Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

usersrv.h File Reference

#include <windows.h>
#include <w32gdip.h>
#include <stddef.h>
#include <ddeml.h>
#include "ddemlp.h"
#include "winuserp.h"
#include "winuserk.h"
#include <dde.h>
#include <ddetrack.h>
#include "kbd.h"
#include <wowuserp.h>
#include <memory.h>
#include <w32err.h>
#include <string.h>
#include "help.h"
#include "user.h"
#include "cscall.h"
#include "strid.h"
#include "csrmsg.h"
#include "globals.h"

Go to the source code of this file.

Classes

struct  tagCTXHARDERRORINFO
struct  _ENDDLGPARAMS
struct  tagHARDERRORINFO
struct  tagWMCSDATA

Defines

#define IDD_ENDTASK   10
#define IDC_STATUSICON   0x100
#define IDC_STATUSMSG   0x101
#define IDC_STATUSCANCEL   0x102
#define IDC_ENDNOW   0x103
#define IDI_CONSOLE   1
#define ETD_XICON   10
#define ETD_YICON   10
#define IDB_WARNING   0x200
#define IDT_CHECKAPPSTATE   0x300
#define IDT_PROGRESS   0x301
#define EDPF_NODLG   0x00000001
#define EDPF_RESPONSE   0x00000002
#define EDPF_HUNG   0x00000004
#define EDPF_WAIT   0x00000008
#define EDPF_INPUT   0x00000010
#define TSN_APPSAYSOK   1
#define TSN_APPSAYSNOTOK   2
#define TSN_USERSAYSKILL   3
#define TSN_USERSAYSCANCEL   4
#define TSN_NOWINDOW   5
#define HEIF_ACTIVE   0x00000001
#define HEIF_NUKED   0x00000002
#define HEIF_ALLOCATEDMSG   0x00000004
#define HEIF_REPLIED   0x00000008
#define HEIF_DEREFTHREAD   0x00000010
#define HEIF_WRONGDESKTOP   0x00000020
#define HEIF_SYSTEMERROR   0x00000040
#define HEIF_VDMERROR   0x00000080
#define BHE_ACTIVATE   0
#define BHE_FORCE   1
#define BHE_TEST   2
#define WMCSD_IGNORE   0x00000001
#define WMCSD_REPLY   0x00000002
#define WMCSD_RECEIVED   0x00000004
#define ServerLoadString(hmod, id, default, allocated)   RtlLoadStringOrError((hmod), (id), (default), (allocated), FALSE)
#define EnterCrit()   RtlEnterCriticalSection(&gcsUserSrv)
#define LeaveCrit()   RtlLeaveCriticalSection(&gcsUserSrv)

Typedefs

typedef tagCTXHARDERRORINFO CTXHARDERRORINFO
typedef tagCTXHARDERRORINFOPCTXHARDERRORINFO
typedef _ENDDLGPARAMS ENDDLGPARAMS
typedef tagHARDERRORINFO HARDERRORINFO
typedef tagHARDERRORINFOPHARDERRORINFO
typedef tagWMCSDATA WMCSDATA
typedef tagWMCSDATAPWMCSDATA

Functions

INT_PTR APIENTRY EndTaskDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
BOOL BoostHardError (ULONG_PTR dwProcessId, DWORD dwCode)
DWORD ThreadShutdownNotify (DWORD dwClientFlags, ULONG_PTR dwThread, LPARAM lParam)
BOOL CALLBACK FindWindowFromThread (HWND hwnd, LPARAM lParam)
int InternalDoEndTaskDialog (TCHAR *pszTitle, HANDLE h, int cSeconds)
LPWSTR RtlLoadStringOrError (HANDLE hModule, UINT wID, LPWSTR lpDefault, PBOOL pAllocated, BOOL bAnsi)

Variables

HANDLE ghModuleWin
DWORD gCmsHungAppTimeout
DWORD gCmsWaitToKillTimeout
DWORD gdwHungToKillCount
DWORD gdwServicesProcessId
DWORD gdwServicesWaitToKillTimeout
DWORD gdwProcessTerminateTimeout


Define Documentation

#define BHE_ACTIVATE   0
 

Definition at line 161 of file usersrv.h.

Referenced by BoostHardError(), and CreateCtrlThread().

#define BHE_FORCE   1
 

Definition at line 162 of file usersrv.h.

Referenced by BoostHardError(), CreateCtrlThread(), KillProcess(), ThreadShutdownNotify(), UserClientShutdown(), and W32WinStationTerminate().

#define BHE_TEST   2
 

Definition at line 163 of file usersrv.h.

Referenced by EndTaskDlgProc(), and ThreadShutdownNotify().

#define EDPF_HUNG   0x00000004
 

Definition at line 112 of file usersrv.h.

Referenced by EndTaskDlgProc(), SetEndTaskDlgStatus(), and ThreadShutdownNotify().

#define EDPF_INPUT   0x00000010
 

Definition at line 114 of file usersrv.h.

Referenced by EndTaskDlgProc(), and ThreadShutdownNotify().

#define EDPF_NODLG   0x00000001
 

Definition at line 110 of file usersrv.h.

Referenced by EndTaskDlgProc(), and ThreadShutdownNotify().

#define EDPF_RESPONSE   0x00000002
 

Definition at line 111 of file usersrv.h.

Referenced by EndTaskDlgProc(), and ThreadShutdownNotify().

#define EDPF_WAIT   0x00000008
 

Definition at line 113 of file usersrv.h.

Referenced by EndTaskDlgProc(), SetEndTaskDlgStatus(), and ThreadShutdownNotify().

#define EnterCrit void   )     RtlEnterCriticalSection(&gcsUserSrv)
 

Definition at line 201 of file usersrv.h.

Referenced by _ExitWindowsEx(), BoostHardError(), CheckAllowForeground(), CheckDefaultDesktop(), DeviceClassNotify(), DownSiren(), EndShutdown(), GetHardErrorText(), HardErrorHandler(), HighBeep(), InitiateWin32kCleanup(), InitSystemThread(), KeyClick(), LowBeep(), NtUserUserHandleGrantAccess(), ProcessHardErrorRequest(), ProcessKeyboardInput(), ProcessMouseInput(), ProcessQueuedMouseEvents(), QueuePowerRequest(), RawInputThread(), RemoteDoMessage(), RemoteMessageThread(), SrvRegisterServicesProcess(), TimersProc(), UpSiren(), UserBeep(), UserEnterUserCritSec(), UserGetDesktopDC(), UserGlobalAtomTableCallout(), UserHardErrorEx(), UserInitialize(), UserRedrawDesktop(), UserRegisterEventSource(), UserReleaseDC(), UserServerDllInitialization(), UserSetConsoleProcessWindowStation(), UserThreadCallout(), VideoPortCalloutThread(), Win32kNtUserCleanup(), Win32UserInitialize(), xxxActivateDebugger(), xxxAllowSetForegroundWindow(), xxxCreateDesktop(), xxxCreateThreadInfo(), xxxDesktopThread(), xxxInitInput(), xxxInitTerminal(), xxxInternalGetMessage(), xxxLW_LoadFonts(), xxxMKMouseMove(), xxxMKMoveAccelCursorTimer(), xxxMKMoveConstCursorTimer(), xxxMouseEventDirect(), xxxMoveEventAbsolute(), xxxMsgWaitForMultipleObjects(), xxxOldMessageBeep(), xxxPollAndWaitForSingleObject(), xxxRegisterForDeviceClassNotifications(), xxxSendMessageBSM(), xxxSleepTask(), xxxSleepThread(), xxxUserDuplicateObject(), xxxUserFindHandleForObject(), xxxUserNotifyConsoleApplication(), xxxUserNotifyProcessCreate(), xxxUserProcessCallout(), and xxxWaitForInputIdle().

