- Remove unneeded old commented code chunks.
- ConDllInitialize can set the current console locale for new threads,...
- ... and it can do its own cleaning.
svn path=/branches/condrv_restructure/; revision=64098
* PROJECT: ReactOS system libraries
* FILE: dll/win32/kernel32/client/console/console.c
* PURPOSE: Win32 server console functions
- * PROGRAMMERS: James Tabor
- * <jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net>
+ * PROGRAMMERS: James Tabor <jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net>
+ * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
*/
/* INCLUDES *******************************************************************/
/* Initialize Console Ctrl Handling */
InitializeCtrlHandling();
+ /* Sets the current console locale for this thread */
SetTEBLangID(lcid);
}
/* Initialize Console Ctrl Handling */
InitializeCtrlHandling();
+ /* Sets the current console locale for this thread */
SetTEBLangID(lcid);
}
ULONG Size = (Unicode ? wcslen(String) : strlen(String)) * sizeof(WCHAR);
return (Size + 3) & ~3;
}
-
-
-/* Copy a string to a capture buffer */
-static VOID
-IntCaptureMessageString(PCSR_CAPTURE_BUFFER CaptureBuffer,
- LPCVOID String,
- BOOL Unicode,
- PUNICODE_STRING RequestString)
-{
- ULONG Size;
- if (Unicode)
- {
- Size = wcslen(String) * sizeof(WCHAR);
- CsrCaptureMessageBuffer(CaptureBuffer, (PVOID)String, Size, (PVOID *)&RequestString->Buffer);
- }
- else
- {
- Size = strlen(String);
- CsrAllocateMessagePointer(CaptureBuffer, Size * sizeof(WCHAR), (PVOID *)&RequestString->Buffer);
- Size = MultiByteToWideChar(CP_ACP, 0, String, Size, RequestString->Buffer, Size * sizeof(WCHAR))
- * sizeof(WCHAR);
- }
- RequestString->Length = RequestString->MaximumLength = (USHORT)Size;
-}
#endif
static VOID
return;
}
- // IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
- // &ExpungeCommandHistoryRequest->ExeName);
CsrCaptureMessageBuffer(CaptureBuffer,
(PVOID)lpExeName,
ExpungeCommandHistoryRequest->ExeLength,
return 0;
}
- // IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
- // &GetCommandHistoryRequest->ExeName);
CsrCaptureMessageBuffer(CaptureBuffer,
(PVOID)lpExeName,
GetCommandHistoryRequest->ExeLength,
(PVOID)&GetCommandHistoryRequest->ExeName);
- // CsrAllocateMessagePointer(CaptureBuffer, HistoryLength,
CsrAllocateMessagePointer(CaptureBuffer, GetCommandHistoryRequest->HistoryLength,
(PVOID*)&GetCommandHistoryRequest->History);
return 0;
}
- // IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
- // &GetCommandHistoryLengthRequest->ExeName);
CsrCaptureMessageBuffer(CaptureBuffer,
(PVOID)lpExeName,
GetCommandHistoryLengthRequest->ExeLength,
return FALSE;
}
- // IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
- // &SetHistoryNumberCommandsRequest->ExeName);
CsrCaptureMessageBuffer(CaptureBuffer,
(PVOID)lpExeName,
SetHistoryNumberCommandsRequest->ExeLength,
extern HANDLE InputWaitHandle;
-static HMODULE ConsoleLibrary = NULL;
+static HMODULE ConsoleApplet = NULL;
static BOOL AlreadyDisplayingProps = FALSE;
static const PWSTR DefaultConsoleTitle = L"ReactOS Console";
AlreadyDisplayingProps = TRUE;
/* Load the Control Applet if needed */
- if (ConsoleLibrary == NULL)
+ if (ConsoleApplet == NULL)
{
WCHAR szBuffer[MAX_PATH];
GetSystemDirectoryW(szBuffer, MAX_PATH);
wcscat(szBuffer, L"\\console.dll");
- ConsoleLibrary = LoadLibraryW(szBuffer);
- if (ConsoleLibrary == NULL)
+ ConsoleApplet = LoadLibraryW(szBuffer);
+ if (ConsoleApplet == NULL)
{
DPRINT1("Failed to load console.dll\n");
Status = STATUS_UNSUCCESSFUL;
}
/* Load its main function */
- CPLFunc = (APPLET_PROC)GetProcAddress(ConsoleLibrary, "CPlApplet");
+ CPLFunc = (APPLET_PROC)GetProcAddress(ConsoleApplet, "CPlApplet");
if (CPLFunc == NULL)
{
DPRINT1("Error: Console.dll misses CPlApplet export\n");
/* We got the handles, let's set them */
Parameters->ConsoleHandle = ConsoleStartInfo->ConsoleHandle;
- if (!(ConsoleStartInfo->dwStartupFlags & STARTF_USESTDHANDLES))
+ if ((ConsoleStartInfo->dwStartupFlags & STARTF_USESTDHANDLES) == 0)
{
Parameters->StandardInput = ConsoleStartInfo->InputHandle;
Parameters->StandardOutput = ConsoleStartInfo->OutputHandle;
if (Reason != DLL_PROCESS_ATTACH)
{
- if (Reason != DLL_THREAD_ATTACH || !IsConsoleApp())
- return TRUE;
+ if ((Reason == DLL_THREAD_ATTACH) && IsConsoleApp())
+ {
+ /* Sets the current console locale for the new thread */
+ SetTEBLangID(lcid);
+ }
+ else if (Reason == DLL_PROCESS_DETACH)
+ {
+ /* Free our resources */
+ if (ConsoleInitialized == TRUE)
+ {
+ if (ConsoleApplet) FreeLibrary(ConsoleApplet);
+
+ ConsoleInitialized = FALSE;
+ RtlDeleteCriticalSection(&ConsoleLock);
+ }
+ }
- // Reason == DLL_THREAD_ATTACH and IsConsoleApp;
- goto Exit;
+ return TRUE;
}
DPRINT("ConDllInitialize for: %wZ\n"
SetUpHandles(&ConnectInfo.ConsoleStartInfo);
InputWaitHandle = ConnectInfo.ConsoleStartInfo.InputWaitHandle;
-Exit:
+
+ /* Sets the current console locale for this thread */
SetTEBLangID(lcid);
}
return TRUE;
}
-
-VOID
-WINAPI
-BasepUninitConsole(VOID)
-{
- /* Delete our critical section if we were initialized */
- if (ConsoleInitialized == TRUE)
- {
- if (ConsoleLibrary) FreeLibrary(ConsoleLibrary);
-
- ConsoleInitialized = FALSE;
- RtlDeleteCriticalSection(&ConsoleLock);
- }
-}
-
/* EOF */
}
_SEH2_END;
- /* Check for sanity */
+ /* FIXME: Check for sanity */
/*
if (!NT_SUCCESS(Status) && pInputControl)
{
* Read functions *
******************/
-/*--------------------------------------------------------------
- * ReadConsoleW
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * ReadConsoleA
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * PeekConsoleInputW
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * PeekConsoleInputA
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * ReadConsoleInputW
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * ReadConsoleInputA
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * ReadConsoleInputExW
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * ReadConsoleInputExA
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * ReadConsoleOutputW
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * ReadConsoleOutputA
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * ReadConsoleOutputCharacterW
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * ReadConsoleOutputCharacterA
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * ReadConsoleOutputAttribute
- *
+/*
* @implemented
*/
BOOL
* Write functions *
*******************/
-/*--------------------------------------------------------------
- * WriteConsoleW
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * WriteConsoleA
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * WriteConsoleInputW
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * WriteConsoleInputA
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * WriteConsoleInputVDMW
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * WriteConsoleInputVDMA
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * WriteConsoleOutputW
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * WriteConsoleOutputA
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * WriteConsoleOutputCharacterW
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * WriteConsoleOutputCharacterA
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * WriteConsoleOutputAttribute
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * FillConsoleOutputCharacterW
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * FillConsoleOutputCharacterA
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * FillConsoleOutputAttribute
- *
+/*
* @implemented
*/
BOOL
#if _WIN32_WINNT >= 0x600
-/*--------------------------------------------------------------
- * GetConsoleHistoryInfo
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * SetConsoleHistoryInfo
- *
+/*
* @implemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * GetConsoleOriginalTitleW
- *
+/*
* @unimplemented
*/
DWORD
}
-/*--------------------------------------------------------------
- * GetConsoleOriginalTitleA
- *
+/*
* @unimplemented
*/
DWORD
}
-/*--------------------------------------------------------------
- * GetConsoleScreenBufferInfoEx
- *
+/*
* @unimplemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * SetConsoleScreenBufferInfoEx
- *
+/*
* @unimplemented
*/
BOOL
}
-/*--------------------------------------------------------------
- * GetCurrentConsoleFontEx
- *
+/*
* @unimplemented
*/
BOOL
{
if (DllInitialized == TRUE)
{
+ /* Uninitialize console support */
+ ConDllInitialize(dwReason, NULL);
+
/* Insert more dll detach stuff here! */
NlsUninit();
- /* Uninitialize console support */
- BasepUninitConsole();
-
/* Delete DLL critical section */
RtlDeleteCriticalSection(&BaseDllDirectoryLock);
}
break;
}
+ case DLL_THREAD_ATTACH:
+ {
+ /* ConDllInitialize sets the current console locale for the new thread */
+ return ConDllInitialize(dwReason, NULL);
+ }
+
default:
break;
}
ConDllInitialize(IN ULONG Reason,
IN PWSTR SessionDir);
-VOID
-WINAPI
-BasepUninitConsole(VOID);
-
VOID
InitializeCtrlHandling(VOID);