mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
More StarCraft and generic support, fix mhack permissions
This commit is contained in:
parent
1ecc6bb248
commit
48bed3d6f1
21
main.c
21
main.c
@ -327,6 +327,15 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
case WM_MBUTTONDBLCLK:
|
||||
case WM_LBUTTONDBLCLK:
|
||||
case WM_RBUTTONDBLCLK:
|
||||
case WM_NCLBUTTONDOWN:
|
||||
case WM_NCRBUTTONDOWN:
|
||||
case WM_NCLBUTTONUP:
|
||||
case WM_NCRBUTTONUP:
|
||||
case WM_NCMBUTTONDOWN:
|
||||
case WM_NCMBUTTONUP:
|
||||
case WM_NCMBUTTONDBLCLK:
|
||||
case WM_NCLBUTTONDBLCLK:
|
||||
case WM_NCRBUTTONDBLCLK:
|
||||
if(ddraw->mhack)
|
||||
{
|
||||
if(!ddraw->locked)
|
||||
@ -340,10 +349,15 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
case 2024: /* this somehow allows RA edwin to work, investigate */
|
||||
return ddraw->WndProc(hWnd, uMsg, wParam, lParam);
|
||||
|
||||
/* for StartCraft and general support */
|
||||
/* for StarCraft and general support */
|
||||
case WM_MOUSEMOVE:
|
||||
fake_GetCursorPos(&pt);
|
||||
return ddraw->WndProc(hWnd, uMsg, wParam, MAKELPARAM(pt.x, pt.y));
|
||||
case WM_NCMOUSEMOVE:
|
||||
if(ddraw->mhack)
|
||||
{
|
||||
fake_GetCursorPos(&pt);
|
||||
return ddraw->WndProc(hWnd, uMsg, wParam, MAKELPARAM(pt.x, pt.y));
|
||||
}
|
||||
return ddraw->WndProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
@ -386,7 +400,6 @@ HRESULT __stdcall ddraw_SetCooperativeLevel(IDirectDrawImpl *This, HWND hWnd, DW
|
||||
}
|
||||
|
||||
GetWindowText(This->hWnd, (LPTSTR)&This->title, sizeof(This->title));
|
||||
printf("wintitle: %s\n", This->title);
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
7
mouse.c
7
mouse.c
@ -126,8 +126,6 @@ void hack_iat(struct hack *hck)
|
||||
int i;
|
||||
char buf[32];
|
||||
struct hook *hk;
|
||||
DWORD tmp;
|
||||
HANDLE hProcess;
|
||||
DWORD dwWritten;
|
||||
IMAGE_DOS_HEADER dos_hdr;
|
||||
IMAGE_NT_HEADERS nt_hdr;
|
||||
@ -135,10 +133,8 @@ void hack_iat(struct hack *hck)
|
||||
IMAGE_THUNK_DATA thunk;
|
||||
PDWORD ptmp;
|
||||
|
||||
GetWindowThreadProcessId(ddraw->hWnd, &tmp);
|
||||
|
||||
HMODULE base = GetModuleHandle(NULL);
|
||||
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, tmp);
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
|
||||
ReadProcessMemory(hProcess, (void *)base, &dos_hdr, sizeof(IMAGE_DOS_HEADER), &dwWritten);
|
||||
ReadProcessMemory(hProcess, (void *)base+dos_hdr.e_lfanew, &nt_hdr, sizeof(IMAGE_NT_HEADERS), &dwWritten);
|
||||
@ -167,6 +163,7 @@ void hack_iat(struct hack *hck)
|
||||
thunk.u1.Function = (DWORD)hk->func;
|
||||
thunk.u1.Ordinal = (DWORD)hk->func;
|
||||
thunk.u1.AddressOfData = (DWORD)hk->func;
|
||||
VirtualProtectEx(hProcess, (void *)base+dir->FirstThunk+(sizeof(IMAGE_THUNK_DATA) * i), sizeof(IMAGE_THUNK_DATA), PAGE_EXECUTE_READWRITE, &dwWritten);
|
||||
WriteProcessMemory(hProcess, (void *)base+dir->FirstThunk+(sizeof(IMAGE_THUNK_DATA) * i), &thunk, sizeof(IMAGE_THUNK_DATA), &dwWritten);
|
||||
mouse_active = TRUE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user