test: win32.c Source File

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

# win32.c

Go to the documentation of this file.

    00001 /*++
    00002
    00003 Copyright (c) 1995  Microsoft Corporation
    00004
    00005 Module Name:
    00006
    00007     win32.c
    00008
    00009 Abstract:
    00010
    00011    This module implements the definition of the executive Win32 objects.
    00012    Functions to manage these objects are implemented in win32k.sys.
    00013
    00014 Author:
    00015
    00016     James I. Anderson (jima) 14-June-1995
    00017
    00018 Environment:
    00019
    00020     Kernel mode only.
    00021
    00022 Revision History:
    00023
    00024 --*/
    00025
    00026 #include "exp.h"
    00027
    00028 //
    00029 // Address of windowstation and desktop object type descriptors.
    00030 //
    00031
    00032 POBJECT_TYPE ExWindowStationObjectType;
    00033 POBJECT_TYPE ExDesktopObjectType;
    00034
    00035 /*
    00036  * windowstation generic mapping
    00037  */
    00038 GENERIC_MAPPING ExpWindowStationMapping = {
    00039     STANDARD_RIGHTS_READ,
    00040     STANDARD_RIGHTS_WRITE,
    00041     STANDARD_RIGHTS_EXECUTE,
    00042     STANDARD_RIGHTS_REQUIRED
    00043 };
    00044
    00045 /*
    00046  * desktop generic mapping
    00047  */
    00048 GENERIC_MAPPING ExpDesktopMapping = {
    00049     STANDARD_RIGHTS_READ,
    00050     STANDARD_RIGHTS_WRITE,
    00051     STANDARD_RIGHTS_EXECUTE,
    00052     STANDARD_RIGHTS_REQUIRED
    00053 };
    00054
    00055 #ifdef ALLOC_PRAGMA
    00056 #pragma alloc_text(INIT, ExpWin32Initialization)
    00057 #endif
    00058
    00059 BOOLEAN
    00060 ExpWin32Initialization (
    00061     )
    00062
    00063 /*++
    00064
    00065 Routine Description:
    00066
    00067     This function creates the Win32 object type descriptors at system
    00068     initialization and stores the address of the object type descriptor
    00069     in local static storage.
    00070
    00071 Arguments:
    00072
    00073     None.
    00074
    00075 Return Value:
    00076
    00077     A value of TRUE is returned if the Win32 object type descriptors are
    00078     successfully created. Otherwise a value of FALSE is returned.
    00079
    00080 --*/
    00081
    00082 {
    00083
    00084     OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
    00085     NTSTATUS Status;
    00086     UNICODE_STRING TypeName;
    00087
    00088     //
    00089     // Initialize string descriptor.
    00090     //
    00091
    00092     RtlInitUnicodeString(&TypeName, L"WindowStation");
    00093
    00094     //
    00095     // Create windowstation object type descriptor.
    00096     //
    00097
    00098     RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
    00099     ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
    00100     ObjectTypeInitializer.GenericMapping = ExpWindowStationMapping;
    00101     ObjectTypeInitializer.SecurityRequired = TRUE;
    00102     ObjectTypeInitializer.PoolType = NonPagedPool;
    00103     ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK |
    00104                                               OBJ_PERMANENT |
    00105                                               OBJ_EXCLUSIVE;
    00106     ObjectTypeInitializer.ValidAccessMask = STANDARD_RIGHTS_REQUIRED;
    00107     Status = ObCreateObjectType(&TypeName,
    00108                                 &ObjectTypeInitializer,
    00109                                 (PSECURITY_DESCRIPTOR)NULL,
    00110                                 &ExWindowStationObjectType);
    00111
    00112     //
    00113     // If the windowstation object type descriptor was not successfully
    00114     // created, then return a value of FALSE.
    00115     //
    00116
    00117     if (!NT_SUCCESS(Status))
    00118         return FALSE;
    00119
    00120     //
    00121     // Initialize string descriptor.
    00122     //
    00123
    00124     RtlInitUnicodeString(&TypeName, L"Desktop");
    00125
    00126     //
    00127     // Create windowstation object type descriptor.
    00128     //
    00129
    00130     ObjectTypeInitializer.GenericMapping = ExpDesktopMapping;
    00131     Status = ObCreateObjectType(&TypeName,
    00132                                 &ObjectTypeInitializer,
    00133                                 (PSECURITY_DESCRIPTOR)NULL,
    00134                                 &ExDesktopObjectType);
    00135
    00136     //
    00137     // If the desktop object type descriptor was successfully created, then
    00138     // return a value of TRUE. Otherwise return a value of FALSE.
    00139     //
    00140
    00141     return (BOOLEAN)(NT_SUCCESS(Status));
    00142 }