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
f714cf4b
Commit
f714cf4b
authored
Nov 06, 2008
by
Nicolas Le Cam
Committed by
Alexandre Julliard
Nov 07, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: test_enum_provider_types test cleanup.
parent
30a6f54d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
30 deletions
+41
-30
crypt.c
dlls/advapi32/tests/crypt.c
+41
-30
No files found.
dlls/advapi32/tests/crypt.c
View file @
f714cf4b
...
...
@@ -566,43 +566,51 @@ static BOOL FindProvTypesRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszTy
HKEY
hKey
;
HKEY
hSubKey
;
PSTR
ch
;
LPSTR
szName
;
DWORD
cbName
;
BOOL
ret
=
FALSE
;
if
(
RegOpenKey
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Cryptography
\\
Defaults
\\
Provider Types"
,
&
hKey
))
return
FALSE
;
if
(
RegQueryInfoKey
(
hKey
,
NULL
,
NULL
,
NULL
,
pdwTypeCount
,
pcbType
Name
,
NULL
,
if
(
RegQueryInfoKey
(
hKey
,
NULL
,
NULL
,
NULL
,
pdwTypeCount
,
&
cb
Name
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
))
return
FALSE
;
(
*
pcbTypeName
)
++
;
goto
cleanup
;
cbName
++
;
if
(
!
(
*
pszTypeName
=
((
LPSTR
)
LocalAlloc
(
LMEM_ZEROINIT
,
*
pcbTypeName
)
)))
return
FALSE
;
if
(
!
(
szName
=
LocalAlloc
(
LMEM_ZEROINIT
,
cbName
)))
goto
cleanup
;
if
(
RegEnumKeyEx
(
hKey
,
dwIndex
,
*
pszTypeName
,
pcbType
Name
,
NULL
,
NULL
,
NULL
,
NULL
))
return
FALSE
;
(
*
pcbTypeName
)
++
;
ch
=
*
pszTypeName
+
strlen
(
*
pszType
Name
);
if
(
RegEnumKeyEx
(
hKey
,
dwIndex
,
szName
,
&
cb
Name
,
NULL
,
NULL
,
NULL
,
NULL
))
goto
cleanup
;
cbName
++
;
ch
=
szName
+
strlen
(
sz
Name
);
/* Convert "Type 000" to 0, etc/ */
*
pdwProvType
=
*
(
--
ch
)
-
'0'
;
*
pdwProvType
+=
(
*
(
--
ch
)
-
'0'
)
*
10
;
*
pdwProvType
+=
(
*
(
--
ch
)
-
'0'
)
*
100
;
if
(
RegOpenKey
(
hKey
,
*
pszType
Name
,
&
hSubKey
))
return
FALSE
;
if
(
RegOpenKey
(
hKey
,
sz
Name
,
&
hSubKey
))
goto
cleanup
;
if
(
RegQueryValueEx
(
hSubKey
,
"TypeName"
,
NULL
,
NULL
,
NULL
,
pcbTypeName
))
return
FALSE
;
goto
cleanup
;
if
(
!
(
*
pszTypeName
=
((
LPSTR
)
LocalAlloc
(
LMEM_ZEROINIT
,
*
pcbTypeName
)
)))
return
FALSE
;
if
(
!
(
*
pszTypeName
=
LocalAlloc
(
LMEM_ZEROINIT
,
*
pcbTypeName
)))
goto
cleanup
;
if
(
RegQueryValueEx
(
hSubKey
,
"TypeName"
,
NULL
,
NULL
,
(
LPBYTE
)
*
pszTypeName
,
pcbTypeName
))
return
FALSE
;
if
(
!
RegQueryValueEx
(
hSubKey
,
"TypeName"
,
NULL
,
NULL
,
(
LPBYTE
)
*
pszTypeName
,
pcbTypeName
))
ret
=
TRUE
;
cleanup:
if
(
!
ret
)
LocalFree
(
*
pszTypeName
);
LocalFree
(
szName
);
RegCloseKey
(
hSubKey
);
RegCloseKey
(
hKey
);
return
TRUE
;
return
ret
;
}
static
void
test_enum_provider_types
(
void
)
...
...
@@ -637,29 +645,31 @@ static void test_enum_provider_types(void)
/* check pdwReserved for NULL */
result
=
pCryptEnumProviderTypesA
(
index
,
&
notNull
,
0
,
&
provType
,
typeName
,
&
typeNameSize
);
ok
(
!
result
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected
%i, got %d
\n
"
,
ERROR_INVALID_PARAMETER
,
GetLastError
());
ok
(
!
result
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected
ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
/* check dwFlags == zero */
result
=
pCryptEnumProviderTypesA
(
index
,
NULL
,
notZeroFlags
,
&
provType
,
typeName
,
&
typeNameSize
);
ok
(
!
result
&&
GetLastError
()
==
NTE_BAD_FLAGS
,
"expected
%i
, got %d
\n
"
,
ERROR_INVALID_PARAMETER
,
GetLastError
());
ok
(
!
result
&&
GetLastError
()
==
NTE_BAD_FLAGS
,
"expected
ERROR_INVALID_PARAMETER
, got %d
\n
"
,
GetLastError
());
/* This test fails under Win2k SP4:
* result = TRUE, GetLastError() == 0xdeadbeef */
if
(
0
)
{
/* alloc provider type to half the size required
* cbTypeName holds the size required */
typeNameSize
=
cbTypeName
/
2
;
if
(
!
(
typeName
=
((
LPSTR
)
LocalAlloc
(
LMEM_ZEROINIT
,
typeNameSize
))))
return
;
goto
cleanup
;
/* This test fails under Win2k SP4:
result = TRUE, GetLastError() == 0xdeadbeef
SetLastError
(
0xdeadbeef
);
result
=
pCryptEnumProviderTypesA
(
index
,
NULL
,
0
,
&
provType
,
typeName
,
&
typeNameSize
);
ok(!result && GetLastError()==ERROR_MORE_DATA, "expected 0/ERROR_MORE_DATA, got %d/%08lx
\n",
ok
(
!
result
&&
GetLastError
()
==
ERROR_MORE_DATA
,
"expected 0/ERROR_MORE_DATA, got %d/%d
\n
"
,
result
,
GetLastError
());
*/
LocalFree
(
typeName
);
}
/* loop through the provider types to get the number of provider types
* after loop ends, count should be dwTypeCount + 1 so subtract 1
...
...
@@ -674,15 +684,14 @@ static void test_enum_provider_types(void)
* ERROR_NO_MORE_ITEMS */
for
(
typeCount
=
0
;
typeCount
<
dwTypeCount
+
1
;
typeCount
++
)
result
=
pCryptEnumProviderTypesA
(
typeCount
,
NULL
,
0
,
&
provType
,
NULL
,
&
typeNameSize
);
ok
(
!
result
&&
GetLastError
()
==
ERROR_NO_MORE_ITEMS
,
"expected %i, got %d
\n
"
,
ERROR_NO_MORE_ITEMS
,
GetLastError
());
ok
(
!
result
&&
GetLastError
()
==
ERROR_NO_MORE_ITEMS
,
"expected ERROR_NO_MORE_ITEMS, got %d
\n
"
,
GetLastError
());
/* check expected versus actual values returned */
result
=
pCryptEnumProviderTypesA
(
index
,
NULL
,
0
,
&
provType
,
NULL
,
&
typeNameSize
);
ok
(
result
&&
typeNameSize
==
cbTypeName
,
"expected %d, got %d
\n
"
,
cbTypeName
,
typeNameSize
);
if
(
!
(
typeName
=
((
LPSTR
)
LocalAlloc
(
LMEM_ZEROINIT
,
typeNameSize
))))
return
;
goto
cleanup
;
typeNameSize
=
0xdeadbeef
;
result
=
pCryptEnumProviderTypesA
(
index
,
NULL
,
0
,
&
provType
,
typeName
,
&
typeNameSize
);
...
...
@@ -693,6 +702,8 @@ static void test_enum_provider_types(void)
ok
(
typeNameSize
==
cbTypeName
,
"expected %d, got %d
\n
"
,
cbTypeName
,
typeNameSize
);
LocalFree
(
typeName
);
cleanup:
LocalFree
(
pszTypeName
);
}
static
BOOL
FindDfltProvRegVals
(
DWORD
dwProvType
,
DWORD
dwFlags
,
LPSTR
*
pszProvName
,
DWORD
*
pcbProvName
)
...
...
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