| View previous topic :: View next topic |
| Author |
Message |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Sun Feb 15, 2009 9:18 pm Post subject: [C++] Strange Process Error |
|
|
For some reason I get:
error C3861: 'GetProcessID': identifier not found
I checked MSDN, and I need to include windows and I have but no avail. I don't know why this is happening. I am not using a Windows 2000 computer, so It make's no sense.
Edit: Could it be I need Platform SDK?
_________________
|
|
| Back to top |
|
 |
BanMe Master Cheater
Reputation: 0
Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
|
|
| Back to top |
|
 |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Sun Feb 15, 2009 9:42 pm Post subject: |
|
|
| BanMe wrote: |
....
eh...
..should.. i...
bah..
GetProcessId()... |
I have the name right, and I included windows.h
_________________
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Feb 15, 2009 10:40 pm Post subject: |
|
|
GetProcessID != GetProcessId
_________________
|
|
| Back to top |
|
 |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Sun Feb 15, 2009 10:56 pm Post subject: |
|
|
I used lower case, before, just messed up
_________________
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Mon Feb 16, 2009 7:01 am Post subject: |
|
|
| AlbanainRetard wrote: | I used lower case, before, just messed up  |
For some reason I get:
error C3861: 'GetProcessID': identifier not found
Read that
GetProcessID
you didn't use lowercase silly.
_________________
|
|
| Back to top |
|
 |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Mon Feb 16, 2009 10:05 am Post subject: |
|
|
Trust me I have tried to push it lowercase, not working.
_________________
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Mon Feb 16, 2009 3:14 pm Post subject: |
|
|
| AlbanainRetard wrote: | | Trust me I have tried to push it lowercase, not working. |
Show me the error + source when its lowercase as i dont believe you
_________________
|
|
| Back to top |
|
 |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Mon Feb 16, 2009 6:20 pm Post subject: |
|
|
| Code: |
#include <windows.h>
#include <tchar.h>
#include <string>
bool InjectSendKey()
{
DWORD hId = GetProcessId("Gamemon.des"); //Get handle on Gamemone.des
char* SendKeyDLL; //255 Characters
if( !GetCurrentDirectory(_MAX_PATH,SendKeyDLL) ) //Did not work
{
MessageBox(NULL,_T("InjectSendKey(), Failed due to:\nThe buffer for Directory was too small\nError Code: 000001"),_T("Fatal Error!"),MB_OK || MB_ICONERROR );
MessageBox(NULL, _T(GetCurrentDirectory(0,NULL)),_T("Fatal Error!"),MB_OK || MB_ICONERROR );
}
//if( insertDll(hId, )
|
Error:
1>\sendkeyinjection.cpp(54) : error C3861: 'GetProcessId': identifier not found
_________________
|
|
| Back to top |
|
 |
talkerzero Grandmaster Cheater
Reputation: 1
Joined: 24 Jul 2008 Posts: 560 Location: California
|
Posted: Mon Feb 16, 2009 6:33 pm Post subject: |
|
|
Well first of all, your usage of GetProcessId is incorrect. The parameter shouldn't be the name of the process, it should be a handle to the process. But you usually want the PID to get a handle.. so that leads you nowhere.
If you want to get the PID of a process, here you go.
| Code: | #include <tlhelp32.h>
DWORD GetPID(char* procName){
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
PROCESSENTRY pe32;
pe32.dwSize = sizeof(PROCESSENTRY32);
while(Process32Next(hSnapshot, &pe32)){ //rotate through processes until it's found
if(!strcmp(pe32.szExeFile, procName))
CloseHandle(&hSnapshot);
return pe32.th32ProcessID;
}
}
CloseHandle(&hSnapshot);
return 0; //if process not found
} |
| Code: | | Usage: GetPID("process.exe"); |
Last edited by talkerzero on Mon Feb 16, 2009 6:34 pm; edited 1 time in total |
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Mon Feb 16, 2009 6:34 pm Post subject: |
|
|
Is not included in winbase.h in vc++6 i opened winbase.h and i cannot find GetProcessId, simulary it won't let me compile.
Thats on msdn comment
You might have to dl a new wdk
_________________
|
|
| Back to top |
|
 |
BanMe Master Cheater
Reputation: 0
Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
|
Posted: Mon Feb 16, 2009 7:57 pm Post subject: |
|
|
if you had included all information to start with (windows 2k) i would answered more clearly.
GetProcessId is only supported in XP sp1 and higher..
use GetPID method provided on this page
or Parse the Handle Table Directly and harvest PID's that way.
_________________
don't +rep me..i do not wish to have "status" or "recognition" from you or anyone.. thank you.
Last edited by BanMe on Mon Feb 16, 2009 8:01 pm; edited 1 time in total |
|
| Back to top |
|
 |
rapion124 Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Mar 2007 Posts: 1095
|
Posted: Mon Feb 16, 2009 8:01 pm Post subject: |
|
|
GetProcessId is not defined in windows.h. It is defined in psapi.h. Add this to your code:
| Code: |
#include <psapi.h>
#pragma comment(lib, "psapi.lib")
|
|
|
| Back to top |
|
 |
sphere90 Grandmaster Cheater
Reputation: 0
Joined: 24 Jun 2006 Posts: 912
|
Posted: Mon Feb 16, 2009 8:04 pm Post subject: |
|
|
| rapion124 wrote: | GetProcessId is not defined in windows.h. It is defined in psapi.h. Add this to your code:
| Code: |
#include <psapi.h>
#pragma comment(lib, "psapi.lib")
|
|
LMAO.
| Quote: | Requirements
Minimum supported client Windows Vista, Windows XP with SP1
Minimum supported server Windows Server 2003
Header Winbase.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll |
_________________
Give a hungry man a fish and he'll be full for a day. Teach a hungry man how to fish and he'll be full for the rest of his life. |
|
| Back to top |
|
 |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Mon Feb 16, 2009 8:16 pm Post subject: |
|
|
I know its in Papsi, but MSDN said under kernel32 and windows.h so...
Thanks sphere and other person.
_________________
|
|
| Back to top |
|
 |
|