2005-07-06 12:37:50 +02:00
|
|
|
/*
|
|
|
|
* Implementation of the Local Security Authority API
|
|
|
|
*
|
|
|
|
* Copyright 1999 Juergen Schmied
|
|
|
|
* Copyright 2002 Andriy Palamarchuk
|
|
|
|
* Copyright 2004 Mike McCormack
|
|
|
|
* Copyright 2005 Hans Leidekker
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-07-06 12:37:50 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
2005-11-28 17:32:54 +01:00
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
2005-07-06 12:37:50 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winreg.h"
|
|
|
|
#include "winternl.h"
|
2006-07-29 14:12:58 +02:00
|
|
|
#include "advapi32_misc.h"
|
2005-07-06 12:37:50 +02:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
2009-09-30 19:56:23 +02:00
|
|
|
#include "wine/unicode.h"
|
2005-07-06 12:37:50 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(advapi);
|
|
|
|
|
|
|
|
#define ADVAPI_ForceLocalComputer(ServerName, FailureCode) \
|
|
|
|
if (!ADVAPI_IsLocalComputer(ServerName)) \
|
|
|
|
{ \
|
|
|
|
FIXME("Action Implemented for local computer only. " \
|
|
|
|
"Requested for server %s\n", debugstr_w(ServerName)); \
|
|
|
|
return FailureCode; \
|
|
|
|
}
|
|
|
|
|
2007-03-10 13:17:57 +01:00
|
|
|
static void dumpLsaAttributes(const LSA_OBJECT_ATTRIBUTES *oa)
|
2005-07-06 12:37:50 +02:00
|
|
|
{
|
|
|
|
if (oa)
|
|
|
|
{
|
2006-10-03 15:48:41 +02:00
|
|
|
TRACE("\n\tlength=%u, rootdir=%p, objectname=%s\n\tattr=0x%08x, sid=%s qos=%p\n",
|
2005-07-06 12:37:50 +02:00
|
|
|
oa->Length, oa->RootDirectory,
|
|
|
|
oa->ObjectName?debugstr_w(oa->ObjectName->Buffer):"null",
|
2006-08-14 13:24:42 +02:00
|
|
|
oa->Attributes, debugstr_sid(oa->SecurityDescriptor),
|
|
|
|
oa->SecurityQualityOfService);
|
2005-07-06 12:37:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-17 21:32:00 +02:00
|
|
|
static void* ADVAPI_GetDomainName(unsigned sz, unsigned ofs)
|
2006-08-14 13:24:42 +02:00
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG ret;
|
2006-10-21 13:18:29 +02:00
|
|
|
BYTE* ptr = NULL;
|
2006-10-17 21:32:00 +02:00
|
|
|
UNICODE_STRING* ustr;
|
2006-08-14 13:24:42 +02:00
|
|
|
|
2006-10-17 21:32:00 +02:00
|
|
|
static const WCHAR wVNETSUP[] = {
|
|
|
|
'S','y','s','t','e','m','\\',
|
|
|
|
'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
|
|
|
|
'S','e','r','v','i','c','e','s','\\',
|
|
|
|
'V','x','D','\\','V','N','E','T','S','U','P','\0'};
|
|
|
|
|
|
|
|
ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, wVNETSUP, 0, KEY_READ, &key);
|
|
|
|
if (ret == ERROR_SUCCESS)
|
2006-08-14 13:24:42 +02:00
|
|
|
{
|
|
|
|
DWORD size = 0;
|
|
|
|
static const WCHAR wg[] = { 'W','o','r','k','g','r','o','u','p',0 };
|
|
|
|
|
|
|
|
ret = RegQueryValueExW(key, wg, NULL, NULL, NULL, &size);
|
|
|
|
if (ret == ERROR_MORE_DATA || ret == ERROR_SUCCESS)
|
|
|
|
{
|
2006-10-17 21:32:00 +02:00
|
|
|
ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sz + size);
|
|
|
|
if (!ptr) return NULL;
|
|
|
|
ustr = (UNICODE_STRING*)(ptr + ofs);
|
|
|
|
ustr->MaximumLength = size;
|
|
|
|
ustr->Buffer = (WCHAR*)(ptr + sz);
|
2006-10-21 13:18:29 +02:00
|
|
|
ret = RegQueryValueExW(key, wg, NULL, NULL, (LPBYTE)ustr->Buffer, &size);
|
|
|
|
if (ret != ERROR_SUCCESS)
|
2006-08-14 13:24:42 +02:00
|
|
|
{
|
2006-10-17 21:32:00 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, ptr);
|
2006-10-21 13:18:29 +02:00
|
|
|
ptr = NULL;
|
|
|
|
}
|
|
|
|
else ustr->Length = size - sizeof(WCHAR);
|
2006-08-14 13:24:42 +02:00
|
|
|
}
|
|
|
|
RegCloseKey(key);
|
|
|
|
}
|
2006-10-21 13:18:29 +02:00
|
|
|
if (!ptr)
|
2006-10-17 21:32:00 +02:00
|
|
|
{
|
|
|
|
static const WCHAR wDomain[] = {'D','O','M','A','I','N','\0'};
|
|
|
|
ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
sz + sizeof(wDomain));
|
2006-10-21 13:18:29 +02:00
|
|
|
if (!ptr) return NULL;
|
2006-10-17 21:32:00 +02:00
|
|
|
ustr = (UNICODE_STRING*)(ptr + ofs);
|
|
|
|
ustr->MaximumLength = sizeof(wDomain);
|
|
|
|
ustr->Buffer = (WCHAR*)(ptr + sz);
|
2006-10-21 13:18:29 +02:00
|
|
|
ustr->Length = sizeof(wDomain) - sizeof(WCHAR);
|
2006-10-17 21:32:00 +02:00
|
|
|
memcpy(ustr->Buffer, wDomain, sizeof(wDomain));
|
|
|
|
}
|
|
|
|
return ptr;
|
2006-08-14 13:24:42 +02:00
|
|
|
}
|
|
|
|
|
2006-03-11 11:54:54 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* LsaAddAccountRights [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaAddAccountRights(
|
|
|
|
LSA_HANDLE policy,
|
|
|
|
PSID sid,
|
|
|
|
PLSA_UNICODE_STRING rights,
|
|
|
|
ULONG count)
|
|
|
|
{
|
2006-10-03 15:48:41 +02:00
|
|
|
FIXME("(%p,%p,%p,0x%08x) stub\n", policy, sid, rights, count);
|
2006-03-11 11:54:54 +01:00
|
|
|
return STATUS_OBJECT_NAME_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
2005-07-06 12:37:50 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* LsaClose [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* Closes a handle to a Policy or TrustedDomain.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* ObjectHandle [I] Handle to a Policy or TrustedDomain.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: STATUS_SUCCESS.
|
|
|
|
* Failure: NTSTATUS code.
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaClose(IN LSA_HANDLE ObjectHandle)
|
|
|
|
{
|
|
|
|
FIXME("(%p) stub\n", ObjectHandle);
|
2006-04-21 15:31:12 +02:00
|
|
|
return STATUS_SUCCESS;
|
2005-07-06 12:37:50 +02:00
|
|
|
}
|
|
|
|
|
2006-03-11 11:54:54 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* LsaCreateTrustedDomainEx [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaCreateTrustedDomainEx(
|
|
|
|
LSA_HANDLE policy,
|
|
|
|
PTRUSTED_DOMAIN_INFORMATION_EX domain_info,
|
|
|
|
PTRUSTED_DOMAIN_AUTH_INFORMATION auth_info,
|
|
|
|
ACCESS_MASK access,
|
|
|
|
PLSA_HANDLE domain)
|
|
|
|
{
|
2006-10-03 15:48:41 +02:00
|
|
|
FIXME("(%p,%p,%p,0x%08x,%p) stub\n", policy, domain_info, auth_info,
|
2006-03-11 11:54:54 +01:00
|
|
|
access, domain);
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* LsaDeleteTrustedDomain [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaDeleteTrustedDomain(LSA_HANDLE policy, PSID sid)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p) stub\n", policy, sid);
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* LsaEnumerateAccountRights [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaEnumerateAccountRights(
|
|
|
|
LSA_HANDLE policy,
|
|
|
|
PSID sid,
|
|
|
|
PLSA_UNICODE_STRING *rights,
|
|
|
|
PULONG count)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p,%p,%p) stub\n", policy, sid, rights, count);
|
2009-06-16 13:00:35 +02:00
|
|
|
*rights = 0;
|
|
|
|
*count = 0;
|
2006-03-11 11:54:54 +01:00
|
|
|
return STATUS_OBJECT_NAME_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* LsaEnumerateAccountsWithUserRight [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaEnumerateAccountsWithUserRight(
|
|
|
|
LSA_HANDLE policy,
|
|
|
|
PLSA_UNICODE_STRING rights,
|
|
|
|
PVOID *buffer,
|
|
|
|
PULONG count)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p,%p,%p) stub\n", policy, rights, buffer, count);
|
|
|
|
return STATUS_NO_MORE_ENTRIES;
|
|
|
|
}
|
|
|
|
|
2005-07-06 12:37:50 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* LsaEnumerateTrustedDomains [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* Returns the names and SIDs of trusted domains.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* PolicyHandle [I] Handle to a Policy object.
|
|
|
|
* EnumerationContext [I] Pointer to an enumeration handle.
|
|
|
|
* Buffer [O] Contains the names and SIDs of trusted domains.
|
2005-07-11 12:59:41 +02:00
|
|
|
* PreferredMaximumLength[I] Preferred maximum size in bytes of Buffer.
|
2005-07-06 12:37:50 +02:00
|
|
|
* CountReturned [O] Number of elements in Buffer.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: STATUS_SUCCESS,
|
|
|
|
* STATUS_MORE_ENTRIES,
|
|
|
|
* STATUS_NO_MORE_ENTRIES
|
|
|
|
* Failure: NTSTATUS code.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* LsaEnumerateTrustedDomains can be called multiple times to enumerate
|
|
|
|
* all trusted domains.
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaEnumerateTrustedDomains(
|
|
|
|
IN LSA_HANDLE PolicyHandle,
|
|
|
|
IN PLSA_ENUMERATION_HANDLE EnumerationContext,
|
|
|
|
OUT PVOID* Buffer,
|
2005-07-11 12:59:41 +02:00
|
|
|
IN ULONG PreferredMaximumLength,
|
2005-07-06 12:37:50 +02:00
|
|
|
OUT PULONG CountReturned)
|
|
|
|
{
|
2006-10-03 15:48:41 +02:00
|
|
|
FIXME("(%p,%p,%p,0x%08x,%p) stub\n", PolicyHandle, EnumerationContext,
|
2005-07-11 12:59:41 +02:00
|
|
|
Buffer, PreferredMaximumLength, CountReturned);
|
2005-07-06 12:37:50 +02:00
|
|
|
|
|
|
|
if (CountReturned) *CountReturned = 0;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2006-03-11 11:54:54 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* LsaEnumerateTrustedDomainsEx [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaEnumerateTrustedDomainsEx(
|
|
|
|
LSA_HANDLE policy,
|
|
|
|
PLSA_ENUMERATION_HANDLE context,
|
|
|
|
PVOID *buffer,
|
|
|
|
ULONG length,
|
|
|
|
PULONG count)
|
|
|
|
{
|
2006-10-03 15:48:41 +02:00
|
|
|
FIXME("(%p,%p,%p,0x%08x,%p) stub\n", policy, context, buffer, length, count);
|
2006-03-11 11:54:54 +01:00
|
|
|
|
|
|
|
if (count) *count = 0;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-07-06 12:37:50 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* LsaFreeMemory [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* Frees memory allocated by a LSA function.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* Buffer [I] Memory buffer to free.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: STATUS_SUCCESS.
|
|
|
|
* Failure: NTSTATUS code.
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", Buffer);
|
2009-08-04 12:22:29 +02:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, Buffer);
|
|
|
|
return STATUS_SUCCESS;
|
2005-07-06 12:37:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* LsaLookupNames [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* Returns the SIDs of an array of user, group, or local group names.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* PolicyHandle [I] Handle to a Policy object.
|
|
|
|
* Count [I] Number of names in Names.
|
|
|
|
* Names [I] Array of names to lookup.
|
|
|
|
* ReferencedDomains [O] Array of domains where the names were found.
|
|
|
|
* Sids [O] Array of SIDs corresponding to Names.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: STATUS_SUCCESS,
|
|
|
|
* STATUS_SOME_NOT_MAPPED
|
|
|
|
* Failure: STATUS_NONE_MAPPED or NTSTATUS code.
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaLookupNames(
|
|
|
|
IN LSA_HANDLE PolicyHandle,
|
|
|
|
IN ULONG Count,
|
|
|
|
IN PLSA_UNICODE_STRING Names,
|
|
|
|
OUT PLSA_REFERENCED_DOMAIN_LIST* ReferencedDomains,
|
|
|
|
OUT PLSA_TRANSLATED_SID* Sids)
|
|
|
|
{
|
2006-10-03 15:48:41 +02:00
|
|
|
FIXME("(%p,0x%08x,%p,%p,%p) stub\n", PolicyHandle, Count, Names,
|
2005-07-06 12:37:50 +02:00
|
|
|
ReferencedDomains, Sids);
|
|
|
|
|
|
|
|
return STATUS_NONE_MAPPED;
|
|
|
|
}
|
|
|
|
|
2009-08-07 08:36:20 +02:00
|
|
|
static BOOL lookup_name( LSA_UNICODE_STRING *name, SID *sid, DWORD *sid_size, WCHAR *domain,
|
|
|
|
DWORD *domain_size, SID_NAME_USE *use, BOOL *handled )
|
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
ret = lookup_local_wellknown_name( name, sid, sid_size, domain, domain_size, use, handled );
|
|
|
|
if (!*handled)
|
|
|
|
ret = lookup_local_user_name( name, sid, sid_size, domain, domain_size, use, handled );
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-01-19 20:26:05 +01:00
|
|
|
/* Adds domain info to referenced domain list.
|
|
|
|
Domain list is stored as plain buffer, layout is:
|
|
|
|
|
|
|
|
LSA_REFERENCED_DOMAIN_LIST,
|
|
|
|
LSA_TRUST_INFORMATION array,
|
|
|
|
domain data array of
|
|
|
|
{
|
|
|
|
domain name data (WCHAR buffer),
|
|
|
|
SID data
|
|
|
|
}
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
list [I] referenced list pointer
|
|
|
|
domain [I] domain name string
|
|
|
|
data [IO] pointer to domain data array
|
|
|
|
*/
|
|
|
|
static LONG lsa_reflist_add_domain(LSA_REFERENCED_DOMAIN_LIST *list, LSA_UNICODE_STRING *domain, char **data)
|
|
|
|
{
|
|
|
|
ULONG sid_size = 0,domain_size = 0;
|
|
|
|
BOOL handled = FALSE;
|
|
|
|
SID_NAME_USE use;
|
|
|
|
LONG i;
|
|
|
|
|
|
|
|
for (i = 0; i < list->Entries; i++)
|
|
|
|
{
|
|
|
|
/* try to reuse index */
|
|
|
|
if ((list->Domains[i].Name.Length == domain->Length) &&
|
|
|
|
(!strncmpiW(list->Domains[i].Name.Buffer, domain->Buffer, (domain->Length / sizeof(WCHAR)))))
|
|
|
|
{
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* no matching domain found, store name */
|
|
|
|
list->Domains[list->Entries].Name.Length = domain->Length;
|
|
|
|
list->Domains[list->Entries].Name.MaximumLength = domain->MaximumLength;
|
|
|
|
list->Domains[list->Entries].Name.Buffer = (WCHAR*)*data;
|
|
|
|
memcpy(list->Domains[list->Entries].Name.Buffer, domain->Buffer, domain->MaximumLength);
|
|
|
|
*data += domain->MaximumLength;
|
|
|
|
|
|
|
|
/* get and store SID data */
|
|
|
|
list->Domains[list->Entries].Sid = *data;
|
|
|
|
lookup_name(domain, NULL, &sid_size, NULL, &domain_size, &use, &handled);
|
|
|
|
domain_size = 0;
|
|
|
|
lookup_name(domain, list->Domains[list->Entries].Sid, &sid_size, NULL, &domain_size, &use, &handled);
|
|
|
|
*data += sid_size;
|
|
|
|
|
|
|
|
return list->Entries++;
|
|
|
|
}
|
|
|
|
|
2006-03-11 11:54:54 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* LsaLookupNames2 [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
*/
|
2009-08-07 08:36:20 +02:00
|
|
|
NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count,
|
|
|
|
PLSA_UNICODE_STRING names, PLSA_REFERENCED_DOMAIN_LIST *domains,
|
|
|
|
PLSA_TRANSLATED_SID2 *sids )
|
2006-03-11 11:54:54 +01:00
|
|
|
{
|
2013-01-19 20:39:12 +01:00
|
|
|
ULONG i, sid_size_total = 0, domain_size_max = 0, size, domainname_size_total = 0;
|
2009-08-07 08:36:20 +02:00
|
|
|
ULONG sid_size, domain_size, mapped;
|
2013-04-29 07:30:24 +02:00
|
|
|
LSA_UNICODE_STRING domain;
|
2010-04-24 22:53:35 +02:00
|
|
|
BOOL handled = FALSE;
|
2013-01-19 20:39:12 +01:00
|
|
|
char *domain_data;
|
2009-08-07 08:36:20 +02:00
|
|
|
SID_NAME_USE use;
|
|
|
|
SID *sid;
|
|
|
|
|
|
|
|
TRACE("(%p,0x%08x,0x%08x,%p,%p,%p)\n", policy, flags, count, names, domains, sids);
|
|
|
|
|
2009-09-30 19:56:23 +02:00
|
|
|
mapped = 0;
|
2009-08-07 08:36:20 +02:00
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
handled = FALSE;
|
|
|
|
sid_size = domain_size = 0;
|
2010-04-24 22:53:35 +02:00
|
|
|
lookup_name( &names[i], NULL, &sid_size, NULL, &domain_size, &use, &handled );
|
2009-08-07 08:36:20 +02:00
|
|
|
if (handled)
|
|
|
|
{
|
|
|
|
sid_size_total += sid_size;
|
2013-01-19 20:39:12 +01:00
|
|
|
domainname_size_total += domain_size;
|
2009-08-07 08:36:20 +02:00
|
|
|
if (domain_size)
|
|
|
|
{
|
2009-09-30 19:56:23 +02:00
|
|
|
if (domain_size > domain_size_max)
|
|
|
|
domain_size_max = domain_size;
|
2009-08-07 08:36:20 +02:00
|
|
|
}
|
|
|
|
mapped++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TRACE("mapped %u out of %u\n", mapped, count);
|
|
|
|
|
|
|
|
size = sizeof(LSA_TRANSLATED_SID2) * count + sid_size_total;
|
2013-01-19 20:39:12 +01:00
|
|
|
if (!(*sids = heap_alloc(size))) return STATUS_NO_MEMORY;
|
2009-08-07 08:36:20 +02:00
|
|
|
|
2009-08-18 13:23:23 +02:00
|
|
|
sid = (SID *)(*sids + count);
|
2009-08-07 08:36:20 +02:00
|
|
|
|
2013-01-19 20:39:12 +01:00
|
|
|
/* use maximum domain count */
|
|
|
|
if (!(*domains = heap_alloc(sizeof(LSA_REFERENCED_DOMAIN_LIST) + sizeof(LSA_TRUST_INFORMATION)*count +
|
2013-04-29 07:22:30 +02:00
|
|
|
sid_size_total + domainname_size_total*sizeof(WCHAR))))
|
2009-08-07 08:36:20 +02:00
|
|
|
{
|
2013-01-19 20:39:12 +01:00
|
|
|
heap_free(*sids);
|
2009-08-07 08:36:20 +02:00
|
|
|
return STATUS_NO_MEMORY;
|
|
|
|
}
|
|
|
|
(*domains)->Entries = 0;
|
2013-01-19 20:39:12 +01:00
|
|
|
(*domains)->Domains = (LSA_TRUST_INFORMATION*)((char*)*domains + sizeof(LSA_REFERENCED_DOMAIN_LIST));
|
|
|
|
domain_data = (char*)(*domains)->Domains + sizeof(LSA_TRUST_INFORMATION)*count;
|
2009-08-07 08:36:20 +02:00
|
|
|
|
2013-04-29 07:30:24 +02:00
|
|
|
domain.Buffer = heap_alloc(domain_size_max*sizeof(WCHAR));
|
2009-08-07 08:36:20 +02:00
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
2009-09-30 19:56:23 +02:00
|
|
|
domain.Length = domain_size_max*sizeof(WCHAR);
|
|
|
|
domain.MaximumLength = domain_size_max*sizeof(WCHAR);
|
|
|
|
|
2009-08-07 08:36:20 +02:00
|
|
|
(*sids)[i].Use = SidTypeUnknown;
|
|
|
|
(*sids)[i].DomainIndex = -1;
|
|
|
|
(*sids)[i].Flags = 0;
|
|
|
|
|
|
|
|
handled = FALSE;
|
|
|
|
sid_size = sid_size_total;
|
2009-09-30 19:56:23 +02:00
|
|
|
domain_size = domain_size_max;
|
2010-04-24 22:53:35 +02:00
|
|
|
lookup_name( &names[i], sid, &sid_size, domain.Buffer, &domain_size, &use, &handled );
|
2009-08-07 08:36:20 +02:00
|
|
|
if (handled)
|
|
|
|
{
|
|
|
|
(*sids)[i].Sid = sid;
|
|
|
|
(*sids)[i].Use = use;
|
|
|
|
|
2011-05-05 13:11:20 +02:00
|
|
|
sid = (SID *)((char *)sid + sid_size);
|
2009-08-07 08:36:20 +02:00
|
|
|
sid_size_total -= sid_size;
|
2009-09-30 19:56:23 +02:00
|
|
|
if (domain_size)
|
|
|
|
{
|
|
|
|
domain.Length = domain_size * sizeof(WCHAR);
|
2013-04-29 07:22:30 +02:00
|
|
|
domain.MaximumLength = (domain_size + 1) * sizeof(WCHAR);
|
2013-01-19 20:39:12 +01:00
|
|
|
(*sids)[i].DomainIndex = lsa_reflist_add_domain(*domains, &domain, &domain_data);
|
2009-09-30 19:56:23 +02:00
|
|
|
}
|
2009-08-07 08:36:20 +02:00
|
|
|
}
|
|
|
|
}
|
2013-04-29 07:30:24 +02:00
|
|
|
heap_free(domain.Buffer);
|
2009-08-07 08:36:20 +02:00
|
|
|
|
|
|
|
if (mapped == count) return STATUS_SUCCESS;
|
|
|
|
if (mapped > 0 && mapped < count) return STATUS_SOME_NOT_MAPPED;
|
2006-03-11 11:54:54 +01:00
|
|
|
return STATUS_NONE_MAPPED;
|
|
|
|
}
|
|
|
|
|
2005-07-06 12:37:50 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* LsaLookupSids [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* Looks up the names that correspond to an array of SIDs.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* PolicyHandle [I] Handle to a Policy object.
|
|
|
|
* Count [I] Number of SIDs in the Sids array.
|
|
|
|
* Sids [I] Array of SIDs to lookup.
|
|
|
|
* ReferencedDomains [O] Array of domains where the sids were found.
|
|
|
|
* Names [O] Array of names corresponding to Sids.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: STATUS_SUCCESS,
|
|
|
|
* STATUS_SOME_NOT_MAPPED
|
|
|
|
* Failure: STATUS_NONE_MAPPED or NTSTATUS code.
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaLookupSids(
|
2013-01-19 20:26:05 +01:00
|
|
|
LSA_HANDLE PolicyHandle,
|
|
|
|
ULONG Count,
|
|
|
|
PSID *Sids,
|
|
|
|
LSA_REFERENCED_DOMAIN_LIST **ReferencedDomains,
|
|
|
|
LSA_TRANSLATED_NAME **Names)
|
2005-07-06 12:37:50 +02:00
|
|
|
{
|
2013-01-19 20:26:05 +01:00
|
|
|
ULONG i, mapped, name_fullsize, domain_fullsize;
|
2009-09-24 15:38:35 +02:00
|
|
|
ULONG name_size, domain_size;
|
2013-01-19 20:26:05 +01:00
|
|
|
LSA_UNICODE_STRING domain;
|
|
|
|
WCHAR *name_buffer;
|
|
|
|
char *domain_data;
|
2009-09-24 15:38:35 +02:00
|
|
|
SID_NAME_USE use;
|
|
|
|
|
2013-01-19 20:26:05 +01:00
|
|
|
TRACE("(%p, %u, %p, %p, %p)\n", PolicyHandle, Count, Sids, ReferencedDomains, Names);
|
2005-07-06 12:37:50 +02:00
|
|
|
|
2013-01-19 20:26:05 +01:00
|
|
|
/* this length does not include actual string length yet */
|
|
|
|
name_fullsize = sizeof(LSA_TRANSLATED_NAME) * Count;
|
|
|
|
if (!(*Names = heap_alloc(name_fullsize))) return STATUS_NO_MEMORY;
|
|
|
|
/* maximum count of stored domain infos is Count, allocate it like that cause really needed
|
|
|
|
count could only be computed after sid data is retrieved */
|
|
|
|
domain_fullsize = sizeof(LSA_REFERENCED_DOMAIN_LIST) + sizeof(LSA_TRUST_INFORMATION)*Count;
|
|
|
|
if (!(*ReferencedDomains = heap_alloc(domain_fullsize)))
|
2009-09-24 15:38:35 +02:00
|
|
|
{
|
2013-01-19 20:26:05 +01:00
|
|
|
heap_free(*Names);
|
2009-09-24 15:38:35 +02:00
|
|
|
return STATUS_NO_MEMORY;
|
|
|
|
}
|
|
|
|
(*ReferencedDomains)->Entries = 0;
|
2013-01-19 20:26:05 +01:00
|
|
|
(*ReferencedDomains)->Domains = (LSA_TRUST_INFORMATION*)((char*)*ReferencedDomains + sizeof(LSA_REFERENCED_DOMAIN_LIST));
|
2009-09-24 15:38:35 +02:00
|
|
|
|
2013-01-19 20:26:05 +01:00
|
|
|
/* Get full names data length and full length needed to store domain name and SID */
|
2009-09-24 15:38:35 +02:00
|
|
|
for (i = 0; i < Count; i++)
|
|
|
|
{
|
|
|
|
(*Names)[i].Use = SidTypeUnknown;
|
|
|
|
(*Names)[i].DomainIndex = -1;
|
|
|
|
(*Names)[i].Name.Buffer = NULL;
|
2010-10-06 15:45:30 +02:00
|
|
|
|
2013-01-19 20:26:05 +01:00
|
|
|
memset(&(*ReferencedDomains)->Domains[i], 0, sizeof(LSA_TRUST_INFORMATION));
|
|
|
|
|
|
|
|
name_size = domain_size = 0;
|
2010-10-06 15:45:30 +02:00
|
|
|
if (!LookupAccountSidW(NULL, Sids[i], NULL, &name_size, NULL, &domain_size, &use) &&
|
|
|
|
GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
2009-09-24 15:38:35 +02:00
|
|
|
{
|
2013-01-19 20:26:05 +01:00
|
|
|
if (name_size)
|
|
|
|
{
|
|
|
|
(*Names)[i].Name.Length = (name_size - 1) * sizeof(WCHAR);
|
|
|
|
(*Names)[i].Name.MaximumLength = name_size * sizeof(WCHAR);
|
|
|
|
name_fullsize += (*Names)[i].Name.MaximumLength;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
(*Names)[i].Name.Length = 0;
|
|
|
|
(*Names)[i].Name.MaximumLength = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This potentially allocates more than needed, cause different names will reuse same domain index.
|
|
|
|
Also it's not possible to store domain name length right here for the same reason. */
|
|
|
|
if (domain_size)
|
|
|
|
{
|
|
|
|
ULONG sid_size = 0;
|
|
|
|
BOOL handled = FALSE;
|
|
|
|
WCHAR *name;
|
|
|
|
|
|
|
|
domain_fullsize += domain_size * sizeof(WCHAR);
|
|
|
|
|
|
|
|
/* get domain SID size too */
|
|
|
|
name = heap_alloc(domain_size * sizeof(WCHAR));
|
|
|
|
*name = 0;
|
|
|
|
LookupAccountSidW(NULL, Sids[i], NULL, &name_size, name, &domain_size, &use);
|
|
|
|
|
|
|
|
domain.Buffer = name;
|
|
|
|
domain.Length = domain_size * sizeof(WCHAR);
|
|
|
|
domain.MaximumLength = domain_size * sizeof(WCHAR);
|
|
|
|
|
|
|
|
lookup_name(&domain, NULL, &sid_size, NULL, &domain_size, &use, &handled);
|
|
|
|
domain_fullsize += sid_size;
|
2009-09-30 19:56:23 +02:00
|
|
|
|
2013-01-19 20:26:05 +01:00
|
|
|
heap_free(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now we have full length needed for both */
|
|
|
|
*Names = heap_realloc(*Names, name_fullsize);
|
|
|
|
name_buffer = (WCHAR*)((char*)*Names + sizeof(LSA_TRANSLATED_NAME)*Count);
|
|
|
|
|
|
|
|
*ReferencedDomains = heap_realloc(*ReferencedDomains, domain_fullsize);
|
|
|
|
/* fix pointer after reallocation */
|
|
|
|
(*ReferencedDomains)->Domains = (LSA_TRUST_INFORMATION*)((char*)*ReferencedDomains + sizeof(LSA_REFERENCED_DOMAIN_LIST));
|
|
|
|
domain_data = (char*)(*ReferencedDomains)->Domains + sizeof(LSA_TRUST_INFORMATION)*Count;
|
|
|
|
|
|
|
|
mapped = 0;
|
|
|
|
for (i = 0; i < Count; i++)
|
|
|
|
{
|
|
|
|
name_size = domain_size = 0;
|
|
|
|
|
|
|
|
if (!LookupAccountSidW(NULL, Sids[i], NULL, &name_size, NULL, &domain_size, &use) &&
|
|
|
|
GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
|
|
|
{
|
2009-09-24 15:38:35 +02:00
|
|
|
mapped++;
|
|
|
|
|
2009-09-30 19:56:23 +02:00
|
|
|
if (domain_size)
|
|
|
|
{
|
2010-06-09 20:52:13 +02:00
|
|
|
domain.Length = (domain_size - 1) * sizeof(WCHAR);
|
2013-01-19 20:26:05 +01:00
|
|
|
domain.MaximumLength = domain_size * sizeof(WCHAR);
|
|
|
|
domain.Buffer = heap_alloc(domain.MaximumLength);
|
2009-09-30 19:56:23 +02:00
|
|
|
}
|
|
|
|
|
2013-01-19 20:26:05 +01:00
|
|
|
(*Names)[i].Name.Buffer = name_buffer;
|
2009-09-30 19:56:23 +02:00
|
|
|
LookupAccountSidW(NULL, Sids[i], (*Names)[i].Name.Buffer, &name_size, domain.Buffer, &domain_size, &use);
|
2010-10-06 15:45:30 +02:00
|
|
|
(*Names)[i].Use = use;
|
2009-09-30 19:56:23 +02:00
|
|
|
|
|
|
|
if (domain_size)
|
2013-01-19 20:26:05 +01:00
|
|
|
{
|
|
|
|
(*Names)[i].DomainIndex = lsa_reflist_add_domain(*ReferencedDomains, &domain, &domain_data);
|
|
|
|
heap_free(domain.Buffer);
|
|
|
|
}
|
2009-09-24 15:38:35 +02:00
|
|
|
}
|
2013-01-19 20:26:05 +01:00
|
|
|
|
|
|
|
name_buffer += name_size;
|
2009-09-24 15:38:35 +02:00
|
|
|
}
|
2013-01-19 20:26:05 +01:00
|
|
|
TRACE("mapped %u out of %u\n", mapped, Count);
|
2009-09-24 15:38:35 +02:00
|
|
|
|
|
|
|
if (mapped == Count) return STATUS_SUCCESS;
|
|
|
|
if (mapped) return STATUS_SOME_NOT_MAPPED;
|
2005-11-24 19:22:30 +01:00
|
|
|
return STATUS_NONE_MAPPED;
|
2005-07-06 12:37:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* LsaNtStatusToWinError [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* Converts an LSA NTSTATUS code to a Windows error code.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* Status [I] NTSTATUS code.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: Corresponding Windows error code.
|
|
|
|
* Failure: ERROR_MR_MID_NOT_FOUND.
|
|
|
|
*/
|
|
|
|
ULONG WINAPI LsaNtStatusToWinError(NTSTATUS Status)
|
|
|
|
{
|
|
|
|
return RtlNtStatusToDosError(Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* LsaOpenPolicy [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* Opens a handle to the Policy object on a local or remote system.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* SystemName [I] Name of the target system.
|
|
|
|
* ObjectAttributes [I] Connection attributes.
|
|
|
|
* DesiredAccess [I] Requested access rights.
|
|
|
|
* PolicyHandle [I/O] Handle to the Policy object.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: STATUS_SUCCESS.
|
|
|
|
* Failure: NTSTATUS code.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* Set SystemName to NULL to open the local Policy object.
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaOpenPolicy(
|
|
|
|
IN PLSA_UNICODE_STRING SystemName,
|
|
|
|
IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
|
|
|
|
IN ACCESS_MASK DesiredAccess,
|
|
|
|
IN OUT PLSA_HANDLE PolicyHandle)
|
|
|
|
{
|
2006-10-03 15:48:41 +02:00
|
|
|
FIXME("(%s,%p,0x%08x,%p) stub\n",
|
2005-07-06 12:37:50 +02:00
|
|
|
SystemName?debugstr_w(SystemName->Buffer):"(null)",
|
|
|
|
ObjectAttributes, DesiredAccess, PolicyHandle);
|
|
|
|
|
|
|
|
ADVAPI_ForceLocalComputer(SystemName ? SystemName->Buffer : NULL,
|
|
|
|
STATUS_ACCESS_VIOLATION);
|
|
|
|
dumpLsaAttributes(ObjectAttributes);
|
|
|
|
|
|
|
|
if(PolicyHandle) *PolicyHandle = (LSA_HANDLE)0xcafe;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2006-03-11 11:54:54 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* LsaOpenTrustedDomainByName [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaOpenTrustedDomainByName(
|
|
|
|
LSA_HANDLE policy,
|
|
|
|
PLSA_UNICODE_STRING name,
|
|
|
|
ACCESS_MASK access,
|
|
|
|
PLSA_HANDLE handle)
|
|
|
|
{
|
2006-10-03 15:48:41 +02:00
|
|
|
FIXME("(%p,%p,0x%08x,%p) stub\n", policy, name, access, handle);
|
2006-03-11 11:54:54 +01:00
|
|
|
return STATUS_OBJECT_NAME_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
2005-07-06 12:37:50 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* LsaQueryInformationPolicy [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* Returns information about a Policy object.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* PolicyHandle [I] Handle to a Policy object.
|
|
|
|
* InformationClass [I] Type of information to retrieve.
|
|
|
|
* Buffer [O] Pointer to the requested information.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: STATUS_SUCCESS.
|
|
|
|
* Failure: NTSTATUS code.
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaQueryInformationPolicy(
|
|
|
|
IN LSA_HANDLE PolicyHandle,
|
|
|
|
IN POLICY_INFORMATION_CLASS InformationClass,
|
|
|
|
OUT PVOID *Buffer)
|
|
|
|
{
|
2006-08-02 03:49:15 +02:00
|
|
|
TRACE("(%p,0x%08x,%p)\n", PolicyHandle, InformationClass, Buffer);
|
2005-07-06 12:37:50 +02:00
|
|
|
|
2006-04-21 04:19:31 +02:00
|
|
|
if(!Buffer) return STATUS_INVALID_PARAMETER;
|
2005-07-06 12:37:50 +02:00
|
|
|
switch (InformationClass)
|
|
|
|
{
|
|
|
|
case PolicyAuditEventsInformation: /* 2 */
|
|
|
|
{
|
|
|
|
PPOLICY_AUDIT_EVENTS_INFO p = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
sizeof(POLICY_AUDIT_EVENTS_INFO));
|
|
|
|
p->AuditingMode = FALSE; /* no auditing */
|
|
|
|
*Buffer = p;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PolicyPrimaryDomainInformation: /* 3 */
|
|
|
|
{
|
2006-08-02 03:49:15 +02:00
|
|
|
/* Only the domain name is valid for the local computer.
|
|
|
|
* All other fields are zero.
|
|
|
|
*/
|
2006-10-17 21:32:00 +02:00
|
|
|
PPOLICY_PRIMARY_DOMAIN_INFO pinfo;
|
2006-12-04 23:53:25 +01:00
|
|
|
|
|
|
|
pinfo = ADVAPI_GetDomainName(sizeof(*pinfo), offsetof(POLICY_PRIMARY_DOMAIN_INFO, Name));
|
2006-08-02 03:49:15 +02:00
|
|
|
|
|
|
|
TRACE("setting domain to %s\n", debugstr_w(pinfo->Name.Buffer));
|
|
|
|
|
|
|
|
*Buffer = pinfo;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PolicyAccountDomainInformation: /* 5 */
|
|
|
|
{
|
|
|
|
struct di
|
2006-07-31 23:53:32 +02:00
|
|
|
{
|
2006-08-02 03:49:15 +02:00
|
|
|
POLICY_ACCOUNT_DOMAIN_INFO info;
|
|
|
|
SID sid;
|
|
|
|
DWORD padding[3];
|
2006-10-17 21:32:00 +02:00
|
|
|
WCHAR domain[MAX_COMPUTERNAME_LENGTH + 1];
|
2006-08-02 03:49:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
|
2006-10-17 21:32:00 +02:00
|
|
|
struct di * xdi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*xdi));
|
2006-08-02 03:49:15 +02:00
|
|
|
|
|
|
|
xdi->info.DomainName.MaximumLength = dwSize * sizeof(WCHAR);
|
2006-10-17 21:32:00 +02:00
|
|
|
xdi->info.DomainName.Buffer = xdi->domain;
|
|
|
|
if (GetComputerNameW(xdi->info.DomainName.Buffer, &dwSize))
|
2006-08-02 03:49:15 +02:00
|
|
|
xdi->info.DomainName.Length = dwSize * sizeof(WCHAR);
|
|
|
|
|
|
|
|
TRACE("setting name to %s\n", debugstr_w(xdi->info.DomainName.Buffer));
|
|
|
|
|
2006-10-17 21:32:00 +02:00
|
|
|
xdi->info.DomainSid = &xdi->sid;
|
2006-08-02 03:49:15 +02:00
|
|
|
|
2006-10-17 21:32:00 +02:00
|
|
|
if (!ADVAPI_GetComputerSid(&xdi->sid))
|
2006-07-31 23:53:32 +02:00
|
|
|
{
|
2006-08-04 03:47:50 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, xdi);
|
2006-08-02 03:49:15 +02:00
|
|
|
|
2006-08-04 03:47:50 +02:00
|
|
|
WARN("Computer SID not found\n");
|
2006-08-02 03:49:15 +02:00
|
|
|
|
2006-08-04 03:47:50 +02:00
|
|
|
return STATUS_UNSUCCESSFUL;
|
2006-07-31 23:53:32 +02:00
|
|
|
}
|
2006-08-02 03:49:15 +02:00
|
|
|
|
2006-07-31 23:53:32 +02:00
|
|
|
TRACE("setting SID to %s\n", debugstr_sid(&xdi->sid));
|
|
|
|
|
|
|
|
*Buffer = xdi;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PolicyDnsDomainInformation: /* 12 (0xc) */
|
|
|
|
{
|
2006-08-02 03:49:15 +02:00
|
|
|
/* Only the domain name is valid for the local computer.
|
|
|
|
* All other fields are zero.
|
|
|
|
*/
|
2006-10-17 21:32:00 +02:00
|
|
|
PPOLICY_DNS_DOMAIN_INFO pinfo;
|
2006-07-31 23:53:32 +02:00
|
|
|
|
2006-12-04 23:53:25 +01:00
|
|
|
pinfo = ADVAPI_GetDomainName(sizeof(*pinfo), offsetof(POLICY_DNS_DOMAIN_INFO, Name));
|
2006-07-31 23:53:32 +02:00
|
|
|
|
2006-08-02 03:49:15 +02:00
|
|
|
TRACE("setting domain to %s\n", debugstr_w(pinfo->Name.Buffer));
|
|
|
|
|
|
|
|
*Buffer = pinfo;
|
2005-07-06 12:37:50 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PolicyAuditLogInformation:
|
|
|
|
case PolicyPdAccountInformation:
|
|
|
|
case PolicyLsaServerRoleInformation:
|
|
|
|
case PolicyReplicaSourceInformation:
|
|
|
|
case PolicyDefaultQuotaInformation:
|
|
|
|
case PolicyModificationInformation:
|
|
|
|
case PolicyAuditFullSetInformation:
|
|
|
|
case PolicyAuditFullQueryInformation:
|
|
|
|
{
|
2006-08-02 03:49:15 +02:00
|
|
|
FIXME("category %d not implemented\n", InformationClass);
|
2006-04-21 04:19:31 +02:00
|
|
|
return STATUS_UNSUCCESSFUL;
|
2005-07-06 12:37:50 +02:00
|
|
|
}
|
|
|
|
}
|
2006-04-21 04:19:31 +02:00
|
|
|
return STATUS_SUCCESS;
|
2005-07-06 12:37:50 +02:00
|
|
|
}
|
|
|
|
|
2006-03-11 11:54:54 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* LsaQueryTrustedDomainInfo [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaQueryTrustedDomainInfo(
|
|
|
|
LSA_HANDLE policy,
|
|
|
|
PSID sid,
|
|
|
|
TRUSTED_INFORMATION_CLASS class,
|
|
|
|
PVOID *buffer)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p,%d,%p) stub\n", policy, sid, class, buffer);
|
|
|
|
return STATUS_OBJECT_NAME_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* LsaQueryTrustedDomainInfoByName [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaQueryTrustedDomainInfoByName(
|
|
|
|
LSA_HANDLE policy,
|
|
|
|
PLSA_UNICODE_STRING name,
|
|
|
|
TRUSTED_INFORMATION_CLASS class,
|
|
|
|
PVOID *buffer)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p,%d,%p) stub\n", policy, name, class, buffer);
|
|
|
|
return STATUS_OBJECT_NAME_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* LsaRegisterPolicyChangeNotification [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaRegisterPolicyChangeNotification(
|
|
|
|
POLICY_NOTIFICATION_INFORMATION_CLASS class,
|
|
|
|
HANDLE event)
|
|
|
|
{
|
|
|
|
FIXME("(%d,%p) stub\n", class, event);
|
|
|
|
return STATUS_UNSUCCESSFUL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* LsaRemoveAccountRights [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaRemoveAccountRights(
|
|
|
|
LSA_HANDLE policy,
|
|
|
|
PSID sid,
|
|
|
|
BOOLEAN all,
|
|
|
|
PLSA_UNICODE_STRING rights,
|
|
|
|
ULONG count)
|
|
|
|
{
|
2006-10-03 15:48:41 +02:00
|
|
|
FIXME("(%p,%p,%d,%p,0x%08x) stub\n", policy, sid, all, rights, count);
|
2006-03-11 11:54:54 +01:00
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-07-06 12:37:50 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* LsaRetrievePrivateData [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* Retrieves data stored by LsaStorePrivateData.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* PolicyHandle [I] Handle to a Policy object.
|
|
|
|
* KeyName [I] Name of the key where the data is stored.
|
|
|
|
* PrivateData [O] Pointer to the private data.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: STATUS_SUCCESS.
|
|
|
|
* Failure: STATUS_OBJECT_NAME_NOT_FOUND or NTSTATUS code.
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaRetrievePrivateData(
|
|
|
|
IN LSA_HANDLE PolicyHandle,
|
|
|
|
IN PLSA_UNICODE_STRING KeyName,
|
|
|
|
OUT PLSA_UNICODE_STRING* PrivateData)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p,%p) stub\n", PolicyHandle, KeyName, PrivateData);
|
|
|
|
return STATUS_OBJECT_NAME_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* LsaSetInformationPolicy [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* Modifies information in a Policy object.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* PolicyHandle [I] Handle to a Policy object.
|
|
|
|
* InformationClass [I] Type of information to set.
|
|
|
|
* Buffer [I] Pointer to the information to set.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: STATUS_SUCCESS.
|
|
|
|
* Failure: NTSTATUS code.
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaSetInformationPolicy(
|
|
|
|
IN LSA_HANDLE PolicyHandle,
|
|
|
|
IN POLICY_INFORMATION_CLASS InformationClass,
|
|
|
|
IN PVOID Buffer)
|
|
|
|
{
|
|
|
|
FIXME("(%p,0x%08x,%p) stub\n", PolicyHandle, InformationClass, Buffer);
|
|
|
|
|
|
|
|
return STATUS_UNSUCCESSFUL;
|
|
|
|
}
|
|
|
|
|
2008-11-11 08:12:23 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* LsaSetSecret [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* Set old and new values on a secret handle
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* SecretHandle [I] Handle to a secret object.
|
|
|
|
* EncryptedCurrentValue [I] Pointer to encrypted new value, can be NULL
|
|
|
|
* EncryptedOldValue [I] Pointer to encrypted old value, can be NULL
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: STATUS_SUCCESS
|
|
|
|
* Failure: NTSTATUS code.
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaSetSecret(
|
|
|
|
IN LSA_HANDLE SecretHandle,
|
|
|
|
IN PLSA_UNICODE_STRING EncryptedCurrentValue,
|
|
|
|
IN PLSA_UNICODE_STRING EncryptedOldValue)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p,%p) stub\n", SecretHandle, EncryptedCurrentValue,
|
|
|
|
EncryptedOldValue);
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2006-03-11 11:54:54 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* LsaSetTrustedDomainInfoByName [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaSetTrustedDomainInfoByName(
|
|
|
|
LSA_HANDLE policy,
|
|
|
|
PLSA_UNICODE_STRING name,
|
|
|
|
TRUSTED_INFORMATION_CLASS class,
|
|
|
|
PVOID buffer)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p,%d,%p) stub\n", policy, name, class, buffer);
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* LsaSetTrustedDomainInformation [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaSetTrustedDomainInformation(
|
|
|
|
LSA_HANDLE policy,
|
|
|
|
PSID sid,
|
|
|
|
TRUSTED_INFORMATION_CLASS class,
|
|
|
|
PVOID buffer)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p,%d,%p) stub\n", policy, sid, class, buffer);
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-07-06 12:37:50 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* LsaStorePrivateData [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* Stores or deletes a Policy object's data under the specified reg key.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* PolicyHandle [I] Handle to a Policy object.
|
|
|
|
* KeyName [I] Name of the key where the data will be stored.
|
|
|
|
* PrivateData [O] Pointer to the private data.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: STATUS_SUCCESS.
|
|
|
|
* Failure: STATUS_OBJECT_NAME_NOT_FOUND or NTSTATUS code.
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaStorePrivateData(
|
|
|
|
IN LSA_HANDLE PolicyHandle,
|
|
|
|
IN PLSA_UNICODE_STRING KeyName,
|
|
|
|
IN PLSA_UNICODE_STRING PrivateData)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p,%p) stub\n", PolicyHandle, KeyName, PrivateData);
|
|
|
|
return STATUS_OBJECT_NAME_NOT_FOUND;
|
|
|
|
}
|
2006-03-11 11:54:54 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* LsaUnregisterPolicyChangeNotification [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI LsaUnregisterPolicyChangeNotification(
|
|
|
|
POLICY_NOTIFICATION_INFORMATION_CLASS class,
|
|
|
|
HANDLE event)
|
|
|
|
{
|
|
|
|
FIXME("(%d,%p) stub\n", class, event);
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|