2009-02-09 Ramon Novoa <rnovoa@artica.es>

* windows/pandora_wmi.cc,
          windows/pandora_wmi.h: Allow custom process creation flags.

        * pandora_windows_service.cc: Hide console window when calling
          tentacle client.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1434 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2009-02-09 17:47:24 +00:00
parent 02d8363146
commit 39b530b340
4 changed files with 20 additions and 23 deletions

View File

@ -1,3 +1,11 @@
2009-02-09 Ramon Novoa <rnovoa@artica.es>
* windows/pandora_wmi.cc,
windows/pandora_wmi.h: Allow custom process creation flags.
* pandora_windows_service.cc: Hide console window when calling
tentacle client.
2009-02-09 Esteban Sanchez <estebans@artica.es>
* main.cc: Added a new parameter --process to run the agent as a

View File

@ -207,7 +207,7 @@ Pandora_Windows_Service::copyTentacleDataFile (string host,
string pass,
string opts)
{
int rc = 0;
bool rc = false;
string var, filepath;
string tentacle_cmd;
@ -244,26 +244,14 @@ Pandora_Windows_Service::copyTentacleDataFile (string host,
filepath.c_str (), host.c_str ());
pandoraDebug ("Command %s", tentacle_cmd.c_str());
rc = system (tentacle_cmd.c_str());
switch (rc) {
/* system() error */
case -1:
pandoraLog ("Unable to copy %s", filename.c_str ());
break;
/* tentacle_client.exe returned OK */
case 0:
break;
/* tentacle_client.exe error */
default:
pandoraDebug ("Tentacle client was unable to copy %s",
filename.c_str ());
break;
rc = Pandora_Wmi::runProgram (tentacle_cmd.c_str(), CREATE_NO_WINDOW);
if (rc == true) {
return 0;
}
return rc;
pandoraDebug ("Tentacle client was unable to copy %s",
filename.c_str ());
return -1;
}
int

View File

@ -520,9 +520,10 @@ Pandora_Wmi::convertWMIDate (string wmi_date, SYSTEMTIME *system_time)
* Runs a program in a new process.
*
* @param command Command to run, with parameters
* @param flags Process creation flags
*/
bool
Pandora_Wmi::runProgram (string command) {
Pandora_Wmi::runProgram (string command, DWORD flags) {
PROCESS_INFORMATION process_info;
STARTUPINFO startup_info;
bool success;
@ -537,7 +538,7 @@ Pandora_Wmi::runProgram (string command) {
pandoraDebug ("Start process \"%s\".", command.c_str ());
cmd = strdup (command.c_str ());
success = CreateProcess (NULL, cmd, NULL, NULL, FALSE, 0,
success = CreateProcess (NULL, cmd, NULL, NULL, FALSE, flags,
NULL, NULL, &startup_info, &process_info);
pandoraFree (cmd);

View File

@ -58,7 +58,7 @@ namespace Pandora_Wmi {
void convertWMIDate (string wmi_date,
SYSTEMTIME *system_time);
bool runProgram (string command);
bool runProgram (string command, DWORD flags = 0);
bool startService (string service_name);
bool stopService (string service_name);
void runWMIQuery (string wmi_query,