ReactOS 0.4.16-dev-2332-g4cba65d
lsa.c
Go to the documentation of this file.
1/*
2 * Unit tests for lsa functions
3 *
4 * Copyright (c) 2006 Robert Reif
5 * Copyright (c) 2020 Dmitry Timoshkov
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#include <stdarg.h>
23#include <stdio.h>
24
25#include "ntstatus.h"
26#define WIN32_NO_STATUS
27#include "windef.h"
28#include "winbase.h"
29#include "winreg.h"
30#include "ntsecapi.h"
31#include "sddl.h"
32#include "winnls.h"
33#include "objbase.h"
34#include "initguid.h"
35#include "wine/test.h"
36#include "winternl.h"
37#include "ntlsa.h"
38
39DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
40
41static BOOL (WINAPI *pGetSystemPreferredUILanguages)(DWORD, ULONG*, WCHAR*, ULONG*);
43
44static void test_lsa(void)
45{
48 LSA_OBJECT_ATTRIBUTES object_attributes;
49
50 ZeroMemory(&object_attributes, sizeof(object_attributes));
51 object_attributes.Length = sizeof(object_attributes);
52
53 status = LsaOpenPolicy( NULL, &object_attributes, POLICY_ALL_ACCESS, &handle);
55 "LsaOpenPolicy(POLICY_ALL_ACCESS) returned 0x%08lx\n", status);
56
57 /* try a more restricted access mask if necessary */
59 trace("LsaOpenPolicy(POLICY_ALL_ACCESS) failed, trying POLICY_VIEW_LOCAL_INFORMATION|POLICY_LOOKUP_NAMES\n");
61 ok(status == STATUS_SUCCESS, "LsaOpenPolicy(POLICY_VIEW_LOCAL_INFORMATION|POLICY_LOOKUP_NAMES) returned 0x%08lx\n", status);
62 }
63
64 if (status == STATUS_SUCCESS) {
65 PPOLICY_AUDIT_EVENTS_INFO audit_events_info;
66 PPOLICY_PRIMARY_DOMAIN_INFO primary_domain_info;
67 PPOLICY_ACCOUNT_DOMAIN_INFO account_domain_info;
68 PPOLICY_DNS_DOMAIN_INFO dns_domain_info;
70 BOOL ret;
71
74 skip("Not enough rights to retrieve PolicyAuditEventsInformation\n");
75 else
76 ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy(PolicyAuditEventsInformation) failed, returned 0x%08lx\n", status);
78 LsaFreeMemory(audit_events_info);
79
81 ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy(PolicyPrimaryDomainInformation) failed, returned 0x%08lx\n", status);
82 if (status == STATUS_SUCCESS) {
83 if (primary_domain_info->Sid) {
84 LPSTR strsid;
85 if (ConvertSidToStringSidA(primary_domain_info->Sid, &strsid))
86 {
87 if (primary_domain_info->Name.Buffer) {
88 LPSTR name = NULL;
89 UINT len;
90 len = WideCharToMultiByte( CP_ACP, 0, primary_domain_info->Name.Buffer, -1, NULL, 0, NULL, NULL );
91 name = LocalAlloc( 0, len );
92 WideCharToMultiByte( CP_ACP, 0, primary_domain_info->Name.Buffer, -1, name, len, NULL, NULL );
93 trace(" name: %s sid: %s\n", name, strsid);
94 LocalFree( name );
95 } else
96 trace(" name: NULL sid: %s\n", strsid);
97 LocalFree( strsid );
98 }
99 else
100 trace("invalid sid\n");
101 }
102 else
103 trace("Running on a standalone system.\n");
104 LsaFreeMemory(primary_domain_info);
105 }
106
108 ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy(PolicyAccountDomainInformation) failed, returned 0x%08lx\n", status);
109 if (status == STATUS_SUCCESS)
110 LsaFreeMemory(account_domain_info);
111
112 /* This isn't supported in NT4 */
115 "LsaQueryInformationPolicy(PolicyDnsDomainInformation) failed, returned 0x%08lx\n", status);
116 if (status == STATUS_SUCCESS) {
117 if (dns_domain_info->Sid || !IsEqualGUID(&dns_domain_info->DomainGuid, &GUID_NULL)) {
118 LPSTR strsid = NULL;
119 LPSTR name = NULL;
120 LPSTR domain = NULL;
121 LPSTR forest = NULL;
122 UINT len;
123 ConvertSidToStringSidA(dns_domain_info->Sid, &strsid);
124 if (dns_domain_info->Name.Buffer) {
125 len = WideCharToMultiByte( CP_ACP, 0, dns_domain_info->Name.Buffer, -1, NULL, 0, NULL, NULL );
126 name = LocalAlloc( 0, len );
127 WideCharToMultiByte( CP_ACP, 0, dns_domain_info->Name.Buffer, -1, name, len, NULL, NULL );
128 }
129 if (dns_domain_info->DnsDomainName.Buffer) {
130 len = WideCharToMultiByte( CP_ACP, 0, dns_domain_info->DnsDomainName.Buffer, -1, NULL, 0, NULL, NULL );
131 domain = LocalAlloc( 0, len );
132 WideCharToMultiByte( CP_ACP, 0, dns_domain_info->DnsDomainName.Buffer, -1, domain, len, NULL, NULL );
133 }
134 if (dns_domain_info->DnsForestName.Buffer) {
135 len = WideCharToMultiByte( CP_ACP, 0, dns_domain_info->DnsForestName.Buffer, -1, NULL, 0, NULL, NULL );
136 forest = LocalAlloc( 0, len );
137 WideCharToMultiByte( CP_ACP, 0, dns_domain_info->DnsForestName.Buffer, -1, forest, len, NULL, NULL );
138 }
139 trace(" name: %s domain: %s forest: %s guid: %s sid: %s\n",
141 debugstr_guid(&dns_domain_info->DomainGuid), debugstr_a(strsid));
142 LocalFree( name );
143 LocalFree( forest );
144 LocalFree( domain );
145 LocalFree( strsid );
146 }
147 else
148 trace("Running on a standalone system.\n");
149 LsaFreeMemory(dns_domain_info);
150 }
151
152 /* We need a valid SID to pass to LsaEnumerateAccountRights */
154 ok(ret, "Unable to obtain process token, error %lu\n", GetLastError( ));
155 if (ret) {
156 char buffer[64];
157 DWORD len;
158 TOKEN_USER *token_user = (TOKEN_USER *) buffer;
159 ret = GetTokenInformation( token, TokenUser, (LPVOID) token_user, sizeof(buffer), &len );
160 ok(ret || GetLastError( ) == ERROR_INSUFFICIENT_BUFFER, "Unable to obtain token information, error %lu\n", GetLastError( ));
162 trace("Resizing buffer to %lu.\n", len);
163 token_user = LocalAlloc( 0, len );
164 if (token_user != NULL)
165 ret = GetTokenInformation( token, TokenUser, (LPVOID) token_user, len, &len );
166 }
167
168 if (ret) {
169 PLSA_UNICODE_STRING rights;
170 ULONG rights_count;
171 rights = (PLSA_UNICODE_STRING) 0xdeadbeaf;
172 rights_count = 0xcafecafe;
173 status = LsaEnumerateAccountRights(handle, token_user->User.Sid, &rights, &rights_count);
174 ok(status == STATUS_SUCCESS || status == STATUS_OBJECT_NAME_NOT_FOUND, "Unexpected status 0x%lx\n", status);
175 if (status == STATUS_SUCCESS)
176 LsaFreeMemory( rights );
177 else
178 ok(rights == NULL && rights_count == 0, "Expected rights and rights_count to be set to 0 on failure\n");
179 }
180 if (token_user != NULL && token_user != (TOKEN_USER *) buffer)
181 LocalFree( token_user );
183 }
184
186 ok(status == STATUS_SUCCESS, "LsaClose() failed, returned 0x%08lx\n", status);
187 }
188}
189
190static void get_sid_info(PSID psid, LPSTR *user, LPSTR *dom)
191{
192 static char account[257], domain[257];
193 DWORD user_size, dom_size;
194 SID_NAME_USE use;
195 BOOL ret;
196
197 *user = account;
198 *dom = domain;
199
200 user_size = dom_size = 257;
201 account[0] = domain[0] = 0;
202 ret = LookupAccountSidA(NULL, psid, account, &user_size, domain, &dom_size, &use);
203 ok(ret, "LookupAccountSidA failed %lu\n", GetLastError());
204}
205
206static void test_LsaLookupNames2(void)
207{
208 static const WCHAR n1[] = {'L','O','C','A','L',' ','S','E','R','V','I','C','E'};
209 static const WCHAR n2[] = {'N','T',' ','A','U','T','H','O','R','I','T','Y','\\','L','o','c','a','l','S','e','r','v','i','c','e'};
210
217 LPSTR account, sid_dom;
218
221 {
222 skip("Non-English locale (skipping LsaLookupNames2 tests)\n");
223 return;
224 }
225
226 memset(&attrs, 0, sizeof(attrs));
227 attrs.Length = sizeof(attrs);
228
231 "LsaOpenPolicy(POLICY_ALL_ACCESS) returned 0x%08lx\n", status);
232
233 /* try a more restricted access mask if necessary */
235 {
236 trace("LsaOpenPolicy(POLICY_ALL_ACCESS) failed, trying POLICY_VIEW_LOCAL_INFORMATION\n");
238 ok(status == STATUS_SUCCESS, "LsaOpenPolicy(POLICY_VIEW_LOCAL_INFORMATION) returned 0x%08lx\n", status);
239 }
240 if (status != STATUS_SUCCESS)
241 {
242 skip("Cannot acquire policy handle\n");
243 return;
244 }
245
246 name[0].Buffer = malloc(sizeof(n1));
247 name[0].Length = name[0].MaximumLength = sizeof(n1);
248 memcpy(name[0].Buffer, n1, sizeof(n1));
249
250 name[1].Buffer = malloc(sizeof(n1));
251 name[1].Length = name[1].MaximumLength = sizeof(n1) - sizeof(WCHAR);
252 memcpy(name[1].Buffer, n1, sizeof(n1) - sizeof(WCHAR));
253
254 name[2].Buffer = malloc(sizeof(n2));
255 name[2].Length = name[2].MaximumLength = sizeof(n2);
256 memcpy(name[2].Buffer, n2, sizeof(n2));
257
258 /* account name only */
259 sids = NULL;
260 domains = NULL;
261 status = LsaLookupNames2(handle, 0, 1, &name[0], &domains, &sids);
262 ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %lx)\n", status);
263 ok(sids[0].Use == SidTypeWellKnownGroup, "expected SidTypeWellKnownGroup, got %u\n", sids[0].Use);
264 ok(sids[0].Flags == 0, "expected 0, got 0x%08lx\n", sids[0].Flags);
265 ok(domains->Entries == 1, "expected 1, got %lu\n", domains->Entries);
266 get_sid_info(sids[0].Sid, &account, &sid_dom);
267 ok(!strcmp(account, "LOCAL SERVICE"), "expected \"LOCAL SERVICE\", got \"%s\"\n", account);
268 ok(!strcmp(sid_dom, "NT AUTHORITY"), "expected \"NT AUTHORITY\", got \"%s\"\n", sid_dom);
269 LsaFreeMemory(sids);
270 LsaFreeMemory(domains);
271
272 /* unknown account name */
273 sids = NULL;
274 domains = NULL;
275 status = LsaLookupNames2(handle, 0, 1, &name[1], &domains, &sids);
276 ok(status == STATUS_NONE_MAPPED, "expected STATUS_NONE_MAPPED, got %lx)\n", status);
277 ok(sids[0].Use == SidTypeUnknown, "expected SidTypeUnknown, got %u\n", sids[0].Use);
278 ok(sids[0].Flags == 0, "expected 0, got 0x%08lx\n", sids[0].Flags);
279 ok(domains->Entries == 0, "expected 0, got %lu\n", domains->Entries);
280 LsaFreeMemory(sids);
281 LsaFreeMemory(domains);
282
283 /* account + domain */
284 sids = NULL;
285 domains = NULL;
286 status = LsaLookupNames2(handle, 0, 1, &name[2], &domains, &sids);
287 ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %lx)\n", status);
288 ok(sids[0].Use == SidTypeWellKnownGroup, "expected SidTypeWellKnownGroup, got %u\n", sids[0].Use);
289 ok(sids[0].Flags == 0, "expected 0, got 0x%08lx\n", sids[0].Flags);
290 ok(domains->Entries == 1, "expected 1, got %lu\n", domains->Entries);
291 get_sid_info(sids[0].Sid, &account, &sid_dom);
292 ok(!strcmp(account, "LOCAL SERVICE"), "expected \"LOCAL SERVICE\", got \"%s\"\n", account);
293 ok(!strcmp(sid_dom, "NT AUTHORITY"), "expected \"NT AUTHORITY\", got \"%s\"\n", sid_dom);
294 LsaFreeMemory(sids);
295 LsaFreeMemory(domains);
296
297 /* all three */
298 sids = NULL;
299 domains = NULL;
300 status = LsaLookupNames2(handle, 0, 3, name, &domains, &sids);
301 ok(status == STATUS_SOME_NOT_MAPPED, "expected STATUS_SOME_NOT_MAPPED, got %lx)\n", status);
302 ok(sids[0].Use == SidTypeWellKnownGroup, "expected SidTypeWellKnownGroup, got %u\n", sids[0].Use);
303 ok(sids[1].Use == SidTypeUnknown, "expected SidTypeUnknown, got %u\n", sids[1].Use);
304 ok(sids[2].Use == SidTypeWellKnownGroup, "expected SidTypeWellKnownGroup, got %u\n", sids[2].Use);
305 ok(sids[0].DomainIndex == 0, "expected 0, got %lu\n", sids[0].DomainIndex);
306 ok(domains->Entries == 1, "expected 1, got %lu\n", domains->Entries);
307 LsaFreeMemory(sids);
308 LsaFreeMemory(domains);
309
310 free(name[0].Buffer);
311 free(name[1].Buffer);
312 free(name[2].Buffer);
313
315 ok(status == STATUS_SUCCESS, "LsaClose() failed, returned 0x%08lx\n", status);
316}
317
318static void check_unicode_string_(int line, const LSA_UNICODE_STRING *string, const WCHAR *expect)
319{
320 ok_(__FILE__, line)(string->Length == wcslen(string->Buffer) * sizeof(WCHAR),
321 "expected %Iu, got %u\n", wcslen(string->Buffer) * sizeof(WCHAR), string->Length);
322 ok_(__FILE__, line)(string->MaximumLength == string->Length + sizeof(WCHAR),
323 "expected %Iu, got %u\n", string->Length + sizeof(WCHAR), string->MaximumLength);
324 ok_(__FILE__, line)(!wcsicmp(string->Buffer, expect), "expected %s, got %s\n",
326}
327#define check_unicode_string(a, b) check_unicode_string_(__LINE__, a, b)
328
329static void test_LsaLookupSids(void)
330{
331 WCHAR langW[32];
332 char user_buffer[64];
333 LSA_OBJECT_ATTRIBUTES attrs = {sizeof(attrs)};
334 TOKEN_USER *user = (TOKEN_USER *)user_buffer;
341 DWORD num, size;
342 BOOL ret;
343 PSID sid;
344
346 ok(status == STATUS_SUCCESS, "got 0x%08lx\n", status);
347
349 ok(ret, "OpenProcessToken() failed, error %lu\n", GetLastError());
350
351 ret = GetTokenInformation(token, TokenUser, user, sizeof(user_buffer), &size);
352 ok(ret, "GetTokenInformation() failed, error %lu\n", GetLastError());
353
356 ok(ret, "GetComputerName() failed, error %lu\n", GetLastError());
357
360 ok(ret, "GetUserName() failed, error %lu\n", GetLastError());
361
362 status = LsaLookupSids(policy, 1, &user->User.Sid, &list, &names);
363 ok(status == STATUS_SUCCESS, "got 0x%08lx\n", status);
364
365 ok(list->Entries == 1, "got %ld\n", list->Entries);
366 check_unicode_string(&list->Domains[0].Name, computer_name);
367
368 ok(names[0].Use == SidTypeUser, "got type %u\n", names[0].Use);
369 ok(!names[0].DomainIndex, "got index %lu\n", names[0].DomainIndex);
371
375
376 ret = ConvertStringSidToSidA("S-1-1-0", &sid);
377 ok(ret, "ConvertStringSidToSidA() failed, error %lu\n", GetLastError());
378
380 ok(status == STATUS_SUCCESS, "got 0x%08lx\n", status);
381
382 ok(list->Entries == 1, "got %ld\n", list->Entries);
383 check_unicode_string(&list->Domains[0].Name, L"");
384
385 ok(names[0].Use == SidTypeWellKnownGroup, "got type %u\n", names[0].Use);
386 ok(!names[0].DomainIndex, "got index %lu\n", names[0].DomainIndex);
387
388 /* The group name gets translated... but not in all locales */
389 size = ARRAY_SIZE(langW);
390 if (!pGetSystemPreferredUILanguages ||
391 !pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID, &num, langW, &size))
392 langW[0] = 0;
393 if (wcscmp(langW, L"0409") == 0 || wcscmp(langW, L"0411") == 0)
394 /* English and Japanese */
395 check_unicode_string(&names[0].Name, L"Everyone");
396 else if (wcscmp(langW, L"0407") == 0) /* German */
397 todo_wine ok(!wcsicmp(names[0].Name.Buffer, L"Jeder"), "missing translation %s\n",
398 debugstr_w(names[0].Name.Buffer));
399 else if (wcscmp(langW, L"040C") == 0) /* French */
400 todo_wine ok(!wcsicmp(names[0].Name.Buffer, L"Tout le monde"), "missing translation %s\n",
401 debugstr_w(names[0].Name.Buffer));
402 else
403 trace("<Everyone-group>.Name=%s\n", debugstr_w(names[0].Name.Buffer));
404
407 FreeSid(sid);
408
409 ret = ConvertStringSidToSidA("S-1-1234-5678-1234-5678", &sid);
410 ok(ret, "ConvertStringSidToSidA() failed, error %lu\n", GetLastError());
411
413 ok(status == STATUS_NONE_MAPPED, "got 0x%08lx\n", status);
414
415 ok(!list->Entries, "got %ld\n", list->Entries);
416
417#ifdef __REACTOS__
418 if (!names) {
419 ok(FALSE, "names should not be null!\n");
420 } else {
421#endif
422 ok(names[0].Use == SidTypeUnknown, "got type %u\n", names[0].Use);
423 ok(names[0].DomainIndex == -1, "got index %lu\n", names[0].DomainIndex);
424 check_unicode_string(&names[0].Name, L"S-1-1234-5678-1234-5678");
425#ifdef __REACTOS__
426 }
427#endif
428
431 FreeSid(sid);
432
434 ok(status == STATUS_SUCCESS, "got 0x%08lx\n", status);
435}
436
438{
443 LUID luid;
444
445 memset(&attrs, 0, sizeof(attrs));
446 attrs.Length = sizeof(attrs);
447
449 ok(status == STATUS_SUCCESS, "Failed to open policy, %#lx.\n", status);
450
451 name = (void *)0xdeadbeef;
453 ok(status != STATUS_SUCCESS, "Unexpected status %#lx.\n", status);
454 ok(name == (void *)0xdeadbeef, "Unexpected name pointer.\n");
455
456 name = (void *)0xdeadbeef;
457 luid.HighPart = 1;
460 ok(status == STATUS_NO_SUCH_PRIVILEGE, "Unexpected status %#lx.\n", status);
461 ok(name == NULL, "Unexpected name pointer.\n");
462
463 luid.HighPart = 0;
466 ok(status == 0, "got %#lx.\n", status);
468}
469
470static void test_LsaGetUserName(void)
471{
473 BOOL ret;
474 UNICODE_STRING *lsa_user, *lsa_domain;
475 WCHAR user[256], computer[256];
476 DWORD size;
477
478 if (!pLsaGetUserName)
479 {
480 skip("LsaGetUserName is not available on this platform\n");
481 return;
482 }
483
486 ok(ret, "GetUserName error %lu\n", GetLastError());
487
488 size = ARRAY_SIZE(computer);
489 ret = GetComputerNameW(computer, &size);
490 ok(ret, "GetComputerName error %lu\n", GetLastError());
491
492 if (0) /* crashes under Windows */
493 status = pLsaGetUserName(NULL, NULL);
494
495 if (0) /* crashes under Windows */
496 status = pLsaGetUserName(NULL, &lsa_domain);
497
498 status = pLsaGetUserName(&lsa_user, NULL);
499 ok(!status, "got %#lx\n", status);
500#ifdef __REACTOS__
502 skip("FIXME: LsaGetUserName not implemented on ReactOS!\n");
503 return;
504 }
505#endif
506 check_unicode_string(lsa_user, user);
507 LsaFreeMemory(lsa_user);
508
509 status = pLsaGetUserName(&lsa_user, &lsa_domain);
510 ok(!status, "got %#lx\n", status);
511 ok(!lstrcmpW(user, lsa_user->Buffer), "%s != %s\n", wine_dbgstr_w(user), wine_dbgstr_wn(lsa_user->Buffer, lsa_user->Length/sizeof(WCHAR)));
512 check_unicode_string(lsa_user, user);
513 check_unicode_string(lsa_domain, computer);
514 LsaFreeMemory(lsa_user);
515 LsaFreeMemory(lsa_domain);
516}
517
519{
520 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
521 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
522
523 pGetSystemPreferredUILanguages = (void*)GetProcAddress(hkernel32, "GetSystemPreferredUILanguages");
524 pLsaGetUserName = (void *)GetProcAddress(hadvapi32, "LsaGetUserName");
525
526 test_lsa();
531}
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
WINBASEAPI _Check_return_ _Out_ AppPolicyProcessTerminationMethod * policy
Definition: appmodel.h:73
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
LONG NTSTATUS
Definition: precomp.h:26
void account(int argc, const char *argv[])
Definition: cmds.c:1690
void user(int argc, const char *argv[])
Definition: cmds.c:1350
#define ARRAY_SIZE(A)
Definition: main.h:20
FT_UInt sid
Definition: cffcmap.c:138
Definition: bufpool.h:45
Definition: list.h:37
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:446
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
LPWSTR Name
Definition: desk.c:124
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NTSTATUS
Definition: precomp.h:19
NTSTATUS WINAPI LsaOpenPolicy(IN PLSA_UNICODE_STRING SystemName OPTIONAL, IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE PolicyHandle)
Definition: lsa.c:1183
NTSTATUS WINAPI LsaLookupPrivilegeName(IN LSA_HANDLE PolicyHandle, IN PLUID Value, OUT PUNICODE_STRING *Name)
Definition: lsa.c:1000
NTSTATUS WINAPI LsaLookupSids(IN LSA_HANDLE PolicyHandle, IN ULONG Count, IN PSID *Sids, OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains, OUT PLSA_TRANSLATED_NAME *Names)
Definition: lsa.c:1069
NTSTATUS WINAPI LsaQueryInformationPolicy(IN LSA_HANDLE PolicyHandle, IN POLICY_INFORMATION_CLASS InformationClass, OUT PVOID *Buffer)
Definition: lsa.c:1473
NTSTATUS WINAPI LsaLookupNames2(IN LSA_HANDLE PolicyHandle, IN ULONG Flags, IN ULONG Count, IN PLSA_UNICODE_STRING Names, OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains, OUT PLSA_TRANSLATED_SID2 *Sids)
Definition: lsa.c:906
NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
Definition: lsa.c:701
NTSTATUS WINAPI LsaEnumerateAccountRights(IN LSA_HANDLE PolicyHandle, IN PSID AccountSid, OUT PLSA_UNICODE_STRING *UserRights, OUT PULONG CountOfRights)
Definition: lsa.c:406
NTSTATUS WINAPI LsaClose(IN LSA_HANDLE ObjectHandle)
Definition: lsa.c:194
BOOL WINAPI LookupAccountSidA(LPCSTR lpSystemName, PSID lpSid, LPSTR lpName, LPDWORD cchName, LPSTR lpReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse)
Definition: misc.c:405
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:411
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
BOOL WINAPI ConvertStringSidToSidA(LPCSTR StringSid, PSID *Sid)
Definition: security.c:3560
PVOID WINAPI FreeSid(PSID pSid)
Definition: security.c:698
BOOL WINAPI ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid)
Definition: security.c:3637
#define CloseHandle
Definition: compat.h:739
#define CP_ACP
Definition: compat.h:109
#define GetProcAddress(x, y)
Definition: compat.h:753
#define GetCurrentProcess()
Definition: compat.h:759
#define WideCharToMultiByte
Definition: compat.h:111
#define wcsicmp
Definition: compat.h:15
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
LCID WINAPI GetThreadLocale(void)
Definition: locale.c:2803
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
LCID WINAPI GetSystemDefaultLCID(void)
Definition: locale.c:1235
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1972
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint * names
Definition: glext.h:11545
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLuint GLuint num
Definition: glext.h:9618
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
#define wine_dbgstr_w
Definition: kernel32.h:34
#define GUID_NULL
Definition: ks.h:106
enum _SID_NAME_USE SID_NAME_USE
@ SidTypeUnknown
Definition: lsa.idl:125
@ SidTypeUser
Definition: lsa.idl:118
@ SidTypeWellKnownGroup
Definition: lsa.idl:122
#define todo_wine
Definition: minitest.h:80
#define ZeroMemory
Definition: minwinbase.h:31
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static void test_LsaLookupSids(void)
Definition: lsa.c:329
static ULONG WCHAR ULONG *static PUNICODE_STRING * domain
Definition: lsa.c:42
static void test_LsaLookupPrivilegeName(void)
Definition: lsa.c:437
static void check_unicode_string_(int line, const LSA_UNICODE_STRING *string, const WCHAR *expect)
Definition: lsa.c:318
static void get_sid_info(PSID psid, LPSTR *user, LPSTR *dom)
Definition: lsa.c:190
#define check_unicode_string(a, b)
Definition: lsa.c:327
static void test_LsaGetUserName(void)
Definition: lsa.c:470
static void test_lsa(void)
Definition: lsa.c:44
static void test_LsaLookupNames2(void)
Definition: lsa.c:206
#define SE_CREATE_TOKEN_PRIVILEGE
Definition: security.c:586
static HINSTANCE hkernel32
Definition: process.c:68
static WCHAR computer_name[MAX_COMPUTERNAME_LENGTH+1]
Definition: access.c:33
static WCHAR user_name[UNLEN+1]
Definition: access.c:32
unsigned int UINT
Definition: ndis.h:50
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1165
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define STATUS_NONE_MAPPED
Definition: ntstatus.h:445
#define STATUS_NO_SUCH_PRIVILEGE
Definition: ntstatus.h:426
#define STATUS_SOME_NOT_MAPPED
Definition: ntstatus.h:139
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
Definition: guiddef.h:68
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
@ PolicyAuditEventsInformation
Definition: ntsecapi.h:244
@ PolicyDnsDomainInformation
Definition: ntsecapi.h:254
@ PolicyPrimaryDomainInformation
Definition: ntsecapi.h:245
@ PolicyAccountDomainInformation
Definition: ntsecapi.h:247
struct _LSA_UNICODE_STRING * PLSA_UNICODE_STRING
#define POLICY_VIEW_LOCAL_INFORMATION
Definition: ntsecapi.h:61
#define POLICY_ALL_ACCESS
Definition: ntsecapi.h:77
#define POLICY_LOOKUP_NAMES
Definition: ntsecapi.h:72
#define list
Definition: rosglue.h:35
int n2
Definition: dwarfget.c:147
int n1
Definition: dwarfget.c:147
#define wine_dbgstr_wn
Definition: testlist.c:2
#define LANG_ENGLISH
Definition: nls.h:52
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define memset(x, y, z)
Definition: compat.h:39
#define STATUS_SUCCESS
Definition: shellext.h:65
LONG HighPart
DWORD LowPart
LSA_UNICODE_STRING Name
Definition: ntsecapi.h:574
LSA_UNICODE_STRING DnsDomainName
Definition: ntsecapi.h:575
LSA_UNICODE_STRING DnsForestName
Definition: ntsecapi.h:576
LSA_UNICODE_STRING Name
Definition: ntsecapi.h:570
SID_AND_ATTRIBUTES User
Definition: setypes.h:1022
Definition: cookie.c:42
Definition: parser.c:49
Definition: name.c:39
Definition: ps.c:97
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define WINAPI
Definition: msvc.h:6
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define TOKEN_QUERY
Definition: setypes.h:940
@ TokenUser
Definition: setypes.h:978
__wchar_t WCHAR
Definition: xmlstorage.h:180
char * LPSTR
Definition: xmlstorage.h:182