From fd9226418caa1190137931b60fcdcae7dc6cf991 Mon Sep 17 00:00:00 2001 From: ufrisk Date: Wed, 13 Oct 2021 23:06:16 +0200 Subject: [PATCH] Version 2.9 --- README.md | 5 +- includes/lib32/leechcore.lib | Bin 5360 -> 5360 bytes includes/lib64/leechcore.lib | Bin 5268 -> 5268 bytes leechagent/version.h | 6 +- leechcore/device_fpga.c | 266 ++++++++++++++++++++++++++++++++--- leechcore/leechcore.c | 4 +- leechcore/oscompatibility.c | 3 + leechcore/version.h | 6 +- leechcorepyc/pkggen_linux.sh | 2 +- leechcorepyc/version.h | 6 +- 10 files changed, 262 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 63c7f74..df5c0d1 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,6 @@ v1.0-1.8 * Bug fixes. * Updates to support MemProcFS v4. * Separate releases for Windows and Linux. - [v2.7](https://github.com/ufrisk/LeechCore/releases/tag/v2.7) * Bug fixes. @@ -180,3 +179,7 @@ v1.0-1.8 * Bug fixes. * 32-bit support. * Support for Active Memory and Full Bitmap Microsoft Crash Dump files. + + +[v2.9](https://github.com/ufrisk/LeechCore/releases/tag/v2.9) +* Support for the FT2232H USB2 chip. diff --git a/includes/lib32/leechcore.lib b/includes/lib32/leechcore.lib index 7b390f27189f9adf8fde0a7a966fd2d2b5e79ae6..4cb9db5fcfd477dfb8367b1092424da1ad89783c 100644 GIT binary patch delta 101 zcmeyM`9X7o69?zfT`_0*85tNjCf9OFPrkq{J-LyioN>qGpByoaJ2r=L$}zI)YOKDt zd-6tZ`N=c5vcOUroDRwPxdnQeDLW>ca91*`@P3=TfqN5JPG)jF4+l_d2TukE0BYzZ A5dZ)H delta 101 zcmeyM`9X7o69;FVfZH#AMg|6s$+cY4lP_>fPj2KWXWTmZCr1q9*3Ds@a*V8JW-{ A2LJ#7 diff --git a/includes/lib64/leechcore.lib b/includes/lib64/leechcore.lib index cde454c05228dce63c91e2ae398e06a7f376e110..68495ee650b1b9b78781874b69c796900a7aecac 100644 GIT binary patch delta 106 zcmbQDIYo2BH+If$xjA?F85tNjCL3}|PnP1C#JFSfT8)brNl%{7T@F^If>5RGxsO!a>)brNl%{7T@F^If>5qwDeviceIndex)) { + if(DeviceFPGA_Initialize_LinuxMultiHandle_LockCheck(ctx->qwDeviceIndex)) { szErrorReason = "FPGA linux handle already open"; goto fail; } @@ -873,13 +887,13 @@ LPSTR DeviceFPGA_InitializeFTDI(_In_ PDEVICE_CONTEXT_FPGA ctx) ctx->dev.hModule = NULL; ctx->dev.hFTDI = NULL; Sleep(3000); - return DeviceFPGA_InitializeFTDI(ctx); + return DeviceFPGA_InitializeFT601(ctx); } ctx->async.fEnabled = ctx->dev.pfnFT_GetOverlappedResult && ctx->dev.pfnFT_InitializeOverlapped && ctx->dev.pfnFT_ReleaseOverlapped && !ctx->dev.pfnFT_InitializeOverlapped(ctx->dev.hFTDI, &ctx->async.oOverlapped); ctx->dev.fInitialized = TRUE; - DeviceFPGA_InitializeFTDI_LinuxMultiHandle_LockAcquire(ctx->qwDeviceIndex); + DeviceFPGA_Initialize_LinuxMultiHandle_LockAcquire(ctx->qwDeviceIndex); return NULL; fail: if(ctx->dev.hFTDI && ctx->dev.pfnFT_Close) { ctx->dev.pfnFT_Close(ctx->dev.hFTDI); } @@ -889,13 +903,210 @@ LPSTR DeviceFPGA_InitializeFTDI(_In_ PDEVICE_CONTEXT_FPGA ctx) return szErrorReason; } -VOID DeviceFPGA_ReInitializeFTDI(_In_ PDEVICE_CONTEXT_FPGA ctx) +//------------------------------------------------------------------------------- +// FT2232H/FT245 connectivity implementation below: +//------------------------------------------------------------------------------- + +typedef struct tdFT2232H_HANDLE { + HANDLE ftHandle; + ULONG(WINAPI *pfnFT_Close)(HANDLE ftHandle); + ULONG(WINAPI *pfnFT_GetStatus)(HANDLE ftHandle, DWORD *dwRxBytes, DWORD *dwTxBytes, DWORD *dwEventDWord); + ULONG(WINAPI *pfnFT_Read)(HANDLE ftHandle, PVOID lpBuffer, DWORD dwBytesToRead, LPDWORD lpBytesReturned); + ULONG(WINAPI *pfnFT_Write)(HANDLE ftHandle, PVOID lpBuffer, DWORD dwBytesToWrite, LPDWORD lpBytesWritten); +} FT2232H_HANDLE, *PFT2232H_HANDLE; + +/* +* Emulate FT601 Close for FT2232H. +*/ +ULONG WINAPI DeviceFPGA_FT2232_FT60x_FT_Close(HANDLE ftHandleEx) +{ + PFT2232H_HANDLE hFT2232H = (PFT2232H_HANDLE)ftHandleEx; + ULONG status = hFT2232H->pfnFT_Close(hFT2232H->ftHandle); + LocalFree(ftHandleEx); + return status; +} + +/* +* Dummy function to keep compatibility with FT601 calls. +*/ +ULONG WINAPI DeviceFPGA_FT2232_FT60x_FT_AbortPipe(HANDLE ftHandleEx, UCHAR ucPipeID) { - // called to try to recover link in case of instable devices. - ctx->dev.pfnFT_Close(ctx->dev.hFTDI); + return 0; +} + +/* +* Emulate FT601 ReadPipe for FT2232H. +*/ +ULONG WINAPI DeviceFPGA_FT2232_FT60x_FT_ReadPipe(HANDLE ftHandleEx, UCHAR ucPipeID, PUCHAR pucBuffer, ULONG ulBufferLength, PULONG pulBytesTransferred, PVOID pOverlapped) +{ + PFT2232H_HANDLE hFT2232H = (PFT2232H_HANDLE)ftHandleEx; + ULONG iRetry, status = 0, cbRead = 0, cbReadTotal = 0, cbRx, cbTx, dwEventStatus; + *pulBytesTransferred = 0; + if(ulBufferLength == 0x00103000) { + // "fake" ASYNC MODE always calls with a 0x103 page buffer in FT2232H mode. + status = hFT2232H->pfnFT_GetStatus(hFT2232H->ftHandle, &cbRx, &cbTx, &dwEventStatus); + if(status) { return status; } + if(cbRx) { + return hFT2232H->pfnFT_Read(hFT2232H->ftHandle, pucBuffer, min(cbRx, ulBufferLength), pulBytesTransferred); + } + usleep(125); + return 0; + } + // "NORMAL" MODE: + while(TRUE) { + cbRx = 0; + iRetry = 0; + while(!cbRx) { + status = hFT2232H->pfnFT_GetStatus(hFT2232H->ftHandle, &cbRx, &cbTx, &dwEventStatus); + if(cbRx) { break; } + if(status || iRetry > 15) { break; } + iRetry++; + usleep(120); + } + status = hFT2232H->pfnFT_Read(hFT2232H->ftHandle, pucBuffer + cbReadTotal, min(cbRx, ulBufferLength - cbReadTotal), &cbRead); + if(status || !cbRead) { break; } + cbReadTotal += cbRead; + if(cbReadTotal >= ulBufferLength) { break; } + } + *pulBytesTransferred = cbReadTotal; + return status; +} + +/* +* Emulate FT601 WritePipe for FT2232H. +*/ +ULONG WINAPI DeviceFPGA_FT2232_FT60x_FT_WritePipe(HANDLE ftHandleEx, UCHAR ucPipeID, PUCHAR pucBuffer, ULONG ulBufferLength, PULONG pulBytesTransferred, PVOID pOverlapped) +{ + PFT2232H_HANDLE hFT2232H = (PFT2232H_HANDLE)ftHandleEx; + return hFT2232H->pfnFT_Write(hFT2232H->ftHandle, pucBuffer, ulBufferLength, pulBytesTransferred); +} + +/* +* Initialize FT2232H with FT245 synchrouous FIFO. +*/ +LPSTR DeviceFPGA_InitializeFT2232(_In_ PDEVICE_CONTEXT_FPGA ctx) +{ + DWORD status; + LPSTR szErrorReason; + CHAR szModuleFTDI[MAX_PATH + 1] = { 0 }; + UCHAR ucMask = 0xff, ucMode0 = 0, ucMode1 = 0x40; + PFT2232H_HANDLE hFT2232H = NULL; + ULONG(WINAPI *pfnFT_Open)(int deviceNumber, HANDLE *pHandle); + ULONG(WINAPI *pfnFT_ResetDevice)(HANDLE ftHandle); + ULONG(WINAPI *pfnFT_SetBitMode)(HANDLE ftHandle, UCHAR ucMask, UCHAR ucEnable); + ULONG(WINAPI *pfnFT_SetLatencyTimer)(HANDLE ftHandle, UCHAR ucLatency); + ULONG(WINAPI *pfnFT_SetUSBParameters)(HANDLE ftHandle, ULONG ulInTransferSize, ULONG ulOutTransferSize); + ULONG(WINAPI *pfnFT_SetFlowControl)(HANDLE ftHandle, USHORT FlowControl, UCHAR XonChar, UCHAR XoffChar); + if(DeviceFPGA_Initialize_LinuxMultiHandle_LockCheck(ctx->qwDeviceIndex)) { + szErrorReason = "FPGA linux handle already open"; + goto fail; + } + // Load FTDI Library + ctx->dev.hModule = LoadLibraryA("FTD2XX.dll"); + if(!ctx->dev.hModule) { + Util_GetPathLib(szModuleFTDI); + strcat_s(szModuleFTDI, sizeof(szModuleFTDI) - 1, "FTD2XX.dll / libftd2xx.so"); + ctx->dev.hModule = LoadLibraryA(szModuleFTDI); + } + if(!ctx->dev.hModule) { + szErrorReason = "Unable to load FTD2XX.dll / libftd2xx.so"; + goto fail; + } + // Assign FT601 compatibility functions to device object: + ctx->dev.pfnFT_AbortPipe = DeviceFPGA_FT2232_FT60x_FT_AbortPipe; + ctx->dev.pfnFT_Close = DeviceFPGA_FT2232_FT60x_FT_Close; + ctx->dev.pfnFT_ReadPipe = DeviceFPGA_FT2232_FT60x_FT_ReadPipe; + ctx->dev.pfnFT_WritePipe = DeviceFPGA_FT2232_FT60x_FT_WritePipe; + // Allocate and assign "extended" ftHandle to device object [free by pfnFT_Close()]. + // Also assign required function pointers. + if(!(hFT2232H = LocalAlloc(LMEM_ZEROINIT, sizeof(FT2232H_HANDLE)))) { + szErrorReason = "OOM"; + goto fail; + } + ctx->dev.hFTDI = (HANDLE)hFT2232H; + hFT2232H->pfnFT_GetStatus = (ULONG(WINAPI *)(HANDLE, DWORD*, DWORD*, DWORD*)) + GetProcAddress(ctx->dev.hModule, "FT_GetStatus"); + hFT2232H->pfnFT_Read = (ULONG(WINAPI *)(HANDLE, PVOID, DWORD, LPDWORD)) + GetProcAddress(ctx->dev.hModule, "FT_Read"); + hFT2232H->pfnFT_Write = (ULONG(WINAPI *)(HANDLE, PVOID, DWORD, LPDWORD)) + GetProcAddress(ctx->dev.hModule, "FT_Write"); + hFT2232H->pfnFT_Close = (ULONG(WINAPI *)(HANDLE)) + GetProcAddress(ctx->dev.hModule, "FT_Close"); + if(!hFT2232H->pfnFT_GetStatus || !hFT2232H->pfnFT_Read || !hFT2232H->pfnFT_Write || !hFT2232H->pfnFT_Close) { + szErrorReason = "Unable to retrieve required functions from FTD2XX.dll"; + goto fail; + } + // Retrieve required function-local function pointers from FTDI library: + pfnFT_Open = (ULONG(WINAPI *)(int, HANDLE*)) + GetProcAddress(ctx->dev.hModule, "FT_Open"); + pfnFT_ResetDevice = (ULONG(WINAPI *)(HANDLE)) + GetProcAddress(ctx->dev.hModule, "FT_ResetDevice"); + pfnFT_SetBitMode = (ULONG(WINAPI *)(HANDLE, UCHAR, UCHAR)) + GetProcAddress(ctx->dev.hModule, "FT_SetBitMode"); + pfnFT_SetLatencyTimer = (ULONG(WINAPI *)(HANDLE, UCHAR)) + GetProcAddress(ctx->dev.hModule, "FT_SetLatencyTimer"); + pfnFT_SetUSBParameters = (ULONG(WINAPI *)(HANDLE, ULONG, ULONG)) + GetProcAddress(ctx->dev.hModule, "FT_SetUSBParameters"); + pfnFT_SetFlowControl = (ULONG(WINAPI *)(HANDLE, USHORT, UCHAR, UCHAR)) + GetProcAddress(ctx->dev.hModule, "FT_SetFlowControl"); + if(!pfnFT_Open || !pfnFT_ResetDevice || !pfnFT_SetBitMode || !pfnFT_SetLatencyTimer || !pfnFT_SetUSBParameters || !pfnFT_SetFlowControl) { + szErrorReason = "Unable to retrieve required functions from FTD2XX.dll"; + goto fail; + } + // Open FTDI + status = pfnFT_Open((int)ctx->qwDeviceIndex, &hFT2232H->ftHandle); + if(status || !hFT2232H->ftHandle) { + szErrorReason = "Unable to connect to USB/FT2232H device"; + goto fail; + } + // Reset, set FT245 mode and performance options: + if(pfnFT_ResetDevice(hFT2232H->ftHandle)) { + szErrorReason = "FT_ResetDevice failed."; + goto fail; + } + pfnFT_SetBitMode(hFT2232H->ftHandle, ucMask, ucMode0); + if(pfnFT_SetBitMode(hFT2232H->ftHandle, ucMask, ucMode1)) { + szErrorReason = "FT_SetBitMode failed."; + goto fail; + } + if(pfnFT_SetLatencyTimer(hFT2232H->ftHandle, 2)) { + szErrorReason = "FT_SetLatencyTimer failed."; + goto fail; + } + if(pfnFT_SetUSBParameters(hFT2232H->ftHandle, 0x10000, 0x10000)) { + szErrorReason = "FT_SetUSBParameters failed."; + goto fail; + } + if(pfnFT_SetFlowControl(hFT2232H->ftHandle, 0x0100 /* FT_FLOW_RTS_CTS */, 0x0, 0x0)) { + szErrorReason = "FT_SetFlowControl failed."; + goto fail; + } + ctx->dev.f2232h = TRUE; + ctx->async.fEnabled = TRUE; + ctx->dev.fInitialized = TRUE; + DeviceFPGA_Initialize_LinuxMultiHandle_LockAcquire(ctx->qwDeviceIndex); + return NULL; +fail: + if(ctx->dev.hFTDI && ctx->dev.pfnFT_Close) { ctx->dev.pfnFT_Close(ctx->dev.hFTDI); } + if(ctx->dev.hModule) { FreeLibrary(ctx->dev.hModule); } + ctx->dev.hModule = NULL; ctx->dev.hFTDI = NULL; - Sleep(250); - ctx->dev.pfnFT_Create((PVOID)ctx->qwDeviceIndex, 0x10 /*FT_OPEN_BY_INDEX*/, &ctx->dev.hFTDI); + return szErrorReason; +} + +//------------------------------------------------------------------------------- +// FPGA implementation below: +//------------------------------------------------------------------------------- + +VOID DeviceFPGA_ReInitializeFTDI(_In_ PDEVICE_CONTEXT_FPGA ctx) +{ + // called to try to recover link in case of unstable devices. + if(ctx->dev.pfnFT_Create) { + ctx->dev.pfnFT_Close(ctx->dev.hFTDI); + ctx->dev.hFTDI = NULL; + Sleep(250); + ctx->dev.pfnFT_Create((PVOID)ctx->qwDeviceIndex, 0x10 /*FT_OPEN_BY_INDEX*/, &ctx->dev.hFTDI); + } } VOID DeviceFPGA_Close(_Inout_ PLC_CONTEXT ctxLC) @@ -903,7 +1114,7 @@ VOID DeviceFPGA_Close(_Inout_ PLC_CONTEXT ctxLC) PDEVICE_CONTEXT_FPGA ctx = (PDEVICE_CONTEXT_FPGA)ctxLC->hDevice; DWORD cbTMP; if(!ctx) { return; } - if(ctx->async.fEnabled) { + if(ctx->async.fEnabled && ctx->dev.pfnFT_GetOverlappedResult) { ctx->dev.pfnFT_GetOverlappedResult(ctx->dev.hFTDI, &ctx->async.oOverlapped, &cbTMP, TRUE); } if(ctx->dev.pfnFT_ReleaseOverlapped && ctx->async.fEnabled) { @@ -914,7 +1125,7 @@ VOID DeviceFPGA_Close(_Inout_ PLC_CONTEXT ctxLC) #endif /* WIN32 */ if(ctx->dev.hFTDI) { ctx->dev.pfnFT_Close(ctx->dev.hFTDI); - DeviceFPGA_InitializeFTDI_LinuxMultiHandle_LockRelease(ctx->qwDeviceIndex); + DeviceFPGA_Initialize_LinuxMultiHandle_LockRelease(ctx->qwDeviceIndex); } if(ctx->dev.hModule) { FreeLibrary(ctx->dev.hModule); } #ifdef WIN32 @@ -1760,11 +1971,15 @@ VOID DeviceFPGA_RxTlpAsynchronous(_In_ PLC_CONTEXT ctxLC, _In_ PDEVICE_CONTEXT_F if(prxbuf) { cbReadMax = min(0x10000, max(0x1000, (cbBytesToRead - prxbuf->cbReadTotal) << 1)); } + if(ctx->dev.f2232h) { + cbReadMax = 0x00103000; // "fake" async buffer magic value in FT2232H mode + fAsync = FALSE; + } usleep(25); status = ctx->dev.pfnFT_ReadPipe(ctx->dev.hFTDI, 0x82, pbBuffer, cbReadMax, &cbRead, NULL); if(status && (status != FT_IO_PENDING)) { return; } while(TRUE) { - cEmptyRead = (cbRead == 0x14) ? cEmptyRead + 1 : 0; + cEmptyRead = ((cbRead == 0) || (cbRead == 0x14)) ? cEmptyRead + 1 : 0; if(cEmptyRead >= 0x30) { break; } cbBuffer += cbRead; // 1: submit async read (if target read is large enough to gain from it) @@ -1804,7 +2019,8 @@ VOID DeviceFPGA_RxTlpSynchronous(_In_ PLC_CONTEXT ctxLC, _In_ PDEVICE_CONTEXT_FP PDWORD pdwTlp = (PDWORD)pbTlp; DWORD dwStatus, *pdwData; // larger read buffer slows down FT_ReadPipe so set it fairly tight if possible. - cbReadRxBuf = min(ctx->rxbuf.cbMax, dwBytesToRead ? max(0x4000, (0x1000 + dwBytesToRead + (dwBytesToRead >> 1))) : (DWORD)-1); + cbReadRxBuf = ctx->dev.f2232h ? ctx->rxbuf.cbMax : + min(ctx->rxbuf.cbMax, dwBytesToRead ? max(0x4000, (0x1000 + dwBytesToRead + (dwBytesToRead >> 1))) : (DWORD)-1); status = ctx->dev.pfnFT_ReadPipe(ctx->dev.hFTDI, 0x82, ctx->rxbuf.pb, cbReadRxBuf, &ctx->rxbuf.cb, NULL); if(status == 0x20 && ctx->perf.RETRY_ON_ERROR) { DeviceFPGA_ReInitializeFTDI(ctx); // try recovery if possible. @@ -2414,6 +2630,7 @@ BOOL DeviceFPGA_SetOption(_In_ PLC_CONTEXT ctxLC, _In_ QWORD fOption, _In_ QWORD } #define FPGA_PARAMETER_UDP_ADDRESS "ip" +#define FPGA_PARAMETER_FT2232H "ft2232h" #define FPGA_PARAMETER_PCIE "pciegen" #define FPGA_PARAMETER_PCIE_NOCONNECT "pcienotconnected" #define FPGA_PARAMETER_RESTART_DEVICE "devreload" @@ -2436,19 +2653,22 @@ BOOL DeviceFPGA_Open(_Inout_ PLC_CONTEXT ctxLC, _Out_opt_ PPLC_CONFIG_ERRORINFO QWORD v; LPSTR szDeviceError; PDEVICE_CONTEXT_FPGA ctx; - PLC_DEVICE_PARAMETER_ENTRY pIpParam; + PLC_DEVICE_PARAMETER_ENTRY pParam; if(ppLcCreateErrorInfo) { *ppLcCreateErrorInfo = NULL; } ctx = LocalAlloc(LMEM_ZEROINIT, sizeof(DEVICE_CONTEXT_FPGA)); if(!ctx) { return FALSE; } ctxLC->hDevice = (HANDLE)ctx; - if((pIpParam = LcDeviceParameterGet(ctxLC, FPGA_PARAMETER_UDP_ADDRESS)) && pIpParam->szValue) { - dwIpAddr = inet_addr(pIpParam->szValue); + if((pParam = LcDeviceParameterGet(ctxLC, FPGA_PARAMETER_UDP_ADDRESS)) && pParam->szValue) { + dwIpAddr = inet_addr(pParam->szValue); szDeviceError = ((dwIpAddr == 0) || (dwIpAddr == (DWORD)-1)) ? "Bad IPv4 address" : DeviceFPGA_InitializeUDP(ctx, dwIpAddr); + } else if((pParam = LcDeviceParameterGet(ctxLC, FPGA_PARAMETER_FT2232H)) && pParam->szValue) { + ctx->qwDeviceIndex = LcDeviceParameterGetNumeric(ctxLC, FPGA_PARAMETER_DEVICE_INDEX); + szDeviceError = DeviceFPGA_InitializeFT2232(ctx); } else { ctx->qwDeviceIndex = LcDeviceParameterGetNumeric(ctxLC, FPGA_PARAMETER_DEVICE_INDEX); - szDeviceError = DeviceFPGA_InitializeFTDI(ctx); + szDeviceError = DeviceFPGA_InitializeFT601(ctx); } if(szDeviceError) { goto fail; } ctx->fRestartDevice = (1 == LcDeviceParameterGetNumeric(ctxLC, FPGA_PARAMETER_RESTART_DEVICE)); @@ -2464,7 +2684,7 @@ BOOL DeviceFPGA_Open(_Inout_ PLC_CONTEXT ctxLC, _Out_opt_ PPLC_CONFIG_ERRORINFO goto fail; } DeviceFPGA_SetPerformanceProfile(ctx); - ctx->rxbuf.cbMax = (DWORD)(1.30 * ctx->perf.MAX_SIZE_RX + 0x2000); // buffer size tuned to lowest possible (+margin) for performance. + ctx->rxbuf.cbMax = ctx->dev.f2232h ? 0x01000000 : (DWORD)(1.30 * ctx->perf.MAX_SIZE_RX + 0x2000); // buffer size tuned to lowest possible (+margin) for performance (FT601). ctx->rxbuf.pb = LocalAlloc(0, 0x01000000); if(!ctx->rxbuf.pb) { goto fail; } ctx->txbuf.cbMax = ctx->perf.MAX_SIZE_TX + 0x10000; diff --git a/leechcore/leechcore.c b/leechcore/leechcore.c index 01bf79f..ab31fab 100644 --- a/leechcore/leechcore.c +++ b/leechcore/leechcore.c @@ -35,7 +35,7 @@ _Success_(return) BOOL LcReadContigious_Initialize(_In_ PLC_CONTEXT ctxLC); VOID LcReadContigious_Close(_In_ PLC_CONTEXT ctxLC); #ifdef _WIN32 -BOOL WINAPI DllMain(_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved) +BOOL WINAPI DllMain(_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ PVOID lpvReserved) { if(fdwReason == DLL_PROCESS_ATTACH) { ZeroMemory(&g_ctx, sizeof(LC_MAIN_CONTEXT)); @@ -176,7 +176,7 @@ VOID LcCreate_FetchDeviceParameter(_Inout_ PLC_CONTEXT ctxLC) EXPORTED_FUNCTION PLC_DEVICE_PARAMETER_ENTRY LcDeviceParameterGet(_In_ PLC_CONTEXT ctxLC, _In_ LPSTR szName) { for(DWORD i = 0; i < ctxLC->cDeviceParameter; i++) { - if(!strcmp(szName, ctxLC->pDeviceParameter[i].szName)) { + if(!_stricmp(szName, ctxLC->pDeviceParameter[i].szName)) { return &ctxLC->pDeviceParameter[i]; } } diff --git a/leechcore/oscompatibility.c b/leechcore/oscompatibility.c index dd2eedd..f38a0c1 100644 --- a/leechcore/oscompatibility.c +++ b/leechcore/oscompatibility.c @@ -209,6 +209,9 @@ HMODULE LoadLibraryA(LPSTR lpFileName) if(lpFileName && (0 == memcmp(lpFileName, "FTD3XX.dll", 10))) { lpFileName = "leechcore_ft601_driver_linux.so"; } + if(lpFileName && (0 == memcmp(lpFileName, "FTD2XX.dll", 10))) { + lpFileName = "libftd2xx.so"; + } if(!strstr(lpFileName, "/")) { Util_GetPathLib(szFileName); } diff --git a/leechcore/version.h b/leechcore/version.h index 3192076..0137bb6 100644 --- a/leechcore/version.h +++ b/leechcore/version.h @@ -2,9 +2,9 @@ #define STRINGIZE(s) STRINGIZE2(s) #define VERSION_MAJOR 2 -#define VERSION_MINOR 8 -#define VERSION_REVISION 1 -#define VERSION_BUILD 35 +#define VERSION_MINOR 9 +#define VERSION_REVISION 0 +#define VERSION_BUILD 37 #define VER_FILE_DESCRIPTION_STR "LeechCore Memory Acquisition Library" #define VER_FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD diff --git a/leechcorepyc/pkggen_linux.sh b/leechcorepyc/pkggen_linux.sh index 43b5923..97ebd77 100644 --- a/leechcorepyc/pkggen_linux.sh +++ b/leechcorepyc/pkggen_linux.sh @@ -39,7 +39,7 @@ leechcorepyc = Extension( setup( name='leechcorepyc', - version='2.8.1', # VERSION_END + version='2.9.0', # VERSION_END description='LeechCore for Python', long_description='LeechCore for Python : native extension for physical memory access', url='https://github.com/ufrisk/LeechCore', diff --git a/leechcorepyc/version.h b/leechcorepyc/version.h index fd6ca41..c7e3527 100644 --- a/leechcorepyc/version.h +++ b/leechcorepyc/version.h @@ -2,9 +2,9 @@ #define STRINGIZE(s) STRINGIZE2(s) #define VERSION_MAJOR 2 -#define VERSION_MINOR 8 -#define VERSION_REVISION 1 -#define VERSION_BUILD 35 +#define VERSION_MINOR 9 +#define VERSION_REVISION 0 +#define VERSION_BUILD 37 #define VER_FILE_DESCRIPTION_STR "LeechCore Memory Acquisition Library : Python API" #define VER_FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD