CloseHandle


Close the handle that was obtained by CreateFile and sets the Controller to Reset-State, if no more Handles are opened on the driver.

Syntax:

BOOL WINAPI CloseHandle( __in HANDLE hDev );

Parameters:

Parameter Description
hDev A handle to the device obtained by CreateFile.

Return Value:
If the function succeeds, the return value is nonzero (TRUE).
If the function fails, or is completing asynchronously, the return value is zero (FALSE). To get extended error information, call the GetLastError() function.

Recommendations:

It is strongly recommended, that the application performs a DeviceIoControl(..., IOCTL_DEINIT,...) before closing the drivers handle, to ensure, that no more requests are pending.

Back to Programming Guide Contact Copyright and Disclaimer