#define ETD_XICON   10
 

Definition at line 77 of file usersrv.h.

Referenced by EndTaskDlgProc().

#define ETD_YICON   10
 

Definition at line 78 of file usersrv.h.

Referenced by EndTaskDlgProc().

#define HEIF_ACTIVE   0x00000001
 

Definition at line 151 of file usersrv.h.

Referenced by BoostHardError(), and HardErrorHandler().

#define HEIF_ALLOCATEDMSG   0x00000004
 

Definition at line 153 of file usersrv.h.

Referenced by FreePhi(), and UserHardErrorEx().

#define HEIF_DEREFTHREAD   0x00000010
 

Definition at line 155 of file usersrv.h.

Referenced by ReplyHardError(), and UserHardErrorEx().

#define HEIF_NUKED   0x00000002
 

Definition at line 152 of file usersrv.h.

Referenced by BoostHardError(), and HardErrorHandler().

#define HEIF_REPLIED   0x00000008
 

Definition at line 154 of file usersrv.h.

Referenced by ReplyHardError(), and UserHardErrorEx().

#define HEIF_SYSTEMERROR   0x00000040
 

Definition at line 157 of file usersrv.h.

Referenced by GetHardErrorText(), and UserHardErrorEx().

#define HEIF_VDMERROR   0x00000080
 

Definition at line 158 of file usersrv.h.

Referenced by GetHardErrorText(), and HardErrorHandler().

#define HEIF_WRONGDESKTOP   0x00000020
 

Definition at line 156 of file usersrv.h.

Referenced by CheckDefaultDesktop(), and HardErrorHandler().

#define IDB_WARNING   0x200
 

Definition at line 80 of file usersrv.h.

Referenced by EndTaskDlgProc().

#define IDC_ENDNOW   0x103
 

Definition at line 74 of file usersrv.h.

Referenced by SetEndTaskDlgStatus(), and ThreadShutdownNotify().

#define IDC_STATUSCANCEL   0x102
 

Definition at line 73 of file usersrv.h.

Referenced by SetEndTaskDlgStatus().

#define IDC_STATUSICON   0x100
 

Definition at line 71 of file usersrv.h.

#define IDC_STATUSMSG   0x101
 

Definition at line 72 of file usersrv.h.

Referenced by SetEndTaskDlgStatus().

#define IDD_ENDTASK   10
 

Definition at line 70 of file usersrv.h.

Referenced by ThreadShutdownNotify().

#define IDI_CONSOLE   1
 

Definition at line 76 of file usersrv.h.

Referenced by EndTaskDlgProc(), and InitWindowClass().

#define IDT_CHECKAPPSTATE   0x300
 

Definition at line 82 of file usersrv.h.

Referenced by EndTaskDlgProc(), and SetEndTaskDlgStatus().

#define IDT_PROGRESS   0x301
 

Definition at line 83 of file usersrv.h.

Referenced by EndTaskDlgProc(), and SetEndTaskDlgStatus().

#define LeaveCrit void   )     RtlLeaveCriticalSection(&gcsUserSrv)
 

Definition at line 202 of file usersrv.h.

Referenced by _ExitWindowsEx(), BoostHardError(), CheckAllowForeground(), CheckDefaultDesktop(), DeviceClassNotify(), DownSiren(), EndShutdown(), GetHardErrorText(), HardErrorHandler(), HighBeep(), InitiateWin32kCleanup(), InitSystemThread(), KeyClick(), LowBeep(), NtUserUserHandleGrantAccess(), ProcessHardErrorRequest(), ProcessKeyboardInput(), ProcessMouseInput(), ProcessQueuedMouseEvents(), QueuePowerRequest(), RawInputThread(), RemoteDoMessage(), RemoteMessageThread(), SrvRegisterServicesProcess(), TimersProc(), UpSiren(), UserBeep(), UserGetDesktopDC(), UserGlobalAtomTableCallout(), UserHardErrorEx(), UserInitialize(), UserLeaveUserCritSec(), UserRedrawDesktop(), UserRegisterEventSource(), UserReleaseDC(), UserServerDllInitialization(), UserSetConsoleProcessWindowStation(), UserThreadCallout(), VideoPortCalloutThread(), Win32kNtUserCleanup(), Win32UserInitialize(), xxxActivateDebugger(), xxxAllowSetForegroundWindow(), xxxCreateDesktop(), xxxCreateThreadInfo(), xxxDesktopThread(), xxxInitInput(), xxxInitTerminal(), xxxInternalGetMessage(), xxxLW_LoadFonts(), xxxMKMouseMove(), xxxMKMoveAccelCursorTimer(), xxxMKMoveConstCursorTimer(), xxxMouseEventDirect(), xxxMoveEventAbsolute(), xxxMsgWaitForMultipleObjects(), xxxOldMessageBeep(), xxxPollAndWaitForSingleObject(), xxxRegisterForDeviceClassNotifications(), xxxSendMessageBSM(), xxxSleepTask(), xxxSleepThread(), xxxUserDuplicateObject(), xxxUserFindHandleForObject(), xxxUserNotifyConsoleApplication(), xxxUserNotifyProcessCreate(), xxxUserProcessCallout(), and xxxWaitForInputIdle().

#define ServerLoadString hmod,
id,
default,
allocated   )     RtlLoadStringOrError((hmod), (id), (default), (allocated), FALSE)
 

Definition at line 196 of file usersrv.h.

#define TSN_APPSAYSNOTOK   2
 

Definition at line 119 of file usersrv.h.

Referenced by _EndTask(), ThreadShutdownNotify(), and UserClientShutdown().

#define TSN_APPSAYSOK   1
 

Definition at line 118 of file usersrv.h.

Referenced by ThreadShutdownNotify(), and UserClientShutdown().

#define TSN_NOWINDOW   5
 

