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
ece65a48
Commit
ece65a48
authored
Nov 20, 2008
by
Francois Gouget
Committed by
Alexandre Julliard
Nov 21, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Fix the line number reported by test_hkey_main_Value_[AW]().
parent
9ce2bd20
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
16 deletions
+19
-16
registry.c
dlls/advapi32/tests/registry.c
+19
-16
No files found.
dlls/advapi32/tests/registry.c
View file @
ece65a48
...
...
@@ -199,7 +199,9 @@ static void setup_main_key(void)
assert
(
!
RegCreateKeyA
(
HKEY_CURRENT_USER
,
"Software
\\
Wine
\\
Test"
,
&
hkey_main
));
}
static
void
test_hkey_main_Value_A
(
LPCSTR
name
,
LPCSTR
string
,
#define lok ok_(__FILE__, line)
#define test_hkey_main_Value_A(name, string, full_byte_len) _test_hkey_main_Value_A(__LINE__, name, string, full_byte_len)
static
void
_test_hkey_main_Value_A
(
int
line
,
LPCSTR
name
,
LPCSTR
string
,
DWORD
full_byte_len
)
{
DWORD
ret
,
type
,
cbData
;
...
...
@@ -214,14 +216,14 @@ static void test_hkey_main_Value_A(LPCSTR name, LPCSTR string,
SetLastError
(
0xdeadbeef
);
ret
=
RegQueryValueExA
(
hkey_main
,
name
,
NULL
,
&
type
,
NULL
,
&
cbData
);
GLE
=
GetLastError
();
ok
(
ret
==
ERROR_SUCCESS
,
"RegQueryValueExA
failed: %d, GLE=%d
\n
"
,
ret
,
GLE
);
lok
(
ret
==
ERROR_SUCCESS
,
"RegQueryValueExA/1
failed: %d, GLE=%d
\n
"
,
ret
,
GLE
);
/* It is wrong for the Ansi version to not be implemented */
ok
(
GLE
==
0xdeadbeef
,
"RegQueryValueExA set GLE = %u
\n
"
,
GLE
);
if
(
GLE
==
ERROR_CALL_NOT_IMPLEMENTED
)
return
;
str_byte_len
=
(
string
?
lstrlenA
(
string
)
:
0
)
+
1
;
ok
(
type
==
REG_SZ
,
"RegQueryValueExA
returned type %d
\n
"
,
type
);
ok
(
cbData
==
full_byte_len
||
cbData
==
str_byte_len
/* Win9x */
,
lok
(
type
==
REG_SZ
,
"RegQueryValueExA/1
returned type %d
\n
"
,
type
);
l
ok
(
cbData
==
full_byte_len
||
cbData
==
str_byte_len
/* Win9x */
,
"cbData=%d instead of %d or %d
\n
"
,
cbData
,
full_byte_len
,
str_byte_len
);
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cbData
+
1
);
...
...
@@ -229,24 +231,25 @@ static void test_hkey_main_Value_A(LPCSTR name, LPCSTR string,
type
=
0xdeadbeef
;
ret
=
RegQueryValueExA
(
hkey_main
,
name
,
NULL
,
&
type
,
value
,
&
cbData
);
GLE
=
GetLastError
();
ok
(
ret
==
ERROR_SUCCESS
,
"RegQueryValueExA
failed: %d, GLE=%d
\n
"
,
ret
,
GLE
);
lok
(
ret
==
ERROR_SUCCESS
,
"RegQueryValueExA/2
failed: %d, GLE=%d
\n
"
,
ret
,
GLE
);
if
(
!
string
)
{
/* When cbData == 0, RegQueryValueExA() should not modify the buffer */
ok
(
*
value
==
0xbd
||
(
cbData
==
1
&&
*
value
==
'\0'
)
/* Win9x */
,
l
ok
(
*
value
==
0xbd
||
(
cbData
==
1
&&
*
value
==
'\0'
)
/* Win9x */
,
"RegQueryValueExA overflowed: cbData=%u *value=%02x
\n
"
,
cbData
,
*
value
);
}
else
{
ok
(
memcmp
(
value
,
string
,
cbData
)
==
0
,
"RegQueryValueExA
failed: %s/%d != %s/%d
\n
"
,
lok
(
memcmp
(
value
,
string
,
cbData
)
==
0
,
"RegQueryValueExA/2
failed: %s/%d != %s/%d
\n
"
,
wine_debugstr_an
((
char
*
)
value
,
cbData
),
cbData
,
wine_debugstr_an
(
string
,
full_byte_len
),
full_byte_len
);
ok
(
*
(
value
+
cbData
)
==
0xbd
,
"RegQueryValueExA overflowed a
t %u: %02x != bd
\n
"
,
cbData
,
*
(
value
+
cbData
));
lok
(
*
(
value
+
cbData
)
==
0xbd
,
"RegQueryValueExA/2 overflowed at offse
t %u: %02x != bd
\n
"
,
cbData
,
*
(
value
+
cbData
));
}
HeapFree
(
GetProcessHeap
(),
0
,
value
);
}
static
void
test_hkey_main_Value_W
(
LPCWSTR
name
,
LPCWSTR
string
,
#define test_hkey_main_Value_W(name, string, full_byte_len) _test_hkey_main_Value_W(__LINE__, name, string, full_byte_len)
static
void
_test_hkey_main_Value_W
(
int
line
,
LPCWSTR
name
,
LPCWSTR
string
,
DWORD
full_byte_len
)
{
DWORD
ret
,
type
,
cbData
;
...
...
@@ -260,15 +263,15 @@ static void test_hkey_main_Value_W(LPCWSTR name, LPCWSTR string,
SetLastError
(
0xdeadbeef
);
ret
=
RegQueryValueExW
(
hkey_main
,
name
,
NULL
,
&
type
,
NULL
,
&
cbData
);
GLE
=
GetLastError
();
ok
(
ret
==
ERROR_SUCCESS
,
"RegQueryValueExW
failed: %d, GLE=%d
\n
"
,
ret
,
GLE
);
lok
(
ret
==
ERROR_SUCCESS
,
"RegQueryValueExW/1
failed: %d, GLE=%d
\n
"
,
ret
,
GLE
);
if
(
GLE
==
ERROR_CALL_NOT_IMPLEMENTED
)
{
win_skip
(
"RegQueryValueExW() is not implemented
\n
"
);
return
;
}
ok
(
type
==
REG_SZ
,
"RegQueryValueExW
returned type %d
\n
"
,
type
);
ok
(
cbData
==
full_byte_len
,
lok
(
type
==
REG_SZ
,
"RegQueryValueExW/1
returned type %d
\n
"
,
type
);
l
ok
(
cbData
==
full_byte_len
,
"cbData=%d instead of %d
\n
"
,
cbData
,
full_byte_len
);
/* Give enough space to overflow by one WCHAR */
...
...
@@ -277,16 +280,16 @@ static void test_hkey_main_Value_W(LPCWSTR name, LPCWSTR string,
type
=
0xdeadbeef
;
ret
=
RegQueryValueExW
(
hkey_main
,
name
,
NULL
,
&
type
,
value
,
&
cbData
);
GLE
=
GetLastError
();
ok
(
ret
==
ERROR_SUCCESS
,
"RegQueryValueExW
failed: %d, GLE=%d
\n
"
,
ret
,
GLE
);
lok
(
ret
==
ERROR_SUCCESS
,
"RegQueryValueExW/2
failed: %d, GLE=%d
\n
"
,
ret
,
GLE
);
if
(
string
)
{
ok
(
memcmp
(
value
,
string
,
cbData
)
==
0
,
"RegQueryValueExW failed: %s/%d != %s/%d
\n
"
,
l
ok
(
memcmp
(
value
,
string
,
cbData
)
==
0
,
"RegQueryValueExW failed: %s/%d != %s/%d
\n
"
,
wine_debugstr_wn
((
WCHAR
*
)
value
,
cbData
/
sizeof
(
WCHAR
)),
cbData
,
wine_debugstr_wn
(
string
,
full_byte_len
/
sizeof
(
WCHAR
)),
full_byte_len
);
}
/* This implies that when cbData == 0, RegQueryValueExW() should not modify the buffer */
ok
(
*
(
value
+
cbData
)
==
0xbd
,
"RegQueryValueExW
overflowed at %u: %02x != bd
\n
"
,
cbData
,
*
(
value
+
cbData
));
ok
(
*
(
value
+
cbData
+
1
)
==
0xbd
,
"RegQueryValueExW
overflowed at %u+1: %02x != bd
\n
"
,
cbData
,
*
(
value
+
cbData
+
1
));
lok
(
*
(
value
+
cbData
)
==
0xbd
,
"RegQueryValueExW/2
overflowed at %u: %02x != bd
\n
"
,
cbData
,
*
(
value
+
cbData
));
lok
(
*
(
value
+
cbData
+
1
)
==
0xbd
,
"RegQueryValueExW/2
overflowed at %u+1: %02x != bd
\n
"
,
cbData
,
*
(
value
+
cbData
+
1
));
HeapFree
(
GetProcessHeap
(),
0
,
value
);
}
...
...
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