Rebase against upstream Wine (what the ...).

Introduce a new 'advapi32-Revert_DACL' patchset for now, to revert all the
changes by Piotr Caban.  We have a completely independent and relatively
well-tested implementation of the same functionality in the wineserver.

TODO: Take a closer look at all the tests from our version and the proposed
change, and then finally decide which implementation we want to keep.
This commit is contained in:
Sebastian Lackner 2015-03-27 15:43:54 +01:00
parent f7fb8e8959
commit f3032f5a57
13 changed files with 687 additions and 320 deletions

View File

@ -129,7 +129,7 @@ Included bug fixes and improvements
* Fix possible segfault in pulse_rd_loop of PulseAudio backend
* Fix race-condition when threads are killed during shutdown
* ~~Fix regression causing black screen on startup~~ ([Wine Bug #38248](https://bugs.winehq.org/show_bug.cgi?id=38248))
* Fix regression causing too dark/missing textures in several games ([Wine Bug #38256](https://bugs.winehq.org/show_bug.cgi?id=38256))
* ~~Fix regression causing too dark/missing textures in several games~~ ([Wine Bug #38256](https://bugs.winehq.org/show_bug.cgi?id=38256))
* Fix return value of ScrollWindowEx for invisible windows ([Wine Bug #37706](https://bugs.winehq.org/show_bug.cgi?id=37706))
* Fix texture corruption in CSI: Fatal Conspiracy ([Wine Bug #33768](https://bugs.winehq.org/show_bug.cgi?id=33768))
* Fix unintentional leaks with ntdll internals

View File

@ -0,0 +1,216 @@
From 8ce7a8b0f7ea6a94ae8327b4a3d07a10c12a2c9e Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 27 Mar 2015 15:32:04 +0100
Subject: Revert "advapi32: Add DACL inheritance support in SetSecurityInfo."
This reverts commit f974d726720eff4fcd7371bca95e6cdcc4b4a848.
---
dlls/advapi32/security.c | 130 +----------------------------------------
dlls/advapi32/tests/security.c | 23 ++++----
2 files changed, 14 insertions(+), 139 deletions(-)
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index 71a8c92..e8cdcc5 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -4052,8 +4052,6 @@ DWORD WINAPI SetNamedSecurityInfoW(LPWSTR pObjectName,
}
break;
case SE_FILE_OBJECT:
- if (SecurityInfo & DACL_SECURITY_INFORMATION)
- access |= READ_CONTROL;
if (!(err = get_security_file( pObjectName, access, &handle )))
{
err = SetSecurityInfo( handle, ObjectType, SecurityInfo, psidOwner, psidGroup, pDacl, pSacl );
@@ -5731,7 +5729,6 @@ DWORD WINAPI SetSecurityInfo(HANDLE handle, SE_OBJECT_TYPE ObjectType,
PSID psidGroup, PACL pDacl, PACL pSacl)
{
SECURITY_DESCRIPTOR sd;
- PACL dacl = pDacl;
NTSTATUS status;
if (!InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION))
@@ -5742,130 +5739,7 @@ DWORD WINAPI SetSecurityInfo(HANDLE handle, SE_OBJECT_TYPE ObjectType,
if (SecurityInfo & GROUP_SECURITY_INFORMATION)
SetSecurityDescriptorGroup(&sd, psidGroup, FALSE);
if (SecurityInfo & DACL_SECURITY_INFORMATION)
- {
- if (ObjectType == SE_FILE_OBJECT)
- {
- SECURITY_DESCRIPTOR_CONTROL control;
- PSECURITY_DESCRIPTOR psd;
- OBJECT_NAME_INFORMATION *name_info;
- DWORD size, rev;
-
- status = NtQuerySecurityObject(handle, SecurityInfo, NULL, 0, &size);
- if (status != STATUS_BUFFER_TOO_SMALL)
- return RtlNtStatusToDosError(status);
-
- psd = heap_alloc(size);
- if (!psd)
- return ERROR_NOT_ENOUGH_MEMORY;
-
- status = NtQuerySecurityObject(handle, SecurityInfo, psd, size, &size);
- if (status)
- {
- heap_free(psd);
- return RtlNtStatusToDosError(status);
- }
-
- status = RtlGetControlSecurityDescriptor(psd, &control, &rev);
- heap_free(psd);
- if (status)
- return RtlNtStatusToDosError(status);
- /* TODO: copy some control flags to new sd */
-
- /* inherit parent directory DACL */
- if (!(control & SE_DACL_PROTECTED))
- {
- status = NtQueryObject(handle, ObjectNameInformation, NULL, 0, &size);
- if (status != STATUS_INFO_LENGTH_MISMATCH)
- return RtlNtStatusToDosError(status);
-
- name_info = heap_alloc(size);
- if (!name_info)
- return ERROR_NOT_ENOUGH_MEMORY;
-
- status = NtQueryObject(handle, ObjectNameInformation, name_info, size, NULL);
- if (status)
- {
- heap_free(name_info);
- return RtlNtStatusToDosError(status);
- }
-
- for (name_info->Name.Length-=2; name_info->Name.Length>0; name_info->Name.Length-=2)
- if (name_info->Name.Buffer[name_info->Name.Length/2-1]=='\\' ||
- name_info->Name.Buffer[name_info->Name.Length/2-1]=='/')
- break;
- if (name_info->Name.Length)
- {
- OBJECT_ATTRIBUTES attr;
- IO_STATUS_BLOCK io;
- HANDLE parent;
- PSECURITY_DESCRIPTOR parent_sd;
- ACL *parent_dacl;
- DWORD err = ERROR_ACCESS_DENIED;
-
- name_info->Name.Buffer[name_info->Name.Length/2] = 0;
-
- attr.Length = sizeof(attr);
- attr.RootDirectory = 0;
- attr.Attributes = 0;
- attr.ObjectName = &name_info->Name;
- attr.SecurityDescriptor = NULL;
- status = NtOpenFile(&parent, READ_CONTROL, &attr, &io,
- FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN_FOR_BACKUP_INTENT);
- heap_free(name_info);
- if (!status)
- {
- err = GetSecurityInfo(parent, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION,
- NULL, NULL, &parent_dacl, NULL, &parent_sd);
- CloseHandle(parent);
- }
-
- if (!err)
- {
- int i;
-
- dacl = heap_alloc_zero(pDacl->AclSize+parent_dacl->AclSize);
- if (!dacl)
- {
- LocalFree(parent_sd);
- return ERROR_NOT_ENOUGH_MEMORY;
- }
- memcpy(dacl, pDacl, pDacl->AclSize);
- dacl->AclSize = pDacl->AclSize+parent_dacl->AclSize;
-
- for (i=0; i<parent_dacl->AceCount; i++)
- {
- ACE_HEADER *ace;
-
- if (!GetAce(parent_dacl, i, (void*)&ace))
- continue;
- if (!(ace->AceFlags & (OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE)))
- continue;
- if ((ace->AceFlags & (OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE)) !=
- (OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE))
- {
- FIXME("unsupported flags: %x\n", ace->AceFlags);
- continue;
- }
-
- if (ace->AceFlags & NO_PROPAGATE_INHERIT_ACE)
- ace->AceFlags &= ~(OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE|NO_PROPAGATE_INHERIT_ACE);
- ace->AceFlags &= ~INHERIT_ONLY_ACE;
- ace->AceFlags |= INHERITED_ACE;
-
- if(!AddAce(dacl, ACL_REVISION, MAXDWORD, ace, ace->AceSize))
- WARN("error adding inherited ACE\n");
- }
- LocalFree(parent_sd);
- }
- }
- else
- heap_free(name_info);
- }
- }
-
- SetSecurityDescriptorDacl(&sd, TRUE, dacl, FALSE);
- }
+ SetSecurityDescriptorDacl(&sd, TRUE, pDacl, FALSE);
if (SecurityInfo & SACL_SECURITY_INFORMATION)
SetSecurityDescriptorSacl(&sd, TRUE, pSacl, FALSE);
@@ -5879,8 +5753,6 @@ DWORD WINAPI SetSecurityInfo(HANDLE handle, SE_OBJECT_TYPE ObjectType,
status = NtSetSecurityObject(handle, SecurityInfo, &sd);
break;
}
- if (dacl != pDacl)
- heap_free(dacl);
return RtlNtStatusToDosError(status);
}
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 15c3b1d..6d3f9ac 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -3417,22 +3417,25 @@ static void test_GetNamedSecurityInfoA(void)
error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION,
NULL, NULL, &pDacl, NULL, &pSD);
- ok(!error, "GetNamedSecurityInfo failed with error %d\n", error);
+ todo_wine ok(!error, "GetNamedSecurityInfo failed with error %d\n", error);
- bret = pGetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation);
- ok(bret, "GetAclInformation failed\n");
- if (acl_size.AceCount > 0)
+ if (!error)
{
- bret = pGetAce(pDacl, 0, (VOID **)&ace);
- ok(bret, "Failed to get ACE.\n");
- todo_wine ok(((ACE_HEADER *)ace)->AceFlags & INHERITED_ACE,
- "ACE has unexpected flags: 0x%x\n", ((ACE_HEADER *)ace)->AceFlags);
+ bret = pGetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation);
+ ok(bret, "GetAclInformation failed\n");
+ if (acl_size.AceCount > 0)
+ {
+ bret = pGetAce(pDacl, 0, (VOID **)&ace);
+ ok(bret, "Failed to get ACE.\n");
+ ok(((ACE_HEADER *)ace)->AceFlags & INHERITED_ACE,
+ "ACE has unexpected flags: 0x%x\n", ((ACE_HEADER *)ace)->AceFlags);
+ }
+ LocalFree(pSD);
}
- LocalFree(pSD);
h = CreateFileA(tmpfile, GENERIC_READ, FILE_SHARE_DELETE|FILE_SHARE_WRITE|FILE_SHARE_READ,
NULL, OPEN_EXISTING, 0, NULL);
- ok(h != INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
+ todo_wine ok(h != INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
CloseHandle(h);
/* NtSetSecurityObject doesn't inherit DACL entries */
--
2.3.3

View File

@ -0,0 +1,74 @@
From 0a8954d7ed5e57340ab6b6234fb3bdfe498fb69e Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 27 Mar 2015 15:32:17 +0100
Subject: Revert "advapi32/tests: Add test for mapping DACL to permission."
This reverts commit a4b12eb9f937202848b229ed15f2c7d1823b41da.
---
dlls/advapi32/tests/security.c | 35 ++---------------------------------
1 file changed, 2 insertions(+), 33 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 6d3f9ac..dbe52b0 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -3405,6 +3405,7 @@ static void test_GetNamedSecurityInfoA(void)
"Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask);
}
LocalFree(pSD);
+ HeapFree(GetProcessHeap(), 0, user);
/* show that setting empty DACL is not removing all file permissions */
pDacl = HeapAlloc(GetProcessHeap(), 0, sizeof(ACL));
@@ -3441,7 +3442,7 @@ static void test_GetNamedSecurityInfoA(void)
/* NtSetSecurityObject doesn't inherit DACL entries */
pSD = sd+sizeof(void*)-((ULONG_PTR)sd)%sizeof(void*);
InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION);
- pDacl = HeapAlloc(GetProcessHeap(), 0, 100);
+ pDacl = HeapAlloc(GetProcessHeap(), 0, sizeof(ACL));
bret = InitializeAcl(pDacl, sizeof(ACL), ACL_REVISION);
ok(bret, "Failed to initialize ACL.\n");
bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE);
@@ -3472,39 +3473,7 @@ static void test_GetNamedSecurityInfoA(void)
NULL, OPEN_EXISTING, 0, NULL);
ok(h == INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
CloseHandle(h);
-
- /* test if DACL is properly mapped to permission */
- bret = InitializeAcl(pDacl, 100, ACL_REVISION);
- ok(bret, "Failed to initialize ACL.\n");
- bret = pAddAccessAllowedAceEx(pDacl, ACL_REVISION, 0, GENERIC_ALL, user_sid);
- ok(bret, "Failed to add Current User to ACL.\n");
- bret = pAddAccessDeniedAceEx(pDacl, ACL_REVISION, 0, GENERIC_ALL, user_sid);
- ok(bret, "Failed to add Current User to ACL.\n");
- bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE);
- ok(bret, "Failed to add ACL to security desciptor.\n");
- status = pNtSetSecurityObject(hTemp, DACL_SECURITY_INFORMATION, pSD);
- ok(status == ERROR_SUCCESS, "NtSetSecurityObject returned %x\n", status);
-
- h = CreateFileA(tmpfile, GENERIC_READ, FILE_SHARE_DELETE|FILE_SHARE_WRITE|FILE_SHARE_READ,
- NULL, OPEN_EXISTING, 0, NULL);
- todo_wine ok(h != INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
-
- bret = InitializeAcl(pDacl, 100, ACL_REVISION);
- ok(bret, "Failed to initialize ACL.\n");
- bret = pAddAccessDeniedAceEx(pDacl, ACL_REVISION, 0, GENERIC_ALL, user_sid);
- ok(bret, "Failed to add Current User to ACL.\n");
- bret = pAddAccessAllowedAceEx(pDacl, ACL_REVISION, 0, GENERIC_ALL, user_sid);
- ok(bret, "Failed to add Current User to ACL.\n");
- bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE);
- ok(bret, "Failed to add ACL to security desciptor.\n");
- status = pNtSetSecurityObject(hTemp, DACL_SECURITY_INFORMATION, pSD);
- ok(status == ERROR_SUCCESS, "NtSetSecurityObject returned %x\n", status);
-
- h = CreateFileA(tmpfile, GENERIC_READ, FILE_SHARE_DELETE|FILE_SHARE_WRITE|FILE_SHARE_READ,
- NULL, OPEN_EXISTING, 0, NULL);
- ok(h == INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
HeapFree(GetProcessHeap(), 0, pDacl);
- HeapFree(GetProcessHeap(), 0, user);
CloseHandle(hTemp);
/* Test querying the ownership of a built-in registry key */
--
2.3.3

View File

@ -0,0 +1,142 @@
From 99244514ca0c26e263e14d7fdf095083e4686166 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 27 Mar 2015 15:32:32 +0100
Subject: Revert "advapi32: Add SetNamedSecurityInfo test with empty DACL."
This reverts commit 02c4f5bd275d70d1dcb48bf95775efa376b50c22.
---
dlls/advapi32/tests/security.c | 79 +++---------------------------------------
1 file changed, 4 insertions(+), 75 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index dbe52b0..e3c1659 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -147,7 +147,6 @@ static BOOL (WINAPI *pCreateRestrictedToken)(HANDLE, DWORD, DWORD, PSID_AND_ATTR
PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES, PHANDLE);
static BOOL (WINAPI *pGetAclInformation)(PACL,LPVOID,DWORD,ACL_INFORMATION_CLASS);
static BOOL (WINAPI *pGetAce)(PACL,DWORD,LPVOID*);
-static NTSTATUS (WINAPI *pNtSetSecurityObject)(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
static HMODULE hmod;
static int myARGC;
@@ -174,7 +173,6 @@ static void init(void)
hntdll = GetModuleHandleA("ntdll.dll");
pNtQueryObject = (void *)GetProcAddress( hntdll, "NtQueryObject" );
pNtAccessCheck = (void *)GetProcAddress( hntdll, "NtAccessCheck" );
- pNtSetSecurityObject = (void *)GetProcAddress(hntdll, "NtSetSecurityObject");
hmod = GetModuleHandleA("advapi32.dll");
pAddAccessAllowedAceEx = (void *)GetProcAddress(hmod, "AddAccessAllowedAceEx");
@@ -3231,7 +3229,7 @@ static void test_GetNamedSecurityInfoA(void)
char invalid_path[] = "/an invalid file path";
int users_ace_id = -1, admins_ace_id = -1, i;
char software_key[] = "MACHINE\\Software";
- char sd[SECURITY_DESCRIPTOR_MIN_LENGTH+sizeof(void*)];
+ char sd[SECURITY_DESCRIPTOR_MIN_LENGTH];
SECURITY_DESCRIPTOR_CONTROL control;
ACL_SIZE_INFORMATION acl_size;
CHAR windows_dir[MAX_PATH];
@@ -3243,12 +3241,11 @@ static void test_GetNamedSecurityInfoA(void)
BOOL owner_defaulted;
BOOL group_defaulted;
BOOL dacl_defaulted;
- HANDLE token, hTemp, h;
+ HANDLE token, hTemp;
PSID owner, group;
BOOL dacl_present;
PACL pDacl;
BYTE flags;
- NTSTATUS status;
if (!pSetNamedSecurityInfoA || !pGetNamedSecurityInfoA || !pCreateWellKnownSid)
{
@@ -3353,8 +3350,8 @@ static void test_GetNamedSecurityInfoA(void)
bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE);
ok(bret, "Failed to add ACL to security desciptor.\n");
GetTempFileNameA(".", "foo", 0, tmpfile);
- hTemp = CreateFileA(tmpfile, WRITE_DAC|GENERIC_WRITE, FILE_SHARE_DELETE|FILE_SHARE_READ,
- NULL, OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, NULL);
+ hTemp = CreateFileA(tmpfile, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING,
+ FILE_FLAG_DELETE_ON_CLOSE, NULL);
SetLastError(0xdeadbeef);
error = pSetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL,
NULL, pDacl, NULL);
@@ -3406,74 +3403,6 @@ static void test_GetNamedSecurityInfoA(void)
}
LocalFree(pSD);
HeapFree(GetProcessHeap(), 0, user);
-
- /* show that setting empty DACL is not removing all file permissions */
- pDacl = HeapAlloc(GetProcessHeap(), 0, sizeof(ACL));
- bret = InitializeAcl(pDacl, sizeof(ACL), ACL_REVISION);
- ok(bret, "Failed to initialize ACL.\n");
- error = pSetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION,
- NULL, NULL, pDacl, NULL);
- ok(!error, "SetNamedSecurityInfoA failed with error %d\n", error);
- HeapFree(GetProcessHeap(), 0, pDacl);
-
- error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION,
- NULL, NULL, &pDacl, NULL, &pSD);
- todo_wine ok(!error, "GetNamedSecurityInfo failed with error %d\n", error);
-
- if (!error)
- {
- bret = pGetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation);
- ok(bret, "GetAclInformation failed\n");
- if (acl_size.AceCount > 0)
- {
- bret = pGetAce(pDacl, 0, (VOID **)&ace);
- ok(bret, "Failed to get ACE.\n");
- ok(((ACE_HEADER *)ace)->AceFlags & INHERITED_ACE,
- "ACE has unexpected flags: 0x%x\n", ((ACE_HEADER *)ace)->AceFlags);
- }
- LocalFree(pSD);
- }
-
- h = CreateFileA(tmpfile, GENERIC_READ, FILE_SHARE_DELETE|FILE_SHARE_WRITE|FILE_SHARE_READ,
- NULL, OPEN_EXISTING, 0, NULL);
- todo_wine ok(h != INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
- CloseHandle(h);
-
- /* NtSetSecurityObject doesn't inherit DACL entries */
- pSD = sd+sizeof(void*)-((ULONG_PTR)sd)%sizeof(void*);
- InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION);
- pDacl = HeapAlloc(GetProcessHeap(), 0, sizeof(ACL));
- bret = InitializeAcl(pDacl, sizeof(ACL), ACL_REVISION);
- ok(bret, "Failed to initialize ACL.\n");
- bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE);
- ok(bret, "Failed to add ACL to security desciptor.\n");
- status = pNtSetSecurityObject(hTemp, DACL_SECURITY_INFORMATION, pSD);
- ok(status == ERROR_SUCCESS, "NtSetSecurityObject returned %x\n", status);
-
- h = CreateFileA(tmpfile, GENERIC_READ, FILE_SHARE_DELETE|FILE_SHARE_WRITE|FILE_SHARE_READ,
- NULL, OPEN_EXISTING, 0, NULL);
- ok(h == INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
- CloseHandle(h);
-
- pSetSecurityDescriptorControl(pSD, SE_DACL_AUTO_INHERIT_REQ, SE_DACL_AUTO_INHERIT_REQ);
- status = pNtSetSecurityObject(hTemp, DACL_SECURITY_INFORMATION, pSD);
- ok(status == ERROR_SUCCESS, "NtSetSecurityObject returned %x\n", status);
-
- h = CreateFileA(tmpfile, GENERIC_READ, FILE_SHARE_DELETE|FILE_SHARE_WRITE|FILE_SHARE_READ,
- NULL, OPEN_EXISTING, 0, NULL);
- ok(h == INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
- CloseHandle(h);
-
- pSetSecurityDescriptorControl(pSD, SE_DACL_AUTO_INHERIT_REQ|SE_DACL_AUTO_INHERITED,
- SE_DACL_AUTO_INHERIT_REQ|SE_DACL_AUTO_INHERITED);
- status = pNtSetSecurityObject(hTemp, DACL_SECURITY_INFORMATION, pSD);
- ok(status == ERROR_SUCCESS, "NtSetSecurityObject returned %x\n", status);
-
- h = CreateFileA(tmpfile, GENERIC_READ, FILE_SHARE_DELETE|FILE_SHARE_WRITE|FILE_SHARE_READ,
- NULL, OPEN_EXISTING, 0, NULL);
- ok(h == INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
- CloseHandle(h);
- HeapFree(GetProcessHeap(), 0, pDacl);
CloseHandle(hTemp);
/* Test querying the ownership of a built-in registry key */
--
2.3.3

View File

@ -0,0 +1,84 @@
From e2eaeb0bfc7411c74f1387e59c121f5cee6c013a Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 27 Mar 2015 15:32:44 +0100
Subject: Revert "server: Make directory DACL entries inheritable."
This reverts commit 3eb448cf33b6b6635bac4e06ea7fddd190e26450.
---
dlls/advapi32/tests/security.c | 12 ++++++------
server/file.c | 8 ++++----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index e3c1659..04a88ae 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -3192,9 +3192,9 @@ static void test_CreateDirectoryA(void)
ok(bret, "Failed to get Current User ACE.\n");
bret = EqualSid(&ace->SidStart, user_sid);
todo_wine ok(bret, "Current User ACE != Current User SID.\n");
- ok(((ACE_HEADER *)ace)->AceFlags == (OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE),
- "Current User ACE has unexpected flags (0x%x != 0x03)\n",
- ((ACE_HEADER *)ace)->AceFlags);
+ todo_wine ok(((ACE_HEADER *)ace)->AceFlags == (OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE),
+ "Current User ACE has unexpected flags (0x%x != 0x03)\n",
+ ((ACE_HEADER *)ace)->AceFlags);
ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n",
ace->Mask);
}
@@ -3204,9 +3204,9 @@ static void test_CreateDirectoryA(void)
ok(bret, "Failed to get Administators Group ACE.\n");
bret = EqualSid(&ace->SidStart, admin_sid);
todo_wine ok(bret, "Administators Group ACE != Administators Group SID.\n");
- ok(((ACE_HEADER *)ace)->AceFlags == (OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE),
- "Administators Group ACE has unexpected flags (0x%x != 0x03)\n",
- ((ACE_HEADER *)ace)->AceFlags);
+ todo_wine ok(((ACE_HEADER *)ace)->AceFlags == (OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE),
+ "Administators Group ACE has unexpected flags (0x%x != 0x03)\n",
+ ((ACE_HEADER *)ace)->AceFlags);
ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n",
ace->Mask);
}
diff --git a/server/file.c b/server/file.c
index f565f5a..abda2c3 100644
--- a/server/file.c
+++ b/server/file.c
@@ -367,7 +367,7 @@ struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID
aaa = (ACCESS_ALLOWED_ACE *)(dacl + 1);
current_ace = &aaa->Header;
aaa->Header.AceType = ACCESS_ALLOWED_ACE_TYPE;
- aaa->Header.AceFlags = (mode & S_IFDIR) ? OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE : 0;
+ aaa->Header.AceFlags = 0;
aaa->Header.AceSize = FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + security_sid_len( local_system_sid );
aaa->Mask = FILE_ALL_ACCESS;
sid = (SID *)&aaa->SidStart;
@@ -379,7 +379,7 @@ struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID
aaa = (ACCESS_ALLOWED_ACE *)ace_next( current_ace );
current_ace = &aaa->Header;
aaa->Header.AceType = ACCESS_ALLOWED_ACE_TYPE;
- aaa->Header.AceFlags = (mode & S_IFDIR) ? OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE : 0;
+ aaa->Header.AceFlags = 0;
aaa->Header.AceSize = FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + security_sid_len( user );
aaa->Mask = WRITE_DAC | WRITE_OWNER;
if (mode & S_IRUSR)
@@ -397,7 +397,7 @@ struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID
ACCESS_DENIED_ACE *ada = (ACCESS_DENIED_ACE *)ace_next( current_ace );
current_ace = &ada->Header;
ada->Header.AceType = ACCESS_DENIED_ACE_TYPE;
- ada->Header.AceFlags = (mode & S_IFDIR) ? OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE : 0;
+ ada->Header.AceFlags = 0;
ada->Header.AceSize = FIELD_OFFSET(ACCESS_DENIED_ACE, SidStart) + security_sid_len( user );
ada->Mask = 0;
if (!(mode & S_IRUSR) && (mode & (S_IRGRP|S_IROTH)))
@@ -414,7 +414,7 @@ struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID
aaa = (ACCESS_ALLOWED_ACE *)ace_next( current_ace );
current_ace = &aaa->Header;
aaa->Header.AceType = ACCESS_ALLOWED_ACE_TYPE;
- aaa->Header.AceFlags = (mode & S_IFDIR) ? OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE : 0;
+ aaa->Header.AceFlags = 0;
aaa->Header.AceSize = FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + security_sid_len( world_sid );
aaa->Mask = 0;
if (mode & S_IROTH)
--
2.3.3

View File

@ -0,0 +1,77 @@
From 59067deb0ad4afb77deca29300133bff9d49f9f7 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 27 Mar 2015 15:32:56 +0100
Subject: Revert "advapi: Don't use CreateFile when opening file with possibly
empty DACL."
This reverts commit f956bb4caa442ccde1ddaf483c5cb619bbf4049a.
---
dlls/advapi32/security.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index e8cdcc5..097b0da 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -397,7 +397,7 @@ static inline BOOL set_ntstatus( NTSTATUS status )
}
/* helper function for SE_FILE_OBJECT objects in [Get|Set]NamedSecurityInfo */
-static inline DWORD get_security_file( LPCWSTR full_file_name, DWORD access, HANDLE *file )
+static inline DWORD get_security_file( LPWSTR full_file_name, DWORD access, HANDLE *file )
{
UNICODE_STRING file_nameW;
OBJECT_ATTRIBUTES attr;
@@ -2029,7 +2029,7 @@ GetFileSecurityW( LPCWSTR lpFileName,
{
HANDLE hfile;
NTSTATUS status;
- DWORD access = 0, err;
+ DWORD access = 0;
TRACE("(%s,%d,%p,%d,%p)\n", debugstr_w(lpFileName),
RequestedInformation, pSecurityDescriptor,
@@ -2041,12 +2041,10 @@ GetFileSecurityW( LPCWSTR lpFileName,
if (RequestedInformation & SACL_SECURITY_INFORMATION)
access |= ACCESS_SYSTEM_SECURITY;
- err = get_security_file( lpFileName, access, &hfile);
- if (err)
- {
- SetLastError(err);
+ hfile = CreateFileW( lpFileName, access, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 );
+ if ( hfile == INVALID_HANDLE_VALUE )
return FALSE;
- }
status = NtQuerySecurityObject( hfile, RequestedInformation, pSecurityDescriptor,
nLength, lpnLengthNeeded );
@@ -2327,7 +2325,7 @@ SetFileSecurityW( LPCWSTR lpFileName,
PSECURITY_DESCRIPTOR pSecurityDescriptor )
{
HANDLE file;
- DWORD access = 0, err;
+ DWORD access = 0;
NTSTATUS status;
TRACE("(%s, 0x%x, %p)\n", debugstr_w(lpFileName), RequestedInformation,
@@ -2341,12 +2339,10 @@ SetFileSecurityW( LPCWSTR lpFileName,
if (RequestedInformation & DACL_SECURITY_INFORMATION)
access |= WRITE_DAC;
- err = get_security_file( lpFileName, access, &file);
- if (err)
- {
- SetLastError(err);
+ file = CreateFileW( lpFileName, access, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL );
+ if (file == INVALID_HANDLE_VALUE)
return FALSE;
- }
status = NtSetSecurityObject( file, RequestedInformation, pSecurityDescriptor );
CloseHandle( file );
--
2.3.3

View File

@ -66,6 +66,7 @@ patch_enable_all ()
enable_Miscellaneous="$1"
enable_Pipelight="$1"
enable_Staging="$1"
enable_advapi32_Revert_DACL="$1"
enable_browseui_Progress_Dialog="$1"
enable_combase_String="$1"
enable_comctl32_LoadIconMetric="$1"
@ -216,7 +217,6 @@ patch_enable_all ()
enable_wined3d_CSMT_Main="$1"
enable_wined3d_DXTn="$1"
enable_wined3d_Multisampling="$1"
enable_wined3d_NormalMatrix="$1"
enable_wined3d_Revert_PixelFormat="$1"
enable_wined3d_UnhandledBlendFactor="$1"
enable_winedevice_Fix_Relocation="$1"
@ -256,6 +256,9 @@ patch_enable ()
Staging)
enable_Staging="$2"
;;
advapi32-Revert_DACL)
enable_advapi32_Revert_DACL="$2"
;;
browseui-Progress_Dialog)
enable_browseui_Progress_Dialog="$2"
;;
@ -706,9 +709,6 @@ patch_enable ()
wined3d-Multisampling)
enable_wined3d_Multisampling="$2"
;;
wined3d-NormalMatrix)
enable_wined3d_NormalMatrix="$2"
;;
wined3d-Revert_PixelFormat)
enable_wined3d_Revert_PixelFormat="$2"
;;
@ -1060,9 +1060,13 @@ if test "$enable_server_Inherited_ACLs" -eq 1; then
fi
if test "$enable_server_Stored_ACLs" -eq 1; then
if test "$enable_advapi32_Revert_DACL" -gt 1; then
abort "Patchset advapi32-Revert_DACL disabled, but server-Stored_ACLs depends on that."
fi
if test "$enable_ntdll_DOS_Attributes" -gt 1; then
abort "Patchset ntdll-DOS_Attributes disabled, but server-Stored_ACLs depends on that."
fi
enable_advapi32_Revert_DACL=1
enable_ntdll_DOS_Attributes=1
fi
@ -1337,6 +1341,26 @@ if test "$enable_Staging" -eq 1; then
) >> "$patchlist"
fi
# Patchset advapi32-Revert_DACL
# |
# | Modified files:
# | * dlls/advapi32/security.c, dlls/advapi32/tests/security.c, server/file.c
# |
if test "$enable_advapi32_Revert_DACL" -eq 1; then
patch_apply advapi32-Revert_DACL/0001-Revert-advapi32-Add-DACL-inheritance-support-in-SetS.patch
patch_apply advapi32-Revert_DACL/0002-Revert-advapi32-tests-Add-test-for-mapping-DACL-to-p.patch
patch_apply advapi32-Revert_DACL/0003-Revert-advapi32-Add-SetNamedSecurityInfo-test-with-e.patch
patch_apply advapi32-Revert_DACL/0004-Revert-server-Make-directory-DACL-entries-inheritabl.patch
patch_apply advapi32-Revert_DACL/0005-Revert-advapi-Don-t-use-CreateFile-when-opening-file.patch
(
echo '+ { "Sebastian Lackner", "Revert \"advapi32: Add DACL inheritance support in SetSecurityInfo.\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"advapi32/tests: Add test for mapping DACL to permission.\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"advapi32: Add SetNamedSecurityInfo test with empty DACL.\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"server: Make directory DACL entries inheritable.\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"advapi: Don'\''t use CreateFile when opening file with possibly empty DACL.\".", 1 },';
) >> "$patchlist"
fi
# Patchset browseui-Progress_Dialog
# |
# | Modified files:
@ -1851,21 +1875,6 @@ if test "$enable_wined3d_Multisampling" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-NormalMatrix
# |
# | This patchset fixes the following Wine bugs:
# | * [#38256] Fix regression causing too dark/missing textures in several games
# |
# | Modified files:
# | * dlls/wined3d/glsl_shader.c
# |
if test "$enable_wined3d_NormalMatrix" -eq 1; then
patch_apply wined3d-NormalMatrix/0001-wined3d-Don-t-use-the-builtin-FFP-uniform-for-the-no.patch
(
echo '+ { "Matteo Bruni", "wined3d: Don'\''t use the builtin FFP uniform for the normal matrix.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-Revert_PixelFormat
# |
# | This patchset fixes the following Wine bugs:
@ -3685,21 +3694,6 @@ if test "$enable_server_CreateProcess_ACLs" -eq 1; then
) >> "$patchlist"
fi
# Patchset server-OpenProcess
# |
# | This patchset fixes the following Wine bugs:
# | * [#37087] Return an error when trying to open a terminated process
# |
# | Modified files:
# | * server/process.c, server/process.h
# |
if test "$enable_server_OpenProcess" -eq 1; then
patch_apply server-OpenProcess/0001-server-Return-error-when-opening-a-terminating-proce.patch
(
echo '+ { "Michael Müller", "server: Return error when opening a terminating process.", 3 },';
) >> "$patchlist"
fi
# Patchset server-Misc_ACL
# |
# | This patchset fixes the following Wine bugs:
@ -3717,6 +3711,21 @@ if test "$enable_server_Misc_ACL" -eq 1; then
) >> "$patchlist"
fi
# Patchset server-OpenProcess
# |
# | This patchset fixes the following Wine bugs:
# | * [#37087] Return an error when trying to open a terminated process
# |
# | Modified files:
# | * server/process.c, server/process.h
# |
if test "$enable_server_OpenProcess" -eq 1; then
patch_apply server-OpenProcess/0001-server-Return-error-when-opening-a-terminating-proce.patch
(
echo '+ { "Michael Müller", "server: Return error when opening a terminating process.", 3 },';
) >> "$patchlist"
fi
# Patchset server-JobObjects
# |
# | This patchset fixes the following Wine bugs:
@ -4224,14 +4233,11 @@ fi
# | * [#27775] Implement empty enumerator for IWiaDevMgr::EnumDeviceInfo
# |
# | Modified files:
# | * dlls/wiaservc/Makefile.in, dlls/wiaservc/enumwiadevinfo.c, dlls/wiaservc/factory.c, dlls/wiaservc/wiadevmgr.c,
# | dlls/wiaservc/wiaservc_private.h
# | * dlls/wiaservc/Makefile.in, dlls/wiaservc/enumwiadevinfo.c, dlls/wiaservc/wiadevmgr.c, dlls/wiaservc/wiaservc_private.h
# |
if test "$enable_wiaservc_IEnumWIA_DEV_INFO" -eq 1; then
patch_apply wiaservc-IEnumWIA_DEV_INFO/0001-wiaservc-Return-pointer-to-vtbl-instead-of-implement.patch
patch_apply wiaservc-IEnumWIA_DEV_INFO/0002-wiaservc-Implement-IWiaDevMgr-EnumDeviceInfo-by-retu.patch
patch_apply wiaservc-IEnumWIA_DEV_INFO/0001-wiaservc-Implement-IWiaDevMgr-EnumDeviceInfo-by-retu.patch
(
echo '+ { "Sebastian Lackner", "wiaservc: Return pointer to vtbl instead of implementation in wiadevmgr_Constructor.", 1 },';
echo '+ { "Mikael Ståldal", "wiaservc: Implement IWiaDevMgr::EnumDeviceInfo by returning an empty enumeration of devices.", 1 },';
) >> "$patchlist"
fi

