home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / xwplascr.zip / XWPL0208.ZIP / include / startshut / shutdown.h < prev   
Text File  |  2002-05-27  |  12KB  |  315 lines

  1.  
  2. /*
  3.  *@@sourcefile shutdown.h:
  4.  *      header file for shutdown.c.
  5.  *
  6.  *@@include #define INCL_DOSPROCESS
  7.  *@@include #define INCL_DOSSEMAPHORES
  8.  *@@include #define INCL_WINWINDOWMGR
  9.  *@@include #define INCL_WINPOINTERS
  10.  *@@include #define INCL_WINSWITCHLIST
  11.  *@@include #include <os2.h>
  12.  *@@include #include "helpers\linklist.h"
  13.  *@@include #include <wpobject.h>
  14.  *@@include #include "startshut\shutdown.h"
  15.  */
  16.  
  17. /*
  18.  *      Copyright (C) 1997-2002 Ulrich Möller.
  19.  *      This program is free software; you can redistribute it and/or modify
  20.  *      it under the terms of the GNU General Public License as published by
  21.  *      the Free Software Foundation, in version 2 as it comes in the COPYING
  22.  *      file of the XWorkplace main distribution.
  23.  *      This program is distributed in the hope that it will be useful,
  24.  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
  25.  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  26.  *      GNU General Public License for more details.
  27.  */
  28.  
  29. #ifndef XSHUTDWN_HEADER_INCLUDED
  30.     #define XSHUTDWN_HEADER_INCLUDED
  31.  
  32.     /********************************************************************
  33.      *
  34.      *   Declarations
  35.      *
  36.      ********************************************************************/
  37.  
  38.     /*
  39.      *@@ SHUTDOWNPARAMS:
  40.      *      shutdown structure for external calls.
  41.      *      This is also used internally in shutdown.c.
  42.      *
  43.      *@@changed V0.9.5 (2000-08-10) [umoeller]: changed ulRestartWPS
  44.      */
  45.  
  46.     typedef struct _SHUTDOWNPARAMS
  47.     {
  48.         BOOL        optReboot,
  49.                     optConfirm,
  50.                     optDebug;
  51.         ULONG       ulCloseMode;
  52.             // changed V0.9.19 (2002-04-02) [umoeller]
  53.             // one of the following:
  54.               #define SHUT_SHUTDOWN               1
  55.               #define SHUT_RESTARTWPS             2
  56.               #define SHUT_LOGOFF                 3
  57.  
  58.         // ULONG       ulRestartWPS;
  59.             // changed V0.9.5 (2000-08-10) [umoeller]:
  60.             // restart Desktop flag, meaning:
  61.             // -- 0: no, do shutdown
  62.             // -- 1: yes, restart Desktop
  63.             // -- 2: yes, restart Desktop, but logoff also
  64.             //          (only if XWPSHELL is running)
  65.  
  66.         BOOL        optWPSCloseWindows,
  67.                     optAutoCloseVIO,
  68.                     optLog,
  69.                     // optAnimate,          // removed V0.9.12 (2001-05-12) [umoeller]
  70.                     optAPMPowerOff,
  71.                     optAPMDelay,
  72.                     optWPSReuseStartupFolder,
  73.                     optEmptyTrashCan,
  74.                     optWarpCenterFirst;
  75.         CHAR        szRebootCommand[CCHMAXPATH];
  76.     } SHUTDOWNPARAMS, *PSHUTDOWNPARAMS;
  77.  
  78.     // traffic light animation
  79.     #define XSD_ANIM_COUNT 8            // animation steps
  80.     typedef struct _SHUTDOWNANIM {
  81.         HPOINTER    ahptr[XSD_ANIM_COUNT];
  82.     } SHUTDOWNANIM, *PSHUTDOWNANIM;
  83.  
  84.     /*
  85.      *@@ AUTOCLOSELISTITEM:
  86.      *      this is the user-defined list of auto-close items
  87.      */
  88.  
  89.     typedef struct _AUTOCLOSELISTITEM
  90.     {
  91.         CHAR                szItemName[100];
  92.         USHORT              usAction;
  93.     } AUTOCLOSELISTITEM, *PAUTOCLOSELISTITEM;
  94.  
  95.     // auto-close actions
  96.     // #define ACL_CTRL_C              1            removed V0.9.19 (2002-05-23) [umoeller]
  97.     #define ACL_WMCLOSE             2
  98.     #define ACL_KILLSESSION         3
  99.     #define ACL_SKIP                4
  100.  
  101.     #ifdef SOM_WPObject_h
  102.     #ifdef LINKLIST_HEADER_INCLUDED
  103.  
  104.         typedef struct SHUTLIST_STRUCT
  105.         {
  106.             SWCNTRL                 swctl;          // system tasklist structure (see PM ref.)
  107.             WPObject                *pObject;       // NULL for non-WPS windows
  108.             CHAR                    szClass[100];   // window class of the task's main window
  109.             LONG                    lSpecial;       // XSD_* flags; > 0 if Desktop or WarpCenter
  110.         } SHUTLISTITEM, *PSHUTLISTITEM;
  111.  
  112.         /*
  113.          *@@ AUTOCLOSEWINDATA:
  114.          *      data structure used in the "Auto close"
  115.          *      dialog (stored in QWL_USER).
  116.          */
  117.  
  118.         typedef struct _AUTOCLOSEWINDATA
  119.         {
  120.             PLINKLIST           pllAutoClose;       // changed (V0.9.0)
  121.             SHORT               sSelected;
  122.             PAUTOCLOSELISTITEM  pliSelected;
  123.             USHORT              usItemCount;
  124.             /* LINKLIST           SHUTLISTITEM llShut
  125.                                 psliLast; */
  126.         } AUTOCLOSEWINDATA, *PAUTOCLOSEWINDATA;
  127.  
  128.         /*
  129.          * REBOOTLISTITEM:
  130.          *      data structure for user reboot items.
  131.          */
  132.  
  133.         typedef struct _REBOOTLISTITEM
  134.         {
  135.             CHAR                szItemName[100];
  136.             CHAR                szCommand[CCHMAXPATH];
  137.         } REBOOTLISTITEM, *PREBOOTLISTITEM;
  138.  
  139.         #ifdef DOSH_HEADER_INCLUDED
  140.         /*
  141.          *@@ REBOOTWINDATA:
  142.          *      data structure used in the "Reboot items"
  143.          *      dialog (stored in QWL_USER).
  144.          */
  145.  
  146.         typedef struct _REBOOTWINDATA
  147.         {
  148.             PLINKLIST       pllReboot;              // changed (V0.9.0)
  149.             SHORT           sSelected;
  150.             PREBOOTLISTITEM pliSelected;
  151.             USHORT          usItemCount;
  152.  
  153.             /* PPARTITIONINFO  ppi;                   // partitions list (V0.9.0)
  154.             USHORT          usPartitions; */
  155.  
  156.             PPARTITIONSLIST pPartitionsList;        // new partitions list
  157.                                                     // V0.9.9 (2001-04-07) [umoeller]
  158.             BOOL            fPartitionsLoaded;      // TRUE after first attempt,
  159.                                                     // even if failed
  160.         } REBOOTWINDATA, *PREBOOTWINDATA;
  161.         #endif
  162.  
  163.     #endif // LINKLIST_HEADER_INCLUDED
  164.     #endif // SOM_WPObject_h
  165.  
  166.     /* ******************************************************************
  167.      *
  168.      *   Shutdown interface
  169.      *
  170.      ********************************************************************/
  171.  
  172.     VOID xsdQueryShutdownSettings(PSHUTDOWNPARAMS psdp);
  173.  
  174.     // current shutdown status
  175.     #define XSD_IDLE                0       // not started yet
  176.     #define XSD_CONFIRMING          1       // confirmation window is open
  177.     #define XSD_INITIALIZING        3       // shutdown thread is init'ing
  178.     #define XSD_CLOSINGWINDOWS      4       // currently closing windows
  179.     #define XSD_CANCELLED           5       // user pressed cancel
  180.                                             // (only in a short time frame before
  181.                                             // the shutdown thread has cleaned
  182.                                             // up; we then reset to XSD_IDLE)
  183.     #define XSD_ALLCLOSED_SAVING    6       // all windows closed, saving WPS
  184.     #define XSD_SAVEDONE_FLUSHING   7       // WPS saved, preparing file-system
  185.                                             // flush or WPS restart, and then
  186.                                             // while system is halted
  187.  
  188.     ULONG xsdQueryShutdownState(VOID);
  189.  
  190.     BOOL xsdInitiateShutdown(VOID);
  191.  
  192.     BOOL xsdInitiateRestartWPS(BOOL fLogoff);
  193.  
  194.     BOOL xsdInitiateShutdownExt(PSHUTDOWNPARAMS psdp);
  195.  
  196.     /* ******************************************************************
  197.      *
  198.      *   Shutdown settings pages
  199.      *
  200.      ********************************************************************/
  201.  
  202.     #ifdef NOTEBOOK_HEADER_INCLUDED
  203.         VOID XWPENTRY xsdShutdownInitPage(PNOTEBOOKPAGE pnbp,
  204.                                           ULONG flFlags);
  205.  
  206.         MRESULT XWPENTRY xsdShutdownItemChanged(PNOTEBOOKPAGE pnbp,
  207.                                        ULONG ulItemID,
  208.                                        USHORT usNotifyCode,
  209.                                        ULONG ulExtra);
  210.     #endif
  211.  
  212.     /* ******************************************************************
  213.      *
  214.      *   Shutdown helper functions
  215.      *
  216.      ********************************************************************/
  217.  
  218.     VOID xsdLoadAnimation(PSHUTDOWNANIM psda);
  219.  
  220.     VOID xsdFreeAnimation(PSHUTDOWNANIM psda);
  221.  
  222.     VOID xsdRestartWPS(HAB hab,
  223.                        BOOL fLogoff);
  224.  
  225.     APIRET xsdFlushWPS2INI(VOID);
  226.  
  227.     #ifdef INCL_WINSWITCHLIST
  228.     #ifdef KERNEL_HEADER_INCLUDED
  229.     #ifdef SOM_WPObject_h
  230.  
  231.         #define XSD_SYSTEM              -1
  232.         #define XSD_INVISIBLE           -2
  233.         #define XSD_DEBUGNEED           -3
  234.  
  235.         #define XSD_DESKTOP             -4
  236.         #define XSD_WARPCENTER          -5
  237.  
  238.         #define XSD_WPSOBJECT_CLOSE     0       // close in all modes
  239.  
  240.         #define XSD_OTHER_OWNED         1       // close with shutdown and logoff,
  241.                                                 // but do not close in restart WPS mode
  242.  
  243.         #define XSD_OTHER_FOREIGN       2       // object is not owned by current user,
  244.                                                 // do not close in logoff mode
  245.  
  246.         typedef struct _SHUTDOWNCONSTS
  247.         {
  248.             PCKERNELGLOBALS pKernelGlobals;
  249.             SOMClass        *pWPDesktop;
  250.             WPObject        *pActiveDesktop;
  251.             HWND            hwndActiveDesktop;
  252.             HWND            hwndOpenWarpCenter; // OPEN_RUNNING view of open WarpCenter
  253.  
  254.             PID             pidWPS,     // WinQueryWindowProcess(G_hwndMain, &G_pidWPS, NULL);
  255.                             pidPM;      // WinQueryWindowProcess(HWND_DESKTOP, &G_pidPM, NULL);
  256.  
  257.             HWND            hwndMain,
  258.                                         // dlg with listbox (visible only in debug mode)
  259.                             hwndShutdownStatus;
  260.                                         // status window (always visible)
  261.             HWND            hwndVioDlg;
  262.                                         // if != NULLHANDLE, currently open VIO confirmation
  263.                                         // window
  264.  
  265.             ULONG           uid;        // user ID if XWPShell is running
  266.                                         // V0.9.19 (2002-04-02) [umoeller]
  267.                                         // -1 otherwise
  268.  
  269.         } SHUTDOWNCONSTS, *PSHUTDOWNCONSTS;
  270.  
  271.         VOID xsdGetShutdownConsts(PSHUTDOWNCONSTS pConsts);
  272.  
  273.         LONG xsdIsClosable(HAB hab,
  274.                            PSHUTDOWNCONSTS pConsts,
  275.                            SWENTRY *pSwEntry,
  276.                            WPObject **ppObject,
  277.                            PULONG pulUserID);
  278.     #endif
  279.     #endif
  280.     #endif
  281.  
  282.     /* ******************************************************************
  283.      *
  284.      *   XShutdown dialogs
  285.      *
  286.      ********************************************************************/
  287.  
  288.     ULONG xsdConfirmShutdown(PSHUTDOWNPARAMS psdParms);
  289.  
  290.     ULONG xsdConfirmRestartWPS(PSHUTDOWNPARAMS psdParms);
  291.  
  292.     MRESULT EXPENTRY fnwpAutoCloseDetails(HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2);
  293.  
  294.     MRESULT EXPENTRY fnwpUserRebootOptions(HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2);
  295.  
  296.     /* ******************************************************************
  297.      *
  298.      *   Shutdown thread
  299.      *
  300.      ********************************************************************/
  301.  
  302.     #ifdef THREADS_HEADER_INCLUDED
  303.     void _Optlink fntShutdownThread(PTHREADINFO pti);
  304.     #endif
  305.  
  306.     /* ******************************************************************
  307.      *
  308.      *   Window list debugging (winlist.c)
  309.      *
  310.      ********************************************************************/
  311.  
  312.     HWND winlCreateWinListWindow(VOID);
  313.  
  314. #endif
  315.