home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: WPS_PM / WPS_PM.zip / xfld085s.zip / helpers / wphandle.h < prev    next >
C/C++ Source or Header  |  1999-02-23  |  12KB  |  360 lines

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