Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

178 lines
6.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: ObjMgr.h
  7. //
  8. // Contents: Keeps track of our applications dialog objects
  9. // and lifetime
  10. //
  11. // Classes:
  12. //
  13. // Notes:
  14. //
  15. // History: 05-Nov-97 rogerg Created.
  16. //
  17. //--------------------------------------------------------------------------
  18. #ifndef _OBJMGR_
  19. #define _OBJMGR_
  20. class CBaseDlg;
  21. class CChoiceDlg;
  22. class CProgressDlg;
  23. typedef enum _tagDLGTYPE // type of dialog.
  24. {
  25. DLGTYPE_CHOICE = 0x1,
  26. DLGTYPE_PROGRESS = 0x2,
  27. } DLGTYPE;
  28. enum EAutoDialState
  29. {
  30. eQuiescedOn, // Quiesced state and auto dial is on
  31. eQuiescedOff, // Quiesced state and auto dial is off
  32. eAutoDialOn, // During a sync session and auto dial is on
  33. eAutoDialOff // During a sync session and auto dial is off
  34. };
  35. typedef struct _tagDLGLISTITEM {
  36. _tagDLGLISTITEM *pDlgNextListItem; // pointer to the next dialog in the list.
  37. DLGTYPE dlgType; // type of dialog this is.
  38. ULONG cRefs; // number of references on this object
  39. ULONG cLocks; // number of locks on this object
  40. CLSID clsid; // clsid of this dialog, only applicable to choice.
  41. CBaseDlg *pDlg;
  42. DWORD dwThreadID; // Thread the dialog is on.
  43. HANDLE hThread; // Handle to the thread the dialog belongs too
  44. BOOL fHasReleaseDlgCmdId; // boolean to indicate if there is a callback
  45. WORD wCommandID; // CommandID to pass to the callback.
  46. } DLGLISTITEM;
  47. typedef struct _tagOBJECTMGRDATA {
  48. DLGLISTITEM *DlgList; // Ptr to Dialog list
  49. HANDLE hClassRegisteredEvent; // Event created by process that has registered the classFactory.
  50. DWORD dwRegClassFactCookie; // registered OLE Class Factory Cooke
  51. BOOL fRegClassFactCookieValid; // registered OLE Class Factory Cooke
  52. DWORD LockCountInternal; // Internal lock count on Application
  53. DWORD LockCountExternal; // External lock count on Application
  54. BOOL fCloseAll; // Set if told to CloseAll, used in ReleaseOneStopLifetime
  55. DWORD dwSettingsLockCount; // number of lock counts on the settings dialog,.
  56. DWORD dwHandlerPropertiesLockCount; // number of lock counts on any handler properties dialogs open
  57. BOOL fDead; // set in release call to avoid multiple releases.
  58. DWORD dwMainThreadID; // Id of Main Thrad
  59. HWND hWndMainThreadMsg; //hwnd of Main Thread Message Hwnd.
  60. BOOL fIdleHandlerRunning; // SyncMgr is currently processing Idle.
  61. EAutoDialState eAutoDialState; // State machine for supporting autodial
  62. BOOL fRasAutoDial; // Is Ras auto dial on ?
  63. BOOL fWininetAutoDial; // Is Wininet auto dial on ?
  64. BOOL fFirstSyncItem; // Is the first PrepareForSyncItem being processed
  65. ULONG cNestedStartCalls; // Count of nested start calls
  66. } OBJECTMGRDATA;
  67. typedef struct _tagDlgThreadArgs {
  68. HANDLE hEvent; // used to know when the message loop has been created.
  69. HRESULT hr; // inidicates if creation was successfull
  70. DLGTYPE dlgType; // requested dialog type to create.
  71. CLSID clsid; // clsid identifies the dialog.
  72. int nCmdShow; // how to display the dialog
  73. CBaseDlg *pDlg; // pointer to the created dialog.
  74. } DlgThreadArgs;
  75. DWORD WINAPI DialogThread( LPVOID lpArg );
  76. // onetime initialization routiens
  77. STDAPI InitObjectManager(CMsgServiceHwnd *pMsgService);
  78. // determines main threads response to WM_QUERYENDSESSION
  79. STDAPI ObjMgr_HandleQueryEndSession(HWND *hwnd,UINT *uMessageId,BOOL *fLetUserDecide);
  80. STDAPI_(ULONG) ObjMgr_AddRefHandlerPropertiesLockCount(DWORD dwNumRefs);
  81. STDAPI_(ULONG) ObjMgr_ReleaseHandlerPropertiesLockCount(DWORD dwNumRefs);
  82. STDAPI ObjMgr_CloseAll();
  83. // idle managmenent
  84. STDAPI RequestIdleLock();
  85. STDAPI ReleaseIdleLock();
  86. // routines for handling dialog lifetime
  87. STDAPI FindChoiceDialog(REFCLSID rclsid,BOOL fCreate,int nCmdShow,CChoiceDlg **pChoiceDlg);
  88. STDAPI_(ULONG) AddRefChoiceDialog(REFCLSID rclsid,CChoiceDlg *pChoiceDlg);
  89. STDAPI_(ULONG) ReleaseChoiceDialog(REFCLSID rclsid,CChoiceDlg *pChoiceDlg);
  90. STDAPI SetChoiceReleaseDlgCmdId(REFCLSID rclsid,CChoiceDlg *pChoiceDlg,WORD wCommandId);
  91. STDAPI FindProgressDialog(REFCLSID rclsid,BOOL fCreate,int nCmdShow,CProgressDlg **pProgressDlg);
  92. STDAPI_(ULONG) AddRefProgressDialog(REFCLSID rclsid,CProgressDlg *pProgressDlg);
  93. STDAPI_(ULONG) ReleaseProgressDialog(REFCLSID rclsid,CProgressDlg *pProgressDlg,BOOL fForce);
  94. STDAPI SetProgressReleaseDlgCmdId(REFCLSID rclsid,CProgressDlg *pProgressDlg,WORD wCommandId);
  95. STDAPI LockProgressDialog(REFCLSID rclsid,CProgressDlg *pProgressDlg,BOOL fLock);
  96. // helper routines called by dialog lifetime.
  97. STDAPI FindDialog(DLGTYPE dlgType,REFCLSID rclsid,BOOL fCreate,int nCmdShow,CBaseDlg **pDlg);
  98. STDAPI_(ULONG) AddRefDialog(DLGTYPE dlgType,REFCLSID rclsid,CBaseDlg *pDlg);
  99. STDAPI_(ULONG) ReleaseDialog(DLGTYPE dlgType,REFCLSID rclsid,CBaseDlg *pDlg,BOOL fForce);
  100. STDAPI SetReleaseDlgCmdId(DLGTYPE dlgType,REFCLSID rclsid,CBaseDlg *pDlg,WORD wCommandId);
  101. // Routines called for dial support
  102. STDAPI BeginSyncSession();
  103. STDAPI EndSyncSession();
  104. STDAPI ApplySyncItemDialState( BOOL fAutoDialDisable );
  105. STDAPI GetAutoDialState();
  106. STDAPI LokDisableAutoDial();
  107. STDAPI LokEnableAutoDial();
  108. typedef struct _tagDlgSettingsArgs {
  109. HANDLE hEvent; // used to know when thread has been initialized.
  110. HWND hwndParent; // hwnd to use the parent as.
  111. DWORD dwParentThreadId;
  112. } DlgSettingsArgs;
  113. DWORD WINAPI SettingsThread( LPVOID lpArg );
  114. STDAPI ShowOptionsDialog(HWND hwndParent);
  115. // helper routine for OLE classes.
  116. STDAPI RegisterOneStopClassFactory(BOOL fForce);
  117. // routines for managing lifetime of application
  118. STDAPI_(ULONG) AddRefOneStopLifetime(BOOL fExternal);
  119. STDAPI_(ULONG) ReleaseOneStopLifetime(BOOL fExternal);
  120. // routines for routing messages
  121. BOOL IsOneStopDlgMessage(MSG *msg);
  122. // declarations for CSingletonNetapi class.
  123. //+-------------------------------------------------------------------------
  124. //
  125. // Class: CSingletonNetApi
  126. //
  127. // Purpose: Singleton net api object
  128. //
  129. // History: 31-Jul-98 SitaramR Created
  130. //
  131. //--------------------------------------------------------------------------
  132. class CSingletonNetApi : CLockHandler
  133. {
  134. public:
  135. CSingletonNetApi()
  136. : m_pNetApi(0)
  137. {
  138. }
  139. ~CSingletonNetApi();
  140. LPNETAPI GetNetApiObj();
  141. void DeleteNetApiObj();
  142. private:
  143. LPNETAPI m_pNetApi; // Actual net api object
  144. };
  145. extern CSingletonNetApi gSingleNetApiObj; // Global singleton NetApi object
  146. #endif // _OBJMGR_