Author: ekohl
Date: Sat Sep 22 09:23:38 2012
New Revision: 57361
URL:
http://svn.reactos.org/svn/reactos?rev=57361&view=rev
Log:
[ADVAPI32]
Implement LsaGetUserName and LsaOpenTrustedDomain.
Modified:
trunk/reactos/dll/win32/advapi32/advapi32.spec
trunk/reactos/dll/win32/advapi32/sec/lsa.c
trunk/reactos/include/psdk/ntsecapi.h
Modified: trunk/reactos/dll/win32/advapi32/advapi32.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/advapi3…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/advapi32.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/advapi32.spec [iso-8859-1] Sat Sep 22 09:23:38 2012
@@ -381,7 +381,7 @@
@ stdcall LsaOpenPolicy(ptr ptr long ptr)
@ stub LsaOpenPolicySce
@ stdcall LsaOpenSecret(ptr ptr long ptr)
-@ stub LsaOpenTrustedDomain
+@ stdcall LsaOpenTrustedDomain(ptr ptr long ptr)
@ stdcall LsaOpenTrustedDomainByName(ptr ptr long ptr)
@ stdcall LsaQueryDomainInformationPolicy(ptr long ptr)
@ stdcall LsaQueryForestTrustInformation(ptr ptr ptr)
Modified: trunk/reactos/dll/win32/advapi32/sec/lsa.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/lsa…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/sec/lsa.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/sec/lsa.c [iso-8859-1] Sat Sep 22 09:23:38 2012
@@ -547,12 +547,40 @@
*/
NTSTATUS
WINAPI
-LsaGetUserName(PUNICODE_STRING *UserName,
- PUNICODE_STRING *DomainName)
-{
- FIXME("LsaGetUserName(%p %p) stub\n",
+LsaGetUserName(OUT PUNICODE_STRING *UserName,
+ OUT PUNICODE_STRING *DomainName OPTIONAL)
+{
+ PRPC_UNICODE_STRING UserNameString = NULL;
+ PRPC_UNICODE_STRING DomainNameString = NULL;
+ NTSTATUS Status;
+
+ TRACE("LsaGetUserName(%p %p)\n",
UserName, DomainName);
- return STATUS_NOT_IMPLEMENTED;
+
+ RpcTryExcept
+ {
+ Status = LsarGetUserName(NULL,
+ &UserNameString,
+ (DomainName != NULL) ? &DomainNameString : NULL);
+
+ *UserName = (PUNICODE_STRING)UserNameString;
+
+ if (DomainName != NULL)
+ *DomainName = (PUNICODE_STRING)DomainNameString;
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ if (UserNameString != NULL)
+ MIDL_user_free(UserNameString);
+
+ if (DomainNameString != NULL)
+ MIDL_user_free(DomainNameString);
+
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return Status;
}
@@ -913,6 +941,38 @@
RpcEndExcept;
TRACE("LsaOpenSecret() done (Status: 0x%08lx)\n", Status);
+
+ return Status;
+}
+
+
+/*
+ * @implemented
+ */
+NTSTATUS
+WINAPI
+LsaOpenTrustedDomain(IN LSA_HANDLE PolicyHandle,
+ IN PSID TrustedDomainSid,
+ IN ACCESS_MASK DesiredAccess,
+ OUT PLSA_HANDLE TrustedDomainHandle)
+{
+ NTSTATUS Status;
+
+ TRACE("LsaOpenTrustedDomain(%p %p 0x%08lx %p)\n",
+ PolicyHandle, TrustedDomainSid, DesiredAccess, TrustedDomainHandle);
+
+ RpcTryExcept
+ {
+ Status = LsarOpenTrustedDomain((LSAPR_HANDLE)PolicyHandle,
+ (PRPC_SID)TrustedDomainSid,
+ DesiredAccess,
+ (PLSAPR_HANDLE)TrustedDomainHandle);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
return Status;
}
Modified: trunk/reactos/include/psdk/ntsecapi.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ntsecapi.h?re…
==============================================================================
--- trunk/reactos/include/psdk/ntsecapi.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/ntsecapi.h [iso-8859-1] Sat Sep 22 09:23:38 2012
@@ -679,18 +679,19 @@
NTSTATUS NTAPI LsaClearAuditLog(LSA_HANDLE);
NTSTATUS NTAPI LsaClose(LSA_HANDLE);
NTSTATUS NTAPI LsaConnectUntrusted(PHANDLE);
-NTSTATUS NTAPI LsaCreateAccount(LSA_HANDLE, PSID, ACCESS_MASK, PLSA_HANDLE);
-NTSTATUS NTAPI LsaCreateSecret(LSA_HANDLE, PLSA_UNICODE_STRING, ACCESS_MASK,
PLSA_HANDLE);
-NTSTATUS NTAPI LsaCreateTrustedDomain(LSA_HANDLE, PLSA_TRUST_INFORMATION,
- ACCESS_MASK, PLSA_HANDLE);
-NTSTATUS NTAPI LsaCreateTrustedDomainEx(LSA_HANDLE, PTRUSTED_DOMAIN_INFORMATION_EX,
- PTRUSTED_DOMAIN_AUTH_INFORMATION, ACCESS_MASK, PLSA_HANDLE);
+NTSTATUS NTAPI LsaCreateAccount(LSA_HANDLE,PSID,ACCESS_MASK,PLSA_HANDLE);
+NTSTATUS NTAPI LsaCreateSecret(LSA_HANDLE,PLSA_UNICODE_STRING,ACCESS_MASK,PLSA_HANDLE);
+NTSTATUS NTAPI LsaCreateTrustedDomain(LSA_HANDLE,PLSA_TRUST_INFORMATION,
+ ACCESS_MASK,PLSA_HANDLE);
+NTSTATUS NTAPI LsaCreateTrustedDomainEx(LSA_HANDLE,PTRUSTED_DOMAIN_INFORMATION_EX,
+ PTRUSTED_DOMAIN_AUTH_INFORMATION,ACCESS_MASK,PLSA_HANDLE);
+NTSTATUS NTAPI LsaDelete(LSA_HANDLE);
NTSTATUS NTAPI LsaDeleteTrustedDomain(LSA_HANDLE,PSID);
NTSTATUS NTAPI LsaDeregisterLogonProcess(HANDLE);
NTSTATUS NTAPI LsaEnumerateAccountRights(LSA_HANDLE,PSID,PLSA_UNICODE_STRING*,PULONG);
NTSTATUS NTAPI LsaEnumerateAccountsWithUserRight(LSA_HANDLE,PLSA_UNICODE_STRING,
PVOID*,PULONG);
-NTSTATUS NTAPI LsaEnumeratePrivilegesOfAccount(LSA_HANDLE, PPRIVILEGE_SET*);
+NTSTATUS NTAPI LsaEnumeratePrivilegesOfAccount(LSA_HANDLE,PPRIVILEGE_SET*);
NTSTATUS NTAPI LsaEnumerateTrustedDomains(LSA_HANDLE,PLSA_ENUMERATION_HANDLE,
PVOID*,ULONG,PULONG);
NTSTATUS NTAPI LsaEnumerateTrustedDomainsEx(LSA_HANDLE,PLSA_ENUMERATION_HANDLE,
@@ -698,6 +699,7 @@
NTSTATUS NTAPI LsaFreeMemory(PVOID);
NTSTATUS NTAPI LsaFreeReturnBuffer(PVOID);
NTSTATUS NTAPI LsaGetSystemAccessAccount(LSA_HANDLE, PULONG);
+NTSTATUS NTAPI LsaGetUserName(PUNICODE_STRING*,PUNICODE_STRING*);
NTSTATUS NTAPI LsaLogonUser(HANDLE,PLSA_STRING,SECURITY_LOGON_TYPE,ULONG,PVOID,
ULONG,PTOKEN_GROUPS,PTOKEN_SOURCE,PVOID*,PULONG,
PLUID,PHANDLE,PQUOTA_LIMITS,PNTSTATUS);
@@ -706,17 +708,18 @@
PLSA_REFERENCED_DOMAIN_LIST*,PLSA_TRANSLATED_SID*);
NTSTATUS NTAPI LsaLookupNames2(LSA_HANDLE,ULONG,ULONG,PLSA_UNICODE_STRING,
PLSA_REFERENCED_DOMAIN_LIST*,PLSA_TRANSLATED_SID2*);
-NTSTATUS NTAPI LsaLookupPrivilegeName(LSA_HANDLE, PLUID, PLSA_UNICODE_STRING*);
-NTSTATUS NTAPI LsaLookupPrivilegeValue(LSA_HANDLE, PLSA_UNICODE_STRING, PLUID);
+NTSTATUS NTAPI LsaLookupPrivilegeName(LSA_HANDLE,PLUID,PLSA_UNICODE_STRING*);
+NTSTATUS NTAPI LsaLookupPrivilegeValue(LSA_HANDLE,PLSA_UNICODE_STRING,PLUID);
NTSTATUS NTAPI LsaLookupSids(LSA_HANDLE,ULONG,PSID*,
PLSA_REFERENCED_DOMAIN_LIST*,PLSA_TRANSLATED_NAME*);
ULONG NTAPI LsaNtStatusToWinError(NTSTATUS);
-NTSTATUS NTAPI LsaOpenAccount(LSA_HANDLE, PSID, ACCESS_MASK, PLSA_HANDLE);
+NTSTATUS NTAPI LsaOpenAccount(LSA_HANDLE,PSID,ACCESS_MASK,PLSA_HANDLE);
NTSTATUS NTAPI LsaOpenPolicy(PLSA_UNICODE_STRING,PLSA_OBJECT_ATTRIBUTES,
ACCESS_MASK,PLSA_HANDLE);
NTSTATUS NTAPI LsaOpenSecret(LSA_HANDLE, PLSA_UNICODE_STRING, ACCESS_MASK, PLSA_HANDLE);
-NTSTATUS NTAPI LsaOpenTrustedDomainByName(LSA_HANDLE, PLSA_UNICODE_STRING,
- ACCESS_MASK, PLSA_HANDLE);
+NTSTATUS NTAPI LsaOpenTrustedDomain(LSA_HANDLE,PSID,ACCESS_MASK,PLSA_HANDLE);
+NTSTATUS NTAPI LsaOpenTrustedDomainByName(LSA_HANDLE,PLSA_UNICODE_STRING,
+ ACCESS_MASK,PLSA_HANDLE);
NTSTATUS NTAPI LsaQueryDomainInformationPolicy(LSA_HANDLE,
POLICY_DOMAIN_INFORMATION_CLASS,PVOID*);
NTSTATUS NTAPI LsaQueryInformationPolicy(LSA_HANDLE,POLICY_INFORMATION_CLASS,PVOID*);
@@ -738,8 +741,8 @@
NTSTATUS NTAPI LsaSetInformationPolicy(LSA_HANDLE,POLICY_INFORMATION_CLASS, PVOID);
NTSTATUS NTAPI LsaSetLocalInformationPolicy(LSA_HANDLE,
POLICY_LOCAL_INFORMATION_CLASS,PVOID);
-NTSTATUS NTAPI LsaSetSecret(LSA_HANDLE, PLSA_UNICODE_STRING, PLSA_UNICODE_STRING);
-NTSTATUS NTAPI LsaSetSystemAccessAccount(LSA_HANDLE, ULONG);
+NTSTATUS NTAPI LsaSetSecret(LSA_HANDLE,PLSA_UNICODE_STRING,PLSA_UNICODE_STRING);
+NTSTATUS NTAPI LsaSetSystemAccessAccount(LSA_HANDLE,ULONG);
NTSTATUS NTAPI LsaSetTrustedDomainInformation(LSA_HANDLE,PSID,
TRUSTED_INFORMATION_CLASS,PVOID);
NTSTATUS NTAPI LsaSetTrustedDomainInfoByName(LSA_HANDLE,PLSA_UNICODE_STRING,