Implemented LsaFreeMemory and

changed a few stubs to match WINE so Msys will load.

svn path=/trunk/; revision=8176
This commit is contained in:
Steven Edwards 2004-02-14 23:13:58 +00:00
parent a3f6dab278
commit 459d72e610

View file

@ -1,4 +1,4 @@
/* $Id: lsa.c,v 1.7 2004/01/20 01:40:19 ekohl Exp $ /* $Id: lsa.c,v 1.8 2004/02/14 23:13:58 sedwards Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -9,40 +9,132 @@
* 19990322 EA created * 19990322 EA created
* 19990515 EA stubs * 19990515 EA stubs
* 20030202 KJK compressed stubs * 20030202 KJK compressed stubs
*
*/ */
#include <windows.h> #include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <ntsecapi.h> #include <ntsecapi.h>
#include <debug.h>
/* /******************************************************************************
* LsaOpenPolicy [ADVAPI32.@]
*
* PARAMS
* x1 []
* x2 []
* x3 []
* x4 []
*
* @unimplemented * @unimplemented
*/ */
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaOpenPolicy(PLSA_UNICODE_STRING lsaucs,PLSA_OBJECT_ATTRIBUTES lsaoa,ACCESS_MASK access,PLSA_HANDLE lsah) LsaOpenPolicy(PLSA_UNICODE_STRING lsaucs,PLSA_OBJECT_ATTRIBUTES lsaoa,ACCESS_MASK access,PLSA_HANDLE lsah)
{ {
return(FALSE); DPRINT1("LsaOpenPolicy - stub\n");
return STATUS_SUCCESS;
} }
/* /*
* @unimplemented * @unimplemented
*/ */
#define SID_REVISION (1) /* Current revision - winnt.h */
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaQueryInformationPolicy(LSA_HANDLE lsah,POLICY_INFORMATION_CLASS pic,PVOID* pv) LsaQueryInformationPolicy(LSA_HANDLE lsah,POLICY_INFORMATION_CLASS pic,PVOID* Buffer)
{ {
return(FALSE); DPRINT1("(%p,0x%08x,%p):LsaQueryInformationPolicy stub\n",
lsah, pic, Buffer);
if(!Buffer) return FALSE;
switch (pic)
{
case PolicyAuditEventsInformation: /* 2 */
{
PPOLICY_AUDIT_EVENTS_INFO p = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(POLICY_AUDIT_EVENTS_INFO));
p->AuditingMode = FALSE; /* no auditing */
*Buffer = p;
}
break;
case PolicyPrimaryDomainInformation: /* 3 */
case PolicyAccountDomainInformation: /* 5 */
{
struct di
{ POLICY_PRIMARY_DOMAIN_INFO ppdi;
SID sid;
};
SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
struct di * xdi = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(xdi));
HKEY key;
BOOL useDefault = TRUE;
LONG ret;
if ((ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
"System\\CurrentControlSet\\Services\\VxD\\VNETSUP", 0,
KEY_READ, &key)) == ERROR_SUCCESS)
{
DWORD size = 0;
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)
{
xdi->ppdi.Name.Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
HEAP_ZERO_MEMORY, size);
if ((ret = RegQueryValueExW(key, wg, NULL, NULL,
(LPBYTE)xdi->ppdi.Name.Buffer, &size)) == ERROR_SUCCESS)
{
xdi->ppdi.Name.Length = (USHORT)size;
useDefault = FALSE;
}
else
{
RtlFreeHeap(RtlGetProcessHeap(), 0, xdi->ppdi.Name.Buffer);
xdi->ppdi.Name.Buffer = NULL;
}
}
RegCloseKey(key);
}
if (useDefault)
RtlCreateUnicodeStringFromAsciiz(&(xdi->ppdi.Name), "DOMAIN");
DPRINT1("setting domain to \n");
xdi->ppdi.Sid = &(xdi->sid);
xdi->sid.Revision = SID_REVISION;
xdi->sid.SubAuthorityCount = 1;
xdi->sid.IdentifierAuthority = localSidAuthority;
xdi->sid.SubAuthority[0] = SECURITY_LOCAL_SYSTEM_RID;
*Buffer = xdi;
}
break;
case PolicyAuditLogInformation:
case PolicyPdAccountInformation:
case PolicyLsaServerRoleInformation:
case PolicyReplicaSourceInformation:
case PolicyDefaultQuotaInformation:
case PolicyModificationInformation:
case PolicyAuditFullSetInformation:
case PolicyAuditFullQueryInformation:
case PolicyDnsDomainInformation:
{
DPRINT1("category not implemented\n");
return FALSE;
}
}
return TRUE;
} }
/* /*
* @unimplemented * @implemented
*/ */
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaFreeMemory(PVOID pv) LsaFreeMemory(PVOID pv)
{ {
return(FALSE); return RtlFreeHeap(RtlGetProcessHeap(), 0, pv);
} }
/* /*
@ -52,7 +144,8 @@ NTSTATUS
STDCALL STDCALL
LsaClose(LSA_HANDLE ObjectHandle) LsaClose(LSA_HANDLE ObjectHandle)
{ {
return(FALSE); DPRINT1("(%p):LsaClose stub\n",ObjectHandle);
return 0xc0000000;
} }
/* /*
@ -61,7 +154,7 @@ LsaClose(LSA_HANDLE ObjectHandle)
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaAddAccountRights( LsaAddAccountRights(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PSID AccountSid, PSID AccountSid,
PLSA_UNICODE_STRING UserRights, PLSA_UNICODE_STRING UserRights,
ULONG CountOfRights ULONG CountOfRights
@ -76,7 +169,7 @@ LsaAddAccountRights(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaCreateTrustedDomainEx( LsaCreateTrustedDomainEx(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PTRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation, PTRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation,
PTRUSTED_DOMAIN_AUTH_INFORMATION AuthenticationInformation, PTRUSTED_DOMAIN_AUTH_INFORMATION AuthenticationInformation,
ACCESS_MASK DesiredAccess, ACCESS_MASK DesiredAccess,
@ -92,7 +185,7 @@ LsaCreateTrustedDomainEx(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaDeleteTrustedDomain( LsaDeleteTrustedDomain(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PSID TrustedDomainSid PSID TrustedDomainSid
) )
{ {
@ -105,7 +198,7 @@ LsaDeleteTrustedDomain(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaEnumerateAccountRights( LsaEnumerateAccountRights(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PSID AccountSid, PSID AccountSid,
PLSA_UNICODE_STRING *UserRights, PLSA_UNICODE_STRING *UserRights,
PULONG CountOfRights PULONG CountOfRights
@ -120,7 +213,7 @@ LsaEnumerateAccountRights(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaEnumerateAccountsWithUserRight( LsaEnumerateAccountsWithUserRight(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
OPTIONAL PLSA_UNICODE_STRING UserRights, OPTIONAL PLSA_UNICODE_STRING UserRights,
PVOID *EnumerationBuffer, PVOID *EnumerationBuffer,
PULONG CountReturned PULONG CountReturned
@ -135,7 +228,7 @@ LsaEnumerateAccountsWithUserRight(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaEnumerateTrustedDomains( LsaEnumerateTrustedDomains(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PLSA_ENUMERATION_HANDLE EnumerationContext, PLSA_ENUMERATION_HANDLE EnumerationContext,
PVOID *Buffer, PVOID *Buffer,
ULONG PreferedMaximumLength, ULONG PreferedMaximumLength,
@ -151,7 +244,7 @@ LsaEnumerateTrustedDomains(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaEnumerateTrustedDomainsEx( LsaEnumerateTrustedDomainsEx(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PLSA_ENUMERATION_HANDLE EnumerationContext, PLSA_ENUMERATION_HANDLE EnumerationContext,
PVOID *Buffer, PVOID *Buffer,
ULONG PreferedMaximumLength, ULONG PreferedMaximumLength,
@ -167,7 +260,7 @@ LsaEnumerateTrustedDomainsEx(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaLookupNames( LsaLookupNames(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
ULONG Count, ULONG Count,
PLSA_UNICODE_STRING Names, PLSA_UNICODE_STRING Names,
PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
@ -183,7 +276,7 @@ LsaLookupNames(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaLookupNames2( LsaLookupNames2(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
ULONG Flags, ULONG Flags,
ULONG Count, ULONG Count,
PLSA_UNICODE_STRING Names, PLSA_UNICODE_STRING Names,
@ -200,7 +293,7 @@ LsaLookupNames2(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaLookupSids( LsaLookupSids(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
ULONG Count, ULONG Count,
PSID *Sids, PSID *Sids,
PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
@ -216,7 +309,7 @@ LsaLookupSids(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaOpenTrustedDomainByName( LsaOpenTrustedDomainByName(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PLSA_UNICODE_STRING TrustedDomainName, PLSA_UNICODE_STRING TrustedDomainName,
ACCESS_MASK DesiredAccess, ACCESS_MASK DesiredAccess,
PLSA_HANDLE TrustedDomainHandle PLSA_HANDLE TrustedDomainHandle
@ -231,8 +324,8 @@ LsaOpenTrustedDomainByName(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaQueryDomainInformationPolicy( LsaQueryDomainInformationPolicy(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
POLICY_DOMAIN_INFORMATION_CLASS InformationClass, POLICY_DOMAIN_INFORMATION_CLASS pic,
PVOID *Buffer PVOID *Buffer
) )
{ {
@ -245,7 +338,7 @@ LsaQueryDomainInformationPolicy(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaQueryForestTrustInformation( LsaQueryForestTrustInformation(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PLSA_UNICODE_STRING TrustedDomainName, PLSA_UNICODE_STRING TrustedDomainName,
PLSA_FOREST_TRUST_INFORMATION * ForestTrustInfo PLSA_FOREST_TRUST_INFORMATION * ForestTrustInfo
) )
@ -259,9 +352,9 @@ LsaQueryForestTrustInformation(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaQueryTrustedDomainInfoByName( LsaQueryTrustedDomainInfoByName(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PLSA_UNICODE_STRING TrustedDomainName, PLSA_UNICODE_STRING TrustedDomainName,
TRUSTED_INFORMATION_CLASS InformationClass, TRUSTED_INFORMATION_CLASS pic,
PVOID *Buffer PVOID *Buffer
) )
{ {
@ -274,9 +367,9 @@ LsaQueryTrustedDomainInfoByName(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaQueryTrustedDomainInfo( LsaQueryTrustedDomainInfo(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PSID TrustedDomainSid, PSID TrustedDomainSid,
TRUSTED_INFORMATION_CLASS InformationClass, TRUSTED_INFORMATION_CLASS pic,
PVOID *Buffer PVOID *Buffer
) )
{ {
@ -289,7 +382,7 @@ LsaQueryTrustedDomainInfo(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaRemoveAccountRights( LsaRemoveAccountRights(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PSID AccountSid, PSID AccountSid,
BOOL AllRights, BOOL AllRights,
PLSA_UNICODE_STRING UserRights, PLSA_UNICODE_STRING UserRights,
@ -305,7 +398,7 @@ LsaRemoveAccountRights(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaRetrievePrivateData( LsaRetrievePrivateData(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PLSA_UNICODE_STRING KeyName, PLSA_UNICODE_STRING KeyName,
PLSA_UNICODE_STRING * PrivateData PLSA_UNICODE_STRING * PrivateData
) )
@ -319,8 +412,8 @@ LsaRetrievePrivateData(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaSetDomainInformationPolicy( LsaSetDomainInformationPolicy(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
POLICY_DOMAIN_INFORMATION_CLASS InformationClass, POLICY_DOMAIN_INFORMATION_CLASS pic,
PVOID Buffer PVOID Buffer
) )
{ {
@ -333,8 +426,8 @@ LsaSetDomainInformationPolicy(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaSetInformationPolicy( LsaSetInformationPolicy(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
POLICY_INFORMATION_CLASS InformationClass, POLICY_INFORMATION_CLASS pic,
PVOID Buffer PVOID Buffer
) )
{ {
@ -347,7 +440,7 @@ LsaSetInformationPolicy(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaSetForestTrustInformation( LsaSetForestTrustInformation(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PLSA_UNICODE_STRING TrustedDomainName, PLSA_UNICODE_STRING TrustedDomainName,
PLSA_FOREST_TRUST_INFORMATION ForestTrustInfo, PLSA_FOREST_TRUST_INFORMATION ForestTrustInfo,
BOOL CheckOnly, BOOL CheckOnly,
@ -363,9 +456,9 @@ LsaSetForestTrustInformation(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaSetTrustedDomainInfoByName( LsaSetTrustedDomainInfoByName(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PLSA_UNICODE_STRING TrustedDomainName, PLSA_UNICODE_STRING TrustedDomainName,
TRUSTED_INFORMATION_CLASS InformationClass, TRUSTED_INFORMATION_CLASS pic,
PVOID Buffer PVOID Buffer
) )
{ {
@ -378,9 +471,9 @@ LsaSetTrustedDomainInfoByName(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaSetTrustedDomainInformation( LsaSetTrustedDomainInformation(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PSID TrustedDomainSid, PSID TrustedDomainSid,
TRUSTED_INFORMATION_CLASS InformationClass, TRUSTED_INFORMATION_CLASS pic,
PVOID Buffer PVOID Buffer
) )
{ {
@ -393,7 +486,7 @@ LsaSetTrustedDomainInformation(
NTSTATUS NTSTATUS
STDCALL STDCALL
LsaStorePrivateData( LsaStorePrivateData(
LSA_HANDLE PolicyHandle, LSA_HANDLE lsah,
PLSA_UNICODE_STRING KeyName, PLSA_UNICODE_STRING KeyName,
PLSA_UNICODE_STRING PrivateData PLSA_UNICODE_STRING PrivateData
) )