Quell
January 14th, 2005, 10:58 PM
Hello.
Does anyone see an error in the following code? it is prolly someting stupid but i can;t see it....here is the code:
#include <windows.h>
#define WINDOW_NAME "Test"
#define ADDY 0x41A788
DWORD OrigTick;
DWORD WINAPI GetTickCountHook(void);
DWORD WINAPI (*GetTickCountOrig)(void);
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
HWND hpid;
DWORD pid;
FARPROC fp;
LPVOID addy;
GetTickCountOrig = (DWORD(*WINAPI)())GetTickCount;
OrigTick = GetTickCount();
hpid = FindWindow(0, WINDOW_NAME);
GetWindowThreadProcessId(hpid, &pid);
(HANDLE)(hpid) = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
addy = VirtualAllocEx(hpid, 0, 4, MEM_COMMIT, PAGE_READWRITE);
fp = (FARPROC)GetTickCountHook;
WriteProcessMemory(hpid, addy, &fp, 4, 0);
WriteProcessMemory(hpid, (void*)((DWORD)ADDY+2), &addy, 4, 0);
break;
}
return 1;
}
DWORD __export WINAPI GetTickCountHook(void)
{
}
there error is in the
GetTickCountOrig = (DWORD(*WINAPI)())GetTickCount;
line.
Any ideas?
dllmain.cpp: In function `int DllEntryPoint(HINSTANCE__*, long unsigned int,
void*)':
dllmain.cpp:17: error: invalid type modifier within pointer declarator
make.exe: *** [dllmain.o] Error 1
Execution terminated
Here is the error code. I am using Dev Cpp v 5.
Thx in Advance
Does anyone see an error in the following code? it is prolly someting stupid but i can;t see it....here is the code:
#include <windows.h>
#define WINDOW_NAME "Test"
#define ADDY 0x41A788
DWORD OrigTick;
DWORD WINAPI GetTickCountHook(void);
DWORD WINAPI (*GetTickCountOrig)(void);
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
HWND hpid;
DWORD pid;
FARPROC fp;
LPVOID addy;
GetTickCountOrig = (DWORD(*WINAPI)())GetTickCount;
OrigTick = GetTickCount();
hpid = FindWindow(0, WINDOW_NAME);
GetWindowThreadProcessId(hpid, &pid);
(HANDLE)(hpid) = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
addy = VirtualAllocEx(hpid, 0, 4, MEM_COMMIT, PAGE_READWRITE);
fp = (FARPROC)GetTickCountHook;
WriteProcessMemory(hpid, addy, &fp, 4, 0);
WriteProcessMemory(hpid, (void*)((DWORD)ADDY+2), &addy, 4, 0);
break;
}
return 1;
}
DWORD __export WINAPI GetTickCountHook(void)
{
}
there error is in the
GetTickCountOrig = (DWORD(*WINAPI)())GetTickCount;
line.
Any ideas?
dllmain.cpp: In function `int DllEntryPoint(HINSTANCE__*, long unsigned int,
void*)':
dllmain.cpp:17: error: invalid type modifier within pointer declarator
make.exe: *** [dllmain.o] Error 1
Execution terminated
Here is the error code. I am using Dev Cpp v 5.
Thx in Advance