diff options
-rw-r--r-- | MemDriverLib/DLLHelper.cpp | 8 | ||||
-rw-r--r-- | TestDLL/TestDLL.vcxproj | 5 |
2 files changed, 8 insertions, 5 deletions
diff --git a/MemDriverLib/DLLHelper.cpp b/MemDriverLib/DLLHelper.cpp index bd76552..78fdf83 100644 --- a/MemDriverLib/DLLHelper.cpp +++ b/MemDriverLib/DLLHelper.cpp @@ -28,7 +28,7 @@ static HMODULE GetRemoteModuleHandle(char *module_name, for (auto& mod : modules) { remote_module_name_length = strnlen(mod.BaseDllName, sizeof mod.BaseDllName); if (strlen(module_name) == remote_module_name_length && - !strncmp(module_name, mod.BaseDllName, remote_module_name_length)) + !_strnicmp(module_name, mod.BaseDllName, remote_module_name_length)) { return (HMODULE)mod.DllBase; } @@ -201,7 +201,7 @@ bool DLLHelper::FixImports() // Loop through all the required modules while ((module_name = (char *)GetPtrFromRVA((DWORD)(impDesc->Name), m_NTHeader, - (PBYTE)m_TargetBaseAddress))) + (PBYTE)m_DLLPtr))) { HMODULE localMod = LoadLibraryA(module_name); HMODULE remoteMod = GetRemoteModuleHandle(module_name, modules); @@ -216,13 +216,13 @@ bool DLLHelper::FixImports() IMAGE_THUNK_DATA *itd = (IMAGE_THUNK_DATA *)GetPtrFromRVA((DWORD)(impDesc->FirstThunk), m_NTHeader, - (PBYTE)m_TargetBaseAddress); + (PBYTE)m_DLLPtr); while (itd->u1.AddressOfData) { IMAGE_IMPORT_BY_NAME *iibn; iibn = (IMAGE_IMPORT_BY_NAME *)GetPtrFromRVA((DWORD)(itd->u1.AddressOfData), - m_NTHeader, (PBYTE)m_TargetBaseAddress); + m_NTHeader, (PBYTE)m_DLLPtr); itd->u1.Function = MakePtr(DWORD, GetRemoteProcAddress(localMod, remoteMod, (char *)iibn->Name), 0); diff --git a/TestDLL/TestDLL.vcxproj b/TestDLL/TestDLL.vcxproj index 0dc46b5..e75526b 100644 --- a/TestDLL/TestDLL.vcxproj +++ b/TestDLL/TestDLL.vcxproj @@ -92,12 +92,13 @@ <SDLCheck>true</SDLCheck> <PreprocessorDefinitions>_DEBUG;TESTDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ConformanceMode>true</ConformanceMode> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Windows</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> <AdditionalLibraryDirectories>$(VCToolsInstallDir)lib\x64;$(OutputPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalDependencies>kernel32.lib;user32.lib</AdditionalDependencies> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> @@ -142,6 +143,7 @@ <SDLCheck>true</SDLCheck> <PreprocessorDefinitions>NDEBUG;TESTDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ConformanceMode>true</ConformanceMode> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -149,6 +151,7 @@ <OptimizeReferences>true</OptimizeReferences> <GenerateDebugInformation>true</GenerateDebugInformation> <AdditionalLibraryDirectories>$(VCToolsInstallDir)lib\x64;$(OutputPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalDependencies>kernel32.lib;user32.lib</AdditionalDependencies> </Link> </ItemDefinitionGroup> <ItemGroup> |