cbutkus Posted November 25, 2008 Posted November 25, 2008 I've got a Java application that uses JNI. Part of the JNI code call the pdh methods to get the system uptime.The code is shown below. What's happening is that the call to PdhAddCounter is hanging (it doesn't return). I haven't found anything on this issue anywhere on the internet at this point. Any ideas?The application is a 32-bit app running on Windows Server 2003 Standard x64 Edition, Service Pack 2int _bladmin_win_get_uptime (){ PDH_STATUS status; HQUERY hQuery; HCOUNTER hCounter; PDH_FMT_COUNTERVALUE Value; int ret; ret = R_ERROR; if (PdhOpenQuery (NULL, 0, &hQuery) == ERROR_SUCCESS) { if ((status = PdhAddCounter(hQuery, "\\\\.\\System\\System Up Time", 0, &hCounter)) == ERROR_SUCCESS) { if ((status = PdhCollectQueryData (hQuery)) == ERROR_SUCCESS) { if ((status = PdhGetFormattedCounterValue (hCounter, PDH_FMT_LARGE , NULL, &Value)) == ERROR_SUCCESS) { ret = (DWORD)(Value.largeValue); } } PdhRemoveCounter (hCounter); } PdhCloseQuery (hQuery); } return ret;}
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now