It seems to go away if I restart my computer, but it seems absurd that I should have to restart my computer.

It also very quickly reappears.

My application doesn't have any memory leaks (I've checked using wrap malloc and wrap free).

I've registered two RAWINPUTDEVICE elements, both have..
* dwFlags == RIDEV_DEVNOTIFY | RIDEV_INPUTSINK
* hwndTarget != NULL
* usUsagePage == HID_USAGE_PAGE_GENERIC

One has usUsage == HID_USAGE_GENERIC_MOUSE
The other has usUsage == HID_USAGE_GENERIC_KEYBOARD

Here is the GetRawInputData code in the WNDPROC for WM_INPUT..

struct
{
  PRAWINPUT a;
} prawinput = { .a = NULL };

do
{
  struct
  {
    HRAWINPUT a;
  } hrawinput = { .a = (HRAWINPUT)lParam };

  UINT a;
if(GetRawInputData(hrawinput.a, RID_HEADER, NULL, &a, sizeof(RAWINPUTHEADER)) != 0)
  {
    //... //< print GetLastError using FormatMessage
    break;
  }

  prawinput.a = malloc(a);
UINT a = GetRawInputData((HRAWINPUT)lParam, RID_HEADER, prawinput.a, &a, sizeof(RAWINPUTHEADER));
  printf("%u bytes copied into prawinput.a\n", a);
  printf("sizeof(<RAWINPUT>.header) %i\n", sizeof(prawinput.a->header));
  printf("sizeof(<RAWINPUT>.data) %i\n", sizeof(prawinput.a->data));
printf("sizeof(<RAWINPUT>.mouse %i sizeof(<RAWINPUT>.keyboard) %i sizeof(<RAWINPUT>.hid) %i\n", sizeof(prawinput.a->data.mouse), sizeof(prawinput.a->data.keyboard), sizeof(prawinput.a->data.hid));
  if(a == (UINT)-1)
  {
    //... //< print GetLastError using FormatMessage
    break;
  }

printf("<RAWINPUT>->header.hDevice %p\n", prawinput.a->header.hDevice);

  //...
} while(0);
if(prawinput.a != NULL)
{
  free(prawinput.a);
}

Is this a bug in mingw, I am not doing anything different from https://www.codeproject.com/articles/185522/using-the-raw-input-api-to-process-joystick-input in using GetRawInputData, besides using malloc instead of HeapAlloc, which the documentation doesn't mention as a criteria, and the message after the second GetRawInputData prints "24 bytes copied into prawinput.a" if using RID_HEADER and "48 bytes copied into prawinput.a" if using RID_INPUT. In both cases the last message printed is "<RAWINPUT>->header.hDevice 0000000000000000".
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to