Author: fireball
Date: Sat Jan 17 02:38:25 2009
New Revision: 38809
URL: http://svn.reactos.org/svn/reactos?rev=38809&view=rev
Log:
- RtlOemStringToCountedUnicodeString improvements:
* Fix STATUS_BUFFER_OVERFLOW when destination string's MaximumLength and Length are equal.
* Add comments.
Modified:
trunk/reactos/lib/rtl/unicode.c
Modified: trunk/reactos/lib/rtl/unicode.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/unicode.c?rev=3880…
==============================================================================
--- trunk/reactos/lib/rtl/unicode.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/unicode.c [iso-8859-1] Sat Jan 17 02:38:25 2009
@@ -1182,29 +1182,35 @@
PAGED_CODE_RTL();
+ /* Calculate size of the string */
Length = RtlOemStringToCountedUnicodeSize(OemSource);
+ /* If it's 0 then zero out dest string and return */
if (!Length)
{
RtlZeroMemory(UniDest, sizeof(UNICODE_STRING));
return STATUS_SUCCESS;
}
+ /* Check if length is a sane value */
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
+ /* Store it in dest string */
UniDest->Length = (USHORT)Length;
+ /* If we're asked to alloc the string - do so */
if (AllocateDestinationString)
{
UniDest->Buffer = RtlpAllocateStringMemory(Length, TAG_USTR);
UniDest->MaximumLength = Length;
if (!UniDest->Buffer) return STATUS_NO_MEMORY;
}
- else if (UniDest->Length >= UniDest->MaximumLength)
+ else if (UniDest->Length > UniDest->MaximumLength)
{
return STATUS_BUFFER_OVERFLOW;
}
+ /* Do the conversion */
Status = RtlOemToUnicodeN(UniDest->Buffer,
UniDest->Length,
&Index,
@@ -1213,6 +1219,7 @@
if (!NT_SUCCESS(Status) && AllocateDestinationString)
{
+ /* Conversion failed, free dest string and return status code */
RtlpFreeStringMemory(UniDest->Buffer, TAG_USTR);
UniDest->Buffer = NULL;
return Status;
Author: fireball
Date: Sat Jan 17 01:44:28 2009
New Revision: 38808
URL: http://svn.reactos.org/svn/reactos?rev=38808&view=rev
Log:
- RtlUnicodeStringToCountedOemString improvements:
* Fix zero-sized input string handling, result would be error instead of success and zero output string.
* If destination string's MaximumLength and Length are equal, it's not an erroneous situation (in fact, a very common situation).
* Add comments.
Modified:
trunk/reactos/lib/rtl/unicode.c
Modified: trunk/reactos/lib/rtl/unicode.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/unicode.c?rev=3880…
==============================================================================
--- trunk/reactos/lib/rtl/unicode.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/unicode.c [iso-8859-1] Sat Jan 17 01:44:28 2009
@@ -1492,38 +1492,47 @@
PAGED_CODE_RTL();
+ /* Calculate size of the string */
Length = RtlUnicodeStringToCountedOemSize(UniSource);
+ /* If it's 0 then zero out dest string and return */
if (!Length)
{
RtlZeroMemory(OemDest, sizeof(OEM_STRING));
- }
-
+ return STATUS_SUCCESS;
+ }
+
+ /* Check if length is a sane value */
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
+ /* Store it in dest string */
OemDest->Length = (USHORT)Length;
+ /* If we're asked to alloc the string - do so */
if (AllocateDestinationString)
{
OemDest->Buffer = RtlpAllocateStringMemory(Length, TAG_OSTR);
OemDest->MaximumLength = Length;
if (!OemDest->Buffer) return STATUS_NO_MEMORY;
}
- else if (OemDest->Length >= OemDest->MaximumLength)
+ else if (OemDest->Length > OemDest->MaximumLength)
{
return STATUS_BUFFER_OVERFLOW;
}
+ /* Do the conversion */
Status = RtlUnicodeToOemN(OemDest->Buffer,
OemDest->Length,
&Index,
UniSource->Buffer,
UniSource->Length);
- /* FIXME: Special check needed and return STATUS_UNMAPPABLE_CHARACTER */
+ /* FIXME: Check if everything mapped correctly and
+ * return STATUS_UNMAPPABLE_CHARACTER */
if (!NT_SUCCESS(Status) && AllocateDestinationString)
{
+ /* Conversion failed, free dest string and return status code */
RtlpFreeStringMemory(OemDest->Buffer, TAG_OSTR);
OemDest->Buffer = NULL;
return Status;
Author: jimtabor
Date: Sat Jan 17 01:07:36 2009
New Revision: 38807
URL: http://svn.reactos.org/svn/reactos?rev=38807&view=rev
Log:
- It is shameful, hacks like this.
Modified:
trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Sat Jan 17 01:07:36 2009
@@ -118,7 +118,9 @@
return FALSE;
MessageQueue = Win32Thread->MessageQueue;
+// HACK!!!!!!! Newbies that wrote this should hold your head down in shame! (jt)
MessageQueue->WakeMask = ~0;
+ MessageQueue->WakeMask &= ~QS_TIMER;
return TRUE;
}
@@ -1432,7 +1434,9 @@
MessageQueue->LastMsgRead = LargeTickCount.u.LowPart;
MessageQueue->FocusWindow = NULL;
MessageQueue->PaintCount = 0;
+// HACK!!!!!!! Newbies that wrote this should hold your head down in shame! (jt)
MessageQueue->WakeMask = ~0;
+ MessageQueue->WakeMask &= ~QS_TIMER;
MessageQueue->NewMessagesHandle = NULL;
Status = ZwCreateEvent(&MessageQueue->NewMessagesHandle, EVENT_ALL_ACCESS,