Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
June 2018
- 68 participants
- 1149 messages
[PATCH 1/2] crypt32: Implement verification of ECDSA signatures.
by Nikolay Sivov
From: Michael Müller <michael(a)fds-team.de>
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
Modifications from original patch:
- few renames to make it closer to existing code;
- removed unrelated formatting changes in existing code;
- new BCrypt path is rearranged to match existing order : import -> hash -> verify.
dlls/crypt32/Makefile.in | 2 +-
dlls/crypt32/cert.c | 260 +++++++++++++++++++++++++++++++++++++--
2 files changed, 250 insertions(+), 12 deletions(-)
diff --git a/dlls/crypt32/Makefile.in b/dlls/crypt32/Makefile.in
index d3a409fcae..0934222119 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 83aac5d8f4..1667b42b0b 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"
@@ -2408,22 +2413,13 @@ 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 CRYPT_VerifySignature(HCRYPTPROV_LEGACY hCryptProv, DWORD dwCertEncodingType,
+ CERT_PUBLIC_KEY_INFO *pubKeyInfo, const CERT_SIGNED_CONTENT_INFO *signedCert, const CRYPT_OID_INFO *info)
{
BOOL ret;
HCRYPTKEY key;
- PCCRYPT_OID_INFO info;
ALG_ID pubKeyID, hashID;
- 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;
@@ -2453,6 +2449,248 @@ static BOOL CRYPT_VerifyCertSignatureFromPublicKeyInfo(HCRYPTPROV_LEGACY hCryptP
return ret;
}
+static BOOL CNG_CalcHash(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;
+
+ 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;
+ }
+
+done:
+ if (hash) BCryptDestroyHash(hash);
+ if (alg) BCryptCloseAlgorithmProvider(alg, 0);
+ if (status) SetLastError(RtlNtStatusToDosError(status));
+ return status == 0;
+}
+
+static BOOL CNG_ImportECCPubKey(CERT_PUBLIC_KEY_INFO *pubKeyInfo, BCRYPT_KEY_HANDLE *key)
+{
+ DWORD blob_magic, ecckey_len, size;
+ BCRYPT_ALG_HANDLE alg = NULL;
+ BCRYPT_ECCKEY_BLOB *ecckey;
+ const WCHAR *sign_algo;
+ char **ecc_curve;
+ NTSTATUS status;
+
+ 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)))
+ goto done;
+
+ ecckey_len = sizeof(BCRYPT_ECCKEY_BLOB) + pubKeyInfo->PublicKey.cbData - 1;
+ if (!(ecckey = CryptMemAlloc(ecckey_len)))
+ {
+ status = STATUS_NO_MEMORY;
+ goto done;
+ }
+
+ 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);
+
+done:
+ if (alg) BCryptCloseAlgorithmProvider(alg, 0);
+ if (status) SetLastError(RtlNtStatusToDosError(status));
+ return !status;
+}
+
+static BOOL CNG_ImportPubKey(CERT_PUBLIC_KEY_INFO *pubKeyInfo, BCRYPT_KEY_HANDLE *key)
+{
+ if (!strcmp(pubKeyInfo->Algorithm.pszObjId, szOID_ECC_PUBLIC_KEY))
+ return CNG_ImportECCPubKey(pubKeyInfo, key);
+
+ FIXME("Unsupported public key type: %s\n", debugstr_a(pubKeyInfo->Algorithm.pszObjId));
+ SetLastError(NTE_BAD_ALGID);
+ return FALSE;
+}
+
+static BOOL CNG_PrepareSignatureECC(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 CNG_PrepareSignature(CERT_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 = CNG_PrepareSignatureECC(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 CNG_VerifySignature(HCRYPTPROV_LEGACY hCryptProv, DWORD dwCertEncodingType,
+ CERT_PUBLIC_KEY_INFO *pubKeyInfo, const CERT_SIGNED_CONTENT_INFO *signedCert, const CRYPT_OID_INFO *info)
+{
+ BCRYPT_KEY_HANDLE key = NULL;
+ BYTE *hash_value = NULL, *sig_value;
+ DWORD hash_len, sig_len;
+ NTSTATUS status;
+ BOOL ret;
+
+ ret = CNG_ImportPubKey(pubKeyInfo, &key);
+ if (ret)
+ {
+ ret = CNG_CalcHash(info->pwszCNGAlgid, signedCert, &hash_value, &hash_len);
+ if (ret)
+ {
+ ret = CNG_PrepareSignature(pubKeyInfo, signedCert, &sig_value, &sig_len);
+ if (ret)
+ {
+ status = BCryptVerifySignature(key, NULL, hash_value, hash_len, sig_value, sig_len, 0);
+ if (status)
+ {
+ FIXME("Failed to verify signature: %08x\n", status);
+ SetLastError(RtlNtStatusToDosError(status));
+ ret = FALSE;
+ }
+ CryptMemFree(sig_value);
+ }
+ CryptMemFree(hash_value);
+ }
+ BCryptDestroyKey(key);
+ }
+
+ return ret;
+}
+
+static BOOL CRYPT_VerifyCertSignatureFromPublicKeyInfo(HCRYPTPROV_LEGACY hCryptProv, DWORD dwCertEncodingType,
+ CERT_PUBLIC_KEY_INFO *pubKeyInfo, const CERT_SIGNED_CONTENT_INFO *signedCert)
+{
+ CCRYPT_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 CNG_VerifySignature(hCryptProv, dwCertEncodingType, pubKeyInfo, signedCert, info);
+ else
+ return CRYPT_VerifySignature(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)
--
2.18.0
June 26, 2018
[PATCH] msi: Remove checks for negative value.
by Hans Leidekker
From: Andrey Gusev <andrey.goosev(a)gmail.com>
Signed-off-by: Andrey Gusev <andrey.goosev(a)gmail.com>
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/msi/format.c | 2 +-
dlls/msi/string.c | 5 ++---
dlls/msi/table.c | 4 +---
3 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/dlls/msi/format.c b/dlls/msi/format.c
index 9356c9e30d..d32afb2a60 100644
--- a/dlls/msi/format.c
+++ b/dlls/msi/format.c
@@ -242,7 +242,7 @@ static WCHAR *deformat_file( FORMAT *format, FORMSTR *str, BOOL shortname, int *
if ((ret = strdupW( file->TargetPath ))) len = strlenW( ret );
goto done;
}
- if ((len = GetShortPathNameW(file->TargetPath, NULL, 0)) <= 0)
+ if (!(len = GetShortPathNameW(file->TargetPath, NULL, 0)))
{
if ((ret = strdupW( file->TargetPath ))) len = strlenW( ret );
goto done;
diff --git a/dlls/msi/string.c b/dlls/msi/string.c
index f094a53c9e..7383fddbed 100644
--- a/dlls/msi/string.c
+++ b/dlls/msi/string.c
@@ -233,7 +233,7 @@ static void set_st_entry( string_table *st, UINT n, WCHAR *str, int len, USHORT
static UINT string2id( const string_table *st, const char *buffer, UINT *id )
{
- DWORD sz;
+ int sz;
UINT r = ERROR_INVALID_PARAMETER;
LPWSTR str;
@@ -245,8 +245,7 @@ static UINT string2id( const string_table *st, const char *buffer, UINT *id )
return ERROR_SUCCESS;
}
- sz = MultiByteToWideChar( st->codepage, 0, buffer, -1, NULL, 0 );
- if( sz <= 0 )
+ if (!(sz = MultiByteToWideChar( st->codepage, 0, buffer, -1, NULL, 0 )))
return r;
str = msi_alloc( sz*sizeof(WCHAR) );
if( !str )
diff --git a/dlls/msi/table.c b/dlls/msi/table.c
index 45a181445a..e046c5c9e2 100644
--- a/dlls/msi/table.c
+++ b/dlls/msi/table.c
@@ -1279,9 +1279,7 @@ static UINT get_table_value_from_record( MSITABLEVIEW *tv, MSIRECORD *rec, UINT
UINT r;
int ival;
- if ( (iField <= 0) ||
- (iField > tv->num_cols) ||
- MSI_RecordIsNull( rec, iField ) )
+ if (!iField || iField > tv->num_cols || MSI_RecordIsNull( rec, iField ))
return ERROR_FUNCTION_FAILED;
columninfo = tv->columns[ iField - 1 ];
--
2.11.0
June 26, 2018
[PATCH] shell32: use characters as arguments to GetTempPathW and GetLongPathNameW
by Marcus Meissner
Signed-off-by: Marcus Meissner <marcus(a)jet.franken.de>
---
dlls/shell32/tests/shlfolder.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c
index 6460fd9381..bb303f66e4 100644
--- a/dlls/shell32/tests/shlfolder.c
+++ b/dlls/shell32/tests/shlfolder.c
@@ -244,8 +244,8 @@ todo_wine_if(parse_tests[i].todo)
CoTaskMemFree(pidl);
/* Relative paths are interpreted relative to the desktop. */
- GetTempPathW(sizeof(buffer), buffer);
- GetLongPathNameW(buffer, buffer, sizeof(buffer));
+ GetTempPathW(ARRAY_SIZE(buffer), buffer);
+ GetLongPathNameW(buffer, buffer, ARRAY_SIZE(buffer));
SetCurrentDirectoryW(buffer);
CreateDirectoryW(testdirW, NULL);
--
2.17.1
June 26, 2018
Re: [PATCH 5/5] include: Make fil_data.idl a common header.
by Marvin
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=39362
Your paranoid android.
=== w2008s64 (64 bit referenceclock) ===
TestBot process got stuck or died unexpectedly
The previous 1 run(s) terminated abnormally
June 26, 2018
[PATCH 5/5] include: Make fil_data.idl a common header.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/devenum/Makefile.in | 3 +-
dlls/devenum/createdevenum.c | 2 +-
dlls/devenum/fil_data.idl | 47 --------------------------
dlls/dxdiagn/Makefile.in | 3 +-
dlls/dxdiagn/provider.c | 2 +-
dlls/quartz/Makefile.in | 1 -
dlls/quartz/fil_data.idl | 52 -----------------------------
dlls/quartz/filtermapper.c | 2 +-
dlls/quartz/tests/Makefile.in | 1 -
dlls/quartz/tests/fil_data.idl | 52 -----------------------------
dlls/quartz/tests/filtermapper.c | 2 +-
include/Makefile.in | 1 +
{dlls/dxdiagn => include/wine}/fil_data.idl | 21 ++----------
13 files changed, 10 insertions(+), 179 deletions(-)
delete mode 100644 dlls/devenum/fil_data.idl
delete mode 100644 dlls/quartz/fil_data.idl
delete mode 100644 dlls/quartz/tests/fil_data.idl
rename {dlls/dxdiagn => include/wine}/fil_data.idl (67%)
diff --git a/dlls/devenum/Makefile.in b/dlls/devenum/Makefile.in
index d1407a9..2760eed 100644
--- a/dlls/devenum/Makefile.in
+++ b/dlls/devenum/Makefile.in
@@ -9,7 +9,6 @@ C_SRCS = \
parsedisplayname.c
IDL_SRCS = \
- devenum_classes.idl \
- fil_data.idl
+ devenum_classes.idl
RC_SRCS = devenum.rc
diff --git a/dlls/devenum/createdevenum.c b/dlls/devenum/createdevenum.c
index 8275c99..c138cb7 100644
--- a/dlls/devenum/createdevenum.c
+++ b/dlls/devenum/createdevenum.c
@@ -37,7 +37,7 @@
#include "mmddk.h"
#include "initguid.h"
-#include "fil_data.h"
+#include "wine/fil_data.h"
WINE_DEFAULT_DEBUG_CHANNEL(devenum);
diff --git a/dlls/devenum/fil_data.idl b/dlls/devenum/fil_data.idl
deleted file mode 100644
index 7e37a75..0000000
--- a/dlls/devenum/fil_data.idl
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2009 Vitaliy Margolen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#pragma makedep header
-
-import "objidl.idl";
-import "strmif.idl";
-import "unknwn.idl";
-
-
-/*****************************************************************************
- * IAMFilterData interface
- */
-[
- object,
- uuid(97f7c4d4-547b-4a5f-8332-536430ad2e4d),
- pointer_default(unique)
-]
-interface IAMFilterData : IUnknown
-{
- typedef [unique] IAMFilterData *LPIAMFILTERDATA;
-
- HRESULT ParseFilterData(
- [in] BYTE * rgbFilterData,
- [in] ULONG cb,
- [out] BYTE ** prgbRegFilter2);
-
- HRESULT CreateFilterData(
- [in] REGFILTER2 * prf2,
- [out] BYTE ** prgbFilterData,
- [out] ULONG * pcb);
-}
diff --git a/dlls/dxdiagn/Makefile.in b/dlls/dxdiagn/Makefile.in
index 3a1017e..c16396e 100644
--- a/dlls/dxdiagn/Makefile.in
+++ b/dlls/dxdiagn/Makefile.in
@@ -9,5 +9,4 @@ C_SRCS = \
RC_SRCS = dxdiagn.rc
IDL_SRCS = \
- dxdiagn.idl \
- fil_data.idl
+ dxdiagn.idl
diff --git a/dlls/dxdiagn/provider.c b/dlls/dxdiagn/provider.c
index 4f964ad..1fdab5e 100644
--- a/dlls/dxdiagn/provider.c
+++ b/dlls/dxdiagn/provider.c
@@ -35,7 +35,7 @@
#include "d3d9.h"
#include "strmif.h"
#include "initguid.h"
-#include "fil_data.h"
+#include "wine/fil_data.h"
#include "psapi.h"
#include "wbemcli.h"
diff --git a/dlls/quartz/Makefile.in b/dlls/quartz/Makefile.in
index e938865..5eb8d44 100644
--- a/dlls/quartz/Makefile.in
+++ b/dlls/quartz/Makefile.in
@@ -30,7 +30,6 @@ RC_SRCS = version.rc
IDL_SRCS = \
control_tlb.idl \
- fil_data.idl \
quartz_strmif.idl
dlldata_EXTRADEFS = -DENTRY_PREFIX=QUARTZ_ -DPROXY_DELEGATION -DWINE_REGISTER_DLL
diff --git a/dlls/quartz/fil_data.idl b/dlls/quartz/fil_data.idl
deleted file mode 100644
index ab93499..0000000
--- a/dlls/quartz/fil_data.idl
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2009 Vitaliy Margolen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#pragma makedep header
-
-import "objidl.idl";
-import "strmif.idl";
-import "unknwn.idl";
-
-
-/*****************************************************************************
- * IAMFilterData interface
- *
- * Notes:
- * - This interface is deprecated and IFilterMapper2 should be used instead.
- * - There is no full replacement for IAMFilterData::ParseFilterData short of manually
- * parsing out the REGFILTER2 struct from the binary blob.
- */
-[
- object,
- uuid(97f7c4d4-547b-4a5f-8332-536430ad2e4d),
- pointer_default(unique)
-]
-interface IAMFilterData : IUnknown
-{
- typedef [unique] IAMFilterData *LPIAMFILTERDATA;
-
- HRESULT ParseFilterData(
- [in] BYTE * rgbFilterData,
- [in] ULONG cb,
- [out] BYTE ** prgbRegFilter2);
-
- HRESULT CreateFilterData(
- [in] REGFILTER2 * prf2,
- [out] BYTE ** prgbFilterData,
- [out] ULONG * pcb);
-}
diff --git a/dlls/quartz/filtermapper.c b/dlls/quartz/filtermapper.c
index 20c7e3a..d78f643 100644
--- a/dlls/quartz/filtermapper.c
+++ b/dlls/quartz/filtermapper.c
@@ -37,7 +37,7 @@
#include "wine/unicode.h"
#include "uuids.h"
#include "initguid.h"
-#include "fil_data.h"
+#include "wine/fil_data.h"
#include "wine/debug.h"
diff --git a/dlls/quartz/tests/Makefile.in b/dlls/quartz/tests/Makefile.in
index 4f54666..6b880c3 100644
--- a/dlls/quartz/tests/Makefile.in
+++ b/dlls/quartz/tests/Makefile.in
@@ -12,7 +12,6 @@ C_SRCS = \
referenceclock.c \
videorenderer.c
-IDL_SRCS = fil_data.idl
RC_SRCS = \
rsrc.rc
diff --git a/dlls/quartz/tests/fil_data.idl b/dlls/quartz/tests/fil_data.idl
deleted file mode 100644
index ab93499..0000000
--- a/dlls/quartz/tests/fil_data.idl
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2009 Vitaliy Margolen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#pragma makedep header
-
-import "objidl.idl";
-import "strmif.idl";
-import "unknwn.idl";
-
-
-/*****************************************************************************
- * IAMFilterData interface
- *
- * Notes:
- * - This interface is deprecated and IFilterMapper2 should be used instead.
- * - There is no full replacement for IAMFilterData::ParseFilterData short of manually
- * parsing out the REGFILTER2 struct from the binary blob.
- */
-[
- object,
- uuid(97f7c4d4-547b-4a5f-8332-536430ad2e4d),
- pointer_default(unique)
-]
-interface IAMFilterData : IUnknown
-{
- typedef [unique] IAMFilterData *LPIAMFILTERDATA;
-
- HRESULT ParseFilterData(
- [in] BYTE * rgbFilterData,
- [in] ULONG cb,
- [out] BYTE ** prgbRegFilter2);
-
- HRESULT CreateFilterData(
- [in] REGFILTER2 * prf2,
- [out] BYTE ** prgbFilterData,
- [out] ULONG * pcb);
-}
diff --git a/dlls/quartz/tests/filtermapper.c b/dlls/quartz/tests/filtermapper.c
index 5a43785..7b6a018 100644
--- a/dlls/quartz/tests/filtermapper.c
+++ b/dlls/quartz/tests/filtermapper.c
@@ -26,7 +26,7 @@
#include "dshow.h"
#include "winternl.h"
-#include "fil_data.h"
+#include "wine/fil_data.h"
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
diff --git a/include/Makefile.in b/include/Makefile.in
index 39f2691..995544a 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -664,6 +664,7 @@ SOURCES = \
windowsx.h \
wine/debug.h \
wine/exception.h \
+ wine/fil_data.idl \
wine/itss.idl \
wine/library.h \
wine/svcctl.idl \
diff --git a/dlls/dxdiagn/fil_data.idl b/include/wine/fil_data.idl
similarity index 67%
rename from dlls/dxdiagn/fil_data.idl
rename to include/wine/fil_data.idl
index 7e37a75..19dfa8a 100644
--- a/dlls/dxdiagn/fil_data.idl
+++ b/include/wine/fil_data.idl
@@ -16,16 +16,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#pragma makedep header
-
-import "objidl.idl";
-import "strmif.idl";
import "unknwn.idl";
+import "strmif.idl";
-
-/*****************************************************************************
- * IAMFilterData interface
- */
[
object,
uuid(97f7c4d4-547b-4a5f-8332-536430ad2e4d),
@@ -33,15 +26,7 @@ import "unknwn.idl";
]
interface IAMFilterData : IUnknown
{
- typedef [unique] IAMFilterData *LPIAMFILTERDATA;
+ HRESULT ParseFilterData( [in] BYTE *data, [in] ULONG size, [out] BYTE **regfilter );
- HRESULT ParseFilterData(
- [in] BYTE * rgbFilterData,
- [in] ULONG cb,
- [out] BYTE ** prgbRegFilter2);
-
- HRESULT CreateFilterData(
- [in] REGFILTER2 * prf2,
- [out] BYTE ** prgbFilterData,
- [out] ULONG * pcb);
+ HRESULT CreateFilterData( [in] REGFILTER2 *regfilter, [out] BYTE **data, [out] ULONG *size );
}
--
2.7.4
June 26, 2018
[PATCH 4/5] devenum: Remove an unused typedef.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/devenum/devenum_main.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/dlls/devenum/devenum_main.c b/dlls/devenum/devenum_main.c
index 98ad1ad..b17bc93 100644
--- a/dlls/devenum/devenum_main.c
+++ b/dlls/devenum/devenum_main.c
@@ -28,13 +28,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(devenum);
DECLSPEC_HIDDEN LONG dll_refs;
static HINSTANCE devenum_instance;
-typedef struct
-{
- REFCLSID clsid;
- LPCWSTR friendly_name;
- BOOL instance;
-} register_info;
-
/***********************************************************************
* DllEntryPoint
*/
--
2.7.4
June 26, 2018
[PATCH 3/5] devenum: Make some variables static.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/devenum/createdevenum.c | 14 ++++++--------
dlls/devenum/devenum_main.c | 13 ++++---------
dlls/devenum/devenum_private.h | 4 +---
dlls/devenum/mediacatenum.c | 4 +++-
4 files changed, 14 insertions(+), 21 deletions(-)
diff --git a/dlls/devenum/createdevenum.c b/dlls/devenum/createdevenum.c
index 06c264c..8275c99 100644
--- a/dlls/devenum/createdevenum.c
+++ b/dlls/devenum/createdevenum.c
@@ -41,8 +41,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(devenum);
-extern HINSTANCE DEVENUM_hInstance;
-
static const WCHAR wszFilterKeyName[] = {'F','i','l','t','e','r',0};
static const WCHAR wszMeritName[] = {'M','e','r','i','t',0};
static const WCHAR wszPins[] = {'P','i','n','s',0};
@@ -460,7 +458,7 @@ static void register_legacy_filters(void)
V_VT(&var) = VT_BSTR;
if (!(V_BSTR(&var) = SysAllocString(wszFilterSubkeyName)))
goto cleanup;
- hr = IPropertyBag_Write(prop_bag, clsid_keyname, &var);
+ hr = IPropertyBag_Write(prop_bag, clsidW, &var);
if (FAILED(hr)) goto cleanup;
VariantClear(&var);
@@ -537,7 +535,7 @@ static BOOL CALLBACK register_dsound_devices(GUID *guid, const WCHAR *desc, cons
StringFromGUID2(&CLSID_DSoundRender, clsid, CHARS_IN_GUID);
if (!(V_BSTR(&var) = SysAllocString(clsid)))
goto cleanup;
- hr = IPropertyBag_Write(prop_bag, clsid_keyname, &var);
+ hr = IPropertyBag_Write(prop_bag, clsidW, &var);
if (FAILED(hr)) goto cleanup;
VariantClear(&var);
@@ -620,7 +618,7 @@ static void register_waveout_devices(void)
StringFromGUID2(&CLSID_AudioRender, clsid, CHARS_IN_GUID);
if (!(V_BSTR(&var) = SysAllocString(clsid)))
goto cleanup;
- hr = IPropertyBag_Write(prop_bag, clsid_keyname, &var);
+ hr = IPropertyBag_Write(prop_bag, clsidW, &var);
if (FAILED(hr)) goto cleanup;
VariantClear(&var);
@@ -693,7 +691,7 @@ static void register_wavein_devices(void)
StringFromGUID2(&CLSID_AudioRecord, clsid, CHARS_IN_GUID);
if (!(V_BSTR(&var) = SysAllocString(clsid)))
goto cleanup;
- hr = IPropertyBag_Write(prop_bag, clsid_keyname, &var);
+ hr = IPropertyBag_Write(prop_bag, clsidW, &var);
if (FAILED(hr)) goto cleanup;
VariantClear(&var);
@@ -765,7 +763,7 @@ static void register_midiout_devices(void)
StringFromGUID2(&CLSID_AVIMIDIRender, clsid, CHARS_IN_GUID);
if (!(V_BSTR(&var) = SysAllocString(clsid)))
goto cleanup;
- hr = IPropertyBag_Write(prop_bag, clsid_keyname, &var);
+ hr = IPropertyBag_Write(prop_bag, clsidW, &var);
if (FAILED(hr)) goto cleanup;
VariantClear(&var);
@@ -854,7 +852,7 @@ static void register_vfw_codecs(void)
StringFromGUID2(&CLSID_AVICo, clsid, CHARS_IN_GUID);
if (!(V_BSTR(&var) = SysAllocString(clsid)))
goto cleanup;
- hr = IPropertyBag_Write(prop_bag, clsid_keyname, &var);
+ hr = IPropertyBag_Write(prop_bag, clsidW, &var);
if (FAILED(hr)) goto cleanup;
VariantClear(&var);
diff --git a/dlls/devenum/devenum_main.c b/dlls/devenum/devenum_main.c
index 3499f99..98ad1ad 100644
--- a/dlls/devenum/devenum_main.c
+++ b/dlls/devenum/devenum_main.c
@@ -26,7 +26,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(devenum);
DECLSPEC_HIDDEN LONG dll_refs;
-DECLSPEC_HIDDEN HINSTANCE DEVENUM_hInstance;
+static HINSTANCE devenum_instance;
typedef struct
{
@@ -36,11 +36,6 @@ typedef struct
} register_info;
/***********************************************************************
- * Global string constant definitions
- */
-const WCHAR clsid_keyname[6] = { 'C', 'L', 'S', 'I', 'D', 0 };
-
-/***********************************************************************
* DllEntryPoint
*/
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
@@ -49,7 +44,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
switch(fdwReason) {
case DLL_PROCESS_ATTACH:
- DEVENUM_hInstance = hinstDLL;
+ devenum_instance = hinstDLL;
DisableThreadLibraryCalls(hinstDLL);
break;
}
@@ -166,7 +161,7 @@ HRESULT WINAPI DllRegisterServer(void)
TRACE("\n");
- res = __wine_register_resources( DEVENUM_hInstance );
+ res = __wine_register_resources( devenum_instance );
if (FAILED(res))
return res;
@@ -214,5 +209,5 @@ HRESULT WINAPI DllRegisterServer(void)
HRESULT WINAPI DllUnregisterServer(void)
{
FIXME("stub!\n");
- return __wine_unregister_resources( DEVENUM_hInstance );
+ return __wine_unregister_resources( devenum_instance );
}
diff --git a/dlls/devenum/devenum_private.h b/dlls/devenum/devenum_private.h
index ea4e017..e18c57d 100644
--- a/dlls/devenum/devenum_private.h
+++ b/dlls/devenum/devenum_private.h
@@ -83,7 +83,7 @@ extern IParseDisplayName DEVENUM_ParseDisplayName DECLSPEC_HIDDEN;
*/
static const WCHAR backslashW[] = {'\\',0};
-static const WCHAR clsidW[] = {'C','L','S','I','D','\\',0};
+static const WCHAR clsidW[] = {'C','L','S','I','D',0};
static const WCHAR instanceW[] = {'\\','I','n','s','t','a','n','c','e',0};
static const WCHAR wszActiveMovieKey[] = {'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\',
@@ -93,5 +93,3 @@ static const WCHAR deviceW[] = {'@','d','e','v','i','c','e',':',0};
static const WCHAR dmoW[] = {'d','m','o',':',0};
static const WCHAR swW[] = {'s','w',':',0};
static const WCHAR cmW[] = {'c','m',':',0};
-
-extern const WCHAR clsid_keyname[6] DECLSPEC_HIDDEN;
diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c
index c4338a2..660e81c 100644
--- a/dlls/devenum/mediacatenum.c
+++ b/dlls/devenum/mediacatenum.c
@@ -347,6 +347,7 @@ static HRESULT create_PropertyBag(MediaCatMoniker *mon, IPropertyBag **ppBag)
else if (rpb->type == DEVICE_FILTER)
{
strcpyW(rpb->path, clsidW);
+ strcatW(rpb->path, backslashW);
if (mon->has_class)
{
StringFromGUID2(&mon->class, rpb->path + strlenW(rpb->path), CHARS_IN_GUID);
@@ -496,7 +497,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToObject(IMoniker *iface, IBi
if (SUCCEEDED(res))
{
V_VT(&var) = VT_LPWSTR;
- res = IPropertyBag_Read(pProp, clsid_keyname, &var, NULL);
+ res = IPropertyBag_Read(pProp, clsidW, &var, NULL);
}
if (SUCCEEDED(res))
{
@@ -1027,6 +1028,7 @@ HRESULT create_EnumMoniker(REFCLSID class, IEnumMoniker **ppEnumMoniker)
pEnumMoniker->class = *class;
strcpyW(buffer, clsidW);
+ strcatW(buffer, backslashW);
StringFromGUID2(class, buffer + strlenW(buffer), CHARS_IN_GUID);
strcatW(buffer, instanceW);
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, buffer, 0, KEY_ENUMERATE_SUB_KEYS, &pEnumMoniker->sw_key))
--
2.7.4
June 26, 2018
[PATCH 2/5] devenum: Use separate factories for CLSID_SystemDeviceEnum and CLSID_CDeviceMoniker.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/devenum/devenum_main.c | 46 +++++++++++++++++++++++----------------------
1 file changed, 24 insertions(+), 22 deletions(-)
diff --git a/dlls/devenum/devenum_main.c b/dlls/devenum/devenum_main.c
index 7bfc593..3499f99 100644
--- a/dlls/devenum/devenum_main.c
+++ b/dlls/devenum/devenum_main.c
@@ -56,6 +56,17 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
return TRUE;
}
+struct class_factory
+{
+ IClassFactory IClassFactory_iface;
+ IUnknown *obj;
+};
+
+static inline struct class_factory *impl_from_IClassFactory( IClassFactory *iface )
+{
+ return CONTAINING_RECORD( iface, struct class_factory, IClassFactory_iface );
+}
+
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID iid, void **obj)
{
TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), obj);
@@ -87,24 +98,15 @@ static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface,
IUnknown *outer, REFIID iid, void **obj)
{
+ struct class_factory *This = impl_from_IClassFactory( iface );
+
TRACE("(%p, %s, %p)\n", outer, debugstr_guid(iid), obj);
if (!obj) return E_POINTER;
if (outer) return CLASS_E_NOAGGREGATION;
- if (IsEqualGUID(&IID_ICreateDevEnum, iid))
- {
- *obj = &DEVENUM_CreateDevEnum;
- return S_OK;
- }
- if (IsEqualGUID(&IID_IParseDisplayName, iid))
- {
- *obj = &DEVENUM_ParseDisplayName;
- return S_OK;
- }
-
- return CLASS_E_CLASSNOTAVAILABLE;
+ return IUnknown_QueryInterface(This->obj, iid, obj);
}
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL lock)
@@ -124,24 +126,24 @@ static const IClassFactoryVtbl ClassFactory_vtbl = {
ClassFactory_LockServer
};
-static IClassFactory devenum_cf = { &ClassFactory_vtbl };
+static struct class_factory create_devenum_cf = { { &ClassFactory_vtbl }, (IUnknown *)&DEVENUM_CreateDevEnum };
+static struct class_factory device_moniker_cf = { { &ClassFactory_vtbl }, (IUnknown *)&DEVENUM_ParseDisplayName };
/***********************************************************************
* DllGetClassObject (DEVENUM.@)
*/
-HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
+HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **obj)
{
- TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
+ TRACE("(%s, %s, %p)\n", debugstr_guid(clsid), debugstr_guid(iid), obj);
- *ppv = NULL;
+ *obj = NULL;
- /* FIXME: we should really have two class factories.
- * Oh well - works just fine as it is */
- if (IsEqualGUID(rclsid, &CLSID_SystemDeviceEnum) ||
- IsEqualGUID(rclsid, &CLSID_CDeviceMoniker))
- return IClassFactory_QueryInterface(&devenum_cf, iid, ppv);
+ if (IsEqualGUID(clsid, &CLSID_SystemDeviceEnum))
+ return IClassFactory_QueryInterface(&create_devenum_cf.IClassFactory_iface, iid, obj);
+ else if (IsEqualGUID(clsid, &CLSID_CDeviceMoniker))
+ return IClassFactory_QueryInterface(&device_moniker_cf.IClassFactory_iface, iid, obj);
- FIXME("CLSID: %s, IID: %s\n", debugstr_guid(rclsid), debugstr_guid(iid));
+ FIXME("class %s not available\n", debugstr_guid(clsid));
return CLASS_E_CLASSNOTAVAILABLE;
}
--
2.7.4
June 26, 2018
[PATCH 1/5] devenum: Merge factory.c into devenum_main.c.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/devenum/Makefile.in | 1 -
dlls/devenum/devenum_main.c | 74 ++++++++++++++++++++++-
dlls/devenum/devenum_private.h | 10 ---
dlls/devenum/factory.c | 134 -----------------------------------------
4 files changed, 72 insertions(+), 147 deletions(-)
delete mode 100644 dlls/devenum/factory.c
diff --git a/dlls/devenum/Makefile.in b/dlls/devenum/Makefile.in
index ae138b6..d1407a9 100644
--- a/dlls/devenum/Makefile.in
+++ b/dlls/devenum/Makefile.in
@@ -5,7 +5,6 @@ DELAYIMPORTS = msvfw32
C_SRCS = \
createdevenum.c \
devenum_main.c \
- factory.c \
mediacatenum.c \
parsedisplayname.c
diff --git a/dlls/devenum/devenum_main.c b/dlls/devenum/devenum_main.c
index cb4b454..7bfc593 100644
--- a/dlls/devenum/devenum_main.c
+++ b/dlls/devenum/devenum_main.c
@@ -1,5 +1,5 @@
/*
- * exported dll functions for devenum.dll
+ * Device Enumeration
*
* Copyright (C) 2002 John K. Hohm
* Copyright (C) 2002 Robert Shearman
@@ -56,6 +56,76 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
return TRUE;
}
+static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID iid, void **obj)
+{
+ TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), obj);
+
+ if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IClassFactory))
+ {
+ IClassFactory_AddRef(iface);
+ *obj = iface;
+ return S_OK;
+ }
+
+ *obj = NULL;
+ WARN("no interface for %s\n", debugstr_guid(iid));
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
+{
+ DEVENUM_LockModule();
+ return 2;
+}
+
+static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
+{
+ DEVENUM_UnlockModule();
+ return 1;
+}
+
+static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface,
+ IUnknown *outer, REFIID iid, void **obj)
+{
+ TRACE("(%p, %s, %p)\n", outer, debugstr_guid(iid), obj);
+
+ if (!obj) return E_POINTER;
+
+ if (outer) return CLASS_E_NOAGGREGATION;
+
+ if (IsEqualGUID(&IID_ICreateDevEnum, iid))
+ {
+ *obj = &DEVENUM_CreateDevEnum;
+ return S_OK;
+ }
+ if (IsEqualGUID(&IID_IParseDisplayName, iid))
+ {
+ *obj = &DEVENUM_ParseDisplayName;
+ return S_OK;
+ }
+
+ return CLASS_E_CLASSNOTAVAILABLE;
+}
+
+static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL lock)
+{
+ if (lock)
+ DEVENUM_LockModule();
+ else
+ DEVENUM_UnlockModule();
+ return S_OK;
+}
+
+static const IClassFactoryVtbl ClassFactory_vtbl = {
+ ClassFactory_QueryInterface,
+ ClassFactory_AddRef,
+ ClassFactory_Release,
+ ClassFactory_CreateInstance,
+ ClassFactory_LockServer
+};
+
+static IClassFactory devenum_cf = { &ClassFactory_vtbl };
+
/***********************************************************************
* DllGetClassObject (DEVENUM.@)
*/
@@ -69,7 +139,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
* Oh well - works just fine as it is */
if (IsEqualGUID(rclsid, &CLSID_SystemDeviceEnum) ||
IsEqualGUID(rclsid, &CLSID_CDeviceMoniker))
- return IClassFactory_QueryInterface(&DEVENUM_ClassFactory.IClassFactory_iface, iid, ppv);
+ return IClassFactory_QueryInterface(&devenum_cf, iid, ppv);
FIXME("CLSID: %s, IID: %s\n", debugstr_guid(rclsid), debugstr_guid(iid));
return CLASS_E_CLASSNOTAVAILABLE;
diff --git a/dlls/devenum/devenum_private.h b/dlls/devenum/devenum_private.h
index df0080d..ea4e017 100644
--- a/dlls/devenum/devenum_private.h
+++ b/dlls/devenum/devenum_private.h
@@ -51,15 +51,6 @@ extern LONG dll_refs DECLSPEC_HIDDEN;
static inline void DEVENUM_LockModule(void) { InterlockedIncrement(&dll_refs); }
static inline void DEVENUM_UnlockModule(void) { InterlockedDecrement(&dll_refs); }
-
-/**********************************************************************
- * ClassFactory declaration for devenum.dll
- */
-typedef struct
-{
- IClassFactory IClassFactory_iface;
-} ClassFactoryImpl;
-
enum device_type
{
DEVICE_FILTER,
@@ -84,7 +75,6 @@ typedef struct
MediaCatMoniker * DEVENUM_IMediaCatMoniker_Construct(void) DECLSPEC_HIDDEN;
HRESULT create_EnumMoniker(REFCLSID class, IEnumMoniker **enum_mon) DECLSPEC_HIDDEN;
-extern ClassFactoryImpl DEVENUM_ClassFactory DECLSPEC_HIDDEN;
extern ICreateDevEnum DEVENUM_CreateDevEnum DECLSPEC_HIDDEN;
extern IParseDisplayName DEVENUM_ParseDisplayName DECLSPEC_HIDDEN;
diff --git a/dlls/devenum/factory.c b/dlls/devenum/factory.c
deleted file mode 100644
index c808fa5..0000000
--- a/dlls/devenum/factory.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * ClassFactory implementation for DEVENUM.dll
- *
- * Copyright (C) 2002 John K. Hohm
- * Copyright (C) 2002 Robert Shearman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "devenum_private.h"
-
-#include "wine/debug.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(devenum);
-
-/**********************************************************************
- * DEVENUM_IClassFactory_QueryInterface (also IUnknown)
- */
-static HRESULT WINAPI DEVENUM_IClassFactory_QueryInterface(IClassFactory *iface, REFIID riid,
- void **ppvObj)
-{
- TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppvObj);
-
- if (ppvObj == NULL) return E_POINTER;
-
- if (IsEqualGUID(riid, &IID_IUnknown) ||
- IsEqualGUID(riid, &IID_IClassFactory))
- {
- *ppvObj = iface;
- IClassFactory_AddRef(iface);
- return S_OK;
- }
- else if (IsEqualGUID(riid, &IID_IParseDisplayName))
- {
- return IClassFactory_CreateInstance(iface, NULL, riid, ppvObj);
- }
-
- FIXME("- no interface IID: %s\n", debugstr_guid(riid));
- return E_NOINTERFACE;
-}
-
-/**********************************************************************
- * DEVENUM_IClassFactory_AddRef (also IUnknown)
- */
-static ULONG WINAPI DEVENUM_IClassFactory_AddRef(IClassFactory *iface)
-{
- TRACE("\n");
-
- DEVENUM_LockModule();
-
- return 2; /* non-heap based object */
-}
-
-/**********************************************************************
- * DEVENUM_IClassFactory_Release (also IUnknown)
- */
-static ULONG WINAPI DEVENUM_IClassFactory_Release(IClassFactory *iface)
-{
- TRACE("\n");
-
- DEVENUM_UnlockModule();
-
- return 1; /* non-heap based object */
-}
-
-/**********************************************************************
- * DEVENUM_IClassFactory_CreateInstance
- */
-static HRESULT WINAPI DEVENUM_IClassFactory_CreateInstance(IClassFactory *iface,
- IUnknown *pUnkOuter, REFIID riid, void **ppvObj)
-{
- TRACE("(%p)->(%p, %s, %p)\n", iface, pUnkOuter, debugstr_guid(riid), ppvObj);
-
- if (ppvObj == NULL) return E_POINTER;
-
- /* Don't support aggregation (Windows doesn't) */
- if (pUnkOuter != NULL) return CLASS_E_NOAGGREGATION;
-
- if (IsEqualGUID(&IID_ICreateDevEnum, riid))
- {
- *ppvObj = &DEVENUM_CreateDevEnum;
- return S_OK;
- }
- if (IsEqualGUID(&IID_IParseDisplayName, riid))
- {
- *ppvObj = &DEVENUM_ParseDisplayName;
- return S_OK;
- }
-
- return CLASS_E_CLASSNOTAVAILABLE;
-}
-
-/**********************************************************************
- * DEVENUM_IClassFactory_LockServer
- */
-static HRESULT WINAPI DEVENUM_IClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
-{
- TRACE("\n");
-
- if (fLock)
- DEVENUM_LockModule();
- else
- DEVENUM_UnlockModule();
- return S_OK;
-}
-
-/**********************************************************************
- * IClassFactory_Vtbl
- */
-static const IClassFactoryVtbl IClassFactory_Vtbl =
-{
- DEVENUM_IClassFactory_QueryInterface,
- DEVENUM_IClassFactory_AddRef,
- DEVENUM_IClassFactory_Release,
- DEVENUM_IClassFactory_CreateInstance,
- DEVENUM_IClassFactory_LockServer
-};
-
-/**********************************************************************
- * static ClassFactory instance
- */
-ClassFactoryImpl DEVENUM_ClassFactory = { { &IClassFactory_Vtbl } };
--
2.7.4
June 26, 2018