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

Last change on this file since 129 was 127, checked in by umoeller, 24 years ago

Tons of updates for turbo folders and replacement icons.

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