logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

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.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: plugedin module not able to execute system()
Author
ashwani_ap



Joined: 29 Aug 2007
Posts: 47
Location: Bangalore

PostPosted: Sat 08 Dec '07 9:16    Post subject: plugedin module not able to execute system() Reply with quote

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: 7298
Location: Germany, Next to Hamburg

PostPosted: Sat 08 Dec '07 15:15    Post subject: Reply with quote

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

PostPosted: Sat 08 Dec '07 15:16    Post subject: Reply with quote

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

PostPosted: Sat 08 Dec '07 16:06    Post subject: Reply with quote

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

PostPosted: Sun 09 Dec '07 5:37    Post subject: Reply with quote

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. Sad
Back to top
ashwani_ap



Joined: 29 Aug 2007
Posts: 47
Location: Bangalore

PostPosted: Mon 10 Dec '07 8:58    Post subject: Reply with quote

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


Reply to topic   Topic: plugedin module not able to execute system() View previous topic :: View next topic
Post new topic   Forum Index -> Apache