PdhUpdateLogA function (pdh.h)

Collects counter data for the current query and writes the data to the log file.

Syntax

PDH_FUNCTION PdhUpdateLogA(
  [in] PDH_HLOG hLog,
  [in] LPCSTR   szUserString
);

Parameters

[in] hLog

Handle of a single log file to update. The PdhOpenLog function returns this handle.

[in] szUserString

Null-terminated string that contains a user-defined comment to add to the data record. The string can not be empty.

Return value

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, the return value is a system error code or a PDH error code. The following are possible values.

Return code Description
PDH_INVALID_HANDLE
The log file handle is not valid.
PDH_INVALID_ARGUMENT
An empty string was passed in the szUserString parameter.

Remarks

If you are updating a log file from another log file, the comments from the other log file do not migrate.

Examples

For an example, see Writing Performance Data to a Log File.

Note

The pdh.h header defines PdhUpdateLog as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header pdh.h
Library Pdh.lib
DLL Pdh.dll

See also

PdhGetLogFileSize

PdhOpenLog

PdhOpenQuery

PdhUpdateLogFileCatalog