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

server.c File Reference

#include "precomp.h"

Go to the source code of this file.

Defines

#define USRINIT_SHAREDSECT_SIZE   32
#define USRINIT_ATOMBUCKET_SIZE   37
#define USRINIT_WINDOWSECT_SIZE   512
#define USRINIT_NOIOSECT_SIZE   128
#define USRINIT_SHAREDSECT_BUFF_SIZE   640
#define USRINIT_SHAREDSECT_READ_SIZE   (USRINIT_SHAREDSECT_BUFF_SIZE-33)
#define WRAPPFN(pfn, type)
#define INITMSGTABLE(member, procname)
#define InitGlobalRIPFlags()
#define PAGE_SIZE   0x1000
#define ROUND_UP_TO_PAGES(SIZE)   (((ULONG)(SIZE) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
#define CALC_DELTA(element)

Functions

NTSTATUS InitQEntryLookaside (VOID)
NTSTATUS InitSMSLookaside (VOID)
NTSTATUS InitCreateSharedSection (VOID)
NTSTATUS InitCreateObjectDirectory (VOID)
BOOL InitCreateUserSubsystem (VOID)
VOID InitFunctionTables (VOID)
VOID InitMessageTables (VOID)
VOID InitWindowMsgTable (PBYTE *, PUINT, CONST WORD *)
VOID VerifySyncOnlyMessages (VOID)
BOOL InitOLEFormats (VOID)
NTSTATUS Win32UserInitialize (VOID)
 WRAPPFN (DesktopWndProc, PWND)
LRESULT xxxWrapSendMessage (PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, ULONG_PTR xParam)
LRESULT xxxWrapSendMessageBSM (PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, ULONG_PTR xParam)
LRESULT xxxUnusedFunctionId (PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, ULONG_PTR xParam)
LRESULT xxxWrapCallWindowProc (PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, ULONG_PTR xParam)
BOOL _GetTextMetricsW (HDC hdc, LPTEXTMETRICW ptm)
BOOL _TextOutW (HDC hdc, int x, int y, LPCWSTR lp, UINT cc)
BOOL InitCreateUserCrit (VOID)
BOOL InitCreateUserSubsystem ()
BOOL CreateSetupNameArray ()
NTSTATUS InitMapSharedSection (PEPROCESS Process, PUSERCONNECT pUserConnect)
VOID InitLoadResources ()
int GetCharDimensions (HDC hdc, TEXTMETRIC *lptm, LPINT lpcy)
PMDEV InitVideo (BOOL bReenumerationNeeded)
void DrvDriverFailure (void)
NTSTATUS UserInitialize (VOID)
BOOL IsDBCSEnabledSystem ()
BOOL IsIMMEnabledSystem ()
BOOL IsMidEastEnabledSystem ()
BOOL SetupClassAtoms (VOID)
HDC UserGetDesktopDC (ULONG type, BOOL bAltType, BOOL bValidate)
NTSTATUS UserThreadCallout (IN PETHREAD pEThread, IN PSW32THREADCALLOUTTYPE CalloutType)
BOOL TellGdiToGetReady ()
NTSTATUS NtUserInitialize (IN DWORD dwVersion, IN HANDLE hPowerRequestEvent, IN HANDLE hMediaRequestEvent)
NTSTATUS NtUserProcessConnect (IN HANDLE hProcess, IN OUT PVOID pConnectInfo, IN ULONG cbConnectInfo)
NTSTATUS xxxUserProcessCallout (IN PW32PROCESS Process, IN BOOLEAN Initialize)
HDEV UserGetHDEV (VOID)
PVOID UserGlobalAtomTableCallout (VOID)

Variables

WORD gDispatchTableValues
BOOL gbUserInitialized
CONST WCHAR szCHECKPOINT_PROP_NAME [] = L"SysCP"
CONST WCHAR szDDETRACK_PROP_NAME [] = L"SysDT"
CONST WCHAR szQOS_PROP_NAME [] = L"SysQOS"
CONST WCHAR szDDEIMP_PROP_NAME [] = L"SysDDEI"
CONST WCHAR szWNDOBJ_PROP_NAME [] = L"SysWNDO"
CONST WCHAR szIMELEVEL_PROP_NAME [] = L"SysIMEL"
CONST WCHAR szLAYER_PROP_NAME [] = L"SysLayer"
CONST WCHAR szUSER32 [] = L"USER32"
CONST WCHAR szMESSAGE [] = L"Message"
CONST WCHAR szCONTEXTHELPIDPROP [] = L"SysCH"
CONST WCHAR szICONSM_PROP_NAME [] = L"SysICS"
CONST WCHAR szICON_PROP_NAME [] = ICON_PROP_NAME
CONST WCHAR szSHELLHOOK [] = L"SHELLHOOK"
CONST WCHAR szACTIVATESHELLWINDOW [] = L"ACTIVATESHELLWINDOW"
CONST WCHAR szOTHERWINDOWCREATED [] = L"OTHERWINDOWCREATED"
CONST WCHAR szOTHERWINDOWDESTROYED [] = L"OTHERWINDOWDESTROYED"
CONST WCHAR szOLEMAINTHREADWNDCLASS [] = L"OleMainThreadWndClass"
CONST WCHAR szFLASHWSTATE [] = L"FlashWState"
CONST WORD gawDefDlgProc []
CONST WORD gawMenuWndProc []
CONST WORD gawDesktopWndProc []
CONST WORD gawScrollBarWndProc []
CONST WORD gawStaticWndProc []
CONST WORD gawButtonWndProc []
CONST WORD gawListboxWndProc []
CONST WORD gawComboWndProc []
CONST WORD gawEditWndProc []
CONST WORD gawImeWndProc []
CONST WORD gawDefWindowMsgs []
CONST WORD gawDefWindowSpecMsgs []
CONST LPCWSTR lpszOLEFormats []
CONST LPCWSTR lpszControls []
UNICODE_STRING * gpastrSetupExe
int giSetupExe
WCHAR * glpSetupPrograms


Define Documentation

#define CALC_DELTA element   ) 
 

Value:

(PVOID)((PBYTE)pClientBase + \ ((PBYTE)gSharedInfo.element - \ (PBYTE)gpvSharedBase))

Definition at line 1640 of file kernel/server.c.

Referenced by InitMapSharedSection().

 
#define InitGlobalRIPFlags  ) 
 

Definition at line 1172 of file kernel/server.c.

Referenced by UserInitialize().

#define INITMSGTABLE member,
procname   ) 
 

Value:

InitWindowMsgTable(&(gSharedInfo.member.abMsgs), \ &(gSharedInfo.member.maxMsgs), \ gaw ## procname);

Referenced by InitMessageTables().

#define PAGE_SIZE   0x1000
 

Definition at line 1214 of file kernel/server.c.

#define ROUND_UP_TO_PAGES SIZE   )     (((ULONG)(SIZE) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
 

Definition at line 1217 of file kernel/server.c.

#define USRINIT_ATOMBUCKET_SIZE   37
 

Definition at line 52 of file kernel/server.c.

Referenced by Win32UserInitialize().

#define USRINIT_NOIOSECT_SIZE   128
 

Definition at line 55 of file kernel/server.c.

Referenced by InitCreateUserSubsystem().

#define USRINIT_SHAREDSECT_BUFF_SIZE   640
 

Definition at line 57 of file kernel/server.c.

Referenced by InitCreateUserSubsystem().

#define USRINIT_SHAREDSECT_READ_SIZE   (USRINIT_SHAREDSECT_BUFF_SIZE-33)
 

Definition at line 58 of file kernel/server.c.

Referenced by InitCreateUserSubsystem().

#define USRINIT_SHAREDSECT_SIZE   32
 

Definition at line 51 of file kernel/server.c.

Referenced by InitCreateSharedSection().

#define USRINIT_WINDOWSECT_SIZE   512
 

Definition at line 54 of file kernel/server.c.

Referenced by InitCreateUserSubsystem().

#define WRAPPFN pfn,
type   ) 
 

Value:

LRESULT xxxWrap ## pfn( \ PWND pwnd, \ UINT message, \ WPARAM wParam, \ LPARAM lParam, \ ULONG_PTR xParam) \ { \ DBG_UNREFERENCED_PARAMETER(xParam); \ \ return xxx ## pfn((type)pwnd, message, wParam, lParam); \ }

Definition at line 745 of file kernel/server.c.


Function Documentation

BOOL _GetTextMetricsW HDC  hdc,
LPTEXTMETRICW  ptm
 

Definition at line 1187 of file kernel/server.c.

References BOOL, and fret().

Referenced by GetCharDimensions(), xxxDrawCaptionTemp(), and xxxPSMTextOut().

01190 { 01191 TMW_INTERNAL tmi; 01192 BOOL fret; 01193 01194 fret = GreGetTextMetricsW(hdc, &tmi); 01195 01196 *ptm = tmi.tmw; 01197 01198 return fret; 01199 }

BOOL _TextOutW HDC  hdc,
int  x,
int  y,
LPCWSTR  lp,
UINT  cc
 

Definition at line 1201 of file kernel/server.c.

References BOOL, and NULL.

Referenced by xxxPSMTextOut().

01207 { 01208 return GreExtTextOutW(hdc, x, y, 0, NULL, (LPWSTR)lp, cc, NULL); 01209 }

BOOL CreateSetupNameArray  ) 
 

Definition at line 1559 of file kernel/server.c.

References BOOL, DWORD, FALSE, FastGetProfileValue(), giSetupExe, glpSetupPrograms, gpastrSetupExe, L, NULL, PBYTE, PMAP_SETUPPROGRAMNAMES, and TRUE.

Referenced by Win32UserInitialize().

01559 { 01560 DWORD dwProgNames; 01561 int iSetupProgramCount = 0; 01562 WCHAR* lpTemp; 01563 int ic, icnt, icMax; 01564 01565 dwProgNames = FastGetProfileValue(NULL, PMAP_SETUPPROGRAMNAMES, 01566 L"SetupProgramNames",NULL,NULL, 0); 01567 01568 /* 01569 * This key is a multi-string, so is best to read as a value. 01570 * First, get the length and create the buffer to hold all of 01571 * the strings. 01572 */ 01573 if (dwProgNames == 0) { 01574 return FALSE; 01575 } 01576 01577 glpSetupPrograms = UserAllocPoolWithQuota(dwProgNames, 01578 TAG_SYSTEM); 01579 01580 if (glpSetupPrograms == NULL) { 01581 RIPMSG0(RIP_WARNING, "CreateSetupNameArray: Memory allocation failure"); 01582 return FALSE; 01583 } 01584 01585 FastGetProfileValue(NULL, 01586 PMAP_SETUPPROGRAMNAMES, 01587 L"SetupProgramNames", 01588 NULL, 01589 (PBYTE)glpSetupPrograms, 01590 dwProgNames); 01591 01592 lpTemp = glpSetupPrograms; 01593 icMax = dwProgNames/2; 01594 ic = 0; icnt=0; 01595 /* 01596 * Now count the strings. 01597 */ 01598 while (ic < icMax) { 01599 if (*(lpTemp+ic) == 0) { 01600 ic++; 01601 continue; 01602 } 01603 ic += wcslen(lpTemp+ic)+1; 01604 icnt++; 01605 } 01606 01607 /* 01608 * gpastrSetupExe is a pointer to an array of UNICODE_STRING structures. 01609 * Each structure is the name of one setup program. 01610 */ 01611 giSetupExe = icnt; 01612 gpastrSetupExe = UserAllocPoolWithQuota(giSetupExe * sizeof(UNICODE_STRING), 01613 TAG_SYSTEM); 01614 01615 if (gpastrSetupExe == NULL) { 01616 RIPMSG0(RIP_WARNING, "CreateSetupNameArray: Memory allocation failure"); 01617 giSetupExe = 0; 01618 UserFreePool(glpSetupPrograms); 01619 glpSetupPrograms = NULL; 01620 return FALSE; 01621 } 01622 01623 ic = 0; icnt=0; 01624 while (ic < icMax) { 01625 if (*(lpTemp+ic) == 0) { 01626 ic++; 01627 continue; 01628 } 01629 gpastrSetupExe[icnt].Buffer = lpTemp+ic; 01630 gpastrSetupExe[icnt].Length = sizeof(WCHAR)*wcslen(lpTemp+ic); 01631 gpastrSetupExe[icnt].MaximumLength = gpastrSetupExe[icnt].Length + sizeof(WCHAR); 01632 ic += wcslen(lpTemp+ic)+1; 01633 icnt++; 01634 01635 } 01636 01637 return TRUE; 01638 }

void DrvDriverFailure void   ) 
 

Definition at line 1985 of file kernel/server.c.

References KeBugCheckEx(), and USERCURRENTVERSION.

Referenced by UserInitialize().

01986 { 01987 KeBugCheckEx(VIDEO_DRIVER_INIT_FAILURE, 01988 0, 01989 0, 01990 0, 01991 USERCURRENTVERSION); 01992 }

int GetCharDimensions HDC  hdc,
TEXTMETRIC *  lptm,
LPINT  lpcy
 

Definition at line 1829 of file kernel/server.c.

References _GetTextMetricsW(), gpsi, L, and NULL.

Referenced by UpdateUserScreen(), xxxDrawMenuBarTemp(), and xxxSetNCFonts().

01834 { 01835 TEXTMETRIC tm; 01836 01837 /* 01838 * Didn't find it in cache, store the font metrics info. 01839 */ 01840 if (!_GetTextMetricsW(hdc, &tm)) { 01841 RIPMSG1(RIP_WARNING, "GetCharDimensions: _GetTextMetricsW failed. hdc %#lx", hdc); 01842 tm = gpsi->tmSysFont; // damage control 01843 01844 if (tm.tmAveCharWidth == 0) { 01845 RIPMSG0(RIP_WARNING, "GetCharDimensions: _GetTextMetricsW first time failure"); 01846 tm.tmAveCharWidth = 8; 01847 } 01848 } 01849 if (lptm != NULL) 01850 *lptm = tm; 01851 if (lpcy != NULL) 01852 *lpcy = tm.tmHeight; 01853 01854 /* 01855 * If variable_width font 01856 */ 01857 if (tm.tmPitchAndFamily & TMPF_FIXED_PITCH) { 01858 SIZE size; 01859 static CONST WCHAR wszAvgChars[] = 01860 L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 01861 01862 /* 01863 * Change from tmAveCharWidth. We will calculate a true average 01864 * as opposed to the one returned by tmAveCharWidth. This works 01865 * better when dealing with proportional spaced fonts. 01866 */ 01867 if (GreGetTextExtentW( 01868 hdc, (LPWSTR)wszAvgChars, 01869 (sizeof(wszAvgChars) / sizeof(WCHAR)) - 1, 01870 &size, GGTE_WIN3_EXTENT)) { 01871 01872 UserAssert((((size.cx / 26) + 1) / 2) > 0); 01873 return ((size.cx / 26) + 1) / 2; // round up 01874 } else { 01875 RIPMSG1(RIP_WARNING, "GetCharDimensions: GreGetTextExtentW failed. hdc %#lx", hdc); 01876 } 01877 } 01878 01879 UserAssert(tm.tmAveCharWidth > 0); 01880 01881 return tm.tmAveCharWidth; 01882 }

NTSTATUS InitCreateObjectDirectory VOID   ) 
 

Definition at line 1417 of file kernel/server.c.

References gbRemoteSession, gpsdInitWinSta, NTSTATUS(), NULL, ObjectAttributes, RtlInitUnicodeString(), Status, szWindowStationDirectory, and TRACE_INIT.

Referenced by UserInitialize().

01418 { 01419 HANDLE hDir; 01420 NTSTATUS Status; 01421 OBJECT_ATTRIBUTES ObjectAttributes; 01422 UNICODE_STRING UnicodeString; 01423 ULONG attributes = OBJ_CASE_INSENSITIVE | OBJ_PERMANENT; 01424 01425 TRACE_INIT(("UserInit: Create User Object-Directory\n")); 01426 01427 RtlInitUnicodeString(&UnicodeString, szWindowStationDirectory); 01428 01429 if (gbRemoteSession) { 01430 /* 01431 * Remote sessions don't use this flag 01432 */ 01433 attributes &= ~OBJ_PERMANENT; 01434 } 01435 01436 InitializeObjectAttributes(&ObjectAttributes, 01437 &UnicodeString, 01438 attributes, 01439 NULL, 01440 gpsdInitWinSta); 01441 01442 Status = ZwCreateDirectoryObject(&hDir, 01443 DIRECTORY_CREATE_OBJECT, 01444 &ObjectAttributes); 01445 01446 UserFreePool(gpsdInitWinSta); 01447 01448 /* 01449 * Do not close this handle for remote session because 01450 * if we do close it then the directory will go away and 01451 * we don't want that to happen. When CSRSS will go away 01452 * this handle will be freed also. 01453 */ 01454 if (!gbRemoteSession) 01455 ZwClose(hDir); 01456 01457 gpsdInitWinSta = NULL; 01458 01459 return Status; 01460 }

NTSTATUS InitCreateSharedSection VOID   ) 
 

Definition at line 1229 of file kernel/server.c.

References ghSectionShared, gpvSharedAlloc, gpvSharedBase, HANDLEENTRY, NT_SUCCESS, NTSTATUS(), NULL, PBYTE, ROUND_UP_TO_PAGES, Status, TRACE_INIT, UserCommitSharedMemory(), UserCreateHeap(), and USRINIT_SHAREDSECT_SIZE.

Referenced by Win32UserInitialize().

01230 { 01231 ULONG ulHeapSize; 01232 ULONG ulHandleTableSize; 01233 NTSTATUS Status; 01234 LARGE_INTEGER SectionSize; 01235 SIZE_T ViewSize; 01236 PVOID pHeapBase; 01237 01238 TRACE_INIT(("UserInit: Create Shared Memory Section\n")); 01239 01240 UserAssert(ghSectionShared == NULL); 01241 01242 ulHeapSize = ROUND_UP_TO_PAGES(USRINIT_SHAREDSECT_SIZE * 1024); 01243 ulHandleTableSize = ROUND_UP_TO_PAGES(0x10000 * sizeof(HANDLEENTRY)); 01244 01245 TRACE_INIT(("UserInit: Share: TableSize = %X; HeapSize = %X\n", 01246 ulHandleTableSize, ulHeapSize)); 01247 01248 SectionSize.LowPart = ulHeapSize + ulHandleTableSize; 01249 SectionSize.HighPart = 0; 01250 01251 Status = Win32CreateSection(&ghSectionShared, 01252 SECTION_ALL_ACCESS, 01253 (POBJECT_ATTRIBUTES)NULL, 01254 &SectionSize, 01255 PAGE_EXECUTE_READWRITE, 01256 SEC_RESERVE, 01257 (HANDLE)NULL, 01258 NULL, 01259 TAG_SECTION_SHARED); 01260 01261 if (!NT_SUCCESS(Status)) { 01262 RIPMSG1(RIP_WARNING, 01263 "MmCreateSection failed in InitCreateSharedSection with Status %x", 01264 Status); 01265 return Status; 01266 } 01267 01268 ViewSize = 0; 01269 gpvSharedBase = NULL; 01270 01271 Status = Win32MapViewInSessionSpace(ghSectionShared, &gpvSharedBase, &ViewSize); 01272 01273 if (!NT_SUCCESS(Status)) { 01274 RIPMSG1(RIP_WARNING, "Win32MapViewInSessionSpace failed with Status %x", 01275 Status); 01276 Win32DestroySection(ghSectionShared); 01277 ghSectionShared = NULL; 01278 return Status; 01279 } 01280 01281 pHeapBase = ((PBYTE)gpvSharedBase + ulHandleTableSize); 01282 01283 TRACE_INIT(("UserInit: Share: BaseAddr = %X; Heap = %X, ViewSize = %X\n", 01284 gpvSharedBase, pHeapBase, ViewSize)); 01285 01286 /* 01287 * Create shared heap. 01288 */ 01289 if ((gpvSharedAlloc = UserCreateHeap( 01290 ghSectionShared, 01291 ulHandleTableSize, 01292 pHeapBase, 01293 ulHeapSize, 01294 UserCommitSharedMemory)) == NULL) { 01295 01296 RIPERR0(ERROR_NOT_ENOUGH_MEMORY, RIP_WARNING, "Can't create shared memory heap."); 01297 01298 Win32UnmapViewInSessionSpace(gpvSharedBase); 01299 01300 Win32DestroySection(ghSectionShared); 01301 gpvSharedAlloc = NULL; 01302 gpvSharedBase = NULL; 01303 ghSectionShared = NULL; 01304 01305 return STATUS_NO_MEMORY; 01306 } 01307 01308 UserAssert(Win32HeapGetHandle(gpvSharedAlloc) == pHeapBase); 01309 01310 return STATUS_SUCCESS; 01311 }

BOOL InitCreateUserCrit VOID   ) 
 

Definition at line 1322 of file kernel/server.c.

References BOOL, ERESOURCE, ExAllocatePoolWithTag, ExFreePool(), ExInitializeFastMutex, ExInitializeResourceLite(), FALSE, gpHandleFlagsMutex, gpresDeviceInfoList, gpresMouseEventQueue, gpresUser, NonPagedPoolMustSucceed, NT_SUCCESS, NULL, TRACE_INIT, and TRUE.

01323 { 01324 TRACE_INIT(("Win32UserInit: InitCreateUserCrit()\n")); 01325 01326 /* 01327 * Initialize a critical section structure that will be used to protect 01328 * all of the User Server's critical sections (except a few special 01329 * cases like the RIT -- see below). 01330 */ 01331 gpresUser = ExAllocatePoolWithTag(NonPagedPoolMustSucceed, 01332 sizeof(ERESOURCE), 01333 TAG_ERESOURCE); 01334 if (!gpresUser) { 01335 goto InitCreateUserCritExit; 01336 } 01337 if (!NT_SUCCESS(ExInitializeResourceLite(gpresUser))) { 01338 goto InitCreateUserCritExit; 01339 } 01340 01341 /* 01342 * Initialize a critical section to be used in [Un]QueueMouseEvent 01343 * to protect the queue of mouse input events that the desktop thread 01344 * uses to pass input on to the RIT, after having moved the cursor 01345 * without obtaining gpresUser itself. 01346 */ 01347 gpresMouseEventQueue = ExAllocatePoolWithTag(NonPagedPoolMustSucceed, 01348 sizeof(ERESOURCE), 01349 TAG_ERESOURCE); 01350 if (!gpresMouseEventQueue) { 01351 goto InitCreateUserCritExit; 01352 } 01353 if (!NT_SUCCESS(ExInitializeResourceLite(gpresMouseEventQueue))) { 01354 goto InitCreateUserCritExit; 01355 } 01356 01357 /* 01358 * Initialize a critical section to protect the list of DEVICEINFO structs 01359 * kept under gpDeviceInfoList. This is used by the RIT when reading kbd 01360 * input, the desktop thread when reading mouse input, and the PnP callback 01361 * routines DeviceClassNotify() and DeviceNotify() when devices come and go. 01362 */ 01363 gpresDeviceInfoList = ExAllocatePoolWithTag(NonPagedPoolMustSucceed, 01364 sizeof(ERESOURCE), 01365 TAG_ERESOURCE); 01366 if (!gpresDeviceInfoList) { 01367 goto InitCreateUserCritExit; 01368 } 01369 if (!NT_SUCCESS(ExInitializeResourceLite(gpresDeviceInfoList))) { 01370 goto InitCreateUserCritExit; 01371 } 01372 01373 /* 01374 * Create the handle flag mutex. We'll need this once we start creating 01375 * windowstations and desktops. 01376 */ 01377 gpHandleFlagsMutex = ExAllocatePoolWithTag(NonPagedPoolMustSucceed, 01378 sizeof(FAST_MUTEX), 01379 TAG_SYSTEM); 01380 if (gpHandleFlagsMutex == NULL) { 01381 goto InitCreateUserCritExit; 01382 } 01383 ExInitializeFastMutex(gpHandleFlagsMutex); 01384 01385 TRACE_INIT(("Win32UserInit: gpHandleFlagsMutex = 0x%p\n", gpHandleFlagsMutex)); 01386 TRACE_INIT(("Win32UserInit: gpresDeviceInfoList = 0x%X\n", gpresDeviceInfoList)); 01387 TRACE_INIT(("Win32UserInit: gpresMouseEventQueue = 0x%X\n", gpresMouseEventQueue)); 01388 TRACE_INIT(("Win32UserInit: gpresUser = 0x%X\n", gpresUser)); 01389 01390 TRACE_INIT(("Win32UserInit: exit InitCreateUserCrit()\n")); 01391 return TRUE; 01392 01393 InitCreateUserCritExit: 01394 RIPERR0(ERROR_NOT_ENOUGH_MEMORY, RIP_ERROR, 01395 "Win32UserInit: InitCreateUserCrit failed"); 01396 01397 if (gpresUser) { 01398 ExFreePool(gpresUser); 01399 } 01400 if (gpresMouseEventQueue) { 01401 ExFreePool(gpresMouseEventQueue); 01402 } 01403 if (gpresDeviceInfoList) { 01404 ExFreePool(gpresDeviceInfoList); 01405 } 01406 return FALSE; 01407 }

BOOL InitCreateUserSubsystem  ) 
 

Definition at line 1471 of file kernel/server.c.

References FALSE, FastGetProfileStringW(), gdwDesktopSectionSize, gdwNOIOSectionSize, L, max, NULL, PMAP_SUBSYSTEMS, RtlInitUnicodeString(), RtlUnicodeStringToInteger(), TRACE_INIT, TRUE, USRINIT_NOIOSECT_SIZE, USRINIT_SHAREDSECT_BUFF_SIZE, USRINIT_SHAREDSECT_READ_SIZE, and USRINIT_WINDOWSECT_SIZE.

Referenced by Win32UserInitialize().

01472 { 01473 LPWSTR lpszSubSystem; 01474 LPWSTR lpszT; 01475 UNICODE_STRING strSize; 01476 01477 TRACE_INIT(("UserInit: Create User SubSystem\n")); 01478 01479 /* 01480 * Initialize the subsystem section. This identifies the default 01481 * user-heap size. 01482 */ 01483 lpszSubSystem = UserAllocPoolWithQuota(USRINIT_SHAREDSECT_BUFF_SIZE * sizeof(WCHAR), 01484 TAG_SYSTEM); 01485 01486 if (lpszSubSystem == NULL) { 01487 return FALSE; 01488 } 01489 01490 if (FastGetProfileStringW(NULL, PMAP_SUBSYSTEMS, 01491 L"Windows", 01492 L"SharedSection=,3072", 01493 lpszSubSystem, 01494 USRINIT_SHAREDSECT_READ_SIZE 01495 ) == 0) { 01496 RIPMSG0(RIP_WARNING, 01497 "UserInit: Windows subsystem definition not found"); 01498 UserFreePool(lpszSubSystem); 01499 return FALSE; 01500 } 01501 01502 /* 01503 * Locate the SharedSection portion of the definition and extract 01504 * the second value. 01505 */ 01506 gdwDesktopSectionSize = USRINIT_WINDOWSECT_SIZE; 01507 gdwNOIOSectionSize = USRINIT_NOIOSECT_SIZE; 01508 01509 if (lpszT = wcsstr(lpszSubSystem, L"SharedSection")) { 01510 01511 *(lpszT + 32) = UNICODE_NULL; 01512 01513 if (lpszT = wcschr(lpszT, L',')) { 01514 01515 RtlInitUnicodeString(&strSize, ++lpszT); 01516 RtlUnicodeStringToInteger(&strSize, 0, &gdwDesktopSectionSize); 01517 01518 /* 01519 * Assert this logic doesn't need to change. 01520 */ 01521 UserAssert(gdwDesktopSectionSize >= USRINIT_WINDOWSECT_SIZE); 01522 01523 gdwDesktopSectionSize = max(USRINIT_WINDOWSECT_SIZE, gdwDesktopSectionSize); 01524 gdwNOIOSectionSize = gdwDesktopSectionSize; 01525 01526 /* 01527 * Now see if the optional non-interactive desktop 01528 * heap size was specified. 01529 */ 01530 if (lpszT = wcschr(lpszT, L',')) { 01531 01532 RtlInitUnicodeString(&strSize, ++lpszT); 01533 RtlUnicodeStringToInteger(&strSize, 0, &gdwNOIOSectionSize); 01534 01535 UserAssert(gdwNOIOSectionSize >= USRINIT_NOIOSECT_SIZE); 01536 gdwNOIOSectionSize = max(USRINIT_NOIOSECT_SIZE, gdwNOIOSectionSize); 01537 } 01538 } 01539 } 01540 01541 UserFreePool(lpszSubSystem); 01542 01543 return TRUE; 01544 }

BOOL InitCreateUserSubsystem VOID   ) 
 

VOID InitFunctionTables VOID   ) 
 

Definition at line 975 of file kernel/server.c.

References CBFNID, fnHkINLPCWPEXSTRUCT(), fnHkINLPCWPRETEXSTRUCT(), FNID, FNID_ARRAY_SIZE, FNID_CALLWINDOWPROC, FNID_DEFWINDOWPROC, FNID_DESKTOP, FNID_HKINLPCWPEXSTRUCT, FNID_HKINLPCWPRETEXSTRUCT, FNID_ICONTITLE, FNID_MENU, FNID_SCROLLBAR, FNID_SENDMESSAGE, FNID_SENDMESSAGEBSM, FNID_SENDMESSAGEEX, FNID_SENDMESSAGEFF, FNID_START, FNID_WNDPROCEND, MENUWND, SBWND, STOCID, TRACE_INIT, UINT, VOID(), WNDPROC_PWND, xxxDefWindowProc(), xxxDesktopWndProc(), xxxMenuWindowProc(), xxxSBWndProc(), xxxSendMessageEx(), xxxSendMessageFF(), xxxUnusedFunctionId(), xxxWrapCallWindowProc(), xxxWrapSendMessage(), and xxxWrapSendMessageBSM().

Referenced by Win32UserInitialize().

00976 { 00977 UINT i; 00978 00979 TRACE_INIT(("UserInit: Initialize Function Tables\n")); 00980 00981 UserAssert(sizeof(CLIENTINFO) <= sizeof(NtCurrentTeb()->Win32ClientInfo)); 00982 00983 /* 00984 * This table is used to convert from server procs to client procs. 00985 */ 00986 STOCID(FNID_SCROLLBAR) = (WNDPROC_PWND)xxxSBWndProc; 00987 STOCID(FNID_ICONTITLE) = xxxDefWindowProc; 00988 STOCID(FNID_MENU) = xxxMenuWindowProc; 00989 STOCID(FNID_DESKTOP) = xxxDesktopWndProc; 00990 STOCID(FNID_DEFWINDOWPROC) = xxxDefWindowProc; 00991 00992 /* 00993 * This table is used to determine the number minimum number 00994 * of reserved windows words required for the server proc. 00995 */ 00996 CBFNID(FNID_SCROLLBAR) = sizeof(SBWND); 00997 CBFNID(FNID_ICONTITLE) = sizeof(WND); 00998 CBFNID(FNID_MENU) = sizeof(MENUWND); 00999 01000 /* 01001 * Initialize this data structure (api function table). 01002 */ 01003 for (i = 0; i < FNID_ARRAY_SIZE; i++) { 01004 FNID((i + FNID_START)) = xxxUnusedFunctionId; 01005 } 01006 FNID(FNID_SCROLLBAR) = xxxWrapSBWndProc; 01007 FNID(FNID_ICONTITLE) = xxxWrapDefWindowProc; 01008 FNID(FNID_MENU) = xxxWrapMenuWindowProc; 01009 FNID(FNID_DESKTOP) = xxxWrapDesktopWndProc; 01010 FNID(FNID_DEFWINDOWPROC) = xxxWrapDefWindowProc; 01011 FNID(FNID_SENDMESSAGE) = xxxWrapSendMessage; 01012 FNID(FNID_HKINLPCWPEXSTRUCT) = fnHkINLPCWPEXSTRUCT; 01013 FNID(FNID_HKINLPCWPRETEXSTRUCT) = fnHkINLPCWPRETEXSTRUCT; 01014 FNID(FNID_SENDMESSAGEFF) = xxxSendMessageFF; 01015 FNID(FNID_SENDMESSAGEEX) = xxxSendMessageEx; 01016 FNID(FNID_CALLWINDOWPROC) = xxxWrapCallWindowProc; 01017 FNID(FNID_SENDMESSAGEBSM) = xxxWrapSendMessageBSM; 01018 01019 #if DBG 01020 { 01021 PULONG_PTR pdw; 01022 01023 /* 01024 * Make sure that everyone got initialized. 01025 */ 01026 for (pdw=(PULONG_PTR)&STOCID(FNID_START); 01027 (ULONG_PTR)pdw<(ULONG_PTR)(&STOCID(FNID_WNDPROCEND)); pdw++) { 01028 UserAssert(*pdw); 01029 } 01030 01031 for (pdw=(PULONG_PTR)&FNID(FNID_START); 01032 (ULONG_PTR)pdw<(ULONG_PTR)(&FNID(FNID_WNDPROCEND)); pdw++) { 01033 UserAssert(*pdw); 01034 } 01035 } 01036 #endif 01037 01038 }

VOID InitLoadResources  ) 
 

Definition at line 1738 of file kernel/server.c.

References tagDISPLAYRESOURCE::cxBorder, tagDISPLAYRESOURCE::cyBorder, DISPLAYRESOURCE, gbRemoteSession, GetPrimaryMonitor(), gpsi, tagMONITOR::rcMonitor, SYSMET, TRACE_INIT, VOID(), tagDISPLAYRESOURCE::xCompressCursor, tagDISPLAYRESOURCE::xCompressIcon, tagDISPLAYRESOURCE::yCompressCursor, tagDISPLAYRESOURCE::yCompressIcon, and tagDISPLAYRESOURCE::yKanji.

Referenced by RemoteConnect(), and UserInitialize().

