Close Function

Windows CE .NET

The system calls the Close function for each application when the application calls the RegCloseKey function to close the HKEY_PERFORMANCE_DATA key. The Close function performs any cleanup required by the performance data collection mechanism for the application. For example, the function can close device handles opened by the CreateFile function, or close a handle to a file-mapping object.

The following code example shows the syntax for the Close function.

DWORD WINAPI ClosePerformanceData();

The ClosePerformanceData name is a placeholder for a name defined in the application.

The function should return ERROR_SUCCESS.

Use event logging to record errors that occur during any function in the performance DLL. Logging error events can help in troubleshooting applications that provide performance data during development and after installation. Be careful not to log error events on every call to the Collect function, however, because data collection can be frequent.

The following table shows the errors that the performance library logs to the event log if the performance library has problems with the Open function. If one of the errors listed below occurs, then the performance library makes no further calls to this performance DLL. Instead, the DLL unloads and data for the object provided by the performance DLL is not returned with the performance data.

Error Description
PERFLIB_OPEN_PROC_NOT_FOUND Occurs when the procedure name defined in the registry could not be found in the DLL as an exported function. This condition typically occurs when the performance counter DLL or the service is not installed correctly or the function name has been renamed without updating the installation procedure.
PERFLIB_OPEN_PROC_FAILURE Occurs when the open procedure returned an error status other than ERROR_SUCCESS. This condition usually occurs when an expected error condition has occurred in the open procedure. Should this happen, the Counter DLL should also enter an event log entry describing the conditions that caused the failure.
PERFLIB_OPEN_PROC_EXCEPTION Occurs when the open procedure encounters an unhandled exception. This condition is typically due to an unexpected error condition encountered by the open procedure.

 Last updated on Friday, October 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.

Show: