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
1d9ce08c
Commit
1d9ce08c
authored
Dec 17, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Dec 18, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust: Implement CryptCATAdminAcquireContext.
Based on work done by Maarten Lankhorst.
parent
976341a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
11 deletions
+50
-11
crypt.c
dlls/wintrust/crypt.c
+47
-5
crypt.c
dlls/wintrust/tests/crypt.c
+3
-6
No files found.
dlls/wintrust/crypt.c
View file @
1d9ce08c
...
...
@@ -32,9 +32,18 @@
#include "imagehlp.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
wintrust
);
#define CATADMIN_MAGIC 0x43415441
/* 'CATA' */
struct
catadmin
{
DWORD
magic
;
WCHAR
path
[
MAX_PATH
];
};
/***********************************************************************
* CryptCATAdminAcquireContext (WINTRUST.@)
*
...
...
@@ -42,7 +51,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wintrust);
*
* PARAMS
* catAdmin [O] Pointer to the context handle.
* sys
System
[I] Pointer to a GUID for the needed subsystem.
* sys
[I] Pointer to a GUID for the needed subsystem.
* dwFlags [I] Reserved.
*
* RETURNS
...
...
@@ -50,19 +59,52 @@ WINE_DEFAULT_DEBUG_CHANNEL(wintrust);
* Failure: FALSE.
*
*/
BOOL
WINAPI
CryptCATAdminAcquireContext
(
HCATADMIN
*
catAdmin
,
const
GUID
*
sysSystem
,
DWORD
dwFlags
)
BOOL
WINAPI
CryptCATAdminAcquireContext
(
HCATADMIN
*
catAdmin
,
const
GUID
*
sys
,
DWORD
dwFlags
)
{
FIXME
(
"%p %s %x
\n
"
,
catAdmin
,
debugstr_guid
(
sysSystem
),
dwFlags
);
static
const
WCHAR
catroot
[]
=
{
'\\'
,
'c'
,
'a'
,
't'
,
'r'
,
'o'
,
'o'
,
't'
,
0
};
static
const
WCHAR
fmt
[]
=
{
'%'
,
's'
,
'\\'
,
'{'
,
'%'
,
'0'
,
'8'
,
'x'
,
'-'
,
'%'
,
'0'
,
'4'
,
'x'
,
'-'
,
'%'
,
'0'
,
'4'
,
'x'
,
'-'
,
'%'
,
'0'
,
'2'
,
'x'
,
'%'
,
'0'
,
'2'
,
'x'
,
'-'
,
'%'
,
'0'
,
'2'
,
'x'
,
'%'
,
'0'
,
'2'
,
'x'
,
'%'
,
'0'
,
'2'
,
'x'
,
'%'
,
'0'
,
'2'
,
'x'
,
'%'
,
'0'
,
'2'
,
'x'
,
'%'
,
'0'
,
'2'
,
'x'
,
'}'
,
0
};
static
const
GUID
defsys
=
{
0x127d0a1d
,
0x4ef2
,
0x11d1
,{
0x86
,
0x08
,
0x00
,
0xc0
,
0x4f
,
0xc2
,
0x95
,
0xee
}};
WCHAR
catroot_dir
[
MAX_PATH
];
struct
catadmin
*
ca
;
TRACE
(
"%p %s %x
\n
"
,
catAdmin
,
debugstr_guid
(
sys
),
dwFlags
);
if
(
!
catAdmin
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
!
(
ca
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
ca
))))
{
SetLastError
(
ERROR_OUTOFMEMORY
);
return
FALSE
;
}
GetSystemDirectoryW
(
catroot_dir
,
MAX_PATH
);
strcatW
(
catroot_dir
,
catroot
);
/* create the directory if it doesn't exist */
CreateDirectoryW
(
catroot_dir
,
NULL
);
if
(
!
sys
)
sys
=
&
defsys
;
sprintfW
(
ca
->
path
,
fmt
,
catroot_dir
,
sys
->
Data1
,
sys
->
Data2
,
sys
->
Data3
,
sys
->
Data4
[
0
],
sys
->
Data4
[
1
],
sys
->
Data4
[
2
],
sys
->
Data4
[
3
],
sys
->
Data4
[
4
],
sys
->
Data4
[
5
],
sys
->
Data4
[
6
],
sys
->
Data4
[
7
]);
*
catAdmin
=
(
HCATADMIN
)
0xdeadbeef
;
/* create the directory if it doesn't exist */
CreateDirectoryW
(
ca
->
path
,
NULL
);
ca
->
magic
=
CATADMIN_MAGIC
;
*
catAdmin
=
ca
;
return
TRUE
;
}
...
...
dlls/wintrust/tests/crypt.c
View file @
1d9ce08c
...
...
@@ -164,17 +164,14 @@ static void test_context(void)
/* 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
"
);
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
"
);
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
);
...
...
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