2010-11-12 Ramon Novoa <rnovoa@artica.es>
* windows/pandora_wmi.cc: isServiceRunning returns -1 for module states other than "Running" and "Stopped". * modules/pandora_module_logevent.cc, modules/pandora_module_logevent.h: Return a non empty string if the event description can not be read. Save the event id as an unsigned long int to avoid overflows. * modules/pandora_module_service.cc, modules/pandora_module_service.h: Aesthetic fix. Removed carriage returns. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3580 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
4366580093
commit
cafe7ef8e5
|
@ -1,3 +1,17 @@
|
||||||
|
2010-11-12 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* windows/pandora_wmi.cc: isServiceRunning returns -1 for module
|
||||||
|
states other than "Running" and "Stopped".
|
||||||
|
|
||||||
|
* modules/pandora_module_logevent.cc,
|
||||||
|
modules/pandora_module_logevent.h: Return a non empty string if
|
||||||
|
the event description can not be read. Save the event id as an
|
||||||
|
unsigned long int to avoid overflows.
|
||||||
|
|
||||||
|
* modules/pandora_module_service.cc,
|
||||||
|
modules/pandora_module_service.h: Aesthetic fix. Removed carriage
|
||||||
|
returns.
|
||||||
|
|
||||||
2010-11-08 Ramon Novoa <rnovoa@artica.es>
|
2010-11-08 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* modules/pandora_module_logevent.cc,
|
* modules/pandora_module_logevent.cc,
|
||||||
|
|
|
@ -59,7 +59,7 @@ Pandora_Module_Logevent::Pandora_Module_Logevent (string name, string source, st
|
||||||
this->type = -1;
|
this->type = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->id = atoi (id.c_str ());
|
this->id = strtoul (id.c_str (), NULL, 0);
|
||||||
this->source = source;
|
this->source = source;
|
||||||
this->pattern = pattern;
|
this->pattern = pattern;
|
||||||
this->application = application;
|
this->application = application;
|
||||||
|
@ -224,6 +224,9 @@ Pandora_Module_Logevent::getLogEvents (list<string> &event_list, unsigned char d
|
||||||
|
|
||||||
// Retrieve the event description
|
// Retrieve the event description
|
||||||
getEventDescription (pevlr, description);
|
getEventDescription (pevlr, description);
|
||||||
|
if (description == "") {
|
||||||
|
strcpy (description, "N/A");
|
||||||
|
}
|
||||||
|
|
||||||
// Filter the event
|
// Filter the event
|
||||||
if (filterEvent (pevlr, description) == 0) {
|
if (filterEvent (pevlr, description) == 0) {
|
||||||
|
@ -310,6 +313,7 @@ Pandora_Module_Logevent::getEventDescription (PEVENTLOGRECORD pevlr, char *messa
|
||||||
module = LoadLibraryEx (exe_file_path, 0, DONT_RESOLVE_DLL_REFERENCES);
|
module = LoadLibraryEx (exe_file_path, 0, DONT_RESOLVE_DLL_REFERENCES);
|
||||||
if(module == NULL) {
|
if(module == NULL) {
|
||||||
RegCloseKey(hk);
|
RegCloseKey(hk);
|
||||||
|
pandoraDebug("LoadLibraryEx error %d. Exe file path %s.", GetLastError(), exe_file_path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace Pandora_Modules {
|
||||||
|
|
||||||
class Pandora_Module_Logevent : public Pandora_Module {
|
class Pandora_Module_Logevent : public Pandora_Module {
|
||||||
private:
|
private:
|
||||||
int id;
|
unsigned long id;
|
||||||
int type;
|
int type;
|
||||||
string source;
|
string source;
|
||||||
string application;
|
string application;
|
||||||
|
|
|
@ -113,7 +113,15 @@ Pandora_Wmi::isServiceRunning (string service_name) {
|
||||||
dhGetValue (L"%s", &state, quickfix,
|
dhGetValue (L"%s", &state, quickfix,
|
||||||
L".State");
|
L".State");
|
||||||
str_state = state;
|
str_state = state;
|
||||||
retval = (str_state == "Running") ? 1 : 0;
|
if (str_state == "Running") {
|
||||||
|
retval = 1;
|
||||||
|
}
|
||||||
|
else if (str_state == "Stopped") {
|
||||||
|
retval = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
retval = -1;
|
||||||
|
}
|
||||||
dhFreeString (state);
|
dhFreeString (state);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
Loading…
Reference in New Issue