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:

  1. check if call using wide variant , change structure accordingly.
  2. check if call using wide variant , use variant instead. easiest option.

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -