ReactOS 0.4.15-dev-7889-g76290a6
display.c File Reference
#include "samsrv.h"
#include <winuser.h>
Include dependency graph for display.c:

Go to the source code of this file.

Classes

struct  _USER_ENTRY
 

Typedefs

typedef struct _USER_ENTRY USER_ENTRY
 
typedef struct _USER_ENTRYPUSER_ENTRY
 

Functions

static NTSTATUS SampFillUserDisplayCache (_In_ PSAM_DB_OBJECT DomainObject)
 
NTSTATUS SampInitializeDisplayCache (VOID)
 
NTSTATUS SampShutdownDisplayCache (VOID)
 
NTSTATUS SampFillDisplayCache (_In_ PSAM_DB_OBJECT DomainObject, _In_ DOMAIN_DISPLAY_INFORMATION DisplayInformationClass)
 

Variables

static LIST_ENTRY UserListHead
 
static BOOLEAN UserListFilled = FALSE
 
static ULONG UserListCount = 0
 

Typedef Documentation

◆ PUSER_ENTRY

◆ USER_ENTRY

Function Documentation

◆ SampFillDisplayCache()

NTSTATUS SampFillDisplayCache ( _In_ PSAM_DB_OBJECT  DomainObject,
_In_ DOMAIN_DISPLAY_INFORMATION  DisplayInformationClass 
)

Definition at line 172 of file display.c.

175{
177
178 TRACE("SampFillDisplayCache()\n");
179
180 switch (DisplayInformationClass)
181 {
183 Status = SampFillUserDisplayCache(DomainObject);
184 break;
185/*
186 case DomainDisplayMachine:
187 Status = SampFillMachineDisplayCache(DomainObject);
188 break;
189
190 case DomainDisplayGroup:
191 Status = SampFillGroupDisplayCache(DomainObject);
192 break;
193*/
194 default:
196 break;
197 }
198
199 return Status;
200}
LONG NTSTATUS
Definition: precomp.h:26
static NTSTATUS SampFillUserDisplayCache(_In_ PSAM_DB_OBJECT DomainObject)
Definition: display.c:36
Status
Definition: gdiplustypes.h:25
@ DomainDisplayUser
Definition: ntsam.h:303
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:240
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by SamrQueryDisplayInformation3().

◆ SampFillUserDisplayCache()

static NTSTATUS SampFillUserDisplayCache ( _In_ PSAM_DB_OBJECT  DomainObject)
static

Definition at line 36 of file display.c.