01739 { 01740 PRECT prc; 01741 01742 DISPLAYRESOURCE dr = { 01743 17, // Height of vertical thumb 01744 17, // Width of horizontal thumb 01745 2, // Icon horiz compression factor 01746 2, // Icon vert compression factor 01747 1, // Cursor horz compression factor 01748 1, // Cursor vert compression factor 01749 0, // Kanji window height 01750 1, // cxBorder (thickness of vertical lines) 01751 1 // cyBorder (thickness of horizontal lines) 01752 }; 01753 01754 01755 TRACE_INIT(("UserInit: Load Display Resources\n")); 01756 01757 if (dr.xCompressIcon > 10) { 01758 01759 /* 01760 * If so, the actual dimensions of icons and cursors are 01761 * kept in OEMBIN. 01762 */ 01763 SYSMET(CXICON) = dr.xCompressIcon; 01764 SYSMET(CYICON) = dr.yCompressIcon; 01765 SYSMET(CXCURSOR) = dr.xCompressCursor; 01766 SYSMET(CYCURSOR) = dr.yCompressCursor; 01767 01768 } else { 01769 01770 /* 01771 * Else, only the ratio of (64/icon dimensions) is kept there. 01772 */ 01773 SYSMET(CXICON) = (64 / dr.xCompressIcon); 01774 SYSMET(CYICON) = (64 / dr.yCompressIcon); 01775 SYSMET(CXCURSOR) = (32 / dr.xCompressCursor); 01776 SYSMET(CYCURSOR) = (32 / dr.yCompressCursor); 01777 } 01778 01779 SYSMET(CXSMICON) = SYSMET(CXICON) / 2; 01780 SYSMET(CYSMICON) = SYSMET(CYICON) / 2; 01781 01782 SYSMET(CYKANJIWINDOW) = dr.yKanji; 01783 01784 /* 01785 * Get border thicknesses. 01786 */ 01787 SYSMET(CXBORDER) = dr.cxBorder; 01788 SYSMET(CYBORDER) = dr.cyBorder; 01789 01790 /* 01791 * Edge is two borders. 01792 */ 01793 SYSMET(CXEDGE) = 2 * SYSMET(CXBORDER); 01794 SYSMET(CYEDGE) = 2 * SYSMET(CYBORDER); 01795 01796 /* 01797 * Fixed frame is outer edge + border. 01798 */ 01799 SYSMET(CXDLGFRAME) = SYSMET(CXEDGE) + SYSMET(CXBORDER); 01800 SYSMET(CYDLGFRAME) = SYSMET(CYEDGE) + SYSMET(CYBORDER); 01801 01802 if (gbRemoteSession) { 01803 return; 01804 } 01805 01806 prc = &GetPrimaryMonitor()->rcMonitor; 01807 SYSMET(CXFULLSCREEN) = prc->right; 01808 SYSMET(CYFULLSCREEN) = prc->bottom - SYSMET(CYCAPTION); 01809 01810 /* 01811 * Set the initial cursor position to the center of the primary screen. 01812 */ 01813 gpsi->ptCursor.x = prc->right / 2; 01814 gpsi->ptCursor.y = prc->bottom / 2; 01815 }

NTSTATUS InitMapSharedSection PEPROCESS  Process,
PUSERCONNECT  pUserConnect
 

Definition at line 1654 of file kernel/server.c.

References _WNDMSG::abMsgs, tagSHAREDINFO::aheList, tagSHAREDINFO::awmControl, CALC_DELTA, tagSHAREDINFO::DefWindowMsgs, tagSHAREDINFO::DefWindowSpecMsgs, FNID_END, FNID_START, ghSectionShared, gpvSharedBase, gSharedInfo, _WNDMSG::maxMsgs, MmMapViewOfSection(), NT_SUCCESS, NTSTATUS(), NULL, PBYTE, tagSHAREDINFO::pDispInfo, tagSHAREDINFO::psi, PUSERCONNECT, _USERCONNECT::siClient, Status, TRACE_INIT, tagSHAREDINFO::ulSharedDelta, ValidateProcessSessionId, and _EPROCESS::Win32Process.

Referenced by NtUserProcessConnect().

01657 { 01658 int i; 01659 PVOID pClientBase = NULL; 01660 ULONG_PTR ulSharedDelta; 01661 01662 TRACE_INIT(("UserInit: Map Shared Memory Section\n")); 01663 01664 UserAssert(ghSectionShared != NULL); 01665 01666 ValidateProcessSessionId(Process); 01667 01668 /* 01669 * Check to see if we haven't already mapped the section 01670 * This might happen for multiple LoadLibrary()/FreeLibrary calls 01671 * in one process. MCostea #56946 01672 */ 01673 if (Process->Win32Process == NULL || 01674 ((PPROCESSINFO)Process->Win32Process)->pClientBase == NULL) { 01675 01676 SIZE_T ViewSize; 01677 LARGE_INTEGER liOffset; 01678 NTSTATUS Status; 01679 01680 ViewSize = 0; 01681 liOffset.QuadPart = 0; 01682 01683 Status = MmMapViewOfSection(ghSectionShared, 01684 Process, 01685 &pClientBase, 01686 0, 01687 0, 01688 &liOffset, 01689 &ViewSize, 01690 ViewUnmap, 01691 SEC_NO_CHANGE, 01692 PAGE_EXECUTE_READ); 01693 if (NT_SUCCESS(Status)) { 01694 TRACE_INIT(("UserInit: Map: Client SharedInfo Base = %x\n", pClientBase)); 01695 01696 UserAssert(gpvSharedBase > pClientBase); 01697 if (Process->Win32Process != NULL) { 01698 ((PPROCESSINFO)Process->Win32Process)->pClientBase = pClientBase; 01699 } 01700 } else { 01701 return Status; 01702 } 01703 01704 } else { 01705 pClientBase = ((PPROCESSINFO)Process->Win32Process)->pClientBase; 01706 } 01707 ulSharedDelta = (PBYTE)gpvSharedBase - (PBYTE)pClientBase; 01708 pUserConnect->siClient.ulSharedDelta = ulSharedDelta; 01709 01710 pUserConnect->siClient.psi = CALC_DELTA(psi); 01711 pUserConnect->siClient.aheList = CALC_DELTA(aheList); 01712 pUserConnect->siClient.pDispInfo = CALC_DELTA(pDispInfo); 01713 01714 01715 pUserConnect->siClient.DefWindowMsgs.maxMsgs = gSharedInfo.DefWindowMsgs.maxMsgs; 01716 pUserConnect->siClient.DefWindowMsgs.abMsgs = CALC_DELTA(DefWindowMsgs.abMsgs); 01717 pUserConnect->siClient.DefWindowSpecMsgs.maxMsgs = gSharedInfo.DefWindowSpecMsgs.maxMsgs; 01718 pUserConnect->siClient.DefWindowSpecMsgs.abMsgs = CALC_DELTA(DefWindowSpecMsgs.abMsgs); 01719 01720 for (i = 0; i < (FNID_END - FNID_START + 1); ++i) { 01721 01722 pUserConnect->siClient.awmControl[i].maxMsgs = gSharedInfo.awmControl[i].maxMsgs; 01723 01724 if (gSharedInfo.awmControl[i].abMsgs) 01725 pUserConnect->siClient.awmControl[i].abMsgs = CALC_DELTA(awmControl[i].abMsgs); 01726 else 01727 pUserConnect->siClient.awmControl[i].abMsgs = NULL; 01728 } 01729 return STATUS_SUCCESS; 01730 }

VOID InitMessageTables VOID   ) 
 

Definition at line 1049 of file kernel/server.c.

References EditWndProc, FNID_BUTTON, FNID_COMBOBOX, FNID_COMBOLISTBOX, FNID_DESKTOP, FNID_DIALOG, FNID_EDIT, FNID_IME, FNID_LISTBOX, FNID_MENU, FNID_SCROLLBAR, FNID_START, FNID_STATIC, INITMSGTABLE, TRACE_INIT, and VOID().

Referenced by Win32UserInitialize().

01050 { 01051 TRACE_INIT(("UserInit: Initialize Message Tables\n")); 01052 01053 #define INITMSGTABLE(member, procname) \ 01054 InitWindowMsgTable(&(gSharedInfo.member.abMsgs), \ 01055 &(gSharedInfo.member.maxMsgs), \ 01056 gaw ## procname); 01057 01058 INITMSGTABLE(DefWindowMsgs, DefWindowMsgs); 01059 INITMSGTABLE(DefWindowSpecMsgs, DefWindowSpecMsgs); 01060 01061 INITMSGTABLE(awmControl[FNID_DIALOG - FNID_START], DefDlgProc); 01062 INITMSGTABLE(awmControl[FNID_SCROLLBAR - FNID_START], ScrollBarWndProc); 01063 INITMSGTABLE(awmControl[FNID_MENU - FNID_START], MenuWndProc); 01064 INITMSGTABLE(awmControl[FNID_DESKTOP - FNID_START], DesktopWndProc); 01065 INITMSGTABLE(awmControl[FNID_STATIC - FNID_START], StaticWndProc); 01066 INITMSGTABLE(awmControl[FNID_BUTTON - FNID_START], ButtonWndProc); 01067 INITMSGTABLE(awmControl[FNID_LISTBOX - FNID_START], ListboxWndProc); 01068 INITMSGTABLE(awmControl[FNID_COMBOBOX - FNID_START], ComboWndProc); 01069 INITMSGTABLE(awmControl[FNID_COMBOLISTBOX - FNID_START], ListboxWndProc); 01070 INITMSGTABLE(awmControl[FNID_EDIT - FNID_START], EditWndProc); 01071 INITMSGTABLE(awmControl[FNID_IME - FNID_START], ImeWndProc); 01072 }

BOOL InitOLEFormats VOID   ) 
 

Definition at line 1087 of file kernel/server.c.

References ARRAY_SIZE, BOOL, lpszOLEFormats, TRACE_INIT, TRUE, UINT, and UserAddAtom().

Referenced by Win32UserInitialize().

01088 { 01089 UINT idx; 01090 ATOM a1; 01091 ATOM a2; 01092 BOOL fSuccess = TRUE; 01093 01094 TRACE_INIT(("UserInit: Initialize OLE Formats\n")); 01095 01096 a1 = UserAddAtom(lpszOLEFormats[0], TRUE); 01097 01098 for (idx = 1; idx < ARRAY_SIZE(lpszOLEFormats); idx++) { 01099 a2 = UserAddAtom(lpszOLEFormats[idx], TRUE); 01100 fSuccess &= !!a2; 01101 01102 UserAssert(((a1 + 1) == a2) && (a1 = a2)); 01103 } 01104 01105 if (!fSuccess) { 01106 RIPMSG0(RIP_ERROR, "InitOLEFormats: at least one atom not registered"); 01107 } 01108 01109 return fSuccess; 01110 }

NTSTATUS InitQEntryLookaside VOID   ) 
 

NTSTATUS InitSMSLookaside VOID   ) 
 

PMDEV InitVideo BOOL  bReenumerationNeeded  ) 
 

Definition at line 1893 of file kernel/server.c.

References FALSE, gpDispInfo, GW_DESKTOP_ID, tagDISPLAYINFO::hDev, HH_INITVIDEO, HYDRA_HINT, InitUserScreen(), KernelMode, NULL, tagDISPLAYINFO::pmdev, and TRUE.

Referenced by RemoteConnect(), and UserInitialize().

01895 { 01896 PMDEV pmdev; 01897 LONG ChangeStatus; 01898 01899 /* 01900 * BUGBUG !!! Need to get a status return from this call. 01901 */ 01902 DrvInitConsole(bReenumerationNeeded); 01903 01904 /* 01905 * BASEVIDEO may be on or off, whether we are in setup or not. 01906 */ 01907 01908 ChangeStatus = DrvChangeDisplaySettings(NULL, 01909 NULL, 01910 NULL, 01911 (PVOID) (GW_DESKTOP_ID), 01912 KernelMode, 01913 FALSE, 01914 TRUE, 01915 NULL, 01916 &pmdev, 01917 GRE_DEFAULT, 01918 TRUE); 01919 01920 if (ChangeStatus != GRE_DISP_CHANGE_SUCCESSFUL) { 01921 01922 /* 01923 * If we fail, try BASEVIDEO temporarily 01924 */ 01925 01926 DrvSetBaseVideo(TRUE); 01927 01928 ChangeStatus = DrvChangeDisplaySettings(NULL, 01929 NULL, 01930 NULL, 01931 (PVOID) (GW_DESKTOP_ID), 01932 KernelMode, 01933 FALSE, 01934 TRUE, 01935 NULL, 01936 &pmdev, 01937 GRE_DEFAULT, 01938 TRUE); 01939 01940 DrvSetBaseVideo(FALSE); 01941 01942 /* 01943 * Give it one last try, not in basevideo, to handle TGA 01944 * (non-vgacompatible) during GUI-mode setup (BASEVIDEO is on by 01945 * default) 01946 */ 01947 01948 if (ChangeStatus != GRE_DISP_CHANGE_SUCCESSFUL) { 01949 01950 ChangeStatus = DrvChangeDisplaySettings(NULL, 01951 NULL, 01952 NULL, 01953 (PVOID) (GW_DESKTOP_ID), 01954 KernelMode, 01955 FALSE, 01956 TRUE, 01957 NULL, 01958 &pmdev, 01959 GRE_DEFAULT, 01960 TRUE); 01961 01962 } 01963 } 01964 01965 if (ChangeStatus != GRE_DISP_CHANGE_SUCCESSFUL) { 01966 RIPMSG0(RIP_WARNING, "InitVideo: No working display driver found"); 01967 return NULL; 01968 } 01969 01970 gpDispInfo->hDev = pmdev->hdevParent; 01971 gpDispInfo->pmdev = pmdev; 01972 01973 GreUpdateSharedDevCaps(gpDispInfo->hDev); 01974 01975 if (!InitUserScreen()) { 01976 RIPMSG0(RIP_WARNING, "InitUserScreen failed"); 01977 return NULL; 01978 } 01979 01980 HYDRA_HINT(HH_INITVIDEO); 01981 01982 return pmdev; 01983 }

