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
February 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
125 discussions
Start a n
N
ew thread
[ekohl] 58312: [MSGINA] Fix typo!
by ekohl@svn.reactos.org
Author: ekohl Date: Wed Feb 13 23:32:18 2013 New Revision: 58312 URL:
http://svn.reactos.org/svn/reactos?rev=58312&view=rev
Log: [MSGINA] Fix typo! Modified: trunk/reactos/dll/win32/msgina/lang/bg-BG.rc Modified: trunk/reactos/dll/win32/msgina/lang/bg-BG.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/bg-B…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/bg-BG.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/bg-BG.rc [iso-8859-1] Wed Feb 13 23:32:18 2013 @@ -67,5 +67,5 @@ IDS_ASKFORUSER "ÐоÑÑебиÑелÑко име: " IDS_ASKFORPASSWORD "ÐаÑола: " IDS_FORCELOGOFF "Така ÑекÑÑиÑÑ Ð¿Ð¾ÑÑебиÑел Ñе излезе и Ñе изгÑби вÑиÑки неÑÑÑ Ñанени данни. Ðа пÑодÑлжа ли?" - IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." + IDS_LOCKMSG "Only %s or an Administrator can unlock this computer." END
11 years, 10 months
1
0
0
0
[ekohl] 58311: [MSGINA] Implement the "Computer locked" dialog box. Attention: Computer can not be unlocked yet!
by ekohl@svn.reactos.org
Author: ekohl Date: Wed Feb 13 23:24:15 2013 New Revision: 58311 URL:
http://svn.reactos.org/svn/reactos?rev=58311&view=rev
Log: [MSGINA] Implement the "Computer locked" dialog box. Attention: Computer can not be unlocked yet! Modified: trunk/reactos/dll/win32/msgina/gui.c trunk/reactos/dll/win32/msgina/lang/bg-BG.rc trunk/reactos/dll/win32/msgina/lang/cs-CZ.rc trunk/reactos/dll/win32/msgina/lang/de-DE.rc trunk/reactos/dll/win32/msgina/lang/en-US.rc trunk/reactos/dll/win32/msgina/lang/es-ES.rc trunk/reactos/dll/win32/msgina/lang/fr-FR.rc trunk/reactos/dll/win32/msgina/lang/he-IL.rc trunk/reactos/dll/win32/msgina/lang/id-ID.rc trunk/reactos/dll/win32/msgina/lang/it-IT.rc trunk/reactos/dll/win32/msgina/lang/ja-JP.rc trunk/reactos/dll/win32/msgina/lang/no-NO.rc trunk/reactos/dll/win32/msgina/lang/pl-PL.rc trunk/reactos/dll/win32/msgina/lang/ro-RO.rc trunk/reactos/dll/win32/msgina/lang/ru-RU.rc trunk/reactos/dll/win32/msgina/lang/sk-SK.rc trunk/reactos/dll/win32/msgina/lang/uk-UA.rc trunk/reactos/dll/win32/msgina/msgina.c trunk/reactos/dll/win32/msgina/msgina.h trunk/reactos/dll/win32/msgina/resource.h trunk/reactos/dll/win32/msgina/stubs.c trunk/reactos/dll/win32/msgina/tui.c Modified: trunk/reactos/dll/win32/msgina/gui.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/gui.c?rev…
============================================================================== --- trunk/reactos/dll/win32/msgina/gui.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/gui.c [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -413,6 +413,68 @@ return WLX_SAS_ACTION_UNLOCK_WKSTA; } + +static INT_PTR CALLBACK +LockedWindowProc( + IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) +{ + PGINA_CONTEXT pgContext; + + pgContext = (PGINA_CONTEXT)GetWindowLongPtr(hwndDlg, GWL_USERDATA); + + switch (uMsg) + { + case WM_INITDIALOG: + { + pgContext = (PGINA_CONTEXT)lParam; + SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pgContext); + + pgContext->hBitmap = LoadImage(hDllInstance, MAKEINTRESOURCE(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); + return TRUE; + } + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdc; + if (pgContext->hBitmap) + { + hdc = BeginPaint(hwndDlg, &ps); + DrawStateW(hdc, NULL, NULL, (LPARAM)pgContext->hBitmap, (WPARAM)0, 0, 0, 0, 0, DST_BITMAP); + EndPaint(hwndDlg, &ps); + } + return TRUE; + } + case WM_DESTROY: + { + DeleteObject(pgContext->hBitmap); + return TRUE; + } + } + + return FALSE; +} + + +static VOID +GUIDisplayLockedNotice( + IN OUT PGINA_CONTEXT pgContext) +{ + int result; + + TRACE("GUIdisplayLockedNotice()\n"); + + result = pgContext->pWlxFuncs->WlxDialogBoxParam( + pgContext->hWlx, + pgContext->hDllInstance, + MAKEINTRESOURCEW(IDD_LOCKED_DLG), + GetDesktopWindow(), + LockedWindowProc, + (LPARAM)pgContext); +} + GINA_UI GinaGraphicalUI = { GUIInitialize, GUIDisplayStatusMessage, @@ -421,4 +483,5 @@ GUILoggedOnSAS, GUILoggedOutSAS, GUILockedSAS, + GUIDisplayLockedNotice, }; Modified: trunk/reactos/dll/win32/msgina/lang/bg-BG.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/bg-B…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/bg-BG.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/bg-BG.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -1,4 +1,4 @@ -LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT +LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT IDD_STATUSWINDOW_DLG DIALOGEX 0,0,275,80 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP @@ -47,6 +47,18 @@ PUSHBUTTON "ÐÑказ",IDCANCEL,130,95,99,14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer Locked" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "This computer is in use and has been locked.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Press Ctrl-Alt-Del to unlock this computer.",IDC_STATIC,37,106,231,8 +END + STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "ÐдÑавейÑе!" @@ -55,4 +67,5 @@ IDS_ASKFORUSER "ÐоÑÑебиÑелÑко име: " IDS_ASKFORPASSWORD "ÐаÑола: " IDS_FORCELOGOFF "Така ÑекÑÑиÑÑ Ð¿Ð¾ÑÑебиÑел Ñе излезе и Ñе изгÑби вÑиÑки неÑÑÑ Ñанени данни. Ðа пÑодÑлжа ли?" + IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." END Modified: trunk/reactos/dll/win32/msgina/lang/cs-CZ.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/cs-C…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/cs-CZ.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/cs-CZ.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -52,6 +52,18 @@ PUSHBUTTON "Storno",IDCANCEL,170,95,70,14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer Locked" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "This computer is in use and has been locked.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Press Ctrl-Alt-Del to unlock this computer.",IDC_STATIC,37,106,231,8 +END + STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "VÃtejte!" @@ -60,4 +72,5 @@ IDS_ASKFORUSER "Uživatelské jméno: " IDS_ASKFORPASSWORD "Heslo: " IDS_FORCELOGOFF "SouÄasný uživatel bude odhlášen a vÅ¡echna jeho neuložená data ztracena. PokraÄovat?" + IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." END Modified: trunk/reactos/dll/win32/msgina/lang/de-DE.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/de-D…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/de-DE.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/de-DE.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -47,6 +47,18 @@ PUSHBUTTON "Abbrechen",IDCANCEL,170,95,70,14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer gesperrt" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "Dieser Computer wird verwndet und ist gesperrt.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Drücken Sie Strg+Alt+Entf um den Computer zu entsperren.",IDC_STATIC,37,106,231,8 +END + STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "Willkommen!" @@ -55,4 +67,5 @@ IDS_ASKFORUSER "Benutzername: " IDS_ASKFORPASSWORD "Passwort: " IDS_FORCELOGOFF "Dies wird den derzeitigen Benutzer abmelden. Alle ungespeicherten Daten gehen verloren. Fortsetzen?" + IDS_LOCKMMSG "Nur %s oder ein Administrator kann den Computer entsperren." END Modified: trunk/reactos/dll/win32/msgina/lang/en-US.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/en-U…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/en-US.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/en-US.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -47,6 +47,18 @@ PUSHBUTTON "Cancel",IDCANCEL,170,95,70,14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer Locked" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "This computer is in use and has been locked.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Press Ctrl-Alt-Del to unlock this computer.",IDC_STATIC,37,106,231,8 +END + STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "Welcome!" @@ -55,4 +67,5 @@ IDS_ASKFORUSER "User name: " IDS_ASKFORPASSWORD "Password: " IDS_FORCELOGOFF "This will log out the current user and lose all unsaved data. Continue?" + IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." END Modified: trunk/reactos/dll/win32/msgina/lang/es-ES.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/es-E…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/es-ES.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/es-ES.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -52,6 +52,18 @@ PUSHBUTTON "Cancelar",IDCANCEL, 186, 95, 70, 14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer Locked" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "This computer is in use and has been locked.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Press Ctrl-Alt-Del to unlock this computer.",IDC_STATIC,37,106,231,8 +END + STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "¡Bienvenido!" @@ -60,4 +72,5 @@ IDS_ASKFORUSER "Usuario: " IDS_ASKFORPASSWORD "Contraseña: " IDS_FORCELOGOFF "Esto cerrará al usuario actual y perderá todos los datos no guardados. ¿Desea Continuar?" + IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." END Modified: trunk/reactos/dll/win32/msgina/lang/fr-FR.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/fr-F…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/fr-FR.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/fr-FR.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -47,6 +47,18 @@ PUSHBUTTON "Annuler",IDCANCEL, 184, 95, 70, 14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer Locked" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "This computer is in use and has been locked.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Press Ctrl-Alt-Del to unlock this computer.",IDC_STATIC,37,106,231,8 +END + STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "Bienvenue!" @@ -55,4 +67,5 @@ IDS_ASKFORUSER "Utilisateur: " IDS_ASKFORPASSWORD "Mot de passe: " IDS_FORCELOGOFF "Cela déconnectera l'utilisateur en cours et perdra les données non sauvées. Continuer?" + IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." END Modified: trunk/reactos/dll/win32/msgina/lang/he-IL.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/he-I…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/he-IL.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/he-IL.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -1,4 +1,4 @@ -LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT +LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT IDD_STATUSWINDOW_DLG DIALOGEX 0,0,275,80 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP @@ -47,6 +47,18 @@ PUSHBUTTON "×××××",IDCANCEL,170,95,70,14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer Locked" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "This computer is in use and has been locked.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Press Ctrl-Alt-Del to unlock this computer.",IDC_STATIC,37,106,231,8 +END + STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "×ר×××× ×××××!" @@ -55,4 +67,5 @@ IDS_ASKFORUSER "×©× ×שת×ש: " IDS_ASKFORPASSWORD "ס×ס××: " IDS_FORCELOGOFF "×× ××ר×× ×××ª× ×ª×§×ת ××שת×ש ×× ×××× ××××× ×ת ×× ×××××¢ ש××× × × ×©×ר. ×××ש××?" + IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." END Modified: trunk/reactos/dll/win32/msgina/lang/id-ID.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/id-I…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/id-ID.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/id-ID.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -47,6 +47,18 @@ PUSHBUTTON "Batal",IDCANCEL,170,95,70,14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer Locked" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "This computer is in use and has been locked.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Press Ctrl-Alt-Del to unlock this computer.",IDC_STATIC,37,106,231,8 +END + STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "Selamat datang!" @@ -55,4 +67,5 @@ IDS_ASKFORUSER "Nama Pengguna: " IDS_ASKFORPASSWORD "Kata sandi: " IDS_FORCELOGOFF "Ini akan mengeluarkan pengguna saat ini dan kehilangan data yang belum disimpan. Lanjutkan?" + IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." END Modified: trunk/reactos/dll/win32/msgina/lang/it-IT.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/it-I…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/it-IT.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/it-IT.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -41,6 +41,18 @@ PUSHBUTTON "Spegnimento",IDC_SHUTDOWN,179,122,50,14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer Locked" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "This computer is in use and has been locked.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Press Ctrl-Alt-Del to unlock this computer.",IDC_STATIC,37,106,231,8 +END + IDD_LOGGEDON_DLG DIALOGEX 0,0,275,116 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU CAPTION "Sicurezza" @@ -63,4 +75,5 @@ IDS_ASKFORUSER "Nome utente: " IDS_ASKFORPASSWORD "Password: " IDS_FORCELOGOFF "Verrà terminata la sessione dell'utente attuale e tutti i dati non salvati verranno persi. Volete procedere?" + IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." END Modified: trunk/reactos/dll/win32/msgina/lang/ja-JP.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/ja-J…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/ja-JP.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/ja-JP.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -1,4 +1,4 @@ -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT IDD_STATUSWINDOW_DLG DIALOGEX 0,0,275,80 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP @@ -47,6 +47,18 @@ PUSHBUTTON "ãã£ã³ã»ã«",IDCANCEL,170,95,70,14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer Locked" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "This computer is in use and has been locked.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Press Ctrl-Alt-Del to unlock this computer.",IDC_STATIC,37,106,231,8 +END + STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "ãããã!" @@ -55,4 +67,5 @@ IDS_ASKFORUSER "ã¦ã¼ã¶ã¼å: " IDS_ASKFORPASSWORD "ãã¹ã¯ã¼ã: " IDS_FORCELOGOFF "ç¾å¨ã®ã¦ã¼ã¶ã¼ããã°ã¢ã¦ããã¾ããä¿åããã¦ããªããã¼ã¿ã¯ãã¹ã¦å¤±ããã¾ãã ç¶è¡ãã¾ãã?" + IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." END Modified: trunk/reactos/dll/win32/msgina/lang/no-NO.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/no-N…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/no-NO.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/no-NO.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -47,6 +47,18 @@ PUSHBUTTON "Avbryt",IDCANCEL, 170, 95, 70, 14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer Locked" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "This computer is in use and has been locked.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Press Ctrl-Alt-Del to unlock this computer.",IDC_STATIC,37,106,231,8 +END + STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "Velkommen!" @@ -55,4 +67,5 @@ IDS_ASKFORUSER "Brukernavn: " IDS_ASKFORPASSWORD "Passord: " IDS_FORCELOGOFF "Dette vil logge av gjeldende bruker, alle ulagrede data vil gå tapt. Fortsette?" + IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." END Modified: trunk/reactos/dll/win32/msgina/lang/pl-PL.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/pl-P…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/pl-PL.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/pl-PL.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -1,4 +1,4 @@ -/* +/* * translated by TestamenT * testament(a)users.sourceforge.net *
https://sourceforge.net/projects/reactospl
@@ -55,6 +55,18 @@ PUSHBUTTON "Anuluj",IDCANCEL,170,95,70,14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer Locked" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "This computer is in use and has been locked.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Press Ctrl-Alt-Del to unlock this computer.",IDC_STATIC,37,106,231,8 +END + STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "Witaj!" @@ -63,4 +75,5 @@ IDS_ASKFORUSER "Nazwa użytkownika: " IDS_ASKFORPASSWORD "HasÅo: " IDS_FORCELOGOFF "To wyloguje aktualnego użytkownika i straci on wszystkie niezapisane dane. KontynuowaÄ?" + IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." END Modified: trunk/reactos/dll/win32/msgina/lang/ro-RO.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/ro-R…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/ro-RO.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/ro-RO.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -48,6 +48,18 @@ PUSHBUTTON "A&nuleazÄ", IDCANCEL,170,95,70,14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer Locked" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "This computer is in use and has been locked.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Press Ctrl-Alt-Del to unlock this computer.",IDC_STATIC,37,106,231,8 +END + STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "Bun venit!" @@ -56,4 +68,5 @@ IDS_ASKFORUSER "Nume utilizator: " IDS_ASKFORPASSWORD "ParolÄ: " IDS_FORCELOGOFF "AceastÄ acÈiune va deautentifica utilizatorului curent cu posibile pierderi ale datelor nepÄstrate. ContinuaÈi?" + IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." END Modified: trunk/reactos/dll/win32/msgina/lang/ru-RU.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/ru-R…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/ru-RU.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/ru-RU.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -1,4 +1,4 @@ -//Russian language file. (Dmitry Chapyshev, 2007.06.17) +//Russian language file. (Dmitry Chapyshev, 2007.06.17) LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT @@ -49,6 +49,18 @@ PUSHBUTTON "ÐÑмена", IDCANCEL, 198, 95, 70, 14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer Locked" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "This computer is in use and has been locked.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Press Ctrl-Alt-Del to unlock this computer.",IDC_STATIC,37,106,231,8 +END + STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "ÐобÑо пожаловаÑÑ!" @@ -57,4 +69,5 @@ IDS_ASKFORUSER "ÐÐ¼Ñ Ð¿Ð¾Ð»ÑзоваÑелÑ: " IDS_ASKFORPASSWORD "ÐаÑолÑ: " IDS_FORCELOGOFF "ÐÑи ÑегиÑÑÑаÑии нового полÑзоваÑÐµÐ»Ñ Ð²Ñе неÑÐ¾Ñ ÑаненнÑе даннÑе бÑдÑÑ ÑÑеÑÑнÑ. ÐÑодолжиÑÑ?" + IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." END Modified: trunk/reactos/dll/win32/msgina/lang/sk-SK.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/sk-S…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/sk-SK.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/sk-SK.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -1,4 +1,4 @@ -/* TRANSLATOR: Mário KaÄmár /Mario Kacmar/ aka Kario (kario(a)szm.sk) +/* TRANSLATOR: Mário KaÄmár /Mario Kacmar/ aka Kario (kario(a)szm.sk) * DATE OF TR: 09-02-2008 */ @@ -37,6 +37,18 @@ PUSHBUTTON "Vypnúť",IDC_SHUTDOWN,179,122,50,14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer Locked" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "This computer is in use and has been locked.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Press Ctrl-Alt-Del to unlock this computer.",IDC_STATIC,37,106,231,8 +END + IDD_LOGGEDON_DLG DIALOGEX 0,0,275,116 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU CAPTION "BezpeÄnosÅ¥" @@ -59,4 +71,5 @@ IDS_ASKFORUSER "Meno použÃvateľa: " IDS_ASKFORPASSWORD "Heslo: " IDS_FORCELOGOFF "Toto spôsobà odhlásenie aktuálneho použÃvateľa a stratu vÅ¡etkých neuložených údajov. Chcete pokraÄovaÅ¥?" + IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." END Modified: trunk/reactos/dll/win32/msgina/lang/uk-UA.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/lang/uk-U…
============================================================================== --- trunk/reactos/dll/win32/msgina/lang/uk-UA.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/lang/uk-UA.rc [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -1,4 +1,4 @@ -/* +/* * PROJECT: ReactOS Logon GINA DLL * LICENSE: GPL - See COPYING in the top level directory * FILE: dll/win32/msgina/lang/uk-UA.rc @@ -55,6 +55,18 @@ PUSHBUTTON "СкаÑÑваÑи",IDCANCEL, 165, 95, 86, 14 END +IDD_LOCKED_DLG DIALOGEX 0,0,275,121 +STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP +CAPTION "Computer Locked" +FONT 8,"MS Shell Dlg",400,0,1 +BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,54 + ICON IDI_LOCKICON,-1,7,59,20,20 + LTEXT "This computer is in use and has been locked.",IDC_STATIC,37,61,231,8 + LTEXT "Message",IDC_LOCKMSG,37,75,231,26 + LTEXT "Press Ctrl-Alt-Del to unlock this computer.",IDC_STATIC,37,106,231,8 +END + STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "ÐаÑкаво пÑоÑимо!" @@ -63,4 +75,5 @@ IDS_ASKFORUSER "ÐоÑиÑÑÑваÑ: " IDS_ASKFORPASSWORD "ÐаÑолÑ: " IDS_FORCELOGOFF "Це завеÑÑиÑÑ ÑÐµÐ°Ð½Ñ Ð¿Ð¾ÑоÑного коÑиÑÑÑваÑа Ñ Ð²ÑÑ Ð½ÐµÐ·Ð±ÐµÑÐµÐ¶ÐµÐ½Ñ Ð´Ð°Ð½Ñ Ð±ÑдÑÑÑ Ð·Ð°Ð³ÑбленÑ. ÐÑодовжиÑи?" + IDS_LOCKMMSG "Only %s or an Administrator can unlock this computer." END Modified: trunk/reactos/dll/win32/msgina/msgina.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/msgina.c?…
============================================================================== --- trunk/reactos/dll/win32/msgina/msgina.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/msgina.c [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -681,6 +681,22 @@ return pGinaUI->LockedSAS(pgContext); } + +/* + * @implemented + */ +VOID +WINAPI +WlxDisplayLockedNotice(PVOID pWlxContext) +{ + PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; + + TRACE("WlxDisplayLockedNotice()\n"); + + pGinaUI->DisplayLockedNotice(pgContext); +} + + /* * @implemented */ Modified: trunk/reactos/dll/win32/msgina/msgina.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/msgina.h?…
============================================================================== --- trunk/reactos/dll/win32/msgina/msgina.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/msgina.h [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -48,6 +48,8 @@ typedef INT (*PFGINA_LOGGEDONSAS)(PGINA_CONTEXT, DWORD); typedef INT (*PFGINA_LOGGEDOUTSAS)(PGINA_CONTEXT); typedef INT (*PFGINA_LOCKEDSAS)(PGINA_CONTEXT); +typedef VOID (*PFGINA_DISPLAYLOCKEDNOTICE)(PGINA_CONTEXT); + typedef struct _GINA_UI { PFGINA_INITIALIZE Initialize; @@ -57,6 +59,7 @@ PFGINA_LOGGEDONSAS LoggedOnSAS; PFGINA_LOGGEDOUTSAS LoggedOutSAS; PFGINA_LOCKEDSAS LockedSAS; + PFGINA_DISPLAYLOCKEDNOTICE DisplayLockedNotice; } GINA_UI, *PGINA_UI; /* msgina.c */ Modified: trunk/reactos/dll/win32/msgina/resource.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/resource.…
============================================================================== --- trunk/reactos/dll/win32/msgina/resource.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/resource.h [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -15,6 +15,7 @@ #define IDC_LOCK 1006 #define IDC_ROSLOGO 1007 #define IDC_TASKMGR 1008 +#define IDC_LOCKMSG 1009 #define IDI_ROSLOGO 20000 @@ -26,5 +27,6 @@ #define IDS_ASKFORUSER 40003 #define IDS_ASKFORPASSWORD 40004 #define IDS_FORCELOGOFF 40005 +#define IDS_LOCKMSG 40006 /* EOF */ Modified: trunk/reactos/dll/win32/msgina/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/stubs.c?r…
============================================================================== --- trunk/reactos/dll/win32/msgina/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/stubs.c [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -37,19 +37,6 @@ */ UNIMPLEMENTED; return FALSE; -} - - -/* - * @unimplemented - */ -VOID WINAPI -WlxDisplayLockedNotice( - PVOID pWlxContext) -{ - UNREFERENCED_PARAMETER(pWlxContext); - - UNIMPLEMENTED; } Modified: trunk/reactos/dll/win32/msgina/tui.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/tui.c?rev…
============================================================================== --- trunk/reactos/dll/win32/msgina/tui.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/tui.c [iso-8859-1] Wed Feb 13 23:24:15 2013 @@ -247,6 +247,12 @@ return WLX_SAS_ACTION_UNLOCK_WKSTA; } +static VOID +TUIDisplayLockedNotice( + IN OUT PGINA_CONTEXT pgContext) +{ +} + GINA_UI GinaTextUI = { TUIInitialize, TUIDisplayStatusMessage, @@ -255,4 +261,5 @@ TUILoggedOnSAS, TUILoggedOutSAS, TUILockedSAS, + TUIDisplayLockedNotice, };
11 years, 10 months
1
0
0
0
[tkreuzer] 58310: [FREELDR] Fix some MSVC/x64 warnings
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Feb 12 10:25:19 2013 New Revision: 58310 URL:
http://svn.reactos.org/svn/reactos?rev=58310&view=rev
Log: [FREELDR] Fix some MSVC/x64 warnings Modified: trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c Modified: trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inffi…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c [iso-8859-1] Tue Feb 12 10:25:19 2013 @@ -235,7 +235,7 @@ PCHAR Name) { PINFCACHESECTION Section = NULL; - ULONG Size; + SIZE_T Size; if (Cache == NULL || Name == NULL) { @@ -335,7 +335,7 @@ PCHAR Data) { PINFCACHEFIELD Field; - ULONG Size; + SIZE_T Size; Size = sizeof(INFCACHEFIELD) + strlen(Data); Field = (PINFCACHEFIELD)MmHeapAlloc (Size); @@ -438,7 +438,7 @@ if (len > MAX_FIELD_LEN - parser->token_len) len = MAX_FIELD_LEN - parser->token_len; - parser->token_len += len; + parser->token_len += (ULONG)len; for ( ; len > 0; len--, dst++, src++) *dst = *src ? (CHAR)*src : L' '; *dst = 0; @@ -1314,7 +1314,7 @@ PINFCACHEFIELD CacheField; PINFCACHEFIELD FieldPtr; ULONG Index; - ULONG Size; + SIZE_T Size; PCHAR Ptr; if (Context == NULL || Context->Line == NULL || FieldIndex == 0) @@ -1346,7 +1346,7 @@ Size++; if (RequiredSize != NULL) - *RequiredSize = Size; + *RequiredSize = (ULONG)Size; if (ReturnBuffer != NULL) { @@ -1383,7 +1383,7 @@ PINFCACHEFIELD CacheField; ULONG Index; PCHAR Ptr; - ULONG Size; + SIZE_T Size; if (Context == NULL || Context->Line == NULL || FieldIndex == 0) { @@ -1415,7 +1415,7 @@ Size = strlen (Ptr) + 1; if (RequiredSize != NULL) - *RequiredSize = Size; + *RequiredSize = (ULONG)Size; if (ReturnBuffer != NULL) {
11 years, 10 months
1
0
0
0
[ekohl] 58309: [LSASRV] Add missing header.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Feb 10 21:14:01 2013 New Revision: 58309 URL:
http://svn.reactos.org/svn/reactos?rev=58309&view=rev
Log: [LSASRV] Add missing header. Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.h Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.h?…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] Sun Feb 10 21:14:01 2013 @@ -20,6 +20,7 @@ #include <ndk/lpctypes.h> #include <ndk/lpcfuncs.h> #include <ndk/obfuncs.h> +#include <ndk/psfuncs.h> #include <ndk/rtlfuncs.h> #include <ndk/setypes.h>
11 years, 10 months
1
0
0
0
[ekohl] 58308: [LSASRV] Create a context struct when the client is registered and delete it when the client is deregistered. In the mean time, pass the context to all client authentication function...
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Feb 10 21:09:28 2013 New Revision: 58308 URL:
http://svn.reactos.org/svn/reactos?rev=58308&view=rev
Log: [LSASRV] Create a context struct when the client is registered and delete it when the client is deregistered. In the mean time, pass the context to all client authentication functions. The context contains a handle to the client process and a handle to the current connection port. The process handle will later be used to retrieve and return logon data and to pass the toke handle back to the client. Modified: trunk/reactos/dll/win32/lsasrv/authport.c Modified: trunk/reactos/dll/win32/lsasrv/authport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/authport.…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/authport.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/authport.c [iso-8859-1] Sun Feb 10 21:09:28 2013 @@ -14,6 +14,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(lsasrv); +typedef struct _LSAP_LOGON_CONTEXT +{ + LIST_ENTRY Entry; + HANDLE ClientProcessHandle; + HANDLE ConnectionHandle; +} LSAP_LOGON_CONTEXT, *PLSAP_LOGON_CONTEXT; + + +static LIST_ENTRY LsapLogonContextList; + static HANDLE PortThreadHandle = NULL; static HANDLE AuthPortHandle = NULL; @@ -21,57 +31,189 @@ /* FUNCTIONS ***************************************************************/ static NTSTATUS -LsapCallAuthenticationPackage(PLSA_API_MSG RequestMsg) -{ +LsapCallAuthenticationPackage(PLSA_API_MSG RequestMsg, + PLSAP_LOGON_CONTEXT LogonContext) +{ + TRACE("(%p %p)\n", RequestMsg, LogonContext); + + return STATUS_SUCCESS; +} + + +static NTSTATUS +LsapDeregisterLogonProcess(PLSA_API_MSG RequestMsg, + PLSAP_LOGON_CONTEXT LogonContext) +{ + TRACE("(%p %p)\n", RequestMsg, LogonContext); + + RemoveHeadList(&LogonContext->Entry); + + NtClose(LogonContext->ClientProcessHandle); + NtClose(LogonContext->ConnectionHandle); + + RtlFreeHeap(RtlGetProcessHeap(), 0, LogonContext); + + return STATUS_SUCCESS; +} + + +static NTSTATUS +LsapLogonUser(PLSA_API_MSG RequestMsg, + PLSAP_LOGON_CONTEXT LogonContext) +{ + TRACE("(%p %p)\n", RequestMsg, LogonContext); + + TRACE("LogonType: %lu\n", RequestMsg->LogonUser.Request.LogonType); + TRACE("AuthenticationPackage: 0x%08lx\n", RequestMsg->LogonUser.Request.AuthenticationPackage); + TRACE("AuthenticationInformation: %p\n", RequestMsg->LogonUser.Request.AuthenticationInformation); + TRACE("AuthenticationInformationLength: %lu\n", RequestMsg->LogonUser.Request.AuthenticationInformationLength); + + + + + RequestMsg->LogonUser.Reply.ProfileBuffer = NULL; + RequestMsg->LogonUser.Reply.ProfileBufferLength = 0; +// LUID LogonId; + RequestMsg->LogonUser.Reply.Token = NULL; +// QUOTA_LIMITS Quotas; + RequestMsg->LogonUser.Reply.SubStatus = STATUS_SUCCESS; + + return STATUS_SUCCESS; +} + + +static NTSTATUS +LsapLookupAuthenticationPackage(PLSA_API_MSG RequestMsg, + PLSAP_LOGON_CONTEXT LogonContext) +{ + TRACE("(%p %p)\n", RequestMsg, LogonContext); + + TRACE("PackageName: %s\n", RequestMsg->LookupAuthenticationPackage.Request.PackageName); + + RequestMsg->LookupAuthenticationPackage.Reply.Package = 0x12345678; + + return STATUS_SUCCESS; +} + + +static NTSTATUS +LsapCheckLogonProcess(PLSA_API_MSG RequestMsg, + PLSAP_LOGON_CONTEXT *LogonContext) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE ProcessHandle = NULL; + PLSAP_LOGON_CONTEXT Context = NULL; + NTSTATUS Status; + TRACE("(%p)\n", RequestMsg); - return STATUS_SUCCESS; -} - - -static NTSTATUS -LsapDeregisterLogonProcess(PLSA_API_MSG RequestMsg) -{ + TRACE("Client ID: %p %p\n", RequestMsg->h.ClientId.UniqueProcess, RequestMsg->h.ClientId.UniqueThread); + + InitializeObjectAttributes(&ObjectAttributes, + NULL, + 0, + NULL, + NULL); + + Status = NtOpenProcess(&ProcessHandle, + PROCESS_VM_READ, + &ObjectAttributes, + &RequestMsg->h.ClientId); + if (!NT_SUCCESS(Status)) + { + TRACE("NtOpenProcess() failed (Status %lx)\n", Status); + return Status; + } + + /* Allocate the logon context */ + Context = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + sizeof(LSAP_LOGON_CONTEXT)); + if (Context == NULL) + { + NtClose(ProcessHandle); + return STATUS_INSUFFICIENT_RESOURCES; + } + + TRACE("New LogonContext: %p\n", Context); + + Context->ClientProcessHandle = ProcessHandle; + + *LogonContext = Context; + + return STATUS_SUCCESS; +} + + +static NTSTATUS +LsapHandlePortConnection(PLSA_API_MSG RequestMsg) +{ + PLSAP_LOGON_CONTEXT LogonContext = NULL; + HANDLE ConnectionHandle = NULL; + BOOLEAN Accept; + REMOTE_PORT_VIEW RemotePortView; + NTSTATUS Status; + TRACE("(%p)\n", RequestMsg); - return STATUS_SUCCESS; -} - - -static NTSTATUS -LsapLogonUser(PLSA_API_MSG RequestMsg) -{ - TRACE("(%p)\n", RequestMsg); - - return STATUS_SUCCESS; -} - - -static NTSTATUS -LsapLookupAuthenticationPackage(PLSA_API_MSG RequestMsg) -{ - TRACE("(%p)\n", RequestMsg); - - TRACE("PackageName: %s\n", RequestMsg->LookupAuthenticationPackage.Request.PackageName); - - RequestMsg->LookupAuthenticationPackage.Reply.Package = 0x12345678; - - return STATUS_SUCCESS; + TRACE("Logon Process Name: %s\n", RequestMsg->ConnectInfo.LogonProcessNameBuffer); + + Status = LsapCheckLogonProcess(RequestMsg, + &LogonContext); + + RequestMsg->ConnectInfo.OperationalMode = 0x43218765; + + RequestMsg->ConnectInfo.Status = Status; + + if (NT_SUCCESS(Status)) + { + Accept = TRUE; + } + else + { + Accept = FALSE; + } + + RemotePortView.Length = sizeof(REMOTE_PORT_VIEW); + Status = NtAcceptConnectPort(&ConnectionHandle, + (PVOID*)LogonContext, + &RequestMsg->h, + Accept, + NULL, + &RemotePortView); + if (!NT_SUCCESS(Status)) + { + ERR("NtAcceptConnectPort failed (Status 0x%lx)\n", Status); + return Status; + } + + if (Accept == TRUE) + { + LogonContext->ConnectionHandle = ConnectionHandle; + + InsertHeadList(&LsapLogonContextList, + &LogonContext->Entry); + + Status = NtCompleteConnectPort(ConnectionHandle); + if (!NT_SUCCESS(Status)) + { + ERR("NtCompleteConnectPort failed (Status 0x%lx)\n", Status); + return Status; + } + } + + return Status; } NTSTATUS WINAPI AuthPortThreadRoutine(PVOID Param) { + PLSAP_LOGON_CONTEXT LogonContext; PLSA_API_MSG ReplyMsg = NULL; LSA_API_MSG RequestMsg; NTSTATUS Status; - HANDLE ConnectionHandle = NULL; - PVOID Context = NULL; - BOOLEAN Accept; - REMOTE_PORT_VIEW RemotePortView; - TRACE("AuthPortThreadRoutine() called\n"); Status = STATUS_SUCCESS; @@ -79,7 +221,7 @@ for (;;) { Status = NtReplyWaitReceivePort(AuthPortHandle, - 0, + (PVOID*)&LogonContext, &ReplyMsg->h, &RequestMsg.h); if (!NT_SUCCESS(Status)) @@ -94,34 +236,7 @@ { case LPC_CONNECTION_REQUEST: TRACE("Port connection request\n"); - - RemotePortView.Length = sizeof(REMOTE_PORT_VIEW); - - TRACE("Logon Process Name: %s\n", RequestMsg.ConnectInfo.LogonProcessNameBuffer); - - RequestMsg.ConnectInfo.OperationalMode = 0x43218765; - RequestMsg.ConnectInfo.Status = STATUS_SUCCESS; - - Accept = TRUE; - Status = NtAcceptConnectPort(&ConnectionHandle, - &Context, - &RequestMsg.h, - Accept, - NULL, - &RemotePortView); - if (!NT_SUCCESS(Status)) - { - ERR("NtAcceptConnectPort failed (Status 0x%lx)\n", Status); - return Status; - } - - Status = NtCompleteConnectPort(ConnectionHandle); - if (!NT_SUCCESS(Status)) - { - ERR("NtCompleteConnectPort failed (Status 0x%lx)\n", Status); - return Status; - } - + Status = LsapHandlePortConnection(&RequestMsg); ReplyMsg = NULL; break; @@ -141,27 +256,42 @@ switch (RequestMsg.ApiNumber) { case LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE: - RequestMsg.Status = LsapCallAuthenticationPackage(&RequestMsg); + RequestMsg.Status = LsapCallAuthenticationPackage(&RequestMsg, + LogonContext); + ReplyMsg = &RequestMsg; break; case LSASS_REQUEST_DEREGISTER_LOGON_PROCESS: - RequestMsg.Status = LsapDeregisterLogonProcess(&RequestMsg); + + ReplyMsg = &RequestMsg; + RequestMsg.Status = STATUS_SUCCESS; + Status = NtReplyPort(AuthPortHandle, + &ReplyMsg->h); + + LsapDeregisterLogonProcess(&RequestMsg, + LogonContext); + + ReplyMsg = NULL; break; case LSASS_REQUEST_LOGON_USER: - RequestMsg.Status = LsapLogonUser(&RequestMsg); + RequestMsg.Status = LsapLogonUser(&RequestMsg, + LogonContext); + ReplyMsg = &RequestMsg; break; case LSASS_REQUEST_LOOKUP_AUTHENTICATION_PACKAGE: - RequestMsg.Status = LsapLookupAuthenticationPackage(&RequestMsg); + RequestMsg.Status = LsapLookupAuthenticationPackage(&RequestMsg, + LogonContext); + ReplyMsg = &RequestMsg; break; default: RequestMsg.Status = STATUS_SUCCESS; /* FIXME */ + ReplyMsg = &RequestMsg; break; } - ReplyMsg = &RequestMsg; break; } } @@ -177,6 +307,9 @@ UNICODE_STRING PortName; DWORD ThreadId; NTSTATUS Status; + + /* Initialize the logon context list */ + InitializeListHead(&LsapLogonContextList); RtlInitUnicodeString(&PortName, L"\\LsaAuthenticationPort");
11 years, 10 months
1
0
0
0
[akhaldi] 58307: [GDI32_APITEST] * Add missing stdio inclusion.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Feb 10 16:48:18 2013 New Revision: 58307 URL:
http://svn.reactos.org/svn/reactos?rev=58307&view=rev
Log: [GDI32_APITEST] * Add missing stdio inclusion. Modified: trunk/rostests/apitests/gdi32/GetTextExtentExPoint.c trunk/rostests/apitests/gdi32/PatBlt.c Modified: trunk/rostests/apitests/gdi32/GetTextExtentExPoint.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/GetTextExt…
============================================================================== --- trunk/rostests/apitests/gdi32/GetTextExtentExPoint.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/GetTextExtentExPoint.c [iso-8859-1] Sun Feb 10 16:48:18 2013 @@ -5,6 +5,7 @@ * PROGRAMMERS: Timo Kreuzer */ +#include <stdio.h> #include <wine/test.h> #include <wingdi.h> #include <winuser.h> Modified: trunk/rostests/apitests/gdi32/PatBlt.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/PatBlt.c?r…
============================================================================== --- trunk/rostests/apitests/gdi32/PatBlt.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/PatBlt.c [iso-8859-1] Sun Feb 10 16:48:18 2013 @@ -5,6 +5,7 @@ * PROGRAMMERS: Timo Kreuzer */ +#include <stdio.h> #include <wine/test.h> #include <wingdi.h>
11 years, 10 months
1
0
0
0
[hbelusca] 58306: [KERNEL32] Code reorganization only : move the console-related initialization functions into a dedicated file, and create a specific header to hold console function definitions.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun Feb 10 13:59:09 2013 New Revision: 58306 URL:
http://svn.reactos.org/svn/reactos?rev=58306&view=rev
Log: [KERNEL32] Code reorganization only : move the console-related initialization functions into a dedicated file, and create a specific header to hold console function definitions. Added: branches/ros-csrss/dll/win32/kernel32/client/console/init.c (with props) branches/ros-csrss/dll/win32/kernel32/include/console.h (with props) Modified: branches/ros-csrss/dll/win32/kernel32/CMakeLists.txt 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/include/kernel32.h branches/ros-csrss/dll/win32/kernel32/k32.h Modified: branches/ros-csrss/dll/win32/kernel32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/CM…
============================================================================== --- branches/ros-csrss/dll/win32/kernel32/CMakeLists.txt [iso-8859-1] (original) +++ branches/ros-csrss/dll/win32/kernel32/CMakeLists.txt [iso-8859-1] Sun Feb 10 13:59:09 2013 @@ -37,6 +37,7 @@ client/console/alias.c client/console/console.c client/console/history.c + client/console/init.c client/console/readwrite.c client/console/vista.c client/file/backup.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] Sun Feb 10 13:59:09 2013 @@ -14,11 +14,12 @@ #define NDEBUG #include <debug.h> + +/* GLOBALS ********************************************************************/ + extern RTL_CRITICAL_SECTION ConsoleLock; extern BOOL ConsoleInitialized; extern BOOL WINAPI IsDebuggerPresent(VOID); - -/* GLOBALS ********************************************************************/ /* Console reserved "file" names */ static LPCWSTR BaseConFileName = CONSOLE_FILE_NAME; @@ -34,6 +35,7 @@ #define INPUTEXENAME_BUFLEN 256 static WCHAR InputExeName[INPUTEXENAME_BUFLEN]; + /* Default Console Control Handler ********************************************/ @@ -189,49 +191,6 @@ /* FUNCTIONS ******************************************************************/ - -VOID -InitConsoleProps(IN OUT PCONSOLE_PROPS ConsoleProps) -{ - STARTUPINFOW si; - - GetStartupInfoW(&si); - - ConsoleProps->dwStartupFlags = si.dwFlags; - if (si.dwFlags & STARTF_USEFILLATTRIBUTE) - { - ConsoleProps->FillAttribute = si.dwFillAttribute; - } - if (si.dwFlags & STARTF_USECOUNTCHARS) - { - ConsoleProps->ScreenBufferSize.X = (SHORT)(si.dwXCountChars); - ConsoleProps->ScreenBufferSize.Y = (SHORT)(si.dwYCountChars); - } - if (si.dwFlags & STARTF_USESHOWWINDOW) - { - ConsoleProps->ShowWindow = si.wShowWindow; - } - if (si.dwFlags & STARTF_USEPOSITION) - { - ConsoleProps->ConsoleWindowOrigin.x = (LONG)(si.dwX); - ConsoleProps->ConsoleWindowOrigin.y = (LONG)(si.dwY); - } - if (si.dwFlags & STARTF_USESIZE) - { - ConsoleProps->ConsoleWindowSize.cx = (LONG)(si.dwXSize); - ConsoleProps->ConsoleWindowSize.cy = (LONG)(si.dwYSize); - } - - if (si.lpTitle) - { - wcsncpy(ConsoleProps->ConsoleTitle, si.lpTitle, MAX_PATH + 1); - } - else - { - ConsoleProps->ConsoleTitle[0] = L'\0'; - } -} - LPCWSTR IntCheckForConsoleFileName(IN LPCWSTR pszName, Added: branches/ros-csrss/dll/win32/kernel32/client/console/init.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/cl…
============================================================================== --- branches/ros-csrss/dll/win32/kernel32/client/console/init.c (added) +++ branches/ros-csrss/dll/win32/kernel32/client/console/init.c [iso-8859-1] Sun Feb 10 13:59:09 2013 @@ -1,0 +1,241 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: dll/win32/kernel32/client/console/init.c + * PURPOSE: Console API Client Initialization + * PROGRAMMERS: Hermes Belusca - Maito + */ + +/* INCLUDES *******************************************************************/ + +#include <k32.h> + +#define NDEBUG +#include <debug.h> + + +/* GLOBALS ********************************************************************/ + +RTL_CRITICAL_SECTION ConsoleLock; +BOOL ConsoleInitialized = FALSE; + +extern DWORD WINAPI ConsoleControlDispatcher(IN LPVOID lpThreadParameter); +extern HANDLE InputWaitHandle; + +#define WIN_OBJ_DIR L"\\Windows" +#define SESSION_DIR L"\\Sessions" + + +/* FUNCTIONS ******************************************************************/ + +VOID +InitConsoleProps(IN OUT PCONSOLE_PROPS ConsoleProps) +{ + STARTUPINFOW si; + + GetStartupInfoW(&si); + + ConsoleProps->dwStartupFlags = si.dwFlags; + if (si.dwFlags & STARTF_USEFILLATTRIBUTE) + { + ConsoleProps->FillAttribute = si.dwFillAttribute; + } + if (si.dwFlags & STARTF_USECOUNTCHARS) + { + ConsoleProps->ScreenBufferSize.X = (SHORT)(si.dwXCountChars); + ConsoleProps->ScreenBufferSize.Y = (SHORT)(si.dwYCountChars); + } + if (si.dwFlags & STARTF_USESHOWWINDOW) + { + ConsoleProps->ShowWindow = si.wShowWindow; + } + if (si.dwFlags & STARTF_USEPOSITION) + { + ConsoleProps->ConsoleWindowOrigin.x = (LONG)(si.dwX); + ConsoleProps->ConsoleWindowOrigin.y = (LONG)(si.dwY); + } + if (si.dwFlags & STARTF_USESIZE) + { + ConsoleProps->ConsoleWindowSize.cx = (LONG)(si.dwXSize); + ConsoleProps->ConsoleWindowSize.cy = (LONG)(si.dwYSize); + } + + if (si.lpTitle) + { + wcsncpy(ConsoleProps->ConsoleTitle, si.lpTitle, MAX_PATH + 1); + } + else + { + ConsoleProps->ConsoleTitle[0] = L'\0'; + } +} + + +BOOL +WINAPI +BasepInitConsole(VOID) +{ + NTSTATUS Status; + PRTL_USER_PROCESS_PARAMETERS Parameters = NtCurrentPeb()->ProcessParameters; + WCHAR SessionDir[256]; + ULONG SessionId = NtCurrentPeb()->SessionId; + BOOLEAN InServer; + + CONSOLE_CONNECTION_INFO ConnectInfo; + ULONG ConnectInfoSize = sizeof(ConnectInfo); + + DPRINT("BasepInitConsole for : %wZ\n", &Parameters->ImagePathName); + DPRINT("Our current console handles are: %lx, %lx, %lx %lx\n", + Parameters->ConsoleHandle, Parameters->StandardInput, + Parameters->StandardOutput, Parameters->StandardError); + + /* Initialize our global console DLL lock */ + Status = RtlInitializeCriticalSection(&ConsoleLock); + if (!NT_SUCCESS(Status)) return FALSE; + ConsoleInitialized = TRUE; + + /* Do nothing if this isn't a console app... */ + if (RtlImageNtHeader(GetModuleHandle(NULL))->OptionalHeader.Subsystem != + IMAGE_SUBSYSTEM_WINDOWS_CUI) + { + DPRINT("Image is not a console application\n"); + Parameters->ConsoleHandle = NULL; + ConnectInfo.ConsoleNeeded = FALSE; // ConsoleNeeded is used for knowing whether or not this is a CUI app. + + ConnectInfo.ConsoleProps.ConsoleTitle[0] = L'\0'; + ConnectInfo.AppPath[0] = L'\0'; + } + else + { + SIZE_T Length = 0; + LPCWSTR ExeName; + + InitConsoleProps(&ConnectInfo.ConsoleProps); + + Length = min(sizeof(ConnectInfo.AppPath) / sizeof(ConnectInfo.AppPath[0]), + Parameters->ImagePathName.Length / sizeof(WCHAR)); + wcsncpy(ConnectInfo.AppPath, Parameters->ImagePathName.Buffer, Length); + ConnectInfo.AppPath[Length] = L'\0'; + + /* Initialize Input EXE name */ + ExeName = wcsrchr(Parameters->ImagePathName.Buffer, L'\\'); + if (ExeName) SetConsoleInputExeNameW(ExeName + 1); + + /* Assume one is needed */ + ConnectInfo.ConsoleNeeded = TRUE; + + /* Handle the special flags given to us by BasePushProcessParameters */ + if (Parameters->ConsoleHandle == HANDLE_DETACHED_PROCESS) + { + /* No console to create */ + DPRINT("No console to create\n"); + Parameters->ConsoleHandle = NULL; + ConnectInfo.ConsoleNeeded = FALSE; + } + else if (Parameters->ConsoleHandle == HANDLE_CREATE_NEW_CONSOLE) + { + /* We'll get the real one soon */ + DPRINT("Creating new console\n"); + Parameters->ConsoleHandle = NULL; + } + else if (Parameters->ConsoleHandle == HANDLE_CREATE_NO_WINDOW) + { + /* We'll get the real one soon */ + DPRINT("Creating new invisible console\n"); + Parameters->ConsoleHandle = NULL; + ConnectInfo.ConsoleProps.ShowWindow = SW_HIDE; + } + else + { + if (Parameters->ConsoleHandle == INVALID_HANDLE_VALUE) + { + Parameters->ConsoleHandle = NULL; + } + DPRINT("Using existing console: %x\n", Parameters->ConsoleHandle); + } + } + + /* Now use the proper console handle */ + ConnectInfo.Console = Parameters->ConsoleHandle; + + /* Initialize Console Ctrl Handler */ + InitConsoleCtrlHandling(); + ConnectInfo.CtrlDispatcher = ConsoleControlDispatcher; + + /* Setup the right Object Directory path */ + if (!SessionId) + { + /* Use the raw path */ + wcscpy(SessionDir, WIN_OBJ_DIR); + } + else + { + /* Use the session path */ + swprintf(SessionDir, + L"%ws\\%ld%ws", + SESSION_DIR, + SessionId, + WIN_OBJ_DIR); + } + + /* Connect to the Console Server */ + DPRINT("Connecting to the Console Server in BasepInitConsole...\n"); + Status = CsrClientConnectToServer(SessionDir, + CONSRV_SERVERDLL_INDEX, + &ConnectInfo, + &ConnectInfoSize, + &InServer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to connect to the Console Server (Status %lx)\n", Status); + return FALSE; + } + + /* Nothing to do for server-to-server */ + if (InServer) return TRUE; + + /* Nothing to do if not a console app */ + if (!ConnectInfo.ConsoleNeeded) return TRUE; + + /* We got the handles, let's set them */ + if ((Parameters->ConsoleHandle = ConnectInfo.Console)) + { + /* If we already had some, don't use the new ones */ + if (!Parameters->StandardInput) + { + Parameters->StandardInput = ConnectInfo.InputHandle; + } + if (!Parameters->StandardOutput) + { + Parameters->StandardOutput = ConnectInfo.OutputHandle; + } + if (!Parameters->StandardError) + { + Parameters->StandardError = ConnectInfo.ErrorHandle; + } + } + + InputWaitHandle = ConnectInfo.InputWaitHandle; + + DPRINT("Console setup: %lx, %lx, %lx, %lx\n", + Parameters->ConsoleHandle, + Parameters->StandardInput, + Parameters->StandardOutput, + Parameters->StandardError); + return TRUE; +} + + +VOID +WINAPI +BasepUninitConsole(VOID) +{ + /* Delete our critical section if we were initialized */ + if (ConsoleInitialized == TRUE) + { + ConsoleInitialized = FALSE; + RtlDeleteCriticalSection(&ConsoleLock); + } +} + +/* EOF */ Propchange: branches/ros-csrss/dll/win32/kernel32/client/console/init.c ------------------------------------------------------------------------------ svn:eol-style = native 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] Sun Feb 10 13:59:09 2013 @@ -27,15 +27,10 @@ HMODULE kernel32_handle = NULL; PPEB Peb; ULONG SessionId; -BOOL ConsoleInitialized = FALSE; static BOOL DllInitialized = FALSE; /* Critical section for various kernel32 data structures */ RTL_CRITICAL_SECTION BaseDllDirectoryLock; -RTL_CRITICAL_SECTION ConsoleLock; - -extern DWORD WINAPI ConsoleControlDispatcher(IN LPVOID lpThreadParameter); -extern HANDLE InputWaitHandle; extern BOOL FASTCALL NlsInit(VOID); extern VOID FASTCALL NlsUninit(VOID); @@ -44,160 +39,6 @@ #define SESSION_DIR L"\\Sessions" /* FUNCTIONS *****************************************************************/ - -BOOL -WINAPI -BasepInitConsole(VOID) -{ - NTSTATUS Status; - PRTL_USER_PROCESS_PARAMETERS Parameters = NtCurrentPeb()->ProcessParameters; - WCHAR SessionDir[256]; - ULONG SessionId = NtCurrentPeb()->SessionId; - BOOLEAN InServer; - - CONSOLE_CONNECTION_INFO ConnectInfo; - ULONG ConnectInfoSize = sizeof(ConnectInfo); - - DPRINT("BasepInitConsole for : %wZ\n", &Parameters->ImagePathName); - DPRINT("Our current console handles are: %lx, %lx, %lx %lx\n", - Parameters->ConsoleHandle, Parameters->StandardInput, - Parameters->StandardOutput, Parameters->StandardError); - - /* Initialize our global console DLL lock */ - Status = RtlInitializeCriticalSection(&ConsoleLock); - if (!NT_SUCCESS(Status)) return FALSE; - ConsoleInitialized = TRUE; - - /* Do nothing if this isn't a console app... */ - if (RtlImageNtHeader(GetModuleHandle(NULL))->OptionalHeader.Subsystem != - IMAGE_SUBSYSTEM_WINDOWS_CUI) - { - DPRINT("Image is not a console application\n"); - Parameters->ConsoleHandle = NULL; - ConnectInfo.ConsoleNeeded = FALSE; // ConsoleNeeded is used for knowing whether or not this is a CUI app. - - ConnectInfo.ConsoleProps.ConsoleTitle[0] = L'\0'; - ConnectInfo.AppPath[0] = L'\0'; - } - else - { - SIZE_T Length = 0; - LPCWSTR ExeName; - - InitConsoleProps(&ConnectInfo.ConsoleProps); - - Length = min(sizeof(ConnectInfo.AppPath) / sizeof(ConnectInfo.AppPath[0]), - Parameters->ImagePathName.Length / sizeof(WCHAR)); - wcsncpy(ConnectInfo.AppPath, Parameters->ImagePathName.Buffer, Length); - ConnectInfo.AppPath[Length] = L'\0'; - - /* Initialize Input EXE name */ - ExeName = wcsrchr(Parameters->ImagePathName.Buffer, L'\\'); - if (ExeName) SetConsoleInputExeNameW(ExeName + 1); - - /* Assume one is needed */ - ConnectInfo.ConsoleNeeded = TRUE; - - /* Handle the special flags given to us by BasePushProcessParameters */ - if (Parameters->ConsoleHandle == HANDLE_DETACHED_PROCESS) - { - /* No console to create */ - DPRINT("No console to create\n"); - Parameters->ConsoleHandle = NULL; - ConnectInfo.ConsoleNeeded = FALSE; - } - else if (Parameters->ConsoleHandle == HANDLE_CREATE_NEW_CONSOLE) - { - /* We'll get the real one soon */ - DPRINT("Creating new console\n"); - Parameters->ConsoleHandle = NULL; - } - else if (Parameters->ConsoleHandle == HANDLE_CREATE_NO_WINDOW) - { - /* We'll get the real one soon */ - DPRINT("Creating new invisible console\n"); - Parameters->ConsoleHandle = NULL; - ConnectInfo.ConsoleProps.ShowWindow = SW_HIDE; - } - else - { - if (Parameters->ConsoleHandle == INVALID_HANDLE_VALUE) - { - Parameters->ConsoleHandle = NULL; - } - DPRINT("Using existing console: %x\n", Parameters->ConsoleHandle); - } - } - - /* Now use the proper console handle */ - ConnectInfo.Console = Parameters->ConsoleHandle; - - /* Initialize Console Ctrl Handler */ - InitConsoleCtrlHandling(); - ConnectInfo.CtrlDispatcher = ConsoleControlDispatcher; - - /* Setup the right Object Directory path */ - if (!SessionId) - { - /* Use the raw path */ - wcscpy(SessionDir, WIN_OBJ_DIR); - } - else - { - /* Use the session path */ - swprintf(SessionDir, - L"%ws\\%ld%ws", - SESSION_DIR, - SessionId, - WIN_OBJ_DIR); - } - - /* Connect to the Console Server */ - DPRINT("Connecting to the Console Server in BasepInitConsole...\n"); - Status = CsrClientConnectToServer(SessionDir, - CONSRV_SERVERDLL_INDEX, - &ConnectInfo, - &ConnectInfoSize, - &InServer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to connect to the Console Server (Status %lx)\n", Status); - return FALSE; - } - - /* Nothing to do for server-to-server */ - if (InServer) return TRUE; - - /* Nothing to do if not a console app */ - if (!ConnectInfo.ConsoleNeeded) return TRUE; - - /* We got the handles, let's set them */ - if ((Parameters->ConsoleHandle = ConnectInfo.Console)) - { - /* If we already had some, don't use the new ones */ - if (!Parameters->StandardInput) - { - Parameters->StandardInput = ConnectInfo.InputHandle; - } - if (!Parameters->StandardOutput) - { - Parameters->StandardOutput = ConnectInfo.OutputHandle; - } - if (!Parameters->StandardError) - { - Parameters->StandardError = ConnectInfo.ErrorHandle; - } - } - - InputWaitHandle = ConnectInfo.InputWaitHandle; - - DPRINT("Console setup: %lx, %lx, %lx, %lx\n", - Parameters->ConsoleHandle, - Parameters->StandardInput, - Parameters->StandardOutput, - Parameters->StandardError); - return TRUE; -} NTSTATUS NTAPI @@ -262,132 +103,136 @@ switch (dwReason) { case DLL_PROCESS_ATTACH: - - /* Set no filter intially */ - GlobalTopLevelExceptionFilter = RtlEncodePointer(NULL); - - /* Enable the Rtl thread pool and timer queue to use proper Win32 thread */ - RtlSetThreadPoolStartFunc(BaseCreateThreadPoolThread, BaseExitThreadPoolThread); - - /* Don't bother us for each thread */ - LdrDisableThreadCalloutsForDll((PVOID)hDll); - - /* Initialize default path to NULL */ - RtlInitUnicodeString(&BaseDefaultPath, NULL); - - /* Setup the right Object Directory path */ - if (!SessionId) { - /* Use the raw path */ - wcscpy(SessionDir, WIN_OBJ_DIR); + /* Set no filter intially */ + GlobalTopLevelExceptionFilter = RtlEncodePointer(NULL); + + /* Enable the Rtl thread pool and timer queue to use proper Win32 thread */ + RtlSetThreadPoolStartFunc(BaseCreateThreadPoolThread, BaseExitThreadPoolThread); + + /* Don't bother us for each thread */ + LdrDisableThreadCalloutsForDll((PVOID)hDll); + + /* Initialize default path to NULL */ + RtlInitUnicodeString(&BaseDefaultPath, NULL); + + /* Setup the right Object Directory path */ + if (!SessionId) + { + /* Use the raw path */ + wcscpy(SessionDir, WIN_OBJ_DIR); + } + else + { + /* Use the session path */ + swprintf(SessionDir, + L"%ws\\%ld%ws", + SESSION_DIR, + SessionId, + WIN_OBJ_DIR); + } + + /* Connect to the base server */ + DPRINT("Connecting to CSR in DllMain...\n"); + Status = CsrClientConnectToServer(SessionDir, + BASESRV_SERVERDLL_INDEX, + &Dummy, + &DummySize, + &BaseRunningInServerProcess); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to connect to CSR (Status %lx)\n", Status); + NtTerminateProcess(NtCurrentProcess(), Status); + return FALSE; + } + DPRINT("kernel32 DllMain - OK, connection succeeded\n"); + + /* Get the server data */ + ASSERT(Peb->ReadOnlyStaticServerData); + BaseStaticServerData = Peb->ReadOnlyStaticServerData[BASESRV_SERVERDLL_INDEX]; + ASSERT(BaseStaticServerData); + + /* Check if we are running a CSR Server */ + if (!BaseRunningInServerProcess) + { + /* Set the termination port for the thread */ + DPRINT("Creating new thread for CSR\n"); + CsrNewThread(); + } + + /* Initialize heap handle table */ + BaseDllInitializeMemoryManager(); + + /* Set HMODULE for our DLL */ + kernel32_handle = hCurrentModule = hDll; + + /* Set the directories */ + BaseWindowsDirectory = BaseStaticServerData->WindowsDirectory; + BaseWindowsSystemDirectory = BaseStaticServerData->WindowsSystemDirectory; + + /* Construct the default path (using the static buffer) */ + _snwprintf(BaseDefaultPathBuffer, + sizeof(BaseDefaultPathBuffer) / sizeof(WCHAR), + L".;%wZ;%wZ\\system;%wZ;", + &BaseWindowsSystemDirectory, + &BaseWindowsDirectory, + &BaseWindowsDirectory); + + BaseDefaultPath.Buffer = BaseDefaultPathBuffer; + BaseDefaultPath.Length = wcslen(BaseDefaultPathBuffer) * sizeof(WCHAR); + BaseDefaultPath.MaximumLength = sizeof(BaseDefaultPathBuffer); + + /* Use remaining part of the default path buffer for the append path */ + BaseDefaultPathAppend.Buffer = (PWSTR)((ULONG_PTR)BaseDefaultPathBuffer + BaseDefaultPath.Length); + BaseDefaultPathAppend.Length = 0; + BaseDefaultPathAppend.MaximumLength = BaseDefaultPath.MaximumLength - BaseDefaultPath.Length; + + /* Initialize command line */ + InitCommandLines(); + + /* Initialize the DLL critical section */ + RtlInitializeCriticalSection(&BaseDllDirectoryLock); + + /* Initialize the National Language Support routines */ + if (!NlsInit()) + { + DPRINT1("NLS Init failed\n"); + return FALSE; + } + + /* Initialize Console Support */ + if (!BasepInitConsole()) + { + DPRINT1("Failed to set up console\n"); + return FALSE; + } + + /* Initialize application certification globals */ + InitializeListHead(&BasepAppCertDllsList); + RtlInitializeCriticalSection(&gcsAppCert); + + /* Insert more dll attach stuff here! */ + DllInitialized = TRUE; + DPRINT("Initialization complete\n"); + break; } - else + + case DLL_PROCESS_DETACH: { - /* Use the session path */ - swprintf(SessionDir, - L"%ws\\%ld%ws", - SESSION_DIR, - SessionId, - WIN_OBJ_DIR); - } - - /* Connect to the base server */ - DPRINT("Connecting to CSR in DllMain...\n"); - Status = CsrClientConnectToServer(SessionDir, - BASESRV_SERVERDLL_INDEX, - &Dummy, - &DummySize, - &BaseRunningInServerProcess); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to connect to CSR (Status %lx)\n", Status); - NtTerminateProcess(NtCurrentProcess(), Status); - return FALSE; - } - DPRINT("kernel32 DllMain - OK, connection succeeded\n"); - - /* Get the server data */ - ASSERT(Peb->ReadOnlyStaticServerData); - BaseStaticServerData = Peb->ReadOnlyStaticServerData[BASESRV_SERVERDLL_INDEX]; - ASSERT(BaseStaticServerData); - - /* Check if we are running a CSR Server */ - if (!BaseRunningInServerProcess) - { - /* Set the termination port for the thread */ - DPRINT("Creating new thread for CSR\n"); - CsrNewThread(); - } - - /* Initialize heap handle table */ - BaseDllInitializeMemoryManager(); - - /* Set HMODULE for our DLL */ - kernel32_handle = hCurrentModule = hDll; - - /* Set the directories */ - BaseWindowsDirectory = BaseStaticServerData->WindowsDirectory; - BaseWindowsSystemDirectory = BaseStaticServerData->WindowsSystemDirectory; - - /* Construct the default path (using the static buffer) */ - _snwprintf(BaseDefaultPathBuffer, sizeof(BaseDefaultPathBuffer) / sizeof(WCHAR), - L".;%wZ;%wZ\\system;%wZ;", &BaseWindowsSystemDirectory, &BaseWindowsDirectory, &BaseWindowsDirectory); - - BaseDefaultPath.Buffer = BaseDefaultPathBuffer; - BaseDefaultPath.Length = wcslen(BaseDefaultPathBuffer) * sizeof(WCHAR); - BaseDefaultPath.MaximumLength = sizeof(BaseDefaultPathBuffer); - - /* Use remaining part of the default path buffer for the append path */ - BaseDefaultPathAppend.Buffer = (PWSTR)((ULONG_PTR)BaseDefaultPathBuffer + BaseDefaultPath.Length); - BaseDefaultPathAppend.Length = 0; - BaseDefaultPathAppend.MaximumLength = BaseDefaultPath.MaximumLength - BaseDefaultPath.Length; - - /* Initialize command line */ - InitCommandLines(); - - /* Initialize the DLL critical section */ - RtlInitializeCriticalSection(&BaseDllDirectoryLock); - - /* Initialize the National Language Support routines */ - if (!NlsInit()) - { - DPRINT1("NLS Init failed\n"); - return FALSE; - } - - /* Initialize Console Support */ - if (!BasepInitConsole()) - { - DPRINT1("Failed to set up console\n"); - return FALSE; - } - - /* Initialize application certification globals */ - InitializeListHead(&BasepAppCertDllsList); - RtlInitializeCriticalSection(&gcsAppCert); - - /* Insert more dll attach stuff here! */ - DllInitialized = TRUE; - DPRINT("Initialization complete\n"); - break; - - case DLL_PROCESS_DETACH: - DPRINT("DLL_PROCESS_DETACH\n"); if (DllInitialized == TRUE) { /* Insert more dll detach stuff here! */ NlsUninit(); + /* Uninitialize console support */ + BasepUninitConsole(); + /* Delete DLL critical section */ - if (ConsoleInitialized == TRUE) - { - ConsoleInitialized = FALSE; - RtlDeleteCriticalSection(&ConsoleLock); - } RtlDeleteCriticalSection(&BaseDllDirectoryLock); } break; + } default: break; Added: branches/ros-csrss/dll/win32/kernel32/include/console.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/in…
============================================================================== --- branches/ros-csrss/dll/win32/kernel32/include/console.h (added) +++ branches/ros-csrss/dll/win32/kernel32/include/console.h [iso-8859-1] Sun Feb 10 13:59:09 2013 @@ -1,0 +1,63 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS System Libraries + * FILE: dll/win32/kernel32/include/console.h + * PURPOSE: Console API Client Definitions + * PROGRAMMER: Hermes Belusca - Maito + */ + +#pragma once + +/* CONSTANTS ******************************************************************/ + +#define HANDLE_DETACHED_PROCESS (HANDLE)-2 +#define HANDLE_CREATE_NEW_CONSOLE (HANDLE)-3 +#define HANDLE_CREATE_NO_WINDOW (HANDLE)-4 + + +/* FUNCTION PROTOTYPES ********************************************************/ + +BOOL WINAPI +BasepInitConsole(VOID); + +VOID WINAPI +BasepUninitConsole(VOID); + +VOID WINAPI +InitConsoleCtrlHandling(VOID); + +HANDLE WINAPI +DuplicateConsoleHandle(HANDLE hConsole, + DWORD dwDesiredAccess, + BOOL bInheritHandle, + DWORD dwOptions); + +BOOL WINAPI +VerifyConsoleIoHandle(HANDLE Handle); + +BOOL WINAPI +CloseConsoleHandle(HANDLE Handle); + +HANDLE WINAPI +GetConsoleInputWaitHandle(VOID); + +HANDLE FASTCALL +TranslateStdHandle(HANDLE hHandle); + +VOID +InitConsoleProps(IN OUT PCONSOLE_PROPS ConsoleProps); + +LPCWSTR +IntCheckForConsoleFileName(IN LPCWSTR pszName, + IN DWORD dwDesiredAccess); + +HANDLE WINAPI +OpenConsoleW(LPCWSTR wsName, + DWORD dwDesiredAccess, + BOOL bInheritHandle, + DWORD dwShareMode); + +BOOL WINAPI +SetConsoleInputExeNameW(LPCWSTR lpInputExeName); + +/* EOF */ Propchange: branches/ros-csrss/dll/win32/kernel32/include/console.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: branches/ros-csrss/dll/win32/kernel32/include/kernel32.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/in…
============================================================================== --- branches/ros-csrss/dll/win32/kernel32/include/kernel32.h [iso-8859-1] (original) +++ branches/ros-csrss/dll/win32/kernel32/include/kernel32.h [iso-8859-1] Sun Feb 10 13:59:09 2013 @@ -61,10 +61,6 @@ #define FIELD_OFFSET(type,fld) ((LONG)&(((type *)0)->fld)) #endif -#define HANDLE_DETACHED_PROCESS (HANDLE)-2 -#define HANDLE_CREATE_NEW_CONSOLE (HANDLE)-3 -#define HANDLE_CREATE_NO_WINDOW (HANDLE)-4 - // // This stuff maybe should go in a vdm.h? // @@ -187,32 +183,7 @@ NTAPI BaseDllInitializeMemoryManager(VOID); -VOID WINAPI InitConsoleCtrlHandling(VOID); - -BOOL WINAPI VerifyConsoleIoHandle(HANDLE Handle); - -BOOL WINAPI CloseConsoleHandle(HANDLE Handle); - -HANDLE WINAPI -GetConsoleInputWaitHandle(VOID); - -VOID -InitConsoleProps(IN OUT PCONSOLE_PROPS ConsoleProps); - -LPCWSTR -IntCheckForConsoleFileName(IN LPCWSTR pszName, - IN DWORD dwDesiredAccess); - -HANDLE WINAPI OpenConsoleW(LPCWSTR wsName, - DWORD dwDesiredAccess, - BOOL bInheritHandle, - DWORD dwShareMode); - -BOOL WINAPI SetConsoleInputExeNameW(LPCWSTR lpInputExeName); - PTEB GetTeb(VOID); - -HANDLE FASTCALL TranslateStdHandle(HANDLE hHandle); PWCHAR FilenameA2W(LPCSTR NameA, BOOL alloc); DWORD FilenameW2A_N(LPSTR dest, INT destlen, LPCWSTR src, INT srclen); @@ -431,13 +402,6 @@ /* FIXME */ WCHAR WINAPI RtlAnsiCharToUnicodeChar(LPSTR *); -HANDLE -WINAPI -DuplicateConsoleHandle(HANDLE hConsole, - DWORD dwDesiredAccess, - BOOL bInheritHandle, - DWORD dwOptions); - VOID NTAPI BasepLocateExeLdrEntry(IN PLDR_DATA_TABLE_ENTRY Entry, Modified: branches/ros-csrss/dll/win32/kernel32/k32.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/k3…
============================================================================== --- branches/ros-csrss/dll/win32/kernel32/k32.h [iso-8859-1] (original) +++ branches/ros-csrss/dll/win32/kernel32/k32.h [iso-8859-1] Sun Feb 10 13:59:09 2013 @@ -70,4 +70,7 @@ /* Base Macros */ #include "include/base_x.h" +/* Console API Client Definitions */ +#include "include/console.h" + #endif
11 years, 10 months
1
0
0
0
[hbelusca] 58305: [KERNEL32-CONSRV] - Introduce a CONSOLE_PROPS structure to hold console properties such as its title or startup attributes it should have. Initialized at console application launc...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun Feb 10 12:36:57 2013 New Revision: 58305 URL:
http://svn.reactos.org/svn/reactos?rev=58305&view=rev
Log: [KERNEL32-CONSRV] - Introduce a CONSOLE_PROPS structure to hold console properties such as its title or startup attributes it should have. Initialized at console application launch time. I have to see how could it be possible to merge this structure with some parts of the GUI_CONSOLE_DATA structure and of the ConsoleInfo structure from console.dll (in /dll/cpl). - Use a helper function to initialize the CONSOLE_PROPS structure in kernel32, at console app start or when calling AllocConsole. - In BasepInitConsole, do initialization of CONSOLE_PROPS and related only if we are about to launch a console app. [CONSRV] - Adapt CONSOLE_CONNECTION_INFO and CONSOLE_ALLOCCONSOLE structures to take into account CONSOLE_PROPS. - Fix the way we are setting console titles. - Add experimental support for loading console properties and title and icon from shell links, thanks to the helper LoadShellLinkInfo. However I'm using there Shell COM facility to extract link properties (I could do it "the RAW way", however I would then know the format of link files, that I don't know and that I don't want to mix up with the console code). Therefore I must add dependencies to uuid and ole32 libraries. Note that icons are used in GUI consoles only (use the PrivateExtractIconExW function to retrieve both handles to the big and small icons at the same time). Part 1/2 [CONSRV] - Remove an unuseful xxxInitScreenBuffer function in the virtual functions console table. - In GUI_CONSOLE_DATA structure and related functions, temporarily explicitely mark which members may be used for both GUI and TUI consoles (for a future simplification). - Add temporary debug prints when we are setting console icon, to see the flow of calls (will be removed just before merging back to trunk). - Add temporary debug prints in ConSrvInitConsoleScreenBuffer and ConioDeleteScreenBuffer, to figure out how SBs are initialized. Modified: branches/ros-csrss/dll/win32/kernel32/client/console/alias.c 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/include/kernel32.h branches/ros-csrss/include/reactos/subsys/win/conmsg.h branches/ros-csrss/win32ss/user/consrv/CMakeLists.txt 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/guiconsole.c branches/ros-csrss/win32ss/user/consrv/guiconsole.h branches/ros-csrss/win32ss/user/consrv/handle.c branches/ros-csrss/win32ss/user/consrv/init.c branches/ros-csrss/win32ss/user/consrv/tuiconsole.c Modified: branches/ros-csrss/dll/win32/kernel32/client/console/alias.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/cl…
============================================================================== --- branches/ros-csrss/dll/win32/kernel32/client/console/alias.c [iso-8859-1] (original) +++ branches/ros-csrss/dll/win32/kernel32/client/console/alias.c [iso-8859-1] Sun Feb 10 12:36:57 2013 @@ -211,7 +211,7 @@ ConsoleAliasRequest->Target, ConsoleAliasRequest->TargetLength); - /* Release the capture buffer and exits */ + /* Release the capture buffer and exit */ CsrFreeCaptureBuffer(CaptureBuffer); return ConsoleAliasRequest->TargetLength; @@ -347,7 +347,7 @@ GetAllAliasesRequest->AliasesBuffer, GetAllAliasesRequest->AliasesBufferLength); - /* Release the capture buffer and exits */ + /* Release the capture buffer and exit */ CsrFreeCaptureBuffer(CaptureBuffer); return GetAllAliasesRequest->AliasesBufferLength; // / sizeof(WCHAR); (original code) @@ -514,7 +514,7 @@ GetAliasesExesRequest->ExeNames, GetAliasesExesRequest->Length); - /* Release the capture buffer and exits */ + /* Release the capture buffer and exit */ CsrFreeCaptureBuffer(CaptureBuffer); return GetAliasesExesRequest->Length; 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] Sun Feb 10 12:36:57 2013 @@ -5,10 +5,6 @@ * PURPOSE: Win32 server console functions * PROGRAMMER: James Tabor * <jimtabor(a)adsl-64-217-116-74.dsl.hstntx.swbell.net> - * UPDATE HISTORY: - * 199901?? ?? Created - * 19990204 EA SetConsoleTitleA - * 19990306 EA Stubs */ /* INCLUDES *******************************************************************/ @@ -194,6 +190,49 @@ /* FUNCTIONS ******************************************************************/ +VOID +InitConsoleProps(IN OUT PCONSOLE_PROPS ConsoleProps) +{ + STARTUPINFOW si; + + GetStartupInfoW(&si); + + ConsoleProps->dwStartupFlags = si.dwFlags; + if (si.dwFlags & STARTF_USEFILLATTRIBUTE) + { + ConsoleProps->FillAttribute = si.dwFillAttribute; + } + if (si.dwFlags & STARTF_USECOUNTCHARS) + { + ConsoleProps->ScreenBufferSize.X = (SHORT)(si.dwXCountChars); + ConsoleProps->ScreenBufferSize.Y = (SHORT)(si.dwYCountChars); + } + if (si.dwFlags & STARTF_USESHOWWINDOW) + { + ConsoleProps->ShowWindow = si.wShowWindow; + } + if (si.dwFlags & STARTF_USEPOSITION) + { + ConsoleProps->ConsoleWindowOrigin.x = (LONG)(si.dwX); + ConsoleProps->ConsoleWindowOrigin.y = (LONG)(si.dwY); + } + if (si.dwFlags & STARTF_USESIZE) + { + ConsoleProps->ConsoleWindowSize.cx = (LONG)(si.dwXSize); + ConsoleProps->ConsoleWindowSize.cy = (LONG)(si.dwYSize); + } + + if (si.lpTitle) + { + wcsncpy(ConsoleProps->ConsoleTitle, si.lpTitle, MAX_PATH + 1); + } + else + { + ConsoleProps->ConsoleTitle[0] = L'\0'; + } +} + + LPCWSTR IntCheckForConsoleFileName(IN LPCWSTR pszName, IN DWORD dwDesiredAccess) @@ -764,9 +803,8 @@ * of the specified device. Otherwise the value is INVALID_HANDLE_VALUE. */ { - PRTL_USER_PROCESS_PARAMETERS Ppb; - - Ppb = NtCurrentPeb()->ProcessParameters; + PRTL_USER_PROCESS_PARAMETERS Ppb = NtCurrentPeb()->ProcessParameters; + switch (nStdHandle) { case STD_INPUT_HANDLE: @@ -802,11 +840,9 @@ * RETURNS: TRUE if the function succeeds, FALSE otherwise. */ { - PRTL_USER_PROCESS_PARAMETERS Ppb; + PRTL_USER_PROCESS_PARAMETERS Ppb = NtCurrentPeb()->ProcessParameters; /* no need to check if hHandle == INVALID_HANDLE_VALUE */ - - Ppb = NtCurrentPeb()->ProcessParameters; switch (nStdHandle) { @@ -823,7 +859,7 @@ return TRUE; } - /* windows for whatever reason sets the last error to ERROR_INVALID_HANDLE here */ + /* Windows for whatever reason sets the last error to ERROR_INVALID_HANDLE here */ SetLastError(ERROR_INVALID_HANDLE); return FALSE; } @@ -839,36 +875,63 @@ AllocConsole(VOID) { NTSTATUS Status; + PRTL_USER_PROCESS_PARAMETERS Parameters = NtCurrentPeb()->ProcessParameters; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_ALLOCCONSOLE AllocConsoleRequest = &ApiMessage.Data.AllocConsoleRequest; - STARTUPINFO si; - - DPRINT1("AllocConsole called !!!!\n"); - - if (NtCurrentPeb()->ProcessParameters->ConsoleHandle) - { - DPRINT1("AllocConsole: Allocate duplicate console to the same Process\n"); + PCSR_CAPTURE_BUFFER CaptureBuffer; + SIZE_T Length = 0; + + DPRINT1("AllocConsole\n"); + + if (Parameters->ConsoleHandle) + { + DPRINT1("AllocConsole: Allocating a console to a process already having one\n"); SetLastError(ERROR_ACCESS_DENIED); return FALSE; } - GetStartupInfo(&si); - - AllocConsoleRequest->ShowCmd = si.wShowWindow; + CaptureBuffer = CsrAllocateCaptureBuffer(2, sizeof(CONSOLE_PROPS) + + (MAX_PATH + 1) * sizeof(WCHAR)); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + CsrAllocateMessagePointer(CaptureBuffer, + sizeof(CONSOLE_PROPS), + (PVOID*)&AllocConsoleRequest->ConsoleProps); + + CsrAllocateMessagePointer(CaptureBuffer, + (MAX_PATH + 1) * sizeof(WCHAR), + (PVOID*)&AllocConsoleRequest->AppPath); + +/** Copied from BasepInitConsole **********************************************/ + InitConsoleProps(AllocConsoleRequest->ConsoleProps); + + Length = min(MAX_PATH + 1, Parameters->ImagePathName.Length / sizeof(WCHAR)); + wcsncpy(AllocConsoleRequest->AppPath, Parameters->ImagePathName.Buffer, Length); + AllocConsoleRequest->AppPath[Length] = L'\0'; +/******************************************************************************/ + AllocConsoleRequest->Console = NULL; AllocConsoleRequest->CtrlDispatcher = ConsoleControlDispatcher; Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, + CaptureBuffer, CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepAlloc), sizeof(CONSOLE_ALLOCCONSOLE)); + + CsrFreeCaptureBuffer(CaptureBuffer); + if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status)) { BaseSetLastNTError(Status); return FALSE; } - NtCurrentPeb()->ProcessParameters->ConsoleHandle = AllocConsoleRequest->Console; + Parameters->ConsoleHandle = AllocConsoleRequest->Console; SetStdHandle(STD_INPUT_HANDLE , AllocConsoleRequest->InputHandle ); SetStdHandle(STD_OUTPUT_HANDLE, AllocConsoleRequest->OutputHandle); SetStdHandle(STD_ERROR_HANDLE , AllocConsoleRequest->ErrorHandle ); @@ -1685,16 +1748,20 @@ WINAPI SetConsoleTitleA(LPCSTR lpConsoleTitle) { - ULONG Length = strlen(lpConsoleTitle) + 1; + BOOL Ret; + ULONG Length = strlen(lpConsoleTitle) + 1; LPWSTR WideTitle = HeapAlloc(GetProcessHeap(), 0, Length * sizeof(WCHAR)); - BOOL Ret; + if (!WideTitle) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } + MultiByteToWideChar(CP_ACP, 0, lpConsoleTitle, -1, WideTitle, Length); + Ret = SetConsoleTitleW(WideTitle); + HeapFree(GetProcessHeap(), 0, WideTitle); return Ret; } @@ -1963,12 +2030,13 @@ AttachConsole(DWORD dwProcessId) { NTSTATUS Status; + PRTL_USER_PROCESS_PARAMETERS Parameters = NtCurrentPeb()->ProcessParameters; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_ATTACHCONSOLE AttachConsoleRequest = &ApiMessage.Data.AttachConsoleRequest; DPRINT1("AttachConsole(%lu)\n", dwProcessId); - if (NtCurrentPeb()->ProcessParameters->ConsoleHandle) + if (Parameters->ConsoleHandle) { DPRINT1("AttachConsole: Attaching a console to a process already having one\n"); SetLastError(ERROR_ACCESS_DENIED); @@ -1988,7 +2056,7 @@ return FALSE; } - NtCurrentPeb()->ProcessParameters->ConsoleHandle = AttachConsoleRequest->Console; + Parameters->ConsoleHandle = AttachConsoleRequest->Console; SetStdHandle(STD_INPUT_HANDLE , AttachConsoleRequest->InputHandle ); SetStdHandle(STD_OUTPUT_HANDLE, AttachConsoleRequest->OutputHandle); SetStdHandle(STD_ERROR_HANDLE , AttachConsoleRequest->ErrorHandle ); @@ -2070,9 +2138,9 @@ { int lenName; - if (!lpInputExeName - || (lenName = lstrlenW(lpInputExeName)) == 0 - || lenName > INPUTEXENAME_BUFLEN - 1) + if ( !lpInputExeName || + (lenName = lstrlenW(lpInputExeName)) == 0 || + lenName > INPUTEXENAME_BUFLEN - 1 ) { /* Fail if string is empty or too long */ SetLastError(ERROR_INVALID_PARAMETER); @@ -2111,12 +2179,11 @@ ANSI_STRING InputExeNameA; UNICODE_STRING InputExeNameU; NTSTATUS Status; - BOOL Ret; RtlInitAnsiString(&InputExeNameA, lpInputExeName); - if(InputExeNameA.Length == 0 || - InputExeNameA.Length > INPUTEXENAME_BUFLEN - 1) + if ( InputExeNameA.Length == 0 || + InputExeNameA.Length > INPUTEXENAME_BUFLEN - 1 ) { /* Fail if string is empty or too long */ SetLastError(ERROR_INVALID_PARAMETER); @@ -2126,18 +2193,15 @@ InputExeNameU.Buffer = Buffer; InputExeNameU.MaximumLength = sizeof(Buffer); InputExeNameU.Length = 0; + Status = RtlAnsiStringToUnicodeString(&InputExeNameU, &InputExeNameA, FALSE); - if(NT_SUCCESS(Status)) - { - Ret = SetConsoleInputExeNameW(InputExeNameU.Buffer); - } - else - { - BaseSetLastNTError(Status); - Ret = FALSE; - } - - return Ret; + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return SetConsoleInputExeNameW(InputExeNameU.Buffer); } @@ -2164,7 +2228,7 @@ return lenName + 1; } - if(lenName + 1 > nBufferLength) + if (lenName + 1 > nBufferLength) { /* Buffer is not large enough! */ SetLastError(ERROR_BUFFER_OVERFLOW); @@ -2219,7 +2283,7 @@ RtlUnicodeStringToAnsiString(&BufferA, &BufferU, FALSE); /* Error handling */ - if(nBufferLength <= BufferU.Length / sizeof(WCHAR)) + if (nBufferLength <= BufferU.Length / sizeof(WCHAR)) { SetLastError(ERROR_BUFFER_OVERFLOW); return 2; 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] Sun Feb 10 12:36:57 2013 @@ -5,8 +5,6 @@ * PURPOSE: Initialization * PROGRAMMERS: Ariadne (ariadne(a)xs4all.nl) * Aleksey Bragin (aleksey(a)reactos.org) - * UPDATE HISTORY: - * Created 01/11/98 */ /* INCLUDES ******************************************************************/ @@ -53,8 +51,6 @@ { NTSTATUS Status; PRTL_USER_PROCESS_PARAMETERS Parameters = NtCurrentPeb()->ProcessParameters; - LPCWSTR ExeName; - STARTUPINFO si; WCHAR SessionDir[256]; ULONG SessionId = NtCurrentPeb()->SessionId; BOOLEAN InServer; @@ -62,9 +58,7 @@ CONSOLE_CONNECTION_INFO ConnectInfo; ULONG ConnectInfoSize = sizeof(ConnectInfo); - WCHAR lpTest[MAX_PATH]; - GetModuleFileNameW(NULL, lpTest, MAX_PATH); - DPRINT("BasepInitConsole for : %S\n", lpTest); + DPRINT("BasepInitConsole for : %wZ\n", &Parameters->ImagePathName); DPRINT("Our current console handles are: %lx, %lx, %lx %lx\n", Parameters->ConsoleHandle, Parameters->StandardInput, Parameters->StandardOutput, Parameters->StandardError); @@ -74,20 +68,35 @@ if (!NT_SUCCESS(Status)) return FALSE; ConsoleInitialized = TRUE; - /* We have nothing to do if this isn't a console app... */ + /* Do nothing if this isn't a console app... */ if (RtlImageNtHeader(GetModuleHandle(NULL))->OptionalHeader.Subsystem != IMAGE_SUBSYSTEM_WINDOWS_CUI) { DPRINT("Image is not a console application\n"); Parameters->ConsoleHandle = NULL; ConnectInfo.ConsoleNeeded = FALSE; // ConsoleNeeded is used for knowing whether or not this is a CUI app. + + ConnectInfo.ConsoleProps.ConsoleTitle[0] = L'\0'; + ConnectInfo.AppPath[0] = L'\0'; } else { + SIZE_T Length = 0; + LPCWSTR ExeName; + + InitConsoleProps(&ConnectInfo.ConsoleProps); + + Length = min(sizeof(ConnectInfo.AppPath) / sizeof(ConnectInfo.AppPath[0]), + Parameters->ImagePathName.Length / sizeof(WCHAR)); + wcsncpy(ConnectInfo.AppPath, Parameters->ImagePathName.Buffer, Length); + ConnectInfo.AppPath[Length] = L'\0'; + + /* Initialize Input EXE name */ + ExeName = wcsrchr(Parameters->ImagePathName.Buffer, L'\\'); + if (ExeName) SetConsoleInputExeNameW(ExeName + 1); + /* Assume one is needed */ - GetStartupInfo(&si); ConnectInfo.ConsoleNeeded = TRUE; - ConnectInfo.ShowCmd = si.wShowWindow; /* Handle the special flags given to us by BasePushProcessParameters */ if (Parameters->ConsoleHandle == HANDLE_DETACHED_PROCESS) @@ -108,7 +117,7 @@ /* We'll get the real one soon */ DPRINT("Creating new invisible console\n"); Parameters->ConsoleHandle = NULL; - ConnectInfo.ShowCmd = SW_HIDE; + ConnectInfo.ConsoleProps.ShowWindow = SW_HIDE; } else { @@ -123,13 +132,9 @@ /* Now use the proper console handle */ ConnectInfo.Console = Parameters->ConsoleHandle; - /* Initialize Console Ctrl Handler and input EXE name */ + /* Initialize Console Ctrl Handler */ InitConsoleCtrlHandling(); ConnectInfo.CtrlDispatcher = ConsoleControlDispatcher; - - ExeName = wcsrchr(Parameters->ImagePathName.Buffer, L'\\'); - if (ExeName) - SetConsoleInputExeNameW(ExeName + 1); /* Setup the right Object Directory path */ if (!SessionId) Modified: branches/ros-csrss/dll/win32/kernel32/include/kernel32.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/in…
============================================================================== --- branches/ros-csrss/dll/win32/kernel32/include/kernel32.h [iso-8859-1] (original) +++ branches/ros-csrss/dll/win32/kernel32/include/kernel32.h [iso-8859-1] Sun Feb 10 12:36:57 2013 @@ -196,6 +196,9 @@ HANDLE WINAPI GetConsoleInputWaitHandle(VOID); +VOID +InitConsoleProps(IN OUT PCONSOLE_PROPS ConsoleProps); + LPCWSTR IntCheckForConsoleFileName(IN LPCWSTR pszName, IN DWORD dwDesiredAccess); Modified: branches/ros-csrss/include/reactos/subsys/win/conmsg.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
============================================================================== --- branches/ros-csrss/include/reactos/subsys/win/conmsg.h [iso-8859-1] (original) +++ branches/ros-csrss/include/reactos/subsys/win/conmsg.h [iso-8859-1] Sun Feb 10 12:36:57 2013 @@ -112,12 +112,26 @@ } CONSRV_API_NUMBER, *PCONSRV_API_NUMBER; +typedef struct _CONSOLE_PROPS +{ + DWORD dwStartupFlags; + DWORD FillAttribute; + COORD ScreenBufferSize; + WORD ShowWindow; + POINT ConsoleWindowOrigin; + SIZE ConsoleWindowSize; + // UNICODE_STRING ConsoleTitle; + WCHAR ConsoleTitle[MAX_PATH + 1]; +} CONSOLE_PROPS, *PCONSOLE_PROPS; + typedef struct _CONSOLE_CONNECTION_INFO { BOOL ConsoleNeeded; // Used for GUI apps only. - /* Copied from CONSOLE_ALLOCCONSOLE */ - INT ShowCmd; + /* Adapted from CONSOLE_ALLOCCONSOLE */ + CONSOLE_PROPS ConsoleProps; + WCHAR AppPath[MAX_PATH + 1]; + HANDLE Console; // ConsoleHandle // In fact, it is a PCSRSS_CONSOLE <-- correct that !! HANDLE InputHandle; HANDLE OutputHandle; @@ -168,7 +182,9 @@ typedef struct { - INT ShowCmd; + PCONSOLE_PROPS ConsoleProps; + LPWSTR AppPath; + HANDLE Console; // ConsoleHandle // In fact, it is a PCSRSS_CONSOLE <-- correct that !! HANDLE InputHandle; HANDLE OutputHandle; Modified: branches/ros-csrss/win32ss/user/consrv/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/C…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/CMakeLists.txt [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/CMakeLists.txt [iso-8859-1] Sun Feb 10 12:36:57 2013 @@ -21,12 +21,12 @@ add_library(consrv SHARED ${SOURCE}) -target_link_libraries(consrv win32ksys ${PSEH_LIB}) # win32ksys because of NtUser...() +target_link_libraries(consrv win32ksys ${PSEH_LIB} uuid) # win32ksys because of NtUser...() set_module_type(consrv win32dll UNICODE) add_importlibs(consrv psapi msvcrt kernel32 ntdll csrsrv) -add_delay_importlibs(consrv user32 gdi32 advapi32) +add_delay_importlibs(consrv user32 gdi32 advapi32 ole32) add_dependencies(consrv bugcodes) add_cd_file(TARGET consrv DESTINATION reactos/system32 FOR all) 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] Sun Feb 10 12:36:57 2013 @@ -15,9 +15,10 @@ #ifndef WM_APP #define WM_APP 0x8000 #endif -#define PM_CREATE_CONSOLE (WM_APP + 1) -#define PM_DESTROY_CONSOLE (WM_APP + 2) -#define PM_CONSOLE_BEEP (WM_APP + 3) +#define PM_CREATE_CONSOLE (WM_APP + 1) +#define PM_DESTROY_CONSOLE (WM_APP + 2) +#define PM_CONSOLE_BEEP (WM_APP + 3) +#define PM_CONSOLE_SET_TITLE (WM_APP + 4) /************************************************************************ @@ -113,8 +114,10 @@ BOOLEAN HistoryNoDup; /* Remove old duplicate history entries */ /****************************** GUI-related data ******************************/ - UNICODE_STRING Title; /* Title of console */ - HWND hWindow; + UNICODE_STRING Title; /* Title of console. It is always NULL-terminated */ + HWND hWindow; /* Handle to the console's window */ + HICON hIcon; /* Handle to its icon (used when freeing) */ + HICON hIconSm; COORD Size; PVOID GuiData; @@ -135,7 +138,6 @@ typedef struct _CONSOLE_VTBL { - VOID (WINAPI *InitScreenBuffer)(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER ScreenBuffer); VOID (WINAPI *WriteStream)(PCONSOLE Console, SMALL_RECT* Block, LONG CursorStartX, LONG CursorStartY, UINT ScrolledLines, CHAR *Buffer, UINT Length); VOID (WINAPI *DrawRegion)(PCONSOLE Console, SMALL_RECT* Region); @@ -143,7 +145,7 @@ BOOL (WINAPI *SetScreenInfo)(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER ScreenBuffer, UINT OldCursorX, UINT OldCursorY); BOOL (WINAPI *UpdateScreenInfo)(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER ScreenBuffer); - BOOL (WINAPI *ChangeTitle)(PCONSOLE Console); + VOID (WINAPI *ChangeTitle)(PCONSOLE Console); VOID (WINAPI *CleanupConsole)(PCONSOLE Console); BOOL (WINAPI *ChangeIcon)(PCONSOLE Console, HICON hWindowIcon); NTSTATUS (WINAPI *ResizeBuffer)(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER ScreenBuffer, COORD Size); @@ -163,7 +165,6 @@ #define PAUSED_FROM_SCROLLBAR 0x2 #define PAUSED_FROM_SELECTION 0x4 -#define ConioInitScreenBuffer(Console, Buff) (Console)->Vtbl->InitScreenBuffer((Console), (Buff)) #define ConioDrawRegion(Console, Region) (Console)->Vtbl->DrawRegion((Console), (Region)) #define ConioWriteStream(Console, Block, CurStartX, CurStartY, ScrolledLines, Buffer, Length) \ (Console)->Vtbl->WriteStream((Console), (Block), (CurStartX), (CurStartY), \ @@ -181,7 +182,10 @@ /* console.c */ VOID WINAPI ConSrvDeleteConsole(PCONSOLE Console); VOID WINAPI ConSrvInitConsoleSupport(VOID); -NTSTATUS WINAPI ConSrvInitConsole(PCONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLeaderProcess); +NTSTATUS WINAPI ConSrvInitConsole(OUT PCONSOLE* NewConsole, + IN LPCWSTR AppPath, + IN OUT PCONSOLE_PROPS ConsoleProps, + IN PCSR_PROCESS ConsoleLeaderProcess); VOID FASTCALL ConioPause(PCONSOLE Console, UINT Flags); VOID FASTCALL ConioUnpause(PCONSOLE Console, UINT Flags); VOID FASTCALL ConSrvConsoleCtrlEvent(DWORD Event, PCONSOLE_PROCESS_DATA ProcessData); 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] Sun Feb 10 12:36:57 2013 @@ -63,7 +63,7 @@ ConSrvInitConsoleScreenBuffer(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buffer) { - DPRINT("ConSrvInitConsoleScreenBuffer Size X %d Size Y %d\n", Buffer->MaxX, Buffer->MaxY); + DPRINT1("ConSrvInitConsoleScreenBuffer Size X %d Size Y %d\n", Buffer->MaxX, Buffer->MaxY); Buffer->Header.Type = CONIO_SCREEN_BUFFER_MAGIC; Buffer->Header.Console = Console; @@ -74,9 +74,10 @@ Buffer->Buffer = RtlAllocateHeap(ConSrvHeap, HEAP_ZERO_MEMORY, Buffer->MaxX * Buffer->MaxY * 2); if (NULL == Buffer->Buffer) { + DPRINT1("ConSrvInitConsoleScreenBuffer - D'oh!\n"); return STATUS_INSUFFICIENT_RESOURCES; } - ConioInitScreenBuffer(Console, Buffer); + Buffer->DefaultAttrib = DEFAULT_ATTRIB; /* initialize buffer to be empty with default attributes */ for (Buffer->CurrentY = 0 ; Buffer->CurrentY < Buffer->MaxY; Buffer->CurrentY++) { @@ -376,6 +377,7 @@ ConioDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer) { PCONSOLE Console = Buffer->Header.Console; + DPRINT1("ConioDeleteScreenBuffer(Buffer = 0x%p, Buffer->Buffer = 0x%p) ; Console = 0x%p\n", Buffer, Buffer->Buffer, Console); RemoveEntryList(&Buffer->ListEntry); if (Buffer == Console->ActiveBuffer) @@ -384,6 +386,7 @@ Console->ActiveBuffer = NULL; if (!IsListEmpty(&Console->BufferList)) { + DPRINT1("ConioDeleteScreenBuffer - Bang !!!!!!!!\n"); Console->ActiveBuffer = CONTAINING_RECORD(Console->BufferList.Flink, CONSOLE_SCREEN_BUFFER, ListEntry); ConioDrawConsole(Console); } @@ -423,7 +426,7 @@ UpdateRect->Right = Start->X + Length - 1; } UpdateRect->Top = Start->Y; - UpdateRect->Bottom = Start->Y+ (Start->X + Length - 1) / Buff->MaxX; + UpdateRect->Bottom = Start->Y + (Start->X + Length - 1) / Buff->MaxX; if (Buff->MaxY <= UpdateRect->Bottom) { UpdateRect->Bottom = Buff->MaxY - 1; 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] Sun Feb 10 12:36:57 2013 @@ -8,9 +8,15 @@ /* INCLUDES ******************************************************************/ +#define COBJMACROS +#define NONAMELESSUNION + #include "consrv.h" #include "guiconsole.h" #include "tuiconsole.h" + +#include <shlwapi.h> +#include <shlobj.h> //#define NDEBUG #include <debug.h> @@ -95,15 +101,117 @@ } } +static BOOL +LoadShellLinkInfo(IN OUT PCONSOLE_PROPS ConsoleProps, + OUT LPWSTR IconPath, + IN SIZE_T IconPathLength, + OUT PINT piIcon) +{ +#define PATH_SEPARATOR L'\\' + + LPWSTR LinkName = NULL; + SIZE_T Length = 0; + + if ((ConsoleProps->dwStartupFlags & STARTF_TITLEISLINKNAME) == 0) + return FALSE; + + if (IconPath == NULL || piIcon == NULL) + return FALSE; + + IconPath[0] = L'\0'; + *piIcon = 0; + + /* 1- Find the last path separator if any */ + LinkName = wcsrchr(ConsoleProps->ConsoleTitle, PATH_SEPARATOR); + if (LinkName == NULL) + { + LinkName = ConsoleProps->ConsoleTitle; + } + else + { + /* Skip the path separator */ + ++LinkName; + } + + /* 2- Check for the link extension. The name ".lnk" is considered invalid. */ + Length = wcslen(LinkName); + if ( (Length <= 4) || (wcsicmp(LinkName + (Length - 4), L".lnk") != 0) ) + return FALSE; + + /* 3- It may be a link. Try to retrieve some properties */ + HRESULT hRes = CoInitialize(NULL); + if (SUCCEEDED(hRes)) + { + // Get a pointer to the IShellLink interface. + IShellLinkW* pshl = NULL; + hRes = CoCreateInstance(&CLSID_ShellLink, + NULL, + CLSCTX_INPROC_SERVER, + &IID_IShellLinkW, + (LPVOID*)&pshl); + if (SUCCEEDED(hRes)) + { + // Get a pointer to the IPersistFile interface. + IPersistFile* ppf = NULL; + hRes = IPersistFile_QueryInterface(pshl, &IID_IPersistFile, (LPVOID*)&ppf); + if (SUCCEEDED(hRes)) + { + // Load the shortcut. + hRes = IPersistFile_Load(ppf, ConsoleProps->ConsoleTitle, STGM_READ); + if (SUCCEEDED(hRes)) + { + /* + * Finally we can get the properties ! + * Update the old ones if needed. + */ + INT ShowCmd = 0; + // WORD HotKey = 0; + + // Get the name of the shortcut. + Length = min(Length - 4, + sizeof(ConsoleProps->ConsoleTitle) / sizeof(ConsoleProps->ConsoleTitle[0])); + wcsncpy(ConsoleProps->ConsoleTitle, LinkName, Length); + ConsoleProps->ConsoleTitle[Length] = L'\0'; + + // Get the window showing command. + hRes = IShellLinkW_GetShowCmd(pshl, &ShowCmd); + if (SUCCEEDED(hRes)) ConsoleProps->ShowWindow = (WORD)ShowCmd; + + // Get the hotkey. + // hRes = pshl->GetHotkey(&ShowCmd); + // if (SUCCEEDED(hRes)) ConsoleProps->HotKey = HotKey; + + // Get the icon location, if any. + hRes = IShellLinkW_GetIconLocation(pshl, IconPath, IconPathLength, piIcon); + if (!SUCCEEDED(hRes)) + { + IconPath[0] = L'\0'; + } + } + IPersistFile_Release(ppf); + } + IShellLinkW_Release(pshl); + } + } + CoUninitialize(); + + return TRUE; +} + NTSTATUS WINAPI -ConSrvInitConsole(PCONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLeaderProcess) +ConSrvInitConsole(OUT PCONSOLE* NewConsole, + IN LPCWSTR AppPath, + IN OUT PCONSOLE_PROPS ConsoleProps, + IN PCSR_PROCESS ConsoleLeaderProcess) { NTSTATUS Status; SECURITY_ATTRIBUTES SecurityAttributes; PCONSOLE Console; PCONSOLE_SCREEN_BUFFER NewBuffer; BOOL GuiMode; - WCHAR Title[255]; + WCHAR Title[128]; + WCHAR IconPath[MAX_PATH + 1] = L""; + INT iIcon = 0; if (NewConsole == NULL) return STATUS_INVALID_PARAMETER; @@ -117,19 +225,21 @@ return STATUS_NO_MEMORY; } + /* + * Check whether the process creating the console + * was launched via a shell-link. + */ + if (ConsoleProps->dwStartupFlags & STARTF_TITLEISLINKNAME) + { + LoadShellLinkInfo(ConsoleProps, + IconPath, + MAX_PATH, + &iIcon); + + ConsoleProps->dwStartupFlags &= ~STARTF_TITLEISLINKNAME; + } + /* Initialize the console */ - Console->Title.MaximumLength = Console->Title.Length = 0; - Console->Title.Buffer = NULL; - - if (LoadStringW(ConSrvDllInstance, IDS_CONSOLE_TITLE, Title, sizeof(Title) / sizeof(Title[0]))) - { - RtlCreateUnicodeString(&Console->Title, Title); - } - else - { - RtlCreateUnicodeString(&Console->Title, L"ReactOS Console"); - } - InitializeCriticalSection(&Console->Lock); Console->ReferenceCount = 0; Console->LineBuffer = NULL; @@ -150,6 +260,7 @@ Console->CodePage = GetOEMCP(); Console->OutputCodePage = GetOEMCP(); Console->GuiData = NULL; + Console->hIcon = Console->hIconSm = NULL; SecurityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES); SecurityAttributes.lpSecurityDescriptor = NULL; @@ -158,35 +269,65 @@ Console->InputBuffer.ActiveEvent = CreateEventW(&SecurityAttributes, TRUE, FALSE, NULL); if (NULL == Console->InputBuffer.ActiveEvent) { - RtlFreeUnicodeString(&Console->Title); DeleteCriticalSection(&Console->Lock); RtlFreeHeap(ConSrvHeap, 0, Console); return STATUS_UNSUCCESSFUL; } - GuiMode = DtbgIsDesktopVisible(); - - /* allocate console screen buffer */ + /* Allocate console screen buffer */ NewBuffer = RtlAllocateHeap(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(CONSOLE_SCREEN_BUFFER)); if (NULL == NewBuffer) { - RtlFreeUnicodeString(&Console->Title); DeleteCriticalSection(&Console->Lock); CloseHandle(Console->InputBuffer.ActiveEvent); RtlFreeHeap(ConSrvHeap, 0, Console); return STATUS_INSUFFICIENT_RESOURCES; } - /* init screen buffer with defaults */ + /* Init screen buffer with defaults */ NewBuffer->CursorInfo.bVisible = TRUE; NewBuffer->CursorInfo.dwSize = CSR_DEFAULT_CURSOR_SIZE; - /* make console active, and insert into console list */ - Console->ActiveBuffer = (PCONSOLE_SCREEN_BUFFER)NewBuffer; + /* Make console active, and insert into console list */ + Console->ActiveBuffer = NewBuffer; + /** Finish to initialize the screen buffer ** + ** Fix problems with MaxX == 0 and MaxY == 0 + ** + Status = ConSrvInitConsoleScreenBuffer(Console, NewBuffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ConSrvInitConsoleScreenBuffer: failed\n"); + RtlFreeHeap(ConSrvHeap, 0, NewBuffer); + DeleteCriticalSection(&Console->Lock); + CloseHandle(Console->InputBuffer.ActiveEvent); + RtlFreeHeap(ConSrvHeap, 0, Console); + return Status; + } + **/ + + /* Initialize the console title */ + Console->Title.MaximumLength = Console->Title.Length = 0; + Console->Title.Buffer = NULL; + if (ConsoleProps->ConsoleTitle[0] == L'\0') + { + if (LoadStringW(ConSrvDllInstance, IDS_CONSOLE_TITLE, Title, sizeof(Title) / sizeof(Title[0]))) + { + RtlCreateUnicodeString(&Console->Title, Title); + } + else + { + RtlCreateUnicodeString(&Console->Title, L"ReactOS Console"); + } + } + else + { + RtlCreateUnicodeString(&Console->Title, ConsoleProps->ConsoleTitle); + } /* - * If we are not in GUI-mode, start the text-mode console. If we fail, - * try to start the GUI-mode console (win32k will automatically switch - * to graphical mode, therefore no additional code is needed). + * If we are not in GUI-mode, start the text-mode console. + * If we fail, try to start the GUI-mode console. */ + GuiMode = DtbgIsDesktopVisible(); + if (!GuiMode) { DPRINT1("CONSRV: Opening text-mode console\n"); @@ -204,33 +345,41 @@ * failed and we start GUI-mode console. * - We are in text-mode, therefore GuiMode == FALSE, the previous test-case * succeeded BUT we failed at starting text-mode console. Then GuiMode - * was switched to TRUE in order to try to open the console in GUI-mode. + * was switched to TRUE in order to try to open the console in GUI-mode + * (win32k will automatically switch to graphical mode, therefore + * no additional code is needed). */ if (GuiMode) { DPRINT1("CONSRV: Opening GUI-mode console\n"); - Status = GuiInitConsole(Console, ShowCmd); + Status = GuiInitConsole(Console, + AppPath, + ConsoleProps->ShowWindow, + IconPath, + iIcon); if (!NT_SUCCESS(Status)) { - RtlFreeHeap(ConSrvHeap,0, NewBuffer); + DPRINT1("GuiInitConsole: failed, Status = 0x%08lx\n", Status); RtlFreeUnicodeString(&Console->Title); DeleteCriticalSection(&Console->Lock); CloseHandle(Console->InputBuffer.ActiveEvent); - DPRINT1("GuiInitConsole: failed, Status = 0x%08lx\n", Status); + RtlFreeHeap(ConSrvHeap, 0, NewBuffer); + /// ConioDeleteScreenBuffer(NewBuffer); RtlFreeHeap(ConSrvHeap, 0, Console); return Status; } } + // TODO: Move this call before initializing Tui/Gui console. But before fix freeing Buffer->Buffer !! Status = ConSrvInitConsoleScreenBuffer(Console, NewBuffer); if (!NT_SUCCESS(Status)) { + DPRINT1("ConSrvInitConsoleScreenBuffer: failed\n"); ConioCleanupConsole(Console); RtlFreeUnicodeString(&Console->Title); DeleteCriticalSection(&Console->Lock); CloseHandle(Console->InputBuffer.ActiveEvent); RtlFreeHeap(ConSrvHeap, 0, NewBuffer); - DPRINT1("ConSrvInitConsoleScreenBuffer: failed\n"); RtlFreeHeap(ConSrvHeap, 0, Console); return Status; } @@ -282,6 +431,7 @@ CloseHandle(Console->InputBuffer.ActiveEvent); if (Console->UnpauseEvent) CloseHandle(Console->UnpauseEvent); DeleteCriticalSection(&Console->Lock); + RtlFreeUnicodeString(&Console->Title); IntDeleteAllAliases(Console->Aliases); RtlFreeHeap(ConSrvHeap, 0, Console); @@ -353,8 +503,8 @@ { NTSTATUS Status = STATUS_SUCCESS; PCONSOLE_ALLOCCONSOLE AllocConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.AllocConsoleRequest; - PCSR_PROCESS ConsoleLeader = CsrGetClientThread()->Process; - PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(ConsoleLeader); + PCSR_PROCESS CsrProcess = CsrGetClientThread()->Process; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrProcess); DPRINT("SrvAllocConsole\n"); @@ -362,6 +512,18 @@ { DPRINT1("Process already has a console\n"); return STATUS_ACCESS_DENIED; + } + + if ( !CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&AllocConsoleRequest->ConsoleProps, + 1, + sizeof(CONSOLE_PROPS)) || + !CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&AllocConsoleRequest->AppPath, + MAX_PATH + 1, + sizeof(WCHAR)) ) + { + return STATUS_INVALID_PARAMETER; } /* @@ -379,11 +541,11 @@ /* Initialize a new Console owned by the Console Leader Process */ Status = ConSrvAllocateConsole(ProcessData, + AllocConsoleRequest->AppPath, &AllocConsoleRequest->InputHandle, &AllocConsoleRequest->OutputHandle, &AllocConsoleRequest->ErrorHandle, - AllocConsoleRequest->ShowCmd, - ConsoleLeader); + AllocConsoleRequest->ConsoleProps); if (!NT_SUCCESS(Status)) { DPRINT1("Console allocation failed\n"); @@ -602,34 +764,37 @@ } Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); - if(NT_SUCCESS(Status)) - { - Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, TitleRequest->Length); - if (Buffer) - { - /* Copy title to console */ - RtlFreeUnicodeString(&Console->Title); - Console->Title.Buffer = Buffer; - Console->Title.Length = Console->Title.MaximumLength = TitleRequest->Length; - memcpy(Console->Title.Buffer, TitleRequest->Title, Console->Title.Length); - - if (!ConioChangeTitle(Console)) - { - Status = STATUS_UNSUCCESSFUL; - } - else - { - Status = STATUS_SUCCESS; - } - } - else - { - Status = STATUS_NO_MEMORY; - } - - ConSrvReleaseConsole(Console, TRUE); - } - + if (!NT_SUCCESS(Status)) + { + DPRINT1("Can't get console\n"); + return Status; + } + + /* Allocate a new buffer to hold the new title (NULL-terminated) */ + Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, TitleRequest->Length + sizeof(WCHAR)); + if (Buffer) + { + /* Free the old title */ + RtlFreeUnicodeString(&Console->Title); + + /* Copy title to console */ + Console->Title.Buffer = Buffer; + Console->Title.Length = TitleRequest->Length; + Console->Title.MaximumLength = Console->Title.Length + sizeof(WCHAR); + RtlCopyMemory(Console->Title.Buffer, + TitleRequest->Title, + Console->Title.Length); + Console->Title.Buffer[Console->Title.Length / sizeof(WCHAR)] = L'\0'; + + ConioChangeTitle(Console); + Status = STATUS_SUCCESS; + } + else + { + Status = STATUS_NO_MEMORY; + } + + ConSrvReleaseConsole(Console, TRUE); return Status; } 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] Sun Feb 10 12:36:57 2013 @@ -178,11 +178,11 @@ VOID FASTCALL ConSrvReleaseObject(Object_t *Object, BOOL IsConsoleLocked); NTSTATUS FASTCALL ConSrvAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData, + LPCWSTR AppPath, PHANDLE pInputHandle, PHANDLE pOutputHandle, PHANDLE pErrorHandle, - int ShowCmd, - PCSR_PROCESS CsrProcess); + PCONSOLE_PROPS ConsoleProps); NTSTATUS FASTCALL ConSrvInheritConsole(PCONSOLE_PROCESS_DATA ProcessData, struct _CONSOLE* Console, BOOL CreateNewHandlesTable, 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] Sun Feb 10 12:36:57 2013 @@ -39,34 +39,39 @@ typedef struct _GUI_CONSOLE_DATA { - HFONT Font; - unsigned CharWidth; - unsigned CharHeight; - BOOL CursorBlinkOn; - BOOL ForceCursorOff; +/* GUI-specific */ HFONT Font; +/* GUI-specific */ WCHAR FontName[LF_FACESIZE]; +/* GUI-specific */ DWORD FontSize; +/* GUI-specific */ DWORD FontWeight; +/* GUI-specific */ UINT CharWidth; +/* GUI-specific */ UINT CharHeight; +/* non-specific */ BOOL CursorBlinkOn; +/* non-specific */ BOOL ForceCursorOff; + CRITICAL_SECTION Lock; HMODULE ConsoleLibrary; HANDLE hGuiInitEvent; - WCHAR FontName[LF_FACESIZE]; - DWORD FontSize; - DWORD FontWeight; - DWORD FullScreen; - DWORD QuickEdit; - DWORD InsertMode; - DWORD WindowPosition; - DWORD UseRasterFonts; - COLORREF ScreenText; - COLORREF ScreenBackground; - COLORREF PopupBackground; - COLORREF PopupText; - COLORREF Colors[16]; + +/* GUI-specific */ DWORD FullScreen; +/* non-specific */ DWORD QuickEdit; +/* non-specific */ DWORD InsertMode; +/* GUI-specific */ DWORD WindowPosition; +/* GUI-specific */ DWORD UseRasterFonts; +/* non-specific */ COLORREF ScreenText; +/* non-specific */ COLORREF ScreenBackground; +/* non-specific */ COLORREF PopupBackground; +/* non-specific */ COLORREF PopupText; +/* non-specific */ COLORREF Colors[16]; WCHAR szProcessName[MAX_PATH]; BOOL WindowSizeLock; POINT OldCursor; } GUI_CONSOLE_DATA, *PGUI_CONSOLE_DATA; -static BOOL ConsInitialized = FALSE; -static HWND NotifyWnd; +static BOOL ConsInitialized = FALSE; +static HICON ghDefaultIcon = NULL; +static HICON ghDefaultIconSm = NULL; +static HCURSOR ghDefaultCursor = NULL; +static HWND NotifyWnd = NULL; typedef struct _GUICONSOLE_MENUITEM { @@ -195,6 +200,12 @@ return (PCONSOLE)GetWindowLongPtrW(hWnd, GWLP_USERDATA); } + + +/******************************************************************************* + ** The following functions may be available for both GUI and CUI + ******************************************************************************/ + static BOOL GuiConsoleOpenUserRegistryPathPerProcessId(DWORD ProcessId, PHANDLE hProcHandle, PHKEY hResult, REGSAM samDesired) { @@ -615,34 +626,39 @@ * init guidata with default properties */ - wcscpy(GuiData->FontName, L"DejaVu Sans Mono"); - GuiData->FontSize = 0x0008000C; // font is 8x12 - GuiData->FontWeight = FW_NORMAL; - GuiData->FullScreen = FALSE; - GuiData->QuickEdit = FALSE; - GuiData->InsertMode = TRUE; - GuiData->ScreenText = RGB(192, 192, 192); - GuiData->ScreenBackground = RGB(0, 0, 0); - GuiData->PopupText = RGB(128, 0, 128); - GuiData->PopupBackground = RGB(255, 255, 255); +/* GUI-specific */ wcscpy(GuiData->FontName, L"DejaVu Sans Mono"); +/* GUI-specific */ GuiData->FontSize = 0x0008000C; // font is 8x12 +/* GUI-specific */ GuiData->FontWeight = FW_NORMAL; +/* GUI-specific */ GuiData->FullScreen = FALSE; +/* non-specific */ GuiData->QuickEdit = FALSE; +/* non-specific */ GuiData->InsertMode = TRUE; +/* non-specific */ GuiData->ScreenText = RGB(192, 192, 192); +/* non-specific */ GuiData->ScreenBackground = RGB(0, 0, 0); +/* non-specific */ GuiData->PopupText = RGB(128, 0, 128); +/* non-specific */ GuiData->PopupBackground = RGB(255, 255, 255); GuiData->WindowPosition = UINT_MAX; - GuiData->UseRasterFonts = TRUE; - memcpy(GuiData->Colors, s_Colors, sizeof(s_Colors)); - - Console->HistoryBufferSize = 50; - Console->NumberOfHistoryBuffers = 5; - Console->HistoryNoDup = FALSE; - Console->Size.X = 80; - Console->Size.Y = 25; +/* GUI-specific */ GuiData->UseRasterFonts = TRUE; +/* non-specific */ memcpy(GuiData->Colors, s_Colors, sizeof(s_Colors)); + +/* non-specific */ Console->HistoryBufferSize = 50; +/* non-specific */ Console->NumberOfHistoryBuffers = 5; +/* non-specific */ Console->HistoryNoDup = FALSE; +/* XUI-specific */ Console->Size.X = 80; +/* XUI-specific */ Console->Size.Y = 25; if (Buffer) { - Buffer->MaxX = 80; - Buffer->MaxY = 300; - Buffer->CursorInfo.bVisible = TRUE; - Buffer->CursorInfo.dwSize = CSR_DEFAULT_CURSOR_SIZE; - } -} +/* XUI-specific */ Buffer->MaxX = 80; +/* XUI-specific */ Buffer->MaxY = 300; +/* XUI-specific */ Buffer->CursorInfo.bVisible = TRUE; +/* XUI-specific */ Buffer->CursorInfo.dwSize = CSR_DEFAULT_CURSOR_SIZE; + } +} + +/******************************************************************************* + ******************************************************************************/ + + VOID FASTCALL @@ -2061,6 +2077,10 @@ Beep(800, 200); break; + case PM_CONSOLE_SET_TITLE: + SetWindowText(hWnd, Console->Title.Buffer); + break; + default: Result = DefWindowProcW(hWnd, msg, wParam, lParam); break; @@ -2078,8 +2098,7 @@ HWND NewWindow; LONG WindowCount; MSG Msg; - PWCHAR Buffer, Title; - PCONSOLE Console = (PCONSOLE) lParam; + PCONSOLE Console = (PCONSOLE)lParam; switch (msg) { @@ -2087,21 +2106,9 @@ SetWindowLongW(hWnd, GWL_USERDATA, 0); return 0; case PM_CREATE_CONSOLE: - Buffer = RtlAllocateHeap(ConSrvHeap, 0, - Console->Title.Length + sizeof(WCHAR)); - if (NULL != Buffer) - { - memcpy(Buffer, Console->Title.Buffer, Console->Title.Length); - Buffer[Console->Title.Length / sizeof(WCHAR)] = L'\0'; - Title = Buffer; - } - else - { - Title = L""; - } NewWindow = CreateWindowExW(WS_EX_CLIENTEDGE, GUI_CONSOLE_WINDOW_CLASS, - Title, + Console->Title.Buffer, WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT, CW_USEDEFAULT, @@ -2109,16 +2116,29 @@ CW_USEDEFAULT, NULL, NULL, - (HINSTANCE)GetModuleHandleW(NULL), + ConSrvDllInstance, (PVOID)Console); - if (NULL != Buffer) - { - RtlFreeHeap(ConSrvHeap, 0, Buffer); - } if (NULL != NewWindow) { + DPRINT1("CreateWindowExW succeeded\n"); SetConsoleWndConsoleLeaderCID(Console); SetWindowLongW(hWnd, GWL_USERDATA, GetWindowLongW(hWnd, GWL_USERDATA) + 1); + + DPRINT1("Set icons via PM_CREATE_CONSOLE\n"); + if (Console->hIcon == NULL) + { + DPRINT1("Not really...\n"); + Console->hIcon = ghDefaultIcon; + Console->hIconSm = ghDefaultIconSm; + } + else if (Console->hIcon != ghDefaultIcon) + { + DPRINT1("Yes !\n"); + SendMessageW(Console->hWindow, WM_SETICON, ICON_BIG, (LPARAM)Console->hIcon); + SendMessageW(Console->hWindow, WM_SETICON, ICON_SMALL, (LPARAM)Console->hIconSm); + } + + DPRINT1("Show window\n"); ShowWindow(NewWindow, (int)wParam); } return (LRESULT)NewWindow; @@ -2164,7 +2184,7 @@ CW_USEDEFAULT, NULL, NULL, - (HINSTANCE) GetModuleHandleW(NULL), + ConSrvDllInstance, NULL); if (NULL == NotifyWnd) { @@ -2195,38 +2215,45 @@ PrivateCsrssManualGuiCheck(+1); } + /* Initialize the notification window class */ wc.cbSize = sizeof(WNDCLASSEXW); wc.lpszClassName = L"ConSrvCreateNotify"; wc.lpfnWndProc = GuiConsoleNotifyWndProc; wc.style = 0; - wc.hInstance = (HINSTANCE)GetModuleHandleW(NULL); + wc.hInstance = ConSrvDllInstance; wc.hIcon = NULL; + wc.hIconSm = NULL; wc.hCursor = NULL; wc.hbrBackground = NULL; wc.lpszMenuName = NULL; wc.cbClsExtra = 0; wc.cbWndExtra = 0; - wc.hIconSm = NULL; if (RegisterClassExW(&wc) == 0) { DPRINT1("Failed to register GUI notify wndproc\n"); return FALSE; } + /* Initialize the console window class */ + ghDefaultIcon = LoadImageW(ConSrvDllInstance, MAKEINTRESOURCEW(IDI_CONSOLE), IMAGE_ICON, + GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), + LR_SHARED); + ghDefaultIconSm = LoadImageW(ConSrvDllInstance, MAKEINTRESOURCEW(IDI_CONSOLE), IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), + LR_SHARED); + ghDefaultCursor = LoadCursorW(NULL, IDC_ARROW); wc.cbSize = sizeof(WNDCLASSEXW); wc.lpszClassName = GUI_CONSOLE_WINDOW_CLASS; wc.lpfnWndProc = GuiConsoleWndProc; wc.style = 0; - wc.hInstance = (HINSTANCE)GetModuleHandleW(NULL); - wc.hIcon = LoadIconW(ConSrvDllInstance, MAKEINTRESOURCEW(1)); - wc.hCursor = LoadCursorW(NULL, (LPCWSTR) IDC_ARROW); + wc.hInstance = ConSrvDllInstance; + wc.hIcon = ghDefaultIcon; + wc.hIconSm = ghDefaultIconSm; + wc.hCursor = ghDefaultCursor; wc.hbrBackground = CreateSolidBrush(RGB(0,0,0)); wc.lpszMenuName = NULL; wc.cbClsExtra = 0; wc.cbWndExtra = GWLP_CONSOLEWND_ALLOC; - wc.hIconSm = LoadImageW(ConSrvDllInstance, MAKEINTRESOURCEW(1), IMAGE_ICON, - GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), - LR_SHARED); ConsoleClassAtom = RegisterClassExW(&wc); if (ConsoleClassAtom == 0) @@ -2243,44 +2270,50 @@ } static VOID WINAPI -GuiInitScreenBuffer(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buffer) -{ - Buffer->DefaultAttrib = DEFAULT_ATTRIB; -} - -static BOOL WINAPI GuiChangeTitle(PCONSOLE Console) { - PWCHAR Buffer, Title; - - Buffer = RtlAllocateHeap(ConSrvHeap, 0, - Console->Title.Length + sizeof(WCHAR)); - if (NULL != Buffer) - { - memcpy(Buffer, Console->Title.Buffer, Console->Title.Length); - Buffer[Console->Title.Length / sizeof(WCHAR)] = L'\0'; - Title = Buffer; - } - else - { - Title = L""; - } - - PostMessageW(Console->hWindow, WM_SETTEXT, 0, (LPARAM)Title); - - if (NULL != Buffer) - { - RtlFreeHeap(ConSrvHeap, 0, Buffer); - } - - return TRUE; + PostMessageW(Console->hWindow, PM_CONSOLE_SET_TITLE, 0, 0); } static BOOL WINAPI GuiChangeIcon(PCONSOLE Console, HICON hWindowIcon) { - PostMessageW(Console->hWindow, WM_SETICON, ICON_BIG, (LPARAM)hWindowIcon); - PostMessageW(Console->hWindow, WM_SETICON, ICON_SMALL, (LPARAM)hWindowIcon); + HICON hIcon, hIconSm; + + if (hWindowIcon == NULL) + { + hIcon = ghDefaultIcon; + hIconSm = ghDefaultIconSm; + } + else + { + hIcon = CopyIcon(hWindowIcon); + hIconSm = CopyIcon(hWindowIcon); + } + + if (hIcon == NULL) + { + return FALSE; + } + + if (hIcon != Console->hIcon) + { + if (Console->hIcon != NULL && Console->hIcon != ghDefaultIcon) + { + DestroyIcon(Console->hIcon); + } + if (Console->hIconSm != NULL && Console->hIconSm != ghDefaultIconSm) + { + DestroyIcon(Console->hIconSm); + } + + Console->hIcon = hIcon; + Console->hIconSm = hIconSm; + + DPRINT1("Set icons in GuiChangeIcon\n"); + PostMessageW(Console->hWindow, WM_SETICON, ICON_BIG, (LPARAM)Console->hIcon); + PostMessageW(Console->hWindow, WM_SETICON, ICON_SMALL, (LPARAM)Console->hIconSm); + } return TRUE; } @@ -2289,11 +2322,23 @@ GuiCleanupConsole(PCONSOLE Console) { SendMessageW(NotifyWnd, PM_DESTROY_CONSOLE, 0, (LPARAM)Console); + + DPRINT1("Destroying icons !! - Console->hIcon = 0x%p ; ghDefaultIcon = 0x%p ; Console->hIconSm = 0x%p ; ghDefaultIconSm = 0x%p\n", + Console->hIcon, ghDefaultIcon, Console->hIconSm, ghDefaultIconSm); + if (Console->hIcon != NULL && Console->hIcon != ghDefaultIcon) + { + DPRINT1("Destroy hIcon\n"); + DestroyIcon(Console->hIcon); + } + if (Console->hIconSm != NULL && Console->hIconSm != ghDefaultIconSm) + { + DPRINT1("Destroy hIconSm\n"); + DestroyIcon(Console->hIconSm); + } } static CONSOLE_VTBL GuiVtbl = { - GuiInitScreenBuffer, GuiWriteStream, GuiDrawRegion, GuiSetCursorInfo, @@ -2306,12 +2351,17 @@ }; NTSTATUS FASTCALL -GuiInitConsole(PCONSOLE Console, int ShowCmd) +GuiInitConsole(PCONSOLE Console, + LPCWSTR AppPath, + WORD ShowWindow, + LPCWSTR IconPath, + INT IconIndex) { HANDLE GraphicsStartupEvent; HANDLE ThreadHandle; PGUI_CONSOLE_DATA GuiData; + /* Initialize the GUI */ if (!ConsInitialized) { ConsInitialized = TRUE; @@ -2322,8 +2372,10 @@ } } + /* Finish to initialize the console */ Console->Vtbl = &GuiVtbl; Console->hWindow = NULL; + if (NULL == NotifyWnd) { GraphicsStartupEvent = CreateEventW(NULL, FALSE, FALSE, NULL); @@ -2356,6 +2408,7 @@ return STATUS_UNSUCCESSFUL; } } + GuiData = RtlAllocateHeap(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(GUI_CONSOLE_DATA)); if (!GuiData) @@ -2363,22 +2416,51 @@ DPRINT1("CONSRV: Failed to create GUI_CONSOLE_DATA\n"); return STATUS_UNSUCCESSFUL; } - Console->GuiData = (PVOID)GuiData; + + /* Initialize the icon handles to their default values */ + Console->hIcon = ghDefaultIcon; + Console->hIconSm = ghDefaultIconSm; + + /* Get the associated icon, if any */ + if (IconPath == NULL || *IconPath == L'\0') + { + IconPath = AppPath; + IconIndex = 0; + } + DPRINT1("IconPath = %S ; IconIndex = %lu\n", (IconPath ? IconPath : L"n/a"), IconIndex); + if (IconPath) + { + HICON hIcon = NULL, hIconSm = NULL; + DPRINT1("Extracting icons\n"); + PrivateExtractIconExW(IconPath, + IconIndex, + &hIcon, + &hIconSm, + 1); + DPRINT1("hIcon = 0x%p ; hIconSm = 0x%p\n", hIcon, hIconSm); + if (hIcon != NULL) + { + DPRINT1("Effectively set the icons\n"); + Console->hIcon = hIcon; + Console->hIconSm = hIconSm; + } + } + /* - * we need to wait until the GUI has been fully initialized - * to retrieve custom settings i.e. WindowSize etc.. + * 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. - * */ GuiData->hGuiInitEvent = CreateEventW(NULL, FALSE, FALSE, NULL); - /* create console */ - PostMessageW(NotifyWnd, PM_CREATE_CONSOLE, ShowCmd, (LPARAM)Console); - - /* wait until initialization has finished */ + + /* Create the GUI console */ + PostMessageW(NotifyWnd, PM_CREATE_CONSOLE, ShowWindow, (LPARAM)Console); + + /* Wait until initialization has finished */ WaitForSingleObject(GuiData->hGuiInitEvent, INFINITE); - DPRINT("received event Console %p GuiData %p X %d Y %d\n", Console, Console->GuiData, Console->Size.X, Console->Size.Y); + DPRINT("Received event Console %p GuiData %p X %d Y %d\n", Console, Console->GuiData, Console->Size.X, Console->Size.Y); CloseHandle(GuiData->hGuiInitEvent); GuiData->hGuiInitEvent = NULL; Modified: branches/ros-csrss/win32ss/user/consrv/guiconsole.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/g…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/guiconsole.h [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/guiconsole.h [iso-8859-1] Sun Feb 10 12:36:57 2013 @@ -13,7 +13,11 @@ #define CONGUI_UPDATE_TIME 0 #define CONGUI_UPDATE_TIMER 1 -NTSTATUS FASTCALL GuiInitConsole(PCONSOLE Console, BOOL Visible); +NTSTATUS FASTCALL GuiInitConsole(PCONSOLE Console, + LPCWSTR AppPath, + WORD ShowWindow, + LPCWSTR IconPath, + INT IconIndex); VOID FASTCALL GuiConsoleHandleScrollbarMenu(VOID); /*EOF*/ 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] Sun Feb 10 12:36:57 2013 @@ -73,7 +73,6 @@ WaitAll, NULL, (PVOID)Entry); - if (!IsListEmpty(&InputBuffer->ReadWaitQueue)) { CsrDereferenceWait(&InputBuffer->ReadWaitQueue); @@ -402,16 +401,16 @@ NTSTATUS FASTCALL ConSrvAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData, + LPCWSTR AppPath, PHANDLE pInputHandle, PHANDLE pOutputHandle, PHANDLE pErrorHandle, - int ShowCmd, - PCSR_PROCESS CsrProcess) + PCONSOLE_PROPS ConsoleProps) { NTSTATUS Status = STATUS_SUCCESS; - /* Initialize a new Console owned by the Console Leader Process */ - Status = ConSrvInitConsole(&ProcessData->Console, ShowCmd, CsrProcess); + /* Initialize a new Console owned by this process */ + Status = ConSrvInitConsole(&ProcessData->Console, AppPath, ConsoleProps, ProcessData->Process); if (!NT_SUCCESS(Status)) { DPRINT1("Console initialization failed\n"); @@ -601,7 +600,6 @@ DPRINT1("ConSrvNewProcess - OK\n"); TargetProcessData = ConsoleGetPerProcessData(TargetProcess); - DPRINT1("TargetProcessData = 0x%p\n", TargetProcessData); /**** HACK !!!! ****/ RtlZeroMemory(TargetProcessData, sizeof(*TargetProcessData)); @@ -623,7 +621,6 @@ return STATUS_SUCCESS; SourceProcessData = ConsoleGetPerProcessData(SourceProcess); - DPRINT1("SourceProcessData = 0x%p\n", SourceProcessData); /* * If both of the processes (parent and new child) are console applications, @@ -699,11 +696,11 @@ /* Initialize a new Console owned by the Console Leader Process */ Status = ConSrvAllocateConsole(ProcessData, + ConnectInfo->AppPath, &ConnectInfo->InputHandle, &ConnectInfo->OutputHandle, &ConnectInfo->ErrorHandle, - ConnectInfo->ShowCmd, - CsrProcess); + &ConnectInfo->ConsoleProps); if (!NT_SUCCESS(Status)) { DPRINT1("Console allocation failed\n"); 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] Sun Feb 10 12:36:57 2013 @@ -465,6 +465,8 @@ LoadedServerDll->NewProcessCallback = ConSrvNewProcess; // LoadedServerDll->HardErrorCallback = ConSrvHardError; + ConSrvDllInstance = LoadedServerDll->ServerHandle; + /* All done */ return STATUS_SUCCESS; } @@ -477,12 +479,6 @@ { UNREFERENCED_PARAMETER(dwReason); UNREFERENCED_PARAMETER(lpReserved); - - if (DLL_PROCESS_ATTACH == dwReason) - { - ConSrvDllInstance = hInstanceDll; - } - return TRUE; } 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] Sun Feb 10 12:36:57 2013 @@ -198,7 +198,7 @@ wc.lpszClassName = TUI_CONSOLE_WINDOW_CLASS; wc.lpfnWndProc = TuiConsoleWndProc; wc.cbWndExtra = GWLP_CONSOLEWND_ALLOC; - wc.hInstance = (HINSTANCE)GetModuleHandleW(NULL); + wc.hInstance = ConSrvDllInstance; ConsoleClassAtom = RegisterClassExW(&wc); if (ConsoleClassAtom == 0) @@ -212,12 +212,6 @@ } return TRUE; -} - -static VOID WINAPI -TuiInitScreenBuffer(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buffer) -{ - Buffer->DefaultAttrib = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED; } static void FASTCALL @@ -358,10 +352,9 @@ return TRUE; } -static BOOL WINAPI +static VOID WINAPI TuiChangeTitle(PCONSOLE Console) { - return TRUE; } static VOID WINAPI @@ -415,7 +408,7 @@ 0, -32000, -32000, 0, 0, NULL, NULL, - (HINSTANCE)GetModuleHandleW(NULL), + ConSrvDllInstance, (PVOID)Console); if (NULL == NewWindow) { @@ -446,7 +439,6 @@ static CONSOLE_VTBL TuiVtbl = { - TuiInitScreenBuffer, TuiWriteStream, TuiDrawRegion, TuiSetCursorInfo,
11 years, 10 months
1
0
0
0
[ekohl] 58304: [LSALIB/LSASRV] - Add the LSA_CONNECTION_INFO struct to the LSA_API_MSG in order to handle the connection info in an easy way. - Let the connection handler return OperationalMode and...
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Feb 10 12:09:21 2013 New Revision: 58304 URL:
http://svn.reactos.org/svn/reactos?rev=58304&view=rev
Log: [LSALIB/LSASRV] - Add the LSA_CONNECTION_INFO struct to the LSA_API_MSG in order to handle the connection info in an easy way. - Let the connection handler return OperationalMode and Status values. This obsoletes a separate register call to lsasrv.dll, thus remove the register call code entirely. - Add dispatcher code and stubs for the remaining client calls. - Add experimental implementation of LsaCallAuthenticationPackage and LsaLogonUser. Modified: trunk/reactos/dll/win32/lsasrv/authport.c trunk/reactos/include/reactos/subsys/lsass/lsass.h trunk/reactos/lib/lsalib/lsa.c Modified: trunk/reactos/dll/win32/lsasrv/authport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/authport.…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/authport.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/authport.c [iso-8859-1] Sun Feb 10 12:09:21 2013 @@ -21,8 +21,39 @@ /* FUNCTIONS ***************************************************************/ static NTSTATUS +LsapCallAuthenticationPackage(PLSA_API_MSG RequestMsg) +{ + TRACE("(%p)\n", RequestMsg); + + return STATUS_SUCCESS; +} + + +static NTSTATUS +LsapDeregisterLogonProcess(PLSA_API_MSG RequestMsg) +{ + TRACE("(%p)\n", RequestMsg); + + return STATUS_SUCCESS; +} + + +static NTSTATUS +LsapLogonUser(PLSA_API_MSG RequestMsg) +{ + TRACE("(%p)\n", RequestMsg); + + return STATUS_SUCCESS; +} + + +static NTSTATUS LsapLookupAuthenticationPackage(PLSA_API_MSG RequestMsg) { + TRACE("(%p)\n", RequestMsg); + + TRACE("PackageName: %s\n", RequestMsg->LookupAuthenticationPackage.Request.PackageName); + RequestMsg->LookupAuthenticationPackage.Reply.Package = 0x12345678; return STATUS_SUCCESS; @@ -65,6 +96,11 @@ TRACE("Port connection request\n"); RemotePortView.Length = sizeof(REMOTE_PORT_VIEW); + + TRACE("Logon Process Name: %s\n", RequestMsg.ConnectInfo.LogonProcessNameBuffer); + + RequestMsg.ConnectInfo.OperationalMode = 0x43218765; + RequestMsg.ConnectInfo.Status = STATUS_SUCCESS; Accept = TRUE; Status = NtAcceptConnectPort(&ConnectionHandle, @@ -102,12 +138,28 @@ default: TRACE("Received request (ApiNumber: %lu)\n", RequestMsg.ApiNumber); - if (RequestMsg.ApiNumber == LSASS_REQUEST_LOOKUP_AUTHENTICATION_PACKAGE) + switch (RequestMsg.ApiNumber) { - RequestMsg.Status = LsapLookupAuthenticationPackage(&RequestMsg); + case LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE: + RequestMsg.Status = LsapCallAuthenticationPackage(&RequestMsg); + break; + + case LSASS_REQUEST_DEREGISTER_LOGON_PROCESS: + RequestMsg.Status = LsapDeregisterLogonProcess(&RequestMsg); + break; + + case LSASS_REQUEST_LOGON_USER: + RequestMsg.Status = LsapLogonUser(&RequestMsg); + break; + + case LSASS_REQUEST_LOOKUP_AUTHENTICATION_PACKAGE: + RequestMsg.Status = LsapLookupAuthenticationPackage(&RequestMsg); + break; + + default: + RequestMsg.Status = STATUS_SUCCESS; /* FIXME */ + break; } - else - RequestMsg.Status = STATUS_SUCCESS; ReplyMsg = &RequestMsg; break; Modified: trunk/reactos/include/reactos/subsys/lsass/lsass.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/lsa…
============================================================================== --- trunk/reactos/include/reactos/subsys/lsass/lsass.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/subsys/lsass/lsass.h [iso-8859-1] Sun Feb 10 12:09:21 2013 @@ -18,7 +18,6 @@ typedef enum _LSA_API_NUMBER { - LSASS_REQUEST_REGISTER_LOGON_PROCESS, LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE, LSASS_REQUEST_DEREGISTER_LOGON_PROCESS, LSASS_REQUEST_LOGON_USER, @@ -26,85 +25,6 @@ LSASS_REQUEST_MAXIMUM } LSA_API_NUMBER, *PLSA_API_NUMBER; -#if 0 -typedef struct _LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REQUEST -{ - ULONG PackageNameLength; - WCHAR PackageName[0]; -} LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REQUEST, - *PLSASS_LOOKUP_AUTHENTICATION_PACKAGE_REQUEST; - -typedef struct _LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REPLY -{ - ULONG Package; -} LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REPLY, - *PLSASS_LOOKUP_AUTHENTICATION_PACKAGE_REPLY; - -typedef struct _LSASS_DEREGISTER_LOGON_PROCESS_REQUEST -{ - ULONG Dummy; -} LSASS_DEREGISTER_LOGON_PROCESS_REQUEST, - *PLSASS_DEREGISTER_LOGON_PROCES_REQUEST; - -typedef struct _LSASS_DEREGISTER_LOGON_PROCESS_REPLY -{ - ULONG Dummy; -} LSASS_DEREGISTER_LOGON_PROCESS_REPLY, - *PLSASS_DEREGISTER_LOGON_PROCESS_REPLY; -#endif - -typedef struct _LSASS_CALL_AUTHENTICATION_PACKAGE_REQUEST -{ - ULONG AuthenticationPackage; - ULONG InBufferLength; - UCHAR InBuffer[0]; -} LSASS_CALL_AUTHENTICATION_PACKAGE_REQUEST, -*PLSASS_CALL_AUTHENTICATION_PACKAGE_REQUEST; - -typedef struct _LSASS_CALL_AUTHENTICATION_PACKAGE_REPLY -{ - ULONG OutBufferLength; - UCHAR OutBuffer[0]; -} LSASS_CALL_AUTHENTICATION_PACKAGE_REPLY, -*PLSASS_CALL_AUTHENTICATION_PACKAGE_REPLY; - -typedef struct _LSASS_LOGON_USER_REQUEST -{ - ULONG OriginNameLength; - PWSTR OriginName; - SECURITY_LOGON_TYPE LogonType; - ULONG AuthenticationPackage; - PVOID AuthenticationInformation; - ULONG AuthenticationInformationLength; - ULONG LocalGroupsCount; - PSID_AND_ATTRIBUTES LocalGroups; - TOKEN_SOURCE SourceContext; - UCHAR Data[1]; -} LSASS_LOGON_USER_REQUEST, *PLSASS_LOGON_USER_REQUEST; - -typedef struct _LSASS_LOGON_USER_REPLY -{ - PVOID ProfileBuffer; - ULONG ProfileBufferLength; - LUID LogonId; - HANDLE Token; - QUOTA_LIMITS Quotas; - NTSTATUS SubStatus; - UCHAR Data[1]; -} LSASS_LOGON_USER_REPLY, *PLSASS_LOGON_USER_REPLY; - -#if 0 -typedef struct _LSASS_REGISTER_LOGON_PROCESS_REQUEST -{ - ULONG Length; - WCHAR LogonProcessNameBuffer[127]; -} LSASS_REGISTER_LOGON_PROCESS_REQUEST, *PLSASS_REGISTER_LOGON_PROCESS_REQUEST; - -typedef struct _LSASS_REGISTER_LOGON_PROCESS_REPLY -{ - LSA_OPERATIONAL_MODE OperationalMode; -} LSASS_REGISTER_LOGON_PROCESS_REPLY, *PLSASS_REGISTER_LOGON_PROCESS_REPLY; -#endif typedef struct _LSA_CONNECTION_INFO { @@ -114,58 +34,63 @@ CHAR LogonProcessNameBuffer[LSASS_MAX_LOGON_PROCESS_NAME_LENGTH + 1]; } LSA_CONNECTION_INFO, *PLSA_CONNECTION_INFO; -#if 0 -typedef union _LSASS_REQUEST -{ - PORT_MESSAGE Header; - struct { - UCHAR LpcHeader[sizeof(PORT_MESSAGE)]; - ULONG Type; - union - { - LSASS_REGISTER_LOGON_PROCESS_REQUEST RegisterLogonProcessRequest; - LSASS_LOGON_USER_REQUEST LogonUserRequest; - LSASS_CALL_AUTHENTICATION_PACKAGE_REQUEST - CallAuthenticationPackageRequest; - LSASS_DEREGISTER_LOGON_PROCESS_REPLY DeregisterLogonProcessRequest; - LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REQUEST - LookupAuthenticationPackageRequest; - } d; - }; -} LSASS_REQUEST, *PLSASS_REQUEST; -typedef struct _LSASS_REPLY -{ - PORT_MESSAGE Header; - NTSTATUS Status; - union - { - LSASS_REGISTER_LOGON_PROCESS_REPLY RegisterLogonProcessReply; - LSASS_LOGON_USER_REPLY LogonUserReply; - LSASS_CALL_AUTHENTICATION_PACKAGE_REPLY CallAuthenticationPackageReply; - LSASS_DEREGISTER_LOGON_PROCESS_REPLY DeregisterLogonProcessReply; - LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REPLY - LookupAuthenticationPackageReply; - } d; -} LSASS_REPLY, *PLSASS_REPLY; -#endif - - -typedef struct _LSA_REGISTER_LOGON_PROCESS_MSG +typedef struct _LSA_LOGON_USER_MSG { union { struct { - ULONG Length; - CHAR LogonProcessNameBuffer[LSASS_MAX_LOGON_PROCESS_NAME_LENGTH + 1]; + LSA_STRING OriginName; + SECURITY_LOGON_TYPE LogonType; + ULONG AuthenticationPackage; + PVOID AuthenticationInformation; + ULONG AuthenticationInformationLength; + PTOKEN_GROUPS LocalGroups; + ULONG LocalGroupsCount; + TOKEN_SOURCE SourceContext; + } Request; + + struct + { + PVOID ProfileBuffer; + ULONG ProfileBufferLength; + LUID LogonId; + HANDLE Token; + QUOTA_LIMITS Quotas; + NTSTATUS SubStatus; + } Reply; + }; +} LSA_LOGON_USER_MSG, *PLSA_LOGON_USER_MSG; + + +typedef struct _LSA_CALL_AUTHENTICATION_PACKAGE_MSG +{ + union + { + struct + { +#if 0 + ULONG AuthenticationPackage; + ULONG InBufferLength; + UCHAR InBuffer[0]; +#endif + ULONG AuthenticationPackage; + PVOID ProtocolSubmitBuffer; + ULONG SubmitBufferLength; } Request; struct { - LSA_OPERATIONAL_MODE OperationalMode; +#if 0 + ULONG OutBufferLength; + UCHAR OutBuffer[0]; +#endif + PVOID ProtocolReturnBuffer; + ULONG ReturnBufferLength; + NTSTATUS ProtocolStatus; } Reply; }; -} LSA_REGISTER_LOGON_PROCESS_MSG, *PLSA_REGISTER_LOGON_PROCESS_MSG; +} LSA_CALL_AUTHENTICATION_PACKAGE_MSG, *PLSA_CALL_AUTHENTICATION_PACKAGE_MSG; typedef struct _LSA_DEREGISTER_LOGON_PROCESS_MSG @@ -200,20 +125,24 @@ }; } LSA_LOOKUP_AUTHENTICATION_PACKAGE_MSG, *PLSA_LOOKUP_AUTHENTICATION_PACKAGE_MSG; + typedef struct _LSA_API_MSG { PORT_MESSAGE h; - struct + union { - LSA_API_NUMBER ApiNumber; - NTSTATUS Status; - union + LSA_CONNECTION_INFO ConnectInfo; + struct { - LSA_REGISTER_LOGON_PROCESS_MSG RegisterLogonProcess; -// LSA_LOGON_USER_MSG LogonUser; -// LSA_CALL_AUTHENTICATION_PACKAGE_MSG CallAuthenticationPackage; - LSA_DEREGISTER_LOGON_PROCESS_MSG DeregisterLogonProcess; - LSA_LOOKUP_AUTHENTICATION_PACKAGE_MSG LookupAuthenticationPackage; + LSA_API_NUMBER ApiNumber; + NTSTATUS Status; + union + { + LSA_LOGON_USER_MSG LogonUser; + LSA_CALL_AUTHENTICATION_PACKAGE_MSG CallAuthenticationPackage; + LSA_DEREGISTER_LOGON_PROCESS_MSG DeregisterLogonProcess; + LSA_LOOKUP_AUTHENTICATION_PACKAGE_MSG LookupAuthenticationPackage; + }; }; }; } LSA_API_MSG, *PLSA_API_MSG; Modified: trunk/reactos/lib/lsalib/lsa.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/lsalib/lsa.c?rev=58304…
============================================================================== --- trunk/reactos/lib/lsalib/lsa.c [iso-8859-1] (original) +++ trunk/reactos/lib/lsalib/lsa.c [iso-8859-1] Sun Feb 10 12:09:21 2013 @@ -87,6 +87,42 @@ PULONG ReturnBufferLength, PNTSTATUS ProtocolStatus) { + LSA_API_MSG ApiMessage; + NTSTATUS Status; + + DPRINT1("LsaCallAuthenticationPackage()\n"); + + ApiMessage.ApiNumber = LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE; + ApiMessage.h.u1.s1.DataLength = LSA_PORT_DATA_SIZE(ApiMessage.CallAuthenticationPackage.Request); + ApiMessage.h.u1.s1.TotalLength = LSA_PORT_MESSAGE_SIZE; + ApiMessage.h.u2.ZeroInit = 0; + + ApiMessage.CallAuthenticationPackage.Request.AuthenticationPackage = AuthenticationPackage; + ApiMessage.CallAuthenticationPackage.Request.ProtocolSubmitBuffer = ProtocolSubmitBuffer; + ApiMessage.CallAuthenticationPackage.Request.SubmitBufferLength = SubmitBufferLength; + + Status = ZwRequestWaitReplyPort(LsaHandle, + (PPORT_MESSAGE)&ApiMessage, + (PPORT_MESSAGE)&ApiMessage); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ZwRequestWaitReplyPort() failed (Status 0x%08lx)\n", Status); + return Status; + } + + if (!NT_SUCCESS(ApiMessage.Status)) + { + DPRINT1("ZwRequestWaitReplyPort() failed (ApiMessage.Status 0x%08lx)\n", ApiMessage.Status); + return ApiMessage.Status; + } + + *ProtocolReturnBuffer = ApiMessage.CallAuthenticationPackage.Reply.ProtocolReturnBuffer; + *ReturnBufferLength = ApiMessage.CallAuthenticationPackage.Reply.ReturnBufferLength; + *ProtocolStatus = ApiMessage.CallAuthenticationPackage.Reply.ProtocolStatus; + + return Status; + + #if 0 PLSASS_REQUEST Request; PLSASS_REPLY Reply; @@ -135,8 +171,6 @@ return Status; #endif - return 0; - } @@ -216,6 +250,48 @@ PQUOTA_LIMITS Quotas, PNTSTATUS SubStatus) { + LSA_API_MSG ApiMessage; + NTSTATUS Status; + + ApiMessage.ApiNumber = LSASS_REQUEST_LOGON_USER; + ApiMessage.h.u1.s1.DataLength = LSA_PORT_DATA_SIZE(ApiMessage.LogonUser.Request); + ApiMessage.h.u1.s1.TotalLength = LSA_PORT_MESSAGE_SIZE; + ApiMessage.h.u2.ZeroInit = 0; + + ApiMessage.LogonUser.Request.OriginName = *OriginName; + ApiMessage.LogonUser.Request.LogonType = LogonType; + ApiMessage.LogonUser.Request.AuthenticationPackage = AuthenticationPackage; + ApiMessage.LogonUser.Request.AuthenticationInformation = AuthenticationInformation; + ApiMessage.LogonUser.Request.AuthenticationInformationLength = AuthenticationInformationLength; + ApiMessage.LogonUser.Request.LocalGroups = LocalGroups; + if (LocalGroups != NULL) + ApiMessage.LogonUser.Request.LocalGroupsCount = LocalGroups->GroupCount; + else + ApiMessage.LogonUser.Request.LocalGroups = 0; + ApiMessage.LogonUser.Request.SourceContext = *SourceContext; + + Status = ZwRequestWaitReplyPort(LsaHandle, + (PPORT_MESSAGE)&ApiMessage, + (PPORT_MESSAGE)&ApiMessage); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + if (!NT_SUCCESS(ApiMessage.Status)) + { + return ApiMessage.Status; + } + + *ProfileBuffer = ApiMessage.LogonUser.Reply.ProfileBuffer; + *ProfileBufferLength = ApiMessage.LogonUser.Reply.ProfileBufferLength; + *LogonId = ApiMessage.LogonUser.Reply.LogonId; + *Token = ApiMessage.LogonUser.Reply.Token; + *Quotas = ApiMessage.LogonUser.Reply.Quotas; + *SubStatus = ApiMessage.LogonUser.Reply.SubStatus; + + return Status; + #if 0 ULONG RequestLength; ULONG CurrentLength; @@ -300,7 +376,6 @@ return Status; #endif - return 0; } @@ -316,8 +391,6 @@ SECURITY_QUALITY_OF_SERVICE SecurityQos; LSA_CONNECTION_INFO ConnectInfo; ULONG ConnectInfoLength = sizeof(ConnectInfo); - LSA_API_MSG ApiMessage; - HANDLE PortHandle = NULL; NTSTATUS Status; DPRINT1("LsaRegisterLogonProcess()\n"); @@ -325,8 +398,6 @@ /* Check the logon process name length */ if (LsaLogonProcessName->Length > LSASS_MAX_LOGON_PROCESS_NAME_LENGTH) return STATUS_NAME_TOO_LONG; - - *Handle = NULL; RtlInitUnicodeString(&PortName, L"\\LsaAuthenticationPort"); @@ -342,7 +413,7 @@ ConnectInfo.Length = LsaLogonProcessName->Length; ConnectInfo.LogonProcessNameBuffer[ConnectInfo.Length] = '\0'; - Status = ZwConnectPort(&PortHandle, + Status = ZwConnectPort(Handle, &PortName, &SecurityQos, NULL, @@ -356,39 +427,15 @@ return Status; } - ApiMessage.ApiNumber = LSASS_REQUEST_REGISTER_LOGON_PROCESS; - ApiMessage.h.u1.s1.DataLength = LSA_PORT_DATA_SIZE(ApiMessage.RegisterLogonProcess.Request); - ApiMessage.h.u1.s1.TotalLength = LSA_PORT_MESSAGE_SIZE; - ApiMessage.h.u2.ZeroInit = 0; - - ApiMessage.RegisterLogonProcess.Request.Length = LsaLogonProcessName->Length; - memcpy(ApiMessage.RegisterLogonProcess.Request.LogonProcessNameBuffer, - LsaLogonProcessName->Buffer, - ApiMessage.RegisterLogonProcess.Request.Length); - - Status = ZwRequestWaitReplyPort(PortHandle, - (PPORT_MESSAGE)&ApiMessage, - (PPORT_MESSAGE)&ApiMessage); - if (!NT_SUCCESS(Status)) - { - DPRINT1("ZwRequestWaitReplyPort failed (Status 0x%08lx)\n", Status); - NtClose(PortHandle); - return Status; - } - - if (!NT_SUCCESS(ApiMessage.Status)) - { - DPRINT1("ZwRequestWaitReplyPort failed (ApiMessage.Status 0x%08lx)\n", ApiMessage.Status); - NtClose(PortHandle); - return ApiMessage.Status; - } - - *Handle = PortHandle; - *OperationalMode = ApiMessage.RegisterLogonProcess.Reply.OperationalMode; - - DPRINT1("LsaRegisterLogonProcess() done (Status 0x%08lx)\n", Status); - - return Status; + DPRINT("ConnectInfo.OperationalMode: 0x%08lx\n", ConnectInfo.OperationalMode); + *OperationalMode = ConnectInfo.OperationalMode; + + if (!NT_SUCCESS(Status)) + { + DPRINT1("ConnectInfo.Status: 0x%08lx\n", ConnectInfo.Status); + } + + return ConnectInfo.Status; }
11 years, 10 months
1
0
0
0
[ekohl] 58303: [LSALIB/LSASRV] Make the call sequence LsaRegisterLogonProcess, LsaLookupAuthenticationPackage, LsaDeregisterLogonProcess work without failures or loss of connection. WIP.
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Feb 9 22:56:26 2013 New Revision: 58303 URL:
http://svn.reactos.org/svn/reactos?rev=58303&view=rev
Log: [LSALIB/LSASRV] Make the call sequence LsaRegisterLogonProcess, LsaLookupAuthenticationPackage, LsaDeregisterLogonProcess work without failures or loss of connection. WIP. Modified: trunk/reactos/dll/win32/lsasrv/authport.c trunk/reactos/include/reactos/subsys/lsass/lsass.h trunk/reactos/lib/lsalib/lsa.c Modified: trunk/reactos/dll/win32/lsasrv/authport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/authport.…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/authport.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/authport.c [iso-8859-1] Sat Feb 9 22:56:26 2013 @@ -20,16 +20,26 @@ /* FUNCTIONS ***************************************************************/ +static NTSTATUS +LsapLookupAuthenticationPackage(PLSA_API_MSG RequestMsg) +{ + RequestMsg->LookupAuthenticationPackage.Reply.Package = 0x12345678; + + return STATUS_SUCCESS; +} + + NTSTATUS WINAPI AuthPortThreadRoutine(PVOID Param) { - LSASS_REQUEST Request; - PPORT_MESSAGE Reply = NULL; + PLSA_API_MSG ReplyMsg = NULL; + LSA_API_MSG RequestMsg; NTSTATUS Status; HANDLE ConnectionHandle = NULL; PVOID Context = NULL; BOOLEAN Accept; + REMOTE_PORT_VIEW RemotePortView; TRACE("AuthPortThreadRoutine() called\n"); @@ -39,8 +49,8 @@ { Status = NtReplyWaitReceivePort(AuthPortHandle, 0, - Reply, - &Request.Header); + &ReplyMsg->h, + &RequestMsg.h); if (!NT_SUCCESS(Status)) { TRACE("NtReplyWaitReceivePort() failed (Status %lx)\n", Status); @@ -49,42 +59,62 @@ TRACE("Received message\n"); - if (Request.Header.u2.s2.Type == LPC_CONNECTION_REQUEST) + switch (RequestMsg.h.u2.s2.Type) { - TRACE("Port connection request\n"); + case LPC_CONNECTION_REQUEST: + TRACE("Port connection request\n"); - Accept = TRUE; - NtAcceptConnectPort(&ConnectionHandle, - &Context, - &Request.Header, - Accept, - NULL, - NULL); + RemotePortView.Length = sizeof(REMOTE_PORT_VIEW); + Accept = TRUE; + Status = NtAcceptConnectPort(&ConnectionHandle, + &Context, + &RequestMsg.h, + Accept, + NULL, + &RemotePortView); + if (!NT_SUCCESS(Status)) + { + ERR("NtAcceptConnectPort failed (Status 0x%lx)\n", Status); + return Status; + } - NtCompleteConnectPort(ConnectionHandle); + Status = NtCompleteConnectPort(ConnectionHandle); + if (!NT_SUCCESS(Status)) + { + ERR("NtCompleteConnectPort failed (Status 0x%lx)\n", Status); + return Status; + } - } - else if (Request.Header.u2.s2.Type == LPC_PORT_CLOSED || - Request.Header.u2.s2.Type == LPC_CLIENT_DIED) - { - TRACE("Port closed or client died request\n"); + ReplyMsg = NULL; + break; -// return STATUS_UNSUCCESSFUL; - } - else if (Request.Header.u2.s2.Type == LPC_REQUEST) - { - TRACE("Received request (Type: %lu)\n", Request.Type); + case LPC_PORT_CLOSED: + TRACE("Port closed\n"); + ReplyMsg = NULL; + break; - } - else if (Request.Header.u2.s2.Type == LPC_DATAGRAM) - { - TRACE("Received datagram\n"); + case LPC_CLIENT_DIED: + TRACE("Client died\n"); + ReplyMsg = NULL; + break; + default: + TRACE("Received request (ApiNumber: %lu)\n", RequestMsg.ApiNumber); + + if (RequestMsg.ApiNumber == LSASS_REQUEST_LOOKUP_AUTHENTICATION_PACKAGE) + { + RequestMsg.Status = LsapLookupAuthenticationPackage(&RequestMsg); + } + else + RequestMsg.Status = STATUS_SUCCESS; + + ReplyMsg = &RequestMsg; + break; } } - return Status; + return STATUS_SUCCESS; } @@ -107,9 +137,9 @@ Status = NtCreatePort(&AuthPortHandle, &ObjectAttributes, - 0, - 0x100, - 0x2000); + sizeof(LSA_CONNECTION_INFO), + sizeof(LSA_API_MSG), + sizeof(LSA_API_MSG) * 32); if (!NT_SUCCESS(Status)) { TRACE("NtCreatePort() failed (Status %lx)\n", Status); Modified: trunk/reactos/include/reactos/subsys/lsass/lsass.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/lsa…
============================================================================== --- trunk/reactos/include/reactos/subsys/lsass/lsass.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/subsys/lsass/lsass.h [iso-8859-1] Sat Feb 9 22:56:26 2013 @@ -14,14 +14,19 @@ #include <ntsecapi.h> #define LSASS_MAX_LOGON_PROCESS_NAME_LENGTH 127 - -#define LSASS_REQUEST_REGISTER_LOGON_PROCESS (1) -#define LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE (2) -#define LSASS_REQUEST_DEREGISTER_LOGON_PROCESS (3) -#define LSASS_REQUEST_LOGON_USER (4) -#define LSASS_REQUEST_LOOKUP_AUTHENTICATION_PACKAGE (5) -#define LSASS_REQUEST_MAXIMUM (6) - +#define LSASS_MAX_PACKAGE_NAME_LENGTH 127 + +typedef enum _LSA_API_NUMBER +{ + LSASS_REQUEST_REGISTER_LOGON_PROCESS, + LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE, + LSASS_REQUEST_DEREGISTER_LOGON_PROCESS, + LSASS_REQUEST_LOGON_USER, + LSASS_REQUEST_LOOKUP_AUTHENTICATION_PACKAGE, + LSASS_REQUEST_MAXIMUM +} LSA_API_NUMBER, *PLSA_API_NUMBER; + +#if 0 typedef struct _LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REQUEST { ULONG PackageNameLength; @@ -46,6 +51,7 @@ ULONG Dummy; } LSASS_DEREGISTER_LOGON_PROCESS_REPLY, *PLSASS_DEREGISTER_LOGON_PROCESS_REPLY; +#endif typedef struct _LSASS_CALL_AUTHENTICATION_PACKAGE_REQUEST { @@ -87,6 +93,7 @@ UCHAR Data[1]; } LSASS_LOGON_USER_REPLY, *PLSASS_LOGON_USER_REPLY; +#if 0 typedef struct _LSASS_REGISTER_LOGON_PROCESS_REQUEST { ULONG Length; @@ -97,17 +104,17 @@ { LSA_OPERATIONAL_MODE OperationalMode; } LSASS_REGISTER_LOGON_PROCESS_REPLY, *PLSASS_REGISTER_LOGON_PROCESS_REPLY; - - -typedef struct _LSASS_CONNECT_DATA +#endif + +typedef struct _LSA_CONNECTION_INFO { NTSTATUS Status; LSA_OPERATIONAL_MODE OperationalMode; ULONG Length; CHAR LogonProcessNameBuffer[LSASS_MAX_LOGON_PROCESS_NAME_LENGTH + 1]; -} LSASS_CONNECT_DATA, *PLSASS_CONNECT_DATA; - - +} LSA_CONNECTION_INFO, *PLSA_CONNECTION_INFO; + +#if 0 typedef union _LSASS_REQUEST { PORT_MESSAGE Header; @@ -141,5 +148,77 @@ LookupAuthenticationPackageReply; } d; } LSASS_REPLY, *PLSASS_REPLY; +#endif + + +typedef struct _LSA_REGISTER_LOGON_PROCESS_MSG +{ + union + { + struct + { + ULONG Length; + CHAR LogonProcessNameBuffer[LSASS_MAX_LOGON_PROCESS_NAME_LENGTH + 1]; + } Request; + struct + { + LSA_OPERATIONAL_MODE OperationalMode; + } Reply; + }; +} LSA_REGISTER_LOGON_PROCESS_MSG, *PLSA_REGISTER_LOGON_PROCESS_MSG; + + +typedef struct _LSA_DEREGISTER_LOGON_PROCESS_MSG +{ + union + { + struct + { + ULONG Dummy; + } Request; + struct + { + ULONG Dummy; + } Reply; + }; +} LSA_DEREGISTER_LOGON_PROCESS_MSG, *PLSA_DEREGISTER_LOGON_PROCESS_MSG; + + +typedef struct _LSA_LOOKUP_AUTHENTICATION_PACKAGE_MSG +{ + union + { + struct + { + ULONG PackageNameLength; + CHAR PackageName[LSASS_MAX_PACKAGE_NAME_LENGTH + 1]; + } Request; + struct + { + ULONG Package; + } Reply; + }; +} LSA_LOOKUP_AUTHENTICATION_PACKAGE_MSG, *PLSA_LOOKUP_AUTHENTICATION_PACKAGE_MSG; + +typedef struct _LSA_API_MSG +{ + PORT_MESSAGE h; + struct + { + LSA_API_NUMBER ApiNumber; + NTSTATUS Status; + union + { + LSA_REGISTER_LOGON_PROCESS_MSG RegisterLogonProcess; +// LSA_LOGON_USER_MSG LogonUser; +// LSA_CALL_AUTHENTICATION_PACKAGE_MSG CallAuthenticationPackage; + LSA_DEREGISTER_LOGON_PROCESS_MSG DeregisterLogonProcess; + LSA_LOOKUP_AUTHENTICATION_PACKAGE_MSG LookupAuthenticationPackage; + }; + }; +} LSA_API_MSG, *PLSA_API_MSG; + +#define LSA_PORT_DATA_SIZE(c) (sizeof(ULONG)+sizeof(NTSTATUS)+sizeof(c)) +#define LSA_PORT_MESSAGE_SIZE (sizeof(LSA_API_MSG)) #endif /* __INCLUDE_LSASS_LSASS_H */ Modified: trunk/reactos/lib/lsalib/lsa.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/lsalib/lsa.c?rev=58303…
============================================================================== --- trunk/reactos/lib/lsalib/lsa.c [iso-8859-1] (original) +++ trunk/reactos/lib/lsalib/lsa.c [iso-8859-1] Sat Feb 9 22:56:26 2013 @@ -12,6 +12,7 @@ #include <ndk/lpctypes.h> #include <ndk/lpcfuncs.h> #include <ndk/rtlfuncs.h> +#include <ndk/obfuncs.h> #include <psdk/ntsecapi.h> #include <lsass/lsass.h> @@ -30,25 +31,34 @@ NTSTATUS WINAPI LsaDeregisterLogonProcess(HANDLE LsaHandle) { - LSASS_REQUEST Request; - LSASS_REPLY Reply; + LSA_API_MSG ApiMessage; NTSTATUS Status; - Request.Header.u1.s1.DataLength = 0; - Request.Header.u1.s1.TotalLength = sizeof(LSASS_REQUEST); - Request.Type = LSASS_REQUEST_DEREGISTER_LOGON_PROCESS; + DPRINT1("LsaDeregisterLogonProcess()\n"); + + ApiMessage.ApiNumber = LSASS_REQUEST_DEREGISTER_LOGON_PROCESS; + ApiMessage.h.u1.s1.DataLength = LSA_PORT_DATA_SIZE(ApiMessage.DeregisterLogonProcess.Request); + ApiMessage.h.u1.s1.TotalLength = LSA_PORT_MESSAGE_SIZE; + ApiMessage.h.u2.ZeroInit = 0; + Status = ZwRequestWaitReplyPort(LsaHandle, - &Request.Header, - &Reply.Header); - if (!NT_SUCCESS(Status)) - { - return Status; - } - - if (!NT_SUCCESS(Reply.Status)) - { - return Reply.Status; - } + (PPORT_MESSAGE)&ApiMessage, + (PPORT_MESSAGE)&ApiMessage); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ZwRequestWaitReplyPort() failed (Status 0x%08lx)\n", Status); + return Status; + } + + if (!NT_SUCCESS(ApiMessage.Status)) + { + DPRINT1("ZwRequestWaitReplyPort() failed (ApiMessage.Status 0x%08lx)\n", ApiMessage.Status); + return ApiMessage.Status; + } + + NtClose(LsaHandle); + + DPRINT1("LsaDeregisterLogonProcess() done (Status 0x%08lx)\n", Status); return Status; } @@ -77,6 +87,7 @@ PULONG ReturnBufferLength, PNTSTATUS ProtocolStatus) { +#if 0 PLSASS_REQUEST Request; PLSASS_REPLY Reply; LSASS_REQUEST RawRequest; @@ -123,6 +134,9 @@ *ReturnBufferLength); return Status; +#endif + return 0; + } @@ -144,34 +158,42 @@ PLSA_STRING PackageName, PULONG AuthenticationPackage) { + LSA_API_MSG ApiMessage; NTSTATUS Status; - PLSASS_REQUEST Request; - LSASS_REQUEST RawRequest; - LSASS_REPLY Reply; - - Request = (PLSASS_REQUEST)&RawRequest; - Request->Header.u1.s1.DataLength = sizeof(LSASS_REQUEST) + PackageName->Length - - sizeof(PORT_MESSAGE); - Request->Header.u1.s1.TotalLength = Request->Header.u1.s1.DataLength + - sizeof(PORT_MESSAGE); - Request->Type = LSASS_REQUEST_LOOKUP_AUTHENTICATION_PACKAGE; + + /* Check the package name length */ + if (PackageName->Length > LSASS_MAX_PACKAGE_NAME_LENGTH) + { + return STATUS_NAME_TOO_LONG; + } + + ApiMessage.ApiNumber = LSASS_REQUEST_LOOKUP_AUTHENTICATION_PACKAGE; + ApiMessage.h.u1.s1.DataLength = LSA_PORT_DATA_SIZE(ApiMessage.LookupAuthenticationPackage.Request); + ApiMessage.h.u1.s1.TotalLength = LSA_PORT_MESSAGE_SIZE; + ApiMessage.h.u2.ZeroInit = 0; + + ApiMessage.LookupAuthenticationPackage.Request.PackageNameLength = PackageName->Length; + strncpy(ApiMessage.LookupAuthenticationPackage.Request.PackageName, + PackageName->Buffer, + ApiMessage.LookupAuthenticationPackage.Request.PackageNameLength); + ApiMessage.LookupAuthenticationPackage.Request.PackageName[ApiMessage.LookupAuthenticationPackage.Request.PackageNameLength] = '\0'; Status = ZwRequestWaitReplyPort(LsaHandle, - &Request->Header, - &Reply.Header); - if (!NT_SUCCESS(Status)) - { - return Status; - } - - if (!NT_SUCCESS(Reply.Status)) - { - return Reply.Status; - } - - *AuthenticationPackage = Reply.d.LookupAuthenticationPackageReply.Package; - - return Reply.Status; + (PPORT_MESSAGE)&ApiMessage, + (PPORT_MESSAGE)&ApiMessage); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + if (!NT_SUCCESS(ApiMessage.Status)) + { + return ApiMessage.Status; + } + + *AuthenticationPackage = ApiMessage.LookupAuthenticationPackage.Reply.Package; + + return Status; } @@ -194,6 +216,7 @@ PQUOTA_LIMITS Quotas, PNTSTATUS SubStatus) { +#if 0 ULONG RequestLength; ULONG CurrentLength; PLSASS_REQUEST Request; @@ -276,6 +299,8 @@ sizeof(Reply->d.LogonUserReply.Quotas)); return Status; +#endif + return 0; } @@ -289,25 +314,27 @@ { UNICODE_STRING PortName; // = RTL_CONSTANT_STRING(L"\\LsaAuthenticationPort"); SECURITY_QUALITY_OF_SERVICE SecurityQos; - ULONG ConnectInfoLength; + LSA_CONNECTION_INFO ConnectInfo; + ULONG ConnectInfoLength = sizeof(ConnectInfo); + LSA_API_MSG ApiMessage; + HANDLE PortHandle = NULL; NTSTATUS Status; - LSASS_CONNECT_DATA ConnectInfo; -// LSASS_REQUEST Request; -// LSASS_REPLY Reply; + + DPRINT1("LsaRegisterLogonProcess()\n"); /* Check the logon process name length */ if (LsaLogonProcessName->Length > LSASS_MAX_LOGON_PROCESS_NAME_LENGTH) return STATUS_NAME_TOO_LONG; + *Handle = NULL; + RtlInitUnicodeString(&PortName, L"\\LsaAuthenticationPort"); - SecurityQos.Length = sizeof (SecurityQos); + SecurityQos.Length = sizeof(SecurityQos); SecurityQos.ImpersonationLevel = SecurityIdentification; SecurityQos.ContextTrackingMode = SECURITY_DYNAMIC_TRACKING; SecurityQos.EffectiveOnly = TRUE; - - ConnectInfoLength = sizeof(LSASS_CONNECT_DATA); strncpy(ConnectInfo.LogonProcessNameBuffer, LsaLogonProcessName->Buffer, @@ -315,7 +342,7 @@ ConnectInfo.Length = LsaLogonProcessName->Length; ConnectInfo.LogonProcessNameBuffer[ConnectInfo.Length] = '\0'; - Status = ZwConnectPort(Handle, + Status = ZwConnectPort(&PortHandle, &PortName, &SecurityQos, NULL, @@ -325,42 +352,43 @@ &ConnectInfoLength); if (!NT_SUCCESS(Status)) { - return Status; - } + DPRINT1("ZwConnectPort failed (Status 0x%08lx)\n", Status); + return Status; + } + + ApiMessage.ApiNumber = LSASS_REQUEST_REGISTER_LOGON_PROCESS; + ApiMessage.h.u1.s1.DataLength = LSA_PORT_DATA_SIZE(ApiMessage.RegisterLogonProcess.Request); + ApiMessage.h.u1.s1.TotalLength = LSA_PORT_MESSAGE_SIZE; + ApiMessage.h.u2.ZeroInit = 0; + + ApiMessage.RegisterLogonProcess.Request.Length = LsaLogonProcessName->Length; + memcpy(ApiMessage.RegisterLogonProcess.Request.LogonProcessNameBuffer, + LsaLogonProcessName->Buffer, + ApiMessage.RegisterLogonProcess.Request.Length); + + Status = ZwRequestWaitReplyPort(PortHandle, + (PPORT_MESSAGE)&ApiMessage, + (PPORT_MESSAGE)&ApiMessage); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ZwRequestWaitReplyPort failed (Status 0x%08lx)\n", Status); + NtClose(PortHandle); + return Status; + } + + if (!NT_SUCCESS(ApiMessage.Status)) + { + DPRINT1("ZwRequestWaitReplyPort failed (ApiMessage.Status 0x%08lx)\n", ApiMessage.Status); + NtClose(PortHandle); + return ApiMessage.Status; + } + + *Handle = PortHandle; + *OperationalMode = ApiMessage.RegisterLogonProcess.Reply.OperationalMode; + + DPRINT1("LsaRegisterLogonProcess() done (Status 0x%08lx)\n", Status); return Status; -#if 0 - Request.Type = LSASS_REQUEST_REGISTER_LOGON_PROCESS; - Request.Header.u1.s1.DataLength = sizeof(LSASS_REQUEST) - - sizeof(PORT_MESSAGE); - Request.Header.u1.s1.TotalLength = sizeof(LSASS_REQUEST); - - Request.d.RegisterLogonProcessRequest.Length = LsaLogonProcessName->Length; - memcpy(Request.d.RegisterLogonProcessRequest.LogonProcessNameBuffer, - LsaLogonProcessName->Buffer, - Request.d.RegisterLogonProcessRequest.Length); - - Status = ZwRequestWaitReplyPort(*Handle, - &Request.Header, - &Reply.Header); - if (!NT_SUCCESS(Status)) - { -// NtClose(*Handle); -// *Handle = NULL; - return Status; - } - - if (!NT_SUCCESS(Reply.Status)) - { -// NtClose(*Handle); -// *Handle = NULL; - return Status; - } - - *OperationalMode = Reply.d.RegisterLogonProcessReply.OperationalMode; - - return Reply.Status; -#endif }
11 years, 10 months
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
12
13
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
Results per page:
10
25
50
100
200