diff --git a/pandora_agents/win32/ChangeLog b/pandora_agents/win32/ChangeLog index f0b1c50b8e..1e433f7669 100644 --- a/pandora_agents/win32/ChangeLog +++ b/pandora_agents/win32/ChangeLog @@ -1,3 +1,14 @@ +2007-09-05 Esteban Sanchez + + * windows/pandora_wmi.cc: Fixed a bug that return 0 in some cases of + free disk space. + + * pandora.cc: Renamed debug file to pandora_debug.log + + * pandora_windows_service.cc: Fixed a blank space. + + * bin/PandoraAgent.exe: Updated to last commit. + 2007-09-03 Raul Mateos * installer/pandora_1.3.mpi: Updated texts in several languages. Now some diff --git a/pandora_agents/win32/bin/PandoraAgent.exe b/pandora_agents/win32/bin/PandoraAgent.exe index 2f8a12c0c0..fa1339290f 100755 Binary files a/pandora_agents/win32/bin/PandoraAgent.exe and b/pandora_agents/win32/bin/PandoraAgent.exe differ diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 2ee121c37c..6ca117900b 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -160,7 +160,7 @@ Pandora::pandoraDebug (char *format, ...) { vsprintf (msg, format, args); va_end (args); - pandoraWriteLog ("pandora_agent.err", (char *) msg); + pandoraWriteLog ("pandora_debug.log", (char *) msg); } return; } diff --git a/pandora_agents/win32/pandora_windows_service.cc b/pandora_agents/win32/pandora_windows_service.cc index 156b61023e..a8b91b92ee 100644 --- a/pandora_agents/win32/pandora_windows_service.cc +++ b/pandora_agents/win32/pandora_windows_service.cc @@ -245,7 +245,7 @@ Pandora_Windows_Service::copyFtpDataFile (string host, } catch (FTP::Authentication_Failed e) { pandoraLog ("Pandora Agent: Authentication Failed " "when connecting to %s (%s)", - host.c_str (), ftp_client.getError ().c_str ()); + host.c_str (), ftp_client.getError ().c_str ()); ftp_client.disconnect (); throw e; } catch (FTP::FTP_Exception e) { diff --git a/pandora_agents/win32/windows/pandora_wmi.cc b/pandora_agents/win32/windows/pandora_wmi.cc index 78982774a1..7830b308fe 100644 --- a/pandora_agents/win32/windows/pandora_wmi.cc +++ b/pandora_agents/win32/windows/pandora_wmi.cc @@ -133,12 +133,16 @@ unsigned long Pandora_Wmi::getDiskFreeSpace (string disk_id) { CDhInitialize init; CDispPtr wmi_svc, quickfixes; - string id, space_str; unsigned long long space = 0; + string space_str; string query; - query = "SELECT DeviceID, FreeSpace FROM Win32_LogicalDisk WHERE DeviceID = \"" + disk_id + "\""; - + query = "SELECT FreeSpace FROM Win32_LogicalDisk WHERE DeviceID = \"" + disk_id + "\""; + + struct QFix { + CDhStringA free_space; + }; + try { dhCheck (dhGetObject (getWmiStr (L"."), NULL, &wmi_svc)); dhCheck (dhGetValue (L"%o", &quickfixes, wmi_svc, @@ -146,9 +150,23 @@ Pandora_Wmi::getDiskFreeSpace (string disk_id) { query.c_str ())); FOR_EACH (quickfix, quickfixes, NULL) { - dhGetValue (L"%d", &space, quickfix, + QFix fix = { 0 }; + dhGetValue (L"%s", &fix.free_space, quickfix, L".FreeSpace"); - + + if (fix.free_space == NULL) + return 0; + + space_str = fix.free_space; + dhFreeString (name); + + try { + + space = Pandora_Strutils::strtoulong (space_str); + } catch (Pandora_Exception e) { + throw Pandora_Wmi_Exception (); + } + return space / 1024 / 1024; } NEXT_THROW (quickfix); } catch (string errstr) { @@ -165,7 +183,7 @@ Pandora_Wmi::getDiskFreeSpace (string disk_id) { * * @return The usage percentage of the CPU. * - * @exception Pandora_Wmi_Exception Throwd if an error occured when reading + * @exception Pandora_Wmi_Exception Throwed if an error occured when reading * from WMI database. */ int @@ -253,7 +271,7 @@ Pandora_Wmi::getOSName () { FOR_EACH (quickfix, quickfixes, NULL) { dhGetValue (L"%s", &name, quickfix, L".Caption"); - + ret = name; dhFreeString (name);