1
0
mirror of https://github.com/DxWnd/DxWnd.reloaded synced 2024-12-30 09:25:35 +01:00

v2_02_78_src

Former-commit-id: 730cdf299f3e27700a78b98fd6d7f8fe7c54542f
This commit is contained in:
gho tik 2014-10-06 12:39:20 -04:00 committed by Refael ACkermann
parent 194502e7e6
commit a60b480840
32 changed files with 1071 additions and 434 deletions

Binary file not shown.

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:93bd98c222d5a3a27ae412c7dff1b5cdca3ad7980ea19e86e4e543b6f34e685b
size 484352
oid sha256:3bb7913ecbd4bf5117c4858a94e0f9e1d5606d8dc8165258118f0a2b4e05c6ef
size 485888

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:32bbbe4a6676b22413cb11cfcb1c8a6cbe831221bea1c1cc83fb25963b86fb9c
oid sha256:d25ed7d43c0672c5ce69054896578802218de233bbc82f22b392c3406e56915f
size 540160

View File

@ -0,0 +1,26 @@
[target]
title0=Age of Empires Expansion Trial
path0=D:\Games\Age of Empires Expansion Trial\empiresx.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134218272
flagg0=1207959552
flagh0=20
flagi0=4194308
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,27 @@
[target]
title0=Age of Wonders II
path0=D:\Games\Age of Wonders II\AoW2.exe
launchpath0=
module0=
opengllib0=
ver0=7
coord0=0
flag0=142606624
flagg0=1207959552
flagh0=20
flagi0=138412036
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,27 @@
[target]
title0=Blair Witch Volume One - Rustin Parr
path0=D:\Games\Blair Witch Volume One - Rustin Parr\NOCTURNE.EXE
launchpath0=
module0=
opengllib0=
ver0=0
coord0=0
flag0=134218272
flagg0=1207959552
flagh0=20
flagi0=134217732
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,27 @@
[target]
title0=Conflict Zone
path0=D:\Games\Conflict Zone\Conflict zone.exe
launchpath0=
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217760
flagg0=1207959552
flagh0=20
flagi0=4194308
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,27 @@
[target]
title0=Disciples II - Dark Prophecy
path0=D:\Games\Disciples II - Dark Prophecy\Discipl2.exe
launchpath0=
module0=
opengllib0=
ver0=1
coord0=0
flag0=134234144
flagg0=1207959552
flagh0=16
flagi0=138412036
tflag0=6147
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,27 @@
[target]
title0=KA52 Team Alligator
path0=D:\Games\Team Alligator\Team2.exe
launchpath0=
module0=
opengllib0=
ver0=0
coord0=0
flag0=687865888
flagg0=1207959552
flagh0=20
flagi0=138412036
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,27 @@
[target]
title0=Myth III - The Wolf Age
path0=D:\Games\Myth III - The Wolf Age\Myth3.exe
launchpath0=
module0=
opengllib0=
ver0=0
coord0=0
flag0=134218272
flagg0=1744830464
flagh0=20
flagi0=205520900
tflag0=6147
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

26
build/exports/Re-Volt.dxw Normal file
View File

@ -0,0 +1,26 @@
[target]
title0=Re-Volt
path0=D:\Games\Re-Volt\REVOLT.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217760
flagg0=1208025088
flagh0=20
flagi0=12
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

26
build/exports/Rune.dxw Normal file
View File

@ -0,0 +1,26 @@
[target]
title0=Rune
path0=D:\Games\Rune\System\Rune.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=402669601
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=6211
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,27 @@
[target]
title0=Shogo Mobile Armor Division
path0=D:\Games\Shogo\Client.exe
launchpath0=D:\Games\Shogo\Shogo.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=151011328
flagg0=1207959552
flagh0=20
flagi0=4194308
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,27 @@
[target]
title0=Slave Zero
path0=D:\Games\Slave Zero\SlaveZero.exe
launchpath0=
module0=
opengllib0=
ver0=0
coord0=0
flag0=671105120
flagg0=1207959552
flagh0=20
flagi0=2097156
tflag0=6210
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

27
build/exports/Unreal.dxw Normal file
View File

@ -0,0 +1,27 @@
[target]
title0=Unreal
path0=D:\Games\Unreal\System\Unreal.exe
launchpath0=
module0=
opengllib0=
ver0=0
coord0=0
flag0=134218272
flagg0=1207959552
flagh0=20
flagi0=138412036
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=4
winver0=0
maxres0=-1

26
build/exports/Warpath.dxw Normal file
View File

@ -0,0 +1,26 @@
[target]
title0=Warpath
path0=D:\Games\Warpath\System\Warpath.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134218272
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,26 @@
[target]
title0=Warrior Kings
path0=D:\Games\Warrior Kings\warrior_kings.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=671236130
flagg0=1207959569
flagh0=65556
flagi0=4
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,26 @@
[target]
title0=World Racing (Demo) MX
path0=D:\Games\World Racing Demo\mbwr_pc_MX.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134234146
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=2
winver0=0
maxres0=-1

