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
48446727
Commit
48446727
authored
Feb 28, 2008
by
Paul Vriens
Committed by
Alexandre Julliard
Feb 28, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust/tests: Add a few tests.
parent
84039b26
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
1 deletion
+73
-1
crypt.c
dlls/wintrust/tests/crypt.c
+73
-1
No files found.
dlls/wintrust/tests/crypt.c
View file @
48446727
...
...
@@ -57,6 +57,8 @@ static void test_context(void)
HCATADMIN
hca
;
static
GUID
dummy
=
{
0xdeadbeef
,
0xdead
,
0xbeef
,
{
0xde
,
0xad
,
0xbe
,
0xef
,
0xde
,
0xad
,
0xbe
,
0xef
}};
static
GUID
unknown
=
{
0xC689AABA
,
0x8E78
,
0x11D0
,
{
0x8C
,
0x47
,
0x00
,
0xC0
,
0x4F
,
0xC2
,
0x95
,
0xEE
}};
/* WINTRUST.DLL */
CHAR
windir
[
MAX_PATH
],
catroot
[
MAX_PATH
],
catroot2
[
MAX_PATH
],
dummydir
[
MAX_PATH
];
DWORD
attrs
;
if
(
!
pCryptCATAdminAcquireContext
||
!
pCryptCATAdminReleaseContext
)
{
...
...
@@ -64,6 +66,34 @@ static void test_context(void)
return
;
}
/* When CryptCATAdminAcquireContext is successful it will create
* several directories if they don't exist:
*
* ...\system32\CatRoot\{GUID}, this directory holds the .cat files
* ...\system32\CatRoot2\{GUID} (WinXP and up), here we find the catalog database for that GUID
*
* Windows Vista uses lowercase catroot and catroot2.
*
* When passed a NULL GUID it will create the following directories although on
* WinXP and up these directories are already present when Windows is installed:
*
* ...\system32\CatRoot\{127D0A1D-4EF2-11D1-8608-00C04FC295EE}
* ...\system32\CatRoot2\{127D0A1D-4EF2-11D1-8608-00C04FC295EE} (WinXP up)
*
* TODO: Find out what this GUID is/does.
*
* On WinXp and up there is also a TimeStamp file in some of directories that
* seem to indicate the last change to the catalog database for that GUID.
*
* On Windows 2000 some files are created/updated:
*
* ...\system32\CatRoot\SYSMAST.cbk
* ...\system32\CatRoot\SYSMAST.cbd
* ...\system32\CatRoot\{GUID}\CATMAST.cbk
* ...\system32\CatRoot\{GUID}\CATMAST.cbd
*
*/
/* All NULL */
SetLastError
(
0xdeadbeef
);
ret
=
pCryptCATAdminAcquireContext
(
NULL
,
NULL
,
0
);
...
...
@@ -114,7 +144,16 @@ static void test_context(void)
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
/* Correct context handle and dummy GUID */
/* Correct context handle and dummy GUID
*
* The tests run in the past unfortunately made sure that some directories were created.
*
* FIXME:
* We don't want to mess too much with these for now so we should delete only the ones
* that shouldn't be there like the deadbeef ones. We first have to figure out if it's
* save to remove files and directories from CatRoot/CatRoot2.
*/
SetLastError
(
0xdeadbeef
);
ret
=
pCryptCATAdminAcquireContext
(
&
hca
,
&
dummy
,
0
);
ok
(
ret
,
"Expected success
\n
"
);
...
...
@@ -123,6 +162,39 @@ static void test_context(void)
"Expected ERROR_SUCCESS or 0xdeadbeef, got %d
\n
"
,
GetLastError
());
ok
(
hca
!=
NULL
,
"Expected a context handle, got NULL
\n
"
);
GetWindowsDirectoryA
(
windir
,
MAX_PATH
);
lstrcpyA
(
catroot
,
windir
);
lstrcatA
(
catroot
,
"
\\
system32
\\
CatRoot"
);
lstrcpyA
(
catroot2
,
windir
);
lstrcatA
(
catroot2
,
"
\\
system32
\\
CatRoot2"
);
attrs
=
GetFileAttributes
(
catroot
);
/* On a clean Wine this will fail. When a native wintrust.dll was used in the past
* some tests will succeed.
*/
todo_wine
ok
(
attrs
!=
INVALID_FILE_ATTRIBUTES
,
"Expected the CatRoot directory to exist
\n
"
);
/* Windows creates the GUID directory in capitals */
lstrcpyA
(
dummydir
,
catroot
);
lstrcatA
(
dummydir
,
"
\\
{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}"
);
attrs
=
GetFileAttributes
(
dummydir
);
todo_wine
ok
(
attrs
!=
INVALID_FILE_ATTRIBUTES
,
"Expected CatRoot
\\
{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF} directory to exist
\n
"
);
/* Only present on XP or higher. */
attrs
=
GetFileAttributes
(
catroot2
);
if
(
attrs
!=
INVALID_FILE_ATTRIBUTES
)
{
lstrcpyA
(
dummydir
,
catroot2
);
lstrcatA
(
dummydir
,
"
\\
{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}"
);
attrs
=
GetFileAttributes
(
dummydir
);
ok
(
attrs
!=
INVALID_FILE_ATTRIBUTES
,
"Expected CatRoot2
\\
{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF} directory to exist
\n
"
);
}
ret
=
pCryptCATAdminReleaseContext
(
hca
,
0
);
ok
(
ret
,
"Expected success
\n
"
);
...
...
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