Added patch to implement advapi32.GetWindowsAccountDomainSid.

This commit is contained in:
Sebastian Lackner 2015-06-13 21:04:59 +02:00
parent 53b165e070
commit 12f0292934
5 changed files with 283 additions and 40 deletions

View File

@ -39,7 +39,7 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
-----------------------------------
**Bug fixes and features included in the next upcoming release [22]:**
**Bug fixes and features included in the next upcoming release [23]:**
* Add implementation for kernel32.GetNumaProcessorNode ([Wine Bug #38660](https://bugs.winehq.org/show_bug.cgi?id=38660))
* Add semi-stub for FileFsVolumeInformation information class ([Wine Bug #21466](https://bugs.winehq.org/show_bug.cgi?id=21466))
@ -51,6 +51,7 @@ Included bug fixes and improvements
* Fix endless loop in regedit when importing files with very long lines
* Fix link notification conditions for riched20 ([Wine Bug #35949](https://bugs.winehq.org/show_bug.cgi?id=35949))
* Forward GIF encoder requests to windowscodecs ([Wine Bug #34356](https://bugs.winehq.org/show_bug.cgi?id=34356))
* Implement advapi32.GetWindowsAccountDomainSid ([Wine Bug #38624](https://bugs.winehq.org/show_bug.cgi?id=38624))
* Implement default homepage button in inetcpl.cpl
* Improve stub for NtQueryEaFile
* Initialize System\CurrentControlSet\Control\TimeZoneInformation registry keys

1
debian/changelog vendored
View File

@ -48,6 +48,7 @@ wine-staging (1.7.45) UNRELEASED; urgency=low
not available.
* Added patch to properly check existence of libunwind before linking against
it.
* Added patch to implement advapi32.GetWindowsAccountDomainSid.
* Removed patch to handle '\r' as whitespace in wbemprox queries (accepted
upstream).
* Removed patch to make sure OpenClipboard with current owner doesn't fail

View File

@ -0,0 +1,219 @@
From 4ba47dbc95a5a73ef646648a3ba8dd90a1089ee8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 13 Jun 2015 20:45:09 +0200
Subject: advapi32: Implement GetWindowsAccountDomainSid.
---
dlls/advapi32/advapi32.spec | 2 +-
dlls/advapi32/security.c | 45 +++++++++++++
dlls/advapi32/tests/security.c | 78 ++++++++++++++++++++++
.../api-ms-win-security-base-l1-1-0.spec | 2 +-
.../api-ms-win-security-base-l1-2-0.spec | 2 +-
5 files changed, 126 insertions(+), 3 deletions(-)
diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec
index 4600142..ec27440 100644
--- a/dlls/advapi32/advapi32.spec
+++ b/dlls/advapi32/advapi32.spec
@@ -363,7 +363,7 @@
@ stdcall GetTrusteeTypeW(ptr)
@ stdcall GetUserNameA(ptr ptr)
@ stdcall GetUserNameW(ptr ptr)
-# @ stub GetWindowsAccountDomainSid
+@ stdcall GetWindowsAccountDomainSid(ptr ptr ptr)
# @ stub I_QueryTagInformation
# @ stub I_ScGetCurrentGroupStateW
# @ stub I_ScIsSecurityProcess
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index 028dcc6..1aae1e0 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -1538,6 +1538,51 @@ BOOL WINAPI SetSecurityDescriptorControl( PSECURITY_DESCRIPTOR pSecurityDescript
pSecurityDescriptor, ControlBitsOfInterest, ControlBitsToSet ) );
}
+/******************************************************************************
+ * GetWindowsAccountDomainSid [ADVAPI32.@]
+ */
+BOOL WINAPI GetWindowsAccountDomainSid( PSID sid, PSID domain_sid, DWORD *size )
+{
+ SID_IDENTIFIER_AUTHORITY domain_ident = {{0,0,0,0,0,5}};
+ DWORD required_size;
+ int i;
+
+ FIXME( "(%p %p %p): semi-stub\n", sid, domain_sid, size );
+
+ if (!sid || !IsValidSid( sid ))
+ {
+ SetLastError( ERROR_INVALID_SID );
+ return FALSE;
+ }
+
+ if (!size)
+ {
+ SetLastError( ERROR_INVALID_PARAMETER );
+ return FALSE;
+ }
+
+ if (*GetSidSubAuthorityCount( sid ) < 4)
+ {
+ SetLastError( ERROR_INVALID_SID );
+ return FALSE;
+ }
+
+ required_size = GetSidLengthRequired( 4 );
+ if (*size < required_size || !domain_sid)
+ {
+ *size = required_size;
+ SetLastError( domain_sid ? ERROR_INSUFFICIENT_BUFFER : ERROR_INVALID_PARAMETER );
+ return FALSE;
+ }
+
+ InitializeSid( domain_sid, &domain_ident, 4 );
+ for (i = 0; i < 4; i++)
+ *GetSidSubAuthority( domain_sid, i ) = *GetSidSubAuthority( sid, i );
+
+ *size = required_size;
+ return TRUE;
+}
+
/* ##############################
###### ACL FUNCTIONS ######
##############################
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index b43f212..3cc149c 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -129,6 +129,7 @@ static NTSTATUS (WINAPI *pNtSetSecurityObject)(HANDLE,SECURITY_INFORMATION,PSECU
static NTSTATUS (WINAPI *pNtCreateFile)(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,PLARGE_INTEGER,ULONG,ULONG,ULONG,ULONG,PVOID,ULONG);
static BOOL (WINAPI *pRtlDosPathNameToNtPathName_U)(LPCWSTR,PUNICODE_STRING,PWSTR*,CURDIR*);
static NTSTATUS (WINAPI *pRtlAnsiStringToUnicodeString)(PUNICODE_STRING,PCANSI_STRING,BOOLEAN);
+static BOOL (WINAPI *pGetWindowsAccountDomainSid)(PSID,PSID,DWORD*);
static HMODULE hmod;
static int myARGC;
@@ -190,6 +191,7 @@ static void init(void)
pConvertStringSidToSidA = (void *)GetProcAddress(hmod, "ConvertStringSidToSidA");
pGetAclInformation = (void *)GetProcAddress(hmod, "GetAclInformation");
pGetAce = (void *)GetProcAddress(hmod, "GetAce");
+ pGetWindowsAccountDomainSid = (void *)GetProcAddress(hmod, "GetWindowsAccountDomainSid");
myARGC = winetest_get_mainargs( &myARGV );
}
@@ -5835,6 +5837,81 @@ static void test_AddAce(void)
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %d\n", GetLastError());
}
+static void test_GetWindowsAccountDomainSid (void)
+{
+ char b[sizeof(TOKEN_USER) + sizeof(SID) + sizeof(DWORD)*SID_MAX_SUB_AUTHORITIES];
+ char buffer1[SECURITY_MAX_SID_SIZE], buffer2[SECURITY_MAX_SID_SIZE];
+ SID_IDENTIFIER_AUTHORITY domain_ident = {{0,0,0,0,0,5}};
+ PSID domain_sid = (PSID *)&buffer1;
+ PSID domain_sid2 = (PSID *)&buffer2;
+ DWORD sid_size, l = sizeof(b);
+ PSID user_sid;
+ HANDLE token;
+ BOOL ret = TRUE;
+ int i;
+
+ if (!pGetWindowsAccountDomainSid)
+ {
+ win_skip("GetWindowsAccountDomainSid not available\n");
+ return;
+ }
+
+ if (!OpenThreadToken(GetCurrentThread(), TOKEN_READ, TRUE, &token))
+ {
+ if (GetLastError() != ERROR_NO_TOKEN) ret = FALSE;
+ else if (!OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &token)) ret = FALSE;
+ }
+ if (!ret)
+ {
+ win_skip("Failed to get current user token\n");
+ return;
+ }
+
+ GetTokenInformation(token, TokenUser, b, l, &l);
+ user_sid = ((TOKEN_USER *)b)->User.Sid;
+ CloseHandle(token);
+
+ SetLastError(0xdeadbeef);
+ ret = pGetWindowsAccountDomainSid(0, 0, 0);
+ ok(!ret, "GetWindowsAccountDomainSid succeeded\n");
+ ok(GetLastError() == ERROR_INVALID_SID, "expected ERROR_INVALID_SID, got %d\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ ret = pGetWindowsAccountDomainSid(user_sid, 0, 0);
+ ok(!ret, "GetWindowsAccountDomainSid succeeded\n");
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+
+ sid_size = SECURITY_MAX_SID_SIZE;
+ SetLastError(0xdeadbeef);
+ ret = pGetWindowsAccountDomainSid(user_sid, 0, &sid_size);
+ ok(!ret, "GetWindowsAccountDomainSid succeeded\n");
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+ ok(sid_size == GetSidLengthRequired(4), "expected size %d, got %d\n", GetSidLengthRequired(4), sid_size);
+
+ SetLastError(0xdeadbeef);
+ ret = pGetWindowsAccountDomainSid(user_sid, domain_sid, 0);
+ ok(!ret, "GetWindowsAccountDomainSid succeeded\n");
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+
+ sid_size = 1;
+ SetLastError(0xdeadbeef);
+ ret = pGetWindowsAccountDomainSid(user_sid, domain_sid, &sid_size);
+ ok(!ret, "GetWindowsAccountDomainSid succeeded\n");
+ ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
+ ok(sid_size == GetSidLengthRequired(4), "expected size %d, got %d\n", GetSidLengthRequired(4), sid_size);
+
+ SetLastError(0xdeadbeef);
+ sid_size = SECURITY_MAX_SID_SIZE;
+ ret = pGetWindowsAccountDomainSid(user_sid, domain_sid, &sid_size);
+ ok(ret, "GetWindowsAccountDomainSid failed with error %d\n", GetLastError());
+ todo_wine ok(GetLastError() == 0xdeadbeef, "last error should not change\n");
+ ok(sid_size == GetSidLengthRequired(4), "expected size %d, got %d\n", GetSidLengthRequired(4), sid_size);
+ InitializeSid(domain_sid2, &domain_ident, 4);
+ for (i = 0; i < 4; i++)
+ *GetSidSubAuthority(domain_sid2, i) = *GetSidSubAuthority(user_sid, i);
+ ok(EqualSid(domain_sid, domain_sid2), "unexpected domain sid\n");
+}
+
START_TEST(security)
{
init();
@@ -5877,4 +5954,5 @@ START_TEST(security)
test_default_dacl_owner_sid();
test_AdjustTokenPrivileges();
test_AddAce();
+ test_GetWindowsAccountDomainSid();
}
diff --git a/dlls/api-ms-win-security-base-l1-1-0/api-ms-win-security-base-l1-1-0.spec b/dlls/api-ms-win-security-base-l1-1-0/api-ms-win-security-base-l1-1-0.spec
index 4277706..edae6d1 100644
--- a/dlls/api-ms-win-security-base-l1-1-0/api-ms-win-security-base-l1-1-0.spec
+++ b/dlls/api-ms-win-security-base-l1-1-0/api-ms-win-security-base-l1-1-0.spec
@@ -57,7 +57,7 @@
@ stdcall GetSidSubAuthority(ptr long) advapi32.GetSidSubAuthority
@ stdcall GetSidSubAuthorityCount(ptr) advapi32.GetSidSubAuthorityCount
@ stdcall GetTokenInformation(long long ptr long ptr) advapi32.GetTokenInformation
-@ stub GetWindowsAccountDomainSid
+@ stdcall GetWindowsAccountDomainSid(ptr ptr ptr) advapi32.GetWindowsAccountDomainSid
@ stdcall ImpersonateAnonymousToken(long) advapi32.ImpersonateAnonymousToken
@ stdcall ImpersonateLoggedOnUser(long) advapi32.ImpersonateLoggedOnUser
@ stdcall ImpersonateSelf(long) advapi32.ImpersonateSelf
diff --git a/dlls/api-ms-win-security-base-l1-2-0/api-ms-win-security-base-l1-2-0.spec b/dlls/api-ms-win-security-base-l1-2-0/api-ms-win-security-base-l1-2-0.spec
index 3adef23..e19fe53 100644
--- a/dlls/api-ms-win-security-base-l1-2-0/api-ms-win-security-base-l1-2-0.spec
+++ b/dlls/api-ms-win-security-base-l1-2-0/api-ms-win-security-base-l1-2-0.spec
@@ -63,7 +63,7 @@
@ stdcall GetSidSubAuthority(ptr long) advapi32.GetSidSubAuthority
@ stdcall GetSidSubAuthorityCount(ptr) advapi32.GetSidSubAuthorityCount
@ stdcall GetTokenInformation(long long ptr long ptr) advapi32.GetTokenInformation
-@ stub GetWindowsAccountDomainSid
+@ stdcall GetWindowsAccountDomainSid(ptr ptr ptr) advapi32.GetWindowsAccountDomainSid
@ stdcall ImpersonateAnonymousToken(long) advapi32.ImpersonateAnonymousToken
@ stdcall ImpersonateLoggedOnUser(long) advapi32.ImpersonateLoggedOnUser
@ stdcall ImpersonateSelf(long) advapi32.ImpersonateSelf
--
2.4.2

View File

@ -0,0 +1 @@
Fixes: [38624] Implement advapi32.GetWindowsAccountDomainSid

View File

@ -80,6 +80,7 @@ patch_enable_all ()
enable_Exagear="$1"
enable_Pipelight="$1"
enable_Staging="$1"
enable_advapi32_GetWindowsAccountDomainSid="$1"
enable_advapi32_LsaLookupSids="$1"
enable_browseui_Progress_Dialog="$1"
enable_combase_String="$1"
@ -319,6 +320,9 @@ patch_enable ()
Staging)
enable_Staging="$2"
;;
advapi32-GetWindowsAccountDomainSid)
enable_advapi32_GetWindowsAccountDomainSid="$2"
;;
advapi32-LsaLookupSids)
enable_advapi32_LsaLookupSids="$2"
;;
@ -2047,6 +2051,23 @@ if test "$enable_Staging" -eq 1; then
) >> "$patchlist"
fi
# Patchset advapi32-GetWindowsAccountDomainSid
# |
# | This patchset fixes the following Wine bugs:
# | * [#38624] Implement advapi32.GetWindowsAccountDomainSid
# |
# | Modified files:
# | * dlls/advapi32/advapi32.spec, dlls/advapi32/security.c, dlls/advapi32/tests/security.c, dlls/api-ms-win-security-
# | base-l1-1-0/api-ms-win-security-base-l1-1-0.spec, dlls/api-ms-win-security-base-l1-2-0/api-ms-win-security-
# | base-l1-2-0.spec
# |
if test "$enable_advapi32_GetWindowsAccountDomainSid" -eq 1; then
patch_apply advapi32-GetWindowsAccountDomainSid/0001-advapi32-Implement-GetWindowsAccountDomainSid.patch
(
echo '+ { "Michael Müller", "advapi32: Implement GetWindowsAccountDomainSid.", 1 },';
) >> "$patchlist"
fi
# Patchset server-Misc_ACL
# |
# | This patchset fixes the following Wine bugs:
@ -5096,45 +5117,6 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-Multisampling
# |
# | This patchset fixes the following Wine bugs:
# | * [#12652] Allow to override number of quality levels for D3DMULTISAMPLE_NONMASKABLE.
# |
# | Modified files:
# | * dlls/wined3d/directx.c, dlls/wined3d/wined3d_main.c, dlls/wined3d/wined3d_private.h
# |
if test "$enable_wined3d_Multisampling" -eq 1; then
patch_apply wined3d-Multisampling/0001-wined3d-Allow-to-specify-multisampling-AA-quality-le.patch
(
echo '+ { "Austin English", "wined3d: Allow to specify multisampling AA quality levels via registry.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-UnhandledBlendFactor
# |
# | Modified files:
# | * dlls/wined3d/state.c
# |
if test "$enable_wined3d_UnhandledBlendFactor" -eq 1; then
patch_apply wined3d-UnhandledBlendFactor/0001-wined3d-Silence-repeated-Unhandled-blend-factor-0-me.patch
(
echo '+ { "Sebastian Lackner", "wined3d: Silence repeated '\''Unhandled blend factor 0'\'' messages.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-wined3d_swapchain_present
# |
# | Modified files:
# | * dlls/wined3d/swapchain.c
# |
if test "$enable_wined3d_wined3d_swapchain_present" -eq 1; then
patch_apply wined3d-wined3d_swapchain_present/0001-wined3d-Silence-repeated-wined3d_swapchain_present-F.patch
(
echo '+ { "Sebastian Lackner", "wined3d: Silence repeated wined3d_swapchain_present FIXME.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-Revert_PixelFormat
# |
# | This patchset fixes the following Wine bugs:
@ -5181,6 +5163,45 @@ if test "$enable_wined3d_resource_check_usage" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-wined3d_swapchain_present
# |
# | Modified files:
# | * dlls/wined3d/swapchain.c
# |
if test "$enable_wined3d_wined3d_swapchain_present" -eq 1; then
patch_apply wined3d-wined3d_swapchain_present/0001-wined3d-Silence-repeated-wined3d_swapchain_present-F.patch
(
echo '+ { "Sebastian Lackner", "wined3d: Silence repeated wined3d_swapchain_present FIXME.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-Multisampling
# |
# | This patchset fixes the following Wine bugs:
# | * [#12652] Allow to override number of quality levels for D3DMULTISAMPLE_NONMASKABLE.
# |
# | Modified files:
# | * dlls/wined3d/directx.c, dlls/wined3d/wined3d_main.c, dlls/wined3d/wined3d_private.h
# |
if test "$enable_wined3d_Multisampling" -eq 1; then
patch_apply wined3d-Multisampling/0001-wined3d-Allow-to-specify-multisampling-AA-quality-le.patch
(
echo '+ { "Austin English", "wined3d: Allow to specify multisampling AA quality levels via registry.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-UnhandledBlendFactor
# |
# | Modified files:
# | * dlls/wined3d/state.c
# |
if test "$enable_wined3d_UnhandledBlendFactor" -eq 1; then
patch_apply wined3d-UnhandledBlendFactor/0001-wined3d-Silence-repeated-Unhandled-blend-factor-0-me.patch
(
echo '+ { "Sebastian Lackner", "wined3d: Silence repeated '\''Unhandled blend factor 0'\'' messages.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-CSMT_Main
# |
# | This patchset fixes the following Wine bugs: