Microsoft KB Archive/188769

{|
 * width="100%"|

BUG: LoadPerfCounterTextString Fails with Error 87

 * }

Q188769

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), used with:
 * the operating system: Microsoft Windows NT 4.0
 * the operating system: Microsoft Windows 2000

-

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.