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
42a86138
Commit
42a86138
authored
Jul 21, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust/tests: Use nameless unions/structs.
parent
30ee1d10
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
28 deletions
+28
-28
asn.c
dlls/wintrust/tests/asn.c
+23
-23
softpub.c
dlls/wintrust/tests/softpub.c
+5
-5
No files found.
dlls/wintrust/tests/asn.c
View file @
42a86138
...
...
@@ -143,7 +143,7 @@ static void test_encodeSPCLink(void)
LocalFree
(
buf
);
}
/* With an invalid char: */
U
(
link
)
.
pwszUrl
=
(
LPWSTR
)
nihongoURL
;
link
.
pwszUrl
=
(
LPWSTR
)
nihongoURL
;
size
=
1
;
SetLastError
(
0xdeadbeef
);
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
&
link
,
...
...
@@ -156,7 +156,7 @@ static void test_encodeSPCLink(void)
* index of the first invalid character.
*/
ok
(
size
==
0
,
"Expected size 0, got %ld
\n
"
,
size
);
U
(
link
)
.
pwszUrl
=
url
;
link
.
pwszUrl
=
url
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
&
link
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08lx
\n
"
,
GetLastError
());
...
...
@@ -167,7 +167,7 @@ static void test_encodeSPCLink(void)
LocalFree
(
buf
);
}
link
.
dwLinkChoice
=
SPC_FILE_LINK_CHOICE
;
U
(
link
)
.
pwszFile
=
(
LPWSTR
)
nihongoURL
;
link
.
pwszFile
=
(
LPWSTR
)
nihongoURL
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
&
link
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08lx
\n
"
,
GetLastError
());
...
...
@@ -178,7 +178,7 @@ static void test_encodeSPCLink(void)
LocalFree
(
buf
);
}
link
.
dwLinkChoice
=
SPC_MONIKER_LINK_CHOICE
;
memset
(
&
U
(
link
).
Moniker
,
0
,
sizeof
(
U
(
link
)
.
Moniker
));
memset
(
&
link
.
Moniker
,
0
,
sizeof
(
link
.
Moniker
));
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
&
link
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08lx
\n
"
,
GetLastError
());
...
...
@@ -188,9 +188,9 @@ static void test_encodeSPCLink(void)
ok
(
!
memcmp
(
buf
,
emptyMonikerSPCLink
,
size
),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
memset
(
&
U
(
link
).
Moniker
.
ClassId
,
0xea
,
sizeof
(
U
(
link
)
.
Moniker
.
ClassId
));
U
(
link
)
.
Moniker
.
SerializedData
.
pbData
=
data
;
U
(
link
)
.
Moniker
.
SerializedData
.
cbData
=
sizeof
(
data
);
memset
(
&
link
.
Moniker
.
ClassId
,
0xea
,
sizeof
(
link
.
Moniker
.
ClassId
));
link
.
Moniker
.
SerializedData
.
pbData
=
data
;
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: %08lx
\n
"
,
GetLastError
());
...
...
@@ -228,7 +228,7 @@ static void test_decodeSPCLink(void)
link
=
(
SPC_LINK
*
)
buf
;
ok
(
link
->
dwLinkChoice
==
SPC_URL_LINK_CHOICE
,
"Expected SPC_URL_LINK_CHOICE, got %ld
\n
"
,
link
->
dwLinkChoice
);
ok
(
lstrlenW
(
U
(
*
link
).
pwszUrl
)
==
0
,
"Expected empty string
\n
"
);
ok
(
lstrlenW
(
link
->
pwszUrl
)
==
0
,
"Expected empty string
\n
"
);
LocalFree
(
buf
);
}
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
...
...
@@ -240,7 +240,7 @@ static void test_decodeSPCLink(void)
link
=
(
SPC_LINK
*
)
buf
;
ok
(
link
->
dwLinkChoice
==
SPC_URL_LINK_CHOICE
,
"Expected SPC_URL_LINK_CHOICE, got %ld
\n
"
,
link
->
dwLinkChoice
);
ok
(
!
lstrcmpW
(
U
(
*
link
).
pwszUrl
,
url
),
"Unexpected URL
\n
"
);
ok
(
!
lstrcmpW
(
link
->
pwszUrl
,
url
),
"Unexpected URL
\n
"
);
LocalFree
(
buf
);
}
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
...
...
@@ -252,7 +252,7 @@ static void test_decodeSPCLink(void)
link
=
(
SPC_LINK
*
)
buf
;
ok
(
link
->
dwLinkChoice
==
SPC_FILE_LINK_CHOICE
,
"Expected SPC_FILE_LINK_CHOICE, got %ld
\n
"
,
link
->
dwLinkChoice
);
ok
(
!
lstrcmpW
(
U
(
*
link
).
pwszFile
,
nihongoURL
),
"Unexpected file
\n
"
);
ok
(
!
lstrcmpW
(
link
->
pwszFile
,
nihongoURL
),
"Unexpected file
\n
"
);
LocalFree
(
buf
);
}
ret
=
pCryptDecodeObjectEx
(
X509_ASN_ENCODING
,
SPC_LINK_STRUCT
,
...
...
@@ -266,9 +266,9 @@ static void test_decodeSPCLink(void)
link
=
(
SPC_LINK
*
)
buf
;
ok
(
link
->
dwLinkChoice
==
SPC_MONIKER_LINK_CHOICE
,
"Expected SPC_MONIKER_LINK_CHOICE, got %ld
\n
"
,
link
->
dwLinkChoice
);
ok
(
!
memcmp
(
&
U
(
*
link
).
Moniker
.
ClassId
,
&
emptyMoniker
.
ClassId
,
ok
(
!
memcmp
(
&
link
->
Moniker
.
ClassId
,
&
emptyMoniker
.
ClassId
,
sizeof
(
emptyMoniker
.
ClassId
)),
"Unexpected value
\n
"
);
ok
(
U
(
*
link
).
Moniker
.
SerializedData
.
cbData
==
0
,
ok
(
link
->
Moniker
.
SerializedData
.
cbData
==
0
,
"Expected no serialized data
\n
"
);
LocalFree
(
buf
);
}
...
...
@@ -284,11 +284,11 @@ static void test_decodeSPCLink(void)
ok
(
link
->
dwLinkChoice
==
SPC_MONIKER_LINK_CHOICE
,
"Expected SPC_MONIKER_LINK_CHOICE, got %ld
\n
"
,
link
->
dwLinkChoice
);
memset
(
&
id
,
0xea
,
sizeof
(
id
));
ok
(
!
memcmp
(
&
U
(
*
link
).
Moniker
.
ClassId
,
&
id
,
sizeof
(
id
)),
ok
(
!
memcmp
(
&
link
->
Moniker
.
ClassId
,
&
id
,
sizeof
(
id
)),
"Unexpected value
\n
"
);
ok
(
U
(
*
link
).
Moniker
.
SerializedData
.
cbData
==
sizeof
(
data
),
"Unexpected data size %ld
\n
"
,
U
(
*
link
).
Moniker
.
SerializedData
.
cbData
);
ok
(
!
memcmp
(
U
(
*
link
).
Moniker
.
SerializedData
.
pbData
,
data
,
sizeof
(
data
)),
ok
(
link
->
Moniker
.
SerializedData
.
cbData
==
sizeof
(
data
),
"Unexpected data size %ld
\n
"
,
link
->
Moniker
.
SerializedData
.
cbData
);
ok
(
!
memcmp
(
link
->
Moniker
.
SerializedData
.
pbData
,
data
,
sizeof
(
data
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
...
...
@@ -405,7 +405,7 @@ static void test_encodeSPCPEImage(void)
LocalFree
(
buf
);
}
/* Finally, a non-empty file: */
U
(
link
)
.
pwszFile
=
(
LPWSTR
)
nihongoURL
;
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: %08lx
\n
"
,
GetLastError
());
...
...
@@ -474,7 +474,7 @@ static void test_decodeSPCPEImage(void)
ok
(
imageData
->
pFile
->
dwLinkChoice
==
SPC_FILE_LINK_CHOICE
,
"Expected SPC_FILE_LINK_CHOICE, got %ld
\n
"
,
imageData
->
pFile
->
dwLinkChoice
);
ok
(
!
lstrcmpW
(
U
(
*
imageData
->
pFile
).
pwszFile
,
emptyString
),
ok
(
!
lstrcmpW
(
imageData
->
pFile
->
pwszFile
,
emptyString
),
"Unexpected file
\n
"
);
}
LocalFree
(
buf
);
...
...
@@ -497,7 +497,7 @@ static void test_decodeSPCPEImage(void)
ok
(
imageData
->
pFile
->
dwLinkChoice
==
SPC_FILE_LINK_CHOICE
,
"Expected SPC_FILE_LINK_CHOICE, got %ld
\n
"
,
imageData
->
pFile
->
dwLinkChoice
);
ok
(
!
lstrcmpW
(
U
(
*
imageData
->
pFile
).
pwszFile
,
emptyString
),
ok
(
!
lstrcmpW
(
imageData
->
pFile
->
pwszFile
,
emptyString
),
"Unexpected file
\n
"
);
}
LocalFree
(
buf
);
...
...
@@ -520,7 +520,7 @@ static void test_decodeSPCPEImage(void)
ok
(
imageData
->
pFile
->
dwLinkChoice
==
SPC_FILE_LINK_CHOICE
,
"Expected SPC_FILE_LINK_CHOICE, got %ld
\n
"
,
imageData
->
pFile
->
dwLinkChoice
);
ok
(
!
lstrcmpW
(
U
(
*
imageData
->
pFile
).
pwszFile
,
nihongoURL
),
ok
(
!
lstrcmpW
(
imageData
->
pFile
->
pwszFile
,
nihongoURL
),
"Unexpected file
\n
"
);
}
LocalFree
(
buf
);
...
...
@@ -840,7 +840,7 @@ static void test_encodeSpOpusInfo(void)
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08lx
\n
"
,
GetLastError
());
moreInfo
.
dwLinkChoice
=
SPC_URL_LINK_CHOICE
;
U
(
moreInfo
)
.
pwszUrl
=
winehq
;
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: %08lx
\n
"
,
GetLastError
());
...
...
@@ -908,7 +908,7 @@ static void test_decodeSpOpusInfo(void)
{
ok
(
info
->
pMoreInfo
->
dwLinkChoice
==
SPC_URL_LINK_CHOICE
,
"unexpected link choice %ld
\n
"
,
info
->
pMoreInfo
->
dwLinkChoice
);
ok
(
!
lstrcmpW
(
U
(
*
info
->
pMoreInfo
).
pwszUrl
,
winehq
),
ok
(
!
lstrcmpW
(
info
->
pMoreInfo
->
pwszUrl
,
winehq
),
"unexpected link value
\n
"
);
}
ok
(
!
info
->
pPublisherInfo
,
"expected NULL
\n
"
);
...
...
@@ -929,7 +929,7 @@ static void test_decodeSpOpusInfo(void)
ok
(
info
->
pPublisherInfo
->
dwLinkChoice
==
SPC_URL_LINK_CHOICE
,
"unexpected link choice %ld
\n
"
,
info
->
pPublisherInfo
->
dwLinkChoice
);
ok
(
!
lstrcmpW
(
U
(
*
info
->
pPublisherInfo
).
pwszUrl
,
winehq
),
ok
(
!
lstrcmpW
(
info
->
pPublisherInfo
->
pwszUrl
,
winehq
),
"unexpected link value
\n
"
);
}
LocalFree
(
info
);
...
...
dlls/wintrust/tests/softpub.c
View file @
42a86138
...
...
@@ -338,7 +338,7 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %08lx
\n
"
,
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]);
U
(
wintrust_data
)
.
pCert
=
&
certInfo
;
wintrust_data
.
pCert
=
&
certInfo
;
wintrust_data
.
dwUnionChoice
=
WTD_CHOICE_CERT
;
ret
=
funcs
->
pfnObjectTrust
(
&
data
);
ok
(
ret
==
S_OK
,
"Expected S_OK, got %08lx
\n
"
,
ret
);
...
...
@@ -349,21 +349,21 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
CertFreeCertificateContext
(
certInfo
.
psCertContext
);
certInfo
.
psCertContext
=
NULL
;
wintrust_data
.
dwUnionChoice
=
WTD_CHOICE_FILE
;
U
(
wintrust_data
)
.
pFile
=
NULL
;
wintrust_data
.
pFile
=
NULL
;
ret
=
funcs
->
pfnObjectTrust
(
&
data
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08lx
\n
"
,
ret
);
ok
(
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %08lx
\n
"
,
data
.
padwTrustStepErrors
[
TRUSTERROR_STEP_FINAL_OBJPROV
]);
U
(
wintrust_data
)
.
pFile
=
&
fileInfo
;
wintrust_data
.
pFile
=
&
fileInfo
;
/* Crashes
ret = funcs->pfnObjectTrust(&data);
*/
/* Create and test with an empty file */
fileInfo
.
hFile
=
create_temp_file
(
pathW
);
/* pfnObjectTrust now crashes unless both pPDSip and psPfns are set */
U
(
data
)
.
pPDSip
=
&
provDataSIP
;
data
.
pPDSip
=
&
provDataSIP
;
data
.
psPfns
=
(
CRYPT_PROVIDER_FUNCTIONS
*
)
funcs
;
ret
=
funcs
->
pfnObjectTrust
(
&
data
);
ok
(
ret
==
S_FALSE
,
"Expected S_FALSE, got %08lx
\n
"
,
ret
);
...
...
@@ -838,7 +838,7 @@ static void test_wintrust(void)
wtd
.
dwUIChoice
=
WTD_UI_NONE
;
wtd
.
fdwRevocationChecks
=
WTD_REVOKE_WHOLECHAIN
;
wtd
.
dwUnionChoice
=
WTD_CHOICE_FILE
;
U
(
wtd
)
.
pFile
=
&
file
;
wtd
.
pFile
=
&
file
;
wtd
.
dwStateAction
=
WTD_STATEACTION_VERIFY
;
memset
(
&
file
,
0
,
sizeof
(
file
));
file
.
cbStruct
=
sizeof
(
file
);
...
...
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