25#define WIN32_NO_STATUS
43DEFINE_GUID(
GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
47 static WCHAR machineW[] = {
'W',
'i',
'n',
'e',
'N',
'o',
'M',
'a',
'c',
'h',
'i',
'n',
'e',0};
53 ZeroMemory(&object_attributes,
sizeof(object_attributes));
54 object_attributes.
Length =
sizeof(object_attributes);
62 "LsaOpenPolicy(POLICY_LOOKUP_NAMES) for invalid machine returned 0x%08x\n",
status);
66 "LsaOpenPolicy(POLICY_ALL_ACCESS) returned 0x%08x\n",
status);
70 trace(
"LsaOpenPolicy(POLICY_ALL_ACCESS) failed, trying POLICY_VIEW_LOCAL_INFORMATION|POLICY_LOOKUP_NAMES\n");
85 skip(
"Not enough rights to retrieve PolicyAuditEventsInformation\n");
94 if (primary_domain_info->
Sid) {
104 trace(
" name: %s sid: %s\n",
name, strsid);
107 trace(
" name: NULL sid: %s\n", strsid);
111 trace(
"invalid sid\n");
114 trace(
"Running on a standalone system.\n");
126 "LsaQueryInformationPolicy(PolicyDnsDomainInformation) failed, returned 0x%08x\n",
status);
157 trace(
" name: %s domain: %s forest: %s guid: %s sid: %s\n",
159 forest ? forest :
"NULL", guidstr, strsid ? strsid :
"NULL");
167 trace(
"Running on a standalone system.\n");
181 trace(
"Resizing buffer to %u.\n",
len);
183 if (token_user !=
NULL)
191 rights_count = 0xcafecafe;
197 ok(rights ==
NULL && rights_count == 0,
"Expected rights and rights_count to be set to 0 on failure\n");
212 DWORD user_size, dom_size;
219 user_size = dom_size = 257;
227 static const WCHAR n1[] = {
'L',
'O',
'C',
'A',
'L',
' ',
'S',
'E',
'R',
'V',
'I',
'C',
'E'};
228 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'};
241 skip(
"Non-English locale (skipping LsaLookupNames2 tests)\n");
245 memset(&attrs, 0,
sizeof(attrs));
246 attrs.
Length =
sizeof(attrs);
250 "LsaOpenPolicy(POLICY_ALL_ACCESS) returned 0x%08x\n",
status);
255 trace(
"LsaOpenPolicy(POLICY_ALL_ACCESS) failed, trying POLICY_VIEW_LOCAL_INFORMATION\n");
261 skip(
"Cannot acquire policy handle\n");
266 name[0].Length =
name[0].MaximumLength =
sizeof(
n1);
274 name[2].Length =
name[2].MaximumLength =
sizeof(
n2);
283 ok(sids[0].
Flags == 0,
"expected 0, got 0x%08x\n", sids[0].
Flags);
287 ok(!
strcmp(sid_dom,
"NT AUTHORITY"),
"expected \"NT AUTHORITY\", got \"%s\"\n", sid_dom);
296 ok(sids[0].Use ==
SidTypeUnknown,
"expected SidTypeUnknown, got %u\n", sids[0].Use);
297 ok(sids[0].
Flags == 0,
"expected 0, got 0x%08x\n", sids[0].
Flags);
308 ok(sids[0].
Flags == 0,
"expected 0, got 0x%08x\n", sids[0].
Flags);
312 ok(!
strcmp(sid_dom,
"NT AUTHORITY"),
"expected \"NT AUTHORITY\", got \"%s\"\n", sid_dom);
322 ok(sids[1].Use ==
SidTypeUnknown,
"expected SidTypeUnknown, got %u\n", sids[1].Use);
324 ok(sids[0].DomainIndex == 0,
"expected 0, got %u\n", sids[0].DomainIndex);
350 memset(&attrs, 0,
sizeof(attrs));
351 attrs.
Length =
sizeof(attrs);
369 ok(
list->Entries > 0,
"got %d\n",
list->Entries);
373 ok((
char*)
list->Domains[0].Sid - (
char*)
list->Domains > 0,
"%p, %p\n",
list->Domains,
list->Domains[0].Sid);
374 ok(
list->Domains[0].Name.MaximumLength >
list->Domains[0].Name.Length,
"got %d, %d\n",
list->Domains[0].Name.MaximumLength,
375 list->Domains[0].Name.Length);
386 ok(
ret ==
TRUE,
"ConvertStringSidToSidA returned false\n");
391 ok(
list->Entries > 0,
"got %d\n",
list->Entries);
396 ok((
char*)
list->Domains[0].Sid - (
char*)
list->Domains > 0,
"%p, %p\n",
list->Domains,
list->Domains[0].Sid);
397 ok(
list->Domains[0].Name.MaximumLength >
list->Domains[0].Name.Length,
"got %d, %d\n",
list->Domains[0].Name.MaximumLength,
398 list->Domains[0].Name.Length);
399 ok(
list->Domains[0].Name.Buffer !=
NULL,
"domain[0] name buffer is null\n");
419 memset(&attrs, 0,
sizeof(attrs));
420 attrs.
Length =
sizeof(attrs);
425 name = (
void *)0xdeadbeef;
428 ok(
name == (
void *)0xdeadbeef,
"Unexpected name pointer.\n");
430 name = (
void *)0xdeadbeef;
435 ok(
name ==
NULL,
"Unexpected name pointer.\n");
int strcmp(const char *String1, const char *String2)
void account(int argc, const char *argv[])
void user(int argc, const char *argv[])
#define ERROR_INSUFFICIENT_BUFFER
NTSTATUS WINAPI LsaOpenPolicy(IN PLSA_UNICODE_STRING SystemName OPTIONAL, IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE PolicyHandle)
NTSTATUS WINAPI LsaLookupPrivilegeName(IN LSA_HANDLE PolicyHandle, IN PLUID Value, OUT PUNICODE_STRING *Name)
NTSTATUS WINAPI LsaLookupSids(IN LSA_HANDLE PolicyHandle, IN ULONG Count, IN PSID *Sids, OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains, OUT PLSA_TRANSLATED_NAME *Names)
NTSTATUS WINAPI LsaQueryInformationPolicy(IN LSA_HANDLE PolicyHandle, IN POLICY_INFORMATION_CLASS InformationClass, OUT PVOID *Buffer)
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)
NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
NTSTATUS WINAPI LsaEnumerateAccountRights(IN LSA_HANDLE PolicyHandle, IN PSID AccountSid, OUT PLSA_UNICODE_STRING *UserRights, OUT PULONG CountOfRights)
NTSTATUS WINAPI LsaClose(IN LSA_HANDLE ObjectHandle)
BOOL WINAPI LookupAccountSidA(LPCSTR lpSystemName, PSID lpSid, LPSTR lpName, LPDWORD cchName, LPSTR lpReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse)
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
BOOL WINAPI ConvertStringSidToSidA(LPCSTR StringSid, PSID *Sid)
PVOID WINAPI FreeSid(PSID pSid)
BOOL WINAPI ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid)
#define GetCurrentProcess()
#define HeapFree(x, y, z)
#define WideCharToMultiByte
LCID WINAPI GetThreadLocale(void)
LCID WINAPI GetSystemDefaultLCID(void)
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
WDF_INTERRUPT_POLICY policy
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
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
enum _SID_NAME_USE SID_NAME_USE
#define memcpy(s1, s2, n)
static void test_LsaLookupSids(void)
static void test_LsaLookupPrivilegeName(void)
static void get_sid_info(PSID psid, LPSTR *user, LPSTR *dom)
static void test_lsa(void)
static void test_LsaLookupNames2(void)
#define SE_CREATE_TOKEN_PRIVILEGE
static const WCHAR machineW[]
static const char machine[]
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
@ PolicyAuditEventsInformation
@ PolicyDnsDomainInformation
@ PolicyPrimaryDomainInformation
@ PolicyAccountDomainInformation
struct _LSA_UNICODE_STRING * PLSA_UNICODE_STRING
#define POLICY_VIEW_LOCAL_INFORMATION
#define POLICY_ALL_ACCESS
#define POLICY_LOOKUP_NAMES
#define RPC_NT_SERVER_UNAVAILABLE
#define STATUS_NONE_MAPPED
#define STATUS_NO_SUCH_PRIVILEGE
#define STATUS_SOME_NOT_MAPPED
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
#define IsEqualGUID(rguid1, rguid2)
#define LANGIDFROMLCID(l)
LSA_UNICODE_STRING DnsDomainName
LSA_UNICODE_STRING DnsForestName
#define STATUS_ACCESS_DENIED
#define STATUS_INVALID_PARAMETER
#define STATUS_OBJECT_NAME_NOT_FOUND
DWORD WINAPI GetLastError(void)
_Must_inspect_result_ _In_ ULONG Flags