1 | /*
|
---|
2 | * NetDrive File System (NDFS)
|
---|
3 | *
|
---|
4 | * Version 2.3.x
|
---|
5 | *
|
---|
6 | * (C) COPYRIGHT Blueprint Software Works, Inc. 1999-2004.
|
---|
7 | * ALL RIGHTS RESERVED.
|
---|
8 | */
|
---|
9 |
|
---|
10 | #ifndef __NDFS__H
|
---|
11 | #define __NDFS__H
|
---|
12 |
|
---|
13 | #define INCL_DOS
|
---|
14 | #define INCL_DOSERRORS
|
---|
15 | #include <os2.h>
|
---|
16 |
|
---|
17 | #if defined(__IBMC__) || defined(__IBMCPP__)
|
---|
18 | #define FNPTR(a) * a
|
---|
19 | #else
|
---|
20 | #define FNPTR(a) a *
|
---|
21 | #endif
|
---|
22 |
|
---|
23 | #define NDENTRY APIENTRY
|
---|
24 | #define PNDENTRY FNPTR(NDENTRY)
|
---|
25 |
|
---|
26 | #ifdef __cplusplus
|
---|
27 | extern "C" {
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | /* This is the file system ID as in DOSQUERYFSINFO */
|
---|
31 | #define NDFS_ID 0x21401785UL
|
---|
32 |
|
---|
33 | /* Maximum length of a type name, including trailing '\0',
|
---|
34 | * i.e. len is up to 7 characters and one nul character
|
---|
35 | */
|
---|
36 | #define ND_MAX_TYPE_SIZE 8
|
---|
37 |
|
---|
38 | /* resource independent flags for NdpMount */
|
---|
39 | #define ND_FLAG_WRITEPROTECT 0x1
|
---|
40 | #define ND_FLAG_CHECKDUPLICATE 0x2
|
---|
41 |
|
---|
42 | /* mount points flags */
|
---|
43 | #define ND_MP_FLAG_NORMAL 0x0
|
---|
44 |
|
---|
45 | /* NdQueryInfo infolevels */
|
---|
46 | #define ND_INFO_IFS 0
|
---|
47 | #define ND_INFO_CTL 1
|
---|
48 | #define ND_INFO_NDFS_PATH 2
|
---|
49 | #define ND_INFO_DRIVES 3
|
---|
50 |
|
---|
51 | #pragma pack(1)
|
---|
52 | typedef struct _RIDINFO
|
---|
53 | {
|
---|
54 | ULONG ulReqCompleted;
|
---|
55 | USHORT usReqMax;
|
---|
56 | USHORT usReqInProcess;
|
---|
57 | USHORT usReqMaxInProcess;
|
---|
58 | USHORT usReqRetCnt;
|
---|
59 | USHORT usReqCptCnt;
|
---|
60 | ULONG ulFreeHits;
|
---|
61 | ULONG ulCptHits;
|
---|
62 | ULONG ulFreeFaults;
|
---|
63 | ULONG ulCptFaults;
|
---|
64 | ULONG ulFreeScanned;
|
---|
65 | ULONG ulCptScanned;
|
---|
66 | } RIDINFO;
|
---|
67 |
|
---|
68 | typedef struct _IFSINFO
|
---|
69 | {
|
---|
70 | CHAR achName[8];
|
---|
71 | USHORT usVerMajor;
|
---|
72 | USHORT usVerMinor;
|
---|
73 | RIDINFO ridInfo;
|
---|
74 | USHORT usCpgmConnected;
|
---|
75 | USHORT usCpgmPID;
|
---|
76 | } IFSINFO;
|
---|
77 |
|
---|
78 | typedef struct _CTLINFO
|
---|
79 | {
|
---|
80 | USHORT usCpgmConnected;
|
---|
81 | USHORT usCpgmPID;
|
---|
82 | ULONG ulVersion;
|
---|
83 | } CTLINFO;
|
---|
84 |
|
---|
85 | typedef struct _NDFSPATHINFO
|
---|
86 | {
|
---|
87 | CHAR achNDFSPath[CCHMAXPATH];
|
---|
88 | } NDFSPATHINFO;
|
---|
89 |
|
---|
90 | #pragma pack()
|
---|
91 |
|
---|
92 |
|
---|
93 | APIRET NDENTRY NdQueryInfo (ULONG infolevel,
|
---|
94 | PVOID pBuf,
|
---|
95 | PULONG pcbBuf);
|
---|
96 |
|
---|
97 | APIRET NDENTRY NdAttach (PSZ pszDevice,
|
---|
98 | PSZ pszLabel,
|
---|
99 | ULONG cUnit,
|
---|
100 | ULONG cUnitAvail);
|
---|
101 |
|
---|
102 | APIRET NDENTRY NdDetach (PSZ pszDevice);
|
---|
103 |
|
---|
104 | APIRET NDENTRY NdSetDriveInfo (PSZ pszDevice,
|
---|
105 | ULONG cUnit,
|
---|
106 | ULONG cUnitAvail);
|
---|
107 |
|
---|
108 | APIRET NDENTRY NdMount (PSZ pszType,
|
---|
109 | ULONG ulFlags,
|
---|
110 | PSZ pszDest,
|
---|
111 | PSZ pszSrc);
|
---|
112 |
|
---|
113 | APIRET NDENTRY NdRemount (PSZ pszType,
|
---|
114 | ULONG ulIndex,
|
---|
115 | ULONG ulFlags,
|
---|
116 | PSZ pszDest,
|
---|
117 | PSZ pszSrc);
|
---|
118 |
|
---|
119 | APIRET NDENTRY NdUnmount (PSZ pszDest,
|
---|
120 | ULONG ulIndex);
|
---|
121 |
|
---|
122 | APIRET NDENTRY NdIoctl (ULONG ulFunction,
|
---|
123 | PSZ pszDest,
|
---|
124 | PVOID pData,
|
---|
125 | ULONG ulDataLenIn,
|
---|
126 | PULONG pulDataLenOut);
|
---|
127 |
|
---|
128 | APIRET NDENTRY NdPluginIoctl (ULONG ulFunction,
|
---|
129 | PSZ pszPlugin,
|
---|
130 | PSZ pszRsrcType,
|
---|
131 | PSZ pszDest,
|
---|
132 | PVOID pData,
|
---|
133 | ULONG ulDataLenIn,
|
---|
134 | PULONG pulDataLenOut);
|
---|
135 |
|
---|
136 | APIRET NDENTRY NdCreateMountPoint (PSZ pszPath,
|
---|
137 | ULONG ulFlags);
|
---|
138 |
|
---|
139 | APIRET NDENTRY NdDeleteMountPoint (PSZ pszPath);
|
---|
140 |
|
---|
141 | APIRET NDENTRY NdKill (VOID);
|
---|
142 |
|
---|
143 | APIRET NDENTRY NdLoadPlugin (PSZ pszName);
|
---|
144 |
|
---|
145 | APIRET NDENTRY NdFreePlugin (PSZ pszName);
|
---|
146 |
|
---|
147 | #define ORD_NDQUERYINFO 1
|
---|
148 | #define ORD_NDATTACH 2
|
---|
149 | #define ORD_NDDETACH 3
|
---|
150 | #define ORD_NDSETDRIVEINFO 4
|
---|
151 | #define ORD_NDMOUNT 5
|
---|
152 | #define ORD_NDUNMOUNT 6
|
---|
153 | #define ORD_NDIOCTL 7
|
---|
154 | #define ORD_NDCREATEMOUNTPOINT 8
|
---|
155 | #define ORD_NDDELETEMOUNTPOINT 9
|
---|
156 | #define ORD_NDKILL 10
|
---|
157 | #define ORD_NDLOADPLUGIN 11
|
---|
158 | #define ORD_NDFREEPLUGIN 12
|
---|
159 | #define ORD_NDPLUGINIOCTL 14
|
---|
160 | #define ORD_NDREMOUNT 15
|
---|
161 |
|
---|
162 |
|
---|
163 | /* IOCTL functions */
|
---|
164 | /* Path related function, pszDest != NULL */
|
---|
165 | #define ND_IOCTL_QUERYMOUNTPOINT 0
|
---|
166 | #define ND_IOCTL_QUERYMOUNTINFO 1
|
---|
167 | #define ND_IOCTL_REFRESH 2
|
---|
168 | #define ND_IOCTL_QUERYMOUNTINFOSHORT 3
|
---|
169 | /* 4 is obsoleted */
|
---|
170 | #define ND_IOCTL_RSRCINFO 5
|
---|
171 | #define ND_IOCTL_REFRESHTREE 6
|
---|
172 | #define ND_IOCTL_QUERYPATHINFO 7
|
---|
173 | #define ND_IOCTL_SETWRITEPROTECT 8
|
---|
174 |
|
---|
175 | /* Plugin related function, pszDest == NULL */
|
---|
176 | #define ND_IOCTL_QUERYPLUGINS 100
|
---|
177 | #define ND_IOCTL_QUERYRSRCTYPES 101
|
---|
178 | #define ND_IOCTL_QUERYTYPEINFO 102
|
---|
179 |
|
---|
180 |
|
---|
181 | #pragma pack(1)
|
---|
182 |
|
---|
183 | /* IOCTL in and out data */
|
---|
184 |
|
---|
185 | /* ND_IOCTL_QUERYMOUNTPOINT:
|
---|
186 | * Query if the specified path is an existing mount point.
|
---|
187 | */
|
---|
188 | /* no in */
|
---|
189 | /* no out */
|
---|
190 |
|
---|
191 |
|
---|
192 | /* ND_IOCTL_QUERYMOUNTINFO:
|
---|
193 | * Query mounted resources and child mount point information
|
---|
194 | * on the specified mount point path.
|
---|
195 | */
|
---|
196 | /* no in */
|
---|
197 | /* out */
|
---|
198 | typedef struct _ND_DATA_MOUNTINFO
|
---|
199 | {
|
---|
200 | USHORT usMountPointsTotal;
|
---|
201 | USHORT usMountPointsReturned;
|
---|
202 | USHORT usResourcesTotal;
|
---|
203 | USHORT usResourcesReturned;
|
---|
204 | ULONG cbName; /* length of the name without the trailing '\0' */
|
---|
205 | CHAR achName[1]; /* name of the mount point */
|
---|
206 | /* usMountPointsReturned ND_DATA_MOUNTPOINT structures */
|
---|
207 | /* usResourcesReturned ND_DATA_MOUNTRESOURCE structures */
|
---|
208 | } ND_DATA_MOUNTINFO;
|
---|
209 | typedef ND_DATA_MOUNTINFO *PND_DATA_MOUNTINFO;
|
---|
210 |
|
---|
211 | typedef struct _ND_DATA_MOUNTPOINT
|
---|
212 | {
|
---|
213 | ULONG cbName; /* length of the name without the trailing '\0' */
|
---|
214 | CHAR achName[1]; /* name of the mount point */
|
---|
215 | } ND_DATA_MOUNTPOINT;
|
---|
216 | typedef ND_DATA_MOUNTPOINT *PND_DATA_MOUNTPOINT;
|
---|
217 |
|
---|
218 | typedef struct _ND_DATA_MOUNTRESOURCE
|
---|
219 | {
|
---|
220 | CHAR achType[ND_MAX_TYPE_SIZE]; /* asciiz type of the resource */
|
---|
221 | ULONG ulFlags; /* resource flags,
|
---|
222 | * low 16 bit - resource independent,
|
---|
223 | * high 16 bit - resource private flags
|
---|
224 | */
|
---|
225 | ULONG cbData; /* length of the data without the trailing '\0' */
|
---|
226 | CHAR achData[1]; /* resource data */
|
---|
227 | } ND_DATA_MOUNTRESOURCE;
|
---|
228 | typedef ND_DATA_MOUNTRESOURCE *PND_DATA_MOUNTRESOURCE;
|
---|
229 |
|
---|
230 |
|
---|
231 | /* ND_IOCTL_REFRESH:
|
---|
232 | * Refresh content of the specified directory. Allows to invalidate
|
---|
233 | * cache for this directory listing.
|
---|
234 | */
|
---|
235 | /* no in */
|
---|
236 | /* no out */
|
---|
237 |
|
---|
238 |
|
---|
239 | /* ND_IOCTL_QUERYMOUNTINFOSHORT:
|
---|
240 | * Query mounted resources and child mount point numbers
|
---|
241 | * on the specified mount point path.
|
---|
242 | */
|
---|
243 | /* no in */
|
---|
244 | /* out */
|
---|
245 | typedef struct _ND_DATA_MOUNTINFOSHORT
|
---|
246 | {
|
---|
247 | USHORT usMountPointsTotal;
|
---|
248 | USHORT usResourcesTotal;
|
---|
249 | ULONG cbName; /* length of the name without the trailing '\0' */
|
---|
250 | CHAR achName[CCHMAXPATH]; /* name of the mount point */
|
---|
251 | } ND_DATA_MOUNTINFOSHORT;
|
---|
252 | typedef ND_DATA_MOUNTINFOSHORT *PND_DATA_MOUNTINFOSHORT;
|
---|
253 |
|
---|
254 |
|
---|
255 | /* ND_IOCTL_RSRCINFO:
|
---|
256 | * Query information about resource with specified index in the
|
---|
257 | * specified mount point.
|
---|
258 | */
|
---|
259 | /* in */
|
---|
260 | typedef struct _ND_PARAM_INDEX
|
---|
261 | {
|
---|
262 | ULONG ulIndex; /* index of resource */
|
---|
263 | } ND_PARAM_INDEX;
|
---|
264 | /* out */
|
---|
265 | typedef struct _ND_DATA_RSRCINFO
|
---|
266 | {
|
---|
267 | ULONG ulType; /* numeric value of resource type, index in types array */
|
---|
268 | ULONG ulFlags; /* flags of the resource */
|
---|
269 | ULONG cbData; /* length of achData without trailing '\0' */
|
---|
270 | BYTE cbType; /* length of achType without trailing '\0' */
|
---|
271 | BYTE bExternal; /* =1 if external plugin */
|
---|
272 | BYTE cbPlugin; /* length of achPlugin without trailing '\0' */
|
---|
273 | CHAR achType[1]; /* type of resource */
|
---|
274 | CHAR achPlugin[1]; /* name of plugin */
|
---|
275 | CHAR achData[1]; /* resource data */
|
---|
276 | } ND_DATA_RSRCINFO;
|
---|
277 |
|
---|
278 | #define RSRCINFO_SIZE(p) (sizeof (*p) + p->cbData + p->cbType + p->cbPlugin)
|
---|
279 | #define RSRCINFO_TYPE(p) (&(p->achType[0]))
|
---|
280 | #define RSRCINFO_PLUGIN(p) (RSRCINFO_TYPE(p) + sizeof (p->achType) + p->cbType)
|
---|
281 | #define RSRCINFO_DATA(p) (RSRCINFO_PLUGIN(p) + sizeof (p->achPlugin) + p->cbPlugin)
|
---|
282 |
|
---|
283 | #define RSRC_TYPE_ERROR 0xFFFF0000L
|
---|
284 |
|
---|
285 |
|
---|
286 | /* ND_IOCTL_REFRESHTREE:
|
---|
287 | * Refresh content of the specified directory and its descendants.
|
---|
288 | * Allows to invalidate cache for the whole tree.
|
---|
289 | */
|
---|
290 | /* no in */
|
---|
291 | /* no out */
|
---|
292 |
|
---|
293 |
|
---|
294 | /* ND_IOCTL_QUERYPATHINFO:
|
---|
295 | * Query NetDrive path information.
|
---|
296 | */
|
---|
297 | /* no in */
|
---|
298 | /* out */
|
---|
299 | typedef struct _ND_DATA_QUERYPATHINFO
|
---|
300 | {
|
---|
301 | USHORT cb; /* size of the structure including the cb */
|
---|
302 | BYTE bPathType; /* see ND_PT_* */
|
---|
303 | ULONG ulType; /* numeric value of resource type */
|
---|
304 | ULONG ulIndex; /* index of resource */
|
---|
305 | BYTE cbType; /* length of achType without trailing '\0' */
|
---|
306 | BYTE cbPlugin; /* length of achPlugin without trailing '\0' */
|
---|
307 | BYTE cbMountPoint; /* length of achMountPoint without trailing '\0' */
|
---|
308 | BYTE cbRsrcPath; /* length of achRsrcPath without trailing '\0' */
|
---|
309 | CHAR achType[1]; /* type name */
|
---|
310 | CHAR achPlugin[1]; /* plugin name */
|
---|
311 | CHAR achMountPoint[1]; /* mount point path */
|
---|
312 | CHAR achRsrcPath[1]; /* path after mount point */
|
---|
313 | } ND_DATA_QUERYPATHINFO;
|
---|
314 | typedef ND_DATA_QUERYPATHINFO *PND_DATA_QUERYPATHINFO;
|
---|
315 |
|
---|
316 | /* Values for ND_DATA_QUERYPATHINFO::bPathType */
|
---|
317 | #define ND_PT_MOUNTPOINT 0
|
---|
318 | #define ND_PT_INTERNAL 1
|
---|
319 | #define ND_PT_EXTERNAL 2
|
---|
320 |
|
---|
321 | #define PATHINFO_SIZE(p) (sizeof (*p) + p->cbType + p->cbPlugin + p->cbMountPoint + p->cbRsrcPath)
|
---|
322 | #define PATHINFO_TYPE(p) (&(p->achType[0]))
|
---|
323 | #define PATHINFO_PLUGIN(p) (PATHINFO_TYPE(p) + sizeof (p->achType) + p->cbType)
|
---|
324 | #define PATHINFO_MOUNTPOINT(p) (PATHINFO_PLUGIN(p) + sizeof (p->achPlugin) + p->cbPlugin)
|
---|
325 | #define PATHINFO_RSRCPATH(p) (PATHINFO_MOUNTPOINT(p) + sizeof (p->achMountPoint) + p->cbMountPoint)
|
---|
326 |
|
---|
327 |
|
---|
328 | /* ND_IOCTL_SETWRITEPROTECT:
|
---|
329 | * Sets write protect flag for resource with specified index in the
|
---|
330 | * specified mount point.
|
---|
331 | */
|
---|
332 | /* in */
|
---|
333 | typedef struct _ND_PARAM_SETWRITEPROTECT
|
---|
334 | {
|
---|
335 | ULONG ulIndex; /* index of resource */
|
---|
336 | ULONG fWriteProtect; /* 1 - write protect, 0 - write enable */
|
---|
337 | } ND_PARAM_SETWRITEPROTECT;
|
---|
338 | /* no out */
|
---|
339 |
|
---|
340 |
|
---|
341 | /* ND_IOCTL_QUERYPLUGINS:
|
---|
342 | * Queries list of loaded plugins.
|
---|
343 | */
|
---|
344 | /* no in */
|
---|
345 | /* out */
|
---|
346 | typedef struct _ND_DATA_PLUGINLIST
|
---|
347 | {
|
---|
348 | ULONG cbSize; /* size of plugin list (with ND_DATA_PLUGINLIST) */
|
---|
349 | ULONG ulCount; /* number of plugins returned */
|
---|
350 | /* ulCount ND_DATA_PLUGIN structures follow */
|
---|
351 | } ND_DATA_PLUGINLIST;
|
---|
352 |
|
---|
353 | typedef struct _ND_DATA_PLUGIN
|
---|
354 | {
|
---|
355 | HMODULE hMod; /* placeholder, always zero */
|
---|
356 | BYTE bExternal; /* = 1 if external plugin; 0 if internal */
|
---|
357 | BYTE cbName; /* length of the name without the trailing '\0' */
|
---|
358 | CHAR szName[1]; /* plugin dll: ndpftp.dll -> name == ndpftp */
|
---|
359 | } ND_DATA_PLUGIN;
|
---|
360 |
|
---|
361 |
|
---|
362 | /* ND_IOCTL_QUERYRSRCTYPES:
|
---|
363 | * Query type names for specified plugin.
|
---|
364 | */
|
---|
365 | /* in */
|
---|
366 | typedef struct _ND_PARAM_QUERYRSRCTYPES
|
---|
367 | {
|
---|
368 | BYTE cbName; /* length of the name without the trailing '\0' */
|
---|
369 | char szName[1]; /* plugin name */
|
---|
370 | } ND_PARAM_QUERYRSRCTYPES;
|
---|
371 | /* out */
|
---|
372 | typedef struct _ND_DATA_RSRCTYPELIST
|
---|
373 | {
|
---|
374 | ULONG cbSize; /* size of type list (with ND_DATA_RSRCTYPELIST) */
|
---|
375 | ULONG ulCount; /* number of types returned */
|
---|
376 | /* ulCount ND_DATA_RSRCTYPE structures follow */
|
---|
377 | } ND_DATA_RSRCTYPELIST;
|
---|
378 |
|
---|
379 | typedef struct _ND_DATA_RSRCTYPE
|
---|
380 | {
|
---|
381 | BYTE cbType; /* length of the name without the trailing '\0' */
|
---|
382 | CHAR szType[1]; /* type: local, ftp ... */
|
---|
383 | } ND_DATA_RSRCTYPE;
|
---|
384 |
|
---|
385 |
|
---|
386 | /* ND_IOCTL_QUERYTYPEINFO:
|
---|
387 | * Query plugin name that supports the specified type.
|
---|
388 | */
|
---|
389 | /* in */
|
---|
390 | typedef struct _ND_PARAM_NAME
|
---|
391 | {
|
---|
392 | BYTE cbName; /* length of the name without the trailing '\0' */
|
---|
393 | CHAR achName[1]; /* the type name */
|
---|
394 | } ND_PARAM_NAME;
|
---|
395 | /* out */
|
---|
396 | typedef struct _ND_DATA_TYPEINFO
|
---|
397 | {
|
---|
398 | ULONG ulType; /* numeric value of resource type, index in types array */
|
---|
399 | BYTE cbType; /* length of achType without trailing '\0' */
|
---|
400 | BYTE cbPlugin; /* length of achPlugin without trailing '\0' */
|
---|
401 | BYTE bExternal; /* = 1 if external plugin */
|
---|
402 | CHAR achType[1]; /* type name */
|
---|
403 | CHAR achPlugin[1]; /* plugin name */
|
---|
404 | } ND_DATA_TYPEINFO;
|
---|
405 |
|
---|
406 | #define TYPEINFO_SIZE(p) (sizeof (*p) + p->cbType + p->cbPlugin)
|
---|
407 | #define TYPEINFO_TYPE(p) (&(p->achType[0]))
|
---|
408 | #define TYPEINFO_PLUGIN(p) (TYPEINFO_TYPE(p) + sizeof (p->achType) + p->cbType)
|
---|
409 |
|
---|
410 | #pragma pack()
|
---|
411 |
|
---|
412 | #ifdef __cplusplus
|
---|
413 | }
|
---|
414 | #endif
|
---|
415 |
|
---|
416 | #endif /* __NDFS__H */
|
---|