Author: hbelusca Date: Tue Sep 9 21:24:44 2014 New Revision: 64098
URL: http://svn.reactos.org/svn/reactos?rev=64098&view=rev Log: [KERNEL32] - Remove unneeded old commented code chunks. - ConDllInitialize can set the current console locale for new threads,... - ... and it can do its own cleaning.
Modified: branches/condrv_restructure/dll/win32/kernel32/client/console/console.c branches/condrv_restructure/dll/win32/kernel32/client/console/history.c branches/condrv_restructure/dll/win32/kernel32/client/console/init.c branches/condrv_restructure/dll/win32/kernel32/client/console/readwrite.c branches/condrv_restructure/dll/win32/kernel32/client/console/vista.c branches/condrv_restructure/dll/win32/kernel32/client/dllmain.c branches/condrv_restructure/dll/win32/kernel32/include/console.h
Modified: branches/condrv_restructure/dll/win32/kernel32/client/console/console.c URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/dll/win32/ker... ============================================================================== --- branches/condrv_restructure/dll/win32/kernel32/client/console/console.c [iso-8859-1] (original) +++ branches/condrv_restructure/dll/win32/kernel32/client/console/console.c [iso-8859-1] Tue Sep 9 21:24:44 2014 @@ -3,8 +3,8 @@ * 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 *******************************************************************/ @@ -1316,6 +1316,7 @@ /* Initialize Console Ctrl Handling */ InitializeCtrlHandling();
+ /* Sets the current console locale for this thread */ SetTEBLangID(lcid); }
@@ -2578,6 +2579,7 @@ /* Initialize Console Ctrl Handling */ InitializeCtrlHandling();
+ /* Sets the current console locale for this thread */ SetTEBLangID(lcid); }
Modified: branches/condrv_restructure/dll/win32/kernel32/client/console/history.c URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/dll/win32/ker... ============================================================================== --- branches/condrv_restructure/dll/win32/kernel32/client/console/history.c [iso-8859-1] (original) +++ branches/condrv_restructure/dll/win32/kernel32/client/console/history.c [iso-8859-1] Tue Sep 9 21:24:44 2014 @@ -25,30 +25,6 @@ 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 @@ -80,8 +56,6 @@ return; }
- // IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode, - // &ExpungeCommandHistoryRequest->ExeName); CsrCaptureMessageBuffer(CaptureBuffer, (PVOID)lpExeName, ExpungeCommandHistoryRequest->ExeLength, @@ -131,14 +105,11 @@ 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);
@@ -192,8 +163,6 @@ return 0; }
- // IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode, - // &GetCommandHistoryLengthRequest->ExeName); CsrCaptureMessageBuffer(CaptureBuffer, (PVOID)lpExeName, GetCommandHistoryLengthRequest->ExeLength, @@ -248,8 +217,6 @@ return FALSE; }
- // IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode, - // &SetHistoryNumberCommandsRequest->ExeName); CsrCaptureMessageBuffer(CaptureBuffer, (PVOID)lpExeName, SetHistoryNumberCommandsRequest->ExeLength,
Modified: branches/condrv_restructure/dll/win32/kernel32/client/console/init.c URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/dll/win32/ker... ============================================================================== --- branches/condrv_restructure/dll/win32/kernel32/client/console/init.c [iso-8859-1] (original) +++ branches/condrv_restructure/dll/win32/kernel32/client/console/init.c [iso-8859-1] Tue Sep 9 21:24:44 2014 @@ -26,7 +26,7 @@
extern HANDLE InputWaitHandle;
-static HMODULE ConsoleLibrary = NULL; +static HMODULE ConsoleApplet = NULL; static BOOL AlreadyDisplayingProps = FALSE;
static const PWSTR DefaultConsoleTitle = L"ReactOS Console"; @@ -60,14 +60,14 @@ 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; @@ -76,7 +76,7 @@ }
/* 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"); @@ -261,7 +261,7 @@ /* 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; @@ -345,11 +345,24 @@
if (Reason != DLL_PROCESS_ATTACH) { - if (Reason != DLL_THREAD_ATTACH || !IsConsoleApp()) - return TRUE; - - // Reason == DLL_THREAD_ATTACH and IsConsoleApp; - goto Exit; + 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); + } + } + + return TRUE; }
DPRINT("ConDllInitialize for: %wZ\n" @@ -509,7 +522,8 @@ SetUpHandles(&ConnectInfo.ConsoleStartInfo);
InputWaitHandle = ConnectInfo.ConsoleStartInfo.InputWaitHandle; -Exit: + + /* Sets the current console locale for this thread */ SetTEBLangID(lcid); }
@@ -522,19 +536,4 @@ 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 */
Modified: branches/condrv_restructure/dll/win32/kernel32/client/console/readwrite.c URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/dll/win32/ker... ============================================================================== --- branches/condrv_restructure/dll/win32/kernel32/client/console/readwrite.c [iso-8859-1] (original) +++ branches/condrv_restructure/dll/win32/kernel32/client/console/readwrite.c [iso-8859-1] Tue Sep 9 21:24:44 2014 @@ -163,7 +163,7 @@ } _SEH2_END;
- /* Check for sanity */ + /* FIXME: Check for sanity */ /* if (!NT_SUCCESS(Status) && pInputControl) { @@ -1167,9 +1167,7 @@ * Read functions * ******************/
-/*-------------------------------------------------------------- - * ReadConsoleW - * +/* * @implemented */ BOOL @@ -1189,9 +1187,7 @@ }
-/*-------------------------------------------------------------- - * ReadConsoleA - * +/* * @implemented */ BOOL @@ -1211,9 +1207,7 @@ }
-/*-------------------------------------------------------------- - * PeekConsoleInputW - * +/* * @implemented */ BOOL @@ -1232,9 +1226,7 @@ }
-/*-------------------------------------------------------------- - * PeekConsoleInputA - * +/* * @implemented */ BOOL @@ -1253,9 +1245,7 @@ }
-/*-------------------------------------------------------------- - * ReadConsoleInputW - * +/* * @implemented */ BOOL @@ -1274,9 +1264,7 @@ }
-/*-------------------------------------------------------------- - * ReadConsoleInputA - * +/* * @implemented */ BOOL @@ -1295,9 +1283,7 @@ }
-/*-------------------------------------------------------------- - * ReadConsoleInputExW - * +/* * @implemented */ BOOL @@ -1317,9 +1303,7 @@ }
-/*-------------------------------------------------------------- - * ReadConsoleInputExA - * +/* * @implemented */ BOOL @@ -1339,9 +1323,7 @@ }
-/*-------------------------------------------------------------- - * ReadConsoleOutputW - * +/* * @implemented */ BOOL @@ -1361,9 +1343,7 @@ }
-/*-------------------------------------------------------------- - * ReadConsoleOutputA - * +/* * @implemented */ BOOL @@ -1383,9 +1363,7 @@ }
-/*-------------------------------------------------------------- - * ReadConsoleOutputCharacterW - * +/* * @implemented */ BOOL @@ -1405,9 +1383,7 @@ }
-/*-------------------------------------------------------------- - * ReadConsoleOutputCharacterA - * +/* * @implemented */ BOOL @@ -1427,9 +1403,7 @@ }
-/*-------------------------------------------------------------- - * ReadConsoleOutputAttribute - * +/* * @implemented */ BOOL @@ -1453,9 +1427,7 @@ * Write functions * *******************/
-/*-------------------------------------------------------------- - * WriteConsoleW - * +/* * @implemented */ BOOL @@ -1475,9 +1447,7 @@ }
-/*-------------------------------------------------------------- - * WriteConsoleA - * +/* * @implemented */ BOOL @@ -1497,9 +1467,7 @@ }
-/*-------------------------------------------------------------- - * WriteConsoleInputW - * +/* * @implemented */ BOOL @@ -1518,9 +1486,7 @@ }
-/*-------------------------------------------------------------- - * WriteConsoleInputA - * +/* * @implemented */ BOOL @@ -1539,9 +1505,7 @@ }
-/*-------------------------------------------------------------- - * WriteConsoleInputVDMW - * +/* * @implemented */ BOOL @@ -1560,9 +1524,7 @@ }
-/*-------------------------------------------------------------- - * WriteConsoleInputVDMA - * +/* * @implemented */ BOOL @@ -1581,9 +1543,7 @@ }
-/*-------------------------------------------------------------- - * WriteConsoleOutputW - * +/* * @implemented */ BOOL @@ -1603,9 +1563,7 @@ }
-/*-------------------------------------------------------------- - * WriteConsoleOutputA - * +/* * @implemented */ BOOL @@ -1625,9 +1583,7 @@ }
-/*-------------------------------------------------------------- - * WriteConsoleOutputCharacterW - * +/* * @implemented */ BOOL @@ -1647,9 +1603,7 @@ }
-/*-------------------------------------------------------------- - * WriteConsoleOutputCharacterA - * +/* * @implemented */ BOOL @@ -1669,9 +1623,7 @@ }
-/*-------------------------------------------------------------- - * WriteConsoleOutputAttribute - * +/* * @implemented */ BOOL @@ -1691,9 +1643,7 @@ }
-/*-------------------------------------------------------------- - * FillConsoleOutputCharacterW - * +/* * @implemented */ BOOL @@ -1715,9 +1665,7 @@ }
-/*-------------------------------------------------------------- - * FillConsoleOutputCharacterA - * +/* * @implemented */ BOOL @@ -1739,9 +1687,7 @@ }
-/*-------------------------------------------------------------- - * FillConsoleOutputAttribute - * +/* * @implemented */ BOOL
Modified: branches/condrv_restructure/dll/win32/kernel32/client/console/vista.c URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/dll/win32/ker... ============================================================================== --- branches/condrv_restructure/dll/win32/kernel32/client/console/vista.c [iso-8859-1] (original) +++ branches/condrv_restructure/dll/win32/kernel32/client/console/vista.c [iso-8859-1] Tue Sep 9 21:24:44 2014 @@ -18,9 +18,7 @@
#if _WIN32_WINNT >= 0x600
-/*-------------------------------------------------------------- - * GetConsoleHistoryInfo - * +/* * @implemented */ BOOL @@ -55,9 +53,7 @@ }
-/*-------------------------------------------------------------- - * SetConsoleHistoryInfo - * +/* * @implemented */ BOOL @@ -92,9 +88,7 @@ }
-/*-------------------------------------------------------------- - * GetConsoleOriginalTitleW - * +/* * @unimplemented */ DWORD @@ -108,9 +102,7 @@ }
-/*-------------------------------------------------------------- - * GetConsoleOriginalTitleA - * +/* * @unimplemented */ DWORD @@ -124,9 +116,7 @@ }
-/*-------------------------------------------------------------- - * GetConsoleScreenBufferInfoEx - * +/* * @unimplemented */ BOOL @@ -140,9 +130,7 @@ }
-/*-------------------------------------------------------------- - * SetConsoleScreenBufferInfoEx - * +/* * @unimplemented */ BOOL @@ -156,9 +144,7 @@ }
-/*-------------------------------------------------------------- - * GetCurrentConsoleFontEx - * +/* * @unimplemented */ BOOL
Modified: branches/condrv_restructure/dll/win32/kernel32/client/dllmain.c URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/dll/win32/ker... ============================================================================== --- branches/condrv_restructure/dll/win32/kernel32/client/dllmain.c [iso-8859-1] (original) +++ branches/condrv_restructure/dll/win32/kernel32/client/dllmain.c [iso-8859-1] Tue Sep 9 21:24:44 2014 @@ -219,16 +219,22 @@ { 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:
Modified: branches/condrv_restructure/dll/win32/kernel32/include/console.h URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/dll/win32/ker... ============================================================================== --- branches/condrv_restructure/dll/win32/kernel32/include/console.h [iso-8859-1] (original) +++ branches/condrv_restructure/dll/win32/kernel32/include/console.h [iso-8859-1] Tue Sep 9 21:24:44 2014 @@ -25,10 +25,6 @@ WINAPI ConDllInitialize(IN ULONG Reason, IN PWSTR SessionDir); - -VOID -WINAPI -BasepUninitConsole(VOID);
VOID InitializeCtrlHandling(VOID);