Reactos
at master 324 lines 6.6 kB view raw
1/* 2 vfdapi.h 3 4 Virtual Floppy Drive for Windows 5 Driver control library API header 6 7 Copyright (C) 2003-2008 Ken Kato 8*/ 9 10#ifndef _VFDAPI_H_ 11#define _VFDAPI_H_ 12 13#ifdef __cplusplus 14extern "C" { 15#endif // __cplusplus 16 17// 18// custom SERVICE STATE value returned by VfdGetDriverState 19// 20#define VFD_NOT_INSTALLED 0xffffffff 21 22// 23// VFD operation code for VFD notification message 24// 25typedef enum _VFD_OPERATION { 26 VFD_OPERATION_NONE, // No operation 27 VFD_OPERATION_INSTALL, // The driver was installed 28 VFD_OPERATION_CONFIG, // The driver config was changed 29 VFD_OPERATION_REMOVE, // The driver was removed 30 VFD_OPERATION_START, // The driver was started 31 VFD_OPERATION_STOP, // The driver was stopped 32 VFD_OPERATION_OPEN, // An image was opened 33 VFD_OPERATION_SAVE, // An image was saved 34 VFD_OPERATION_CLOSE, // An image was closed 35 VFD_OPERATION_SETLINK, // A drive letter was created 36 VFD_OPERATION_DELLINK, // A drive letter was removed 37 VFD_OPERATION_PROTECT, // Write protect state was changed 38 VFD_OPERATION_SHELL, // Shell extension was installed/removed 39 VFD_OPERATION_MAX // Maximum value place holder 40} VFD_OPERATION, *PVFD_OPERATION; 41 42//============================== 43// Driver management functions 44//============================== 45 46// Install the driver 47 48DWORD WINAPI VfdInstallDriver( 49 PCSTR sFileName, 50 DWORD nStart); 51 52// Uninstall the driver 53 54DWORD WINAPI VfdRemoveDriver(); 55 56// Configure the driver 57 58DWORD WINAPI VfdConfigDriver( 59 DWORD nStart); 60 61// Start the driver 62 63DWORD WINAPI VfdStartDriver( 64 PDWORD pState); 65 66// Stop the driver 67 68DWORD WINAPI VfdStopDriver( 69 PDWORD pState); 70 71// Get current driver config information 72 73DWORD WINAPI VfdGetDriverConfig( 74 PSTR sFileName, 75 PDWORD pStart); 76 77// Get current driver state 78 79DWORD WINAPI VfdGetDriverState( 80 PDWORD pState); 81 82//============================== 83// Device control functions 84//============================== 85 86// Open a VFD device 87 88HANDLE WINAPI VfdOpenDevice( 89 ULONG nTarget); 90 91// Get the device number 92 93DWORD WINAPI VfdGetDeviceNumber( 94 HANDLE hDevice, 95 PULONG pNumber); 96 97// Get the device name 98 99DWORD WINAPI VfdGetDeviceName( 100 HANDLE hDevice, 101 PCHAR pName, 102 ULONG nLength); 103 104// Get the driver version 105 106DWORD WINAPI VfdGetDriverVersion( 107 HANDLE hDevice, 108 PULONG pVersion); 109 110//============================== 111// image functions 112//============================== 113 114// Open a virtual floppy image 115 116DWORD WINAPI VfdOpenImage( 117 HANDLE hDevice, 118 PCSTR sFileName, 119 VFD_DISKTYPE nDiskType, 120 VFD_MEDIA nMediaType, 121 VFD_FLAGS nMediaFlags); 122 123// Close the current virtual floppy image 124 125DWORD WINAPI VfdCloseImage( 126 HANDLE hDevice, 127 BOOL bForce); 128 129// Get the current image information 130 131DWORD WINAPI VfdGetImageInfo( 132 HANDLE hDevice, 133 PSTR sFileName, 134 PVFD_DISKTYPE pDiskType, 135 PVFD_MEDIA pMediaType, 136 PVFD_FLAGS pMediaFlags, 137 PVFD_FILETYPE pFileType, 138 PULONG pImageSize); 139 140// Save the current image into a file 141 142DWORD WINAPI VfdSaveImage( 143 HANDLE hDevice, 144 PCSTR sFileName, 145 BOOL bOverWrite, 146 BOOL bTruncate); 147 148// Format the current virtual media 149 150DWORD WINAPI VfdFormatMedia( 151 HANDLE hDevice); 152 153// Get the current media state (opened / write protected) 154 155DWORD WINAPI VfdGetMediaState( 156 HANDLE hDevice); 157 158// Set write protect state 159 160DWORD WINAPI VfdWriteProtect( 161 HANDLE hDevice, 162 BOOL bProtect); 163 164// Dismount the volume (should be called before Save, Format) 165 166DWORD WINAPI VfdDismountVolume( 167 HANDLE hDevice, 168 BOOL bForce); 169 170//============================== 171// Drive letter functions 172//============================== 173 174// Assign or remove a persistent drive letter 175 176DWORD WINAPI VfdSetGlobalLink( 177 HANDLE hDevice, 178 CHAR cLetter); 179 180// Get the current persistent drive letter 181 182DWORD WINAPI VfdGetGlobalLink( 183 HANDLE hDevice, 184 PCHAR pLetter); 185 186// Assign or remove an ephemeral drive letter 187 188DWORD WINAPI VfdSetLocalLink( 189 HANDLE hDevice, 190 CHAR cLetter); 191 192// Get the first ephemeral drive letter 193 194DWORD WINAPI VfdGetLocalLink( 195 HANDLE hDevice, 196 PCHAR pLetter); 197 198// Choose the first available drive letter 199 200CHAR WINAPI VfdChooseLetter(); 201 202//============================== 203// utility functions 204//============================== 205 206// Check running platform 207 208BOOL WINAPI VfdIsValidPlatform(); 209 210// Get VFD notification message value 211 212UINT WINAPI VfdGetNotifyMessage(); 213 214// Check if specified file is a valid VFD driver 215 216DWORD WINAPI VfdCheckDriverFile( 217 PCSTR sFileName, 218 PULONG pFileVersion); 219 220// Check if specified path is a valid image file 221 222DWORD WINAPI VfdCheckImageFile( 223 PCSTR sFileName, 224 PDWORD pAttributes, 225 PVFD_FILETYPE pFileType, 226 PULONG pImageSize); 227 228// Create a formatted new image file 229 230DWORD WINAPI VfdCreateImageFile( 231 PCSTR sFileName, 232 VFD_MEDIA nMediaType, 233 VFD_FILETYPE nFileType, 234 BOOL bOverWrite); 235 236// Lookup the largest media to fit in a size 237 238VFD_MEDIA WINAPI VfdLookupMedia( 239 ULONG nSize); 240 241// Get media size (in bytes) of a media type 242 243ULONG WINAPI VfdGetMediaSize( 244 VFD_MEDIA nMediaType); 245 246// Get media type name 247 248PCSTR WINAPI VfdMediaTypeName( 249 VFD_MEDIA nMediaType); 250 251// Make a file description text 252 253void WINAPI VfdMakeFileDesc( 254 PSTR pBuffer, 255 ULONG nBufSize, 256 VFD_FILETYPE nFileType, 257 ULONG nFileSize, 258 DWORD nFileAttr); 259 260//============================== 261// Shell Extension functions 262//============================== 263 264// install the shell extension 265 266DWORD WINAPI VfdRegisterHandlers(); 267 268// uninstall the shell extension 269 270DWORD WINAPI VfdUnregisterHandlers(); 271 272// check if the shell extension is installed 273 274DWORD WINAPI VfdCheckHandlers(); 275 276//============================== 277// GUI utility functions 278//============================== 279 280// open an existing image file 281 282DWORD WINAPI VfdGuiOpen( 283 HWND hParent, // parent window 284 ULONG nDevice); // device number 285 286// Save the current image 287 288DWORD WINAPI VfdGuiSave( 289 HWND hParent, // parent window 290 ULONG nDevice); // device number 291 292// close the current image 293 294DWORD WINAPI VfdGuiClose( 295 HWND hParent, // parent window 296 ULONG nDevice); // device number 297 298// format the current media 299 300DWORD WINAPI VfdGuiFormat( 301 HWND hParent, // parent window 302 ULONG nDevice); // device number 303 304// display a tooltip window 305 306void WINAPI VfdToolTip( 307 HWND hParent, // parent window 308 PCSTR sText, // tooltip text 309 int pos_x, // position x 310 int pos_y, // position y 311 BOOL stick); // stick (remain until losing the focus) or 312 // non-stick (remain until the mouse leaves) 313 314// Show image information tooltip 315 316void WINAPI VfdImageTip( 317 HWND hParent, 318 ULONG nDevice); 319 320#ifdef __cplusplus 321} 322#endif // __cplusplus 323 324#endif // _VFDAPI_H_