VOID InitWindowMsgTable PBYTE ,
PUINT  ,
CONST WORD * 
 

Definition at line 944 of file kernel/server.c.

References BYTE, msg, SharedAlloc(), UINT, and VOID().

00948 { 00949 UINT i; 00950 WORD msg; 00951 UINT cbTable; 00952 00953 *pmax = 0; 00954 for (i = 0; (msg = pw[i]) != 0; i++) { 00955 if (msg > *pmax) 00956 *pmax = msg; 00957 } 00958 00959 cbTable = *pmax / 8 + 1; 00960 *ppbyte = SharedAlloc(cbTable); 00961 00962 for (i = 0; (msg = pw[i]) != 0; i++) 00963 (*ppbyte)[msg / 8] |= (BYTE)(1 << (msg & 7)); 00964 }

BOOL IsDBCSEnabledSystem  ) 
 

Definition at line 2118 of file kernel/server.c.

References BOOL, and NlsMbCodePageTag.

Referenced by IsIMMEnabledSystem(), and Win32UserInitialize().

02119 { 02120 extern BOOLEAN* NlsMbCodePageTag; 02121 return !!*NlsMbCodePageTag; 02122 }

BOOL IsIMMEnabledSystem  ) 
 

Definition at line 2125 of file kernel/server.c.

References BOOL, FastGetProfileDwordW(), IsDBCSEnabledSystem(), NULL, PMAP_IMM, and TRUE.

Referenced by Win32UserInitialize().

02126 { 02127 // if the entire system is DBCS enabled, IMM/IME should be activated anyway 02128 if (IsDBCSEnabledSystem()) 02129 return TRUE; 02130 02131 return FastGetProfileDwordW(NULL, PMAP_IMM, TEXT("LoadIMM"), 0); 02132 }

BOOL IsMidEastEnabledSystem  ) 
 

Definition at line 2135 of file kernel/server.c.

References __declspec(), BOOL, FALSE, NlsAnsiCodePage, TRUE, and USHORT.

Referenced by Win32UserInitialize().

02136 { 02137 extern __declspec(dllimport) USHORT NlsAnsiCodePage; 02138 //1255 Hebrew and 1256 Arabic 02139 if ((NlsAnsiCodePage == 1255) || (NlsAnsiCodePage == 1256)) { 02140 return TRUE; 02141 } 02142 return FALSE; 02143 }

NTSTATUS NtUserInitialize IN DWORD  dwVersion,
IN HANDLE  hPowerRequestEvent,
IN HANDLE  hMediaRequestEvent
 

Definition at line 2713 of file kernel/server.c.

References gbRemoteSession, gpepCSRSS, gSessionId, InitializeMediaChange(), InitializePowerRequestList(), KeBugCheckEx(), NT_SUCCESS, NTSTATUS(), NULL, PsGetCurrentProcess, Status, TellGdiToGetReady(), TRACE_INIT, TRUE, USERCURRENTVERSION, UserInitialize(), and _EPROCESS::Win32Process.

Referenced by UserServerDllInitialization().

02717 { 02718 NTSTATUS Status; 02719 02720 TRACE_INIT(("Entering NtUserInitialize\n")); 02721 02722 /* 02723 * Make sure we're not trying to load this twice. 02724 */ 02725 if (gpepCSRSS != NULL) { 02726 RIPMSG0(RIP_ERROR, "Can't initialize more than once"); 02727 return STATUS_UNSUCCESSFUL; 02728 } 02729 02730 /* 02731 * Check version number 02732 */ 02733 if (dwVersion != USERCURRENTVERSION) { 02734 KeBugCheckEx(WIN32K_INIT_OR_RIT_FAILURE, 02735 0, 02736 0, 02737 dwVersion, 02738 USERCURRENTVERSION); 02739 } 02740 02741 /* 02742 * Get the session ID from the EPROCESS structure 02743 */ 02744 gSessionId = PsGetCurrentProcess()->SessionId; 02745 02746 UserAssert(gSessionId == 0 || gbRemoteSession == TRUE); 02747 02748 /* 02749 * Initialize the power request list. 02750 */ 02751 Status = InitializePowerRequestList(hPowerRequestEvent); 02752 if (!NT_SUCCESS(Status)) { 02753 return Status; 02754 } 02755 02756 InitializeMediaChange(hMediaRequestEvent); 02757 02758 /* 02759 * Save the system process structure. 02760 */ 02761 gpepCSRSS = PsGetCurrentProcess(); 02762 02763 if (!TellGdiToGetReady()) 02764 { 02765 RIPMSG0(RIP_WARNING, "TellGdiToGetReady failed"); 02766 Status = STATUS_UNSUCCESSFUL; 02767 return Status; 02768 } 02769 02770 /* 02771 * Allow CSR to read the screen 02772 */ 02773 ((PW32PROCESS)gpepCSRSS->Win32Process)->W32PF_Flags |= (W32PF_READSCREENACCESSGRANTED|W32PF_IOWINSTA); 02774 02775 02776 Status = UserInitialize(); 02777 02778 TRACE_INIT(("Leaving NtUserInitialize\n")); 02779 return Status; 02780 }

NTSTATUS NtUserProcessConnect IN HANDLE  hProcess,
IN OUT PVOID  pConnectInfo,
IN ULONG  cbConnectInfo
 

Definition at line 2788 of file kernel/server.c.

References _USERCONNECT::dwDispatchCount, DWORD, FALSE, gDispatchTableValues, GetCurrentProcessId, InitMapSharedSection(), NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, ObReferenceObjectByHandle(), ProbeForWrite(), PsProcessType, Status, TRACE_INIT, _USERCONNECT::ulVersion, USERCONNECT, USERCURRENTVERSION, and UserMode.

Referenced by ClientThreadSetup(), and UserClientConnect().

02792 { 02793 PEPROCESS Process; 02794 PUSERCONNECT pucConnect = (PUSERCONNECT)pConnectInfo; 02795 USERCONNECT ucLocal; 02796 NTSTATUS Status = STATUS_SUCCESS; 02797 02798 02799 TRACE_INIT(("Entering NtUserProcessConnect\n")); 02800 02801 if (!pucConnect || (cbConnectInfo != sizeof(USERCONNECT))) { 02802 return STATUS_UNSUCCESSFUL; 02803 } 02804 02805 try { 02806 ProbeForWrite(pucConnect, cbConnectInfo, sizeof(DWORD)); 02807 02808 ucLocal = *pucConnect; 02809 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 02810 return GetExceptionCode(); 02811 } 02812 02813 /* 02814 * Check client/server versions. 02815 */ 02816 if (ucLocal.ulVersion != USERCURRENTVERSION) { 02817 02818 RIPMSG2(RIP_ERROR, 02819 "Client version %lx > server version %lx\n", 02820 ucLocal.ulVersion, USERCURRENTVERSION); 02821 return STATUS_UNSUCCESSFUL; 02822 } 02823 02824 02825 02826 if (ucLocal.dwDispatchCount != gDispatchTableValues) { 02827 RIPMSG2(RIP_ERROR, 02828 "!!!! Client Dispatch info %lX != Server %lX\n", 02829 ucLocal.dwDispatchCount, gDispatchTableValues); 02830 } 02831 02832 02833 /* 02834 * Reference the process. 02835 */ 02836 Status = ObReferenceObjectByHandle(hProcess, 02837 PROCESS_VM_OPERATION, 02838 *PsProcessType, 02839 UserMode, 02840 &Process, 02841 NULL); 02842 if (!NT_SUCCESS(Status)) 02843 return Status; 02844 /* 02845 * Return client's view of shared data. 02846 */ 02847 Status = InitMapSharedSection(Process, &ucLocal); 02848 02849 if (!NT_SUCCESS(Status) && 02850 (Status != STATUS_NO_MEMORY) && 02851 (Status != STATUS_PROCESS_IS_TERMINATING) && 02852 (Status != STATUS_QUOTA_EXCEEDED) && 02853 (Status != STATUS_COMMITMENT_LIMIT)) { 02854 02855 RIPMSG2(RIP_ERROR, 02856 "Failed to map shared data into client %x, status = %x\n", 02857 GetCurrentProcessId(), Status); 02858 } 02859 02860 ObDereferenceObject(Process); 02861 02862 if (NT_SUCCESS(Status)) { 02863 02864 try { 02865 *pucConnect = ucLocal; 02866 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 02867 Status = GetExceptionCode(); 02868 } 02869 } 02870 02871 TRACE_INIT(("Leaving NtUserProcessConnect\n")); 02872 02873 return Status; 02874 }

BOOL SetupClassAtoms VOID   ) 
 

Definition at line 2151 of file kernel/server.c.

References atomCheckpointProp, tagSERVERINFO::atomContextHelpIdProp, atomDDEImp, atomDDETrack, tagSERVERINFO::atomIconProp, tagSERVERINFO::atomIconSmProp, atomImeLevel, atomLayer, atomQOS, tagSERVERINFO::atomSysClass, atomWndObj, BOOL, DESKTOPCLASS, DIALOGCLASS, gaFlashWState, gaOleMainThreadWndClass, gatomLastPinned, gatomMessage, gpsi, guiActivateShellWindow, guiOtherWindowCreated, guiOtherWindowDestroyed, ICLS_BUTTON, ICLS_CTL_MAX, ICLS_DESKTOP, ICLS_DIALOG, ICLS_ICONTITLE, ICLS_MENU, ICLS_SWITCH, ICLS_TOOLTIP, ICONTITLECLASS, lpszControls, MENUCLASS, PTR_TO_ID, SWITCHWNDCLASS, szACTIVATESHELLWINDOW, szCHECKPOINT_PROP_NAME, szCONTEXTHELPIDPROP, szDDEIMP_PROP_NAME, szDDETRACK_PROP_NAME, szFLASHWSTATE, szICON_PROP_NAME, szICONSM_PROP_NAME, szIMELEVEL_PROP_NAME, szLAYER_PROP_NAME, szMESSAGE, szOLEMAINTHREADWNDCLASS, szOTHERWINDOWCREATED, szOTHERWINDOWDESTROYED, szQOS_PROP_NAME, szSHELLHOOK, szWNDOBJ_PROP_NAME, TOOLTIPCLASS, TRUE, tagSERVERINFO::uiShellMsg, and UserAddAtom().

Referenced by Win32UserInitialize().

