From 4d7af4085f1e62fb440b732882f53f732ebc131b Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 23 Mar 2018 08:37:51 +1100 Subject: [PATCH] Rebase against afef57f872433bcd3032c2ccbc0453bef5b62178 --- ...anging-strict-drawing-through-an-exp.patch | 42 ---- ...-bcrypt-Implement-BCryptDuplicateKey.patch | 140 ----------- ...sts-Add-tests-for-BCryptDuplicateKey.patch | 77 ------ ...upport-for-auth-data-in-AES-GCM-mode.patch | 114 --------- ...-tests-for-auth-data-in-AES-GCM-mode.patch | 102 -------- ...sh-in-tests-when-compiling-without-g.patch | 49 ++-- ...tEncrypt-with-AES_GCM-and-no-input-a.patch | 64 ----- ...rypt-Preparation-for-asymmetric-keys.patch | 212 +++++++--------- ...pt-Implement-importing-of-ecdsa-keys.patch | 100 ++++---- ...l-ECCKEY_BLOB-struct-in-BCryptImport.patch | 12 +- ...nt-ID3DXEffect_FindNextValidTechniqu.patch | 141 ----------- .../definition | 1 - patches/patchinstall.sh | 108 +-------- ...prove-compatibility-of-IMILBitmapSou.patch | 46 ++-- ...plement-WICCreateBitmapFromSection-E.patch | 214 ---------------- .../definition | 1 - ...repeated-wined3d_swapchain_present-F.patch | 37 --- ...t-updating-swap-interval-through-win.patch | 228 ------------------ .../wined3d-dxgi_swapchain_Present/definition | 2 - ...compile-error-when-Vulkan-isn-t-avai.patch | 30 --- 20 files changed, 182 insertions(+), 1538 deletions(-) delete mode 100644 patches/Pipelight/0003-wined3d-allow-changing-strict-drawing-through-an-exp.patch delete mode 100644 patches/bcrypt-Improvements/0020-bcrypt-Implement-BCryptDuplicateKey.patch delete mode 100644 patches/bcrypt-Improvements/0021-bcrypt-tests-Add-tests-for-BCryptDuplicateKey.patch delete mode 100644 patches/bcrypt-Improvements/0023-bcrypt-Add-support-for-auth-data-in-AES-GCM-mode.patch delete mode 100644 patches/bcrypt-Improvements/0024-bcrypt-tests-Add-tests-for-auth-data-in-AES-GCM-mode.patch delete mode 100644 patches/bcrypt-Improvements/0027-bcrypt-Fix-BCryptEncrypt-with-AES_GCM-and-no-input-a.patch delete mode 100644 patches/d3dx9_36-FindNextValidTechnique/0001-d3dx9_36-Implement-ID3DXEffect_FindNextValidTechniqu.patch delete mode 100644 patches/d3dx9_36-FindNextValidTechnique/definition delete mode 100644 patches/windowscodecs-WICCreateBitmapFromSection/0001-windowscodecs-Implement-WICCreateBitmapFromSection-E.patch delete mode 100644 patches/windowscodecs-WICCreateBitmapFromSection/definition delete mode 100644 patches/wined3d-Silence_FIXMEs/0005-wined3d-Silence-repeated-wined3d_swapchain_present-F.patch delete mode 100644 patches/wined3d-dxgi_swapchain_Present/0001-wined3d-Implement-updating-swap-interval-through-win.patch delete mode 100644 patches/wined3d-dxgi_swapchain_Present/definition delete mode 100644 patches/winex11-Vulkan-compile-fix/0001-winex11.drv-Fix-compile-error-when-Vulkan-isn-t-avai.patch diff --git a/patches/Pipelight/0003-wined3d-allow-changing-strict-drawing-through-an-exp.patch b/patches/Pipelight/0003-wined3d-allow-changing-strict-drawing-through-an-exp.patch deleted file mode 100644 index 18441640..00000000 --- a/patches/Pipelight/0003-wined3d-allow-changing-strict-drawing-through-an-exp.patch +++ /dev/null @@ -1,42 +0,0 @@ -From b0a0388503a1576fb9b1b91ca764251b30f7dd3e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Sun, 20 Jul 2014 22:22:14 +0200 -Subject: wined3d: allow changing strict drawing through an exported function - ---- - dlls/wined3d/wined3d.spec | 2 ++ - dlls/wined3d/wined3d_main.c | 5 +++++ - 2 files changed, 7 insertions(+) - -diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec -index bbd2fb5..2fd0c0e 100644 ---- a/dlls/wined3d/wined3d.spec -+++ b/dlls/wined3d/wined3d.spec -@@ -220,6 +220,8 @@ - @ cdecl wined3d_stateblock_decref(ptr) - @ cdecl wined3d_stateblock_incref(ptr) - -+@ cdecl wined3d_strictdrawing_set(long) -+ - @ cdecl wined3d_swapchain_create(ptr ptr ptr ptr ptr) - @ cdecl wined3d_swapchain_decref(ptr) - @ cdecl wined3d_swapchain_get_back_buffer(ptr long) -diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c -index 0543d97..6a62697 100644 ---- a/dlls/wined3d/wined3d_main.c -+++ b/dlls/wined3d/wined3d_main.c -@@ -515,6 +515,11 @@ void wined3d_unregister_window(HWND window) - wined3d_wndproc_mutex_unlock(); - } - -+void CDECL wined3d_strictdrawing_set(int value) -+{ -+ wined3d_settings.strict_draw_ordering = value; -+} -+ - /* At process attach */ - BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved) - { --- -2.7.1 - diff --git a/patches/bcrypt-Improvements/0020-bcrypt-Implement-BCryptDuplicateKey.patch b/patches/bcrypt-Improvements/0020-bcrypt-Implement-BCryptDuplicateKey.patch deleted file mode 100644 index b4faec9a..00000000 --- a/patches/bcrypt-Improvements/0020-bcrypt-Implement-BCryptDuplicateKey.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 392198981958d9d2c76e22e27c1b704c7763971b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Mon, 26 Dec 2016 08:28:24 +0100 -Subject: [PATCH] bcrypt: Implement BCryptDuplicateKey. - ---- - dlls/bcrypt/bcrypt.spec | 2 +- - dlls/bcrypt/bcrypt_main.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++ - dlls/ncrypt/ncrypt.spec | 2 +- - 3 files changed, 70 insertions(+), 2 deletions(-) - -diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec -index 21b54b4..28c2394 100644 ---- a/dlls/bcrypt/bcrypt.spec -+++ b/dlls/bcrypt/bcrypt.spec -@@ -12,7 +12,7 @@ - @ stdcall BCryptDestroyKey(ptr) - @ stub BCryptDestroySecret - @ stdcall BCryptDuplicateHash(ptr ptr ptr long long) --@ stub BCryptDuplicateKey -+@ stdcall BCryptDuplicateKey(ptr ptr ptr long long) - @ stdcall BCryptEncrypt(ptr ptr long ptr ptr long ptr long ptr long) - @ stdcall BCryptEnumAlgorithms(long ptr ptr long) - @ stub BCryptEnumContextFunctionProviders -diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index cd44bdf..0d321d2 100644 ---- a/dlls/bcrypt/bcrypt_main.c -+++ b/dlls/bcrypt/bcrypt_main.c -@@ -953,6 +953,24 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val - return STATUS_NOT_IMPLEMENTED; - } - -+static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) -+{ -+ UCHAR *buffer; -+ -+ if (!(buffer = HeapAlloc( GetProcessHeap(), 0, key_orig->secret_len ))) return STATUS_NO_MEMORY; -+ memcpy( buffer, key_orig->secret, key_orig->secret_len ); -+ -+ key_copy->hdr = key_orig->hdr; -+ key_copy->alg_id = key_orig->alg_id; -+ key_copy->mode = key_orig->mode; -+ key_copy->block_size = key_orig->block_size; -+ key_copy->handle = NULL; -+ key_copy->secret = buffer; -+ key_copy->secret_len = key_orig->secret_len; -+ -+ return STATUS_SUCCESS; -+} -+ - static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key ) - { - switch (key->alg_id) -@@ -1094,6 +1112,25 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val - return STATUS_NOT_IMPLEMENTED; - } - -+static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) -+{ -+ UCHAR *buffer; -+ -+ if (!(buffer = HeapAlloc( GetProcessHeap(), 0, key_orig->secret_len ))) return STATUS_NO_MEMORY; -+ memcpy( buffer, key_orig->secret, key_orig->secret_len ); -+ -+ key_copy->hdr = key_orig->hdr; -+ key_copy->alg_id = key_orig->alg_id; -+ key_copy->mode = key_orig->mode; -+ key_copy->block_size = key_orig->block_size; -+ key_copy->ref_encrypt = NULL; -+ key_copy->ref_decrypt = NULL; -+ key_copy->secret = buffer; -+ key_copy->secret_len = key_orig->secret_len; -+ -+ return STATUS_SUCCESS; -+} -+ - static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len ) - { - CCCryptorStatus status; -@@ -1182,6 +1219,13 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val - return STATUS_NOT_IMPLEMENTED; - } - -+static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) -+{ -+ ERR( "support for keys not available at build time\n" ); -+ key_copy->mode = MODE_ID_CBC; -+ return STATUS_NOT_IMPLEMENTED; -+} -+ - static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len ) - { - ERR( "support for keys not available at build time\n" ); -@@ -1310,6 +1354,30 @@ NTSTATUS WINAPI BCryptExportKey(BCRYPT_KEY_HANDLE export_key, BCRYPT_KEY_HANDLE - return key_export( key, type, output, output_len, size ); - } - -+NTSTATUS WINAPI BCryptDuplicateKey( BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE *handle_copy, -+ UCHAR *object, ULONG object_len, ULONG flags ) -+{ -+ struct key *key_orig = handle; -+ struct key *key_copy; -+ NTSTATUS status; -+ -+ TRACE( "%p, %p, %p, %u, %08x\n", handle, handle_copy, object, object_len, flags ); -+ -+ if (!key_orig || key_orig->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE; -+ if (!handle_copy) return STATUS_INVALID_PARAMETER; -+ if (!(key_copy = HeapAlloc( GetProcessHeap(), 0, sizeof(*key_copy) ))) -+ return STATUS_NO_MEMORY; -+ -+ if ((status = key_duplicate( key_orig, key_copy ))) -+ { -+ HeapFree( GetProcessHeap(), 0, key_copy ); -+ return status; -+ } -+ -+ *handle_copy = key_copy; -+ return STATUS_SUCCESS; -+} -+ - NTSTATUS WINAPI BCryptDestroyKey( BCRYPT_KEY_HANDLE handle ) - { - struct key *key = handle; -diff --git a/dlls/ncrypt/ncrypt.spec b/dlls/ncrypt/ncrypt.spec -index 5d5fae0..d0f0f56 100644 ---- a/dlls/ncrypt/ncrypt.spec -+++ b/dlls/ncrypt/ncrypt.spec -@@ -14,7 +14,7 @@ - @ stdcall BCryptDestroyKey(ptr) bcrypt.BCryptDestroyKey - @ stub BCryptDestroySecret - @ stdcall BCryptDuplicateHash(ptr ptr ptr long long) bcrypt.BCryptDuplicateHash --@ stub BCryptDuplicateKey -+@ stdcall BCryptDuplicateKey(ptr ptr ptr long long) bcrypt.BCryptDuplicateKey - @ stdcall BCryptEncrypt(ptr ptr long ptr ptr long ptr long ptr long) bcrypt.BCryptEncrypt - @ stdcall BCryptEnumAlgorithms(long ptr ptr long) bcrypt.BCryptEnumAlgorithms - @ stub BCryptEnumContextFunctionProviders --- -1.9.1 - diff --git a/patches/bcrypt-Improvements/0021-bcrypt-tests-Add-tests-for-BCryptDuplicateKey.patch b/patches/bcrypt-Improvements/0021-bcrypt-tests-Add-tests-for-BCryptDuplicateKey.patch deleted file mode 100644 index eb6b1a17..00000000 --- a/patches/bcrypt-Improvements/0021-bcrypt-tests-Add-tests-for-BCryptDuplicateKey.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 1eed1f80cd5b8fd8e77e02990ebcf3eb7a5bfda5 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Mon, 26 Dec 2016 08:30:43 +0100 -Subject: [PATCH 21/36] bcrypt/tests: Add tests for BCryptDuplicateKey. - ---- - dlls/bcrypt/tests/bcrypt.c | 33 ++++++++++++++++++++++++++++++++- - 1 file changed, 32 insertions(+), 1 deletion(-) - -diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c -index 18cd2a2713..6ec429e309 100644 ---- a/dlls/bcrypt/tests/bcrypt.c -+++ b/dlls/bcrypt/tests/bcrypt.c -@@ -45,6 +45,7 @@ static NTSTATUS (WINAPI *pBCryptEncrypt)(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID - ULONG *, ULONG); - static NTSTATUS (WINAPI *pBCryptDecrypt)(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, - ULONG *, ULONG); -+static NTSTATUS (WINAPI *pBCryptDuplicateKey)(BCRYPT_KEY_HANDLE, BCRYPT_KEY_HANDLE *, UCHAR *, ULONG, ULONG); - static NTSTATUS (WINAPI *pBCryptDestroyKey)(BCRYPT_KEY_HANDLE); - static NTSTATUS (WINAPI *pBCryptImportKey)(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, BCRYPT_KEY_HANDLE *, - PUCHAR, ULONG, PUCHAR, ULONG, ULONG); -@@ -503,7 +504,7 @@ static void test_BCryptGenerateSymmetricKey(void) - static UCHAR expected[] = - {0xc6,0xa1,0x3b,0x37,0x87,0x8f,0x5b,0x82,0x6f,0x4f,0x81,0x62,0xa1,0xc8,0xd8,0x79}; - BCRYPT_ALG_HANDLE aes; -- BCRYPT_KEY_HANDLE key; -+ BCRYPT_KEY_HANDLE key, key2; - UCHAR *buf, ciphertext[16], plaintext[16], ivbuf[16]; - ULONG size, len, i; - NTSTATUS ret; -@@ -546,6 +547,35 @@ static void test_BCryptGenerateSymmetricKey(void) - for (i = 0; i < 16; i++) - ok(ciphertext[i] == expected[i], "%u: %02x != %02x\n", i, ciphertext[i], expected[i]); - -+ ret = pBCryptDuplicateKey(NULL, &key2, NULL, 0, 0); -+ ok(ret == STATUS_INVALID_HANDLE, "got %08x\n", ret); -+ -+ if (0) /* crashes on some Windows versions */ -+ { -+ ret = pBCryptDuplicateKey(key, NULL, NULL, 0, 0); -+ ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret); -+ } -+ -+ key2 = (void *)0xdeadbeef; -+ ret = pBCryptDuplicateKey(key, &key2, NULL, 0, 0); -+ ok(ret == STATUS_SUCCESS || broken(ret == STATUS_INVALID_PARAMETER), "got %08x\n", ret); -+ -+ if (ret == STATUS_SUCCESS) -+ { -+ size = 0; -+ memcpy(ivbuf, iv, sizeof(iv)); -+ memset(ciphertext, 0, sizeof(ciphertext)); -+ ret = pBCryptEncrypt(key2, data, 16, NULL, ivbuf, 16, ciphertext, 16, &size, 0); -+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret); -+ ok(size == 16, "got %u\n", size); -+ ok(!memcmp(ciphertext, expected, sizeof(expected)), "wrong data\n"); -+ for (i = 0; i < 16; i++) -+ ok(ciphertext[i] == expected[i], "%u: %02x != %02x\n", i, ciphertext[i], expected[i]); -+ -+ ret = pBCryptDestroyKey(key2); -+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret); -+ } -+ - size = 0xdeadbeef; - ret = pBCryptDecrypt(key, NULL, 0, NULL, NULL, 0, NULL, 0, &size, 0); - ok(ret == STATUS_SUCCESS, "got %08x\n", ret); -@@ -1059,6 +1089,7 @@ START_TEST(bcrypt) - pBCryptGenerateSymmetricKey = (void *)GetProcAddress(module, "BCryptGenerateSymmetricKey"); - pBCryptEncrypt = (void *)GetProcAddress(module, "BCryptEncrypt"); - pBCryptDecrypt = (void *)GetProcAddress(module, "BCryptDecrypt"); -+ pBCryptDuplicateKey = (void *)GetProcAddress(module, "BCryptDuplicateKey"); - pBCryptDestroyKey = (void *)GetProcAddress(module, "BCryptDestroyKey"); - pBCryptImportKey = (void *)GetProcAddress(module, "BCryptImportKey"); - pBCryptExportKey = (void *)GetProcAddress(module, "BCryptExportKey"); --- -2.16.1 - diff --git a/patches/bcrypt-Improvements/0023-bcrypt-Add-support-for-auth-data-in-AES-GCM-mode.patch b/patches/bcrypt-Improvements/0023-bcrypt-Add-support-for-auth-data-in-AES-GCM-mode.patch deleted file mode 100644 index b294fd2c..00000000 --- a/patches/bcrypt-Improvements/0023-bcrypt-Add-support-for-auth-data-in-AES-GCM-mode.patch +++ /dev/null @@ -1,114 +0,0 @@ -From d11095de823d25cd44a80bbdab2745c560db9521 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Mon, 26 Dec 2016 15:01:19 +0100 -Subject: [PATCH 23/36] bcrypt: Add support for auth data in AES GCM mode. - ---- - dlls/bcrypt/bcrypt_main.c | 42 +++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 41 insertions(+), 1 deletion(-) - -diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index f027eea..da9cb02 100644 ---- a/dlls/bcrypt/bcrypt_main.c -+++ b/dlls/bcrypt/bcrypt_main.c -@@ -52,6 +52,7 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag); - - /* Not present in gnutls version < 3.0 */ - static int (*pgnutls_cipher_tag)(gnutls_cipher_hd_t handle, void * tag, size_t tag_size); -+static int (*pgnutls_cipher_add_auth)(gnutls_cipher_hd_t handle, const void *ptext, size_t ptext_size); - - static void *libgnutls_handle; - #define MAKE_FUNCPTR(f) static typeof(f) * p##f -@@ -72,7 +73,12 @@ MAKE_FUNCPTR(gnutls_perror); - #define GNUTLS_CIPHER_AES_256_GCM 94 - #endif - --static int compat_gnutls_cipher_tag(gnutls_cipher_hd_t handle, void * tag, size_t tag_size) -+static int compat_gnutls_cipher_tag(gnutls_cipher_hd_t handle, void *tag, size_t tag_size) -+{ -+ return GNUTLS_E_UNKNOWN_CIPHER_TYPE; -+} -+ -+static int compat_gnutls_cipher_add_auth(gnutls_cipher_hd_t handle, const void *ptext, size_t ptext_size) - { - return GNUTLS_E_UNKNOWN_CIPHER_TYPE; - } -@@ -115,6 +121,11 @@ static BOOL gnutls_initialize(void) - WARN("gnutls_cipher_tag not found\n"); - pgnutls_cipher_tag = compat_gnutls_cipher_tag; - } -+ if (!(pgnutls_cipher_add_auth = wine_dlsym( libgnutls_handle, "gnutls_cipher_add_auth", NULL, 0 ))) -+ { -+ WARN("gnutls_cipher_add_auth not found\n"); -+ pgnutls_cipher_add_auth = compat_gnutls_cipher_add_auth; -+ } - - if ((ret = pgnutls_global_init()) != GNUTLS_E_SUCCESS) - { -@@ -1050,6 +1061,19 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len ) - return STATUS_SUCCESS; - } - -+static NTSTATUS key_set_auth_data( struct key *key, UCHAR *auth_data, ULONG len ) -+{ -+ int ret; -+ -+ if ((ret = pgnutls_cipher_add_auth( key->handle, auth_data, len ))) -+ { -+ pgnutls_perror( ret ); -+ return STATUS_INTERNAL_ERROR; -+ } -+ -+ return STATUS_SUCCESS; -+} -+ - static NTSTATUS key_encrypt( struct key *key, const UCHAR *input, ULONG input_len, UCHAR *output, - ULONG output_len ) - { -@@ -1193,6 +1217,12 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len ) - return STATUS_SUCCESS; - } - -+static NTSTATUS key_set_auth_data( struct key *key, UCHAR *auth_data, ULONG len ) -+{ -+ FIXME( "not implemented on Mac\n" ); -+ return STATUS_NOT_IMPLEMENTED; -+} -+ - static NTSTATUS key_encrypt( struct key *key, const UCHAR *input, ULONG input_len, UCHAR *output, - ULONG output_len ) - { -@@ -1262,6 +1292,12 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len ) - return STATUS_NOT_IMPLEMENTED; - } - -+static NTSTATUS key_set_auth_data( struct key *key, UCHAR *auth_data, ULONG len ) -+{ -+ ERR( "support for keys not available at build time\n" ); -+ return STATUS_NOT_IMPLEMENTED; -+} -+ - static NTSTATUS key_encrypt( struct key *key, const UCHAR *input, ULONG input_len, UCHAR *output, - ULONG output_len ) - { -@@ -1456,6 +1492,8 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp - if (!output) return STATUS_SUCCESS; - if (output_len < *ret_len) return STATUS_BUFFER_TOO_SMALL; - -+ if (auth_info->pbAuthData && (status = key_set_auth_data( key, auth_info->pbAuthData, auth_info->cbAuthData ))) -+ return status; - if ((status = key_encrypt( key, input, input_len, output, output_len ))) - return status; - -@@ -1533,6 +1571,8 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp - if (!output) return STATUS_SUCCESS; - if (output_len < *ret_len) return STATUS_BUFFER_TOO_SMALL; - -+ if (auth_info->pbAuthData && (status = key_set_auth_data( key, auth_info->pbAuthData, auth_info->cbAuthData ))) -+ return status; - if ((status = key_decrypt( key, input, input_len, output, output_len ))) - return status; - --- -2.7.4 - diff --git a/patches/bcrypt-Improvements/0024-bcrypt-tests-Add-tests-for-auth-data-in-AES-GCM-mode.patch b/patches/bcrypt-Improvements/0024-bcrypt-tests-Add-tests-for-auth-data-in-AES-GCM-mode.patch deleted file mode 100644 index dcb7f061..00000000 --- a/patches/bcrypt-Improvements/0024-bcrypt-tests-Add-tests-for-auth-data-in-AES-GCM-mode.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 7fd1604b8ca60711c6850fbc47189bc9a7fbaa06 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Mon, 26 Dec 2016 15:01:38 +0100 -Subject: [PATCH 24/36] bcrypt/tests: Add tests for auth data in AES GCM mode. - ---- - dlls/bcrypt/tests/bcrypt.c | 44 ++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 42 insertions(+), 2 deletions(-) - -diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c -index baf5b638f9..bd22b80d9a 100644 ---- a/dlls/bcrypt/tests/bcrypt.c -+++ b/dlls/bcrypt/tests/bcrypt.c -@@ -610,7 +610,9 @@ static void test_BCryptGenerateSymmetricKey(void) - static void test_BCryptEncrypt(void) - { - static UCHAR nonce[] = -- {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60}; -+ {0x10,0x20,0x30,0x40,0x50,0x60,0x10,0x20,0x30,0x40,0x50,0x60}; -+ static UCHAR auth_data[] = -+ {0x60,0x50,0x40,0x30,0x20,0x10,0x60,0x50,0x40,0x30,0x20,0x10}; - static UCHAR secret[] = - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}; - static UCHAR iv[] = -@@ -636,6 +638,8 @@ static void test_BCryptEncrypt(void) - {0x89,0xb3,0x92,0x00,0x39,0x20,0x09,0xb4,0x6a,0xd6,0xaf,0xca,0x4b,0x5b,0xfd,0xd0}; - static UCHAR expected_tag2[] = - {0x9a,0x92,0x32,0x2c,0x61,0x2a,0xae,0xef,0x66,0x2a,0xfb,0x55,0xe9,0x48,0xdf,0xbd}; -+ static UCHAR expected_tag3[] = -+ {0x17,0x9d,0xc0,0x7a,0xf0,0xcf,0xaa,0xd5,0x1c,0x11,0xc4,0x4b,0xd6,0xa3,0x3e,0x77}; - BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO auth_info; - UCHAR *buf, ciphertext[48], ivbuf[16], tag[16]; - BCRYPT_AUTH_TAG_LENGTHS_STRUCT tag_length; -@@ -809,6 +813,24 @@ static void test_BCryptEncrypt(void) - for (i = 0; i < 16; i++) - ok(tag[i] == expected_tag2[i], "%u: %02x != %02x\n", i, tag[i], expected_tag2[i]); - -+ /* test with auth data */ -+ auth_info.pbAuthData = auth_data; -+ auth_info.cbAuthData = sizeof(auth_data); -+ -+ size = 0; -+ memcpy(ivbuf, iv, sizeof(iv)); -+ memset(ciphertext, 0xff, sizeof(ciphertext)); -+ memset(tag, 0xff, sizeof(tag)); -+ ret = pBCryptEncrypt(key, data2, 32, &auth_info, ivbuf, 16, ciphertext, 32, &size, 0); -+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret); -+ ok(size == 32, "got %u\n", size); -+ ok(!memcmp(ciphertext, expected4, sizeof(expected4)), "wrong data\n"); -+ ok(!memcmp(tag, expected_tag3, sizeof(expected_tag3)), "wrong tag\n"); -+ for (i = 0; i < 32; i++) -+ ok(ciphertext[i] == expected4[i], "%u: %02x != %02x\n", i, ciphertext[i], expected4[i]); -+ for (i = 0; i < 16; i++) -+ ok(tag[i] == expected_tag3[i], "%u: %02x != %02x\n", i, tag[i], expected_tag3[i]); -+ - /* test with padding */ - memcpy(ivbuf, iv, sizeof(iv)); - memset(ciphertext, 0, sizeof(ciphertext)); -@@ -831,7 +853,9 @@ static void test_BCryptEncrypt(void) - static void test_BCryptDecrypt(void) - { - static UCHAR nonce[] = -- {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60}; -+ {0x10,0x20,0x30,0x40,0x50,0x60,0x10,0x20,0x30,0x40,0x50,0x60}; -+ static UCHAR auth_data[] = -+ {0x60,0x50,0x40,0x30,0x20,0x10,0x60,0x50,0x40,0x30,0x20,0x10}; - static UCHAR secret[] = - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}; - static UCHAR iv[] = -@@ -858,6 +882,8 @@ static void test_BCryptDecrypt(void) - 0x86,0x64,0xc3,0xfe,0xa3,0x07,0x61,0xf8,0x16,0xc9,0x78,0x7f,0xe7,0xb1,0xc4,0x94}; - static UCHAR tag[] = - {0x89,0xb3,0x92,0x00,0x39,0x20,0x09,0xb4,0x6a,0xd6,0xaf,0xca,0x4b,0x5b,0xfd,0xd0}; -+ static UCHAR tag2[] = -+ {0x17,0x9d,0xc0,0x7a,0xf0,0xcf,0xaa,0xd5,0x1c,0x11,0xc4,0x4b,0xd6,0xa3,0x3e,0x77}; - BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO auth_info; - BCRYPT_KEY_LENGTHS_STRUCT key_lengths; - BCRYPT_ALG_HANDLE aes; -@@ -1007,6 +1033,20 @@ static void test_BCryptDecrypt(void) - ok(size == 32, "got %u\n", size); - ok(!memcmp(plaintext, expected3, sizeof(expected3)), "wrong data\n"); - -+ /* test with auuth data */ -+ auth_info.pbAuthData = auth_data; -+ auth_info.cbAuthData = sizeof(auth_data); -+ auth_info.pbTag = tag2; -+ auth_info.cbTag = sizeof(tag2); -+ -+ size = 0; -+ memcpy(ivbuf, iv, sizeof(iv)); -+ memset(plaintext, 0, sizeof(plaintext)); -+ ret = pBCryptDecrypt(key, ciphertext4, 32, &auth_info, ivbuf, 16, plaintext, 32, &size, 0); -+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret); -+ ok(size == 32, "got %u\n", size); -+ ok(!memcmp(plaintext, expected3, sizeof(expected3)), "wrong data\n"); -+ - /* test with wrong tag */ - memcpy(ivbuf, iv, sizeof(iv)); - auth_info.pbTag = iv; /* wrong tag */ --- -2.16.1 - diff --git a/patches/bcrypt-Improvements/0025-bcrypt-Avoid-crash-in-tests-when-compiling-without-g.patch b/patches/bcrypt-Improvements/0025-bcrypt-Avoid-crash-in-tests-when-compiling-without-g.patch index c7ffade5..a99f063f 100644 --- a/patches/bcrypt-Improvements/0025-bcrypt-Avoid-crash-in-tests-when-compiling-without-g.patch +++ b/patches/bcrypt-Improvements/0025-bcrypt-Avoid-crash-in-tests-when-compiling-without-g.patch @@ -1,54 +1,39 @@ -From 0fbdf39c6714848c3186882ef01111c08174afa1 Mon Sep 17 00:00:00 2001 +From facd838db32bcb086711fda48a7ae9d5419a2d3c Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 26 Dec 2016 16:20:57 +0100 -Subject: [PATCH 25/36] bcrypt: Avoid crash in tests when compiling without - gnutls support. +Subject: [PATCH] bcrypt: Avoid crash in tests when compiling without gnutls + support. --- - dlls/bcrypt/bcrypt_main.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) + dlls/bcrypt/bcrypt_main.c | 5 +++++ + 1 file changed, 5 insertions(+) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index da9cb02..1839edc 100644 +index e05e94c..81dce08 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c -@@ -1344,12 +1344,19 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_ +@@ -1293,9 +1293,12 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_ + TRACE( "%p, %p, %p, %u, %p, %u, %08x\n", algorithm, handle, object, object_len, secret, secret_len, flags ); + if (!alg || alg->hdr.magic != MAGIC_ALG) return STATUS_INVALID_HANDLE; ++ if (!handle) return STATUS_INVALID_PARAMETER; if (object) FIXME( "ignoring object buffer\n" ); -- if (!(key = heap_alloc( sizeof(*key) ))) return STATUS_NO_MEMORY; -+ -+ if (!(key = heap_alloc( sizeof(*key) ))) -+ { -+ *handle = NULL; -+ return STATUS_NO_MEMORY; -+ } ++ *handle = NULL; + if (!(key = heap_alloc( sizeof(*key) ))) return STATUS_NO_MEMORY; + key->hdr.magic = MAGIC_KEY; if ((status = key_init( key, alg, secret, secret_len ))) - { - heap_free( key ); -+ *handle = NULL; - return status; - } +@@ -1383,6 +1386,8 @@ NTSTATUS WINAPI BCryptDuplicateKey( BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE -@@ -1432,11 +1439,15 @@ NTSTATUS WINAPI BCryptDuplicateKey( BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE if (!key_orig || key_orig->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE; if (!handle_copy) return STATUS_INVALID_PARAMETER; - if (!(key_copy = HeapAlloc( GetProcessHeap(), 0, sizeof(*key_copy) ))) -+ { -+ *handle_copy = NULL; - return STATUS_NO_MEMORY; -+ } ++ ++ *handle_copy = NULL; + if (!(key_copy = heap_alloc( sizeof(*key_copy) ))) return STATUS_NO_MEMORY; if ((status = key_duplicate( key_orig, key_copy ))) - { - HeapFree( GetProcessHeap(), 0, key_copy ); -+ *handle_copy = NULL; - return status; - } - -- -2.7.4 +1.9.1 diff --git a/patches/bcrypt-Improvements/0027-bcrypt-Fix-BCryptEncrypt-with-AES_GCM-and-no-input-a.patch b/patches/bcrypt-Improvements/0027-bcrypt-Fix-BCryptEncrypt-with-AES_GCM-and-no-input-a.patch deleted file mode 100644 index 1f57cbb5..00000000 --- a/patches/bcrypt-Improvements/0027-bcrypt-Fix-BCryptEncrypt-with-AES_GCM-and-no-input-a.patch +++ /dev/null @@ -1,64 +0,0 @@ -From ed34c7953eea6419df4fcde8b65ecfab6da2f476 Mon Sep 17 00:00:00 2001 -From: Andrew Wesie -Date: Mon, 1 May 2017 22:57:43 -0500 -Subject: [PATCH 27/36] bcrypt: Fix BCryptEncrypt with AES_GCM and no input and - no output. - -Signed-off-by: Andrew Wesie ---- - dlls/bcrypt/bcrypt_main.c | 2 +- - dlls/bcrypt/tests/bcrypt.c | 18 ++++++++++++++++++ - 2 files changed, 19 insertions(+), 1 deletion(-) - -diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index cbd38f57d6..f19a90e6bf 100644 ---- a/dlls/bcrypt/bcrypt_main.c -+++ b/dlls/bcrypt/bcrypt_main.c -@@ -1475,7 +1475,7 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp - - *ret_len = input_len; - if (flags & BCRYPT_BLOCK_PADDING) return STATUS_INVALID_PARAMETER; -- if (!output) return STATUS_SUCCESS; -+ if (input && !output) return STATUS_SUCCESS; - if (output_len < *ret_len) return STATUS_BUFFER_TOO_SMALL; - - if (auth_info->pbAuthData && (status = key_set_auth_data( key, auth_info->pbAuthData, auth_info->cbAuthData ))) -diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c -index ade8058724..159be44714 100644 ---- a/dlls/bcrypt/tests/bcrypt.c -+++ b/dlls/bcrypt/tests/bcrypt.c -@@ -649,6 +649,9 @@ static void test_BCryptEncrypt(void) - {0x9a,0x92,0x32,0x2c,0x61,0x2a,0xae,0xef,0x66,0x2a,0xfb,0x55,0xe9,0x48,0xdf,0xbd}; - static UCHAR expected_tag3[] = - {0x17,0x9d,0xc0,0x7a,0xf0,0xcf,0xaa,0xd5,0x1c,0x11,0xc4,0x4b,0xd6,0xa3,0x3e,0x77}; -+ static UCHAR expected_tag4[] = -+ {0x4c,0x42,0x83,0x9e,0x8d,0x40,0xf1,0x19,0xd6,0x2b,0x1c,0x66,0x03,0x2b,0x39,0x63}; -+ - BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO auth_info; - UCHAR *buf, ciphertext[48], ivbuf[16], tag[16]; - BCRYPT_AUTH_TAG_LENGTHS_STRUCT tag_length; -@@ -840,6 +843,21 @@ static void test_BCryptEncrypt(void) - for (i = 0; i < 16; i++) - ok(tag[i] == expected_tag3[i], "%u: %02x != %02x\n", i, tag[i], expected_tag3[i]); - -+ memset(tag, 0xff, sizeof(tag)); -+ ret = pBCryptEncrypt(key, data2, 0, &auth_info, ivbuf, 16, NULL, 0, &size, 0); -+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret); -+ ok(size == 0, "got %u\n", size); -+ for (i = 0; i < 16; i++) -+ ok(tag[i] == 0xff, "%u: %02x != %02x\n", i, tag[i], 0xff); -+ -+ memset(tag, 0xff, sizeof(tag)); -+ ret = pBCryptEncrypt(key, NULL, 0, &auth_info, ivbuf, 16, NULL, 0, &size, 0); -+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret); -+ ok(size == 0, "got %u\n", size); -+ ok(!memcmp(tag, expected_tag4, sizeof(expected_tag4)), "wrong tag\n"); -+ for (i = 0; i < 16; i++) -+ ok(tag[i] == expected_tag4[i], "%u: %02x != %02x\n", i, tag[i], expected_tag4[i]); -+ - /* test with padding */ - memcpy(ivbuf, iv, sizeof(iv)); - memset(ciphertext, 0, sizeof(ciphertext)); --- -2.16.1 - diff --git a/patches/bcrypt-Improvements/0030-bcrypt-Preparation-for-asymmetric-keys.patch b/patches/bcrypt-Improvements/0030-bcrypt-Preparation-for-asymmetric-keys.patch index 6c438a35..1c61834a 100644 --- a/patches/bcrypt-Improvements/0030-bcrypt-Preparation-for-asymmetric-keys.patch +++ b/patches/bcrypt-Improvements/0030-bcrypt-Preparation-for-asymmetric-keys.patch @@ -1,25 +1,16 @@ -From 70501f83e7effe724e09263791e99c494ecfbe3d Mon Sep 17 00:00:00 2001 +From b3c2814f36f027657feb2ceb6abf1142ab7062b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 29 Sep 2017 18:31:55 +0200 Subject: [PATCH] bcrypt: Preparation for asymmetric keys. --- - dlls/bcrypt/bcrypt_main.c | 367 ++++++++++++++++++++++++++++------------------ - 1 file changed, 226 insertions(+), 141 deletions(-) + dlls/bcrypt/bcrypt_main.c | 346 +++++++++++++++++++++++++++++----------------- + 1 file changed, 217 insertions(+), 129 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 2e6ed8b..0791cf3 100644 +index c20abb8..2dd839f 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c -@@ -19,7 +19,7 @@ - - #include "config.h" - #include "wine/port.h" -- -+#undef HAVE_GNUTLS_CIPHER_INIT - #include - #ifdef HAVE_COMMONCRYPTO_COMMONCRYPTOR_H - #include @@ -238,16 +238,17 @@ static const struct { ULONG hash_length; ULONG block_bits; @@ -141,7 +132,7 @@ index 2e6ed8b..0791cf3 100644 static ULONG get_block_size( struct algorithm *alg ) { ULONG ret = 0, size = sizeof(ret); -@@ -899,25 +947,43 @@ static NTSTATUS key_export( struct key *key, const WCHAR *type, UCHAR *output, U +@@ -900,15 +948,15 @@ static NTSTATUS key_export( struct key *key, const WCHAR *type, UCHAR *output, U if (!strcmpW( type, BCRYPT_KEY_DATA_BLOB )) { BCRYPT_KEY_DATA_BLOB_HEADER *header = (BCRYPT_KEY_DATA_BLOB_HEADER *)output; @@ -160,27 +151,42 @@ index 2e6ed8b..0791cf3 100644 return STATUS_SUCCESS; } - FIXME( "unsupported key type %s\n", debugstr_w(type) ); - return STATUS_NOT_IMPLEMENTED; +@@ -920,23 +968,33 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) + { + UCHAR *buffer; + +- if (!(buffer = heap_alloc( key_orig->secret_len ))) return STATUS_NO_MEMORY; +- memcpy( buffer, key_orig->secret, key_orig->secret_len ); ++ key_copy->hdr = key_orig->hdr; ++ key_copy->alg_id = key_orig->alg_id; + +- memset( key_copy, 0, sizeof(*key_copy) ); +- key_copy->hdr = key_orig->hdr; +- key_copy->alg_id = key_orig->alg_id; +- key_copy->mode = key_orig->mode; +- key_copy->block_size = key_orig->block_size; +- key_copy->secret = buffer; +- key_copy->secret_len = key_orig->secret_len; ++ if (key_is_symmetric(key_orig)) ++ { ++ if (!(buffer = heap_alloc( key_orig->u.s.secret_len ))) return STATUS_NO_MEMORY; ++ memcpy( buffer, key_orig->u.s.secret, key_orig->u.s.secret_len ); ++ ++ memset( key_copy, 0, sizeof(*key_copy) ); ++ key_copy->hdr = key_orig->hdr; ++ key_copy->alg_id = key_orig->alg_id; ++ key_copy->u.s.mode = key_orig->u.s.mode; ++ key_copy->u.s.block_size = key_orig->u.s.block_size; ++ key_copy->u.s.secret = buffer; ++ key_copy->u.s.secret_len = key_orig->u.s.secret_len; ++ } ++ else ++ { ++ return STATUS_NOT_IMPLEMENTED; ++ } + + return STATUS_SUCCESS; } -+#else -+static inline BOOL key_is_symmetric( struct key *key ) -+{ -+ ERR( "support for keys not available at build time\n" ); -+ return FALSE; -+} -+ -+static NTSTATUS key_symmetric_get_mode( struct key *key, enum mode_id *mode ) -+{ -+ *mode = key->u.s.mode; -+ return STATUS_SUCCESS; -+} -+ -+static NTSTATUS key_symmetric_get_blocksize( struct key *key, ULONG *size ) -+{ -+ ERR( "support for keys not available at build time\n" ); -+ return STATUS_NOT_IMPLEMENTED; -+} #endif #if defined(HAVE_GNUTLS_CIPHER_INIT) && !defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H) @@ -189,7 +195,7 @@ index 2e6ed8b..0791cf3 100644 { UCHAR *buffer; -@@ -933,15 +999,15 @@ static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *s +@@ -952,15 +1010,15 @@ static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *s return STATUS_NOT_SUPPORTED; } @@ -211,7 +217,7 @@ index 2e6ed8b..0791cf3 100644 return STATUS_SUCCESS; } -@@ -952,17 +1018,17 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val +@@ -971,17 +1029,17 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val { if (!strncmpW( (WCHAR *)value, BCRYPT_CHAIN_MODE_ECB, size )) { @@ -232,41 +238,7 @@ index 2e6ed8b..0791cf3 100644 return STATUS_SUCCESS; } else -@@ -980,16 +1046,24 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) - { - UCHAR *buffer; - -- if (!(buffer = HeapAlloc( GetProcessHeap(), 0, key_orig->secret_len ))) return STATUS_NO_MEMORY; -- memcpy( buffer, key_orig->secret, key_orig->secret_len ); -+ key_copy->hdr = key_orig->hdr; -+ key_copy->alg_id = key_orig->alg_id; - -- key_copy->hdr = key_orig->hdr; -- key_copy->alg_id = key_orig->alg_id; -- key_copy->mode = key_orig->mode; -- key_copy->block_size = key_orig->block_size; -- key_copy->handle = NULL; -- key_copy->secret = buffer; -- key_copy->secret_len = key_orig->secret_len; -+ if (key_is_symmetric(key_orig)) -+ { -+ if (!(buffer = HeapAlloc( GetProcessHeap(), 0, key_orig->u.s.secret_len ))) return STATUS_NO_MEMORY; -+ memcpy( buffer, key_orig->u.s.secret, key_orig->u.s.secret_len ); -+ -+ key_copy->u.s.mode = key_orig->u.s.mode; -+ key_copy->u.s.block_size = key_orig->u.s.block_size; -+ key_copy->u.s.handle = NULL; -+ key_copy->u.s.secret = buffer; -+ key_copy->u.s.secret_len = key_orig->u.s.secret_len; -+ } -+ else -+ { -+ return STATUS_NOT_IMPLEMENTED; -+ } - - return STATUS_SUCCESS; - } -@@ -1000,22 +1074,22 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key ) +@@ -1001,22 +1059,22 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key ) { case ALG_ID_AES: WARN( "handle block size\n" ); @@ -296,7 +268,7 @@ index 2e6ed8b..0791cf3 100644 return GNUTLS_CIPHER_UNKNOWN; default: FIXME( "algorithm %u not supported\n", key->alg_id ); -@@ -1023,17 +1097,17 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key ) +@@ -1024,17 +1082,17 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key ) } } @@ -318,7 +290,7 @@ index 2e6ed8b..0791cf3 100644 } if ((cipher = get_gnutls_cipher( key )) == GNUTLS_CIPHER_UNKNOWN) -@@ -1045,12 +1119,12 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len ) +@@ -1046,12 +1104,12 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len ) iv_len = sizeof(zero_iv); } @@ -334,7 +306,7 @@ index 2e6ed8b..0791cf3 100644 { pgnutls_perror( ret ); return STATUS_INTERNAL_ERROR; -@@ -1059,11 +1133,11 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len ) +@@ -1060,11 +1118,11 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len ) return STATUS_SUCCESS; } @@ -348,7 +320,7 @@ index 2e6ed8b..0791cf3 100644 { pgnutls_perror( ret ); return STATUS_INTERNAL_ERROR; -@@ -1072,12 +1146,12 @@ static NTSTATUS key_set_auth_data( struct key *key, UCHAR *auth_data, ULONG len +@@ -1073,12 +1131,12 @@ static NTSTATUS key_set_auth_data( struct key *key, UCHAR *auth_data, ULONG len return STATUS_SUCCESS; } @@ -363,7 +335,7 @@ index 2e6ed8b..0791cf3 100644 { pgnutls_perror( ret ); return STATUS_INTERNAL_ERROR; -@@ -1091,7 +1165,7 @@ static NTSTATUS key_decrypt( struct key *key, const UCHAR *input, ULONG input_le +@@ -1092,7 +1150,7 @@ static NTSTATUS key_decrypt( struct key *key, const UCHAR *input, ULONG input_le { int ret; @@ -372,7 +344,7 @@ index 2e6ed8b..0791cf3 100644 { pgnutls_perror( ret ); return STATUS_INTERNAL_ERROR; -@@ -1104,7 +1178,7 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len ) +@@ -1105,7 +1163,7 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len ) { int ret; @@ -381,7 +353,7 @@ index 2e6ed8b..0791cf3 100644 { pgnutls_perror( ret ); return STATUS_INTERNAL_ERROR; -@@ -1115,13 +1189,13 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len ) +@@ -1116,13 +1174,13 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len ) static NTSTATUS key_destroy( struct key *key ) { @@ -398,7 +370,7 @@ index 2e6ed8b..0791cf3 100644 { UCHAR *buffer; -@@ -1143,16 +1217,16 @@ static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *s +@@ -1144,16 +1202,16 @@ static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *s return STATUS_NOT_SUPPORTED; } @@ -422,33 +394,8 @@ index 2e6ed8b..0791cf3 100644 return STATUS_SUCCESS; } -@@ -1167,66 +1241,66 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) - { - UCHAR *buffer; - -- if (!(buffer = HeapAlloc( GetProcessHeap(), 0, key_orig->secret_len ))) return STATUS_NO_MEMORY; -- memcpy( buffer, key_orig->secret, key_orig->secret_len ); -+ if (!(buffer = HeapAlloc( GetProcessHeap(), 0, key_orig->u.s.secret_len ))) return STATUS_NO_MEMORY; -+ memcpy( buffer, key_orig->u.s.secret, key_orig->u.s.secret_len ); - -- key_copy->hdr = key_orig->hdr; -- key_copy->alg_id = key_orig->alg_id; -- key_copy->mode = key_orig->mode; -- key_copy->block_size = key_orig->block_size; -- key_copy->ref_encrypt = NULL; -- key_copy->ref_decrypt = NULL; -- key_copy->secret = buffer; -- key_copy->secret_len = key_orig->secret_len; -+ key_copy->hdr = key_orig->hdr; -+ key_copy->alg_id = key_orig->alg_id; -+ key_copy->u.s.mode = key_orig->u.s.mode; -+ key_copy->u.s.block_size = key_orig->u.s.block_size; -+ key_copy->u.s.ref_encrypt = NULL; -+ key_copy->u.s.ref_decrypt = NULL; -+ key_copy->u.s.secret = buffer; -+ key_copy->u.s.secret_len = key_orig->u.s.secret_len; - - return STATUS_SUCCESS; +@@ -1164,51 +1222,51 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val + return STATUS_NOT_IMPLEMENTED; } -static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len ) @@ -513,7 +460,7 @@ index 2e6ed8b..0791cf3 100644 { WARN( "CCCryptorUpdate failed %d\n", status ); return STATUS_INTERNAL_ERROR; -@@ -1240,7 +1314,7 @@ static NTSTATUS key_decrypt( struct key *key, const UCHAR *input, ULONG input_le +@@ -1222,7 +1280,7 @@ static NTSTATUS key_decrypt( struct key *key, const UCHAR *input, ULONG input_le { CCCryptorStatus status; @@ -522,7 +469,7 @@ index 2e6ed8b..0791cf3 100644 { WARN( "CCCryptorUpdate failed %d\n", status ); return STATUS_INTERNAL_ERROR; -@@ -1257,14 +1331,14 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len ) +@@ -1239,14 +1297,14 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len ) static NTSTATUS key_destroy( struct key *key ) { @@ -541,11 +488,7 @@ index 2e6ed8b..0791cf3 100644 { ERR( "support for keys not available at build time\n" ); return STATUS_NOT_IMPLEMENTED; -@@ -1279,23 +1353,22 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val - static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) - { - ERR( "support for keys not available at build time\n" ); -- key_copy->mode = MODE_ID_CBC; +@@ -1264,19 +1322,19 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) return STATUS_NOT_IMPLEMENTED; } @@ -568,7 +511,32 @@ index 2e6ed8b..0791cf3 100644 ULONG output_len ) { ERR( "support for keys not available at build time\n" ); -@@ -1350,7 +1423,7 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_ +@@ -1307,6 +1365,24 @@ static NTSTATUS key_export( struct key *key, const WCHAR *type, UCHAR *output, U + ERR( "support for keys not available at build time\n" ); + return STATUS_NOT_IMPLEMENTED; + } ++ ++static inline BOOL key_is_symmetric( struct key *key ) ++{ ++ ERR( "support for keys not available at build time\n" ); ++ return FALSE; ++} ++ ++static NTSTATUS key_symmetric_get_mode( struct key *key, enum mode_id *mode ) ++{ ++ *mode = key->u.s.mode; ++ return STATUS_SUCCESS; ++} ++ ++static NTSTATUS key_symmetric_get_blocksize( struct key *key, ULONG *size ) ++{ ++ ERR( "support for keys not available at build time\n" ); ++ return STATUS_NOT_IMPLEMENTED; ++} + #endif + + NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HANDLE *handle, +@@ -1328,7 +1404,7 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_ key->hdr.magic = MAGIC_KEY; @@ -576,8 +544,8 @@ index 2e6ed8b..0791cf3 100644 + if ((status = key_symmetric_init( key, alg, secret, secret_len ))) { heap_free( key ); - *handle = NULL; -@@ -1469,19 +1542,30 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp + return status; +@@ -1444,19 +1520,30 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp struct key *key = handle; ULONG bytes_left = input_len; UCHAR *buf, *src, *dst; @@ -609,7 +577,7 @@ index 2e6ed8b..0791cf3 100644 { BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO *auth_info = padding; -@@ -1492,7 +1576,7 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp +@@ -1467,7 +1554,7 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp if (auth_info->dwFlags & BCRYPT_AUTH_MODE_CHAIN_CALLS_FLAG) FIXME( "call chaining not implemented\n" ); @@ -618,7 +586,7 @@ index 2e6ed8b..0791cf3 100644 return status; *ret_len = input_len; -@@ -1500,46 +1584,47 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp +@@ -1475,46 +1562,47 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp if (input && !output) return STATUS_SUCCESS; if (output_len < *ret_len) return STATUS_BUFFER_TOO_SMALL; @@ -681,7 +649,7 @@ index 2e6ed8b..0791cf3 100644 heap_free( buf ); } -@@ -1565,7 +1650,7 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp +@@ -1540,7 +1628,7 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp return STATUS_NOT_IMPLEMENTED; } @@ -690,7 +658,7 @@ index 2e6ed8b..0791cf3 100644 { BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO *auth_info = padding; UCHAR tag[16]; -@@ -1575,7 +1660,7 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp +@@ -1550,7 +1638,7 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp if (!auth_info->pbTag) return STATUS_INVALID_PARAMETER; if (auth_info->cbTag < 12 || auth_info->cbTag > 16) return STATUS_INVALID_PARAMETER; @@ -699,7 +667,7 @@ index 2e6ed8b..0791cf3 100644 return status; *ret_len = input_len; -@@ -1583,7 +1668,7 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp +@@ -1558,7 +1646,7 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp if (!output) return STATUS_SUCCESS; if (output_len < *ret_len) return STATUS_BUFFER_TOO_SMALL; @@ -708,7 +676,7 @@ index 2e6ed8b..0791cf3 100644 return status; if ((status = key_decrypt( key, input, input_len, output, output_len ))) return status; -@@ -1596,44 +1681,44 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp +@@ -1571,44 +1659,44 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp return STATUS_SUCCESS; } diff --git a/patches/bcrypt-Improvements/0033-bcrypt-Implement-importing-of-ecdsa-keys.patch b/patches/bcrypt-Improvements/0033-bcrypt-Implement-importing-of-ecdsa-keys.patch index 1118a5bf..cbc3436a 100644 --- a/patches/bcrypt-Improvements/0033-bcrypt-Implement-importing-of-ecdsa-keys.patch +++ b/patches/bcrypt-Improvements/0033-bcrypt-Implement-importing-of-ecdsa-keys.patch @@ -1,14 +1,14 @@ -From a1c152388920e9a6b3cafc840df1e28822f52180 Mon Sep 17 00:00:00 2001 +From 6879933e1a7630c2b8d22f2c0e0d2519c8416d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 29 Sep 2017 19:18:58 +0200 Subject: [PATCH] bcrypt: Implement importing of ecdsa keys. --- dlls/bcrypt/bcrypt.spec | 4 +- - dlls/bcrypt/bcrypt_main.c | 168 +++++++++++++++++++++++++++++++++++++++++++-- + dlls/bcrypt/bcrypt_main.c | 160 +++++++++++++++++++++++++++++++++++++++++++-- dlls/bcrypt/tests/bcrypt.c | 6 +- include/bcrypt.h | 2 + - 4 files changed, 170 insertions(+), 10 deletions(-) + 4 files changed, 162 insertions(+), 10 deletions(-) diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec index 28c2394..78824d7 100644 @@ -33,7 +33,7 @@ index 28c2394..78824d7 100644 @ stub GetCipherInterface @ stub GetHashInterface diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 0791cf3..c1a5114 100644 +index 2dd839f..b1736fa 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -220,7 +220,9 @@ enum alg_id @@ -109,23 +109,21 @@ index 0791cf3..c1a5114 100644 } u; }; #else -@@ -969,6 +989,12 @@ static inline BOOL key_is_symmetric( struct key *key ) - return FALSE; - } - -+static inline BOOL key_is_asymmetric( struct key *key ) -+{ -+ ERR( "support for keys not available at build time\n" ); -+ return FALSE; -+} +@@ -986,11 +1006,42 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) + } + else + { +- return STATUS_NOT_IMPLEMENTED; ++ if (!(buffer = heap_alloc( key_orig->u.a.pubkey_len ))) return STATUS_NO_MEMORY; ++ memcpy( buffer, key_orig->u.a.pubkey, key_orig->u.a.pubkey_len ); + - static NTSTATUS key_symmetric_get_mode( struct key *key, enum mode_id *mode ) - { - *mode = key->u.s.mode; -@@ -1042,6 +1068,33 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val - return STATUS_NOT_IMPLEMENTED; - } ++ key_copy->u.a.pubkey = buffer; ++ key_copy->u.a.pubkey_len = key_orig->u.a.pubkey_len; + } + return STATUS_SUCCESS; + } ++ +static NTSTATUS key_asymmetric_init( struct key *key, struct algorithm *alg, const UCHAR *pubkey, ULONG pubkey_len ) +{ + UCHAR *buffer; @@ -152,26 +150,10 @@ index 0791cf3..c1a5114 100644 + + return STATUS_SUCCESS; +} -+ - static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) - { - UCHAR *buffer; -@@ -1062,7 +1115,13 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) - } - else - { -- return STATUS_NOT_IMPLEMENTED; -+ if (!(buffer = HeapAlloc( GetProcessHeap(), 0, key_orig->u.a.pubkey_len ))) return STATUS_NO_MEMORY; -+ memcpy( buffer, key_orig->u.a.pubkey, key_orig->u.a.pubkey_len ); -+ -+ key_copy->u.a.pubkey = buffer; -+ key_copy->u.a.pubkey_len = key_orig->u.a.pubkey_len; -+ -+ return STATUS_SUCCESS; - } + #endif - return STATUS_SUCCESS; -@@ -1189,8 +1248,13 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len ) + #if defined(HAVE_GNUTLS_CIPHER_INIT) && !defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H) +@@ -1174,8 +1225,13 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len ) static NTSTATUS key_destroy( struct key *key ) { @@ -187,7 +169,7 @@ index 0791cf3..c1a5114 100644 heap_free( key ); return STATUS_SUCCESS; } -@@ -1237,6 +1301,12 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val +@@ -1310,6 +1366,12 @@ static NTSTATUS key_symmetric_init( struct key *key, struct algorithm *alg, cons return STATUS_NOT_IMPLEMENTED; } @@ -197,23 +179,23 @@ index 0791cf3..c1a5114 100644 + return STATUS_NOT_IMPLEMENTED; +} + - static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) - { - UCHAR *buffer; -@@ -1350,6 +1420,12 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val - return STATUS_NOT_IMPLEMENTED; - } - -+static NTSTATUS key_asymmetric_init( struct key *key, struct algorithm *alg, const UCHAR *pubkey, ULONG pubkey_len ) -+{ -+ ERR( "support for keys not available at build time\n" ); -+ return STATUS_NOT_IMPLEMENTED; -+} -+ - static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) + static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *value, ULONG size, ULONG flags ) { ERR( "support for keys not available at build time\n" ); -@@ -1525,6 +1601,88 @@ NTSTATUS WINAPI BCryptDuplicateKey( BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE +@@ -1372,6 +1434,12 @@ static inline BOOL key_is_symmetric( struct key *key ) + return FALSE; + } + ++static inline BOOL key_is_asymmetric( struct key *key ) ++{ ++ ERR( "support for keys not available at build time\n" ); ++ return FALSE; ++} ++ + static NTSTATUS key_symmetric_get_mode( struct key *key, enum mode_id *mode ) + { + *mode = key->u.s.mode; +@@ -1503,6 +1571,88 @@ NTSTATUS WINAPI BCryptDuplicateKey( BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE return STATUS_SUCCESS; } @@ -267,13 +249,13 @@ index 0791cf3..c1a5114 100644 + if (ecc_blob->cbKey != key_size) + return STATUS_INVALID_PARAMETER; + -+ if (!(key = HeapAlloc( GetProcessHeap(), 0, sizeof(*key) ))) ++ if (!(key = heap_alloc( sizeof(*key) ))) + return STATUS_NO_MEMORY; + + key->hdr.magic = MAGIC_KEY; + if ((status = key_asymmetric_init( key, alg, (BYTE *)(ecc_blob + 1), ecc_blob->cbKey * 2 ))) + { -+ HeapFree( GetProcessHeap(), 0, key ); ++ heap_free( key ); + return status; + } + @@ -303,10 +285,10 @@ index 0791cf3..c1a5114 100644 { struct key *key = handle; diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c -index 22a0ffe..73d3325 100644 +index a262251..d5f08be 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c -@@ -1404,7 +1404,7 @@ static void test_ECDSA(void) +@@ -1419,7 +1419,7 @@ static void test_ECDSA(void) status = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_ECDSA_P256_ALGORITHM, NULL, 0); if (status) { @@ -315,7 +297,7 @@ index 22a0ffe..73d3325 100644 return; } -@@ -1420,10 +1420,10 @@ static void test_ECDSA(void) +@@ -1435,10 +1435,10 @@ static void test_ECDSA(void) ok(!status, "BCryptImportKeyPair failed: %08x\n", status); status = pBCryptVerifySignature(key, NULL, certHash, sizeof(certHash) - 1, certSignature, sizeof(certSignature), 0); diff --git a/patches/bcrypt-Improvements/0037-bcrypt-Store-full-ECCKEY_BLOB-struct-in-BCryptImport.patch b/patches/bcrypt-Improvements/0037-bcrypt-Store-full-ECCKEY_BLOB-struct-in-BCryptImport.patch index 34d7f84f..65922b09 100644 --- a/patches/bcrypt-Improvements/0037-bcrypt-Store-full-ECCKEY_BLOB-struct-in-BCryptImport.patch +++ b/patches/bcrypt-Improvements/0037-bcrypt-Store-full-ECCKEY_BLOB-struct-in-BCryptImport.patch @@ -1,4 +1,4 @@ -From f986cac5710ee6bbf96aae2cdefea4f8eb49653e Mon Sep 17 00:00:00 2001 +From 8a9bfbd2670fb200c280a73addc0fb012f5576ce Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 14 Oct 2017 22:44:13 +0200 Subject: [PATCH] bcrypt: Store full ECCKEY_BLOB struct in BCryptImportKeyPair. @@ -8,10 +8,10 @@ Subject: [PATCH] bcrypt: Store full ECCKEY_BLOB struct in BCryptImportKeyPair. 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index f858bec..c2300b4 100644 +index 131082a..9443d04 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c -@@ -1428,6 +1428,7 @@ static void buffer_append_asn1_r_s( struct buffer *buffer, BYTE *r, DWORD r_len, +@@ -1405,6 +1405,7 @@ static void buffer_append_asn1_r_s( struct buffer *buffer, BYTE *r, DWORD r_len, static NTSTATUS import_gnutls_pubkey_ecc( struct key *key, gnutls_pubkey_t *gnutls_key ) { @@ -19,7 +19,7 @@ index f858bec..c2300b4 100644 gnutls_ecc_curve_t curve; gnutls_datum_t x, y; int ret; -@@ -1448,10 +1449,11 @@ static NTSTATUS import_gnutls_pubkey_ecc( struct key *key, gnutls_pubkey_t *gnut +@@ -1425,10 +1426,11 @@ static NTSTATUS import_gnutls_pubkey_ecc( struct key *key, gnutls_pubkey_t *gnut return STATUS_INTERNAL_ERROR; } @@ -35,14 +35,14 @@ index f858bec..c2300b4 100644 if ((ret = pgnutls_pubkey_import_ecc_raw( *gnutls_key, curve, &x, &y ))) { -@@ -2062,7 +2064,7 @@ NTSTATUS WINAPI BCryptImportKeyPair( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HAN +@@ -2032,7 +2034,7 @@ NTSTATUS WINAPI BCryptImportKeyPair( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HAN return STATUS_NO_MEMORY; key->hdr.magic = MAGIC_KEY; - if ((status = key_asymmetric_init( key, alg, (BYTE *)(ecc_blob + 1), ecc_blob->cbKey * 2 ))) + if ((status = key_asymmetric_init( key, alg, (BYTE *)ecc_blob, sizeof(*ecc_blob) + ecc_blob->cbKey * 2 ))) { - HeapFree( GetProcessHeap(), 0, key ); + heap_free( key ); return status; -- 1.9.1 diff --git a/patches/d3dx9_36-FindNextValidTechnique/0001-d3dx9_36-Implement-ID3DXEffect_FindNextValidTechniqu.patch b/patches/d3dx9_36-FindNextValidTechnique/0001-d3dx9_36-Implement-ID3DXEffect_FindNextValidTechniqu.patch deleted file mode 100644 index a0466ab7..00000000 --- a/patches/d3dx9_36-FindNextValidTechnique/0001-d3dx9_36-Implement-ID3DXEffect_FindNextValidTechniqu.patch +++ /dev/null @@ -1,141 +0,0 @@ -From f462b95015bf3ec86638dfad41ee219b2384f131 Mon Sep 17 00:00:00 2001 -From: Christian Costa -Date: Fri, 19 Dec 2014 22:31:46 +0100 -Subject: [PATCH] d3dx9_36: Implement ID3DXEffect_FindNextValidTechnique + add - tests. - ---- - dlls/d3dx9_36/effect.c | 34 ++++++++++++++++++++++--- - dlls/d3dx9_36/tests/effect.c | 60 ++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 91 insertions(+), 3 deletions(-) - -diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c -index 5160f3a..707c52f 100644 ---- a/dlls/d3dx9_36/effect.c -+++ b/dlls/d3dx9_36/effect.c -@@ -3984,13 +3984,41 @@ done: - return ret; - } - --static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect* iface, D3DXHANDLE technique, D3DXHANDLE* next_technique) -+static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect *iface, -+ D3DXHANDLE technique, D3DXHANDLE *next_technique) - { - struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface); -+ struct d3dx9_base_effect *base_effect = &This->base_effect; -+ UINT i = 0; - -- FIXME("(%p)->(%p, %p): stub\n", This, technique, next_technique); -+ TRACE("iface %p, technique %p, next_technique %p\n", iface, technique, next_technique); - -- return E_NOTIMPL; -+ if (!next_technique) -+ return D3DERR_INVALIDCALL; -+ -+ if (technique) -+ { -+ for (; i < base_effect->technique_count; i++) -+ { -+ if (technique == get_technique_handle(&base_effect->techniques[i])) -+ { -+ i++; /* Go to next technique */ -+ break; -+ } -+ } -+ } -+ -+ for (; i < base_effect->technique_count; i++) -+ { -+ if (SUCCEEDED(iface->lpVtbl->ValidateTechnique(iface, get_technique_handle(&base_effect->techniques[i])))) -+ { -+ *next_technique = get_technique_handle(&base_effect->techniques[i]); -+ return D3D_OK; -+ } -+ } -+ -+ *next_technique = NULL; -+ return S_FALSE; - } - - static BOOL walk_parameter_dep(struct d3dx_parameter *param, walk_parameter_dep_func param_func, -diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c -index ced6c8e..a6fe609 100644 ---- a/dlls/d3dx9_36/tests/effect.c -+++ b/dlls/d3dx9_36/tests/effect.c -@@ -7368,6 +7368,65 @@ if (hr == D3D_OK) - DestroyWindow(window); - } - -+/* -+ * fxc.exe /Tfx_2_0 -+ */ -+#if 0 -+technique t1 { pass p { ZEnable = TRUE; } } -+technique t2 { pass p { ZEnable = FALSE; } } -+#endif -+static const DWORD test_effect_technique_validation_blob[] = -+{ -+0xfeff0901, 0x00000064, 0x00000000, 0x00000001, 0x00000002, 0x00000002, 0x00000000, 0x00000000, -+0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x00000070, 0x00000003, 0x00003174, 0x00000000, -+0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002, -+0x00000070, 0x00000003, 0x00003274, 0x00000000, 0x00000002, 0x00000002, 0x00000001, 0x0000002c, -+0x00000000, 0x00000001, 0x00000024, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000008, -+0x00000004, 0x0000005c, 0x00000000, 0x00000001, 0x00000054, 0x00000000, 0x00000001, 0x00000000, -+0x00000000, 0x00000038, 0x00000034, 0x00000000, 0x00000000 -+}; -+ -+static void test_effect_technique_validation(IDirect3DDevice9 *device) -+{ -+ ID3DXEffect *effect; -+ ULONG count; -+ D3DXHANDLE technique1, technique2, technique; -+ HRESULT hr; -+ -+ hr = D3DXCreateEffect(device, test_effect_technique_validation_blob, -+ sizeof(test_effect_technique_validation_blob), NULL, NULL, 0, NULL, &effect, NULL); -+ ok(hr == D3D_OK, "D3DXCreateEffect failed, got %#x, expected %#x\n", hr, D3D_OK); -+ -+ technique1 = effect->lpVtbl->GetTechniqueByName(effect, "t1"); -+ ok(technique1 != NULL, "Failed to get technique\n"); -+ technique2 = effect->lpVtbl->GetTechniqueByName(effect, "t2"); -+ ok(technique2 != NULL, "Failed to get technique\n"); -+ -+#if 0 /* This crashes on Windows */ -+ hr = effect->lpVtbl->FindNextValidTechnique(effect, (D3DXHANDLE)0xdeadbeef, &technique); -+#endif -+ hr = effect->lpVtbl->FindNextValidTechnique(effect, NULL, NULL); -+ ok(hr == D3DERR_INVALIDCALL, "FindNextValidTechnique, got %#x, expected %#x\n", hr, D3DERR_INVALIDCALL); -+ -+ technique = (D3DXHANDLE)0xdeadbeef; -+ hr = effect->lpVtbl->FindNextValidTechnique(effect, NULL, &technique); -+ ok(hr == D3D_OK, "FindNextValidTechnique failed, got %#x, expected %#x\n", hr, D3D_OK); -+ ok(technique == technique1, "Technique returned %p, expected %p\n", technique, technique1); -+ -+ technique = (D3DXHANDLE)0xdeadbeef; -+ hr = effect->lpVtbl->FindNextValidTechnique(effect, technique1, &technique); -+ ok(hr == D3D_OK, "FindNextValidTechnique failed, got %#x, expected %#x\n", hr, D3D_OK); -+ ok(technique == technique2, "Technique returned %p, expected %p\n", technique, technique2); -+ -+ technique = (D3DXHANDLE)0xdeadbeef; -+ hr = effect->lpVtbl->FindNextValidTechnique(effect, technique2, &technique); -+ ok(hr == S_FALSE, "FindNextValidTechnique, got %#x, expected %#x\n", hr, S_FALSE); -+ ok(technique == NULL, "Technique returned %p, expected %p\n", technique, NULL); -+ -+ count = effect->lpVtbl->Release(effect); -+ ok(!count, "Release failed %u\n", count); -+} -+ - START_TEST(effect) - { - IDirect3DDevice9 *device; -@@ -7396,6 +7455,7 @@ START_TEST(effect) - test_effect_large_address_aware_flag(device); - test_effect_get_pass_desc(device); - test_effect_skip_constants(device); -+ test_effect_technique_validation(device); - - refcount = IDirect3DDevice9_Release(device); - ok(!refcount, "Device has %u references left.\n", refcount); --- -1.9.1 - diff --git a/patches/d3dx9_36-FindNextValidTechnique/definition b/patches/d3dx9_36-FindNextValidTechnique/definition deleted file mode 100644 index 56c1c087..00000000 --- a/patches/d3dx9_36-FindNextValidTechnique/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [34101] Implement ID3DXEffect::FindNextValidTechnique diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 2cdf79dc..ce05b77c 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "f2cb86decb334fc72ff5422122ba190bc9b6046e" + echo "afef57f872433bcd3032c2ccbc0453bef5b62178" } # Show version information @@ -128,7 +128,6 @@ patch_enable_all () enable_d3dx9_36_DrawText="$1" enable_d3dx9_36_Dummy_Skininfo="$1" enable_d3dx9_36_Filter_Warnings="$1" - enable_d3dx9_36_FindNextValidTechnique="$1" enable_d3dx9_36_Optimize_Inplace="$1" enable_d3dx9_36_Texture_Align="$1" enable_d3dx9_36_UpdateSkinnedMesh="$1" @@ -380,7 +379,6 @@ patch_enable_all () enable_windowscodecs_JPEG_Decoder="$1" enable_windowscodecs_Palette_Images="$1" enable_windowscodecs_TIFF_Support="$1" - enable_windowscodecs_WICCreateBitmapFromSection="$1" enable_wine_inf_Directory_ContextMenuHandlers="$1" enable_wine_inf_Dummy_CA_Certificate="$1" enable_wine_inf_Performance="$1" @@ -410,7 +408,6 @@ patch_enable_all () enable_wined3d_Viewports="$1" enable_wined3d_WINED3DFMT_R32G32_UINT="$1" enable_wined3d_WINED3D_RS_COLORWRITEENABLE="$1" - enable_wined3d_dxgi_swapchain_Present="$1" enable_wined3d_sample_c_lz="$1" enable_wined3d_wined3d_guess_gl_vendor="$1" enable_winedbg_Process_Arguments="$1" @@ -425,7 +422,6 @@ patch_enable_all () enable_winex11_DefaultDisplayFrequency="$1" enable_winex11_MWM_Decorations="$1" enable_winex11_UpdateLayeredWindow="$1" - enable_winex11_Vulkan_compile_fix="$1" enable_winex11_WM_WINDOWPOSCHANGING="$1" enable_winex11_Window_Style="$1" enable_winex11_XEMBED="$1" @@ -596,9 +592,6 @@ patch_enable () d3dx9_36-Filter_Warnings) enable_d3dx9_36_Filter_Warnings="$2" ;; - d3dx9_36-FindNextValidTechnique) - enable_d3dx9_36_FindNextValidTechnique="$2" - ;; d3dx9_36-Optimize_Inplace) enable_d3dx9_36_Optimize_Inplace="$2" ;; @@ -1352,9 +1345,6 @@ patch_enable () windowscodecs-TIFF_Support) enable_windowscodecs_TIFF_Support="$2" ;; - windowscodecs-WICCreateBitmapFromSection) - enable_windowscodecs_WICCreateBitmapFromSection="$2" - ;; wine.inf-Directory_ContextMenuHandlers) enable_wine_inf_Directory_ContextMenuHandlers="$2" ;; @@ -1442,9 +1432,6 @@ patch_enable () wined3d-WINED3D_RS_COLORWRITEENABLE) enable_wined3d_WINED3D_RS_COLORWRITEENABLE="$2" ;; - wined3d-dxgi_swapchain_Present) - enable_wined3d_dxgi_swapchain_Present="$2" - ;; wined3d-sample_c_lz) enable_wined3d_sample_c_lz="$2" ;; @@ -1487,9 +1474,6 @@ patch_enable () winex11-UpdateLayeredWindow) enable_winex11_UpdateLayeredWindow="$2" ;; - winex11-Vulkan-compile-fix) - enable_winex11_Vulkan_compile_fix="$2" - ;; winex11-WM_WINDOWPOSCHANGING) enable_winex11_WM_WINDOWPOSCHANGING="$2" ;; @@ -1974,13 +1958,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then enable_wined3d_CSMT_Helper=1 fi -if test "$enable_wined3d_dxgi_swapchain_Present" -eq 1; then - if test "$enable_wined3d_Silence_FIXMEs" -gt 1; then - abort "Patchset wined3d-Silence_FIXMEs disabled, but wined3d-dxgi_swapchain_Present depends on that." - fi - enable_wined3d_Silence_FIXMEs=1 -fi - if test "$enable_wined3d_Indexed_Vertex_Blending" -eq 1; then if test "$enable_wined3d_WINED3D_RS_COLORWRITEENABLE" -gt 1; then abort "Patchset wined3d-WINED3D_RS_COLORWRITEENABLE disabled, but wined3d-Indexed_Vertex_Blending depends on that." @@ -2624,18 +2601,16 @@ fi # Patchset Pipelight # | # | Modified files: -# | * dlls/user32/message.c, dlls/user32/tests/msg.c, dlls/wined3d/wined3d.spec, dlls/wined3d/wined3d_main.c, -# | dlls/winex11.drv/init.c, dlls/winex11.drv/opengl.c, dlls/winex11.drv/x11drv.h +# | * dlls/user32/message.c, dlls/user32/tests/msg.c, dlls/winex11.drv/init.c, dlls/winex11.drv/opengl.c, +# | dlls/winex11.drv/x11drv.h # | if test "$enable_Pipelight" -eq 1; then patch_apply Pipelight/0001-winex11-Implement-X11DRV_FLUSH_GDI_DISPLAY-ExtEscape-c.patch patch_apply Pipelight/0002-user32-Decrease-minimum-SetTimer-interval-to-5-ms.patch - patch_apply Pipelight/0003-wined3d-allow-changing-strict-drawing-through-an-exp.patch patch_apply Pipelight/0004-winex11.drv-Indicate-direct-rendering-through-OpenGL.patch ( printf '%s\n' '+ { "Sebastian Lackner", "winex11: Implement X11DRV_FLUSH_GDI_DISPLAY ExtEscape command.", 1 },'; printf '%s\n' '+ { "Michael Müller", "user32: Decrease minimum SetTimer interval to 5 ms.", 2 },'; - printf '%s\n' '+ { "Michael Müller", "wined3d: Allow changing strict drawing through an exported function.", 1 },'; printf '%s\n' '+ { "Michael Müller", "winex11.drv: Indicate direct rendering through OpenGL extension.", 1 },'; ) >> "$patchlist" fi @@ -3003,17 +2978,11 @@ fi # | * [#43605] Implement elliptic curve (ECDSA) cryptography # | # | Modified files: -# | * dlls/bcrypt/bcrypt.spec, dlls/bcrypt/bcrypt_main.c, dlls/bcrypt/tests/bcrypt.c, dlls/ncrypt/ncrypt.spec, -# | include/bcrypt.h +# | * dlls/bcrypt/bcrypt.spec, dlls/bcrypt/bcrypt_main.c, dlls/bcrypt/tests/bcrypt.c, include/bcrypt.h # | if test "$enable_bcrypt_Improvements" -eq 1; then - patch_apply bcrypt-Improvements/0020-bcrypt-Implement-BCryptDuplicateKey.patch - patch_apply bcrypt-Improvements/0021-bcrypt-tests-Add-tests-for-BCryptDuplicateKey.patch - patch_apply bcrypt-Improvements/0023-bcrypt-Add-support-for-auth-data-in-AES-GCM-mode.patch - patch_apply bcrypt-Improvements/0024-bcrypt-tests-Add-tests-for-auth-data-in-AES-GCM-mode.patch patch_apply bcrypt-Improvements/0025-bcrypt-Avoid-crash-in-tests-when-compiling-without-g.patch patch_apply bcrypt-Improvements/0026-bcrypt-Implement-support-for-ECB-chain-mode.patch - patch_apply bcrypt-Improvements/0027-bcrypt-Fix-BCryptEncrypt-with-AES_GCM-and-no-input-a.patch patch_apply bcrypt-Improvements/0029-bcrypt-Add-support-for-192-and-256-bit-aes-keys.patch patch_apply bcrypt-Improvements/0030-bcrypt-Preparation-for-asymmetric-keys.patch patch_apply bcrypt-Improvements/0032-bcrypt-tests-Add-basic-test-for-ecdsa.patch @@ -3023,13 +2992,8 @@ if test "$enable_bcrypt_Improvements" -eq 1; then patch_apply bcrypt-Improvements/0036-bcrypt-tests-Add-simple-test-for-RSA.patch patch_apply bcrypt-Improvements/0037-bcrypt-Store-full-ECCKEY_BLOB-struct-in-BCryptImport.patch ( - printf '%s\n' '+ { "Michael Müller", "bcrypt: Implement BCryptDuplicateKey.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "bcrypt/tests: Add tests for BCryptDuplicateKey.", 1 },'; - printf '%s\n' '+ { "Michael Müller", "bcrypt: Add support for auth data in AES GCM mode.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "bcrypt/tests: Add tests for auth data in AES GCM mode.", 1 },'; printf '%s\n' '+ { "Sebastian Lackner", "bcrypt: Avoid crash in tests when compiling without gnutls support.", 1 },'; printf '%s\n' '+ { "Sebastian Lackner", "bcrypt: Implement support for ECB chain mode.", 1 },'; - printf '%s\n' '+ { "Andrew Wesie", "bcrypt: Fix BCryptEncrypt with AES_GCM and no input and no output.", 1 },'; printf '%s\n' '+ { "Michael Müller", "bcrypt: Add support for 192 and 256 bit aes keys.", 1 },'; printf '%s\n' '+ { "Michael Müller", "bcrypt: Preparation for asymmetric keys.", 1 },'; printf '%s\n' '+ { "Michael Müller", "bcrypt/tests: Add basic test for ecdsa.", 1 },'; @@ -3704,21 +3668,6 @@ if test "$enable_d3dx9_36_Filter_Warnings" -eq 1; then ) >> "$patchlist" fi -# Patchset d3dx9_36-FindNextValidTechnique -# | -# | This patchset fixes the following Wine bugs: -# | * [#34101] Implement ID3DXEffect::FindNextValidTechnique -# | -# | Modified files: -# | * dlls/d3dx9_36/effect.c, dlls/d3dx9_36/tests/effect.c -# | -if test "$enable_d3dx9_36_FindNextValidTechnique" -eq 1; then - patch_apply d3dx9_36-FindNextValidTechnique/0001-d3dx9_36-Implement-ID3DXEffect_FindNextValidTechniqu.patch - ( - printf '%s\n' '+ { "Christian Costa", "d3dx9_36: Implement ID3DXEffect_FindNextValidTechnique + add tests.", 1 },'; - ) >> "$patchlist" -fi - # Patchset d3dx9_36-Optimize_Inplace # | # | Modified files: @@ -8092,22 +8041,6 @@ if test "$enable_windowscodecs_JPEG_Decoder" -eq 1; then ) >> "$patchlist" fi -# Patchset windowscodecs-WICCreateBitmapFromSection -# | -# | This patchset fixes the following Wine bugs: -# | * [#40273] Implement windowscodecs.WICCreateBitmapFromSection(Ex) -# | -# | Modified files: -# | * dlls/windowscodecs/bitmap.c, dlls/windowscodecs/imgfactory.c, dlls/windowscodecs/windowscodecs.spec, -# | include/wincodec.idl -# | -if test "$enable_windowscodecs_WICCreateBitmapFromSection" -eq 1; then - patch_apply windowscodecs-WICCreateBitmapFromSection/0001-windowscodecs-Implement-WICCreateBitmapFromSection-E.patch - ( - printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Implement WICCreateBitmapFromSection(Ex).", 2 },'; - ) >> "$patchlist" -fi - # Patchset wine.inf-Directory_ContextMenuHandlers # | # | This patchset fixes the following Wine bugs: @@ -8416,17 +8349,15 @@ fi # Patchset wined3d-Silence_FIXMEs # | # | Modified files: -# | * dlls/wined3d/resource.c, dlls/wined3d/surface.c, dlls/wined3d/swapchain.c, dlls/wined3d/texture.c +# | * dlls/wined3d/resource.c, dlls/wined3d/surface.c, dlls/wined3d/texture.c # | if test "$enable_wined3d_Silence_FIXMEs" -eq 1; then patch_apply wined3d-Silence_FIXMEs/0003-wined3d-Silence-repeated-resource_check_usage-FIXME.patch patch_apply wined3d-Silence_FIXMEs/0004-wined3d-Print-FIXME-only-once-in-surface_cpu_blt.patch - patch_apply wined3d-Silence_FIXMEs/0005-wined3d-Silence-repeated-wined3d_swapchain_present-F.patch patch_apply wined3d-Silence_FIXMEs/0006-wined3d-Silence-extremely-noisy-FIXME-in-wined3d_tex.patch ( printf '%s\n' '+ { "Erich E. Hoover", "wined3d: Silence repeated resource_check_usage FIXME.", 2 },'; printf '%s\n' '+ { "Christian Costa", "wined3d: Print FIXME only once in surface_cpu_blt.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Silence repeated wined3d_swapchain_present FIXME.", 1 },'; printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Silence extremely noisy FIXME in wined3d_texture_add_dirty_region.", 1 },'; ) >> "$patchlist" fi @@ -8551,23 +8482,6 @@ if test "$enable_wined3d_WINED3DFMT_R32G32_UINT" -eq 1; then ) >> "$patchlist" fi -# Patchset wined3d-dxgi_swapchain_Present -# | -# | This patchset has the following (direct or indirect) dependencies: -# | * wined3d-Silence_FIXMEs -# | -# | Modified files: -# | * dlls/d3d8/swapchain.c, dlls/d3d9/device.c, dlls/d3d9/swapchain.c, dlls/dxgi/swapchain.c, dlls/wined3d/cs.c, -# | dlls/wined3d/surface.c, dlls/wined3d/swapchain.c, dlls/wined3d/wined3d.spec, dlls/wined3d/wined3d_private.h, -# | include/wine/wined3d.h -# | -if test "$enable_wined3d_dxgi_swapchain_Present" -eq 1; then - patch_apply wined3d-dxgi_swapchain_Present/0001-wined3d-Implement-updating-swap-interval-through-win.patch - ( - printf '%s\n' '+ { "Michael Müller", "wined3d: Implement updating swap interval through wined3d_swapchain_present.", 1 },'; - ) >> "$patchlist" -fi - # Patchset wined3d-sample_c_lz # | # | Modified files: @@ -8825,18 +8739,6 @@ if test "$enable_winex11_UpdateLayeredWindow" -eq 1; then ) >> "$patchlist" fi -# Patchset winex11-Vulkan-compile-fix -# | -# | Modified files: -# | * dlls/winex11.drv/vulkan.c -# | -if test "$enable_winex11_Vulkan_compile_fix" -eq 1; then - patch_apply winex11-Vulkan-compile-fix/0001-winex11.drv-Fix-compile-error-when-Vulkan-isn-t-avai.patch - ( - printf '%s\n' '+ { "Alistair Leslie-Hughes", "winex11.drv: Fix compile error when Vulkan isn'\''t avaiable.", 1 },'; - ) >> "$patchlist" -fi - # Patchset winex11-_NET_ACTIVE_WINDOW # | # | This patchset fixes the following Wine bugs: diff --git a/patches/windowscodecs-IMILBitmapSource/0001-windowscodecs-Improve-compatibility-of-IMILBitmapSou.patch b/patches/windowscodecs-IMILBitmapSource/0001-windowscodecs-Improve-compatibility-of-IMILBitmapSou.patch index 55fe9e25..88d2dab2 100644 --- a/patches/windowscodecs-IMILBitmapSource/0001-windowscodecs-Improve-compatibility-of-IMILBitmapSou.patch +++ b/patches/windowscodecs-IMILBitmapSource/0001-windowscodecs-Improve-compatibility-of-IMILBitmapSou.patch @@ -1,8 +1,8 @@ -From 2393324ce158c6e47d7fc3dcaf1266302e96285b Mon Sep 17 00:00:00 2001 +From 86e5afc80f75ccef2f6f7215a6c1f281c7d4fd39 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 22 Mar 2016 23:46:30 +0800 -Subject: windowscodecs: Improve compatibility of IMILBitmapSource interface. - (v3) +Subject: [PATCH] windowscodecs: Improve compatibility of IMILBitmapSource + interface. (v3) Based on Focht's investigation. This makes the test application attached to the bug 34764 work. @@ -12,10 +12,10 @@ to the bug 34764 work. 2 files changed, 197 insertions(+), 45 deletions(-) diff --git a/dlls/windowscodecs/bitmap.c b/dlls/windowscodecs/bitmap.c -index 6adaab0..09a5e62 100644 +index f841496..734c211 100644 --- a/dlls/windowscodecs/bitmap.c +++ b/dlls/windowscodecs/bitmap.c -@@ -135,6 +135,7 @@ static HRESULT WINAPI BitmapLockImpl_QueryInterface(IWICBitmapLock *iface, REFII +@@ -137,6 +137,7 @@ static HRESULT WINAPI BitmapLockImpl_QueryInterface(IWICBitmapLock *iface, REFII } else { @@ -23,7 +23,7 @@ index 6adaab0..09a5e62 100644 *ppv = NULL; return E_NOINTERFACE; } -@@ -248,12 +249,14 @@ static HRESULT WINAPI BitmapImpl_QueryInterface(IWICBitmap *iface, REFIID iid, +@@ -250,12 +251,14 @@ static HRESULT WINAPI BitmapImpl_QueryInterface(IWICBitmap *iface, REFIID iid, { *ppv = &This->IWICBitmap_iface; } @@ -39,7 +39,7 @@ index 6adaab0..09a5e62 100644 *ppv = NULL; return E_NOINTERFACE; } -@@ -479,13 +482,22 @@ static HRESULT WINAPI IMILBitmapImpl_QueryInterface(IMILBitmapSource *iface, REF +@@ -484,13 +487,22 @@ static HRESULT WINAPI IMILBitmapImpl_QueryInterface(IMILBitmapSource *iface, REF if (!ppv) return E_INVALIDARG; if (IsEqualIID(&IID_IUnknown, iid) || @@ -62,7 +62,7 @@ index 6adaab0..09a5e62 100644 *ppv = NULL; return E_NOINTERFACE; } -@@ -506,6 +518,7 @@ static HRESULT WINAPI IMILBitmapImpl_GetSize(IMILBitmapSource *iface, +@@ -511,6 +523,7 @@ static HRESULT WINAPI IMILBitmapImpl_GetSize(IMILBitmapSource *iface, UINT *width, UINT *height) { BitmapImpl *This = impl_from_IMILBitmapSource(iface); @@ -70,7 +70,7 @@ index 6adaab0..09a5e62 100644 return IWICBitmap_GetSize(&This->IWICBitmap_iface, width, height); } -@@ -559,6 +572,7 @@ static HRESULT WINAPI IMILBitmapImpl_GetPixelFormat(IMILBitmapSource *iface, +@@ -564,6 +577,7 @@ static HRESULT WINAPI IMILBitmapImpl_GetPixelFormat(IMILBitmapSource *iface, } } @@ -78,7 +78,7 @@ index 6adaab0..09a5e62 100644 return S_OK; } -@@ -566,6 +580,7 @@ static HRESULT WINAPI IMILBitmapImpl_GetResolution(IMILBitmapSource *iface, +@@ -571,6 +585,7 @@ static HRESULT WINAPI IMILBitmapImpl_GetResolution(IMILBitmapSource *iface, double *dpix, double *dpiy) { BitmapImpl *This = impl_from_IMILBitmapSource(iface); @@ -86,7 +86,7 @@ index 6adaab0..09a5e62 100644 return IWICBitmap_GetResolution(&This->IWICBitmap_iface, dpix, dpiy); } -@@ -573,6 +588,7 @@ static HRESULT WINAPI IMILBitmapImpl_CopyPalette(IMILBitmapSource *iface, +@@ -578,6 +593,7 @@ static HRESULT WINAPI IMILBitmapImpl_CopyPalette(IMILBitmapSource *iface, IWICPalette *palette) { BitmapImpl *This = impl_from_IMILBitmapSource(iface); @@ -94,7 +94,7 @@ index 6adaab0..09a5e62 100644 return IWICBitmap_CopyPalette(&This->IWICBitmap_iface, palette); } -@@ -580,10 +596,11 @@ static HRESULT WINAPI IMILBitmapImpl_CopyPixels(IMILBitmapSource *iface, +@@ -585,10 +601,11 @@ static HRESULT WINAPI IMILBitmapImpl_CopyPixels(IMILBitmapSource *iface, const WICRect *rc, UINT stride, UINT size, BYTE *buffer) { BitmapImpl *This = impl_from_IMILBitmapSource(iface); @@ -107,7 +107,7 @@ index 6adaab0..09a5e62 100644 { BitmapImpl *This = impl_from_IMILBitmapSource(iface); -@@ -591,12 +608,46 @@ static HRESULT WINAPI IMILBitmapImpl_UnknownMethod1(IMILBitmapSource *iface, voi +@@ -596,12 +613,46 @@ static HRESULT WINAPI IMILBitmapImpl_UnknownMethod1(IMILBitmapSource *iface, voi if (!ppv) return E_INVALIDARG; @@ -155,7 +155,7 @@ index 6adaab0..09a5e62 100644 static const IMILBitmapSourceVtbl IMILBitmapImpl_Vtbl = { IMILBitmapImpl_QueryInterface, -@@ -607,26 +658,20 @@ static const IMILBitmapSourceVtbl IMILBitmapImpl_Vtbl = +@@ -612,26 +663,20 @@ static const IMILBitmapSourceVtbl IMILBitmapImpl_Vtbl = IMILBitmapImpl_GetResolution, IMILBitmapImpl_CopyPalette, IMILBitmapImpl_CopyPixels, @@ -191,7 +191,7 @@ index 6adaab0..09a5e62 100644 } static ULONG WINAPI IMILUnknown1Impl_AddRef(IMILUnknown1 *iface) -@@ -641,47 +686,108 @@ static ULONG WINAPI IMILUnknown1Impl_Release(IMILUnknown1 *iface) +@@ -646,47 +691,108 @@ static ULONG WINAPI IMILUnknown1Impl_Release(IMILUnknown1 *iface) return IWICBitmap_Release(&This->IWICBitmap_iface); } @@ -319,7 +319,7 @@ index 6adaab0..09a5e62 100644 return E_NOTIMPL; } -@@ -690,7 +796,9 @@ static const IMILUnknown2Vtbl IMILUnknown2Impl_Vtbl = +@@ -695,7 +801,9 @@ static const IMILUnknown2Vtbl IMILUnknown2Impl_Vtbl = IMILUnknown2Impl_QueryInterface, IMILUnknown2Impl_AddRef, IMILUnknown2Impl_Release, @@ -329,12 +329,12 @@ index 6adaab0..09a5e62 100644 + IMILUnknown2Impl_unknown3 }; - HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, + HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, UINT stride, UINT datasize, void *view, diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h -index f54403c..218228a 100644 +index 0274ece..0c256be 100644 --- a/dlls/windowscodecs/wincodecs_private.h +++ b/dlls/windowscodecs/wincodecs_private.h -@@ -30,7 +30,13 @@ DEFINE_GUID(GUID_WineContainerFormatTga, 0x0c44fda1,0xa5c5,0x4298,0x96,0x85,0x47 +@@ -31,7 +31,13 @@ DEFINE_GUID(GUID_WineContainerFormatTga, 0x0c44fda1,0xa5c5,0x4298,0x96,0x85,0x47 DEFINE_GUID(GUID_VendorWine, 0xddf46da1,0x7dc1,0x404e,0x98,0xf2,0xef,0xa4,0x8d,0xfc,0x95,0x0a); @@ -348,7 +348,7 @@ index f54403c..218228a 100644 #define INTERFACE IMILBitmapSource DECLARE_INTERFACE_(IMILBitmapSource,IUnknown) { -@@ -38,16 +44,39 @@ DECLARE_INTERFACE_(IMILBitmapSource,IUnknown) +@@ -39,16 +45,39 @@ DECLARE_INTERFACE_(IMILBitmapSource,IUnknown) STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; @@ -394,7 +394,7 @@ index f54403c..218228a 100644 #define INTERFACE IMILUnknown1 DECLARE_INTERFACE_(IMILUnknown1,IUnknown) { -@@ -55,6 +84,19 @@ DECLARE_INTERFACE_(IMILUnknown1,IUnknown) +@@ -56,6 +85,19 @@ DECLARE_INTERFACE_(IMILUnknown1,IUnknown) STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; @@ -414,7 +414,7 @@ index f54403c..218228a 100644 }; #undef INTERFACE -@@ -66,7 +108,9 @@ DECLARE_INTERFACE_(IMILUnknown2,IUnknown) +@@ -67,7 +109,9 @@ DECLARE_INTERFACE_(IMILUnknown2,IUnknown) STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** unknown methods ***/ @@ -426,5 +426,5 @@ index f54403c..218228a 100644 #undef INTERFACE -- -2.7.1 +1.9.1 diff --git a/patches/windowscodecs-WICCreateBitmapFromSection/0001-windowscodecs-Implement-WICCreateBitmapFromSection-E.patch b/patches/windowscodecs-WICCreateBitmapFromSection/0001-windowscodecs-Implement-WICCreateBitmapFromSection-E.patch deleted file mode 100644 index 7984c2e5..00000000 --- a/patches/windowscodecs-WICCreateBitmapFromSection/0001-windowscodecs-Implement-WICCreateBitmapFromSection-E.patch +++ /dev/null @@ -1,214 +0,0 @@ -From dcebc7fcedaffca0940a4324b1525ea9485a4674 Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Fri, 11 Mar 2016 03:48:46 +0100 -Subject: windowscodecs: Implement WICCreateBitmapFromSection(Ex). (v2) - ---- - dlls/windowscodecs/bitmap.c | 27 ++++++++----- - dlls/windowscodecs/imgfactory.c | 73 ++++++++++++++++++++++++++++++++++- - dlls/windowscodecs/windowscodecs.spec | 3 +- - include/wincodec.idl | 8 ++++ - 4 files changed, 100 insertions(+), 11 deletions(-) - -diff --git a/dlls/windowscodecs/bitmap.c b/dlls/windowscodecs/bitmap.c -index 6adaab0aea1..76298b22ca2 100644 ---- a/dlls/windowscodecs/bitmap.c -+++ b/dlls/windowscodecs/bitmap.c -@@ -45,6 +45,7 @@ typedef struct BitmapImpl { - int palette_set; - LONG lock; /* 0 if not locked, -1 if locked for writing, count if locked for reading */ - BYTE *data; -+ BOOL is_section; /* TRUE if data is a section created by an application */ - UINT width, height; - UINT stride; - UINT bpp; -@@ -284,7 +285,10 @@ static ULONG WINAPI BitmapImpl_Release(IWICBitmap *iface) - if (This->palette) IWICPalette_Release(This->palette); - This->cs.DebugInfo->Spare[0] = 0; - DeleteCriticalSection(&This->cs); -- HeapFree(GetProcessHeap(), 0, This->data); -+ if (This->is_section) -+ UnmapViewOfFile(This->data); -+ else -+ HeapFree(GetProcessHeap(), 0, This->data); - HeapFree(GetProcessHeap(), 0, This); - } - -@@ -694,13 +698,12 @@ static const IMILUnknown2Vtbl IMILUnknown2Impl_Vtbl = - }; - - HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, -- UINT stride, UINT datasize, BYTE *bits, -+ UINT stride, UINT datasize, BYTE *data, - REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option, - IWICBitmap **ppIBitmap) - { - HRESULT hr; - BitmapImpl *This; -- BYTE *data; - UINT bpp; - - hr = get_pixelformat_bpp(pixelFormat, &bpp); -@@ -713,14 +716,20 @@ HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, - if (stride < ((bpp*uiWidth)+7)/8) return E_INVALIDARG; - - This = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapImpl)); -- data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, datasize); -- if (!This || !data) -+ if (!This) return E_OUTOFMEMORY; -+ -+ if (!data) - { -- HeapFree(GetProcessHeap(), 0, This); -- HeapFree(GetProcessHeap(), 0, data); -- return E_OUTOFMEMORY; -+ data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, datasize); -+ if (!data) -+ { -+ HeapFree(GetProcessHeap(), 0, This); -+ return E_OUTOFMEMORY; -+ } -+ This->is_section = FALSE; - } -- if (bits) memcpy(data, bits, datasize); -+ else -+ This->is_section = TRUE; - - This->IWICBitmap_iface.lpVtbl = &BitmapImpl_Vtbl; - This->IMILBitmapSource_iface.lpVtbl = &IMILBitmapImpl_Vtbl; -diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c -index bf634949b44..50e6725a5c7 100644 ---- a/dlls/windowscodecs/imgfactory.c -+++ b/dlls/windowscodecs/imgfactory.c -@@ -595,12 +595,36 @@ static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory(IWICComponentFacto - UINT width, UINT height, REFWICPixelFormatGUID format, UINT stride, - UINT size, BYTE *buffer, IWICBitmap **bitmap) - { -+ HRESULT hr; -+ - TRACE("(%p,%u,%u,%s,%u,%u,%p,%p\n", iface, width, height, - debugstr_guid(format), stride, size, buffer, bitmap); - - if (!stride || !size || !buffer || !bitmap) return E_INVALIDARG; - -- return BitmapImpl_Create(width, height, stride, size, buffer, format, WICBitmapCacheOnLoad, bitmap); -+ hr = BitmapImpl_Create(width, height, stride, size, NULL, format, WICBitmapCacheOnLoad, bitmap); -+ if (SUCCEEDED(hr)) -+ { -+ IWICBitmapLock *lock; -+ -+ hr = IWICBitmap_Lock(*bitmap, NULL, WICBitmapLockWrite, &lock); -+ if (SUCCEEDED(hr)) -+ { -+ UINT buffersize; -+ BYTE *data; -+ -+ IWICBitmapLock_GetDataPointer(lock, &buffersize, &data); -+ memcpy(data, buffer, buffersize); -+ -+ IWICBitmapLock_Release(lock); -+ } -+ else -+ { -+ IWICBitmap_Release(*bitmap); -+ *bitmap = NULL; -+ } -+ } -+ return hr; - } - - static BOOL get_16bpp_format(HBITMAP hbm, WICPixelFormatGUID *format) -@@ -1176,3 +1200,50 @@ HRESULT ComponentFactory_CreateInstance(REFIID iid, void** ppv) - - return ret; - } -+ -+HRESULT WINAPI WICCreateBitmapFromSectionEx(UINT width, UINT height, -+ REFWICPixelFormatGUID format, HANDLE section, UINT stride, -+ UINT offset, WICSectionAccessLevel wicaccess, IWICBitmap **bitmap) -+{ -+ DWORD access; -+ void *buffer; -+ HRESULT hr; -+ -+ TRACE("%u,%u,%s,%p,%u,%#x,%#x,%p\n", width, height, debugstr_guid(format), -+ section, stride, offset, wicaccess, bitmap); -+ -+ if (!width || !height || !section || !bitmap) return E_INVALIDARG; -+ -+ switch (wicaccess) -+ { -+ case WICSectionAccessLevelReadWrite: -+ access = FILE_MAP_READ | FILE_MAP_WRITE; -+ break; -+ -+ case WICSectionAccessLevelRead: -+ access = FILE_MAP_READ; -+ break; -+ -+ default: -+ FIXME("unsupported access %#x\n", wicaccess); -+ return E_INVALIDARG; -+ } -+ -+ buffer = MapViewOfFile(section, access, 0, offset, 0); -+ if (!buffer) return HRESULT_FROM_WIN32(GetLastError()); -+ -+ hr = BitmapImpl_Create(width, height, stride, 0, buffer, format, WICBitmapCacheOnLoad, bitmap); -+ if (FAILED(hr)) UnmapViewOfFile(buffer); -+ return hr; -+} -+ -+HRESULT WINAPI WICCreateBitmapFromSection(UINT width, UINT height, -+ REFWICPixelFormatGUID format, HANDLE section, -+ UINT stride, UINT offset, IWICBitmap **bitmap) -+{ -+ TRACE("%u,%u,%s,%p,%u,%u,%p\n", width, height, debugstr_guid(format), -+ section, stride, offset, bitmap); -+ -+ return WICCreateBitmapFromSectionEx(width, height, format, section, -+ stride, offset, WICSectionAccessLevelRead, bitmap); -+} -diff --git a/dlls/windowscodecs/windowscodecs.spec b/dlls/windowscodecs/windowscodecs.spec -index 49346fc86b7..905ef835afc 100644 ---- a/dlls/windowscodecs/windowscodecs.spec -+++ b/dlls/windowscodecs/windowscodecs.spec -@@ -105,7 +105,8 @@ - @ stdcall IWICStream_InitializeFromIStream_Proxy(ptr ptr) IWICStream_InitializeFromIStream_Proxy_W - @ stdcall IWICStream_InitializeFromMemory_Proxy(ptr ptr long) IWICStream_InitializeFromMemory_Proxy_W - @ stdcall WICConvertBitmapSource(ptr ptr ptr) --@ stub WICCreateBitmapFromSection -+@ stdcall WICCreateBitmapFromSection(long long ptr long long long ptr) -+@ stdcall WICCreateBitmapFromSectionEx(long long ptr long long long long ptr) - @ stdcall WICCreateColorContext_Proxy(ptr ptr) - @ stdcall WICCreateImagingFactory_Proxy(long ptr) - @ stub WICGetMetadataContentSize -diff --git a/include/wincodec.idl b/include/wincodec.idl -index 1bbdab90c4a..43ed1c4a08b 100644 ---- a/include/wincodec.idl -+++ b/include/wincodec.idl -@@ -181,6 +181,12 @@ typedef enum WICPngFilterOption { - WICPNFFILTEROPTION_FORCE_DWORD = CODEC_FORCE_DWORD - } WICPngFilterOption; - -+typedef enum WICSectionAccessLevel { -+ WICSectionAccessLevelRead = 0x00000001, -+ WICSectionAccessLevelReadWrite = 0x00000003, -+ WICSectionAccessLevel_FORCE_DWORD = CODEC_FORCE_DWORD -+} WICSectionAccessLevel; -+ - typedef GUID WICPixelFormatGUID; - typedef REFGUID REFWICPixelFormatGUID; - -@@ -1050,6 +1056,8 @@ interface IWICEnumMetadataItem : IUnknown - } - - cpp_quote("HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitmapSource *pISrc, IWICBitmapSource **ppIDst);") -+cpp_quote("HRESULT WINAPI WICCreateBitmapFromSection(UINT width, UINT height, REFWICPixelFormatGUID format, HANDLE section, UINT stride, UINT offset, IWICBitmap **bitmap);") -+cpp_quote("HRESULT WINAPI WICCreateBitmapFromSectionEx(UINT width, UINT height, REFWICPixelFormatGUID format, HANDLE section, UINT stride, UINT offset, WICSectionAccessLevel access, IWICBitmap **bitmap);") - - cpp_quote("HRESULT WINAPI WICMapGuidToShortName(REFGUID,UINT,WCHAR *,UINT *);") - cpp_quote("HRESULT WINAPI WICMapShortNameToGuid(PCWSTR,GUID *);") --- -2.13.1 - diff --git a/patches/windowscodecs-WICCreateBitmapFromSection/definition b/patches/windowscodecs-WICCreateBitmapFromSection/definition deleted file mode 100644 index 6b4dc071..00000000 --- a/patches/windowscodecs-WICCreateBitmapFromSection/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [40273] Implement windowscodecs.WICCreateBitmapFromSection(Ex) diff --git a/patches/wined3d-Silence_FIXMEs/0005-wined3d-Silence-repeated-wined3d_swapchain_present-F.patch b/patches/wined3d-Silence_FIXMEs/0005-wined3d-Silence-repeated-wined3d_swapchain_present-F.patch deleted file mode 100644 index aefde494..00000000 --- a/patches/wined3d-Silence_FIXMEs/0005-wined3d-Silence-repeated-wined3d_swapchain_present-F.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 8ff4dfbdec69e2244204a7157c918ef14cf6afc7 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sun, 4 May 2014 00:53:51 +0200 -Subject: wined3d: Silence repeated wined3d_swapchain_present FIXME. - ---- - dlls/wined3d/swapchain.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c -index 7d02375..db93328 100644 ---- a/dlls/wined3d/swapchain.c -+++ b/dlls/wined3d/swapchain.c -@@ -135,14 +135,18 @@ void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWN - HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain, - const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) - { -+ static DWORD notified_flags = 0; - RECT s, d; - - TRACE("swapchain %p, src_rect %s, dst_rect %s, dst_window_override %p, flags %#x.\n", - swapchain, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect), - dst_window_override, flags); - -- if (flags) -- FIXME("Ignoring flags %#x.\n", flags); -+ if (flags & ~notified_flags) -+ { -+ FIXME("Ignoring flags %#x.\n", flags & ~notified_flags); -+ notified_flags |= flags; -+ } - - if (!swapchain->back_buffers) - { --- -2.7.1 - diff --git a/patches/wined3d-dxgi_swapchain_Present/0001-wined3d-Implement-updating-swap-interval-through-win.patch b/patches/wined3d-dxgi_swapchain_Present/0001-wined3d-Implement-updating-swap-interval-through-win.patch deleted file mode 100644 index e59bff5b..00000000 --- a/patches/wined3d-dxgi_swapchain_Present/0001-wined3d-Implement-updating-swap-interval-through-win.patch +++ /dev/null @@ -1,228 +0,0 @@ -From 09257c42ac366ba4a26878ad52781b3b4e7a5637 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Sun, 1 Oct 2017 01:44:57 +0200 -Subject: [PATCH] wined3d: Implement updating swap interval through - wined3d_swapchain_present. - ---- - dlls/d3d8/swapchain.c | 2 +- - dlls/d3d9/device.c | 4 ++-- - dlls/d3d9/swapchain.c | 2 +- - dlls/dxgi/swapchain.c | 16 +++++++++++++--- - dlls/wined3d/cs.c | 11 ++++++++++- - dlls/wined3d/surface.c | 2 +- - dlls/wined3d/swapchain.c | 5 +++-- - dlls/wined3d/wined3d.spec | 2 +- - dlls/wined3d/wined3d_private.h | 4 ++-- - include/wine/wined3d.h | 2 +- - 10 files changed, 35 insertions(+), 15 deletions(-) - -diff --git a/dlls/d3d8/swapchain.c b/dlls/d3d8/swapchain.c -index 7003aa3..3a588b5 100644 ---- a/dlls/d3d8/swapchain.c -+++ b/dlls/d3d8/swapchain.c -@@ -105,7 +105,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d8_swapchain_Present(IDirect3DSwapChai - - wined3d_mutex_lock(); - hr = wined3d_swapchain_present(swapchain->wined3d_swapchain, -- src_rect, dst_rect, dst_window_override, 0); -+ src_rect, dst_rect, dst_window_override, 0, 0); - wined3d_mutex_unlock(); - - return hr; -diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c -index 5e0f558..d7f4a25 100644 ---- a/dlls/d3d9/device.c -+++ b/dlls/d3d9/device.c -@@ -992,7 +992,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_Present(IDirect3DDevice9Ex * - for (i = 0; i < device->implicit_swapchain_count; ++i) - { - if (FAILED(hr = wined3d_swapchain_present(device->implicit_swapchains[i]->wined3d_swapchain, -- src_rect, dst_rect, dst_window_override, 0))) -+ src_rect, dst_rect, dst_window_override, 0, 0))) - { - wined3d_mutex_unlock(); - return hr; -@@ -3667,7 +3667,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_PresentEx(IDirect3DDevice9Ex - for (i = 0; i < device->implicit_swapchain_count; ++i) - { - if (FAILED(hr = wined3d_swapchain_present(device->implicit_swapchains[i]->wined3d_swapchain, -- src_rect, dst_rect, dst_window_override, flags))) -+ src_rect, dst_rect, dst_window_override, 0, flags))) - { - wined3d_mutex_unlock(); - return hr; -diff --git a/dlls/d3d9/swapchain.c b/dlls/d3d9/swapchain.c -index 411040a..dbb3f45 100644 ---- a/dlls/d3d9/swapchain.c -+++ b/dlls/d3d9/swapchain.c -@@ -137,7 +137,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_swapchain_Present(IDirect3DSwapChai - - wined3d_mutex_lock(); - hr = wined3d_swapchain_present(swapchain->wined3d_swapchain, -- src_rect, dst_rect, dst_window_override, flags); -+ src_rect, dst_rect, dst_window_override, 0, flags); - wined3d_mutex_unlock(); - - return hr; -diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c -index 1f88d71..70fb460 100644 ---- a/dlls/dxgi/swapchain.c -+++ b/dlls/dxgi/swapchain.c -@@ -528,6 +528,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_Present1(IDXGISwapChain1 *iface, - UINT sync_interval, UINT flags, const DXGI_PRESENT_PARAMETERS *present_parameters) - { - struct dxgi_swapchain *swapchain = impl_from_IDXGISwapChain1(iface); -+ DWORD swap_interval = 0; - HRESULT hr; - - TRACE("iface %p, sync_interval %u, flags %#x, present_parameters %p.\n", -@@ -541,13 +542,22 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_Present1(IDXGISwapChain1 *iface, - return S_OK; - } - -- if (sync_interval) -- FIXME("Unimplemented sync interval %u.\n", sync_interval); -+ switch (sync_interval) -+ { -+ case 0: -+ swap_interval = WINED3D_SWAP_INTERVAL_IMMEDIATE; -+ break; -+ case 1: -+ swap_interval = WINED3D_SWAP_INTERVAL_ONE; -+ break; -+ default: -+ FIXME("Unimplemented sync interval %u.\n", sync_interval); -+ } - if (present_parameters) - FIXME("Ignored present parameters %p.\n", present_parameters); - - wined3d_mutex_lock(); -- hr = wined3d_swapchain_present(swapchain->wined3d_swapchain, NULL, NULL, NULL, 0); -+ hr = wined3d_swapchain_present(swapchain->wined3d_swapchain, NULL, NULL, NULL, swap_interval, 0); - wined3d_mutex_unlock(); - - return hr; -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 2f77c7b..2356bce 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -94,6 +94,7 @@ struct wined3d_cs_present - struct wined3d_swapchain *swapchain; - RECT src_rect; - RECT dst_rect; -+ DWORD swap_interval; - DWORD flags; - }; - -@@ -453,6 +454,12 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) - swapchain = op->swapchain; - wined3d_swapchain_set_window(swapchain, op->dst_window_override); - -+ if (op->swap_interval && swapchain->desc.swap_interval != op->swap_interval) -+ { -+ swapchain->desc.swap_interval = op->swap_interval; -+ swapchain_update_swap_interval(swapchain); -+ } -+ - swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags); - - wined3d_resource_release(&swapchain->front_buffer->resource); -@@ -465,7 +472,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) - } - - void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, -- const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) -+ const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, -+ DWORD swap_interval, DWORD flags) - { - struct wined3d_cs_present *op; - unsigned int i; -@@ -477,6 +485,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw - op->swapchain = swapchain; - op->src_rect = *src_rect; - op->dst_rect = *dst_rect; -+ op->swap_interval = swap_interval; - op->flags = flags; - - pending = InterlockedIncrement(&cs->pending_presents); -diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index 387326b..9432a4d 100644 ---- a/dlls/wined3d/surface.c -+++ b/dlls/wined3d/surface.c -@@ -3961,7 +3961,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst - /* Set the swap effect to COPY, we don't want the backbuffer to become - * undefined. */ - dst_swapchain->desc.swap_effect = WINED3D_SWAP_EFFECT_COPY; -- wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, 0); -+ wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, 0, 0); - dst_swapchain->desc.swap_effect = swap_effect; - - return WINED3D_OK; -diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c -index 26cd61e..9b3962f 100644 ---- a/dlls/wined3d/swapchain.c -+++ b/dlls/wined3d/swapchain.c -@@ -146,7 +146,8 @@ void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWN - } - - HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain, -- const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) -+ const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, -+ DWORD swap_interval, DWORD flags) - { - static DWORD notified_flags = 0; - RECT s, d; -@@ -181,7 +182,7 @@ HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain, - } - - wined3d_cs_emit_present(swapchain->device->cs, swapchain, src_rect, -- dst_rect, dst_window_override, flags); -+ dst_rect, dst_window_override, swap_interval, flags); - - return WINED3D_OK; - } -diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec -index d2b6bef..16d22f5 100644 ---- a/dlls/wined3d/wined3d.spec -+++ b/dlls/wined3d/wined3d.spec -@@ -281,7 +281,7 @@ - @ cdecl wined3d_swapchain_get_desc(ptr ptr) - @ cdecl wined3d_swapchain_get_raster_status(ptr ptr) - @ cdecl wined3d_swapchain_incref(ptr) --@ cdecl wined3d_swapchain_present(ptr ptr ptr ptr long) -+@ cdecl wined3d_swapchain_present(ptr ptr ptr ptr long long) - @ cdecl wined3d_swapchain_resize_buffers(ptr long long long long long long) - @ cdecl wined3d_swapchain_resize_target(ptr ptr) - @ cdecl wined3d_swapchain_set_fullscreen(ptr ptr ptr) -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 021c274..de1a6b5 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -3553,8 +3553,8 @@ void wined3d_cs_emit_draw_indirect(struct wined3d_cs *cs, GLenum primitive_type, - void wined3d_cs_emit_flush(struct wined3d_cs *cs) DECLSPEC_HIDDEN; - void wined3d_cs_emit_generate_mipmaps(struct wined3d_cs *cs, struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN; - void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; --void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, -- const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, const RECT *src_rect, -+ const RECT *dst_rect, HWND dst_window_override, DWORD swap_interval, DWORD flags) DECLSPEC_HIDDEN; - void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN; - void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN; - void wined3d_cs_emit_set_blend_state(struct wined3d_cs *cs, struct wined3d_blend_state *state) DECLSPEC_HIDDEN; -diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h -index b6a2ec3..96c1c25 100644 ---- a/include/wine/wined3d.h -+++ b/include/wine/wined3d.h -@@ -2656,7 +2656,7 @@ HRESULT __cdecl wined3d_swapchain_get_raster_status(const struct wined3d_swapcha - struct wined3d_raster_status *raster_status); - ULONG __cdecl wined3d_swapchain_incref(struct wined3d_swapchain *swapchain); - HRESULT __cdecl wined3d_swapchain_present(struct wined3d_swapchain *swapchain, -- const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags); -+ const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD swap_interval, DWORD flags); - HRESULT __cdecl wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapchain, unsigned int buffer_count, - unsigned int width, unsigned int height, enum wined3d_format_id format_id, - enum wined3d_multisample_type multisample_type, unsigned int multisample_quality); --- -2.7.4 - diff --git a/patches/wined3d-dxgi_swapchain_Present/definition b/patches/wined3d-dxgi_swapchain_Present/definition deleted file mode 100644 index c514c91e..00000000 --- a/patches/wined3d-dxgi_swapchain_Present/definition +++ /dev/null @@ -1,2 +0,0 @@ -Fixes: Implement vsync handling for d3d10/d3d11 -Depends: wined3d-Silence_FIXMEs diff --git a/patches/winex11-Vulkan-compile-fix/0001-winex11.drv-Fix-compile-error-when-Vulkan-isn-t-avai.patch b/patches/winex11-Vulkan-compile-fix/0001-winex11.drv-Fix-compile-error-when-Vulkan-isn-t-avai.patch deleted file mode 100644 index 29eb568a..00000000 --- a/patches/winex11-Vulkan-compile-fix/0001-winex11.drv-Fix-compile-error-when-Vulkan-isn-t-avai.patch +++ /dev/null @@ -1,30 +0,0 @@ -From f3bc9d9828f84d9899fd1b9ef42af3ea7027e258 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Thu, 22 Mar 2018 09:35:41 +1100 -Subject: [PATCH] winex11.drv: Fix compile error when Vulkan isn't avaiable - -Signed-off-by: Alistair Leslie-Hughes ---- - dlls/winex11.drv/vulkan.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c -index 27ff722..f96ef64 100644 ---- a/dlls/winex11.drv/vulkan.c -+++ b/dlls/winex11.drv/vulkan.c -@@ -37,10 +37,10 @@ - #include "wine/vulkan.h" - #include "wine/vulkan_driver.h" - --#ifdef SONAME_LIBVULKAN -- - WINE_DEFAULT_DEBUG_CHANNEL(vulkan); - -+#ifdef SONAME_LIBVULKAN -+ - typedef VkFlags VkXlibSurfaceCreateFlagsKHR; - #define VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR 1000004000 - --- -1.9.1 -