 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Sun Jun 29, 2008 3:27 pm Post subject: [C++] Help with CreateProcess |
|
|
hii..
i'm trying to open notepad with CreateProcess according to the book that i'm studing with it goes like this:
| Code: |
STARTUPINFO sui;
PROCESS_INFORMATION pi;
ZeroMemory(&sui,sizeof(STARTUPINFO));
sui.cb = sizeof(STARTUPINFO);
CreateProcess(NULL,L"C:\\WINDOWS\\Notepad.exe",NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&sui,&pi);
|
but when i active that code the window crushes . . huh o.O ?!?!
_________________
Stylo |
|
| Back to top |
|
 |
Overload Master Cheater
Reputation: 0
Joined: 08 Feb 2008 Posts: 293
|
Posted: Sun Jun 29, 2008 3:33 pm Post subject: |
|
|
| Code: | int OpenProcess( LPTSTR process_name )
{
STARTUPINFO sui;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(sui) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
int retval = CreateProcess( process_name,
NULL,NULL,NULL,FALSE, NULL, //change your creation flag to suit your need.
NULL,NULL,&sui,&pi);
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
//returns ZERO if failed. returns NON-ZERO if succeeded.
return retval;
} |
Credits: The_Undead
|
|
| Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Sun Jun 29, 2008 3:39 pm Post subject: |
|
|
Switch the first to parameters. You're giving the path as the command line.
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Jun 29, 2008 5:27 pm Post subject: |
|
|
| Code: | #include <windows.h>
char target[] = "\\test.exe";
char path[MAX_PATH];
STARTUPINFO si = { 0 };
PROCESS_INFORMATION pi;
int main(){
si.cb = sizeof(STARTUPINFO);
GetCurrentDirectory((MAX_PATH - sizeof(target)), (LPSTR)&path);
lstrcat((LPSTR)&path, (LPSTR)&target);
CreateProcess((LPSTR)&path, NULL, NULL, NULL, FALSE,
NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);
} |
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Sun Jun 29, 2008 8:53 pm Post subject: |
|
|
oh thx HalfPrime all i needed was to switch the first two parameters
thx to other guys that help too
_________________
Stylo |
|
| Back to top |
|
 |
systat Advanced Cheater
Reputation: 0
Joined: 15 Feb 2008 Posts: 54
|
Posted: Mon Jun 30, 2008 2:04 am Post subject: |
|
|
| Overload wrote: | | Code: | int OpenProcess( LPTSTR process_name )
{
STARTUPINFO sui;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(sui) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
int retval = CreateProcess( process_name,
NULL,NULL,NULL,FALSE, NULL, //change your creation flag to suit your need.
NULL,NULL,&sui,&pi);
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
//returns ZERO if failed. returns NON-ZERO if succeeded.
return retval;
} |
Credits: The_Undead |
Hey pal | Code: | | si.cb = sizeof(si); |
si isn't declared!!!!!!!!!!
_________________
uuuuuuuuuuuuu |
|
| Back to top |
|
 |
Overload Master Cheater
Reputation: 0
Joined: 08 Feb 2008 Posts: 293
|
Posted: Mon Jun 30, 2008 2:41 am Post subject: |
|
|
| systat wrote: | | Overload wrote: | | Code: | int OpenProcess( LPTSTR process_name )
{
STARTUPINFO sui;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(sui) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
int retval = CreateProcess( process_name,
NULL,NULL,NULL,FALSE, NULL, //change your creation flag to suit your need.
NULL,NULL,&sui,&pi);
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
//returns ZERO if failed. returns NON-ZERO if succeeded.
return retval;
} |
Credits: The_Undead |
Hey pal | Code: | | si.cb = sizeof(si); |
si isn't declared!!!!!!!!!! |
if you can't fix that, you dont deserve to be on this forum...lol
it was just a typing error =/
|
|
| Back to top |
|
 |
|
|
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
|
|