Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
ea79639b
Commit
ea79639b
authored
Aug 11, 2006
by
Juan Lang
Committed by
Alexandre Julliard
Aug 11, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32/tests: Only load crypt32 once.
parent
e476cf8c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
91 deletions
+87
-91
main.c
dlls/crypt32/tests/main.c
+87
-91
No files found.
dlls/crypt32/tests/main.c
View file @
ea79639b
...
...
@@ -28,6 +28,8 @@
#include "wine/test.h"
HMODULE
hCrypt
;
static
void
test_findAttribute
(
void
)
{
PCRYPT_ATTRIBUTE
ret
;
...
...
@@ -208,68 +210,64 @@ static I_CryptFreeTlsFunc pI_CryptFreeTls;
static
void
test_cryptTls
(
void
)
{
HMODULE
lib
=
LoadLibraryA
(
"crypt32.dll"
);
DWORD
index
;
BOOL
ret
;
if
(
lib
)
{
DWORD
index
;
BOOL
ret
;
if
(
!
hCrypt
)
return
;
pI_CryptAllocTls
=
(
I_CryptAllocTlsFunc
)
GetProcAddress
(
lib
,
"I_CryptAllocTls"
);
pI_CryptDetachTls
=
(
I_CryptDetachTlsFunc
)
GetProcAddress
(
lib
,
"I_CryptDetachTls"
);
pI_CryptGetTls
=
(
I_CryptGetTlsFunc
)
GetProcAddress
(
lib
,
"I_CryptGetTls"
);
pI_CryptSetTls
=
(
I_CryptSetTlsFunc
)
GetProcAddress
(
lib
,
"I_CryptSetTls"
);
pI_CryptFreeTls
=
(
I_CryptFreeTlsFunc
)
GetProcAddress
(
lib
,
"I_CryptFreeTls"
);
pI_CryptAllocTls
=
(
I_CryptAllocTlsFunc
)
GetProcAddress
(
hCrypt
,
"I_CryptAllocTls"
);
pI_CryptDetachTls
=
(
I_CryptDetachTlsFunc
)
GetProcAddress
(
hCrypt
,
"I_CryptDetachTls"
);
pI_CryptGetTls
=
(
I_CryptGetTlsFunc
)
GetProcAddress
(
hCrypt
,
"I_CryptGetTls"
);
pI_CryptSetTls
=
(
I_CryptSetTlsFunc
)
GetProcAddress
(
hCrypt
,
"I_CryptSetTls"
);
pI_CryptFreeTls
=
(
I_CryptFreeTlsFunc
)
GetProcAddress
(
hCrypt
,
"I_CryptFreeTls"
);
/* One normal pass */
index
=
pI_CryptAllocTls
();
ok
(
index
,
"I_CryptAllocTls failed: %08lx
\n
"
,
GetLastError
());
if
(
index
)
{
LPVOID
ptr
;
/* One normal pass */
index
=
pI_CryptAllocTls
();
ok
(
index
,
"I_CryptAllocTls failed: %08lx
\n
"
,
GetLastError
());
if
(
index
)
{
LPVOID
ptr
;
ptr
=
pI_CryptGetTls
(
index
);
ok
(
!
ptr
,
"Expected NULL
\n
"
);
ret
=
pI_CryptSetTls
(
index
,
(
LPVOID
)
0xdeadbeef
);
ok
(
ret
,
"I_CryptSetTls failed: %08lx
\n
"
,
GetLastError
());
ptr
=
pI_CryptGetTls
(
index
);
ok
(
ptr
==
(
LPVOID
)
0xdeadbeef
,
"Expected 0xdeadbeef, got %p
\n
"
,
ptr
);
/* This crashes
ret = pI_CryptFreeTls(index, 1);
*/
ret
=
pI_CryptFreeTls
(
index
,
0
);
ok
(
ret
,
"I_CryptFreeTls failed: %08lx
\n
"
,
GetLastError
());
ret
=
pI_CryptFreeTls
(
index
,
0
);
/* Not sure if this fails because TlsFree should fail, so leave as
* todo for now.
*/
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %08lx
\n
"
,
GetLastError
());
}
/* Similar pass, check I_CryptDetachTls */
index
=
pI_CryptAllocTls
();
ok
(
index
,
"I_CryptAllocTls failed: %08lx
\n
"
,
GetLastError
());
if
(
index
)
{
LPVOID
ptr
;
ptr
=
pI_CryptGetTls
(
index
);
ok
(
!
ptr
,
"Expected NULL
\n
"
);
ret
=
pI_CryptSetTls
(
index
,
(
LPVOID
)
0xdeadbeef
);
ok
(
ret
,
"I_CryptSetTls failed: %08lx
\n
"
,
GetLastError
());
ptr
=
pI_CryptGetTls
(
index
);
ok
(
ptr
==
(
LPVOID
)
0xdeadbeef
,
"Expected 0xdeadbeef, got %p
\n
"
,
ptr
);
/* This crashes
ret = pI_CryptFreeTls(index, 1);
*/
ret
=
pI_CryptFreeTls
(
index
,
0
);
ok
(
ret
,
"I_CryptFreeTls failed: %08lx
\n
"
,
GetLastError
());
ret
=
pI_CryptFreeTls
(
index
,
0
);
/* Not sure if this fails because TlsFree should fail, so leave as
* todo for now.
*/
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %08lx
\n
"
,
GetLastError
());
}
/* Similar pass, check I_CryptDetachTls */
index
=
pI_CryptAllocTls
();
ok
(
index
,
"I_CryptAllocTls failed: %08lx
\n
"
,
GetLastError
());
if
(
index
)
{
LPVOID
ptr
;
ptr
=
pI_CryptGetTls
(
index
);
ok
(
!
ptr
,
"Expected NULL
\n
"
);
ret
=
pI_CryptSetTls
(
index
,
(
LPVOID
)
0xdeadbeef
);
ok
(
ret
,
"I_CryptSetTls failed: %08lx
\n
"
,
GetLastError
());
ptr
=
pI_CryptGetTls
(
index
);
ok
(
ptr
==
(
LPVOID
)
0xdeadbeef
,
"Expected 0xdeadbeef, got %p
\n
"
,
ptr
);
ptr
=
pI_CryptDetachTls
(
index
);
ok
(
ptr
==
(
LPVOID
)
0xdeadbeef
,
"Expected 0xdeadbeef, got %p
\n
"
,
ptr
);
ptr
=
pI_CryptGetTls
(
index
);
ok
(
!
ptr
,
"Expected NULL
\n
"
);
}
FreeLibrary
(
lib
);
ptr
=
pI_CryptGetTls
(
index
);
ok
(
!
ptr
,
"Expected NULL
\n
"
);
ret
=
pI_CryptSetTls
(
index
,
(
LPVOID
)
0xdeadbeef
);
ok
(
ret
,
"I_CryptSetTls failed: %08lx
\n
"
,
GetLastError
());
ptr
=
pI_CryptGetTls
(
index
);
ok
(
ptr
==
(
LPVOID
)
0xdeadbeef
,
"Expected 0xdeadbeef, got %p
\n
"
,
ptr
);
ptr
=
pI_CryptDetachTls
(
index
);
ok
(
ptr
==
(
LPVOID
)
0xdeadbeef
,
"Expected 0xdeadbeef, got %p
\n
"
,
ptr
);
ptr
=
pI_CryptGetTls
(
index
);
ok
(
!
ptr
,
"Expected NULL
\n
"
);
}
}
...
...
@@ -278,51 +276,49 @@ typedef BOOL (WINAPI *I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc)
static
void
test_readTrustedPublisherDWORD
(
void
)
{
HMODULE
lib
=
LoadLibraryA
(
"crypt32.dll"
)
;
I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc
pReadDWORD
;
if
(
lib
)
if
(
!
hCrypt
)
return
;
pReadDWORD
=
(
I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc
)
GetProcAddress
(
hCrypt
,
"I_CryptReadTrustedPublisherDWORDValueFromRegistry"
);
if
(
pReadDWORD
)
{
I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc
pReadDWORD
=
(
I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc
)
GetProcAddress
(
lib
,
"I_CryptReadTrustedPublisherDWORDValueFromRegistry"
);
static
const
WCHAR
safer
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'P'
,
'o'
,
'l'
,
'i'
,
'c'
,
'i'
,
'e'
,
's'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'C'
,
'e'
,
'r'
,
't'
,
'i'
,
'f'
,
'i'
,
'c'
,
'a'
,
't'
,
'e'
,
's'
,
'\\'
,
'T'
,
'r'
,
'u'
,
's'
,
't'
,
'e'
,
'd'
,
'P'
,
'u'
,
'b'
,
'l'
,
'i'
,
's'
,
'h'
,
'e'
,
'r'
,
'\\'
,
'S'
,
'a'
,
'f'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
authenticodeFlags
[]
=
{
'A'
,
'u'
,
't'
,
'h'
,
'e'
,
'n'
,
't'
,
'i'
,
'c'
,
'o'
,
'd'
,
'e'
,
'F'
,
'l'
,
'a'
,
'g'
,
's'
,
0
};
BOOL
ret
,
exists
=
FALSE
;
DWORD
size
,
readFlags
,
returnedFlags
;
HKEY
key
;
LONG
rc
;
if
(
pReadDWORD
)
rc
=
RegOpenKeyW
(
HKEY_LOCAL_MACHINE
,
safer
,
&
key
);
if
(
rc
==
ERROR_SUCCESS
)
{
static
const
WCHAR
safer
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'P'
,
'o'
,
'l'
,
'i'
,
'c'
,
'i'
,
'e'
,
's'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'C'
,
'e'
,
'r'
,
't'
,
'i'
,
'f'
,
'i'
,
'c'
,
'a'
,
't'
,
'e'
,
's'
,
'\\'
,
'T'
,
'r'
,
'u'
,
's'
,
't'
,
'e'
,
'd'
,
'P'
,
'u'
,
'b'
,
'l'
,
'i'
,
's'
,
'h'
,
'e'
,
'r'
,
'\\'
,
'S'
,
'a'
,
'f'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
authenticodeFlags
[]
=
{
'A'
,
'u'
,
't'
,
'h'
,
'e'
,
'n'
,
't'
,
'i'
,
'c'
,
'o'
,
'd'
,
'e'
,
'F'
,
'l'
,
'a'
,
'g'
,
's'
,
0
};
BOOL
ret
,
exists
=
FALSE
;
DWORD
size
,
readFlags
,
returnedFlags
;
HKEY
key
;
LONG
rc
;
rc
=
RegOpenKeyW
(
HKEY_LOCAL_MACHINE
,
safer
,
&
key
);
size
=
sizeof
(
readFlags
);
rc
=
RegQueryValueExW
(
key
,
authenticodeFlags
,
NULL
,
NULL
,
(
LPBYTE
)
&
readFlags
,
&
size
);
if
(
rc
==
ERROR_SUCCESS
)
{
size
=
sizeof
(
readFlags
);
rc
=
RegQueryValueExW
(
key
,
authenticodeFlags
,
NULL
,
NULL
,
(
LPBYTE
)
&
readFlags
,
&
size
);
if
(
rc
==
ERROR_SUCCESS
)
exists
=
TRUE
;
}
ret
=
pReadDWORD
(
authenticodeFlags
,
&
returnedFlags
);
ok
(
ret
==
exists
,
"Unexpected return value
\n
"
);
if
(
exists
)
ok
(
readFlags
==
returnedFlags
,
"Expected flags %08lx, got %08lx
\n
"
,
readFlags
,
returnedFlags
);
exists
=
TRUE
;
}
FreeLibrary
(
lib
);
ret
=
pReadDWORD
(
authenticodeFlags
,
&
returnedFlags
);
ok
(
ret
==
exists
,
"Unexpected return value
\n
"
);
if
(
exists
)
ok
(
readFlags
==
returnedFlags
,
"Expected flags %08lx, got %08lx
\n
"
,
readFlags
,
returnedFlags
);
}
}
START_TEST
(
main
)
{
hCrypt
=
LoadLibraryA
(
"crypt32.dll"
);
test_findAttribute
();
test_findExtension
();
test_findRDNAttr
();
...
...
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