diff --git a/release.bat b/release.bat index bb78c0d7..9cdc2733 100644 --- a/release.bat +++ b/release.bat @@ -23,14 +23,12 @@ mkdir %RELEASEDIR%\bin_base\bin\x64 copy bin\x32\BeaEngine.dll %RELEASEDIR%\bin_base\bin\x32\BeaEngine.dll copy bin\x32\dbghelp.dll %RELEASEDIR%\bin_base\bin\x32\dbghelp.dll -copy bin\x32\DeviceNameResolver.dll %RELEASEDIR%\bin_base\bin\x32\DeviceNameResolver.dll copy bin\x32\Scylla.dll %RELEASEDIR%\bin_base\bin\x32\Scylla.dll copy bin\x32\sqlite.dll %RELEASEDIR%\bin_base\bin\x32\sqlite.dll copy bin\x32\TitanEngine.dll %RELEASEDIR%\bin_base\bin\x32\TitanEngine.dll copy bin\x32\XEDParse.dll %RELEASEDIR%\bin_base\bin\x32\XEDParse.dll copy bin\x64\BeaEngine.dll %RELEASEDIR%\bin_base\bin\x64\BeaEngine.dll copy bin\x64\dbghelp.dll %RELEASEDIR%\bin_base\bin\x64\dbghelp.dll -copy bin\x64\DeviceNameResolver.dll %RELEASEDIR%\bin_base\bin\x64\DeviceNameResolver.dll copy bin\x64\Scylla.dll %RELEASEDIR%\bin_base\bin\x64\Scylla.dll copy bin\x64\sqlite.dll %RELEASEDIR%\bin_base\bin\x64\sqlite.dll copy bin\x64\TitanEngine.dll %RELEASEDIR%\bin_base\bin\x64\TitanEngine.dll diff --git a/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver.h b/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver.h deleted file mode 100644 index dd6dd6af..00000000 --- a/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _DEVICENAMERESOLVER_H -#define _DEVICENAMERESOLVER_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -__declspec(dllexport) bool DevicePathToPathW(const wchar_t* szDevicePath, wchar_t* szPath, size_t nSize); -__declspec(dllexport) bool DevicePathToPathA(const char* szDevicePath, char* szPath, size_t nSize); - -#ifdef __cplusplus -} -#endif - -#endif // _DEVICENAMERESOLVER_H diff --git a/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x64.a b/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x64.a deleted file mode 100644 index d9c5f8c1..00000000 Binary files a/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x64.a and /dev/null differ diff --git a/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x64.lib b/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x64.lib deleted file mode 100644 index 7f797fe9..00000000 Binary files a/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x64.lib and /dev/null differ diff --git a/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x86.a b/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x86.a deleted file mode 100644 index 7217306f..00000000 Binary files a/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x86.a and /dev/null differ diff --git a/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x86.lib b/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x86.lib deleted file mode 100644 index f96cbf23..00000000 Binary files a/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x86.lib and /dev/null differ diff --git a/x64_dbg_dbg/_global.cpp b/x64_dbg_dbg/_global.cpp index bc8a7858..8160b733 100644 --- a/x64_dbg_dbg/_global.cpp +++ b/x64_dbg_dbg/_global.cpp @@ -1,5 +1,4 @@ #include "_global.h" -#include "DeviceNameResolver\DeviceNameResolver.h" #include HINSTANCE hInst; @@ -117,6 +116,30 @@ bool DirExists(const char* dir) return (attrib==FILE_ATTRIBUTE_DIRECTORY); } +bool DevicePathToPath(const char* devicepath, char* path, size_t path_size) +{ + if(!devicepath or !path) + return false; + char curDrive[3]=" :"; + char curDevice[MAX_PATH]=""; + for(char drive='C'; drive<='Z'; drive++) + { + *curDrive=drive; + if(!QueryDosDeviceA(curDrive, curDevice, MAX_PATH)) + continue; + strcat(curDevice, "\\"); //fixed thanks to ahmadmansoor! + size_t curDevice_len=strlen(curDevice); + if(!_strnicmp(devicepath, curDevice, curDevice_len)) //we match the device + { + if(strlen(devicepath)-curDevice_len>=path_size) + return false; + sprintf(path, "%s%s", curDrive, devicepath+curDevice_len); + return true; + } + } + return false; +} + bool GetFileNameFromHandle(HANDLE hFile, char* szFileName) { if(!GetFileSize(hFile, 0)) @@ -133,7 +156,7 @@ bool GetFileNameFromHandle(HANDLE hFile, char* szFileName) char szMappedName[MAX_PATH]=""; if(GetMappedFileNameA(GetCurrentProcess(), pFileMap, szMappedName, MAX_PATH)) { - if(!DevicePathToPathA(szMappedName, szFileName, MAX_PATH)) + if(!DevicePathToPath(szMappedName, szFileName, MAX_PATH)) return false; UnmapViewOfFile(pFileMap); CloseHandle(hFileMap); diff --git a/x64_dbg_dbg/_global.h b/x64_dbg_dbg/_global.h index 24912c3c..71edd458 100644 --- a/x64_dbg_dbg/_global.h +++ b/x64_dbg_dbg/_global.h @@ -106,6 +106,7 @@ void formathex(char* string); void formatdec(char* string); bool FileExists(const char* file); bool DirExists(const char* dir); +bool DevicePathToPath(const char* devicepath, char* path, size_t path_size); bool GetFileNameFromHandle(HANDLE hFile, char* szFileName); bool settingboolget(const char* section, const char* name); diff --git a/x64_dbg_dbg/debugger.cpp b/x64_dbg_dbg/debugger.cpp index fec8c1d3..9ed8c41a 100644 --- a/x64_dbg_dbg/debugger.cpp +++ b/x64_dbg_dbg/debugger.cpp @@ -16,7 +16,6 @@ #include "disasm_fast.h" #include "BeaEngine\BeaEngine.h" -#include "DeviceNameResolver\DeviceNameResolver.h" static PROCESS_INFORMATION g_pi= {0,0,0,0}; static char szFileName[MAX_PATH]=""; @@ -474,7 +473,7 @@ static void cbCreateProcess(CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo) if(!GetMappedFileNameA(fdProcessInfo->hProcess, base, DebugFileName, deflen)) strcpy(DebugFileName, "??? (GetMappedFileName failed)"); else - DevicePathToPathA(DebugFileName, DebugFileName, deflen); + DevicePathToPath(DebugFileName, DebugFileName, deflen); dprintf("Process Started: "fhex" %s\n", base, DebugFileName); //init program database @@ -656,7 +655,7 @@ static void cbLoadDll(LOAD_DLL_DEBUG_INFO* LoadDll) if(!GetMappedFileNameA(fdProcessInfo->hProcess, base, DLLDebugFileName, deflen)) strcpy(DLLDebugFileName, "??? (GetMappedFileName failed)"); else - DevicePathToPathA(DLLDebugFileName, DLLDebugFileName, deflen); + DevicePathToPath(DLLDebugFileName, DLLDebugFileName, deflen); dprintf("DLL Loaded: "fhex" %s\n", base, DLLDebugFileName); SymLoadModuleEx(fdProcessInfo->hProcess, LoadDll->hFile, DLLDebugFileName, 0, (DWORD64)base, 0, 0, 0); diff --git a/x64_dbg_dbg/x64_dbg_dbg.cbp b/x64_dbg_dbg/x64_dbg_dbg.cbp index cbcdd966..37b443b5 100644 --- a/x64_dbg_dbg/x64_dbg_dbg.cbp +++ b/x64_dbg_dbg/x64_dbg_dbg.cbp @@ -28,7 +28,6 @@ - @@ -52,7 +51,6 @@ - diff --git a/x64_dbg_dbg/x64_dbg_dbg.vcxproj b/x64_dbg_dbg/x64_dbg_dbg.vcxproj index 6e8dfb52..ee0962a8 100644 --- a/x64_dbg_dbg/x64_dbg_dbg.vcxproj +++ b/x64_dbg_dbg/x64_dbg_dbg.vcxproj @@ -56,7 +56,6 @@ - @@ -130,7 +129,7 @@ Windows true true - DeviceNameResolver\DeviceNameResolver_x86.lib;XEDParse\XEDParse_x86.lib;$(SolutionDir)bin\x32\x32_bridge.lib;dbghelp\dbghelp_x86.lib;TitanEngine\TitanEngine_x86.lib;sqlite\sqlite32.lib;BeaEngine\BeaEngine.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) + XEDParse\XEDParse_x86.lib;$(SolutionDir)bin\x32\x32_bridge.lib;dbghelp\dbghelp_x86.lib;TitanEngine\TitanEngine_x86.lib;sqlite\sqlite32.lib;BeaEngine\BeaEngine.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) @@ -145,7 +144,7 @@ Windows true true - DeviceNameResolver\DeviceNameResolver_x64.lib;XEDParse\XEDParse_x64.lib;$(SolutionDir)bin\x64\x64_bridge.lib;dbghelp\dbghelp_x64.lib;TitanEngine\TitanEngine_x64.lib;sqlite\sqlite64.lib;BeaEngine\BeaEngine_64.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) + XEDParse\XEDParse_x64.lib;$(SolutionDir)bin\x64\x64_bridge.lib;dbghelp\dbghelp_x64.lib;TitanEngine\TitanEngine_x64.lib;sqlite\sqlite64.lib;BeaEngine\BeaEngine_64.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) diff --git a/x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters b/x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters index 1ddb6844..679e354a 100644 --- a/x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters +++ b/x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters @@ -31,9 +31,6 @@ {6b85ff77-8866-4618-9d46-006d8c349f8f} - - {f4eb1487-15d6-4836-9d20-339d0f18c31f} - @@ -242,8 +239,5 @@ Header Files\sqlite - - Header Files\DeviceNameResolver - \ No newline at end of file