38{
39 HANDLE UsersKeyHandle = NULL;
40 WCHAR UserKeyName[64];
41 ULONG EnumIndex;
42 ULONG NameLength;
43 ULONG Rid;
44 PSAM_DB_OBJECT UserObject;
45 SAM_USER_FIXED_DATA FixedUserData;
46 ULONG Size;
48 PUSER_ENTRY UserEntry;
50
51 FIXME("SampFillUserDisplayCache(%p)\n", DomainObject);
52
54 {
55 FIXME("Already filled!\n");
56 return STATUS_SUCCESS;
57 }
58
59 Status = SampRegOpenKey(DomainObject->KeyHandle,
60 L"Users",
61 KEY_ALL_ACCESS, /* FIXME */
62 &UsersKeyHandle);
63 if (!NT_SUCCESS(Status))
64 goto done;
65
66 for (EnumIndex = 0; ; EnumIndex++)
67 {
68 FIXME("EnumIndex: %lu\n", EnumIndex);
69 NameLength = 64 * sizeof(WCHAR);
70 Status = SampRegEnumerateSubKey(UsersKeyHandle,
71 EnumIndex,
72 NameLength,
73 UserKeyName);
74 if (!NT_SUCCESS(Status))
75 {
78 break;
79 }
80
81 FIXME("User name: %S\n", UserKeyName);
82 FIXME("Name length: %lu\n", NameLength);
83
84 Rid = wcstoul(UserKeyName, NULL, 16);
85 if (Rid == 0 || Rid == ULONG_MAX)
86 continue;
87
88 FIXME("Rid: 0x%lx\n", Rid);
89 Status = SampOpenDbObject(DomainObject,
90 L"Users",
91 UserKeyName,
92 Rid,
94 0,
95 &UserObject);
96 if (NT_SUCCESS(Status))
97 {
98 Size = sizeof(SAM_USER_FIXED_DATA);
99 Status = SampGetObjectAttribute(UserObject,
100 L"F",
101 &DataType,
102 (LPVOID)&FixedUserData,
103 &Size);
104 if (NT_SUCCESS(Status))
105 {
106 FIXME("Account control: 0x%lx\n", FixedUserData.UserAccountControl);
107
108 if (FixedUserData.UserAccountControl & USER_NORMAL_ACCOUNT)
109 {
110 UserEntry = RtlAllocateHeap(RtlGetProcessHeap(),
112 sizeof(USER_ENTRY));
113 if (UserEntry != NULL)
114 {
115
116 UserEntry->User.Rid = Rid;
117 UserEntry->User.AccountControl = FixedUserData.UserAccountControl;
118
119 /* FIXME: Add remaining attributes */
120
123 }
124 }
125 }
126
127 SampCloseDbObject(UserObject);
128 }
129 }
130
131done:
132 if (Status == STATUS_SUCCESS)
134
135 FIXME("SampFillUserDisplayCache() done (Status 0x%08lx)\n", Status);
136
137 return Status;
138}
#define FIXME(fmt,...)
Definition: debug.h:111
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
NTSTATUS SampCloseDbObject(PSAM_DB_OBJECT DbObject)
Definition: database.c:346
NTSTATUS SampOpenDbObject(IN PSAM_DB_OBJECT ParentObject, IN LPWSTR ContainerName, IN LPWSTR ObjectName, IN ULONG RelativeId, IN SAM_DB_OBJECT_TYPE ObjectType, IN ACCESS_MASK DesiredAccess, OUT PSAM_DB_OBJECT *DbObject)
Definition: database.c:173
static BOOLEAN UserListFilled
Definition: display.c:24
static LIST_ENTRY UserListHead
Definition: display.c:23
static ULONG UserListCount
Definition: display.c:25
NTSTATUS SampRegOpenKey(IN HANDLE ParentKeyHandle, IN LPCWSTR KeyName, IN ACCESS_MASK DesiredAccess, OUT PHANDLE KeyHandle)
Definition: registry.c:158
NTSTATUS SampRegEnumerateSubKey(IN HANDLE KeyHandle, IN ULONG Index, IN ULONG Length, OUT LPWSTR Buffer)
Definition: registry.c:101
struct _SAM_USER_FIXED_DATA SAM_USER_FIXED_DATA
@ SamDbUserObject
Definition: samsrv.h:42
#define InsertTailList(ListHead, Entry)
#define ULONG_MAX
Definition: limits.h:44
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define USER_NORMAL_ACCOUNT
Definition: ntsam.h:171
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:205
#define L(x)
Definition: ntvdm.h:50
#define STATUS_SUCCESS
Definition: shellext.h:65
DataType
Definition: simd.h:252
unsigned long AccountControl
Definition: sam.idl:297
unsigned long Rid
Definition: sam.idl:296
ULONG UserAccountControl
Definition: samsrv.h:109
Definition: display.c:17
LIST_ENTRY ListEntry
Definition: display.c:18
SAMPR_DOMAIN_DISPLAY_USER User
Definition: display.c:19
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by SampFillDisplayCache().

◆ SampInitializeDisplayCache()

NTSTATUS SampInitializeDisplayCache ( VOID  )

Definition at line 143 of file display.c.

144{
145 TRACE("SampInitializeDisplayCache()\n");
146
149 UserListCount = 0;
150
151// InitializeListHead(&MachineListHead);
152// MachineListFilled = FALSE;
153// MachineListCount = 0;
154
155// InitializeListHead(&GroupListHead);
156// GroupListFilled = FALSE;
157// GroupListCount = 0;
158
159 return STATUS_SUCCESS;
160}
#define FALSE
Definition: types.h:117
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944

Referenced by SamIInitialize().

◆ SampShutdownDisplayCache()

NTSTATUS SampShutdownDisplayCache ( VOID  )

Definition at line 164 of file display.c.

165{
166 TRACE("SampShutdownDisplayCache()\n");
167 return STATUS_SUCCESS;
168}

Referenced by SamrShutdownSamServer().

Variable Documentation

◆ UserListCount

ULONG UserListCount = 0
static

Definition at line 25 of file display.c.

Referenced by SampFillUserDisplayCache(), and SampInitializeDisplayCache().

◆ UserListFilled

BOOLEAN UserListFilled = FALSE
static

Definition at line 24 of file display.c.

Referenced by SampFillUserDisplayCache(), and SampInitializeDisplayCache().

◆ UserListHead

LIST_ENTRY UserListHead
static

Definition at line 23 of file display.c.

Referenced by SampFillUserDisplayCache(), and SampInitializeDisplayCache().