wine-staging/patches/advapi32-LsaLookupSids/0004-advapi32-Fallback-to-Sid-string-when-LookupAccountSi.patch

69 lines
1.8 KiB
Diff

From 616c17cc58a4943d3a367704943e737d5713740d Mon Sep 17 00:00:00 2001
From: Qian Hong <qhong@codeweavers.com>
Date: Tue, 7 Apr 2015 11:23:34 +0800
Subject: advapi32: Fallback to Sid string when LookupAccountSid fails.
---
dlls/advapi32/lsa.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/dlls/advapi32/lsa.c b/dlls/advapi32/lsa.c
index 258b8ca..93afa20 100644
--- a/dlls/advapi32/lsa.c
+++ b/dlls/advapi32/lsa.c
@@ -29,6 +29,7 @@
#include "winbase.h"
#include "winreg.h"
#include "winternl.h"
+#include "sddl.h"
#include "advapi32_misc.h"
#include "wine/debug.h"
@@ -554,6 +555,21 @@ NTSTATUS WINAPI LsaLookupSids(
heap_free(name);
}
}
+ else
+ {
+ WCHAR *strsid = NULL;
+
+ if (ConvertSidToStringSidW(Sids[i], &strsid))
+ {
+ name_size = strlenW(strsid) + 1;
+
+ (*Names)[i].Name.Length = (name_size - 1) * sizeof(WCHAR);
+ (*Names)[i].Name.MaximumLength = name_size * sizeof(WCHAR);
+ name_fullsize += (*Names)[i].Name.MaximumLength;
+
+ LocalFree(strsid);
+ }
+ }
}
/* now we have full length needed for both */
@@ -593,6 +609,21 @@ NTSTATUS WINAPI LsaLookupSids(
heap_free(domain.Buffer);
}
}
+ else
+ {
+ WCHAR *strsid = NULL;
+
+ if (ConvertSidToStringSidW(Sids[i], &strsid))
+ {
+ name_size = strlenW(strsid) + 1;
+ mapped++;
+
+ (*Names)[i].Name.Buffer = name_buffer;
+ memcpy((*Names)[i].Name.Buffer, strsid, name_size * sizeof(WCHAR));
+
+ LocalFree(strsid);
+ }
+ }
name_buffer += name_size;
}
--
2.3.5