| 117 | } |
| 118 | |
| 119 | static int lookup_functions() |
| 120 | { |
| 121 | hid_lib_handle = LoadLibraryW(L"hid.dll"); |
| 122 | if (hid_lib_handle == NULL) { |
| 123 | goto err; |
| 124 | } |
| 125 | |
| 126 | cfgmgr32_lib_handle = LoadLibraryW(L"cfgmgr32.dll"); |
| 127 | if (cfgmgr32_lib_handle == NULL) { |
| 128 | goto err; |
| 129 | } |
| 130 | |
| 131 | #if defined(__GNUC__) |
| 132 | # pragma GCC diagnostic push |
| 133 | # pragma GCC diagnostic ignored "-Wcast-function-type" |
| 134 | #endif |
| 135 | #define RESOLVE(lib_handle, x) x = (x##_)GetProcAddress(lib_handle, #x); if (!x) goto err; |
| 136 | |
| 137 | RESOLVE(hid_lib_handle, HidD_GetHidGuid); |
| 138 | RESOLVE(hid_lib_handle, HidD_GetAttributes); |
| 139 | RESOLVE(hid_lib_handle, HidD_GetSerialNumberString); |
| 140 | RESOLVE(hid_lib_handle, HidD_GetManufacturerString); |
| 141 | RESOLVE(hid_lib_handle, HidD_GetProductString); |
| 142 | RESOLVE(hid_lib_handle, HidD_SetFeature); |
| 143 | RESOLVE(hid_lib_handle, HidD_GetFeature); |
| 144 | RESOLVE(hid_lib_handle, HidD_GetInputReport); |
| 145 | RESOLVE(hid_lib_handle, HidD_GetIndexedString); |
| 146 | RESOLVE(hid_lib_handle, HidD_GetPreparsedData); |
| 147 | RESOLVE(hid_lib_handle, HidD_FreePreparsedData); |
| 148 | RESOLVE(hid_lib_handle, HidP_GetCaps); |
| 149 | RESOLVE(hid_lib_handle, HidD_SetNumInputBuffers); |
| 150 | |
| 151 | RESOLVE(cfgmgr32_lib_handle, CM_Locate_DevNodeW); |
| 152 | RESOLVE(cfgmgr32_lib_handle, CM_Get_Parent); |
| 153 | RESOLVE(cfgmgr32_lib_handle, CM_Get_DevNode_PropertyW); |
| 154 | RESOLVE(cfgmgr32_lib_handle, CM_Get_Device_Interface_PropertyW); |
| 155 | RESOLVE(cfgmgr32_lib_handle, CM_Get_Device_Interface_List_SizeW); |
| 156 | RESOLVE(cfgmgr32_lib_handle, CM_Get_Device_Interface_ListW); |
| 157 | |
| 158 | #undef RESOLVE |
| 159 | #if defined(__GNUC__) |
| 160 | # pragma GCC diagnostic pop |
| 161 | #endif |
| 162 | |
| 163 | return 0; |
| 164 | |
| 165 | err: |
| 166 | free_library_handles(); |
| 167 | return -1; |
| 168 | } |
| 169 | |
| 170 | #endif /* HIDAPI_USE_DDK */ |
| 171 |
no test coverage detected