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
21dce1d0
Commit
21dce1d0
authored
May 08, 2007
by
Juan Lang
Committed by
Alexandre Julliard
May 09, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement CertEnumSystemStore.
parent
2f5232d5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
136 additions
and
0 deletions
+136
-0
crypt32.spec
dlls/crypt32/crypt32.spec
+1
-0
store.c
dlls/crypt32/store.c
+87
-0
store.c
dlls/crypt32/tests/store.c
+48
-0
No files found.
dlls/crypt32/crypt32.spec
View file @
21dce1d0
...
...
@@ -34,6 +34,7 @@
@ stdcall CertEnumCTLsInStore(ptr ptr)
@ stdcall CertEnumCertificateContextProperties(ptr long)
@ stdcall CertEnumCertificatesInStore(long ptr)
@ stdcall CertEnumSystemStore(long ptr ptr ptr)
@ stdcall CertFindAttribute(str long ptr)
@ stdcall CertFindCRLInStore(long long long long ptr ptr)
@ stub CertFindCTLInStore
...
...
dlls/crypt32/store.c
View file @
21dce1d0
...
...
@@ -2603,3 +2603,90 @@ void WINAPI CertRemoveStoreFromCollection(HCERTSTORE hCollectionStore,
}
LeaveCriticalSection
(
&
collection
->
cs
);
}
static
LONG
CRYPT_OpenParentStore
(
DWORD
dwFlags
,
void
*
pvSystemStoreLocationPara
,
HKEY
*
key
)
{
HKEY
root
;
LPCWSTR
base
;
TRACE
(
"(%08x, %p)
\n
"
,
dwFlags
,
pvSystemStoreLocationPara
);
switch
(
dwFlags
&
CERT_SYSTEM_STORE_LOCATION_MASK
)
{
case
CERT_SYSTEM_STORE_LOCAL_MACHINE
:
root
=
HKEY_LOCAL_MACHINE
;
base
=
CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH
;
break
;
case
CERT_SYSTEM_STORE_CURRENT_USER
:
root
=
HKEY_CURRENT_USER
;
base
=
CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH
;
break
;
case
CERT_SYSTEM_STORE_CURRENT_SERVICE
:
/* hklm\Software\Microsoft\Cryptography\Services\servicename\
* SystemCertificates
*/
FIXME
(
"CERT_SYSTEM_STORE_CURRENT_SERVICE
\n
"
);
return
ERROR_FILE_NOT_FOUND
;
case
CERT_SYSTEM_STORE_SERVICES
:
/* hklm\Software\Microsoft\Cryptography\Services\servicename\
* SystemCertificates
*/
FIXME
(
"CERT_SYSTEM_STORE_SERVICES"
);
return
ERROR_FILE_NOT_FOUND
;
case
CERT_SYSTEM_STORE_USERS
:
/* hku\user sid\Software\Microsoft\SystemCertificates */
FIXME
(
"CERT_SYSTEM_STORE_USERS
\n
"
);
return
ERROR_FILE_NOT_FOUND
;
case
CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY
:
root
=
HKEY_CURRENT_USER
;
base
=
CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH
;
break
;
case
CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY
:
root
=
HKEY_LOCAL_MACHINE
;
base
=
CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH
;
break
;
case
CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE
:
/* hklm\Software\Microsoft\EnterpriseCertificates */
FIXME
(
"CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE
\n
"
);
return
ERROR_FILE_NOT_FOUND
;
default:
return
ERROR_FILE_NOT_FOUND
;
}
return
RegOpenKeyExW
(
root
,
base
,
0
,
KEY_READ
,
key
);
}
BOOL
WINAPI
CertEnumSystemStore
(
DWORD
dwFlags
,
void
*
pvSystemStoreLocationPara
,
void
*
pvArg
,
PFN_CERT_ENUM_SYSTEM_STORE
pfnEnum
)
{
BOOL
ret
=
FALSE
;
LONG
rc
;
HKEY
key
;
TRACE
(
"(%08x, %p, %p, %p)
\n
"
,
dwFlags
,
pvSystemStoreLocationPara
,
pvArg
,
pfnEnum
);
rc
=
CRYPT_OpenParentStore
(
dwFlags
,
pvArg
,
&
key
);
if
(
!
rc
)
{
DWORD
index
=
0
;
CERT_SYSTEM_STORE_INFO
info
=
{
sizeof
(
info
)
};
ret
=
TRUE
;
do
{
WCHAR
name
[
MAX_PATH
];
DWORD
size
=
sizeof
(
name
)
/
sizeof
(
name
[
0
]);
rc
=
RegEnumKeyExW
(
key
,
index
++
,
name
,
&
size
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
!
rc
)
ret
=
pfnEnum
(
name
,
0
,
&
info
,
NULL
,
pvArg
);
}
while
(
ret
&&
!
rc
);
if
(
ret
&&
rc
!=
ERROR_NO_MORE_ITEMS
)
SetLastError
(
rc
);
}
else
SetLastError
(
rc
);
return
ret
;
}
dlls/crypt32/tests/store.c
View file @
21dce1d0
...
...
@@ -1379,6 +1379,53 @@ static void testCertOpenSystemStore(void)
RegDeleteKeyW
(
HKEY_CURRENT_USER
,
BogusPathW
);
}
struct
EnumSystemStoreInfo
{
BOOL
goOn
;
DWORD
storeCount
;
};
static
BOOL
CALLBACK
enumSystemStoreCB
(
const
void
*
systemStore
,
DWORD
dwFlags
,
PCERT_SYSTEM_STORE_INFO
pStoreInfo
,
void
*
pvReserved
,
void
*
pvArg
)
{
struct
EnumSystemStoreInfo
*
info
=
(
struct
EnumSystemStoreInfo
*
)
pvArg
;
info
->
storeCount
++
;
return
info
->
goOn
;
}
static
void
testCertEnumSystemStore
(
void
)
{
BOOL
ret
;
struct
EnumSystemStoreInfo
info
=
{
FALSE
,
0
};
SetLastError
(
0xdeadbeef
);
ret
=
CertEnumSystemStore
(
0
,
NULL
,
NULL
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"Expected ERROR_FILE_NOT_FOUND, got %08x
\n
"
,
GetLastError
());
/* Crashes
ret = CertEnumSystemStore(CERT_SYSTEM_STORE_LOCAL_MACHINE, NULL, NULL,
NULL);
*/
SetLastError
(
0xdeadbeef
);
ret
=
CertEnumSystemStore
(
CERT_SYSTEM_STORE_LOCAL_MACHINE
,
NULL
,
&
info
,
enumSystemStoreCB
);
/* Callback returning FALSE stops enumeration */
ok
(
!
ret
,
"Expected CertEnumSystemStore to stop
\n
"
);
ok
(
info
.
storeCount
==
0
||
info
.
storeCount
==
1
,
"Expected 0 or 1 stores
\n
"
);
info
.
goOn
=
TRUE
;
info
.
storeCount
=
0
;
ret
=
CertEnumSystemStore
(
CERT_SYSTEM_STORE_LOCAL_MACHINE
,
NULL
,
&
info
,
enumSystemStoreCB
);
ok
(
ret
,
"CertEnumSystemStore failed: %08x
\n
"
,
GetLastError
());
/* There should always be at least My, Root, and CA stores */
ok
(
info
.
storeCount
==
0
||
info
.
storeCount
>=
3
,
"Expected at least 3 stores
\n
"
);
}
static
void
testAddSerialized
(
void
)
{
BOOL
ret
;
...
...
@@ -1545,6 +1592,7 @@ START_TEST(store)
testFileNameStore
();
testCertOpenSystemStore
();
testCertEnumSystemStore
();
testAddSerialized
();
}
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