diff --git a/Include/dxwnd.h b/Include/dxwnd.h index 52b2ac6..c1315ce 100644 --- a/Include/dxwnd.h +++ b/Include/dxwnd.h @@ -200,6 +200,7 @@ #define FLIPEMULATION 0x00010000 // create virtual primary and backbuffer as un-attached surfaces and replace Flip with Blt #define SETZBUFFERBITDEPTHS 0x00020000 // when not set, set the legacy dwZBufferBitDepths field in the directdraw capability from GetCaps() #define SHAREDDC 0x00040000 // enable sharing window DC and primary surface DC +#define WOW32REGISTRY 0x00080000 // Sets KEY_WOW32_64KEY registry flag // logging Tflags DWORD: #define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general diff --git a/build/dxwnd.dll b/build/dxwnd.dll index 5ba6e8d..5df4d43 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7974a9d6ece70e47422cce4c82daa4d31131c217d89aa967ad23993ba7a3268c -size 583680 +oid sha256:f2fe03b12248b3b75bf4e724f83017b2767ac7eaf5f5c25ac2021da81ba9dd23 +size 585728 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 134653c..4b98fce 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cd704d7423b954daf34806d31bb047aa8d606752a5fa6cd1f9f602b668c5e5f3 -size 542208 +oid sha256:482a21422742238d783015f22714a6001eac5a1dc38332c53db686dcd086c7c3 +size 544256 diff --git a/build/exports/Beetle Crazy Cup.dxw b/build/exports/Beetle Crazy Cup.dxw new file mode 100644 index 0000000..9cc57d5 --- /dev/null +++ b/build/exports/Beetle Crazy Cup.dxw @@ -0,0 +1,31 @@ +[target] +title0=Beetle Crazy Cup +path0=D:\Games\Beetle Crazy Cup\beetle.exe +launchpath0= +module0= +opengllib0= +notes0= +ver0=0 +coord0=0 +flag0=136314914 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=327680 +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 +swapeffect0=0 diff --git a/build/exports/Command & Conquer - Red Alert The Aftermath.dxw b/build/exports/Command & Conquer - Red Alert The Aftermath.dxw new file mode 100644 index 0000000..78003a6 --- /dev/null +++ b/build/exports/Command & Conquer - Red Alert The Aftermath.dxw @@ -0,0 +1,32 @@ +[target] +title0=Command & Conquer - Red Alert The Aftermath +path0=D:\Games\C&C - Red Alert The Aftermath\RA95.EXE +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=136331362 +flagg0=1207959552 +flagh0=532 +flagi0=138412036 +flagj0=4224 +flagk0=262144 +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 +swapeffect0=0 diff --git a/build/exports/Empire Earth.dxw b/build/exports/Empire Earth.dxw index 0fb0433..b592392 100644 --- a/build/exports/Empire Earth.dxw +++ b/build/exports/Empire Earth.dxw @@ -9,7 +9,7 @@ flag0=671088675 flagg0=1207959552 flagh0=20 flagi0=4325380 -tflag0=6147 +tflag0=0 initx0=0 inity0=0 minx0=0 @@ -27,5 +27,6 @@ maxres0=-1 launchpath0= notes0= flagj0=128 -flagk0=0 +flagk0=65536 swapeffect0=0 +registry0= diff --git a/build/exports/Empire of the Ants.dxw b/build/exports/Empire of the Ants.dxw index 9c5eaee..f5052ac 100644 --- a/build/exports/Empire of the Ants.dxw +++ b/build/exports/Empire of the Ants.dxw @@ -27,5 +27,5 @@ maxres0=-1 launchpath0= notes0= flagj0=128 -flagk0=0 +flagk0=65536 swapeffect0=0 diff --git a/build/exports/Evolva.dxw b/build/exports/Evolva.dxw index c715fc8..869dbd1 100644 --- a/build/exports/Evolva.dxw +++ b/build/exports/Evolva.dxw @@ -9,7 +9,7 @@ flag0=134217762 flagg0=1207959552 flagh0=20 flagi0=4194308 -tflag0=6146 +tflag0=0 initx0=0 inity0=0 minx0=0 @@ -27,3 +27,6 @@ maxres0=-1 launchpath0= notes0= flagj0=128 +registry0= +flagk0=65536 +swapeffect0=0 diff --git a/build/exports/Flying Heroes.dxw b/build/exports/Flying Heroes.dxw index 89f2c1e..4fc9c2a 100644 --- a/build/exports/Flying Heroes.dxw +++ b/build/exports/Flying Heroes.dxw @@ -26,3 +26,7 @@ winver0=0 maxres0=-1 launchpath0= flagj0=128 +notes0= +registry0= +flagk0=65536 +swapeffect0=0 diff --git a/build/exports/Force 21.dxw b/build/exports/Force 21.dxw index 7ecf597..47bb7b6 100644 --- a/build/exports/Force 21.dxw +++ b/build/exports/Force 21.dxw @@ -10,7 +10,7 @@ flag0=136331298 flagg0=1207959552 flagh0=20 flagi0=138412036 -flagj0=8320 +flagj0=128 tflag0=0 initx0=0 inity0=0 @@ -26,3 +26,6 @@ maxfps0=0 initts0=0 winver0=0 maxres0=-1 +notes0= +flagk0=65536 +swapeffect0=0 diff --git a/build/exports/Forsaken (HW).dxw b/build/exports/Forsaken (HW).dxw index 636132a..a0ee2c1 100644 --- a/build/exports/Forsaken (HW).dxw +++ b/build/exports/Forsaken (HW).dxw @@ -26,6 +26,6 @@ winver0=0 maxres0=-1 launchpath0= notes0= -flagj0=162 -flagk0=0 +flagj0=130 +flagk0=73728 swapeffect0=0 diff --git a/build/exports/Horde 2 the Citadel.dxw b/build/exports/Horde 2 the Citadel.dxw index a889d01..e7b079c 100644 --- a/build/exports/Horde 2 the Citadel.dxw +++ b/build/exports/Horde 2 the Citadel.dxw @@ -5,7 +5,7 @@ module0= opengllib0= ver0=0 coord0=0 -flag0=134217766 +flag0=136314918 flagg0=1207959552 flagh0=20 flagi0=4194308 @@ -27,3 +27,5 @@ maxres0=-1 launchpath0= notes0= flagj0=128 +flagk0=0 +swapeffect0=0 diff --git a/build/exports/Star Trek Armada.dxw b/build/exports/Star Trek Armada.dxw new file mode 100644 index 0000000..b8f7965 --- /dev/null +++ b/build/exports/Star Trek Armada.dxw @@ -0,0 +1,32 @@ +[target] +title0=Star Trek Armada +path0=D:\Games\Star Trek Armada\Armada.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=-2011168669 +flagg0=1543503872 +flagh0=98320 +flagi0=136314884 +flagj0=4224 +flagk0=327680 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=100 +posy0=100 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 diff --git a/build/exports/Star Trek Generations.dxw b/build/exports/Star Trek Generations.dxw new file mode 100644 index 0000000..b5be506 --- /dev/null +++ b/build/exports/Star Trek Generations.dxw @@ -0,0 +1,32 @@ +[target] +title0=Star Trek Generations +path0=D:\Games\stgen\sgens.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0=[HKEY_LOCAL_MACHINE\SOFTWARE\MicroProse\Star Trek Generations]\n[HKEY_LOCAL_MACHINE\SOFTWARE\MicroProse\Star Trek Generations\1.0]\n"Path"="D:\\GAMES\\STGEN"\n"CDPath"="F:\\GENS"\n"InstallSet"="MED"\n +ver0=1 +coord0=0 +flag0=136314978 +flagg0=1744830464 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=0 +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 +swapeffect0=0 diff --git a/build/exports/eXpendable.dxw b/build/exports/eXpendable.dxw index d6101cf..8b8e574 100644 --- a/build/exports/eXpendable.dxw +++ b/build/exports/eXpendable.dxw @@ -27,5 +27,6 @@ initts0=0 winver0=0 maxres0=-1 notes0= -flagk0=0 +flagk0=65536 swapeffect0=0 +registry0= diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index 2fc8c67..48db031 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -887,4 +887,16 @@ fix: the flags for disabling DDSCAPS_SYSTEMMEMORY capability are now used also i fix: handling of NULL DC in non emulated modes: the NULL DC (corresponding to the whole desktop) is replaced by the window DC. This reduces problems like clearing the whole desktop. fix: EnumDisplayModes was returning wrong modes list in SVGA mode. fix: applied the error suppression to the DeleteAttachedSurface hooker. -fix: hooked User32 CreateRectRegion/Indirect calls. \ No newline at end of file +fix: hooked User32 CreateRectRegion/Indirect calls. + +v2.03.36: +fix: fixed "fix movies color depth" flag for color depths greater than 8BPP. Fixes the "Horde 2 the Citadel" intro movie. +add: added the "Set KEY_WOW64_32KEY flag" flag to prevent registry redirection for win32 applications +add: virtual registry configuration integrated in DxWnd configuration and exported files +add: hooking of RegEnumValue() call. Useful for "Star trek Generations" +fix: fixed mouse handling through "Message processing" option for child windows. Fixes "Star Trek Armada" mouse problems +fix: fixed GetDC hooker for child windows. Fixes some "Star Trek Armada" graphic problems +fix: CreateCompatibleDC hooker printing wrong error messages in normal conditions +fix: fixed DrawText, DrawTextEx hookers returning wrong RECT structure. Fixes "Star Trek Armada" text placement problems +add: completed log messages for DrawTextEx, CreateDialogParam, DialogBoxParam and CreateDialogIndirectParam + diff --git a/dll/advapi.cpp b/dll/advapi.cpp index 4335d05..84eab58 100644 --- a/dll/advapi.cpp +++ b/dll/advapi.cpp @@ -10,6 +10,9 @@ typedef LONG (WINAPI *RegFlushKey_Type)(HKEY); LONG WINAPI extRegFlushKey(HKEY); RegFlushKey_Type pRegFlushKey = NULL; +typedef LONG (WINAPI *RegEnumValueA_Type)(HKEY, DWORD, LPTSTR, LPDWORD, LPDWORD, LPDWORD, LPBYTE, LPDWORD); +LONG WINAPI extRegEnumValueA(HKEY, DWORD, LPTSTR, LPDWORD, LPDWORD, LPDWORD, LPBYTE, LPDWORD); +RegEnumValueA_Type pRegEnumValueA = NULL; static HookEntry_Type Hooks[]={ {HOOK_IAT_CANDIDATE, "RegOpenKeyExA", NULL, (FARPROC *)&pRegOpenKeyEx, (FARPROC)extRegOpenKeyEx}, @@ -19,6 +22,8 @@ static HookEntry_Type Hooks[]={ {HOOK_IAT_CANDIDATE, "RegCreateKeyExA", NULL, (FARPROC *)&pRegCreateKeyEx, (FARPROC)extRegCreateKeyEx}, {HOOK_IAT_CANDIDATE, "RegSetValueExA", NULL, (FARPROC *)&pRegSetValueEx, (FARPROC)extRegSetValueEx}, {HOOK_IAT_CANDIDATE, "RegFlushKey", NULL, (FARPROC *)&pRegFlushKey, (FARPROC)extRegFlushKey}, + // v2.3.36 + {HOOK_IAT_CANDIDATE, "RegEnumValueA", NULL, (FARPROC *)&pRegEnumValueA, (FARPROC)extRegEnumValueA}, {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator }; @@ -152,7 +157,14 @@ LONG WINAPI extRegOpenKeyEx( if(res == ERROR_SUCCESS) return res; } - if(dxw.dwFlags6 & WOW64REGISTRY) ulOptions |= KEY_WOW64_64KEY; + if(dxw.dwFlags6 & WOW64REGISTRY){ + ulOptions &= ~KEY_WOW64_32KEY; + ulOptions |= KEY_WOW64_64KEY; + } + if(dxw.dwFlags6 & WOW32REGISTRY){ + ulOptions &= ~KEY_WOW64_64KEY; + ulOptions |= KEY_WOW64_32KEY; + } res=(*pRegOpenKeyEx)(hKey, lpSubKey, ulOptions, samDesired, phkResult); OutTraceR("RegOpenKeyEx: res=%x phkResult=%x\n", res, phkResult ? *phkResult : 0); @@ -368,3 +380,12 @@ LONG WINAPI extRegCreateKey(HKEY hKey, LPCTSTR lpSubKey, PHKEY phkResult) else return (*pRegCreateKey)(hKey, lpSubKey, phkResult); } + +LONG WINAPI extRegEnumValueA(HKEY hKey, DWORD dwIndex, LPTSTR lpValueName, LPDWORD lpcchValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData) +{ + LONG ret; + OutTrace("RegEnumValue: hKey=%x(%s) Index=%x\n", hKey, hKey2String(hKey), dwIndex); + ret=(*pRegEnumValueA)(hKey, dwIndex, lpValueName, lpcchValueName, lpReserved, lpType, lpData, lpcbData); + OutTrace("RegEnumValue: hKey=%x(%s) Index=%x ValueName=\"%s\", Type=%x ret=%x\n", hKey, hKey2String(hKey), dwIndex, lpValueName, lpType ? *lpType : 0, ret); + return ret; +} diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp index fc41b93..c8b98eb 100644 --- a/dll/dxhook.cpp +++ b/dll/dxhook.cpp @@ -109,7 +109,7 @@ static char *Flag6Names[32]={ "SUPPRESSRELEASE", "FIXMOVIESCOLOR", "WOW64REGISTRY", "DISABLEMAXWINMODE", "FIXPITCH", "POWER2WIDTH", "HIDETASKBAR", "ACTIVATEAPP", "NOSYSMEMPRIMARY", "NOSYSMEMBACKBUF", "CONFIRMONCLOSE", "TERMINATEONCLOSE", - "FLIPEMULATION", "SETZBUFFERBITDEPTHS", "SHAREDDC", "", + "FLIPEMULATION", "SETZBUFFERBITDEPTHS", "SHAREDDC", "WOW32REGISTRY", "", "", "", "", "", "", "", "", "", "", "", "", @@ -1383,6 +1383,7 @@ void HookModule(HMODULE base, int dxversion) if(dxw.dwFlags4 & HOOKGLIDE) HookGlideLibs(base); if( (dxw.dwFlags3 & EMULATEREGISTRY) || (dxw.dwFlags4 & OVERRIDEREGISTRY) || + (dxw.dwFlags6 & (WOW32REGISTRY|WOW64REGISTRY)) || (dxw.dwTFlags & OUTREGISTRY)) HookAdvApi32(base); HookMSV4WLibs(base); // -- used by Aliens & Amazons demo: what for? HookAVIFil32(base); @@ -1485,7 +1486,8 @@ LRESULT CALLBACK MessageHook(int code, WPARAM wParam, LPARAM lParam) else { // fix the message point coordinates POINT upleft={0,0}; - (*pClientToScreen)(dxw.GethWnd(), &upleft); + // v2.03.36: offset to be calculated from target window + (*pClientToScreen)(msg->hwnd, &upleft); msg->pt = dxw.SubCoordinates(msg->pt, upleft); msg->pt=dxw.FixCursorPos(msg->pt); // beware: needs fix for mousewheel? diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index 13a79bd..8802646 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.03.35" +#define VERSION "2.03.36" #define DDTHREADLOCK 1 //#define LOCKTHREADS diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 8423cf1..06a5c31 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/gdi32.cpp b/dll/gdi32.cpp index 605be5d..4ec6a65 100644 --- a/dll/gdi32.cpp +++ b/dll/gdi32.cpp @@ -715,7 +715,7 @@ HDC WINAPI extGDICreateCompatibleDC(HDC hdc) SetLastError(0); RetHdc=(*pGDICreateCompatibleDC)(hdc); LastError=GetLastError(); - if(!LastError) + if(LastError == 0) OutTraceDW("GDI.CreateCompatibleDC: returning HDC=%x\n", RetHdc); else OutTraceE("GDI.CreateCompatibleDC ERROR: err=%d at %d\n", LastError, __LINE__); @@ -756,20 +756,20 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH OutTrace("Debug: DC dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest); } else if(WindowFromDC(hdcDest)==NULL){ - // V2.02.31: See StretchBlt. - int nWDest, nHDest; - nWDest= nWidth; - nHDest= nHeight; - dxw.MapWindow(&nXDest, &nYDest, &nWDest, &nHDest); - res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop); - dxw.ShowOverlay(hdcDest); - OutTrace("Debug: NULL dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest); + // V2.02.31: See StretchBlt. + int nWDest, nHDest; + nWDest= nWidth; + nHDest= nHeight; + dxw.MapWindow(&nXDest, &nYDest, &nWDest, &nHDest); + res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop); + dxw.ShowOverlay(hdcDest); + OutTrace("Debug: NULL dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest); + } + else{ + res=(*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop); + OutTrace("Debug: PROXY dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWidth, nHeight); + } } - else{ - res=(*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop); - OutTrace("Debug: PROXY dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWidth, nHeight); - } - } else { res=(*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop); OutTrace("Debug: MEM dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWidth, nHeight); diff --git a/dll/user32.cpp b/dll/user32.cpp index 455b467..d447177 100644 --- a/dll/user32.cpp +++ b/dll/user32.cpp @@ -312,6 +312,17 @@ static void Stopper(char *s, int line) #define STOPPER(s) #endif +static LPCSTR sTemplateName(LPCSTR tn) +{ + static char sBuf[20+1]; + if((DWORD)tn >> 16) + return tn; + else { + sprintf(sBuf, "ID:(%x)", ((DWORD)tn & 0x0000FFFF)); + return sBuf; + } +} + // -------------------------------------------------------------------------- // // globals, externs, static functions... @@ -1952,6 +1963,18 @@ static HDC WINAPI sGetDC(HWND hwnd, char *ApiName) LPDIRECTDRAWSURFACE lpDDSPrim; lpDDSPrim = dxwss.GetPrimarySurface(); if (lpDDSPrim) (*pGetDC)(lpDDSPrim, &hFlippedDC); + if (!(hwnd == dxw.GethWnd())) { + POINT father, child, offset; + father.x = father.y = 0; + child.x = child.y = 0; + (*pClientToScreen)(dxw.GethWnd(),&father); + (*pClientToScreen)(hwnd,&child); + offset.x = child.x - father.x; + offset.y = child.y - father.y; + dxw.UnmapClient(&offset); + OutTraceDW("%s: child window hwnd=%x offset=(%d,%d)\n", ApiName, hwnd, offset.x, offset.y); + (*pSetViewportOrgEx)(hFlippedDC, offset.x, offset.y, NULL); + } OutTraceDW("%s: remapping flipped GDI lpDDSPrim=%x hdc=%x\n", ApiName, lpDDSPrim, hFlippedDC); if(hFlippedDC) return hFlippedDC; } @@ -2012,6 +2035,7 @@ HDC WINAPI extGDIGetWindowDC(HWND hwnd) return sGetDC(hwnd, "GDI.GetWindowDC"); } + int WINAPI extGDIReleaseDC(HWND hwnd, HDC hDC) { int res; @@ -2120,8 +2144,10 @@ HWND WINAPI extCreateDialogIndirectParam(HINSTANCE hInstance, LPCDLGTEMPLATE lpT HWND RetHWND; BOOL FullScreen; FullScreen = dxw.IsFullScreen(); - OutTraceDW("CreateDialogIndirectParam: hInstance=%x lpTemplate=%s hWndParent=%x lpDialogFunc=%x lParamInit=%x\n", - hInstance, "tbd", hWndParent, lpDialogFunc, lParamInit); + OutTraceDW("CreateDialogIndirectParam: hInstance=%x lpTemplate=(style=%x extstyle=%x items=%d pos=(%d,%d) size=(%dx%d)) hWndParent=%x lpDialogFunc=%x lParamInit=%x\n", + hInstance, + lpTemplate->style, lpTemplate->dwExtendedStyle, lpTemplate->cdit, lpTemplate->x, lpTemplate->y, lpTemplate->cx, lpTemplate->cy, + hWndParent, lpDialogFunc, lParamInit); if(dxw.IsFullScreen() && hWndParent==NULL) hWndParent=dxw.GethWnd(); RetHWND=(*pCreateDialogIndirectParam)(hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit); dxw.SetFullScreen(FullScreen); @@ -2143,7 +2169,7 @@ HWND WINAPI extCreateDialogParam(HINSTANCE hInstance, LPCTSTR lpTemplateName, HW BOOL FullScreen; FullScreen = dxw.IsFullScreen(); OutTraceDW("CreateDialogParam: hInstance=%x lpTemplateName=%s hWndParent=%x lpDialogFunc=%x lParamInit=%x\n", - hInstance, "tbd", hWndParent, lpDialogFunc, lParamInit); + hInstance, sTemplateName(lpTemplateName), hWndParent, lpDialogFunc, lParamInit); if(hWndParent==NULL) hWndParent=dxw.GethWnd(); RetHWND=(*pCreateDialogParam)(hInstance, lpTemplateName, hWndParent, lpDialogFunc, lParamInit); dxw.SetFullScreen(FullScreen); @@ -2354,35 +2380,64 @@ BOOL gFixed; int WINAPI extDrawTextA(HDC hdc, LPCTSTR lpchText, int nCount, LPRECT lpRect, UINT uFormat) { int ret; + BOOL MustScale; OutTraceDW("DrawText: hdc=%x rect=(%d,%d)-(%d,%d) Format=%x(%s) Text=(%d)\"%s\"\n", hdc, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, uFormat, ExplainDTFormat(uFormat), nCount, lpchText); - gFixed = TRUE; - if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){ + MustScale = dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc)); + if (MustScale){ dxw.MapClient((RECT *)lpRect); OutTraceDW("DrawText: fixed rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); } + gFixed = TRUE; ret=(*pDrawText)(hdc, lpchText, nCount, lpRect, uFormat); gFixed=FALSE; + // if nCount is zero, DrawRect returns 0 as text heigth, but this is not an error! (ref. "Imperialism II") if(nCount && !ret) OutTraceE("DrawText: ERROR ret=%x err=%d\n", ret, GetLastError()); + + if (MustScale){ + dxw.UnmapClient((RECT *)lpRect); + OutTraceDW("DrawText: fixed output rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); + } + return ret; } int WINAPI extDrawTextExA(HDC hdc, LPTSTR lpchText, int nCount, LPRECT lpRect, UINT dwDTFormat, LPDRAWTEXTPARAMS lpDTParams) { int ret; + BOOL MustScale; + OutTraceDW("DrawTextEx: hdc=%x rect=(%d,%d)-(%d,%d) DTFormat=%x Text=(%d)\"%s\"\n", hdc, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, dwDTFormat, nCount, lpchText); + if (IsDebug){ + if(lpDTParams) + OutTrace("DTParams: size=%d (L,R)margins=(%d,%d) TabLength=%d lDrawn=%d\n", + lpDTParams->cbSize, lpDTParams->iLeftMargin, lpDTParams->iRightMargin, + lpDTParams->iTabLength, lpDTParams->uiLengthDrawn); + else + OutTrace("DTParams: NULL\n"); + } - if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){ + MustScale = dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc)); + + if (MustScale){ dxw.MapClient((RECT *)lpRect); OutTraceDW("DrawTextEx: fixed rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); } + gFixed = TRUE; ret=(*pDrawTextEx)(hdc, lpchText, nCount, lpRect, dwDTFormat, lpDTParams); - if(!ret) OutTraceE("DrawTextEx: ERROR ret=%x err=%d\n", ret, GetLastError()); + gFixed=FALSE; + if(nCount && !ret) OutTraceE("DrawTextEx: ERROR ret=%x err=%d\n", ret, GetLastError()); + + if (MustScale){ + dxw.UnmapClient((RECT *)lpRect); + OutTraceDW("DrawTextEx: fixed output rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); + } + return ret; } @@ -2960,7 +3015,8 @@ INT_PTR WINAPI extDialogBoxParamA(HINSTANCE hInstance, LPCTSTR lpTemplateName, H { BOOL ret, FullScreen; FullScreen = dxw.IsFullScreen(); - OutTraceDW("DialogBoxParamA: FullScreen=%x\n", FullScreen); + OutTraceDW("DialogBoxParamA: FullScreen=%x TemplateName=\"%s\" WndParent=%x\n", + FullScreen, sTemplateName(lpTemplateName), hWndParent); dxw.SetFullScreen(FALSE); ret = (*pDialogBoxParamA)(hInstance, lpTemplateName, hWndParent, lpDialogFunc, dwInitParam); dxw.SetFullScreen(FullScreen); diff --git a/host/TabCompat.cpp b/host/TabCompat.cpp index ffee0f3..3d91d1f 100644 --- a/host/TabCompat.cpp +++ b/host/TabCompat.cpp @@ -49,6 +49,7 @@ void CTabCompat::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_EMULATEREGISTRY, cTarget->m_EmulateRegistry); DDX_Check(pDX, IDC_OVERRIDEREGISTRY, cTarget->m_OverrideRegistry); DDX_Check(pDX, IDC_WOW64REGISTRY, cTarget->m_Wow64Registry); + DDX_Check(pDX, IDC_WOW32REGISTRY, cTarget->m_Wow32Registry); } BEGIN_MESSAGE_MAP(CTabCompat, CDialog) diff --git a/host/TabRegistry.cpp b/host/TabRegistry.cpp new file mode 100644 index 0000000..7c3de2b --- /dev/null +++ b/host/TabRegistry.cpp @@ -0,0 +1,40 @@ +// TabRegistry.cpp : implementation file +// + +#include "stdafx.h" +#include "TargetDlg.h" +#include "TabRegistry.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTabRegistry dialog + +CTabRegistry::CTabRegistry(CWnd* pParent /*=NULL*/) +// : CTargetDlg(pParent) + : CDialog(CTabRegistry::IDD, pParent) +{ + //{{AFX_DATA_INIT(CTabRegistry) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + +void CTabRegistry::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent())); + DDX_Text(pDX, IDC_REGISTRY, cTarget->m_Registry); +} + +BEGIN_MESSAGE_MAP(CTabRegistry, CDialog) + //{{AFX_MSG_MAP(CTabRegistry) + // NOTE: the ClassWizard will add message map macros here + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTabRegistry message handlers diff --git a/host/TabRegistry.h b/host/TabRegistry.h new file mode 100644 index 0000000..2453893 --- /dev/null +++ b/host/TabRegistry.h @@ -0,0 +1,45 @@ +#if !defined(AFX_TABNOTES_H__798A9124_C906_446C_822D_322B5AB6F1F1__INCLUDED_) +#define AFX_TABNOTES_H__798A9124_C906_446C_822D_322B5AB6F1F1__INCLUDED_ + +#include "resource.h" +#include "TargetDlg.h" + +///////////////////////////////////////////////////////////////////////////// +// CTabRegistry dialog + +//class CTabRegistry : public CTargetDlg +class CTabRegistry : public CDialog +{ +// Construction +public: + CTabRegistry(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CTabDirectX) + enum { IDD = IDD_TAB_REGISTRY }; + // NOTE: the ClassWizard will add data members here + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTabDirectX) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + //BOOL OnInitDialog(); + + // Generated message map functions + //{{AFX_MSG(CTabDirectX) + // NOTE: the ClassWizard will add member functions here + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TABTHREE_H__798A9124_C906_446C_822D_322B5AB6C4C4__INCLUDED_) diff --git a/host/TargetDlg.cpp b/host/TargetDlg.cpp index 9c71c72..9cbddb8 100644 --- a/host/TargetDlg.cpp +++ b/host/TargetDlg.cpp @@ -99,6 +99,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_EmulateRegistry = FALSE; m_OverrideRegistry = FALSE; m_Wow64Registry = FALSE; + m_Wow32Registry = FALSE; m_FullScreenOnly = FALSE; m_FilterMessages = FALSE; m_PeekAllMessages = FALSE; @@ -246,6 +247,8 @@ BOOL CTargetDlg::OnInitDialog() m_tabdxTabCtrl.InsertItem(i++, _T(sCaption)); LoadString(AfxGetResourceHandle(), DXW_TAB_COMPAT, sCaption, sizeof(sCaption)); m_tabdxTabCtrl.InsertItem(i++, _T(sCaption)); + LoadString(AfxGetResourceHandle(), DXW_TAB_REGISTRY, sCaption, sizeof(sCaption)); + m_tabdxTabCtrl.InsertItem(i++, _T(sCaption)); LoadString(AfxGetResourceHandle(), DXW_TAB_NOTES, sCaption, sizeof(sCaption)); m_tabdxTabCtrl.InsertItem(i++, _T(sCaption)); LoadString(AfxGetResourceHandle(), DXW_TAB_DEBUG, sCaption, sizeof(sCaption)); diff --git a/host/TargetDlg.h b/host/TargetDlg.h index cb61681..3cdbf9c 100644 --- a/host/TargetDlg.h +++ b/host/TargetDlg.h @@ -60,6 +60,7 @@ public: BOOL m_EmulateRegistry; BOOL m_OverrideRegistry; BOOL m_Wow64Registry; + BOOL m_Wow32Registry; BOOL m_FullScreenOnly; BOOL m_FilterMessages; BOOL m_PeekAllMessages; @@ -75,6 +76,7 @@ public: CString m_Title; CString m_OpenGLLib; CString m_Notes; + CString m_Registry; BOOL m_SaveLoad; BOOL m_SlowDown; BOOL m_BlitFromBackBuffer; diff --git a/host/dxTabCtrl.cpp b/host/dxTabCtrl.cpp index 89699c8..755f1a1 100644 --- a/host/dxTabCtrl.cpp +++ b/host/dxTabCtrl.cpp @@ -31,6 +31,7 @@ #include "TabOpenGL.h" #include "TabCompat.h" #include "TabColor.h" +#include "TabRegistry.h" #include "TabNotes.h" #include "TabSysLibs.h" #include "TabDebug.h" @@ -58,6 +59,7 @@ CDXTabCtrl::CDXTabCtrl() m_tabPages[i++]=new CTabLogs; m_tabPages[i++]=new CTabSysLibs; m_tabPages[i++]=new CTabCompat; + m_tabPages[i++]=new CTabRegistry; m_tabPages[i++]=new CTabNotes; if (gbDebug) m_tabPages[i++]=new CTabDebug; @@ -85,6 +87,7 @@ void CDXTabCtrl::Init() m_tabPages[i++]->Create(IDD_TAB_LOG, this); m_tabPages[i++]->Create(IDD_TAB_SYSLIBS, this); m_tabPages[i++]->Create(IDD_TAB_COMPAT, this); + m_tabPages[i++]->Create(IDD_TAB_REGISTRY, this); m_tabPages[i++]->Create(IDD_TAB_NOTES, this); if (gbDebug) m_tabPages[i++]->Create(IDD_TAB_DEBUG, this); diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index 851b00f..98ad216 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.h b/host/dxwndhost.h index df7477c..de5b35a 100644 --- a/host/dxwndhost.h +++ b/host/dxwndhost.h @@ -23,6 +23,7 @@ extern int MessageBoxLangArg(UINT, UINT, UINT, ...); // the (limited) IPC space and allow for more record entryes (currently 255). #define MAX_NOTES 1024 +#define MAX_REGISTRY 2048 #define MAX_TITLE 80 typedef struct PRIVATEMAP @@ -30,6 +31,7 @@ typedef struct PRIVATEMAP char title[MAX_TITLE+1]; char launchpath[MAX_PATH+1]; char notes[MAX_NOTES+1]; + char registry[MAX_REGISTRY+1]; }PRIVATEMAP; ///////////////////////////////////////////////////////////////////////////// diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index 766e752..1304060 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 52635b6..3ba046e 100644 Binary files a/host/dxwndhost.vs2008.suo and b/host/dxwndhost.vs2008.suo differ diff --git a/host/dxwndhost.vs2008.vcproj b/host/dxwndhost.vs2008.vcproj index f0fd80a..954da59 100644 --- a/host/dxwndhost.vs2008.vcproj +++ b/host/dxwndhost.vs2008.vcproj @@ -433,6 +433,10 @@ RelativePath=".\TabProgram.cpp" > + + @@ -554,6 +558,10 @@ RelativePath=".\TabProgram.h" > + + diff --git a/host/dxwndhostView.cpp b/host/dxwndhostView.cpp index a3dce89..8c5a084 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -45,7 +45,7 @@ char *strnncpy(char *dest, char *src, size_t count) static char *Escape(char *s) { - static char tmp[1024]; + static char tmp[2048]; char *t = tmp; for(; *s; s++){ if(*s=='\n'){ @@ -66,7 +66,7 @@ static char *Escape(char *s) static char *Unescape(char *s) { - static char tmp[1024]; + static char tmp[2048]; char *t = tmp; for(; *s; s++){ if((*s=='\\') && (*(s+1)=='n')){ @@ -180,6 +180,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_EmulateRegistry) t->flags3 |= EMULATEREGISTRY; if(dlg->m_OverrideRegistry) t->flags4 |= OVERRIDEREGISTRY; if(dlg->m_Wow64Registry) t->flags6 |= WOW64REGISTRY; + if(dlg->m_Wow32Registry) t->flags6 |= WOW32REGISTRY; if(dlg->m_HookEnabled) t->flags3 |= HOOKENABLED; if(dlg->m_NoBanner) t->flags2 |= NOBANNER; if(dlg->m_StartDebug) t->flags2 |= STARTDEBUG; @@ -425,6 +426,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_EmulateRegistry = t->flags3 & EMULATEREGISTRY ? 1 : 0; dlg->m_OverrideRegistry = t->flags4 & OVERRIDEREGISTRY ? 1 : 0; dlg->m_Wow64Registry = t->flags6 & WOW64REGISTRY ? 1 : 0; + dlg->m_Wow32Registry = t->flags6 & WOW32REGISTRY ? 1 : 0; dlg->m_HookEnabled = t->flags3 & HOOKENABLED ? 1 : 0; dlg->m_NoBanner = t->flags2 & NOBANNER ? 1 : 0; dlg->m_StartDebug = t->flags2 & STARTDEBUG ? 1 : 0; @@ -652,6 +654,8 @@ static void SaveConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i, WritePrivateProfileString("target", key, TargetMap->OpenGLLib, InitPath); sprintf_s(key, sizeof(key), "notes%i", i); WritePrivateProfileString("target", key, Escape(PrivateMap->notes), InitPath); + sprintf_s(key, sizeof(key), "registry%i", i); + WritePrivateProfileString("target", key, Escape(PrivateMap->registry), InitPath); sprintf_s(key, sizeof(key), "ver%i", i); sprintf_s(val, sizeof(val), "%i", TargetMap->dxversion); WritePrivateProfileString("target", key, val, InitPath); @@ -785,6 +789,8 @@ static void ClearTarget(int i, char *InitPath) WritePrivateProfileString("target", key, 0, InitPath); sprintf_s(key, sizeof(key), "notes%i", i); WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "registry%i", i); + WritePrivateProfileString("target", key, 0, InitPath); } static int LoadConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i, char *InitPath) @@ -805,6 +811,9 @@ static int LoadConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i, c sprintf_s(key, sizeof(key), "notes%i", i); GetPrivateProfileString("target", key, "", PrivateMap->notes, MAX_NOTES, InitPath); strcpy(PrivateMap->notes, Unescape(PrivateMap->notes)); + sprintf_s(key, sizeof(key), "registry%i", i); + GetPrivateProfileString("target", key, "", PrivateMap->registry, MAX_NOTES, InitPath); + strcpy(PrivateMap->registry, Unescape(PrivateMap->registry)); sprintf_s(key, sizeof(key), "ver%i", i); TargetMap->dxversion = GetPrivateProfileInt("target", key, 0, InitPath); sprintf_s(key, sizeof(key), "coord%i", i); @@ -887,7 +896,7 @@ void CDxwndhostView::SaveConfigFile() for(i = 0; i < MAXTARGETS; i ++){ if(!TargetMaps[i].path[0]) break; - SaveConfigItem(&TargetMaps[i], &TitleMaps[i], i, InitPath); + SaveConfigItem(&TargetMaps[i], &PrivateMaps[i], i, InitPath); } for(; i < MAXTARGETS; i ++) ClearTarget(i, InitPath); this->isUpdated=FALSE; @@ -977,17 +986,17 @@ void CDxwndhostView::OnInitialUpdate() listctrl.InsertColumn(0, &listcol); for(i = 0; i < MAXTARGETS; i ++){ - if (!LoadConfigItem(&TargetMaps[i], &TitleMaps[i], i, InitPath)) break; + if (!LoadConfigItem(&TargetMaps[i], &PrivateMaps[i], i, InitPath)) break; listitem.mask = LVIF_TEXT | LVIF_IMAGE; listitem.iItem = i; listitem.iSubItem = 0; - listitem.pszText = TitleMaps[i].title; + listitem.pszText = PrivateMaps[i].title; listitem.iImage = SetTargetIcon(TargetMaps[i]); listctrl.InsertItem(&listitem); } for(; i < MAXTARGETS; i ++) { TargetMaps[i].path[0] = 0; - TitleMaps[i].title[0] = 0; + PrivateMaps[i].title[0] = 0; } Resize(); SetTarget(TargetMaps); @@ -997,7 +1006,7 @@ void CDxwndhostView::OnInitialUpdate() this->OnHookStop(); if(m_StartToTray) this->OnGoToTrayIcon(); this->isUpdated=FALSE; - pTitles = &TitleMaps[0]; + pTitles = &PrivateMaps[0]; pTargets= &TargetMaps[0]; } @@ -1043,7 +1052,7 @@ void CDxwndhostView::OnExport() i = listctrl.GetNextSelectedItem(pos); GetPrivateProfileString("window", "exportpath", NULL, path, MAX_PATH, InitPath); //strcat_s(path, MAX_PATH, "\\"); - strcat_s(path, MAX_PATH, TitleMaps[i].title); + strcat_s(path, MAX_PATH, PrivateMaps[i].title); CFileDialog dlg( FALSE, "*.dxw", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "dxwnd task config (*.dxw)|*.dxw|All Files (*.*)|*.*||", this); if( dlg.DoModal() == IDOK) { @@ -1055,7 +1064,7 @@ void CDxwndhostView::OnExport() TargetMap = &TargetMaps[i]; TFlags = TargetMap->tflags; TargetMap->tflags = 0; - SaveConfigItem(&TargetMaps[i], &TitleMaps[i], 0, path); + SaveConfigItem(&TargetMaps[i], &PrivateMaps[i], 0, path); TargetMap->tflags = TFlags; if(GetPrivateProfileInt("window", "updatepaths", 1, InitPath)) { GetFolderFromPath(path); @@ -1095,12 +1104,12 @@ void CDxwndhostView::OnImport() if(ImportExportPath[ofn.nFileOffset - 1] != '\0'){ // Single-Select // "buffer" - name of file - if(LoadConfigItem(&TargetMaps[i], &TitleMaps[i], 0, ImportExportPath)){ + if(LoadConfigItem(&TargetMaps[i], &PrivateMaps[i], 0, ImportExportPath)){ listitem.mask = LVIF_TEXT | LVIF_IMAGE; listitem.iItem = i; listitem.iSubItem = 0; listitem.iImage = SetTargetIcon(TargetMaps[i]); - listitem.pszText = TitleMaps[i].title; + listitem.pszText = PrivateMaps[i].title; listctrl.InsertItem(&listitem); if(GetPrivateProfileInt("window", "updatepaths", 1, InitPath)) { GetFolderFromPath(ImportExportPath); @@ -1122,12 +1131,12 @@ void CDxwndhostView::OnImport() if(i==MAXTARGETS) break; strcpy(pathname, folder); strcat(pathname, p); - if (LoadConfigItem(&TargetMaps[i], &TitleMaps[i], 0, pathname)){ + if (LoadConfigItem(&TargetMaps[i], &PrivateMaps[i], 0, pathname)){ listitem.mask = LVIF_TEXT | LVIF_IMAGE; listitem.iItem = i; listitem.iSubItem = 0; listitem.iImage = SetTargetIcon(TargetMaps[i]); - listitem.pszText = TitleMaps[i].title; + listitem.pszText = PrivateMaps[i].title; listctrl.InsertItem(&listitem); i++; } @@ -1151,21 +1160,23 @@ void CDxwndhostView::OnModify() if(!listctrl.GetSelectedCount()) return; pos = listctrl.GetFirstSelectedItemPosition(); i = listctrl.GetNextSelectedItem(pos); - dlg.m_Title = TitleMaps[i].title; - dlg.m_Notes = TitleMaps[i].notes; - dlg.m_LaunchPath = TitleMaps[i].launchpath; + dlg.m_Title = PrivateMaps[i].title; + dlg.m_Notes = PrivateMaps[i].notes; + dlg.m_Registry = PrivateMaps[i].registry; + dlg.m_LaunchPath = PrivateMaps[i].launchpath; SetDlgFromTarget(&TargetMaps[i], &dlg); if(dlg.DoModal() == IDOK && dlg.m_FilePath.GetLength()){ - strnncpy(TitleMaps[i].title, (char *)dlg.m_Title.GetString(), MAX_TITLE); - strnncpy(TitleMaps[i].notes, (char *)dlg.m_Notes.GetString(), MAX_NOTES); - strnncpy(TitleMaps[i].launchpath, (char *)dlg.m_LaunchPath.GetString(), MAX_PATH); + strnncpy(PrivateMaps[i].title, (char *)dlg.m_Title.GetString(), MAX_TITLE); + strnncpy(PrivateMaps[i].notes, (char *)dlg.m_Notes.GetString(), MAX_NOTES); + strnncpy(PrivateMaps[i].registry, (char *)dlg.m_Registry.GetString(), MAX_REGISTRY); + strnncpy(PrivateMaps[i].launchpath, (char *)dlg.m_LaunchPath.GetString(), MAX_PATH); SetTargetFromDlg(&TargetMaps[i], &dlg); CListCtrl& listctrl = GetListCtrl(); listitem.mask = LVIF_TEXT | LVIF_IMAGE; listitem.iItem = i; listitem.iSubItem = 0; listitem.iImage = SetTargetIcon(TargetMaps[i]); - listitem.pszText = TitleMaps[i].title; + listitem.pszText = PrivateMaps[i].title; listctrl.SetItem(&listitem); Resize(); SetTarget(TargetMaps); @@ -1269,6 +1280,31 @@ void CDxwndhostView::OnDebugView() CloseHandle(pinfo.hThread); } +void CDxwndhostView::OnSetRegistry() +{ + int i; + CTargetDlg dlg; + POSITION pos; + CString Registry; + FILE *regfp; + + CListCtrl& listctrl = GetListCtrl(); + + if(!listctrl.GetSelectedCount()) return; + pos = listctrl.GetFirstSelectedItemPosition(); + i = listctrl.GetNextSelectedItem(pos); + Registry = PrivateMaps[i].registry; + + regfp=fopen("dxwnd.reg", "w"); + if(regfp==NULL){ + MessageBox("Error writing virtual registry file", "Error", MB_ICONERROR|MB_OK); + return; + } + + fwrite(Registry.GetString(), Registry.GetLength(), 1, regfp); + fclose(regfp); +} + #define strcasecmp lstrcmpi void CDxwndhostView::OnSort() @@ -1294,14 +1330,14 @@ void CDxwndhostView::OnSort() while(swapped){ swapped=0; for(i=0; i0){ + if(strcasecmp(PrivateMaps[i].title, PrivateMaps[i+1].title)>0){ // swap entries MapEntry=TargetMaps[i]; TargetMaps[i]=TargetMaps[i+1]; TargetMaps[i+1]=MapEntry; - TitEntry=TitleMaps[i]; - TitleMaps[i]=TitleMaps[i+1]; - TitleMaps[i+1]=TitEntry; + TitEntry=PrivateMaps[i]; + PrivateMaps[i]=PrivateMaps[i+1]; + PrivateMaps[i+1]=TitEntry; swapped=1; } } @@ -1314,7 +1350,7 @@ void CDxwndhostView::OnSort() listitem.iItem = i; listitem.iSubItem = 0; listitem.iImage = SetTargetIcon(TargetMaps[i]); - listitem.pszText = TitleMaps[i].title; + listitem.pszText = PrivateMaps[i].title; listctrl.SetItem(&listitem); listctrl.InsertItem(&listitem); } @@ -1376,7 +1412,7 @@ void CDxwndhostView::OnPause() } else { wchar_t *wcstring = new wchar_t[48+1]; - mbstowcs_s(NULL, wcstring, 48, TitleMaps[DxWndStatus.TaskIdx].title, _TRUNCATE); + mbstowcs_s(NULL, wcstring, 48, PrivateMaps[DxWndStatus.TaskIdx].title, _TRUNCATE); res=MessageBoxLangArg(DXW_STRING_PAUSETASK, DXW_STRING_INFO, MB_YESNO | MB_ICONQUESTION, wcstring); if(res!=IDYES) return; PauseResumeThreadList(DxWndStatus.dwPid, FALSE); @@ -1393,7 +1429,7 @@ void CDxwndhostView::OnResume() } else { wchar_t *wcstring = new wchar_t[48+1]; - mbstowcs_s(NULL, wcstring, 48, TitleMaps[DxWndStatus.TaskIdx].title, _TRUNCATE); + mbstowcs_s(NULL, wcstring, 48, PrivateMaps[DxWndStatus.TaskIdx].title, _TRUNCATE); res=MessageBoxLangArg(DXW_STRING_RESUMETASK, DXW_STRING_WARNING, MB_YESNO | MB_ICONQUESTION, wcstring); if(res!=IDYES) return; PauseResumeThreadList(DxWndStatus.dwPid, TRUE); @@ -1447,7 +1483,7 @@ void CDxwndhostView::OnKill() } else { wchar_t *wcstring = new wchar_t[48+1]; - mbstowcs_s(NULL, wcstring, 48, TitleMaps[DxWndStatus.TaskIdx].title, _TRUNCATE); + mbstowcs_s(NULL, wcstring, 48, PrivateMaps[DxWndStatus.TaskIdx].title, _TRUNCATE); res=MessageBoxLangArg(DXW_STRING_KILLTASK, DXW_STRING_WARNING, MB_YESNO | MB_ICONQUESTION, wcstring); if(res!=IDYES) return; DxWndStatus.dwPid; @@ -1487,7 +1523,7 @@ void CDxwndhostView::OnProcessKill() if(!KillProcByName(lpProcName, FALSE)){ wchar_t *wcstring = new wchar_t[48+1]; - mbstowcs_s(NULL, wcstring, 48, TitleMaps[i].title, _TRUNCATE); + mbstowcs_s(NULL, wcstring, 48, PrivateMaps[i].title, _TRUNCATE); res=MessageBoxLangArg(DXW_STRING_KILLTASK, DXW_STRING_WARNING, MB_YESNO | MB_ICONQUESTION, wcstring); if(res!=IDYES) return; KillProcByName(lpProcName, TRUE); @@ -1514,24 +1550,25 @@ void CDxwndhostView::OnAdd() } memset(&TargetMaps[i],0,sizeof(TARGETMAP)); // clean up, just in case.... if(dlg.DoModal() == IDOK && dlg.m_FilePath.GetLength()){ - strnncpy(TitleMaps[i].title, (char *)dlg.m_Title.GetString(), MAX_TITLE); - strnncpy(TitleMaps[i].notes, (char *)dlg.m_Notes.GetString(), MAX_NOTES); - strnncpy(TitleMaps[i].launchpath, (char *)dlg.m_LaunchPath.GetString(), MAX_PATH); + strnncpy(PrivateMaps[i].title, (char *)dlg.m_Title.GetString(), MAX_TITLE); + strnncpy(PrivateMaps[i].notes, (char *)dlg.m_Notes.GetString(), MAX_NOTES); + strnncpy(PrivateMaps[i].registry, (char *)dlg.m_Registry.GetString(), MAX_REGISTRY); + strnncpy(PrivateMaps[i].launchpath, (char *)dlg.m_LaunchPath.GetString(), MAX_PATH); SetTargetFromDlg(&TargetMaps[i], &dlg); CListCtrl& listctrl = GetListCtrl(); listitem.mask = LVIF_TEXT | LVIF_IMAGE; listitem.iItem = i; listitem.iSubItem = 0; listitem.iImage = SetTargetIcon(TargetMaps[i]); - if (strlen(TitleMaps[i].title)==0){ + if (strlen(PrivateMaps[i].title)==0){ int len; CString FilePath; FilePath=TargetMaps[i].path; len=FilePath.ReverseFind('\\'); FilePath=FilePath.Right(FilePath.GetLength()-len-1); - strncpy_s(TitleMaps[i].title, sizeof(TitleMaps[i].title), FilePath.GetString(), sizeof(TitleMaps[i].title)-1); + strncpy_s(PrivateMaps[i].title, sizeof(PrivateMaps[i].title), FilePath.GetString(), sizeof(PrivateMaps[i].title)-1); } - listitem.pszText = TitleMaps[i].title; + listitem.pszText = PrivateMaps[i].title; listctrl.InsertItem(&listitem); Resize(); SetTarget(TargetMaps); @@ -1551,7 +1588,7 @@ void CDxwndhostView::OnDelete() pos = listctrl.GetFirstSelectedItemPosition(); i = listctrl.GetNextSelectedItem(pos); - FilePath=TitleMaps[i].title; + FilePath=PrivateMaps[i].title; if (FilePath.GetLength()==0){ FilePath = TargetMaps[i].path; len=FilePath.ReverseFind('\\'); @@ -1565,7 +1602,7 @@ void CDxwndhostView::OnDelete() if(res!=IDYES) return; listctrl.DeleteItem(i); for(; i < MAXTARGETS - 1; i ++) { - TitleMaps[i] = TitleMaps[i + 1]; // V2.1.74 fix + PrivateMaps[i] = PrivateMaps[i + 1]; // V2.1.74 fix TargetMaps[i] = TargetMaps[i + 1]; } Resize(); @@ -1771,7 +1808,7 @@ void CDxwndhostView::Resize() for(i = 0; i < MAXTARGETS; i ++){ if(strlen(TargetMaps[i].path) == 0) break; - tmp = listctrl.GetStringWidth(TitleMaps[i].title); + tmp = listctrl.GetStringWidth(PrivateMaps[i].title); if(size < tmp) size = tmp; } @@ -1813,6 +1850,9 @@ void CDxwndhostView::OnRButtonDown(UINT nFlags, CPoint point) case ID_PLOG_DEBUGVIEW: OnDebugView(); break; + case ID_SETREGISTRY: + OnSetRegistry(); + break; case ID_TASK_KILL: OnKill(); break; @@ -2037,12 +2077,12 @@ void CDxwndhostView::OnRun() PathRemoveFileSpec(path); if(TargetMaps[i].flags2 & STARTDEBUG){ ThreadInfo.TM=&TargetMaps[i]; - ThreadInfo.PM=&TitleMaps[i]; + ThreadInfo.PM=&PrivateMaps[i]; CloseHandle(CreateThread( NULL, 0, StartDebug, &ThreadInfo, 0, NULL)); } else{ CreateProcess(NULL, - (strlen(TitleMaps[i].launchpath)>0) ? TitleMaps[i].launchpath: TargetMaps[i].path, + (strlen(PrivateMaps[i].launchpath)>0) ? PrivateMaps[i].launchpath: TargetMaps[i].path, 0, 0, false, CREATE_DEFAULT_ERROR_MODE, NULL, path, &sinfo, &pinfo); CloseHandle(pinfo.hProcess); // no longer needed, avoid handle leakage CloseHandle(pinfo.hThread); // no longer needed, avoid handle leakage diff --git a/host/dxwndhostView.h b/host/dxwndhostView.h index 83247f7..f4dc736 100644 --- a/host/dxwndhostView.h +++ b/host/dxwndhostView.h @@ -21,7 +21,7 @@ private: void Resize(void); void SaveConfigFile(); TARGETMAP TargetMaps[MAXTARGETS]; - PRIVATEMAP TitleMaps[MAXTARGETS]; + PRIVATEMAP PrivateMaps[MAXTARGETS]; char InitPath[MAX_PATH]; BOOL isUpdated; DEVMODE InitDevMode; @@ -79,6 +79,7 @@ protected: afx_msg void OnViewLog(); afx_msg void OnDeleteLog(); afx_msg void OnDebugView(); + afx_msg void OnSetRegistry(); afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg void OnRun(); afx_msg void OnClearAllLogs(); diff --git a/host/resource b/host/resource index b362f05..47eb586 100644 Binary files a/host/resource and b/host/resource differ