Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: plugedin module not able to execute system() |
|
Author |
|
ashwani_ap
Joined: 29 Aug 2007 Posts: 47 Location: Bangalore
|
Posted: Sat 08 Dec '07 9:16 Post subject: plugedin module not able to execute system() |
|
|
Hi,
I have successfully plugged in a module into my apache web server.
In the module code I want to execute this:
if (!CreateProcess(NULL, TEXT("F:\\Apache21\\bin\\httpd.exe"),
NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {}
NOTE: this httpd.exe is diff running at diff port.
But it is not executing successfully. It gives access violation error pointing to &pi.
Can sombody tell what is the problem. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Sat 08 Dec '07 15:15 Post subject: |
|
|
Is that a PHP or perl script? Which "module" did you load? An own one? |
|
Back to top |
|
ashwani_ap
Joined: 29 Aug 2007 Posts: 47 Location: Bangalore
|
Posted: Sat 08 Dec '07 15:16 Post subject: |
|
|
Hi,
This module is written in C for doing some specfic task. |
|
Back to top |
|
tdonovan Moderator
Joined: 17 Dec 2005 Posts: 611 Location: Milford, MA, USA
|
Posted: Sat 08 Dec '07 16:06 Post subject: |
|
|
Have you defined si and pi correctly?
Like this: Code: | PROCESS_INFORMATION pi;
STARTUPINFO si;
// set new process startup info from parent's startup info
GetStartupInfo(&si);
CreateProcess(NULL, "F:\\Apache21\\bin\\httpd.exe", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
// close the new process handles
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
|
-tom- |
|
Back to top |
|
ashwani_ap
Joined: 29 Aug 2007 Posts: 47 Location: Bangalore
|
Posted: Sun 09 Dec '07 5:37 Post subject: |
|
|
Hi,
I have done all this. below is the code snippet. but still I am facing same problem
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
CreateProcess(NULL, TEXT("F:\\Apache21\\bin\\httpd.exe"), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
Still same problem. |
|
Back to top |
|
ashwani_ap
Joined: 29 Aug 2007 Posts: 47 Location: Bangalore
|
Posted: Mon 10 Dec '07 8:58 Post subject: |
|
|
Hi,
I tried few things on win2k3. same peace of code is working.
I don't know what is the problem with winXP.
Thanks |
|
Back to top |
|
|
|
|
|
|