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
56d085cc
Commit
56d085cc
authored
Feb 12, 2008
by
Paul Vriens
Committed by
Alexandre Julliard
Feb 12, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Only use functions if they are implemented.
parent
b1789fc7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
crypt.c
dlls/advapi32/tests/crypt.c
+17
-2
No files found.
dlls/advapi32/tests/crypt.c
View file @
56d085cc
...
@@ -34,7 +34,6 @@ static const char szKeySet[] = "wine_test_keyset";
...
@@ -34,7 +34,6 @@ static const char szKeySet[] = "wine_test_keyset";
static
const
char
szBadKeySet
[]
=
"wine_test_bad_keyset"
;
static
const
char
szBadKeySet
[]
=
"wine_test_bad_keyset"
;
#define NON_DEF_PROV_TYPE 999
#define NON_DEF_PROV_TYPE 999
static
HMODULE
hadvapi32
;
static
BOOL
(
WINAPI
*
pCryptAcquireContextA
)(
HCRYPTPROV
*
,
LPCSTR
,
LPCSTR
,
DWORD
,
DWORD
);
static
BOOL
(
WINAPI
*
pCryptAcquireContextA
)(
HCRYPTPROV
*
,
LPCSTR
,
LPCSTR
,
DWORD
,
DWORD
);
static
BOOL
(
WINAPI
*
pCryptEnumProviderTypesA
)(
DWORD
,
DWORD
*
,
DWORD
,
DWORD
*
,
LPSTR
,
DWORD
*
);
static
BOOL
(
WINAPI
*
pCryptEnumProviderTypesA
)(
DWORD
,
DWORD
*
,
DWORD
,
DWORD
*
,
LPSTR
,
DWORD
*
);
static
BOOL
(
WINAPI
*
pCryptEnumProvidersA
)(
DWORD
,
DWORD
*
,
DWORD
,
DWORD
*
,
LPSTR
,
DWORD
*
);
static
BOOL
(
WINAPI
*
pCryptEnumProvidersA
)(
DWORD
,
DWORD
*
,
DWORD
,
DWORD
*
,
LPSTR
,
DWORD
*
);
...
@@ -68,7 +67,7 @@ static BOOL (WINAPI *pCryptVerifySignatureW)(HCRYPTHASH, BYTE*, DWORD, HCRYPTKEY
...
@@ -68,7 +67,7 @@ static BOOL (WINAPI *pCryptVerifySignatureW)(HCRYPTHASH, BYTE*, DWORD, HCRYPTKEY
static
void
init_function_pointers
(
void
)
static
void
init_function_pointers
(
void
)
{
{
hadvapi32
=
GetModuleHandleA
(
"advapi32.dll"
);
HMODULE
hadvapi32
=
GetModuleHandleA
(
"advapi32.dll"
);
pCryptAcquireContextA
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"CryptAcquireContextA"
);
pCryptAcquireContextA
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"CryptAcquireContextA"
);
pCryptEnumProviderTypesA
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"CryptEnumProviderTypesA"
);
pCryptEnumProviderTypesA
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"CryptEnumProviderTypesA"
);
...
@@ -324,10 +323,15 @@ static void test_incorrect_api_usage(void)
...
@@ -324,10 +323,15 @@ static void test_incorrect_api_usage(void)
result
=
pCryptImportKey
(
hProv
,
&
temp
,
1
,
(
HCRYPTKEY
)
NULL
,
0
,
&
hKey2
);
result
=
pCryptImportKey
(
hProv
,
&
temp
,
1
,
(
HCRYPTKEY
)
NULL
,
0
,
&
hKey2
);
ok
(
!
result
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"%d
\n
"
,
GetLastError
());
ok
(
!
result
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"%d
\n
"
,
GetLastError
());
if
(
pCryptSignHashW
)
{
dwLen
=
1
;
dwLen
=
1
;
result
=
pCryptSignHashW
(
hHash
,
0
,
NULL
,
0
,
&
temp
,
&
dwLen
);
result
=
pCryptSignHashW
(
hHash
,
0
,
NULL
,
0
,
&
temp
,
&
dwLen
);
ok
(
!
result
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
ok
(
!
result
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
),
"%d
\n
"
,
GetLastError
());
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
),
"%d
\n
"
,
GetLastError
());
}
else
skip
(
"CryptSignHashW is not available
\n
"
);
result
=
pCryptSetKeyParam
(
hKey
,
0
,
&
temp
,
1
);
result
=
pCryptSetKeyParam
(
hKey
,
0
,
&
temp
,
1
);
ok
(
!
result
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"%d
\n
"
,
GetLastError
());
ok
(
!
result
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"%d
\n
"
,
GetLastError
());
...
@@ -338,9 +342,14 @@ static void test_incorrect_api_usage(void)
...
@@ -338,9 +342,14 @@ static void test_incorrect_api_usage(void)
result
=
pCryptSetProvParam
(
hProv
,
0
,
&
temp
,
1
);
result
=
pCryptSetProvParam
(
hProv
,
0
,
&
temp
,
1
);
ok
(
!
result
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"%d
\n
"
,
GetLastError
());
ok
(
!
result
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"%d
\n
"
,
GetLastError
());
if
(
pCryptVerifySignatureW
)
{
result
=
pCryptVerifySignatureW
(
hHash
,
&
temp
,
1
,
hKey
,
NULL
,
0
);
result
=
pCryptVerifySignatureW
(
hHash
,
&
temp
,
1
,
hKey
,
NULL
,
0
);
ok
(
!
result
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
ok
(
!
result
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
),
"%d
\n
"
,
GetLastError
());
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
),
"%d
\n
"
,
GetLastError
());
}
else
skip
(
"CryptVerifySignatureW is not available
\n
"
);
result
=
pCryptDestroyHash
(
hHash
);
result
=
pCryptDestroyHash
(
hHash
);
ok
(
!
result
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"%d
\n
"
,
GetLastError
());
ok
(
!
result
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"%d
\n
"
,
GetLastError
());
...
@@ -383,6 +392,12 @@ static void test_verify_sig(void)
...
@@ -383,6 +392,12 @@ static void test_verify_sig(void)
HCRYPTHASH
hash
;
HCRYPTHASH
hash
;
BYTE
bogus
[]
=
{
0
};
BYTE
bogus
[]
=
{
0
};
if
(
!
pCryptVerifySignatureW
)
{
skip
(
"CryptVerifySignatureW is not available
\n
"
);
return
;
}
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
pCryptVerifySignatureW
(
0
,
NULL
,
0
,
0
,
NULL
,
0
);
ret
=
pCryptVerifySignatureW
(
0
,
NULL
,
0
,
0
,
NULL
,
0
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
...
...
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