Leaked source code of windows server 2003
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.

235 lines
6.9 KiB

  1. /*++ BUILD Version: 0015 // Increment this if a change has global effects
  2. /****************************** Module Header ******************************\
  3. * Module Name: usersrv.h
  4. *
  5. * Copyright (c) 1985 - 1999, Microsoft Corporation
  6. *
  7. * Typedefs, defines, and prototypes that are used exclusively by the User
  8. * and Console server-side DLL.
  9. *
  10. * History:
  11. * 04-28-91 DarrinM Created from PROTO.H, MACRO.H, and STRTABLE.H
  12. * 01-25-95 JimA Split off from kernel-mode.
  13. \***************************************************************************/
  14. #ifndef _USERSRV_
  15. #define _USERSRV_
  16. #include <windows.h>
  17. #include <w32gdip.h>
  18. /*
  19. * Enable warnings that are turned off default for NT but we want on
  20. */
  21. #ifndef RC_INVOKED // RC can't handle #pragmas
  22. #pragma warning(error:4101) // Unreferenced local variable
  23. #endif
  24. #ifndef _USERKDX_ /* if not building ntuser\kdexts */
  25. #include <stddef.h>
  26. #include <w32gdip.h>
  27. #include <ddeml.h>
  28. #include "ddemlp.h"
  29. #include "winuserp.h"
  30. #include "winuserk.h"
  31. #include <dde.h>
  32. #include <ddetrack.h>
  33. #include "kbd.h"
  34. #include <wowuserp.h>
  35. #include <memory.h>
  36. #include <w32err.h>
  37. #include <string.h>
  38. #include "help.h"
  39. #include "user.h"
  40. #include "cscall.h"
  41. #undef MONITOR
  42. #include "strid.h"
  43. #include "csrmsg.h"
  44. #endif /* _USERKDX_ */
  45. typedef struct tagCTXHARDERRORINFO {
  46. CLIENT_ID ClientId;
  47. ULONG MessageId;
  48. LPWSTR pTitle;
  49. LPWSTR pMessage;
  50. ULONG Style;
  51. ULONG Timeout;
  52. ULONG Response;
  53. PULONG pResponse;
  54. PNTSTATUS pStatus;
  55. HANDLE hEvent;
  56. BOOLEAN DoNotWait;
  57. BOOLEAN CountPending;
  58. BOOLEAN DoNotWaitForCorrectDesktop;
  59. struct tagCTXHARDERRORINFO * pchiNext;
  60. } CTXHARDERRORINFO, *PCTXHARDERRORINFO;
  61. /*
  62. * EndTask dialog, controls, timers, etc
  63. */
  64. #define IDD_ENDTASK 10
  65. #define IDC_STATUSICON 0x100
  66. #define IDC_STATUSMSG 0x101
  67. #define IDC_STATUSCANCEL 0x102
  68. #define IDC_ENDNOW 0x103
  69. #define IDI_CONSOLE 1
  70. #define ETD_XICON 10
  71. #define ETD_YICON 10
  72. #define IDB_WARNING 0x200
  73. #define IDT_CHECKAPPSTATE 0x300
  74. #define IDT_PROGRESS 0x301
  75. /*
  76. * End task dialog parameters.
  77. */
  78. INT_PTR APIENTRY EndTaskDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  79. typedef struct _ENDDLGPARAMS {
  80. DWORD dwFlags; /* EDPF_* flags */
  81. DWORD dwClientFlags; /* WMCS_* flags defined in ntuser\user.h */
  82. DWORD dwRet; /* User selection */
  83. UINT uStrId; /* IDC_STATUS message */
  84. PCSR_THREAD pcsrt; /* Not provided for console */
  85. LPARAM lParam; /* hwnd for windows - pwcTitle for Console */
  86. DWORD dwCheckTimerCount;/* IDT_CHECKAPPTIMER tick count */
  87. HBITMAP hbmpWarning; /* Warning bitmap to display on icon if not waiting */
  88. RECT rcWarning; /* Warning bitmap position */
  89. HICON hIcon; /* Application's icon */
  90. RECT rcBar; /* Progress bar rect including edge */
  91. RECT rcProgress; /* Next block's rect */
  92. int iProgressStop; /* Progress bar right most coordinate */
  93. int iProgressWidth; /* Progress bar block width */
  94. HBRUSH hbrProgress; /* Used to draw progress bar blocks */
  95. RECT rcEndButton; /* End button original position (move while in wait mode) */
  96. } ENDDLGPARAMS;
  97. /*
  98. * ENDDLGPARAMS dwFlags field
  99. */
  100. #define EDPF_NODLG 0x00000001
  101. #define EDPF_RESPONSE 0x00000002
  102. #define EDPF_HUNG 0x00000004
  103. #define EDPF_WAIT 0x00000008
  104. #define EDPF_INPUT 0x00000010
  105. /*
  106. * Commands returned from ThreadShutdownNotify
  107. */
  108. #define TSN_APPSAYSOK 1
  109. #define TSN_APPSAYSNOTOK 2
  110. #define TSN_USERSAYSKILL 3
  111. #define TSN_USERSAYSCANCEL 4
  112. #define TSN_NOWINDOW 5
  113. /*
  114. * Max number of threads stuck in ThreadShutdownNotify at any one time.
  115. */
  116. #define TSN_MAX_THREADS 0x8
  117. /*
  118. * Shared data between user and console
  119. */
  120. extern HANDLE ghModuleWin;
  121. extern DWORD gCmsHungAppTimeout;
  122. extern DWORD gCmsWaitToKillTimeout;
  123. extern DWORD gdwHungToKillCount;
  124. extern DWORD gdwServicesProcessId;
  125. extern DWORD gdwServicesWaitToKillTimeout;
  126. extern DWORD gdwProcessTerminateTimeout;
  127. /*
  128. * Hard error information
  129. */
  130. typedef struct tagHARDERRORINFO {
  131. struct tagHARDERRORINFO *phiNext;
  132. PCSR_THREAD pthread;
  133. HANDLE hEventHardError;
  134. PHARDERROR_MSG pmsg;
  135. DWORD dwHEIFFlags;
  136. UNICODE_STRING usText; /* MessageBox text, caption and flags */
  137. UNICODE_STRING usCaption;
  138. DWORD dwMBFlags;
  139. DWORD dwTimeout; /* MessageBox timeout (could be INFINITE) */
  140. DWORD dwVDMParam0;
  141. DWORD dwVDMParam1;
  142. PCTXHARDERRORINFO pCtxHEInfo;
  143. } HARDERRORINFO, *PHARDERRORINFO;
  144. #define HEIF_ACTIVE 0x00000001
  145. #define HEIF_NUKED 0x00000002
  146. #define HEIF_ALLOCATEDMSG 0x00000004
  147. #define HEIF_REPLIED 0x00000008
  148. #define HEIF_DEREFTHREAD 0x00000010
  149. #define HEIF_WRONGDESKTOP 0x00000020
  150. #define HEIF_SYSTEMERROR 0x00000040
  151. #define HEIF_VDMERROR 0x00000080
  152. #define HEIF_NOWAIT 0x00000100
  153. BOOL BoostHardError(ULONG_PTR dwProcessId, DWORD dwCode);
  154. #define BHE_ACTIVATE 0
  155. #define BHE_FORCE 1
  156. #define BHE_TEST 2
  157. DWORD ThreadShutdownNotify(DWORD dwClientFlags, ULONG_PTR dwThread, LPARAM lParam);
  158. /*
  159. * WM_CLIENTSHUTDOWN message callback
  160. */
  161. typedef struct tagWMCSDATA {
  162. DWORD dwFlags;
  163. DWORD dwRet;
  164. } WMCSDATA, *PWMCSDATA;
  165. #define WMCSD_IGNORE 0x00000001
  166. #define WMCSD_REPLY 0x00000002
  167. #define WMCSD_RECEIVED 0x00000004
  168. /*
  169. * Prototypes from server.c
  170. */
  171. BOOL CALLBACK FindWindowFromThread (HWND hwnd, LPARAM lParam);
  172. /*
  173. * !!! LATER - move other internal routines out of winuserp.h
  174. */
  175. int InternalDoEndTaskDialog(TCHAR* pszTitle, HANDLE h, int cSeconds);
  176. #ifndef _USERKDX_ /* if not building ntuser\kdexts */
  177. LPWSTR RtlLoadStringOrError(
  178. HANDLE hModule,
  179. UINT wID,
  180. LPWSTR lpDefault,
  181. PBOOL pAllocated,
  182. BOOL bAnsi
  183. );
  184. #define ServerLoadString(hmod, id, default, allocated)\
  185. RtlLoadStringOrError((hmod), (id), (default), (allocated), FALSE)
  186. #endif /* _USERKDX_ */
  187. #define EnterCrit() RtlEnterCriticalSection(&gcsUserSrv)
  188. #define LeaveCrit() RtlLeaveCriticalSection(&gcsUserSrv)
  189. #ifdef FE_IME
  190. BOOL IsImeWindow( HWND hwnd );
  191. #endif
  192. VOID UserExitWorkerThread(NTSTATUS Status);
  193. // used by hang reporting since CreateProcessW does not work from CSRSS
  194. BOOL StartHangReport(ULONG ulSessionId, LPWSTR wszEventName,
  195. DWORD dwpidHung, DWORD dwtidHung, BOOL f64Bit,
  196. HANDLE *phProcDumprep);
  197. // used by hang reporting to create the SD for the event that will signal when
  198. // it's ok to kill the hung process
  199. NTSTATUS AllocDefSD(SECURITY_DESCRIPTOR *psd, DWORD dwOALS, DWORD dwWA);
  200. void FreeDefSD(SECURITY_DESCRIPTOR *psd);
  201. #include "globals.h"
  202. #endif // !_USERSRV_