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

v2_03_74_src

Former-commit-id: 34b12a81c38fe41efec75082ef0312828ec7c5fe
This commit is contained in:
gho tik 2016-03-07 11:46:17 -05:00 committed by Refael ACkermann
parent 36d3bd869b
commit f07fc28344
32 changed files with 551 additions and 192 deletions

View File

@ -1,34 +0,0 @@
[window]
posx=50
posy=50
sizx=320
sizy=200
lang=default
;lang=automatic
;updatepaths=1
;debug=1
;multiprocesshook=0
;checkadmin=0
[texture]
MinTexX=16
MaxTexX=0
MinTexY=16
MaxTexY=0
[keymapping]
timetoggle=0x72
altf4=0x73
timeslow=0x74
timefast=0x75
cliptoggle=
refresh=
logtoggle=
plocktoggle=
fpstoggle=
printscreen=0x7B
corner=0x7A
freezetime=0x79
fullscreen=0x0D
workarea=
desktop=

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f80de53cd4be510b1bd1357b345ca6353b3d2b8a00a459b3d736f67b62bdee85
size 660480
oid sha256:49d7c2658bf62db9650233f60f2cf5dd82912f2a522c26d4c115891440ccabd9
size 659968

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:17c2ae808e9f1b33fb9f412cc91d8c501cec58f395a2e9d098c008abc9285e74
size 576000
oid sha256:c966fe71e5250ed781b9e1415ce53fec601a93c4384893a2afb78bab76d75e56
size 640512

View File

@ -1,5 +0,0 @@
[window]
posx=50
posy=50
sizx=320
sizy=200

View File

@ -5,10 +5,10 @@ module0=p3shared
opengllib0=
ver0=8
coord0=0
flag0=134217762
flag0=134217770
flagg0=1207959552
flagh0=20
flagi0=4
flagi0=4194308
tflag0=0
initx0=0
inity0=0
@ -24,3 +24,14 @@ maxfps0=0
initts0=0
winver0=0
maxres0=-1
launchpath0=
notes0=
registry0=
flagj0=0
flagk0=0
flagl0=0
flagm0=0
dflag0=0
swapeffect0=0
maxddinterface0=7
slowratio0=1

View File

@ -0,0 +1,31 @@
[target]
title0=Midnight GT Primary Racer
path0=D:\Games\Midnight GT Primary Racer\game.exe
launchpath0=
module0=
opengllib0=
notes0=
registry0=
ver0=0
coord0=0
flag0=136314914
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4226
flagk0=65552
flagl0=0
flagm0=0
tflag0=0
dflag0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0
maxddinterface0=7
slowratio0=2

View File

@ -0,0 +1,31 @@
[target]
title0=Total Annihilation
path0=D:\Games\TOTA\totala.exe
launchpath0=
module0=
opengllib0=
notes0=
registry0=
ver0=1
coord0=0
flag0=136314914
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4224
flagk0=0
flagl0=0
flagm0=0
tflag0=0
dflag0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0
maxddinterface0=7
slowratio0=2

View File

@ -1142,3 +1142,8 @@ fix: logic for restering last window position on multimonitor configurations
add: "Help -> View Help" to show help page
add: "Fix GlobalUnlock" flag to fix GlobalUnlock bad errorcodes in "Grand Prix World" and possibly other games.
add: revised log configuration, added "Separate" mode to make each process to write on a dedicated file.
v2.03.74
fix: logging of dwFOURCC field text value
fix: Injection routine: avoid closing a few handles that should not be closed, simplified logic.
add: GUI global configuration panel

View File

@ -59,7 +59,7 @@ BOOL Inject(DWORD pID, const char * DLL_NAME)
}
CloseHandle(hThread);
CloseHandle(hProc);
CloseHandle(hLib);
//CloseHandle(hLib);
return true;
}

View File

@ -1834,8 +1834,8 @@ static char *sFourCC(DWORD fcc)
char *t=&sRet[0];
for(i=0; i<4; i++){
c = fcc & (0xFF);
*t++ = isprint(c) ? c : '.';
c = c >> 8;
*(t++) = isprint(c) ? c : '.';
fcc = fcc >> 8;
}
*t = 0;
return sRet;

View File

@ -1530,7 +1530,6 @@ void HookInit(TARGETMAP *target, HWND hwnd)
else
if(dxw.dwFlags7 & CPUMAXUSAGE)
CreateThread(NULL, 0, CpuLimit, NULL, 0, NULL);
}
LPCSTR ProcToString(LPCSTR proc)

Binary file not shown.

View File

@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "TlHelp32.h"
#define VERSION "2.03.73"
#define VERSION "2.03.74"
#define DDTHREADLOCK 1
//#define LOCKTHREADS

View File

