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
199c5f0b
Commit
199c5f0b
authored
Sep 12, 2006
by
Paul Vriens
Committed by
Alexandre Julliard
Sep 12, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust: Added tests for WintrustAddDefaultForUsage.
parent
1f05420b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
108 additions
and
2 deletions
+108
-2
Makefile.in
dlls/wintrust/tests/Makefile.in
+1
-1
register.c
dlls/wintrust/tests/register.c
+107
-1
No files found.
dlls/wintrust/tests/Makefile.in
View file @
199c5f0b
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR
=
@srcdir@
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
VPATH
=
@srcdir@
TESTDLL
=
wintrust.dll
TESTDLL
=
wintrust.dll
IMPORTS
=
user32 kernel32
IMPORTS
=
user32
advapi32
kernel32
CTESTS
=
\
CTESTS
=
\
register.c
register.c
...
...
dlls/wintrust/tests/register.c
View file @
199c5f0b
...
@@ -24,10 +24,12 @@
...
@@ -24,10 +24,12 @@
#include "windows.h"
#include "windows.h"
#include "softpub.h"
#include "softpub.h"
#include "wintrust.h"
#include "wintrust.h"
#include "winreg.h"
#include "wine/test.h"
#include "wine/test.h"
static
BOOL
(
WINAPI
*
pWintrustAddActionID
)(
GUID
*
,
DWORD
,
CRYPT_REGISTER_ACTIONID
*
);
static
BOOL
(
WINAPI
*
pWintrustAddActionID
)(
GUID
*
,
DWORD
,
CRYPT_REGISTER_ACTIONID
*
);
static
BOOL
(
WINAPI
*
pWintrustAddDefaultForUsage
)(
const
CHAR
*
,
CRYPT_PROVIDER_REGDEFUSAGE
*
);
static
BOOL
(
WINAPI
*
pWintrustRemoveActionID
)(
GUID
*
);
static
BOOL
(
WINAPI
*
pWintrustRemoveActionID
)(
GUID
*
);
static
HMODULE
hWintrust
=
0
;
static
HMODULE
hWintrust
=
0
;
...
@@ -51,6 +53,7 @@ static BOOL InitFunctionPtrs(void)
...
@@ -51,6 +53,7 @@ static BOOL InitFunctionPtrs(void)
}
}
WINTRUST_GET_PROC
(
WintrustAddActionID
)
WINTRUST_GET_PROC
(
WintrustAddActionID
)
WINTRUST_GET_PROC
(
WintrustAddDefaultForUsage
)
WINTRUST_GET_PROC
(
WintrustRemoveActionID
)
WINTRUST_GET_PROC
(
WintrustRemoveActionID
)
return
TRUE
;
return
TRUE
;
...
@@ -60,7 +63,7 @@ static void test_AddRem_ActionID(void)
...
@@ -60,7 +63,7 @@ static void test_AddRem_ActionID(void)
{
{
static
WCHAR
DummyDllW
[]
=
{
'd'
,
'e'
,
'a'
,
'd'
,
'b'
,
'e'
,
'e'
,
'f'
,
'.'
,
'd'
,
'l'
,
'l'
,
0
};
static
WCHAR
DummyDllW
[]
=
{
'd'
,
'e'
,
'a'
,
'd'
,
'b'
,
'e'
,
'e'
,
'f'
,
'.'
,
'd'
,
'l'
,
'l'
,
0
};
static
WCHAR
DummyFunctionW
[]
=
{
'd'
,
'u'
,
'm'
,
'm'
,
'y'
,
'f'
,
'u'
,
'n'
,
'c'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
WCHAR
DummyFunctionW
[]
=
{
'd'
,
'u'
,
'm'
,
'm'
,
'y'
,
'f'
,
'u'
,
'n'
,
'c'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
GUID
ActionID
=
{
0xdeadbe
,
0xefde
,
0xadbe
,
{
0xef
,
0xde
,
0xad
,
0xbe
,
0xef
,
0xde
,
0xad
,
0xbe
}};
GUID
ActionID
=
{
0xdeadbe
ef
,
0xdead
,
0xbeef
,
{
0xde
,
0xad
,
0xbe
,
0xef
,
0xde
,
0xad
,
0xbe
,
0xef
}};
CRYPT_REGISTER_ACTIONID
ActionIDFunctions
;
CRYPT_REGISTER_ACTIONID
ActionIDFunctions
;
CRYPT_TRUST_REG_ENTRY
EmptyProvider
=
{
0
,
NULL
,
NULL
};
CRYPT_TRUST_REG_ENTRY
EmptyProvider
=
{
0
,
NULL
,
NULL
};
CRYPT_TRUST_REG_ENTRY
DummyProvider
=
{
sizeof
(
CRYPT_TRUST_REG_ENTRY
),
DummyDllW
,
DummyFunctionW
};
CRYPT_TRUST_REG_ENTRY
DummyProvider
=
{
sizeof
(
CRYPT_TRUST_REG_ENTRY
),
DummyDllW
,
DummyFunctionW
};
...
@@ -158,12 +161,115 @@ static void test_AddRem_ActionID(void)
...
@@ -158,12 +161,115 @@ static void test_AddRem_ActionID(void)
"Expected 0xdeadbeef, got %ld.
\n
"
,
GetLastError
());
"Expected 0xdeadbeef, got %ld.
\n
"
,
GetLastError
());
}
}
static
void
test_AddDefaultForUsage
(
void
)
{
BOOL
ret
;
LONG
res
;
static
GUID
ActionID
=
{
0xdeadbeef
,
0xdead
,
0xbeef
,
{
0xde
,
0xad
,
0xbe
,
0xef
,
0xde
,
0xad
,
0xbe
,
0xef
}};
static
WCHAR
DummyDllW
[]
=
{
'd'
,
'e'
,
'a'
,
'd'
,
'b'
,
'e'
,
'e'
,
'f'
,
'.'
,
'd'
,
'l'
,
'l'
,
0
};
static
CHAR
DummyFunction
[]
=
"dummyfunction"
;
static
const
CHAR
oid
[]
=
"1.2.3.4.5.6.7.8.9.10"
;
static
const
CHAR
Usages
[]
=
"SOFTWARE
\\
Microsoft
\\
Cryptography
\\
Providers
\\
Trust
\\
Usages
\\
1.2.3.4.5.6.7.8.9.10"
;
static
CRYPT_PROVIDER_REGDEFUSAGE
DefUsage
;
/* All NULL */
SetLastError
(
0xdeadbeef
);
ret
=
pWintrustAddDefaultForUsage
(
NULL
,
NULL
);
ok
(
!
ret
,
"Expected WintrustAddDefaultForUsage to fail.
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %ld.
\n
"
,
GetLastError
());
/* NULL defusage */
SetLastError
(
0xdeadbeef
);
ret
=
pWintrustAddDefaultForUsage
(
oid
,
NULL
);
ok
(
!
ret
,
"Expected WintrustAddDefaultForUsage to fail.
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %ld.
\n
"
,
GetLastError
());
/* NULL oid and proper defusage */
memset
(
&
DefUsage
,
0
,
sizeof
(
CRYPT_PROVIDER_REGDEFUSAGE
));
DefUsage
.
cbStruct
=
sizeof
(
CRYPT_PROVIDER_REGDEFUSAGE
);
DefUsage
.
pgActionID
=
&
ActionID
;
DefUsage
.
pwszDllName
=
DummyDllW
;
DefUsage
.
pwszLoadCallbackDataFunctionName
=
DummyFunction
;
DefUsage
.
pwszFreeCallbackDataFunctionName
=
DummyFunction
;
SetLastError
(
0xdeadbeef
);
ret
=
pWintrustAddDefaultForUsage
(
NULL
,
&
DefUsage
);
ok
(
!
ret
,
"Expected WintrustAddDefaultForUsage to fail.
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %ld.
\n
"
,
GetLastError
());
/* Just the ActionID */
memset
(
&
DefUsage
,
0
,
sizeof
(
CRYPT_PROVIDER_REGDEFUSAGE
));
DefUsage
.
cbStruct
=
sizeof
(
CRYPT_PROVIDER_REGDEFUSAGE
);
DefUsage
.
pgActionID
=
&
ActionID
;
SetLastError
(
0xdeadbeef
);
ret
=
pWintrustAddDefaultForUsage
(
oid
,
&
DefUsage
);
todo_wine
ok
(
ret
,
"Expected WintrustAddDefaultForUsage to succeed
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Last error should not have been changed: 0x%08lx
\n
"
,
GetLastError
());
/* No ActionID */
memset
(
&
DefUsage
,
0
,
sizeof
(
CRYPT_PROVIDER_REGDEFUSAGE
));
DefUsage
.
cbStruct
=
sizeof
(
CRYPT_PROVIDER_REGDEFUSAGE
);
DefUsage
.
pwszDllName
=
DummyDllW
;
DefUsage
.
pwszLoadCallbackDataFunctionName
=
DummyFunction
;
DefUsage
.
pwszFreeCallbackDataFunctionName
=
DummyFunction
;
ret
=
pWintrustAddDefaultForUsage
(
oid
,
&
DefUsage
);
ok
(
!
ret
,
"Expected WintrustAddDefaultForUsage to fail.
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %ld.
\n
"
,
GetLastError
());
/* cbStruct set to 0 */
memset
(
&
DefUsage
,
0
,
sizeof
(
CRYPT_PROVIDER_REGDEFUSAGE
));
DefUsage
.
cbStruct
=
0
;
DefUsage
.
pgActionID
=
&
ActionID
;
DefUsage
.
pwszDllName
=
DummyDllW
;
DefUsage
.
pwszLoadCallbackDataFunctionName
=
DummyFunction
;
DefUsage
.
pwszFreeCallbackDataFunctionName
=
DummyFunction
;
SetLastError
(
0xdeadbeef
);
ret
=
pWintrustAddDefaultForUsage
(
oid
,
&
DefUsage
);
ok
(
!
ret
,
"Expected WintrustAddDefaultForUsage to fail.
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %ld.
\n
"
,
GetLastError
());
/* All OK */
memset
(
&
DefUsage
,
0
,
sizeof
(
CRYPT_PROVIDER_REGDEFUSAGE
));
DefUsage
.
cbStruct
=
sizeof
(
CRYPT_PROVIDER_REGDEFUSAGE
);
DefUsage
.
pgActionID
=
&
ActionID
;
DefUsage
.
pwszDllName
=
DummyDllW
;
DefUsage
.
pwszLoadCallbackDataFunctionName
=
DummyFunction
;
DefUsage
.
pwszFreeCallbackDataFunctionName
=
DummyFunction
;
SetLastError
(
0xdeadbeef
);
ret
=
pWintrustAddDefaultForUsage
(
oid
,
&
DefUsage
);
todo_wine
ok
(
ret
,
"Expected WintrustAddDefaultForUsage to succeed
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Last error should not have been changed: 0x%08lx
\n
"
,
GetLastError
());
/* There is no corresponding remove for WintrustAddDefaultForUsage
* so we delete the registry key manually.
*/
if
(
ret
)
{
res
=
RegDeleteKeyA
(
HKEY_LOCAL_MACHINE
,
Usages
);
ok
(
res
==
ERROR_SUCCESS
,
"Key delete failed : 0x%08lx
\n
"
,
res
);
}
}
START_TEST
(
register
)
START_TEST
(
register
)
{
{
if
(
!
InitFunctionPtrs
())
if
(
!
InitFunctionPtrs
())
return
;
return
;
test_AddRem_ActionID
();
test_AddRem_ActionID
();
test_AddDefaultForUsage
();
FreeLibrary
(
hWintrust
);
FreeLibrary
(
hWintrust
);
}
}
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