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
121be51f
Commit
121be51f
authored
Feb 16, 2008
by
Rob Shearman
Committed by
Alexandre Julliard
Feb 18, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Add tests for RegSetValueA/W.
Fix RegSetValueA/W to return ERROR_INVALID_PARAMETER if NULL data is passed in.
parent
45b862d5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
2 deletions
+61
-2
registry.c
dlls/advapi32/registry.c
+2
-2
registry.c
dlls/advapi32/tests/registry.c
+59
-0
No files found.
dlls/advapi32/registry.c
View file @
121be51f
...
...
@@ -1078,7 +1078,7 @@ LSTATUS WINAPI RegSetValueW( HKEY hkey, LPCWSTR name, DWORD type, LPCWSTR data,
TRACE
(
"(%p,%s,%d,%s,%d)
\n
"
,
hkey
,
debugstr_w
(
name
),
type
,
debugstr_w
(
data
),
count
);
if
(
type
!=
REG_SZ
)
return
ERROR_INVALID_PARAMETER
;
if
(
type
!=
REG_SZ
||
!
data
)
return
ERROR_INVALID_PARAMETER
;
if
(
name
&&
name
[
0
])
/* need to create the subkey */
{
...
...
@@ -1104,7 +1104,7 @@ LSTATUS WINAPI RegSetValueA( HKEY hkey, LPCSTR name, DWORD type, LPCSTR data, DW
TRACE
(
"(%p,%s,%d,%s,%d)
\n
"
,
hkey
,
debugstr_a
(
name
),
type
,
debugstr_a
(
data
),
count
);
if
(
type
!=
REG_SZ
)
return
ERROR_INVALID_PARAMETER
;
if
(
type
!=
REG_SZ
||
!
data
)
return
ERROR_INVALID_PARAMETER
;
if
(
name
&&
name
[
0
])
/* need to create the subkey */
{
...
...
dlls/advapi32/tests/registry.c
View file @
121be51f
...
...
@@ -295,12 +295,42 @@ static void test_set_value(void)
static
const
WCHAR
emptyW
[]
=
{
0
};
static
const
WCHAR
string1W
[]
=
{
'T'
,
'h'
,
'i'
,
's'
,
'N'
,
'e'
,
'v'
,
'e'
,
'r'
,
'B'
,
'r'
,
'e'
,
'a'
,
'k'
,
's'
,
0
};
static
const
WCHAR
string2W
[]
=
{
'T'
,
'h'
,
'i'
,
's'
,
0
,
'B'
,
'r'
,
'e'
,
'a'
,
'k'
,
's'
,
0
,
0
,
'A'
,
0
,
0
,
0
,
'L'
,
'o'
,
't'
,
0
,
0
,
0
,
0
,
0
};
static
const
WCHAR
substring2W
[]
=
{
'T'
,
'h'
,
'i'
,
's'
,
0
};
static
const
char
name1A
[]
=
"CleanSingleString"
;
static
const
char
name2A
[]
=
"SomeIntraZeroedString"
;
static
const
char
emptyA
[]
=
""
;
static
const
char
string1A
[]
=
"ThisNeverBreaks"
;
static
const
char
string2A
[]
=
"This
\0
Breaks
\0\0
A
\0\0\0
Lot
\0\0\0\0
"
;
static
const
char
substring2A
[]
=
"This"
;
ret
=
RegSetValueA
(
hkey_main
,
NULL
,
REG_SZ
,
NULL
,
0
);
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"RegSetValueA should have failed with ERROR_INVALID_PARAMETER instead of %d
\n
"
,
ret
);
ret
=
RegSetValueA
(
hkey_main
,
NULL
,
REG_SZ
,
string1A
,
sizeof
(
string1A
));
ok
(
ret
==
ERROR_SUCCESS
,
"RegSetValueA failed: %d, GLE=%d
\n
"
,
ret
,
GetLastError
());
test_hkey_main_Value_A
(
NULL
,
string1A
,
sizeof
(
string1A
));
test_hkey_main_Value_W
(
NULL
,
string1W
,
sizeof
(
string1W
));
/* RegSetValueA ignores the size passed in */
ret
=
RegSetValueA
(
hkey_main
,
NULL
,
REG_SZ
,
string1A
,
4
);
ok
(
ret
==
ERROR_SUCCESS
,
"RegSetValueA failed: %d, GLE=%d
\n
"
,
ret
,
GetLastError
());
test_hkey_main_Value_A
(
NULL
,
string1A
,
sizeof
(
string1A
));
test_hkey_main_Value_W
(
NULL
,
string1W
,
sizeof
(
string1W
));
/* stops at first null */
ret
=
RegSetValueA
(
hkey_main
,
NULL
,
REG_SZ
,
string2A
,
sizeof
(
string2A
));
ok
(
ret
==
ERROR_SUCCESS
,
"RegSetValueA failed: %d, GLE=%d
\n
"
,
ret
,
GetLastError
());
test_hkey_main_Value_A
(
NULL
,
substring2A
,
sizeof
(
substring2A
));
test_hkey_main_Value_W
(
NULL
,
substring2W
,
sizeof
(
substring2W
));
/* only REG_SZ is supported */
ret
=
RegSetValueA
(
hkey_main
,
NULL
,
REG_BINARY
,
string2A
,
sizeof
(
string2A
));
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"RegSetValueA should have returned ERROR_INVALID_PARAMETER instead of %d
\n
"
,
ret
);
ret
=
RegSetValueA
(
hkey_main
,
NULL
,
REG_EXPAND_SZ
,
string2A
,
sizeof
(
string2A
));
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"RegSetValueA should have returned ERROR_INVALID_PARAMETER instead of %d
\n
"
,
ret
);
ret
=
RegSetValueA
(
hkey_main
,
NULL
,
REG_MULTI_SZ
,
string2A
,
sizeof
(
string2A
));
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"RegSetValueA should have returned ERROR_INVALID_PARAMETER instead of %d
\n
"
,
ret
);
/* Test RegSetValueExA with a 'zero-byte' string (as Office 2003 does).
* Surprisingly enough we're supposed to get zero bytes out of it.
...
...
@@ -334,6 +364,35 @@ static void test_set_value(void)
/* 9x doesn't support W-calls, so don't test them then */
if
(
GLE
==
ERROR_CALL_NOT_IMPLEMENTED
)
return
;
ret
=
RegSetValueW
(
hkey_main
,
NULL
,
REG_SZ
,
NULL
,
0
);
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"RegSetValueW should have failed with ERROR_INVALID_PARAMETER instead of %d
\n
"
,
ret
);
ret
=
RegSetValueW
(
hkey_main
,
NULL
,
REG_SZ
,
string1W
,
sizeof
(
string1W
));
ok
(
ret
==
ERROR_SUCCESS
,
"RegSetValueW failed: %d, GLE=%d
\n
"
,
ret
,
GetLastError
());
test_hkey_main_Value_A
(
NULL
,
string1A
,
sizeof
(
string1A
));
test_hkey_main_Value_W
(
NULL
,
string1W
,
sizeof
(
string1W
));
/* RegSetValueA ignores the size passed in */
ret
=
RegSetValueW
(
hkey_main
,
NULL
,
REG_SZ
,
string1W
,
4
*
sizeof
(
string1W
[
0
]));
ok
(
ret
==
ERROR_SUCCESS
,
"RegSetValueW failed: %d, GLE=%d
\n
"
,
ret
,
GetLastError
());
test_hkey_main_Value_A
(
NULL
,
string1A
,
sizeof
(
string1A
));
test_hkey_main_Value_W
(
NULL
,
string1W
,
sizeof
(
string1W
));
/* stops at first null */
ret
=
RegSetValueW
(
hkey_main
,
NULL
,
REG_SZ
,
string2W
,
sizeof
(
string2W
));
ok
(
ret
==
ERROR_SUCCESS
,
"RegSetValueW failed: %d, GLE=%d
\n
"
,
ret
,
GetLastError
());
test_hkey_main_Value_A
(
NULL
,
substring2A
,
sizeof
(
substring2A
));
test_hkey_main_Value_W
(
NULL
,
substring2W
,
sizeof
(
substring2W
));
/* only REG_SZ is supported */
ret
=
RegSetValueW
(
hkey_main
,
NULL
,
REG_BINARY
,
string2W
,
sizeof
(
string2W
));
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"RegSetValueW should have returned ERROR_INVALID_PARAMETER instead of %d
\n
"
,
ret
);
ret
=
RegSetValueW
(
hkey_main
,
NULL
,
REG_EXPAND_SZ
,
string2W
,
sizeof
(
string2W
));
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"RegSetValueW should have returned ERROR_INVALID_PARAMETER instead of %d
\n
"
,
ret
);
ret
=
RegSetValueW
(
hkey_main
,
NULL
,
REG_MULTI_SZ
,
string2W
,
sizeof
(
string2W
));
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"RegSetValueW should have returned ERROR_INVALID_PARAMETER instead of %d
\n
"
,
ret
);
/* test RegSetValueExW with normal string */
ret
=
RegSetValueExW
(
hkey_main
,
name1W
,
0
,
REG_SZ
,
(
const
BYTE
*
)
string1W
,
sizeof
(
string1W
));
ok
(
ret
==
ERROR_SUCCESS
,
"RegSetValueExW failed: %d, GLE=%d
\n
"
,
ret
,
GetLastError
());
...
...
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