2007-09-05 Esteban Sanchez <estebans@artica.es>

* 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.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@643 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Esteban Sanchez 2007-09-05 16:22:26 +00:00
parent 4b703ffd39
commit ee800a101b
5 changed files with 38 additions and 9 deletions

View File

@ -1,3 +1,14 @@
2007-09-05 Esteban Sanchez <estebans@artica.es>
* 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 <raulofpandora@gmail.com> 2007-09-03 Raul Mateos <raulofpandora@gmail.com>
* installer/pandora_1.3.mpi: Updated texts in several languages. Now some * installer/pandora_1.3.mpi: Updated texts in several languages. Now some

View File

@ -160,7 +160,7 @@ Pandora::pandoraDebug (char *format, ...) {
vsprintf (msg, format, args); vsprintf (msg, format, args);
va_end (args); va_end (args);
pandoraWriteLog ("pandora_agent.err", (char *) msg); pandoraWriteLog ("pandora_debug.log", (char *) msg);
} }
return; return;
} }

View File

@ -245,7 +245,7 @@ Pandora_Windows_Service::copyFtpDataFile (string host,
} catch (FTP::Authentication_Failed e) { } catch (FTP::Authentication_Failed e) {
pandoraLog ("Pandora Agent: Authentication Failed " pandoraLog ("Pandora Agent: Authentication Failed "
"when connecting to %s (%s)", "when connecting to %s (%s)",
host.c_str (), ftp_client.getError ().c_str ()); host.c_str (), ftp_client.getError ().c_str ());
ftp_client.disconnect (); ftp_client.disconnect ();
throw e; throw e;
} catch (FTP::FTP_Exception e) { } catch (FTP::FTP_Exception e) {

View File

@ -133,12 +133,16 @@ unsigned 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, space_str;
unsigned long long space = 0; unsigned long long space = 0;
string space_str;
string query; 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 { 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,
@ -146,9 +150,23 @@ Pandora_Wmi::getDiskFreeSpace (string disk_id) {
query.c_str ())); query.c_str ()));
FOR_EACH (quickfix, quickfixes, NULL) { FOR_EACH (quickfix, quickfixes, NULL) {
dhGetValue (L"%d", &space, quickfix, QFix fix = { 0 };
dhGetValue (L"%s", &fix.free_space, quickfix,
L".FreeSpace"); 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; return space / 1024 / 1024;
} NEXT_THROW (quickfix); } NEXT_THROW (quickfix);
} catch (string errstr) { } catch (string errstr) {
@ -165,7 +183,7 @@ Pandora_Wmi::getDiskFreeSpace (string disk_id) {
* *
* @return The usage percentage of the CPU. * @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. * from WMI database.
*/ */
int int
@ -253,7 +271,7 @@ Pandora_Wmi::getOSName () {
FOR_EACH (quickfix, quickfixes, NULL) { FOR_EACH (quickfix, quickfixes, NULL) {
dhGetValue (L"%s", &name, quickfix, dhGetValue (L"%s", &name, quickfix,
L".Caption"); L".Caption");
ret = name; ret = name;
dhFreeString (name); dhFreeString (name);