xref: /reactos/modules/rosapps/lib/vfdlib/vfdlib.h (revision 0182dcd7)
1 /*
2 	vfdlib.h
3 
4 	Virtual Floppy Drive for Windows
5 	Driver control library local header
6 
7 	Copyright (C) 2003-2005 Ken Kato
8 */
9 
10 #ifndef _VFDLIB_H_
11 #define _VFDLIB_H_
12 
13 #ifdef __REACTOS__
14 #define DWL_USER DWLP_USER
15 #endif
16 
17 #define VFD_LIBRARY_FILENAME	"vfd.dll"
18 
19 #ifdef VFD_EMBED_DRIVER
20 #define VFD_DRIVER_NAME_ID		VFD_DRIVER
21 #define VFD_DRIVER_TYPE_ID		BINARY
22 #endif
23 
24 #ifndef RC_INVOKED
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif	// __cplusplus
29 
30 //
31 //	DLL instance handle
32 //
33 extern HINSTANCE	g_hDllModule;
34 
35 //
36 //	Reference count for the DLL
37 //
38 extern UINT			g_cDllRefCnt;
39 
40 //
41 //	VFD notification message value
42 //
43 extern UINT			g_nNotifyMsg;
44 
45 //
46 //	VFD notification message register string
47 //
48 #define VFD_NOTIFY_MESSAGE	"VfdNotifyMessage"
49 
50 //
51 //	Message box title string
52 //
53 #define VFD_MSGBOX_TITLE	"Virtual Floppy Drive"
54 
55 //
56 //	shell extention string constants
57 //
58 #define VFDEXT_DESCRIPTION	"VFD shell extension"
59 #define VFDEXT_MENU_REGKEY	"Drive\\shellex\\ContextMenuHandlers\\VFD"
60 #define VFDEXT_DND_REGKEY	"Drive\\shellex\\DragDropHandlers\\VFD"
61 #define VFDEXT_PROP_REGKEY	"Drive\\shellex\\PropertySheetHandlers\\VFD"
62 #define VFDEXT_INFO_REGKEY	"Drive\\shellex\\{00021500-0000-0000-C000-000000000046}"
63 
64 //=====================================
65 //	Image handling functions
66 //=====================================
67 
68 //	Format a buffer with FAT12
69 
70 DWORD FormatBufferFat(
71 	PUCHAR			pBuffer,
72 	ULONG			nSectors);
73 
74 //	Extract image information from a zip compressed file
75 
76 DWORD ExtractZipInfo(
77 	HANDLE			hFile,
78 	ULONG			*pSize);
79 
80 //	Extract original image from a zip compressed file
81 
82 DWORD ExtractZipImage(
83 	HANDLE			hFile,
84 	PUCHAR			*pBuffer,
85 	PULONG			pLength);
86 
87 //=====================================
88 //	GUI utility functions
89 //=====================================
90 
91 typedef struct _SAVE_PARAM {
92 	HANDLE			hDevice;
93 	VFD_DISKTYPE	DiskType;
94 	VFD_MEDIA		MediaType;
95 	VFD_FLAGS		MediaFlags;
96 	VFD_FILETYPE	FileType;
97 	ULONG			ImageSize;
98 	PSTR			ImageName;
99 } SAVE_PARAM, PSAVE_PARAM;
100 
101 typedef const SAVE_PARAM CSAVE_PARAM, *PCSAVE_PARAM;
102 
103 DWORD GuiSaveParam(
104 	HWND			hParent,
105 	PCSAVE_PARAM	pParam);
106 
107 void ShowContextMenu(
108 	HWND			hDlg,
109 	HWND			hCtl,
110 	LPARAM			lParam);
111 
112 void ShowHelpWindow(
113 	HWND			hDlg,
114 	UINT			nCtl);
115 
116 //
117 //	Set a message to a control window
118 //
119 void SetControlText(
120 	HWND			hWnd,
121 	UINT			nCtrl,
122 	DWORD			nMsg);
123 
124 //==============================
125 //	Message extract functions
126 //==============================
127 
128 //	Return a system error message
129 
130 PCSTR SystemMessage(
131 	DWORD			nError);
132 
133 //	Return a message from this DLL module
134 
135 PSTR ModuleMessage(
136 	DWORD			nFormat, ...);
137 
138 //==============================
139 //	utility macros
140 //==============================
141 
142 #define IS_WINDOWS_NT()	((GetVersion() & 0xff) < 5)
143 
144 //==============================
145 //	Debug functions
146 //==============================
147 
148 #ifdef _DEBUG
149 extern ULONG TraceFlags;
150 #ifndef __REACTOS__
151 extern PCHAR TraceFile;
152 #else
153 extern CHAR const * TraceFile;
154 #endif
155 extern ULONG TraceLine;
156 
157 #define VFDTRACE(LEVEL,STRING)					\
158 	if ((TraceFlags & (LEVEL)) == (LEVEL)) {	\
159 		TraceFile = __FILE__;					\
160 		TraceLine = __LINE__;					\
161 		DebugTrace STRING;						\
162 	}
163 
164 void DebugTrace(PCSTR sFormat, ...);
165 
166 #else	// _DEBUG
167 #define VFDTRACE(LEVEL,STRING)
168 #endif	// _DEBUG
169 
170 //
171 //	supplement old system headers
172 //
173 #ifndef INVALID_FILE_ATTRIBUTES
174 #define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
175 #endif	// INVALID_FILE_ATTRIBUTES
176 
177 #if defined(_INC_COMMDLG) && !defined(OPENFILENAME_SIZE_VERSION_400)
178 // Pre Win2K system header is used
179 // OPENFILENAME is defined without extra fields.
180 #define OPENFILENAME_SIZE_VERSION_400 sizeof(OPENFILENAME)
181 #endif	// __INC_COMMDLG && !OPENFILENAME_SIZE_VERSION_400
182 
183 #ifdef __cplusplus
184 }
185 #endif	//	__cplusplus
186 
187 #endif	//	RC_INVOKED
188 
189 #endif	//	_VFDLIB_H_
190