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