From 050de17f6a25c2037ed4dc40d6a83387f790e7ea Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Fri, 24 Apr 2015 17:37:31 +0000 Subject: [PATCH] [NTDLL_WINETEST] - Avoid printing an unterminated string in registry test. Powered by DPH. - Add a ROS hack to avoid a buffer overflow when one of our DPRINTs is returned by WaitForDebugEvent (e.g. when using DPH) svn path=/trunk/; revision=67382 --- rostests/winetests/ntdll/exception.c | 8 ++++++++ rostests/winetests/ntdll/reg.c | 20 ++------------------ 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/rostests/winetests/ntdll/exception.c b/rostests/winetests/ntdll/exception.c index ccd1b615638..8e7894ee345 100644 --- a/rostests/winetests/ntdll/exception.c +++ b/rostests/winetests/ntdll/exception.c @@ -959,7 +959,15 @@ static void test_debugger(void) else if (de.dwDebugEventCode == OUTPUT_DEBUG_STRING_EVENT) { int stage; +#ifdef __REACTOS__ + /* This will catch our DPRINTs, such as + * "WARNING: RtlpDphTargetDllsLogicInitialize at ..\..\lib\rtl\heappage.c:1283 is UNIMPLEMENTED!" + * so we need a full-size buffer to avoid a stack overflow + */ + char buffer[513]; +#else char buffer[64]; +#endif status = pNtReadVirtualMemory(pi.hProcess, &test_stage, &stage, sizeof(stage), &size_read); diff --git a/rostests/winetests/ntdll/reg.c b/rostests/winetests/ntdll/reg.c index 52a13e9dc1a..a7910bb7a64 100755 --- a/rostests/winetests/ntdll/reg.c +++ b/rostests/winetests/ntdll/reg.c @@ -204,22 +204,9 @@ static NTSTATUS WINAPI QueryRoutine (IN PCWSTR ValueName, IN ULONG ValueType, IN IN ULONG ValueLength, IN PVOID Context, IN PVOID EntryContext) { NTSTATUS ret = STATUS_SUCCESS; - int ValueNameLength = 0; - LPSTR ValName = 0; + trace("**Test %d**\n", CurrentTest); - - if(ValueName) - { - ValueNameLength = lstrlenW(ValueName); - - ValName = pRtlAllocateHeap(GetProcessHeap(), 0, ValueNameLength); - - WideCharToMultiByte(CP_ACP, 0, ValueName, ValueNameLength+1, ValName, ValueNameLength, NULL, NULL); - - trace("ValueName: %s\n", ValName); - } - else - trace("ValueName: (null)\n"); + trace("ValueName: %s\n", wine_dbgstr_w(ValueName)); switch(ValueType) { @@ -262,9 +249,6 @@ static NTSTATUS WINAPI QueryRoutine (IN PCWSTR ValueName, IN ULONG ValueType, IN CurrentTest++; - if(ValName) - pRtlFreeHeap(GetProcessHeap(), 0, ValName); - return ret; }