Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Mayr
wine
Commits
199c5f0b
Commit
199c5f0b
authored
18 years ago
by
Paul Vriens
Committed by
Alexandre Julliard
18 years ago
Browse files
Options
Downloads
Patches
Plain Diff
wintrust: Added tests for WintrustAddDefaultForUsage.
parent
1f05420b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/wintrust/tests/Makefile.in
+1
-1
1 addition, 1 deletion
dlls/wintrust/tests/Makefile.in
dlls/wintrust/tests/register.c
+107
-1
107 additions, 1 deletion
dlls/wintrust/tests/register.c
with
108 additions
and
2 deletions
dlls/wintrust/tests/Makefile.in
+
1
−
1
View file @
199c5f0b
...
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
TESTDLL
=
wintrust.dll
IMPORTS
=
user32 kernel32
IMPORTS
=
user32
advapi32
kernel32
CTESTS
=
\
register.c
...
...
This diff is collapsed.
Click to expand it.
dlls/wintrust/tests/register.c
+
107
−
1
View file @
199c5f0b
...
...
@@ -24,10 +24,12 @@
#include
"windows.h"
#include
"softpub.h"
#include
"wintrust.h"
#include
"winreg.h"
#include
"wine/test.h"
static
BOOL
(
WINAPI
*
pWintrustAddActionID
)(
GUID
*
,
DWORD
,
CRYPT_REGISTER_ACTIONID
*
);
static
BOOL
(
WINAPI
*
pWintrustAddDefaultForUsage
)(
const
CHAR
*
,
CRYPT_PROVIDER_REGDEFUSAGE
*
);
static
BOOL
(
WINAPI
*
pWintrustRemoveActionID
)(
GUID
*
);
static
HMODULE
hWintrust
=
0
;
...
...
@@ -51,6 +53,7 @@ static BOOL InitFunctionPtrs(void)
}
WINTRUST_GET_PROC
(
WintrustAddActionID
)
WINTRUST_GET_PROC
(
WintrustAddDefaultForUsage
)
WINTRUST_GET_PROC
(
WintrustRemoveActionID
)
return
TRUE
;
...
...
@@ -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
DummyFunctionW
[]
=
{
'd'
,
'u'
,
'm'
,
'm'
,
'y'
,
'f'
,
'u'
,
'n'
,
'c'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
GUID
ActionID
=
{
0xdeadbe
,
0x
efde
,
0xadbe
,
{
0xef
,
0xde
,
0xad
,
0xbe
,
0xef
,
0xde
,
0xad
,
0xbe
}};
GUID
ActionID
=
{
0xdeadbe
ef
,
0x
dead
,
0xbeef
,
{
0xde
,
0xad
,
0xbe
,
0xef
,
0xde
,
0xad
,
0xbe
,
0xef
}};
CRYPT_REGISTER_ACTIONID
ActionIDFunctions
;
CRYPT_TRUST_REG_ENTRY
EmptyProvider
=
{
0
,
NULL
,
NULL
};
CRYPT_TRUST_REG_ENTRY
DummyProvider
=
{
sizeof
(
CRYPT_TRUST_REG_ENTRY
),
DummyDllW
,
DummyFunctionW
};
...
...
@@ -158,12 +161,115 @@ static void test_AddRem_ActionID(void)
"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
)
{
if
(
!
InitFunctionPtrs
())
return
;
test_AddRem_ActionID
();
test_AddDefaultForUsage
();
FreeLibrary
(
hWintrust
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment