Author: ekohl Date: Sat May 10 21:15:36 2014 New Revision: 63224
URL: http://svn.reactos.org/svn/reactos?rev=63224&view=rev Log: [VIDEOPRT] Fix buggy monitor device id decode routine. This patch is dedicated to Christoph von Wittlich.
Modified: trunk/reactos/win32ss/drivers/videoprt/child.c
Modified: trunk/reactos/win32ss/drivers/videoprt/child.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/drivers/videoprt/ch... ============================================================================== --- trunk/reactos/win32ss/drivers/videoprt/child.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/drivers/videoprt/child.c [iso-8859-1] Sat May 10 21:15:36 2014 @@ -20,6 +20,7 @@ */
#include "videoprt.h" +#include <stdio.h>
#define NDEBUG #include <debug.h> @@ -33,30 +34,24 @@ IN OUT PWCHAR Buffer) { USHORT Manufacturer, Model; - UNICODE_STRING UnicodeModelStr;
/* This must be valid to call this function */ ASSERT(ChildExtension->EdidValid);
/* 3 letters 5-bit ANSI manufacturer code (big endian) */ + /* Letters encoded as A=1 to Z=26 */ Manufacturer = *(PUSHORT)(&ChildExtension->ChildDescriptor[8]); - - /* Letters encoded as A=1 to Z=26 */ - Buffer[0] = (WCHAR)((Manufacturer & 0x7C00) + 'A' - 1); - Buffer[1] = (WCHAR)((Manufacturer & 0x03E0) + 'A' - 1); - Buffer[2] = (WCHAR)((Manufacturer & 0x001F) + 'A' - 1);
/* Model number (16-bit little endian) */ Model = *(PUSHORT)(&ChildExtension->ChildDescriptor[10]);
- /* Use Rtl helper for conversion */ - UnicodeModelStr.Buffer = &Buffer[3]; - UnicodeModelStr.Length = 0; - UnicodeModelStr.MaximumLength = 4 * sizeof(WCHAR); - RtlIntegerToUnicodeString(Model, 16, &UnicodeModelStr); - - /* Terminate it */ - Buffer[7] = UNICODE_NULL; + /* Convert the Monitor ID to a readable form */ + swprintf(Buffer, + L"%C%C%C%04hx", + (WCHAR)((Manufacturer >> 10 & 0x001F) + 'A' - 1), + (WCHAR)((Manufacturer >> 5 & 0x001F) + 'A' - 1), + (WCHAR)((Manufacturer & 0x001F) + 'A' - 1), + Model);
/* And we're done */ return TRUE;