mirror of
https://github.com/DxWnd/DxWnd.reloaded
synced 2024-12-30 09:25:35 +01:00
v2_02_22_src
Former-commit-id: 710973bdebd0677d74039bdf1682d4fce759af64
This commit is contained in:
parent
68d6b7317c
commit
03b1052ffe
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -1,301 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// File: D3D10_1Shader.h
|
||||
// Content: D3D10.1 Shader Types and APIs
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __D3D10_1SHADER_H__
|
||||
#define __D3D10_1SHADER_H__
|
||||
|
||||
#include "d3d10shader.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Shader debugging structures
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum _D3D10_SHADER_DEBUG_REGTYPE
|
||||
{
|
||||
D3D10_SHADER_DEBUG_REG_INPUT,
|
||||
D3D10_SHADER_DEBUG_REG_OUTPUT,
|
||||
D3D10_SHADER_DEBUG_REG_CBUFFER,
|
||||
D3D10_SHADER_DEBUG_REG_TBUFFER,
|
||||
D3D10_SHADER_DEBUG_REG_TEMP,
|
||||
D3D10_SHADER_DEBUG_REG_TEMPARRAY,
|
||||
D3D10_SHADER_DEBUG_REG_TEXTURE,
|
||||
D3D10_SHADER_DEBUG_REG_SAMPLER,
|
||||
D3D10_SHADER_DEBUG_REG_IMMEDIATECBUFFER,
|
||||
D3D10_SHADER_DEBUG_REG_LITERAL,
|
||||
D3D10_SHADER_DEBUG_REG_UNUSED,
|
||||
D3D11_SHADER_DEBUG_REG_INTERFACE_POINTERS,
|
||||
D3D11_SHADER_DEBUG_REG_UAV,
|
||||
D3D10_SHADER_DEBUG_REG_FORCE_DWORD = 0x7fffffff,
|
||||
} D3D10_SHADER_DEBUG_REGTYPE;
|
||||
|
||||
typedef enum _D3D10_SHADER_DEBUG_SCOPETYPE
|
||||
{
|
||||
D3D10_SHADER_DEBUG_SCOPE_GLOBAL,
|
||||
D3D10_SHADER_DEBUG_SCOPE_BLOCK,
|
||||
D3D10_SHADER_DEBUG_SCOPE_FORLOOP,
|
||||
D3D10_SHADER_DEBUG_SCOPE_STRUCT,
|
||||
D3D10_SHADER_DEBUG_SCOPE_FUNC_PARAMS,
|
||||
D3D10_SHADER_DEBUG_SCOPE_STATEBLOCK,
|
||||
D3D10_SHADER_DEBUG_SCOPE_NAMESPACE,
|
||||
D3D10_SHADER_DEBUG_SCOPE_ANNOTATION,
|
||||
D3D10_SHADER_DEBUG_SCOPE_FORCE_DWORD = 0x7fffffff,
|
||||
} D3D10_SHADER_DEBUG_SCOPETYPE;
|
||||
|
||||
typedef enum _D3D10_SHADER_DEBUG_VARTYPE
|
||||
{
|
||||
D3D10_SHADER_DEBUG_VAR_VARIABLE,
|
||||
D3D10_SHADER_DEBUG_VAR_FUNCTION,
|
||||
D3D10_SHADER_DEBUG_VAR_FORCE_DWORD = 0x7fffffff,
|
||||
} D3D10_SHADER_DEBUG_VARTYPE;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// These are the serialized structures that get written to the file
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_TOKEN_INFO
|
||||
{
|
||||
UINT File; // offset into file list
|
||||
UINT Line; // line #
|
||||
UINT Column; // column #
|
||||
|
||||
UINT TokenLength;
|
||||
UINT TokenId; // offset to LPCSTR of length TokenLength in string datastore
|
||||
} D3D10_SHADER_DEBUG_TOKEN_INFO;
|
||||
|
||||
// Variable list
|
||||
typedef struct _D3D10_SHADER_DEBUG_VAR_INFO
|
||||
{
|
||||
// Index into token list for declaring identifier
|
||||
UINT TokenId;
|
||||
D3D10_SHADER_VARIABLE_TYPE Type;
|
||||
// register and component for this variable, only valid/necessary for arrays
|
||||
UINT Register;
|
||||
UINT Component;
|
||||
// gives the original variable that declared this variable
|
||||
UINT ScopeVar;
|
||||
// this variable's offset in its ScopeVar
|
||||
UINT ScopeVarOffset;
|
||||
} D3D10_SHADER_DEBUG_VAR_INFO;
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_INPUT_INFO
|
||||
{
|
||||
// index into array of variables of variable to initialize
|
||||
UINT Var;
|
||||
// input, cbuffer, tbuffer
|
||||
D3D10_SHADER_DEBUG_REGTYPE InitialRegisterSet;
|
||||
// set to cbuffer or tbuffer slot, geometry shader input primitive #,
|
||||
// identifying register for indexable temp, or -1
|
||||
UINT InitialBank;
|
||||
// -1 if temp, otherwise gives register in register set
|
||||
UINT InitialRegister;
|
||||
// -1 if temp, otherwise gives component
|
||||
UINT InitialComponent;
|
||||
// initial value if literal
|
||||
UINT InitialValue;
|
||||
} D3D10_SHADER_DEBUG_INPUT_INFO;
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_SCOPEVAR_INFO
|
||||
{
|
||||
// Index into variable token
|
||||
UINT TokenId;
|
||||
|
||||
D3D10_SHADER_DEBUG_VARTYPE VarType; // variable or function (different namespaces)
|
||||
D3D10_SHADER_VARIABLE_CLASS Class;
|
||||
UINT Rows; // number of rows (matrices)
|
||||
UINT Columns; // number of columns (vectors and matrices)
|
||||
|
||||
// In an array of structures, one struct member scope is provided, and
|
||||
// you'll have to add the array stride times the index to the variable
|
||||
// index you find, then find that variable in this structure's list of
|
||||
// variables.
|
||||
|
||||
// gives a scope to look up struct members. -1 if not a struct
|
||||
UINT StructMemberScope;
|
||||
|
||||
// number of array indices
|
||||
UINT uArrayIndices; // a[3][2][1] has 3 indices
|
||||
// maximum array index for each index
|
||||
// offset to UINT[uArrayIndices] in UINT datastore
|
||||
UINT ArrayElements; // a[3][2][1] has {3, 2, 1}
|
||||
// how many variables each array index moves
|
||||
// offset to UINT[uArrayIndices] in UINT datastore
|
||||
UINT ArrayStrides; // a[3][2][1] has {2, 1, 1}
|
||||
|
||||
UINT uVariables;
|
||||
// index of the first variable, later variables are offsets from this one
|
||||
UINT uFirstVariable;
|
||||
} D3D10_SHADER_DEBUG_SCOPEVAR_INFO;
|
||||
|
||||
// scope data, this maps variable names to debug variables (useful for the watch window)
|
||||
typedef struct _D3D10_SHADER_DEBUG_SCOPE_INFO
|
||||
{
|
||||
D3D10_SHADER_DEBUG_SCOPETYPE ScopeType;
|
||||
UINT Name; // offset to name of scope in strings list
|
||||
UINT uNameLen; // length of name string
|
||||
UINT uVariables;
|
||||
UINT VariableData; // Offset to UINT[uVariables] indexing the Scope Variable list
|
||||
} D3D10_SHADER_DEBUG_SCOPE_INFO;
|
||||
|
||||
// instruction outputs
|
||||
typedef struct _D3D10_SHADER_DEBUG_OUTPUTVAR
|
||||
{
|
||||
// index variable being written to, if -1 it's not going to a variable
|
||||
UINT Var;
|
||||
// range data that the compiler expects to be true
|
||||
UINT uValueMin, uValueMax;
|
||||
INT iValueMin, iValueMax;
|
||||
FLOAT fValueMin, fValueMax;
|
||||
|
||||
BOOL bNaNPossible, bInfPossible;
|
||||
} D3D10_SHADER_DEBUG_OUTPUTVAR;
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_OUTPUTREG_INFO
|
||||
{
|
||||
// Only temp, indexable temp, and output are valid here
|
||||
D3D10_SHADER_DEBUG_REGTYPE OutputRegisterSet;
|
||||
// -1 means no output
|
||||
UINT OutputReg;
|
||||
// if a temp array, identifier for which one
|
||||
UINT TempArrayReg;
|
||||
// -1 means masked out
|
||||
UINT OutputComponents[4];
|
||||
D3D10_SHADER_DEBUG_OUTPUTVAR OutputVars[4];
|
||||
// when indexing the output, get the value of this register, then add
|
||||
// that to uOutputReg. If uIndexReg is -1, then there is no index.
|
||||
// find the variable whose register is the sum (by looking in the ScopeVar)
|
||||
// and component matches, then set it. This should only happen for indexable
|
||||
// temps and outputs.
|
||||
UINT IndexReg;
|
||||
UINT IndexComp;
|
||||
} D3D10_SHADER_DEBUG_OUTPUTREG_INFO;
|
||||
|
||||
// per instruction data
|
||||
typedef struct _D3D10_SHADER_DEBUG_INST_INFO
|
||||
{
|
||||
UINT Id; // Which instruction this is in the bytecode
|
||||
UINT Opcode; // instruction type
|
||||
|
||||
// 0, 1, or 2
|
||||
UINT uOutputs;
|
||||
|
||||
// up to two outputs per instruction
|
||||
D3D10_SHADER_DEBUG_OUTPUTREG_INFO pOutputs[2];
|
||||
|
||||
// index into the list of tokens for this instruction's token
|
||||
UINT TokenId;
|
||||
|
||||
// how many function calls deep this instruction is
|
||||
UINT NestingLevel;
|
||||
|
||||
// list of scopes from outer-most to inner-most
|
||||
// Number of scopes
|
||||
UINT Scopes;
|
||||
UINT ScopeInfo; // Offset to UINT[uScopes] specifying indices of the ScopeInfo Array
|
||||
|
||||
// list of variables accessed by this instruction
|
||||
// Number of variables
|
||||
UINT AccessedVars;
|
||||
UINT AccessedVarsInfo; // Offset to UINT[AccessedVars] specifying indices of the ScopeVariableInfo Array
|
||||
} D3D10_SHADER_DEBUG_INST_INFO;
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_FILE_INFO
|
||||
{
|
||||
UINT FileName; // Offset to LPCSTR for file name
|
||||
UINT FileNameLen; // Length of file name
|
||||
UINT FileData; // Offset to LPCSTR of length FileLen
|
||||
UINT FileLen; // Length of file
|
||||
} D3D10_SHADER_DEBUG_FILE_INFO;
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_INFO
|
||||
{
|
||||
UINT Size; // sizeof(D3D10_SHADER_DEBUG_INFO)
|
||||
UINT Creator; // Offset to LPCSTR for compiler version
|
||||
UINT EntrypointName; // Offset to LPCSTR for Entry point name
|
||||
UINT ShaderTarget; // Offset to LPCSTR for shader target
|
||||
UINT CompileFlags; // flags used to compile
|
||||
UINT Files; // number of included files
|
||||
UINT FileInfo; // Offset to D3D10_SHADER_DEBUG_FILE_INFO[Files]
|
||||
UINT Instructions; // number of instructions
|
||||
UINT InstructionInfo; // Offset to D3D10_SHADER_DEBUG_INST_INFO[Instructions]
|
||||
UINT Variables; // number of variables
|
||||
UINT VariableInfo; // Offset to D3D10_SHADER_DEBUG_VAR_INFO[Variables]
|
||||
UINT InputVariables; // number of variables to initialize before running
|
||||
UINT InputVariableInfo; // Offset to D3D10_SHADER_DEBUG_INPUT_INFO[InputVariables]
|
||||
UINT Tokens; // number of tokens to initialize
|
||||
UINT TokenInfo; // Offset to D3D10_SHADER_DEBUG_TOKEN_INFO[Tokens]
|
||||
UINT Scopes; // number of scopes
|
||||
UINT ScopeInfo; // Offset to D3D10_SHADER_DEBUG_SCOPE_INFO[Scopes]
|
||||
UINT ScopeVariables; // number of variables declared
|
||||
UINT ScopeVariableInfo; // Offset to D3D10_SHADER_DEBUG_SCOPEVAR_INFO[Scopes]
|
||||
UINT UintOffset; // Offset to the UINT datastore, all UINT offsets are from this offset
|
||||
UINT StringOffset; // Offset to the string datastore, all string offsets are from this offset
|
||||
} D3D10_SHADER_DEBUG_INFO;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// ID3D10ShaderReflection1:
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Interface definitions
|
||||
//
|
||||
|
||||
typedef interface ID3D10ShaderReflection1 ID3D10ShaderReflection1;
|
||||
typedef interface ID3D10ShaderReflection1 *LPD3D10SHADERREFLECTION1;
|
||||
|
||||
// {C3457783-A846-47CE-9520-CEA6F66E7447}
|
||||
DEFINE_GUID(IID_ID3D10ShaderReflection1,
|
||||
0xc3457783, 0xa846, 0x47ce, 0x95, 0x20, 0xce, 0xa6, 0xf6, 0x6e, 0x74, 0x47);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D10ShaderReflection1
|
||||
|
||||
DECLARE_INTERFACE_(ID3D10ShaderReflection1, IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDescByName)(THIS_ LPCSTR Name, D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD(GetMovInstructionCount)(THIS_ UINT* pCount) PURE;
|
||||
STDMETHOD(GetMovcInstructionCount)(THIS_ UINT* pCount) PURE;
|
||||
STDMETHOD(GetConversionInstructionCount)(THIS_ UINT* pCount) PURE;
|
||||
STDMETHOD(GetBitwiseInstructionCount)(THIS_ UINT* pCount) PURE;
|
||||
|
||||
STDMETHOD(GetGSInputPrimitive)(THIS_ D3D10_PRIMITIVE* pPrim) PURE;
|
||||
STDMETHOD(IsLevel9Shader)(THIS_ BOOL* pbLevel9Shader) PURE;
|
||||
STDMETHOD(IsSampleFrequencyShader)(THIS_ BOOL* pbSampleFrequency) PURE;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// APIs //////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif //__D3D10_1SHADER_H__
|
||||
|
317
Include/TlHelp32.h
Normal file
317
Include/TlHelp32.h
Normal file
@ -0,0 +1,317 @@
|
||||
/*****************************************************************************\
|
||||
* *
|
||||
* tlhelp32.h - WIN32 tool help functions, types, and definitions *
|
||||
* *
|
||||
* Version 1.0 *
|
||||
* *
|
||||
* NOTE: windows.h/winbase.h must be #included first *
|
||||
* *
|
||||
* Copyright (c) Microsoft Corp. All rights reserved. *
|
||||
* *
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifndef _INC_TOOLHELP32
|
||||
#define _INC_TOOLHELP32
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Assume C declarations for C++ */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define MAX_MODULE_NAME32 255
|
||||
|
||||
/****** Shapshot function **********************************************/
|
||||
|
||||
HANDLE
|
||||
WINAPI
|
||||
CreateToolhelp32Snapshot(
|
||||
DWORD dwFlags,
|
||||
DWORD th32ProcessID
|
||||
);
|
||||
|
||||
//
|
||||
// The th32ProcessID argument is only used if TH32CS_SNAPHEAPLIST or
|
||||
// TH32CS_SNAPMODULE is specified. th32ProcessID == 0 means the current
|
||||
// process.
|
||||
//
|
||||
// NOTE that all of the snapshots are global except for the heap and module
|
||||
// lists which are process specific. To enumerate the heap or module
|
||||
// state for all WIN32 processes call with TH32CS_SNAPALL and the
|
||||
// current process. Then for each process in the TH32CS_SNAPPROCESS
|
||||
// list that isn't the current process, do a call with just
|
||||
// TH32CS_SNAPHEAPLIST and/or TH32CS_SNAPMODULE.
|
||||
//
|
||||
// dwFlags
|
||||
//
|
||||
#define TH32CS_SNAPHEAPLIST 0x00000001
|
||||
#define TH32CS_SNAPPROCESS 0x00000002
|
||||
#define TH32CS_SNAPTHREAD 0x00000004
|
||||
#define TH32CS_SNAPMODULE 0x00000008
|
||||
#define TH32CS_SNAPMODULE32 0x00000010
|
||||
#define TH32CS_SNAPALL (TH32CS_SNAPHEAPLIST | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD | TH32CS_SNAPMODULE)
|
||||
#define TH32CS_INHERIT 0x80000000
|
||||
//
|
||||
// Use CloseHandle to destroy the snapshot
|
||||
//
|
||||
|
||||
/****** heap walking ***************************************************/
|
||||
|
||||
typedef struct tagHEAPLIST32
|
||||
{
|
||||
SIZE_T dwSize;
|
||||
DWORD th32ProcessID; // owning process
|
||||
ULONG_PTR th32HeapID; // heap (in owning process's context!)
|
||||
DWORD dwFlags;
|
||||
} HEAPLIST32;
|
||||
typedef HEAPLIST32 * PHEAPLIST32;
|
||||
typedef HEAPLIST32 * LPHEAPLIST32;
|
||||
//
|
||||
// dwFlags
|
||||
//
|
||||
#define HF32_DEFAULT 1 // process's default heap
|
||||
#define HF32_SHARED 2 // is shared heap
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Heap32ListFirst(
|
||||
HANDLE hSnapshot,
|
||||
LPHEAPLIST32 lphl
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Heap32ListNext(
|
||||
HANDLE hSnapshot,
|
||||
LPHEAPLIST32 lphl
|
||||
);
|
||||
|
||||
typedef struct tagHEAPENTRY32
|
||||
{
|
||||
SIZE_T dwSize;
|
||||
HANDLE hHandle; // Handle of this heap block
|
||||
ULONG_PTR dwAddress; // Linear address of start of block
|
||||
SIZE_T dwBlockSize; // Size of block in bytes
|
||||
DWORD dwFlags;
|
||||
DWORD dwLockCount;
|
||||
DWORD dwResvd;
|
||||
DWORD th32ProcessID; // owning process
|
||||
ULONG_PTR th32HeapID; // heap block is in
|
||||
} HEAPENTRY32;
|
||||
typedef HEAPENTRY32 * PHEAPENTRY32;
|
||||
typedef HEAPENTRY32 * LPHEAPENTRY32;
|
||||
//
|
||||
// dwFlags
|
||||
//
|
||||
#define LF32_FIXED 0x00000001
|
||||
#define LF32_FREE 0x00000002
|
||||
#define LF32_MOVEABLE 0x00000004
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Heap32First(
|
||||
LPHEAPENTRY32 lphe,
|
||||
DWORD th32ProcessID,
|
||||
ULONG_PTR th32HeapID
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Heap32Next(
|
||||
LPHEAPENTRY32 lphe
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Toolhelp32ReadProcessMemory(
|
||||
DWORD th32ProcessID,
|
||||
LPCVOID lpBaseAddress,
|
||||
LPVOID lpBuffer,
|
||||
SIZE_T cbRead,
|
||||
SIZE_T *lpNumberOfBytesRead
|
||||
);
|
||||
|
||||
/***** Process walking *************************************************/
|
||||
|
||||
typedef struct tagPROCESSENTRY32W
|
||||
{
|
||||
DWORD dwSize;
|
||||
DWORD cntUsage;
|
||||
DWORD th32ProcessID; // this process
|
||||
ULONG_PTR th32DefaultHeapID;
|
||||
DWORD th32ModuleID; // associated exe
|
||||
DWORD cntThreads;
|
||||
DWORD th32ParentProcessID; // this process's parent process
|
||||
LONG pcPriClassBase; // Base priority of process's threads
|
||||
DWORD dwFlags;
|
||||
WCHAR szExeFile[MAX_PATH]; // Path
|
||||
} PROCESSENTRY32W;
|
||||
typedef PROCESSENTRY32W * PPROCESSENTRY32W;
|
||||
typedef PROCESSENTRY32W * LPPROCESSENTRY32W;
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Process32FirstW(
|
||||
HANDLE hSnapshot,
|
||||
LPPROCESSENTRY32W lppe
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Process32NextW(
|
||||
HANDLE hSnapshot,
|
||||
LPPROCESSENTRY32W lppe
|
||||
);
|
||||
|
||||
typedef struct tagPROCESSENTRY32
|
||||
{
|
||||
DWORD dwSize;
|
||||
DWORD cntUsage;
|
||||
DWORD th32ProcessID; // this process
|
||||
ULONG_PTR th32DefaultHeapID;
|
||||
DWORD th32ModuleID; // associated exe
|
||||
DWORD cntThreads;
|
||||
DWORD th32ParentProcessID; // this process's parent process
|
||||
LONG pcPriClassBase; // Base priority of process's threads
|
||||
DWORD dwFlags;
|
||||
CHAR szExeFile[MAX_PATH]; // Path
|
||||
} PROCESSENTRY32;
|
||||
typedef PROCESSENTRY32 * PPROCESSENTRY32;
|
||||
typedef PROCESSENTRY32 * LPPROCESSENTRY32;
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Process32First(
|
||||
HANDLE hSnapshot,
|
||||
LPPROCESSENTRY32 lppe
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Process32Next(
|
||||
HANDLE hSnapshot,
|
||||
LPPROCESSENTRY32 lppe
|
||||
);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define Process32First Process32FirstW
|
||||
#define Process32Next Process32NextW
|
||||
#define PROCESSENTRY32 PROCESSENTRY32W
|
||||
#define PPROCESSENTRY32 PPROCESSENTRY32W
|
||||
#define LPPROCESSENTRY32 LPPROCESSENTRY32W
|
||||
#endif // !UNICODE
|
||||
|
||||
/***** Thread walking **************************************************/
|
||||
|
||||
typedef struct tagTHREADENTRY32
|
||||
{
|
||||
DWORD dwSize;
|
||||
DWORD cntUsage;
|
||||
DWORD th32ThreadID; // this thread
|
||||
DWORD th32OwnerProcessID; // Process this thread is associated with
|
||||
LONG tpBasePri;
|
||||
LONG tpDeltaPri;
|
||||
DWORD dwFlags;
|
||||
} THREADENTRY32;
|
||||
typedef THREADENTRY32 * PTHREADENTRY32;
|
||||
typedef THREADENTRY32 * LPTHREADENTRY32;
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Thread32First(
|
||||
HANDLE hSnapshot,
|
||||
LPTHREADENTRY32 lpte
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Thread32Next(
|
||||
HANDLE hSnapshot,
|
||||
LPTHREADENTRY32 lpte
|
||||
);
|
||||
|
||||
/***** Module walking *************************************************/
|
||||
|
||||
typedef struct tagMODULEENTRY32W
|
||||
{
|
||||
DWORD dwSize;
|
||||
DWORD th32ModuleID; // This module
|
||||
DWORD th32ProcessID; // owning process
|
||||
DWORD GlblcntUsage; // Global usage count on the module
|
||||
DWORD ProccntUsage; // Module usage count in th32ProcessID's context
|
||||
BYTE * modBaseAddr; // Base address of module in th32ProcessID's context
|
||||
DWORD modBaseSize; // Size in bytes of module starting at modBaseAddr
|
||||
HMODULE hModule; // The hModule of this module in th32ProcessID's context
|
||||
WCHAR szModule[MAX_MODULE_NAME32 + 1];
|
||||
WCHAR szExePath[MAX_PATH];
|
||||
} MODULEENTRY32W;
|
||||
typedef MODULEENTRY32W * PMODULEENTRY32W;
|
||||
typedef MODULEENTRY32W * LPMODULEENTRY32W;
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Module32FirstW(
|
||||
HANDLE hSnapshot,
|
||||
LPMODULEENTRY32W lpme
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Module32NextW(
|
||||
HANDLE hSnapshot,
|
||||
LPMODULEENTRY32W lpme
|
||||
);
|
||||
|
||||
|
||||
typedef struct tagMODULEENTRY32
|
||||
{
|
||||
DWORD dwSize;
|
||||
DWORD th32ModuleID; // This module
|
||||
DWORD th32ProcessID; // owning process
|
||||
DWORD GlblcntUsage; // Global usage count on the module
|
||||
DWORD ProccntUsage; // Module usage count in th32ProcessID's context
|
||||
BYTE * modBaseAddr; // Base address of module in th32ProcessID's context
|
||||
DWORD modBaseSize; // Size in bytes of module starting at modBaseAddr
|
||||
HMODULE hModule; // The hModule of this module in th32ProcessID's context
|
||||
char szModule[MAX_MODULE_NAME32 + 1];
|
||||
char szExePath[MAX_PATH];
|
||||
} MODULEENTRY32;
|
||||
typedef MODULEENTRY32 * PMODULEENTRY32;
|
||||
typedef MODULEENTRY32 * LPMODULEENTRY32;
|
||||
|
||||
//
|
||||
// NOTE CAREFULLY that the modBaseAddr and hModule fields are valid ONLY
|
||||
// in th32ProcessID's process context.
|
||||
//
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Module32First(
|
||||
HANDLE hSnapshot,
|
||||
LPMODULEENTRY32 lpme
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Module32Next(
|
||||
HANDLE hSnapshot,
|
||||
LPMODULEENTRY32 lpme
|
||||
);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define Module32First Module32FirstW
|
||||
#define Module32Next Module32NextW
|
||||
#define MODULEENTRY32 MODULEENTRY32W
|
||||
#define PMODULEENTRY32 PMODULEENTRY32W
|
||||
#define LPMODULEENTRY32 LPMODULEENTRY32W
|
||||
#endif // !UNICODE
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _INC_TOOLHELP32
|
||||
|
2045
Include/d3d9.wine.h
Normal file
2045
Include/d3d9.wine.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -82,6 +82,8 @@
|
||||
#define MARKBLIT 0x00000002 // higlights the blit to primary surface operation by surroundig the rect in color
|
||||
#define HOOKDLLS 0x00000004 // Hook all DLLs referenced in PE
|
||||
#define SUPPRESSD3DEXT 0x00000008 // Disables extended d3d APIs for Vista/Win7/Win8 platforms
|
||||
#define HOOKENABLED 0x00000010 // Enables task hooking
|
||||
#define FIXD3DFRAME 0x00000020 // Preserve windows frame in D3D9 programs
|
||||
|
||||
// logging Tflags DWORD:
|
||||
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general
|
||||
@ -104,6 +106,7 @@ typedef struct TARGETMAP
|
||||
char module[60+1];
|
||||
char OpenGLLib[20+1];
|
||||
int dxversion;
|
||||
int coordinates;
|
||||
int flags;
|
||||
int flags2;
|
||||
int flags3;
|
||||
@ -180,4 +183,8 @@ LRESULT CALLBACK extWindowProc(HWND, UINT, WPARAM, LPARAM);
|
||||
extern void WhndStackPush(HWND, WNDPROC);
|
||||
extern WNDPROC WhndGetWindowProc(HWND );
|
||||
|
||||
|
||||
typedef enum {
|
||||
DXW_SET_COORDINATES = 0,
|
||||
DXW_DESKTOP_WORKAREA,
|
||||
DXW_DESKTOP_CENTER
|
||||
} Coordinates_Types;
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3ab8190eadcff243a68b15f1b95a1ae8a260ec90013a73ba149322adc1786dfd
|
||||
size 340992
|
||||
oid sha256:8c93bb6e4097da150e945750f0b04e1b4b490868251332a3ea2451fb5338cf60
|
||||
size 341504
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b5a29f58873b15c65c45cc3216847b5bd94c4c6a382ad62f717087cb69e8406e
|
||||
size 503296
|
||||
oid sha256:0995a55f7547535590183f7287c7b511fcb4ee2203a39f6e8414afce2a0af15f
|
||||
size 520192
|
||||
|
5484
build/dxwnd.ini
5484
build/dxwnd.ini
File diff suppressed because it is too large
Load Diff
BIN
build/dxwnd_manual.pdf
Normal file
BIN
build/dxwnd_manual.pdf
Normal file
Binary file not shown.
@ -120,3 +120,12 @@ Some code rearrangement
|
||||
v2.02.21
|
||||
it's a w.i.p. release, wait 'till finished....
|
||||
|
||||
v2.02.22
|
||||
Major code rearrangement in API hooking. Expect some troubles...
|
||||
Added desktop workarea and centered coordinate settings
|
||||
Fixed imelib hooking
|
||||
Added HOOKENABLED flag
|
||||
Fixed ChangeDisplaySettings
|
||||
GUI: added ListView icons
|
||||
GUI: added pause command
|
||||
GUI: updated commands layout
|
||||
|
BIN
build/v2_02_22_build.rar
Normal file
BIN
build/v2_02_22_build.rar
Normal file
Binary file not shown.
@ -43,9 +43,7 @@ HRESULT HookDxDiag(REFIID riid, LPVOID FAR* ppv)
|
||||
OutTraceD("CoCreateInstance: CLSID_DxDiagProvider object\n");
|
||||
dxdlib=(*pLoadLibraryA)("dxdiagn.dll");
|
||||
OutTraceD("CoCreateInstance: dxdiagn lib handle=%x\n", dxdlib);
|
||||
extern void HookSysLibs(HMODULE);
|
||||
extern void HookModule(HMODULE, int);
|
||||
//HookSysLibs(dxdlib);
|
||||
HookModule(dxdlib, 0);
|
||||
|
||||
switch (*(DWORD *)&riid){
|
||||
|
@ -999,3 +999,44 @@ char *ExplainLoadLibFlags(DWORD c)
|
||||
else strcpy(eb,"NULL");
|
||||
return(eb);
|
||||
}
|
||||
|
||||
char *ExplainDevModeFields(DWORD c)
|
||||
{
|
||||
static char eb[512];
|
||||
unsigned int l;
|
||||
strcpy(eb,"DM_");
|
||||
if (c & DM_ORIENTATION) strcat(eb, "ORIENTATION+");
|
||||
if (c & DM_PAPERSIZE) strcat(eb, "PAPERSIZE+");
|
||||
if (c & DM_PAPERLENGTH) strcat(eb, "PAPERLENGTH+");
|
||||
if (c & DM_PAPERWIDTH) strcat(eb, "PAPERWIDTH+");
|
||||
if (c & DM_SCALE) strcat(eb, "SCALE+");
|
||||
if (c & DM_COPIES) strcat(eb, "COPIES+");
|
||||
if (c & DM_DEFAULTSOURCE) strcat(eb, "DEFAULTSOURCE+");
|
||||
if (c & DM_PRINTQUALITY) strcat(eb, "PRINTQUALITY+");
|
||||
if (c & DM_POSITION) strcat(eb, "POSITION+");
|
||||
if (c & DM_DISPLAYORIENTATION) strcat(eb, "DISPLAYORIENTATION+");
|
||||
if (c & DM_DISPLAYFIXEDOUTPUT) strcat(eb, "DISPLAYFIXEDOUTPUT+");
|
||||
if (c & DM_COLOR) strcat(eb, "COLOR+");
|
||||
if (c & DM_DUPLEX) strcat(eb, "DUPLEX+");
|
||||
if (c & DM_YRESOLUTION) strcat(eb, "YRESOLUTION+");
|
||||
if (c & DM_TTOPTION) strcat(eb, "TTOPTION+");
|
||||
if (c & DM_COLLATE) strcat(eb, "COLLATE+");
|
||||
if (c & DM_FORMNAME) strcat(eb, "FORMNAME+");
|
||||
if (c & DM_LOGPIXELS) strcat(eb, "LOGPIXELS+");
|
||||
if (c & DM_BITSPERPEL) strcat(eb, "BITSPERPEL+");
|
||||
if (c & DM_PELSWIDTH) strcat(eb, "PELSWIDTH+");
|
||||
if (c & DM_PELSHEIGHT) strcat(eb, "PELSHEIGHT+");
|
||||
if (c & DM_DISPLAYFLAGS) strcat(eb, "DISPLAYFLAGS+");
|
||||
if (c & DM_NUP) strcat(eb, "NUP+");
|
||||
if (c & DM_DISPLAYFREQUENCY) strcat(eb, "DISPLAYFREQUENCY+");
|
||||
if (c & DM_ICMMETHOD) strcat(eb, "ICMMETHOD+");
|
||||
if (c & DM_ICMINTENT) strcat(eb, "ICMINTENT+");
|
||||
if (c & DM_MEDIATYPE) strcat(eb, "MEDIATYPE+");
|
||||
if (c & DM_DITHERTYPE) strcat(eb, "DITHERTYPE+");
|
||||
if (c & DM_PANNINGWIDTH) strcat(eb, "PANNINGWIDTH+");
|
||||
if (c & DM_PANNINGHEIGHT) strcat(eb, "PANNINGHEIGHT+");
|
||||
l=strlen(eb);
|
||||
if (l>strlen("DM_")) eb[l-1]=0; // delete last '+' if any
|
||||
else strcpy(eb,"NULL");
|
||||
return(eb);
|
||||
}
|
||||
|
@ -29,4 +29,5 @@ extern char *ExplainNChitTest(DWORD);
|
||||
extern char *ExplainDDEnumerateFlags(DWORD);
|
||||
extern char *ExplainsSystemMetrics(DWORD);
|
||||
extern char *ExplainWPFlags(DWORD);
|
||||
extern char *ExplainLoadLibFlags(DWORD);
|
||||
extern char *ExplainLoadLibFlags(DWORD);
|
||||
extern char *ExplainDevModeFields(DWORD);
|
||||
|
231
dll/dxhook.cpp
231
dll/dxhook.cpp
@ -280,6 +280,7 @@ void SetHook(void *target, void *hookproc, void **hookedproc, char *hookname)
|
||||
static DWORD MinHook=0xFFFFFFFF;
|
||||
static DWORD MaxHook=0;
|
||||
|
||||
OutTraceB("SetHook: DEBUG target=%x, proc=%x name=%s\n", target, hookproc, hookname);
|
||||
// keep track of hooked call range to avoid re-hooking of hooked addresses !!!
|
||||
if ((DWORD)hookproc < MinHook) MinHook=(DWORD)hookproc;
|
||||
if ((DWORD)hookproc > MaxHook) MaxHook=(DWORD)hookproc;
|
||||
@ -316,6 +317,9 @@ void *HookAPI(HMODULE module, char *dll, void *apiproc, const char *apiname, voi
|
||||
DWORD oldprotect;
|
||||
void *org;
|
||||
|
||||
OutTraceB("HookAPI: module=%x dll=%s apiproc=%x apiname=%s hookproc=%x\n",
|
||||
module, dll, apiproc, apiname, hookproc);
|
||||
|
||||
if(!*apiname) { // check
|
||||
char *sMsg="HookAPI: NULL api name\n";
|
||||
OutTraceE(sMsg);
|
||||
@ -401,19 +405,55 @@ void *HookAPI(HMODULE module, char *dll, void *apiproc, const char *apiname, voi
|
||||
|
||||
void CalculateWindowPos(HWND hwnd, DWORD width, DWORD height, LPWINDOWPOS wp)
|
||||
{
|
||||
RECT rect;
|
||||
RECT rect, desktop, workarea;
|
||||
DWORD dwStyle;
|
||||
int MaxX, MaxY;
|
||||
HMENU hMenu;
|
||||
|
||||
rect.left = dxw.iPosX;
|
||||
rect.top = dxw.iPosY; //v2.02.09
|
||||
MaxX = dxw.iSizX;
|
||||
MaxY = dxw.iSizY;
|
||||
if (!MaxX) MaxX = width;
|
||||
if (!MaxY) MaxY = height;
|
||||
rect.right = dxw.iPosX+MaxX;
|
||||
rect.bottom = dxw.iPosY+MaxY; //v2.02.09
|
||||
switch(dxw.Coordinates){
|
||||
case DXW_DESKTOP_CENTER:
|
||||
MaxX = dxw.iSizX;
|
||||
MaxY = dxw.iSizY;
|
||||
if (!MaxX) MaxX = width;
|
||||
if (!MaxY) MaxY = height;
|
||||
//GetClientRect(0, &desktop);
|
||||
(*pGetClientRect)(GetDesktopWindow(), &desktop);
|
||||
rect.left = (desktop.right - MaxX) / 2;
|
||||
rect.top = (desktop.bottom - MaxY) / 2;
|
||||
rect.right = rect.left + MaxX;
|
||||
rect.bottom = rect.top + MaxY; //v2.02.09
|
||||
break;
|
||||
case DXW_DESKTOP_WORKAREA:
|
||||
SystemParametersInfo(SPI_GETWORKAREA, NULL, &workarea, 0);
|
||||
rect = workarea;
|
||||
if (dxw.dwFlags2 & KEEPASPECTRATIO) {
|
||||
int w, h, b; // width, height and border
|
||||
w = workarea.right - workarea.left;
|
||||
h = workarea.bottom - workarea.top;
|
||||
if ((w * 600) > (h * 800)){
|
||||
b = (w - (h * 800 / 600))/2;
|
||||
rect.left = workarea.left + b;
|
||||
rect.right = workarea.right - b;
|
||||
}
|
||||
else {
|
||||
b = (h - (w * 600 / 800))/2;
|
||||
rect.top = workarea.top + b;
|
||||
rect.bottom = workarea.bottom - b;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DXW_SET_COORDINATES:
|
||||
default:
|
||||
rect.left = dxw.iPosX;
|
||||
rect.top = dxw.iPosY; //v2.02.09
|
||||
MaxX = dxw.iSizX;
|
||||
MaxY = dxw.iSizY;
|
||||
if (!MaxX) MaxX = width;
|
||||
if (!MaxY) MaxY = height;
|
||||
rect.right = dxw.iPosX + MaxX;
|
||||
rect.bottom = dxw.iPosY + MaxY; //v2.02.09
|
||||
break;
|
||||
}
|
||||
|
||||
dwStyle=(*pGetWindowLong)(hwnd, GWL_STYLE);
|
||||
hMenu = GetMenu(hwnd);
|
||||
@ -455,16 +495,18 @@ void AdjustWindowFrame(HWND hwnd, DWORD width, DWORD height)
|
||||
|
||||
HRESULT res=0;
|
||||
WNDPROC pWindowProc;
|
||||
LONG style;
|
||||
|
||||
OutTraceD("AdjustWindowFrame hwnd=%x, size=(%d,%d)\n", hwnd, width, height);
|
||||
OutTraceD("AdjustWindowFrame hwnd=%x, size=(%d,%d) coord=%d\n", hwnd, width, height, dxw.Coordinates);
|
||||
|
||||
dxw.SetScreenSize(width, height);
|
||||
if (hwnd==NULL) return;
|
||||
|
||||
(*pSetWindowLong)(hwnd, GWL_STYLE, (dxw.dwFlags2 & MODALSTYLE) ? 0 : WS_OVERLAPPEDWINDOW);
|
||||
style = ((dxw.dwFlags2 & MODALSTYLE) || (dxw.Coordinates == DXW_DESKTOP_WORKAREA)) ? 0 : WS_OVERLAPPEDWINDOW;
|
||||
(*pSetWindowLong)(hwnd, GWL_STYLE, style);
|
||||
(*pSetWindowLong)(hwnd, GWL_EXSTYLE, 0);
|
||||
(*pShowWindow)(hwnd, SW_SHOWNORMAL);
|
||||
OutTraceD("AdjustWindowFrame hwnd=%x, set style=%s extstyle=0\n", hwnd, (dxw.dwFlags2 & MODALSTYLE) ? "0" : "WS_OVERLAPPEDWINDOW");
|
||||
OutTraceD("AdjustWindowFrame hwnd=%x, set style=%s extstyle=0\n", hwnd, (style == 0) ? "0" : "WS_OVERLAPPEDWINDOW");
|
||||
AdjustWindowPos(hwnd, width, height);
|
||||
|
||||
// fixing windows message handling procedure
|
||||
@ -1053,138 +1095,6 @@ void HookGDILib(HMODULE module)
|
||||
}
|
||||
}
|
||||
|
||||
void HookSysLibs(HMODULE module)
|
||||
{
|
||||
void *tmp;
|
||||
|
||||
OutTraceD("HookSysLibs module=%x\n", module);
|
||||
|
||||
tmp = HookAPI(module, "kernel32.dll", GetProcAddress, "GetProcAddress", extGetProcAddress);
|
||||
if(tmp) pGetProcAddress = (GetProcAddress_Type)tmp;
|
||||
tmp = HookAPI(module, "kernel32.dll", LoadLibraryA, "LoadLibraryA", extLoadLibraryA);
|
||||
if(tmp) pLoadLibraryA = (LoadLibraryA_Type)tmp;
|
||||
tmp = HookAPI(module, "kernel32.dll", LoadLibraryExA, "LoadLibraryExA", extLoadLibraryExA);
|
||||
if(tmp) pLoadLibraryExA = (LoadLibraryExA_Type)tmp;
|
||||
tmp = HookAPI(module, "kernel32.dll", LoadLibraryW, "LoadLibraryW", extLoadLibraryW);
|
||||
if(tmp) pLoadLibraryW = (LoadLibraryW_Type)tmp;
|
||||
tmp = HookAPI(module, "kernel32.dll", LoadLibraryExW, "LoadLibraryExW", extLoadLibraryExW);
|
||||
if(tmp) pLoadLibraryExW = (LoadLibraryExW_Type)tmp;
|
||||
|
||||
tmp = HookAPI(module, "user32.dll", BeginPaint, "BeginPaint", extBeginPaint);
|
||||
if(tmp) pBeginPaint = (BeginPaint_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", EndPaint, "EndPaint", extEndPaint);
|
||||
if(tmp) pEndPaint = (EndPaint_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", ShowCursor, "ShowCursor", extShowCursor);
|
||||
if(tmp) pShowCursor = (ShowCursor_Type)tmp;
|
||||
if(dxw.dwFlags1 & MAPGDITOPRIMARY){
|
||||
tmp = HookAPI(module, "user32.dll", GetDC, "GetDC", extDDGetDC);
|
||||
if(tmp) pGDIGetDC = (GDIGetDC_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", GetWindowDC, "GetWindowDC", extDDGetWindowDC);
|
||||
if(tmp) pGDIGetWindowDC = (GDIGetDC_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", ReleaseDC, "ReleaseDC", extDDReleaseDC);
|
||||
if(tmp) pGDIReleaseDC = (GDIReleaseDC_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", InvalidateRect, "InvalidateRect", extDDInvalidateRect);
|
||||
if(tmp) pInvalidateRect = (InvalidateRect_Type)tmp;
|
||||
}
|
||||
else{
|
||||
tmp = HookAPI(module, "user32.dll", GetDC, "GetDC", extGDIGetDC);
|
||||
if(tmp) pGDIGetDC = (GDIGetDC_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", GetWindowDC, "GetWindowDC", extGDIGetWindowDC);
|
||||
if(tmp) pGDIGetWindowDC = (GDIGetDC_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", ReleaseDC, "ReleaseDC", extGDIReleaseDC);
|
||||
if(tmp) pGDIReleaseDC = (GDIReleaseDC_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", InvalidateRect, "InvalidateRect", extInvalidateRect);
|
||||
if(tmp) pInvalidateRect = (InvalidateRect_Type)tmp;
|
||||
}
|
||||
|
||||
if (dxw.dwFlags1 & CLIENTREMAPPING){
|
||||
tmp = HookAPI(module, "user32.dll", ScreenToClient, "ScreenToClient", extScreenToClient);
|
||||
if(tmp) pScreenToClient = (ScreenToClient_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", ClientToScreen, "ClientToScreen", extClientToScreen);
|
||||
if(tmp) pClientToScreen = (ClientToScreen_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", GetClientRect, "GetClientRect", extGetClientRect);
|
||||
if(tmp) pGetClientRect = (GetClientRect_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", GetWindowRect, "GetWindowRect", extGetWindowRect);
|
||||
if(tmp) pGetWindowRect = (GetWindowRect_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", MapWindowPoints, "MapWindowPoints", extMapWindowPoints);
|
||||
if(tmp) pMapWindowPoints = (MapWindowPoints_Type)tmp;
|
||||
}
|
||||
|
||||
// get / change display settings
|
||||
tmp = HookAPI(module, "user32.dll", ChangeDisplaySettingsA, "ChangeDisplaySettingsA", extChangeDisplaySettings);
|
||||
if(tmp) pChangeDisplaySettings = (ChangeDisplaySettings_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", ChangeDisplaySettingsExA, "ChangeDisplaySettingsExA", extChangeDisplaySettingsEx);
|
||||
if(tmp) pChangeDisplaySettingsEx = (ChangeDisplaySettingsEx_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", EnumDisplaySettingsA, "EnumDisplaySettingsA", extEnumDisplaySettings);
|
||||
if(tmp) pEnumDisplaySettings = (EnumDisplaySettings_Type)tmp;
|
||||
|
||||
// handle cursor clipping
|
||||
tmp = HookAPI(module, "user32.dll", GetClipCursor, "GetClipCursor", extGetClipCursor);
|
||||
if(tmp) pGetClipCursor = (GetClipCursor_Type)tmp;
|
||||
|
||||
tmp = HookAPI(module, "user32.dll", ClipCursor, "ClipCursor", extClipCursor);
|
||||
if(tmp) pClipCursor = (ClipCursor_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", FillRect, "FillRect", extFillRect);
|
||||
if(tmp) pFillRect = (FillRect_Type)tmp;
|
||||
if (dxw.dwFlags1 & MESSAGEPROC) {
|
||||
tmp = HookAPI(module, "user32.dll", PeekMessageA, "PeekMessageA", extPeekMessage); // added for GPL
|
||||
if(tmp) pPeekMessage = (PeekMessage_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", GetMessageA, "GetMessageA", extGetMessage); // added for GPL
|
||||
if(tmp) pGetMessage = (GetMessage_Type)tmp;
|
||||
}
|
||||
tmp = HookAPI(module, "user32.dll", DefWindowProcA, "DefWindowProcA", extDefWindowProc); // added for WarWind background erase
|
||||
if(tmp) pDefWindowProc = (DefWindowProc_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", CreateWindowExA, "CreateWindowExA", extCreateWindowExA);
|
||||
if(tmp) pCreateWindowExA = (CreateWindowExA_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", RegisterClassExA, "RegisterClassExA", extRegisterClassExA);
|
||||
if(tmp) pRegisterClassExA = (RegisterClassExA_Type)tmp;
|
||||
if (dxw.dwFlags1 & (PREVENTMAXIMIZE|FIXWINFRAME|LOCKWINPOS|LOCKWINSTYLE)){
|
||||
tmp = HookAPI(module, "user32.dll", ShowWindow, "ShowWindow", extShowWindow);
|
||||
if(tmp) pShowWindow = (ShowWindow_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", SetWindowLongA, "SetWindowLongA", extSetWindowLong);
|
||||
if(tmp) pSetWindowLong = (SetWindowLong_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", GetWindowLongA, "GetWindowLongA", extGetWindowLong);
|
||||
if(tmp) pGetWindowLong = (GetWindowLong_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", SetWindowPos, "SetWindowPos", extSetWindowPos);
|
||||
if(tmp) pSetWindowPos = (SetWindowPos_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", DeferWindowPos, "DeferWindowPos", extDeferWindowPos);
|
||||
if(tmp) pGDIDeferWindowPos = (DeferWindowPos_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", CallWindowProcA, "CallWindowProcA", extCallWindowProc);
|
||||
if(tmp) pCallWindowProc = (CallWindowProc_Type)tmp;
|
||||
}
|
||||
tmp = HookAPI(module, "user32.dll", GetSystemMetrics, "GetSystemMetrics", extGetSystemMetrics);
|
||||
if(tmp) pGetSystemMetrics = (GetSystemMetrics_Type)tmp;
|
||||
|
||||
tmp = HookAPI(module, "user32.dll", GetDesktopWindow, "GetDesktopWindow", extGetDesktopWindow);
|
||||
if(tmp) pGetDesktopWindow = (GetDesktopWindow_Type)tmp;
|
||||
|
||||
if(dxw.dwFlags1 & MODIFYMOUSE){
|
||||
tmp = HookAPI(module, "user32.dll", GetCursorPos, "GetCursorPos", extGetCursorPos);
|
||||
if(tmp) pGetCursorPos = (GetCursorPos_Type)tmp;
|
||||
//tmp = HookAPI(module, "user32.dll", GetPhysicalCursorPos, "", extGetCursorPos);
|
||||
tmp = HookAPI(module, "user32.dll", SetCursor, "SetCursor", extSetCursor);
|
||||
if(tmp) pSetCursor = (SetCursor_Type)tmp;
|
||||
//tmp = HookAPI(module, "user32.dll", SetPhysicalCursorPos, "", extSetCursorPos);
|
||||
tmp = HookAPI(module, "user32.dll", SendMessageA, "SendMessageA", extSendMessage);
|
||||
if(tmp) pSendMessage = (SendMessage_Type)tmp;
|
||||
}
|
||||
|
||||
if((dxw.dwFlags1 & (MODIFYMOUSE|SLOWDOWN|KEEPCURSORWITHIN)) || (dxw.dwFlags2 & KEEPCURSORFIXED)){
|
||||
tmp = HookAPI(module, "user32.dll", SetCursorPos, "SetCursorPos", extSetCursorPos);
|
||||
if(tmp) pSetCursorPos = (SetCursorPos_Type)tmp;
|
||||
}
|
||||
|
||||
tmp = HookAPI(module, "user32.dll", CreateDialogIndirectParamA, "CreateDialogIndirectParamA", extCreateDialogIndirectParam);
|
||||
if(tmp) pCreateDialogIndirectParam = (CreateDialogIndirectParam_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", CreateDialogParamA, "CreateDialogParamA", extCreateDialogParam);
|
||||
if(tmp) pCreateDialogParam = (CreateDialogParam_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", MoveWindow, "MoveWindow", extMoveWindow);
|
||||
if(tmp) pMoveWindow = (MoveWindow_Type)tmp;
|
||||
|
||||
HookKernel32(module);
|
||||
return;
|
||||
}
|
||||
|
||||
static void RecoverScreenMode()
|
||||
{
|
||||
DEVMODE InitDevMode;
|
||||
@ -1281,13 +1191,15 @@ void HookExceptionHandler(void)
|
||||
|
||||
void HookModule(HMODULE base, int dxversion)
|
||||
{
|
||||
HookSysLibs(base);
|
||||
HookKernel32(base);
|
||||
HookUser32(base);
|
||||
HookWinMM(base);
|
||||
//if(dxw.dwFlags2 & SUPPRESSIME) HookImeLib(module);
|
||||
if(dxw.dwFlags2 & HOOKGDI) HookGDILib(base);
|
||||
if(dxw.dwFlags1 & HOOKDI) HookDirectInput(base, dxversion);
|
||||
HookDirectDraw(base, dxversion);
|
||||
HookDirect3D(base, dxversion);
|
||||
HookOle32(base, dxversion); // unfinished business
|
||||
HookOle32(base);
|
||||
if(dxw.dwFlags2 & HOOKOPENGL) HookOpenGLLibs(base, dxw.CustomOpenGLLib);
|
||||
HookMSV4WLibs(base);
|
||||
}
|
||||
@ -1440,3 +1352,30 @@ LPCSTR ProcToString(LPCSTR proc)
|
||||
else
|
||||
return proc;
|
||||
}
|
||||
|
||||
FARPROC RemapLibrary(LPCSTR proc, HMODULE hModule, HookEntry_Type *Hooks)
|
||||
{
|
||||
int i;
|
||||
HookEntry_Type *Hook;
|
||||
for(i=0; Hooks[i].APIName; i++){
|
||||
Hook=&Hooks[i];
|
||||
if (!strcmp(proc,Hook->APIName)){
|
||||
if (Hook->StoreAddress) *(Hook->StoreAddress)=(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), (Hook->StoreAddress) ? *(Hook->StoreAddress) : 0);
|
||||
return Hook->HookerAddress;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void HookLibrary(HMODULE hModule, HookEntry_Type *Hooks, char *DLLName)
|
||||
{
|
||||
int i;
|
||||
void *tmp;
|
||||
HookEntry_Type *Hook;
|
||||
for(i=0; Hooks[i].APIName; i++){
|
||||
Hook=&Hooks[i];
|
||||
tmp = HookAPI(hModule, DLLName, Hook->OriginalAddress, Hook->APIName, Hook->HookerAddress);
|
||||
if(tmp) *(Hook->StoreAddress) = (FARPROC)tmp;
|
||||
}
|
||||
}
|
||||
|
16
dll/dxhook.h
16
dll/dxhook.h
@ -1,10 +1,12 @@
|
||||
extern int HookDirectDraw(HMODULE, int);
|
||||
extern int HookDDProxy(HMODULE, int);
|
||||
extern int HookDirect3D(HMODULE, int);
|
||||
extern int HookOle32(HMODULE, int);
|
||||
extern void HookOle32(HMODULE);
|
||||
extern int HookDirectInput(HMODULE, int);
|
||||
extern void HookImeLib(HMODULE);
|
||||
extern void HookKernel32(HMODULE);
|
||||
extern void HookUser32(HMODULE);
|
||||
extern void HookWinMM(HMODULE);
|
||||
|
||||
extern void InitPosition(int, int, int, int, int, int);
|
||||
//void InitWindowPos(int, int, int, int);
|
||||
@ -22,4 +24,16 @@ extern FARPROC Remap_smack_ProcAddress(LPCSTR, HMODULE);
|
||||
extern FARPROC Remap_user32_ProcAddress(LPCSTR, HMODULE);
|
||||
extern FARPROC Remap_kernel32_ProcAddress(LPCSTR, HMODULE);
|
||||
extern FARPROC Remap_ole32_ProcAddress(LPCSTR, HMODULE);
|
||||
extern FARPROC Remap_trust_ProcAddress(LPCSTR, HMODULE);
|
||||
extern FARPROC Remap_WinMM_ProcAddress(LPCSTR, HMODULE);
|
||||
extern FARPROC Remap_ImeLib_ProcAddress(LPCSTR, HMODULE);
|
||||
|
||||
typedef struct {
|
||||
char *APIName;
|
||||
FARPROC OriginalAddress;
|
||||
FARPROC *StoreAddress;
|
||||
FARPROC HookerAddress;
|
||||
} HookEntry_Type;
|
||||
|
||||
extern FARPROC RemapLibrary(LPCSTR, HMODULE, HookEntry_Type *);
|
||||
extern void HookLibrary(HMODULE, HookEntry_Type *, char *);
|
||||
|
@ -3,111 +3,66 @@
|
||||
#include "syslibs.h"
|
||||
#include "dxhook.h"
|
||||
|
||||
static HookEntry_Type Hooks[]={
|
||||
{"IsDebuggerPresent", (FARPROC)NULL, (FARPROC *)NULL, (FARPROC)extIsDebuggerPresent},
|
||||
{"GlobalMemoryStatus", (FARPROC)GlobalMemoryStatus, (FARPROC *)&pGlobalMemoryStatus, (FARPROC)extGlobalMemoryStatus},
|
||||
{"GetProcAddress", (FARPROC)GetProcAddress, (FARPROC *)&pGetProcAddress, (FARPROC)extGetProcAddress},
|
||||
{"LoadLibraryA", (FARPROC)LoadLibraryA, (FARPROC *)&pLoadLibraryA, (FARPROC)extLoadLibraryA},
|
||||
{"LoadLibraryExA", (FARPROC)LoadLibraryExA, (FARPROC *)&pLoadLibraryExA, (FARPROC)extLoadLibraryExA},
|
||||
{"LoadLibraryW", (FARPROC)LoadLibraryW, (FARPROC *)&pLoadLibraryW, (FARPROC)extLoadLibraryW},
|
||||
{"LoadLibraryExW", (FARPROC)LoadLibraryExW, (FARPROC *)&pLoadLibraryExW, (FARPROC)extLoadLibraryExW},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
static HookEntry_Type LimitHooks[]={
|
||||
{"GetDiskFreeSpaceA", (FARPROC)GetDiskFreeSpaceA, (FARPROC *)&pGetDiskFreeSpaceA, (FARPROC)extGetDiskFreeSpaceA},
|
||||
{"GlobalMemoryStatus", (FARPROC)GlobalMemoryStatus, (FARPROC *)&pGlobalMemoryStatus, (FARPROC)extGlobalMemoryStatus},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
static HookEntry_Type TimeHooks[]={
|
||||
{"GetTickCount", (FARPROC)GetTickCount, (FARPROC *)&pGetTickCount, (FARPROC)extGetTickCount},
|
||||
{"GetLocalTime", (FARPROC)GetLocalTime, (FARPROC *)&pGetLocalTime, (FARPROC)extGetLocalTime},
|
||||
{"GetSystemTime", (FARPROC)GetSystemTime, (FARPROC *)&pGetSystemTime, (FARPROC)extGetSystemTime},
|
||||
{"GetSystemTimeAsFileTime", (FARPROC)GetSystemTimeAsFileTime, (FARPROC *)&pGetSystemTimeAsFileTime, (FARPROC)extGetSystemTimeAsFileTime},
|
||||
{"Sleep", (FARPROC)Sleep, (FARPROC *)&pSleep, (FARPROC)extSleep},
|
||||
{"SleepEx", (FARPROC)SleepEx, (FARPROC *)&pSleepEx, (FARPROC)extSleepEx},
|
||||
{"SetTimer", (FARPROC)SetTimer, (FARPROC *)&pSetTimer, (FARPROC)extSetTimer},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
static HookEntry_Type VersionHooks[]={
|
||||
{"GetVersion", (FARPROC)GetVersion, (FARPROC *)&pGetVersion, (FARPROC)extGetVersion},
|
||||
{"GetVersionEx", (FARPROC)GetVersionEx, (FARPROC *)&pGetVersionEx, (FARPROC)extGetVersionEx},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
void HookKernel32(HMODULE module)
|
||||
{
|
||||
void *tmp;
|
||||
HookLibrary(module, Hooks, "kernel32.dll");
|
||||
|
||||
if(dxw.dwFlags2 & LIMITRESOURCES){
|
||||
tmp = HookAPI(module, "kernel32.dll", GetDiskFreeSpaceA, "GetDiskFreeSpaceA", extGetDiskFreeSpaceA);
|
||||
if(tmp) pGetDiskFreeSpaceA = (GetDiskFreeSpaceA_Type)tmp;
|
||||
tmp = HookAPI(module, "kernel32.dll", GlobalMemoryStatus, "GlobalMemoryStatus", extGlobalMemoryStatus);
|
||||
if(tmp) pGlobalMemoryStatus = (GlobalMemoryStatus_Type)tmp;
|
||||
}
|
||||
if(dxw.dwFlags2 & LIMITRESOURCES) HookLibrary(module, LimitHooks, "kernel32.dll");
|
||||
|
||||
if(dxw.dwFlags2 & LIMITRESOURCES) HookLibrary(module, TimeHooks, "kernel32.dll");
|
||||
|
||||
if(dxw.dwFlags2 & TIMESTRETCH){
|
||||
tmp = HookAPI(module, "kernel32.dll", GetTickCount, "GetTickCount", extGetTickCount);
|
||||
if(tmp) pGetTickCount = (GetTickCount_Type)tmp;
|
||||
tmp = HookAPI(module, "kernel32.dll", GetLocalTime, "GetLocalTime", extGetLocalTime);
|
||||
if(tmp) pGetLocalTime = (GetLocalTime_Type)tmp;
|
||||
tmp = HookAPI(module, "kernel32.dll", GetSystemTime, "GetSystemTime", extGetSystemTime);
|
||||
if(tmp) pGetSystemTime = (GetSystemTime_Type)tmp;
|
||||
tmp = HookAPI(module, "kernel32.dll", GetSystemTimeAsFileTime, "GetSystemTimeAsFileTime", extGetSystemTimeAsFileTime);
|
||||
if(tmp) pGetSystemTimeAsFileTime = (GetSystemTimeAsFileTime_Type)tmp;
|
||||
tmp = HookAPI(module, "kernel32.dll", Sleep, "Sleep", extSleep);
|
||||
if(tmp) pSleep = (Sleep_Type)tmp;
|
||||
tmp = HookAPI(module, "kernel32.dll", SleepEx, "SleepEx", extSleepEx);
|
||||
if(tmp) pSleepEx = (SleepEx_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", SetTimer, "SetTimer", extSetTimer);
|
||||
if(tmp) pSetTimer = (SetTimer_Type)tmp;
|
||||
tmp = HookAPI(module, "winmm.dll", NULL, "timeGetTime", exttimeGetTime);
|
||||
if(tmp) ptimeGetTime = (timeGetTime_Type)tmp;
|
||||
}
|
||||
|
||||
if(dxw.dwFlags2 & FAKEVERSION){
|
||||
tmp = HookAPI(module, "kernel32.dll", GetVersion, "GetVersion", extGetVersion);
|
||||
if(tmp) pGetVersion = (GetVersion_Type)tmp;
|
||||
tmp = HookAPI(module, "kernel32.dll", GetVersionEx, "GetVersionEx", extGetVersionEx);
|
||||
if(tmp) pGetVersionEx = (GetVersionEx_Type)tmp;
|
||||
}
|
||||
if(dxw.dwFlags2 & FAKEVERSION) HookLibrary(module, VersionHooks, "kernel32.dll");
|
||||
}
|
||||
|
||||
FARPROC Remap_kernel32_ProcAddress(LPCSTR proc, HMODULE hModule)
|
||||
{
|
||||
if (!strcmp(proc,"IsDebuggerPresent")){
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extIsDebuggerPresent);
|
||||
return (FARPROC)extIsDebuggerPresent;
|
||||
}
|
||||
if(dxw.dwFlags2 & LIMITRESOURCES){
|
||||
if (!strcmp(proc,"GetDiskFreeSpaceA")){
|
||||
pGetDiskFreeSpaceA=(GetDiskFreeSpaceA_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGetDiskFreeSpaceA);
|
||||
return (FARPROC)extGetDiskFreeSpaceA;
|
||||
}
|
||||
if (!strcmp(proc,"GlobalMemoryStatus")){
|
||||
pGlobalMemoryStatus=(GlobalMemoryStatus_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGlobalMemoryStatus);
|
||||
return (FARPROC)extGlobalMemoryStatus;
|
||||
}
|
||||
}
|
||||
if(dxw.dwFlags2 & TIMESTRETCH){
|
||||
if (!strcmp(proc,"GetTickCount")){
|
||||
pGetTickCount=(GetTickCount_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGetTickCount);
|
||||
return (FARPROC)extGetTickCount;
|
||||
}
|
||||
if (!strcmp(proc,"GetLocalTime")){
|
||||
pGetLocalTime=(GetLocalTime_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGetLocalTime);
|
||||
return (FARPROC)extGetLocalTime;
|
||||
}
|
||||
if (!strcmp(proc,"GetSystemTime")){
|
||||
pGetSystemTime=(GetSystemTime_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGetSystemTime);
|
||||
return (FARPROC)extGetSystemTime;
|
||||
}
|
||||
if (!strcmp(proc,"GetSystemTimeAsFileTime")){
|
||||
pGetSystemTimeAsFileTime=(GetSystemTimeAsFileTime_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGetSystemTimeAsFileTime);
|
||||
return (FARPROC)extGetSystemTimeAsFileTime;
|
||||
}
|
||||
if (!strcmp(proc,"Sleep")){
|
||||
pSleep=(Sleep_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extSleep);
|
||||
return (FARPROC)extSleep;
|
||||
}
|
||||
if (!strcmp(proc,"SleepEx")){
|
||||
pSleepEx=(SleepEx_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extSleepEx);
|
||||
return (FARPROC)extSleepEx;
|
||||
}
|
||||
if (!strcmp(proc,"SetTimer")){
|
||||
pSetTimer=(SetTimer_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extSetTimer);
|
||||
return (FARPROC)extSetTimer;
|
||||
}
|
||||
}
|
||||
if(dxw.dwFlags2 & FAKEVERSION){
|
||||
if (!strcmp(proc,"GetVersion")){
|
||||
pGetVersion=(GetVersion_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGetVersion);
|
||||
return (FARPROC)extGetVersion;
|
||||
}
|
||||
if (!strcmp(proc,"GetVersionEx")){
|
||||
pGetVersionEx=(GetVersionEx_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGetVersionEx);
|
||||
return (FARPROC)extGetVersionEx;
|
||||
}
|
||||
}
|
||||
FARPROC addr;
|
||||
|
||||
if (addr=RemapLibrary(proc, hModule, Hooks)) return addr;
|
||||
|
||||
if(dxw.dwFlags2 & LIMITRESOURCES)
|
||||
if (addr=RemapLibrary(proc, hModule, LimitHooks)) return addr;
|
||||
|
||||
if(dxw.dwFlags2 & TIMESTRETCH)
|
||||
if (addr=RemapLibrary(proc, hModule, TimeHooks)) return addr;
|
||||
|
||||
if(dxw.dwFlags2 & FAKEVERSION)
|
||||
if (addr=RemapLibrary(proc, hModule, VersionHooks)) return addr;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -5,16 +5,24 @@
|
||||
#include "dxhook.h"
|
||||
#include "dxhelper.h"
|
||||
|
||||
static HookEntry_Type Hooks[]={
|
||||
{"CoCreateInstance", NULL, (FARPROC *)&pCoCreateInstance, (FARPROC)extCoCreateInstance},
|
||||
// {"CoCreateInstanceEx", NULL, (FARPROC *)&pCoCreateInstanceEx, (FARPROC)extCoCreateInstanceEx}, remote object creation....
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
extern HRESULT WINAPI extDirectDrawCreate(GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *);
|
||||
extern HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *, LPDIRECTDRAW FAR *, REFIID, IUnknown FAR *);
|
||||
|
||||
void HookOle32(HMODULE module)
|
||||
{
|
||||
HookLibrary(module, Hooks, "ole32.dll");
|
||||
}
|
||||
|
||||
FARPROC Remap_ole32_ProcAddress(LPCSTR proc, HMODULE hModule)
|
||||
{
|
||||
if (!strcmp(proc,"CoCreateInstance")){
|
||||
pCoCreateInstance=(CoCreateInstance_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pCoCreateInstance);
|
||||
return (FARPROC)extCoCreateInstance;
|
||||
}
|
||||
FARPROC addr;
|
||||
if (addr=RemapLibrary(proc, hModule, Hooks)) return addr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -24,7 +32,6 @@ FARPROC Remap_ole32_ProcAddress(LPCSTR proc, HMODULE hModule)
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
static void HookDDSession(LPDIRECTDRAW *, int);
|
||||
//CoCreateInstance_Type pCoCreateInstance=NULL;
|
||||
|
||||
HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID FAR* ppv)
|
||||
{
|
||||
@ -39,8 +46,9 @@ HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
|
||||
OutTraceD("CoCreateInstance: CLSID_FilterGraph RIID=%x\n", *(DWORD *)&riid);
|
||||
qlib=(*pLoadLibraryA)("quartz.dll");
|
||||
OutTraceD("CoCreateInstance: quartz lib handle=%x\n", qlib);
|
||||
extern void HookSysLibs(HMODULE);
|
||||
HookSysLibs(qlib);
|
||||
HookKernel32(qlib);
|
||||
HookUser32(qlib);
|
||||
HookWinMM(qlib);
|
||||
}
|
||||
|
||||
res=(*pCoCreateInstance)(rclsid, pUnkOuter, dwClsContext, riid, ppv);
|
||||
@ -87,14 +95,3 @@ HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int HookOle32(HMODULE module, int version)
|
||||
{
|
||||
// used by Axis & Allies ....
|
||||
void *tmp;
|
||||
//return 0;
|
||||
OutTraceD("HookOle32 version=%d\n", version); //GHO
|
||||
tmp = HookAPI(module, "ole32.dll", NULL, "CoCreateInstance", extCoCreateInstance);
|
||||
if(tmp) pCoCreateInstance = (CoCreateInstance_Type)tmp;
|
||||
return 0;
|
||||
}
|
||||
|
229
dll/dxuser32.cpp
229
dll/dxuser32.cpp
@ -3,138 +3,117 @@
|
||||
#include "syslibs.h"
|
||||
#include "dxhook.h"
|
||||
|
||||
static HookEntry_Type Hooks[]={
|
||||
{"ChangeDisplaySettingsA", NULL, (FARPROC *)&pChangeDisplaySettings, (FARPROC)extChangeDisplaySettings},
|
||||
{"ChangeDisplaySettingsExA", NULL, (FARPROC *)&pChangeDisplaySettingsEx, (FARPROC)extChangeDisplaySettingsEx},
|
||||
{"BeginPaint", NULL, (FARPROC *)&pBeginPaint, (FARPROC)&extBeginPaint},
|
||||
{"EndPaint", NULL, (FARPROC *)&pEndPaint, (FARPROC)extEndPaint},
|
||||
{"ShowCursor", NULL, (FARPROC *)&pShowCursor, (FARPROC)extShowCursor},
|
||||
{"CreateDialogIndirectParamA", NULL, (FARPROC *)&pCreateDialogIndirectParam, (FARPROC)extCreateDialogIndirectParam},
|
||||
{"CreateDialogParamA", NULL, (FARPROC *)&pCreateDialogParam, (FARPROC)extCreateDialogParam},
|
||||
{"MoveWindow", NULL, (FARPROC *)&pMoveWindow, (FARPROC)extMoveWindow},
|
||||
{"ChangeDisplaySettingsA", NULL, (FARPROC *)&pChangeDisplaySettings, (FARPROC)extChangeDisplaySettings},
|
||||
{"ChangeDisplaySettingsExA", NULL, (FARPROC *)&pChangeDisplaySettingsEx, (FARPROC)extChangeDisplaySettingsEx},
|
||||
{"EnumDisplaySettingsA", NULL, (FARPROC *)&pEnumDisplaySettings, (FARPROC)extEnumDisplaySettings},
|
||||
{"GetClipCursor", NULL, (FARPROC *)&pGetClipCursor, (FARPROC)extGetClipCursor},
|
||||
{"ClipCursor", NULL, (FARPROC *)&pClipCursor, (FARPROC)extClipCursor},
|
||||
{"FillRect", NULL, (FARPROC *)&pClipCursor, (FARPROC)extFillRect},
|
||||
{"DefWindowProcA", NULL, (FARPROC *)&pDefWindowProc, (FARPROC)extDefWindowProc},
|
||||
{"CreateWindowExA", NULL, (FARPROC *)&pCreateWindowExA, (FARPROC)extCreateWindowExA},
|
||||
{"RegisterClassExA", NULL, (FARPROC *)&pRegisterClassExA, (FARPROC)extRegisterClassExA},
|
||||
{"GetSystemMetrics", NULL, (FARPROC *)&pGetSystemMetrics, (FARPROC)extGetSystemMetrics},
|
||||
{"GetDesktopWindow", NULL, (FARPROC *)&pGetDesktopWindow, (FARPROC)extGetDesktopWindow},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
static HookEntry_Type DDHooks[]={
|
||||
{"GetDC", NULL, (FARPROC *)&pGDIGetDC, (FARPROC)extDDGetDC},
|
||||
{"GetWindowDC", NULL, (FARPROC *)&pGDIGetWindowDC, (FARPROC)extDDGetDC},
|
||||
{"ReleaseDC", NULL, (FARPROC *)&pGDIReleaseDC, (FARPROC)extDDReleaseDC},
|
||||
{"InvalidateRect", NULL, (FARPROC *)&pInvalidateRect, (FARPROC)extDDInvalidateRect},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
static HookEntry_Type GDIHooks[]={
|
||||
{"GetDC", NULL, (FARPROC *)&pGDIGetDC, (FARPROC)extGDIGetDC},
|
||||
{"GetWindowDC", NULL, (FARPROC *)&pGDIGetWindowDC, (FARPROC)extGDIGetDC},
|
||||
{"ReleaseDC", NULL, (FARPROC *)&pGDIReleaseDC, (FARPROC)extGDIReleaseDC},
|
||||
{"InvalidateRect", NULL, (FARPROC *)&pInvalidateRect, (FARPROC)extInvalidateRect},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
static HookEntry_Type RemapHooks[]={
|
||||
{"ScreenToClient", NULL, (FARPROC *)&pScreenToClient, (FARPROC)extScreenToClient},
|
||||
{"ClientToScreen", NULL, (FARPROC *)&pClientToScreen, (FARPROC)extClientToScreen},
|
||||
{"GetClientRect", NULL, (FARPROC *)&pGetClientRect, (FARPROC)extGetClientRect},
|
||||
{"GetWindowRect", NULL, (FARPROC *)&pGetWindowRect, (FARPROC)extGetWindowRect},
|
||||
{"MapWindowPoints", NULL, (FARPROC *)&pMapWindowPoints, (FARPROC)extMapWindowPoints},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
static HookEntry_Type MessageHooks[]={
|
||||
{"PeekMessageA", NULL, (FARPROC *)&pPeekMessage, (FARPROC)extPeekMessage},
|
||||
{"GetMessageA", NULL, (FARPROC *)&pGetMessage, (FARPROC)extGetMessage},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
static HookEntry_Type MouseHooks[]={
|
||||
{"GetCursorPos", NULL, (FARPROC *)&pGetCursorPos, (FARPROC)extGetCursorPos},
|
||||
{"SetCursor", NULL, (FARPROC *)&pSetCursor, (FARPROC)extSetCursor},
|
||||
{"SendMessageA", NULL, (FARPROC *)&pSendMessage, (FARPROC)extSendMessage}, // ???
|
||||
//{"SetPhysicalCursorPos", NULL, (FARPROC *)&pSetCursor, (FARPROC)extSetCursor}, // ???
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
static HookEntry_Type WinHooks[]={
|
||||
{"ShowWindow", NULL, (FARPROC *)&pShowWindow, (FARPROC)extShowWindow},
|
||||
{"SetWindowLongA", (FARPROC)SetWindowLongA, (FARPROC *)&pSetWindowLong, (FARPROC)extSetWindowLong},
|
||||
{"GetWindowLongA", (FARPROC)GetWindowLongA, (FARPROC *)&pGetWindowLong, (FARPROC)extGetWindowLong},
|
||||
{"SetWindowPos", (FARPROC)SetWindowPos, (FARPROC *)&pSetWindowPos, (FARPROC)extSetWindowPos},
|
||||
{"DeferWindowPos", (FARPROC)DeferWindowPos, (FARPROC *)&pGDIDeferWindowPos, (FARPROC)extDeferWindowPos},
|
||||
{"CallWindowProcA", (FARPROC)CallWindowProcA, (FARPROC *)&pCallWindowProc, (FARPROC)extCallWindowProc},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
static HookEntry_Type MouseHooks2[]={
|
||||
{"SetCursorPos", (FARPROC)SetCursorPos, (FARPROC *)&pSetCursorPos, (FARPROC)extSetCursorPos},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
FARPROC Remap_user32_ProcAddress(LPCSTR proc, HMODULE hModule)
|
||||
{
|
||||
if (!strcmp(proc,"ChangeDisplaySettingsA")){
|
||||
pChangeDisplaySettings=(ChangeDisplaySettings_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pChangeDisplaySettings);
|
||||
return (FARPROC)extChangeDisplaySettings;
|
||||
}
|
||||
if (!strcmp(proc,"ChangeDisplaySettingsExA")){
|
||||
pChangeDisplaySettingsEx=(ChangeDisplaySettingsEx_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pChangeDisplaySettingsEx);
|
||||
return (FARPROC)extChangeDisplaySettingsEx;
|
||||
}
|
||||
if (!strcmp(proc,"BeginPaint")){
|
||||
pBeginPaint=(BeginPaint_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pBeginPaint);
|
||||
return (FARPROC)extBeginPaint;
|
||||
}
|
||||
if (!strcmp(proc,"EndPaint")){
|
||||
pEndPaint=(EndPaint_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pEndPaint);
|
||||
return (FARPROC)extEndPaint;
|
||||
}
|
||||
if (!strcmp(proc,"ShowCursor")){
|
||||
pShowCursor=(ShowCursor_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pShowCursor);
|
||||
return (FARPROC)extShowCursor;
|
||||
}
|
||||
/*
|
||||
if(dxw.dwFlags1 & MAPGDITOPRIMARY){
|
||||
tmp = HookAPI(module, "user32.dll", GetDC, "GetDC", extDDGetDC);
|
||||
if(tmp) pGDIGetDC = (GDIGetDC_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", GetWindowDC, "GetWindowDC", extDDGetWindowDC);
|
||||
if(tmp) pGDIGetWindowDC = (GDIGetDC_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", ReleaseDC, "ReleaseDC", extDDReleaseDC);
|
||||
if(tmp) pGDIReleaseDC = (GDIReleaseDC_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", InvalidateRect, "InvalidateRect", extDDInvalidateRect);
|
||||
if(tmp) pInvalidateRect = (InvalidateRect_Type)tmp;
|
||||
}
|
||||
else{
|
||||
tmp = HookAPI(module, "user32.dll", GetDC, "GetDC", extGDIGetDC);
|
||||
if(tmp) pGDIGetDC = (GDIGetDC_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", GetWindowDC, "GetWindowDC", extGDIGetWindowDC);
|
||||
if(tmp) pGDIGetWindowDC = (GDIGetDC_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", ReleaseDC, "ReleaseDC", extGDIReleaseDC);
|
||||
if(tmp) pGDIReleaseDC = (GDIReleaseDC_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", InvalidateRect, "InvalidateRect", extInvalidateRect);
|
||||
if(tmp) pInvalidateRect = (InvalidateRect_Type)tmp;
|
||||
}
|
||||
FARPROC addr;
|
||||
if (addr=RemapLibrary(proc, hModule, Hooks)) return addr;
|
||||
|
||||
if (addr=RemapLibrary(proc, hModule, (dxw.dwFlags1 & MAPGDITOPRIMARY) ? DDHooks : GDIHooks)) return addr;
|
||||
|
||||
if (dxw.dwFlags1 & CLIENTREMAPPING){
|
||||
tmp = HookAPI(module, "user32.dll", ScreenToClient, "ScreenToClient", extScreenToClient);
|
||||
if(tmp) pScreenToClient = (ScreenToClient_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", ClientToScreen, "ClientToScreen", extClientToScreen);
|
||||
if(tmp) pClientToScreen = (ClientToScreen_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", GetClientRect, "GetClientRect", extGetClientRect);
|
||||
if(tmp) pGetClientRect = (GetClientRect_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", GetWindowRect, "GetWindowRect", extGetWindowRect);
|
||||
if(tmp) pGetWindowRect = (GetWindowRect_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", MapWindowPoints, "MapWindowPoints", extMapWindowPoints);
|
||||
if(tmp) pMapWindowPoints = (MapWindowPoints_Type)tmp;
|
||||
}
|
||||
if (dxw.dwFlags1 & CLIENTREMAPPING)
|
||||
if (addr=RemapLibrary(proc, hModule, RemapHooks)) return addr;
|
||||
|
||||
// get / change display settings
|
||||
tmp = HookAPI(module, "user32.dll", ChangeDisplaySettingsA, "ChangeDisplaySettingsA", extChangeDisplaySettings);
|
||||
if(tmp) pChangeDisplaySettings = (ChangeDisplaySettings_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", ChangeDisplaySettingsExA, "ChangeDisplaySettingsExA", extChangeDisplaySettingsEx);
|
||||
if(tmp) pChangeDisplaySettingsEx = (ChangeDisplaySettingsEx_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", EnumDisplaySettingsA, "EnumDisplaySettingsA", extEnumDisplaySettings);
|
||||
if(tmp) pEnumDisplaySettings = (EnumDisplaySettings_Type)tmp;
|
||||
if (dxw.dwFlags1 & MESSAGEPROC)
|
||||
if (addr=RemapLibrary(proc, hModule, MessageHooks)) return addr;
|
||||
|
||||
// handle cursor clipping
|
||||
tmp = HookAPI(module, "user32.dll", GetClipCursor, "GetClipCursor", extGetClipCursor);
|
||||
if(tmp) pGetClipCursor = (GetClipCursor_Type)tmp;
|
||||
if(dxw.dwFlags1 & MODIFYMOUSE)
|
||||
if (addr=RemapLibrary(proc, hModule, MouseHooks)) return addr;
|
||||
|
||||
tmp = HookAPI(module, "user32.dll", ClipCursor, "ClipCursor", extClipCursor);
|
||||
if(tmp) pClipCursor = (ClipCursor_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", FillRect, "FillRect", extFillRect);
|
||||
if(tmp) pFillRect = (FillRect_Type)tmp;
|
||||
if (dxw.dwFlags1 & MESSAGEPROC) {
|
||||
tmp = HookAPI(module, "user32.dll", PeekMessageA, "PeekMessageA", extPeekMessage); // added for GPL
|
||||
if(tmp) pPeekMessage = (PeekMessage_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", GetMessageA, "GetMessageA", extGetMessage); // added for GPL
|
||||
if(tmp) pGetMessage = (GetMessage_Type)tmp;
|
||||
}
|
||||
tmp = HookAPI(module, "user32.dll", DefWindowProcA, "DefWindowProcA", extDefWindowProc); // added for WarWind background erase
|
||||
if(tmp) pDefWindowProc = (DefWindowProc_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", CreateWindowExA, "CreateWindowExA", extCreateWindowExA);
|
||||
if(tmp) pCreateWindowExA = (CreateWindowExA_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", RegisterClassExA, "RegisterClassExA", extRegisterClassExA);
|
||||
if(tmp) pRegisterClassExA = (RegisterClassExA_Type)tmp;
|
||||
if (dxw.dwFlags1 & (PREVENTMAXIMIZE|FIXWINFRAME|LOCKWINPOS|LOCKWINSTYLE)){
|
||||
tmp = HookAPI(module, "user32.dll", ShowWindow, "ShowWindow", extShowWindow);
|
||||
if(tmp) pShowWindow = (ShowWindow_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", SetWindowLongA, "SetWindowLongA", extSetWindowLong);
|
||||
if(tmp) pSetWindowLong = (SetWindowLong_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", GetWindowLongA, "GetWindowLongA", extGetWindowLong);
|
||||
if(tmp) pGetWindowLong = (GetWindowLong_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", SetWindowPos, "SetWindowPos", extSetWindowPos);
|
||||
if(tmp) pSetWindowPos = (SetWindowPos_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", DeferWindowPos, "DeferWindowPos", extDeferWindowPos);
|
||||
if(tmp) pGDIDeferWindowPos = (DeferWindowPos_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", CallWindowProcA, "CallWindowProcA", extCallWindowProc);
|
||||
if(tmp) pCallWindowProc = (CallWindowProc_Type)tmp;
|
||||
}
|
||||
tmp = HookAPI(module, "user32.dll", GetSystemMetrics, "GetSystemMetrics", extGetSystemMetrics);
|
||||
if(tmp) pGetSystemMetrics = (GetSystemMetrics_Type)tmp;
|
||||
if (dxw.dwFlags1 & (PREVENTMAXIMIZE|FIXWINFRAME|LOCKWINPOS|LOCKWINSTYLE))
|
||||
if (addr=RemapLibrary(proc, hModule, WinHooks)) return addr;
|
||||
|
||||
tmp = HookAPI(module, "user32.dll", GetDesktopWindow, "GetDesktopWindow", extGetDesktopWindow);
|
||||
if(tmp) pGetDesktopWindow = (GetDesktopWindow_Type)tmp;
|
||||
if((dxw.dwFlags1 & (MODIFYMOUSE|SLOWDOWN|KEEPCURSORWITHIN)) || (dxw.dwFlags2 & KEEPCURSORFIXED))
|
||||
if (addr=RemapLibrary(proc, hModule, MouseHooks2)) return addr;
|
||||
|
||||
if(dxw.dwFlags1 & MODIFYMOUSE){
|
||||
tmp = HookAPI(module, "user32.dll", GetCursorPos, "GetCursorPos", extGetCursorPos);
|
||||
if(tmp) pGetCursorPos = (GetCursorPos_Type)tmp;
|
||||
//tmp = HookAPI(module, "user32.dll", GetPhysicalCursorPos, "", extGetCursorPos);
|
||||
tmp = HookAPI(module, "user32.dll", SetCursor, "SetCursor", extSetCursor);
|
||||
if(tmp) pSetCursor = (SetCursor_Type)tmp;
|
||||
//tmp = HookAPI(module, "user32.dll", SetPhysicalCursorPos, "", extSetCursorPos);
|
||||
tmp = HookAPI(module, "user32.dll", SendMessageA, "SendMessageA", extSendMessage);
|
||||
if(tmp) pSendMessage = (SendMessage_Type)tmp;
|
||||
}
|
||||
|
||||
if((dxw.dwFlags1 & (MODIFYMOUSE|SLOWDOWN|KEEPCURSORWITHIN)) || (dxw.dwFlags2 & KEEPCURSORFIXED)){
|
||||
tmp = HookAPI(module, "user32.dll", SetCursorPos, "SetCursorPos", extSetCursorPos);
|
||||
if(tmp) pSetCursorPos = (SetCursorPos_Type)tmp;
|
||||
}
|
||||
|
||||
tmp = HookAPI(module, "user32.dll", CreateDialogIndirectParamA, "CreateDialogIndirectParamA", extCreateDialogIndirectParam);
|
||||
if(tmp) pCreateDialogIndirectParam = (CreateDialogIndirectParam_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", CreateDialogParamA, "CreateDialogParamA", extCreateDialogParam);
|
||||
if(tmp) pCreateDialogParam = (CreateDialogParam_Type)tmp;
|
||||
tmp = HookAPI(module, "user32.dll", MoveWindow, "MoveWindow", extMoveWindow);
|
||||
if(tmp) pMoveWindow = (MoveWindow_Type)tmp;
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void HookUser32(HMODULE hModule)
|
||||
{
|
||||
HookLibrary(hModule, Hooks, "user32.dll");
|
||||
|
||||
HookLibrary(hModule, (dxw.dwFlags1 & MAPGDITOPRIMARY) ? DDHooks : GDIHooks, "user32.dll");
|
||||
if (dxw.dwFlags1 & CLIENTREMAPPING) HookLibrary(hModule, RemapHooks, "user32.dll");
|
||||
if (dxw.dwFlags1 & MESSAGEPROC) HookLibrary(hModule, MessageHooks, "user32.dll");
|
||||
if(dxw.dwFlags1 & MODIFYMOUSE)HookLibrary(hModule, MouseHooks, "user32.dll");
|
||||
if (dxw.dwFlags1 & (PREVENTMAXIMIZE|FIXWINFRAME|LOCKWINPOS|LOCKWINSTYLE))HookLibrary(hModule, WinHooks, "user32.dll");
|
||||
if((dxw.dwFlags1 & (MODIFYMOUSE|SLOWDOWN|KEEPCURSORWITHIN)) || (dxw.dwFlags2 & KEEPCURSORFIXED)) HookLibrary(hModule, MouseHooks2, "user32.dll");
|
||||
return;
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ void dxwCore::InitTarget(TARGETMAP *target)
|
||||
if(TimeShift < -8) TimeShift = -8;
|
||||
if(TimeShift > 8) TimeShift = 8;
|
||||
FakeVersionId = target->FakeVersionId;
|
||||
Coordinates = target->coordinates;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
@ -540,7 +541,7 @@ static BOOL SkipFrameCount(DWORD delay)
|
||||
|
||||
BOOL dxwCore::HandleFPS()
|
||||
{
|
||||
if(dwFlags2 & (SHOWFPS|SHOWFPSOVERLAY)) CountFPS(hWnd);
|
||||
if(dwFlags2 & (SHOWFPS|SHOWFPSOVERLAY)) CountFPS(hWndFPS);
|
||||
if(dwFlags2 & LIMITFPS) LimitFrameCount(dxw.MaxFPS);
|
||||
if(dwFlags2 & SKIPFPS) if(SkipFrameCount(dxw.MaxFPS)) return TRUE;
|
||||
return FALSE;
|
||||
@ -786,6 +787,7 @@ int dxwCore::GetDLLIndex(char *lpFileName)
|
||||
"kernel32",
|
||||
"USER32",
|
||||
"GDI32",
|
||||
"imelib",
|
||||
"ADVAPI32",
|
||||
"ole32",
|
||||
"ddraw",
|
||||
@ -810,6 +812,7 @@ int dxwCore::GetDLLIndex(char *lpFileName)
|
||||
"ws2_32",
|
||||
"tapi32",
|
||||
"netapi32",
|
||||
"wintrust",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,8 @@ public:
|
||||
// Operations
|
||||
public: // methods
|
||||
void InitTarget(TARGETMAP *);
|
||||
void SethWnd(HWND hwnd) {hWnd=hwnd;}
|
||||
void SethWnd(HWND hwnd) {hWnd=hwnd; hWndFPS=hwnd;}
|
||||
void SethWnd(HWND hwnd, HWND hwndfps) {hWnd=hwnd; hWndFPS=hwndfps;}
|
||||
void InitWindowPos(int, int, int, int);
|
||||
HWND GethWnd(void) {return hWnd;}
|
||||
void SetScreenSize(void) {dwScreenWidth=800; dwScreenHeight=600;}
|
||||
@ -96,13 +97,14 @@ public: // simple data variables
|
||||
WORD palNumEntries;
|
||||
PALETTEENTRY palPalEntry[256];
|
||||
short FakeVersionId;
|
||||
int Coordinates;
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
DWORD dwScreenWidth;
|
||||
DWORD dwScreenHeight;
|
||||
BOOL FullScreen;
|
||||
HWND hWnd;
|
||||
HWND hWnd, hWndFPS;
|
||||
DWORD PrimSurfaces[DDSQLEN+1];
|
||||
};
|
||||
|
||||
@ -112,6 +114,7 @@ typedef enum {
|
||||
SYSLIBIDX_KERNEL32 = 0,
|
||||
SYSLIBIDX_USER32,
|
||||
SYSLIBIDX_GDI32,
|
||||
SYSLIBIDX_IMELIB,
|
||||
SYSLIBIDX_ADVAPI32,
|
||||
SYSLIBIDX_OLE32,
|
||||
SYSLIBIDX_DIRECTDRAW,
|
||||
@ -127,6 +130,7 @@ typedef enum {
|
||||
SYSLIBIDX_DPLAYX,
|
||||
SYSLIBIDX_DSOUND,
|
||||
SYSLIBIDX_WINMM,
|
||||
SYSLIBIDX_IMM32,
|
||||
SYSLIBIDX_WSOCK,
|
||||
SYSLIBIDX_DINPUT,
|
||||
SYSLIBIDX_DINPUT8,
|
||||
@ -135,4 +139,6 @@ typedef enum {
|
||||
SYSLIBIDX_WS2_32,
|
||||
SYSLIBIDX_TAPI32,
|
||||
SYSLIBIDX_NETAPI32,
|
||||
SYSLIBIDX_MAX } enum_syslibraries;
|
||||
SYSLIBIDX_WINTRUST,
|
||||
SYSLIBIDX_MAX }
|
||||
enum_syslibraries;
|
||||
|
@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "dxwnd.h"
|
||||
#include "dxwcore.hpp"
|
||||
|
||||
#define VERSION "2.02.21"
|
||||
#define VERSION "2.02.22"
|
||||
|
||||
LRESULT CALLBACK HookProc(int ncode, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
@ -150,6 +150,7 @@ LRESULT CALLBACK HookProc(int ncode, WPARAM wparam, LPARAM lparam)
|
||||
for(i = 0; name[i]; i ++) name[i] = tolower(name[i]);
|
||||
WaitForSingleObject(hMutex, INFINITE);
|
||||
for(i = 0; pMapping[i].path[0]; i ++){
|
||||
if (!(pMapping[i].flags3 & HOOKENABLED)) continue;
|
||||
if(!strncmp(name, pMapping[i].path, strlen(name)))
|
||||
{
|
||||
// V.68 late fix:
|
||||
|
Binary file not shown.
@ -377,7 +377,11 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\walkmod.cpp"
|
||||
RelativePath=".\winmm.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\wintrust.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
125
dll/glhook.cpp
125
dll/glhook.cpp
@ -7,96 +7,59 @@
|
||||
#include "glhook.h"
|
||||
#undef DXWDECLARATIONS
|
||||
|
||||
static HookEntry_Type Hooks[]={
|
||||
{"glViewport", NULL, (FARPROC *)&pglViewport, (FARPROC)extglViewport},
|
||||
{"glScissor", NULL, (FARPROC *)&pglScissor, (FARPROC)extglScissor},
|
||||
{"glGetIntegerv", NULL, (FARPROC *)&pglGetIntegerv, (FARPROC)&extglGetIntegerv},
|
||||
{"glDrawBuffer", NULL, (FARPROC *)&pglDrawBuffer, (FARPROC)extglDrawBuffer},
|
||||
{"glPolygonMode", NULL, (FARPROC *)&pglPolygonMode, (FARPROC)extglPolygonMode},
|
||||
{"glGetFloatv", NULL, (FARPROC *)&pglGetFloatv, (FARPROC)extglGetFloatv},
|
||||
{"glClear", NULL, (FARPROC *)&pglClear, (FARPROC)extglClear},
|
||||
{"wglCreateContext", NULL, (FARPROC *)&pwglCreateContext, (FARPROC)extwglCreateContext},
|
||||
{"wglMakeCurrent", NULL, (FARPROC *)&pwglMakeCurrent, (FARPROC)extwglMakeCurrent},
|
||||
{"wglGetProcAddress", NULL, (FARPROC *)&pwglGetProcAddress, (FARPROC)extwglGetProcAddress},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
static HookEntry_Type wglHooks[]={
|
||||
{"glViewport", NULL, (FARPROC *)&pglViewport, (FARPROC)extglViewport},
|
||||
{"glScissor", NULL, (FARPROC *)&pglScissor, (FARPROC)extglScissor},
|
||||
{"glGetIntegerv", NULL, (FARPROC *)&pglGetIntegerv, (FARPROC)&extglGetIntegerv},
|
||||
{"glDrawBuffer", NULL, (FARPROC *)&pglDrawBuffer, (FARPROC)extglDrawBuffer},
|
||||
{"glPolygonMode", NULL, (FARPROC *)&pglPolygonMode, (FARPROC)extglPolygonMode},
|
||||
{"glGetFloatv", NULL, (FARPROC *)&pglGetFloatv, (FARPROC)extglGetFloatv},
|
||||
{"glClear", NULL, (FARPROC *)&pglClear, (FARPROC)extglClear},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
FARPROC Remap_gl_ProcAddress(LPCSTR proc, HMODULE hModule)
|
||||
{
|
||||
FARPROC addr;
|
||||
if(!(dxw.dwFlags2 & HOOKOPENGL)) return NULL;
|
||||
|
||||
if (!strcmp(proc,"glViewport") && !pglViewport){
|
||||
pglViewport=(glViewport_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pglViewport);
|
||||
return (FARPROC)extglViewport;
|
||||
}
|
||||
if (!strcmp(proc,"glScissor") && !pglScissor){
|
||||
pglScissor=(glScissor_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pglScissor);
|
||||
return (FARPROC)extglScissor;
|
||||
}
|
||||
if (!strcmp(proc,"glGetIntegerv") && !pglGetIntegerv){
|
||||
pglGetIntegerv=(glGetIntegerv_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pglGetIntegerv);
|
||||
return (FARPROC)extglGetIntegerv;
|
||||
}
|
||||
if (!strcmp(proc,"glDrawBuffer") && !pglDrawBuffer){
|
||||
pglDrawBuffer=(glDrawBuffer_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pglDrawBuffer);
|
||||
return (FARPROC)extglDrawBuffer;
|
||||
}
|
||||
if (!strcmp(proc,"glPolygonMode") && !pglPolygonMode){
|
||||
pglPolygonMode=(glPolygonMode_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pglPolygonMode);
|
||||
return (FARPROC)extglPolygonMode;
|
||||
}
|
||||
if (!strcmp(proc,"glGetFloatv") && !pglGetFloatv){
|
||||
pglGetFloatv=(glGetFloatv_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pglGetFloatv);
|
||||
return (FARPROC)extglGetFloatv;
|
||||
}
|
||||
if (!strcmp(proc,"glClear") && !pglClear){
|
||||
pglClear=(glClear_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pglClear);
|
||||
return (FARPROC)extglClear;
|
||||
}
|
||||
if (!strcmp(proc,"wglCreateContext") && !pwglCreateContext){
|
||||
pwglCreateContext=(wglCreateContext_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pwglCreateContext);
|
||||
return (FARPROC)extwglCreateContext;
|
||||
}
|
||||
if (!strcmp(proc,"wglMakeCurrent") && !pwglMakeCurrent){
|
||||
pwglMakeCurrent=(wglMakeCurrent_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pwglMakeCurrent);
|
||||
return (FARPROC)extwglMakeCurrent;
|
||||
}
|
||||
if (addr=RemapLibrary(proc, hModule, Hooks)) return addr;
|
||||
// NULL -> keep the original call address
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static FARPROC wglRemapLibrary(LPCSTR proc, HookEntry_Type *Hooks)
|
||||
{
|
||||
int i;
|
||||
HookEntry_Type *Hook;
|
||||
for(i=0; Hooks[i].APIName; i++){
|
||||
Hook=&Hooks[i];
|
||||
if (!strcmp(proc,Hook->APIName)){
|
||||
if (Hook->StoreAddress) *(Hook->StoreAddress)=(*pwglGetProcAddress)(proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), (Hook->StoreAddress) ? *(Hook->StoreAddress) : 0);
|
||||
return Hook->HookerAddress;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PROC Remap_wgl_ProcAddress(LPCSTR proc)
|
||||
{
|
||||
if (!strcmp(proc,"glViewport")){
|
||||
pglViewport=(glViewport_Type)(*pwglGetProcAddress)(proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pglViewport);
|
||||
return (FARPROC)extglViewport;
|
||||
}
|
||||
if (!strcmp(proc,"glScissor")){
|
||||
pglScissor=(glScissor_Type)(*pwglGetProcAddress)(proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pglScissor);
|
||||
return (FARPROC)extglScissor;
|
||||
}
|
||||
if (!strcmp(proc,"glGetIntegerv")){
|
||||
pglGetIntegerv=(glGetIntegerv_Type)(*pwglGetProcAddress)(proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pglGetIntegerv);
|
||||
return (FARPROC)extglGetIntegerv;
|
||||
}
|
||||
if (!strcmp(proc,"glDrawBuffer")){
|
||||
pglDrawBuffer=(glDrawBuffer_Type)(*pwglGetProcAddress)(proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pglDrawBuffer);
|
||||
return (FARPROC)extglDrawBuffer;
|
||||
}
|
||||
if (!strcmp(proc,"glPolygonMode")){
|
||||
pglPolygonMode=(glPolygonMode_Type)(*pwglGetProcAddress)(proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pglPolygonMode);
|
||||
return (FARPROC)extglPolygonMode;
|
||||
}
|
||||
if (!strcmp(proc,"glGetFloatv")){
|
||||
pglGetFloatv=(glGetFloatv_Type)(*pwglGetProcAddress)(proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pglGetFloatv);
|
||||
return (FARPROC)extglGetFloatv;
|
||||
}
|
||||
if (!strcmp(proc,"glClear")){
|
||||
pglClear=(glClear_Type)(*pwglGetProcAddress)(proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pglClear);
|
||||
return (FARPROC)extglClear;
|
||||
}
|
||||
FARPROC addr;
|
||||
if(addr=wglRemapLibrary(proc, wglHooks)) return addr;
|
||||
// NULL -> keep the original call address
|
||||
return NULL;
|
||||
}
|
||||
|
141
dll/hd3d.cpp
141
dll/hd3d.cpp
@ -7,6 +7,7 @@
|
||||
#include "dxwnd.h"
|
||||
#include "dxwcore.hpp"
|
||||
#include "dxhook.h"
|
||||
#include "syslibs.h"
|
||||
|
||||
#define HOOKD3D10ANDLATER 1
|
||||
|
||||
@ -15,6 +16,7 @@ typedef HRESULT (WINAPI *QueryInterface_Type)(void *, REFIID riid, void** ppvObj
|
||||
typedef void* (WINAPI *Direct3DCreate8_Type)(UINT);
|
||||
typedef void* (WINAPI *Direct3DCreate9_Type)(UINT);
|
||||
typedef HRESULT (WINAPI *Direct3DCreate9Ex_Type)(UINT, IDirect3D9Ex **);
|
||||
typedef HRESULT (WINAPI *CheckFullScreen_Type)(void);
|
||||
|
||||
typedef UINT (WINAPI *GetAdapterCount_Type)(void *);
|
||||
typedef HRESULT (WINAPI *GetAdapterIdentifier_Type)(void *, UINT, DWORD, D3DADAPTER_IDENTIFIER9 *);
|
||||
@ -49,6 +51,8 @@ HRESULT WINAPI extGetDirect3D(void *, IDirect3D9 **);
|
||||
void* WINAPI extDirect3DCreate8(UINT);
|
||||
void* WINAPI extDirect3DCreate9(UINT);
|
||||
HRESULT WINAPI extDirect3DCreate9Ex(UINT, IDirect3D9Ex **);
|
||||
HRESULT WINAPI extCheckFullScreen(void);
|
||||
|
||||
UINT WINAPI extGetAdapterCount(void *);
|
||||
HRESULT WINAPI extGetAdapterIdentifier(void *, UINT, DWORD, D3DADAPTER_IDENTIFIER9 *);
|
||||
HRESULT WINAPI extCreateDevice(void *, UINT, D3DDEVTYPE, HWND, DWORD, D3DPRESENT_PARAMETERS *, void **);
|
||||
@ -74,37 +78,39 @@ void WINAPI extRSSetViewports(ID3D11DeviceContext *, UINT, D3D11_VIEWPORT *);
|
||||
|
||||
extern char *ExplainDDError(DWORD);
|
||||
|
||||
QueryInterface_Type pQueryInterfaceD3D8;
|
||||
QueryInterface_Type pQueryInterfaceDev8;
|
||||
QueryInterface_Type pQueryInterfaceD3D9;
|
||||
QueryInterface_Type pQueryInterfaceDev9;
|
||||
QueryInterface_Type pQueryInterfaceD3D8 = 0;
|
||||
QueryInterface_Type pQueryInterfaceDev8 = 0;
|
||||
QueryInterface_Type pQueryInterfaceD3D9 = 0;
|
||||
QueryInterface_Type pQueryInterfaceDev9 = 0;
|
||||
|
||||
GetDirect3D_Type pGetDirect3D;
|
||||
GetDirect3D_Type pGetDirect3D = 0;
|
||||
Direct3DCreate8_Type pDirect3DCreate8 = 0;
|
||||
Direct3DCreate9_Type pDirect3DCreate9 = 0;
|
||||
Direct3DCreate9Ex_Type pDirect3DCreate9Ex = 0;
|
||||
GetAdapterCount_Type pGetAdapterCount;
|
||||
GetAdapterIdentifier_Type pGetAdapterIdentifier;
|
||||
CreateDevice_Type pCreateDevice;
|
||||
CreateDeviceEx_Type pCreateDeviceEx;
|
||||
EnumAdapterModes8_Type pEnumAdapterModes8;
|
||||
EnumAdapterModes9_Type pEnumAdapterModes9;
|
||||
GetAdapterDisplayMode_Type pGetAdapterDisplayMode;
|
||||
GetDisplayMode_Type pGetDisplayMode;
|
||||
Present_Type pPresent = 0;
|
||||
SetRenderState_Type pSetRenderState;
|
||||
GetRenderState_Type pGetRenderState;
|
||||
CreateAdditionalSwapChain_Type pCreateAdditionalSwapChain;
|
||||
GetViewport_Type pGetViewport;
|
||||
SetViewport_Type pSetViewport;
|
||||
CheckFullScreen_Type pCheckFullScreen = 0;
|
||||
|
||||
D3D10CreateDevice_Type pD3D10CreateDevice;
|
||||
D3D10CreateDeviceAndSwapChain_Type pD3D10CreateDeviceAndSwapChain;
|
||||
D3D10CreateDevice1_Type pD3D10CreateDevice1;
|
||||
D3D10CreateDeviceAndSwapChain1_Type pD3D10CreateDeviceAndSwapChain1;
|
||||
D3D11CreateDevice_Type pD3D11CreateDevice;
|
||||
D3D11CreateDeviceAndSwapChain_Type pD3D11CreateDeviceAndSwapChain;
|
||||
RSSetViewports_Type pRSSetViewports;
|
||||
GetAdapterCount_Type pGetAdapterCount = 0;
|
||||
GetAdapterIdentifier_Type pGetAdapterIdentifier = 0;
|
||||
CreateDevice_Type pCreateDevice = 0;
|
||||
CreateDeviceEx_Type pCreateDeviceEx = 0;
|
||||
EnumAdapterModes8_Type pEnumAdapterModes8 = 0;
|
||||
EnumAdapterModes9_Type pEnumAdapterModes9 = 0;
|
||||
GetAdapterDisplayMode_Type pGetAdapterDisplayMode = 0;
|
||||
GetDisplayMode_Type pGetDisplayMode = 0;
|
||||
Present_Type pPresent = 0;
|
||||
SetRenderState_Type pSetRenderState = 0;
|
||||
GetRenderState_Type pGetRenderState = 0;
|
||||
CreateAdditionalSwapChain_Type pCreateAdditionalSwapChain = 0;
|
||||
GetViewport_Type pGetViewport = 0;
|
||||
SetViewport_Type pSetViewport = 0;
|
||||
|
||||
D3D10CreateDevice_Type pD3D10CreateDevice = 0;
|
||||
D3D10CreateDeviceAndSwapChain_Type pD3D10CreateDeviceAndSwapChain = 0;
|
||||
D3D10CreateDevice1_Type pD3D10CreateDevice1 = 0;
|
||||
D3D10CreateDeviceAndSwapChain1_Type pD3D10CreateDeviceAndSwapChain1 = 0;
|
||||
D3D11CreateDevice_Type pD3D11CreateDevice = 0;
|
||||
D3D11CreateDeviceAndSwapChain_Type pD3D11CreateDeviceAndSwapChain = 0;
|
||||
RSSetViewports_Type pRSSetViewports = 0;
|
||||
|
||||
DWORD dwD3DVersion;
|
||||
|
||||
@ -150,6 +156,11 @@ FARPROC Remap_d3d9_ProcAddress(LPCSTR proc, HMODULE hModule)
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreate9Ex);
|
||||
return (FARPROC)extDirect3DCreate9Ex;
|
||||
}
|
||||
if (!strcmp(proc,"CheckFullScreen") && !pCheckFullScreen){
|
||||
pCheckFullScreen=(CheckFullScreen_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pCheckFullScreen);
|
||||
return (FARPROC)extCheckFullScreen;
|
||||
}
|
||||
|
||||
if (!(dxw.dwFlags3 & SUPPRESSD3DEXT)) return NULL;
|
||||
|
||||
@ -237,6 +248,8 @@ int HookDirect3D(HMODULE module, int version){
|
||||
if(tmp) pDirect3DCreate9 = (Direct3DCreate9_Type)tmp;
|
||||
tmp = HookAPI(module, "d3d9.dll", NULL, "Direct3DCreate9Ex", extDirect3DCreate9Ex);
|
||||
if(tmp) pDirect3DCreate9Ex = (Direct3DCreate9Ex_Type)tmp;
|
||||
tmp = HookAPI(module, "d3d9.dll", NULL, "CheckFullScreen", extCheckFullScreen);
|
||||
if(tmp) pCheckFullScreen = (CheckFullScreen_Type)tmp;
|
||||
#ifdef HOOKD3D10ANDLATER
|
||||
// D3D10
|
||||
tmp = HookAPI(module, "d3d10.dll", NULL, "D3D10CreateDevice", extD3D10CreateDevice);
|
||||
@ -268,6 +281,10 @@ int HookDirect3D(HMODULE module, int version){
|
||||
hinst = LoadLibrary("d3d9.dll");
|
||||
pDirect3DCreate9 =
|
||||
(Direct3DCreate9_Type)GetProcAddress(hinst, "Direct3DCreate9");
|
||||
pDirect3DCreate9Ex =
|
||||
(Direct3DCreate9Ex_Type)GetProcAddress(hinst, "Direct3DCreate9Ex");
|
||||
pCheckFullScreen =
|
||||
(CheckFullScreen_Type)GetProcAddress(hinst, "CheckFullScreen");
|
||||
if(pDirect3DCreate9){
|
||||
lpd3d = (LPDIRECT3D9)extDirect3DCreate9(31);
|
||||
if(lpd3d) lpd3d->Release();
|
||||
@ -535,6 +552,11 @@ HRESULT WINAPI extGetAdapterDisplayMode(void *lpd3d, UINT Adapter, D3DDISPLAYMOD
|
||||
// OutTrace("GetDeviceCaps hooked\n");
|
||||
// return (*pGetDeviceCapsD3D)(lpd3dd, pCaps);
|
||||
//}
|
||||
HRESULT WINAPI extProbe(void *lpd3dd)
|
||||
{
|
||||
OutTrace("Probe: %x\n", lpd3dd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
|
||||
HWND hfocuswindow, DWORD behaviorflags, D3DPRESENT_PARAMETERS *ppresentparam, void **ppd3dd)
|
||||
@ -549,6 +571,23 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
|
||||
dxw.SetScreenSize(param[0], param[1]);
|
||||
AdjustWindowFrame(dxw.GethWnd(), dxw.GetScreenWidth(), dxw.GetScreenHeight());
|
||||
|
||||
if(dxw.dwFlags3 & FIXD3DFRAME){
|
||||
char ClassName[81];
|
||||
GetClassName(dxw.GethWnd(), ClassName, 80);
|
||||
hfocuswindow=(*pCreateWindowExA)(
|
||||
0, ClassName, "child",
|
||||
WS_CHILD|WS_VISIBLE,
|
||||
//GetSystemMetrics(SM_CXSIZEFRAME), GetSystemMetrics(SM_CYSIZEFRAME)+GetSystemMetrics(SM_CYCAPTION),
|
||||
0, 0,
|
||||
dxw.GetScreenWidth(), dxw.GetScreenHeight(), dxw.GethWnd(),
|
||||
NULL, NULL, NULL);
|
||||
if (hfocuswindow)
|
||||
OutTraceD("CreateDevice: updated hfocuswindow=%x\n", hfocuswindow, GetLastError());
|
||||
else
|
||||
OutTraceD("CreateDevice: CreateWindowEx ERROR err=%d\n", GetLastError());
|
||||
dxw.SethWnd(hfocuswindow, dxw.GethWnd());
|
||||
}
|
||||
|
||||
tmp = param;
|
||||
OutTraceD("D3D%d::CreateDevice\n", dwD3DVersion);
|
||||
OutTraceD(" Adapter = %i\n", adapter);
|
||||
@ -575,10 +614,13 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
|
||||
param[2] = mode.Format;
|
||||
OutTraceD(" Current Format = 0x%x\n", mode.Format);
|
||||
|
||||
//param[0]=param[1]=0;
|
||||
|
||||
if(dwD3DVersion == 9){
|
||||
param[7] = 0; //hDeviceWindow
|
||||
dxw.SetFullScreen(~param[8]?TRUE:FALSE);
|
||||
param[8] = 1; //Windowed
|
||||
//param[11] = D3DPRESENTFLAG_DEVICECLIP; //Flags;
|
||||
param[12] = 0; //FullScreen_RefreshRateInHz;
|
||||
param[13] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval
|
||||
}
|
||||
@ -586,6 +628,7 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
|
||||
param[6] = 0; //hDeviceWindow
|
||||
dxw.SetFullScreen(~param[7]?TRUE:FALSE);
|
||||
param[7] = 1; //Windowed
|
||||
//param[10] = D3DPRESENTFLAG_DEVICECLIP; //Flags;
|
||||
param[11] = 0; //FullScreen_RefreshRateInHz;
|
||||
param[12] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval
|
||||
}
|
||||
@ -595,7 +638,7 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
|
||||
OutTraceD("FAILED! %x\n", res);
|
||||
return res;
|
||||
}
|
||||
OutTraceD("SUCCESS!\n");
|
||||
OutTraceD("SUCCESS! device=%x\n", *ppd3dd);
|
||||
|
||||
if(dwD3DVersion == 8){
|
||||
void *pReset;
|
||||
@ -628,8 +671,12 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
|
||||
SetHook((void *)(**(DWORD **)ppd3dd + 232), extGetRenderState, (void **)&pGetRenderState, "GetRenderState(D9)");
|
||||
(*pSetRenderState)((void *)*ppd3dd, D3DRS_FILLMODE, D3DFILL_WIREFRAME);
|
||||
}
|
||||
// experiments ....
|
||||
//SetHook((void *)(**(DWORD **)ppd3dd +280), extValidateDevice, (void **)&pValidateDevice, "ValidateDevice(D9)");
|
||||
//SetHook((void *)(**(DWORD **)ppd3dd + 28), extGetDeviceCapsD3D, (void **)&pGetDeviceCapsD3D, "GetDeviceCaps(D9)");
|
||||
//void *pNull=0;
|
||||
//SetHook((void *)(**(DWORD **)ppd3dd + 344), extProbe, &pNull, "Probe-CreateVertexDeclaration(D9)");
|
||||
//SetHook((void *)(**(DWORD **)ppd3dd + 28), extProbe, &pNull, "Probe-GetDeviceCaps(D9)");
|
||||
}
|
||||
|
||||
GetHookInfo()->IsFullScreen = dxw.IsFullScreen();
|
||||
@ -741,7 +788,7 @@ HRESULT WINAPI extSetViewport(void *pd3dd, D3DVIEWPORT9 *pViewport)
|
||||
(*pGetClientRect)(dxw.GethWnd(), &client);
|
||||
OutTraceD("SetViewport: declared pos=(%d,%d) size=(%d,%d) depth=(%f;%f)\n",
|
||||
pViewport->X, pViewport->Y, pViewport->Width, pViewport->Height, pViewport->MinZ, pViewport->MaxZ);
|
||||
if(IsDebug) OutTrace("glViewport: DEBUG win=(%d,%d) screen=(%d,%d)\n",
|
||||
if(IsDebug) OutTrace("SetViewport: DEBUG win=(%d,%d) screen=(%d,%d)\n",
|
||||
client.right, client.bottom, dxw.GetScreenWidth(), dxw.GetScreenHeight());
|
||||
pViewport->X = (pViewport->X * (int)client.right) / (int)dxw.GetScreenWidth();
|
||||
pViewport->Y = (pViewport->Y * (int)client.bottom) / (int)dxw.GetScreenHeight();
|
||||
@ -982,6 +1029,8 @@ HRESULT WINAPI extQueryInterfaceD3D9(void *obj, REFIID riid, void** ppvObj)
|
||||
HRESULT WINAPI extQueryInterfaceDev9(void *obj, REFIID riid, void** ppvObj)
|
||||
{
|
||||
HRESULT res;
|
||||
void *pReset;
|
||||
|
||||
OutTraceD("Device::QueryInterface(9): lpd3dd=%x refiid=%x\n", obj, riid);
|
||||
res=pQueryInterfaceDev9(obj, riid, ppvObj);
|
||||
if(res){
|
||||
@ -990,19 +1039,23 @@ HRESULT WINAPI extQueryInterfaceDev9(void *obj, REFIID riid, void** ppvObj)
|
||||
}
|
||||
OutTraceD("Device::QueryInterface(9): ppvObj=%x\n", *ppvObj);
|
||||
|
||||
void *pReset;
|
||||
pReset=NULL; // to avoid assert condition
|
||||
SetHook((void *)(**(DWORD **)ppvObj + 0), extQueryInterfaceDev9, (void **)&pQueryInterfaceDev9, "QueryInterface(D9)");
|
||||
SetHook((void *)(**(DWORD **)ppvObj + 32), extGetDisplayMode, (void **)&pGetDisplayMode, "GetDisplayMode(D9)");
|
||||
SetHook((void *)(**(DWORD **)ppvObj + 52), extCreateAdditionalSwapChain, (void **)&pCreateAdditionalSwapChain, "CreateAdditionalSwapChain(D9)");
|
||||
SetHook((void *)(**(DWORD **)ppvObj + 64), extReset, (void **)&pReset, "Reset(D9)");
|
||||
SetHook((void *)(**(DWORD **)ppvObj + 68), extPresent, (void **)&pPresent, "Present(D9)");
|
||||
SetHook((void *)(**(DWORD **)ppvObj +188), extSetViewport, (void **)&pSetViewport, "SetViewport(D9)");
|
||||
SetHook((void *)(**(DWORD **)ppvObj +192), extGetViewport, (void **)&pGetViewport, "GetViewport(D9)");
|
||||
if(dxw.dwFlags2 & WIREFRAME){
|
||||
SetHook((void *)(**(DWORD **)ppvObj + 228), extSetRenderState, (void **)&pSetRenderState, "SetRenderState(D9)");
|
||||
SetHook((void *)(**(DWORD **)ppvObj + 232), extGetRenderState, (void **)&pGetRenderState, "GetRenderState(D9)");
|
||||
(*pSetRenderState)((void *)*ppvObj, D3DRS_FILLMODE, D3DFILL_WIREFRAME);
|
||||
switch(*(DWORD *)&riid){
|
||||
case 0xD0223B96: // IID_IDirect3DDevice9
|
||||
OutTraceD("Device hook for IID_IDirect3DDevice9 interface\n");
|
||||
pReset=NULL; // to avoid assert condition
|
||||
SetHook((void *)(**(DWORD **)ppvObj + 0), extQueryInterfaceDev9, (void **)&pQueryInterfaceDev9, "QueryInterface(D9)");
|
||||
SetHook((void *)(**(DWORD **)ppvObj + 32), extGetDisplayMode, (void **)&pGetDisplayMode, "GetDisplayMode(D9)");
|
||||
SetHook((void *)(**(DWORD **)ppvObj + 52), extCreateAdditionalSwapChain, (void **)&pCreateAdditionalSwapChain, "CreateAdditionalSwapChain(D9)");
|
||||
SetHook((void *)(**(DWORD **)ppvObj + 64), extReset, (void **)&pReset, "Reset(D9)");
|
||||
SetHook((void *)(**(DWORD **)ppvObj + 68), extPresent, (void **)&pPresent, "Present(D9)");
|
||||
//SetHook((void *)(**(DWORD **)ppvObj +188), extSetViewport, (void **)&pSetViewport, "SetViewport(D9)");
|
||||
//SetHook((void *)(**(DWORD **)ppvObj +192), extGetViewport, (void **)&pGetViewport, "GetViewport(D9)");
|
||||
if(dxw.dwFlags2 & WIREFRAME){
|
||||
SetHook((void *)(**(DWORD **)ppvObj + 228), extSetRenderState, (void **)&pSetRenderState, "SetRenderState(D9)");
|
||||
SetHook((void *)(**(DWORD **)ppvObj + 232), extGetRenderState, (void **)&pGetRenderState, "GetRenderState(D9)");
|
||||
(*pSetRenderState)((void *)*ppvObj, D3DRS_FILLMODE, D3DFILL_WIREFRAME);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -1013,3 +1066,9 @@ HRESULT WINAPI extGetDirect3D(void *lpdd3dd, IDirect3D9 **ppD3D9)
|
||||
OutTraceD("Device::GetDirect3D\n");
|
||||
return (*pGetDirect3D)(lpdd3dd, ppD3D9);
|
||||
}
|
||||
|
||||
HRESULT WINAPI extCheckFullScreen(void)
|
||||
{
|
||||
OutTraceD("CheckFullScreen\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -509,8 +509,10 @@ int HookDirectDraw(HMODULE module, int version)
|
||||
|
||||
hinst=LoadLibrary("ddraw.dll");
|
||||
pSetAppCompatData=(SetAppCompatData_Type)(*pGetProcAddress)(hinst, "SetAppCompatData");
|
||||
if(pSetAppCompatData) res=(*pSetAppCompatData)(2, 0);
|
||||
OutTraceD("HookDirectDraw: SetAppCompatData(2,0) ret=%x(%s)\n", res, ExplainDDError(res));
|
||||
if(pSetAppCompatData) {
|
||||
res=(*pSetAppCompatData)(2, 0);
|
||||
OutTraceD("HookDirectDraw: SetAppCompatData(2,0) ret=%x(%s)\n", res, ExplainDDError(res));
|
||||
}
|
||||
FreeLibrary(hinst);
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,30 @@
|
||||
#include "syslibs.h"
|
||||
#include "dxhelper.h"
|
||||
|
||||
static HookEntry_Type Hooks[]={
|
||||
{"ImmNotifyIME", NULL, (FARPROC *)&pImmNotifyIME, (FARPROC)extImmNotifyIME},
|
||||
{"ImmCreateContext", NULL, (FARPROC *)&pImmCreateContext, (FARPROC)extImmCreateContext},
|
||||
{"ImmDestroyContext", NULL, (FARPROC *)&pImmDestroyContext, (FARPROC)extImmDestroyContext},
|
||||
{"ImmSetOpenStatus", NULL, (FARPROC *)&pImmSetOpenStatus, (FARPROC)extImmSetOpenStatus},
|
||||
{"ImmAssociateContext", NULL, (FARPROC *)&pImmAssociateContext, (FARPROC)extImmAssociateContext},
|
||||
{"ImmSetCompositionWindow", NULL, (FARPROC *)&pImmSetCompositionWindow, (FARPROC)extImmSetCompositionWindow},
|
||||
{"ImmSetCompositionStringA", NULL, (FARPROC *)&pImmSetCompositionString, (FARPROC)extImmSetCompositionString},
|
||||
{"ImmGetOpenStatus", NULL, (FARPROC *)&pImmGetOpenStatus, (FARPROC)extImmGetOpenStatus},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
void HookImeLib(HMODULE module)
|
||||
{
|
||||
HookLibrary(module, Hooks, "IMM32.dll");
|
||||
}
|
||||
|
||||
FARPROC Remap_ImeLib_ProcAddress(LPCSTR proc, HMODULE hModule)
|
||||
{
|
||||
FARPROC addr;
|
||||
if (addr=RemapLibrary(proc, hModule, Hooks)) return addr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BOOL WINAPI extImmNotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
|
||||
{
|
||||
OutTraceD("ImmNotifyIME: hIMC=%x dwAction=%x dwIndex=%x dwValue=%x\n", hIMC, dwAction, dwIndex, dwValue);
|
||||
@ -57,25 +81,3 @@ BOOL WINAPI extImmGetOpenStatus(HIMC hIMC)
|
||||
OutTraceD("ImmGetOpenStatus: hIMC=%x\n", hIMC);
|
||||
return(*pImmGetOpenStatus)(hIMC);
|
||||
}
|
||||
|
||||
void HookImeLib(HMODULE module)
|
||||
{
|
||||
void *tmp;
|
||||
|
||||
tmp = HookAPI(module, "IMM32.dll", NULL, "ImmNotifyIME", extImmNotifyIME);
|
||||
if(tmp) pImmNotifyIME = (ImmNotifyIME_Type)tmp;
|
||||
tmp = HookAPI(module, "IMM32.dll", NULL, "ImmCreateContext", extImmCreateContext);
|
||||
if(tmp) pImmCreateContext = (ImmCreateContext_Type)tmp;
|
||||
tmp = HookAPI(module, "IMM32.dll", NULL, "ImmDestroyContext", extImmDestroyContext);
|
||||
if(tmp) pImmDestroyContext = (ImmDestroyContext_Type)tmp;
|
||||
tmp = HookAPI(module, "IMM32.dll", NULL, "ImmSetOpenStatus", extImmSetOpenStatus);
|
||||
if(tmp) pImmSetOpenStatus = (ImmSetOpenStatus_Type)tmp;
|
||||
tmp = HookAPI(module, "IMM32.dll", NULL, "ImmAssociateContext", extImmAssociateContext);
|
||||
if(tmp) pImmAssociateContext = (ImmAssociateContext_Type)tmp;
|
||||
tmp = HookAPI(module, "IMM32.dll", NULL, "ImmSetCompositionWindow", extImmSetCompositionWindow);
|
||||
if(tmp) pImmSetCompositionWindow = (ImmSetCompositionWindow_Type)tmp;
|
||||
tmp = HookAPI(module, "IMM32.dll", NULL, "ImmSetCompositionStringA", extImmSetCompositionString);
|
||||
if(tmp) pImmSetCompositionString = (ImmSetCompositionString_Type)tmp;
|
||||
tmp = HookAPI(module, "IMM32.dll", NULL, "ImmGetOpenStatus", extImmGetOpenStatus);
|
||||
if(tmp) pImmGetOpenStatus = (ImmGetOpenStatus_Type)tmp;
|
||||
}
|
||||
|
@ -8,32 +8,23 @@
|
||||
#include "msvfwhook.h"
|
||||
#undef DXWDECLARATIONS
|
||||
|
||||
static HookEntry_Type Hooks[]={
|
||||
{"ICSendMessage", (FARPROC)NULL, (FARPROC *)&pICSendMessage, (FARPROC)extICSendMessage},
|
||||
{"ICOpen", (FARPROC)NULL, (FARPROC *)&pICOpen, (FARPROC)extICOpen},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
FARPROC Remap_vfw_ProcAddress(LPCSTR proc, HMODULE hModule)
|
||||
{
|
||||
if (!strcmp(proc,"ICSendMessage")){
|
||||
pICSendMessage=(ICSendMessage_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pICSendMessage);
|
||||
return (FARPROC)extICSendMessage;
|
||||
}
|
||||
if (!strcmp(proc,"ICOpen")){
|
||||
pICOpen=(ICOpen_Type)(*pGetProcAddress)(hModule, proc);
|
||||
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pICOpen);
|
||||
return (FARPROC)extICOpen;
|
||||
}
|
||||
|
||||
FARPROC addr;
|
||||
if (addr=RemapLibrary(proc, hModule, Hooks)) return addr;
|
||||
// NULL -> keep the original call address
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void HookMSV4WLibs(HMODULE module)
|
||||
{
|
||||
void *tmp;
|
||||
tmp = HookAPI(module, "MSVFW32.dll", NULL, "ICSendMessage", extICSendMessage);
|
||||
if(tmp) pICSendMessage = (ICSendMessage_Type)tmp;
|
||||
tmp = HookAPI(module, "MSVFW32.dll", NULL, "ICOpen", extICOpen);
|
||||
if(tmp) pICOpen = (ICOpen_Type)tmp;
|
||||
|
||||
return;
|
||||
HookLibrary(module, Hooks, "MSVFW32.dll");
|
||||
}
|
||||
|
||||
LRESULT WINAPI extICSendMessage(HIC hic, UINT wMsg, DWORD_PTR dw1, DWORD_PTR dw2)
|
||||
|
@ -1190,11 +1190,16 @@ LONG WINAPI MyChangeDisplaySettings(char *fname, DEVMODE *lpDevMode, DWORD dwfla
|
||||
else{
|
||||
DEVMODE NewMode, TryMode;
|
||||
int i;
|
||||
HDC DesktopDC;
|
||||
|
||||
// set the proper mode
|
||||
NewMode = *lpDevMode;
|
||||
NewMode.dmPelsHeight = (*GetSystemMetrics)(SM_CYSCREEN);
|
||||
NewMode.dmPelsWidth = (*GetSystemMetrics)(SM_CXSCREEN);
|
||||
if (!(NewMode.dmFields & DM_BITSPERPEL)) {
|
||||
DesktopDC = GetDC(GetDesktopWindow());
|
||||
NewMode.dmBitsPerPel = GetDeviceCaps(DesktopDC, BITSPIXEL) * GetDeviceCaps(DesktopDC, PLANES);
|
||||
}
|
||||
TryMode.dmSize = sizeof(TryMode);
|
||||
OutTraceD("ChangeDisplaySettings: DEBUG looking for size=(%d x %d) bpp=%d\n",
|
||||
NewMode.dmPelsWidth, NewMode.dmPelsHeight, NewMode.dmBitsPerPel);
|
||||
@ -1212,6 +1217,11 @@ LONG WINAPI MyChangeDisplaySettings(char *fname, DEVMODE *lpDevMode, DWORD dwfla
|
||||
if((NewMode.dmBitsPerPel==TryMode.dmBitsPerPel) &&
|
||||
(NewMode.dmPelsHeight==TryMode.dmPelsHeight) &&
|
||||
(NewMode.dmPelsWidth==TryMode.dmPelsWidth)) break;
|
||||
|
||||
//if ((NewMode.dmFields & DM_BITSPERPEL) && (NewMode.dmBitsPerPel!=TryMode.dmBitsPerPel)) continue;
|
||||
//if (NewMode.dmPelsHeight!=TryMode.dmPelsHeight) continue;
|
||||
//if (NewMode.dmPelsWidth!=TryMode.dmPelsWidth) continue;
|
||||
break;
|
||||
}
|
||||
if(dwflags==CDS_FULLSCREEN) dwflags=0; // no FULLSCREEN
|
||||
res=(*ChangeDisplaySettings)(&TryMode, dwflags);
|
||||
@ -1229,7 +1239,8 @@ LONG WINAPI extChangeDisplaySettings(DEVMODE *lpDevMode, DWORD dwflags)
|
||||
{
|
||||
if(IsTraceD){
|
||||
OutTrace("ChangeDisplaySettings: lpDevMode=%x flags=%x", lpDevMode, dwflags);
|
||||
if (lpDevMode) OutTrace(" size=(%d x %d) bpp=%x",
|
||||
if (lpDevMode) OutTrace(" fields=%x(%s) size=(%d x %d) bpp=%x",
|
||||
lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields),
|
||||
lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel);
|
||||
OutTrace("\n");
|
||||
}
|
||||
@ -1465,7 +1476,6 @@ BOOL WINAPI extGetMessage(LPMSG lpMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgF
|
||||
|
||||
|
||||
extern void HookModule(HMODULE, int);
|
||||
extern void HookSysLibs(HMODULE);
|
||||
|
||||
HMODULE SysLibs[SYSLIBIDX_MAX];
|
||||
|
||||
@ -1494,7 +1504,6 @@ HMODULE WINAPI LoadLibraryExWrapper(LPCTSTR lpFileName, HANDLE hFile, DWORD dwFl
|
||||
idx=SYSLIBIDX_OPENGL;
|
||||
SysLibs[idx]=libhandle;
|
||||
}
|
||||
//if (idx == SYSLIBIDX_MAX) HookModule(libhandle, 0);
|
||||
if (idx == -1) HookModule(libhandle, 0);
|
||||
return libhandle;
|
||||
}
|
||||
@ -1561,6 +1570,12 @@ FARPROC WINAPI extGetProcAddress(HMODULE hModule, LPCSTR proc)
|
||||
case SYSLIBIDX_KERNEL32:
|
||||
if (remap=Remap_kernel32_ProcAddress(proc, hModule)) return remap;
|
||||
break;
|
||||
case SYSLIBIDX_IMELIB:
|
||||
if (remap=Remap_ImeLib_ProcAddress(proc, hModule)) return remap;
|
||||
break;
|
||||
case SYSLIBIDX_WINMM:
|
||||
if (remap=Remap_WinMM_ProcAddress(proc, hModule)) return remap;
|
||||
break;
|
||||
case SYSLIBIDX_OLE32:
|
||||
if (remap=Remap_ole32_ProcAddress(proc, hModule)) return remap;
|
||||
break;
|
||||
@ -1588,6 +1603,9 @@ FARPROC WINAPI extGetProcAddress(HMODULE hModule, LPCSTR proc)
|
||||
case SYSLIBIDX_SMACK:
|
||||
if (remap=Remap_smack_ProcAddress(proc, hModule)) return remap;
|
||||
break;
|
||||
case SYSLIBIDX_WINTRUST:
|
||||
if (remap=Remap_trust_ProcAddress(proc, hModule)) return remap;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -2451,14 +2469,6 @@ LRESULT WINAPI extSendMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
return ret;
|
||||
}
|
||||
|
||||
DWORD WINAPI exttimeGetTime(void)
|
||||
{
|
||||
DWORD ret;
|
||||
ret = dxw.GetTickCount();
|
||||
if (IsDebug) OutTrace("timeGetTime: time=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int WINAPI extShowCursor(BOOL bShow)
|
||||
{
|
||||
static int iFakeCounter;
|
||||
|
2493
dll/syslibs.cpp.bak
Normal file
2493
dll/syslibs.cpp.bak
Normal file
File diff suppressed because it is too large
Load Diff
32
dll/winmm.cpp
Normal file
32
dll/winmm.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include "dxwnd.h"
|
||||
#include "dxwcore.hpp"
|
||||
#include "syslibs.h"
|
||||
#include "dxhook.h"
|
||||
|
||||
static HookEntry_Type TimeHooks[]={
|
||||
{"timeGetTime", NULL, (FARPROC *)&ptimeGetTime, (FARPROC)exttimeGetTime},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
void HookWinMM(HMODULE module)
|
||||
{
|
||||
if(dxw.dwFlags2 & TIMESTRETCH) HookLibrary(module, TimeHooks, "winmm.dll");
|
||||
}
|
||||
|
||||
FARPROC Remap_WinMM_ProcAddress(LPCSTR proc, HMODULE hModule)
|
||||
{
|
||||
FARPROC addr;
|
||||
|
||||
if(dxw.dwFlags2 & TIMESTRETCH)
|
||||
if (addr=RemapLibrary(proc, hModule, TimeHooks)) return addr;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD WINAPI exttimeGetTime(void)
|
||||
{
|
||||
DWORD ret;
|
||||
ret = dxw.GetTickCount();
|
||||
if (IsDebug) OutTrace("timeGetTime: time=%x\n", ret);
|
||||
return ret;
|
||||
}
|
35
dll/wintrust.cpp
Normal file
35
dll/wintrust.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include <dxdiag.h>
|
||||
#include "dxwnd.h"
|
||||
#include "dxwcore.hpp"
|
||||
#include "syslibs.h"
|
||||
#include "dxhook.h"
|
||||
#include "dxhelper.h"
|
||||
|
||||
typedef LONG (WINAPI *WinVerifyTrust_Type)(HWND, GUID *, LPVOID);
|
||||
WinVerifyTrust_Type pWinVerifyTrust;
|
||||
extern LONG WINAPI extWinVerifyTrust(HWND, GUID *, LPVOID);
|
||||
|
||||
static HookEntry_Type Hooks[]={
|
||||
{"WinVerifyTrust", NULL, (FARPROC *)&pWinVerifyTrust, (FARPROC)extWinVerifyTrust},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
void HookTrust(HMODULE module)
|
||||
{
|
||||
HookLibrary(module, Hooks, "wintrust.dll");
|
||||
}
|
||||
|
||||
FARPROC Remap_trust_ProcAddress(LPCSTR proc, HMODULE hModule)
|
||||
{
|
||||
FARPROC addr;
|
||||
if (addr=RemapLibrary(proc, hModule, Hooks)) return addr;
|
||||
return NULL;}
|
||||
|
||||
LONG WINAPI extWinVerifyTrust(HWND hWnd, GUID *pgActionID, LPVOID pWVTData)
|
||||
{
|
||||
LONG ret;
|
||||
OutTraceD("WinVerifyTrust: hwnd=%x pgActionID=%x pWVTData=%x\n", hWnd, pgActionID, pWVTData);
|
||||
ret = (*pWinVerifyTrust)(hWnd, pgActionID, pWVTData);
|
||||
OutTraceD("WinVerifyTrust: ret=%x\n", ret);
|
||||
return ret;
|
||||
}
|
@ -6,13 +6,11 @@
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDR_MFXTEXTYPE 129
|
||||
#define IDD_TARGET 130
|
||||
#define IDR_DXWNDIDLE 131
|
||||
#define IDR_ACTIVE 131
|
||||
#define IDR_MENU_POPUP 132
|
||||
#define IDR_MENU_SYSTRAY 133
|
||||
#define IDI_DXWAIT 137
|
||||
#define IDI_DXIDLE 138
|
||||
#define IDI_ICON1 140
|
||||
#define IDI_DXRUN 140
|
||||
#define IDI_ICON2 141
|
||||
#define IDI_RUN0 142
|
||||
@ -21,21 +19,21 @@
|
||||
#define IDI_RUN3 145
|
||||
#define IDI_RUN4 146
|
||||
#define IDI_RUN5 147
|
||||
#define IDI_ICON3 148
|
||||
#define IDI_RUN6 148
|
||||
#define IDD_STATUS 149
|
||||
#define IDD_TIMESLIDER 150
|
||||
#define IDD_TAB_PROGRAM 152
|
||||
#define IDD_TAB_LOG 153
|
||||
#define IDB_BIGICONS 153
|
||||
#define IDD_TAB_DIRECTX 154
|
||||
#define IDD_TAB_MOUSE 155
|
||||
#define IDB_BITMAP1 155
|
||||
#define IDB_SMALLICONS 155
|
||||
#define IDD_TAB_TIMING 156
|
||||
#define IDD_TAB_WINDOW 157
|
||||
#define IDD_TAB_EMPTY 158
|
||||
#define IDD_TAB_EMPTY1 159
|
||||
#define IDD_TAB_OPENGL 159
|
||||
#define IDD_TAB_COMPAT 160
|
||||
#define IDD_TAB_EMPTY2 161
|
||||
#define IDD_TAB_GDI 161
|
||||
#define IDC_AUTO 300
|
||||
#define IDC_DIRECTX1 301
|
||||
@ -47,6 +45,8 @@
|
||||
#define IDC_DIRECTX11 307
|
||||
#define IDC_FILE 1000
|
||||
#define IDC_OPEN 1001
|
||||
#define IDC_STATUSINFO 1005
|
||||
#define IDC_VERSION 1006
|
||||
#define IDC_UNNOTIFY 1007
|
||||
#define IDC_EMULATESURFACE 1008
|
||||
#define IDC_EMULATEBUFFER 1009
|
||||
@ -54,7 +54,6 @@
|
||||
#define IDC_HOOKDI 1011
|
||||
#define IDC_MODIFYMOUSE 1012
|
||||
#define IDC_OUTTRACE 1013
|
||||
#define IDC_VERSION 1014
|
||||
#define IDC_HANDLEDC 1014
|
||||
#define IDC_SAVELOAD 1015
|
||||
#define IDC_INITX 1016
|
||||
@ -65,28 +64,20 @@
|
||||
#define IDC_MAXY 1021
|
||||
#define IDC_MAXFPS 1022
|
||||
#define IDC_MODULE 1023
|
||||
#define IDC_SNOOZE 1023
|
||||
#define IDC_KILL 1024
|
||||
#define IDC_OPENGLLIB 1024
|
||||
#define IDC_AUTOREFRESH 1025
|
||||
#define IDC_FIXWINFRAME 1026
|
||||
#define IDC_HIDEHWCURSOR 1027
|
||||
#define IDC_ENABLECLIPPING 1028
|
||||
#define IDC_COUNTDOWN 1028
|
||||
#define IDC_EDIT1 1029
|
||||
#define IDC_SHOWHWCURSOR 1029
|
||||
#define IDC_VIDEOTOSYSTEMMEM 1030
|
||||
#define IDC_FIXTEXTOUT 1031
|
||||
#define IDC_STATUSINFO 1031
|
||||
#define IDC_KEEPCURSORWITHIN 1032
|
||||
#define IDC_USERGB565 1033
|
||||
#define IDC_SUPPRESSDXERRORS 1034
|
||||
#define IDC_PREVENTMAXIMIZE 1035
|
||||
#define IDC_SUPPRESSDXERRORS2 1035
|
||||
#define IDC_MARKBLIT 1035
|
||||
#define IDC_OUTWINMESSAGES 1036
|
||||
#define IDC_OUTDXTRACE 1037
|
||||
#define IDC_MODEXEMULATION 1038
|
||||
#define IDC_DXPROXED 1038
|
||||
#define IDC_TITLE 1039
|
||||
#define IDC_SLOW 1040
|
||||
@ -112,7 +103,6 @@
|
||||
#define IDC_LOCKWINSTYLE 1060
|
||||
#define IDC_FIXPARENTWIN 1061
|
||||
#define IDC_LOGENABLED 1062
|
||||
#define IDC_MOUSETRACE 1063
|
||||
#define IDC_CURSORTRACE 1063
|
||||
#define IDC_IMPORTTABLE 1064
|
||||
#define IDC_HANDLEEXCEPTIONS 1065
|
||||
@ -124,22 +114,20 @@
|
||||
#define IDC_LIMITRESOURCES 1071
|
||||
#define IDC_SUPPRESSIME 1072
|
||||
#define IDC_SETCOMPATIBILITY 1073
|
||||
#define IDC_SUPPRESSD3DEXT 1073
|
||||
#define IDC_FIXNCHITTEST 1074
|
||||
#define IDC_LIMITFPS 1075
|
||||
#define IDC_SKIPFPS 1076
|
||||
#define IDC_SHOWFPS 1077
|
||||
#define IDC_HIDEMULTIMONITOR 1078
|
||||
#define IDC_TIMESTRETCH 1079
|
||||
#define IDC_TIMESPEED 1079
|
||||
#define IDC_HOOKOPENGL 1080
|
||||
#define IDC_WALLPAPERMODE 1081
|
||||
#define IDC_HOOKGDI 1082
|
||||
#define IDC_SHOWFPSOVERLAY 1083
|
||||
#define IDC_FAKEVERSION 1084
|
||||
#define IDC_COMBOTS 1085
|
||||
#define IDC_FULLRECTBLT 1085
|
||||
#define IDC_NOPALETTEUPDATE 1086
|
||||
#define IDC_MARKBLIT 1087
|
||||
#define IDC_LISTTS 1088
|
||||
#define IDC_LISTFAKE 1089
|
||||
#define IDC_TABPANEL 1090
|
||||
@ -148,11 +136,18 @@
|
||||
#define IDC_STARTDEBUG 1093
|
||||
#define IDC_WIREFRAME 1094
|
||||
#define IDC_DISABLEGAMMARAMP 1095
|
||||
#define IDC_WINDOWIZE2 1095
|
||||
#define IDC_HOOKDLLS 1095
|
||||
#define IDC_FORCEWINRESIZE 1096
|
||||
#define IDC_TIMESLIDER 1097
|
||||
#define IDC_FORCEHOOKOPENGL 1098
|
||||
#define IDC_DESKTOPCENTER 1099
|
||||
#define IDC_COORDINATES 1100
|
||||
#define IDC_SUPPRESSD3DEXT 1101
|
||||
#define IDC_FULLRECTBLT 1102
|
||||
#define IDC_TIMESPEED 1103
|
||||
#define IDC_HOOKDLLS 1104
|
||||
#define IDC_HOOKENABLED 1105
|
||||
#define IDC_DESKTOPWORKAREA 1106
|
||||
#define IDC_FIXD3DFRAME 1107
|
||||
#define ID_MODIFY 32771
|
||||
#define ID_DELETE 32772
|
||||
#define ID_ADD 32773
|
||||
@ -186,14 +181,21 @@
|
||||
#define ID_VIEW_STATUS32813 32813
|
||||
#define ID_VIEW_TIMESLIDER32814 32814
|
||||
#define ID_VIEW_STATUS3 32815
|
||||
#define ID_KILL_PAUSE 32816
|
||||
#define ID_KILL_RESUME 32817
|
||||
#define ID_KILL_KILL 32818
|
||||
#define ID_TASK_RESUME 32819
|
||||
#define ID_FILE_IMPORT 32820
|
||||
#define ID_INDEX0_EXPORT 32821
|
||||
#define ID_PEXPORT 32822
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 153
|
||||
#define _APS_NEXT_COMMAND_VALUE 32816
|
||||
#define _APS_NEXT_RESOURCE_VALUE 156
|
||||
#define _APS_NEXT_COMMAND_VALUE 32823
|
||||
#define _APS_NEXT_CONTROL_VALUE 1091
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
@ -62,3 +62,4 @@ END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTabDirectX message handlers
|
||||
|
||||
|
@ -39,6 +39,7 @@ protected:
|
||||
// NOTE: the ClassWizard will add member functions here
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
@ -26,6 +26,7 @@ void CTabProgram::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent()));
|
||||
DDX_Radio(pDX, IDC_COORDINATES, cTarget->m_Coordinates);
|
||||
DDX_Control(pDX, IDC_FILE, cTarget->m_File);
|
||||
DDX_Text(pDX, IDC_FILE, cTarget->m_FilePath);
|
||||
DDX_Text(pDX, IDC_MODULE, cTarget->m_Module);
|
||||
@ -33,6 +34,7 @@ void CTabProgram::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_UNNOTIFY, cTarget->m_UnNotify);
|
||||
DDX_Check(pDX, IDC_WINDOWIZE, cTarget->m_Windowize);
|
||||
DDX_Check(pDX, IDC_HOOKDLLS, cTarget->m_HookDLLs);
|
||||
DDX_Check(pDX, IDC_HOOKENABLED, cTarget->m_HookEnabled);
|
||||
DDX_Check(pDX, IDC_NOBANNER, cTarget->m_NoBanner);
|
||||
DDX_Check(pDX, IDC_STARTDEBUG, cTarget->m_StartDebug);
|
||||
DDX_Check(pDX, IDC_CLIENTREMAPPING, cTarget->m_ClientRemapping);
|
||||
@ -50,6 +52,9 @@ BEGIN_MESSAGE_MAP(CTabProgram, CDialog)
|
||||
// NOTE: the ClassWizard will add message map macros here
|
||||
ON_BN_CLICKED(IDC_OPEN, OnOpen)
|
||||
//}}AFX_MSG_MAP
|
||||
//ON_BN_CLICKED(IDC_COORDINATES, &CTabProgram::OnBnClickedCoordinates)
|
||||
//ON_BN_CLICKED(IDC_DESKTOPWORKAREA, &CTabProgram::OnBnClickedDesktopworkarea)
|
||||
//ON_BN_CLICKED(IDC_DESKTOPCENTER, &CTabProgram::OnBnClickedDesktopcenter)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -64,4 +69,20 @@ void CTabProgram::OnOpen()
|
||||
CFileDialog dlg( TRUE, "*.*", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
|
||||
"Program (*.exe)|*.exe|All Files (*.*)|*.*||", this);
|
||||
if( dlg.DoModal() == IDOK) cTarget->m_File.SetWindowText(dlg.GetPathName());
|
||||
}
|
||||
}
|
||||
void CTabProgram::OnBnClickedCoordinates()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
//CWnd *cTarget = ((CTargetDlg *)(this->GetParent());
|
||||
//(CEdBoxEditor *)(cTarget->GetDlgItem(IDC_POSX))
|
||||
}
|
||||
|
||||
void CTabProgram::OnBnClickedDesktopworkarea()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
}
|
||||
|
||||
void CTabProgram::OnBnClickedDesktopcenter()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
}
|
||||
|
@ -37,6 +37,10 @@ protected:
|
||||
// NOTE: the ClassWizard will add member functions here
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
afx_msg void OnBnClickedCoordinates();
|
||||
afx_msg void OnBnClickedDesktopworkarea();
|
||||
afx_msg void OnBnClickedDesktopcenter();
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
@ -43,6 +43,7 @@ void CTabWindow::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_REFRESHONRESIZE, cTarget->m_RefreshOnResize);
|
||||
DDX_Check(pDX, IDC_INIT8BPP, cTarget->m_Init8BPP);
|
||||
DDX_Check(pDX, IDC_INIT16BPP, cTarget->m_Init16BPP);
|
||||
DDX_Check(pDX, IDC_FIXD3DFRAME, cTarget->m_FixD3DFrame);
|
||||
}
|
||||
|
||||
BOOL CTabWindow::OnInitDialog()
|
||||
|
@ -21,6 +21,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CTargetDlg)
|
||||
m_DXVersion = -1;
|
||||
m_Coordinates = 0;
|
||||
m_EmulateSurface = FALSE;
|
||||
m_NoEmulateSurface = TRUE; // current default
|
||||
m_EmulateBuffer = FALSE;
|
||||
@ -39,8 +40,9 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_SetCompatibility = FALSE;
|
||||
m_LimitResources = FALSE;
|
||||
m_UnNotify = FALSE;
|
||||
m_Windowize = TRUE;
|
||||
m_Windowize = TRUE; // default true !!
|
||||
m_HookDLLs = FALSE;
|
||||
m_HookEnabled = TRUE; // default true !!
|
||||
m_NoBanner = FALSE;
|
||||
m_StartDebug = FALSE;
|
||||
m_FilePath = _T("");
|
||||
@ -75,6 +77,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_HookGDI = FALSE;
|
||||
m_HideMultiMonitor = FALSE;
|
||||
m_WallpaperMode = FALSE;
|
||||
m_FixD3DFrame = FALSE;
|
||||
m_HookChildWin = FALSE;
|
||||
m_MessageProc = FALSE;
|
||||
m_FixNCHITTEST = FALSE;
|
||||
@ -101,8 +104,8 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_MaxY = 0;
|
||||
m_MinX = 0;
|
||||
m_MinY = 0;
|
||||
m_PosX = 0;
|
||||
m_PosY = 0;
|
||||
m_PosX = 50;
|
||||
m_PosY = 50;
|
||||
m_SizX = 800;
|
||||
m_SizY = 600;
|
||||
m_MaxFPS = 0;
|
||||
|
@ -24,6 +24,7 @@ public:
|
||||
CDXTabCtrl m_tabdxTabCtrl;
|
||||
CEdit m_File;
|
||||
int m_DXVersion;
|
||||
int m_Coordinates;
|
||||
BOOL m_EmulateSurface;
|
||||
BOOL m_NoEmulateSurface;
|
||||
BOOL m_EmulateBuffer;
|
||||
@ -44,6 +45,7 @@ public:
|
||||
BOOL m_HookDLLs;
|
||||
BOOL m_NoBanner;
|
||||
BOOL m_StartDebug;
|
||||
BOOL m_HookEnabled;
|
||||
CString m_FilePath;
|
||||
CString m_Module;
|
||||
CString m_Title;
|
||||
@ -78,6 +80,7 @@ public:
|
||||
BOOL m_HookGDI;
|
||||
BOOL m_HideMultiMonitor;
|
||||
BOOL m_WallpaperMode;
|
||||
BOOL m_FixD3DFrame;
|
||||
BOOL m_HookChildWin;
|
||||
BOOL m_MessageProc;
|
||||
BOOL m_FixNCHITTEST;
|
||||
|
317
host/TlHelp32.h
Normal file
317
host/TlHelp32.h
Normal file
@ -0,0 +1,317 @@
|
||||
/*****************************************************************************\
|
||||
* *
|
||||
* tlhelp32.h - WIN32 tool help functions, types, and definitions *
|
||||
* *
|
||||
* Version 1.0 *
|
||||
* *
|
||||
* NOTE: windows.h/winbase.h must be #included first *
|
||||
* *
|
||||
* Copyright (c) Microsoft Corp. All rights reserved. *
|
||||
* *
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifndef _INC_TOOLHELP32
|
||||
#define _INC_TOOLHELP32
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Assume C declarations for C++ */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define MAX_MODULE_NAME32 255
|
||||
|
||||
/****** Shapshot function **********************************************/
|
||||
|
||||
HANDLE
|
||||
WINAPI
|
||||
CreateToolhelp32Snapshot(
|
||||
DWORD dwFlags,
|
||||
DWORD th32ProcessID
|
||||
);
|
||||
|
||||
//
|
||||
// The th32ProcessID argument is only used if TH32CS_SNAPHEAPLIST or
|
||||
// TH32CS_SNAPMODULE is specified. th32ProcessID == 0 means the current
|
||||
// process.
|
||||
//
|
||||
// NOTE that all of the snapshots are global except for the heap and module
|
||||
// lists which are process specific. To enumerate the heap or module
|
||||
// state for all WIN32 processes call with TH32CS_SNAPALL and the
|
||||
// current process. Then for each process in the TH32CS_SNAPPROCESS
|
||||
// list that isn't the current process, do a call with just
|
||||
// TH32CS_SNAPHEAPLIST and/or TH32CS_SNAPMODULE.
|
||||
//
|
||||
// dwFlags
|
||||
//
|
||||
#define TH32CS_SNAPHEAPLIST 0x00000001
|
||||
#define TH32CS_SNAPPROCESS 0x00000002
|
||||
#define TH32CS_SNAPTHREAD 0x00000004
|
||||
#define TH32CS_SNAPMODULE 0x00000008
|
||||
#define TH32CS_SNAPMODULE32 0x00000010
|
||||
#define TH32CS_SNAPALL (TH32CS_SNAPHEAPLIST | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD | TH32CS_SNAPMODULE)
|
||||
#define TH32CS_INHERIT 0x80000000
|
||||
//
|
||||
// Use CloseHandle to destroy the snapshot
|
||||
//
|
||||
|
||||
/****** heap walking ***************************************************/
|
||||
|
||||
typedef struct tagHEAPLIST32
|
||||
{
|
||||
SIZE_T dwSize;
|
||||
DWORD th32ProcessID; // owning process
|
||||
ULONG_PTR th32HeapID; // heap (in owning process's context!)
|
||||
DWORD dwFlags;
|
||||
} HEAPLIST32;
|
||||
typedef HEAPLIST32 * PHEAPLIST32;
|
||||
typedef HEAPLIST32 * LPHEAPLIST32;
|
||||
//
|
||||
// dwFlags
|
||||
//
|
||||
#define HF32_DEFAULT 1 // process's default heap
|
||||
#define HF32_SHARED 2 // is shared heap
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Heap32ListFirst(
|
||||
HANDLE hSnapshot,
|
||||
LPHEAPLIST32 lphl
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Heap32ListNext(
|
||||
HANDLE hSnapshot,
|
||||
LPHEAPLIST32 lphl
|
||||
);
|
||||
|
||||
typedef struct tagHEAPENTRY32
|
||||
{
|
||||
SIZE_T dwSize;
|
||||
HANDLE hHandle; // Handle of this heap block
|
||||
ULONG_PTR dwAddress; // Linear address of start of block
|
||||
SIZE_T dwBlockSize; // Size of block in bytes
|
||||
DWORD dwFlags;
|
||||
DWORD dwLockCount;
|
||||
DWORD dwResvd;
|
||||
DWORD th32ProcessID; // owning process
|
||||
ULONG_PTR th32HeapID; // heap block is in
|
||||
} HEAPENTRY32;
|
||||
typedef HEAPENTRY32 * PHEAPENTRY32;
|
||||
typedef HEAPENTRY32 * LPHEAPENTRY32;
|
||||
//
|
||||
// dwFlags
|
||||
//
|
||||
#define LF32_FIXED 0x00000001
|
||||
#define LF32_FREE 0x00000002
|
||||
#define LF32_MOVEABLE 0x00000004
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Heap32First(
|
||||
LPHEAPENTRY32 lphe,
|
||||
DWORD th32ProcessID,
|
||||
ULONG_PTR th32HeapID
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Heap32Next(
|
||||
LPHEAPENTRY32 lphe
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Toolhelp32ReadProcessMemory(
|
||||
DWORD th32ProcessID,
|
||||
LPCVOID lpBaseAddress,
|
||||
LPVOID lpBuffer,
|
||||
SIZE_T cbRead,
|
||||
SIZE_T *lpNumberOfBytesRead
|
||||
);
|
||||
|
||||
/***** Process walking *************************************************/
|
||||
|
||||
typedef struct tagPROCESSENTRY32W
|
||||
{
|
||||
DWORD dwSize;
|
||||
DWORD cntUsage;
|
||||
DWORD th32ProcessID; // this process
|
||||
ULONG_PTR th32DefaultHeapID;
|
||||
DWORD th32ModuleID; // associated exe
|
||||
DWORD cntThreads;
|
||||
DWORD th32ParentProcessID; // this process's parent process
|
||||
LONG pcPriClassBase; // Base priority of process's threads
|
||||
DWORD dwFlags;
|
||||
WCHAR szExeFile[MAX_PATH]; // Path
|
||||
} PROCESSENTRY32W;
|
||||
typedef PROCESSENTRY32W * PPROCESSENTRY32W;
|
||||
typedef PROCESSENTRY32W * LPPROCESSENTRY32W;
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Process32FirstW(
|
||||
HANDLE hSnapshot,
|
||||
LPPROCESSENTRY32W lppe
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Process32NextW(
|
||||
HANDLE hSnapshot,
|
||||
LPPROCESSENTRY32W lppe
|
||||
);
|
||||
|
||||
typedef struct tagPROCESSENTRY32
|
||||
{
|
||||
DWORD dwSize;
|
||||
DWORD cntUsage;
|
||||
DWORD th32ProcessID; // this process
|
||||
ULONG_PTR th32DefaultHeapID;
|
||||
DWORD th32ModuleID; // associated exe
|
||||
DWORD cntThreads;
|
||||
DWORD th32ParentProcessID; // this process's parent process
|
||||
LONG pcPriClassBase; // Base priority of process's threads
|
||||
DWORD dwFlags;
|
||||
CHAR szExeFile[MAX_PATH]; // Path
|
||||
} PROCESSENTRY32;
|
||||
typedef PROCESSENTRY32 * PPROCESSENTRY32;
|
||||
typedef PROCESSENTRY32 * LPPROCESSENTRY32;
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Process32First(
|
||||
HANDLE hSnapshot,
|
||||
LPPROCESSENTRY32 lppe
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Process32Next(
|
||||
HANDLE hSnapshot,
|
||||
LPPROCESSENTRY32 lppe
|
||||
);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define Process32First Process32FirstW
|
||||
#define Process32Next Process32NextW
|
||||
#define PROCESSENTRY32 PROCESSENTRY32W
|
||||
#define PPROCESSENTRY32 PPROCESSENTRY32W
|
||||
#define LPPROCESSENTRY32 LPPROCESSENTRY32W
|
||||
#endif // !UNICODE
|
||||
|
||||
/***** Thread walking **************************************************/
|
||||
|
||||
typedef struct tagTHREADENTRY32
|
||||
{
|
||||
DWORD dwSize;
|
||||
DWORD cntUsage;
|
||||
DWORD th32ThreadID; // this thread
|
||||
DWORD th32OwnerProcessID; // Process this thread is associated with
|
||||
LONG tpBasePri;
|
||||
LONG tpDeltaPri;
|
||||
DWORD dwFlags;
|
||||
} THREADENTRY32;
|
||||
typedef THREADENTRY32 * PTHREADENTRY32;
|
||||
typedef THREADENTRY32 * LPTHREADENTRY32;
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Thread32First(
|
||||
HANDLE hSnapshot,
|
||||
LPTHREADENTRY32 lpte
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Thread32Next(
|
||||
HANDLE hSnapshot,
|
||||
LPTHREADENTRY32 lpte
|
||||
);
|
||||
|
||||
/***** Module walking *************************************************/
|
||||
|
||||
typedef struct tagMODULEENTRY32W
|
||||
{
|
||||
DWORD dwSize;
|
||||
DWORD th32ModuleID; // This module
|
||||
DWORD th32ProcessID; // owning process
|
||||
DWORD GlblcntUsage; // Global usage count on the module
|
||||
DWORD ProccntUsage; // Module usage count in th32ProcessID's context
|
||||
BYTE * modBaseAddr; // Base address of module in th32ProcessID's context
|
||||
DWORD modBaseSize; // Size in bytes of module starting at modBaseAddr
|
||||
HMODULE hModule; // The hModule of this module in th32ProcessID's context
|
||||
WCHAR szModule[MAX_MODULE_NAME32 + 1];
|
||||
WCHAR szExePath[MAX_PATH];
|
||||
} MODULEENTRY32W;
|
||||
typedef MODULEENTRY32W * PMODULEENTRY32W;
|
||||
typedef MODULEENTRY32W * LPMODULEENTRY32W;
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Module32FirstW(
|
||||
HANDLE hSnapshot,
|
||||
LPMODULEENTRY32W lpme
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Module32NextW(
|
||||
HANDLE hSnapshot,
|
||||
LPMODULEENTRY32W lpme
|
||||
);
|
||||
|
||||
|
||||
typedef struct tagMODULEENTRY32
|
||||
{
|
||||
DWORD dwSize;
|
||||
DWORD th32ModuleID; // This module
|
||||
DWORD th32ProcessID; // owning process
|
||||
DWORD GlblcntUsage; // Global usage count on the module
|
||||
DWORD ProccntUsage; // Module usage count in th32ProcessID's context
|
||||
BYTE * modBaseAddr; // Base address of module in th32ProcessID's context
|
||||
DWORD modBaseSize; // Size in bytes of module starting at modBaseAddr
|
||||
HMODULE hModule; // The hModule of this module in th32ProcessID's context
|
||||
char szModule[MAX_MODULE_NAME32 + 1];
|
||||
char szExePath[MAX_PATH];
|
||||
} MODULEENTRY32;
|
||||
typedef MODULEENTRY32 * PMODULEENTRY32;
|
||||
typedef MODULEENTRY32 * LPMODULEENTRY32;
|
||||
|
||||
//
|
||||
// NOTE CAREFULLY that the modBaseAddr and hModule fields are valid ONLY
|
||||
// in th32ProcessID's process context.
|
||||
//
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Module32First(
|
||||
HANDLE hSnapshot,
|
||||
LPMODULEENTRY32 lpme
|
||||
);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
Module32Next(
|
||||
HANDLE hSnapshot,
|
||||
LPMODULEENTRY32 lpme
|
||||
);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define Module32First Module32FirstW
|
||||
#define Module32Next Module32NextW
|
||||
#define MODULEENTRY32 MODULEENTRY32W
|
||||
#define PMODULEENTRY32 PMODULEENTRY32W
|
||||
#define LPMODULEENTRY32 LPMODULEENTRY32W
|
||||
#endif // !UNICODE
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _INC_TOOLHELP32
|
||||
|
@ -3,3 +3,26 @@ posx=1104
|
||||
posy=310
|
||||
sizx=303
|
||||
sizy=138
|
||||
[target]
|
||||
title0=speeddemo.exe
|
||||
path0=D:\Games\Need For Speed Underground Demo\speeddemo.exe
|
||||
module0=
|
||||
opengllib0=
|
||||
ver0=0
|
||||
flag0=0
|
||||
flagg0=134217728
|
||||
flagh0=-842150435
|
||||
flagi0=-842150451
|
||||
tflag0=0
|
||||
initx0=0
|
||||
inity0=0
|
||||
minx0=0
|
||||
miny0=0
|
||||
maxx0=0
|
||||
maxy0=0
|
||||
posx0=0
|
||||
posy0=0
|
||||
sizx0=800
|
||||
sizy0=600
|
||||
maxfps0=0
|
||||
initts0=0
|
||||
|
Binary file not shown.
@ -82,13 +82,19 @@ BEGIN
|
||||
BEGIN
|
||||
MENUITEM "Save", ID_FILE_SAVE
|
||||
MENUITEM "&Sort programs list", ID_FILE_SORTPROGRAMSLIST
|
||||
MENUITEM "&Import ...", ID_FILE_IMPORT
|
||||
MENUITEM "&Clear all logs", ID_FILE_CLEARALLLOGS
|
||||
POPUP "Hook"
|
||||
BEGIN
|
||||
MENUITEM "Start", ID_HOOK_START
|
||||
MENUITEM "Stop", ID_HOOK_STOP
|
||||
END
|
||||
MENUITEM "&Kill", ID_TASK_KILL
|
||||
POPUP "&Process"
|
||||
BEGIN
|
||||
MENUITEM "&Pause", ID_TASK_PAUSE
|
||||
MENUITEM "&Resume", ID_TASK_RESUME
|
||||
MENUITEM "&Kill", ID_TASK_KILL
|
||||
END
|
||||
MENUITEM "Move to Tray", ID_FILE_GOTOTRAYICON
|
||||
MENUITEM "e&Xit", ID_DXAPP_EXIT
|
||||
END
|
||||
@ -130,7 +136,7 @@ BEGIN
|
||||
MENUITEM "&View", ID_PLOG_VIEW
|
||||
MENUITEM "&Delete", ID_PLOG_DELETE
|
||||
END
|
||||
MENUITEM "&Kill ", ID_TASK_KILL
|
||||
MENUITEM "e&Xport ...", ID_PEXPORT
|
||||
END
|
||||
END
|
||||
|
||||
@ -252,16 +258,20 @@ BEGIN
|
||||
EDITTEXT IDC_POSY,55,210,19,14,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
|
||||
EDITTEXT IDC_SIZX,85,210,19,14,ES_AUTOHSCROLL,WS_EX_RIGHT
|
||||
EDITTEXT IDC_SIZY,113,210,19,14,ES_AUTOHSCROLL,WS_EX_RIGHT
|
||||
CONTROL "Do not notify on task switch",IDC_UNNOTIFY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,112,124,12
|
||||
CONTROL "Optimize CPU (DirectX1 - 7)",IDC_SAVELOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,122,123,12
|
||||
CONTROL "Intercept Alt-F4 key",IDC_HANDLEALTF4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,132,109,12
|
||||
CONTROL "Run in Window",IDC_WINDOWIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,142,124,12
|
||||
CONTROL "Do not notify on task switch",IDC_UNNOTIFY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,122,124,10
|
||||
CONTROL "Optimize CPU (DirectX1 - 7)",IDC_SAVELOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,152,109,10
|
||||
CONTROL "Intercept Alt-F4 key",IDC_HANDLEALTF4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,132,109,10
|
||||
CONTROL "Run in Window",IDC_WINDOWIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,142,124,10
|
||||
GROUPBOX "Generic",IDC_STATIC,7,103,286,88
|
||||
CONTROL "No banner",IDC_NOBANNER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,122,108,12
|
||||
CONTROL "use DLL Injection",IDC_STARTDEBUG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,132,100,12
|
||||
CONTROL "3D Wireframe",IDC_WIREFRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,142,115,12
|
||||
CONTROL "No banner",IDC_NOBANNER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,122,108,10
|
||||
CONTROL "use DLL Injection",IDC_STARTDEBUG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,132,100,10
|
||||
CONTROL "3D Wireframe",IDC_WIREFRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,142,96,10
|
||||
CONTROL "Remap Client Rect",IDC_CLIENTREMAPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,112,115,10
|
||||
CONTROL "Hook all DLLs",IDC_HOOKDLLS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,152,124,12
|
||||
CONTROL "Hook all DLLs",IDC_HOOKDLLS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,152,124,10
|
||||
CONTROL "Hook enabled",IDC_HOOKENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,112,124,10
|
||||
CONTROL "X,Y coordinates",IDC_COORDINATES,"Button",BS_AUTORADIOBUTTON | WS_GROUP,170,198,95,10
|
||||
CONTROL "Desktop work area",IDC_DESKTOPWORKAREA,"Button",BS_AUTORADIOBUTTON,170,208,95,10
|
||||
CONTROL "Desktop center",IDC_DESKTOPCENTER,"Button",BS_AUTORADIOBUTTON,170,218,95,10
|
||||
END
|
||||
|
||||
IDD_TAB_LOG DIALOGEX 0, 0, 300, 240
|
||||
@ -370,7 +380,7 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "Fix Window Frame Style",IDC_FIXWINFRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,16,120,10
|
||||
CONTROL "Prevent Win Maximize",IDC_PREVENTMAXIMIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,28,115,10
|
||||
GROUPBOX "Windows handling",IDC_STATIC,6,4,140,193
|
||||
GROUPBOX "Windows handling",IDC_STATIC,6,4,140,229
|
||||
CONTROL "Lock win coordinates",IDC_LOCKWINPOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,39,115,10
|
||||
CONTROL "Hook CHILD windows",IDC_HOOKCHILDWIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,62,115,10
|
||||
CONTROL "Recover screen mode",IDC_RECOVERSCREENMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,74,115,10
|
||||
@ -384,6 +394,7 @@ BEGIN
|
||||
CONTROL "Force win resize",IDC_FORCEWINRESIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,154,115,10
|
||||
CONTROL "Hide multi-monitor config.",IDC_HIDEMULTIMONITOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,166,115,10
|
||||
CONTROL "Wallpaper mode",IDC_WALLPAPERMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,178,115,10
|
||||
CONTROL "Fix Windows Frame in D3D",IDC_FIXD3DFRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,188,115,10
|
||||
END
|
||||
|
||||
IDD_TAB_EMPTY DIALOGEX 0, 0, 300, 240
|
||||
@ -589,6 +600,14 @@ END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_BIGICONS BITMAP "res\\bigicons.bmp"
|
||||
IDB_SMALLICONS BITMAP "res\\smallicons.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
|
Binary file not shown.
@ -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"
|
||||
@ -515,6 +515,10 @@
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\res\bigicons.bmp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\dxw1.ico"
|
||||
>
|
||||
@ -567,6 +571,10 @@
|
||||
RelativePath=".\res\run-90.ico"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\smallicons.bmp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "shlwapi.h"
|
||||
#include "TlHelp32.h"
|
||||
|
||||
#include "dxwndhost.h"
|
||||
|
||||
@ -43,8 +44,12 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView)
|
||||
ON_COMMAND(ID_LOG_VIEW, OnViewLog)
|
||||
ON_COMMAND(ID_LOG_DELETE, OnDeleteLog)
|
||||
ON_COMMAND(ID_TASK_KILL, OnKill)
|
||||
ON_COMMAND(ID_TASK_PAUSE, OnPause)
|
||||
ON_COMMAND(ID_TASK_RESUME, OnResume)
|
||||
ON_COMMAND(ID_ADD, OnAdd)
|
||||
ON_COMMAND(ID_MODIFY, OnModify)
|
||||
ON_COMMAND(ID_PEXPORT, OnExport)
|
||||
ON_COMMAND(ID_FILE_IMPORT, OnImport)
|
||||
ON_COMMAND(ID_DELETE, OnDelete)
|
||||
ON_COMMAND(ID_FILE_SORTPROGRAMSLIST, OnSort)
|
||||
ON_COMMAND(ID_FILE_CLEARALLLOGS, OnClearAllLogs)
|
||||
@ -54,10 +59,6 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView)
|
||||
ON_COMMAND(ID_HOOK_STOP, OnHookStop)
|
||||
ON_COMMAND(ID_DXAPP_EXIT, OnExit)
|
||||
ON_WM_RBUTTONDOWN()
|
||||
ON_WM_DESTROY()
|
||||
ON_WM_MOVE()
|
||||
ON_WM_SIZE()
|
||||
ON_WM_DESTROY()
|
||||
ON_COMMAND(ID_RUN, OnRun)
|
||||
ON_COMMAND(ID_TRAY_RESTORE, OnTrayRestore)
|
||||
ON_COMMAND(ID_VIEW_STATUS, OnViewStatus)
|
||||
@ -92,170 +93,201 @@ static void RevertScreenChanges(DEVMODE *InitDevMode)
|
||||
}
|
||||
}
|
||||
|
||||
static void SaveConfigItem(TARGETMAP *TargetMap, char *Title, int i, char *InitPath)
|
||||
{
|
||||
char key[32], val[32];
|
||||
sprintf_s(key, sizeof(key), "title%i", i);
|
||||
WritePrivateProfileString("target", key, Title, InitPath);
|
||||
sprintf_s(key, sizeof(key), "path%i", i);
|
||||
WritePrivateProfileString("target", key, TargetMap->path, InitPath);
|
||||
sprintf_s(key, sizeof(key), "module%i", i);
|
||||
WritePrivateProfileString("target", key, TargetMap->module, InitPath);
|
||||
sprintf_s(key, sizeof(key), "opengllib%i", i);
|
||||
WritePrivateProfileString("target", key, TargetMap->OpenGLLib, InitPath);
|
||||
sprintf_s(key, sizeof(key), "ver%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->dxversion);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "coord%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->coordinates);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flag%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->flags);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagg%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->flags2);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagh%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->flags3);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagi%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->flags4);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "tflag%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->tflags);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "initx%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->initx);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "inity%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->inity);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "minx%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->minx);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "miny%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->miny);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxx%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->maxx);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxy%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->maxy);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "posx%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->posx);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "posy%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->posy);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "sizx%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->sizx);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "sizy%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->sizy);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxfps%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->MaxFPS);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "initts%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->InitTS);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
}
|
||||
|
||||
static void ClearTarget(int i, char *InitPath)
|
||||
{
|
||||
char key[32];
|
||||
sprintf_s(key, sizeof(key), "path%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "ver%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "coord%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flag%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagg%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagh%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagi%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "tflag%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "initx%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "inity%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "minx%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "miny%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxx%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxy%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "posx%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "posy%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "sizx%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "sizy%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxfps%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "initts%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
}
|
||||
|
||||
static int LoadConfigItem(TARGETMAP *TargetMap, char *Title, int i, char *InitPath)
|
||||
{
|
||||
char key[32];
|
||||
sprintf_s(key, sizeof(key), "path%i", i);
|
||||
GetPrivateProfileString("target", key, "", TargetMap->path, MAX_PATH, InitPath);
|
||||
if(!TargetMap->path[0]) return FALSE;
|
||||
sprintf_s(key, sizeof(key), "title%i", i);
|
||||
GetPrivateProfileString("target", key, "", Title, sizeof(PRIVATEMAP)-1, InitPath);
|
||||
sprintf_s(key, sizeof(key), "module%i", i);
|
||||
GetPrivateProfileString("target", key, "", TargetMap->module, sizeof(TargetMap->module)-1, InitPath);
|
||||
sprintf_s(key, sizeof(key), "opengllib%i", i);
|
||||
GetPrivateProfileString("target", key, "", TargetMap->OpenGLLib, sizeof(TargetMap->OpenGLLib)-1, InitPath);
|
||||
sprintf_s(key, sizeof(key), "ver%i", i);
|
||||
TargetMap->dxversion = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "coord%i", i);
|
||||
TargetMap->coordinates = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flag%i", i);
|
||||
TargetMap->flags = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagg%i", i);
|
||||
TargetMap->flags2 = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagh%i", i);
|
||||
TargetMap->flags3 = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagi%i", i);
|
||||
TargetMap->flags4 = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "tflag%i", i);
|
||||
TargetMap->tflags = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "initx%i", i);
|
||||
TargetMap->initx = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "inity%i", i);
|
||||
TargetMap->inity = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "minx%i", i);
|
||||
TargetMap->minx = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "miny%i", i);
|
||||
TargetMap->miny = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxx%i", i);
|
||||
TargetMap->maxx = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxy%i", i);
|
||||
TargetMap->maxy = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "posx%i", i);
|
||||
TargetMap->posx = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "posy%i", i);
|
||||
TargetMap->posy = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "sizx%i", i);
|
||||
TargetMap->sizx = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "sizy%i", i);
|
||||
TargetMap->sizy = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxfps%i", i);
|
||||
TargetMap->MaxFPS = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "initts%i", i);
|
||||
TargetMap->InitTS = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int SetTargetIcon(TARGETMAP tm)
|
||||
{
|
||||
FILE *target;
|
||||
target = fopen(tm.path, "r");
|
||||
if (target==NULL) return 3;
|
||||
fclose(target);
|
||||
if (tm.flags3 & HOOKENABLED) return (tm.flags2 & STARTDEBUG) ? 2 : 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDxwndhostView class constructor / destructor
|
||||
|
||||
CDxwndhostView::CDxwndhostView()
|
||||
{
|
||||
// EnumDisplaySettings(NULL, ENUM_REGISTRY_SETTINGS, &this->InitDevMode);
|
||||
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &this->InitDevMode);
|
||||
}
|
||||
|
||||
void CDxwndhostView::OnMove(int x, int y)
|
||||
{
|
||||
CWnd::OnMove(x, y);
|
||||
this->LastX=x;
|
||||
this->LastY=y;
|
||||
}
|
||||
|
||||
void CDxwndhostView::OnSize(UINT nSize, int cx, int cy)
|
||||
{
|
||||
this->LastCX=cx;
|
||||
this->LastCY=cy;
|
||||
// save x,y pos since OnMove is not working .... why?
|
||||
RECT rect;
|
||||
this->GetActiveWindow()->GetWindowRect(&rect);
|
||||
this->LastX=rect.left;
|
||||
this->LastY=rect.top;
|
||||
}
|
||||
|
||||
void CDxwndhostView::SaveWinPos()
|
||||
{
|
||||
char val[32];
|
||||
//RECT rect;
|
||||
|
||||
// save window rect
|
||||
//this->GetActiveWindow()->GetWindowRect(&rect);
|
||||
//if((rect.top < 0) || (rect.bottom < 0) || (rect.left < 0) || (rect.right < 0)) return;
|
||||
//sprintf_s(val, sizeof(val), "%i", rect.left);
|
||||
//WritePrivateProfileString("window", "posx", val, InitPath);
|
||||
//sprintf_s(val, sizeof(val), "%i", rect.top);
|
||||
//WritePrivateProfileString("window", "posy", val, InitPath);
|
||||
//sprintf_s(val, sizeof(val), "%i", rect.right-rect.left);
|
||||
//WritePrivateProfileString("window", "sizx", val, InitPath);
|
||||
//sprintf_s(val, sizeof(val), "%i", rect.bottom-rect.top);
|
||||
//WritePrivateProfileString("window", "sizy", val, InitPath);
|
||||
sprintf_s(val, sizeof(val), "%i", this->LastX);
|
||||
WritePrivateProfileString("window", "posx", val, InitPath);
|
||||
sprintf_s(val, sizeof(val), "%i", this->LastY);
|
||||
WritePrivateProfileString("window", "posy", val, InitPath);
|
||||
sprintf_s(val, sizeof(val), "%i", this->LastCX);
|
||||
WritePrivateProfileString("window", "sizx", val, InitPath);
|
||||
sprintf_s(val, sizeof(val), "%i", this->LastCY);
|
||||
WritePrivateProfileString("window", "sizy", val, InitPath);
|
||||
}
|
||||
|
||||
void CDxwndhostView::SaveConfigFile()
|
||||
{
|
||||
int i;
|
||||
char key[32], val[32];
|
||||
|
||||
for(i = 0; i < MAXTARGETS; i ++){
|
||||
if(!TargetMaps[i].path[0]) break;
|
||||
sprintf_s(key, sizeof(key), "title%i", i);
|
||||
WritePrivateProfileString("target", key, TitleMaps[i].title, InitPath);
|
||||
sprintf_s(key, sizeof(key), "path%i", i);
|
||||
WritePrivateProfileString("target", key, TargetMaps[i].path, InitPath);
|
||||
sprintf_s(key, sizeof(key), "module%i", i);
|
||||
WritePrivateProfileString("target", key, TargetMaps[i].module, InitPath);
|
||||
sprintf_s(key, sizeof(key), "opengllib%i", i);
|
||||
WritePrivateProfileString("target", key, TargetMaps[i].OpenGLLib, InitPath);
|
||||
sprintf_s(key, sizeof(key), "ver%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].dxversion);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flag%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].flags);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagg%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].flags2);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagh%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].flags3);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagi%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].flags4);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "tflag%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].tflags);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "initx%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].initx);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "inity%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].inity);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "minx%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].minx);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "miny%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].miny);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxx%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].maxx);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxy%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].maxy);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "posx%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].posx);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "posy%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].posy);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "sizx%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].sizx);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "sizy%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].sizy);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxfps%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].MaxFPS);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "initts%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].InitTS);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
SaveConfigItem(&TargetMaps[i], TitleMaps[i].title, i, InitPath);
|
||||
}
|
||||
for(; i < MAXTARGETS; i ++){
|
||||
sprintf_s(key, sizeof(key), "path%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "ver%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flag%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagg%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagh%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagi%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "tflag%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "initx%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "inity%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "minx%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "miny%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxx%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxy%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "posx%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "posy%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "sizx%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "sizy%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxfps%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "initts%i", i);
|
||||
WritePrivateProfileString("target", key, 0, InitPath);
|
||||
}
|
||||
|
||||
for(; i < MAXTARGETS; i ++) ClearTarget(i, InitPath);
|
||||
this->isUpdated=FALSE;
|
||||
}
|
||||
|
||||
@ -278,16 +310,9 @@ CDxwndhostView::~CDxwndhostView()
|
||||
}
|
||||
}
|
||||
|
||||
void CDxwndhostView::OnDestroy()
|
||||
{
|
||||
this->OnExit();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void CDxwndhostView::OnExit()
|
||||
{
|
||||
// check for running apps ....
|
||||
this->SaveWinPos();
|
||||
if (GetHookStatus(NULL)==DXW_RUNNING){
|
||||
if (MessageBoxEx(0,
|
||||
"A hooked task is still running.\n"
|
||||
@ -320,7 +345,27 @@ void CDxwndhostView::OnInitialUpdate()
|
||||
LV_COLUMN listcol;
|
||||
LV_ITEM listitem;
|
||||
int i;
|
||||
char key[32];
|
||||
|
||||
// Create 256 color image lists
|
||||
HIMAGELIST hList = ImageList_Create(32,32, ILC_COLOR8 |ILC_MASK , 4, 1);
|
||||
m_cImageListNormal.Attach(hList);
|
||||
|
||||
hList = ImageList_Create(16, 16, ILC_COLOR8 | ILC_MASK, 4, 1);
|
||||
m_cImageListSmall.Attach(hList);
|
||||
|
||||
// Load the large icons
|
||||
CBitmap cBmp;
|
||||
cBmp.LoadBitmap(IDB_BIGICONS);
|
||||
m_cImageListNormal.Add(&cBmp, RGB(255,0, 255));
|
||||
cBmp.DeleteObject();
|
||||
|
||||
// Load the small icons
|
||||
cBmp.LoadBitmap(IDB_SMALLICONS);
|
||||
m_cImageListSmall.Add(&cBmp, RGB(255,0, 255));
|
||||
|
||||
// Attach them
|
||||
listctrl.SetImageList(&m_cImageListNormal, LVSIL_NORMAL);
|
||||
listctrl.SetImageList(&m_cImageListSmall, LVSIL_SMALL);
|
||||
|
||||
listcol.mask = LVCF_WIDTH;
|
||||
listcol.cx = 100;
|
||||
@ -329,57 +374,16 @@ void CDxwndhostView::OnInitialUpdate()
|
||||
GetCurrentDirectory(MAX_PATH, InitPath);
|
||||
strcat_s(InitPath, sizeof(InitPath), "\\");
|
||||
strcat_s(InitPath, sizeof(InitPath), m_ConfigFileName);
|
||||
listctrl.InsertColumn(0, &listcol);
|
||||
|
||||
for(i = 0; i < MAXTARGETS; i ++){
|
||||
sprintf_s(key, sizeof(key), "path%i", i);
|
||||
GetPrivateProfileString("target", key, "", TargetMaps[i].path, MAX_PATH, InitPath);
|
||||
if(!TargetMaps[i].path[0]) break;
|
||||
sprintf_s(key, sizeof(key), "title%i", i);
|
||||
GetPrivateProfileString("target", key, "", TitleMaps[i].title, sizeof(TitleMaps[i].title)-1, InitPath);
|
||||
sprintf_s(key, sizeof(key), "module%i", i);
|
||||
GetPrivateProfileString("target", key, "", TargetMaps[i].module, sizeof(TargetMaps[i].module)-1, InitPath);
|
||||
sprintf_s(key, sizeof(key), "opengllib%i", i);
|
||||
GetPrivateProfileString("target", key, "", TargetMaps[i].OpenGLLib, sizeof(TargetMaps[i].OpenGLLib)-1, InitPath);
|
||||
sprintf_s(key, sizeof(key), "ver%i", i);
|
||||
TargetMaps[i].dxversion = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flag%i", i);
|
||||
TargetMaps[i].flags = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagg%i", i);
|
||||
TargetMaps[i].flags2 = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagh%i", i);
|
||||
TargetMaps[i].flags3 = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "flagi%i", i);
|
||||
TargetMaps[i].flags4 = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "tflag%i", i);
|
||||
TargetMaps[i].tflags = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "initx%i", i);
|
||||
TargetMaps[i].initx = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "inity%i", i);
|
||||
TargetMaps[i].inity = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "minx%i", i);
|
||||
TargetMaps[i].minx = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "miny%i", i);
|
||||
TargetMaps[i].miny = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxx%i", i);
|
||||
TargetMaps[i].maxx = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxy%i", i);
|
||||
TargetMaps[i].maxy = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "posx%i", i);
|
||||
TargetMaps[i].posx = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "posy%i", i);
|
||||
TargetMaps[i].posy = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "sizx%i", i);
|
||||
TargetMaps[i].sizx = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "sizy%i", i);
|
||||
TargetMaps[i].sizy = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "maxfps%i", i);
|
||||
TargetMaps[i].MaxFPS = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
sprintf_s(key, sizeof(key), "initts%i", i);
|
||||
TargetMaps[i].InitTS = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
listitem.mask = LVIF_TEXT;
|
||||
FILE *target;
|
||||
if (!LoadConfigItem(&TargetMaps[i], TitleMaps[i].title, i, InitPath)) break;
|
||||
listitem.mask = LVIF_TEXT | LVIF_IMAGE;
|
||||
listitem.iItem = i;
|
||||
listitem.iSubItem = 0;
|
||||
listitem.pszText = TitleMaps[i].title;
|
||||
listitem.iImage = SetTargetIcon(TargetMaps[i]);
|
||||
listctrl.InsertItem(&listitem);
|
||||
}
|
||||
for(; i < MAXTARGETS; i ++) TargetMaps[i].path[0] = 0;
|
||||
@ -424,9 +428,62 @@ void CDxwndhostView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CDxwndhostView::OnExport()
|
||||
{
|
||||
int i;
|
||||
char path[MAX_PATH];
|
||||
CListCtrl& listctrl = GetListCtrl();
|
||||
POSITION pos;
|
||||
if(!listctrl.GetSelectedCount()) return;
|
||||
pos = listctrl.GetFirstSelectedItemPosition();
|
||||
i = listctrl.GetNextSelectedItem(pos);
|
||||
//path[0]=0;
|
||||
strcpy_s(path, MAX_PATH, TitleMaps[i].title);
|
||||
CFileDialog dlg( FALSE, "*.dxw", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
|
||||
"dxwnd task config (*.dxw)|*.dxw|All Files (*.*)|*.*||", this);
|
||||
if( dlg.DoModal() == IDOK)
|
||||
SaveConfigItem(&TargetMaps[i], TitleMaps[i].title, 0, dlg.GetPathName().GetBuffer());
|
||||
}
|
||||
|
||||
void CDxwndhostView::OnImport()
|
||||
{
|
||||
int i;
|
||||
char path[MAX_PATH];
|
||||
for (i=0; strlen(TargetMaps[i].path) && i<MAXTARGETS; i++)
|
||||
;
|
||||
if (i==MAXTARGETS) return;
|
||||
path[0]=0;
|
||||
CFileDialog dlg( TRUE, "*.dxw", path, OFN_FILEMUSTEXIST,
|
||||
"dxwnd task config (*.dxw)|*.dxw|All Files (*.*)|*.*||", this);
|
||||
if( dlg.DoModal() == IDOK){
|
||||
LV_ITEM listitem;
|
||||
CListCtrl& listctrl = GetListCtrl();
|
||||
|
||||
LoadConfigItem(&TargetMaps[i], TitleMaps[i].title, 0, dlg.GetPathName().GetBuffer());
|
||||
|
||||
listitem.mask = LVIF_TEXT | LVIF_IMAGE;
|
||||
listitem.iItem = i;
|
||||
listitem.iSubItem = 0;
|
||||
listitem.iImage = SetTargetIcon(TargetMaps[i]);
|
||||
if (strlen(TitleMaps[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);
|
||||
}
|
||||
|
||||
listitem.pszText = TitleMaps[i].title;
|
||||
listctrl.InsertItem(&listitem);
|
||||
Resize();
|
||||
SetTarget(TargetMaps);
|
||||
this->isUpdated=TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void CDxwndhostView::OnModify()
|
||||
{
|
||||
// TODO: Please add a command handler code here.
|
||||
int i;
|
||||
CTargetDlg dlg;
|
||||
POSITION pos;
|
||||
@ -438,6 +495,7 @@ void CDxwndhostView::OnModify()
|
||||
i = listctrl.GetNextSelectedItem(pos);
|
||||
dlg.m_DXVersion = TargetMaps[i].dxversion;
|
||||
if(dlg.m_DXVersion > 6) dlg.m_DXVersion -= 5;
|
||||
dlg.m_Coordinates = TargetMaps[i].coordinates;
|
||||
dlg.m_FilePath = TargetMaps[i].path;
|
||||
dlg.m_Module = TargetMaps[i].module;
|
||||
dlg.m_OpenGLLib = TargetMaps[i].OpenGLLib;
|
||||
@ -445,6 +503,7 @@ void CDxwndhostView::OnModify()
|
||||
dlg.m_UnNotify = TargetMaps[i].flags & UNNOTIFY ? 1 : 0;
|
||||
dlg.m_Windowize = TargetMaps[i].flags2 & WINDOWIZE ? 1 : 0;
|
||||
dlg.m_HookDLLs = TargetMaps[i].flags3 & HOOKDLLS ? 1 : 0;
|
||||
dlg.m_HookEnabled = TargetMaps[i].flags3 & HOOKENABLED ? 1 : 0;
|
||||
dlg.m_NoBanner = TargetMaps[i].flags2 & NOBANNER ? 1 : 0;
|
||||
dlg.m_StartDebug = TargetMaps[i].flags2 & STARTDEBUG ? 1 : 0;
|
||||
dlg.m_EmulateSurface = TargetMaps[i].flags & EMULATESURFACE ? 1 : 0;
|
||||
@ -497,6 +556,7 @@ void CDxwndhostView::OnModify()
|
||||
dlg.m_HookGDI = TargetMaps[i].flags2 & HOOKGDI ? 1 : 0;
|
||||
dlg.m_HideMultiMonitor = TargetMaps[i].flags2 & HIDEMULTIMONITOR ? 1 : 0;
|
||||
dlg.m_WallpaperMode = TargetMaps[i].flags2 & WALLPAPERMODE ? 1 : 0;
|
||||
dlg.m_FixD3DFrame = TargetMaps[i].flags3 & FIXD3DFRAME ? 1 : 0;
|
||||
dlg.m_HookChildWin = TargetMaps[i].flags & HOOKCHILDWIN ? 1 : 0;
|
||||
dlg.m_MessageProc = TargetMaps[i].flags & MESSAGEPROC ? 1 : 0;
|
||||
dlg.m_FixNCHITTEST = TargetMaps[i].flags2 & FIXNCHITTEST ? 1 : 0;
|
||||
@ -537,6 +597,7 @@ void CDxwndhostView::OnModify()
|
||||
strcpy_s(TitleMaps[i].title, sizeof(TitleMaps[i].title), dlg.m_Title);
|
||||
if(dlg.m_DXVersion > 1) dlg.m_DXVersion += 5;
|
||||
TargetMaps[i].dxversion = dlg.m_DXVersion;
|
||||
TargetMaps[i].coordinates = dlg.m_Coordinates;
|
||||
TargetMaps[i].flags = 0;
|
||||
TargetMaps[i].flags2 = 0;
|
||||
TargetMaps[i].flags3 = 0;
|
||||
@ -545,6 +606,7 @@ void CDxwndhostView::OnModify()
|
||||
if(dlg.m_UnNotify) TargetMaps[i].flags |= UNNOTIFY;
|
||||
if(dlg.m_Windowize) TargetMaps[i].flags2 |= WINDOWIZE;
|
||||
if(dlg.m_HookDLLs) TargetMaps[i].flags3 |= HOOKDLLS;
|
||||
if(dlg.m_HookEnabled) TargetMaps[i].flags3 |= HOOKENABLED;
|
||||
if(dlg.m_NoBanner) TargetMaps[i].flags2 |= NOBANNER;
|
||||
if(dlg.m_StartDebug) TargetMaps[i].flags2 |= STARTDEBUG;
|
||||
if(dlg.m_NoEmulateSurface) {
|
||||
@ -611,6 +673,7 @@ void CDxwndhostView::OnModify()
|
||||
if(dlg.m_HookGDI) TargetMaps[i].flags2 |= HOOKGDI;
|
||||
if(dlg.m_HideMultiMonitor) TargetMaps[i].flags2 |= HIDEMULTIMONITOR;
|
||||
if(dlg.m_WallpaperMode) TargetMaps[i].flags2 |= WALLPAPERMODE;
|
||||
if(dlg.m_FixD3DFrame) TargetMaps[i].flags3 |= FIXD3DFRAME;
|
||||
if(dlg.m_HookChildWin) TargetMaps[i].flags |= HOOKCHILDWIN;
|
||||
if(dlg.m_MessageProc) TargetMaps[i].flags |= MESSAGEPROC;
|
||||
if(dlg.m_FixNCHITTEST) TargetMaps[i].flags2 |= FIXNCHITTEST;
|
||||
@ -648,9 +711,10 @@ void CDxwndhostView::OnModify()
|
||||
strcpy_s(TargetMaps[i].OpenGLLib, sizeof(TargetMaps[i].OpenGLLib), dlg.m_OpenGLLib);
|
||||
strcpy_s(TitleMaps[i].title, sizeof(TitleMaps[i].title), dlg.m_Title);
|
||||
CListCtrl& listctrl = GetListCtrl();
|
||||
listitem.mask = LVIF_TEXT;
|
||||
listitem.mask = LVIF_TEXT | LVIF_IMAGE;
|
||||
listitem.iItem = i;
|
||||
listitem.iSubItem = 0;
|
||||
listitem.iImage = SetTargetIcon(TargetMaps[i]);
|
||||
listitem.pszText = TitleMaps[i].title;
|
||||
listctrl.SetItem(&listitem);
|
||||
Resize();
|
||||
@ -776,9 +840,10 @@ void CDxwndhostView::OnSort()
|
||||
listctrl.DeleteAllItems();
|
||||
for(i=0; i<itemcount; i++) {
|
||||
LV_ITEM listitem;
|
||||
listitem.mask = LVIF_TEXT;
|
||||
listitem.mask = LVIF_TEXT | LVIF_IMAGE;
|
||||
listitem.iItem = i;
|
||||
listitem.iSubItem = 0;
|
||||
listitem.iImage = SetTargetIcon(TargetMaps[i]);
|
||||
listitem.pszText = TitleMaps[i].title;
|
||||
listctrl.SetItem(&listitem);
|
||||
listctrl.InsertItem(&listitem);
|
||||
@ -788,6 +853,84 @@ void CDxwndhostView::OnSort()
|
||||
this->isUpdated=TRUE;
|
||||
}
|
||||
|
||||
BOOL PauseResumeThreadList(DWORD dwOwnerPID, bool bResumeThread)
|
||||
{
|
||||
HANDLE hThreadSnap = NULL;
|
||||
BOOL bRet = FALSE;
|
||||
THREADENTRY32 te32 = {0};
|
||||
|
||||
// Take a snapshot of all threads currently in the system.
|
||||
|
||||
hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
|
||||
if (hThreadSnap == INVALID_HANDLE_VALUE)
|
||||
return (FALSE);
|
||||
|
||||
// Fill in the size of the structure before using it.
|
||||
|
||||
te32.dwSize = sizeof(THREADENTRY32);
|
||||
|
||||
// Walk the thread snapshot to find all threads of the process.
|
||||
// If the thread belongs to the process, add its information
|
||||
// to the display list.
|
||||
|
||||
if (Thread32First(hThreadSnap, &te32)){
|
||||
do{
|
||||
if (te32.th32OwnerProcessID == dwOwnerPID){
|
||||
HANDLE hThread = OpenThread(THREAD_SUSPEND_RESUME, FALSE, te32.th32ThreadID);
|
||||
if (bResumeThread)
|
||||
ResumeThread(hThread);
|
||||
else
|
||||
SuspendThread(hThread);
|
||||
CloseHandle(hThread);
|
||||
}
|
||||
}
|
||||
while (Thread32Next(hThreadSnap, &te32));
|
||||
bRet = TRUE;
|
||||
}
|
||||
else
|
||||
bRet = FALSE; // could not walk the list of threads
|
||||
|
||||
// Do not forget to clean up the snapshot object.
|
||||
CloseHandle (hThreadSnap);
|
||||
|
||||
return (bRet);
|
||||
}
|
||||
|
||||
void CDxwndhostView::OnPause()
|
||||
{
|
||||
CTargetDlg dlg;
|
||||
HRESULT res;
|
||||
char sMsg[128+1];
|
||||
DXWNDSTATUS DxWndStatus;
|
||||
if ((GetHookStatus(&DxWndStatus) != DXW_RUNNING) || (DxWndStatus.hWnd==NULL)) {
|
||||
MessageBoxEx(0, "No active task to pause.", "Info", MB_ICONEXCLAMATION, NULL);
|
||||
}
|
||||
else {
|
||||
sprintf_s(sMsg, 128, "Do you want to pause \nthe \"%s\" task?", TitleMaps[DxWndStatus.TaskIdx].title);
|
||||
res=MessageBoxEx(0, sMsg, "Warning", MB_YESNO | MB_ICONQUESTION, NULL);
|
||||
if(res!=IDYES) return;
|
||||
PauseResumeThreadList(DxWndStatus.dwPid, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void CDxwndhostView::OnResume()
|
||||
{
|
||||
CTargetDlg dlg;
|
||||
HRESULT res;
|
||||
HANDLE TargetHandle;
|
||||
char sMsg[128+1];
|
||||
DXWNDSTATUS DxWndStatus;
|
||||
if ((GetHookStatus(&DxWndStatus) != DXW_RUNNING) || (DxWndStatus.hWnd==NULL)) {
|
||||
MessageBoxEx(0, "No active task to resume.", "Info", MB_ICONEXCLAMATION, NULL);
|
||||
}
|
||||
else {
|
||||
sprintf_s(sMsg, 128, "Do you want to resume \nthe \"%s\" task?", TitleMaps[DxWndStatus.TaskIdx].title);
|
||||
res=MessageBoxEx(0, sMsg, "Warning", MB_YESNO | MB_ICONQUESTION, NULL);
|
||||
if(res!=IDYES) return;
|
||||
PauseResumeThreadList(DxWndStatus.dwPid, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void CDxwndhostView::OnKill()
|
||||
{
|
||||
CTargetDlg dlg;
|
||||
@ -830,6 +973,7 @@ void CDxwndhostView::OnAdd()
|
||||
LV_ITEM listitem;
|
||||
|
||||
dlg.m_DXVersion = 0;
|
||||
dlg.m_Coordinates = 0;
|
||||
dlg.m_MaxX = 0; //639;
|
||||
dlg.m_MaxY = 0; //479;
|
||||
for(i = 0; i < MAXTARGETS; i ++) if(!TargetMaps[i].path[0]) break;
|
||||
@ -844,12 +988,14 @@ void CDxwndhostView::OnAdd()
|
||||
strcpy_s(TitleMaps[i].title, sizeof(TitleMaps[i].title), dlg.m_Title);
|
||||
if(dlg.m_DXVersion > 1) dlg.m_DXVersion += 5;
|
||||
TargetMaps[i].dxversion = dlg.m_DXVersion;
|
||||
TargetMaps[i].coordinates = dlg.m_Coordinates;
|
||||
TargetMaps[i].flags = 0;
|
||||
TargetMaps[i].flags2 = 0;
|
||||
TargetMaps[i].tflags = 0;
|
||||
if(dlg.m_UnNotify) TargetMaps[i].flags |= UNNOTIFY;
|
||||
if(dlg.m_Windowize) TargetMaps[i].flags2 |= WINDOWIZE;
|
||||
if(dlg.m_HookDLLs) TargetMaps[i].flags3 |= HOOKDLLS;
|
||||
if(dlg.m_HookEnabled) TargetMaps[i].flags3 |= HOOKENABLED;
|
||||
if(dlg.m_NoBanner) TargetMaps[i].flags2 |= NOBANNER;
|
||||
if(dlg.m_StartDebug) TargetMaps[i].flags2 |= STARTDEBUG;
|
||||
if(dlg.m_NoEmulateSurface) {
|
||||
@ -916,6 +1062,7 @@ void CDxwndhostView::OnAdd()
|
||||
if(dlg.m_HookGDI) TargetMaps[i].flags2 |= HOOKGDI;
|
||||
if(dlg.m_HideMultiMonitor) TargetMaps[i].flags2 |= HIDEMULTIMONITOR;
|
||||
if(dlg.m_WallpaperMode) TargetMaps[i].flags2 |= WALLPAPERMODE;
|
||||
if(dlg.m_FixD3DFrame) TargetMaps[i].flags3 |= FIXD3DFRAME;
|
||||
if(dlg.m_HookChildWin) TargetMaps[i].flags |= HOOKCHILDWIN;
|
||||
if(dlg.m_MessageProc) TargetMaps[i].flags |= MESSAGEPROC;
|
||||
if(dlg.m_FixNCHITTEST) TargetMaps[i].flags2 |= FIXNCHITTEST;
|
||||
@ -953,9 +1100,10 @@ void CDxwndhostView::OnAdd()
|
||||
else
|
||||
MessageBoxEx(0, "Bad InitTS", "Warning", MB_OK, NULL);
|
||||
CListCtrl& listctrl = GetListCtrl();
|
||||
listitem.mask = LVIF_TEXT;
|
||||
listitem.mask = LVIF_TEXT | LVIF_IMAGE;
|
||||
listitem.iItem = i;
|
||||
listitem.iSubItem = 0;
|
||||
listitem.iImage = SetTargetIcon(TargetMaps[i]);
|
||||
if (strlen(TitleMaps[i].title)==0){
|
||||
int len;
|
||||
CString FilePath;
|
||||
@ -1234,6 +1382,18 @@ void CDxwndhostView::OnRButtonDown(UINT nFlags, CPoint point)
|
||||
case ID_TASK_KILL:
|
||||
OnKill();
|
||||
break;
|
||||
case ID_TASK_PAUSE:
|
||||
OnPause();
|
||||
break;
|
||||
case ID_TASK_RESUME:
|
||||
OnResume();
|
||||
break;
|
||||
case ID_PEXPORT:
|
||||
OnExport();
|
||||
break;
|
||||
case ID_FILE_IMPORT:
|
||||
OnImport();
|
||||
break;
|
||||
}
|
||||
CListView::OnRButtonDown(nFlags, point);
|
||||
}
|
||||
@ -1307,6 +1467,10 @@ DWORD WINAPI StartDebug(void *p)
|
||||
li->hFile, GetFileNameFromHandle(li->hFile));
|
||||
res=MessageBoxEx(0, DebugMessage, "Continue stepping?", MB_YESNO | MB_ICONQUESTION, NULL);
|
||||
if(res!=IDYES) step=FALSE;
|
||||
if(!Inject(pinfo.dwProcessId, path)){
|
||||
sprintf(DebugMessage,"Injection error: pid=%x dll=%s", pinfo.dwProcessId, path);
|
||||
MessageBoxEx(0, DebugMessage, "Injection", MB_ICONEXCLAMATION, NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UNLOAD_DLL_DEBUG_EVENT:
|
||||
|
@ -20,7 +20,6 @@ protected: // Create from serialization only features.
|
||||
private:
|
||||
void Resize(void);
|
||||
void SaveConfigFile();
|
||||
void SaveWinPos();
|
||||
TARGETMAP TargetMaps[MAXTARGETS];
|
||||
PRIVATEMAP TitleMaps[MAXTARGETS];
|
||||
char InitPath[MAX_PATH];
|
||||
@ -28,6 +27,7 @@ private:
|
||||
DEVMODE InitDevMode;
|
||||
CSystemTray SystemTray;
|
||||
int LastX, LastY, LastCX, LastCY;
|
||||
CImageList m_cImageListNormal, m_cImageListSmall;
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
@ -44,9 +44,6 @@ public:
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
protected:
|
||||
virtual void OnInitialUpdate(); // Called once after the initial construction.
|
||||
virtual void OnMove(int, int);
|
||||
virtual void OnSize(UINT, int, int);
|
||||
virtual void OnDestroy();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
@ -65,9 +62,13 @@ protected:
|
||||
afx_msg void OnDblclk(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnAdd();
|
||||
afx_msg void OnModify();
|
||||
afx_msg void OnExport();
|
||||
afx_msg void OnImport();
|
||||
afx_msg void OnDelete();
|
||||
afx_msg void OnExplore();
|
||||
afx_msg void OnKill();
|
||||
afx_msg void OnPause();
|
||||
afx_msg void OnResume();
|
||||
afx_msg void OnSort();
|
||||
afx_msg void OnViewLog();
|
||||
afx_msg void OnDeleteLog();
|
||||
|
BIN
host/res/bigicons.bmp
Normal file
BIN
host/res/bigicons.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.1 KiB |
BIN
host/res/smallicons.bmp
Normal file
BIN
host/res/smallicons.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Loading…
x
Reference in New Issue
Block a user