mirror of
https://github.com/reactos/reactos.git
synced 2024-08-26 21:28:48 +00:00
* halfplement reading / writing Console User settings
* remove hardcoded constants * shuffle initialization code :-) * changing console text / background color now works :-))))))) * changing cursor works only for one input (needs be investigated) svn path=/trunk/; revision=23930
This commit is contained in:
parent
7aae13b091
commit
753aa1c0e2
|
@ -126,8 +126,6 @@ CsrInitConsoleScreenBuffer(PCSRSS_CONSOLE Console,
|
||||||
{
|
{
|
||||||
ClearLineBuffer(Buffer);
|
ClearLineBuffer(Buffer);
|
||||||
}
|
}
|
||||||
Buffer->CursorInfo.bVisible = TRUE;
|
|
||||||
Buffer->CursorInfo.dwSize = 5;
|
|
||||||
Buffer->Mode = ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT;
|
Buffer->Mode = ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT;
|
||||||
Buffer->CurrentX = 0;
|
Buffer->CurrentX = 0;
|
||||||
Buffer->CurrentY = 0;
|
Buffer->CurrentY = 0;
|
||||||
|
@ -158,8 +156,6 @@ CsrInitConsole(PCSRSS_CONSOLE Console)
|
||||||
Console->EarlyReturn = FALSE;
|
Console->EarlyReturn = FALSE;
|
||||||
Console->ActiveBuffer = NULL;
|
Console->ActiveBuffer = NULL;
|
||||||
InitializeListHead(&Console->InputEvents);
|
InitializeListHead(&Console->InputEvents);
|
||||||
InitializeListHead(&Console->ProcessList);
|
|
||||||
|
|
||||||
Console->CodePage = GetOEMCP();
|
Console->CodePage = GetOEMCP();
|
||||||
Console->OutputCodePage = GetOEMCP();
|
Console->OutputCodePage = GetOEMCP();
|
||||||
|
|
||||||
|
@ -180,6 +176,9 @@ CsrInitConsole(PCSRSS_CONSOLE Console)
|
||||||
|
|
||||||
/* allocate console screen buffer */
|
/* allocate console screen buffer */
|
||||||
NewBuffer = HeapAlloc(Win32CsrApiHeap, HEAP_ZERO_MEMORY, sizeof(CSRSS_SCREEN_BUFFER));
|
NewBuffer = HeapAlloc(Win32CsrApiHeap, HEAP_ZERO_MEMORY, sizeof(CSRSS_SCREEN_BUFFER));
|
||||||
|
/* init screen buffer with defaults */
|
||||||
|
NewBuffer->CursorInfo.bVisible = TRUE;
|
||||||
|
NewBuffer->CursorInfo.dwSize = 5;
|
||||||
/* make console active, and insert into console list */
|
/* make console active, and insert into console list */
|
||||||
Console->ActiveBuffer = (PCSRSS_SCREEN_BUFFER) NewBuffer;
|
Console->ActiveBuffer = (PCSRSS_SCREEN_BUFFER) NewBuffer;
|
||||||
/* add a reference count because the buffer is tied to the console */
|
/* add a reference count because the buffer is tied to the console */
|
||||||
|
@ -275,14 +274,17 @@ CSR_API(CsrAllocConsole)
|
||||||
{
|
{
|
||||||
/* Allocate a console structure */
|
/* Allocate a console structure */
|
||||||
NewConsole = TRUE;
|
NewConsole = TRUE;
|
||||||
Console = HeapAlloc(Win32CsrApiHeap, 0, sizeof(CSRSS_CONSOLE));
|
Console = HeapAlloc(Win32CsrApiHeap, HEAP_ZERO_MEMORY, sizeof(CSRSS_CONSOLE));
|
||||||
if (NULL == Console)
|
if (NULL == Console)
|
||||||
{
|
{
|
||||||
DPRINT1("Not enough memory for console\n");
|
DPRINT1("Not enough memory for console\n");
|
||||||
Request->Status = STATUS_NO_MEMORY;
|
Request->Status = STATUS_NO_MEMORY;
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
/* initialize list head */
|
||||||
|
InitializeListHead(&Console->ProcessList);
|
||||||
|
/* insert process data required for GUI initialization */
|
||||||
|
InsertHeadList(&Console->ProcessList, &ProcessData->ProcessEntry);
|
||||||
/* Initialize the Console */
|
/* Initialize the Console */
|
||||||
Request->Status = CsrInitConsole(Console);
|
Request->Status = CsrInitConsole(Console);
|
||||||
if (!NT_SUCCESS(Request->Status))
|
if (!NT_SUCCESS(Request->Status))
|
||||||
|
@ -361,10 +363,12 @@ CSR_API(CsrAllocConsole)
|
||||||
ProcessData->CtrlDispatcher = Request->Data.AllocConsoleRequest.CtrlDispatcher;
|
ProcessData->CtrlDispatcher = Request->Data.AllocConsoleRequest.CtrlDispatcher;
|
||||||
DPRINT("CSRSS:CtrlDispatcher address: %x\n", ProcessData->CtrlDispatcher);
|
DPRINT("CSRSS:CtrlDispatcher address: %x\n", ProcessData->CtrlDispatcher);
|
||||||
|
|
||||||
/* Insert into the list */
|
if (!NewConsole)
|
||||||
////////////////////////////
|
{
|
||||||
|
/* Insert into the list if it has not been added */
|
||||||
InsertHeadList(&ProcessData->Console->ProcessList, &ProcessData->ProcessEntry);
|
InsertHeadList(&ProcessData->Console->ProcessList, &ProcessData->ProcessEntry);
|
||||||
///////////////////////////
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +376,6 @@ CSR_API(CsrFreeConsole)
|
||||||
{
|
{
|
||||||
PCSRSS_CONSOLE Console;
|
PCSRSS_CONSOLE Console;
|
||||||
|
|
||||||
DPRINT("CsrFreeConsole\n");
|
|
||||||
|
|
||||||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||||
|
@ -388,7 +391,6 @@ CSR_API(CsrFreeConsole)
|
||||||
{
|
{
|
||||||
ConioDeleteConsole((Object_t *) Console);
|
ConioDeleteConsole((Object_t *) Console);
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1999,7 +2001,8 @@ CSR_API(CsrGetCursorInfo)
|
||||||
{
|
{
|
||||||
return Request->Status = Status;
|
return Request->Status = Status;
|
||||||
}
|
}
|
||||||
Request->Data.GetCursorInfoRequest.Info = Buff->CursorInfo;
|
Request->Data.GetCursorInfoRequest.Info.bVisible = Buff->CursorInfo.bVisible;
|
||||||
|
Request->Data.GetCursorInfoRequest.Info.dwSize = Buff->CursorInfo.dwSize;
|
||||||
ConioUnlockScreenBuffer(Buff);
|
ConioUnlockScreenBuffer(Buff);
|
||||||
|
|
||||||
return Request->Status = STATUS_SUCCESS;
|
return Request->Status = STATUS_SUCCESS;
|
||||||
|
@ -2220,13 +2223,24 @@ CSR_API(CsrCreateScreenBuffer)
|
||||||
{
|
{
|
||||||
Buff->MaxX = Console->ActiveBuffer->MaxX;
|
Buff->MaxX = Console->ActiveBuffer->MaxX;
|
||||||
Buff->MaxY = Console->ActiveBuffer->MaxY;
|
Buff->MaxY = Console->ActiveBuffer->MaxY;
|
||||||
|
Buff->CursorInfo.bVisible = Console->ActiveBuffer->CursorInfo.bVisible;
|
||||||
|
Buff->CursorInfo.dwSize = Console->ActiveBuffer->CursorInfo.dwSize;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Buff->CursorInfo.bVisible = TRUE;
|
||||||
|
Buff->CursorInfo.dwSize = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Buff->MaxX == 0)
|
if (Buff->MaxX == 0)
|
||||||
|
{
|
||||||
Buff->MaxX = 80;
|
Buff->MaxX = 80;
|
||||||
|
}
|
||||||
|
|
||||||
if (Buff->MaxY == 0)
|
if (Buff->MaxY == 0)
|
||||||
|
{
|
||||||
Buff->MaxY = 25;
|
Buff->MaxY = 25;
|
||||||
|
}
|
||||||
|
|
||||||
Status = CsrInitConsoleScreenBuffer(Console, Buff);
|
Status = CsrInitConsoleScreenBuffer(Console, Buff);
|
||||||
if(! NT_SUCCESS(Status))
|
if(! NT_SUCCESS(Status))
|
||||||
|
@ -3308,7 +3322,7 @@ CSR_API(CsrGetProcessList)
|
||||||
current_entry = current_entry->Flink)
|
current_entry = current_entry->Flink)
|
||||||
{
|
{
|
||||||
current = CONTAINING_RECORD(current_entry, CSRSS_PROCESS_DATA, ProcessEntry);
|
current = CONTAINING_RECORD(current_entry, CSRSS_PROCESS_DATA, ProcessEntry);
|
||||||
if(nItems++ < Request->Data.GetProcessListRequest.nMaxIds)
|
if(++nItems < Request->Data.GetProcessListRequest.nMaxIds)
|
||||||
{
|
{
|
||||||
*(Buffer++) = current->ProcessId;
|
*(Buffer++) = current->ProcessId;
|
||||||
nCopied++;
|
nCopied++;
|
||||||
|
|
|
@ -38,4 +38,11 @@ BEGIN
|
||||||
IDS_FIND "Find..."
|
IDS_FIND "Find..."
|
||||||
IDS_DEFAULTS "Defaults"
|
IDS_DEFAULTS "Defaults"
|
||||||
IDS_PROPERTIES "Properties"
|
IDS_PROPERTIES "Properties"
|
||||||
|
IDS_SCROLLHERE "Scroll Here"
|
||||||
|
IDS_SCROLLTOP "Scroll Top"
|
||||||
|
IDS_SCROLLBOTTOM "Scroll Bottom"
|
||||||
|
IDS_SCROLLPAGE_UP "Page Up"
|
||||||
|
IDS_SCROLLPAGE_DOWN "Page Down"
|
||||||
|
IDS_SCROLLUP "Scroll Up"
|
||||||
|
IDS_SCROLLDOWN "Scroll Down"
|
||||||
END
|
END
|
||||||
|
|
|
@ -32,14 +32,26 @@ typedef struct GUI_CONSOLE_DATA_TAG
|
||||||
BOOL MouseDown;
|
BOOL MouseDown;
|
||||||
HMODULE ConsoleLibrary;
|
HMODULE ConsoleLibrary;
|
||||||
HANDLE hGuiInitEvent;
|
HANDLE hGuiInitEvent;
|
||||||
|
HWND hVScrollBar;
|
||||||
|
HWND hHScrollBar;
|
||||||
WCHAR FontName[LF_FACESIZE];
|
WCHAR FontName[LF_FACESIZE];
|
||||||
DWORD FontSize;
|
DWORD FontSize;
|
||||||
DWORD FontWeight;
|
DWORD FontWeight;
|
||||||
DWORD CursorSize;
|
|
||||||
DWORD HistoryNoDup;
|
DWORD HistoryNoDup;
|
||||||
DWORD FullScreen;
|
DWORD FullScreen;
|
||||||
DWORD QuickEdit;
|
DWORD QuickEdit;
|
||||||
DWORD InsertMode;
|
DWORD InsertMode;
|
||||||
|
DWORD NumberOfHistoryBuffers;
|
||||||
|
DWORD HistoryBufferSize;
|
||||||
|
DWORD WindowPosition;
|
||||||
|
DWORD ScreenBufferSize;
|
||||||
|
DWORD UseRasterFonts;
|
||||||
|
COLORREF ScreenText;
|
||||||
|
COLORREF ScreenBackground;
|
||||||
|
COLORREF PopupBackground;
|
||||||
|
COLORREF PopupText;
|
||||||
|
COLORREF Colors[16];
|
||||||
|
WCHAR szProcessName[MAX_PATH];
|
||||||
} GUI_CONSOLE_DATA, *PGUI_CONSOLE_DATA;
|
} GUI_CONSOLE_DATA, *PGUI_CONSOLE_DATA;
|
||||||
|
|
||||||
#ifndef WM_APP
|
#ifndef WM_APP
|
||||||
|
@ -49,6 +61,7 @@ typedef struct GUI_CONSOLE_DATA_TAG
|
||||||
#define PM_DESTROY_CONSOLE (WM_APP + 2)
|
#define PM_DESTROY_CONSOLE (WM_APP + 2)
|
||||||
|
|
||||||
#define CURSOR_BLINK_TIME 500
|
#define CURSOR_BLINK_TIME 500
|
||||||
|
#define DEFAULT_ATTRIB (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY)
|
||||||
|
|
||||||
static BOOL ConsInitialized = FALSE;
|
static BOOL ConsInitialized = FALSE;
|
||||||
static HWND NotifyWnd;
|
static HWND NotifyWnd;
|
||||||
|
@ -82,6 +95,26 @@ static const GUICONSOLE_MENUITEM GuiConsoleMainMenuItems[] =
|
||||||
{ 0, NULL, 0 } /* End of list */
|
{ 0, NULL, 0 } /* End of list */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const COLORREF s_Colors[] =
|
||||||
|
{
|
||||||
|
RGB(0, 0, 0),
|
||||||
|
RGB(0, 0, 128),
|
||||||
|
RGB(0, 128, 0),
|
||||||
|
RGB(0, 128, 128),
|
||||||
|
RGB(128, 0, 0),
|
||||||
|
RGB(128, 0, 128),
|
||||||
|
RGB(128, 128, 0),
|
||||||
|
RGB(192, 192, 192),
|
||||||
|
RGB(128, 128, 128),
|
||||||
|
RGB(0, 0, 255),
|
||||||
|
RGB(0, 255, 0),
|
||||||
|
RGB(0, 255, 255),
|
||||||
|
RGB(255, 0, 0),
|
||||||
|
RGB(255, 0, 255),
|
||||||
|
RGB(255, 255, 0),
|
||||||
|
RGB(255, 255, 255)
|
||||||
|
};
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
static VOID FASTCALL
|
static VOID FASTCALL
|
||||||
|
@ -215,7 +248,7 @@ GuiConsoleOpenUserRegistryPathPerProcessId(DWORD ProcessId, PHANDLE hProcHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL FASTCALL
|
static BOOL FASTCALL
|
||||||
GuiConsoleOpenUserSettings(HWND hWnd, DWORD ProcessId, PHKEY hSubKey, REGSAM samDesired)
|
GuiConsoleOpenUserSettings(PGUI_CONSOLE_DATA GuiData, DWORD ProcessId, PHKEY hSubKey, REGSAM samDesired, BOOL bCreate)
|
||||||
{
|
{
|
||||||
WCHAR szProcessName[MAX_PATH];
|
WCHAR szProcessName[MAX_PATH];
|
||||||
WCHAR szBuffer[MAX_PATH];
|
WCHAR szBuffer[MAX_PATH];
|
||||||
|
@ -224,9 +257,7 @@ GuiConsoleOpenUserSettings(HWND hWnd, DWORD ProcessId, PHKEY hSubKey, REGSAM sam
|
||||||
WCHAR CurDrive[] = { 'A',':', 0 };
|
WCHAR CurDrive[] = { 'A',':', 0 };
|
||||||
HANDLE hProcess;
|
HANDLE hProcess;
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
WCHAR * ptr, *res;
|
WCHAR * ptr;
|
||||||
static const WCHAR szSystemRoot[] = { '%','S','y','s','t','e','m','R','o','o','t','%', 0 };
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* console properties are stored under
|
* console properties are stored under
|
||||||
|
@ -243,21 +274,42 @@ GuiConsoleOpenUserSettings(HWND hWnd, DWORD ProcessId, PHKEY hSubKey, REGSAM sam
|
||||||
* i.e. %SystemRoot%_system32_cmd.exe
|
* i.e. %SystemRoot%_system32_cmd.exe
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!GuiConsoleOpenUserRegistryPathPerProcessId(ProcessId, &hProcess, &hKey, samDesired))
|
DPRINT("GuiConsoleOpenUserSettings entered\n");
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
fLength = GetProcessImageFileNameW(hProcess, szProcessName, MAX_PATH);
|
if (!GuiConsoleOpenUserRegistryPathPerProcessId(ProcessId, &hProcess, &hKey, samDesired))
|
||||||
|
{
|
||||||
|
DPRINT("GuiConsoleOpenUserRegistryPathPerProcessId failed\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
fLength = GetProcessImageFileNameW(hProcess, szProcessName, sizeof(GuiData->szProcessName) / sizeof(WCHAR));
|
||||||
CloseHandle(hProcess);
|
CloseHandle(hProcess);
|
||||||
|
|
||||||
if (!fLength)
|
if (!fLength)
|
||||||
{
|
{
|
||||||
DPRINT1("GetProcessImageFileNameW failed(0x%x)ProcessId %d\n", GetLastError(),hProcess);
|
DPRINT("GetProcessImageFileNameW failed(0x%x)ProcessId %d\n", GetLastError(),hProcess);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* try the process name as path
|
||||||
|
*/
|
||||||
|
|
||||||
ptr = wcsrchr(szProcessName, L'\\');
|
ptr = wcsrchr(szProcessName, L'\\');
|
||||||
|
wcscpy(GuiData->szProcessName, ptr);
|
||||||
|
|
||||||
swprintf(szBuffer, L"Console%s",ptr);
|
swprintf(szBuffer, L"Console%s",ptr);
|
||||||
|
DPRINT("#1 Path : %S\n", szBuffer);
|
||||||
|
|
||||||
|
if (bCreate)
|
||||||
|
{
|
||||||
|
if (RegCreateKeyW(hKey, szBuffer, hSubKey) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (RegOpenKeyExW(hKey, szBuffer, 0, samDesired, hSubKey) == ERROR_SUCCESS)
|
if (RegOpenKeyExW(hKey, szBuffer, 0, samDesired, hSubKey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -265,6 +317,26 @@ GuiConsoleOpenUserSettings(HWND hWnd, DWORD ProcessId, PHKEY hSubKey, REGSAM sam
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* try the "Shortcut to processname" as path
|
||||||
|
* FIXME: detect wheter the process was started as a shortcut
|
||||||
|
*/
|
||||||
|
|
||||||
|
swprintf(szBuffer, L"Console\\Shortcut to %S", ptr);
|
||||||
|
DPRINT("#2 Path : %S\n", szBuffer);
|
||||||
|
if (RegOpenKeyExW(hKey, szBuffer, 0, samDesired, hSubKey) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
swprintf(GuiData->szProcessName, L"Shortcut to %S", ptr);
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* if the path contains \\Device\\HarddiskVolume1\... remove it
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (szProcessName[0] == L'\\')
|
||||||
|
{
|
||||||
dwBitmask = GetLogicalDrives();
|
dwBitmask = GetLogicalDrives();
|
||||||
while(dwBitmask)
|
while(dwBitmask)
|
||||||
{
|
{
|
||||||
|
@ -275,8 +347,8 @@ GuiConsoleOpenUserSettings(HWND hWnd, DWORD ProcessId, PHKEY hSubKey, REGSAM sam
|
||||||
{
|
{
|
||||||
if (!memcmp(szBuffer, szProcessName, (dwLength-2)*sizeof(WCHAR)))
|
if (!memcmp(szBuffer, szProcessName, (dwLength-2)*sizeof(WCHAR)))
|
||||||
{
|
{
|
||||||
wcscpy(szBuffer, CurDrive);
|
wcscpy(szProcessName, CurDrive);
|
||||||
wcscat(&szBuffer[(sizeof(CurDrive)/sizeof(WCHAR))-1], &szProcessName[dwLength-2]);
|
RtlMoveMemory(&szProcessName[2], &szProcessName[dwLength-1], fLength - dwLength -1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,31 +356,140 @@ GuiConsoleOpenUserSettings(HWND hWnd, DWORD ProcessId, PHKEY hSubKey, REGSAM sam
|
||||||
dwBitmask = (dwBitmask >> 1);
|
dwBitmask = (dwBitmask >> 1);
|
||||||
CurDrive[0]++;
|
CurDrive[0]++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wLength = GetWindowsDirectoryW(szProcessName, MAX_PATH);
|
/*
|
||||||
|
* last attempt: check whether the file is under %SystemRoot%
|
||||||
|
* and use path like Console\%SystemRoot%_dir_dir2_file.exe
|
||||||
|
*/
|
||||||
|
|
||||||
|
wLength = GetWindowsDirectoryW(szBuffer, MAX_PATH);
|
||||||
|
if (wLength)
|
||||||
|
{
|
||||||
if (!wcsncmp(szProcessName, szBuffer, wLength))
|
if (!wcsncmp(szProcessName, szBuffer, wLength))
|
||||||
{
|
{
|
||||||
wcscpy(szProcessName, szSystemRoot);
|
/* replace slashes by underscores */
|
||||||
wcscpy(&szProcessName[(sizeof(szSystemRoot) / sizeof(WCHAR))-1], &szBuffer[wLength]);
|
|
||||||
ptr = res = szProcessName;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ptr = res = szBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
while((ptr = wcschr(szProcessName, L'\\')))
|
while((ptr = wcschr(szProcessName, L'\\')))
|
||||||
ptr[0] = L'_';
|
ptr[0] = L'_';
|
||||||
|
|
||||||
if (RegOpenKeyExW(hKey, res, 0, samDesired, hSubKey) == ERROR_SUCCESS)
|
swprintf(szBuffer, L"Console\\\%SystemRoot\%%S", &szProcessName[wLength]);
|
||||||
|
DPRINT("#3 Path : %S\n", szBuffer);
|
||||||
|
if (RegOpenKeyExW(hKey, szBuffer, 0, samDesired, hSubKey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
swprintf(GuiData->szProcessName, L"\%SystemRoot\%%S", &szProcessName[wLength]);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VOID
|
||||||
|
GuiConsoleWriteUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData)
|
||||||
|
{
|
||||||
|
HKEY hKey;
|
||||||
|
PCSRSS_PROCESS_DATA ProcessData;
|
||||||
|
|
||||||
|
if (Console->ProcessList.Flink == &Console->ProcessList)
|
||||||
|
{
|
||||||
|
DPRINT("GuiConsoleWriteUserSettings: No Process!!!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ProcessData = CONTAINING_RECORD(Console->ProcessList.Flink, CSRSS_PROCESS_DATA, ProcessEntry);
|
||||||
|
if (!GuiConsoleOpenUserSettings(GuiData, PtrToUlong(ProcessData->ProcessId), &hKey, KEY_READ | KEY_WRITE, TRUE))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Console->ActiveBuffer->CursorInfo.dwSize <= 1)
|
||||||
|
{
|
||||||
|
RegDeleteKeyW(hKey, L"CursorSize");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RegSetValueExW(hKey, L"CursorSize", 0, REG_DWORD, (const BYTE *)&Console->ActiveBuffer->CursorInfo.dwSize, sizeof(DWORD));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GuiData->NumberOfHistoryBuffers == 5)
|
||||||
|
{
|
||||||
|
RegDeleteKeyW(hKey, L"NumberOfHistoryBuffers");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RegSetValueExW(hKey, L"NumberOfHistoryBuffers", 0, REG_DWORD, (const BYTE *)&GuiData->NumberOfHistoryBuffers, sizeof(DWORD));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GuiData->HistoryBufferSize == 50)
|
||||||
|
{
|
||||||
|
RegDeleteKeyW(hKey, L"HistoryBufferSize");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RegSetValueExW(hKey, L"HistoryBufferSize", 0, REG_DWORD, (const BYTE *)&GuiData->HistoryBufferSize, sizeof(DWORD));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GuiData->FullScreen == FALSE)
|
||||||
|
{
|
||||||
|
RegDeleteKeyW(hKey, L"FullScreen");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RegSetValueExW(hKey, L"FullScreen", 0, REG_DWORD, (const BYTE *)&GuiData->FullScreen, sizeof(DWORD));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( GuiData->QuickEdit == FALSE)
|
||||||
|
{
|
||||||
|
RegDeleteKeyW(hKey, L"QuickEdit");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RegSetValueExW(hKey, L"QuickEdit", 0, REG_DWORD, (const BYTE *)&GuiData->QuickEdit, sizeof(DWORD));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GuiData->InsertMode == TRUE)
|
||||||
|
{
|
||||||
|
RegDeleteKeyW(hKey, L"InsertMode");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RegSetValueExW(hKey, L"InsertMode", 0, REG_DWORD, (const BYTE *)&GuiData->InsertMode, sizeof(DWORD));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GuiData->HistoryNoDup == FALSE)
|
||||||
|
{
|
||||||
|
RegDeleteKeyW(hKey, L"HistoryNoDup");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RegSetValueExW(hKey, L"HistoryNoDup", 0, REG_DWORD, (const BYTE *)&GuiData->HistoryNoDup, sizeof(DWORD));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GuiData->ScreenText == RGB(192, 192, 192))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* MS uses console attributes instead of real color
|
||||||
|
*/
|
||||||
|
RegDeleteKeyW(hKey, L"ScreenText");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RegSetValueExW(hKey, L"ScreenText", 0, REG_DWORD, (const BYTE *)&GuiData->ScreenText, sizeof(COLORREF));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GuiData->ScreenBackground == RGB(0, 0, 0))
|
||||||
|
{
|
||||||
|
RegDeleteKeyW(hKey, L"ScreenBackground");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RegSetValueExW(hKey, L"ScreenBackground", 0, REG_DWORD, (const BYTE *)&GuiData->ScreenBackground, sizeof(COLORREF));
|
||||||
|
}
|
||||||
|
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
}
|
||||||
|
|
||||||
static void FASTCALL
|
static void FASTCALL
|
||||||
GuiConsoleReadUserSettings(HKEY hKey, PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PCSRSS_SCREEN_BUFFER Buffer)
|
GuiConsoleReadUserSettings(HKEY hKey, PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PCSRSS_SCREEN_BUFFER Buffer)
|
||||||
{
|
{
|
||||||
|
@ -321,7 +502,13 @@ GuiConsoleReadUserSettings(HKEY hKey, PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA
|
||||||
WCHAR szValue[MAX_PATH];
|
WCHAR szValue[MAX_PATH];
|
||||||
DWORD Value;
|
DWORD Value;
|
||||||
|
|
||||||
RegQueryInfoKey(hKey, NULL, NULL, NULL, &dwNumSubKeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL );
|
if (RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &dwNumSubKeys, NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
DPRINT("GuiConsoleReadUserSettings: RegQueryInfoKey failed\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("GuiConsoleReadUserSettings entered dwNumSubKeys %d\n", dwNumSubKeys);
|
||||||
|
|
||||||
for (dwIndex = 0; dwIndex < dwNumSubKeys; dwIndex++)
|
for (dwIndex = 0; dwIndex < dwNumSubKeys; dwIndex++)
|
||||||
{
|
{
|
||||||
|
@ -343,13 +530,24 @@ GuiConsoleReadUserSettings(HKEY hKey, PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wcscmp(szValueName, L"CursorSize"))
|
if (!wcscmp(szValueName, L"CursorSize"))
|
||||||
{
|
{
|
||||||
if (Value == 0x32)
|
if (Value == 0x32)
|
||||||
GuiData->CursorSize = Value;
|
{
|
||||||
|
Buffer->CursorInfo.dwSize = Value;
|
||||||
|
}
|
||||||
else if (Value == 0x64)
|
else if (Value == 0x64)
|
||||||
GuiData->CursorSize = Value;
|
{
|
||||||
|
Buffer->CursorInfo.dwSize = Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!wcscmp(szValueName, L"ScreenText"))
|
||||||
|
{
|
||||||
|
GuiData->ScreenText = Value;
|
||||||
|
}
|
||||||
|
else if (!wcscmp(szValueName, L"ScreenBackground"))
|
||||||
|
{
|
||||||
|
GuiData->ScreenBackground = Value;
|
||||||
}
|
}
|
||||||
else if (!wcscmp(szValueName, L"FaceName"))
|
else if (!wcscmp(szValueName, L"FaceName"))
|
||||||
{
|
{
|
||||||
|
@ -374,7 +572,7 @@ GuiConsoleReadUserSettings(HKEY hKey, PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA
|
||||||
}
|
}
|
||||||
else if (!wcscmp(szValueName, L"ScreenBufferSize"))
|
else if (!wcscmp(szValueName, L"ScreenBufferSize"))
|
||||||
{
|
{
|
||||||
if( Buffer)
|
if(Buffer)
|
||||||
{
|
{
|
||||||
Buffer->MaxX = LOWORD(Value);
|
Buffer->MaxX = LOWORD(Value);
|
||||||
Buffer->MaxY = HIWORD(Value);
|
Buffer->MaxY = HIWORD(Value);
|
||||||
|
@ -404,11 +602,20 @@ GuiConsoleUseDefaults(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PCSRSS_
|
||||||
wcscpy(GuiData->FontName, L"Bitstream Vera Sans Mono");
|
wcscpy(GuiData->FontName, L"Bitstream Vera Sans Mono");
|
||||||
GuiData->FontSize = 0x0008000C; // font is 8x12
|
GuiData->FontSize = 0x0008000C; // font is 8x12
|
||||||
GuiData->FontWeight = FW_NORMAL;
|
GuiData->FontWeight = FW_NORMAL;
|
||||||
GuiData->CursorSize = 0;
|
|
||||||
GuiData->HistoryNoDup = FALSE;
|
GuiData->HistoryNoDup = FALSE;
|
||||||
GuiData->FullScreen = FALSE;
|
GuiData->FullScreen = FALSE;
|
||||||
GuiData->QuickEdit = FALSE;
|
GuiData->QuickEdit = FALSE;
|
||||||
GuiData->InsertMode = TRUE;
|
GuiData->InsertMode = TRUE;
|
||||||
|
GuiData->HistoryBufferSize = 50;
|
||||||
|
GuiData->NumberOfHistoryBuffers = 5;
|
||||||
|
GuiData->ScreenText = RGB(192, 192, 192);
|
||||||
|
GuiData->ScreenBackground = RGB(0, 0, 0);
|
||||||
|
GuiData->PopupText = RGB(128, 0, 128);
|
||||||
|
GuiData->PopupBackground = RGB(255, 255, 255);
|
||||||
|
GuiData->WindowPosition = UINT_MAX;
|
||||||
|
GuiData->ScreenBufferSize = MAKELONG(80, 300); //FIXME
|
||||||
|
GuiData->UseRasterFonts = TRUE;
|
||||||
|
memcpy(GuiData->Colors, s_Colors, sizeof(s_Colors));
|
||||||
|
|
||||||
Console->Size.X = 80;
|
Console->Size.X = 80;
|
||||||
Console->Size.Y = 25;
|
Console->Size.Y = 25;
|
||||||
|
@ -417,6 +624,8 @@ GuiConsoleUseDefaults(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PCSRSS_
|
||||||
{
|
{
|
||||||
Buffer->MaxX = 80;
|
Buffer->MaxX = 80;
|
||||||
Buffer->MaxY = 25;
|
Buffer->MaxY = 25;
|
||||||
|
Buffer->CursorInfo.bVisible = TRUE;
|
||||||
|
Buffer->CursorInfo.dwSize = 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,7 +655,7 @@ GuiConsoleHandleNcCreate(HWND hWnd, CREATESTRUCTW *Create)
|
||||||
if (Console->ProcessList.Flink != &Console->ProcessList)
|
if (Console->ProcessList.Flink != &Console->ProcessList)
|
||||||
{
|
{
|
||||||
ProcessData = CONTAINING_RECORD(Console->ProcessList.Flink, CSRSS_PROCESS_DATA, ProcessEntry);
|
ProcessData = CONTAINING_RECORD(Console->ProcessList.Flink, CSRSS_PROCESS_DATA, ProcessEntry);
|
||||||
if (GuiConsoleOpenUserSettings(hWnd, PtrToUlong(ProcessData->ProcessId), &hKey, KEY_READ))
|
if (GuiConsoleOpenUserSettings(GuiData, PtrToUlong(ProcessData->ProcessId), &hKey, KEY_READ, FALSE))
|
||||||
{
|
{
|
||||||
GuiConsoleReadUserSettings(hKey, Console, GuiData, Console->ActiveBuffer);
|
GuiConsoleReadUserSettings(hKey, Console, GuiData, Console->ActiveBuffer);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
|
@ -528,9 +737,8 @@ GuiConsoleHandleNcCreate(HWND hWnd, CREATESTRUCTW *Create)
|
||||||
Rect.bottom - Rect.top, FALSE);
|
Rect.bottom - Rect.top, FALSE);
|
||||||
|
|
||||||
SetTimer(hWnd, 1, CURSOR_BLINK_TIME, NULL);
|
SetTimer(hWnd, 1, CURSOR_BLINK_TIME, NULL);
|
||||||
SetEvent(GuiData->hGuiInitEvent);
|
|
||||||
|
|
||||||
GuiConsoleCreateSysMenu(Console);
|
GuiConsoleCreateSysMenu(Console);
|
||||||
|
SetEvent(GuiData->hGuiInitEvent);
|
||||||
|
|
||||||
return (BOOL) DefWindowProcW(hWnd, WM_NCCREATE, 0, (LPARAM) Create);
|
return (BOOL) DefWindowProcW(hWnd, WM_NCCREATE, 0, (LPARAM) Create);
|
||||||
}
|
}
|
||||||
|
@ -546,10 +754,18 @@ GuiConsoleRGBFromAttribute(BYTE Attribute)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID FASTCALL
|
static VOID FASTCALL
|
||||||
GuiConsoleSetTextColors(HDC Dc, BYTE Attribute)
|
GuiConsoleSetTextColors(HDC Dc, BYTE Attribute, PCSRSS_SCREEN_BUFFER Buff, COLORREF TextColor, COLORREF BkColor)
|
||||||
{
|
{
|
||||||
|
if (Attribute != Buff->DefaultAttrib)
|
||||||
|
{
|
||||||
SetTextColor(Dc, GuiConsoleRGBFromAttribute(Attribute & 0x0f));
|
SetTextColor(Dc, GuiConsoleRGBFromAttribute(Attribute & 0x0f));
|
||||||
SetBkColor(Dc, GuiConsoleRGBFromAttribute((Attribute & 0xf0) >> 4));
|
SetBkColor(Dc, GuiConsoleRGBFromAttribute((Attribute & 0xf0) >> 4));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetTextColor(Dc, TextColor);
|
||||||
|
SetBkColor(Dc, BkColor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID FASTCALL
|
static VOID FASTCALL
|
||||||
|
@ -656,7 +872,10 @@ GuiConsolePaint(PCSRSS_CONSOLE Console,
|
||||||
LastAttribute = Buff->Buffer[(TopLine * Buff->MaxX + LeftChar) * 2 + 1];
|
LastAttribute = Buff->Buffer[(TopLine * Buff->MaxX + LeftChar) * 2 + 1];
|
||||||
|
|
||||||
GuiConsoleSetTextColors(hDC,
|
GuiConsoleSetTextColors(hDC,
|
||||||
LastAttribute);
|
LastAttribute,
|
||||||
|
Buff,
|
||||||
|
GuiData->ScreenText,
|
||||||
|
GuiData->ScreenBackground);
|
||||||
|
|
||||||
EnterCriticalSection(&Buff->Header.Lock);
|
EnterCriticalSection(&Buff->Header.Lock);
|
||||||
|
|
||||||
|
@ -692,7 +911,10 @@ GuiConsolePaint(PCSRSS_CONSOLE Console,
|
||||||
if (Attribute != LastAttribute)
|
if (Attribute != LastAttribute)
|
||||||
{
|
{
|
||||||
GuiConsoleSetTextColors(hDC,
|
GuiConsoleSetTextColors(hDC,
|
||||||
Attribute);
|
Attribute,
|
||||||
|
Buff,
|
||||||
|
GuiData->ScreenText,
|
||||||
|
GuiData->ScreenBackground);
|
||||||
LastAttribute = Attribute;
|
LastAttribute = Attribute;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -729,7 +951,16 @@ GuiConsolePaint(PCSRSS_CONSOLE Console,
|
||||||
CursorHeight = 1;
|
CursorHeight = 1;
|
||||||
}
|
}
|
||||||
From = Buff->Buffer + (Buff->CurrentY * Buff->MaxX + Buff->CurrentX) * 2 + 1;
|
From = Buff->Buffer + (Buff->CurrentY * Buff->MaxX + Buff->CurrentX) * 2 + 1;
|
||||||
|
|
||||||
|
if (*From != DEFAULT_ATTRIB)
|
||||||
|
{
|
||||||
CursorBrush = CreateSolidBrush(GuiConsoleRGBFromAttribute(*From));
|
CursorBrush = CreateSolidBrush(GuiConsoleRGBFromAttribute(*From));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CursorBrush = CreateSolidBrush(GuiData->ScreenText);
|
||||||
|
}
|
||||||
|
|
||||||
OldBrush = SelectObject(hDC,
|
OldBrush = SelectObject(hDC,
|
||||||
CursorBrush);
|
CursorBrush);
|
||||||
PatBlt(hDC,
|
PatBlt(hDC,
|
||||||
|
@ -1026,6 +1257,7 @@ GuiConsoleHandleNcDestroy(HWND hWnd)
|
||||||
PCSRSS_CONSOLE Console;
|
PCSRSS_CONSOLE Console;
|
||||||
PGUI_CONSOLE_DATA GuiData;
|
PGUI_CONSOLE_DATA GuiData;
|
||||||
|
|
||||||
|
|
||||||
GuiConsoleGetDataPointers(hWnd, &Console, &GuiData);
|
GuiConsoleGetDataPointers(hWnd, &Console, &GuiData);
|
||||||
KillTimer(hWnd, 1);
|
KillTimer(hWnd, 1);
|
||||||
Console->PrivateData = NULL;
|
Console->PrivateData = NULL;
|
||||||
|
@ -1176,21 +1408,25 @@ GuiConsoleRightMouseDown(HWND hWnd)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
GuiConsoleShowConsoleProperties(HWND hWnd, BOOL Defaults)
|
GuiConsoleShowConsoleProperties(HWND hWnd, BOOL Defaults, PGUI_CONSOLE_DATA GuiData)
|
||||||
{
|
{
|
||||||
PCSRSS_CONSOLE Console;
|
PCSRSS_CONSOLE Console;
|
||||||
PGUI_CONSOLE_DATA GuiData;
|
|
||||||
APPLET_PROC CPLFunc;
|
APPLET_PROC CPLFunc;
|
||||||
TCHAR szBuffer[MAX_PATH];
|
TCHAR szBuffer[MAX_PATH];
|
||||||
|
ConsoleInfo SharedInfo;
|
||||||
|
|
||||||
|
DPRINT("GuiConsoleShowConsoleProperties entered\n");
|
||||||
|
|
||||||
GuiConsoleGetDataPointers(hWnd, &Console, &GuiData);
|
GuiConsoleGetDataPointers(hWnd, &Console, &GuiData);
|
||||||
|
|
||||||
if (GuiData == NULL)
|
if (GuiData == NULL)
|
||||||
{
|
{
|
||||||
DPRINT1("GuiConsoleGetDataPointers failed\n");
|
DPRINT("GuiConsoleGetDataPointers failed\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GuiData->ConsoleLibrary == NULL)
|
if (GuiData->ConsoleLibrary == NULL)
|
||||||
{
|
{
|
||||||
GetWindowsDirectory(szBuffer,MAX_PATH);
|
GetWindowsDirectory(szBuffer,MAX_PATH);
|
||||||
|
@ -1211,6 +1447,26 @@ GuiConsoleShowConsoleProperties(HWND hWnd, BOOL Defaults)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* setup struct */
|
||||||
|
SharedInfo.InsertMode = GuiData->InsertMode;
|
||||||
|
SharedInfo.HistoryBufferSize = GuiData->HistoryBufferSize;
|
||||||
|
SharedInfo.NumberOfHistoryBuffers = GuiData->NumberOfHistoryBuffers;
|
||||||
|
SharedInfo.ScreenText = GuiData->ScreenText;
|
||||||
|
SharedInfo.ScreenBackground = GuiData->ScreenBackground;
|
||||||
|
SharedInfo.PopupText = GuiData->PopupText;
|
||||||
|
SharedInfo.PopupBackground = GuiData->PopupBackground;
|
||||||
|
SharedInfo.WindowSize = (DWORD)MAKELONG(Console->Size.X, Console->Size.Y);
|
||||||
|
SharedInfo.WindowPosition = GuiData->WindowPosition;
|
||||||
|
SharedInfo.ScreenBuffer = GuiData->ScreenBufferSize;
|
||||||
|
SharedInfo.UseRasterFonts = GuiData->UseRasterFonts;
|
||||||
|
SharedInfo.FontSize = (DWORD)GuiData->FontSize;
|
||||||
|
SharedInfo.FontWeight = GuiData->FontWeight;
|
||||||
|
SharedInfo.CursorSize = Console->ActiveBuffer->CursorInfo.dwSize;
|
||||||
|
SharedInfo.HistoryNoDup = GuiData->HistoryNoDup;
|
||||||
|
SharedInfo.FullScreen = GuiData->FullScreen;
|
||||||
|
SharedInfo.QuickEdit = GuiData->QuickEdit;
|
||||||
|
memcpy(&SharedInfo.Colors[0], GuiData->Colors, sizeof(s_Colors));
|
||||||
|
|
||||||
if (!CPLFunc(hWnd, CPL_INIT, 0, 0))
|
if (!CPLFunc(hWnd, CPL_INIT, 0, 0))
|
||||||
{
|
{
|
||||||
DPRINT("Error: failed to initialize console.dll\n");
|
DPRINT("Error: failed to initialize console.dll\n");
|
||||||
|
@ -1223,22 +1479,10 @@ GuiConsoleShowConsoleProperties(HWND hWnd, BOOL Defaults)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CPLFunc(hWnd, CPL_DBLCLK, 0, Defaults);
|
CPLFunc(hWnd, CPL_DBLCLK, (LPARAM)&SharedInfo, Defaults);
|
||||||
|
|
||||||
// TODO
|
|
||||||
//
|
|
||||||
// read back the changes from console.dll
|
|
||||||
//
|
|
||||||
// if the changes are system-wide then
|
|
||||||
// console.dll should have written it to
|
|
||||||
// registry
|
|
||||||
//
|
|
||||||
// if the changes only apply to this session
|
|
||||||
// then exchange this info with console.dll in
|
|
||||||
// some private way
|
|
||||||
}
|
}
|
||||||
static BOOL FASTCALL
|
static BOOL FASTCALL
|
||||||
GuiConsoleHandleSysMenuCommand(HWND hWnd, WPARAM wParam)
|
GuiConsoleHandleSysMenuCommand(HWND hWnd, WPARAM wParam, PGUI_CONSOLE_DATA GuiData)
|
||||||
{
|
{
|
||||||
BOOL Ret = TRUE;
|
BOOL Ret = TRUE;
|
||||||
|
|
||||||
|
@ -1253,11 +1497,11 @@ GuiConsoleHandleSysMenuCommand(HWND hWnd, WPARAM wParam)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_SYSTEM_DEFAULTS:
|
case ID_SYSTEM_DEFAULTS:
|
||||||
GuiConsoleShowConsoleProperties(hWnd, TRUE);
|
GuiConsoleShowConsoleProperties(hWnd, TRUE, GuiData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_SYSTEM_PROPERTIES:
|
case ID_SYSTEM_PROPERTIES:
|
||||||
GuiConsoleShowConsoleProperties(hWnd, FALSE);
|
GuiConsoleShowConsoleProperties(hWnd, FALSE, GuiData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1268,10 +1512,161 @@ GuiConsoleHandleSysMenuCommand(HWND hWnd, WPARAM wParam)
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VOID FASTCALL
|
||||||
|
GuiConsoleResize(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
PCSRSS_CONSOLE Console;
|
||||||
|
PGUI_CONSOLE_DATA GuiData;
|
||||||
|
|
||||||
|
GuiConsoleGetDataPointers(hWnd, &Console, &GuiData);
|
||||||
|
if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED || wParam == SIZE_MINIMIZED)
|
||||||
|
{
|
||||||
|
DPRINT1("GuiConsoleResize X %d Y %d\n", LOWORD(lParam), HIWORD(lParam));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID FASTCALL
|
||||||
|
GuiConsoleCreateScrollBar(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, HWND NewWindow)
|
||||||
|
{
|
||||||
|
HMENU hMenu;
|
||||||
|
HWND hVScrollBar;
|
||||||
|
HWND hHScrollBar;
|
||||||
|
SCROLLINFO sInfo;
|
||||||
|
|
||||||
|
hMenu = CreatePopupMenu();
|
||||||
|
if (hMenu == NULL)
|
||||||
|
{
|
||||||
|
DPRINT("CreatePopupMenu failed\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//InsertItem(hMenu, MIIM_STRING, MIIM_ID | MIIM_FTYPE | MIIM_STRING, 0, NULL, IDS_SCROLLHERE);
|
||||||
|
//InsertItem(hMenu, MFT_SEPARATOR, MIIM_FTYPE, 0, NULL, -1);
|
||||||
|
//InsertItem(hMenu, MIIM_STRING, MIIM_ID | MIIM_FTYPE | MIIM_STRING, 0, NULL, IDS_SCROLLTOP);
|
||||||
|
//InsertItem(hMenu, MIIM_STRING, MIIM_ID | MIIM_FTYPE | MIIM_STRING, 0, NULL, IDS_SCROLLBOTTOM);
|
||||||
|
//InsertItem(hMenu, MFT_SEPARATOR, MIIM_FTYPE, 0, NULL, -1);
|
||||||
|
//InsertItem(hMenu, MIIM_STRING, MIIM_ID | MIIM_FTYPE | MIIM_STRING, 0, NULL, IDS_SCROLLPAGE_UP);
|
||||||
|
//InsertItem(hMenu, MIIM_STRING, MIIM_ID | MIIM_FTYPE | MIIM_STRING, 0, NULL, IDS_SCROLLPAGE_DOWN);
|
||||||
|
//InsertItem(hMenu, MFT_SEPARATOR, MIIM_FTYPE, 0, NULL, -1);
|
||||||
|
//InsertItem(hMenu, MIIM_STRING, MIIM_ID | MIIM_FTYPE | MIIM_STRING, 0, NULL, IDS_SCROLLUP);
|
||||||
|
//InsertItem(hMenu, MIIM_STRING, MIIM_ID | MIIM_FTYPE | MIIM_STRING, 0, NULL, IDS_SCROLLDOWN);
|
||||||
|
|
||||||
|
hVScrollBar = CreateWindowExW(0L,
|
||||||
|
L"ScrollBar",
|
||||||
|
(LPWSTR)NULL,
|
||||||
|
WS_CHILD | WS_VSCROLL,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
200,
|
||||||
|
50,
|
||||||
|
NewWindow,
|
||||||
|
NULL, //hMenu,
|
||||||
|
GetModuleHandleW(NULL),
|
||||||
|
(LPVOID)GuiData);
|
||||||
|
|
||||||
|
if (hVScrollBar)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* set scrollbar sizes */
|
||||||
|
sInfo.cbSize = sizeof(SCROLLINFO);
|
||||||
|
sInfo.fMask = SIF_RANGE | SIF_POS;
|
||||||
|
sInfo.nMin = 0;
|
||||||
|
sInfo.nMax = Console->ActiveBuffer->MaxY;
|
||||||
|
sInfo.nPos = 0;
|
||||||
|
SetScrollInfo(hVScrollBar, SB_CTL, &sInfo, TRUE);
|
||||||
|
ShowScrollBar(NewWindow, SB_CTL, TRUE);
|
||||||
|
GuiData->hVScrollBar = hVScrollBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Console->ActiveBuffer->MaxX > Console->Size.X)
|
||||||
|
{
|
||||||
|
hHScrollBar = CreateWindowExW(0L,
|
||||||
|
L"ScrollBar",
|
||||||
|
(LPWSTR)NULL,
|
||||||
|
WS_CHILD | WS_HSCROLL,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
200,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
NewWindow,
|
||||||
|
hMenu,
|
||||||
|
GetModuleHandleW(NULL),
|
||||||
|
(LPVOID)GuiData);
|
||||||
|
if (hHScrollBar)
|
||||||
|
{
|
||||||
|
sInfo.nMax = Console->ActiveBuffer->MaxX;
|
||||||
|
SetScrollInfo(hHScrollBar, SB_CTL, &sInfo, TRUE);
|
||||||
|
GuiData->hHScrollBar = hHScrollBar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID FASTCALL
|
||||||
|
GuiApplyUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PConsoleInfo pConInfo)
|
||||||
|
{
|
||||||
|
DWORD windx, windy;
|
||||||
|
RECT rect;
|
||||||
|
|
||||||
|
/* apply text / background color */
|
||||||
|
GuiData->ScreenText = pConInfo->ScreenText;
|
||||||
|
GuiData->ScreenBackground = pConInfo->ScreenBackground;
|
||||||
|
|
||||||
|
/* apply cursor size */
|
||||||
|
Console->ActiveBuffer->CursorInfo.dwSize = max(min(pConInfo->CursorSize, 1), 100);
|
||||||
|
|
||||||
|
windx = LOWORD(pConInfo->ScreenBuffer);
|
||||||
|
windy = HIWORD(pConInfo->ScreenBuffer);
|
||||||
|
|
||||||
|
if (windx != Console->ActiveBuffer->MaxX || windy != Console->ActiveBuffer->MaxY)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// TODO
|
||||||
|
// resize screen buffer
|
||||||
|
|
||||||
|
|
||||||
|
// Console->ActiveBuffer->MaxX = windx;
|
||||||
|
// Console->ActiveBuffer->MaxY = windy;
|
||||||
|
}
|
||||||
|
|
||||||
|
windx = LOWORD(pConInfo->WindowSize);
|
||||||
|
windy = HIWORD(pConInfo->WindowSize);
|
||||||
|
|
||||||
|
if (windx != Console->Size.X || windy != Console->Size.Y)
|
||||||
|
{
|
||||||
|
/* resize window */
|
||||||
|
Console->Size.X = windx;
|
||||||
|
Console->Size.Y = windy;
|
||||||
|
|
||||||
|
GetWindowRect(pConInfo->hConsoleWindow, &rect);
|
||||||
|
|
||||||
|
rect.right = rect.left + Console->Size.X * GuiData->CharWidth + 2 * GetSystemMetrics(SM_CXFIXEDFRAME);
|
||||||
|
rect.bottom = rect.top + Console->Size.Y * GuiData->CharHeight + 2 * GetSystemMetrics(SM_CYFIXEDFRAME) + GetSystemMetrics(SM_CYCAPTION);
|
||||||
|
|
||||||
|
MoveWindow(pConInfo->hConsoleWindow, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, FALSE);
|
||||||
|
|
||||||
|
if (Console->Size.X < Console->ActiveBuffer->MaxX)
|
||||||
|
{
|
||||||
|
/* show scrollbar when window becomes smaller than active screen buffer */
|
||||||
|
//ShowScrollBar(GuiData->hHScrollBar, SB_CTL, TRUE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* hide scrollbar */
|
||||||
|
//ShowScrollBar(GuiData->hHScrollBar, SB_CTL, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* repaint window */
|
||||||
|
InvalidateRect(pConInfo->hConsoleWindow, NULL, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
static LRESULT CALLBACK
|
static LRESULT CALLBACK
|
||||||
GuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
GuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
LRESULT Result = 0;
|
LRESULT Result = 0;
|
||||||
|
PGUI_CONSOLE_DATA GuiData = NULL;
|
||||||
|
PCSRSS_CONSOLE Console = NULL;
|
||||||
|
|
||||||
|
GuiConsoleGetDataPointers(hWnd, &Console, &GuiData);
|
||||||
|
|
||||||
switch(msg)
|
switch(msg)
|
||||||
{
|
{
|
||||||
|
@ -1310,9 +1705,19 @@ GuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
GuiConsoleMouseMove(hWnd, wParam, lParam);
|
GuiConsoleMouseMove(hWnd, wParam, lParam);
|
||||||
break;
|
break;
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
if (!GuiConsoleHandleSysMenuCommand(hWnd, wParam))
|
if (!GuiConsoleHandleSysMenuCommand(hWnd, wParam, GuiData))
|
||||||
Result = DefWindowProcW(hWnd, msg, wParam, lParam);
|
Result = DefWindowProcW(hWnd, msg, wParam, lParam);
|
||||||
break;
|
break;
|
||||||
|
case WM_SIZE:
|
||||||
|
GuiConsoleResize(hWnd, wParam, lParam);
|
||||||
|
break;
|
||||||
|
case PM_APPLY_CONSOLE_INFO:
|
||||||
|
GuiApplyUserSettings(Console, GuiData, (PConsoleInfo)wParam);
|
||||||
|
if (lParam)
|
||||||
|
{
|
||||||
|
GuiConsoleWriteUserSettings(Console, GuiData);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Result = DefWindowProcW(hWnd, msg, wParam, lParam);
|
Result = DefWindowProcW(hWnd, msg, wParam, lParam);
|
||||||
break;
|
break;
|
||||||
|
@ -1352,7 +1757,7 @@ GuiConsoleNotifyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
NewWindow = CreateWindowW(L"ConsoleWindowClass",
|
NewWindow = CreateWindowW(L"ConsoleWindowClass",
|
||||||
Title,
|
Title,
|
||||||
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, // | WS_HSCROLL | WS_VSCROLL,
|
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, //WS_OVERLAPPEDWINDOW
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
|
@ -1367,8 +1772,8 @@ GuiConsoleNotifyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
if (NULL != NewWindow)
|
if (NULL != NewWindow)
|
||||||
{
|
{
|
||||||
//ShowScrollBar(NewWindow, SB_VERT, FALSE);
|
// scrollbar support
|
||||||
//ShowScrollBar(NewWindow, SB_HORZ, FALSE);
|
//GuiConsoleCreateScrollBar(Console, (PGUI_CONSOLE_DATA)Console->PrivateData, NewWindow);
|
||||||
SetWindowLongW(hWnd, GWL_USERDATA, GetWindowLongW(hWnd, GWL_USERDATA) + 1);
|
SetWindowLongW(hWnd, GWL_USERDATA, GetWindowLongW(hWnd, GWL_USERDATA) + 1);
|
||||||
ShowWindow(NewWindow, SW_SHOW);
|
ShowWindow(NewWindow, SW_SHOW);
|
||||||
}
|
}
|
||||||
|
@ -1489,7 +1894,7 @@ GuiInit(VOID)
|
||||||
static VOID STDCALL
|
static VOID STDCALL
|
||||||
GuiInitScreenBuffer(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buffer)
|
GuiInitScreenBuffer(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buffer)
|
||||||
{
|
{
|
||||||
Buffer->DefaultAttrib = 0x0f;
|
Buffer->DefaultAttrib = DEFAULT_ATTRIB;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL STDCALL
|
static BOOL STDCALL
|
||||||
|
|
|
@ -36,6 +36,15 @@
|
||||||
#define IDS_DEFAULTS 211
|
#define IDS_DEFAULTS 211
|
||||||
#define IDS_PROPERTIES 212
|
#define IDS_PROPERTIES 212
|
||||||
|
|
||||||
|
//scrollbar resource ids
|
||||||
|
#define IDS_SCROLLHERE 304
|
||||||
|
#define IDS_SCROLLTOP 305
|
||||||
|
#define IDS_SCROLLBOTTOM 306
|
||||||
|
#define IDS_SCROLLPAGE_UP 307
|
||||||
|
#define IDS_SCROLLPAGE_DOWN 308
|
||||||
|
#define IDS_SCROLLUP 309
|
||||||
|
#define IDS_SCROLLDOWN 310
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* WIN32CSR_RESOURCE_H_INCLUDED */
|
#endif /* WIN32CSR_RESOURCE_H_INCLUDED */
|
||||||
|
|
|
@ -48,7 +48,7 @@ TuiInit(VOID)
|
||||||
static VOID STDCALL
|
static VOID STDCALL
|
||||||
TuiInitScreenBuffer(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buffer)
|
TuiInitScreenBuffer(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buffer)
|
||||||
{
|
{
|
||||||
Buffer->DefaultAttrib = 0x17;
|
Buffer->DefaultAttrib = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | BACKGROUND_BLUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FASTCALL
|
static void FASTCALL
|
||||||
|
|
|
@ -27,4 +27,6 @@
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
/* shared header with console.dll */
|
||||||
|
#include "console.h"
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<include base="csrss">include</include>
|
<include base="csrss">include</include>
|
||||||
<include base="ReactOS">include/reactos/subsys</include>
|
<include base="ReactOS">include/reactos/subsys</include>
|
||||||
<include base="ReactOS">include/reactos/drivers</include>
|
<include base="ReactOS">include/reactos/drivers</include>
|
||||||
|
<include base="console">.</include>
|
||||||
<define name="_DISABLE_TIDENTS" />
|
<define name="_DISABLE_TIDENTS" />
|
||||||
<define name="__USE_W32API" />
|
<define name="__USE_W32API" />
|
||||||
<define name="_WIN32_WINNT">0x0501</define>
|
<define name="_WIN32_WINNT">0x0501</define>
|
||||||
|
|
Loading…
Reference in a new issue