Author: jgardou
Date: Fri May 3 16:44:31 2013
New Revision: 58914
URL:
http://svn.reactos.org/svn/reactos?rev=58914&view=rev
Log:
[ADVAPI32]
- SEH-ize access to the data buffer in RegSetValueExW.
Fixes winetest crash
Modified:
trunk/reactos/dll/win32/advapi32/reg/reg.c
Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] Fri May 3 16:44:31 2013
@@ -14,6 +14,7 @@
/* INCLUDES *****************************************************************/
#include <advapi32.h>
+#include <pseh/pseh2.h>
WINE_DEFAULT_DEBUG_CHANNEL(reg);
/* DEFINES ******************************************************************/
@@ -4952,10 +4953,29 @@
DWORD cbData)
{
UNICODE_STRING ValueName;
- PUNICODE_STRING pValueName;
HANDLE KeyHandle;
NTSTATUS Status;
+ if (is_string(dwType) && (cbData != 0))
+ {
+ PWSTR pwsData = (PWSTR)lpData;
+
+ _SEH2_TRY
+ {
+ if((pwsData[cbData / sizeof(WCHAR) - 1] != L'\0') &&
+ (pwsData[cbData / sizeof(WCHAR)] == L'\0'))
+ {
+ /* Increment length if last character is not zero and next is zero */
+ cbData += sizeof(WCHAR);
+ }
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ _SEH2_YIELD(return ERROR_NOACCESS);
+ }
+ _SEH2_END;
+ }
+
Status = MapDefaultKey(&KeyHandle,
hKey);
if (!NT_SUCCESS(Status))
@@ -4964,22 +4984,9 @@
}
RtlInitUnicodeString(&ValueName, lpValueName);
- pValueName = &ValueName;
-
- if (is_string(dwType) && (cbData != 0))
- {
- PWSTR pwsData = (PWSTR)lpData;
-
- if((pwsData[cbData / sizeof(WCHAR) - 1] != L'\0') &&
- (pwsData[cbData / sizeof(WCHAR)] == L'\0'))
- {
- /* Increment length if last character is not zero and next is zero */
- cbData += sizeof(WCHAR);
- }
- }
Status = NtSetValueKey(KeyHandle,
- pValueName,
+ &ValueName,
0,
dwType,
(PVOID)lpData,