2006-07-14 Esteban Sanchez <estebans@artica.es>

* modules/pandora_module_factory.cc: Removed unnecessary debug.

        * windows/pandora_wmi.cc: Removed graphical exceptions to be executed when something happens with disphelper library. Get a string when retrieving the FreeSpace field on getDiskFreeSpace(), it solves a bug when the free space was a huge amount.

        * bin/PandoraAgent.exe: Updated to the new commit.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@138 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
esanchezm 2006-07-17 09:13:46 +00:00
parent 29283c3bf9
commit 2790c437ac
4 changed files with 26 additions and 26 deletions

View File

@ -1,3 +1,14 @@
2006-07-14 Esteban Sanchez <estebans@artica.es>
* modules/pandora_module_factory.cc: Removed unnecessary debug.
* windows/pandora_wmi.cc: Removed graphical exceptions to be executed
when something happens with disphelper library. Get a string when
retrieving the FreeSpace field on getDiskFreeSpace(), it solves a bug
when the free space was a huge amount.
* bin/PandoraAgent.exe: Updated to the new commit.
2006-07-12 Esteban Sanchez <estebans@artica.es> 2006-07-12 Esteban Sanchez <estebans@artica.es>
* modules/pandora_module_freememory.[cc,h]: Added to repository. * modules/pandora_module_freememory.[cc,h]: Added to repository.

View File

@ -147,7 +147,6 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_freedisk); module_freedisk);
} else if (module_freememory != "") { } else if (module_freememory != "") {
pandoraDebug ("Freememory");
module = new Pandora_Module_Freememory (module_name); module = new Pandora_Module_Freememory (module_name);
} else if (module_cpuusage != "") { } else if (module_cpuusage != "") {

View File

@ -52,8 +52,6 @@ Pandora_Wmi::isProcessRunning (string process_name) {
string name; string name;
int result = 0; int result = 0;
dhToggleExceptions (TRUE);
struct QFix { struct QFix {
CDhStringA name, description, state; CDhStringA name, description, state;
}; };
@ -91,8 +89,6 @@ Pandora_Wmi::isServiceRunning (string service_name) {
CDispPtr wmi_svc, quickfixes; CDispPtr wmi_svc, quickfixes;
string name, state; string name, state;
dhToggleExceptions (TRUE);
struct QFix { struct QFix {
CDhStringA name, state; CDhStringA name, state;
}; };
@ -136,20 +132,18 @@ long
Pandora_Wmi::getDiskFreeSpace (string disk_id) { Pandora_Wmi::getDiskFreeSpace (string disk_id) {
CDhInitialize init; CDhInitialize init;
CDispPtr wmi_svc, quickfixes; CDispPtr wmi_svc, quickfixes;
string id; string id, space_str;
int space;
dhToggleExceptions (TRUE);
struct QFix { struct QFix {
CDhStringA id; CDhStringA id, free_space;
long free_space;
}; };
try { try {
dhCheck (dhGetObject (getWmiStr (L"."), NULL, &wmi_svc)); dhCheck (dhGetObject (getWmiStr (L"."), NULL, &wmi_svc));
dhCheck (dhGetValue (L"%o", &quickfixes, wmi_svc, dhCheck (dhGetValue (L"%o", &quickfixes, wmi_svc,
L".ExecQuery(%S)", L".ExecQuery(%S)",
L"SELECT * FROM Win32_LogicalDisk ")); L"SELECT DeviceID, FreeSpace FROM Win32_LogicalDisk "));
FOR_EACH (quickfix, quickfixes, NULL) { FOR_EACH (quickfix, quickfixes, NULL) {
QFix fix = { 0 }; QFix fix = { 0 };
@ -160,10 +154,18 @@ Pandora_Wmi::getDiskFreeSpace (string disk_id) {
id = fix.id; id = fix.id;
if (disk_id == id) { if (disk_id == id) {
dhGetValue (L"%d", &fix.free_space, quickfix, dhGetValue (L"%s", &fix.free_space, quickfix,
L".FreeSpace"); L".FreeSpace");
return fix.free_space / 1024 / 1024; space_str = fix.free_space;
try {
space = Pandora_Strutils::strtoint (space_str);
} catch (Pandora_Exception e) {
throw Pandora_Wmi_Error ();
}
return space / 1024 / 1024;
} }
} NEXT_THROW (quickfix); } NEXT_THROW (quickfix);
@ -180,8 +182,6 @@ Pandora_Wmi::getCpuUsagePercentage (int cpu_id) {
CDispPtr wmi_svc, quickfixes; CDispPtr wmi_svc, quickfixes;
string id, cpu_id_str; string id, cpu_id_str;
dhToggleExceptions (TRUE);
cpu_id_str = "CPU"; cpu_id_str = "CPU";
cpu_id_str += Pandora_Strutils::inttostr (cpu_id); cpu_id_str += Pandora_Strutils::inttostr (cpu_id);
@ -225,8 +225,6 @@ Pandora_Wmi::getFreememory () {
CDhInitialize init; CDhInitialize init;
CDispPtr wmi_svc, quickfixes; CDispPtr wmi_svc, quickfixes;
dhToggleExceptions (TRUE);
struct QFix { struct QFix {
long free_memory; long free_memory;
}; };
@ -258,8 +256,6 @@ Pandora_Wmi::getOSName () {
CDispPtr wmi_svc, quickfixes; CDispPtr wmi_svc, quickfixes;
string ret; string ret;
dhToggleExceptions (TRUE);
struct QFix { struct QFix {
CDhStringA name, state, description; CDhStringA name, state, description;
}; };
@ -292,8 +288,6 @@ Pandora_Wmi::getOSVersion () {
CDispPtr wmi_svc, quickfixes; CDispPtr wmi_svc, quickfixes;
string ret; string ret;
dhToggleExceptions (TRUE);
struct QFix { struct QFix {
CDhStringA name, state, description; CDhStringA name, state, description;
}; };
@ -325,9 +319,7 @@ Pandora_Wmi::getOSBuild () {
CDhInitialize init; CDhInitialize init;
CDispPtr wmi_svc, quickfixes; CDispPtr wmi_svc, quickfixes;
string ret; string ret;
dhToggleExceptions (TRUE);
struct QFix { struct QFix {
CDhStringA name, state, description; CDhStringA name, state, description;
}; };
@ -360,8 +352,6 @@ Pandora_Wmi::getSystemName () {
CDispPtr wmi_svc, quickfixes; CDispPtr wmi_svc, quickfixes;
string ret; string ret;
dhToggleExceptions (TRUE);
struct QFix { struct QFix {
CDhStringA name, state, description; CDhStringA name, state, description;
}; };