xref: /reactos/modules/rosapps/include/vfd/vfdapi.h (revision 40462c92)
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
14 extern "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 //
25 typedef 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 
48 DWORD WINAPI VfdInstallDriver(
49 	PCSTR			sFileName,
50 	DWORD			nStart);
51 
52 //	Uninstall the driver
53 
54 DWORD WINAPI VfdRemoveDriver();
55 
56 //	Configure the driver
57 
58 DWORD WINAPI VfdConfigDriver(
59 	DWORD			nStart);
60 
61 //	Start the driver
62 
63 DWORD WINAPI VfdStartDriver(
64 	PDWORD			pState);
65 
66 //	Stop the driver
67 
68 DWORD WINAPI VfdStopDriver(
69 	PDWORD			pState);
70 
71 //	Get current driver config information
72 
73 DWORD WINAPI VfdGetDriverConfig(
74 	PSTR			sFileName,
75 	PDWORD			pStart);
76 
77 //	Get current driver state
78 
79 DWORD WINAPI VfdGetDriverState(
80 	PDWORD			pState);
81 
82 //==============================
83 //	Device control functions
84 //==============================
85 
86 //	Open a VFD device
87 
88 HANDLE WINAPI VfdOpenDevice(
89 	ULONG			nTarget);
90 
91 //	Get the device number
92 
93 DWORD WINAPI VfdGetDeviceNumber(
94 	HANDLE			hDevice,
95 	PULONG			pNumber);
96 
97 //	Get the device name
98 
99 DWORD WINAPI VfdGetDeviceName(
100 	HANDLE			hDevice,
101 	PCHAR			pName,
102 	ULONG			nLength);
103 
104 //	Get the driver version
105 
106 DWORD WINAPI VfdGetDriverVersion(
107 	HANDLE			hDevice,
108 	PULONG			pVersion);
109 
110 //==============================
111 //	image functions
112 //==============================
113 
114 //	Open a virtual floppy image
115 
116 DWORD 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 
125 DWORD WINAPI VfdCloseImage(
126 	HANDLE			hDevice,
127 	BOOL			bForce);
128 
129 //	Get the current image information
130 
131 DWORD 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 
142 DWORD WINAPI VfdSaveImage(
143 	HANDLE			hDevice,
144 	PCSTR			sFileName,
145 	BOOL			bOverWrite,
146 	BOOL			bTruncate);
147 
148 //	Format the current virtual media
149 
150 DWORD WINAPI VfdFormatMedia(
151 	HANDLE			hDevice);
152 
153 //	Get the current media state (opened / write protected)
154 
155 DWORD WINAPI VfdGetMediaState(
156 	HANDLE			hDevice);
157 
158 //	Set write protect state
159 
160 DWORD WINAPI VfdWriteProtect(
161 	HANDLE			hDevice,
162 	BOOL			bProtect);
163 
164 //	Dismount the volume (should be called before Save, Format)
165 
166 DWORD 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 
176 DWORD WINAPI VfdSetGlobalLink(
177 	HANDLE			hDevice,
178 	CHAR			cLetter);
179 
180 //	Get the current persistent drive letter
181 
182 DWORD WINAPI VfdGetGlobalLink(
183 	HANDLE			hDevice,
184 	PCHAR			pLetter);
185 
186 //	Assign or remove an ephemeral drive letter
187 
188 DWORD WINAPI VfdSetLocalLink(
189 	HANDLE			hDevice,
190 	CHAR			cLetter);
191 
192 //	Get the first ephemeral drive letter
193 
194 DWORD WINAPI VfdGetLocalLink(
195 	HANDLE			hDevice,
196 	PCHAR			pLetter);
197 
198 //	Choose the first available drive letter
199 
200 CHAR WINAPI VfdChooseLetter();
201 
202 //==============================
203 //	utility functions
204 //==============================
205 
206 //	Check running platform
207 
208 BOOL WINAPI VfdIsValidPlatform();
209 
210 //	Get VFD notification message value
211 
212 UINT WINAPI VfdGetNotifyMessage();
213 
214 //	Check if specified file is a valid VFD driver
215 
216 DWORD WINAPI VfdCheckDriverFile(
217 	PCSTR			sFileName,
218 	PULONG			pFileVersion);
219 
220 //	Check if specified path is a valid image file
221 
222 DWORD WINAPI VfdCheckImageFile(
223 	PCSTR			sFileName,
224 	PDWORD			pAttributes,
225 	PVFD_FILETYPE	pFileType,
226 	PULONG			pImageSize);
227 
228 //	Create a formatted new image file
229 
230 DWORD 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 
238 VFD_MEDIA WINAPI VfdLookupMedia(
239 	ULONG			nSize);
240 
241 //	Get media size (in bytes) of a media type
242 
243 ULONG WINAPI VfdGetMediaSize(
244 	VFD_MEDIA		nMediaType);
245 
246 //	Get media type name
247 
248 PCSTR WINAPI VfdMediaTypeName(
249 	VFD_MEDIA		nMediaType);
250 
251 //	Make a file description text
252 
253 void 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 
266 DWORD WINAPI VfdRegisterHandlers();
267 
268 //	uninstall the shell extension
269 
270 DWORD WINAPI VfdUnregisterHandlers();
271 
272 //	check if the shell extension is installed
273 
274 DWORD WINAPI VfdCheckHandlers();
275 
276 //==============================
277 //	GUI utility functions
278 //==============================
279 
280 //	open an existing image file
281 
282 DWORD WINAPI VfdGuiOpen(
283 	HWND			hParent,	//	parent window
284 	ULONG			nDevice);	//	device number
285 
286 //	Save the current image
287 
288 DWORD WINAPI VfdGuiSave(
289 	HWND			hParent,	//	parent window
290 	ULONG			nDevice);	//	device number
291 
292 //	close the current image
293 
294 DWORD WINAPI VfdGuiClose(
295 	HWND			hParent,	//	parent window
296 	ULONG			nDevice);	//	device number
297 
298 //	format the current media
299 
300 DWORD WINAPI VfdGuiFormat(
301 	HWND			hParent,	//	parent window
302 	ULONG			nDevice);	//	device number
303 
304 //	display a tooltip window
305 
306 void 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 
316 void WINAPI VfdImageTip(
317 	HWND			hParent,
318 	ULONG			nDevice);
319 
320 #ifdef __cplusplus
321 }
322 #endif	//	__cplusplus
323 
324 #endif	//	_VFDAPI_H_
325