My issue isn't so much with the function as it is to do with the data after the function returns...
1 2 3 4 5 6 7 8 9 10 11
|
SetupDiGetDeviceInterfacePropertyW(
_In_ HDEVINFO DeviceInfoSet,
_In_ PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
_In_ CONST DEVPROPKEY * PropertyKey,
_Out_ DEVPROPTYPE * PropertyType,
_Out_writes_bytes_to_opt_(PropertyBufferSize, *RequiredSize) PBYTE PropertyBuffer,
_In_ DWORD PropertyBufferSize,
_Out_opt_ PDWORD RequiredSize,
_In_ DWORD Flags
);
|
I have all verifiable good working parameters but it uses the DEVPROPTYPE which is supposed to clue you in as to what to do with the data after its populated the buffer. (or possiby before when making the buffer)
the property types are defined like so
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#define DEVPROP_TYPE_EMPTY 0x00000000 // nothing, no property data
#define DEVPROP_TYPE_NULL 0x00000001 // null property data
#define DEVPROP_TYPE_SBYTE 0x00000002 // 8-bit signed int (SBYTE)
#define DEVPROP_TYPE_BYTE 0x00000003 // 8-bit unsigned int (BYTE)
#define DEVPROP_TYPE_INT16 0x00000004 // 16-bit signed int (SHORT)
#define DEVPROP_TYPE_UINT16 0x00000005 // 16-bit unsigned int (USHORT)
#define DEVPROP_TYPE_INT32 0x00000006 // 32-bit signed int (LONG)
#define DEVPROP_TYPE_UINT32 0x00000007 // 32-bit unsigned int (ULONG)
#define DEVPROP_TYPE_INT64 0x00000008 // 64-bit signed int (LONG64)
#define DEVPROP_TYPE_UINT64 0x00000009 // 64-bit unsigned int (ULONG64)
#define DEVPROP_TYPE_FLOAT 0x0000000A // 32-bit floating-point (FLOAT)
#define DEVPROP_TYPE_DOUBLE 0x0000000B // 64-bit floating-point (DOUBLE)
#define DEVPROP_TYPE_DECIMAL 0x0000000C // 128-bit data (DECIMAL)
|
my question is do i need to drag the whole list into my code and make some type of enum or can i use these keywords in like a template function that takes the keyword as the type, have it do the converstion and have the return be a template as well... just kinda stuck. I believe that i've attempted to cast to the DEVPROPTYPE and that was a bust. I tried a few things and then just kinda gave up and moved on but now i'm begining to think that this is the KEY to what i'm trying to accomplish...but i could be wrong.
Also just to set the record straight, I'm well aware that this function needs to be called twice, first gives you the size of the buffer needed and the DEVPROPTYPE value. that way you can prepare the buffer properly, then you have to call it again to actually fill the buffer.
I guess if worse comes to worst i can put them in a vector and loop through and do comparisons... but Im assuming there has to be an easier way to go about this. I'd also like to say that the list of Proptypes is much longer i just posted like a third of the list