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
7041b4db
Commit
7041b4db
authored
Jul 02, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 02, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Implement RegSetKeyValue().
parent
9d59d4e5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
31 deletions
+85
-31
advapi32.spec
dlls/advapi32/advapi32.spec
+2
-2
registry.c
dlls/advapi32/registry.c
+48
-29
registry.c
dlls/advapi32/tests/registry.c
+33
-0
winreg.h
include/winreg.h
+2
-0
No files found.
dlls/advapi32/advapi32.spec
View file @
7041b4db
...
@@ -645,8 +645,8 @@
...
@@ -645,8 +645,8 @@
# @ stub RegSaveKeyExW
# @ stub RegSaveKeyExW
@ stdcall RegSaveKeyW(long ptr ptr)
@ stdcall RegSaveKeyW(long ptr ptr)
@ stdcall RegSetKeySecurity(long long ptr)
@ stdcall RegSetKeySecurity(long long ptr)
# @ stub RegSetKeyValueA
@ stdcall RegSetKeyValueA(long str str long ptr long)
# @ stub RegSetKeyValueW
@ stdcall RegSetKeyValueW(long wstr wstr long ptr long)
@ stdcall RegSetValueA(long str long ptr long)
@ stdcall RegSetValueA(long str long ptr long)
@ stdcall RegSetValueExA(long str long long ptr long)
@ stdcall RegSetValueExA(long str long long ptr long)
@ stdcall RegSetValueExW(long wstr long long ptr long)
@ stdcall RegSetValueExW(long wstr long long ptr long)
...
...
dlls/advapi32/registry.c
View file @
7041b4db
...
@@ -1276,61 +1276,80 @@ LSTATUS WINAPI RegSetValueExA( HKEY hkey, LPCSTR name, DWORD reserved, DWORD typ
...
@@ -1276,61 +1276,80 @@ LSTATUS WINAPI RegSetValueExA( HKEY hkey, LPCSTR name, DWORD reserved, DWORD typ
* Sets the data for the default or unnamed value of a reg key.
* Sets the data for the default or unnamed value of a reg key.
*
*
* PARAMS
* PARAMS
* h
K
ey [I] Handle to an open key.
* h
k
ey [I] Handle to an open key.
*
lpSubKey
[I] Name of a subkey of hKey.
*
subkey
[I] Name of a subkey of hKey.
*
dwType
[I] Type of information to store.
*
type
[I] Type of information to store.
*
lpData
[I] String that contains the data to set for the default value.
*
data
[I] String that contains the data to set for the default value.
* c
bData
[I] Ignored.
* c
ount
[I] Ignored.
*
*
* RETURNS
* RETURNS
* Success: ERROR_SUCCESS
* Success: ERROR_SUCCESS
* Failure: nonzero error code from Winerror.h
* Failure: nonzero error code from Winerror.h
*/
*/
LSTATUS
WINAPI
RegSetValueW
(
HKEY
hkey
,
LPCWSTR
name
,
DWORD
type
,
LPCWSTR
data
,
DWORD
count
)
LSTATUS
WINAPI
RegSetValueW
(
HKEY
hkey
,
LPCWSTR
subkey
,
DWORD
type
,
LPCWSTR
data
,
DWORD
count
)
{
{
HKEY
subkey
=
hkey
;
TRACE
(
"(%p,%s,%d,%s,%d)
\n
"
,
hkey
,
debugstr_w
(
subkey
),
type
,
debugstr_w
(
data
),
count
);
DWORD
ret
;
TRACE
(
"(%p,%s,%d,%s,%d)
\n
"
,
hkey
,
debugstr_w
(
name
),
type
,
debugstr_w
(
data
),
count
);
if
(
type
!=
REG_SZ
||
!
data
)
return
ERROR_INVALID_PARAMETER
;
if
(
type
!=
REG_SZ
||
!
data
)
return
ERROR_INVALID_PARAMETER
;
if
(
name
&&
name
[
0
])
/* need to create the subkey */
return
RegSetKeyValueW
(
hkey
,
subkey
,
NULL
,
type
,
data
,
(
strlenW
(
data
)
+
1
)
*
sizeof
(
WCHAR
)
);
{
if
((
ret
=
RegCreateKeyW
(
hkey
,
name
,
&
subkey
))
!=
ERROR_SUCCESS
)
return
ret
;
}
ret
=
RegSetValueExW
(
subkey
,
NULL
,
0
,
REG_SZ
,
(
const
BYTE
*
)
data
,
(
strlenW
(
data
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
subkey
!=
hkey
)
RegCloseKey
(
subkey
);
return
ret
;
}
}
/******************************************************************************
/******************************************************************************
* RegSetValueA [ADVAPI32.@]
* RegSetValueA [ADVAPI32.@]
*
*
* See RegSetValueW.
* See RegSetValueW.
*/
*/
LSTATUS
WINAPI
RegSetValueA
(
HKEY
hkey
,
LPCSTR
name
,
DWORD
type
,
LPCSTR
data
,
DWORD
count
)
LSTATUS
WINAPI
RegSetValueA
(
HKEY
hkey
,
LPCSTR
subkey
,
DWORD
type
,
LPCSTR
data
,
DWORD
count
)
{
{
HKEY
subkey
=
hkey
;
TRACE
(
"(%p,%s,%d,%s,%d)
\n
"
,
hkey
,
debugstr_a
(
subkey
),
type
,
debugstr_a
(
data
),
count
);
DWORD
ret
;
TRACE
(
"(%p,%s,%d,%s,%d)
\n
"
,
hkey
,
debugstr_a
(
name
),
type
,
debugstr_a
(
data
),
count
);
if
(
type
!=
REG_SZ
||
!
data
)
return
ERROR_INVALID_PARAMETER
;
if
(
type
!=
REG_SZ
||
!
data
)
return
ERROR_INVALID_PARAMETER
;
if
(
name
&&
name
[
0
])
/* need to create the subkey */
return
RegSetKeyValueA
(
hkey
,
subkey
,
NULL
,
type
,
data
,
strlen
(
data
)
+
1
);
}
/******************************************************************************
* RegSetKeyValueW [ADVAPI32.@]
*/
LONG
WINAPI
RegSetKeyValueW
(
HKEY
hkey
,
LPCWSTR
subkey
,
LPCWSTR
name
,
DWORD
type
,
const
void
*
data
,
DWORD
len
)
{
HKEY
hsubkey
=
NULL
;
DWORD
ret
;
TRACE
(
"(%p,%s,%s,%d,%p,%d)
\n
"
,
hkey
,
debugstr_w
(
subkey
),
debugstr_w
(
name
),
type
,
data
,
len
);
if
(
subkey
&&
subkey
[
0
])
/* need to create the subkey */
{
{
if
((
ret
=
RegCreateKeyA
(
hkey
,
name
,
&
subkey
))
!=
ERROR_SUCCESS
)
return
ret
;
if
((
ret
=
RegCreateKeyW
(
hkey
,
subkey
,
&
hsubkey
))
!=
ERROR_SUCCESS
)
return
ret
;
hkey
=
hsubkey
;
}
}
ret
=
RegSetValueExA
(
subkey
,
NULL
,
0
,
REG_SZ
,
(
const
BYTE
*
)
data
,
strlen
(
data
)
+
1
);
if
(
subkey
!=
hkey
)
RegCloseKey
(
subkey
);
ret
=
RegSetValueExW
(
hkey
,
name
,
0
,
type
,
(
const
BYTE
*
)
data
,
len
);
if
(
hsubkey
)
RegCloseKey
(
hsubkey
);
return
ret
;
return
ret
;
}
}
/******************************************************************************
* RegSetKeyValueA [ADVAPI32.@]
*/
LONG
WINAPI
RegSetKeyValueA
(
HKEY
hkey
,
LPCSTR
subkey
,
LPCSTR
name
,
DWORD
type
,
const
void
*
data
,
DWORD
len
)
{
HKEY
hsubkey
=
NULL
;
DWORD
ret
;
TRACE
(
"(%p,%s,%s,%d,%p,%d)
\n
"
,
hkey
,
debugstr_a
(
subkey
),
debugstr_a
(
name
),
type
,
data
,
len
);
if
(
subkey
&&
subkey
[
0
])
/* need to create the subkey */
{
if
((
ret
=
RegCreateKeyA
(
hkey
,
subkey
,
&
hsubkey
))
!=
ERROR_SUCCESS
)
return
ret
;
hkey
=
hsubkey
;
}
ret
=
RegSetValueExA
(
hkey
,
name
,
0
,
type
,
(
const
BYTE
*
)
data
,
len
);
if
(
hsubkey
)
RegCloseKey
(
hsubkey
);
return
ret
;
}
/******************************************************************************
/******************************************************************************
* RegQueryValueExW [ADVAPI32.@]
* RegQueryValueExW [ADVAPI32.@]
...
...
dlls/advapi32/tests/registry.c
View file @
7041b4db
...
@@ -48,6 +48,7 @@ static NTSTATUS (WINAPI * pNtDeleteKey)(HANDLE);
...
@@ -48,6 +48,7 @@ static NTSTATUS (WINAPI * pNtDeleteKey)(HANDLE);
static
NTSTATUS
(
WINAPI
*
pRtlFormatCurrentUserKeyPath
)(
UNICODE_STRING
*
);
static
NTSTATUS
(
WINAPI
*
pRtlFormatCurrentUserKeyPath
)(
UNICODE_STRING
*
);
static
NTSTATUS
(
WINAPI
*
pRtlFreeUnicodeString
)(
PUNICODE_STRING
);
static
NTSTATUS
(
WINAPI
*
pRtlFreeUnicodeString
)(
PUNICODE_STRING
);
static
LONG
(
WINAPI
*
pRegDeleteKeyValueA
)(
HKEY
,
LPCSTR
,
LPCSTR
);
static
LONG
(
WINAPI
*
pRegDeleteKeyValueA
)(
HKEY
,
LPCSTR
,
LPCSTR
);
static
LONG
(
WINAPI
*
pRegSetKeyValueW
)(
HKEY
,
LPCWSTR
,
LPCWSTR
,
DWORD
,
const
void
*
,
DWORD
);
static
BOOL
limited_user
;
static
BOOL
limited_user
;
...
@@ -137,6 +138,7 @@ static void InitFunctionPtrs(void)
...
@@ -137,6 +138,7 @@ static void InitFunctionPtrs(void)
ADVAPI32_GET_PROC
(
RegDeleteTreeA
);
ADVAPI32_GET_PROC
(
RegDeleteTreeA
);
ADVAPI32_GET_PROC
(
RegDeleteKeyExA
);
ADVAPI32_GET_PROC
(
RegDeleteKeyExA
);
ADVAPI32_GET_PROC
(
RegDeleteKeyValueA
);
ADVAPI32_GET_PROC
(
RegDeleteKeyValueA
);
ADVAPI32_GET_PROC
(
RegSetKeyValueW
);
pIsWow64Process
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"IsWow64Process"
);
pIsWow64Process
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"IsWow64Process"
);
pRtlFormatCurrentUserKeyPath
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlFormatCurrentUserKeyPath"
);
pRtlFormatCurrentUserKeyPath
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlFormatCurrentUserKeyPath"
);
...
@@ -433,6 +435,37 @@ static void test_set_value(void)
...
@@ -433,6 +435,37 @@ static void test_set_value(void)
ok
(
ret
==
ERROR_NOACCESS
,
"RegSetValueExW should have failed with ERROR_NOACCESS: %d, GLE=%d
\n
"
,
ret
,
GetLastError
());
ok
(
ret
==
ERROR_NOACCESS
,
"RegSetValueExW should have failed with ERROR_NOACCESS: %d, GLE=%d
\n
"
,
ret
,
GetLastError
());
ret
=
RegSetValueExW
(
hkey_main
,
name2W
,
0
,
REG_DWORD
,
(
const
BYTE
*
)
1
,
1
);
ret
=
RegSetValueExW
(
hkey_main
,
name2W
,
0
,
REG_DWORD
,
(
const
BYTE
*
)
1
,
1
);
ok
(
ret
==
ERROR_NOACCESS
,
"RegSetValueExW should have failed with ERROR_NOACCESS: %d, GLE=%d
\n
"
,
ret
,
GetLastError
());
ok
(
ret
==
ERROR_NOACCESS
,
"RegSetValueExW should have failed with ERROR_NOACCESS: %d, GLE=%d
\n
"
,
ret
,
GetLastError
());
/* RegSetKeyValue */
if
(
!
pRegSetKeyValueW
)
win_skip
(
"RegSetKeyValue() is not supported.
\n
"
);
else
{
static
const
WCHAR
subkeyW
[]
=
{
's'
,
'u'
,
'b'
,
'k'
,
'e'
,
'y'
,
0
};
DWORD
len
,
type
;
HKEY
subkey
;
ret
=
pRegSetKeyValueW
(
hkey_main
,
NULL
,
name1W
,
REG_SZ
,
(
const
BYTE
*
)
string2W
,
sizeof
(
string2W
));
ok
(
ret
==
ERROR_SUCCESS
,
"got %d
\n
"
,
ret
);
test_hkey_main_Value_A
(
name1A
,
string2A
,
sizeof
(
string2A
));
test_hkey_main_Value_W
(
name1W
,
string2W
,
sizeof
(
string2W
));
ret
=
pRegSetKeyValueW
(
hkey_main
,
subkeyW
,
name1W
,
REG_SZ
,
string1W
,
sizeof
(
string1W
));
ok
(
ret
==
ERROR_SUCCESS
,
"got %d
\n
"
,
ret
);
ret
=
RegOpenKeyExW
(
hkey_main
,
subkeyW
,
0
,
KEY_QUERY_VALUE
,
&
subkey
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %d
\n
"
,
ret
);
type
=
len
=
0
;
ret
=
RegQueryValueExW
(
subkey
,
name1W
,
0
,
&
type
,
NULL
,
&
len
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %d
\n
"
,
ret
);
ok
(
len
==
sizeof
(
string1W
),
"got %d
\n
"
,
len
);
ok
(
type
==
REG_SZ
,
"got type %d
\n
"
,
type
);
ret
=
pRegSetKeyValueW
(
hkey_main
,
subkeyW
,
name1W
,
REG_SZ
,
NULL
,
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %d
\n
"
,
ret
);
RegCloseKey
(
subkey
);
}
}
}
static
void
create_test_entries
(
void
)
static
void
create_test_entries
(
void
)
...
...
include/winreg.h
View file @
7041b4db
...
@@ -169,6 +169,8 @@ WINADVAPI LSTATUS WINAPI RegSaveKeyA(HKEY,LPCSTR,LPSECURITY_ATTRIBUTES);
...
@@ -169,6 +169,8 @@ WINADVAPI LSTATUS WINAPI RegSaveKeyA(HKEY,LPCSTR,LPSECURITY_ATTRIBUTES);
WINADVAPI
LSTATUS
WINAPI
RegSaveKeyW
(
HKEY
,
LPCWSTR
,
LPSECURITY_ATTRIBUTES
);
WINADVAPI
LSTATUS
WINAPI
RegSaveKeyW
(
HKEY
,
LPCWSTR
,
LPSECURITY_ATTRIBUTES
);
#define RegSaveKey WINELIB_NAME_AW(RegSaveKey)
#define RegSaveKey WINELIB_NAME_AW(RegSaveKey)
WINADVAPI
LSTATUS
WINAPI
RegSetKeySecurity
(
HKEY
,
SECURITY_INFORMATION
,
PSECURITY_DESCRIPTOR
);
WINADVAPI
LSTATUS
WINAPI
RegSetKeySecurity
(
HKEY
,
SECURITY_INFORMATION
,
PSECURITY_DESCRIPTOR
);
WINADVAPI
LSTATUS
WINAPI
RegSetKeyValueA
(
HKEY
,
LPCSTR
,
LPCSTR
,
DWORD
,
const
void
*
,
DWORD
);
WINADVAPI
LSTATUS
WINAPI
RegSetKeyValueW
(
HKEY
,
LPCWSTR
,
LPCWSTR
,
DWORD
,
const
void
*
,
DWORD
);
WINADVAPI
LSTATUS
WINAPI
RegSetValueA
(
HKEY
,
LPCSTR
,
DWORD
,
LPCSTR
,
DWORD
);
WINADVAPI
LSTATUS
WINAPI
RegSetValueA
(
HKEY
,
LPCSTR
,
DWORD
,
LPCSTR
,
DWORD
);
WINADVAPI
LSTATUS
WINAPI
RegSetValueW
(
HKEY
,
LPCWSTR
,
DWORD
,
LPCWSTR
,
DWORD
);
WINADVAPI
LSTATUS
WINAPI
RegSetValueW
(
HKEY
,
LPCWSTR
,
DWORD
,
LPCWSTR
,
DWORD
);
#define RegSetValue WINELIB_NAME_AW(RegSetValue)
#define RegSetValue WINELIB_NAME_AW(RegSetValue)
...
...
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