View File

@ -0,0 +1,26 @@
[target]
title0=World Racing (Demo)
path0=D:\Games\World Racing Demo\mbwr_pc.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134234146
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

27
build/exports/XIII.dxw Normal file
View File

@ -0,0 +1,27 @@
[target]
title0=XIII
path0=D:\Games\Ubisoft\XIII\system\XIII.exe
launchpath0=
module0=
opengllib0=
ver0=0
coord0=0
flag0=671105540
flagg0=1207959552
flagh0=20
flagi0=138412036
tflag0=6146
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -511,4 +511,14 @@ fix: some log messages
fix: handling of GetProcAddress D3D9 api
fix: handling of EMULATEBUFFER option - fixes "Star Trek Birth of the Federation"
fix: expanded hot patching scope - now can handle QueryPerformanceCounter and fix time stretching on obfuscated version of "Wind Fantasy SP"
added logging in D3DDevice9::GetAdapterIdentifier
added logging in D3DDevice9::GetAdapterIdentifier
v2.02.78
fix: hooked D3D8/9Device::BeginStateBlock
ddraw API hot swappable
log: helper for ChangeDisplaySettings() flags
fix: hot patch handling of loaded modules
log: fixed some messages with no line ending for GetObjectType()
d3d begin of code reorganization and cleaning
ole32, user32 API hot patched
handling of DWL_DLGPROC message

View File