View File

@ -1,2 +1,3 @@
Depends: advapi32-Revert_DACL
Depends: ntdll-DOS_Attributes
Fixes: [33576] Support for stored file ACLs

View File

@ -1,78 +0,0 @@
From 18b3c656e19464999313d19ddee1d8168d87cb3a Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 27 Mar 2015 09:14:37 +0100
Subject: wiaservc: Return pointer to vtbl instead of implementation in
wiadevmgr_Constructor.
---
dlls/wiaservc/factory.c | 8 ++++----
dlls/wiaservc/wiadevmgr.c | 4 ++--
dlls/wiaservc/wiaservc_private.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/wiaservc/factory.c b/dlls/wiaservc/factory.c
index c76a363..9a607d5 100644
--- a/dlls/wiaservc/factory.c
+++ b/dlls/wiaservc/factory.c
@@ -70,19 +70,19 @@ WIASERVC_IClassFactory_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter,
REFIID riid, LPVOID *ppvObj)
{
HRESULT res;
- IUnknown *punk = NULL;
+ IWiaDevMgr *devmgr = NULL;
TRACE("IID: %s\n", debugstr_guid(riid));
if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
- res = wiadevmgr_Constructor((LPVOID*) &punk);
+ res = wiadevmgr_Constructor(&devmgr);
if (FAILED(res))
return res;
- res = IUnknown_QueryInterface(punk, riid, ppvObj);
- IUnknown_Release(punk);
+ res = IWiaDevMgr_QueryInterface(devmgr, riid, ppvObj);
+ IWiaDevMgr_Release(devmgr);
return res;
}
diff --git a/dlls/wiaservc/wiadevmgr.c b/dlls/wiaservc/wiadevmgr.c
index 2f0907b..6eb82aa 100644
--- a/dlls/wiaservc/wiadevmgr.c
+++ b/dlls/wiaservc/wiadevmgr.c
@@ -164,7 +164,7 @@ static const IWiaDevMgrVtbl WIASERVC_IWiaDevMgr_Vtbl =
wiadevmgr_AddDeviceDlg
};
-HRESULT wiadevmgr_Constructor(LPVOID *ppObj)
+HRESULT wiadevmgr_Constructor(IWiaDevMgr **ppObj)
{
wiadevmgr *This;
TRACE("(%p)\n", ppObj);
@@ -173,7 +173,7 @@ HRESULT wiadevmgr_Constructor(LPVOID *ppObj)
{
This->IWiaDevMgr_iface.lpVtbl = &WIASERVC_IWiaDevMgr_Vtbl;
This->ref = 1;
- *ppObj = This;
+ *ppObj = &This->IWiaDevMgr_iface;
return S_OK;
}
*ppObj = NULL;
diff --git a/dlls/wiaservc/wiaservc_private.h b/dlls/wiaservc/wiaservc_private.h
index b7faf89..33c9ba1 100644
--- a/dlls/wiaservc/wiaservc_private.h
+++ b/dlls/wiaservc/wiaservc_private.h
@@ -34,7 +34,7 @@ typedef struct
LONG ref;
} wiadevmgr;
-HRESULT wiadevmgr_Constructor(LPVOID *ppObj) DECLSPEC_HIDDEN;
+HRESULT wiadevmgr_Constructor(IWiaDevMgr **ppObj) DECLSPEC_HIDDEN;
/* Little helper functions */
static inline char *
--
2.3.3

