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 "wphandle.h"
|
---|
17 | */
|
---|
18 |
|
---|
19 | /* This file Copyright (C) 1997-2000 Ulrich Mller,
|
---|
20 | * Henk Kelder.
|
---|
21 | * This file is part of the "XWorkplace helpers" source package.
|
---|
22 | * This is free software; you can redistribute it and/or modify
|
---|
23 | * it under the terms of the GNU General Public License as published by
|
---|
24 | * the Free Software Foundation, in version 2 as it comes in the COPYING
|
---|
25 | * file of the XWorkplace main distribution.
|
---|
26 | * This program is distributed in the hope that it will be useful,
|
---|
27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
29 | * GNU General Public License for more details.
|
---|
30 | */
|
---|
31 |
|
---|
32 | #if __cplusplus
|
---|
33 | extern "C" {
|
---|
34 | #endif
|
---|
35 |
|
---|
36 | #ifndef WPHANDLE_HEADER_INCLUDED
|
---|
37 | #define WPHANDLE_HEADER_INCLUDED
|
---|
38 |
|
---|
39 | /* ******************************************************************
|
---|
40 | *
|
---|
41 | * Errors
|
---|
42 | *
|
---|
43 | ********************************************************************/
|
---|
44 |
|
---|
45 | #define ERROR_WPH_FIRST 41000
|
---|
46 | #define ERROR_WPH_CRASHED (ERROR_WPH_FIRST + 0)
|
---|
47 | #define ERROR_WPH_NO_BASECLASS_DATA (ERROR_WPH_FIRST + 1)
|
---|
48 | #define ERROR_WPH_NO_ACTIVEHANDLES_DATA (ERROR_WPH_FIRST + 2)
|
---|
49 | #define ERROR_WPH_INCOMPLETE_BASECLASS_DATA (ERROR_WPH_FIRST + 3)
|
---|
50 | #define ERROR_WPH_NO_HANDLES_DATA (ERROR_WPH_FIRST + 4)
|
---|
51 | #define ERROR_WPH_CORRUPT_HANDLES_DATA (ERROR_WPH_FIRST + 5)
|
---|
52 | #define ERROR_WPH_INVALID_PARENT_HANDLE (ERROR_WPH_FIRST + 6)
|
---|
53 |
|
---|
54 | /* ******************************************************************
|
---|
55 | *
|
---|
56 | * Definitions
|
---|
57 | *
|
---|
58 | ********************************************************************/
|
---|
59 |
|
---|
60 | #pragma pack(1)
|
---|
61 |
|
---|
62 | /*
|
---|
63 | *@@ NODE:
|
---|
64 | * file or directory node in the BLOCKS
|
---|
65 | * in OS2SYS.INI. See wphandle.c.
|
---|
66 | *
|
---|
67 | *@@added V0.9.16 (2001-10-02) [umoeller]
|
---|
68 | */
|
---|
69 |
|
---|
70 | typedef struct _NODE
|
---|
71 | {
|
---|
72 | CHAR achName[4]; // = 'NODE'
|
---|
73 | USHORT usUsage; // always == 1
|
---|
74 | USHORT usHandle; // object handle of this NODE
|
---|
75 | USHORT usParentHandle; // object handle of parent NODE
|
---|
76 | BYTE achFiller[20]; // filler
|
---|
77 | USHORT usNameSize; // size of non-qualified filename
|
---|
78 | CHAR szName[1]; // variable length: non-qualified filename
|
---|
79 | // (zero-terminated)
|
---|
80 | } NODE, *PNODE;
|
---|
81 |
|
---|
82 | /*
|
---|
83 | *@@ DRIVE:
|
---|
84 | * drive node in the BLOCKS
|
---|
85 | * in OS2SYS.INI. See wphandle.c.
|
---|
86 | *
|
---|
87 | *@@added V0.9.16 (2001-10-02) [umoeller]
|
---|
88 | */
|
---|
89 |
|
---|
90 | typedef struct _DRIVE
|
---|
91 | {
|
---|
92 | CHAR achName[4]; // = 'DRIV'
|
---|
93 | USHORT usUnknown1[4];
|
---|
94 | ULONG ulSerialNr;
|
---|
95 | USHORT usUnknown2[2];
|
---|
96 | CHAR szName[1];
|
---|
97 | } DRIV, *PDRIV;
|
---|
98 |
|
---|
99 | #pragma pack()
|
---|
100 |
|
---|
101 | /*
|
---|
102 | *@@ WPHANDLESBUF:
|
---|
103 | * structure created by wphLoadHandles.
|
---|
104 | *
|
---|
105 | *@@added V0.9.16 (2001-10-02) [umoeller]
|
---|
106 | */
|
---|
107 |
|
---|
108 | typedef struct _WPHANDLESBUF
|
---|
109 | {
|
---|
110 | PBYTE pbData; // ptr to all handles (buffers from OS2SYS.INI)
|
---|
111 | ULONG cbData; // byte count of *p
|
---|
112 |
|
---|
113 | USHORT usHiwordAbstract, // hiword for WPAbstract handles
|
---|
114 | usHiwordFileSystem; // hiword for WPFileSystem handles
|
---|
115 |
|
---|
116 | PNODE NodeHashTable[65536];
|
---|
117 | BOOL fNodeHashTableValid; // TRUE after wphRebuildNodeHashTable
|
---|
118 |
|
---|
119 | } HANDLESBUF, *PHANDLESBUF;
|
---|
120 |
|
---|
121 | /* ******************************************************************
|
---|
122 | *
|
---|
123 | * Load handles functions
|
---|
124 | *
|
---|
125 | ********************************************************************/
|
---|
126 |
|
---|
127 | APIRET wphQueryActiveHandles(HINI hiniSystem,
|
---|
128 | PSZ *ppszActiveHandles);
|
---|
129 |
|
---|
130 | APIRET wphQueryBaseClassesHiwords(HINI hiniUser,
|
---|
131 | PUSHORT pusHiwordAbstract,
|
---|
132 | PUSHORT pusHiwordFileSystem);
|
---|
133 |
|
---|
134 | APIRET wphRebuildNodeHashTable(PHANDLESBUF pHandlesBuf);
|
---|
135 |
|
---|
136 | APIRET wphLoadHandles(HINI hiniUser,
|
---|
137 | HINI hiniSystem,
|
---|
138 | const char *pcszActiveHandles,
|
---|
139 | PHANDLESBUF *ppHandlesBuf);
|
---|
140 |
|
---|
141 | APIRET wphFreeHandles(PHANDLESBUF *ppHandlesBuf);
|
---|
142 |
|
---|
143 | APIRET wphQueryHandleFromPath(HINI hiniUser,
|
---|
144 | HINI hiniSystem,
|
---|
145 | const char *pcszName,
|
---|
146 | HOBJECT *phobj);
|
---|
147 |
|
---|
148 | APIRET wphComposePath(PHANDLESBUF pHandlesBuf,
|
---|
149 | USHORT usHandle,
|
---|
150 | PSZ pszFilename,
|
---|
151 | ULONG cbFilename,
|
---|
152 | PNODE *ppNode);
|
---|
153 |
|
---|
154 | APIRET wphQueryPathFromHandle(HINI hiniUser,
|
---|
155 | HINI hiniSystem,
|
---|
156 | HOBJECT hObject,
|
---|
157 | PSZ pszFilename,
|
---|
158 | ULONG cbFilename);
|
---|
159 |
|
---|
160 | #endif
|
---|
161 |
|
---|
162 | #if __cplusplus
|
---|
163 | }
|
---|
164 | #endif
|
---|
165 |
|
---|