02153 { 02154 BOOL fSuccess = TRUE; 02155 int ind; 02156 02157 /* 02158 * Set up class atoms 02159 */ 02160 /* 02161 * HACK: Controls are registered on the client side so we can't 02162 * fill in their atomSysClass entry the same way we do for the other 02163 * classes. 02164 */ 02165 for (ind = ICLS_BUTTON; ind < ICLS_CTL_MAX; ind++) { 02166 gpsi->atomSysClass[ind] = UserAddAtom(lpszControls[ind], TRUE); 02167 fSuccess &= !!gpsi->atomSysClass[ind]; 02168 } 02169 02170 gpsi->atomSysClass[ICLS_DIALOG] = PTR_TO_ID(DIALOGCLASS); 02171 gpsi->atomSysClass[ICLS_ICONTITLE] = PTR_TO_ID(ICONTITLECLASS); 02172 gpsi->atomSysClass[ICLS_TOOLTIP] = PTR_TO_ID(TOOLTIPCLASS); 02173 gpsi->atomSysClass[ICLS_DESKTOP] = PTR_TO_ID(DESKTOPCLASS); 02174 gpsi->atomSysClass[ICLS_SWITCH] = PTR_TO_ID(SWITCHWNDCLASS); 02175 gpsi->atomSysClass[ICLS_MENU] = PTR_TO_ID(MENUCLASS); 02176 02177 gpsi->atomContextHelpIdProp = UserAddAtom(szCONTEXTHELPIDPROP, TRUE); 02178 fSuccess &= !!gpsi->atomContextHelpIdProp; 02179 02180 gpsi->atomIconSmProp = UserAddAtom(szICONSM_PROP_NAME, TRUE); 02181 fSuccess &= !!gpsi->atomIconSmProp; 02182 02183 gpsi->atomIconProp = UserAddAtom(szICON_PROP_NAME, TRUE); 02184 fSuccess &= !!gpsi->atomIconProp; 02185 02186 gpsi->uiShellMsg = UserAddAtom(szSHELLHOOK, TRUE); 02187 fSuccess &= !!gpsi->uiShellMsg; 02188 02189 /* 02190 * Initialize the integer atoms for our magic window properties 02191 */ 02192 atomCheckpointProp = UserAddAtom(szCHECKPOINT_PROP_NAME, TRUE); 02193 fSuccess &= !!atomCheckpointProp; 02194 02195 atomDDETrack = UserAddAtom(szDDETRACK_PROP_NAME, TRUE); 02196 fSuccess &= !!atomDDETrack; 02197 02198 atomQOS = UserAddAtom(szQOS_PROP_NAME, TRUE); 02199 fSuccess &= !!atomQOS; 02200 02201 atomDDEImp = UserAddAtom(szDDEIMP_PROP_NAME, TRUE); 02202 fSuccess &= !!atomDDEImp; 02203 02204 atomWndObj = UserAddAtom(szWNDOBJ_PROP_NAME, TRUE); 02205 fSuccess &= !!atomWndObj; 02206 02207 atomImeLevel = UserAddAtom(szIMELEVEL_PROP_NAME, TRUE); 02208 fSuccess &= !!atomImeLevel; 02209 02210 atomLayer = UserAddAtom(szLAYER_PROP_NAME, TRUE); 02211 fSuccess &= !!atomLayer; 02212 02213 guiActivateShellWindow = UserAddAtom(szACTIVATESHELLWINDOW, TRUE); 02214 fSuccess &= !!guiActivateShellWindow; 02215 02216 guiOtherWindowCreated = UserAddAtom(szOTHERWINDOWCREATED, TRUE); 02217 fSuccess &= !!guiOtherWindowCreated; 02218 02219 guiOtherWindowDestroyed = UserAddAtom(szOTHERWINDOWDESTROYED, TRUE); 02220 fSuccess &= !!guiOtherWindowDestroyed; 02221 02222 gatomMessage = UserAddAtom(szMESSAGE, TRUE); 02223 fSuccess &= !!gatomMessage; 02224 02225 #ifdef HUNGAPP_GHOSTING 02226 gatomGhost = UserAddAtom(szGHOST, TRUE); 02227 fSuccess &= !!gatomGhost; 02228 #endif // HUNGAPP_GHOSTING 02229 02230 gaOleMainThreadWndClass = UserAddAtom(szOLEMAINTHREADWNDCLASS, TRUE); 02231 fSuccess &= !!gaOleMainThreadWndClass; 02232 02233 gaFlashWState = UserAddAtom(szFLASHWSTATE, TRUE); 02234 fSuccess &= !!gaFlashWState; 02235 02236 gatomLastPinned = gaOleMainThreadWndClass; 02237 02238 return fSuccess; 02239 }

BOOL TellGdiToGetReady  ) 
 

Referenced by NtUserInitialize().

HDC UserGetDesktopDC ULONG  type,
BOOL  bAltType,
BOOL  bValidate
 

Definition at line 2519 of file kernel/server.c.

References _GetDCEx(), EnterCrit, gpDispInfo, gpepCSRSS, tagDISPLAYINFO::hDev, IS_SYSTEM_THREAD, IS_THREAD_RESTRICTED, LeaveCrit, NULL, tagDESKTOP::pDeskInfo, tagDESKTOP::pDispInfo, PsGetCurrentThread, PtiCurrent, PtiCurrentShared, PtoH, tagTHREADINFO::rpdesk, tagDESKTOPINFO::spwnd, _ETHREAD::ThreadsProcess, type, and ValidateHwnd.

02523 { 02524 PETHREAD Thread; 02525 HDC hdc; 02526 PTHREADINFO pti = PtiCurrentShared(); // This is called from outside the crit sec 02527 HDEV hdev = gpDispInfo->hDev; 02528 02529 if (bValidate && type != DCTYPE_INFO && 02530 IS_THREAD_RESTRICTED(pti, JOB_OBJECT_UILIMIT_HANDLES)) { 02531 02532 UserAssert(pti->rpdesk != NULL); 02533 02534 if (!ValidateHwnd(PtoH(pti->rpdesk->pDeskInfo->spwnd))) { 02535 RIPMSG0(RIP_WARNING, 02536 "UserGetDesktopDC fails desktop window validation"); 02537 return NULL; 02538 } 02539 } 02540 02541 /* 02542 * !!! BUGBUG 02543 * This is a real nasty trick to get both DCs created on a desktop on 02544 * a different device to work (for the video applet) and to be able 02545 * to clip DCs that are actually on the same device ... 02546 */ 02547 if (pti && pti->rpdesk) 02548 hdev = pti->rpdesk->pDispInfo->hDev; 02549 02550 /* 02551 * We want to turn this call that was originally OpenDC("Display", ...) 02552 * into GetDC null call so this DC will be clipped to the current 02553 * desktop or else the DC can write to any desktop. Only do this 02554 * for client apps; let the server do whatever it wants. 02555 */ 02556 Thread = PsGetCurrentThread(); 02557 if ((type != DCTYPE_DIRECT) || 02558 (hdev != gpDispInfo->hDev) || 02559 IS_SYSTEM_THREAD(Thread) || 02560 (Thread->ThreadsProcess == gpepCSRSS)) { 02561 02562 hdc = GreCreateDisplayDC(hdev, type, bAltType); 02563 02564 } else { 02565 02566 PDESKTOP pdesk; 02567 02568 EnterCrit(); 02569 02570 if (pdesk = PtiCurrent()->rpdesk) { 02571 02572 hdc = _GetDCEx(pdesk->pDeskInfo->spwnd, 02573 NULL, 02574 DCX_WINDOW | DCX_CACHE | DCX_CREATEDC); 02575 } else { 02576 hdc = NULL; 02577 } 02578 02579 LeaveCrit(); 02580 } 02581 02582 return hdc; 02583 }

HDEV UserGetHDEV VOID   ) 
 

Definition at line 3011 of file kernel/server.c.

References gpDispInfo, and tagDISPLAYINFO::hDev.

03012 { 03013 03014 /* 03015 * BUGBUG This is busted. 03016 * This need to return the device for the current desktop. 03017 * The graphics device may not be the same for all desktops. 03018 * -Andre 03019 */ 03020 return gpDispInfo->hDev; 03021 }

PVOID UserGlobalAtomTableCallout VOID   ) 
 

Definition at line 3035 of file kernel/server.c.

References End, EnterCrit, gpJobsList, IS_THREAD_RESTRICTED, tagW32JOB::Job, LeaveCrit, NT_SUCCESS, NULL, tagW32JOB::pAtomTable, tagWINDOWSTATION::pGlobalAtomTable, tagW32JOB::pNext, tagTHREADINFO::ppi, PsGetCurrentProcess, PsGetCurrentThread, PtiFromThread, tagPROCESSINFO::pW32Job, ReferenceWindowStation(), TRUE, and _EJOB::UIRestrictionsClass.

03036 { 03037 PETHREAD Thread; 03038 PTHREADINFO pti; 03039 PWINDOWSTATION pwinsta; 03040 PW32JOB pW32Job; 03041 PEJOB Job; 03042 PVOID GlobalAtomTable = NULL; 03043 03044 Thread = PsGetCurrentThread(); 03045 03046 pti = PtiFromThread(Thread); 03047 03048 EnterCrit(); 03049 03050 /* 03051 * For restricted threads access the atom table off of the job object 03052 */ 03053 if (pti != NULL && IS_THREAD_RESTRICTED(pti, JOB_OBJECT_UILIMIT_GLOBALATOMS)) { 03054 03055 UserAssert(pti->ppi != NULL); 03056 03057 pW32Job = pti->ppi->pW32Job; 03058 03059 UserAssert(pW32Job != NULL && pW32Job->pAtomTable != NULL); 03060 03061 GlobalAtomTable = pW32Job->pAtomTable; 03062 03063 goto End; 03064 } 03065 03066 Job = PsGetCurrentProcess()->Job; 03067 03068 /* 03069 * Now handle the case where this si not a GUI thread/process 03070 * but it is assigned to a job that has JOB_OBJECT_UILIMIT_GLOBALATOMS 03071 * restrictions set. There is no easy way to convert this thread 03072 * to GUI. 03073 */ 03074 if (pti == NULL && Job != NULL && 03075 (Job->UIRestrictionsClass & JOB_OBJECT_UILIMIT_GLOBALATOMS)) { 03076 03077 /* 03078 * find the W32JOB in the global list 03079 */ 03080 pW32Job = gpJobsList; 03081 03082 while (pW32Job) { 03083 if (pW32Job->Job == Job) { 03084 break; 03085 } 03086 pW32Job = pW32Job->pNext; 03087 } 03088 03089 UserAssert(pW32Job != NULL && pW32Job->pAtomTable != NULL); 03090 03091 GlobalAtomTable = pW32Job->pAtomTable; 03092 03093 goto End; 03094 } 03095 03096 #if DBG 03097 pwinsta = NULL; 03098 #endif 03099 03100 if (NT_SUCCESS(ReferenceWindowStation(Thread, 03101 PsGetCurrentProcess()->Win32WindowStation, 03102 WINSTA_ACCESSGLOBALATOMS, 03103 &pwinsta, 03104 TRUE))) { 03105 UserAssert(pwinsta != NULL); 03106 03107 GlobalAtomTable = pwinsta->pGlobalAtomTable; 03108 } 03109 03110 End: 03111 LeaveCrit(); 03112 03113 #if DBG 03114 if (GlobalAtomTable == NULL) { 03115 RIPMSG1(RIP_WARNING, 03116 "_UserGetGlobalAtomTable: NULL Atom Table for pwinsta=0x%x", 03117 pwinsta); 03118 } 03119 #endif 03120 03121 return GlobalAtomTable; 03122 }

NTSTATUS UserInitialize VOID   ) 
 

Definition at line 2004 of file kernel/server.c.

References CreateKernelEvent(), DrvDriverFailure(), EnterCrit, FALSE, gbRemoteSession, gbUserInitialized, gbVideoInitialized, gpEventDiconnectDesktop, gSessionId, HH_USERINITIALIZE, HYDRA_HINT, InitCreateObjectDirectory(), InitGlobalRIPFlags, InitLoadResources(), InitVideo(), ISTS, L, LeaveCrit, LW_BrushInit(), NT_SUCCESS, NtGlobalFlag, NTSTATUS(), NULL, PsGetCurrentThread, SESSION_ROOT, Status, szWindowStationDirectory, TRACE_INIT, TraceInitialization, TRUE, WINSTA_DIR, and xxxCreateThreadInfo().

Referenced by NtUserInitialize().