View File

@ -461,7 +461,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -5034,7 +5034,11 @@
@@ -5116,7 +5116,11 @@
fill_surface(surface_managed, 0x0000ff00, D3DLOCK_NO_DIRTY_UPDATE);
add_dirty_rect_test_draw(device);
color = getPixelColor(device, 320, 240);
@ -1678,7 +1678,7 @@ diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -16503,7 +16503,11 @@
@@ -16585,7 +16585,11 @@
fill_surface(surface_managed, 0x0000ff00, D3DLOCK_NO_DIRTY_UPDATE);
add_dirty_rect_test_draw(device);
color = getPixelColor(device, 320, 240);
@ -1751,7 +1751,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
};
extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN;
@@ -997,9 +1027,14 @@
@@ -998,9 +1028,14 @@
WORD use_map; /* MAX_ATTRIBS, 16 */
};
@ -1766,7 +1766,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN;
#define eps 1e-8f
@@ -1084,8 +1119,10 @@
@@ -1085,8 +1120,10 @@
struct list entry;
GLuint id;
struct wined3d_context *context;
@ -1777,7 +1777,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
};
union wined3d_gl_query_object
@@ -1121,6 +1158,7 @@
@@ -1122,6 +1159,7 @@
struct list entry;
GLuint id;
struct wined3d_context *context;
@ -1785,7 +1785,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
UINT64 timestamp;
};
@@ -1156,6 +1194,12 @@
@@ -1157,6 +1195,12 @@
for (i = 0; i < min(dst->rt_size, src->rt_size); i++)
dst->render_targets[i] = src->render_targets[i];
}
@ -1798,7 +1798,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
struct wined3d_context
{
@@ -1171,7 +1215,9 @@
@@ -1172,7 +1216,9 @@
DWORD dirtyArray[STATE_HIGHEST + 1]; /* Won't get bigger than that, a state is never marked dirty 2 times */
DWORD numDirtyEntries;
DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */
@ -1808,7 +1808,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
struct wined3d_swapchain *swapchain;
struct wined3d_surface *current_rt;
@@ -1271,8 +1317,17 @@
@@ -1272,8 +1318,17 @@
GLfloat fog_coord_value;
GLfloat color[4], fogstart, fogend, fogcolor[4];
GLuint dummy_arbfp_prog;
@ -1826,7 +1826,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
};
typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id);
@@ -1402,8 +1457,12 @@
@@ -1403,8 +1458,12 @@
void context_apply_blit_state(struct wined3d_context *context, const struct wined3d_device *device) DECLSPEC_HIDDEN;
BOOL context_apply_clear_state(struct wined3d_context *context, const struct wined3d_device *device,
UINT rt_count, const struct wined3d_fb_state *fb) DECLSPEC_HIDDEN;
@ -1839,7 +1839,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target,
struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location) DECLSPEC_HIDDEN;
void context_active_texture(struct wined3d_context *context, const struct wined3d_gl_info *gl_info,
@@ -1952,7 +2011,11 @@
@@ -1953,7 +2012,11 @@
struct wined3d_state
{
DWORD flags;
@ -1851,7 +1851,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
struct wined3d_vertex_declaration *vertex_declaration;
struct wined3d_stream_output stream_output[MAX_STREAM_OUT];
@@ -1997,6 +2060,7 @@
@@ -1998,6 +2061,7 @@
DWORD render_states[WINEHIGHEST_RENDER_STATE + 1];
};
@ -1859,7 +1859,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
struct wined3d_gl_bo
{
GLuint name;
@@ -2005,6 +2069,7 @@
@@ -2006,6 +2070,7 @@
UINT size;
};
@ -1867,7 +1867,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
#define WINED3D_UNMAPPED_STAGE ~0U
/* Multithreaded flag. Removed from the public header to signal that
@@ -2060,11 +2125,23 @@
@@ -2061,11 +2126,23 @@
struct wined3d_rendertarget_view *back_buffer_view;
struct wined3d_swapchain **swapchains;
UINT swapchain_count;
@ -1891,7 +1891,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
/* For rendering to a texture using glCopyTexImage */
GLuint depth_blt_texture;
@@ -2075,6 +2152,9 @@
@@ -2076,6 +2153,9 @@
UINT xScreenSpace;
UINT yScreenSpace;
UINT cursorWidth, cursorHeight;
@ -1901,7 +1901,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
HCURSOR hardwareCursor;
/* The Wine logo texture */
@@ -2106,6 +2186,7 @@
@@ -2107,6 +2187,7 @@
UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN;
void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
@ -1909,7 +1909,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN;
void device_invalidate_shader_constants(const struct wined3d_device *device, DWORD mask) DECLSPEC_HIDDEN;
void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture,
@@ -2117,6 +2198,11 @@
@@ -2118,6 +2199,11 @@
void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
void device_delete_opengl_contexts_cs(struct wined3d_device *device,
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
@ -1921,7 +1921,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -2140,9 +2226,11 @@
@@ -2141,9 +2227,11 @@
ULONG (*resource_incref)(struct wined3d_resource *resource);
ULONG (*resource_decref)(struct wined3d_resource *resource);
void (*resource_unload)(struct wined3d_resource *resource);
@ -1933,7 +1933,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
};
struct wined3d_resource
@@ -2165,6 +2253,7 @@
@@ -2166,6 +2254,7 @@
UINT depth;
UINT size;
DWORD priority;
@ -1941,7 +1941,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void *heap_memory, *map_heap_memory, *user_memory, *bitmap_data;
UINT custom_row_pitch, custom_slice_pitch;
struct wined3d_gl_bo *buffer, *map_buffer;
@@ -2172,6 +2261,11 @@
@@ -2173,6 +2262,11 @@
DWORD locations;
LONG access_fence;
BOOL unmap_dirtify;
@ -1953,7 +1953,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void *parent;
const struct wined3d_parent_ops *parent_ops;
@@ -2196,6 +2290,7 @@
@@ -2197,6 +2291,7 @@
void *parent, const struct wined3d_parent_ops *parent_ops,
const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN;
void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
@ -1961,7 +1961,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
DWORD wined3d_resource_access_from_location(DWORD location) DECLSPEC_HIDDEN;
BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void wined3d_resource_changed(struct wined3d_resource *resource,
@@ -2242,6 +2337,15 @@
@@ -2243,6 +2338,15 @@
{
while(InterlockedCompareExchange(&resource->access_fence, 0, 0));
}
@ -1977,7 +1977,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
/* Tests show that the start address of resources is 32 byte aligned */
#define RESOURCE_ALIGNMENT 16
@@ -2319,7 +2423,9 @@
@@ -2320,7 +2424,9 @@
void wined3d_texture_apply_sampler_desc(struct wined3d_texture *texture,
const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
@ -1987,7 +1987,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void wined3d_texture_bind(struct wined3d_texture *texture,
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
@@ -2353,9 +2459,16 @@
@@ -2354,9 +2460,16 @@
struct wined3d_resource resource;
struct wined3d_texture *container;
@ -2004,7 +2004,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
};
static inline struct wined3d_volume *volume_from_resource(struct wined3d_resource *resource)
@@ -2363,6 +2476,7 @@
@@ -2364,6 +2477,7 @@
return CONTAINING_RECORD(resource, struct wined3d_volume, resource);
}
@ -2012,7 +2012,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
HRESULT wined3d_volume_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc,
unsigned int level, struct wined3d_volume **volume) DECLSPEC_HIDDEN;
void wined3d_volume_destroy(struct wined3d_volume *volume) DECLSPEC_HIDDEN;
@@ -2375,6 +2489,23 @@
@@ -2376,6 +2490,23 @@
struct wined3d_surface_dib
{
HBITMAP DIBsection;
@ -2036,7 +2036,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
UINT bitmap_size;
};
@@ -2400,7 +2531,11 @@
@@ -2401,7 +2532,11 @@
struct wined3d_surface_ops
{
HRESULT (*surface_private_setup)(struct wined3d_surface *surface);
@ -2048,7 +2048,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
};
struct wined3d_surface
@@ -2408,12 +2543,25 @@
@@ -2409,12 +2544,25 @@
struct wined3d_resource resource;
const struct wined3d_surface_ops *surface_ops;
struct wined3d_texture *container;
@ -2074,7 +2074,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
GLuint rb_multisample;
GLuint rb_resolved;
GLenum texture_target;
@@ -2457,10 +2605,19 @@
@@ -2458,10 +2606,19 @@
GLenum surface_get_gl_buffer(const struct wined3d_surface *surface) DECLSPEC_HIDDEN;
void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context,
unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN;
@ -2094,7 +2094,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN;
void surface_prepare_rb(struct wined3d_surface *surface,
const struct wined3d_gl_info *gl_info, BOOL multisample) DECLSPEC_HIDDEN;
@@ -2472,6 +2629,7 @@
@@ -2473,6 +2630,7 @@
const struct wined3d_gl_info *gl_info, void *mem, unsigned int pitch) DECLSPEC_HIDDEN;
HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const POINT *dst_point,
struct wined3d_surface *src_surface, const RECT *src_rect) DECLSPEC_HIDDEN;
@ -2102,7 +2102,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
HRESULT wined3d_surface_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc,
GLenum target, unsigned int level, unsigned int layer, DWORD flags,
struct wined3d_surface **surface) DECLSPEC_HIDDEN;
@@ -2490,6 +2648,21 @@
@@ -2491,6 +2649,21 @@
void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context,
const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
void surface_flip(struct wined3d_surface *front, struct wined3d_surface *back) DECLSPEC_HIDDEN;
@ -2124,7 +2124,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
/* Surface flags: */
#define SFLAG_DIBSECTION 0x00000001 /* Has a DIB section attached for GetDC. */
@@ -2537,8 +2710,10 @@
@@ -2538,8 +2711,10 @@
BOOL half_float_conv_needed;
};
@ -2135,7 +2135,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
struct wined3d_saved_states
{
DWORD transform[(HIGHEST_TRANSFORMSTATE >> 5) + 1];
@@ -2606,6 +2781,7 @@
@@ -2607,6 +2782,7 @@
void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN;
void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN;
@ -2143,7 +2143,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl_info,
const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN;
void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN;
@@ -2656,6 +2832,32 @@
@@ -2657,6 +2833,32 @@
void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, struct wined3d_context *context,
struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN;
@ -2176,7 +2176,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects,
DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) DECLSPEC_HIDDEN;
@@ -2703,6 +2905,7 @@
@@ -2704,6 +2906,7 @@
void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN;
@ -2184,7 +2184,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, UINT start_register, const float *constants,
UINT vector4f_count, enum wined3d_shader_type type) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, UINT start_register,
@@ -2762,6 +2965,7 @@
@@ -2763,6 +2966,7 @@
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void wined3d_cs_emit_getdc(struct wined3d_cs *cs, struct wined3d_surface *surface) DECLSPEC_HIDDEN;
void wined3d_cs_emit_releasedc(struct wined3d_cs *cs, struct wined3d_surface *surface) DECLSPEC_HIDDEN;
@ -2192,7 +2192,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
@@ -2776,8 +2980,12 @@
@@ -2777,8 +2981,12 @@
struct wined3d_query_ops
{
HRESULT (*query_get_data)(struct wined3d_query *query, void *data, DWORD data_size, DWORD flags);
@ -2205,7 +2205,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
};
struct wined3d_query
@@ -2791,12 +2999,16 @@
@@ -2792,12 +3000,16 @@
enum wined3d_query_type type;
DWORD data_size;
void *extendedData;
@ -2222,7 +2222,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
/* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other
* fixed function semantics as D3DCOLOR or FLOAT16 */
@@ -2823,7 +3035,9 @@
@@ -2824,7 +3036,9 @@
GLenum buffer_object_usage;
GLenum buffer_type_hint;
DWORD flags;
@ -2232,7 +2232,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void *map_ptr;
struct wined3d_map_range *maps;
@@ -2848,11 +3062,15 @@
@@ -2849,11 +3063,15 @@
BYTE *buffer_get_sysmem(struct wined3d_buffer *This, struct wined3d_context *context) DECLSPEC_HIDDEN;
void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context,
const struct wined3d_state *state) DECLSPEC_HIDDEN;
@ -2248,7 +2248,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
struct wined3d_rendertarget_view
{
@@ -2890,8 +3108,10 @@
@@ -2891,8 +3109,10 @@
return surface_from_resource(resource);
}
@ -2259,7 +2259,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
struct wined3d_shader_resource_view
{
LONG refcount;
@@ -2904,8 +3124,12 @@
@@ -2905,8 +3125,12 @@
struct wined3d_swapchain_ops
{
void (*swapchain_present)(struct wined3d_swapchain *swapchain, const RECT *src_rect,
@ -2272,7 +2272,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
};
struct wined3d_swapchain
@@ -2945,8 +3169,10 @@
@@ -2946,8 +3170,10 @@
HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
@ -2283,7 +2283,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
/*****************************************************************************
* Utility function prototypes
@@ -3159,7 +3385,9 @@
@@ -3158,7 +3384,9 @@
void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_shader_buffer *buffer,
const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) DECLSPEC_HIDDEN;
BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage) DECLSPEC_HIDDEN;
@ -4508,7 +4508,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -961,8 +961,15 @@
@@ -1061,8 +1061,15 @@
const struct wined3d_shader_reg_maps *reg_maps, const struct shader_glsl_ctx_priv *ctx_priv)
{
const struct wined3d_shader_version *version = &reg_maps->shader_version;
@ -4524,7 +4524,7 @@ diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
unsigned int i, extra_constants_needed = 0;
const struct wined3d_shader_lconst *lconst;
const char *prefix;
@@ -1203,7 +1210,11 @@
@@ -1303,7 +1310,11 @@
{
UINT in_count = min(vec4_varyings(version->major, gl_info), shader->limits->packed_input);
@ -4536,7 +4536,7 @@ diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
shader_addline(buffer, "varying vec4 %s_link[%u];\n", prefix, in_count);
shader_addline(buffer, "vec4 %s_in[%u];\n", prefix, in_count);
}
@@ -1244,6 +1255,7 @@
@@ -1344,6 +1355,7 @@
}
else
{
@ -4544,7 +4544,7 @@ diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
/* This happens because we do not have proper tracking of the
* constant registers that are actually used, only the max
* limit of the shader version.
@@ -1252,6 +1264,23 @@
@@ -1352,6 +1364,23 @@
* it and just create the uniform.
*/
FIXME("Cannot find a free uniform for vpos correction params\n");

View File

@ -1,154 +0,0 @@
From 038e357b26d73568f8904330ab79fb6e96792ff4 Mon Sep 17 00:00:00 2001
From: Matteo Bruni <mbruni@codeweavers.com>
Date: Fri, 20 Mar 2015 18:56:53 +0100
Subject: wined3d: Don't use the builtin FFP uniform for the normal matrix.
---
dlls/wined3d/glsl_shader.c | 95 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 93 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index e38cd18..6839587 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -118,6 +118,7 @@ struct glsl_vs_program
GLint pos_fixup_location;
GLint modelview_matrix_location;
+ GLint normal_matrix_location;
};
struct glsl_gs_program
@@ -735,6 +736,92 @@ static void shader_glsl_load_np2fixup_constants(const struct glsl_ps_program *ps
GL_EXTCALL(glUniform4fv(ps->np2_fixup_location, ps->np2_fixup_info->num_consts, np2fixup_constants));
}
+/* Taken and adapted from Mesa. */
+static BOOL invert_matrix_3d_general(struct wined3d_matrix *out, const struct wined3d_matrix *in)
+{
+ float pos, neg, t;
+ float det;
+ struct wined3d_matrix temp;
+
+ /* Calculate the determinant of upper left 3x3 submatrix and
+ * determine if the matrix is singular. */
+ pos = neg = 0.0f;
+ t = in->_11 * in->_22 * in->_33;
+ if (t >= 0.0f)
+ pos += t;
+ else
+ neg += t;
+
+ t = in->_21 * in->_32 * in->_13;
+ if (t >= 0.0f)
+ pos += t;
+ else
+ neg += t;
+ t = in->_31 * in->_12 * in->_23;
+ if (t >= 0.0f)
+ pos += t;
+ else
+ neg += t;
+
+ t = -in->_31 * in->_22 * in->_13;
+ if (t >= 0.0f)
+ pos += t;
+ else
+ neg += t;
+ t = -in->_21 * in->_12 * in->_33;
+ if (t >= 0.0f)
+ pos += t;
+ else
+ neg += t;
+
+ t = -in->_11 * in->_32 * in->_23;
+ if (t >= 0.0f)
+ pos += t;
+ else
+ neg += t;
+
+ det = pos + neg;
+
+ if (fabsf(det) < 1e-25f)
+ return FALSE;
+
+ det = 1.0f / det;
+ temp._11 = (in->_22 * in->_33 - in->_32 * in->_23) * det;
+ temp._12 = -(in->_12 * in->_33 - in->_32 * in->_13) * det;
+ temp._13 = (in->_12 * in->_23 - in->_22 * in->_13) * det;
+ temp._21 = -(in->_21 * in->_33 - in->_31 * in->_23) * det;
+ temp._22 = (in->_11 * in->_33 - in->_31 * in->_13) * det;
+ temp._23 = -(in->_11 * in->_23 - in->_21 * in->_13) * det;
+ temp._31 = (in->_21 * in->_32 - in->_31 * in->_22) * det;
+ temp._32 = -(in->_11 * in->_32 - in->_31 * in->_12) * det;
+ temp._33 = (in->_11 * in->_22 - in->_21 * in->_12) * det;
+
+ memcpy(out, &temp, sizeof(temp));
+ return TRUE;
+}
+
+static void shader_glsl_ffp_vertex_normalmatrix_uniform(const struct wined3d_context *context,
+ const struct wined3d_state *state, struct glsl_shader_prog_link *prog)
+{
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+ float mat[3][3];
+ struct wined3d_matrix mv;
+ unsigned int i, j;
+
+ /* gl_NormalMatrix is defined in the spec as "transpose of the inverse of the
+ * upper leftmost 3x3 of gl_ModelViewMatrix". */
+ get_modelview_matrix(context, state, &mv);
+ /* TODO: Could check for and use optimized matrix inversion functions for
+ * special (common) cases, like Mesa does. */
+ invert_matrix_3d_general(&mv, &mv);
+ for (i = 0; i < 3; ++i)
+ for (j = 0; j < 3; ++j)
+ mat[i][j] = ((float *)&mv)[j * 4 + i];
+
+ GL_EXTCALL(glUniformMatrix3fv(prog->vs.normal_matrix_location, 1, FALSE, (GLfloat *)mat));
+ checkGLcall("glUniformMatrix3fv");
+}
+
/* Context activation is done by the caller (state handler). */
static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context *context,
const struct wined3d_state *state)
@@ -784,6 +871,8 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
get_modelview_matrix(context, state, &mat);
GL_EXTCALL(glUniformMatrix4fv(prog->vs.modelview_matrix_location, 1, FALSE, &mat._11));
checkGLcall("glUniformMatrix4fv");
+
+ shader_glsl_ffp_vertex_normalmatrix_uniform(context, state, prog);
}
if (update_mask & WINED3D_SHADER_CONST_PS_F)
@@ -4989,6 +5078,7 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct wined3d_shader_buffe
shader_addline(buffer, "\n");
shader_addline(buffer, "uniform mat4 ffp_modelview_matrix;\n");
+ shader_addline(buffer, "uniform mat3 ffp_normal_matrix;\n");
shader_addline(buffer, "\nvoid main()\n{\n");
shader_addline(buffer, "float m;\n");
@@ -5012,9 +5102,9 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct wined3d_shader_buffe
if (!settings->normal)
shader_addline(buffer, "vec3 normal = vec3(0.0);\n");
else if (settings->normalize)
- shader_addline(buffer, "vec3 normal = normalize(gl_NormalMatrix * gl_Normal);\n");
+ shader_addline(buffer, "vec3 normal = normalize(ffp_normal_matrix * gl_Normal);\n");
else
- shader_addline(buffer, "vec3 normal = gl_NormalMatrix * gl_Normal;\n");
+ shader_addline(buffer, "vec3 normal = ffp_normal_matrix * gl_Normal;\n");
shader_glsl_ffp_vertex_lighting(buffer, settings, gl_info);
@@ -5771,6 +5861,7 @@ static void shader_glsl_init_vs_uniform_locations(const struct wined3d_gl_info *
vs->pos_fixup_location = GL_EXTCALL(glGetUniformLocation(program_id, "posFixup"));
vs->modelview_matrix_location = GL_EXTCALL(glGetUniformLocation(program_id, "ffp_modelview_matrix"));
+ vs->normal_matrix_location = GL_EXTCALL(glGetUniformLocation(program_id, "ffp_normal_matrix"));
}
static void shader_glsl_init_ps_uniform_locations(const struct wined3d_gl_info *gl_info,
--
2.3.2

View File

@ -1 +0,0 @@
Fixes: [38256] Fix regression causing too dark/missing textures in several games