Error using pdh.dll on Windows XP Embedded

I have this programm I ran on a windows xp embedded system two weeks ago. No problems (I fixed the ones I had). Now I wanted to rerun the programm (which gathers data of CPU usage via PDH API) and I get this error message:

“The procedure entry point PdhAddEnglishCounterA could not be located in the dynamic link library pdh.dll.”

I already know I cannot use this method on XP since it is only supported from Vista on, so I used a simple strcmp-if/else query in my code which checks the argv (ofc I have to enter the right string) whether I’m using “XP mode” or “new mode”. This was already included in the programm two weeks ago, tested and working fine. I’m not even calling this methode with the right string (command line argument). The system itself was (as far as I know) untouched. The code (and query) works fine on a Windows 7 desktop pc.

Using Google the Internet tells me to try regsvr32 pdh.dll (even with /u and /i arguments). This results in

“pdh.dll was loaded, but DllRegisterServer entry point was not found. The file can not be registered”.

So now my question is: What can I do? Is this maybe related to a linker problem in Visual Studio?

This is the method where it is used:

void init(char* lang){          //init CPU und Counter
        PdhOpenQuery(NULL, NULL, &cpuQuery);
        if(strcmp(lang, "en") == 0)         
            PdhAddCounter(cpuQuery, "Processor(_Total)% Processor Time", NULL, &cpuTotal); 
        else if(strcmp(lang, "int") == 0)
            PdhAddEnglishCounter(cpuQuery, "Processor(_Total)% Processor Time", NULL, &cpuTotal);
            cerr << "Wrong Language" << endl;                   

Source: windows

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.