delphi - TJvHidDeviceController "DevicePath" always showing "\" -
i'm using tjvhiddevicecontroller class retrive hid device information. have plugged 2 hid devices, i'm trying ge "devicepath" of sp_device_interface_detail_data_a structure getting device path '\'. ican't open createfile function. please me solve issue. os win7. all.
this guessing!
the 1 thing can think of is:
tjvhiddevicecontroller calls windows api call without using or w suffix. structure used sp_device_interface_detail_data_a, ansi version. now, if use delphi 2009 or higher, routine expect sp_device_interface_detail_data_w. size same looks ok. strings stored usc2 encoded (widechars) instead of ansi encoded -> after every ansi character there null byte. tjvhiddevicecontroller converts character array pascal string using function strpas , hence, see first character.
check: set breakpoint after function call fills structure , use cpu window view content memory dump. if see ansi characters every other byte , null bytes in between, can confirm above scenario case.
solution:
- check if call using wide variant , change structure accordingly.
- check if call using wide variant , use variant instead. easiest option.
Comments
Post a Comment