Convert title from UNICODE_STRING to nul-terminated
Modified: trunk/reactos/subsys/csrss/win32csr/guiconsole.c
_____
Modified: trunk/reactos/subsys/csrss/win32csr/guiconsole.c
--- trunk/reactos/subsys/csrss/win32csr/guiconsole.c 2005-09-09
10:22:40 UTC (rev 17760)
+++ trunk/reactos/subsys/csrss/win32csr/guiconsole.c 2005-09-09
11:43:26 UTC (rev 17761)
@@ -786,6 +786,7 @@
HWND NewWindow;
LONG WindowCount;
MSG Msg;
+ PWCHAR Buffer, Title;
PCSRSS_CONSOLE Console = (PCSRSS_CONSOLE) lParam;
switch(msg)
@@ -794,8 +795,20 @@
SetWindowLongW(hWnd, GWL_USERDATA, 0);
return 0;
case PM_CREATE_CONSOLE:
+ Buffer = HeapAlloc(Win32CsrApiHeap, 0,
+ Console->Title.Length + sizeof(WCHAR));
+ if (NULL != Buffer)
+ {
+ memcpy(Buffer, Console->Title.Buffer,
Console->Title.Length);
+ Buffer[Console->Title.Length / sizeof(WCHAR)] = L'\0';
+ Title = Buffer;
+ }
+ else
+ {
+ Title = L"";
+ }
NewWindow = CreateWindowW(L"ConsoleWindowClass",
- Console->Title.Buffer,
+ Title,
WS_OVERLAPPED | WS_CAPTION |
WS_SYSMENU | WS_MINIMIZEBOX,
CW_USEDEFAULT,
CW_USEDEFAULT,
@@ -805,6 +818,10 @@
NULL,
(HINSTANCE) GetModuleHandleW(NULL),
(PVOID) Console);
+ if (NULL != Buffer)
+ {
+ HeapFree(Win32CsrApiHeap, 0, Buffer);
+ }
Console->hWindow = NewWindow;
if (NULL != NewWindow)
{
@@ -934,8 +951,26 @@
STATIC BOOL STDCALL
GuiChangeTitle(PCSRSS_CONSOLE Console)
{
- SendMessageW(Console->hWindow, WM_SETTEXT, 0, (LPARAM)
Console->Title.Buffer);
+ PWCHAR Buffer, Title;
+ Buffer = HeapAlloc(Win32CsrApiHeap, 0,
+ Console->Title.Length + sizeof(WCHAR));
+ if (NULL != Buffer)
+ {
+ memcpy(Buffer, Console->Title.Buffer, Console->Title.Length);
+ Buffer[Console->Title.Length / sizeof(WCHAR)] = L'\0';
+ Title = Buffer;
+ }
+ else
+ {
+ Title = L"";
+ }
+ SendMessageW(Console->hWindow, WM_SETTEXT, 0, (LPARAM) Title);
+ if (NULL != Buffer)
+ {
+ HeapFree(Win32CsrApiHeap, 0, Buffer);
+ }
+
return TRUE;
}
Show replies by date