@ -265,10 +265,10 @@ static void SetPixFmt(LPDDSURFACEDESC2);
static void GetPixFmt(LPDDSURFACEDESC2);
static HookEntry_Type ddHooks[]={
{HOOK_IAT_CANDIDATE, "DirectDrawCreate", (FARPROC)NULL, (FARPROC *)&pDirectDrawCreate, (FARPROC)extDirectDrawCreate},
{HOOK_IAT_CANDIDATE, "DirectDrawCreateEx", (FARPROC)NULL, (FARPROC *)&pDirectDrawCreateEx, (FARPROC)extDirectDrawCreateEx},
{HOOK_IAT_CANDIDATE, "DirectDrawEnumerateA", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerate, (FARPROC)extDirectDrawEnumerate},
{HOOK_IAT_CANDIDATE, "DirectDrawEnumerateExA", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerateEx, (FARPROC)extDirectDrawEnumerateEx},
{HOOK_HOT_CANDIDATE, "DirectDrawCreate", (FARPROC)NULL, (FARPROC *)&pDirectDrawCreate, (FARPROC)extDirectDrawCreate},
{HOOK_HOT_CANDIDATE, "DirectDrawCreateEx", (FARPROC)NULL, (FARPROC *)&pDirectDrawCreateEx, (FARPROC)extDirectDrawCreateEx},
{HOOK_HOT_CANDIDATE, "DirectDrawEnumerateA", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerate, (FARPROC)extDirectDrawEnumerate},
{HOOK_HOT_CANDIDATE, "DirectDrawEnumerateExA", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerateEx, (FARPROC)extDirectDrawEnumerateEx},
//{HOOK_IAT_CANDIDATE, "DirectDrawEnumerateW", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerateW, (FARPROC)extDirectDrawCreate},
//{HOOK_IAT_CANDIDATE, "DirectDrawEnumerateExW", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerateExW, (FARPROC)extDirectDrawCreate},
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
@ -642,92 +642,110 @@ void FixPixelFormat(int ColorDepth, DDPIXELFORMAT *pf)
}
}
static void ddSetCompatibility()
{
typedef HRESULT (WINAPI *SetAppCompatData_Type)(DWORD, DWORD);
SetAppCompatData_Type pSetAppCompatData;
HRESULT res;
HINSTANCE hinst;
hinst=LoadLibrary("ddraw.dll");
pSetAppCompatData=(SetAppCompatData_Type)(*pGetProcAddress)(hinst, "SetAppCompatData");
if(pSetAppCompatData) {
res=(*pSetAppCompatData)(2, 0);
OutTraceDW("HookDirectDraw: SetAppCompatData(2,0) ret=%x(%s)\n", res, ExplainDDError(res));
}
FreeLibrary(hinst);
}
int HookDirectDraw(HMODULE module, int version)
{
HINSTANCE hinst;
void *tmp;
const GUID dd7 = {0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b};
if(dxw.dwFlags2 & SETCOMPATIBILITY) ddSetCompatibility();
if(dxw.dwFlags2 & SETCOMPATIBILITY){
typedef HRESULT (WINAPI *SetAppCompatData_Type)(DWORD, DWORD);
SetAppCompatData_Type pSetAppCompatData;
HRESULT res;
hinst=LoadLibrary("ddraw.dll");
pSetAppCompatData=(SetAppCompatData_Type)(*pGetProcAddress)(hinst, "SetAppCompatData");
if(pSetAppCompatData) {
res=(*pSetAppCompatData)(2, 0);
OutTraceDW("HookDirectDraw: SetAppCompatData(2,0) ret=%x(%s)\n", res, ExplainDDError(res));
}
FreeLibrary(hinst);
}
#if 0
//void *tmp;
//const GUID dd7 = {0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b};
OutTraceB("HookDirectDraw version=%d\n", version); //GHO
switch(version){
case 0: // automatic
tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawCreate", extDirectDrawCreate);
if(tmp) pDirectDrawCreate = (DirectDrawCreate_Type)tmp;
tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawCreateEx", extDirectDrawCreateEx);
if(tmp) pDirectDrawCreateEx = (DirectDrawCreateEx_Type)tmp;
tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawEnumerateA", extDirectDrawEnumerate);
if(tmp) pDirectDrawEnumerate = (DirectDrawEnumerate_Type)tmp;
tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawEnumerateExA", extDirectDrawEnumerateEx);
if(tmp) pDirectDrawEnumerateEx = (DirectDrawEnumerateEx_Type)tmp;
HookLibrary(module, ddHooks, "ddraw.dll");
//tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawCreate", extDirectDrawCreate);
//if(tmp) pDirectDrawCreate = (DirectDrawCreate_Type)tmp;
//tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawCreateEx", extDirectDrawCreateEx);
//if(tmp) pDirectDrawCreateEx = (DirectDrawCreateEx_Type)tmp;
//tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawEnumerateA", extDirectDrawEnumerate);
//if(tmp) pDirectDrawEnumerate = (DirectDrawEnumerate_Type)tmp;
//tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawEnumerateExA", extDirectDrawEnumerateEx);
//if(tmp) pDirectDrawEnumerateEx = (DirectDrawEnumerateEx_Type)tmp;
break;
case 1:
case 2:
case 3:
case 5:
case 6:
hinst = LoadLibrary("ddraw.dll");
pDirectDrawEnumerate =
(DirectDrawEnumerate_Type)GetProcAddress(hinst, "DirectDrawEnumerateA");
pDirectDrawCreate =
(DirectDrawCreate_Type)GetProcAddress(hinst, "DirectDrawCreate");
if(pDirectDrawCreate){
LPDIRECTDRAW lpdd;
BOOL res;
HookAPI(module, "ddraw.dll", pDirectDrawCreate, "DirectDrawCreate", extDirectDrawCreate);
HookAPI(module, "ddraw.dll", pDirectDrawEnumerate, "DirectDrawEnumerateA", extDirectDrawEnumerate);
res=extDirectDrawCreate(0, &lpdd, 0);
if (res){
OutTraceE("DirectDrawCreate: ERROR res=%x(%s)\n", res, ExplainDDError(res));
}
lpdd->Release();
}
break;
HookLibrary(module, ddHooks, "ddraw.dll");
//hinst = LoadLibrary("ddraw.dll");
//pDirectDrawEnumerate =
// (DirectDrawEnumerate_Type)GetProcAddress(hinst, "DirectDrawEnumerateA");
//pDirectDrawCreate =
// (DirectDrawCreate_Type)GetProcAddress(hinst, "DirectDrawCreate");
//if(dxw.dwFlags4 & HOTPATCH){
// extern void *HotPatch(void *, const char *, void *);
// pDirectDrawEnumerate = (DirectDrawEnumerate_Type)HotPatch(pDirectDrawEnumerate, "DirectDrawEnumerate", extDirectDrawEnumerate);
// pDirectDrawCreate = (DirectDrawCreate_Type)HotPatch(pDirectDrawCreate, "DirectDrawCreate", extDirectDrawCreate);
//}
//else {
// if(pDirectDrawCreate){
// LPDIRECTDRAW lpdd;
// BOOL res;
// HookAPI(module, "ddraw.dll", pDirectDrawCreate, "DirectDrawCreate", extDirectDrawCreate);
// HookAPI(module, "ddraw.dll", pDirectDrawEnumerate, "DirectDrawEnumerateA", extDirectDrawEnumerate);
// res=extDirectDrawCreate(0, &lpdd, 0);
// if (res){
// OutTraceE("DirectDrawCreate: ERROR res=%x(%s)\n", res, ExplainDDError(res));
// }
// lpdd->Release();
// }
//}
//break;
case 7:
hinst = LoadLibrary("ddraw.dll");
pDirectDrawEnumerate =
(DirectDrawEnumerate_Type)GetProcAddress(hinst, "DirectDrawEnumerateA");
pDirectDrawEnumerateEx =
(DirectDrawEnumerateEx_Type)GetProcAddress(hinst, "DirectDrawEnumerateExA");
pDirectDrawCreate =
(DirectDrawCreate_Type)GetProcAddress(hinst, "DirectDrawCreate");
if(pDirectDrawCreate){
LPDIRECTDRAW lpdd;
BOOL res;
HookAPI(module, "ddraw.dll", pDirectDrawCreate, "DirectDrawCreate", extDirectDrawCreate);
HookAPI(module, "ddraw.dll", pDirectDrawEnumerate, "DirectDrawEnumerateA", extDirectDrawEnumerate);
HookAPI(module, "ddraw.dll", pDirectDrawEnumerateEx, "DirectDrawEnumerateExA", extDirectDrawEnumerateEx);
res=extDirectDrawCreate(0, &lpdd, 0);
if (res) OutTraceE("DirectDrawCreate: ERROR res=%x(%s)\n", res, ExplainDDError(res));
lpdd->Release();
}
pDirectDrawCreateEx =
(DirectDrawCreateEx_Type)GetProcAddress(hinst, "DirectDrawCreateEx");
if(pDirectDrawCreateEx){
LPDIRECTDRAW lpdd;
BOOL res;
HookAPI(module, "ddraw.dll", pDirectDrawCreateEx, "DirectDrawCreateEx", extDirectDrawCreateEx);
res=extDirectDrawCreateEx(0, &lpdd, dd7, 0);
if (res) OutTraceE("DirectDrawCreateEx: ERROR res=%x(%s)\n", res, ExplainDDError(res));
lpdd->Release();
}
HookLibrary(module, ddHooks, "ddraw.dll");
//hinst = LoadLibrary("ddraw.dll");
//pDirectDrawEnumerate =
// (DirectDrawEnumerate_Type)GetProcAddress(hinst, "DirectDrawEnumerateA");
//pDirectDrawEnumerateEx =
// (DirectDrawEnumerateEx_Type)GetProcAddress(hinst, "DirectDrawEnumerateExA");
//pDirectDrawCreate =
// (DirectDrawCreate_Type)GetProcAddress(hinst, "DirectDrawCreate");
//if(pDirectDrawCreate){
// LPDIRECTDRAW lpdd;
// BOOL res;
// HookAPI(module, "ddraw.dll", pDirectDrawCreate, "DirectDrawCreate", extDirectDrawCreate);
// HookAPI(module, "ddraw.dll", pDirectDrawEnumerate, "DirectDrawEnumerateA", extDirectDrawEnumerate);
// HookAPI(module, "ddraw.dll", pDirectDrawEnumerateEx, "DirectDrawEnumerateExA", extDirectDrawEnumerateEx);
// res=extDirectDrawCreate(0, &lpdd, 0);
// if (res) OutTraceE("DirectDrawCreate: ERROR res=%x(%s)\n", res, ExplainDDError(res));
// lpdd->Release();
//}
//pDirectDrawCreateEx =
// (DirectDrawCreateEx_Type)GetProcAddress(hinst, "DirectDrawCreateEx");
//if(pDirectDrawCreateEx){
// LPDIRECTDRAW lpdd;
// BOOL res;
// HookAPI(module, "ddraw.dll", pDirectDrawCreateEx, "DirectDrawCreateEx", extDirectDrawCreateEx);
// res=extDirectDrawCreateEx(0, &lpdd, dd7, 0);
// if (res) OutTraceE("DirectDrawCreateEx: ERROR res=%x(%s)\n", res, ExplainDDError(res));
// lpdd->Release();
//}
break;
}
if(pDirectDrawCreate || pDirectDrawCreateEx) return 1;
#else
HookLibrary(module, ddHooks, "ddraw.dll");
#endif
return 0;
}