Definition at line 122 of file usersrv.h.

Referenced by ThreadShutdownNotify(), and UserClientShutdown().

#define TSN_USERSAYSCANCEL   4
 

Definition at line 121 of file usersrv.h.

Referenced by _EndTask(), CreateCtrlThread(), ThreadShutdownNotify(), and UserClientShutdown().

#define TSN_USERSAYSKILL   3
 

Definition at line 120 of file usersrv.h.

Referenced by ThreadShutdownNotify(), and UserClientShutdown().

#define WMCSD_IGNORE   0x00000001
 

Definition at line 174 of file usersrv.h.

Referenced by ThreadShutdownNotify(), and WMCSCallback().

#define WMCSD_RECEIVED   0x00000004
 

Definition at line 176 of file usersrv.h.

#define WMCSD_REPLY   0x00000002
 

Definition at line 175 of file usersrv.h.

Referenced by ThreadShutdownNotify(), and WMCSCallback().


Typedef Documentation

typedef struct tagCTXHARDERRORINFO CTXHARDERRORINFO
 

Referenced by RemoteDoMessage().

typedef struct _ENDDLGPARAMS ENDDLGPARAMS
 

Referenced by ThreadShutdownNotify().

typedef struct tagHARDERRORINFO HARDERRORINFO
 

Referenced by UserHardErrorEx().

typedef struct tagCTXHARDERRORINFO * PCTXHARDERRORINFO
 

typedef struct tagHARDERRORINFO * PHARDERRORINFO
 

typedef struct tagWMCSDATA * PWMCSDATA
 

Referenced by WMCSCallback().

typedef struct tagWMCSDATA WMCSDATA
 

Referenced by ThreadShutdownNotify().


Function Documentation

BOOL BoostHardError ULONG_PTR  dwProcessId,
DWORD  dwCode
 

Definition at line 1906 of file w32/ntuser/server/harderr.c.

References BHE_ACTIVATE, BHE_FORCE, BOOL, tagHARDERRORINFO::dwHEIFFlags, DWORD, EnterCrit, EnumThreadWindows(), FALSE, FindWindowFromThread(), gdwHardErrorThreadId, gphiList, HEIF_ACTIVE, HEIF_NUKED, LeaveCrit, NtUserHardErrorControl(), NULL, tagHARDERRORINFO::phiNext, PostThreadMessage(), ReplyHardError(), SetForegroundWindow(), and TRUE.

Referenced by CreateCtrlThread(), EndTaskDlgProc(), KillProcess(), ThreadShutdownNotify(), UserClientShutdown(), and W32WinStationTerminate().

01909 { 01910 DESKRESTOREDATA drdRestore; 01911 PHARDERRORINFO phi, *pphi; 01912 BOOL fHasError = FALSE; 01913 01914 EnterCrit(); 01915 /* 01916 * If the list is empty, nothing do to here. 01917 */ 01918 if (gphiList == NULL) { 01919 LeaveCrit(); 01920 return FALSE; 01921 } 01922 drdRestore.pdeskRestore = NULL; 01923 /* 01924 * Walk the hard error list 01925 */ 01926 pphi = &gphiList; 01927 while (*pphi != NULL) { 01928 /* 01929 * If not not nuking all and not owned by dwProcessId, continue walking 01930 */ 01931 if (dwProcessId != (ULONG_PTR)-1) { 01932 if (((*pphi)->pthread == NULL) 01933 || ((ULONG_PTR)((*pphi)->pthread->ClientId.UniqueProcess) != dwProcessId)) { 01934 01935 pphi = &(*pphi)->phiNext; 01936 continue; 01937 } 01938 } else { 01939 UserAssert(dwCode == BHE_FORCE); 01940 } 01941 /* 01942 * Got one so we want to return TRUE 01943 */ 01944 fHasError = TRUE; 01945 /* 01946 * If nuking the request 01947 */ 01948 if (dwCode == BHE_FORCE) { 01949 /* 01950 * Unlink it from the list. 01951 */ 01952 phi = *pphi; 01953 *pphi = phi->phiNext; 01954 01955 /* 01956 * If this box is being shown right now, signal it to go away. 01957 * Otherwise, nuke it 01958 */ 01959 if (phi->dwHEIFFlags & HEIF_ACTIVE) { 01960 DWORD dwHardErrorHandler = gdwHardErrorThreadId; 01961 phi->dwHEIFFlags |= HEIF_NUKED; 01962 LeaveCrit(); 01963 PostThreadMessage(dwHardErrorHandler, WM_QUIT, 0, 0); 01964 } else { 01965 /* 01966 * Acknowledge the error as not handled, reply and free 01967 */ 01968 LeaveCrit(); 01969 ReplyHardError(phi, ResponseNotHandled); 01970 } 01971 01972 /* 01973 * Restart the search because we left the crit sect. 01974 */ 01975 EnterCrit(); 01976 pphi = &gphiList; 01977 01978 /* continue */ 01979 01980 } else if (dwCode == BHE_ACTIVATE) { 01981 /* 01982 * If it's active, find it and show it. 01983 */ 01984 phi = *pphi; 01985 if (phi->dwHEIFFlags & HEIF_ACTIVE) { 01986 HWND hwndError = NULL; 01987 DWORD dwHardErrorHandler = gdwHardErrorThreadId; 01988 01989 LeaveCrit(); 01990 EnumThreadWindows(dwHardErrorHandler, FindWindowFromThread, (LPARAM)&hwndError); 01991 01992 if ((hwndError != NULL) 01993 && (HEC_SUCCESS == NtUserHardErrorControl(HardErrorAttachNoQueue, NULL, &drdRestore))) { 01994 01995 SetForegroundWindow(hwndError); 01996 01997 NtUserHardErrorControl(HardErrorDetachNoQueue, NULL, &drdRestore); 01998 } 01999 return TRUE; 02000 } 02001 02002 /* 02003 * It's not active so move it to the head of the list 02004 * to make it show up next. 02005 */ 02006 *pphi = phi->phiNext; 02007 phi->phiNext = gphiList; 02008 gphiList = phi; 02009 break; 02010 02011 } else { /* BHE_TEST */ 02012 /* 02013 * The caller just want to know if this process owns a hard error 02014 */ 02015 break; 02016 } 02017 } /* while (*pphi != NULL) */ 02018 02019 LeaveCrit(); 02020 02021 /* 02022 * Bug 284468. Wake up the hard error handler 02023 */ 02024 if (dwCode == BHE_FORCE && gdwHardErrorThreadId != 0) { 02025 PostThreadMessage(gdwHardErrorThreadId, WM_NULL, 0, 0); 02026 } 02027 02028 return fHasError; 02029 }

INT_PTR APIENTRY EndTaskDlgProc HWND  hwndDlg,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 1312 of file server/exitwin.c.

