ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
September 2005
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
22 participants
582 discussions
Start a n
N
ew thread
[weiden] 18011: minor optimization of RtlCreateUnicodeString: as the memory never overlaps, just copy the memory instead of moving it
by weiden@svn.reactos.com
minor optimization of RtlCreateUnicodeString: as the memory never overlaps, just copy the memory instead of moving it Modified: trunk/reactos/lib/rtl/unicode.c _____ Modified: trunk/reactos/lib/rtl/unicode.c --- trunk/reactos/lib/rtl/unicode.c 2005-09-23 11:12:18 UTC (rev 18010) +++ trunk/reactos/lib/rtl/unicode.c 2005-09-23 14:13:44 UTC (rev 18011) @@ -1919,7 +1919,7 @@ if (UniDest->Buffer == NULL) return FALSE; - RtlMoveMemory(UniDest->Buffer, Source, Length); + RtlCopyMemory(UniDest->Buffer, Source, Length); UniDest->MaximumLength = (USHORT)Length; UniDest->Length = Length - sizeof (WCHAR);
19 years, 3 months
1
0
0
0
[weiden] 18010: fixed signedness warning
by weiden@svn.reactos.com
fixed signedness warning Modified: trunk/reactos/lib/rtl/unicode.c _____ Modified: trunk/reactos/lib/rtl/unicode.c --- trunk/reactos/lib/rtl/unicode.c 2005-09-23 09:51:18 UTC (rev 18009) +++ trunk/reactos/lib/rtl/unicode.c 2005-09-23 11:12:18 UTC (rev 18010) @@ -32,19 +32,19 @@ { ULONG Size; NTSTATUS Status; - WCHAR UnicodeChar = 0x20; + WCHAR UnicodeChar = L' '; Size = (NlsLeadByteInfo[**AnsiChar] == 0) ? 1 : 2; Status = RtlMultiByteToUnicodeN(&UnicodeChar, sizeof(WCHAR), NULL, - *AnsiChar, + (PCHAR)*AnsiChar, Size); if (!NT_SUCCESS(Status)) { - UnicodeChar = 0x20; + UnicodeChar = L' '; } *AnsiChar += Size;
19 years, 3 months
1
0
0
0
[gvg] 18009: Remove dead file
by gvg@svn.reactos.com
Remove dead file Deleted: trunk/reactos/ntoskrnl/ke/catch.c _____ Deleted: trunk/reactos/ntoskrnl/ke/catch.c --- trunk/reactos/ntoskrnl/ke/catch.c 2005-09-23 09:23:14 UTC (rev 18008) +++ trunk/reactos/ntoskrnl/ke/catch.c 2005-09-23 09:51:18 UTC (rev 18009) @@ -1,234 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/ke/catch.c - * PURPOSE: Exception handling - * - * PROGRAMMERS: Anich Gregor - * David Welch (welch(a)mcmail.com) - * Casper S. Hornstrup (chorns(a)users.sourceforge.net) - */ - -/* INCLUDES *****************************************************************/ - -#include <ntoskrnl.h> -#define NDEBUG -#include <internal/debug.h> - -/* FUNCTIONS ****************************************************************/ - -ULONG -RtlpDispatchException(IN PEXCEPTION_RECORD ExceptionRecord, - IN PCONTEXT Context); - -/* - * @unimplemented - */ -VOID -STDCALL -KiCoprocessorError(VOID) -{ - UNIMPLEMENTED; -} - -/* - * @unimplemented - */ -VOID -STDCALL -KiUnexpectedInterrupt(VOID) -{ - UNIMPLEMENTED; -} - -VOID -KiDispatchException(PEXCEPTION_RECORD ExceptionRecord, - PCONTEXT Context, - PKTRAP_FRAME Tf, - KPROCESSOR_MODE PreviousMode, - BOOLEAN SearchFrames) -{ - EXCEPTION_DISPOSITION Value; - CONTEXT TContext; - KD_CONTINUE_TYPE Action = kdHandleException; - - DPRINT("KiDispatchException() called\n"); - - /* Increase number of Exception Dispatches */ - KeGetCurrentPrcb()->KeExceptionDispatchCount++; - - if (!Context) - { - /* Assume Full context */ - TContext.ContextFlags = CONTEXT_FULL; - - /* Check the mode */ - if (PreviousMode != KernelMode) - { - /* Add Debugger Registers if this is User Mode */ - TContext.ContextFlags = TContext.ContextFlags | CONTEXT_DEBUGGER; - } - - /* Convert the Trapframe into a Context */ - KeTrapFrameToContext(Tf, &TContext); - - /* Use local stack context */ - Context = &TContext; - } - - /* Break into Debugger */ - Action = KdpEnterDebuggerException(ExceptionRecord, - PreviousMode, - Context, - Tf, - TRUE, - TRUE); - - /* If the debugger said continue, then continue */ - if (Action == kdContinue) return; - - /* If the Debugger couldn't handle it... */ - if (Action != kdDoNotHandleException) - { - /* See what kind of Exception this is */ - if (PreviousMode != KernelMode) - { - /* User mode exception, search the frames if we have to */ - if (SearchFrames) - { - PULONG Stack; - ULONG CDest; - char temp_space[12 + sizeof(EXCEPTION_RECORD) + sizeof(CONTEXT)]; /* FIXME: HACKHACK */ - PULONG pNewUserStack = (PULONG)(Tf->Esp - (12 + sizeof(EXCEPTION_RECORD) + sizeof(CONTEXT))); - NTSTATUS Status = STATUS_SUCCESS; - - /* Enter Debugger if available */ - Action = KdpEnterDebuggerException(ExceptionRecord, - PreviousMode, - Context, - Tf, - TRUE, - FALSE); - - /* Exit if we're continuing */ - if (Action == kdContinue) return; - - /* FIXME: Forward exception to user mode debugger */ - - /* FIXME: Check user mode stack for enough space */ - - /* Let usermode try and handle the exception. Setup Stack */ - Stack = (PULONG)temp_space; - CDest = 3 + (ROUND_UP(sizeof(EXCEPTION_RECORD), 4) / 4); - /* Return Address */ - Stack[0] = 0; - /* Pointer to EXCEPTION_RECORD structure */ - Stack[1] = (ULONG)&pNewUserStack[3]; - /* Pointer to CONTEXT structure */ - Stack[2] = (ULONG)&pNewUserStack[CDest]; - memcpy(&Stack[3], ExceptionRecord, sizeof(EXCEPTION_RECORD)); - memcpy(&Stack[CDest], Context, sizeof(CONTEXT)); - - /* Copy Stack */ - _SEH_TRY - { - ProbeForWrite(pNewUserStack, - 12 + sizeof(EXCEPTION_RECORD) + sizeof(CONTEXT), - 1); - RtlCopyMemory(pNewUserStack, - temp_space, - 12 + sizeof(EXCEPTION_RECORD) + sizeof(CONTEXT)); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - - /* Check for success */ - if (NT_SUCCESS(Status)) - { - /* Set new Stack Pointer */ - Tf->Esp = (ULONG)pNewUserStack; - } - else - { - /* - * Now it really hit the ventilation device. Sorry, - * can do nothing but kill the sucker. - */ - ZwTerminateThread(NtCurrentThread(), ExceptionRecord->ExceptionCode); - DPRINT1("User-mode stack was invalid. Terminating target thread\n"); - } - /* Set EIP to the User-mode Dispathcer */ - Tf->Eip = (ULONG)KeUserExceptionDispatcher; - return; - } - - /* FIXME: Forward the exception to the debugger */ - - /* FIXME: Forward the exception to the process exception port */ - - /* Enter KDB if available */ - Action = KdpEnterDebuggerException(ExceptionRecord, - PreviousMode, - Context, - Tf, - FALSE, - FALSE); - - /* Exit if we're continuing */ - if (Action == kdContinue) return; - - /* Terminate the offending thread */ - DPRINT1("Unhandled UserMode exception, terminating thread\n"); - ZwTerminateThread(NtCurrentThread(), ExceptionRecord->ExceptionCode); - } - else - { - /* This is Kernel Mode */ - - /* Enter KDB if available */ - Action = KdpEnterDebuggerException(ExceptionRecord, - PreviousMode, - Context, - Tf, - TRUE, - FALSE); - - /* Exit if we're continuing */ - if (Action == kdContinue) return; - - /* Dispatch the Exception */ - Value = RtlpDispatchException (ExceptionRecord, Context); - DPRINT("RtlpDispatchException() returned with 0x%X\n", Value); - - /* If RtlpDispatchException() did not handle the exception then bugcheck */ - if (Value != ExceptionContinueExecution || - 0 != (ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE)) - { - DPRINT("ExceptionRecord->ExceptionAddress = 0x%p\n", ExceptionRecord->ExceptionAddress); - - /* Enter KDB if available */ - Action = KdpEnterDebuggerException(ExceptionRecord, - PreviousMode, - Context, - Tf, - FALSE, - FALSE); - - /* Exit if we're continuing */ - if (Action == kdContinue) return; - - KEBUGCHECKWITHTF(KMODE_EXCEPTION_NOT_HANDLED, - ExceptionRecord->ExceptionCode, - (ULONG)ExceptionRecord->ExceptionAddress, - ExceptionRecord->ExceptionInformation[0], - ExceptionRecord->ExceptionInformation[1], - Tf); - } - } - } -} - -/* EOF */
19 years, 3 months
1
0
0
0
[gvg] 18008: Make GDB available for release builds
by gvg@svn.reactos.com
Make GDB available for release builds Modified: trunk/reactos/ntoskrnl/kd/kdinit.c Modified: trunk/reactos/ntoskrnl/ntoskrnl.xml _____ Modified: trunk/reactos/ntoskrnl/kd/kdinit.c --- trunk/reactos/ntoskrnl/kd/kdinit.c 2005-09-23 09:17:38 UTC (rev 18007) +++ trunk/reactos/ntoskrnl/kd/kdinit.c 2005-09-23 09:23:14 UTC (rev 18008) @@ -43,7 +43,6 @@ { PCHAR p2 = Currentp2; -#ifdef DBG /* Check for BOCHS Debugging */ if (!_strnicmp(p2, "BOCHS", 5)) { @@ -75,7 +74,6 @@ /* Enable Debugging */ KdDebuggerEnabled = TRUE; } -#endif #ifdef KDBG /* Get the KDBG Settings and enable it */ _____ Modified: trunk/reactos/ntoskrnl/ntoskrnl.xml --- trunk/reactos/ntoskrnl/ntoskrnl.xml 2005-09-23 09:17:38 UTC (rev 18007) +++ trunk/reactos/ntoskrnl/ntoskrnl.xml 2005-09-23 09:23:14 UTC (rev 18008) @@ -201,10 +201,8 @@ </directory> <directory name="kd"> <directory name="wrappers"> - <if property="DBG" value="1"> - <file>bochs.c</file> - <file>gdbstub.c</file> - </if> + <file>bochs.c</file> + <file>gdbstub.c</file> </directory> <file>kdinit.c</file> <file>kdio.c</file>
19 years, 3 months
1
0
0
0
[gvg] 18007: Don't use uninitialized var
by gvg@svn.reactos.com
Don't use uninitialized var Modified: trunk/reactos/subsys/win32k/ntuser/accelerator.c _____ Modified: trunk/reactos/subsys/win32k/ntuser/accelerator.c --- trunk/reactos/subsys/win32k/ntuser/accelerator.c 2005-09-23 09:02:16 UTC (rev 18006) +++ trunk/reactos/subsys/win32k/ntuser/accelerator.c 2005-09-23 09:17:38 UTC (rev 18007) @@ -359,7 +359,7 @@ if (Accel->Table == NULL) { ObmDeleteObject(hAccel, otAccel); - SetLastNtError(Status); + SetLastNtError(STATUS_NO_MEMORY); RETURN( (HACCEL) 0); }
19 years, 3 months
1
0
0
0
[hpoussin] 18006: Report correctly USB device class and subclass when the device reports only one interface and the class is not defined in the device descriptor
by hpoussin@svn.reactos.com
Report correctly USB device class and subclass when the device reports only one interface and the class is not defined in the device descriptor Modified: trunk/reactos/drivers/usb/usbhub/fdo.c _____ Modified: trunk/reactos/drivers/usb/usbhub/fdo.c --- trunk/reactos/drivers/usb/usbhub/fdo.c 2005-09-23 08:55:33 UTC (rev 18005) +++ trunk/reactos/drivers/usb/usbhub/fdo.c 2005-09-23 09:02:16 UTC (rev 18006) @@ -110,13 +110,11 @@ if (!NT_SUCCESS(Status)) goto ByeBye; - DPRINT1("child #%lu: USB\\Vid_%04x&Pid_%04x&Rev_%04x (class %x:%x)\n", + DPRINT1("child #%lu: USB\\Vid_%04x&Pid_%04x&Rev_%04x\n", i, PdoExtension->dev->descriptor.idVendor, PdoExtension->dev->descriptor.idProduct, - PdoExtension->dev->descriptor.bcdDevice, - PdoExtension->dev->descriptor.bDeviceClass, - PdoExtension->dev->descriptor.bDeviceSubClass); + PdoExtension->dev->descriptor.bcdDevice); sprintf(Buffer[0], "USB\\Vid_%04x&Pid_%04x&Rev_%04x", PdoExtension->dev->descriptor.idVendor, PdoExtension->dev->descriptor.idProduct, @@ -139,15 +137,33 @@ if (PdoExtension->dev->actconfig->desc.bNumInterfaces == 1) { /* Single-interface USB device */ - sprintf(Buffer[0], "USB\\Class_%02x&SubClass_%02x&Prot_%02x", - PdoExtension->dev->descriptor.bDeviceClass, - PdoExtension->dev->descriptor.bDeviceSubClass, - PdoExtension->dev->descriptor.bDeviceProtocol); - sprintf(Buffer[1], "USB\\Class_%02x&SubClass_%02x", - PdoExtension->dev->descriptor.bDeviceClass, - PdoExtension->dev->descriptor.bDeviceSubClass); - sprintf(Buffer[2], "USB\\Class_%02x", - PdoExtension->dev->descriptor.bDeviceClass); + if (PdoExtension->dev->descriptor.bDeviceClass != 0) + { + /* Use these values for device class/sub class/protocol */ + sprintf(Buffer[0], "USB\\Class_%02x&SubClass_%02x&Prot_%02x", + PdoExtension->dev->descriptor.bDeviceClass, + PdoExtension->dev->descriptor.bDeviceSubClass, + PdoExtension->dev->descriptor.bDeviceProtocol); + sprintf(Buffer[1], "USB\\Class_%02x&SubClass_%02x", + PdoExtension->dev->descriptor.bDeviceClass, + PdoExtension->dev->descriptor.bDeviceSubClass); + sprintf(Buffer[2], "USB\\Class_%02x", + PdoExtension->dev->descriptor.bDeviceClass); + } + else + { + /* Use values specified in the interface descriptor */ + struct usb_host_interface *itf = PdoExtension->dev->actconfig->interface->altsetting; + sprintf(Buffer[0], "USB\\Class_%02x&SubClass_%02x&Prot_%02x", + itf->desc.bInterfaceClass, + itf->desc.bInterfaceSubClass, + itf->desc.bInterfaceProtocol); + sprintf(Buffer[1], "USB\\Class_%02x&SubClass_%02x", + itf->desc.bInterfaceClass, + itf->desc.bInterfaceSubClass); + sprintf(Buffer[2], "USB\\Class_%02x", + itf->desc.bInterfaceClass); + } Status = UsbhubInitMultiSzString( &PdoExtension->CompatibleIds, Buffer[0], Buffer[1], Buffer[2], NULL);
19 years, 3 months
1
0
0
0
[hpoussin] 18005: Cast the right pointer to the structure.
by hpoussin@svn.reactos.com
Cast the right pointer to the structure. Fix bug 783. Thanks GvG. Modified: trunk/reactos/lib/setupapi/devinst.c _____ Modified: trunk/reactos/lib/setupapi/devinst.c --- trunk/reactos/lib/setupapi/devinst.c 2005-09-23 07:32:21 UTC (rev 18004) +++ trunk/reactos/lib/setupapi/devinst.c 2005-09-23 08:55:33 UTC (rev 18005) @@ -3737,7 +3737,7 @@ { if (DeviceInfoData) { - struct DeviceInfoElement *deviceInfo = (struct DeviceInfoElement *)DeviceInfoData; + struct DeviceInfoElement *deviceInfo = (struct DeviceInfoElement *)DeviceInfoData->Reserved; deviceInfo->Flags |= DI_DIDCOMPAT; } else
19 years, 3 months
1
0
0
0
[sedwards] 18004: doing my good dead for the day
by sedwards@svn.reactos.com
doing my good dead for the day Modified: trunk/reactos/lib/ntdll/dbg/debug.c _____ Modified: trunk/reactos/lib/ntdll/dbg/debug.c --- trunk/reactos/lib/ntdll/dbg/debug.c 2005-09-23 07:19:47 UTC (rev 18003) +++ trunk/reactos/lib/ntdll/dbg/debug.c 2005-09-23 07:32:21 UTC (rev 18004) @@ -178,8 +178,8 @@ * @unimplemented */ NTSTATUS STDCALL -DbgUiWaitStateChange(ULONG Unknown1, - ULONG Unknown2) +DbgUiWaitStateChange(PDBGUI_WAIT_STATE_CHANGE DbgUiWaitStateCange, + PLARGE_INTEGER TimeOut) { return STATUS_NOT_IMPLEMENTED; }
19 years, 3 months
1
0
0
0
[ion] 18003: Forgot these changes, sorry
by ion@svn.reactos.com
Forgot these changes, sorry Modified: trunk/reactos/include/ndk/kdtypes.h Modified: trunk/reactos/include/ndk/ldrtypes.h Modified: trunk/reactos/include/ndk/rtlfuncs.h Modified: trunk/reactos/include/ndk/umfuncs.h Modified: trunk/reactos/include/ndk/umtypes.h Modified: trunk/reactos/include/ndk/zwfuncs.h _____ Modified: trunk/reactos/include/ndk/kdtypes.h --- trunk/reactos/include/ndk/kdtypes.h 2005-09-23 06:37:14 UTC (rev 18002) +++ trunk/reactos/include/ndk/kdtypes.h 2005-09-23 07:19:47 UTC (rev 18003) @@ -14,7 +14,22 @@ /* EXPORTED DATA *************************************************************/ /* CONSTANTS *****************************************************************/ +#define DPFLTR_ERROR_LEVEL 0 +#define DPFLTR_WARNING_LEVEL 1 +#define DPFLTR_TRACE_LEVEL 2 +#define DPFLTR_INFO_LEVEL 3 +#define DPFLTR_MASK 0x80000000 +#define DBG_STATUS_CONTROL_C 1 +#define DBG_STATUS_SYSRQ 2 +#define DBG_STATUS_BUGCHECK_FIRST 3 +#define DBG_STATUS_BUGCHECK_SECOND 4 +#define DBG_STATUS_FATAL 5 +#define DBG_STATUS_DEBUG_CONTROL 6 +#define DBG_STATUS_WORKER 7 + +#define BREAKPOINT_PRINT 1 +#define BREAKPOINT_PROMPT 2 /* ENUMERATIONS **************************************************************/ typedef enum _DEBUG_CONTROL_CODE _____ Modified: trunk/reactos/include/ndk/ldrtypes.h --- trunk/reactos/include/ndk/ldrtypes.h 2005-09-23 06:37:14 UTC (rev 18002) +++ trunk/reactos/include/ndk/ldrtypes.h 2005-09-23 07:19:47 UTC (rev 18003) @@ -32,7 +32,9 @@ #define LDRP_PROCESS_ATTACH_CALLED 0x00080000 #define LDRP_DEBUG_SYMBOLS_LOADED 0x00100000 #define LDRP_IMAGE_NOT_AT_BASE 0x00200000 -#define LDRP_WX86_IGNORE_MACHINETYPE 0x00400000 +#define LDRP_COR_IMAGE 0x00400000 +#define LDR_COR_OWNS_UNMAP 0x00800000 +#define LDRP_REDIRECTED 0x10000000 /* ENUMERATIONS **************************************************************/ _____ Modified: trunk/reactos/include/ndk/rtlfuncs.h --- trunk/reactos/include/ndk/rtlfuncs.h 2005-09-23 06:37:14 UTC (rev 18002) +++ trunk/reactos/include/ndk/rtlfuncs.h 2005-09-23 07:19:47 UTC (rev 18003) @@ -946,6 +946,13 @@ * Ansi->Unicode String Functions */ NTSYSAPI +ULONG +NTAPI +RtlxAnsiStringToUnicodeSize( + PCANSI_STRING AnsiString +); + +NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString( _____ Modified: trunk/reactos/include/ndk/umfuncs.h --- trunk/reactos/include/ndk/umfuncs.h 2005-09-23 06:37:14 UTC (rev 18002) +++ trunk/reactos/include/ndk/umfuncs.h 2005-09-23 07:19:47 UTC (rev 18003) @@ -108,14 +108,10 @@ NTAPI DbgBreakPoint(VOID); -NTSTATUS +NTSYSAPI +VOID NTAPI -DbgSsInitialize( - HANDLE ReplyPort, - PVOID Callback, - ULONG Unknown2, - ULONG Unknown3 -); +DbgBreakPointWithStatus(IN ULONG Status); NTSTATUS NTAPI @@ -131,8 +127,8 @@ NTSTATUS NTAPI DbgUiWaitStateChange( - ULONG Unknown1, - ULONG Unknown2 + PDBGUI_WAIT_STATE_CHANGE DbgUiWaitStateCange, + PLARGE_INTEGER TimeOut ); VOID _____ Modified: trunk/reactos/include/ndk/umtypes.h --- trunk/reactos/include/ndk/umtypes.h 2005-09-23 06:37:14 UTC (rev 18002) +++ trunk/reactos/include/ndk/umtypes.h 2005-09-23 07:19:47 UTC (rev 18003) @@ -90,6 +90,17 @@ #define NT_WARNING(x) ((ULONG)(x)>>30==2) #define NT_ERROR(x) ((ULONG)(x)>>30==3) +/* Limits */ +#define MINCHAR 0x80 +#define MAXCHAR 0x7f +#define MINSHORT 0x8000 +#define MAXSHORT 0x7fff +#define MINLONG 0x80000000 +#define MAXLONG 0x7fffffff +#define MAXUCHAR 0xff +#define MAXUSHORT 0xffff +#define MAXULONG 0xffffffff + /* TYPES *********************************************************************/ /* Basic Types that aren't defined in User-Mode Headers */ _____ Modified: trunk/reactos/include/ndk/zwfuncs.h --- trunk/reactos/include/ndk/zwfuncs.h 2005-09-23 06:37:14 UTC (rev 18002) +++ trunk/reactos/include/ndk/zwfuncs.h 2005-09-23 07:19:47 UTC (rev 18003) @@ -315,8 +315,28 @@ IN HANDLE EventHandle ); +NTSYSCALLAPI NTSTATUS NTAPI +NtCreateDebugObject( + OUT PHANDLE DebugHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN BOOLEAN KillProcessOnExit +); + +NTSYSAPI +NTSTATUS +NTAPI +ZwCreateDebugObject( + OUT PHANDLE DebugHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN BOOLEAN KillProcessOnExit +); + +NTSTATUS +NTAPI NtCreateJobObject( PHANDLE JobHandle, ACCESS_MASK DesiredAccess, @@ -906,8 +926,34 @@ ULONG NPMessageQueueSize OPTIONAL ); +NTSYSCALLAPI NTSTATUS NTAPI +NtQueryDebugFilterState( + ULONG ComponentId, + ULONG Level +); + +NTSYSCALLAPI +NTSTATUS +NTAPI +NtDebugContinue( + IN HANDLE DebugObject, + IN PCLIENT_ID AppClientId, + IN NTSTATUS ContinueStatus +); + +NTSYSAPI +NTSTATUS +NTAPI +ZwDebugContinue( + IN HANDLE DebugObject, + IN PCLIENT_ID AppClientId, + IN NTSTATUS ContinueStatus +); + +NTSTATUS +NTAPI NtDelayExecution( IN BOOLEAN Alertable, IN LARGE_INTEGER *Interval @@ -3410,8 +3456,17 @@ IN PCONTEXT Context ); +NTSYSAPI NTSTATUS NTAPI +NtSetDebugFilterState( + ULONG ComponentId, + ULONG Level, + BOOLEAN State +); + +NTSTATUS +NTAPI NtSetDefaultLocale( IN BOOLEAN UserProfile, IN LCID DefaultLocaleId @@ -4182,8 +4237,28 @@ OUT PULONG ResultLength OPTIONAL ); +NTSYSCALLAPI NTSTATUS NTAPI +NtWaitForDebugEvent( + IN HANDLE DebugObject, + IN BOOLEAN Alertable, + IN PLARGE_INTEGER Timeout OPTIONAL, + OUT PDBGUI_WAIT_STATE_CHANGE StateChange +); + +NTSYSAPI +NTSTATUS +NTAPI +ZwWaitForDebugEvent( + IN HANDLE DebugObject, + IN BOOLEAN Alertable, + IN PLARGE_INTEGER Timeout OPTIONAL, + OUT PDBGUI_WAIT_STATE_CHANGE StateChange +); + +NTSTATUS +NTAPI NtWaitForMultipleObjects( IN ULONG Count, IN HANDLE Object[],
19 years, 3 months
1
0
0
0
[ion] 18002: - Fix a bunch of various bugs in the Rtl String routines, mostly subtle (ie: fail AFTER writing maximum length, not before (some apps might depend on it), fix completely broken RtlAnsiCharToUnicodeChar prototype and functionality, don't clear buffers when we shouldn't/clear buffers when we should...)
by ion@svn.reactos.com
- Fix a bunch of various bugs in the Rtl String routines, mostly subtle (ie: fail AFTER writing maximum length, not before (some apps might depend on it), fix completely broken RtlAnsiCharToUnicodeChar prototype and functionality, don't clear buffers when we shouldn't/clear buffers when we should...) - Also cleanup formatting of the file - Use Index member from Rtl...To...N API when null-terminating the strings. - Various optimizations and simplifications in some of the loops. - Remove some duplicated code. - Notes about special handling where required, also implement it in some parts. - Add more failure cases. - Return correct status codes on failures. Modified: trunk/reactos/lib/rtl/unicode.c _____ Modified: trunk/reactos/lib/rtl/unicode.c --- trunk/reactos/lib/rtl/unicode.c 2005-09-23 06:32:47 UTC (rev 18001) +++ trunk/reactos/lib/rtl/unicode.c 2005-09-23 06:37:14 UTC (rev 18002) @@ -3,7 +3,9 @@ * PROJECT: ReactOS system libraries * PURPOSE: Unicode Conversion Routines * FILE: lib/rtl/unicode.c - * PROGRAMMER: + * PROGRAMMER: Alex Ionescu (alex(a)relsoft.net) + * Emanuele Aliberti + * Gunnar Dalsnes */ /* INCLUDES *****************************************************************/ @@ -17,35 +19,87 @@ extern BOOLEAN NlsMbCodePageTag; extern BOOLEAN NlsMbOemCodePageTag; +extern PUSHORT NlsLeadByteInfo; /* FUNCTIONS *****************************************************************/ - /* * @implemented */ -WCHAR STDCALL -RtlAnsiCharToUnicodeChar (IN CHAR AnsiChar) +WCHAR +STDCALL +RtlAnsiCharToUnicodeChar(IN PUCHAR *AnsiChar) { - ULONG Size; - WCHAR UnicodeChar; + ULONG Size; + NTSTATUS Status; + WCHAR UnicodeChar = 0x20; - Size = 1; -#if 0 + Size = (NlsLeadByteInfo[**AnsiChar] == 0) ? 1 : 2; - Size = (NlsLeadByteInfo[AnsiChar] == 0) ? 1 : 2; -#endif + Status = RtlMultiByteToUnicodeN(&UnicodeChar, + sizeof(WCHAR), + NULL, + *AnsiChar, + Size); - RtlMultiByteToUnicodeN (&UnicodeChar, - sizeof(WCHAR), - NULL, - &AnsiChar, - Size); + if (!NT_SUCCESS(Status)) + { + UnicodeChar = 0x20; + } - return UnicodeChar; + *AnsiChar += Size; + return UnicodeChar; } +/* + * @implemented + * + * NOTES + * This function always writes a terminating '\0'. + * If the dest buffer is too small a partial copy is NOT performed! + */ +NTSTATUS +STDCALL +RtlAnsiStringToUnicodeString( + IN OUT PUNICODE_STRING UniDest, + IN PANSI_STRING AnsiSource, + IN BOOLEAN AllocateDestinationString) +{ + NTSTATUS Status; + ULONG Length; + ULONG Index; + Length = RtlAnsiStringToUnicodeSize(AnsiSource); + if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2; + UniDest->Length = (USHORT)Length - sizeof(WCHAR); + + if (AllocateDestinationString == TRUE) + { + UniDest->Buffer = RtlpAllocateStringMemory(Length, TAG_USTR); + UniDest->MaximumLength = Length; + if (!UniDest->Buffer) return STATUS_NO_MEMORY; + } + else if (Length >= UniDest->MaximumLength) + { + return STATUS_BUFFER_TOO_SMALL; + } + + Status = RtlMultiByteToUnicodeN(UniDest->Buffer, + UniDest->Length, + &Index, + AnsiSource->Buffer, + AnsiSource->Length); + + if (!NT_SUCCESS(Status) && AllocateDestinationString) + { + RtlpFreeStringMemory(UniDest->Buffer, TAG_USTR); + return Status; + } + + UniDest->Buffer[Index / sizeof(WCHAR)] = UNICODE_NULL; + return Status; +} + /* * @implemented * @@ -67,8 +121,6 @@ return(Size + sizeof(WCHAR)); } - - /* * @implemented * @@ -78,31 +130,28 @@ */ NTSTATUS STDCALL -RtlAppendStringToString(IN OUT PSTRING Destination, +RtlAppendStringToString(IN PSTRING Destination, IN PSTRING Source) { - PCHAR Ptr; + USHORT SourceLength = Source->Length; - if (Source->Length == 0) - return(STATUS_SUCCESS); + if (SourceLength) + { + if (Destination->Length + SourceLength > Destination->MaximumLength) + { + return STATUS_BUFFER_TOO_SMALL; + } - if (Destination->Length + Source->Length >= Destination->MaximumLength) - return(STATUS_BUFFER_TOO_SMALL); + RtlMoveMemory(&Destination->Buffer[Destination->Length], + Source->Buffer, + SourceLength); - Ptr = Destination->Buffer + Destination->Length; - memmove(Ptr, - Source->Buffer, - Source->Length); - Ptr += Source->Length; - *Ptr = 0; + Destination->Length += SourceLength; + } - Destination->Length += Source->Length; - - return(STATUS_SUCCESS); + return STATUS_SUCCESS; } - - /* * @implemented * @@ -117,20 +166,29 @@ IN OUT PUNICODE_STRING Destination, IN PCUNICODE_STRING Source) { + USHORT SourceLength = Source->Length; + PWCHAR Buffer = &Destination->Buffer[Destination->Length / sizeof(WCHAR)]; - if ((Source->Length + Destination->Length) > Destination->MaximumLength) - return STATUS_BUFFER_TOO_SMALL; + if (SourceLength) + { + if ((SourceLength+ Destination->Length) > Destination->MaximumLength) + { + return STATUS_BUFFER_TOO_SMALL; + } - memcpy((char*)Destination->Buffer + Destination->Length, Source->Buffer, Source->Length); - Destination->Length += Source->Length; - /* append terminating '\0' if enough space */ - if( Destination->MaximumLength > Destination->Length ) - Destination->Buffer[Destination->Length / sizeof(WCHAR)] = 0; + RtlMoveMemory(Buffer, Source->Buffer, SourceLength); + Destination->Length += SourceLength; - return STATUS_SUCCESS; + /* append terminating '\0' if enough space */ + if (Destination->MaximumLength > Destination->Length) + { + Buffer[SourceLength / sizeof(WCHAR)] = UNICODE_NULL; + } + } + + return STATUS_SUCCESS; } - /*********************************************************************** *** * RtlCharToInteger (NTDLL.@) * @implemented @@ -251,7 +309,6 @@ return ret; } - /* * @implemented * @@ -265,11 +322,10 @@ IN PSTRING s2, IN BOOLEAN CaseInsensitive) { - if (s1->Length != s2->Length) return FALSE; - return !RtlCompareString(s1, s2, CaseInsensitive ); + if (s1->Length != s2->Length) return FALSE; + return !RtlCompareString(s1, s2, CaseInsensitive); } - /* * @implemented * @@ -283,11 +339,10 @@ IN CONST UNICODE_STRING *s2, IN BOOLEAN CaseInsensitive) { - if (s1->Length != s2->Length) return FALSE; - return !RtlCompareUnicodeString((PUNICODE_STRING)s1, (PUNICODE_STRING)s2, CaseInsensitive ); + if (s1->Length != s2->Length) return FALSE; + return !RtlCompareUnicodeString(s1, s2, CaseInsensitive ); } - /* * @implemented */ @@ -295,17 +350,13 @@ STDCALL RtlFreeAnsiString(IN PANSI_STRING AnsiString) { - if (AnsiString->Buffer != NULL) - { - RtlpFreeStringMemory(AnsiString->Buffer, TAG_ASTR); - - AnsiString->Buffer = NULL; - AnsiString->Length = 0; - AnsiString->MaximumLength = 0; - } + if (AnsiString->Buffer) + { + RtlpFreeStringMemory(AnsiString->Buffer, TAG_ASTR); + RtlZeroMemory(AnsiString, sizeof(ANSI_STRING)); + } } - /* * @implemented */ @@ -313,17 +364,9 @@ STDCALL RtlFreeOemString(IN POEM_STRING OemString) { - if (OemString->Buffer != NULL) - { - RtlpFreeStringMemory(OemString->Buffer, TAG_OSTR); - - OemString->Buffer = NULL; - OemString->Length = 0; - OemString->MaximumLength = 0; - } + if (OemString->Buffer) RtlpFreeStringMemory(OemString->Buffer, TAG_OSTR); } - /* * @implemented */ @@ -331,14 +374,11 @@ STDCALL RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString) { - if (UnicodeString->Buffer != NULL) - { - RtlpFreeStringMemory(UnicodeString->Buffer, TAG_USTR); - - UnicodeString->Buffer = NULL; - UnicodeString->Length = 0; - UnicodeString->MaximumLength = 0; - } + if (UnicodeString->Buffer) + { + RtlpFreeStringMemory(UnicodeString->Buffer, TAG_ASTR); + RtlZeroMemory(UnicodeString, sizeof(UNICODE_STRING)); + } } /* @@ -346,12 +386,10 @@ */ BOOLEAN STDCALL -RtlIsValidOemCharacter ( - IN PWCHAR Char - ) +RtlIsValidOemCharacter(IN PWCHAR Char) { - UNIMPLEMENTED; - return FALSE; + UNIMPLEMENTED; + return FALSE; } /* @@ -365,24 +403,23 @@ RtlInitAnsiString(IN OUT PANSI_STRING DestinationString, IN PCSZ SourceString) { - ULONG DestSize; + ULONG DestSize; - if (SourceString == NULL) - { - DestinationString->Length = 0; - DestinationString->MaximumLength = 0; - } - else - { - DestSize = strlen ((const char *)SourceString); - DestinationString->Length = DestSize; - DestinationString->MaximumLength = DestSize + sizeof(CHAR); - } - DestinationString->Buffer = (PCHAR)SourceString; + if(SourceString) + { + DestSize = strlen(SourceString); + DestinationString->Length = (USHORT)DestSize; + DestinationString->MaximumLength = (USHORT)DestSize + sizeof(CHAR); + } + else + { + DestinationString->Length = 0; + DestinationString->MaximumLength = 0; + } + + DestinationString->Buffer = (PCHAR)SourceString; } - - /* * @implemented * @@ -395,23 +432,9 @@ IN OUT PSTRING DestinationString, IN PCSZ SourceString) { - ULONG DestSize; - - if (SourceString == NULL) - { - DestinationString->Length = 0; - DestinationString->MaximumLength = 0; - } - else - { - DestSize = strlen((const char *)SourceString); - DestinationString->Length = DestSize; - DestinationString->MaximumLength = DestSize + sizeof(CHAR); - } - DestinationString->Buffer = (PCHAR)SourceString; + RtlInitAnsiString(DestinationString, SourceString); } - /* * @implemented * @@ -423,53 +446,48 @@ RtlInitUnicodeString(IN OUT PUNICODE_STRING DestinationString, IN PCWSTR SourceString) { - ULONG DestSize; + ULONG DestSize; - DPRINT("RtlInitUnicodeString(DestinationString 0x%p, SourceString 0x%p)\n", - DestinationString, - SourceString); + if(SourceString) + { + DestSize = wcslen(SourceString) * sizeof(WCHAR); + DestinationString->Length = (USHORT)DestSize; + DestinationString->MaximumLength = (USHORT)DestSize + sizeof(WCHAR); + } + else + { + DestinationString->Length = 0; + DestinationString->MaximumLength = 0; + } - if (SourceString == NULL) - { - DestinationString->Length = 0; - DestinationString->MaximumLength = 0; - } - else - { - DestSize = wcslen((PWSTR)SourceString) * sizeof(WCHAR); - DestinationString->Length = DestSize; - DestinationString->MaximumLength = DestSize + sizeof(WCHAR); - } - DestinationString->Buffer = (PWSTR)SourceString; + DestinationString->Buffer = (PWCHAR)SourceString; } /* * @implemented */ -NTSTATUS STDCALL +NTSTATUS +STDCALL RtlInitUnicodeStringEx(OUT PUNICODE_STRING DestinationString, IN PCWSTR SourceString) { - ULONG Length; + ULONG DestSize; - if (SourceString != NULL) - { - Length = wcslen(SourceString) * sizeof(WCHAR); - if (Length > 0xFFFC) - return STATUS_NAME_TOO_LONG; + if(SourceString) + { + DestSize = wcslen(SourceString) * sizeof(WCHAR); + if (DestSize > 0xFFFC) return STATUS_NAME_TOO_LONG; + DestinationString->Length = (USHORT)DestSize; + DestinationString->MaximumLength = (USHORT)DestSize + sizeof(WCHAR); + } + else + { + DestinationString->Length = 0; + DestinationString->MaximumLength = 0; + } - DestinationString->Length = Length; - DestinationString->MaximumLength = Length + sizeof(WCHAR); - DestinationString->Buffer = (PWSTR)SourceString; - } - else - { - DestinationString->Length = 0; - DestinationString->MaximumLength = 0; - DestinationString->Buffer = NULL; - } - - return STATUS_SUCCESS; + DestinationString->Buffer = (PWCHAR)SourceString; + return STATUS_SUCCESS; } /* @@ -530,7 +548,6 @@ return STATUS_SUCCESS; } - /* * @implemented */ @@ -585,78 +602,63 @@ return STATUS_SUCCESS; } - - /* * @implemented */ NTSTATUS STDCALL RtlIntegerToUnicodeString( - IN ULONG Value, - IN ULONG Base, /* optional */ + IN ULONG Value, + IN ULONG Base OPTIONAL, IN OUT PUNICODE_STRING String) { - ANSI_STRING AnsiString; - CHAR Buffer[33]; - NTSTATUS Status; + ANSI_STRING AnsiString; + CHAR Buffer[16]; + NTSTATUS Status; - Status = RtlIntegerToChar (Value, - Base, - sizeof(Buffer), - Buffer); - if (NT_SUCCESS(Status)) - { - AnsiString.Buffer = Buffer; - AnsiString.Length = strlen (Buffer); - AnsiString.MaximumLength = sizeof(Buffer); + Status = RtlIntegerToChar(Value, Base, sizeof(Buffer), Buffer); + if (NT_SUCCESS(Status)) + { + AnsiString.Buffer = Buffer; + AnsiString.Length = (USHORT)strlen(Buffer); + AnsiString.MaximumLength = sizeof(Buffer); - Status = RtlAnsiStringToUnicodeString (String, - &AnsiString, - FALSE); - } + Status = RtlAnsiStringToUnicodeString(String, &AnsiString, FALSE); + } - return Status; + return Status; } - /* -* @implemented -*/ + * @implemented + */ NTSTATUS STDCALL RtlInt64ToUnicodeString ( - IN ULONGLONG Value, - IN ULONG Base OPTIONAL, - IN OUT PUNICODE_STRING String - ) + IN ULONGLONG Value, + IN ULONG Base OPTIONAL, + IN OUT PUNICODE_STRING String) { - LARGE_INTEGER LargeInt; - ANSI_STRING AnsiString; - CHAR Buffer[33]; - NTSTATUS Status; + LARGE_INTEGER LargeInt; + ANSI_STRING AnsiString; + CHAR Buffer[32]; + NTSTATUS Status; - LargeInt.QuadPart = Value; + LargeInt.QuadPart = Value; - Status = RtlLargeIntegerToChar (&LargeInt, - Base, - sizeof(Buffer), - Buffer); - if (NT_SUCCESS(Status)) - { - AnsiString.Buffer = Buffer; - AnsiString.Length = strlen (Buffer); - AnsiString.MaximumLength = sizeof(Buffer); + Status = RtlLargeIntegerToChar(&LargeInt, Base, sizeof(Buffer), Buffer); + if (NT_SUCCESS(Status)) + { + AnsiString.Buffer = Buffer; + AnsiString.Length = (USHORT)strlen(Buffer); + AnsiString.MaximumLength = sizeof(Buffer); - Status = RtlAnsiStringToUnicodeString (String, - &AnsiString, - FALSE); - } + Status = RtlAnsiStringToUnicodeString(String, &AnsiString, FALSE); + } - return Status; + return Status; } - /* * @implemented * @@ -704,7 +706,6 @@ return FALSE; } - /* * @implemented * @@ -864,7 +865,6 @@ return STATUS_SUCCESS; } - /* * @implemented * @@ -889,7 +889,6 @@ /* * @implemented * - * NOTES * This function always writes a terminating '\0'. * It performs a partial copy if ansi is too small. @@ -901,47 +900,46 @@ IN PCUNICODE_STRING UniSource, IN BOOLEAN AllocateDestinationString) { - NTSTATUS Status = STATUS_SUCCESS; - ULONG Length; /* including nullterm */ + NTSTATUS Status = STATUS_SUCCESS; + NTSTATUS RealStatus; + ULONG Length; + ULONG Index; - Length = RtlUnicodeStringToAnsiSize(UniSource); - AnsiDest->Length = Length - sizeof(CHAR); + Length = RtlUnicodeStringToAnsiSize(UniSource); + if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2; - if (AllocateDestinationString) - { - AnsiDest->Buffer = RtlpAllocateStringMemory(Length, TAG_ASTR); - if (AnsiDest->Buffer == NULL) - return STATUS_NO_MEMORY; + AnsiDest->Length = (USHORT)Length - sizeof(CHAR); - AnsiDest->MaximumLength = Length; - } - else if (AnsiDest->MaximumLength == 0) - { - return STATUS_BUFFER_TOO_SMALL; - } - else if (Length > AnsiDest->MaximumLength) - { - /* make room for nullterm */ - AnsiDest->Length = AnsiDest->MaximumLength - sizeof(CHAR); - } + if (AllocateDestinationString) + { + AnsiDest->Buffer = RtlpAllocateStringMemory(Length, TAG_ASTR); + AnsiDest->MaximumLength = Length; + if (!AnsiDest->Buffer) return STATUS_NO_MEMORY; + } + else if (AnsiDest->Length >= AnsiDest->MaximumLength) + { + if (!AnsiDest->MaximumLength) return STATUS_BUFFER_OVERFLOW; - Status = RtlUnicodeToMultiByteN (AnsiDest->Buffer, - AnsiDest->Length, - NULL, - UniSource->Buffer, - UniSource->Length); + Status = STATUS_BUFFER_OVERFLOW; + AnsiDest->Length = AnsiDest->MaximumLength - 1; + } - if (!NT_SUCCESS(Status) && AllocateDestinationString) - { - RtlpFreeStringMemory(AnsiDest->Buffer, TAG_ASTR); - return Status; - } + RealStatus = RtlUnicodeToMultiByteN(AnsiDest->Buffer, + AnsiDest->Length, + &Index, + UniSource->Buffer, + UniSource->Length); - AnsiDest->Buffer[AnsiDest->Length] = 0; - return Status; + if (!NT_SUCCESS(RealStatus) && AllocateDestinationString) + { + RtlpFreeStringMemory(AnsiDest->Buffer, TAG_ASTR); + return RealStatus; + } + + AnsiDest->Buffer[Index] = ANSI_NULL; + return Status; } - /* * @implemented * @@ -956,50 +954,43 @@ IN PCOEM_STRING OemSource, IN BOOLEAN AllocateDestinationString) { - NTSTATUS Status; - ULONG Length; /* including nullterm */ + NTSTATUS Status; + ULONG Length; + ULONG Index; - Length = RtlOemStringToUnicodeSize(OemSource); - if (Length > 0xffff) - return STATUS_INVALID_PARAMETER_2; + Length = RtlOemStringToUnicodeSize(OemSource); + if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2; - UniDest->Length = (WORD)(Length - sizeof(WCHAR)); + UniDest->Length = (USHORT)Length - sizeof(WCHAR); - if (AllocateDestinationString) - { - UniDest->Buffer = RtlpAllocateStringMemory(Length, TAG_USTR); - if (UniDest->Buffer == NULL) - return STATUS_NO_MEMORY; + if (AllocateDestinationString) + { + UniDest->Buffer = RtlpAllocateStringMemory(Length, TAG_USTR); + UniDest->MaximumLength = Length; + if (!UniDest->Buffer) return STATUS_NO_MEMORY; + } + else if (UniDest->Length >= UniDest->MaximumLength) + { + return STATUS_BUFFER_OVERFLOW; + } - UniDest->MaximumLength = Length; - } - else if (Length > UniDest->MaximumLength) - { - DPRINT("STATUS_BUFFER_TOO_SMALL\n"); - return STATUS_BUFFER_TOO_SMALL; - } - - /* FIXME: Do we need this????? -Gunnar */ - RtlZeroMemory (UniDest->Buffer, - UniDest->Length); - - Status = RtlOemToUnicodeN (UniDest->Buffer, + Status = RtlOemToUnicodeN(UniDest->Buffer, UniDest->Length, - NULL, + &Index, OemSource->Buffer, OemSource->Length); - if (!NT_SUCCESS(Status) && AllocateDestinationString) - { - RtlpFreeStringMemory(UniDest->Buffer, TAG_USTR); - return Status; - } + if (!NT_SUCCESS(Status) && AllocateDestinationString) + { + RtlpFreeStringMemory(UniDest->Buffer, TAG_USTR); + UniDest->Buffer = NULL; + return Status; + } - UniDest->Buffer[UniDest->Length / sizeof(WCHAR)] = 0; - return STATUS_SUCCESS; + UniDest->Buffer[Index / sizeof(WCHAR)] = UNICODE_NULL; + return Status; } - /* * @implemented * @@ -1013,52 +1004,45 @@ IN PCUNICODE_STRING UniSource, IN BOOLEAN AllocateDestinationString) { - NTSTATUS Status = STATUS_SUCCESS; - ULONG Length; //including nullterm + NTSTATUS Status; + ULONG Length; + ULONG Index; - Length = RtlUnicodeStringToAnsiSize(UniSource); - if (Length > 0x0000FFFF) - return STATUS_INVALID_PARAMETER_2; + Length = RtlUnicodeStringToOemSize(UniSource); + if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2; - OemDest->Length = (WORD)(Length - sizeof(CHAR)); + OemDest->Length = (USHORT)Length - sizeof(CHAR); - if (AllocateDestinationString) - { - OemDest->Buffer = RtlpAllocateStringMemory(Length, TAG_OSTR); - if (OemDest->Buffer == NULL) - return STATUS_NO_MEMORY; + if (AllocateDestinationString) + { + OemDest->Buffer = RtlpAllocateStringMemory(Length, TAG_OSTR); + OemDest->MaximumLength = Length; + if (!OemDest->Buffer) return STATUS_NO_MEMORY; + } + else if (OemDest->Length >= OemDest->MaximumLength) + { + return STATUS_BUFFER_OVERFLOW; + } - OemDest->MaximumLength = Length; - } - else if (OemDest->MaximumLength == 0) - { - return STATUS_BUFFER_TOO_SMALL; - } - else if (Length > OemDest->MaximumLength) - { - //make room for nullterm - OemDest->Length = OemDest->MaximumLength - sizeof(CHAR); - } - - Status = RtlUnicodeToOemN (OemDest->Buffer, + Status = RtlUnicodeToOemN(OemDest->Buffer, OemDest->Length, - NULL, + &Index, UniSource->Buffer, UniSource->Length); - if (!NT_SUCCESS(Status) && AllocateDestinationString) - { - RtlpFreeStringMemory(OemDest->Buffer, TAG_OSTR); - return Status; - } + if (!NT_SUCCESS(Status) && AllocateDestinationString) + { + RtlpFreeStringMemory(OemDest->Buffer, TAG_OSTR); + OemDest->Buffer = NULL; + return Status; + } - OemDest->Buffer[OemDest->Length] = 0; - return Status; + OemDest->Buffer[Index] = ANSI_NULL; + return Status; } #define ITU_IMPLEMENTED_TESTS (IS_TEXT_UNICODE_ODD_LENGTH|IS_TEXT_UNICODE_SIGNATURE) - /* * @implemented * @@ -1117,7 +1101,6 @@ return Length; } - /* * @implemented * @@ -1132,41 +1115,47 @@ IN PCOEM_STRING OemSource, IN BOOLEAN AllocateDestinationString) { - NTSTATUS Status; - ULONG Length; /* excluding nullterm */ + NTSTATUS Status; + ULONG Length; + ULONG Index; - Length = RtlOemStringToCountedUnicodeSize(OemSource); - if (Length > 65535) - return STATUS_INVALID_PARAMETER_2; + Length = RtlOemStringToCountedUnicodeSize(OemSource); - if (AllocateDestinationString == TRUE) - { - UniDest->Buffer = RtlpAllocateStringMemory (Length, TAG_USTR); - if (UniDest->Buffer == NULL) - return STATUS_NO_MEMORY; + if (!Length) + { + RtlZeroMemory(UniDest, sizeof(UNICODE_STRING)); + return STATUS_SUCCESS; + } - UniDest->MaximumLength = Length; - } - else if (Length > UniDest->MaximumLength) - { - return STATUS_BUFFER_TOO_SMALL; - } + if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2; - UniDest->Length = Length; + UniDest->Length = (USHORT)Length; - Status = RtlOemToUnicodeN (UniDest->Buffer, + if (AllocateDestinationString) + { + UniDest->Buffer = RtlpAllocateStringMemory(Length, TAG_USTR); + UniDest->MaximumLength = Length; + if (!UniDest->Buffer) return STATUS_NO_MEMORY; + } + else if (UniDest->Length >= UniDest->MaximumLength) + { + return STATUS_BUFFER_OVERFLOW; + } + + Status = RtlOemToUnicodeN(UniDest->Buffer, UniDest->Length, - NULL, + &Index, OemSource->Buffer, OemSource->Length); - if (!NT_SUCCESS(Status) && AllocateDestinationString) - { - RtlpFreeStringMemory(UniDest->Buffer, TAG_USTR); - return Status; - } + if (!NT_SUCCESS(Status) && AllocateDestinationString) + { + RtlpFreeStringMemory(UniDest->Buffer, TAG_USTR); + UniDest->Buffer = NULL; + return Status; + } - return Status; + return STATUS_SUCCESS; } /* @@ -1184,21 +1173,25 @@ IN PUNICODE_STRING ComputerName1, IN PUNICODE_STRING ComputerName2) { - OEM_STRING OemString1; - OEM_STRING OemString2; - BOOLEAN Result = FALSE; + OEM_STRING OemString1; + OEM_STRING OemString2; + BOOLEAN Result = FALSE; - if (NT_SUCCESS(RtlUpcaseUnicodeStringToOemString( &OemString1, ComputerName1, TRUE ))) - { - if (NT_SUCCESS(RtlUpcaseUnicodeStringToOemString( &OemString2, ComputerName2, TRUE ))) - { - Result = RtlEqualString( &OemString1, &OemString2, TRUE ); - RtlFreeOemString( &OemString2 ); - } - RtlFreeOemString( &OemString1 ); - } + if (NT_SUCCESS(RtlUpcaseUnicodeStringToOemString(&OemString1, + ComputerName1, + TRUE))) + { + if (NT_SUCCESS(RtlUpcaseUnicodeStringToOemString(&OemString2, + ComputerName2, + TRUE))) + { + Result = RtlEqualString(&OemString1, &OemString2, FALSE); + RtlFreeOemString(&OemString2); + } + RtlFreeOemString(&OemString1); + } - return Result; + return Result; } /* @@ -1217,46 +1210,11 @@ IN PUNICODE_STRING DomainName2 ) { - return RtlEqualComputerName(DomainName1, DomainName2); + return RtlEqualComputerName(DomainName1, DomainName2); } - /* * @implemented - */ -/* -BOOLEAN -STDCALL -RtlEqualDomainName ( - IN PUNICODE_STRING DomainName1, - IN PUNICODE_STRING DomainName2 -) -{ - OEM_STRING OemString1; - OEM_STRING OemString2; - BOOLEAN Result; - - RtlUpcaseUnicodeStringToOemString (&OemString1, - DomainName1, [truncated at 1000 lines; 877 more skipped]
19 years, 3 months
1
0
0
0
← Newer
1
...
15
16
17
18
19
20
21
...
59
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Results per page:
10
25
50
100
200