02005 { 02006 NTSTATUS Status; 02007 02008 /* 02009 * Allow a trace of all the init stuff going on related to display drivers. 02010 * Usefull to debug boot time problems related to graphics. 02011 */ 02012 if (**((PULONG *)&NtGlobalFlag) & FLG_SHOW_LDR_SNAPS) 02013 TraceInitialization = 1; 02014 02015 TRACE_INIT(("Entering UserInitialize\n")); 02016 02017 EnterCrit(); 02018 02019 HYDRA_HINT(HH_USERINITIALIZE); 02020 02021 if (ISTS()) { 02022 02023 if (gbRemoteSession) { 02024 swprintf(szWindowStationDirectory, L"%ws\\%ld%ws", 02025 SESSION_ROOT, gSessionId, WINSTA_DIR); 02026 } else { 02027 wcscpy(szWindowStationDirectory, WINSTA_DIR); 02028 } 02029 } else { 02030 wcscpy(szWindowStationDirectory, WINSTA_DIR); 02031 } 02032 02033 /* 02034 * Create WindowStation object directory. 02035 */ 02036 Status = InitCreateObjectDirectory(); 02037 02038 if (!NT_SUCCESS(Status)) { 02039 RIPMSG1(RIP_WARNING, "InitCreateObjectDirectory failed with Status %x", 02040 Status); 02041 02042 goto Exit; 02043 } 02044 02045 /* 02046 * WinStations get init'ed on the first connect 02047 */ 02048 if (gbRemoteSession) { 02049 02050 /* 02051 * Create the event for the diconnect desktop creation 02052 */ 02053 gpEventDiconnectDesktop = CreateKernelEvent(SynchronizationEvent, FALSE); 02054 02055 if (gpEventDiconnectDesktop == NULL) { 02056 RIPMSG0(RIP_WARNING, "Failed to create gpEventDiconnectDesktop"); 02057 Status = STATUS_NO_MEMORY; 02058 goto Exit; 02059 } 02060 02061 goto SkipRemote; 02062 } 02063 02064 if (InitVideo(TRUE) == NULL) { 02065 DrvDriverFailure(); 02066 } 02067 02068 /* 02069 * Do this here so power callouts 02070 * have the pmdev in gpDispInfo set 02071 */ 02072 gbVideoInitialized = TRUE; 02073 02074 SkipRemote: 02075 02076 gbUserInitialized = TRUE; 02077 02078 /* 02079 * Now that the system is initialized, allocate 02080 * a pti for this thread. 02081 */ 02082 Status = xxxCreateThreadInfo(PsGetCurrentThread(), FALSE); 02083 02084 if (!NT_SUCCESS(Status)) { 02085 RIPMSG1(RIP_WARNING, "xxxCreateThreadInfo failed during UserInitialize with Status", 02086 Status); 02087 goto Exit; 02088 } 02089 02090 /* 02091 * Initialize Global RIP flags (debug only). 02092 */ 02093 InitGlobalRIPFlags(); 02094 02095 /* 02096 * WinStations get init'ed on the first connect 02097 */ 02098 if (!gbRemoteSession) 02099 UserVerify(LW_BrushInit()); 02100 02101 InitLoadResources(); 02102 02103 Exit: 02104 LeaveCrit(); 02105 02106 TRACE_INIT(("Leaving UserInitialize\n")); 02107 02108 return Status; 02109 }

NTSTATUS UserThreadCallout IN PETHREAD  pEThread,
IN PSW32THREADCALLOUTTYPE  CalloutType
 

Definition at line 2595 of file kernel/server.c.

References EnterCrit, FALSE, FullScreenCleanup(), gbCleanedUpResources, gbNoMorePowerCallouts, gbRemoteSession, gbUserInitialized, gbVideoInitialized, gpDispInfo, gpepCSRSS, gpresUser, tagDISPLAYINFO::hdcScreen, tagDISPLAYINFO::hDev, LeaveCrit, NTSTATUS(), NULL, PsW32ThreadCalloutExit, PsW32ThreadCalloutInitialize, PtiCurrent, Status, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, TRACE_INIT, xxxCreateThreadInfo(), and xxxDestroyThreadInfo().

02598 { 02599 PTHREADINFO pti; 02600 NTSTATUS Status = STATUS_SUCCESS; 02601 02602 UserAssert(gpresUser != NULL); 02603 02604 switch (CalloutType) { 02605 case PsW32ThreadCalloutInitialize: 02606 TRACE_INIT(("Entering UserThreadCallout PsW32ThreadCalloutInitialize\n")); 02607 02608 if (gbNoMorePowerCallouts) { 02609 RIPMSG0(RIP_WARNING, "No more GUI threads allowed"); 02610 return STATUS_UNSUCCESSFUL; 02611 } 02612 02613 /* 02614 * Only create a thread info structure if we're initialized. 02615 */ 02616 if (gbUserInitialized) { 02617 EnterCrit(); 02618 UserAssert(gpepCSRSS != NULL); 02619 02620 /* 02621 * Initialize this thread 02622 */ 02623 Status = xxxCreateThreadInfo(pEThread, FALSE); 02624 02625 LeaveCrit(); 02626 } 02627 break; 02628 02629 case PsW32ThreadCalloutExit: 02630 02631 TRACE_INIT(("Entering UserThreadCallout PsW32ThreadCalloutExit\n")); 02632 02633 /* 02634 * If we aren't already inside the critical section, enter it. 02635 * Because this is the first pass, we remain in the critical 02636 * section when we return so that our try/finally handlers 02637 * are protected by the critical section. 02638 * EnterCrit here before GreUnlockDisplay() provides a pti which 02639 * may be required if unlocking the display may release some 02640 * deferred WinEvents, for which a pti is required. 02641 */ 02642 EnterCrit(); 02643 02644 pti = (PTHREADINFO)pEThread->Tcb.Win32Thread; 02645 02646 /* 02647 * WinStations that haven't gone through the first connect do not 02648 * have any of the graphics setup. 02649 */ 02650 if (!gbRemoteSession || gbVideoInitialized) { 02651 02652 /* 02653 * Assert that we did not cleaned up gpDispInfo->hDev 02654 */ 02655 UserAssert(!gbCleanedUpResources); 02656 02657 GreLockDisplay(gpDispInfo->hDev); 02658 GreUnlockDisplay(gpDispInfo->hDev); 02659 } 02660 02661 02662 /* 02663 * Mark this thread as in the middle of cleanup. This is useful for 02664 * several problems in USER where we need to know this information. 02665 */ 02666 pti->TIF_flags |= TIF_INCLEANUP; 02667 02668 /* 02669 * If we died during a full screen switch make sure we cleanup 02670 * correctly 02671 */ 02672 FullScreenCleanup(); 02673 /* 02674 * Cleanup gpDispInfo->hdcScreen - if we crashed while using it, 02675 * it may have owned objects still selected into it. Cleaning 02676 * it this way will ensure that gdi doesn't try to delete these 02677 * objects while they are still selected into this public hdc. 02678 */ 02679 02680 /* 02681 * WinStations that haven't gone through the first connect do not 02682 * have any of the graphics setup. 02683 */ 02684 if (!gbRemoteSession || gbVideoInitialized) { 02685 GreCleanDC(gpDispInfo->hdcScreen); 02686 } 02687 02688 /* 02689 * This thread is exiting execution; xxxDestroyThreadInfo cleans 02690 * up everything that can go now 02691 */ 02692 UserAssert(pti == PtiCurrent()); 02693 xxxDestroyThreadInfo(); 02694 LeaveCrit(); 02695 02696 break; 02697 } 02698 02699 TRACE_INIT(("Leaving UserThreadCallout\n")); 02700 02701 return Status; 02702 }

VOID VerifySyncOnlyMessages VOID   ) 
 

Referenced by Win32UserInitialize().

NTSTATUS Win32UserInitialize VOID   ) 
 

WRAPPFN DesktopWndProc  ,
PWND 
 

LRESULT xxxUnusedFunctionId PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
ULONG_PTR  xParam
 

Definition at line 822 of file kernel/server.c.

References FALSE.

Referenced by InitFunctionTables().

00828 { 00829 DBG_UNREFERENCED_PARAMETER(pwnd); 00830 DBG_UNREFERENCED_PARAMETER(message); 00831 DBG_UNREFERENCED_PARAMETER(wParam); 00832 DBG_UNREFERENCED_PARAMETER(lParam); 00833 DBG_UNREFERENCED_PARAMETER(xParam); 00834 00835 UserAssert(FALSE); 00836 return 0; 00837 }

NTSTATUS xxxUserProcessCallout IN PW32PROCESS  Process,
IN BOOLEAN  Initialize
 

Definition at line 2882 of file kernel/server.c.

References tagSHAREDINFO::aheList, _HANDLEENTRY::bType, _WIN32_JOBCALLOUT_PARAMETERS::CalloutType, _WIN32_JOBCALLOUT_PARAMETERS::Data, tagDCE::DCX_flags, DestroyCacheDC(), DestroyProcessInfo(), EnterCrit, ExAcquireResourceExclusive, ExReleaseResource, giheLast, gpDispInfo, gpepCSRSS, gppiList, gpresUser, gSharedInfo, tagDCE::hdc, _WIN32_JOBCALLOUT_PARAMETERS::Job, _EJOB::JobLock, KeEnterCriticalRegion, KeLeaveCriticalRegion, LeaveCrit, NTSTATUS(), NULL, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, tagPROCESSINFO::ppiNextRunning, PsW32JobCalloutAddProcess, RemoveProcessFromJob(), _EJOB::SessionId, Status, TRACE_INIT, TRUE, TYPE_FREE, UserJobCallout(), and xxxInitProcessInfo().

