| 201 | } |
| 202 | |
| 203 | static void register_error(hid_device *device, const char *op) |
| 204 | { |
| 205 | WCHAR *ptr, *msg; |
| 206 | |
| 207 | DWORD count = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | |
| 208 | FORMAT_MESSAGE_FROM_SYSTEM | |
| 209 | FORMAT_MESSAGE_IGNORE_INSERTS, |
| 210 | NULL, |
| 211 | GetLastError(), |
| 212 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
| 213 | (LPWSTR)&msg, 0/*sz*/, |
| 214 | NULL); |
| 215 | if (!count) |
| 216 | return; |
| 217 | |
| 218 | /* Get rid of the CR and LF that FormatMessage() sticks at the |
| 219 | end of the message. Thanks Microsoft! */ |
| 220 | ptr = msg; |
| 221 | while (*ptr) { |
| 222 | if (*ptr == '\r') { |
| 223 | *ptr = 0x0000; |
| 224 | break; |
| 225 | } |
| 226 | ptr++; |
| 227 | } |
| 228 | |
| 229 | /* Store the message off in the Device entry so that |
| 230 | the hid_error() function can pick it up. */ |
| 231 | LocalFree(device->last_error_str); |
| 232 | device->last_error_str = msg; |
| 233 | } |
| 234 | |
| 235 | #ifndef HIDAPI_USE_DDK |
| 236 | static int lookup_functions() |
no outgoing calls
no test coverage detected