BUG: LoadPerfCounterTextString Fails with Error 87

ID: Q188769

The information in this article applies to:

SYMPTOMS

The LoadPerfCounterTextString Win32 API fails with return code 87 (ERROR_INVALID_PARAMETER) when you use it as prescribed in the Platform SDK documentation.

CAUSE

The first parameter needs more information in addition to the .ini filename to qualify parameter validation.

RESOLUTION

To work around this problem, pre-pend characters and a space to the filename specification for the first parameter. Then LoadPerfCounterTextString will qualify the first parameter, but ignore the pre-pended characters.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The documentation states that the first parameter, lpCommandLine, is the name of your initialization file. Although this is a reasonable design it does not work this way.

LoadPerfCounterTextString was implemented in conjunction with the Lodctr.exe utility. The main routine of the utility simply takes the command-line information and passes it to LoadPerfCounterTextString, which is typically the name of the executable (a space character), and the name of a file. It does not matter what the pre-pended word in the string is. For example:

   lRet = LoadPerfCounterTextString("x myperf.ini", FALSE);

The filename myperf.ini specifies a hypothetical performance counter .ini file.

REFERENCES

For more information about LoadPerfCounterTextString see:

Platform SDK: Windows Base Services; Windows NT Features; Performance Data Helper; Performance Data Helper; Adding Performance Counters

Additional query words:

Keywords          : kberrmsg kbKernBase kbPerfMon 
Version           : WINNT:4.0;
Platform          : winnt
Issue type        : kbbug
Solution Type     : kbpending

Last Reviewed: July 2, 1998