source: branches/branch-1-0/include/helpers/wphandle.h@ 399

Last change on this file since 399 was 399, checked in by rlw, 14 years ago

add fsDirectory field to NODE structure

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 9.3 KB
Line 
1
2/*
3 *@@sourcefile wphandle.h:
4 * header file for wphandle.c, which contains the logic for
5 * dealing with those annoying WPS object handles in OS2SYS.INI.
6 *
7 * This code is mostly written by Henk Kelder and published
8 * with his kind permission.
9 *
10 * Note: Version numbering in this file relates to XWorkplace version
11 * numbering.
12 *
13 *@@include #define INCL_WINSHELLDATA
14 *@@include #define INCL_WINWORKPLACE
15 *@@include #include <os2.h>
16 *@@include #include "helpers\wphandle.h"
17 */
18
19/* This file Copyright (C) 1997-2001 Ulrich M”ller.
20 * This file is part of the "XWorkplace helpers" source package.
21 * This is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation, in version 2 as it comes in the COPYING
24 * file of the XWorkplace main distribution.
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 */
30
31#if __cplusplus
32extern "C" {
33#endif
34
35#ifndef WPHANDLE_HEADER_INCLUDED
36 #define WPHANDLE_HEADER_INCLUDED
37
38 /* ******************************************************************
39 *
40 * Errors
41 *
42 ********************************************************************/
43
44 #define ERROR_WPH_FIRST 41000
45
46 // #define ERROR_WPH_CRASHED (ERROR_WPH_FIRST + 0)
47 // now using ERROR_PROTECTION_VIOLATION instead
48 // V0.9.19 (2002-07-01) [umoeller]
49 #define ERROR_WPH_NO_BASECLASS_DATA (ERROR_WPH_FIRST + 1)
50 #define ERROR_WPH_NO_ACTIVEHANDLES_DATA (ERROR_WPH_FIRST + 2)
51 #define ERROR_WPH_INCOMPLETE_BASECLASS_DATA (ERROR_WPH_FIRST + 3)
52 #define ERROR_WPH_NO_HANDLES_DATA (ERROR_WPH_FIRST + 4)
53 #define ERROR_WPH_CORRUPT_HANDLES_DATA (ERROR_WPH_FIRST + 5)
54 // cannot determine format (invalid keywords)
55 #define ERROR_WPH_INVALID_PARENT_HANDLE (ERROR_WPH_FIRST + 6)
56 #define ERROR_WPH_CANNOT_FIND_HANDLE (ERROR_WPH_FIRST + 7)
57 #define ERROR_WPH_DRIV_TREEINSERT_FAILED (ERROR_WPH_FIRST + 8)
58 #define ERROR_WPH_NODE_TREEINSERT_FAILED (ERROR_WPH_FIRST + 9)
59 #define ERROR_WPH_NODE_BEFORE_DRIV (ERROR_WPH_FIRST + 10)
60 #define ERROR_WPH_NO_MATCHING_DRIVE_BLOCK (ERROR_WPH_FIRST + 11)
61 #define ERROR_WPH_NO_MATCHING_ROOT_DIR (ERROR_WPH_FIRST + 12)
62 #define ERROR_WPH_NOT_FILESYSTEM_HANDLE (ERROR_WPH_FIRST + 13)
63 #define ERROR_WPH_PRFQUERYPROFILESIZE_BLOCK (ERROR_WPH_FIRST + 14)
64 // PrfQueryProfileSize failed on BLOCK (fatal)
65 // V0.9.19 (2002-07-01) [umoeller]
66 #define ERROR_WPH_PRFQUERYPROFILEDATA_BLOCK (ERROR_WPH_FIRST + 15)
67 // PrfQueryProfileData failed on BLOCK (fatal)
68 // V0.9.19 (2002-07-01) [umoeller]
69
70 #define ERROR_WPH_LAST (ERROR_WPH_FIRST + 15)
71
72 /* ******************************************************************
73 *
74 * Definitions
75 *
76 ********************************************************************/
77
78 #pragma pack(1)
79
80 /*
81 *@@ NODE:
82 * file or directory node in the BLOCKS
83 * in OS2SYS.INI. See wphandle.c.
84 *
85 *@@added V0.9.16 (2001-10-02) [umoeller]
86 */
87
88 typedef struct _NODE
89 {
90 CHAR achName[4]; // = 'NODE'
91 USHORT usUsage; // always == 1
92 USHORT usHandle; // object handle of this NODE
93 USHORT usParentHandle; // object handle of parent NODE
94 BYTE achFiller[18]; // filler
95 USHORT fsDirectory; // 1 if a directory, 0 if a file [rw]
96 USHORT usNameSize; // size of non-qualified filename
97 CHAR szName[1]; // variable length: non-qualified filename
98 // (zero-terminated)
99 } NODE, *PNODE;
100
101 /*
102 *@@ DRIVE:
103 * drive node in the BLOCKS
104 * in OS2SYS.INI. See wphandle.c.
105 *
106 *@@added V0.9.16 (2001-10-02) [umoeller]
107 */
108
109 typedef struct _DRIVE
110 {
111 CHAR achName[4]; // = 'DRIV'
112 USHORT usUnknown1[4];
113 ULONG ulSerialNr;
114 USHORT usUnknown2[2];
115 CHAR szName[1];
116 } DRIVE, *PDRIVE;
117
118 #pragma pack()
119
120 /* ******************************************************************
121 *
122 * Private declarations
123 *
124 ********************************************************************/
125
126 #ifdef INCLUDE_WPHANDLE_PRIVATE
127
128 /*
129 *@@ DRIVETREENODE:
130 *
131 *@@added V0.9.16 (2001-10-19) [umoeller]
132 */
133
134 typedef struct _DRIVETREENODE
135 {
136 TREE Tree; // ulKey points to the DRIVE.szName
137 // (null terminated)
138 PDRIVE pDriv; // actual DRIVE node
139
140 TREE *ChildrenTree; // NODETREENODE's, if any
141 LONG cChildren;
142
143 } DRIVETREENODE, *PDRIVETREENODE;
144
145 /*
146 *@@ NODETREENODE:
147 *
148 *@@added V0.9.16 (2001-10-19) [umoeller]
149 */
150
151 typedef struct _NODETREENODE
152 {
153 TREE Tree; // ulKey points to the NODE.szName
154 // (null terminated)
155 PNODE pNode; // actual NODE node
156
157 TREE *ChildrenTree; // NODETREENODE's, if any
158 LONG cChildren;
159
160 } NODETREENODE, *PNODETREENODE;
161
162 /*
163 *@@ WPHANDLESBUF:
164 * structure created by wphLoadHandles.
165 *
166 * The composed BLOCKs in the handles buffer make up a tree of
167 * DRIVE and NODE structures (see wphandle.h). Each NODE stands
168 * for either a directory or a file. (We don't care about the
169 * DRIVE structures because the root directory gets a NODE also.)
170 * Each NODE contains the non-qualified file name, an fshandle,
171 * and the fshandle of its parent NODE.
172 *
173 *@@added V0.9.16 (2001-10-02) [umoeller]
174 */
175
176 typedef struct _WPHANDLESBUF
177 {
178 PBYTE pbData; // ptr to all handles (buffers from OS2SYS.INI)
179 ULONG cbData; // byte count of *p
180
181 USHORT usHiwordAbstract, // hiword for WPAbstract handles
182 usHiwordFileSystem; // hiword for WPFileSystem handles
183
184 BOOL fCacheValid; // TRUE after wphRebuildNodeHashTable()
185 PNODETREENODE NodeHashTable[65536]; // hash table with all nodes sorted by handle;
186 // if item is NULL, no handle is assigned
187 TREE *DrivesTree; // DRIVETREENODE structs really
188 LONG cDrives;
189
190 LINKLIST llDuplicateHandles; // linked list of NODETREENODE's that
191 // have an fshandle that was already
192 // occupied (i.e. same fshandle for two
193 // NODEs)
194 LINKLIST llDuplicateShortNames;
195
196 } HANDLESBUF, *PHANDLESBUF;
197
198 #endif
199
200 /* ******************************************************************
201 *
202 * Load handles functions
203 *
204 ********************************************************************/
205
206 typedef unsigned long HHANDLES;
207
208 APIRET wphQueryActiveHandles(HINI hiniSystem,
209 PSZ *ppszActiveHandles);
210
211 APIRET wphQueryBaseClassesHiwords(HINI hiniUser,
212 PUSHORT pusHiwordAbstract,
213 PUSHORT pusHiwordFileSystem);
214
215 APIRET wphRebuildNodeHashTable(HHANDLES hHandles,
216 BOOL fQuitOnErrors);
217
218 APIRET wphLoadHandles(HINI hiniUser,
219 HINI hiniSystem,
220 const char *pcszActiveHandles,
221 HHANDLES *phHandles);
222
223 APIRET wphFreeHandles(HHANDLES *phHandles);
224
225 APIRET wphQueryHandleFromPath(HINI hiniUser,
226 HINI hiniSystem,
227 const char *pcszName,
228 HOBJECT *phobj);
229
230 APIRET wphComposePath(HHANDLES hHandles,
231 USHORT usHandle,
232 PSZ pszFilename,
233 ULONG cbFilename,
234 PNODE *ppNode);
235
236 APIRET wphQueryPathFromHandle(HINI hiniUser,
237 HINI hiniSystem,
238 HOBJECT hObject,
239 PSZ pszFilename,
240 ULONG cbFilename);
241
242 PCSZ wphDescribeError(APIRET arc);
243
244#endif
245
246#if __cplusplus
247}
248#endif
249
Note: See TracBrowser for help on using the repository browser.