ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
January 2013
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
11 participants
185 discussions
Start a n
N
ew thread
[hbelusca] 58107: [WIN32K] - Start to implement NtUserConsoleControl to allow the console server define Console Window Class atom. - In UserInitialize, initialize the current thread by a call to Us...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Fri Jan 4 00:41:10 2013 New Revision: 58107 URL:
http://svn.reactos.org/svn/reactos?rev=58107&view=rev
Log: [WIN32K] - Start to implement NtUserConsoleControl to allow the console server define Console Window Class atom. - In UserInitialize, initialize the current thread by a call to UserCreateThreadInfo. - In UserCreateThreadInfo, set the TIF_CSRSSTHREAD flag for threads created by CSRSS. - In NtUserQueryWindow, when querying the process/thread ID associated to a given window, check whether the window was created by CSRSS and if so, if this is a Console window, get the process/thread ID of the associated console process (console leader process), instead of the CID of CSRSS. [CONSRV] - Introduce the concept of console leader process (to be used as the process owning the console window). - Introduce extra console window information to store the PID and TID of the console leader process via new internal flags to be used by GetWindowLong. - Effectively set the console window console leader CID at its creation. - Improve CsrInitConsole to set a console leader process to the console being created. This fixes
http://jira.reactos.org/browse/CORE-122
in this branch. [CONSRV-WIN32K] Fix various code misspellings. Modified: branches/ros-csrss/win32ss/include/ntuser.h branches/ros-csrss/win32ss/user/consrv/conio.h branches/ros-csrss/win32ss/user/consrv/console.c branches/ros-csrss/win32ss/user/consrv/consrv.h branches/ros-csrss/win32ss/user/consrv/guiconsole.c branches/ros-csrss/win32ss/user/consrv/handle.c branches/ros-csrss/win32ss/user/consrv/tuiconsole.c branches/ros-csrss/win32ss/user/ntuser/main.c branches/ros-csrss/win32ss/user/ntuser/ntstubs.c branches/ros-csrss/win32ss/user/ntuser/ntuser.c branches/ros-csrss/win32ss/user/ntuser/ntuser.h branches/ros-csrss/win32ss/user/ntuser/userfuncs.h branches/ros-csrss/win32ss/user/ntuser/window.c branches/ros-csrss/win32ss/user/ntuser/winsta.c branches/ros-csrss/win32ss/user/ntuser/winsta.h Modified: branches/ros-csrss/win32ss/include/ntuser.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/include/ntuse…
============================================================================== --- branches/ros-csrss/win32ss/include/ntuser.h [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/include/ntuser.h [iso-8859-1] Fri Jan 4 00:41:10 2013 @@ -1562,12 +1562,19 @@ NtUserCloseWindowStation( HWINSTA hWinSta); -DWORD -NTAPI +/* Console commands for NtUserConsoleControl */ +typedef enum _CONSOLECONTROL +{ + GuiConsoleWndClassAtom, + TuiConsoleWndClassAtom, +} CONSOLECONTROL, *PCONSOLECONTROL; + +NTSTATUS +APIENTRY NtUserConsoleControl( - DWORD dwUnknown1, - DWORD dwUnknown2, - DWORD dwUnknown3); + IN CONSOLECONTROL ConsoleCtrl, + IN PVOID ConsoleCtrlInfo, + IN DWORD ConsoleCtrlInfoLength); HANDLE NTAPI Modified: branches/ros-csrss/win32ss/user/consrv/conio.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] Fri Jan 4 00:41:10 2013 @@ -50,6 +50,7 @@ struct tagCSRSS_CONSOLE *Prev, *Next; /* Next and Prev consoles in console wheel */ struct tagCSRSS_CONSOLE_VTBL *Vtbl; /* Using CUI or GUI consoles */ + CLIENT_ID ConsoleLeaderCID; /* Contains the Console Leader Process CID */ LIST_ENTRY ProcessList; LIST_ENTRY InputEvents; /* List head for input event queue */ @@ -89,6 +90,19 @@ CONSOLE_SELECTION_INFO Selection; } CSRSS_CONSOLE, *PCSRSS_CONSOLE; + +/**************************************************************\ +\** Define the Console Leader Process for the console window **/ +#define GWLP_CONSOLEWND_ALLOC (2 * sizeof(LONG_PTR)) +#define GWLP_CONSOLE_LEADER_PID 0 +#define GWLP_CONSOLE_LEADER_TID 4 + +#define SetConsoleWndConsoleLeaderCID(Console) \ +do { \ + SetWindowLongPtrW((Console)->hWindow, GWLP_CONSOLE_LEADER_PID, (LONG_PTR)((Console)->ConsoleLeaderCID.UniqueProcess)); \ + SetWindowLongPtrW((Console)->hWindow, GWLP_CONSOLE_LEADER_TID, (LONG_PTR)((Console)->ConsoleLeaderCID.UniqueThread )); \ +} while(0) +/**************************************************************/ typedef struct tagCSRSS_CONSOLE_VTBL { @@ -146,6 +160,7 @@ PCSRSS_CONSOLE *Console); VOID WINAPI ConioDeleteConsole(PCSRSS_CONSOLE Console); VOID WINAPI CsrInitConsoleSupport(VOID); +NTSTATUS WINAPI CsrInitConsole(PCSRSS_CONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLeaderProcess); VOID FASTCALL ConioPause(PCSRSS_CONSOLE Console, UINT Flags); VOID FASTCALL ConioUnpause(PCSRSS_CONSOLE Console, UINT Flags); VOID FASTCALL ConioConsoleCtrlEvent(DWORD Event, PCONSOLE_PROCESS_DATA ProcessData); Modified: branches/ros-csrss/win32ss/user/consrv/console.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] Fri Jan 4 00:41:10 2013 @@ -87,8 +87,8 @@ ConioConsoleCtrlEventTimeout(Event, ProcessData, 0); } -/* static */ NTSTATUS WINAPI -CsrInitConsole(PCSRSS_CONSOLE* NewConsole, int ShowCmd) +NTSTATUS WINAPI +CsrInitConsole(PCSRSS_CONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLeaderProcess) { NTSTATUS Status; SECURITY_ATTRIBUTES SecurityAttributes; @@ -127,6 +127,7 @@ Console->Header.Type = CONIO_CONSOLE_MAGIC; Console->Header.Console = Console; Console->Mode = ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT; + Console->ConsoleLeaderCID = ConsoleLeaderProcess->ClientId; InitializeListHead(&Console->ProcessList); InitializeListHead(&Console->BufferList); Console->ActiveBuffer = NULL; @@ -292,7 +293,8 @@ { NTSTATUS Status = STATUS_SUCCESS; PCSRSS_ALLOC_CONSOLE AllocConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.AllocConsoleRequest; - PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + PCSR_PROCESS ConsoleLeader = CsrGetClientThread()->Process; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(ConsoleLeader); DPRINT("SrvAllocConsole\n"); @@ -306,8 +308,8 @@ DPRINT1("SrvAllocConsole - Checkpoint 1\n"); - /* Initialize a new Console */ - Status = CsrInitConsole(&ProcessData->Console, AllocConsoleRequest->ShowCmd); + /* Initialize a new Console owned by the Console Leader Process */ + Status = CsrInitConsole(&ProcessData->Console, AllocConsoleRequest->ShowCmd, ConsoleLeader); if (!NT_SUCCESS(Status)) { DPRINT1("Console initialization failed\n"); Modified: branches/ros-csrss/win32ss/user/consrv/consrv.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/consrv.h [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/consrv.h [iso-8859-1] Fri Jan 4 00:41:10 2013 @@ -16,6 +16,9 @@ #include <windows.h> #define NTOS_MODE_USER #include <ndk/ntndk.h> + +/* Public Win32K Headers */ +#include <ntuser.h> /* CSRSS Header */ #include <csr/csrsrv.h> Modified: branches/ros-csrss/win32ss/user/consrv/guiconsole.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/g…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/guiconsole.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/guiconsole.c [iso-8859-1] Fri Jan 4 00:41:10 2013 @@ -12,11 +12,13 @@ #include "guiconsole.h" #include <psapi.h> -/* Public Win32K Headers */ -#include <ntuser.h> - #define NDEBUG #include <debug.h> + + +/* GUI Console Window Class name */ +#define GUI_CONSOLE_WINDOW_CLASS L"ConsoleWindowClass" + /* Not defined in any header file */ // extern VOID WINAPI PrivateCsrssManualGuiCheck(LONG Check); @@ -194,7 +196,7 @@ static VOID GuiConsoleGetDataPointers(HWND hWnd, PCSRSS_CONSOLE *Console, PGUI_CONSOLE_DATA *GuiData) { - *Console = (PCSRSS_CONSOLE) GetWindowLongPtrW(hWnd, GWL_USERDATA); + *Console = (PCSRSS_CONSOLE)GetWindowLongPtrW(hWnd, GWLP_USERDATA); *GuiData = (NULL == *Console ? NULL : (*Console)->PrivateData); } @@ -693,9 +695,9 @@ } static BOOL -GuiConsoleHandleNcCreate(HWND hWnd, CREATESTRUCTW *Create) -{ - PCSRSS_CONSOLE Console = (PCSRSS_CONSOLE) Create->lpCreateParams; +GuiConsoleHandleNcCreate(HWND hWnd, LPCREATESTRUCTW Create) +{ + PCSRSS_CONSOLE Console = (PCSRSS_CONSOLE)Create->lpCreateParams; PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)Console->PrivateData; HDC Dc; HFONT OldFont; @@ -788,7 +790,7 @@ DPRINT("Console %p GuiData %p\n", Console, GuiData); Console->PrivateData = GuiData; - SetWindowLongPtrW(hWnd, GWL_USERDATA, (DWORD_PTR) Console); + SetWindowLongPtrW(hWnd, GWLP_USERDATA, (DWORD_PTR)Console); SetTimer(hWnd, CONGUI_UPDATE_TIMER, CONGUI_UPDATE_TIME, NULL); GuiConsoleCreateSysMenu(Console); @@ -1512,7 +1514,6 @@ } - static VOID GuiConsoleShowConsoleProperties(HWND hWnd, BOOL Defaults, PGUI_CONSOLE_DATA GuiData) { @@ -2004,7 +2005,7 @@ switch(msg) { case WM_NCCREATE: - Result = (LRESULT) GuiConsoleHandleNcCreate(hWnd, (CREATESTRUCTW *) lParam); + Result = (LRESULT) GuiConsoleHandleNcCreate(hWnd, (LPCREATESTRUCTW)lParam); break; case WM_PAINT: GuiConsoleHandlePaint(hWnd, (HDC)wParam); @@ -2073,8 +2074,6 @@ MSG Msg; PWCHAR Buffer, Title; PCSRSS_CONSOLE Console = (PCSRSS_CONSOLE) lParam; - - switch(msg) { @@ -2095,7 +2094,7 @@ Title = L""; } NewWindow = CreateWindowExW(WS_EX_CLIENTEDGE, - L"ConsoleWindowClass", + GUI_CONSOLE_WINDOW_CLASS, Title, WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT, @@ -2104,18 +2103,19 @@ CW_USEDEFAULT, NULL, NULL, - (HINSTANCE) GetModuleHandleW(NULL), - (PVOID) Console); + (HINSTANCE)GetModuleHandleW(NULL), + (PVOID)Console); if (NULL != Buffer) { HeapFree(ConSrvHeap, 0, Buffer); } if (NULL != NewWindow) { + SetConsoleWndConsoleLeaderCID(Console); SetWindowLongW(hWnd, GWL_USERDATA, GetWindowLongW(hWnd, GWL_USERDATA) + 1); ShowWindow(NewWindow, (int)wParam); } - return (LRESULT) NewWindow; + return (LRESULT)NewWindow; case PM_DESTROY_CONSOLE: /* Window creation is done using a PostMessage(), so it's possible that the * window that we want to destroy doesn't exist yet. So first empty the message @@ -2182,6 +2182,7 @@ GuiInit(VOID) { WNDCLASSEXW wc; + ATOM ConsoleClassAtom; if (NULL == NotifyWnd) { @@ -2202,12 +2203,12 @@ wc.hIconSm = NULL; if (RegisterClassExW(&wc) == 0) { - DPRINT1("Failed to register notify wndproc\n"); + DPRINT1("Failed to register GUI notify wndproc\n"); return FALSE; } wc.cbSize = sizeof(WNDCLASSEXW); - wc.lpszClassName = L"ConsoleWindowClass"; + wc.lpszClassName = GUI_CONSOLE_WINDOW_CLASS; wc.lpfnWndProc = GuiConsoleWndProc; wc.style = 0; wc.hInstance = (HINSTANCE)GetModuleHandleW(NULL); @@ -2216,14 +2217,20 @@ wc.hbrBackground = CreateSolidBrush(RGB(0,0,0)); wc.lpszMenuName = NULL; wc.cbClsExtra = 0; - wc.cbWndExtra = 0; + wc.cbWndExtra = GWLP_CONSOLEWND_ALLOC; wc.hIconSm = LoadImageW(ConSrvDllInstance, MAKEINTRESOURCEW(1), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); - if (RegisterClassExW(&wc) == 0) - { - DPRINT1("Failed to register console wndproc\n"); + + ConsoleClassAtom = RegisterClassExW(&wc); + if (ConsoleClassAtom == 0) + { + DPRINT1("Failed to register GUI console wndproc\n"); return FALSE; + } + else + { + NtUserConsoleControl(GuiConsoleWndClassAtom, &ConsoleClassAtom, sizeof(ATOM)); } return TRUE; @@ -2299,10 +2306,10 @@ HANDLE ThreadHandle; PGUI_CONSOLE_DATA GuiData; - if (! ConsInitialized) + if (!ConsInitialized) { ConsInitialized = TRUE; - if (! GuiInit()) + if (!GuiInit()) { ConsInitialized = FALSE; return STATUS_UNSUCCESSFUL; @@ -2310,6 +2317,7 @@ } Console->Vtbl = &GuiVtbl; + Console->hWindow = NULL; if (NULL == NotifyWnd) { GraphicsStartupEvent = CreateEventW(NULL, FALSE, FALSE, NULL); @@ -2321,7 +2329,7 @@ ThreadHandle = CreateThread(NULL, 0, GuiConsoleGuiThread, - (PVOID) &GraphicsStartupEvent, + (PVOID)&GraphicsStartupEvent, 0, NULL); if (NULL == ThreadHandle) @@ -2350,9 +2358,9 @@ return STATUS_UNSUCCESSFUL; } - Console->PrivateData = (PVOID) GuiData; + Console->PrivateData = (PVOID)GuiData; /* - * we need to wait untill the GUI has been fully initialized + * we need to wait until the GUI has been fully initialized * to retrieve custom settings i.e. WindowSize etc.. * Ideally we could use SendNotifyMessage for this but its not * yet implemented. @@ -2362,7 +2370,7 @@ /* create console */ PostMessageW(NotifyWnd, PM_CREATE_CONSOLE, ShowCmd, (LPARAM)Console); - /* wait untill initialization has finished */ + /* wait until initialization has finished */ WaitForSingleObject(GuiData->hGuiInitEvent, INFINITE); DPRINT("received event Console %p GuiData %p X %d Y %d\n", Console, Console->PrivateData, Console->Size.X, Console->Size.Y); CloseHandle(GuiData->hGuiInitEvent); Modified: branches/ros-csrss/win32ss/user/consrv/handle.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/h…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] Fri Jan 4 00:41:10 2013 @@ -321,9 +321,6 @@ return STATUS_SUCCESS; } -// Temporary ; move it to a header. -NTSTATUS WINAPI CsrInitConsole(PCSRSS_CONSOLE* NewConsole, int ShowCmd); - NTSTATUS NTAPI ConsoleConnect(IN PCSR_PROCESS CsrProcess, @@ -363,13 +360,11 @@ if (!ConnectInfo->Console || ConnectInfo->Console != ProcessData->ParentConsole) { - // PCSRSS_CONSOLE Console; - DPRINT1("ConsoleConnect - Allocate a new console\n"); - /* Initialize a new Console */ + /* Initialize a new Console owned by the Console Leader Process */ NewConsole = TRUE; - Status = CsrInitConsole(&ProcessData->Console, ConnectInfo->ShowCmd); + Status = CsrInitConsole(&ProcessData->Console, ConnectInfo->ShowCmd, CsrProcess); if (!NT_SUCCESS(Status)) { DPRINT1("Console initialization failed\n"); Modified: branches/ros-csrss/win32ss/user/consrv/tuiconsole.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/t…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/tuiconsole.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/tuiconsole.c [iso-8859-1] Fri Jan 4 00:41:10 2013 @@ -13,6 +13,11 @@ #define NDEBUG #include <debug.h> + +/* TUI Console Window Class name */ +#define TUI_CONSOLE_WINDOW_CLASS L"TuiConsoleWindowClass" + + CRITICAL_SECTION ActiveConsoleLock; static COORD PhysicalConsoleSize; static HANDLE ConsoleDeviceHandle; @@ -69,6 +74,7 @@ CONSOLE_SCREEN_BUFFER_INFO ScrInfo; DWORD BytesReturned; WNDCLASSEXW wc; + ATOM ConsoleClassAtom; USHORT TextAttribute = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED; TuiStartService(L"Blue"); @@ -98,8 +104,8 @@ ActiveConsole = NULL; InitializeCriticalSection(&ActiveConsoleLock); - if (! DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO, - NULL, 0, &ScrInfo, sizeof(ScrInfo), &BytesReturned, NULL)) + if (!DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO, + NULL, 0, &ScrInfo, sizeof(ScrInfo), &BytesReturned, NULL)) { DPRINT1("Failed to get console info\n"); return FALSE; @@ -108,13 +114,20 @@ RtlZeroMemory(&wc, sizeof(WNDCLASSEXW)); wc.cbSize = sizeof(WNDCLASSEXW); - wc.lpszClassName = L"TuiConsoleWindowClass"; + wc.lpszClassName = TUI_CONSOLE_WINDOW_CLASS; wc.lpfnWndProc = TuiConsoleWndProc; - wc.hInstance = (HINSTANCE) GetModuleHandleW(NULL); - if (RegisterClassExW(&wc) == 0) - { - DPRINT1("Failed to register console wndproc\n"); + wc.cbWndExtra = GWLP_CONSOLEWND_ALLOC; + wc.hInstance = (HINSTANCE)GetModuleHandleW(NULL); + + ConsoleClassAtom = RegisterClassExW(&wc); + if (ConsoleClassAtom == 0) + { + DPRINT1("Failed to register TUI console wndproc\n"); return FALSE; + } + else + { + NtUserConsoleControl(TuiConsoleWndClassAtom, &ConsoleClassAtom, sizeof(ATOM)); } return TRUE; @@ -179,8 +192,8 @@ TuiCopyRect((char *) (ConsoleDraw + 1), Buff, Region); - if (! DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_DRAW, - NULL, 0, ConsoleDraw, ConsoleDrawSize, &BytesReturned, NULL)) + if (!DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_DRAW, + NULL, 0, ConsoleDraw, ConsoleDrawSize, &BytesReturned, NULL)) { DPRINT1("Failed to draw console\n"); HeapFree(ConSrvHeap, 0, ConsoleDraw); @@ -222,8 +235,8 @@ Info.dwSize = ConioEffectiveCursorSize(Console, 100); Info.bVisible = Buff->CursorInfo.bVisible; - if (! DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_SET_CURSOR_INFO, - &Info, sizeof(Info), NULL, 0, &BytesReturned, NULL)) + if (!DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_SET_CURSOR_INFO, + &Info, sizeof(Info), NULL, 0, &BytesReturned, NULL)) { DPRINT1( "Failed to set cursor info\n" ); return FALSE; @@ -247,9 +260,9 @@ Info.dwCursorPosition.Y = Buff->CurrentY; Info.wAttributes = Buff->DefaultAttrib; - if (! DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO, - &Info, sizeof(CONSOLE_SCREEN_BUFFER_INFO), NULL, 0, - &BytesReturned, NULL)) + if (!DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO, + &Info, sizeof(CONSOLE_SCREEN_BUFFER_INFO), NULL, 0, + &BytesReturned, NULL)) { DPRINT1( "Failed to set cursor position\n" ); return FALSE; @@ -316,19 +329,20 @@ HWND NewWindow; MSG msg; - NewWindow = CreateWindowW(L"TuiConsoleWindowClass", + NewWindow = CreateWindowW(TUI_CONSOLE_WINDOW_CLASS, Console->Title.Buffer, 0, -32000, -32000, 0, 0, NULL, NULL, - (HINSTANCE) GetModuleHandleW(NULL), - (PVOID) Console); - Console->hWindow = NewWindow; + (HINSTANCE)GetModuleHandleW(NULL), + (PVOID)Console); if (NULL == NewWindow) { DPRINT1("CSR: Unable to create console window\n"); return 1; } + Console->hWindow = NewWindow; + SetConsoleWndConsoleLeaderCID(Console); SetForegroundWindow(Console->hWindow); @@ -368,10 +382,10 @@ { HANDLE ThreadHandle; - if (! ConsInitialized) + if (!ConsInitialized) { ConsInitialized = TRUE; - if (! TuiInit(Console->CodePage)) + if (!TuiInit(Console->CodePage)) { ConsInitialized = FALSE; return STATUS_UNSUCCESSFUL; @@ -384,8 +398,12 @@ Console->ActiveBuffer->MaxX = PhysicalConsoleSize.X; Console->ActiveBuffer->MaxY = PhysicalConsoleSize.Y; - ThreadHandle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)TuiConsoleThread, - Console, 0, NULL); + ThreadHandle = CreateThread(NULL, + 0, + TuiConsoleThread, + (PVOID)Console, + 0, + NULL); if (NULL == ThreadHandle) { DPRINT1("CSR: Unable to create console thread\n"); @@ -451,9 +469,9 @@ pos->X = (PhysicalConsoleSize.X - Title.Length) / 2; /* redraw the console to clear off old title */ ConioDrawConsole(ActiveConsole); - if (! DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER, - NULL, 0, Buffer, sizeof(COORD) + Title.Length, - &BytesReturned, NULL)) + if (!DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER, + NULL, 0, Buffer, sizeof(COORD) + Title.Length, + &BytesReturned, NULL)) { DPRINT1( "Error writing to console\n" ); } Modified: branches/ros-csrss/win32ss/user/ntuser/main.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/ntuser/m…
============================================================================== --- branches/ros-csrss/win32ss/user/ntuser/main.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/ntuser/main.c [iso-8859-1] Fri Jan 4 00:41:10 2013 @@ -304,6 +304,8 @@ if (ptiCurrent->KeyboardLayout) UserReferenceObject(ptiCurrent->KeyboardLayout); ptiCurrent->TIF_flags &= ~TIF_INCLEANUP; + if (Process == gpepCSRSS) /* If this thread is owned by CSRSS, mark it as such */ + ptiCurrent->TIF_flags |= TIF_CSRSSTHREAD; ptiCurrent->pcti = &ptiCurrent->cti; /* Initialize the CLIENTINFO */ Modified: branches/ros-csrss/win32ss/user/ntuser/ntstubs.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/ntuser/n…
============================================================================== --- branches/ros-csrss/win32ss/user/ntuser/ntstubs.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/ntuser/ntstubs.c [iso-8859-1] Fri Jan 4 00:41:10 2013 @@ -559,15 +559,66 @@ return 0; } -DWORD +NTSTATUS APIENTRY NtUserConsoleControl( - DWORD dwUnknown1, - DWORD dwUnknown2, - DWORD dwUnknown3) -{ - STUB; - return 0; + IN CONSOLECONTROL ConsoleCtrl, + IN PVOID ConsoleCtrlInfo, + IN DWORD ConsoleCtrlInfoLength) +{ + NTSTATUS Status = STATUS_SUCCESS; + + /* Allow only Console Server to perform this operation (via CSRSS) */ + if (gpepCSRSS != PsGetCurrentProcess()) + return STATUS_ACCESS_DENIED; + + UserEnterExclusive(); + + switch (ConsoleCtrl) + { + case GuiConsoleWndClassAtom: + { + _SEH2_TRY + { + ProbeForRead(ConsoleCtrlInfo, ConsoleCtrlInfoLength, 1); + ASSERT(ConsoleCtrlInfoLength == sizeof(ATOM)); + gaGuiConsoleWndClass = *(ATOM*)ConsoleCtrlInfo; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + + break; + } + + case TuiConsoleWndClassAtom: + { + _SEH2_TRY + { + ProbeForRead(ConsoleCtrlInfo, ConsoleCtrlInfoLength, 1); + ASSERT(ConsoleCtrlInfoLength == sizeof(ATOM)); + gaTuiConsoleWndClass = *(ATOM*)ConsoleCtrlInfo; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + + break; + } + + default: + ERR("Calling invalid control %lu in NtUserConsoleControl\n", ConsoleCtrl); + Status = STATUS_INVALID_INFO_CLASS; + break; + } + + UserLeave(); + + return Status; } DWORD Modified: branches/ros-csrss/win32ss/user/ntuser/ntuser.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/ntuser/n…
============================================================================== --- branches/ros-csrss/win32ss/user/ntuser/ntuser.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/ntuser/ntuser.c [iso-8859-1] Fri Jan 4 00:41:10 2013 @@ -21,6 +21,8 @@ HINSTANCE hModClient = NULL; BOOL ClientPfnInit = FALSE; PEPROCESS gpepCSRSS = NULL; +ATOM gaGuiConsoleWndClass; +ATOM gaTuiConsoleWndClass; /* PRIVATE FUNCTIONS *********************************************************/ @@ -105,7 +107,7 @@ // Set W32PF_Flags |= (W32PF_READSCREENACCESSGRANTED | W32PF_IOWINSTA) // Create Event for Diconnect Desktop. - Status = UserCreateWinstaDirectoy(); + Status = UserCreateWinstaDirectory(); if (!NT_SUCCESS(Status)) return Status; /* Initialize Video. */ @@ -121,7 +123,9 @@ // Create ThreadInfo for this Thread! // { - GetW32ThreadInfo(); + /* Initialize the current thread. */ + Status = UserCreateThreadInfo(PsGetCurrentThread()); + if (!NT_SUCCESS(Status)) return Status; // Callback to User32 Client Thread Setup Modified: branches/ros-csrss/win32ss/user/ntuser/ntuser.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/ntuser/n…
============================================================================== --- branches/ros-csrss/win32ss/user/ntuser/ntuser.h [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/ntuser/ntuser.h [iso-8859-1] Fri Jan 4 00:41:10 2013 @@ -16,6 +16,8 @@ extern PPROCESSINFO ppiScrnSaver; extern PPROCESSINFO gppiInputProvider; extern PEPROCESS gpepCSRSS; +extern ATOM gaGuiConsoleWndClass; +extern ATOM gaTuiConsoleWndClass; INIT_FUNCTION NTSTATUS NTAPI InitUserImpl(VOID); VOID FASTCALL CleanupUserImpl(VOID); Modified: branches/ros-csrss/win32ss/user/ntuser/userfuncs.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/ntuser/u…
============================================================================== --- branches/ros-csrss/win32ss/user/ntuser/userfuncs.h [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/ntuser/userfuncs.h [iso-8859-1] Fri Jan 4 00:41:10 2013 @@ -36,6 +36,10 @@ #define DUMP_REFS(obj) TRACE_CH(UserObj,"obj 0x%x, refs %i\n",obj, ((PHEAD)obj)->cLockObj) PWND FASTCALL IntGetWindowObject(HWND hWnd); + +/*************** MAIN.C ***************/ + +NTSTATUS NTAPI UserCreateThreadInfo(struct _ETHREAD *Thread); /*************** WINSTA.C ***************/ Modified: branches/ros-csrss/win32ss/user/ntuser/window.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/ntuser/w…
============================================================================== --- branches/ros-csrss/win32ss/user/ntuser/window.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/ntuser/window.c [iso-8859-1] Fri Jan 4 00:41:10 2013 @@ -3720,6 +3720,10 @@ DWORD APIENTRY NtUserQueryWindow(HWND hWnd, DWORD Index) { +/* Console Leader Process CID Window offsets */ +#define GWLP_CONSOLE_LEADER_PID 0 +#define GWLP_CONSOLE_LEADER_TID 4 + PWND pWnd; DWORD Result; DECLARE_RETURN(UINT); @@ -3735,12 +3739,36 @@ switch(Index) { case QUERY_WINDOW_UNIQUE_PROCESS_ID: - Result = (DWORD)IntGetWndProcessId(pWnd); + { + if ( (pWnd->head.pti->TIF_flags & TIF_CSRSSTHREAD) && + ( (pWnd->pcls->atomClassName == gaGuiConsoleWndClass) || + (pWnd->pcls->atomClassName == gaTuiConsoleWndClass) ) ) + { + // IntGetWindowLong(offset == GWLP_CONSOLE_LEADER_PID) + Result = (DWORD)(*((LONG_PTR*)((PCHAR)(pWnd + 1) + GWLP_CONSOLE_LEADER_PID))); + } + else + { + Result = (DWORD)IntGetWndProcessId(pWnd); + } break; + } case QUERY_WINDOW_UNIQUE_THREAD_ID: - Result = (DWORD)IntGetWndThreadId(pWnd); + { + if ( (pWnd->head.pti->TIF_flags & TIF_CSRSSTHREAD) && + ( (pWnd->pcls->atomClassName == gaGuiConsoleWndClass) || + (pWnd->pcls->atomClassName == gaTuiConsoleWndClass) ) ) + { + // IntGetWindowLong(offset == GWLP_CONSOLE_LEADER_TID) + Result = (DWORD)(*((LONG_PTR*)((PCHAR)(pWnd + 1) + GWLP_CONSOLE_LEADER_TID))); + } + else + { + Result = (DWORD)IntGetWndThreadId(pWnd); + } break; + } case QUERY_WINDOW_ACTIVE: Result = (DWORD)(pWnd->head.pti->MessageQueue->spwndActive ? UserHMGetHandle(pWnd->head.pti->MessageQueue->spwndActive) : 0); Modified: branches/ros-csrss/win32ss/user/ntuser/winsta.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/ntuser/w…
============================================================================== --- branches/ros-csrss/win32ss/user/ntuser/winsta.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/ntuser/winsta.c [iso-8859-1] Fri Jan 4 00:41:10 2013 @@ -45,7 +45,7 @@ NTSTATUS NTAPI -UserCreateWinstaDirectoy() +UserCreateWinstaDirectory() { PPEB Peb; NTSTATUS Status; Modified: branches/ros-csrss/win32ss/user/ntuser/winsta.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/ntuser/w…
============================================================================== --- branches/ros-csrss/win32ss/user/ntuser/winsta.h [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/ntuser/winsta.h [iso-8859-1] Fri Jan 4 00:41:10 2013 @@ -69,7 +69,7 @@ NTSTATUS NTAPI InitWindowStationImpl(VOID); -NTSTATUS NTAPI UserCreateWinstaDirectoy(); +NTSTATUS NTAPI UserCreateWinstaDirectory(); VOID APIENTRY IntWinStaObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters); NTSTATUS APIENTRY IntWinStaObjectParse(PWIN32_PARSEMETHOD_PARAMETERS Parameters);
11 years, 11 months
1
0
0
0
[tkreuzer] 58106: [INCLUDE] Delete obsolete files
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Jan 3 20:56:00 2013 New Revision: 58106 URL:
http://svn.reactos.org/svn/reactos?rev=58106&view=rev
Log: [INCLUDE] Delete obsolete files Removed: trunk/reactos/include/reactos/ks386.inc trunk/reactos/include/reactos/ksamd64.inc Removed: trunk/reactos/include/reactos/ks386.inc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/ks386.inc?…
============================================================================== --- trunk/reactos/include/reactos/ks386.inc [iso-8859-1] (original) +++ trunk/reactos/include/reactos/ks386.inc (removed) @@ -1,947 +1,0 @@ - -/* Pointer size */ -SizeofPointer = 0x4 - -/* Breakpoints */ -BREAKPOINT_BREAK = 0x0 -BREAKPOINT_PRINT = 0x1 -BREAKPOINT_PROMPT = 0x2 -BREAKPOINT_LOAD_SYMBOLS = 0x3 -BREAKPOINT_UNLOAD_SYMBOLS = 0x4 -BREAKPOINT_COMMAND_STRING = 0x5 - -/* Context Frame Flags */ -CONTEXT_FULL = 0x10007 -CONTEXT_CONTROL = 0x10001 -CONTEXT_INTEGER = 0x10002 -CONTEXT_SEGMENTS = 0x10004 -CONTEXT_FLOATING_POINT = 0x10008 -CONTEXT_DEBUG_REGISTERS = 0x10010 - -/* Exception flags */ -EXCEPTION_NONCONTINUABLE = 0x1 -EXCEPTION_UNWINDING = 0x2 -EXCEPTION_EXIT_UNWIND = 0x4 -EXCEPTION_STACK_INVALID = 0x8 -EXCEPTION_NESTED_CALL = 0x10 -EXCEPTION_TARGET_UNWIND = 0x20 -EXCEPTION_COLLIDED_UNWIND = 0x20 -EXCEPTION_UNWIND = 0x6 -EXCEPTION_EXECUTE_HANDLER = 0x1 -EXCEPTION_CONTINUE_SEARCH = 0x0 -EXCEPTION_CONTINUE_EXECUTION = 0xffffffff -EXCEPTION_CHAIN_END = 0xffffffff - -/* Exception types */ -ExceptionContinueExecution = 0x0 -ExceptionContinueSearch = 0x1 -ExceptionNestedException = 0x2 -ExceptionCollidedUnwind = 0x3 - -/* Lock Queue */ -LOCK_QUEUE_WAIT = 0x1 -LOCK_QUEUE_OWNER = 0x2 -LockQueueDispatcherLock = 0x0 - -/* Process states */ -ProcessInMemory = 0x0 -ProcessOutOfMemory = 0x1 -ProcessInTransition = 0x2 - -/* Processor mode */ -KernelMode = 0x0 -UserMode = 0x1 - -/* Status codes */ -STATUS_ACCESS_VIOLATION = 0xc0000005 -STATUS_ASSERTION_FAILURE = 0xc0000420 -STATUS_ARRAY_BOUNDS_EXCEEDED = 0xc000008c -STATUS_BAD_COMPRESSION_BUFFER = 0xc0000242 -STATUS_BREAKPOINT = 0x80000003 -STATUS_CALLBACK_POP_STACK = 0xc0000423 -STATUS_DATATYPE_MISALIGNMENT = 0x80000002 -STATUS_FLOAT_DENORMAL_OPERAND = 0xc000008d -STATUS_FLOAT_DIVIDE_BY_ZERO = 0xc000008e -STATUS_FLOAT_INEXACT_RESULT = 0xc000008f -STATUS_FLOAT_INVALID_OPERATION = 0xc0000090 -STATUS_FLOAT_OVERFLOW = 0xc0000091 -STATUS_FLOAT_STACK_CHECK = 0xc0000092 -STATUS_FLOAT_UNDERFLOW = 0xc0000093 -STATUS_FLOAT_MULTIPLE_FAULTS = 0xc00002b4 -STATUS_FLOAT_MULTIPLE_TRAPS = 0xc00002b5 -STATUS_GUARD_PAGE_VIOLATION = 0x80000001 -STATUS_ILLEGAL_FLOAT_CONTEXT = 0xc000014a -STATUS_ILLEGAL_INSTRUCTION = 0xc000001d -STATUS_INSTRUCTION_MISALIGNMENT = 0xc00000aa -STATUS_INVALID_HANDLE = 0xc0000008 -STATUS_INVALID_LOCK_SEQUENCE = 0xc000001e -STATUS_INVALID_OWNER = 0xc000005a -STATUS_INVALID_PARAMETER = 0xc000000d -STATUS_INVALID_PARAMETER_1 = 0xc00000ef -STATUS_INVALID_SYSTEM_SERVICE = 0xc000001c -STATUS_INTEGER_DIVIDE_BY_ZERO = 0xc0000094 -STATUS_INTEGER_OVERFLOW = 0xc0000095 -STATUS_IN_PAGE_ERROR = 0xc0000006 -STATUS_KERNEL_APC = 0x100 -STATUS_LONGJUMP = 0x80000026 -STATUS_NO_CALLBACK_ACTIVE = 0xc0000258 -STATUS_NO_EVENT_PAIR = 0xc000014e -STATUS_PRIVILEGED_INSTRUCTION = 0xc0000096 -STATUS_SINGLE_STEP = 0x80000004 -STATUS_STACK_BUFFER_OVERRUN = 0xc0000409 -STATUS_STACK_OVERFLOW = 0xc00000fd -STATUS_SUCCESS = 0x0 -STATUS_THREAD_IS_TERMINATING = 0xc000004b -STATUS_TIMEOUT = 0x102 -STATUS_UNWIND = 0xc0000027 -STATUS_UNWIND_CONSOLIDATE = 0x80000029 -STATUS_USER_APC = 0xc0 -STATUS_WAKE_SYSTEM_DEBUGGER = 0x80000007 - -/* TLS defines */ -TLS_MINIMUM_AVAILABLE = 0x40 -TLS_EXPANSION_SLOTS = 0x400 - -/* Thread states */ -Initialized = 0x0 -Ready = 0x1 -Running = 0x2 -Standby = 0x3 -Terminated = 0x4 -Waiting = 0x5 - -/* Wait type / reason */ -WrExecutive = 0x7 -WrMutex = 0x1d -WrDispatchInt = 0x1f -WrQuantumEnd = 0x1e -WrEventPair = 0xe -WaitAny = 0x1 -WaitAll = 0x0 - -/* Interrupt object types */ -InLevelSensitive = 0x0 -InLatched = 0x1 - -/* Bug Check Codes */ -APC_INDEX_MISMATCH = 0x1 -INVALID_AFFINITY_SET = 0x3 -INVALID_DATA_ACCESS_TRAP = 0x4 -IRQL_NOT_GREATER_OR_EQUAL = 0x9 -IRQL_NOT_LESS_OR_EQUAL = 0xa -NO_USER_MODE_CONTEXT = 0xe -SPIN_LOCK_ALREADY_OWNED = 0xf -SPIN_LOCK_NOT_OWNED = 0x10 -THREAD_NOT_MUTEX_OWNER = 0x11 -TRAP_CAUSE_UNKNOWN = 0x12 -KMODE_EXCEPTION_NOT_HANDLED = 0x1e -KERNEL_APC_PENDING_DURING_EXIT = 0x20 -PANIC_STACK_SWITCH = 0x2b -DATA_BUS_ERROR = 0x2e -INSTRUCTION_BUS_ERROR = 0x2f -SYSTEM_EXIT_OWNED_MUTEX = 0x39 -PAGE_FAULT_WITH_INTERRUPTS_OFF = 0x49 -IRQL_GT_ZERO_AT_SYSTEM_SERVICE = 0x4a -DATA_COHERENCY_EXCEPTION = 0x55 -INSTRUCTION_COHERENCY_EXCEPTION = 0x56 -HAL1_INITIALIZATION_FAILED = 0x61 -UNEXPECTED_KERNEL_MODE_TRAP = 0x7f -NMI_HARDWARE_FAILURE = 0x80 -SPIN_LOCK_INIT_FAILURE = 0x81 -ATTEMPTED_SWITCH_FROM_DPC = 0xb8 - -/* IRQL */ -PASSIVE_LEVEL = 0x0 -APC_LEVEL = 0x1 -DISPATCH_LEVEL = 0x2 -CLOCK1_LEVEL = 0x1c -CLOCK2_LEVEL = 0x1c -IPI_LEVEL = 0x1d -POWER_LEVEL = 0x1e -PROFILE_LEVEL = 0x1b -HIGH_LEVEL = 0x1f -#ifdef NT_UP -SYNCH_LEVEL = 0x2 -#else -SYNCH_LEVEL = 0x1b -#endif - -/* Stack sizes */ -KERNEL_STACK_SIZE = 0x3000 -KERNEL_LARGE_STACK_SIZE = 0xf000 -KERNEL_LARGE_STACK_COMMIT = 0x3000 - -/* Miscellaneous Definitions */ -LOW_REALTIME_PRIORITY = 0x10 -CLOCK_QUANTUM_DECREMENT = 0x3 -WAIT_QUANTUM_DECREMENT = 0x1 -MAXIMUM_PROCESSORS = 0x20 -INITIAL_STALL_COUNT = 0x64 -KI_EXCEPTION_ACCESS_VIOLATION = 0x10000004 -Executive = 0x0 -FALSE = 0x0 -TRUE = 0x1 -DBG_STATUS_CONTROL_C = 0x1 -USER_SHARED_DATA = 0xffdf0000 -PAGE_SIZE = 0x1000 -MAXIMUM_IDTVECTOR = 0xff -PRIMARY_VECTOR_BASE = 0x30 -RPL_MASK = 0x3 -MODE_MASK = 0x1 -NUMBER_SERVICE_TABLES = 0x2 -SERVICE_NUMBER_MASK = 0xfff -SERVICE_TABLE_SHIFT = 0x8 -SERVICE_TABLE_MASK = 0x10 -SERVICE_TABLE_TEST = 0x10 - -/* KAPC */ -ApType = 0x0 -ApSize = 0x2 -ApThread = 0x8 -ApApcListEntry = 0xc -ApKernelRoutine = 0x14 -ApRundownRoutine = 0x18 -ApNormalRoutine = 0x1c -ApNormalContext = 0x20 -ApSystemArgument1 = 0x24 -ApSystemArgument2 = 0x28 -ApApcStateIndex = 0x2c -ApApcMode = 0x2d -ApInserted = 0x2e -ApcObjectLength = 0x30 - -/* KAPC_STATE */ -AsApcListHead = 0x0 -AsProcess = 0x10 -AsKernelApcInProgress = 0x14 -AsKernelApcPending = 0x15 -AsUserApcPending = 0x16 - -/* CLIENT_ID */ -CidUniqueProcess = 0x0 -CidUniqueThread = 0x4 - -/* RTL_CRITICAL_SECTION */ -CsDebugInfo = 0x0 -CsLockCount = 0x4 -CsRecursionCount = 0x8 -CsOwningThread = 0xc -CsLockSemaphore = 0x10 -CsSpinCount = 0x14 - -/* RTL_CRITICAL_SECTION_DEBUG */ -CsType = 0x0 -CsCreatorBackTraceIndex = 0x2 -CsCriticalSection = 0x4 -CsProcessLocksList = 0x8 -CsEntryCount = 0x10 -CsContentionCount = 0x14 - -/* KDEVICE_QUEUE_ENTRY */ -DeDeviceListEntry = 0x0 -DeSortKey = 0x8 -DeInserted = 0xc -DeviceQueueEntryLength = 0x10 - -/* KDPC */ -DpType = 0x0 -DpImportance = 0x1 -DpNumber = 0x2 -DpDpcListEntry = 0x4 -DpDeferredRoutine = 0xc -DpDeferredContext = 0x10 -DpSystemArgument1 = 0x14 -DpSystemArgument2 = 0x18 -DpDpcData = 0x1c -DpcObjectLength = 0x20 - -/* KDEVICE_QUEUE */ -DvType = 0x0 -DvSize = 0x2 -DvDeviceListHead = 0x4 -DvSpinLock = 0xc -DvBusy = 0x10 -DeviceQueueObjectLength = 0x14 - -/* EXCEPTION_RECORD */ -ErExceptionCode = 0x0 -ErExceptionFlags = 0x4 -ErExceptionRecord = 0x8 -ErExceptionAddress = 0xc -ErNumberParameters = 0x10 -ErExceptionInformation = 0x14 -ExceptionRecordLength = 0x50 -EXCEPTION_RECORD_LENGTH = 0x50 - -/* EPROCESS */ -EpDebugPort = 0xcc -EpVdmObjects = 0x144 -ExecutiveProcessObjectLength = 0x278 - -/* KEVENT */ -EvType = 0x0 -EvSize = 0x2 -EvSignalState = 0x4 -EvWaitListHead = 0x8 -EventObjectLength = 0x10 - -/* FAST_MUTEX */ -FmCount = 0x0 -FmOwner = 0x4 -FmContention = 0x8 -FmOldIrql = 0x1c - -/* KINTERRUPT */ -InType = 0x0 -InSize = 0x2 -InInterruptListEntry = 0x4 -InServiceRoutine = 0xc -InServiceContext = 0x10 -InSpinLock = 0x14 -InTickCount = 0x18 -InActualLock = 0x1c -InDispatchAddress = 0x20 -InVector = 0x24 -InIrql = 0x28 -InSynchronizeIrql = 0x29 -InFloatingSave = 0x2a -InConnected = 0x2b -InNumber = 0x2c -InShareVector = 0x2d -InMode = 0x30 -InServiceCount = 0x34 -InDispatchCount = 0x38 -InDispatchCode = 0x3c -InterruptObjectLength = 0x1e4 - -/* IO_STATUS_BLOCK */ -IoStatus = 0x0 -IoPointer = 0x0 -IoInformation = 0x4 - -/* KNODE */ -KnPfnDereferenceSListHead = 0x8 -KnProcessorMask = 0x10 -KnColor = 0x14 -KnSeed = 0x18 -KnNodeNumber = 0x19 -KnFlags = 0x1a -knMmShiftedColor = 0x1e -KnFreeCount = 0x22 -KnPfnDeferredList = 0x2a -KNODE_SIZE = 0x2e - -/* KSPIN_LOCK_QUEUE */ -LqNext = 0x0 -LqLock = 0x4 - -/* KLOCK_QUEUE_HANDLE */ -LqhNext = 0x0 -LqhLock = 0x4 -LqhOldIrql = 0x8 -LOCK_QUEUE_HEADER_SIZE = 0xc - -/* LARGE_INTEGER */ -LiLowPart = 0x0 -LiHighPart = 0x4 - -/* LIST_ENTRY */ -LsFlink = 0x0 -LsBlink = 0x4 - -/* PEB */ -PeKernelCallbackTable = 0x2c -ProcessEnvironmentBlockLength = 0x230 - -/* KPROFILE */ -PfType = 0x0 -PfSize = 0x2 -PfProfileListEntry = 0x4 -PfProcess = 0xc -PfRangeBase = 0x10 -PfRangeLimit = 0x14 -PfBucketShift = 0x18 -PfBuffer = 0x1c -PfSegment = 0x20 -PfAffinity = 0x24 -PfSource = 0x28 -PfStarted = 0x2c -ProfileObjectLength = 0x30 - -/* PORT_MESSAGE */ -PmLength = 0x0 -PmZeroInit = 0x4 -PmClientId = 0x8 -PmProcess = 0x8 -PmThread = 0xc -PmMessageId = 0x10 -PmClientViewSize = 0x14 -PortMessageLength = 0x18 - -/* KPROCESS */ -PrType = 0x0 -PrSize = 0x2 -PrSignalState = 0x4 -PrProfileListHead = 0x10 -PrDirectoryTableBase = 0x18 -PrLdtDescriptor = 0x20 -PrIopmOffset = 0x30 -PrInt21Descriptor = 0x28 -PrVdmTrapcHandler = 0x4c -PrFlags = 0x6b -PrActiveProcessors = 0x34 -PrKernelTime = 0x38 -PrUserTime = 0x3c -PrReadyListHead = 0x40 -PrSwapListEntry = 0x48 -PrThreadListHead = 0x50 -PrProcessLock = 0x58 -PrAffinity = 0x5c -PrProcessFlags = 0x60 -PrBasePriority = 0x64 -PrQuantumReset = 0x65 -PrState = 0x66 -PrStackCount = 0x6c -KernelProcessObjectLength = 0x78 - -/* KQUEUE */ -QuType = 0x0 -QuSize = 0x2 -QuSignalState = 0x4 -QuEntryListHead = 0x10 -QuCurrentCount = 0x18 -QuMaximumCount = 0x1c -QuThreadListHead = 0x20 -QueueObjectLength = 0x28 - -/* STRING */ -StrLength = 0x0 -StrMaximumLength = 0x2 -StrBuffer = 0x4 - -/* TEB */ -TeCmTeb = 0x0 -TeExceptionList = 0x0 -TeStackBase = 0x4 -TeStackLimit = 0x8 -TeFiberData = 0x10 -TeSelf = 0x18 -TeEnvironmentPointer = 0x1c -TeClientId = 0x20 -TeActiveRpcHandle = 0x28 -TeThreadLocalStoragePointer = 0x2c -TeCountOfOwnedCriticalSections = 0x38 -TePeb = 0x30 -TeCsrClientThread = 0x3c -TeWOW32Reserved = 0xc0 -TeExceptionCode = 0x1a4 -TeActivationContextStackPointer = 0x1a8 -TeGdiClientPID = 0x6c0 -TeGdiClientTID = 0x6c4 -TeGdiThreadLocalInfo = 0x6c8 -TeglDispatchTable = 0x7c4 -TeglReserved1 = 0xb68 -TeglReserved2 = 0xbdc -TeglSectionInfo = 0xbe0 -TeglSection = 0xbe4 -TeglTable = 0xbe8 -TeglCurrentRC = 0xbec -TeglContext = 0xbf0 -TeDeallocationStack = 0xe0c -TeTlsSlots = 0xe10 -TeTlsExpansionSlots = 0xf94 -TeLastErrorValue = 0x34 -TeVdm = 0xf18 -TeInstrumentation = 0xf2c -TeGdiBatchCount = 0xf70 -TeGuaranteedStackBytes = 0xf78 -TeFlsData = 0xfb4 -TeSafeThunkCall = 0xfb8 -ThreadEnvironmentBlockLength = 0xfbc - -/* TIME_FIELDS */ -TfSecond = 0xa -TfMinute = 0x8 -TfHour = 0x6 -TfWeekday = 0xe -TfDay = 0x4 -TfMonth = 0x2 -TfYear = 0x0 -TfMilliseconds = 0xc - -/* KTHREAD */ -ThType = 0x0 -ThSize = 0x2 -ThLock = 0x0 -ThDebugActive = 0x3 -ThSignalState = 0x4 -ThInitialStack = 0x18 -ThStackLimit = 0x1c -ThKernelStack = 0x20 -ThThreadLock = 0x24 -ThAlerted = 0x5e -ThApcState = 0x28 -ThPriority = 0x5b -ThSwapBusy = 0x5d -ThNextProcessor = 0x40 -ThDeferredProcessor = 0x41 -ThApcQueueLock = 0x44 -ThContextSwitches = 0x48 -ThState = 0x4c -ThNpxState = 0x4d -ThWaitIrql = 0x4e -ThWaitMode = 0x4f -ThWaitStatus = 0x50 -ThWaitBlockList = 0x54 -ThGateObject = 0x54 -ThWaitListEntry = 0x60 -ThSwapListEntry = 0x60 -ThQueue = 0x68 -ThWaitTime = 0x6c -ThCombinedApcDisable = 0x70 -ThKernelApcDisable = 0x70 -ThSpecialApcDisable = 0x72 -ThTeb = 0x74 -ThTimer = 0x78 -ThThreadFlags = 0xa0 -ThServiceTable = 0x118 -ThWaitBlock = 0xa8 -ThResourceIndex = 0xef -ThQueueListEntry = 0x108 -ThTrapFrame = 0x110 -ThCallbackStack = 0x114 -ThApcStateIndex = 0x11c -ThIdealProcessor = 0x11d -ThBasePriority = 0x121 -ThPriorityDecrement = 0x122 -ThAdjustReason = 0x42 -ThAdjustIncrement = 0x43 -ThPreviousMode = 0xd7 -ThSaturation = 0x123 -ThFreezeCount = 0x14f -ThUserAffinity = 0x124 -ThProcess = 0x128 -ThAffinity = 0x12c -ThUserIdealProcessor = 0x151 -ThApcStatePointer = 0x130 -ThSavedApcState = 0x138 -ThWaitReason = 0x5a -ThSuspendCount = 0x150 -ThWin32Thread = 0x154 -ThStackBase = 0x158 -ThSuspendApc = 0x15c -ThPowerState = 0x18b -ThKernelTime = 0x160 -ThLegoData = 0x184 -ThLargeStack = 0x107 -ThUserTime = 0x18c -ThSuspendSemaphore = 0x190 -ThSListFaultCount = 0x1a4 -ThThreadListEntry = 0x1a8 -ThMutantListHead = 0x10 -ThSListFaultAddress = 0x1b0 -KernelThreadObjectLength = 0x1b8 -ExecutiveThreadObjectLength = 0x250 - -/* KTIMER */ -TiType = 0x0 -TiSize = 0x2 -TiInserted = 0x3 -TiSignalState = 0x4 -TiDueTime = 0x10 -TiTimerListEntry = 0x18 -TiDpc = 0x20 -TiPeriod = 0x24 -TimerObjectLength = 0x28 - -/* TIME */ - -/* KUSER_SHARED_DATA */ -UsTickCountMultiplier = 0x4 -UsInterruptTime = 0x8 -UsSystemTime = 0x14 -UsTimeZoneBias = 0x20 -UsImageNumberLow = 0x2c -UsImageNumberHigh = 0x2e -UsNtSystemRoot = 0x30 -UsMaxStackTraceDepth = 0x238 -UsCryptoExponent = 0x23c -UsTimeZoneId = 0x240 -UsLargePageMinimum = 0x244 -UsReserved2 = 0x248 -UsNtProductType = 0x264 -UsProductTypeIsValid = 0x268 -UsNtMajorVersion = 0x26c -UsNtMinorVersion = 0x270 -UsProcessorFeatures = 0x274 -UsReserved1 = 0x2b4 -UsReserved3 = 0x2b8 -UsTimeSlip = 0x2bc -UsAlternativeArchitecture = 0x2c0 -UsSystemExpirationDate = 0x2c8 -UsSuiteMask = 0x2d0 -UsKdDebuggerEnabled = 0x2d4 -UsActiveConsoleId = 0x2d8 -UsDismountCount = 0x2dc -UsComPlusPackage = 0x2e0 -UsLastSystemRITEventTickCount = 0x2e4 -UsNumberOfPhysicalPages = 0x2e8 -UsSafeBootMode = 0x2ec -UsTestRetInstruction = 0x2f8 -UsSystemCall = 0x300 -UsSystemCallReturn = 0x304 -UsSystemCallPad = 0x308 -UsTickCount = 0x320 -UsTickCountQuad = 0x320 -UsWow64SharedInformation = 0x340 - -/* KWAIT_BLOCK */ -WbWaitListEntry = 0x0 -WbThread = 0x8 -WbObject = 0xc -WbNextWaitBlock = 0x10 -WbWaitKey = 0x14 -WbWaitType = 0x16 - -/* CR0 flags */ -CR0_PE = 0x1 -CR0_MP = 0x2 -CR0_EM = 0x4 -CR0_TS = 0x8 -CR0_ET = 0x10 -CR0_NE = 0x20 -CR0_WP = 0x10000 -CR0_AM = 0x40000 -CR0_NW = 0x20000000 -CR0_CD = 0x40000000 -CR0_PG = 0x80000000 - -/* CR4 flags */ -CR4_VME = 0x1 -CR4_PVI = 0x2 -CR4_TSD = 0x4 -CR4_DE = 0x8 -CR4_PSE = 0x10 -CR4_PAE = 0x20 -CR4_MCE = 0x40 -CR4_PGE = 0x80 -CR4_FXSR = 0x200 -CR4_XMMEXCPT = 0x400 - -/* KeFeatureBits flags */ -KF_RDTSC = 0x2 -KF_CR4 = 0x4 -KF_GLOBAL_PAGE = 0x10 -KF_LARGE_PAGE = 0x20 -KF_CMPXCHG8B = 0x80 -KF_FAST_SYSCALL = 0x1000 -KF_V86_VIS = 0x1 - -/* Machine type definitions */ -MACHINE_TYPE_ISA = 0x0 -MACHINE_TYPE_EISA = 0x1 -MACHINE_TYPE_MCA = 0x2 - -/* EFLAGS */ -EFLAGS_TF = 0x100 -EFLAGS_INTERRUPT_MASK = 0x200 -EFLAGS_V86_MASK = 0x20000 -EFLAGS_ALIGN_CHECK = 0x40000 -EFLAGS_VIF = 0x80000 -EFLAGS_VIP = 0x100000 -EFLAGS_USER_SANITIZE = 0x3f4dd7 - -/* KDGT selectors */ -KGDT_R3_DATA = 0x20 -KGDT_R3_CODE = 0x18 -KGDT_R0_CODE = 0x8 -KGDT_R0_DATA = 0x10 -KGDT_R0_PCR = 0x30 -KGDT_TSS = 0x28 -KGDT_R3_TEB = 0x38 -KGDT_DF_TSS = 0x50 -KGDT_NMI_TSS = 0x58 -KGDT_LDT = 0x48 -NPX_STATE_NOT_LOADED = 0xa -NPX_STATE_LOADED = 0x0 -PF_XMMI_INSTRUCTIONS_AVAILABLE = 0x6 -EFLAG_SELECT = 0xc000 - -/* CONTEXT */ -CsContextFlags = 0x0 -CsDr0 = 0x4 -CsDr1 = 0x8 -CsDr2 = 0xc -CsDr3 = 0x10 -CsDr6 = 0x14 -CsDr7 = 0x18 -CsFloatSave = 0x1c -CsSegGs = 0x8c -CsSegFs = 0x90 -CsSegEs = 0x94 -CsSegDs = 0x98 -CsEdi = 0x9c -CsEsi = 0xa0 -CsEbx = 0xa4 -CsEdx = 0xa8 -CsEcx = 0xac -CsEax = 0xb0 -CsEbp = 0xb4 -CsEip = 0xb8 -CsSegCs = 0xbc -CsEflags = 0xc0 -CsEsp = 0xc4 -CsSegSs = 0xc8 -CsExtendedRegisters = 0xcc -ContextFrameLength = 0x2cc -CONTEXT_LENGTH = 0x2cc - -/* KGDTENTRY */ -KgdtBaseLow = 0x2 -KgdtBaseMid = 0x4 -KgdtBaseHi = 0x7 -KgdtLimitHi = 0x6 -KgdtLimitLow = 0x0 - -/* KTRAP_FRAME */ -TsExceptionList = 0x4c -TsPreviousPreviousMode = 0x48 -TsSegGs = 0x30 -TsSegFs = 0x50 -TsSegEs = 0x34 -TsSegDs = 0x38 -TsEdi = 0x54 -TsEsi = 0x58 -TsEbp = 0x60 -TsEbx = 0x5c -TsEdx = 0x3c -TsEcx = 0x40 -TsEax = 0x44 -TsErrCode = 0x64 -TsEip = 0x68 -TsSegCs = 0x6c -TsEflags = 0x70 -TsHardwareEsp = 0x74 -TsHardwareSegSs = 0x78 -TsTempSegCs = 0x10 -TsTempEsp = 0x14 -TsDbgEbp = 0x0 -TsDbgEip = 0x4 -TsDbgArgMark = 0x8 -TsDbgArgPointer = 0xc -TsDr0 = 0x18 -TsDr1 = 0x1c -TsDr2 = 0x20 -TsDr3 = 0x24 -TsDr6 = 0x28 -TsDr7 = 0x2c -TsV86Es = 0x7c -TsV86Ds = 0x80 -TsV86Fs = 0x84 -TsV86Gs = 0x88 -KTRAP_FRAME_LENGTH = 0x8c -KTRAP_FRAME_ALIGN = 0x4 -FRAME_EDITED = 0xfff8 - -/* KTSS */ -TssEsp0 = 0x4 -TssCR3 = 0x1c -TssEip = 0x20 -TssEFlags = 0x24 -TssEax = 0x28 -TssEbx = 0x34 -TssEcx = 0x2c -TssEdx = 0x30 -TssEsp = 0x38 -TssEbp = 0x3c -TssEsi = 0x40 -TssEdi = 0x44 -TssEs = 0x48 -TssCs = 0x4c -TssSs = 0x50 -TssDs = 0x54 -TssFs = 0x58 -TssGs = 0x5c -TssLDT = 0x60 -TssIoMapBase = 0x66 -TssIoMaps = 0x68 -TssLength = 0x20ac - -/* KPCR */ -KPCR_EXCEPTION_LIST = 0x0 -KPCR_PERF_GLOBAL_GROUP_MASK = 0x8 -KPCR_CONTEXT_SWITCHES = 0x10 -KPCR_TEB = 0x18 -KPCR_SELF = 0x1c -KPCR_PRCB = 0x20 -KPCR_IDT = 0x38 -KPCR_GDT = 0x3c -KPCR_TSS = 0x40 -KPCR_STALL_SCALE_FACTOR = 0x4c -KPCR_PRCB_DATA = 0x120 -KPCR_CURRENT_THREAD = 0x124 -KPCR_PRCB_NEXT_THREAD = 0x128 -KPCR_PRCB_DPC_QUEUE_DEPTH = 0xa4c -KPCR_PRCB_DPC_STACK = 0xa68 -KPCR_PRCB_MAXIMUM_DPC_QUEUE_DEPTH = 0xa6c -KPCR_PRCB_DPC_ROUTINE_ACTIVE = 0xa7a -KPCR_PRCB_TIMER_REQUEST = 0xa88 -KPCR_PRCB_QUANTUM_END = 0xaa1 -KPCR_PRCB_DEFERRED_READY_LIST_HEAD = 0xc10 -KPCR_PRCB_POWER_STATE_IDLE_FUNCTION = 0xec0 - -/* KTRAP_FRAME */ -KTRAP_FRAME_DEBUGEBP = 0x0 -KTRAP_FRAME_DEBUGEIP = 0x4 -KTRAP_FRAME_TEMPESP = 0x14 -KTRAP_FRAME_DR0 = 0x18 -KTRAP_FRAME_DR1 = 0x1c -KTRAP_FRAME_DR2 = 0x20 -KTRAP_FRAME_DR3 = 0x24 -KTRAP_FRAME_DR6 = 0x28 -KTRAP_FRAME_DR7 = 0x2c -KTRAP_FRAME_GS = 0x30 -KTRAP_FRAME_ES = 0x34 -KTRAP_FRAME_DS = 0x38 -KTRAP_FRAME_EDX = 0x3c -KTRAP_FRAME_ECX = 0x40 -KTRAP_FRAME_EAX = 0x44 -KTRAP_FRAME_PREVIOUS_MODE = 0x48 -KTRAP_FRAME_EXCEPTION_LIST = 0x4c -KTRAP_FRAME_FS = 0x50 -KTRAP_FRAME_EDI = 0x54 -KTRAP_FRAME_ESI = 0x58 -KTRAP_FRAME_EBX = 0x5c -KTRAP_FRAME_EBP = 0x60 -KTRAP_FRAME_ERROR_CODE = 0x64 -KTRAP_FRAME_EIP = 0x68 -KTRAP_FRAME_EFLAGS = 0x70 -KTRAP_FRAME_ESP = 0x74 -KTRAP_FRAME_SS = 0x78 -KTRAP_FRAME_V86_ES = 0x7c -KTRAP_FRAME_V86_DS = 0x80 -KTRAP_FRAME_V86_FS = 0x84 -KTRAP_FRAME_V86_GS = 0x88 -KTRAP_FRAME_SIZE = 0x8c -FRAME_EDITED = 0xfff8 - -/* CONTEXT */ -CONTEXT_FLAGS = 0x0 -CONTEXT_SEGGS = 0x8c -CONTEXT_SEGFS = 0x90 -CONTEXT_SEGES = 0x94 -CONTEXT_SEGDS = 0x98 -CONTEXT_EDI = 0x9c -CONTEXT_ESI = 0xa0 -CONTEXT_EBX = 0xa4 -CONTEXT_EDX = 0xa8 -CONTEXT_ECX = 0xac -CONTEXT_EAX = 0xb0 -CONTEXT_EBP = 0xb4 -CONTEXT_EIP = 0xb8 -CONTEXT_SEGCS = 0xbc -CONTEXT_EFLAGS = 0xc0 -CONTEXT_ESP = 0xc4 -CONTEXT_SEGSS = 0xc8 -CONTEXT_FRAME_LENGTH = 0x2cc - -/* FIBER */ -FIBER_PARAMETER = 0x0 -FIBER_EXCEPTION_LIST = 0x4 -FIBER_STACK_BASE = 0x8 -FIBER_STACK_LIMIT = 0xc -FIBER_DEALLOCATION_STACK = 0x10 -FIBER_CONTEXT = 0x14 -FIBER_CONTEXT_FLAGS = 0x14 -FIBER_CONTEXT_EAX = 0xc4 -FIBER_CONTEXT_EBX = 0xb8 -FIBER_CONTEXT_ECX = 0xc0 -FIBER_CONTEXT_EDX = 0xbc -FIBER_CONTEXT_ESI = 0xb4 -FIBER_CONTEXT_EDI = 0xb0 -FIBER_CONTEXT_EBP = 0xc8 -FIBER_CONTEXT_EIP = 0xcc -FIBER_CONTEXT_ESP = 0xd8 -FIBER_CONTEXT_DR6 = 0x28 -FIBER_CONTEXT_FLOAT_SAVE_CONTROL_WORD = 0x30 -FIBER_CONTEXT_FLOAT_SAVE_STATUS_WORD = 0x34 -FIBER_CONTEXT_FLOAT_SAVE_TAG_WORD = 0x38 -FIBER_GUARANTEED_STACK_BYTES = 0x2e0 -FIBER_FLS_DATA = 0x2e4 -FIBER_ACTIVATION_CONTEXT_STACK = 0x2e8 - -/* KTSS */ -KTSS_IOMAPBASE = 0x66 -KTSS_ESP0 = 0x4 - -/* EXCEPTION_RECORD */ -EXCEPTION_RECORD_EXCEPTION_CODE = 0x0 -EXCEPTION_RECORD_EXCEPTION_FLAGS = 0x4 -EXCEPTION_RECORD_EXCEPTION_RECORD = 0x8 -EXCEPTION_RECORD_EXCEPTION_ADDRESS = 0xc -EXCEPTION_RECORD_NUMBER_PARAMETERS = 0x10 -EXCEPTION_RECORD_EXCEPTION_ADDRESS = 0xc -SIZEOF_EXCEPTION_RECORD = 0x50 -EXCEPTION_RECORD_LENGTH = 0x50 - -/* KTHREAD */ -KTHREAD_DEBUG_ACTIVE = 0x3 -KTHREAD_INITIAL_STACK = 0x18 -KTHREAD_STACK_LIMIT = 0x1c -KTHREAD_TEB = 0x74 -KTHREAD_KERNEL_STACK = 0x20 -KTHREAD_APCSTATE_PROCESS = 0x38 -KTHREAD_PENDING_KERNEL_APC = 0x3d -KTHREAD_CONTEXT_SWITCHES = 0x48 -KTHREAD_STATE_ = 0x4c -KTHREAD_NPX_STATE = 0x4d -KTHREAD_WAIT_IRQL = 0x4e -KTHREAD_WAIT_REASON = 0x5a -KTHREAD_COMBINED_APC_DISABLE = 0x70 -KTHREAD_SPECIAL_APC_DISABLE = 0x72 -KTHREAD_LARGE_STACK = 0x107 -KTHREAD_TRAP_FRAME = 0x110 -KTHREAD_CALLBACK_STACK = 0x114 -KTHREAD_APC_STATE_INDEX = 0x11c -KTHREAD_STACK_BASE = 0x158 - -/* KPROCESS */ -KPROCESS_DIRECTORY_TABLE_BASE = 0x18 -KPROCESS_LDT_DESCRIPTOR0 = 0x20 -KPROCESS_LDT_DESCRIPTOR1 = 0x24 -KPROCESS_INT21_DESCRIPTOR0 = 0x28 -KPROCESS_INT21_DESCRIPTOR1 = 0x2c -KPROCESS_IOPM_OFFSET = 0x30 - -/* Teb */ -TEB_EXCEPTION_LIST = 0x0 -TEB_STACK_LIMIT = 0x8 -TEB_STACK_BASE = 0x4 -TEB_SELF = 0x18 -TEB_FIBER_DATA = 0x10 -TEB_PEB = 0x30 -TEB_EXCEPTION_CODE = 0x1a4 -PEB_KERNEL_CALLBACK_TABLE = 0x2c -TEB_FLS_DATA = 0xfb4 -TEB_ACTIVATION_CONTEXT_STACK_POINTER = 0x1a8 -TEB_GUARANTEED_STACK_BYTES = 0xf78 -TEB_DEALLOCATION_STACK = 0xe0c - -/* Misc */ -NPX_FRAME_LENGTH = 0x210 -FN_CR0_NPX_STATE = 0x20c -DR7_RESERVED_MASK = 0xdc00 -FP_CONTROL_WORD = 0x0 -FP_STATUS_WORD = 0x4 -FP_TAG_WORD = 0x8 -FP_DATA_SELECTOR = 0x18 -CBSTACK_RESULT = 0x20 -CBSTACK_RESULT_LENGTH = 0x24 -CBSTACK_TRAP_FRAME = 0x4 -CBSTACK_CALLBACK_STACK = 0x8 -SIZEOF_FX_SAVE_AREA = 0x210 -KUSER_SHARED_SYSCALL = 0x7ffe0300 -EXCEPTION_EXECUTE_HANDLER = 0x1 -STATUS_CALLBACK_POP_STACK = 0xc0000423 -CONTEXT_ALIGNED_SIZE = 0x2cc -PROCESSOR_FEATURE_FXSR = 0x7ffe0278 Removed: trunk/reactos/include/reactos/ksamd64.inc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/ksamd64.in…
============================================================================== --- trunk/reactos/include/reactos/ksamd64.inc [iso-8859-1] (original) +++ trunk/reactos/include/reactos/ksamd64.inc (removed) @@ -1,1074 +1,0 @@ - -/* Pointer size */ -SizeofPointer = 0x8 - -/* Breakpoints */ -BREAKPOINT_BREAK = 0x0 -BREAKPOINT_PRINT = 0x1 -BREAKPOINT_PROMPT = 0x2 -BREAKPOINT_LOAD_SYMBOLS = 0x3 -BREAKPOINT_UNLOAD_SYMBOLS = 0x4 -BREAKPOINT_COMMAND_STRING = 0x5 - -/* Context Frame Flags */ -CONTEXT_FULL = 0x10000b -CONTEXT_CONTROL = 0x100001 -CONTEXT_INTEGER = 0x100002 -CONTEXT_SEGMENTS = 0x100004 -CONTEXT_FLOATING_POINT = 0x100008 -CONTEXT_DEBUG_REGISTERS = 0x100010 - -/* Exception flags */ -EXCEPTION_NONCONTINUABLE = 0x1 -EXCEPTION_UNWINDING = 0x2 -EXCEPTION_EXIT_UNWIND = 0x4 -EXCEPTION_STACK_INVALID = 0x8 -EXCEPTION_NESTED_CALL = 0x10 -EXCEPTION_TARGET_UNWIND = 0x20 -EXCEPTION_COLLIDED_UNWIND = 0x20 -EXCEPTION_UNWIND = 0x6 -EXCEPTION_EXECUTE_HANDLER = 0x1 -EXCEPTION_CONTINUE_SEARCH = 0x0 -EXCEPTION_CONTINUE_EXECUTION = 0xffffffff - -/* Exception types */ -ExceptionContinueExecution = 0x0 -ExceptionContinueSearch = 0x1 -ExceptionNestedException = 0x2 -ExceptionCollidedUnwind = 0x3 - -/* Lock Queue */ -LOCK_QUEUE_WAIT = 0x1 -LOCK_QUEUE_OWNER = 0x2 -LockQueueDispatcherLock = 0x0 - -/* Process states */ -ProcessInMemory = 0x0 -ProcessOutOfMemory = 0x1 -ProcessInTransition = 0x2 - -/* Processor mode */ -KernelMode = 0x0 -UserMode = 0x1 - -/* Status codes */ -STATUS_ACCESS_VIOLATION = 0xc0000005 -STATUS_ASSERTION_FAILURE = 0xc0000420 -STATUS_ARRAY_BOUNDS_EXCEEDED = 0xc000008c -STATUS_BAD_COMPRESSION_BUFFER = 0xc0000242 -STATUS_BREAKPOINT = 0x80000003 -STATUS_CALLBACK_POP_STACK = 0xc0000423 -STATUS_DATATYPE_MISALIGNMENT = 0x80000002 -STATUS_FLOAT_DENORMAL_OPERAND = 0xc000008d -STATUS_FLOAT_DIVIDE_BY_ZERO = 0xc000008e -STATUS_FLOAT_INEXACT_RESULT = 0xc000008f -STATUS_FLOAT_INVALID_OPERATION = 0xc0000090 -STATUS_FLOAT_OVERFLOW = 0xc0000091 -STATUS_FLOAT_STACK_CHECK = 0xc0000092 -STATUS_FLOAT_UNDERFLOW = 0xc0000093 -STATUS_FLOAT_MULTIPLE_FAULTS = 0xc00002b4 -STATUS_FLOAT_MULTIPLE_TRAPS = 0xc00002b5 -STATUS_GUARD_PAGE_VIOLATION = 0x80000001 -STATUS_ILLEGAL_FLOAT_CONTEXT = 0xc000014a -STATUS_ILLEGAL_INSTRUCTION = 0xc000001d -STATUS_INSTRUCTION_MISALIGNMENT = 0xc00000aa -STATUS_INVALID_HANDLE = 0xc0000008 -STATUS_INVALID_LOCK_SEQUENCE = 0xc000001e -STATUS_INVALID_OWNER = 0xc000005a -STATUS_INVALID_PARAMETER = 0xc000000d -STATUS_INVALID_PARAMETER_1 = 0xc00000ef -STATUS_INVALID_SYSTEM_SERVICE = 0xc000001c -STATUS_INTEGER_DIVIDE_BY_ZERO = 0xc0000094 -STATUS_INTEGER_OVERFLOW = 0xc0000095 -STATUS_IN_PAGE_ERROR = 0xc0000006 -STATUS_KERNEL_APC = 0x100 -STATUS_LONGJUMP = 0x80000026 -STATUS_NO_CALLBACK_ACTIVE = 0xc0000258 -STATUS_NO_EVENT_PAIR = 0xc000014e -STATUS_PRIVILEGED_INSTRUCTION = 0xc0000096 -STATUS_SINGLE_STEP = 0x80000004 -STATUS_STACK_BUFFER_OVERRUN = 0xc0000409 -STATUS_STACK_OVERFLOW = 0xc00000fd -STATUS_SUCCESS = 0x0 -STATUS_THREAD_IS_TERMINATING = 0xc000004b -STATUS_TIMEOUT = 0x102 -STATUS_UNWIND = 0xc0000027 -STATUS_UNWIND_CONSOLIDATE = 0x80000029 -STATUS_USER_APC = 0xc0 -STATUS_WAKE_SYSTEM_DEBUGGER = 0x80000007 - -/* TLS defines */ -TLS_MINIMUM_AVAILABLE = 0x40 -TLS_EXPANSION_SLOTS = 0x400 - -/* Thread states */ -Initialized = 0x0 -Ready = 0x1 -Running = 0x2 -Standby = 0x3 -Terminated = 0x4 -Waiting = 0x5 - -/* Wait type / reason */ -WrExecutive = 0x7 -WrMutex = 0x1d -WrDispatchInt = 0x1f -WrQuantumEnd = 0x1e -WrEventPair = 0xe -WaitAny = 0x1 -WaitAll = 0x0 - -/* Interrupt object types */ -InLevelSensitive = 0x0 -InLatched = 0x1 - -/* Bug Check Codes */ -APC_INDEX_MISMATCH = 0x1 -INVALID_AFFINITY_SET = 0x3 -INVALID_DATA_ACCESS_TRAP = 0x4 -IRQL_NOT_GREATER_OR_EQUAL = 0x9 -IRQL_NOT_LESS_OR_EQUAL = 0xa -NO_USER_MODE_CONTEXT = 0xe -SPIN_LOCK_ALREADY_OWNED = 0xf -SPIN_LOCK_NOT_OWNED = 0x10 -THREAD_NOT_MUTEX_OWNER = 0x11 -TRAP_CAUSE_UNKNOWN = 0x12 -KMODE_EXCEPTION_NOT_HANDLED = 0x1e -KERNEL_APC_PENDING_DURING_EXIT = 0x20 -PANIC_STACK_SWITCH = 0x2b -DATA_BUS_ERROR = 0x2e -INSTRUCTION_BUS_ERROR = 0x2f -SYSTEM_EXIT_OWNED_MUTEX = 0x39 -PAGE_FAULT_WITH_INTERRUPTS_OFF = 0x49 -IRQL_GT_ZERO_AT_SYSTEM_SERVICE = 0x4a -DATA_COHERENCY_EXCEPTION = 0x55 -INSTRUCTION_COHERENCY_EXCEPTION = 0x56 -HAL1_INITIALIZATION_FAILED = 0x61 -UNEXPECTED_KERNEL_MODE_TRAP = 0x7f -NMI_HARDWARE_FAILURE = 0x80 -SPIN_LOCK_INIT_FAILURE = 0x81 -ATTEMPTED_SWITCH_FROM_DPC = 0xb8 - -/* IRQL */ -PASSIVE_LEVEL = 0x0 -APC_LEVEL = 0x1 -DISPATCH_LEVEL = 0x2 -CLOCK_LEVEL = 0xd -IPI_LEVEL = 0xe -POWER_LEVEL = 0xe -PROFILE_LEVEL = 0xf -HIGH_LEVEL = 0xf -#ifdef NT_UP -SYNCH_LEVEL = 0x2 -#else -SYNCH_LEVEL = 0xc -#endif - -/* Stack sizes */ -KERNEL_STACK_SIZE = 0x6000 -KERNEL_LARGE_STACK_SIZE = 0x12000 -KERNEL_LARGE_STACK_COMMIT = 0x6000 -KERNEL_MCA_EXCEPTION_STACK_SIZE = 0x2000 -NMI_STACK_SIZE = 0x2000 - -/* Miscellaneous Definitions */ -LOW_REALTIME_PRIORITY = 0x10 -CLOCK_QUANTUM_DECREMENT = 0x3 -WAIT_QUANTUM_DECREMENT = 0x1 -MAXIMUM_PROCESSORS = 0x40 -INITIAL_STALL_COUNT = 0x64 -KI_EXCEPTION_ACCESS_VIOLATION = 0x10000004 -Executive = 0x0 -FALSE = 0x0 -TRUE = 0x1 -DBG_STATUS_CONTROL_C = 0x1 -USER_SHARED_DATA = 0xffdf0000 -PAGE_SIZE = 0x1000 -MAXIMUM_IDTVECTOR = 0xff -PRIMARY_VECTOR_BASE = 0x30 -RPL_MASK = 0x3 -MODE_MASK = 0x1 -NUMBER_SERVICE_TABLES = 0x2 -SERVICE_NUMBER_MASK = 0xfff -SERVICE_TABLE_SHIFT = 0x7 -SERVICE_TABLE_MASK = 0x20 -SERVICE_TABLE_TEST = 0x20 - -/* KAPC */ -ApType = 0x0 -ApSize = 0x2 -ApThread = 0x8 -ApApcListEntry = 0x10 -ApKernelRoutine = 0x20 -ApRundownRoutine = 0x28 -ApNormalRoutine = 0x30 -ApNormalContext = 0x38 -ApSystemArgument1 = 0x40 -ApSystemArgument2 = 0x48 -ApApcStateIndex = 0x50 -ApApcMode = 0x51 -ApInserted = 0x52 -ApcObjectLength = 0x58 - -/* KAPC_STATE */ -AsApcListHead = 0x0 -AsProcess = 0x20 -AsKernelApcInProgress = 0x28 -AsKernelApcPending = 0x29 -AsUserApcPending = 0x2a - -/* CLIENT_ID */ -CidUniqueProcess = 0x0 -CidUniqueThread = 0x8 - -/* RTL_CRITICAL_SECTION */ -CsDebugInfo = 0x0 -CsLockCount = 0x8 -CsRecursionCount = 0xc -CsOwningThread = 0x10 -CsLockSemaphore = 0x18 -CsSpinCount = 0x20 - -/* RTL_CRITICAL_SECTION_DEBUG */ -CsType = 0x0 -CsCreatorBackTraceIndex = 0x2 -CsCriticalSection = 0x8 -CsProcessLocksList = 0x10 -CsEntryCount = 0x20 -CsContentionCount = 0x24 - -/* KDEVICE_QUEUE_ENTRY */ -DeDeviceListEntry = 0x0 -DeSortKey = 0x10 -DeInserted = 0x14 -DeviceQueueEntryLength = 0x18 - -/* KDPC */ -DpType = 0x0 -DpImportance = 0x1 -DpNumber = 0x2 -DpDpcListEntry = 0x8 -DpDeferredRoutine = 0x18 -DpDeferredContext = 0x20 -DpSystemArgument1 = 0x28 -DpSystemArgument2 = 0x30 -DpDpcData = 0x38 -DpcObjectLength = 0x40 - -/* KDEVICE_QUEUE */ -DvType = 0x0 -DvSize = 0x2 -DvDeviceListHead = 0x8 -DvSpinLock = 0x18 -DvBusy = 0x20 -DeviceQueueObjectLength = 0x28 - -/* EXCEPTION_RECORD */ -ErExceptionCode = 0x0 -ErExceptionFlags = 0x4 -ErExceptionRecord = 0x8 -ErExceptionAddress = 0x10 -ErNumberParameters = 0x18 -ErExceptionInformation = 0x20 -ExceptionRecordLength = 0x98 -EXCEPTION_RECORD_LENGTH = 0x98 - -/* EPROCESS */ -EpDebugPort = 0x110 -EpVdmObjects = 0x1f0 -ExecutiveProcessObjectLength = 0x3a0 - -/* KEVENT */ -EvType = 0x0 -EvSize = 0x2 -EvSignalState = 0x4 -EvWaitListHead = 0x8 -EventObjectLength = 0x18 - -/* FAST_MUTEX */ -FmCount = 0x0 -FmOwner = 0x8 -FmContention = 0x10 -FmOldIrql = 0x30 - -/* KINTERRUPT */ -InType = 0x0 -InSize = 0x2 -InInterruptListEntry = 0x8 -InServiceRoutine = 0x18 -InServiceContext = 0x20 -InSpinLock = 0x28 -InTickCount = 0x30 -InActualLock = 0x38 -InDispatchAddress = 0x40 -InVector = 0x48 -InIrql = 0x4c -InSynchronizeIrql = 0x4d -InFloatingSave = 0x4e -InConnected = 0x4f -InNumber = 0x50 -InShareVector = 0x51 -InMode = 0x54 -InServiceCount = 0x58 -InDispatchCount = 0x5c -InDispatchCode = 0x60 -InterruptObjectLength = 0x208 - -/* IO_STATUS_BLOCK */ -IoStatus = 0x0 -IoPointer = 0x0 -IoInformation = 0x8 - -/* KNODE */ -KnPfnDereferenceSListHead = 0x10 -KnProcessorMask = 0x20 -KnColor = 0x28 -KnSeed = 0x2c -KnNodeNumber = 0x2d -KnFlags = 0x2e -knMmShiftedColor = 0x32 -KnFreeCount = 0x36 -KnPfnDeferredList = 0x3e -KNODE_SIZE = 0x46 - -/* KSPIN_LOCK_QUEUE */ -LqNext = 0x0 -LqLock = 0x8 - -/* KLOCK_QUEUE_HANDLE */ -LqhNext = 0x0 -LqhLock = 0x8 -LqhOldIrql = 0x10 -LOCK_QUEUE_HEADER_SIZE = 0x18 - -/* LARGE_INTEGER */ -LiLowPart = 0x0 -LiHighPart = 0x4 - -/* LIST_ENTRY */ -LsFlink = 0x0 -LsBlink = 0x8 - -/* PEB */ -PeKernelCallbackTable = 0x58 -ProcessEnvironmentBlockLength = 0x358 - -/* KPROFILE */ -PfType = 0x0 -PfSize = 0x2 -PfProfileListEntry = 0x8 -PfProcess = 0x18 -PfRangeBase = 0x20 -PfRangeLimit = 0x28 -PfBucketShift = 0x30 -PfBuffer = 0x38 -PfSegment = 0x40 -PfAffinity = 0x48 -PfSource = 0x50 -PfStarted = 0x54 -ProfileObjectLength = 0x58 - -/* PORT_MESSAGE */ -PmLength = 0x0 -PmZeroInit = 0x4 -PmClientId = 0x8 -PmProcess = 0x8 -PmThread = 0x10 -PmMessageId = 0x18 -PmClientViewSize = 0x1c -PortMessageLength = 0x24 - -/* KPROCESS */ -PrType = 0x0 -PrSize = 0x2 -PrSignalState = 0x4 -PrProfileListHead = 0x18 -PrDirectoryTableBase = 0x28 -PrActiveProcessors = 0x30 -PrKernelTime = 0x34 -PrUserTime = 0x38 -PrReadyListHead = 0x40 -PrSwapListEntry = 0x50 -PrThreadListHead = 0x60 -PrProcessLock = 0x70 -PrAffinity = 0x78 -PrProcessFlags = 0x80 -PrBasePriority = 0x84 -PrQuantumReset = 0x85 -PrState = 0x86 -PrStackCount = 0x8c -KernelProcessObjectLength = 0xa0 - -/* KQUEUE */ -QuType = 0x0 -QuSize = 0x2 -QuSignalState = 0x4 -QuEntryListHead = 0x18 -QuCurrentCount = 0x28 -QuMaximumCount = 0x2c -QuThreadListHead = 0x30 -QueueObjectLength = 0x40 - -/* STRING */ -StrLength = 0x0 -StrMaximumLength = 0x2 -StrBuffer = 0x8 - -/* TEB */ -TeCmTeb = 0x0 -TeStackBase = 0x8 -TeStackLimit = 0x10 -TeFiberData = 0x20 -TeSelf = 0x30 -TeEnvironmentPointer = 0x38 -TeClientId = 0x40 -TeActiveRpcHandle = 0x50 -TeThreadLocalStoragePointer = 0x58 -TeCountOfOwnedCriticalSections = 0x6c -TePeb = 0x60 -TeCsrClientThread = 0x70 -TeWOW32Reserved = 0x100 -TeExceptionCode = 0x2c0 -TeActivationContextStackPointer = 0x2c8 -TeGdiClientPID = 0x7f0 -TeGdiClientTID = 0x7f4 -TeGdiThreadLocalInfo = 0x7f8 -TeglDispatchTable = 0x9f0 -TeglReserved1 = 0x1138 -TeglReserved2 = 0x1220 -TeglSectionInfo = 0x1228 -TeglSection = 0x1230 -TeglTable = 0x1238 -TeglCurrentRC = 0x1240 -TeglContext = 0x1248 -TeDeallocationStack = 0x1478 -TeTlsSlots = 0x1480 -TeTlsExpansionSlots = 0x1780 -TeLastErrorValue = 0x68 -TeVdm = 0x1690 -TeInstrumentation = 0x16b8 -TeGdiBatchCount = 0x1740 -TeGuaranteedStackBytes = 0x1748 -TeFlsData = 0x17c8 -ThreadEnvironmentBlockLength = 0x17d8 - -/* TIME_FIELDS */ -TfSecond = 0xa -TfMinute = 0x8 -TfHour = 0x6 -TfWeekday = 0xe -TfDay = 0x4 -TfMonth = 0x2 -TfYear = 0x0 -TfMilliseconds = 0xc - -/* KTHREAD */ -ThType = 0x0 -ThSize = 0x2 -ThLock = 0x0 -ThDebugActive = 0x3 -ThSignalState = 0x4 -ThInitialStack = 0x28 -ThStackLimit = 0x30 -ThKernelStack = 0x38 -ThThreadLock = 0x40 -ThAlerted = 0x9e -ThApcState = 0x48 -ThPriority = 0x9b -ThSwapBusy = 0x9d -ThNextProcessor = 0x60 -ThDeferredProcessor = 0x61 -ThApcQueueLock = 0x78 -ThContextSwitches = 0x80 -ThState = 0x84 -ThNpxState = 0x85 -ThWaitIrql = 0x86 -ThWaitMode = 0x87 -ThWaitStatus = 0x88 -ThWaitBlockList = 0x90 -ThGateObject = 0x90 -ThWaitListEntry = 0xa0 -ThSwapListEntry = 0xa0 -ThQueue = 0xb0 -ThWaitTime = 0xb8 -ThCombinedApcDisable = 0xbc -ThKernelApcDisable = 0xbc -ThSpecialApcDisable = 0xbe -ThTeb = 0xc0 -ThTimer = 0xc8 -ThThreadFlags = 0xf0 -ThServiceTable = 0x1e8 -ThWaitBlock = 0x108 -ThResourceIndex = 0x14f -ThQueueListEntry = 0x1c8 -ThTrapFrame = 0x1d8 -ThCallbackStack = 0x1e0 -ThApcStateIndex = 0x1f0 -ThIdealProcessor = 0x1f1 -ThBasePriority = 0x1f5 -ThPriorityDecrement = 0x1f6 -ThAdjustReason = 0x62 -ThAdjustIncrement = 0x63 -ThPreviousMode = 0x137 -ThSaturation = 0x1f7 -ThFreezeCount = 0x237 -ThUserAffinity = 0x1f8 -ThProcess = 0x200 -ThAffinity = 0x208 -ThUserIdealProcessor = 0x239 -ThApcStatePointer = 0x210 -ThSavedApcState = 0x220 -ThWaitReason = 0x9a -ThSuspendCount = 0x238 -ThWin32Thread = 0x250 -ThStackBase = 0x258 -ThSuspendApc = 0x260 -ThPowerState = 0x28f -ThKernelTime = 0x264 -ThLegoData = 0x288 -ThLargeStack = 0x167 -ThUserTime = 0x290 -ThSuspendSemaphore = 0x2b8 -ThSListFaultCount = 0x2cc -ThThreadListEntry = 0x2d8 -ThMutantListHead = 0x18 -ThSListFaultAddress = 0x2e8 -KernelThreadObjectLength = 0x2f0 -ExecutiveThreadObjectLength = 0x3f8 - -/* KTIMER */ -TiType = 0x0 -TiSize = 0x2 -TiInserted = 0x3 -TiSignalState = 0x4 -TiDueTime = 0x18 -TiTimerListEntry = 0x20 -TiDpc = 0x30 -TiPeriod = 0x3c -TimerObjectLength = 0x40 - -/* TIME */ - -/* KUSER_SHARED_DATA */ -UsTickCountMultiplier = 0x4 -UsInterruptTime = 0x8 -UsSystemTime = 0x14 -UsTimeZoneBias = 0x20 -UsImageNumberLow = 0x2c -UsImageNumberHigh = 0x2e -UsNtSystemRoot = 0x30 -UsMaxStackTraceDepth = 0x238 -UsCryptoExponent = 0x23c -UsTimeZoneId = 0x240 -UsLargePageMinimum = 0x244 -UsReserved2 = 0x248 -UsNtProductType = 0x264 -UsProductTypeIsValid = 0x268 -UsNtMajorVersion = 0x26c -UsNtMinorVersion = 0x270 -UsProcessorFeatures = 0x274 -UsReserved1 = 0x2b4 -UsReserved3 = 0x2b8 -UsTimeSlip = 0x2bc -UsAlternativeArchitecture = 0x2c0 -UsSystemExpirationDate = 0x2c8 -UsSuiteMask = 0x2d0 -UsKdDebuggerEnabled = 0x2d4 -UsActiveConsoleId = 0x2d8 -UsDismountCount = 0x2dc -UsComPlusPackage = 0x2e0 -UsLastSystemRITEventTickCount = 0x2e4 -UsNumberOfPhysicalPages = 0x2e8 -UsSafeBootMode = 0x2ec -UsTestRetInstruction = 0x2f8 -UsSystemCall = 0x300 -UsSystemCallReturn = 0x304 -UsSystemCallPad = 0x308 -UsTickCount = 0x320 -UsTickCountQuad = 0x320 -UsWow64SharedInformation = 0x340 - -/* KWAIT_BLOCK */ -WbWaitListEntry = 0x0 -WbThread = 0x10 -WbObject = 0x18 -WbNextWaitBlock = 0x20 -WbWaitKey = 0x28 -WbWaitType = 0x2a - -/* CR0 flags */ -CR0_PE = 0x1 -CR0_MP = 0x2 -CR0_EM = 0x4 -CR0_TS = 0x8 -CR0_ET = 0x10 -CR0_NE = 0x20 -CR0_WP = 0x10000 -CR0_AM = 0x40000 -CR0_NW = 0x20000000 -CR0_CD = 0x40000000 -CR0_PG = 0x80000000 - -/* CR4 flags */ -CR4_VME = 0x1 -CR4_PVI = 0x2 -CR4_TSD = 0x4 -CR4_DE = 0x8 -CR4_PSE = 0x10 -CR4_PAE = 0x20 -CR4_MCE = 0x40 -CR4_PGE = 0x80 -CR4_FXSR = 0x200 -CR4_XMMEXCPT = 0x400 -CR4_CHANNELS = 0x800 - -/* KeFeatureBits flags */ -KF_RDTSC = 0x2 -KF_CR4 = 0x4 -KF_GLOBAL_PAGE = 0x10 -KF_LARGE_PAGE = 0x20 -KF_CMPXCHG8B = 0x80 -KF_FAST_SYSCALL = 0x1000 - -/* Machine type definitions */ -MACHINE_TYPE_ISA = 0x0 -MACHINE_TYPE_EISA = 0x1 -MACHINE_TYPE_MCA = 0x2 - -/* EFLAGS */ -EFLAGS_TF_MASK = 0x100 -EFLAGS_TF_SHIFT = 0x8 -EFLAGS_IF_MASK = 0x200 -EFLAGS_IF_SHIFT = 0x9 -EFLAGS_ID_MASK = 0x200000 - -/* Hypervisor Enlightenment Definitions */ - -/* KDGT selectors */ -KGDT64_NULL = 0x0 -KGDT64_R0_CODE = 0x10 -KGDT64_R0_DATA = 0x18 -KGDT64_R3_CMCODE = 0x20 -KGDT64_R3_DATA = 0x28 -KGDT64_R3_CODE = 0x30 -KGDT64_SYS_TSS = 0x40 -KGDT64_R3_CMTEB = 0x50 - -/* Machine Specific Register Numbers */ -MSR_EFER = 0xc0000080 -MSR_STAR = 0xc0000081 -MSR_LSTAR = 0xc0000082 -MSR_CSTAR = 0xc0000083 -MSR_SYSCALL_MASK = 0xc0000084 -MSR_FS_BASE = 0xc0000100 -MSR_GS_BASE = 0xc0000101 -MSR_GS_SWAP = 0xc0000102 -MSR_MCG_STATUS = 0x17a -MSR_AMD_ACCESS = 0x9c5a203a - -/* Flags for MSR_EFER */ -MSR_LMA = 0x400 -MSR_LME = 0x100 -MSR_SCE = 0x1 -MSR_NXE = 0x800 -MSR_PAT = 0x277 -MSR_DEGUG_CTL = 0x1d9 -MSR_LAST_BRANCH_FROM = 0x1db -MSR_LAST_BRANCH_TO = 0x1dc -MSR_LAST_EXCEPTION_FROM = 0x1dd -MSR_LAST_EXCEPTION_TO = 0x1de - -/* Flags for MSR_DEGUG_CTL */ - -/* Fatal exception codes */ -EXCEPTION_DIVIDED_BY_ZERO = 0x0 -EXCEPTION_DEBUG = 0x1 -EXCEPTION_NMI = 0x2 -EXCEPTION_INT3 = 0x3 -EXCEPTION_BOUND_CHECK = 0x5 -EXCEPTION_INVALID_OPCODE = 0x6 -EXCEPTION_NPX_NOT_AVAILABLE = 0x7 -EXCEPTION_DOUBLE_FAULT = 0x8 -EXCEPTION_NPX_OVERRUN = 0x9 -EXCEPTION_INVALID_TSS = 0xa -EXCEPTION_SEGMENT_NOT_PRESENT = 0xb -EXCEPTION_STACK_FAULT = 0xc -EXCEPTION_GP_FAULT = 0xd -EXCEPTION_RESERVED_TRAP = 0xf -EXCEPTION_NPX_ERROR = 0x10 -EXCEPTION_ALIGNMENT_CHECK = 0x11 - -/* Argument Home Address */ -P1Home = 0x0 -P2Home = 0x0 -P3Home = 0x0 -P4Home = 0x0 - -/* CONTEXT */ -CONTEXT_P1Home = 0x0 -CONTEXT_P2Home = 0x8 -CONTEXT_P3Home = 0x10 -CONTEXT_P4Home = 0x18 -CONTEXT_P5Home = 0x20 -CONTEXT_P6Home = 0x28 -CONTEXT_ContextFlags = 0x30 -CONTEXT_MxCsr = 0x34 -CONTEXT_SegCs = 0x38 -CONTEXT_SegDs = 0x3a -CONTEXT_SegEs = 0x3c -CONTEXT_SegFs = 0x3e -CONTEXT_SegGs = 0x40 -CONTEXT_SegSs = 0x42 -CONTEXT_EFlags = 0x44 -CONTEXT_Dr0 = 0x48 -CONTEXT_Dr1 = 0x50 -CONTEXT_Dr2 = 0x58 -CONTEXT_Dr3 = 0x60 -CONTEXT_Dr6 = 0x68 -CONTEXT_Dr7 = 0x70 -CONTEXT_Rax = 0x78 -CONTEXT_Rcx = 0x80 -CONTEXT_Rdx = 0x88 -CONTEXT_Rbx = 0x90 -CONTEXT_Rsp = 0x98 -CONTEXT_Rbp = 0xa0 -CONTEXT_Rsi = 0xa8 -CONTEXT_Rdi = 0xb0 -CONTEXT_R8 = 0xb8 -CONTEXT_R9 = 0xc0 -CONTEXT_R10 = 0xc8 -CONTEXT_R11 = 0xd0 -CONTEXT_R12 = 0xd8 -CONTEXT_R13 = 0xe0 -CONTEXT_R14 = 0xe8 -CONTEXT_R15 = 0xf0 -CONTEXT_Rip = 0xf8 -CONTEXT_FltSave = 0x100 -CONTEXT_Xmm0 = 0x1a0 -CONTEXT_Xmm1 = 0x1b0 -CONTEXT_Xmm2 = 0x1c0 -CONTEXT_Xmm3 = 0x1d0 -CONTEXT_Xmm4 = 0x1e0 -CONTEXT_Xmm5 = 0x1f0 -CONTEXT_Xmm6 = 0x200 -CONTEXT_Xmm7 = 0x210 -CONTEXT_Xmm8 = 0x220 -CONTEXT_Xmm9 = 0x230 -CONTEXT_Xmm10 = 0x240 -CONTEXT_Xmm11 = 0x250 -CONTEXT_Xmm12 = 0x260 -CONTEXT_Xmm13 = 0x270 -CONTEXT_Xmm14 = 0x280 -CONTEXT_Xmm15 = 0x290 -CONTEXT_DebugControl = 0x4a8 -CONTEXT_LastBranchToRip = 0x4b0 -CONTEXT_LastBranchFromRip = 0x4b8 -CONTEXT_LastExceptionToRip = 0x4c0 -CONTEXT_LastExceptionFromRip = 0x4c8 -CONTEXT_VectorControl = 0x4a0 -CONTEXT_VectorRegister = 0x300 -CONTEXT_FRAME_LENGTH = 0x4d0 - -/* DISPATCHER_CONTEXT */ -DcControlPc = 0x0 -DcImageBase = 0x8 -DcFunctionEntry = 0x10 -DcEstablisherFrame = 0x18 -DcTargetIp = 0x20 -DcContextRecord = 0x28 -DcLanguageHandler = 0x30 -DcHandlerData = 0x38 -DcHistoryTable = 0x40 -DcScopeIndex = 0x48 - -/* KEXCEPTION_FRAME */ -KEXCEPTION_FRAME_P1Home = 0x0 -KEXCEPTION_FRAME_P2Home = 0x8 -KEXCEPTION_FRAME_P3Home = 0x10 -KEXCEPTION_FRAME_P4Home = 0x18 -KEXCEPTION_FRAME_P5 = 0x20 -KEXCEPTION_FRAME_Xmm6 = 0x30 -KEXCEPTION_FRAME_Xmm7 = 0x40 -KEXCEPTION_FRAME_Xmm8 = 0x50 -KEXCEPTION_FRAME_Xmm9 = 0x60 -KEXCEPTION_FRAME_Xmm10 = 0x70 -KEXCEPTION_FRAME_Xmm11 = 0x80 -KEXCEPTION_FRAME_Xmm12 = 0x90 -KEXCEPTION_FRAME_Xmm13 = 0xa0 -KEXCEPTION_FRAME_Xmm14 = 0xb0 -KEXCEPTION_FRAME_Xmm15 = 0xc0 -KEXCEPTION_FRAME_MxCsr = 0xf0 -KEXCEPTION_FRAME_Rbp = 0xf8 -KEXCEPTION_FRAME_Rbx = 0x100 -KEXCEPTION_FRAME_Rdi = 0x108 -KEXCEPTION_FRAME_Rsi = 0x110 -KEXCEPTION_FRAME_R12 = 0x118 -KEXCEPTION_FRAME_R13 = 0x120 -KEXCEPTION_FRAME_R14 = 0x128 -KEXCEPTION_FRAME_R15 = 0x130 -KEXCEPTION_FRAME_Return = 0x138 -KEXCEPTION_FRAME_InitialStack = 0x28 -KEXCEPTION_FRAME_TrapFrame = 0xd0 -KEXCEPTION_FRAME_CallbackStack = 0xd8 -KEXCEPTION_FRAME_OutputBuffer = 0xe0 -KEXCEPTION_FRAME_OutputLength = 0xe8 -KEXCEPTION_FRAME_LENGTH = 0x140 - -/* JUMP_BUFFER */ -JbFrame = 0x0 -JbRbx = 0x8 -JbRsp = 0x10 -JbRbp = 0x18 -JbRsi = 0x20 -JbRdi = 0x28 -JbR12 = 0x30 -JbR13 = 0x38 -JbR14 = 0x40 -JbR15 = 0x48 -JbRip = 0x50 -JbXmm6 = 0x60 -JbXmm7 = 0x70 -JbXmm8 = 0x80 -JbXmm9 = 0x90 -JbXmm10 = 0xa0 -JbXmm11 = 0xb0 -JbXmm12 = 0xc0 -JbXmm13 = 0xd0 -JbXmm14 = 0xe0 -JbXmm15 = 0xf0 - -/* KGDTENTRY64 */ -KgdtBaseLow = 0x2 -KgdtBaseMiddle = 0x4 -KgdtBaseHigh = 0x7 -KgdtBaseUpper = 0x8 -KgdtLimitHigh = 0x6 -KgdtLimitLow = 0x0 - -/* KPRCB */ -PbMxCsr = 0x0 -PbNumber = 0x4 -PbInterruptRequest = 0x6 -PbIdleHalt = 0x7 -PbCurrentThread = 0x8 -PbNextThread = 0x10 -PbIdleThread = 0x18 -PbNestingLevel = 0x5 -PbRspBase = 0x28 -PbPrcbLock = 0x30 -PbSetMember = 0x38 -PbProcessorState = 0x40 -PbCpuType = 0x5f0 -PbCpuID = 0x5f1 -PbCpuStep = 0x5f2 -PbHalReserved = 0x5f8 -PbMinorVersion = 0x638 -PbMajorVersion = 0x63a -PbBuildType = 0x63c -PbCpuVendor = 0x63d -PbApicMask = 0x640 -PbCFlushSize = 0x644 -PbAcpiReserved = 0x648 -PbInitialApicId = 0x63e -PbLockQueue = 0x670 -PbPPLookasideList = 0x880 -PbPPNPagedLookasideList = 0x980 -PbPPPagedLookasideList = 0xb80 -PbPacketBarrier = 0xd80 -PbDeferredReadyListHead = 0xd88 -PbLookasideIrpFloat = 0xdc4 -PbTargetSet = 0xe00 -PbIpiFrozen = 0xe08 -PbRequestMailbox = 0xe80 -PbSenderSummary = 0x2680 -PbDpcStack = 0x2740 -PbMaximumDpcQueueDepth = 0x2750 -PbDpcRequestRate = 0x2754 -PbMinimumDpcRate = 0x2758 -PbDpcInterruptRequested = 0x275c -PbDpcThreadRequested = 0x275d -PbDpcRoutineActive = 0x275e -PbDpcThreadActive = 0x275f -PbTimerHand = 0x2760 -PbTimerRequest = 0x2768 -PbTickOffset = 0x2770 -PbMasterOffset = 0x2774 -PbDpcLastCount = 0x2778 -PbQuantumEnd = 0x277d -PbDpcSetEventRequest = 0x2780 -PbIdleSchedule = 0x277f -PbReadySummary = 0x2818 -PbDispatcherReadyListHead = 0x2820 -PbInterruptCount = 0x2a20 -PbKernelTime = 0x2a24 -PbUserTime = 0x2a28 -PbDpcTime = 0x2a2c -PbInterruptTime = 0x2a30 -PbAdjustDpcThreshold = 0x2a34 -PbSkipTick = 0x2a38 -PbPollSlot = 0x2a3a -PbParentNode = 0x2a48 -PbMultiThreadProcessorSet = 0x2a50 -PbMultiThreadSetMaster = 0x2a58 -PbPageColor = 0x2a6c -PbNodeColor = 0x2a70 -PbNodeShiftedColor = 0x2a74 -PbSecondaryColorMask = 0x2a78 -PbSleeping = 0x2a60 -PbVendorString = 0x2abc -PbPowerState = 0x2ad8 -ProcessorBlockLength = 0x2c88 - -/* KPCR */ -PcUserRsp = 0x10 -PcSelf = 0x18 -PcCurrentPrcb = 0x20 -PcLockArray = 0x28 -PcIrql = 0x50 -PcStallScaleFactor = 0x64 -PcHalReserved = 0xc0 - -/* KPROCESSOR_STATE */ -PsSpecialRegisters = 0x0 -PsCr0 = 0x0 -PsCr2 = 0x8 -PsCr3 = 0x10 -PsCr4 = 0x18 -PsKernelDr0 = 0x20 -PsKernelDr1 = 0x28 -PsKernelDr2 = 0x30 -PsKernelDr3 = 0x38 -PsKernelDr6 = 0x40 -PsKernelDr7 = 0x48 -PsGdtr = 0x50 -PsIdtr = 0x60 -PsTr = 0x70 -PsLdtr = 0x72 -PsMxCsr = 0x74 -PsContextFrame = 0xe0 -PsDebugControl = 0x78 -PsLastBranchToRip = 0x80 -PsLastBranchFromRip = 0x88 -PsLastExceptionToRip = 0x90 -PsLastExceptionFromRip = 0x98 -PsCr8 = 0xa0 -ProcessorStateLength = 0x5b0 - -/* KSTART_FRAME */ -SfP1Home = 0x0 -SfP2Home = 0x8 -SfP3Home = 0x10 -SfP4Home = 0x18 -SfReturn = 0x28 -KSTART_FRAME_LENGTH = 0x30 - -/* KSPECIAL_REGISTERS */ -SrKernelDr0 = 0x20 -SrKernelDr1 = 0x28 -SrKernelDr2 = 0x30 -SrKernelDr3 = 0x38 -SrKernelDr6 = 0x40 -SrKernelDr7 = 0x48 -SrGdtr = 0x50 -SrIdtr = 0x60 -SrTr = 0x70 -SrMxCsr = 0x74 -SrMsrGsBase = 0xa8 -SrMsrGsSwap = 0xb0 -SrMsrStar = 0xb8 -SrMsrLStar = 0xc0 -SrMsrCStar = 0xc8 -SrMsrSyscallMask = 0xd0 - -/* KSYSTEM_TIME */ -StLowTime = 0x0 -StHigh1Time = 0x4 -StHigh2Time = 0x8 - -/* KSWITCH_FRAME */ -SwP5Home = 0x20 -SwApcBypass = 0x28 -SwRbp = 0x30 -SwReturn = 0x38 -SwitchFrameLength = 0x40 -KSWITCH_FRAME_LENGTH = 0x40 - -/* KTRAP_FRAME */ -KTRAP_FRAME_P1Home = 0x0 -KTRAP_FRAME_P2Home = 0x8 -KTRAP_FRAME_P3Home = 0x10 -KTRAP_FRAME_P4Home = 0x18 -KTRAP_FRAME_P5 = 0x20 -KTRAP_FRAME_PreviousMode = 0x28 -KTRAP_FRAME_PreviousIrql = 0x29 -KTRAP_FRAME_FaultIndicator = 0x2a -KTRAP_FRAME_ExceptionActive = 0x2b -KTRAP_FRAME_MxCsr = 0x2c -KTRAP_FRAME_Rax = 0x30 -KTRAP_FRAME_Rcx = 0x38 -KTRAP_FRAME_Rdx = 0x40 -KTRAP_FRAME_R8 = 0x48 -KTRAP_FRAME_R9 = 0x50 -KTRAP_FRAME_R10 = 0x58 -KTRAP_FRAME_R11 = 0x60 -KTRAP_FRAME_GsBase = 0x68 -KTRAP_FRAME_GsSwap = 0x68 -KTRAP_FRAME_Xmm0 = 0x70 -KTRAP_FRAME_Xmm1 = 0x80 -KTRAP_FRAME_Xmm2 = 0x90 -KTRAP_FRAME_Xmm3 = 0xa0 -KTRAP_FRAME_Xmm4 = 0xb0 -KTRAP_FRAME_Xmm5 = 0xc0 -KTRAP_FRAME_FaultAddress = 0xd0 -KTRAP_FRAME_TimeStampCKCL = 0xd0 -KTRAP_FRAME_Dr0 = 0xd8 -KTRAP_FRAME_Dr1 = 0xe0 -KTRAP_FRAME_Dr2 = 0xe8 -KTRAP_FRAME_Dr3 = 0xf0 -KTRAP_FRAME_Dr6 = 0xf8 -KTRAP_FRAME_Dr7 = 0x100 -KTRAP_FRAME_DebugControl = 0x108 -KTRAP_FRAME_LastBranchToRip = 0x110 -KTRAP_FRAME_LastBranchFromRip = 0x118 -KTRAP_FRAME_LastExceptionToRip = 0x120 -KTRAP_FRAME_LastExceptionFromRip = 0x128 -KTRAP_FRAME_LastBranchControl = 0x108 -KTRAP_FRAME_LastBranchMSR = 0x110 -KTRAP_FRAME_SegDs = 0x130 -KTRAP_FRAME_SegEs = 0x132 -KTRAP_FRAME_SegFs = 0x134 -KTRAP_FRAME_SegGs = 0x136 -KTRAP_FRAME_TrapFrame = 0x138 -KTRAP_FRAME_Rbx = 0x140 -KTRAP_FRAME_Rdi = 0x148 -KTRAP_FRAME_Rsi = 0x150 -KTRAP_FRAME_Rbp = 0x158 -KTRAP_FRAME_ErrorCode = 0x160 -KTRAP_FRAME_TimeStampKlog = 0x160 -KTRAP_FRAME_Rip = 0x168 -KTRAP_FRAME_SegCs = 0x170 -KTRAP_FRAME_Logging = 0x173 -KTRAP_FRAME_EFlags = 0x178 -KTRAP_FRAME_Rsp = 0x180 -KTRAP_FRAME_SegSs = 0x188 -KTRAP_FRAME_CodePatchCycle = 0x18c -KTRAP_FRAME_LENGTH = 0x190 - -/* KTSS */ -TssRsp0 = 0x4 -TssRsp1 = 0xc -TssRsp2 = 0x14 -TssPanicStack = 0x24 -TssMcaStack = 0x2c -TssNmiStack = 0x34 -TssIoMapBase = 0x66 -TssLength = 0x68 - -/* EXCEPTION_RECORD */ -EXCEPTION_RECORD_ExceptionCode = 0x0 -EXCEPTION_RECORD_ExceptionFlags = 0x4 -EXCEPTION_RECORD_ExceptionRecord = 0x8 -EXCEPTION_RECORD_ExceptionAddress = 0x10 -EXCEPTION_RECORD_NumberParameters = 0x18 -EXCEPTION_RECORD_ExceptionInformation = 0x20 -KTHREAD_WAIT_IRQL = 0x86
11 years, 11 months
1
0
0
0
[hbelusca] 58105: [CONSRV] Revert unwanted changes brought accidentally in r58104.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu Jan 3 17:47:34 2013 New Revision: 58105 URL:
http://svn.reactos.org/svn/reactos?rev=58105&view=rev
Log: [CONSRV] Revert unwanted changes brought accidentally in r58104. Modified: branches/ros-csrss/win32ss/user/consrv/coninput.c branches/ros-csrss/win32ss/user/consrv/conio.h branches/ros-csrss/win32ss/user/consrv/conoutput.c branches/ros-csrss/win32ss/user/consrv/console.c branches/ros-csrss/win32ss/user/consrv/handle.c Modified: branches/ros-csrss/win32ss/user/consrv/coninput.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/coninput.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/coninput.c [iso-8859-1] Thu Jan 3 17:47:34 2013 @@ -88,16 +88,6 @@ InsertTailList(&Console->InputEvents, &ConInRec->ListEntry); SetEvent(Console->ActiveEvent); -/* - if (CsrNotifyWait(&Console->ReadWaitQueue, - WaitAny, - NULL, - NULL)) - { - ASSERT(Console->SatisfiedWaits == NULL); - Console->SatisfiedWaits = &Console->ReadWaitQueue; - } -*/ CsrNotifyWait(&Console->ReadWaitQueue, WaitAny, NULL, @@ -265,7 +255,7 @@ { current = CONTAINING_RECORD(current_entry, CONSOLE_PROCESS_DATA, ConsoleLink); current_entry = current_entry->Flink; - ConioConsoleCtrlEvent(CTRL_C_EVENT, current); + ConioConsoleCtrlEvent((DWORD)CTRL_C_EVENT, current); } if (Console->LineBuffer && !Console->LineComplete) { @@ -334,7 +324,6 @@ CapturedInputInfo, NULL)) { - /* Fail */ HeapFree(ConSrvHeap, 0, CapturedInputInfo); return STATUS_NO_MEMORY; } @@ -364,46 +353,11 @@ PCSRSS_GET_CONSOLE_INPUT GetConsoleInputRequest = &((PCONSOLE_API_MESSAGE)WaitApiMessage)->Data.GetConsoleInputRequest; PGET_INPUT_INFO InputInfo = (PGET_INPUT_INFO)WaitContext; - DWORD Flag = (DWORD)WaitArgument1; - BOOLEAN InputHandleClosing = (WaitArgument2 == (PVOID)0xdeaddead); - - DPRINT("ReadInputBufferThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags); - - /* - * If we are signaled by pressing Ctrl-C or Ctrl-Break, - * just ignore this event. - */ - if ( (Flag == 1 << CTRL_C_EVENT) || - (Flag == 1 << CTRL_BREAK_EVENT) ) - { - return FALSE; - } - - /* - * If we are called via CsrNotifyWaitBlock by a call to - * CsrDestroyProcess or CsrDestroyThread, just return. - */ - if (WaitFlags & CsrProcessTerminating) - { - Status = STATUS_THREAD_IS_TERMINATING; - goto Quit; - } - - /* - * If we are about to close an input handle, then just return. - */ - if (InputHandleClosing) - { - Status = STATUS_ALERTED; - goto Quit; - } - Status = ReadInputBuffer(InputInfo, GetConsoleInputRequest->bRead, WaitApiMessage, FALSE); -Quit: if (Status != STATUS_PENDING) { WaitApiMessage->Status = Status; @@ -496,38 +450,10 @@ NTSTATUS Status; PGET_INPUT_INFO InputInfo = (PGET_INPUT_INFO)WaitContext; - DWORD Flag = (DWORD)WaitArgument1; - BOOLEAN InputHandleClosing = (WaitArgument2 == (PVOID)0xdeaddead); - - DPRINT("ReadCharsThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags); - - /* - * If we are called via CsrNotifyWaitBlock by a call to - * CsrDestroyProcess or CsrDestroyThread, just return. - */ - if (WaitFlags & CsrProcessTerminating) - { - Status = STATUS_THREAD_IS_TERMINATING; - goto Quit; - } - - /* - * If we are signaled by pressing Ctrl-C or Ctrl-Break, - * or that we close an input handle, then just return. - */ - if ( (Flag == 1 << CTRL_C_EVENT) || - (Flag == 1 << CTRL_BREAK_EVENT) || - (InputHandleClosing == TRUE) ) - { - Status = STATUS_ALERTED; - goto Quit; - } - Status = ReadChars(InputInfo, WaitApiMessage, FALSE); -Quit: if (Status != STATUS_PENDING) { WaitApiMessage->Status = Status; @@ -553,7 +479,6 @@ /* We haven't read anything (yet) */ - // Cooked-like mode if (InputInfo->Console->Mode & ENABLE_LINE_INPUT) { if (InputInfo->Console->LineBuffer == NULL) @@ -638,7 +563,7 @@ WaitForMoreToRead = FALSE; } } - else // Raw-like mode + else { /* Character input */ while ( ReadConsoleRequest->NrCharactersRead < nNumberOfCharsToRead && Modified: branches/ros-csrss/win32ss/user/consrv/conio.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] Thu Jan 3 17:47:34 2013 @@ -29,17 +29,16 @@ typedef struct tagCSRSS_SCREEN_BUFFER { Object_t Header; /* Object header */ - LIST_ENTRY ListEntry; /* Entry in console's list of buffers */ - - BYTE *Buffer; /* Pointer to screen buffer */ - USHORT MaxX, MaxY; /* Size of the entire scrollback buffer */ - USHORT ShowX, ShowY; /* Beginning offset for the actual display area */ + BYTE *Buffer; /* pointer to screen buffer */ + USHORT MaxX, MaxY; /* size of the entire scrollback buffer */ + USHORT ShowX, ShowY; /* beginning offset for the actual display area */ ULONG CurrentX; /* Current X cursor position */ ULONG CurrentY; /* Current Y cursor position */ - WORD DefaultAttrib; /* Default char attribute */ - USHORT VirtualY; /* Top row of buffer being displayed, reported to callers */ + WORD DefaultAttrib; /* default char attribute */ + USHORT VirtualY; /* top row of buffer being displayed, reported to callers */ CONSOLE_CURSOR_INFO CursorInfo; USHORT Mode; + LIST_ENTRY ListEntry; /* entry in console's list of buffers */ } CSRSS_SCREEN_BUFFER, *PCSRSS_SCREEN_BUFFER; typedef struct tagCSRSS_CONSOLE @@ -77,15 +76,6 @@ BYTE PauseFlags; HANDLE UnpauseEvent; LIST_ENTRY WriteWaitQueue; /* List head for the queue of write wait blocks */ - -#if 0 - /* Pointers to lists of wait blocks, when they contain satisfied waits to be freed */ - PLIST_ENTRY SatisfiedWaits; - - /* Pointers to lists of wait blocks, when they contain satisfied waits to be freed */ - PLIST_ENTRY ReadSatisfiedWaits; - PLIST_ENTRY WriteSatisfiedWaits; -#endif WORD Mode; /* Console mode flags */ UNICODE_STRING Title; /* Title of console */ Modified: branches/ros-csrss/win32ss/user/consrv/conoutput.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/conoutput.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/conoutput.c [iso-8859-1] Thu Jan 3 17:47:34 2013 @@ -447,23 +447,10 @@ { NTSTATUS Status; - DPRINT("WriteConsoleThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags); - - /* - * If we are called via CsrNotifyWaitBlock by a call to - * CsrDestroyProcess or CsrDestroyThread, just return. - */ - if (WaitFlags & CsrProcessTerminating) - { - Status = STATUS_THREAD_IS_TERMINATING; - goto Quit; - } - Status = DoWriteConsole(WaitApiMessage, WaitThread, FALSE); -Quit: if (Status != STATUS_PENDING) { WaitApiMessage->Status = Status; Modified: branches/ros-csrss/win32ss/user/consrv/console.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] Thu Jan 3 17:47:34 2013 @@ -64,42 +64,6 @@ DPRINT("ConioConsoleCtrlEvent Parent ProcessId = %x\n", ProcessData->Process->ClientId.UniqueProcess); - /* Notify all the waits only if we see Ctrl-C or Ctrl-Break */ - if (Event == CTRL_C_EVENT || Event == CTRL_BREAK_EVENT) - { - DWORD Flag = (1 << Event); // Transform an integer value to a power of 2. - NTSTATUS Status; - PCSRSS_CONSOLE Console; - // LIST_ENTRY WaitQueue; - - DPRINT1("ConioConsoleCtrlEvent - Ctrl-C captured\n"); - Status = ConioConsoleFromProcessData(ProcessData, &Console); - if (NT_SUCCESS(Status)) - { - DPRINT1("ConioConsoleCtrlEvent - console captured, try to dereference waits...\n"); - /* - * Wake-up all of the writing waiters, dereference them - * and purge them all from the list. - */ - if (CsrNotifyWait(&Console->ReadWaitQueue, - WaitAll, - (PVOID)Flag, - NULL)) - { - DPRINT1("ConioConsoleCtrlEvent - waits dereferenced...\n"); - // InitializeListHead(&WaitQueue); - - // CsrMoveSatisfiedWait(&WaitQueue, &Console->ReadWaitQueue); - if (!IsListEmpty(&Console->ReadWaitQueue /* &WaitQueue */)) - { - CsrDereferenceWait(&Console->ReadWaitQueue /* &WaitQueue */); - } - } - ConioUnlockConsole(Console); // NOTE_WAITS: <-- Here we have the possibility to free the console waits also. - } - } - - /* Notify the process of the control event */ if (ProcessData->CtrlDispatcher) { Thread = CreateRemoteThread(ProcessData->Process->ProcessHandle, NULL, 0, @@ -166,7 +130,6 @@ InitializeListHead(&Console->ProcessList); InitializeListHead(&Console->BufferList); Console->ActiveBuffer = NULL; - // Console->SatisfiedWaits = NULL; InitializeListHead(&Console->ReadWaitQueue); InitializeListHead(&Console->WriteWaitQueue); InitializeListHead(&Console->InputEvents); @@ -490,9 +453,6 @@ DPRINT("ConioDeleteConsole\n"); - /* TODO: Dereference all the waits in Console->ReadWaitQueue */ - /* TODO: Dereference all the waits in Console->WriteWaitQueue */ - /* Drain input event queue */ while (Console->InputEvents.Flink != &Console->InputEvents) { @@ -541,8 +501,6 @@ VOID FASTCALL ConioUnpause(PCSRSS_CONSOLE Console, UINT Flags) { - // LIST_ENTRY WaitQueue; - Console->PauseFlags &= ~Flags; // if ((Console->PauseFlags & (PAUSED_FROM_KEYBOARD | PAUSED_FROM_SCROLLBAR | PAUSED_FROM_SELECTION)) == 0) @@ -552,23 +510,10 @@ CloseHandle(Console->UnpauseEvent); Console->UnpauseEvent = NULL; - /* - * Wake-up all of the writing waiters, dereference them - * and purge them all from the list. - */ - if (CsrNotifyWait(&Console->WriteWaitQueue, - WaitAll, - NULL, - NULL)) - { - // InitializeListHead(&WaitQueue); - - // CsrMoveSatisfiedWait(&WaitQueue, &Console->WriteWaitQueue); - if (!IsListEmpty(&Console->WriteWaitQueue /* &WaitQueue */)) - { - CsrDereferenceWait(&Console->WriteWaitQueue /* &WaitQueue */); - } - } + CsrNotifyWait(&Console->WriteWaitQueue, + WaitAll, + NULL, + NULL); } } Modified: branches/ros-csrss/win32ss/user/consrv/handle.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/h…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] Thu Jan 3 17:47:34 2013 @@ -11,7 +11,7 @@ #include "consrv.h" #include "conio.h" -#define NDEBUG +//#define NDEBUG #include <debug.h> @@ -47,32 +47,10 @@ Win32CsrCloseHandleEntry(PCSRSS_HANDLE Entry) { Object_t *Object = Entry->Object; - if (Object != NULL) { PCSRSS_CONSOLE Console = Object->Console; EnterCriticalSection(&Console->Lock); - - if (Object->Type == CONIO_CONSOLE_MAGIC) - { - // LIST_ENTRY WaitQueue; - - /* - * Wake-up all of the writing waiters if any, dereference them - * and purge them all from the list. - */ - CsrNotifyWait(&Console->ReadWaitQueue, - WaitAll, - NULL, - (PVOID)0xdeaddead); - // InitializeListHead(&WaitQueue); - - // CsrMoveSatisfiedWait(&WaitQueue, &Console->ReadWaitQueue); - if (!IsListEmpty(&Console->ReadWaitQueue /* &WaitQueue */)) - { - CsrDereferenceWait(&Console->ReadWaitQueue /* &WaitQueue */); - } - } /* If the last handle to a screen buffer is closed, delete it... */ if (AdjustHandleCounts(Entry, -1) == 0) @@ -165,6 +143,8 @@ RtlLeaveCriticalSection(&ProcessData->HandleTableLock); return STATUS_INVALID_HANDLE; } + + DPRINT1("Win32CsrReleaseObject - Process 0x%p, Release 0x%p\n", ProcessData->Process, &ProcessData->HandleTable[h]); Win32CsrCloseHandleEntry(&ProcessData->HandleTable[h]); RtlLeaveCriticalSection(&ProcessData->HandleTableLock); @@ -209,23 +189,6 @@ Win32CsrUnlockConsole(PCSRSS_CONSOLE Console) { LeaveCriticalSection(&Console->Lock); - -#if 0 - /* If it was the last held lock for the owning thread... */ - if (&Console->Lock.RecursionCount == 0) - { - /* ...dereference waiting threads if any */ - LIST_ENTRY WaitQueue; - InitializeListHead(&WaitQueue); - - CsrMoveSatisfiedWait(&WaitQueue, Console->SatisfiedWaits); - Console->SatisfiedWaits = NULL; - if (!IsListEmpty(&WaitQueue)) - { - CsrDereferenceWait(&WaitQueue); - } - } -#endif /* Decrement reference count */ if (_InterlockedDecrement(&Console->ReferenceCount) == 0)
11 years, 11 months
1
0
0
0
[hbelusca] 58104: [KERNEL32] Silent more debug prints and remove an unused DPRINT1 I've introduced in r57666.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu Jan 3 17:42:27 2013 New Revision: 58104 URL:
http://svn.reactos.org/svn/reactos?rev=58104&view=rev
Log: [KERNEL32] Silent more debug prints and remove an unused DPRINT1 I've introduced in r57666. Modified: branches/ros-csrss/dll/win32/kernel32/client/console/console.c branches/ros-csrss/dll/win32/kernel32/client/dllmain.c branches/ros-csrss/dll/win32/kernel32/client/proc.c branches/ros-csrss/win32ss/user/consrv/coninput.c branches/ros-csrss/win32ss/user/consrv/conio.h branches/ros-csrss/win32ss/user/consrv/conoutput.c branches/ros-csrss/win32ss/user/consrv/console.c branches/ros-csrss/win32ss/user/consrv/handle.c Modified: branches/ros-csrss/dll/win32/kernel32/client/console/console.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/cl…
============================================================================== --- branches/ros-csrss/dll/win32/kernel32/client/console/console.c [iso-8859-1] (original) +++ branches/ros-csrss/dll/win32/kernel32/client/console/console.c [iso-8859-1] Thu Jan 3 17:42:27 2013 @@ -51,16 +51,16 @@ DPRINT("Ctrl-Break Event\n"); break; - case CTRL_SHUTDOWN_EVENT: - DPRINT("Ctrl Shutdown Event\n"); - break; - case CTRL_CLOSE_EVENT: DPRINT("Ctrl Close Event\n"); break; case CTRL_LOGOFF_EVENT: DPRINT("Ctrl Logoff Event\n"); + break; + + case CTRL_SHUTDOWN_EVENT: + DPRINT("Ctrl Shutdown Event\n"); break; } Modified: branches/ros-csrss/dll/win32/kernel32/client/dllmain.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/cl…
============================================================================== --- branches/ros-csrss/dll/win32/kernel32/client/dllmain.c [iso-8859-1] (original) +++ branches/ros-csrss/dll/win32/kernel32/client/dllmain.c [iso-8859-1] Thu Jan 3 17:42:27 2013 @@ -13,7 +13,7 @@ #include <k32.h> -// #define NDEBUG +#define NDEBUG #include <debug.h> /* GLOBALS *******************************************************************/ @@ -353,7 +353,7 @@ /* Initialize Console Support */ if (!BasepInitConsole()) { - DPRINT1("Failure to set up console\n"); + DPRINT1("Failed to set up console\n"); return FALSE; } Modified: branches/ros-csrss/dll/win32/kernel32/client/proc.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/cl…
============================================================================== --- branches/ros-csrss/dll/win32/kernel32/client/proc.c [iso-8859-1] (original) +++ branches/ros-csrss/dll/win32/kernel32/client/proc.c [iso-8859-1] Thu Jan 3 17:42:27 2013 @@ -12,7 +12,7 @@ #include <k32.h> -// #define NDEBUG +#define NDEBUG #include <debug.h> /* GLOBALS *******************************************************************/ @@ -511,7 +511,7 @@ sizeof(BASE_CREATE_THREAD)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(ApiMessage.Status)) { - DPRINT1("Failed to tell csrss about new thread: %lx %lx\n", Status, ApiMessage.Status); + DPRINT1("Failed to tell CSRSS about new thread: %lx %lx\n", Status, ApiMessage.Status); return ApiMessage.Status; } @@ -590,14 +590,13 @@ } /* Call CSR */ - DPRINT1("Calling CsrClientCallServer from BasepCreateFirstThread...\n"); Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, NULL, CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepCreateProcess), sizeof(BASE_CREATE_PROCESS)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(ApiMessage.Status)) { - DPRINT1("Failed to tell csrss about new process: %lx %lx\n", Status, ApiMessage.Status); + DPRINT1("Failed to tell CSRSS about new process: %lx %lx\n", Status, ApiMessage.Status); return NULL; } @@ -1201,7 +1200,7 @@ return FALSE; } - /* Get the data out of the LCP reply */ + /* Get the data back */ *lpdwLevel = GetShutdownParametersRequest->Level; *lpdwFlags = GetShutdownParametersRequest->Flags; return TRUE; Modified: branches/ros-csrss/win32ss/user/consrv/coninput.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/coninput.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/coninput.c [iso-8859-1] Thu Jan 3 17:42:27 2013 @@ -88,6 +88,16 @@ InsertTailList(&Console->InputEvents, &ConInRec->ListEntry); SetEvent(Console->ActiveEvent); +/* + if (CsrNotifyWait(&Console->ReadWaitQueue, + WaitAny, + NULL, + NULL)) + { + ASSERT(Console->SatisfiedWaits == NULL); + Console->SatisfiedWaits = &Console->ReadWaitQueue; + } +*/ CsrNotifyWait(&Console->ReadWaitQueue, WaitAny, NULL, @@ -255,7 +265,7 @@ { current = CONTAINING_RECORD(current_entry, CONSOLE_PROCESS_DATA, ConsoleLink); current_entry = current_entry->Flink; - ConioConsoleCtrlEvent((DWORD)CTRL_C_EVENT, current); + ConioConsoleCtrlEvent(CTRL_C_EVENT, current); } if (Console->LineBuffer && !Console->LineComplete) { @@ -324,6 +334,7 @@ CapturedInputInfo, NULL)) { + /* Fail */ HeapFree(ConSrvHeap, 0, CapturedInputInfo); return STATUS_NO_MEMORY; } @@ -353,11 +364,46 @@ PCSRSS_GET_CONSOLE_INPUT GetConsoleInputRequest = &((PCONSOLE_API_MESSAGE)WaitApiMessage)->Data.GetConsoleInputRequest; PGET_INPUT_INFO InputInfo = (PGET_INPUT_INFO)WaitContext; + DWORD Flag = (DWORD)WaitArgument1; + BOOLEAN InputHandleClosing = (WaitArgument2 == (PVOID)0xdeaddead); + + DPRINT("ReadInputBufferThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags); + + /* + * If we are signaled by pressing Ctrl-C or Ctrl-Break, + * just ignore this event. + */ + if ( (Flag == 1 << CTRL_C_EVENT) || + (Flag == 1 << CTRL_BREAK_EVENT) ) + { + return FALSE; + } + + /* + * If we are called via CsrNotifyWaitBlock by a call to + * CsrDestroyProcess or CsrDestroyThread, just return. + */ + if (WaitFlags & CsrProcessTerminating) + { + Status = STATUS_THREAD_IS_TERMINATING; + goto Quit; + } + + /* + * If we are about to close an input handle, then just return. + */ + if (InputHandleClosing) + { + Status = STATUS_ALERTED; + goto Quit; + } + Status = ReadInputBuffer(InputInfo, GetConsoleInputRequest->bRead, WaitApiMessage, FALSE); +Quit: if (Status != STATUS_PENDING) { WaitApiMessage->Status = Status; @@ -450,10 +496,38 @@ NTSTATUS Status; PGET_INPUT_INFO InputInfo = (PGET_INPUT_INFO)WaitContext; + DWORD Flag = (DWORD)WaitArgument1; + BOOLEAN InputHandleClosing = (WaitArgument2 == (PVOID)0xdeaddead); + + DPRINT("ReadCharsThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags); + + /* + * If we are called via CsrNotifyWaitBlock by a call to + * CsrDestroyProcess or CsrDestroyThread, just return. + */ + if (WaitFlags & CsrProcessTerminating) + { + Status = STATUS_THREAD_IS_TERMINATING; + goto Quit; + } + + /* + * If we are signaled by pressing Ctrl-C or Ctrl-Break, + * or that we close an input handle, then just return. + */ + if ( (Flag == 1 << CTRL_C_EVENT) || + (Flag == 1 << CTRL_BREAK_EVENT) || + (InputHandleClosing == TRUE) ) + { + Status = STATUS_ALERTED; + goto Quit; + } + Status = ReadChars(InputInfo, WaitApiMessage, FALSE); +Quit: if (Status != STATUS_PENDING) { WaitApiMessage->Status = Status; @@ -479,6 +553,7 @@ /* We haven't read anything (yet) */ + // Cooked-like mode if (InputInfo->Console->Mode & ENABLE_LINE_INPUT) { if (InputInfo->Console->LineBuffer == NULL) @@ -563,7 +638,7 @@ WaitForMoreToRead = FALSE; } } - else + else // Raw-like mode { /* Character input */ while ( ReadConsoleRequest->NrCharactersRead < nNumberOfCharsToRead && Modified: branches/ros-csrss/win32ss/user/consrv/conio.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] Thu Jan 3 17:42:27 2013 @@ -29,16 +29,17 @@ typedef struct tagCSRSS_SCREEN_BUFFER { Object_t Header; /* Object header */ - BYTE *Buffer; /* pointer to screen buffer */ - USHORT MaxX, MaxY; /* size of the entire scrollback buffer */ - USHORT ShowX, ShowY; /* beginning offset for the actual display area */ + LIST_ENTRY ListEntry; /* Entry in console's list of buffers */ + + BYTE *Buffer; /* Pointer to screen buffer */ + USHORT MaxX, MaxY; /* Size of the entire scrollback buffer */ + USHORT ShowX, ShowY; /* Beginning offset for the actual display area */ ULONG CurrentX; /* Current X cursor position */ ULONG CurrentY; /* Current Y cursor position */ - WORD DefaultAttrib; /* default char attribute */ - USHORT VirtualY; /* top row of buffer being displayed, reported to callers */ + WORD DefaultAttrib; /* Default char attribute */ + USHORT VirtualY; /* Top row of buffer being displayed, reported to callers */ CONSOLE_CURSOR_INFO CursorInfo; USHORT Mode; - LIST_ENTRY ListEntry; /* entry in console's list of buffers */ } CSRSS_SCREEN_BUFFER, *PCSRSS_SCREEN_BUFFER; typedef struct tagCSRSS_CONSOLE @@ -76,6 +77,15 @@ BYTE PauseFlags; HANDLE UnpauseEvent; LIST_ENTRY WriteWaitQueue; /* List head for the queue of write wait blocks */ + +#if 0 + /* Pointers to lists of wait blocks, when they contain satisfied waits to be freed */ + PLIST_ENTRY SatisfiedWaits; + + /* Pointers to lists of wait blocks, when they contain satisfied waits to be freed */ + PLIST_ENTRY ReadSatisfiedWaits; + PLIST_ENTRY WriteSatisfiedWaits; +#endif WORD Mode; /* Console mode flags */ UNICODE_STRING Title; /* Title of console */ Modified: branches/ros-csrss/win32ss/user/consrv/conoutput.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/conoutput.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/conoutput.c [iso-8859-1] Thu Jan 3 17:42:27 2013 @@ -447,10 +447,23 @@ { NTSTATUS Status; + DPRINT("WriteConsoleThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags); + + /* + * If we are called via CsrNotifyWaitBlock by a call to + * CsrDestroyProcess or CsrDestroyThread, just return. + */ + if (WaitFlags & CsrProcessTerminating) + { + Status = STATUS_THREAD_IS_TERMINATING; + goto Quit; + } + Status = DoWriteConsole(WaitApiMessage, WaitThread, FALSE); +Quit: if (Status != STATUS_PENDING) { WaitApiMessage->Status = Status; Modified: branches/ros-csrss/win32ss/user/consrv/console.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] Thu Jan 3 17:42:27 2013 @@ -64,6 +64,42 @@ DPRINT("ConioConsoleCtrlEvent Parent ProcessId = %x\n", ProcessData->Process->ClientId.UniqueProcess); + /* Notify all the waits only if we see Ctrl-C or Ctrl-Break */ + if (Event == CTRL_C_EVENT || Event == CTRL_BREAK_EVENT) + { + DWORD Flag = (1 << Event); // Transform an integer value to a power of 2. + NTSTATUS Status; + PCSRSS_CONSOLE Console; + // LIST_ENTRY WaitQueue; + + DPRINT1("ConioConsoleCtrlEvent - Ctrl-C captured\n"); + Status = ConioConsoleFromProcessData(ProcessData, &Console); + if (NT_SUCCESS(Status)) + { + DPRINT1("ConioConsoleCtrlEvent - console captured, try to dereference waits...\n"); + /* + * Wake-up all of the writing waiters, dereference them + * and purge them all from the list. + */ + if (CsrNotifyWait(&Console->ReadWaitQueue, + WaitAll, + (PVOID)Flag, + NULL)) + { + DPRINT1("ConioConsoleCtrlEvent - waits dereferenced...\n"); + // InitializeListHead(&WaitQueue); + + // CsrMoveSatisfiedWait(&WaitQueue, &Console->ReadWaitQueue); + if (!IsListEmpty(&Console->ReadWaitQueue /* &WaitQueue */)) + { + CsrDereferenceWait(&Console->ReadWaitQueue /* &WaitQueue */); + } + } + ConioUnlockConsole(Console); // NOTE_WAITS: <-- Here we have the possibility to free the console waits also. + } + } + + /* Notify the process of the control event */ if (ProcessData->CtrlDispatcher) { Thread = CreateRemoteThread(ProcessData->Process->ProcessHandle, NULL, 0, @@ -130,6 +166,7 @@ InitializeListHead(&Console->ProcessList); InitializeListHead(&Console->BufferList); Console->ActiveBuffer = NULL; + // Console->SatisfiedWaits = NULL; InitializeListHead(&Console->ReadWaitQueue); InitializeListHead(&Console->WriteWaitQueue); InitializeListHead(&Console->InputEvents); @@ -453,6 +490,9 @@ DPRINT("ConioDeleteConsole\n"); + /* TODO: Dereference all the waits in Console->ReadWaitQueue */ + /* TODO: Dereference all the waits in Console->WriteWaitQueue */ + /* Drain input event queue */ while (Console->InputEvents.Flink != &Console->InputEvents) { @@ -501,6 +541,8 @@ VOID FASTCALL ConioUnpause(PCSRSS_CONSOLE Console, UINT Flags) { + // LIST_ENTRY WaitQueue; + Console->PauseFlags &= ~Flags; // if ((Console->PauseFlags & (PAUSED_FROM_KEYBOARD | PAUSED_FROM_SCROLLBAR | PAUSED_FROM_SELECTION)) == 0) @@ -510,10 +552,23 @@ CloseHandle(Console->UnpauseEvent); Console->UnpauseEvent = NULL; - CsrNotifyWait(&Console->WriteWaitQueue, - WaitAll, - NULL, - NULL); + /* + * Wake-up all of the writing waiters, dereference them + * and purge them all from the list. + */ + if (CsrNotifyWait(&Console->WriteWaitQueue, + WaitAll, + NULL, + NULL)) + { + // InitializeListHead(&WaitQueue); + + // CsrMoveSatisfiedWait(&WaitQueue, &Console->WriteWaitQueue); + if (!IsListEmpty(&Console->WriteWaitQueue /* &WaitQueue */)) + { + CsrDereferenceWait(&Console->WriteWaitQueue /* &WaitQueue */); + } + } } } Modified: branches/ros-csrss/win32ss/user/consrv/handle.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/h…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] Thu Jan 3 17:42:27 2013 @@ -11,7 +11,7 @@ #include "consrv.h" #include "conio.h" -//#define NDEBUG +#define NDEBUG #include <debug.h> @@ -47,10 +47,32 @@ Win32CsrCloseHandleEntry(PCSRSS_HANDLE Entry) { Object_t *Object = Entry->Object; + if (Object != NULL) { PCSRSS_CONSOLE Console = Object->Console; EnterCriticalSection(&Console->Lock); + + if (Object->Type == CONIO_CONSOLE_MAGIC) + { + // LIST_ENTRY WaitQueue; + + /* + * Wake-up all of the writing waiters if any, dereference them + * and purge them all from the list. + */ + CsrNotifyWait(&Console->ReadWaitQueue, + WaitAll, + NULL, + (PVOID)0xdeaddead); + // InitializeListHead(&WaitQueue); + + // CsrMoveSatisfiedWait(&WaitQueue, &Console->ReadWaitQueue); + if (!IsListEmpty(&Console->ReadWaitQueue /* &WaitQueue */)) + { + CsrDereferenceWait(&Console->ReadWaitQueue /* &WaitQueue */); + } + } /* If the last handle to a screen buffer is closed, delete it... */ if (AdjustHandleCounts(Entry, -1) == 0) @@ -143,8 +165,6 @@ RtlLeaveCriticalSection(&ProcessData->HandleTableLock); return STATUS_INVALID_HANDLE; } - - DPRINT1("Win32CsrReleaseObject - Process 0x%p, Release 0x%p\n", ProcessData->Process, &ProcessData->HandleTable[h]); Win32CsrCloseHandleEntry(&ProcessData->HandleTable[h]); RtlLeaveCriticalSection(&ProcessData->HandleTableLock); @@ -189,6 +209,23 @@ Win32CsrUnlockConsole(PCSRSS_CONSOLE Console) { LeaveCriticalSection(&Console->Lock); + +#if 0 + /* If it was the last held lock for the owning thread... */ + if (&Console->Lock.RecursionCount == 0) + { + /* ...dereference waiting threads if any */ + LIST_ENTRY WaitQueue; + InitializeListHead(&WaitQueue); + + CsrMoveSatisfiedWait(&WaitQueue, Console->SatisfiedWaits); + Console->SatisfiedWaits = NULL; + if (!IsListEmpty(&WaitQueue)) + { + CsrDereferenceWait(&WaitQueue); + } + } +#endif /* Decrement reference count */ if (_InterlockedDecrement(&Console->ReferenceCount) == 0)
11 years, 11 months
1
0
0
0
[hbelusca] 58103: [BASESRV] Remove a temporary DPRINT1. [CSRSRV] - Shut down debug output. - Fix some misspellings. - Fix a bug in CsrMoveSatisfiedWaits ("satisfied" waits are waits where WaitFunct...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu Jan 3 17:18:19 2013 New Revision: 58103 URL:
http://svn.reactos.org/svn/reactos?rev=58103&view=rev
Log: [BASESRV] Remove a temporary DPRINT1. [CSRSRV] - Shut down debug output. - Fix some misspellings. - Fix a bug in CsrMoveSatisfiedWaits ("satisfied" waits are waits where WaitFunction was put to NULL during a previous call to CsrNotifyWait, but still not dereferenced, and which can be dereferenced by a call to CsrDereferenceWait). Modified: branches/ros-csrss/subsystems/win/basesrv/server.c branches/ros-csrss/subsystems/win32/csrsrv/api.c branches/ros-csrss/subsystems/win32/csrsrv/init.c branches/ros-csrss/subsystems/win32/csrsrv/procsup.c branches/ros-csrss/subsystems/win32/csrsrv/wait.c Modified: branches/ros-csrss/subsystems/win/basesrv/server.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/basesr…
============================================================================== --- branches/ros-csrss/subsystems/win/basesrv/server.c [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win/basesrv/server.c [iso-8859-1] Thu Jan 3 17:18:19 2013 @@ -83,7 +83,7 @@ } if ((Flags & 2) == 0) { - DPRINT1("BaseSrvCreateProcess - Launching a Console process\n"); + /* We are launching a console process */ DebugFlags |= CsrProcessIsConsoleApp; } Modified: branches/ros-csrss/subsystems/win32/csrsrv/api.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
============================================================================== --- branches/ros-csrss/subsystems/win32/csrsrv/api.c [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win32/csrsrv/api.c [iso-8859-1] Thu Jan 3 17:18:19 2013 @@ -11,7 +11,7 @@ #include "srv.h" -//#define NDEBUG +#define NDEBUG #include <debug.h> /* GLOBALS ********************************************************************/ @@ -1329,7 +1329,7 @@ * @param ElementSize * Size of each element. * - * @return TRUE if validation suceeded, FALSE otherwise. + * @return TRUE if validation succeeded, FALSE otherwise. * * @remarks None. * @@ -1447,7 +1447,7 @@ * @param MessageString * Pointer to the buffer containing the string to validate. * - * @return TRUE if validation suceeded, FALSE otherwise. + * @return TRUE if validation succeeded, FALSE otherwise. * * @remarks None. * Modified: branches/ros-csrss/subsystems/win32/csrsrv/init.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
============================================================================== --- branches/ros-csrss/subsystems/win32/csrsrv/init.c [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win32/csrsrv/init.c [iso-8859-1] Thu Jan 3 17:18:19 2013 @@ -25,7 +25,7 @@ HANDLE CsrSmApiPort = NULL; HANDLE hSbApiPort = NULL; HANDLE CsrApiPort = NULL; -ULONG CsrDebug = 0xFFFFFFFF; // 0; +ULONG CsrDebug = 0; // 0xFFFFFFFF; ULONG CsrMaxApiRequestThreads; ULONG CsrTotalPerProcessDataLength; ULONG SessionId; Modified: branches/ros-csrss/subsystems/win32/csrsrv/procsup.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
============================================================================== --- branches/ros-csrss/subsystems/win32/csrsrv/procsup.c [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win32/csrsrv/procsup.c [iso-8859-1] Thu Jan 3 17:18:19 2013 @@ -1007,7 +1007,7 @@ * @param CsrThread * Pointer to the CSR Thread to impersonate. * - * @return TRUE if impersionation suceeded, false otherwise. + * @return TRUE if impersonation succeeded, false otherwise. * * @remarks Impersonation can be recursive. * Modified: branches/ros-csrss/subsystems/win32/csrsrv/wait.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
============================================================================== --- branches/ros-csrss/subsystems/win32/csrsrv/wait.c [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win32/csrsrv/wait.c [iso-8859-1] Thu Jan 3 17:18:19 2013 @@ -127,13 +127,13 @@ IN BOOLEAN DereferenceThread) { /* Call the wait function */ - if ((WaitBlock->WaitFunction)(WaitList, - WaitBlock->WaitThread, - &WaitBlock->WaitApiMessage, - WaitBlock->WaitContext, - WaitArgument1, - WaitArgument2, - WaitFlags)) + if (WaitBlock->WaitFunction(WaitList, + WaitBlock->WaitThread, + &WaitBlock->WaitApiMessage, + WaitBlock->WaitContext, + WaitArgument1, + WaitArgument2, + WaitFlags)) { /* The wait is done, clear the block */ WaitBlock->WaitThread->WaitBlock = NULL; @@ -175,11 +175,11 @@ /* The wait is complete, but the thread is being kept alive */ WaitBlock->WaitFunction = NULL; } - - /* The wait suceeded */ + + /* The wait succeeded */ return TRUE; } - + /* The wait failed */ return FALSE; } @@ -297,8 +297,8 @@ /* Move to the next entry */ NextEntry = NextEntry->Flink; - /* Check if there's no Wait Routine */ - if (!WaitBlock->WaitFunction) + /* Check if there's no Wait Routine (satisfied wait) */ + if (WaitBlock->WaitFunction == NULL) { /* Remove it from the Wait List */ if (WaitBlock->WaitList.Flink) @@ -366,8 +366,8 @@ /* Go to the next entry */ NextEntry = NextEntry->Flink; - /* Check if there is a Wait Callback */ - if (WaitBlock->WaitFunction) + /* Check if there's no Wait Routine (satisfied wait) */ + if (WaitBlock->WaitFunction == NULL) { /* Remove it from the Wait Block Queue */ RemoveEntryList(&WaitBlock->WaitList); @@ -427,8 +427,8 @@ /* Go to the next entry */ NextEntry = NextEntry->Flink; - /* Check if there is a Wait Callback */ - if (WaitBlock->WaitFunction) + /* Check if there is a Wait Routine */ + if (WaitBlock->WaitFunction != NULL) { /* Notify the Waiter */ NotifySuccess |= CsrNotifyWaitBlock(WaitBlock,
11 years, 11 months
1
0
0
0
[tkreuzer] 58102: [WIN32K] Handle references to DC selected fonts, so we don't leak them or use fonts that are already deleted.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Jan 3 08:45:00 2013 New Revision: 58102 URL:
http://svn.reactos.org/svn/reactos?rev=58102&view=rev
Log: [WIN32K] Handle references to DC selected fonts, so we don't leak them or use fonts that are already deleted. Modified: trunk/reactos/win32ss/gdi/ntgdi/dc.h trunk/reactos/win32ss/gdi/ntgdi/dclife.c trunk/reactos/win32ss/gdi/ntgdi/dcstate.c trunk/reactos/win32ss/gdi/ntgdi/font.c trunk/reactos/win32ss/gdi/ntgdi/gdibatch.c Modified: trunk/reactos/win32ss/gdi/ntgdi/dc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dc.h?rev…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dc.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dc.h [iso-8859-1] Thu Jan 3 08:45:00 2013 @@ -66,7 +66,7 @@ POINTL ptlBrushOrigin; PBRUSH pbrFill; PBRUSH pbrLine; - PVOID plfnt; /* LFONTOBJ* (TEXTOBJ*) */ + _Notnull_ struct _LFONT * plfnt; /* LFONT* (TEXTOBJ*) */ HGDIOBJ hPath; /* HPATH */ FLONG flPath; LINEATTRS laPath; /* 0x20 bytes */ @@ -110,7 +110,7 @@ PVOID hsem; /* PERESOURCE aka HSEMAPHORE */ FLONG flGraphicsCaps; FLONG flGraphicsCaps2; - PDC_ATTR pdcattr; + _Notnull_ PDC_ATTR pdcattr; DCLEVEL dclevel; DC_ATTR dcattr; HDC hdcNext; @@ -155,18 +155,27 @@ VOID FASTCALL DC_vUpdateTextBrush(PDC pdc); VOID FASTCALL DC_vUpdateBackgroundBrush(PDC pdc); +HFONT +NTAPI +DC_hSelectFont( + _In_ PDC pdc, + _In_ HFONT hlfntNew); + HPALETTE NTAPI GdiSelectPalette( - HDC hDC, - HPALETTE hpal, - BOOL ForceBackground); + _In_ HDC hDC, + _In_ HPALETTE hpal, + _In_ BOOL ForceBackground); /* dcutil.c */ COLORREF FASTCALL -IntGdiSetBkColor (HDC hDC, COLORREF Color); +IntGdiSetBkColor( + _In_ HDC hDC, + _In_ COLORREF Color); + INT FASTCALL IntGdiSetBkMode(HDC hDC, INT backgroundMode); COLORREF FASTCALL IntGdiSetTextColor(HDC hDC, COLORREF color); UINT FASTCALL IntGdiSetTextAlign(HDC hDC, UINT Mode); @@ -211,14 +220,26 @@ PDC DC_LockDc(HDC hdc) { - //if (GDI_HANDLE_GET_TYPE(hdc) != GDILoObjType_LO_DC_TYPE) return NULL; ??? - return GDIOBJ_LockObject(hdc, GDIObjType_DC_TYPE); + PDC pdc; + + pdc = GDIOBJ_LockObject(hdc, GDIObjType_DC_TYPE); + if (pdc) + { + ASSERT(GDI_HANDLE_GET_TYPE(pdc->BaseObject.hHmgr) == GDILoObjType_LO_DC_TYPE); + ASSERT(pdc->dclevel.plfnt != NULL); + ASSERT(GDI_HANDLE_GET_TYPE(((POBJ)pdc->dclevel.plfnt)->hHmgr) == GDILoObjType_LO_FONT_TYPE); + } + + return pdc; } FORCEINLINE VOID DC_UnlockDc(PDC pdc) { + ASSERT(pdc->dclevel.plfnt != NULL); + ASSERT(GDI_HANDLE_GET_TYPE(((POBJ)pdc->dclevel.plfnt)->hHmgr) == GDILoObjType_LO_FONT_TYPE); + GDIOBJ_vUnlockObject(&pdc->BaseObject); } Modified: trunk/reactos/win32ss/gdi/ntgdi/dclife.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dclife.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dclife.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dclife.c [iso-8859-1] Thu Jan 3 08:45:00 2013 @@ -319,7 +319,7 @@ pdc->dcattr.lBreakExtra = 0; pdc->dcattr.cBreak = 0; pdc->dcattr.hlfntNew = StockObjects[SYSTEM_FONT]; -// pdc->dclevel.pFont = LFONT_ShareLockFont(pdc->dcattr.hlfntNew); + pdc->dclevel.plfnt = LFONT_ShareLockFont(pdc->dcattr.hlfntNew); /* Other stuff */ pdc->hdcNext = NULL; @@ -367,6 +367,9 @@ EBRUSHOBJ_vCleanup(&pdc->eboLine); EBRUSHOBJ_vCleanup(&pdc->eboText); EBRUSHOBJ_vCleanup(&pdc->eboBackground); + + /* Release font */ + LFONT_ShareUnlockFont(pdc->dclevel.plfnt); /* Free regions */ if (pdc->rosdc.hClipRgn && GreIsHandleValid(pdc->rosdc.hClipRgn)) Modified: trunk/reactos/win32ss/gdi/ntgdi/dcstate.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dcstate.…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dcstate.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dcstate.c [iso-8859-1] Thu Jan 3 08:45:00 2013 @@ -45,7 +45,9 @@ DC_vSelectLineBrush(pdcDst, pdcSrc->dclevel.pbrLine); DC_vSelectPalette(pdcDst, pdcSrc->dclevel.ppal); - // FIXME: Handle refs + /* Dereference the old font, reference the new one */ + if (pdcDst->dclevel.plfnt) LFONT_ShareUnlockFont(pdcDst->dclevel.plfnt); /// @todo should aways be != NULL + GDIOBJ_vReferenceObjectByPointer(&pdcSrc->dclevel.plfnt->BaseObject); pdcDst->dclevel.plfnt = pdcSrc->dclevel.plfnt; /* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */ Modified: trunk/reactos/win32ss/gdi/ntgdi/font.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/font.c?r…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/font.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/font.c [iso-8859-1] Thu Jan 3 08:45:00 2013 @@ -426,6 +426,8 @@ { hOrgFont = pdcattr->hlfntNew; } + if (pdc->dclevel.plfnt) LFONT_ShareUnlockFont(pdc->dclevel.plfnt); + if (pNewFnt) GDIOBJ_vReferenceObjectByPointer(&pNewFnt->BaseObject); pdc->dclevel.plfnt = pNewFnt; pdc->hlfntCur = hFont; pdcattr->hlfntNew = hFont; Modified: trunk/reactos/win32ss/gdi/ntgdi/gdibatch.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdibatch…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/gdibatch.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/gdibatch.c [iso-8859-1] Thu Jan 3 08:45:00 2013 @@ -127,6 +127,8 @@ /* LFONTOBJ use share and locking. */ pNewFnt = TEXTOBJ_LockText(pgO->hgdiobj); + if (dc->dclevel.plfnt) LFONT_ShareUnlockFont(dc->dclevel.plfnt); + if (pNewFnt) GDIOBJ_vReferenceObjectByPointer(&pNewFnt->BaseObject); dc->dclevel.plfnt = pNewFnt; dc->hlfntCur = pgO->hgdiobj; pdcattr->hlfntNew = pgO->hgdiobj;
11 years, 11 months
1
0
0
0
[tkreuzer] 58101: [WIN32K] Revert the revert from r58091 and apply a correct fix (passed parameters to RECTL_vSetRect() in wrong order)
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Jan 2 14:52:34 2013 New Revision: 58101 URL:
http://svn.reactos.org/svn/reactos?rev=58101&view=rev
Log: [WIN32K] Revert the revert from r58091 and apply a correct fix (passed parameters to RECTL_vSetRect() in wrong order) Modified: trunk/reactos/win32ss/gdi/ntgdi/dib.h trunk/reactos/win32ss/gdi/ntgdi/dibobj.c trunk/reactos/win32ss/user/ntuser/clipboard.c trunk/reactos/win32ss/user/ntuser/misc/file.c Modified: trunk/reactos/win32ss/gdi/ntgdi/dib.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dib.h?re…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dib.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dib.h [iso-8859-1] Wed Jan 2 14:52:34 2013 @@ -7,8 +7,11 @@ INT APIENTRY DIB_GetDIBImageBytes (INT width, INT height, INT depth); HPALETTE FASTCALL DIB_MapPaletteColors(PPALETTE ppal, CONST BITMAPINFO* lpbmi); HPALETTE FASTCALL BuildDIBPalette (CONST BITMAPINFO *bmi); + +/* Those functions permit to tranparently work with a BITMAPCOREINFO structure */ BITMAPINFO* FASTCALL DIB_ConvertBitmapInfo(CONST BITMAPINFO* bmi, DWORD Usage); -VOID FASTCALL DIB_FreeConvertedBitmapInfo(BITMAPINFO* converted, BITMAPINFO* orig); +/* Pass Usage = -1 if you don't want to convert the BITMAPINFO back to BITMAPCOREINFO */ +VOID FASTCALL DIB_FreeConvertedBitmapInfo(BITMAPINFO* converted, BITMAPINFO* orig, DWORD Usage); INT APIENTRY Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dibobj.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] Wed Jan 2 14:52:34 2013 @@ -584,7 +584,6 @@ DWORD compr, size ; USHORT i; int bitmap_type; - RGBTRIPLE* rgbTriples; RGBQUAD* rgbQuads; VOID* colorPtr; @@ -594,7 +593,6 @@ return 0; colorPtr = (LPBYTE)Info + Info->bmiHeader.biSize; - rgbTriples = colorPtr; rgbQuads = colorPtr; bitmap_type = DIB_GetBitmapInfo(&Info->bmiHeader, @@ -643,15 +641,6 @@ switch(bpp) { case 0: /* Only info */ - if(pbmci) - { - pbmci->bmciHeader.bcWidth = (WORD)psurf->SurfObj.sizlBitmap.cx; - pbmci->bmciHeader.bcHeight = (WORD)((psurf->SurfObj.fjBitmap & BMF_TOPDOWN) ? - -psurf->SurfObj.sizlBitmap.cy : - psurf->SurfObj.sizlBitmap.cy); - pbmci->bmciHeader.bcPlanes = 1; - pbmci->bmciHeader.bcBitCount = BitsPerFormat(psurf->SurfObj.iBitmapFormat); - } Info->bmiHeader.biWidth = psurf->SurfObj.sizlBitmap.cx; Info->bmiHeader.biHeight = (psurf->SurfObj.fjBitmap & BMF_TOPDOWN) ? -psurf->SurfObj.sizlBitmap.cy : @@ -702,16 +691,6 @@ if(Usage == DIB_RGB_COLORS) { ULONG colors = min(psurf->ppal->NumColors, 256); - - if(pbmci) - { - for(i = 0; i < colors; i++) - { - rgbTriples[i].rgbtRed = psurf->ppal->IndexedColors[i].peRed; - rgbTriples[i].rgbtGreen = psurf->ppal->IndexedColors[i].peGreen; - rgbTriples[i].rgbtBlue = psurf->ppal->IndexedColors[i].peBlue; - } - } if(colors != 256) Info->bmiHeader.biClrUsed = colors; for(i = 0; i < colors; i++) { @@ -724,10 +703,7 @@ else { for(i = 0; i < 256; i++) - { - if(pbmci) ((WORD*)rgbTriples)[i] = i; ((WORD*)rgbQuads)[i] = i; - } } } else @@ -736,7 +712,6 @@ { for(i = 0; i < 256; i++) { - if(pbmci) ((WORD*)rgbTriples)[i] = i; ((WORD*)rgbQuads)[i] = i; } } @@ -753,13 +728,6 @@ } for (i = 0; i < pDcPal->NumColors; i++) { - if (pbmci) - { - rgbTriples[i].rgbtRed = pDcPal->IndexedColors[i].peRed; - rgbTriples[i].rgbtGreen = pDcPal->IndexedColors[i].peGreen; - rgbTriples[i].rgbtBlue = pDcPal->IndexedColors[i].peBlue; - } - rgbQuads[i].rgbRed = pDcPal->IndexedColors[i].peRed; rgbQuads[i].rgbGreen = pDcPal->IndexedColors[i].peGreen; rgbQuads[i].rgbBlue = pDcPal->IndexedColors[i].peBlue; @@ -772,55 +740,20 @@ switch (bpp) { case 1: - if (pbmci) - { - rgbTriples[0].rgbtRed = rgbTriples[0].rgbtGreen = - rgbTriples[0].rgbtBlue = 0; - rgbTriples[1].rgbtRed = rgbTriples[1].rgbtGreen = - rgbTriples[1].rgbtBlue = 0xff; - } - rgbQuads[0].rgbRed = rgbQuads[0].rgbGreen = - rgbQuads[0].rgbBlue = 0; + rgbQuads[0].rgbRed = rgbQuads[0].rgbGreen = rgbQuads[0].rgbBlue = 0; rgbQuads[0].rgbReserved = 0; - rgbQuads[1].rgbRed = rgbQuads[1].rgbGreen = - rgbQuads[1].rgbBlue = 0xff; + rgbQuads[1].rgbRed = rgbQuads[1].rgbGreen = rgbQuads[1].rgbBlue = 0xff; rgbQuads[1].rgbReserved = 0; break; case 4: - if (pbmci) - RtlCopyMemory(rgbTriples, EGAColorsTriples, sizeof(EGAColorsTriples)); RtlCopyMemory(rgbQuads, EGAColorsQuads, sizeof(EGAColorsQuads)); - break; case 8: { INT r, g, b; RGBQUAD *color; - if (pbmci) - { - RGBTRIPLE *colorTriple; - - RtlCopyMemory(rgbTriples, DefLogPaletteTriples, - 10 * sizeof(RGBTRIPLE)); - RtlCopyMemory(rgbTriples + 246, DefLogPaletteTriples + 10, - 10 * sizeof(RGBTRIPLE)); - colorTriple = rgbTriples + 10; - for(r = 0; r <= 5; r++) /* FIXME */ - { - for(g = 0; g <= 5; g++) - { - for(b = 0; b <= 5; b++) - { - colorTriple->rgbtRed = (r * 0xff) / 5; - colorTriple->rgbtGreen = (g * 0xff) / 5; - colorTriple->rgbtBlue = (b * 0xff) / 5; - colorTriple++; - } - } - } - } memcpy(rgbQuads, DefLogPaletteQuads, 10 * sizeof(RGBQUAD)); memcpy(rgbQuads + 246, DefLogPaletteQuads + 10, @@ -935,12 +868,7 @@ psurfDest = SURFACE_ShareLockSurface(hBmpDest); - RECTL_vSetRect(&rcDest, 0, 0, ScanLines, psurf->SurfObj.sizlBitmap.cx); - - rcDest.left = 0; - rcDest.top = 0; - rcDest.bottom = ScanLines; - rcDest.right = psurf->SurfObj.sizlBitmap.cx; + RECTL_vSetRect(&rcDest, 0, 0, psurf->SurfObj.sizlBitmap.cx, ScanLines); srcPoint.x = 0; @@ -990,7 +918,7 @@ if(pDC) DC_UnlockDc(pDC); if(psurf) SURFACE_ShareUnlockSurface(psurf); - if(pbmci) DIB_FreeConvertedBitmapInfo(Info, (BITMAPINFO*)pbmci); + if(pbmci) DIB_FreeConvertedBitmapInfo(Info, (BITMAPINFO*)pbmci, Usage); return ScanLines; } @@ -1929,10 +1857,51 @@ /* Frees a BITMAPINFO created with DIB_ConvertBitmapInfo */ VOID FASTCALL -DIB_FreeConvertedBitmapInfo(BITMAPINFO* converted, BITMAPINFO* orig) -{ - if(converted != orig) +DIB_FreeConvertedBitmapInfo(BITMAPINFO* converted, BITMAPINFO* orig, DWORD usage) +{ + BITMAPCOREINFO* pbmci; + if(converted == orig) + return; + + if(usage == -1) + { + /* Caller don't want any conversion */ ExFreePoolWithTag(converted, TAG_DIB); + return; + } + + /* Perform inverse conversion */ + pbmci = (BITMAPCOREINFO*)orig; + + ASSERT(pbmci->bmciHeader.bcSize == sizeof(BITMAPCOREHEADER)); + pbmci->bmciHeader.bcBitCount = converted->bmiHeader.biBitCount; + pbmci->bmciHeader.bcWidth = converted->bmiHeader.biWidth; + pbmci->bmciHeader.bcHeight = converted->bmiHeader.biHeight; + pbmci->bmciHeader.bcPlanes = converted->bmiHeader.biPlanes; + + if(pbmci->bmciHeader.bcBitCount <= 8) + { + UINT numColors = converted->bmiHeader.biClrUsed; + if(!numColors) numColors = 1 << pbmci->bmciHeader.bcBitCount; + if(usage == DIB_PAL_COLORS) + { + RtlZeroMemory(pbmci->bmciColors, (1 << pbmci->bmciHeader.bcBitCount) * sizeof(WORD)); + RtlCopyMemory(pbmci->bmciColors, converted->bmiColors, numColors * sizeof(WORD)); + } + else + { + UINT i; + RtlZeroMemory(pbmci->bmciColors, (1 << pbmci->bmciHeader.bcBitCount) * sizeof(RGBTRIPLE)); + for(i=0; i<numColors; i++) + { + pbmci->bmciColors[i].rgbtRed = converted->bmiColors[i].rgbRed; + pbmci->bmciColors[i].rgbtGreen = converted->bmiColors[i].rgbGreen; + pbmci->bmciColors[i].rgbtBlue = converted->bmiColors[i].rgbBlue; + } + } + } + /* Now free it, it's not needed anymore */ + ExFreePoolWithTag(converted, TAG_DIB); } /* EOF */ Modified: trunk/reactos/win32ss/user/ntuser/clipboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/clipbo…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/clipboard.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/clipboard.c [iso-8859-1] Wed Jan 2 14:52:34 2013 @@ -276,7 +276,7 @@ UserReleaseDC(NULL, hdc, FALSE); if (pConvertedBmi) - DIB_FreeConvertedBitmapInfo(pConvertedBmi, pBmi); + DIB_FreeConvertedBitmapInfo(pConvertedBmi, pBmi, -1); } VOID static NTAPI Modified: trunk/reactos/win32ss/user/ntuser/misc/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/misc/f…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/misc/file.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/misc/file.c [iso-8859-1] Wed Jan 2 14:52:34 2013 @@ -233,7 +233,7 @@ 0); NtGdiDeleteObjectApp(hdc); - DIB_FreeConvertedBitmapInfo(pConvertedInfo, pbmi); + DIB_FreeConvertedBitmapInfo(pConvertedInfo, pbmi, -1); } else {
11 years, 11 months
1
0
0
0
[akhaldi] 58100: * Create a branch for JC's effort to manually maintain VS project files.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Jan 2 13:17:06 2013 New Revision: 58100 URL:
http://svn.reactos.org/svn/reactos?rev=58100&view=rev
Log: * Create a branch for JC's effort to manually maintain VS project files. Added: branches/vs_jc/ (props changed) - copied from r58099, trunk/reactos/ Propchange: branches/vs_jc/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Wed Jan 2 13:17:06 2013 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+) Propchange: branches/vs_jc/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details. Propchange: branches/vs_jc/ ------------------------------------------------------------------------------ bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/vs_jc/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Wed Jan 2 13:17:06 2013 @@ -1,0 +1,14 @@ +*.iso +makefile.auto +makefile-*.auto +config-*.rbuild +obj-* +output-* +reactos +reactos.* +RosBE-Logs +*.sln +*.ncb +*.suo +versionreport.xml +config.rbuild Propchange: branches/vs_jc/ ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Wed Jan 2 13:17:06 2013 @@ -1,0 +1,15 @@ +/branches/GSoC_2011/GSoC_Network:51548 +/branches/GSoC_2011/GSoC_TcpIpDriver:51550 +/branches/GSoC_2011/TcpIpDriver:51551-53074,53076-53119 +/branches/GSoC_Network:51545-51546 +/branches/cmake-bringup:50484,50693,50719,51544-52564 +/branches/header-work:45691-47721 +/branches/reactos-yarotows:45219-46371,46373-48025,48027-49273 +/branches/reactx/reactos:49994-49995 +/branches/ros-amd64-bringup:36852 +/branches/ros-amd64-bringup/reactos:34711-34712,34741,34743,34770,34780-34782,34803,34812,34839,34842,34864,34870,34874,34877,34908-34909,34917,34965,35323-35324,35347-35348,35361,35436,35509,35515,35588,35655,35683,35739,35746,35762,35771,35777,35781,35789,35805,35823,35827,35902,35904-35906,35942,35947-35949,35952-35953,35966,36011-36013,36172,36360,36380,36388-36389,36393,36397,36443,36445,36475,36502-36503,36505,36570,36614,36852,36898-36899,36930,36936,36949,36951,36958,36961,36964,36969,36972,36987-36988,36990,36992,37019,37322-37323,37333-37334,37434,37472,37475,37536,37820-37821,37868-37869,37873,37990-37991,38013-38014,38092,38100,38148-38151,38264-38265,38268,38355,39151,39333,39335,39345,39639,40120,40122-40123,40125,40127-40128,40155,40247,40324,40608,40753,40926-40928,40986-40987,40989,40991,40993,40995-40996,41000-41001,41027-41030,41044-41045,41047-41050,41052,41070,41082-41086,41097-41098,41101,41449,41479-41480,41483-41485,41499-41500,41502,41531,41536,41540,41546-41547,41549,43080,43426,43451,43454,43506,43566,43574,43598,43600-43602,43604-43605,43677,43682,43757,43775,43836,43838-43840,43852,43857-43858,43860,43905-43907,43952,43954,43965,43969,43979,43981,43992,44002,44036-44037,44039-44040,44044-44045,44053,44065,44095,44123,44143-44144,44205,44238,44257,44259,44294,44338-44339,44385,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44634,44639,44772,44818,45124,45126-45127,45430,46394,46404,46478,46511,46523-46524,46526,46534-46535,46537-46539,46589,46805,46868,47472,47846-47847,47878,47882 +/branches/shell32_new-bringup:51893-53652,53661,53700 +/branches/tcp-rewrite-branch:48720,48840-48841,49424-49426,49454 +/branches/usb-bringup:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859 +/branches/usb-bringup-trunk:55019-55543,55548-55554,55556-55567 +/branches/wlan-bringup:54809-54998 Propchange: branches/vs_jc/ ------------------------------------------------------------------------------ tsvn:logminsize = 10
11 years, 11 months
1
0
0
0
[tkreuzer] 58099: [GDI32] Set correct last error code in GetClipRgn. Fixes regression from r58089.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Jan 2 10:54:54 2013 New Revision: 58099 URL:
http://svn.reactos.org/svn/reactos?rev=58099&view=rev
Log: [GDI32] Set correct last error code in GetClipRgn. Fixes regression from r58089. Modified: trunk/reactos/win32ss/gdi/gdi32/objects/region.c Modified: trunk/reactos/win32ss/gdi/gdi32/objects/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/objects/…
============================================================================== --- trunk/reactos/win32ss/gdi/gdi32/objects/region.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/gdi32/objects/region.c [iso-8859-1] Wed Jan 2 10:54:54 2013 @@ -700,7 +700,18 @@ HRGN hrgn ) { - INT Ret = NtGdiGetRandomRgn(hdc, hrgn, CLIPRGN); + INT Ret; + + /* Check if DC handle is valid */ + if (!GdiGetDcAttr(hdc)) + { + /* Last error code differs from what NtGdiGetRandomRgn returns */ + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + Ret = NtGdiGetRandomRgn(hdc, hrgn, CLIPRGN); + // if (Ret) // { // if(GetLayout(hdc) & LAYOUT_RTL) MirrorRgnDC(hdc,(HRGN)Ret, NULL);
11 years, 11 months
1
0
0
0
[hbelusca] 58098: [CONSRV] - Fix console apps initialization. - Add some debug output (NOTE TO MYSELF: remove them when all things work). - Rewrite ConsoleNewProcess. - Reorganize SrvAllocConsole a...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Wed Jan 2 00:32:20 2013 New Revision: 58098 URL:
http://svn.reactos.org/svn/reactos?rev=58098&view=rev
Log: [CONSRV] - Fix console apps initialization. - Add some debug output (NOTE TO MYSELF: remove them when all things work). - Rewrite ConsoleNewProcess. - Reorganize SrvAllocConsole and create ConsoleConnect based on SrvAllocConsole. - Create ConsoleDisconnect which undoes what ConsoleConnect and ConsoleNewProcess did. - Rework a little bit CsrInitConsole. Now the console app. initialization algorithm is the following: 1- A process is created, its type (GUI or CUI) is determined (kernel32 and basesrv). 2- ConsoleNewProcess is called (consrv) and makes this new process inherit the console handles table from its parent (NOTE: this is done for all CUI processes, because at this point, we still don't know whether we must inherit the handles from the parent or not). 3- (back in kernel32) In BasepInitConsole, we determine whether or not we must create a new console window or use the parent's one or not using one at all. We (as a client) connect to the console server (consrv) (via CsrClientConnectToServer) which in turn (via CSRSS mechanism) calls ConsoleConnect. For GUI processes we do nothing. For CUI processes, we initialize a new console based on properties set in BasepInitConsole. 4- When a process dies, ConsoleDisconnect is called and whether it is a GUI or CUI process, we revert the actions done previously. Part 2/2 TODO: - Debug the CSR waits. - Work on the console properties property-sheet. - See what can be done on
http://jira.reactos.org/browse/CORE-122
Modified: branches/ros-csrss/win32ss/user/consrv/conio.h branches/ros-csrss/win32ss/user/consrv/conoutput.c branches/ros-csrss/win32ss/user/consrv/console.c branches/ros-csrss/win32ss/user/consrv/consrv.h branches/ros-csrss/win32ss/user/consrv/handle.c branches/ros-csrss/win32ss/user/consrv/init.c Modified: branches/ros-csrss/win32ss/user/consrv/conio.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] Wed Jan 2 00:32:20 2013 @@ -9,11 +9,6 @@ #pragma once #define CSR_DEFAULT_CURSOR_SIZE 25 - -/* Object type magic numbers */ - -#define CONIO_CONSOLE_MAGIC 0x00000001 -#define CONIO_SCREEN_BUFFER_MAGIC 0x00000002 /************************************************************************ * Screen buffer structure represents the win32 screen buffer object. * @@ -29,7 +24,7 @@ * being printed causes another line to scroll down, that the buffer IS * * memcpy()'s up, and the bottom of the buffer is still displayed, but * * internally, I just wrap back to the top of the buffer. * - ***********************************************************************/ + ************************************************************************/ typedef struct tagCSRSS_SCREEN_BUFFER { @@ -149,7 +144,7 @@ /* console.c */ NTSTATUS FASTCALL ConioConsoleFromProcessData(PCONSOLE_PROCESS_DATA ProcessData, PCSRSS_CONSOLE *Console); -VOID WINAPI ConioDeleteConsole(Object_t *Object); +VOID WINAPI ConioDeleteConsole(PCSRSS_CONSOLE Console); VOID WINAPI CsrInitConsoleSupport(VOID); VOID FASTCALL ConioPause(PCSRSS_CONSOLE Console, UINT Flags); VOID FASTCALL ConioUnpause(PCSRSS_CONSOLE Console, UINT Flags); Modified: branches/ros-csrss/win32ss/user/consrv/conoutput.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/conoutput.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/conoutput.c [iso-8859-1] Wed Jan 2 00:32:20 2013 @@ -489,58 +489,60 @@ NULL, NULL)) { + /* Fail */ ConioUnlockScreenBuffer(Buff); return STATUS_NO_MEMORY; } } /* Wait until we un-pause the console */ - ConioUnlockScreenBuffer(Buff); - return STATUS_PENDING; - } - - if(WriteConsoleRequest->Unicode) - { - Length = WideCharToMultiByte(Console->OutputCodePage, 0, - (PWCHAR)WriteConsoleRequest->Buffer, - WriteConsoleRequest->NrCharactersToWrite, - NULL, 0, NULL, NULL); - Buffer = RtlAllocateHeap(GetProcessHeap(), 0, Length); + Status = STATUS_PENDING; + } + else + { + if(WriteConsoleRequest->Unicode) + { + Length = WideCharToMultiByte(Console->OutputCodePage, 0, + (PWCHAR)WriteConsoleRequest->Buffer, + WriteConsoleRequest->NrCharactersToWrite, + NULL, 0, NULL, NULL); + Buffer = RtlAllocateHeap(GetProcessHeap(), 0, Length); + if (Buffer) + { + WideCharToMultiByte(Console->OutputCodePage, 0, + (PWCHAR)WriteConsoleRequest->Buffer, + WriteConsoleRequest->NrCharactersToWrite, + Buffer, Length, NULL, NULL); + } + else + { + Status = STATUS_NO_MEMORY; + } + } + else + { + Buffer = (PCHAR)WriteConsoleRequest->Buffer; + } + if (Buffer) { - WideCharToMultiByte(Console->OutputCodePage, 0, - (PWCHAR)WriteConsoleRequest->Buffer, - WriteConsoleRequest->NrCharactersToWrite, - Buffer, Length, NULL, NULL); - } - else - { - Status = STATUS_NO_MEMORY; - } - } - else - { - Buffer = (PCHAR)WriteConsoleRequest->Buffer; - } - - if (Buffer) - { - if (NT_SUCCESS(Status)) - { - Status = ConioWriteConsole(Console, Buff, Buffer, - WriteConsoleRequest->NrCharactersToWrite, TRUE); if (NT_SUCCESS(Status)) { - Written = WriteConsoleRequest->NrCharactersToWrite; - } - } - if (WriteConsoleRequest->Unicode) - { - RtlFreeHeap(GetProcessHeap(), 0, Buffer); - } - } - - WriteConsoleRequest->NrCharactersWritten = Written; + Status = ConioWriteConsole(Console, Buff, Buffer, + WriteConsoleRequest->NrCharactersToWrite, TRUE); + if (NT_SUCCESS(Status)) + { + Written = WriteConsoleRequest->NrCharactersToWrite; + } + } + if (WriteConsoleRequest->Unicode) + { + RtlFreeHeap(GetProcessHeap(), 0, Buffer); + } + } + + WriteConsoleRequest->NrCharactersWritten = Written; + } ConioUnlockScreenBuffer(Buff); return Status; Modified: branches/ros-csrss/win32ss/user/consrv/console.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] Wed Jan 2 00:32:20 2013 @@ -12,7 +12,7 @@ #include "guiconsole.h" #include "tuiconsole.h" -#define NDEBUG +//#define NDEBUG #include <debug.h> /* FUNCTIONS *****************************************************************/ @@ -75,6 +75,7 @@ return; } + DPRINT1("We succeeded at creating ProcessData->CtrlDispatcher remote thread, ProcessId = %x, Process = 0x%p\n", ProcessData->Process->ClientId.UniqueProcess, ProcessData->Process); WaitForSingleObject(Thread, Timeout); CloseHandle(Thread); } @@ -86,15 +87,29 @@ ConioConsoleCtrlEventTimeout(Event, ProcessData, 0); } -static NTSTATUS WINAPI -CsrInitConsole(PCSRSS_CONSOLE Console, int ShowCmd) +/* static */ NTSTATUS WINAPI +CsrInitConsole(PCSRSS_CONSOLE* NewConsole, int ShowCmd) { NTSTATUS Status; SECURITY_ATTRIBUTES SecurityAttributes; + PCSRSS_CONSOLE Console; PCSRSS_SCREEN_BUFFER NewBuffer; BOOL GuiMode; WCHAR Title[255]; + if (NewConsole == NULL) return STATUS_INVALID_PARAMETER; + + *NewConsole = NULL; + + /* Allocate a console structure */ + Console = HeapAlloc(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(CSRSS_CONSOLE)); + if (NULL == Console) + { + DPRINT1("Not enough memory for console creation.\n"); + return STATUS_NO_MEMORY; + } + + /* Initialize the console */ Console->Title.MaximumLength = Console->Title.Length = 0; Console->Title.Buffer = NULL; @@ -112,6 +127,7 @@ Console->Header.Type = CONIO_CONSOLE_MAGIC; Console->Header.Console = Console; Console->Mode = ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT; + InitializeListHead(&Console->ProcessList); InitializeListHead(&Console->BufferList); Console->ActiveBuffer = NULL; InitializeListHead(&Console->ReadWaitQueue); @@ -129,6 +145,7 @@ if (NULL == Console->ActiveEvent) { RtlFreeUnicodeString(&Console->Title); + HeapFree(ConSrvHeap, 0, Console); return STATUS_UNSUCCESSFUL; } Console->PrivateData = NULL; @@ -143,6 +160,7 @@ RtlFreeUnicodeString(&Console->Title); DeleteCriticalSection(&Console->Lock); CloseHandle(Console->ActiveEvent); + HeapFree(ConSrvHeap, 0, Console); return STATUS_INSUFFICIENT_RESOURCES; } /* init screen buffer with defaults */ @@ -186,6 +204,7 @@ DeleteCriticalSection(&Console->Lock); CloseHandle(Console->ActiveEvent); DPRINT1("GuiInitConsole: failed, Status = 0x%08lx\n", Status); + HeapFree(ConSrvHeap, 0, Console); return Status; } } @@ -199,11 +218,14 @@ CloseHandle(Console->ActiveEvent); HeapFree(ConSrvHeap, 0, NewBuffer); DPRINT1("CsrInitConsoleScreenBuffer: failed\n"); + HeapFree(ConSrvHeap, 0, Console); return Status; } - /* copy buffer contents to screen */ + /* Copy buffer contents to screen */ ConioDrawConsole(Console); + + *NewConsole = Console; return STATUS_SUCCESS; } @@ -271,109 +293,116 @@ NTSTATUS Status = STATUS_SUCCESS; PCSRSS_ALLOC_CONSOLE AllocConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.AllocConsoleRequest; PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); - PCSRSS_CONSOLE Console; - BOOLEAN NewConsole = FALSE; DPRINT("SrvAllocConsole\n"); + if (ProcessData->Console != NULL) + { + DPRINT1("Process already has a console\n"); + return STATUS_INVALID_PARAMETER; + } + RtlEnterCriticalSection(&ProcessData->HandleTableLock); - if (ProcessData->Console) - { - DPRINT1("Process already has a console\n"); + DPRINT1("SrvAllocConsole - Checkpoint 1\n"); + + /* Initialize a new Console */ + Status = CsrInitConsole(&ProcessData->Console, AllocConsoleRequest->ShowCmd); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Console initialization failed\n"); RtlLeaveCriticalSection(&ProcessData->HandleTableLock); - return STATUS_INVALID_PARAMETER; - } - - DPRINT1("SrvAllocConsole - Checkpoint 1\n"); - - /* If we don't need a console, then get out of here */ - if (!AllocConsoleRequest->ConsoleNeeded) - { - DPRINT("No console needed\n"); + return Status; + } + + /* Insert the process into the processes list of the console */ + InsertHeadList(&ProcessData->Console->ProcessList, &ProcessData->ConsoleLink); + + /* Return it to the caller */ + AllocConsoleRequest->Console = ProcessData->Console; + + /* Add a reference count because the process is tied to the console */ + _InterlockedIncrement(&ProcessData->Console->ReferenceCount); + +#if 0000 + /* + * We've just created a new console. However when ConsoleNewProcess was + * called, we didn't know that we wanted to create a new console and + * therefore, we by default inherited the handles table from our parent + * process. It's only now that we notice that in fact we do not need + * them, because we've created a new console and thus we must use it. + * + * Therefore, free our handles table and recreate a new one. + */ + + ULONG i; + + /* Close all console handles and free the handle table memory */ + for (i = 0; i < ProcessData->HandleTableSize; i++) + { + Win32CsrCloseHandleEntry(&ProcessData->HandleTable[i]); + } + ProcessData->HandleTableSize = 0; + RtlFreeHeap(ConSrvHeap, 0, ProcessData->HandleTable); + ProcessData->HandleTable = NULL; +#endif + + /* + * Create a new handle table - Insert the IO handles + */ + + /* Insert the Input handle */ + Status = Win32CsrInsertObject(ProcessData, + &AllocConsoleRequest->InputHandle, + &ProcessData->Console->Header, + GENERIC_READ | GENERIC_WRITE, + TRUE, + FILE_SHARE_READ | FILE_SHARE_WRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to insert the input handle\n"); + ConioDeleteConsole(ProcessData->Console); + ProcessData->Console = NULL; RtlLeaveCriticalSection(&ProcessData->HandleTableLock); - return STATUS_SUCCESS; - } - - /* If we already have one, then don't create a new one... */ - if (!AllocConsoleRequest->Console || - AllocConsoleRequest->Console != ProcessData->ParentConsole) - { - /* Allocate a console structure */ - NewConsole = TRUE; - Console = HeapAlloc(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(CSRSS_CONSOLE)); - if (NULL == Console) - { - DPRINT1("Not enough memory for console\n"); - RtlLeaveCriticalSection(&ProcessData->HandleTableLock); - return STATUS_NO_MEMORY; - } - - /* Initialize list head */ - InitializeListHead(&Console->ProcessList); - - /* Insert process data required for GUI initialization */ - InsertHeadList(&Console->ProcessList, &ProcessData->ConsoleLink); - - /* Initialize the Console */ - Status = CsrInitConsole(Console, AllocConsoleRequest->ShowCmd); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Console init failed\n"); - HeapFree(ConSrvHeap, 0, Console); - RtlLeaveCriticalSection(&ProcessData->HandleTableLock); - return Status; - } - } - else - { - /* Reuse our current console */ - Console = AllocConsoleRequest->Console; - } - - /* Set the Process Console */ - ProcessData->Console = Console; - - /* Return it to the caller */ - AllocConsoleRequest->Console = Console; - - /* Add a reference count because the process is tied to the console */ - _InterlockedIncrement(&Console->ReferenceCount); - - if (NewConsole || !ProcessData->bInheritHandles) - { - /* Insert the Objects */ - Status = Win32CsrInsertObject(ProcessData, - &AllocConsoleRequest->InputHandle, - &Console->Header, - GENERIC_READ | GENERIC_WRITE, - TRUE, - FILE_SHARE_READ | FILE_SHARE_WRITE); - if (! NT_SUCCESS(Status)) - { - DPRINT1("Failed to insert object\n"); - ConioDeleteConsole((Object_t *) Console); - ProcessData->Console = NULL; - RtlLeaveCriticalSection(&ProcessData->HandleTableLock); - return Status; - } - - Status = Win32CsrInsertObject(ProcessData, - &AllocConsoleRequest->OutputHandle, - &Console->ActiveBuffer->Header, - GENERIC_READ | GENERIC_WRITE, - TRUE, - FILE_SHARE_READ | FILE_SHARE_WRITE); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to insert object\n"); - ConioDeleteConsole((Object_t *) Console); - Win32CsrReleaseObject(ProcessData, - AllocConsoleRequest->InputHandle); - ProcessData->Console = NULL; - RtlLeaveCriticalSection(&ProcessData->HandleTableLock); - return Status; - } + return Status; + } + + /* Insert the Output handle */ + Status = Win32CsrInsertObject(ProcessData, + &AllocConsoleRequest->OutputHandle, + &ProcessData->Console->ActiveBuffer->Header, + GENERIC_READ | GENERIC_WRITE, + TRUE, + FILE_SHARE_READ | FILE_SHARE_WRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to insert the output handle\n"); + ConioDeleteConsole(ProcessData->Console); + Win32CsrReleaseObject(ProcessData, + AllocConsoleRequest->InputHandle); + ProcessData->Console = NULL; + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return Status; + } + + /* Insert the Error handle */ + Status = Win32CsrInsertObject(ProcessData, + &AllocConsoleRequest->ErrorHandle, + &ProcessData->Console->ActiveBuffer->Header, + GENERIC_READ | GENERIC_WRITE, + TRUE, + FILE_SHARE_READ | FILE_SHARE_WRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to insert the error handle\n"); + ConioDeleteConsole(ProcessData->Console); + Win32CsrReleaseObject(ProcessData, + AllocConsoleRequest->OutputHandle); + Win32CsrReleaseObject(ProcessData, + AllocConsoleRequest->InputHandle); + ProcessData->Console = NULL; + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return Status; } /* Duplicate the Event */ @@ -385,9 +414,11 @@ if (!NT_SUCCESS(Status)) { DPRINT1("NtDuplicateObject() failed: %lu\n", Status); - ConioDeleteConsole((Object_t *) Console); - if (NewConsole || !ProcessData->bInheritHandles) - { + ConioDeleteConsole(ProcessData->Console); + // if (NewConsole /* || !ProcessData->bInheritHandles */) + { + Win32CsrReleaseObject(ProcessData, + AllocConsoleRequest->ErrorHandle); Win32CsrReleaseObject(ProcessData, AllocConsoleRequest->OutputHandle); Win32CsrReleaseObject(ProcessData, @@ -397,37 +428,30 @@ RtlLeaveCriticalSection(&ProcessData->HandleTableLock); return Status; } + /* Input Wait Handle */ + AllocConsoleRequest->InputWaitHandle = ProcessData->ConsoleEvent; /* Set the Ctrl Dispatcher */ ProcessData->CtrlDispatcher = AllocConsoleRequest->CtrlDispatcher; DPRINT("CSRSS:CtrlDispatcher address: %x\n", ProcessData->CtrlDispatcher); - if (!NewConsole) - { - /* Insert into the list if it has not been added */ - InsertHeadList(&ProcessData->Console->ProcessList, &ProcessData->ConsoleLink); - } - RtlLeaveCriticalSection(&ProcessData->HandleTableLock); return STATUS_SUCCESS; } CSR_API(SrvFreeConsole) { + DPRINT1("SrvFreeConsole\n"); Win32CsrReleaseConsole(CsrGetClientThread()->Process); return STATUS_SUCCESS; } VOID WINAPI -ConioDeleteConsole(Object_t *Object) -{ - PCSRSS_CONSOLE Console = (PCSRSS_CONSOLE) Object; +ConioDeleteConsole(PCSRSS_CONSOLE Console) +{ ConsoleInput *Event; DPRINT("ConioDeleteConsole\n"); - - /* TODO: Dereference all the waits in Console->ReadWaitQueue */ - /* TODO: Dereference all the waits in Console->WriteWaitQueue */ /* Drain input event queue */ while (Console->InputEvents.Flink != &Console->InputEvents) Modified: branches/ros-csrss/win32ss/user/consrv/consrv.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/consrv.h [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/consrv.h [iso-8859-1] Wed Jan 2 00:32:20 2013 @@ -35,6 +35,9 @@ // extern HANDLE BaseSrvSharedHeap; // extern PBASE_STATIC_SERVER_DATA BaseStaticServerData; +/* Object type magic numbers */ +#define CONIO_CONSOLE_MAGIC 0x00000001 // --> Input-type handles +#define CONIO_SCREEN_BUFFER_MAGIC 0x00000002 // --> Output-type handles /* Common things to input/output/console objects */ typedef struct Object_tt @@ -62,14 +65,17 @@ typedef struct _CONSOLE_PROCESS_DATA { LIST_ENTRY ConsoleLink; - PCSR_PROCESS Process; // Parent process. + PCSR_PROCESS Process; // Process owning this structure. HANDLE ConsoleEvent; /* PCSRSS_CONSOLE */ struct tagCSRSS_CONSOLE* Console; /* PCSRSS_CONSOLE */ struct tagCSRSS_CONSOLE* ParentConsole; - BOOL bInheritHandles; + + // BOOL bInheritHandles; + BOOL ConsoleApp; // TRUE if it is a CUI app, FALSE otherwise. + RTL_CRITICAL_SECTION HandleTableLock; ULONG HandleTableSize; - /* PCSRSS_HANDLE */ struct _CSRSS_HANDLE* HandleTable; // Is it a length-varying table or length-fixed ?? + PCSRSS_HANDLE HandleTable; // Length-varying table LPTHREAD_START_ROUTINE CtrlDispatcher; } CONSOLE_PROCESS_DATA, *PCONSOLE_PROCESS_DATA; @@ -128,11 +134,7 @@ CSR_API(SrvCloseHandle); CSR_API(SrvVerifyConsoleIoHandle); CSR_API(SrvDuplicateHandle); -CSR_API(CsrGetInputWaitHandle); - -NTSTATUS NTAPI ConsoleNewProcess(PCSR_PROCESS SourceProcess, - PCSR_PROCESS TargetProcess); -VOID NTAPI Win32CsrReleaseConsole(PCSR_PROCESS Process); +/// CSR_API(CsrGetInputWaitHandle); NTSTATUS FASTCALL Win32CsrInsertObject(PCONSOLE_PROCESS_DATA ProcessData, PHANDLE Handle, @@ -149,6 +151,14 @@ NTSTATUS FASTCALL Win32CsrReleaseObject(PCONSOLE_PROCESS_DATA ProcessData, HANDLE Handle); +NTSTATUS NTAPI ConsoleNewProcess(PCSR_PROCESS SourceProcess, + PCSR_PROCESS TargetProcess); +NTSTATUS NTAPI ConsoleConnect(IN PCSR_PROCESS CsrProcess, + IN OUT PVOID ConnectionInfo, + IN OUT PULONG ConnectionInfoLength); +VOID NTAPI ConsoleDisconnect(PCSR_PROCESS Process); +VOID NTAPI Win32CsrReleaseConsole(PCSR_PROCESS Process); + /* lineinput.c */ CSR_API(SrvGetConsoleCommandHistoryLength); CSR_API(SrvGetConsoleCommandHistory); Modified: branches/ros-csrss/win32ss/user/consrv/handle.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/h…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] Wed Jan 2 00:32:20 2013 @@ -11,7 +11,7 @@ #include "consrv.h" #include "conio.h" -#define NDEBUG +//#define NDEBUG #include <debug.h> @@ -21,11 +21,16 @@ AdjustHandleCounts(PCSRSS_HANDLE Entry, INT Change) { Object_t *Object = Entry->Object; + + DPRINT1("AdjustHandleCounts(0x%p, %d), Object = 0x%p, Object->HandleCount = %d, Object->Type = %lu\n", Entry, Change, Object, Object->HandleCount, Object->Type); + if (Entry->Access & GENERIC_READ) Object->AccessRead += Change; if (Entry->Access & GENERIC_WRITE) Object->AccessWrite += Change; if (!(Entry->ShareMode & FILE_SHARE_READ)) Object->ExclusiveRead += Change; if (!(Entry->ShareMode & FILE_SHARE_WRITE)) Object->ExclusiveWrite += Change; + Object->HandleCount += Change; + return Object->HandleCount; } @@ -46,17 +51,26 @@ { PCSRSS_CONSOLE Console = Object->Console; EnterCriticalSection(&Console->Lock); - /* If the last handle to a screen buffer is closed, delete it */ - if (AdjustHandleCounts(Entry, -1) == 0 - && Object->Type == CONIO_SCREEN_BUFFER_MAGIC) - { - PCSRSS_SCREEN_BUFFER Buffer = (PCSRSS_SCREEN_BUFFER)Object; - /* ...unless it's the only buffer left. Windows allows deletion - * even of the last buffer, but having to deal with a lack of - * any active buffer might be error-prone. */ - if (Buffer->ListEntry.Flink != Buffer->ListEntry.Blink) - ConioDeleteScreenBuffer(Buffer); - } + + /* If the last handle to a screen buffer is closed, delete it... */ + if (AdjustHandleCounts(Entry, -1) == 0) + { + if (Object->Type == CONIO_SCREEN_BUFFER_MAGIC) + { + PCSRSS_SCREEN_BUFFER Buffer = (PCSRSS_SCREEN_BUFFER)Object; + /* ...unless it's the only buffer left. Windows allows deletion + * even of the last buffer, but having to deal with a lack of + * any active buffer might be error-prone. */ + if (Buffer->ListEntry.Flink != Buffer->ListEntry.Blink) + ConioDeleteScreenBuffer(Buffer); + } + else if (Object->Type == CONIO_CONSOLE_MAGIC) + { + /* TODO: FIXME: Destroy here the console ?? */ + // ConioDeleteConsole(Console); + } + } + LeaveCriticalSection(&Console->Lock); Entry->Object = NULL; } @@ -94,7 +108,7 @@ if (Block == NULL) { RtlLeaveCriticalSection(&ProcessData->HandleTableLock); - return(STATUS_UNSUCCESSFUL); + return STATUS_UNSUCCESSFUL; } RtlCopyMemory(Block, ProcessData->HandleTable, @@ -129,6 +143,8 @@ RtlLeaveCriticalSection(&ProcessData->HandleTableLock); return STATUS_INVALID_HANDLE; } + + DPRINT1("Win32CsrReleaseObject - Process 0x%p, Release 0x%p\n", ProcessData->Process, &ProcessData->HandleTable[h]); Win32CsrCloseHandleEntry(&ProcessData->HandleTable[h]); RtlLeaveCriticalSection(&ProcessData->HandleTableLock); @@ -169,24 +185,43 @@ return STATUS_SUCCESS; } +VOID FASTCALL +Win32CsrUnlockConsole(PCSRSS_CONSOLE Console) +{ + LeaveCriticalSection(&Console->Lock); + + /* Decrement reference count */ + if (_InterlockedDecrement(&Console->ReferenceCount) == 0) + ConioDeleteConsole(Console); +} + VOID FASTCALL Win32CsrUnlockObject(Object_t *Object) { - PCSRSS_CONSOLE Console = Object->Console; - LeaveCriticalSection(&Console->Lock); - /* dec ref count */ - if (_InterlockedDecrement(&Console->ReferenceCount) == 0) - ConioDeleteConsole(&Console->Header); -} - - - + Win32CsrUnlockConsole(Object->Console); +} + + + +/** Remark: this function can be called by SrvAttachConsole (not yet implemented) **/ NTSTATUS NTAPI ConsoleNewProcess(PCSR_PROCESS SourceProcess, PCSR_PROCESS TargetProcess) { + /************************************************************************** + * This function is called whenever a new process (GUI or CUI) is created. + * + * Copy the parent's handles table here if both the parent and the child + * processes are CUI. If we must actually create our proper console (and + * thus do not inherit from the console handles of the parent's), then we + * will clean this table in the next ConsoleConnect call. Why we are doing + * this? It's because here, we still don't know whether or not we must create + * a new console instead of inherit it from the parent, and, because in + * ConsoleConnect we don't have any reference to the parent process anymore. + **************************************************************************/ + PCONSOLE_PROCESS_DATA SourceProcessData, TargetProcessData; ULONG i; @@ -200,9 +235,22 @@ DPRINT1("ConsoleNewProcess - OK\n"); TargetProcessData = ConsoleGetPerProcessData(TargetProcess); + DPRINT1("TargetProcessData = 0x%p\n", TargetProcessData); + + /**** HACK !!!! ****/ RtlZeroMemory(TargetProcessData, sizeof(*TargetProcessData)); /* Initialize the new (target) process */ TargetProcessData->Process = TargetProcess; + TargetProcessData->ConsoleEvent = NULL; + TargetProcessData->Console = TargetProcessData->ParentConsole = NULL; + // TargetProcessData->bInheritHandles = FALSE; + TargetProcessData->ConsoleApp = ((TargetProcess->Flags & CsrProcessIsConsoleApp) ? TRUE : FALSE); + + // Testing + TargetProcessData->HandleTableSize = 0; + TargetProcessData->HandleTable = NULL; + + /* HACK */ RtlZeroMemory(&TargetProcessData->HandleTableLock, sizeof(RTL_CRITICAL_SECTION)); RtlInitializeCriticalSection(&TargetProcessData->HandleTableLock); /* Do nothing if the source process is NULL */ @@ -210,51 +258,256 @@ return STATUS_SUCCESS; SourceProcessData = ConsoleGetPerProcessData(SourceProcess); - - // TODO: Check if one of the processes is really a CONSOLE. + DPRINT1("SourceProcessData = 0x%p\n", SourceProcessData); + /* - if (!(CreateProcessRequest->CreationFlags & (CREATE_NEW_CONSOLE | DETACHED_PROCESS))) - { - // NewProcess == TargetProcess. - NewProcess->ParentConsole = Process->Console; - NewProcess->bInheritHandles = CreateProcessRequest->bInheritHandles; - } - */ - - /* Only inherit if the if the flag was set */ - if (!TargetProcessData->bInheritHandles) return STATUS_SUCCESS; - - if (TargetProcessData->HandleTableSize) - { - return STATUS_INVALID_PARAMETER; - } - - RtlEnterCriticalSection(&SourceProcessData->HandleTableLock); - - TargetProcessData->HandleTable = RtlAllocateHeap(ConSrvHeap, - HEAP_ZERO_MEMORY, - SourceProcessData->HandleTableSize - * sizeof(CSRSS_HANDLE)); - if (TargetProcessData->HandleTable == NULL) - { + * If both of the processes (parent and new child) are console applications, + * then try to inherit handles from the parent process. + */ + if ( SourceProcessData->Console != NULL && /* SourceProcessData->ConsoleApp */ + TargetProcessData->ConsoleApp ) + { +/* + if (TargetProcessData->HandleTableSize) + { + return STATUS_INVALID_PARAMETER; + } +*/ + + DPRINT1("ConsoleNewProcess - Copy the handle table (1)\n"); + /* Temporary "inherit" the console from the parent */ + TargetProcessData->ParentConsole = SourceProcessData->Console; + RtlEnterCriticalSection(&SourceProcessData->HandleTableLock); + DPRINT1("ConsoleNewProcess - Copy the handle table (2)\n"); + + /* Allocate a new handle table for the child process */ + TargetProcessData->HandleTable = RtlAllocateHeap(ConSrvHeap, + HEAP_ZERO_MEMORY, + SourceProcessData->HandleTableSize + * sizeof(CSRSS_HANDLE)); + if (TargetProcessData->HandleTable == NULL) + { + RtlLeaveCriticalSection(&SourceProcessData->HandleTableLock); + return STATUS_UNSUCCESSFUL; + } + + TargetProcessData->HandleTableSize = SourceProcessData->HandleTableSize; + + /* + * Parse the parent process' handles table and, for each handle, + * do a copy of it and reference it, if the handle is inheritable. + */ + for (i = 0; i < SourceProcessData->HandleTableSize; i++) + { + if (SourceProcessData->HandleTable[i].Object != NULL && + SourceProcessData->HandleTable[i].Inheritable) + { + /* + * Copy the handle data and increment the reference count of the + * pointed object (via the call to Win32CsrCreateHandleEntry). + */ + TargetProcessData->HandleTable[i] = SourceProcessData->HandleTable[i]; + Win32CsrCreateHandleEntry(&TargetProcessData->HandleTable[i]); + } + } + RtlLeaveCriticalSection(&SourceProcessData->HandleTableLock); + } + else + { + DPRINT1("ConsoleNewProcess - We don't launch a Console process : SourceProcessData->Console = 0x%p ; TargetProcess->Flags = %lu\n", SourceProcessData->Console, TargetProcess->Flags); + } + + return STATUS_SUCCESS; +} + +// Temporary ; move it to a header. +NTSTATUS WINAPI CsrInitConsole(PCSRSS_CONSOLE* NewConsole, int ShowCmd); + +NTSTATUS +NTAPI +ConsoleConnect(IN PCSR_PROCESS CsrProcess, + IN OUT PVOID ConnectionInfo, + IN OUT PULONG ConnectionInfoLength) +{ + /************************************************************************** + * This function is called whenever a CUI new process is created. + **************************************************************************/ + + NTSTATUS Status = STATUS_SUCCESS; + PCONSOLE_CONNECTION_INFO ConnectInfo = (PCONSOLE_CONNECTION_INFO)ConnectionInfo; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrProcess); + BOOLEAN NewConsole = FALSE; + // PCSRSS_CONSOLE Console = NULL; + + DPRINT1("ConsoleConnect\n"); + + if ( ConnectionInfo == NULL || + ConnectionInfoLength == NULL || + *ConnectionInfoLength != sizeof(CONSOLE_CONNECTION_INFO) ) + { + DPRINT1("CONSRV: Connection failed\n"); return STATUS_UNSUCCESSFUL; } - TargetProcessData->HandleTableSize = SourceProcessData->HandleTableSize; - - for (i = 0; i < SourceProcessData->HandleTableSize; i++) - { - if (SourceProcessData->HandleTable[i].Object != NULL && - SourceProcessData->HandleTable[i].Inheritable) - { - TargetProcessData->HandleTable[i] = SourceProcessData->HandleTable[i]; - Win32CsrCreateHandleEntry(&TargetProcessData->HandleTable[i]); - } - } - - RtlLeaveCriticalSection(&SourceProcessData->HandleTableLock); - + /* If we don't need a console, then get out of here */ + if (!ConnectInfo->ConsoleNeeded || !ProcessData->ConsoleApp) // In fact, it is for GUI apps. + { + DPRINT("ConsoleConnect - No console needed\n"); + return STATUS_SUCCESS; + } + + RtlEnterCriticalSection(&ProcessData->HandleTableLock); + + /* If we don't have a console, then create a new one... */ + if (!ConnectInfo->Console || + ConnectInfo->Console != ProcessData->ParentConsole) + { + // PCSRSS_CONSOLE Console; + + DPRINT1("ConsoleConnect - Allocate a new console\n"); + + /* Initialize a new Console */ + NewConsole = TRUE; + Status = CsrInitConsole(&ProcessData->Console, ConnectInfo->ShowCmd); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Console initialization failed\n"); + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return Status; + } + } + else /* We inherit it from the parent */ + { + DPRINT1("ConsoleConnect - Reuse current (parent's) console\n"); + + /* Reuse our current console */ + NewConsole = FALSE; + ProcessData->Console = ConnectInfo->Console; + } + + /* Insert the process into the processes list of the console */ + InsertHeadList(&ProcessData->Console->ProcessList, &ProcessData->ConsoleLink); + + /* Return it to the caller */ + ConnectInfo->Console = ProcessData->Console; + + /* Add a reference count because the process is tied to the console */ + _InterlockedIncrement(&ProcessData->Console->ReferenceCount); + + if (NewConsole /* || !ProcessData->bInheritHandles */) + { + /* + * We've just created a new console. However when ConsoleNewProcess was + * called, we didn't know that we wanted to create a new console and + * therefore, we by default inherited the handles table from our parent + * process. It's only now that we notice that in fact we do not need + * them, because we've created a new console and thus we must use it. + * + * Therefore, free our handles table and recreate a new one. + */ + + ULONG i; + + /* Close all console handles and free the handle table memory */ + for (i = 0; i < ProcessData->HandleTableSize; i++) + { + Win32CsrCloseHandleEntry(&ProcessData->HandleTable[i]); + } + ProcessData->HandleTableSize = 0; + RtlFreeHeap(ConSrvHeap, 0, ProcessData->HandleTable); + ProcessData->HandleTable = NULL; + + /* + * Create a new handle table - Insert the IO handles + */ + + /* Insert the Input handle */ + Status = Win32CsrInsertObject(ProcessData, + &ConnectInfo->InputHandle, + &ProcessData->Console->Header, + GENERIC_READ | GENERIC_WRITE, + TRUE, + FILE_SHARE_READ | FILE_SHARE_WRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to insert the input handle\n"); + ConioDeleteConsole(ProcessData->Console); + ProcessData->Console = NULL; + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return Status; + } + + /* Insert the Output handle */ + Status = Win32CsrInsertObject(ProcessData, + &ConnectInfo->OutputHandle, + &ProcessData->Console->ActiveBuffer->Header, + GENERIC_READ | GENERIC_WRITE, + TRUE, + FILE_SHARE_READ | FILE_SHARE_WRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to insert the output handle\n"); + ConioDeleteConsole(ProcessData->Console); + Win32CsrReleaseObject(ProcessData, + ConnectInfo->InputHandle); + ProcessData->Console = NULL; + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return Status; + } + + /* Insert the Error handle */ + Status = Win32CsrInsertObject(ProcessData, + &ConnectInfo->ErrorHandle, + &ProcessData->Console->ActiveBuffer->Header, + GENERIC_READ | GENERIC_WRITE, + TRUE, + FILE_SHARE_READ | FILE_SHARE_WRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to insert the error handle\n"); + ConioDeleteConsole(ProcessData->Console); + Win32CsrReleaseObject(ProcessData, + ConnectInfo->OutputHandle); + Win32CsrReleaseObject(ProcessData, + ConnectInfo->InputHandle); + ProcessData->Console = NULL; + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return Status; + } + } + + /* Duplicate the Event */ + Status = NtDuplicateObject(NtCurrentProcess(), + ProcessData->Console->ActiveEvent, + ProcessData->Process->ProcessHandle, + &ProcessData->ConsoleEvent, + EVENT_ALL_ACCESS, 0, 0); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtDuplicateObject() failed: %lu\n", Status); + ConioDeleteConsole(ProcessData->Console); + if (NewConsole /* || !ProcessData->bInheritHandles */) + { + Win32CsrReleaseObject(ProcessData, + ConnectInfo->ErrorHandle); + Win32CsrReleaseObject(ProcessData, + ConnectInfo->OutputHandle); + Win32CsrReleaseObject(ProcessData, + ConnectInfo->InputHandle); + } + ProcessData->Console = NULL; + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return Status; + } + /* Input Wait Handle */ + ConnectInfo->InputWaitHandle = ProcessData->ConsoleEvent; + + /* Set the Ctrl Dispatcher */ + ProcessData->CtrlDispatcher = ConnectInfo->CtrlDispatcher; + DPRINT("CSRSS:CtrlDispatcher address: %x\n", ProcessData->CtrlDispatcher); + + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); return STATUS_SUCCESS; } @@ -266,29 +519,62 @@ PCSRSS_CONSOLE Console; ULONG i; - /* Close all console handles and detach process from console */ + DPRINT1("Win32CsrReleaseConsole\n"); + RtlEnterCriticalSection(&ProcessData->HandleTableLock); + /* Close all console handles and free the handle table memory */ for (i = 0; i < ProcessData->HandleTableSize; i++) + { Win32CsrCloseHandleEntry(&ProcessData->HandleTable[i]); + } ProcessData->HandleTableSize = 0; RtlFreeHeap(ConSrvHeap, 0, ProcessData->HandleTable); ProcessData->HandleTable = NULL; + /* Detach process from console */ Console = ProcessData->Console; if (Console != NULL) { + DPRINT1("Win32CsrReleaseConsole - Console->ReferenceCount = %lu - We are going to decrement it !\n", Console->ReferenceCount); ProcessData->Console = NULL; EnterCriticalSection(&Console->Lock); RemoveEntryList(&ProcessData->ConsoleLink); - LeaveCriticalSection(&Console->Lock); - if (_InterlockedDecrement(&Console->ReferenceCount) == 0) - ConioDeleteConsole(&Console->Header); + Win32CsrUnlockConsole(Console); //CloseHandle(ProcessData->ConsoleEvent); //ProcessData->ConsoleEvent = NULL; } + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); } + +VOID +WINAPI +ConsoleDisconnect(PCSR_PROCESS Process) +{ + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(Process); + + /************************************************************************** + * This function is called whenever a new process (GUI or CUI) is destroyed. + * + * Only do something if the process is a CUI. <-- modify this behaviour if + * we deal with a GUI which + * quits and acquired a + * console... + **************************************************************************/ + + DPRINT1("ConsoleDisconnect called\n"); + // if (ProcessData->Console != NULL) + if (ProcessData->ConsoleApp) + { + DPRINT1("ConsoleDisconnect - calling Win32CsrReleaseConsole\n"); + Win32CsrReleaseConsole(Process); + } + + RtlDeleteCriticalSection(&ProcessData->HandleTableLock); +} + + CSR_API(SrvCloseHandle) { @@ -374,6 +660,7 @@ return ApiMessage->Status; } +/** CSR_API(CsrGetInputWaitHandle) { PCSRSS_GET_INPUT_WAIT_HANDLE GetConsoleInputWaitHandle = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleInputWaitHandle; @@ -383,5 +670,6 @@ return STATUS_SUCCESS; } +**/ /* EOF */ Modified: branches/ros-csrss/win32ss/user/consrv/init.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/i…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/init.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/init.c [iso-8859-1] Wed Jan 2 00:32:20 2013 @@ -460,8 +460,8 @@ LoadedServerDll->ValidTable = ConsoleServerApiServerValidTable; LoadedServerDll->NameTable = ConsoleServerApiNameTable; LoadedServerDll->SizeOfProcessData = sizeof(CONSOLE_PROCESS_DATA); - LoadedServerDll->ConnectCallback = NULL; - LoadedServerDll->DisconnectCallback = Win32CsrReleaseConsole; + LoadedServerDll->ConnectCallback = ConsoleConnect; + LoadedServerDll->DisconnectCallback = ConsoleDisconnect; LoadedServerDll->NewProcessCallback = ConsoleNewProcess; // LoadedServerDll->HardErrorCallback = Win32CsrHardError;
11 years, 11 months
1
0
0
0
← Newer
1
...
13
14
15
16
17
18
19
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Results per page:
10
25
50
100
200