Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
457044cb
Commit
457044cb
authored
Mar 09, 2022
by
Eric Pouech
Committed by
Alexandre Julliard
Mar 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust/tests: Enable compilation with long types.
Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9e46e114
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
309 additions
and
310 deletions
+309
-310
Makefile.in
dlls/wintrust/tests/Makefile.in
+0
-1
asn.c
dlls/wintrust/tests/asn.c
+104
-104
crypt.c
dlls/wintrust/tests/crypt.c
+111
-111
register.c
dlls/wintrust/tests/register.c
+22
-22
softpub.c
dlls/wintrust/tests/softpub.c
+72
-72
No files found.
dlls/wintrust/tests/Makefile.in
View file @
457044cb
EXTRADEFS
=
-DWINE_NO_LONG_TYPES
TESTDLL
=
wintrust.dll
IMPORTS
=
wintrust crypt32 advapi32
...
...
dlls/wintrust/tests/asn.c
View file @
457044cb
...
...
@@ -46,20 +46,20 @@ static void test_encodeSPCFinancialCriteria(void)
}
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_FINANCIAL_CRITERIA_STRUCT
,
&
criteria
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
falseCriteria
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
falseCriteria
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
falseCriteria
,
size
),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
criteria
.
fFinancialInfoAvailable
=
criteria
.
fMeetsCriteria
=
TRUE
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_FINANCIAL_CRITERIA_STRUCT
,
&
criteria
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
trueCriteria
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
trueCriteria
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
trueCriteria
,
size
),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
...
...
@@ -79,7 +79,7 @@ static void test_decodeSPCFinancialCriteria(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_FINANCIAL_CRITERIA_STRUCT
,
falseCriteria
,
sizeof
(
falseCriteria
),
0
,
NULL
,
&
criteria
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
!
criteria
.
fFinancialInfoAvailable
,
"expected FALSE
\n
"
);
...
...
@@ -87,7 +87,7 @@ static void test_decodeSPCFinancialCriteria(void)
}
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_FINANCIAL_CRITERIA_STRUCT
,
trueCriteria
,
sizeof
(
trueCriteria
),
0
,
NULL
,
&
criteria
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
criteria
.
fFinancialInfoAvailable
,
"expected TRUE
\n
"
);
...
...
@@ -131,14 +131,14 @@ static void test_encodeSPCLink(void)
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
&
link
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
"Expected E_INVALIDARG, got %08
l
x
\n
"
,
GetLastError
());
link
.
dwLinkChoice
=
SPC_URL_LINK_CHOICE
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
&
link
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
emptyURLSPCLink
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
emptyURLSPCLink
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
emptyURLSPCLink
,
size
),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
...
...
@@ -151,18 +151,18 @@ static void test_encodeSPCLink(void)
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_INVALID_IA5_STRING
||
GetLastError
()
==
OSS_BAD_PTR
/* WinNT */
),
"Expected CRYPT_E_INVALID_IA5_STRING, got %08x
\n
"
,
GetLastError
());
"Expected CRYPT_E_INVALID_IA5_STRING, got %08
l
x
\n
"
,
GetLastError
());
/* Unlike the crypt32 string encoding routines, size is not set to the
* index of the first invalid character.
*/
ok
(
size
==
0
,
"Expected size 0, got %d
\n
"
,
size
);
ok
(
size
==
0
,
"Expected size 0, got %
l
d
\n
"
,
size
);
U
(
link
).
pwszUrl
=
url
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
&
link
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
urlSPCLink
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
urlSPCLink
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
urlSPCLink
,
size
),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
...
...
@@ -170,10 +170,10 @@ static void test_encodeSPCLink(void)
U
(
link
).
pwszFile
=
(
LPWSTR
)
nihongoURL
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
&
link
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
fileSPCLink
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
fileSPCLink
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
fileSPCLink
,
size
),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
...
...
@@ -181,10 +181,10 @@ static void test_encodeSPCLink(void)
memset
(
&
U
(
link
).
Moniker
,
0
,
sizeof
(
U
(
link
).
Moniker
));
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
&
link
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
emptyMonikerSPCLink
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
emptyMonikerSPCLink
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
emptyMonikerSPCLink
,
size
),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
...
...
@@ -193,10 +193,10 @@ static void test_encodeSPCLink(void)
U
(
link
).
Moniker
.
SerializedData
.
cbData
=
sizeof
(
data
);
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
&
link
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
monikerSPCLink
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
monikerSPCLink
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
monikerSPCLink
,
size
),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
...
...
@@ -222,50 +222,50 @@ static void test_decodeSPCLink(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
emptyURLSPCLink
,
sizeof
(
emptyURLSPCLink
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
link
=
(
SPC_LINK
*
)
buf
;
ok
(
link
->
dwLinkChoice
==
SPC_URL_LINK_CHOICE
,
"Expected SPC_URL_LINK_CHOICE, got %d
\n
"
,
link
->
dwLinkChoice
);
"Expected SPC_URL_LINK_CHOICE, got %
l
d
\n
"
,
link
->
dwLinkChoice
);
ok
(
lstrlenW
(
U
(
*
link
).
pwszUrl
)
==
0
,
"Expected empty string
\n
"
);
LocalFree
(
buf
);
}
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
urlSPCLink
,
sizeof
(
urlSPCLink
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
link
=
(
SPC_LINK
*
)
buf
;
ok
(
link
->
dwLinkChoice
==
SPC_URL_LINK_CHOICE
,
"Expected SPC_URL_LINK_CHOICE, got %d
\n
"
,
link
->
dwLinkChoice
);
"Expected SPC_URL_LINK_CHOICE, got %
l
d
\n
"
,
link
->
dwLinkChoice
);
ok
(
!
lstrcmpW
(
U
(
*
link
).
pwszUrl
,
url
),
"Unexpected URL
\n
"
);
LocalFree
(
buf
);
}
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
fileSPCLink
,
sizeof
(
fileSPCLink
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
link
=
(
SPC_LINK
*
)
buf
;
ok
(
link
->
dwLinkChoice
==
SPC_FILE_LINK_CHOICE
,
"Expected SPC_FILE_LINK_CHOICE, got %d
\n
"
,
link
->
dwLinkChoice
);
"Expected SPC_FILE_LINK_CHOICE, got %
l
d
\n
"
,
link
->
dwLinkChoice
);
ok
(
!
lstrcmpW
(
U
(
*
link
).
pwszFile
,
nihongoURL
),
"Unexpected file
\n
"
);
LocalFree
(
buf
);
}
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
emptyMonikerSPCLink
,
sizeof
(
emptyMonikerSPCLink
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
SPC_SERIALIZED_OBJECT
emptyMoniker
=
{
{
0
}
};
link
=
(
SPC_LINK
*
)
buf
;
ok
(
link
->
dwLinkChoice
==
SPC_MONIKER_LINK_CHOICE
,
"Expected SPC_MONIKER_LINK_CHOICE, got %d
\n
"
,
link
->
dwLinkChoice
);
"Expected SPC_MONIKER_LINK_CHOICE, got %
l
d
\n
"
,
link
->
dwLinkChoice
);
ok
(
!
memcmp
(
&
U
(
*
link
).
Moniker
.
ClassId
,
&
emptyMoniker
.
ClassId
,
sizeof
(
emptyMoniker
.
ClassId
)),
"Unexpected value
\n
"
);
ok
(
U
(
*
link
).
Moniker
.
SerializedData
.
cbData
==
0
,
...
...
@@ -275,19 +275,19 @@ static void test_decodeSPCLink(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
monikerSPCLink
,
sizeof
(
monikerSPCLink
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
SPC_UUID
id
;
link
=
(
SPC_LINK
*
)
buf
;
ok
(
link
->
dwLinkChoice
==
SPC_MONIKER_LINK_CHOICE
,
"Expected SPC_MONIKER_LINK_CHOICE, got %d
\n
"
,
link
->
dwLinkChoice
);
"Expected SPC_MONIKER_LINK_CHOICE, got %
l
d
\n
"
,
link
->
dwLinkChoice
);
memset
(
&
id
,
0xea
,
sizeof
(
id
));
ok
(
!
memcmp
(
&
U
(
*
link
).
Moniker
.
ClassId
,
&
id
,
sizeof
(
id
)),
"Unexpected value
\n
"
);
ok
(
U
(
*
link
).
Moniker
.
SerializedData
.
cbData
==
sizeof
(
data
),
"Unexpected data size %d
\n
"
,
U
(
*
link
).
Moniker
.
SerializedData
.
cbData
);
"Unexpected data size %
l
d
\n
"
,
U
(
*
link
).
Moniker
.
SerializedData
.
cbData
);
ok
(
!
memcmp
(
U
(
*
link
).
Moniker
.
SerializedData
.
pbData
,
data
,
sizeof
(
data
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
...
...
@@ -299,7 +299,7 @@ static void test_decodeSPCLink(void)
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_BAD_ENCODE
||
GetLastError
()
==
OSS_DATA_ERROR
/* WinNT */
),
"Expected CRYPT_E_BAD_ENCODE, got %08x
\n
"
,
GetLastError
());
"Expected CRYPT_E_BAD_ENCODE, got %08
l
x
\n
"
,
GetLastError
());
}
static
const
BYTE
emptySequence
[]
=
{
0x30
,
0x00
};
...
...
@@ -329,10 +329,10 @@ static void test_encodeSPCPEImage(void)
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_PE_IMAGE_DATA_STRUCT
,
&
imageData
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
emptySequence
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
emptySequence
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
emptySequence
,
sizeof
(
emptySequence
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
...
...
@@ -343,16 +343,16 @@ static void test_encodeSPCPEImage(void)
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_PE_IMAGE_DATA_STRUCT
,
&
imageData
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
"Expected E_INVALIDARG, got %08
l
x
\n
"
,
GetLastError
());
/* With just unused bits field set: */
imageData
.
pFile
=
NULL
;
imageData
.
Flags
.
cUnusedBits
=
1
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_PE_IMAGE_DATA_STRUCT
,
&
imageData
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
emptySequence
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
emptySequence
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
emptySequence
,
sizeof
(
emptySequence
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
...
...
@@ -368,10 +368,10 @@ static void test_encodeSPCPEImage(void)
skip
(
"SPC_PE_IMAGE_DATA_STRUCT not supported
\n
"
);
return
;
}
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
onlyFlagsPEImage
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
onlyFlagsPEImage
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
onlyFlagsPEImage
,
sizeof
(
onlyFlagsPEImage
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
...
...
@@ -382,10 +382,10 @@ static void test_encodeSPCPEImage(void)
imageData
.
pFile
=
&
link
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_PE_IMAGE_DATA_STRUCT
,
&
imageData
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
onlyEmptyFilePEImage
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
onlyEmptyFilePEImage
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
onlyEmptyFilePEImage
,
sizeof
(
onlyEmptyFilePEImage
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
...
...
@@ -395,10 +395,10 @@ static void test_encodeSPCPEImage(void)
imageData
.
Flags
.
cbData
=
sizeof
(
flags
);
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_PE_IMAGE_DATA_STRUCT
,
&
imageData
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
flagsAndEmptyFilePEImage
),
"Unexpected size %d
\n
"
,
ok
(
size
==
sizeof
(
flagsAndEmptyFilePEImage
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
flagsAndEmptyFilePEImage
,
sizeof
(
flagsAndEmptyFilePEImage
)),
"Unexpected value
\n
"
);
...
...
@@ -408,10 +408,10 @@ static void test_encodeSPCPEImage(void)
U
(
link
).
pwszFile
=
(
LPWSTR
)
nihongoURL
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_PE_IMAGE_DATA_STRUCT
,
&
imageData
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
flagsAndFilePEImage
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
flagsAndFilePEImage
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
flagsAndFilePEImage
,
sizeof
(
flagsAndFilePEImage
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
...
...
@@ -435,11 +435,11 @@ static void test_decodeSPCPEImage(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_PE_IMAGE_DATA_STRUCT
,
emptySequence
,
sizeof
(
emptySequence
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
imageData
=
(
SPC_PE_IMAGE_DATA
*
)
buf
;
ok
(
imageData
->
Flags
.
cbData
==
0
,
"Expected empty flags, got %d
\n
"
,
ok
(
imageData
->
Flags
.
cbData
==
0
,
"Expected empty flags, got %
l
d
\n
"
,
imageData
->
Flags
.
cbData
);
ok
(
imageData
->
pFile
==
NULL
,
"Expected no file
\n
"
);
LocalFree
(
buf
);
...
...
@@ -447,12 +447,12 @@ static void test_decodeSPCPEImage(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_PE_IMAGE_DATA_STRUCT
,
onlyFlagsPEImage
,
sizeof
(
onlyFlagsPEImage
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
imageData
=
(
SPC_PE_IMAGE_DATA
*
)
buf
;
ok
(
imageData
->
Flags
.
cbData
==
sizeof
(
flags
),
"Unexpected flags size %d
\n
"
,
imageData
->
Flags
.
cbData
);
"Unexpected flags size %
l
d
\n
"
,
imageData
->
Flags
.
cbData
);
if
(
imageData
->
Flags
.
cbData
)
ok
(
!
memcmp
(
imageData
->
Flags
.
pbData
,
flags
,
sizeof
(
flags
)),
"Unexpected flags
\n
"
);
...
...
@@ -462,17 +462,17 @@ static void test_decodeSPCPEImage(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_PE_IMAGE_DATA_STRUCT
,
onlyEmptyFilePEImage
,
sizeof
(
onlyEmptyFilePEImage
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
imageData
=
(
SPC_PE_IMAGE_DATA
*
)
buf
;
ok
(
imageData
->
Flags
.
cbData
==
0
,
"Expected empty flags, got %d
\n
"
,
ok
(
imageData
->
Flags
.
cbData
==
0
,
"Expected empty flags, got %
l
d
\n
"
,
imageData
->
Flags
.
cbData
);
ok
(
imageData
->
pFile
!=
NULL
,
"Expected a file
\n
"
);
if
(
imageData
->
pFile
)
{
ok
(
imageData
->
pFile
->
dwLinkChoice
==
SPC_FILE_LINK_CHOICE
,
"Expected SPC_FILE_LINK_CHOICE, got %d
\n
"
,
"Expected SPC_FILE_LINK_CHOICE, got %
l
d
\n
"
,
imageData
->
pFile
->
dwLinkChoice
);
ok
(
!
lstrcmpW
(
U
(
*
imageData
->
pFile
).
pwszFile
,
emptyString
),
"Unexpected file
\n
"
);
...
...
@@ -482,12 +482,12 @@ static void test_decodeSPCPEImage(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_PE_IMAGE_DATA_STRUCT
,
flagsAndEmptyFilePEImage
,
sizeof
(
flagsAndEmptyFilePEImage
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
imageData
=
(
SPC_PE_IMAGE_DATA
*
)
buf
;
ok
(
imageData
->
Flags
.
cbData
==
sizeof
(
flags
),
"Unexpected flags size %d
\n
"
,
imageData
->
Flags
.
cbData
);
"Unexpected flags size %
l
d
\n
"
,
imageData
->
Flags
.
cbData
);
if
(
imageData
->
Flags
.
cbData
)
ok
(
!
memcmp
(
imageData
->
Flags
.
pbData
,
flags
,
sizeof
(
flags
)),
"Unexpected flags
\n
"
);
...
...
@@ -495,7 +495,7 @@ static void test_decodeSPCPEImage(void)
if
(
imageData
->
pFile
)
{
ok
(
imageData
->
pFile
->
dwLinkChoice
==
SPC_FILE_LINK_CHOICE
,
"Expected SPC_FILE_LINK_CHOICE, got %d
\n
"
,
"Expected SPC_FILE_LINK_CHOICE, got %
l
d
\n
"
,
imageData
->
pFile
->
dwLinkChoice
);
ok
(
!
lstrcmpW
(
U
(
*
imageData
->
pFile
).
pwszFile
,
emptyString
),
"Unexpected file
\n
"
);
...
...
@@ -505,12 +505,12 @@ static void test_decodeSPCPEImage(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_PE_IMAGE_DATA_STRUCT
,
flagsAndFilePEImage
,
sizeof
(
flagsAndFilePEImage
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
imageData
=
(
SPC_PE_IMAGE_DATA
*
)
buf
;
ok
(
imageData
->
Flags
.
cbData
==
sizeof
(
flags
),
"Unexpected flags size %d
\n
"
,
imageData
->
Flags
.
cbData
);
"Unexpected flags size %
l
d
\n
"
,
imageData
->
Flags
.
cbData
);
if
(
imageData
->
Flags
.
cbData
)
ok
(
!
memcmp
(
imageData
->
Flags
.
pbData
,
flags
,
sizeof
(
flags
)),
"Unexpected flags
\n
"
);
...
...
@@ -518,7 +518,7 @@ static void test_decodeSPCPEImage(void)
if
(
imageData
->
pFile
)
{
ok
(
imageData
->
pFile
->
dwLinkChoice
==
SPC_FILE_LINK_CHOICE
,
"Expected SPC_FILE_LINK_CHOICE, got %d
\n
"
,
"Expected SPC_FILE_LINK_CHOICE, got %
l
d
\n
"
,
imageData
->
pFile
->
dwLinkChoice
);
ok
(
!
lstrcmpW
(
U
(
*
imageData
->
pFile
).
pwszFile
,
nihongoURL
),
"Unexpected file
\n
"
);
...
...
@@ -560,10 +560,10 @@ static void test_encodeCatMemberInfo(void)
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
CAT_MEMBERINFO_STRUCT
,
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
emptyCatMemberInfo
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
emptyCatMemberInfo
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
emptyCatMemberInfo
,
sizeof
(
emptyCatMemberInfo
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
...
...
@@ -571,10 +571,10 @@ static void test_encodeCatMemberInfo(void)
info
.
pwszSubjGuid
=
foo
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
CAT_MEMBERINFO_STRUCT
,
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
catMemberInfoWithSillyGuid
),
"Unexpected size %d
\n
"
,
ok
(
size
==
sizeof
(
catMemberInfoWithSillyGuid
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
catMemberInfoWithSillyGuid
,
sizeof
(
catMemberInfoWithSillyGuid
)),
"Unexpected value
\n
"
);
...
...
@@ -583,10 +583,10 @@ static void test_encodeCatMemberInfo(void)
info
.
pwszSubjGuid
=
guidStr
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
CAT_MEMBERINFO_STRUCT
,
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
catMemberInfoWithGuid
),
"Unexpected size %d
\n
"
,
ok
(
size
==
sizeof
(
catMemberInfoWithGuid
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
catMemberInfoWithGuid
,
sizeof
(
catMemberInfoWithGuid
)),
"Unexpected value
\n
"
);
...
...
@@ -610,39 +610,39 @@ static void test_decodeCatMemberInfo(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
CAT_MEMBERINFO_STRUCT
,
emptyCatMemberInfo
,
sizeof
(
emptyCatMemberInfo
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
info
=
(
CAT_MEMBERINFO
*
)
buf
;
ok
(
!
info
->
pwszSubjGuid
||
!
info
->
pwszSubjGuid
[
0
],
"expected empty pwszSubjGuid
\n
"
);
ok
(
info
->
dwCertVersion
==
0
,
"expected dwCertVersion == 0, got %d
\n
"
,
ok
(
info
->
dwCertVersion
==
0
,
"expected dwCertVersion == 0, got %
l
d
\n
"
,
info
->
dwCertVersion
);
LocalFree
(
buf
);
}
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
CAT_MEMBERINFO_STRUCT
,
catMemberInfoWithSillyGuid
,
sizeof
(
catMemberInfoWithSillyGuid
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
info
=
(
CAT_MEMBERINFO
*
)
buf
;
ok
(
info
->
pwszSubjGuid
&&
!
lstrcmpW
(
info
->
pwszSubjGuid
,
foo
),
"unexpected pwszSubjGuid
\n
"
);
ok
(
info
->
dwCertVersion
==
0
,
"expected dwCertVersion == 0, got %d
\n
"
,
ok
(
info
->
dwCertVersion
==
0
,
"expected dwCertVersion == 0, got %
l
d
\n
"
,
info
->
dwCertVersion
);
LocalFree
(
buf
);
}
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
CAT_MEMBERINFO_STRUCT
,
catMemberInfoWithGuid
,
sizeof
(
catMemberInfoWithGuid
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
info
=
(
CAT_MEMBERINFO
*
)
buf
;
ok
(
info
->
pwszSubjGuid
&&
!
lstrcmpW
(
info
->
pwszSubjGuid
,
guidStr
),
"unexpected pwszSubjGuid
\n
"
);
ok
(
info
->
dwCertVersion
==
0
,
"expected dwCertVersion == 0, got %d
\n
"
,
ok
(
info
->
dwCertVersion
==
0
,
"expected dwCertVersion == 0, got %
l
d
\n
"
,
info
->
dwCertVersion
);
LocalFree
(
buf
);
}
...
...
@@ -670,10 +670,10 @@ static void test_encodeCatNameValue(void)
memset
(
&
value
,
0
,
sizeof
(
value
));
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
CAT_NAMEVALUE_STRUCT
,
&
value
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
emptyCatNameValue
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
emptyCatNameValue
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
emptyCatNameValue
,
sizeof
(
emptyCatNameValue
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
...
...
@@ -681,10 +681,10 @@ static void test_encodeCatNameValue(void)
value
.
pwszTag
=
foo
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
CAT_NAMEVALUE_STRUCT
,
&
value
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
catNameValueWithTag
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
catNameValueWithTag
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
catNameValueWithTag
,
sizeof
(
catNameValueWithTag
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
...
...
@@ -693,10 +693,10 @@ static void test_encodeCatNameValue(void)
value
.
fdwFlags
=
0xf00dd00d
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
CAT_NAMEVALUE_STRUCT
,
&
value
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
catNameValueWithFlags
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
catNameValueWithFlags
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
catNameValueWithFlags
,
sizeof
(
catNameValueWithFlags
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
...
...
@@ -706,10 +706,10 @@ static void test_encodeCatNameValue(void)
value
.
Value
.
pbData
=
aVal
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
CAT_NAMEVALUE_STRUCT
,
&
value
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
catNameValueWithValue
),
"Unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
catNameValueWithValue
),
"Unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
catNameValueWithValue
,
sizeof
(
catNameValueWithValue
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
...
...
@@ -727,14 +727,14 @@ static void test_decodeCatNameValue(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
CAT_NAMEVALUE_STRUCT
,
emptyCatNameValue
,
sizeof
(
emptyCatNameValue
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
value
=
(
CAT_NAMEVALUE
*
)
buf
;
ok
(
!
value
->
pwszTag
||
!
value
->
pwszTag
[
0
],
"expected empty pwszTag
\n
"
);
ok
(
value
->
fdwFlags
==
0
,
"expected fdwFlags == 0, got %08x
\n
"
,
ok
(
value
->
fdwFlags
==
0
,
"expected fdwFlags == 0, got %08
l
x
\n
"
,
value
->
fdwFlags
);
ok
(
value
->
Value
.
cbData
==
0
,
"expected 0-length value, got %d
\n
"
,
ok
(
value
->
Value
.
cbData
==
0
,
"expected 0-length value, got %
l
d
\n
"
,
value
->
Value
.
cbData
);
LocalFree
(
buf
);
}
...
...
@@ -742,15 +742,15 @@ static void test_decodeCatNameValue(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
CAT_NAMEVALUE_STRUCT
,
catNameValueWithTag
,
sizeof
(
catNameValueWithTag
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
value
=
(
CAT_NAMEVALUE
*
)
buf
;
ok
(
value
->
pwszTag
&&
!
lstrcmpW
(
value
->
pwszTag
,
foo
),
"unexpected pwszTag
\n
"
);
ok
(
value
->
fdwFlags
==
0
,
"expected fdwFlags == 0, got %08x
\n
"
,
ok
(
value
->
fdwFlags
==
0
,
"expected fdwFlags == 0, got %08
l
x
\n
"
,
value
->
fdwFlags
);
ok
(
value
->
Value
.
cbData
==
0
,
"expected 0-length value, got %d
\n
"
,
ok
(
value
->
Value
.
cbData
==
0
,
"expected 0-length value, got %
l
d
\n
"
,
value
->
Value
.
cbData
);
LocalFree
(
buf
);
}
...
...
@@ -758,14 +758,14 @@ static void test_decodeCatNameValue(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
CAT_NAMEVALUE_STRUCT
,
catNameValueWithFlags
,
sizeof
(
catNameValueWithFlags
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
value
=
(
CAT_NAMEVALUE
*
)
buf
;
ok
(
!
value
->
pwszTag
||
!
value
->
pwszTag
[
0
],
"expected empty pwszTag
\n
"
);
ok
(
value
->
fdwFlags
==
0xf00dd00d
,
"expected fdwFlags == 0xf00dd00d, got %08x
\n
"
,
value
->
fdwFlags
);
ok
(
value
->
Value
.
cbData
==
0
,
"expected 0-length value, got %d
\n
"
,
"expected fdwFlags == 0xf00dd00d, got %08
l
x
\n
"
,
value
->
fdwFlags
);
ok
(
value
->
Value
.
cbData
==
0
,
"expected 0-length value, got %
l
d
\n
"
,
value
->
Value
.
cbData
);
LocalFree
(
buf
);
}
...
...
@@ -773,14 +773,14 @@ static void test_decodeCatNameValue(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
CAT_NAMEVALUE_STRUCT
,
catNameValueWithValue
,
sizeof
(
catNameValueWithValue
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
value
=
(
CAT_NAMEVALUE
*
)
buf
;
ok
(
!
value
->
pwszTag
||
!
value
->
pwszTag
[
0
],
"expected empty pwszTag
\n
"
);
ok
(
value
->
fdwFlags
==
0
,
"expected fdwFlags == 0, got %08x
\n
"
,
ok
(
value
->
fdwFlags
==
0
,
"expected fdwFlags == 0, got %08
l
x
\n
"
,
value
->
fdwFlags
);
ok
(
value
->
Value
.
cbData
==
sizeof
(
aVal
),
"unexpected size %d
\n
"
,
ok
(
value
->
Value
.
cbData
==
sizeof
(
aVal
),
"unexpected size %
l
d
\n
"
,
value
->
Value
.
cbData
);
ok
(
!
memcmp
(
value
->
Value
.
pbData
,
aVal
,
value
->
Value
.
cbData
),
"unexpected value
\n
"
);
...
...
@@ -812,20 +812,20 @@ static void test_encodeSpOpusInfo(void)
memset
(
&
info
,
0
,
sizeof
(
info
));
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
emptySequence
),
"unexpected size %d
\n
"
,
size
);
ok
(
size
==
sizeof
(
emptySequence
),
"unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
emptySequence
,
size
),
"unexpected value
\n
"
);
LocalFree
(
buf
);
}
info
.
pwszProgramName
=
progName
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
spOpusInfoWithProgramName
),
"unexpected size %d
\n
"
,
ok
(
size
==
sizeof
(
spOpusInfoWithProgramName
),
"unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
spOpusInfoWithProgramName
,
size
),
"unexpected value
\n
"
);
...
...
@@ -838,16 +838,16 @@ static void test_encodeSpOpusInfo(void)
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
"expected E_INVALIDARG, got %08
l
x
\n
"
,
GetLastError
());
moreInfo
.
dwLinkChoice
=
SPC_URL_LINK_CHOICE
;
U
(
moreInfo
).
pwszUrl
=
winehq
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
spOpusInfoWithMoreInfo
),
"unexpected size %d
\n
"
,
size
);
"unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
spOpusInfoWithMoreInfo
,
size
),
"unexpected value
\n
"
);
LocalFree
(
buf
);
...
...
@@ -856,11 +856,11 @@ static void test_encodeSpOpusInfo(void)
info
.
pPublisherInfo
=
&
moreInfo
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptEncodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
spOpusInfoWithPublisherInfo
),
"unexpected size %d
\n
"
,
size
);
"unexpected size %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
spOpusInfoWithPublisherInfo
,
size
),
"unexpected value
\n
"
);
LocalFree
(
buf
);
...
...
@@ -876,7 +876,7 @@ static void test_decodeSpOpusInfo(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
emptySequence
,
sizeof
(
emptySequence
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
info
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
!
info
->
pwszProgramName
,
"expected NULL
\n
"
);
...
...
@@ -887,7 +887,7 @@ static void test_decodeSpOpusInfo(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
spOpusInfoWithProgramName
,
sizeof
(
spOpusInfoWithProgramName
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
info
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
info
->
pwszProgramName
&&
!
lstrcmpW
(
info
->
pwszProgramName
,
...
...
@@ -899,7 +899,7 @@ static void test_decodeSpOpusInfo(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
spOpusInfoWithMoreInfo
,
sizeof
(
spOpusInfoWithMoreInfo
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
info
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
!
info
->
pwszProgramName
,
"expected NULL
\n
"
);
...
...
@@ -907,7 +907,7 @@ static void test_decodeSpOpusInfo(void)
if
(
info
->
pMoreInfo
)
{
ok
(
info
->
pMoreInfo
->
dwLinkChoice
==
SPC_URL_LINK_CHOICE
,
"unexpected link choice %d
\n
"
,
info
->
pMoreInfo
->
dwLinkChoice
);
"unexpected link choice %
l
d
\n
"
,
info
->
pMoreInfo
->
dwLinkChoice
);
ok
(
!
lstrcmpW
(
U
(
*
info
->
pMoreInfo
).
pwszUrl
,
winehq
),
"unexpected link value
\n
"
);
}
...
...
@@ -917,7 +917,7 @@ static void test_decodeSpOpusInfo(void)
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
spOpusInfoWithPublisherInfo
,
sizeof
(
spOpusInfoWithPublisherInfo
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
info
,
&
size
);
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptDecodeObjectEx failed: %08
l
x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
!
info
->
pwszProgramName
,
"expected NULL
\n
"
);
...
...
@@ -927,7 +927,7 @@ static void test_decodeSpOpusInfo(void)
if
(
info
->
pPublisherInfo
)
{
ok
(
info
->
pPublisherInfo
->
dwLinkChoice
==
SPC_URL_LINK_CHOICE
,
"unexpected link choice %d
\n
"
,
"unexpected link choice %
l
d
\n
"
,
info
->
pPublisherInfo
->
dwLinkChoice
);
ok
(
!
lstrcmpW
(
U
(
*
info
->
pPublisherInfo
).
pwszUrl
,
winehq
),
"unexpected link value
\n
"
);
...
...
dlls/wintrust/tests/crypt.c
View file @
457044cb
...
...
@@ -200,25 +200,25 @@ static void test_context(void)
ret
=
pCryptCATAdminAcquireContext
(
NULL
,
NULL
,
0
);
ok
(
!
ret
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
/* NULL GUID */
if
(
0
)
{
/* crashes on 64-bit win10 */
ret
=
pCryptCATAdminAcquireContext
(
&
hca
,
NULL
,
0
);
ok
(
ret
,
"Expected success, got FALSE with %d
\n
"
,
GetLastError
());
ok
(
ret
,
"Expected success, got FALSE with %
l
d
\n
"
,
GetLastError
());
ok
(
hca
!=
NULL
,
"Expected a context handle, got NULL
\n
"
);
/* Proper release */
SetLastError
(
0xdeadbeef
);
ret
=
pCryptCATAdminReleaseContext
(
hca
,
0
);
ok
(
ret
,
"Expected success, got FALSE with %d
\n
"
,
GetLastError
());
ok
(
ret
,
"Expected success, got FALSE with %
l
d
\n
"
,
GetLastError
());
/* Try to release a second time */
SetLastError
(
0xdeadbeef
);
ret
=
pCryptCATAdminReleaseContext
(
hca
,
0
);
ok
(
!
ret
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
}
/* All NULL */
...
...
@@ -226,14 +226,14 @@ static void test_context(void)
ret
=
pCryptCATAdminReleaseContext
(
NULL
,
0
);
ok
(
!
ret
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
/* NULL context handle and dummy GUID */
SetLastError
(
0xdeadbeef
);
ret
=
pCryptCATAdminAcquireContext
(
NULL
,
&
dummy
,
0
);
ok
(
!
ret
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
/* Correct context handle and dummy GUID
*
...
...
@@ -246,7 +246,7 @@ static void test_context(void)
*/
ret
=
pCryptCATAdminAcquireContext
(
&
hca
,
&
dummy
,
0
);
ok
(
ret
||
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"CryptCATAdminAcquireContext failed %u
\n
"
,
GetLastError
());
ok
(
ret
||
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"CryptCATAdminAcquireContext failed %
l
u
\n
"
,
GetLastError
());
if
(
!
ret
&&
GetLastError
()
==
ERROR_ACCESS_DENIED
)
{
win_skip
(
"Not running as administrator
\n
"
);
...
...
@@ -276,15 +276,15 @@ static void test_context(void)
}
ret
=
pCryptCATAdminReleaseContext
(
hca
,
0
);
ok
(
ret
,
"Expected success, got FALSE with %d
\n
"
,
GetLastError
());
ok
(
ret
,
"Expected success, got FALSE with %
l
d
\n
"
,
GetLastError
());
/* Correct context handle and GUID */
ret
=
pCryptCATAdminAcquireContext
(
&
hca
,
&
unknown
,
0
);
ok
(
ret
,
"Expected success, got FALSE with %d
\n
"
,
GetLastError
());
ok
(
ret
,
"Expected success, got FALSE with %
l
d
\n
"
,
GetLastError
());
ok
(
hca
!=
NULL
,
"Expected a context handle, got NULL
\n
"
);
ret
=
pCryptCATAdminReleaseContext
(
hca
,
0
);
ok
(
ret
,
"Expected success, got FALSE with %d
\n
"
,
GetLastError
());
ok
(
ret
,
"Expected success, got FALSE with %
l
d
\n
"
,
GetLastError
());
hca
=
(
void
*
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
...
...
@@ -292,14 +292,14 @@ static void test_context(void)
ret
=
pCryptCATAdminAcquireContext
(
&
hca
,
&
unknown
,
1
);
ok
((
!
ret
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
)
&&
(
hca
==
(
void
*
)
0xdeadbeef
))
||
broken
(
ret
&&
hca
!=
NULL
&&
hca
!=
(
void
*
)
0xdeadbeef
),
"Expected FALSE and ERROR_INVALID_PARAMETER with untouched handle, got %d and %u with %p
\n
"
,
"Expected FALSE and ERROR_INVALID_PARAMETER with untouched handle, got %d and %
l
u with %p
\n
"
,
ret
,
GetLastError
(),
hca
);
if
(
ret
&&
hca
)
{
SetLastError
(
0xdeadbeef
);
ret
=
pCryptCATAdminReleaseContext
(
hca
,
0
);
ok
(
ret
,
"Expected success, got FALSE with %d
\n
"
,
GetLastError
());
ok
(
ret
,
"Expected success, got FALSE with %
l
d
\n
"
,
GetLastError
());
}
}
...
...
@@ -319,14 +319,14 @@ static void test_calchash(void)
ret
=
pCryptCATAdminCalcHashFromFileHandle
(
NULL
,
NULL
,
NULL
,
0
);
ok
(
!
ret
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
/* NULL filehandle, rest is legal */
SetLastError
(
0xdeadbeef
);
ret
=
pCryptCATAdminCalcHashFromFileHandle
(
NULL
,
&
hashsize
,
NULL
,
0
);
ok
(
!
ret
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
/* Correct filehandle, rest is NULL */
file
=
CreateFileA
(
selfname
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
...
...
@@ -334,7 +334,7 @@ static void test_calchash(void)
ret
=
pCryptCATAdminCalcHashFromFileHandle
(
file
,
NULL
,
NULL
,
0
);
ok
(
!
ret
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
CloseHandle
(
file
);
/* All OK, but dwFlags set to 1 */
...
...
@@ -343,18 +343,18 @@ static void test_calchash(void)
ret
=
pCryptCATAdminCalcHashFromFileHandle
(
file
,
&
hashsize
,
NULL
,
1
);
ok
(
!
ret
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
CloseHandle
(
file
);
/* All OK, requesting the size of the hash */
file
=
CreateFileA
(
selfname
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFile failed %u
\n
"
,
GetLastError
());
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFile failed %
l
u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pCryptCATAdminCalcHashFromFileHandle
(
file
,
&
hashsize
,
NULL
,
0
);
ok
(
ret
,
"Expected success, got FALSE with %d
\n
"
,
GetLastError
());
ok
(
hashsize
==
20
,
" Expected a hash size of 20, got %d
\n
"
,
hashsize
);
ok
(
ret
,
"Expected success, got FALSE with %
l
d
\n
"
,
GetLastError
());
ok
(
hashsize
==
20
,
" Expected a hash size of 20, got %
l
d
\n
"
,
hashsize
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Expected ERROR_INSUFFICIENT_BUFFER, got %d
\n
"
,
GetLastError
());
"Expected ERROR_INSUFFICIENT_BUFFER, got %
l
d
\n
"
,
GetLastError
());
CloseHandle
(
file
);
/* All OK, retrieve the hash
...
...
@@ -365,10 +365,10 @@ static void test_calchash(void)
hash
=
HeapAlloc
(
GetProcessHeap
(),
0
,
hashsize
);
SetLastError
(
0xdeadbeef
);
ret
=
pCryptCATAdminCalcHashFromFileHandle
(
file
,
&
hashsize
,
hash
,
0
);
ok
(
ret
,
"Expected success, got FALSE with %d
\n
"
,
GetLastError
());
ok
(
hashsize
==
20
,
" Expected a hash size of 20, got %d
\n
"
,
hashsize
);
ok
(
ret
,
"Expected success, got FALSE with %
l
d
\n
"
,
GetLastError
());
ok
(
hashsize
==
20
,
" Expected a hash size of 20, got %
l
d
\n
"
,
hashsize
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
GetLastError
());
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
GetLastError
());
CloseHandle
(
file
);
HeapFree
(
GetProcessHeap
(),
0
,
hash
);
...
...
@@ -387,9 +387,9 @@ static void test_calchash(void)
hash
=
HeapAlloc
(
GetProcessHeap
(),
0
,
hashsize
);
SetLastError
(
0xdeadbeef
);
ret
=
pCryptCATAdminCalcHashFromFileHandle
(
file
,
&
hashsize
,
hash
,
0
);
ok
(
ret
,
"Expected success, got FALSE with %d
\n
"
,
GetLastError
());
ok
(
ret
,
"Expected success, got FALSE with %
l
d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
GetLastError
());
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
GetLastError
());
ok
(
hashsize
==
sizeof
(
expectedhash
)
&&
!
memcmp
(
hash
,
expectedhash
,
sizeof
(
expectedhash
)),
"Hashes didn't match
\n
"
);
...
...
@@ -414,7 +414,7 @@ static void test_CryptCATOpen(void)
SetLastError
(
0xdeadbeef
);
cat
=
pCryptCATOpen
(
NULL
,
0
,
0
,
0
,
0
);
ok
(
cat
==
INVALID_HANDLE_VALUE
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got error %
l
u
\n
"
,
GetLastError
());
for
(
flags
=
0
;
flags
<
8
;
++
flags
)
{
...
...
@@ -422,19 +422,19 @@ static void test_CryptCATOpen(void)
cat
=
pCryptCATOpen
(
filename
,
flags
,
0
,
0
,
0
);
if
(
flags
==
CRYPTCAT_OPEN_EXISTING
)
{
ok
(
cat
==
INVALID_HANDLE_VALUE
,
"flags %#x: expected failure
\n
"
,
flags
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"flags %#
x: got error %
u
\n
"
,
flags
,
GetLastError
());
ok
(
cat
==
INVALID_HANDLE_VALUE
,
"flags %#
l
x: expected failure
\n
"
,
flags
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"flags %#
lx: got error %l
u
\n
"
,
flags
,
GetLastError
());
ret
=
DeleteFileW
(
filename
);
ok
(
!
ret
,
"flags %#x: expected failure
\n
"
,
flags
);
ok
(
!
ret
,
"flags %#
l
x: expected failure
\n
"
,
flags
);
}
else
{
ok
(
cat
!=
INVALID_HANDLE_VALUE
,
"flags %#x: expected success
\n
"
,
flags
);
ok
(
!
GetLastError
(),
"flags %#
x: got error %
u
\n
"
,
flags
,
GetLastError
());
ok
(
cat
!=
INVALID_HANDLE_VALUE
,
"flags %#
l
x: expected success
\n
"
,
flags
);
ok
(
!
GetLastError
(),
"flags %#
lx: got error %l
u
\n
"
,
flags
,
GetLastError
());
ret
=
pCryptCATClose
(
cat
);
ok
(
ret
,
"flags %#x: failed to close file
\n
"
,
flags
);
ok
(
ret
,
"flags %#
l
x: failed to close file
\n
"
,
flags
);
ret
=
DeleteFileW
(
filename
);
ok
(
ret
,
"flags %#
x: failed to delete file, error %
u
\n
"
,
flags
,
GetLastError
());
ok
(
ret
,
"flags %#
lx: failed to delete file, error %l
u
\n
"
,
flags
,
GetLastError
());
}
file
=
_wfopen
(
filename
,
L"w"
);
...
...
@@ -443,21 +443,21 @@ static void test_CryptCATOpen(void)
SetLastError
(
0xdeadbeef
);
cat
=
pCryptCATOpen
(
filename
,
flags
,
0
,
0
,
0
);
ok
(
cat
!=
INVALID_HANDLE_VALUE
,
"flags %#x: expected success
\n
"
,
flags
);
ok
(
!
GetLastError
(),
"flags %#
x: got error %
u
\n
"
,
flags
,
GetLastError
());
ok
(
cat
!=
INVALID_HANDLE_VALUE
,
"flags %#
l
x: expected success
\n
"
,
flags
);
ok
(
!
GetLastError
(),
"flags %#
lx: got error %l
u
\n
"
,
flags
,
GetLastError
());
ret
=
pCryptCATClose
(
cat
);
ok
(
ret
,
"flags %#x: failed to close file
\n
"
,
flags
);
ok
(
ret
,
"flags %#
l
x: failed to close file
\n
"
,
flags
);
file
=
_wfopen
(
filename
,
L"r"
);
ret
=
fread
(
buffer
,
1
,
sizeof
(
buffer
),
file
);
if
(
flags
&
CRYPTCAT_OPEN_CREATENEW
)
ok
(
!
ret
,
"flags %#x: got %s
\n
"
,
flags
,
debugstr_an
(
buffer
,
ret
));
ok
(
!
ret
,
"flags %#
l
x: got %s
\n
"
,
flags
,
debugstr_an
(
buffer
,
ret
));
else
ok
(
ret
==
9
&&
!
strncmp
(
buffer
,
"test text"
,
ret
),
"flags %#x: got %s
\n
"
,
flags
,
debugstr_an
(
buffer
,
ret
));
ok
(
ret
==
9
&&
!
strncmp
(
buffer
,
"test text"
,
ret
),
"flags %#
l
x: got %s
\n
"
,
flags
,
debugstr_an
(
buffer
,
ret
));
fclose
(
file
);
ret
=
DeleteFileW
(
filename
);
ok
(
ret
,
"flags %#
x: failed to delete file, error %
u
\n
"
,
flags
,
GetLastError
());
ok
(
ret
,
"flags %#
lx: failed to delete file, error %l
u
\n
"
,
flags
,
GetLastError
());
}
}
...
...
@@ -466,7 +466,7 @@ static DWORD local_error;
static
void
WINAPI
cdf_callback
(
DWORD
area
,
DWORD
error
,
WCHAR
*
line
)
{
ok
(
error_area
!=
-
2
,
"Didn't expect cdf_callback() to be called (%08
x, %08
x)
\n
"
,
ok
(
error_area
!=
-
2
,
"Didn't expect cdf_callback() to be called (%08
lx, %08l
x)
\n
"
,
area
,
error
);
error_area
=
area
;
...
...
@@ -489,33 +489,33 @@ static void test_CryptCATCDF_params(void)
catcdf
=
pCryptCATCDFOpen
(
NULL
,
NULL
);
ok
(
catcdf
==
NULL
,
"CryptCATCDFOpen succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
catcdf
=
pCryptCATCDFOpen
(
NULL
,
cdf_callback
);
ok
(
catcdf
==
NULL
,
"CryptCATCDFOpen succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
/* File doesn't exist */
SetLastError
(
0xdeadbeef
);
catcdf
=
pCryptCATCDFOpen
(
nonexistent
,
cdf_callback
);
ok
(
catcdf
==
NULL
,
"CryptCATCDFOpen succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"Expected ERROR_FILE_NOT_FOUND, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"Expected ERROR_FILE_NOT_FOUND, got %
l
d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pCryptCATCDFClose
(
NULL
);
ok
(
!
ret
,
"Expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
catcdf
=
NULL
;
SetLastError
(
0xdeadbeef
);
ret
=
pCryptCATCDFClose
(
catcdf
);
ok
(
!
ret
,
"Expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
}
/* FIXME: Once Wine can create catalog files we should use the created catalog file in this test */
...
...
@@ -545,11 +545,11 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
if
(
!
GetTempFileNameA
(
CURR_DIR
,
"cat"
,
0
,
tmpfile
))
return
;
DeleteFileA
(
tmpfile
);
file
=
CreateFileA
(
tmpfile
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_NEW
,
0
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFileA failed %u
\n
"
,
GetLastError
());
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFileA failed %
l
u
\n
"
,
GetLastError
());
CloseHandle
(
file
);
ret
=
pCryptCATAdminAcquireContext
(
&
hcatadmin
,
&
dummy
,
0
);
ok
(
ret
||
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"CryptCATAdminAcquireContext failed %u
\n
"
,
GetLastError
());
ok
(
ret
||
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"CryptCATAdminAcquireContext failed %
l
u
\n
"
,
GetLastError
());
if
(
!
ret
&&
GetLastError
()
==
ERROR_ACCESS_DENIED
)
{
win_skip
(
"Not running as administrator
\n
"
);
...
...
@@ -560,13 +560,13 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
hcatinfo
=
pCryptCATAdminAddCatalog
(
NULL
,
NULL
,
NULL
,
0
);
error
=
GetLastError
();
ok
(
hcatinfo
==
NULL
,
"CryptCATAdminAddCatalog succeeded
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u expected ERROR_INVALID_PARAMETER
\n
"
,
GetLastError
());
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %
l
u expected ERROR_INVALID_PARAMETER
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
hcatinfo
=
pCryptCATAdminAddCatalog
(
hcatadmin
,
NULL
,
NULL
,
0
);
error
=
GetLastError
();
ok
(
hcatinfo
==
NULL
,
"CryptCATAdminAddCatalog succeeded
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u expected ERROR_INVALID_PARAMETER
\n
"
,
GetLastError
());
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %
l
u expected ERROR_INVALID_PARAMETER
\n
"
,
GetLastError
());
MultiByteToWideChar
(
CP_ACP
,
0
,
tmpfile
,
-
1
,
tmpfileW
,
MAX_PATH
);
...
...
@@ -575,7 +575,7 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
error
=
GetLastError
();
todo_wine
{
ok
(
hcatinfo
==
NULL
,
"CryptCATAdminAddCatalog succeeded
\n
"
);
ok
(
error
==
ERROR_BAD_FORMAT
,
"got %u expected ERROR_BAD_FORMAT
\n
"
,
GetLastError
());
ok
(
error
==
ERROR_BAD_FORMAT
,
"got %
l
u expected ERROR_BAD_FORMAT
\n
"
,
GetLastError
());
}
if
(
hcatinfo
!=
NULL
)
pCryptCATAdminReleaseCatalogContext
(
hcatadmin
,
hcatinfo
,
0
);
...
...
@@ -586,17 +586,17 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
ok
(
hcatinfo
==
NULL
,
"CryptCATAdminAddCatalog succeeded
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
||
error
==
ERROR_BAD_FORMAT
,
/* win 8 */
"got %u
\n
"
,
GetLastError
());
"got %
l
u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
hcatinfo
=
pCryptCATAdminAddCatalog
(
hcatadmin
,
tmpfileW
,
NULL
,
0
);
error
=
GetLastError
();
ok
(
hcatinfo
==
NULL
,
"CryptCATAdminAddCatalog succeeded
\n
"
);
todo_wine
ok
(
error
==
ERROR_BAD_FORMAT
,
"got %u expected ERROR_BAD_FORMAT
\n
"
,
GetLastError
());
todo_wine
ok
(
error
==
ERROR_BAD_FORMAT
,
"got %
l
u expected ERROR_BAD_FORMAT
\n
"
,
GetLastError
());
DeleteFileA
(
tmpfile
);
file
=
CreateFileA
(
tmpfile
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_NEW
,
0
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFileA failed %u
\n
"
,
GetLastError
());
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFileA failed %
l
u
\n
"
,
GetLastError
());
WriteFile
(
file
,
test_catalog
,
sizeof
(
test_catalog
),
&
written
,
NULL
);
CloseHandle
(
file
);
...
...
@@ -607,14 +607,14 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
win_skip
(
"Not enough rights
\n
"
);
goto
cleanup
;
}
todo_wine
ok
(
hcatinfo
!=
NULL
,
"CryptCATAdminAddCatalog failed %u
\n
"
,
GetLastError
());
todo_wine
ok
(
hcatinfo
!=
NULL
,
"CryptCATAdminAddCatalog failed %
l
u
\n
"
,
GetLastError
());
info
.
cbStruct
=
sizeof
(
info
);
info
.
wszCatalogFile
[
0
]
=
0
;
ret
=
pCryptCATCatalogInfoFromContext
(
hcatinfo
,
&
info
,
0
);
todo_wine
{
ok
(
ret
,
"CryptCATCatalogInfoFromContext failed %u
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptCATCatalogInfoFromContext failed %
l
u
\n
"
,
GetLastError
());
ok
(
info
.
wszCatalogFile
[
0
]
!=
0
,
"Expected a filename
\n
"
);
}
WideCharToMultiByte
(
CP_ACP
,
0
,
info
.
wszCatalogFile
,
-
1
,
catfile
,
MAX_PATH
,
NULL
,
NULL
);
...
...
@@ -625,11 +625,11 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
/* Set the file attributes so we can check what happens with them during the 'copy' */
attrs
=
FILE_ATTRIBUTE_READONLY
;
ret
=
SetFileAttributesA
(
tmpfile
,
attrs
);
ok
(
ret
,
"SetFileAttributesA failed : %u
\n
"
,
GetLastError
());
ok
(
ret
,
"SetFileAttributesA failed : %
l
u
\n
"
,
GetLastError
());
/* winetest.cat will be created */
hcatinfo
=
pCryptCATAdminAddCatalog
(
hcatadmin
,
tmpfileW
,
basenameW
,
0
);
ok
(
hcatinfo
!=
NULL
,
"CryptCATAdminAddCatalog failed %u
\n
"
,
GetLastError
());
ok
(
hcatinfo
!=
NULL
,
"CryptCATAdminAddCatalog failed %
l
u
\n
"
,
GetLastError
());
lstrcpyA
(
catfilepath
,
catroot
);
lstrcatA
(
catfilepath
,
"
\\
{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}
\\
winetest.cat"
);
...
...
@@ -638,45 +638,45 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
todo_wine
ok
(
attrs
==
FILE_ATTRIBUTE_SYSTEM
||
attrs
==
(
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
|
FILE_ATTRIBUTE_SYSTEM
),
/* Vista */
"File has wrong attributes : %08x
\n
"
,
attrs
);
"File has wrong attributes : %08
l
x
\n
"
,
attrs
);
info
.
cbStruct
=
sizeof
(
info
);
info
.
wszCatalogFile
[
0
]
=
0
;
ret
=
pCryptCATCatalogInfoFromContext
(
hcatinfo
,
&
info
,
0
);
ok
(
ret
,
"CryptCATCatalogInfoFromContext failed %u
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptCATCatalogInfoFromContext failed %
l
u
\n
"
,
GetLastError
());
ok
(
info
.
wszCatalogFile
[
0
]
!=
0
,
"Expected a filename
\n
"
);
WideCharToMultiByte
(
CP_ACP
,
0
,
info
.
wszCatalogFile
,
-
1
,
catfile
,
MAX_PATH
,
NULL
,
NULL
);
if
((
p
=
strrchr
(
catfile
,
'\\'
)))
p
++
;
ok
(
!
lstrcmpA
(
basename
,
p
),
"Expected %s, got %s
\n
"
,
basename
,
p
);
ret
=
pCryptCATAdminReleaseCatalogContext
(
hcatadmin
,
hcatinfo
,
0
);
ok
(
ret
,
"CryptCATAdminReleaseCatalogContext failed %u
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptCATAdminReleaseCatalogContext failed %
l
u
\n
"
,
GetLastError
());
/* Remove the catalog file with the unique name */
ret
=
pCryptCATAdminRemoveCatalog
(
hcatadmin
,
catfileW
,
0
);
ok
(
ret
,
"CryptCATAdminRemoveCatalog failed %u
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptCATAdminRemoveCatalog failed %
l
u
\n
"
,
GetLastError
());
/* Remove the winetest.cat catalog file, first with the full path. This should not succeed
* according to MSDN */
ret
=
pCryptCATAdminRemoveCatalog
(
hcatadmin
,
info
.
wszCatalogFile
,
0
);
ok
(
ret
,
"CryptCATAdminRemoveCatalog failed %u
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptCATAdminRemoveCatalog failed %
l
u
\n
"
,
GetLastError
());
/* The call succeeded with the full path but the file is not removed */
attrs
=
GetFileAttributesA
(
catfilepath
);
ok
(
attrs
!=
INVALID_FILE_ATTRIBUTES
,
"Expected %s to exist
\n
"
,
catfilepath
);
/* Given only the filename the file is removed */
ret
=
pCryptCATAdminRemoveCatalog
(
hcatadmin
,
basenameW
,
0
);
ok
(
ret
,
"CryptCATAdminRemoveCatalog failed %u
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptCATAdminRemoveCatalog failed %
l
u
\n
"
,
GetLastError
());
attrs
=
GetFileAttributesA
(
catfilepath
);
ok
(
attrs
==
INVALID_FILE_ATTRIBUTES
,
"Expected %s to be removed
\n
"
,
catfilepath
);
cleanup:
ret
=
pCryptCATAdminReleaseContext
(
hcatadmin
,
0
);
ok
(
ret
,
"CryptCATAdminReleaseContext failed %u
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptCATAdminReleaseContext failed %
l
u
\n
"
,
GetLastError
());
/* Set the attributes so we can delete the file */
attrs
=
FILE_ATTRIBUTE_NORMAL
;
ret
=
SetFileAttributesA
(
tmpfile
,
attrs
);
ok
(
ret
,
"SetFileAttributesA failed %u
\n
"
,
GetLastError
());
ok
(
ret
,
"SetFileAttributesA failed %
l
u
\n
"
,
GetLastError
());
DeleteFileA
(
tmpfile
);
}
...
...
@@ -705,7 +705,7 @@ static void test_catalog_properties(const char *catfile, int attributes, int mem
trace
(
"Creating the catalog file
\n
"
);
if
(
!
GetTempFileNameA
(
CURR_DIR
,
"cat"
,
0
,
catalog
))
return
;
file
=
CreateFileA
(
catalog
,
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFileA failed %u
\n
"
,
GetLastError
());
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFileA failed %
l
u
\n
"
,
GetLastError
());
WriteFile
(
file
,
test_catalog
,
sizeof
(
test_catalog
),
&
written
,
NULL
);
CloseHandle
(
file
);
...
...
@@ -725,7 +725,7 @@ static void test_catalog_properties(const char *catfile, int attributes, int mem
win_skip
(
"CryptCATOpen on W2K can't handle catalog files with no members
\n
"
);
return
;
}
ok
(
hcat
!=
INVALID_HANDLE_VALUE
,
"CryptCATOpen failed %u
\n
"
,
GetLastError
());
ok
(
hcat
!=
INVALID_HANDLE_VALUE
,
"CryptCATOpen failed %
l
u
\n
"
,
GetLastError
());
m
=
pCryptCATEnumerateMember
(
NULL
,
NULL
);
ok
(
m
==
NULL
,
"CryptCATEnumerateMember succeeded
\n
"
);
...
...
@@ -733,12 +733,12 @@ static void test_catalog_properties(const char *catfile, int attributes, int mem
m
=
NULL
;
while
((
m
=
pCryptCATEnumerateMember
(
hcat
,
m
)))
{
ok
(
m
->
cbStruct
==
sizeof
(
CRYPTCATMEMBER
),
"unexpected size %u
\n
"
,
m
->
cbStruct
);
ok
(
m
->
cbStruct
==
sizeof
(
CRYPTCATMEMBER
),
"unexpected size %
l
u
\n
"
,
m
->
cbStruct
);
todo_wine
ok
(
!
lstrcmpW
(
m
->
pwszReferenceTag
,
hashmeW
),
"unexpected tag
\n
"
);
ok
(
!
memcmp
(
&
m
->
gSubjectType
,
&
subject
,
sizeof
(
subject
)),
"guid differs
\n
"
);
ok
(
!
m
->
fdwMemberFlags
,
"got %x expected 0
\n
"
,
m
->
fdwMemberFlags
);
ok
(
m
->
dwCertVersion
==
0x200
,
"got %x expected 0x200
\n
"
,
m
->
dwCertVersion
);
ok
(
!
m
->
dwReserved
,
"got %x expected 0
\n
"
,
m
->
dwReserved
);
ok
(
!
m
->
fdwMemberFlags
,
"got %
l
x expected 0
\n
"
,
m
->
fdwMemberFlags
);
ok
(
m
->
dwCertVersion
==
0x200
,
"got %
l
x expected 0x200
\n
"
,
m
->
dwCertVersion
);
ok
(
!
m
->
dwReserved
,
"got %
l
x expected 0
\n
"
,
m
->
dwReserved
);
ok
(
m
->
hReserved
==
NULL
,
"got %p expected NULL
\n
"
,
m
->
hReserved
);
attr
=
pCryptCATEnumerateAttr
(
hcat
,
m
,
NULL
);
...
...
@@ -793,7 +793,7 @@ static void test_create_catalog_file(void)
/* Create the cdf file */
file
=
CreateFileA
(
cdffileA
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFileA failed %u
\n
"
,
GetLastError
());
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFileA failed %
l
u
\n
"
,
GetLastError
());
WriteFile
(
file
,
test_cdf
,
sizeof
(
test_cdf
)
-
1
,
&
written
,
NULL
);
CloseHandle
(
file
);
...
...
@@ -804,14 +804,14 @@ static void test_create_catalog_file(void)
todo_wine
{
ok
(
catcdf
!=
NULL
,
"CryptCATCDFOpen failed
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
GetLastError
());
}
ret
=
pCryptCATCDFClose
(
catcdf
);
todo_wine
{
ok
(
ret
,
"Expected success, got FALSE with %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
GetLastError
());
ok
(
ret
,
"Expected success, got FALSE with %
l
d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
GetLastError
());
}
attrs
=
GetFileAttributesA
(
catfileA
);
...
...
@@ -893,15 +893,15 @@ static void create_cdf_file(const CHAR *filename, const CHAR *contents)
DWORD
written
;
file
=
CreateFileA
(
filename
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFileA failed %u
\n
"
,
GetLastError
());
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFileA failed %
l
u
\n
"
,
GetLastError
());
WriteFile
(
file
,
contents
,
lstrlenA
(
contents
),
&
written
,
NULL
);
CloseHandle
(
file
);
}
#define CHECK_EXPECT(a, b) \
do { \
ok(a == error_area, "Expected %08x, got %08x\n", a, error_area); \
ok(b == local_error, "Expected %08x, got %08x\n", b, local_error); \
ok(a == error_area, "Expected %08x, got %08
l
x\n", a, error_area); \
ok(b == local_error, "Expected %08x, got %08
l
x\n", b, local_error); \
} while (0)
/* Clear the variables (can't use 0) */
...
...
@@ -940,7 +940,7 @@ static void test_cdf_parsing(void)
CHECK_EXPECT
(
CRYPTCAT_E_AREA_HEADER
,
CRYPTCAT_E_CDF_TAGNOTFOUND
);
ok
(
catcdf
==
NULL
,
"CryptCATCDFOpen succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
GetLastError
());
DeleteFileA
(
cdffileA
);
ok
(
!
DeleteFileA
(
catfileA
),
"Didn't expect a catalog file to be created
\n
"
);
...
...
@@ -954,7 +954,7 @@ static void test_cdf_parsing(void)
ok
(
catcdf
==
NULL
,
"CryptCATCDFOpen succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_SHARING_VIOLATION
,
"Expected ERROR_SHARING_VIOLATION, got %d
\n
"
,
GetLastError
());
"Expected ERROR_SHARING_VIOLATION, got %
l
d
\n
"
,
GetLastError
());
DeleteFileA
(
cdffileA
);
/* Header and member only */
...
...
@@ -969,7 +969,7 @@ static void test_cdf_parsing(void)
ok
(
catcdf
==
NULL
,
"CryptCATCDFOpen succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_SHARING_VIOLATION
,
"Expected ERROR_SHARING_VIOLATION, got %d
\n
"
,
GetLastError
());
"Expected ERROR_SHARING_VIOLATION, got %
l
d
\n
"
,
GetLastError
());
DeleteFileA
(
cdffileA
);
ok
(
!
DeleteFileA
(
catfileA
),
"Didn't expect a catalog file to be created
\n
"
);
...
...
@@ -984,7 +984,7 @@ static void test_cdf_parsing(void)
ok
(
catcdf
==
NULL
,
"CryptCATCDFOpen succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_SHARING_VIOLATION
,
"Expected ERROR_SHARING_VIOLATION, got %d
\n
"
,
GetLastError
());
"Expected ERROR_SHARING_VIOLATION, got %
l
d
\n
"
,
GetLastError
());
DeleteFileA
(
cdffileA
);
ok
(
!
DeleteFileA
(
catfileA
),
"Didn't expect a catalog file to be created
\n
"
);
...
...
@@ -999,7 +999,7 @@ static void test_cdf_parsing(void)
todo_wine
{
ok
(
catcdf
!=
NULL
,
"CryptCATCDFOpen failed
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
GetLastError
());
}
pCryptCATCDFClose
(
catcdf
);
DeleteFileA
(
cdffileA
);
...
...
@@ -1019,7 +1019,7 @@ static void test_cdf_parsing(void)
todo_wine
{
ok
(
catcdf
!=
NULL
,
"CryptCATCDFOpen failed
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
GetLastError
());
}
/* Loop through the members */
CLEAR_EXPECT
;
...
...
@@ -1046,7 +1046,7 @@ static void test_cdf_parsing(void)
todo_wine
{
ok
(
catcdf
!=
NULL
,
"CryptCATCDFOpen failed
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
GetLastError
());
}
/* Loop through the members */
CLEAR_EXPECT
;
...
...
@@ -1054,9 +1054,9 @@ static void test_cdf_parsing(void)
catmembertag
=
NULL
;
while
((
catmembertag
=
pCryptCATCDFEnumMembersByCDFTagEx
(
catcdf
,
catmembertag
,
cdf_callback
,
&
catmember
,
FALSE
,
NULL
)))
;
ok
(
error_area
==
0xffffffff
||
broken
(
error_area
==
CRYPTCAT_E_AREA_MEMBER
)
/* < win81 */
,
"Expected area 0xffffffff, got %08x
\n
"
,
error_area
);
"Expected area 0xffffffff, got %08
l
x
\n
"
,
error_area
);
ok
(
local_error
==
0xffffffff
||
broken
(
local_error
==
CRYPTCAT_E_CDF_MEMBER_FILE_PATH
)
/* < win81 */
,
"Expected error 0xffffffff, got %08x
\n
"
,
local_error
);
"Expected error 0xffffffff, got %08
l
x
\n
"
,
local_error
);
pCryptCATCDFClose
(
catcdf
);
DeleteFileA
(
cdffileA
);
...
...
@@ -1077,7 +1077,7 @@ static void test_cdf_parsing(void)
todo_wine
{
ok
(
catcdf
!=
NULL
,
"CryptCATCDFOpen failed
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
GetLastError
());
}
/* Loop through the members */
SET_UNEXPECTED
;
...
...
@@ -1102,7 +1102,7 @@ static void test_cdf_parsing(void)
todo_wine
{
ok
(
catcdf
!=
NULL
,
"CryptCATCDFOpen failed
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
GetLastError
());
}
/* Loop through the attributes */
CLEAR_EXPECT
;
...
...
@@ -1130,7 +1130,7 @@ static void test_cdf_parsing(void)
todo_wine
{
ok
(
catcdf
!=
NULL
,
"CryptCATCDFOpen failed
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
GetLastError
());
}
/* Loop through the members */
SET_UNEXPECTED
;
...
...
@@ -1162,7 +1162,7 @@ static void test_cdf_parsing(void)
todo_wine
{
ok
(
catcdf
!=
NULL
,
"CryptCATCDFOpen failed
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
GetLastError
());
}
/* Loop through the members */
SET_UNEXPECTED
;
...
...
@@ -1266,26 +1266,26 @@ static void test_sip(void)
info
.
cbSize
=
sizeof
(
SIP_SUBJECTINFO
);
info
.
pgSubjectType
=
&
guid
;
ret
=
CryptSIPRetrieveSubjectGuid
(
NULL
,
file
,
info
.
pgSubjectType
);
ok
(
ret
,
"CryptSIPRetrieveSubjectGuid failed (%x)
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptSIPRetrieveSubjectGuid failed (%
l
x)
\n
"
,
GetLastError
());
ret
=
pPutSignedDataMsg
(
&
info
,
X509_ASN_ENCODING
,
&
index
,
4
,
(
BYTE
*
)
"test"
);
ok
(
!
ret
,
"CryptSIPPutSignedDataMsg succeeded
\n
"
);
index
=
GetLastError
();
ok
(
index
==
ERROR_PATH_NOT_FOUND
,
"GetLastError returned %x
\n
"
,
index
);
ok
(
index
==
ERROR_PATH_NOT_FOUND
,
"GetLastError returned %
l
x
\n
"
,
index
);
info
.
hFile
=
file
;
info
.
pwsFileName
=
nameW
;
ret
=
pPutSignedDataMsg
(
&
info
,
X509_ASN_ENCODING
,
&
index
,
4
,
(
BYTE
*
)
"test"
);
ok
(
!
ret
,
"CryptSIPPutSignedDataMsg succeeded
\n
"
);
index
=
GetLastError
();
todo_wine
ok
(
index
==
ERROR_INVALID_PARAMETER
,
"GetLastError returned %x
\n
"
,
index
);
todo_wine
ok
(
index
==
ERROR_INVALID_PARAMETER
,
"GetLastError returned %
l
x
\n
"
,
index
);
info
.
hFile
=
INVALID_HANDLE_VALUE
;
info
.
pwsFileName
=
nameW
;
ret
=
pPutSignedDataMsg
(
&
info
,
X509_ASN_ENCODING
,
&
index
,
4
,
(
BYTE
*
)
"test"
);
ok
(
!
ret
,
"CryptSIPPutSignedDataMsg succeeded
\n
"
);
index
=
GetLastError
();
ok
(
index
==
ERROR_SHARING_VIOLATION
,
"GetLastError returned %x
\n
"
,
index
);
ok
(
index
==
ERROR_SHARING_VIOLATION
,
"GetLastError returned %
l
x
\n
"
,
index
);
CloseHandle
(
file
);
file
=
CreateFileW
(
nameW
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
...
...
@@ -1293,8 +1293,8 @@ static void test_sip(void)
info
.
hFile
=
file
;
info
.
pwsFileName
=
(
void
*
)
0xdeadbeef
;
ret
=
pPutSignedDataMsg
(
&
info
,
X509_ASN_ENCODING
,
&
index
,
4
,
(
BYTE
*
)
"test"
);
ok
(
ret
,
"CryptSIPPutSignedDataMsg failed (%x)
\n
"
,
GetLastError
());
ok
(
index
==
0
,
"index = %x
\n
"
,
index
);
ok
(
ret
,
"CryptSIPPutSignedDataMsg failed (%
l
x)
\n
"
,
GetLastError
());
ok
(
index
==
0
,
"index = %
l
x
\n
"
,
index
);
CloseHandle
(
file
);
file
=
CreateFileW
(
nameW
,
GENERIC_READ
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
...
...
@@ -1302,33 +1302,33 @@ static void test_sip(void)
info
.
hFile
=
INVALID_HANDLE_VALUE
;
info
.
pwsFileName
=
nameW
;
ret
=
pPutSignedDataMsg
(
&
info
,
X509_ASN_ENCODING
,
&
index
,
14
,
(
BYTE
*
)
"longer message"
);
ok
(
ret
,
"CryptSIPPutSignedDataMsg failed (%x)
\n
"
,
GetLastError
());
ok
(
index
==
1
,
"index = %x
\n
"
,
index
);
ok
(
ret
,
"CryptSIPPutSignedDataMsg failed (%
l
x)
\n
"
,
GetLastError
());
ok
(
index
==
1
,
"index = %
l
x
\n
"
,
index
);
size
=
0
;
encoding
=
0xdeadbeef
;
ret
=
pGetSignedDataMsg
(
&
info
,
&
encoding
,
0
,
&
size
,
NULL
);
ok
(
ret
,
"CryptSIPGetSignedDataMsg failed (%x)
\n
"
,
GetLastError
());
ok
(
encoding
==
0xdeadbeef
,
"encoding = %x
\n
"
,
encoding
);
ok
(
size
==
16
,
"size = %d
\n
"
,
size
);
ok
(
ret
,
"CryptSIPGetSignedDataMsg failed (%
l
x)
\n
"
,
GetLastError
());
ok
(
encoding
==
0xdeadbeef
,
"encoding = %
l
x
\n
"
,
encoding
);
ok
(
size
==
16
,
"size = %
l
d
\n
"
,
size
);
ret
=
pGetSignedDataMsg
(
&
info
,
&
encoding
,
0
,
&
size
,
(
BYTE
*
)
buf
);
ok
(
ret
,
"CryptSIPGetSignedDataMsg failed (%x)
\n
"
,
GetLastError
());
ok
(
encoding
==
(
X509_ASN_ENCODING
|
PKCS_7_ASN_ENCODING
),
"encoding = %x
\n
"
,
encoding
);
ok
(
size
==
8
,
"size = %d
\n
"
,
size
);
ok
(
ret
,
"CryptSIPGetSignedDataMsg failed (%
l
x)
\n
"
,
GetLastError
());
ok
(
encoding
==
(
X509_ASN_ENCODING
|
PKCS_7_ASN_ENCODING
),
"encoding = %
l
x
\n
"
,
encoding
);
ok
(
size
==
8
,
"size = %
l
d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
"test
\0\0\0\0
"
,
8
),
"buf = %s
\n
"
,
buf
);
size
=
0
;
encoding
=
0xdeadbeef
;
ret
=
pGetSignedDataMsg
(
&
info
,
&
encoding
,
1
,
&
size
,
NULL
);
ok
(
ret
,
"CryptSIPGetSignedDataMsg failed (%x)
\n
"
,
GetLastError
());
ok
(
encoding
==
0xdeadbeef
,
"encoding = %x
\n
"
,
encoding
);
ok
(
size
==
24
,
"size = %d
\n
"
,
size
);
ok
(
ret
,
"CryptSIPGetSignedDataMsg failed (%
l
x)
\n
"
,
GetLastError
());
ok
(
encoding
==
0xdeadbeef
,
"encoding = %
l
x
\n
"
,
encoding
);
ok
(
size
==
24
,
"size = %
l
d
\n
"
,
size
);
ret
=
pGetSignedDataMsg
(
&
info
,
&
encoding
,
1
,
&
size
,
(
BYTE
*
)
buf
);
ok
(
ret
,
"CryptSIPGetSignedDataMsg failed (%x)
\n
"
,
GetLastError
());
ok
(
encoding
==
(
X509_ASN_ENCODING
|
PKCS_7_ASN_ENCODING
),
"encoding = %x
\n
"
,
encoding
);
ok
(
size
==
16
,
"size = %d
\n
"
,
size
);
ok
(
ret
,
"CryptSIPGetSignedDataMsg failed (%
l
x)
\n
"
,
GetLastError
());
ok
(
encoding
==
(
X509_ASN_ENCODING
|
PKCS_7_ASN_ENCODING
),
"encoding = %
l
x
\n
"
,
encoding
);
ok
(
size
==
16
,
"size = %
l
d
\n
"
,
size
);
ok
(
!
strcmp
(
buf
,
"longer message"
),
"buf = %s
\n
"
,
buf
);
CryptReleaseContext
(
info
.
hProv
,
0
);
...
...
dlls/wintrust/tests/register.c
View file @
457044cb
...
...
@@ -76,7 +76,7 @@ static void test_AddRem_ActionID(void)
ok
(
!
ret
,
"Expected WintrustAddActionID to fail.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
/* XP/W2K3 */
||
GetLastError
()
==
0xdeadbeef
/* Win98/NT4/W2K */
,
"Expected ERROR_INVALID_PARAMETER(W2K3) or 0xdeadbeef(Win98/NT4/W2K), got %u.
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER(W2K3) or 0xdeadbeef(Win98/NT4/W2K), got %
l
u.
\n
"
,
GetLastError
());
/* NULL functions */
SetLastError
(
0xdeadbeef
);
...
...
@@ -84,7 +84,7 @@ static void test_AddRem_ActionID(void)
ok
(
!
ret
,
"Expected WintrustAddActionID to fail.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
/* XP/W2K3 */
||
GetLastError
()
==
0xdeadbeef
/* Win98/NT4/W2K */
,
"Expected ERROR_INVALID_PARAMETER(W2K3) or 0xdeadbeef(Win98/NT4/W2K), got %u.
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER(W2K3) or 0xdeadbeef(Win98/NT4/W2K), got %
l
u.
\n
"
,
GetLastError
());
/* All OK (although no functions defined), except cbStruct is not set in ActionIDFunctions */
SetLastError
(
0xdeadbeef
);
...
...
@@ -93,7 +93,7 @@ static void test_AddRem_ActionID(void)
ok
(
!
ret
,
"Expected WintrustAddActionID to fail.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
/* XP/W2K3 */
||
GetLastError
()
==
0xdeadbeef
/* Win98/NT4/W2K */
,
"Expected ERROR_INVALID_PARAMETER(W2K3) or 0xdeadbeef(Win98/NT4/W2K), got %u.
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER(W2K3) or 0xdeadbeef(Win98/NT4/W2K), got %
l
u.
\n
"
,
GetLastError
());
/* All OK (although no functions defined) and cbStruct is set now */
SetLastError
(
0xdeadbeef
);
...
...
@@ -102,7 +102,7 @@ static void test_AddRem_ActionID(void)
ret
=
pWintrustAddActionID
(
&
ActionID
,
0
,
&
ActionIDFunctions
);
ok
(
ret
,
"Expected WintrustAddActionID to succeed.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %u.
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %
l
u.
\n
"
,
GetLastError
());
/* All OK and all (but 1) functions are correctly defined. The DLL and entrypoints
* are not present.
...
...
@@ -122,7 +122,7 @@ static void test_AddRem_ActionID(void)
ok
(
ret
,
"Expected WintrustAddActionID to succeed.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"Expected ERROR_INVALID_PARAMETER or ERROR_ACCESS_DENIED, got %u.
\n
"
,
"Expected ERROR_INVALID_PARAMETER or ERROR_ACCESS_DENIED, got %
l
u.
\n
"
,
GetLastError
());
/* All OK and all functions are correctly defined. The DLL and entrypoints
...
...
@@ -142,27 +142,27 @@ static void test_AddRem_ActionID(void)
ret
=
pWintrustAddActionID
(
&
ActionID
,
0
,
&
ActionIDFunctions
);
ok
(
ret
,
"Expected WintrustAddActionID to succeed.
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
||
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"Expected 0xdeadbeef or ERROR_ACCESS_DENIED, got %u.
\n
"
,
"Expected 0xdeadbeef or ERROR_ACCESS_DENIED, got %
l
u.
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pWintrustRemoveActionID
(
&
ActionID
);
ok
(
ret
,
"WintrustRemoveActionID failed : %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
0xdeadbeef
,
"Last error should not have been changed: %u
\n
"
,
GetLastError
());
ok
(
ret
,
"WintrustRemoveActionID failed : %
l
d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
0xdeadbeef
,
"Last error should not have been changed: %
l
u
\n
"
,
GetLastError
());
/* NULL input */
SetLastError
(
0xdeadbeef
);
ret
=
pWintrustRemoveActionID
(
NULL
);
ok
(
ret
,
"Expected WintrustRemoveActionID to succeed.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %u.
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %
l
u.
\n
"
,
GetLastError
());
/* The passed GUID is removed by a previous call, so it's basically a test with a nonexistent Trust provider */
SetLastError
(
0xdeadbeef
);
ret
=
pWintrustRemoveActionID
(
&
ActionID
);
ok
(
ret
,
"Expected WintrustRemoveActionID to succeed.
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %u.
\n
"
,
GetLastError
());
"Expected 0xdeadbeef, got %
l
u.
\n
"
,
GetLastError
());
}
static
void
test_AddDefaultForUsage
(
void
)
...
...
@@ -185,14 +185,14 @@ static void test_AddDefaultForUsage(void)
ret
=
pWintrustAddDefaultForUsage
(
NULL
,
NULL
);
ok
(
!
ret
,
"Expected WintrustAddDefaultForUsage to fail.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %u.
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %
l
u.
\n
"
,
GetLastError
());
/* NULL defusage */
SetLastError
(
0xdeadbeef
);
ret
=
pWintrustAddDefaultForUsage
(
oid
,
NULL
);
ok
(
!
ret
,
"Expected WintrustAddDefaultForUsage to fail.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %u.
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %
l
u.
\n
"
,
GetLastError
());
/* NULL oid and proper defusage */
memset
(
&
DefUsage
,
0
,
sizeof
(
CRYPT_PROVIDER_REGDEFUSAGE
));
...
...
@@ -205,7 +205,7 @@ static void test_AddDefaultForUsage(void)
ret
=
pWintrustAddDefaultForUsage
(
NULL
,
&
DefUsage
);
ok
(
!
ret
,
"Expected WintrustAddDefaultForUsage to fail.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %u.
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %
l
u.
\n
"
,
GetLastError
());
/* cbStruct set to 0 */
memset
(
&
DefUsage
,
0
,
sizeof
(
CRYPT_PROVIDER_REGDEFUSAGE
));
...
...
@@ -218,7 +218,7 @@ static void test_AddDefaultForUsage(void)
ret
=
pWintrustAddDefaultForUsage
(
oid
,
&
DefUsage
);
ok
(
!
ret
,
"Expected WintrustAddDefaultForUsage to fail.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %u.
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %
l
u.
\n
"
,
GetLastError
());
}
static
void
test_LoadFunctionPointers
(
void
)
...
...
@@ -244,7 +244,7 @@ static void test_LoadFunctionPointers(void)
ok
(
!
ret
,
"WintrustLoadFunctionPointers succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
GetLastError
()
==
0xdeadbeef
/* W2K and XP-SP1 */
,
"Expected ERROR_INVALID_PARAMETER or 0xdeadbeef, got %d
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER or 0xdeadbeef, got %
l
d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
funcs
.
cbStruct
=
0
;
...
...
@@ -253,7 +253,7 @@ static void test_LoadFunctionPointers(void)
SetLastError
(
0xdeadbeef
);
funcs
.
cbStruct
=
sizeof
(
funcs
);
ret
=
pWintrustLoadFunctionPointers
(
&
action
,
&
funcs
);
ok
(
ret
,
"WintrustLoadFunctionPointers failed: %d
\n
"
,
GetLastError
());
ok
(
ret
,
"WintrustLoadFunctionPointers failed: %
l
d
\n
"
,
GetLastError
());
ok
(
funcs
.
pfnAlloc
!=
NULL
,
"Expected a pointer
\n
"
);
ok
(
funcs
.
pfnFree
!=
NULL
,
"Expected a pointer
\n
"
);
}
...
...
@@ -286,21 +286,21 @@ static void test_RegPolicyFlags(void)
r
=
RegOpenKeyExA
(
HKEY_CURRENT_USER
,
Software_Publishing
,
0
,
KEY_ALL_ACCESS
,
&
key
);
ok
(
!
r
,
"RegOpenKeyEx failed: %d
\n
"
,
r
);
ok
(
!
r
,
"RegOpenKeyEx failed: %
l
d
\n
"
,
r
);
size
=
sizeof
(
flags1
);
r
=
RegQueryValueExA
(
key
,
State
,
NULL
,
NULL
,
(
LPBYTE
)
&
flags1
,
&
size
);
ok
(
!
r
||
r
==
ERROR_FILE_NOT_FOUND
,
"RegQueryValueEx failed: %d
\n
"
,
r
);
ok
(
!
r
||
r
==
ERROR_FILE_NOT_FOUND
,
"RegQueryValueEx failed: %
l
d
\n
"
,
r
);
if
(
!
r
)
ok
(
flags1
==
flags2
,
"Got %08
x flags instead of %08
x
\n
"
,
flags1
,
flags2
);
ok
(
flags1
==
flags2
,
"Got %08
lx flags instead of %08l
x
\n
"
,
flags1
,
flags2
);
flags3
=
flags2
|
1
;
ret
=
pWintrustSetRegPolicyFlags
(
flags3
);
ok
(
ret
,
"WintrustSetRegPolicyFlags failed: %d
\n
"
,
GetLastError
());
ok
(
ret
,
"WintrustSetRegPolicyFlags failed: %
l
d
\n
"
,
GetLastError
());
size
=
sizeof
(
flags1
);
r
=
RegQueryValueExA
(
key
,
State
,
NULL
,
NULL
,
(
LPBYTE
)
&
flags1
,
&
size
);
ok
(
!
r
,
"RegQueryValueEx failed: %d
\n
"
,
r
);
ok
(
flags1
==
flags3
,
"Got %08
x flags instead of %08
x
\n
"
,
flags1
,
flags3
);
ok
(
!
r
,
"RegQueryValueEx failed: %
l
d
\n
"
,
r
);
ok
(
flags1
==
flags3
,
"Got %08
lx flags instead of %08l
x
\n
"
,
flags1
,
flags3
);
pWintrustSetRegPolicyFlags
(
flags2
);
...
...
dlls/wintrust/tests/softpub.c
View file @
457044cb
...
...
@@ -138,8 +138,8 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs)
if
(
store
)
{
ret
=
funcs
->
pfnAddStore2Chain
(
&
data
,
store
);
ok
(
ret
,
"pfnAddStore2Chain failed: %08x
\n
"
,
GetLastError
());
ok
(
data
.
chStores
==
1
,
"Expected 1 store, got %d
\n
"
,
data
.
chStores
);
ok
(
ret
,
"pfnAddStore2Chain failed: %08
l
x
\n
"
,
GetLastError
());
ok
(
data
.
chStores
==
1
,
"Expected 1 store, got %
l
d
\n
"
,
data
.
chStores
);
ok
(
data
.
pahStores
!=
NULL
,
"Expected pahStores to be allocated
\n
"
);
if
(
data
.
pahStores
)
{
...
...
@@ -153,15 +153,15 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs)
}
}
else
skip
(
"CertOpenStore failed: %08x
\n
"
,
GetLastError
());
skip
(
"CertOpenStore failed: %08
l
x
\n
"
,
GetLastError
());
/* Crash
ret = funcs->pfnAddSgnr2Chain(NULL, FALSE, 0, NULL);
ret = funcs->pfnAddSgnr2Chain(&data, FALSE, 0, NULL);
*/
ret
=
funcs
->
pfnAddSgnr2Chain
(
&
data
,
FALSE
,
0
,
&
sgnr
);
ok
(
ret
,
"pfnAddSgnr2Chain failed: %08x
\n
"
,
GetLastError
());
ok
(
data
.
csSigners
==
1
,
"Expected 1 signer, got %d
\n
"
,
data
.
csSigners
);
ok
(
ret
,
"pfnAddSgnr2Chain failed: %08
l
x
\n
"
,
GetLastError
());
ok
(
data
.
csSigners
==
1
,
"Expected 1 signer, got %
l
d
\n
"
,
data
.
csSigners
);
ok
(
data
.
pasSigners
!=
NULL
,
"Expected pasSigners to be allocated
\n
"
);
if
(
data
.
pasSigners
)
{
...
...
@@ -173,15 +173,15 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs)
sgnr
.
cbStruct
=
sizeof
(
CRYPT_PROVIDER_SGNR
);
sgnr
.
sftVerifyAsOf
.
dwLowDateTime
=
0xdeadbeef
;
ret
=
funcs
->
pfnAddSgnr2Chain
(
&
data
,
FALSE
,
1
,
&
sgnr
);
ok
(
ret
,
"pfnAddSgnr2Chain failed: %08x
\n
"
,
GetLastError
());
ok
(
data
.
csSigners
==
2
,
"Expected 2 signers, got %d
\n
"
,
data
.
csSigners
);
ok
(
ret
,
"pfnAddSgnr2Chain failed: %08
l
x
\n
"
,
GetLastError
());
ok
(
data
.
csSigners
==
2
,
"Expected 2 signers, got %
l
d
\n
"
,
data
.
csSigners
);
ok
(
!
memcmp
(
&
data
.
pasSigners
[
1
],
&
sgnr
,
sizeof
(
sgnr
)),
"Unexpected data in signer
\n
"
);
/* This also adds, but the index is ignored */
sgnr
.
cbStruct
=
sizeof
(
DWORD
);
ret
=
funcs
->
pfnAddSgnr2Chain
(
&
data
,
FALSE
,
0
,
&
sgnr
);
ok
(
ret
,
"pfnAddSgnr2Chain failed: %08x
\n
"
,
GetLastError
());
ok
(
data
.
csSigners
==
3
,
"Expected 3 signers, got %d
\n
"
,
data
.
csSigners
);
ok
(
ret
,
"pfnAddSgnr2Chain failed: %08
l
x
\n
"
,
GetLastError
());
ok
(
data
.
csSigners
==
3
,
"Expected 3 signers, got %
l
d
\n
"
,
data
.
csSigners
);
sgnr
.
sftVerifyAsOf
.
dwLowDateTime
=
0
;
todo_wine
ok
(
!
memcmp
(
&
data
.
pasSigners
[
2
],
&
sgnr
,
sizeof
(
sgnr
)),
...
...
@@ -191,7 +191,7 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs)
SetLastError
(
0xdeadbeef
);
ret
=
funcs
->
pfnAddSgnr2Chain
(
&
data
,
FALSE
,
0
,
&
sgnr
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
/* Crash
ret = funcs->pfnAddCert2Chain(NULL, 0, FALSE, 0, NULL);
...
...
@@ -206,8 +206,8 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs)
* 2. An invalid signer index isn't checked.
*/
ret
=
funcs
->
pfnAddCert2Chain
(
&
data
,
0
,
FALSE
,
0
,
cert
);
ok
(
ret
,
"pfnAddCert2Chain failed: %08x
\n
"
,
GetLastError
());
ok
(
data
.
pasSigners
[
0
].
csCertChain
==
1
,
"Expected 1 cert, got %d
\n
"
,
ok
(
ret
,
"pfnAddCert2Chain failed: %08
l
x
\n
"
,
GetLastError
());
ok
(
data
.
pasSigners
[
0
].
csCertChain
==
1
,
"Expected 1 cert, got %
l
d
\n
"
,
data
.
pasSigners
[
0
].
csCertChain
);
ok
(
data
.
pasSigners
[
0
].
pasCertChain
!=
NULL
,
"Expected pasCertChain to be allocated
\n
"
);
...
...
@@ -221,7 +221,7 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs)
CertFreeCertificateContext
(
cert
);
}
else
skip
(
"CertCreateCertificateContext failed: %08x
\n
"
,
GetLastError
());
skip
(
"CertCreateCertificateContext failed: %08
l
x
\n
"
,
GetLastError
());
funcs
->
pfnFree
(
data
.
pasSigners
);
}
}
...
...
@@ -243,7 +243,7 @@ static void testInitialize(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
*/
memset
(
&
data
,
0
,
sizeof
(
data
));
ret
=
funcs
->
pfnInitialize
(
&
data
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08
l
x
\n
"
,
ret
);
data
.
padwTrustStepErrors
=
funcs
->
pfnAlloc
(
TRUSTERROR_MAX_STEPS
*
sizeof
(
DWORD
));
/* Without wintrust data set, crashes when padwTrustStepErrors is set */
...
...
@@ -254,17 +254,17 @@ static void testInitialize(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
memset
(
data
.
padwTrustStepErrors
,
0
,
TRUSTERROR_MAX_STEPS
*
sizeof
(
DWORD
));
ret
=
funcs
->
pfnInitialize
(
&
data
);
ok
(
ret
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_OK
,
"Expected S_OK, got %08
l
x
\n
"
,
ret
);
data
.
cdwTrustStepErrors
=
1
;
ret
=
funcs
->
pfnInitialize
(
&
data
);
ok
(
ret
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_OK
,
"Expected S_OK, got %08
l
x
\n
"
,
ret
);
memset
(
data
.
padwTrustStepErrors
,
0xba
,
TRUSTERROR_MAX_STEPS
*
sizeof
(
DWORD
));
ret
=
funcs
->
pfnInitialize
(
&
data
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08
l
x
\n
"
,
ret
);
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_WVTINIT
]
=
0
;
ret
=
funcs
->
pfnInitialize
(
&
data
);
ok
(
ret
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_OK
,
"Expected S_OK, got %08
l
x
\n
"
,
ret
);
funcs
->
pfnFree
(
data
.
padwTrustStepErrors
);
}
}
...
...
@@ -333,28 +333,28 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
0x00
,
0x00
,
0x00
,
0x00
,
0x00
}
};
ret
=
funcs
->
pfnObjectTrust
(
&
data
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08
l
x
\n
"
,
ret
);
ok
(
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %08x
\n
"
,
"Expected ERROR_INVALID_PARAMETER, got %08
l
x
\n
"
,
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]);
U
(
wintrust_data
).
pCert
=
&
certInfo
;
wintrust_data
.
dwUnionChoice
=
WTD_CHOICE_CERT
;
ret
=
funcs
->
pfnObjectTrust
(
&
data
);
ok
(
ret
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_OK
,
"Expected S_OK, got %08
l
x
\n
"
,
ret
);
certInfo
.
psCertContext
=
(
PCERT_CONTEXT
)
CertCreateCertificateContext
(
X509_ASN_ENCODING
,
v1CertWithPubKey
,
sizeof
(
v1CertWithPubKey
));
ret
=
funcs
->
pfnObjectTrust
(
&
data
);
ok
(
ret
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_OK
,
"Expected S_OK, got %08
l
x
\n
"
,
ret
);
CertFreeCertificateContext
(
certInfo
.
psCertContext
);
certInfo
.
psCertContext
=
NULL
;
wintrust_data
.
dwUnionChoice
=
WTD_CHOICE_FILE
;
U
(
wintrust_data
).
pFile
=
NULL
;
ret
=
funcs
->
pfnObjectTrust
(
&
data
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08
l
x
\n
"
,
ret
);
ok
(
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %08x
\n
"
,
"Expected ERROR_INVALID_PARAMETER, got %08
l
x
\n
"
,
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]);
U
(
wintrust_data
).
pFile
=
&
fileInfo
;
/* Crashes
...
...
@@ -366,19 +366,19 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
U
(
data
).
pPDSip
=
&
provDataSIP
;
data
.
psPfns
=
(
CRYPT_PROVIDER_FUNCTIONS
*
)
funcs
;
ret
=
funcs
->
pfnObjectTrust
(
&
data
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08
l
x
\n
"
,
ret
);
ok
(
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]
==
TRUST_E_SUBJECT_FORM_UNKNOWN
,
"expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08x
\n
"
,
"expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08
l
x
\n
"
,
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]);
CloseHandle
(
fileInfo
.
hFile
);
fileInfo
.
hFile
=
NULL
;
fileInfo
.
pcwszFilePath
=
pathW
;
ret
=
funcs
->
pfnObjectTrust
(
&
data
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08
l
x
\n
"
,
ret
);
ok
(
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]
==
TRUST_E_SUBJECT_FORM_UNKNOWN
,
"expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08x
\n
"
,
"expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08
l
x
\n
"
,
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]);
DeleteFileW
(
pathW
);
/* Test again with a file we expect to exist, and to contain no
...
...
@@ -386,12 +386,12 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
*/
getNotepadPath
(
pathW
,
MAX_PATH
);
ret
=
funcs
->
pfnObjectTrust
(
&
data
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08
l
x
\n
"
,
ret
);
ok
(
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]
==
TRUST_E_NOSIGNATURE
||
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]
==
TRUST_E_SUBJECT_FORM_UNKNOWN
,
"Expected TRUST_E_NOSIGNATURE or TRUST_E_SUBJECT_FORM_UNKNOWN, got %08x
\n
"
,
"Expected TRUST_E_NOSIGNATURE or TRUST_E_SUBJECT_FORM_UNKNOWN, got %08
l
x
\n
"
,
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]);
if
(
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]
==
TRUST_E_NOSIGNATURE
)
...
...
@@ -405,14 +405,14 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
/* Specifying the GUID results in that GUID being the subject GUID */
fileInfo
.
pgKnownSubject
=
&
bogusGuid
;
ret
=
funcs
->
pfnObjectTrust
(
&
data
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08
l
x
\n
"
,
ret
);
ok
(
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]
==
TRUST_E_NOSIGNATURE
||
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]
==
TRUST_E_SUBJECT_FORM_UNKNOWN
||
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]
==
TRUST_E_PROVIDER_UNKNOWN
,
"Expected TRUST_E_NOSIGNATURE or TRUST_E_SUBJECT_FORM_UNKNOWN or TRUST_E_PROVIDER_UNKNOWN, got %08x
\n
"
,
"Expected TRUST_E_NOSIGNATURE or TRUST_E_SUBJECT_FORM_UNKNOWN or TRUST_E_PROVIDER_UNKNOWN, got %08
l
x
\n
"
,
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]);
if
(
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]
==
TRUST_E_NOSIGNATURE
)
...
...
@@ -425,7 +425,7 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
{
fileInfo
.
pgKnownSubject
=
(
GUID
*
)
0xdeadbeef
;
ret
=
funcs
->
pfnObjectTrust
(
&
data
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08
l
x
\n
"
,
ret
);
}
funcs
->
pfnFree
(
data
.
padwTrustStepErrors
);
}
...
...
@@ -568,9 +568,9 @@ static void testCertTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
return
;
}
ret
=
funcs
->
pfnCertificateTrust
(
&
data
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08
l
x
\n
"
,
ret
);
ok
(
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_CERTPROV
]
==
TRUST_E_NOSIGNATURE
,
"Expected TRUST_E_NOSIGNATURE, got %08x
\n
"
,
TRUST_E_NOSIGNATURE
,
"Expected TRUST_E_NOSIGNATURE, got %08
l
x
\n
"
,
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_CERTPROV
]);
b
=
funcs
->
pfnAddSgnr2Chain
(
&
data
,
FALSE
,
0
,
&
sgnr
);
if
(
b
)
...
...
@@ -579,7 +579,7 @@ static void testCertTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
/* An empty signer "succeeds," even though there's no cert */
ret
=
funcs
->
pfnCertificateTrust
(
&
data
);
ok
(
ret
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
ret
);
ok
(
ret
==
S_OK
,
"Expected S_OK, got %08
l
x
\n
"
,
ret
);
cert
=
CertCreateCertificateContext
(
X509_ASN_ENCODING
,
selfSignedCert
,
sizeof
(
selfSignedCert
));
if
(
cert
)
...
...
@@ -598,13 +598,13 @@ static void testCertTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
*/
data
.
psPfns
=
(
CRYPT_PROVIDER_FUNCTIONS
*
)
funcs
;
ret
=
funcs
->
pfnCertificateTrust
(
&
data
);
ok
(
ret
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
ret
);
ok
(
data
.
csSigners
==
1
,
"Unexpected number of signers %d
\n
"
,
ok
(
ret
==
S_OK
,
"Expected S_OK, got %08
l
x
\n
"
,
ret
);
ok
(
data
.
csSigners
==
1
,
"Unexpected number of signers %
l
d
\n
"
,
data
.
csSigners
);
ok
(
data
.
pasSigners
[
0
].
pChainContext
!=
NULL
,
"Expected a certificate chain
\n
"
);
ok
(
data
.
pasSigners
[
0
].
csCertChain
==
1
,
"Unexpected number of chain elements %d
\n
"
,
"Unexpected number of chain elements %
l
d
\n
"
,
data
.
pasSigners
[
0
].
csCertChain
);
/* pasSigners and pasSigners[0].pasCertChain are guaranteed to be
* initialized, see tests for pfnAddSgnr2Chain and pfnAddCert2Chain
...
...
@@ -615,7 +615,7 @@ static void testCertTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
"Expected cert to be self-signed
\n
"
);
ok
(
data
.
pasSigners
[
0
].
pasCertChain
[
0
].
dwConfidence
==
(
CERT_CONFIDENCE_SIG
|
CERT_CONFIDENCE_TIMENEST
),
"Expected CERT_CONFIDENCE_SIG | CERT_CONFIDENCE_TIMENEST, got %08x
\n
"
,
"Expected CERT_CONFIDENCE_SIG | CERT_CONFIDENCE_TIMENEST, got %08
l
x
\n
"
,
data
.
pasSigners
[
0
].
pasCertChain
[
0
].
dwConfidence
);
CertFreeCertificateContext
(
data
.
pasSigners
[
0
].
pasCertChain
[
0
].
pCert
);
...
...
@@ -756,16 +756,16 @@ static void test_sip_create_indirect_data(void)
SetLastError
(
0xdeadbeef
);
ret
=
CryptSIPCreateIndirectData_p
(
NULL
,
NULL
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
CryptSIPCreateIndirectData_p
(
&
subjinfo
,
NULL
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
subjinfo
.
cbSize
=
sizeof
(
subjinfo
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptSIPCreateIndirectData_p
(
&
subjinfo
,
NULL
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
file
=
create_temp_file
(
temp_file
);
if
(
file
==
INVALID_HANDLE_VALUE
)
{
...
...
@@ -779,17 +779,17 @@ static void test_sip_create_indirect_data(void)
SetLastError
(
0xdeadbeef
);
ret
=
CryptSIPCreateIndirectData_p
(
&
subjinfo
,
NULL
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
subjinfo
.
pgSubjectType
=
&
unknown
;
SetLastError
(
0xdeadbeef
);
ret
=
CryptSIPCreateIndirectData_p
(
&
subjinfo
,
NULL
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
subjinfo
.
DigestAlgorithm
.
pszObjId
=
oid_sha1
;
count
=
0xdeadbeef
;
ret
=
CryptSIPCreateIndirectData_p
(
&
subjinfo
,
&
count
,
NULL
);
todo_wine
ok
(
ret
,
"CryptSIPCreateIndirectData failed: %d
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptSIPCreateIndirectData failed: %
l
d
\n
"
,
GetLastError
());
ok
(
count
,
"expected a positive count
\n
"
);
if
(
ret
)
{
...
...
@@ -797,16 +797,16 @@ static void test_sip_create_indirect_data(void)
count
=
256
;
ret
=
CryptSIPCreateIndirectData_p
(
&
subjinfo
,
&
count
,
indirect
);
ok
(
ret
,
"CryptSIPCreateIndirectData failed: %d
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptSIPCreateIndirectData failed: %
l
d
\n
"
,
GetLastError
());
/* If the count is larger than needed, it's unmodified */
ok
(
count
==
256
,
"unexpected count %d
\n
"
,
count
);
ok
(
count
==
256
,
"unexpected count %
l
d
\n
"
,
count
);
ok
(
!
strcmp
(
indirect
->
Data
.
pszObjId
,
SPC_PE_IMAGE_DATA_OBJID
),
"unexpected data oid %s
\n
"
,
indirect
->
Data
.
pszObjId
);
ok
(
!
strcmp
(
indirect
->
DigestAlgorithm
.
pszObjId
,
oid_sha1
),
"unexpected digest algorithm oid %s
\n
"
,
indirect
->
DigestAlgorithm
.
pszObjId
);
ok
(
indirect
->
Digest
.
cbData
==
20
,
"unexpected hash size %d
\n
"
,
ok
(
indirect
->
Digest
.
cbData
==
20
,
"unexpected hash size %
l
d
\n
"
,
indirect
->
Digest
.
cbData
);
if
(
indirect
->
Digest
.
cbData
==
20
)
{
...
...
@@ -847,9 +847,9 @@ static void test_wintrust(void)
file
.
hFile
=
create_temp_file
(
pathW
);
SetLastError
(
0xdeadbeef
);
r
=
WinVerifyTrust
(
INVALID_HANDLE_VALUE
,
&
generic_action_v2
,
&
wtd
);
ok
(
r
==
GetLastError
(),
"expected %08
x, got %08
x
\n
"
,
GetLastError
(),
r
);
ok
(
r
==
GetLastError
(),
"expected %08
lx, got %08l
x
\n
"
,
GetLastError
(),
r
);
ok
(
r
==
TRUST_E_SUBJECT_FORM_UNKNOWN
,
"expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08x
\n
"
,
r
);
"expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08
l
x
\n
"
,
r
);
CloseHandle
(
file
.
hFile
);
DeleteFileW
(
pathW
);
file
.
hFile
=
NULL
;
...
...
@@ -857,25 +857,25 @@ static void test_wintrust(void)
getNotepadPath
(
pathW
,
MAX_PATH
);
SetLastError
(
0xdeadbeef
);
r
=
WinVerifyTrust
(
INVALID_HANDLE_VALUE
,
&
generic_action_v2
,
&
wtd
);
ok
(
r
==
GetLastError
(),
"expected %08
x, got %08
x
\n
"
,
GetLastError
(),
r
);
ok
(
r
==
GetLastError
(),
"expected %08
lx, got %08l
x
\n
"
,
GetLastError
(),
r
);
ok
(
r
==
TRUST_E_NOSIGNATURE
||
r
==
CRYPT_E_FILE_ERROR
,
"expected TRUST_E_NOSIGNATURE or CRYPT_E_FILE_ERROR, got %08x
\n
"
,
r
);
"expected TRUST_E_NOSIGNATURE or CRYPT_E_FILE_ERROR, got %08
l
x
\n
"
,
r
);
wtd
.
dwStateAction
=
WTD_STATEACTION_CLOSE
;
SetLastError
(
0xdeadbeef
);
r
=
WinVerifyTrust
(
INVALID_HANDLE_VALUE
,
&
generic_action_v2
,
&
wtd
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"expected 0xdeadbeef, got %08x
\n
"
,
GetLastError
());
ok
(
r
==
S_OK
,
"WinVerifyTrust failed: %08x
\n
"
,
r
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"expected 0xdeadbeef, got %08
l
x
\n
"
,
GetLastError
());
ok
(
r
==
S_OK
,
"WinVerifyTrust failed: %08
l
x
\n
"
,
r
);
wtd
.
dwStateAction
=
WTD_STATEACTION_VERIFY
;
SetLastError
(
0xdeadbeef
);
hr
=
WinVerifyTrustEx
(
INVALID_HANDLE_VALUE
,
&
generic_action_v2
,
&
wtd
);
ok
(
hr
==
GetLastError
(),
"expected %08
x, got %08
x
\n
"
,
GetLastError
(),
hr
);
ok
(
hr
==
GetLastError
(),
"expected %08
lx, got %08l
x
\n
"
,
GetLastError
(),
hr
);
ok
(
hr
==
TRUST_E_NOSIGNATURE
||
hr
==
CRYPT_E_FILE_ERROR
,
"expected TRUST_E_NOSIGNATURE or CRYPT_E_FILE_ERROR, got %08x
\n
"
,
hr
);
"expected TRUST_E_NOSIGNATURE or CRYPT_E_FILE_ERROR, got %08
l
x
\n
"
,
hr
);
wtd
.
dwStateAction
=
WTD_STATEACTION_CLOSE
;
SetLastError
(
0xdeadbeef
);
r
=
WinVerifyTrust
(
INVALID_HANDLE_VALUE
,
&
generic_action_v2
,
&
wtd
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"expected 0xdeadbeef, got %08x
\n
"
,
GetLastError
());
ok
(
r
==
S_OK
,
"WinVerifyTrust failed: %08x
\n
"
,
r
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"expected 0xdeadbeef, got %08
l
x
\n
"
,
GetLastError
());
ok
(
r
==
S_OK
,
"WinVerifyTrust failed: %08
l
x
\n
"
,
r
);
}
/* Self-signed .exe, built with tcc, signed with signtool
...
...
@@ -1142,7 +1142,7 @@ static void call_winverify(WCHAR *pathW, LONG *status, BOOL hash_only)
data
.
dwStateAction
=
WTD_STATEACTION_CLOSE
;
ret
=
WinVerifyTrust
(
NULL
,
&
WVTPolicyGUID
,
&
data
);
ok
(
ret
==
S_OK
,
"WinVerifyTrust failed: %08x
\n
"
,
ret
);
ok
(
ret
==
S_OK
,
"WinVerifyTrust failed: %08
l
x
\n
"
,
ret
);
}
static
void
test_wintrust_digest
(
void
)
...
...
@@ -1231,18 +1231,18 @@ static void test_wintrust_digest(void)
for
(
j
=
0
;
tests
[
i
].
blocks
[
j
].
data
;
j
++
)
{
ret
=
WriteFile
(
file
,
tests
[
i
].
blocks
[
j
].
data
,
tests
[
i
].
blocks
[
j
].
length
,
&
written
,
NULL
);
ok
(
ret
&&
written
==
tests
[
i
].
blocks
[
j
].
length
,
"WriteFile failed with %u
\n
"
,
GetLastError
());
ok
(
ret
&&
written
==
tests
[
i
].
blocks
[
j
].
length
,
"WriteFile failed with %
l
u
\n
"
,
GetLastError
());
}
CloseHandle
(
file
);
call_winverify
(
pathW
,
&
status
,
FALSE
);
todo_wine_if
(
tests
[
i
].
t1
.
todo
)
ok
(
status
==
tests
[
i
].
t1
.
status
,
"test %d/1: expected %08
x, got %08
x
\n
"
,
i
,
tests
[
i
].
t1
.
status
,
status
);
ok
(
status
==
tests
[
i
].
t1
.
status
,
"test %d/1: expected %08
lx, got %08l
x
\n
"
,
i
,
tests
[
i
].
t1
.
status
,
status
);
call_winverify
(
pathW
,
&
status
,
TRUE
);
todo_wine_if
(
tests
[
i
].
t2
.
todo
)
ok
(
status
==
tests
[
i
].
t2
.
status
,
"test %d/2: expected %08
x, got %08
x
\n
"
,
i
,
tests
[
i
].
t2
.
status
,
status
);
ok
(
status
==
tests
[
i
].
t2
.
status
,
"test %d/2: expected %08
lx, got %08l
x
\n
"
,
i
,
tests
[
i
].
t2
.
status
,
status
);
DeleteFileW
(
pathW
);
}
...
...
@@ -1261,22 +1261,22 @@ static void test_get_known_usages(void)
SetLastError
(
0xdeadbeef
);
ret
=
pWTHelperGetKnownUsages
(
0
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pWTHelperGetKnownUsages
(
1
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pWTHelperGetKnownUsages
(
0
,
&
usages
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
/* A value of 1 for the first parameter seems to imply the value is
* allocated
*/
SetLastError
(
0xdeadbeef
);
usages
=
NULL
;
ret
=
pWTHelperGetKnownUsages
(
1
,
&
usages
);
ok
(
ret
,
"WTHelperGetKnownUsages failed: %d
\n
"
,
GetLastError
());
ok
(
ret
,
"WTHelperGetKnownUsages failed: %
l
d
\n
"
,
GetLastError
());
ok
(
usages
!=
NULL
,
"expected a pointer
\n
"
);
if
(
ret
&&
usages
)
{
...
...
@@ -1289,10 +1289,10 @@ static void test_get_known_usages(void)
{
ok
((
*
ptr
)
->
cbSize
==
sizeof
(
CRYPT_OID_INFO
)
||
(
*
ptr
)
->
cbSize
==
(
sizeof
(
CRYPT_OID_INFO
)
+
2
*
sizeof
(
LPCWSTR
)),
/* Vista */
"unexpected size %d
\n
"
,
(
*
ptr
)
->
cbSize
);
"unexpected size %
l
d
\n
"
,
(
*
ptr
)
->
cbSize
);
/* Each returned usage is in the CRYPT_ENHKEY_USAGE_OID_GROUP_ID group */
ok
((
*
ptr
)
->
dwGroupId
==
CRYPT_ENHKEY_USAGE_OID_GROUP_ID
,
"expected group CRYPT_ENHKEY_USAGE_OID_GROUP_ID, got %d
\n
"
,
"expected group CRYPT_ENHKEY_USAGE_OID_GROUP_ID, got %
l
d
\n
"
,
(
*
ptr
)
->
dwGroupId
);
}
}
...
...
@@ -1300,16 +1300,16 @@ static void test_get_known_usages(void)
*/
SetLastError
(
0xdeadbeef
);
ret
=
pWTHelperGetKnownUsages
(
2
,
&
usages
);
ok
(
ret
,
"WTHelperGetKnownUsages failed: %d
\n
"
,
GetLastError
());
ok
(
ret
,
"WTHelperGetKnownUsages failed: %
l
d
\n
"
,
GetLastError
());
ok
(
usages
==
NULL
,
"expected pointer to be cleared
\n
"
);
SetLastError
(
0xdeadbeef
);
usages
=
NULL
;
ret
=
pWTHelperGetKnownUsages
(
2
,
&
usages
);
ok
(
ret
,
"WTHelperGetKnownUsages failed: %d
\n
"
,
GetLastError
());
ok
(
ret
,
"WTHelperGetKnownUsages failed: %
l
d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pWTHelperGetKnownUsages
(
2
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
}
START_TEST
(
softpub
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment