Freigeben über


Эта страшная функция GetRawInputDeviceList.

??????? GetRawInputDeviceList ????? ????? ????????? ? ???????? ??????????? ????????? ????????????????? API. ??? ??????? ???????????? ??? ????????? ?????? ?????????? ????????? ????? (raw input devices). ?????? ????????. ???????? ??????? ???? ???????? ???????? ??????? – ????? ??? ?????????, ?, ??? ??????? ?? ??????, ?????????? ??????? ???????? ????????.

 UINT GetRawInputDeviceList(
    __out_opt PRAWINPUTDEVICELIST pRawInputDeviceList,
    __inout PUINT puiNumDevices,
    __in UINT cbSize
    );

??? ??????????? ?????? ????????????, ????? ?????? ???????? MSDN. ?????? ???????? – ??? ?????? ????????? ?? ?????, ? ??????? ??????? ?????? ???????? RAWINPUTDEVICELIST. ???? ??? ?????????. ? ??? ?????? ???????? – ??? ?????. ????:

Pointer to a variable. If pRawInputDeviceList is NULL, it specifies the number of devices attached to the system. Otherwise, it contains the size, in bytes, of the preallocated buffer pointed to by pRawInputDeviceList. However, if *puiNumDevices is smaller than needed to contain RAWINPUTDEVICELIST structures, the required buffer size is returned here.

??? ????????? ?? ??????????. ???? ?????????? ????????? pRawInputDeviceList ????? NULL, ?? ? ???? ?????????? ???????????? ?????????? ?????????, ?.?. ?????????? ????????? ???????. ???? pRawInputDeviceList ?? ????? NULL, ?? ??? ?????????? ?????? ?????? ?????? ?? ??????? ????????? pRawInputDeviceList ? ?????? . ???? ??? ???? ????? ???????? ??????? ???, ?? ??????? ????????? ? ???? ?????????? ??????????? ?????? ?????? ? ?????? .

?.?. ??? ??????????. ??? ?????? ?????? ??????? ??????????? ?????? ?????? ???????????? ? ???? ?????????? ????????? ???????. ?? ????? ??????? ?????? ???? ?? ?????? ??? ??????????? ? ??????, ????????? ????????????? ??? ????????? «puiNumDevices».

?????? ???????? ?????? ?????? ????????? RAWINPUTDEVICELIST. ?? ???? ???? ???????? ?????? ?????? ???? ????? sizeof(RAWINPUTDEVICELIST)! ???????????? ???? ???????? ????? ?????????????? ??? ????????? ?????? ?????? RAWINPUTDEVICELIST, ?? ? ????? ?????????? ? puiNumDevices, ???? ?????? ??????? ????????.

?? ? ??? ??? ?? ???. ????????????? ????????????? ???????? ???? ?? ????????. ??? ???????? ?????????? ???????, ???????????? ???????? ????? ????, ???? pRawInputDeviceList ????? NULL. ???? pRawInputDeviceList ?? ????? NULL, ?? ??????? ?????????? ?????????? ????????? ?????????? ? ?????. ??? ?????? ?????? ?????????? ?????????? ????????? – ?? ???????. ???? ??????? ??????????? ???????, ?? ?????? ???????????? -1. ???? ??????? ?????? – ????????????? ?????? ??????, ?? *puiNumDevices ??????????? ??????????? ??????.

??? ?????????, ???????? ??? ??????? ? ???????? ??? ?????? ?? ??????. ?????????? ?????????? ???? ? ????????? ??????? ?????? ? ?????? ????????, ????????? ????????????? ????????????? ???????? ? ?????? ???????? ????????:

 BOOL GetRawInputDeviceList(
    __out_opt PRAWINPUTDEVICELIST pBuffer,
    __inout PUINT puiNumDevices
    );

PS: ?????? ?? ???????????, ?????? ??? ?? ??????? ? ?????? ??????. ?????? ?????????.

Cross-posted from blog.not-a-kernel-guy.com.