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

v2_03_58_src

Former-commit-id: 5dab36758c525b1f6191ef2fee843affbd0b1a7d
This commit is contained in:
gho tik 2016-03-22 12:45:25 -04:00 committed by Refael ACkermann
parent 9aca112da3
commit f9dc501eb6
21 changed files with 487 additions and 174 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f5024ec55f3917b2908e231698222147516bb21efda0938c969100fc43f7fd9f
size 626688
oid sha256:22f399a262f8cb3071bb10d366ee021b542e9c13b6122b70370ecc319b970489
size 628736

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b2afb528861c05b34730d201b567c3e47f969732676f7d9fd998ffe8cf16674d
size 553472
oid sha256:393da7c339ffda956ed69f340401cd4dfeef582666d42a812699a641e698d691
size 558080

View File

@ -1,120 +0,0 @@
[window]
exportpath=D:\DxWnd\exports\
exepath=D:\Games\msgolf\Golf '98 Trial\
posx=981
posy=464
sizx=320
sizy=200
[target]
title0=Miscrosoft Golf '98 Trial
path0=D:\Games\msgolf\Golf '98 Trial\game.exe
launchpath0=
module0=
opengllib0=
notes0=
registry0=[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Golf '98]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Golf '98\Version 1.0 Demo]\n"AppPath"="D:\\Games\\msgolf\\Golf '98 Trial"\n"InstallType"="1"\n"InstalledPath"="D:\\Games\\msgolf\\Golf '98 Trial"\n"CDPath"="D:\\Games\\msgolf\\Golf '98 Trial\\"\n"ITF File Path"="D:\\Games\\msgolf\\Golf '98 Trial\\golf.itf"\n"Launched"="1"\n"PID"=""\n"Path"="D:\\Games\\msgolf\\Golf '98 Trial"\n"VersionType"="TrialVersion"\n"InstalledGroup"="1"\n"LangID"=dword:00000009\n\n\n[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games]\n[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Golf '98]\n[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Golf '98\Version 1.0 Demo]\n"AppPath"="D:\\Games\\msgolf\\Golf '98 Trial"\n"InstallType"="1"\n"InstalledPath"="D:\\Games\\msgolf\\Golf '98 Trial"\n"CDPath"="D:\\Games\\msgolf\\Golf '98 Trial\\"\n"ITF File Path"="D:\\Games\\msgolf\\Golf '98 Trial\\golf.itf"\n"Launched"="1"\n"PID"=""\n"Path"="D:\\Games\\msgolf\\Golf '98 Trial"\n"VersionType"="TrialVersion"\n"InstalledGroup"="1"\n"LangID"=dword:00000009
ver0=0
coord0=0
flag0=2101474
flagg0=1476395016
flagh0=1044
flagi0=1210187780
flagj0=128
flagk0=327680
flagl0=4
flagm0=0
tflag0=0
posx0=50
posy0=50
sizx0=880
sizy0=660
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0
maxddinterface0=0
title1=M1 Tank Platoon 2
path1=D:\Games\M1 Tank Platoon 2\M1TP2.exe
launchpath1=
module1=
opengllib1=
notes1=
registry1=
ver1=0
coord1=0
flag1=134238242
flagg1=1207959552
flagh1=20
flagi1=138412036
flagj1=268439680
flagk1=0
flagl1=0
flagm1=0
tflag1=0
posx1=50
posy1=50
sizx1=800
sizy1=600
maxfps1=0
initts1=8
winver1=0
maxres1=-1
swapeffect1=0
maxddinterface1=7
title2=Imperialism II
path2=D:\Games\Imperialism 2\imperialism II.exe
launchpath2=
module2=
opengllib2=
notes2=
registry2=
ver2=0
coord2=0
flag2=679485474
flagg2=1207959552
flagh2=20
flagi2=4194308
flagj2=0
flagk2=262144
flagl2=4
flagm2=0
tflag2=0
posx2=50
posy2=50
sizx2=800
sizy2=600
maxfps2=0
initts2=0
winver2=0
maxres2=0
swapeffect2=0
maxddinterface2=7
title3=Imperialism
path3=D:\Games\Imperialism\Imperialism.exe
launchpath3=
module3=
opengllib3=
notes3=Note:\nMap zooming is currently not workind. Do not click on the magnifying glass, \nor the game will crash.
registry3=
ver3=0
coord3=0
flag3=1746935843
flagg3=1744830464
flagh3=20
flagi3=71303172
flagj3=128
flagk3=262144
flagl3=4
flagm3=0
tflag3=0
posx3=50
posy3=50
sizx3=800
sizy3=600
maxfps3=0
initts3=0
winver3=0
maxres3=-1
swapeffect3=0
maxddinterface3=7

