c++ - Using RegQueryValueEx and HKEY_PERFORMANCE_COUNTER to Get "Disk Bytes/sec% -


I have looked for examples and documentation, but I still can not understand it ...

RegQueryValueEx ( not pdhxage function) to query something like disk bytes / sec ?

I have tried the following:

  DWORD type; Static Union (TCHAR Data [32 * 1024]; PERF_DATA_BLOCK Perf; } Perf; // stack buffer DWORD cbData = sizeof (perf); LSTATUS s = RegQueryValueEx (HKEY_PERFORMANCE_DATA, _T ("physical disk"), faucet, and type, (LPBYT) and PRF, and CBDATA); PPERF_OBJECT_TYPE pObjType = (PPERF_OBJECT_TYPE) ((BYTE *) and perf + perf.Perf.HeaderLength);   

But it gives the header with no data. : (

You can not query data for this type of name instead. The query requires that the index can help you find the appropriate indicator for the query with some code. Unfortunately, you have to determine which index in run-time. For example, the following performance should be retrieved Data for processor.

  LSTATUS s = RegQueryValueEx (HKEY_PERFORMANCE_DATA, _T ("238"), faucet, and type, (LPBYT) and PRF, and CBDTA);    

Comments