Fix FirewallAPI error

This commit is contained in:
nastys
2020-02-08 17:12:44 +01:00
parent 3c6ff05649
commit 8ef3b2ec5c
6 changed files with 52 additions and 6 deletions
+16 -3
View File
@@ -31,7 +31,7 @@ after_build:
copy %APPVEYOR_BUILD_FOLDER%\source-code\x64\%CONFIGURATION%\dnsapi.dll %TMP%\update\ copy %APPVEYOR_BUILD_FOLDER%\source-code\x64\%CONFIGURATION%\dinput8.dll %TMP%\update\
copy %APPVEYOR_BUILD_FOLDER%\source-code\x64\%CONFIGURATION%\*.dva %TMP%\update\plugins\ copy %APPVEYOR_BUILD_FOLDER%\source-code\x64\%CONFIGURATION%\*.dva %TMP%\update\plugins\
@@ -57,7 +57,7 @@ after_build:
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\plugins\pv_equip\sfx.ini %TMP%\update\plugins\pv_equip\ copy %APPVEYOR_BUILD_FOLDER%\source-code\data\plugins\pv_equip\sfx.ini %TMP%\update\plugins\pv_equip\
copy %APPVEYOR_BUILD_FOLDER%\source-code\x64\%CONFIGURATION%\dnsapi.dll %TMP%\full\ copy %APPVEYOR_BUILD_FOLDER%\source-code\x64\%CONFIGURATION%\dinput8.dll %TMP%\full\
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\patches\custom_freeplay_text_example.p %TMP%\full\patches\ copy %APPVEYOR_BUILD_FOLDER%\source-code\data\patches\custom_freeplay_text_example.p %TMP%\full\patches\
@@ -77,7 +77,7 @@ after_build:
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\plugins\*.* %TMP%\full\plugins\ copy %APPVEYOR_BUILD_FOLDER%\source-code\data\plugins\*.* %TMP%\full\plugins\
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\plugins\*.* %TMP%\full\plugins\pv_equip\ copy %APPVEYOR_BUILD_FOLDER%\source-code\data\plugins\*.* %TMP%\full\plugins\pv_equip\
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\ram\databank\*.dat %TMP%\full\ram\databank\ copy %APPVEYOR_BUILD_FOLDER%\source-code\data\ram\databank\*.dat %TMP%\full\ram\databank\
@@ -90,5 +90,18 @@ after_build:
cd %TMP%\update\ cd %TMP%\update\
7z a %APPVEYOR_BUILD_FOLDER%\PD-Loader-%CONFIGURATION%-Update-AppVeyor.zip * 7z a %APPVEYOR_BUILD_FOLDER%\PD-Loader-%CONFIGURATION%-Update-AppVeyor.zip *
cd %APPVEYOR_BUILD_FOLDER%\source-code\x64\%CONFIGURATION%\
ren dinput8.dll dnsapi.dll
cd %TMP%\full\
7z a %APPVEYOR_BUILD_FOLDER%\PD-Loader-%CONFIGURATION%-AppVeyor-Vista.zip *
cd %TMP%\update\
7z a %APPVEYOR_BUILD_FOLDER%\PD-Loader-%CONFIGURATION%-Update-AppVeyor-Vista.zip *
artifacts: artifacts:
- path: PD-Loader-*.zip - path: PD-Loader-*.zip
@@ -52,7 +52,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<TargetName>dnsapi</TargetName> <TargetName>dinput8</TargetName>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
+13 -1
View File
@@ -138,7 +138,10 @@ void LoadOriginalLibrary()
auto szSystemPath = SHGetKnownFolderPath(FOLDERID_System, 0, nullptr) + L'\\' + szSelfName; auto szSystemPath = SHGetKnownFolderPath(FOLDERID_System, 0, nullptr) + L'\\' + szSelfName;
auto szLocalPath = GetModuleFileNameW(hm); szLocalPath = szLocalPath.substr(0, szLocalPath.find_last_of(L"/\\") + 1); auto szLocalPath = GetModuleFileNameW(hm); szLocalPath = szLocalPath.substr(0, szLocalPath.find_last_of(L"/\\") + 1);
if (iequals(szSelfName, L"dnsapi.dll")) { if (iequals(szSelfName, L"dinput8.dll")) {
dinput8.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
}
else if (iequals(szSelfName, L"dnsapi.dll")) {
dnsapi.LoadOriginalLibrary(LoadLibraryW(szSystemPath)); dnsapi.LoadOriginalLibrary(LoadLibraryW(szSystemPath));
} }
} }
@@ -577,6 +580,15 @@ bool HookKernel32IAT(HMODULE mod, bool exe)
{ {
PIMAGE_IMPORT_BY_NAME import = (PIMAGE_IMPORT_BY_NAME)(hInstance + thunk->u1.AddressOfData); PIMAGE_IMPORT_BY_NAME import = (PIMAGE_IMPORT_BY_NAME)(hInstance + thunk->u1.AddressOfData);
void** p = (void**)(hInstance + (pImports + i)->FirstThunk); void** p = (void**)(hInstance + (pImports + i)->FirstThunk);
if (iequals(szSelfName, L"dinput8.dll"))
{
DWORD Protect;
VirtualProtect(&p[j], 4, PAGE_EXECUTE_READWRITE, &Protect);
if ((IMAGE_ORDINAL(thunk->u1.Ordinal)) == 1)
p[j] = _DirectInput8Create;
}
} }
++thunk; ++thunk;
} }
+14
View File
@@ -506,6 +506,18 @@ struct dnsapi_dll
} }
} dnsapi; } dnsapi;
struct dinput8_dll
{
HMODULE dll;
FARPROC DirectInput8Create;
void LoadOriginalLibrary(HMODULE module)
{
dll = module;
shared.LoadOriginalLibrary(dll);
DirectInput8Create = GetProcAddress(dll, "DirectInput8Create");
}
} dinput8;
#pragma runtime_checks( "", off ) #pragma runtime_checks( "", off )
@@ -737,6 +749,8 @@ void _Socket_TcpListen() { dnsapi.Socket_TcpListen(); }
void _Update_ReplaceAddressRecordsW() { dnsapi.Update_ReplaceAddressRecordsW(); } void _Update_ReplaceAddressRecordsW() { dnsapi.Update_ReplaceAddressRecordsW(); }
void _Util_IsIp6Running() { dnsapi.Util_IsIp6Running(); } void _Util_IsIp6Running() { dnsapi.Util_IsIp6Running(); }
typedef HRESULT(*fn_DirectInput8Create)(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID* ppvOut, LPUNKNOWN punkOuter);
void _DirectInput8Create() { (fn_DirectInput8Create)dinput8.DirectInput8Create(); }
void _DllRegisterServer() { shared.DllRegisterServer(); } void _DllRegisterServer() { shared.DllRegisterServer(); }
void _DllUnregisterServer() { shared.DllUnregisterServer(); } void _DllUnregisterServer() { shared.DllUnregisterServer(); }
+8
View File
@@ -1,3 +1,11 @@
LIBRARY "dinput8"
EXPORTS
DirectInput8Create = _DirectInput8Create
DllCanUnloadNow = _DllCanUnloadNow PRIVATE
DllGetClassObject = _DllGetClassObject PRIVATE
DllRegisterServer = _DllRegisterServer PRIVATE
DllUnregisterServer = _DllUnregisterServer PRIVATE
LIBRARY "dnsapi" LIBRARY "dnsapi"
EXPORTS EXPORTS
BreakRecordsIntoBlob = _BreakRecordsIntoBlob BreakRecordsIntoBlob = _BreakRecordsIntoBlob