Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++] Strange Process Error
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
AlbanainRetard
Master Cheater
Reputation: 0

Joined: 02 Nov 2008
Posts: 494
Location: Canada eh?

PostPosted: Sun Feb 15, 2009 9:18 pm    Post subject: [C++] Strange Process Error Reply with quote

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
View user's profile Send private message Send e-mail
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Sun Feb 15, 2009 9:29 pm    Post subject: Reply with quote

Twisted Evil


....
eh...
..should.. i...

bah..

GetProcessId()...

_________________
don't +rep me..i do not wish to have "status" or "recognition" from you or anyone.. thank you.
Back to top
View user's profile Send private message MSN Messenger
AlbanainRetard
Master Cheater
Reputation: 0

Joined: 02 Nov 2008
Posts: 494
Location: Canada eh?

PostPosted: Sun Feb 15, 2009 9:42 pm    Post subject: Reply with quote

BanMe wrote:
Twisted Evil


....
eh...
..should.. i...

bah..

GetProcessId()...


I have the name right, and I included windows.h

_________________
Back to top
View user's profile Send private message Send e-mail
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun Feb 15, 2009 10:40 pm    Post subject: Reply with quote

Rolling Eyes

GetProcessID != GetProcessId

_________________
Back to top
View user's profile Send private message
AlbanainRetard
Master Cheater
Reputation: 0

Joined: 02 Nov 2008
Posts: 494
Location: Canada eh?

PostPosted: Sun Feb 15, 2009 10:56 pm    Post subject: Reply with quote

I used lower case, before, just messed up Wink
_________________
Back to top
View user's profile Send private message Send e-mail
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Feb 16, 2009 7:01 am    Post subject: Reply with quote

AlbanainRetard wrote:
I used lower case, before, just messed up Wink


For some reason I get:
error C3861: 'GetProcessID': identifier not found

Read that

GetProcessID

you didn't use lowercase silly.

_________________
Back to top
View user's profile Send private message
AlbanainRetard
Master Cheater
Reputation: 0

Joined: 02 Nov 2008
Posts: 494
Location: Canada eh?

PostPosted: Mon Feb 16, 2009 10:05 am    Post subject: Reply with quote

Trust me I have tried to push it lowercase, not working.
_________________
Back to top
View user's profile Send private message Send e-mail
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Feb 16, 2009 3:14 pm    Post subject: Reply with quote

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
View user's profile Send private message
AlbanainRetard
Master Cheater
Reputation: 0

Joined: 02 Nov 2008
Posts: 494
Location: Canada eh?

PostPosted: Mon Feb 16, 2009 6:20 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
talkerzero
Grandmaster Cheater
Reputation: 1

Joined: 24 Jul 2008
Posts: 560
Location: California

PostPosted: Mon Feb 16, 2009 6:33 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Feb 16, 2009 6:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Mon Feb 16, 2009 7:57 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
rapion124
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Mar 2007
Posts: 1095

PostPosted: Mon Feb 16, 2009 8:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
sphere90
Grandmaster Cheater
Reputation: 0

Joined: 24 Jun 2006
Posts: 912

PostPosted: Mon Feb 16, 2009 8:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
AlbanainRetard
Master Cheater
Reputation: 0

Joined: 02 Nov 2008
Posts: 494
Location: Canada eh?

PostPosted: Mon Feb 16, 2009 8:16 pm    Post subject: Reply with quote

I know its in Papsi, but MSDN said under kernel32 and windows.h so...

Thanks sphere and other person.

_________________
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites