Windows 8 cannot read HID raw data RRS feed

  • Question

  • I aready had solutions to commnunicate with HID device.

    It has worked well until Windows 7.

    but on windows 8 It makes error ACCESS_DENIED

       hDeviceHandle=CreateFile \
        (detailData->DevicePath, \
        NULL, \
        OPEN_EXISTING, \
        0 , \

    if I elimindate GENERIC_READ, it passed the step. but i could not read the data.

    is it windows 8 bug?

    or is there any other way for windows8?

    Monday, September 24, 2012 10:31 AM


All replies

  • check out the link




    Monday, September 24, 2012 1:40 PM
  • Thank You Chris!
    Monday, September 24, 2012 10:37 PM
  • According to links,  there is not a method or technique for reading data from hid device using "CreateFile" in  hid.dll on Win 8?

    is it right?

    It is very confusing to me.

    if so,why does it work on Win 7 ?

    the softwares that already made with legacy WIN32 API are not available for Win8?

    please find the solution that keep it for Metro and not have to revert to the legacy Win32 API.

    Tuesday, September 25, 2012 12:58 AM
  • The legacy APIs are available on the desktop.  However they are not available from Windows Store apps.  If you have a HID function driver for your own device it is likely possible to get it working...
    Tuesday, September 25, 2012 1:46 AM
  • Dear Eric,

    according to link http://msdn.microsoft.com/en-us/library/windows/hardware/ff538731(v=vs.85).aspx

    in Step CreateFile , it always return invalid handle with GENERIC_READ option.

    error code is ERROR_ACCESS_DENIED

    if I eliminate GENERIC_READ option, it passed the step , but it cannot read data from device.

    this problems are only happened in Windows 8. on windows 7,XP no problems.

    Tuesday, September 25, 2012 2:08 AM
  • what do you mean HID function driver ?

    do you mean that I should make specific driver for our device?

    Tuesday, September 25, 2012 10:26 AM
  • My source is

     GUID Guid;
     HANDLE hDevInfo;
     HANDLE hDeviceHandle;

     HIDD_ATTRIBUTES      Attributes;
     hDevInfo=SetupDiGetClassDevs \
      (&Guid, \
      NULL, \
      NULL, \
     devInfoData.cbSize = sizeof(devInfoData);

     int memberIndex=0;
      BOOL result = SetupDiEnumDeviceInterfaces(hDevInfo,0,&Guid,memberIndex,&devInfoData);

      if(result != 0 )
       ULONG uLength;
       ULONG uRequired;
       result = SetupDiGetDeviceInterfaceDetail(hDevInfo,&devInfoData,NULL,0,&uLength,NULL);
       detailData = (PSP_DEVICE_INTERFACE_DETAIL_DATA) malloc(uLength);
       detailData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);

       result = SetupDiGetDeviceInterfaceDetail(hDevInfo,&devInfoData,detailData,uLength,&uRequired,NULL);
       AfxMessageBox(detailData->DevicePath );

       if(hDeviceHandle == INVALID_HANDLE_VALUE)
        Attributes.Size = sizeof(Attributes);
        result = HidD_GetAttributes(hDeviceHandle,&Attributes);

        CString szS;
        szS.Format(L"vender = %d product = %d",Attributes.VendorID ,Attributes.ProductID );



    Tuesday, September 25, 2012 10:35 AM

    Here is a link to the sample for the HID function driver:


    With regards to the code sample it is not possible to make it work for a Windows Store app.  For a desktop app the Windows 7 code will work.

    Best Wishes - Eric

    Tuesday, September 25, 2012 5:46 PM