Compare commits

...

16 Commits
v3.11 ... v3.12

Author SHA1 Message Date
Alistair Leslie-Hughes
23fd2d0f93 Release 3.12 2018-07-10 09:38:48 +10:00
Alistair Leslie-Hughes
f61b8570b8 Rebase against 8ef224fa43869a8c977921d6bec08863382d6e11 2018-07-10 09:02:41 +10:00
Zebediah Figura
738fd3fd35 Rebase against 80205232d3ece73d4cc6c7589cea893583aae0b1. 2018-07-07 01:01:40 +02:00
Zebediah Figura
8ed2ef6f5c Rebase against cb468b682d2b7d088d0607259affe1680b558e24.
Thanks to Henri Verbeet for his assistance.
2018-07-06 16:02:29 +02:00
Alistair Leslie-Hughes
686ab91ec6 Rebase against e7f5dc194aeb586bb516b5fd191ad6924c4fcdd3 2018-07-05 09:19:21 +10:00
Zebediah Figura
d53fc8ece0 Rebase against 3edbb2a4fdd2fb46a7af13c921bcd4bf8b7ab718. 2018-07-04 00:13:50 +02:00
Alistair Leslie-Hughes
a505e3815f Correct upstream commit sha 2018-07-03 08:57:59 +10:00
Zebediah Figura
51b6a46ce0 xaudio2_7-WMA_support: Also include libavcodec/libavutil CFLAGS.
Should hopefully fix build on some systems.

Also add dependency on other xaudio2 patch.
2018-07-02 21:07:42 +02:00
Alistair Leslie-Hughes
729a9ebadd Rebase against 86864486be64a277f6edf8e66709cd0f17a4eed9 2018-06-29 08:35:27 +10:00
Alistair Leslie-Hughes
4e57013325 Added wined3d-texture-blt-device patchset 2018-06-28 14:27:13 +10:00
Alistair Leslie-Hughes
19db07f062 Added xaudio2-WMA_support patchset 2018-06-28 14:26:16 +10:00
Alistair Leslie-Hughes
74b35082b3 Rebase against 6a04cf4a69205ddf6827fb2a4b97862fd1947c62 2018-06-28 08:30:08 +10:00
Alistair Leslie-Hughes
24f0fcf07d Remove Coverity patches
These patches are never going to be accepted upstream.

https://www.winehq.org/pipermail/wine-devel/2015-November/110396.html
2018-06-27 08:22:21 +10:00
Alistair Leslie-Hughes
59948639b6 Rebase against 85f1a79be8bbb9b62ad88e0d0fbf1e005fd3ba16 2018-06-27 08:20:14 +10:00
Alistair Leslie-Hughes
2bf4df0d11 Updated wintab32-improvements patchset 2018-06-26 21:07:52 +10:00
Alistair Leslie-Hughes
ba6b6642fb Rebase against 6d801377055911d914226a3c6af8d8637a63fa13 2018-06-26 08:16:59 +10:00
52 changed files with 1233 additions and 2999 deletions

View File

@@ -1,7 +1,8 @@
From 59f0bb786dc3ec4e77cb43ea4410743ecd317bbf Mon Sep 17 00:00:00 2001
From 42dbdf9479e2e09734fa183b854d5ddfe987f203 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 22 Mar 2016 23:08:30 +0100
Subject: include: Check element type in CONTAINING_RECORD and similar macros.
Subject: [PATCH] include: Check element type in CONTAINING_RECORD and
similar macros.
---
include/wine/list.h | 10 ++++++++--
@@ -30,10 +31,10 @@ index b4d681f..287ad39 100644
#endif /* __WINE_SERVER_LIST_H */
diff --git a/include/wine/rbtree.h b/include/wine/rbtree.h
index 13452d9..554d239 100644
index dc50b5e..8130deb 100644
--- a/include/wine/rbtree.h
+++ b/include/wine/rbtree.h
@@ -22,8 +22,14 @@
@@ -23,8 +23,14 @@
#ifndef __WINE_WINE_RBTREE_H
#define __WINE_WINE_RBTREE_H
@@ -51,10 +52,10 @@ index 13452d9..554d239 100644
struct wine_rb_entry
{
diff --git a/include/winnt.h b/include/winnt.h
index 559a719..4a711f4 100644
index 7f822c4..ccfe73b 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -753,8 +753,14 @@ typedef struct _MEMORY_BASIC_INFORMATION
@@ -756,8 +756,14 @@ typedef struct _MEMORY_BASIC_INFORMATION
#define FIELD_OFFSET(type, field) ((LONG)offsetof(type, field))
@@ -69,8 +70,8 @@ index 559a719..4a711f4 100644
+ ((type *)((PCHAR)(address) - offsetof(type, field)))
+#endif
/* Types */
#ifdef __WINESRC__
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
--
2.7.1
1.9.1

View File

@@ -1,29 +0,0 @@
From 6f561502fe458837f3a5b27f477b1a52f33d88ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= <nerv@dawncrow.de>
Date: Mon, 16 Nov 2015 22:36:40 +0100
Subject: sfnt2fon: Don't leak output name if specified multiple times
(Coverity)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: André Hentschel <nerv@dawncrow.de>
---
tools/sfnt2fon/sfnt2fon.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/sfnt2fon/sfnt2fon.c b/tools/sfnt2fon/sfnt2fon.c
index 7612bc2..f825ae4 100644
--- a/tools/sfnt2fon/sfnt2fon.c
+++ b/tools/sfnt2fon/sfnt2fon.c
@@ -654,6 +654,7 @@ static char **parse_options( int argc, char **argv )
option_defchar = atoi( optarg );
break;
case 'o':
+ free( option_output );
option_output = strdup( optarg );
break;
case 'q':
--
2.6.2

View File

@@ -1,30 +0,0 @@
From 792e99d66b40481fb81042d51a12c861d8b33b51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= <nerv@dawncrow.de>
Date: Mon, 16 Nov 2015 22:36:38 +0100
Subject: winedump: Free debug string in case it was not freed in for-loop
(Coverity)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: André Hentschel <nerv@dawncrow.de>
---
tools/winedump/msc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c
index 5890b29..3f1fd98 100644
--- a/tools/winedump/msc.c
+++ b/tools/winedump/msc.c
@@ -1378,6 +1378,8 @@ BOOL codeview_dump_symbols(const void* root, unsigned long size)
dump_data((const void*)sym, sym->generic.len + 2, " ");
}
}
+
+ free(curr_func);
return TRUE;
}
--
2.6.2

View File

@@ -1,146 +0,0 @@
From ad4623778a56ea3278bb9c81a951af14575b9ac0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 30 Sep 2017 03:02:15 +0200
Subject: crypt32: Correctly return how the issuer of a self signed certificate
was checked.
---
dlls/crypt32/cert.c | 2 +-
dlls/crypt32/chain.c | 20 ++++++++++++++------
dlls/crypt32/crypt32_private.h | 2 +-
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c
index a4b43ff1555..0cfa46788f3 100644
--- a/dlls/crypt32/cert.c
+++ b/dlls/crypt32/cert.c
@@ -1884,7 +1884,7 @@ PCCERT_CONTEXT WINAPI CertGetIssuerCertificateFromStore(HCERTSTORE hCertStore,
CertFreeCertificateContext(ret);
ret = NULL;
}
- if (CRYPT_IsCertificateSelfSigned(pSubjectContext))
+ if (CRYPT_IsCertificateSelfSigned(pSubjectContext, NULL))
{
CertFreeCertificateContext(ret);
ret = NULL;
diff --git a/dlls/crypt32/chain.c b/dlls/crypt32/chain.c
index 80b6513ab1e..89a8ddb95f4 100644
--- a/dlls/crypt32/chain.c
+++ b/dlls/crypt32/chain.c
@@ -265,7 +265,7 @@ typedef struct _CertificateChain
LONG ref;
} CertificateChain;
-BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert)
+BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert, DWORD *type)
{
PCERT_EXTENSION ext;
DWORD size;
@@ -300,6 +300,7 @@ BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert)
&directoryName->u.DirectoryName, &cert->pCertInfo->Issuer)
&& CertCompareIntegerBlob(&info->AuthorityCertSerialNumber,
&cert->pCertInfo->SerialNumber);
+ if (type) *type = CERT_TRUST_HAS_NAME_MATCH_ISSUER;
}
else
{
@@ -321,6 +322,7 @@ BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert)
CERT_KEY_IDENTIFIER_PROP_ID, buf, &size);
ret = !memcmp(buf, info->KeyId.pbData, size);
CryptMemFree(buf);
+ if (type) *type = CERT_TRUST_HAS_KEY_MATCH_ISSUER;
}
else
ret = FALSE;
@@ -348,6 +350,7 @@ BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert)
&info->CertIssuer, &cert->pCertInfo->Issuer) &&
CertCompareIntegerBlob(&info->CertSerialNumber,
&cert->pCertInfo->SerialNumber);
+ if (type) *type = CERT_TRUST_HAS_NAME_MATCH_ISSUER;
}
else if (info->KeyId.cbData)
{
@@ -363,6 +366,7 @@ BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert)
CERT_KEY_IDENTIFIER_PROP_ID, buf, &size);
ret = !memcmp(buf, info->KeyId.pbData, size);
CryptMemFree(buf);
+ if (type) *type = CERT_TRUST_HAS_KEY_MATCH_ISSUER;
}
else
ret = FALSE;
@@ -376,8 +380,11 @@ BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert)
}
}
else
+ {
ret = CertCompareCertificateName(cert->dwCertEncodingType,
&cert->pCertInfo->Subject, &cert->pCertInfo->Issuer);
+ if (type) *type = CERT_TRUST_HAS_NAME_MATCH_ISSUER;
+ }
return ret;
}
@@ -1320,7 +1327,7 @@ static void CRYPT_CheckChainNameConstraints(PCERT_SIMPLE_CHAIN chain)
* constraints checked unless they're the end cert.
*/
if (j == 0 || !CRYPT_IsCertificateSelfSigned(
- chain->rgpElement[j]->pCertContext))
+ chain->rgpElement[j]->pCertContext, NULL))
{
CRYPT_CheckNameConstraints(nameConstraints,
chain->rgpElement[j]->pCertContext->pCertInfo,
@@ -1893,6 +1900,7 @@ static void CRYPT_CheckSimpleChain(CertificateChainEngine *engine,
int i;
BOOL pathLengthConstraintViolated = FALSE;
CERT_BASIC_CONSTRAINTS2_INFO constraints = { FALSE, FALSE, 0 };
+ DWORD type;
TRACE_(chain)("checking chain with %d elements for time %s\n",
chain->cElement, filetime_to_str(time));
@@ -1904,7 +1912,7 @@ static void CRYPT_CheckSimpleChain(CertificateChainEngine *engine,
dump_element(chain->rgpElement[i]->pCertContext);
if (i == chain->cElement - 1)
isRoot = CRYPT_IsCertificateSelfSigned(
- chain->rgpElement[i]->pCertContext);
+ chain->rgpElement[i]->pCertContext, NULL);
else
isRoot = FALSE;
if (!CRYPT_IsCertVersionValid(chain->rgpElement[i]->pCertContext))
@@ -1980,10 +1988,10 @@ static void CRYPT_CheckSimpleChain(CertificateChainEngine *engine,
}
CRYPT_CheckChainNameConstraints(chain);
CRYPT_CheckChainPolicies(chain);
- if (CRYPT_IsCertificateSelfSigned(rootElement->pCertContext))
+ if (CRYPT_IsCertificateSelfSigned(rootElement->pCertContext, &type))
{
rootElement->TrustStatus.dwInfoStatus |=
- CERT_TRUST_IS_SELF_SIGNED | CERT_TRUST_HAS_NAME_MATCH_ISSUER;
+ CERT_TRUST_IS_SELF_SIGNED | type;
CRYPT_CheckRootCert(engine->hRoot, rootElement);
}
CRYPT_CombineTrustStatus(&chain->TrustStatus, &rootElement->TrustStatus);
@@ -2195,7 +2203,7 @@ static BOOL CRYPT_BuildSimpleChain(const CertificateChainEngine *engine,
PCCERT_CONTEXT cert = chain->rgpElement[chain->cElement - 1]->pCertContext;
while (ret && !CRYPT_IsSimpleChainCyclic(chain) &&
- !CRYPT_IsCertificateSelfSigned(cert))
+ !CRYPT_IsCertificateSelfSigned(cert, NULL))
{
PCCERT_CONTEXT issuer = CRYPT_GetIssuer(engine, world, cert, NULL, flags,
&chain->rgpElement[chain->cElement - 1]->TrustStatus.dwInfoStatus);
diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h
index 8b1b003a120..5c08369f007 100644
--- a/dlls/crypt32/crypt32_private.h
+++ b/dlls/crypt32/crypt32_private.h
@@ -341,7 +341,7 @@ void CRYPT_ImportSystemRootCertsToReg(void) DECLSPEC_HIDDEN;
BOOL CRYPT_SerializeContextsToReg(HKEY key, DWORD flags, const WINE_CONTEXT_INTERFACE *contextInterface,
HCERTSTORE memStore) DECLSPEC_HIDDEN;
-BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert) DECLSPEC_HIDDEN;
+BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert, DWORD *type) DECLSPEC_HIDDEN;
/* Allocates and initializes a certificate chain engine, but without creating
* the root store. Instead, it uses root, and assumes the caller has done any
--
2.14.1

View File

@@ -1,384 +0,0 @@
From 2da87110b4a7637cada56e5e188f2d6ccafc97e4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 30 Sep 2017 03:10:08 +0200
Subject: crypt32: Implement verification of ECDSA signatures.
---
dlls/crypt32/Makefile.in | 2 +-
dlls/crypt32/cert.c | 292 ++++++++++++++++++++++++++++++++++++++++++---
dlls/crypt32/tests/chain.c | 4 +-
3 files changed, 280 insertions(+), 18 deletions(-)
diff --git a/dlls/crypt32/Makefile.in b/dlls/crypt32/Makefile.in
index d3a409fcae6..09342221192 100644
--- a/dlls/crypt32/Makefile.in
+++ b/dlls/crypt32/Makefile.in
@@ -1,7 +1,7 @@
EXTRADEFS = -D_CRYPT32_
MODULE = crypt32.dll
IMPORTLIB = crypt32
-IMPORTS = user32 advapi32
+IMPORTS = user32 advapi32 bcrypt
DELAYIMPORTS = cryptnet
EXTRALIBS = $(SECURITY_LIBS)
diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c
index 0cfa46788f3..d2aa182ff6e 100644
--- a/dlls/crypt32/cert.c
+++ b/dlls/crypt32/cert.c
@@ -21,9 +21,14 @@
#include <stdarg.h>
#define NONAMELESSUNION
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
+#include "winternl.h"
+#define CRYPT_OID_INFO_HAS_EXTRA_FIELDS
#include "wincrypt.h"
+#include "bcrypt.h"
#include "winnls.h"
#include "rpc.h"
#include "wine/debug.h"
@@ -2409,36 +2414,29 @@ BOOL WINAPI CryptVerifyCertificateSignature(HCRYPTPROV_LEGACY hCryptProv,
CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY, pPublicKey, 0, NULL);
}
-static BOOL CRYPT_VerifyCertSignatureFromPublicKeyInfo(HCRYPTPROV_LEGACY hCryptProv,
- DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pubKeyInfo,
- const CERT_SIGNED_CONTENT_INFO *signedCert)
+static BOOL verify_signature_crypt(HCRYPTPROV_LEGACY hCryptProv,
+ DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pubKeyInfo,
+ const CERT_SIGNED_CONTENT_INFO *signedCert, PCCRYPT_OID_INFO info)
{
- BOOL ret;
- HCRYPTKEY key;
- PCCRYPT_OID_INFO info;
ALG_ID pubKeyID, hashID;
+ HCRYPTHASH hash;
+ HCRYPTKEY key;
+ BOOL ret;
- info = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY,
- signedCert->SignatureAlgorithm.pszObjId, 0);
- if (!info || info->dwGroupId != CRYPT_SIGN_ALG_OID_GROUP_ID)
- {
- SetLastError(NTE_BAD_ALGID);
- return FALSE;
- }
hashID = info->u.Algid;
if (info->ExtraInfo.cbData >= sizeof(ALG_ID))
pubKeyID = *(ALG_ID *)info->ExtraInfo.pbData;
else
pubKeyID = hashID;
+
/* Load the default provider if necessary */
if (!hCryptProv)
hCryptProv = CRYPT_GetDefaultProvider();
+
ret = CryptImportPublicKeyInfoEx(hCryptProv, dwCertEncodingType,
pubKeyInfo, pubKeyID, 0, NULL, &key);
if (ret)
{
- HCRYPTHASH hash;
-
ret = CryptCreateHash(hCryptProv, hashID, 0, 0, &hash);
if (ret)
{
@@ -2454,6 +2452,270 @@ static BOOL CRYPT_VerifyCertSignatureFromPublicKeyInfo(HCRYPTPROV_LEGACY hCryptP
return ret;
}
+static BOOL calculate_hash_bcrypt(const WCHAR *algorithm,
+ const CERT_SIGNED_CONTENT_INFO *signedCert, BYTE **hash_value, DWORD *hash_len)
+{
+ BCRYPT_HASH_HANDLE hash = NULL;
+ BCRYPT_ALG_HANDLE alg = NULL;
+ NTSTATUS status;
+ DWORD size;
+ BOOL ret = FALSE;
+
+ if ((status = BCryptOpenAlgorithmProvider(&alg, algorithm, NULL, 0)))
+ goto done;
+
+ if ((status = BCryptCreateHash(alg, &hash, NULL, 0, NULL, 0, 0)))
+ goto done;
+
+ if ((status = BCryptHashData(hash, signedCert->ToBeSigned.pbData, signedCert->ToBeSigned.cbData, 0)))
+ goto done;
+
+ if ((status = BCryptGetProperty(hash, BCRYPT_HASH_LENGTH, (BYTE *)hash_len, sizeof(*hash_len), &size, 0)))
+ goto done;
+
+ if (!(*hash_value = CryptMemAlloc(*hash_len)))
+ {
+ status = STATUS_NO_MEMORY;
+ goto done;
+ }
+
+ if ((status = BCryptFinishHash(hash, *hash_value, *hash_len, 0)))
+ {
+ CryptMemFree(*hash_value);
+ goto done;
+ }
+
+ ret = TRUE;
+
+done:
+ if (hash) BCryptDestroyHash(hash);
+ if (alg) BCryptCloseAlgorithmProvider(alg, 0);
+ if (status) SetLastError(RtlNtStatusToDosError(status));
+ return ret;
+}
+
+static BOOL import_bcrypt_pubkey_ecc(PCERT_PUBLIC_KEY_INFO pubKeyInfo, BCRYPT_KEY_HANDLE *key)
+{
+ DWORD blob_magic, ecckey_len, size;
+ NTSTATUS status = STATUS_SUCCESS;
+ BCRYPT_ECCKEY_BLOB *ecckey;
+ const WCHAR *sign_algo;
+ BCRYPT_ALG_HANDLE alg;
+ LPSTR *ecc_curve;
+
+ if (!pubKeyInfo->PublicKey.cbData)
+ {
+ SetLastError(NTE_BAD_ALGID);
+ return FALSE;
+ }
+
+ if (pubKeyInfo->PublicKey.pbData[0] != 0x4)
+ {
+ FIXME("Compressed ECC curves (%02x) not yet supported\n", pubKeyInfo->PublicKey.pbData[0]);
+ SetLastError(NTE_BAD_ALGID);
+ return FALSE;
+ }
+
+ if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_OBJECT_IDENTIFIER,
+ pubKeyInfo->Algorithm.Parameters.pbData,
+ pubKeyInfo->Algorithm.Parameters.cbData,
+ CRYPT_DECODE_ALLOC_FLAG, NULL, &ecc_curve, &size))
+ return FALSE;
+
+ if (!strcmp(*ecc_curve, szOID_ECC_CURVE_P256))
+ {
+ sign_algo = BCRYPT_ECDSA_P256_ALGORITHM;
+ blob_magic = BCRYPT_ECDSA_PUBLIC_P256_MAGIC;
+ }
+ else if(!strcmp(*ecc_curve, szOID_ECC_CURVE_P384))
+ {
+ sign_algo = BCRYPT_ECDSA_P384_ALGORITHM;
+ blob_magic = BCRYPT_ECDSA_PUBLIC_P384_MAGIC;
+ }
+ else
+ {
+ FIXME("Unsupported ecc curve type: %s\n", *ecc_curve);
+ sign_algo = NULL;
+ blob_magic = 0;
+ }
+ LocalFree(ecc_curve);
+
+ if (!sign_algo)
+ {
+ SetLastError(NTE_BAD_ALGID);
+ return FALSE;
+ }
+
+ if ((status = BCryptOpenAlgorithmProvider(&alg, sign_algo, NULL, 0)))
+ {
+ SetLastError(RtlNtStatusToDosError(status));
+ return FALSE;
+ }
+
+ ecckey_len = sizeof(BCRYPT_ECCKEY_BLOB) + pubKeyInfo->PublicKey.cbData - 1;
+ if (!(ecckey = CryptMemAlloc(ecckey_len)))
+ {
+ BCryptCloseAlgorithmProvider(alg, 0);
+ SetLastError(ERROR_OUTOFMEMORY);
+ return FALSE;
+ }
+
+ ecckey->dwMagic = blob_magic;
+ ecckey->cbKey = (pubKeyInfo->PublicKey.cbData - 1) / 2;
+ memcpy(ecckey + 1, pubKeyInfo->PublicKey.pbData + 1, pubKeyInfo->PublicKey.cbData - 1);
+
+ status = BCryptImportKeyPair(alg, NULL, BCRYPT_ECCPUBLIC_BLOB, key, (BYTE*)ecckey, ecckey_len, 0);
+ BCryptCloseAlgorithmProvider(alg, 0);
+ if (status)
+ {
+ SetLastError(RtlNtStatusToDosError(status));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static BOOL import_bcrypt_pubkey(PCERT_PUBLIC_KEY_INFO pubKeyInfo, BCRYPT_KEY_HANDLE *key)
+{
+ if (!strcmp(pubKeyInfo->Algorithm.pszObjId, szOID_ECC_PUBLIC_KEY))
+ return import_bcrypt_pubkey_ecc(pubKeyInfo, key);
+
+ FIXME("Unsupported public key type: %s\n", debugstr_a(pubKeyInfo->Algorithm.pszObjId));
+ SetLastError(NTE_BAD_ALGID);
+ return FALSE;
+}
+
+static BOOL prepare_bcrypt_signature_ecc(BYTE *encoded_sig, DWORD encoded_size,
+ BYTE **sig_value, DWORD *sig_len)
+{
+ CERT_ECC_SIGNATURE *ecc_sig;
+ DWORD size;
+ int i;
+
+ if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_ECC_SIGNATURE,
+ encoded_sig, encoded_size,
+ CRYPT_DECODE_ALLOC_FLAG, NULL, &ecc_sig, &size))
+ return FALSE;
+
+ if (!ecc_sig->r.cbData || !ecc_sig->s.cbData)
+ {
+ LocalFree(ecc_sig);
+ SetLastError(ERROR_INVALID_DATA);
+ return FALSE;
+ }
+
+ *sig_len = ecc_sig->r.cbData + ecc_sig->s.cbData;
+ if (!(*sig_value = CryptMemAlloc(*sig_len)))
+ {
+ LocalFree(ecc_sig);
+ SetLastError(ERROR_OUTOFMEMORY);
+ return FALSE;
+ }
+
+ for (i = 0; i < ecc_sig->r.cbData; i++)
+ (*sig_value)[i] = ecc_sig->r.pbData[ecc_sig->r.cbData - i - 1];
+ for (i = 0; i < ecc_sig->s.cbData; i++)
+ (*sig_value)[ecc_sig->r.cbData + i] = ecc_sig->s.pbData[ecc_sig->s.cbData - i - 1];
+
+ LocalFree(ecc_sig);
+ return TRUE;
+}
+
+static BOOL prepare_bcrypt_signature(PCERT_PUBLIC_KEY_INFO pubKeyInfo,
+ const CERT_SIGNED_CONTENT_INFO *signedCert, BYTE **sig_value, DWORD *sig_len)
+{
+ BYTE *encoded_sig;
+ BOOL ret = FALSE;
+ int i;
+
+ if (!signedCert->Signature.cbData)
+ {
+ SetLastError(ERROR_INVALID_DATA);
+ return FALSE;
+ }
+
+ if (!(encoded_sig = CryptMemAlloc(signedCert->Signature.cbData)))
+ {
+ SetLastError(ERROR_OUTOFMEMORY);
+ return FALSE;
+ }
+
+ for (i = 0; i < signedCert->Signature.cbData; i++)
+ encoded_sig[i] = signedCert->Signature.pbData[signedCert->Signature.cbData - i - 1];
+
+ if (!strcmp(pubKeyInfo->Algorithm.pszObjId, szOID_ECC_PUBLIC_KEY))
+ ret = prepare_bcrypt_signature_ecc(encoded_sig, signedCert->Signature.cbData, sig_value, sig_len);
+ else
+ {
+ FIXME("Unsupported public key type: %s\n", debugstr_a(pubKeyInfo->Algorithm.pszObjId));
+ SetLastError(NTE_BAD_ALGID);
+ }
+
+ CryptMemFree(encoded_sig);
+ return ret;
+}
+
+static BOOL verify_signature_bcrypt(HCRYPTPROV_LEGACY hCryptProv,
+ DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pubKeyInfo,
+ const CERT_SIGNED_CONTENT_INFO *signedCert, PCCRYPT_OID_INFO info)
+{
+ BCRYPT_KEY_HANDLE key = NULL;
+ BYTE *hash_value, *sig_value;
+ DWORD hash_len, sig_len;
+ NTSTATUS status;
+
+ if (!calculate_hash_bcrypt(info->pwszCNGAlgid, signedCert, &hash_value, &hash_len))
+ return FALSE;
+
+ if (!import_bcrypt_pubkey(pubKeyInfo, &key))
+ {
+ CryptMemFree(hash_value);
+ return FALSE;
+ }
+
+ if (!prepare_bcrypt_signature(pubKeyInfo, signedCert, &sig_value, &sig_len))
+ {
+ CryptMemFree(hash_value);
+ BCryptDestroyKey(key);
+ return FALSE;
+ }
+
+ status = BCryptVerifySignature(key, NULL, hash_value, hash_len, sig_value, sig_len, 0);
+
+ BCryptDestroyKey(key);
+ CryptMemFree(hash_value);
+ CryptMemFree(sig_value);
+
+ if (status)
+ {
+ FIXME("Failed to verify signature: %08x\n", status);
+ SetLastError(RtlNtStatusToDosError(status));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static BOOL CRYPT_VerifyCertSignatureFromPublicKeyInfo(HCRYPTPROV_LEGACY hCryptProv,
+ DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pubKeyInfo,
+ const CERT_SIGNED_CONTENT_INFO *signedCert)
+{
+ PCCRYPT_OID_INFO info;
+
+ info = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY,
+ signedCert->SignatureAlgorithm.pszObjId, 0);
+ if (!info || info->dwGroupId != CRYPT_SIGN_ALG_OID_GROUP_ID)
+ {
+ SetLastError(NTE_BAD_ALGID);
+ return FALSE;
+ }
+
+ if (info->u.Algid == CALG_OID_INFO_CNG_ONLY)
+ return verify_signature_bcrypt(hCryptProv, dwCertEncodingType, pubKeyInfo, signedCert, info);
+ else
+ return verify_signature_crypt(hCryptProv, dwCertEncodingType, pubKeyInfo, signedCert, info);
+}
+
BOOL WINAPI CryptVerifyCertificateSignatureEx(HCRYPTPROV_LEGACY hCryptProv,
DWORD dwCertEncodingType, DWORD dwSubjectType, void *pvSubject,
DWORD dwIssuerType, void *pvIssuer, DWORD dwFlags, void *pvReserved)
diff --git a/dlls/crypt32/tests/chain.c b/dlls/crypt32/tests/chain.c
index 1279735e496..e3b280b0884 100644
--- a/dlls/crypt32/tests/chain.c
+++ b/dlls/crypt32/tests/chain.c
@@ -3945,7 +3945,7 @@ static ChainCheck chainCheckECDSA = {
{ CERT_TRUST_IS_UNTRUSTED_ROOT, CERT_TRUST_HAS_PREFERRED_ISSUER },
{ CERT_TRUST_IS_UNTRUSTED_ROOT, 0 },
1, simpleStatusECDSA
- }, TODO_ERROR
+ }, 0
};
#define test_name_blob(a,b) _test_name_blob(__LINE__,a,b)
@@ -4226,7 +4226,7 @@ static void testGetCertChain(void)
chain = getChain(NULL, &chainCheckECDSA.certs, 0, TRUE, &nov2017, FALSE, 0);
if (chain)
{
- todo_wine ok(chain->TrustStatus.dwErrorStatus == CERT_TRUST_IS_UNTRUSTED_ROOT,
+ ok(chain->TrustStatus.dwErrorStatus == CERT_TRUST_IS_UNTRUSTED_ROOT,
"unexpected chain error status %08x\n", chain->TrustStatus.dwErrorStatus);
checkChainStatus(chain, &chainCheckECDSA.status, chainCheckECDSA.todo, "chainCheckECDSA", 0);
pCertFreeCertificateChain(chain);
--
2.14.1

View File

@@ -1,16 +1,17 @@
From 342951349469b7a84f3226d02f04ca5401982273 Mon Sep 17 00:00:00 2001
From 51ba80615215fac54b251e56a374dfab9a2b834b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 15 Aug 2015 02:59:17 +0200
Subject: dxdiagn: Enumerate DirectSound devices and add some basic properties.
Subject: [PATCH] dxdiagn: Enumerate DirectSound devices and add some basic
properties.
---
dlls/dxdiagn/Makefile.in | 2 +-
dlls/dxdiagn/provider.c | 91 ++++++++++++++++++++++++++
dlls/dxdiagn/tests/container.c | 141 +++++++++++++++++++++++++++++++++++++++++
dlls/dxdiagn/provider.c | 91 +++++++++++++++++++++
dlls/dxdiagn/tests/container.c | 141 +++++++++++++++++++++++++++++++++
3 files changed, 233 insertions(+), 1 deletion(-)
diff --git a/dlls/dxdiagn/Makefile.in b/dlls/dxdiagn/Makefile.in
index 3a1017e9d0a..87f6177aadf 100644
index c16396e464b..e926d3b2a8a 100644
--- a/dlls/dxdiagn/Makefile.in
+++ b/dlls/dxdiagn/Makefile.in
@@ -1,5 +1,5 @@
@@ -21,18 +22,18 @@ index 3a1017e9d0a..87f6177aadf 100644
C_SRCS = \
container.c \
diff --git a/dlls/dxdiagn/provider.c b/dlls/dxdiagn/provider.c
index 5665d01d5b8..20998bc9aba 100644
index 1fdab5e2db0..6fb9e585dbd 100644
--- a/dlls/dxdiagn/provider.c
+++ b/dlls/dxdiagn/provider.c
@@ -38,6 +38,7 @@
#include "fil_data.h"
#include "wine/fil_data.h"
#include "psapi.h"
#include "wbemcli.h"
+#include "dsound.h"
#include "wine/debug.h"
@@ -1195,11 +1196,85 @@ static HRESULT build_displaydevices_tree(IDxDiagContainerImpl_Container *node)
@@ -1354,11 +1355,85 @@ static HRESULT build_displaydevices_tree(IDxDiagContainerImpl_Container *node)
return fill_display_information_fallback(node);
}
@@ -118,7 +119,7 @@ index 5665d01d5b8..20998bc9aba 100644
IDxDiagContainerImpl_Container *cont;
cont = allocate_information_node(DxDiag_SoundDevices);
@@ -1208,12 +1283,28 @@ static HRESULT build_directsound_tree(IDxDiagContainerImpl_Container *node)
@@ -1367,12 +1442,28 @@ static HRESULT build_directsound_tree(IDxDiagContainerImpl_Container *node)
add_subcontainer(node, cont);
@@ -148,7 +149,7 @@ index 5665d01d5b8..20998bc9aba 100644
}
diff --git a/dlls/dxdiagn/tests/container.c b/dlls/dxdiagn/tests/container.c
index 5bc5161635a..2ffe0fb685b 100644
index 936707632a4..c80717cd392 100644
--- a/dlls/dxdiagn/tests/container.c
+++ b/dlls/dxdiagn/tests/container.c
@@ -36,6 +36,11 @@ static IDxDiagContainer *pddc;
@@ -163,7 +164,7 @@ index 5bc5161635a..2ffe0fb685b 100644
/* Based on debugstr_variant in dlls/jscript/jsutils.c. */
static const char *debugstr_variant(const VARIANT *var)
@@ -1020,6 +1025,140 @@ cleanup:
@@ -1022,6 +1027,140 @@ cleanup:
IDxDiagProvider_Release(pddp);
}
@@ -304,7 +305,7 @@ index 5bc5161635a..2ffe0fb685b 100644
START_TEST(container)
{
CoInitialize(NULL);
@@ -1034,5 +1173,7 @@ START_TEST(container)
@@ -1036,5 +1175,7 @@ START_TEST(container)
test_root_children();
test_DxDiag_SystemInfo();
test_DxDiag_DisplayDevices();
@@ -313,5 +314,5 @@ index 5bc5161635a..2ffe0fb685b 100644
CoUninitialize();
}
--
2.11.0
2.18.0