View File

@ -1,31 +0,0 @@
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Golf '98]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Golf '98\Version 1.0 Demo]
"AppPath"="D:\\Games\\msgolf\\Golf '98 Trial"
"InstallType"="1"
"InstalledPath"="D:\\Games\\msgolf\\Golf '98 Trial"
"CDPath"="D:\\Games\\msgolf\\Golf '98 Trial\\"
"ITF File Path"="D:\\Games\\msgolf\\Golf '98 Trial\\golf.itf"
"Launched"="1"
"PID"=""
"Path"="D:\\Games\\msgolf\\Golf '98 Trial"
"VersionType"="TrialVersion"
"InstalledGroup"="1"
"LangID"=dword:00000009
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Golf '98]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Golf '98\Version 1.0 Demo]
"AppPath"="D:\\Games\\msgolf\\Golf '98 Trial"
"InstallType"="1"
"InstalledPath"="D:\\Games\\msgolf\\Golf '98 Trial"
"CDPath"="D:\\Games\\msgolf\\Golf '98 Trial\\"
"ITF File Path"="D:\\Games\\msgolf\\Golf '98 Trial\\golf.itf"
"Launched"="1"
"PID"=""
"Path"="D:\\Games\\msgolf\\Golf '98 Trial"
"VersionType"="TrialVersion"
"InstalledGroup"="1"
"LangID"=dword:00000009

View File