References APIENTRY, BeginPaint, BHE_TEST, BOOL, BoostHardError(), CCHBODYMAX, DestroyWindow, DrawEdge(), DrawIcon(), DWORD, EDPF_HUNG, EDPF_INPUT, EDPF_NODLG, EDPF_RESPONSE, EDPF_WAIT, ETD_XICON, ETD_YICON, FALSE, FillRect(), gdwHungToKillCount, GetApplicationText(), GetClassLongPtr(), GetDC, GetInputWindow(), GetProp(), GetSystemMetrics(), GetWindowLongPtr(), GetWindowText(), ghModuleWin, ICON_PROP_NAME, IDB_WARNING, IDI_CONSOLE, IDT_CHECKAPPSTATE, IDT_PROGRESS, InflateRect(), msg, NULL, ReleaseDC(), SetEndTaskDlgStatus(), SetWindowLongPtr(), SetWindowPos, SetWindowText(), TRUE, UINT, and WMCS_CONSOLE.

Referenced by ThreadShutdownNotify().

01317 { 01318 ENDDLGPARAMS* pedp; 01319 WCHAR achTitle[CCHBODYMAX]; 01320 WCHAR *pwcText, *pwcTemp; 01321 UINT uLen; 01322 UINT uStrId; 01323 PAINTSTRUCT ps; 01324 HDC hdc, hdcMem; 01325 BOOL fIsInput, fWasInput; 01326 #ifdef USE_MIRRORING 01327 int iOldLayout; 01328 #endif 01329 01330 switch (msg) { 01331 case WM_INITDIALOG: 01332 /* 01333 * Save parameters 01334 */ 01335 pedp = (ENDDLGPARAMS*)lParam; 01336 SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (ULONG_PTR)pedp); 01337 /* 01338 * This tells the caller that the dialog is up 01339 */ 01340 pedp->dwFlags &= ~EDPF_NODLG; 01341 /* 01342 * Build the dialog title making sure that 01343 * we end up with a NULL terminated string. 01344 */ 01345 *(achTitle + CCHBODYMAX - 1) = (WCHAR)0; 01346 uLen = GetWindowText(hwndDlg, achTitle, CCHBODYMAX - 1); 01347 pwcText = achTitle + uLen; 01348 uLen = CCHBODYMAX - 1 - uLen; 01349 /* 01350 * Console provides the title; we figure it out for windows apps. 01351 */ 01352 if (pedp->dwClientFlags & WMCS_CONSOLE) { 01353 pwcTemp = (WCHAR *)pedp->lParam; 01354 while (uLen-- && (*pwcText++ = *pwcTemp++)); 01355 } else { 01356 GetApplicationText((HWND)pedp->lParam, pedp->pcsrt->ThreadHandle, pwcText, uLen); 01357 } 01358 01359 SetWindowText(hwndDlg, achTitle); 01360 /* 01361 * Get the app's icon: first look for atomIconProperty 01362 * if not available, try the class icon. 01363 * else, use the default icon. 01364 */ 01365 pedp->hIcon = (HICON)GetProp((HWND)pedp->lParam, ICON_PROP_NAME); 01366 01367 if (pedp->hIcon == NULL) { 01368 01369 pedp->hIcon = (HICON)GetClassLongPtr((HWND)pedp->lParam, GCLP_HICON); 01370 01371 if (pedp->hIcon == NULL) { 01372 01373 if (pedp->dwClientFlags & WMCS_CONSOLE) { 01374 pedp->hIcon = LoadIcon(ghModuleWin, MAKEINTRESOURCE(IDI_CONSOLE)); 01375 } 01376 else { 01377 pedp->hIcon = LoadIcon(NULL, IDI_APPLICATION); 01378 } 01379 } 01380 } 01381 01382 /* 01383 * Figure out what message the caller wants initially 01384 */ 01385 if (pedp->dwClientFlags & WMCS_CONSOLE) { 01386 uStrId = STR_ENDTASK_CONSOLE; 01387 } else if (pedp->dwFlags & EDPF_INPUT) { 01388 uStrId = STR_ENDTASK_INPUT; 01389 } else if (pedp->dwFlags & EDPF_WAIT) { 01390 uStrId = STR_ENDTASK_WAIT; 01391 } else { 01392 uStrId = STR_ENDTASK_HUNG; 01393 } 01394 /* 01395 * Display the message, set the focus and show the dialog 01396 */ 01397 SetEndTaskDlgStatus(pedp, hwndDlg, uStrId, TRUE); 01398 return FALSE; 01399 01400 01401 case WM_PAINT: 01402 pedp = (ENDDLGPARAMS*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); 01403 if ((pedp == NULL) || (pedp->hIcon == NULL)) { 01404 break; 01405 } 01406 /* 01407 * Draw the icon 01408 */ 01409 hdc = BeginPaint(hwndDlg, &ps); 01410 #ifdef USE_MIRRORING 01411 iOldLayout = GetLayout(hdc); 01412 if (iOldLayout != GDI_ERROR) { 01413 SetLayout(hdc, iOldLayout|LAYOUT_BITMAPORIENTATIONPRESERVED); 01414 } 01415 #endif 01416 DrawIcon(hdc, ETD_XICON, ETD_YICON, pedp->hIcon); 01417 #ifdef USE_MIRRORING 01418 if (iOldLayout != GDI_ERROR) { 01419 SetLayout(hdc, iOldLayout); 01420 } 01421 #endif 01422 /* 01423 * If waiting, draw the progress bar; 01424 * else draw the warning sign 01425 */ 01426 if (pedp->dwFlags & EDPF_WAIT) { 01427 RECT rc; 01428 /* 01429 * Draw a client-edge-looking border. 01430 */ 01431 rc = pedp->rcBar; 01432 DrawEdge(hdc, &rc, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST); 01433 InflateRect(&rc, -1, -1); 01434 /* 01435 * Draw the blocks up to current position 01436 */ 01437 rc.right = rc.left + pedp->iProgressWidth - 1; 01438 while (rc.left < pedp->rcProgress.left) { 01439 if (rc.right > pedp->iProgressStop) { 01440 rc.right = pedp->iProgressStop; 01441 if (rc.left >= rc.right) { 01442 break; 01443 } 01444 } 01445 FillRect(hdc, &rc, pedp->hbrProgress); 01446 rc.left += pedp->iProgressWidth; 01447 rc.right += pedp->iProgressWidth; 01448 } 01449 } else { 01450 /* 01451 * Load the bitmap the first time around and 01452 * figure out where it goes 01453 */ 01454 if (pedp->hbmpWarning == NULL) { 01455 BITMAP bmp; 01456 pedp->hbmpWarning = LoadBitmap(ghModuleWin, MAKEINTRESOURCE(IDB_WARNING)); 01457 if (GetObject(pedp->hbmpWarning, sizeof(bmp), &bmp)) { 01458 pedp->rcWarning.left = ETD_XICON; 01459 pedp->rcWarning.top = ETD_XICON + 32 - bmp.bmHeight; 01460 pedp->rcWarning.right = bmp.bmWidth; 01461 pedp->rcWarning.bottom = bmp.bmHeight; 01462 } 01463 } 01464 /* 01465 * Blit it 01466 */ 01467 hdcMem = CreateCompatibleDC(hdc); 01468 SelectObject(hdcMem, pedp->hbmpWarning); 01469 GdiTransparentBlt(hdc, pedp->rcWarning.left, pedp->rcWarning.top, 01470 pedp->rcWarning.right, pedp->rcWarning.bottom, 01471 hdcMem, 0, 0, pedp->rcWarning.right, pedp->rcWarning.bottom, RGB(255, 0, 255)); 01472 DeleteDC(hdcMem); 01473 } 01474 01475 EndPaint(hwndDlg, &ps); 01476 return TRUE; 01477 01478 case WM_TIMER: 01479 pedp = (ENDDLGPARAMS*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); 01480 if (pedp == NULL) { 01481 return TRUE; 01482 } 01483 switch (wParam) { 01484 case IDT_CHECKAPPSTATE: 01485 pedp->dwCheckTimerCount++; 01486 /* 01487 * Check if the app has switched from/to a waiting-for-input 01488 * mode. If so, update the dialog and wait a little longer 01489 */ 01490 fIsInput = (BoostHardError((ULONG_PTR)pedp->pcsrt->ClientId.UniqueProcess, BHE_TEST) 01491 || (GetInputWindow(pedp->pcsrt, (HWND)pedp->lParam) != NULL)); 01492 fWasInput = (pedp->dwFlags & EDPF_INPUT); 01493 if (fIsInput ^ fWasInput) { 01494 UINT uProgress; 01495 pedp->dwFlags &= ~(EDPF_INPUT | EDPF_WAIT); 01496 pedp->dwFlags |= (fIsInput ? EDPF_INPUT : EDPF_WAIT); 01497 SetEndTaskDlgStatus(pedp, hwndDlg, 01498 (fIsInput ? STR_ENDTASK_INPUT : STR_ENDTASK_WAIT), 01499 FALSE); 01500 pedp->dwCheckTimerCount /= 2; 01501 uProgress = pedp->rcProgress.left - pedp->rcBar.left - GetSystemMetrics(SM_CXEDGE); 01502 uProgress /= 2; 01503 pedp->rcProgress.left -= uProgress; 01504 pedp->rcProgress.right -= uProgress; 01505 } 01506 /* 01507 * Is it time to declare it hung? 01508 */ 01509 if (pedp->dwCheckTimerCount >= gdwHungToKillCount) { 01510 KillTimer(hwndDlg, IDT_CHECKAPPSTATE); 01511 pedp->dwFlags &= ~(EDPF_INPUT | EDPF_WAIT); 01512 pedp->dwFlags |= EDPF_HUNG; 01513 SetEndTaskDlgStatus(pedp, hwndDlg, STR_ENDTASK_HUNG, FALSE); 01514 } 01515 break; 01516 01517 case IDT_PROGRESS: 01518 /* 01519 * Draw the next block in the progress bar. 01520 */ 01521 if (pedp->rcProgress.right >= pedp->iProgressStop) { 01522 pedp->rcProgress.right = pedp->iProgressStop; 01523 if (pedp->rcProgress.left >= pedp->rcProgress.right) { 01524 break; 01525 } 01526 } 01527 hdc = GetDC(hwndDlg); 01528 FillRect(hdc, &pedp->rcProgress, pedp->hbrProgress); 01529 ReleaseDC(hwndDlg, hdc); 01530 pedp->rcProgress.left += pedp->iProgressWidth; 01531 pedp->rcProgress.right += pedp->iProgressWidth; 01532 break; 01533 } 01534 return TRUE; 01535 01536 01537 case WM_NCACTIVATE: 01538 /* 01539 * Make sure we're uncovered when active and not covering the app 01540 * when inactive 01541 */ 01542 pedp = (ENDDLGPARAMS*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); 01543 if (pedp != NULL) { 01544 HWND hwnd; 01545 if (wParam) { 01546 hwnd = HWND_TOPMOST; 01547 } else if (pedp->dwClientFlags & WMCS_CONSOLE) { 01548 hwnd = HWND_TOP; 01549 } else { 01550 hwnd = (HWND)pedp->lParam; 01551 } 01552 SetWindowPos(hwndDlg, hwnd, 01553 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); 01554 } 01555 break; 01556 01557 01558 case WM_COMMAND: 01559 /* 01560 * The user has made a choice, we're done. 01561 */ 01562 pedp = (ENDDLGPARAMS*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); 01563 if (pedp != NULL) { 01564 pedp->dwRet = (DWORD)wParam; 01565 } 01566 DestroyWindow(hwndDlg); 01567 break; 01568 01569 01570 case WM_DESTROY: 01571 /* 01572 * We're dead. Make sure the caller knows we're history 01573 */ 01574 pedp = (ENDDLGPARAMS*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); 01575 if (pedp != NULL) { 01576 pedp->dwFlags |= (EDPF_NODLG | EDPF_RESPONSE); 01577 if (pedp->hbmpWarning != NULL) { 01578 DeleteObject(pedp->hbmpWarning); 01579 } 01580 if (pedp->hbrProgress != NULL) { 01581 DeleteObject(pedp->hbrProgress); 01582 } 01583 } 01584 break; 01585 } 01586 01587 return FALSE; 01588 }

BOOL CALLBACK FindWindowFromThread HWND  hwnd,
LPARAM  lParam
 

Definition at line 1255 of file server/server.c.

References BOOL, GetWindow(), NULL, and TRUE.

Referenced by BoostHardError(), GetHardErrorText(), and ThreadShutdownNotify().

01256 { 01257 BOOL fTopLevelOwner; 01258 #ifdef FE_IME 01259 if ( IsImeWindow(hwnd) ) { 01260 return TRUE; 01261 } 01262 #endif 01263 01264 fTopLevelOwner = (GetWindow(hwnd, GW_OWNER) == NULL); 01265 if ((*((HWND *)lParam) == NULL) || fTopLevelOwner) { 01266 *((HWND *)lParam) = hwnd; 01267 } 01268 return !fTopLevelOwner; 01269 }

int InternalDoEndTaskDialog TCHAR *  pszTitle,
HANDLE  h,
int  cSeconds
 

LPWSTR RtlLoadStringOrError HANDLE  hModule,
UINT  wID,
LPWSTR  lpDefault,
PBOOL  pAllocated,
BOOL  bAnsi
 

Definition at line 1499 of file w32/ntuser/server/harderr.c.

References CHAR, FALSE, LMEM_ZEROINIT, NT_SUCCESS, NTSTATUS(), NULL, RtlFindMessage(), Status, and TRUE.

Referenced by GetRegIntFromID(), and UserServerDllInitialization().

01506 { 01507 LPTSTR lpsz; 01508 int cch; 01509 LPWSTR lpw; 01510 PMESSAGE_RESOURCE_ENTRY MessageEntry; 01511 NTSTATUS Status; 01512 01513 cch = 0; 01514 lpw = NULL; 01515 01516 Status = RtlFindMessage((PVOID)hModule, (ULONG_PTR)RT_MESSAGETABLE, 01517 0, wID, &MessageEntry); 01518 if (NT_SUCCESS(Status)) { 01519 01520 /* 01521 * Return two fewer chars so the crlf in the message will be 01522 * stripped out. 01523 */ 01524 cch = wcslen((PWCHAR)MessageEntry->Text) - 2; 01525 lpsz = (LPWSTR)MessageEntry->Text; 01526 01527 if (bAnsi) { 01528 int ich; 01529 01530 /* 01531 * Add one to zero terminate then force the termination 01532 */ 01533 ich = WCSToMB(lpsz, cch+1, (CHAR **)&lpw, -1, TRUE); 01534 ((LPSTR)lpw)[ich-1] = 0; 01535 01536 } 01537 else { 01538 lpw = (LPWSTR)LocalAlloc(LMEM_ZEROINIT,(cch+1)*sizeof(WCHAR)); 01539 if ( lpw ) { 01540 01541 /* 01542 * Copy the string into the buffer. 01543 */ 01544 RtlCopyMemory(lpw, lpsz, cch*sizeof(WCHAR)); 01545 } 01546 } 01547 } 01548 01549 if ( !lpw ) { 01550 lpw = lpDefault; 01551 *pAllocated = FALSE; 01552 } else { 01553 *pAllocated = TRUE; 01554 } 01555 01556 return lpw; 01557 }

DWORD ThreadShutdownNotify DWORD  dwClientFlags,
ULONG_PTR  dwThread,
LPARAM  lParam
 

Definition at line 757 of file server/exitwin.c.

References BHE_FORCE, BHE_TEST, BOOL, BoostHardError(), CCHBODYMAX, DestroyWindow, DispatchMessage(), tagWMCSDATA::dwFlags, DWORD, tagWMCSDATA::dwRet, EDPF_HUNG, EDPF_INPUT, EDPF_NODLG, EDPF_RESPONSE, EDPF_WAIT, ENDDLGPARAMS, EndTaskDlgProc(), EnumThreadWindows(), ESMH_CANCELEVENT, ESMH_HANDLECOUNT, ESMH_THREAD, FALSE, FindWindowFromThread(), gCmsHungAppTimeout, GetApplicationText(), GetInputWindow(), GetWindow(), GetWindowLongPtr(), gfAutoEndTask, gheventCancel, ghModuleWin, IDC_ENDNOW, IDD_ENDTASK, IsDialogMessage, ISTS, IsWindowEnabled(), msg, MsgWaitForMultipleObjects(), NtUserQueryInformationThread(), NULL, PeekMessage(), PostMessage(), SendMessageCallback(), SendNotifyMessage(), SetForegroundWindow(), TranslateMessage(), TRUE, TSN_APPSAYSNOTOK, TSN_APPSAYSOK, TSN_NOWINDOW, TSN_USERSAYSCANCEL, TSN_USERSAYSKILL, WMCS_CONSOLE, WMCS_CONTEXTLOGOFF, WMCS_ENDTASK, WMCS_EXIT, WMCS_NODLGIFHUNG, WMCS_NORETRY, WMCS_QUERYEND, WMCSCallback(), WMCSD_IGNORE, WMCSD_REPLY, WMCSDATA, WMCSR_ALLOWSHUTDOWN, WMCSR_CANCEL, WMCSR_DONE, and WowExitTask().

Referenced by _EndTask(), CreateCtrlThread(), and UserClientShutdown().

00758 { 00759 HWND hwnd, hwndOwner; 00760 PWMCSDATA pwmcsd = NULL; 00761 HWND hwndDlg; 00762 ENDDLGPARAMS edp; 00763 DWORD dwRet, dwRealTimeout, dwTimeout, dwStartTiming, dwCmd; 00764 MSG msg; 00765 PCSR_THREAD pcsrt; 00766 HANDLE hThread; 00767 BOOL fEndTaskNow = FALSE; 00768 00769 #define ESMH_CANCELEVENT 0 00770 #define ESMH_THREAD 1 00771 #define ESMH_HANDLECOUNT 2 00772 HANDLE ahandles[ESMH_HANDLECOUNT]; 00773 00774 /* 00775 * If this is console, just set up the wait loop and 00776 * bring the dialog up right away. Otherwise, find 00777 * the notification window, notify it and go wait. 00778 */ 00779 if (dwClientFlags & WMCS_CONSOLE) { 00780 hThread = (HANDLE)dwThread; 00781 dwRealTimeout = 0; 00782 goto SetupWaitLoop; 00783 } else { 00784 pcsrt = (PCSR_THREAD)dwThread; 00785 hThread = pcsrt->ThreadHandle; 00786 hwnd = (HWND)lParam; 00787 } 00788 00789 /* 00790 * If no window was provided, 00791 * find a top-level window owned by the thread 00792 */ 00793 if (hwnd == NULL) { 00794 EnumThreadWindows(HandleToUlong(pcsrt->ClientId.UniqueThread), 00795 &FindWindowFromThread, (LPARAM)&hwnd); 00796 } 00797 if (hwnd == NULL) { 00798 return TSN_NOWINDOW; 00799 } 00800 /* 00801 * Find the root owner (we'll guess this is the "main" window) 00802 */ 00803 while ((hwndOwner = GetWindow(hwnd, GW_OWNER)) != NULL) { 00804 hwnd = hwndOwner; 00805 } 00806 00807 #if defined(FE_IME) 00808 /* 00809 * If this is a console window, then just returns TSN_APPSAYSOK. 00810 * In this routine: 00811 * Normally windows NT environment, hwnd never point to console window. 00812 * However, In ConIme process, its owner window point to console window. 00813 */ 00814 if (!(dwClientFlags & WMCS_ENDTASK)) { 00815 if ((HANDLE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE) == ghModuleWin) { 00816 return TSN_APPSAYSOK; 00817 } 00818 } 00819 #endif 00820 00821 /* 00822 * If this is an EndTask request but the window is disabled, 00823 * then we want to bring the dialog up right way (the app 00824 * is probably waiting for input). 00825 * Otherwise, we bring the window to the foreground, send/post 00826 * the request and wait 00827 */ 00828 00829 00830 /* 00831 * Bug 296188 - joejo 00832 * 00833 * Make sure we respond to the user ASAP when they 00834 * attempt to shutdown an application that we know is hung. 00835 */ 00836 00837 if ((dwClientFlags & WMCS_ENDTASK)) { 00838 00839 dwTimeout = gCmsHungAppTimeout; 00840 NtUserQueryInformationThread(pcsrt->ThreadHandle, UserThreadHungStatus, &dwTimeout, sizeof(dwTimeout), NULL); 00841 00842 if (!IsWindowEnabled(hwnd) || dwTimeout){ 00843 dwRealTimeout = 0; 00844 fEndTaskNow = TRUE; 00845 } 00846 00847 00848 } 00849 00850 if (!fEndTaskNow) { 00851 00852 SetForegroundWindow(hwnd); 00853 dwRealTimeout = gCmsHungAppTimeout; 00854 if (dwClientFlags & WMCS_ENDTASK) { 00855 PostMessage(hwnd, WM_CLOSE, 0, 0); 00856 } else { 00857 /* 00858 * If the shutdown was canceled, we don't need to wait. 00859 * (we're just sending the WM_ENDSESSION(FALSE)) 00860 */ 00861 if (!(dwClientFlags & (WMCS_QUERYEND | WMCS_EXIT))) { 00862 SendNotifyMessage(hwnd, WM_CLIENTSHUTDOWN, dwClientFlags, 0); 00863 return TSN_APPSAYSOK; 00864 } 00865 /* 00866 * Allocate callback data. If out of memory, kill it. 00867 */ 00868 pwmcsd = (PWMCSDATA)LocalAlloc(LPTR, sizeof(WMCSDATA)); 00869 if (pwmcsd == NULL) { 00870 return TSN_USERSAYSKILL; 00871 } 00872 00873 SendMessageCallback(hwnd, WM_CLIENTSHUTDOWN, dwClientFlags, 0, 00874 WMCSCallback, (ULONG_PTR)pwmcsd); 00875 } 00876 } 00877 00878 SetupWaitLoop: 00879 /* 00880 * This tells us if the hwndDlg is valid. This is set/cleared by 00881 * EndTaskDlgProc 00882 */ 00883 ZeroMemory(&edp, sizeof(edp)); 00884 edp.dwFlags = EDPF_NODLG; 00885 /* 00886 * Loop until the hwnd replies, the request is canceled 00887 * or the thread goes away. It time out, bring up the 00888 * dialog and wait until the user tells us what to do. 00889 */ 00890 *(ahandles + ESMH_CANCELEVENT) = gheventCancel; 00891 *(ahandles + ESMH_THREAD) = hThread; 00892 dwStartTiming = GetTickCount(); 00893 dwCmd = 0; 00894 while (dwCmd == 0) { 00895 /* 00896 * Calculate how long we have to wait. 00897 */ 00898 dwTimeout = dwRealTimeout; 00899 if ((dwTimeout != 0) && (dwTimeout != INFINITE)) { 00900 dwTimeout -= (GetTickCount() - dwStartTiming); 00901 if ((int)dwTimeout < 0) { 00902 dwTimeout = 0; 00903 } 00904 } 00905 00906 dwRet = MsgWaitForMultipleObjects(ESMH_HANDLECOUNT, ahandles, FALSE, dwTimeout, QS_ALLINPUT); 00907 00908 switch (dwRet) { 00909 case WAIT_OBJECT_0 + ESMH_CANCELEVENT: 00910 /* 00911 * The request has been canceled. 00912 */ 00913 dwCmd = TSN_USERSAYSCANCEL; 00914 break; 00915 00916 case WAIT_OBJECT_0 + ESMH_THREAD: 00917 /* 00918 * The thread is gone. 00919 */ 00920 dwCmd = TSN_APPSAYSOK; 00921 break; 00922 00923 case WAIT_OBJECT_0 + ESMH_HANDLECOUNT: 00924 /* 00925 * We got some input; process it. 00926 */ 00927 while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { 00928 if ((edp.dwFlags & EDPF_NODLG) 00929 || !IsDialogMessage(hwndDlg, &msg)) { 00930 00931 TranslateMessage(&msg); 00932 DispatchMessage(&msg); 00933 } 00934 } 00935 /* 00936 * If we got a reply to the message, act on it 00937 */ 00938 if ((pwmcsd != NULL) && (pwmcsd->dwFlags & WMCSD_REPLY)) { 00939 00940 switch (pwmcsd->dwRet) { 00941 default: 00942 /* 00943 * If the message was not processed (the thread 00944 * exited) or someone processed it and returned 00945 * a bogus value, just shut them down. 00946 * Fall through 00947 */ 00948 case WMCSR_ALLOWSHUTDOWN: 00949 /* 00950 * We're going to nuke this app, so get rid of 00951 * any pending harderror boxes he might have 00952 */ 00953 BoostHardError((ULONG_PTR)pcsrt->ClientId.UniqueProcess, BHE_FORCE); 00954 /* 00955 * Fall through. 00956 */ 00957 case WMCSR_DONE: 00958 dwCmd = TSN_APPSAYSOK; 00959 break; 00960 00961 case WMCSR_CANCEL: 00962 dwCmd = TSN_APPSAYSNOTOK; 00963 break; 00964 } 00965 } 00966 /* 00967 * Else if the dialog is still up, keep waiting for the user 00968 * to tell us what to do 00969 */ 00970 else if (!(edp.dwFlags & EDPF_NODLG)) { 00971 break; 00972 } 00973 /* 00974 * Else if the user dismissed the dialog, act on his response 00975 */ 00976 else if (edp.dwFlags & EDPF_RESPONSE) { 00977 switch(edp.dwRet) { 00978 case IDC_ENDNOW: 00979 /* 00980 * The user wants us to kill it 00981 */ 00982 dwCmd = TSN_USERSAYSKILL; 00983 break; 00984 00985 /* case IDCANCEL: */ 00986 default: 00987 dwCmd = TSN_USERSAYSCANCEL; 00988 break; 00989 } 00990 } 00991 break; 00992 00993 case WAIT_TIMEOUT: 00994 00995 if (dwClientFlags & WMCS_NORETRY) { 00996 00997 /* 00998 * We come here only for Terminal Server case. We return 00999 * TSN_APPSAYSOK as Terminal Server 4 did in this case. 01000 */ 01001 UserAssert(ISTS()); 01002 01003 dwCmd = TSN_APPSAYSOK; 01004 break; 01005 } 01006 01007 01008 /* 01009 * Once we time out, we bring up the dialog and let 01010 * its timer take over. 01011 */ 01012 dwRealTimeout = INFINITE; 01013 /* 01014 * Check if the windows app is waiting for input; 01015 * if not, we assume it is hung for EndTask; 01016 * otherwise we enter a wait mode that brings the 01017 * dialog up just to provide some (waiting) feedback 01018 * Console just gets the dialog right away 01019 */ 01020 if (!(dwClientFlags & WMCS_CONSOLE)) { 01021 if (BoostHardError((ULONG_PTR)pcsrt->ClientId.UniqueProcess, BHE_TEST) 01022 || (GetInputWindow(pcsrt, hwnd) != NULL)) { 01023 01024 edp.dwFlags |= EDPF_INPUT; 01025 } else { 01026 /* 01027 * EWX_FORCEIFHUNG support. 01028 * Also, if this is an ExitWindows call and the process is not in 01029 * the context being logged off, we won't kill it. 01030 * So don't bother asking the user what to do 01031 */ 01032 if ((dwClientFlags & WMCS_NODLGIFHUNG) 01033 || (!(dwClientFlags & WMCS_ENDTASK) 01034 && !(dwClientFlags & WMCS_CONTEXTLOGOFF))) { 01035 01036 dwCmd = TSN_USERSAYSKILL; 01037 break; 01038 } 01039 /* 01040 * Hung or Wait? 01041 */ 01042 if (dwClientFlags & WMCS_ENDTASK) { 01043 edp.dwFlags |= EDPF_HUNG; 01044 } else { 01045 edp.dwFlags |= EDPF_WAIT; 01046 } 01047 } 01048 } 01049 01050 /* 01051 * If the registry says no dialog, then tell the caller 01052 * the user wants to kill the app. 01053 */ 01054 if (gfAutoEndTask) { 01055 dwCmd = TSN_USERSAYSKILL; 01056 break; 01057 } 01058 /* 01059 * Setup the parameters needed by EndTaskDlgProc 01060 */ 01061 edp.dwRet = 0; 01062 edp.dwClientFlags = dwClientFlags; 01063 if (dwClientFlags & WMCS_CONSOLE) { 01064 edp.pcsrt = NULL; 01065 edp.lParam = lParam; 01066 } else { 01067 edp.pcsrt = pcsrt; 01068 edp.lParam = (LPARAM)hwnd; 01069 } 01070 01071 hwndDlg = CreateDialogParam (ghModuleWin, MAKEINTRESOURCE(IDD_ENDTASK), 01072 NULL, EndTaskDlgProc, (LPARAM)(&edp)); 01073 /* 01074 * If we cannot ask the user, then kill the app. 01075 */ 01076 if (hwndDlg == NULL) { 01077 edp.dwFlags |= EDPF_NODLG; 01078 dwCmd = TSN_USERSAYSKILL; 01079 break; 01080 } 01081 break; 01082 01083 default: 01084 /* 01085 * Unexpected return; something is wrong. Kill the app. 01086 */ 01087 UserAssert(dwRet != dwRet); 01088 dwCmd = TSN_USERSAYSKILL; 01089 break; 01090 } /* switch (dwRet) */ 01091 } /* while (dwCmd == 0) */ 01092 01093 01094 /* 01095 * If the dialog is up, nuke it. 01096 */ 01097 if (!(edp.dwFlags & EDPF_NODLG)) { 01098 DestroyWindow(hwndDlg); 01099 } 01100 /* 01101 * Make sure pwmcsd is freed or marked to be freed by WMCSCallback 01102 * when the reply comes 01103 */ 01104 if (pwmcsd != NULL) { 01105 if (pwmcsd->dwFlags & WMCSD_REPLY) { 01106 LocalFree(pwmcsd); 01107 } else { 01108 pwmcsd->dwFlags |= WMCSD_IGNORE; 01109 } 01110 } 01111 #if DBG 01112 /* 01113 * If Canceling, let's the name the app that doesn't let us log off 01114 */ 01115 if ((dwClientFlags & WMCS_EXIT) && (dwCmd == TSN_APPSAYSNOTOK)) { 01116 WCHAR achTitle[CCHBODYMAX]; 01117 WCHAR *pwcText; 01118 UserAssert(!(dwClientFlags & WMCS_CONSOLE)); 01119 pwcText = achTitle; 01120 *(achTitle + CCHBODYMAX - 1) = (WCHAR)0; 01121 GetApplicationText(hwnd, hThread, pwcText, CCHBODYMAX - 1); 01122 KdPrint(("Log off canceled by pid:%#lx tid:%#lx - '%ws'.\n", 01123 HandleToUlong(pcsrt->ClientId.UniqueProcess), 01124 HandleToUlong(pcsrt->ClientId.UniqueThread), 01125 pwcText)); 01126 } 01127 #endif 01128 /* 01129 * If we're killing this dude, clean any hard errors. 01130 * Also if wow takes care of it, then our caller doesn't need to 01131 */ 01132 if ((dwCmd == TSN_USERSAYSKILL) && !(dwClientFlags & WMCS_CONSOLE)) { 01133 01134 BoostHardError((ULONG_PTR)pcsrt->ClientId.UniqueProcess, BHE_FORCE); 01135 01136 if (!(pcsrt->Flags & CSR_THREAD_DESTROYED) && WowExitTask(pcsrt)) { 01137 dwCmd = TSN_APPSAYSOK; 01138 } 01139 } 01140 01141 return dwCmd; 01142 }


Variable Documentation

DWORD gCmsHungAppTimeout
 

Definition at line 127 of file usersrv.h.

Referenced by CreateCtrlThread(), GetInputWindow(), GetTimeouts(), SetEndTaskDlgStatus(), and ThreadShutdownNotify().

DWORD gCmsWaitToKillTimeout
 

Definition at line 128 of file usersrv.h.

Referenced by CreateCtrlThread(), and GetTimeouts().

DWORD gdwHungToKillCount
 

Definition at line 129 of file usersrv.h.

Referenced by EndTaskDlgProc(), GetTimeouts(), and SetEndTaskDlgStatus().

DWORD gdwProcessTerminateTimeout
 

Definition at line 132 of file usersrv.h.

Referenced by GetTimeouts(), and UserClientShutdown().

DWORD gdwServicesProcessId
 

Definition at line 130 of file usersrv.h.

Referenced by CreateCtrlThread(), and SrvRegisterServicesProcess().

DWORD gdwServicesWaitToKillTimeout
 

Definition at line 131 of file usersrv.h.

Referenced by CreateCtrlThread(), and GetTimeouts().

HANDLE ghModuleWin
 

Definition at line 126 of file usersrv.h.

Referenced by _EndTask(), EndTaskDlgProc(), GetHardErrorText(), GetRegIntFromID(), InitWindowClass(), SetEndTaskDlgStatus(), ThreadShutdownNotify(), and UserServerDllInitialization().


Generated on Sat May 15 19:46:05 2004 for test by doxygen 1.3.7