View File

@@ -1,18 +1,18 @@
From 8f0f5577096155171dceb98ee28c570533a9a89c Mon Sep 17 00:00:00 2001
From a539993bd7c60424fb6d592be8cb5040959e1b48 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Sun, 17 Apr 2016 19:58:15 +0800
Subject: kernel32/tests: Add some tests for GetLongPathName/GetShortPathName
called with a wildcard.
Subject: [PATCH] kernel32/tests: Add some tests for
GetLongPathName/GetShortPathName called with a wildcard.
---
dlls/kernel32/tests/path.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c
index 079820f..0dc8802 100644
index ca1cbf3..1e698bf 100644
--- a/dlls/kernel32/tests/path.c
+++ b/dlls/kernel32/tests/path.c
@@ -1170,7 +1170,7 @@ static void test_GetTempPath(void)
@@ -1186,7 +1186,7 @@ static void test_GetTempPath(void)
static void test_GetLongPathNameA(void)
{
DWORD length, explength, hostsize;
@@ -21,7 +21,7 @@ index 079820f..0dc8802 100644
char longpath[MAX_PATH];
char unc_prefix[MAX_PATH];
char unc_short[MAX_PATH], unc_long[MAX_PATH];
@@ -1181,7 +1181,17 @@ static void test_GetLongPathNameA(void)
@@ -1197,7 +1197,17 @@ static void test_GetLongPathNameA(void)
return;
GetTempPathA(MAX_PATH, tempfile);
@@ -40,7 +40,7 @@ index 079820f..0dc8802 100644
file = CreateFileA(tempfile, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
CloseHandle(file);
@@ -1385,6 +1395,7 @@ static void test_GetShortPathNameW(void)
@@ -1401,6 +1411,7 @@ static void test_GetShortPathNameW(void)
static const WCHAR name[] = { 't', 'e', 's', 't', 0 };
static const WCHAR backSlash[] = { '\\', 0 };
static const WCHAR a_bcdeW[] = {'a','.','b','c','d','e',0};
@@ -48,8 +48,8 @@ index 079820f..0dc8802 100644
WCHAR path[MAX_PATH], tmppath[MAX_PATH], *ptr;
WCHAR short_path[MAX_PATH];
DWORD length;
@@ -1447,6 +1458,15 @@ static void test_GetShortPathNameW(void)
length = GetShortPathNameW( path, short_path, sizeof(short_path)/sizeof(*short_path) );
@@ -1463,6 +1474,15 @@ static void test_GetShortPathNameW(void)
length = GetShortPathNameW( path, short_path, ARRAY_SIZE( short_path ));
ok( length, "GetShortPathNameW failed: %u.\n", GetLastError() );
+ lstrcpyW(ptr, wildW);
@@ -65,5 +65,5 @@ index 079820f..0dc8802 100644
ok( ret, "Cannot delete file.\n" );
*ptr = 0;
--
2.7.1
1.9.1

View File

@@ -1,28 +0,0 @@
From 46302575f68264f8b097a663bee06e8624fa69ad Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 1 May 2016 16:45:31 +0200
Subject: kernel32: Fill stack with meaningful values in call_process_entry
mis-align workaround.
---
dlls/kernel32/process.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 4771108..28ec659 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -1064,7 +1064,9 @@ __ASM_GLOBAL_FUNC( call_process_entry,
__ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
"movl %esp,%ebp\n\t"
__ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
- "subl $12,%esp\n\t" /* deliberately mis-align the stack by 8, Doom 3 needs this */
+ "pushl 4(%ebp)\n\t" /* deliberately mis-align the stack by 8, Doom 3 needs this */
+ "pushl 4(%ebp)\n\t" /* Driller expects readable address at this offset */
+ "pushl 4(%ebp)\n\t"
"pushl 8(%ebp)\n\t"
"call *12(%ebp)\n\t"
"leave\n\t"
--
2.8.0

View File

@@ -1 +0,0 @@
Fixes: [24374] Fill stack with meaningful values in call_process_entry mis-align workaround

View File

@@ -1,2 +1 @@
Fixes: [42125] Various PE loader fixes for 8k demos
Depends: kernel32-Misalign_Workaround

View File

@@ -1,7 +1,7 @@
From fbe441532820151b6fbb6462378cf2465303cf80 Mon Sep 17 00:00:00 2001
From bbcdf76bf8fd3786856b2c9afebe2a6b3974a037 Mon Sep 17 00:00:00 2001
From: Claudio Fontana <claudio.fontana@linaro.org>
Date: Sat, 29 Nov 2014 22:06:20 +0100
Subject: kernel32: Allow empty profile section and key name strings.
Subject: [PATCH] kernel32: Allow empty profile section and key name strings.
Consider "" a normal section, and fix calculation for zero
length section name string and key name string.
@@ -15,7 +15,7 @@ Changes by Sebastian Lackner <sebastian@fds-team.de>:
2 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c
index a9a11b1..fb35c90 100644
index 0974aaf..f0c65f1 100644
--- a/dlls/kernel32/profile.c
+++ b/dlls/kernel32/profile.c
@@ -500,7 +500,7 @@ static BOOL PROFILE_DeleteSection( PROFILESECTION **section, LPCWSTR name )
@@ -119,13 +119,13 @@ index a9a11b1..fb35c90 100644
INT ret = PROFILE_GetSection(CurProfile->section, section, buffer, len, FALSE);
if (!buffer[0]) /* no luck -> def_val */
diff --git a/dlls/kernel32/tests/profile.c b/dlls/kernel32/tests/profile.c
index 2eb90a8..990aa14 100644
index 4dbe129..e443b25 100644
--- a/dlls/kernel32/tests/profile.c
+++ b/dlls/kernel32/tests/profile.c
@@ -154,9 +154,7 @@ static void test_profile_string(void)
@@ -153,9 +153,7 @@ static void test_profile_string(void)
/* works only in unicode, ascii crashes */
ret=GetPrivateProfileStringW(sW, emptyW, emptyW, bufW,
sizeof(bufW)/sizeof(bufW[0]), TESTFILE2W);
ret=GetPrivateProfileStringW(sW, emptyW, emptyW, bufW, ARRAY_SIZE(bufW), TESTFILE2W);
- todo_wine
ok(ret == 10, "expected 10, got %u\n", ret);
- todo_wine
@@ -133,5 +133,5 @@ index 2eb90a8..990aa14 100644
wine_dbgstr_w(valnokeyW), wine_dbgstr_w(bufW) );
--
2.1.3
1.9.1

View File

@@ -1,57 +0,0 @@
From 3418775c892b4fff2dd9ca879b7d4d1059bd065b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 15 Jan 2016 12:58:17 +0100
Subject: [PATCH] msvcr120: Add stub for _SetWinRTOutOfMemoryExceptionCallback.
---
dlls/msvcr120/msvcr120.spec | 2 +-
dlls/msvcr120_app/msvcr120_app.spec | 2 +-
dlls/msvcrt/misc.c | 8 ++++++++
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec
index b6f0e1f..19088e4 100644
--- a/dlls/msvcr120/msvcr120.spec
+++ b/dlls/msvcr120/msvcr120.spec
@@ -844,7 +844,7 @@
@ stub -arch=i386 _NLG_Return
@ stub -arch=i386 _NLG_Return2
@ stub -arch=arm,win64 __NLG_Return2
-@ stub _SetWinRTOutOfMemoryExceptionCallback
+@ cdecl -arch=i386,x86_64,arm _SetWinRTOutOfMemoryExceptionCallback(ptr) MSVCR120__SetWinRTOutOfMemoryExceptionCallback
@ stub -arch=win64 _SetImageBase
@ stub -arch=win64 _SetThrowImageBase
@ cdecl _Strftime(ptr long str ptr ptr)
diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec
index 7a9b6aa..166d6b8 100644
--- a/dlls/msvcr120_app/msvcr120_app.spec
+++ b/dlls/msvcr120_app/msvcr120_app.spec
@@ -838,7 +838,7 @@
@ stub -arch=i386 _NLG_Return
@ stub -arch=i386 _NLG_Return2
@ stub -arch=arm,win64 __NLG_Return2
-@ stub _SetWinRTOutOfMemoryExceptionCallback
+@ cdecl -arch=i386,x86_64,arm _SetWinRTOutOfMemoryExceptionCallback(ptr) msvcr120._SetWinRTOutOfMemoryExceptionCallback
@ stub -arch=win64 _SetImageBase
@ stub -arch=win64 _SetThrowImageBase
@ cdecl _Strftime(ptr long str ptr ptr) msvcr120._Strftime
diff --git a/dlls/msvcrt/misc.c b/dlls/msvcrt/misc.c
index c197d69..c5f8f42 100644
--- a/dlls/msvcrt/misc.c
+++ b/dlls/msvcrt/misc.c
@@ -578,4 +578,12 @@ void CDECL MSVCRT__crtSleep(DWORD timeout)
TRACE("(%u)\n", timeout);
Sleep(timeout);
}
+
+/*********************************************************************
+ * _SetWinRTOutOfMemoryExceptionCallback (MSVCR120.@)
+ */
+void CDECL MSVCR120__SetWinRTOutOfMemoryExceptionCallback(void *callback)
+{
+ FIXME("(%p): stub\n", callback);
+}
#endif
--
1.9.1

View File

@@ -1 +0,0 @@
Fixes: Add stub for _SetWinRTOutOfMemoryExceptionCallback

View File

@@ -1,4 +1,4 @@
From 4c3ec3a9f0ed4523f6d6f7bcba9540803eea8a64 Mon Sep 17 00:00:00 2001
From 7c2a302a95f6be16dbb5f6b3379e57d411a5310a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 1 Jun 2017 06:04:53 +0200
Subject: ntdll: Fix holes in ELF mappings. (v2)
@@ -10,14 +10,13 @@ Based on a patch by Andrew Wesie.
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 0b813d3b0e9..b10c36c3f69 100644
index 53db698..f1869be 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -425,6 +425,16 @@ static inline BOOL is_write_watch_range( const void *addr, size_t size )
}
@@ -429,6 +429,16 @@ static inline BOOL is_write_watch_range( const void *addr, size_t size )
+/***********************************************************************
/***********************************************************************
+ * is_system_range
+ */
+static inline BOOL is_system_range( const void *addr, size_t size )
@@ -27,10 +26,11 @@ index 0b813d3b0e9..b10c36c3f69 100644
+}
+
+
/***********************************************************************
+/***********************************************************************
* find_view_range
*
@@ -1822,6 +1832,19 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
* Find the first view overlapping at least part of the specified range.
@@ -2047,6 +2057,19 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
if (VIRTUAL_GetUnixProt( get_page_vprot( page )) & PROT_READ) ret = STATUS_SUCCESS;
else update_shared_data = FALSE;
}
@@ -51,10 +51,10 @@ index 0b813d3b0e9..b10c36c3f69 100644
if (update_shared_data)
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
index e35a7b694cb..e7af5bc61cc 100644
index e61cf02..6e98754 100644
--- a/dlls/psapi/tests/psapi_main.c
+++ b/dlls/psapi/tests/psapi_main.c
@@ -152,6 +152,7 @@ static void test_EnumProcessModules(void)
@@ -196,6 +196,7 @@ todo_wine
static void test_GetModuleInformation(void)
{
HMODULE hMod = GetModuleHandleA(NULL);
@@ -62,19 +62,19 @@ index e35a7b694cb..e7af5bc61cc 100644
MODULEINFO info;
DWORD ret;
@@ -171,10 +172,21 @@ static void test_GetModuleInformation(void)
pGetModuleInformation(hpQV, hMod, &info, sizeof(info)-1);
@@ -215,10 +216,21 @@ static void test_GetModuleInformation(void)
GetModuleInformation(hpQV, hMod, &info, sizeof(info)-1);
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected error=ERROR_INSUFFICIENT_BUFFER but got %d\n", GetLastError());
- SetLastError(0xdeadbeef);
ret = pGetModuleInformation(hpQV, hMod, &info, sizeof(info));
ret = GetModuleInformation(hpQV, hMod, &info, sizeof(info));
ok(ret == 1, "failed with %d\n", GetLastError());
ok(info.lpBaseOfDll == hMod, "lpBaseOfDll=%p hMod=%p\n", info.lpBaseOfDll, hMod);
+
+ hMod = LoadLibraryA("shell32.dll");
+ ok(hMod != NULL, "Failed to load shell32.dll, error: %u\n", GetLastError());
+
+ ret = pGetModuleInformation(hpQV, hMod, &info, sizeof(info));
+ ret = GetModuleInformation(hpQV, hMod, &info, sizeof(info));
+ ok(ret == 1, "failed with %d\n", GetLastError());
+ info.SizeOfImage /= sizeof(DWORD);
+ for (tmp = (DWORD *)hMod; info.SizeOfImage; info.SizeOfImage--)
@@ -86,5 +86,5 @@ index e35a7b694cb..e7af5bc61cc 100644
static BOOL check_with_margin(SIZE_T perf, SIZE_T sysperf, int margin)
--
2.14.1
2.7.4

View File

@@ -1,4 +1,4 @@
From 225b86d4fb6f51854f173076564f6bea9a9e5ac0 Mon Sep 17 00:00:00 2001
From 8ebb22fe5f693288dd36dca0aa911164385b6e77 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 3 Apr 2017 05:30:27 +0200
Subject: [PATCH] ntdll: Implement HashLinks field in LDR module data.
@@ -10,7 +10,7 @@ Subject: [PATCH] ntdll: Implement HashLinks field in LDR module data.
3 files changed, 144 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index ac62d28..0f5ddf1 100644
index 037c01e..369d48b 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -29,6 +29,7 @@
@@ -108,10 +108,10 @@ index ac62d28..0f5ddf1 100644
+ test_HashLinks();
}
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 06915aa..722ab44 100644
index c24fa95..246bc0b 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -86,6 +86,9 @@ static const char * const reason_names[] =
@@ -96,6 +96,9 @@ static const char * const reason_names[] =
static const WCHAR dllW[] = {'.','d','l','l',0};
@@ -121,8 +121,8 @@ index 06915aa..722ab44 100644
/* internal representation of 32bit modules. per process. */
typedef struct _wine_modref
{
@@ -349,6 +352,52 @@ static inline ULONG_PTR allocate_stub( const char *dll, const char *name ) { ret
@@ -382,6 +385,52 @@ static void call_ldr_notifications( ULONG reason, LDR_MODULE *module )
}
/*************************************************************************
+ * hash_basename
@@ -174,7 +174,7 @@ index 06915aa..722ab44 100644
* get_modref
*
* Looks for the referenced HMODULE in the current process
@@ -1067,7 +1116,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename, LPCWSTR fak
@@ -1100,7 +1149,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename, LPCWSTR fak
&wm->ldr.InLoadOrderModuleList);
InsertTailList(&NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList,
&wm->ldr.InMemoryOrderModuleList);
@@ -187,7 +187,7 @@ index 06915aa..722ab44 100644
if (!(nt->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT))
{
@@ -1795,6 +1849,7 @@ static void load_builtin_callback( void *module, const char *filename )
@@ -1864,6 +1918,7 @@ static void load_builtin_callback( void *module, const char *filename )
/* the module has only be inserted in the load & memory order lists */
RemoveEntryList(&wm->ldr.InLoadOrderModuleList);
RemoveEntryList(&wm->ldr.InMemoryOrderModuleList);
@@ -195,7 +195,7 @@ index 06915aa..722ab44 100644
/* FIXME: free the modref */
builtin_load_info->status = STATUS_DLL_NOT_FOUND;
return;
@@ -2055,6 +2110,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, LPCWSTR fakemo
@@ -2124,6 +2179,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, LPCWSTR fakemo
/* the module has only be inserted in the load & memory order lists */
RemoveEntryList(&wm->ldr.InLoadOrderModuleList);
RemoveEntryList(&wm->ldr.InMemoryOrderModuleList);
@@ -203,7 +203,7 @@ index 06915aa..722ab44 100644
/* FIXME: there are several more dangling references
* left. Including dlls loaded by this dll before the
@@ -3230,6 +3286,7 @@ static void free_modref( WINE_MODREF *wm )
@@ -3299,6 +3355,7 @@ static void free_modref( WINE_MODREF *wm )
{
RemoveEntryList(&wm->ldr.InLoadOrderModuleList);
RemoveEntryList(&wm->ldr.InMemoryOrderModuleList);
@@ -211,7 +211,7 @@ index 06915aa..722ab44 100644
if (wm->ldr.InInitializationOrderModuleList.Flink)
RemoveEntryList(&wm->ldr.InInitializationOrderModuleList);
@@ -3627,6 +3684,9 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
@@ -3696,6 +3753,9 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
RemoveEntryList( &wm->ldr.InMemoryOrderModuleList );
InsertHeadList( &peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderModuleList );
@@ -221,7 +221,7 @@ index 06915aa..722ab44 100644
if ((status = virtual_alloc_thread_stack( NtCurrentTeb(), 0, 0, NULL )) != STATUS_SUCCESS)
{
ERR( "Main exe initialization for %s failed, status %x\n",
@@ -3773,6 +3833,7 @@ void __wine_process_init(void)
@@ -3842,6 +3902,7 @@ void __wine_process_init(void)
NTSTATUS status;
ANSI_STRING func_name;
void (* DECLSPEC_NORETURN CDECL init_func)(void);
@@ -229,7 +229,7 @@ index 06915aa..722ab44 100644
main_exe_file = thread_init();
@@ -3782,6 +3843,10 @@ void __wine_process_init(void)
@@ -3851,6 +3912,10 @@ void __wine_process_init(void)
load_global_options();
@@ -241,10 +241,10 @@ index 06915aa..722ab44 100644
wine_dll_set_callback( load_builtin_callback );
diff --git a/include/winternl.h b/include/winternl.h
index 3659db1..bd6a8af 100644
index 558f643..737e7f1 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2164,8 +2164,7 @@ typedef struct _LDR_MODULE
@@ -2171,8 +2171,7 @@ typedef struct _LDR_MODULE
ULONG Flags;
SHORT LoadCount;
SHORT TlsIndex;
@@ -254,7 +254,7 @@ index 3659db1..bd6a8af 100644
ULONG TimeDateStamp;
HANDLE ActivationContext;
PVOID PatchInformation;
@@ -2175,6 +2174,9 @@ typedef struct _LDR_MODULE
@@ -2182,6 +2181,9 @@ typedef struct _LDR_MODULE
PVOID ContextInformation;
ULONG_PTR OriginalBase;
LARGE_INTEGER LoadTime;

View File

@@ -1,4 +1,4 @@
From 2d479408e3fb2670cb0d30ab912f88aa627c687f Mon Sep 17 00:00:00 2001
From c2794d82d31322d361e3545e54789fee28119d40 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 30 May 2015 02:23:15 +0200
Subject: [PATCH] ntdll: Add support for hiding wine version information from
@@ -10,10 +10,10 @@ 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 51aa334..1a69606 100644
index 58c02c9..04bae4b 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -67,9 +67,12 @@ typedef void (CALLBACK *LDRENUMPROC)(LDR_MODULE *, void *, BOOLEAN *);
@@ -68,9 +68,12 @@ typedef void (CALLBACK *LDRENUMPROC)(LDR_MODULE *, void *, BOOLEAN *);
const WCHAR system_dir[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
's','y','s','t','e','m','3','2','\\',0};
@@ -24,9 +24,9 @@ index 51aa334..1a69606 100644
static int free_lib_count; /* recursion depth of LdrUnloadDll calls */
+static BOOL hide_wine_exports = FALSE; /* try to hide ntdll wine exports from applications */
static const char * const reason_names[] =
struct ldr_notification
{
@@ -1477,6 +1480,96 @@ NTSTATUS WINAPI LdrUnlockLoaderLock( ULONG flags, ULONG_PTR magic )
@@ -1598,6 +1601,96 @@ NTSTATUS WINAPI LdrUnlockLoaderLock( ULONG flags, ULONG_PTR magic )
}
@@ -123,7 +123,7 @@ index 51aa334..1a69606 100644
/******************************************************************
* LdrGetProcedureAddress (NTDLL.@)
*/
@@ -1497,7 +1590,7 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name,
@@ -1618,7 +1711,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,7 +132,7 @@ index 51aa334..1a69606 100644
{
*address = proc;
ret = STATUS_SUCCESS;
@@ -3182,6 +3275,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
@@ -3374,6 +3467,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
if (!peb->ProcessParameters->WindowTitle.Buffer)
peb->ProcessParameters->WindowTitle = wm->ldr.FullDllName;
version_init( wm->ldr.FullDllName.Buffer );
@@ -141,10 +141,10 @@ index 51aa334..1a69606 100644
LdrQueryImageFileExecutionOptions( &peb->ProcessParameters->ImagePathName, globalflagW,
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 717e47d..3007755 100644
index d0fc81b..c09f25c 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -251,6 +251,11 @@ extern HANDLE keyed_event DECLSPEC_HIDDEN;
@@ -254,6 +254,11 @@ extern HANDLE keyed_event DECLSPEC_HIDDEN;
NTSTATUS WINAPI RtlHashUnicodeString(PCUNICODE_STRING,BOOLEAN,ULONG,ULONG*);
@@ -157,5 +157,5 @@ index 717e47d..3007755 100644
extern BOOL read_process_time(int unix_pid, int unix_tid, unsigned long clk_tck,
LARGE_INTEGER *kernel, LARGE_INTEGER *user) DECLSPEC_HIDDEN;
--
2.7.4
1.9.1

View File

@@ -1,450 +0,0 @@
From 1a105dee7bff64ffe5280b29e4274c0d375cacf9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 22 Jul 2017 03:56:26 +0200
Subject: [PATCH] ntdll: Implement LdrRegisterDllNotification and
LdrUnregisterDllNotification.
---
dlls/ntdll/loader.c | 79 +++++++++++++++-
dlls/ntdll/tests/rtl.c | 250 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 325 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index ba3e2df..6495bb3 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -40,6 +40,7 @@
#include "wine/library.h"
#include "wine/unicode.h"
#include "wine/debug.h"
+#include "wine/list.h"
#include "wine/server.h"
#include "ntdll_misc.h"
#include "ddk/wdm.h"
@@ -67,6 +68,15 @@ typedef void (CALLBACK *LDRENUMPROC)(LDR_MODULE *, void *, BOOLEAN *);
const WCHAR system_dir[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
's','y','s','t','e','m','3','2','\\',0};
+struct ldr_notification
+{
+ struct list entry;
+ PLDR_DLL_NOTIFICATION_FUNCTION callback;
+ void *context;
+};
+
+static struct list ldr_notifications = LIST_INIT( ldr_notifications );
+
#define IS_OPTION_TRUE(ch) ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
static BOOL imports_fixup_done = FALSE; /* set once the imports have been fixed up, before attaching them */
@@ -350,6 +360,29 @@ static ULONG_PTR allocate_stub( const char *dll, const char *name )
static inline ULONG_PTR allocate_stub( const char *dll, const char *name ) { return 0xdeadbeef; }
#endif /* __i386__ */
+/* call ldr notifications */
+static void call_ldr_notifications( ULONG reason, LDR_MODULE *module )
+{
+ struct ldr_notification *notify, *notify_next;
+ LDR_DLL_NOTIFICATION_DATA data;
+
+ data.Loaded.Flags = 0;
+ data.Loaded.FullDllName = &module->FullDllName;
+ data.Loaded.BaseDllName = &module->BaseDllName;
+ data.Loaded.DllBase = module->BaseAddress;
+ data.Loaded.SizeOfImage = module->SizeOfImage;
+
+ LIST_FOR_EACH_ENTRY_SAFE( notify, notify_next, &ldr_notifications, struct ldr_notification, entry )
+ {
+ TRACE_(relay)("\1Call LDR notification callback (proc=%p,reason=%u,data=%p,context=%p)\n",
+ notify->callback, reason, &data, notify->context );
+
+ notify->callback(reason, &data, notify->context);
+
+ TRACE_(relay)("\1Ret LDR notification callback (proc=%p,reason=%u,data=%p,context=%p)\n",
+ notify->callback, reason, &data, notify->context );
+ }
+}
/*************************************************************************
* hash_basename
@@ -1334,16 +1367,23 @@ static NTSTATUS process_attach( WINE_MODREF *wm, LPVOID lpReserved )
{
WINE_MODREF *prev = current_modref;
current_modref = wm;
+
+ call_ldr_notifications( LDR_DLL_NOTIFICATION_REASON_LOADED, &wm->ldr );
status = MODULE_InitDLL( wm, DLL_PROCESS_ATTACH, lpReserved );
if (status == STATUS_SUCCESS)
+ {
wm->ldr.Flags |= LDR_PROCESS_ATTACHED;
+ }
else
{
MODULE_InitDLL( wm, DLL_PROCESS_DETACH, lpReserved );
+ call_ldr_notifications( LDR_DLL_NOTIFICATION_REASON_UNLOADED, &wm->ldr );
+
/* point to the name so LdrInitializeThunk can print it */
last_failed_modref = wm;
WARN("Initialization of %s failed\n", debugstr_w(wm->ldr.BaseDllName.Buffer));
}
+
current_modref = prev;
}
@@ -1412,6 +1452,7 @@ static void process_detach(void)
mod->Flags &= ~LDR_PROCESS_ATTACHED;
MODULE_InitDLL( CONTAINING_RECORD(mod, WINE_MODREF, ldr),
DLL_PROCESS_DETACH, ULongToPtr(process_detaching) );
+ call_ldr_notifications( LDR_DLL_NOTIFICATION_REASON_UNLOADED, mod );
/* Restart at head of WINE_MODREF list, as entries might have
been added and/or removed while performing the call ... */
@@ -1526,8 +1567,27 @@ NTSTATUS WINAPI LdrEnumerateLoadedModules( void *unknown, LDRENUMPROC callback,
NTSTATUS WINAPI LdrRegisterDllNotification(ULONG flags, PLDR_DLL_NOTIFICATION_FUNCTION callback,
void *context, void **cookie)
{
- FIXME( "(%04x, %p, %p, %p) stub\n", flags, callback, context, cookie );
- return STATUS_NOT_IMPLEMENTED;
+ struct ldr_notification *notify;
+
+ TRACE( "(%x, %p, %p, %p)\n", flags, callback, context, cookie );
+
+ if (!callback || !cookie)
+ return STATUS_INVALID_PARAMETER;
+
+ if (flags)
+ FIXME( "ignoring flags %x\n", flags );
+
+ notify = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*notify) );
+ if (!notify) return STATUS_NO_MEMORY;
+ notify->callback = callback;
+ notify->context = context;
+
+ RtlEnterCriticalSection( &loader_section );
+ list_add_tail( &ldr_notifications, &notify->entry );
+ RtlLeaveCriticalSection( &loader_section );
+
+ *cookie = notify;
+ return STATUS_SUCCESS;
}
/******************************************************************
@@ -1535,8 +1595,18 @@ NTSTATUS WINAPI LdrRegisterDllNotification(ULONG flags, PLDR_DLL_NOTIFICATION_FU
*/
NTSTATUS WINAPI LdrUnregisterDllNotification( void *cookie )
{
- FIXME( "(%p) stub\n", cookie );
- return STATUS_NOT_IMPLEMENTED;
+ struct ldr_notification *notify = cookie;
+
+ TRACE( "(%p)\n", cookie );
+
+ if (!notify) return STATUS_INVALID_PARAMETER;
+
+ RtlEnterCriticalSection( &loader_section );
+ list_remove( &notify->entry );
+ RtlLeaveCriticalSection( &loader_section );
+
+ RtlFreeHeap( GetProcessHeap(), 0, notify );
+ return STATUS_SUCCESS;
}
/******************************************************************
@@ -2141,6 +2211,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, LPCWSTR fakemo
TRACE_(loaddll)( "Loaded %s at %p: native\n", debugstr_w(wm->ldr.FullDllName.Buffer), module );
wm->ldr.LoadCount = 1;
+
*pwm = wm;
return STATUS_SUCCESS;
}
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c
index 02ae1c1..8358cd5 100644
--- a/dlls/ntdll/tests/rtl.c
+++ b/dlls/ntdll/tests/rtl.c
@@ -105,6 +105,8 @@ static NTSTATUS (WINAPI *pLdrEnumerateLoadedModules)(void *, void *, void *);
static NTSTATUS (WINAPI *pRtlQueryPackageIdentity)(HANDLE, WCHAR*, SIZE_T*, WCHAR*, SIZE_T*, BOOLEAN*);
static NTSTATUS (WINAPI *pRtlMakeSelfRelativeSD)(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,LPDWORD);
static NTSTATUS (WINAPI *pRtlAbsoluteToSelfRelativeSD)(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,PULONG);
+static NTSTATUS (WINAPI *pLdrRegisterDllNotification)(ULONG, PLDR_DLL_NOTIFICATION_FUNCTION, void *, void **);
+static NTSTATUS (WINAPI *pLdrUnregisterDllNotification)(void *);
static HMODULE hkernel32 = 0;
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
@@ -112,6 +114,9 @@ static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
#define LEN 16
static const char* src_src = "This is a test!"; /* 16 bytes long, incl NUL */
+static WCHAR ws2_32dllW[] = {'w','s','2','_','3','2','.','d','l','l',0};
+static WCHAR wintrustdllW[] = {'w','i','n','t','r','u','s','t','.','d','l','l',0};
+static WCHAR crypt32dllW[] = {'c','r','y','p','t','3','2','.','d','l','l',0};
static ULONG src_aligned_block[4];
static ULONG dest_aligned_block[32];
static const char *src = (const char*)src_aligned_block;
@@ -162,6 +167,8 @@ static void InitFunctionPtrs(void)
pRtlQueryPackageIdentity = (void *)GetProcAddress(hntdll, "RtlQueryPackageIdentity");
pRtlMakeSelfRelativeSD = (void *)GetProcAddress(hntdll, "RtlMakeSelfRelativeSD");
pRtlAbsoluteToSelfRelativeSD = (void *)GetProcAddress(hntdll, "RtlAbsoluteToSelfRelativeSD");
+ pLdrRegisterDllNotification = (void *)GetProcAddress(hntdll, "LdrRegisterDllNotification");
+ pLdrUnregisterDllNotification = (void *)GetProcAddress(hntdll, "LdrUnregisterDllNotification");
}
hkernel32 = LoadLibraryA("kernel32.dll");
ok(hkernel32 != 0, "LoadLibrary failed\n");
@@ -2334,6 +2341,248 @@ done:
CoUninitialize();
}
+static DWORD (CALLBACK *orig_entry)(HMODULE,DWORD,LPVOID);
+static DWORD *dll_main_data;
+
+static inline void *get_rva( HMODULE module, DWORD va )
+{
+ return (void *)((char *)module + va);
+}
+
+static void CALLBACK ldr_notify_callback1(ULONG reason, LDR_DLL_NOTIFICATION_DATA *data, void *context)
+{
+ const IMAGE_IMPORT_DESCRIPTOR *imports;
+ const IMAGE_THUNK_DATA *import_list;
+ IMAGE_THUNK_DATA *thunk_list;
+ DWORD *calls = context;
+ LIST_ENTRY *mark;
+ LDR_MODULE *mod;
+ ULONG size;
+ int i, j;
+
+ *calls <<= 4;
+ *calls |= reason;
+
+ ok(data->Loaded.Flags == 0, "Expected flags 0, got %x\n", data->Loaded.Flags);
+ ok(!lstrcmpiW(data->Loaded.BaseDllName->Buffer, ws2_32dllW), "Expected ws2_32.dll, got %s\n",
+ wine_dbgstr_w(data->Loaded.BaseDllName->Buffer));
+ ok(!!data->Loaded.DllBase, "Expected non zero base address\n");
+ ok(data->Loaded.SizeOfImage, "Expected non zero image size\n");
+
+ /* expect module to be last module listed in LdrData load order list */
+ mark = &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList;
+ mod = CONTAINING_RECORD(mark->Blink, LDR_MODULE, InMemoryOrderModuleList);
+ ok(mod->BaseAddress == data->Loaded.DllBase, "Expected base address %p, got %p\n",
+ data->Loaded.DllBase, mod->BaseAddress);
+ ok(!lstrcmpiW(mod->BaseDllName.Buffer, ws2_32dllW), "Expected ws2_32.dll, got %s\n",
+ wine_dbgstr_w(mod->BaseDllName.Buffer));
+
+ /* show that imports have already been resolved */
+ imports = RtlImageDirectoryEntryToData(data->Loaded.DllBase, TRUE, IMAGE_DIRECTORY_ENTRY_IMPORT, &size);
+ ok(!!imports, "Expected dll to have imports\n");
+
+ for (i = 0; imports[i].Name; i++)
+ {
+ thunk_list = get_rva(data->Loaded.DllBase, (DWORD)imports[i].FirstThunk);
+ if (imports[i].OriginalFirstThunk)
+ import_list = get_rva(data->Loaded.DllBase, (DWORD)imports[i].OriginalFirstThunk);
+ else
+ import_list = thunk_list;
+
+ for (j = 0; import_list[j].u1.Ordinal; j++)
+ {
+ ok(thunk_list[j].u1.AddressOfData > data->Loaded.SizeOfImage,
+ "Import has not been resolved: %p\n", (void*)thunk_list[j].u1.Function);
+ }
+ }
+}
+
+static void CALLBACK ldr_notify_callback2(ULONG reason, LDR_DLL_NOTIFICATION_DATA *data, void *context)
+{
+ DWORD *calls = context;
+ *calls <<= 4;
+ *calls |= reason + 2;
+}
+
+static BOOL WINAPI fake_dll_main(HINSTANCE instance, DWORD reason, void* reserved)
+{
+ if (reason == DLL_PROCESS_ATTACH)
+ {
+ *dll_main_data <<= 4;
+ *dll_main_data |= 3;
+ }
+ else if (reason == DLL_PROCESS_DETACH)
+ {
+ *dll_main_data <<= 4;
+ *dll_main_data |= 4;
+ }
+ return orig_entry(instance, reason, reserved);
+}
+
+static void CALLBACK ldr_notify_callback_dll_main(ULONG reason, LDR_DLL_NOTIFICATION_DATA *data, void *context)
+{
+ DWORD *calls = context;
+ LIST_ENTRY *mark;
+ LDR_MODULE *mod;
+
+ *calls <<= 4;
+ *calls |= reason;
+
+ if (reason != LDR_DLL_NOTIFICATION_REASON_LOADED)
+ return;
+
+ mark = &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList;
+ mod = CONTAINING_RECORD(mark->Blink, LDR_MODULE, InMemoryOrderModuleList);
+ ok(mod->BaseAddress == data->Loaded.DllBase, "Expected base address %p, got %p\n",
+ data->Loaded.DllBase, mod->BaseAddress);
+ if (mod->BaseAddress != data->Loaded.DllBase)
+ return;
+
+ orig_entry = mod->EntryPoint;
+ mod->EntryPoint = fake_dll_main;
+ dll_main_data = calls;
+}
+
+static BOOL WINAPI fake_dll_main_fail(HINSTANCE instance, DWORD reason, void* reserved)
+{
+ if (reason == DLL_PROCESS_ATTACH)
+ {
+ *dll_main_data <<= 4;
+ *dll_main_data |= 3;
+ }
+ else if (reason == DLL_PROCESS_DETACH)
+ {
+ *dll_main_data <<= 4;
+ *dll_main_data |= 4;
+ }
+ return FALSE;
+}
+
+static void CALLBACK ldr_notify_callback_fail(ULONG reason, LDR_DLL_NOTIFICATION_DATA *data, void *context)
+{
+ DWORD *calls = context;
+ LIST_ENTRY *mark;
+ LDR_MODULE *mod;
+
+ *calls <<= 4;
+ *calls |= reason;
+
+ if (reason != LDR_DLL_NOTIFICATION_REASON_LOADED)
+ return;
+
+ mark = &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList;
+ mod = CONTAINING_RECORD(mark->Blink, LDR_MODULE, InMemoryOrderModuleList);
+ ok(mod->BaseAddress == data->Loaded.DllBase, "Expected base address %p, got %p\n",
+ data->Loaded.DllBase, mod->BaseAddress);
+ if (mod->BaseAddress != data->Loaded.DllBase)
+ return;
+
+ orig_entry = mod->EntryPoint;
+ mod->EntryPoint = fake_dll_main_fail;
+ dll_main_data = calls;
+}
+
+static void CALLBACK ldr_notify_callback_imports(ULONG reason, LDR_DLL_NOTIFICATION_DATA *data, void *context)
+{
+ DWORD *calls = context;
+
+ if (reason != LDR_DLL_NOTIFICATION_REASON_LOADED)
+ return;
+
+ if (!lstrcmpiW(data->Loaded.BaseDllName->Buffer, crypt32dllW))
+ {
+ *calls <<= 4;
+ *calls |= 1;
+ }
+
+ if (!lstrcmpiW(data->Loaded.BaseDllName->Buffer, wintrustdllW))
+ {
+ *calls <<= 4;
+ *calls |= 2;
+ }
+}
+
+static void test_LdrRegisterDllNotification(void)
+{
+ void *cookie, *cookie2;
+ NTSTATUS status;
+ HMODULE mod;
+ DWORD calls;
+
+ if (!pLdrRegisterDllNotification || !pLdrUnregisterDllNotification)
+ {
+ win_skip("Ldr(Un)RegisterDllNotification not available\n");
+ return;
+ }
+
+ /* generic test */
+ status = pLdrRegisterDllNotification(0, ldr_notify_callback1, &calls, &cookie);
+ ok(!status, "Expected STATUS_SUCCESS, got %08x\n", status);
+
+ calls = 0;
+ mod = LoadLibraryW(ws2_32dllW);
+ ok(!!mod, "Failed to load library: %d\n", GetLastError());
+ ok(calls == LDR_DLL_NOTIFICATION_REASON_LOADED, "Expected LDR_DLL_NOTIFICATION_REASON_LOADED, got %x\n", calls);
+
+ calls = 0;
+ FreeLibrary(mod);
+ ok(calls == LDR_DLL_NOTIFICATION_REASON_UNLOADED, "Expected LDR_DLL_NOTIFICATION_REASON_UNLOADED, got %x\n", calls);
+
+ /* test order of callbacks */
+ status = pLdrRegisterDllNotification(0, ldr_notify_callback2, &calls, &cookie2);
+ ok(!status, "Expected STATUS_SUCCESS, got %08x\n", status);
+
+ calls = 0;
+ mod = LoadLibraryW(ws2_32dllW);
+ ok(!!mod, "Failed to load library: %d\n", GetLastError());
+ ok(calls == 0x13, "Expected order 0x13, got %x\n", calls);
+
+ calls = 0;
+ FreeLibrary(mod);
+ ok(calls == 0x24, "Expected order 0x24, got %x\n", calls);
+
+ pLdrUnregisterDllNotification(cookie2);
+ pLdrUnregisterDllNotification(cookie);
+
+ /* test dll main order */
+ status = pLdrRegisterDllNotification(0, ldr_notify_callback_dll_main, &calls, &cookie);
+ ok(!status, "Expected STATUS_SUCCESS, got %08x\n", status);
+
+ calls = 0;
+ mod = LoadLibraryW(ws2_32dllW);
+ ok(!!mod, "Failed to load library: %d\n", GetLastError());
+ ok(calls == 0x13, "Expected order 0x13, got %x\n", calls);
+
+ calls = 0;
+ FreeLibrary(mod);
+ ok(calls == 0x42, "Expected order 0x42, got %x\n", calls);
+
+ pLdrUnregisterDllNotification(cookie);
+
+ /* test dll main order */
+ status = pLdrRegisterDllNotification(0, ldr_notify_callback_fail, &calls, &cookie);
+ ok(!status, "Expected STATUS_SUCCESS, got %08x\n", status);
+
+ calls = 0;
+ mod = LoadLibraryW(ws2_32dllW);
+ ok(!mod, "Expected library to fail loading\n");
+ ok(calls == 0x1342, "Expected order 0x1342, got %x\n", calls);
+
+ pLdrUnregisterDllNotification(cookie);
+
+ /* test dll with dependencies */
+ status = pLdrRegisterDllNotification(0, ldr_notify_callback_imports, &calls, &cookie);
+ ok(!status, "Expected STATUS_SUCCESS, got %08x\n", status);
+
+ calls = 0;
+ mod = LoadLibraryW(wintrustdllW);
+ ok(!!mod, "Failed to load library: %d\n", GetLastError());
+ ok(calls == 0x12, "Expected order 0x12, got %x\n", calls);
+
+ FreeLibrary(mod);
+ pLdrUnregisterDllNotification(cookie);
+}
+
START_TEST(rtl)
{
InitFunctionPtrs();
@@ -2369,4 +2618,5 @@ START_TEST(rtl)
test_LdrEnumerateLoadedModules();
test_RtlQueryPackageIdentity();
test_RtlMakeSelfRelativeSD();
+ test_LdrRegisterDllNotification();
}
--
1.9.1

View File

@@ -1,5 +0,0 @@
Fixes: [44585] Implement LdrRegisterDllNotification/LdrUnregisterDllNotification
# note: originally without explanation, unless "The title says it all" counts as explanation
Depends: ntdll-HashLinks
Depends: ntdll-RtlQueryPackageIdentity
Depends: ntdll-Hide_Wine_Exports

View File

@@ -1,17 +1,18 @@
From 996792332616f1daf63bd0fe539245c96550cdb7 Mon Sep 17 00:00:00 2001
From 25d22ac6fe6c84742dedf45a6b9115b4ba1bbf6c Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 28 May 2017 05:44:38 +0200
Subject: ntdll: Allow to query section names from other processes. (v2)
Subject: [PATCH] ntdll: Allow to query section names from other processes.
(v2)
---
dlls/psapi/tests/psapi_main.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
index ef5ae19aeaf..ee027480ec5 100644
index b9d8576..af69646 100644
--- a/dlls/psapi/tests/psapi_main.c
+++ b/dlls/psapi/tests/psapi_main.c
@@ -368,6 +368,10 @@ static void test_GetMappedFileName(void)
@@ -399,6 +399,10 @@ static void test_GetMappedFileName(void)
char temp_path[MAX_PATH], file_name[MAX_PATH], map_name[MAX_PATH], device_name[MAX_PATH], drive[3];
WCHAR map_nameW[MAX_PATH], nt_map_name[MAX_PATH];
HANDLE hfile, hmap;
@@ -21,13 +22,12 @@ index ef5ae19aeaf..ee027480ec5 100644
+ GetCurrentProcess(), &current_process, 0, 0, DUPLICATE_SAME_ACCESS );
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(NULL, hMod, szMapPath, sizeof(szMapPath));
@@ -468,6 +472,20 @@ todo_wine
ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name);
ret = GetMappedFileNameA(NULL, hMod, szMapPath, sizeof(szMapPath));
@@ -500,6 +504,20 @@ todo_wine
}
+ SetLastError(0xdeadbeef);
+ ret = pGetMappedFileNameW(current_process, base, map_nameW, sizeof(map_nameW)/sizeof(map_nameW[0]));
SetLastError(0xdeadbeef);
+ ret = GetMappedFileNameW(current_process, base, map_nameW, sizeof(map_nameW)/sizeof(map_nameW[0]));
+todo_wine {
+ ok(ret, "GetMappedFileNameW error %d\n", GetLastError());
+ ok(ret > strlen(device_name), "map_name should be longer than device_name\n");
@@ -40,10 +40,11 @@ index ef5ae19aeaf..ee027480ec5 100644
+ ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name);
+ }
+
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(GetCurrentProcess(), base + 0x2000, map_name, sizeof(map_name));
+ SetLastError(0xdeadbeef);
ret = GetMappedFileNameA(GetCurrentProcess(), base + 0x2000, map_name, sizeof(map_name));
todo_wine {
@@ -513,6 +531,7 @@ todo_wine
ok(ret, "GetMappedFileName error %d\n", GetLastError());
@@ -544,6 +562,7 @@ todo_wine
todo_wine
ok(GetLastError() == ERROR_FILE_INVALID, "expected ERROR_FILE_INVALID, got %d\n", GetLastError());
@@ -52,5 +53,5 @@ index ef5ae19aeaf..ee027480ec5 100644
CloseHandle(hmap);
}
--
2.14.1
2.7.4

