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