mirror of
https://github.com/reactos/reactos.git
synced 2025-06-01 07:28:19 +00:00
- Add winetests for credui, cryptnet, cryptui, dnsapi, fusion
svn path=/trunk/; revision=39788
This commit is contained in:
parent
1f80c7f756
commit
569bd394b8
20 changed files with 4898 additions and 0 deletions
132
rostests/winetests/credui/credui.c
Normal file
132
rostests/winetests/credui/credui.c
Normal file
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
* Credentials User Interface Tests
|
||||
*
|
||||
* Copyright 2007 Robert Shearman for CodeWeavers
|
||||
*
|
||||
* 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 <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wincred.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static void test_CredUIPromptForCredentials(void)
|
||||
{
|
||||
static const WCHAR wszServerName[] = {'W','i','n','e','T','e','s','t',0};
|
||||
DWORD ret;
|
||||
WCHAR username[256];
|
||||
WCHAR password[256];
|
||||
CREDUI_INFOW credui_info;
|
||||
BOOL save = FALSE;
|
||||
|
||||
credui_info.cbSize = sizeof(credui_info);
|
||||
credui_info.hwndParent = NULL;
|
||||
credui_info.pszMessageText = NULL;
|
||||
credui_info.hbmBanner = NULL;
|
||||
|
||||
ret = CredUIConfirmCredentialsW(NULL, TRUE);
|
||||
ok(ret == ERROR_INVALID_PARAMETER /* 2003 + */ || ret == ERROR_NOT_FOUND /* XP */,
|
||||
"CredUIConfirmCredentials should have returned ERROR_INVALID_PARAMETER or ERROR_NOT_FOUND instead of %d\n", ret);
|
||||
|
||||
ret = CredUIConfirmCredentialsW(wszServerName, TRUE);
|
||||
ok(ret == ERROR_NOT_FOUND, "CredUIConfirmCredentials should have returned ERROR_NOT_FOUND instead of %d\n", ret);
|
||||
|
||||
username[0] = '\0';
|
||||
password[0] = '\0';
|
||||
ret = CredUIPromptForCredentialsW(NULL, NULL, NULL, 0, username,
|
||||
sizeof(username)/sizeof(username[0]),
|
||||
password, sizeof(password)/sizeof(password[0]),
|
||||
NULL, CREDUI_FLAGS_ALWAYS_SHOW_UI);
|
||||
ok(ret == ERROR_INVALID_FLAGS, "CredUIPromptForCredentials should have returned ERROR_INVALID_FLAGS instead of %d\n", ret);
|
||||
|
||||
ret = CredUIPromptForCredentialsW(NULL, NULL, NULL, 0, username,
|
||||
sizeof(username)/sizeof(username[0]),
|
||||
password, sizeof(password)/sizeof(password[0]),
|
||||
NULL, CREDUI_FLAGS_ALWAYS_SHOW_UI | CREDUI_FLAGS_GENERIC_CREDENTIALS);
|
||||
ok(ret == ERROR_INVALID_PARAMETER, "CredUIPromptForCredentials should have returned ERROR_INVALID_PARAMETER instead of %d\n", ret);
|
||||
|
||||
ret = CredUIPromptForCredentialsW(NULL, wszServerName, NULL, 0, username,
|
||||
sizeof(username)/sizeof(username[0]),
|
||||
password, sizeof(password)/sizeof(password[0]),
|
||||
NULL, CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX);
|
||||
ok(ret == ERROR_INVALID_PARAMETER, "CredUIPromptForCredentials should have returned ERROR_INVALID_FLAGS instead of %d\n", ret);
|
||||
|
||||
if (winetest_interactive)
|
||||
{
|
||||
static const WCHAR wszCaption1[] = {'C','R','E','D','U','I','_','F','L','A','G','S','_','E','X','P','E','C','T','_','C','O','N','F','I','R','M','A','T','I','O','N',0};
|
||||
static const WCHAR wszCaption2[] = {'C','R','E','D','U','I','_','F','L','A','G','S','_','I','N','C','O','R','R','E','C','T','_','P','A','S','S','W','O','R','D','|',
|
||||
'C','R','E','D','U','I','_','F','L','A','G','S','_','E','X','P','E','C','T','_','C','O','N','F','I','R','M','A','T','I','O','N',0};
|
||||
static const WCHAR wszCaption3[] = {'C','R','E','D','U','I','_','F','L','A','G','S','_','D','O','_','N','O','T','_','P','E','R','S','I','S','T','|',
|
||||
'C','R','E','D','U','I','_','F','L','A','G','S','_','E','X','P','E','C','T','_','C','O','N','F','I','R','M','A','T','I','O','N',0};
|
||||
static const WCHAR wszCaption4[] = {'C','R','E','D','U','I','_','F','L','A','G','S','_','P','E','R','S','I','S','T','|',
|
||||
'C','R','E','D','U','I','_','F','L','A','G','S','_','E','X','P','E','C','T','_','C','O','N','F','I','R','M','A','T','I','O','N',0};
|
||||
|
||||
ret = CredUIPromptForCredentialsW(NULL, wszServerName, NULL, 0, username,
|
||||
sizeof(username)/sizeof(username[0]),
|
||||
password, sizeof(password)/sizeof(password[0]),
|
||||
&save, CREDUI_FLAGS_EXPECT_CONFIRMATION);
|
||||
ok(ret == ERROR_SUCCESS || ret == ERROR_CANCELLED, "CredUIPromptForCredentials failed with error %d\n", ret);
|
||||
if (ret == ERROR_SUCCESS)
|
||||
ret = CredUIConfirmCredentialsW(wszServerName, FALSE);
|
||||
|
||||
credui_info.pszCaptionText = wszCaption1;
|
||||
ret = CredUIPromptForCredentialsW(&credui_info, wszServerName, NULL,
|
||||
ERROR_ACCESS_DENIED,
|
||||
username, sizeof(username)/sizeof(username[0]),
|
||||
password, sizeof(password)/sizeof(password[0]),
|
||||
&save, CREDUI_FLAGS_EXPECT_CONFIRMATION);
|
||||
ok(ret == ERROR_SUCCESS || ret == ERROR_CANCELLED, "CredUIPromptForCredentials failed with error %d\n", ret);
|
||||
if (ret == ERROR_SUCCESS)
|
||||
ret = CredUIConfirmCredentialsW(wszServerName, FALSE);
|
||||
|
||||
credui_info.pszCaptionText = wszCaption2;
|
||||
ret = CredUIPromptForCredentialsW(&credui_info, wszServerName, NULL, 0,
|
||||
username, sizeof(username)/sizeof(username[0]),
|
||||
password, sizeof(password)/sizeof(password[0]),
|
||||
NULL, CREDUI_FLAGS_INCORRECT_PASSWORD|CREDUI_FLAGS_EXPECT_CONFIRMATION);
|
||||
ok(ret == ERROR_SUCCESS || ret == ERROR_CANCELLED, "CredUIPromptForCredentials failed with error %d\n", ret);
|
||||
if (ret == ERROR_SUCCESS)
|
||||
ret = CredUIConfirmCredentialsW(wszServerName, FALSE);
|
||||
|
||||
save = TRUE;
|
||||
credui_info.pszCaptionText = wszCaption3;
|
||||
ret = CredUIPromptForCredentialsW(&credui_info, wszServerName, NULL, 0,
|
||||
username, sizeof(username)/sizeof(username[0]),
|
||||
password, sizeof(password)/sizeof(password[0]),
|
||||
&save, CREDUI_FLAGS_DO_NOT_PERSIST|CREDUI_FLAGS_EXPECT_CONFIRMATION);
|
||||
ok(ret == ERROR_SUCCESS || ret == ERROR_CANCELLED, "CredUIPromptForCredentials failed with error %d\n", ret);
|
||||
ok(save, "save flag should have been untouched\n");
|
||||
|
||||
save = FALSE;
|
||||
credui_info.pszCaptionText = wszCaption4;
|
||||
ret = CredUIPromptForCredentialsW(&credui_info, wszServerName, NULL, 0,
|
||||
username, sizeof(username)/sizeof(username[0]),
|
||||
password, sizeof(password)/sizeof(password[0]),
|
||||
&save, CREDUI_FLAGS_PERSIST|CREDUI_FLAGS_EXPECT_CONFIRMATION);
|
||||
ok(ret == ERROR_SUCCESS || ret == ERROR_CANCELLED, "CredUIPromptForCredentials failed with error %d\n", ret);
|
||||
ok(!save, "save flag should have been untouched\n");
|
||||
if (ret == ERROR_SUCCESS)
|
||||
ret = CredUIConfirmCredentialsW(wszServerName, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(credui)
|
||||
{
|
||||
test_CredUIPromptForCredentials();
|
||||
}
|
10
rostests/winetests/credui/credui.rbuild
Normal file
10
rostests/winetests/credui/credui.rbuild
Normal file
|
@ -0,0 +1,10 @@
|
|||
<module name="credui_winetest" type="win32cui" installbase="bin" installname="credui_winetest.exe" allowwarnings="true">
|
||||
<compilerflag compiler="cc">-Wno-format</compilerflag>
|
||||
<include base="credui_winetest">.</include>
|
||||
<file>credui.c</file>
|
||||
<file>testlist.c</file>
|
||||
<library>wine</library>
|
||||
<library>credui</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
</module>
|
15
rostests/winetests/credui/testlist.c
Normal file
15
rostests/winetests/credui/testlist.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* Automatically generated file; DO NOT EDIT!! */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#define STANDALONE
|
||||
#include "wine/test.h"
|
||||
|
||||
extern void func_credui(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "credui", func_credui },
|
||||
{ 0, 0 }
|
||||
};
|
400
rostests/winetests/cryptnet/cryptnet.c
Normal file
400
rostests/winetests/cryptnet/cryptnet.c
Normal file
|
@ -0,0 +1,400 @@
|
|||
/*
|
||||
* Unit test suite for cryptnet.dll
|
||||
*
|
||||
* Copyright 2007 Juan Lang
|
||||
*
|
||||
* 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 <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#define NONAMELESSUNION
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <winerror.h>
|
||||
#include <wincrypt.h>
|
||||
#include "wine/test.h"
|
||||
|
||||
static const BYTE bigCert[] = {
|
||||
0x30,0x78,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x14,0x31,0x12,0x30,0x10,
|
||||
0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
|
||||
0x67,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,
|
||||
0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,
|
||||
0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x14,0x31,0x12,0x30,0x10,0x06,0x03,
|
||||
0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x30,
|
||||
0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,
|
||||
0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,
|
||||
0x01,0x01};
|
||||
static const BYTE certWithIssuingDistPoint[] = {
|
||||
0x30,0x81,0x99,0xa0,0x03,0x02,0x01,0x02,0x02,0x01,0x01,0x30,0x0d,0x06,0x09,
|
||||
0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,0x00,0x30,0x14,0x31,0x12,
|
||||
0x30,0x10,0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,
|
||||
0x61,0x6e,0x67,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,
|
||||
0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
|
||||
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x14,0x31,0x12,0x30,0x10,
|
||||
0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
|
||||
0x67,0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,0xa3,0x27,0x30,0x25,0x30,
|
||||
0x23,0x06,0x03,0x55,0x1d,0x1c,0x01,0x01,0xff,0x04,0x19,0x30,0x17,0xa0,0x15,
|
||||
0xa0,0x13,0x86,0x11,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x69,0x6e,0x65,
|
||||
0x68,0x71,0x2e,0x6f,0x72,0x67, };
|
||||
static const BYTE certWithCRLDistPoint[] = {
|
||||
0x30,0x81,0x9b,0xa0,0x03,0x02,0x01,0x02,0x02,0x01,0x01,0x30,0x0d,0x06,0x09,
|
||||
0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,0x00,0x30,0x14,0x31,0x12,
|
||||
0x30,0x10,0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,
|
||||
0x61,0x6e,0x67,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,
|
||||
0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
|
||||
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x14,0x31,0x12,0x30,0x10,
|
||||
0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
|
||||
0x67,0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,0xa3,0x29,0x30,0x27,0x30,
|
||||
0x25,0x06,0x03,0x55,0x1d,0x1f,0x01,0x01,0xff,0x04,0x1b,0x30,0x19,0x30,0x17,
|
||||
0xa0,0x15,0xa0,0x13,0x86,0x11,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x69,
|
||||
0x6e,0x65,0x68,0x71,0x2e,0x6f,0x72,0x67, };
|
||||
|
||||
static void compareUrlArray(const CRYPT_URL_ARRAY *expected,
|
||||
const CRYPT_URL_ARRAY *got)
|
||||
{
|
||||
ok(expected->cUrl == got->cUrl, "Expected %d URLs, got %d\n",
|
||||
expected->cUrl, got->cUrl);
|
||||
if (expected->cUrl == got->cUrl)
|
||||
{
|
||||
DWORD i;
|
||||
|
||||
for (i = 0; i < got->cUrl; i++)
|
||||
ok(!lstrcmpiW(expected->rgwszUrl[i], got->rgwszUrl[i]),
|
||||
"%d: unexpected URL\n", i);
|
||||
}
|
||||
}
|
||||
|
||||
static WCHAR url[] =
|
||||
{ 'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',0 };
|
||||
|
||||
static void test_getObjectUrl(void)
|
||||
{
|
||||
BOOL ret;
|
||||
DWORD urlArraySize = 0, infoSize = 0;
|
||||
PCCERT_CONTEXT cert;
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptGetObjectUrl(NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL);
|
||||
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
|
||||
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
||||
/* Crash
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, NULL, 0, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, NULL, 0, NULL, NULL,
|
||||
NULL, &infoSize, NULL);
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, NULL, 0, NULL,
|
||||
&urlArraySize, NULL, &infoSize, NULL);
|
||||
*/
|
||||
/* A cert with no CRL dist point extension fails.. */
|
||||
cert = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
|
||||
sizeof(bigCert));
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void *)cert, 0, NULL,
|
||||
NULL, NULL, NULL, NULL);
|
||||
ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
|
||||
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
|
||||
CertFreeCertificateContext(cert);
|
||||
|
||||
cert = CertCreateCertificateContext(X509_ASN_ENCODING,
|
||||
certWithIssuingDistPoint, sizeof(certWithIssuingDistPoint));
|
||||
if (cert)
|
||||
{
|
||||
/* This cert has no AIA extension, so expect this to fail */
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void *)cert, 0,
|
||||
NULL, NULL, NULL, NULL, NULL);
|
||||
ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
|
||||
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void *)cert,
|
||||
CRYPT_GET_URL_FROM_PROPERTY, NULL, NULL, NULL, NULL, NULL);
|
||||
ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
|
||||
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void *)cert,
|
||||
CRYPT_GET_URL_FROM_EXTENSION, NULL, NULL, NULL, NULL, NULL);
|
||||
ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
|
||||
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
|
||||
/* It does have an issuing dist point extension, but that's not what
|
||||
* this is looking for (it wants a CRL dist points extension)
|
||||
*/
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT,
|
||||
(void *)cert, 0, NULL, NULL, NULL, NULL, NULL);
|
||||
ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
|
||||
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT,
|
||||
(void *)cert, CRYPT_GET_URL_FROM_PROPERTY, NULL, NULL, NULL, NULL,
|
||||
NULL);
|
||||
ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
|
||||
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT,
|
||||
(void *)cert, CRYPT_GET_URL_FROM_EXTENSION, NULL, NULL, NULL, NULL,
|
||||
NULL);
|
||||
ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
|
||||
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
|
||||
CertFreeCertificateContext(cert);
|
||||
}
|
||||
cert = CertCreateCertificateContext(X509_ASN_ENCODING,
|
||||
certWithCRLDistPoint, sizeof(certWithCRLDistPoint));
|
||||
if (cert)
|
||||
{
|
||||
PCRYPT_URL_ARRAY urlArray;
|
||||
|
||||
/* This cert has no AIA extension, so expect this to fail */
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void *)cert, 0,
|
||||
NULL, NULL, NULL, NULL, NULL);
|
||||
ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
|
||||
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void *)cert,
|
||||
CRYPT_GET_URL_FROM_PROPERTY, NULL, NULL, NULL, NULL, NULL);
|
||||
ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
|
||||
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void *)cert,
|
||||
CRYPT_GET_URL_FROM_EXTENSION, NULL, NULL, NULL, NULL, NULL);
|
||||
ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
|
||||
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
|
||||
/* It does have a CRL dist points extension */
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT,
|
||||
(void *)cert, 0, NULL, NULL, NULL, NULL, NULL);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"Expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT,
|
||||
(void *)cert, 0, NULL, NULL, NULL, &infoSize, NULL);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"Expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
/* Can get it without specifying the location: */
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT,
|
||||
(void *)cert, 0, NULL, &urlArraySize, NULL, NULL, NULL);
|
||||
ok(ret, "CryptGetObjectUrl failed: %08x\n", GetLastError());
|
||||
urlArray = HeapAlloc(GetProcessHeap(), 0, urlArraySize);
|
||||
if (urlArray)
|
||||
{
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT,
|
||||
(void *)cert, 0, urlArray, &urlArraySize, NULL, NULL, NULL);
|
||||
ok(ret, "CryptGetObjectUrl failed: %08x\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
LPWSTR pUrl = url;
|
||||
CRYPT_URL_ARRAY expectedUrl = { 1, &pUrl };
|
||||
|
||||
compareUrlArray(&expectedUrl, urlArray);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, urlArray);
|
||||
}
|
||||
/* or by specifying it's an extension: */
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT,
|
||||
(void *)cert, CRYPT_GET_URL_FROM_EXTENSION, NULL, &urlArraySize, NULL,
|
||||
NULL, NULL);
|
||||
ok(ret, "CryptGetObjectUrl failed: %08x\n", GetLastError());
|
||||
urlArray = HeapAlloc(GetProcessHeap(), 0, urlArraySize);
|
||||
if (urlArray)
|
||||
{
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT,
|
||||
(void *)cert, CRYPT_GET_URL_FROM_EXTENSION, urlArray,
|
||||
&urlArraySize, NULL, NULL, NULL);
|
||||
ok(ret, "CryptGetObjectUrl failed: %08x\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
LPWSTR pUrl = url;
|
||||
CRYPT_URL_ARRAY expectedUrl = { 1, &pUrl };
|
||||
|
||||
compareUrlArray(&expectedUrl, urlArray);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, urlArray);
|
||||
}
|
||||
/* but it isn't contained in a property: */
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT,
|
||||
(void *)cert, CRYPT_GET_URL_FROM_PROPERTY, NULL, &urlArraySize, NULL,
|
||||
NULL, NULL);
|
||||
ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
|
||||
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
|
||||
CertFreeCertificateContext(cert);
|
||||
}
|
||||
}
|
||||
|
||||
static void make_tmp_file(LPSTR path)
|
||||
{
|
||||
static char curr[MAX_PATH] = { 0 };
|
||||
char temp[MAX_PATH];
|
||||
DWORD dwNumberOfBytesWritten;
|
||||
HANDLE hf;
|
||||
|
||||
if (!*curr)
|
||||
GetCurrentDirectoryA(MAX_PATH, curr);
|
||||
GetTempFileNameA(curr, "net", 0, temp);
|
||||
lstrcpyA(path, temp);
|
||||
hf = CreateFileA(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
WriteFile(hf, certWithCRLDistPoint, sizeof(certWithCRLDistPoint),
|
||||
&dwNumberOfBytesWritten, NULL);
|
||||
CloseHandle(hf);
|
||||
}
|
||||
|
||||
static void test_retrieveObjectByUrl(void)
|
||||
{
|
||||
BOOL ret;
|
||||
char tmpfile[MAX_PATH * 2], *ptr, url[MAX_PATH + 8];
|
||||
CRYPT_BLOB_ARRAY *pBlobArray;
|
||||
PCCERT_CONTEXT cert;
|
||||
PCCRL_CONTEXT crl;
|
||||
HCERTSTORE store;
|
||||
CRYPT_RETRIEVE_AUX_INFO aux = { 0 };
|
||||
FILETIME ft = { 0 };
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptRetrieveObjectByUrlA(NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL);
|
||||
ok(!ret && (GetLastError() == ERROR_INVALID_PARAMETER ||
|
||||
GetLastError() == E_INVALIDARG),
|
||||
"got 0x%x/%u (expected ERROR_INVALID_PARAMETER or E_INVALIDARG)\n",
|
||||
GetLastError(), GetLastError());
|
||||
|
||||
make_tmp_file(tmpfile);
|
||||
ptr = strchr(tmpfile, ':');
|
||||
if (ptr)
|
||||
ptr += 2; /* skip colon and first slash */
|
||||
else
|
||||
ptr = tmpfile;
|
||||
snprintf(url, sizeof(url), "file:///%s", ptr);
|
||||
do {
|
||||
ptr = strchr(url, '\\');
|
||||
if (ptr)
|
||||
*ptr = '/';
|
||||
} while (ptr);
|
||||
|
||||
pBlobArray = (CRYPT_BLOB_ARRAY *)0xdeadbeef;
|
||||
ret = CryptRetrieveObjectByUrlA(url, NULL, 0, 0, (void **)&pBlobArray,
|
||||
NULL, NULL, NULL, NULL);
|
||||
if (!ret)
|
||||
{
|
||||
/* File URL support was apparently removed in Vista/Windows 2008 */
|
||||
win_skip("File URLs not supported\n");
|
||||
return;
|
||||
}
|
||||
ok(ret, "CryptRetrieveObjectByUrlA failed: %d\n", GetLastError());
|
||||
ok(pBlobArray && pBlobArray != (CRYPT_BLOB_ARRAY *)0xdeadbeef,
|
||||
"Expected a valid pointer\n");
|
||||
if (pBlobArray && pBlobArray != (CRYPT_BLOB_ARRAY *)0xdeadbeef)
|
||||
{
|
||||
ok(pBlobArray->cBlob == 1, "Expected 1 blob, got %d\n",
|
||||
pBlobArray->cBlob);
|
||||
ok(pBlobArray->rgBlob[0].cbData == sizeof(certWithCRLDistPoint),
|
||||
"Unexpected size %d\n", pBlobArray->rgBlob[0].cbData);
|
||||
CryptMemFree(pBlobArray);
|
||||
}
|
||||
cert = (PCCERT_CONTEXT)0xdeadbeef;
|
||||
ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CERTIFICATE, 0, 0,
|
||||
(void **)&cert, NULL, NULL, NULL, NULL);
|
||||
ok(cert && cert != (PCCERT_CONTEXT)0xdeadbeef, "Expected a cert\n");
|
||||
if (cert && cert != (PCCERT_CONTEXT)0xdeadbeef)
|
||||
CertFreeCertificateContext(cert);
|
||||
crl = (PCCRL_CONTEXT)0xdeadbeef;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CRL, 0, 0, (void **)&crl,
|
||||
NULL, NULL, NULL, NULL);
|
||||
/* w2k3,XP, newer w2k: CRYPT_E_NO_MATCH, 95: OSS_DATA_ERROR */
|
||||
ok(!ret && (GetLastError() == CRYPT_E_NO_MATCH ||
|
||||
GetLastError() == CRYPT_E_ASN1_BADTAG ||
|
||||
GetLastError() == OSS_DATA_ERROR),
|
||||
"got 0x%x/%u (expected CRYPT_E_NO_MATCH or CRYPT_E_ASN1_BADTAG or "
|
||||
"OSS_DATA_ERROR)\n", GetLastError(), GetLastError());
|
||||
|
||||
/* only newer versions of cryptnet do the cleanup */
|
||||
if(!ret && GetLastError() != CRYPT_E_ASN1_BADTAG &&
|
||||
GetLastError() != OSS_DATA_ERROR) {
|
||||
ok(crl == NULL, "Expected CRL to be NULL\n");
|
||||
}
|
||||
|
||||
if (crl && crl != (PCCRL_CONTEXT)0xdeadbeef)
|
||||
CertFreeCRLContext(crl);
|
||||
store = (HCERTSTORE)0xdeadbeef;
|
||||
ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CAPI2_ANY, 0, 0,
|
||||
&store, NULL, NULL, NULL, NULL);
|
||||
ok(ret, "CryptRetrieveObjectByUrlA failed: %d\n", GetLastError());
|
||||
if (store && store != (HCERTSTORE)0xdeadbeef)
|
||||
{
|
||||
DWORD certs = 0;
|
||||
|
||||
cert = NULL;
|
||||
do {
|
||||
cert = CertEnumCertificatesInStore(store, cert);
|
||||
if (cert)
|
||||
certs++;
|
||||
} while (cert);
|
||||
ok(certs == 1, "Expected 1 cert, got %d\n", certs);
|
||||
CertCloseStore(store, 0);
|
||||
}
|
||||
/* Are file URLs cached? */
|
||||
cert = (PCCERT_CONTEXT)0xdeadbeef;
|
||||
ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CERTIFICATE,
|
||||
CRYPT_CACHE_ONLY_RETRIEVAL, 0, (void **)&cert, NULL, NULL, NULL, NULL);
|
||||
ok(ret, "CryptRetrieveObjectByUrlA failed: %08x\n", GetLastError());
|
||||
if (cert && cert != (PCCERT_CONTEXT)0xdeadbeef)
|
||||
CertFreeCertificateContext(cert);
|
||||
|
||||
cert = (PCCERT_CONTEXT)0xdeadbeef;
|
||||
ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CERTIFICATE, 0, 0,
|
||||
(void **)&cert, NULL, NULL, NULL, &aux);
|
||||
/* w2k: success, 9x: fail with E_INVALIDARG */
|
||||
ok(ret || (GetLastError() == E_INVALIDARG),
|
||||
"got %u with 0x%x/%u (expected '!=0' or '0' with E_INVALIDARG)\n",
|
||||
ret, GetLastError(), GetLastError());
|
||||
if (cert && cert != (PCCERT_CONTEXT)0xdeadbeef)
|
||||
CertFreeCertificateContext(cert);
|
||||
|
||||
cert = (PCCERT_CONTEXT)0xdeadbeef;
|
||||
aux.cbSize = sizeof(aux);
|
||||
ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CERTIFICATE, 0, 0,
|
||||
(void **)&cert, NULL, NULL, NULL, &aux);
|
||||
/* w2k: success, 9x: fail with E_INVALIDARG */
|
||||
ok(ret || (GetLastError() == E_INVALIDARG),
|
||||
"got %u with 0x%x/%u (expected '!=0' or '0' with E_INVALIDARG)\n",
|
||||
ret, GetLastError(), GetLastError());
|
||||
if (!ret) {
|
||||
/* no more tests useful */
|
||||
DeleteFileA(tmpfile);
|
||||
skip("no usable CertificateContext\n");
|
||||
return;
|
||||
}
|
||||
|
||||
aux.pLastSyncTime = &ft;
|
||||
ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CERTIFICATE, 0, 0,
|
||||
(void **)&cert, NULL, NULL, NULL, &aux);
|
||||
ok(ft.dwLowDateTime || ft.dwHighDateTime,
|
||||
"Expected last sync time to be set\n");
|
||||
DeleteFileA(tmpfile);
|
||||
/* Okay, after being deleted, are file URLs still cached? */
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CERTIFICATE,
|
||||
CRYPT_CACHE_ONLY_RETRIEVAL, 0, (void **)&cert, NULL, NULL, NULL, NULL);
|
||||
ok(!ret && (GetLastError() == ERROR_FILE_NOT_FOUND ||
|
||||
GetLastError() == ERROR_PATH_NOT_FOUND),
|
||||
"Expected ERROR_FILE_NOT_FOUND or ERROR_PATH_NOT_FOUND, got %d\n",
|
||||
GetLastError());
|
||||
}
|
||||
|
||||
START_TEST(cryptnet)
|
||||
{
|
||||
test_getObjectUrl();
|
||||
test_retrieveObjectByUrl();
|
||||
}
|
11
rostests/winetests/cryptnet/cryptnet.rbuild
Normal file
11
rostests/winetests/cryptnet/cryptnet.rbuild
Normal file
|
@ -0,0 +1,11 @@
|
|||
<module name="cryptnet_winetest" type="win32cui" installbase="bin" installname="cryptnet_winetest.exe" allowwarnings="true">
|
||||
<compilerflag compiler="cc">-Wno-format</compilerflag>
|
||||
<include base="cryptnet_winetest">.</include>
|
||||
<file>cryptnet.c</file>
|
||||
<file>testlist.c</file>
|
||||
<library>wine</library>
|
||||
<library>cryptnet</library>
|
||||
<library>crypt32</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
</module>
|
15
rostests/winetests/cryptnet/testlist.c
Normal file
15
rostests/winetests/cryptnet/testlist.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* Automatically generated file; DO NOT EDIT!! */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#define STANDALONE
|
||||
#include "wine/test.h"
|
||||
|
||||
extern void func_cryptnet(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "cryptnet", func_cryptnet },
|
||||
{ 0, 0 }
|
||||
};
|
664
rostests/winetests/cryptui/cryptui.c
Normal file
664
rostests/winetests/cryptui/cryptui.c
Normal file
|
@ -0,0 +1,664 @@
|
|||
/*
|
||||
* Unit test suite for cryptui.dll
|
||||
*
|
||||
* Copyright 2008 Juan Lang
|
||||
*
|
||||
* 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 <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#define NONAMELESSUNION
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <winerror.h>
|
||||
#include <winuser.h>
|
||||
#include <wincrypt.h>
|
||||
#include <cryptuiapi.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static BYTE v1CertWithValidPubKey[] = {
|
||||
0x30,0x81,0xcf,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,
|
||||
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
|
||||
0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,
|
||||
0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
|
||||
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,
|
||||
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
|
||||
0x67,0x00,0x30,0x5c,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
|
||||
0x01,0x01,0x05,0x00,0x03,0x4b,0x00,0x30,0x48,0x02,0x41,0x00,0xe2,0x54,0x3a,
|
||||
0xa7,0x83,0xb1,0x27,0x14,0x3e,0x59,0xbb,0xb4,0x53,0xe6,0x1f,0xe7,0x5d,0xf1,
|
||||
0x21,0x68,0xad,0x85,0x53,0xdb,0x6b,0x1e,0xeb,0x65,0x97,0x03,0x86,0x60,0xde,
|
||||
0xf3,0x6c,0x38,0x75,0xe0,0x4c,0x61,0xbb,0xbc,0x62,0x17,0xa9,0xcd,0x79,0x3f,
|
||||
0x21,0x4e,0x96,0xcb,0x0e,0xdc,0x61,0x94,0x30,0x18,0x10,0x6b,0xd0,0x1c,0x10,
|
||||
0x79,0x02,0x03,0x01,0x00,0x01,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,0x03,0x55,
|
||||
0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 };
|
||||
static const BYTE iTunesCert1[] = {
|
||||
0x30,0x82,0x03,0xff,0x30,0x82,0x02,0xe7,0xa0,0x03,0x02,0x01,0x02,0x02,0x10,
|
||||
0x0d,0xe9,0x2b,0xf0,0xd4,0xd8,0x29,0x88,0x18,0x32,0x05,0x09,0x5e,0x9a,0x76,
|
||||
0x88,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,
|
||||
0x00,0x30,0x53,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,
|
||||
0x53,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0a,0x13,0x0e,0x56,0x65,0x72,
|
||||
0x69,0x53,0x69,0x67,0x6e,0x2c,0x20,0x49,0x6e,0x63,0x2e,0x31,0x2b,0x30,0x29,
|
||||
0x06,0x03,0x55,0x04,0x03,0x13,0x22,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6e,
|
||||
0x20,0x54,0x69,0x6d,0x65,0x20,0x53,0x74,0x61,0x6d,0x70,0x69,0x6e,0x67,0x20,
|
||||
0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x20,0x43,0x41,0x30,0x1e,0x17,0x0d,
|
||||
0x30,0x33,0x31,0x32,0x30,0x34,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x17,0x0d,
|
||||
0x30,0x38,0x31,0x32,0x30,0x33,0x32,0x33,0x35,0x39,0x35,0x39,0x5a,0x30,0x57,
|
||||
0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,
|
||||
0x30,0x15,0x06,0x03,0x55,0x04,0x0a,0x13,0x0e,0x56,0x65,0x72,0x69,0x53,0x69,
|
||||
0x67,0x6e,0x2c,0x20,0x49,0x6e,0x63,0x2e,0x31,0x2f,0x30,0x2d,0x06,0x03,0x55,
|
||||
0x04,0x03,0x13,0x26,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6e,0x20,0x54,0x69,
|
||||
0x6d,0x65,0x20,0x53,0x74,0x61,0x6d,0x70,0x69,0x6e,0x67,0x20,0x53,0x65,0x72,
|
||||
0x76,0x69,0x63,0x65,0x73,0x20,0x53,0x69,0x67,0x6e,0x65,0x72,0x30,0x82,0x01,
|
||||
0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,
|
||||
0x00,0x03,0x82,0x01,0x0f,0x00,0x30,0x82,0x01,0x0a,0x02,0x82,0x01,0x01,0x00,
|
||||
0xb2,0x50,0x28,0x48,0xdd,0xd3,0x68,0x7a,0x84,0x18,0x44,0x66,0x75,0x5d,0x7e,
|
||||
0xc4,0xb8,0x9f,0x63,0x26,0xff,0x3d,0x43,0x9c,0x7c,0x11,0x38,0x10,0x25,0x55,
|
||||
0x73,0xd9,0x75,0x27,0x69,0xfd,0x4e,0xb9,0x20,0x5c,0xd3,0x0a,0xf9,0xa0,0x1b,
|
||||
0x2a,0xed,0x55,0x56,0x21,0x61,0xd8,0x1e,0xdb,0xe4,0xbc,0x33,0x6b,0xc7,0xef,
|
||||
0xdd,0xa3,0x37,0x65,0x8e,0x1b,0x93,0x0c,0xb6,0x53,0x1e,0x5c,0x7c,0x66,0x35,
|
||||
0x5f,0x05,0x8a,0x45,0xfe,0x76,0x4e,0xdf,0x53,0x80,0xa2,0x81,0x20,0x9d,0xae,
|
||||
0x88,0x5c,0xa2,0x08,0xf7,0xe5,0x30,0xf9,0xee,0x22,0x37,0x4c,0x42,0x0a,0xce,
|
||||
0xdf,0xc6,0x1f,0xc4,0xd6,0x55,0xe9,0x81,0x3f,0xb5,0x52,0xa3,0x2c,0xaa,0x01,
|
||||
0x7a,0xf2,0xa2,0xaa,0x8d,0x35,0xfe,0x9f,0xe6,0x5d,0x6a,0x05,0x9f,0x3d,0x6b,
|
||||
0xe3,0xbf,0x96,0xc0,0xfe,0xcc,0x60,0xf9,0x40,0xe7,0x07,0xa0,0x44,0xeb,0x81,
|
||||
0x51,0x6e,0xa5,0x2a,0xf2,0xb6,0x8a,0x10,0x28,0xed,0x8f,0xdc,0x06,0xa0,0x86,
|
||||
0x50,0x9a,0x7b,0x4a,0x08,0x0d,0x30,0x1d,0xca,0x10,0x9e,0x6b,0xf7,0xe9,0x58,
|
||||
0xae,0x04,0xa9,0x40,0x99,0xb2,0x28,0xe8,0x8f,0x16,0xac,0x3c,0xe3,0x53,0x6f,
|
||||
0x4b,0xd3,0x35,0x9d,0xb5,0x6f,0x64,0x1d,0xb3,0x96,0x2c,0xbb,0x3d,0xe7,0x79,
|
||||
0xeb,0x6d,0x7a,0xf9,0x16,0xe6,0x26,0xad,0xaf,0xef,0x99,0x53,0xb7,0x40,0x2c,
|
||||
0x95,0xb8,0x79,0xaa,0xfe,0xd4,0x52,0xab,0x29,0x74,0x7e,0x42,0xec,0x39,0x1e,
|
||||
0xa2,0x6a,0x16,0xe6,0x59,0xbb,0x24,0x68,0xd8,0x00,0x80,0x43,0x10,0x87,0x80,
|
||||
0x6b,0x02,0x03,0x01,0x00,0x01,0xa3,0x81,0xca,0x30,0x81,0xc7,0x30,0x34,0x06,
|
||||
0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x01,0x01,0x04,0x28,0x30,0x26,0x30,0x24,
|
||||
0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x86,0x18,0x68,0x74,0x74,
|
||||
0x70,0x3a,0x2f,0x2f,0x6f,0x63,0x73,0x70,0x2e,0x76,0x65,0x72,0x69,0x73,0x69,
|
||||
0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x30,0x0c,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,
|
||||
0xff,0x04,0x02,0x30,0x00,0x30,0x33,0x06,0x03,0x55,0x1d,0x1f,0x04,0x2c,0x30,
|
||||
0x2a,0x30,0x28,0xa0,0x26,0xa0,0x24,0x86,0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,
|
||||
0x2f,0x63,0x72,0x6c,0x2e,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6e,0x2e,0x63,
|
||||
0x6f,0x6d,0x2f,0x74,0x73,0x73,0x2d,0x63,0x61,0x2e,0x63,0x72,0x6c,0x30,0x16,
|
||||
0x06,0x03,0x55,0x1d,0x25,0x01,0x01,0xff,0x04,0x0c,0x30,0x0a,0x06,0x08,0x2b,
|
||||
0x06,0x01,0x05,0x05,0x07,0x03,0x08,0x30,0x0e,0x06,0x03,0x55,0x1d,0x0f,0x01,
|
||||
0x01,0xff,0x04,0x04,0x03,0x02,0x06,0xc0,0x30,0x24,0x06,0x03,0x55,0x1d,0x11,
|
||||
0x04,0x1d,0x30,0x1b,0xa4,0x19,0x30,0x17,0x31,0x15,0x30,0x13,0x06,0x03,0x55,
|
||||
0x04,0x03,0x13,0x0c,0x54,0x53,0x41,0x32,0x30,0x34,0x38,0x2d,0x31,0x2d,0x35,
|
||||
0x34,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,
|
||||
0x00,0x03,0x82,0x01,0x01,0x00,0x87,0x78,0x70,0xda,0x4e,0x52,0x01,0x20,0x5b,
|
||||
0xe0,0x79,0xc9,0x82,0x30,0xc4,0xfd,0xb9,0x19,0x96,0xbd,0x91,0x00,0xc3,0xbd,
|
||||
0xcd,0xcd,0xc6,0xf4,0x0e,0xd8,0xff,0xf9,0x4d,0xc0,0x33,0x62,0x30,0x11,0xc5,
|
||||
0xf5,0x74,0x1b,0xd4,0x92,0xde,0x5f,0x9c,0x20,0x13,0xb1,0x7c,0x45,0xbe,0x50,
|
||||
0xcd,0x83,0xe7,0x80,0x17,0x83,0xa7,0x27,0x93,0x67,0x13,0x46,0xfb,0xca,0xb8,
|
||||
0x98,0x41,0x03,0xcc,0x9b,0x51,0x5b,0x05,0x8b,0x7f,0xa8,0x6f,0xf3,0x1b,0x50,
|
||||
0x1b,0x24,0x2e,0xf2,0x69,0x8d,0x6c,0x22,0xf7,0xbb,0xca,0x16,0x95,0xed,0x0c,
|
||||
0x74,0xc0,0x68,0x77,0xd9,0xeb,0x99,0x62,0x87,0xc1,0x73,0x90,0xf8,0x89,0x74,
|
||||
0x7a,0x23,0xab,0xa3,0x98,0x7b,0x97,0xb1,0xf7,0x8f,0x29,0x71,0x4d,0x2e,0x75,
|
||||
0x1b,0x48,0x41,0xda,0xf0,0xb5,0x0d,0x20,0x54,0xd6,0x77,0xa0,0x97,0x82,0x63,
|
||||
0x69,0xfd,0x09,0xcf,0x8a,0xf0,0x75,0xbb,0x09,0x9b,0xd9,0xf9,0x11,0x55,0x26,
|
||||
0x9a,0x61,0x32,0xbe,0x7a,0x02,0xb0,0x7b,0x86,0xbe,0xa2,0xc3,0x8b,0x22,0x2c,
|
||||
0x78,0xd1,0x35,0x76,0xbc,0x92,0x73,0x5c,0xf9,0xb9,0xe6,0x4c,0x15,0x0a,0x23,
|
||||
0xcc,0xe4,0xd2,0xd4,0x34,0x2e,0x49,0x40,0x15,0x3c,0x0f,0x60,0x7a,0x24,0xc6,
|
||||
0xa5,0x66,0xef,0x96,0xcf,0x70,0xeb,0x3e,0xe7,0xf4,0x0d,0x7e,0xdc,0xd1,0x7c,
|
||||
0xa3,0x76,0x71,0x69,0xc1,0x9c,0x4f,0x47,0x30,0x35,0x21,0xb1,0xa2,0xaf,0x1a,
|
||||
0x62,0x3c,0x2b,0xd9,0x8e,0xaa,0x2a,0x07,0x7b,0xd8,0x18,0xb3,0x5c,0x7b,0xe2,
|
||||
0x9d,0xa5,0x6f,0xfe,0x3c,0x89,0xad };
|
||||
static const BYTE iTunesCert2[] = {
|
||||
0x30,0x82,0x04,0xbf,0x30,0x82,0x04,0x28,0xa0,0x03,0x02,0x01,0x02,0x02,0x10,
|
||||
0x41,0x91,0xa1,0x5a,0x39,0x78,0xdf,0xcf,0x49,0x65,0x66,0x38,0x1d,0x4c,0x75,
|
||||
0xc2,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,
|
||||
0x00,0x30,0x5f,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,
|
||||
0x53,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0a,0x13,0x0e,0x56,0x65,0x72,
|
||||
0x69,0x53,0x69,0x67,0x6e,0x2c,0x20,0x49,0x6e,0x63,0x2e,0x31,0x37,0x30,0x35,
|
||||
0x06,0x03,0x55,0x04,0x0b,0x13,0x2e,0x43,0x6c,0x61,0x73,0x73,0x20,0x33,0x20,
|
||||
0x50,0x75,0x62,0x6c,0x69,0x63,0x20,0x50,0x72,0x69,0x6d,0x61,0x72,0x79,0x20,
|
||||
0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x41,
|
||||
0x75,0x74,0x68,0x6f,0x72,0x69,0x74,0x79,0x30,0x1e,0x17,0x0d,0x30,0x34,0x30,
|
||||
0x37,0x31,0x36,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x17,0x0d,0x31,0x34,0x30,
|
||||
0x37,0x31,0x35,0x32,0x33,0x35,0x39,0x35,0x39,0x5a,0x30,0x81,0xb4,0x31,0x0b,
|
||||
0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,0x15,
|
||||
0x06,0x03,0x55,0x04,0x0a,0x13,0x0e,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6e,
|
||||
0x2c,0x20,0x49,0x6e,0x63,0x2e,0x31,0x1f,0x30,0x1d,0x06,0x03,0x55,0x04,0x0b,
|
||||
0x13,0x16,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6e,0x20,0x54,0x72,0x75,0x73,
|
||||
0x74,0x20,0x4e,0x65,0x74,0x77,0x6f,0x72,0x6b,0x31,0x3b,0x30,0x39,0x06,0x03,
|
||||
0x55,0x04,0x0b,0x13,0x32,0x54,0x65,0x72,0x6d,0x73,0x20,0x6f,0x66,0x20,0x75,
|
||||
0x73,0x65,0x20,0x61,0x74,0x20,0x68,0x74,0x74,0x70,0x73,0x3a,0x2f,0x2f,0x77,
|
||||
0x77,0x77,0x2e,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,
|
||||
0x2f,0x72,0x70,0x61,0x20,0x28,0x63,0x29,0x30,0x34,0x31,0x2e,0x30,0x2c,0x06,
|
||||
0x03,0x55,0x04,0x03,0x13,0x25,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6e,0x20,
|
||||
0x43,0x6c,0x61,0x73,0x73,0x20,0x33,0x20,0x43,0x6f,0x64,0x65,0x20,0x53,0x69,
|
||||
0x67,0x6e,0x69,0x6e,0x67,0x20,0x32,0x30,0x30,0x34,0x20,0x43,0x41,0x30,0x82,
|
||||
0x01,0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,
|
||||
0x05,0x00,0x03,0x82,0x01,0x0f,0x00,0x30,0x82,0x01,0x0a,0x02,0x82,0x01,0x01,
|
||||
0x00,0xbe,0xbc,0xee,0xbc,0x7e,0xef,0x83,0xeb,0xe0,0x37,0x4f,0xfb,0x03,0x10,
|
||||
0x38,0xbe,0x08,0xd2,0x8c,0x7d,0x9d,0xfa,0x92,0x7f,0x19,0x0c,0xc2,0x6b,0xee,
|
||||
0x42,0x52,0x8c,0xde,0xd3,0x1c,0x48,0x13,0x25,0xea,0xc1,0x63,0x7a,0xf9,0x51,
|
||||
0x65,0xee,0xd3,0xaa,0x3b,0xf5,0xf0,0x94,0x9c,0x2b,0xfb,0xf2,0x66,0xd4,0x24,
|
||||
0xda,0xf7,0xf5,0x9f,0x6e,0x19,0x39,0x36,0xbc,0xd0,0xa3,0x76,0x08,0x1e,0x22,
|
||||
0x27,0x24,0x6c,0x38,0x91,0x27,0xe2,0x84,0x49,0xae,0x1b,0x8a,0xa1,0xfd,0x25,
|
||||
0x82,0x2c,0x10,0x30,0xe8,0x71,0xab,0x28,0xe8,0x77,0x4a,0x51,0xf1,0xec,0xcd,
|
||||
0xf8,0xf0,0x54,0xd4,0x6f,0xc0,0xe3,0x6d,0x0a,0x8f,0xd9,0xd8,0x64,0x8d,0x63,
|
||||
0xb2,0x2d,0x4e,0x27,0xf6,0x85,0x0e,0xfe,0x6d,0xe3,0x29,0x99,0xe2,0x85,0x47,
|
||||
0x7c,0x2d,0x86,0x7f,0xe8,0x57,0x8f,0xad,0x67,0xc2,0x33,0x32,0x91,0x13,0x20,
|
||||
0xfc,0xa9,0x23,0x14,0x9a,0x6d,0xc2,0x84,0x4b,0x76,0x68,0x04,0xd5,0x71,0x2c,
|
||||
0x5d,0x21,0xfa,0x88,0x0d,0x26,0xfd,0x1f,0x2d,0x91,0x2b,0xe7,0x01,0x55,0x4d,
|
||||
0xf2,0x6d,0x35,0x28,0x82,0xdf,0xd9,0x6b,0x5c,0xb6,0xd6,0xd9,0xaa,0x81,0xfd,
|
||||
0x5f,0xcd,0x83,0xba,0x63,0x9d,0xd0,0x22,0xfc,0xa9,0x3b,0x42,0x69,0xb2,0x8e,
|
||||
0x3a,0xb5,0xbc,0xb4,0x9e,0x0f,0x5e,0xc4,0xea,0x2c,0x82,0x8b,0x28,0xfd,0x53,
|
||||
0x08,0x96,0xdd,0xb5,0x01,0x20,0xd1,0xf9,0xa5,0x18,0xe7,0xc0,0xee,0x51,0x70,
|
||||
0x37,0xe1,0xb6,0x05,0x48,0x52,0x48,0x6f,0x38,0xea,0xc3,0xe8,0x6c,0x7b,0x44,
|
||||
0x84,0xbb,0x02,0x03,0x01,0x00,0x01,0xa3,0x82,0x01,0xa0,0x30,0x82,0x01,0x9c,
|
||||
0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,
|
||||
0x01,0xff,0x02,0x01,0x00,0x30,0x44,0x06,0x03,0x55,0x1d,0x20,0x04,0x3d,0x30,
|
||||
0x3b,0x30,0x39,0x06,0x0b,0x60,0x86,0x48,0x01,0x86,0xf8,0x45,0x01,0x07,0x17,
|
||||
0x03,0x30,0x2a,0x30,0x28,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x02,0x01,
|
||||
0x16,0x1c,0x68,0x74,0x74,0x70,0x73,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x76,
|
||||
0x65,0x72,0x69,0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x2f,0x72,0x70,0x61,
|
||||
0x30,0x31,0x06,0x03,0x55,0x1d,0x1f,0x04,0x2a,0x30,0x28,0x30,0x26,0xa0,0x24,
|
||||
0xa0,0x22,0x86,0x20,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x63,0x72,0x6c,0x2e,
|
||||
0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x2f,0x70,0x63,
|
||||
0x61,0x33,0x2e,0x63,0x72,0x6c,0x30,0x1d,0x06,0x03,0x55,0x1d,0x25,0x04,0x16,
|
||||
0x30,0x14,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x02,0x06,0x08,0x2b,
|
||||
0x06,0x01,0x05,0x05,0x07,0x03,0x03,0x30,0x0e,0x06,0x03,0x55,0x1d,0x0f,0x01,
|
||||
0x01,0xff,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x11,0x06,0x09,0x60,0x86,0x48,
|
||||
0x01,0x86,0xf8,0x42,0x01,0x01,0x04,0x04,0x03,0x02,0x00,0x01,0x30,0x29,0x06,
|
||||
0x03,0x55,0x1d,0x11,0x04,0x22,0x30,0x20,0xa4,0x1e,0x30,0x1c,0x31,0x1a,0x30,
|
||||
0x18,0x06,0x03,0x55,0x04,0x03,0x13,0x11,0x43,0x6c,0x61,0x73,0x73,0x33,0x43,
|
||||
0x41,0x32,0x30,0x34,0x38,0x2d,0x31,0x2d,0x34,0x33,0x30,0x1d,0x06,0x03,0x55,
|
||||
0x1d,0x0e,0x04,0x16,0x04,0x14,0x08,0xf5,0x51,0xe8,0xfb,0xfe,0x3d,0x3d,0x64,
|
||||
0x36,0x7c,0x68,0xcf,0x5b,0x78,0xa8,0xdf,0xb9,0xc5,0x37,0x30,0x81,0x80,0x06,
|
||||
0x03,0x55,0x1d,0x23,0x04,0x79,0x30,0x77,0xa1,0x63,0xa4,0x61,0x30,0x5f,0x31,
|
||||
0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,
|
||||
0x15,0x06,0x03,0x55,0x04,0x0a,0x13,0x0e,0x56,0x65,0x72,0x69,0x53,0x69,0x67,
|
||||
0x6e,0x2c,0x20,0x49,0x6e,0x63,0x2e,0x31,0x37,0x30,0x35,0x06,0x03,0x55,0x04,
|
||||
0x0b,0x13,0x2e,0x43,0x6c,0x61,0x73,0x73,0x20,0x33,0x20,0x50,0x75,0x62,0x6c,
|
||||
0x69,0x63,0x20,0x50,0x72,0x69,0x6d,0x61,0x72,0x79,0x20,0x43,0x65,0x72,0x74,
|
||||
0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x41,0x75,0x74,0x68,0x6f,
|
||||
0x72,0x69,0x74,0x79,0x82,0x10,0x70,0xba,0xe4,0x1d,0x10,0xd9,0x29,0x34,0xb6,
|
||||
0x38,0xca,0x7b,0x03,0xcc,0xba,0xbf,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,
|
||||
0xf7,0x0d,0x01,0x01,0x05,0x05,0x00,0x03,0x81,0x81,0x00,0xae,0x3a,0x17,0xb8,
|
||||
0x4a,0x7b,0x55,0xfa,0x64,0x55,0xec,0x40,0xa4,0xed,0x49,0x41,0x90,0x99,0x9c,
|
||||
0x89,0xbc,0xaf,0x2e,0x1d,0xca,0x78,0x23,0xf9,0x1c,0x19,0x0f,0x7f,0xeb,0x68,
|
||||
0xbc,0x32,0xd9,0x88,0x38,0xde,0xdc,0x3f,0xd3,0x89,0xb4,0x3f,0xb1,0x82,0x96,
|
||||
0xf1,0xa4,0x5a,0xba,0xed,0x2e,0x26,0xd3,0xde,0x7c,0x01,0x6e,0x00,0x0a,0x00,
|
||||
0xa4,0x06,0x92,0x11,0x48,0x09,0x40,0xf9,0x1c,0x18,0x79,0x67,0x23,0x24,0xe0,
|
||||
0xbb,0xd5,0xe1,0x50,0xae,0x1b,0xf5,0x0e,0xdd,0xe0,0x2e,0x81,0xcd,0x80,0xa3,
|
||||
0x6c,0x52,0x4f,0x91,0x75,0x55,0x8a,0xba,0x22,0xf2,0xd2,0xea,0x41,0x75,0x88,
|
||||
0x2f,0x63,0x55,0x7d,0x1e,0x54,0x5a,0x95,0x59,0xca,0xd9,0x34,0x81,0xc0,0x5f,
|
||||
0x5e,0xf6,0x7a,0xb5 };
|
||||
static const BYTE iTunesCert3[] = {
|
||||
0x30,0x82,0x04,0xf1,0x30,0x82,0x03,0xd9,0xa0,0x03,0x02,0x01,0x02,0x02,0x10,
|
||||
0x0f,0x1a,0xa0,0xe0,0x9b,0x9b,0x61,0xa6,0xb6,0xfe,0x40,0xd2,0xdf,0x6a,0xf6,
|
||||
0x8d,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,
|
||||
0x00,0x30,0x81,0xb4,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,
|
||||
0x55,0x53,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0a,0x13,0x0e,0x56,0x65,
|
||||
0x72,0x69,0x53,0x69,0x67,0x6e,0x2c,0x20,0x49,0x6e,0x63,0x2e,0x31,0x1f,0x30,
|
||||
0x1d,0x06,0x03,0x55,0x04,0x0b,0x13,0x16,0x56,0x65,0x72,0x69,0x53,0x69,0x67,
|
||||
0x6e,0x20,0x54,0x72,0x75,0x73,0x74,0x20,0x4e,0x65,0x74,0x77,0x6f,0x72,0x6b,
|
||||
0x31,0x3b,0x30,0x39,0x06,0x03,0x55,0x04,0x0b,0x13,0x32,0x54,0x65,0x72,0x6d,
|
||||
0x73,0x20,0x6f,0x66,0x20,0x75,0x73,0x65,0x20,0x61,0x74,0x20,0x68,0x74,0x74,
|
||||
0x70,0x73,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x76,0x65,0x72,0x69,0x73,0x69,
|
||||
0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x2f,0x72,0x70,0x61,0x20,0x28,0x63,0x29,0x30,
|
||||
0x34,0x31,0x2e,0x30,0x2c,0x06,0x03,0x55,0x04,0x03,0x13,0x25,0x56,0x65,0x72,
|
||||
0x69,0x53,0x69,0x67,0x6e,0x20,0x43,0x6c,0x61,0x73,0x73,0x20,0x33,0x20,0x43,
|
||||
0x6f,0x64,0x65,0x20,0x53,0x69,0x67,0x6e,0x69,0x6e,0x67,0x20,0x32,0x30,0x30,
|
||||
0x34,0x20,0x43,0x41,0x30,0x1e,0x17,0x0d,0x30,0x36,0x30,0x31,0x31,0x37,0x30,
|
||||
0x30,0x30,0x30,0x30,0x30,0x5a,0x17,0x0d,0x30,0x38,0x30,0x31,0x32,0x32,0x32,
|
||||
0x33,0x35,0x39,0x35,0x39,0x5a,0x30,0x81,0xb4,0x31,0x0b,0x30,0x09,0x06,0x03,
|
||||
0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,
|
||||
0x08,0x13,0x0a,0x43,0x61,0x6c,0x69,0x66,0x6f,0x72,0x6e,0x69,0x61,0x31,0x12,
|
||||
0x30,0x10,0x06,0x03,0x55,0x04,0x07,0x13,0x09,0x43,0x75,0x70,0x65,0x72,0x74,
|
||||
0x69,0x6e,0x6f,0x31,0x1d,0x30,0x1b,0x06,0x03,0x55,0x04,0x0a,0x14,0x14,0x41,
|
||||
0x70,0x70,0x6c,0x65,0x20,0x43,0x6f,0x6d,0x70,0x75,0x74,0x65,0x72,0x2c,0x20,
|
||||
0x49,0x6e,0x63,0x2e,0x31,0x3e,0x30,0x3c,0x06,0x03,0x55,0x04,0x0b,0x13,0x35,
|
||||
0x44,0x69,0x67,0x69,0x74,0x61,0x6c,0x20,0x49,0x44,0x20,0x43,0x6c,0x61,0x73,
|
||||
0x73,0x20,0x33,0x20,0x2d,0x20,0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f,0x66,0x74,
|
||||
0x20,0x53,0x6f,0x66,0x74,0x77,0x61,0x72,0x65,0x20,0x56,0x61,0x6c,0x69,0x64,
|
||||
0x61,0x74,0x69,0x6f,0x6e,0x20,0x76,0x32,0x31,0x1d,0x30,0x1b,0x06,0x03,0x55,
|
||||
0x04,0x03,0x14,0x14,0x41,0x70,0x70,0x6c,0x65,0x20,0x43,0x6f,0x6d,0x70,0x75,
|
||||
0x74,0x65,0x72,0x2c,0x20,0x49,0x6e,0x63,0x2e,0x30,0x81,0x9f,0x30,0x0d,0x06,
|
||||
0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8d,
|
||||
0x00,0x30,0x81,0x89,0x02,0x81,0x81,0x00,0xd3,0xab,0x3b,0x7f,0xec,0x48,0x84,
|
||||
0xce,0xa8,0x1a,0x12,0xf3,0x3c,0x87,0xcb,0x24,0x58,0x96,0x02,0x87,0x66,0x49,
|
||||
0xeb,0x89,0xee,0x79,0x44,0x70,0x8d,0xe7,0xd4,0x1f,0x30,0x92,0xc0,0x9c,0x35,
|
||||
0x78,0xc0,0xaf,0x1c,0xb6,0x28,0xd3,0xe0,0xe0,0x9d,0xd3,0x49,0x76,0x73,0x57,
|
||||
0x19,0x4d,0x8d,0x70,0x85,0x64,0x4d,0x1d,0xc6,0x02,0x3e,0xe5,0x2c,0x66,0x07,
|
||||
0xd2,0x27,0x4b,0xd6,0xc8,0x3c,0x93,0xb6,0x15,0x0c,0xde,0x5b,0xd7,0x93,0xdd,
|
||||
0xbe,0x85,0x62,0x34,0x17,0x8a,0x05,0x60,0xf0,0x8a,0x1c,0x5a,0x40,0x21,0x8d,
|
||||
0x51,0x6c,0xb0,0x62,0xd8,0xb5,0xd4,0xf9,0xb1,0xd0,0x58,0x7a,0x7a,0x82,0x55,
|
||||
0xb3,0xf9,0x53,0x71,0xde,0xd2,0xc9,0x37,0x8c,0xf6,0x5a,0x1f,0x2d,0xcd,0x7c,
|
||||
0x67,0x02,0x03,0x01,0x00,0x01,0xa3,0x82,0x01,0x7f,0x30,0x82,0x01,0x7b,0x30,
|
||||
0x09,0x06,0x03,0x55,0x1d,0x13,0x04,0x02,0x30,0x00,0x30,0x0e,0x06,0x03,0x55,
|
||||
0x1d,0x0f,0x01,0x01,0xff,0x04,0x04,0x03,0x02,0x07,0x80,0x30,0x40,0x06,0x03,
|
||||
0x55,0x1d,0x1f,0x04,0x39,0x30,0x37,0x30,0x35,0xa0,0x33,0xa0,0x31,0x86,0x2f,
|
||||
0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x43,0x53,0x43,0x33,0x2d,0x32,0x30,0x30,
|
||||
0x34,0x2d,0x63,0x72,0x6c,0x2e,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6e,0x2e,
|
||||
0x63,0x6f,0x6d,0x2f,0x43,0x53,0x43,0x33,0x2d,0x32,0x30,0x30,0x34,0x2e,0x63,
|
||||
0x72,0x6c,0x30,0x44,0x06,0x03,0x55,0x1d,0x20,0x04,0x3d,0x30,0x3b,0x30,0x39,
|
||||
0x06,0x0b,0x60,0x86,0x48,0x01,0x86,0xf8,0x45,0x01,0x07,0x17,0x03,0x30,0x2a,
|
||||
0x30,0x28,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x02,0x01,0x16,0x1c,0x68,
|
||||
0x74,0x74,0x70,0x73,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x76,0x65,0x72,0x69,
|
||||
0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x2f,0x72,0x70,0x61,0x30,0x13,0x06,
|
||||
0x03,0x55,0x1d,0x25,0x04,0x0c,0x30,0x0a,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,
|
||||
0x07,0x03,0x03,0x30,0x75,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x01,0x01,
|
||||
0x04,0x69,0x30,0x67,0x30,0x24,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x30,
|
||||
0x01,0x86,0x18,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x6f,0x63,0x73,0x70,0x2e,
|
||||
0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x30,0x3f,0x06,
|
||||
0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x02,0x86,0x33,0x68,0x74,0x74,0x70,
|
||||
0x3a,0x2f,0x2f,0x43,0x53,0x43,0x33,0x2d,0x32,0x30,0x30,0x34,0x2d,0x61,0x69,
|
||||
0x61,0x2e,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x2f,
|
||||
0x43,0x53,0x43,0x33,0x2d,0x32,0x30,0x30,0x34,0x2d,0x61,0x69,0x61,0x2e,0x63,
|
||||
0x65,0x72,0x30,0x1f,0x06,0x03,0x55,0x1d,0x23,0x04,0x18,0x30,0x16,0x80,0x14,
|
||||
0x08,0xf5,0x51,0xe8,0xfb,0xfe,0x3d,0x3d,0x64,0x36,0x7c,0x68,0xcf,0x5b,0x78,
|
||||
0xa8,0xdf,0xb9,0xc5,0x37,0x30,0x11,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xf8,
|
||||
0x42,0x01,0x01,0x04,0x04,0x03,0x02,0x04,0x10,0x30,0x16,0x06,0x0a,0x2b,0x06,
|
||||
0x01,0x04,0x01,0x82,0x37,0x02,0x01,0x1b,0x04,0x08,0x30,0x06,0x01,0x01,0x00,
|
||||
0x01,0x01,0xff,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,
|
||||
0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x6a,0xa6,0x06,0xd0,0x33,0x18,0x64,
|
||||
0xe2,0x69,0x82,0xee,0x6e,0x36,0x9e,0x9d,0x9a,0x0e,0x18,0xa8,0xac,0x9d,0x10,
|
||||
0xed,0x01,0x3c,0xb9,0x61,0x04,0x62,0xf3,0x85,0x8f,0xcc,0x4f,0x2c,0x66,0x35,
|
||||
0x54,0x25,0x45,0x8d,0x95,0x1c,0xd2,0x33,0xbe,0x2e,0xdd,0x7f,0x74,0xaf,0x03,
|
||||
0x7b,0x86,0x63,0xb0,0xc9,0xe6,0xbd,0xc7,0x8e,0xde,0x03,0x18,0x98,0x82,0xc3,
|
||||
0xbb,0xf8,0x15,0x99,0x1a,0xa9,0xdd,0xb9,0x5d,0xb9,0xbd,0x53,0x95,0x25,0x76,
|
||||
0xfb,0x5c,0x53,0x90,0xea,0x01,0x0a,0xa0,0xb1,0xbf,0x09,0x1b,0x97,0x8f,0x40,
|
||||
0xfa,0x85,0x12,0x74,0x01,0xdb,0xf6,0xdb,0x09,0xd6,0x5f,0x4f,0xd7,0x17,0xb4,
|
||||
0xbf,0x9e,0x2f,0x86,0x52,0x5d,0x70,0x24,0x52,0x32,0x1e,0xa5,0x1d,0x39,0x8b,
|
||||
0x66,0xf6,0xba,0x9b,0x69,0x8e,0x12,0x60,0xdb,0xb6,0xcf,0xe6,0x0d,0xd6,0x1c,
|
||||
0x8f,0xd4,0x5b,0x4b,0x00,0xde,0x21,0x93,0xfb,0x6e,0xc7,0x3d,0xb4,0x66,0x0d,
|
||||
0x29,0x0c,0x4e,0xe9,0x3f,0x94,0xd6,0xd6,0xdc,0xec,0xf8,0x53,0x3b,0x62,0xd5,
|
||||
0x97,0x50,0x53,0x84,0x17,0xfe,0xe2,0xed,0x4c,0x23,0x0a,0x49,0xce,0x5b,0xe9,
|
||||
0x70,0x31,0xc1,0x04,0x02,0x02,0x6c,0xb8,0x52,0xcd,0xc7,0x4e,0x70,0xb4,0x13,
|
||||
0xd7,0xe0,0x92,0xba,0x44,0x1a,0x10,0x4c,0x6e,0x45,0xc6,0x86,0x04,0xc6,0x64,
|
||||
0xd3,0x9c,0x6e,0xc1,0x9c,0xac,0x74,0x3d,0x77,0x06,0x5e,0x28,0x28,0x5c,0xf5,
|
||||
0xe0,0x9c,0x19,0xd8,0xba,0x74,0x81,0x2d,0x67,0x77,0x93,0x8d,0xbf,0xd2,0x52,
|
||||
0x00,0xe6,0xa5,0x38,0x4e,0x2e,0x73,0x66,0x7a };
|
||||
static const BYTE signedCRL[] = { 0x30, 0x45, 0x30, 0x2c, 0x30, 0x02, 0x06,
|
||||
0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
|
||||
0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x18, 0x0f,
|
||||
0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30,
|
||||
0x30, 0x5a, 0x30, 0x02, 0x06, 0x00, 0x03, 0x11, 0x00, 0x0f, 0x0e, 0x0d, 0x0c,
|
||||
0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 };
|
||||
|
||||
/* CBT hook to ensure a window (e.g., MessageBox) cannot be created */
|
||||
static HHOOK hook;
|
||||
static LRESULT CALLBACK cbt_hook_proc(int code, WPARAM wp, LPARAM lp)
|
||||
{
|
||||
return code == HCBT_CREATEWND ? 1: CallNextHookEx(hook, code, wp, lp);
|
||||
}
|
||||
|
||||
static BOOL (WINAPI *pCryptUIWizImport)(DWORD dwFlags, HWND hwndParent,
|
||||
LPCWSTR pwszWizardTitle, PCCRYPTUI_WIZ_IMPORT_SRC_INFO pImportSrc,
|
||||
HCERTSTORE hDestCertStore);
|
||||
|
||||
static BOOL find_and_delete_cert_in_store(HCERTSTORE store, PCCERT_CONTEXT cert)
|
||||
{
|
||||
CERT_ID id;
|
||||
PCCERT_CONTEXT found;
|
||||
|
||||
id.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
|
||||
memcpy(&id.u.IssuerSerialNumber.Issuer,
|
||||
&cert->pCertInfo->Issuer, sizeof(CERT_NAME_BLOB));
|
||||
memcpy(&id.u.IssuerSerialNumber.SerialNumber,
|
||||
&cert->pCertInfo->SerialNumber, sizeof(CRYPT_INTEGER_BLOB));
|
||||
found = CertFindCertificateInStore(store, X509_ASN_ENCODING, 0,
|
||||
CERT_FIND_CERT_ID, &id, NULL);
|
||||
if (!found)
|
||||
return FALSE;
|
||||
|
||||
CertDeleteCertificateFromStore(found);
|
||||
CertFreeCertificateContext(found);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void test_crypt_ui_wiz_import(void)
|
||||
{
|
||||
BOOL ret;
|
||||
CRYPTUI_WIZ_IMPORT_SRC_INFO info;
|
||||
HCERTSTORE store;
|
||||
PCCERT_CONTEXT cert;
|
||||
PCCRL_CONTEXT crl;
|
||||
DWORD count;
|
||||
|
||||
if (!pCryptUIWizImport)
|
||||
{
|
||||
skip("No CryptUIWizImport\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set CBT hook to disallow MessageBox and wizard creation in current
|
||||
* thread.
|
||||
*/
|
||||
hook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, GetCurrentThreadId());
|
||||
|
||||
/* Brings up UI. Cancelling yields ret = 1. */
|
||||
if (0)
|
||||
{
|
||||
ret = pCryptUIWizImport(0, 0, NULL, NULL, NULL);
|
||||
}
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, NULL, NULL);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
memset(&info, 0, sizeof(info));
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
info.dwSize = sizeof(info);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
info.dwSubjectChoice = CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_CONTEXT;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CERT,
|
||||
0, NULL, &info, NULL);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
/* Check allowed vs. given type mismatches */
|
||||
info.u.pCertContext = CertCreateCertificateContext(X509_ASN_ENCODING,
|
||||
v1CertWithValidPubKey, sizeof(v1CertWithValidPubKey));
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CRL,
|
||||
0, NULL, &info, NULL);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
CertFreeCertificateContext(info.u.pCertContext);
|
||||
info.dwSubjectChoice = CRYPTUI_WIZ_IMPORT_SUBJECT_CRL_CONTEXT;
|
||||
info.u.pCRLContext = CertCreateCRLContext(X509_ASN_ENCODING,
|
||||
signedCRL, sizeof(signedCRL));
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CERT,
|
||||
0, NULL, &info, NULL);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
CertFreeCRLContext(info.u.pCRLContext);
|
||||
/* Imports the following cert--self-signed, with no basic constraints set--
|
||||
* to the CA store. Puts up a dialog at the end if it succeeds or fails.
|
||||
*/
|
||||
info.dwSubjectChoice = CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_CONTEXT;
|
||||
info.u.pCertContext = CertCreateCertificateContext(X509_ASN_ENCODING,
|
||||
v1CertWithValidPubKey, sizeof(v1CertWithValidPubKey));
|
||||
ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL);
|
||||
ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
static const WCHAR CA[] = { 'C','A',0 };
|
||||
HCERTSTORE ca = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0,
|
||||
CERT_SYSTEM_STORE_CURRENT_USER, CA);
|
||||
|
||||
if (ca)
|
||||
{
|
||||
ret = find_and_delete_cert_in_store(ca, info.u.pCertContext);
|
||||
ok(ret ||
|
||||
broken(!ret) /* Win9x/NT4 */,
|
||||
"expected to find v1CertWithValidPubKey in CA store\n");
|
||||
CertCloseStore(ca, 0);
|
||||
}
|
||||
}
|
||||
CertFreeCertificateContext(info.u.pCertContext);
|
||||
/* Imports the following cert--not self-signed, with a basic constraints2
|
||||
* extensions--to the "AddressBook" store. Puts up a dialog at the end if
|
||||
* it succeeds or fails.
|
||||
*/
|
||||
info.u.pCertContext = CertCreateCertificateContext(X509_ASN_ENCODING,
|
||||
iTunesCert3, sizeof(iTunesCert3));
|
||||
ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL);
|
||||
ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
static const WCHAR AddressBook[] = { 'A','d','d','r','e','s','s',
|
||||
'B','o','o','k',0 };
|
||||
HCERTSTORE addressBook = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0,
|
||||
CERT_SYSTEM_STORE_CURRENT_USER, AddressBook);
|
||||
|
||||
if (addressBook)
|
||||
{
|
||||
ret = find_and_delete_cert_in_store(addressBook,
|
||||
info.u.pCertContext);
|
||||
ok(ret ||
|
||||
broken(!ret), /* Windows 2000 and earlier */
|
||||
"expected to find iTunesCert3 in AddressBook store\n");
|
||||
CertCloseStore(addressBook, 0);
|
||||
}
|
||||
}
|
||||
/* Displays the wizard, but disables the "Certificate store" edit and
|
||||
* the Browse button. Confusingly, the "Place all certificates in the
|
||||
* following store" radio button is not disabled.
|
||||
*/
|
||||
if (0)
|
||||
{
|
||||
ret = pCryptUIWizImport(CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE, 0,
|
||||
NULL, &info, NULL);
|
||||
ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
|
||||
}
|
||||
store = CertOpenStore(CERT_STORE_PROV_MEMORY, X509_ASN_ENCODING, 0,
|
||||
CERT_STORE_CREATE_NEW_FLAG, NULL);
|
||||
/* Displays the wizard, but sets the "Certificate store" edit to the
|
||||
* string "Determined by the program", and disables it and the Browse
|
||||
* button, as well as the "Automatically select the certificate store
|
||||
* based on the type of certificate" radio button.
|
||||
*/
|
||||
if (0)
|
||||
{
|
||||
ret = pCryptUIWizImport(CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE, 0,
|
||||
NULL, &info, store);
|
||||
ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
|
||||
}
|
||||
ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI |
|
||||
CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE, 0, NULL, &info, store);
|
||||
ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
|
||||
ret = find_and_delete_cert_in_store(store, info.u.pCertContext);
|
||||
ok(ret ||
|
||||
broken(!ret) /* Win9x/NT4 */,
|
||||
"expected to find iTunesCert3 in memory store\n");
|
||||
CertFreeCertificateContext(info.u.pCertContext);
|
||||
CertCloseStore(store, 0);
|
||||
|
||||
info.u.pCertContext = CertCreateCertificateContext(X509_ASN_ENCODING,
|
||||
iTunesCert1, sizeof(iTunesCert1));
|
||||
ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL);
|
||||
ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
static const WCHAR AddressBook[] = { 'A','d','d','r','e','s','s',
|
||||
'B','o','o','k',0 };
|
||||
HCERTSTORE addressBook = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0,
|
||||
CERT_SYSTEM_STORE_CURRENT_USER, AddressBook);
|
||||
|
||||
if (addressBook)
|
||||
{
|
||||
ret = find_and_delete_cert_in_store(addressBook,
|
||||
info.u.pCertContext);
|
||||
ok(ret ||
|
||||
broken(!ret), /* Windows 2000 and earlier */
|
||||
"expected to find iTunesCert1 in AddressBook store\n");
|
||||
CertCloseStore(addressBook, 0);
|
||||
}
|
||||
}
|
||||
CertFreeCertificateContext(info.u.pCertContext);
|
||||
|
||||
info.u.pCertContext = CertCreateCertificateContext(X509_ASN_ENCODING,
|
||||
iTunesCert2, sizeof(iTunesCert2));
|
||||
ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL);
|
||||
ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
static const WCHAR CA[] = { 'C','A',0 };
|
||||
HCERTSTORE ca = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0,
|
||||
CERT_SYSTEM_STORE_CURRENT_USER, CA);
|
||||
|
||||
if (ca)
|
||||
{
|
||||
ret = find_and_delete_cert_in_store(ca, info.u.pCertContext);
|
||||
ok(ret ||
|
||||
broken(!ret) /* Win9x/NT4 */,
|
||||
"expected to find iTunesCert2 in CA store\n");
|
||||
CertCloseStore(ca, 0);
|
||||
}
|
||||
}
|
||||
CertFreeCertificateContext(info.u.pCertContext);
|
||||
|
||||
info.u.hCertStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
|
||||
CERT_STORE_CREATE_NEW_FLAG, NULL);
|
||||
CertAddEncodedCertificateToStore(info.u.hCertStore, X509_ASN_ENCODING,
|
||||
v1CertWithValidPubKey, sizeof(v1CertWithValidPubKey),
|
||||
CERT_STORE_ADD_ALWAYS, NULL);
|
||||
CertAddEncodedCRLToStore(info.u.hCertStore, X509_ASN_ENCODING, signedCRL,
|
||||
sizeof(signedCRL), CERT_STORE_ADD_ALWAYS, NULL);
|
||||
info.dwSubjectChoice = CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_STORE;
|
||||
/* The ALLOW flags aren't allowed with a store as the source if the source
|
||||
* contains types other than those allowed.
|
||||
*/
|
||||
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
|
||||
CERT_STORE_CREATE_NEW_FLAG, NULL);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CERT,
|
||||
0, NULL, &info, store);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CRL,
|
||||
0, NULL, &info, store);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptUIWizImport(CRYPTUI_WIZ_NO_UI |
|
||||
CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE |
|
||||
CRYPTUI_WIZ_IMPORT_ALLOW_CERT | CRYPTUI_WIZ_IMPORT_ALLOW_CRL, 0, NULL,
|
||||
&info, store);
|
||||
ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
count = 0;
|
||||
cert = NULL;
|
||||
do {
|
||||
cert = CertEnumCertificatesInStore(store, cert);
|
||||
if (cert)
|
||||
count++;
|
||||
} while (cert);
|
||||
ok(count == 1, "expected 1 cert, got %d\n", count);
|
||||
count = 0;
|
||||
crl = NULL;
|
||||
do {
|
||||
crl = CertEnumCRLsInStore(store, crl);
|
||||
if (crl)
|
||||
count++;
|
||||
} while (cert);
|
||||
ok(count == 1, "expected 1 CRL, got %d\n", count);
|
||||
}
|
||||
CertCloseStore(store, 0);
|
||||
CertCloseStore(info.u.hCertStore, 0);
|
||||
|
||||
/* If the ALLOW flags match the content of the store, the store can be
|
||||
* imported.
|
||||
*/
|
||||
info.u.hCertStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
|
||||
CERT_STORE_CREATE_NEW_FLAG, NULL);
|
||||
CertAddEncodedCertificateToStore(info.u.hCertStore, X509_ASN_ENCODING,
|
||||
v1CertWithValidPubKey, sizeof(v1CertWithValidPubKey),
|
||||
CERT_STORE_ADD_ALWAYS, NULL);
|
||||
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
|
||||
CERT_STORE_CREATE_NEW_FLAG, NULL);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CERT,
|
||||
0, NULL, &info, store);
|
||||
ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
count = 0;
|
||||
cert = NULL;
|
||||
do {
|
||||
cert = CertEnumCertificatesInStore(store, cert);
|
||||
if (cert)
|
||||
count++;
|
||||
} while (cert);
|
||||
ok(count == 1, "expected 1 cert, got %d\n", count);
|
||||
count = 0;
|
||||
crl = NULL;
|
||||
do {
|
||||
crl = CertEnumCRLsInStore(store, crl);
|
||||
if (crl)
|
||||
count++;
|
||||
} while (cert);
|
||||
ok(count == 0, "expected 0 CRLs, got %d\n", count);
|
||||
}
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CRL,
|
||||
0, NULL, &info, store);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
CertCloseStore(store, 0);
|
||||
CertCloseStore(info.u.hCertStore, 0);
|
||||
|
||||
/* Again, if the ALLOW flags match the content of the store, the store can
|
||||
* be imported.
|
||||
*/
|
||||
info.u.hCertStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
|
||||
CERT_STORE_CREATE_NEW_FLAG, NULL);
|
||||
CertAddEncodedCRLToStore(info.u.hCertStore, X509_ASN_ENCODING, signedCRL,
|
||||
sizeof(signedCRL), CERT_STORE_ADD_ALWAYS, NULL);
|
||||
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
|
||||
CERT_STORE_CREATE_NEW_FLAG, NULL);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CRL,
|
||||
0, NULL, &info, store);
|
||||
ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
count = 0;
|
||||
cert = NULL;
|
||||
do {
|
||||
cert = CertEnumCertificatesInStore(store, cert);
|
||||
if (cert)
|
||||
count++;
|
||||
} while (cert);
|
||||
ok(count == 0, "expected 0 certs, got %d\n", count);
|
||||
count = 0;
|
||||
crl = NULL;
|
||||
do {
|
||||
crl = CertEnumCRLsInStore(store, crl);
|
||||
if (crl)
|
||||
count++;
|
||||
} while (cert);
|
||||
ok(count == 1, "expected 1 CRL, got %d\n", count);
|
||||
}
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = CryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CERT,
|
||||
0, NULL, &info, store);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
CertCloseStore(store, 0);
|
||||
CertCloseStore(info.u.hCertStore, 0);
|
||||
|
||||
UnhookWindowsHookEx(hook);
|
||||
}
|
||||
|
||||
START_TEST(cryptui)
|
||||
{
|
||||
HMODULE lib = LoadLibraryA("cryptui");
|
||||
|
||||
if (lib)
|
||||
{
|
||||
pCryptUIWizImport = (void *)GetProcAddress(lib, "CryptUIWizImport");
|
||||
|
||||
test_crypt_ui_wiz_import();
|
||||
FreeLibrary(lib);
|
||||
}
|
||||
}
|
12
rostests/winetests/cryptui/cryptui.rbuild
Normal file
12
rostests/winetests/cryptui/cryptui.rbuild
Normal file
|
@ -0,0 +1,12 @@
|
|||
<module name="cryptui_winetest" type="win32cui" installbase="bin" installname="cryptui_winetest.exe" allowwarnings="true">
|
||||
<compilerflag compiler="cc">-Wno-format</compilerflag>
|
||||
<include base="cryptui_winetest">.</include>
|
||||
<file>cryptui.c</file>
|
||||
<file>testlist.c</file>
|
||||
<library>wine</library>
|
||||
<library>cryptui</library>
|
||||
<library>crypt32</library>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>ntdll</library>
|
||||
</module>
|
15
rostests/winetests/cryptui/testlist.c
Normal file
15
rostests/winetests/cryptui/testlist.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* Automatically generated file; DO NOT EDIT!! */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#define STANDALONE
|
||||
#include "wine/test.h"
|
||||
|
||||
extern void func_cryptui(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "cryptui", func_cryptui },
|
||||
{ 0, 0 }
|
||||
};
|
|
@ -22,9 +22,24 @@
|
|||
<directory name="comdlg32">
|
||||
<xi:include href="comdlg32/comdlg32.rbuild" />
|
||||
</directory>
|
||||
<directory name="credui">
|
||||
<xi:include href="credui/credui.rbuild" />
|
||||
</directory>
|
||||
<directory name="crypt32">
|
||||
<xi:include href="crypt32/crypt32.rbuild" />
|
||||
</directory>
|
||||
<directory name="cryptnet">
|
||||
<xi:include href="cryptnet/cryptnet.rbuild" />
|
||||
</directory>
|
||||
<directory name="cryptui">
|
||||
<xi:include href="cryptui/cryptui.rbuild" />
|
||||
</directory>
|
||||
<directory name="dnsapi">
|
||||
<xi:include href="dnsapi/dnsapi.rbuild" />
|
||||
</directory>
|
||||
<directory name="fusion">
|
||||
<xi:include href="fusion/fusion.rbuild" />
|
||||
</directory>
|
||||
<directory name="gdi32">
|
||||
<xi:include href="gdi32/gdi32.rbuild" />
|
||||
</directory>
|
||||
|
|
11
rostests/winetests/dnsapi/dnsapi.rbuild
Normal file
11
rostests/winetests/dnsapi/dnsapi.rbuild
Normal file
|
@ -0,0 +1,11 @@
|
|||
<module name="dnsapi_winetest" type="win32cui" installbase="bin" installname="dnsapi_winetest.exe" allowwarnings="true">
|
||||
<compilerflag compiler="cc">-Wno-format</compilerflag>
|
||||
<include base="dnsapi_winetest">.</include>
|
||||
<file>name.c</file>
|
||||
<file>record.c</file>
|
||||
<file>testlist.c</file>
|
||||
<library>wine</library>
|
||||
<library>dnsapi</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
</module>
|
208
rostests/winetests/dnsapi/name.c
Normal file
208
rostests/winetests/dnsapi/name.c
Normal file
|
@ -0,0 +1,208 @@
|
|||
/*
|
||||
* Tests for name handling functions
|
||||
*
|
||||
* Copyright 2006 Hans Leidekker
|
||||
*
|
||||
* 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 <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winnls.h"
|
||||
#include "windns.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static const struct
|
||||
{
|
||||
LPCSTR name;
|
||||
DNS_NAME_FORMAT format;
|
||||
DNS_STATUS status;
|
||||
}
|
||||
test_data[] =
|
||||
{
|
||||
{ "", DnsNameDomain, ERROR_INVALID_NAME },
|
||||
{ ".", DnsNameDomain, ERROR_SUCCESS },
|
||||
{ "..", DnsNameDomain, ERROR_INVALID_NAME },
|
||||
{ ".a", DnsNameDomain, ERROR_INVALID_NAME },
|
||||
{ "a.", DnsNameDomain, ERROR_SUCCESS },
|
||||
{ "a..", DnsNameDomain, ERROR_INVALID_NAME },
|
||||
{ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", DnsNameDomain, ERROR_INVALID_NAME },
|
||||
{ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", DnsNameDomain, ERROR_INVALID_NAME },
|
||||
{ "a.?", DnsNameDomain, DNS_ERROR_INVALID_NAME_CHAR },
|
||||
{ "a.*", DnsNameDomain, DNS_ERROR_INVALID_NAME_CHAR },
|
||||
{ "a ", DnsNameDomain, DNS_ERROR_INVALID_NAME_CHAR },
|
||||
{ "a._b", DnsNameDomain, DNS_ERROR_NON_RFC_NAME },
|
||||
{ "123", DnsNameDomain, DNS_ERROR_NUMERIC_NAME },
|
||||
{ "123.456", DnsNameDomain, DNS_ERROR_NUMERIC_NAME },
|
||||
{ "a.b", DnsNameDomain, ERROR_SUCCESS },
|
||||
|
||||
{ "", DnsNameDomainLabel, ERROR_INVALID_NAME },
|
||||
{ ".", DnsNameDomainLabel, ERROR_INVALID_NAME },
|
||||
{ "..", DnsNameDomainLabel, ERROR_INVALID_NAME },
|
||||
{ ".c", DnsNameDomainLabel, ERROR_INVALID_NAME },
|
||||
{ "c.", DnsNameDomainLabel, ERROR_INVALID_NAME },
|
||||
{ "c..", DnsNameDomainLabel, ERROR_INVALID_NAME },
|
||||
{ "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", DnsNameDomainLabel, ERROR_INVALID_NAME },
|
||||
{ "?", DnsNameDomainLabel, DNS_ERROR_INVALID_NAME_CHAR },
|
||||
{ "*", DnsNameDomainLabel, DNS_ERROR_INVALID_NAME_CHAR },
|
||||
{ "c ", DnsNameDomainLabel, DNS_ERROR_INVALID_NAME_CHAR },
|
||||
{ "_c", DnsNameDomainLabel, DNS_ERROR_NON_RFC_NAME },
|
||||
{ "456", DnsNameDomainLabel, ERROR_SUCCESS },
|
||||
{ "456.789", DnsNameDomainLabel, ERROR_INVALID_NAME },
|
||||
{ "c.d", DnsNameDomainLabel, ERROR_INVALID_NAME },
|
||||
|
||||
{ "", DnsNameHostnameFull, ERROR_INVALID_NAME },
|
||||
{ ".", DnsNameHostnameFull, ERROR_SUCCESS },
|
||||
{ "..", DnsNameHostnameFull, ERROR_INVALID_NAME },
|
||||
{ ".e", DnsNameHostnameFull, ERROR_INVALID_NAME },
|
||||
{ "e.", DnsNameHostnameFull, ERROR_SUCCESS },
|
||||
{ "e..", DnsNameHostnameFull, ERROR_INVALID_NAME },
|
||||
{ "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", DnsNameDomain, ERROR_INVALID_NAME },
|
||||
{ "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", DnsNameHostnameFull, ERROR_INVALID_NAME },
|
||||
{ "?", DnsNameHostnameLabel, DNS_ERROR_INVALID_NAME_CHAR },
|
||||
{ "e.?", DnsNameHostnameFull, DNS_ERROR_INVALID_NAME_CHAR },
|
||||
{ "e.*", DnsNameHostnameFull, DNS_ERROR_INVALID_NAME_CHAR },
|
||||
{ "e ", DnsNameHostnameFull, DNS_ERROR_INVALID_NAME_CHAR },
|
||||
{ "e._f", DnsNameHostnameFull, DNS_ERROR_NON_RFC_NAME },
|
||||
{ "789", DnsNameHostnameFull, DNS_ERROR_NUMERIC_NAME },
|
||||
{ "789.456", DnsNameHostnameFull, DNS_ERROR_NUMERIC_NAME },
|
||||
{ "e.f", DnsNameHostnameFull, ERROR_SUCCESS },
|
||||
|
||||
{ "", DnsNameHostnameLabel, ERROR_INVALID_NAME },
|
||||
{ ".", DnsNameHostnameLabel, ERROR_INVALID_NAME },
|
||||
{ "..", DnsNameHostnameLabel, ERROR_INVALID_NAME },
|
||||
{ ".g", DnsNameHostnameLabel, ERROR_INVALID_NAME },
|
||||
{ "g.", DnsNameHostnameLabel, ERROR_INVALID_NAME },
|
||||
{ "g..", DnsNameHostnameLabel, ERROR_INVALID_NAME },
|
||||
{ "gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg", DnsNameHostnameLabel, ERROR_INVALID_NAME },
|
||||
{ "*", DnsNameHostnameLabel, DNS_ERROR_INVALID_NAME_CHAR },
|
||||
{ "g ", DnsNameHostnameLabel, DNS_ERROR_INVALID_NAME_CHAR },
|
||||
{ "_g", DnsNameHostnameLabel, DNS_ERROR_NON_RFC_NAME },
|
||||
{ "123", DnsNameHostnameLabel, DNS_ERROR_NUMERIC_NAME },
|
||||
{ "123.456", DnsNameHostnameLabel, ERROR_INVALID_NAME },
|
||||
{ "g.h", DnsNameHostnameLabel, ERROR_INVALID_NAME },
|
||||
|
||||
{ "", DnsNameWildcard, ERROR_INVALID_NAME },
|
||||
{ ".", DnsNameWildcard, ERROR_INVALID_NAME },
|
||||
{ "..", DnsNameWildcard, ERROR_INVALID_NAME },
|
||||
{ ".j", DnsNameWildcard, ERROR_INVALID_NAME },
|
||||
{ "j.", DnsNameWildcard, ERROR_INVALID_NAME },
|
||||
{ "j..", DnsNameWildcard, ERROR_INVALID_NAME },
|
||||
{ "jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj", DnsNameWildcard, ERROR_INVALID_NAME },
|
||||
{ "jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj.jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj.jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj.jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj", DnsNameWildcard, ERROR_INVALID_NAME },
|
||||
{ "?", DnsNameWildcard, ERROR_INVALID_NAME },
|
||||
{ "i ", DnsNameWildcard, ERROR_INVALID_NAME },
|
||||
{ "_i", DnsNameWildcard, ERROR_INVALID_NAME },
|
||||
{ "123", DnsNameWildcard, ERROR_INVALID_NAME },
|
||||
{ "123.456", DnsNameWildcard, ERROR_INVALID_NAME },
|
||||
{ "i.j", DnsNameWildcard, ERROR_INVALID_NAME },
|
||||
{ "*", DnsNameWildcard, ERROR_SUCCESS },
|
||||
{ "*j", DnsNameWildcard, DNS_ERROR_INVALID_NAME_CHAR },
|
||||
{ "*.j", DnsNameWildcard, ERROR_SUCCESS },
|
||||
{ "i.*", DnsNameWildcard, ERROR_INVALID_NAME },
|
||||
|
||||
{ "", DnsNameSrvRecord, ERROR_INVALID_NAME },
|
||||
{ ".", DnsNameSrvRecord, ERROR_INVALID_NAME },
|
||||
{ "..", DnsNameSrvRecord, ERROR_INVALID_NAME },
|
||||
{ ".k", DnsNameSrvRecord, ERROR_INVALID_NAME },
|
||||
{ "k.", DnsNameSrvRecord, ERROR_INVALID_NAME },
|
||||
{ "k..", DnsNameSrvRecord, ERROR_INVALID_NAME },
|
||||
{ "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk", DnsNameSrvRecord, ERROR_INVALID_NAME },
|
||||
{ "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk.kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk.kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk.kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk", DnsNameSrvRecord, ERROR_INVALID_NAME },
|
||||
{ "?", DnsNameSrvRecord, ERROR_INVALID_NAME },
|
||||
{ "k ", DnsNameSrvRecord, ERROR_INVALID_NAME },
|
||||
{ "_k", DnsNameSrvRecord, ERROR_SUCCESS },
|
||||
{ "123", DnsNameSrvRecord, ERROR_INVALID_NAME },
|
||||
{ "123.456", DnsNameSrvRecord, ERROR_INVALID_NAME },
|
||||
{ "k.l", DnsNameSrvRecord, ERROR_INVALID_NAME },
|
||||
{ "_", DnsNameSrvRecord, DNS_ERROR_NON_RFC_NAME },
|
||||
{ "_k.l", DnsNameSrvRecord, ERROR_SUCCESS },
|
||||
{ "k._l", DnsNameSrvRecord, ERROR_INVALID_NAME }
|
||||
};
|
||||
|
||||
static void test_DnsValidateName_A( void )
|
||||
{
|
||||
unsigned int i;
|
||||
DNS_STATUS status;
|
||||
|
||||
status = DnsValidateName_A( NULL, DnsNameDomain );
|
||||
ok( status == ERROR_INVALID_NAME, "succeeded unexpectedly\n" );
|
||||
|
||||
for (i = 0; i < sizeof(test_data) / sizeof(test_data[0]); i++)
|
||||
{
|
||||
status = DnsValidateName_A( test_data[i].name, test_data[i].format );
|
||||
ok( status == test_data[i].status, "%d: \'%s\': got %d, expected %d\n",
|
||||
i, test_data[i].name, status, test_data[i].status );
|
||||
}
|
||||
}
|
||||
|
||||
static void test_DnsNameCompare_A( void )
|
||||
{
|
||||
static CHAR empty[] = "",
|
||||
dot[] = ".",
|
||||
dotdot[] = "..",
|
||||
A[] = "A",
|
||||
a[] = "a",
|
||||
B[] = "B",
|
||||
b[] = "b",
|
||||
A_dot_B[] = "A.B",
|
||||
a_dot_a[] = "a.a",
|
||||
a_dot_b[] = "a.b",
|
||||
a_dot_b_dot[] = "a.b.",
|
||||
a_dot_b_dotdot[] = "a.b..",
|
||||
B_dot_A[] = "B.A",
|
||||
b_dot_a[] = "b.a",
|
||||
b_dot_a_dot[] = "b.a.",
|
||||
b_dot_a_dotdot[] = "b.a..";
|
||||
|
||||
ok( DnsNameCompare_A( NULL, NULL ) == TRUE, "failed unexpectedly\n" );
|
||||
|
||||
ok( DnsNameCompare_A( empty, empty ) == TRUE, "failed unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( dot, empty ) == TRUE, "failed unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( empty, dot ) == TRUE, "failed unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( dot, dotdot ) == TRUE, "failed unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( dotdot, dot ) == TRUE, "failed unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( a, a ) == TRUE, "failed unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( a, A ) == TRUE, "failed unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( A, a ) == TRUE, "failed unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( a_dot_b, A_dot_B ) == TRUE, "failed unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( a_dot_b, a_dot_b ) == TRUE, "failed unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( a_dot_b_dot, a_dot_b_dot ) == TRUE, "failed unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( a_dot_b_dotdot, a_dot_b_dotdot ) == TRUE, "failed unexpectedly\n" );
|
||||
|
||||
ok( DnsNameCompare_A( empty, NULL ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( NULL, empty ) == FALSE, "succeeded unexpectedly\n" );
|
||||
|
||||
ok( DnsNameCompare_A( a, b ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( a, B ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( A, b ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( a_dot_b, B_dot_A ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( a_dot_b_dot, b_dot_a_dot ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( a_dot_b, a_dot_a ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( a_dot_b_dotdot, b_dot_a_dotdot ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( a_dot_b_dot, b_dot_a_dotdot ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( a_dot_b_dotdot, b_dot_a_dot ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( a_dot_b_dot, b_dot_a ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( DnsNameCompare_A( a_dot_b, b_dot_a_dot ) == FALSE, "succeeded unexpectedly\n" );
|
||||
}
|
||||
|
||||
START_TEST(name)
|
||||
{
|
||||
test_DnsValidateName_A();
|
||||
test_DnsNameCompare_A();
|
||||
}
|
146
rostests/winetests/dnsapi/record.c
Normal file
146
rostests/winetests/dnsapi/record.c
Normal file
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* Tests for record handling functions
|
||||
*
|
||||
* Copyright 2006 Hans Leidekker
|
||||
*
|
||||
* 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 <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winnls.h"
|
||||
#include "windns.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static char name1[] = "localhost";
|
||||
static char name2[] = "LOCALHOST";
|
||||
|
||||
static DNS_RECORDA r1 = { NULL, name1, DNS_TYPE_A, sizeof(DNS_A_DATA), { 0 }, 1200, 0, { { 0xffffffff } } };
|
||||
static DNS_RECORDA r2 = { NULL, name1, DNS_TYPE_A, sizeof(DNS_A_DATA), { 0 }, 1200, 0, { { 0xffffffff } } };
|
||||
static DNS_RECORDA r3 = { NULL, name1, DNS_TYPE_A, sizeof(DNS_A_DATA), { 0 }, 1200, 0, { { 0xffffffff } } };
|
||||
|
||||
static void test_DnsRecordCompare( void )
|
||||
{
|
||||
ok( DnsRecordCompare( &r1, &r1 ) == TRUE, "failed unexpectedly\n" );
|
||||
|
||||
r2.pName = name2;
|
||||
ok( DnsRecordCompare( &r1, &r2 ) == TRUE, "failed unexpectedly\n" );
|
||||
|
||||
r2.Flags.S.CharSet = DnsCharSetUnicode;
|
||||
ok( DnsRecordCompare( &r1, &r2 ) == FALSE, "succeeded unexpectedly\n" );
|
||||
|
||||
r2.Flags.S.CharSet = DnsCharSetAnsi;
|
||||
ok( DnsRecordCompare( &r1, &r2 ) == FALSE, "succeeded unexpectedly\n" );
|
||||
|
||||
r1.Flags.S.CharSet = DnsCharSetAnsi;
|
||||
ok( DnsRecordCompare( &r1, &r2 ) == TRUE, "failed unexpectedly\n" );
|
||||
|
||||
r1.dwTtl = 0;
|
||||
ok( DnsRecordCompare( &r1, &r2 ) == TRUE, "failed unexpectedly\n" );
|
||||
|
||||
r2.Data.A.IpAddress = 0;
|
||||
ok( DnsRecordCompare( &r1, &r2 ) == FALSE, "succeeded unexpectedly\n" );
|
||||
}
|
||||
|
||||
static void test_DnsRecordSetCompare( void )
|
||||
{
|
||||
DNS_RECORD *diff1;
|
||||
DNS_RECORD *diff2;
|
||||
DNS_RRSET rr1, rr2;
|
||||
|
||||
r1.Flags.DW = 0x2019;
|
||||
r2.Flags.DW = 0x2019;
|
||||
r2.Data.A.IpAddress = 0xffffffff;
|
||||
|
||||
DNS_RRSET_INIT( rr1 );
|
||||
DNS_RRSET_INIT( rr2 );
|
||||
|
||||
DNS_RRSET_ADD( rr1, &r1 );
|
||||
DNS_RRSET_ADD( rr2, &r2 );
|
||||
|
||||
DNS_RRSET_TERMINATE( rr1 );
|
||||
DNS_RRSET_TERMINATE( rr2 );
|
||||
|
||||
ok( DnsRecordSetCompare( NULL, NULL, NULL, NULL ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( DnsRecordSetCompare( rr1.pFirstRR, NULL, NULL, NULL ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( DnsRecordSetCompare( NULL, rr2.pFirstRR, NULL, NULL ) == FALSE, "succeeded unexpectedly\n" );
|
||||
|
||||
diff1 = NULL;
|
||||
diff2 = NULL;
|
||||
|
||||
ok( DnsRecordSetCompare( NULL, NULL, &diff1, &diff2 ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( diff1 == NULL && diff2 == NULL, "unexpected result: %p, %p\n", diff1, diff2 );
|
||||
|
||||
ok( DnsRecordSetCompare( rr1.pFirstRR, NULL, &diff1, &diff2 ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( diff1 != NULL && diff2 == NULL, "unexpected result: %p, %p\n", diff1, diff2 );
|
||||
DnsRecordListFree( diff1, DnsFreeRecordList );
|
||||
|
||||
ok( DnsRecordSetCompare( NULL, rr2.pFirstRR, &diff1, &diff2 ) == FALSE, "succeeded unexpectedly\n" );
|
||||
ok( diff1 == NULL && diff2 != NULL, "unexpected result: %p, %p\n", diff1, diff2 );
|
||||
DnsRecordListFree( diff2, DnsFreeRecordList );
|
||||
|
||||
ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, NULL, &diff2 ) == TRUE, "failed unexpectedly\n" );
|
||||
ok( diff2 == NULL, "unexpected result: %p\n", diff2 );
|
||||
|
||||
ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, &diff1, NULL ) == TRUE, "failed unexpectedly\n" );
|
||||
ok( diff1 == NULL, "unexpected result: %p\n", diff1 );
|
||||
|
||||
ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, &diff1, &diff2 ) == TRUE, "failed unexpectedly\n" );
|
||||
ok( diff1 == NULL && diff2 == NULL, "unexpected result: %p, %p\n", diff1, diff2 );
|
||||
|
||||
r2.Data.A.IpAddress = 0;
|
||||
|
||||
ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, NULL, &diff2 ) == FALSE, "succeeded unexpectedly\n" );
|
||||
DnsRecordListFree( diff2, DnsFreeRecordList );
|
||||
|
||||
ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, &diff1, NULL ) == FALSE, "succeeded unexpectedly\n" );
|
||||
DnsRecordListFree( diff1, DnsFreeRecordList );
|
||||
|
||||
ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, &diff1, &diff2 ) == FALSE, "succeeded unexpectedly\n" );
|
||||
DnsRecordListFree( diff1, DnsFreeRecordList );
|
||||
DnsRecordListFree( diff2, DnsFreeRecordList );
|
||||
}
|
||||
|
||||
static void test_DnsRecordSetDetach( void )
|
||||
{
|
||||
DNS_RRSET rr;
|
||||
DNS_RECORDA *r, *s;
|
||||
|
||||
DNS_RRSET_INIT( rr );
|
||||
DNS_RRSET_ADD( rr, &r1 );
|
||||
DNS_RRSET_ADD( rr, &r2 );
|
||||
DNS_RRSET_ADD( rr, &r3 );
|
||||
DNS_RRSET_TERMINATE( rr );
|
||||
|
||||
ok( !DnsRecordSetDetach( NULL ), "succeeded unexpectedly\n" );
|
||||
|
||||
r = rr.pFirstRR;
|
||||
s = DnsRecordSetDetach( r );
|
||||
|
||||
ok( s == &r3, "failed unexpectedly: got %p, expected %p\n", s, &r3 );
|
||||
ok( r == &r1, "failed unexpectedly: got %p, expected %p\n", r, &r1 );
|
||||
ok( !r2.pNext, "failed unexpectedly\n" );
|
||||
}
|
||||
|
||||
START_TEST(record)
|
||||
{
|
||||
test_DnsRecordCompare();
|
||||
test_DnsRecordSetCompare();
|
||||
test_DnsRecordSetDetach();
|
||||
}
|
17
rostests/winetests/dnsapi/testlist.c
Normal file
17
rostests/winetests/dnsapi/testlist.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
/* Automatically generated file; DO NOT EDIT!! */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#define STANDALONE
|
||||
#include "wine/test.h"
|
||||
|
||||
extern void func_name(void);
|
||||
extern void func_record(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "name", func_name },
|
||||
{ "record", func_record },
|
||||
{ 0, 0 }
|
||||
};
|
1533
rostests/winetests/fusion/asmcache.c
Normal file
1533
rostests/winetests/fusion/asmcache.c
Normal file
File diff suppressed because it is too large
Load diff
662
rostests/winetests/fusion/asmenum.c
Normal file
662
rostests/winetests/fusion/asmenum.c
Normal file
|
@ -0,0 +1,662 @@
|
|||
/*
|
||||
* Copyright 2008 James Hawkins
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <shlwapi.h>
|
||||
#include <mscoree.h>
|
||||
#include <fusion.h>
|
||||
#include <corerror.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
static HRESULT (WINAPI *pCreateAssemblyEnum)(IAssemblyEnum **pEnum,
|
||||
IUnknown *pUnkReserved,
|
||||
IAssemblyName *pName,
|
||||
DWORD dwFlags, LPVOID pvReserved);
|
||||
static HRESULT (WINAPI *pCreateAssemblyNameObject)(LPASSEMBLYNAME *ppAssemblyNameObj,
|
||||
LPCWSTR szAssemblyName, DWORD dwFlags,
|
||||
LPVOID pvReserved);
|
||||
static HRESULT (WINAPI *pGetCachePath)(ASM_CACHE_FLAGS dwCacheFlags,
|
||||
LPWSTR pwzCachePath, PDWORD pcchPath);
|
||||
static HRESULT (WINAPI *pLoadLibraryShim)(LPCWSTR szDllName, LPCWSTR szVersion,
|
||||
LPVOID pvReserved, HMODULE *phModDll);
|
||||
|
||||
static BOOL init_functionpointers(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
HMODULE hfusion;
|
||||
HMODULE hmscoree;
|
||||
|
||||
static const WCHAR szFusion[] = {'f','u','s','i','o','n','.','d','l','l',0};
|
||||
|
||||
hmscoree = LoadLibraryA("mscoree.dll");
|
||||
if (!hmscoree)
|
||||
{
|
||||
win_skip("mscoree.dll not available\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pLoadLibraryShim = (void *)GetProcAddress(hmscoree, "LoadLibraryShim");
|
||||
if (!pLoadLibraryShim)
|
||||
{
|
||||
win_skip("LoadLibraryShim not available\n");
|
||||
FreeLibrary(hmscoree);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hr = pLoadLibraryShim(szFusion, NULL, NULL, &hfusion);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
win_skip("fusion.dll not available\n");
|
||||
FreeLibrary(hmscoree);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pCreateAssemblyEnum = (void *)GetProcAddress(hfusion, "CreateAssemblyEnum");
|
||||
pCreateAssemblyNameObject = (void *)GetProcAddress(hfusion, "CreateAssemblyNameObject");
|
||||
pGetCachePath = (void *)GetProcAddress(hfusion, "GetCachePath");
|
||||
|
||||
if (!pCreateAssemblyEnum ||
|
||||
!pCreateAssemblyNameObject || !pGetCachePath)
|
||||
{
|
||||
win_skip("fusion.dll not implemented\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
FreeLibrary(hmscoree);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static inline void to_widechar(LPWSTR dest, LPCSTR src)
|
||||
{
|
||||
MultiByteToWideChar(CP_ACP, 0, src, -1, dest, MAX_PATH);
|
||||
}
|
||||
|
||||
static inline void to_multibyte(LPSTR dest, LPWSTR src)
|
||||
{
|
||||
WideCharToMultiByte(CP_ACP, 0, src, -1, dest, MAX_PATH, NULL, NULL);
|
||||
}
|
||||
|
||||
static BOOL create_full_path(LPCSTR path)
|
||||
{
|
||||
LPSTR new_path;
|
||||
BOOL ret = TRUE;
|
||||
int len;
|
||||
|
||||
new_path = HeapAlloc(GetProcessHeap(), 0, lstrlenA(path) + 1);
|
||||
if (!new_path)
|
||||
return FALSE;
|
||||
|
||||
lstrcpyA(new_path, path);
|
||||
|
||||
while ((len = lstrlenA(new_path)) && new_path[len - 1] == '\\')
|
||||
new_path[len - 1] = 0;
|
||||
|
||||
while (!CreateDirectoryA(new_path, NULL))
|
||||
{
|
||||
LPSTR slash;
|
||||
DWORD last_error = GetLastError();
|
||||
|
||||
if(last_error == ERROR_ALREADY_EXISTS)
|
||||
break;
|
||||
|
||||
if(last_error != ERROR_PATH_NOT_FOUND)
|
||||
{
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!(slash = strrchr(new_path, '\\')))
|
||||
{
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
len = slash - new_path;
|
||||
new_path[len] = 0;
|
||||
if(!create_full_path(new_path))
|
||||
{
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
new_path[len] = '\\';
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, new_path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
|
||||
{
|
||||
HANDLE file;
|
||||
DWORD written;
|
||||
|
||||
file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||
ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
|
||||
WriteFile(file, data, strlen(data), &written, NULL);
|
||||
|
||||
if (size)
|
||||
{
|
||||
SetFilePointer(file, size, NULL, FILE_BEGIN);
|
||||
SetEndOfFile(file);
|
||||
}
|
||||
|
||||
CloseHandle(file);
|
||||
}
|
||||
|
||||
#define create_file(name, size) create_file_data(name, name, size)
|
||||
|
||||
static void test_CreateAssemblyEnum(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
WCHAR namestr[MAX_PATH];
|
||||
IAssemblyEnum *asmenum;
|
||||
IAssemblyName *asmname;
|
||||
|
||||
to_widechar(namestr, "wine");
|
||||
asmname = NULL;
|
||||
hr = pCreateAssemblyNameObject(&asmname, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(asmname != NULL, "Expected non-NULL asmname\n");
|
||||
|
||||
/* pEnum is NULL */
|
||||
if (0)
|
||||
{
|
||||
/* Crashes on .NET 1.x */
|
||||
hr = pCreateAssemblyEnum(NULL, NULL, asmname, ASM_CACHE_GAC, NULL);
|
||||
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
|
||||
}
|
||||
|
||||
/* pName is NULL */
|
||||
asmenum = NULL;
|
||||
hr = pCreateAssemblyEnum(&asmenum, NULL, NULL, ASM_CACHE_GAC, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(asmenum != NULL, "Expected non-NULL asmenum\n");
|
||||
|
||||
IAssemblyEnum_Release(asmenum);
|
||||
|
||||
/* dwFlags is ASM_CACHE_ROOT */
|
||||
asmenum = (IAssemblyEnum *)0xdeadbeef;
|
||||
hr = pCreateAssemblyEnum(&asmenum, NULL, NULL, ASM_CACHE_ROOT, NULL);
|
||||
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
|
||||
ok(asmenum == (IAssemblyEnum *)0xdeadbeef,
|
||||
"Expected asmenum to be unchanged, got %p\n", asmenum);
|
||||
|
||||
/* invalid dwFlags */
|
||||
asmenum = (IAssemblyEnum *)0xdeadbeef;
|
||||
hr = pCreateAssemblyEnum(&asmenum, NULL, NULL, 0, NULL);
|
||||
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
|
||||
ok(asmenum == (IAssemblyEnum *)0xdeadbeef,
|
||||
"Expected asmenum to be unchanged, got %p\n", asmenum);
|
||||
}
|
||||
|
||||
typedef struct _tagASMNAME
|
||||
{
|
||||
struct list entry;
|
||||
LPSTR data;
|
||||
} ASMNAME;
|
||||
|
||||
static BOOL enum_gac_assemblies(struct list *assemblies, int depth, LPSTR path)
|
||||
{
|
||||
WIN32_FIND_DATAA ffd;
|
||||
CHAR buf[MAX_PATH];
|
||||
CHAR disp[MAX_PATH];
|
||||
ASMNAME *name;
|
||||
HANDLE hfind;
|
||||
LPSTR ptr;
|
||||
|
||||
static CHAR parent[MAX_PATH];
|
||||
|
||||
sprintf(buf, "%s\\*", path);
|
||||
hfind = FindFirstFileA(buf, &ffd);
|
||||
if (hfind == INVALID_HANDLE_VALUE)
|
||||
return FALSE;
|
||||
|
||||
do
|
||||
{
|
||||
if (!lstrcmpA(ffd.cFileName, ".") || !lstrcmpA(ffd.cFileName, ".."))
|
||||
continue;
|
||||
|
||||
if (depth == 0)
|
||||
{
|
||||
sprintf(parent, "%s, ", ffd.cFileName);
|
||||
}
|
||||
else if (depth == 1)
|
||||
{
|
||||
char culture[MAX_PATH];
|
||||
|
||||
ptr = strstr(ffd.cFileName, "_");
|
||||
*ptr = '\0';
|
||||
ptr++;
|
||||
|
||||
if (*ptr != '_')
|
||||
{
|
||||
lstrcpyA(culture, ptr);
|
||||
*strstr(culture, "_") = '\0';
|
||||
}
|
||||
else
|
||||
lstrcpyA(culture, "neutral");
|
||||
|
||||
ptr = strchr(ptr, '_');
|
||||
ptr++;
|
||||
sprintf(buf, "Version=%s, Culture=%s, PublicKeyToken=%s",
|
||||
ffd.cFileName, culture, ptr);
|
||||
lstrcpyA(disp, parent);
|
||||
lstrcatA(disp, buf);
|
||||
|
||||
name = HeapAlloc(GetProcessHeap(), 0, sizeof(ASMNAME));
|
||||
name->data = HeapAlloc(GetProcessHeap(), 0, lstrlenA(disp) + 1);
|
||||
lstrcpyA(name->data, disp);
|
||||
list_add_tail(assemblies, &name->entry);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
sprintf(buf, "%s\\%s", path, ffd.cFileName);
|
||||
enum_gac_assemblies(assemblies, depth + 1, buf);
|
||||
} while (FindNextFileA(hfind, &ffd) != 0);
|
||||
|
||||
FindClose(hfind);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void test_enumerate(void)
|
||||
{
|
||||
struct list assemblies = LIST_INIT(assemblies);
|
||||
struct list *item, *cursor;
|
||||
IAssemblyEnum *asmenum;
|
||||
IAssemblyName *next;
|
||||
WCHAR buf[MAX_PATH];
|
||||
CHAR path[MAX_PATH];
|
||||
CHAR disp[MAX_PATH];
|
||||
HRESULT hr;
|
||||
BOOL found;
|
||||
DWORD size;
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = pGetCachePath(ASM_CACHE_GAC, buf, &size);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
|
||||
to_multibyte(path, buf);
|
||||
lstrcatA(path, "_32");
|
||||
enum_gac_assemblies(&assemblies, 0, path);
|
||||
|
||||
to_multibyte(path, buf);
|
||||
lstrcatA(path, "_64");
|
||||
enum_gac_assemblies(&assemblies, 0, path);
|
||||
|
||||
to_multibyte(path, buf);
|
||||
lstrcatA(path, "_MSIL");
|
||||
enum_gac_assemblies(&assemblies, 0, path);
|
||||
|
||||
to_multibyte(path, buf);
|
||||
enum_gac_assemblies(&assemblies, 0, path);
|
||||
|
||||
asmenum = NULL;
|
||||
hr = pCreateAssemblyEnum(&asmenum, NULL, NULL, ASM_CACHE_GAC, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(asmenum != NULL, "Expected non-NULL asmenum\n");
|
||||
|
||||
while (IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0) == S_OK)
|
||||
{
|
||||
size = MAX_PATH;
|
||||
IAssemblyName_GetDisplayName(next, buf, &size, 0);
|
||||
to_multibyte(disp, buf);
|
||||
|
||||
found = FALSE;
|
||||
LIST_FOR_EACH_SAFE(item, cursor, &assemblies)
|
||||
{
|
||||
ASMNAME *asmname = LIST_ENTRY(item, ASMNAME, entry);
|
||||
|
||||
if (!lstrcmpA(asmname->data, disp))
|
||||
{
|
||||
found = TRUE;
|
||||
|
||||
list_remove(&asmname->entry);
|
||||
HeapFree(GetProcessHeap(), 0, asmname->data);
|
||||
HeapFree(GetProcessHeap(), 0, asmname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ok(found, "Extra assembly enumerated: %s\n", disp);
|
||||
IAssemblyName_Release(next);
|
||||
}
|
||||
|
||||
/* enumeration is exhausted */
|
||||
next = (IAssemblyName *)0xdeadbeef;
|
||||
hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
|
||||
ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr);
|
||||
ok(next == (IAssemblyName *)0xdeadbeef,
|
||||
"Expected next to be unchanged, got %p\n", next);
|
||||
|
||||
LIST_FOR_EACH_SAFE(item, cursor, &assemblies)
|
||||
{
|
||||
ASMNAME *asmname = LIST_ENTRY(item, ASMNAME, entry);
|
||||
|
||||
ok(FALSE, "Assembly not enumerated: %s\n", asmname->data);
|
||||
|
||||
list_remove(&asmname->entry);
|
||||
HeapFree(GetProcessHeap(), 0, asmname->data);
|
||||
HeapFree(GetProcessHeap(), 0, asmname);
|
||||
}
|
||||
|
||||
IAssemblyEnum_Release(asmenum);
|
||||
}
|
||||
|
||||
static void test_enumerate_name(void)
|
||||
{
|
||||
IAssemblyEnum *asmenum;
|
||||
IAssemblyName *asmname, *next;
|
||||
WCHAR buf[MAX_PATH];
|
||||
CHAR gac[MAX_PATH];
|
||||
CHAR path[MAX_PATH];
|
||||
CHAR disp[MAX_PATH];
|
||||
WCHAR namestr[MAX_PATH];
|
||||
CHAR exp[6][MAX_PATH];
|
||||
HRESULT hr;
|
||||
DWORD size;
|
||||
|
||||
lstrcpyA(exp[0], "wine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=16a3fcd171e93a8d");
|
||||
lstrcpyA(exp[1], "wine, Version=1.0.1.2, Culture=neutral, PublicKeyToken=123456789abcdef0");
|
||||
lstrcpyA(exp[2], "wine, Version=1.0.1.2, Culture=neutral, PublicKeyToken=16a3fcd171e93a8d");
|
||||
lstrcpyA(exp[3], "Wine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=16a3fcd171e93a8d");
|
||||
lstrcpyA(exp[4], "Wine, Version=1.0.1.2, Culture=neutral, PublicKeyToken=123456789abcdef0");
|
||||
lstrcpyA(exp[5], "Wine, Version=1.0.1.2, Culture=neutral, PublicKeyToken=16a3fcd171e93a8d");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = pGetCachePath(ASM_CACHE_GAC, buf, &size);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
|
||||
to_multibyte(gac, buf);
|
||||
create_full_path(gac);
|
||||
|
||||
sprintf(path, "%s\\Wine", gac);
|
||||
CreateDirectoryA(path, NULL);
|
||||
|
||||
sprintf(path, "%s\\Wine\\1.0.0.0__16a3fcd171e93a8d", gac);
|
||||
CreateDirectoryA(path, NULL);
|
||||
|
||||
lstrcatA(path, "\\Wine.dll");
|
||||
create_file(path, 100);
|
||||
|
||||
sprintf(path, "%s\\Wine\\1.0.1.2__16a3fcd171e93a8d", gac);
|
||||
CreateDirectoryA(path, NULL);
|
||||
|
||||
lstrcatA(path, "\\Wine.dll");
|
||||
create_file(path, 100);
|
||||
|
||||
sprintf(path, "%s\\Wine\\1.0.1.2__123456789abcdef0", gac);
|
||||
CreateDirectoryA(path, NULL);
|
||||
|
||||
lstrcatA(path, "\\Wine.dll");
|
||||
create_file(path, 100);
|
||||
|
||||
/* test case sensitivity */
|
||||
to_widechar(namestr, "wine");
|
||||
asmname = NULL;
|
||||
hr = pCreateAssemblyNameObject(&asmname, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(asmname != NULL, "Expected non-NULL asmname\n");
|
||||
|
||||
asmenum = NULL;
|
||||
hr = pCreateAssemblyEnum(&asmenum, NULL, asmname, ASM_CACHE_GAC, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(asmenum != NULL, "Expected non-NULL asmenum\n");
|
||||
|
||||
next = NULL;
|
||||
hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(next != NULL, "Expected non-NULL next\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
|
||||
to_multibyte(disp, buf);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(!lstrcmpA(disp, exp[0]) ||
|
||||
!lstrcmpA(disp, exp[1]),
|
||||
"Expected \"%s\" or \"%s\", got \"%s\"\n", exp[0], exp[1], disp);
|
||||
|
||||
IAssemblyName_Release(next);
|
||||
|
||||
next = NULL;
|
||||
hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(next != NULL, "Expected non-NULL next\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
|
||||
to_multibyte(disp, buf);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(!lstrcmpA(disp, exp[1]) ||
|
||||
!lstrcmpA(disp, exp[2]),
|
||||
"Expected \"%s\" or \"%s\", got \"%s\"\n", exp[1], exp[2], disp);
|
||||
|
||||
IAssemblyName_Release(next);
|
||||
|
||||
next = NULL;
|
||||
hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(next != NULL, "Expected non-NULL next\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
|
||||
to_multibyte(disp, buf);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(!lstrcmpA(disp, exp[2]), "Expected \"%s\", got \"%s\"\n", exp[2], disp);
|
||||
|
||||
IAssemblyName_Release(next);
|
||||
|
||||
next = (IAssemblyName *)0xdeadbeef;
|
||||
hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
|
||||
ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr);
|
||||
ok(next == (IAssemblyName *)0xdeadbeef,
|
||||
"Expected next to be unchanged, got %p\n", next);
|
||||
|
||||
IAssemblyEnum_Release(asmenum);
|
||||
IAssemblyName_Release(asmname);
|
||||
|
||||
/* only Version */
|
||||
to_widechar(namestr, "Wine, Version=1.0.1.2");
|
||||
asmname = NULL;
|
||||
hr = pCreateAssemblyNameObject(&asmname, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(asmname != NULL, "Expected non-NULL asmname\n");
|
||||
|
||||
asmenum = NULL;
|
||||
hr = pCreateAssemblyEnum(&asmenum, NULL, asmname, ASM_CACHE_GAC, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(asmenum != NULL, "Expected non-NULL asmenum\n");
|
||||
|
||||
next = NULL;
|
||||
hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(next != NULL, "Expected non-NULL next\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
|
||||
to_multibyte(disp, buf);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(!lstrcmpA(disp, exp[4]), "Expected \"%s\", got \"%s\"\n", exp[4], disp);
|
||||
|
||||
IAssemblyName_Release(next);
|
||||
|
||||
next = NULL;
|
||||
hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(next != NULL, "Expected non-NULL next\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
|
||||
to_multibyte(disp, buf);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(!lstrcmpA(disp, exp[5]), "Expected \"%s\", got \"%s\"\n", exp[5], disp);
|
||||
|
||||
IAssemblyName_Release(next);
|
||||
|
||||
next = (IAssemblyName *)0xdeadbeef;
|
||||
hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
|
||||
ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr);
|
||||
ok(next == (IAssemblyName *)0xdeadbeef,
|
||||
"Expected next to be unchanged, got %p\n", next);
|
||||
|
||||
IAssemblyEnum_Release(asmenum);
|
||||
IAssemblyName_Release(asmname);
|
||||
|
||||
/* only PublicKeyToken */
|
||||
to_widechar(namestr, "Wine, PublicKeyToken=16a3fcd171e93a8d");
|
||||
asmname = NULL;
|
||||
hr = pCreateAssemblyNameObject(&asmname, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(asmname != NULL, "Expected non-NULL asmname\n");
|
||||
|
||||
asmenum = NULL;
|
||||
hr = pCreateAssemblyEnum(&asmenum, NULL, asmname, ASM_CACHE_GAC, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(asmenum != NULL, "Expected non-NULL asmenum\n");
|
||||
|
||||
next = NULL;
|
||||
hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(next != NULL, "Expected non-NULL next\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
|
||||
to_multibyte(disp, buf);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(!lstrcmpA(disp, exp[3]), "Expected \"%s\", got \"%s\"\n", exp[3], disp);
|
||||
|
||||
IAssemblyName_Release(next);
|
||||
|
||||
next = NULL;
|
||||
hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(next != NULL, "Expected non-NULL next\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
|
||||
to_multibyte(disp, buf);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(!lstrcmpA(disp, exp[5]), "Expected \"%s\", got \"%s\"\n", exp[5], disp);
|
||||
|
||||
IAssemblyName_Release(next);
|
||||
|
||||
next = (IAssemblyName *)0xdeadbeef;
|
||||
hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
|
||||
ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr);
|
||||
ok(next == (IAssemblyName *)0xdeadbeef,
|
||||
"Expected next to be unchanged, got %p\n", next);
|
||||
|
||||
IAssemblyEnum_Release(asmenum);
|
||||
IAssemblyName_Release(asmname);
|
||||
|
||||
/* only Culture */
|
||||
to_widechar(namestr, "wine, Culture=neutral");
|
||||
asmname = NULL;
|
||||
hr = pCreateAssemblyNameObject(&asmname, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(asmname != NULL, "Expected non-NULL asmname\n");
|
||||
|
||||
asmenum = NULL;
|
||||
hr = pCreateAssemblyEnum(&asmenum, NULL, asmname, ASM_CACHE_GAC, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(asmenum != NULL, "Expected non-NULL asmenum\n");
|
||||
|
||||
next = NULL;
|
||||
hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(next != NULL, "Expected non-NULL next\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
|
||||
to_multibyte(disp, buf);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(!lstrcmpA(disp, exp[0]), "Expected \"%s\", got \"%s\"\n", exp[0], disp);
|
||||
|
||||
IAssemblyName_Release(next);
|
||||
|
||||
next = NULL;
|
||||
hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(next != NULL, "Expected non-NULL next\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
|
||||
to_multibyte(disp, buf);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(!lstrcmpA(disp, exp[1]) ||
|
||||
!lstrcmpA(disp, exp[2]),
|
||||
"Expected \"%s\" or \"%s\", got \"%s\"\n", exp[1], exp[2], disp);
|
||||
|
||||
IAssemblyName_Release(next);
|
||||
|
||||
next = NULL;
|
||||
hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(next != NULL, "Expected non-NULL next\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(next, buf, &size, 0);
|
||||
to_multibyte(disp, buf);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(!lstrcmpA(disp, exp[1]) ||
|
||||
!lstrcmpA(disp, exp[2]),
|
||||
"Expected \"%s\" or \"%s\", got \"%s\"\n", exp[1], exp[2], disp);
|
||||
|
||||
IAssemblyName_Release(next);
|
||||
|
||||
next = (IAssemblyName *)0xdeadbeef;
|
||||
hr = IAssemblyEnum_GetNextAssembly(asmenum, NULL, &next, 0);
|
||||
ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr);
|
||||
ok(next == (IAssemblyName *)0xdeadbeef,
|
||||
"Expected next to be unchanged, got %p\n", next);
|
||||
|
||||
IAssemblyEnum_Release(asmenum);
|
||||
IAssemblyName_Release(asmname);
|
||||
|
||||
sprintf(path, "%s\\Wine\\1.0.0.0__16a3fcd171e93a8d\\Wine.dll", gac);
|
||||
DeleteFileA(path);
|
||||
sprintf(path, "%s\\Wine\\1.0.1.2__16a3fcd171e93a8d\\Wine.dll", gac);
|
||||
DeleteFileA(path);
|
||||
sprintf(path, "%s\\Wine\\1.0.1.2__123456789abcdef0\\Wine.dll", gac);
|
||||
DeleteFileA(path);
|
||||
sprintf(path, "%s\\Wine\\1.0.0.0__16a3fcd171e93a8d", gac);
|
||||
RemoveDirectoryA(path);
|
||||
sprintf(path, "%s\\Wine\\1.0.1.2__16a3fcd171e93a8d", gac);
|
||||
RemoveDirectoryA(path);
|
||||
sprintf(path, "%s\\Wine\\1.0.1.2__123456789abcdef0", gac);
|
||||
RemoveDirectoryA(path);
|
||||
sprintf(path, "%s\\Wine", gac);
|
||||
RemoveDirectoryA(path);
|
||||
}
|
||||
|
||||
START_TEST(asmenum)
|
||||
{
|
||||
if (!init_functionpointers())
|
||||
return;
|
||||
|
||||
test_CreateAssemblyEnum();
|
||||
test_enumerate();
|
||||
test_enumerate_name();
|
||||
}
|
785
rostests/winetests/fusion/asmname.c
Normal file
785
rostests/winetests/fusion/asmname.c
Normal file
|
@ -0,0 +1,785 @@
|
|||
/*
|
||||
* Copyright 2008 James Hawkins
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <mscoree.h>
|
||||
#include <fusion.h>
|
||||
#include <corerror.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
/* ok-like statement which takes two unicode strings or one unicode and one ANSI string as arguments */
|
||||
static CHAR string1[MAX_PATH];
|
||||
|
||||
#define ok_aw(aString, wString) \
|
||||
WideCharToMultiByte(CP_ACP, 0, wString, -1, string1, MAX_PATH, NULL, NULL); \
|
||||
if (lstrcmpA(string1, aString) != 0) \
|
||||
ok(0, "Expected \"%s\", got \"%s\"\n", aString, string1);
|
||||
|
||||
static HRESULT (WINAPI *pCreateAssemblyNameObject)(LPASSEMBLYNAME *ppAssemblyNameObj,
|
||||
LPCWSTR szAssemblyName, DWORD dwFlags,
|
||||
LPVOID pvReserved);
|
||||
static HRESULT (WINAPI *pLoadLibraryShim)(LPCWSTR szDllName, LPCWSTR szVersion,
|
||||
LPVOID pvReserved, HMODULE *phModDll);
|
||||
|
||||
static BOOL init_functionpointers(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
HMODULE hfusion;
|
||||
HMODULE hmscoree;
|
||||
|
||||
static const WCHAR szFusion[] = {'f','u','s','i','o','n','.','d','l','l',0};
|
||||
|
||||
hmscoree = LoadLibraryA("mscoree.dll");
|
||||
if (!hmscoree)
|
||||
return FALSE;
|
||||
|
||||
pLoadLibraryShim = (void *)GetProcAddress(hmscoree, "LoadLibraryShim");
|
||||
if (!pLoadLibraryShim)
|
||||
{
|
||||
FreeLibrary(hmscoree);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hr = pLoadLibraryShim(szFusion, NULL, NULL, &hfusion);
|
||||
if (FAILED(hr))
|
||||
return FALSE;
|
||||
|
||||
pCreateAssemblyNameObject = (void *)GetProcAddress(hfusion, "CreateAssemblyNameObject");
|
||||
if (!pCreateAssemblyNameObject)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
typedef struct _tagASMPROP_RES
|
||||
{
|
||||
HRESULT hr;
|
||||
CHAR val[MAX_PATH];
|
||||
DWORD size;
|
||||
} ASMPROP_RES;
|
||||
|
||||
static const ASMPROP_RES defaults[ASM_NAME_MAX_PARAMS] =
|
||||
{
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_FALSE, "", MAX_PATH},
|
||||
{S_FALSE, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0}
|
||||
};
|
||||
|
||||
static const ASMPROP_RES emptyname[ASM_NAME_MAX_PARAMS] =
|
||||
{
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 2},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_FALSE, "", MAX_PATH},
|
||||
{S_FALSE, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0}
|
||||
};
|
||||
|
||||
static const ASMPROP_RES winename[ASM_NAME_MAX_PARAMS] =
|
||||
{
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "wine", 10},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_FALSE, "", MAX_PATH},
|
||||
{S_FALSE, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0}
|
||||
};
|
||||
|
||||
static const ASMPROP_RES vername[ASM_NAME_MAX_PARAMS] =
|
||||
{
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "wine", 10},
|
||||
{S_OK, "\x01", 2},
|
||||
{S_OK, "\x02", 2},
|
||||
{S_OK, "\x03", 2},
|
||||
{S_OK, "\x04", 2},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_FALSE, "", MAX_PATH},
|
||||
{S_FALSE, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0}
|
||||
};
|
||||
|
||||
static const ASMPROP_RES badvername[ASM_NAME_MAX_PARAMS] =
|
||||
{
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "wine", 10},
|
||||
{S_OK, "\x01", 2},
|
||||
{S_OK, "\x05", 2},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_FALSE, "", MAX_PATH},
|
||||
{S_FALSE, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0}
|
||||
};
|
||||
|
||||
static const ASMPROP_RES neutralname[ASM_NAME_MAX_PARAMS] =
|
||||
{
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "wine", 10},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 2},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_FALSE, "", MAX_PATH},
|
||||
{S_FALSE, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0}
|
||||
};
|
||||
|
||||
static const ASMPROP_RES enname[ASM_NAME_MAX_PARAMS] =
|
||||
{
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "wine", 10},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "en", 6},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_FALSE, "", MAX_PATH},
|
||||
{S_FALSE, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0}
|
||||
};
|
||||
|
||||
static const ASMPROP_RES pubkeyname[ASM_NAME_MAX_PARAMS] =
|
||||
{
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "\x12\x34\x56\x78\x90\xab\xcd\xef", 8},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "wine", 10},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", MAX_PATH},
|
||||
{S_OK, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", MAX_PATH},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0},
|
||||
{S_OK, "", 0}
|
||||
};
|
||||
|
||||
static inline void to_widechar(LPWSTR dest, LPCSTR src)
|
||||
{
|
||||
MultiByteToWideChar(CP_ACP, 0, src, -1, dest, MAX_PATH);
|
||||
}
|
||||
|
||||
static inline void to_multibyte(LPSTR dest, LPWSTR src)
|
||||
{
|
||||
WideCharToMultiByte(CP_ACP, 0, src, -1, dest, MAX_PATH, NULL, NULL);
|
||||
}
|
||||
|
||||
static void test_assembly_name_props_line(IAssemblyName *name,
|
||||
const ASMPROP_RES *vals, int line)
|
||||
{
|
||||
HRESULT hr;
|
||||
DWORD i, size;
|
||||
WCHAR expect[MAX_PATH];
|
||||
WCHAR str[MAX_PATH];
|
||||
CHAR val[MAX_PATH];
|
||||
|
||||
for (i = 0; i < ASM_NAME_MAX_PARAMS; i++)
|
||||
{
|
||||
to_widechar(expect, vals[i].val);
|
||||
|
||||
size = MAX_PATH;
|
||||
ZeroMemory(str, MAX_PATH);
|
||||
hr = IAssemblyName_GetProperty(name, i, str, &size);
|
||||
to_multibyte(val, str);
|
||||
|
||||
ok(hr == vals[i].hr ||
|
||||
broken(i >= ASM_NAME_CONFIG_MASK && hr == E_INVALIDARG) || /* .NET 1.1 */
|
||||
broken(i >= ASM_NAME_FILE_MAJOR_VERSION && hr == E_INVALIDARG), /* .NET 1.0 */
|
||||
"%d: prop %d: Expected %08x, got %08x\n", line, i, vals[i].hr, hr);
|
||||
if (hr != E_INVALIDARG)
|
||||
{
|
||||
if (i == ASM_NAME_PUBLIC_KEY_TOKEN)
|
||||
ok(!memcmp(vals[i].val, str, size), "Expected a correct ASM_NAME_PUBLIC_KEY_TOKEN\n");
|
||||
else
|
||||
ok(!lstrcmpA(vals[i].val, val), "%d: prop %d: Expected \"%s\", got \"%s\"\n", line, i, vals[i].val, val);
|
||||
ok(size == vals[i].size, "%d: prop %d: Expected %d, got %d\n", line, i, vals[i].size, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define test_assembly_name_props(name, vals) \
|
||||
test_assembly_name_props_line(name, vals, __LINE__);
|
||||
|
||||
static void test_CreateAssemblyNameObject(void)
|
||||
{
|
||||
IAssemblyName *name;
|
||||
WCHAR str[MAX_PATH];
|
||||
WCHAR namestr[MAX_PATH];
|
||||
DWORD size, hi, lo;
|
||||
HRESULT hr;
|
||||
|
||||
static const WCHAR empty[] = {0};
|
||||
|
||||
/* NULL ppAssemblyNameObj */
|
||||
to_widechar(namestr, "wine.dll");
|
||||
hr = pCreateAssemblyNameObject(NULL, namestr, 0, NULL);
|
||||
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
|
||||
|
||||
/* NULL szAssemblyName, CANOF_PARSE_DISPLAY_NAME */
|
||||
name = (IAssemblyName *)0xdeadbeef;
|
||||
hr = pCreateAssemblyNameObject(&name, NULL, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
|
||||
ok(name == (IAssemblyName *)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", name);
|
||||
|
||||
/* empty szAssemblyName, CANOF_PARSE_DISPLAY_NAME */
|
||||
name = (IAssemblyName *)0xdeadbeef;
|
||||
hr = pCreateAssemblyNameObject(&name, empty, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
|
||||
ok(name == (IAssemblyName *)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", name);
|
||||
|
||||
/* check the contents of the AssemblyName for default values */
|
||||
|
||||
/* NULL szAssemblyName */
|
||||
name = NULL;
|
||||
hr = pCreateAssemblyNameObject(&name, NULL, CANOF_SET_DEFAULT_VALUES, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(name != NULL, "Expected non-NULL name\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(name, str, &size, ASM_DISPLAYF_FULL);
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
|
||||
size = MAX_PATH;
|
||||
str[0] = '\0';
|
||||
hr = IAssemblyName_GetName(name, &size, str);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(lstrlenW(str) == 0, "Expected empty name\n");
|
||||
ok(size == 0, "Expected 0, got %d\n", size);
|
||||
|
||||
hi = 0xbeefcace;
|
||||
lo = 0xcafebabe;
|
||||
hr = IAssemblyName_GetVersion(name, &hi, &lo);
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
ok(hi == 0, "Expected 0, got %08x\n", hi);
|
||||
ok(lo == 0, "Expected 0, got %08x\n", lo);
|
||||
|
||||
test_assembly_name_props(name, defaults);
|
||||
|
||||
IAssemblyName_Release(name);
|
||||
|
||||
/* empty szAssemblyName */
|
||||
name = NULL;
|
||||
hr = pCreateAssemblyNameObject(&name, empty, CANOF_SET_DEFAULT_VALUES, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(name != NULL, "Expected non-NULL name\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(name, str, &size, ASM_DISPLAYF_FULL);
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
|
||||
size = MAX_PATH;
|
||||
str[0] = '\0';
|
||||
hr = IAssemblyName_GetName(name, &size, str);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(lstrlenW(str) == 0, "Expected empty name\n");
|
||||
ok(size == 1, "Expected 1, got %d\n", size);
|
||||
|
||||
hi = 0xbeefcace;
|
||||
lo = 0xcafebabe;
|
||||
hr = IAssemblyName_GetVersion(name, &hi, &lo);
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
ok(hi == 0, "Expected 0, got %08x\n", hi);
|
||||
ok(lo == 0, "Expected 0, got %08x\n", lo);
|
||||
|
||||
test_assembly_name_props(name, emptyname);
|
||||
|
||||
IAssemblyName_Release(name);
|
||||
|
||||
/* 'wine' */
|
||||
to_widechar(namestr, "wine");
|
||||
name = NULL;
|
||||
hr = pCreateAssemblyNameObject(&name, namestr, CANOF_SET_DEFAULT_VALUES, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(name != NULL, "Expected non-NULL name\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(name, str, &size, ASM_DISPLAYF_FULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_aw("wine", str);
|
||||
ok(size == 5, "Expected 5, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
str[0] = '\0';
|
||||
hr = IAssemblyName_GetName(name, &size, str);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_aw("wine", str);
|
||||
ok(size == 5, "Expected 5, got %d\n", size);
|
||||
|
||||
hi = 0xbeefcace;
|
||||
lo = 0xcafebabe;
|
||||
hr = IAssemblyName_GetVersion(name, &hi, &lo);
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
ok(hi == 0, "Expected 0, got %08x\n", hi);
|
||||
ok(lo == 0, "Expected 0, got %08x\n", lo);
|
||||
|
||||
test_assembly_name_props(name, winename);
|
||||
|
||||
IAssemblyName_Release(name);
|
||||
|
||||
/* check the contents of the AssemblyName with parsing */
|
||||
|
||||
/* 'wine' */
|
||||
to_widechar(namestr, "wine");
|
||||
name = NULL;
|
||||
hr = pCreateAssemblyNameObject(&name, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(name != NULL, "Expected non-NULL name\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(name, str, &size, ASM_DISPLAYF_FULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_aw("wine", str);
|
||||
ok(size == 5, "Expected 5, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
str[0] = '\0';
|
||||
hr = IAssemblyName_GetName(name, &size, str);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_aw("wine", str);
|
||||
ok(size == 5, "Expected 5, got %d\n", size);
|
||||
|
||||
hi = 0xbeefcace;
|
||||
lo = 0xcafebabe;
|
||||
hr = IAssemblyName_GetVersion(name, &hi, &lo);
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
ok(hi == 0, "Expected 0, got %08x\n", hi);
|
||||
ok(lo == 0, "Expected 0, got %08x\n", lo);
|
||||
|
||||
test_assembly_name_props(name, winename);
|
||||
|
||||
IAssemblyName_Release(name);
|
||||
|
||||
/* 'wine, Version=1.2.3.4' */
|
||||
to_widechar(namestr, "wine, Version=1.2.3.4");
|
||||
name = NULL;
|
||||
hr = pCreateAssemblyNameObject(&name, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(name != NULL, "Expected non-NULL name\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(name, str, &size, ASM_DISPLAYF_FULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_aw("wine, Version=1.2.3.4", str);
|
||||
ok(size == 22, "Expected 22, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
str[0] = '\0';
|
||||
hr = IAssemblyName_GetName(name, &size, str);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_aw("wine", str);
|
||||
ok(size == 5, "Expected 5, got %d\n", size);
|
||||
|
||||
hi = 0xbeefcace;
|
||||
lo = 0xcafebabe;
|
||||
hr = IAssemblyName_GetVersion(name, &hi, &lo);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(hi == 0x00010002, "Expected 0x00010002, got %08x\n", hi);
|
||||
ok(lo == 0x00030004, "Expected 0x00030004, got %08x\n", lo);
|
||||
|
||||
test_assembly_name_props(name, vername);
|
||||
|
||||
IAssemblyName_Release(name);
|
||||
|
||||
/* Version isn't of the form 1.x.x.x */
|
||||
to_widechar(namestr, "wine, Version=1.5");
|
||||
name = NULL;
|
||||
hr = pCreateAssemblyNameObject(&name, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(name != NULL, "Expected non-NULL name\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(name, str, &size, ASM_DISPLAYF_FULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_aw("wine, Version=1.5", str);
|
||||
ok(size == 18, "Expected 18, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
str[0] = '\0';
|
||||
hr = IAssemblyName_GetName(name, &size, str);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_aw("wine", str);
|
||||
ok(size == 5, "Expected 5, got %d\n", size);
|
||||
|
||||
hi = 0xbeefcace;
|
||||
lo = 0xcafebabe;
|
||||
hr = IAssemblyName_GetVersion(name, &hi, &lo);
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
ok(hi == 0, "Expected 0, got %08x\n", hi);
|
||||
ok(lo == 0, "Expected 0, got %08x\n", lo);
|
||||
|
||||
test_assembly_name_props(name, badvername);
|
||||
|
||||
IAssemblyName_Release(name);
|
||||
|
||||
/* 'wine, Culture=neutral' */
|
||||
to_widechar(namestr, "wine, Culture=neutral");
|
||||
name = NULL;
|
||||
hr = pCreateAssemblyNameObject(&name, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(name != NULL, "Expected non-NULL name\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(name, str, &size, ASM_DISPLAYF_FULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_aw("wine, Culture=neutral", str);
|
||||
ok(size == 22, "Expected 22, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
str[0] = '\0';
|
||||
hr = IAssemblyName_GetName(name, &size, str);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_aw("wine", str);
|
||||
ok(size == 5, "Expected 5, got %d\n", size);
|
||||
|
||||
hi = 0xbeefcace;
|
||||
lo = 0xcafebabe;
|
||||
hr = IAssemblyName_GetVersion(name, &hi, &lo);
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
ok(hi == 0, "Expected 0, got %08x\n", hi);
|
||||
ok(lo == 0, "Expected 0, got %08x\n", lo);
|
||||
|
||||
test_assembly_name_props(name, neutralname);
|
||||
|
||||
IAssemblyName_Release(name);
|
||||
|
||||
/* 'wine, Culture=en' */
|
||||
to_widechar(namestr, "wine, Culture=en");
|
||||
name = NULL;
|
||||
hr = pCreateAssemblyNameObject(&name, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(name != NULL, "Expected non-NULL name\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(name, str, &size, ASM_DISPLAYF_FULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_aw("wine, Culture=en", str);
|
||||
ok(size == 17, "Expected 17, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
str[0] = '\0';
|
||||
hr = IAssemblyName_GetName(name, &size, str);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_aw("wine", str);
|
||||
ok(size == 5, "Expected 5, got %d\n", size);
|
||||
|
||||
hi = 0xbeefcace;
|
||||
lo = 0xcafebabe;
|
||||
hr = IAssemblyName_GetVersion(name, &hi, &lo);
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
ok(hi == 0, "Expected 0, got %08x\n", hi);
|
||||
ok(lo == 0, "Expected 0, got %08x\n", lo);
|
||||
|
||||
test_assembly_name_props(name, enname);
|
||||
|
||||
IAssemblyName_Release(name);
|
||||
|
||||
/* 'wine, PublicKeyToken=1234567890abcdef' */
|
||||
to_widechar(namestr, "wine, PublicKeyToken=1234567890abcdef");
|
||||
name = NULL;
|
||||
hr = pCreateAssemblyNameObject(&name, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(name != NULL, "Expected non-NULL name\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(name, str, &size, ASM_DISPLAYF_FULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_aw("wine, PublicKeyToken=1234567890abcdef", str);
|
||||
ok(size == 38, "Expected 38, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
str[0] = '\0';
|
||||
hr = IAssemblyName_GetName(name, &size, str);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_aw("wine", str);
|
||||
ok(size == 5, "Expected 5, got %d\n", size);
|
||||
|
||||
hi = 0xbeefcace;
|
||||
lo = 0xcafebabe;
|
||||
hr = IAssemblyName_GetVersion(name, &hi, &lo);
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
ok(hi == 0, "Expected 0, got %08x\n", hi);
|
||||
ok(lo == 0, "Expected 0, got %08x\n", lo);
|
||||
|
||||
test_assembly_name_props(name, pubkeyname);
|
||||
|
||||
IAssemblyName_Release(name);
|
||||
|
||||
/* PublicKeyToken is not 16 chars long */
|
||||
to_widechar(namestr, "wine, PublicKeyToken=567890abcdef");
|
||||
name = (IAssemblyName *)0xdeadbeef;
|
||||
hr = pCreateAssemblyNameObject(&name, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
ok(name == (IAssemblyName *)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", name);
|
||||
|
||||
/* PublicKeyToken contains invalid chars */
|
||||
to_widechar(namestr, "wine, PublicKeyToken=1234567890ghijkl");
|
||||
name = (IAssemblyName *)0xdeadbeef;
|
||||
hr = pCreateAssemblyNameObject(&name, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
ok(name == (IAssemblyName *)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", name);
|
||||
|
||||
/* no comma separator */
|
||||
to_widechar(namestr, "wine PublicKeyToken=1234567890abcdef");
|
||||
name = (IAssemblyName *)0xdeadbeef;
|
||||
hr = pCreateAssemblyNameObject(&name, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
todo_wine
|
||||
{
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
ok(name == (IAssemblyName *)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", name);
|
||||
}
|
||||
|
||||
/* no '=' */
|
||||
to_widechar(namestr, "wine, PublicKeyToken");
|
||||
name = (IAssemblyName *)0xdeadbeef;
|
||||
hr = pCreateAssemblyNameObject(&name, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
ok(name == (IAssemblyName *)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", name);
|
||||
|
||||
/* no value */
|
||||
to_widechar(namestr, "wine, PublicKeyToken=");
|
||||
name = (IAssemblyName *)0xdeadbeef;
|
||||
hr = pCreateAssemblyNameObject(&name, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
ok(name == (IAssemblyName *)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", name);
|
||||
|
||||
/* invalid property */
|
||||
to_widechar(namestr, "wine, BadProp=42");
|
||||
name = NULL;
|
||||
hr = pCreateAssemblyNameObject(&name, namestr, CANOF_PARSE_DISPLAY_NAME, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(name != NULL, "Expected non-NULL name\n");
|
||||
|
||||
size = MAX_PATH;
|
||||
hr = IAssemblyName_GetDisplayName(name, str, &size, ASM_DISPLAYF_FULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
todo_wine
|
||||
{
|
||||
ok_aw("wine", str);
|
||||
ok(size == 5, "Expected 5, got %d\n", size);
|
||||
}
|
||||
|
||||
size = MAX_PATH;
|
||||
str[0] = '\0';
|
||||
hr = IAssemblyName_GetName(name, &size, str);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_aw("wine", str);
|
||||
ok(size == 5, "Expected 5, got %d\n", size);
|
||||
|
||||
hi = 0xbeefcace;
|
||||
lo = 0xcafebabe;
|
||||
hr = IAssemblyName_GetVersion(name, &hi, &lo);
|
||||
ok(hr == FUSION_E_INVALID_NAME,
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
ok(hi == 0, "Expected 0, got %08x\n", hi);
|
||||
ok(lo == 0, "Expected 0, got %08x\n", lo);
|
||||
|
||||
test_assembly_name_props(name, winename);
|
||||
|
||||
IAssemblyName_Release(name);
|
||||
}
|
||||
|
||||
START_TEST(asmname)
|
||||
{
|
||||
if (!init_functionpointers())
|
||||
{
|
||||
win_skip("fusion.dll not available\n");
|
||||
return;
|
||||
}
|
||||
|
||||
test_CreateAssemblyNameObject();
|
||||
}
|
213
rostests/winetests/fusion/fusion.c
Normal file
213
rostests/winetests/fusion/fusion.c
Normal file
|
@ -0,0 +1,213 @@
|
|||
/*
|
||||
* Copyright 2008 James Hawkins
|
||||
*
|
||||
* 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 <windows.h>
|
||||
#include <fusion.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static HMODULE hmscoree;
|
||||
|
||||
static HRESULT (WINAPI *pGetCachePath)(ASM_CACHE_FLAGS dwCacheFlags,
|
||||
LPWSTR pwzCachePath, PDWORD pcchPath);
|
||||
static HRESULT (WINAPI *pLoadLibraryShim)(LPCWSTR szDllName, LPCWSTR szVersion,
|
||||
LPVOID pvReserved, HMODULE *phModDll);
|
||||
static HRESULT (WINAPI *pGetCORVersion)(LPWSTR pbuffer, DWORD cchBuffer,
|
||||
DWORD *dwLength);
|
||||
|
||||
static CHAR string1[MAX_PATH], string2[MAX_PATH];
|
||||
|
||||
#define ok_w2(format, szString1, szString2) \
|
||||
\
|
||||
WideCharToMultiByte(CP_ACP, 0, szString1, -1, string1, MAX_PATH, NULL, NULL); \
|
||||
WideCharToMultiByte(CP_ACP, 0, szString2, -1, string2, MAX_PATH, NULL, NULL); \
|
||||
ok(!lstrcmpA(string1, string2), format, string1, string2)
|
||||
|
||||
static BOOL init_functionpointers(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
HMODULE hfusion;
|
||||
|
||||
static const WCHAR szFusion[] = {'f','u','s','i','o','n','.','d','l','l',0};
|
||||
|
||||
hmscoree = LoadLibraryA("mscoree.dll");
|
||||
if (!hmscoree)
|
||||
{
|
||||
win_skip("mscoree.dll not available\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pLoadLibraryShim = (void *)GetProcAddress(hmscoree, "LoadLibraryShim");
|
||||
if (!pLoadLibraryShim)
|
||||
{
|
||||
win_skip("LoadLibraryShim not available\n");
|
||||
FreeLibrary(hmscoree);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pGetCORVersion = (void *)GetProcAddress(hmscoree, "GetCORVersion");
|
||||
|
||||
hr = pLoadLibraryShim(szFusion, NULL, NULL, &hfusion);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
win_skip("fusion.dll not available\n");
|
||||
FreeLibrary(hmscoree);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pGetCachePath = (void *)GetProcAddress(hfusion, "GetCachePath");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void test_GetCachePath(void)
|
||||
{
|
||||
CHAR windirA[MAX_PATH];
|
||||
WCHAR windir[MAX_PATH];
|
||||
WCHAR cachepath[MAX_PATH];
|
||||
WCHAR version[MAX_PATH];
|
||||
WCHAR path[MAX_PATH];
|
||||
DWORD size;
|
||||
HRESULT hr;
|
||||
|
||||
static const WCHAR backslash[] = {'\\',0};
|
||||
static const WCHAR nochange[] = {'n','o','c','h','a','n','g','e',0};
|
||||
static const WCHAR assembly[] = {'a','s','s','e','m','b','l','y',0};
|
||||
static const WCHAR gac[] = {'G','A','C',0};
|
||||
|
||||
if (!pGetCachePath)
|
||||
{
|
||||
win_skip("GetCachePath not implemented\n");
|
||||
return;
|
||||
}
|
||||
|
||||
GetWindowsDirectoryA(windirA, MAX_PATH);
|
||||
MultiByteToWideChar(CP_ACP, 0, windirA, -1, windir, MAX_PATH);
|
||||
lstrcpyW(cachepath, windir);
|
||||
lstrcatW(cachepath, backslash);
|
||||
lstrcatW(cachepath, assembly);
|
||||
lstrcatW(cachepath, backslash);
|
||||
lstrcatW(cachepath, gac);
|
||||
|
||||
/* NULL pwzCachePath, pcchPath is 0 */
|
||||
size = 0;
|
||||
hr = pGetCachePath(ASM_CACHE_GAC, NULL, &size);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER),
|
||||
"Expected HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), got %08x\n", hr);
|
||||
ok(size == lstrlenW(cachepath) + 1,
|
||||
"Expected %d, got %d\n", lstrlenW(cachepath) + 1, size);
|
||||
|
||||
/* NULL pwszCachePath, pcchPath is MAX_PATH */
|
||||
size = MAX_PATH;
|
||||
hr = pGetCachePath(ASM_CACHE_GAC, NULL, &size);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER),
|
||||
"Expected HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), got %08x\n", hr);
|
||||
ok(size == lstrlenW(cachepath) + 1,
|
||||
"Expected %d, got %d\n", lstrlenW(cachepath) + 1, size);
|
||||
|
||||
/* both pwszCachePath and pcchPath NULL */
|
||||
hr = pGetCachePath(ASM_CACHE_GAC, NULL, NULL);
|
||||
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
|
||||
|
||||
/* NULL pcchPath */
|
||||
lstrcpyW(path, nochange);
|
||||
hr = pGetCachePath(ASM_CACHE_GAC, path, NULL);
|
||||
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
|
||||
ok_w2("Expected \"%s\", got \"%s\"\n", nochange, path);
|
||||
|
||||
/* get the cache path */
|
||||
lstrcpyW(path, nochange);
|
||||
size = MAX_PATH;
|
||||
hr = pGetCachePath(ASM_CACHE_GAC, path, &size);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_w2("Expected \"%s\", got \"%s\"\n", cachepath, path);
|
||||
|
||||
/* pcchPath has no room for NULL terminator */
|
||||
lstrcpyW(path, nochange);
|
||||
size = lstrlenW(cachepath);
|
||||
hr = pGetCachePath(ASM_CACHE_GAC, path, &size);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER),
|
||||
"Expected HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), got %08x\n", hr);
|
||||
ok_w2("Expected \"%s\", got \"%s\"\n", nochange, path);
|
||||
|
||||
lstrcpyW(cachepath, windir);
|
||||
lstrcatW(cachepath, backslash);
|
||||
lstrcatW(cachepath, assembly);
|
||||
|
||||
/* ASM_CACHE_ROOT */
|
||||
lstrcpyW(path, nochange);
|
||||
size = MAX_PATH;
|
||||
hr = pGetCachePath(ASM_CACHE_ROOT, path, &size);
|
||||
ok(hr == S_OK ||
|
||||
broken(hr == E_INVALIDARG), /* .NET 1.1 */
|
||||
"Expected S_OK, got %08x\n", hr);
|
||||
if (hr == S_OK)
|
||||
ok_w2("Expected \"%s\", got \"%s\"\n", cachepath, path);
|
||||
|
||||
if (pGetCORVersion)
|
||||
{
|
||||
CHAR versionA[MAX_PATH];
|
||||
CHAR cachepathA[MAX_PATH];
|
||||
CHAR nativeimgA[MAX_PATH];
|
||||
CHAR zapfmtA[MAX_PATH];
|
||||
|
||||
if (hr == S_OK)
|
||||
{
|
||||
lstrcpyA(nativeimgA, "NativeImages_");
|
||||
#ifdef _WIN64
|
||||
lstrcpyA(zapfmtA, "%s\\%s\\%s%s_64");
|
||||
#else
|
||||
lstrcpyA(zapfmtA, "%s\\%s\\%s%s_32");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
lstrcpyA(nativeimgA, "NativeImages1_");
|
||||
lstrcpyA(zapfmtA, "%s\\%s\\%s%s");
|
||||
}
|
||||
|
||||
pGetCORVersion(version, MAX_PATH, &size);
|
||||
WideCharToMultiByte(CP_ACP, 0, version, -1, versionA, MAX_PATH, 0, 0);
|
||||
|
||||
wsprintfA(cachepathA, zapfmtA, windirA, "assembly", nativeimgA, versionA);
|
||||
MultiByteToWideChar(CP_ACP, 0, cachepathA, -1, cachepath, MAX_PATH);
|
||||
|
||||
/* ASM_CACHE_ZAP */
|
||||
lstrcpyW(path, nochange);
|
||||
size = MAX_PATH;
|
||||
hr = pGetCachePath(ASM_CACHE_ZAP, path, &size);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok_w2("Expected \"%s\", got \"%s\"\n", cachepath, path);
|
||||
}
|
||||
|
||||
/* two flags at once */
|
||||
lstrcpyW(path, nochange);
|
||||
size = MAX_PATH;
|
||||
hr = pGetCachePath(ASM_CACHE_GAC | ASM_CACHE_ROOT, path, &size);
|
||||
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
|
||||
ok_w2("Expected \"%s\", got \"%s\"\n", nochange, path);
|
||||
}
|
||||
|
||||
START_TEST(fusion)
|
||||
{
|
||||
if (!init_functionpointers())
|
||||
return;
|
||||
|
||||
test_GetCachePath();
|
||||
|
||||
FreeLibrary(hmscoree);
|
||||
}
|
13
rostests/winetests/fusion/fusion.rbuild
Normal file
13
rostests/winetests/fusion/fusion.rbuild
Normal file
|
@ -0,0 +1,13 @@
|
|||
<module name="fusion_winetest" type="win32cui" installbase="bin" installname="fusion_winetest.exe" allowwarnings="true">
|
||||
<compilerflag compiler="cc">-Wno-format</compilerflag>
|
||||
<include base="fusion_winetest">.</include>
|
||||
<file>asmcache.c</file>
|
||||
<file>asmenum.c</file>
|
||||
<file>asmname.c</file>
|
||||
<file>fusion.c</file>
|
||||
<file>testlist.c</file>
|
||||
<library>wine</library>
|
||||
<library>user32</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
</module>
|
21
rostests/winetests/fusion/testlist.c
Normal file
21
rostests/winetests/fusion/testlist.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* Automatically generated file; DO NOT EDIT!! */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#define STANDALONE
|
||||
#include "wine/test.h"
|
||||
|
||||
extern void func_fusion(void);
|
||||
extern void func_asmname(void);
|
||||
extern void func_asmenum(void);
|
||||
extern void func_asmcache(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "fusion", func_fusion },
|
||||
{ "asmname", func_asmname },
|
||||
{ "asmenum", func_asmenum },
|
||||
{ "asmcache", func_asmcache },
|
||||
{ 0, 0 }
|
||||
};
|
Loading…
Reference in a new issue