Author: ekohl
Date: Tue Sep 26 07:51:56 2017
New Revision: 75971
URL:
http://svn.reactos.org/svn/reactos?rev=75971&view=rev
Log:
[NETAPI32]
Rename misc.c to utils.c because misc.c will be used for something else.
Added:
trunk/reactos/dll/win32/netapi32/utils.c
- copied, changed from r75964, trunk/reactos/dll/win32/netapi32/misc.c
Removed:
trunk/reactos/dll/win32/netapi32/misc.c
Modified:
trunk/reactos/dll/win32/netapi32/CMakeLists.txt
Modified: trunk/reactos/dll/win32/netapi32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/CMakeLi…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/CMakeLists.txt [iso-8859-1] Tue Sep 26 07:51:56 2017
@@ -20,7 +20,6 @@
dssetup.c
group.c
local_group.c
- misc.c
nbcmdqueue.c
nbnamecache.c
nbt.c
@@ -31,6 +30,7 @@
schedule.c
srvsvc.c
user.c
+ utils.c
wksta.c
wksta_new.c
netapi32.h
Removed: trunk/reactos/dll/win32/netapi32/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/misc.c?…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/misc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/misc.c (removed)
@@ -1,218 +0,0 @@
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: NetAPI DLL
- * FILE: reactos/dll/win32/netapi32/misc.c
- * PURPOSE: Helper functions
- *
- * PROGRAMMERS: Eric Kohl
- */
-
-/* INCLUDES ******************************************************************/
-
-#include "netapi32.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
-
-/* GLOBALS *******************************************************************/
-
-static SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
-
-/* FUNCTIONS *****************************************************************/
-
-NTSTATUS
-GetAccountDomainSid(IN PUNICODE_STRING ServerName,
- OUT PSID *AccountDomainSid)
-{
- PPOLICY_ACCOUNT_DOMAIN_INFO AccountDomainInfo = NULL;
- LSA_OBJECT_ATTRIBUTES ObjectAttributes;
- LSA_HANDLE PolicyHandle = NULL;
- ULONG Length = 0;
- NTSTATUS Status;
-
- memset(&ObjectAttributes, 0, sizeof(LSA_OBJECT_ATTRIBUTES));
-
- Status = LsaOpenPolicy(ServerName,
- &ObjectAttributes,
- POLICY_VIEW_LOCAL_INFORMATION,
- &PolicyHandle);
- if (!NT_SUCCESS(Status))
- {
- ERR("LsaOpenPolicy failed (Status %08lx)\n", Status);
- return Status;
- }
-
- Status = LsaQueryInformationPolicy(PolicyHandle,
- PolicyAccountDomainInformation,
- (PVOID *)&AccountDomainInfo);
- if (!NT_SUCCESS(Status))
- {
- ERR("LsaQueryInformationPolicy failed (Status %08lx)\n", Status);
- goto done;
- }
-
- Length = RtlLengthSid(AccountDomainInfo->DomainSid);
-
- *AccountDomainSid = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length);
- if (*AccountDomainSid == NULL)
- {
- ERR("Failed to allocate SID\n");
- Status = STATUS_INSUFFICIENT_RESOURCES;
- goto done;
- }
-
- memcpy(*AccountDomainSid, AccountDomainInfo->DomainSid, Length);
-
-done:
- if (AccountDomainInfo != NULL)
- LsaFreeMemory(AccountDomainInfo);
-
- LsaClose(PolicyHandle);
-
- return Status;
-}
-
-
-NTSTATUS
-GetBuiltinDomainSid(OUT PSID *BuiltinDomainSid)
-{
- PSID Sid = NULL;
- PULONG Ptr;
- NTSTATUS Status = STATUS_SUCCESS;
-
- *BuiltinDomainSid = NULL;
-
- Sid = RtlAllocateHeap(RtlGetProcessHeap(),
- 0,
- RtlLengthRequiredSid(1));
- if (Sid == NULL)
- return STATUS_INSUFFICIENT_RESOURCES;
-
- Status = RtlInitializeSid(Sid,
- &NtAuthority,
- 1);
- if (!NT_SUCCESS(Status))
- goto done;
-
- Ptr = RtlSubAuthoritySid(Sid, 0);
- *Ptr = SECURITY_BUILTIN_DOMAIN_RID;
-
- *BuiltinDomainSid = Sid;
-
-done:
- if (!NT_SUCCESS(Status))
- {
- if (Sid != NULL)
- RtlFreeHeap(RtlGetProcessHeap(), 0, Sid);
- }
-
- return Status;
-}
-
-
-NTSTATUS
-OpenAccountDomain(IN SAM_HANDLE ServerHandle,
- IN PUNICODE_STRING ServerName,
- IN ULONG DesiredAccess,
- OUT PSAM_HANDLE DomainHandle)
-{
- PSID DomainSid = NULL;
- NTSTATUS Status;
-
- Status = GetAccountDomainSid(ServerName,
- &DomainSid);
- if (!NT_SUCCESS(Status))
- {
- ERR("GetAccountDomainSid failed (Status %08lx)\n", Status);
- return Status;
- }
-
- Status = SamOpenDomain(ServerHandle,
- DesiredAccess,
- DomainSid,
- DomainHandle);
-
- RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
-
- if (!NT_SUCCESS(Status))
- {
- ERR("SamOpenDomain failed (Status %08lx)\n", Status);
- }
-
- return Status;
-}
-
-
-NTSTATUS
-OpenBuiltinDomain(IN SAM_HANDLE ServerHandle,
- IN ULONG DesiredAccess,
- OUT PSAM_HANDLE DomainHandle)
-{
- PSID DomainSid = NULL;
- NTSTATUS Status;
-
- Status = GetBuiltinDomainSid(&DomainSid);
- if (!NT_SUCCESS(Status))
- {
- ERR("GetBuiltinDomainSid failed (Status %08lx)\n", Status);
- return Status;
- }
-
- Status = SamOpenDomain(ServerHandle,
- DesiredAccess,
- DomainSid,
- DomainHandle);
-
- RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
-
- if (!NT_SUCCESS(Status))
- {
- ERR("SamOpenDomain failed (Status %08lx)\n", Status);
- }
-
- return Status;
-}
-
-
-NET_API_STATUS
-BuildSidFromSidAndRid(IN PSID SrcSid,
- IN ULONG RelativeId,
- OUT PSID *DestSid)
-{
- UCHAR RidCount;
- PSID DstSid;
- ULONG i;
- ULONG DstSidSize;
- PULONG p, q;
- NET_API_STATUS ApiStatus = NERR_Success;
-
- RidCount = *RtlSubAuthorityCountSid(SrcSid);
- if (RidCount >= 8)
- return ERROR_INVALID_PARAMETER;
-
- DstSidSize = RtlLengthRequiredSid(RidCount + 1);
-
- ApiStatus = NetApiBufferAllocate(DstSidSize,
- &DstSid);
- if (ApiStatus != NERR_Success)
- return ApiStatus;
-
- RtlInitializeSid(DstSid,
- RtlIdentifierAuthoritySid(SrcSid),
- RidCount + 1);
-
- for (i = 0; i < (ULONG)RidCount; i++)
- {
- p = RtlSubAuthoritySid(SrcSid, i);
- q = RtlSubAuthoritySid(DstSid, i);
- *q = *p;
- }
-
- q = RtlSubAuthoritySid(DstSid, (ULONG)RidCount);
- *q = RelativeId;
-
- *DestSid = DstSid;
-
- return NERR_Success;
-}
-
-/* EOF */
Copied: trunk/reactos/dll/win32/netapi32/utils.c (from r75964,
trunk/reactos/dll/win32/netapi32/misc.c)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/utils.c…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/misc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/utils.c [iso-8859-1] Tue Sep 26 07:51:56 2017
@@ -1,7 +1,7 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: NetAPI DLL
- * FILE: reactos/dll/win32/netapi32/misc.c
+ * FILE: reactos/dll/win32/netapi32/utils.c
* PURPOSE: Helper functions
*
* PROGRAMMERS: Eric Kohl