From 32bac8b64c57063cc597e69caed894287fbc3bd2 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 14 Feb 2019 11:08:02 +1100 Subject: [PATCH] Rebase against 7907ccfdcb39b30dc49c96c411332534525b6ea9 --- ...on-to-create-new-tokens-for-elevatio.patch | 26 +- ...core-Add-dll-and-stub-some-functions.patch | 9 +- ...-BCryptDeriveKeyPBKDF2-and-add-test-.patch | 351 --------- .../bcrypt-BCryptDeriveKeyPBKDF2/definition | 1 - ...-BCryptGenerate-FinalizeKeyPair-for-.patch | 678 ------------------ .../bcrypt-BCryptGenerateKeyPair/definition | 1 - .../bcrypt-BCryptSecretAgreement/definition | 1 - ...001-mfplat-Implement-MFGetSystemTime.patch | 69 -- patches/mfplat-MFGetSystemTime/definition | 1 - .../0001-ntdll-Add-dummy-apiset-to-PEB.patch | 14 +- ...t-for-hiding-wine-version-informatio.patch | 18 +- ...to-update-user-shared-data-into-a-se.patch | 18 +- ...ead-to-update-user_shared_data-time-.patch | 32 +- patches/patchinstall.sh | 77 +- .../0002-uianimation-Add-stub-dll.patch | 14 +- ...tubs-for-escapes-required-by-Adobe-P.patch | 118 --- ...cript-header-should-be-written-by-St.patch | 84 --- 17 files changed, 68 insertions(+), 1444 deletions(-) delete mode 100644 patches/bcrypt-BCryptDeriveKeyPBKDF2/0001-bcrypt-Implement-BCryptDeriveKeyPBKDF2-and-add-test-.patch delete mode 100644 patches/bcrypt-BCryptDeriveKeyPBKDF2/definition delete mode 100644 patches/bcrypt-BCryptGenerateKeyPair/0001-bcrypt-Implement-BCryptGenerate-FinalizeKeyPair-for-.patch delete mode 100644 patches/bcrypt-BCryptGenerateKeyPair/definition delete mode 100644 patches/mfplat-MFGetSystemTime/0001-mfplat-Implement-MFGetSystemTime.patch delete mode 100644 patches/mfplat-MFGetSystemTime/definition delete mode 100644 patches/wineps.drv-PostScript_Fixes/0003-wineps.drv-Add-stubs-for-escapes-required-by-Adobe-P.patch delete mode 100644 patches/wineps.drv-PostScript_Fixes/0005-wineps.drv-PostScript-header-should-be-written-by-St.patch diff --git a/patches/advapi32-Token_Integrity_Level/0006-ntdll-Add-function-to-create-new-tokens-for-elevatio.patch b/patches/advapi32-Token_Integrity_Level/0006-ntdll-Add-function-to-create-new-tokens-for-elevatio.patch index 9caae4f4..6c1d0d0c 100644 --- a/patches/advapi32-Token_Integrity_Level/0006-ntdll-Add-function-to-create-new-tokens-for-elevatio.patch +++ b/patches/advapi32-Token_Integrity_Level/0006-ntdll-Add-function-to-create-new-tokens-for-elevatio.patch @@ -1,4 +1,4 @@ -From b40b0c90a309b73a06ff71ee8a5e99d52a1fbde3 Mon Sep 17 00:00:00 2001 +From f94296129eb249a04ccb012a10f50b79fb0a631a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 5 Aug 2017 01:45:29 +0200 Subject: [PATCH] ntdll: Add function to create new tokens for elevation @@ -7,14 +7,14 @@ Subject: [PATCH] ntdll: Add function to create new tokens for elevation --- dlls/ntdll/ntdll.spec | 3 ++ dlls/ntdll/ntdll_misc.h | 3 ++ - dlls/ntdll/process.c | 18 +++++++++ - server/protocol.def | 8 ++++ + dlls/ntdll/process.c | 18 +++++++++++ + server/protocol.def | 8 +++++ server/security.h | 1 + - server/token.c | 84 +++++++++++++++++++++++++++++++++++++++++ + server/token.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 117 insertions(+) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec -index 969cee72eb4..008abb744a0 100644 +index 969cee7..008abb7 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1508,6 +1508,9 @@ @@ -28,12 +28,12 @@ index 969cee72eb4..008abb744a0 100644 @ cdecl wine_get_version() NTDLL_wine_get_version @ cdecl wine_get_patches() NTDLL_wine_get_patches diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index bad7d96d9da..6b71ded85b1 100644 +index 5a93ede..cb02bd1 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h -@@ -82,6 +82,9 @@ extern void fill_cpu_info(void) DECLSPEC_HIDDEN; - extern void heap_set_debug_flags( HANDLE handle ) DECLSPEC_HIDDEN; +@@ -83,6 +83,9 @@ extern void heap_set_debug_flags( HANDLE handle ) DECLSPEC_HIDDEN; extern void init_user_process_params( SIZE_T data_size ) DECLSPEC_HIDDEN; + extern void update_user_process_params( const UNICODE_STRING *image ) DECLSPEC_HIDDEN; +/* token */ +extern HANDLE CDECL __wine_create_default_token(BOOL admin); @@ -42,7 +42,7 @@ index bad7d96d9da..6b71ded85b1 100644 extern timeout_t server_start_time DECLSPEC_HIDDEN; extern unsigned int server_cpus DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c -index 2ff8610ccee..bb4a1719c3c 100644 +index 2ff8610..bb4a171 100644 --- a/dlls/ntdll/process.c +++ b/dlls/ntdll/process.c @@ -118,6 +118,24 @@ HANDLE CDECL __wine_make_process_system(void) @@ -71,7 +71,7 @@ index 2ff8610ccee..bb4a1719c3c 100644 #define UNIMPLEMENTED_INFO_CLASS(c) \ diff --git a/server/protocol.def b/server/protocol.def -index 493100b8922..071f7404087 100644 +index 493100b..071f740 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3666,6 +3666,14 @@ struct handle_info @@ -90,7 +90,7 @@ index 493100b8922..071f7404087 100644 @REQ(create_completion) unsigned int access; /* desired access to a port */ diff --git a/server/security.h b/server/security.h -index 6c337143c3d..21e90ccf23f 100644 +index 6c33714..21e90cc 100644 --- a/server/security.h +++ b/server/security.h @@ -49,6 +49,7 @@ extern const PSID security_builtin_users_sid; @@ -102,7 +102,7 @@ index 6c337143c3d..21e90ccf23f 100644 /* token functions */ diff --git a/server/token.c b/server/token.c -index 4c37c674abd..e449e61a4db 100644 +index 4c37c67..e449e61 100644 --- a/server/token.c +++ b/server/token.c @@ -79,6 +79,7 @@ static const SID anonymous_logon_sid = { SID_REVISION, 1, { SECURITY_NT_AUTHORIT @@ -215,5 +215,5 @@ index 4c37c674abd..e449e61a4db 100644 + } +} -- -2.20.1 +1.9.1 diff --git a/patches/api-ms-win-Stub_DLLs/0027-uiautomationcore-Add-dll-and-stub-some-functions.patch b/patches/api-ms-win-Stub_DLLs/0027-uiautomationcore-Add-dll-and-stub-some-functions.patch index 5be612cb..ad7555fe 100644 --- a/patches/api-ms-win-Stub_DLLs/0027-uiautomationcore-Add-dll-and-stub-some-functions.patch +++ b/patches/api-ms-win-Stub_DLLs/0027-uiautomationcore-Add-dll-and-stub-some-functions.patch @@ -1,4 +1,4 @@ -From ab6be2f28c6a3501a056e890a41b44d49c1e2eb0 Mon Sep 17 00:00:00 2001 +From 9a67b4c62e5a575a38081114d4434f274355020e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Tue, 12 Apr 2016 01:02:34 +0200 Subject: [PATCH] uiautomationcore: Add dll and stub some functions. @@ -9,17 +9,18 @@ Subject: [PATCH] uiautomationcore: Add dll and stub some functions. 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/dlls/uiautomationcore/Makefile.in b/dlls/uiautomationcore/Makefile.in -index 78d6254..029fc2e 100644 +index 5221450..5173f23 100644 --- a/dlls/uiautomationcore/Makefile.in +++ b/dlls/uiautomationcore/Makefile.in -@@ -1,4 +1,5 @@ +@@ -1,5 +1,6 @@ MODULE = uiautomationcore.dll + IMPORTLIB = uiautomationcore +IMPORTS = uuid C_SRCS = \ uia_main.c diff --git a/dlls/uiautomationcore/uia_main.c b/dlls/uiautomationcore/uia_main.c -index 31b7d3e..cc4831e 100644 +index f0d8247..b9c24b4 100644 --- a/dlls/uiautomationcore/uia_main.c +++ b/dlls/uiautomationcore/uia_main.c @@ -1,4 +1,5 @@ diff --git a/patches/bcrypt-BCryptDeriveKeyPBKDF2/0001-bcrypt-Implement-BCryptDeriveKeyPBKDF2-and-add-test-.patch b/patches/bcrypt-BCryptDeriveKeyPBKDF2/0001-bcrypt-Implement-BCryptDeriveKeyPBKDF2-and-add-test-.patch deleted file mode 100644 index 7226e199..00000000 --- a/patches/bcrypt-BCryptDeriveKeyPBKDF2/0001-bcrypt-Implement-BCryptDeriveKeyPBKDF2-and-add-test-.patch +++ /dev/null @@ -1,351 +0,0 @@ -From ff1967f048d2b32ad98e91b4f39edba0c425a8a9 Mon Sep 17 00:00:00 2001 -From: Jack Grigg -Date: Sat, 17 Mar 2018 21:14:05 +1100 -Subject: [PATCH] bcrypt: Implement BCryptDeriveKeyPBKDF2 and add test vectors. - -Fixes https://bugs.winehq.org/show_bug.cgi?id=42704 - -Tested on Ubuntu 16.04.2 LTS. - -v2 - Removed C++ comment - - Removed all warnings. - - Use heap_* functions - - Formatting changes. - -Signed-off-by: Jack Grigg ---- - dlls/bcrypt/bcrypt.spec | 1 + - dlls/bcrypt/bcrypt_main.c | 163 +++++++++++++++++++++++++++++++++++++++++++++ - dlls/bcrypt/tests/bcrypt.c | 83 +++++++++++++++++++++++ - dlls/ncrypt/ncrypt.spec | 2 +- - include/bcrypt.h | 1 + - 5 files changed, 249 insertions(+), 1 deletion(-) - -diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec -index 78824d7..f4d9a57 100644 ---- a/dlls/bcrypt/bcrypt.spec -+++ b/dlls/bcrypt/bcrypt.spec -@@ -8,6 +8,7 @@ - @ stdcall BCryptDecrypt(ptr ptr long ptr ptr long ptr long ptr long) - @ stub BCryptDeleteContext - @ stub BCryptDeriveKey -+@ stdcall BCryptDeriveKeyPBKDF2(ptr ptr long ptr long int64 ptr long long) - @ stdcall BCryptDestroyHash(ptr) - @ stdcall BCryptDestroyKey(ptr) - @ stub BCryptDestroySecret -diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 2b9ae0b..49ccb13 100644 ---- a/dlls/bcrypt/bcrypt_main.c -+++ b/dlls/bcrypt/bcrypt_main.c -@@ -1316,6 +1316,169 @@ NTSTATUS WINAPI BCryptSetProperty( BCRYPT_HANDLE handle, const WCHAR *prop, UCHA - } - } - -+NTSTATUS PBKDF2_F( BCRYPT_ALG_HANDLE algorithm, -+ UCHAR *password, ULONG password_length, -+ UCHAR *salt, ULONG salt_length, -+ ULONGLONG iterations, int i, -+ UCHAR *res, int hash_length ) -+{ -+ BCRYPT_HASH_HANDLE handle; -+ NTSTATUS status = STATUS_NOT_SUPPORTED; -+ UCHAR bytes[4]; -+ UCHAR *tmp; -+ int j; -+ int k; -+ -+ if (!(tmp = heap_alloc( hash_length ))) -+ { -+ return STATUS_NO_MEMORY; -+ } -+ -+ for (j = 0; j < iterations; j++) -+ { -+ status = BCryptCreateHash( algorithm, &handle, NULL, 0, -+ password, password_length, 0 ); -+ if (status != STATUS_SUCCESS) -+ goto done; -+ -+ if (j == 0) -+ { -+ /* Use salt || INT(i) */ -+ status = BCryptHashData( handle, salt, salt_length, 0 ); -+ if (status != STATUS_SUCCESS) -+ goto done; -+ bytes[0] = (i >> 24) & 0xFF; -+ bytes[1] = (i >> 16) & 0xFF; -+ bytes[2] = (i >> 8) & 0xFF; -+ bytes[3] = i & 0xFF; -+ status = BCryptHashData( handle, bytes, 4, 0 ); -+ } -+ else -+ { -+ /* Use U_j */ -+ status = BCryptHashData( handle, tmp, hash_length, 0 ); -+ } -+ if (status != STATUS_SUCCESS) -+ goto done; -+ -+ status = BCryptFinishHash( handle, tmp, hash_length, 0 ); -+ if (status != STATUS_SUCCESS) -+ goto done; -+ -+ status = BCryptDestroyHash( handle ); -+ if (status != STATUS_SUCCESS) -+ goto done; -+ -+ handle = NULL; -+ -+ if (j == 0) -+ { -+ /* Copy into res */ -+ memcpy( res, tmp, hash_length ); -+ } -+ else -+ { -+ /* XOR into res */ -+ for (k = 0; k < hash_length; k++) -+ res[k] ^= tmp[k]; -+ } -+ } -+ -+done: -+ TRACE("<- status 0x%08x\n", status); -+ if(handle) -+ BCryptDestroyHash( handle ); -+ heap_free( tmp ); -+ return status; -+} -+ -+/************************************************************ -+ * BCryptDeriveKeyPBKDF2 (BCRYPT.@) -+ * -+ * Derive a key from a password using the PBKDF2 function -+ * (RFC 2898). -+ * -+ * PARAMS -+ * handle [I] Pointer to the PRF provider -+ * password [I] Optional pointer to the beginning of the password -+ * password_length [I] Length of the password -+ * salt [I] Optional pointer to the beginning of the salt -+ * salt_length [I] Length of the salt -+ * iterations [I] Iteration count -+ * dk [O] Pointer to the beginning of the buffer to store the -+ * derived key in, at least dklen in size -+ * dklen [I] Intended length of the derived key, at most -+ * (2^32 - 1) * (output length of PRF) -+ * flags [I] Reserved, must be zero -+ * -+ * RETURNS -+ * Success: STATUS_SUCCESS. -+ * Failure: - STATUS_INVALID_HANDLE -+ * - STATUS_INVALID_PARAMETER -+ * - STATUS_NO_MEMORY -+ */ -+NTSTATUS WINAPI BCryptDeriveKeyPBKDF2( BCRYPT_ALG_HANDLE handle, -+ PUCHAR password, ULONG password_length, -+ PUCHAR salt, ULONG salt_length, -+ ULONGLONG iterations, -+ PUCHAR dk, ULONG dklen, -+ ULONG flags ) -+{ -+ struct algorithm *alg = handle; -+ int hlen = alg_props[alg->id].hash_length; -+ UCHAR *partial; -+ NTSTATUS status; -+ int l; -+ int r; -+ int i; -+ -+ TRACE( "%p, %p, %u, %p, %u, %s, %p, %u, %08x - stub\n", -+ handle, password, password_length, salt, salt_length, -+ wine_dbgstr_longlong(iterations), dk, dklen, flags ); -+ -+ if (dklen <= 0 || dklen > ((((ULONGLONG) 1) << 32) - 1) * hlen) -+ { -+ return STATUS_INVALID_PARAMETER; -+ } -+ -+ l = 1 + ((dklen - 1) / hlen); /* ceil(dklen/hlen) */ -+ r = dklen - (l - 1) * hlen; -+ -+ /* Full blocks */ -+ for (i = 1; i < l; i++) -+ { -+ status = PBKDF2_F( handle, -+ password, password_length, -+ salt, salt_length, -+ iterations, i, -+ dk + ((i - 1) * hlen), hlen ); -+ if (status != STATUS_SUCCESS) -+ { -+ return status; -+ } -+ } -+ -+ /* Final partial block */ -+ if (!(partial = heap_alloc( hlen ))) -+ { -+ return STATUS_NO_MEMORY; -+ } -+ status = PBKDF2_F( handle, -+ password, password_length, -+ salt, salt_length, -+ iterations, l, -+ partial, hlen ); -+ if (status != STATUS_SUCCESS) -+ { -+ heap_free( partial ); -+ return status; -+ } -+ memcpy( dk + ((l - 1) * hlen), partial, r ); -+ heap_free( partial ); -+ -+ return STATUS_SUCCESS; -+} -+ - BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) - { - switch (reason) -diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c -index 6865e87..5c4df6a 100644 ---- a/dlls/bcrypt/tests/bcrypt.c -+++ b/dlls/bcrypt/tests/bcrypt.c -@@ -36,6 +36,8 @@ static NTSTATUS (WINAPI *pBCryptHashData)(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULO - static NTSTATUS (WINAPI *pBCryptDuplicateHash)(BCRYPT_HASH_HANDLE, BCRYPT_HASH_HANDLE *, UCHAR *, ULONG, ULONG); - static NTSTATUS (WINAPI *pBCryptFinishHash)(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG); - static NTSTATUS (WINAPI *pBCryptDestroyHash)(BCRYPT_HASH_HANDLE); -+static NTSTATUS (WINAPI *pBCryptDeriveKeyPBKDF2)(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, -+ ULONGLONG, PUCHAR, ULONG, ULONG); - static NTSTATUS (WINAPI *pBCryptGenRandom)(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, ULONG); - static NTSTATUS (WINAPI *pBCryptGetProperty)(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG *, ULONG); - static NTSTATUS (WINAPI *pBCryptSetProperty)(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG); -@@ -396,6 +398,81 @@ static void test_BcryptHash(void) - ok(ret == STATUS_SUCCESS, "got %08x\n", ret); - } - -+/* Test vectors from RFC 6070 */ -+static UCHAR password[] = "password"; -+static UCHAR salt[] = "salt"; -+static UCHAR long_password[] = -+ "passwordPASSWORDpassword"; -+static UCHAR long_salt[] = -+ "saltSALTsaltSALTsaltSALTsaltSALTsalt"; -+static UCHAR password_NUL[] = "pass\0word"; -+static UCHAR salt_NUL[] = "sa\0lt"; -+ -+static UCHAR dk1[] = -+ "0c60c80f961f0e71f3a9b524af6012062fe037a6"; -+static UCHAR dk2[] = -+ "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957"; -+static UCHAR dk3[] = -+ "4b007901b765489abead49d926f721d065a429c1"; -+static UCHAR dk4[] = -+ "eefe3d61cd4da4e4e9945b3d6ba2158c2634e984"; -+static UCHAR dk5[] = -+ "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038"; -+static UCHAR dk6[] = -+ "56fa6aa75548099dcc37d7f03425e0c3"; -+ -+static const struct { -+ ULONG password_length; -+ ULONG salt_length; -+ ULONGLONG iterations; -+ ULONG dklen; -+ UCHAR *password; -+ UCHAR *salt; -+ const UCHAR *dk; -+} rfc6070[] = { -+ { 8, 4, 1, 20, password, salt, dk1 }, -+ { 8, 4, 2, 20, password, salt, dk2 }, -+ { 8, 4, 4096, 20, password, salt, dk3 }, -+ { 8, 4, 16777216, 20, password, salt, dk4 }, -+ { 24, 36, 4096, 25, long_password, long_salt, dk5 }, -+ { 9, 5, 4096, 16, password_NUL, salt_NUL, dk6 } -+}; -+ -+static void test_BcryptDeriveKeyPBKDF2(void) -+{ -+ BCRYPT_ALG_HANDLE alg; -+ UCHAR dk[25]; -+ char str[51]; -+ NTSTATUS ret; -+ int i; -+ -+ alg = NULL; -+ ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_SHA1_ALGORITHM, MS_PRIMITIVE_PROVIDER, -+ BCRYPT_ALG_HANDLE_HMAC_FLAG); -+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret); -+ ok(alg != NULL, "alg not set\n"); -+ -+ test_hash_length(alg, 20); -+ test_alg_name(alg, "SHA1"); -+ -+ for (i = 0; i < ARRAY_SIZE(rfc6070); i++) -+ { -+ memset(dk, 0, sizeof(dk)); -+ ret = pBCryptDeriveKeyPBKDF2(alg, -+ rfc6070[i].password, rfc6070[i].password_length, -+ rfc6070[i].salt, rfc6070[i].salt_length, -+ rfc6070[i].iterations, -+ dk, rfc6070[i].dklen, -+ 0); -+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret); -+ format_hash( dk, rfc6070[i].dklen, str ); -+ ok(!memcmp(str, rfc6070[i].dk, rfc6070[i].dklen), "got %s\n", str); -+ } -+ -+ ret = pBCryptCloseAlgorithmProvider(alg, 0); -+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret); -+} -+ - static void test_rng(void) - { - BCRYPT_ALG_HANDLE alg; -@@ -1630,6 +1707,7 @@ START_TEST(bcrypt) - pBCryptDuplicateHash = (void *)GetProcAddress(module, "BCryptDuplicateHash"); - pBCryptFinishHash = (void *)GetProcAddress(module, "BCryptFinishHash"); - pBCryptDestroyHash = (void *)GetProcAddress(module, "BCryptDestroyHash"); -+ pBCryptDeriveKeyPBKDF2 = (void *)GetProcAddress(module, "BCryptDeriveKeyPBKDF2"); - pBCryptGenRandom = (void *)GetProcAddress(module, "BCryptGenRandom"); - pBCryptGetProperty = (void *)GetProcAddress(module, "BCryptGetProperty"); - pBCryptSetProperty = (void *)GetProcAddress(module, "BCryptSetProperty"); -@@ -1660,5 +1738,10 @@ START_TEST(bcrypt) - else - win_skip("BCryptHash is not available\n"); - -+ if (pBCryptDeriveKeyPBKDF2) /* >= Win 7 */ -+ test_BcryptDeriveKeyPBKDF2(); -+ else -+ win_skip("BCryptDeriveKeyPBKDF2 is not available\n"); -+ - FreeLibrary(module); - } -diff --git a/dlls/ncrypt/ncrypt.spec b/dlls/ncrypt/ncrypt.spec -index e7b12e0..adc0999 100644 ---- a/dlls/ncrypt/ncrypt.spec -+++ b/dlls/ncrypt/ncrypt.spec -@@ -9,7 +9,7 @@ - @ stub BCryptDeleteContext - @ stub BCryptDeriveKey - @ stub BCryptDeriveKeyCapi --@ stub BCryptDeriveKeyPBKDF2 -+@ stdcall BCryptDeriveKeyPBKDF2(ptr ptr long ptr long int64 ptr long long) bcrypt.BCryptDeriveKeyPBKDF2 - @ stdcall BCryptDestroyHash(ptr) bcrypt.BCryptDestroyHash - @ stdcall BCryptDestroyKey(ptr) bcrypt.BCryptDestroyKey - @ stub BCryptDestroySecret -diff --git a/include/bcrypt.h b/include/bcrypt.h -index df54f62..d3e4b99 100644 ---- a/include/bcrypt.h -+++ b/include/bcrypt.h -@@ -217,6 +217,7 @@ typedef PVOID BCRYPT_HASH_HANDLE; - NTSTATUS WINAPI BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE, ULONG); - NTSTATUS WINAPI BCryptCreateHash(BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG); - NTSTATUS WINAPI BCryptDecrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG); -+NTSTATUS WINAPI BCryptDeriveKeyPBKDF2(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, ULONGLONG, PUCHAR, ULONG, ULONG); - NTSTATUS WINAPI BCryptDestroyHash(BCRYPT_HASH_HANDLE); - NTSTATUS WINAPI BCryptDestroyKey(BCRYPT_KEY_HANDLE); - NTSTATUS WINAPI BCryptEncrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG); --- -1.9.1 - diff --git a/patches/bcrypt-BCryptDeriveKeyPBKDF2/definition b/patches/bcrypt-BCryptDeriveKeyPBKDF2/definition deleted file mode 100644 index ad69b261..00000000 --- a/patches/bcrypt-BCryptDeriveKeyPBKDF2/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [42704] Implement BCryptDeriveKeyPBKDF2 diff --git a/patches/bcrypt-BCryptGenerateKeyPair/0001-bcrypt-Implement-BCryptGenerate-FinalizeKeyPair-for-.patch b/patches/bcrypt-BCryptGenerateKeyPair/0001-bcrypt-Implement-BCryptGenerate-FinalizeKeyPair-for-.patch deleted file mode 100644 index 3decf870..00000000 --- a/patches/bcrypt-BCryptGenerateKeyPair/0001-bcrypt-Implement-BCryptGenerate-FinalizeKeyPair-for-.patch +++ /dev/null @@ -1,678 +0,0 @@ -From e389506e3f5794441083739616be85071637907e Mon Sep 17 00:00:00 2001 -From: Hans Leidekker -Date: Tue, 5 Feb 2019 09:00:02 +1100 -Subject: [PATCH] bcrypt: Implement BCryptGenerate/FinalizeKeyPair for ECDH - P256. - ---- - dlls/bcrypt/bcrypt.spec | 4 +- - dlls/bcrypt/bcrypt_internal.h | 7 +- - dlls/bcrypt/bcrypt_main.c | 68 ++++++++++++++++- - dlls/bcrypt/gnutls.c | 165 +++++++++++++++++++++++++++++++++++++++--- - dlls/bcrypt/macos.c | 6 ++ - dlls/bcrypt/tests/bcrypt.c | 94 ++++++++++++++++++------ - dlls/ncrypt/ncrypt.spec | 4 +- - include/bcrypt.h | 12 ++- - 8 files changed, 318 insertions(+), 42 deletions(-) - -diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec -index f4d9a57..052a099 100644 ---- a/dlls/bcrypt/bcrypt.spec -+++ b/dlls/bcrypt/bcrypt.spec -@@ -22,11 +22,11 @@ - @ stub BCryptEnumProviders - @ stub BCryptEnumRegisteredProviders - @ stdcall BCryptExportKey(ptr ptr wstr ptr long ptr long) --@ stub BCryptFinalizeKeyPair -+@ stdcall BCryptFinalizeKeyPair(ptr long) - @ stdcall BCryptFinishHash(ptr ptr long long) - @ stub BCryptFreeBuffer - @ stdcall BCryptGenRandom(ptr ptr long long) --@ stub BCryptGenerateKeyPair -+@ stdcall BCryptGenerateKeyPair(ptr ptr long long) - @ stdcall BCryptGenerateSymmetricKey(ptr ptr ptr long ptr long long) - @ stdcall BCryptGetFipsAlgorithmMode(ptr) - @ stdcall BCryptGetProperty(ptr wstr ptr long ptr long) -diff --git a/dlls/bcrypt/bcrypt_internal.h b/dlls/bcrypt/bcrypt_internal.h -index 593e784..b6e3d0b 100644 ---- a/dlls/bcrypt/bcrypt_internal.h -+++ b/dlls/bcrypt/bcrypt_internal.h -@@ -125,6 +125,7 @@ enum alg_id - ALG_ID_SHA256, - ALG_ID_SHA384, - ALG_ID_SHA512, -+ ALG_ID_ECDH_P256, - ALG_ID_ECDSA_P256, - ALG_ID_ECDSA_P384, - }; -@@ -156,8 +157,9 @@ struct key_symmetric - - struct key_asymmetric - { -- UCHAR *pubkey; -- ULONG pubkey_len; -+ gnutls_privkey_t handle; -+ UCHAR *pubkey; -+ ULONG pubkey_len; - }; - - struct key -@@ -224,6 +226,7 @@ NTSTATUS key_symmetric_encrypt( struct key *, const UCHAR *, ULONG, UCHAR *, ULO - NTSTATUS key_symmetric_decrypt( struct key *, const UCHAR *, ULONG, UCHAR *, ULONG ) DECLSPEC_HIDDEN; - NTSTATUS key_symmetric_get_tag( struct key *, UCHAR *, ULONG ) DECLSPEC_HIDDEN; - NTSTATUS key_asymmetric_init( struct key *, struct algorithm *, const UCHAR *, ULONG ) DECLSPEC_HIDDEN; -+NTSTATUS key_asymmetric_generate( struct key * ) DECLSPEC_HIDDEN; - NTSTATUS key_asymmetric_verify( struct key *, void *, UCHAR *, ULONG, UCHAR *, ULONG, DWORD ) DECLSPEC_HIDDEN; - NTSTATUS key_destroy( struct key * ) DECLSPEC_HIDDEN; - BOOL key_is_symmetric( struct key * ) DECLSPEC_HIDDEN; -diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 9427ea7..38d006b 100644 ---- a/dlls/bcrypt/bcrypt_main.c -+++ b/dlls/bcrypt/bcrypt_main.c -@@ -114,6 +114,7 @@ alg_props[] = - /* ALG_ID_SHA256 */ { 286, 32, 512, BCRYPT_SHA256_ALGORITHM, FALSE }, - /* ALG_ID_SHA384 */ { 382, 48, 1024, BCRYPT_SHA384_ALGORITHM, FALSE }, - /* ALG_ID_SHA512 */ { 382, 64, 1024, BCRYPT_SHA512_ALGORITHM, FALSE }, -+ /* ALG_ID_ECDH_P256 */ { 0, 0, 0, BCRYPT_ECDH_P256_ALGORITHM, FALSE }, - /* ALG_ID_ECDSA_P256 */ { 0, 0, 0, BCRYPT_ECDSA_P256_ALGORITHM, FALSE }, - /* ALG_ID_ECDSA_P384 */ { 0, 0, 0, BCRYPT_ECDSA_P384_ALGORITHM, FALSE }, - }; -@@ -184,6 +185,7 @@ NTSTATUS WINAPI BCryptOpenAlgorithmProvider( BCRYPT_ALG_HANDLE *handle, LPCWSTR - else if (!strcmpW( id, BCRYPT_SHA256_ALGORITHM )) alg_id = ALG_ID_SHA256; - else if (!strcmpW( id, BCRYPT_SHA384_ALGORITHM )) alg_id = ALG_ID_SHA384; - else if (!strcmpW( id, BCRYPT_SHA512_ALGORITHM )) alg_id = ALG_ID_SHA512; -+ else if (!strcmpW( id, BCRYPT_ECDH_P256_ALGORITHM )) alg_id = ALG_ID_ECDH_P256; - else if (!strcmpW( id, BCRYPT_ECDSA_P256_ALGORITHM )) alg_id = ALG_ID_ECDSA_P256; - else if (!strcmpW( id, BCRYPT_ECDSA_P384_ALGORITHM )) alg_id = ALG_ID_ECDSA_P384; - else -@@ -811,6 +813,14 @@ static NTSTATUS key_export( struct key *key, const WCHAR *type, UCHAR *output, U - memcpy( output + sizeof(len), key->u.s.secret, key->u.s.secret_len ); - return STATUS_SUCCESS; - } -+ else if (!strcmpW( type, BCRYPT_ECCPUBLIC_BLOB )) -+ { -+ *size = key->u.a.pubkey_len; -+ if (output_len < key->u.a.pubkey_len) return STATUS_SUCCESS; -+ -+ memcpy( output, key->u.a.pubkey, key->u.a.pubkey_len ); -+ return STATUS_SUCCESS; -+ } - - FIXME( "unsupported key type %s\n", debugstr_w(type) ); - return STATUS_NOT_IMPLEMENTED; -@@ -1010,6 +1020,11 @@ static NTSTATUS key_import_pair( struct algorithm *alg, const WCHAR *type, BCRYP - - switch (alg->id) - { -+ case ALG_ID_ECDH_P256: -+ key_size = 32; -+ magic = BCRYPT_ECDH_PUBLIC_P256_MAGIC; -+ break; -+ - case ALG_ID_ECDSA_P256: - key_size = 32; - magic = BCRYPT_ECDSA_PUBLIC_P256_MAGIC; -@@ -1028,7 +1043,7 @@ static NTSTATUS key_import_pair( struct algorithm *alg, const WCHAR *type, BCRYP - if (ecc_blob->dwMagic != magic) return STATUS_NOT_SUPPORTED; - if (ecc_blob->cbKey != key_size) return STATUS_INVALID_PARAMETER; - -- if (!(key = heap_alloc( sizeof(*key) ))) return STATUS_NO_MEMORY; -+ if (!(key = heap_alloc_zero( sizeof(*key) ))) return STATUS_NO_MEMORY; - key->hdr.magic = MAGIC_KEY; - if ((status = key_asymmetric_init( key, alg, (BYTE *)ecc_blob, sizeof(*ecc_blob) + ecc_blob->cbKey * 2 ))) - { -@@ -1047,7 +1062,7 @@ static NTSTATUS key_import_pair( struct algorithm *alg, const WCHAR *type, BCRYP - if (input_len < sizeof(*rsa_blob)) return STATUS_INVALID_PARAMETER; - if (alg->id != ALG_ID_RSA || rsa_blob->Magic != BCRYPT_RSAPUBLIC_MAGIC) return STATUS_NOT_SUPPORTED; - -- if (!(key = heap_alloc( sizeof(*key) ))) return STATUS_NO_MEMORY; -+ if (!(key = heap_alloc_zero( sizeof(*key) ))) return STATUS_NO_MEMORY; - key->hdr.magic = MAGIC_KEY; - - size = sizeof(*rsa_blob) + rsa_blob->cbPublicExp + rsa_blob->cbModulus; -@@ -1135,6 +1150,18 @@ static NTSTATUS key_import_pair( struct algorithm *alg, const WCHAR *type, BCRYP - ERR( "support for keys not available at build time\n" ); - return STATUS_NOT_IMPLEMENTED; - } -+ -+NTSTATUS key_asymmetric_generate( struct key *key ) -+{ -+ FIXME( "support for keys not available at build time\n" ); -+ return STATUS_NOT_IMPLEMENTED; -+} -+ -+NTSTATUS key_asymmetric_init( struct key *key, struct algorithm *alg, const UCHAR *pubkey, ULONG pubkey_len ) -+{ -+ FIXME( "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, -@@ -1163,6 +1190,41 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_ - return STATUS_SUCCESS; - } - -+NTSTATUS WINAPI BCryptGenerateKeyPair( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HANDLE *handle, ULONG key_len, -+ ULONG flags ) -+{ -+ struct algorithm *alg = algorithm; -+ struct key *key; -+ NTSTATUS status; -+ -+ TRACE( "%p, %p, %u, %08x\n", algorithm, handle, key_len, flags ); -+ -+ if (!alg || alg->hdr.magic != MAGIC_ALG) return STATUS_INVALID_HANDLE; -+ if (!handle) return STATUS_INVALID_PARAMETER; -+ -+ if (!(key = heap_alloc_zero( sizeof(*key) ))) return STATUS_NO_MEMORY; -+ key->hdr.magic = MAGIC_KEY; -+ -+ if ((status = key_asymmetric_init( key, alg, NULL, 0 ))) -+ { -+ heap_free( key ); -+ return status; -+ } -+ -+ *handle = key; -+ return STATUS_SUCCESS; -+} -+ -+NTSTATUS WINAPI BCryptFinalizeKeyPair( BCRYPT_KEY_HANDLE handle, ULONG flags ) -+{ -+ struct key *key = handle; -+ -+ TRACE( "%p, %08x\n", key, flags ); -+ if (!key || key->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE; -+ -+ return key_asymmetric_generate( key ); -+} -+ - NTSTATUS WINAPI BCryptImportKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HANDLE decrypt_key, LPCWSTR type, - BCRYPT_KEY_HANDLE *key, PUCHAR object, ULONG object_len, PUCHAR input, - ULONG input_len, ULONG flags ) -@@ -1192,7 +1254,7 @@ NTSTATUS WINAPI BCryptExportKey( BCRYPT_KEY_HANDLE export_key, BCRYPT_KEY_HANDLE - TRACE("%p, %p, %s, %p, %u, %p, %u\n", key, encrypt_key, debugstr_w(type), output, output_len, size, flags); - - if (!key || key->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE; -- if (!output || !type || !size) return STATUS_INVALID_PARAMETER; -+ if (!type || !size) return STATUS_INVALID_PARAMETER; - - if (encrypt_key) - { -diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c -index 69276be..1b2905e 100644 ---- a/dlls/bcrypt/gnutls.c -+++ b/dlls/bcrypt/gnutls.c -@@ -52,6 +52,8 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag); - #define GNUTLS_CIPHER_AES_256_GCM 94 - #define GNUTLS_PK_ECC 4 - -+#define GNUTLS_CURVE_TO_BITS(curve) (unsigned int)(((unsigned int)1<<31)|((unsigned int)(curve))) -+ - typedef enum - { - GNUTLS_ECC_CURVE_INVALID, -@@ -62,14 +64,21 @@ typedef enum - } gnutls_ecc_curve_t; - #endif - -+#ifndef GNUTLS_PK_ECDSA -+#define GNUTLS_PK_ECDSA 4 -+#endif -+ - /* Not present in gnutls version < 3.0 */ - static int (*pgnutls_cipher_tag)(gnutls_cipher_hd_t, void *, size_t); - static int (*pgnutls_cipher_add_auth)(gnutls_cipher_hd_t, const void *, size_t); -+static int (*pgnutls_privkey_export_ecc_raw)(gnutls_privkey_t, gnutls_ecc_curve_t *, -+ gnutls_datum_t *, gnutls_datum_t *, gnutls_datum_t *); - static int (*pgnutls_pubkey_import_ecc_raw)(gnutls_pubkey_t, gnutls_ecc_curve_t, - const gnutls_datum_t *, const gnutls_datum_t *); - static gnutls_sign_algorithm_t (*pgnutls_pk_to_sign)(gnutls_pk_algorithm_t, gnutls_digest_algorithm_t); - static int (*pgnutls_pubkey_verify_hash2)(gnutls_pubkey_t, gnutls_sign_algorithm_t, unsigned int, - const gnutls_datum_t *, const gnutls_datum_t *); -+static int (*pgnutls_privkey_generate)(gnutls_privkey_t, gnutls_pk_algorithm_t, unsigned int, unsigned int); - - /* Not present in gnutls version < 2.11.0 */ - static int (*pgnutls_pubkey_import_rsa_raw)(gnutls_pubkey_t key, const gnutls_datum_t *m, const gnutls_datum_t *e); -@@ -85,8 +94,10 @@ MAKE_FUNCPTR(gnutls_global_init); - MAKE_FUNCPTR(gnutls_global_set_log_function); - MAKE_FUNCPTR(gnutls_global_set_log_level); - MAKE_FUNCPTR(gnutls_perror); --MAKE_FUNCPTR(gnutls_pubkey_init); -+MAKE_FUNCPTR(gnutls_privkey_deinit); -+MAKE_FUNCPTR(gnutls_privkey_init); - MAKE_FUNCPTR(gnutls_pubkey_deinit); -+MAKE_FUNCPTR(gnutls_pubkey_init); - #undef MAKE_FUNCPTR - - static int compat_gnutls_cipher_tag(gnutls_cipher_hd_t handle, void *tag, size_t tag_size) -@@ -102,7 +113,13 @@ static int compat_gnutls_cipher_add_auth(gnutls_cipher_hd_t handle, const void * - static int compat_gnutls_pubkey_import_ecc_raw(gnutls_pubkey_t key, gnutls_ecc_curve_t curve, - const gnutls_datum_t *x, const gnutls_datum_t *y) - { -- return GNUTLS_E_UNKNOWN_CIPHER_TYPE; -+ return GNUTLS_E_UNKNOWN_PK_ALGORITHM; -+} -+ -+static int compat_gnutls_privkey_export_ecc_raw(gnutls_privkey_t key, gnutls_ecc_curve_t *curve, -+ gnutls_datum_t *x, gnutls_datum_t *y, gnutls_datum_t *k) -+{ -+ return GNUTLS_E_UNKNOWN_PK_ALGORITHM; - } - - static gnutls_sign_algorithm_t compat_gnutls_pk_to_sign(gnutls_pk_algorithm_t pk, gnutls_digest_algorithm_t hash) -@@ -114,12 +131,18 @@ static int compat_gnutls_pubkey_verify_hash2(gnutls_pubkey_t key, gnutls_sign_al - unsigned int flags, const gnutls_datum_t *hash, - const gnutls_datum_t *signature) - { -- return GNUTLS_E_UNKNOWN_CIPHER_TYPE; -+ return GNUTLS_E_UNKNOWN_PK_ALGORITHM; - } - - static int compat_gnutls_pubkey_import_rsa_raw(gnutls_pubkey_t key, const gnutls_datum_t *m, const gnutls_datum_t *e) - { -- return GNUTLS_E_UNKNOWN_CIPHER_TYPE; -+ return GNUTLS_E_UNKNOWN_PK_ALGORITHM; -+} -+ -+static int compat_gnutls_privkey_generate(gnutls_privkey_t key, gnutls_pk_algorithm_t algo, unsigned int bits, -+ unsigned int flags) -+{ -+ return GNUTLS_E_UNKNOWN_PK_ALGORITHM; - } - - static void gnutls_log( int level, const char *msg ) -@@ -153,8 +176,10 @@ BOOL gnutls_initialize(void) - LOAD_FUNCPTR(gnutls_global_set_log_function) - LOAD_FUNCPTR(gnutls_global_set_log_level) - LOAD_FUNCPTR(gnutls_perror) -- LOAD_FUNCPTR(gnutls_pubkey_init); -+ LOAD_FUNCPTR(gnutls_privkey_deinit); -+ LOAD_FUNCPTR(gnutls_privkey_init); - LOAD_FUNCPTR(gnutls_pubkey_deinit); -+ LOAD_FUNCPTR(gnutls_pubkey_init); - #undef LOAD_FUNCPTR - - if (!(pgnutls_cipher_tag = wine_dlsym( libgnutls_handle, "gnutls_cipher_tag", NULL, 0 ))) -@@ -178,6 +203,11 @@ BOOL gnutls_initialize(void) - WARN("gnutls_pubkey_import_ecc_raw not found\n"); - pgnutls_pubkey_import_ecc_raw = compat_gnutls_pubkey_import_ecc_raw; - } -+ if (!(pgnutls_privkey_export_ecc_raw = wine_dlsym( libgnutls_handle, "gnutls_privkey_export_ecc_raw", NULL, 0 ))) -+ { -+ WARN("gnutls_privkey_export_ecc_raw not found\n"); -+ pgnutls_privkey_export_ecc_raw = compat_gnutls_privkey_export_ecc_raw; -+ } - if (!(pgnutls_pk_to_sign = wine_dlsym( libgnutls_handle, "gnutls_pk_to_sign", NULL, 0 ))) - { - WARN("gnutls_pk_to_sign not found\n"); -@@ -194,6 +224,12 @@ BOOL gnutls_initialize(void) - pgnutls_pubkey_import_rsa_raw = compat_gnutls_pubkey_import_rsa_raw; - } - -+ if (!(pgnutls_pubkey_import_rsa_raw = wine_dlsym( libgnutls_handle, "gnutls_privkey_generate", NULL, 0 ))) -+ { -+ WARN("gnutls_privkey_generate not found\n"); -+ pgnutls_privkey_generate = compat_gnutls_privkey_generate; -+ } -+ - if (TRACE_ON( bcrypt )) - { - pgnutls_global_set_log_level( 4 ); -@@ -488,12 +524,114 @@ NTSTATUS key_symmetric_get_tag( struct key *key, UCHAR *tag, ULONG len ) - return STATUS_SUCCESS; - } - -+static NTSTATUS export_gnutls_pubkey_ecc( gnutls_privkey_t gnutls_key, UCHAR **pubkey, ULONG *pubkey_len ) -+{ -+ BCRYPT_ECCKEY_BLOB *ecc_blob; -+ gnutls_ecc_curve_t curve; -+ gnutls_datum_t x, y; -+ DWORD magic, size; -+ UCHAR *src, *dst; -+ int ret; -+ -+ if ((ret = pgnutls_privkey_export_ecc_raw( gnutls_key, &curve, &x, &y, NULL ))) -+ { -+ pgnutls_perror( ret ); -+ return STATUS_INTERNAL_ERROR; -+ } -+ -+ switch (curve) -+ { -+ case GNUTLS_ECC_CURVE_SECP256R1: -+ magic = BCRYPT_ECDH_PUBLIC_P256_MAGIC; -+ size = 32; -+ break; -+ -+ default: -+ FIXME( "curve %u not supported\n", curve ); -+ free( x.data ); free( y.data ); -+ return STATUS_NOT_IMPLEMENTED; -+ } -+ -+ if (!(ecc_blob = heap_alloc( sizeof(*ecc_blob) + x.size + y.size ))) -+ { -+ pgnutls_perror( ret ); -+ free( x.data ); free( y.data ); -+ return STATUS_NO_MEMORY; -+ } -+ -+ ecc_blob->dwMagic = magic; -+ ecc_blob->cbKey = size; -+ -+ dst = (UCHAR *)(ecc_blob + 1); -+ if (x.size == size + 1) src = x.data + 1; -+ else src = x.data; -+ memcpy( dst, src, size ); -+ -+ dst += size; -+ if (y.size == size + 1) src = y.data + 1; -+ else src = y.data; -+ memcpy( dst, src, size ); -+ -+ *pubkey = (UCHAR *)ecc_blob; -+ *pubkey_len = sizeof(*ecc_blob) + ecc_blob->cbKey * 2; -+ -+ free( x.data ); free( y.data ); -+ return STATUS_SUCCESS; -+} -+ -+NTSTATUS key_asymmetric_generate( struct key *key ) -+{ -+ gnutls_pk_algorithm_t pk_alg; -+ gnutls_ecc_curve_t curve; -+ gnutls_privkey_t handle; -+ NTSTATUS status; -+ int ret; -+ -+ if (!libgnutls_handle) return STATUS_INTERNAL_ERROR; -+ -+ switch (key->alg_id) -+ { -+ case ALG_ID_ECDH_P256: -+ pk_alg = GNUTLS_PK_ECDSA; /* compatible with ECDSA and ECDH */ -+ curve = GNUTLS_ECC_CURVE_SECP256R1; -+ break; -+ -+ default: -+ FIXME( "algorithm %u not supported\n", key->alg_id ); -+ return STATUS_NOT_SUPPORTED; -+ } -+ -+ if ((ret = pgnutls_privkey_init( &handle ))) -+ { -+ pgnutls_perror( ret ); -+ return STATUS_INTERNAL_ERROR; -+ } -+ -+ if ((ret = pgnutls_privkey_generate( handle, pk_alg, GNUTLS_CURVE_TO_BITS(curve), 0 ))) -+ { -+ pgnutls_perror( ret ); -+ pgnutls_privkey_deinit( handle ); -+ return STATUS_INTERNAL_ERROR; -+ } -+ -+ if ((status = export_gnutls_pubkey_ecc( handle, &key->u.a.pubkey, &key->u.a.pubkey_len ))) -+ { -+ pgnutls_privkey_deinit( handle ); -+ return STATUS_INTERNAL_ERROR; -+ } -+ -+ key->u.a.handle = handle; -+ -+ return STATUS_SUCCESS; -+} -+ - NTSTATUS key_asymmetric_init( struct key *key, struct algorithm *alg, const UCHAR *pubkey, ULONG pubkey_len ) - { - if (!libgnutls_handle) return STATUS_INTERNAL_ERROR; - - switch (alg->id) - { -+ case ALG_ID_ECDH_P256: - case ALG_ID_ECDSA_P256: - case ALG_ID_ECDSA_P384: - case ALG_ID_RSA: -@@ -504,10 +642,13 @@ NTSTATUS key_asymmetric_init( struct key *key, struct algorithm *alg, const UCHA - return STATUS_NOT_SUPPORTED; - } - -- if (!(key->u.a.pubkey = heap_alloc( pubkey_len ))) return STATUS_NO_MEMORY; -- memcpy( key->u.a.pubkey, pubkey, pubkey_len ); -- key->u.a.pubkey_len = pubkey_len; -- key->alg_id = alg->id; -+ if (pubkey_len) -+ { -+ if (!(key->u.a.pubkey = heap_alloc( pubkey_len ))) return STATUS_NO_MEMORY; -+ memcpy( key->u.a.pubkey, pubkey, pubkey_len ); -+ key->u.a.pubkey_len = pubkey_len; -+ } -+ key->alg_id = alg->id; - - return STATUS_SUCCESS; - } -@@ -728,7 +869,11 @@ NTSTATUS key_destroy( struct key *key ) - if (key->u.s.handle) pgnutls_cipher_deinit( key->u.s.handle ); - heap_free( key->u.s.secret ); - } -- else heap_free( key->u.a.pubkey ); -+ else -+ { -+ if (key->u.a.handle) pgnutls_privkey_deinit( key->u.a.handle ); -+ heap_free( key->u.a.pubkey ); -+ } - heap_free( key ); - return STATUS_SUCCESS; - } -diff --git a/dlls/bcrypt/macos.c b/dlls/bcrypt/macos.c -index a6eaee8..0e0ed83 100644 ---- a/dlls/bcrypt/macos.c -+++ b/dlls/bcrypt/macos.c -@@ -205,6 +205,12 @@ NTSTATUS key_asymmetric_verify( struct key *key, void *padding, UCHAR *hash, ULO - return STATUS_NOT_IMPLEMENTED; - } - -+NTSTATUS key_asymmetric_generate( struct key *key ) -+{ -+ FIXME( "not implemented on Mac\n" ); -+ return STATUS_NOT_IMPLEMENTED; -+} -+ - NTSTATUS key_destroy( struct key *key ) - { - if (key->u.s.ref_encrypt) CCCryptorRelease( key->u.s.ref_encrypt ); -diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c -index c635fcb..f88e48f 100644 ---- a/dlls/bcrypt/tests/bcrypt.c -+++ b/dlls/bcrypt/tests/bcrypt.c -@@ -26,34 +26,36 @@ - - #include "wine/test.h" - --static NTSTATUS (WINAPI *pBCryptOpenAlgorithmProvider)(BCRYPT_ALG_HANDLE *, LPCWSTR, LPCWSTR, ULONG); - static NTSTATUS (WINAPI *pBCryptCloseAlgorithmProvider)(BCRYPT_ALG_HANDLE, ULONG); --static NTSTATUS (WINAPI *pBCryptGetFipsAlgorithmMode)(BOOLEAN *); - static NTSTATUS (WINAPI *pBCryptCreateHash)(BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE *, PUCHAR, ULONG, PUCHAR, -- ULONG, ULONG); --static NTSTATUS (WINAPI *pBCryptHash)(BCRYPT_ALG_HANDLE, UCHAR *, ULONG, UCHAR *, ULONG, UCHAR *, ULONG); --static NTSTATUS (WINAPI *pBCryptHashData)(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG); --static NTSTATUS (WINAPI *pBCryptDuplicateHash)(BCRYPT_HASH_HANDLE, BCRYPT_HASH_HANDLE *, UCHAR *, ULONG, ULONG); --static NTSTATUS (WINAPI *pBCryptFinishHash)(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG); --static NTSTATUS (WINAPI *pBCryptDestroyHash)(BCRYPT_HASH_HANDLE); -+ ULONG, ULONG); -+static NTSTATUS (WINAPI *pBCryptDecrypt)(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, -+ ULONG *, ULONG); - static NTSTATUS (WINAPI *pBCryptDeriveKeyPBKDF2)(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, - ULONGLONG, PUCHAR, ULONG, ULONG); --static NTSTATUS (WINAPI *pBCryptGenRandom)(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, ULONG); --static NTSTATUS (WINAPI *pBCryptGetProperty)(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG *, ULONG); --static NTSTATUS (WINAPI *pBCryptSetProperty)(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG); --static NTSTATUS (WINAPI *pBCryptGenerateSymmetricKey)(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, PUCHAR, ULONG, -- PUCHAR, ULONG, ULONG); --static NTSTATUS (WINAPI *pBCryptEncrypt)(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, -- 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 *pBCryptDestroyHash)(BCRYPT_HASH_HANDLE); - 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); -+static NTSTATUS (WINAPI *pBCryptDuplicateHash)(BCRYPT_HASH_HANDLE, BCRYPT_HASH_HANDLE *, UCHAR *, ULONG, ULONG); -+static NTSTATUS (WINAPI *pBCryptDuplicateKey)(BCRYPT_KEY_HANDLE, BCRYPT_KEY_HANDLE *, UCHAR *, ULONG, ULONG); -+static NTSTATUS (WINAPI *pBCryptEncrypt)(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, -+ ULONG *, ULONG); - static NTSTATUS (WINAPI *pBCryptExportKey)(BCRYPT_KEY_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG *, ULONG); --static NTSTATUS (WINAPI *pBCryptImportKeyPair)(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, BCRYPT_KEY_HANDLE *, UCHAR *, ULONG, ULONG); --static NTSTATUS (WINAPI *pBCryptVerifySignature)(BCRYPT_KEY_HANDLE, VOID *, UCHAR *, ULONG, UCHAR *, ULONG, ULONG); -+static NTSTATUS (WINAPI *pBCryptFinalizeKeyPair)(BCRYPT_KEY_HANDLE, ULONG); -+static NTSTATUS (WINAPI *pBCryptFinishHash)(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG); -+static NTSTATUS (WINAPI *pBCryptGenerateKeyPair)(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, ULONG, ULONG); -+static NTSTATUS (WINAPI *pBCryptGenerateSymmetricKey)(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, PUCHAR, ULONG, -+ PUCHAR, ULONG, ULONG); -+static NTSTATUS (WINAPI *pBCryptGetFipsAlgorithmMode)(BOOLEAN *); -+static NTSTATUS (WINAPI *pBCryptGetProperty)(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG *, ULONG); -+static NTSTATUS (WINAPI *pBCryptGenRandom)(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, ULONG); -+static NTSTATUS (WINAPI *pBCryptHash)(BCRYPT_ALG_HANDLE, UCHAR *, ULONG, UCHAR *, ULONG, UCHAR *, ULONG); -+static NTSTATUS (WINAPI *pBCryptHashData)(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG); -+static NTSTATUS (WINAPI *pBCryptImportKey)(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, BCRYPT_KEY_HANDLE *, -+ PUCHAR, ULONG, PUCHAR, ULONG, ULONG); -+static NTSTATUS (WINAPI *pBCryptImportKeyPair)(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, BCRYPT_KEY_HANDLE *, -+ UCHAR *, ULONG, ULONG); -+static NTSTATUS (WINAPI *pBCryptOpenAlgorithmProvider)(BCRYPT_ALG_HANDLE *, LPCWSTR, LPCWSTR, ULONG); -+static NTSTATUS (WINAPI *pBCryptSetProperty)(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG);static NTSTATUS (WINAPI *pBCryptVerifySignature)(BCRYPT_KEY_HANDLE, VOID *, UCHAR *, ULONG, UCHAR *, ULONG, ULONG); - - static void test_BCryptGenRandom(void) - { -@@ -1731,6 +1733,53 @@ static void test_RSA(void) - ok(!ret, "pBCryptCloseAlgorithmProvider failed: %08x\n", ret); - } - -+static void test_ECDH(void) -+{ -+ BYTE *buf; -+ BCRYPT_ECCKEY_BLOB *ecckey; -+ BCRYPT_ALG_HANDLE alg; -+ BCRYPT_KEY_HANDLE key; -+ NTSTATUS status; -+ ULONG size; -+ -+ status = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_ECDH_P256_ALGORITHM, NULL, 0); -+ if (status) -+ { -+ skip("Failed to open BCRYPT_ECDH_P256_ALGORITHM provider %08x\n", status); -+ return; -+ } -+ -+ key = NULL; -+ status = pBCryptGenerateKeyPair(alg, &key, 256, 0); -+ ok(status == STATUS_SUCCESS, "got %08x\n", status); -+ ok(key != NULL, "key not set\n"); -+ -+ status = pBCryptFinalizeKeyPair(key, 0); -+ ok(status == STATUS_SUCCESS, "got %08x\n", status); -+ -+ size = 0; -+ SetLastError(0xdeadbeef); -+ status = pBCryptExportKey(key, NULL, BCRYPT_ECCPUBLIC_BLOB, NULL, 0, &size, 0); -+ ok(status == STATUS_SUCCESS, "got %08x\n", status); -+ ok(size, "size not set\n"); -+ -+ buf = HeapAlloc(GetProcessHeap(), 0, size); -+ status = pBCryptExportKey(key, NULL, BCRYPT_ECCPUBLIC_BLOB, buf, size, &size, 0); -+ ok(status == STATUS_SUCCESS, "got %08x\n", status); -+ ecckey = (BCRYPT_ECCKEY_BLOB *)buf; -+ ok(ecckey->dwMagic == BCRYPT_ECDH_PUBLIC_P256_MAGIC, "got %08x\n", ecckey->dwMagic); -+ ok(ecckey->cbKey == 32, "got %u\n", ecckey->cbKey); -+ ok(size == sizeof(*ecckey) + ecckey->cbKey * 2, "got %u\n", size); -+ pBCryptDestroyKey(key); -+ -+ status = BCryptImportKeyPair(alg, NULL, BCRYPT_ECCPUBLIC_BLOB, &key, buf, size, 0); -+ ok(status == STATUS_SUCCESS, "got %08x\n", status); -+ HeapFree(GetProcessHeap(), 0, buf); -+ -+ pBCryptDestroyKey(key); -+ pBCryptCloseAlgorithmProvider(alg, 0); -+} -+ - START_TEST(bcrypt) - { - HMODULE module; -@@ -1776,6 +1825,7 @@ START_TEST(bcrypt) - test_key_import_export(); - test_ECDSA(); - test_RSA(); -+ test_ECDH(); - - if (pBCryptHash) /* >= Win 10 */ - test_BcryptHash(); -diff --git a/dlls/ncrypt/ncrypt.spec b/dlls/ncrypt/ncrypt.spec -index adc0999..85fa5c0 100644 ---- a/dlls/ncrypt/ncrypt.spec -+++ b/dlls/ncrypt/ncrypt.spec -@@ -23,11 +23,11 @@ - @ stub BCryptEnumProviders - @ stub BCryptEnumRegisteredProviders - @ stdcall BCryptExportKey(ptr ptr wstr ptr long ptr long) bcrypt.BCryptExportKey --@ stub BCryptFinalizeKeyPair -+@ stdcall BCryptFinalizeKeyPair(ptr long) bcrypt.BCryptFinalizeKeyPair - @ stdcall BCryptFinishHash(ptr ptr long long) bcrypt.BCryptFinishHash - @ stub BCryptFreeBuffer - @ stdcall BCryptGenRandom(ptr ptr long long) bcrypt.BCryptGenRandom --@ stub BCryptGenerateKeyPair -+@ stdcall BCryptGenerateKeyPair(ptr ptr long long) bcrypt.BCryptGenerateKeyPair - @ stdcall BCryptGenerateSymmetricKey(ptr ptr ptr long ptr long long) bcrypt.BCryptGenerateSymmetricKey - @ stdcall BCryptGetFipsAlgorithmMode(ptr) bcrypt.BCryptGetFipsAlgorithmMode - @ stdcall BCryptGetProperty(ptr wstr ptr long ptr long) bcrypt.BCryptGetProperty -diff --git a/include/bcrypt.h b/include/bcrypt.h -index d3e4b99..ba78c1d 100644 ---- a/include/bcrypt.h -+++ b/include/bcrypt.h -@@ -81,6 +81,7 @@ typedef LONG NTSTATUS; - #define BCRYPT_SHA256_ALGORITHM (const WCHAR []){'S','H','A','2','5','6',0} - #define BCRYPT_SHA384_ALGORITHM (const WCHAR []){'S','H','A','3','8','4',0} - #define BCRYPT_SHA512_ALGORITHM (const WCHAR []){'S','H','A','5','1','2',0} -+#define BCRYPT_ECDH_P256_ALGORITHM (const WCHAR []){'E','C','D','H','_','P','2','5','6',0} - #define BCRYPT_ECDSA_P256_ALGORITHM (const WCHAR []){'E','C','D','S','A','_','P','2','5','6',0} - #define BCRYPT_ECDSA_P384_ALGORITHM (const WCHAR []){'E','C','D','S','A','_','P','3','8','4',0} - #define BCRYPT_ECDSA_P521_ALGORITHM (const WCHAR []){'E','C','D','S','A','_','P','5','2','1',0} -@@ -99,6 +100,13 @@ typedef LONG NTSTATUS; - #define BCRYPT_ECDSA_PUBLIC_P521_MAGIC 0x35534345 - #define BCRYPT_ECDSA_PRIVATE_P521_MAGIC 0x36534345 - -+#define BCRYPT_ECDH_PUBLIC_P256_MAGIC 0x314b4345 -+#define BCRYPT_ECDH_PRIVATE_P256_MAGIC 0x324b4345 -+#define BCRYPT_ECDH_PUBLIC_P384_MAGIC 0x334b4345 -+#define BCRYPT_ECDH_PRIVATE_P384_MAGIC 0x344b4345 -+#define BCRYPT_ECDH_PUBLIC_P521_MAGIC 0x354b4345 -+#define BCRYPT_ECDH_PRIVATE_P521_MAGIC 0x364b4345 -+ - typedef struct _BCRYPT_ALGORITHM_IDENTIFIER - { - LPWSTR pszName; -@@ -220,9 +228,12 @@ NTSTATUS WINAPI BCryptDecrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, - NTSTATUS WINAPI BCryptDeriveKeyPBKDF2(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, ULONGLONG, PUCHAR, ULONG, ULONG); - NTSTATUS WINAPI BCryptDestroyHash(BCRYPT_HASH_HANDLE); - NTSTATUS WINAPI BCryptDestroyKey(BCRYPT_KEY_HANDLE); -+NTSTATUS WINAPI BCryptDuplicateHash(BCRYPT_HASH_HANDLE, BCRYPT_HASH_HANDLE *, UCHAR *, ULONG, ULONG); - NTSTATUS WINAPI BCryptEncrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG); - NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG, ULONG *, BCRYPT_ALGORITHM_IDENTIFIER **, ULONG); -+NTSTATUS WINAPI BCryptFinalizeKeyPair(BCRYPT_KEY_HANDLE, ULONG); - NTSTATUS WINAPI BCryptFinishHash(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG); -+NTSTATUS WINAPI BCryptGenerateKeyPair(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, ULONG, ULONG); - NTSTATUS WINAPI BCryptGenerateSymmetricKey(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG); - NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, ULONG); - NTSTATUS WINAPI BCryptGetFipsAlgorithmMode(BOOLEAN *); -@@ -232,7 +243,6 @@ NTSTATUS WINAPI BCryptHashData(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG); - NTSTATUS WINAPI BCryptImportKeyPair(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, BCRYPT_KEY_HANDLE *, UCHAR *, ULONG, ULONG); - NTSTATUS WINAPI BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE *, LPCWSTR, LPCWSTR, ULONG); - NTSTATUS WINAPI BCryptSetProperty(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG); --NTSTATUS WINAPI BCryptDuplicateHash(BCRYPT_HASH_HANDLE, BCRYPT_HASH_HANDLE *, UCHAR *, ULONG, ULONG); - NTSTATUS WINAPI BCryptVerifySignature(BCRYPT_KEY_HANDLE, void *, UCHAR *, ULONG, UCHAR *, ULONG, ULONG); - - #endif /* __WINE_BCRYPT_H */ --- -1.9.1 - diff --git a/patches/bcrypt-BCryptGenerateKeyPair/definition b/patches/bcrypt-BCryptGenerateKeyPair/definition deleted file mode 100644 index d6fdff34..00000000 --- a/patches/bcrypt-BCryptGenerateKeyPair/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [45312] Fix issue for Assassin's Creed : Syndicate diff --git a/patches/bcrypt-BCryptSecretAgreement/definition b/patches/bcrypt-BCryptSecretAgreement/definition index d85e29e9..b44f001e 100644 --- a/patches/bcrypt-BCryptSecretAgreement/definition +++ b/patches/bcrypt-BCryptSecretAgreement/definition @@ -1,2 +1 @@ Fixes: [46564] Add BCryptDestroySecret/BCryptSecretAgreement stubs. -Depends: bcrypt-BCryptGenerateKeyPair diff --git a/patches/mfplat-MFGetSystemTime/0001-mfplat-Implement-MFGetSystemTime.patch b/patches/mfplat-MFGetSystemTime/0001-mfplat-Implement-MFGetSystemTime.patch deleted file mode 100644 index 25edb4ed..00000000 --- a/patches/mfplat-MFGetSystemTime/0001-mfplat-Implement-MFGetSystemTime.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 544deb6c0d9ae04d3b82d241f7ffe6a21fa3835f Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 17 Dec 2018 11:21:48 +1100 -Subject: [PATCH] mfplat: Implement MFGetSystemTime - -Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=46300 -Signed-off-by: Alistair Leslie-Hughes ---- - dlls/mfplat/main.c | 17 +++++++++++++++++ - dlls/mfplat/mfplat.spec | 2 +- - include/mfidl.idl | 1 + - 3 files changed, 19 insertions(+), 1 deletion(-) - -diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c -index c7c3465..1e8e2ea 100644 ---- a/dlls/mfplat/main.c -+++ b/dlls/mfplat/main.c -@@ -248,6 +248,23 @@ HRESULT WINAPI MFTUnregisterLocal(IClassFactory *factory) - return S_OK; - } - -+MFTIME WINAPI MFGetSystemTime() -+{ -+ SYSTEMTIME st; -+ FILETIME ft; -+ MFTIME mf; -+ -+ TRACE("()\n"); -+ -+ GetSystemTime(&st); -+ -+ SystemTimeToFileTime(&st, &ft); -+ -+ memcpy(&mf, &ft, sizeof(FILETIME)); -+ -+ return mf; -+} -+ - static BOOL match_type(const WCHAR *clsid_str, const WCHAR *type_str, MFT_REGISTER_TYPE_INFO *type) - { - HKEY htransform, hfilter; -diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec -index c828aea..349b926 100644 ---- a/dlls/mfplat/mfplat.spec -+++ b/dlls/mfplat/mfplat.spec -@@ -98,7 +98,7 @@ - @ stub MFGetPrivateWorkqueues - @ stub MFGetSockaddrFromNumericName - @ stub MFGetStrideForBitmapInfoHeader --@ stub MFGetSystemTime -+@ stdcall MFGetSystemTime() - @ stub MFGetTimerPeriodicity - @ stub MFGetUncompressedVideoFormat - @ stub MFGetWorkQueueMMCSSClass -diff --git a/include/mfidl.idl b/include/mfidl.idl -index 2373e41..2fdb288 100644 ---- a/include/mfidl.idl -+++ b/include/mfidl.idl -@@ -313,6 +313,7 @@ cpp_quote(" IMFMediaType **types, IMFStreamDescriptor **descriptor);") - cpp_quote("HRESULT WINAPI MFCreateTopology(IMFTopology **topology);") - cpp_quote("HRESULT WINAPI MFGetSupportedMimeTypes(PROPVARIANT *array);") - cpp_quote("HRESULT WINAPI MFGetService(IUnknown *object, REFGUID service, REFIID iid, void **obj);") -+cpp_quote("MFTIME WINAPI MFGetSystemTime(void);") - - [ - object, --- -1.9.1 - diff --git a/patches/mfplat-MFGetSystemTime/definition b/patches/mfplat-MFGetSystemTime/definition deleted file mode 100644 index 3127973c..00000000 --- a/patches/mfplat-MFGetSystemTime/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [46300] mfplat: Implement MFGetSystemTime diff --git a/patches/ntdll-ApiSetMap/0001-ntdll-Add-dummy-apiset-to-PEB.patch b/patches/ntdll-ApiSetMap/0001-ntdll-Add-dummy-apiset-to-PEB.patch index def2ed57..507c2212 100644 --- a/patches/ntdll-ApiSetMap/0001-ntdll-Add-dummy-apiset-to-PEB.patch +++ b/patches/ntdll-ApiSetMap/0001-ntdll-Add-dummy-apiset-to-PEB.patch @@ -1,4 +1,4 @@ -From 6b07556e47ab6db08cb68371b706f11525bd2d16 Mon Sep 17 00:00:00 2001 +From 2afc731dcc7e4b8963ddc2792cce17e1ff7c40dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 3 Apr 2017 01:06:26 +0200 Subject: [PATCH] ntdll: Add dummy apiset to PEB. @@ -12,10 +12,10 @@ Subject: [PATCH] ntdll: Add dummy apiset to PEB. create mode 100644 include/apiset.h diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index c4e02da..79bc4e2 100644 +index 0f90291..c36337a6 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -72,6 +72,7 @@ static WCHAR current_dir[MAX_PATH]; +@@ -72,6 +72,7 @@ static PEB_LDR_DATA ldr; static RTL_BITMAP tls_bitmap; static RTL_BITMAP tls_expansion_bitmap; static RTL_BITMAP fls_bitmap; @@ -23,16 +23,16 @@ index c4e02da..79bc4e2 100644 static int nb_threads = 1; static RTL_CRITICAL_SECTION peb_lock; -@@ -308,6 +309,7 @@ void thread_init(void) +@@ -275,6 +276,7 @@ void thread_init(void) + peb = addr; peb->FastPebLock = &peb_lock; - peb->ProcessParameters = ¶ms; + peb->ApiSetMap = &apiset_map; peb->TlsBitmap = &tls_bitmap; peb->TlsExpansionBitmap = &tls_expansion_bitmap; peb->FlsBitmap = &fls_bitmap; diff --git a/include/Makefile.in b/include/Makefile.in -index cc78b1c..e6d554b 100644 +index 5485084..72e6e5d 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -13,6 +13,7 @@ SOURCES = \ @@ -88,7 +88,7 @@ index 0000000..f55f804 +#endif + diff --git a/include/winternl.h b/include/winternl.h -index 9c88613..c09f462 100644 +index 064444d..a9c6cab 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -23,6 +23,7 @@ diff --git a/patches/ntdll-Hide_Wine_Exports/0001-ntdll-Add-support-for-hiding-wine-version-informatio.patch b/patches/ntdll-Hide_Wine_Exports/0001-ntdll-Add-support-for-hiding-wine-version-informatio.patch index 9953cf3b..db2c8421 100644 --- a/patches/ntdll-Hide_Wine_Exports/0001-ntdll-Add-support-for-hiding-wine-version-informatio.patch +++ b/patches/ntdll-Hide_Wine_Exports/0001-ntdll-Add-support-for-hiding-wine-version-informatio.patch @@ -1,4 +1,4 @@ -From c2794d82d31322d361e3545e54789fee28119d40 Mon Sep 17 00:00:00 2001 +From 6dce8cc12b18115a486509cc730e6993b9ce56a0 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 30 May 2015 02:23:15 +0200 Subject: [PATCH] ntdll: Add support for hiding wine version information from @@ -10,7 +10,7 @@ Subject: [PATCH] ntdll: Add support for hiding wine version information from 2 files changed, 100 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index 58c02c9..04bae4b 100644 +index cda55e1..71d2659 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -68,9 +68,12 @@ typedef void (CALLBACK *LDRENUMPROC)(LDR_MODULE *, void *, BOOLEAN *); @@ -26,7 +26,7 @@ index 58c02c9..04bae4b 100644 struct ldr_notification { -@@ -1598,6 +1601,96 @@ NTSTATUS WINAPI LdrUnlockLoaderLock( ULONG flags, ULONG_PTR magic ) +@@ -1602,6 +1605,96 @@ NTSTATUS WINAPI LdrUnlockLoaderLock( ULONG flags, ULONG_PTR magic ) } @@ -123,7 +123,7 @@ index 58c02c9..04bae4b 100644 /****************************************************************** * LdrGetProcedureAddress (NTDLL.@) */ -@@ -1618,7 +1711,7 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name, +@@ -1622,7 +1715,7 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name, LPCWSTR load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer; void *proc = name ? find_named_export( module, exports, exp_size, name->Buffer, -1, load_path ) : find_ordinal_export( module, exports, exp_size, ord - exports->Base, load_path ); @@ -132,19 +132,19 @@ index 58c02c9..04bae4b 100644 { *address = proc; ret = STATUS_SUCCESS; -@@ -3374,6 +3467,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2, - if (!peb->ProcessParameters->WindowTitle.Buffer) - peb->ProcessParameters->WindowTitle = wm->ldr.FullDllName; +@@ -3427,6 +3520,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2, + peb->LoaderLock = &loader_section; + update_user_process_params( &wm->ldr.FullDllName ); version_init( wm->ldr.FullDllName.Buffer ); + hidden_exports_init( wm->ldr.FullDllName.Buffer ); virtual_set_large_address_space(); LdrQueryImageFileExecutionOptions( &peb->ProcessParameters->ImagePathName, globalflagW, diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index d0fc81b..c09f25c 100644 +index e1b2482..dd4c8bc 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h -@@ -254,6 +254,11 @@ extern HANDLE keyed_event DECLSPEC_HIDDEN; +@@ -259,6 +259,11 @@ extern HANDLE keyed_event DECLSPEC_HIDDEN; NTSTATUS WINAPI RtlHashUnicodeString(PCUNICODE_STRING,BOOLEAN,ULONG,ULONG*); diff --git a/patches/ntdll-User_Shared_Data/0001-ntdll-Move-code-to-update-user-shared-data-into-a-se.patch b/patches/ntdll-User_Shared_Data/0001-ntdll-Move-code-to-update-user-shared-data-into-a-se.patch index 74e8c7d3..cc003f70 100644 --- a/patches/ntdll-User_Shared_Data/0001-ntdll-Move-code-to-update-user-shared-data-into-a-se.patch +++ b/patches/ntdll-User_Shared_Data/0001-ntdll-Move-code-to-update-user-shared-data-into-a-se.patch @@ -1,4 +1,4 @@ -From 33502f50d05cbb558a0589af8c08125ed7a988dc Mon Sep 17 00:00:00 2001 +From 4fbcbb1132148919be8175a0e55dda206ee407a2 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 26 Nov 2014 10:46:09 +0100 Subject: [PATCH] ntdll: Move code to update user shared data into a separate @@ -10,7 +10,7 @@ Subject: [PATCH] ntdll: Move code to update user shared data into a separate 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec -index 008abb744a0..87a6c70081b 100644 +index 008abb7..87a6c70 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1526,3 +1526,6 @@ @@ -21,10 +21,10 @@ index 008abb744a0..87a6c70081b 100644 +# User shared data +@ cdecl __wine_user_shared_data() diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index 6718f38c7e1..974519cca48 100644 +index c36337a6..0a11cfe 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -248,7 +248,6 @@ void thread_init(void) +@@ -246,7 +246,6 @@ void thread_init(void) void *addr; BOOL suspend; SIZE_T size, info_size; @@ -32,9 +32,9 @@ index 6718f38c7e1..974519cca48 100644 NTSTATUS status; struct ntdll_thread_data *thread_data; static struct debug_info debug_info; /* debug info for initial thread */ -@@ -361,7 +360,23 @@ void thread_init(void) - wine_server_fd_to_handle( 2, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, ¶ms.hStdError ); - } +@@ -340,7 +339,23 @@ void thread_init(void) + + init_user_process_params( info_size ); - /* initialize time values in user_shared_data */ + /* initialize user_shared_data */ @@ -57,7 +57,7 @@ index 6718f38c7e1..974519cca48 100644 NtQuerySystemTime( &now ); user_shared_data->SystemTime.LowPart = now.u.LowPart; user_shared_data->SystemTime.High1Time = user_shared_data->SystemTime.High2Time = now.u.HighPart; -@@ -369,10 +384,7 @@ void thread_init(void) +@@ -348,10 +363,7 @@ void thread_init(void) user_shared_data->u.TickCount.High2Time = user_shared_data->u.TickCount.High1Time; user_shared_data->TickCountLowDeprecated = user_shared_data->u.TickCount.LowPart; user_shared_data->TickCountMultiplier = 1 << 24; @@ -70,5 +70,5 @@ index 6718f38c7e1..974519cca48 100644 -- -2.20.1 +1.9.1 diff --git a/patches/ntdll-User_Shared_Data/0003-ntdll-Create-thread-to-update-user_shared_data-time-.patch b/patches/ntdll-User_Shared_Data/0003-ntdll-Create-thread-to-update-user_shared_data-time-.patch index ab03ff91..8dbc5175 100644 --- a/patches/ntdll-User_Shared_Data/0003-ntdll-Create-thread-to-update-user_shared_data-time-.patch +++ b/patches/ntdll-User_Shared_Data/0003-ntdll-Create-thread-to-update-user_shared_data-time-.patch @@ -1,18 +1,18 @@ -From 986dd43219c45f75fe172cd2a17197fc373641f2 Mon Sep 17 00:00:00 2001 +From 3e5ae0f2aec2dfb5d6fd1da07021a6772e8a2135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 5 May 2017 05:40:50 +0200 Subject: [PATCH] ntdll: Create thread to update user_shared_data time values when necessary. --- - dlls/ntdll/loader.c | 31 ++++++++++++++++++ - dlls/ntdll/ntdll_misc.h | 3 ++ - dlls/ntdll/thread.c | 70 ++++++++++++++++++++++++++++++++++++----- - dlls/ntdll/virtual.c | 17 ++++++++++ + dlls/ntdll/loader.c | 31 ++++++++++++++++++++++ + dlls/ntdll/ntdll_misc.h | 3 +++ + dlls/ntdll/thread.c | 70 ++++++++++++++++++++++++++++++++++++++++++++----- + dlls/ntdll/virtual.c | 17 ++++++++++++ 4 files changed, 114 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index 1e609a08610..70976855e12 100644 +index 71d2659..64aea23 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3493,6 +3493,36 @@ static void load_global_options(void) @@ -52,19 +52,19 @@ index 1e609a08610..70976855e12 100644 /****************************************************************** * LdrInitializeThunk (NTDLL.@) * -@@ -3522,6 +3552,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2, - if (!peb->ProcessParameters->WindowTitle.Buffer) - peb->ProcessParameters->WindowTitle = wm->ldr.FullDllName; +@@ -3520,6 +3550,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2, + peb->LoaderLock = &loader_section; + update_user_process_params( &wm->ldr.FullDllName ); version_init( wm->ldr.FullDllName.Buffer ); + user_shared_data_init(); hidden_exports_init( wm->ldr.FullDllName.Buffer ); virtual_set_large_address_space(); diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index ec2e74a891b..1e2f2fdeb6e 100644 +index dd4c8bc..2bf1453 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h -@@ -194,6 +194,9 @@ extern void virtual_set_large_address_space(void) DECLSPEC_HIDDEN; +@@ -195,6 +195,9 @@ extern void virtual_set_large_address_space(void) DECLSPEC_HIDDEN; extern void virtual_fill_image_information( const pe_image_info_t *pe_info, SECTION_IMAGE_INFORMATION *info ) DECLSPEC_HIDDEN; extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN; @@ -75,7 +75,7 @@ index ec2e74a891b..1e2f2fdeb6e 100644 /* completion */ extern NTSTATUS NTDLL_AddCompletion( HANDLE hFile, ULONG_PTR CompletionValue, diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index 974519cca48..63778f6b840 100644 +index 0a11cfe..1c09344 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -44,6 +44,7 @@ @@ -97,7 +97,7 @@ index 974519cca48..63778f6b840 100644 static const WCHAR default_windirW[] = {'C',':','\\','w','i','n','d','o','w','s',0}; void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) = NULL; -@@ -265,7 +268,7 @@ void thread_init(void) +@@ -263,7 +266,7 @@ void thread_init(void) MESSAGE( "wine: failed to map the shared user data: %08x\n", status ); exit(1); } @@ -106,7 +106,7 @@ index 974519cca48..63778f6b840 100644 memcpy( user_shared_data->NtSystemRoot, default_windirW, sizeof(default_windirW) ); /* allocate and initialize the PEB */ -@@ -376,18 +379,71 @@ void thread_init(void) +@@ -355,18 +358,71 @@ void thread_init(void) */ BYTE* CDECL __wine_user_shared_data(void) { @@ -184,7 +184,7 @@ index 974519cca48..63778f6b840 100644 * free_thread_data */ diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c -index da40aabb6c7..de63460e741 100644 +index da40aab..de63460 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -2013,6 +2013,7 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack ) @@ -220,5 +220,5 @@ index da40aabb6c7..de63460e741 100644 } -- -2.20.1 +1.9.1 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 5a1f540e..92e7de00 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "9781b5433cd4b708c0f537aa0b5608ff4157f04c" + echo "7907ccfdcb39b30dc49c96c411332534525b6ea9" } # Show version information @@ -96,8 +96,6 @@ patch_enable_all () enable_atl_AtlAxDialogBox="$1" enable_avifil32_IGetFrame_fnSetFormat="$1" enable_avifile_dll16_AVIStreamGetFrame="$1" - enable_bcrypt_BCryptDeriveKeyPBKDF2="$1" - enable_bcrypt_BCryptGenerateKeyPair="$1" enable_bcrypt_BCryptSecretAgreement="$1" enable_comctl32_Listview_DrawItem="$1" enable_comdlg32_lpstrFileTitle="$1" @@ -176,7 +174,6 @@ patch_enable_all () enable_libs_Unicode_Collation="$1" enable_mciavi32_fullscreen_support="$1" enable_mf_MFCreateSequencerSource="$1" - enable_mfplat_MFGetSystemTime="$1" enable_mmsystem_dll16_MIDIHDR_Refcount="$1" enable_mountmgr_DosDevices="$1" enable_mscoree_CorValidateImage="$1" @@ -444,12 +441,6 @@ patch_enable () avifile.dll16-AVIStreamGetFrame) enable_avifile_dll16_AVIStreamGetFrame="$2" ;; - bcrypt-BCryptDeriveKeyPBKDF2) - enable_bcrypt_BCryptDeriveKeyPBKDF2="$2" - ;; - bcrypt-BCryptGenerateKeyPair) - enable_bcrypt_BCryptGenerateKeyPair="$2" - ;; bcrypt-BCryptSecretAgreement) enable_bcrypt_BCryptSecretAgreement="$2" ;; @@ -684,9 +675,6 @@ patch_enable () mf-MFCreateSequencerSource) enable_mf_MFCreateSequencerSource="$2" ;; - mfplat-MFGetSystemTime) - enable_mfplat_MFGetSystemTime="$2" - ;; mmsystem.dll16-MIDIHDR_Refcount) enable_mmsystem_dll16_MIDIHDR_Refcount="$2" ;; @@ -2111,13 +2099,6 @@ if test "$enable_nvapi_Stub_DLL" -eq 1; then enable_nvcuda_CUDA_Support=1 fi -if test "$enable_bcrypt_BCryptSecretAgreement" -eq 1; then - if test "$enable_bcrypt_BCryptGenerateKeyPair" -gt 1; then - abort "Patchset bcrypt-BCryptGenerateKeyPair disabled, but bcrypt-BCryptSecretAgreement depends on that." - fi - enable_bcrypt_BCryptGenerateKeyPair=1 -fi - if test "$enable_advapi32_Token_Integrity_Level" -eq 1; then if test "$enable_Staging" -gt 1; then abort "Patchset Staging disabled, but advapi32-Token_Integrity_Level depends on that." @@ -2462,43 +2443,8 @@ if test "$enable_avifile_dll16_AVIStreamGetFrame" -eq 1; then ) >> "$patchlist" fi -# Patchset bcrypt-BCryptDeriveKeyPBKDF2 -# | -# | This patchset fixes the following Wine bugs: -# | * [#42704] Implement BCryptDeriveKeyPBKDF2 -# | -# | Modified files: -# | * dlls/bcrypt/bcrypt.spec, dlls/bcrypt/bcrypt_main.c, dlls/bcrypt/tests/bcrypt.c, dlls/ncrypt/ncrypt.spec, -# | include/bcrypt.h -# | -if test "$enable_bcrypt_BCryptDeriveKeyPBKDF2" -eq 1; then - patch_apply bcrypt-BCryptDeriveKeyPBKDF2/0001-bcrypt-Implement-BCryptDeriveKeyPBKDF2-and-add-test-.patch - ( - printf '%s\n' '+ { "Jack Grigg", "bcrypt: Implement BCryptDeriveKeyPBKDF2 and add test vectors.", 1 },'; - ) >> "$patchlist" -fi - -# Patchset bcrypt-BCryptGenerateKeyPair -# | -# | This patchset fixes the following Wine bugs: -# | * [#45312] Fix issue for Assassin's Creed : Syndicate -# | -# | Modified files: -# | * dlls/bcrypt/bcrypt.spec, dlls/bcrypt/bcrypt_internal.h, dlls/bcrypt/bcrypt_main.c, dlls/bcrypt/gnutls.c, -# | dlls/bcrypt/macos.c, dlls/bcrypt/tests/bcrypt.c, dlls/ncrypt/ncrypt.spec, include/bcrypt.h -# | -if test "$enable_bcrypt_BCryptGenerateKeyPair" -eq 1; then - patch_apply bcrypt-BCryptGenerateKeyPair/0001-bcrypt-Implement-BCryptGenerate-FinalizeKeyPair-for-.patch - ( - printf '%s\n' '+ { "Hans Leidekker", "bcrypt: Implement BCryptGenerate/FinalizeKeyPair for ECDH P256.", 1 },'; - ) >> "$patchlist" -fi - # Patchset bcrypt-BCryptSecretAgreement # | -# | This patchset has the following (direct or indirect) dependencies: -# | * bcrypt-BCryptGenerateKeyPair -# | # | This patchset fixes the following Wine bugs: # | * [#46564] Add BCryptDestroySecret/BCryptSecretAgreement stubs. # | @@ -4064,21 +4010,6 @@ if test "$enable_mf_MFCreateSequencerSource" -eq 1; then ) >> "$patchlist" fi -# Patchset mfplat-MFGetSystemTime -# | -# | This patchset fixes the following Wine bugs: -# | * [#46300] mfplat: Implement MFGetSystemTime -# | -# | Modified files: -# | * dlls/mfplat/main.c, dlls/mfplat/mfplat.spec, include/mfidl.idl -# | -if test "$enable_mfplat_MFGetSystemTime" -eq 1; then - patch_apply mfplat-MFGetSystemTime/0001-mfplat-Implement-MFGetSystemTime.patch - ( - printf '%s\n' '+ { "Alistair Leslie-Hughes", "mfplat: Implement MFGetSystemTime.", 1 },'; - ) >> "$patchlist" -fi - # Patchset mmsystem.dll16-MIDIHDR_Refcount # | # | This patchset fixes the following Wine bugs: @@ -7159,16 +7090,12 @@ fi # | * [#4836] Various improvements for wineps.drv for Adobe PageMaker compatibility # | # | Modified files: -# | * dlls/gdi32/tests/dc.c, dlls/wineps.drv/download.c, dlls/wineps.drv/escape.c, dlls/wineps.drv/psdrv.h +# | * dlls/wineps.drv/download.c, dlls/wineps.drv/escape.c, dlls/wineps.drv/psdrv.h # | if test "$enable_wineps_drv_PostScript_Fixes" -eq 1; then - patch_apply wineps.drv-PostScript_Fixes/0003-wineps.drv-Add-stubs-for-escapes-required-by-Adobe-P.patch patch_apply wineps.drv-PostScript_Fixes/0004-wineps.drv-Add-support-for-GETFACENAME-and-DOWNLOADF.patch - patch_apply wineps.drv-PostScript_Fixes/0005-wineps.drv-PostScript-header-should-be-written-by-St.patch ( - printf '%s\n' '+ { "Dmitry Timoshkov", "wineps.drv: Add stubs for escapes required by Adobe PageMaker.", 1 },'; printf '%s\n' '+ { "Dmitry Timoshkov", "wineps.drv: Add support for GETFACENAME and DOWNLOADFACE escapes.", 1 },'; - printf '%s\n' '+ { "Dmitry Timoshkov", "wineps.drv: PostScript header should be written by StartDoc instead of StartPage.", 1 },'; ) >> "$patchlist" fi diff --git a/patches/uianimation-stubs/0002-uianimation-Add-stub-dll.patch b/patches/uianimation-stubs/0002-uianimation-Add-stub-dll.patch index 51029bfe..1eb860bb 100644 --- a/patches/uianimation-stubs/0002-uianimation-Add-stub-dll.patch +++ b/patches/uianimation-stubs/0002-uianimation-Add-stub-dll.patch @@ -1,4 +1,4 @@ -From e95f5c6de6b725baabf59a4767c722b4589bd7cc Mon Sep 17 00:00:00 2001 +From 22e4de0e6c77f8d5e29ecd125f016a221a3b8e1b Mon Sep 17 00:00:00 2001 From: Louis Lenders Date: Thu, 7 Jun 2018 11:51:01 +0200 Subject: [PATCH] uianimation: Add stub dll @@ -22,7 +22,7 @@ Signed-off-by: Louis Lenders create mode 100644 dlls/uianimation/uianimation_typelib.idl diff --git a/configure b/configure -index dd1d347..bb4025c 100755 +index 5cefb64..10f7e05 100755 --- a/configure +++ b/configure @@ -1547,6 +1547,7 @@ enable_traffic @@ -33,26 +33,26 @@ index dd1d347..bb4025c 100755 enable_uiautomationcore enable_uiribbon enable_unicows -@@ -19983,6 +19984,7 @@ wine_fn_config_makefile dlls/typelib.dll16 enable_win16 +@@ -19985,6 +19986,7 @@ wine_fn_config_makefile dlls/typelib.dll16 enable_win16 wine_fn_config_makefile dlls/tzres enable_tzres wine_fn_config_makefile dlls/ucrtbase enable_ucrtbase wine_fn_config_makefile dlls/ucrtbase/tests enable_tests +wine_fn_config_makefile dlls/uianimation enable_uianimation wine_fn_config_makefile dlls/uiautomationcore enable_uiautomationcore + wine_fn_config_makefile dlls/uiautomationcore/tests enable_tests wine_fn_config_makefile dlls/uiribbon enable_uiribbon - wine_fn_config_makefile dlls/unicows enable_unicows diff --git a/configure.ac b/configure.ac -index 119c4ce..584a2d7 100644 +index bac2c09..8191489 100644 --- a/configure.ac +++ b/configure.ac -@@ -3722,6 +3722,7 @@ WINE_CONFIG_MAKEFILE(dlls/typelib.dll16,enable_win16) +@@ -3783,6 +3783,7 @@ WINE_CONFIG_MAKEFILE(dlls/typelib.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/tzres) WINE_CONFIG_MAKEFILE(dlls/ucrtbase) WINE_CONFIG_MAKEFILE(dlls/ucrtbase/tests) +WINE_CONFIG_MAKEFILE(dlls/uianimation) WINE_CONFIG_MAKEFILE(dlls/uiautomationcore) + WINE_CONFIG_MAKEFILE(dlls/uiautomationcore/tests) WINE_CONFIG_MAKEFILE(dlls/uiribbon) - WINE_CONFIG_MAKEFILE(dlls/unicows) diff --git a/dlls/uianimation/Makefile.in b/dlls/uianimation/Makefile.in new file mode 100644 index 0000000..bc303b3 diff --git a/patches/wineps.drv-PostScript_Fixes/0003-wineps.drv-Add-stubs-for-escapes-required-by-Adobe-P.patch b/patches/wineps.drv-PostScript_Fixes/0003-wineps.drv-Add-stubs-for-escapes-required-by-Adobe-P.patch deleted file mode 100644 index 02c76063..00000000 --- a/patches/wineps.drv-PostScript_Fixes/0003-wineps.drv-Add-stubs-for-escapes-required-by-Adobe-P.patch +++ /dev/null @@ -1,118 +0,0 @@ -From c9912e16ab7c0c5add52913cdc38e98dc81f8690 Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Wed, 13 Apr 2016 15:48:10 +0800 -Subject: wineps.drv: Add stubs for escapes required by Adobe PageMaker. - ---- - dlls/gdi32/tests/dc.c | 7 ------- - dlls/wineps.drv/escape.c | 41 +++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 41 insertions(+), 7 deletions(-) - -diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c -index 4a50594..939f33e 100644 ---- a/dlls/gdi32/tests/dc.c -+++ b/dlls/gdi32/tests/dc.c -@@ -1413,9 +1413,7 @@ static void print_something(HDC hdc) - - strcpy(buf, "deadbeef"); - ret = ExtEscape(hdc, DOWNLOADHEADER, 0, NULL, sizeof(buf), buf ); --todo_wine - ok(ret == 1, "DOWNLOADHEADER failed\n"); --todo_wine - ok(strcmp(buf, "deadbeef") != 0, "DOWNLOADHEADER failed\n"); - - strcpy(buf + 2, "\n% ===> after DOWNLOADHEADER <===\n"); -@@ -1475,22 +1473,18 @@ static void test_pscript_printer_dc(void) - - query = DOWNLOADFACE; - ret = Escape(hdc, QUERYESCSUPPORT, sizeof(query), (LPCSTR)&query, NULL); --todo_wine - ok(ret == 1, "DOWNLOADFACE is not supported\n"); - - query = OPENCHANNEL; - ret = Escape(hdc, QUERYESCSUPPORT, sizeof(query), (LPCSTR)&query, NULL); --todo_wine - ok(ret == 1, "OPENCHANNEL is not supported\n"); - - query = DOWNLOADHEADER; - ret = Escape(hdc, QUERYESCSUPPORT, sizeof(query), (LPCSTR)&query, NULL); --todo_wine - ok(ret == 1, "DOWNLOADHEADER is not supported\n"); - - query = CLOSECHANNEL; - ret = Escape(hdc, QUERYESCSUPPORT, sizeof(query), (LPCSTR)&query, NULL); --todo_wine - ok(ret == 1, "CLOSECHANNEL is not supported\n"); - - query = POSTSCRIPT_PASSTHROUGH; -@@ -1498,7 +1492,6 @@ todo_wine - ok(ret == 1, "POSTSCRIPT_PASSTHROUGH is not supported\n"); - - ret = ExtEscape(hdc, GETFACENAME, 0, NULL, sizeof(buf), buf); --todo_wine - ok(ret == 1, "GETFACENAME failed\n"); - trace("face name: %s\n", buf); - -diff --git a/dlls/wineps.drv/escape.c b/dlls/wineps.drv/escape.c -index 6e89837..2f3ddfc 100644 ---- a/dlls/wineps.drv/escape.c -+++ b/dlls/wineps.drv/escape.c -@@ -100,14 +100,55 @@ INT PSDRV_ExtEscape( PHYSDEV dev, INT nEscape, INT cbInput, LPCVOID in_data, - case CLIP_TO_PATH: - case END_PATH: - /*case DRAWPATTERNRECT:*/ -+ -+ /* PageMaker checks for it */ -+ case DOWNLOADHEADER: -+ -+ /* PageMaker doesn't check for DOWNLOADFACE and GETFACENAME but -+ * uses them, they are supposed to be supported by any PS printer. -+ */ -+ case DOWNLOADFACE: -+ -+ /* PageMaker checks for these as a part of process of detecting -+ * a "fully compatible" PS printer, but doesn't actually use them. -+ */ -+ case OPENCHANNEL: -+ case CLOSECHANNEL: - return TRUE; - -+ /* Windows PS driver reports 0, but still supports this escape */ -+ case GETFACENAME: -+ return FALSE; /* suppress the FIXME below */ -+ - default: - FIXME("QUERYESCSUPPORT(%d) - not supported.\n", num); - return FALSE; - } - } - -+ case OPENCHANNEL: -+ FIXME("OPENCHANNEL: stub\n"); -+ return 1; -+ -+ case CLOSECHANNEL: -+ FIXME("CLOSECHANNEL: stub\n"); -+ return 1; -+ -+ case DOWNLOADHEADER: -+ FIXME("DOWNLOADHEADER: stub\n"); -+ /* should return name of the downloaded procset */ -+ *(char *)out_data = 0; -+ return 1; -+ -+ case GETFACENAME: -+ FIXME("GETFACENAME: stub\n"); -+ lstrcpynA(out_data, "Courier", cbOutput); -+ return 1; -+ -+ case DOWNLOADFACE: -+ FIXME("DOWNLOADFACE: stub\n"); -+ return 1; -+ - case MFCOMMENT: - { - FIXME("MFCOMMENT(%p, %d)\n", in_data, cbInput); --- -2.7.1 - diff --git a/patches/wineps.drv-PostScript_Fixes/0005-wineps.drv-PostScript-header-should-be-written-by-St.patch b/patches/wineps.drv-PostScript_Fixes/0005-wineps.drv-PostScript-header-should-be-written-by-St.patch deleted file mode 100644 index 6c35b104..00000000 --- a/patches/wineps.drv-PostScript_Fixes/0005-wineps.drv-PostScript-header-should-be-written-by-St.patch +++ /dev/null @@ -1,84 +0,0 @@ -From f723db2c924b592d8c6e073a2d1b566a035fde92 Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Wed, 13 Apr 2016 15:58:36 +0800 -Subject: wineps.drv: PostScript header should be written by StartDoc instead - of StartPage. - -Otherwise a being created file has wrong signature if an application -directly injects PostScript code. This patch fixes printing from -Adobe PageMaker. ---- - dlls/gdi32/tests/dc.c | 1 - - dlls/wineps.drv/escape.c | 18 ++++++++++++++---- - 2 files changed, 14 insertions(+), 5 deletions(-) - -diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c -index 939f33e..bab99e3 100644 ---- a/dlls/gdi32/tests/dc.c -+++ b/dlls/gdi32/tests/dc.c -@@ -1444,7 +1444,6 @@ static void print_something(HDC hdc) - - while (*p == '\r' || *p == '\n') p++; - } --todo_wine - ok(p && !memcmp(p, psadobe, sizeof(psadobe)), "wrong signature: %.14s\n", p ? p : buf); - - DeleteFileA(file_name); -diff --git a/dlls/wineps.drv/escape.c b/dlls/wineps.drv/escape.c -index 86a94fd..9cf0277 100644 ---- a/dlls/wineps.drv/escape.c -+++ b/dlls/wineps.drv/escape.c -@@ -431,15 +431,14 @@ INT PSDRV_StartPage( PHYSDEV dev ) - { - PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); - -+ TRACE("%p\n", dev->hdc); -+ - if(!physDev->job.OutOfPage) { - FIXME("Already started a page?\n"); - return 1; - } - -- if(physDev->job.PageNo++ == 0) { -- if(!PSDRV_WriteHeader( dev, physDev->job.doc_name )) -- return 0; -- } -+ physDev->job.PageNo++; - - if(!PSDRV_WriteNewPage( dev )) - return 0; -@@ -455,6 +454,8 @@ INT PSDRV_EndPage( PHYSDEV dev ) - { - PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); - -+ TRACE("%p\n", dev->hdc); -+ - if(physDev->job.OutOfPage) { - FIXME("Already ended a page?\n"); - return 1; -@@ -515,6 +516,13 @@ INT PSDRV_StartDoc( PHYSDEV dev, const DOCINFOW *doc ) - ClosePrinter(physDev->job.hprinter); - return 0; - } -+ -+ if (!PSDRV_WriteHeader( dev, doc->lpszDocName )) { -+ WARN("Failed to write header\n"); -+ ClosePrinter(physDev->job.hprinter); -+ return 0; -+ } -+ - physDev->job.banding = FALSE; - physDev->job.OutOfPage = TRUE; - physDev->job.PageNo = 0; -@@ -534,6 +542,8 @@ INT PSDRV_EndDoc( PHYSDEV dev ) - PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); - INT ret = 1; - -+ TRACE("%p\n", dev->hdc); -+ - if(!physDev->job.id) { - FIXME("hJob == 0. Now what?\n"); - return 0; --- -2.7.1 -