View File

@ -1694,3 +1694,25 @@ char *ExplainWfPFlags(DWORD c)
else strcpy(eb,"CWP_ALL");
return(eb);
}
char *ExplainChangeDisplaySettingsFlags(DWORD c)
{
static char eb[128];
unsigned int l;
strcpy(eb,"CDS_");
if(c & CDS_UPDATEREGISTRY) strcat(eb, "UPDATEREGISTRY+");
if(c & CDS_TEST) strcat(eb, "TEST+");
if(c & CDS_FULLSCREEN) strcat(eb, "FULLSCREEN+");
if(c & CDS_GLOBAL) strcat(eb, "GLOBAL+");
if(c & CDS_SET_PRIMARY) strcat(eb, "SET_PRIMARY+");
if(c & CDS_VIDEOPARAMETERS) strcat(eb, "VIDEOPARAMETERS+");
if(c & CDS_ENABLE_UNSAFE_MODES) strcat(eb, "ENABLE_UNSAFE_MODES+");
if(c & CDS_DISABLE_UNSAFE_MODES) strcat(eb, "DISABLE_UNSAFE_MODES+");
if(c & CDS_RESET) strcat(eb, "RESET+");
if(c & CDS_NORESET) strcat(eb, "NORESET+");
l=strlen(eb);
if (l>strlen("CDS_")) eb[l-1]=0; // delete last '+' if any
else strcpy(eb,"NULL");
return(eb);
}

