Home > USB Central > HID Page > HID Code Comments
HID Code Comments
Various comments on my HID code. I haven't implemented these changes in the online code.
Suggested changes for 64 bits
In FileIO, use:
internal static extern SafeFileHandle CreateFile(String lpFileName, UInt32 dwDesiredAccess, Int32 dwShareMode, IntPtr lpSecurityAttributes, Int32 dwCreationDisposition, Int32 dwFlagsAndAttributes, IntPtr hTemplateFile);
In DeviceManagement, use:
internal static extern Int32 SetupDiCreateDeviceInfoList(ref Guid ClassGuid, IntPtr hwndParent);
In DeviceManagement.cs, change:
IntPtr pDevicePathName = new IntPtr(detailDataBuffer.ToInt32() + 4);
to:
IntPtr pDevicePathName = detailDataBuffer + 4;
Bug in DeviceNameMatch routine if the charset isn't English
In this routine:
internal Boolean DeviceNameMatch(Message m, String mydevicePathName)
in DeviceManagement.cs, when using the installed culture, string.compare returns false even it compares identical strings.
Change:
if ((String.Compare(DeviceNameString, mydevicePathName, true) == 0))
to:
if ((String.Compare(DeviceNameString, mydevicePathName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))