@ -1049,4 +1049,14 @@ fix: improved handling of clipping regions in shared dc mode
add: added DWM status to log file
add: flags for preliminary hook of DirectSound and Smack libraries
fix: changed icon colors (yellow for red, doesn't suggest the idea of error or danger)
add: menu commands for entry movement (top, bottom, up, down) or duplication
add: menu commands for entry movement (top, bottom, up, down) or duplication
v2.03/58
add: added program manifest stating Win10/8/7/Vista compatibility
add: "Clear compatbility flag" tool
add: "Recover screen mode" tool
add: "Set path" tool
fix: reorganized menu commands
fix: proper handling of DEFAULT win size on CreateWindowEx - fixes "Imperialism" problem
fix: fixed stretced blit operation because Blt behaves differently from StretchBlt. Fixes "3D Minigolf" partial background
fix: GetPixel logging

View File

@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <windows.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "TlHelp32.h"
#define VERSION "2.03.57"
#define VERSION "2.03.58"
#define DDTHREADLOCK 1
//#define LOCKTHREADS

28
dll/dxwnd.dll.manifest Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="dxwnd" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"
/>
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
</application>
</compatibility>
</assembly>

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="dxwnd"
ProjectGUID="{579E7FE7-2745-4100-A802-23511711FCDE}"
RootNamespace="dxwnd"
@ -30,6 +30,9 @@
/>
<Tool
Name="VCCustomBuildTool"
Description="embed manifest"
CommandLine="mt.exe -nologo -manifest dxwnd.dll.manifest -outputresource:&quot;../Debug/dxwnd.dll;#1"
Outputs="manifest.out.txt"
/>
<Tool
Name="VCXMLDataGeneratorTool"
@ -131,6 +134,9 @@
/>
<Tool
Name="VCCustomBuildTool"
Description="embed manifest"
CommandLine="mt.exe -nologo -manifest dxwnd.dll.manifest -outputresource:&quot;../Release/dxwnd.dll;#1"
Outputs="manifest.out.txt"
/>
<Tool
Name="VCXMLDataGeneratorTool"
@ -182,6 +188,8 @@
OutputFile="../Release/dxwnd.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="false"
ManifestFile=""
ModuleDefinitionFile=".\dxwnd.def"
ProgramDatabaseFile=".\Release/dxwnd.pdb"
RandomizedBaseAddress="1"

View File

@ -997,6 +997,21 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
nHDest= nHeight;
switch(Flux){
case 1: // memory to screen
// v1.03.58: BitBlt can blitfrom negative coordinates, StretchBlt can't!
if(nXDest < 0){
int nXshift = -nXDest;
nXDest = 0;
nXSrc += nXshift;
nWidth -= nXshift;
nWDest -= nXshift;
}
if(nYDest < 0){
int nYshift = -nYDest;
nYDest = 0;
nYSrc += nYshift;
nHeight -= nYshift;
nHDest -= nYshift;
}
dxw.MapClient(&nXDest, &nYDest, &nWDest, &nHDest);
break;
case 2: // screen to memory
@ -2847,7 +2862,7 @@ int WINAPI extOffsetRgn(HRGN hrgn, int nXOffset, int nYOffset)
COLORREF WINAPI extGetPixel(HDC hdc, int nXPos, int nYPos)
{
COLORREF ret;
OutTraceDW("CreateDIBitmap: hdc=%x\n", hdc);
OutTraceDW("GetPixel: hdc=%x\n", hdc);
if(dxw.IsToRemap(hdc)) {
switch(dxw.GDIEmulationMode){
@ -2864,7 +2879,7 @@ COLORREF WINAPI extGetPixel(HDC hdc, int nXPos, int nYPos)
}
ret=(*pGetPixel)(hdc, nXPos, nYPos);
if(!ret) OutTraceE("CreateDIBitmap ERROR: err=%d\n", GetLastError());
if(!ret) OutTraceE("GetPixel ERROR: err=%d\n", GetLastError());
return ret;}
BOOL WINAPI extPlgBlt(HDC hdcDest, const POINT *lpPoint, HDC hdcSrc, int nXSrc, int nYSrc, int nWidth, int nHeight, HBITMAP hbmMask, int xMask, int yMask)

View File

@ -166,8 +166,8 @@ HDC dxwSDC::GetPrimaryDC(HDC hdc)
switch(VirtualSurfaceType){
case VIRTUAL_ON_DDRAW:
if(!(*pGDIBitBlt)(VirtualHDC, 0, 0, ScreenWidth, ScreenHeight, PrimaryDC, VirtualOffset.x, VirtualOffset.y, SRCCOPY)){
OutTraceE("dxwSDC::GetPrimaryDC: StretchBlt ERROR err=%d at=%d\n", GetLastError(), __LINE__);
_Warn("StretchBlt ERROR");
OutTraceE("dxwSDC::GetPrimaryDC: BitBlt ERROR err=%d at=%d\n", GetLastError(), __LINE__);
_Warn("BitBlt ERROR");
}
OutTraceB("dxwSDC::GetPrimaryDC: fill=(0,0)-(%dx%d) from=(%d,%d)\n", ScreenWidth, ScreenHeight, VirtualOffset.x, VirtualOffset.y);
break;

View File

@ -1499,7 +1499,8 @@ static HWND WINAPI extCreateWindowCommon(
POINT upleft = {0,0};
// update virtual screen size if it has grown
dxw.SetScreenSize(nWidth, nHeight);
// v2.03.58 fix: do't consider CW_USEDEFAULT ad a big unsigned integer!! Fixes "Imperialism".
if((nWidth != CW_USEDEFAULT) && (nHeight != CW_USEDEFAULT)) dxw.SetScreenSize(nWidth, nHeight);
// inserted some checks here, since the main window could be destroyed
// or minimized (see "Jedi Outcast") so that you may get a dangerous

View File

@ -7,16 +7,16 @@
#include <windows.h>
#include <tlhelp32.h>
int KillProcByName(char *szToTerminate, BOOL bKill)
int KillProcByName(char *sProcessTail, BOOL bKill)
// Created: 6/23/2000 (RK)
// Last modified: 3/10/2002 (RK)
// Please report any problems or bugs to kochhar@physiology.wisc.edu
// The latest version of this routine can be found at:
// http://www.neurophys.wisc.edu/ravi/software/killproc/
// Terminate the process "szToTerminate" if it is currently running
// Terminate the process "sProcessTail" if it is currently running
// This works for Win/95/98/ME and also Win/NT/2000/XP
// The process name is case-insensitive, i.e. "notepad.exe" and "NOTEPAD.EXE"
// will both work (for szToTerminate)
// will both work (for sProcessTail)
// Return codes are as follows:
// 0 = Process was successfully terminated
// 603 = Process was not currently running
@ -52,10 +52,10 @@ int KillProcByName(char *szToTerminate, BOOL bKill)
// Transfer Process name into "szToTermUpper" and
// convert it to upper case
iLenP=strlen(szToTerminate);
iLenP=strlen(sProcessTail);
if(iLenP<1 || iLenP>MAX_PATH) return 632;
for(indx=0;indx<iLenP;indx++)
szToTermUpper[indx]=toupper(szToTerminate[indx]);
szToTermUpper[indx]=toupper(sProcessTail[indx]);
szToTermUpper[iLenP]=0;
// PSAPI Function Pointers.
@ -329,3 +329,242 @@ int KillProcByName(char *szToTerminate, BOOL bKill)
return 0;
}
// tries to get the full pathname of a running process
// returning 0 if succeeds.
BOOL GetProcByName(char *sProcessTail, char*sFullPath)
{
BOOL bResult,bResultm;
DWORD aiPID[1000],iCb=1000,iNumProc,iV2000=0;
DWORD iCbneeded,i,iFound=0;
char szName[MAX_PATH],szToTermUpper[MAX_PATH];
HANDLE hProc,hSnapShot,hSnapShotm;
OSVERSIONINFO osvi;
HINSTANCE hInstLib;
int iLen,iLenP,indx;
HMODULE hMod;
PROCESSENTRY32 procentry;
MODULEENTRY32 modentry;
// Transfer Process name into "szToTermUpper" and
// convert it to upper case
iLenP=strlen(sProcessTail);
if(iLenP<1 || iLenP>MAX_PATH) return FALSE;
for(indx=0;indx<iLenP;indx++)
szToTermUpper[indx]=toupper(sProcessTail[indx]);
szToTermUpper[iLenP]=0;
// PSAPI Function Pointers.
BOOL (WINAPI *lpfEnumProcesses)( DWORD *, DWORD cb, DWORD * );
BOOL (WINAPI *lpfEnumProcessModules)( HANDLE, HMODULE *, DWORD, LPDWORD );
DWORD (WINAPI *lpfGetModuleBaseName)( HANDLE, HMODULE, LPTSTR, DWORD );
DWORD (WINAPI *lpfGetModuleFileName)( HANDLE, HMODULE, LPTSTR, DWORD );
// ToolHelp Function Pointers.
HANDLE (WINAPI *lpfCreateToolhelp32Snapshot)(DWORD,DWORD) ;
BOOL (WINAPI *lpfProcess32First)(HANDLE,LPPROCESSENTRY32) ;
BOOL (WINAPI *lpfProcess32Next)(HANDLE,LPPROCESSENTRY32) ;
BOOL (WINAPI *lpfModule32First)(HANDLE,LPMODULEENTRY32) ;
BOOL (WINAPI *lpfModule32Next)(HANDLE,LPMODULEENTRY32) ;
// First check what version of Windows we're in
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
bResult=GetVersionEx(&osvi);
if(!bResult) // Unable to identify system version
return 606;
// At Present we only support Win/NT/2000/XP or Win/9x/ME
if((osvi.dwPlatformId != VER_PLATFORM_WIN32_NT) &&
(osvi.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS))
return 607;
if(osvi.dwPlatformId>=VER_PLATFORM_WIN32_NT)
{
// Win/NT or 2000 or XP or greater
// Load library and get the procedures explicitly. We do
// this so that we don't have to worry about modules using
// this code failing to load under Windows 9x, because
// it can't resolve references to the PSAPI.DLL.
hInstLib = LoadLibraryA("PSAPI.DLL");
if(hInstLib == NULL)
return 605;
// Get procedure addresses.
lpfEnumProcesses = (BOOL(WINAPI *)(DWORD *,DWORD,DWORD*))
GetProcAddress( hInstLib, "EnumProcesses" ) ;
lpfEnumProcessModules = (BOOL(WINAPI *)(HANDLE, HMODULE *,
DWORD, LPDWORD)) GetProcAddress( hInstLib,
"EnumProcessModules" ) ;
lpfGetModuleBaseName =(DWORD (WINAPI *)(HANDLE, HMODULE,
LPTSTR, DWORD )) GetProcAddress( hInstLib,
"GetModuleBaseNameA" ) ;
lpfGetModuleFileName =(DWORD (WINAPI *)(HANDLE, HMODULE,
LPTSTR, DWORD )) GetProcAddress( hInstLib,
"GetModuleFileNameExA" ) ;
if(lpfEnumProcesses == NULL ||
lpfEnumProcessModules == NULL ||
lpfGetModuleBaseName == NULL ||
lpfGetModuleFileName == NULL)
{
FreeLibrary(hInstLib);
return 700;
}
bResult=lpfEnumProcesses(aiPID,iCb,&iCbneeded);
if(!bResult)
{
// Unable to get process list, EnumProcesses failed
FreeLibrary(hInstLib);
return 701;
}
// How many processes are there?
iNumProc=iCbneeded/sizeof(DWORD);
// Get and match the name of each process
for(i=0;i<iNumProc;i++)
{
// Get the (module) name for this process
strcpy(szName,"Unknown");
// First, get a handle to the process
hProc=OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,FALSE,
aiPID[i]);
// Now, get the process name
if(hProc)
{
if(lpfEnumProcessModules(hProc,&hMod,sizeof(hMod),&iCbneeded) )
{
iLen=lpfGetModuleBaseName(hProc,hMod,szName,MAX_PATH);
}
}
// We will match regardless of lower or upper case
#ifdef BORLANDC
if(strcmp(strupr(szName),szToTermUpper)==0)
#else
if(strcmp(_strupr(szName),szToTermUpper)==0)
#endif
{
// Process found
iFound = 1;
lpfGetModuleFileName(hProc,hMod,sFullPath,MAX_PATH);
FreeLibrary(hInstLib);
CloseHandle(hProc);
return 0; // just tell you found it.
}
CloseHandle(hProc);
}
}
if(osvi.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS)
{
return 999; // untested .....
// Win/95 or 98 or ME
hInstLib = LoadLibraryA("Kernel32.DLL");
if( hInstLib == NULL )
return 702;
// Get procedure addresses.
// We are linking to these functions of Kernel32
// explicitly, because otherwise a module using
// this code would fail to load under Windows NT,
// which does not have the Toolhelp32
// functions in the Kernel 32.
lpfCreateToolhelp32Snapshot=
(HANDLE(WINAPI *)(DWORD,DWORD))
GetProcAddress( hInstLib,
"CreateToolhelp32Snapshot" ) ;
lpfProcess32First=
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))
GetProcAddress( hInstLib, "Process32First" ) ;
lpfProcess32Next=
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))
GetProcAddress( hInstLib, "Process32Next" ) ;
lpfModule32First=
(BOOL(WINAPI *)(HANDLE,LPMODULEENTRY32))
GetProcAddress( hInstLib, "Module32First" ) ;
lpfModule32Next=
(BOOL(WINAPI *)(HANDLE,LPMODULEENTRY32))
GetProcAddress( hInstLib, "Module32Next" ) ;
if( lpfProcess32Next == NULL ||
lpfProcess32First == NULL ||
lpfModule32Next == NULL ||
lpfModule32First == NULL ||
lpfCreateToolhelp32Snapshot == NULL )
{
FreeLibrary(hInstLib);
return 703;
}
// The Process32.. and Module32.. routines return names in all uppercase
// Get a handle to a Toolhelp snapshot of all the systems processes.
hSnapShot = lpfCreateToolhelp32Snapshot(
TH32CS_SNAPPROCESS, 0 ) ;
if( hSnapShot == INVALID_HANDLE_VALUE )
{
FreeLibrary(hInstLib);
return 704;
}
// Get the first process' information.
procentry.dwSize = sizeof(PROCESSENTRY32);
bResult=lpfProcess32First(hSnapShot,&procentry);
// While there are processes, keep looping and checking.
while(bResult)
{
// Get a handle to a Toolhelp snapshot of this process.
hSnapShotm = lpfCreateToolhelp32Snapshot(
TH32CS_SNAPMODULE, procentry.th32ProcessID) ;
if( hSnapShotm == INVALID_HANDLE_VALUE )
{
CloseHandle(hSnapShot);
FreeLibrary(hInstLib);
return 704;
}
// Get the module list for this process
modentry.dwSize=sizeof(MODULEENTRY32);
bResultm=lpfModule32First(hSnapShotm,&modentry);
// While there are modules, keep looping and checking
while(bResultm)
{
if(strcmp(modentry.szModule,szToTermUpper)==0)
{
// Process found, now terminate it
strcpy(sFullPath, szName);
// process terminated
CloseHandle(hSnapShotm);
CloseHandle(hSnapShot);
FreeLibrary(hInstLib);
}
else
{ // Look for next modules for this process
modentry.dwSize=sizeof(MODULEENTRY32);
bResultm=lpfModule32Next(hSnapShotm,&modentry);
}
}
//Keep looking
CloseHandle(hSnapShotm);
procentry.dwSize = sizeof(PROCESSENTRY32);
bResult = lpfProcess32Next(hSnapShot,&procentry);
}
CloseHandle(hSnapShot);
}
if(iFound==0)
{
FreeLibrary(hInstLib);
return 603;
}
FreeLibrary(hInstLib);
return 0;
}

