Improved compatibility with pre-SP4 Win2000

Moved the LoadLibrary call out of DllMain entry point.
Updated version number and changelog.
This commit is contained in:
NovaRain
2023-08-24 21:42:27 +08:00
parent 59eacce6be
commit 71e3ee4801
3 changed files with 14 additions and 6 deletions
+3
View File
@@ -1,5 +1,8 @@
# Changelog
## 3.8.40.1
* Improved compatibility with older Windows 2000 (**pre-SP4**)
## 3.8.40
* Implemented a `mods_order.txt` to improve and simplify mod ordering and add support for mod managers. This replaces previous **.dat** file autoloading. Please refer to `ddraw.ini` for details
* Implemented a **custom config file parser**, which greatly improves the performance of sfall initialization and reading files from scripts
+9 -4
View File
@@ -87,6 +87,7 @@
#include "WinProc.h"
ddrawDll ddraw;
static void LoadOriginalDll(DWORD fdwReason);
namespace sfall
{
@@ -211,6 +212,9 @@ static int CheckEXE() {
static HMODULE SfallInit() {
char filepath[MAX_PATH];
LoadOriginalDll(DLL_PROCESS_ATTACH);
GetModuleFileName(0, filepath, MAX_PATH);
SetCursor(LoadCursorA(0, IDC_ARROW));
@@ -311,7 +315,7 @@ defaultIni:
}
static bool LoadOriginalDll(DWORD fdwReason) {
static void LoadOriginalDll(DWORD fdwReason) {
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
char path[MAX_PATH];
@@ -342,20 +346,21 @@ static bool LoadOriginalDll(DWORD fdwReason) {
ddraw.ReleaseDDThreadLock = GetProcAddress(ddraw.dll, "ReleaseDDThreadLock");
ddraw.SetAppCompatData = GetProcAddress(ddraw.dll, "SetAppCompatData");
}
return true;
break;
case DLL_PROCESS_DETACH:
if (ddraw.dll) FreeLibrary(ddraw.dll);
break;
}
return false;
}
bool __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {
if (LoadOriginalDll(fdwReason)) {
if (fdwReason == DLL_PROCESS_ATTACH) {
if (sfall::CheckEXE()) {
ddraw.sfall = hinstDLL;
sfall::MakeCall(0x4DE8DE, sfall::SfallInit); // LoadDirectX_
}
} else {
LoadOriginalDll(fdwReason);
}
return true;
}
+2 -2
View File
@@ -25,6 +25,6 @@
#define VERSION_MAJOR 3
#define VERSION_MINOR 8
#define VERSION_BUILD 40
#define VERSION_REV 0
#define VERSION_REV 1
#define VERSION_STRING "3.8.40"
#define VERSION_STRING "3.8.40.1"