FSDMGR Helper Functions for FSD Developers

FSDMGR provides many helper functions to make developing an FSD easier. In particular, registry helper functions provide a simple mechanism for configuring an FSD for a particular storage device and I/O helper functions provide a media-independent mechanism for communicating with a block/disk driver. These functions are defined in public\common\sdk\inc\fsdmgr.h.

FSDMGR_GetVolumeName

Used by an FSD to retrieve the name of the volume that was registered (the name of the folder where it is mounted, e.g. \Storage Card). Typically, the only reason an FSD would need to know the name of its volume is for posting callback file notifications.

FSDMGR_GetRegistryValue

FSDMGR_GetRegistryString

FSDMGR_GetRegistryFlag

A set of registry helper functions that allow an FSD to read registry settings without being aware of the registry key from which it was loaded. It is advised that all FSDs use these registry helper functions to load run-time settings. All three helper functions search the profile file system key and the base file system key (in that order).

; profile file system key:
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MyProfile\MyFSD]
"RegistryValue1"=dword:1

; base file system key:
[HKEY_LOCAL_MACHINE\System\StorageManager\MyFSD]
"RegistryString1"="test string"

Because of the profile key search, it is possible for an FSD to have multiple sets of configurations. These unique configurations can be targeted at different storage devices advertising different storage profile names.

FSDMGR_RegisterVolume

Invoked by an FSD when it is mounted (from FSD_MountDisk), this function associates an instance of an FSD (volume) with a partition on a disk. See more details in the section “Interacting with FSDMGR” below.

FSDMGR_DeregisterVolume

Invoked by an FSD when it is ummounted (from FSD_UnmountDisk), this function disassociates an instance of an FSD (volume) with a partition on a disk. See more details in the section “Interacting with FSDMGR” below.

FSDMGR_CreateSearchHandle

FSDMGR_CreateFileHandle

Helper functions used by an FSD in functions that return a HANDLE value: FSD_FindFirstFileW and FSD_CreateFileW. These functions convert the FSD’s handle context object into a search or file handle that can be returned to the caller. See more details in the section “Interacting with FSDMGR” below.

FSDMGR_GetDiskInfo

Used by an FSD to retrieve geometry for the underlying disk partition. This function is typically used to retrieve the sector size for the media, which is required information for performing subsequent disk I/O operations. Also provided is the total number of sectors in the partition. The FSD has access to all of these sectors.

FSDMGR_ReadDisk

A simple disk-read function; reads a number of contiguous sectors and returns them to the FSD.

FSDMGR_WriteDisk

A simple disk-write function; writes FSD-provided data to a number of contiguous sectors.

FSDMGR_ReadDiskEx

A more advanced disk-read function; reads a number of contiguous sectors into multiple FSD-provided buffers.

FSDMGR_WriteDiskEx

A more advanced disk-write function; writes data from a number of FSD-provided buffers to contiguous sectors.

FSDMGR_DiskIoControl

A generic disk I/O function for performing storage-driver specific operations. Any disk control code can be passed to this function (IOCTL_DISK_xxx).