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

Last change on this file 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
RevLine 
[7]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>
[113]16 *@@include #include "helpers\wphandle.h"
[7]17 */
18
[113]19/* This file Copyright (C) 1997-2001 Ulrich M”ller.
[14]20 * This file is part of the "XWorkplace helpers" source package.
21 * This is free software; you can redistribute it and/or modify
[7]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
[106]38 /* ******************************************************************
39 *
40 * Errors
41 *
42 ********************************************************************/
[7]43
[106]44 #define ERROR_WPH_FIRST 41000
[153]45
[180]46 // #define ERROR_WPH_CRASHED (ERROR_WPH_FIRST + 0)
47 // now using ERROR_PROTECTION_VIOLATION instead
48 // V0.9.19 (2002-07-01) [umoeller]
[106]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)
[180]54 // cannot determine format (invalid keywords)
[106]55 #define ERROR_WPH_INVALID_PARENT_HANDLE (ERROR_WPH_FIRST + 6)
[113]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)
[127]62 #define ERROR_WPH_NOT_FILESYSTEM_HANDLE (ERROR_WPH_FIRST + 13)
[180]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]
[7]69
[180]70 #define ERROR_WPH_LAST (ERROR_WPH_FIRST + 15)
[153]71
[106]72 /* ******************************************************************
[7]73 *
[106]74 * Definitions
75 *
76 ********************************************************************/
[7]77
[106]78 #pragma pack(1)
[7]79
80 /*
[106]81 *@@ NODE:
82 * file or directory node in the BLOCKS
83 * in OS2SYS.INI. See wphandle.c.
[7]84 *
[106]85 *@@added V0.9.16 (2001-10-02) [umoeller]
[7]86 */
87
[106]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
[399]94 BYTE achFiller[18]; // filler
95 USHORT fsDirectory; // 1 if a directory, 0 if a file [rw]
[106]96 USHORT usNameSize; // size of non-qualified filename
97 CHAR szName[1]; // variable length: non-qualified filename
98 // (zero-terminated)
99 } NODE, *PNODE;
[7]100
101 /*
[106]102 *@@ DRIVE:
103 * drive node in the BLOCKS
104 * in OS2SYS.INI. See wphandle.c.
[7]105 *
[106]106 *@@added V0.9.16 (2001-10-02) [umoeller]
[7]107 */
108
[106]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];
[113]116 } DRIVE, *PDRIVE;
[7]117
[106]118 #pragma pack()
[7]119
[113]120 /* ******************************************************************
[106]121 *
[113]122 * Private declarations
123 *
124 ********************************************************************/
[7]125
[113]126 #ifdef INCLUDE_WPHANDLE_PRIVATE
[7]127
[113]128 /*
129 *@@ DRIVETREENODE:
130 *
131 *@@added V0.9.16 (2001-10-19) [umoeller]
132 */
[7]133
[113]134 typedef struct _DRIVETREENODE
135 {
136 TREE Tree; // ulKey points to the DRIVE.szName
137 // (null terminated)
138 PDRIVE pDriv; // actual DRIVE node
[7]139
[113]140 TREE *ChildrenTree; // NODETREENODE's, if any
141 LONG cChildren;
[7]142
[113]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
[106]200 /* ******************************************************************
[7]201 *
[106]202 * Load handles functions
203 *
204 ********************************************************************/
[7]205
[113]206 typedef unsigned long HHANDLES;
207
[106]208 APIRET wphQueryActiveHandles(HINI hiniSystem,
209 PSZ *ppszActiveHandles);
[7]210
[106]211 APIRET wphQueryBaseClassesHiwords(HINI hiniUser,
212 PUSHORT pusHiwordAbstract,
213 PUSHORT pusHiwordFileSystem);
[7]214
[140]215 APIRET wphRebuildNodeHashTable(HHANDLES hHandles,
216 BOOL fQuitOnErrors);
[7]217
[106]218 APIRET wphLoadHandles(HINI hiniUser,
219 HINI hiniSystem,
220 const char *pcszActiveHandles,
[113]221 HHANDLES *phHandles);
[7]222
[113]223 APIRET wphFreeHandles(HHANDLES *phHandles);
[7]224
[106]225 APIRET wphQueryHandleFromPath(HINI hiniUser,
226 HINI hiniSystem,
227 const char *pcszName,
228 HOBJECT *phobj);
[7]229
[113]230 APIRET wphComposePath(HHANDLES hHandles,
[106]231 USHORT usHandle,
232 PSZ pszFilename,
233 ULONG cbFilename,
234 PNODE *ppNode);
[7]235
[106]236 APIRET wphQueryPathFromHandle(HINI hiniUser,
237 HINI hiniSystem,
238 HOBJECT hObject,
239 PSZ pszFilename,
240 ULONG cbFilename);
[7]241
[180]242 PCSZ wphDescribeError(APIRET arc);
243
[7]244#endif
245
246#if __cplusplus
247}
248#endif
249
Note: See TracBrowser for help on using the repository browser.