From: "Erich E. Hoover" Subject: [PATCH 1/3] advapi: Return the current user as the owner of files (resend 4). Message-Id: Date: Tue, 30 Oct 2012 13:50:38 -0600 This series of patches provides a fix for Bug #31858 (Netflix Internet Connection Problem) and Bug #31993 (Netflix hangs with loading bar at 100%). Once this patch series has been applied then Netflix (using Silverlight 4.x) will successfully load and play movies and TV shows, provided that you do not move the mouse while the content is first loading. This particular patch changes the ACL-reported owner of files from the "world" (S-1-1-0) to the current user (usually S-1-5-21-0-0-0-1000). With this change PlayReady will get a little bit further, no longer immediately trying to recreate the individualization folder because it has unexpected ownership, which results in an access problem since the individualization file inside the folder is currently in use. From 722d7cf0e4d32142a1dcb9ec3a2d85aa8e9cc78c Mon Sep 17 00:00:00 2001 From: Erich Hoover Date: Tue, 30 Oct 2012 09:51:27 -0600 Subject: advapi: Return the current user as the owner of files. --- dlls/advapi32/security.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index c86ca17..c493983 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -5405,8 +5405,12 @@ DWORD WINAPI GetNamedSecurityInfoW( LPWSTR name, SE_OBJECT_TYPE type, SECURITY_INFORMATION info, PSID* owner, PSID* group, PACL* dacl, PACL* sacl, PSECURITY_DESCRIPTOR* descriptor ) { - DWORD needed, offset; + char b[sizeof(TOKEN_USER) + sizeof(MAX_SID)]; + DWORD needed, offset, l = sizeof(b), owner_len = sizeof(sidWorld); + PSID owner_sid = (PSID) &sidWorld; SECURITY_DESCRIPTOR_RELATIVE *relative = NULL; + BOOL ret = TRUE; + HANDLE token; BYTE *buffer; TRACE( "%s %d %d %p %p %p %p %p\n", debugstr_w(name), type, info, owner, @@ -5423,9 +5427,25 @@ DWORD WINAPI GetNamedSecurityInfoW( LPWSTR name, SE_OBJECT_TYPE type, || ((info & SACL_SECURITY_INFORMATION) && !sacl) )) return ERROR_INVALID_PARAMETER; + 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) + { + ret = GetTokenInformation(token, TokenUser, b, l, &l); + CloseHandle( token ); + } + if (ret) + { + owner_sid = ((TOKEN_USER *)b)->User.Sid; + owner_len = GetLengthSid(owner_sid); + } + needed = !descriptor ? 0 : sizeof(SECURITY_DESCRIPTOR_RELATIVE); if (info & OWNER_SECURITY_INFORMATION) - needed += sizeof(sidWorld); + needed += owner_len; if (info & GROUP_SECURITY_INFORMATION) needed += sizeof(sidWorld); if (info & DACL_SECURITY_INFORMATION) @@ -5460,12 +5480,13 @@ DWORD WINAPI GetNamedSecurityInfoW( LPWSTR name, SE_OBJECT_TYPE type, if (info & OWNER_SECURITY_INFORMATION) { - memcpy( buffer + offset, &sidWorld, sizeof(sidWorld) ); + memcpy( buffer + offset, owner_sid, owner_len ); + if(relative) relative->Owner = offset; if (owner) *owner = buffer + offset; - offset += sizeof(sidWorld); + offset += owner_len; } if (info & GROUP_SECURITY_INFORMATION) { -- 1.7.9.5