source: trunk/include/helpers/wphandle.h@ 122

Last change on this file since 122 was 113, checked in by umoeller, 24 years ago

Misc updates.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 8.4 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 #define ERROR_WPH_CRASHED (ERROR_WPH_FIRST + 0)
46 #define ERROR_WPH_NO_BASECLASS_DATA (ERROR_WPH_FIRST + 1)
47 #define ERROR_WPH_NO_ACTIVEHANDLES_DATA (ERROR_WPH_FIRST + 2)
48 #define ERROR_WPH_INCOMPLETE_BASECLASS_DATA (ERROR_WPH_FIRST + 3)
49 #define ERROR_WPH_NO_HANDLES_DATA (ERROR_WPH_FIRST + 4)
50 #define ERROR_WPH_CORRUPT_HANDLES_DATA (ERROR_WPH_FIRST + 5)
51 #define ERROR_WPH_INVALID_PARENT_HANDLE (ERROR_WPH_FIRST + 6)
52 #define ERROR_WPH_CANNOT_FIND_HANDLE (ERROR_WPH_FIRST + 7)
53 #define ERROR_WPH_DRIV_TREEINSERT_FAILED (ERROR_WPH_FIRST + 8)
54 #define ERROR_WPH_NODE_TREEINSERT_FAILED (ERROR_WPH_FIRST + 9)
55 #define ERROR_WPH_NODE_BEFORE_DRIV (ERROR_WPH_FIRST + 10)
56 #define ERROR_WPH_NO_MATCHING_DRIVE_BLOCK (ERROR_WPH_FIRST + 11)
57 #define ERROR_WPH_NO_MATCHING_ROOT_DIR (ERROR_WPH_FIRST + 12)
58
59 /* ******************************************************************
60 *
61 * Definitions
62 *
63 ********************************************************************/
64
65 #pragma pack(1)
66
67 /*
68 *@@ NODE:
69 * file or directory node in the BLOCKS
70 * in OS2SYS.INI. See wphandle.c.
71 *
72 *@@added V0.9.16 (2001-10-02) [umoeller]
73 */
74
75 typedef struct _NODE
76 {
77 CHAR achName[4]; // = 'NODE'
78 USHORT usUsage; // always == 1
79 USHORT usHandle; // object handle of this NODE
80 USHORT usParentHandle; // object handle of parent NODE
81 BYTE achFiller[20]; // filler
82 USHORT usNameSize; // size of non-qualified filename
83 CHAR szName[1]; // variable length: non-qualified filename
84 // (zero-terminated)
85 } NODE, *PNODE;
86
87 /*
88 *@@ DRIVE:
89 * drive node in the BLOCKS
90 * in OS2SYS.INI. See wphandle.c.
91 *
92 *@@added V0.9.16 (2001-10-02) [umoeller]
93 */
94
95 typedef struct _DRIVE
96 {
97 CHAR achName[4]; // = 'DRIV'
98 USHORT usUnknown1[4];
99 ULONG ulSerialNr;
100 USHORT usUnknown2[2];
101 CHAR szName[1];
102 } DRIVE, *PDRIVE;
103
104 #pragma pack()
105
106 /* ******************************************************************
107 *
108 * Private declarations
109 *
110 ********************************************************************/
111
112 #ifdef INCLUDE_WPHANDLE_PRIVATE
113
114 /*
115 *@@ DRIVETREENODE:
116 *
117 *@@added V0.9.16 (2001-10-19) [umoeller]
118 */
119
120 typedef struct _DRIVETREENODE
121 {
122 TREE Tree; // ulKey points to the DRIVE.szName
123 // (null terminated)
124 PDRIVE pDriv; // actual DRIVE node
125
126 TREE *ChildrenTree; // NODETREENODE's, if any
127 LONG cChildren;
128
129 } DRIVETREENODE, *PDRIVETREENODE;
130
131 /*
132 *@@ NODETREENODE:
133 *
134 *@@added V0.9.16 (2001-10-19) [umoeller]
135 */
136
137 typedef struct _NODETREENODE
138 {
139 TREE Tree; // ulKey points to the NODE.szName
140 // (null terminated)
141 PNODE pNode; // actual NODE node
142
143 TREE *ChildrenTree; // NODETREENODE's, if any
144 LONG cChildren;
145
146 } NODETREENODE, *PNODETREENODE;
147
148 /*
149 *@@ WPHANDLESBUF:
150 * structure created by wphLoadHandles.
151 *
152 * The composed BLOCKs in the handles buffer make up a tree of
153 * DRIVE and NODE structures (see wphandle.h). Each NODE stands
154 * for either a directory or a file. (We don't care about the
155 * DRIVE structures because the root directory gets a NODE also.)
156 * Each NODE contains the non-qualified file name, an fshandle,
157 * and the fshandle of its parent NODE.
158 *
159 *@@added V0.9.16 (2001-10-02) [umoeller]
160 */
161
162 typedef struct _WPHANDLESBUF
163 {
164 PBYTE pbData; // ptr to all handles (buffers from OS2SYS.INI)
165 ULONG cbData; // byte count of *p
166
167 USHORT usHiwordAbstract, // hiword for WPAbstract handles
168 usHiwordFileSystem; // hiword for WPFileSystem handles
169
170 BOOL fCacheValid; // TRUE after wphRebuildNodeHashTable()
171 PNODETREENODE NodeHashTable[65536]; // hash table with all nodes sorted by handle;
172 // if item is NULL, no handle is assigned
173 TREE *DrivesTree; // DRIVETREENODE structs really
174 LONG cDrives;
175
176 LINKLIST llDuplicateHandles; // linked list of NODETREENODE's that
177 // have an fshandle that was already
178 // occupied (i.e. same fshandle for two
179 // NODEs)
180 LINKLIST llDuplicateShortNames;
181
182 } HANDLESBUF, *PHANDLESBUF;
183
184 #endif
185
186 /* ******************************************************************
187 *
188 * Load handles functions
189 *
190 ********************************************************************/
191
192 typedef unsigned long HHANDLES;
193
194 APIRET wphQueryActiveHandles(HINI hiniSystem,
195 PSZ *ppszActiveHandles);
196
197 APIRET wphQueryBaseClassesHiwords(HINI hiniUser,
198 PUSHORT pusHiwordAbstract,
199 PUSHORT pusHiwordFileSystem);
200
201 APIRET wphRebuildNodeHashTable(HHANDLES hHandles);
202
203 APIRET wphLoadHandles(HINI hiniUser,
204 HINI hiniSystem,
205 const char *pcszActiveHandles,
206 HHANDLES *phHandles);
207
208 APIRET wphFreeHandles(HHANDLES *phHandles);
209
210 APIRET wphQueryHandleFromPath(HINI hiniUser,
211 HINI hiniSystem,
212 const char *pcszName,
213 HOBJECT *phobj);
214
215 APIRET wphComposePath(HHANDLES hHandles,
216 USHORT usHandle,
217 PSZ pszFilename,
218 ULONG cbFilename,
219 PNODE *ppNode);
220
221 APIRET wphQueryPathFromHandle(HINI hiniUser,
222 HINI hiniSystem,
223 HOBJECT hObject,
224 PSZ pszFilename,
225 ULONG cbFilename);
226
227#endif
228
229#if __cplusplus
230}
231#endif
232
Note: See TracBrowser for help on using the repository browser.