diff --git a/build/dxwnd.dll b/build/dxwnd.dll index fa2b277..08ed6d5 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1db64cc2ff8db11e460be5c81efc1a0da01f7393b14471b0d3fb158105ed4523 +oid sha256:a5cf1c69e785fd49a000d8d45799f9cc319a62bbade9c8fece0a48fc1860c4c1 size 774656 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 21123ed..ea6e28e 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cac62feee622d3aecce7d6529ebd4f0460d97e9eb20edf79b3a03d935610cc1f +oid sha256:faa2086fcb25e8c4f488ce6c9a216819960a29cc365be1debe325635fef886e8 size 669696 diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index 6947a34..4c2b8e3 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -1423,3 +1423,14 @@ add: D3D8 16bpp backbuffer emulation on 32bpp color depth. Fixes "Dangerous Wate add: more OpenGL wgl* hooks, used by "StarSiege 2014". fix: using correct version method pointers in bilinear blit, avoids crash in "Daytona USA" using bilinear filtering fix: do not try to CloseHandle the handle returned by GetMenu, avoids debugger exceptions. + +v2.04.04 +GUI: +add: run unhooked command +fix: improved logic to propose config save only when virtual registry string is potentially updated +fix: when hooking is disabled, STARTDEBUG and INJECTSUSPENDED processing don't take place +DLL: +fix: crashing condition on "hide desktop background" option - fixes M&MVI crash +fix: mouse loop coordinate fix when main window is not set +fix: eliminated log of dmDeviceName field in ChangeDisplaySettings* calls because the field may be not initialized +fix: NOMOVIES option now stops also SmackW32 movies (making movie length only 1 photogram). diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index b61f9b4..f59e360 100644 --- a/dll/dxwnd.cpp +++ b/dll/dxwnd.cpp @@ -27,7 +27,7 @@ along with this program. If not, see . #include "TlHelp32.h" -#define VERSION "2.04.03.fx1" +#define VERSION "2.04.04" #define DDTHREADLOCK 1 diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 6e767de..c4ed85e 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/hd3d.cpp b/dll/hd3d.cpp index 5e633ff..0003bba 100644 --- a/dll/hd3d.cpp +++ b/dll/hd3d.cpp @@ -509,9 +509,6 @@ void HookD3DDevice8(void** ppD3Ddev8) if((dxw.dwFlags5 & TEXTUREMASK) || (dxw.dwFlags4 & NOTEXTURES)){ SetHook((void *)(**(DWORD **)ppD3Ddev8 + 244), extSetTexture8, (void **)&pSetTexture8, "SetTexture(D8)"); } - //if (!(dxw.dwTFlags & OUTPROXYTRACE)) return; - //SetHook((void *)(**(DWORD **)ppD3Ddev8 + 4), extAddRef8, (void **)&pAddRef8, "AddRef(D8)"); - //SetHook((void *)(**(DWORD **)ppD3Ddev8 + 8), extRelease8, (void **)&pRelease8, "Release(D8)"); } void HookD3DDevice9(void** ppD3Ddev9) diff --git a/dll/iatpatch.cpp b/dll/iatpatch.cpp index abbed0e..7720284 100644 --- a/dll/iatpatch.cpp +++ b/dll/iatpatch.cpp @@ -155,14 +155,14 @@ void *IATPatchSequential(HMODULE module, DWORD ordinal, char *dll, void *apiproc pidesc ++; } pidesc = (PIMAGE_IMPORT_DESCRIPTOR)(base + rva); - OutTraceB("IATPatch: first call=%s\n", fname); + //OutTraceB("IATPatch: first call=%s\n", fname); while(pidesc->FirstThunk){ impmodule = (PSTR)(base + pidesc->Name); if(!lstrcmpi(dll, impmodule)) { OutTraceH("IATPatch: dll=%s found at %x\n", dll, impmodule); - OutTraceH("IATPatch: first call=%s\n", fname); + //OutTraceH("IATPatch: first call=%s\n", fname); ptaddr = (PIMAGE_THUNK_DATA)(base + (DWORD)pidesc->FirstThunk); ptname = (pidesc->OriginalFirstThunk) ? (PIMAGE_THUNK_DATA)(base + (DWORD)pidesc->OriginalFirstThunk) : NULL; @@ -228,7 +228,7 @@ void *IATPatchSequential(HMODULE module, DWORD ordinal, char *dll, void *apiproc } } else{ - OutTraceDW("IATPatch: skip dll=%s first call=%s\n", impmodule, fname); + //OutTraceDW("IATPatch: skip dll=%s first call=%s\n", impmodule, fname); // skip dll fnames ... ptaddr = (PIMAGE_THUNK_DATA)(base + (DWORD)pidesc->FirstThunk); //ptname = (pidesc->OriginalFirstThunk) ? (PIMAGE_THUNK_DATA)(base + (DWORD)pidesc->OriginalFirstThunk) : NULL; diff --git a/dll/smack.cpp b/dll/smack.cpp index 21f59e4..b6c9e83 100644 --- a/dll/smack.cpp +++ b/dll/smack.cpp @@ -6,26 +6,13 @@ #include "syslibs.h" #include "dxhook.h" -#if 0 -#pragma pack(1) -typedef struct { - UINT32 Version; - UINT32 Width; - UINT32 Height; - UINT32 Frame; - UINT32 mspf; - char unknown[864]; - UINT32 FrameNum; -} Smack; -#else #include "smack.h" -#endif typedef Smack * (WINAPI *SmackOpen_Type)(HANDLE, UINT32, INT32); -typedef Smack * (WINAPI *Smacker_Type)(HANDLE); -typedef Smack * (WINAPI *Smacker2_Type)(HANDLE, UINT32); -typedef Smack * (WINAPI *SmackColorRemap_Type)(HANDLE, const void PTR4 *, u32, u32); -typedef Smack * (WINAPI *SmackColorRemapWithTrans_Type)(HANDLE, const void PTR4 *, u32, u32, u32); +typedef Smack * (WINAPI *Smacker_Type)(Smack *); +typedef Smack * (WINAPI *Smacker2_Type)(Smack *, UINT32); +typedef Smack * (WINAPI *SmackColorRemap_Type)(Smack *, const void PTR4 *, u32, u32); +typedef Smack * (WINAPI *SmackColorRemapWithTrans_Type)(Smack *, const void PTR4 *, u32, u32, u32); typedef u32 (RADEXPLINK *SmackSetSystemRes_Type)(u32); SmackOpen_Type pSmackOpen; @@ -36,16 +23,16 @@ SmackColorRemapWithTrans_Type pSmackColorRemapWithTrans; SmackSetSystemRes_Type pSmackSetSystemRes; Smack * WINAPI extSmackOpen(HANDLE, UINT32, INT32); -Smack * WINAPI extSmackClose(HANDLE); -Smack * WINAPI extSmackWait(HANDLE); -Smack * WINAPI extSmackDoFrame(HANDLE); -Smack * WINAPI extSmackNextFrame(HANDLE); -Smack * WINAPI extSmackSoundUseMSS(HANDLE); -Smack * WINAPI extSmackSoundUseDirectSound(HANDLE); -Smack * WINAPI extSmackSoundOnOff(HANDLE, UINT32); -Smack * WINAPI extSmackGoto(HANDLE, UINT32); -Smack * WINAPI extSmackColorRemap(HANDLE, const void PTR4 *, u32, u32); -Smack * WINAPI extSmackColorRemapWithTrans(HANDLE, const void PTR4 *, u32, u32, u32); +Smack * WINAPI extSmackClose(Smack *); +Smack * WINAPI extSmackWait(Smack *); +Smack * WINAPI extSmackDoFrame(Smack *); +Smack * WINAPI extSmackNextFrame(Smack *); +Smack * WINAPI extSmackSoundUseMSS(Smack *); +Smack * WINAPI extSmackSoundUseDirectSound(Smack *); +Smack * WINAPI extSmackSoundOnOff(Smack *, UINT32); +Smack * WINAPI extSmackGoto(Smack *, UINT32); +Smack * WINAPI extSmackColorRemap(Smack *, const void PTR4 *, u32, u32); +Smack * WINAPI extSmackColorRemapWithTrans(Smack *, const void PTR4 *, u32, u32, u32); u32 RADEXPLINK extSmackSetSystemRes(u32 mode); static HookEntryEx_Type Hooks[]={ @@ -124,32 +111,36 @@ static void DumpSmack(Smack *s) Smack * WINAPI extSmackOpen(HANDLE SmackFile, UINT32 flags, INT32 extrabuf) { - Smack *ret; + Smack *h; OutTraceDW("SmackOpen: SmackFile=%x flags=%x(%s) extrabuf=%x\n", SmackFile, flags, ExplainSmackFlags(flags), extrabuf); if(!pSmackOpen) OutTraceE("ASSERT: NULL pSmackOpen\n"); - ret=(*pSmackOpen)(SmackFile, flags, extrabuf); - OutTraceDW("SmackOpen: ret=%x\n", ret); - if (ret) { - OutTraceDW("SmackOpen: version=\"%4.4s\" screen=(%dx%d) frame_count=%d frame_number=%d\n", - (char *)&(ret->Version), ret->Width, ret->Height, ret->Frames, ret->FrameNum); + h=(*pSmackOpen)(SmackFile, flags, extrabuf); + OutTraceDW("SmackOpen: ret=%x\n", h); + if (!h) return NULL; + + DumpSmack(h); + if(dxw.dwFlags6 & NOMOVIES) { + OutTraceDW("SmackOpen: NOMOVIES\n"); + h->Frames = 1; // returning NULL or a frame counter below 1 is risky! + return h; } - return ret; + return h; } -Smack * WINAPI extSmackClose(HANDLE h) +Smack * WINAPI extSmackClose(Smack *h) { OutTraceDW("SmackClose: h=%x\n", h); return (*pSmackClose)(h); } -Smack * WINAPI extSmackWait(HANDLE h) +Smack * WINAPI extSmackWait(Smack *h) { OutTraceDW("SmackWait: h=%x\n", h); DumpSmack((Smack *)h); return (*pSmackWait)(h); } -Smack * WINAPI extSmackDoFrame(HANDLE h) +Smack * WINAPI extSmackDoFrame(Smack *h) { Smack *ret; OutTraceDW("SmackDoFrame: h=%x\n", h); @@ -162,57 +153,57 @@ Smack * WINAPI extSmackDoFrame(HANDLE h) return ret; } -Smack * WINAPI extSmackNextFrame(HANDLE h) +Smack * WINAPI extSmackNextFrame(Smack *h) { OutTraceDW("SmackNextFrame: h=%x\n", h); - DumpSmack((Smack *)h); + DumpSmack(h); return (*pSmackNextFrame)(h); } -Smack * WINAPI extSmackSoundUseMSS(HANDLE h) +Smack * WINAPI extSmackSoundUseMSS(Smack *h) { OutTraceDW("SmackSoundUseMSS: h=%x\n", h); - DumpSmack((Smack *)h); + DumpSmack(h); return (*pSmackSoundUseMSS)(h); } -Smack * WINAPI extSmackSoundUseDirectSound(HANDLE h) +Smack * WINAPI extSmackSoundUseDirectSound(Smack *h) { OutTraceDW("SmackSoundUseDirectSound: h=%x\n", h); - DumpSmack((Smack *)h); + DumpSmack(h); return (*pSmackSoundUseDirectSound)(h); } -Smack * WINAPI extSmackSoundOnOff(HANDLE h, UINT32 flag) +Smack * WINAPI extSmackSoundOnOff(Smack *h, UINT32 flag) { OutTraceDW("SmackSoundOnOff: h=%x flag=%x\n", h, flag); - DumpSmack((Smack *)h); + DumpSmack(h); return (*pSmackSoundOnOff)(h, flag); } -Smack * WINAPI extSmackGoto(HANDLE h, UINT32 flag) +Smack * WINAPI extSmackGoto(Smack *h, UINT32 flag) { OutTraceDW("SmackGoto: h=%x flag=%x\n", h, flag); - DumpSmack((Smack *)h); + DumpSmack(h); return (*pSmackGoto)(h, flag); } -Smack * WINAPI extSmackColorRemap(HANDLE h, const void PTR4 *remappal, u32 numcolors, u32 paltype) +Smack * WINAPI extSmackColorRemap(Smack *h, const void PTR4 *remappal, u32 numcolors, u32 paltype) { OutTraceDW("SmackColorRemap: h=%x numcolors=%d paltype=%d\n", h, numcolors, paltype); - DumpSmack((Smack *)h); + DumpSmack(h); // BYPASS the call to avoid resolution changes //return (*pSmackColorRemap)(h, remappal, numcolors, paltype); - return (Smack *)h; + return h; } -Smack * WINAPI extSmackColorRemapWithTrans(HANDLE h, const void PTR4 *remappal, u32 numcolors, u32 paltype, u32 transindex) +Smack * WINAPI extSmackColorRemapWithTrans(Smack *h, const void PTR4 *remappal, u32 numcolors, u32 paltype, u32 transindex) { OutTraceDW("SmackColorRemapWithTrans: h=%x numcolors=%d paltype=%d transindex=%d\n", h, numcolors, paltype, transindex); - DumpSmack((Smack *)h); + DumpSmack(h); // BYPASS the call to avoid resolution changes //return (*pSmackColorRemapWithTrans)(h, remappal, numcolors, paltype); - return (Smack *)h; + return h; } /* --------------------------------------------------------------- diff --git a/dll/user32.cpp b/dll/user32.cpp index ec523f0..549c0d5 100644 --- a/dll/user32.cpp +++ b/dll/user32.cpp @@ -165,7 +165,7 @@ static HookEntryEx_Type Hooks[]={ //{HOOK_IAT_CANDIDATE, 0, "TranslateMessage", (FARPROC)TranslateMessage, (FARPROC *)&pTranslateMessage, (FARPROC)extTranslateMessage}, - {HOOK_IAT_CANDIDATE, 0, "UpdateWindow", (FARPROC)NULL, (FARPROC *)&pUpdateWindow, (FARPROC)extUpdateWindow}, + {HOOK_IAT_CANDIDATE, 0, "UpdateWindow", (FARPROC)UpdateWindow, (FARPROC *)&pUpdateWindow, (FARPROC)extUpdateWindow}, // v2.04.04: needed for "Hide Desktop" option //{HOOK_IAT_CANDIDATE, 0, "GetWindowPlacement", (FARPROC)NULL, (FARPROC *)&pGetWindowPlacement, (FARPROC)extGetWindowPlacement}, //{HOOK_IAT_CANDIDATE, 0, "SetWindowPlacement", (FARPROC)NULL, (FARPROC *)&pSetWindowPlacement, (FARPROC)extSetWindowPlacement}, {HOOK_HOT_CANDIDATE, 0x25, "ChangeDisplaySettingsA", (FARPROC)ChangeDisplaySettingsA, (FARPROC *)&pChangeDisplaySettingsA, (FARPROC)extChangeDisplaySettingsA}, @@ -777,6 +777,7 @@ BOOL WINAPI extShowWindow(HWND hwnd, int nCmdShow) BOOL res; extern HWND hTrayWnd; static long iLastSizX, iLastSizY; + int nOrigCmd; //static long iLastPosX, iLastPosY; OutTraceDW("ShowWindow: hwnd=%x, CmdShow=%x(%s)\n", hwnd, nCmdShow, ExplainShowCmd(nCmdShow)); @@ -787,6 +788,7 @@ BOOL WINAPI extShowWindow(HWND hwnd, int nCmdShow) return TRUE; } + nOrigCmd = nCmdShow; if (dxw.dwFlags1 & PREVENTMAXIMIZE){ if(nCmdShow==SW_MAXIMIZE){ OutTraceDW("ShowWindow: suppress SW_MAXIMIZE maximize\n"); @@ -804,14 +806,12 @@ BOOL WINAPI extShowWindow(HWND hwnd, int nCmdShow) } res=(*pShowWindow)(hwnd, nCmdShow); - // v2.03.95: force zero size when minimize and drefresh window coordinates + // v2.03.95: force zero size when minimize and refresh window coordinates if(hwnd == dxw.GethWnd()){ if(nCmdShow==SW_MINIMIZE) { dxw.IsVisible = FALSE; iLastSizX = dxw.iSizX; iLastSizY = dxw.iSizY; - //iLastPosX = dxw.iPosX; - //iLastPosY = dxw.iPosY; dxw.iSizX = dxw.iSizY = 0; } else { @@ -819,11 +819,10 @@ BOOL WINAPI extShowWindow(HWND hwnd, int nCmdShow) if((dxw.iSizX == 0) && (dxw.iSizY == 0)){ dxw.iSizX = iLastSizX; dxw.iSizY = iLastSizY; - //dxw.iPosX = iLastPosX; - //dxw.iPosY = iLastPosY; } } } + //dxw.UpdateDesktopCoordinates(); OutTraceDW("ShowWindow: res=%x\n", res); @@ -1269,8 +1268,14 @@ static BOOL WINAPI extPeekMessage(PeekMessage_Type pPeekMessage, LPMSG lpMsg, HW lpMsg->wParam, lpMsg->lParam, lpMsg->pt.x, lpMsg->pt.y, res); } - if(dxw.dwFlags1 & MODIFYMOUSE){ - extGetCursorPos(&(lpMsg->pt)); + if((dxw.dwFlags1 & MODIFYMOUSE) && dxw.GethWnd()){ + POINT point; + //res=(*pGetCursorPos)(&point); // can't do this. Why? + point = lpMsg->pt; + point=dxw.ScreenToClient(point); + point=dxw.FixCursorPos(point); + OutTraceC("GetCursorPos: FIXED pos=(%d,%d)->(%d,%d)\n", lpMsg->pt.x, lpMsg->pt.y, point.x, point.y); + lpMsg->pt = point; } if(dxw.dwFlags1 & SLOWDOWN) (*pSleep)(1); @@ -2340,8 +2345,9 @@ LONG WINAPI extChangeDisplaySettingsA(DEVMODEA *lpDevMode, DWORD dwflags) if(IsTraceDDRAW){ char sInfo[1024]; strcpy(sInfo, ""); - if (lpDevMode) sprintf(sInfo, " DeviceName=%s fields=%x(%s) size=(%d x %d) bpp=%d", - lpDevMode->dmDeviceName, lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields), + // v2.04.04: dmDeviceName not printed since it could be not initialized (Warhammer SOTHR) + if (lpDevMode) sprintf(sInfo, " fields=%x(%s) size=(%d x %d) bpp=%d", + lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields), lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel); OutTrace("ChangeDisplaySettingsA: lpDevMode=%x flags=%x(%s)%s\n", lpDevMode, dwflags, ExplainChangeDisplaySettingsFlags(dwflags), sInfo); @@ -2358,8 +2364,9 @@ LONG WINAPI extChangeDisplaySettingsW(DEVMODEW *lpDevMode, DWORD dwflags) if(IsTraceDDRAW){ char sInfo[1024]; strcpy(sInfo, ""); - if (lpDevMode) sprintf(sInfo, " DeviceName=%ls fields=%x(%s) size=(%d x %d) bpp=%d", - lpDevMode->dmDeviceName, lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields), + // v2.04.04: dmDeviceName not printed since it could be not initialized (Warhammer SOTHR) + if (lpDevMode) sprintf(sInfo, "fields=%x(%s) size=(%d x %d) bpp=%d", + lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields), lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel); OutTrace("ChangeDisplaySettingsW: lpDevMode=%x flags=%x(%s)%s\n", lpDevMode, dwflags, ExplainChangeDisplaySettingsFlags(dwflags), sInfo); diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index e1c83f5..9592d63 100644 Binary files a/host/dxwndhost.rc and b/host/dxwndhost.rc differ diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo index 5ed9731..dc7ba98 100644 Binary files a/host/dxwndhost.vs2008.suo and b/host/dxwndhost.vs2008.suo differ diff --git a/host/dxwndhostView.cpp b/host/dxwndhostView.cpp index f1ab47b..1132085 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -95,7 +95,6 @@ static char *Unescape(char *s, char **dest) return *dest; } - void GetFolderFromPath(char *path) { for(char *c=&path[strlen(path)-1]; (c>path) && (*c!='\\'); c--) *c=0; @@ -1230,6 +1229,7 @@ void CDxwndhostView::SaveConfigFile() } for(; i < MAXTARGETS; i ++) ClearTarget(i, gInitPath); this->isUpdated=FALSE; + this->isRegistryUpdated=FALSE; } CDxwndhostView::~CDxwndhostView() @@ -1384,6 +1384,7 @@ void CDxwndhostView::OnInitialUpdate() this->OnHookStop(); if(m_StartToTray) this->OnGoToTrayIcon(); this->isUpdated=FALSE; + this->isRegistryUpdated=FALSE; pTitles = &PrivateMaps[0]; pTargets= &TargetMaps[0]; @@ -1488,6 +1489,7 @@ BOOL CDxwndhostView::OnImport(CString sFilePath) Resize(); SetTarget(TargetMaps); this->isUpdated=TRUE; + this->isRegistryUpdated=TRUE; return TRUE; } @@ -1567,6 +1569,7 @@ void CDxwndhostView::OnImport() Resize(); SetTarget(TargetMaps); this->isUpdated=TRUE; + this->isRegistryUpdated=TRUE; } } @@ -1591,6 +1594,7 @@ void CDxwndhostView::OnModify() strnncpy(PrivateMaps[i].title, (char *)dlg.m_Title.GetString(), MAX_TITLE); PrivateMaps[i].notes = (char *)realloc(PrivateMaps[i].notes, strlen(dlg.m_Notes.GetString())+1); strcpy(PrivateMaps[i].notes, (char *)dlg.m_Notes.GetString()); + if(strcmp((char *)dlg.m_Registry.GetString(), PrivateMaps[i].registry)) this->isRegistryUpdated=TRUE; PrivateMaps[i].registry = (char *)realloc(PrivateMaps[i].registry, strlen(dlg.m_Registry.GetString())+1); strcpy(PrivateMaps[i].registry, (char *)dlg.m_Registry.GetString()); strnncpy(PrivateMaps[i].launchpath, (char *)dlg.m_LaunchPath.GetString(), MAX_PATH); @@ -1829,6 +1833,7 @@ void CDxwndhostView::OnSort() SetTarget(TargetMaps); this->isUpdated=TRUE; + this->isRegistryUpdated=TRUE; } BOOL PauseResumeThreadList(DWORD dwOwnerPID, bool bResumeThread) @@ -2071,6 +2076,7 @@ void CDxwndhostView::OnAdd(char *sInitialPath) Resize(); SetTarget(TargetMaps); this->isUpdated=TRUE; + this->isRegistryUpdated=TRUE; } } @@ -2105,6 +2111,7 @@ void CDxwndhostView::OnDuplicate() } SetTarget(TargetMaps); this->isUpdated=TRUE; + this->isRegistryUpdated=TRUE; } void CDxwndhostView::OnMoveTop() @@ -2141,6 +2148,7 @@ void CDxwndhostView::OnMoveTop() } SetTarget(TargetMaps); this->isUpdated=TRUE; + this->isRegistryUpdated=TRUE; } void CDxwndhostView::OnMoveUp() @@ -2175,6 +2183,7 @@ void CDxwndhostView::OnMoveUp() } SetTarget(TargetMaps); this->isUpdated=TRUE; + this->isRegistryUpdated=TRUE; } void CDxwndhostView::OnMoveDown() @@ -2209,6 +2218,7 @@ void CDxwndhostView::OnMoveDown() } SetTarget(TargetMaps); this->isUpdated=TRUE; + this->isRegistryUpdated=TRUE; } void CDxwndhostView::OnMoveBottom() @@ -2246,6 +2256,7 @@ void CDxwndhostView::OnMoveBottom() } SetTarget(TargetMaps); this->isUpdated=TRUE; + this->isRegistryUpdated=TRUE; } void CDxwndhostView::OnDelete() @@ -2281,6 +2292,7 @@ void CDxwndhostView::OnDelete() Resize(); SetTarget(TargetMaps); this->isUpdated=TRUE; + this->isRegistryUpdated=TRUE; } void CDxwndhostView::OnHookStart() @@ -2545,6 +2557,9 @@ void CDxwndhostView::OnRButtonDown(UINT nFlags, CPoint point) case ID_PRUN: OnRun(); break; + case ID_RUNUNHOOKED: + OnRun(TRUE); + break; case ID_PMODIFY: OnModify(); break; @@ -3230,6 +3245,11 @@ static void MakeHiddenFile(char *sTargetPath) PROCESSMAP pm; void CDxwndhostView::OnRun() +{ + OnRun(FALSE); +} + +void CDxwndhostView::OnRun(BOOL bForceNoHook) { CListCtrl& listctrl = GetListCtrl(); POSITION pos; @@ -3268,8 +3288,9 @@ void CDxwndhostView::OnRun() MakeHiddenFile(exepath); strncpy(RestrictedMaps[0].path, exepath, MAX_PATH); } + if(bForceNoHook) RestrictedMaps[0].flags3 &= ~HOOKENABLED; SetTarget(RestrictedMaps); - OutTrace("OnRun idx=%d prog=\"%s\"\n", i, TargetMaps[i].path); + OutTrace("OnRun idx=%d prog=\"%s\" unhooked=%x\n", i, TargetMaps[i].path, bForceNoHook); if(TargetMaps[i].flags7 & HOOKNORUN){ MessageBoxLang(DXW_STRING_CANT_RUN, DXW_STRING_WARNING, MB_ICONERROR|MB_OK); @@ -3287,7 +3308,7 @@ void CDxwndhostView::OnRun() } if((TargetMaps[i].flags3 & EMULATEREGISTRY) || (TargetMaps[i].flags4 & OVERRIDEREGISTRY)){ - if(this->isUpdated){ + if(this->isRegistryUpdated){ if(MessageBoxLang(DXW_STRING_VREG_UPDATE,DXW_STRING_WARNING, MB_OKCANCEL|MB_ICONINFORMATION)==IDOK) this->SaveConfigFile(); } @@ -3307,7 +3328,9 @@ void CDxwndhostView::OnRun() CheckSafeDiscVersion(TargetMaps[i].path); } - if(TargetMaps[i].flags2 & STARTDEBUG){ + // v2.04.04: fix - STARTDEBUG and INJECTSUSPENDED must take place only when HOOKENABLED + if ((TargetMaps[i].flags2 & STARTDEBUG) && + (TargetMaps[i].flags3 & HOOKENABLED)){ OutTrace("debugger mode\n"); ThreadInfo_Type ThreadInfo; ThreadInfo.TM=&TargetMaps[i]; @@ -3316,7 +3339,8 @@ void CDxwndhostView::OnRun() CloseHandle(CreateThread( NULL, 0, StartDebug, &ThreadInfo, 0, NULL)); } else - if(TargetMaps[i].flags7 & INJECTSUSPENDED){ + if ((TargetMaps[i].flags7 & INJECTSUSPENDED) && + (TargetMaps[i].flags3 & HOOKENABLED)){ OutTrace("injectsuspended mode\n"); InjectSuspended(exepath, folderpath); } @@ -3337,7 +3361,9 @@ void CDxwndhostView::OnRun() // wait & recover CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)RecoverTargetMaps, (LPVOID)TargetMaps, 0, NULL); - if(gAutoHideMode) this->OnGoToTrayIcon(); + // go to tray icon mode when autohide is set, but only if hooking is enabled. If not enable it + // is not possible to monitor the process status, so the window will never show automatically! + if(gAutoHideMode && !bForceNoHook) this->OnGoToTrayIcon(); // not working: the file is opened, can't be deleted //if(TargetMaps[i].flags7 & COPYNOSHIMS){ diff --git a/host/dxwndhostView.h b/host/dxwndhostView.h index c89fc5d..be50a48 100644 --- a/host/dxwndhostView.h +++ b/host/dxwndhostView.h @@ -18,6 +18,7 @@ protected: // Create from serialization only features. afx_msg void OnHotKey(UINT, UINT, UINT); DECLARE_DYNCREATE(CDxwndhostView) BOOL isUpdated; + BOOL isRegistryUpdated; void SaveConfigFile(); BOOL OnInitDialog(); @@ -89,6 +90,7 @@ protected: afx_msg void OnSetPath(); afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg void OnRun(); + afx_msg void OnRun(BOOL); afx_msg void OnClearAllLogs(); afx_msg void OnGoToTrayIcon(); afx_msg void OnSaveFile(); diff --git a/host/resource b/host/resource index 992c4ed..55e20f8 100644 Binary files a/host/resource and b/host/resource differ