cbutkus Posted November 25, 2008 Share 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;} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now