`
mmdev
  • 浏览: 12929307 次
  • 性别: Icon_minigender_1
  • 来自: 大连
文章分类
社区版块
存档分类
最新评论

File System Driver Creation

 
阅读更多
File System Driver Creation A file system driver (FSD) is a dynamic-link library (DLL) that exports file system entry points that map to standard Microsoft® Windows® CE file system functions, such as CreateFile and CreateDirectory. When an application calls a file system function, and the function references a file on a volume registered by the FSD, the FSD Manager maps the call to the FSD. The FSD Manager manages all system interactions with installable FSDs. The operating system (OS) provides a template for functions that you need to develop for a file system. Typically, an FSD exports a full range of functions, but you can also choose to not export an entry point for a particular file system function if you do not want that function to be available. For example, to prevent applications from creating or destroying directories inside volumes belonging to your FSD, do not include CreateDirectory and RemoveDirectory in your FSD. The FSD Manager automatically supplies stub functions for any functions that you choose not to supply for your file system. These stub functions return ERROR_NOT_SUPPORTED. As a result, if an application tries to create or remove a directory on a volume that belongs to your FSD, the call fails. In addition to exporting entry points for the file system functions, an FSD must export entry points for the FSD_MountDisk and FSD_UnmountDisk functions. The Device Manager calls FSD_MountDisk when a target device for which that FSD has been registered is inserted or removed. The FSD_MountDisk and FSD_UnmountDisk entry points are each passed a DWORD that uniquely identifies the disk being mounted. These DWORD types are passed back to the FSD Manager services that query, read, and write to that disk. To create an FSD for a hypothetical file system named MyFSD, you must create a DLL named MyFSD.dll. This DLL contains the data type definitions, header files, and functions for MyFSD. You can define the PVOLUME, PFILE, and PSEARCH data types in MyFSD.dll. Use these types to declare variables and function parameters that hold information about the mounted volume, the file, and the search handle, respectively. These data types are used throughout the FSD functions and by default, are all DWORD types. You can redefine these data types to contain any information that you need. For example, you can redefine them as pointers to customized structures. You must redefine these types before including Fsdmgr.h or the default definitions will be used. The code that compiles into MyFSD.dll must include Fsdmgr.h. This header file generates the prototypes for all of the functions that you write for your file system. If you want to define the PVOLUME, PFILE, and PSEARCH data types, do so before including Fsdmgr.h. You must also define a constant, FSDAPI, which is the name of your file system. The following code example shows how to include the header file Fsdmgr.h in MyFSD.dll. Copy // This defines a type that is a pointer to a structure containing // two DWORDs. typedef struct { DWORD first_field; DWORD second_field; } TWODWORDS, *PTWODWORDS; // In this example, only PSEARCH is redefined. // PFILE and PVOLUME will default to being defined as DWORDs. // You can define these types to be different types or the // same type, based on your FSD needs. #define PSEARCH PTWODWORDS // Now define the name of the file system. #define FSDAPI MyFSD #include <fsdmgr.h> The file system name, the prefix for all functions, and the name of the resulting DLL are all defined by the name that you specify for FSDAPI. MyFSD.dll must generate prototypes for all FSD Manager services that your FSD needs. MyFSD.dll must export entry points for all file system functions that you want to export. For each of these file system functions, the function name must be preceded by the name of your FSD, which is MyFSD_ in this example. You must also implement the MyFSD_MountDisk and MyFSD_UnmountDisk functions in MyFSD.dll. These functions are exported using the generic names FSD_MountDisk and FSD_UnmountDisk. FSD Manager uses these functions to identify MyFSD.dll as a legitimate FSD. The following code example shows how to export functions for MyFSD.dll in a module definition (.def) file. Copy LIBRARY MyFSD DESCRIPTION 'My File System for Windows CE' EXPORTS MyFSD_MountDisk MyFSD_UnmountDisk FSD_MountDisk=MyFSD_MountDisk FSD_UnmountDisk=MyFSD_UnmountDisk MyFSD_CreateDirectoryW MyFSD_RemoveDirectoryW MyFSD_GetFileAttributesW MyFSD_SetFileAttributesW MyFSD_DeleteFileW MyFSD_MoveFileW MyFSD_DeleteAndRenameFileW MyFSD_GetDiskFreeSpaceW MyFSD_Notify MyFSD_RegisterFileSystemFunction MyFSD_FindFirstFileW MyFSD_FindNextFileW MyFSD_FindClose MyFSD_CreateFileW MyFSD_ReadFile MyFSD_ReadFileWithSeek MyFSD_WriteFile MyFSD_WriteFileWithSeek MyFSD_SetFilePointer MyFSD_GetFileSize MyFSD_GetFileInformationByHandle MyFSD_FlushFileBuffers MyFSD_GetFileTime MyFSD_SetFileTime MyFSD_SetEndOfFile MyFSD_DeviceIOControl MyFSD_CloseFile MyFSD_CloseVolume The MyFSD hypothetical file system implements the full set of functions for working with a file system. You must supply the functions necessary for your file system. However, as previously mentioned, you can choose to not provide a function in your FSD. For any missing functions, FSD Manager automatically provides stub functions that return ERROR_NOT_SUPPORTED. </fsdmgr.h>
分享到:
评论

相关推荐

    Operating.System.Design.The.Xinu.Approach.2nd.Edition

    The text begins with a bare machine and proceeds step by step through the design and implementation of Xinu which is a small elegant operating system that supports dynamic process creation dynamic ...

    vxbus_device_driver_developers_guide_6.9

    3.3.1 File Location ...................................................................................................... 20 Wind River Drivers ..........................................................

    S7A驱动720版本

    - The driver can now be registered as a service with the local system account as the log-on account. For more information see the document "S7A_as_Service.PDF" on the installation CD . - The ...

    java7帮助文档

    The directory &lt;Java home&gt;/demo/nio/zipfs/ contains samples that demonstrate the NIO.2 NFS (Network File System) file system. Networking The URLClassLoader.close method has been added; see Closing a ...

    vxworks_kernel_programmers_guide_6.9

    2.3.2 Device Driver Selection ................................................................................... 13 2.3.3 Component Bundles and Configuration Profiles ...................................

    CA-100CUSB充电线改装为移动电源

    • FTLang will now detect current user interface language rather than Windows system language. Release version 2.04.16 (February 17, 2009) WHQL certified version with various bug fixes and ...

    8-07-14_MegaCLI for linux_windows

    SCGCQ00393585 (DFCT) - VD creation from MegaCli fails on Solaris Sparc 10u9 operating system. SCGCQ00413883 (DFCT) - "megacli -version -pd -a0" Segmentation Faults if PDs are missing SCGCQ00445356 (C...

    PHP5 完整官方 中文教程

    PS — PostScript document creation Pspell — Pspell Functions qtdom — qtdom Functions radius — Radius Rar — Rar Functions Readline — GNU Readline Recode — GNU Recode Functions RPMReader — RPM ...

    a project model for the FreeBSD Project.7z

    Committers fall into three groups: committers who are only concerned with one area of the project (for instance file systems), committers who are involved only with one sub-project and committers who ...

    PHP5中文参考手册

    PS — PostScript document creation Pspell — Pspell Functions qtdom — qtdom Functions radius — Radius Rar — Rar Functions Readline — GNU Readline Recode — GNU Recode Functions RPMReader — RPM ...

    Microsoft Windows 7 In Depth.pdf

    got a bad rap, perhaps for some good reasons: It was slow, required too much RAM, had driver issues, and annoyed users with its User Account Control prompts. Windows 7 fixes all of that, thank ...

    PHP官方手册中文版

    54. PDO Driver How-To 55. Extension FAQs 56. Zend Engine 2 API reference 57. Zend Engine 1 58. The future: PHP 6 and Zend Engine 3 VIII. FAQ:常见问题 59. 一般信息 60. 邮件列表 61. 获取 PHP ...

    PHP手册2007整合中文版

    54. PDO Driver How-To 55. Extension FAQs 56. Zend Engine 2 API reference 57. Zend Engine 1 58. The future: PHP 6 and Zend Engine 3 VIII. FAQ:常见问题 59. 一般信息 60. 邮件列表 61. 获取 PHP 62. 数据库...

    acpi控制笔记本风扇转速

    Moved all FADT-related functions to a new file, tbfadt.c. Eliminated the AcpiHwInitialize function - the FADT registers are now validated when the table is loaded. Added two new warnings during FADT ...

    Bochs - The cross platform IA-32 (x86) emulator

    - USB printer: output file creation failure now causes a disconnect - re-implemented "options" parameter for additional options of connected devices (currently only used to set the speed reported ...

    cpuz 1.0 完美版

    - UseDisplayAPI : Set to 1, uses the display driver to read the display adapters information. Parameters 参数 ---------- -txt=filename : Launch CPU-Z in ghost mode (no interface appears) and ...

    The Definitive Guide to NetBeans Platform

    ■CHAPTER 7 File Access and Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 ■CHAPTER 8 Graphical Components . . . . . . . . . . . . . . . . . . . . . . . . . . ....

Global site tag (gtag.js) - Google Analytics