28
host/dxwnd.manifest Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="dxwnd" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"
/>
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
</application>
</compatibility>
</assembly>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="dxwndhost"
ProjectGUID="{FD0B0234-8EC5-43C0-A384-1B881DD3D925}"
RootNamespace="dxwndhost"
@ -83,6 +83,7 @@
OutputFile="../Release/dxwnd.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalManifestDependencies=""
ProgramDatabaseFile=".\Release/dxwnd.pdb"
SubSystem="2"
RandomizedBaseAddress="1"
@ -94,6 +95,7 @@
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="dxwnd.manifest"
/>
<Tool
Name="VCXDCMakeTool"

View File

@ -140,6 +140,8 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView)
ON_COMMAND(ID_DESKTOPCOLORDEPTH_16BPP, OnDesktopcolordepth16bpp)
ON_COMMAND(ID_DESKTOPCOLORDEPTH_24BPP, OnDesktopcolordepth24bpp)
ON_COMMAND(ID_DESKTOPCOLORDEPTH_32BPP, OnDesktopcolordepth32bpp)
ON_COMMAND(ID_TOOLS_RECOVERSCREENMODE, OnRecoverScreenMode)
ON_COMMAND(ID_TOOLS_CLEARCOMPATIBILITYFLAGS, OnClearCompatibilityFlags)
ON_COMMAND(ID_MOVE_TOP, OnMoveTop)
ON_COMMAND(ID_MOVE_UP, OnMoveUp)
ON_COMMAND(ID_MOVE_DOWN, OnMoveDown)
@ -1389,6 +1391,48 @@ void CDxwndhostView::OnDebugView()
CloseHandle(pinfo.hThread);
}
void CDxwndhostView::OnSetPath()
{
int i;
CTargetDlg dlg;
POSITION pos;
char *lpProcName, *lpNext;
extern BOOL GetProcByName(char *, char *);
char FullPath[MAX_PATH+1];
char sMessage[1000];
CListCtrl& listctrl = GetListCtrl();
if(!listctrl.GetSelectedCount()) return;
pos = listctrl.GetFirstSelectedItemPosition();
i = listctrl.GetNextSelectedItem(pos);
//if(TargetMaps[i].path[0] != '*') return;
lpProcName = &(TargetMaps[i].path[1]);
while (lpNext=strchr(lpProcName,'\\')) lpProcName=lpNext+1;
strcpy(FullPath,"");
if(GetProcByName(lpProcName, FullPath)==0){
int res;
if(strcmp(TargetMaps[i].path, FullPath)){
sprintf(sMessage, "Found replacement for \"%s\", "
"full path = \"%s\", "
"do you want to update the configuration?", lpProcName, FullPath);
res = MessageBox(sMessage, "DxWnd set path", MB_YESNO);
if(res!=IDYES) return;
strcpy(TargetMaps[i].path, FullPath);
this->isUpdated=TRUE;
}
else {
sprintf(sMessage, "Path \"%s\" was already set.", FullPath);
MessageBox(sMessage, "DxWnd set path", MB_OK);
}
}
else{
sprintf(sMessage, "Replacement for \"%s\" not found, run the game!", lpProcName);
MessageBox(sMessage, "DxWnd set path", MB_ICONEXCLAMATION);
}
}
void CDxwndhostView::OnSetRegistry()
{
int i;
@ -2148,6 +2192,9 @@ void CDxwndhostView::OnRButtonDown(UINT nFlags, CPoint point)
case ID_SETREGISTRY:
OnSetRegistry();
break;
case ID_SETPATH:
OnSetPath();
break;
case ID_TASK_KILL:
OnKill();
break;
@ -2178,6 +2225,12 @@ void CDxwndhostView::OnRButtonDown(UINT nFlags, CPoint point)
case ID_DESKTOPCOLORDEPTH_32BPP:
OnDesktopcolordepth32bpp();
break;
case ID_TOOLS_RECOVERSCREENMODE:
OnRecoverScreenMode();
break;
case ID_TOOLS_CLEARCOMPATIBILITYFLAGS:
OnClearCompatibilityFlags();
break;
case ID_MOVE_TOP:
OnMoveTop();
break;
@ -2452,24 +2505,101 @@ void SwitchToColorDepth(int bpp)
void CDxwndhostView::OnDesktopcolordepth8bpp()
{
// TODO: Add your command handler code here
SwitchToColorDepth(8);
}
void CDxwndhostView::OnDesktopcolordepth16bpp()
{
// TODO: Add your command handler code here
SwitchToColorDepth(16);
}
void CDxwndhostView::OnDesktopcolordepth24bpp()
{
// TODO: Add your command handler code here
SwitchToColorDepth(24);
}
void CDxwndhostView::OnDesktopcolordepth32bpp()
{
// TODO: Add your command handler code here
SwitchToColorDepth(32);
}
void CDxwndhostView::OnRecoverScreenMode()
{
RevertScreenChanges(&this->InitDevMode);
}
void CDxwndhostView::OnClearCompatibilityFlags()
{
int i;
POSITION pos;
CListCtrl& listctrl = GetListCtrl();
CString FilePath;
HRESULT res;
char sMessage[500];
DWORD lKeyLength;
LONG ret;
if(!listctrl.GetSelectedCount()) return ;
pos = listctrl.GetFirstSelectedItemPosition();
i = listctrl.GetNextSelectedItem(pos);
sprintf(sMessage, "Clear all compatibility flags for \"%s\"?", PrivateMaps[i].title);
res=MessageBox(sMessage, "DxWnd", MB_YESNO | MB_ICONQUESTION);
if(res!=IDYES) return;
FilePath=TargetMaps[i].path;
if (FilePath.GetLength()==0) return;
HKEY hk;
lKeyLength = 0L;
DWORD lType;
ret=RegOpenKeyEx(HKEY_CURRENT_USER,
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers", 0, KEY_ALL_ACCESS, &hk);
if(ret){
if(ret != ERROR_FILE_NOT_FOUND){
sprintf(sMessage, "error %ld in RegOpenKeyEx HKEY_CURRENT_USER", ret);
MessageBox(sMessage, "DxWnd", MB_OK);
}
}
else {
ret=RegQueryValueEx(hk, TargetMaps[i].path, NULL, &lType, NULL, &lKeyLength);
if(ret && (ret != ERROR_FILE_NOT_FOUND)){
sprintf(sMessage, "error %ld in RegQueryValue hk=%lx \"%s\"", ret, hk, TargetMaps[i].path);
MessageBox(sMessage, "DxWnd", MB_OK);
}
if(lKeyLength > 0L) {
MessageBox("Found compatibility flag in HKEY_CURRENT_USER", "DxWnd", MB_OK);
if(ret = RegDeleteValue(hk, TargetMaps[i].path)) {
sprintf(sMessage, "error %ld in RegDeleteValue hk=%lx \"%s\"", ret, hk, TargetMaps[i].path);
MessageBox(sMessage, "DxWnd", MB_OK);
}
}
RegCloseKey(hk);
}
hk=0L;
lKeyLength = 0L;
ret=RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers", 0, KEY_ALL_ACCESS, &hk);
if(ret){
if(ret != ERROR_FILE_NOT_FOUND){
sprintf(sMessage, "error %ld in RegOpenKeyEx HKEY_LOCAL_MACHINE", ret);
MessageBox(sMessage, "DxWnd", MB_OK);
}
}
else{
ret=RegQueryValueEx(hk, TargetMaps[i].path, NULL, &lType, NULL, &lKeyLength);
if(ret && (ret != ERROR_FILE_NOT_FOUND)){
sprintf(sMessage, "error %ld in RegQueryValue hk=%lx \"%s\"", ret, hk, TargetMaps[i].path);
MessageBox(sMessage, "DxWnd", MB_OK);
}
if(lKeyLength > 0L) {
MessageBox("Found compatibility flag in HKEY_LOCAL_MACHINE", "DxWnd", MB_OK);
if(ret = RegDeleteValue(hk, TargetMaps[i].path)) {
sprintf(sMessage, "error %ld in RegDeleteValue hk=%lx \"%s\"", ret, hk, TargetMaps[i].path);
MessageBox(sMessage, "DxWnd", MB_OK);
}
}
RegCloseKey(hk);
}
}

View File

@ -80,6 +80,7 @@ protected:
afx_msg void OnDeleteLog();
afx_msg void OnDebugView();
afx_msg void OnSetRegistry();
afx_msg void OnSetPath();
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRun();
afx_msg void OnClearAllLogs();
@ -98,6 +99,8 @@ protected:
afx_msg void OnDesktopcolordepth16bpp();
afx_msg void OnDesktopcolordepth24bpp();
afx_msg void OnDesktopcolordepth32bpp();
afx_msg void OnRecoverScreenMode();
afx_msg void OnClearCompatibilityFlags();
afx_msg void OnMoveTop();
afx_msg void OnMoveUp();
afx_msg void OnMoveDown();

Binary file not shown.