@ -1,20 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxwnd", "dxwnd.vs2008.vcproj", "{579E7FE7-2745-4100-A802-23511711FCDE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{579E7FE7-2745-4100-A802-23511711FCDE}.Debug|Win32.ActiveCfg = Debug|Win32
{579E7FE7-2745-4100-A802-23511711FCDE}.Debug|Win32.Build.0 = Debug|Win32
{579E7FE7-2745-4100-A802-23511711FCDE}.Release|Win32.ActiveCfg = Release|Win32
{579E7FE7-2745-4100-A802-23511711FCDE}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@ -8,7 +8,7 @@
//#undef IsTraceDW
//#define IsTraceDW TRUE
#define LOCKINJECTIONTHREADS
//#define LOCKINJECTIONTHREADS
#define TRYFATNAMES TRUE
extern HRESULT WINAPI extDirectDrawEnumerateA(LPDDENUMCALLBACK, LPVOID);
@ -920,8 +920,7 @@ BOOL WINAPI extCreateProcessA(
extern BOOL Inject(DWORD, const char *);
LPVOID LastExceptionPtr = 0;
//dwCreationFlags |= DEBUG_ONLY_THIS_PROCESS;
dwCreationFlags |= (DEBUG_ONLY_THIS_PROCESS|DEBUG_PROCESS);
dwCreationFlags |= DEBUG_ONLY_THIS_PROCESS;
res=(*pCreateProcessA)(
lpApplicationName, lpCommandLine,
@ -934,92 +933,89 @@ BOOL WINAPI extCreateProcessA(
while(bContinueDebugging)
{
if (!WaitForDebugEvent(&debug_event, INFINITE)) break;
OutTrace("CreateProcess: event=%x(%s)\n", debug_event.dwDebugEventCode, ExplainDebugEvent(debug_event.dwDebugEventCode));
OutTraceB("CreateProcess: WaitForDebugEvent pid=%x tid=%x event=%x(%s)\n",
debug_event.dwProcessId, debug_event.dwThreadId, debug_event.dwDebugEventCode, ExplainDebugEvent(debug_event.dwDebugEventCode));
switch(debug_event.dwDebugEventCode){
case EXIT_PROCESS_DEBUG_EVENT:
//OutTrace("CreateProcess: event=%x(%s) process terminated\n", debug_event.dwDebugEventCode, ExplainDebugEvent(debug_event.dwDebugEventCode));
bContinueDebugging=false;
break;
case CREATE_PROCESS_DEBUG_EVENT:
//OutTrace("CreateProcess: event=%x(%s) process started\n", debug_event.dwDebugEventCode, ExplainDebugEvent(debug_event.dwDebugEventCode));
GetModuleFileName(GetModuleHandle("dxwnd"), path, MAX_PATH);
OutTrace("CreateProcess: injecting path=%s\n", path);
if(!Inject(lpProcessInformation->dwProcessId, path)){
OutTrace("CreateProcess: Injection ERROR pid=%x dll=%s\n", lpProcessInformation->dwProcessId, path);
}
case EXIT_PROCESS_DEBUG_EVENT:
bContinueDebugging=false;
break;
case CREATE_PROCESS_DEBUG_EVENT:
GetModuleFileName(GetModuleHandle("dxwnd"), path, MAX_PATH);
OutTrace("CreateProcess: injecting path=%s\n", path);
if(!Inject(lpProcessInformation->dwProcessId, path)){
OutTrace("CreateProcess: Injection ERROR pid=%x dll=%s\n", lpProcessInformation->dwProcessId, path);
}
#ifdef LOCKINJECTIONTHREADS
extern LPVOID GetThreadStartAddress(HANDLE);
DWORD TargetHandle;
DWORD EndlessLoop;
EndlessLoop=0x9090FEEB; // assembly for JMP to here, NOP, NOP
SIZE_T BytesCount;
TargetHandle = (DWORD)OpenProcess(
PROCESS_QUERY_INFORMATION|PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE,
FALSE,
lpProcessInformation->dwProcessId);
if(TargetHandle){
StartAddress = GetThreadStartAddress(lpProcessInformation->hThread);
OutTrace("CreateProcess: StartAddress=%x\n", StartAddress);
if(StartAddress){
if(!ReadProcessMemory(lpProcessInformation->hProcess, StartAddress, &StartingCode, 4, &BytesCount)){
OutTrace("CreateProcess: ReadProcessMemory error=%d\n", GetLastError());
}
OutTrace("CreateProcess: StartCode=%x\n", StartingCode);
if(!WriteProcessMemory(lpProcessInformation->hProcess, StartAddress, &EndlessLoop, 4, &BytesCount)){
OutTrace("CreateProcess: WriteProcessMemory error=%d\n", GetLastError());
HANDLE TargetHandle;
extern LPVOID GetThreadStartAddress(HANDLE);
DWORD EndlessLoop;
EndlessLoop=0x9090FEEB; // assembly for JMP to here, NOP, NOP
SIZE_T BytesCount;
TargetHandle = (DWORD)OpenProcess(
PROCESS_QUERY_INFORMATION|PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE,
FALSE,
lpProcessInformation->dwProcessId);
if(TargetHandle){
StartAddress = GetThreadStartAddress(lpProcessInformation->hThread);
OutTrace("CreateProcess: StartAddress=%x\n", StartAddress);
if(StartAddress){
if(!ReadProcessMemory(lpProcessInformation->hProcess, StartAddress, &StartingCode, 4, &BytesCount)){
OutTrace("CreateProcess: ReadProcessMemory error=%d\n", GetLastError());
}
OutTrace("CreateProcess: StartCode=%x\n", StartingCode);
if(!WriteProcessMemory(lpProcessInformation->hProcess, StartAddress, &EndlessLoop, 4, &BytesCount)){
OutTrace("CreateProcess: WriteProcessMemory error=%d\n", GetLastError());
}
}
}
}
#endif
OutTrace("CreateProcess: injection started\n", res);
CloseHandle(((CREATE_PROCESS_DEBUG_INFO *)&debug_event.u)->hProcess);
CloseHandle(((CREATE_PROCESS_DEBUG_INFO *)&debug_event.u)->hThread);
CloseHandle(((CREATE_PROCESS_DEBUG_INFO *)&debug_event.u)->hFile);
break;
case EXIT_THREAD_DEBUG_EVENT:
//OutTrace("CreateProcess: event=%x(%s) injection terminated\n", debug_event.dwDebugEventCode, ExplainDebugEvent(debug_event.dwDebugEventCode));
OutTrace("CreateProcess: injection started\n", res);
CloseHandle(debug_event.u.CreateProcessInfo.hFile);
break;
case EXCEPTION_DEBUG_EVENT:
{
LPEXCEPTION_DEBUG_INFO ei;
ei=(LPEXCEPTION_DEBUG_INFO)&debug_event.u;
OutTraceE("CreateProcess: EXCEPTION code=%x flags=%x addr=%x firstchance=%x\n",
ei->ExceptionRecord.ExceptionCode,
ei->ExceptionRecord.ExceptionFlags,
ei->ExceptionRecord.ExceptionAddress,
debug_event.u.Exception.dwFirstChance);
// exception twice in same address, then do not continue.
if(LastExceptionPtr == ei->ExceptionRecord.ExceptionAddress) bContinueDebugging = FALSE;
//if(ei->dwFirstChance == 0) bContinueDebugging = FALSE;
LastExceptionPtr = ei->ExceptionRecord.ExceptionAddress;
}
bContinueDebugging=false;
break;
case LOAD_DLL_DEBUG_EVENT:
//OutTrace("CreateProcess: event=%x(%s) dll=%s address=%x\n",
// debug_event.dwDebugEventCode, ExplainDebugEvent(debug_event.dwDebugEventCode),
// ((LOAD_DLL_DEBUG_INFO *)&debug_event.u)->lpImageName, ((LOAD_DLL_DEBUG_INFO *)&debug_event.u)->lpBaseOfDll);
CloseHandle(debug_event.u.LoadDll.hFile);
break;
case CREATE_THREAD_DEBUG_EVENT:
OutTraceB("CreateProcess: THREAD %x\n", debug_event.u.CreateThread.hThread);
break;
case EXIT_THREAD_DEBUG_EVENT:
#ifdef LOCKINJECTIONTHREADS
if(TargetHandle && StartAddress){
if(dxw.dwFlags5 & FREEZEINJECTEDSON){
OutTrace("CreateProcess: FREEZEINJECTEDSON leaving son process in endless loop\n", GetLastError());
if(TargetHandle && StartAddress){
if(dxw.dwFlags5 & FREEZEINJECTEDSON){
OutTrace("CreateProcess: FREEZEINJECTEDSON leaving son process in endless loop\n", GetLastError());
}
else{
if(!WriteProcessMemory(lpProcessInformation->hProcess, StartAddress, &StartingCode, 4, &BytesCount)){
OutTrace("CreateProcess: WriteProcessMemory error=%d\n", GetLastError());
}
}
CloseHandle((HANDLE)TargetHandle);
OutTrace("CreateProcess: injection terminated\n", res);
}
else{
if(!WriteProcessMemory(lpProcessInformation->hProcess, StartAddress, &StartingCode, 4, &BytesCount)){
OutTrace("CreateProcess: WriteProcessMemory error=%d\n", GetLastError());
}
}
CloseHandle((HANDLE)TargetHandle);
OutTrace("CreateProcess: injection terminated\n", res);
}
#endif
bContinueDebugging=false;
case EXCEPTION_DEBUG_EVENT:
//OutTrace("CreateProcess: event=%x(%s)\n", debug_event.dwDebugEventCode, ExplainDebugEvent(debug_event.dwDebugEventCode));
{
LPEXCEPTION_DEBUG_INFO ei;
ei=(LPEXCEPTION_DEBUG_INFO)&debug_event.u;
OutTraceE("CreateProcess: EXCEPTION code=%x flags=%x addr=%x firstchance=%x\n",
ei->ExceptionRecord.ExceptionCode,
ei->ExceptionRecord.ExceptionFlags,
ei->ExceptionRecord.ExceptionAddress,
debug_event.u.Exception.dwFirstChance);
// exception twice in same address, then do not continue.
if(LastExceptionPtr == ei->ExceptionRecord.ExceptionAddress) bContinueDebugging = FALSE;
//if(ei->dwFirstChance == 0) bContinueDebugging = FALSE;
LastExceptionPtr = ei->ExceptionRecord.ExceptionAddress;
}
break;
case LOAD_DLL_DEBUG_EVENT:
//OutTrace("CreateProcess: event=%x(%s) dll=%s address=%x\n",
// debug_event.dwDebugEventCode, ExplainDebugEvent(debug_event.dwDebugEventCode),
// ((LOAD_DLL_DEBUG_INFO *)&debug_event.u)->lpImageName, ((LOAD_DLL_DEBUG_INFO *)&debug_event.u)->lpBaseOfDll);
CloseHandle(((LOAD_DLL_DEBUG_INFO *)&debug_event.u)->hFile);
break;
case CREATE_THREAD_DEBUG_EVENT:
CloseHandle(((CREATE_THREAD_DEBUG_INFO *)&debug_event.u)->hThread);
break;
default:
break;
OutTraceB("CreateProcess: thread exit code=%x\n", debug_event.u.ExitThread.dwExitCode);
bContinueDebugging=false;
default:
break;
}
if(bContinueDebugging){
ContinueDebugEvent(debug_event.dwProcessId,
@ -1027,12 +1023,17 @@ BOOL WINAPI extCreateProcessA(
dwContinueStatus);
}
else{
DebugSetProcessKillOnExit(FALSE);
ContinueDebugEvent(debug_event.dwProcessId, debug_event.dwThreadId, DBG_CONTINUE);
DebugActiveProcessStop(debug_event.dwProcessId);
if(!DebugSetProcessKillOnExit(FALSE)){
OutTraceE("CreateProcess: DebugSetProcessKillOnExit ERROR err=%d\n", GetLastError());
}
if(!DebugActiveProcessStop(debug_event.dwProcessId)){
OutTraceE("CreateProcess: DebugActiveProcessStop ERROR err=%d\n", GetLastError());
MessageBox(NULL, "Error in DebugActiveProcessStop", "dxwnd", MB_OK);
}
}
}
OutTrace("CreateProcess: detached\n", res);
OutTrace("CreateProcess: detached\n");
}
else{
res=(*pCreateProcessA)(

BIN
host/-dxwndhost.vs2008.suo Normal file

Binary file not shown.

218
host/CGlobalSettings.cpp Normal file
View File

@ -0,0 +1,218 @@
// CGlobalSettings.cpp : implementation file
//
#include "stdafx.h"
#include "dxwndhost.h"
//#include "dxwndhostView.h"
#include "CGlobalSettings.h"
extern char gInitPath[];
Key_Type FKeys[] = {
{IDC_KEY_LABEL1, "Time toggle", IDC_KEY_COMBO1, "timetoggle", 0},
{IDC_KEY_LABEL2, "Time fast", IDC_KEY_COMBO2, "timefast", 0},
{IDC_KEY_LABEL3, "Time slow", IDC_KEY_COMBO3, "timeslow", 0},
{IDC_KEY_LABEL4, "Alt-F4", IDC_KEY_COMBO4, "altf4", 0},
{IDC_KEY_LABEL5, "Clip toggle", IDC_KEY_COMBO5, "cliptoggle", 0},
{IDC_KEY_LABEL6, "Refresh", IDC_KEY_COMBO6, "refresh", 0},
{IDC_KEY_LABEL7, "Log toggle", IDC_KEY_COMBO7, "logtoggle", 0},
{IDC_KEY_LABEL8, "label4", IDC_KEY_COMBO8, "plogtoggle", 0},
{IDC_KEY_LABEL9, "FPS toggle", IDC_KEY_COMBO9, "fpstoggle", 0},
{IDC_KEY_LABEL10, "Print screen", IDC_KEY_COMBO10, "printscreen", 0},
{IDC_KEY_LABEL11, "Corner tog.", IDC_KEY_COMBO11, "corner", 0},
{IDC_KEY_LABEL12, "Time freeze", IDC_KEY_COMBO12, "freezetime", 0},
{IDC_KEY_LABEL13, "Fullscr. t.", IDC_KEY_COMBO13, "fullscreen", 0},
{IDC_KEY_LABEL14, "Work area t.", IDC_KEY_COMBO14, "workarea", 0},
{IDC_KEY_LABEL15, "Desktop t.", IDC_KEY_COMBO15, "desktop", 0},
{0, "", 0, 0}
};
Key_Type HKeys[] = {
{IDC_HKEY_LABEL1, "Minimize", IDC_HKEY_COMBO1, "minimize", 0},
{IDC_HKEY_LABEL2, "Restore", IDC_HKEY_COMBO2, "restore", 0},
{IDC_HKEY_LABEL3, "Kill proc.", IDC_HKEY_COMBO3, "kill", 0},
{0, "", 0, 0}
};
KeyCombo_Type FKeyCombo[] = {
{-1, "--"},
{VK_F1, "F1"},
{VK_F2, "F2"},
{VK_F3, "F3"},
{VK_F5, "F5"},
{VK_F6, "F6"},
{VK_F7, "F7"},
{VK_F8, "F8"},
{VK_F9, "F9"},
{VK_F10, "F10"},
{VK_F11, "F11"},
{VK_F12, "F12"},
{0, ""}
};
KeyCombo_Type HKeyCombo[] = {
{-1, "--"},
{VK_END, "END"},
{VK_HOME, "HOME"},
{VK_DELETE, "DEL"},
{VK_ESCAPE, "ESC"},
{VK_F1, "F1"},
{VK_F2, "F2"},
{VK_F3, "F3"},
{VK_F5, "F5"},
{VK_F6, "F6"},
{VK_F7, "F7"},
{VK_F8, "F8"},
{VK_F9, "F9"},
{VK_F10, "F10"},
{VK_F11, "F11"},
{VK_F12, "F12"},
{0, ""}
};
// CGlobalSettings dialog
IMPLEMENT_DYNAMIC(CGlobalSettings, CDialog)
CGlobalSettings::CGlobalSettings(CWnd* pParent /*=NULL*/)
: CDialog(CGlobalSettings::IDD, pParent)
{
}
CGlobalSettings::~CGlobalSettings()
{
}
void CGlobalSettings::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Check(pDX, IDC_CONFIG_DEBUGMODE, m_DebugMode);
DDX_Check(pDX, IDC_CONFIG_AUTOHIDE, m_AutoHideMode);
DDX_Check(pDX, IDC_CONFIG_CHECKADMIN, m_CheckAdminRights);
DDX_Check(pDX, IDC_CONFIG_SAVEPATHS, m_UpdatePaths);
DDX_Text (pDX, IDC_TEX_MINX, m_TexMinX);
DDX_Text (pDX, IDC_TEX_MINY, m_TexMinY);
DDX_Text (pDX, IDC_TEX_MAXX, m_TexMaxX);
DDX_Text (pDX, IDC_TEX_MAXY, m_TexMaxY);
}
BEGIN_MESSAGE_MAP(CGlobalSettings, CDialog)
END_MESSAGE_MAP()
#define IDPaletteTIMER 2
// CPaletteDialog message handlers
//static void SetKeys(HWND hDlg, Key_Type *FKeys, KeyCombo_Type *FKeyCombo)
//{
// for(int i=0; FKeys[i].iLabelResourceId; i++){
// int iCursor = 0;
// DWORD dwKey;
// dwKey = GetPrivateProfileInt("keymapping", FKeys[i].sIniLabel, -1, gInitPath);
// SetDlgItemText(hDlg,FKeys[i].iLabelResourceId,FKeys[i].sLabel);
// CComboBox *pCombo=(CComboBox *)GetDlgItem(FKeys[i].iComboResourceId);
// pCombo->Clear();
// for(int j=0; FKeyCombo[j].dwVKeyCode; j++) {
// pCombo->AddString(FKeyCombo[j].sVKeyLabel);
// if(dwKey == FKeyCombo[j].dwVKeyCode) iCursor=j;
// }
// pCombo->SetCurSel(iCursor);
// }
//}
BOOL CGlobalSettings::OnInitDialog()
{
for(int i=0; FKeys[i].iLabelResourceId; i++){
int iCursor = 0;
DWORD dwKey;
dwKey = GetPrivateProfileInt("keymapping", FKeys[i].sIniLabel, -1, gInitPath);
SetDlgItemText(FKeys[i].iLabelResourceId,FKeys[i].sLabel);
CComboBox *pCombo=(CComboBox *)GetDlgItem(FKeys[i].iComboResourceId);
pCombo->Clear();
for(int j=0; FKeyCombo[j].dwVKeyCode; j++) {
pCombo->AddString(FKeyCombo[j].sVKeyLabel);
if(dwKey == FKeyCombo[j].dwVKeyCode) iCursor=j;
}
pCombo->SetCurSel(iCursor);
}
for(int i=0; HKeys[i].iLabelResourceId; i++){
int iCursor = 0;
DWORD dwKey;
dwKey = GetPrivateProfileInt("keymapping", HKeys[i].sIniLabel, -1, gInitPath);
SetDlgItemText(HKeys[i].iLabelResourceId,HKeys[i].sLabel);
CComboBox *pCombo=(CComboBox *)GetDlgItem(HKeys[i].iComboResourceId);
pCombo->Clear();
for(int j=0; HKeyCombo[j].dwVKeyCode; j++) {
pCombo->AddString(HKeyCombo[j].sVKeyLabel);
if(dwKey == HKeyCombo[j].dwVKeyCode) iCursor=j;
}
pCombo->SetCurSel(iCursor);
}
//SetKeys(this, FKeys, FKeyCombo);
//SetKeys(this, HKeys, HKeyCombo);
m_DebugMode = GetPrivateProfileInt("window", "debug", 0, gInitPath);
m_AutoHideMode = GetPrivateProfileInt("window", "autohide", 0, gInitPath);
m_CheckAdminRights = GetPrivateProfileInt("window", "checkadmin", 0, gInitPath);
m_UpdatePaths = GetPrivateProfileInt("window", "updatepaths", 1, gInitPath);
m_TexMinX = GetPrivateProfileInt("texture", "MinTexX", 0, gInitPath);
m_TexMinY = GetPrivateProfileInt("texture", "MinTexY", 0, gInitPath);
m_TexMaxX = GetPrivateProfileInt("texture", "MaxTexX", 0, gInitPath);
m_TexMaxY = GetPrivateProfileInt("texture", "MaxTexY", 0, gInitPath);
CDialog::OnInitDialog();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CGlobalSettings::OnOK()
{
char val[32];
CDialog::OnOK();
// boolean flags
sprintf_s(val, sizeof(val), "%i", m_DebugMode);
WritePrivateProfileString("window", "debug", val, gInitPath);
sprintf_s(val, sizeof(val), "%i", m_AutoHideMode);
WritePrivateProfileString("window", "autohide", val, gInitPath);
sprintf_s(val, sizeof(val), "%i", m_CheckAdminRights);
WritePrivateProfileString("window", "checkadmin", val, gInitPath);
sprintf_s(val, sizeof(val), "%i", m_UpdatePaths);
WritePrivateProfileString("window", "updatepaths", val, gInitPath);
// texture limits
sprintf_s(val, sizeof(val), "%i", m_TexMinX);
WritePrivateProfileString("texture", "MinTexX", val, gInitPath);
sprintf_s(val, sizeof(val), "%i", m_TexMinY);
WritePrivateProfileString("texture", "MinTexY", val, gInitPath);
sprintf_s(val, sizeof(val), "%i", m_TexMaxX);
WritePrivateProfileString("texture", "MaxTexX", val, gInitPath);
sprintf_s(val, sizeof(val), "%i", m_TexMaxY);
WritePrivateProfileString("texture", "MaxTexY", val, gInitPath);
// fkeys
for(int i=0; FKeys[i].iLabelResourceId; i++){
int iCursor = 0;
DWORD dwKey;
CComboBox *pCombo=(CComboBox *)GetDlgItem(FKeys[i].iComboResourceId);
dwKey = FKeyCombo[pCombo->GetCurSel()].dwVKeyCode;
if(dwKey != -1) {
char sKNum[20];
sprintf_s(sKNum, sizeof(sKNum), "%i", dwKey);
WritePrivateProfileString("keymapping", FKeys[i].sIniLabel, sKNum, gInitPath);
}
else
WritePrivateProfileString("keymapping", FKeys[i].sIniLabel, "", gInitPath);
}
// hot keys
for(int i=0; HKeys[i].iLabelResourceId; i++){
int iCursor = 0;
DWORD dwKey;
CComboBox *pCombo=(CComboBox *)GetDlgItem(HKeys[i].iComboResourceId);
dwKey = HKeyCombo[pCombo->GetCurSel()].dwVKeyCode;
if(dwKey != -1) {
char sKNum[20];
sprintf_s(sKNum, sizeof(sKNum), "%i", dwKey);
WritePrivateProfileString("keymapping", HKeys[i].sIniLabel, sKNum, gInitPath);
}
else
WritePrivateProfileString("keymapping", HKeys[i].sIniLabel, "", gInitPath);
}
//(CDxwndhostView *)(this->GetParent())->UpdateHotKeys();
}

47
host/CGlobalSettings.h Normal file
View File

@ -0,0 +1,47 @@
#pragma once
typedef struct {
int iLabelResourceId;
char *sLabel;
int iComboResourceId;
char *sIniLabel;
int iComboSelection;
} Key_Type;
typedef struct {
DWORD dwVKeyCode;
char *sVKeyLabel;
} KeyCombo_Type;
// CGlobalSettings dialog
class CGlobalSettings : public CDialog
{
DECLARE_DYNAMIC(CGlobalSettings)
public:
CGlobalSettings(CWnd* pParent = NULL); // standard constructor
virtual ~CGlobalSettings();
// Dialog Data
enum { IDD = IDD_GLOBAL_CONFIG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
BOOL m_DebugMode;
BOOL m_UpdatePaths;
BOOL m_AutoHideMode;
BOOL m_CheckAdminRights;
int m_TexMinX;
int m_TexMinY;
int m_TexMaxX;
int m_TexMaxY;
DECLARE_MESSAGE_MAP()
public:
public:
virtual BOOL OnInitDialog();
protected:
virtual void OnOK();
};

BIN
host/alt-ctrl-shift.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
host/alt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Binary file not shown.

View File

@ -1,20 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxwndhost", "dxwndhost.vs2008.vcproj", "{FD0B0234-8EC5-43C0-A384-1B881DD3D925}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Debug|Win32.ActiveCfg = Debug|Win32
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Debug|Win32.Build.0 = Debug|Win32
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Release|Win32.ActiveCfg = Release|Win32
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@ -221,6 +221,10 @@
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\CGlobalSettings.cpp"
>
</File>
<File
RelativePath=".\CoolUtils.cpp"
>
@ -504,6 +508,10 @@
RelativePath=".\cdib.h"
>
</File>
<File
RelativePath=".\CGlobalSettings.h"
>
</File>
<File
RelativePath=".\CoolUtils.h"
>
@ -617,6 +625,14 @@
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
>
<File
RelativePath=".\res\alt-ctrl-shift.bmp"
>
</File>
<File
RelativePath=".\res\alt.bmp"
>
</File>
<File
RelativePath=".\res\bigicons.bmp"
>
@ -698,6 +714,22 @@
>
</File>
</Filter>
<File
RelativePath=".\alt-ctrl-shift.png"
>
</File>
<File
RelativePath=".\res\alt-ctrl-shift.png"
>
</File>
<File
RelativePath=".\res\alt.png"
>
</File>
<File
RelativePath=".\alt.png"
>
</File>
<File
RelativePath=".\resource"
>

View File

@ -17,6 +17,7 @@
#include "PaletteDialog.h"
#include "TimeSliderDialog.h"
#include "ShimsDialog.h"
#include "CGlobalSettings.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@ -126,13 +127,13 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView)
ON_COMMAND(ID_FILE_IMPORT, OnImport)
ON_COMMAND(ID_DELETE, OnDelete)
ON_COMMAND(ID_FILE_SORTPROGRAMSLIST, OnSort)
ON_COMMAND(ID_EDIT_GLOBALSETTINGS, OnGlobalSettings)
ON_COMMAND(ID_FILE_CLEARALLLOGS, OnClearAllLogs)
ON_COMMAND(ID_FILE_GOTOTRAYICON, OnGoToTrayIcon)
ON_COMMAND(ID_FILE_SAVE, OnSaveFile)
ON_COMMAND(ID_HOOK_START, OnHookStart)
ON_COMMAND(ID_HOOK_STOP, OnHookStop)
ON_COMMAND(ID_DXAPP_EXIT, OnExit)
ON_WM_RBUTTONDOWN()
ON_COMMAND(ID_RUN, OnRun)
ON_COMMAND(ID_TRAY_RESTORE, OnTrayRestore)
ON_COMMAND(ID_VIEW_STATUS, OnViewStatus)
@ -150,6 +151,8 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView)
ON_COMMAND(ID_MOVE_UP, OnMoveUp)
ON_COMMAND(ID_MOVE_DOWN, OnMoveDown)
ON_COMMAND(ID_MOVE_BOTTOM, OnMoveBottom)
ON_WM_RBUTTONDOWN()
ON_WM_HOTKEY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@ -1105,6 +1108,44 @@ void CDxwndhostView::OnDraw(CDC* pDC)
ASSERT_VALID(pDoc);
}
void CDxwndhostView::OnHotKey(UINT nHotKeyId, UINT nKey1, UINT nKey2)
{
switch(nHotKeyId){
case 0: // minimize
this->OnWindowMinimize();
break;
case 1: // restore
this->OnWindowRestore();
break;
case 2: // kill
this->OnProcessKill();
break;
}
}
void VKeyError(char *key)
{
char Msg[81];
sprintf(Msg, "RegisterHotKey(%s) failed err=%d", key, GetLastError());
MessageBox(NULL, Msg, "DxWnd error", MB_OK+MB_ICONWARNING);
}
void CDxwndhostView::UpdateHotKeys()
{
// Hot Keys
DWORD dwKey;
extern Key_Type HKeys[];
extern KeyCombo_Type HKeyCombo[];
// MessageBox("update global settings", "debug", MB_OK);
for(int i=0; HKeys[i].iLabelResourceId; i++){
dwKey = GetPrivateProfileInt("keymapping", HKeys[i].sIniLabel, 0, gInitPath);
if(dwKey) {
UnregisterHotKey(this->GetSafeHwnd(), i);
if(!RegisterHotKey(this->GetSafeHwnd(), i, MOD_ALT+MOD_SHIFT+MOD_CONTROL, dwKey)) VKeyError(HKeys[i].sIniLabel);
}
}
}
void CDxwndhostView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
@ -1167,6 +1208,17 @@ void CDxwndhostView::OnInitialUpdate()
pTitles = &PrivateMaps[0];
pTargets= &TargetMaps[0];
// Hot Keys
//DWORD dwKey;
//extern Key_Type HKeys[];
//extern KeyCombo_Type HKeyCombo[];
//for(int i=0; HKeys[i].iLabelResourceId; i++){
// dwKey = GetPrivateProfileInt("keymapping", HKeys[i].sIniLabel, 0, gInitPath);
// if(dwKey) if(!RegisterHotKey(this->GetSafeHwnd(), i, MOD_ALT+MOD_SHIFT+MOD_CONTROL, dwKey)) VKeyError(HKeys[i].sIniLabel);
//}
UpdateHotKeys();
// Transient mode
if(gTransientMode){
this->OnRun();
}
@ -1651,28 +1703,29 @@ void CDxwndhostView::OnResume()
extern HWND find_main_window(unsigned long);
void CDxwndhostView::OnWindowMinimize()
static void SendMessageToHookedWin(DWORD message)
{
DXWNDSTATUS DxWndStatus;
if ((GetHookStatus(&DxWndStatus) == DXW_RUNNING) && (DxWndStatus.hWnd!=NULL))
//::PostMessage(DxWndStatus.hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
::PostMessage(find_main_window(DxWndStatus.dwPid), WM_SYSCOMMAND, SC_MINIMIZE, 0);
HWND TargethWnd;
if (GetHookStatus(&DxWndStatus) == DXW_RUNNING){
TargethWnd = (DxWndStatus.hWnd) ? DxWndStatus.hWnd : find_main_window(DxWndStatus.dwPid);
::PostMessage(TargethWnd, WM_SYSCOMMAND, message, 0);
}
}
void CDxwndhostView::OnWindowMinimize()
{
SendMessageToHookedWin(SC_MINIMIZE);
}
void CDxwndhostView::OnWindowRestore()
{
DXWNDSTATUS DxWndStatus;
if ((GetHookStatus(&DxWndStatus) == DXW_RUNNING) && (DxWndStatus.hWnd!=NULL))
//::PostMessage(DxWndStatus.hWnd, WM_SYSCOMMAND, SC_RESTORE, 0);
::PostMessage(find_main_window(DxWndStatus.dwPid), WM_SYSCOMMAND, SC_RESTORE, 0);
SendMessageToHookedWin(SC_RESTORE);
}
void CDxwndhostView::OnWindowClose()
{
DXWNDSTATUS DxWndStatus;
if ((GetHookStatus(&DxWndStatus) == DXW_RUNNING) && (DxWndStatus.hWnd!=NULL))
//::PostMessage(DxWndStatus.hWnd, WM_SYSCOMMAND, SC_CLOSE, 0);
::PostMessage(find_main_window(DxWndStatus.dwPid), WM_SYSCOMMAND, SC_CLOSE, 0);
SendMessageToHookedWin(SC_CLOSE);
}
void CDxwndhostView::OnTaskbarHide()
@ -2211,6 +2264,13 @@ void CDxwndhostView::OnViewPalette()
pDlg->ShowWindow(SW_SHOW);
}
void CDxwndhostView::OnGlobalSettings()
{
CGlobalSettings *pDlg = new CGlobalSettings();
BOOL ret = pDlg->Create(CGlobalSettings::IDD, this);
pDlg->ShowWindow(SW_SHOW);
}
void CDxwndhostView::OnViewTimeSlider()
{
CTimeSliderDialog *pDlg = new CTimeSliderDialog();
@ -2401,7 +2461,7 @@ DWORD WINAPI StartDebug(void *p)
(strlen(ThInfo->PM->launchpath)>0) ? ThInfo->PM->launchpath : ThInfo->TM->path,
0, 0, false, DEBUG_PROCESS|DEBUG_ONLY_THIS_PROCESS, NULL, path, &sinfo, &pinfo)){
sprintf(DebugMessage, "CREATE PROCESS error=%d", GetLastError());
MessageBoxEx(0, DebugMessage, "ERROR", MB_YESNO | MB_ICONQUESTION, NULL);
MessageBoxEx(0, DebugMessage, "ERROR", MB_ICONEXCLAMATION|MB_OK, NULL);
}
CString strEventMessage;
@ -2421,7 +2481,7 @@ DWORD WINAPI StartDebug(void *p)
if(!Inject(pinfo.dwProcessId, path)){
// DXW_STRING_INJECTION
sprintf(DebugMessage,"Injection error: pid=%x dll=%s", pinfo.dwProcessId, path);
MessageBoxEx(0, DebugMessage, "Injection", MB_ICONEXCLAMATION, NULL);
MessageBoxEx(0, DebugMessage, "Injection", MB_ICONEXCLAMATION|MB_OK, NULL);
}
#ifdef LOCKINJECTIONTHREADS
extern LPVOID GetThreadStartAddress(HANDLE);
@ -2434,11 +2494,11 @@ DWORD WINAPI StartDebug(void *p)
if(StartAddress){
if(!ReadProcessMemory(pinfo.hProcess, StartAddress, &StartingCode, 4, &BytesCount)){
sprintf(DebugMessage,"ReadProcessMemory error=%d", GetLastError());
MessageBoxEx(0, DebugMessage, "Injection", MB_ICONEXCLAMATION, NULL);
MessageBoxEx(0, DebugMessage, "Injection", MB_ICONEXCLAMATION|MB_OK, NULL);
}
if(!WriteProcessMemory(pinfo.hProcess, StartAddress, &EndlessLoop, 4, &BytesCount)){
sprintf(DebugMessage,"WriteProcessMemory error=%d", GetLastError());
MessageBoxEx(0, DebugMessage, "Injection", MB_ICONEXCLAMATION, NULL);
MessageBoxEx(0, DebugMessage, "Injection", MB_ICONEXCLAMATION|MB_OK, NULL);
}
}
}
@ -2455,7 +2515,7 @@ DWORD WINAPI StartDebug(void *p)
if(TargetHandle && StartAddress){
if(!WriteProcessMemory(pinfo.hProcess, StartAddress, &StartingCode, 4, &BytesCount)){
sprintf(DebugMessage,"WriteProcessMemory error=%d", GetLastError());
MessageBoxEx(0, DebugMessage, "Injection", MB_ICONEXCLAMATION, NULL);
MessageBoxEx(0, DebugMessage, "Injection", MB_ICONEXCLAMATION|MB_OK, NULL);
}
}
if(TargetHandle) CloseHandle((HANDLE)TargetHandle);

View File

@ -15,6 +15,7 @@ class CDxwndhostView : public CListView
{
protected: // Create from serialization only features.
CDxwndhostView();
afx_msg void OnHotKey(UINT, UINT, UINT);
DECLARE_DYNCREATE(CDxwndhostView)
BOOL isUpdated;
void SaveConfigFile();
@ -43,6 +44,7 @@ public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void OnInitialUpdate(); // Called once after the initial construction.
void UpdateHotKeys();
//}}AFX_VIRTUAL
// Implementation
@ -76,6 +78,7 @@ protected:
afx_msg void OnTaskbarHide();
afx_msg void OnTaskbarShow();
afx_msg void OnSort();
afx_msg void OnGlobalSettings();
afx_msg void OnViewLog();
afx_msg void OnDeleteLog();
afx_msg void OnDebugView();

Binary file not shown.

BIN
host/res/alt-ctrl-shift.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
host/res/alt.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.