View File

@ -49,3 +49,4 @@ extern char *ExplainRasterCaps(DWORD);
extern char *ExplainD3DRenderState(DWORD);
extern char *ExplainRenderstateValue(DWORD);
extern char *ExplainWfPFlags(DWORD);
extern char *ExplainChangeDisplaySettingsFlags(DWORD);

View File

@ -1543,8 +1543,31 @@ LPCSTR ProcToString(LPCSTR proc)
FARPROC RemapLibrary(LPCSTR proc, HMODULE hModule, HookEntry_Type *Hooks)
{
void *remapped_addr;
for(; Hooks->APIName; Hooks++){
if (!strcmp(proc,Hooks->APIName)){
if((((dxw.dwFlags4 & HOTPATCH) && (Hooks->HookStatus == HOOK_HOT_CANDIDATE)) || // hot patch candidate still to process - or
((dxw.dwFlags4 & HOTPATCHALWAYS) && (Hooks->HookStatus != HOOK_HOT_LINKED)))){ // force hot patch and not already hooked
if(!Hooks->OriginalAddress) {
Hooks->OriginalAddress=(*pGetProcAddress)(hModule, Hooks->APIName);
if(!Hooks->OriginalAddress) continue;
}
remapped_addr = HotPatch(Hooks->OriginalAddress, Hooks->APIName, Hooks->HookerAddress);
if(remapped_addr == (void *)1) { // should never go here ...
Hooks->HookStatus = HOOK_HOT_LINKED;
continue; // already hooked
}
if(remapped_addr) {
Hooks->HookStatus = HOOK_HOT_LINKED;
if(Hooks->StoreAddress) *(Hooks->StoreAddress) = (FARPROC)remapped_addr;
}
}
if(Hooks->HookStatus == HOOK_HOT_LINKED) {
OutTraceDW("GetProcAddress: hot patched proc=%s addr=%x\n", ProcToString(proc), Hooks->HookerAddress);
return Hooks->HookerAddress;
}
if (Hooks->StoreAddress) *(Hooks->StoreAddress)=(*pGetProcAddress)(hModule, proc);
OutTraceDW("GetProcAddress: hooking proc=%s addr=%x->%x\n",
ProcToString(proc), (Hooks->StoreAddress) ? *(Hooks->StoreAddress) : 0, Hooks->HookerAddress);
@ -1556,6 +1579,8 @@ FARPROC RemapLibrary(LPCSTR proc, HMODULE hModule, HookEntry_Type *Hooks)
void HookLibrary(HMODULE hModule, HookEntry_Type *Hooks, char *DLLName)
{
HMODULE hDLL = NULL;
//OutTrace("HookLibrary: hModule=%x dll=%s\n", hModule, DLLName);
for(; Hooks->APIName; Hooks++){
//tmp = HookAPI(hModule, DLLName, Hooks->HookStatus, Hooks->OriginalAddress, Hooks->APIName, Hooks->HookerAddress);
//if(tmp && Hooks->StoreAddress) *(Hooks->StoreAddress) = (FARPROC)tmp;
@ -1577,8 +1602,26 @@ void HookLibrary(HMODULE hModule, HookEntry_Type *Hooks, char *DLLName)
if((((dxw.dwFlags4 & HOTPATCH) && (Hooks->HookStatus == HOOK_HOT_CANDIDATE)) || // hot patch candidate still to process - or
((dxw.dwFlags4 & HOTPATCHALWAYS) && (Hooks->HookStatus != HOOK_HOT_LINKED))) // force hot patch and not already hooked
&&
(Hooks->OriginalAddress && Hooks->StoreAddress)){ // API address and save ptr available
// Hot Patch
Hooks->StoreAddress){ // and save ptr available
#if 1
// Hot Patch - beware! This way yo're likely to hook unneeded libraries.
if(!Hooks->OriginalAddress) {
if(!hDLL) {
hDLL = (*pLoadLibraryA)(DLLName);
if(!hDLL) {
OutTrace("HookLibrary: LoadLibrary failed on DLL=%s err=%x\n", DLLName, GetLastError());
continue;
}
}
Hooks->OriginalAddress=(*pGetProcAddress)(hDLL, Hooks->APIName);
if(!Hooks->OriginalAddress) {
OutTrace("HookLibrary: GetProcAddress failed on API=%s err=%x\n", Hooks->APIName, GetLastError());
continue;
}
}
#else
if(!Hooks->OriginalAddress) continue;
#endif
remapped_addr = HotPatch(Hooks->OriginalAddress, Hooks->APIName, Hooks->HookerAddress);
if(remapped_addr == (void *)1) { // should never go here ...
Hooks->HookStatus = HOOK_HOT_LINKED;

View File

@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "dxwnd.h"
#include "dxwcore.hpp"
#define VERSION "2.02.77"
#define VERSION "2.02.78"
#define DDTHREADLOCK 1

Binary file not shown.

View File

@ -1804,9 +1804,9 @@ DWORD WINAPI extGetObjectType(HGDIOBJ h)
{
DWORD res;
res=(*pGetObjectType)(h);
OutTraceDW("GetObjectType: h=%x type=%x", h, res);
OutTraceDW("GetObjectType: h=%x type=%x\n", h, res);
if(h==dxw.VirtualHDC) {
OutTraceDW("GetObjectType: REMAP h=%x type=%x->%x", h, res, OBJ_DC);
OutTraceDW("GetObjectType: REMAP h=%x type=%x->%x\n", h, res, OBJ_DC);
res=OBJ_DC;
}
return res;

File diff suppressed because it is too large Load Diff

View File

@ -8,9 +8,9 @@
extern void HookModule(HMODULE, int);
static HookEntry_Type Hooks[]={
{HOOK_IAT_CANDIDATE, "CoCreateInstance", NULL, (FARPROC *)&pCoCreateInstance, (FARPROC)extCoCreateInstance},
{HOOK_IAT_CANDIDATE, "CoCreateInstanceEx", NULL, (FARPROC *)&pCoCreateInstanceEx, (FARPROC)extCoCreateInstanceEx},
{HOOK_IAT_CANDIDATE, "CoInitialize", NULL, (FARPROC *)&pCoInitialize, (FARPROC)extCoInitialize},
{HOOK_HOT_CANDIDATE, "CoCreateInstance", NULL, (FARPROC *)&pCoCreateInstance, (FARPROC)extCoCreateInstance},
{HOOK_HOT_CANDIDATE, "CoCreateInstanceEx", NULL, (FARPROC *)&pCoCreateInstanceEx, (FARPROC)extCoCreateInstanceEx},
{HOOK_HOT_CANDIDATE, "CoInitialize", NULL, (FARPROC *)&pCoInitialize, (FARPROC)extCoInitialize},
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
};

View File

@ -125,10 +125,10 @@ static HookEntry_Type MouseHooks[]={
};
static HookEntry_Type WinHooks[]={
{HOOK_IAT_CANDIDATE, "ShowWindow", (FARPROC)ShowWindow, (FARPROC *)&pShowWindow, (FARPROC)extShowWindow},
{HOOK_IAT_CANDIDATE, "SetWindowPos", (FARPROC)SetWindowPos, (FARPROC *)&pSetWindowPos, (FARPROC)extSetWindowPos},
{HOOK_IAT_CANDIDATE, "DeferWindowPos", (FARPROC)DeferWindowPos, (FARPROC *)&pGDIDeferWindowPos, (FARPROC)extDeferWindowPos},
{HOOK_IAT_CANDIDATE, "CallWindowProcA", (FARPROC)CallWindowProcA, (FARPROC *)&pCallWindowProc, (FARPROC)extCallWindowProc},
{HOOK_HOT_CANDIDATE, "ShowWindow", (FARPROC)ShowWindow, (FARPROC *)&pShowWindow, (FARPROC)extShowWindow},
{HOOK_HOT_CANDIDATE, "SetWindowPos", (FARPROC)SetWindowPos, (FARPROC *)&pSetWindowPos, (FARPROC)extSetWindowPos},
{HOOK_HOT_CANDIDATE, "DeferWindowPos", (FARPROC)DeferWindowPos, (FARPROC *)&pGDIDeferWindowPos, (FARPROC)extDeferWindowPos},
{HOOK_HOT_CANDIDATE, "CallWindowProcA", (FARPROC)CallWindowProcA, (FARPROC *)&pCallWindowProc, (FARPROC)extCallWindowProc},
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
};
@ -277,7 +277,7 @@ LONG WINAPI MyChangeDisplaySettings(char *fname, BOOL WideChar, void *lpDevMode,
dxw.SetFullScreen(TRUE);
}
}
if ((dwflags==0 || dwflags==CDS_FULLSCREEN) && lpDevMode){
if (dxw.dwFlags1 & EMULATESURFACE || !(dmFields & DM_BITSPERPEL)){
OutTraceDW("%s: BYPASS res=DISP_CHANGE_SUCCESSFUL\n", fname);
@ -286,7 +286,7 @@ LONG WINAPI MyChangeDisplaySettings(char *fname, BOOL WideChar, void *lpDevMode,
else{
DEVMODEA NewMode;
if(dwflags==CDS_FULLSCREEN) dwflags=0; // no FULLSCREEN
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &NewMode);
(*pEnumDisplaySettings)(NULL, ENUM_CURRENT_SETTINGS, &NewMode);
OutTraceDW("ChangeDisplaySettings: CURRENT wxh=(%dx%d) BitsPerPel=%d -> %d\n",
NewMode.dmPelsWidth, NewMode.dmPelsHeight, NewMode.dmBitsPerPel, dmBitsPerPel);
NewMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
@ -298,7 +298,7 @@ LONG WINAPI MyChangeDisplaySettings(char *fname, BOOL WideChar, void *lpDevMode,
}
else{
if(WideChar)
return (*pChangeDisplaySettingsW)((LPDEVMODEW)lpDevMode, dwflags);
return (*pChangeDisplaySettingsExW)(NULL, (LPDEVMODEW)lpDevMode, NULL, dwflags, NULL);
else
return (*pChangeDisplaySettingsExA)(NULL, (LPDEVMODEA)lpDevMode, NULL, dwflags, NULL);
}
@ -539,7 +539,7 @@ LONG WINAPI extGetWindowLong(HWND hwnd, int nIndex, GetWindowLong_Type pGetWindo
OutTraceDW("GetWindowLong: hwnd=%x, Index=%x(%s) res=%x\n", hwnd, nIndex, ExplainSetWindowIndex(nIndex), res);
if(nIndex==GWL_WNDPROC){
if((nIndex==GWL_WNDPROC)||(nIndex==DWL_DLGPROC)){
WNDPROC wp;
wp=WhndGetWindowProc(hwnd);
OutTraceDW("GetWindowLong: remapping WindowProc res=%x -> %x\n", res, (LONG)wp);
@ -606,7 +606,7 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong, SetWindowLon
}
}
if ((nIndex==GWL_WNDPROC) && dxw.IsFullScreen()){ // v2.02.51 - see A10 Cuba....
if (((nIndex==GWL_WNDPROC)||(nIndex==DWL_DLGPROC)) && dxw.IsFullScreen()){ // v2.02.51 - see A10 Cuba....
//if (nIndex==GWL_WNDPROC){
WNDPROC lres;
WNDPROC OldProc;
@ -617,7 +617,7 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong, SetWindowLon
}
// end of GPL fix
OldProc = (WNDPROC)(*pGetWindowLongA)(hwnd, GWL_WNDPROC);
OldProc = (WNDPROC)(*pGetWindowLongA)(hwnd, nIndex);
// v2.02.70 fix
if((OldProc==extWindowProc) ||
(OldProc==extChildWindowProc)||
@ -626,7 +626,7 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong, SetWindowLon
WhndStackPush(hwnd, (WNDPROC)dwNewLong);
res=(LONG)OldProc;
SetLastError(0);
lres=(WNDPROC)(*pSetWindowLongA)(hwnd, GWL_WNDPROC, (LONG)extWindowProc);
lres=(WNDPROC)(*pSetWindowLongA)(hwnd, nIndex, (LONG)extWindowProc);
if(!lres && GetLastError())OutTraceE("SetWindowLong: ERROR err=%d at %d\n", GetLastError(), __LINE__);
}
else {
@ -1165,6 +1165,24 @@ static HWND WINAPI extCreateWindowCommon(
if(!res) OutTraceE("%s: SetWindowLong ERROR %x\n", ApiName, GetLastError());
WhndStackPush(hwnd, pWindowProc);
}
if ((dwStyle & WS_DLGFRAME) && (dxw.dwFlags1 & HOOKCHILDWIN)){
// child window inherit the father's windproc, so if it's redirected to
// a hooker (either extWindowProc or extChildWindowProc) you have to retrieve
// the correct value (WhndGetWindowProc) before saving it (WhndStackPush).
long res;
pWindowProc = (WNDPROC)(*pGetWindowLongA)(hwnd, DWL_DLGPROC);
if((pWindowProc == extWindowProc) ||
(pWindowProc == extChildWindowProc) ||
(pWindowProc == extDialogWindowProc)){ // avoid recursions
HWND Father;
Father=GetParent(hwnd);
pWindowProc=WhndGetWindowProc(Father);
}
OutTraceDW("Hooking CHILD hwnd=%x father WindowProc %x->%x\n", hwnd, pWindowProc, extChildWindowProc);
res=(*pSetWindowLongA)(hwnd, DWL_DLGPROC, (LONG)extDialogWindowProc);
if(!res) OutTraceE("%s: SetWindowLong ERROR %x\n", ApiName, GetLastError());
WhndStackPush(hwnd, pWindowProc);
}
OutTraceDW("%s: ret=%x\n", ApiName, hwnd);
return hwnd;
}
@ -1333,6 +1351,24 @@ static HWND WINAPI extCreateWindowCommon(
if(!res) OutTraceE("%s: SetWindowLong ERROR %x\n", ApiName, GetLastError());
WhndStackPush(hwnd, pWindowProc);
}
if ((dwStyle & WS_DLGFRAME) && (dxw.dwFlags1 & HOOKCHILDWIN)){
// child window inherit the father's windproc, so if it's redirected to
// a hooker (either extWindowProc or extChildWindowProc) you have to retrieve
// the correct value (WhndGetWindowProc) before saving it (WhndStackPush).
long res;
pWindowProc = (WNDPROC)(*pGetWindowLongA)(hwnd, DWL_DLGPROC);
if((pWindowProc == extWindowProc) ||
(pWindowProc == extChildWindowProc) ||
(pWindowProc == extDialogWindowProc)){ // avoid recursions
HWND Father;
Father=GetParent(hwnd);
pWindowProc=WhndGetWindowProc(Father);
}
OutTraceDW("Hooking CHILD hwnd=%x father WindowProc %x->%x\n", hwnd, pWindowProc, extChildWindowProc);
res=(*pSetWindowLongA)(hwnd, DWL_DLGPROC, (LONG)extDialogWindowProc);
if(!res) OutTraceE("%s: SetWindowLong ERROR %x\n", ApiName, GetLastError());
WhndStackPush(hwnd, pWindowProc);
}
OutTraceDW("%s: ret=%x\n", ApiName, hwnd);
return hwnd;
@ -1649,7 +1685,7 @@ LONG WINAPI extEnumDisplaySettings(LPCTSTR lpszDeviceName, DWORD iModeNum, DEVMO
LONG WINAPI extChangeDisplaySettingsA(DEVMODEA *lpDevMode, DWORD dwflags)
{
if(IsTraceDDRAW){
OutTrace("ChangeDisplaySettingsA: lpDevMode=%x flags=%x", lpDevMode, dwflags);
OutTrace("ChangeDisplaySettingsA: lpDevMode=%x flags=%x(%s)", lpDevMode, dwflags, ExplainChangeDisplaySettingsFlags(dwflags));
if (lpDevMode) OutTrace(" DeviceName=%s fields=%x(%s) size=(%d x %d) bpp=%d",
lpDevMode->dmDeviceName, lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields),
lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel);
@ -1665,7 +1701,7 @@ LONG WINAPI extChangeDisplaySettingsA(DEVMODEA *lpDevMode, DWORD dwflags)
LONG WINAPI extChangeDisplaySettingsW(DEVMODEW *lpDevMode, DWORD dwflags)
{
if(IsTraceDDRAW){
OutTrace("ChangeDisplaySettingsW: lpDevMode=%x flags=%x", lpDevMode, dwflags);
OutTrace("ChangeDisplaySettingsW: lpDevMode=%x flags=%x(%s)", lpDevMode, dwflags, ExplainChangeDisplaySettingsFlags(dwflags));
if (lpDevMode) OutTrace(" DeviceName=%ls fields=%x(%s) size=(%d x %d) bpp=%d",
lpDevMode->dmDeviceName, lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields),
lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel);
@ -1681,7 +1717,7 @@ LONG WINAPI extChangeDisplaySettingsW(DEVMODEW *lpDevMode, DWORD dwflags)
LONG WINAPI extChangeDisplaySettingsExA(LPCTSTR lpszDeviceName, DEVMODEA *lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam)
{
if(IsTraceDDRAW){
OutTrace("ChangeDisplaySettingsExA: DeviceName=%s lpDevMode=%x flags=%x", lpszDeviceName, lpDevMode, dwflags);
OutTrace("ChangeDisplaySettingsExA: DeviceName=%s lpDevMode=%x flags=%x(%s)", lpszDeviceName, lpDevMode, dwflags, ExplainChangeDisplaySettingsFlags(dwflags));
if (lpDevMode) OutTrace(" DeviceName=%s fields=%x(%s) size=(%d x %d) bpp=%d",
lpDevMode->dmDeviceName, lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields),
lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel);
@ -1697,7 +1733,7 @@ LONG WINAPI extChangeDisplaySettingsExA(LPCTSTR lpszDeviceName, DEVMODEA *lpDevM
LONG WINAPI extChangeDisplaySettingsExW(LPCTSTR lpszDeviceName, DEVMODEW *lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam)
{
if(IsTraceDDRAW){
OutTrace("ChangeDisplaySettingsExW: DeviceName=%ls lpDevMode=%x flags=%x", lpszDeviceName, lpDevMode, dwflags);
OutTrace("ChangeDisplaySettingsExW: DeviceName=%ls lpDevMode=%x flags=%x(%s)", lpszDeviceName, lpDevMode, dwflags, ExplainChangeDisplaySettingsFlags(dwflags));
if (lpDevMode) OutTrace(" DeviceName=%ls fields=%x(%s) size=(%d x %d) bpp=%d",
lpDevMode->dmDeviceName, lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields),
lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel);

Binary file not shown.