Skip to content

Commit

Permalink
local proxy load support for all name variants
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Oct 27, 2023
1 parent a9415e5 commit 0947e93
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 18 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ install:
- cmd: >-
git submodule update --init --recursive
premake5.bat
premake5.exe vs2022 --with-version=%APPVEYOR_BUILD_VERSION%
build:
project: build/Ultimate-ASI-Loader-Win32.sln
verbosity: minimal
Expand Down
96 changes: 79 additions & 17 deletions source/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,43 +224,83 @@ void LoadOriginalLibrary()

if (iequals(szSelfName, L"dsound.dll"))
{
dsound.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
szLocalPath += L"dsoundHooked.dll";
if (std::filesystem::exists(szLocalPath))
dsound.LoadOriginalLibrary(LoadLibraryW(szLocalPath));
else
dsound.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
}
else if (iequals(szSelfName, L"dinput8.dll"))
{
dinput8.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
szLocalPath += L"dinput8Hooked.dll";
if (std::filesystem::exists(szLocalPath))
dinput8.LoadOriginalLibrary(LoadLibraryW(szLocalPath));
else
dinput8.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
}
else if (iequals(szSelfName, L"wininet.dll"))
{
wininet.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
szLocalPath += L"wininetHooked.dll";
if (std::filesystem::exists(szLocalPath))
wininet.LoadOriginalLibrary(LoadLibraryW(szLocalPath));
else
wininet.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
}
else if (iequals(szSelfName, L"version.dll"))
{
version.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
szLocalPath += L"versionHooked.dll";
if (std::filesystem::exists(szLocalPath))
version.LoadOriginalLibrary(LoadLibraryW(szLocalPath));
else
version.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
}
else if (iequals(szSelfName, L"d3d9.dll"))
{
d3d9.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
szLocalPath += L"d3d9Hooked.dll";
if (std::filesystem::exists(szLocalPath))
d3d9.LoadOriginalLibrary(LoadLibraryW(szLocalPath));
else
d3d9.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
}
else if (iequals(szSelfName, L"d3d10.dll"))
{
d3d10.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
szLocalPath += L"d3d10Hooked.dll";
if (std::filesystem::exists(szLocalPath))
d3d10.LoadOriginalLibrary(LoadLibraryW(szLocalPath));
else
d3d10.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
}
else if (iequals(szSelfName, L"d3d11.dll"))
{
d3d11.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
szLocalPath += L"d3d11Hooked.dll";
if (std::filesystem::exists(szLocalPath))
d3d11.LoadOriginalLibrary(LoadLibraryW(szLocalPath));
else
d3d11.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
}
else if (iequals(szSelfName, L"d3d12.dll"))
{
d3d12.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
szLocalPath += L"d3d12Hooked.dll";
if (std::filesystem::exists(szLocalPath))
d3d12.LoadOriginalLibrary(LoadLibraryW(szLocalPath));
else
d3d12.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
}
else if (iequals(szSelfName, L"winmm.dll"))
{
winmm.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
szLocalPath += L"winmmHooked.dll";
if (std::filesystem::exists(szLocalPath))
winmm.LoadOriginalLibrary(LoadLibraryW(szLocalPath));
else
winmm.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
}
else if (iequals(szSelfName, L"winhttp.dll"))
{
winhttp.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
szLocalPath += L"winhttpHooked.dll";
if (std::filesystem::exists(szLocalPath))
winhttp.LoadOriginalLibrary(LoadLibraryW(szLocalPath));
else
winhttp.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
}
else
#if !X64
Expand Down Expand Up @@ -301,25 +341,47 @@ void LoadOriginalLibrary()
}
else if (iequals(szSelfName, L"ddraw.dll"))
{
ddraw.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
szLocalPath += L"ddrawHooked.dll";
if (std::filesystem::exists(szLocalPath))
ddraw.LoadOriginalLibrary(LoadLibraryW(szLocalPath));
else
ddraw.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
}
else if (iequals(szSelfName, L"d3d8.dll"))
{
d3d8.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
if (GetPrivateProfileIntW(L"globalsets", L"used3d8to9", FALSE, iniPaths))
d3d8.Direct3DCreate8 = (FARPROC)Direct3DCreate8;
szLocalPath += L"d3d8Hooked.dll";
if (std::filesystem::exists(szLocalPath))
d3d8.LoadOriginalLibrary(LoadLibraryW(szLocalPath));
else
{
d3d8.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
if (GetPrivateProfileIntW(L"globalsets", L"used3d8to9", FALSE, iniPaths))
d3d8.Direct3DCreate8 = (FARPROC)Direct3DCreate8;
}
}
else if (iequals(szSelfName, L"msacm32.dll"))
{
msacm32.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
szLocalPath += L"msacm32Hooked.dll";
if (std::filesystem::exists(szLocalPath))
msacm32.LoadOriginalLibrary(LoadLibraryW(szLocalPath));
else
msacm32.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
}
else if (iequals(szSelfName, L"dinput.dll"))
{
dinput.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
szLocalPath += L"dinputHooked.dll";
if (std::filesystem::exists(szLocalPath))
dinput.LoadOriginalLibrary(LoadLibraryW(szLocalPath));
else
dinput.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
}
else if (iequals(szSelfName, L"msvfw32.dll"))
{
msvfw32.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
szLocalPath += L"msvfw32Hooked.dll";
if (std::filesystem::exists(szLocalPath))
msvfw32.LoadOriginalLibrary(LoadLibraryW(szLocalPath));
else
msvfw32.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
}
else if (iequals(szSelfName, L"binkw32.dll"))
{
Expand Down

0 comments on commit 0947e93

Please sign in to comment.