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
acc41b50
Commit
acc41b50
authored
Apr 02, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Don't use the static Unicode buffer for value names since they can be…
advapi32: Don't use the static Unicode buffer for value names since they can be larger than MAX_PATH.
parent
935cc798
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
14 deletions
+20
-14
registry.c
dlls/advapi32/registry.c
+18
-13
registry.c
dlls/advapi32/tests/registry.c
+2
-1
No files found.
dlls/advapi32/registry.c
View file @
acc41b50
...
...
@@ -1103,6 +1103,7 @@ LSTATUS WINAPI RegSetValueExA( HKEY hkey, LPCSTR name, DWORD reserved, DWORD typ
CONST
BYTE
*
data
,
DWORD
count
)
{
ANSI_STRING
nameA
;
UNICODE_STRING
nameW
;
WCHAR
*
dataW
=
NULL
;
NTSTATUS
status
;
...
...
@@ -1133,10 +1134,10 @@ LSTATUS WINAPI RegSetValueExA( HKEY hkey, LPCSTR name, DWORD reserved, DWORD typ
}
RtlInitAnsiString
(
&
nameA
,
name
);
if
(
!
(
status
=
RtlAnsiStringToUnicodeString
(
&
NtCurrentTeb
()
->
StaticUnicodeString
,
&
nameA
,
FALSE
)))
if
(
!
(
status
=
RtlAnsiStringToUnicodeString
(
&
nameW
,
&
nameA
,
TRUE
)))
{
status
=
NtSetValueKey
(
hkey
,
&
NtCurrentTeb
()
->
StaticUnicodeString
,
0
,
type
,
data
,
count
);
status
=
NtSetValueKey
(
hkey
,
&
nameW
,
0
,
type
,
data
,
count
);
RtlFreeUnicodeString
(
&
nameW
);
}
HeapFree
(
GetProcessHeap
(),
0
,
dataW
);
return
RtlNtStatusToDosError
(
status
);
...
...
@@ -1305,6 +1306,7 @@ LSTATUS WINAPI RegQueryValueExA( HKEY hkey, LPCSTR name, LPDWORD reserved, LPDWO
{
NTSTATUS
status
;
ANSI_STRING
nameA
;
UNICODE_STRING
nameW
;
DWORD
total_size
,
datalen
=
0
;
char
buffer
[
256
],
*
buf_ptr
=
buffer
;
KEY_VALUE_PARTIAL_INFORMATION
*
info
=
(
KEY_VALUE_PARTIAL_INFORMATION
*
)
buffer
;
...
...
@@ -1323,12 +1325,11 @@ LSTATUS WINAPI RegQueryValueExA( HKEY hkey, LPCSTR name, LPDWORD reserved, LPDWO
if
(
type
)
*
type
=
REG_NONE
;
RtlInitAnsiString
(
&
nameA
,
name
);
if
((
status
=
RtlAnsiStringToUnicodeString
(
&
NtCurrentTeb
()
->
StaticUnicodeString
,
&
nameA
,
FALSE
)))
if
((
status
=
RtlAnsiStringToUnicodeString
(
&
nameW
,
&
nameA
,
TRUE
)))
return
RtlNtStatusToDosError
(
status
);
status
=
NtQueryValueKey
(
hkey
,
&
NtCurrentTeb
()
->
StaticUnicodeString
,
KeyValuePartialInformation
,
buffer
,
sizeof
(
buffer
),
&
total_size
);
status
=
NtQueryValueKey
(
hkey
,
&
nameW
,
KeyValuePartialInformation
,
buffer
,
sizeof
(
buffer
),
&
total_size
);
if
(
status
&&
status
!=
STATUS_BUFFER_OVERFLOW
)
goto
done
;
/* we need to fetch the contents for a string type even if not requested,
...
...
@@ -1345,8 +1346,8 @@ LSTATUS WINAPI RegQueryValueExA( HKEY hkey, LPCSTR name, LPDWORD reserved, LPDWO
goto
done
;
}
info
=
(
KEY_VALUE_PARTIAL_INFORMATION
*
)
buf_ptr
;
status
=
NtQueryValueKey
(
hkey
,
&
NtCurrentTeb
()
->
StaticUnicodeString
,
KeyValuePartialInformation
,
buf_ptr
,
total_size
,
&
total_size
);
status
=
NtQueryValueKey
(
hkey
,
&
nameW
,
KeyValuePartialInformation
,
buf_ptr
,
total_size
,
&
total_size
);
}
if
(
status
)
goto
done
;
...
...
@@ -1384,6 +1385,7 @@ LSTATUS WINAPI RegQueryValueExA( HKEY hkey, LPCSTR name, LPDWORD reserved, LPDWO
done:
if
(
buf_ptr
!=
buffer
)
HeapFree
(
GetProcessHeap
(),
0
,
buf_ptr
);
RtlFreeUnicodeString
(
&
nameW
);
return
RtlNtStatusToDosError
(
status
);
}
...
...
@@ -1955,15 +1957,18 @@ LSTATUS WINAPI RegDeleteValueW( HKEY hkey, LPCWSTR name )
*/
LSTATUS
WINAPI
RegDeleteValueA
(
HKEY
hkey
,
LPCSTR
name
)
{
STRING
nameA
;
ANSI_STRING
nameA
;
UNICODE_STRING
nameW
;
NTSTATUS
status
;
if
(
!
(
hkey
=
get_special_root_hkey
(
hkey
)))
return
ERROR_INVALID_HANDLE
;
RtlInitAnsiString
(
&
nameA
,
name
);
if
(
!
(
status
=
RtlAnsiStringToUnicodeString
(
&
NtCurrentTeb
()
->
StaticUnicodeString
,
&
nameA
,
FALSE
)))
status
=
NtDeleteValueKey
(
hkey
,
&
NtCurrentTeb
()
->
StaticUnicodeString
);
if
(
!
(
status
=
RtlAnsiStringToUnicodeString
(
&
nameW
,
&
nameA
,
TRUE
)))
{
status
=
NtDeleteValueKey
(
hkey
,
&
nameW
);
RtlFreeUnicodeString
(
&
nameW
);
}
return
RtlNtStatusToDosError
(
status
);
}
...
...
dlls/advapi32/tests/registry.c
View file @
acc41b50
...
...
@@ -1968,7 +1968,8 @@ static void test_delete_value(void)
memset
(
longname
,
'a'
,
400
);
longname
[
400
]
=
0
;
res
=
RegDeleteValueA
(
hkey_main
,
longname
);
todo_wine
ok
(
res
==
ERROR_FILE_NOT_FOUND
,
"expect ERROR_FILE_NOT_FOUND, got %i
\n
"
,
res
);
ok
(
res
==
ERROR_FILE_NOT_FOUND
||
broken
(
res
==
ERROR_MORE_DATA
),
/* nt4, win2k */
"expect ERROR_FILE_NOT_FOUND, got %i
\n
"
,
res
);
}
START_TEST
(
registry
)
...
...
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