player->ProcessInformation->hProcess
is correct. Good luck!
Question
The structure looks like this
typedef struct _PROCESS_INFORMATION {
HANDLE hProcess;
HANDLE hThread;
DWORD dwProcessId;
DWORD dwThreadId;
} PROCESS_INFORMATION, *LPPROCESS_INFORMATION;
struct PLAYER
{
/* 0x0/0 */ struct PROCESS_INFORMATION *ProcessInformation;
/* 0x4/4 */ unsigned long dword4;
/* 0x8/8 */ unsigned long dword8;
/* 0xC/12 */ unsigned long dwordC;
//... Lots of fields here
}
Here is the prototype for TerminateProcess
BOOL WINAPI TerminateProcess(
_In_ HANDLE hProcess,
_In_ UINT uExitCode
);
I tried all 3 of these below and failed.
unsigned int v102; //exit code.
struct PLAYER *player; // eax@9
TerminateProcess(player->ProcessInformation->hProcess, v102);
TerminateProcess(player->ProcessInformation.hProcess, v102);
TerminateProcess(*(player->ProcessInformation)->hProcess, v102);
The arrow ->
works for other members of the PLAYER struct pointer
but if the member inside the struct
PLAYER is a pointer to another struct then I get compiler problems.
All 3 above give me the compiler problems.
Maybe I had to use *LPPROCESS_INFORMATION
inside the struct PLAYER
or maybe I had to use struct _PROCESS_INFORMATION *
because I really hate using typedef
's
(yeah I just started using C only a week ago I usually code in Java/C#/VB.NET so this is all new to me.)
Edit: Seems I found the problem I was using a stupid typedef
no wonder I had so much problems.. Those typedef's eliminate the use for a type which in this case is a struct
so my structure was very screwed up..
Fix was to replace
/* 0x0/0 */ struct PROCESS_INFORMATION *ProcessInformation;
with
/* 0x0/0 */ struct _PROCESS_INFORMATION *ProcessInformation;
Now I can use the beautifiul arrows non-stop
player->ProcessInformation->hProcess
Is this right?
Solution
player->ProcessInformation->hProcess
is correct. Good luck!