Advertisement

Help me finding an error :P

Started by July 09, 2000 12:25 AM
7 comments, last by RoTTer 24 years, 5 months ago
Hey Im sorry about the topic, I couldnt think of one that could describe my error very well, so I used that. Ok, I am trying to understand a program written by someone else and am so far getting it. Now I got to a part that not only I didnt understand very well but when I simply copy it and try to compile it wont work. I have the original source code and project/workspace file, and when I open it and compile (the original) it compiles perfectly. Now when I compile my copy it gives me some errors. Ill paste the copy I made from the program and the errors I got, and hopefully someone will see whats wrong (although as I said its copied from a 100% working program). Ok, here it goes (the importand part) :

struct HOOK_DATA {
	PROC pfnOriginalProc;
	PROC pfnHookProc;
	char* pszFunctionName;
};

int PASCAL FAR hook_select (int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, const struct timeval FAR *timeout);

HOOK_DATA g_hdFunctionHooks[3] =
{
	{NULL, &hook_recv, "recv"},
	{NULL, &hook_send, "send"},
	{NULL, &hook_select, "select"}
};

int PASCAL FAR hook_select (int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, const struct timeval FAR *timeout)
{

// some scary code

return (g_hdFunctionHooks[2].pfnOriginalProc)(nfds, readfds, writefds, exceptfds, timeout);
}

 
And I get the following errors : "error C2116: function parameter lists differed" - On all the three (NULL, &hook_*, "*") "error C2197: ''int (__stdcall *)(void)'' : too many actual parameters" - On the return (fpointer)(param1, param2, ...); and after that : "fatal error C1903: unable to recover from previous error(s); stopping compilation" Its a DLL (the original is, Im not sure if I really managed to make mine be a DLL too, and Im not sure if that would matter on the compilation), and it supposedly uses hooks to read incoming and outgoing data to a game and modify it. Any help would be appreciated Thanks a lot, -RoTTer
Hmmmm, I have a silly question. What OS is this for?





#define MY_LIFE BUSY
http://www.crosswinds.net/~druidgames/resist.jpg
Advertisement
Hey, The C Guy.

It''s for Windows 95/98. Its part of a program that "cheats" in an online Windows game.

Cya,
-RoTTer
Try this:

    typedef struct tagHOOK_DATA { PROC pfnOriginalProc; PROC pfnHookProc; char* pszFunctionName;}HOOK_DATA;    






#define MY_LIFE BUSY
http://www.crosswinds.net/~druidgames/resist.jpg
Hey

Thanks for the try .

But I got the same errors as before =/.

The most strange thing is that it compiles perfectly in the original source! Waah.

I cant understand this =[.

Thanks for your help,
-RoTTer
maybe the main file has an #include statement that adds something to the program (i.e. redefine on o the typedefs that u''re using) and u''re forgetting to include that

-----------------
- Pouya / FOO!!!
One of the initiators of the "uh, no" crisis and entitled to be the king of crap posters.
Advertisement
quote: Original post by RoTTer

Hey

Im sorry about the topic, I couldnt think of one that could describe my error very well, so I used that.
Ok, I am trying to understand a program written by someone else and am so far getting it. Now I got to a part that not only I didnt understand very well but when I simply copy it and try to compile it wont work. I have the original source code and project/workspace file, and when I open it and compile (the original) it compiles perfectly. Now when I compile my copy it gives me some errors.

Ill paste the copy I made from the program and the errors I got, and hopefully someone will see whats wrong (although as I said its copied from a 100% working program).

Ok, here it goes (the importand part) :

struct HOOK_DATA {	PROC pfnOriginalProc;	PROC pfnHookProc;	char* pszFunctionName;};int PASCAL FAR hook_select (int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, const struct timeval FAR *timeout);HOOK_DATA g_hdFunctionHooks[3] ={	{NULL, &hook_recv, "recv"},	{NULL, &hook_send, "send"},	{NULL, &hook_select, "select"}};int PASCAL FAR hook_select (int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, const struct timeval FAR *timeout){// some scary codereturn (g_hdFunctionHooks[2].pfnOriginalProc)(nfds, readfds, writefds, exceptfds, timeout);}  


And I get the following errors :

"error C2116: function parameter lists differed" - On all the three (NULL, &hook_*, "*")

"error C2197: ''int (__stdcall *)(void)'' : too many actual parameters" - On the return (fpointer)(param1, param2, ...);

and after that :

"fatal error C1903: unable to recover from previous error(s); stopping compilation"


Its a DLL (the original is, Im not sure if I really managed to make mine be a DLL too, and Im not sure if that would matter on the compilation), and it supposedly uses hooks to read incoming and outgoing data to a game and modify it.

Any help would be appreciated

Thanks a lot,
-RoTTer


Oops - didn''t mean to post your original text....
Anyway, try this:

typedef int (FAR PASCAL *MYPROC)(int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, const struct timeval FAR *timeout);

struct HOOK_DATA {
MYPROC pfnOriginalProc;
MYPROC pfnHookProc;
char* pszFunctionName;
};

Seems to work with the code extract you''ve provided.
Try this:

typedef int (FAR PASCAL *MYPROC)(int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, const struct timeval FAR *timeout);

struct HOOK_DATA {
MYPROC pfnOriginalProc;
MYPROC pfnHookProc;
char* pszFunctionName;
};

Seems to work with the code extract you''ve provided.

This topic is closed to new replies.

Advertisement