tarik yilgin


my project for usb hid comunication.

i need my defined variable memory adress for "SetupDiGetDeviceInterfaceDetail" api on "setupapi.dll" in 3. parameter

sample for vbasic,
Result = SetupDiGetDeviceInterfaceDetail ( DeviceInfoSet, _
MyDeviceInterfaceData , _
VarPtr( DetailDataBuffer(0)) ,_
DetailData, Needed, 0)

or how to define long data type pointer for string variable

Thanks.




Re: how to learn variable memory adress ???

CetinBasoz


Tarik,

Pass string by address.

local lcDataBuffer

lcDataBuffer = replicate(chr(0), nDesiredlen)

* set cbSize parameter

...( ... MyDeviceInterfaceData, @lcDataBuffer, ... )






Re: how to learn variable memory adress ???

tarik yilgin

hi,

if send my string data this method to api, sending data type is string, but api waiting for long data type

Thaks for ansver..






Re: how to learn variable memory adress ???

AndyKr

If you need to pass a numeric value, then just initialize the buffer accordingly. You still pass it the same way (by reference)

local lnBuffer

lnBuffer = 0

MyDeviceInterfaceData, @lnBuffer, ...






Re: how to learn variable memory adress ???

CetinBasoz

Please read documentation before making assumptions. At least read documentation of that API call, here it is for you:

WINSETUPAPI BOOL WINAPI
SetupDiGetDeviceInterfaceDetail(
IN HDEVINFO DeviceInfoSet,
IN PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
OUT PSP_DEVICE_INTERFACE_DETAIL_DATA DeviceInterfaceDetailData, OPTIONAL
IN DWORD DeviceInterfaceDetailDataSize,
OUT PDWORD RequiredSize, OPTIONAL
OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL
);

DeviceInterfaceDetailData
Optionally points to a caller-allocated SP_DEVICE_INTERFACE_DETAIL_DATA structure to receive information about the specified interface. The caller must set DeviceInterfaceDetailData.cbSize to sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA) before calling this function. The cbSize field always contains the size of the fixed part of the data structure, not a size reflecting the variable-length string at the end.

This parameter must be NULL if DeviceInterfaceDetailSize is zero.





Re: how to learn variable memory adress ???

CetinBasoz

If you need to pass the pointer to the address then try this:

Code Snippet

DECLARE integer GetProcessHeap IN WIN32API
DECLARE integer HeapAlloc IN WIN32API integer hHeap, integer dwFlags, integer dwBytes
DECLARE integer HeapFree IN WIN32API integer hHeap, integer dwFlags, integer lpMem

lcString = "hello"+CHR(0)
pHeap = GetProcessHeap()
nHeapAddress = HeapAlloc(m.pHeap, 0, LEN(m.lcString))
SYS(2600,m.nHeapAddress, LEN(m.lcString),m.lcString)
* m.nHeapAddress is integer pointer here
HeapFree(m.pHeap,0,m.nHeapAddress)





Re: how to learn variable memory adress ???

tarik yilgin

Thanks,