Share via


CeResyncFilesys

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

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**.

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**.

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.

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
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

FSD Functions

Other Resources

ActivateDeviceEx
POST_INIT_BUF