From 8c24955031c9b88c8990ba825de83c3d052f9b69 Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Thu, 17 Apr 2014 20:18:01 +0200 Subject: [PATCH] DBG: removed DeviceNameResolver (bug was fixed by ahmadmansoor already) PROJECT: updated release script --- release.bat | 2 -- .../DeviceNameResolver/DeviceNameResolver.h | 16 ----------- .../DeviceNameResolver_x64.a | Bin 3022 -> 0 bytes .../DeviceNameResolver_x64.lib | Bin 2186 -> 0 bytes .../DeviceNameResolver_x86.a | Bin 3010 -> 0 bytes .../DeviceNameResolver_x86.lib | Bin 2186 -> 0 bytes x64_dbg_dbg/_global.cpp | 27 ++++++++++++++++-- x64_dbg_dbg/_global.h | 1 + x64_dbg_dbg/debugger.cpp | 5 ++-- x64_dbg_dbg/x64_dbg_dbg.cbp | 2 -- x64_dbg_dbg/x64_dbg_dbg.vcxproj | 5 ++-- x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters | 6 ---- 12 files changed, 30 insertions(+), 34 deletions(-) delete mode 100644 x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver.h delete mode 100644 x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x64.a delete mode 100644 x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x64.lib delete mode 100644 x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x86.a delete mode 100644 x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x86.lib 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 d9c5f8c11c047c1cccc24e9b3bf8fd1da4de5a10..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3022 zcmeHJ!A{#i5S_%KZ6d02KrOc#sl8RM1Hl9dRf*I?d#NH+sh3K|B~BfY5JU_@oH(GK z`6NE5-%vVl)@!d5JJ1U~v?FCbo_)^jzIi+L`fhM?5WQ=>we!~8+}ZZptqpg_wq2Pr zN84_C?c{;|1`$2t-%ldzirqc+tFI8%SA73{cs4u;KLz7(FPu(BXW@w-_`@TSX4j}x#NpG9^{kX`DJr(x_&(yf;5vFW;==h?RBZl-(e|G*ZB z-c*R5iMK>f9G=JGmk&1e_MLtZ2jvi%=}_;+`8J*20i#RchWNu*EscG`PL0=PT8CVX z+tP91mdkP58n?#IY5`8q>+5`Fo&IP<sm`{i~1DlQsd35flGC6&TAhy?ayA9Ibab+oLEcv zc`Dw06dFm3VmO;rn+9=odUU8FqLCca*yIDKSlCr62EX7mGqW?OHP7i;+GS@!b6zNCsCnwLHI=0A?6R$<(PbaY60Vp`yjF_TjB|-D{54S(E;hOM?6TYy zjgEl~MRu8W&$KIos}?6471 z*VkDr^C|`JPt+MXRqgBSDeWko;Mqhm##;?(t@%DoCWq2>Dbbm*g$(?Z>bhA+)e&JJ zr%u@`Dz8?gR!D^GN}bQygW=Svh$HuEsM1GvX1@cMj3@U8LUMg8PX< diff --git a/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x64.lib b/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x64.lib deleted file mode 100644 index 7f797fe90b5cc70265e43802aee011603ef32292..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2186 zcmcIl&2JJx6#uc%4>ul&8e`HlLDSSWCVYc6F=kOrB&A!j&~RKRy9x<}hGMVYIGG+f z+5f>mp$Go}j~+erpow>n^}XF0%E!`z4U^q{^WOYs=FQvRd-M2ZwNtCVQX`?!7E8Q% zp595uqp?wYRH*S-TJ$O^fE7SF1p*hq@+Pnvbl;Ue4fRbkw^!IVN@n(L@r{uyl=clX zYo9b~wq9-7hJD;_p4c6jrhbsmPh#I`n5L^ZN6eW7FgaCX{9O<9%-1{uIi=cNbrk%Vz zQ^X@<;kl793CX02I{8DxRL= z(ba%Fbv{c)NDaZ);f7W1RyX2u=mB+p(ECRi{3JC*&jl_m%y>i{mG+Z3wrdET(~rkG z?y!o7-iLjP`#~ndcLzkvkX$>vx7Vn3+Q;qp-O!e?9m?nQT`@i)?vlnn@k?3f^eE+s zQEc;=M;5man9`SDKJUK&?F2nsVfWHpYcaD zULD8^jfFzRBp)FG;tcKphn^tAyifB4aX!7j*>PgF%^d%5KquY z>ND{Gl$qJxWF7yMN}wKKB=3%AKksOq*qhTQe zRP=q6CZ{uM&k#O7|Ewp>49Fa-P`3=*1sG1IgVdcZ7hJYd-}8bX5Tey-EmzvJXrTc6 z7QhqsHY_)dzozV$Hv+uAJB-q(9Ks{V;N7?%7mGV!@QrX|nsC3Vv2}Fn_+F;*d=l5v zal&nuDdWWgFS4uWDCCmhxC}-LytkLlhb2> z{5|FT^@rBuD@6l5Lx=RZtM-=mr$~<)Z}tXmsc&;!`-Ic}dcTc<22e|1YJ>TC%--)P zG~oh;a5Ua+7^TUVi;0Y|M&JQd%*;8r#@c#TeF zX)dhTs;0A^7ap1~MSWL&4Gyr#vh|&w)!>)7Le0>zLJBfjrpP854k>_v-7i z9uiwkO!mRZ3#&Susjr8KNs4hxJ=1(gh?y7T0vu+eeLhwg6~a#3+&-tf>+4kvz=HLY z@Qinua*-nNM8->UO!uZ|@=WRMd<6#cY~p$gN@2_rWx=P6^G1CqMg`93lGjM@AazX7 zlTmi5OI=}U9vSfnpsWTx^zQYeQ1Qb-b(nSQ{nsrKEG1X`pYf-43pw3(|2^GS{Iph8 F<6oBPiRl0U diff --git a/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x86.lib b/x64_dbg_dbg/DeviceNameResolver/DeviceNameResolver_x86.lib deleted file mode 100644 index f96cbf23081a29391678fe560e3997e12612d7e0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2186 zcmcIl&2HL25dJVEP^$;jR#l`Z60IUNZ6zRfAgNSU&{C-=gdjtdqaolHB#YK0*$Ch#q?A1LW9yIb-|3mub=oxFZ0C1O zBWqrlXC-SGYSq*M!~ty##4dp4G>}MoZ=7WDv2B<4YWr5hE`6+ju*$W@zGau3(_Y)D zwg!&noVfi{X9(M_9#ksRy7)G&?5Q?B9aMMiQn68lG+1kmx(%1dL$cQ!9NR$~o;_ce zjtA=&F?U@|zb;Eun6U<2#DMfNkW3Iym7)hrh#>+^%+cxSLlU}Q9Yd20**Ki3@|hbY zx)V89h-&K7A2!|T_n~K05hdF0vY9h?q-ImEM52iPtJa@K2!m8q9DV(=UiVm_ zLW}Q;k#hmb_vv1zHEOLJYU>Fte$z{^78Iqifb6-{%S$mEwI~%U|;#iLC=A z$?>GoIZy-M58Jcc5%Z$T$Zt-dN)xF1B_igygHhEHTmCSCDpN@rRX-IYXGYbc(K5?- zU!! 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