mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
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:
parent
aa412a0dd1
commit
a0b5f01761
@ -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>
|
2009-02-09 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
* main.cc: Added a new parameter --process to run the agent as a
|
* main.cc: Added a new parameter --process to run the agent as a
|
||||||
|
@ -207,7 +207,7 @@ Pandora_Windows_Service::copyTentacleDataFile (string host,
|
|||||||
string pass,
|
string pass,
|
||||||
string opts)
|
string opts)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
bool rc = false;
|
||||||
string var, filepath;
|
string var, filepath;
|
||||||
string tentacle_cmd;
|
string tentacle_cmd;
|
||||||
|
|
||||||
@ -244,26 +244,14 @@ Pandora_Windows_Service::copyTentacleDataFile (string host,
|
|||||||
filepath.c_str (), host.c_str ());
|
filepath.c_str (), host.c_str ());
|
||||||
pandoraDebug ("Command %s", tentacle_cmd.c_str());
|
pandoraDebug ("Command %s", tentacle_cmd.c_str());
|
||||||
|
|
||||||
rc = system (tentacle_cmd.c_str());
|
rc = Pandora_Wmi::runProgram (tentacle_cmd.c_str(), CREATE_NO_WINDOW);
|
||||||
switch (rc) {
|
if (rc == true) {
|
||||||
|
return 0;
|
||||||
/* 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
pandoraDebug ("Tentacle client was unable to copy %s",
|
||||||
|
filename.c_str ());
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -520,9 +520,10 @@ Pandora_Wmi::convertWMIDate (string wmi_date, SYSTEMTIME *system_time)
|
|||||||
* Runs a program in a new process.
|
* Runs a program in a new process.
|
||||||
*
|
*
|
||||||
* @param command Command to run, with parameters
|
* @param command Command to run, with parameters
|
||||||
|
* @param flags Process creation flags
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
Pandora_Wmi::runProgram (string command) {
|
Pandora_Wmi::runProgram (string command, DWORD flags) {
|
||||||
PROCESS_INFORMATION process_info;
|
PROCESS_INFORMATION process_info;
|
||||||
STARTUPINFO startup_info;
|
STARTUPINFO startup_info;
|
||||||
bool success;
|
bool success;
|
||||||
@ -537,7 +538,7 @@ Pandora_Wmi::runProgram (string command) {
|
|||||||
|
|
||||||
pandoraDebug ("Start process \"%s\".", command.c_str ());
|
pandoraDebug ("Start process \"%s\".", command.c_str ());
|
||||||
cmd = strdup (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);
|
NULL, NULL, &startup_info, &process_info);
|
||||||
pandoraFree (cmd);
|
pandoraFree (cmd);
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ namespace Pandora_Wmi {
|
|||||||
void convertWMIDate (string wmi_date,
|
void convertWMIDate (string wmi_date,
|
||||||
SYSTEMTIME *system_time);
|
SYSTEMTIME *system_time);
|
||||||
|
|
||||||
bool runProgram (string command);
|
bool runProgram (string command, DWORD flags = 0);
|
||||||
bool startService (string service_name);
|
bool startService (string service_name);
|
||||||
bool stopService (string service_name);
|
bool stopService (string service_name);
|
||||||
void runWMIQuery (string wmi_query,
|
void runWMIQuery (string wmi_query,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user