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
500be1e8
Commit
500be1e8
authored
Nov 18, 2008
by
Francois Gouget
Committed by
Alexandre Julliard
Nov 19, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Test how NT(Set, Query)ValueKey() handle non-terminated strings.
parent
d7d95ca2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
+27
-2
reg.c
dlls/ntdll/tests/reg.c
+27
-2
No files found.
dlls/ntdll/tests/reg.c
View file @
500be1e8
...
...
@@ -29,6 +29,11 @@
#include "winnls.h"
#include "stdlib.h"
/* A test string */
static
const
WCHAR
stringW
[]
=
{
's'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
'W'
,
0
};
/* A size, in bytes, short enough to cause truncation of the above */
#define STR_TRUNC_SIZE (sizeof(stringW)-2*sizeof(*stringW))
#ifndef __WINE_WINTERNL_H
/* RtlQueryRegistryValues structs and defines */
...
...
@@ -413,16 +418,20 @@ static void test_NtSetValueKey(void)
UNICODE_STRING
ValName
;
DWORD
data
=
711
;
pRtlCreateUnicodeStringFromAsciiz
(
&
ValName
,
"deletetest"
);
InitializeObjectAttributes
(
&
attr
,
&
winetestpath
,
0
,
0
,
0
);
status
=
pNtOpenKey
(
&
key
,
am
,
&
attr
);
ok
(
status
==
STATUS_SUCCESS
,
"NtOpenKey Failed: 0x%08x
\n
"
,
status
);
pRtlCreateUnicodeStringFromAsciiz
(
&
ValName
,
"deletetest"
);
status
=
pNtSetValueKey
(
key
,
&
ValName
,
0
,
REG_DWORD
,
&
data
,
sizeof
(
data
));
ok
(
status
==
STATUS_SUCCESS
,
"NtSetValueKey Failed: 0x%08x
\n
"
,
status
);
pRtlFreeUnicodeString
(
&
ValName
);
pRtlCreateUnicodeStringFromAsciiz
(
&
ValName
,
"stringtest"
);
status
=
pNtSetValueKey
(
key
,
&
ValName
,
0
,
REG_SZ
,
(
VOID
*
)
stringW
,
STR_TRUNC_SIZE
);
ok
(
status
==
STATUS_SUCCESS
,
"NtSetValueKey Failed: 0x%08x
\n
"
,
status
);
pRtlFreeUnicodeString
(
&
ValName
);
pNtClose
(
key
);
}
...
...
@@ -545,6 +554,22 @@ static void test_NtQueryValueKey(void)
HeapFree
(
GetProcessHeap
(),
0
,
full_info
);
pRtlFreeUnicodeString
(
&
ValName
);
pRtlCreateUnicodeStringFromAsciiz
(
&
ValName
,
"stringtest"
);
status
=
pNtQueryValueKey
(
key
,
&
ValName
,
KeyValuePartialInformation
,
NULL
,
0
,
&
len
);
todo_wine
ok
(
status
==
STATUS_BUFFER_TOO_SMALL
,
"NtQueryValueKey should have returned STATUS_BUFFER_TOO_SMALL instead of 0x%08x
\n
"
,
status
);
partial_info
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
+
1
);
memset
((
BYTE
*
)
partial_info
,
0xbd
,
len
+
1
);
status
=
pNtQueryValueKey
(
key
,
&
ValName
,
KeyValuePartialInformation
,
partial_info
,
len
,
&
len
);
ok
(
status
==
STATUS_SUCCESS
,
"NtQueryValueKey should have returned STATUS_SUCCESS instead of 0x%08x
\n
"
,
status
);
ok
(
partial_info
->
TitleIndex
==
0
,
"NtQueryValueKey returned wrong TitleIndex %d
\n
"
,
partial_info
->
TitleIndex
);
ok
(
partial_info
->
Type
==
REG_SZ
,
"NtQueryValueKey returned wrong Type %d
\n
"
,
partial_info
->
Type
);
ok
(
partial_info
->
DataLength
==
STR_TRUNC_SIZE
,
"NtQueryValueKey returned wrong DataLength %d
\n
"
,
partial_info
->
DataLength
);
ok
(
!
memcmp
(
partial_info
->
Data
,
stringW
,
STR_TRUNC_SIZE
),
"incorrect Data returned
\n
"
);
ok
(
*
(
partial_info
->
Data
+
STR_TRUNC_SIZE
)
==
0xbd
,
"string overflowed %02x
\n
"
,
*
(
partial_info
->
Data
+
STR_TRUNC_SIZE
));
HeapFree
(
GetProcessHeap
(),
0
,
partial_info
);
pRtlFreeUnicodeString
(
&
ValName
);
pNtClose
(
key
);
}
...
...
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