View File

@@ -1,4 +1,4 @@
From a1c5805b5cb85cca744257e8f34dbd88accb025c Mon Sep 17 00:00:00 2001
From b9e418cc3e9cf7808285b2000db6f8163a48eb47 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Wed, 16 Mar 2016 20:23:28 +0800
Subject: [PATCH] kernel32: Implement K32GetMappedFileName. (v2)
@@ -98,24 +98,24 @@ index c7a15cd..f2a2c71 100644
/***********************************************************************
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
index 065764b..d36c123 100644
index af69646..e92b55b 100644
--- a/dlls/psapi/tests/psapi_main.c
+++ b/dlls/psapi/tests/psapi_main.c
@@ -462,27 +462,22 @@ static void test_GetMappedFileName(void)
@@ -407,27 +407,22 @@ static void test_GetMappedFileName(void)
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(NULL, hMod, szMapPath, sizeof(szMapPath));
ret = GetMappedFileNameA(NULL, hMod, szMapPath, sizeof(szMapPath));
ok(!ret, "GetMappedFileName should fail\n");
-todo_wine
ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(hpSR, hMod, szMapPath, sizeof(szMapPath));
ret = GetMappedFileNameA(hpSR, hMod, szMapPath, sizeof(szMapPath));
ok(!ret, "GetMappedFileName should fail\n");
-todo_wine
ok(GetLastError() == ERROR_ACCESS_DENIED, "expected error=ERROR_ACCESS_DENIED but got %d\n", GetLastError());
SetLastError( 0xdeadbeef );
ret = pGetMappedFileNameA(hpQI, hMod, szMapPath, sizeof(szMapPath));
ret = GetMappedFileNameA(hpQI, hMod, szMapPath, sizeof(szMapPath));
-todo_wine
ok( ret || broken(GetLastError() == ERROR_UNEXP_NET_ERR), /* win2k */
"GetMappedFileNameA failed with error %u\n", GetLastError() );
@@ -129,28 +129,28 @@ index 065764b..d36c123 100644
ok(szMapBaseName && *szMapBaseName, "szMapPath=\"%s\"\n", szMapPath);
if (szMapBaseName)
{
@@ -520,29 +515,25 @@ todo_wine
@@ -465,29 +460,25 @@ todo_wine
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(GetCurrentProcess(), base, map_name, 0);
ret = GetMappedFileNameA(GetCurrentProcess(), base, map_name, 0);
ok(!ret, "GetMappedFileName should fail\n");
-todo_wine
ok(GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"wrong error %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(GetCurrentProcess(), base, 0, sizeof(map_name));
ret = GetMappedFileNameA(GetCurrentProcess(), base, 0, sizeof(map_name));
ok(!ret, "GetMappedFileName should fail\n");
-todo_wine
ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(GetCurrentProcess(), base, map_name, 1);
ret = GetMappedFileNameA(GetCurrentProcess(), base, map_name, 1);
-todo_wine
ok(ret == 1, "GetMappedFileName error %d\n", GetLastError());
ok(!map_name[0] || broken(map_name[0] == device_name[0]) /* before win2k */, "expected 0, got %c\n", map_name[0]);
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(GetCurrentProcess(), base, map_name, sizeof(map_name));
ret = GetMappedFileNameA(GetCurrentProcess(), base, map_name, sizeof(map_name));
-todo_wine {
ok(ret, "GetMappedFileName error %d\n", GetLastError());
ok(ret > strlen(device_name), "map_name should be longer than device_name\n");
@@ -159,11 +159,11 @@ index 065764b..d36c123 100644
-}
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameW(GetCurrentProcess(), base, map_nameW, ARRAY_SIZE(map_nameW));
@@ -560,10 +551,9 @@ todo_wine
ret = GetMappedFileNameW(GetCurrentProcess(), base, map_nameW, ARRAY_SIZE(map_nameW));
@@ -505,10 +496,9 @@ todo_wine
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameW(current_process, base, map_nameW, sizeof(map_nameW)/sizeof(map_nameW[0]));
ret = GetMappedFileNameW(current_process, base, map_nameW, sizeof(map_nameW)/sizeof(map_nameW[0]));
-todo_wine {
ok(ret, "GetMappedFileNameW error %d\n", GetLastError());
ok(ret > strlen(device_name), "map_name should be longer than device_name\n");
@@ -172,10 +172,10 @@ index 065764b..d36c123 100644
if (nt_get_mapped_file_name(current_process, base, nt_map_name, sizeof(nt_map_name)/sizeof(nt_map_name[0])))
{
ok(memcmp(map_nameW, nt_map_name, lstrlenW(map_nameW)) == 0, "map name does not start with a device name: %s\n", map_name);
@@ -574,16 +564,14 @@ todo_wine
@@ -519,16 +509,14 @@ todo_wine
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(GetCurrentProcess(), base + 0x2000, map_name, sizeof(map_name));
ret = GetMappedFileNameA(GetCurrentProcess(), base + 0x2000, map_name, sizeof(map_name));
-todo_wine {
ok(ret, "GetMappedFileName error %d\n", GetLastError());
ok(ret > strlen(device_name), "map_name should be longer than device_name\n");
@@ -184,29 +184,29 @@ index 065764b..d36c123 100644
-}
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(GetCurrentProcess(), base + 0x4000, map_name, sizeof(map_name));
ret = GetMappedFileNameA(GetCurrentProcess(), base + 0x4000, map_name, sizeof(map_name));
ok(!ret, "GetMappedFileName should fail\n");
-todo_wine
ok(GetLastError() == ERROR_UNEXP_NET_ERR, "expected ERROR_UNEXP_NET_ERR, got %d\n", GetLastError());
SetLastError(0xdeadbeef);
@@ -595,7 +583,6 @@ todo_wine
@@ -540,7 +528,6 @@ todo_wine
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(0, base, map_name, sizeof(map_name));
ret = GetMappedFileNameA(0, base, map_name, sizeof(map_name));
ok(!ret, "GetMappedFileName should fail\n");
-todo_wine
ok(GetLastError() == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
UnmapViewOfFile(base);
@@ -614,7 +601,6 @@ todo_wine
@@ -559,7 +546,6 @@ todo_wine
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(GetCurrentProcess(), base, map_name, sizeof(map_name));
ret = GetMappedFileNameA(GetCurrentProcess(), base, map_name, sizeof(map_name));
ok(!ret, "GetMappedFileName should fail\n");
-todo_wine
ok(GetLastError() == ERROR_FILE_INVALID, "expected ERROR_FILE_INVALID, got %d\n", GetLastError());
CloseHandle(current_process);
@@ -664,7 +650,7 @@ static void test_GetProcessImageFileName(void)
@@ -606,7 +592,7 @@ static void test_GetProcessImageFileName(void)
if(ret && ret1)
{
/* Windows returns 2*strlen-1 */
@@ -216,5 +216,5 @@ index 065764b..d36c123 100644
}
--
1.9.1
2.7.4

Some files were not shown because too many files have changed in this diff Show More