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
053b2295
Commit
053b2295
authored
Dec 23, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Dec 23, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust: Add some tests.
parent
32766e38
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
1 deletion
+78
-1
crypt.c
dlls/wintrust/tests/crypt.c
+78
-1
No files found.
dlls/wintrust/tests/crypt.c
View file @
053b2295
...
...
@@ -48,7 +48,7 @@ CATATTR2=0x10010001:attr2:value2
hashme=.\winetest.cdf
*/
const
BYTE
test_catalog
[]
=
{
static
const
BYTE
test_catalog
[]
=
{
0x30
,
0x82
,
0x01
,
0xbc
,
0x06
,
0x09
,
0x2a
,
0x86
,
0x48
,
0x86
,
0xf7
,
0x0d
,
0x01
,
0x07
,
0x02
,
0xa0
,
0x82
,
0x01
,
0xad
,
0x30
,
0x82
,
0x01
,
0xa9
,
0x02
,
0x01
,
0x01
,
0x31
,
0x00
,
0x30
,
0x82
,
0x01
,
0x9e
,
0x06
,
0x09
,
0x2b
,
0x06
,
0x01
,
0x04
,
0x01
,
0x82
,
0x37
,
0x0a
,
0x01
,
0xa0
,
0x82
,
0x01
,
0x8f
,
0x30
,
...
...
@@ -85,6 +85,11 @@ static BOOL (WINAPI * pCryptCATAdminCalcHashFromFileHandle)(HANDLE hFile, DWORD*
static
HCATINFO
(
WINAPI
*
pCryptCATAdminAddCatalog
)(
HCATADMIN
,
PWSTR
,
PWSTR
,
DWORD
);
static
BOOL
(
WINAPI
*
pCryptCATAdminRemoveCatalog
)(
HCATADMIN
,
LPCWSTR
,
DWORD
);
static
BOOL
(
WINAPI
*
pCryptCATAdminReleaseCatalogContext
)(
HCATADMIN
,
HCATINFO
,
DWORD
);
static
HANDLE
(
WINAPI
*
pCryptCATOpen
)(
LPWSTR
,
DWORD
,
HCRYPTPROV
,
DWORD
,
DWORD
);
static
BOOL
(
WINAPI
*
pCryptCATCatalogInfoFromContext
)(
HCATINFO
,
CATALOG_INFO
*
,
DWORD
);
static
CRYPTCATMEMBER
*
(
WINAPI
*
pCryptCATEnumerateMember
)(
HANDLE
,
CRYPTCATMEMBER
*
);
static
CRYPTCATATTRIBUTE
*
(
WINAPI
*
pCryptCATEnumerateAttr
)(
HANDLE
,
CRYPTCATMEMBER
*
,
CRYPTCATATTRIBUTE
*
);
static
BOOL
(
WINAPI
*
pCryptCATClose
)(
HANDLE
);
static
void
InitFunctionPtrs
(
void
)
{
...
...
@@ -102,6 +107,11 @@ static void InitFunctionPtrs(void)
WINTRUST_GET_PROC
(
CryptCATAdminAddCatalog
)
WINTRUST_GET_PROC
(
CryptCATAdminRemoveCatalog
)
WINTRUST_GET_PROC
(
CryptCATAdminReleaseCatalogContext
)
WINTRUST_GET_PROC
(
CryptCATOpen
)
WINTRUST_GET_PROC
(
CryptCATCatalogInfoFromContext
)
WINTRUST_GET_PROC
(
CryptCATEnumerateMember
)
WINTRUST_GET_PROC
(
CryptCATEnumerateAttr
)
WINTRUST_GET_PROC
(
CryptCATClose
)
#undef WINTRUST_GET_PROC
}
...
...
@@ -346,6 +356,7 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
static
WCHAR
basenameW
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
'.'
,
'c'
,
'a'
,
't'
,
0
};
HCATADMIN
hcatadmin
;
HCATINFO
hcatinfo
;
CATALOG_INFO
info
;
WCHAR
tmpfileW
[
MAX_PATH
];
char
tmpfile
[
MAX_PATH
];
HANDLE
file
;
...
...
@@ -414,6 +425,11 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
hcatinfo
=
pCryptCATAdminAddCatalog
(
hcatadmin
,
tmpfileW
,
basenameW
,
0
);
ok
(
hcatinfo
!=
NULL
,
"CryptCATAdminAddCatalog failed %u
\n
"
,
GetLastError
());
info
.
cbStruct
=
sizeof
(
info
);
info
.
wszCatalogFile
[
0
]
=
0
;
ret
=
pCryptCATCatalogInfoFromContext
(
hcatinfo
,
&
info
,
0
);
ok
(
ret
,
"CryptCATCatalogInfoFromContext failed %u
\n
"
,
GetLastError
());
ret
=
pCryptCATAdminReleaseCatalogContext
(
hcatadmin
,
hcatinfo
,
0
);
ok
(
ret
,
"CryptCATAdminReleaseCatalogContext failed %u
\n
"
,
GetLastError
());
...
...
@@ -426,6 +442,66 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
DeleteFileA
(
tmpfile
);
}
static
void
test_catalog_properties
(
void
)
{
static
const
WCHAR
hashmeW
[]
=
{
'h'
,
'a'
,
's'
,
'h'
,
'm'
,
'e'
,
0
};
static
const
GUID
subject
=
{
0xde351a42
,
0x8e59
,
0x11d0
,{
0x8c
,
0x47
,
0x00
,
0xc0
,
0x4f
,
0xc2
,
0x95
,
0xee
}};
HANDLE
hcat
;
CRYPTCATMEMBER
*
m
;
CRYPTCATATTRIBUTE
*
attr
;
char
catalog
[
MAX_PATH
];
WCHAR
catalogW
[
MAX_PATH
];
DWORD
written
;
HANDLE
file
;
BOOL
ret
;
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
());
WriteFile
(
file
,
test_catalog
,
sizeof
(
test_catalog
),
&
written
,
NULL
);
CloseHandle
(
file
);
hcat
=
pCryptCATOpen
(
NULL
,
0
,
0
,
0
,
0
);
ok
(
hcat
==
INVALID_HANDLE_VALUE
,
"CryptCATOpen succeeded
\n
"
);
MultiByteToWideChar
(
CP_ACP
,
0
,
catalog
,
-
1
,
catalogW
,
MAX_PATH
);
hcat
=
pCryptCATOpen
(
catalogW
,
0
,
0
,
0
,
0
);
ok
(
hcat
!=
INVALID_HANDLE_VALUE
,
"CryptCATOpen failed %u
\n
"
,
GetLastError
());
m
=
pCryptCATEnumerateMember
(
NULL
,
NULL
);
ok
(
m
==
NULL
,
"CryptCATEnumerateMember succeeded
\n
"
);
m
=
pCryptCATEnumerateMember
(
hcat
,
NULL
);
ok
(
m
!=
NULL
,
"CryptCATEnumerateMember failed %u
\n
"
,
GetLastError
());
ok
(
m
->
cbStruct
==
sizeof
(
CRYPTCATMEMBER
),
"unexpected size %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
->
hReserved
==
NULL
,
"got %p expected NULL
\n
"
,
m
->
hReserved
);
attr
=
pCryptCATEnumerateAttr
(
NULL
,
NULL
,
NULL
);
ok
(
attr
==
NULL
,
"CryptCATEnumerateAttr succeeded
\n
"
);
attr
=
pCryptCATEnumerateAttr
(
hcat
,
NULL
,
NULL
);
ok
(
attr
==
NULL
,
"CryptCATEnumerateAttr succeeded
\n
"
);
attr
=
pCryptCATEnumerateAttr
(
hcat
,
m
,
NULL
);
ok
(
attr
==
NULL
,
"CryptCATEnumerateAttr succeeded
\n
"
);
m
=
pCryptCATEnumerateMember
(
hcat
,
m
);
ok
(
m
==
NULL
,
"CryptCATEnumerateMember succeeded
\n
"
);
ret
=
pCryptCATClose
(
hcat
);
ok
(
ret
,
"CryptCATClose failed
\n
"
);
DeleteFileA
(
catalog
);
}
START_TEST
(
crypt
)
{
int
myARGC
;
...
...
@@ -447,4 +523,5 @@ START_TEST(crypt)
test_context
();
test_calchash
();
test_CryptCATAdminAddRemoveCatalog
();
test_catalog_properties
();
}
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