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
060ed4cf
Commit
060ed4cf
authored
Nov 06, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Nov 07, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rsaenh: Use helper function to create a container's registry key.
parent
58269419
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
27 deletions
+37
-27
rsaenh.c
dlls/rsaenh/rsaenh.c
+37
-27
No files found.
dlls/rsaenh/rsaenh.c
View file @
060ed4cf
...
...
@@ -906,6 +906,35 @@ static void store_key_pair(HCRYPTKEY hCryptKey, HKEY hKey, LPCSTR szValueName, D
}
/******************************************************************************
* create_container_key [Internal]
*
* Creates the registry key for a key container's persistent storage.
*
* PARAMS
* pKeyContainer [I] Pointer to the key container
* sam [I] Desired registry access
* phKey [O] Returned key
*/
static
BOOL
create_container_key
(
KEYCONTAINER
*
pKeyContainer
,
REGSAM
sam
,
HKEY
*
phKey
)
{
CHAR
szRSABase
[
MAX_PATH
];
HKEY
hRootKey
;
sprintf
(
szRSABase
,
RSAENH_REGKEY
,
pKeyContainer
->
szName
);
if
(
pKeyContainer
->
dwFlags
&
CRYPT_MACHINE_KEYSET
)
hRootKey
=
HKEY_LOCAL_MACHINE
;
else
hRootKey
=
HKEY_CURRENT_USER
;
/* @@ Wine registry key: HKLM\Software\Wine\Crypto\RSA */
/* @@ Wine registry key: HKCU\Software\Wine\Crypto\RSA */
return
RegCreateKeyExA
(
hRootKey
,
szRSABase
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
sam
,
NULL
,
phKey
,
NULL
)
==
ERROR_SUCCESS
;
}
/******************************************************************************
* store_key_container_keys [Internal]
*
* Stores key container's keys in a persistent location.
...
...
@@ -915,27 +944,19 @@ static void store_key_pair(HCRYPTKEY hCryptKey, HKEY hKey, LPCSTR szValueName, D
*/
static
void
store_key_container_keys
(
KEYCONTAINER
*
pKeyContainer
)
{
CHAR
szRSABase
[
MAX_PATH
];
HKEY
hKey
,
hRootKey
;
HKEY
hKey
;
DWORD
dwFlags
;
/* On WinXP, persistent keys are stored in a file located at:
* $AppData$\\Microsoft\\Crypto\\RSA\\$SID$\\some_hex_string
*/
sprintf
(
szRSABase
,
RSAENH_REGKEY
,
pKeyContainer
->
szName
);
if
(
pKeyContainer
->
dwFlags
&
CRYPT_MACHINE_KEYSET
)
{
hRootKey
=
HKEY_LOCAL_MACHINE
;
if
(
pKeyContainer
->
dwFlags
&
CRYPT_MACHINE_KEYSET
)
dwFlags
=
CRYPTPROTECT_LOCAL_MACHINE
;
}
else
{
hRootKey
=
HKEY_CURRENT_USER
;
else
dwFlags
=
0
;
}
/* @@ Wine registry key: HKLM\Software\Wine\Crypto\RSA */
/* @@ Wine registry key: HKCU\Software\Wine\Crypto\RSA */
if
(
RegCreateKeyExA
(
hRootKey
,
szRSABase
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_WRITE
,
NULL
,
&
hKey
,
NULL
)
==
ERROR_SUCCESS
)
if
(
create_container_key
(
pKeyContainer
,
KEY_WRITE
,
&
hKey
))
{
store_key_pair
(
pKeyContainer
->
hKeyExchangeKeyPair
,
hKey
,
"KeyExchangeKeyPair"
,
dwFlags
);
...
...
@@ -1006,21 +1027,10 @@ static HCRYPTPROV new_key_container(PCCH pszContainerName, DWORD dwFlags, const
/* The new key container has to be inserted into the CSP immediately
* after creation to be available for CPGetProvParam's PP_ENUMCONTAINERS. */
if
(
!
(
dwFlags
&
CRYPT_VERIFYCONTEXT
))
{
CHAR
szRSABase
[
MAX_PATH
];
HKEY
hRootKey
,
hKey
;
sprintf
(
szRSABase
,
RSAENH_REGKEY
,
pKeyContainer
->
szName
);
if
(
pKeyContainer
->
dwFlags
&
CRYPT_MACHINE_KEYSET
)
{
hRootKey
=
HKEY_LOCAL_MACHINE
;
}
else
{
hRootKey
=
HKEY_CURRENT_USER
;
}
HKEY
hKey
;
/* @@ Wine registry key: HKLM\Software\Wine\Crypto\RSA */
/* @@ Wine registry key: HKCU\Software\Wine\Crypto\RSA */
RegCreateKeyA
(
hRootKey
,
szRSABase
,
&
hKey
);
RegCloseKey
(
hKey
);
if
(
create_container_key
(
pKeyContainer
,
KEY_WRITE
,
&
hKey
))
RegCloseKey
(
hKey
);
}
}
...
...
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