ReactOS 0.4.15-dev-8428-g6910fa6
display.c File Reference
#include "netapi32.h"
Include dependency graph for display.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (netapi32)
 
NET_API_STATUS WINAPI NetQueryDisplayInformation (_In_ LPCWSTR ServerName, _In_ DWORD Level, _In_ DWORD Index, _In_ DWORD EntriesRequested, _In_ DWORD PreferredMaximumLength, _Out_ LPDWORD ReturnedEntryCount, _Out_ PVOID *SortedBuffer)
 
NET_API_STATUS WINAPI NetGetDisplayInformationIndex (_In_ LPCWSTR ServerName, _In_ DWORD Level, _In_ LPCWSTR Prefix, _Out_ LPDWORD Index)
 

Function Documentation

◆ NetGetDisplayInformationIndex()

NET_API_STATUS WINAPI NetGetDisplayInformationIndex ( _In_ LPCWSTR  ServerName,
_In_ DWORD  Level,
_In_ LPCWSTR  Prefix,
_Out_ LPDWORD  Index 
)

Definition at line 124 of file display.c.

129{
130 UNICODE_STRING ServerNameString, PrefixString;
131 SAM_HANDLE ServerHandle = NULL;
132 SAM_HANDLE DomainHandle = NULL;
133 DOMAIN_DISPLAY_INFORMATION DisplayInformation;
134 NET_API_STATUS ApiStatus = NERR_Success;
136
137 TRACE("NetGetDisplayInformationIndex(%s %ld %s %p)\n",
138 debugstr_w(ServerName), Level, debugstr_w(Prefix), Index);
139
140 switch (Level)
141 {
142 case 1:
143 DisplayInformation = DomainDisplayUser;
144 break;
145
146 case 2:
147 DisplayInformation = DomainDisplayMachine;
148 break;
149
150 case 3:
151 DisplayInformation = DomainDisplayGroup;
152 break;
153
154 default:
155 return ERROR_INVALID_LEVEL;
156 }
157
158 if (ServerName != NULL)
159 RtlInitUnicodeString(&ServerNameString, ServerName);
160
161 /* Connect to the SAM Server */
162 Status = SamConnect((ServerName != NULL) ? &ServerNameString : NULL,
163 &ServerHandle,
165 NULL);
166 if (!NT_SUCCESS(Status))
167 {
168 ERR("SamConnect failed (Status %08lx)\n", Status);
169 ApiStatus = NetpNtStatusToApiStatus(Status);
170 goto done;
171 }
172
173 /* Open the Account Domain */
174 Status = OpenAccountDomain(ServerHandle,
175 (ServerName != NULL) ? &ServerNameString : NULL,
177 &DomainHandle);
178 if (!NT_SUCCESS(Status))
179 {
180 ERR("OpenAccountDomain failed (Status %08lx)\n", Status);
181 ApiStatus = NetpNtStatusToApiStatus(Status);
182 goto done;
183 }
184
185 RtlInitUnicodeString(&PrefixString, Prefix);
186
187 /* Get the index */
189 DisplayInformation,
190 &PrefixString,
191 Index);
192 if (!NT_SUCCESS(Status))
193 {
194 ERR("SamGetDisplayEnumerationIndex failed (Status %08lx)\n", Status);
195 ApiStatus = NetpNtStatusToApiStatus(Status);
196 }
197
198done:
199 if (DomainHandle != NULL)
200 SamCloseHandle(DomainHandle);
201
202 if (ServerHandle != NULL)
203 SamCloseHandle(ServerHandle);
204
205 return ApiStatus;
206}
LONG NTSTATUS
Definition: precomp.h:26
#define ERR(fmt,...)
Definition: precomp.h:57
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
NET_API_STATUS WINAPI NetpNtStatusToApiStatus(_In_ NTSTATUS Status)
Definition: misc.c:289
Status
Definition: gdiplustypes.h:25
#define debugstr_w
Definition: kernel32.h:32
#define NERR_Success
Definition: lmerr.h:5
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
NTSTATUS OpenAccountDomain(IN SAM_HANDLE ServerHandle, IN PUNICODE_STRING ServerName, IN ULONG DesiredAccess, OUT PSAM_HANDLE DomainHandle)
Definition: utils.c:113
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
enum _DOMAIN_DISPLAY_INFORMATION DOMAIN_DISPLAY_INFORMATION
#define SAM_SERVER_LOOKUP_DOMAIN
Definition: ntsam.h:104
#define SAM_SERVER_CONNECT
Definition: ntsam.h:99
@ DomainDisplayUser
Definition: ntsam.h:303
@ DomainDisplayMachine
Definition: ntsam.h:304
@ DomainDisplayGroup
Definition: ntsam.h:305
#define DOMAIN_LIST_ACCOUNTS
Definition: ntsam.h:41
NTSTATUS NTAPI SamGetDisplayEnumerationIndex(IN SAM_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformation, IN PUNICODE_STRING Prefix, OUT PULONG Index)
Definition: samlib.c:1061
NTSTATUS NTAPI SamConnect(IN OUT PUNICODE_STRING ServerName OPTIONAL, OUT PSAM_HANDLE ServerHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: samlib.c:519
NTSTATUS NTAPI SamCloseHandle(IN SAM_HANDLE SamHandle)
Definition: samlib.c:497
#define TRACE(s)
Definition: solgame.cpp:4
_In_ WDFCOLLECTION _In_ ULONG Index
#define ERROR_INVALID_LEVEL
Definition: winerror.h:196
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:56
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1630

◆ NetQueryDisplayInformation()

NET_API_STATUS WINAPI NetQueryDisplayInformation ( _In_ LPCWSTR  ServerName,
_In_ DWORD  Level,
_In_ DWORD  Index,
_In_ DWORD  EntriesRequested,
_In_ DWORD  PreferredMaximumLength,
_Out_ LPDWORD  ReturnedEntryCount,
_Out_ PVOID SortedBuffer 
)

Definition at line 20 of file display.c.

28{
29 UNICODE_STRING ServerNameString;
30 SAM_HANDLE ServerHandle = NULL;
31 SAM_HANDLE DomainHandle = NULL;
32 DOMAIN_DISPLAY_INFORMATION DisplayInformation;
33 DWORD LocalTotalBytesAvailable;
34 DWORD LocalTotalBytesReturned;
35 DWORD LocalReturnedEntryCount;
36 PVOID LocalSortedBuffer;
37 NET_API_STATUS ApiStatus = NERR_Success;
39
40 TRACE("NetQueryDisplayInformation(%s, %ld, %ld, %ld, %ld, %p, %p)\n",
41 debugstr_w(ServerName), Level, Index, EntriesRequested,
42 PreferredMaximumLength, ReturnedEntryCount, SortedBuffer);
43
44 *ReturnedEntryCount = 0;
45 *SortedBuffer = NULL;
46
47 switch (Level)
48 {
49 case 1:
50 DisplayInformation = DomainDisplayUser;
51 break;
52
53 case 2:
54 DisplayInformation = DomainDisplayMachine;
55 break;
56
57 case 3:
58 DisplayInformation = DomainDisplayGroup;
59 break;
60
61 default:
63 }
64
65 if (ServerName != NULL)
66 RtlInitUnicodeString(&ServerNameString, ServerName);
67
68 /* Connect to the SAM Server */
69 Status = SamConnect((ServerName != NULL) ? &ServerNameString : NULL,
70 &ServerHandle,
72 NULL);
73 if (!NT_SUCCESS(Status))
74 {
75 ERR("SamConnect failed (Status %08lx)\n", Status);
77 goto done;
78 }
79
80 /* Open the Account Domain */
81 Status = OpenAccountDomain(ServerHandle,
82 (ServerName != NULL) ? &ServerNameString : NULL,
84 &DomainHandle);
85 if (!NT_SUCCESS(Status))
86 {
87 ERR("OpenAccountDomain failed (Status %08lx)\n", Status);
89 goto done;
90 }
91
92 /* Query the information */
94 DisplayInformation,
95 Index,
96 EntriesRequested,
97 PreferredMaximumLength,
98 &LocalTotalBytesAvailable,
99 &LocalTotalBytesReturned,
100 &LocalReturnedEntryCount,
101 &LocalSortedBuffer);
102 if (!NT_SUCCESS(Status))
103 {
104 ERR("SamQueryDisplayInformation failed (Status %08lx)\n", Status);
105 ApiStatus = NetpNtStatusToApiStatus(Status);
106 goto done;
107 }
108
109 /* FIXME */
110
111done:
112 if (DomainHandle != NULL)
113 SamCloseHandle(DomainHandle);
114
115 if (ServerHandle != NULL)
116 SamCloseHandle(ServerHandle);
117
118 return ApiStatus;
119}
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSTATUS NTAPI SamQueryDisplayInformation(IN SAM_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformation, IN ULONG Index, IN ULONG EntryCount, IN ULONG PreferredMaximumLength, OUT PULONG TotalAvailable, OUT PULONG TotalReturned, OUT PULONG ReturnedEntryCount, OUT PVOID *SortedBuffer)
Definition: samlib.c:1564

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( netapi32  )