I have to pass an array of clusters to a DLL and it doesn't work. The cluster has the following type:
typedef struct __USB_DEVICE_INFO
{
GUID DeviceClass;
LPWSTR szName;
LPWSTR szLocation;
LPWSTR szDeviceInstanceId;
} USB_DEVICE_INFO, *PUSB_DEVICE_INFO;
The DLL function has the following prototype:
USBENUMERATOR_API BOOL WINAPI EnumerateBus
(
HANDLE p_hEnumerator, // (IN) - Handle returned by CreateEnumerator
PUSB_DEVICE_INFO* p_ppResultSet, // (IN) - Pointer to an USB_DEVICE_INFO array
PDWORD p_pdwLength // (IN) - Pointer to location where to store array length
);
In the DLL configuration window I selected 'Handles by Value' and 'Adapt to Type' for the parameters p_ppResultSet and p_PdwLength. The function works somehow, because for the p_pdwLength I get the right value returned (I have a sample c-test program using the same dll).
The problem is the array of clusters, the return-value is an empty cluster.
I pass an array with enough elements (15). The strings in the cluster are initialized with 50 characters. For the GUID I use an extended precicion number (GUID has to bi 128 bit).
Could the problem be, that the function is especting unicode strings (LPWSTR) instead of ASCII strings?
Thanks for any help!
Dave