1 | /* $Id: wphandle.h 29 2001-01-22 07:28:54Z umoeller $ */
|
---|
2 |
|
---|
3 |
|
---|
4 | /*
|
---|
5 | *@@sourcefile wphandle.h:
|
---|
6 | * header file for wphandle.c, which contains the logic for
|
---|
7 | * dealing with those annoying WPS object handles in OS2SYS.INI.
|
---|
8 | *
|
---|
9 | * This code is mostly written by Henk Kelder and published
|
---|
10 | * with his kind permission.
|
---|
11 | *
|
---|
12 | * Note: Version numbering in this file relates to XWorkplace version
|
---|
13 | * numbering.
|
---|
14 | *
|
---|
15 | *@@include #define INCL_WINSHELLDATA
|
---|
16 | *@@include #define INCL_WINWORKPLACE
|
---|
17 | *@@include #include <os2.h>
|
---|
18 | *@@include #include "wphandle.h"
|
---|
19 | */
|
---|
20 |
|
---|
21 | /* This file Copyright (C) 1997-2000 Ulrich Mller,
|
---|
22 | * Henk Kelder.
|
---|
23 | * This file is part of the "XWorkplace helpers" source package.
|
---|
24 | * This is free software; you can redistribute it and/or modify
|
---|
25 | * it under the terms of the GNU General Public License as published by
|
---|
26 | * the Free Software Foundation, in version 2 as it comes in the COPYING
|
---|
27 | * file of the XWorkplace main distribution.
|
---|
28 | * This program is distributed in the hope that it will be useful,
|
---|
29 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
30 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
31 | * GNU General Public License for more details.
|
---|
32 | */
|
---|
33 |
|
---|
34 | #if __cplusplus
|
---|
35 | extern "C" {
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | #ifndef WPHANDLE_HEADER_INCLUDED
|
---|
39 | #define WPHANDLE_HEADER_INCLUDED
|
---|
40 |
|
---|
41 | /*
|
---|
42 | *@@ IsObjectAbstract:
|
---|
43 | * this macro returns TRUE if the passed hObject points
|
---|
44 | * to an abstract object; the WPS sets the HIWORD of
|
---|
45 | * an abstract hObject to 2 or 3 for these, to 1 for
|
---|
46 | * file system objects
|
---|
47 | */
|
---|
48 |
|
---|
49 | #define IsObjectAbstract(h) (BOOL)((HIUSHORT(h)) != 3)
|
---|
50 |
|
---|
51 | /*
|
---|
52 | * Two structures needed for finding
|
---|
53 | * a filename based on a object handle
|
---|
54 | * (OS2SYS.INI). These are only needed
|
---|
55 | * to parse the BLOCK data manually.
|
---|
56 | */
|
---|
57 |
|
---|
58 | #pragma pack(1)
|
---|
59 |
|
---|
60 | typedef struct _NodeDev
|
---|
61 | {
|
---|
62 | BYTE chName[4]; // = 'NODE'
|
---|
63 | USHORT usLevel; // always == 1
|
---|
64 | USHORT usHandle; // object handle of this NODE
|
---|
65 | USHORT usParentHandle; // object handle of parent NODE
|
---|
66 | BYTE ch[20];
|
---|
67 | USHORT usNameSize; // size of non-qualified filename
|
---|
68 | BYTE szName[1]; // variable length: non-qualified filename
|
---|
69 | // (zero-terminated)
|
---|
70 | } NODE, *PNODE;
|
---|
71 |
|
---|
72 | typedef struct _DrivDev
|
---|
73 | {
|
---|
74 | BYTE chName[4]; // = 'DRIV'
|
---|
75 | USHORT usUnknown1[4];
|
---|
76 | // or BYTE ch1[8], if you prefer
|
---|
77 | ULONG ulSerialNr;
|
---|
78 | USHORT usUnknown2[2];
|
---|
79 | // or BYTE ch2[4], if you prefer
|
---|
80 | BYTE szName[1];
|
---|
81 | } DRIV, *PDRIV;
|
---|
82 |
|
---|
83 | /*
|
---|
84 | * prototypes
|
---|
85 | *
|
---|
86 | */
|
---|
87 |
|
---|
88 | BOOL wphQueryActiveHandles(HINI hIniSystem,
|
---|
89 | PSZ pszHandlesAppName,
|
---|
90 | USHORT usMax);
|
---|
91 |
|
---|
92 | BOOL wphReadAllBlocks(HINI hiniSystem,
|
---|
93 | PSZ pszActiveHandles,
|
---|
94 | PBYTE* ppBlock,
|
---|
95 | PULONG pulSize);
|
---|
96 |
|
---|
97 | HOBJECT wphQueryHandleFromPath(HINI hIniUser,
|
---|
98 | HINI hIniSystem,
|
---|
99 | PSZ pszName);
|
---|
100 |
|
---|
101 | PNODE wphFindPartName(PBYTE pHandlesBuffer,
|
---|
102 | ULONG ulBufSize,
|
---|
103 | USHORT usHandle,
|
---|
104 | PSZ pszFname,
|
---|
105 | USHORT usMax);
|
---|
106 |
|
---|
107 | BOOL wphQueryPathFromHandle(HINI hIniSystem,
|
---|
108 | HOBJECT hObject,
|
---|
109 | PSZ pszFname,
|
---|
110 | USHORT usMax);
|
---|
111 | /*
|
---|
112 | * OS2.INI applications
|
---|
113 | *
|
---|
114 | */
|
---|
115 |
|
---|
116 | // abstract objects per folder handle
|
---|
117 | #define FOLDERCONTENT "PM_Abstract:FldrContent"
|
---|
118 | // all defined abstract objects on the system
|
---|
119 | #define OBJECTS "PM_Abstract:Objects"
|
---|
120 | // their icons, if set individually
|
---|
121 | #define ICONS "PM_Abstract:Icons"
|
---|
122 |
|
---|
123 | // folder positions
|
---|
124 | #define FOLDERPOS "PM_Workplace:FolderPos"
|
---|
125 |
|
---|
126 | // object ID's (<WP_DESKTOP> etc.)
|
---|
127 | #define LOCATION "PM_Workplace:Location"
|
---|
128 | // palette positions
|
---|
129 | #define PALETTEPOS "PM_Workplace:PalettePos"
|
---|
130 | // ???
|
---|
131 | #define STATUSPOS "PM_Workplace:StatusPos"
|
---|
132 | // startup folders
|
---|
133 | #define STARTUP "PM_Workplace:Startup"
|
---|
134 | // all the defined templates on the system
|
---|
135 | #define TEMPLATES "PM_Workplace:Templates"
|
---|
136 | // associations by filter ("*.txt")
|
---|
137 | #define ASSOC_FILTER "PMWP_ASSOC_FILTER"
|
---|
138 | // associations by type ("Plain Text")
|
---|
139 | #define ASSOC_TYPE "PMWP_ASSOC_TYPE"
|
---|
140 | // checksums ?!?
|
---|
141 | #define ASSOC_CHECKSUM "PMWP_ASSOC_CHECKSUM"
|
---|
142 | // all work area folders
|
---|
143 | #define WORKAREARUNNING "FolderWorkareaRunningObjects"
|
---|
144 | // spooler windows ?!?
|
---|
145 | #define JOBCNRPOS "PM_PrintObject:JobCnrPos"
|
---|
146 |
|
---|
147 | /*
|
---|
148 | * OS2SYS.INI applications
|
---|
149 | *
|
---|
150 | */
|
---|
151 |
|
---|
152 | #define HANDLEBLOCK "BLOCK1"
|
---|
153 | #define ACTIVEHANDLES "PM_Workplace:ActiveHandles"
|
---|
154 | #define HANDLES "PM_Workplace:Handles"
|
---|
155 | #define HANDLESAPP "HandlesAppName"
|
---|
156 |
|
---|
157 | /*
|
---|
158 | * Extended Attrribute types
|
---|
159 | *
|
---|
160 | */
|
---|
161 |
|
---|
162 | #ifdef FORGET_IT
|
---|
163 | #define EAT_BINARY 0xFFFE // length preceeded binary
|
---|
164 | #define EAT_ASCII 0xFFFD // length preceeded ASCII
|
---|
165 | #define EAT_BITMAP 0xFFFB // length preceeded bitmap
|
---|
166 | #define EAT_METAFILE 0xFFFA // length preceeded metafile
|
---|
167 | #define EAT_ICON 0xFFF9 // length preceeded icon
|
---|
168 | #define EAT_EA 0xFFEE // length preceeded ASCII
|
---|
169 | // name of associated data (#include)
|
---|
170 | #define EAT_MVMT 0xFFDF // multi-valued, multi-typed field
|
---|
171 | #define EAT_MVST 0xFFDE // multi-valued, single-typed field
|
---|
172 | #define EAT_ASN1 0xFFDD // ASN.1 field
|
---|
173 | #endif
|
---|
174 |
|
---|
175 | /*
|
---|
176 | * Several defines to read EA's
|
---|
177 | *
|
---|
178 | */
|
---|
179 |
|
---|
180 | #define EA_LPBINARY EAT_BINARY // Length preceeded binary
|
---|
181 | #define EA_LPASCII EAT_ASCII // Length preceeded ascii
|
---|
182 | #define EA_ASCIIZ 0xFFFC // Asciiz
|
---|
183 | #define EA_LPBITMAP EAT_BITMAP // Length preceeded bitmap
|
---|
184 | #define EA_LPMETAFILE EAT_METAFILE // metafile
|
---|
185 | #define EA_LPICON EAT_ICON // Length preceeded icon
|
---|
186 | #define EA_ASCIIZFN 0xFFEF // Asciiz file name of associated dat
|
---|
187 | #define EA_ASCIIZEA EAT_EA // Name of associated data, LP Ascii
|
---|
188 | #define EA_MVMT EAT_MVMT // Multi value, multi type
|
---|
189 | #define EA_MVST EAT_MVST // Multi value, single type
|
---|
190 | #define EA_ASN1 EAT_ASN1 // ASN.1 Field
|
---|
191 |
|
---|
192 | /*
|
---|
193 | * The high word of a HOBJECT determines its type:
|
---|
194 | *
|
---|
195 | */
|
---|
196 |
|
---|
197 | // Abstract objects _always_ have an object handle,
|
---|
198 | // because they cannot be referenced by file name.
|
---|
199 | // The high word is either 1 or 2.
|
---|
200 | #define OBJECT_ABSTRACT 0x0001 // before Warp 3, I guess (UM)
|
---|
201 | #define OBJECT_ABSTRACT2 0x0002
|
---|
202 | // File-system objects do not necessarily have an
|
---|
203 | // object handle. If they do, these handles are stored
|
---|
204 | // in those ugly PM_Workplace:Handles BLOCK's in
|
---|
205 | // OS2SYS.INI.
|
---|
206 | // The high word is always 3.
|
---|
207 | #define OBJECT_FSYS 0x0003
|
---|
208 |
|
---|
209 | /*
|
---|
210 | * Several datatags:
|
---|
211 | * all the following are used by the wpRestoreData/
|
---|
212 | * wpSaveData methods to specify the type of data to
|
---|
213 | * be worked on (ulKey parameter). This is specific
|
---|
214 | * to each class.
|
---|
215 | *
|
---|
216 | * Object instance data is stored in OS2.INI for
|
---|
217 | * abstract, in file EA's for file-system objects
|
---|
218 | * (.CLASSDATA).
|
---|
219 | *
|
---|
220 | * Many of these are also declared in the WPS header
|
---|
221 | * files (IDKEY_* parameters; see wpfolder.h for
|
---|
222 | * examples).
|
---|
223 | */
|
---|
224 |
|
---|
225 | // WPObject
|
---|
226 | #define WPOBJECT_HELPPANEL 2
|
---|
227 | #define WPOBJECT_SZID 6
|
---|
228 | #define WPOBJECT_STYLE 7
|
---|
229 | #define WPOBJECT_MINWIN 8
|
---|
230 | #define WPOBJECT_CONCURRENT 9
|
---|
231 | #define WPOBJECT_VIEWBUTTON 10
|
---|
232 | #define WPOBJECT_DATA 11
|
---|
233 | #define WPOBJECT_STRINGS 12
|
---|
234 | #define WPOBJ_STR_OBJID 1
|
---|
235 |
|
---|
236 | // WPAbstract
|
---|
237 | #define WPABSTRACT_TITLE 1
|
---|
238 | #define WPABSTRACT_STYLE 2 // appears to contain the same as WPOBJECT 7
|
---|
239 |
|
---|
240 | // WPShadow
|
---|
241 | #define WPSHADOW_LINK 104 // target object
|
---|
242 |
|
---|
243 | // WPProgram
|
---|
244 | #define WPPROGRAM_PROGTYPE 1
|
---|
245 | #define WPPROGRAM_EXEHANDLE 2 // object handle of executable
|
---|
246 | #define WPPROGRAM_PARAMS 3
|
---|
247 | #define WPPROGRAM_DIRHANDLE 4 // object handle of startup dir
|
---|
248 | #define WPPROGRAM_DOSSET 6
|
---|
249 | #define WPPROGRAM_STYLE 7
|
---|
250 | #define WPPROGRAM_EXENAME 9
|
---|
251 | #define WPPROGRAM_DATA 11
|
---|
252 | #define WPPROGRAM_STRINGS 10
|
---|
253 | #define WPPGM_STR_EXENAME 0
|
---|
254 | #define WPPGM_STR_ARGS 1
|
---|
255 |
|
---|
256 | // WPFileSystem
|
---|
257 | #define WPFSYS_MENUCOUNT 4
|
---|
258 | #define WPFSYS_MENUARRAY 3
|
---|
259 |
|
---|
260 | // WPFolder (also see the additional def's in wpfolder.h)
|
---|
261 | #define WPFOLDER_FOLDERFLAG 13
|
---|
262 | #define WPFOLDER_ICONVIEW 2900 /* IDKEY_FDRCONTENTATTR */
|
---|
263 | #define WPFOLDER_DATA 2931 /* IDKEY_FDRLONGARRAY */
|
---|
264 | #define WPFOLDER_FONTS 2932 /* IDKEY_FDRSTRARRAY */
|
---|
265 |
|
---|
266 | // WPProgramFile
|
---|
267 | #define WPPROGFILE_PROGTYPE 1
|
---|
268 | #define WPPROGFILE_DOSSET 5
|
---|
269 | #define WPPROGFILE_STYLE 6
|
---|
270 | #define WPPROGFILE_DATA 10
|
---|
271 | #define WPPROGFILE_STRINGS 11
|
---|
272 | #define WPPRGFIL_STR_ARGS 0
|
---|
273 |
|
---|
274 | // printer queues?!?
|
---|
275 | #define IDKEY_PRNQUEUENAME 3
|
---|
276 | #define IDKEY_PRNCOMPUTER 5
|
---|
277 | #define IDKEY_PRNJOBDIALOG 9
|
---|
278 | #define IDKEY_PRNREMQUEUE 13
|
---|
279 |
|
---|
280 | #define IDKEY_RPRNNETID 1
|
---|
281 |
|
---|
282 | // WPDisk?!?
|
---|
283 | #define IDKEY_DRIVENUM 1
|
---|
284 |
|
---|
285 | /*
|
---|
286 | * Two structures needed for reading
|
---|
287 | * WPAbstract's object information.
|
---|
288 | *
|
---|
289 | * These are only needed if the instance
|
---|
290 | * data in OS2.INI is to be parsed manually.
|
---|
291 | */
|
---|
292 |
|
---|
293 | typedef struct _ObjectInfo
|
---|
294 | {
|
---|
295 | USHORT cbName; // Size of szName
|
---|
296 | USHORT cbData; // Size of variable length data, starting after szName
|
---|
297 | BYTE szName[1]; // The name of the datagroup
|
---|
298 | } OINFO, *POINFO;
|
---|
299 |
|
---|
300 | typedef struct _TagInfo
|
---|
301 | {
|
---|
302 | USHORT usTagFormat; // Format of data
|
---|
303 | USHORT usTag; // The data-identifier
|
---|
304 | USHORT cbTag; // The size of the data
|
---|
305 | } TAG, *PTAG;
|
---|
306 |
|
---|
307 | typedef struct _WPProgramRefData
|
---|
308 | {
|
---|
309 | HOBJECT hExeHandle;
|
---|
310 | HOBJECT hCurDirHandle;
|
---|
311 | ULONG ulFiller1;
|
---|
312 | ULONG ulProgType;
|
---|
313 | BYTE bFiller[12];
|
---|
314 | } WPPGMDATA;
|
---|
315 |
|
---|
316 | typedef struct _WPProgramFileData
|
---|
317 | {
|
---|
318 | HOBJECT hCurDirHandle;
|
---|
319 | ULONG ulProgType;
|
---|
320 | ULONG ulFiller1;
|
---|
321 | ULONG ulFiller2;
|
---|
322 | ULONG ulFiller3;
|
---|
323 | } WPPGMFILEDATA;
|
---|
324 |
|
---|
325 | typedef struct _WPObjectData
|
---|
326 | {
|
---|
327 | LONG lDefaultView;
|
---|
328 | ULONG ulHelpPanel;
|
---|
329 | ULONG ulUnknown3;
|
---|
330 | ULONG ulObjectStyle;
|
---|
331 | ULONG ulMinWin;
|
---|
332 | ULONG ulConcurrent;
|
---|
333 | ULONG ulViewButton;
|
---|
334 | ULONG ulMenuFlag;
|
---|
335 | } WPOBJDATA;
|
---|
336 |
|
---|
337 | typedef struct _WPFolderData
|
---|
338 | {
|
---|
339 | ULONG ulIconView;
|
---|
340 | ULONG ulTreeView;
|
---|
341 | ULONG ulDetailsView;
|
---|
342 | ULONG ulFolderFlag;
|
---|
343 | ULONG ulTreeStyle;
|
---|
344 | ULONG ulDetailsStyle;
|
---|
345 | BYTE rgbIconTextBkgnd[4];
|
---|
346 | BYTE Filler1[4];
|
---|
347 | BYTE rgbIconTextColor[4];
|
---|
348 | BYTE Filler2[8];
|
---|
349 | BYTE rgbTreeTextColor[4];
|
---|
350 | BYTE rgbDetailsTextColor[4];
|
---|
351 | BYTE Filler3[4];
|
---|
352 | USHORT fIconTextVisible;
|
---|
353 | USHORT fIconViewFlags;
|
---|
354 | USHORT fTreeTextVisible;
|
---|
355 | USHORT fTreeViewFlags;
|
---|
356 | BYTE Filler4[4];
|
---|
357 | ULONG ulMenuFlag;
|
---|
358 | BYTE rgbIconShadowColor[4];
|
---|
359 | BYTE rgbTreeShadowColor[4];
|
---|
360 | BYTE rgbDetailsShadowColor[4];
|
---|
361 | } WPFOLDATA;
|
---|
362 |
|
---|
363 | typedef struct _FsysMenu
|
---|
364 | {
|
---|
365 | USHORT usIDMenu ;
|
---|
366 | USHORT usIDParent ;
|
---|
367 | USHORT usMenuType; // 1 = Cascade, 2 = condcascade, 3 = choice
|
---|
368 | HOBJECT hObject;
|
---|
369 | BYTE szTitle[32];
|
---|
370 | } FSYSMENU, *PFSYSMENU;
|
---|
371 |
|
---|
372 | typedef struct _FolderSort
|
---|
373 | {
|
---|
374 | LONG lDefaultSortIndex;
|
---|
375 | BOOL fAlwaysSort;
|
---|
376 | LONG lCurrentSort;
|
---|
377 | BYTE bFiller[12];
|
---|
378 | } FOLDERSORT, *PFOLDERSORT;
|
---|
379 |
|
---|
380 | typedef struct _FldBkgnd
|
---|
381 | {
|
---|
382 | ULONG ulUnknown;
|
---|
383 | BYTE bBlue;
|
---|
384 | BYTE bGreen;
|
---|
385 | BYTE bRed;
|
---|
386 | BYTE bExtra;
|
---|
387 | //RGB rgb;
|
---|
388 | //BYTE bFiller;
|
---|
389 | BYTE bColorOnly; // 0x28 Image, 0x27 Color only
|
---|
390 | BYTE bFiller2;
|
---|
391 | BYTE bImageType; // 2=Normal, 3=tiled, 4=scaled
|
---|
392 | BYTE bFiller3;
|
---|
393 | BYTE bScaleFactor;
|
---|
394 | BYTE bFiller4;
|
---|
395 | } FLDBKGND, *PFLDBKGND;
|
---|
396 |
|
---|
397 | #pragma pack() // added V0.9.0
|
---|
398 |
|
---|
399 | #endif
|
---|
400 |
|
---|
401 | #if __cplusplus
|
---|
402 | }
|
---|
403 | #endif
|
---|
404 |
|
---|