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
1af94dbf
Commit
1af94dbf
authored
May 14, 2007
by
Juan Lang
Committed by
Alexandre Julliard
May 15, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust: Implement WintrustGetRegPolicyFlags and WintrustSetRegPolicyFlags.
parent
d132d194
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
113 additions
and
3 deletions
+113
-3
register.c
dlls/wintrust/tests/register.c
+60
-0
wintrust_main.c
dlls/wintrust/wintrust_main.c
+52
-3
wintrust.h
include/wintrust.h
+1
-0
No files found.
dlls/wintrust/tests/register.c
View file @
1af94dbf
...
...
@@ -286,6 +286,65 @@ static void test_LoadFunctionPointers(void)
ok
(
ret
,
"WintrustLoadFunctionPointers failed: %d
\n
"
,
GetLastError
());
}
typedef
void
(
WINAPI
*
WintrustGetRegPolicyFlagsFunc
)(
DWORD
*
);
typedef
BOOL
(
WINAPI
*
WintrustSetRegPolicyFlagsFunc
)(
DWORD
);
static
void
test_RegPolicyFlags
(
void
)
{
/* Default state value 0x00023c00, which is
* WTPF_IGNOREREVOCATIONONTS |
* WTPF_OFFLINEOKNBU_COM |
* WTPF_OFFLINEOKNBU_IND |
* WTPF_OFFLINEOK_COM |
* WTPF_OFFLINEOK_IND
*/
static
const
WCHAR
Software_Publishing
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
'\\'
,
'W'
,
'i'
,
'n'
,
't'
,
'r'
,
'u'
,
's'
,
't'
,
'\\'
,
'T'
,
'r'
,
'u'
,
's'
,
't'
,
' '
,
'P'
,
'r'
,
'o'
,
'v'
,
'i'
,
'd'
,
'e'
,
'r'
,
's'
,
'\\'
,
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
' '
,
'P'
,
'u'
,
'b'
,
'l'
,
'i'
,
's'
,
'h'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
State
[]
=
{
'S'
,
't'
,
'a'
,
't'
,
'e'
,
0
};
WintrustGetRegPolicyFlagsFunc
pGetFlags
;
WintrustSetRegPolicyFlagsFunc
pSetFlags
;
HKEY
key
;
LONG
r
;
DWORD
flags1
,
flags2
,
flags3
,
size
;
BOOL
ret
;
pGetFlags
=
(
WintrustGetRegPolicyFlagsFunc
)
GetProcAddress
(
hWintrust
,
"WintrustGetRegPolicyFlags"
);
pSetFlags
=
(
WintrustSetRegPolicyFlagsFunc
)
GetProcAddress
(
hWintrust
,
"WintrustSetRegPolicyFlags"
);
if
(
!
pGetFlags
||
!
pSetFlags
)
skip
(
"Policy flags functions not present
\n
"
);
r
=
RegOpenKeyExW
(
HKEY_CURRENT_USER
,
Software_Publishing
,
0
,
KEY_ALL_ACCESS
,
&
key
);
ok
(
!
r
,
"RegOpenKeyEx failed: %d
\n
"
,
r
);
size
=
sizeof
(
flags1
);
r
=
RegQueryValueExW
(
key
,
State
,
NULL
,
NULL
,
(
LPBYTE
)
&
flags1
,
&
size
);
ok
(
!
r
,
"RegQueryValueEx failed: %d
\n
"
,
r
);
pGetFlags
(
&
flags2
);
ok
(
flags1
==
flags2
,
"Didn't get expected flags
\n
"
);
flags3
=
flags2
|
1
;
ret
=
pSetFlags
(
flags3
);
ok
(
ret
,
"pSetFlags failed: %d
\n
"
,
GetLastError
());
size
=
sizeof
(
flags1
);
r
=
RegQueryValueExW
(
key
,
State
,
NULL
,
NULL
,
(
LPBYTE
)
&
flags1
,
&
size
);
ok
(
flags1
==
flags3
,
"Didn't get expected flags
\n
"
);
pSetFlags
(
flags2
);
RegCloseKey
(
key
);
}
START_TEST
(
register
)
{
if
(
!
InitFunctionPtrs
())
...
...
@@ -294,6 +353,7 @@ START_TEST(register)
test_AddRem_ActionID
();
test_AddDefaultForUsage
();
test_LoadFunctionPointers
();
test_RegPolicyFlags
();
FreeLibrary
(
hWintrust
);
}
dlls/wintrust/wintrust_main.c
View file @
1af94dbf
...
...
@@ -23,6 +23,7 @@
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winreg.h"
#include "guiddef.h"
#include "wintrust.h"
#include "softpub.h"
...
...
@@ -118,13 +119,48 @@ CRYPT_PROVIDER_DATA * WINAPI WTHelperProvDataFromStateData(HANDLE hStateData)
return
NULL
;
}
static
const
WCHAR
Software_Publishing
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
'\\'
,
'W'
,
'i'
,
'n'
,
't'
,
'r'
,
'u'
,
's'
,
't'
,
'\\'
,
'T'
,
'r'
,
'u'
,
's'
,
't'
,
' '
,
'P'
,
'r'
,
'o'
,
'v'
,
'i'
,
'd'
,
'e'
,
'r'
,
's'
,
'\\'
,
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
' '
,
'P'
,
'u'
,
'b'
,
'l'
,
'i'
,
's'
,
'h'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
State
[]
=
{
'S'
,
't'
,
'a'
,
't'
,
'e'
,
0
};
/***********************************************************************
* WintrustGetRegPolicyFlags (WINTRUST.@)
*/
void
WINAPI
WintrustGetRegPolicyFlags
(
DWORD
*
pdwPolicyFlags
)
{
FIXME
(
"%p
\n
"
,
pdwPolicyFlags
);
HKEY
key
;
LONG
r
;
TRACE
(
"%p
\n
"
,
pdwPolicyFlags
);
*
pdwPolicyFlags
=
0
;
r
=
RegCreateKeyExW
(
HKEY_CURRENT_USER
,
Software_Publishing
,
0
,
NULL
,
0
,
KEY_READ
,
NULL
,
&
key
,
NULL
);
if
(
!
r
)
{
DWORD
size
=
sizeof
(
DWORD
);
r
=
RegQueryValueExW
(
key
,
State
,
NULL
,
NULL
,
(
LPBYTE
)
pdwPolicyFlags
,
&
size
);
RegCloseKey
(
key
);
if
(
r
)
{
/* Failed to query, create and return default value */
*
pdwPolicyFlags
=
WTPF_IGNOREREVOCATIONONTS
|
WTPF_OFFLINEOKNBU_COM
|
WTPF_OFFLINEOKNBU_IND
|
WTPF_OFFLINEOK_COM
|
WTPF_OFFLINEOK_IND
;
WintrustSetRegPolicyFlags
(
*
pdwPolicyFlags
);
}
}
}
/***********************************************************************
...
...
@@ -132,6 +168,19 @@ void WINAPI WintrustGetRegPolicyFlags( DWORD* pdwPolicyFlags )
*/
BOOL
WINAPI
WintrustSetRegPolicyFlags
(
DWORD
dwPolicyFlags
)
{
FIXME
(
"stub: %x
\n
"
,
dwPolicyFlags
);
return
TRUE
;
HKEY
key
;
LONG
r
;
TRACE
(
"%x
\n
"
,
dwPolicyFlags
);
r
=
RegCreateKeyExW
(
HKEY_CURRENT_USER
,
Software_Publishing
,
0
,
NULL
,
0
,
KEY_WRITE
,
NULL
,
&
key
,
NULL
);
if
(
!
r
)
{
r
=
RegSetValueExW
(
key
,
State
,
0
,
REG_DWORD
,
(
LPBYTE
)
&
dwPolicyFlags
,
sizeof
(
DWORD
));
RegCloseKey
(
key
);
}
if
(
r
)
SetLastError
(
r
);
return
r
==
ERROR_SUCCESS
;
}
include/wintrust.h
View file @
1af94dbf
...
...
@@ -364,6 +364,7 @@ BOOL WINAPI WintrustRemoveActionID(GUID*);
BOOL
WINAPI
WintrustLoadFunctionPointers
(
GUID
*
,
CRYPT_PROVIDER_FUNCTIONS
*
);
BOOL
WINAPI
WintrustAddDefaultForUsage
(
const
char
*
,
CRYPT_PROVIDER_REGDEFUSAGE
*
);
void
WINAPI
WintrustGetRegPolicyFlags
(
DWORD
*
);
BOOL
WINAPI
WintrustSetRegPolicyFlags
(
DWORD
);
LONG
WINAPI
WinVerifyTrust
(
HWND
,
GUID
*
,
LPVOID
);
HRESULT
WINAPI
WinVerifyTrustEx
(
HWND
,
GUID
*
,
WINTRUST_DATA
*
);
...
...
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