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

logon.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

BOOL _RegisterLogonProcess (DWORD dwProcessId, BOOL fSecure)
UINT _LockWindowStation (PWINDOWSTATION pwinsta)
BOOL _UnlockWindowStation (PWINDOWSTATION pwinsta)
BOOL _SetLogonNotifyWindow (PWND pwnd)


Function Documentation

UINT _LockWindowStation PWINDOWSTATION  pwinsta  ) 
 

Definition at line 57 of file logon.c.

References BOOL, tagWINDOWSTATION::dwWSF_Flags, FALSE, GetCurrentProcessId, gpidLogon, grpdeskLogon, NULL, OBJECT_TO_OBJECT_HEADER, tagWINDOWSTATION::rpdeskList, tagDESKTOP::rpdeskNext, TRUE, UINT, WSF_OPENLOCK, WSF_SHUTDOWN, and WSF_SWITCHLOCK.

Referenced by NtUserLockWindowStation().

00059 { 00060 PDESKTOP pdesk; 00061 BOOL fBusy = FALSE; 00062 00063 /* 00064 * Make sure the caller is the logon process 00065 */ 00066 if (GetCurrentProcessId() != gpidLogon) { 00067 RIPERR0(ERROR_ACCESS_DENIED, 00068 RIP_WARNING, 00069 "Access denied in _LockWindowStation"); 00070 00071 return WSS_ERROR; 00072 } 00073 00074 /* 00075 * Prevent desktop switches 00076 */ 00077 pwinsta->dwWSF_Flags |= WSF_SWITCHLOCK; 00078 00079 /* 00080 * Determine whether the station is busy 00081 */ 00082 pdesk = pwinsta->rpdeskList; 00083 while (pdesk != NULL) { 00084 if (pdesk != grpdeskLogon && 00085 OBJECT_TO_OBJECT_HEADER(pdesk)->HandleCount != 0) { 00086 00087 /* 00088 * This desktop is open, thus the station is busy 00089 */ 00090 fBusy = TRUE; 00091 break; 00092 } 00093 pdesk = pdesk->rpdeskNext; 00094 } 00095 00096 if (pwinsta->dwWSF_Flags & WSF_SHUTDOWN) 00097 pwinsta->dwWSF_Flags |= WSF_OPENLOCK; 00098 00099 /* 00100 * Unlock opens if the station is busy and is not in the middle 00101 * of shutting down. 00102 */ 00103 if (fBusy) 00104 return WSS_BUSY; 00105 else 00106 return WSS_IDLE; 00107 }

BOOL _RegisterLogonProcess DWORD  dwProcessId,
BOOL  fSecure
 

Definition at line 25 of file logon.c.

References BOOL, FALSE, gpidLogon, IsPrivileged(), psTcb, and TRUE.

00028 { 00029 UNREFERENCED_PARAMETER(fSecure); 00030 00031 /* 00032 * Allow only one logon process and then only if it has TCB 00033 * privilege. 00034 */ 00035 if (gpidLogon != 0 || !IsPrivileged(&psTcb)) { 00036 RIPERR0(ERROR_ACCESS_DENIED, 00037 RIP_WARNING, 00038 "Access denied in _RegisterLogonProcess"); 00039 00040 return FALSE; 00041 } 00042 00043 gpidLogon = (HANDLE)LongToHandle( dwProcessId ); 00044 return TRUE; 00045 }

BOOL _SetLogonNotifyWindow PWND  pwnd  ) 
 

Definition at line 153 of file logon.c.

References BOOL, FALSE, GetCurrentProcessId, gpidLogon, gspwndLogonNotify, Lock, and TRUE.

Referenced by NtUserSetLogonNotifyWindow().

00155 { 00156 /* 00157 * Make sure the caller is the logon process 00158 */ 00159 if (GetCurrentProcessId() != gpidLogon) { 00160 RIPERR0(ERROR_ACCESS_DENIED, 00161 RIP_WARNING, 00162 "Access denied in _SetLogonNotifyWindow"); 00163 00164 return FALSE; 00165 } 00166 00167 Lock(&gspwndLogonNotify, pwnd); 00168 00169 return TRUE; 00170 }

BOOL _UnlockWindowStation PWINDOWSTATION  pwinsta  ) 
 

Definition at line 119 of file logon.c.

References BOOL, tagWINDOWSTATION::dwWSF_Flags, FALSE, GetCurrentProcessId, gpidLogon, TRUE, WSF_OPENLOCK, WSF_SHUTDOWN, and WSF_SWITCHLOCK.

Referenced by NtUserUnlockWindowStation().

00121 { 00122 00123 /* 00124 * Make sure the caller is the logon process 00125 */ 00126 if (GetCurrentProcessId() != gpidLogon) { 00127 RIPERR0(ERROR_ACCESS_DENIED, 00128 RIP_WARNING, 00129 "Access denied in _UnlockWindowStation"); 00130 00131 return FALSE; 00132 } 00133 00134 /* 00135 * If shutdown is occuring, only remove the switch lock. 00136 */ 00137 if (pwinsta->dwWSF_Flags & WSF_SHUTDOWN) 00138 pwinsta->dwWSF_Flags &= ~WSF_SWITCHLOCK; 00139 else 00140 pwinsta->dwWSF_Flags &= ~(WSF_OPENLOCK | WSF_SWITCHLOCK); 00141 return TRUE; 00142 }


Generated on Sat May 15 19:44:33 2004 for test by doxygen 1.3.7