-
Notifications
You must be signed in to change notification settings - Fork 1
/
fix_name.c
46 lines (43 loc) · 1.57 KB
/
fix_name.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "ftd2xx.h"
#include "config.h"
FTD2XX_API FT_STATUS WINAPI FT_ListDevices(PVOID pvArg1, PVOID pvArg2, DWORD dwFlags)
{
FT_STATUS (*f)(PVOID pvArg1, PVOID pvArg2, DWORD dwFlags) = realSym(__FUNCTION__);
FT_STATUS r = f(pvArg1, pvArg2, dwFlags);
if (r != FT_OK)
return r;
if (!(dwFlags & FT_LIST_ALL))
return r;
char **ids = pvArg1;
DWORD num = *((DWORD *)pvArg2);
for (DWORD i = 0; i < num; i++)
fillId(ids[i]);
return r;
}
FTD2XX_API FT_STATUS WINAPI FT_GetDeviceInfoDetail(DWORD dwIndex, LPDWORD lpdwFlags, LPDWORD lpdwType, LPDWORD lpdwID,
LPDWORD lpdwLocId, LPVOID lpSerialNumber, LPVOID lpDescription,
FT_HANDLE *pftHandle)
{
FT_STATUS(*f)
(DWORD dwIndex, LPDWORD lpdwFlags, LPDWORD lpdwType, LPDWORD lpdwID, LPDWORD lpdwLocId, LPVOID lpSerialNumber,
LPVOID lpDescription, FT_HANDLE * pftHandle) = realSym(__FUNCTION__);
FT_STATUS r = f(dwIndex, lpdwFlags, lpdwType, lpdwID, lpdwLocId, lpSerialNumber, lpDescription, pftHandle);
if (r != FT_OK)
return r;
fillId(lpDescription);
fillSerial(lpSerialNumber);
return r;
}
FTD2XX_API FT_STATUS WINAPI FT_GetDeviceInfo(FT_HANDLE ftHandle, FT_DEVICE *lpftDevice, LPDWORD lpdwID,
PCHAR pcSerialNumber, PCHAR pcDescription, LPVOID pvDummy)
{
FT_STATUS(*f)
(FT_HANDLE ftHandle, FT_DEVICE * lpftDevice, LPDWORD lpdwID, PCHAR pcSerialNumber, PCHAR pcDescription,
LPVOID pvDummy) = realSym(__FUNCTION__);
FT_STATUS r = f(ftHandle, lpftDevice, lpdwID, pcSerialNumber, pcDescription, pvDummy);
if (r != FT_OK)
return r;
fillId(pcDescription);
fillSerial(pcSerialNumber);
return r;
}