02885 { 02886 NTSTATUS Status = STATUS_SUCCESS; 02887 02888 if (Initialize) { 02889 02890 TRACE_INIT(("Entering xxxUserProcessCallout Initialize\n")); 02891 02892 UserAssert(gpresUser != NULL); 02893 EnterCrit(); 02894 02895 /* 02896 * Initialize the important process level stuff. 02897 */ 02898 Status = xxxInitProcessInfo(Process); 02899 02900 LeaveCrit(); 02901 02902 if (Status == STATUS_SUCCESS) { 02903 02904 if (Process->Process && 02905 Process->Process->Job && 02906 Process->Process->Job->UIRestrictionsClass != 0) { 02907 02908 WIN32_JOBCALLOUT_PARAMETERS Parms; 02909 02910 PEJOB Job = Process->Process->Job; 02911 02912 /* 02913 * aquire the job's lock and after that enter the user 02914 * critical section. 02915 */ 02916 KeEnterCriticalRegion(); 02917 ExAcquireResourceExclusive(&Job->JobLock, TRUE); 02918 02919 Parms.Job = Job; 02920 Parms.CalloutType = PsW32JobCalloutAddProcess; 02921 Parms.Data = Process; 02922 02923 UserAssert(Job->SessionId == Process->Process->SessionId); 02924 02925 UserJobCallout(&Parms); 02926 02927 ExReleaseResource(&Job->JobLock); 02928 KeLeaveCriticalRegion(); 02929 } 02930 } 02931 } else { 02932 02933 int i; 02934 PHE phe; 02935 PDCE *ppdce; 02936 PDCE pdce; 02937 02938 TRACE_INIT(("Entering xxxUserProcessCallout Cleanup\n")); 02939 02940 UserAssert(gpresUser != NULL); 02941 02942 EnterCrit(); 02943 02944 #if DBG 02945 if (Process->Process == gpepCSRSS) { 02946 02947 /* 02948 * CSRSS should be the last to go ... 02949 */ 02950 UserAssert(gppiList->ppiNextRunning == NULL); 02951 } 02952 #endif // DBG 02953 02954 if (Process->Process && Process->Process->Job != NULL) { 02955 RemoveProcessFromJob((PPROCESSINFO)Process); 02956 } 02957 02958 /* 02959 * DestroyProcessInfo will return TRUE if any threads ever 02960 * connected. If nothing ever connected, we needn't do 02961 * this cleanup. 02962 */ 02963 if (DestroyProcessInfo(Process)) { 02964 02965 /* 02966 * See if we can compact the handle table. 02967 */ 02968 i = giheLast; 02969 phe = &gSharedInfo.aheList[giheLast]; 02970 while ((phe > &gSharedInfo.aheList[0]) && (phe->bType == TYPE_FREE)) { 02971 phe--; 02972 giheLast--; 02973 } 02974 02975 /* 02976 * Scan the DC cache to find any DC's that need to be destroyed. 02977 */ 02978 for (ppdce = &gpDispInfo->pdceFirst; *ppdce != NULL; ) { 02979 02980 pdce = *ppdce; 02981 if (pdce->DCX_flags & DCX_DESTROYTHIS) 02982 DestroyCacheDC(ppdce, pdce->hdc); 02983 02984 /* 02985 * Step to the next DC. If the DC was deleted, there 02986 * is no need to calculate address of the next entry. 02987 */ 02988 if (pdce == *ppdce) 02989 ppdce = &pdce->pdceNext; 02990 } 02991 } 02992 02993 UserAssert(gpresUser != NULL); 02994 02995 LeaveCrit(); 02996 } 02997 02998 TRACE_INIT(("Leaving xxxUserProcessCallout\n")); 02999 03000 return Status; 03001 }

LRESULT xxxWrapCallWindowProc PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
ULONG_PTR  xParam
 

Definition at line 849 of file kernel/server.c.

References tagSERVERINFO::apfnClientA, tagSERVERINFO::apfnClientW, CPD_UNICODE_TO_ANSI, gpsi, HMValidateHandleNoRip(), _CALLPROCDATA::pfnClientPrevious, _PFNCLIENT::pfnDispatchMessage, _PFNCLIENT::pfnEditWndProc, SCMS_FLAGS_ANSI, ScSendMessage, TYPE_CALLPROC, and _CALLPROCDATA::wType.

Referenced by InitFunctionTables().

00855 { 00856 PCALLPROCDATA pCPD; 00857 LRESULT lRet = 0; 00858 00859 if (pCPD = HMValidateHandleNoRip((PVOID)xParam, TYPE_CALLPROC)) { 00860 00861 lRet = ScSendMessage(pwnd, 00862 message, 00863 wParam, 00864 lParam, 00865 pCPD->pfnClientPrevious, 00866 gpsi->apfnClientW.pfnDispatchMessage, 00867 (pCPD->wType & CPD_UNICODE_TO_ANSI) ? 00868 SCMS_FLAGS_ANSI : 0); 00869 00870 } else { 00871 00872 /* 00873 * If it is not a real call proc handle it must be a special 00874 * handler for editwndproc or regular EditWndProc 00875 */ 00876 lRet = ScSendMessage(pwnd, 00877 message, 00878 wParam, 00879 lParam, 00880 xParam, 00881 gpsi->apfnClientA.pfnDispatchMessage, 00882 (xParam == (ULONG_PTR)gpsi->apfnClientA.pfnEditWndProc) ? 00883 SCMS_FLAGS_ANSI : 0); 00884 } 00885 00886 return lRet; 00887 }

LRESULT xxxWrapSendMessage PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
ULONG_PTR  xParam
 

Definition at line 763 of file kernel/server.c.

References NULL, and xxxSendMessageTimeout().

Referenced by InitFunctionTables().

00769 { 00770 DBG_UNREFERENCED_PARAMETER(xParam); 00771 00772 return xxxSendMessageTimeout(pwnd, 00773 message, 00774 wParam, 00775 lParam, 00776 SMTO_NORMAL, 00777 0, 00778 NULL); 00779 }

LRESULT xxxWrapSendMessageBSM PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
ULONG_PTR  xParam
 

Definition at line 781 of file kernel/server.c.

References BROADCASTSYSTEMMSGPARAMS::dwRecipients, FALSE, IsPrivileged(), LPBROADCASTSYSTEMMSGPARAMS, ProbeAndReadBroadcastSystemMsgParams, psTcb, and xxxSendMessageBSM().

Referenced by InitFunctionTables().

00787 { 00788 BROADCASTSYSTEMMSGPARAMS bsmParams; 00789 00790 try { 00791 bsmParams = ProbeAndReadBroadcastSystemMsgParams((LPBROADCASTSYSTEMMSGPARAMS)xParam); 00792 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00793 return 0; 00794 } 00795 00796 /* 00797 * If this broadcast is going to all desktops, make sure the thread has 00798 * sufficient privileges. Do the check here, so we don't effect kernel 00799 * generated broadcasts (i.e power messages). 00800 */ 00801 if (bsmParams.dwRecipients & (BSM_ALLDESKTOPS)) { 00802 if (!IsPrivileged(&psTcb)) { 00803 bsmParams.dwRecipients &= ~(BSM_ALLDESKTOPS); 00804 } 00805 } 00806 00807 return xxxSendMessageBSM(pwnd, 00808 message, 00809 wParam, 00810 lParam, 00811 &bsmParams); 00812 }


Variable Documentation

CONST WORD gawButtonWndProc[]
 

Definition at line 251 of file kernel/server.c.

CONST WORD gawComboWndProc[]
 

Definition at line 378 of file kernel/server.c.

CONST WORD gawDefDlgProc[]
 

Definition at line 113 of file kernel/server.c.

CONST WORD gawDefWindowMsgs[]
 

Definition at line 589 of file kernel/server.c.

CONST WORD gawDefWindowSpecMsgs[]
 

Definition at line 637 of file kernel/server.c.

CONST WORD gawDesktopWndProc[]
 

Initial value:

{ WM_PAINT, WM_ERASEBKGND, 0 }

Definition at line 192 of file kernel/server.c.

CONST WORD gawEditWndProc[]
 

Definition at line 467 of file kernel/server.c.

CONST WORD gawImeWndProc[]
 

Initial value:

{ WM_ERASEBKGND, WM_PAINT, WM_DESTROY, WM_NCDESTROY, WM_FINALDESTROY, WM_CREATE, WM_IME_SYSTEM, WM_IME_SELECT, WM_IME_CONTROL, WM_IME_SETCONTEXT, WM_IME_NOTIFY, WM_IME_COMPOSITION, WM_IME_STARTCOMPOSITION, WM_IME_ENDCOMPOSITION, WM_IME_REQUEST, WM_COPYDATA, 0 }

Definition at line 565 of file kernel/server.c.

CONST WORD gawListboxWndProc[]
 

Definition at line 288 of file kernel/server.c.

CONST WORD gawMenuWndProc[]
 

Definition at line 149 of file kernel/server.c.

CONST WORD gawScrollBarWndProc[]
 

Initial value:

{ WM_CREATE, WM_SETFOCUS, WM_KILLFOCUS, WM_ERASEBKGND, WM_PAINT, WM_LBUTTONDBLCLK, WM_LBUTTONDOWN, WM_KEYUP, WM_KEYDOWN, WM_ENABLE, SBM_ENABLE_ARROWS, SBM_SETPOS, SBM_SETRANGEREDRAW, SBM_SETRANGE, SBM_SETSCROLLINFO, SBM_GETSCROLLINFO, WM_PRINTCLIENT, WM_MOUSEMOVE, WM_MOUSELEAVE, 0 }

Definition at line 198 of file kernel/server.c.

CONST WORD gawStaticWndProc[]
 

Initial value:

{ STM_GETICON, STM_GETIMAGE, STM_SETICON, STM_SETIMAGE, WM_ERASEBKGND, WM_PAINT, WM_PRINTCLIENT, WM_CREATE, WM_DESTROY, WM_NCCREATE, WM_NCDESTROY, WM_FINALDESTROY, WM_NCHITTEST, WM_LBUTTONDOWN, WM_NCLBUTTONDOWN, WM_LBUTTONDBLCLK, WM_NCLBUTTONDBLCLK, WM_SETTEXT, WM_ENABLE, WM_GETDLGCODE, WM_SETFONT, WM_GETFONT, WM_GETTEXT, WM_TIMER, WM_INPUTLANGCHANGEREQUEST, WM_UPDATEUISTATE, 0 }

Definition at line 221 of file kernel/server.c.

BOOL gbUserInitialized
 

Definition at line 16 of file kernel/server.c.

Referenced by UserInitialize(), and UserThreadCallout().

WORD gDispatchTableValues
 

Definition at line 14 of file kernel/server.c.

int giSetupExe
 

Definition at line 1547 of file kernel/server.c.

Referenced by CreateSetupNameArray(), and SetAppImeCompatFlags().

WCHAR* glpSetupPrograms
 

Definition at line 1550 of file kernel/server.c.

Referenced by CreateSetupNameArray(), and Win32kNtUserCleanup().

UNICODE_STRING* gpastrSetupExe
 

Definition at line 1546 of file kernel/server.c.

CONST LPCWSTR lpszControls[] [static]
 

Initial value:

{ L"Button", L"Edit", L"Static", L"ListBox", L"ScrollBar", L"ComboBox", L"MDIClient", L"ComboLBox", L"DDEMLEvent", L"DDEMLMom", L"DMGClass", L"DDEMLAnsiClient", L"DDEMLUnicodeClient", L"DDEMLAnsiServer", L"DDEMLUnicodeServer", L"IME", }

Definition at line 714 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST LPCWSTR lpszOLEFormats[] [static]
 

Initial value:

{ L"ObjectLink", L"OwnerLink", L"Native", L"Binary", L"FileName", L"FileNameW", L"NetworkName", L"DataObject", L"Embedded Object", L"Embed Source", L"Custom Link Source", L"Link Source", L"Object Descriptor", L"Link Source Descriptor", L"OleDraw", L"PBrush", L"MSDraw", L"Ole Private Data", L"Screen Picture", L"OleClipboardPersistOnFlush", L"MoreOlePrivateData" }

Definition at line 690 of file kernel/server.c.

Referenced by InitOLEFormats().

CONST WCHAR szACTIVATESHELLWINDOW[] = L"ACTIVATESHELLWINDOW"
 

Definition at line 82 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szCHECKPOINT_PROP_NAME[] = L"SysCP"
 

Definition at line 69 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szCONTEXTHELPIDPROP[] = L"SysCH"
 

Definition at line 78 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szDDEIMP_PROP_NAME[] = L"SysDDEI"
 

Definition at line 72 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szDDETRACK_PROP_NAME[] = L"SysDT"
 

Definition at line 70 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szFLASHWSTATE[] = L"FlashWState"
 

Definition at line 86 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szICON_PROP_NAME[] = ICON_PROP_NAME
 

Definition at line 80 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szICONSM_PROP_NAME[] = L"SysICS"
 

Definition at line 79 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szIMELEVEL_PROP_NAME[] = L"SysIMEL"
 

Definition at line 74 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szLAYER_PROP_NAME[] = L"SysLayer"
 

Definition at line 75 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szMESSAGE[] = L"Message"
 

Definition at line 77 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szOLEMAINTHREADWNDCLASS[] = L"OleMainThreadWndClass"
 

Definition at line 85 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szOTHERWINDOWCREATED[] = L"OTHERWINDOWCREATED"
 

Definition at line 83 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szOTHERWINDOWDESTROYED[] = L"OTHERWINDOWDESTROYED"
 

Definition at line 84 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szQOS_PROP_NAME[] = L"SysQOS"
 

Definition at line 71 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szSHELLHOOK[] = L"SHELLHOOK"
 

Definition at line 81 of file kernel/server.c.

Referenced by SetupClassAtoms().

CONST WCHAR szUSER32[] = L"USER32"
 

Definition at line 76 of file kernel/server.c.

CONST WCHAR szWNDOBJ_PROP_NAME[] = L"SysWNDO"
 

Definition at line 73 of file kernel/server.c.

Referenced by SetupClassAtoms().


Generated on Sat May 15 19:45:37 2004 for test by doxygen 1.3.7