ReactOS  0.4.15-dev-3453-gff89651
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  {
182  case DomainDisplayUser:
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
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:240
static NTSTATUS SampFillUserDisplayCache(_In_ PSAM_DB_OBJECT DomainObject)
Definition: display.c:36

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 
53  if (UserListFilled)
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 
121  InsertTailList(&UserListHead, &UserEntry->ListEntry);
122  UserListCount++;
123  }
124  }
125  }
126 
127  SampCloseDbObject(UserObject);
128  }
129  }
130 
131 done:
132  if (Status == STATUS_SUCCESS)
134 
135  FIXME("SampFillUserDisplayCache() done (Status 0x%08lx)\n", Status);
136 
137  return Status;
138 }
struct _SAM_USER_FIXED_DATA SAM_USER_FIXED_DATA
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:205
SAMPR_DOMAIN_DISPLAY_USER User
Definition: display.c:19
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
unsigned long Rid
Definition: sam.idl:296
#define InsertTailList(ListHead, Entry)
#define L(x)
Definition: ntvdm.h:50
static ULONG UserListCount
Definition: display.c:25
#define FIXME(fmt,...)
Definition: debug.h:111
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
Status
Definition: gdiplustypes.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static LIST_ENTRY UserListHead
Definition: display.c:23
NTSTATUS SampRegEnumerateSubKey(IN HANDLE KeyHandle, IN ULONG Index, IN ULONG Length, OUT LPWSTR Buffer)
Definition: registry.c:101
#define USER_NORMAL_ACCOUNT
Definition: ntsam.h:171
NTSTATUS SampCloseDbObject(PSAM_DB_OBJECT DbObject)
Definition: database.c:346
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
unsigned long AccountControl
Definition: sam.idl:297
static BOOLEAN UserListFilled
Definition: display.c:24
NTSTATUS SampRegOpenKey(IN HANDLE ParentKeyHandle, IN LPCWSTR KeyName, IN ACCESS_MASK DesiredAccess, OUT PHANDLE KeyHandle)
Definition: registry.c:158
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
Definition: display.c:16
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
ULONG UserAccountControl
Definition: samsrv.h:109
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
_In_ ULONG DataType
Definition: iotypes.h:820
LIST_ENTRY ListEntry
Definition: display.c:18
#define ULONG_MAX
Definition: limits.h:44
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

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
static ULONG UserListCount
Definition: display.c:25
#define TRACE(s)
Definition: solgame.cpp:4
static LIST_ENTRY UserListHead
Definition: display.c:23
static BOOLEAN UserListFilled
Definition: display.c:24
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define STATUS_SUCCESS
Definition: shellext.h:65

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 }
#define TRACE(s)
Definition: solgame.cpp:4
#define STATUS_SUCCESS
Definition: shellext.h:65

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().