CeResyncFilesys (Windows CE 5.0)

Send Feedback

This function causes a file system driver (FSD) to remount a device because of a medium change.

BOOL CeResyncFilesys(HANDLE hDevice);

Parameters

  • hDevice
    [in] Handle to registered device created with a call to the ActivateDeviceEx function.

Return Values

TRUE indicates success. FALSE indicates failure.

Remarks

A device driver uses CeResyncFilesys to indicate to its associated file system driver (FSD) that a new volume or media has been inserted.

Retrieve the handle from the device's active key in the registry or from the p_hDevice field of the POST_INIT_BUF structure passed to the post-initialization IOCTL.

When a driver detects a media change it can call CeResyncFilesys with hDevice and return a BOOL.

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 in DSK_Init. You need to 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

OS Versions: Windows CE 3.0 and later.
Header: Winbase.h.
Link Library: Device.lib.

See Also

ActivateDeviceEx | POST_INIT_BUF

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.