mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Convert title from UNICODE_STRING to nul-terminated
svn path=/trunk/; revision=17761
This commit is contained in:
parent
b1e0054bee
commit
c0337d5d24
1 changed files with 37 additions and 2 deletions
|
@ -786,6 +786,7 @@ GuiConsoleNotifyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
HWND NewWindow;
|
||||
LONG WindowCount;
|
||||
MSG Msg;
|
||||
PWCHAR Buffer, Title;
|
||||
PCSRSS_CONSOLE Console = (PCSRSS_CONSOLE) lParam;
|
||||
|
||||
switch(msg)
|
||||
|
@ -794,8 +795,20 @@ GuiConsoleNotifyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
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 @@ GuiConsoleNotifyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
NULL,
|
||||
(HINSTANCE) GetModuleHandleW(NULL),
|
||||
(PVOID) Console);
|
||||
if (NULL != Buffer)
|
||||
{
|
||||
HeapFree(Win32CsrApiHeap, 0, Buffer);
|
||||
}
|
||||
Console->hWindow = NewWindow;
|
||||
if (NULL != NewWindow)
|
||||
{
|
||||
|
@ -934,7 +951,25 @@ GuiInitScreenBuffer(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buffer)
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue