CeResyncFilesys (Compact 2013)
3/26/2014
This function causes a file system driver (FSD) to remount a device because a new volume or storage medium has been inserted.
Syntax
BOOL CeResyncFilesys(
HANDLE hDevice
);
Parameters
- hDevice
[in] Handle to a registered device created with the ActivateDeviceEx function.
Return Value
TRUE indicates success. FALSE indicates failure.
Remarks
A device driver uses this function to indicate to its associated FSD that a new volume or storage medium has been inserted.
Retrieve the handle from the device's active key in the registry or from the p_hDevice member of the POST_INIT_BUF structure passed to the post-initialization I/O control.
When a driver detects a new storage medium, it can call this function with hDevice and return a BOOLEAN.
The following code example shows how to obtain the device handle by looking in the disk device's HKEY_LOCAL_MACHINE\Drivers\Active registry key. The registry path to the device's active key is passed as the dwContext parameter in DSK_Init. You must make a copy of this path in your driver structure.
Important
For readability, the following code example does not contain security checking or error handling. Do not use the following code in a production environment.
PDISK pDisk = (PDISK)pvDisk;
HKEY hActive;
HANDLE hDevice;
DWORD Type;
DWORD Len;
DWORD status;
status = RegOpenKeyEx( HKEY_LOCAL_MACHINE, pDisk->d_ActivePath, 0, 0, &hActive);
if (status)
{
DEBUGMSG(1, (TEXT("ATADISK: RegOpenKeyEx(HLM\\%s) returned %d!!!\r\n"), pDisk->d_ActivePath, status)); return 0;
}
Len = sizeof(hDevice);
status = RegQueryValueEx(hActive, DEVLOAD_HANDLE_VALNAME, NULL, &Type, (PUCHAR)&hDevice, &Len);
if (status != ERROR_SUCCESS) {
DEBUGMSG(1, (TEXT("ATADISK: RegQueryValueEx(%s) returned %d\r\n"), DEVLOAD_HANDLE_VALNAME, status));
RegCloseKey(hActive); return 0;
}
RegCloseKey(hActive);
Requirements
Header |
winbase.h |
Library |
Device.lib |