Index: . =================================================================== --- . (rvision 58607) +++ . (copie de travail) Modification de proprits sur . ___________________________________________________________________ Modified: svn:mergeinfo Fusionn /branches/ros-csrss:r57561-58607 Index: base/applications/cmdutils/doskey/doskey.h =================================================================== --- base/applications/cmdutils/doskey/doskey.h (rvision 58607) +++ base/applications/cmdutils/doskey/doskey.h (copie de travail) @@ -2,48 +2,3 @@ #define IDS_HELP 0 #define IDS_INVALID_MACRO_DEF 1 - -#ifndef RC_INVOKED - -#ifdef UNICODE -#define TNAME(x) x##W -#else -#define TNAME(x) x##A -#endif - -/* Missing from include/psdk/wincon.h */ -#ifndef ENABLE_INSERT_MODE -#define ENABLE_INSERT_MODE 0x20 -#endif -#ifndef ENABLE_EXTENDED_FLAGS -#define ENABLE_EXTENDED_FLAGS 0x80 -#endif - -/* Undocumented APIs */ -#ifndef AddConsoleAlias -BOOL WINAPI AddConsoleAliasA(LPSTR, LPSTR, LPSTR); -BOOL WINAPI AddConsoleAliasW(LPWSTR, LPWSTR, LPWSTR); -#define AddConsoleAlias TNAME(AddConsoleAlias) -#endif -#ifndef GetConsoleAliases -DWORD WINAPI GetConsoleAliasesA(LPSTR, DWORD, LPSTR); -DWORD WINAPI GetConsoleAliasesW(LPWSTR, DWORD, LPWSTR); -#define GetConsoleAliases TNAME(GetConsoleAliases) -#endif -#ifndef GetConsoleAliasesLength -DWORD WINAPI GetConsoleAliasesLengthA(LPSTR); -DWORD WINAPI GetConsoleAliasesLengthW(LPWSTR); -#define GetConsoleAliasesLength TNAME(GetConsoleAliasesLength) -#endif -#ifndef GetConsoleAliasExes -DWORD WINAPI GetConsoleAliasExesA(LPSTR, DWORD); -DWORD WINAPI GetConsoleAliasExesW(LPWSTR, DWORD); -#define GetConsoleAliasExes TNAME(GetConsoleAliasExes) -#endif -#ifndef GetConsoleAliasExesLength -DWORD WINAPI GetConsoleAliasExesLengthA(VOID); -DWORD WINAPI GetConsoleAliasExesLengthW(VOID); -#define GetConsoleAliasExesLength TNAME(GetConsoleAliasExesLength) -#endif - -#endif /* RC_INVOKED */ Index: base/system/smss/smloop.c =================================================================== --- base/system/smss/smloop.c (rvision 58607) +++ base/system/smss/smloop.c (copie de travail) @@ -166,7 +166,7 @@ return STATUS_NOT_IMPLEMENTED; } -PSM_API_HANDLER SmpApiDispatch[SmMaxApiNumber] = +PSM_API_HANDLER SmpApiDispatch[SmpMaxApiNumber - SmpCreateForeignSessionApi] = { SmpCreateForeignSession, SmpSessionComplete, @@ -401,13 +401,13 @@ RequestMsg.ReturnValue = STATUS_PENDING; /* Check if the API is valid */ - if (RequestMsg.ApiNumber >= SmMaxApiNumber) + if (RequestMsg.ApiNumber >= SmpMaxApiNumber) { /* It isn't, fail */ DPRINT1("Invalid API: %lx\n", RequestMsg.ApiNumber); Status = STATUS_NOT_IMPLEMENTED; } - else if ((RequestMsg.ApiNumber <= SmTerminateForeignSessionApi) && + else if ((RequestMsg.ApiNumber <= SmpTerminateForeignSessionApi) && !(ClientContext->Subsystem)) { /* It's valid, but doesn't have a subsystem with it */ Index: boot/bootdata/hivedef.inf =================================================================== --- boot/bootdata/hivedef.inf (rvision 58607) +++ boot/bootdata/hivedef.inf (copie de travail) @@ -3,38 +3,6 @@ [AddReg] -HKCU,"Console","CursorSize",0x00010003,25 -HKCU,"Console","FaceName",0x00000002,"" -HKCU,"Console","FontFamily",0x00010003,0 -HKCU,"Console","FontSize",0x00010003,0 -HKCU,"Console","FontWeight",0x00010003,0 -HKCU,"Console","FullScreen",0x00010003,0 -HKCU,"Console","HistoryBufferSize",0x00010003,50 -HKCU,"Console","InsertMode",0x00010003,1 -HKCU,"Console","LoadConIme",0x00010003,1 -HKCU,"Console","NumberOfHistoryBuffers",0x00010003,4 -HKCU,"Console","PopupColors",0x00010003,245 -HKCU,"Console","QuickEdit",0x00010003,0 -HKCU,"Console","ScreenBufferSize",0x00010003,19660880 -HKCU,"Console","ScreenColors",0x00010003,7 -HKCU,"Console","WindowSize",0x00010003,1638480 -HKCU,"Console","ColorTable00",0x00010003,0 -HKCU,"Console","ColorTable01",0x00010003,8388608 -HKCU,"Console","ColorTable02",0x00010003,32768 -HKCU,"Console","ColorTable03",0x00010003,8421376 -HKCU,"Console","ColorTable04",0x00010003,128 -HKCU,"Console","ColorTable05",0x00010003,8388736 -HKCU,"Console","ColorTable06",0x00010003,32896 -HKCU,"Console","ColorTable07",0x00010003,12632256 -HKCU,"Console","ColorTable08",0x00010003,8421504 -HKCU,"Console","ColorTable09",0x00010003,16711680 -HKCU,"Console","ColorTable10",0x00010003,65280 -HKCU,"Console","ColorTable11",0x00010003,16776960 -HKCU,"Console","ColorTable12",0x00010003,255 -HKCU,"Console","ColorTable13",0x00010003,16711935 -HKCU,"Console","ColorTable14",0x00010003,65535 -HKCU,"Console","ColorTable15",0x00010003,16777215 - HKCU,"Control Panel",,0x00000012 ; Accessibility Index: boot/bootdata/hivesys.inf =================================================================== --- boot/bootdata/hivesys.inf (rvision 58607) +++ boot/bootdata/hivesys.inf (copie de travail) @@ -770,8 +770,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Keyboard Layout\DosKeybIDs","00020408",2,"319" ; Lsa -HKLM,"SYSTEM\CurrentControlSet\Control\Lsa","Authentication Packages",0x00010000, \ - "msv1_0" +HKLM,"SYSTEM\CurrentControlSet\Control\Lsa","Authentication Packages",0x00010000,"msv1_0" ; Network HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}",,0x00000000,"Network Adapters" @@ -1246,7 +1245,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems","Optional",0x00010000,"Posix" HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems","Posix",0x00020000,"%SystemRoot%\system32\psxss.exe" HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems","Required",0x00010000,"Debug","Windows" -HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,12288,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=win32csr:Win32CsrInitialization,2 ProfileControl=Off MaxRequestThreads=16" +HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,12288,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=consrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16" ; WOW Support HKLM,"SYSTEM\CurrentControlSet\Control\Wow","",0x00000000,"" Index: dll/cpl/console/CMakeLists.txt =================================================================== --- dll/cpl/console/CMakeLists.txt (rvision 58607) +++ dll/cpl/console/CMakeLists.txt (copie de travail) @@ -1,4 +1,5 @@ +include_directories(${REACTOS_SOURCE_DIR}/win32ss/user/consrv) spec2def(console.dll console.spec) @@ -20,7 +21,8 @@ user32 gdi32 comctl32 - kernel32) + kernel32 + ntdll) add_pch(console console.h) add_cd_file(TARGET console DESTINATION reactos/system32 FOR all) Index: dll/cpl/console/colors.c =================================================================== --- dll/cpl/console/colors.c (rvision 58607) +++ dll/cpl/console/colors.c (copie de travail) @@ -8,237 +8,279 @@ #include "console.h" -static -BOOL -PaintStaticControls(HWND hwndDlg, PConsoleInfo pConInfo, LPDRAWITEMSTRUCT drawItem) +#define NDEBUG +#include + +static BOOL +PaintStaticControls(HWND hwndDlg, + PCONSOLE_PROPS pConInfo, + LPDRAWITEMSTRUCT drawItem) { - HBRUSH hBrush; - DWORD index; + HBRUSH hBrush; + DWORD index; - index = drawItem->CtlID - IDC_STATIC_COLOR1; - hBrush = CreateSolidBrush(pConInfo->Colors[index]); - if (!hBrush) - { - return FALSE; - } + index = min(drawItem->CtlID - IDC_STATIC_COLOR1, + sizeof(pConInfo->ci.Colors) / sizeof(pConInfo->ci.Colors[0]) - 1); + hBrush = CreateSolidBrush(pConInfo->ci.Colors[index]); + if (!hBrush) + { + return FALSE; + } - FillRect(drawItem->hDC, &drawItem->rcItem, hBrush); + FillRect(drawItem->hDC, &drawItem->rcItem, hBrush); DeleteObject((HGDIOBJ)hBrush); - if (pConInfo->ActiveStaticControl == index) - { - DrawFocusRect(drawItem->hDC, &drawItem->rcItem); - } - return TRUE; + if (pConInfo->ActiveStaticControl == index) + { + DrawFocusRect(drawItem->hDC, &drawItem->rcItem); + } + + return TRUE; } -INT_PTR -CALLBACK -ColorsProc( - HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam -) +INT_PTR CALLBACK +ColorsProc(HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) { - PConsoleInfo pConInfo; - LPNMUPDOWN lpnmud; - LPPSHNOTIFY lppsn; - LPDRAWITEMSTRUCT drawItem; - DWORD red = MAXDWORD; - DWORD green = MAXDWORD; - DWORD blue = MAXDWORD; + PCONSOLE_PROPS pConInfo; + LPDRAWITEMSTRUCT drawItem; + DWORD colorIndex; + COLORREF color; - pConInfo = (PConsoleInfo) GetWindowLongPtr(hwndDlg, DWLP_USER); + pConInfo = (PCONSOLE_PROPS)GetWindowLongPtr(hwndDlg, DWLP_USER); - switch(uMsg) - { - case WM_INITDIALOG: - { - pConInfo = (PConsoleInfo) ((LPPROPSHEETPAGE)lParam)->lParam; - SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo); - SendMessage(GetDlgItem(hwndDlg, IDC_RADIO_SCREEN_BACKGROUND), BM_SETCHECK, BST_CHECKED, 0); - SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_RED), UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0)); - SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_GREEN), UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0)); - SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_BLUE), UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0)); - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(pConInfo->ScreenBackground), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(pConInfo->ScreenBackground), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, GetBValue(pConInfo->ScreenBackground), FALSE); - CheckRadioButton(hwndDlg, IDC_RADIO_SCREEN_TEXT, IDC_RADIO_POPUP_BACKGROUND, IDC_RADIO_SCREEN_BACKGROUND); - return TRUE; - } - case WM_DRAWITEM: - { - drawItem = (LPDRAWITEMSTRUCT)lParam; - if (drawItem->CtlID >= IDC_STATIC_COLOR1 && drawItem->CtlID <= IDC_STATIC_COLOR16) - { - return PaintStaticControls(hwndDlg, pConInfo, drawItem); - } - else if (drawItem->CtlID == IDC_STATIC_SCREEN_COLOR || drawItem->CtlID == IDC_STATIC_POPUP_COLOR) - { - PaintText(drawItem, pConInfo); - return TRUE; - } - } - case WM_NOTIFY: - { - lpnmud = (LPNMUPDOWN) lParam; - lppsn = (LPPSHNOTIFY) lParam; + switch (uMsg) + { + case WM_INITDIALOG: + { + pConInfo = (PCONSOLE_PROPS)((LPPROPSHEETPAGE)lParam)->lParam; + SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo); - if (lppsn->hdr.code == PSN_APPLY) - { - if (!pConInfo->AppliedConfig) - { - ApplyConsoleInfo(hwndDlg, pConInfo); - } - else - { - /* Options have already been applied */ - SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR); - return TRUE; - } - return TRUE; - } + /* Set the valid range of the colour indicators */ + SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_RED), UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0)); + SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_GREEN), UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0)); + SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_BLUE), UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0)); - if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_RED) - { - red = lpnmud->iPos; - } - else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_GREEN) - { - green = lpnmud->iPos; - } - else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_BLUE) - { - blue = lpnmud->iPos; - } - else - { - break; - } + /* Select by default the screen background option */ + CheckRadioButton(hwndDlg, IDC_RADIO_SCREEN_TEXT, IDC_RADIO_POPUP_BACKGROUND, IDC_RADIO_SCREEN_BACKGROUND); + SendMessage(hwndDlg, WM_COMMAND, IDC_RADIO_SCREEN_BACKGROUND, 0); - if (red == MAXDWORD) - { - red = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_RED), UDM_GETPOS, 0, 0); - if (HIWORD(red)) - { - // TODO: Handle error - break; - } - red = LOBYTE(red); - } + return TRUE; + } - if (green == MAXDWORD) - { - green = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_GREEN), UDM_GETPOS, 0, 0); - if (HIWORD(green)) - { - // TODO: Handle error - break; - } - green = LOBYTE(green); - } + case WM_DRAWITEM: + { + drawItem = (LPDRAWITEMSTRUCT)lParam; + if (drawItem->CtlID >= IDC_STATIC_COLOR1 && drawItem->CtlID <= IDC_STATIC_COLOR16) + { + return PaintStaticControls(hwndDlg, pConInfo, drawItem); + } + else if (drawItem->CtlID == IDC_STATIC_SCREEN_COLOR || drawItem->CtlID == IDC_STATIC_POPUP_COLOR) + { + PaintText(drawItem, pConInfo); + return TRUE; + } + break; + } - if (blue == MAXDWORD) - { - blue = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_BLUE), UDM_GETPOS, 0, 0); - if (HIWORD(blue)) - { - // TODO: Handle error - break; - } - blue = LOBYTE(blue); - } - pConInfo->Colors[pConInfo->ActiveStaticControl] = RGB(red, green, blue); - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE); - break; - } - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case IDC_RADIO_SCREEN_TEXT: - { - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(pConInfo->ScreenText), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(pConInfo->ScreenText), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, GetBValue(pConInfo->ScreenText), FALSE); - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE); - break; - } - case IDC_RADIO_SCREEN_BACKGROUND: - { - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(pConInfo->ScreenBackground), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(pConInfo->ScreenBackground), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, GetBValue(pConInfo->ScreenBackground), FALSE); - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE); - break; - } - case IDC_RADIO_POPUP_TEXT: - { - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(pConInfo->PopupText), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(pConInfo->PopupText), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, GetBValue(pConInfo->PopupText), FALSE); - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE); - break; - } - case IDC_RADIO_POPUP_BACKGROUND: - { - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(pConInfo->PopupBackground), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(pConInfo->PopupBackground), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, GetBValue(pConInfo->PopupBackground), FALSE); - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE); - break; - } - } - if (HIWORD(wParam) == STN_CLICKED && LOWORD(wParam) >= IDC_STATIC_COLOR1 && LOWORD(wParam) <= IDC_STATIC_COLOR16) - { - DWORD index = LOWORD(wParam) - IDC_STATIC_COLOR1; + case WM_NOTIFY: + { + switch (((LPNMHDR)lParam)->code) + { + case PSN_APPLY: + { + // LPPSHNOTIFY lppsn; + if (!pConInfo->AppliedConfig) + { + return ApplyConsoleInfo(hwndDlg, pConInfo); + } + else + { + /* Options have already been applied */ + SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR); + return TRUE; + } + break; + } - if (index == pConInfo->ActiveStaticControl) - { - /* Same static control was re-clicked */ - break; - } + case UDN_DELTAPOS: + { + LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam; - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(pConInfo->Colors[index]), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(pConInfo->Colors[index]), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, GetBValue(pConInfo->Colors[index]), FALSE); + /* Get the current color */ + colorIndex = pConInfo->ActiveStaticControl; + color = pConInfo->ci.Colors[colorIndex]; - /* Update global struct */ - if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_SCREEN_TEXT)) - { - pConInfo->ScreenText = pConInfo->Colors[index]; - } - else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_SCREEN_BACKGROUND)) - { - pConInfo->ScreenBackground = pConInfo->Colors[index]; - } - else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_POPUP_TEXT)) - { - pConInfo->PopupText = pConInfo->Colors[index]; - } - else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_POPUP_BACKGROUND)) - { - pConInfo->PopupBackground = pConInfo->Colors[index]; - } - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + index), NULL, TRUE); - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE); - pConInfo->ActiveStaticControl = index; - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - break; - } - } + if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_RED) + { + if (lpnmud->iPos < 0) lpnmud->iPos = 0; + else if (lpnmud->iPos > 255) lpnmud->iPos = 255; - default: - break; - } + color = RGB(lpnmud->iPos, GetGValue(color), GetBValue(color)); + } + else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_GREEN) + { + if (lpnmud->iPos < 0) lpnmud->iPos = 0; + else if (lpnmud->iPos > 255) lpnmud->iPos = 255; - return FALSE; + color = RGB(GetRValue(color), lpnmud->iPos, GetBValue(color)); + } + else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_BLUE) + { + if (lpnmud->iPos < 0) lpnmud->iPos = 0; + else if (lpnmud->iPos > 255) lpnmud->iPos = 255; + + color = RGB(GetRValue(color), GetGValue(color), lpnmud->iPos); + } + else + { + break; + } + + pConInfo->ci.Colors[colorIndex] = color; + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE); + + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + } + } + + break; + } + + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDC_RADIO_SCREEN_TEXT: + { + /* Get the color of the screen foreground */ + colorIndex = TextAttribFromAttrib(pConInfo->ci.ScreenAttrib); + color = pConInfo->ci.Colors[colorIndex]; + + /* Set the values of the colour indicators */ + SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(color), FALSE); + SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE); + SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, GetBValue(color), FALSE); + + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); + pConInfo->ActiveStaticControl = colorIndex; + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE); + break; + } + + case IDC_RADIO_SCREEN_BACKGROUND: + { + /* Get the color of the screen background */ + colorIndex = BkgdAttribFromAttrib(pConInfo->ci.ScreenAttrib); + color = pConInfo->ci.Colors[colorIndex]; + + /* Set the values of the colour indicators */ + SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(color), FALSE); + SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE); + SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, GetBValue(color), FALSE); + + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); + pConInfo->ActiveStaticControl = colorIndex; + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE); + break; + } + + case IDC_RADIO_POPUP_TEXT: + { + /* Get the color of the popup foreground */ + colorIndex = TextAttribFromAttrib(pConInfo->ci.PopupAttrib); + color = pConInfo->ci.Colors[colorIndex]; + + /* Set the values of the colour indicators */ + SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(color), FALSE); + SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE); + SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, GetBValue(color), FALSE); + + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); + pConInfo->ActiveStaticControl = colorIndex; + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE); + break; + } + + case IDC_RADIO_POPUP_BACKGROUND: + { + /* Get the color of the popup background */ + colorIndex = BkgdAttribFromAttrib(pConInfo->ci.PopupAttrib); + color = pConInfo->ci.Colors[colorIndex]; + + /* Set the values of the colour indicators */ + SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(color), FALSE); + SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE); + SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, GetBValue(color), FALSE); + + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); + pConInfo->ActiveStaticControl = colorIndex; + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE); + break; + } + } + + if ( HIWORD(wParam) == STN_CLICKED && + IDC_STATIC_COLOR1 <= LOWORD(wParam) && LOWORD(wParam) <= IDC_STATIC_COLOR16 ) + { + colorIndex = LOWORD(wParam) - IDC_STATIC_COLOR1; + + if (colorIndex == pConInfo->ActiveStaticControl) + { + /* Same static control was re-clicked */ + break; + } + + color = pConInfo->ci.Colors[colorIndex]; + + SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(color), FALSE); + SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE); + SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, GetBValue(color), FALSE); + + /* Update global struct */ + if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_SCREEN_TEXT)) + { + pConInfo->ci.ScreenAttrib = MakeAttrib(colorIndex, BkgdAttribFromAttrib(pConInfo->ci.ScreenAttrib)); + } + else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_SCREEN_BACKGROUND)) + { + pConInfo->ci.ScreenAttrib = MakeAttrib(TextAttribFromAttrib(pConInfo->ci.ScreenAttrib), colorIndex); + } + else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_POPUP_TEXT)) + { + pConInfo->ci.PopupAttrib = MakeAttrib(colorIndex, BkgdAttribFromAttrib(pConInfo->ci.PopupAttrib)); + } + else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_POPUP_BACKGROUND)) + { + pConInfo->ci.PopupAttrib = MakeAttrib(TextAttribFromAttrib(pConInfo->ci.PopupAttrib), colorIndex); + } + + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); + pConInfo->ActiveStaticControl = colorIndex; + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE); + + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + } + } + + default: + break; + } + + return FALSE; } Index: dll/cpl/console/console.c =================================================================== --- dll/cpl/console/console.c (rvision 58607) +++ dll/cpl/console/console.c (copie de travail) @@ -8,9 +8,10 @@ #include "console.h" -#define NUM_APPLETS (1) -#define WM_SETCONSOLE (WM_USER+10) +#define NDEBUG +#include +#define NUM_APPLETS 1 LONG APIENTRY InitApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam); INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); @@ -23,286 +24,362 @@ /* Applets */ APPLET Applets[NUM_APPLETS] = { - {IDC_CPLICON, IDS_CPLNAME, IDS_CPLDESCRIPTION, InitApplet} + {IDC_CPLICON, IDS_CPLNAME, IDS_CPLDESCRIPTION, InitApplet} }; -static COLORREF s_Colors[] = +/* + * Default 16-color palette for foreground and background + * (corresponding flags in comments). + */ +const COLORREF s_Colors[16] = { - RGB(0, 0, 0), - RGB(0, 0, 128), - RGB(0, 128, 0), - RGB(0, 128, 128), - RGB(128, 0, 0), - RGB(128, 0, 128), - RGB(128, 128, 0), - RGB(192, 192, 192), - RGB(128, 128, 128), - RGB(0, 0, 255), - RGB(0, 255, 0), - RGB(0, 255, 255), - RGB(255, 0, 0), - RGB(255, 0, 255), - RGB(255, 255, 0), - RGB(255, 255, 255) + RGB(0, 0, 0), // (Black) + RGB(0, 0, 128), // BLUE + RGB(0, 128, 0), // GREEN + RGB(0, 128, 128), // BLUE | GREEN + RGB(128, 0, 0), // RED + RGB(128, 0, 128), // BLUE | RED + RGB(128, 128, 0), // GREEN | RED + RGB(192, 192, 192), // BLUE | GREEN | RED + + RGB(128, 128, 128), // (Grey) INTENSITY + RGB(0, 0, 255), // BLUE | INTENSITY + RGB(0, 255, 0), // GREEN | INTENSITY + RGB(0, 255, 255), // BLUE | GREEN | INTENSITY + RGB(255, 0, 0), // RED | INTENSITY + RGB(255, 0, 255), // BLUE | RED | INTENSITY + RGB(255, 255, 0), // GREEN | RED | INTENSITY + RGB(255, 255, 255) // BLUE | GREEN | RED | INTENSITY }; +/* Default attributes */ +#define DEFAULT_SCREEN_ATTRIB (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED) +#define DEFAULT_POPUP_ATTRIB (FOREGROUND_BLUE | FOREGROUND_RED | \ + BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY) +/* Cursor size */ +#define CSR_DEFAULT_CURSOR_SIZE 25 -static void -InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc, LPARAM lParam) +static VOID +InitPropSheetPage(PROPSHEETPAGE *psp, + WORD idDlg, + DLGPROC DlgProc, + LPARAM lParam) { - ZeroMemory(psp, sizeof(PROPSHEETPAGE)); - psp->dwSize = sizeof(PROPSHEETPAGE); - psp->dwFlags = PSP_DEFAULT; - psp->hInstance = hApplet; - psp->pszTemplate = MAKEINTRESOURCE(idDlg); - psp->pfnDlgProc = DlgProc; - psp->lParam = lParam; + ZeroMemory(psp, sizeof(PROPSHEETPAGE)); + psp->dwSize = sizeof(PROPSHEETPAGE); + psp->dwFlags = PSP_DEFAULT; + psp->hInstance = hApplet; + psp->pszTemplate = MAKEINTRESOURCE(idDlg); + psp->pfnDlgProc = DlgProc; + psp->lParam = lParam; } -PConsoleInfo +PCONSOLE_PROPS AllocConsoleInfo() { - PConsoleInfo pConInfo; + /* Adapted for holding GUI terminal information */ + return HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + sizeof(CONSOLE_PROPS) + sizeof(GUI_CONSOLE_INFO)); +} - pConInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ConsoleInfo)); +VOID +InitConsoleDefaults(PCONSOLE_PROPS pConInfo) +{ + PGUI_CONSOLE_INFO GuiInfo = NULL; - return pConInfo; -} + /* Initialize the default properties */ + pConInfo->ci.HistoryBufferSize = 50; + pConInfo->ci.NumberOfHistoryBuffers = 4; + pConInfo->ci.HistoryNoDup = FALSE; + pConInfo->ci.FullScreen = FALSE; + pConInfo->ci.QuickEdit = FALSE; + pConInfo->ci.InsertMode = TRUE; + // pConInfo->ci.InputBufferSize; + pConInfo->ci.ScreenBufferSize = (COORD){80, 300}; + pConInfo->ci.ConsoleSize = (COORD){80, 25 }; + pConInfo->ci.CursorBlinkOn = TRUE; + pConInfo->ci.ForceCursorOff = FALSE; + pConInfo->ci.CursorSize = CSR_DEFAULT_CURSOR_SIZE; + pConInfo->ci.ScreenAttrib = DEFAULT_SCREEN_ATTRIB; + pConInfo->ci.PopupAttrib = DEFAULT_POPUP_ATTRIB; + pConInfo->ci.CodePage = 0; + pConInfo->ci.ConsoleTitle[0] = L'\0'; -void -InitConsoleDefaults(PConsoleInfo pConInfo) -{ - /* Initialize struct */ - pConInfo->InsertMode = TRUE; - pConInfo->HistoryBufferSize = 50; - pConInfo->NumberOfHistoryBuffers = 5; - pConInfo->ScreenText = RGB(192, 192, 192); - pConInfo->ScreenBackground = RGB(0, 0, 0); - pConInfo->PopupText = RGB(128, 0, 128); - pConInfo->PopupBackground = RGB(255, 255, 255); - pConInfo->WindowSize = (DWORD)MAKELONG(80, 25); - pConInfo->WindowPosition = UINT_MAX; - pConInfo->ScreenBuffer = MAKELONG(80, 300); - pConInfo->UseRasterFonts = TRUE; - pConInfo->FontSize = (DWORD)MAKELONG(8, 12); - pConInfo->FontWeight = FW_NORMAL; - memcpy(pConInfo->Colors, s_Colors, sizeof(s_Colors)); + /* Adapted for holding GUI terminal information */ + pConInfo->TerminalInfo.Size = sizeof(GUI_CONSOLE_INFO); + GuiInfo = pConInfo->TerminalInfo.TermInfo = (PGUI_CONSOLE_INFO)(pConInfo + 1); + GuiInfo->FaceName[0] = L'\0'; + GuiInfo->FontFamily = FF_DONTCARE; + GuiInfo->FontSize = 0; + GuiInfo->FontWeight = FW_DONTCARE; + GuiInfo->UseRasterFonts = TRUE; + + GuiInfo->AutoPosition = TRUE; + GuiInfo->WindowOrigin = (POINT){0, 0}; + + memcpy(pConInfo->ci.Colors, s_Colors, sizeof(s_Colors)); } - INT_PTR CALLBACK -ApplyProc( - HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam -) +ApplyProc(HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) { - HWND hDlgCtrl; + HWND hDlgCtrl; - UNREFERENCED_PARAMETER(lParam); + UNREFERENCED_PARAMETER(lParam); - switch(uMsg) - { - case WM_INITDIALOG: - { - hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_APPLY_CURRENT); - SendMessage(hDlgCtrl, BM_SETCHECK, BST_CHECKED, 0); - return TRUE; - } - case WM_COMMAND: - { - if (LOWORD(wParam) == IDOK) - { - hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_APPLY_CURRENT); - if ( SendMessage(hDlgCtrl, BM_GETCHECK, 0, 0) == BST_CHECKED ) - EndDialog(hwndDlg, IDC_RADIO_APPLY_CURRENT); - else - EndDialog(hwndDlg, IDC_RADIO_APPLY_ALL); - } - else if (LOWORD(wParam) == IDCANCEL) - { - EndDialog(hwndDlg, IDCANCEL); - } - break; - } - default: - break; - } - return FALSE; + switch (uMsg) + { + case WM_INITDIALOG: + { + hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_APPLY_CURRENT); + SendMessage(hDlgCtrl, BM_SETCHECK, BST_CHECKED, 0); + return TRUE; + } + case WM_COMMAND: + { + if (LOWORD(wParam) == IDOK) + { + hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_APPLY_CURRENT); + if (SendMessage(hDlgCtrl, BM_GETCHECK, 0, 0) == BST_CHECKED) + EndDialog(hwndDlg, IDC_RADIO_APPLY_CURRENT); + else + EndDialog(hwndDlg, IDC_RADIO_APPLY_ALL); + } + else if (LOWORD(wParam) == IDCANCEL) + { + EndDialog(hwndDlg, IDCANCEL); + } + break; + } + default: + break; + } + return FALSE; } -void -ApplyConsoleInfo(HWND hwndDlg, PConsoleInfo pConInfo) +BOOL +ApplyConsoleInfo(HWND hwndDlg, + PCONSOLE_PROPS pConInfo) { - INT_PTR res = 0; + INT_PTR res = 0; - res = DialogBox(hApplet, MAKEINTRESOURCE(IDD_APPLYOPTIONS), hwndDlg, ApplyProc); + res = DialogBox(hApplet, MAKEINTRESOURCE(IDD_APPLYOPTIONS), hwndDlg, ApplyProc); + if (res == IDCANCEL) + { + /* Don't destroy when user presses cancel */ + SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE); + return TRUE; + } + else if (res == IDC_RADIO_APPLY_ALL || res == IDC_RADIO_APPLY_CURRENT) + { + HANDLE hSection; + PCONSOLE_PROPS pSharedInfo; - if (res == IDCANCEL) - { - /* Don't destroy when user presses cancel */ - SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE); - } - else if ( res == IDC_RADIO_APPLY_ALL ) - { - pConInfo->AppliedConfig = TRUE; - SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR); - SendMessage(pConInfo->hConsoleWindow, PM_APPLY_CONSOLE_INFO, (WPARAM)pConInfo, (LPARAM)TRUE); - } - else if ( res == IDC_RADIO_APPLY_CURRENT ) - { - pConInfo->AppliedConfig = TRUE; - SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR); - SendMessage(pConInfo->hConsoleWindow, PM_APPLY_CONSOLE_INFO, (WPARAM)pConInfo, (LPARAM)TRUE); - } + /* + * Create a memory section to share with the server, and map it. + */ + /* Holds data for console.dll + console info + terminal-specific info */ + hSection = CreateFileMapping(INVALID_HANDLE_VALUE, + NULL, + PAGE_READWRITE, + 0, + sizeof(CONSOLE_PROPS) + sizeof(GUI_CONSOLE_INFO), + NULL); + if (!hSection) + { + DPRINT1("Error when creating file mapping, error = %d\n", GetLastError()); + return FALSE; + } + + pSharedInfo = MapViewOfFile(hSection, FILE_MAP_ALL_ACCESS, 0, 0, 0); + if (!pSharedInfo) + { + DPRINT1("Error when mapping view of file, error = %d\n", GetLastError()); + CloseHandle(hSection); + return FALSE; + } + + /* We are applying the chosen configuration */ + pConInfo->AppliedConfig = TRUE; + + /* Copy the console info into the section */ + RtlCopyMemory(pSharedInfo, pConInfo, sizeof(CONSOLE_PROPS) + sizeof(GUI_CONSOLE_INFO)); + /* Offsetize */ + pSharedInfo->TerminalInfo.TermInfo = (PVOID)((ULONG_PTR)pSharedInfo->TerminalInfo.TermInfo - (ULONG_PTR)pSharedInfo); + + /* Unmap it */ + UnmapViewOfFile(pSharedInfo); + + /* Signal to the console server that it can apply the new configuration */ + SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR); + SendMessage(pConInfo->hConsoleWindow, + PM_APPLY_CONSOLE_INFO, + (WPARAM)hSection, + (LPARAM)(res == IDC_RADIO_APPLY_ALL)); + + /* Close the section and return */ + CloseHandle(hSection); + return TRUE; + } + + return TRUE; } /* First Applet */ LONG APIENTRY -InitApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) +InitApplet(HWND hWnd, UINT uMsg, LPARAM wParam, LPARAM lParam) { - PROPSHEETPAGE psp[4]; - PROPSHEETHEADER psh; - INT i=0; - PConsoleInfo pConInfo; - WCHAR szTitle[100]; - PConsoleInfo pSharedInfo = (PConsoleInfo)wParam; + HANDLE hSection = (HANDLE)wParam; + BOOL GuiTermInfo = FALSE; + PCONSOLE_PROPS pSharedInfo; + PCONSOLE_PROPS pConInfo; + WCHAR szTitle[MAX_PATH + 1]; + PROPSHEETPAGE psp[4]; + PROPSHEETHEADER psh; + INT i = 0; - UNREFERENCED_PARAMETER(uMsg); + UNREFERENCED_PARAMETER(uMsg); - /* - * console.dll shares information with win32csr with wParam, lParam - * - * wParam is a pointer to a ConsoleInfo struct - * lParam is a boolean parameter which specifies whether defaults should be shown - */ + /* + * CONSOLE.DLL shares information with CONSRV with wParam: + * wParam is a handle to a shared section holding a CONSOLE_PROPS struct. + * + * NOTE: lParam is not used. + */ - pConInfo = AllocConsoleInfo(); - if (!pConInfo) - { - return 0; - } + /* Allocate a local buffer to hold console information */ + pConInfo = AllocConsoleInfo(); + if (!pConInfo) return 0; - if (lParam) - { - /* Use defaults */ - InitConsoleDefaults(pConInfo); - } - else - { - if (IsBadReadPtr((const void *)pSharedInfo, sizeof(ConsoleInfo))) - { - /* Use defaults */ - InitConsoleDefaults(pConInfo); - } - else - { - pConInfo->InsertMode = pSharedInfo->InsertMode; - pConInfo->HistoryBufferSize = pSharedInfo->HistoryBufferSize; - pConInfo->NumberOfHistoryBuffers = pSharedInfo->NumberOfHistoryBuffers; - pConInfo->ScreenText = pSharedInfo->ScreenText; - pConInfo->ScreenBackground = pSharedInfo->ScreenBackground; - pConInfo->PopupText = pSharedInfo->PopupText; - pConInfo->PopupBackground = pSharedInfo->PopupBackground; - pConInfo->WindowSize = pSharedInfo->WindowSize; - pConInfo->WindowPosition = pSharedInfo->WindowPosition; - pConInfo->ScreenBuffer = pSharedInfo->ScreenBuffer; - pConInfo->UseRasterFonts = pSharedInfo->UseRasterFonts; - pConInfo->FontSize = pSharedInfo->FontSize; - pConInfo->FontWeight = pSharedInfo->FontWeight; - memcpy(pConInfo->Colors, pSharedInfo->Colors, sizeof(s_Colors)); - } - } + /* Map the shared section */ + pSharedInfo = MapViewOfFile(hSection, FILE_MAP_READ, 0, 0, 0); + if (pSharedInfo == NULL) + { + HeapFree(GetProcessHeap(), 0, pConInfo); + return 0; + } - /* console window -> is notified on a property change event */ - pConInfo->hConsoleWindow = hwnd; + // if (IsBadReadPtr((PVOID)pSharedInfo, sizeof(CONSOLE_PROPS))) + // { + // } - ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); - psh.dwSize = sizeof(PROPSHEETHEADER); - psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; - if(_tcslen(pConInfo->szProcessName)) - { - psh.dwFlags |= PSH_PROPTITLE; - psh.pszCaption = pConInfo->szProcessName; - } - else - { - if (!GetConsoleTitleW(szTitle, sizeof(szTitle)/sizeof(WCHAR))) - { - _tcscpy(szTitle, _T("cmd.exe")); - } - szTitle[(sizeof(szTitle)/sizeof(WCHAR))-1] = _T('\0'); - psh.pszCaption = szTitle; - } + /* Find the console window and whether we must use default parameters */ + pConInfo->hConsoleWindow = pSharedInfo->hConsoleWindow; + pConInfo->ShowDefaultParams = pSharedInfo->ShowDefaultParams; - psh.hwndParent = hwnd; - psh.hInstance = hApplet; - psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON)); - psh.nPages = 4; - psh.nStartPage = 0; - psh.ppsp = psp; + /* Check that we are going to modify GUI terminal information */ + GuiTermInfo = ( pSharedInfo->TerminalInfo.Size == sizeof(GUI_CONSOLE_INFO) && + pSharedInfo->TerminalInfo.TermInfo != 0 ); - InitPropSheetPage(&psp[i++], IDD_PROPPAGEOPTIONS, (DLGPROC) OptionsProc, (LPARAM)pConInfo); - InitPropSheetPage(&psp[i++], IDD_PROPPAGEFONT, (DLGPROC) FontProc, (LPARAM)pConInfo); - InitPropSheetPage(&psp[i++], IDD_PROPPAGELAYOUT, (DLGPROC) LayoutProc, (LPARAM)pConInfo); - InitPropSheetPage(&psp[i++], IDD_PROPPAGECOLORS, (DLGPROC) ColorsProc, (LPARAM)pConInfo); - - return (PropertySheet(&psh) != -1); -} - -/* Control Panel Callback */ -LONG CALLBACK -CPlApplet( - HWND hwndCPl, - UINT uMsg, - LPARAM lParam1, - LPARAM lParam2) -{ - switch(uMsg) - { - case CPL_INIT: + if (pConInfo->ShowDefaultParams || !GuiTermInfo) { - return TRUE; + /* Use defaults */ + InitConsoleDefaults(pConInfo); } - case CPL_GETCOUNT: + else { - return NUM_APPLETS; + /* + * Copy the shared data into our allocated buffer, and + * de-offsetize the address of terminal-specific information. + */ + RtlCopyMemory(pConInfo, pSharedInfo, sizeof(CONSOLE_PROPS) + sizeof(GUI_CONSOLE_INFO)); + pConInfo->TerminalInfo.TermInfo = (PVOID)((ULONG_PTR)pConInfo + (ULONG_PTR)pConInfo->TerminalInfo.TermInfo); } - case CPL_INQUIRE: + + /* Close the section */ + UnmapViewOfFile(pSharedInfo); + CloseHandle(hSection); + + /* Initialize the property sheet structure */ + ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); + psh.dwSize = sizeof(PROPSHEETHEADER); + psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | /* PSH_USEHICON | PSH_USEICONID | */ PSH_NOAPPLYNOW; + + if (pConInfo->ci.ConsoleTitle[0] != L'\0') { - CPLINFO *CPlInfo = (CPLINFO*)lParam2; - CPlInfo->idIcon = Applets[0].idIcon; - CPlInfo->idName = Applets[0].idName; - CPlInfo->idInfo = Applets[0].idDescription; - break; + wcsncpy(szTitle, L"\"", sizeof(szTitle) / sizeof(szTitle[0])); + wcsncat(szTitle, pConInfo->ci.ConsoleTitle, sizeof(szTitle) / sizeof(szTitle[0])); + wcsncat(szTitle, L"\"", sizeof(szTitle) / sizeof(szTitle[0])); } - case CPL_DBLCLK: + else { - InitApplet(hwndCPl, uMsg, lParam1, lParam2); - break; + wcscpy(szTitle, L"ReactOS Console"); } - } - return FALSE; + psh.pszCaption = szTitle; + + psh.hwndParent = pConInfo->hConsoleWindow; + psh.hInstance = hApplet; + // psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON)); + // psh.pszIcon = MAKEINTRESOURCE(IDC_CPLICON); + psh.nPages = 4; + psh.nStartPage = 0; + psh.ppsp = psp; + + InitPropSheetPage(&psp[i++], IDD_PROPPAGEOPTIONS, (DLGPROC) OptionsProc, (LPARAM)pConInfo); + InitPropSheetPage(&psp[i++], IDD_PROPPAGEFONT, (DLGPROC) FontProc, (LPARAM)pConInfo); + InitPropSheetPage(&psp[i++], IDD_PROPPAGELAYOUT, (DLGPROC) LayoutProc, (LPARAM)pConInfo); + InitPropSheetPage(&psp[i++], IDD_PROPPAGECOLORS, (DLGPROC) ColorsProc, (LPARAM)pConInfo); + + return (PropertySheet(&psh) != -1); } +/* Control Panel Callback */ +LONG CALLBACK +CPlApplet(HWND hwndCPl, + UINT uMsg, + LPARAM lParam1, + LPARAM lParam2) +{ + switch (uMsg) + { + case CPL_INIT: + return TRUE; + case CPL_EXIT: + // TODO: Free allocated memory + break; + + case CPL_GETCOUNT: + return NUM_APPLETS; + + case CPL_INQUIRE: + { + CPLINFO *CPlInfo = (CPLINFO*)lParam2; + CPlInfo->idIcon = Applets[0].idIcon; + CPlInfo->idName = Applets[0].idName; + CPlInfo->idInfo = Applets[0].idDescription; + break; + } + + case CPL_DBLCLK: + InitApplet(hwndCPl, uMsg, lParam1, lParam2); + break; + } + + return FALSE; +} + + INT WINAPI -DllMain( - HINSTANCE hinstDLL, - DWORD dwReason, - LPVOID lpvReserved) +DllMain(HINSTANCE hinstDLL, + DWORD dwReason, + LPVOID lpvReserved) { - UNREFERENCED_PARAMETER(lpvReserved); + UNREFERENCED_PARAMETER(lpvReserved); - switch(dwReason) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - hApplet = hinstDLL; - break; - } - return TRUE; + switch (dwReason) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + hApplet = hinstDLL; + break; + } + + return TRUE; } Index: dll/cpl/console/console.h =================================================================== --- dll/cpl/console/console.h (rvision 58607) +++ dll/cpl/console/console.h (copie de travail) @@ -2,7 +2,9 @@ #define CONSOLE_H__ #define WIN32_NO_STATUS -#include +#include // just for UINT_MAX in layout.c +#include + #include #include #include @@ -10,52 +12,24 @@ #include #include #include -#include -#include #include "resource.h" +/* Shared header with consrv.dll */ +#include "consolecpl.h" + typedef struct { - int idIcon; - int idName; - int idDescription; - APPLET_PROC AppletProc; + int idIcon; + int idName; + int idDescription; + APPLET_PROC AppletProc; } APPLET, *PAPPLET; -typedef struct TAGConsoleInfo -{ - HWND hConsoleWindow; - WCHAR szProcessName[MAX_PATH]; - BOOLEAN AppliedConfig; - DWORD UseRasterFonts; - DWORD FontSize; - DWORD FontWeight; - FONTSIGNATURE FontSignature; - DWORD CursorSize; - DWORD NumberOfHistoryBuffers; - DWORD HistoryBufferSize; - DWORD HistoryNoDup; - DWORD FullScreen; - DWORD QuickEdit; - DWORD InsertMode; - DWORD ScreenBuffer; - DWORD WindowSize; - DWORD WindowPosition; - DWORD ActiveStaticControl; - COLORREF ScreenText; - COLORREF ScreenBackground; - COLORREF PopupText; - COLORREF PopupBackground; - COLORREF Colors[16]; -} ConsoleInfo, *PConsoleInfo; +BOOL ApplyConsoleInfo(HWND hwndDlg, PCONSOLE_PROPS pConInfo); +VOID PaintConsole(LPDRAWITEMSTRUCT drawItem, PCONSOLE_PROPS pConInfo); +VOID PaintText(LPDRAWITEMSTRUCT drawItem, PCONSOLE_PROPS pConInfo); -void ApplyConsoleInfo(HWND hwndDlg, PConsoleInfo pConInfo); -void PaintConsole(LPDRAWITEMSTRUCT drawItem, PConsoleInfo pConInfo); -void PaintText(LPDRAWITEMSTRUCT drawItem, PConsoleInfo pConInfo); - -#define PM_APPLY_CONSOLE_INFO (WM_APP + 100) - // Globals extern HINSTANCE hApplet; Index: dll/cpl/console/console.rc =================================================================== --- dll/cpl/console/console.rc (rvision 58607) +++ dll/cpl/console/console.rc (copie de travail) @@ -17,4 +17,6 @@ #define REACTOS_STR_ORIGINAL_FILENAME "console.dll\0" #include +// IDC_CPLICON ICON DISCARDABLE "res/terminal.ico" + #include "rsrc.rc" Index: dll/cpl/console/font.c =================================================================== --- dll/cpl/console/font.c (rvision 58607) +++ dll/cpl/console/font.c (copie de travail) @@ -6,51 +6,50 @@ * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@student.tugraz.at) */ - #include "console.h" +#define NDEBUG +#include + INT_PTR CALLBACK -FontProc( - HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam -) +FontProc(HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) { - LPDRAWITEMSTRUCT drawItem; - PConsoleInfo pConInfo = (PConsoleInfo)GetWindowLongPtr(hwndDlg, DWLP_USER); + LPDRAWITEMSTRUCT drawItem; + PCONSOLE_PROPS pConInfo = (PCONSOLE_PROPS)GetWindowLongPtr(hwndDlg, DWLP_USER); - UNREFERENCED_PARAMETER(hwndDlg); - UNREFERENCED_PARAMETER(wParam); + UNREFERENCED_PARAMETER(hwndDlg); + UNREFERENCED_PARAMETER(wParam); + switch (uMsg) + { + case WM_INITDIALOG: + { + pConInfo = (PCONSOLE_PROPS)((LPPROPSHEETPAGE)lParam)->lParam; + SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo); + return TRUE; + } + case WM_DRAWITEM: + { + drawItem = (LPDRAWITEMSTRUCT)lParam; + if (drawItem->CtlID == IDC_STATIC_FONT_WINDOW_PREVIEW) + { + PaintConsole(drawItem, pConInfo); + } + else if (drawItem->CtlID == IDC_STATIC_SELECT_FONT_PREVIEW) + { + PaintText(drawItem, pConInfo); + } + return TRUE; + } + default: + { + break; + } + } - switch(uMsg) - { - case WM_INITDIALOG: - { - pConInfo = (PConsoleInfo) ((LPPROPSHEETPAGE)lParam)->lParam; - SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo); - return TRUE; - } - case WM_DRAWITEM: - { - drawItem = (LPDRAWITEMSTRUCT)lParam; - if (drawItem->CtlID == IDC_STATIC_FONT_WINDOW_PREVIEW) - { - PaintConsole(drawItem, pConInfo); - } - else if (drawItem->CtlID == IDC_STATIC_SELECT_FONT_PREVIEW) - { - PaintText(drawItem, pConInfo); - } - return TRUE; - } - default: - { - break; - } - } - - return FALSE; + return FALSE; } Index: dll/cpl/console/lang/bg-BG.rc =================================================================== --- dll/cpl/console/lang/bg-BG.rc (rvision 58607) +++ dll/cpl/console/lang/bg-BG.rc (copie de travail) @@ -12,99 +12,99 @@ IDD_PROPPAGEOPTIONS DIALOGEX 0, 0, 283, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Настройки" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 7, 7, 130, 70, WS_CHILD | WS_VISIBLE | WS_GROUP - CONTROL "&", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 20, 90, 10 - CONTROL "&", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 40, 90, 10 - CONTROL "&", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 60, 90, 10 - GROUPBOX " ", -1, 143, 7, 130, 70, WS_CHILD | WS_VISIBLE | WS_GROUP - CONTROL "&", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 152, 20, 70, 10 - CONTROL "& ", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 152, 40, 70, 10 - GROUPBOX " ", -1, 7, 84, 130, 77, WS_CHILD | WS_VISIBLE | WS_GROUP - LTEXT " &", -1, 14, 101, 70, 12 - EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 97, 12, 15 - LTEXT "& ", -1, 14, 124, 70, 12 - EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 120, 12, 15 - CHECKBOX "& ", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 120, 15 - GROUPBOX " ", -1, 143, 85, 130, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP - CHECKBOX " & ", IDC_CHECK_QUICK_EDIT, 150, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP - CHECKBOX " &", IDC_CHECK_INSERT_MODE, 150, 113, 76, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "Размер на показалеца", -1, 7, 7, 130, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Малък", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 20, 90, 10 + CONTROL "&Среден", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 40, 90, 10 + CONTROL "&Голям", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 60, 90, 10 + GROUPBOX "Настройки на екрана", -1, 143, 7, 130, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Прозорец", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 152, 20, 70, 10 + CONTROL "&Цял екран", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 152, 40, 70, 10 + GROUPBOX "Дневник на заповедите", -1, 7, 85, 130, 77, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "Размер на &буфера", -1, 14, 101, 70, 12 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 97, 12, 15 + LTEXT "&Брой буфери", -1, 14, 124, 70, 12 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 120, 12, 15 + CHECKBOX "Пре&махване на старите бройки", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 120, 15 + GROUPBOX "Промяна на настройките", -1, 143, 85, 130, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP + CHECKBOX "Режим &бърза обработка", IDC_CHECK_QUICK_EDIT, 150, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + CHECKBOX "Режим &вмъкване", IDC_CHECK_INSERT_MODE, 150, 113, 76, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_PROPPAGEFONT DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Шрифт" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", -1, 10, 10, 94, 10 - LTEXT ":", -1, 180, 10, 36, 10 + LTEXT "Прозоречен преглед:", -1, 10, 10, 94, 10 + LTEXT "Размер:", -1, 180, 10, 36, 10 CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 163, 74 LISTBOX IDC_LBOX_FONTS, 181, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL - LTEXT "&:", -1, 10, 105, 33, 10 - CHECKBOX "& ", IDC_CHECK_BOLD_FONTS, 38, 105, 85, 10 + LTEXT "&Шрифт:", -1, 10, 105, 33, 10 + CHECKBOX "&Получери шрифтове", IDC_CHECK_BOLD_FONTS, 38, 105, 85, 10 LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 40, LBS_DISABLENOSCROLL | WS_VSCROLL GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 6, 156, 241, 50 CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 16, 165, 95, 35 - LTEXT " :", -1, 124, 166, 75, 10 - LTEXT "screen pixel wide\nscreen pixel high", -1, 136, 180, 101, 20 /* */ + LTEXT "Всеки знак е:", -1, 124, 166, 75, 10 + LTEXT "screen pixel wide\nscreen pixel high", -1, 136, 180, 101, 20 /* неясно */ LTEXT "", IDC_FONT_SIZE_X, 120, 180, 10, 10 LTEXT "", IDC_FONT_SIZE_Y, 120, 188, 10, 10 END IDD_PROPPAGELAYOUT DIALOGEX 0, 0, 273, 230 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Подредба" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ", -1, 8, 6, 105, 10 + LTEXT "Прозоречен преглед", -1, 8, 6, 105, 10 CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 8, 16, 115, 70 - GROUPBOX " ", -1, 130, 12, 135, 50 - LTEXT "&:", -1, 140, 28, 40, 10 - LTEXT "&:", -1, 140, 46, 39, 10 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 25, 13, 14 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 42, 13, 14 - GROUPBOX " ", -1, 130, 65, 135, 47 - LTEXT "&&:", -1, 140, 78, 39, 10 - LTEXT "&&:", -1, 140, 95, 37, 10 - EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 75, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 92, 13, 14 - GROUPBOX " ", -1, 130, 116, 135, 64 - LTEXT "&:", -1, 140, 132, 38, 10 - LTEXT "&:", -1, 140, 149, 40, 10 - EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 128, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 146, 13, 14 - CHECKBOX " & ", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 118, 10 + GROUPBOX "Размер на екранния буфер", -1, 130, 12, 135, 50 + LTEXT "&Ширина:", -1, 140, 28, 40, 10 + LTEXT "&Височина:", -1, 140, 46, 39, 10 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 25, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 42, 13, 14 + GROUPBOX "Размер на прозореца", -1, 130, 65, 135, 47 + LTEXT "&Ш&ирина:", -1, 140, 78, 39, 10 + LTEXT "&Ви&сочина:", -1, 140, 95, 37, 10 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 75, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 92, 13, 14 + GROUPBOX "Положение на прозореца", -1, 130, 116, 135, 64 + LTEXT "От&ляво:", -1, 140, 132, 38, 10 + LTEXT "От&горе:", -1, 140, 149, 40, 10 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 128, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 146, 13, 14 + CHECKBOX "Уредбата на&мества прозореца", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 118, 10 END IDD_PROPPAGECOLORS DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Цветове" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " &", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 112, 10 - CONTROL " &", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 - CONTROL "& ", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 - CONTROL " &", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 - GROUPBOX " ", -1, 129, 7, 118, 73 - LTEXT "&:", -1, 140, 25, 48, 10 - EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 22, 12, 14 - LTEXT "&:", -1, 140, 42, 48, 10 - EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 39, 12, 14 - LTEXT "&:", -1, 140, 60, 48, 10 - EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 56, 12, 14 + CONTROL "Екранен &текст", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 112, 10 + CONTROL "Екранна под&цветка", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 + CONTROL "Из&скачащ текст", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 + CONTROL "Изскачаща под&цветка", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 + GROUPBOX "Selected Color Components", -1, 129, 7, 118, 73 + LTEXT "&Червено:", -1, 140, 25, 48, 10 + EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 22, 12, 14 + LTEXT "&Зелено:", -1, 140, 42, 48, 10 + EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 39, 12, 14 + LTEXT "&Синьо:", -1, 140, 60, 48, 10 + EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 56, 12, 14 CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 17, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 31, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 45, 90, 12, 12 @@ -121,28 +121,27 @@ CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 199, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 213, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 227, 90, 12, 12 - GROUPBOX " :", -1, 7, 111, 240, 40 + GROUPBOX "Preview (Screen)", -1, 7, 111, 240, 40 CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 124, 224, 20 - GROUPBOX " :", -1, 7, 162, 240, 40 + GROUPBOX "Preview (Popup)", -1, 7, 162, 240, 40 CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 176, 224, 20 END IDD_APPLYOPTIONS DIALOGEX 0, 0, 265, 79 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION " " +CAPTION "Прилагане на свойствата" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " & ", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 12, 207, 10 - CONTROL " ", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 31, 247, 10 - PUSHBUTTON "", IDOK, 58, 58, 50, 14, WS_VISIBLE - PUSHBUTTON "", IDCANCEL, 114, 58, 50, 14, WS_VISIBLE + CONTROL "Прилагане на свойствата само за &текущия прозорец", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 12, 207, 10 + CONTROL "Прилагане на свойствата за бъдещи прозорци със същото заглавие", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 31, 247, 10 + PUSHBUTTON "Добре", IDOK, 58, 58, 50, 14, WS_VISIBLE + PUSHBUTTON "Отказ", IDCANCEL, 114, 58, 50, 14, WS_VISIBLE END STRINGTABLE BEGIN - IDS_CPLNAME "" - IDS_CPLDESCRIPTION " ." - IDS_APPLY_SHORTCUT_ALL " &, " - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" - IDS_RASTERFONTS " " + IDS_CPLNAME "Конзола" + IDS_CPLDESCRIPTION "Настройка на конзолата." + IDS_APPLY_SHORTCUT_ALL "Промяна на &препратката, запуснала този прозорец" + IDS_RASTERFONTS "Решетъчни шрифтове" END Index: dll/cpl/console/lang/cs-CZ.rc =================================================================== --- dll/cpl/console/lang/cs-CZ.rc (rvision 58607) +++ dll/cpl/console/lang/cs-CZ.rc (copie de travail) @@ -1,4 +1,5 @@ -/* FILE: dll/cpl/console/lang/cs-CZ.rc +/* + * FILE: dll/cpl/console/lang/cs-CZ.rc * TRANSLATOR: Radek Liska aka Black_Fox (radekliska at gmail dot com) * UPDATED: 2011-03-31 */ @@ -9,45 +10,45 @@ IDD_PROPPAGEOPTIONS DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Monosti" +CAPTION "Možnosti" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Velikost kurzoru", -1, 7, 7, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP - CONTROL "&Mal", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 20, 90, 10 - CONTROL "&Stedn", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 40, 90, 10 - CONTROL "&Velk", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 60, 90, 10 - GROUPBOX "Monosti zobrazen", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Malá", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 20, 90, 10 + CONTROL "&Střední", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 40, 90, 10 + CONTROL "&Velká", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 60, 90, 10 + GROUPBOX "Možnosti zobrazení", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP CONTROL "&Okno", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 20, 70, 10 - CONTROL "&Cel obrazovka", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 - GROUPBOX "Historie pkaz", -1, 7, 84, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP - LTEXT "Velikost v&yrovnvac pamti:", -1, 14, 101, 70, 12 - EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 97, 12, 15 - LTEXT "&Poet vyrovnvacch pamt:", -1, 14, 124, 70, 12 - EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 120, 12, 15 - CHECKBOX "&Zahodit star duplikty", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 - GROUPBOX "Monosti prav", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP - CHECKBOX "Reim &rychlch prav", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP - CHECKBOX "Reim v&kldn", IDC_CHECK_INSERT_MODE, 140, 113, 76, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + CONTROL "&Celá obrazovka", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 + GROUPBOX "Historie příkazů", -1, 7, 85, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "Velikost v&yrovnávací paměti:", -1, 14, 101, 70, 12 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 97, 12, 15 + LTEXT "&Počet vyrovnávacích pamětí:", -1, 14, 124, 70, 12 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 120, 12, 15 + CHECKBOX "&Zahodit staré duplikáty", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 + GROUPBOX "Možnosti úprav", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP + CHECKBOX "Režim &rychlých úprav", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + CHECKBOX "Režim v&kládání", IDC_CHECK_INSERT_MODE, 140, 113, 76, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_PROPPAGEFONT DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Psmo" +CAPTION "Písmo" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Nhled okna:", -1, 10, 10, 94, 10 + LTEXT "Náhled okna:", -1, 10, 10, 94, 10 LTEXT "Velikost:", -1, 180, 10, 36, 10 CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 163, 74 LISTBOX IDC_LBOX_FONTS, 181, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL - LTEXT "&Psmo:", -1, 10, 105, 33, 10 - CHECKBOX "&Tun psma", IDC_CHECK_BOLD_FONTS, 56, 105, 60, 10 + LTEXT "&Písmo:", -1, 10, 105, 33, 10 + CHECKBOX "&Tučná písma", IDC_CHECK_BOLD_FONTS, 56, 105, 60, 10 LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 40, LBS_DISABLENOSCROLL | WS_VSCROLL GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 6, 156, 241, 50 CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 16, 165, 95, 35 - LTEXT "Kad znak je:", -1, 124, 166, 75, 10 - LTEXT "obrazovkovch pixel irok\nobrazovkovch pixel vysok", -1, 136, 180, 101, 20 + LTEXT "Každý znak je:", -1, 124, 166, 75, 10 + LTEXT "obrazovkových pixelů široký\nobrazovkových pixelů vysoků", -1, 136, 180, 101, 20 LTEXT "", IDC_FONT_SIZE_X, 120, 180, 10, 10 LTEXT "", IDC_FONT_SIZE_Y, 120, 188, 10, 10 END @@ -57,30 +58,30 @@ CAPTION "Vzhled" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Nhled okna:", -1, 8, 6, 95, 10 + LTEXT "Náhled okna:", -1, 8, 6, 95, 10 CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 8, 16, 115, 70 - GROUPBOX "Velikost bufferu zobrazen", -1, 130, 12, 115, 50 - LTEXT "&ka:", -1, 140, 28, 40, 10 - LTEXT "&Vka:", -1, 140, 46, 39, 10 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 25, 13, 14 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 42, 13, 14 + GROUPBOX "Velikost bufferu zobrazení", -1, 130, 12, 115, 50 + LTEXT "&Šířka:", -1, 140, 28, 40, 10 + LTEXT "&Výška:", -1, 140, 46, 39, 10 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 25, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 42, 13, 14 GROUPBOX "Velikost okna", -1, 130, 65, 115, 47 - LTEXT "&ka:", -1, 140, 78, 39, 10 - LTEXT "V&ka:", -1, 140, 95, 37, 10 - EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 75, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 92, 13, 14 - GROUPBOX "Umstn okna", -1, 130, 116, 115, 64 + LTEXT "Š&ířka:", -1, 140, 78, 39, 10 + LTEXT "V&ýška:", -1, 140, 95, 37, 10 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 75, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 92, 13, 14 + GROUPBOX "Umístění okna", -1, 130, 116, 115, 64 LTEXT "&Zleva:", -1, 140, 132, 38, 10 LTEXT "&Shora:", -1, 140, 149, 40, 10 - EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 128, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 146, 13, 14 - CHECKBOX "&Okno je umstno systmem", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 104, 10 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 128, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 146, 13, 14 + CHECKBOX "&Okno je umístěno systémem", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 104, 10 END IDD_PROPPAGECOLORS DIALOGEX 0, 0, 253, 220 @@ -88,20 +89,20 @@ CAPTION "Barvy" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "&Text zobrazen", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 112, 10 - CONTROL "Pozad zo&brazen", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 - CONTROL "Text &vbru", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 - CONTROL "Pozad v&bru", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 - GROUPBOX "Zvolen barevn hodnoty", -1, 129, 7, 118, 73 - LTEXT "e&rven:", -1, 140, 25, 48, 10 - EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 22, 12, 14 - LTEXT "Zele&n:", -1, 140, 42, 48, 10 - EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 39, 12, 14 - LTEXT "&Modr:", -1, 140, 60, 48, 10 - EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 56, 12, 14 + CONTROL "&Text zobrazení", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 112, 10 + CONTROL "Pozadí zo&brazení", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 + CONTROL "Text &výběru", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 + CONTROL "Pozadí vý&běru", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 + GROUPBOX "Selected Color Components", -1, 129, 7, 118, 73 + LTEXT "Če&rvená:", -1, 140, 25, 48, 10 + EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 22, 12, 14 + LTEXT "Zele&ná:", -1, 140, 42, 48, 10 + EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 39, 12, 14 + LTEXT "&Modrá:", -1, 140, 60, 48, 10 + EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 56, 12, 14 CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 17, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 31, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 45, 90, 12, 12 @@ -118,19 +119,19 @@ CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 199, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 213, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 227, 90, 12, 12 - GROUPBOX "Zvolen barvy zobrazen", -1, 7, 111, 240, 40 + GROUPBOX "Preview (Screen)", -1, 7, 111, 240, 40 CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 124, 224, 20 - GROUPBOX "Zvolen barvy vbru", -1, 7, 162, 240, 40 + GROUPBOX "Preview (Popup)", -1, 7, 162, 240, 40 CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 176, 224, 20 END IDD_APPLYOPTIONS DIALOGEX 0, 0, 220, 79 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION "Pout vlastnosti" +CAPTION "Použít vlastnosti" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "&Pout vlastnosti jen pro toto okno", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 12, 207, 10 - CONTROL "&Uloit vlastnosti pro kad dal budouc okno s tmto nzvem", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 31, 207, 10 + CONTROL "&Použít vlastnosti jen pro toto okno", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 12, 207, 10 + CONTROL "&Uložit vlastnosti pro každé další budoucí okno s tímto názvem", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 31, 207, 10 PUSHBUTTON "OK", IDOK, 58, 58, 50, 14, WS_VISIBLE PUSHBUTTON "Storno", IDCANCEL, 114, 58, 50, 14, WS_VISIBLE END @@ -139,7 +140,6 @@ BEGIN IDS_CPLNAME "Konzole" IDS_CPLDESCRIPTION "Nastavit vlastnosti konzole." - IDS_APPLY_SHORTCUT_ALL "Zmnit z&stupce, kter spustil toto okno" - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" - IDS_RASTERFONTS "Rastrov psma" + IDS_APPLY_SHORTCUT_ALL "Změnit zá&stupce, který spustil toto okno" + IDS_RASTERFONTS "Rastrová písma" END Index: dll/cpl/console/lang/de-DE.rc =================================================================== --- dll/cpl/console/lang/de-DE.rc (rvision 58607) +++ dll/cpl/console/lang/de-DE.rc (copie de travail) @@ -15,26 +15,24 @@ CAPTION "Optionen" FONT 8, "MS Shell Dlg" BEGIN -GROUPBOX "Cursorgre", -1, 15, 15, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -CONTROL "&Klein", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 90, 10 -CONTROL "&Mittel", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 90, 10 -CONTROL "&Gro", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 55, 90, 10 -GROUPBOX "Anzeigeeinstellungen", -1, 140, 15, 100, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -CONTROL "&Fenster", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 35, 70, 10 -CONTROL "V&ollbild", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 50, 70, 10 -GROUPBOX "Befehlsspeicher:", -1, 15, 90, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -LTEXT "&Puffergre", -1, 25, 100, 60, 15 -EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 100, 30, 15, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 100, 12, 12 -LTEXT "P&ufferanzahl:", -1, 25, 120, 80, 15 -EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 120, 12, 12 -CHECKBOX "&Alte Duplikate lschen", IDC_CHECK_DISCARD_DUPLICATES, 25, 140, 100, 15 - - -GROUPBOX "Bearbeitungsoptionen", -1, 140, 90, 100, 70, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP -CHECKBOX "&QuickEdit-Modus", IDC_CHECK_QUICK_EDIT, 150, 100, 70, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP -CHECKBOX "&Einfgemodus", IDC_CHECK_INSERT_MODE, 150, 120, 70, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "Cursorgröße", -1, 15, 15, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Klein", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 90, 10 + CONTROL "&Mittel", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 90, 10 + CONTROL "&Groß", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 55, 90, 10 + GROUPBOX "Anzeigeeinstellungen", -1, 140, 15, 100, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Fenster", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 35, 70, 10 + CONTROL "V&ollbild", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 50, 70, 10 + GROUPBOX "Befehlsspeicher:", -1, 15, 90, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "&Puffergröße", -1, 25, 100, 60, 15 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 100, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 115, 100, 12, 12 + LTEXT "P&ufferanzahl:", -1, 25, 120, 80, 15 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 115, 120, 12, 12 + CHECKBOX "&Alte Duplikate löschen", IDC_CHECK_DISCARD_DUPLICATES, 25, 140, 100, 15 + GROUPBOX "Bearbeitungsoptionen", -1, 140, 90, 100, 70, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP + CHECKBOX "&QuickEdit-Modus", IDC_CHECK_QUICK_EDIT, 150, 100, 70, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + CHECKBOX "&Einfügemodus", IDC_CHECK_INSERT_MODE, 150, 120, 70, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_PROPPAGEFONT DIALOGEX 0, 0, 250, 220 @@ -42,19 +40,19 @@ CAPTION "Schrift" FONT 8, "MS Shell Dlg" BEGIN -LTEXT "Fenstervorschau", -1, 10, 7, 65, 10 -LTEXT "Gre", -1, 130, 10, 30, 10 -CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 115, 70 -LISTBOX IDC_LBOX_FONTS, 130, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL -LTEXT "&Schrift", -1, 10, 105, 35, 10 -CHECKBOX "&Fette Schriften", IDC_CHECK_BOLD_FONTS, 45, 105, 60, 10 -LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 50, LBS_DISABLENOSCROLL | WS_VSCROLL -GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 10, 155, 200, 50 -CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 95, 35 -LTEXT "Jedes Zeichen ist:", -1, 130, 165, 75, 10 -LTEXT "Bildschirmpixe breit\nBildschirmpixel hoch", -1, 140, 180, 65, 20 -LTEXT "", IDC_FONT_SIZE_X, 125, 180, 10, 10 -LTEXT "", IDC_FONT_SIZE_Y, 125, 188, 10, 10 + LTEXT "Fenstervorschau", -1, 10, 7, 65, 10 + LTEXT "Größe", -1, 130, 10, 30, 10 + CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 115, 70 + LISTBOX IDC_LBOX_FONTS, 130, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL + LTEXT "&Schrift", -1, 10, 105, 35, 10 + CHECKBOX "&Fette Schriften", IDC_CHECK_BOLD_FONTS, 45, 105, 60, 10 + LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 50, LBS_DISABLENOSCROLL | WS_VSCROLL + GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 10, 155, 200, 50 + CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 95, 35 + LTEXT "Jedes Zeichen ist:", -1, 130, 165, 75, 10 + LTEXT "Bildschirmpixeö breit\nBildschirmpixel hoch", -1, 140, 180, 65, 20 + LTEXT "", IDC_FONT_SIZE_X, 125, 180, 10, 10 + LTEXT "", IDC_FONT_SIZE_Y, 125, 188, 10, 10 END IDD_PROPPAGELAYOUT DIALOGEX 0, 0, 250, 220 @@ -62,30 +60,30 @@ CAPTION "Layout" FONT 8, "MS Shell Dlg" BEGIN -LTEXT "Fenstervorschau", -1, 10, 7, 65, 10 -CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 10, 20, 115, 70 -GROUPBOX "Fensterpuffergre", -1, 130, 15, 115, 40 -LTEXT "&Breite:", -1, 135, 30, 25, 10 -LTEXT "&Hhe:", -1, 135, 40, 25, 10 -EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 165, 30, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 165, 40, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -GROUPBOX "Fenstergre", -1, 130, 60, 115, 40 -LTEXT "B&reite:", -1, 135, 70, 25, 10 -LTEXT "H&he:", -1, 135, 80, 25, 10 -EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 165, 70, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 165, 80, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -GROUPBOX "Fensterposition", -1, 130, 105, 115, 55 -LTEXT "&Links:", -1, 135, 120, 25, 10 -LTEXT "&Oben:", -1, 135, 130, 25, 10 -EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 165, 120, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 165, 130, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -CHECKBOX "&Automatisch", IDC_CHECK_SYSTEM_POS_WINDOW, 135, 145, 100, 10 + LTEXT "Fenstervorschau", -1, 10, 7, 65, 10 + CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 10, 20, 115, 70 + GROUPBOX "Fensterpuffergröße", -1, 130, 15, 115, 40 + LTEXT "&Breite:", -1, 135, 30, 25, 10 + LTEXT "&Höhe:", -1, 135, 40, 25, 10 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 165, 30, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 165, 40, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + GROUPBOX "Fenstergröße", -1, 130, 60, 115, 40 + LTEXT "B&reite:", -1, 135, 70, 25, 10 + LTEXT "H&öhe:", -1, 135, 80, 25, 10 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 165, 70, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 165, 80, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + GROUPBOX "Fensterposition", -1, 130, 105, 115, 55 + LTEXT "&Links:", -1, 135, 120, 25, 10 + LTEXT "&Oben:", -1, 135, 130, 25, 10 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 165, 120, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 165, 130, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + CHECKBOX "&Automatisch", IDC_CHECK_SYSTEM_POS_WINDOW, 135, 145, 100, 10 END IDD_PROPPAGECOLORS DIALOGEX 0, 0, 250, 220 @@ -93,58 +91,57 @@ CAPTION "Farben" FONT 8, "MS Shell Dlg" BEGIN -CONTROL "Fenster&text", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 15, 90, 10 -CONTROL "Fenster&hintergrund", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 25, 90, 10 -CONTROL "&Popuptext", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 35, 90, 10 -CONTROL "Pop&uphintergrund", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 45, 90, 10 -GROUPBOX "Ausgewhlte Farbwerte", -1, 120, 15, 90, 45 -LTEXT "&Rot:", -1, 125, 25, 30, 10 -EDITTEXT IDC_EDIT_COLOR_RED, 150, 25, 30, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 25, 30, 10 -LTEXT "&Grn:", -1, 125, 35, 30, 10 -EDITTEXT IDC_EDIT_COLOR_GREEN, 150, 35, 30, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 35, 30, 10 -LTEXT "&Blau:", -1, 125, 45, 30, 10 -EDITTEXT IDC_EDIT_COLOR_BLUE, 150, 45, 30, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 45, 30, 10 -CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 15, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 27, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 39, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR4, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 51, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR5, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 63, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR6, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 75, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR7, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 87, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR8, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 99, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR9, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 111, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR10, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 123, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR11, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 135, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR12, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 147, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR13, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 159, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 171, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 183, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 195, 90, 10, 10 -GROUPBOX "Ausgewhlte Fensterfarben", -1, 10, 110, 200, 40 -CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 120, 180, 20 -GROUPBOX "Ausgewhlte Popupfarben", -1, 10, 155, 200, 40 -CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 180, 20 + CONTROL "Fenster&text", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 15, 90, 10 + CONTROL "Fenster&hintergrund", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 25, 90, 10 + CONTROL "&Popuptext", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 35, 90, 10 + CONTROL "Pop&uphintergrund", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 45, 90, 10 + GROUPBOX "Selected Color Components", -1, 120, 15, 90, 45 + LTEXT "&Rot:", -1, 125, 25, 30, 10 + EDITTEXT IDC_EDIT_COLOR_RED, 150, 25, 30, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 165, 25, 30, 10 + LTEXT "&Grün:", -1, 125, 35, 30, 10 + EDITTEXT IDC_EDIT_COLOR_GREEN, 150, 35, 30, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 165, 35, 30, 10 + LTEXT "&Blau:", -1, 125, 45, 30, 10 + EDITTEXT IDC_EDIT_COLOR_BLUE, 150, 45, 30, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 165, 45, 30, 10 + CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 15, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 27, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 39, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR4, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 51, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR5, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 63, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR6, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 75, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR7, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 87, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR8, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 99, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR9, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 111, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR10, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 123, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR11, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 135, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR12, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 147, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR13, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 159, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 171, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 183, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 195, 90, 10, 10 + GROUPBOX "Fenstervorschau", -1, 10, 110, 200, 40 + CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 120, 180, 20 + GROUPBOX "Popupvorschau", -1, 10, 155, 200, 40 + CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 180, 20 END IDD_APPLYOPTIONS DIALOGEX 0, 0, 220, 100 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION "Eigenschaften bernehmen" +CAPTION "Eigenschaften übernehmen" FONT 8, "MS Shell Dlg" BEGIN -CONTROL "&Eigenschaften gelten nur fr aktuelles Fenster", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 185, 10 -CONTROL "&Eigenschaften gelten fr alle Fenster mit gleichem Titel", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 185, 10 -PUSHBUTTON "OK", IDOK, 25, 80, 40, 15, WS_VISIBLE -PUSHBUTTON "Abbrechen", IDCANCEL, 120, 80, 50, 15, WS_VISIBLE + CONTROL "&Eigenschaften gelten nur für aktuelles Fenster", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 185, 10 + CONTROL "&Eigenschaften gelten für alle Fenster mit gleichem Titel", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 185, 10 + PUSHBUTTON "OK", IDOK, 25, 80, 40, 15, WS_VISIBLE + PUSHBUTTON "Abbrechen", IDCANCEL, 120, 80, 50, 15, WS_VISIBLE END STRINGTABLE BEGIN - IDS_CPLNAME "Konsole" - IDS_CPLDESCRIPTION "Konfiguriert die Konsoleneigenschaften." - IDS_APPLY_SHORTCUT_ALL "Modifiziere die &Verknpfung, die das Fenster startete" - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" - IDS_RASTERFONTS "Rasterschriften" + IDS_CPLNAME "Konsole" + IDS_CPLDESCRIPTION "Konfiguriert die Konsoleneigenschaften." + IDS_APPLY_SHORTCUT_ALL "Modifiziere die &Verknüpfung, die das Fenster startete" + IDS_RASTERFONTS "Rasterschriften" END Index: dll/cpl/console/lang/en-US.rc =================================================================== --- dll/cpl/console/lang/en-US.rc (rvision 58607) +++ dll/cpl/console/lang/en-US.rc (copie de travail) @@ -22,13 +22,13 @@ GROUPBOX "Display Options", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP CONTROL "&Window", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 20, 70, 10 CONTROL "F&ull Screen", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 - GROUPBOX "Command History", -1, 7, 84, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP + GROUPBOX "Command History", -1, 7, 85, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP LTEXT "&Buffer Size:", -1, 14, 101, 70, 12 - EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 97, 12, 15 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 97, 12, 15 LTEXT "&Number of Buffers:", -1, 14, 124, 70, 12 - EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 120, 12, 15 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 120, 12, 15 CHECKBOX "&Discard Old Duplicates", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 GROUPBOX "Edit Options", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP CHECKBOX "&QuickEdit Mode", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP @@ -65,24 +65,24 @@ GROUPBOX "Screen Buffer Size", -1, 130, 12, 115, 50 LTEXT "&Width:", -1, 140, 28, 40, 10 LTEXT "&Height:", -1, 140, 46, 39, 10 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 25, 13, 14 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 42, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 25, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 42, 13, 14 GROUPBOX "Window Size", -1, 130, 65, 115, 47 LTEXT "&W&idth:", -1, 140, 78, 39, 10 LTEXT "&H&eight:", -1, 140, 95, 37, 10 - EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 75, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 92, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 75, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 92, 13, 14 GROUPBOX "Window Position", -1, 130, 116, 115, 64 LTEXT "&Left:", -1, 140, 132, 38, 10 LTEXT "&Top:", -1, 140, 149, 40, 10 - EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 128, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 146, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 128, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 146, 13, 14 CHECKBOX "Let system &position window", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 104, 10 END @@ -91,40 +91,40 @@ CAPTION "Colors" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "Screen &Text", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 112, 10 - CONTROL "Screen &Background", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 - CONTROL "&Popup Text", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 - CONTROL "Pop&up Background", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 - GROUPBOX "Selected Color Values", -1, 129, 7, 118, 73 - LTEXT "&Red:", -1, 140, 25, 48, 10 - EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 22, 12, 14 - LTEXT "&Green:", -1, 140, 42, 48, 10 - EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 39, 12, 14 - LTEXT "&Blue:", -1, 140, 60, 48, 10 - EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 56, 12, 14 - CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 17, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 31, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 45, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR4, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 59, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR5, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 73, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR6, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 87, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR7, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 101, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR8, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 115, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR9, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 129, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR10, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 143, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR11, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 157, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR12, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 171, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR13, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 185, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 199, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 213, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 227, 90, 12, 12 - GROUPBOX "Selected Screen Colors", -1, 7, 111, 240, 40 - CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 124, 224, 20 - GROUPBOX "Selected Popup Colors", -1, 7, 162, 240, 40 - CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 176, 224, 20 + CONTROL "Screen &Text", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 90, 10 + CONTROL "Screen &Background", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 24, 90, 10 + CONTROL "&Popup Text", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 36, 90, 10 + CONTROL "Pop&up Background", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 90, 10 + GROUPBOX "Selected Color Components", -1, 105, 6, 140, 60 + LTEXT "&Red:", -1, 135, 18, 30, 10 + EDITTEXT IDC_EDIT_COLOR_RED, 175, 16, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 210, 16, 10, 14 + LTEXT "&Green:", -1, 135, 34, 30, 10 + EDITTEXT IDC_EDIT_COLOR_GREEN, 175, 32, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 210, 32, 10, 14 + LTEXT "&Blue:", -1, 135, 50, 30, 10 + EDITTEXT IDC_EDIT_COLOR_BLUE, 175, 48, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 210, 48, 10, 14 + CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 23, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 36, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 49, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR4, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 62, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR5, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 75, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR6, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 88, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR7, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 101, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR8, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 114, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR9, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 127, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR10, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 140, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR11, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 153, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR12, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 166, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR13, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 179, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 192, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 205, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 218, 80, 12, 12 + GROUPBOX "Preview (Screen)", -1, 8, 100, 237, 55 + CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 13, 110, 227, 40 + GROUPBOX "Preview (Popup)", -1, 8, 160, 237, 55 + CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 13, 170, 227, 40 END IDD_APPLYOPTIONS DIALOGEX 0, 0, 220, 79 @@ -143,6 +143,5 @@ IDS_CPLNAME "Console" IDS_CPLDESCRIPTION "Configures console properties." IDS_APPLY_SHORTCUT_ALL "Modify &shortcut that started this window" - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" IDS_RASTERFONTS "Raster Fonts" END Index: dll/cpl/console/lang/es-ES.rc =================================================================== --- dll/cpl/console/lang/es-ES.rc (rvision 58607) +++ dll/cpl/console/lang/es-ES.rc (copie de travail) @@ -1,11 +1,8 @@ - /* - *Spanish Language resource file + * Spanish Language resource file * Javier Remacha 2007-12-01 */ - - #include LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL @@ -15,26 +12,24 @@ CAPTION "Opciones" FONT 8, "MS Shell Dlg" BEGIN -GROUPBOX "Tamao del Cursor", -1, 15, 15, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -CONTROL "&Pequeo", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 90, 10 -CONTROL "&Mediano", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 90, 10 -CONTROL "&Grande", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 55, 90, 10 -GROUPBOX "Mostrar Opciones", -1, 140, 15, 100, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -CONTROL "&Ventana", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 35, 70, 10 -CONTROL "&Pantalla Completa", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 50, 70, 10 -GROUPBOX "Historial de Comandos:", -1, 15, 90, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -LTEXT "Tamao del &Bfer", -1, 25, 100, 60, 15 -EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 100, 30, 15, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 100, 12, 12 -LTEXT "&Nmbero de Bfers:", -1, 25, 120, 80, 15 -EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 120, 12, 12 -CHECKBOX "&Descartar Viejos Duplicados", IDC_CHECK_DISCARD_DUPLICATES, 25, 140, 100, 15 - - -GROUPBOX "Editar Opciones", -1, 140, 90, 100, 70, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP -CHECKBOX "Modo &Edicin rpida", IDC_CHECK_QUICK_EDIT, 150, 100, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP -CHECKBOX "Modo &Insertar", IDC_CHECK_INSERT_MODE, 150, 120, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "Tamaño del Cursor", -1, 15, 15, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Pequeño", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 90, 10 + CONTROL "&Mediano", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 90, 10 + CONTROL "&Grande", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 55, 90, 10 + GROUPBOX "Mostrar Opciones", -1, 140, 15, 100, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Ventana", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 35, 70, 10 + CONTROL "&Pantalla Completa", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 50, 70, 10 + GROUPBOX "Historial de Comandos:", -1, 15, 90, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "Tamaño del &Búfer", -1, 25, 100, 60, 15 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 100, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 115, 100, 12, 12 + LTEXT "&Númbero de Búfers:", -1, 25, 120, 80, 15 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 115, 120, 12, 12 + CHECKBOX "&Descartar Viejos Duplicados", IDC_CHECK_DISCARD_DUPLICATES, 25, 140, 100, 15 + GROUPBOX "Editar Opciones", -1, 140, 90, 100, 70, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP + CHECKBOX "Modo &Edición rápida", IDC_CHECK_QUICK_EDIT, 150, 100, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + CHECKBOX "Modo &Insertar", IDC_CHECK_INSERT_MODE, 150, 120, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_PROPPAGEFONT DIALOGEX 0, 0, 250, 220 @@ -42,50 +37,50 @@ CAPTION "Fuente" FONT 8, "MS Shell Dlg" BEGIN -LTEXT "Ventana de Previsualizacin", -1, 10, 7, 65, 10 -LTEXT "Tamao", -1, 130, 10, 30, 10 -CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 115, 70 -LISTBOX IDC_LBOX_FONTS, 130, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL -LTEXT "&Fuente", -1, 10, 105, 35, 10 -CHECKBOX "&Negrita", IDC_CHECK_BOLD_FONTS, 45, 105, 60, 10 -LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 50, LBS_DISABLENOSCROLL | WS_VSCROLL -GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 10, 155, 200, 50 -CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 95, 35 -LTEXT "Cada caracter es:", -1, 130, 165, 75, 10 -LTEXT "anchura del pixel\naltura del pixel", -1, 140, 180, 65, 20 -LTEXT "", IDC_FONT_SIZE_X, 125, 180, 10, 10 -LTEXT "", IDC_FONT_SIZE_Y, 125, 188, 10, 10 + LTEXT "Ventana de Previsualización", -1, 10, 7, 65, 10 + LTEXT "Tamaño", -1, 130, 10, 30, 10 + CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 115, 70 + LISTBOX IDC_LBOX_FONTS, 130, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL + LTEXT "&Fuente", -1, 10, 105, 35, 10 + CHECKBOX "&Negrita", IDC_CHECK_BOLD_FONTS, 45, 105, 60, 10 + LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 50, LBS_DISABLENOSCROLL | WS_VSCROLL + GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 10, 155, 200, 50 + CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 95, 35 + LTEXT "Cada caracter es:", -1, 130, 165, 75, 10 + LTEXT "anchura del pixel\naltura del pixel", -1, 140, 180, 65, 20 + LTEXT "", IDC_FONT_SIZE_X, 125, 180, 10, 10 + LTEXT "", IDC_FONT_SIZE_Y, 125, 188, 10, 10 END IDD_PROPPAGELAYOUT DIALOGEX 0, 0, 250, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Disposicin" +CAPTION "Disposición" FONT 8, "MS Shell Dlg" BEGIN -LTEXT "Ventana de Previsualizacin", -1, 10, 7, 65, 10 -CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 10, 20, 115, 70 -GROUPBOX "Tamao del Bfer de Pantalla", -1, 130, 15, 115, 40 -LTEXT "&Anchura:", -1, 135, 30, 25, 10 -LTEXT "A<ura:", -1, 135, 40, 25, 10 -EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 165, 30, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 165, 40, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -GROUPBOX "Tamao de la Ventana", -1, 130, 60, 115, 40 -LTEXT "&A&nchura:", -1, 135, 70, 25, 10 -LTEXT "A&l&tura:", -1, 135, 80, 25, 10 -EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 165, 70, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 165, 80, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -GROUPBOX "Posicin de la Ventana", -1, 130, 105, 115, 55 -LTEXT "&Izquierda:", -1, 135, 120, 25, 10 -LTEXT "&Arriba:", -1, 135, 130, 25, 10 -EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 165, 120, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 165, 130, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -CHECKBOX "Deje la &posicin de ventana del sistema", IDC_CHECK_SYSTEM_POS_WINDOW, 135, 145, 100, 10 + LTEXT "Ventana de Previsualización", -1, 10, 7, 65, 10 + CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 10, 20, 115, 70 + GROUPBOX "Tamaño del Búfer de Pantalla", -1, 130, 15, 115, 40 + LTEXT "&Anchura:", -1, 135, 30, 25, 10 + LTEXT "A<ura:", -1, 135, 40, 25, 10 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 165, 30, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 165, 40, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + GROUPBOX "Tamaño de la Ventana", -1, 130, 60, 115, 40 + LTEXT "&A&nchura:", -1, 135, 70, 25, 10 + LTEXT "A&l&tura:", -1, 135, 80, 25, 10 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 165, 70, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 165, 80, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + GROUPBOX "Posición de la Ventana", -1, 130, 105, 115, 55 + LTEXT "&Izquierda:", -1, 135, 120, 25, 10 + LTEXT "&Arriba:", -1, 135, 130, 25, 10 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 165, 120, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 165, 130, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + CHECKBOX "Deje la &posición de ventana del sistema", IDC_CHECK_SYSTEM_POS_WINDOW, 135, 145, 100, 10 END IDD_PROPPAGECOLORS DIALOGEX 0, 0, 250, 220 @@ -93,40 +88,40 @@ CAPTION "Colores" FONT 8, "MS Shell Dlg" BEGIN -CONTROL "&Texto Pantalla", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 15, 90, 10 -CONTROL "&Fondo Pantalla", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 25, 90, 10 -CONTROL "Texto &Emergente", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 35, 90, 10 -CONTROL "Fondo E&mergente", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 45, 90, 10 -GROUPBOX "Valores de Color Seleccionados", -1, 120, 15, 90, 45 -LTEXT "&Rojo:", -1, 125, 25, 30, 10 -EDITTEXT IDC_EDIT_COLOR_RED, 150, 25, 30, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 25, 30, 10 -LTEXT "&Verde:", -1, 125, 35, 30, 10 -EDITTEXT IDC_EDIT_COLOR_GREEN, 150, 35, 30, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 35, 30, 10 -LTEXT "&Azul:", -1, 125, 45, 30, 10 -EDITTEXT IDC_EDIT_COLOR_BLUE, 150, 45, 30, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 45, 30, 10 -CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 15, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 27, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 39, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR4, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 51, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR5, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 63, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR6, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 75, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR7, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 87, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR8, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 99, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR9, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 111, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR10, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 123, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR11, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 135, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR12, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 147, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR13, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 159, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 171, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 183, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 195, 90, 10, 10 -GROUPBOX "Colores de Pantalla Seleccionados", -1, 10, 110, 200, 40 -CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 120, 180, 20 -GROUPBOX "Colores Emergentes Seleccionados", -1, 10, 155, 200, 40 -CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 180, 20 + CONTROL "&Texto Pantalla", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 15, 90, 10 + CONTROL "&Fondo Pantalla", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 25, 90, 10 + CONTROL "Texto &Emergente", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 35, 90, 10 + CONTROL "Fondo E&mergente", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 45, 90, 10 + GROUPBOX "Componentes de Color Seleccionados", -1, 120, 15, 90, 45 + LTEXT "&Rojo:", -1, 125, 25, 30, 10 + EDITTEXT IDC_EDIT_COLOR_RED, 150, 25, 30, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 165, 25, 30, 10 + LTEXT "&Verde:", -1, 125, 35, 30, 10 + EDITTEXT IDC_EDIT_COLOR_GREEN, 150, 35, 30, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 165, 35, 30, 10 + LTEXT "&Azul:", -1, 125, 45, 30, 10 + EDITTEXT IDC_EDIT_COLOR_BLUE, 150, 45, 30, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 165, 45, 30, 10 + CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 15, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 27, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 39, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR4, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 51, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR5, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 63, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR6, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 75, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR7, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 87, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR8, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 99, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR9, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 111, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR10, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 123, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR11, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 135, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR12, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 147, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR13, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 159, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 171, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 183, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 195, 90, 10, 10 + GROUPBOX "Previsualización (Pantalla)", -1, 10, 110, 200, 40 + CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 120, 180, 20 + GROUPBOX "Previsualización (Emergente)", -1, 10, 155, 200, 40 + CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 180, 20 END IDD_APPLYOPTIONS DIALOGEX 0, 0, 220, 100 @@ -134,17 +129,16 @@ CAPTION "Aplicar Propiedades" FONT 8, "MS Shell Dlg" BEGIN -CONTROL "&Aplicar propiedades slo a la ventana actual", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 150, 10 -CONTROL "&Guardar propiedades para futuras ventanas con el mismo ttulo", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 185, 10 -PUSHBUTTON "Aceptar", IDOK, 25, 80, 40, 15, WS_VISIBLE -PUSHBUTTON "Cancelar", IDCANCEL, 120, 80, 50, 15, WS_VISIBLE + CONTROL "&Aplicar propiedades sólo a la ventana actual", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 150, 10 + CONTROL "&Guardar propiedades para futuras ventanas con el mismo título", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 185, 10 + PUSHBUTTON "Aceptar", IDOK, 25, 80, 40, 15, WS_VISIBLE + PUSHBUTTON "Cancelar", IDCANCEL, 120, 80, 50, 15, WS_VISIBLE END STRINGTABLE BEGIN - IDS_CPLNAME "Consola" - IDS_CPLDESCRIPTION "Configurar propiedades de la consola." - IDS_APPLY_SHORTCUT_ALL "Modificar &atajo que comienza esta ventana" - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" - IDS_RASTERFONTS "Fuentes Raster" + IDS_CPLNAME "Consola" + IDS_CPLDESCRIPTION "Configurar propiedades de la consola." + IDS_APPLY_SHORTCUT_ALL "Modificar &atajo que comienza esta ventana" + IDS_RASTERFONTS "Fuentes Raster" END Index: dll/cpl/console/lang/fr-FR.rc =================================================================== --- dll/cpl/console/lang/fr-FR.rc (rvision 58607) +++ dll/cpl/console/lang/fr-FR.rc (copie de travail) @@ -22,14 +22,14 @@ GROUPBOX "Options d'affichage", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP CONTROL "&Fenêtre", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 20, 70, 10 CONTROL "P&lein écran", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 - GROUPBOX "Historique des commandes", -1, 7, 84, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP + GROUPBOX "Historique des commandes", -1, 7, 85, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP LTEXT "Taille du &buffer :", -1, 14, 101, 70, 12 - EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 97, 12, 15 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 97, 12, 15 LTEXT "&Nombre de buffers :", -1, 14, 124, 70, 12 - EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 120, 12, 15 - CHECKBOX "&Se débarrasser des vielles copies", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 120, 12, 15 + CHECKBOX "&Supprimer les doublons", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 GROUPBOX "Options d'édition", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP CHECKBOX "M&ode d'édition rapide", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP CHECKBOX "Mode &insertion", IDC_CHECK_INSERT_MODE, 140, 113, 76, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP @@ -65,25 +65,25 @@ GROUPBOX "Taille du buffer de l'écran", -1, 130, 12, 115, 50 LTEXT "&Largeur :", -1, 140, 28, 40, 10 LTEXT "&Hauteur :", -1, 140, 46, 39, 10 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 25, 13, 14 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 42, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 25, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 42, 13, 14 GROUPBOX "Taille de la fenêtre", -1, 130, 65, 115, 47 - LTEXT "&L&argeur :", -1, 140, 78, 39, 10 - LTEXT "&H&auteur :", -1, 140, 95, 37, 10 - EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 75, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 92, 13, 14 + LTEXT "L&argeur :", -1, 140, 78, 39, 10 + LTEXT "Ha&uteur :", -1, 140, 95, 37, 10 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 75, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 92, 13, 14 GROUPBOX "Position de la Fenêtre", -1, 130, 116, 115, 64 LTEXT "&Gauche :", -1, 140, 132, 38, 10 LTEXT "&En haut :", -1, 140, 149, 40, 10 - EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 128, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 146, 13, 14 - CHECKBOX "Laisser le système &positionner la fenêtre", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 104, 10 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 128, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 146, 13, 14 + CHECKBOX "&Positionnée par le système", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 104, 10 END IDD_PROPPAGECOLORS DIALOGEX 0, 0, 253, 220 @@ -91,40 +91,40 @@ CAPTION "Couleurs" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "&Texte à l'écran", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 112, 10 - CONTROL "Fond de l'&écran", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 - CONTROL "Texte du &popup", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 - CONTROL "Fond du Pop&up", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 - GROUPBOX "Valeurs de couleur séléctionnées", -1, 129, 7, 118, 73 - LTEXT "&Rouge :", -1, 140, 25, 48, 10 - EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 22, 12, 14 - LTEXT "&Vert :", -1, 140, 42, 48, 10 - EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 39, 12, 14 - LTEXT "&Bleu :", -1, 140, 60, 48, 10 - EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 56, 12, 14 - CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 17, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 31, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 45, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR4, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 59, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR5, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 73, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR6, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 87, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR7, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 101, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR8, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 115, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR9, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 129, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR10, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 143, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR11, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 157, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR12, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 171, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR13, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 185, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 199, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 213, 90, 12, 12 - CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 227, 90, 12, 12 - GROUPBOX "Couleurs de l'écran sélectionneés", -1, 7, 111, 240, 40 - CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 124, 224, 20 - GROUPBOX "Couleurs du popup sélectionneés", -1, 7, 162, 240, 40 - CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 176, 224, 20 + CONTROL "&Texte (Écran)", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 90, 10 + CONTROL "Arr&ière-plan (Écran)", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 24, 90, 10 + CONTROL "T&exte (Popup)", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 36, 90, 10 + CONTROL "Arrière-pla&n (Popup)", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 90, 10 + GROUPBOX "Composantes de la couleur sélectionnée", -1, 105, 6, 140, 60 + LTEXT "&Rouge :", -1, 135, 18, 30, 10 + EDITTEXT IDC_EDIT_COLOR_RED, 175, 16, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 210, 16, 10, 14 + LTEXT "&Vert :", -1, 135, 34, 30, 10 + EDITTEXT IDC_EDIT_COLOR_GREEN, 175, 32, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 210, 32, 10, 14 + LTEXT "&Bleu :", -1, 135, 50, 30, 10 + EDITTEXT IDC_EDIT_COLOR_BLUE, 175, 48, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 210, 48, 10, 14 + CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 23, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 36, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 49, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR4, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 62, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR5, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 75, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR6, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 88, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR7, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 101, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR8, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 114, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR9, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 127, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR10, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 140, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR11, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 153, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR12, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 166, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR13, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 179, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 192, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 205, 80, 12, 12 + CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 218, 80, 12, 12 + GROUPBOX "Aperçu (Écran)", -1, 8, 100, 237, 55 + CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 13, 110, 227, 40 + GROUPBOX "Aperçu (Popup)", -1, 8, 160, 237, 55 + CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 13, 170, 227, 40 END IDD_APPLYOPTIONS DIALOGEX 0, 0, 220, 79 @@ -143,6 +143,5 @@ IDS_CPLNAME "Console" IDS_CPLDESCRIPTION "Configurer les propriétés de la console." IDS_APPLY_SHORTCUT_ALL "Modify &shortcut that started this window" - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" IDS_RASTERFONTS "Polices Raster" END Index: dll/cpl/console/lang/he-IL.rc =================================================================== --- dll/cpl/console/lang/he-IL.rc (rvision 58607) +++ dll/cpl/console/lang/he-IL.rc (copie de travail) @@ -23,13 +23,13 @@ GROUPBOX "אפשרויות תצוגה", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP CONTROL "חלון", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 20, 70, 10 CONTROL "מסך מלא", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 - GROUPBOX "היסטוריית פקודות:", -1, 7, 84, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP + GROUPBOX "היסטוריית פקודות:", -1, 7, 85, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP LTEXT "גודל מתווך:", -1, 14, 101, 70, 12 - EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 97, 12, 15 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 97, 12, 15 LTEXT "מספר המתווכים:", -1, 14, 124, 70, 12 - EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 120, 12, 15 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 120, 12, 15 CHECKBOX "&Discard Old Duplicates", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 GROUPBOX "אפשרויות עריכה", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP CHECKBOX "&QuickEdit Mode", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP @@ -66,24 +66,24 @@ GROUPBOX "גודל מתווך המסך", -1, 130, 12, 115, 50 LTEXT "רוחב:", -1, 140, 28, 40, 10 LTEXT "גובה:", -1, 140, 46, 39, 10 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 25, 13, 14 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 42, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 25, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 42, 13, 14 GROUPBOX "גודל חלון", -1, 130, 65, 115, 47 LTEXT "רוחב:", -1, 140, 78, 39, 10 LTEXT "גובה:", -1, 140, 95, 37, 10 - EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 75, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 92, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 75, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 92, 13, 14 GROUPBOX "מיקום החלון", -1, 130, 116, 115, 64 LTEXT "שמאל:", -1, 140, 132, 38, 10 LTEXT "עליון:", -1, 140, 149, 40, 10 - EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 128, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 146, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 128, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 146, 13, 14 CHECKBOX "תן למערכת למקם את החלון.", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 104, 10 END @@ -92,20 +92,20 @@ CAPTION "צבעים" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "טקסט של המסך", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 112, 10 - CONTROL "רקע מסך", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 - CONTROL "טקסט של חלון קופץ", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 - CONTROL "רקע של חלון קופץ", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 - GROUPBOX "ערכי הצבעים הנבחרים", -1, 129, 7, 118, 73 + CONTROL "Screen &Text", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 112, 10 + CONTROL "Screen &Background", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 + CONTROL "&Popup Text", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 + CONTROL "Pop&up Background", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 + GROUPBOX "Selected Color Components", -1, 129, 7, 118, 73 LTEXT "אדום:", -1, 140, 25, 48, 10 - EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 22, 12, 14 + EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 22, 12, 14 LTEXT "ירוק:", -1, 140, 42, 48, 10 - EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 39, 12, 14 + EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 39, 12, 14 LTEXT "כחול:", -1, 140, 60, 48, 10 - EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 56, 12, 14 + EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 56, 12, 14 CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 17, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 31, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 45, 90, 12, 12 @@ -122,9 +122,9 @@ CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 199, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 213, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 227, 90, 12, 12 - GROUPBOX "צבעי מסך נבחרים", -1, 7, 111, 240, 40 + GROUPBOX "Preview (Screen)", -1, 7, 111, 240, 40 CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 124, 224, 20 - GROUPBOX "צבעי חלונות קופצים נבחרים", -1, 7, 162, 240, 40 + GROUPBOX "Preview (Popup)", -1, 7, 162, 240, 40 CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 176, 224, 20 END @@ -144,6 +144,5 @@ IDS_CPLNAME "שורת הפקודה" IDS_CPLDESCRIPTION "Configures console properties." IDS_APPLY_SHORTCUT_ALL "Modify &shortcut that started this window" - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" IDS_RASTERFONTS "גופני מפת סיביות" END Index: dll/cpl/console/lang/id-ID.rc =================================================================== --- dll/cpl/console/lang/id-ID.rc (rvision 58607) +++ dll/cpl/console/lang/id-ID.rc (copie de travail) @@ -15,26 +15,24 @@ CAPTION "Opsi" FONT 8, "MS Shell Dlg" BEGIN -GROUPBOX "Ukuran kursor", -1, 15, 15, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -CONTROL "&Kecil", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 90, 10 -CONTROL "&Medium", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 90, 10 -CONTROL "&Besar", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 55, 90, 10 -GROUPBOX "Opsi Tampilan", -1, 140, 15, 100, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -CONTROL "&Jendela", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 35, 70, 10 -CONTROL "Layar Pen&uh", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 50, 70, 10 -GROUPBOX "Histori Perintah:", -1, 15, 90, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -LTEXT "Ukuran Bu&fer", -1, 25, 100, 60, 15 -EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 100, 30, 15, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 100, 12, 12 -LTEXT "Ju&mlah Bufer:", -1, 25, 120, 80, 15 -EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 120, 12, 12 -CHECKBOX "Abaikan &Duplikasi Lama", IDC_CHECK_DISCARD_DUPLICATES, 25, 140, 100, 15 - - -GROUPBOX "Opsi Edit", -1, 140, 90, 100, 70, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP -CHECKBOX "Mode Edit&Cepat", IDC_CHECK_QUICK_EDIT, 150, 100, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP -CHECKBOX "Mode S&isip", IDC_CHECK_INSERT_MODE, 150, 120, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "Ukuran kursor", -1, 15, 15, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Kecil", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 90, 10 + CONTROL "&Medium", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 90, 10 + CONTROL "&Besar", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 55, 90, 10 + GROUPBOX "Opsi Tampilan", -1, 140, 15, 100, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Jendela", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 35, 70, 10 + CONTROL "Layar Pen&uh", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 50, 70, 10 + GROUPBOX "Histori Perintah:", -1, 15, 90, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "Ukuran Bu&fer", -1, 25, 100, 60, 15 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 100, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 115, 100, 12, 12 + LTEXT "Ju&mlah Bufer:", -1, 25, 120, 80, 15 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 115, 120, 12, 12 + CHECKBOX "Abaikan &Duplikasi Lama", IDC_CHECK_DISCARD_DUPLICATES, 25, 140, 100, 15 + GROUPBOX "Opsi Edit", -1, 140, 90, 100, 70, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP + CHECKBOX "Mode Edit&Cepat", IDC_CHECK_QUICK_EDIT, 150, 100, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + CHECKBOX "Mode S&isip", IDC_CHECK_INSERT_MODE, 150, 120, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_PROPPAGEFONT DIALOGEX 0, 0, 250, 220 @@ -42,19 +40,19 @@ CAPTION "Font" FONT 8, "MS Shell Dlg" BEGIN -LTEXT "Tinjauan Jendela", -1, 10, 7, 65, 10 -LTEXT "Ukuran", -1, 130, 10, 30, 10 -CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 115, 70 -LISTBOX IDC_LBOX_FONTS, 130, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL -LTEXT "&Font", -1, 10, 105, 35, 10 -CHECKBOX "Font &tebal", IDC_CHECK_BOLD_FONTS, 45, 105, 60, 10 -LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 50, LBS_DISABLENOSCROLL | WS_VSCROLL -GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 10, 155, 200, 50 -CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 95, 35 -LTEXT "Setiap karakter adalah:", -1, 130, 165, 75, 10 -LTEXT "lebar pixel layar\ntinggi pixel layar", -1, 140, 180, 65, 20 -LTEXT "", IDC_FONT_SIZE_X, 125, 180, 10, 10 -LTEXT "", IDC_FONT_SIZE_Y, 125, 188, 10, 10 + LTEXT "Tinjauan Jendela", -1, 10, 7, 65, 10 + LTEXT "Ukuran", -1, 130, 10, 30, 10 + CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 115, 70 + LISTBOX IDC_LBOX_FONTS, 130, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL + LTEXT "&Font", -1, 10, 105, 35, 10 + CHECKBOX "Font &tebal", IDC_CHECK_BOLD_FONTS, 45, 105, 60, 10 + LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 50, LBS_DISABLENOSCROLL | WS_VSCROLL + GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 10, 155, 200, 50 + CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 95, 35 + LTEXT "Setiap karakter adalah:", -1, 130, 165, 75, 10 + LTEXT "lebar pixel layar\ntinggi pixel layar", -1, 140, 180, 65, 20 + LTEXT "", IDC_FONT_SIZE_X, 125, 180, 10, 10 + LTEXT "", IDC_FONT_SIZE_Y, 125, 188, 10, 10 END IDD_PROPPAGELAYOUT DIALOGEX 0, 0, 250, 220 @@ -62,30 +60,30 @@ CAPTION "Tata Letak" FONT 8, "MS Shell Dlg" BEGIN -LTEXT "Tinjauan Jendela", -1, 10, 7, 65, 10 -CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 10, 20, 115, 70 -GROUPBOX "Ukuran Bufer Layar", -1, 130, 15, 115, 40 -LTEXT "&Panjang:", -1, 135, 30, 25, 10 -LTEXT "&Tinggi:", -1, 135, 40, 25, 10 -EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 165, 30, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 165, 40, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -GROUPBOX "Ukuran Jendela", -1, 130, 60, 115, 40 -LTEXT "P&anjang:", -1, 135, 70, 25, 10 -LTEXT "T&inggi:", -1, 135, 80, 25, 10 -EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 165, 70, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 165, 80, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -GROUPBOX "Posisi Jendela", -1, 130, 105, 115, 55 -LTEXT "&Kiri:", -1, 135, 120, 25, 10 -LTEXT "&Atas:", -1, 135, 130, 25, 10 -EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 165, 120, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 165, 130, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -CHECKBOX "Biarkan jendela &posisi sistem", IDC_CHECK_SYSTEM_POS_WINDOW, 135, 145, 100, 10 + LTEXT "Tinjauan Jendela", -1, 10, 7, 65, 10 + CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 10, 20, 115, 70 + GROUPBOX "Ukuran Bufer Layar", -1, 130, 15, 115, 40 + LTEXT "&Panjang:", -1, 135, 30, 25, 10 + LTEXT "&Tinggi:", -1, 135, 40, 25, 10 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 165, 30, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 165, 40, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + GROUPBOX "Ukuran Jendela", -1, 130, 60, 115, 40 + LTEXT "P&anjang:", -1, 135, 70, 25, 10 + LTEXT "T&inggi:", -1, 135, 80, 25, 10 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 165, 70, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 165, 80, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + GROUPBOX "Posisi Jendela", -1, 130, 105, 115, 55 + LTEXT "&Kiri:", -1, 135, 120, 25, 10 + LTEXT "&Atas:", -1, 135, 130, 25, 10 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 165, 120, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 165, 130, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + CHECKBOX "Biarkan jendela &posisi sistem", IDC_CHECK_SYSTEM_POS_WINDOW, 135, 145, 100, 10 END IDD_PROPPAGECOLORS DIALOGEX 0, 0, 250, 220 @@ -93,40 +91,40 @@ CAPTION "Warna" FONT 8, "MS Shell Dlg" BEGIN -CONTROL "&Teks Layar", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 15, 90, 10 -CONTROL "Latar &Belakang Layar", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 25, 90, 10 -CONTROL "Teks &Popup", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 35, 90, 10 -CONTROL "Latar Belakang Pop&up", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 45, 90, 10 -GROUPBOX "Nilai Warna Dipilih", -1, 120, 15, 90, 45 -LTEXT "&Merah:", -1, 125, 25, 30, 10 -EDITTEXT IDC_EDIT_COLOR_RED, 150, 25, 30, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 25, 30, 10 -LTEXT "&Hijau:", -1, 125, 35, 30, 10 -EDITTEXT IDC_EDIT_COLOR_GREEN, 150, 35, 30, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 35, 30, 10 -LTEXT "&Biru:", -1, 125, 45, 30, 10 -EDITTEXT IDC_EDIT_COLOR_BLUE, 150, 45, 30, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 45, 30, 10 -CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 15, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 27, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 39, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR4, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 51, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR5, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 63, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR6, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 75, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR7, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 87, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR8, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 99, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR9, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 111, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR10, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 123, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR11, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 135, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR12, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 147, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR13, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 159, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 171, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 183, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 195, 90, 10, 10 -GROUPBOX "Warna Layar Dipilih", -1, 10, 110, 200, 40 -CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 120, 180, 20 -GROUPBOX "Warna Popup Dipilih", -1, 10, 155, 200, 40 -CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 180, 20 + CONTROL "Screen &Text", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 15, 90, 10 + CONTROL "Screen &Background", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 25, 90, 10 + CONTROL "&Popup Text", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 35, 90, 10 + CONTROL "Pop&up Background", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 45, 90, 10 + GROUPBOX "Selected Color Components", -1, 120, 15, 90, 45 + LTEXT "&Merah:", -1, 125, 25, 30, 10 + EDITTEXT IDC_EDIT_COLOR_RED, 150, 25, 30, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 165, 25, 30, 10 + LTEXT "&Hijau:", -1, 125, 35, 30, 10 + EDITTEXT IDC_EDIT_COLOR_GREEN, 150, 35, 30, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 165, 35, 30, 10 + LTEXT "&Biru:", -1, 125, 45, 30, 10 + EDITTEXT IDC_EDIT_COLOR_BLUE, 150, 45, 30, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 165, 45, 30, 10 + CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 15, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 27, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 39, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR4, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 51, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR5, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 63, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR6, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 75, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR7, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 87, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR8, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 99, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR9, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 111, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR10, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 123, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR11, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 135, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR12, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 147, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR13, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 159, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 171, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 183, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 195, 90, 10, 10 + GROUPBOX "Preview (Screen)", -1, 10, 110, 200, 40 + CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 120, 180, 20 + GROUPBOX "Preview (Popup)", -1, 10, 155, 200, 40 + CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 180, 20 END IDD_APPLYOPTIONS DIALOGEX 0, 0, 220, 100 @@ -134,17 +132,16 @@ CAPTION "Terapkan Properti" FONT 8, "MS Shell Dlg" BEGIN -CONTROL "Ter&apkan Properti hanya ke jendela saat ini", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 150, 10 -CONTROL "&Simpan Properti untuk jendela nanti dengan judul sama", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 185, 10 -PUSHBUTTON "OK", IDOK, 25, 80, 40, 15, WS_VISIBLE -PUSHBUTTON "Batal", IDCANCEL, 120, 80, 50, 15, WS_VISIBLE + CONTROL "Ter&apkan Properti hanya ke jendela saat ini", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 150, 10 + CONTROL "&Simpan Properti untuk jendela nanti dengan judul sama", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 185, 10 + PUSHBUTTON "OK", IDOK, 25, 80, 40, 15, WS_VISIBLE + PUSHBUTTON "Batal", IDCANCEL, 120, 80, 50, 15, WS_VISIBLE END STRINGTABLE BEGIN - IDS_CPLNAME "Konsol" - IDS_CPLDESCRIPTION "Konfigurasi properti konsol." - IDS_APPLY_SHORTCUT_ALL "Modifikasi &jalan pintas yang memulai jendela ini" - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" - IDS_RASTERFONTS "Font Raster" + IDS_CPLNAME "Konsol" + IDS_CPLDESCRIPTION "Konfigurasi properti konsol." + IDS_APPLY_SHORTCUT_ALL "Modifikasi &jalan pintas yang memulai jendela ini" + IDS_RASTERFONTS "Font Raster" END Index: dll/cpl/console/lang/it-IT.rc =================================================================== --- dll/cpl/console/lang/it-IT.rc (rvision 58607) +++ dll/cpl/console/lang/it-IT.rc (copie de travail) @@ -15,26 +15,24 @@ CAPTION "Opzioni" FONT 8, "MS Shell Dlg" BEGIN -GROUPBOX "Dimensione del cursore", -1, 15, 15, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -CONTROL "&Piccolo", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 90, 10 -CONTROL "&Medio", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 90, 10 -CONTROL "&Largo", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 55, 90, 10 -GROUPBOX "Opzioni dello schermo", -1, 140, 15, 100, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -CONTROL "&Finestra", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 35, 70, 10 -CONTROL "&Tutto lo schermo", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 50, 70, 10 -GROUPBOX "Storia dei comandi:", -1, 15, 90, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -LTEXT "&Dimensione della memoria di appoggio", -1, 25, 100, 60, 15 -EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 100, 30, 15, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 100, 12, 12 -LTEXT "&Numerosit:", -1, 25, 120, 80, 15 -EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 120, 12, 12 -CHECKBOX "&Rimuovere i vecchi duplicati", IDC_CHECK_DISCARD_DUPLICATES, 25, 140, 100, 15 - - -GROUPBOX "Opzioni di modifica", -1, 140, 90, 100, 70, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP -CHECKBOX "Modalit &Modifica rapida", IDC_CHECK_QUICK_EDIT, 150, 100, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP -CHECKBOX "Modalit &Inserimento", IDC_CHECK_INSERT_MODE, 150, 120, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "Dimensione del cursore", -1, 15, 15, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Piccolo", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 90, 10 + CONTROL "&Medio", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 90, 10 + CONTROL "&Largo", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 55, 90, 10 + GROUPBOX "Opzioni dello schermo", -1, 140, 15, 100, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Finestra", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 35, 70, 10 + CONTROL "&Tutto lo schermo", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 50, 70, 10 + GROUPBOX "Storia dei comandi:", -1, 15, 90, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "&Dimensione della memoria di appoggio", -1, 25, 100, 60, 15 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 100, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 115, 100, 12, 12 + LTEXT "&Numerosità:", -1, 25, 120, 80, 15 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 115, 120, 12, 12 + CHECKBOX "&Rimuovere i vecchi duplicati", IDC_CHECK_DISCARD_DUPLICATES, 25, 140, 100, 15 + GROUPBOX "Opzioni di modifica", -1, 140, 90, 100, 70, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP + CHECKBOX "Modalità &Modifica rapida", IDC_CHECK_QUICK_EDIT, 150, 100, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + CHECKBOX "Modalità &Inserimento", IDC_CHECK_INSERT_MODE, 150, 120, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_PROPPAGEFONT DIALOGEX 0, 0, 250, 220 @@ -42,19 +40,19 @@ CAPTION "Font" FONT 8, "MS Shell Dlg" BEGIN -LTEXT "Anteprima", -1, 10, 7, 65, 10 -LTEXT "Dimansione", -1, 130, 10, 30, 10 -CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 115, 70 -LISTBOX IDC_LBOX_FONTS, 130, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL -LTEXT "&Font", -1, 10, 105, 35, 10 -CHECKBOX "&Grassetto fonts", IDC_CHECK_BOLD_FONTS, 45, 105, 60, 10 -LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 50, LBS_DISABLENOSCROLL | WS_VSCROLL -GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 10, 155, 200, 50 -CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 95, 35 -LTEXT "Ogni carattere :", -1, 130, 165, 75, 10 -LTEXT "larghezza in pixel\naltezza in pixel", -1, 140, 180, 65, 20 -LTEXT "", IDC_FONT_SIZE_X, 125, 180, 10, 10 -LTEXT "", IDC_FONT_SIZE_Y, 125, 188, 10, 10 + LTEXT "Anteprima", -1, 10, 7, 65, 10 + LTEXT "Dimansione", -1, 130, 10, 30, 10 + CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 115, 70 + LISTBOX IDC_LBOX_FONTS, 130, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL + LTEXT "&Font", -1, 10, 105, 35, 10 + CHECKBOX "&Grassetto fonts", IDC_CHECK_BOLD_FONTS, 45, 105, 60, 10 + LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 50, LBS_DISABLENOSCROLL | WS_VSCROLL + GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 10, 155, 200, 50 + CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 95, 35 + LTEXT "Ogni carattere è:", -1, 130, 165, 75, 10 + LTEXT "larghezza in pixel\naltezza in pixel", -1, 140, 180, 65, 20 + LTEXT "", IDC_FONT_SIZE_X, 125, 180, 10, 10 + LTEXT "", IDC_FONT_SIZE_Y, 125, 188, 10, 10 END IDD_PROPPAGELAYOUT DIALOGEX 0, 0, 250, 220 @@ -62,30 +60,30 @@ CAPTION "Layout" FONT 8, "MS Shell Dlg" BEGIN -LTEXT "Anteprima", -1, 10, 7, 65, 10 -CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 10, 20, 115, 70 -GROUPBOX "Dimensione del buffer dello schermo", -1, 130, 15, 115, 40 -LTEXT "&Larghezza:", -1, 135, 30, 25, 10 -LTEXT "&Altezza:", -1, 135, 40, 25, 10 -EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 165, 30, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 165, 40, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -GROUPBOX "Dimensione della finestra", -1, 130, 60, 115, 40 -LTEXT "&L&arghezza:", -1, 135, 70, 25, 10 -LTEXT "&A<ezza:", -1, 135, 80, 25, 10 -EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 165, 70, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 165, 80, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -GROUPBOX "Posizione della finestra", -1, 130, 105, 115, 55 -LTEXT "&Sinistra:", -1, 135, 120, 25, 10 -LTEXT "&Alto:", -1, 135, 130, 25, 10 -EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 165, 120, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 165, 130, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -CHECKBOX "Posizionare la finestra automaticamente", IDC_CHECK_SYSTEM_POS_WINDOW, 135, 145, 100, 10 + LTEXT "Anteprima", -1, 10, 7, 65, 10 + CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 10, 20, 115, 70 + GROUPBOX "Dimensione del buffer dello schermo", -1, 130, 15, 115, 40 + LTEXT "&Larghezza:", -1, 135, 30, 25, 10 + LTEXT "&Altezza:", -1, 135, 40, 25, 10 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 165, 30, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 165, 40, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + GROUPBOX "Dimensione della finestra", -1, 130, 60, 115, 40 + LTEXT "&L&arghezza:", -1, 135, 70, 25, 10 + LTEXT "&A<ezza:", -1, 135, 80, 25, 10 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 165, 70, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 165, 80, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + GROUPBOX "Posizione della finestra", -1, 130, 105, 115, 55 + LTEXT "&Sinistra:", -1, 135, 120, 25, 10 + LTEXT "&Alto:", -1, 135, 130, 25, 10 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 165, 120, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 165, 130, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + CHECKBOX "Posizionare la finestra automaticamente", IDC_CHECK_SYSTEM_POS_WINDOW, 135, 145, 100, 10 END IDD_PROPPAGECOLORS DIALOGEX 0, 0, 250, 220 @@ -93,58 +91,57 @@ CAPTION "Colori" FONT 8, "MS Shell Dlg" BEGIN -CONTROL "&Text", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 15, 90, 10 -CONTROL "&Sfondo", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 25, 90, 10 -CONTROL "&Testo Popup", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 35, 90, 10 -CONTROL "Sfondo Popup", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 45, 90, 10 -GROUPBOX "Valori dei colori", -1, 120, 15, 90, 45 -LTEXT "&Rosso:", -1, 125, 25, 30, 10 -EDITTEXT IDC_EDIT_COLOR_RED, 150, 25, 30, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 25, 30, 10 -LTEXT "&Verde:", -1, 125, 35, 30, 10 -EDITTEXT IDC_EDIT_COLOR_GREEN, 150, 35, 30, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 35, 30, 10 -LTEXT "&Blu:", -1, 125, 45, 30, 10 -EDITTEXT IDC_EDIT_COLOR_BLUE, 150, 45, 30, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 45, 30, 10 -CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 15, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 27, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 39, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR4, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 51, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR5, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 63, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR6, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 75, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR7, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 87, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR8, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 99, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR9, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 111, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR10, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 123, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR11, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 135, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR12, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 147, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR13, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 159, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 171, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 183, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 195, 90, 10, 10 -GROUPBOX "Colori selezionati", -1, 10, 110, 200, 40 -CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 120, 180, 20 -GROUPBOX "Colori selezionati Popup", -1, 10, 155, 200, 40 -CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 180, 20 + CONTROL "&Testo Schermo", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 15, 90, 10 + CONTROL "&Sfondo Schermo", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 25, 90, 10 + CONTROL "T&esto Popup", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 35, 90, 10 + CONTROL "S&fondo Popup", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 45, 90, 10 + GROUPBOX "Componenti dei colori", -1, 120, 15, 90, 45 + LTEXT "&Rosso:", -1, 125, 25, 30, 10 + EDITTEXT IDC_EDIT_COLOR_RED, 150, 25, 30, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 165, 25, 30, 10 + LTEXT "&Verde:", -1, 125, 35, 30, 10 + EDITTEXT IDC_EDIT_COLOR_GREEN, 150, 35, 30, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 165, 35, 30, 10 + LTEXT "&Blu:", -1, 125, 45, 30, 10 + EDITTEXT IDC_EDIT_COLOR_BLUE, 150, 45, 30, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 165, 45, 30, 10 + CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 15, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 27, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 39, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR4, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 51, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR5, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 63, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR6, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 75, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR7, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 87, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR8, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 99, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR9, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 111, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR10, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 123, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR11, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 135, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR12, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 147, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR13, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 159, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 171, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 183, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 195, 90, 10, 10 + GROUPBOX "Anteprima (Schermo)", -1, 10, 110, 200, 40 + CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 120, 180, 20 + GROUPBOX "Anteprima (Popup)", -1, 10, 155, 200, 40 + CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 180, 20 END IDD_APPLYOPTIONS DIALOGEX 0, 0, 220, 100 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION "Applicazione delle propriet" +CAPTION "Applicazione delle proprietà" FONT 8, "MS Shell Dlg" BEGIN -CONTROL "&Applicare alla sola finestra attuale", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 150, 10 -CONTROL "&Applicare a tutte le finestre con lo stesso titolo", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 185, 10 -PUSHBUTTON "OK", IDOK, 25, 80, 40, 15, WS_VISIBLE -PUSHBUTTON "Annulla", IDCANCEL, 120, 80, 50, 15, WS_VISIBLE + CONTROL "&Applicare alla sola finestra attuale", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 150, 10 + CONTROL "&Applicare a tutte le finestre con lo stesso titolo", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 185, 10 + PUSHBUTTON "OK", IDOK, 25, 80, 40, 15, WS_VISIBLE + PUSHBUTTON "Annulla", IDCANCEL, 120, 80, 50, 15, WS_VISIBLE END STRINGTABLE BEGIN - IDS_CPLNAME "Console" - IDS_CPLDESCRIPTION "Configura le propriet della console." - IDS_APPLY_SHORTCUT_ALL "Modifica il collegamento che ha attivato questa finestra" - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" - IDS_RASTERFONTS "Raster Fonts" + IDS_CPLNAME "Console" + IDS_CPLDESCRIPTION "Configura le proprietà della console." + IDS_APPLY_SHORTCUT_ALL "Modifica il collegamento che ha attivato questa finestra" + IDS_RASTERFONTS "Raster Fonts" END Index: dll/cpl/console/lang/no-NO.rc =================================================================== --- dll/cpl/console/lang/no-NO.rc (rvision 58607) +++ dll/cpl/console/lang/no-NO.rc (copie de travail) @@ -2,7 +2,7 @@ * PROJECT: ReactOS Console Configuration DLL * LICENSE: GPL - See COPYING in the top level directory * FILE: dll/win32/console/lang/en-US.rc - * PURPOSE: English resource file + * PURPOSE: Norwegian resource file * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@student.tugraz.at) */ @@ -15,20 +15,20 @@ CAPTION "Valg" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Markrstrrelse", -1, 7, 7, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP - CONTROL "&Sm", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 20, 90, 10 + GROUPBOX "Markørstørrelse", -1, 7, 7, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Små", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 20, 90, 10 CONTROL "&Middels", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 40, 90, 10 CONTROL "&Store", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 60, 90, 10 GROUPBOX "Skjerminnstillinger", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP CONTROL "&Vindu", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 20, 70, 10 CONTROL "F&ull skjerm", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 - GROUPBOX "Kommando historie", -1, 7, 84, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP - LTEXT "&Bufferstrrelse:", -1, 14, 101, 70, 12 - EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 97, 12, 15 + GROUPBOX "Kommando historie", -1, 7, 85, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "&Bufferstørrelse:", -1, 14, 101, 70, 12 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 97, 12, 15 LTEXT "&Antall buffere:", -1, 14, 124, 70, 12 - EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 120, 12, 15 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 120, 12, 15 CHECKBOX "&Fjern gamle duplikater", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 GROUPBOX "Rediger valg", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP CHECKBOX "&Hurtigredigeringsmodus", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP @@ -40,8 +40,8 @@ CAPTION "Skrift" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Vindu forhndsvisning:", -1, 10, 10, 94, 10 - LTEXT "Strrelse:", -1, 180, 10, 36, 10 + LTEXT "Vindu forhåndsvisning:", -1, 10, 10, 94, 10 + LTEXT "Størrelse:", -1, 180, 10, 36, 10 CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 163, 74 LISTBOX IDC_LBOX_FONTS, 181, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL LTEXT "&Skrift:", -1, 10, 105, 33, 10 @@ -50,7 +50,7 @@ GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 6, 156, 241, 50 CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 16, 165, 95, 35 LTEXT "Hver tegn er:", -1, 124, 166, 75, 10 - LTEXT "Skjerm piksel bred\nskjerm piksel hy", -1, 136, 180, 101, 20 + LTEXT "Skjerm piksel bred\nskjerm piksel høy", -1, 136, 180, 101, 20 LTEXT "", IDC_FONT_SIZE_X, 120, 180, 10, 10 LTEXT "", IDC_FONT_SIZE_Y, 120, 188, 10, 10 END @@ -60,29 +60,29 @@ CAPTION "Oppsett" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Vindu forhndsvisning:", -1, 8, 6, 95, 10 + LTEXT "Vindu forhåndsvisning:", -1, 8, 6, 95, 10 CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 8, 16, 115, 70 - GROUPBOX "Strrelse p skjermbuffer", -1, 130, 12, 115, 50 + GROUPBOX "Størrelse på skjermbuffer", -1, 130, 12, 115, 50 LTEXT "&Bredde:", -1, 140, 28, 40, 10 - LTEXT "&Hyde:", -1, 140, 46, 39, 10 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 25, 13, 14 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 42, 13, 14 - GROUPBOX "Vindu strrelse", -1, 130, 65, 115, 47 + LTEXT "&Høyde:", -1, 140, 46, 39, 10 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 25, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 42, 13, 14 + GROUPBOX "Vindu størrelse", -1, 130, 65, 115, 47 LTEXT "&B&redde:", -1, 140, 78, 39, 10 - LTEXT "&H&yde:", -1, 140, 95, 37, 10 - EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 75, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 92, 13, 14 + LTEXT "&H&øyde:", -1, 140, 95, 37, 10 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 75, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 92, 13, 14 GROUPBOX "Vindusplassering", -1, 130, 116, 115, 64 LTEXT "&Venstre:", -1, 140, 132, 38, 10 LTEXT "&Topp:", -1, 140, 149, 40, 10 - EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 128, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 146, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 128, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 146, 13, 14 CHECKBOX "Automatisk &vindusplassering", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 104, 10 END @@ -95,16 +95,16 @@ CONTROL "Skjerm &bakgrunn", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 CONTROL "&Hurtigmenytekst", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 CONTROL "Hurtig&menybakgrunn", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 - GROUPBOX "Valgte fargeverdier", -1, 129, 7, 118, 73 - LTEXT "&Rd:", -1, 140, 25, 48, 10 - EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 22, 12, 14 - LTEXT "&Grnn:", -1, 140, 42, 48, 10 - EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 39, 12, 14 - LTEXT "&Bl:", -1, 140, 60, 48, 10 - EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 56, 12, 14 + GROUPBOX "Selected Color Components", -1, 129, 7, 118, 73 + LTEXT "&Rød:", -1, 140, 25, 48, 10 + EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 22, 12, 14 + LTEXT "&Grønn:", -1, 140, 42, 48, 10 + EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 39, 12, 14 + LTEXT "&Blå:", -1, 140, 60, 48, 10 + EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 56, 12, 14 CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 17, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 31, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 45, 90, 12, 12 @@ -121,9 +121,9 @@ CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 199, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 213, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 227, 90, 12, 12 - GROUPBOX "Valgte skjermfarger", -1, 7, 111, 240, 40 + GROUPBOX "Preview (Screen)", -1, 7, 111, 240, 40 CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 124, 224, 20 - GROUPBOX "Valgte hurtigmenyfarger", -1, 7, 162, 240, 40 + GROUPBOX "Preview (Popup)", -1, 7, 162, 240, 40 CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 176, 224, 20 END @@ -132,7 +132,7 @@ CAPTION "Godta innstillinger" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "&Godta innstillinger for bare nvrende vindu", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 12, 207, 10 + CONTROL "&Godta innstillinger for bare nåværende vindu", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 12, 207, 10 CONTROL "&Godta innstillinger for fremtidlige vinduer med samme navn", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 31, 207, 10 PUSHBUTTON "OK", IDOK, 58, 58, 50, 14, WS_VISIBLE PUSHBUTTON "Avbryt", IDCANCEL, 114, 58, 50, 14, WS_VISIBLE @@ -143,6 +143,5 @@ IDS_CPLNAME "Konsoll" IDS_CPLDESCRIPTION "Konfigurere Konsoll innstillinger." IDS_APPLY_SHORTCUT_ALL "Modify &shortcut that started this window" - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" IDS_RASTERFONTS "Raster Fonts" END Index: dll/cpl/console/lang/pl-PL.rc =================================================================== --- dll/cpl/console/lang/pl-PL.rc (rvision 58607) +++ dll/cpl/console/lang/pl-PL.rc (copie de travail) @@ -4,6 +4,7 @@ * https://sourceforge.net/projects/reactospl * UTF-8 conversion by Caemyr (May, 2011) */ + #include LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -13,26 +14,24 @@ CAPTION "Opcje" FONT 8, "MS Shell Dlg" BEGIN -GROUPBOX "Rozmiar kursora", -1, 15, 15, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -CONTROL "&Mały", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 90, 10 -CONTROL "&Średni", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 90, 10 -CONTROL "&Duży", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 55, 90, 10 -GROUPBOX "Pokaż opcje", -1, 140, 15, 100, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -CONTROL "&Okno", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 35, 70, 10 -CONTROL "&Pełny ekran", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 50, 70, 10 -GROUPBOX "Historia poleceń:", -1, 15, 90, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -LTEXT "&Rozmiar bufora", -1, 25, 100, 60, 15 -EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 100, 30, 15, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 100, 12, 12 -LTEXT "&Numery buforów:", -1, 25, 120, 80, 15 -EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 120, 12, 12 -CHECKBOX "O&drzuć stare duplikaty", IDC_CHECK_DISCARD_DUPLICATES, 25, 140, 100, 15 - - -GROUPBOX "Edytuj opcje", -1, 140, 90, 100, 70, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP -CHECKBOX "&Tryb szybkiej edycji", IDC_CHECK_QUICK_EDIT, 150, 100, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP -CHECKBOX "&Wstaw tryb", IDC_CHECK_INSERT_MODE, 150, 120, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "Rozmiar kursora", -1, 15, 15, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Mały", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 90, 10 + CONTROL "&Średni", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 90, 10 + CONTROL "&Duży", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 55, 90, 10 + GROUPBOX "Pokaż opcje", -1, 140, 15, 100, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Okno", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 35, 70, 10 + CONTROL "&Pełny ekran", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 50, 70, 10 + GROUPBOX "Historia poleceń:", -1, 15, 90, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "&Rozmiar bufora", -1, 25, 100, 60, 15 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 100, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 115, 100, 12, 12 + LTEXT "&Numery buforów:", -1, 25, 120, 80, 15 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 115, 120, 12, 12 + CHECKBOX "O&drzuć stare duplikaty", IDC_CHECK_DISCARD_DUPLICATES, 25, 140, 100, 15 + GROUPBOX "Edytuj opcje", -1, 140, 90, 100, 70, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP + CHECKBOX "&Tryb szybkiej edycji", IDC_CHECK_QUICK_EDIT, 150, 100, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + CHECKBOX "&Wstaw tryb", IDC_CHECK_INSERT_MODE, 150, 120, 60, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_PROPPAGEFONT DIALOGEX 0, 0, 250, 220 @@ -40,19 +39,19 @@ CAPTION "Czcionka" FONT 8, "MS Shell Dlg" BEGIN -LTEXT "Okno podglądu", -1, 10, 7, 65, 10 -LTEXT "Rozmiar", -1, 130, 10, 30, 10 -CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 115, 70 -LISTBOX IDC_LBOX_FONTS, 130, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL -LTEXT "&Czcionka", -1, 10, 105, 35, 10 -CHECKBOX "&Pogrubiona czcionka", IDC_CHECK_BOLD_FONTS, 45, 105, 60, 10 -LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 50, LBS_DISABLENOSCROLL | WS_VSCROLL -GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 10, 155, 200, 50 -CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 95, 35 -LTEXT "Pogrubiona czcionka:", -1, 130, 165, 75, 10 -LTEXT "szerokość ekranu w pikselach/nwysokość ekranu w pikselach", -1, 140, 180, 65, 20 -LTEXT "", IDC_FONT_SIZE_X, 125, 180, 10, 10 -LTEXT "", IDC_FONT_SIZE_Y, 125, 188, 10, 10 + LTEXT "Okno podglądu", -1, 10, 7, 65, 10 + LTEXT "Rozmiar", -1, 130, 10, 30, 10 + CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 115, 70 + LISTBOX IDC_LBOX_FONTS, 130, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL + LTEXT "&Czcionka", -1, 10, 105, 35, 10 + CHECKBOX "&Pogrubiona czcionka", IDC_CHECK_BOLD_FONTS, 45, 105, 60, 10 + LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 50, LBS_DISABLENOSCROLL | WS_VSCROLL + GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 10, 155, 200, 50 + CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 95, 35 + LTEXT "Pogrubiona czcionka:", -1, 130, 165, 75, 10 + LTEXT "szerokość ekranu w pikselach/nwysokość ekranu w pikselach", -1, 140, 180, 65, 20 + LTEXT "", IDC_FONT_SIZE_X, 125, 180, 10, 10 + LTEXT "", IDC_FONT_SIZE_Y, 125, 188, 10, 10 END IDD_PROPPAGELAYOUT DIALOGEX 0, 0, 250, 220 @@ -60,30 +59,30 @@ CAPTION "Układ" FONT 8, "MS Shell Dlg" BEGIN -LTEXT "Okno podglądu", -1, 10, 7, 65, 10 -CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 10, 20, 115, 70 -GROUPBOX "Rozmiar bufora ekranu", -1, 130, 15, 115, 40 -LTEXT "&Szerokość:", -1, 135, 30, 25, 10 -LTEXT "&Wysokość:", -1, 135, 40, 25, 10 -EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 165, 30, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 165, 40, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -GROUPBOX "Rozmiar okna", -1, 130, 60, 115, 40 -LTEXT "&Szerokość:", -1, 135, 70, 25, 10 -LTEXT "&Wysokość:", -1, 135, 80, 25, 10 -EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 165, 70, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 165, 80, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -GROUPBOX "Pozycja okna", -1, 130, 105, 115, 55 -LTEXT "&Lewo:", -1, 135, 120, 25, 10 -LTEXT "&Góra:", -1, 135, 130, 25, 10 -EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 165, 120, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 165, 130, 35, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -CHECKBOX "Wybór pozycji okna przez system", IDC_CHECK_SYSTEM_POS_WINDOW, 135, 145, 100, 10 + LTEXT "Okno podglądu", -1, 10, 7, 65, 10 + CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 10, 20, 115, 70 + GROUPBOX "Rozmiar bufora ekranu", -1, 130, 15, 115, 40 + LTEXT "&Szerokość:", -1, 135, 30, 25, 10 + LTEXT "&Wysokość:", -1, 135, 40, 25, 10 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 165, 30, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 165, 40, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + GROUPBOX "Rozmiar okna", -1, 130, 60, 115, 40 + LTEXT "&Szerokość:", -1, 135, 70, 25, 10 + LTEXT "&Wysokość:", -1, 135, 80, 25, 10 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 165, 70, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 165, 80, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + GROUPBOX "Pozycja okna", -1, 130, 105, 115, 55 + LTEXT "&Lewo:", -1, 135, 120, 25, 10 + LTEXT "&Góra:", -1, 135, 130, 25, 10 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 165, 120, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 165, 130, 35, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 185, 30, 30, 10 + CHECKBOX "Wybór pozycji okna przez system", IDC_CHECK_SYSTEM_POS_WINDOW, 135, 145, 100, 10 END IDD_PROPPAGECOLORS DIALOGEX 0, 0, 250, 220 @@ -91,40 +90,40 @@ CAPTION "Kolory" FONT 8, "MS Shell Dlg" BEGIN -CONTROL "Ekran &tekst", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 15, 90, 10 -CONTROL "Ekran &tło", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 25, 90, 10 -CONTROL "&Popup tekst", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 35, 90, 10 -CONTROL "Pop&up tło", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 45, 90, 10 -GROUPBOX "Wybrane wartości koloru", -1, 120, 15, 90, 45 -LTEXT "&Czerowny:", -1, 125, 25, 30, 10 -EDITTEXT IDC_EDIT_COLOR_RED, 150, 25, 30, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 25, 30, 10 -LTEXT "&Zielony:", -1, 125, 35, 30, 10 -EDITTEXT IDC_EDIT_COLOR_GREEN, 150, 35, 30, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 35, 30, 10 -LTEXT "&Niebieski:", -1, 125, 45, 30, 10 -EDITTEXT IDC_EDIT_COLOR_BLUE, 150, 45, 30, 10, ES_RIGHT | WS_GROUP -CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 45, 30, 10 -CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 15, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 27, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 39, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR4, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 51, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR5, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 63, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR6, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 75, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR7, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 87, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR8, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 99, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR9, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 111, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR10, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 123, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR11, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 135, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR12, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 147, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR13, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 159, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 171, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 183, 90, 10, 10 -CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 195, 90, 10, 10 -GROUPBOX "Wybrane kolory ekranu", -1, 10, 110, 200, 40 -CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 120, 180, 20 -GROUPBOX "Wybrane kolory Popup", -1, 10, 155, 200, 40 -CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 180, 20 + CONTROL "Ekran &tekst", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 15, 90, 10 + CONTROL "Ekran &tło", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 25, 90, 10 + CONTROL "&Popup tekst", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 35, 90, 10 + CONTROL "Pop&up tło", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 45, 90, 10 + GROUPBOX "Selected Color Components", -1, 120, 15, 90, 45 + LTEXT "&Czerowny:", -1, 125, 25, 30, 10 + EDITTEXT IDC_EDIT_COLOR_RED, 150, 25, 30, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 165, 25, 30, 10 + LTEXT "&Zielony:", -1, 125, 35, 30, 10 + EDITTEXT IDC_EDIT_COLOR_GREEN, 150, 35, 30, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 165, 35, 30, 10 + LTEXT "&Niebieski:", -1, 125, 45, 30, 10 + EDITTEXT IDC_EDIT_COLOR_BLUE, 150, 45, 30, 10, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 165, 45, 30, 10 + CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 15, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 27, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 39, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR4, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 51, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR5, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 63, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR6, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 75, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR7, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 87, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR8, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 99, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR9, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 111, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR10, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 123, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR11, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 135, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR12, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 147, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR13, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 159, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 171, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 183, 90, 10, 10 + CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 195, 90, 10, 10 + GROUPBOX "Preview (Screen)", -1, 10, 110, 200, 40 + CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 120, 180, 20 + GROUPBOX "Preview (Popup)", -1, 10, 155, 200, 40 + CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 180, 20 END IDD_APPLYOPTIONS DIALOGEX 0, 0, 220, 100 @@ -132,17 +131,16 @@ CAPTION "Zastosuj właściwości" FONT 8, "MS Shell Dlg" BEGIN -CONTROL "&Zastosuj właściwości tylko do aktualnego okna", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 150, 10 -CONTROL "Z&apisz właściwości na przyszłe okna z tym sam tytułem", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 185, 10 -PUSHBUTTON "OK", IDOK, 25, 80, 40, 15, WS_VISIBLE -PUSHBUTTON "Anuluj", IDCANCEL, 120, 80, 50, 15, WS_VISIBLE + CONTROL "&Zastosuj właściwości tylko do aktualnego okna", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 150, 10 + CONTROL "Z&apisz właściwości na przyszłe okna z tym sam tytułem", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 185, 10 + PUSHBUTTON "OK", IDOK, 25, 80, 40, 15, WS_VISIBLE + PUSHBUTTON "Anuluj", IDCANCEL, 120, 80, 50, 15, WS_VISIBLE END STRINGTABLE BEGIN - IDS_CPLNAME "Konsola" - IDS_CPLDESCRIPTION "Konfiguruje właściwości konsoli." - IDS_APPLY_SHORTCUT_ALL "Zmodyfikuj skrót, który wywołał to okno" - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" - IDS_RASTERFONTS "Czcionki rastrowe" + IDS_CPLNAME "Konsola" + IDS_CPLDESCRIPTION "Konfiguruje właściwości konsoli." + IDS_APPLY_SHORTCUT_ALL "Zmodyfikuj skrót, który wywołał to okno" + IDS_RASTERFONTS "Czcionki rastrowe" END Index: dll/cpl/console/lang/ro-RO.rc =================================================================== --- dll/cpl/console/lang/ro-RO.rc (rvision 58607) +++ dll/cpl/console/lang/ro-RO.rc (copie de travail) @@ -23,13 +23,13 @@ GROUPBOX "Mod de afișare", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP CONTROL "În fe&reastră", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 20, 70, 10 CONTROL "Pe &tot ecranul", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 - GROUPBOX "Istoric pentru comenzi", -1, 7, 84, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP + GROUPBOX "Istoric pentru comenzi", -1, 7, 85, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP LTEXT "N&umăr de înregistrări:", -1, 14, 101, 70, 12 - EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 97, 12, 15 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 97, 12, 15 LTEXT "Nu&măr de registre:", -1, 14, 124, 70, 12 - EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 120, 12, 15 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 120, 12, 15 CHECKBOX "Înlătură dublicatele &vechi", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 GROUPBOX "Opțiuni de editare", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP CHECKBOX "Mod E&ditareRapidă", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP @@ -66,24 +66,24 @@ GROUPBOX "Dimensiunea textului", -1, 130, 12, 115, 50 LTEXT "&Coloane:", -1, 140, 28, 40, 10 LTEXT "&Rânduri:", -1, 140, 46, 39, 10 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 25, 13, 14 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 42, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 25, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 42, 13, 14 GROUPBOX "Dimensiunea ferestrei", -1, 130, 65, 115, 47 LTEXT "C&oloane:", -1, 140, 78, 39, 10 LTEXT "Rân&duri:", -1, 140, 95, 37, 10 - EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 75, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 92, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 75, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 92, 13, 14 GROUPBOX "Poziția fereastrei", -1, 130, 116, 115, 64 LTEXT "&Stânga:", -1, 140, 132, 38, 10 LTEXT "S&us:", -1, 140, 149, 40, 10 - EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 128, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 146, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 128, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 146, 13, 14 CHECKBOX "&Amplasare automată", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 104, 10 END @@ -98,14 +98,14 @@ CONTROL "Fun&dal ferestre intempestive", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 GROUPBOX "Paleta culorii selectate:", -1, 129, 7, 118, 73 LTEXT "&Roșu:", -1, 140, 25, 48, 10 - EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 22, 12, 14 + EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 22, 12, 14 LTEXT "&Verde:", -1, 140, 42, 48, 10 - EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 39, 12, 14 + EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 39, 12, 14 LTEXT "&Albastru:", -1, 140, 60, 48, 10 - EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 56, 12, 14 + EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 56, 12, 14 CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 17, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 31, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 45, 90, 12, 12 @@ -122,9 +122,9 @@ CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 199, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 213, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 227, 90, 12, 12 - GROUPBOX "Previzionarea culorilor alese pentru ecran", -1, 7, 111, 240, 40 + GROUPBOX "Previzionare (ecran)", -1, 7, 111, 240, 40 CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 124, 224, 20 - GROUPBOX "Previzionarea culorilor alese pentru ferestre intempestive", -1, 7, 162, 240, 40 + GROUPBOX "Previzionare (ferestre intempestive)", -1, 7, 162, 240, 40 CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 176, 224, 20 END @@ -144,6 +144,5 @@ IDS_CPLNAME "Linie de comandă" IDS_CPLDESCRIPTION "Configurarea proprietăților pentru programe linie de comandă." IDS_APPLY_SHORTCUT_ALL "Modifică &scurtătura care a pornit aplicația" - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" IDS_RASTERFONTS "Fonturi rastre" END Index: dll/cpl/console/lang/ru-RU.rc =================================================================== --- dll/cpl/console/lang/ru-RU.rc (rvision 58607) +++ dll/cpl/console/lang/ru-RU.rc (copie de travail) @@ -16,13 +16,13 @@ GROUPBOX "Экран", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP CONTROL "&Окно", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 20, 70, 10 CONTROL "&Полный экран", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 - GROUPBOX "История команд", -1, 7, 84, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP + GROUPBOX "История команд", -1, 7, 85, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP LTEXT "&Размер буфера:", -1, 14, 101, 60, 12 - EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 97, 12, 15 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 97, 12, 15 LTEXT "&Число буферов:", -1, 14, 124, 60, 12 - EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 120, 12, 15 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 120, 12, 15 CHECKBOX "&Убирать старые экземляры", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 GROUPBOX "Редактирование", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP CHECKBOX "&Быстрое редактирование", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP @@ -59,24 +59,24 @@ GROUPBOX "Размер буфера экрана", -1, 130, 12, 115, 50 LTEXT "&Ширина:", -1, 140, 28, 40, 10 LTEXT "&Высота:", -1, 140, 46, 39, 10 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 25, 13, 14 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 42, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 25, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 42, 13, 14 GROUPBOX "Размер окна", -1, 130, 65, 115, 47 LTEXT "Ш&ирина:", -1, 140, 78, 39, 10 LTEXT "В&ысота:", -1, 140, 95, 37, 10 - EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 75, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 92, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 75, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 92, 13, 14 GROUPBOX "Положение окна", -1, 130, 116, 115, 64 LTEXT "&Отступ:", -1, 140, 132, 38, 10 LTEXT "&Высота:", -1, 140, 149, 40, 10 - EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 128, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 146, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 128, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 146, 13, 14 CHECKBOX "&Системная позиция окна", IDC_CHECK_SYSTEM_POS_WINDOW, 140, 165, 100, 10 END @@ -89,16 +89,16 @@ CONTROL "&Фон экрана", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 CONTROL "&Всплывающий текст", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 CONTROL "В&сплывающий фон", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 - GROUPBOX "Выбор значений цветов", -1, 129, 7, 118, 73 + GROUPBOX "Selected Color Components", -1, 129, 7, 118, 73 LTEXT "&Красный:", -1, 140, 25, 48, 10 - EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 22, 12, 14 + EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 22, 12, 14 LTEXT "&Зеленый:", -1, 140, 42, 48, 10 - EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 39, 12, 14 + EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 39, 12, 14 LTEXT "&Голубой:", -1, 140, 60, 48, 10 - EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 56, 12, 14 + EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 56, 12, 14 CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 17, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 31, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 45, 90, 12, 12 @@ -115,9 +115,9 @@ CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 199, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 213, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 227, 90, 12, 12 - GROUPBOX "Выбранный цвет экрана", -1, 7, 111, 240, 40 + GROUPBOX "Preview (Screen)", -1, 7, 111, 240, 40 CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 124, 224, 20 - GROUPBOX "Выбранные всплывающие цвета", -1, 7, 162, 240, 40 + GROUPBOX "Preview (Popup)", -1, 7, 162, 240, 40 CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 176, 224, 20 END @@ -137,6 +137,5 @@ IDS_CPLNAME "Командная строка" IDS_CPLDESCRIPTION "Настройка командной строки." IDS_APPLY_SHORTCUT_ALL "&Изменить ярлык, которым было запущено это окно" - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-07 5:00\nSYSTEM32 10-01-07 5:00" IDS_RASTERFONTS "Растровые шрифты" END Index: dll/cpl/console/lang/sk-SK.rc =================================================================== --- dll/cpl/console/lang/sk-SK.rc (rvision 58607) +++ dll/cpl/console/lang/sk-SK.rc (copie de travail) @@ -1,4 +1,4 @@ -/* TRANSLATOR: Mrio Kamr /Mario Kacmar/ aka Kario (kario@szm.sk) +/* TRANSLATOR: Mário Kačmár /Mario Kacmar/ aka Kario (kario@szm.sk) * DATE OF TR.: 16-06-2008 */ @@ -8,44 +8,44 @@ IDD_PROPPAGEOPTIONS DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Monosti" +CAPTION "Možnosti" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Vekos kurzora", -1, 7, 7, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP - CONTROL "&Mal", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 20, 90, 10 - CONTROL "&Stredn", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 40, 90, 10 - CONTROL "&Vek", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 60, 90, 10 + GROUPBOX "Veľkosť kurzora", -1, 7, 7, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Malý", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 20, 90, 10 + CONTROL "&Stredný", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 40, 90, 10 + CONTROL "&Veľký", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 60, 90, 10 GROUPBOX "Display Options", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP CONTROL "&Window", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 20, 70, 10 CONTROL "F&ull Screen", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 - GROUPBOX "Histria prkazov", -1, 7, 84, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP + GROUPBOX "História príkazov", -1, 7, 85, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP LTEXT "&Buffer Size:", -1, 14, 101, 70, 12 - EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 97, 12, 15 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 97, 12, 15 LTEXT "&Number of Buffers:", -1, 14, 124, 70, 12 - EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 120, 12, 15 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 120, 12, 15 CHECKBOX "&Discard Old Duplicates", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 - GROUPBOX "Monosti prav", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP + GROUPBOX "Možnosti úprav", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP CHECKBOX "&QuickEdit Mode", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP CHECKBOX "&Insert Mode", IDC_CHECK_INSERT_MODE, 140, 113, 76, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_PROPPAGEFONT DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Psmo" +CAPTION "Písmo" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Ukka okna:", -1, 10, 10, 94, 10 - LTEXT "Vekos:", -1, 180, 10, 36, 10 + LTEXT "Ukážka okna:", -1, 10, 10, 94, 10 + LTEXT "Veľkosť:", -1, 180, 10, 36, 10 CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 163, 74 LISTBOX IDC_LBOX_FONTS, 181, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL - LTEXT "&Psmo:", -1, 10, 105, 33, 10 - CHECKBOX "&Tun psma", IDC_CHECK_BOLD_FONTS, 56, 105, 60, 10 + LTEXT "&Písmo:", -1, 10, 105, 33, 10 + CHECKBOX "&Tučné písma", IDC_CHECK_BOLD_FONTS, 56, 105, 60, 10 LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 40, LBS_DISABLENOSCROLL | WS_VSCROLL GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 6, 156, 241, 50 CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 16, 165, 95, 35 - LTEXT "Kad znak je:", -1, 124, 166, 75, 10 + LTEXT "Každý znak je:", -1, 124, 166, 75, 10 LTEXT "screen pixel wide\nscreen pixel high", -1, 136, 180, 101, 20 LTEXT "", IDC_FONT_SIZE_X, 120, 180, 10, 10 LTEXT "", IDC_FONT_SIZE_Y, 120, 188, 10, 10 @@ -56,29 +56,29 @@ CAPTION "Layout" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Ukka okna:", -1, 8, 6, 95, 10 + LTEXT "Ukážka okna:", -1, 8, 6, 95, 10 CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 8, 16, 115, 70 GROUPBOX "Screen Buffer Size", -1, 130, 12, 115, 50 LTEXT "&Width:", -1, 140, 28, 40, 10 LTEXT "&Height:", -1, 140, 46, 39, 10 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 25, 13, 14 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 42, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 25, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 42, 13, 14 GROUPBOX "Window Size", -1, 130, 65, 115, 47 LTEXT "&W&idth:", -1, 140, 78, 39, 10 LTEXT "&H&eight:", -1, 140, 95, 37, 10 - EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 75, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 92, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 75, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 92, 13, 14 GROUPBOX "Window Position", -1, 130, 116, 115, 64 LTEXT "&Left:", -1, 140, 132, 38, 10 LTEXT "&Top:", -1, 140, 149, 40, 10 - EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 128, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 146, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 128, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 146, 13, 14 CHECKBOX "Let system &position window", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 104, 10 END @@ -91,16 +91,16 @@ CONTROL "Screen &Background", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 CONTROL "&Popup Text", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 CONTROL "Pop&up Background", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 - GROUPBOX "Selected Color Values", -1, 129, 7, 118, 73 + GROUPBOX "Selected Color Components", -1, 129, 7, 118, 73 LTEXT "&Red:", -1, 140, 25, 48, 10 - EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 22, 12, 14 + EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 22, 12, 14 LTEXT "&Green:", -1, 140, 42, 48, 10 - EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 39, 12, 14 + EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 39, 12, 14 LTEXT "&Blue:", -1, 140, 60, 48, 10 - EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 56, 12, 14 + EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 56, 12, 14 CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 17, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 31, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 45, 90, 12, 12 @@ -117,9 +117,9 @@ CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 199, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 213, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 227, 90, 12, 12 - GROUPBOX "Selected Screen Colors", -1, 7, 111, 240, 40 + GROUPBOX "Preview (Screen)", -1, 7, 111, 240, 40 CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 124, 224, 20 - GROUPBOX "Selected Popup Colors", -1, 7, 162, 240, 40 + GROUPBOX "Preview (Popup)", -1, 7, 162, 240, 40 CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 176, 224, 20 END @@ -131,7 +131,7 @@ CONTROL "&Apply Properties to current window only", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 12, 207, 10 CONTROL "&Save Properties for future windows with same title", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 31, 207, 10 PUSHBUTTON "OK", IDOK, 58, 58, 50, 14, WS_VISIBLE - PUSHBUTTON "Zrui", IDCANCEL, 114, 58, 50, 14, WS_VISIBLE + PUSHBUTTON "Zrušiť", IDCANCEL, 114, 58, 50, 14, WS_VISIBLE END STRINGTABLE @@ -139,6 +139,5 @@ IDS_CPLNAME "Konzola" IDS_CPLDESCRIPTION "Nastavuje vlastnosti Konzoly." IDS_APPLY_SHORTCUT_ALL "Modify &shortcut that started this window" - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" - IDS_RASTERFONTS "Rasterov psma" + IDS_RASTERFONTS "Rasterové písma" END Index: dll/cpl/console/lang/uk-UA.rc =================================================================== --- dll/cpl/console/lang/uk-UA.rc (rvision 58607) +++ dll/cpl/console/lang/uk-UA.rc (copie de travail) @@ -23,13 +23,13 @@ GROUPBOX "Параметри відображення", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP CONTROL "В&ікно", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 20, 70, 10 CONTROL "&На весь екран", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 - GROUPBOX "Журнал команд", -1, 7, 84, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP + GROUPBOX "Журнал команд", -1, 7, 85, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP LTEXT "&Розмір буфера:", -1, 14, 101, 70, 12 - EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 97, 12, 15 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 97, 12, 15 LTEXT "&Кількість буферів:", -1, 14, 124, 70, 12 - EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 120, 12, 15 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 120, 12, 15 CHECKBOX "В&ідкидати повторення", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 GROUPBOX "Параметри редагування", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP CHECKBOX "&Швидке редагування", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP @@ -66,24 +66,24 @@ GROUPBOX "Розмір буфера екрана", -1, 130, 12, 115, 50 LTEXT "&Ширина:", -1, 140, 28, 40, 10 LTEXT "&Висота:", -1, 140, 46, 39, 10 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 25, 13, 14 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 42, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 25, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 42, 13, 14 GROUPBOX "Розмір вікна", -1, 130, 65, 115, 47 LTEXT "Ши&рина:", -1, 140, 78, 39, 10 LTEXT "В&исота:", -1, 140, 95, 37, 10 - EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 75, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 92, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 75, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 92, 13, 14 GROUPBOX "Позиція вікна", -1, 130, 116, 115, 64 LTEXT "&Зліва:", -1, 140, 132, 38, 10 LTEXT "З&гори:", -1, 140, 149, 40, 10 - EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 128, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 146, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 128, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 146, 13, 14 CHECKBOX "&Автоматичний вибір", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 104, 10 END @@ -96,16 +96,16 @@ CONTROL "&Тло екрана", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 CONTROL "Те&кст спливного вікна", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 CONTROL "Т&ло спливного вікна", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 - GROUPBOX "Значення вибраних кольорів", -1, 129, 7, 118, 73 + GROUPBOX "Selected Color Components", -1, 129, 7, 118, 73 LTEXT "&Червоний:", -1, 140, 25, 48, 10 - EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 22, 12, 14 + EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 22, 12, 14 LTEXT "&Зелений:", -1, 140, 42, 48, 10 - EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 39, 12, 14 + EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 39, 12, 14 LTEXT "&Синій:", -1, 140, 60, 48, 10 - EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 56, 12, 14 + EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 56, 12, 14 CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 17, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 31, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 45, 90, 12, 12 @@ -122,9 +122,9 @@ CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 199, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 213, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 227, 90, 12, 12 - GROUPBOX "Вибрані кольори екрана", -1, 7, 111, 240, 40 + GROUPBOX "Preview (Screen)", -1, 7, 111, 240, 40 CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 124, 224, 20 - GROUPBOX "Вибрані спливні кольори", -1, 7, 162, 240, 40 + GROUPBOX "Preview (Popup)", -1, 7, 162, 240, 40 CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 176, 224, 20 END @@ -144,6 +144,5 @@ IDS_CPLNAME "Консоль" IDS_CPLDESCRIPTION "Настроювання властивостей консолі." IDS_APPLY_SHORTCUT_ALL "Зміна &ярлика, який запустив це вікно" - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" IDS_RASTERFONTS "Растрові шрифти" END Index: dll/cpl/console/lang/zh-CN.rc =================================================================== --- dll/cpl/console/lang/zh-CN.rc (rvision 58607) +++ dll/cpl/console/lang/zh-CN.rc (copie de travail) @@ -1,5 +1,5 @@ /* - *Simplified Chinese resource for console (dll/cpl/console/lang/zh-CN.rc) + * Simplified Chinese resource for console (dll/cpl/console/lang/zh-CN.rc) * * TRANSLATOR: Jingjing Fu (jingjingf AT 188.com) * CREATED: 2009-04-26 @@ -11,99 +11,99 @@ IDD_PROPPAGEOPTIONS DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "ѡ" +CAPTION "选项" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "С", -1, 7, 7, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP - CONTROL "С(&S)", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 20, 90, 10 - CONTROL "(&M)", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 40, 90, 10 - CONTROL "(&L)", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 60, 90, 10 - GROUPBOX "ʾѡ", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP - CONTROL "(&W)", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 20, 70, 10 - CONTROL "ȫʾ(&F)", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 - GROUPBOX "¼", -1, 7, 84, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP - LTEXT "С(&B):", -1, 14, 101, 70, 12 - EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 97, 12, 15 - LTEXT "(&N):", -1, 14, 124, 70, 12 - EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 120, 12, 15 - CHECKBOX "ɵĸ(&D)", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 - GROUPBOX "༭ѡ", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP - CHECKBOX "ٱ༭ģʽ(&Q)", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP - CHECKBOX "ģʽ(&I)", IDC_CHECK_INSERT_MODE, 140, 113, 76, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "光标大小", -1, 7, 7, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "小(&S)", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 20, 90, 10 + CONTROL "中(&M)", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 40, 90, 10 + CONTROL "大(&L)", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 60, 90, 10 + GROUPBOX "显示选项", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "窗口(&W)", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 20, 70, 10 + CONTROL "全屏显示(&F)", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 + GROUPBOX "命令记录", -1, 7, 85, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "缓冲区大小(&B):", -1, 14, 101, 70, 12 + EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 97, 12, 15 + LTEXT "缓冲区数量(&N):", -1, 14, 124, 70, 12 + EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 119, 120, 12, 15 + CHECKBOX "丢弃旧的副本(&D)", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 + GROUPBOX "编辑选项", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP + CHECKBOX "快速编辑模式(&Q)", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + CHECKBOX "插入模式(&I)", IDC_CHECK_INSERT_MODE, 140, 113, 76, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_PROPPAGEFONT DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "字体" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Ԥ", -1, 10, 10, 94, 10 - LTEXT "С", -1, 180, 10, 36, 10 + LTEXT "窗口预览:", -1, 10, 10, 94, 10 + LTEXT "大小:", -1, 180, 10, 36, 10 CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 163, 74 LISTBOX IDC_LBOX_FONTS, 181, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL - LTEXT "&(&F)", -1, 10, 105, 33, 10 - CHECKBOX "(&B)", IDC_CHECK_BOLD_FONTS, 56, 105, 60, 10 + LTEXT "&字体(&F):", -1, 10, 105, 33, 10 + CHECKBOX "粗体(&B)", IDC_CHECK_BOLD_FONTS, 56, 105, 60, 10 LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 40, LBS_DISABLENOSCROLL | WS_VSCROLL GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 6, 156, 241, 50 CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 16, 165, 95, 35 - LTEXT "ÿַΪ", -1, 124, 166, 75, 10 - LTEXT "Ļؿ\nĻظ", -1, 136, 180, 101, 20 + LTEXT "每个字符为:", -1, 124, 166, 75, 10 + LTEXT "屏幕像素宽\n屏幕像素高", -1, 136, 180, 101, 20 LTEXT "", IDC_FONT_SIZE_X, 120, 180, 10, 10 LTEXT "", IDC_FONT_SIZE_Y, 120, 188, 10, 10 END IDD_PROPPAGELAYOUT DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "布局" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Ԥ", -1, 8, 6, 95, 10 + LTEXT "窗口预览:", -1, 8, 6, 95, 10 CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 8, 16, 115, 70 - GROUPBOX "ĻС", -1, 130, 12, 115, 50 - LTEXT "(&W)", -1, 140, 28, 40, 10 - LTEXT "(&H)", -1, 140, 46, 39, 10 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 25, 13, 14 - EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 42, 13, 14 - GROUPBOX "ڴС", -1, 130, 65, 115, 47 - LTEXT "(&I)", -1, 140, 78, 39, 10 - LTEXT "(&E)", -1, 140, 95, 37, 10 - EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 75, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 92, 13, 14 - GROUPBOX "λ", -1, 130, 116, 115, 64 - LTEXT "(&L)", -1, 140, 132, 38, 10 - LTEXT "(&T)", -1, 140, 149, 40, 10 - EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 128, 13, 14 - EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 146, 13, 14 - CHECKBOX "ϵͳλ(&P)", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 104, 10 + GROUPBOX "屏幕缓冲区大小", -1, 130, 12, 115, 50 + LTEXT "宽(&W):", -1, 140, 28, 40, 10 + LTEXT "高(&H):", -1, 140, 46, 39, 10 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 25, 13, 14 + EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 42, 13, 14 + GROUPBOX "窗口大小", -1, 130, 65, 115, 47 + LTEXT "宽(&I)", -1, 140, 78, 39, 10 + LTEXT "高(&E)", -1, 140, 95, 37, 10 + EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 75, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 92, 13, 14 + GROUPBOX "窗口位置", -1, 130, 116, 115, 64 + LTEXT "左(&L):", -1, 140, 132, 38, 10 + LTEXT "上(&T):", -1, 140, 149, 40, 10 + EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 128, 13, 14 + EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 238, 146, 13, 14 + CHECKBOX "由系统定位窗口(&P)", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 104, 10 END IDD_PROPPAGECOLORS DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "ɫ" +CAPTION "颜色" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "Ļ(&T)", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 112, 10 - CONTROL "Ļ(&B)", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 - CONTROL "(&P)", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 - CONTROL "ڱ(&U)", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 - GROUPBOX "ѡɫֵ", -1, 129, 7, 118, 73 - LTEXT "(&R)", -1, 140, 25, 48, 10 - EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 22, 12, 14 - LTEXT "(&G)", -1, 140, 42, 48, 10 - EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 39, 12, 14 - LTEXT "(&B)", -1, 140, 60, 48, 10 - EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | WS_GROUP - CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 56, 12, 14 + CONTROL "屏幕文字(&T)", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 112, 10 + CONTROL "屏幕背景(&B)", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 + CONTROL "弹出窗口文字(&P)", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 + CONTROL "弹出窗口背景(&U)", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 + GROUPBOX "Selected Color Components", -1, 129, 7, 118, 73 + LTEXT "红(&R):", -1, 140, 25, 48, 10 + EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 22, 12, 14 + LTEXT "绿(&G):", -1, 140, 42, 48, 10 + EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 39, 12, 14 + LTEXT "蓝(&B):", -1, 140, 60, 48, 10 + EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | ES_NUMBER | WS_GROUP + CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP, 240, 56, 12, 14 CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 17, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 31, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 45, 90, 12, 12 @@ -120,28 +120,27 @@ CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 199, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 213, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 227, 90, 12, 12 - GROUPBOX "ѡĻɫ", -1, 7, 111, 240, 40 + GROUPBOX "Preview (Screen)", -1, 7, 111, 240, 40 CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 124, 224, 20 - GROUPBOX "ѡĵɫ", -1, 7, 162, 240, 40 + GROUPBOX "Preview (Popup)", -1, 7, 162, 240, 40 CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 176, 224, 20 END IDD_APPLYOPTIONS DIALOGEX 0, 0, 220, 79 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION "Ӧ" +CAPTION "应用属性" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "ԽԵǰЧ(&A)", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 12, 207, 10 - CONTROL "ԣԺͬĴʹ(&S)", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 31, 207, 10 - PUSHBUTTON "ȷ", IDOK, 58, 58, 50, 14, WS_VISIBLE - PUSHBUTTON "ȡ", IDCANCEL, 114, 58, 50, 14, WS_VISIBLE + CONTROL "属性仅对当前窗口生效(&A)", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 12, 207, 10 + CONTROL "保存属性,供以后具有相同标题的窗口使用(&S)", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 31, 207, 10 + PUSHBUTTON "确定", IDOK, 58, 58, 50, 14, WS_VISIBLE + PUSHBUTTON "取消", IDCANCEL, 114, 58, 50, 14, WS_VISIBLE END STRINGTABLE BEGIN - IDS_CPLNAME "̨" - IDS_CPLDESCRIPTION "ÿ̨ԡ" - IDS_APPLY_SHORTCUT_ALL "޸˴ڵĿݷʽ(&S)" - IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" - IDS_RASTERFONTS "Raster " + IDS_CPLNAME "控制台" + IDS_CPLDESCRIPTION "配置控制台属性。" + IDS_APPLY_SHORTCUT_ALL "修改启动此窗口的快捷方式(&S)" + IDS_RASTERFONTS "Raster 字体" END Index: dll/cpl/console/layout.c =================================================================== --- dll/cpl/console/layout.c (rvision 58607) +++ dll/cpl/console/layout.c (copie de travail) @@ -8,367 +8,376 @@ #include "console.h" +#define NDEBUG +#include -void PaintConsole(LPDRAWITEMSTRUCT drawItem, PConsoleInfo pConInfo) +const TCHAR szPreviewText[] = + _T("C:\\ReactOS> dir \n") \ + _T("SYSTEM 03-03-13 5:00a\n") \ + _T("SYSTEM32 03-03-13 5:00a\n") \ + _T("readme txt 1739 03-03-13 5:00a\n") \ + _T("explorer exe 3329536 03-03-13 5:00a\n") \ + _T("vgafonts cab 18736 03-03-13 5:00a\n") \ + _T("setuplog txt 313 03-03-13 5:00a\n") \ + _T("win ini 7005 03-03-13 5:00a\n"); + + +VOID +PaintConsole(LPDRAWITEMSTRUCT drawItem, + PCONSOLE_PROPS pConInfo) { - HBRUSH hBrush; - RECT cRect, fRect; - DWORD startx, starty; - DWORD endx, endy; - DWORD sizex, sizey; + PGUI_CONSOLE_INFO GuiInfo = pConInfo->TerminalInfo.TermInfo; + HBRUSH hBrush; + RECT cRect, fRect; + DWORD startx, starty; + DWORD endx, endy; + DWORD sizex, sizey; - FillRect(drawItem->hDC, &drawItem->rcItem, GetSysColorBrush(COLOR_BACKGROUND)); + FillRect(drawItem->hDC, &drawItem->rcItem, GetSysColorBrush(COLOR_BACKGROUND)); - sizex = drawItem->rcItem.right - drawItem->rcItem.left; - sizey = drawItem->rcItem.bottom - drawItem->rcItem.top; + sizex = drawItem->rcItem.right - drawItem->rcItem.left; + sizey = drawItem->rcItem.bottom - drawItem->rcItem.top; - if (pConInfo->WindowPosition == UINT_MAX) - { - startx = sizex / 3; - starty = sizey / 3; - } - else - { - // TODO: - // Calculate pos correctly when console centered - startx = sizex / 3; - starty = sizey / 3; - } + if ( GuiInfo->WindowOrigin.x == MAXDWORD && + GuiInfo->WindowOrigin.y == MAXDWORD ) + { + startx = sizex / 3; + starty = sizey / 3; + } + else + { + // TODO: + // Calculate pos correctly when console centered + startx = sizex / 3; + starty = sizey / 3; + } - // TODO: - // Strech console when bold fonts are selected - endx = drawItem->rcItem.right - startx + 15; - endy = starty + sizey / 3; + // TODO: + // Strech console when bold fonts are selected + endx = drawItem->rcItem.right - startx + 15; + endy = starty + sizey / 3; - /* Draw console size */ - SetRect(&cRect, startx, starty, endx, endy); - FillRect(drawItem->hDC, &cRect, GetSysColorBrush(COLOR_WINDOWFRAME)); + /* Draw console size */ + SetRect(&cRect, startx, starty, endx, endy); + FillRect(drawItem->hDC, &cRect, GetSysColorBrush(COLOR_WINDOWFRAME)); - /* Draw console border */ - SetRect(&fRect, startx + 1, starty + 1, cRect.right - 1, cRect.bottom - 1); - FrameRect(drawItem->hDC, &fRect, GetSysColorBrush(COLOR_ACTIVEBORDER)); + /* Draw console border */ + SetRect(&fRect, startx + 1, starty + 1, cRect.right - 1, cRect.bottom - 1); + FrameRect(drawItem->hDC, &fRect, GetSysColorBrush(COLOR_ACTIVEBORDER)); - /* Draw left box */ - SetRect(&fRect, startx + 3, starty + 3, startx + 5, starty + 5); - FillRect(drawItem->hDC, &fRect, GetSysColorBrush(COLOR_ACTIVEBORDER)); + /* Draw left box */ + SetRect(&fRect, startx + 3, starty + 3, startx + 5, starty + 5); + FillRect(drawItem->hDC, &fRect, GetSysColorBrush(COLOR_ACTIVEBORDER)); - /* Draw window title */ - SetRect(&fRect, startx + 7, starty + 3, cRect.right - 9, starty + 5); - FillRect(drawItem->hDC, &fRect, GetSysColorBrush(COLOR_ACTIVECAPTION)); + /* Draw window title */ + SetRect(&fRect, startx + 7, starty + 3, cRect.right - 9, starty + 5); + FillRect(drawItem->hDC, &fRect, GetSysColorBrush(COLOR_ACTIVECAPTION)); - /* Draw first right box */ - SetRect(&fRect, fRect.right + 1, starty + 3, fRect.right + 3, starty + 5); - FillRect(drawItem->hDC, &fRect, GetSysColorBrush(COLOR_ACTIVEBORDER)); + /* Draw first right box */ + SetRect(&fRect, fRect.right + 1, starty + 3, fRect.right + 3, starty + 5); + FillRect(drawItem->hDC, &fRect, GetSysColorBrush(COLOR_ACTIVEBORDER)); - /* Draw second right box */ - SetRect(&fRect, fRect.right + 1, starty + 3, fRect.right + 3, starty + 5); - FillRect(drawItem->hDC, &fRect, GetSysColorBrush(COLOR_ACTIVEBORDER)); + /* Draw second right box */ + SetRect(&fRect, fRect.right + 1, starty + 3, fRect.right + 3, starty + 5); + FillRect(drawItem->hDC, &fRect, GetSysColorBrush(COLOR_ACTIVEBORDER)); - /* Draw scrollbar */ - SetRect(&fRect, cRect.right - 5, fRect.bottom + 1, cRect.right - 3, cRect.bottom - 3); - FillRect(drawItem->hDC, &fRect, GetSysColorBrush(COLOR_SCROLLBAR)); + /* Draw scrollbar */ + SetRect(&fRect, cRect.right - 5, fRect.bottom + 1, cRect.right - 3, cRect.bottom - 3); + FillRect(drawItem->hDC, &fRect, GetSysColorBrush(COLOR_SCROLLBAR)); - /* Draw console background */ - hBrush = CreateSolidBrush(pConInfo->ScreenBackground); - SetRect(&fRect, startx + 3, starty + 6, cRect.right - 6, cRect.bottom - 3); - FillRect(drawItem->hDC, &fRect, hBrush); - DeleteObject((HGDIOBJ)hBrush); + /* Draw console background */ + hBrush = CreateSolidBrush(pConInfo->ci.Colors[BkgdAttribFromAttrib(pConInfo->ci.ScreenAttrib)]); + SetRect(&fRect, startx + 3, starty + 6, cRect.right - 6, cRect.bottom - 3); + FillRect(drawItem->hDC, &fRect, hBrush); + DeleteObject((HGDIOBJ)hBrush); } -void PaintText(LPDRAWITEMSTRUCT drawItem, PConsoleInfo pConInfo) +VOID PaintText(LPDRAWITEMSTRUCT drawItem, + PCONSOLE_PROPS pConInfo) { - COLORREF pbkColor, ptColor; - COLORREF nbkColor, ntColor; - HBRUSH hBrush = NULL; - TCHAR szText[1024]; + COLORREF pbkColor, ptColor; + COLORREF nbkColor, ntColor; + HBRUSH hBrush = NULL; - ZeroMemory(szText, sizeof(szText)); - LoadString(hApplet, IDS_SCREEN_TEXT, szText, sizeof(szText) / sizeof(TCHAR)); + if (drawItem->CtlID == IDC_STATIC_SCREEN_COLOR) + { + nbkColor = pConInfo->ci.Colors[BkgdAttribFromAttrib(pConInfo->ci.ScreenAttrib)]; + hBrush = CreateSolidBrush(nbkColor); + ntColor = pConInfo->ci.Colors[TextAttribFromAttrib(pConInfo->ci.ScreenAttrib)]; + } + else if (drawItem->CtlID == IDC_STATIC_POPUP_COLOR) + { + nbkColor = pConInfo->ci.Colors[BkgdAttribFromAttrib(pConInfo->ci.PopupAttrib)]; + hBrush = CreateSolidBrush(nbkColor); + ntColor = pConInfo->ci.Colors[TextAttribFromAttrib(pConInfo->ci.PopupAttrib)]; + } - if (drawItem->CtlID == IDC_STATIC_SCREEN_COLOR) - { - nbkColor = pConInfo->ScreenBackground; - hBrush = CreateSolidBrush(nbkColor); - ntColor = pConInfo->ScreenText; - } - else if (drawItem->CtlID == IDC_STATIC_POPUP_COLOR) - { - nbkColor = pConInfo->PopupBackground; - hBrush = CreateSolidBrush(nbkColor); - ntColor = pConInfo->PopupText; - } + if (!hBrush) + { + return; + } - if (!hBrush) - { - return; - } + FillRect(drawItem->hDC, &drawItem->rcItem, hBrush); - FillRect(drawItem->hDC, &drawItem->rcItem, hBrush); - if (ntColor == nbkColor) - { - /* Text has same color -> invisible */ - return; - } - - ptColor = SetTextColor(drawItem->hDC, ntColor); - pbkColor = SetBkColor(drawItem->hDC, nbkColor); - DrawText(drawItem->hDC, szText, _tcslen(szText), &drawItem->rcItem, 0); - SetTextColor(drawItem->hDC, ptColor); - SetBkColor(drawItem->hDC, pbkColor); - DeleteObject((HGDIOBJ)hBrush); + ptColor = SetTextColor(drawItem->hDC, ntColor); + pbkColor = SetBkColor(drawItem->hDC, nbkColor); + DrawText(drawItem->hDC, szPreviewText, _tcslen(szPreviewText), &drawItem->rcItem, 0); + SetTextColor(drawItem->hDC, ptColor); + SetBkColor(drawItem->hDC, pbkColor); + DeleteObject((HGDIOBJ)hBrush); } - INT_PTR CALLBACK -LayoutProc( - HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam -) +LayoutProc(HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) { - LPNMUPDOWN lpnmud; - LPPSHNOTIFY lppsn; - PConsoleInfo pConInfo = (PConsoleInfo)GetWindowLongPtr(hwndDlg, DWLP_USER); + LPNMUPDOWN lpnmud; + LPPSHNOTIFY lppsn; + PCONSOLE_PROPS pConInfo = (PCONSOLE_PROPS)GetWindowLongPtr(hwndDlg, DWLP_USER); + PGUI_CONSOLE_INFO GuiInfo = (pConInfo ? pConInfo->TerminalInfo.TermInfo : NULL); - UNREFERENCED_PARAMETER(hwndDlg); - UNREFERENCED_PARAMETER(wParam); + UNREFERENCED_PARAMETER(hwndDlg); + UNREFERENCED_PARAMETER(wParam); - switch(uMsg) - { - case WM_INITDIALOG: - { - DWORD xres, yres; - HDC hDC; - pConInfo = (PConsoleInfo) ((LPPROPSHEETPAGE)lParam)->lParam; - SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo); - SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, HIWORD(pConInfo->ScreenBuffer), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, LOWORD(pConInfo->ScreenBuffer), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, HIWORD(pConInfo->WindowSize), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, LOWORD(pConInfo->WindowSize), FALSE); - SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_SCREEN_BUFFER_HEIGHT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1)); - SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_SCREEN_BUFFER_WIDTH), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1)); - SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_SIZE_HEIGHT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1)); - SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_SIZE_WIDTH), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1)); + switch (uMsg) + { + case WM_INITDIALOG: + { + DWORD xres, yres; + HDC hDC; + pConInfo = (PCONSOLE_PROPS)((LPPROPSHEETPAGE)lParam)->lParam; + GuiInfo = pConInfo->TerminalInfo.TermInfo; + SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo); - hDC = GetDC(NULL); - xres = GetDeviceCaps(hDC, HORZRES); - yres = GetDeviceCaps(hDC, VERTRES); - SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(xres, 0)); - SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP), UDM_SETRANGE, 0, (LPARAM)MAKELONG(yres, 0)); + SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_SCREEN_BUFFER_HEIGHT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1)); + SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_SCREEN_BUFFER_WIDTH), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1)); + SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_SIZE_HEIGHT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1)); + SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_SIZE_WIDTH), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1)); - if (pConInfo->WindowPosition != MAXDWORD) - { - SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, LOWORD(pConInfo->WindowPosition), FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, HIWORD(pConInfo->WindowPosition), FALSE); - } - else - { - // FIXME: Calculate window pos from xres, yres - SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, 88, FALSE); - SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, 88, FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_TOP), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP), FALSE); - SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_SYSTEM_POS_WINDOW), BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - } + SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, pConInfo->ci.ScreenBufferSize.Y, FALSE); + SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, pConInfo->ci.ScreenBufferSize.X, FALSE); + SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, pConInfo->ci.ConsoleSize.Y, FALSE); + SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, pConInfo->ci.ConsoleSize.X, FALSE); - return TRUE; - } - case WM_DRAWITEM: - { - PaintConsole((LPDRAWITEMSTRUCT)lParam, pConInfo); - return TRUE; - } - case WM_NOTIFY: - { - lpnmud = (LPNMUPDOWN) lParam; - lppsn = (LPPSHNOTIFY) lParam; + hDC = GetDC(NULL); + xres = GetDeviceCaps(hDC, HORZRES); + yres = GetDeviceCaps(hDC, VERTRES); + SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(xres, 0)); + SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP), UDM_SETRANGE, 0, (LPARAM)MAKELONG(yres, 0)); - if (lppsn->hdr.code == UDN_DELTAPOS) - { - DWORD wheight, wwidth; - DWORD sheight, swidth; - DWORD left, top; + if ( GuiInfo->WindowOrigin.x != MAXDWORD && + GuiInfo->WindowOrigin.y != MAXDWORD ) + { + SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, GuiInfo->WindowOrigin.x, FALSE); + SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, GuiInfo->WindowOrigin.y, FALSE); + } + else + { + // FIXME: Calculate window pos from xres, yres + SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, 88, FALSE); + SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, 88, FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_TOP), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP), FALSE); + SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_SYSTEM_POS_WINDOW), BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + } - if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_WIDTH) - { - wwidth = lpnmud->iPos + lpnmud->iDelta; - } - else - { - wwidth = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, NULL, FALSE); - } + return TRUE; + } + case WM_DRAWITEM: + { + PaintConsole((LPDRAWITEMSTRUCT)lParam, pConInfo); + return TRUE; + } + case WM_NOTIFY: + { + lpnmud = (LPNMUPDOWN) lParam; + lppsn = (LPPSHNOTIFY) lParam; - if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_HEIGHT) - { - wheight = lpnmud->iPos + lpnmud->iDelta; - } - else - { - wheight = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, NULL, FALSE); - } + if (lppsn->hdr.code == UDN_DELTAPOS) + { + DWORD wheight, wwidth; + DWORD sheight, swidth; + DWORD left, top; - if (lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_WIDTH) - { - swidth = lpnmud->iPos + lpnmud->iDelta; - } - else - { - swidth = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, NULL, FALSE); - } + if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_WIDTH) + { + wwidth = lpnmud->iPos + lpnmud->iDelta; + } + else + { + wwidth = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, NULL, FALSE); + } - if (lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_HEIGHT) - { - sheight = lpnmud->iPos + lpnmud->iDelta; - } - else - { - sheight = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, NULL, FALSE); - } + if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_HEIGHT) + { + wheight = lpnmud->iPos + lpnmud->iDelta; + } + else + { + wheight = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, NULL, FALSE); + } - if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_POS_LEFT) - { - left = lpnmud->iPos + lpnmud->iDelta; - } - else - { - left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, FALSE); - } + if (lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_WIDTH) + { + swidth = lpnmud->iPos + lpnmud->iDelta; + } + else + { + swidth = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, NULL, FALSE); + } - if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_POS_TOP) - { - top = lpnmud->iPos + lpnmud->iDelta; - } - else - { - top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, NULL, FALSE); - } + if (lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_HEIGHT) + { + sheight = lpnmud->iPos + lpnmud->iDelta; + } + else + { + sheight = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, NULL, FALSE); + } - if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_WIDTH || lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_HEIGHT) - { - /* Automatically adjust screen buffer size when window size enlarges */ - if (wwidth >= swidth) - { - SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, wwidth, TRUE); - swidth = wwidth; - } + if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_POS_LEFT) + { + left = lpnmud->iPos + lpnmud->iDelta; + } + else + { + left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, FALSE); + } - if (wheight >= sheight) - { - SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, wheight, TRUE); - sheight = wheight; - } - } - swidth = max(swidth, 1); - sheight = max(sheight, 1); + if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_POS_TOP) + { + top = lpnmud->iPos + lpnmud->iDelta; + } + else + { + top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, NULL, FALSE); + } - if (lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_WIDTH || lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_HEIGHT) - { - /* Automatically adjust window size when screen buffer decreases */ - if (wwidth > swidth) - { - SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, swidth, TRUE); - wwidth = swidth; - } + if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_WIDTH || lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_HEIGHT) + { + /* Automatically adjust screen buffer size when window size enlarges */ + if (wwidth >= swidth) + { + SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, wwidth, TRUE); + swidth = wwidth; + } - if (wheight > sheight) - { - SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, sheight, TRUE); - wheight = sheight; - } - } + if (wheight >= sheight) + { + SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, wheight, TRUE); + sheight = wheight; + } + } + swidth = max(swidth, 1); + sheight = max(sheight, 1); - pConInfo->ScreenBuffer = MAKELONG(swidth, sheight); - pConInfo->WindowSize = MAKELONG(wwidth, wheight); - pConInfo->WindowPosition = MAKELONG(left, top); - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - } - break; - } - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case IDC_EDIT_SCREEN_BUFFER_WIDTH: - case IDC_EDIT_SCREEN_BUFFER_HEIGHT: - case IDC_EDIT_WINDOW_SIZE_WIDTH: - case IDC_UPDOWN_WINDOW_SIZE_HEIGHT: - case IDC_EDIT_WINDOW_POS_LEFT: - case IDC_EDIT_WINDOW_POS_TOP: - { - if (HIWORD(wParam) == EN_KILLFOCUS) - { - DWORD wheight, wwidth; - DWORD sheight, swidth; - DWORD left, top; + if (lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_WIDTH || lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_HEIGHT) + { + /* Automatically adjust window size when screen buffer decreases */ + if (wwidth > swidth) + { + SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, swidth, TRUE); + wwidth = swidth; + } - wwidth = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, NULL, FALSE); - wheight = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, NULL, FALSE); - swidth = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, NULL, FALSE); - sheight = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, NULL, FALSE); - left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, FALSE); - top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, NULL, FALSE); + if (wheight > sheight) + { + SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, sheight, TRUE); + wheight = sheight; + } + } - swidth = max(swidth, 1); - sheight = max(sheight, 1); + pConInfo->ci.ScreenBufferSize = (COORD){swidth, sheight}; + pConInfo->ci.ConsoleSize = (COORD){wwidth, wheight}; + GuiInfo->WindowOrigin = (POINT){left, top}; + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + break; + } + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDC_EDIT_SCREEN_BUFFER_WIDTH: + case IDC_EDIT_SCREEN_BUFFER_HEIGHT: + case IDC_EDIT_WINDOW_SIZE_WIDTH: + case IDC_UPDOWN_WINDOW_SIZE_HEIGHT: + case IDC_EDIT_WINDOW_POS_LEFT: + case IDC_EDIT_WINDOW_POS_TOP: + { + if (HIWORD(wParam) == EN_KILLFOCUS) + { + DWORD wheight, wwidth; + DWORD sheight, swidth; + DWORD left, top; - /* Automatically adjust window size when screen buffer decreases */ - if (wwidth > swidth) - { - SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, swidth, TRUE); - wwidth = swidth; - } + wwidth = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, NULL, FALSE); + wheight = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, NULL, FALSE); + swidth = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, NULL, FALSE); + sheight = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, NULL, FALSE); + left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, FALSE); + top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, NULL, FALSE); - if (wheight > sheight) - { - SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, sheight, TRUE); - wheight = sheight; - } + swidth = max(swidth, 1); + sheight = max(sheight, 1); + /* Automatically adjust window size when screen buffer decreases */ + if (wwidth > swidth) + { + SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, swidth, TRUE); + wwidth = swidth; + } - pConInfo->ScreenBuffer = MAKELONG(swidth, sheight); - pConInfo->WindowSize = MAKELONG(wwidth, wheight); - pConInfo->WindowPosition = MAKELONG(left, top); + if (wheight > sheight) + { + SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, sheight, TRUE); + wheight = sheight; + } - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - } - break; - } + pConInfo->ci.ScreenBufferSize = (COORD){swidth, sheight}; + pConInfo->ci.ConsoleSize = (COORD){wwidth, wheight}; + GuiInfo->WindowOrigin = (POINT){left, top}; + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + break; + } - case IDC_CHECK_SYSTEM_POS_WINDOW: - { - LONG res = SendMessage((HWND)lParam, BM_GETCHECK, 0, 0); - if (res == BST_CHECKED) - { - ULONG left, top; + case IDC_CHECK_SYSTEM_POS_WINDOW: + { + LONG res = SendMessage((HWND)lParam, BM_GETCHECK, 0, 0); + if (res == BST_CHECKED) + { + ULONG left, top; - left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, FALSE); - top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, NULL, FALSE); - pConInfo->WindowPosition = MAKELONG(left, top); - SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); - EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT), TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_TOP), TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT), TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP), TRUE); - } - else if (res == BST_UNCHECKED) - { - pConInfo->WindowPosition = UINT_MAX; - SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_TOP), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP), FALSE); - } - } - } - } - default: - break; - } + left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, FALSE); + top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, NULL, FALSE); + GuiInfo->WindowOrigin = (POINT){left, top}; + SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_TOP), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP), TRUE); + } + else if (res == BST_UNCHECKED) + { + GuiInfo->WindowOrigin = (POINT){UINT_MAX, UINT_MAX}; + SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_TOP), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP), FALSE); + } + } + } + } + default: + break; + } - return FALSE; + return FALSE; } Index: dll/cpl/console/options.c =================================================================== --- dll/cpl/console/options.c (rvision 58607) +++ dll/cpl/console/options.c (copie de travail) @@ -8,257 +8,251 @@ #include "console.h" +#define NDEBUG +#include + static void -UpdateDialogElements(HWND hwndDlg, PConsoleInfo pConInfo); +UpdateDialogElements(HWND hwndDlg, PCONSOLE_PROPS pConInfo); INT_PTR CALLBACK -OptionsProc( - HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam -) +OptionsProc(HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) { - PConsoleInfo pConInfo; - LRESULT lResult; - HWND hDlgCtrl; + PCONSOLE_PROPS pConInfo; + LRESULT lResult; + HWND hDlgCtrl; LPPSHNOTIFY lppsn; - pConInfo = (PConsoleInfo) GetWindowLongPtr(hwndDlg, DWLP_USER); + pConInfo = (PCONSOLE_PROPS)GetWindowLongPtr(hwndDlg, DWLP_USER); - switch(uMsg) - { - case WM_INITDIALOG: - { - pConInfo = (PConsoleInfo) ((LPPROPSHEETPAGE)lParam)->lParam; - SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo); - UpdateDialogElements(hwndDlg, pConInfo); - return TRUE; - } - case WM_NOTIFY: - { - if (!pConInfo) - { - break; - } - lppsn = (LPPSHNOTIFY) lParam; + switch (uMsg) + { + case WM_INITDIALOG: + { + pConInfo = (PCONSOLE_PROPS)((LPPROPSHEETPAGE)lParam)->lParam; + SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo); + UpdateDialogElements(hwndDlg, pConInfo); + return TRUE; + } + case WM_NOTIFY: + { + if (!pConInfo) break; + + lppsn = (LPPSHNOTIFY) lParam; if (lppsn->hdr.code == UDN_DELTAPOS) { - hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_BUFFER_SIZE); - pConInfo->HistoryBufferSize = LOWORD(SendMessage(hDlgCtrl, UDM_GETPOS, 0, 0)); + hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_BUFFER_SIZE); + pConInfo->ci.HistoryBufferSize = LOWORD(SendMessage(hDlgCtrl, UDM_GETPOS, 0, 0)); - hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_NUM_BUFFER); - pConInfo->NumberOfHistoryBuffers = LOWORD(SendMessage(hDlgCtrl, UDM_GETPOS, 0, 0)); - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - } - else if (lppsn->hdr.code == PSN_APPLY) - { - if (!pConInfo->AppliedConfig) - { - ApplyConsoleInfo(hwndDlg, pConInfo); - } - else - { - /* Options have already been applied */ - SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR); - return TRUE; - } - return TRUE; - } - break; - } - case WM_COMMAND: - { - if (!pConInfo) - { - break; - } - switch(LOWORD(wParam)) - { - case IDC_RADIO_SMALL_CURSOR: - { - pConInfo->CursorSize = 0x0; - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - break; - } - case IDC_RADIO_MEDIUM_CURSOR: - { - pConInfo->CursorSize = 0x32; - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - break; - } - case IDC_RADIO_LARGE_CURSOR: - { - pConInfo->CursorSize = 0x64; - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - break; - } - case IDC_RADIO_DISPLAY_WINDOW: - { - pConInfo->FullScreen = FALSE; - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - break; - } - case IDC_RADIO_DISPLAY_FULL: - { - pConInfo->FullScreen = TRUE; - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - break; - } - case IDC_CHECK_QUICK_EDIT: - { + hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_NUM_BUFFER); + pConInfo->ci.NumberOfHistoryBuffers = LOWORD(SendMessage(hDlgCtrl, UDM_GETPOS, 0, 0)); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + else if (lppsn->hdr.code == PSN_APPLY) + { + if (!pConInfo->AppliedConfig) + { + return ApplyConsoleInfo(hwndDlg, pConInfo); + } + else + { + /* Options have already been applied */ + SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR); + return TRUE; + } + } + break; + } + case WM_COMMAND: + { + if (!pConInfo) break; + + switch (LOWORD(wParam)) + { + case IDC_RADIO_SMALL_CURSOR: + { + pConInfo->ci.CursorSize = 25; + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + } + case IDC_RADIO_MEDIUM_CURSOR: + { + pConInfo->ci.CursorSize = 50; + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + } + case IDC_RADIO_LARGE_CURSOR: + { + pConInfo->ci.CursorSize = 100; + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + } + case IDC_RADIO_DISPLAY_WINDOW: + { + pConInfo->ci.FullScreen = FALSE; + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + } + case IDC_RADIO_DISPLAY_FULL: + { + pConInfo->ci.FullScreen = TRUE; + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + } + case IDC_CHECK_QUICK_EDIT: + { lResult = SendMessage((HWND)lParam, BM_GETCHECK, (WPARAM)0, (LPARAM)0); if (lResult == BST_CHECKED) { - pConInfo->QuickEdit = FALSE; + pConInfo->ci.QuickEdit = FALSE; SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_UNCHECKED, (LPARAM)0); } else if (lResult == BST_UNCHECKED) { - pConInfo->QuickEdit = TRUE; + pConInfo->ci.QuickEdit = TRUE; SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0); } - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - break; - } - case IDC_CHECK_INSERT_MODE: - { + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + } + case IDC_CHECK_INSERT_MODE: + { lResult = SendMessage((HWND)lParam, BM_GETCHECK, (WPARAM)0, (LPARAM)0); if (lResult == BST_CHECKED) { - pConInfo->InsertMode = FALSE; + pConInfo->ci.InsertMode = FALSE; SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_UNCHECKED, (LPARAM)0); } else if (lResult == BST_UNCHECKED) { - pConInfo->InsertMode = TRUE; + pConInfo->ci.InsertMode = TRUE; SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0); } - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - break; - } - case IDC_CHECK_DISCARD_DUPLICATES: - { + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + } + case IDC_CHECK_DISCARD_DUPLICATES: + { lResult = SendMessage((HWND)lParam, BM_GETCHECK, (WPARAM)0, (LPARAM)0); if (lResult == BST_CHECKED) { - pConInfo->HistoryNoDup = FALSE; + pConInfo->ci.HistoryNoDup = FALSE; SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_UNCHECKED, (LPARAM)0); } else if (lResult == BST_UNCHECKED) { - pConInfo->HistoryNoDup = TRUE; + pConInfo->ci.HistoryNoDup = TRUE; SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0); } - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - break; - } - default: - break; - } - break; - } - default: - break; - } + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + } + default: + break; + } + break; + } + default: + break; + } - return FALSE; + return FALSE; } static void -UpdateDialogElements(HWND hwndDlg, PConsoleInfo pConInfo) +UpdateDialogElements(HWND hwndDlg, PCONSOLE_PROPS pConInfo) { - HWND hDlgCtrl; - TCHAR szBuffer[MAX_PATH]; + HWND hDlgCtrl; + TCHAR szBuffer[MAX_PATH]; - /* Update cursor size */ - if ( pConInfo->CursorSize == 0) - { - /* Small cursor */ - hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR); - SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + /* Update cursor size */ + if (pConInfo->ci.CursorSize <= 25) + { + /* Small cursor */ + hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR); + SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR); - SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); - hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR); - SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); - } - else if ( pConInfo->CursorSize == 0x32 ) - { - hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR); - SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR); + SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); + hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR); + SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); + } + else if (pConInfo->ci.CursorSize <= 50) + { + hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR); + SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR); - SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); - hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR); - SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); - } - else if ( pConInfo->CursorSize == 0x64 ) - { - hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR); - SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR); + SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); + hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR); + SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); + } + else /* if (pConInfo->ci.CursorSize <= 100) */ + { + hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR); + SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR); - SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); - hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR); - SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); - } + hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR); + SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); + hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR); + SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); + } - /* Update num buffers */ - hDlgCtrl = GetDlgItem(hwndDlg, IDC_UPDOWN_NUM_BUFFER); - SendMessage(hDlgCtrl, UDM_SETRANGE, 0, MAKELONG((short)999, (short)1)); - hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_NUM_BUFFER); - _stprintf(szBuffer, _T("%d"), pConInfo->NumberOfHistoryBuffers); - SendMessage(hDlgCtrl, WM_SETTEXT, 0, (LPARAM)szBuffer); + /* Update num buffers */ + hDlgCtrl = GetDlgItem(hwndDlg, IDC_UPDOWN_NUM_BUFFER); + SendMessage(hDlgCtrl, UDM_SETRANGE, 0, MAKELONG((short)999, (short)1)); + hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_NUM_BUFFER); + _stprintf(szBuffer, _T("%d"), pConInfo->ci.NumberOfHistoryBuffers); + SendMessage(hDlgCtrl, WM_SETTEXT, 0, (LPARAM)szBuffer); - /* Update buffer size */ - hDlgCtrl = GetDlgItem(hwndDlg, IDC_UPDOWN_BUFFER_SIZE); - SendMessage(hDlgCtrl, UDM_SETRANGE, 0, MAKELONG((short)999, (short)1)); - hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_BUFFER_SIZE); - _stprintf(szBuffer, _T("%d"), pConInfo->HistoryBufferSize); - SendMessage(hDlgCtrl, WM_SETTEXT, 0, (LPARAM)szBuffer); + /* Update buffer size */ + hDlgCtrl = GetDlgItem(hwndDlg, IDC_UPDOWN_BUFFER_SIZE); + SendMessage(hDlgCtrl, UDM_SETRANGE, 0, MAKELONG((short)999, (short)1)); + hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_BUFFER_SIZE); + _stprintf(szBuffer, _T("%d"), pConInfo->ci.HistoryBufferSize); + SendMessage(hDlgCtrl, WM_SETTEXT, 0, (LPARAM)szBuffer); + /* Update discard duplicates */ + hDlgCtrl = GetDlgItem(hwndDlg, IDC_CHECK_DISCARD_DUPLICATES); + if (pConInfo->ci.HistoryNoDup) + SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + else + SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0); + /* Update full/window screen */ + if (pConInfo->ci.FullScreen) + { + hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_FULL); + SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - /* Update discard duplicates */ - hDlgCtrl = GetDlgItem(hwndDlg, IDC_CHECK_DISCARD_DUPLICATES); - if ( pConInfo->HistoryNoDup ) - SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - else - SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0); + hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_WINDOW); + SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0); + } + else + { + hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_WINDOW); + SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - /* Update full/window screen */ - if ( pConInfo->FullScreen ) - { - hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_FULL); - SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_FULL); + SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0); + } - hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_WINDOW); - SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0); - } - else - { - hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_WINDOW); - SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + /* Update quick edit */ + hDlgCtrl = GetDlgItem(hwndDlg, IDC_CHECK_QUICK_EDIT); + if (pConInfo->ci.QuickEdit) + SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + else + SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0); - hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_FULL); - SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0); - } - - /* Update quick edit */ - hDlgCtrl = GetDlgItem(hwndDlg, IDC_CHECK_QUICK_EDIT); - if ( pConInfo->QuickEdit ) - SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - else - SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0); - - /* Update insert mode */ - hDlgCtrl = GetDlgItem(hwndDlg, IDC_CHECK_INSERT_MODE); - if ( pConInfo->InsertMode ) - SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - else - SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0); + /* Update insert mode */ + hDlgCtrl = GetDlgItem(hwndDlg, IDC_CHECK_INSERT_MODE); + if (pConInfo->ci.InsertMode) + SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + else + SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0); } Index: dll/cpl/console/resource.h =================================================================== --- dll/cpl/console/resource.h (rvision 58607) +++ dll/cpl/console/resource.h (copie de travail) @@ -1,36 +1,36 @@ #pragma once -#define IDC_CPLICON 40 -#define IDS_CPLNAME 41 -#define IDS_CPLDESCRIPTION 42 +#define IDC_CPLICON 40 +#define IDS_CPLNAME 41 +#define IDS_CPLDESCRIPTION 42 #define IDS_APPLY_SHORTCUT_ALL 43 -#define IDD_PROPPAGEOPTIONS 100 -#define IDD_PROPPAGEFONT 101 -#define IDD_PROPPAGELAYOUT 102 -#define IDD_PROPPAGECOLORS 103 -#define IDD_APPLYOPTIONS 104 +#define IDD_PROPPAGEOPTIONS 100 +#define IDD_PROPPAGEFONT 101 +#define IDD_PROPPAGELAYOUT 102 +#define IDD_PROPPAGECOLORS 103 +#define IDD_APPLYOPTIONS 104 // Options dialog -#define IDC_CHECK_QUICK_EDIT 200 -#define IDC_CHECK_INSERT_MODE 201 -#define IDC_CHECK_DISCARD_DUPLICATES 202 -#define IDC_EDIT_BUFFER_SIZE 203 -#define IDC_UPDOWN_BUFFER_SIZE 204 -#define IDC_EDIT_NUM_BUFFER 205 -#define IDC_UPDOWN_NUM_BUFFER 206 -#define IDC_RADIO_SMALL_CURSOR 207 -#define IDC_RADIO_MEDIUM_CURSOR 208 -#define IDC_RADIO_LARGE_CURSOR 209 -#define IDC_RADIO_DISPLAY_WINDOW 210 -#define IDC_RADIO_DISPLAY_FULL 211 +#define IDC_CHECK_QUICK_EDIT 200 +#define IDC_CHECK_INSERT_MODE 201 +#define IDC_CHECK_DISCARD_DUPLICATES 202 +#define IDC_EDIT_BUFFER_SIZE 203 +#define IDC_UPDOWN_BUFFER_SIZE 204 +#define IDC_EDIT_NUM_BUFFER 205 +#define IDC_UPDOWN_NUM_BUFFER 206 +#define IDC_RADIO_SMALL_CURSOR 207 +#define IDC_RADIO_MEDIUM_CURSOR 208 +#define IDC_RADIO_LARGE_CURSOR 209 +#define IDC_RADIO_DISPLAY_WINDOW 210 +#define IDC_RADIO_DISPLAY_FULL 211 // Apply dialog -#define IDC_RADIO_APPLY_ALL 300 -#define IDC_RADIO_APPLY_CURRENT 301 +#define IDC_RADIO_APPLY_ALL 300 +#define IDC_RADIO_APPLY_CURRENT 301 // Font dialog -#define IDC_CHECK_BOLD_FONTS 400 +#define IDC_CHECK_BOLD_FONTS 400 #define IDC_STATIC_SELECT_FONT_PREVIEW 401 #define IDC_FONT_SIZE_X 402 #define IDC_FONT_SIZE_Y 403 @@ -40,20 +40,20 @@ #define IDC_GROUPBOX_FONT_NAME 407 // Layout dialog -#define IDC_UPDOWN_SCREEN_BUFFER_WIDTH 500 -#define IDC_EDIT_SCREEN_BUFFER_WIDTH 501 -#define IDC_EDIT_SCREEN_BUFFER_HEIGHT 502 -#define IDC_UPDOWN_SCREEN_BUFFER_HEIGHT 503 -#define IDC_EDIT_WINDOW_SIZE_WIDTH 504 -#define IDC_UPDOWN_WINDOW_SIZE_WIDTH 505 -#define IDC_EDIT_WINDOW_SIZE_HEIGHT 506 -#define IDC_UPDOWN_WINDOW_SIZE_HEIGHT 507 -#define IDC_EDIT_WINDOW_POS_LEFT 508 -#define IDC_UPDOWN_WINDOW_POS_LEFT 509 -#define IDC_EDIT_WINDOW_POS_TOP 510 -#define IDC_UPDOWN_WINDOW_POS_TOP 511 -#define IDC_CHECK_SYSTEM_POS_WINDOW 512 -#define IDC_STATIC_LAYOUT_WINDOW_PREVIEW 513 +#define IDC_UPDOWN_SCREEN_BUFFER_WIDTH 500 +#define IDC_EDIT_SCREEN_BUFFER_WIDTH 501 +#define IDC_EDIT_SCREEN_BUFFER_HEIGHT 502 +#define IDC_UPDOWN_SCREEN_BUFFER_HEIGHT 503 +#define IDC_EDIT_WINDOW_SIZE_WIDTH 504 +#define IDC_UPDOWN_WINDOW_SIZE_WIDTH 505 +#define IDC_EDIT_WINDOW_SIZE_HEIGHT 506 +#define IDC_UPDOWN_WINDOW_SIZE_HEIGHT 507 +#define IDC_EDIT_WINDOW_POS_LEFT 508 +#define IDC_UPDOWN_WINDOW_POS_LEFT 509 +#define IDC_EDIT_WINDOW_POS_TOP 510 +#define IDC_UPDOWN_WINDOW_POS_TOP 511 +#define IDC_CHECK_SYSTEM_POS_WINDOW 512 +#define IDC_STATIC_LAYOUT_WINDOW_PREVIEW 513 // Color dialog #define IDC_RADIO_SCREEN_TEXT 600 @@ -86,5 +86,4 @@ #define IDC_STATIC_COLOR16 627 // String IDs -#define IDS_SCREEN_TEXT 700 -#define IDS_RASTERFONTS 701 +#define IDS_RASTERFONTS 700 Index: dll/cpl/console/rsrc.rc =================================================================== --- dll/cpl/console/rsrc.rc (rvision 58607) +++ dll/cpl/console/rsrc.rc (copie de travail) @@ -1,5 +1,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +// UTF-8 +#pragma code_page(65001) #ifdef LANGUAGE_BG_BG #include "lang/bg-BG.rc" #endif @@ -18,6 +20,9 @@ #ifdef LANGUAGE_FR_FR #include "lang/fr-FR.rc" #endif +#ifdef LANGUAGE_HE_IL + #include "lang/he-IL.rc" +#endif #ifdef LANGUAGE_ID_ID #include "lang/id-ID.rc" #endif @@ -27,18 +32,6 @@ #ifdef LANGUAGE_NB_NO #include "lang/no-NO.rc" #endif -#ifdef LANGUAGE_SK_SK - #include "lang/sk-SK.rc" -#endif -#ifdef LANGUAGE_ZH_CN - #include "lang/zh-CN.rc" -#endif - -// UTF-8 -#pragma code_page(65001) -#ifdef LANGUAGE_HE_IL - #include "lang/he-IL.rc" -#endif #ifdef LANGUAGE_PL_PL #include "lang/pl-PL.rc" #endif @@ -48,6 +41,12 @@ #ifdef LANGUAGE_RU_RU #include "lang/ru-RU.rc" #endif +#ifdef LANGUAGE_SK_SK + #include "lang/sk-SK.rc" +#endif #ifdef LANGUAGE_UK_UA #include "lang/uk-UA.rc" #endif +#ifdef LANGUAGE_ZH_CN + #include "lang/zh-CN.rc" +#endif Index: dll/ntdll/csr/api.c =================================================================== --- dll/ntdll/csr/api.c (rvision 58607) +++ dll/ntdll/csr/api.c (copie de travail) @@ -6,16 +6,17 @@ * PROGRAMMER: Alex Ionescu (alex@relsoft.net) */ -/* INCLUDES *****************************************************************/ +/* INCLUDES *******************************************************************/ #include #define NDEBUG #include -/* GLOBALS *******************************************************************/ +/* GLOBALS ********************************************************************/ + extern HANDLE CsrApiPort; -/* FUNCTIONS *****************************************************************/ +/* FUNCTIONS ******************************************************************/ /* * @implemented @@ -37,8 +38,8 @@ PULONG PriorityClass) { NTSTATUS Status; - CSR_API_MESSAGE2 ApiMessage; /* <- Remove the "2" when CSR is commited */ - PCSR_SET_PRIORITY_CLASS SetPriorityClass = &ApiMessage.SetPriorityClass; + CSR_API_MESSAGE ApiMessage; + PCSR_SET_PRIORITY_CLASS SetPriorityClass = &ApiMessage.Data.SetPriorityClass; /* Set up the data for CSR */ DbgBreakPoint(); @@ -46,12 +47,11 @@ SetPriorityClass->PriorityClass = *PriorityClass; /* Call it */ - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + Status = CsrClientCallServer(&ApiMessage, NULL, - CSR_MAKE_OPCODE(CsrpSetPriorityClass, - CSR_SRV_SERVER), + CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX, CsrpSetPriorityClass), sizeof(CSR_SET_PRIORITY_CLASS)); - + /* Return what we got, if requested */ if (*PriorityClass) *PriorityClass = SetPriorityClass->PriorityClass; @@ -64,23 +64,22 @@ */ NTSTATUS NTAPI -CsrIdentifyAlertableThread (VOID) +CsrIdentifyAlertableThread(VOID) { NTSTATUS Status; - CSR_API_MESSAGE2 ApiMessage; /* <- Remove the "2" when CSR is commited */ + CSR_API_MESSAGE ApiMessage; PCSR_IDENTIFY_ALTERTABLE_THREAD IdentifyAlertableThread; - + /* Set up the data for CSR */ DbgBreakPoint(); - IdentifyAlertableThread = &ApiMessage.IdentifyAlertableThread; + IdentifyAlertableThread = &ApiMessage.Data.IdentifyAlertableThread; IdentifyAlertableThread->Cid = NtCurrentTeb()->ClientId; /* Call it */ - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + Status = CsrClientCallServer(&ApiMessage, NULL, - CSR_MAKE_OPCODE(CsrpIdentifyAlertable, - CSR_SRV_SERVER), - sizeof(CSR_SET_PRIORITY_CLASS)); + CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX, CsrpIdentifyAlertable), + sizeof(CSR_IDENTIFY_ALTERTABLE_THREAD)); /* Return to caller */ return Status; Index: dll/ntdll/csr/capture.c =================================================================== --- dll/ntdll/csr/capture.c (rvision 58607) +++ dll/ntdll/csr/capture.c (copie de travail) @@ -6,16 +6,17 @@ * PROGRAMMER: Alex Ionescu (alex@relsoft.net) */ -/* INCLUDES *****************************************************************/ +/* INCLUDES *******************************************************************/ #include #define NDEBUG #include -/* GLOBALS *******************************************************************/ +/* GLOBALS ********************************************************************/ + extern HANDLE CsrPortHeap; -/* FUNCTIONS *****************************************************************/ +/* FUNCTIONS ******************************************************************/ /* * @implemented @@ -82,34 +83,37 @@ /* * @implemented */ -PVOID +PCSR_CAPTURE_BUFFER NTAPI -CsrAllocateCaptureBuffer(ULONG ArgumentCount, - ULONG BufferSize) +CsrAllocateCaptureBuffer(IN ULONG ArgumentCount, + IN ULONG BufferSize) { PCSR_CAPTURE_BUFFER CaptureBuffer; /* Validate size */ if (BufferSize >= MAXLONG) return NULL; - /* Add the size of the header and for each pointer to the pointers */ - BufferSize += sizeof(CSR_CAPTURE_BUFFER) + (ArgumentCount * sizeof(PVOID)); + /* Add the size of the header and for each offset to the pointers */ + BufferSize += FIELD_OFFSET(CSR_CAPTURE_BUFFER, PointerOffsetsArray) + (ArgumentCount * sizeof(ULONG_PTR)); + /* Align it to a 4-byte boundary */ + BufferSize = (BufferSize + 3) & ~3; + /* Allocate memory from the port heap */ - CaptureBuffer = RtlAllocateHeap(CsrPortHeap, 0, BufferSize); + CaptureBuffer = RtlAllocateHeap(CsrPortHeap, HEAP_ZERO_MEMORY, BufferSize); if (CaptureBuffer == NULL) return NULL; /* Initialize the header */ CaptureBuffer->Size = BufferSize; CaptureBuffer->PointerCount = 0; - /* Initialize all the pointers */ - RtlZeroMemory(CaptureBuffer->PointerArray, + /* Initialize all the offsets */ + RtlZeroMemory(CaptureBuffer->PointerOffsetsArray, ArgumentCount * sizeof(ULONG_PTR)); - /* Point the start of the free buffer */ - CaptureBuffer->BufferEnd = (ULONG_PTR)CaptureBuffer->PointerArray + - ArgumentCount * sizeof(ULONG_PTR); + /* Point to the start of the free buffer */ + CaptureBuffer->BufferEnd = (PVOID)((ULONG_PTR)CaptureBuffer->PointerOffsetsArray + + ArgumentCount * sizeof(ULONG_PTR)); /* Return the address of the buffer */ return CaptureBuffer; @@ -120,20 +124,19 @@ */ ULONG NTAPI -CsrAllocateMessagePointer(PCSR_CAPTURE_BUFFER CaptureBuffer, - ULONG MessageLength, - PVOID *CaptureData) +CsrAllocateMessagePointer(IN OUT PCSR_CAPTURE_BUFFER CaptureBuffer, + IN ULONG MessageLength, + OUT PVOID *CapturedData) { - /* If there's no data, our job is easy. */ if (MessageLength == 0) { - *CaptureData = NULL; - CaptureData = NULL; + *CapturedData = NULL; + CapturedData = NULL; } else { /* Set the capture data at our current available buffer */ - *CaptureData = (PVOID)CaptureBuffer->BufferEnd; + *CapturedData = CaptureBuffer->BufferEnd; /* Validate the size */ if (MessageLength >= MAXLONG) return 0; @@ -142,15 +145,12 @@ MessageLength = (MessageLength + 3) & ~3; /* Move our available buffer beyond this space */ - CaptureBuffer->BufferEnd += MessageLength; + CaptureBuffer->BufferEnd = (PVOID)((ULONG_PTR)CaptureBuffer->BufferEnd + MessageLength); } - /* Write down this pointer in the array */ - CaptureBuffer->PointerArray[CaptureBuffer->PointerCount] = (ULONG_PTR)CaptureData; + /* Write down this pointer in the array and increase the count */ + CaptureBuffer->PointerOffsetsArray[CaptureBuffer->PointerCount++] = (ULONG_PTR)CapturedData; - /* Increase the pointer count */ - CaptureBuffer->PointerCount++; - /* Return the aligned length */ return MessageLength; } @@ -160,19 +160,19 @@ */ VOID NTAPI -CsrCaptureMessageBuffer(PCSR_CAPTURE_BUFFER CaptureBuffer, - PVOID MessageString, - ULONG StringLength, - PVOID *CapturedData) +CsrCaptureMessageBuffer(IN OUT PCSR_CAPTURE_BUFFER CaptureBuffer, + IN PVOID MessageBuffer OPTIONAL, + IN ULONG MessageLength, + OUT PVOID *CapturedData) { /* Simply allocate a message pointer in the buffer */ - CsrAllocateMessagePointer(CaptureBuffer, StringLength, CapturedData); + CsrAllocateMessagePointer(CaptureBuffer, MessageLength, CapturedData); /* Check if there was any data */ - if (!MessageString || !StringLength) return; + if (!MessageBuffer || !MessageLength) return; /* Copy the data into the buffer */ - RtlMoveMemory(*CapturedData, MessageString, StringLength); + RtlMoveMemory(*CapturedData, MessageBuffer, MessageLength); } /* @@ -180,14 +180,14 @@ */ VOID NTAPI -CsrFreeCaptureBuffer(PCSR_CAPTURE_BUFFER CaptureBuffer) +CsrFreeCaptureBuffer(IN PCSR_CAPTURE_BUFFER CaptureBuffer) { /* Free it from the heap */ RtlFreeHeap(CsrPortHeap, 0, CaptureBuffer); } /* - * @implemented + * @unimplemented */ NTSTATUS NTAPI @@ -206,8 +206,8 @@ */ VOID NTAPI -CsrCaptureMessageString(PCSR_CAPTURE_BUFFER CaptureBuffer, - LPSTR String, +CsrCaptureMessageString(IN OUT PCSR_CAPTURE_BUFFER CaptureBuffer, + IN LPSTR String OPTIONAL, IN ULONG StringLength, IN ULONG MaximumLength, OUT PANSI_STRING CapturedString) @@ -256,14 +256,14 @@ */ PLARGE_INTEGER NTAPI -CsrCaptureTimeout(LONG Milliseconds, - PLARGE_INTEGER Timeout) +CsrCaptureTimeout(IN ULONG Milliseconds, + OUT PLARGE_INTEGER Timeout) { /* Validate the time */ if (Milliseconds == -1) return NULL; /* Convert to relative ticks */ - Timeout->QuadPart = Milliseconds * -100000; + Timeout->QuadPart = Int32x32To64(Milliseconds, -10000); return Timeout; } Index: dll/ntdll/csr/connect.c =================================================================== --- dll/ntdll/csr/connect.c (rvision 58607) +++ dll/ntdll/csr/connect.c (copie de travail) @@ -6,13 +6,13 @@ * PROGRAMMER: Alex Ionescu (alex@relsoft.net) */ -/* INCLUDES *****************************************************************/ +/* INCLUDES *******************************************************************/ #include #define NDEBUG #include -/* GLOBALS *******************************************************************/ +/* GLOBALS ********************************************************************/ HANDLE CsrApiPort; HANDLE CsrProcessId; @@ -27,9 +27,8 @@ PCSR_SERVER_API_ROUTINE CsrServerApiRoutine; #define UNICODE_PATH_SEP L"\\" -#define CSR_PORT_NAME L"ApiPort" -/* FUNCTIONS *****************************************************************/ +/* FUNCTIONS ******************************************************************/ /* * @implemented @@ -46,136 +45,138 @@ */ NTSTATUS NTAPI -CsrClientCallServer(PCSR_API_MESSAGE ApiMessage, - PCSR_CAPTURE_BUFFER CaptureBuffer OPTIONAL, - CSR_API_NUMBER ApiNumber, - ULONG RequestLength) +CsrClientCallServer(IN OUT PCSR_API_MESSAGE ApiMessage, + IN OUT PCSR_CAPTURE_BUFFER CaptureBuffer OPTIONAL, + IN CSR_API_NUMBER ApiNumber, + IN ULONG DataLength) { NTSTATUS Status; ULONG PointerCount; - PULONG_PTR Pointers; - ULONG_PTR CurrentPointer; - DPRINT("CsrClientCallServer\n"); + PULONG_PTR OffsetPointer; - /* Fill out the Port Message Header */ + /* Fill out the Port Message Header. */ ApiMessage->Header.u2.ZeroInit = 0; - ApiMessage->Header.u1.s1.DataLength = RequestLength - sizeof(PORT_MESSAGE); - ApiMessage->Header.u1.s1.TotalLength = RequestLength; + ApiMessage->Header.u1.s1.TotalLength = + FIELD_OFFSET(CSR_API_MESSAGE, Data) + DataLength; + ApiMessage->Header.u1.s1.DataLength = + ApiMessage->Header.u1.s1.TotalLength - sizeof(PORT_MESSAGE); - /* Fill out the CSR Header */ - ApiMessage->Type = ApiNumber; - //ApiMessage->Opcode = ApiNumber; <- Activate with new CSR + /* Fill out the CSR Header. */ + ApiMessage->ApiNumber = ApiNumber; ApiMessage->CsrCaptureData = NULL; - DPRINT("API: %lx, u1.s1.DataLength: %x, u1.s1.TotalLength: %x\n", + DPRINT("API: %lx, u1.s1.DataLength: %x, u1.s1.TotalLength: %x\n", ApiNumber, ApiMessage->Header.u1.s1.DataLength, ApiMessage->Header.u1.s1.TotalLength); - /* Check if we are already inside a CSR Server */ + /* Check if we are already inside a CSR Server. */ if (!InsideCsrProcess) { - /* Check if we got a a Capture Buffer */ + /* Check if we got a Capture Buffer. */ if (CaptureBuffer) { - /* We have to convert from our local view to the remote view */ - ApiMessage->CsrCaptureData = (PVOID)((ULONG_PTR)CaptureBuffer + - CsrPortMemoryDelta); + /* + * We have to convert from our local (client) view + * to the remote (server) view. + */ + ApiMessage->CsrCaptureData = (PCSR_CAPTURE_BUFFER) + ((ULONG_PTR)CaptureBuffer + CsrPortMemoryDelta); - /* Lock the buffer */ - CaptureBuffer->BufferEnd = 0; + /* Lock the buffer. */ + CaptureBuffer->BufferEnd = NULL; - /* Get the pointer information */ - PointerCount = CaptureBuffer->PointerCount; - Pointers = CaptureBuffer->PointerArray; - - /* Loop through every pointer and convert it */ - DPRINT("PointerCount: %lx\n", PointerCount); + /* + * Each client pointer inside the CSR message is converted into + * a server pointer, and each pointer to these message pointers + * is converted into an offset. + */ + PointerCount = CaptureBuffer->PointerCount; + OffsetPointer = CaptureBuffer->PointerOffsetsArray; while (PointerCount--) { - /* Get this pointer and check if it's valid */ - DPRINT("Array Address: %p. This pointer: %p. Data: %lx\n", - &Pointers, Pointers, *Pointers); - if ((CurrentPointer = *Pointers++)) + if (*OffsetPointer != 0) { - /* Update it */ - DPRINT("CurrentPointer: %lx.\n", *(PULONG_PTR)CurrentPointer); - *(PULONG_PTR)CurrentPointer += CsrPortMemoryDelta; - Pointers[-1] = CurrentPointer - (ULONG_PTR)ApiMessage; - DPRINT("CurrentPointer: %lx.\n", *(PULONG_PTR)CurrentPointer); + *(PULONG_PTR)*OffsetPointer += CsrPortMemoryDelta; + *OffsetPointer -= (ULONG_PTR)ApiMessage; } + ++OffsetPointer; } } - /* Send the LPC Message */ + /* Send the LPC Message. */ Status = NtRequestWaitReplyPort(CsrApiPort, &ApiMessage->Header, &ApiMessage->Header); - /* Check if we got a a Capture Buffer */ + /* Check if we got a Capture Buffer. */ if (CaptureBuffer) { - /* We have to convert from the remote view to our remote view */ - DPRINT("Reconverting CaptureBuffer\n"); - ApiMessage->CsrCaptureData = (PVOID)((ULONG_PTR) - ApiMessage->CsrCaptureData - - CsrPortMemoryDelta); + /* + * We have to convert back from the remote (server) view + * to our local (client) view. + */ + ApiMessage->CsrCaptureData = (PCSR_CAPTURE_BUFFER) + ((ULONG_PTR)ApiMessage->CsrCaptureData - CsrPortMemoryDelta); - /* Get the pointer information */ - PointerCount = CaptureBuffer->PointerCount; - Pointers = CaptureBuffer->PointerArray; - - /* Loop through every pointer and convert it */ + /* + * Convert back the offsets into pointers to CSR message + * pointers, and convert back these message server pointers + * into client pointers. + */ + PointerCount = CaptureBuffer->PointerCount; + OffsetPointer = CaptureBuffer->PointerOffsetsArray; while (PointerCount--) { - /* Get this pointer and check if it's valid */ - if ((CurrentPointer = *Pointers++)) + if (*OffsetPointer != 0) { - /* Update it */ - CurrentPointer += (ULONG_PTR)ApiMessage; - Pointers[-1] = CurrentPointer; - *(PULONG_PTR)CurrentPointer -= CsrPortMemoryDelta; + *OffsetPointer += (ULONG_PTR)ApiMessage; + *(PULONG_PTR)*OffsetPointer -= CsrPortMemoryDelta; } + ++OffsetPointer; } } - /* Check for success */ + /* Check for success. */ if (!NT_SUCCESS(Status)) { - /* We failed. Overwrite the return value with the failure */ + /* We failed. Overwrite the return value with the failure. */ DPRINT1("LPC Failed: %lx\n", Status); ApiMessage->Status = Status; } } else { - /* This is a server-to-server call. Save our CID and do a direct call */ + /* This is a server-to-server call. Save our CID and do a direct call. */ DPRINT1("Next gen server-to-server call\n"); + + /* We check this equality inside CsrValidateMessageBuffer. */ ApiMessage->Header.ClientId = NtCurrentTeb()->ClientId; + Status = CsrServerApiRoutine(&ApiMessage->Header, &ApiMessage->Header); - - /* Check for success */ + + /* Check for success. */ if (!NT_SUCCESS(Status)) { - /* We failed. Overwrite the return value with the failure */ + /* We failed. Overwrite the return value with the failure. */ ApiMessage->Status = Status; } } - /* Return the CSR Result */ + /* Return the CSR Result. */ DPRINT("Got back: 0x%lx\n", ApiMessage->Status); return ApiMessage->Status; } NTSTATUS NTAPI -CsrConnectToServer(IN PWSTR ObjectDirectory) +CsrpConnectToServer(IN PWSTR ObjectDirectory) { + NTSTATUS Status; ULONG PortNameLength; UNICODE_STRING PortName; LARGE_INTEGER CsrSectionViewSize; - NTSTATUS Status; HANDLE CsrSectionHandle; PORT_VIEW LpcWrite; REMOTE_PORT_VIEW LpcRead; @@ -202,7 +203,7 @@ PortName.MaximumLength = PortNameLength; /* Allocate a buffer for it */ - PortName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, PortNameLength); + PortName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, PortNameLength); if (PortName.Buffer == NULL) { return STATUS_INSUFFICIENT_RESOURCES; @@ -306,6 +307,8 @@ 0); if (CsrPortHeap == NULL) { + /* Failure */ + DPRINT1("Couldn't create heap for CSR port\n"); NtClose(CsrApiPort); CsrApiPort = NULL; return STATUS_INSUFFICIENT_RESOURCES; @@ -320,24 +323,24 @@ */ NTSTATUS NTAPI -CsrClientConnectToServer(PWSTR ObjectDirectory, - ULONG ServerId, - PVOID ConnectionInfo, - PULONG ConnectionInfoSize, - PBOOLEAN ServerToServerCall) +CsrClientConnectToServer(IN PWSTR ObjectDirectory, + IN ULONG ServerId, + IN PVOID ConnectionInfo, + IN OUT PULONG ConnectionInfoSize, + OUT PBOOLEAN ServerToServerCall) { NTSTATUS Status; PIMAGE_NT_HEADERS NtHeader; UNICODE_STRING CsrSrvName; HANDLE hCsrSrv; ANSI_STRING CsrServerRoutineName; + CSR_API_MESSAGE ApiMessage; + PCSR_CLIENT_CONNECT ClientConnect = &ApiMessage.Data.CsrClientConnect; PCSR_CAPTURE_BUFFER CaptureBuffer; - CSR_API_MESSAGE RosApiMessage; - CSR_API_MESSAGE2 ApiMessage; - PCSR_CLIENT_CONNECT ClientConnect = &ApiMessage.ClientConnect; + DPRINT("CsrClientConnectToServer: %lx %p\n", ServerId, ConnectionInfo); + /* Validate the Connection Info */ - DPRINT("CsrClientConnectToServer: %lx %p\n", ServerId, ConnectionInfo); if (ConnectionInfo && (!ConnectionInfoSize || !*ConnectionInfoSize)) { DPRINT1("Connection info given, but no length\n"); @@ -400,7 +403,7 @@ if (!CsrApiPort) { /* No, set it up now */ - if (!NT_SUCCESS(Status = CsrConnectToServer(ObjectDirectory))) + if (!NT_SUCCESS(Status = CsrpConnectToServer(ObjectDirectory))) { /* Failed */ DPRINT1("Failure to connect to CSR\n"); @@ -413,38 +416,34 @@ ClientConnect->ConnectionInfoSize = *ConnectionInfoSize; /* Setup a buffer for the connection info */ - CaptureBuffer = CsrAllocateCaptureBuffer(1, - ClientConnect->ConnectionInfoSize); + CaptureBuffer = CsrAllocateCaptureBuffer(1, ClientConnect->ConnectionInfoSize); if (CaptureBuffer == NULL) { return STATUS_INSUFFICIENT_RESOURCES; } - /* Allocate a pointer for the connection info*/ - CsrAllocateMessagePointer(CaptureBuffer, - ClientConnect->ConnectionInfoSize, - &ClientConnect->ConnectionInfo); + /* Capture the connection info data */ + CsrCaptureMessageBuffer(CaptureBuffer, + ConnectionInfo, + ClientConnect->ConnectionInfoSize, + &ClientConnect->ConnectionInfo); - /* Copy the data into the buffer */ - RtlMoveMemory(ClientConnect->ConnectionInfo, - ConnectionInfo, - ClientConnect->ConnectionInfoSize); - /* Return the allocated length */ *ConnectionInfoSize = ClientConnect->ConnectionInfoSize; /* Call CSR */ -#if 0 Status = CsrClientCallServer(&ApiMessage, CaptureBuffer, - CSR_MAKE_OPCODE(CsrpClientConnect, - CSR_SRV_DLL), + CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX, CsrpClientConnect), sizeof(CSR_CLIENT_CONNECT)); -#endif - Status = CsrClientCallServer(&RosApiMessage, - NULL, - MAKE_CSR_API(CONNECT_PROCESS, CSR_NATIVE), - sizeof(CSR_API_MESSAGE)); + + /* Copy the updated connection info data back into the user buffer */ + RtlMoveMemory(ConnectionInfo, + ClientConnect->ConnectionInfo, + *ConnectionInfoSize); + + /* Free the capture buffer */ + CsrFreeCaptureBuffer(CaptureBuffer); } else { @@ -455,6 +454,7 @@ /* Let the caller know if this was server to server */ DPRINT("Status was: 0x%lx. Are we in server: 0x%x\n", Status, InsideCsrProcess); if (ServerToServerCall) *ServerToServerCall = InsideCsrProcess; + return Status; } Index: dll/ntdll/include/ntdll.h =================================================================== --- dll/ntdll/include/ntdll.h (rvision 58607) +++ dll/ntdll/include/ntdll.h (copie de travail) @@ -44,8 +44,9 @@ /* Internal NTDLL */ #include "ntdllp.h" -/* CSRSS Header */ -#include +/* CSRSS Headers */ +#include +#include /* PSEH */ #include Index: dll/ntdll/include/ntdllp.h =================================================================== --- dll/ntdll/include/ntdllp.h (rvision 58607) +++ dll/ntdll/include/ntdllp.h (copie de travail) @@ -143,11 +143,11 @@ /* FIXME: Cleanup this mess */ typedef NTSTATUS (NTAPI *PEPFUNC)(PPEB); NTSTATUS LdrMapSections(HANDLE ProcessHandle, - PVOID ImageBase, - HANDLE SectionHandle, - PIMAGE_NT_HEADERS NTHeaders); + PVOID ImageBase, + HANDLE SectionHandle, + PIMAGE_NT_HEADERS NTHeaders); NTSTATUS LdrMapNTDllForProcess(HANDLE ProcessHandle, - PHANDLE NTDllSectionHandle); + PHANDLE NTDllSectionHandle); ULONG LdrpGetResidentSize(PIMAGE_NT_HEADERS NTHeaders); @@ -162,7 +162,5 @@ VOID NTAPI LdrpFinalizeAndDeallocateDataTableEntry(IN PLDR_DATA_TABLE_ENTRY Entry); - -extern HANDLE WindowsApiPort; /* EOF */ Index: dll/win32/kernel32/client/console =================================================================== --- dll/win32/kernel32/client/console (rvision 58607) +++ dll/win32/kernel32/client/console (copie de travail) Modification de proprits sur dll/win32/kernel32/client/console ___________________________________________________________________ Added: bugtraq:url ## -0,0 +1 ## +http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID% \ No newline at end of property Added: bugtraq:message ## -0,0 +1 ## +See issue #%BUGID% for more details. \ No newline at end of property Added: tsvn:logminsize ## -0,0 +1 ## +10 \ No newline at end of property Added: bugtraq:logregex ## -0,0 +1,2 ## +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+) \ No newline at end of property Index: dll/win32/kernel32/client/console/alias.c =================================================================== --- dll/win32/kernel32/client/console/alias.c (rvision 0) +++ dll/win32/kernel32/client/console/alias.c (copie de travail) @@ -0,0 +1,598 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: dll/win32/kernel32/client/console/alias.c + * PURPOSE: Win32 Console Client Alias support functions + * PROGRAMMERS: David Welch (welch@cwcom.net) (welch@mcmail.com) + * Christoph von Wittich (christoph_vw@reactos.org) + * Johannes Anderwald (janderwald@reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + + +/* FUNCTIONS ******************************************************************/ + +/* + * @implemented + */ +BOOL +WINAPI +AddConsoleAliasW(LPCWSTR lpSource, + LPCWSTR lpTarget, + LPCWSTR lpExeName) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_ADDGETALIAS ConsoleAliasRequest = &ApiMessage.Data.ConsoleAliasRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + ULONG CapturedStrings; + + DPRINT("AddConsoleAliasW enterd with lpSource %S lpTarget %S lpExeName %S\n", lpSource, lpTarget, lpExeName); + + /* Determine the needed sizes */ + ConsoleAliasRequest->SourceLength = (wcslen(lpSource ) + 1) * sizeof(WCHAR); + ConsoleAliasRequest->ExeLength = (wcslen(lpExeName) + 1) * sizeof(WCHAR); + CapturedStrings = 2; + + if (lpTarget) /* The target can be optional */ + { + ConsoleAliasRequest->TargetLength = (wcslen(lpTarget) + 1) * sizeof(WCHAR); + CapturedStrings++; + } + else + { + ConsoleAliasRequest->TargetLength = 0; + } + + /* Allocate a Capture Buffer */ + CaptureBuffer = CsrAllocateCaptureBuffer(CapturedStrings, + ConsoleAliasRequest->SourceLength + + ConsoleAliasRequest->ExeLength + + ConsoleAliasRequest->TargetLength); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + /* Capture the strings */ + CsrCaptureMessageBuffer(CaptureBuffer, + (PVOID)lpSource, + ConsoleAliasRequest->SourceLength, + (PVOID*)&ConsoleAliasRequest->Source); + + CsrCaptureMessageBuffer(CaptureBuffer, + (PVOID)lpExeName, + ConsoleAliasRequest->ExeLength, + (PVOID*)&ConsoleAliasRequest->Exe); + + if (lpTarget) /* The target can be optional */ + { + CsrCaptureMessageBuffer(CaptureBuffer, + (PVOID)lpTarget, + ConsoleAliasRequest->TargetLength, + (PVOID*)&ConsoleAliasRequest->Target); + } + else + { + ConsoleAliasRequest->Target = NULL; + } + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepAddAlias), + sizeof(CONSOLE_ADDGETALIAS)); + + CsrFreeCaptureBuffer(CaptureBuffer); + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +AddConsoleAliasA(LPCSTR lpSource, + LPCSTR lpTarget, + LPCSTR lpExeName) +{ + LPWSTR lpSourceW = NULL; + LPWSTR lpTargetW = NULL; + LPWSTR lpExeNameW = NULL; + BOOL bRetVal; + + if (lpSource) + BasepAnsiStringToHeapUnicodeString(lpSource, (LPWSTR*)&lpSourceW); + if (lpTarget) + BasepAnsiStringToHeapUnicodeString(lpTarget, (LPWSTR*)&lpTargetW); + if (lpExeName) + BasepAnsiStringToHeapUnicodeString(lpExeName, (LPWSTR*)&lpExeNameW); + + bRetVal = AddConsoleAliasW(lpSourceW, lpTargetW, lpExeNameW); + + /* Clean up */ + if (lpSourceW) + RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*)lpSourceW); + if (lpTargetW) + RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*)lpTargetW); + if (lpExeNameW) + RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*)lpExeNameW); + + return bRetVal; +} + + +/* + * @implemented + */ +DWORD +WINAPI +GetConsoleAliasW(LPWSTR lpSource, + LPWSTR lpTargetBuffer, + DWORD TargetBufferLength, + LPWSTR lpExeName) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_ADDGETALIAS ConsoleAliasRequest = &ApiMessage.Data.ConsoleAliasRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + + DPRINT("GetConsoleAliasW entered with lpSource %S lpExeName %S\n", lpSource, lpExeName); + + if (lpTargetBuffer == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + /* Determine the needed sizes */ + ConsoleAliasRequest->SourceLength = (wcslen(lpSource ) + 1) * sizeof(WCHAR); + ConsoleAliasRequest->ExeLength = (wcslen(lpExeName) + 1) * sizeof(WCHAR); + + ConsoleAliasRequest->Target = NULL; + ConsoleAliasRequest->TargetLength = TargetBufferLength; + + /* Allocate a Capture Buffer */ + CaptureBuffer = CsrAllocateCaptureBuffer(3, ConsoleAliasRequest->SourceLength + + ConsoleAliasRequest->ExeLength + + ConsoleAliasRequest->TargetLength); + if (!CaptureBuffer) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + + /* Capture the strings */ + CsrCaptureMessageBuffer(CaptureBuffer, + (PVOID)lpSource, + ConsoleAliasRequest->SourceLength, + (PVOID*)&ConsoleAliasRequest->Source); + + CsrCaptureMessageBuffer(CaptureBuffer, + (PVOID)lpExeName, + ConsoleAliasRequest->ExeLength, + (PVOID*)&ConsoleAliasRequest->Exe); + + /* Allocate space for the target buffer */ + CsrAllocateMessagePointer(CaptureBuffer, + ConsoleAliasRequest->TargetLength, + (PVOID*)&ConsoleAliasRequest->Target); + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetAlias), + sizeof(CONSOLE_ADDGETALIAS)); + if (!NT_SUCCESS(Status)) + { + CsrFreeCaptureBuffer(CaptureBuffer); + BaseSetLastNTError(Status); + return 0; + } + + /* Copy the returned target string into the user buffer */ + // wcscpy(lpTargetBuffer, ConsoleAliasRequest->Target); + memcpy(lpTargetBuffer, + ConsoleAliasRequest->Target, + ConsoleAliasRequest->TargetLength); + + /* Release the capture buffer and exit */ + CsrFreeCaptureBuffer(CaptureBuffer); + + return ConsoleAliasRequest->TargetLength; +} + + +/* + * @implemented + */ +DWORD +WINAPI +GetConsoleAliasA(LPSTR lpSource, + LPSTR lpTargetBuffer, + DWORD TargetBufferLength, + LPSTR lpExeName) +{ + LPWSTR lpwSource; + LPWSTR lpwExeName; + LPWSTR lpwTargetBuffer; + UINT dwSourceSize; + UINT dwExeNameSize; + UINT dwResult; + + DPRINT("GetConsoleAliasA entered\n"); + + if (lpTargetBuffer == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + dwSourceSize = (strlen(lpSource)+1) * sizeof(WCHAR); + lpwSource = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSourceSize); + if (lpwSource == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + MultiByteToWideChar(CP_ACP, 0, lpSource, -1, lpwSource, dwSourceSize); + + dwExeNameSize = (strlen(lpExeName)+1) * sizeof(WCHAR); + lpwExeName = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwExeNameSize); + if (lpwExeName == NULL) + { + HeapFree(GetProcessHeap(), 0, lpwSource); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + MultiByteToWideChar(CP_ACP, 0, lpExeName, -1, lpwExeName, dwExeNameSize); + + lpwTargetBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, TargetBufferLength * sizeof(WCHAR)); + if (lpwTargetBuffer == NULL) + { + HeapFree(GetProcessHeap(), 0, lpwSource); + HeapFree(GetProcessHeap(), 0, lpwExeName); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + + dwResult = GetConsoleAliasW(lpwSource, lpwTargetBuffer, TargetBufferLength * sizeof(WCHAR), lpwExeName); + + HeapFree(GetProcessHeap(), 0, lpwSource); + HeapFree(GetProcessHeap(), 0, lpwExeName); + + if (dwResult) + dwResult = WideCharToMultiByte(CP_ACP, 0, lpwTargetBuffer, dwResult / sizeof(WCHAR), lpTargetBuffer, TargetBufferLength, NULL, NULL); + + HeapFree(GetProcessHeap(), 0, lpwTargetBuffer); + + return dwResult; +} + + +/* + * @implemented + */ +DWORD +WINAPI +GetConsoleAliasesW(LPWSTR AliasBuffer, + DWORD AliasBufferLength, + LPWSTR ExeName) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETALLALIASES GetAllAliasesRequest = &ApiMessage.Data.GetAllAliasesRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + + DPRINT("GetConsoleAliasesW entered\n"); + + /* Determine the needed sizes */ + GetAllAliasesRequest->ExeLength = GetConsoleAliasesLengthW(ExeName); + if (GetAllAliasesRequest->ExeLength == 0 || + GetAllAliasesRequest->ExeLength > AliasBufferLength) + { + return 0; + } + + GetAllAliasesRequest->AliasesBufferLength = AliasBufferLength; + + /* Allocate a Capture Buffer */ + CaptureBuffer = CsrAllocateCaptureBuffer(2, GetAllAliasesRequest->ExeLength + + GetAllAliasesRequest->AliasesBufferLength); + if (!CaptureBuffer) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + + /* Capture the exe name and allocate space for the aliases buffer */ + CsrCaptureMessageBuffer(CaptureBuffer, + (PVOID)ExeName, + GetAllAliasesRequest->ExeLength, + (PVOID*)&GetAllAliasesRequest->ExeName); + + CsrAllocateMessagePointer(CaptureBuffer, + GetAllAliasesRequest->AliasesBufferLength, + (PVOID*)&GetAllAliasesRequest->AliasesBuffer); + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetAliases), + sizeof(CONSOLE_GETALLALIASES)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return 0; + } + + /* Copy the returned aliases string into the user buffer */ + // wcscpy(AliasBuffer, GetAllAliasesRequest->AliasesBuffer); + memcpy(AliasBuffer, + GetAllAliasesRequest->AliasesBuffer, + GetAllAliasesRequest->AliasesBufferLength); + + /* Release the capture buffer and exit */ + CsrFreeCaptureBuffer(CaptureBuffer); + + return GetAllAliasesRequest->AliasesBufferLength; // / sizeof(WCHAR); (original code) +} + + +/* + * @implemented + */ +DWORD +WINAPI +GetConsoleAliasesA(LPSTR AliasBuffer, + DWORD AliasBufferLength, + LPSTR ExeName) +{ + DWORD dwRetVal = 0; + LPWSTR lpwExeName = NULL; + LPWSTR lpwAliasBuffer; + + DPRINT("GetConsoleAliasesA entered\n"); + + if (ExeName) + BasepAnsiStringToHeapUnicodeString(ExeName, (LPWSTR*)&lpwExeName); + + lpwAliasBuffer = HeapAlloc(GetProcessHeap(), 0, AliasBufferLength * sizeof(WCHAR)); + + dwRetVal = GetConsoleAliasesW(lpwAliasBuffer, AliasBufferLength * sizeof(WCHAR), lpwExeName); + + if (lpwExeName) + RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*)lpwExeName); + + if (dwRetVal) + dwRetVal = WideCharToMultiByte(CP_ACP, 0, lpwAliasBuffer, dwRetVal /**/ / sizeof(WCHAR) /**/, AliasBuffer, AliasBufferLength, NULL, NULL); + + HeapFree(GetProcessHeap(), 0, lpwAliasBuffer); + return dwRetVal; +} + + +/* + * @implemented + */ +DWORD +WINAPI +GetConsoleAliasesLengthW(LPWSTR lpExeName) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETALLALIASESLENGTH GetAllAliasesLengthRequest = &ApiMessage.Data.GetAllAliasesLengthRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + + DPRINT("GetConsoleAliasesLengthW entered\n"); + + if (lpExeName == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + GetAllAliasesLengthRequest->ExeLength = (wcslen(lpExeName) + 1) * sizeof(WCHAR); + GetAllAliasesLengthRequest->Length = 0; + + /* Allocate a Capture Buffer */ + CaptureBuffer = CsrAllocateCaptureBuffer(1, GetAllAliasesLengthRequest->ExeLength); + if (!CaptureBuffer) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + + /* Capture the exe name */ + CsrCaptureMessageBuffer(CaptureBuffer, + (PVOID)lpExeName, + GetAllAliasesLengthRequest->ExeLength, + (PVOID)&GetAllAliasesLengthRequest->ExeName); + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetAliasesLength), + sizeof(CONSOLE_GETALLALIASESLENGTH)); + + CsrFreeCaptureBuffer(CaptureBuffer); + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return 0; + } + + return GetAllAliasesLengthRequest->Length; +} + + +/* + * @implemented + */ +DWORD +WINAPI +GetConsoleAliasesLengthA(LPSTR lpExeName) +{ + DWORD dwRetVal = 0; + LPWSTR lpExeNameW = NULL; + + if (lpExeName) + BasepAnsiStringToHeapUnicodeString(lpExeName, (LPWSTR*)&lpExeNameW); + + dwRetVal = GetConsoleAliasesLengthW(lpExeNameW); + if (dwRetVal) + dwRetVal /= sizeof(WCHAR); + + /* Clean up */ + if (lpExeNameW) + RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*)lpExeNameW); + + return dwRetVal; +} + + +/* + * @implemented + */ +DWORD +WINAPI +GetConsoleAliasExesW(LPWSTR lpExeNameBuffer, + DWORD ExeNameBufferLength) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETALIASESEXES GetAliasesExesRequest = &ApiMessage.Data.GetAliasesExesRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + + DPRINT("GetConsoleAliasExesW entered\n"); + + /* Allocate a Capture Buffer */ + CaptureBuffer = CsrAllocateCaptureBuffer(1, ExeNameBufferLength); + if (!CaptureBuffer) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + + GetAliasesExesRequest->Length = ExeNameBufferLength; + + /* Allocate space for the exe name buffer */ + CsrAllocateMessagePointer(CaptureBuffer, + ExeNameBufferLength, + (PVOID*)&GetAliasesExesRequest->ExeNames); + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetAliasExes), + sizeof(CONSOLE_GETALIASESEXES)); + if (!NT_SUCCESS(Status)) + { + CsrFreeCaptureBuffer(CaptureBuffer); + BaseSetLastNTError(Status); + return 0; + } + + /* Copy the returned target string into the user buffer */ + memcpy(lpExeNameBuffer, + GetAliasesExesRequest->ExeNames, + GetAliasesExesRequest->Length); + + /* Release the capture buffer and exit */ + CsrFreeCaptureBuffer(CaptureBuffer); + + return GetAliasesExesRequest->Length; +} + + +/* + * @implemented + */ +DWORD +WINAPI +GetConsoleAliasExesA(LPSTR lpExeNameBuffer, + DWORD ExeNameBufferLength) +{ + LPWSTR lpwExeNameBuffer; + DWORD dwResult; + + DPRINT("GetConsoleAliasExesA entered\n"); + + lpwExeNameBuffer = HeapAlloc(GetProcessHeap(), 0, ExeNameBufferLength * sizeof(WCHAR)); + + dwResult = GetConsoleAliasExesW(lpwExeNameBuffer, ExeNameBufferLength * sizeof(WCHAR)); + + if (dwResult) + dwResult = WideCharToMultiByte(CP_ACP, 0, lpwExeNameBuffer, dwResult / sizeof(WCHAR), lpExeNameBuffer, ExeNameBufferLength, NULL, NULL); + + HeapFree(GetProcessHeap(), 0, lpwExeNameBuffer); + return dwResult; +} + + +/* + * @implemented + */ +DWORD +WINAPI +GetConsoleAliasExesLengthW(VOID) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETALIASESEXESLENGTH GetAliasesExesLengthRequest = &ApiMessage.Data.GetAliasesExesLengthRequest; + + DPRINT("GetConsoleAliasExesLengthW entered\n"); + + GetAliasesExesLengthRequest->Length = 0; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetAliasExesLength), + sizeof(CONSOLE_GETALIASESEXESLENGTH)); + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return 0; + } + + return GetAliasesExesLengthRequest->Length; +} + + +/* + * @implemented + */ +DWORD +WINAPI +GetConsoleAliasExesLengthA(VOID) +{ + DWORD dwLength; + + DPRINT("GetConsoleAliasExesLengthA entered\n"); + + dwLength = GetConsoleAliasExesLengthW(); + + if (dwLength) + dwLength /= sizeof(WCHAR); + + return dwLength; +} + +/* EOF */ Index: dll/win32/kernel32/client/console/alias.c =================================================================== --- dll/win32/kernel32/client/console/alias.c (rvision 58607) +++ dll/win32/kernel32/client/console/alias.c (copie de travail) Modification de proprits sur dll/win32/kernel32/client/console/alias.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: dll/win32/kernel32/client/console/console.c =================================================================== --- dll/win32/kernel32/client/console/console.c (rvision 0) +++ dll/win32/kernel32/client/console/console.c (copie de travail) @@ -0,0 +1,2345 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: dll/win32/kernel32/client/console/console.c + * PURPOSE: Win32 server console functions + * PROGRAMMER: James Tabor + * + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + + +/* GLOBALS ********************************************************************/ + +extern RTL_CRITICAL_SECTION ConsoleLock; +extern BOOL ConsoleInitialized; +extern BOOL WINAPI IsDebuggerPresent(VOID); + +/* Console reserved "file" names */ +static LPCWSTR BaseConFileName = CONSOLE_FILE_NAME; +static LPCWSTR BaseConInputFileName = CONSOLE_INPUT_FILE_NAME; +static LPCWSTR BaseConOutputFileName = CONSOLE_OUTPUT_FILE_NAME; + +PHANDLER_ROUTINE InitialHandler[1]; +PHANDLER_ROUTINE* CtrlHandlers; +ULONG NrCtrlHandlers; +ULONG NrAllocatedHandlers; + +HANDLE InputWaitHandle = INVALID_HANDLE_VALUE; + +#define INPUTEXENAME_BUFLEN 256 +static WCHAR InputExeName[INPUTEXENAME_BUFLEN]; + + +/* Default Console Control Handler ********************************************/ + +BOOL +WINAPI +DefaultConsoleCtrlHandler(DWORD Event) +{ + DPRINT("Default handler called: %lx\n", Event); + switch(Event) + { + case CTRL_C_EVENT: + DPRINT("Ctrl-C Event\n"); + break; + + case CTRL_BREAK_EVENT: + DPRINT("Ctrl-Break Event\n"); + break; + + case CTRL_CLOSE_EVENT: + DPRINT("Ctrl Close Event\n"); + break; + + case CTRL_LOGOFF_EVENT: + DPRINT("Ctrl Logoff Event\n"); + break; + + case CTRL_SHUTDOWN_EVENT: + DPRINT("Ctrl Shutdown Event\n"); + break; + } + + ExitProcess(CONTROL_C_EXIT); + return TRUE; +} + +DWORD +WINAPI +ConsoleControlDispatcher(IN LPVOID lpThreadParameter) +{ + DWORD nExitCode = 0; + DWORD CodeAndFlag = PtrToUlong(lpThreadParameter); + DWORD nCode = CodeAndFlag & MAXLONG; + UINT i; + EXCEPTION_RECORD erException; + + DPRINT1("Console Dispatcher Active: %lx %lx\n", CodeAndFlag, nCode); + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); + + switch(nCode) + { + case CTRL_C_EVENT: + case CTRL_BREAK_EVENT: + { + if (IsDebuggerPresent()) + { + erException.ExceptionCode = (nCode == CTRL_C_EVENT ? + DBG_CONTROL_C : DBG_CONTROL_BREAK); + erException.ExceptionFlags = 0; + erException.ExceptionRecord = NULL; + erException.ExceptionAddress = DefaultConsoleCtrlHandler; + erException.NumberParameters = 0; + + _SEH2_TRY + { + RtlRaiseException(&erException); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + RtlEnterCriticalSection(&ConsoleLock); + + if ((nCode != CTRL_C_EVENT) || + (NtCurrentPeb()->ProcessParameters->ConsoleFlags != 1)) + { + for (i = NrCtrlHandlers; i > 0; i--) + { + if (CtrlHandlers[i - 1](nCode)) break; + } + } + + RtlLeaveCriticalSection(&ConsoleLock); + } + _SEH2_END; + + ExitThread(0); + } + break; + } + + case CTRL_CLOSE_EVENT: + case CTRL_LOGOFF_EVENT: + case CTRL_SHUTDOWN_EVENT: + break; + + case 3: + ExitThread(0); + break; + + case 4: + ExitProcess(CONTROL_C_EXIT); + break; + + default: + ASSERT(FALSE); + break; + } + + ASSERT(ConsoleInitialized); + + RtlEnterCriticalSection(&ConsoleLock); + + nExitCode = 0; + if ((nCode != CTRL_C_EVENT) || (NtCurrentPeb()->ProcessParameters->ConsoleFlags != 1)) + { + for (i = NrCtrlHandlers; i > 0; i--) + { + if ((i == 1) && + (CodeAndFlag & MINLONG) && + ((nCode == CTRL_LOGOFF_EVENT) || (nCode == CTRL_SHUTDOWN_EVENT))) + { + DPRINT("Skipping system/service apps\n"); + break; + } + + if (CtrlHandlers[i - 1](nCode)) + { + switch(nCode) + { + case CTRL_CLOSE_EVENT: + case CTRL_LOGOFF_EVENT: + case CTRL_SHUTDOWN_EVENT: + case 3: + nExitCode = CodeAndFlag; + break; + } + break; + } + } + } + + RtlLeaveCriticalSection(&ConsoleLock); + + ExitThread(nExitCode); + return STATUS_SUCCESS; +} + +VOID +WINAPI +InitConsoleCtrlHandling(VOID) +{ + /* Initialize Console Ctrl Handler */ + NrAllocatedHandlers = NrCtrlHandlers = 1; + CtrlHandlers = InitialHandler; + CtrlHandlers[0] = DefaultConsoleCtrlHandler; +} + + +/* FUNCTIONS ******************************************************************/ + +LPCWSTR +IntCheckForConsoleFileName(IN LPCWSTR pszName, + IN DWORD dwDesiredAccess) +{ + LPCWSTR ConsoleName = pszName; + ULONG DeviceNameInfo; + + /* + * Check whether we deal with a DOS device, and if so, + * strip the path till the file name. + * Therefore, things like \\.\CON or C:\some_path\CONIN$ + * are transformed into CON or CONIN$, for example. + */ + DeviceNameInfo = RtlIsDosDeviceName_U(pszName); + if (DeviceNameInfo != 0) + { + ConsoleName = (LPCWSTR)((ULONG_PTR)ConsoleName + ((DeviceNameInfo >> 16) & 0xFFFF)); + } + + /* Return a standard console "file" name according to what we passed in parameters */ + if (_wcsicmp(ConsoleName, BaseConInputFileName) == 0) + { + return BaseConInputFileName; + } + else if (_wcsicmp(ConsoleName, BaseConOutputFileName) == 0) + { + return BaseConOutputFileName; + } + else if (_wcsicmp(ConsoleName, BaseConFileName) == 0) + { + if ((dwDesiredAccess & (GENERIC_READ | GENERIC_WRITE)) == GENERIC_READ) + { + return BaseConInputFileName; + } + else if ((dwDesiredAccess & (GENERIC_READ | GENERIC_WRITE)) == GENERIC_WRITE) + { + return BaseConOutputFileName; + } + } + + /* If we are there, that means that either the file name or the desired access are wrong */ + return NULL; +} + + +/* + * @unimplemented (Undocumented) + */ +BOOL +WINAPI +ConsoleMenuControl(HANDLE hConsole, + DWORD Unknown1, + DWORD Unknown2) +{ + DPRINT1("ConsoleMenuControl(0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", hConsole, Unknown1, Unknown2); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/* + * @implemented + */ +HANDLE +WINAPI +DuplicateConsoleHandle(HANDLE hConsole, + DWORD dwDesiredAccess, + BOOL bInheritHandle, + DWORD dwOptions) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_DUPLICATEHANDLE DuplicateHandleRequest = &ApiMessage.Data.DuplicateHandleRequest; + + if ( (dwOptions & ~(DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) || + (!(dwOptions & DUPLICATE_SAME_ACCESS) && + (dwDesiredAccess & ~(GENERIC_READ | GENERIC_WRITE))) ) + { + SetLastError (ERROR_INVALID_PARAMETER); + return INVALID_HANDLE_VALUE; + } + + DuplicateHandleRequest->ConsoleHandle = hConsole; + DuplicateHandleRequest->Access = dwDesiredAccess; + DuplicateHandleRequest->Inheritable = bInheritHandle; + DuplicateHandleRequest->Options = dwOptions; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepDuplicateHandle), + sizeof(CONSOLE_DUPLICATEHANDLE)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return INVALID_HANDLE_VALUE; + } + + return DuplicateHandleRequest->ConsoleHandle; +} + + +/* + * @unimplemented + */ +INT +WINAPI +GetConsoleDisplayMode(LPDWORD lpdwMode) + /* + * FUNCTION: Get the console display mode + * ARGUMENTS: + * lpdwMode - Address of variable that receives the current value + * of display mode + * STATUS: Undocumented + */ +{ + DPRINT1("GetConsoleDisplayMode(0x%x) UNIMPLEMENTED!\n", lpdwMode); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + + +/* + * @unimplemented (Undocumented) + */ +DWORD +WINAPI +GetConsoleFontInfo(DWORD Unknown0, + DWORD Unknown1, + DWORD Unknown2, + DWORD Unknown3) +{ + DPRINT1("GetConsoleFontInfo(0x%x, 0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1, Unknown2, Unknown3); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + + +/* + * @unimplemented + */ +COORD +WINAPI +GetConsoleFontSize(HANDLE hConsoleOutput, + DWORD nFont) +{ + COORD Empty = {0, 0}; + DPRINT1("GetConsoleFontSize(0x%x, 0x%x) UNIMPLEMENTED!\n", hConsoleOutput, nFont); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return Empty; +} + + +/* + * @implemented (Undocumented) + */ +DWORD +WINAPI +GetConsoleHardwareState(HANDLE hConsoleOutput, + DWORD Flags, + PDWORD State) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETSETHWSTATE HardwareStateRequest = &ApiMessage.Data.HardwareStateRequest; + + HardwareStateRequest->OutputHandle = hConsoleOutput; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetHardwareState), + sizeof(CONSOLE_GETSETHWSTATE)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + *State = HardwareStateRequest->State; + return TRUE; +} + + +/* + * @implemented (Undocumented) + */ +HANDLE +WINAPI +GetConsoleInputWaitHandle(VOID) +{ + return InputWaitHandle; +} + + +/* + * @unimplemented + */ +INT +WINAPI +GetCurrentConsoleFont(HANDLE hConsoleOutput, + BOOL bMaximumWindow, + PCONSOLE_FONT_INFO lpConsoleCurrentFont) +{ + DPRINT1("GetCurrentConsoleFont(0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", hConsoleOutput, bMaximumWindow, lpConsoleCurrentFont); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + + +/* + * @unimplemented (Undocumented) + */ +ULONG +WINAPI +GetNumberOfConsoleFonts(VOID) +{ + DPRINT1("GetNumberOfConsoleFonts() UNIMPLEMENTED!\n"); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 1; +} + + +/* + * @unimplemented (Undocumented) + */ +DWORD +WINAPI +InvalidateConsoleDIBits(DWORD Unknown0, + DWORD Unknown1) +{ + DPRINT1("InvalidateConsoleDIBits(0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + + +/* + * @unimplemented (Undocumented) + */ +HANDLE +WINAPI +OpenConsoleW(LPCWSTR wsName, + DWORD dwDesiredAccess, + BOOL bInheritHandle, + DWORD dwShareMode) +{ + NTSTATUS Status = STATUS_SUCCESS; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_OPENCONSOLE OpenConsoleRequest = &ApiMessage.Data.OpenConsoleRequest; + CONSOLE_HANDLE_TYPE HandleType; + + if (wsName && 0 == _wcsicmp(wsName, BaseConInputFileName)) + { + HandleType = HANDLE_INPUT; + } + else if (wsName && 0 == _wcsicmp(wsName, BaseConOutputFileName)) + { + HandleType = HANDLE_OUTPUT; + } + else + { + SetLastError(ERROR_INVALID_PARAMETER); + return INVALID_HANDLE_VALUE; + } + + if ( (dwDesiredAccess & ~(GENERIC_READ | GENERIC_WRITE)) || + (dwShareMode & ~(FILE_SHARE_READ | FILE_SHARE_WRITE)) ) + { + SetLastError(ERROR_INVALID_PARAMETER); + return INVALID_HANDLE_VALUE; + } + + OpenConsoleRequest->HandleType = HandleType; + OpenConsoleRequest->Access = dwDesiredAccess; + OpenConsoleRequest->Inheritable = bInheritHandle; + OpenConsoleRequest->ShareMode = dwShareMode; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepOpenConsole), + sizeof(CONSOLE_OPENCONSOLE)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return INVALID_HANDLE_VALUE; + } + + return OpenConsoleRequest->ConsoleHandle; +} + + +/* + * @unimplemented (Undocumented) + */ +BOOL +WINAPI +SetConsoleCursor(DWORD Unknown0, + DWORD Unknown1) +{ + DPRINT1("SetConsoleCursor(0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/* + * @unimplemented + */ +BOOL +WINAPI +SetConsoleDisplayMode(HANDLE hOut, + DWORD dwNewMode, + PCOORD lpdwOldMode) + /* + * FUNCTION: Set the console display mode. + * ARGUMENTS: + * hOut - Standard output handle. + * dwNewMode - New mode. + * lpdwOldMode - Address of a variable that receives the old mode. + */ +{ + DPRINT1("SetConsoleDisplayMode(0x%x, 0x%x, 0x%p) UNIMPLEMENTED!\n", hOut, dwNewMode, lpdwOldMode); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/* + * @unimplemented (Undocumented) + */ +BOOL +WINAPI +SetConsoleFont(DWORD Unknown0, + DWORD Unknown1) +{ + DPRINT1("SetConsoleFont(0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/* + * @implemented (Undocumented) + */ +BOOL +WINAPI +SetConsoleHardwareState(HANDLE hConsoleOutput, + DWORD Flags, + DWORD State) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETSETHWSTATE HardwareStateRequest = &ApiMessage.Data.HardwareStateRequest; + + HardwareStateRequest->OutputHandle = hConsoleOutput; + HardwareStateRequest->State = State; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetHardwareState), + sizeof(CONSOLE_GETSETHWSTATE)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @unimplemented (Undocumented) + */ +BOOL +WINAPI +SetConsoleKeyShortcuts(DWORD Unknown0, + DWORD Unknown1, + DWORD Unknown2, + DWORD Unknown3) +{ + DPRINT1("SetConsoleKeyShortcuts(0x%x, 0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1, Unknown2, Unknown3); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/* + * @unimplemented (Undocumented) + */ +BOOL +WINAPI +SetConsoleMaximumWindowSize(DWORD Unknown0, + DWORD Unknown1) +{ + DPRINT1("SetConsoleMaximumWindowSize(0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/* + * @unimplemented (Undocumented) + */ +BOOL +WINAPI +SetConsoleMenuClose(DWORD Unknown0) +{ + DPRINT1("SetConsoleMenuClose(0x%x) UNIMPLEMENTED!\n", Unknown0); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/* + * @unimplemented (Undocumented) + */ +BOOL +WINAPI +SetConsolePalette(DWORD Unknown0, + DWORD Unknown1, + DWORD Unknown2) +{ + DPRINT1("SetConsolePalette(0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1, Unknown2); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/* + * @unimplemented (Undocumented) + */ +DWORD +WINAPI +ShowConsoleCursor(DWORD Unknown0, + DWORD Unknown1) +{ + DPRINT1("ShowConsoleCursor(0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + + +/* + * FUNCTION: Checks whether the given handle is a valid console handle. + * + * ARGUMENTS: + * Handle - Handle to be checked + * + * RETURNS: + * TRUE: Handle is a valid console handle + * FALSE: Handle is not a valid console handle. + * + * STATUS: Officially undocumented + * + * @implemented + */ +BOOL +WINAPI +VerifyConsoleIoHandle(HANDLE Handle) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + ApiMessage.Data.VerifyHandleRequest.ConsoleHandle = Handle; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepVerifyIoHandle), + sizeof(CONSOLE_VERIFYHANDLE)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @unimplemented + */ +DWORD +WINAPI +WriteConsoleInputVDMA(DWORD Unknown0, + DWORD Unknown1, + DWORD Unknown2, + DWORD Unknown3) +{ + DPRINT1("WriteConsoleInputVDMA(0x%x, 0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1, Unknown2, Unknown3); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + + +/* + * @unimplemented + */ +DWORD +WINAPI +WriteConsoleInputVDMW(DWORD Unknown0, + DWORD Unknown1, + DWORD Unknown2, + DWORD Unknown3) +{ + DPRINT1("WriteConsoleInputVDMW(0x%x, 0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1, Unknown2, Unknown3); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + + +/* + * @implemented (Undocumented) + */ +BOOL +WINAPI +CloseConsoleHandle(HANDLE Handle) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + ApiMessage.Data.CloseHandleRequest.ConsoleHandle = Handle; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepCloseHandle), + sizeof(CONSOLE_CLOSEHANDLE)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +HANDLE +WINAPI +GetStdHandle(DWORD nStdHandle) +/* + * FUNCTION: Get a handle for the standard input, standard output + * and a standard error device. + * + * ARGUMENTS: + * nStdHandle - Specifies the device for which to return the handle. + * + * RETURNS: If the function succeeds, the return value is the handle + * of the specified device. Otherwise the value is INVALID_HANDLE_VALUE. + */ +{ + PRTL_USER_PROCESS_PARAMETERS Ppb = NtCurrentPeb()->ProcessParameters; + + switch (nStdHandle) + { + case STD_INPUT_HANDLE: + return Ppb->StandardInput; + + case STD_OUTPUT_HANDLE: + return Ppb->StandardOutput; + + case STD_ERROR_HANDLE: + return Ppb->StandardError; + } + + SetLastError(ERROR_INVALID_HANDLE); + return INVALID_HANDLE_VALUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +SetStdHandle(DWORD nStdHandle, + HANDLE hHandle) +/* + * FUNCTION: Set the handle for the standard input, standard output or + * the standard error device. + * + * ARGUMENTS: + * nStdHandle - Specifies the handle to be set. + * hHandle - The handle to set. + * + * RETURNS: TRUE if the function succeeds, FALSE otherwise. + */ +{ + PRTL_USER_PROCESS_PARAMETERS Ppb = NtCurrentPeb()->ProcessParameters; + + /* no need to check if hHandle == INVALID_HANDLE_VALUE */ + + switch (nStdHandle) + { + case STD_INPUT_HANDLE: + Ppb->StandardInput = hHandle; + return TRUE; + + case STD_OUTPUT_HANDLE: + Ppb->StandardOutput = hHandle; + return TRUE; + + case STD_ERROR_HANDLE: + Ppb->StandardError = hHandle; + return TRUE; + } + + /* Windows for whatever reason sets the last error to ERROR_INVALID_HANDLE here */ + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; +} + + +/*-------------------------------------------------------------- + * AllocConsole + * + * @implemented + */ +BOOL +WINAPI +AllocConsole(VOID) +{ + NTSTATUS Status; + PRTL_USER_PROCESS_PARAMETERS Parameters = NtCurrentPeb()->ProcessParameters; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_ALLOCCONSOLE AllocConsoleRequest = &ApiMessage.Data.AllocConsoleRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + LPWSTR AppPath = NULL; + SIZE_T Length = 0; + + if (Parameters->ConsoleHandle) + { + DPRINT1("AllocConsole: Allocating a console to a process already having one\n"); + SetLastError(ERROR_ACCESS_DENIED); + return FALSE; + } + + CaptureBuffer = CsrAllocateCaptureBuffer(1, sizeof(CONSOLE_START_INFO)); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + CsrAllocateMessagePointer(CaptureBuffer, + sizeof(CONSOLE_START_INFO), + (PVOID*)&AllocConsoleRequest->ConsoleStartInfo); + +/** Copied from BasepInitConsole **********************************************/ + InitConsoleInfo(AllocConsoleRequest->ConsoleStartInfo); + + AppPath = AllocConsoleRequest->ConsoleStartInfo->AppPath; + Length = min(MAX_PATH, Parameters->ImagePathName.Length / sizeof(WCHAR)); + wcsncpy(AppPath, Parameters->ImagePathName.Buffer, Length); + AppPath[Length] = L'\0'; +/******************************************************************************/ + + AllocConsoleRequest->Console = NULL; + AllocConsoleRequest->CtrlDispatcher = ConsoleControlDispatcher; + AllocConsoleRequest->PropDispatcher = PropDialogHandler; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepAlloc), + sizeof(CONSOLE_ALLOCCONSOLE)); + + CsrFreeCaptureBuffer(CaptureBuffer); + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + Parameters->ConsoleHandle = AllocConsoleRequest->Console; + SetStdHandle(STD_INPUT_HANDLE , AllocConsoleRequest->InputHandle ); + SetStdHandle(STD_OUTPUT_HANDLE, AllocConsoleRequest->OutputHandle); + SetStdHandle(STD_ERROR_HANDLE , AllocConsoleRequest->ErrorHandle ); + + /* Initialize Console Ctrl Handler */ + InitConsoleCtrlHandling(); + + InputWaitHandle = AllocConsoleRequest->InputWaitHandle; + + return TRUE; +} + + +/*-------------------------------------------------------------- + * FreeConsole + * + * @implemented + */ +BOOL +WINAPI +FreeConsole(VOID) +{ + // AG: I'm not sure if this is correct (what happens to std handles?) + // but I just tried to reverse what AllocConsole() does... + + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepFree), + sizeof(CONSOLE_FREECONSOLE)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + NtCurrentPeb()->ProcessParameters->ConsoleHandle = NULL; + + CloseHandle(InputWaitHandle); + InputWaitHandle = INVALID_HANDLE_VALUE; + + return TRUE; +} + + +/*-------------------------------------------------------------- + * GetConsoleScreenBufferInfo + * + * @implemented + */ +BOOL +WINAPI +GetConsoleScreenBufferInfo(HANDLE hConsoleOutput, + PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + if (lpConsoleScreenBufferInfo == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + ApiMessage.Data.ScreenBufferInfoRequest.OutputHandle = hConsoleOutput; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetScreenBufferInfo), + sizeof(CONSOLE_GETSCREENBUFFERINFO)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + *lpConsoleScreenBufferInfo = ApiMessage.Data.ScreenBufferInfoRequest.Info; + + return TRUE; +} + + +/*-------------------------------------------------------------- + * SetConsoleCursorPosition + * + * @implemented + */ +BOOL +WINAPI +SetConsoleCursorPosition(HANDLE hConsoleOutput, + COORD dwCursorPosition) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + ApiMessage.Data.SetCursorPositionRequest.OutputHandle = hConsoleOutput; + ApiMessage.Data.SetCursorPositionRequest.Position = dwCursorPosition; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetCursorPosition), + sizeof(CONSOLE_SETCURSORPOSITION)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/*-------------------------------------------------------------- + * GetConsoleMode + * + * @implemented + */ +BOOL +WINAPI +GetConsoleMode(HANDLE hConsoleHandle, + LPDWORD lpMode) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &ApiMessage.Data.ConsoleModeRequest; + + ConsoleModeRequest->ConsoleHandle = hConsoleHandle; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetMode), + sizeof(CONSOLE_GETSETCONSOLEMODE)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + *lpMode = ConsoleModeRequest->ConsoleMode; + + return TRUE; +} + + +/*-------------------------------------------------------------- + * GetNumberOfConsoleInputEvents + * + * @implemented + */ +BOOL +WINAPI +GetNumberOfConsoleInputEvents(HANDLE hConsoleInput, + LPDWORD lpNumberOfEvents) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETNUMINPUTEVENTS GetNumInputEventsRequest = &ApiMessage.Data.GetNumInputEventsRequest; + + GetNumInputEventsRequest->InputHandle = hConsoleInput; + GetNumInputEventsRequest->NumInputEvents = 0; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetNumberOfInputEvents), + sizeof(CONSOLE_GETNUMINPUTEVENTS)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + if (lpNumberOfEvents == NULL) + { + SetLastError(ERROR_INVALID_ACCESS); + return FALSE; + } + + *lpNumberOfEvents = GetNumInputEventsRequest->NumInputEvents; + + return TRUE; +} + + +/*-------------------------------------------------------------- + * GetLargestConsoleWindowSize + * + * @unimplemented + */ +COORD +WINAPI +GetLargestConsoleWindowSize(HANDLE hConsoleOutput) +{ + COORD Coord = {80,25}; + DPRINT1("GetLargestConsoleWindowSize(0x%x) UNIMPLEMENTED!\n", hConsoleOutput); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return Coord; +} + + +/*-------------------------------------------------------------- + * GetConsoleCursorInfo + * + * @implemented + */ +BOOL +WINAPI +GetConsoleCursorInfo(HANDLE hConsoleOutput, + PCONSOLE_CURSOR_INFO lpConsoleCursorInfo) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + if (!lpConsoleCursorInfo) + { + if (!hConsoleOutput) + SetLastError(ERROR_INVALID_HANDLE); + else + SetLastError(ERROR_INVALID_ACCESS); + + return FALSE; + } + + ApiMessage.Data.CursorInfoRequest.OutputHandle = hConsoleOutput; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetCursorInfo), + sizeof(CONSOLE_GETSETCURSORINFO)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + *lpConsoleCursorInfo = ApiMessage.Data.CursorInfoRequest.Info; + + return TRUE; +} + + +/*-------------------------------------------------------------- + * GetNumberOfConsoleMouseButtons + * + * @unimplemented + */ +BOOL +WINAPI +GetNumberOfConsoleMouseButtons(LPDWORD lpNumberOfMouseButtons) +{ + DPRINT1("GetNumberOfConsoleMouseButtons(0x%x) UNIMPLEMENTED!\n", lpNumberOfMouseButtons); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/*-------------------------------------------------------------- + * SetConsoleMode + * + * @implemented + */ +BOOL +WINAPI +SetConsoleMode(HANDLE hConsoleHandle, + DWORD dwMode) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &ApiMessage.Data.ConsoleModeRequest; + + ConsoleModeRequest->ConsoleHandle = hConsoleHandle; + ConsoleModeRequest->ConsoleMode = dwMode; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetMode), + sizeof(CONSOLE_GETSETCONSOLEMODE)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/*-------------------------------------------------------------- + * SetConsoleActiveScreenBuffer + * + * @implemented + */ +BOOL +WINAPI +SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + ApiMessage.Data.SetScreenBufferRequest.OutputHandle = hConsoleOutput; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetActiveScreenBuffer), + sizeof(CONSOLE_SETACTIVESCREENBUFFER)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/*-------------------------------------------------------------- + * FlushConsoleInputBuffer + * + * @implemented + */ +BOOL +WINAPI +FlushConsoleInputBuffer(HANDLE hConsoleInput) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + ApiMessage.Data.FlushInputBufferRequest.InputHandle = hConsoleInput; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepFlushInputBuffer), + sizeof(CONSOLE_FLUSHINPUTBUFFER)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/*-------------------------------------------------------------- + * SetConsoleScreenBufferSize + * + * @implemented + */ +BOOL +WINAPI +SetConsoleScreenBufferSize(HANDLE hConsoleOutput, + COORD dwSize) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + ApiMessage.Data.SetScreenBufferSizeRequest.OutputHandle = hConsoleOutput; + ApiMessage.Data.SetScreenBufferSizeRequest.Size = dwSize; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetScreenBufferSize), + sizeof(CONSOLE_SETSCREENBUFFERSIZE)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/*-------------------------------------------------------------- + * SetConsoleCursorInfo + * + * @implemented + */ +BOOL +WINAPI +SetConsoleCursorInfo(HANDLE hConsoleOutput, + CONST CONSOLE_CURSOR_INFO *lpConsoleCursorInfo) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + ApiMessage.Data.CursorInfoRequest.OutputHandle = hConsoleOutput; + ApiMessage.Data.CursorInfoRequest.Info = *lpConsoleCursorInfo; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetCursorInfo), + sizeof(CONSOLE_GETSETCURSORINFO)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +static +BOOL +IntScrollConsoleScreenBuffer(HANDLE hConsoleOutput, + const SMALL_RECT *lpScrollRectangle, + const SMALL_RECT *lpClipRectangle, + COORD dwDestinationOrigin, + const CHAR_INFO *lpFill, + BOOL bUnicode) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_SCROLLSCREENBUFFER ScrollScreenBufferRequest = &ApiMessage.Data.ScrollScreenBufferRequest; + + ScrollScreenBufferRequest->OutputHandle = hConsoleOutput; + ScrollScreenBufferRequest->Unicode = bUnicode; + ScrollScreenBufferRequest->ScrollRectangle = *lpScrollRectangle; + + if (lpClipRectangle != NULL) + { + ScrollScreenBufferRequest->UseClipRectangle = TRUE; + ScrollScreenBufferRequest->ClipRectangle = *lpClipRectangle; + } + else + { + ScrollScreenBufferRequest->UseClipRectangle = FALSE; + } + + ScrollScreenBufferRequest->DestinationOrigin = dwDestinationOrigin; + ScrollScreenBufferRequest->Fill = *lpFill; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepScrollScreenBuffer), + sizeof(CONSOLE_SCROLLSCREENBUFFER)); + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/*-------------------------------------------------------------- + * ScrollConsoleScreenBufferA + * + * @implemented + */ +BOOL +WINAPI +ScrollConsoleScreenBufferA(HANDLE hConsoleOutput, + CONST SMALL_RECT *lpScrollRectangle, + CONST SMALL_RECT *lpClipRectangle, + COORD dwDestinationOrigin, + CONST CHAR_INFO *lpFill) +{ + return IntScrollConsoleScreenBuffer(hConsoleOutput, + (PSMALL_RECT)lpScrollRectangle, + (PSMALL_RECT)lpClipRectangle, + dwDestinationOrigin, + (PCHAR_INFO)lpFill, + FALSE); +} + + +/*-------------------------------------------------------------- + * ScrollConsoleScreenBufferW + * + * @implemented + */ +BOOL +WINAPI +ScrollConsoleScreenBufferW(HANDLE hConsoleOutput, + CONST SMALL_RECT *lpScrollRectangle, + CONST SMALL_RECT *lpClipRectangle, + COORD dwDestinationOrigin, + CONST CHAR_INFO *lpFill) +{ + return IntScrollConsoleScreenBuffer(hConsoleOutput, + lpScrollRectangle, + lpClipRectangle, + dwDestinationOrigin, + lpFill, + TRUE); +} + + +/*-------------------------------------------------------------- + * SetConsoleWindowInfo + * + * @unimplemented + */ +BOOL +WINAPI +SetConsoleWindowInfo(HANDLE hConsoleOutput, + BOOL bAbsolute, + CONST SMALL_RECT *lpConsoleWindow) +{ + DPRINT1("SetConsoleWindowInfo(0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", hConsoleOutput, bAbsolute, lpConsoleWindow); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/*-------------------------------------------------------------- + * SetConsoleTextAttribute + * + * @implemented + */ +BOOL +WINAPI +SetConsoleTextAttribute(HANDLE hConsoleOutput, + WORD wAttributes) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + ApiMessage.Data.SetTextAttribRequest.OutputHandle = hConsoleOutput; + ApiMessage.Data.SetTextAttribRequest.Attrib = wAttributes; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetTextAttribute), + sizeof(CONSOLE_SETTEXTATTRIB)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +static +BOOL +AddConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine) +{ + PHANDLER_ROUTINE* NewCtrlHandlers = NULL; + + if (HandlerRoutine == NULL) + { + NtCurrentPeb()->ProcessParameters->ConsoleFlags = TRUE; + return TRUE; + } + + if (NrCtrlHandlers == NrAllocatedHandlers) + { + NewCtrlHandlers = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + (NrCtrlHandlers + 4) * sizeof(PHANDLER_ROUTINE)); + if (NewCtrlHandlers == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + memmove(NewCtrlHandlers, CtrlHandlers, sizeof(PHANDLER_ROUTINE) * NrCtrlHandlers); + + if (NrAllocatedHandlers > 1) RtlFreeHeap(RtlGetProcessHeap(), 0, CtrlHandlers); + + CtrlHandlers = NewCtrlHandlers; + NrAllocatedHandlers += 4; + } + + ASSERT(NrCtrlHandlers < NrAllocatedHandlers); + + CtrlHandlers[NrCtrlHandlers++] = HandlerRoutine; + return TRUE; +} + + +static +BOOL +RemoveConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine) +{ + ULONG i; + + if (HandlerRoutine == NULL) + { + NtCurrentPeb()->ProcessParameters->ConsoleFlags = FALSE; + return TRUE; + } + + for (i = 0; i < NrCtrlHandlers; i++) + { + if (CtrlHandlers[i] == HandlerRoutine) + { + if (i < (NrCtrlHandlers - 1)) + { + memmove(&CtrlHandlers[i], + &CtrlHandlers[i+1], + (NrCtrlHandlers - i + 1) * sizeof(PHANDLER_ROUTINE)); + } + + NrCtrlHandlers--; + return TRUE; + } + } + + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, + BOOL Add) +{ + BOOL Ret; + + RtlEnterCriticalSection(&BaseDllDirectoryLock); + if (Add) + { + Ret = AddConsoleCtrlHandler(HandlerRoutine); + } + else + { + Ret = RemoveConsoleCtrlHandler(HandlerRoutine); + } + + RtlLeaveCriticalSection(&BaseDllDirectoryLock); + return(Ret); +} + + +/*-------------------------------------------------------------- + * GenerateConsoleCtrlEvent + * + * @implemented + */ +BOOL +WINAPI +GenerateConsoleCtrlEvent(DWORD dwCtrlEvent, + DWORD dwProcessGroupId) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + if (dwCtrlEvent != CTRL_C_EVENT && dwCtrlEvent != CTRL_BREAK_EVENT) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + ApiMessage.Data.GenerateCtrlEventRequest.Event = dwCtrlEvent; + ApiMessage.Data.GenerateCtrlEventRequest.ProcessGroup = dwProcessGroupId; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGenerateCtrlEvent), + sizeof(CONSOLE_GENERATECTRLEVENT)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +static DWORD +IntGetConsoleTitle(LPVOID lpConsoleTitle, DWORD nSize, BOOL bUnicode) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETSETCONSOLETITLE TitleRequest = &ApiMessage.Data.TitleRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + + if (nSize == 0) return 0; + + TitleRequest->Length = nSize * (bUnicode ? 1 : sizeof(WCHAR)); + CaptureBuffer = CsrAllocateCaptureBuffer(1, TitleRequest->Length); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + + CsrAllocateMessagePointer(CaptureBuffer, + TitleRequest->Length, + (PVOID*)&TitleRequest->Title); + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetTitle), + sizeof(CONSOLE_GETSETCONSOLETITLE)); + if (!NT_SUCCESS(Status)) + { + CsrFreeCaptureBuffer(CaptureBuffer); + BaseSetLastNTError(Status); + return 0; + } + + if (bUnicode) + { + if (nSize >= sizeof(WCHAR)) + wcscpy((LPWSTR)lpConsoleTitle, TitleRequest->Title); + } + else + { + if (nSize < TitleRequest->Length / sizeof(WCHAR) || + !WideCharToMultiByte(CP_ACP, // ANSI code page + 0, // performance and mapping flags + TitleRequest->Title, // address of wide-character string + -1, // number of characters in string + (LPSTR)lpConsoleTitle, // address of buffer for new string + nSize, // size of buffer + NULL, // FAST + NULL)) + { + /* Yes, if the buffer isn't big enough, it returns 0... Bad API */ + *(LPSTR)lpConsoleTitle = '\0'; + TitleRequest->Length = 0; + } + } + CsrFreeCaptureBuffer(CaptureBuffer); + + return TitleRequest->Length / sizeof(WCHAR); +} + + +/*-------------------------------------------------------------- + * GetConsoleTitleW + * + * @implemented + */ +DWORD +WINAPI +GetConsoleTitleW(LPWSTR lpConsoleTitle, + DWORD nSize) +{ + return IntGetConsoleTitle(lpConsoleTitle, nSize, TRUE); +} + + +/*-------------------------------------------------------------- + * GetConsoleTitleA + * + * @implemented + */ +DWORD +WINAPI +GetConsoleTitleA(LPSTR lpConsoleTitle, + DWORD nSize) +{ + return IntGetConsoleTitle(lpConsoleTitle, nSize, FALSE); +} + + +/*-------------------------------------------------------------- + * SetConsoleTitleW + * + * @implemented + */ +BOOL +WINAPI +SetConsoleTitleW(LPCWSTR lpConsoleTitle) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETSETCONSOLETITLE TitleRequest = &ApiMessage.Data.TitleRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + + TitleRequest->Length = wcslen(lpConsoleTitle) * sizeof(WCHAR); + + CaptureBuffer = CsrAllocateCaptureBuffer(1, TitleRequest->Length); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + CsrCaptureMessageBuffer(CaptureBuffer, + (PVOID)lpConsoleTitle, + TitleRequest->Length, + (PVOID*)&TitleRequest->Title); + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetTitle), + sizeof(CONSOLE_GETSETCONSOLETITLE)); + + CsrFreeCaptureBuffer(CaptureBuffer); + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/*-------------------------------------------------------------- + * SetConsoleTitleA + * + * @implemented + */ +BOOL +WINAPI +SetConsoleTitleA(LPCSTR lpConsoleTitle) +{ + BOOL Ret; + ULONG Length = strlen(lpConsoleTitle) + 1; + LPWSTR WideTitle = HeapAlloc(GetProcessHeap(), 0, Length * sizeof(WCHAR)); + + 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; +} + + +/*-------------------------------------------------------------- + * CreateConsoleScreenBuffer + * + * @implemented + */ +HANDLE +WINAPI +CreateConsoleScreenBuffer(DWORD dwDesiredAccess, + DWORD dwShareMode, + CONST SECURITY_ATTRIBUTES *lpSecurityAttributes, + DWORD dwFlags, + LPVOID lpScreenBufferData) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + if ( (dwDesiredAccess & ~(GENERIC_READ | GENERIC_WRITE)) || + (dwShareMode & ~(FILE_SHARE_READ | FILE_SHARE_WRITE)) || + (dwFlags != CONSOLE_TEXTMODE_BUFFER) ) + { + SetLastError(ERROR_INVALID_PARAMETER); + return INVALID_HANDLE_VALUE; + } + + ApiMessage.Data.CreateScreenBufferRequest.Access = dwDesiredAccess; + ApiMessage.Data.CreateScreenBufferRequest.ShareMode = dwShareMode; + ApiMessage.Data.CreateScreenBufferRequest.Inheritable = + (lpSecurityAttributes ? lpSecurityAttributes->bInheritHandle : FALSE); + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepCreateScreenBuffer), + sizeof(CONSOLE_CREATESCREENBUFFER)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return INVALID_HANDLE_VALUE; + } + + return ApiMessage.Data.CreateScreenBufferRequest.OutputHandle; +} + + +/*-------------------------------------------------------------- + * GetConsoleCP + * + * @implemented + */ +UINT +WINAPI +GetConsoleCP(VOID) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + /* Get the Input Code Page */ + ApiMessage.Data.ConsoleCPRequest.InputCP = TRUE; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetCP), + sizeof(CONSOLE_GETSETINPUTOUTPUTCP)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return 0; + } + + return ApiMessage.Data.ConsoleCPRequest.CodePage; +} + + +/*-------------------------------------------------------------- + * SetConsoleCP + * + * @implemented + */ +BOOL +WINAPI +SetConsoleCP(UINT wCodePageID) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + /* Set the Input Code Page */ + ApiMessage.Data.ConsoleCPRequest.InputCP = TRUE; + ApiMessage.Data.ConsoleCPRequest.CodePage = wCodePageID; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetCP), + sizeof(CONSOLE_GETSETINPUTOUTPUTCP)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + } + + return NT_SUCCESS(Status); +} + + +/*-------------------------------------------------------------- + * GetConsoleOutputCP + * + * @implemented + */ +UINT +WINAPI +GetConsoleOutputCP(VOID) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + /* Get the Output Code Page */ + ApiMessage.Data.ConsoleCPRequest.InputCP = FALSE; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetCP), + sizeof(CONSOLE_GETSETINPUTOUTPUTCP)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError (Status); + return 0; + } + + return ApiMessage.Data.ConsoleCPRequest.CodePage; +} + + +/*-------------------------------------------------------------- + * SetConsoleOutputCP + * + * @implemented + */ +BOOL +WINAPI +SetConsoleOutputCP(UINT wCodePageID) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + /* Set the Output Code Page */ + ApiMessage.Data.ConsoleCPRequest.InputCP = FALSE; + ApiMessage.Data.ConsoleCPRequest.CodePage = wCodePageID; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetCP), + sizeof(CONSOLE_GETSETINPUTOUTPUTCP)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + } + + return NT_SUCCESS(Status); +} + + +/*-------------------------------------------------------------- + * GetConsoleProcessList + * + * @implemented + */ +DWORD +WINAPI +GetConsoleProcessList(LPDWORD lpdwProcessList, + DWORD dwProcessCount) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETPROCESSLIST GetProcessListRequest = &ApiMessage.Data.GetProcessListRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + ULONG nProcesses; + + if (lpdwProcessList == NULL || dwProcessCount == 0) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + CaptureBuffer = CsrAllocateCaptureBuffer(1, dwProcessCount * sizeof(DWORD)); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + GetProcessListRequest->nMaxIds = dwProcessCount; + + CsrAllocateMessagePointer(CaptureBuffer, + dwProcessCount * sizeof(DWORD), + (PVOID*)&GetProcessListRequest->pProcessIds); + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetProcessList), + sizeof(CONSOLE_GETPROCESSLIST)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError (Status); + nProcesses = 0; + } + else + { + nProcesses = GetProcessListRequest->nProcessIdsTotal; + if (dwProcessCount >= nProcesses) + { + memcpy(lpdwProcessList, GetProcessListRequest->pProcessIds, nProcesses * sizeof(DWORD)); + } + } + + CsrFreeCaptureBuffer(CaptureBuffer); + return nProcesses; +} + + +/*-------------------------------------------------------------- + * GetConsoleSelectionInfo + * + * @implemented + */ +BOOL +WINAPI +GetConsoleSelectionInfo(PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + if (lpConsoleSelectionInfo == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetSelectionInfo), + sizeof(CONSOLE_GETSELECTIONINFO)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + *lpConsoleSelectionInfo = ApiMessage.Data.GetSelectionInfoRequest.Info; + return TRUE; +} + + +/*-------------------------------------------------------------- + * AttachConsole + * + * @implemented + * + * @note Strongly inspired by AllocConsole. + */ +BOOL +WINAPI +AttachConsole(DWORD dwProcessId) +{ + NTSTATUS Status; + PRTL_USER_PROCESS_PARAMETERS Parameters = NtCurrentPeb()->ProcessParameters; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_ATTACHCONSOLE AttachConsoleRequest = &ApiMessage.Data.AttachConsoleRequest; + + if (Parameters->ConsoleHandle) + { + DPRINT1("AttachConsole: Attaching a console to a process already having one\n"); + SetLastError(ERROR_ACCESS_DENIED); + return FALSE; + } + + AttachConsoleRequest->ProcessId = dwProcessId; + AttachConsoleRequest->CtrlDispatcher = ConsoleControlDispatcher; + AttachConsoleRequest->PropDispatcher = PropDialogHandler; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepAttach), + sizeof(CONSOLE_ATTACHCONSOLE)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + Parameters->ConsoleHandle = AttachConsoleRequest->Console; + SetStdHandle(STD_INPUT_HANDLE , AttachConsoleRequest->InputHandle ); + SetStdHandle(STD_OUTPUT_HANDLE, AttachConsoleRequest->OutputHandle); + SetStdHandle(STD_ERROR_HANDLE , AttachConsoleRequest->ErrorHandle ); + + /* Initialize Console Ctrl Handler */ + InitConsoleCtrlHandling(); + + InputWaitHandle = AttachConsoleRequest->InputWaitHandle; + + return TRUE; +} + + +/*-------------------------------------------------------------- + * GetConsoleWindow + * + * @implemented + */ +HWND +WINAPI +GetConsoleWindow(VOID) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetConsoleWindow), + sizeof(CONSOLE_GETWINDOW)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return (HWND)NULL; + } + + return ApiMessage.Data.GetWindowRequest.WindowHandle; +} + + +/*-------------------------------------------------------------- + * SetConsoleIcon + * + * @implemented + */ +BOOL +WINAPI +SetConsoleIcon(HICON hicon) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + + ApiMessage.Data.SetIconRequest.WindowIcon = hicon; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetIcon), + sizeof(CONSOLE_SETICON)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return NT_SUCCESS(Status); +} + + +/****************************************************************************** + * \name SetConsoleInputExeNameW + * \brief Sets the console input file name from a unicode string. + * \param lpInputExeName Pointer to a unicode string with the name. + * \return TRUE if successful, FALSE if unsuccsedful. + * \remarks If lpInputExeName is 0 or the string length is 0 or greater than 255, + * the function fails and sets last error to ERROR_INVALID_PARAMETER. + */ +BOOL +WINAPI +SetConsoleInputExeNameW(LPCWSTR lpInputExeName) +{ + int lenName; + + if ( !lpInputExeName || + (lenName = lstrlenW(lpInputExeName)) == 0 || + lenName > INPUTEXENAME_BUFLEN - 1 ) + { + /* Fail if string is empty or too long */ + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + RtlEnterCriticalSection(&ConsoleLock); + _SEH2_TRY + { + RtlCopyMemory(InputExeName, lpInputExeName, lenName * sizeof(WCHAR)); + InputExeName[lenName] = L'\0'; + } + _SEH2_FINALLY + { + RtlLeaveCriticalSection(&ConsoleLock); + } + _SEH2_END; + + return TRUE; +} + + +/****************************************************************************** + * \name SetConsoleInputExeNameA + * \brief Sets the console input file name from an ansi string. + * \param lpInputExeName Pointer to an ansi string with the name. + * \return TRUE if successful, FALSE if unsuccsedful. + * \remarks If lpInputExeName is 0 or the string length is 0 or greater than 255, + * the function fails and sets last error to ERROR_INVALID_PARAMETER. + */ +BOOL +WINAPI +SetConsoleInputExeNameA(LPCSTR lpInputExeName) +{ + WCHAR Buffer[INPUTEXENAME_BUFLEN]; + ANSI_STRING InputExeNameA; + UNICODE_STRING InputExeNameU; + NTSTATUS Status; + + RtlInitAnsiString(&InputExeNameA, lpInputExeName); + + if ( InputExeNameA.Length == 0 || + InputExeNameA.Length > INPUTEXENAME_BUFLEN - 1 ) + { + /* Fail if string is empty or too long */ + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + InputExeNameU.Buffer = Buffer; + InputExeNameU.MaximumLength = sizeof(Buffer); + InputExeNameU.Length = 0; + + Status = RtlAnsiStringToUnicodeString(&InputExeNameU, &InputExeNameA, FALSE); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return SetConsoleInputExeNameW(InputExeNameU.Buffer); +} + + +/****************************************************************************** + * \name GetConsoleInputExeNameW + * \brief Retrieves the console input file name as unicode string. + * \param nBufferLength Length of the buffer in WCHARs. + * Specify 0 to recieve the needed buffer length. + * \param lpBuffer Pointer to a buffer that recieves the string. + * \return Needed buffer size if \p nBufferLength is 0. + * Otherwise 1 if successful, 2 if buffer is too small. + * \remarks Sets last error value to ERROR_BUFFER_OVERFLOW if the buffer + * is not big enough. + */ +DWORD +WINAPI +GetConsoleInputExeNameW(DWORD nBufferLength, LPWSTR lpBuffer) +{ + int lenName = lstrlenW(InputExeName); + + if (nBufferLength == 0) + { + /* Buffer size is requested, return it */ + return lenName + 1; + } + + if (lenName + 1 > nBufferLength) + { + /* Buffer is not large enough! */ + SetLastError(ERROR_BUFFER_OVERFLOW); + return 2; + } + + RtlEnterCriticalSection(&ConsoleLock); + _SEH2_TRY + { + RtlCopyMemory(lpBuffer, InputExeName, lenName * sizeof(WCHAR)); + lpBuffer[lenName] = '\0'; + } + _SEH2_FINALLY + { + RtlLeaveCriticalSection(&ConsoleLock); + } + _SEH2_END; + + /* Success, return 1 */ + return 1; +} + + +/****************************************************************************** + * \name GetConsoleInputExeNameA + * \brief Retrieves the console input file name as ansi string. + * \param nBufferLength Length of the buffer in CHARs. + * \param lpBuffer Pointer to a buffer that recieves the string. + * \return 1 if successful, 2 if buffer is too small. + * \remarks Sets last error value to ERROR_BUFFER_OVERFLOW if the buffer + * is not big enough. The buffer recieves as much characters as fit. + */ +DWORD +WINAPI +GetConsoleInputExeNameA(DWORD nBufferLength, LPSTR lpBuffer) +{ + WCHAR Buffer[INPUTEXENAME_BUFLEN]; + DWORD Ret; + UNICODE_STRING BufferU; + ANSI_STRING BufferA; + + /* Get the unicode name */ + Ret = GetConsoleInputExeNameW(sizeof(Buffer) / sizeof(Buffer[0]), Buffer); + + /* Initialize strings for conversion */ + RtlInitUnicodeString(&BufferU, Buffer); + BufferA.Length = 0; + BufferA.MaximumLength = nBufferLength; + BufferA.Buffer = lpBuffer; + + /* Convert unicode name to ansi, copying as much chars as fit */ + RtlUnicodeStringToAnsiString(&BufferA, &BufferU, FALSE); + + /* Error handling */ + if (nBufferLength <= BufferU.Length / sizeof(WCHAR)) + { + SetLastError(ERROR_BUFFER_OVERFLOW); + return 2; + } + + return Ret; +} + +BOOL +WINAPI +GetConsoleCharType(HANDLE hConsole, COORD Coord, PDWORD Type) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +GetConsoleCursorMode(HANDLE hConsole, PBOOL pUnknown1, PBOOL pUnknown2) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +GetConsoleNlsMode(HANDLE hConsole, LPDWORD lpMode) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +SetConsoleCursorMode(HANDLE hConsole, BOOL Unknown1, BOOL Unknown2) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +SetConsoleLocalEUDC(DWORD Unknown1, DWORD Unknown2, DWORD Unknown3, DWORD Unknown4) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +SetConsoleNlsMode(HANDLE hConsole, DWORD dwMode) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +RegisterConsoleIME(HWND hWnd, LPDWORD ThreadId) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +RegisterConsoleOS2(BOOL bUnknown) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +SetConsoleOS2OemFormat(BOOL bUnknown) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +UnregisterConsoleIME(VOID) +{ + STUB; + return FALSE; +} + + +/* + * @unimplemented + */ +BOOL WINAPI GetConsoleKeyboardLayoutNameA(LPSTR name) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL WINAPI GetConsoleKeyboardLayoutNameW(LPWSTR name) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetLastConsoleEventActive(VOID) +{ + STUB; + return FALSE; +} + +/* EOF */ Index: dll/win32/kernel32/client/console/console.c =================================================================== --- dll/win32/kernel32/client/console/console.c (rvision 58607) +++ dll/win32/kernel32/client/console/console.c (copie de travail) Modification de proprits sur dll/win32/kernel32/client/console/console.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: dll/win32/kernel32/client/console/history.c =================================================================== --- dll/win32/kernel32/client/console/history.c (rvision 0) +++ dll/win32/kernel32/client/console/history.c (copie de travail) @@ -0,0 +1,352 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: dll/win32/kernel32/client/console/history.c + * PURPOSE: Win32 Console Client history functions + * PROGRAMMERS: Jeffrey Morlan + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + + +/* PRIVATE FUNCTIONS **********************************************************/ + +/* Get the size needed to copy a string to a capture buffer, including alignment */ +static ULONG +IntStringSize(LPCVOID String, + BOOL Unicode) +{ + ULONG Size = (Unicode ? wcslen(String) : strlen(String)) * sizeof(WCHAR); + return (Size + 3) & -4; +} + + +/* Copy a string to a capture buffer */ +static VOID +IntCaptureMessageString(PCSR_CAPTURE_BUFFER CaptureBuffer, + LPCVOID String, + BOOL Unicode, + PUNICODE_STRING RequestString) +{ + ULONG Size; + if (Unicode) + { + Size = wcslen(String) * sizeof(WCHAR); + CsrCaptureMessageBuffer(CaptureBuffer, (PVOID)String, Size, (PVOID *)&RequestString->Buffer); + } + else + { + Size = strlen(String); + CsrAllocateMessagePointer(CaptureBuffer, Size * sizeof(WCHAR), (PVOID *)&RequestString->Buffer); + Size = MultiByteToWideChar(CP_ACP, 0, String, Size, RequestString->Buffer, Size * sizeof(WCHAR)) + * sizeof(WCHAR); + } + RequestString->Length = RequestString->MaximumLength = Size; +} + + +static BOOL +IntExpungeConsoleCommandHistory(LPCVOID lpExeName, BOOL bUnicode) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_EXPUNGECOMMANDHISTORY ExpungeCommandHistoryRequest = &ApiMessage.Data.ExpungeCommandHistoryRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + + if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + CaptureBuffer = CsrAllocateCaptureBuffer(1, IntStringSize(lpExeName, bUnicode)); + if (!CaptureBuffer) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode, + &ExpungeCommandHistoryRequest->ExeName); + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepExpungeCommandHistory), + sizeof(CONSOLE_EXPUNGECOMMANDHISTORY)); + + CsrFreeCaptureBuffer(CaptureBuffer); + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +static DWORD +IntGetConsoleCommandHistory(LPVOID lpHistory, DWORD cbHistory, LPCVOID lpExeName, BOOL bUnicode) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETCOMMANDHISTORY GetCommandHistoryRequest = &ApiMessage.Data.GetCommandHistoryRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + DWORD HistoryLength = cbHistory * (bUnicode ? 1 : sizeof(WCHAR)); + + if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + CaptureBuffer = CsrAllocateCaptureBuffer(2, IntStringSize(lpExeName, bUnicode) + + HistoryLength); + if (!CaptureBuffer) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + + IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode, + &GetCommandHistoryRequest->ExeName); + GetCommandHistoryRequest->Length = HistoryLength; + CsrAllocateMessagePointer(CaptureBuffer, HistoryLength, + (PVOID*)&GetCommandHistoryRequest->History); + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetCommandHistory), + sizeof(CONSOLE_GETCOMMANDHISTORY)); + if (!NT_SUCCESS(Status)) + { + CsrFreeCaptureBuffer(CaptureBuffer); + BaseSetLastNTError(Status); + return 0; + } + + if (bUnicode) + { + memcpy(lpHistory, + GetCommandHistoryRequest->History, + GetCommandHistoryRequest->Length); + } + else + { + WideCharToMultiByte(CP_ACP, 0, + GetCommandHistoryRequest->History, + GetCommandHistoryRequest->Length / sizeof(WCHAR), + lpHistory, + cbHistory, + NULL, NULL); + } + + CsrFreeCaptureBuffer(CaptureBuffer); + + return GetCommandHistoryRequest->Length; +} + + +static DWORD +IntGetConsoleCommandHistoryLength(LPCVOID lpExeName, BOOL bUnicode) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETCOMMANDHISTORYLENGTH GetCommandHistoryLengthRequest = &ApiMessage.Data.GetCommandHistoryLengthRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + + if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + CaptureBuffer = CsrAllocateCaptureBuffer(1, IntStringSize(lpExeName, bUnicode)); + if (!CaptureBuffer) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + + IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode, + &GetCommandHistoryLengthRequest->ExeName); + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetCommandHistoryLength), + sizeof(CONSOLE_GETCOMMANDHISTORYLENGTH)); + + CsrFreeCaptureBuffer(CaptureBuffer); + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return 0; + } + + return GetCommandHistoryLengthRequest->Length; +} + + +static BOOL +IntSetConsoleNumberOfCommands(DWORD dwNumCommands, + LPCVOID lpExeName, + BOOL bUnicode) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_SETHISTORYNUMBERCOMMANDS SetHistoryNumberCommandsRequest = &ApiMessage.Data.SetHistoryNumberCommandsRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + + if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + CaptureBuffer = CsrAllocateCaptureBuffer(1, IntStringSize(lpExeName, bUnicode)); + if (!CaptureBuffer) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode, + &SetHistoryNumberCommandsRequest->ExeName); + SetHistoryNumberCommandsRequest->NumCommands = dwNumCommands; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetNumberOfCommands), + sizeof(CONSOLE_SETHISTORYNUMBERCOMMANDS)); + + CsrFreeCaptureBuffer(CaptureBuffer); + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/* FUNCTIONS ******************************************************************/ + +/* + * @implemented (Undocumented) + */ +BOOL +WINAPI +ExpungeConsoleCommandHistoryW(LPCWSTR lpExeName) +{ + return IntExpungeConsoleCommandHistory(lpExeName, TRUE); +} + + +/* + * @implemented (Undocumented) + */ +BOOL +WINAPI +ExpungeConsoleCommandHistoryA(LPCSTR lpExeName) +{ + return IntExpungeConsoleCommandHistory(lpExeName, FALSE); +} + + +/* + * @implemented (Undocumented) + */ +DWORD +WINAPI +GetConsoleCommandHistoryW(LPWSTR lpHistory, + DWORD cbHistory, + LPCWSTR lpExeName) +{ + return IntGetConsoleCommandHistory(lpHistory, cbHistory, lpExeName, TRUE); +} + + +/* + * @implemented (Undocumented) + */ +DWORD +WINAPI +GetConsoleCommandHistoryA(LPSTR lpHistory, + DWORD cbHistory, + LPCSTR lpExeName) +{ + return IntGetConsoleCommandHistory(lpHistory, cbHistory, lpExeName, FALSE); +} + + +/* + * @implemented (Undocumented) + */ +DWORD +WINAPI +GetConsoleCommandHistoryLengthW(LPCWSTR lpExeName) +{ + return IntGetConsoleCommandHistoryLength(lpExeName, TRUE); +} + + +/* + * @implemented (Undocumented) + */ +DWORD +WINAPI +GetConsoleCommandHistoryLengthA(LPCSTR lpExeName) +{ + return IntGetConsoleCommandHistoryLength(lpExeName, FALSE) / sizeof(WCHAR); +} + + +/* + * @implemented (Undocumented) + */ +BOOL +WINAPI +SetConsoleNumberOfCommandsW(DWORD dwNumCommands, + LPCSTR lpExeName) +{ + return IntSetConsoleNumberOfCommands(dwNumCommands, lpExeName, TRUE); +} + + +/* + * @implemented (Undocumented) + */ +BOOL +WINAPI +SetConsoleNumberOfCommandsA(DWORD dwNumCommands, + LPCWSTR lpExeName) +{ + return IntSetConsoleNumberOfCommands(dwNumCommands, lpExeName, FALSE); +} + + +/* + * @unimplemented + */ +BOOL +WINAPI +SetConsoleCommandHistoryMode(IN DWORD dwMode) +{ + STUB; + return FALSE; +} + +/* EOF */ Index: dll/win32/kernel32/client/console/history.c =================================================================== --- dll/win32/kernel32/client/console/history.c (rvision 58607) +++ dll/win32/kernel32/client/console/history.c (copie de travail) Modification de proprits sur dll/win32/kernel32/client/console/history.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: dll/win32/kernel32/client/console/init.c =================================================================== --- dll/win32/kernel32/client/console/init.c (rvision 0) +++ dll/win32/kernel32/client/console/init.c (copie de travail) @@ -0,0 +1,328 @@ +/* + * 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 + +// For Control Panel Applet +#include + +#define NDEBUG +#include + + +/* GLOBALS ********************************************************************/ + +RTL_CRITICAL_SECTION ConsoleLock; +BOOL ConsoleInitialized = FALSE; + +extern HANDLE InputWaitHandle; + +static HMODULE ConsoleLibrary = NULL; +static BOOL AlreadyDisplayingProps = FALSE; + +#define WIN_OBJ_DIR L"\\Windows" +#define SESSION_DIR L"\\Sessions" + + +/* FUNCTIONS ******************************************************************/ + +DWORD +WINAPI +PropDialogHandler(IN LPVOID lpThreadParameter) +{ + // NOTE: lpThreadParameter corresponds to the client shared section handle. + + APPLET_PROC CPLFunc; + + /* + * Do not launch more than once the console property dialog applet, + * or (albeit less probable), if we are not initialized. + */ + if (!ConsoleInitialized || AlreadyDisplayingProps) + { + /* Close the associated client shared section handle if needed */ + if (lpThreadParameter) + { + CloseHandle((HANDLE)lpThreadParameter); + } + return STATUS_UNSUCCESSFUL; + } + + AlreadyDisplayingProps = TRUE; + + /* Load the Control Applet if needed */ + if (ConsoleLibrary == NULL) + { + WCHAR szBuffer[MAX_PATH]; + + GetWindowsDirectoryW(szBuffer, MAX_PATH); + wcscat(szBuffer, L"\\system32\\console.dll"); + ConsoleLibrary = LoadLibraryW(szBuffer); + + if (ConsoleLibrary == NULL) + { + DPRINT1("Failed to load console.dll"); + AlreadyDisplayingProps = FALSE; + return STATUS_UNSUCCESSFUL; + } + } + + /* Load its main function */ + CPLFunc = (APPLET_PROC)GetProcAddress(ConsoleLibrary, "CPlApplet"); + if (CPLFunc == NULL) + { + DPRINT("Error: Console.dll misses CPlApplet export\n"); + AlreadyDisplayingProps = FALSE; + return STATUS_UNSUCCESSFUL; + } + + if (CPLFunc(NULL, CPL_INIT, 0, 0) == FALSE) + { + DPRINT("Error: failed to initialize console.dll\n"); + AlreadyDisplayingProps = FALSE; + return STATUS_UNSUCCESSFUL; + } + + if (CPLFunc(NULL, CPL_GETCOUNT, 0, 0) != 1) + { + DPRINT("Error: console.dll returned unexpected CPL count\n"); + AlreadyDisplayingProps = FALSE; + return STATUS_UNSUCCESSFUL; + } + + CPLFunc(NULL, CPL_DBLCLK, (LPARAM)lpThreadParameter, 0); + CPLFunc(NULL, CPL_EXIT , 0, 0); + + AlreadyDisplayingProps = FALSE; + return STATUS_SUCCESS; +} + + +VOID +InitConsoleInfo(IN OUT PCONSOLE_START_INFO ConsoleStartInfo) +{ + STARTUPINFOW si; + + GetStartupInfoW(&si); + + ConsoleStartInfo->dwStartupFlags = si.dwFlags; + if (si.dwFlags & STARTF_USEFILLATTRIBUTE) + { + ConsoleStartInfo->FillAttribute = si.dwFillAttribute; + } + if (si.dwFlags & STARTF_USECOUNTCHARS) + { + ConsoleStartInfo->ScreenBufferSize.X = (SHORT)(si.dwXCountChars); + ConsoleStartInfo->ScreenBufferSize.Y = (SHORT)(si.dwYCountChars); + } + if (si.dwFlags & STARTF_USESHOWWINDOW) + { + ConsoleStartInfo->ShowWindow = si.wShowWindow; + } + if (si.dwFlags & STARTF_USEPOSITION) + { + ConsoleStartInfo->ConsoleWindowOrigin.x = (LONG)(si.dwX); + ConsoleStartInfo->ConsoleWindowOrigin.y = (LONG)(si.dwY); + } + if (si.dwFlags & STARTF_USESIZE) + { + ConsoleStartInfo->ConsoleWindowSize.cx = (LONG)(si.dwXSize); + ConsoleStartInfo->ConsoleWindowSize.cy = (LONG)(si.dwYSize); + } + /* + if (si.dwFlags & STARTF_RUNFULLSCREEN) + { + } + */ + + if (si.lpTitle) + { + wcsncpy(ConsoleStartInfo->ConsoleTitle, si.lpTitle, MAX_PATH + 1); + } + else + { + ConsoleStartInfo->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.ConsoleStartInfo.ConsoleTitle[0] = L'\0'; + ConnectInfo.ConsoleStartInfo.AppPath[0] = L'\0'; + } + else + { + SIZE_T Length = 0; + LPCWSTR ExeName; + + InitConsoleInfo(&ConnectInfo.ConsoleStartInfo); + + Length = min(sizeof(ConnectInfo.ConsoleStartInfo.AppPath) / sizeof(ConnectInfo.ConsoleStartInfo.AppPath[0]) - 1, + Parameters->ImagePathName.Length / sizeof(WCHAR)); + wcsncpy(ConnectInfo.ConsoleStartInfo.AppPath, Parameters->ImagePathName.Buffer, Length); + ConnectInfo.ConsoleStartInfo.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.ConsoleStartInfo.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 the Console Ctrl Handler */ + InitConsoleCtrlHandling(); + ConnectInfo.CtrlDispatcher = ConsoleControlDispatcher; + + /* Initialize the Property Dialog Handler */ + ConnectInfo.PropDispatcher = PropDialogHandler; + + /* 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) + { + if (ConsoleLibrary) FreeLibrary(ConsoleLibrary); + + ConsoleInitialized = FALSE; + RtlDeleteCriticalSection(&ConsoleLock); + } +} + +/* EOF */ Index: dll/win32/kernel32/client/console/init.c =================================================================== --- dll/win32/kernel32/client/console/init.c (rvision 58607) +++ dll/win32/kernel32/client/console/init.c (copie de travail) Modification de proprits sur dll/win32/kernel32/client/console/init.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: dll/win32/kernel32/client/console/readwrite.c =================================================================== --- dll/win32/kernel32/client/console/readwrite.c (rvision 0) +++ dll/win32/kernel32/client/console/readwrite.c (copie de travail) @@ -0,0 +1,1282 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: dll/win32/kernel32/client/console/readwrite.c + * PURPOSE: Win32 Console Client read-write functions + * PROGRAMMERS: Emanuele Aliberti + * Marty Dill + * Filip Navara (xnavara@volny.cz) + * Thomas Weidenmueller (w3seek@reactos.org) + * Jeffrey Morlan + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + + +/* PRIVATE FUNCTIONS **********************************************************/ + +/****************** + * Read functions * + ******************/ + +static +BOOL +IntReadConsole(HANDLE hConsoleInput, + PVOID lpBuffer, + DWORD nNumberOfCharsToRead, + LPDWORD lpNumberOfCharsRead, + PCONSOLE_READCONSOLE_CONTROL pInputControl, + BOOL bUnicode) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_READCONSOLE ReadConsoleRequest = &ApiMessage.Data.ReadConsoleRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + ULONG CharSize; + + /* Determine the needed size */ + CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); + ReadConsoleRequest->BufferSize = nNumberOfCharsToRead * CharSize; + + /* Allocate a Capture Buffer */ + CaptureBuffer = CsrAllocateCaptureBuffer(1, ReadConsoleRequest->BufferSize); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + /* Allocate space in the Buffer */ + CsrAllocateMessagePointer(CaptureBuffer, + ReadConsoleRequest->BufferSize, + (PVOID*)&ReadConsoleRequest->Buffer); + + /* Set up the data to send to the Console Server */ + ReadConsoleRequest->InputHandle = hConsoleInput; + ReadConsoleRequest->Unicode = bUnicode; + ReadConsoleRequest->NrCharactersToRead = (WORD)nNumberOfCharsToRead; + ReadConsoleRequest->NrCharactersRead = 0; + ReadConsoleRequest->CtrlWakeupMask = 0; + if (pInputControl && pInputControl->nLength == sizeof(CONSOLE_READCONSOLE_CONTROL)) + { + ReadConsoleRequest->NrCharactersRead = pInputControl->nInitialChars; + memcpy(ReadConsoleRequest->Buffer, + lpBuffer, + pInputControl->nInitialChars * sizeof(WCHAR)); + ReadConsoleRequest->CtrlWakeupMask = pInputControl->dwCtrlWakeupMask; + } + + /* Call the server */ + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepReadConsole), + sizeof(CONSOLE_READCONSOLE)); + + /* Check for success */ + if (NT_SUCCESS(Status)) + { + memcpy(lpBuffer, + ReadConsoleRequest->Buffer, + ReadConsoleRequest->NrCharactersRead * CharSize); + + if (lpNumberOfCharsRead != NULL) + *lpNumberOfCharsRead = ReadConsoleRequest->NrCharactersRead; + + if (pInputControl && pInputControl->nLength == sizeof(CONSOLE_READCONSOLE_CONTROL)) + pInputControl->dwControlKeyState = ReadConsoleRequest->ControlKeyState; + } + else + { + DPRINT1("CSR returned error in ReadConsole\n"); + + if (lpNumberOfCharsRead != NULL) + *lpNumberOfCharsRead = 0; + + /* Error out */ + BaseSetLastNTError(Status); + } + + CsrFreeCaptureBuffer(CaptureBuffer); + + /* Return TRUE or FALSE */ + // return TRUE; + return (ReadConsoleRequest->NrCharactersRead > 0); + // return NT_SUCCESS(Status); +} + + +static +BOOL +IntGetConsoleInput(HANDLE hConsoleInput, + BOOL bRead, + PINPUT_RECORD lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsRead, + BOOL bUnicode) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETINPUT GetInputRequest = &ApiMessage.Data.GetInputRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + ULONG Size; + + if (lpBuffer == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + Size = nLength * sizeof(INPUT_RECORD); + + DPRINT("IntGetConsoleInput: %lx %p\n", Size, lpNumberOfEventsRead); + + /* Allocate a Capture Buffer */ + CaptureBuffer = CsrAllocateCaptureBuffer(1, Size); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + /* Allocate space in the Buffer */ + CsrAllocateMessagePointer(CaptureBuffer, + Size, + (PVOID*)&GetInputRequest->InputRecord); + + /* Set up the data to send to the Console Server */ + GetInputRequest->InputHandle = hConsoleInput; + GetInputRequest->Unicode = bUnicode; + GetInputRequest->bRead = bRead; + GetInputRequest->InputsRead = 0; + GetInputRequest->Length = nLength; + + /* Call the server */ + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetConsoleInput), + sizeof(CONSOLE_GETINPUT)); + DPRINT("Server returned: %x\n", Status); + + /* Check for success */ + if (NT_SUCCESS(Status)) + { + /* Return the number of events read */ + DPRINT("Events read: %lx\n", GetInputRequest->InputsRead); + + if (lpNumberOfEventsRead != NULL) + *lpNumberOfEventsRead = GetInputRequest->InputsRead; + + /* Copy into the buffer */ + DPRINT("Copying to buffer\n"); + RtlCopyMemory(lpBuffer, + GetInputRequest->InputRecord, + sizeof(INPUT_RECORD) * GetInputRequest->InputsRead); + } + else + { + if (lpNumberOfEventsRead != NULL) + *lpNumberOfEventsRead = 0; + + /* Error out */ + BaseSetLastNTError(Status); + } + + /* Release the capture buffer */ + CsrFreeCaptureBuffer(CaptureBuffer); + + /* Return TRUE or FALSE */ + return (GetInputRequest->InputsRead > 0); + // return NT_SUCCESS(Status); +} + + +static +BOOL +IntReadConsoleOutput(HANDLE hConsoleOutput, + PCHAR_INFO lpBuffer, + COORD dwBufferSize, + COORD dwBufferCoord, + PSMALL_RECT lpReadRegion, + BOOL bUnicode) +{ + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_READOUTPUT ReadOutputRequest = &ApiMessage.Data.ReadOutputRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + DWORD Size, SizeX, SizeY; + + if (lpBuffer == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + Size = dwBufferSize.X * dwBufferSize.Y * sizeof(CHAR_INFO); + + DPRINT("IntReadConsoleOutput: %lx %p\n", Size, lpReadRegion); + + /* Allocate a Capture Buffer */ + CaptureBuffer = CsrAllocateCaptureBuffer(1, Size); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed with size 0x%x!\n", Size); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + /* Allocate space in the Buffer */ + CsrAllocateMessagePointer(CaptureBuffer, + Size, + (PVOID*)&ReadOutputRequest->CharInfo); + + /* Set up the data to send to the Console Server */ + ReadOutputRequest->OutputHandle = hConsoleOutput; + ReadOutputRequest->Unicode = bUnicode; + ReadOutputRequest->BufferSize = dwBufferSize; + ReadOutputRequest->BufferCoord = dwBufferCoord; + ReadOutputRequest->ReadRegion = *lpReadRegion; + + /* Call the server */ + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepReadConsoleOutput), + sizeof(CONSOLE_READOUTPUT)); + DPRINT("Server returned: %x\n", ApiMessage.Status); + + /* Check for success */ + if (NT_SUCCESS(ApiMessage.Status)) + { + /* Copy into the buffer */ + DPRINT("Copying to buffer\n"); + SizeX = ReadOutputRequest->ReadRegion.Right - + ReadOutputRequest->ReadRegion.Left + 1; + SizeY = ReadOutputRequest->ReadRegion.Bottom - + ReadOutputRequest->ReadRegion.Top + 1; + RtlCopyMemory(lpBuffer, + ReadOutputRequest->CharInfo, + sizeof(CHAR_INFO) * SizeX * SizeY); + } + else + { + /* Error out */ + BaseSetLastNTError(ApiMessage.Status); + } + + /* Return the read region */ + DPRINT("read region: %lx\n", ReadOutputRequest->ReadRegion); + *lpReadRegion = ReadOutputRequest->ReadRegion; + + /* Release the capture buffer */ + CsrFreeCaptureBuffer(CaptureBuffer); + + /* Return TRUE or FALSE */ + return NT_SUCCESS(ApiMessage.Status); +} + + +static +BOOL +IntReadConsoleOutputCode(HANDLE hConsoleOutput, + CODE_TYPE CodeType, + PVOID pCode, + DWORD nLength, + COORD dwReadCoord, + LPDWORD lpNumberOfCodesRead) +{ + NTSTATUS Status; + BOOL bRet = TRUE; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_READOUTPUTCODE ReadOutputCodeRequest = &ApiMessage.Data.ReadOutputCodeRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + ULONG SizeBytes, CodeSize; + DWORD CodesRead; + + /* Determine the needed size */ + switch (CodeType) + { + case CODE_ASCII: + CodeSize = sizeof(CHAR); + break; + + case CODE_UNICODE: + CodeSize = sizeof(WCHAR); + break; + + case CODE_ATTRIBUTE: + CodeSize = sizeof(WORD); + break; + + default: + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + SizeBytes = nLength * CodeSize; + + /* Allocate a Capture Buffer */ + CaptureBuffer = CsrAllocateCaptureBuffer(1, SizeBytes); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + /* Allocate space in the Buffer */ + CsrAllocateMessagePointer(CaptureBuffer, + SizeBytes, + (PVOID*)&ReadOutputCodeRequest->pCode.pCode); + + /* Start reading */ + ReadOutputCodeRequest->OutputHandle = hConsoleOutput; + ReadOutputCodeRequest->CodeType = CodeType; + ReadOutputCodeRequest->ReadCoord = dwReadCoord; + + ReadOutputCodeRequest->NumCodesToRead = nLength; + + /* Call the server */ + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepReadConsoleOutputString), + sizeof(CONSOLE_READOUTPUTCODE)); + + /* Check for success */ + if (NT_SUCCESS(Status)) + { + CodesRead = ReadOutputCodeRequest->CodesRead; + memcpy(pCode, ReadOutputCodeRequest->pCode.pCode, CodesRead * CodeSize); + + // ReadOutputCodeRequest->ReadCoord = ReadOutputCodeRequest->EndCoord; + + if (lpNumberOfCodesRead != NULL) + *lpNumberOfCodesRead = CodesRead; + + bRet = TRUE; + } + else + { + if (lpNumberOfCodesRead != NULL) + *lpNumberOfCodesRead = 0; + + /* Error out */ + BaseSetLastNTError(Status); + bRet = FALSE; + } + + CsrFreeCaptureBuffer(CaptureBuffer); + + return bRet; +} + + +/******************* + * Write functions * + *******************/ + +static +BOOL +IntWriteConsole(HANDLE hConsoleOutput, + PVOID lpBuffer, + DWORD nNumberOfCharsToWrite, + LPDWORD lpNumberOfCharsWritten, + LPVOID lpReserved, + BOOL bUnicode) +{ + NTSTATUS Status; + BOOL bRet = TRUE; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_WRITECONSOLE WriteConsoleRequest = &ApiMessage.Data.WriteConsoleRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + ULONG CharSize; + + /* Determine the needed size */ + CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); + WriteConsoleRequest->BufferSize = nNumberOfCharsToWrite * CharSize; + + /* Allocate a Capture Buffer */ + CaptureBuffer = CsrAllocateCaptureBuffer(1, WriteConsoleRequest->BufferSize); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + /* Capture the buffer to write */ + CsrCaptureMessageBuffer(CaptureBuffer, + (PVOID)lpBuffer, + WriteConsoleRequest->BufferSize, + (PVOID*)&WriteConsoleRequest->Buffer); + + /* Start writing */ + WriteConsoleRequest->NrCharactersToWrite = nNumberOfCharsToWrite; + WriteConsoleRequest->OutputHandle = hConsoleOutput; + WriteConsoleRequest->Unicode = bUnicode; + + /* Call the server */ + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepWriteConsole), + sizeof(CONSOLE_WRITECONSOLE)); + + /* Check for success */ + if (NT_SUCCESS(Status)) + { + if (lpNumberOfCharsWritten != NULL) + *lpNumberOfCharsWritten = WriteConsoleRequest->NrCharactersWritten; + + bRet = TRUE; + } + else + { + if (lpNumberOfCharsWritten != NULL) + *lpNumberOfCharsWritten = 0; + + /* Error out */ + BaseSetLastNTError(Status); + bRet = FALSE; + } + + CsrFreeCaptureBuffer(CaptureBuffer); + + return bRet; +} + + +static +BOOL +IntWriteConsoleInput(HANDLE hConsoleInput, + PINPUT_RECORD lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsWritten, + BOOL bUnicode) +{ + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_WRITEINPUT WriteInputRequest = &ApiMessage.Data.WriteInputRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + DWORD Size; + + Size = nLength * sizeof(INPUT_RECORD); + + DPRINT("IntWriteConsoleInput: %lx %p\n", Size, lpNumberOfEventsWritten); + + /* Allocate a Capture Buffer */ + CaptureBuffer = CsrAllocateCaptureBuffer(1, Size); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + /* Capture the user buffer */ + CsrCaptureMessageBuffer(CaptureBuffer, + lpBuffer, + Size, + (PVOID*)&WriteInputRequest->InputRecord); + + /* Set up the data to send to the Console Server */ + WriteInputRequest->InputHandle = hConsoleInput; + WriteInputRequest->Unicode = bUnicode; + WriteInputRequest->Length = nLength; + + /* Call the server */ + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepWriteConsoleInput), + sizeof(CONSOLE_WRITEINPUT)); + DPRINT("Server returned: %x\n", ApiMessage.Status); + + /* Check for success */ + if (NT_SUCCESS(ApiMessage.Status)) + { + /* Return the number of events read */ + DPRINT("Events read: %lx\n", WriteInputRequest->Length); + + if (lpNumberOfEventsWritten != NULL) + *lpNumberOfEventsWritten = WriteInputRequest->Length; + } + else + { + if (lpNumberOfEventsWritten != NULL) + *lpNumberOfEventsWritten = 0; + + /* Error out */ + BaseSetLastNTError(ApiMessage.Status); + } + + /* Release the capture buffer */ + CsrFreeCaptureBuffer(CaptureBuffer); + + /* Return TRUE or FALSE */ + return NT_SUCCESS(ApiMessage.Status); +} + + +static +BOOL +IntWriteConsoleOutput(HANDLE hConsoleOutput, + CONST CHAR_INFO *lpBuffer, + COORD dwBufferSize, + COORD dwBufferCoord, + PSMALL_RECT lpWriteRegion, + BOOL bUnicode) +{ + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_WRITEOUTPUT WriteOutputRequest = &ApiMessage.Data.WriteOutputRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + ULONG Size; + + if ((lpBuffer == NULL) || (lpWriteRegion == NULL)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + /* + if (lpWriteRegion == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + */ + + Size = dwBufferSize.Y * dwBufferSize.X * sizeof(CHAR_INFO); + + DPRINT("IntWriteConsoleOutput: %lx %p\n", Size, lpWriteRegion); + + /* Allocate a Capture Buffer */ + CaptureBuffer = CsrAllocateCaptureBuffer(1, Size); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + /* Capture the user buffer */ + CsrCaptureMessageBuffer(CaptureBuffer, + (PVOID)lpBuffer, + Size, + (PVOID*)&WriteOutputRequest->CharInfo); + + /* Set up the data to send to the Console Server */ + WriteOutputRequest->OutputHandle = hConsoleOutput; + WriteOutputRequest->Unicode = bUnicode; + WriteOutputRequest->BufferSize = dwBufferSize; + WriteOutputRequest->BufferCoord = dwBufferCoord; + WriteOutputRequest->WriteRegion = *lpWriteRegion; + + /* Call the server */ + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepWriteConsoleOutput), + sizeof(CONSOLE_WRITEOUTPUT)); + DPRINT("Server returned: %x\n", ApiMessage.Status); + + /* Check for success */ + if (!NT_SUCCESS(ApiMessage.Status)) + { + /* Error out */ + BaseSetLastNTError(ApiMessage.Status); + } + + /* Return the read region */ + DPRINT("read region: %lx\n", WriteOutputRequest->WriteRegion); + *lpWriteRegion = WriteOutputRequest->WriteRegion; + + /* Release the capture buffer */ + CsrFreeCaptureBuffer(CaptureBuffer); + + /* Return TRUE or FALSE */ + return NT_SUCCESS(ApiMessage.Status); +} + + +static +BOOL +IntWriteConsoleOutputCode(HANDLE hConsoleOutput, + CODE_TYPE CodeType, + CONST VOID *pCode, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfCodesWritten) +{ + NTSTATUS Status; + BOOL bRet = TRUE; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_WRITEOUTPUTCODE WriteOutputCodeRequest = &ApiMessage.Data.WriteOutputCodeRequest; + PCSR_CAPTURE_BUFFER CaptureBuffer; + ULONG CodeSize; + + /* Determine the needed size */ + switch (CodeType) + { + case CODE_ASCII: + CodeSize = sizeof(CHAR); + break; + + case CODE_UNICODE: + CodeSize = sizeof(WCHAR); + break; + + case CODE_ATTRIBUTE: + CodeSize = sizeof(WORD); + break; + + default: + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + WriteOutputCodeRequest->BufferSize = nLength * CodeSize; + + /* Allocate a Capture Buffer */ + CaptureBuffer = CsrAllocateCaptureBuffer(1, WriteOutputCodeRequest->BufferSize); + if (CaptureBuffer == NULL) + { + DPRINT1("CsrAllocateCaptureBuffer failed!\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + /* Capture the buffer to write */ + CsrCaptureMessageBuffer(CaptureBuffer, + (PVOID)pCode, + WriteOutputCodeRequest->BufferSize, + (PVOID*)&WriteOutputCodeRequest->pCode.pCode); + + /* Start writing */ + WriteOutputCodeRequest->OutputHandle = hConsoleOutput; + WriteOutputCodeRequest->CodeType = CodeType; + WriteOutputCodeRequest->Coord = dwWriteCoord; + + WriteOutputCodeRequest->Length = nLength; + + /* Call the server */ + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepWriteConsoleOutputString), + sizeof(CONSOLE_WRITEOUTPUTCODE)); + + /* Check for success */ + if (NT_SUCCESS(Status)) + { + // WriteOutputCodeRequest->Coord = WriteOutputCodeRequest->EndCoord; + + if (lpNumberOfCodesWritten != NULL) + // *lpNumberOfCodesWritten = WriteOutputCodeRequest->NrCharactersWritten; + *lpNumberOfCodesWritten = WriteOutputCodeRequest->Length; + + bRet = TRUE; + } + else + { + if (lpNumberOfCodesWritten != NULL) + *lpNumberOfCodesWritten = 0; + + /* Error out */ + BaseSetLastNTError(Status); + bRet = FALSE; + } + + CsrFreeCaptureBuffer(CaptureBuffer); + + return bRet; +} + + +static +BOOL +IntFillConsoleOutputCode(HANDLE hConsoleOutput, + CODE_TYPE CodeType, + PVOID pCode, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfCodesWritten) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_FILLOUTPUTCODE FillOutputRequest = &ApiMessage.Data.FillOutputRequest; + + FillOutputRequest->OutputHandle = hConsoleOutput; + FillOutputRequest->CodeType = CodeType; + + switch (CodeType) + { + case CODE_ASCII: + FillOutputRequest->Code.AsciiChar = *(PCHAR)pCode; + break; + + case CODE_UNICODE: + FillOutputRequest->Code.UnicodeChar = *(PWCHAR)pCode; + break; + + case CODE_ATTRIBUTE: + FillOutputRequest->Code.Attribute = *(PWORD)pCode; + break; + + default: + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + /* Set up the data to send to the Console Server */ + FillOutputRequest->Coord = dwWriteCoord; + FillOutputRequest->Length = nLength; + + /* Call the server */ + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepFillConsoleOutput), + sizeof(CONSOLE_FILLOUTPUTCODE)); + + /* Check for success */ + if (NT_SUCCESS(Status)) + { + if (lpNumberOfCodesWritten != NULL) + *lpNumberOfCodesWritten = FillOutputRequest->Length; + // *lpNumberOfCodesWritten = Request.Data.FillOutputRequest.NrCharactersWritten; + + return TRUE; + } + else + { + if (lpNumberOfCodesWritten != NULL) + *lpNumberOfCodesWritten = 0; + + BaseSetLastNTError(Status); + return FALSE; + } +} + + +/* FUNCTIONS ******************************************************************/ + +/****************** + * Read functions * + ******************/ + +/*-------------------------------------------------------------- + * ReadConsoleW + * + * @implemented + */ +BOOL +WINAPI +ReadConsoleW(HANDLE hConsoleInput, + LPVOID lpBuffer, + DWORD nNumberOfCharsToRead, + LPDWORD lpNumberOfCharsRead, + PCONSOLE_READCONSOLE_CONTROL pInputControl) +{ + return IntReadConsole(hConsoleInput, + lpBuffer, + nNumberOfCharsToRead, + lpNumberOfCharsRead, + pInputControl, + TRUE); +} + + +/*-------------------------------------------------------------- + * ReadConsoleA + * + * @implemented + */ +BOOL +WINAPI +ReadConsoleA(HANDLE hConsoleInput, + LPVOID lpBuffer, + DWORD nNumberOfCharsToRead, + LPDWORD lpNumberOfCharsRead, + PCONSOLE_READCONSOLE_CONTROL pInputControl) +{ + return IntReadConsole(hConsoleInput, + lpBuffer, + nNumberOfCharsToRead, + lpNumberOfCharsRead, + NULL, + FALSE); +} + + +/*-------------------------------------------------------------- + * PeekConsoleInputW + * + * @implemented + */ +BOOL +WINAPI +PeekConsoleInputW(HANDLE hConsoleInput, + PINPUT_RECORD lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsRead) +{ + return IntGetConsoleInput(hConsoleInput, + FALSE, + lpBuffer, + nLength, + lpNumberOfEventsRead, + TRUE); +} + + +/*-------------------------------------------------------------- + * PeekConsoleInputA + * + * @implemented + */ +BOOL +WINAPI +PeekConsoleInputA(HANDLE hConsoleInput, + PINPUT_RECORD lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsRead) +{ + return IntGetConsoleInput(hConsoleInput, + FALSE, + lpBuffer, + nLength, + lpNumberOfEventsRead, + FALSE); +} + + +/*-------------------------------------------------------------- + * ReadConsoleInputW + * + * @implemented + */ +BOOL +WINAPI +ReadConsoleInputW(HANDLE hConsoleInput, + PINPUT_RECORD lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsRead) +{ + return IntGetConsoleInput(hConsoleInput, + TRUE, + lpBuffer, + nLength, + lpNumberOfEventsRead, + TRUE); +} + + +/*-------------------------------------------------------------- + * ReadConsoleInputA + * + * @implemented + */ +BOOL +WINAPI +ReadConsoleInputA(HANDLE hConsoleInput, + PINPUT_RECORD lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsRead) +{ + return IntGetConsoleInput(hConsoleInput, + TRUE, + lpBuffer, + nLength, + lpNumberOfEventsRead, + FALSE); +} + + +BOOL +WINAPI +ReadConsoleInputExW(HANDLE hConsole, LPVOID lpBuffer, DWORD dwLen, LPDWORD Unknown1, DWORD Unknown2) +{ + STUB; + return FALSE; +} + + +BOOL +WINAPI +ReadConsoleInputExA(HANDLE hConsole, LPVOID lpBuffer, DWORD dwLen, LPDWORD Unknown1, DWORD Unknown2) +{ + STUB; + return FALSE; +} + + +/*-------------------------------------------------------------- + * ReadConsoleOutputW + * + * @implemented + */ +BOOL +WINAPI +ReadConsoleOutputW(HANDLE hConsoleOutput, + PCHAR_INFO lpBuffer, + COORD dwBufferSize, + COORD dwBufferCoord, + PSMALL_RECT lpReadRegion) +{ + return IntReadConsoleOutput(hConsoleOutput, + lpBuffer, + dwBufferSize, + dwBufferCoord, + lpReadRegion, + TRUE); +} + + +/*-------------------------------------------------------------- + * ReadConsoleOutputA + * + * @implemented + */ +BOOL +WINAPI +ReadConsoleOutputA(HANDLE hConsoleOutput, + PCHAR_INFO lpBuffer, + COORD dwBufferSize, + COORD dwBufferCoord, + PSMALL_RECT lpReadRegion) +{ + return IntReadConsoleOutput(hConsoleOutput, + lpBuffer, + dwBufferSize, + dwBufferCoord, + lpReadRegion, + FALSE); +} + + +/*-------------------------------------------------------------- + * ReadConsoleOutputCharacterW + * + * @implemented + */ +BOOL +WINAPI +ReadConsoleOutputCharacterW(HANDLE hConsoleOutput, + LPWSTR lpCharacter, + DWORD nLength, + COORD dwReadCoord, + LPDWORD lpNumberOfCharsRead) +{ + return IntReadConsoleOutputCode(hConsoleOutput, + CODE_UNICODE, + lpCharacter, + nLength, + dwReadCoord, + lpNumberOfCharsRead); +} + + +/*-------------------------------------------------------------- + * ReadConsoleOutputCharacterA + * + * @implemented + */ +BOOL +WINAPI +ReadConsoleOutputCharacterA(HANDLE hConsoleOutput, + LPSTR lpCharacter, + DWORD nLength, + COORD dwReadCoord, + LPDWORD lpNumberOfCharsRead) +{ + return IntReadConsoleOutputCode(hConsoleOutput, + CODE_ASCII, + lpCharacter, + nLength, + dwReadCoord, + lpNumberOfCharsRead); +} + + +/*-------------------------------------------------------------- + * ReadConsoleOutputAttribute + * + * @implemented + */ +BOOL +WINAPI +ReadConsoleOutputAttribute(HANDLE hConsoleOutput, + LPWORD lpAttribute, + DWORD nLength, + COORD dwReadCoord, + LPDWORD lpNumberOfAttrsRead) +{ + return IntReadConsoleOutputCode(hConsoleOutput, + CODE_ATTRIBUTE, + lpAttribute, + nLength, + dwReadCoord, + lpNumberOfAttrsRead); +} + + +/******************* + * Write functions * + *******************/ + +/*-------------------------------------------------------------- + * WriteConsoleW + * + * @implemented + */ +BOOL +WINAPI +WriteConsoleW(HANDLE hConsoleOutput, + CONST VOID *lpBuffer, + DWORD nNumberOfCharsToWrite, + LPDWORD lpNumberOfCharsWritten, + LPVOID lpReserved) +{ + return IntWriteConsole(hConsoleOutput, + (PVOID)lpBuffer, + nNumberOfCharsToWrite, + lpNumberOfCharsWritten, + lpReserved, + TRUE); +} + + +/*-------------------------------------------------------------- + * WriteConsoleA + * + * @implemented + */ +BOOL +WINAPI +WriteConsoleA(HANDLE hConsoleOutput, + CONST VOID *lpBuffer, + DWORD nNumberOfCharsToWrite, + LPDWORD lpNumberOfCharsWritten, + LPVOID lpReserved) +{ + return IntWriteConsole(hConsoleOutput, + (PVOID)lpBuffer, + nNumberOfCharsToWrite, + lpNumberOfCharsWritten, + lpReserved, + FALSE); +} + + +/*-------------------------------------------------------------- + * WriteConsoleInputW + * + * @implemented + */ +BOOL +WINAPI +WriteConsoleInputW(HANDLE hConsoleInput, + CONST INPUT_RECORD *lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsWritten) +{ + return IntWriteConsoleInput(hConsoleInput, + (PINPUT_RECORD)lpBuffer, + nLength, + lpNumberOfEventsWritten, + TRUE); +} + + +/*-------------------------------------------------------------- + * WriteConsoleInputA + * + * @implemented + */ +BOOL +WINAPI +WriteConsoleInputA(HANDLE hConsoleInput, + CONST INPUT_RECORD *lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsWritten) +{ + return IntWriteConsoleInput(hConsoleInput, + (PINPUT_RECORD)lpBuffer, + nLength, + lpNumberOfEventsWritten, + FALSE); +} + + +/*-------------------------------------------------------------- + * WriteConsoleOutputW + * + * @implemented + */ +BOOL +WINAPI +WriteConsoleOutputW(HANDLE hConsoleOutput, + CONST CHAR_INFO *lpBuffer, + COORD dwBufferSize, + COORD dwBufferCoord, + PSMALL_RECT lpWriteRegion) +{ + return IntWriteConsoleOutput(hConsoleOutput, + lpBuffer, + dwBufferSize, + dwBufferCoord, + lpWriteRegion, + TRUE); +} + + +/*-------------------------------------------------------------- + * WriteConsoleOutputA + * + * @implemented + */ +BOOL +WINAPI +WriteConsoleOutputA(HANDLE hConsoleOutput, + CONST CHAR_INFO *lpBuffer, + COORD dwBufferSize, + COORD dwBufferCoord, + PSMALL_RECT lpWriteRegion) +{ + return IntWriteConsoleOutput(hConsoleOutput, + lpBuffer, + dwBufferSize, + dwBufferCoord, + lpWriteRegion, + FALSE); +} + + +/*-------------------------------------------------------------- + * WriteConsoleOutputCharacterW + * + * @implemented + */ +BOOL +WINAPI +WriteConsoleOutputCharacterW(HANDLE hConsoleOutput, + LPCWSTR lpCharacter, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfCharsWritten) +{ + return IntWriteConsoleOutputCode(hConsoleOutput, + CODE_UNICODE, + lpCharacter, + nLength, + dwWriteCoord, + lpNumberOfCharsWritten); +} + + +/*-------------------------------------------------------------- + * WriteConsoleOutputCharacterA + * + * @implemented + */ +BOOL +WINAPI +WriteConsoleOutputCharacterA(HANDLE hConsoleOutput, + LPCSTR lpCharacter, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfCharsWritten) +{ + return IntWriteConsoleOutputCode(hConsoleOutput, + CODE_ASCII, + lpCharacter, + nLength, + dwWriteCoord, + lpNumberOfCharsWritten); +} + + +/*-------------------------------------------------------------- + * WriteConsoleOutputAttribute + * + * @implemented + */ +BOOL +WINAPI +WriteConsoleOutputAttribute(HANDLE hConsoleOutput, + CONST WORD *lpAttribute, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfAttrsWritten) +{ + return IntWriteConsoleOutputCode(hConsoleOutput, + CODE_ATTRIBUTE, + lpAttribute, + nLength, + dwWriteCoord, + lpNumberOfAttrsWritten); +} + + +/*-------------------------------------------------------------- + * FillConsoleOutputCharacterW + * + * @implemented + */ +BOOL +WINAPI +FillConsoleOutputCharacterW(HANDLE hConsoleOutput, + WCHAR cCharacter, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfCharsWritten) +{ + return IntFillConsoleOutputCode(hConsoleOutput, + CODE_UNICODE, + &cCharacter, + nLength, + dwWriteCoord, + lpNumberOfCharsWritten); +} + + +/*-------------------------------------------------------------- + * FillConsoleOutputCharacterA + * + * @implemented + */ +BOOL +WINAPI +FillConsoleOutputCharacterA(HANDLE hConsoleOutput, + CHAR cCharacter, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfCharsWritten) +{ + return IntFillConsoleOutputCode(hConsoleOutput, + CODE_ASCII, + &cCharacter, + nLength, + dwWriteCoord, + lpNumberOfCharsWritten); +} + + +/*-------------------------------------------------------------- + * FillConsoleOutputAttribute + * + * @implemented + */ +BOOL +WINAPI +FillConsoleOutputAttribute(HANDLE hConsoleOutput, + WORD wAttribute, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfAttrsWritten) +{ + return IntFillConsoleOutputCode(hConsoleOutput, + CODE_ATTRIBUTE, + &wAttribute, + nLength, + dwWriteCoord, + lpNumberOfAttrsWritten); +} + +/* EOF */ Index: dll/win32/kernel32/client/console/readwrite.c =================================================================== --- dll/win32/kernel32/client/console/readwrite.c (rvision 58607) +++ dll/win32/kernel32/client/console/readwrite.c (copie de travail) Modification de proprits sur dll/win32/kernel32/client/console/readwrite.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: dll/win32/kernel32/client/console/vista.c =================================================================== --- dll/win32/kernel32/client/console/vista.c (rvision 0) +++ dll/win32/kernel32/client/console/vista.c (copie de travail) @@ -0,0 +1,177 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Vista functions + * PROGRAMMER: Thomas Weidenmueller (w3seek@reactos.com) + * Hermes Belusca-Maito (hermes.belusca@sfr.fr) + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + + +/* PUBLIC FUNCTIONS ***********************************************************/ + +#if _WIN32_WINNT >= 0x600 + +/*-------------------------------------------------------------- + * GetConsoleHistoryInfo + * + * @implemented + */ +BOOL +WINAPI +GetConsoleHistoryInfo(PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETSETHISTORYINFO HistoryInfoRequest = &ApiMessage.Data.HistoryInfoRequest; + + if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetHistory), + sizeof(CONSOLE_GETSETHISTORYINFO)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + lpConsoleHistoryInfo->HistoryBufferSize = HistoryInfoRequest->HistoryBufferSize; + lpConsoleHistoryInfo->NumberOfHistoryBuffers = HistoryInfoRequest->NumberOfHistoryBuffers; + lpConsoleHistoryInfo->dwFlags = HistoryInfoRequest->dwFlags; + + return TRUE; +} + + +/*-------------------------------------------------------------- + * SetConsoleHistoryInfo + * + * @implemented + */ +BOOL +WINAPI +SetConsoleHistoryInfo(IN PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo) +{ + NTSTATUS Status; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETSETHISTORYINFO HistoryInfoRequest = &ApiMessage.Data.HistoryInfoRequest; + + if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + HistoryInfoRequest->HistoryBufferSize = lpConsoleHistoryInfo->HistoryBufferSize; + HistoryInfoRequest->NumberOfHistoryBuffers = lpConsoleHistoryInfo->NumberOfHistoryBuffers; + HistoryInfoRequest->dwFlags = lpConsoleHistoryInfo->dwFlags; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetHistory), + sizeof(CONSOLE_GETSETHISTORYINFO)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/*-------------------------------------------------------------- + * GetConsoleOriginalTitleW + * + * @unimplemented + */ +DWORD +WINAPI +GetConsoleOriginalTitleW(OUT LPWSTR lpConsoleTitle, + IN DWORD nSize) +{ + DPRINT1("GetConsoleOriginalTitleW(0x%p, 0x%x) UNIMPLEMENTED!\n", lpConsoleTitle, nSize); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + + +/*-------------------------------------------------------------- + * GetConsoleOriginalTitleA + * + * @unimplemented + */ +DWORD +WINAPI +GetConsoleOriginalTitleA(OUT LPSTR lpConsoleTitle, + IN DWORD nSize) +{ + DPRINT1("GetConsoleOriginalTitleA(0x%p, 0x%x) UNIMPLEMENTED!\n", lpConsoleTitle, nSize); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + + +/*-------------------------------------------------------------- + * GetConsoleScreenBufferInfoEx + * + * @unimplemented + */ +BOOL +WINAPI +GetConsoleScreenBufferInfoEx(IN HANDLE hConsoleOutput, + OUT PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx) +{ + DPRINT1("GetConsoleScreenBufferInfoEx(0x%p, 0x%p) UNIMPLEMENTED!\n", hConsoleOutput, lpConsoleScreenBufferInfoEx); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/*-------------------------------------------------------------- + * SetConsoleScreenBufferInfoEx + * + * @unimplemented + */ +BOOL +WINAPI +SetConsoleScreenBufferInfoEx(IN HANDLE hConsoleOutput, + IN PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx) +{ + DPRINT1("SetConsoleScreenBufferInfoEx(0x%p, 0x%p) UNIMPLEMENTED!\n", hConsoleOutput, lpConsoleScreenBufferInfoEx); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/*-------------------------------------------------------------- + * GetCurrentConsoleFontEx + * + * @unimplemented + */ +BOOL +WINAPI +GetCurrentConsoleFontEx(IN HANDLE hConsoleOutput, + IN BOOL bMaximumWindow, + OUT PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx) +{ + DPRINT1("GetCurrentConsoleFontEx(0x%p, 0x%x, 0x%p) UNIMPLEMENTED!\n", hConsoleOutput, bMaximumWindow, lpConsoleCurrentFontEx); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +#endif + +/* EOF */ Index: dll/win32/kernel32/client/console/vista.c =================================================================== --- dll/win32/kernel32/client/console/vista.c (rvision 58607) +++ dll/win32/kernel32/client/console/vista.c (copie de travail) Modification de proprits sur dll/win32/kernel32/client/console/vista.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: dll/win32/kernel32/client/dllmain.c =================================================================== --- dll/win32/kernel32/client/dllmain.c (rvision 58607) +++ dll/win32/kernel32/client/dllmain.c (copie de travail) @@ -3,10 +3,8 @@ * PROJECT: ReactOS system libraries * FILE: lib/kernel32/misc/dllmain.c * PURPOSE: Initialization - * PROGRAMMER: Ariadne ( ariadne@xs4all.nl) + * PROGRAMMERS: Ariadne (ariadne@xs4all.nl) * Aleksey Bragin (aleksey@reactos.org) - * UPDATE HISTORY: - * Created 01/11/98 */ /* INCLUDES ******************************************************************/ @@ -29,196 +27,19 @@ HMODULE kernel32_handle = NULL; PPEB Peb; ULONG SessionId; -BOOL ConsoleInitialized = FALSE; static BOOL DllInitialized = FALSE; -BOOL WINAPI -DllMain(HANDLE hInst, - DWORD dwReason, - LPVOID lpReserved); - /* Critical section for various kernel32 data structures */ RTL_CRITICAL_SECTION BaseDllDirectoryLock; -RTL_CRITICAL_SECTION ConsoleLock; -extern BOOL WINAPI DefaultConsoleCtrlHandler(DWORD Event); -extern __declspec(noreturn) VOID CALLBACK ConsoleControlDispatcher(DWORD CodeAndFlag); -extern PHANDLER_ROUTINE InitialHandler[1]; -extern PHANDLER_ROUTINE* CtrlHandlers; -extern ULONG NrCtrlHandlers; -extern ULONG NrAllocatedHandlers; extern BOOL FASTCALL NlsInit(VOID); extern VOID FASTCALL NlsUninit(VOID); -BOOLEAN InWindows = FALSE; #define WIN_OBJ_DIR L"\\Windows" #define SESSION_DIR L"\\Sessions" /* FUNCTIONS *****************************************************************/ -BOOL -WINAPI -BasepInitConsole(VOID) -{ - CSR_API_MESSAGE Request; - ULONG CsrRequest; - NTSTATUS Status; - BOOLEAN NotConsole = FALSE; - PRTL_USER_PROCESS_PARAMETERS Parameters = NtCurrentPeb()->ProcessParameters; - LPCWSTR ExeName; - STARTUPINFO si; - WCHAR SessionDir[256]; - ULONG SessionId = NtCurrentPeb()->SessionId; - BOOLEAN InServer; - - WCHAR lpTest[MAX_PATH]; - GetModuleFileNameW(NULL, lpTest, MAX_PATH); - DPRINT("BasepInitConsole for : %S\n", lpTest); - DPRINT("Our current console handles are: %lx, %lx, %lx %lx\n", - Parameters->ConsoleHandle, Parameters->StandardInput, - Parameters->StandardOutput, Parameters->StandardError); - - /* We have nothing to do 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; - Request.Data.AllocConsoleRequest.ConsoleNeeded = FALSE; - } - else - { - /* Assume one is needed */ - GetStartupInfo(&si); - Request.Data.AllocConsoleRequest.ConsoleNeeded = TRUE; - Request.Data.AllocConsoleRequest.ShowCmd = si.wShowWindow; - - /* Handle the special flags given to us by BasepInitializeEnvironment */ - if (Parameters->ConsoleHandle == HANDLE_DETACHED_PROCESS) - { - /* No console to create */ - DPRINT("No console to create\n"); - Parameters->ConsoleHandle = NULL; - Request.Data.AllocConsoleRequest.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; - Request.Data.AllocConsoleRequest.ShowCmd = SW_HIDE; - } - else - { - if (Parameters->ConsoleHandle == INVALID_HANDLE_VALUE) - { - Parameters->ConsoleHandle = 0; - } - DPRINT("Using existing console: %x\n", Parameters->ConsoleHandle); - } - } - - /* Initialize Console Ctrl Handler and input EXE name */ - ConsoleInitialized = TRUE; - RtlInitializeCriticalSection(&ConsoleLock); - NrAllocatedHandlers = 1; - NrCtrlHandlers = 1; - CtrlHandlers = InitialHandler; - CtrlHandlers[0] = DefaultConsoleCtrlHandler; - - ExeName = wcsrchr(Parameters->ImagePathName.Buffer, L'\\'); - if (ExeName) - SetConsoleInputExeNameW(ExeName + 1); - - /* Now use the proper console handle */ - Request.Data.AllocConsoleRequest.Console = Parameters->ConsoleHandle; - - /* 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...\n"); - Status = CsrClientConnectToServer(SessionDir, - 2, - NULL, - NULL, - &InServer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to connect to CSR (Status %lx)\n", Status); - return FALSE; - } - - /* Nothing to do for server-to-server */ - if (InServer) return TRUE; - - /* - * Normally, we should be connecting to the Console CSR Server... - * but we don't have one yet, so we will instead simply send a create - * console message to the Base Server. When we finally have a Console - * Server, this code should be changed to send connection data instead. - */ - CsrRequest = MAKE_CSR_API(ALLOC_CONSOLE, CSR_CONSOLE); - Request.Data.AllocConsoleRequest.CtrlDispatcher = ConsoleControlDispatcher; - Status = CsrClientCallServer(&Request, - NULL, - CsrRequest, - sizeof(CSR_API_MESSAGE)); - if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) - { - DPRINT1("CSR Failed to give us a console\n"); - /* We're lying here, so at least the process can load... */ - return TRUE; - } - - /* Nothing to do if not a console app */ - if (NotConsole) return TRUE; - - /* We got the handles, let's set them */ - if ((Parameters->ConsoleHandle = Request.Data.AllocConsoleRequest.Console)) - { - /* If we already had some, don't use the new ones */ - if (!Parameters->StandardInput) - { - Parameters->StandardInput = Request.Data.AllocConsoleRequest.InputHandle; - } - if (!Parameters->StandardOutput) - { - Parameters->StandardOutput = Request.Data.AllocConsoleRequest.OutputHandle; - } - if (!Parameters->StandardError) - { - Parameters->StandardError = Request.Data.AllocConsoleRequest.OutputHandle; - } - } - - DPRINT("Console setup: %lx, %lx, %lx, %lx\n", - Parameters->ConsoleHandle, - Parameters->StandardInput, - Parameters->StandardOutput, - Parameters->StandardError); - return TRUE; -} - NTSTATUS NTAPI BaseCreateThreadPoolThread(IN PTHREAD_START_ROUTINE Function, @@ -282,131 +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); + { + /* 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); + /* Don't bother us for each thread */ + LdrDisableThreadCalloutsForDll((PVOID)hDll); - /* Initialize default path to NULL */ - RtlInitUnicodeString(&BaseDefaultPath, NULL); + /* 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); - } + /* 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...\n"); - Status = CsrClientConnectToServer(SessionDir, - InWindows ? 1 : 0, - &Dummy, - &DummySize, - &BaseRunningInServerProcess); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to connect to CSR (Status %lx)\n", Status); - NtTerminateProcess(NtCurrentProcess(), Status); - return FALSE; - } + /* 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[CSR_CONSOLE]; - ASSERT(BaseStaticServerData); + /* 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(); - } + /* 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(); + /* Initialize heap handle table */ + BaseDllInitializeMemoryManager(); - /* Set HMODULE for our DLL */ - kernel32_handle = hCurrentModule = hDll; + /* Set HMODULE for our DLL */ + kernel32_handle = hCurrentModule = hDll; - /* Set the directories */ - BaseWindowsDirectory = BaseStaticServerData->WindowsDirectory; - BaseWindowsSystemDirectory = BaseStaticServerData->WindowsSystemDirectory; + /* 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); + /* 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); + 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; + /* 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 command line */ + InitCommandLines(); - /* Initialize the DLL critical section */ - RtlInitializeCriticalSection(&BaseDllDirectoryLock); + /* Initialize the DLL critical section */ + RtlInitializeCriticalSection(&BaseDllDirectoryLock); - /* Initialize the National Language Support routines */ - if (!NlsInit()) - { - DPRINT1("NLS Init failed\n"); - return FALSE; - } + /* Initialize the National Language Support routines */ + if (!NlsInit()) + { + DPRINT1("NLS Init failed\n"); + return FALSE; + } - /* Initialize Console Support */ - if (!BasepInitConsole()) - { - DPRINT1("Failure to set up console\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); + /* Initialize application certification globals */ + InitializeListHead(&BasepAppCertDllsList); + RtlInitializeCriticalSection(&gcsAppCert); - /* Insert more dll attach stuff here! */ - DllInitialized = TRUE; - DPRINT("Initialization complete\n"); - break; + /* 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); + RtlDeleteCriticalSection(&BaseDllDirectoryLock); } break; + } default: break; Index: dll/win32/kernel32/client/dosdev.c =================================================================== --- dll/win32/kernel32/client/dosdev.c (rvision 58607) +++ dll/win32/kernel32/client/dosdev.c (copie de travail) @@ -3,7 +3,7 @@ * PROJECT: ReactOS system libraries * FILE: lib/kernel32/file/dosdev.c * PURPOSE: Dos device functions - * PROGRAMMER: Ariadne ( ariadne@xs4all.nl) + * PROGRAMMER: Ariadne (ariadne@xs4all.nl) * UPDATE HISTORY: * Created 01/11/98 */ @@ -89,8 +89,9 @@ { ULONG ArgumentCount; ULONG BufferSize; + BASE_API_MESSAGE ApiMessage; + PBASE_DEFINE_DOS_DEVICE DefineDosDeviceRequest = &ApiMessage.Data.DefineDosDeviceRequest; PCSR_CAPTURE_BUFFER CaptureBuffer; - CSR_API_MESSAGE Request; NTSTATUS Status; UNICODE_STRING NtTargetPathU; UNICODE_STRING DeviceNameU; @@ -156,16 +157,16 @@ } else { - Request.Data.DefineDosDeviceRequest.dwFlags = dwFlags; + DefineDosDeviceRequest->dwFlags = dwFlags; CsrCaptureMessageBuffer(CaptureBuffer, (PVOID)DeviceUpcaseNameU.Buffer, DeviceUpcaseNameU.Length, - (PVOID*)&Request.Data.DefineDosDeviceRequest.DeviceName.Buffer); + (PVOID*)&DefineDosDeviceRequest->DeviceName.Buffer); - Request.Data.DefineDosDeviceRequest.DeviceName.Length = + DefineDosDeviceRequest->DeviceName.Length = DeviceUpcaseNameU.Length; - Request.Data.DefineDosDeviceRequest.DeviceName.MaximumLength = + DefineDosDeviceRequest->DeviceName.MaximumLength = DeviceUpcaseNameU.Length; if (NtTargetPathU.Buffer) @@ -173,24 +174,22 @@ CsrCaptureMessageBuffer(CaptureBuffer, (PVOID)NtTargetPathU.Buffer, NtTargetPathU.Length, - (PVOID*)&Request.Data.DefineDosDeviceRequest.TargetName.Buffer); + (PVOID*)&DefineDosDeviceRequest->TargetName.Buffer); } - Request.Data.DefineDosDeviceRequest.TargetName.Length = + DefineDosDeviceRequest->TargetName.Length = NtTargetPathU.Length; - Request.Data.DefineDosDeviceRequest.TargetName.MaximumLength = + DefineDosDeviceRequest->TargetName.MaximumLength = NtTargetPathU.Length; - Status = CsrClientCallServer(&Request, + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, CaptureBuffer, - MAKE_CSR_API(DEFINE_DOS_DEVICE, CSR_CONSOLE), - sizeof(CSR_API_MESSAGE)); + CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepDefineDosDevice), + sizeof(BASE_DEFINE_DOS_DEVICE)); CsrFreeCaptureBuffer(CaptureBuffer); - if (! NT_SUCCESS(Status) || - ! NT_SUCCESS(Status = Request.Status)) + if (!NT_SUCCESS(Status)) { - WARN("CsrClientCallServer() failed (Status %lx)\n", - Status); + WARN("CsrClientCallServer() failed (Status %lx)\n", Status); BaseSetLastNTError(Status); Result = FALSE; } Index: dll/win32/kernel32/client/file/create.c =================================================================== --- dll/win32/kernel32/client/file/create.c (rvision 58607) +++ dll/win32/kernel32/client/file/create.c (copie de travail) @@ -98,6 +98,7 @@ OBJECT_ATTRIBUTES ObjectAttributes; IO_STATUS_BLOCK IoStatusBlock; UNICODE_STRING NtPathU; + LPCWSTR pszConsoleFileName; HANDLE FileHandle; NTSTATUS Status; ULONG FileAttributes, Flags = 0; @@ -141,10 +142,10 @@ } /* check for console input/output */ - if (0 == _wcsicmp(L"CONOUT$", lpFileName) - || 0 == _wcsicmp(L"CONIN$", lpFileName)) + pszConsoleFileName = IntCheckForConsoleFileName(lpFileName, dwDesiredAccess); + if (pszConsoleFileName) { - return OpenConsoleW(lpFileName, + return OpenConsoleW(pszConsoleFileName, dwDesiredAccess, lpSecurityAttributes ? lpSecurityAttributes->bInheritHandle : FALSE, FILE_SHARE_READ | FILE_SHARE_WRITE); Index: dll/win32/kernel32/client/file/deviceio.c =================================================================== --- dll/win32/kernel32/client/file/deviceio.c (rvision 58607) +++ dll/win32/kernel32/client/file/deviceio.c (copie de travail) @@ -18,21 +18,22 @@ WINAPI NotifySoundSentry(VOID) { - CSR_API_MESSAGE ApiMessage; + BASE_API_MESSAGE ApiMessage; + PBASE_SOUND_SENTRY SoundSentryRequest = &ApiMessage.Data.SoundSentryRequest; /* Get the video mode */ - if (!GetConsoleDisplayMode(&ApiMessage.Data.SoundSentryRequest.VideoMode)) + if (!GetConsoleDisplayMode(&SoundSentryRequest->VideoMode)) { - ApiMessage.Data.SoundSentryRequest.VideoMode = 0; + SoundSentryRequest->VideoMode = 0; } /* Make sure it's not fullscreen, and send the message if not */ - if (ApiMessage.Data.SoundSentryRequest.VideoMode == 0) + if (SoundSentryRequest->VideoMode == 0) { - CsrClientCallServer(&ApiMessage, + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, NULL, - MAKE_CSR_API(SOUND_SENTRY, CSR_NATIVE), - sizeof(CSR_API_MESSAGE)); + CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepSoundSentryNotification), + sizeof(BASE_SOUND_SENTRY)); } } Index: dll/win32/kernel32/client/file/filename.c =================================================================== --- dll/win32/kernel32/client/file/filename.c (rvision 58607) +++ dll/win32/kernel32/client/file/filename.c (copie de travail) @@ -3,7 +3,7 @@ * PROJECT: ReactOS system libraries * FILE: lib/kernel32/file/file.c * PURPOSE: Directory functions - * PROGRAMMER: Ariadne ( ariadne@xs4all.nl) + * PROGRAMMERS: Ariadne (ariadne@xs4all.nl) * Pierre Schweitzer (pierre.schweitzer@reactos.org) * UPDATE HISTORY: * Created 01/11/98 @@ -91,7 +91,8 @@ UINT ID, Num = 0; CHAR IDString[5]; WCHAR * TempFileName; - CSR_API_MESSAGE ApiMessage; + BASE_API_MESSAGE ApiMessage; + PBASE_GET_TEMP_FILE GetTempFile = &ApiMessage.Data.GetTempFile; DWORD FileAttributes, LastError; UNICODE_STRING PathNameString, PrefixString; static const WCHAR Ext[] = { L'.', 't', 'm', 'p', UNICODE_NULL }; @@ -157,14 +158,17 @@ /* If user didn't gave any ID, ask Csrss to give one */ if (!uUnique) { - CsrClientCallServer(&ApiMessage, NULL, MAKE_CSR_API(GET_TEMP_FILE, CSR_NATIVE), sizeof(CSR_API_MESSAGE)); - if (ApiMessage.Data.GetTempFile.UniqueID == 0) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepGetTempFile), + sizeof(BASE_GET_TEMP_FILE)); + if (GetTempFile->UniqueID == 0) { Num++; continue; } - ID = ApiMessage.Data.GetTempFile.UniqueID; + ID = GetTempFile->UniqueID; } else { Index: dll/win32/kernel32/client/proc.c =================================================================== --- dll/win32/kernel32/client/proc.c (rvision 58607) +++ dll/win32/kernel32/client/proc.c (copie de travail) @@ -3,7 +3,7 @@ * PROJECT: ReactOS system libraries * FILE: lib/kernel32/proc/proc.c * PURPOSE: Process functions - * PROGRAMMER: Ariadne ( ariadne@xs4all.nl) + * PROGRAMMERS: Ariadne (ariadne@xs4all.nl) * UPDATE HISTORY: * Created 01/11/98 */ @@ -493,26 +493,26 @@ BasepNotifyCsrOfThread(IN HANDLE ThreadHandle, IN PCLIENT_ID ClientId) { - ULONG Request = CREATE_THREAD; - CSR_API_MESSAGE CsrRequest; NTSTATUS Status; + BASE_API_MESSAGE ApiMessage; + PBASE_CREATE_THREAD CreateThreadRequest = &ApiMessage.Data.CreateThreadRequest; DPRINT("BasepNotifyCsrOfThread: Thread: %lx, Handle %lx\n", ClientId->UniqueThread, ThreadHandle); /* Fill out the request */ - CsrRequest.Data.CreateThreadRequest.ClientId = *ClientId; - CsrRequest.Data.CreateThreadRequest.ThreadHandle = ThreadHandle; + CreateThreadRequest->ClientId = *ClientId; + CreateThreadRequest->ThreadHandle = ThreadHandle; /* Call CSR */ - Status = CsrClientCallServer(&CsrRequest, + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, NULL, - MAKE_CSR_API(Request, CSR_NATIVE), - sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status)) + CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepCreateThread), + sizeof(BASE_CREATE_THREAD)); + if (!NT_SUCCESS(Status)) { - DPRINT1("Failed to tell csrss about new thread: %lx %lx\n", Status, CsrRequest.Status); - return CsrRequest.Status; + DPRINT1("Failed to tell CSRSS about new thread: %lx\n", Status); + return Status; } /* Return Success */ @@ -528,17 +528,17 @@ LPSECURITY_ATTRIBUTES lpThreadAttributes, PSECTION_IMAGE_INFORMATION SectionImageInfo, PCLIENT_ID ClientId, - BOOLEAN InheritHandles, DWORD dwCreationFlags) { + NTSTATUS Status; OBJECT_ATTRIBUTES LocalObjectAttributes; POBJECT_ATTRIBUTES ObjectAttributes; CONTEXT Context; INITIAL_TEB InitialTeb; - NTSTATUS Status; HANDLE hThread; - ULONG Request = CREATE_PROCESS; - CSR_API_MESSAGE CsrRequest; + BASE_API_MESSAGE ApiMessage; + PBASE_CREATE_PROCESS CreateProcessRequest = &ApiMessage.Data.CreateProcessRequest; + DPRINT("BasepCreateFirstThread. hProcess: %lx\n", ProcessHandle); /* Create the Thread's Stack */ @@ -574,20 +574,29 @@ } /* Fill out the request to notify CSRSS */ - CsrRequest.Data.CreateProcessRequest.ClientId = *ClientId; - CsrRequest.Data.CreateProcessRequest.ProcessHandle = ProcessHandle; - CsrRequest.Data.CreateProcessRequest.ThreadHandle = hThread; - CsrRequest.Data.CreateProcessRequest.CreationFlags = dwCreationFlags; - CsrRequest.Data.CreateProcessRequest.bInheritHandles = InheritHandles; + CreateProcessRequest->ClientId = *ClientId; + CreateProcessRequest->ProcessHandle = ProcessHandle; + CreateProcessRequest->ThreadHandle = hThread; + CreateProcessRequest->CreationFlags = dwCreationFlags; + /* + * For GUI applications we turn on the 2nd bit. This also allows + * us to know whether or not the application is a GUI or CUI app. + */ + if (IMAGE_SUBSYSTEM_WINDOWS_GUI == SectionImageInfo->SubSystemType) + { + CreateProcessRequest->ProcessHandle = (HANDLE) + ((ULONG_PTR)CreateProcessRequest->ProcessHandle | 2); + } + /* Call CSR */ - Status = CsrClientCallServer(&CsrRequest, + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, NULL, - MAKE_CSR_API(Request, CSR_NATIVE), - sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status)) + CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepCreateProcess), + sizeof(BASE_CREATE_PROCESS)); + if (!NT_SUCCESS(Status)) { - DPRINT1("Failed to tell csrss about new process: %lx %lx\n", Status, CsrRequest.Status); + DPRINT1("Failed to tell CSRSS about new process: %lx\n", Status); return NULL; } @@ -935,19 +944,19 @@ ProcessParameters->StandardError = StartupInfo->hStdError; } - /* Use Special Flags for ConDllInitialize in Kernel32 */ + /* Use Special Flags for BasepInitConsole in Kernel32 */ if (CreationFlags & DETACHED_PROCESS) { ProcessParameters->ConsoleHandle = HANDLE_DETACHED_PROCESS; } + else if (CreationFlags & CREATE_NEW_CONSOLE) + { + ProcessParameters->ConsoleHandle = HANDLE_CREATE_NEW_CONSOLE; + } else if (CreationFlags & CREATE_NO_WINDOW) { ProcessParameters->ConsoleHandle = HANDLE_CREATE_NO_WINDOW; } - else if (CreationFlags & CREATE_NEW_CONSOLE) - { - ProcessParameters->ConsoleHandle = HANDLE_CREATE_NEW_CONSOLE; - } else { /* Inherit our Console Handle */ @@ -1175,24 +1184,25 @@ GetProcessShutdownParameters(OUT LPDWORD lpdwLevel, OUT LPDWORD lpdwFlags) { - CSR_API_MESSAGE CsrRequest; NTSTATUS Status; + BASE_API_MESSAGE ApiMessage; + PBASE_GET_PROCESS_SHUTDOWN_PARAMS GetShutdownParametersRequest = &ApiMessage.Data.GetShutdownParametersRequest; /* Ask CSRSS for shutdown information */ - Status = CsrClientCallServer(&CsrRequest, + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, NULL, - MAKE_CSR_API(GET_SHUTDOWN_PARAMETERS, CSR_NATIVE), - sizeof(CSR_API_MESSAGE)); - if (!(NT_SUCCESS(Status)) || !(NT_SUCCESS(CsrRequest.Status))) + CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepGetProcessShutdownParam), + sizeof(BASE_GET_PROCESS_SHUTDOWN_PARAMS)); + if (!NT_SUCCESS(Status)) { /* Return the failure from CSRSS */ - BaseSetLastNTError(CsrRequest.Status); + BaseSetLastNTError(Status); return FALSE; } - /* Get the data out of the LCP reply */ - *lpdwLevel = CsrRequest.Data.GetShutdownParametersRequest.Level; - *lpdwFlags = CsrRequest.Data.GetShutdownParametersRequest.Flags; + /* Get the data back */ + *lpdwLevel = GetShutdownParametersRequest->Level; + *lpdwFlags = GetShutdownParametersRequest->Flags; return TRUE; } @@ -1204,20 +1214,21 @@ SetProcessShutdownParameters(IN DWORD dwLevel, IN DWORD dwFlags) { - CSR_API_MESSAGE CsrRequest; NTSTATUS Status; + BASE_API_MESSAGE ApiMessage; + PBASE_SET_PROCESS_SHUTDOWN_PARAMS SetShutdownParametersRequest = &ApiMessage.Data.SetShutdownParametersRequest; /* Write the data into the CSRSS request and send it */ - CsrRequest.Data.SetShutdownParametersRequest.Level = dwLevel; - CsrRequest.Data.SetShutdownParametersRequest.Flags = dwFlags; - Status = CsrClientCallServer(&CsrRequest, + SetShutdownParametersRequest->Level = dwLevel; + SetShutdownParametersRequest->Flags = dwFlags; + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, NULL, - MAKE_CSR_API(SET_SHUTDOWN_PARAMETERS, CSR_NATIVE), - sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status)) + CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepSetProcessShutdownParam), + sizeof(BASE_SET_PROCESS_SHUTDOWN_PARAMS)); + if (!NT_SUCCESS(Status)) { /* Return the failure from CSRSS */ - BaseSetLastNTError(CsrRequest.Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1741,7 +1752,9 @@ WINAPI ExitProcess(IN UINT uExitCode) { - CSR_API_MESSAGE CsrRequest; + BASE_API_MESSAGE ApiMessage; + PBASE_EXIT_PROCESS ExitProcessRequest = &ApiMessage.Data.ExitProcessRequest; + ASSERT(!BaseRunningInServerProcess); _SEH2_TRY @@ -1756,11 +1769,11 @@ LdrShutdownProcess(); /* Notify Base Server of process termination */ - CsrRequest.Data.TerminateProcessRequest.uExitCode = uExitCode; - CsrClientCallServer(&CsrRequest, + ExitProcessRequest->uExitCode = uExitCode; + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, NULL, - MAKE_CSR_API(TERMINATE_PROCESS, CSR_NATIVE), - sizeof(CSR_API_MESSAGE)); + CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepExitProcess), + sizeof(BASE_EXIT_PROCESS)); /* Now do it again */ NtTerminateProcess(NtCurrentProcess(), uExitCode); @@ -3235,7 +3248,6 @@ lpThreadAttributes, &SectionImageInfo, &ClientId, - bInheritHandles, dwCreationFlags); if (hThread == NULL) Index: dll/win32/kernel32/client/vdm.c =================================================================== --- dll/win32/kernel32/client/vdm.c (rvision 58607) +++ dll/win32/kernel32/client/vdm.c (copie de travail) @@ -70,7 +70,7 @@ IN PCWCH CommandLine, IN PCWCH CurrentDirectory, IN PANSI_STRING AnsiEnvironment, - IN PCSR_API_MESSAGE Msg, + IN PCSR_API_MESSAGE ApiMessage, IN OUT PULONG iTask, IN DWORD CreationFlags, IN LPSTARTUPINFOW StartupInfo) @@ -87,9 +87,10 @@ IN ULONG IndexInfo, IN ULONG BinaryType) { +#if 0 // Unimplemented in BASESRV NTSTATUS Status; - CSR_API_MESSAGE Msg; - ULONG CsrRequest = MAKE_CSR_API(UPDATE_VDM_ENTRY, CSR_CONSOLE); + BASE_API_MESSAGE ApiMessage; + PBASE_UPDATE_VDM_ENTRY UpdateVdmEntry = &ApiMessage.Data.UpdateVdmEntry; /* Check what update is being sent */ switch (UpdateIndex) @@ -98,16 +99,16 @@ case VdmEntryUndo: /* Tell the server how far we had gotten along */ - Msg.Data.UpdateVdmEntry.iTask = (ULONG)*WaitHandle; - Msg.Data.UpdateVdmEntry.VDMCreationState = IndexInfo; + UpdateVdmEntry->iTask = (ULONG)*WaitHandle; + UpdateVdmEntry->VDMCreationState = IndexInfo; break; /* VDM is ready with a new process handle */ case VdmEntryUpdateProcess: /* Send it the process handle */ - Msg.Data.UpdateVdmEntry.VDMProcessHandle = *WaitHandle; - Msg.Data.UpdateVdmEntry.iTask = IndexInfo; + UpdateVdmEntry->VDMProcessHandle = *WaitHandle; + UpdateVdmEntry->iTask = IndexInfo; break; } @@ -115,29 +116,32 @@ if (BinaryType == BINARY_TYPE_WOW) { /* Magic value for 16-bit apps */ - Msg.Data.UpdateVdmEntry.ConsoleHandle = (HANDLE)-1; + UpdateVdmEntry->ConsoleHandle = (HANDLE)-1; } - else if (Msg.Data.UpdateVdmEntry.iTask) + else if (UpdateVdmEntry->iTask) { /* No handle for true VDM */ - Msg.Data.UpdateVdmEntry.ConsoleHandle = 0; + UpdateVdmEntry->ConsoleHandle = 0; } else { /* Otherwise, send the regular consoel handle */ - Msg.Data.UpdateVdmEntry.ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + UpdateVdmEntry->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; } /* Finally write the index and binary type */ - Msg.Data.UpdateVdmEntry.EntryIndex = UpdateIndex; - Msg.Data.UpdateVdmEntry.BinaryType = BinaryType; + UpdateVdmEntry->EntryIndex = UpdateIndex; + UpdateVdmEntry->BinaryType = BinaryType; /* Send the message to CSRSS */ - Status = CsrClientCallServer(&Msg, NULL, CsrRequest, sizeof(Msg)); - if (!(NT_SUCCESS(Status)) || !(NT_SUCCESS(Msg.Status))) + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepUpdateVDMEntry), + sizeof(BASE_UPDATE_VDM_ENTRY)); + if (!NT_SUCCESS(Status)) { /* Handle failure */ - BaseSetLastNTError(Msg.Status); + BaseSetLastNTError(Status); return FALSE; } @@ -145,9 +149,9 @@ if (UpdateIndex == VdmEntryUpdateProcess) { /* Return it to the caller */ - *WaitHandle = Msg.Data.UpdateVdmEntry.WaitObjectForParent; + *WaitHandle = UpdateVdmEntry->WaitObjectForParent; } - +#endif /* We made it */ return TRUE; } @@ -157,10 +161,11 @@ BaseCheckForVDM(IN HANDLE ProcessHandle, OUT LPDWORD ExitCode) { +#if 0 // Unimplemented in BASESRV NTSTATUS Status; EVENT_BASIC_INFORMATION EventBasicInfo; - CSR_API_MESSAGE Msg; - ULONG CsrRequest = MAKE_CSR_API(GET_VDM_EXIT_CODE, CSR_CONSOLE); + BASE_API_MESSAGE ApiMessage; + PBASE_GET_VDM_EXIT_CODE GetVdmExitCode = &ApiMessage.Data.GetVdmExitCode; /* It's VDM if the process is actually a wait handle (an event) */ Status = NtQueryEvent(ProcessHandle, @@ -171,15 +176,19 @@ if (!NT_SUCCESS(Status)) return FALSE; /* Setup the input parameters */ - Msg.Data.GetVdmExitCode.ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; - Msg.Data.GetVdmExitCode.hParent = ProcessHandle; + GetVdmExitCode->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + GetVdmExitCode->hParent = ProcessHandle; /* Call CSRSS */ - Status = CsrClientCallServer(&Msg, NULL, CsrRequest, sizeof(Msg)); + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepGetVDMExitCode /* BasepCheckVDM */), + sizeof(BASE_GET_VDM_EXIT_CODE)); if (!NT_SUCCESS(Status)) return FALSE; /* Get the exit code from the reply */ - *ExitCode = Msg.Data.GetVdmExitCode.ExitCode; + *ExitCode = GetVdmExitCode->ExitCode; +#endif return TRUE; } Index: dll/win32/kernel32/client/vista.c =================================================================== --- dll/win32/kernel32/client/vista.c (rvision 58607) +++ dll/win32/kernel32/client/vista.c (copie de travail) @@ -1,9 +1,12 @@ -/* COPYRIGHT: See COPYING in the top level directory +/* + * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries * PURPOSE: Vista functions * PROGRAMMER: Thomas Weidenmueller */ +/* INCLUDES *******************************************************************/ + #include #define NDEBUG @@ -101,8 +104,8 @@ * @implemented */ BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, - IN DWORD dwSpinCount, - IN DWORD flags ) + IN DWORD dwSpinCount, + IN DWORD flags) { NTSTATUS Status; @@ -124,7 +127,6 @@ } - /* * @implemented */ @@ -228,6 +230,7 @@ return Result; } + /* * @unimplemented */ @@ -309,147 +312,7 @@ return E_FAIL; } -/*-------------------------------------------------------------- - * GetConsoleHistoryInfo - * - * @implemented - */ -BOOL -WINAPI -GetConsoleHistoryInfo(PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo) -{ - CSR_API_MESSAGE Request; - ULONG CsrRequest = MAKE_CSR_API(GET_HISTORY_INFO, CSR_CONSOLE); - NTSTATUS Status; - if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) - { - BaseSetLastNTError(Status); - return FALSE; - } - lpConsoleHistoryInfo->HistoryBufferSize = Request.Data.GetHistoryInfo.HistoryBufferSize; - lpConsoleHistoryInfo->NumberOfHistoryBuffers = Request.Data.GetHistoryInfo.NumberOfHistoryBuffers; - lpConsoleHistoryInfo->dwFlags = Request.Data.GetHistoryInfo.dwFlags; - return TRUE; -} - -/*-------------------------------------------------------------- - * SetConsoleHistoryInfo - * - * @implemented - */ -BOOL -WINAPI -SetConsoleHistoryInfo(IN PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo) -{ - CSR_API_MESSAGE Request; - ULONG CsrRequest = MAKE_CSR_API(GET_HISTORY_INFO, CSR_CONSOLE); - NTSTATUS Status; - if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - Request.Data.SetHistoryInfo.HistoryBufferSize = lpConsoleHistoryInfo->HistoryBufferSize; - Request.Data.SetHistoryInfo.NumberOfHistoryBuffers = lpConsoleHistoryInfo->NumberOfHistoryBuffers; - Request.Data.SetHistoryInfo.dwFlags = lpConsoleHistoryInfo->dwFlags; - Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) - { - BaseSetLastNTError(Status); - return FALSE; - } - return TRUE; -} - - -/*-------------------------------------------------------------- - * GetConsoleOriginalTitleW - * - * @unimplemented - */ -DWORD -WINAPI -GetConsoleOriginalTitleW(OUT LPWSTR lpConsoleTitle, - IN DWORD nSize) -{ - DPRINT1("GetConsoleOriginalTitleW(0x%p, 0x%x) UNIMPLEMENTED!\n", lpConsoleTitle, nSize); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - - -/*-------------------------------------------------------------- - * GetConsoleOriginalTitleA - * - * @unimplemented - */ -DWORD -WINAPI -GetConsoleOriginalTitleA(OUT LPSTR lpConsoleTitle, - IN DWORD nSize) -{ - DPRINT1("GetConsoleOriginalTitleA(0x%p, 0x%x) UNIMPLEMENTED!\n", lpConsoleTitle, nSize); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - - -/*-------------------------------------------------------------- - * GetConsoleScreenBufferInfoEx - * - * @unimplemented - */ -BOOL -WINAPI -GetConsoleScreenBufferInfoEx(IN HANDLE hConsoleOutput, - OUT PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx) -{ - DPRINT1("GetConsoleScreenBufferInfoEx(0x%p, 0x%p) UNIMPLEMENTED!\n", hConsoleOutput, lpConsoleScreenBufferInfoEx); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - - -/*-------------------------------------------------------------- - * SetConsoleScreenBufferInfoEx - * - * @unimplemented - */ -BOOL -WINAPI -SetConsoleScreenBufferInfoEx(IN HANDLE hConsoleOutput, - IN PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx) -{ - DPRINT1("SetConsoleScreenBufferInfoEx(0x%p, 0x%p) UNIMPLEMENTED!\n", hConsoleOutput, lpConsoleScreenBufferInfoEx); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - - -/*-------------------------------------------------------------- - * GetCurrentConsoleFontEx - * - * @unimplemented - */ -BOOL -WINAPI -GetCurrentConsoleFontEx(IN HANDLE hConsoleOutput, - IN BOOL bMaximumWindow, - OUT PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx) -{ - DPRINT1("GetCurrentConsoleFontEx(0x%p, 0x%x, 0x%p) UNIMPLEMENTED!\n", hConsoleOutput, bMaximumWindow, lpConsoleCurrentFontEx); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - - /* * @implemented */ @@ -687,6 +550,7 @@ return Ret; } + /* * @unimplemented */ @@ -708,6 +572,7 @@ return 0; } + /* * @implemented */ @@ -775,6 +640,7 @@ return Ret; } + /* * @unimplemented */ Index: dll/win32/kernel32/CMakeLists.txt =================================================================== --- dll/win32/kernel32/CMakeLists.txt (rvision 58607) +++ dll/win32/kernel32/CMakeLists.txt (copie de travail) @@ -4,40 +4,45 @@ spec2def(kernel32.dll kernel32.spec ADD_IMPORTLIB) list(APPEND SOURCE - client/appcache.c - client/atom.c - client/compname.c + client/appcache.c + client/atom.c + client/compname.c client/debugger.c client/dosdev.c - client/dllmain.c - client/environ.c + client/dllmain.c + client/environ.c client/except.c client/fiber.c - client/handle.c + client/handle.c client/heapmem.c client/job.c - client/loader.c - client/path.c - client/perfcnt.c - client/power.c + client/loader.c + client/path.c + client/perfcnt.c + client/power.c client/proc.c - client/resntfy.c + client/resntfy.c client/session.c client/synch.c - client/sysinfo.c - client/time.c - client/timerqueue.c - client/toolhelp.c - client/utils.c + client/sysinfo.c + client/time.c + client/timerqueue.c + client/toolhelp.c + client/utils.c client/thread.c - client/vdm.c - client/version.c + client/vdm.c + client/version.c client/virtmem.c client/vista.c + 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 client/file/cnotify.c client/file/copy.c - client/file/console.c client/file/create.c client/file/delete.c client/file/deviceio.c Index: dll/win32/kernel32/include/console.h =================================================================== --- dll/win32/kernel32/include/console.h (rvision 0) +++ dll/win32/kernel32/include/console.h (copie de travail) @@ -0,0 +1,69 @@ +/* + * 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); + +DWORD WINAPI +ConsoleControlDispatcher(IN LPVOID lpThreadParameter); + +DWORD WINAPI +PropDialogHandler(IN LPVOID lpThreadParameter); + +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 +InitConsoleInfo(IN OUT PCONSOLE_START_INFO ConsoleStartInfo); + +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 */ Index: dll/win32/kernel32/include/console.h =================================================================== --- dll/win32/kernel32/include/console.h (rvision 58607) +++ dll/win32/kernel32/include/console.h (copie de travail) Modification de proprits sur dll/win32/kernel32/include/console.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: dll/win32/kernel32/include/kernel32.h =================================================================== --- dll/win32/kernel32/include/kernel32.h (rvision 58607) +++ dll/win32/kernel32/include/kernel32.h (copie de travail) @@ -61,13 +61,6 @@ #define FIELD_OFFSET(type,fld) ((LONG)&(((type *)0)->fld)) #endif -#define IsConsoleHandle(h) \ - (((((ULONG_PTR)h) & 0x10000003) == 0x3) ? TRUE : FALSE) - -#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? // @@ -109,19 +102,20 @@ typedef struct _CODEPAGE_ENTRY { - LIST_ENTRY Entry; - UINT CodePage; - HANDLE SectionHandle; - PBYTE SectionMapping; - CPTABLEINFO CodePageTable; + LIST_ENTRY Entry; + UINT CodePage; + HANDLE SectionHandle; + PBYTE SectionMapping; + CPTABLEINFO CodePageTable; } CODEPAGE_ENTRY, *PCODEPAGE_ENTRY; -typedef struct tagLOADPARMS32 { - LPSTR lpEnvAddress; - LPSTR lpCmdLine; - WORD wMagicValue; - WORD wCmdShow; - DWORD dwReserved; +typedef struct tagLOADPARMS32 +{ + LPSTR lpEnvAddress; + LPSTR lpCmdLine; + WORD wMagicValue; + WORD wCmdShow; + DWORD dwReserved; } LOADPARMS32; typedef enum _BASE_SEARCH_PATH_TYPE @@ -155,7 +149,6 @@ #define BASEP_GET_MODULE_HANDLE_EX_PARAMETER_VALIDATION_SUCCESS 2 #define BASEP_GET_MODULE_HANDLE_EX_PARAMETER_VALIDATION_CONTINUE 3 - extern PBASE_STATIC_SERVER_DATA BaseStaticServerData; typedef @@ -164,8 +157,6 @@ HANDLE hProcess, DWORD dwMilliseconds); - -extern BOOLEAN InWindows; extern WaitForInputIdleType UserWaitForInputIdleRoutine; /* GLOBAL VARIABLES **********************************************************/ @@ -192,24 +183,8 @@ NTAPI BaseDllInitializeMemoryManager(VOID); -BOOL WINAPI VerifyConsoleIoHandle(HANDLE Handle); - -BOOL WINAPI CloseConsoleHandle(HANDLE Handle); - -HANDLE WINAPI -GetConsoleInputWaitHandle (VOID); - -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); @@ -427,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, Index: dll/win32/kernel32/k32.h =================================================================== --- dll/win32/kernel32/k32.h (rvision 58607) +++ dll/win32/kernel32/k32.h (copie de travail) @@ -43,7 +43,12 @@ #include /* CSRSS Header */ -#include +#include +#include +#include +#include +#include +#include /* C Headers */ //#include @@ -65,4 +70,7 @@ /* Base Macros */ #include "include/base_x.h" +/* Console API Client Definitions */ +#include "include/console.h" + #endif Index: dll/win32/shell32/shelllink.cpp =================================================================== --- dll/win32/shell32/shelllink.cpp (rvision 58607) +++ dll/win32/shell32/shelllink.cpp (copie de travail) @@ -1825,10 +1825,10 @@ else path = strdupW(sPath); - if (lpici->cbSize == sizeof (CMINVOKECOMMANDINFOEX) && - (lpici->fMask & CMIC_MASK_UNICODE)) + if ( lpici->cbSize == sizeof(CMINVOKECOMMANDINFOEX) && + (lpici->fMask & CMIC_MASK_UNICODE) ) { - LPCMINVOKECOMMANDINFOEX iciex = (LPCMINVOKECOMMANDINFOEX) lpici; + LPCMINVOKECOMMANDINFOEX iciex = (LPCMINVOKECOMMANDINFOEX)lpici; DWORD len = 2; if (sArgs) @@ -1854,8 +1854,10 @@ SHELLEXECUTEINFOW sei; memset(&sei, 0, sizeof sei); sei.cbSize = sizeof sei; - sei.fMask = SEE_MASK_UNICODE | (lpici->fMask & (SEE_MASK_NOASYNC | SEE_MASK_ASYNCOK | SEE_MASK_FLAG_NO_UI)); + sei.fMask = SEE_MASK_HASLINKNAME | SEE_MASK_UNICODE | + (lpici->fMask & (SEE_MASK_NOASYNC | SEE_MASK_ASYNCOK | SEE_MASK_FLAG_NO_UI)); sei.lpFile = path; + sei.lpClass = sLinkPath; sei.nShow = iShowCmd; sei.lpDirectory = sWorkDir; sei.lpParameters = args; Index: dll/win32/shell32/shelllink.h =================================================================== --- dll/win32/shell32/shelllink.h (rvision 58607) +++ dll/win32/shell32/shelllink.h (copie de travail) @@ -67,11 +67,11 @@ LPWSTR sWorkDir; LPWSTR sDescription; LPWSTR sPathRel; - LPWSTR sProduct; - LPWSTR sComponent; + LPWSTR sProduct; + LPWSTR sComponent; volume_info volume; - LPWSTR sLinkPath; - BOOL bRunAs; + LPWSTR sLinkPath; + BOOL bRunAs; BOOL bDirty; INT iIdOpen; /* id of the "Open" entry in the context menu */ CComPtr site; Index: dll/win32/shell32/shlexec.cpp =================================================================== --- dll/win32/shell32/shlexec.cpp (rvision 58607) +++ dll/win32/shell32/shlexec.cpp (copie de travail) @@ -450,6 +450,11 @@ startup.cb = sizeof(STARTUPINFOW); startup.dwFlags = STARTF_USESHOWWINDOW; startup.wShowWindow = psei->nShow; + startup.lpTitle = (LPWSTR)(psei->fMask & (SEE_MASK_HASLINKNAME | SEE_MASK_HASTITLE) ? psei->lpClass : NULL); + + if (psei->fMask & SEE_MASK_HASLINKNAME) + startup.dwFlags |= STARTF_TITLEISLINKNAME; + dwCreationFlags = CREATE_UNICODE_ENVIRONMENT; if (psei->fMask & SEE_MASK_NO_CONSOLE) Index: include/ndk/umfuncs.h =================================================================== --- include/ndk/umfuncs.h (rvision 58607) +++ include/ndk/umfuncs.h (copie de travail) @@ -26,103 +26,6 @@ #include // -// Don't force inclusion of csrss header, leave this opaque. -// -struct _CSR_API_MESSAGE; -struct _CSR_CAPTURE_BUFFER; - -// -// CSR Functions -// -PVOID -NTAPI -CsrAllocateCaptureBuffer( - ULONG ArgumentCount, - ULONG BufferSize -); - -ULONG -NTAPI -CsrAllocateMessagePointer( - struct _CSR_CAPTURE_BUFFER *CaptureBuffer, - ULONG MessageLength, - PVOID *CaptureData -); - -VOID -NTAPI -CsrCaptureMessageBuffer( - struct _CSR_CAPTURE_BUFFER *CaptureBuffer, - PVOID MessageString, - ULONG StringLength, - PVOID *CapturedData -); - -NTSTATUS -NTAPI -CsrClientConnectToServer( - PWSTR ObjectDirectory, - ULONG ServerId, - PVOID ConnectionInfo, - PULONG ConnectionInfoSize, - PBOOLEAN ServerToServerCall -); - -NTSTATUS -NTAPI -CsrClientCallServer( - struct _CSR_API_MESSAGE *Request, - _In_opt_ struct _CSR_CAPTURE_BUFFER *CaptureBuffer, - ULONG ApiNumber, - ULONG RequestLength -); - -NTSTATUS -NTAPI -CsrIdentifyAlertableThread( - VOID -); - -VOID -NTAPI -CsrFreeCaptureBuffer( - struct _CSR_CAPTURE_BUFFER *CaptureBuffer -); - -HANDLE -NTAPI -CsrGetProcessId( - VOID -); - -NTSTATUS -NTAPI -CsrNewThread(VOID); - -NTSTATUS -NTAPI -CsrSetPriorityClass( - HANDLE Process, - PULONG PriorityClass -); - -VOID -NTAPI -CsrProbeForRead( - _In_ PVOID Address, - _In_ ULONG Length, - _In_ ULONG Alignment -); - -VOID -NTAPI -CsrProbeForWrite( - _In_ PVOID Address, - _In_ ULONG Length, - _In_ ULONG Alignment -); - -// // Debug Functions // __analysis_noreturn Index: include/ndk/umtypes.h =================================================================== --- include/ndk/umtypes.h (rvision 58607) +++ include/ndk/umtypes.h (copie de travail) @@ -114,13 +114,6 @@ #define MAXULONG 0xffffffff // -// CSR Macros -// -#define CSR_MAKE_OPCODE(s,m) ((s) << 16) | (m) -#define CSR_API_ID_FROM_OPCODE(n) ((ULONG)((USHORT)(n))) -#define CSR_SERVER_ID_FROM_OPCODE(n) (ULONG)((n) >> 16) - -// // Basic Types that aren't defined in User-Mode Headers // typedef CONST int CINT; Index: include/psdk/shellapi.h =================================================================== --- include/psdk/shellapi.h (rvision 58607) +++ include/psdk/shellapi.h (copie de travail) @@ -20,23 +20,42 @@ #define ABE_BOTTOM 3 #define ABS_AUTOHIDE 1 #define ABS_ALWAYSONTOP 2 -#define SEE_MASK_CLASSNAME 1 -#define SEE_MASK_CLASSKEY 3 -#define SEE_MASK_IDLIST 4 -#define SEE_MASK_INVOKEIDLIST 12 -#define SEE_MASK_ICON 0x10 -#define SEE_MASK_HOTKEY 0x20 -#define SEE_MASK_NOCLOSEPROCESS 0x40 -#define SEE_MASK_CONNECTNETDRV 0x80 + +#define SEE_MASK_DEFAULT 0x00000000 +#define SEE_MASK_CLASSNAME 0x00000001 +#define SEE_MASK_CLASSKEY 0x00000003 +#define SEE_MASK_IDLIST 0x00000004 +#define SEE_MASK_INVOKEIDLIST 0x0000000C +#define SEE_MASK_ICON 0x00000010 +#define SEE_MASK_HOTKEY 0x00000020 +#define SEE_MASK_NOCLOSEPROCESS 0x00000040 +#define SEE_MASK_CONNECTNETDRV 0x00000080 #define SEE_MASK_NOASYNC 0x00000100 #define SEE_MASK_FLAG_DDEWAIT SEE_MASK_NOASYNC -#define SEE_MASK_DOENVSUBST 0x200 -#define SEE_MASK_FLAG_NO_UI 0x400 -#define SEE_MASK_NO_CONSOLE 0x8000 -#define SEE_MASK_UNICODE 0x10000 -#define SEE_MASK_ASYNCOK 0x100000 -#define SEE_MASK_HMONITOR 0x200000 -#define SEE_MASK_NOZONECHECKS 0x00800000 +#define SEE_MASK_DOENVSUBST 0x00000200 +#define SEE_MASK_FLAG_NO_UI 0x00000400 +#define SEE_MASK_UNICODE 0x00004000 +#define SEE_MASK_NO_CONSOLE 0x00008000 +/* + * NOTE: The following three flags are undocumented and are not present in the + * official Windows SDK. However they are used in shobjidl.idl to define some + * CMIC_MASK_* flags, these ones being mentioned in the MSDN documentation of + * the CMINVOKECOMMANDINFOEX structure. + * I affect them this range of values which seems to be strangely empty. Of + * course their values may differ from the real ones, however I have no way + * of discovering them. If somebody else can verify them, it would be great. + */ +#define SEE_MASK_HASLINKNAME 0x00010000 +#define SEE_MASK_HASTITLE 0x00020000 +#define SEE_MASK_FLAG_SEPVDM 0x00040000 +/* END NOTE */ +#define SEE_MASK_ASYNCOK 0x00100000 +#define SEE_MASK_HMONITOR 0x00200000 +#define SEE_MASK_NOZONECHECKS 0x00800000 +#define SEE_MASK_NOQUERYCLASSSTORE 0x01000000 +#define SEE_MASK_WAITFORINPUTIDLE 0x02000000 +#define SEE_MASK_FLAG_LOG_USAGE 0x04000000 + #define ABM_NEW 0 #define ABM_REMOVE 1 #define ABM_QUERYPOS 2 Index: include/psdk/winbase.h =================================================================== --- include/psdk/winbase.h (rvision 58607) +++ include/psdk/winbase.h (copie de travail) @@ -467,16 +467,23 @@ #define STREAM_MODIFIED_WHEN_READ 1 #define STREAM_CONTAINS_SECURITY 2 #define STREAM_CONTAINS_PROPERTIES 4 -#define STARTF_USESHOWWINDOW 1 -#define STARTF_USESIZE 2 -#define STARTF_USEPOSITION 4 -#define STARTF_USECOUNTCHARS 8 -#define STARTF_USEFILLATTRIBUTE 16 -#define STARTF_RUNFULLSCREEN 32 -#define STARTF_FORCEONFEEDBACK 64 -#define STARTF_FORCEOFFFEEDBACK 128 -#define STARTF_USESTDHANDLES 256 -#define STARTF_USEHOTKEY 512 + +#define STARTF_USESHOWWINDOW 0x00000001 +#define STARTF_USESIZE 0x00000002 +#define STARTF_USEPOSITION 0x00000004 +#define STARTF_USECOUNTCHARS 0x00000008 +#define STARTF_USEFILLATTRIBUTE 0x00000010 +#define STARTF_RUNFULLSCREEN 0x00000020 +#define STARTF_FORCEONFEEDBACK 0x00000040 +#define STARTF_FORCEOFFFEEDBACK 0x00000080 +#define STARTF_USESTDHANDLES 0x00000100 +#if (WINVER >= 0x400) +#define STARTF_USEHOTKEY 0x00000200 +#define STARTF_TITLEISLINKNAME 0x00000800 +#define STARTF_TITLEISAPPID 0x00001000 +#define STARTF_PREVENTPINNING 0x00002000 +#endif /* (WINVER >= 0x400) */ + #define TC_NORMAL 0 #define TC_HARDERR 1 #define TC_GP_TRAP 2 Index: include/psdk/wincon.h =================================================================== --- include/psdk/wincon.h (rvision 58607) +++ include/psdk/wincon.h (copie de travail) @@ -14,26 +14,45 @@ #pragma warning(disable:4820) #endif -#define FOREGROUND_BLUE 1 -#define FOREGROUND_GREEN 2 -#define FOREGROUND_RED 4 -#define FOREGROUND_INTENSITY 8 -#define BACKGROUND_BLUE 16 -#define BACKGROUND_GREEN 32 -#define BACKGROUND_RED 64 -#define BACKGROUND_INTENSITY 128 -#define CTRL_C_EVENT 0 -#define CTRL_BREAK_EVENT 1 -#define CTRL_CLOSE_EVENT 2 -#define CTRL_LOGOFF_EVENT 5 +/* + * Color attributes for text and screen background + */ +#define FOREGROUND_BLUE 0x0001 +#define FOREGROUND_GREEN 0x0002 +#define FOREGROUND_RED 0x0004 +#define FOREGROUND_INTENSITY 0x0008 +#define BACKGROUND_BLUE 0x0010 +#define BACKGROUND_GREEN 0x0020 +#define BACKGROUND_RED 0x0040 +#define BACKGROUND_INTENSITY 0x0080 + +/* + * Control handler codes + */ +#define CTRL_C_EVENT 0 +#define CTRL_BREAK_EVENT 1 +#define CTRL_CLOSE_EVENT 2 +#define CTRL_LOGOFF_EVENT 5 #define CTRL_SHUTDOWN_EVENT 6 -#define ENABLE_LINE_INPUT 2 -#define ENABLE_ECHO_INPUT 4 -#define ENABLE_PROCESSED_INPUT 1 -#define ENABLE_WINDOW_INPUT 8 -#define ENABLE_MOUSE_INPUT 16 -#define ENABLE_PROCESSED_OUTPUT 1 -#define ENABLE_WRAP_AT_EOL_OUTPUT 2 + +/* + * Input mode flags + */ +#define ENABLE_PROCESSED_INPUT 0x0001 +#define ENABLE_LINE_INPUT 0x0002 +#define ENABLE_ECHO_INPUT 0x0004 +#define ENABLE_WINDOW_INPUT 0x0008 +#define ENABLE_MOUSE_INPUT 0x0010 +#define ENABLE_INSERT_MODE 0x0020 +#define ENABLE_QUICK_EDIT_MODE 0x0040 +#define ENABLE_EXTENDED_FLAGS 0x0080 + +/* + * Output mode flags + */ +#define ENABLE_PROCESSED_OUTPUT 0x0001 +#define ENABLE_WRAP_AT_EOL_OUTPUT 0x0002 + #define KEY_EVENT 1 #define MOUSE_EVENT 2 #define WINDOW_BUFFER_SIZE_EVENT 4 @@ -172,10 +191,12 @@ #endif #endif -BOOL WINAPI AllocConsole(void); +BOOL WINAPI AllocConsole(VOID); + #if (_WIN32_WINNT >= 0x0501) #define ATTACH_PARENT_PROCESS (DWORD)-1 BOOL WINAPI AttachConsole(_In_ DWORD); + BOOL WINAPI AddConsoleAliasA(_In_ LPCSTR, _In_ LPCSTR, _In_ LPCSTR); BOOL WINAPI AddConsoleAliasW(_In_ LPCWSTR, _In_ LPCWSTR, _In_ LPCWSTR); @@ -209,20 +230,36 @@ _In_ DWORD AliasBufferLength, _In_ LPWSTR ExeName); -DWORD WINAPI GetConsoleAliasesLengthA(_In_ LPSTR); -DWORD WINAPI GetConsoleAliasesLengthW(_In_ LPWSTR); +DWORD WINAPI GetConsoleAliasesLengthA(_In_ LPSTR ExeName); +DWORD WINAPI GetConsoleAliasesLengthW(_In_ LPWSTR ExeName); + +DWORD +WINAPI +GetConsoleAliasExesA( + _Out_writes_(ExeNameBufferLength) LPSTR ExeNameBuffer, + _In_ DWORD ExeNameBufferLength); + +DWORD +WINAPI +GetConsoleAliasExesW( + _Out_writes_(ExeNameBufferLength) LPWSTR ExeNameBuffer, + _In_ DWORD ExeNameBufferLength); + +DWORD WINAPI GetConsoleAliasExesLengthA(VOID); +DWORD WINAPI GetConsoleAliasExesLengthW(VOID); #endif + HANDLE WINAPI CreateConsoleScreenBuffer(_In_ DWORD, _In_ DWORD, _In_opt_ CONST SECURITY_ATTRIBUTES*, _In_ DWORD, _Reserved_ LPVOID); BOOL WINAPI FillConsoleOutputAttribute(_In_ HANDLE, _In_ WORD, _In_ DWORD, _In_ COORD, _Out_ PDWORD); BOOL WINAPI FillConsoleOutputCharacterA(_In_ HANDLE, _In_ CHAR, _In_ DWORD, _In_ COORD, _Out_ PDWORD); BOOL WINAPI FillConsoleOutputCharacterW(_In_ HANDLE, _In_ WCHAR, _In_ DWORD, _In_ COORD, _Out_ PDWORD); BOOL WINAPI FlushConsoleInputBuffer(_In_ HANDLE); -BOOL WINAPI FreeConsole(void); +BOOL WINAPI FreeConsole(VOID); BOOL WINAPI GenerateConsoleCtrlEvent(_In_ DWORD, _In_ DWORD); -UINT WINAPI GetConsoleCP(void); +UINT WINAPI GetConsoleCP(VOID); BOOL WINAPI GetConsoleCursorInfo(_In_ HANDLE, _Out_ PCONSOLE_CURSOR_INFO); BOOL WINAPI GetConsoleMode(HANDLE,PDWORD); -UINT WINAPI GetConsoleOutputCP(void); +UINT WINAPI GetConsoleOutputCP(VOID); BOOL WINAPI GetConsoleScreenBufferInfo(_In_ HANDLE, _Out_ PCONSOLE_SCREEN_BUFFER_INFO); DWORD @@ -238,7 +275,7 @@ _In_ DWORD nSize); #if (_WIN32_WINNT >= 0x0500) -HWND WINAPI GetConsoleWindow(void); +HWND WINAPI GetConsoleWindow(VOID); WINBASEAPI BOOL APIENTRY GetConsoleDisplayMode(_Out_ LPDWORD lpModeFlags); BOOL APIENTRY SetConsoleDisplayMode(_In_ HANDLE hConsoleOutput, _In_ DWORD dwFlags, _Out_opt_ PCOORD lpNewScreenBufferDimensions); #endif @@ -389,11 +426,12 @@ #define CONSOLE_WINDOWED_MODE 2 #ifdef UNICODE -#define FillConsoleOutputCharacter FillConsoleOutputCharacterW #define AddConsoleAlias AddConsoleAliasW #define GetConsoleAlias GetConsoleAliasW #define GetConsoleAliases GetConsoleAliasesW #define GetConsoleAliasesLength GetConsoleAliasesLengthW +#define GetConsoleAliasExes GetConsoleAliasExesW +#define GetConsoleAliasExesLength GetConsoleAliasExesLengthW #define GetConsoleTitle GetConsoleTitleW #define PeekConsoleInput PeekConsoleInputW #define ReadConsole ReadConsoleW @@ -405,13 +443,15 @@ #define WriteConsole WriteConsoleW #define WriteConsoleInput WriteConsoleInputW #define WriteConsoleOutput WriteConsoleOutputW +#define FillConsoleOutputCharacter FillConsoleOutputCharacterW #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterW #else #define AddConsoleAlias AddConsoleAliasA -#define FillConsoleOutputCharacter FillConsoleOutputCharacterA #define GetConsoleAlias GetConsoleAliasA #define GetConsoleAliases GetConsoleAliasesA #define GetConsoleAliasesLength GetConsoleAliasesLengthA +#define GetConsoleAliasExes GetConsoleAliasExesA +#define GetConsoleAliasExesLength GetConsoleAliasExesLengthA #define GetConsoleTitle GetConsoleTitleA #define PeekConsoleInput PeekConsoleInputA #define ReadConsole ReadConsoleA @@ -423,6 +463,7 @@ #define WriteConsole WriteConsoleA #define WriteConsoleInput WriteConsoleInputA #define WriteConsoleOutput WriteConsoleOutputA +#define FillConsoleOutputCharacter FillConsoleOutputCharacterA #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA #endif Index: include/reactos/subsys/csr =================================================================== --- include/reactos/subsys/csr (rvision 58607) +++ include/reactos/subsys/csr (copie de travail) Modification de proprits sur include/reactos/subsys/csr ___________________________________________________________________ Added: svn:ignore ## -0,0 +1,7 ## +GNUmakefile +*.vcproj +*.user +*.cbp +*.ncb +*.suo +*.sln Index: include/reactos/subsys/csr/csr.h =================================================================== --- include/reactos/subsys/csr/csr.h (rvision 0) +++ include/reactos/subsys/csr/csr.h (copie de travail) @@ -0,0 +1,96 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: include/reactos/subsys/csr/csr.h + * PURPOSE: Public definitions for CSR Clients + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + * Hermes Belusca-Maito (hermes.belusca@sfr.fr) + */ + +#ifndef _CSR_H +#define _CSR_H + +#include "csrmsg.h" + +NTSTATUS +NTAPI +CsrClientConnectToServer(IN PWSTR ObjectDirectory, + IN ULONG ServerId, + IN PVOID ConnectionInfo, + IN OUT PULONG ConnectionInfoSize, + OUT PBOOLEAN ServerToServerCall); + +NTSTATUS +NTAPI +CsrClientCallServer(IN OUT PCSR_API_MESSAGE ApiMessage, + IN OUT PCSR_CAPTURE_BUFFER CaptureBuffer OPTIONAL, + IN CSR_API_NUMBER ApiNumber, + IN ULONG DataLength); + +PCSR_CAPTURE_BUFFER +NTAPI +CsrAllocateCaptureBuffer(IN ULONG ArgumentCount, + IN ULONG BufferSize); + +ULONG +NTAPI +CsrAllocateMessagePointer(IN OUT PCSR_CAPTURE_BUFFER CaptureBuffer, + IN ULONG MessageLength, + OUT PVOID *CapturedData); + +VOID +NTAPI +CsrCaptureMessageBuffer(IN OUT PCSR_CAPTURE_BUFFER CaptureBuffer, + IN PVOID MessageBuffer OPTIONAL, + IN ULONG MessageLength, + OUT PVOID *CapturedData); + +VOID +NTAPI +CsrCaptureMessageString(IN OUT PCSR_CAPTURE_BUFFER CaptureBuffer, + IN LPSTR String OPTIONAL, + IN ULONG StringLength, + IN ULONG MaximumLength, + OUT PANSI_STRING CapturedString); + +VOID +NTAPI +CsrFreeCaptureBuffer(IN PCSR_CAPTURE_BUFFER CaptureBuffer); + +PLARGE_INTEGER +NTAPI +CsrCaptureTimeout(IN ULONG Milliseconds, + OUT PLARGE_INTEGER Timeout); + +VOID +NTAPI +CsrProbeForRead(IN PVOID Address, + IN ULONG Length, + IN ULONG Alignment); + +VOID +NTAPI +CsrProbeForWrite(IN PVOID Address, + IN ULONG Length, + IN ULONG Alignment); + +NTSTATUS +NTAPI +CsrIdentifyAlertableThread(VOID); + +HANDLE +NTAPI +CsrGetProcessId(VOID); + +NTSTATUS +NTAPI +CsrNewThread(VOID); + +NTSTATUS +NTAPI +CsrSetPriorityClass(IN HANDLE Process, + IN OUT PULONG PriorityClass); + +#endif // _CSR_H + +/* EOF */ Index: include/reactos/subsys/csr/csr.h =================================================================== --- include/reactos/subsys/csr/csr.h (rvision 58607) +++ include/reactos/subsys/csr/csr.h (copie de travail) Modification de proprits sur include/reactos/subsys/csr/csr.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: include/reactos/subsys/csr/csrmsg.h =================================================================== --- include/reactos/subsys/csr/csrmsg.h (rvision 0) +++ include/reactos/subsys/csr/csrmsg.h (copie de travail) @@ -0,0 +1,156 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: include/reactos/subsys/csr/csrmsg.h + * PURPOSE: Public definitions for communication + * between CSR Clients and Servers + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + * Hermes Belusca-Maito (hermes.belusca@sfr.fr) + */ + +#ifndef _CSRMSG_H +#define _CSRMSG_H + +#pragma once + + +#define CSR_PORT_NAME L"ApiPort" // CSR_API_PORT_NAME + + +#define CSRSRV_SERVERDLL_INDEX 0 +#define CSRSRV_FIRST_API_NUMBER 0 + +typedef enum _CSRSRV_API_NUMBER +{ + CsrpClientConnect = CSRSRV_FIRST_API_NUMBER, + CsrpThreadConnect, + CsrpProfileControl, + CsrpIdentifyAlertable, + CsrpSetPriorityClass, + + CsrpMaxApiNumber +} CSRSRV_API_NUMBER, *PCSRSRV_API_NUMBER; + + +/* +typedef union _CSR_API_NUMBER +{ + WORD Index; + WORD Subsystem; +} CSR_API_NUMBER, *PCSR_API_NUMBER; +*/ +typedef ULONG CSR_API_NUMBER; + +#define CSR_CREATE_API_NUMBER(ServerId, ApiId) \ + (CSR_API_NUMBER)(((ServerId) << 16) | (ApiId)) + +#define CSR_API_NUMBER_TO_SERVER_ID(ApiNumber) \ + (ULONG)((ULONG)(ApiNumber) >> 16) + +#define CSR_API_NUMBER_TO_API_ID(ApiNumber) \ + (ULONG)((ULONG)(ApiNumber) & 0xFFFF) + + +typedef struct _CSR_CONNECTION_INFO +{ + ULONG Version; + ULONG Unknown; + HANDLE ObjectDirectory; + PVOID SharedSectionBase; + PVOID SharedSectionHeap; + PVOID SharedSectionData; + ULONG DebugFlags; + ULONG Unknown2[3]; + HANDLE ProcessId; +} CSR_CONNECTION_INFO, *PCSR_CONNECTION_INFO; + +// We must have a size at most equal to the maximum acceptable LPC data size. +C_ASSERT(sizeof(CSR_CONNECTION_INFO) <= LPC_MAX_DATA_LENGTH); + + +typedef struct _CSR_IDENTIFY_ALTERTABLE_THREAD +{ + CLIENT_ID Cid; +} CSR_IDENTIFY_ALTERTABLE_THREAD, *PCSR_IDENTIFY_ALTERTABLE_THREAD; + +typedef struct _CSR_SET_PRIORITY_CLASS +{ + HANDLE hProcess; + ULONG PriorityClass; +} CSR_SET_PRIORITY_CLASS, *PCSR_SET_PRIORITY_CLASS; + +typedef struct +{ + HANDLE UniqueThread; + CLIENT_ID Cid; +} CSRSS_IDENTIFY_ALERTABLE_THREAD, *PCSRSS_IDENTIFY_ALERTABLE_THREAD; + +typedef struct _CSR_CLIENT_CONNECT +{ + ULONG ServerId; + PVOID ConnectionInfo; + ULONG ConnectionInfoSize; +} CSR_CLIENT_CONNECT, *PCSR_CLIENT_CONNECT; + +typedef struct _CSR_CAPTURE_BUFFER +{ + ULONG Size; + struct _CSR_CAPTURE_BUFFER *PreviousCaptureBuffer; + ULONG PointerCount; + PVOID BufferEnd; + ULONG_PTR PointerOffsetsArray[ANYSIZE_ARRAY]; +} CSR_CAPTURE_BUFFER, *PCSR_CAPTURE_BUFFER; + + +typedef struct _CSR_API_MESSAGE +{ + PORT_MESSAGE Header; + union + { + CSR_CONNECTION_INFO ConnectionInfo; // Uniquely used in CSRSRV for internal signaling (opening a new connection). + struct + { + PCSR_CAPTURE_BUFFER CsrCaptureData; + CSR_API_NUMBER ApiNumber; + NTSTATUS Status; // ReturnValue; + ULONG Reserved; + union + { + CSR_CLIENT_CONNECT CsrClientConnect; + CSR_SET_PRIORITY_CLASS SetPriorityClass; + CSR_IDENTIFY_ALTERTABLE_THREAD IdentifyAlertableThread; + + // + // This padding is used to make the CSR_API_MESSAGE structure + // large enough to hold full other API_MESSAGE-type structures + // used by other servers. These latter structures's sizes must + // be checked against the size of CSR_API_MESSAGE by using the + // CHECK_API_MSG_SIZE macro defined below. + // + // This is required because LPC will use this generic structure + // for communicating all the different servers' messages, and + // thus we avoid possible buffer overflows with this method. + // The problems there are, that we have to manually adjust the + // size of the padding to hope that all the servers' messaging + // structures will hold in it, or, that we have to be careful + // to not define too big messaging structures for the servers. + // + // Finally, the overall message structure size must be at most + // equal to the maximum acceptable LPC message size. + // + ULONG_PTR Padding[35]; + } Data; + }; + }; +} CSR_API_MESSAGE, *PCSR_API_MESSAGE; + +// We must have a size at most equal to the maximum acceptable LPC message size. +C_ASSERT(sizeof(CSR_API_MESSAGE) <= LPC_MAX_MESSAGE_LENGTH); + +// Macro to check that the total size of servers' message structures +// are at most equal to the size of the CSR_API_MESSAGE structure. +#define CHECK_API_MSG_SIZE(type) C_ASSERT(sizeof(type) <= sizeof(CSR_API_MESSAGE)) + +#endif // _CSRMSG_H + +/* EOF */ Index: include/reactos/subsys/csr/csrmsg.h =================================================================== --- include/reactos/subsys/csr/csrmsg.h (rvision 58607) +++ include/reactos/subsys/csr/csrmsg.h (copie de travail) Modification de proprits sur include/reactos/subsys/csr/csrmsg.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: include/reactos/subsys/csr/csrsrv.h =================================================================== --- include/reactos/subsys/csr/csrsrv.h (rvision 0) +++ include/reactos/subsys/csr/csrsrv.h (copie de travail) @@ -0,0 +1,430 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: include/reactos/subsys/csr/csrsrv.h + * PURPOSE: Public definitions for CSR Servers + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + * Hermes Belusca-Maito (hermes.belusca@sfr.fr) + */ + +#ifndef _CSRSRV_H +#define _CSRSRV_H + +// see http://code.google.com/p/ontl/source/browse/branches/x64/ntl/nt/csr.hxx?r=67 + +/* +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning (disable:4201) +#endif +*/ + +#include "csrmsg.h" + + +/* TYPES **********************************************************************/ + +// Used in ntdll/csr/connect.c +#define CSR_CSRSS_SECTION_SIZE 65536 + +typedef struct _CSR_NT_SESSION +{ + ULONG ReferenceCount; + LIST_ENTRY SessionLink; + ULONG SessionId; +} CSR_NT_SESSION, *PCSR_NT_SESSION; + +typedef struct _CSR_PROCESS +{ + CLIENT_ID ClientId; + LIST_ENTRY ListLink; + LIST_ENTRY ThreadList; + PCSR_NT_SESSION NtSession; + ULONG ExpectedVersion; + HANDLE ClientPort; + ULONG_PTR ClientViewBase; + ULONG_PTR ClientViewBounds; + HANDLE ProcessHandle; + ULONG SequenceNumber; + ULONG Flags; + ULONG DebugFlags; + CLIENT_ID DebugCid; + ULONG ReferenceCount; + ULONG ProcessGroupId; + ULONG ProcessGroupSequence; + ULONG fVDM; + ULONG ThreadCount; + ULONG PriorityClass; + ULONG Reserved; + ULONG ShutdownLevel; + ULONG ShutdownFlags; + PVOID ServerData[ANYSIZE_ARRAY]; // One structure per CSR server. +} CSR_PROCESS, *PCSR_PROCESS; + +typedef struct _CSR_THREAD +{ + LARGE_INTEGER CreateTime; + LIST_ENTRY Link; + LIST_ENTRY HashLinks; + CLIENT_ID ClientId; + PCSR_PROCESS Process; + struct _CSR_WAIT_BLOCK *WaitBlock; + HANDLE ThreadHandle; + ULONG Flags; + ULONG ReferenceCount; + ULONG ImpersonationCount; +} CSR_THREAD, *PCSR_THREAD; + +#define CsrGetClientThread() \ + ((PCSR_THREAD)(NtCurrentTeb()->CsrClientThread)) + + +/* ENUMERATIONS ***************************************************************/ + +typedef enum _CSR_PROCESS_FLAGS +{ + CsrProcessTerminating = 0x1, + CsrProcessSkipShutdown = 0x2, + CsrProcessNormalPriority = 0x10, + CsrProcessIdlePriority = 0x20, + CsrProcessHighPriority = 0x40, + CsrProcessRealtimePriority = 0x80, + CsrProcessCreateNewGroup = 0x100, + CsrProcessTerminated = 0x200, + CsrProcessLastThreadTerminated = 0x400, + CsrProcessIsConsoleApp = 0x800 +} CSR_PROCESS_FLAGS, *PCSR_PROCESS_FLAGS; + +#define CsrProcessPriorityFlags (CsrProcessNormalPriority | \ + CsrProcessIdlePriority | \ + CsrProcessHighPriority | \ + CsrProcessRealtimePriority) + +typedef enum _CSR_THREAD_FLAGS +{ + CsrThreadAlertable = 0x1, + CsrThreadInTermination = 0x2, + CsrThreadTerminated = 0x4, + CsrThreadIsServerThread = 0x10 +} CSR_THREAD_FLAGS, *PCSR_THREAD_FLAGS; + +typedef enum _SHUTDOWN_RESULT +{ + CsrShutdownCsrProcess = 1, + CsrShutdownNonCsrProcess, + CsrShutdownCancelled +} SHUTDOWN_RESULT, *PSHUTDOWN_RESULT; + +typedef enum _CSR_SHUTDOWN_FLAGS +{ + CsrShutdownSystem = 4, + CsrShutdownOther = 8 +} CSR_SHUTDOWN_FLAGS, *PCSR_SHUTDOWN_FLAGS; + +typedef enum _CSR_DEBUG_FLAGS +{ + CsrDebugOnlyThisProcess = 1, + CsrDebugProcessChildren = 2 +} CSR_PROCESS_DEBUG_FLAGS, *PCSR_PROCESS_DEBUG_FLAGS; + +typedef enum _CSR_REPLY_CODE +{ + CsrReplyImmediately = 0, + CsrReplyPending = 1, + CsrReplyDeadClient = 2, + CsrReplyAlreadySent = 3 +} CSR_REPLY_CODE, *PCSR_REPLY_CODE; + + +/* FUNCTION TYPES AND STRUCTURES **********************************************/ + +/* + * Wait block + */ +typedef +BOOLEAN +(*CSR_WAIT_FUNCTION)( + IN PLIST_ENTRY WaitList, + IN PCSR_THREAD WaitThread, + IN PCSR_API_MESSAGE WaitApiMessage, + IN PVOID WaitContext, + IN PVOID WaitArgument1, + IN PVOID WaitArgument2, + IN ULONG WaitFlags +); + +typedef struct _CSR_WAIT_BLOCK +{ + ULONG Size; // Size of the wait block (variable-sized) + LIST_ENTRY WaitList; + LIST_ENTRY UserWaitList; + PVOID WaitContext; + PCSR_THREAD WaitThread; + CSR_WAIT_FUNCTION WaitFunction; + CSR_API_MESSAGE WaitApiMessage; // Variable-sized CSR API message +} CSR_WAIT_BLOCK, *PCSR_WAIT_BLOCK; + + +/* + * Server DLL structure + */ +typedef +NTSTATUS +(NTAPI *PCSR_API_ROUTINE)( + IN OUT PCSR_API_MESSAGE ApiMessage, + IN OUT PCSR_REPLY_CODE ReplyCode OPTIONAL +); + +#define CSR_API(n) \ + NTSTATUS NTAPI n(IN OUT PCSR_API_MESSAGE ApiMessage, \ + IN OUT PCSR_REPLY_CODE ReplyCode OPTIONAL) + +typedef +NTSTATUS +(NTAPI *PCSR_CONNECT_CALLBACK)( + IN PCSR_PROCESS CsrProcess, + IN OUT PVOID ConnectionInfo, + IN OUT PULONG ConnectionInfoLength +); + +typedef +VOID +(NTAPI *PCSR_DISCONNECT_CALLBACK)(IN PCSR_PROCESS CsrProcess); + +typedef +NTSTATUS +(NTAPI *PCSR_NEWPROCESS_CALLBACK)( + IN PCSR_PROCESS Parent, + IN PCSR_PROCESS CsrProcess +); + +typedef +VOID +(NTAPI *PCSR_HARDERROR_CALLBACK)( + IN PCSR_THREAD CsrThread, + IN PHARDERROR_MSG HardErrorMessage +); + +typedef +ULONG +(NTAPI *PCSR_SHUTDOWNPROCESS_CALLBACK)( + IN PCSR_PROCESS CsrProcess, + IN ULONG Flags, + IN BOOLEAN FirstPhase +); + +typedef struct _CSR_SERVER_DLL +{ + ULONG Length; + HANDLE Event; + ANSI_STRING Name; + HANDLE ServerHandle; + ULONG ServerId; + ULONG Unknown; + ULONG ApiBase; // ApiNumberBase + ULONG HighestApiSupported; // MaxApiNumber + PCSR_API_ROUTINE *DispatchTable; + PBOOLEAN ValidTable; // Table of booleans which describe whether or not a server function call is valid when it is called via CsrCallServerFromServer. + PCHAR *NameTable; + ULONG SizeOfProcessData; + PCSR_CONNECT_CALLBACK ConnectCallback; + PCSR_DISCONNECT_CALLBACK DisconnectCallback; + PCSR_HARDERROR_CALLBACK HardErrorCallback; + PVOID SharedSection; // SharedStaticServerData + PCSR_NEWPROCESS_CALLBACK NewProcessCallback; + PCSR_SHUTDOWNPROCESS_CALLBACK ShutdownProcessCallback; + ULONG Unknown2[3]; +} CSR_SERVER_DLL, *PCSR_SERVER_DLL; + + +typedef +NTSTATUS +(NTAPI *PCSR_SERVER_DLL_INIT_CALLBACK)(IN PCSR_SERVER_DLL LoadedServerDll); + +#define CSR_SERVER_DLL_INIT(n) \ + NTSTATUS NTAPI n(IN PCSR_SERVER_DLL LoadedServerDll) + + +/* PROTOTYPES ****************************************************************/ + +NTSTATUS +NTAPI +CsrServerInitialization(IN ULONG ArgumentCount, + IN PCHAR Arguments[]); + +PCSR_THREAD +NTAPI +CsrAddStaticServerThread(IN HANDLE hThread, + IN PCLIENT_ID ClientId, + IN ULONG ThreadFlags); + +NTSTATUS +NTAPI +CsrCallServerFromServer(IN PCSR_API_MESSAGE ReceiveMsg, + IN OUT PCSR_API_MESSAGE ReplyMsg); + +PCSR_THREAD +NTAPI +CsrConnectToUser(VOID); + +NTSTATUS +NTAPI +CsrCreateProcess(IN HANDLE hProcess, + IN HANDLE hThread, + IN PCLIENT_ID ClientId, + IN PCSR_NT_SESSION NtSession, + IN ULONG Flags, + IN PCLIENT_ID DebugCid); + +NTSTATUS +NTAPI +CsrCreateRemoteThread(IN HANDLE hThread, + IN PCLIENT_ID ClientId); + +NTSTATUS +NTAPI +CsrCreateThread(IN PCSR_PROCESS CsrProcess, + IN HANDLE hThread, + IN PCLIENT_ID ClientId, + IN BOOLEAN HaveClient); + +BOOLEAN +NTAPI +CsrCreateWait(IN PLIST_ENTRY WaitList, + IN CSR_WAIT_FUNCTION WaitFunction, + IN PCSR_THREAD CsrWaitThread, + IN OUT PCSR_API_MESSAGE WaitApiMessage, + IN PVOID WaitContext, + IN PLIST_ENTRY UserWaitList OPTIONAL); + +NTSTATUS +NTAPI +CsrDebugProcess(IN PCSR_PROCESS CsrProcess); + +NTSTATUS +NTAPI +CsrDebugProcessStop(IN PCSR_PROCESS CsrProcess); + +VOID +NTAPI +CsrDereferenceProcess(IN PCSR_PROCESS CsrProcess); + +VOID +NTAPI +CsrDereferenceThread(IN PCSR_THREAD CsrThread); + +VOID +NTAPI +CsrDereferenceWait(IN PLIST_ENTRY WaitList); + +NTSTATUS +NTAPI +CsrDestroyProcess(IN PCLIENT_ID Cid, + IN NTSTATUS ExitStatus); + +NTSTATUS +NTAPI +CsrDestroyThread(IN PCLIENT_ID Cid); + +NTSTATUS +NTAPI +CsrExecServerThread(IN PVOID ThreadHandler, + IN ULONG Flags); + +NTSTATUS +NTAPI +CsrGetProcessLuid(IN HANDLE hProcess OPTIONAL, + OUT PLUID Luid); + +BOOLEAN +NTAPI +CsrImpersonateClient(IN PCSR_THREAD CsrThread); + +NTSTATUS +NTAPI +CsrLockProcessByClientId(IN HANDLE Pid, + OUT PCSR_PROCESS *CsrProcess OPTIONAL); + +NTSTATUS +NTAPI +CsrLockThreadByClientId(IN HANDLE Tid, + OUT PCSR_THREAD *CsrThread); + +VOID +NTAPI +CsrMoveSatisfiedWait(IN PLIST_ENTRY NewEntry, + IN PLIST_ENTRY WaitList); + +BOOLEAN +NTAPI +CsrNotifyWait(IN PLIST_ENTRY WaitList, + IN ULONG WaitType, + IN PVOID WaitArgument1, + IN PVOID WaitArgument2); + +VOID +NTAPI +CsrPopulateDosDevices(VOID); + +HANDLE +NTAPI +CsrQueryApiPort(VOID); + +VOID +NTAPI +CsrReferenceThread(IN PCSR_THREAD CsrThread); + +BOOLEAN +NTAPI +CsrRevertToSelf(VOID); + +VOID +NTAPI +CsrSetBackgroundPriority(IN PCSR_PROCESS CsrProcess); + +VOID +NTAPI +CsrSetCallingSpooler(ULONG Reserved); + +VOID +NTAPI +CsrSetForegroundPriority(IN PCSR_PROCESS CsrProcess); + +NTSTATUS +NTAPI +CsrShutdownProcesses(IN PLUID CallerLuid, + IN ULONG Flags); + +EXCEPTION_DISPOSITION +NTAPI +CsrUnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo); + +NTSTATUS +NTAPI +CsrUnlockProcess(IN PCSR_PROCESS CsrProcess); + +NTSTATUS +NTAPI +CsrUnlockThread(IN PCSR_THREAD CsrThread); + +BOOLEAN +NTAPI +CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, + IN PVOID *Buffer, + IN ULONG ElementCount, + IN ULONG ElementSize); + +BOOLEAN +NTAPI +CsrValidateMessageString(IN PCSR_API_MESSAGE ApiMessage, + IN LPWSTR *MessageString); + +/* +#ifdef _MSC_VER +#pragma warning(pop) +#endif +*/ + +#endif // _CSRSRV_H + +/* EOF */ Index: include/reactos/subsys/csr/csrsrv.h =================================================================== --- include/reactos/subsys/csr/csrsrv.h (rvision 58607) +++ include/reactos/subsys/csr/csrsrv.h (copie de travail) Modification de proprits sur include/reactos/subsys/csr/csrsrv.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: include/reactos/subsys/csr/server.h =================================================================== --- include/reactos/subsys/csr/server.h (rvision 58607) +++ include/reactos/subsys/csr/server.h (copie de travail) @@ -1,277 +0,0 @@ -/* - * PROJECT: ReactOS Native Headers - * FILE: include/subsys/csr/server.h - * PURPOSE: Public Definitions for CSR Servers - * PROGRAMMER: Alex Ionescu (alex@relsoft.net) - */ -#ifndef _CSRSERVER_H -#define _CSRSERVER_H - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning (disable:4201) -#endif - -/* DEPENDENCIES **************************************************************/ - -/* TYPES **********************************************************************/ -typedef struct _CSR_NT_SESSION -{ - ULONG ReferenceCount; - LIST_ENTRY SessionLink; - ULONG SessionId; -} CSR_NT_SESSION, *PCSR_NT_SESSION; - -typedef struct _CSR_PROCESS -{ - CLIENT_ID ClientId; - LIST_ENTRY ListLink; - LIST_ENTRY ThreadList; - struct _CSR_PROCESS *Parent; - PCSR_NT_SESSION NtSession; - ULONG ExpectedVersion; - HANDLE ClientPort; - ULONG_PTR ClientViewBase; - ULONG_PTR ClientViewBounds; - HANDLE ProcessHandle; - ULONG SequenceNumber; - ULONG Flags; - ULONG DebugFlags; - CLIENT_ID DebugCid; - ULONG ReferenceCount; - ULONG ProcessGroupId; - ULONG ProcessGroupSequence; - ULONG fVDM; - ULONG ThreadCount; - ULONG PriorityClass; - ULONG Reserved; - ULONG ShutdownLevel; - ULONG ShutdownFlags; - PVOID ServerData[ANYSIZE_ARRAY]; -} CSR_PROCESS, *PCSR_PROCESS; - -typedef struct _CSR_THREAD -{ - LARGE_INTEGER CreateTime; - LIST_ENTRY Link; - LIST_ENTRY HashLinks; - CLIENT_ID ClientId; - PCSR_PROCESS Process; - struct _CSR_WAIT_BLOCK *WaitBlock; - HANDLE ThreadHandle; - ULONG Flags; - ULONG ReferenceCount; - ULONG ImpersonationCount; -} CSR_THREAD, *PCSR_THREAD; - -/* ENUMERATIONS **************************************************************/ -#define CSR_SRV_SERVER 0 - -typedef enum _CSR_PROCESS_FLAGS -{ - CsrProcessTerminating = 0x1, - CsrProcessSkipShutdown = 0x2, - CsrProcessNormalPriority = 0x10, - CsrProcessIdlePriority = 0x20, - CsrProcessHighPriority = 0x40, - CsrProcessRealtimePriority = 0x80, - CsrProcessCreateNewGroup = 0x100, - CsrProcessTerminated = 0x200, - CsrProcessLastThreadTerminated = 0x400, - CsrProcessIsConsoleApp = 0x800 -} CSR_PROCESS_FLAGS, *PCSR_PROCESS_FLAGS; - -#define CsrProcessPriorityFlags (CsrProcessNormalPriority | \ - CsrProcessIdlePriority | \ - CsrProcessHighPriority | \ - CsrProcessRealtimePriority) - -typedef enum _CSR_THREAD_FLAGS -{ - CsrThreadAltertable = 0x1, - CsrThreadInTermination = 0x2, - CsrThreadTerminated = 0x4, - CsrThreadIsServerThread = 0x10 -} CSR_THREAD_FLAGS, *PCSR_THREAD_FLAGS; - -typedef enum _SHUTDOWN_RESULT -{ - CsrShutdownCsrProcess = 1, - CsrShutdownNonCsrProcess, - CsrShutdownCancelled -} SHUTDOWN_RESULT, *PSHUTDOWN_RESULT; - -typedef enum _CSR_SHUTDOWN_FLAGS -{ - CsrShutdownSystem = 4, - CsrShutdownOther = 8 -} CSR_SHUTDOWN_FLAGS, *PCSR_SHUTDOWN_FLAGS; - -typedef enum _CSR_DEBUG_FLAGS -{ - CsrDebugOnlyThisProcess = 1, - CsrDebugProcessChildren = 2 -} CSR_PROCESS_DEBUG_FLAGS, *PCSR_PROCESS_DEBUG_FLAGS; - -/* FUNCTION TYPES ************************************************************/ -typedef -NTSTATUS -(NTAPI *PCSR_CONNECT_CALLBACK)( - IN PCSR_PROCESS CsrProcess, - IN OUT PVOID ConnectionInfo, - IN OUT PULONG ConnectionInfoLength -); - -typedef -VOID -(NTAPI *PCSR_DISCONNECT_CALLBACK)(IN PCSR_PROCESS CsrProcess); - -typedef -NTSTATUS -(NTAPI *PCSR_NEWPROCESS_CALLBACK)( - IN PCSR_PROCESS Parent, - IN PCSR_PROCESS CsrProcess -); - -typedef -VOID -(NTAPI *PCSR_HARDERROR_CALLBACK)( - IN PCSR_THREAD CsrThread, - IN PHARDERROR_MSG HardErrorMessage -); - -typedef -ULONG -(NTAPI *PCSR_SHUTDOWNPROCESS_CALLBACK)( - IN PCSR_PROCESS CsrProcess, - IN ULONG Flags, - IN BOOLEAN FirstPhase -); - - -/* FIXME: Put into public NDK Header */ -typedef ULONG CSR_API_NUMBER; - -#define CSR_MAKE_OPCODE(s,m) ((s) << 16) | (m) -#define CSR_API_ID_FROM_OPCODE(n) ((ULONG)((USHORT)(n))) -#define CSR_SERVER_ID_FROM_OPCODE(n) (ULONG)((n) >> 16) - -typedef struct _CSR_CONNECTION_INFO -{ - ULONG Unknown[2]; - HANDLE ObjectDirectory; - PVOID SharedSectionBase; - PVOID SharedSectionHeap; - PVOID SharedSectionData; - ULONG DebugFlags; - ULONG Unknown2[3]; - HANDLE ProcessId; -} CSR_CONNECTION_INFO, *PCSR_CONNECTION_INFO; - -typedef struct _CSR_CLIENT_CONNECT -{ - ULONG ServerId; - PVOID ConnectionInfo; - ULONG ConnectionInfoSize; -} CSR_CLIENT_CONNECT, *PCSR_CLIENT_CONNECT; - -typedef struct _CSR_API_MESSAGE -{ - PORT_MESSAGE Header; - union - { - CSR_CONNECTION_INFO ConnectionInfo; - struct - { - PVOID CsrCaptureData; - CSR_API_NUMBER Opcode; - ULONG Status; - ULONG Reserved; - union - { - CSR_CLIENT_CONNECT CsrClientConnect; - }; - }; - }; -} CSR_API_MESSAGE, *PCSR_API_MESSAGE; - -typedef struct _CSR_CAPTURE_BUFFER -{ - ULONG Size; - struct _CSR_CAPTURE_BUFFER *PreviousCaptureBuffer; - ULONG PointerCount; - ULONG_PTR BufferEnd; -} CSR_CAPTURE_BUFFER, *PCSR_CAPTURE_BUFFER; - -/* Private data resumes here */ -typedef -NTSTATUS -(NTAPI *PCSR_API_ROUTINE)( - IN OUT PCSR_API_MESSAGE ApiMessage, - IN OUT PULONG Reply -); - -typedef struct _CSR_SERVER_DLL -{ - ULONG Length; - HANDLE Event; - ANSI_STRING Name; - HANDLE ServerHandle; - ULONG ServerId; - ULONG Unknown; - ULONG ApiBase; - ULONG HighestApiSupported; - PCSR_API_ROUTINE *DispatchTable; - PBOOLEAN ValidTable; - PCHAR *NameTable; - ULONG SizeOfProcessData; - PCSR_CONNECT_CALLBACK ConnectCallback; - PCSR_DISCONNECT_CALLBACK DisconnectCallback; - PCSR_HARDERROR_CALLBACK HardErrorCallback; - PVOID SharedSection; - PCSR_NEWPROCESS_CALLBACK NewProcessCallback; - PCSR_SHUTDOWNPROCESS_CALLBACK ShutdownProcessCallback; - ULONG Unknown2[3]; -} CSR_SERVER_DLL, *PCSR_SERVER_DLL; - -typedef -NTSTATUS -(NTAPI *PCSR_SERVER_DLL_INIT_CALLBACK)(IN PCSR_SERVER_DLL ServerDll); - -typedef -BOOLEAN -(*CSR_WAIT_FUNCTION)( - IN PLIST_ENTRY WaitList, - IN PCSR_THREAD WaitThread, - IN PCSR_API_MESSAGE WaitApiMessage, - IN PVOID WaitContext, - IN PVOID WaitArgument1, - IN PVOID WaitArgument2, - IN ULONG WaitFlags -); - -typedef struct _CSR_WAIT_BLOCK -{ - ULONG Size; - LIST_ENTRY WaitList; - LIST_ENTRY UserWaitList; - PVOID WaitContext; - PCSR_THREAD WaitThread; - CSR_WAIT_FUNCTION WaitFunction; - CSR_API_MESSAGE WaitApiMessage; -} CSR_WAIT_BLOCK, *PCSR_WAIT_BLOCK; - -/* PROTOTYPES ****************************************************************/ - -NTSTATUS -NTAPI -CsrServerInitialization( - ULONG ArgumentCount, - PCHAR Arguments[] -); - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -#endif Index: include/reactos/subsys/sm/helper.h =================================================================== --- include/reactos/subsys/sm/helper.h (rvision 58607) +++ include/reactos/subsys/sm/helper.h (copie de travail) @@ -7,32 +7,31 @@ /* smlib/connect.c */ NTSTATUS WINAPI -SmConnectApiPort (IN PUNICODE_STRING pSbApiPortName OPTIONAL, - IN HANDLE hSbApiPort OPTIONAL, - IN WORD wSubsystem OPTIONAL, /* pe.h */ - IN OUT PHANDLE phSmApiPort); +SmConnectApiPort(IN PUNICODE_STRING pSbApiPortName OPTIONAL, + IN HANDLE hSbApiPort OPTIONAL, + IN WORD wSubsystem OPTIONAL, /* pe.h */ + IN OUT PHANDLE phSmApiPort); /* smlib/compses.c */ NTSTATUS WINAPI -SmCompleteSession (IN HANDLE hSmApiPort, - IN HANDLE hSbApiPort, - IN HANDLE hApiPort); +SmCompleteSession(IN HANDLE hSmApiPort, + IN HANDLE hSbApiPort, + IN HANDLE hApiPort); /* smlib/execpgm.c */ NTSTATUS WINAPI -SmExecuteProgram (IN HANDLE hSmApiPort, - IN PUNICODE_STRING Pgm - ); +SmExecuteProgram(IN HANDLE hSmApiPort, + IN PUNICODE_STRING Pgm); /* smdll/query.c */ NTSTATUS WINAPI -SmQueryInformation (IN HANDLE SmApiPort, - IN SM_INFORMATION_CLASS SmInformationClass, - IN OUT PVOID Data, - IN ULONG DataLength, - IN OUT PULONG ReturnedDataLength OPTIONAL); +SmQueryInformation(IN HANDLE SmApiPort, + IN SM_INFORMATION_CLASS SmInformationClass, + IN OUT PVOID Data, + IN ULONG DataLength, + IN OUT PULONG ReturnedDataLength OPTIONAL); /* smlib/lookupss.c */ NTSTATUS WINAPI -SmLookupSubsystem (IN PWSTR Name, - IN OUT PWSTR Data, - IN OUT PULONG DataLength, - IN OUT PULONG DataType, - IN PVOID Environment OPTIONAL); +SmLookupSubsystem(IN PWSTR Name, + IN OUT PWSTR Data, + IN OUT PULONG DataLength, + IN OUT PULONG DataType, + IN PVOID Environment OPTIONAL); #endif /* ndef INCLUDE_SM_HELPER_H */ Index: include/reactos/subsys/sm/ns.h =================================================================== --- include/reactos/subsys/sm/ns.h (rvision 58607) +++ include/reactos/subsys/sm/ns.h (copie de travail) @@ -1,7 +1,7 @@ #if !defined(INCLUDE_SM_NS_H) #define INCLUDE_SM_NS_H -#define SM_REGISTRY_ROOT_NAME L"\\Session Manager" +#define SM_REGISTRY_ROOT_NAME L"\\Session Manager" #define SM_REGISTRY_SUBSYSTEMS_NAME L"SubSystems" #define SM_API_PORT_NAME L"\\SmApiPort" Index: include/reactos/subsys/sm/smmsg.h =================================================================== --- include/reactos/subsys/sm/smmsg.h (rvision 58607) +++ include/reactos/subsys/sm/smmsg.h (copie de travail) @@ -18,17 +18,21 @@ // in the checked build of SMSS, which is probably a close approximation. We add // "p" to use the similar nomenclature seen/leaked out in the Base CSRSS APIs. // +// The enumeration finishes with an enumeratee holding the maximum API number. +// Its name is based on BasepMaxApiNumber, UserpMaxApiNumber... // +// typedef enum _SMSRV_API_NUMBER { - SmCreateForeignSessionApi, - SmSessionCompleteApi, - SmTerminateForeignSessionApi, - SmExecPgmApi, - SmLoadDeferedSubsystemApi, - SmStartCsrApi, - SmStopCsrApi, - SmMaxApiNumber // Based on BasepMaxApiNumber, UserpMaxApiNumber... + SmpCreateForeignSessionApi, + SmpSessionCompleteApi, + SmpTerminateForeignSessionApi, + SmpExecPgmApi, + SmpLoadDeferedSubsystemApi, + SmpStartCsrApi, + SmpStopCsrApi, + + SmpMaxApiNumber } SMSRV_API_NUMBER; // @@ -108,7 +112,7 @@ #endif // -// There are the APIs that the SMSS Serve can send to a client (such as CSRSS) +// There are the APIs that the SMSS Server can send to a client (such as CSRSS). // // These are called "SB" APIs. // @@ -117,14 +121,18 @@ // We add "p" to use the similar nomenclature seen/leaked out in the Base CSRSS // APIs. // +// The enumeration finishes with an enumeratee holding the maximum API number. +// Its name is based on BasepMaxApiNumber, UserpMaxApiNumber... // +// typedef enum _SB_API_NUMBER { SbpCreateSession, SbpTerminateSession, SbpForeignSessionComplete, SbpCreateProcess, - SbpMaxApiNumber // Based on BasepMaxApiNumber, UserpMaxApiNumber... + + SbpMaxApiNumber } SB_API_NUMBER; // Index: include/reactos/subsys/win/base.h =================================================================== --- include/reactos/subsys/win/base.h (rvision 58607) +++ include/reactos/subsys/win/base.h (copie de travail) @@ -1,16 +1,88 @@ -#if !defined(__INCLUDE_WIN_BASE_H) -#define __INCLUDE_WIN_BASE_H +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: include/reactos/subsys/win/base.h + * PURPOSE: Public definitions for Base API Clients + * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr) + */ -#include +#ifndef _BASE_H +#define _BASE_H -/* w32 base server */ +#pragma once -#define WIN_SRV_BASE 1 - typedef VOID (CALLBACK * BASE_PROCESS_CREATE_NOTIFY_ROUTINE)(PVOID); -NTSTATUS WINAPI BaseSetProcessCreateNotify (BASE_PROCESS_CREATE_NOTIFY_ROUTINE); -NTSTATUS WINAPI ServerDllInitialization (ULONG,LPWSTR*); +NTSTATUS WINAPI BaseSetProcessCreateNotify(BASE_PROCESS_CREATE_NOTIFY_ROUTINE); -#endif /* ndef __INCLUDE_WIN_BASE_H */ +typedef struct _NLS_USER_INFO +{ + WCHAR iCountry[80]; + WCHAR sCountry[80]; + WCHAR sList[80]; + WCHAR iMeasure[80]; + WCHAR iPaperSize[80]; + WCHAR sDecimal[80]; + WCHAR sThousand[80]; + WCHAR sGrouping[80]; + WCHAR iDigits[80]; + WCHAR iLZero[80]; + WCHAR iNegNumber[80]; + WCHAR sNativeDigits[80]; + WCHAR iDigitSubstitution[80]; + WCHAR sCurrency[80]; + WCHAR sMonDecSep[80]; + WCHAR sMonThouSep[80]; + WCHAR sMonGrouping[80]; + WCHAR iCurrDigits[80]; + WCHAR iCurrency[80]; + WCHAR iNegCurr[80]; + WCHAR sPosSign[80]; + WCHAR sNegSign[80]; + WCHAR sTimeFormat[80]; + WCHAR s1159[80]; + WCHAR s2359[80]; + WCHAR sShortDate[80]; + WCHAR sYearMonth[80]; + WCHAR sLongDate[80]; + WCHAR iCalType[80]; + WCHAR iFirstDay[80]; + WCHAR iFirstWeek[80]; + WCHAR sLocale[80]; + WCHAR sLocaleName[85]; + LCID UserLocaleId; + LUID InteractiveUserLuid; + CHAR InteractiveUserSid[68]; // SECURITY_MAX_SID_SIZE to make ROS happy + ULONG ulCacheUpdateCount; +} NLS_USER_INFO, *PNLS_USER_INFO; + +typedef struct _BASE_STATIC_SERVER_DATA +{ + UNICODE_STRING WindowsDirectory; + UNICODE_STRING WindowsSystemDirectory; + UNICODE_STRING NamedObjectDirectory; + USHORT WindowsMajorVersion; + USHORT WindowsMinorVersion; + USHORT BuildNumber; + USHORT CSDNumber; + USHORT RCNumber; + WCHAR CSDVersion[128]; + SYSTEM_BASIC_INFORMATION SysInfo; + SYSTEM_TIMEOFDAY_INFORMATION TimeOfDay; + PVOID IniFileMapping; + NLS_USER_INFO NlsUserInfo; + BOOLEAN DefaultSeparateVDM; + BOOLEAN IsWowTaskReady; + UNICODE_STRING WindowsSys32x86Directory; + BOOLEAN fTermsrvAppInstallMode; + TIME_ZONE_INFORMATION tziTermsrvClientTimeZone; + KSYSTEM_TIME ktTermsrvClientBias; + ULONG TermsrvClientTimeZoneId; + BOOLEAN LUIDDeviceMapsEnabled; + ULONG TermsrvClientTimeZoneChangeNum; +} BASE_STATIC_SERVER_DATA, *PBASE_STATIC_SERVER_DATA; + +#endif // _BASE_H + +/* EOF */ Index: include/reactos/subsys/win/basemsg.h =================================================================== --- include/reactos/subsys/win/basemsg.h (rvision 0) +++ include/reactos/subsys/win/basemsg.h (copie de travail) @@ -0,0 +1,210 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: include/reactos/subsys/win/basemsg.h + * PURPOSE: Public definitions for communication + * between Base API Clients and Servers + * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr) + */ + +#ifndef _BASEMSG_H +#define _BASEMSG_H + +#pragma once + +#define BASESRV_SERVERDLL_INDEX 1 +#define BASESRV_FIRST_API_NUMBER 0 + +// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3 +typedef enum _BASESRV_API_NUMBER +{ + BasepCreateProcess = BASESRV_FIRST_API_NUMBER, + BasepCreateThread, + BasepGetTempFile, + BasepExitProcess, + // BasepDebugProcess, + // BasepCheckVDM, + // BasepUpdateVDMEntry, + // BasepGetNextVDMCommand, + // BasepExitVDM, + // BasepIsFirstVDM, + // BasepGetVDMExitCode, + // BasepSetReenterCount, + BasepSetProcessShutdownParam, + BasepGetProcessShutdownParam, + // BasepNlsSetUserInfo, + // BasepNlsSetMultipleUserInfo, + // BasepNlsCreateSection, + // BasepSetVDMCurDirs, + // BasepGetVDMCurDirs, + // BasepBatNotification, + // BasepRegisterWowExec, + BasepSoundSentryNotification, + // BasepRefreshIniFileMapping, + BasepDefineDosDevice, + // BasepSetTermsrvAppInstallMode, + // BasepNlsUpdateCacheCount, + // BasepSetTermsrvClientTimeZone, + // BasepSxsCreateActivationContext, + // BasepRegisterThread, + // BasepNlsGetUserInfo, + + BasepMaxApiNumber +} BASESRV_API_NUMBER, *PBASESRV_API_NUMBER; + +typedef struct _BASE_SXS_CREATEPROCESS_MSG +{ + ULONG Flags; + ULONG ProcessParameterFlags; + HANDLE FileHandle; + UNICODE_STRING SxsWin32ExePath; + UNICODE_STRING SxsNtExePath; + SIZE_T OverrideManifestOffset; + ULONG OverrideManifestSize; + SIZE_T OverridePolicyOffset; + ULONG OverridePolicySize; + PVOID PEManifestAddress; + ULONG PEManifestSize; + UNICODE_STRING CultureFallbacks; + ULONG Unknown[7]; + UNICODE_STRING AssemblyName; +} BASE_SXS_CREATEPROCESS_MSG, *PBASE_SXS_CREATEPROCESS_MSG; + +typedef struct +{ + // + // NT-type structure (BASE_CREATEPROCESS_MSG) + // + HANDLE ProcessHandle; + HANDLE ThreadHandle; + CLIENT_ID ClientId; + ULONG CreationFlags; + ULONG VdmBinaryType; + ULONG VdmTask; + HANDLE hVDM; + BASE_SXS_CREATEPROCESS_MSG Sxs; + PVOID PebAddressNative; + ULONG PebAddressWow64; + USHORT ProcessorArchitecture; +} BASE_CREATE_PROCESS, *PBASE_CREATE_PROCESS; + +typedef struct +{ + CLIENT_ID ClientId; + HANDLE ThreadHandle; +} BASE_CREATE_THREAD, *PBASE_CREATE_THREAD; + +typedef struct +{ + UINT uExitCode; +} BASE_EXIT_PROCESS, *PBASE_EXIT_PROCESS; + +typedef struct +{ + UINT UniqueID; +} BASE_GET_TEMP_FILE, *PBASE_GET_TEMP_FILE; + +typedef struct +{ + ULONG iTask; + HANDLE ConsoleHandle; + ULONG BinaryType; + HANDLE WaitObjectForParent; + HANDLE StdIn; + HANDLE StdOut; + HANDLE StdErr; + ULONG CodePage; + ULONG dwCreationFlags; + PCHAR CmdLine; + PCHAR appName; + PCHAR PifFile; + PCHAR CurDirectory; + PCHAR Env; + ULONG EnvLen; + PVOID StartupInfo; + PCHAR Desktop; + ULONG DesktopLen; + PCHAR Title; + ULONG TitleLen; + PCHAR Reserved; + ULONG ReservedLen; + USHORT CmdLen; + USHORT AppLen; + USHORT PifLen; + USHORT CurDirectoryLen; + USHORT CurDrive; + USHORT VDMState; +} BASE_CHECK_VDM, *PBASE_CHECK_VDM; + +typedef struct +{ + ULONG iTask; + ULONG BinaryType; + HANDLE ConsoleHandle; + HANDLE VDMProcessHandle; + HANDLE WaitObjectForParent; + USHORT EntryIndex; + USHORT VDMCreationState; +} BASE_UPDATE_VDM_ENTRY, *PBASE_UPDATE_VDM_ENTRY; + +typedef struct +{ + HANDLE ConsoleHandle; + HANDLE hParent; + ULONG ExitCode; +} BASE_GET_VDM_EXIT_CODE, *PBASE_GET_VDM_EXIT_CODE; + +typedef struct +{ + DWORD Level; + DWORD Flags; +} BASE_SET_PROCESS_SHUTDOWN_PARAMS, *PBASE_SET_PROCESS_SHUTDOWN_PARAMS; + +typedef struct +{ + DWORD Level; + DWORD Flags; +} BASE_GET_PROCESS_SHUTDOWN_PARAMS, *PBASE_GET_PROCESS_SHUTDOWN_PARAMS; + +typedef struct +{ + ULONG VideoMode; +} BASE_SOUND_SENTRY, *PBASE_SOUND_SENTRY; + +typedef struct +{ + UNICODE_STRING DeviceName; + UNICODE_STRING TargetName; + DWORD dwFlags; +} BASE_DEFINE_DOS_DEVICE, *PBASE_DEFINE_DOS_DEVICE; + +typedef struct _BASE_API_MESSAGE +{ + PORT_MESSAGE Header; + + PCSR_CAPTURE_BUFFER CsrCaptureData; + CSR_API_NUMBER ApiNumber; + NTSTATUS Status; // ReturnValue; + ULONG Reserved; + union + { + BASE_CREATE_PROCESS CreateProcessRequest; + BASE_CREATE_THREAD CreateThreadRequest; + BASE_EXIT_PROCESS ExitProcessRequest; + BASE_GET_TEMP_FILE GetTempFile; + BASE_CHECK_VDM CheckVdm; + BASE_UPDATE_VDM_ENTRY UpdateVdmEntry; + BASE_GET_VDM_EXIT_CODE GetVdmExitCode; + BASE_SET_PROCESS_SHUTDOWN_PARAMS SetShutdownParametersRequest; + BASE_GET_PROCESS_SHUTDOWN_PARAMS GetShutdownParametersRequest; + BASE_SOUND_SENTRY SoundSentryRequest; + BASE_DEFINE_DOS_DEVICE DefineDosDeviceRequest; + } Data; +} BASE_API_MESSAGE, *PBASE_API_MESSAGE; + +// Check that a BASE_API_MESSAGE can hold in a CSR_API_MESSAGE. +CHECK_API_MSG_SIZE(BASE_API_MESSAGE); + +#endif // _BASEMSG_H + +/* EOF */ Index: include/reactos/subsys/win/basemsg.h =================================================================== --- include/reactos/subsys/win/basemsg.h (rvision 58607) +++ include/reactos/subsys/win/basemsg.h (copie de travail) Modification de proprits sur include/reactos/subsys/win/basemsg.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: include/reactos/subsys/win/conmsg.h =================================================================== --- include/reactos/subsys/win/conmsg.h (rvision 0) +++ include/reactos/subsys/win/conmsg.h (copie de travail) @@ -0,0 +1,639 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: include/reactos/subsys/win/conmsg.h + * PURPOSE: Public definitions for communication + * between Console API Clients and Servers + * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr) + */ + +#ifndef _CONMSG_H +#define _CONMSG_H + +#pragma once + +#define CONSRV_SERVERDLL_INDEX 2 +#define CONSRV_FIRST_API_NUMBER 512 + +// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3 +// plus a little bit of Windows 7. +typedef enum _CONSRV_API_NUMBER +{ + ConsolepOpenConsole = CONSRV_FIRST_API_NUMBER, + ConsolepGetConsoleInput, + ConsolepWriteConsoleInput, + ConsolepReadConsoleOutput, + ConsolepWriteConsoleOutput, + ConsolepReadConsoleOutputString, + ConsolepWriteConsoleOutputString, + ConsolepFillConsoleOutput, + ConsolepGetMode, + // ConsolepGetNumberOfFonts, + ConsolepGetNumberOfInputEvents, + ConsolepGetScreenBufferInfo, + ConsolepGetCursorInfo, + // ConsolepGetMouseInfo, + // ConsolepGetFontInfo, + // ConsolepGetFontSize, + // ConsolepGetCurrentFont, + ConsolepSetMode, + ConsolepSetActiveScreenBuffer, + ConsolepFlushInputBuffer, + // ConsolepGetLargestWindowSize, + ConsolepSetScreenBufferSize, + ConsolepSetCursorPosition, + ConsolepSetCursorInfo, + // ConsolepSetWindowInfo, + ConsolepScrollScreenBuffer, + ConsolepSetTextAttribute, + // ConsolepSetFont, + ConsolepSetIcon, + ConsolepReadConsole, + ConsolepWriteConsole, + ConsolepDuplicateHandle, + // ConsolepGetHandleInformation, + // ConsolepSetHandleInformation, + ConsolepCloseHandle, + ConsolepVerifyIoHandle, + ConsolepAlloc, + ConsolepFree, + ConsolepGetTitle, + ConsolepSetTitle, + ConsolepCreateScreenBuffer, + // ConsolepInvalidateBitMapRect, + // ConsolepVDMOperation, + // ConsolepSetCursor, + // ConsolepShowCursor, + // ConsolepMenuControl, + // ConsolepSetPalette, + // ConsolepSetDisplayMode, + // ConsolepRegisterVDM, + ConsolepGetHardwareState, + ConsolepSetHardwareState, + // ConsolepGetDisplayMode, + ConsolepAddAlias, + ConsolepGetAlias, + ConsolepGetAliasesLength, + ConsolepGetAliasExesLength, + ConsolepGetAliases, + ConsolepGetAliasExes, + ConsolepExpungeCommandHistory, + ConsolepSetNumberOfCommands, + ConsolepGetCommandHistoryLength, + ConsolepGetCommandHistory, + // ConsolepSetCommandHistoryMode, + ConsolepGetCP, + ConsolepSetCP, + // ConsolepSetKeyShortcuts, + // ConsolepSetMenuClose, + // ConsolepNotifyLastClose, + ConsolepGenerateCtrlEvent, + // ConsolepGetKeyboardLayoutName, + ConsolepGetConsoleWindow, + // ConsolepCharType, + // ConsolepSetLocalEUDC, + // ConsolepSetCursorMode, + // ConsolepGetCursorMode, + // ConsolepRegisterOS2, + // ConsolepSetOS2OemFormat, + // ConsolepGetNlsMode, + // ConsolepSetNlsMode, + // ConsolepRegisterConsoleIME, + // ConsolepUnregisterConsoleIME, + // ConsolepGetLangId, + ConsolepAttach, + ConsolepGetSelectionInfo, + ConsolepGetProcessList, + ConsolepGetHistory, + ConsolepSetHistory, + + ConsolepMaxApiNumber +} CONSRV_API_NUMBER, *PCONSRV_API_NUMBER; + + +typedef struct _CONSOLE_START_INFO +{ + DWORD dwStartupFlags; + DWORD FillAttribute; + COORD ScreenBufferSize; + WORD ShowWindow; + POINT ConsoleWindowOrigin; + SIZE ConsoleWindowSize; + // UNICODE_STRING ConsoleTitle; + WCHAR ConsoleTitle[MAX_PATH + 1]; // Console title or full path to the startup shortcut + WCHAR AppPath[MAX_PATH + 1]; // Full path of the launched app +} CONSOLE_START_INFO, *PCONSOLE_START_INFO; + +typedef struct _CONSOLE_CONNECTION_INFO +{ + BOOL ConsoleNeeded; // Used for GUI apps only. + + /* Adapted from CONSOLE_ALLOCCONSOLE */ + CONSOLE_START_INFO ConsoleStartInfo; + + HANDLE Console; // ConsoleHandle // In fact, it is a PCSRSS_CONSOLE <-- correct that !! + HANDLE InputHandle; + HANDLE OutputHandle; + HANDLE ErrorHandle; + HANDLE InputWaitHandle; + LPTHREAD_START_ROUTINE CtrlDispatcher; + LPTHREAD_START_ROUTINE PropDispatcher; +} CONSOLE_CONNECTION_INFO, *PCONSOLE_CONNECTION_INFO; + + +typedef struct +{ + USHORT nMaxIds; + ULONG nProcessIdsTotal; + PDWORD pProcessIds; +} CONSOLE_GETPROCESSLIST, *PCONSOLE_GETPROCESSLIST; + +typedef struct +{ + HANDLE OutputHandle; + + BOOL Unicode; + ULONG NrCharactersToWrite; + ULONG NrCharactersWritten; + + ULONG BufferSize; + PVOID Buffer; +} CONSOLE_WRITECONSOLE, *PCONSOLE_WRITECONSOLE; + +typedef struct +{ + HANDLE InputHandle; + + BOOL Unicode; + WORD NrCharactersToRead; + WORD NrCharactersRead; + + UNICODE_STRING ExeName; + DWORD CtrlWakeupMask; + DWORD ControlKeyState; + + ULONG BufferSize; + PVOID Buffer; +} CONSOLE_READCONSOLE, *PCONSOLE_READCONSOLE; + +typedef struct +{ + PCONSOLE_START_INFO ConsoleStartInfo; + + HANDLE Console; // ConsoleHandle // In fact, it is a PCSRSS_CONSOLE <-- correct that !! + HANDLE InputHandle; + HANDLE OutputHandle; + HANDLE ErrorHandle; + HANDLE InputWaitHandle; + LPTHREAD_START_ROUTINE CtrlDispatcher; + LPTHREAD_START_ROUTINE PropDispatcher; +} CONSOLE_ALLOCCONSOLE, *PCONSOLE_ALLOCCONSOLE; + +typedef struct +{ + DWORD ProcessId; // If ProcessId == ATTACH_PARENT_PROCESS == -1, then attach the current process to its parent process console. + HANDLE Console; // ConsoleHandle // In fact, it is a PCSRSS_CONSOLE <-- correct that !! + HANDLE InputHandle; + HANDLE OutputHandle; + HANDLE ErrorHandle; + HANDLE InputWaitHandle; + LPTHREAD_START_ROUTINE CtrlDispatcher; + LPTHREAD_START_ROUTINE PropDispatcher; +} CONSOLE_ATTACHCONSOLE, *PCONSOLE_ATTACHCONSOLE; + +typedef struct +{ + ULONG Dummy; +} CONSOLE_FREECONSOLE, *PCONSOLE_FREECONSOLE; + +typedef struct +{ + HANDLE OutputHandle; + CONSOLE_SCREEN_BUFFER_INFO Info; +} CONSOLE_GETSCREENBUFFERINFO, *PCONSOLE_GETSCREENBUFFERINFO; + +typedef struct +{ + HANDLE OutputHandle; + COORD Position; +} CONSOLE_SETCURSORPOSITION, *PCONSOLE_SETCURSORPOSITION; + +typedef struct +{ + HANDLE OutputHandle; + CONSOLE_CURSOR_INFO Info; +} CONSOLE_GETSETCURSORINFO, *PCONSOLE_GETSETCURSORINFO; + +typedef struct +{ + HANDLE OutputHandle; + WORD Attrib; +} CONSOLE_SETTEXTATTRIB, *PCONSOLE_SETTEXTATTRIB; + +typedef struct +{ + HANDLE ConsoleHandle; /* A valid input or output console handle */ + DWORD ConsoleMode; +} CONSOLE_GETSETCONSOLEMODE, *PCONSOLE_GETSETCONSOLEMODE; + +typedef struct +{ + HANDLE OutputHandle; /* Handle to newly created screen buffer */ + + DWORD Access; + DWORD ShareMode; + BOOL Inheritable; +} CONSOLE_CREATESCREENBUFFER, *PCONSOLE_CREATESCREENBUFFER; + +typedef struct +{ + HANDLE OutputHandle; /* Handle to screen buffer to switch to */ +} CONSOLE_SETACTIVESCREENBUFFER, *PCONSOLE_SETACTIVESCREENBUFFER; + +typedef struct +{ + DWORD Length; + PWCHAR Title; +} CONSOLE_GETSETCONSOLETITLE, *PCONSOLE_GETSETCONSOLETITLE; + +typedef struct +{ + HANDLE OutputHandle; + + BOOL Unicode; + COORD BufferSize; + COORD BufferCoord; + SMALL_RECT WriteRegion; + CHAR_INFO* CharInfo; +} CONSOLE_WRITEOUTPUT, *PCONSOLE_WRITEOUTPUT; + +typedef struct +{ + HANDLE InputHandle; +} CONSOLE_FLUSHINPUTBUFFER, *PCONSOLE_FLUSHINPUTBUFFER; + +typedef struct +{ + HANDLE OutputHandle; + + BOOL Unicode; + SMALL_RECT ScrollRectangle; + BOOL UseClipRectangle; + SMALL_RECT ClipRectangle; + COORD DestinationOrigin; + CHAR_INFO Fill; +} CONSOLE_SCROLLSCREENBUFFER, *PCONSOLE_SCROLLSCREENBUFFER; + + +/* + * An attribute or a character are instances of the same entity, namely + * a "code" (what would be called an (ANSI) escape sequence). Therefore + * encode them inside the same structure. + */ +typedef enum _CODE_TYPE +{ + CODE_ASCII = 0x01, + CODE_UNICODE = 0x02, + CODE_ATTRIBUTE = 0x03 +} CODE_TYPE; + +typedef struct +{ + HANDLE OutputHandle; + + DWORD NumCodesToRead; + COORD ReadCoord; + COORD EndCoord; + + DWORD CodesRead; + + CODE_TYPE CodeType; + union + { + PVOID pCode; + PCHAR AsciiChar; + PWCHAR UnicodeChar; + PWORD Attribute; + } pCode; // Either a pointer to a character or to an attribute. +} CONSOLE_READOUTPUTCODE, *PCONSOLE_READOUTPUTCODE; + +typedef struct +{ + HANDLE OutputHandle; + + ULONG BufferSize; + WORD Length; + COORD Coord; + COORD EndCoord; + + ULONG NrCharactersWritten; + + USHORT CodeType; + union + { + // PVOID String; + PVOID pCode; + PCHAR AsciiChar; + PWCHAR UnicodeChar; + PWORD Attribute; + } pCode; // Either a pointer to a character or to an attribute. +} CONSOLE_WRITEOUTPUTCODE, *PCONSOLE_WRITEOUTPUTCODE; + +typedef struct +{ + HANDLE OutputHandle; + + CODE_TYPE CodeType; + union + { + CHAR AsciiChar; + WCHAR UnicodeChar; + WORD Attribute; + } Code; // Either a character or an attribute. + + COORD Coord; + ULONG Length; + + ULONG NrCharactersWritten; // FIXME: Only for chars, is it removable ? +} CONSOLE_FILLOUTPUTCODE, *PCONSOLE_FILLOUTPUTCODE; + +typedef struct +{ + HANDLE InputHandle; + BOOL Unicode; + BOOL bRead; // TRUE --> Read ; FALSE --> Peek + + ULONG InputsRead; + + ULONG Length; + PINPUT_RECORD InputRecord; +} CONSOLE_GETINPUT, *PCONSOLE_GETINPUT; + +typedef struct +{ + HANDLE OutputHandle; + + BOOL Unicode; + COORD BufferSize; + COORD BufferCoord; + SMALL_RECT ReadRegion; + CHAR_INFO* CharInfo; +} CONSOLE_READOUTPUT, *PCONSOLE_READOUTPUT; + +typedef struct +{ + HANDLE InputHandle; + BOOL Unicode; + DWORD Length; + INPUT_RECORD* InputRecord; +} CONSOLE_WRITEINPUT, *PCONSOLE_WRITEINPUT; + +typedef struct +{ + HANDLE ConsoleHandle; +} CONSOLE_CLOSEHANDLE, *PCONSOLE_CLOSEHANDLE; + +typedef struct +{ + HANDLE ConsoleHandle; +} CONSOLE_VERIFYHANDLE, *PCONSOLE_VERIFYHANDLE; + +typedef struct +{ + HANDLE ConsoleHandle; + DWORD Access; + BOOL Inheritable; + DWORD Options; +} CONSOLE_DUPLICATEHANDLE, *PCONSOLE_DUPLICATEHANDLE; + +/* + * Type of handles. + */ +typedef enum _CONSOLE_HANDLE_TYPE +{ + HANDLE_INPUT = 0x01, + HANDLE_OUTPUT = 0x02 +} CONSOLE_HANDLE_TYPE; + +typedef struct +{ + HANDLE ConsoleHandle; + CONSOLE_HANDLE_TYPE HandleType; + DWORD Access; + BOOL Inheritable; + DWORD ShareMode; +} CONSOLE_OPENCONSOLE, *PCONSOLE_OPENCONSOLE; + + +/* + * Console hardware states. + */ +#define CONSOLE_HARDWARE_STATE_GDI_MANAGED 0 +#define CONSOLE_HARDWARE_STATE_DIRECT 1 + +typedef struct +{ + HANDLE OutputHandle; + DWORD State; +} CONSOLE_GETSETHWSTATE, *PCONSOLE_GETSETHWSTATE; + +typedef struct +{ + HWND WindowHandle; +} CONSOLE_GETWINDOW, *PCONSOLE_GETWINDOW; + +typedef struct +{ + HICON WindowIcon; +} CONSOLE_SETICON, *PCONSOLE_SETICON; + + + +typedef struct +{ + ULONG SourceLength; + ULONG TargetLength; // Also used for storing the number of bytes written. + ULONG ExeLength; + LPWSTR Source; + LPWSTR Target; + LPWSTR Exe; +} CONSOLE_ADDGETALIAS, *PCONSOLE_ADDGETALIAS; + +typedef struct +{ + DWORD ExeLength; + DWORD AliasesBufferLength; + LPWSTR ExeName; + LPWSTR AliasesBuffer; +} CONSOLE_GETALLALIASES, *PCONSOLE_GETALLALIASES; + +typedef struct +{ + DWORD Length; + DWORD ExeLength; + LPWSTR ExeName; +} CONSOLE_GETALLALIASESLENGTH, *PCONSOLE_GETALLALIASESLENGTH; + +typedef struct +{ + DWORD Length; + LPWSTR ExeNames; +} CONSOLE_GETALIASESEXES, *PCONSOLE_GETALIASESEXES; + +typedef struct +{ + DWORD Length; +} CONSOLE_GETALIASESEXESLENGTH, *PCONSOLE_GETALIASESEXESLENGTH; + + + +typedef struct +{ + UNICODE_STRING ExeName; + PWCHAR History; + DWORD Length; +} CONSOLE_GETCOMMANDHISTORY, *PCONSOLE_GETCOMMANDHISTORY; + +typedef struct +{ + UNICODE_STRING ExeName; + DWORD Length; +} CONSOLE_GETCOMMANDHISTORYLENGTH, *PCONSOLE_GETCOMMANDHISTORYLENGTH; + +typedef struct +{ + UNICODE_STRING ExeName; +} CONSOLE_EXPUNGECOMMANDHISTORY, *PCONSOLE_EXPUNGECOMMANDHISTORY; + +typedef struct +{ + UNICODE_STRING ExeName; + DWORD NumCommands; +} CONSOLE_SETHISTORYNUMBERCOMMANDS, *PCONSOLE_SETHISTORYNUMBERCOMMANDS; + +typedef struct +{ + UINT HistoryBufferSize; + UINT NumberOfHistoryBuffers; + DWORD dwFlags; +} CONSOLE_GETSETHISTORYINFO, *PCONSOLE_GETSETHISTORYINFO; + + + +typedef struct +{ + DWORD Event; + DWORD ProcessGroup; +} CONSOLE_GENERATECTRLEVENT, *PCONSOLE_GENERATECTRLEVENT; + +typedef struct +{ + HANDLE InputHandle; + DWORD NumInputEvents; +} CONSOLE_GETNUMINPUTEVENTS, *PCONSOLE_GETNUMINPUTEVENTS; + +typedef struct +{ + HANDLE OutputHandle; + COORD Size; +} CONSOLE_SETSCREENBUFFERSIZE, *PCONSOLE_SETSCREENBUFFERSIZE; + +typedef struct +{ + CONSOLE_SELECTION_INFO Info; +} CONSOLE_GETSELECTIONINFO, *PCONSOLE_GETSELECTIONINFO; + +typedef struct +{ + BOOL InputCP; // TRUE : Input Code Page ; FALSE : Output Code Page + UINT CodePage; +} CONSOLE_GETSETINPUTOUTPUTCP, *PCONSOLE_GETSETINPUTOUTPUTCP; + +typedef struct _CONSOLE_API_MESSAGE +{ + PORT_MESSAGE Header; + + PCSR_CAPTURE_BUFFER CsrCaptureData; + CSR_API_NUMBER ApiNumber; + NTSTATUS Status; // ReturnValue; + ULONG Reserved; + union + { + CONSOLE_ALLOCCONSOLE AllocConsoleRequest; + CONSOLE_ATTACHCONSOLE AttachConsoleRequest; + CONSOLE_FREECONSOLE FreeConsoleRequest; + + /* Handles */ + CONSOLE_OPENCONSOLE OpenConsoleRequest; + CONSOLE_CLOSEHANDLE CloseHandleRequest; + CONSOLE_VERIFYHANDLE VerifyHandleRequest; + CONSOLE_DUPLICATEHANDLE DuplicateHandleRequest; + + /* Cursor */ + CONSOLE_GETSETCURSORINFO CursorInfoRequest; + CONSOLE_SETCURSORPOSITION SetCursorPositionRequest; + + /* Screen buffer */ + CONSOLE_CREATESCREENBUFFER CreateScreenBufferRequest; + CONSOLE_SETACTIVESCREENBUFFER SetScreenBufferRequest; + CONSOLE_GETSCREENBUFFERINFO ScreenBufferInfoRequest; + CONSOLE_SETSCREENBUFFERSIZE SetScreenBufferSizeRequest; + CONSOLE_SCROLLSCREENBUFFER ScrollScreenBufferRequest; + + CONSOLE_GETSELECTIONINFO GetSelectionInfoRequest; + CONSOLE_FLUSHINPUTBUFFER FlushInputBufferRequest; + + /* Console mode */ + CONSOLE_GETSETCONSOLEMODE ConsoleModeRequest; + CONSOLE_GETSETHWSTATE HardwareStateRequest; + + /* Console window */ + CONSOLE_GETSETCONSOLETITLE TitleRequest; + CONSOLE_GETWINDOW GetWindowRequest; + CONSOLE_SETICON SetIconRequest; + + /* Read */ + CONSOLE_READCONSOLE ReadConsoleRequest; // SrvReadConsole / ReadConsole + CONSOLE_GETINPUT GetInputRequest; // SrvGetConsoleInput / PeekConsoleInput & ReadConsoleInput + CONSOLE_READOUTPUT ReadOutputRequest; // SrvReadConsoleOutput / ReadConsoleOutput + CONSOLE_READOUTPUTCODE ReadOutputCodeRequest; // SrvReadConsoleOutputString / ReadConsoleOutputAttribute & ReadConsoleOutputCharacter + + /* Write */ + CONSOLE_WRITECONSOLE WriteConsoleRequest; // SrvWriteConsole / WriteConsole + CONSOLE_WRITEINPUT WriteInputRequest; + CONSOLE_WRITEOUTPUT WriteOutputRequest; + CONSOLE_WRITEOUTPUTCODE WriteOutputCodeRequest; + + CONSOLE_FILLOUTPUTCODE FillOutputRequest; + CONSOLE_SETTEXTATTRIB SetTextAttribRequest; + + /* Aliases */ + CONSOLE_ADDGETALIAS ConsoleAliasRequest; + CONSOLE_GETALLALIASES GetAllAliasesRequest; + CONSOLE_GETALLALIASESLENGTH GetAllAliasesLengthRequest; + CONSOLE_GETALIASESEXES GetAliasesExesRequest; + CONSOLE_GETALIASESEXESLENGTH GetAliasesExesLengthRequest; + + /* History */ + CONSOLE_GETCOMMANDHISTORY GetCommandHistoryRequest; + CONSOLE_GETCOMMANDHISTORYLENGTH GetCommandHistoryLengthRequest; + CONSOLE_EXPUNGECOMMANDHISTORY ExpungeCommandHistoryRequest; + CONSOLE_SETHISTORYNUMBERCOMMANDS SetHistoryNumberCommandsRequest; + CONSOLE_GETSETHISTORYINFO HistoryInfoRequest; + + CONSOLE_GENERATECTRLEVENT GenerateCtrlEventRequest; + CONSOLE_GETNUMINPUTEVENTS GetNumInputEventsRequest; + + /* Input and Output Code Pages */ + CONSOLE_GETSETINPUTOUTPUTCP ConsoleCPRequest; + + CONSOLE_GETPROCESSLIST GetProcessListRequest; + } Data; +} CONSOLE_API_MESSAGE, *PCONSOLE_API_MESSAGE; + +// Check that a CONSOLE_API_MESSAGE can hold in a CSR_API_MESSAGE. +CHECK_API_MSG_SIZE(CONSOLE_API_MESSAGE); + +#endif // _CONMSG_H + +/* EOF */ Index: include/reactos/subsys/win/conmsg.h =================================================================== --- include/reactos/subsys/win/conmsg.h (rvision 58607) +++ include/reactos/subsys/win/conmsg.h (copie de travail) Modification de proprits sur include/reactos/subsys/win/conmsg.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: include/reactos/subsys/win/console.h =================================================================== --- include/reactos/subsys/win/console.h (rvision 0) +++ include/reactos/subsys/win/console.h (copie de travail) @@ -0,0 +1,24 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: include/reactos/subsys/win/console.h + * PURPOSE: Public definitions for Console API Clients + * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr) + */ + +#ifndef _CONSOLE_H +#define _CONSOLE_H + +#pragma once + +#define IsConsoleHandle(h) \ + (((ULONG_PTR)(h) & 0x10000003) == 0x3) + +/* Console reserved "file" names */ +#define CONSOLE_FILE_NAME L"CON" +#define CONSOLE_INPUT_FILE_NAME L"CONIN$" +#define CONSOLE_OUTPUT_FILE_NAME L"CONOUT$" + +#endif // _CONSOLE_H + +/* EOF */ Index: include/reactos/subsys/win/console.h =================================================================== --- include/reactos/subsys/win/console.h (rvision 58607) +++ include/reactos/subsys/win/console.h (copie de travail) Modification de proprits sur include/reactos/subsys/win/console.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: include/reactos/subsys/win/winmsg.h =================================================================== --- include/reactos/subsys/win/winmsg.h (rvision 0) +++ include/reactos/subsys/win/winmsg.h (copie de travail) @@ -0,0 +1,78 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: include/reactos/subsys/win/winmsg.h + * PURPOSE: Public definitions for communication + * between User-Mode API Clients and Servers + * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr) + */ + +#ifndef _WINMSG_H +#define _WINMSG_H + +#pragma once + +#define USERSRV_SERVERDLL_INDEX 3 +#define USERSRV_FIRST_API_NUMBER 1024 + +// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3 +typedef enum _USERSRV_API_NUMBER +{ + UserpExitWindowsEx = USERSRV_FIRST_API_NUMBER, + // UserpEndTask, + // UserpLogon, + UserpRegisterServicesProcess, // Not present in Win7 + // UserpActivateDebugger, + // UserpGetThreadConsoleDesktop, // Not present in Win7 + // UserpDeviceEvent, + UserpRegisterLogonProcess, // Not present in Win7 + // UserpCreateSystemThreads, + // UserpRecordShutdownReason, + // UserpCancelShutdown, // Added in Vista + // UserpConsoleHandleOperation, // Added in Win7 + // UserpGetSetShutdownBlockReason, // Added in Vista + + UserpMaxApiNumber +} USERSRV_API_NUMBER, *PUSERSRV_API_NUMBER; + + +typedef struct +{ + UINT Flags; + DWORD Reserved; +} CSRSS_EXIT_REACTOS, *PCSRSS_EXIT_REACTOS; + +typedef struct +{ + ULONG_PTR ProcessId; +} CSRSS_REGISTER_SERVICES_PROCESS, *PCSRSS_REGISTER_SERVICES_PROCESS; + +typedef struct +{ + ULONG_PTR ProcessId; + BOOL Register; +} CSRSS_REGISTER_LOGON_PROCESS, *PCSRSS_REGISTER_LOGON_PROCESS; + + +typedef struct _USER_API_MESSAGE +{ + PORT_MESSAGE Header; + + PCSR_CAPTURE_BUFFER CsrCaptureData; + CSR_API_NUMBER ApiNumber; + NTSTATUS Status; // ReturnValue; + ULONG Reserved; + union + { + CSRSS_EXIT_REACTOS ExitReactosRequest; + CSRSS_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest; + CSRSS_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest; + } Data; +} USER_API_MESSAGE, *PUSER_API_MESSAGE; + +// Check that a USER_API_MESSAGE can hold in a CSR_API_MESSAGE. +CHECK_API_MSG_SIZE(USER_API_MESSAGE); + +#endif // _WINMSG_H + +/* EOF */ Index: include/reactos/subsys/win/winmsg.h =================================================================== --- include/reactos/subsys/win/winmsg.h (rvision 58607) +++ include/reactos/subsys/win/winmsg.h (copie de travail) Modification de proprits sur include/reactos/subsys/win/winmsg.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: lib/smlib/smclient.c =================================================================== --- lib/smlib/smclient.c (rvision 58607) +++ lib/smlib/smclient.c (copie de travail) @@ -38,7 +38,7 @@ SmApiMsg.h.u1.s1.TotalLength = sizeof(SmApiMsg); /* Initalize this specific API's parameters */ - SmApiMsg.ApiNumber = SmExecPgmApi; + SmApiMsg.ApiNumber = SmpExecPgmApi; RtlCopyMemory(&SmApiMsg.u.ExecPgm.ProcessInformation, ProcessInformation, sizeof(SmApiMsg.u.ExecPgm.ProcessInformation)); @@ -144,7 +144,7 @@ SessionComplete->SessionStatus = SessionStatus; /* Set the API Message Port Message header */ - ApiMessage.ApiNumber = SmSessionCompleteApi; + ApiMessage.ApiNumber = SmpSessionCompleteApi; ApiMessage.h.u1.s1.DataLength = sizeof(SM_SESSION_COMPLETE_MSG) + 8; ApiMessage.h.u1.s1.TotalLength = sizeof(SM_API_MSG); ApiMessage.h.u2.ZeroInit = 0; Index: subsystems/CMakeLists.txt =================================================================== --- subsystems/CMakeLists.txt (rvision 58607) +++ subsystems/CMakeLists.txt (copie de travail) @@ -1,4 +1,6 @@ + if(ARCH STREQUAL "i386") add_subdirectory(ntvdm) endif() +add_subdirectory(win) add_subdirectory(win32) Index: subsystems/win32/CMakeLists.txt =================================================================== --- subsystems/win32/CMakeLists.txt (rvision 58607) +++ subsystems/win32/CMakeLists.txt (copie de travail) @@ -1,2 +1,3 @@ +add_subdirectory(csrsrv) add_subdirectory(csrss) Index: subsystems/win32/csrsrv/api.c =================================================================== --- subsystems/win32/csrsrv/api.c (rvision 0) +++ subsystems/win32/csrsrv/api.c (copie de travail) @@ -0,0 +1,1442 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: subsystems/win32/csrsrv/api.c + * PURPOSE: CSR Server DLL API LPC Implementation + * "\windows\ApiPort" port process management functions + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES *******************************************************************/ + +#include "srv.h" + +#define NDEBUG +#include + +/* GLOBALS ********************************************************************/ + +BOOLEAN (*CsrClientThreadSetup)(VOID) = NULL; +UNICODE_STRING CsrApiPortName; +volatile LONG CsrpStaticThreadCount; +volatile LONG CsrpDynamicThreadTotal; +extern ULONG CsrMaxApiRequestThreads; + +/* FUNCTIONS ******************************************************************/ + +/*++ + * @name CsrCallServerFromServer + * @implemented NT4 + * + * The CsrCallServerFromServer routine calls a CSR API from within a server. + * It avoids using LPC messages since the request isn't coming from a client. + * + * @param ReceiveMsg + * Pointer to the CSR API Message to send to the server. + * + * @param ReplyMsg + * Pointer to the CSR API Message to receive from the server. + * + * @return STATUS_SUCCESS in case of success, STATUS_ILLEGAL_FUNCTION + * if the ApiNumber is invalid, or STATUS_ACCESS_VIOLATION if there + * was a problem executing the API. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrCallServerFromServer(IN PCSR_API_MESSAGE ReceiveMsg, + IN OUT PCSR_API_MESSAGE ReplyMsg) +{ + ULONG ServerId; + PCSR_SERVER_DLL ServerDll; + ULONG ApiId; + CSR_REPLY_CODE ReplyCode = CsrReplyImmediately; + + /* Get the Server ID */ + ServerId = CSR_API_NUMBER_TO_SERVER_ID(ReceiveMsg->ApiNumber); + + /* Make sure that the ID is within limits, and the Server DLL loaded */ + if ((ServerId >= CSR_SERVER_DLL_MAX) || + (!(ServerDll = CsrLoadedServerDll[ServerId]))) + { + /* We are beyond the Maximum Server ID */ + DPRINT1("CSRSS: %lx is invalid ServerDllIndex (%08x)\n", ServerId, ServerDll); + ReplyMsg->Status = (ULONG)STATUS_ILLEGAL_FUNCTION; + return STATUS_ILLEGAL_FUNCTION; + } + else + { + /* Get the API ID, normalized with our Base ID */ + ApiId = CSR_API_NUMBER_TO_API_ID(ReceiveMsg->ApiNumber) - ServerDll->ApiBase; + + /* Make sure that the ID is within limits, and the entry exists */ + if ((ApiId >= ServerDll->HighestApiSupported) || + ((ServerDll->ValidTable) && !(ServerDll->ValidTable[ApiId]))) + { + /* We are beyond the Maximum API ID, or it doesn't exist */ + DPRINT1("CSRSS: %lx (%s) is invalid ApiTableIndex for %Z or is an " + "invalid API to call from the server.\n", + ServerDll->ValidTable[ApiId], + ((ServerDll->NameTable) && (ServerDll->NameTable[ApiId])) ? + ServerDll->NameTable[ApiId] : "*** UNKNOWN ***", &ServerDll->Name); + DbgBreakPoint(); + ReplyMsg->Status = (ULONG)STATUS_ILLEGAL_FUNCTION; + return STATUS_ILLEGAL_FUNCTION; + } + } + + if (CsrDebug & 2) + { + DPRINT1("CSRSS: %s Api Request received from server process\n", + ServerDll->NameTable[ApiId]); + } + + /* Validation complete, start SEH */ + _SEH2_TRY + { + /* Call the API, get the reply code and return the result */ + ReplyMsg->Status = ServerDll->DispatchTable[ApiId](ReceiveMsg, &ReplyCode); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* If we got an exception, return access violation */ + ReplyMsg->Status = STATUS_ACCESS_VIOLATION; + } + _SEH2_END; + + /* Return success */ + return STATUS_SUCCESS; +} + +/*++ + * @name CsrApiHandleConnectionRequest + * + * The CsrApiHandleConnectionRequest routine handles and accepts a new + * connection request to the CSR API LPC Port. + * + * @param ApiMessage + * Pointer to the incoming CSR API Message which contains the + * connection request. + * + * @return STATUS_SUCCESS in case of success, or status code which caused + * the routine to error. + * + * @remarks This routine is responsible for attaching the Shared Section to + * new clients connecting to CSR. + * + *--*/ +NTSTATUS +NTAPI +CsrApiHandleConnectionRequest(IN PCSR_API_MESSAGE ApiMessage) +{ + PCSR_THREAD CsrThread = NULL; + PCSR_PROCESS CsrProcess = NULL; + NTSTATUS Status = STATUS_SUCCESS; + PCSR_CONNECTION_INFO ConnectInfo = &ApiMessage->ConnectionInfo; + BOOLEAN AllowConnection = FALSE; + REMOTE_PORT_VIEW RemotePortView; + HANDLE ServerPort; + + /* Acquire the Process Lock */ + CsrAcquireProcessLock(); + + /* Lookup the CSR Thread */ + CsrThread = CsrLocateThreadByClientId(NULL, &ApiMessage->Header.ClientId); + + /* Check if we have a thread */ + if (CsrThread) + { + /* Get the Process */ + CsrProcess = CsrThread->Process; + + /* Make sure we have a Process as well */ + if (CsrProcess) + { + /* Reference the Process */ + CsrLockedReferenceProcess(CsrThread->Process); + + /* Release the lock */ + CsrReleaseProcessLock(); + + /* Duplicate the Object Directory */ + Status = NtDuplicateObject(NtCurrentProcess(), + CsrObjectDirectory, + CsrProcess->ProcessHandle, + &ConnectInfo->ObjectDirectory, + 0, + 0, + DUPLICATE_SAME_ACCESS | + DUPLICATE_SAME_ATTRIBUTES); + + /* Acquire the lock */ + CsrAcquireProcessLock(); + + /* Check for success */ + if (NT_SUCCESS(Status)) + { + /* Attach the Shared Section */ + Status = CsrSrvAttachSharedSection(CsrProcess, ConnectInfo); + + /* Check how this went */ + if (NT_SUCCESS(Status)) AllowConnection = TRUE; + } + + /* Dereference the project */ + CsrLockedDereferenceProcess(CsrProcess); + } + } + + /* Release the lock */ + CsrReleaseProcessLock(); + + /* Setup the Port View Structure */ + RemotePortView.Length = sizeof(REMOTE_PORT_VIEW); + RemotePortView.ViewSize = 0; + RemotePortView.ViewBase = NULL; + + /* Save the Process ID */ + ConnectInfo->ProcessId = NtCurrentTeb()->ClientId.UniqueProcess; + + /* Accept the Connection */ + Status = NtAcceptConnectPort(&ServerPort, + AllowConnection ? UlongToPtr(CsrProcess->SequenceNumber) : 0, + &ApiMessage->Header, + AllowConnection, + NULL, + &RemotePortView); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: NtAcceptConnectPort - failed. Status == %X\n", Status); + } + else if (AllowConnection) + { + if (CsrDebug & 2) + { + DPRINT1("CSRSS: ClientId: %lx.%lx has ClientView: Base=%p, Size=%lx\n", + ApiMessage->Header.ClientId.UniqueProcess, + ApiMessage->Header.ClientId.UniqueThread, + RemotePortView.ViewBase, + RemotePortView.ViewSize); + } + + /* Set some Port Data in the Process */ + CsrProcess->ClientPort = ServerPort; + CsrProcess->ClientViewBase = (ULONG_PTR)RemotePortView.ViewBase; + CsrProcess->ClientViewBounds = (ULONG_PTR)((ULONG_PTR)RemotePortView.ViewBase + + (ULONG_PTR)RemotePortView.ViewSize); + + /* Complete the connection */ + Status = NtCompleteConnectPort(ServerPort); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: NtCompleteConnectPort - failed. Status == %X\n", Status); + } + } + else + { + DPRINT1("CSRSS: Rejecting Connection Request from ClientId: %lx.%lx\n", + ApiMessage->Header.ClientId.UniqueProcess, + ApiMessage->Header.ClientId.UniqueThread); + } + + /* Return status to caller */ + return Status; +} + +/*++ + * @name CsrpCheckRequestThreads + * + * The CsrpCheckRequestThreads routine checks if there are no more threads + * to handle CSR API Requests, and creates a new thread if possible, to + * avoid starvation. + * + * @param None. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL + * if a new thread couldn't be created. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrpCheckRequestThreads(VOID) +{ + HANDLE hThread; + CLIENT_ID ClientId; + NTSTATUS Status; + + /* Decrease the count, and see if we're out */ + if (_InterlockedDecrement(&CsrpStaticThreadCount) == 0) + { + /* Check if we've still got space for a Dynamic Thread */ + if (CsrpDynamicThreadTotal < CsrMaxApiRequestThreads) + { + /* Create a new dynamic thread */ + Status = RtlCreateUserThread(NtCurrentProcess(), + NULL, + TRUE, + 0, + 0, + 0, + (PVOID)CsrApiRequestThread, + NULL, + &hThread, + &ClientId); + /* Check success */ + if (NT_SUCCESS(Status)) + { + /* Increase the thread counts */ + _InterlockedIncrement(&CsrpStaticThreadCount); + _InterlockedIncrement(&CsrpDynamicThreadTotal); + + /* Add a new server thread */ + if (CsrAddStaticServerThread(hThread, + &ClientId, + CsrThreadIsServerThread)) + { + /* Activate it */ + NtResumeThread(hThread, NULL); + } + else + { + /* Failed to create a new static thread */ + _InterlockedDecrement(&CsrpStaticThreadCount); + _InterlockedDecrement(&CsrpDynamicThreadTotal); + + /* Terminate it */ + DPRINT1("Failing\n"); + NtTerminateThread(hThread, 0); + NtClose(hThread); + + /* Return */ + return STATUS_UNSUCCESSFUL; + } + } + } + } + + /* Success */ + return STATUS_SUCCESS; +} + +/*++ + * @name CsrApiRequestThread + * + * The CsrApiRequestThread routine handles incoming messages or connection + * requests on the CSR API LPC Port. + * + * @param Parameter + * System-default user-defined parameter. Unused. + * + * @return The thread exit code, if the thread is terminated. + * + * @remarks Before listening on the port, the routine will first attempt + * to connect to the user subsystem. + * + *--*/ +NTSTATUS +NTAPI +CsrApiRequestThread(IN PVOID Parameter) +{ + PTEB Teb = NtCurrentTeb(); + LARGE_INTEGER TimeOut; + PCSR_THREAD CurrentThread, CsrThread; + NTSTATUS Status; + CSR_REPLY_CODE ReplyCode; + PCSR_API_MESSAGE ReplyMsg; + CSR_API_MESSAGE ReceiveMsg; + PCSR_PROCESS CsrProcess; + PHARDERROR_MSG HardErrorMsg; + PVOID PortContext; + PCSR_SERVER_DLL ServerDll; + PCLIENT_DIED_MSG ClientDiedMsg; + PDBGKM_MSG DebugMessage; + ULONG ServerId, ApiId, MessageType, i; + HANDLE ReplyPort; + + /* Setup LPC loop port and message */ + ReplyMsg = NULL; + ReplyPort = CsrApiPort; + + /* Connect to user32 */ + while (!CsrConnectToUser()) + { + /* Set up the timeout for the connect (30 seconds) */ + TimeOut.QuadPart = -30 * 1000 * 1000 * 10; + + /* Keep trying until we get a response */ + Teb->Win32ClientInfo[0] = 0; + NtDelayExecution(FALSE, &TimeOut); + } + + /* Get our thread */ + CurrentThread = Teb->CsrClientThread; + + /* If we got an event... */ + if (Parameter) + { + /* Set it, to let stuff waiting on us load */ + Status = NtSetEvent((HANDLE)Parameter, NULL); + ASSERT(NT_SUCCESS(Status)); + + /* Increase the Thread Counts */ + _InterlockedIncrement(&CsrpStaticThreadCount); + _InterlockedIncrement(&CsrpDynamicThreadTotal); + } + + /* Now start the loop */ + while (TRUE) + { + /* Make sure the real CID is set */ + Teb->RealClientId = Teb->ClientId; + + /* Debug check */ + if (Teb->CountOfOwnedCriticalSections) + { + DPRINT1("CSRSRV: FATAL ERROR. CsrThread is Idle while holding %lu critical sections\n", + Teb->CountOfOwnedCriticalSections); + DPRINT1("CSRSRV: Last Receive Message %lx ReplyMessage %lx\n", + &ReceiveMsg, ReplyMsg); + DbgBreakPoint(); + } + + /* Wait for a message to come through */ + Status = NtReplyWaitReceivePort(ReplyPort, + &PortContext, + &ReplyMsg->Header, + &ReceiveMsg.Header); + + /* Check if we didn't get success */ + if (Status != STATUS_SUCCESS) + { + /* Was it a failure or another success code? */ + if (!NT_SUCCESS(Status)) + { + /* Check for specific status cases */ + if ((Status != STATUS_INVALID_CID) && + (Status != STATUS_UNSUCCESSFUL) && + ((Status == STATUS_INVALID_HANDLE) || (ReplyPort == CsrApiPort))) + { + /* Notify the debugger */ + DPRINT1("CSRSS: ReceivePort failed - Status == %X\n", Status); + DPRINT1("CSRSS: ReplyPortHandle %lx CsrApiPort %lx\n", ReplyPort, CsrApiPort); + } + + /* We failed big time, so start out fresh */ + ReplyMsg = NULL; + ReplyPort = CsrApiPort; + continue; + } + else + { + /* A bizare "success" code, just try again */ + DPRINT1("NtReplyWaitReceivePort returned \"success\" status 0x%x\n", Status); + continue; + } + } + + /* Use whatever Client ID we got */ + Teb->RealClientId = ReceiveMsg.Header.ClientId; + + /* Get the Message Type */ + MessageType = ReceiveMsg.Header.u2.s2.Type; + + /* Handle connection requests */ + if (MessageType == LPC_CONNECTION_REQUEST) + { + /* Handle the Connection Request */ + CsrApiHandleConnectionRequest(&ReceiveMsg); + + ReplyMsg = NULL; + ReplyPort = CsrApiPort; + continue; + } + + /* It's some other kind of request. Get the lock for the lookup */ + CsrAcquireProcessLock(); + + /* Now do the lookup to get the CSR_THREAD */ + CsrThread = CsrLocateThreadByClientId(&CsrProcess, + &ReceiveMsg.Header.ClientId); + + /* Did we find a thread? */ + if (!CsrThread) + { + /* This wasn't a CSR Thread, release lock */ + CsrReleaseProcessLock(); + + /* If this was an exception, handle it */ + if (MessageType == LPC_EXCEPTION) + { + ReplyMsg = &ReceiveMsg; + ReplyPort = CsrApiPort; + ReplyMsg->Status = DBG_CONTINUE; + } + else if (MessageType == LPC_PORT_CLOSED || + MessageType == LPC_CLIENT_DIED) + { + /* The Client or Port are gone, loop again */ + ReplyMsg = NULL; + ReplyPort = CsrApiPort; + } + else if (MessageType == LPC_ERROR_EVENT) + { + /* If it's a hard error, handle this too */ + HardErrorMsg = (PHARDERROR_MSG)&ReceiveMsg; + + /* Default it to unhandled */ + HardErrorMsg->Response = ResponseNotHandled; + + /* Check if there are free api threads */ + CsrpCheckRequestThreads(); + if (CsrpStaticThreadCount) + { + /* Loop every Server DLL */ + for (i = 0; i < CSR_SERVER_DLL_MAX; i++) + { + /* Get the Server DLL */ + ServerDll = CsrLoadedServerDll[i]; + + /* Check if it's valid and if it has a Hard Error Callback */ + if ((ServerDll) && (ServerDll->HardErrorCallback)) + { + /* Call it */ + ServerDll->HardErrorCallback(NULL /* == CsrThread */, HardErrorMsg); + + /* If it's handled, get out of here */ + if (HardErrorMsg->Response != ResponseNotHandled) break; + } + } + } + + /* Increase the thread count */ + _InterlockedIncrement(&CsrpStaticThreadCount); + + /* If the response was 0xFFFFFFFF, we'll ignore it */ + if (HardErrorMsg->Response == 0xFFFFFFFF) + { + ReplyMsg = NULL; + ReplyPort = CsrApiPort; + } + else + { + ReplyMsg = &ReceiveMsg; + ReplyPort = CsrApiPort; + } + } + else if (MessageType == LPC_REQUEST) + { + /* This is an API Message coming from a non-CSR Thread */ + ReplyMsg = &ReceiveMsg; + ReplyPort = CsrApiPort; + ReplyMsg->Status = STATUS_ILLEGAL_FUNCTION; + } + else if (MessageType == LPC_DATAGRAM) + { + /* This is an API call, get the Server ID */ + ServerId = CSR_API_NUMBER_TO_SERVER_ID(ReceiveMsg.ApiNumber); + + /* Make sure that the ID is within limits, and the Server DLL loaded */ + ServerDll = NULL; + if ((ServerId >= CSR_SERVER_DLL_MAX) || + (!(ServerDll = CsrLoadedServerDll[ServerId]))) + { + /* We are beyond the Maximum Server ID */ + DPRINT1("CSRSS: %lx is invalid ServerDllIndex (%08x)\n", + ServerId, ServerDll); + DbgBreakPoint(); + + ReplyMsg = NULL; + ReplyPort = CsrApiPort; + continue; + } + + /* Get the API ID, normalized with our Base ID */ + ApiId = CSR_API_NUMBER_TO_API_ID(ReceiveMsg.ApiNumber) - ServerDll->ApiBase; + + /* Make sure that the ID is within limits, and the entry exists */ + if (ApiId >= ServerDll->HighestApiSupported) + { + /* We are beyond the Maximum API ID, or it doesn't exist */ + DPRINT1("CSRSS: %lx is invalid ApiTableIndex for %Z\n", + CSR_API_NUMBER_TO_API_ID(ReceiveMsg.ApiNumber), + &ServerDll->Name); + + ReplyPort = CsrApiPort; + ReplyMsg = NULL; + continue; + } + + if (CsrDebug & 2) + { + DPRINT1("[%02x] CSRSS: [%02x,%02x] - %s Api called from %08x\n", + Teb->ClientId.UniqueThread, + ReceiveMsg.Header.ClientId.UniqueProcess, + ReceiveMsg.Header.ClientId.UniqueThread, + ServerDll->NameTable[ApiId], + NULL); + } + + /* Assume success */ + ReceiveMsg.Status = STATUS_SUCCESS; + + /* Validation complete, start SEH */ + _SEH2_TRY + { + /* Make sure we have enough threads */ + CsrpCheckRequestThreads(); + + /* Call the API and get the reply code */ + ReplyMsg = NULL; + ReplyPort = CsrApiPort; + ServerDll->DispatchTable[ApiId](&ReceiveMsg, &ReplyCode); + + /* Increase the static thread count */ + _InterlockedIncrement(&CsrpStaticThreadCount); + } + _SEH2_EXCEPT(CsrUnhandledExceptionFilter(_SEH2_GetExceptionInformation())) + { + ReplyMsg = NULL; + ReplyPort = CsrApiPort; + } + _SEH2_END; + } + else + { + /* Some other ignored message type */ + ReplyMsg = NULL; + ReplyPort = CsrApiPort; + } + + /* Keep going */ + continue; + } + + /* We have a valid thread, was this an LPC Request? */ + if (MessageType != LPC_REQUEST) + { + /* It's not an API, check if the client died */ + if (MessageType == LPC_CLIENT_DIED) + { + /* Get the information and check if it matches our thread */ + ClientDiedMsg = (PCLIENT_DIED_MSG)&ReceiveMsg; + if (ClientDiedMsg->CreateTime.QuadPart == CsrThread->CreateTime.QuadPart) + { + /* Now we reply to the dying client */ + ReplyPort = CsrThread->Process->ClientPort; + + /* Reference the thread */ + CsrLockedReferenceThread(CsrThread); + + /* Destroy the thread in the API Message */ + CsrDestroyThread(&ReceiveMsg.Header.ClientId); + + /* Check if the thread was actually ourselves */ + if (CsrProcess->ThreadCount == 1) + { + /* Kill the process manually here */ + CsrDestroyProcess(&CsrThread->ClientId, 0); + } + + /* Remove our extra reference */ + CsrLockedDereferenceThread(CsrThread); + } + + /* Release the lock and keep looping */ + CsrReleaseProcessLock(); + + ReplyMsg = NULL; + ReplyPort = CsrApiPort; + continue; + } + + /* Reference the thread and release the lock */ + CsrLockedReferenceThread(CsrThread); + CsrReleaseProcessLock(); + + /* Check if this was an exception */ + if (MessageType == LPC_EXCEPTION) + { + /* Kill the process */ + NtTerminateProcess(CsrProcess->ProcessHandle, STATUS_ABANDONED); + + /* Destroy it from CSR */ + CsrDestroyProcess(&ReceiveMsg.Header.ClientId, STATUS_ABANDONED); + + /* Return a Debug Message */ + DebugMessage = (PDBGKM_MSG)&ReceiveMsg; + DebugMessage->ReturnedStatus = DBG_CONTINUE; + ReplyMsg = &ReceiveMsg; + ReplyPort = CsrApiPort; + + /* Remove our extra reference */ + CsrDereferenceThread(CsrThread); + } + else if (MessageType == LPC_ERROR_EVENT) + { + /* If it's a hard error, handle this too */ + HardErrorMsg = (PHARDERROR_MSG)&ReceiveMsg; + + /* Default it to unhandled */ + HardErrorMsg->Response = ResponseNotHandled; + + /* Check if there are free api threads */ + CsrpCheckRequestThreads(); + if (CsrpStaticThreadCount) + { + /* Loop every Server DLL */ + for (i = 0; i < CSR_SERVER_DLL_MAX; i++) + { + /* Get the Server DLL */ + ServerDll = CsrLoadedServerDll[i]; + + /* Check if it's valid and if it has a Hard Error Callback */ + if ((ServerDll) && (ServerDll->HardErrorCallback)) + { + /* Call it */ + ServerDll->HardErrorCallback(CsrThread, HardErrorMsg); + + /* If it's handled, get out of here */ + if (HardErrorMsg->Response != ResponseNotHandled) break; + } + } + } + + /* Increase the thread count */ + _InterlockedIncrement(&CsrpStaticThreadCount); + + /* If the response was 0xFFFFFFFF, we'll ignore it */ + if (HardErrorMsg->Response == 0xFFFFFFFF) + { + ReplyMsg = NULL; + ReplyPort = CsrApiPort; + } + else + { + CsrDereferenceThread(CsrThread); + ReplyMsg = &ReceiveMsg; + ReplyPort = CsrApiPort; + } + } + else + { + /* Something else */ + CsrDereferenceThread(CsrThread); + ReplyMsg = NULL; + } + + /* Keep looping */ + continue; + } + + /* We got an API Request */ + CsrLockedReferenceThread(CsrThread); + CsrReleaseProcessLock(); + + /* This is an API call, get the Server ID */ + ServerId = CSR_API_NUMBER_TO_SERVER_ID(ReceiveMsg.ApiNumber); + + /* Make sure that the ID is within limits, and the Server DLL loaded */ + ServerDll = NULL; + if ((ServerId >= CSR_SERVER_DLL_MAX) || + (!(ServerDll = CsrLoadedServerDll[ServerId]))) + { + /* We are beyond the Maximum Server ID */ + DPRINT1("CSRSS: %lx is invalid ServerDllIndex (%08x)\n", + ServerId, ServerDll); + DbgBreakPoint(); + + ReplyPort = CsrApiPort; + ReplyMsg = &ReceiveMsg; + ReplyMsg->Status = STATUS_ILLEGAL_FUNCTION; + CsrDereferenceThread(CsrThread); + continue; + } + + /* Get the API ID, normalized with our Base ID */ + ApiId = CSR_API_NUMBER_TO_API_ID(ReceiveMsg.ApiNumber) - ServerDll->ApiBase; + + /* Make sure that the ID is within limits, and the entry exists */ + if (ApiId >= ServerDll->HighestApiSupported) + { + /* We are beyond the Maximum API ID, or it doesn't exist */ + DPRINT1("CSRSS: %lx is invalid ApiTableIndex for %Z\n", + CSR_API_NUMBER_TO_API_ID(ReceiveMsg.ApiNumber), + &ServerDll->Name); + + ReplyPort = CsrApiPort; + ReplyMsg = &ReceiveMsg; + ReplyMsg->Status = STATUS_ILLEGAL_FUNCTION; + CsrDereferenceThread(CsrThread); + continue; + } + + if (CsrDebug & 2) + { + DPRINT1("[%02x] CSRSS: [%02x,%02x] - %s Api called from %08x, Process %08x - %08x\n", + Teb->ClientId.UniqueThread, + ReceiveMsg.Header.ClientId.UniqueProcess, + ReceiveMsg.Header.ClientId.UniqueThread, + ServerDll->NameTable[ApiId], + CsrThread, + CsrThread->Process, + CsrProcess); + } + + /* Assume success */ + ReplyMsg = &ReceiveMsg; + ReceiveMsg.Status = STATUS_SUCCESS; + + /* Now we reply to a particular client */ + ReplyPort = CsrThread->Process->ClientPort; + + /* Check if there's a capture buffer */ + if (ReceiveMsg.CsrCaptureData) + { + /* Capture the arguments */ + if (!CsrCaptureArguments(CsrThread, &ReceiveMsg)) + { + /* Ignore this message if we failed to get the arguments */ + CsrDereferenceThread(CsrThread); + continue; + } + } + + /* Validation complete, start SEH */ + _SEH2_TRY + { + /* Make sure we have enough threads */ + CsrpCheckRequestThreads(); + + Teb->CsrClientThread = CsrThread; + + /* Call the API, get the reply code and return the result */ + ReplyCode = CsrReplyImmediately; + ReplyMsg->Status = ServerDll->DispatchTable[ApiId](&ReceiveMsg, &ReplyCode); + + /* Increase the static thread count */ + _InterlockedIncrement(&CsrpStaticThreadCount); + + Teb->CsrClientThread = CurrentThread; + + if (ReplyCode == CsrReplyAlreadySent) + { + if (ReceiveMsg.CsrCaptureData) + { + CsrReleaseCapturedArguments(&ReceiveMsg); + } + ReplyMsg = NULL; + ReplyPort = CsrApiPort; + CsrDereferenceThread(CsrThread); + } + else if (ReplyCode == CsrReplyDeadClient) + { + /* Reply to the death message */ + NtReplyPort(ReplyPort, &ReplyMsg->Header); + + /* Reply back to the API port now */ + ReplyMsg = NULL; + ReplyPort = CsrApiPort; + + CsrDereferenceThread(CsrThread); + } + else if (ReplyCode == CsrReplyPending) + { + ReplyMsg = NULL; + ReplyPort = CsrApiPort; + } + else + { + if (ReceiveMsg.CsrCaptureData) + { + CsrReleaseCapturedArguments(&ReceiveMsg); + } + CsrDereferenceThread(CsrThread); + } + } + _SEH2_EXCEPT(CsrUnhandledExceptionFilter(_SEH2_GetExceptionInformation())) + { + ReplyMsg = NULL; + ReplyPort = CsrApiPort; + } + _SEH2_END; + } + + /* We're out of the loop for some reason, terminate! */ + NtTerminateThread(NtCurrentThread(), Status); + return Status; +} + +/*++ + * @name CsrApiPortInitialize + * + * The CsrApiPortInitialize routine initializes the LPC Port used for + * communications with the Client/Server Runtime (CSR) and initializes the + * static thread that will handle connection requests and APIs. + * + * @param None + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrApiPortInitialize(VOID) +{ + ULONG Size; + OBJECT_ATTRIBUTES ObjectAttributes; + NTSTATUS Status; + HANDLE hRequestEvent, hThread; + CLIENT_ID ClientId; + PLIST_ENTRY ListHead, NextEntry; + PCSR_THREAD ServerThread; + + /* Calculate how much space we'll need for the Port Name */ + Size = CsrDirectoryName.Length + sizeof(CSR_PORT_NAME) + sizeof(WCHAR); + + /* Create the buffer for it */ + CsrApiPortName.Buffer = RtlAllocateHeap(CsrHeap, 0, Size); + if (!CsrApiPortName.Buffer) return STATUS_NO_MEMORY; + + /* Setup the rest of the empty string */ + CsrApiPortName.Length = 0; + CsrApiPortName.MaximumLength = (USHORT)Size; + RtlAppendUnicodeStringToString(&CsrApiPortName, &CsrDirectoryName); + RtlAppendUnicodeToString(&CsrApiPortName, UNICODE_PATH_SEP); + RtlAppendUnicodeToString(&CsrApiPortName, CSR_PORT_NAME); + if (CsrDebug & 1) + { + DPRINT1("CSRSS: Creating %wZ port and associated threads\n", &CsrApiPortName); + DPRINT1("CSRSS: sizeof( CONNECTINFO ) == %ld sizeof( API_MSG ) == %ld\n", + sizeof(CSR_CONNECTION_INFO), sizeof(CSR_API_MESSAGE)); + } + + /* FIXME: Create a Security Descriptor */ + + /* Initialize the Attributes */ + InitializeObjectAttributes(&ObjectAttributes, + &CsrApiPortName, + 0, + NULL, + NULL /* FIXME: Use the Security Descriptor */); + + /* Create the Port Object */ + Status = NtCreatePort(&CsrApiPort, + &ObjectAttributes, + sizeof(CSR_CONNECTION_INFO), + sizeof(CSR_API_MESSAGE), + 16 * PAGE_SIZE); + if (NT_SUCCESS(Status)) + { + /* Create the event the Port Thread will use */ + Status = NtCreateEvent(&hRequestEvent, + EVENT_ALL_ACCESS, + NULL, + SynchronizationEvent, + FALSE); + if (NT_SUCCESS(Status)) + { + /* Create the Request Thread */ + Status = RtlCreateUserThread(NtCurrentProcess(), + NULL, + TRUE, + 0, + 0, + 0, + (PVOID)CsrApiRequestThread, + (PVOID)hRequestEvent, + &hThread, + &ClientId); + if (NT_SUCCESS(Status)) + { + /* Add this as a static thread to CSRSRV */ + CsrAddStaticServerThread(hThread, &ClientId, CsrThreadIsServerThread); + + /* Get the Thread List Pointers */ + ListHead = &CsrRootProcess->ThreadList; + NextEntry = ListHead->Flink; + + /* Start looping the list */ + while (NextEntry != ListHead) + { + /* Get the Thread */ + ServerThread = CONTAINING_RECORD(NextEntry, CSR_THREAD, Link); + + /* Start it up */ + Status = NtResumeThread(ServerThread->ThreadHandle, NULL); + + /* Is this a Server Thread? */ + if (ServerThread->Flags & CsrThreadIsServerThread) + { + /* If so, then wait for it to initialize */ + Status = NtWaitForSingleObject(hRequestEvent, FALSE, NULL); + ASSERT(NT_SUCCESS(Status)); + } + + /* Next thread */ + NextEntry = NextEntry->Flink; + } + + /* We don't need this anymore */ + NtClose(hRequestEvent); + } + } + } + + /* Return */ + return Status; +} + +/*++ + * @name CsrConnectToUser + * @implemented NT4 + * + * The CsrConnectToUser connects to the User subsystem. + * + * @param None + * + * @return A pointer to the CSR Thread + * + * @remarks None. + * + *--*/ +PCSR_THREAD +NTAPI +CsrConnectToUser(VOID) +{ +#if 0 // FIXME: This code is OK, however it is ClientThreadSetup which sucks. + NTSTATUS Status; + ANSI_STRING DllName; + UNICODE_STRING TempName; + HANDLE hUser32; + STRING StartupName; + PTEB Teb = NtCurrentTeb(); + PCSR_THREAD CsrThread; + BOOLEAN Connected; + + /* Check if we didn't already find it */ + if (!CsrClientThreadSetup) + { + /* Get the DLL Handle for user32.dll */ + RtlInitAnsiString(&DllName, "user32"); + RtlAnsiStringToUnicodeString(&TempName, &DllName, TRUE); + Status = LdrGetDllHandle(NULL, + NULL, + &TempName, + &hUser32); + RtlFreeUnicodeString(&TempName); + + /* If we got the handle, get the Client Thread Startup Entrypoint */ + if (NT_SUCCESS(Status)) + { + RtlInitAnsiString(&StartupName,"ClientThreadSetup"); + Status = LdrGetProcedureAddress(hUser32, + &StartupName, + 0, + (PVOID)&CsrClientThreadSetup); + } + } + + /* Connect to user32 */ + _SEH2_TRY + { + Connected = CsrClientThreadSetup(); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Connected = FALSE; + } _SEH2_END; + + if (!Connected) + { + DPRINT1("CSRSS: CsrConnectToUser failed\n"); + return NULL; + } + + /* Save pointer to this thread in TEB */ + CsrAcquireProcessLock(); + CsrThread = CsrLocateThreadInProcess(NULL, &Teb->ClientId); + CsrReleaseProcessLock(); + if (CsrThread) Teb->CsrClientThread = CsrThread; + + /* Return it */ + return CsrThread; + +#else + + PTEB Teb = NtCurrentTeb(); + PCSR_THREAD CsrThread; + + /* Save pointer to this thread in TEB */ + CsrAcquireProcessLock(); + CsrThread = CsrLocateThreadInProcess(NULL, &Teb->ClientId); + CsrReleaseProcessLock(); + if (CsrThread) Teb->CsrClientThread = CsrThread; + + /* Return it */ + return CsrThread; +#endif +} + +/*++ + * @name CsrQueryApiPort + * @implemented NT4 + * + * The CsrQueryApiPort routine returns a handle to the CSR API LPC port. + * + * @param None. + * + * @return A handle to the port. + * + * @remarks None. + * + *--*/ +HANDLE +NTAPI +CsrQueryApiPort(VOID) +{ + return CsrApiPort; +} + +/*++ + * @name CsrCaptureArguments + * @implemented NT5.1 + * + * The CsrCaptureArguments routine validates a CSR Capture Buffer and + * re-captures it into a server CSR Capture Buffer. + * + * @param CsrThread + * Pointer to the CSR Thread performing the validation. + * + * @param ApiMessage + * Pointer to the CSR API Message containing the Capture Buffer + * that needs to be validated. + * + * @return TRUE if validation succeeded, FALSE otherwise. + * + * @remarks None. + * + *--*/ +BOOLEAN +NTAPI +CsrCaptureArguments(IN PCSR_THREAD CsrThread, + IN PCSR_API_MESSAGE ApiMessage) +{ + PCSR_CAPTURE_BUFFER LocalCaptureBuffer = NULL, RemoteCaptureBuffer = NULL; + SIZE_T BufferDistance; + ULONG Length = 0; + ULONG PointerCount; + PULONG_PTR OffsetPointer; + ULONG_PTR CurrentOffset; + + /* Use SEH to make sure this is valid */ + _SEH2_TRY + { + /* Get the buffer we got from whoever called NTDLL */ + LocalCaptureBuffer = ApiMessage->CsrCaptureData; + Length = LocalCaptureBuffer->Size; + + /* Now check if the buffer is inside our mapped section */ + if (((ULONG_PTR)LocalCaptureBuffer < CsrThread->Process->ClientViewBase) || + (((ULONG_PTR)LocalCaptureBuffer + Length) >= CsrThread->Process->ClientViewBounds)) + { + /* Return failure */ + DPRINT1("*** CSRSS: CaptureBuffer outside of ClientView\n"); + ApiMessage->Status = STATUS_INVALID_PARAMETER; + _SEH2_YIELD(return FALSE); + } + + /* Check if the Length is valid */ + if ((FIELD_OFFSET(CSR_CAPTURE_BUFFER, PointerOffsetsArray) + + (LocalCaptureBuffer->PointerCount * sizeof(PVOID)) > Length) || + (Length > MAXWORD)) + { + /* Return failure */ + DPRINT1("*** CSRSS: CaptureBuffer %p has bad length\n", LocalCaptureBuffer); + DbgBreakPoint(); + ApiMessage->Status = STATUS_INVALID_PARAMETER; + _SEH2_YIELD(return FALSE); + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* Return failure */ + ApiMessage->Status = STATUS_INVALID_PARAMETER; + _SEH2_YIELD(return FALSE); + } _SEH2_END; + + /* We validated the incoming buffer, now allocate the remote one */ + RemoteCaptureBuffer = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, Length); + if (!RemoteCaptureBuffer) + { + /* We're out of memory */ + ApiMessage->Status = STATUS_NO_MEMORY; + return FALSE; + } + + /* Copy the client's buffer */ + RtlMoveMemory(RemoteCaptureBuffer, LocalCaptureBuffer, Length); + + /* Calculate the difference between our buffer and the client's */ + BufferDistance = (ULONG_PTR)RemoteCaptureBuffer - (ULONG_PTR)LocalCaptureBuffer; + + /* + * All the pointer offsets correspond to pointers which point + * to the remote data buffer instead of the local one. + */ + PointerCount = RemoteCaptureBuffer->PointerCount; + OffsetPointer = RemoteCaptureBuffer->PointerOffsetsArray; + while (PointerCount--) + { + CurrentOffset = *OffsetPointer; + + if (CurrentOffset != 0) + { + /* Get the pointer corresponding to the offset */ + CurrentOffset += (ULONG_PTR)ApiMessage; + + /* Validate the bounds of the current pointed pointer */ + if ((*(PULONG_PTR)CurrentOffset >= CsrThread->Process->ClientViewBase) && + (*(PULONG_PTR)CurrentOffset < CsrThread->Process->ClientViewBounds)) + { + /* Modify the pointed pointer to take into account its new position */ + *(PULONG_PTR)CurrentOffset += BufferDistance; + } + else + { + /* Invalid pointer, fail */ + DPRINT1("*** CSRSS: CaptureBuffer MessagePointer outside of ClientView\n"); + DbgBreakPoint(); + ApiMessage->Status = STATUS_INVALID_PARAMETER; + } + } + + ++OffsetPointer; + } + + /* Check if we got success */ + if (ApiMessage->Status != STATUS_SUCCESS) + { + /* Failure. Free the buffer and return */ + RtlFreeHeap(CsrHeap, 0, RemoteCaptureBuffer); + return FALSE; + } + else + { + /* Success, save the previous buffer and use the remote capture buffer */ + RemoteCaptureBuffer->PreviousCaptureBuffer = LocalCaptureBuffer; + ApiMessage->CsrCaptureData = RemoteCaptureBuffer; + } + + /* Success */ + return TRUE; +} + +/*++ + * @name CsrReleaseCapturedArguments + * @implemented NT5.1 + * + * The CsrReleaseCapturedArguments routine releases a Capture Buffer + * that was previously captured with CsrCaptureArguments. + * + * @param ApiMessage + * Pointer to the CSR API Message containing the Capture Buffer + * that needs to be released. + * + * @return None. + * + * @remarks None. + * + *--*/ +VOID +NTAPI +CsrReleaseCapturedArguments(IN PCSR_API_MESSAGE ApiMessage) +{ + PCSR_CAPTURE_BUFFER RemoteCaptureBuffer, LocalCaptureBuffer; + SIZE_T BufferDistance; + ULONG PointerCount; + PULONG_PTR OffsetPointer; + ULONG_PTR CurrentOffset; + + /* Get the remote capture buffer */ + RemoteCaptureBuffer = ApiMessage->CsrCaptureData; + + /* Do not continue if there is no captured buffer */ + if (!RemoteCaptureBuffer) return; + + /* If there is one, get the corresponding local capture buffer */ + LocalCaptureBuffer = RemoteCaptureBuffer->PreviousCaptureBuffer; + + /* Free the previous one and use again the local capture buffer */ + RemoteCaptureBuffer->PreviousCaptureBuffer = NULL; + ApiMessage->CsrCaptureData = LocalCaptureBuffer; + + /* Calculate the difference between our buffer and the client's */ + BufferDistance = (ULONG_PTR)RemoteCaptureBuffer - (ULONG_PTR)LocalCaptureBuffer; + + /* + * All the pointer offsets correspond to pointers which point + * to the local data buffer instead of the remote one (revert + * the logic of CsrCaptureArguments). + */ + PointerCount = RemoteCaptureBuffer->PointerCount; + OffsetPointer = RemoteCaptureBuffer->PointerOffsetsArray; + while (PointerCount--) + { + CurrentOffset = *OffsetPointer; + + if (CurrentOffset != 0) + { + /* Get the pointer corresponding to the offset */ + CurrentOffset += (ULONG_PTR)ApiMessage; + + /* Modify the pointed pointer to take into account its new position */ + *(PULONG_PTR)CurrentOffset -= BufferDistance; + } + + ++OffsetPointer; + } + + /* Copy the data back */ + RtlMoveMemory(LocalCaptureBuffer, RemoteCaptureBuffer, RemoteCaptureBuffer->Size); + + /* Free our allocated buffer */ + RtlFreeHeap(CsrHeap, 0, RemoteCaptureBuffer); +} + +/*++ + * @name CsrValidateMessageBuffer + * @implemented NT5.1 + * + * The CsrValidateMessageBuffer routine validates a captured message buffer + * present in the CSR Api Message + * + * @param ApiMessage + * Pointer to the CSR API Message containing the CSR Capture Buffer. + * + * @param Buffer + * Pointer to the message buffer to validate. + * + * @param ElementCount + * Number of elements contained in the message buffer. + * + * @param ElementSize + * Size of each element. + * + * @return TRUE if validation succeeded, FALSE otherwise. + * + * @remarks None. + * + *--*/ +BOOLEAN +NTAPI +CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, + IN PVOID *Buffer, + IN ULONG ElementCount, + IN ULONG ElementSize) +{ + PCSR_CAPTURE_BUFFER CaptureBuffer = ApiMessage->CsrCaptureData; + SIZE_T BufferDistance = (ULONG_PTR)Buffer - (ULONG_PTR)ApiMessage; + ULONG PointerCount; + PULONG_PTR OffsetPointer; + + /* + * Check whether we have a valid buffer pointer, elements + * of non-trivial size and that we don't overflow. + */ + if (!Buffer || ElementSize == 0 || + (ULONGLONG)ElementCount * ElementSize > (ULONGLONG)0xFFFFFFFF) + { + return FALSE; + } + + /* Check if didn't get a buffer and there aren't any arguments to check */ + // if (!*Buffer && (ElementCount * ElementSize == 0)) + if (!*Buffer && ElementCount == 0) // Here ElementSize != 0 therefore only ElementCount can be == 0 + return TRUE; + + /* Check if we have no capture buffer */ + if (!CaptureBuffer) + { + /* + * In this case, check only the Process ID + * and if there is a match, we succeed. + */ + if (NtCurrentTeb()->ClientId.UniqueProcess == + ApiMessage->Header.ClientId.UniqueProcess) + { + return TRUE; + } + } + else + { + /* Make sure that there is still space left in the buffer */ + if ((CaptureBuffer->Size - (ULONG_PTR)*Buffer + (ULONG_PTR)CaptureBuffer) >= + (ElementCount * ElementSize)) + { + /* Perform the validation test */ + PointerCount = CaptureBuffer->PointerCount; + OffsetPointer = CaptureBuffer->PointerOffsetsArray; + while (PointerCount--) + { + /* + * The pointer offset must be equal to the delta between + * the addresses of the buffer and of the API message. + */ + if (*OffsetPointer == BufferDistance) + { + return TRUE; + } + ++OffsetPointer; + } + } + } + + /* Failure */ + DPRINT1("CSRSRV: Bad message buffer %p\n", ApiMessage); + DbgBreakPoint(); + return FALSE; +} + +/*++ + * @name CsrValidateMessageString + * @implemented NT5.1 + * + * The CsrValidateMessageString validates a captured Wide-Character String + * present in a CSR API Message. + * + * @param ApiMessage + * Pointer to the CSR API Message containing the CSR Capture Buffer. + * + * @param MessageString + * Pointer to the buffer containing the string to validate. + * + * @return TRUE if validation succeeded, FALSE otherwise. + * + * @remarks None. + * + *--*/ +BOOLEAN +NTAPI +CsrValidateMessageString(IN PCSR_API_MESSAGE ApiMessage, + IN LPWSTR *MessageString) +{ + if (MessageString) + { + return CsrValidateMessageBuffer(ApiMessage, + (PVOID*)MessageString, + wcslen(*MessageString) + 1, + sizeof(WCHAR)); + } + else + { + return FALSE; + } +} + +/* EOF */ Index: subsystems/win32/csrsrv/api.c =================================================================== --- subsystems/win32/csrsrv/api.c (rvision 58607) +++ subsystems/win32/csrsrv/api.c (copie de travail) Modification de proprits sur subsystems/win32/csrsrv/api.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win32/csrsrv/api.h =================================================================== --- subsystems/win32/csrsrv/api.h (rvision 0) +++ subsystems/win32/csrsrv/api.h (copie de travail) @@ -0,0 +1,260 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: subsystems/win32/csrsrv/api.h + * PURPOSE: CSRSS Internal API + */ + +#pragma once + +#define NTOS_MODE_USER +#include +#include + +#include + + +extern RTL_CRITICAL_SECTION CsrProcessLock, CsrWaitListsLock; + +#define CsrAcquireProcessLock() \ + RtlEnterCriticalSection(&CsrProcessLock); + +#define CsrReleaseProcessLock() \ + RtlLeaveCriticalSection(&CsrProcessLock); + +#define ProcessStructureListLocked() \ + (CsrProcessLock.OwningThread == NtCurrentTeb()->ClientId.UniqueThread) + +#define CsrAcquireWaitLock() \ + RtlEnterCriticalSection(&CsrWaitListsLock); + +#define CsrReleaseWaitLock() \ + RtlLeaveCriticalSection(&CsrWaitListsLock); + +#define CsrAcquireNtSessionLock() \ + RtlEnterCriticalSection(&CsrNtSessionLock); + +#define CsrReleaseNtSessionLock() \ + RtlLeaveCriticalSection(&CsrNtSessionLock); + + +#define CSR_SERVER_DLL_MAX 4 + + +extern HANDLE hBootstrapOk; +extern HANDLE CsrApiPort; +extern HANDLE CsrSmApiPort; +extern HANDLE CsrSbApiPort; +extern LIST_ENTRY CsrThreadHashTable[256]; +extern PCSR_PROCESS CsrRootProcess; +extern UNICODE_STRING CsrDirectoryName; +extern ULONG CsrDebug; +extern ULONG CsrTotalPerProcessDataLength; +extern SYSTEM_BASIC_INFORMATION CsrNtSysInfo; +extern HANDLE CsrHeap; +extern PVOID CsrSrvSharedSectionHeap; +extern PVOID *CsrSrvSharedStaticServerData; +extern HANDLE CsrInitializationEvent; +extern PCSR_SERVER_DLL CsrLoadedServerDll[CSR_SERVER_DLL_MAX]; +extern ULONG CsrMaxApiRequestThreads; + +/****************************************************/ +extern UNICODE_STRING CsrSbApiPortName; +extern UNICODE_STRING CsrApiPortName; +extern RTL_CRITICAL_SECTION CsrProcessLock; +extern RTL_CRITICAL_SECTION CsrWaitListsLock; +extern HANDLE CsrObjectDirectory; +/****************************************************/ + + + +CSR_API(CsrSrvClientConnect); +CSR_API(CsrSrvUnusedFunction); +CSR_API(CsrSrvIdentifyAlertableThread); +CSR_API(CsrSrvSetPriorityClass); + + +NTSTATUS +NTAPI +CsrServerDllInitialization(IN PCSR_SERVER_DLL LoadedServerDll); + + +BOOLEAN +NTAPI +CsrCaptureArguments(IN PCSR_THREAD CsrThread, + IN PCSR_API_MESSAGE ApiMessage); + +VOID +NTAPI +CsrReleaseCapturedArguments(IN PCSR_API_MESSAGE ApiMessage); + +NTSTATUS +NTAPI +CsrLoadServerDll(IN PCHAR DllString, + IN PCHAR EntryPoint OPTIONAL, + IN ULONG ServerId); + + +PCSR_THREAD +NTAPI +CsrAllocateThread(IN PCSR_PROCESS CsrProcess); + +PCSR_PROCESS +NTAPI +CsrAllocateProcess(VOID); + +VOID +NTAPI +CsrDeallocateProcess(IN PCSR_PROCESS CsrProcess); + +VOID +NTAPI +CsrInsertProcess(IN PCSR_PROCESS ParentProcess OPTIONAL, + IN PCSR_PROCESS CsrProcess); + +VOID +NTAPI +CsrRemoveProcess(IN PCSR_PROCESS CsrProcess); + +NTSTATUS +NTAPI +CsrApiRequestThread(IN PVOID Parameter); + +VOID +NTAPI +CsrSbApiRequestThread(IN PVOID Parameter); + +NTSTATUS +NTAPI +CsrApiPortInitialize(VOID); + +BOOLEAN +NTAPI +ProtectHandle(IN HANDLE ObjectHandle); + +BOOLEAN +NTAPI +UnProtectHandle(IN HANDLE ObjectHandle); + +VOID +NTAPI +CsrInsertThread(IN PCSR_PROCESS Process, + IN PCSR_THREAD Thread); + +VOID +NTAPI +CsrLockedReferenceProcess(IN PCSR_PROCESS CsrProcess); + +VOID +NTAPI +CsrLockedReferenceThread(IN PCSR_THREAD CsrThread); + +NTSTATUS +NTAPI +CsrInitializeProcessStructure(VOID); + +// NTSTATUS WINAPI CsrEnumProcesses(CSRSS_ENUM_PROCESS_PROC EnumProc, +// PVOID Context); +PCSR_THREAD +NTAPI +CsrLocateThreadInProcess(IN PCSR_PROCESS CsrProcess OPTIONAL, + IN PCLIENT_ID Cid); +PCSR_THREAD +NTAPI +CsrLocateThreadByClientId(OUT PCSR_PROCESS *Process OPTIONAL, + IN PCLIENT_ID ClientId); + +NTSTATUS +NTAPI +CsrInitializeNtSessionList(VOID); + +NTSTATUS +NTAPI +CsrSrvAttachSharedSection(IN PCSR_PROCESS CsrProcess OPTIONAL, + OUT PCSR_CONNECTION_INFO ConnectInfo); + +NTSTATUS +NTAPI +CsrSrvCreateSharedSection(IN PCHAR ParameterValue); + +VOID +NTAPI +CsrLockedDereferenceProcess(PCSR_PROCESS CsrProcess); + +VOID +NTAPI +CsrLockedDereferenceThread(IN PCSR_THREAD CsrThread); + +BOOLEAN +NTAPI +CsrNotifyWaitBlock(IN PCSR_WAIT_BLOCK WaitBlock, + IN PLIST_ENTRY WaitList, + IN PVOID WaitArgument1, + IN PVOID WaitArgument2, + IN ULONG WaitFlags, + IN BOOLEAN DereferenceThread); + +VOID +NTAPI +CsrReferenceNtSession(IN PCSR_NT_SESSION Session); + +VOID +NTAPI +CsrDereferenceNtSession(IN PCSR_NT_SESSION Session, + IN NTSTATUS ExitStatus); + +/****************************************************************************** + ******************************************************************************/ + +NTSTATUS +NTAPI +CsrCreateSessionObjectDirectory(IN ULONG SessionId); + +NTSTATUS +NTAPI +CsrCreateObjectDirectory(IN PCHAR ObjectDirectory); + +NTSTATUS +NTAPI +CsrSbApiPortInitialize(VOID); + +BOOLEAN +NTAPI +CsrSbCreateSession(IN PSB_API_MSG ApiMessage); + +BOOLEAN +NTAPI +CsrSbTerminateSession(IN PSB_API_MSG ApiMessage); + +BOOLEAN +NTAPI +CsrSbForeignSessionComplete(IN PSB_API_MSG ApiMessage); + +BOOLEAN +NTAPI +CsrSbCreateProcess(IN PSB_API_MSG ApiMessage); + +NTSTATUS +NTAPI +CsrSbApiHandleConnectionRequest(IN PSB_API_MSG Message); + +NTSTATUS +NTAPI +CsrApiHandleConnectionRequest(IN PCSR_API_MESSAGE ApiMessage); + +/** this API is used with CsrPopulateDosDevices, deprecated in r55585. +NTSTATUS +NTAPI +CsrPopulateDosDevicesDirectory(IN HANDLE DosDevicesDirectory, + IN PPROCESS_DEVICEMAP_INFORMATION DeviceMap); +**/ + +NTSTATUS +NTAPI +CsrCreateLocalSystemSD(OUT PSECURITY_DESCRIPTOR *LocalSystemSd); + +NTSTATUS +NTAPI +CsrSetDirectorySecurity(IN HANDLE ObjectDirectory); + +/* EOF */ Index: subsystems/win32/csrsrv/api.h =================================================================== --- subsystems/win32/csrsrv/api.h (rvision 58607) +++ subsystems/win32/csrsrv/api.h (copie de travail) Modification de proprits sur subsystems/win32/csrsrv/api.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win32/csrsrv/CMakeLists.txt =================================================================== --- subsystems/win32/csrsrv/CMakeLists.txt (rvision 0) +++ subsystems/win32/csrsrv/CMakeLists.txt (copie de travail) @@ -0,0 +1,30 @@ + +include_directories(${REACTOS_SOURCE_DIR}/subsystems/win32/csrss/include) +include_directories(${REACTOS_SOURCE_DIR}/include/reactos/subsys) + +spec2def(csrsrv.dll csrsrv.spec ADD_IMPORTLIB) + +list(APPEND SOURCE + api.c + init.c + procsup.c + server.c + session.c + thredsup.c + wait.c + csrsrv.rc + ${CMAKE_CURRENT_BINARY_DIR}/csrsrv.def) + +add_library(csrsrv SHARED ${SOURCE}) + +target_link_libraries(csrsrv ${PSEH_LIB} smlib) + +set_module_type(csrsrv nativedll) + +add_importlibs(csrsrv ntdll smdll) + +add_pch(csrsrv srv.h) + +add_dependencies(csrsrv psdk bugcodes) +add_cd_file(TARGET csrsrv DESTINATION reactos/system32 FOR all) + Index: subsystems/win32/csrsrv/CMakeLists.txt =================================================================== --- subsystems/win32/csrsrv/CMakeLists.txt (rvision 58607) +++ subsystems/win32/csrsrv/CMakeLists.txt (copie de travail) Modification de proprits sur subsystems/win32/csrsrv/CMakeLists.txt ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win32/csrsrv/csrsrv.rc =================================================================== --- subsystems/win32/csrsrv/csrsrv.rc (rvision 0) +++ subsystems/win32/csrsrv/csrsrv.rc (copie de travail) @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "Client/Server Runtime SubSystem Server DLL" +#define REACTOS_STR_INTERNAL_NAME "csrsrv" +#define REACTOS_STR_ORIGINAL_FILENAME "csrsrv.dll" +#include Index: subsystems/win32/csrsrv/csrsrv.rc =================================================================== --- subsystems/win32/csrsrv/csrsrv.rc (rvision 58607) +++ subsystems/win32/csrsrv/csrsrv.rc (copie de travail) Modification de proprits sur subsystems/win32/csrsrv/csrsrv.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win32/csrsrv/csrsrv.spec =================================================================== --- subsystems/win32/csrsrv/csrsrv.spec (rvision 0) +++ subsystems/win32/csrsrv/csrsrv.spec (copie de travail) @@ -0,0 +1,36 @@ +@ stdcall CsrAddStaticServerThread(ptr ptr long) +@ stdcall CsrCallServerFromServer(ptr ptr) +@ stdcall CsrConnectToUser() +@ stdcall CsrCreateProcess(ptr ptr ptr ptr long ptr) +@ stdcall CsrCreateRemoteThread(ptr ptr) +@ stdcall CsrCreateThread(ptr ptr ptr long) +@ stdcall CsrCreateWait(ptr ptr ptr ptr ptr ptr) +@ stdcall CsrDebugProcess(ptr) +@ stdcall CsrDebugProcessStop(ptr) +@ stdcall CsrDereferenceProcess(ptr) +@ stdcall CsrDereferenceThread(ptr) +@ stdcall CsrDereferenceWait(ptr) +@ stdcall CsrDestroyProcess(ptr long) +@ stdcall CsrDestroyThread(ptr) +;@ stdcall CsrEnumProcesses(ptr ptr) ;;;;;;; Temporary hack used in win32csr, to be removed +@ stdcall CsrExecServerThread(ptr long) +@ stdcall CsrGetProcessLuid(ptr ptr) +@ stdcall CsrImpersonateClient(ptr) +@ stdcall CsrLockProcessByClientId(ptr ptr) +@ stdcall CsrLockThreadByClientId(ptr ptr) +@ stdcall CsrMoveSatisfiedWait(ptr ptr) +@ stdcall CsrNotifyWait(ptr long ptr ptr) +@ stdcall CsrPopulateDosDevices() +@ stdcall CsrQueryApiPort() +@ stdcall CsrReferenceThread(ptr) +@ stdcall CsrRevertToSelf() +@ stdcall CsrServerInitialization(long ptr) +@ stdcall CsrSetBackgroundPriority(ptr) +@ stdcall CsrSetCallingSpooler(long) +@ stdcall CsrSetForegroundPriority(ptr) +@ stdcall CsrShutdownProcesses(ptr long) +@ stdcall CsrUnhandledExceptionFilter(ptr) +@ stdcall CsrUnlockProcess(ptr) +@ stdcall CsrUnlockThread(ptr) +@ stdcall CsrValidateMessageBuffer(ptr ptr long long) +@ stdcall CsrValidateMessageString(ptr ptr) Index: subsystems/win32/csrsrv/csrsrv.spec =================================================================== --- subsystems/win32/csrsrv/csrsrv.spec (rvision 58607) +++ subsystems/win32/csrsrv/csrsrv.spec (copie de travail) Modification de proprits sur subsystems/win32/csrsrv/csrsrv.spec ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win32/csrsrv/init.c =================================================================== --- subsystems/win32/csrsrv/init.c (rvision 0) +++ subsystems/win32/csrsrv/init.c (copie de travail) @@ -0,0 +1,1138 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: subsystems/win32/csrsrv/init.c + * PURPOSE: CSR Server DLL Initialization + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + * ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include "srv.h" + +#define NDEBUG +#include + +/* DATA ***********************************************************************/ + +HANDLE CsrHeap = NULL; +HANDLE CsrObjectDirectory = NULL; +UNICODE_STRING CsrDirectoryName; +UNICODE_STRING CsrSbApiPortName; +HANDLE CsrSbApiPort = NULL; +PCSR_THREAD CsrSbApiRequestThreadPtr; +HANDLE CsrSmApiPort = NULL; +HANDLE hSbApiPort = NULL; +HANDLE CsrApiPort = NULL; +ULONG CsrDebug = 0; // 0xFFFFFFFF; +ULONG CsrMaxApiRequestThreads; +ULONG CsrTotalPerProcessDataLength; +ULONG SessionId; +HANDLE BNOLinksDirectory; +HANDLE SessionObjectDirectory; +HANDLE DosDevicesDirectory; +HANDLE CsrInitializationEvent; +SYSTEM_BASIC_INFORMATION CsrNtSysInfo; + + +/* PRIVATE FUNCTIONS **********************************************************/ + +/* === INIT ROUTINES === */ + +/*++ + * @name CsrSetProcessSecurity + * + * The CsrSetProcessSecurity routine protects access to the CSRSS process + * from unauthorized tampering. + * + * @param None. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrSetProcessSecurity(VOID) +{ + NTSTATUS Status; + HANDLE hToken, hProcess = NtCurrentProcess(); + ULONG Length; + PTOKEN_USER TokenInfo = NULL; + PSECURITY_DESCRIPTOR ProcSd = NULL; + PACL Dacl; + PSID UserSid; + + /* Open our token */ + Status = NtOpenProcessToken(hProcess, TOKEN_QUERY, &hToken); + if (!NT_SUCCESS(Status)) goto Quickie; + + /* Get the Token User Length */ + NtQueryInformationToken(hToken, TokenUser, NULL, 0, &Length); + + /* Allocate space for it */ + TokenInfo = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, Length); + if (!TokenInfo) + { + Status = STATUS_NO_MEMORY; + goto Quickie; + } + + /* Now query the data */ + Status = NtQueryInformationToken(hToken, TokenUser, TokenInfo, Length, &Length); + NtClose(hToken); + if (!NT_SUCCESS(Status)) goto Quickie; + + /* Now check the SID Length */ + UserSid = TokenInfo->User.Sid; + Length = RtlLengthSid(UserSid) + sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE); + + /* Allocate a buffer for the Security Descriptor, with SID and DACL */ + ProcSd = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, SECURITY_DESCRIPTOR_MIN_LENGTH + Length); + if (!ProcSd) + { + Status = STATUS_NO_MEMORY; + goto Quickie; + } + + /* Set the pointer to the DACL */ + Dacl = (PACL)((ULONG_PTR)ProcSd + SECURITY_DESCRIPTOR_MIN_LENGTH); + + /* Now create the SD itself */ + Status = RtlCreateSecurityDescriptor(ProcSd, SECURITY_DESCRIPTOR_REVISION); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: SD creation failed - status = %lx\n", Status); + goto Quickie; + } + + /* Create the DACL for it*/ + Status = RtlCreateAcl(Dacl, Length, ACL_REVISION2); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: DACL creation failed - status = %lx\n", Status); + goto Quickie; + } + + /* Create the ACE */ + Status = RtlAddAccessAllowedAce(Dacl, + ACL_REVISION, + PROCESS_VM_READ | PROCESS_VM_WRITE | + PROCESS_VM_OPERATION | PROCESS_DUP_HANDLE | + PROCESS_TERMINATE | PROCESS_SUSPEND_RESUME | + PROCESS_QUERY_INFORMATION | READ_CONTROL, + UserSid); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: ACE creation failed - status = %lx\n", Status); + goto Quickie; + } + + /* Clear the DACL in the SD */ + Status = RtlSetDaclSecurityDescriptor(ProcSd, TRUE, Dacl, FALSE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: set DACL failed - status = %lx\n", Status); + goto Quickie; + } + + /* Write the SD into the Process */ + Status = NtSetSecurityObject(hProcess, DACL_SECURITY_INFORMATION, ProcSd); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: set process DACL failed - status = %lx\n", Status); + goto Quickie; + } + + /* Free the memory and return */ +Quickie: + if (ProcSd) RtlFreeHeap(CsrHeap, 0, ProcSd); + RtlFreeHeap(CsrHeap, 0, TokenInfo); + return Status; +} + +/*++ + * @name CsrSetDirectorySecurity + * + * The CsrSetDirectorySecurity routine sets the security descriptor for the + * specified Object Directory. + * + * @param ObjectDirectory + * Handle fo the Object Directory to protect. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrSetDirectorySecurity(IN HANDLE ObjectDirectory) +{ + /* FIXME: Implement */ + return STATUS_SUCCESS; +} + +/*++ + * @name GetDosDevicesProtection + * + * The GetDosDevicesProtection creates a security descriptor for the DOS Devices + * Object Directory. + * + * @param DosDevicesSd + * Pointer to the Security Descriptor to return. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks Depending on the DOS Devices Protection Mode (set in the registry), + * regular users may or may not have full access to the directory. + * + *--*/ +NTSTATUS +NTAPI +GetDosDevicesProtection(OUT PSECURITY_DESCRIPTOR DosDevicesSd) +{ + SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY}; + SID_IDENTIFIER_AUTHORITY CreatorAuthority = {SECURITY_CREATOR_SID_AUTHORITY}; + SID_IDENTIFIER_AUTHORITY NtSidAuthority = {SECURITY_NT_AUTHORITY}; + PSID WorldSid, CreatorSid, AdminSid, SystemSid; + UCHAR KeyValueBuffer[0x40]; + PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo; + UNICODE_STRING KeyName; + ULONG ProtectionMode = 0; + OBJECT_ATTRIBUTES ObjectAttributes; + PACL Dacl; + PACCESS_ALLOWED_ACE Ace; + HANDLE hKey; + NTSTATUS Status; + ULONG ResultLength, SidLength, AclLength; + + /* Create the SD */ + Status = RtlCreateSecurityDescriptor(DosDevicesSd, SECURITY_DESCRIPTOR_REVISION); + ASSERT(NT_SUCCESS(Status)); + + /* Initialize the System SID */ + Status = RtlAllocateAndInitializeSid(&NtSidAuthority, 1, + SECURITY_LOCAL_SYSTEM_RID, + 0, 0, 0, 0, 0, 0, 0, + &SystemSid); + ASSERT(NT_SUCCESS(Status)); + + /* Initialize the World SID */ + Status = RtlAllocateAndInitializeSid(&WorldAuthority, 1, + SECURITY_WORLD_RID, + 0, 0, 0, 0, 0, 0, 0, + &WorldSid); + ASSERT(NT_SUCCESS(Status)); + + /* Initialize the Admin SID */ + Status = RtlAllocateAndInitializeSid(&NtSidAuthority, 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, + &AdminSid); + ASSERT(NT_SUCCESS(Status)); + + /* Initialize the Creator SID */ + Status = RtlAllocateAndInitializeSid(&CreatorAuthority, 1, + SECURITY_CREATOR_OWNER_RID, + 0, 0, 0, 0, 0, 0, 0, + &CreatorSid); + ASSERT(NT_SUCCESS(Status)); + + /* Open the Session Manager Key */ + RtlInitUnicodeString(&KeyName, SM_REG_KEY); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtOpenKey(&hKey, KEY_READ, &ObjectAttributes); + if (NT_SUCCESS(Status)) + { + /* Read the key value */ + RtlInitUnicodeString(&KeyName, L"ProtectionMode"); + Status = NtQueryValueKey(hKey, + &KeyName, + KeyValuePartialInformation, + KeyValueBuffer, + sizeof(KeyValueBuffer), + &ResultLength); + + /* Make sure it's what we expect it to be */ + KeyValuePartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION)KeyValueBuffer; + if ((NT_SUCCESS(Status)) && (KeyValuePartialInfo->Type == REG_DWORD) && + (*(PULONG)KeyValuePartialInfo->Data)) + { + /* Save the Protection Mode */ + ProtectionMode = *(PULONG)KeyValuePartialInfo->Data; + } + + /* Close the handle */ + NtClose(hKey); + } + + /* Check the Protection Mode */ + if (ProtectionMode & 3) + { + /* Calculate SID Lengths */ + SidLength = RtlLengthSid(CreatorSid) + RtlLengthSid(SystemSid) + + RtlLengthSid(AdminSid); + AclLength = sizeof(ACL) + 3 * sizeof(ACCESS_ALLOWED_ACE) + SidLength; + + /* Allocate memory for the DACL */ + Dacl = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, AclLength); + ASSERT(Dacl != NULL); + + /* Build the ACL and add 3 ACEs */ + Status = RtlCreateAcl(Dacl, AclLength, ACL_REVISION2); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_ALL, SystemSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_ALL, AdminSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_ALL, CreatorSid); + ASSERT(NT_SUCCESS(Status)); + + /* Edit the ACEs to make them inheritable */ + Status = RtlGetAce(Dacl, 0, (PVOID*)&Ace); + ASSERT(NT_SUCCESS(Status)); + Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; + Status = RtlGetAce(Dacl, 1, (PVOID*)&Ace); + ASSERT(NT_SUCCESS(Status)); + Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; + Status = RtlGetAce(Dacl, 2, (PVOID*)&Ace); + ASSERT(NT_SUCCESS(Status)); + Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | INHERIT_ONLY_ACE; + + /* Set this DACL with the SD */ + Status = RtlSetDaclSecurityDescriptor(DosDevicesSd, TRUE, Dacl, FALSE); + ASSERT(NT_SUCCESS(Status)); + goto Quickie; + } + else + { + /* Calculate SID Lengths */ + SidLength = RtlLengthSid(WorldSid) + RtlLengthSid(SystemSid); + AclLength = sizeof(ACL) + 3 * sizeof(ACCESS_ALLOWED_ACE) + SidLength; + + /* Allocate memory for the DACL */ + Dacl = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, AclLength); + ASSERT(Dacl != NULL); + + /* Build the ACL and add 3 ACEs */ + Status = RtlCreateAcl(Dacl, AclLength, ACL_REVISION2); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE, WorldSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_ALL, SystemSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_ALL, WorldSid); + ASSERT(NT_SUCCESS(Status)); + + /* Edit the last ACE to make it inheritable */ + Status = RtlGetAce(Dacl, 2, (PVOID*)&Ace); + ASSERT(NT_SUCCESS(Status)); + Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | INHERIT_ONLY_ACE; + + /* Set this DACL with the SD */ + Status = RtlSetDaclSecurityDescriptor(DosDevicesSd, TRUE, Dacl, FALSE); + ASSERT(NT_SUCCESS(Status)); + goto Quickie; + } + +/* FIXME: failure cases! Fail: */ + /* Free the memory */ + RtlFreeHeap(CsrHeap, 0, Dacl); + +/* FIXME: semi-failure cases! Quickie: */ +Quickie: + /* Free the SIDs */ + RtlFreeSid(SystemSid); + RtlFreeSid(WorldSid); + RtlFreeSid(AdminSid); + RtlFreeSid(CreatorSid); + + /* Return */ + return Status; +} + +/*++ + * @name FreeDosDevicesProtection + * + * The FreeDosDevicesProtection frees the security descriptor that was created + * by GetDosDevicesProtection + * + * @param DosDevicesSd + * Pointer to the security descriptor to free. + + * @return None. + * + * @remarks None. + * + *--*/ +VOID +NTAPI +FreeDosDevicesProtection(IN PSECURITY_DESCRIPTOR DosDevicesSd) +{ + PACL Dacl; + BOOLEAN Present, Default; + NTSTATUS Status; + + /* Get the DACL corresponding to this SD */ + Status = RtlGetDaclSecurityDescriptor(DosDevicesSd, &Present, &Dacl, &Default); + ASSERT(NT_SUCCESS(Status)); + ASSERT(Present); + ASSERT(Dacl != NULL); + + /* Free it */ + if ((NT_SUCCESS(Status)) && (Dacl)) RtlFreeHeap(CsrHeap, 0, Dacl); +} + +/*++ + * @name CsrCreateSessionObjectDirectory + * + * The CsrCreateSessionObjectDirectory routine creates the BaseNamedObjects, + * Session and Dos Devices directories for the specified session. + * + * @param Session + * Session ID for which to create the directories. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrCreateSessionObjectDirectory(IN ULONG Session) +{ + WCHAR SessionBuffer[512], BnoBuffer[512]; + UNICODE_STRING SessionString, BnoString; + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE BnoHandle; + SECURITY_DESCRIPTOR DosDevicesSd; + NTSTATUS Status; + + /* Generate the Session BNOLINKS Directory name */ + swprintf(SessionBuffer, L"%ws\\BNOLINKS", SESSION_ROOT); + RtlInitUnicodeString(&SessionString, SessionBuffer); + + /* Create it */ + InitializeObjectAttributes(&ObjectAttributes, + &SessionString, + OBJ_OPENIF | OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtCreateDirectoryObject(&BNOLinksDirectory, + DIRECTORY_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: NtCreateDirectoryObject failed in " + "CsrCreateSessionObjectDirectory - status = %lx\n", Status); + return Status; + } + + /* Now add the Session ID */ + swprintf(SessionBuffer, L"%ld", Session); + RtlInitUnicodeString(&SessionString, SessionBuffer); + + /* Check if this is the first Session */ + if (Session) + { + /* Not the first, so the name will be slighly more complex */ + swprintf(BnoBuffer, L"%ws\\%ld\\BaseNamedObjects", SESSION_ROOT, Session); + RtlInitUnicodeString(&BnoString, BnoBuffer); + } + else + { + /* Use the direct name */ + RtlInitUnicodeString(&BnoString, L"\\BaseNamedObjects"); + } + + /* Create the symlink */ + InitializeObjectAttributes(&ObjectAttributes, + &SessionString, + OBJ_OPENIF | OBJ_CASE_INSENSITIVE, + BNOLinksDirectory, + NULL); + Status = NtCreateSymbolicLinkObject(&BnoHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes, + &BnoString); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: NtCreateSymbolicLinkObject failed in " + "CsrCreateSessionObjectDirectory - status = %lx\n", Status); + return Status; + } + + /* Create the \DosDevices Security Descriptor */ + Status = GetDosDevicesProtection(&DosDevicesSd); + if (!NT_SUCCESS(Status)) return Status; + + /* Now create a directory for this session */ + swprintf(SessionBuffer, L"%ws\\%ld", SESSION_ROOT, Session); + RtlInitUnicodeString(&SessionString, SessionBuffer); + + /* Create the directory */ + InitializeObjectAttributes(&ObjectAttributes, + &SessionString, + OBJ_OPENIF | OBJ_CASE_INSENSITIVE, + 0, + &DosDevicesSd); + Status = NtCreateDirectoryObject(&SessionObjectDirectory, + DIRECTORY_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: NtCreateDirectoryObject failed in " + "CsrCreateSessionObjectDirectory - status = %lx\n", Status); + FreeDosDevicesProtection(&DosDevicesSd); + return Status; + } + + /* Next, create a directory for this session's DOS Devices */ + RtlInitUnicodeString(&SessionString, L"DosDevices"); + InitializeObjectAttributes(&ObjectAttributes, + &SessionString, + OBJ_CASE_INSENSITIVE, + SessionObjectDirectory, + &DosDevicesSd); + Status = NtCreateDirectoryObject(&DosDevicesDirectory, + DIRECTORY_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: NtCreateDirectoryObject failed in " + "CsrCreateSessionObjectDirectory - status = %lx\n", Status); + } + + /* Release the Security Descriptor */ + FreeDosDevicesProtection(&DosDevicesSd); + + /* Return */ + return Status; +} + +/*++ + * @name CsrParseServerCommandLine + * + * The CsrParseServerCommandLine routine parses the CSRSS command-line in the + * registry and performs operations for each entry found. + * + * @param ArgumentCount + * Number of arguments on the command line. + * + * @param Arguments + * Array of arguments. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrParseServerCommandLine(IN ULONG ArgumentCount, + IN PCHAR Arguments[]) +{ + NTSTATUS Status; + PCHAR ParameterName = NULL, ParameterValue = NULL, EntryPoint, ServerString; + ULONG i, DllIndex; + ANSI_STRING AnsiString; + OBJECT_ATTRIBUTES ObjectAttributes; + + /* Set the Defaults */ + CsrTotalPerProcessDataLength = 0; + CsrObjectDirectory = NULL; + CsrMaxApiRequestThreads = 16; + + /* Save our Session ID, and create a Directory for it */ + SessionId = NtCurrentPeb()->SessionId; + Status = CsrCreateSessionObjectDirectory(SessionId); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: CsrCreateSessionObjectDirectory failed (%lx)\n", + Status); + + /* It's not fatal if the session ID isn't zero */ + if (SessionId != 0) return Status; + ASSERT(NT_SUCCESS(Status)); + } + + /* Loop through every argument */ + for (i = 1; i < ArgumentCount; i++) + { + /* Split Name and Value */ + ParameterName = Arguments[i]; + ParameterValue = NULL; + ParameterValue = strchr(ParameterName, '='); + if (ParameterValue) *ParameterValue++ = ANSI_NULL; + DPRINT1("Name=%s, Value=%s\n", ParameterName, ParameterValue); + + /* Check for Object Directory */ + if (_stricmp(ParameterName, "ObjectDirectory") == 0) + { + /* Check if a session ID is specified */ + if (SessionId != 0) + { + DPRINT1("Sessions not yet implemented\n"); + ASSERT(SessionId); + } + + /* Initialize the directory name */ + RtlInitAnsiString(&AnsiString, ParameterValue); + Status = RtlAnsiStringToUnicodeString(&CsrDirectoryName, + &AnsiString, + TRUE); + ASSERT(NT_SUCCESS(Status) || SessionId != 0); + if (!NT_SUCCESS(Status)) return Status; + + /* Create it */ + InitializeObjectAttributes(&ObjectAttributes, + &CsrDirectoryName, + OBJ_OPENIF | OBJ_CASE_INSENSITIVE | OBJ_PERMANENT, + NULL, + NULL); + Status = NtCreateDirectoryObject(&CsrObjectDirectory, + DIRECTORY_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) return Status; + + /* Secure it */ + Status = CsrSetDirectorySecurity(CsrObjectDirectory); + if (!NT_SUCCESS(Status)) return Status; + } + else if (_stricmp(ParameterName, "SubSystemType") == 0) + { + /* Ignored */ + } + else if (_stricmp(ParameterName, "MaxRequestThreads") == 0) + { + Status = RtlCharToInteger(ParameterValue, + 0, + &CsrMaxApiRequestThreads); + } + else if (_stricmp(ParameterName, "RequestThreads") == 0) + { + /* Ignored */ + Status = STATUS_SUCCESS; + } + else if (_stricmp(ParameterName, "ProfileControl") == 0) + { + /* Ignored */ + } + else if (_stricmp(ParameterName, "SharedSection") == 0) + { + /* Create the Section */ + Status = CsrSrvCreateSharedSection(ParameterValue); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: *** Invalid syntax for %s=%s (Status == %X)\n", + ParameterName, ParameterValue, Status); + return Status; + } + + /* Load us */ + Status = CsrLoadServerDll("CSRSS" /* "CSRSRV" */, NULL, CSRSRV_SERVERDLL_INDEX); + } + else if (_stricmp(ParameterName, "ServerDll") == 0) + { + /* Loop the command line */ + EntryPoint = NULL; + Status = STATUS_INVALID_PARAMETER; + ServerString = ParameterValue; + while (*ServerString) + { + /* Check for the Entry Point */ + if ((*ServerString == ':') && (!EntryPoint)) + { + /* Found it. Add a nullchar and save it */ + *ServerString++ = ANSI_NULL; + EntryPoint = ServerString; + } + + /* Check for the Dll Index */ + if (*ServerString++ == ',') break; + } + + /* Did we find something to load? */ + if (!*ServerString) + { + DPRINT1("CSRSS: *** Invalid syntax for ServerDll=%s (Status == %X)\n", + ParameterValue, Status); + return Status; + } + + /* Convert it to a ULONG */ + Status = RtlCharToInteger(ServerString, 10, &DllIndex); + + /* Add a null char if it was valid */ + if (NT_SUCCESS(Status)) ServerString[-1] = ANSI_NULL; + + /* Load it */ + if (CsrDebug & 1) DPRINT1("CSRSS: Loading ServerDll=%s:%s\n", ParameterValue, EntryPoint); + Status = CsrLoadServerDll(ParameterValue, EntryPoint, DllIndex); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: *** Failed loading ServerDll=%s (Status == 0x%x)\n", + ParameterValue, Status); + return Status; + } + } + else if (_stricmp(ParameterName, "Windows") == 0) + { + /* Ignored */ + // Check whether we want to start in pure GUI or pure CLI. + } + else + { + /* Invalid parameter on the command line */ + Status = STATUS_INVALID_PARAMETER; + } + } + + /* Return status */ + return Status; +} + +/*++ + * @name CsrInitCsrRootProcess + * + * The CsrInitCsrRootProcess routine further initializes the CSR Root Process + * created by CsrInitializeProcessStructure, by allocating and initializing + * per-process data for each Server DLL. + * + * @param None. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrInitCsrRootProcess(VOID) +{ + PVOID ProcessData; + PCSR_SERVER_DLL ServerDll; + ULONG i = 0; + + /* All Server DLLs are now loaded, allocate a heap for the Root Process */ + ProcessData = RtlAllocateHeap(CsrHeap, + HEAP_ZERO_MEMORY, + CsrTotalPerProcessDataLength); + if (!ProcessData) + { + DPRINT1("CSRSRV:%s: RtlAllocateHeap failed (Status=%08lx)\n", + __FUNCTION__, STATUS_NO_MEMORY); + return STATUS_NO_MEMORY; + } + + /* + * Our Root Process was never officially initalized, + * so write the data for each Server DLL manually. + */ + + /* Loop every DLL */ + for (i = 0; i < CSR_SERVER_DLL_MAX; i++) + { + /* Get the current Server */ + ServerDll = CsrLoadedServerDll[i]; + + /* Is it loaded, and does it have per process data? */ + if (ServerDll && ServerDll->SizeOfProcessData) + { + /* It does, give it part of our allocated heap */ + CsrRootProcess->ServerData[i] = ProcessData; + + /* Move to the next heap position */ + ProcessData = (PVOID)((ULONG_PTR)ProcessData + + ServerDll->SizeOfProcessData); + } + else + { + /* Nothing for this Server DLL */ + CsrRootProcess->ServerData[i] = NULL; + } + } + + /* Now initialize the Root Process manually as well */ + for (i = 0; i < CSR_SERVER_DLL_MAX; i++) + { + /* Get the current Server */ + ServerDll = CsrLoadedServerDll[i]; + + /* Is it loaded, and does it a callback for new processes? */ + if (ServerDll && ServerDll->NewProcessCallback) + { + /* Call the callback */ + ServerDll->NewProcessCallback(NULL, CsrRootProcess); + } + } + + return STATUS_SUCCESS; +} + +/*++ + * @name CsrCreateLocalSystemSD + * + * The CsrCreateLocalSystemSD routine creates a Security Descriptor for + * the local account with PORT_ALL_ACCESS. + * + * @param LocalSystemSd + * Pointer to a pointer to the security descriptor to create. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrCreateLocalSystemSD(OUT PSECURITY_DESCRIPTOR *LocalSystemSd) +{ + SID_IDENTIFIER_AUTHORITY NtSidAuthority = {SECURITY_NT_AUTHORITY}; + PSID SystemSid; + ULONG Length; + PSECURITY_DESCRIPTOR SystemSd; + PACL Dacl; + NTSTATUS Status; + + /* Initialize the System SID */ + RtlAllocateAndInitializeSid(&NtSidAuthority, 1, + SECURITY_LOCAL_SYSTEM_RID, + 0, 0, 0, 0, 0, 0, 0, + &SystemSid); + + /* Get the length of the SID */ + Length = RtlLengthSid(SystemSid) + sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE); + + /* Allocate a buffer for the Security Descriptor, with SID and DACL */ + SystemSd = RtlAllocateHeap(CsrHeap, 0, SECURITY_DESCRIPTOR_MIN_LENGTH + Length); + + /* Set the pointer to the DACL */ + Dacl = (PACL)((ULONG_PTR)SystemSd + SECURITY_DESCRIPTOR_MIN_LENGTH); + + /* Now create the SD itself */ + Status = RtlCreateSecurityDescriptor(SystemSd, SECURITY_DESCRIPTOR_REVISION); + if (!NT_SUCCESS(Status)) + { + /* Fail */ + RtlFreeHeap(CsrHeap, 0, SystemSd); + return Status; + } + + /* Create the DACL for it */ + RtlCreateAcl(Dacl, Length, ACL_REVISION2); + + /* Create the ACE */ + Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, PORT_ALL_ACCESS, SystemSid); + if (!NT_SUCCESS(Status)) + { + /* Fail */ + RtlFreeHeap(CsrHeap, 0, SystemSd); + return Status; + } + + /* Clear the DACL in the SD */ + Status = RtlSetDaclSecurityDescriptor(SystemSd, TRUE, Dacl, FALSE); + if (!NT_SUCCESS(Status)) + { + /* Fail */ + RtlFreeHeap(CsrHeap, 0, SystemSd); + return Status; + } + + /* Free the SID and return*/ + RtlFreeSid(SystemSid); + *LocalSystemSd = SystemSd; + return Status; +} + +/*++ + * @name CsrSbApiPortInitialize + * + * The CsrSbApiPortInitialize routine initializes the LPC Port used for + * communications with the Session Manager (SM) and initializes the static + * thread that will handle connection requests and APIs. + * + * @param None + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrSbApiPortInitialize(VOID) +{ + ULONG Size; + PSECURITY_DESCRIPTOR PortSd; + OBJECT_ATTRIBUTES ObjectAttributes; + NTSTATUS Status; + HANDLE hRequestThread; + CLIENT_ID ClientId; + + /* Calculate how much space we'll need for the Port Name */ + Size = CsrDirectoryName.Length + sizeof(SB_PORT_NAME) + sizeof(WCHAR); + + /* Create the buffer for it */ + CsrSbApiPortName.Buffer = RtlAllocateHeap(CsrHeap, 0, Size); + if (!CsrSbApiPortName.Buffer) return STATUS_NO_MEMORY; + + /* Setup the rest of the empty string */ + CsrSbApiPortName.Length = 0; + CsrSbApiPortName.MaximumLength = (USHORT)Size; + + /* Now append the full port name */ + RtlAppendUnicodeStringToString(&CsrSbApiPortName, &CsrDirectoryName); + RtlAppendUnicodeToString(&CsrSbApiPortName, UNICODE_PATH_SEP); + RtlAppendUnicodeToString(&CsrSbApiPortName, SB_PORT_NAME); + if (CsrDebug & 2) DPRINT1("CSRSS: Creating %wZ port and associated thread\n", &CsrSbApiPortName); + + /* Create Security Descriptor for this Port */ + Status = CsrCreateLocalSystemSD(&PortSd); + if (!NT_SUCCESS(Status)) return Status; + + /* Initialize the Attributes */ + InitializeObjectAttributes(&ObjectAttributes, + &CsrSbApiPortName, + 0, + NULL, + PortSd); + + /* Create the Port Object */ + Status = NtCreatePort(&CsrSbApiPort, + &ObjectAttributes, + sizeof(SB_CONNECTION_INFO), + sizeof(SB_API_MSG), + 32 * sizeof(SB_API_MSG)); + if (PortSd) RtlFreeHeap(CsrHeap, 0, PortSd); + + if (NT_SUCCESS(Status)) + { + /* Create the Thread to handle the API Requests */ + Status = RtlCreateUserThread(NtCurrentProcess(), + NULL, + TRUE, + 0, + 0, + 0, + (PVOID)CsrSbApiRequestThread, + NULL, + &hRequestThread, + &ClientId); + if (NT_SUCCESS(Status)) + { + /* Add it as a Static Server Thread */ + CsrSbApiRequestThreadPtr = CsrAddStaticServerThread(hRequestThread, + &ClientId, + 0); + + /* Activate it */ + Status = NtResumeThread(hRequestThread, NULL); + } + } + + return Status; +} + + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/*++ + * @name CsrServerInitialization + * @implemented NT4 + * + * The CsrServerInitialization routine is the native (not Server) entrypoint + * of this Server DLL. It serves as the entrypoint for CSRSS. + * + * @param ArgumentCount + * Number of arguments on the command line. + * + * @param Arguments + * Array of arguments from the command line. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrServerInitialization(IN ULONG ArgumentCount, + IN PCHAR Arguments[]) +{ + NTSTATUS Status = STATUS_SUCCESS; + + /* Create the Init Event */ + Status = NtCreateEvent(&CsrInitializationEvent, + EVENT_ALL_ACCESS, + NULL, + SynchronizationEvent, + FALSE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: NtCreateEvent failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Cache System Basic Information so we don't always request it */ + Status = NtQuerySystemInformation(SystemBasicInformation, + &CsrNtSysInfo, + sizeof(SYSTEM_BASIC_INFORMATION), + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: NtQuerySystemInformation failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Save our Heap */ + CsrHeap = RtlGetProcessHeap(); + + /* Set our Security Descriptor to protect the process */ + Status = CsrSetProcessSecurity(); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: CsrSetProcessSecurity failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Set up Session Support */ + Status = CsrInitializeNtSessionList(); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: CsrInitializeSessions failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Set up Process Support and allocate the CSR Root Process */ + Status = CsrInitializeProcessStructure(); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: CsrInitializeProcessStructure failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Parse the command line */ + Status = CsrParseServerCommandLine(ArgumentCount, Arguments); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: CsrParseServerCommandLine failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Finish to initialize the CSR Root Process */ + Status = CsrInitCsrRootProcess(); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: CsrInitCsrRootProcess failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Now initialize our API Port */ + Status = CsrApiPortInitialize(); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: CsrApiPortInitialize failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Initialize the API Port for SM communication */ + Status = CsrSbApiPortInitialize(); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: CsrSbApiPortInitialize failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* We're all set! Connect to SM! */ + Status = SmConnectToSm(&CsrSbApiPortName, + CsrSbApiPort, + IMAGE_SUBSYSTEM_WINDOWS_GUI, + &CsrSmApiPort); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: SmConnectToSm failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Finito! Signal the event */ + Status = NtSetEvent(CsrInitializationEvent, NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: NtSetEvent failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Close the event handle now */ + NtClose(CsrInitializationEvent); + + /* Have us handle Hard Errors */ + Status = NtSetDefaultHardErrorPort(CsrApiPort); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: NtSetDefaultHardErrorPort failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Return status */ + return Status; +} + +/*++ + * @name CsrPopulateDosDevices + * @unimplemented NT5.1 + * + * The CsrPopulateDosDevices routine uses the DOS Device Map from the Kernel + * to populate the Dos Devices Object Directory for the session. + * + * @param None. + * + * @return None. + * + * @remarks None. + * + *--*/ +VOID +NTAPI +CsrPopulateDosDevices(VOID) +{ + DPRINT1("Deprecated API in r55585.\n"); + return; +} + +BOOL +NTAPI +DllMain(IN HINSTANCE hInstanceDll, + IN DWORD dwReason, + IN LPVOID lpReserved) +{ + /* We don't do much */ + UNREFERENCED_PARAMETER(hInstanceDll); + UNREFERENCED_PARAMETER(dwReason); + UNREFERENCED_PARAMETER(lpReserved); + + return TRUE; +} + +/* EOF */ Index: subsystems/win32/csrsrv/init.c =================================================================== --- subsystems/win32/csrsrv/init.c (rvision 58607) +++ subsystems/win32/csrsrv/init.c (copie de travail) Modification de proprits sur subsystems/win32/csrsrv/init.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win32/csrsrv/procsup.c =================================================================== --- subsystems/win32/csrsrv/procsup.c (rvision 0) +++ subsystems/win32/csrsrv/procsup.c (copie de travail) @@ -0,0 +1,1488 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: subsystems/win32/csrsrv/procsup.c + * PURPOSE: CSR Server DLL Process Management + * PROGRAMMERS: ReactOS Portable Systems Group + * Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + +/* GLOBALS ********************************************************************/ + +RTL_CRITICAL_SECTION CsrProcessLock; +PCSR_PROCESS CsrRootProcess = NULL; +SECURITY_QUALITY_OF_SERVICE CsrSecurityQos = +{ + sizeof(SECURITY_QUALITY_OF_SERVICE), + SecurityImpersonation, + SECURITY_STATIC_TRACKING, + FALSE +}; +ULONG CsrProcessSequenceCount = 5; +extern ULONG CsrTotalPerProcessDataLength; + + +/* PRIVATE FUNCTIONS **********************************************************/ + +/*++ + * @name CsrSetToNormalPriority + * + * The CsrSetToNormalPriority routine sets the current NT Process' + * priority to the normal priority for CSR Processes. + * + * @param None. + * + * @return None. + * + * @remarks The "Normal" Priority corresponds to the Normal Foreground + * Priority (9) plus a boost of 4. + * + *--*/ +VOID +NTAPI +CsrSetToNormalPriority(VOID) +{ + KPRIORITY BasePriority = (8 + 1) + 4; + + /* Set the Priority */ + NtSetInformationProcess(NtCurrentProcess(), + ProcessBasePriority, + &BasePriority, + sizeof(KPRIORITY)); +} + +/*++ + * @name CsrSetToShutdownPriority + * + * The CsrSetToShutdownPriority routine sets the current NT Process' + * priority to the boosted priority for CSR Processes doing shutdown. + * Additonally, it acquires the Shutdown Privilege required for shutdown. + * + * @param None. + * + * @return None. + * + * @remarks The "Shutdown" Priority corresponds to the Normal Foreground + * Priority (9) plus a boost of 6. + * + *--*/ +VOID +NTAPI +CsrSetToShutdownPriority(VOID) +{ + KPRIORITY SetBasePriority = (8 + 1) + 6; + BOOLEAN Old; + + /* Get the shutdown privilege */ + if (NT_SUCCESS(RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE, + TRUE, + FALSE, + &Old))) + { + /* Set the Priority */ + NtSetInformationProcess(NtCurrentProcess(), + ProcessBasePriority, + &SetBasePriority, + sizeof(KPRIORITY)); + } +} + +/*++ + * @name FindProcessForShutdown + * + * The FindProcessForShutdown routine returns a CSR Process which is ready + * to be shutdown, and sets the appropriate shutdown flags for it. + * + * @param CallerLuid + * Pointer to the LUID of the CSR Process calling this routine. + * + * @return Pointer to a CSR Process which is ready to be shutdown. + * + * @remarks None. + * + *--*/ +PCSR_PROCESS +NTAPI +FindProcessForShutdown(IN PLUID CallerLuid) +{ + PCSR_PROCESS CsrProcess, ReturnCsrProcess = NULL; + // PCSR_THREAD CsrThread; + NTSTATUS Status; + ULONG Level = 0; + LUID ProcessLuid; + LUID SystemLuid = SYSTEM_LUID; + // BOOLEAN IsSystemLuid = FALSE, IsOurLuid = FALSE; + PLIST_ENTRY NextEntry; + + /* Set the List Pointers */ + NextEntry = CsrRootProcess->ListLink.Flink; + while (NextEntry != &CsrRootProcess->ListLink) + { + /* Get the process */ + CsrProcess = CONTAINING_RECORD(NextEntry, CSR_PROCESS, ListLink); + + /* Move to the next entry */ + NextEntry = NextEntry->Flink; + + /* Skip this process if it's already been processed */ + if (CsrProcess->Flags & CsrProcessSkipShutdown) continue; + + /* Get the LUID of this Process */ + Status = CsrGetProcessLuid(CsrProcess->ProcessHandle, &ProcessLuid); + + /* Check if we didn't get access to the LUID */ + if (Status == STATUS_ACCESS_DENIED) + { + /* FIXME: Check if we have any threads */ +/* + /\* Check if we have any threads *\/ + if (CsrProcess->ThreadCount) + { + /\* Impersonate one of the threads and retry *\/ + CsrThread = CONTAINING_RECORD(CsrProcess->ThreadList.Flink, + CSR_THREAD, + Link); + CsrImpersonateClient(CsrThread); + Status = CsrGetProcessLuid(NULL, &ProcessLuid); + CsrRevertToSelf(); + } +*/ + } + + if (!NT_SUCCESS(Status)) + { + /* We didn't have access, so skip it */ + CsrProcess->Flags |= CsrProcessSkipShutdown; + continue; + } + + /* Check if this is the System LUID */ + if ((/*IsSystemLuid =*/ RtlEqualLuid(&ProcessLuid, &SystemLuid))) + { + /* Mark this process */ + CsrProcess->ShutdownFlags |= CsrShutdownSystem; + } + else if (!(/*IsOurLuid =*/ RtlEqualLuid(&ProcessLuid, CallerLuid))) + { + /* Our LUID doesn't match with the caller's */ + CsrProcess->ShutdownFlags |= CsrShutdownOther; + } + + /* Check if we're past the previous level */ + // FIXME: if ((CsrProcess->ShutdownLevel > Level) || !(ReturnCsrProcess)) + if (CsrProcess->ShutdownLevel > Level /* || !ReturnCsrProcess */) + { + /* Update the level */ + Level = CsrProcess->ShutdownLevel; + + /* Set the final process */ + ReturnCsrProcess = CsrProcess; + } + } + + /* Check if we found a process */ + if (ReturnCsrProcess) + { + /* Skip this one next time */ + ReturnCsrProcess->Flags |= CsrProcessSkipShutdown; + } + + return ReturnCsrProcess; +} + +/*++ + * @name CsrProcessRefcountZero + * + * The CsrProcessRefcountZero routine is executed when a CSR Process has lost + * all its active references. It removes and de-allocates the CSR Process. + * + * @param CsrProcess + * Pointer to the CSR Process that is to be deleted. + * + * @return None. + * + * @remarks Do not call this routine. It is reserved for the internal + * thread management routines when a CSR Process has lost all + * its references. + * + * This routine is called with the Process Lock held. + * + *--*/ +VOID +NTAPI +CsrProcessRefcountZero(IN PCSR_PROCESS CsrProcess) +{ + ASSERT(ProcessStructureListLocked()); + + /* Remove the Process from the list */ + CsrRemoveProcess(CsrProcess); + + /* Check if there's a session */ + if (CsrProcess->NtSession) + { + /* Dereference the Session */ + CsrDereferenceNtSession(CsrProcess->NtSession, 0); + } + + /* Close the Client Port if there is one */ + if (CsrProcess->ClientPort) NtClose(CsrProcess->ClientPort); + + /* Close the process handle */ + NtClose(CsrProcess->ProcessHandle); + + /* Free the Proces Object */ + CsrDeallocateProcess(CsrProcess); +} + +/*++ + * @name CsrLockedDereferenceProcess + * + * The CsrLockedDereferenceProcess dereferences a CSR Process while the + * Process Lock is already being held. + * + * @param CsrProcess + * Pointer to the CSR Process to be dereferenced. + * + * @return None. + * + * @remarks This routine will return with the Process Lock held. + * + *--*/ +VOID +NTAPI +CsrLockedDereferenceProcess(PCSR_PROCESS CsrProcess) +{ + LONG LockCount; + + /* Decrease reference count */ + LockCount = --CsrProcess->ReferenceCount; + ASSERT(LockCount >= 0); + if (LockCount == 0) + { + /* Call the generic cleanup code */ + DPRINT1("Should kill process: %p\n", CsrProcess); + CsrAcquireProcessLock(); + CsrProcessRefcountZero(CsrProcess); + } +} + +/*++ + * @name CsrAllocateProcess + * @implemented NT4 + * + * The CsrAllocateProcess routine allocates a new CSR Process object. + * + * @return Pointer to the newly allocated CSR Process. + * + * @remarks None. + * + *--*/ +PCSR_PROCESS +NTAPI +CsrAllocateProcess(VOID) +{ + PCSR_PROCESS CsrProcess; + ULONG TotalSize; + + /* Calculate the amount of memory this should take */ + TotalSize = sizeof(CSR_PROCESS) + + (CSR_SERVER_DLL_MAX * sizeof(PVOID)) + + CsrTotalPerProcessDataLength; + + /* Allocate a Process */ + CsrProcess = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, TotalSize); + if (!CsrProcess) return NULL; + + /* Handle the Sequence Number and protect against overflow */ + CsrProcess->SequenceNumber = CsrProcessSequenceCount++; + if (CsrProcessSequenceCount < 5) CsrProcessSequenceCount = 5; + + /* Increase the reference count */ + CsrLockedReferenceProcess(CsrProcess); + + /* Initialize the Thread List */ + InitializeListHead(&CsrProcess->ThreadList); + + /* Return the Process */ + return CsrProcess; +} + +/*++ + * @name CsrLockedReferenceProcess + * + * The CsrLockedReferenceProcess references a CSR Process while the + * Process Lock is already being held. + * + * @param CsrProcess + * Pointer to the CSR Process to be referenced. + * + * @return None. + * + * @remarks This routine will return with the Process Lock held. + * + *--*/ +VOID +NTAPI +CsrLockedReferenceProcess(IN PCSR_PROCESS CsrProcess) +{ + /* Increment the reference count */ + ++CsrProcess->ReferenceCount; +} + +/*++ + * @name CsrInitializeProcessStructure + * @implemented NT4 + * + * The CsrInitializeProcessStructure routine sets up support for CSR Processes + * and CSR Threads by initializing our own CSR Root Process. + * + * @param None. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrInitializeProcessStructure(VOID) +{ + NTSTATUS Status; + ULONG i; + + /* Initialize the Lock */ + Status = RtlInitializeCriticalSection(&CsrProcessLock); + if (!NT_SUCCESS(Status)) return Status; + + /* Set up the Root Process */ + CsrRootProcess = CsrAllocateProcess(); + if (!CsrRootProcess) return STATUS_NO_MEMORY; + + /* Set up the minimal information for it */ + InitializeListHead(&CsrRootProcess->ListLink); + CsrRootProcess->ProcessHandle = (HANDLE)-1; + CsrRootProcess->ClientId = NtCurrentTeb()->ClientId; + + /* Initialize the Thread Hash List */ + for (i = 0; i < 256; i++) InitializeListHead(&CsrThreadHashTable[i]); + + /* Initialize the Wait Lock */ + return RtlInitializeCriticalSection(&CsrWaitListsLock); +} + +/*++ + * @name CsrDeallocateProcess + * + * The CsrDeallocateProcess frees the memory associated with a CSR Process. + * + * @param CsrProcess + * Pointer to the CSR Process to be freed. + * + * @return None. + * + * @remarks Do not call this routine. It is reserved for the internal + * thread management routines when a CSR Process has been cleanly + * dereferenced and killed. + * + *--*/ +VOID +NTAPI +CsrDeallocateProcess(IN PCSR_PROCESS CsrProcess) +{ + /* Free the process object from the heap */ + RtlFreeHeap(CsrHeap, 0, CsrProcess); +} + +/*++ + * @name CsrRemoveProcess + * + * The CsrRemoveProcess function undoes a CsrInsertProcess operation and + * removes the CSR Process from the Process List and notifies Server DLLs + * of this removal. + * + * @param CsrProcess + * Pointer to the CSR Process to remove. + * + * @return None. + * + * @remarks None. + * + *--*/ +VOID +NTAPI +CsrRemoveProcess(IN PCSR_PROCESS CsrProcess) +{ + PCSR_SERVER_DLL ServerDll; + ULONG i; + ASSERT(ProcessStructureListLocked()); + + /* Remove us from the Process List */ + RemoveEntryList(&CsrProcess->ListLink); + + /* Release the lock */ + CsrReleaseProcessLock(); + + /* Loop every Server DLL */ + for (i = 0; i < CSR_SERVER_DLL_MAX; i++) + { + /* Get the Server DLL */ + ServerDll = CsrLoadedServerDll[i]; + + /* Check if it's valid and if it has a Disconnect Callback */ + if (ServerDll && ServerDll->DisconnectCallback) + { + /* Call it */ + ServerDll->DisconnectCallback(CsrProcess); + } + } +} + +/*++ + * @name CsrInsertProcess + * + * The CsrInsertProcess routine inserts a CSR Process into the Process List + * and notifies Server DLLs of the creation of a new CSR Process. + * + * @param ParentProcess + * Optional pointer to the Parent Process creating this CSR Process. + * + * @param CsrProcess + * Pointer to the CSR Process which is to be inserted. + * + * @return None. + * + * @remarks None. + * + *--*/ +VOID +NTAPI +CsrInsertProcess(IN PCSR_PROCESS ParentProcess OPTIONAL, + IN PCSR_PROCESS CsrProcess) +{ + PCSR_SERVER_DLL ServerDll; + ULONG i; + ASSERT(ProcessStructureListLocked()); + + /* Insert it into the Root List */ + InsertTailList(&CsrRootProcess->ListLink, &CsrProcess->ListLink); + + /* Notify the Server DLLs */ + for (i = 0; i < CSR_SERVER_DLL_MAX; i++) + { + /* Get the current Server DLL */ + ServerDll = CsrLoadedServerDll[i]; + + /* Make sure it's valid and that it has callback */ + if (ServerDll && ServerDll->NewProcessCallback) + { + ServerDll->NewProcessCallback(ParentProcess, CsrProcess); + } + } +} + + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/*++ + * @name CsrCreateProcess + * @implemented NT4 + * + * The CsrCreateProcess routine creates a CSR Process object for an NT Process. + * + * @param hProcess + * Handle to an existing NT Process to which to associate this + * CSR Process. + * + * @param hThread + * Handle to an existing NT Thread to which to create its + * corresponding CSR Thread for this CSR Process. + * + * @param ClientId + * Pointer to the Client ID structure of the NT Process to associate + * with this CSR Process. + * + * @param NtSession + * @param Flags + * @param DebugCid + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrCreateProcess(IN HANDLE hProcess, + IN HANDLE hThread, + IN PCLIENT_ID ClientId, + IN PCSR_NT_SESSION NtSession, + IN ULONG Flags, + IN PCLIENT_ID DebugCid) +{ + PCSR_THREAD CurrentThread = CsrGetClientThread(); + CLIENT_ID CurrentCid; + PCSR_PROCESS CurrentProcess; + PCSR_SERVER_DLL ServerDll; + PVOID ProcessData; + ULONG i; + PCSR_PROCESS CsrProcess; + NTSTATUS Status; + PCSR_THREAD CsrThread; + KERNEL_USER_TIMES KernelTimes; + + /* Get the current CID and lock Processes */ + CurrentCid = CurrentThread->ClientId; + CsrAcquireProcessLock(); + + /* Get the current CSR Thread */ + CurrentThread = CsrLocateThreadByClientId(&CurrentProcess, &CurrentCid); + if (!CurrentThread) + { + /* We've failed to locate the thread */ + CsrReleaseProcessLock(); + return STATUS_THREAD_IS_TERMINATING; + } + + /* Allocate a new Process Object */ + CsrProcess = CsrAllocateProcess(); + if (!CsrProcess) + { + /* Couldn't allocate Process */ + CsrReleaseProcessLock(); + return STATUS_NO_MEMORY; + } + + /* Inherit the Process Data */ + CurrentProcess = CurrentThread->Process; + ProcessData = &CsrProcess->ServerData[CSR_SERVER_DLL_MAX]; + for (i = 0; i < CSR_SERVER_DLL_MAX; i++) + { + /* Get the current Server */ + ServerDll = CsrLoadedServerDll[i]; + + /* Check if the DLL is Loaded and has Per Process Data */ + if (ServerDll && ServerDll->SizeOfProcessData) + { + /* Set the pointer */ + CsrProcess->ServerData[i] = ProcessData; + + /* Copy the Data */ + RtlMoveMemory(ProcessData, + CurrentProcess->ServerData[i], + ServerDll->SizeOfProcessData); + + /* Update next data pointer */ + ProcessData = (PVOID)((ULONG_PTR)ProcessData + + ServerDll->SizeOfProcessData); + } + else + { + /* No data for this Server */ + CsrProcess->ServerData[i] = NULL; + } + } + + /* Set the Exception port for us */ + Status = NtSetInformationProcess(hProcess, + ProcessExceptionPort, + &CsrApiPort, + sizeof(HANDLE)); + if (!NT_SUCCESS(Status)) + { + /* Failed */ + CsrDeallocateProcess(CsrProcess); + CsrReleaseProcessLock(); + return STATUS_NO_MEMORY; + } + + /* Check if CreateProcess got CREATE_NEW_PROCESS_GROUP */ + if ((Flags & CsrProcessCreateNewGroup) == 0) + { + /* Create new data */ + CsrProcess->ProcessGroupId = HandleToUlong(ClientId->UniqueProcess); + CsrProcess->ProcessGroupSequence = CsrProcess->SequenceNumber; + } + else + { + /* Copy it from the current process */ + CsrProcess->ProcessGroupId = CurrentProcess->ProcessGroupId; + CsrProcess->ProcessGroupSequence = CurrentProcess->ProcessGroupSequence; + } + + /* Check if this is a console process */ + if (Flags & CsrProcessIsConsoleApp) CsrProcess->Flags |= CsrProcessIsConsoleApp; + + /* Mask out non-debug flags */ + Flags &= ~(CsrProcessIsConsoleApp | CsrProcessCreateNewGroup | CsrProcessPriorityFlags); + + /* Check if every process will be debugged */ + if (!(Flags) && (CurrentProcess->DebugFlags & CsrDebugProcessChildren)) + { + /* Pass it on to the current process */ + CsrProcess->DebugFlags = CsrDebugProcessChildren; + CsrProcess->DebugCid = CurrentProcess->DebugCid; + } + + /* Check if Debugging was used on this process */ + if ((Flags & (CsrDebugOnlyThisProcess | CsrDebugProcessChildren)) && (DebugCid)) + { + /* Save the debug flag used */ + CsrProcess->DebugFlags = Flags; + + /* Save the CID */ + CsrProcess->DebugCid = *DebugCid; + } + + /* Check if Debugging is enabled */ + if (CsrProcess->DebugFlags) + { + /* Set the Debug Port for us */ + Status = NtSetInformationProcess(hProcess, + ProcessDebugPort, + &CsrApiPort, + sizeof(HANDLE)); + ASSERT(NT_SUCCESS(Status)); + if (!NT_SUCCESS(Status)) + { + /* Failed */ + CsrDeallocateProcess(CsrProcess); + CsrReleaseProcessLock(); + return STATUS_NO_MEMORY; + } + } + + /* Get the Thread Create Time */ + Status = NtQueryInformationThread(hThread, + ThreadTimes, + (PVOID)&KernelTimes, + sizeof(KernelTimes), + NULL); + if (!NT_SUCCESS(Status)) + { + /* Failed */ + CsrDeallocateProcess(CsrProcess); + CsrReleaseProcessLock(); + return STATUS_NO_MEMORY; + } + + /* Allocate a CSR Thread Structure */ + CsrThread = CsrAllocateThread(CsrProcess); + if (!CsrThread) + { + /* Failed */ + CsrDeallocateProcess(CsrProcess); + CsrReleaseProcessLock(); + return STATUS_NO_MEMORY; + } + + /* Save the data we have */ + CsrThread->CreateTime = KernelTimes.CreateTime; + CsrThread->ClientId = *ClientId; + CsrThread->ThreadHandle = hThread; + ProtectHandle(hThread); + CsrThread->Flags = 0; + + /* Insert the Thread into the Process */ + CsrInsertThread(CsrProcess, CsrThread); + + /* Reference the session */ + CsrReferenceNtSession(NtSession); + CsrProcess->NtSession = NtSession; + + /* Setup Process Data */ + CsrProcess->ClientId = *ClientId; + CsrProcess->ProcessHandle = hProcess; + CsrProcess->ShutdownLevel = 0x280; + + /* Set the Priority to Background */ + CsrSetBackgroundPriority(CsrProcess); + + /* Insert the Process */ + CsrInsertProcess(CurrentProcess, CsrProcess); + + /* Release lock and return */ + CsrReleaseProcessLock(); + return Status; +} + +/*++ + * @name CsrDebugProcess + * @implemented NT4 + * + * The CsrDebugProcess routine is deprecated in NT 5.1 and higher. It is + * exported only for compatibility with older CSR Server DLLs. + * + * @param CsrProcess + * Deprecated. + * + * @return Deprecated + * + * @remarks Deprecated. + * + *--*/ +NTSTATUS +NTAPI +CsrDebugProcess(IN PCSR_PROCESS CsrProcess) +{ + /* CSR does not handle debugging anymore */ + DPRINT("CSRSRV: %s(%08lx) called\n", __FUNCTION__, CsrProcess); + return STATUS_UNSUCCESSFUL; +} + +/*++ + * @name CsrDebugProcessStop + * @implemented NT4 + * + * The CsrDebugProcessStop routine is deprecated in NT 5.1 and higher. It is + * exported only for compatibility with older CSR Server DLLs. + * + * @param CsrProcess + * Deprecated. + * + * @return Deprecated + * + * @remarks Deprecated. + * + *--*/ +NTSTATUS +NTAPI +CsrDebugProcessStop(IN PCSR_PROCESS CsrProcess) +{ + /* CSR does not handle debugging anymore */ + DPRINT("CSRSRV: %s(%08lx) called\n", __FUNCTION__, CsrProcess); + return STATUS_UNSUCCESSFUL; +} + +/*++ + * @name CsrDereferenceProcess + * @implemented NT4 + * + * The CsrDereferenceProcess routine removes a reference from a CSR Process. + * + * @param CsrThread + * Pointer to the CSR Process to dereference. + * + * @return None. + * + * @remarks If the reference count has reached zero (ie: the CSR Process has + * no more active references), it will be deleted. + * + *--*/ +VOID +NTAPI +CsrDereferenceProcess(IN PCSR_PROCESS CsrProcess) +{ + LONG LockCount; + + /* Acquire process lock */ + CsrAcquireProcessLock(); + + /* Decrease reference count */ + LockCount = --CsrProcess->ReferenceCount; + ASSERT(LockCount >= 0); + if (LockCount == 0) + { + /* Call the generic cleanup code */ + CsrProcessRefcountZero(CsrProcess); + } + else + { + /* Just release the lock */ + CsrReleaseProcessLock(); + } +} + +/*++ + * @name CsrDestroyProcess + * @implemented NT4 + * + * The CsrDestroyProcess routine destroys the CSR Process corresponding to + * a given Client ID. + * + * @param Cid + * Pointer to the Client ID Structure corresponding to the CSR + * Process which is about to be destroyed. + * + * @param ExitStatus + * Unused. + * + * @return STATUS_SUCCESS in case of success, STATUS_THREAD_IS_TERMINATING + * if the CSR Process is already terminating. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrDestroyProcess(IN PCLIENT_ID Cid, + IN NTSTATUS ExitStatus) +{ + PCSR_THREAD CsrThread; + PCSR_PROCESS CsrProcess; + CLIENT_ID ClientId = *Cid; + PLIST_ENTRY NextEntry; + + /* Acquire lock */ + CsrAcquireProcessLock(); + + /* Find the thread */ + CsrThread = CsrLocateThreadByClientId(&CsrProcess, &ClientId); + + /* Make sure we got one back, and that it's not already gone */ + if (!(CsrThread) || (CsrProcess->Flags & CsrProcessTerminating)) + { + /* Release the lock and return failure */ + CsrReleaseProcessLock(); + return STATUS_THREAD_IS_TERMINATING; + } + + /* Set the terminated flag */ + CsrProcess->Flags |= CsrProcessTerminating; + + /* Get the List Pointers */ + NextEntry = CsrProcess->ThreadList.Flink; + while (NextEntry != &CsrProcess->ThreadList) + { + /* Get the current thread entry */ + CsrThread = CONTAINING_RECORD(NextEntry, CSR_THREAD, Link); + + /* Move to the next entry */ + NextEntry = NextEntry->Flink; + + /* Make sure the thread isn't already dead */ + if (CsrThread->Flags & CsrThreadTerminated) + { + /* Go the the next thread */ + continue; + } + + /* Set the Terminated flag */ + CsrThread->Flags |= CsrThreadTerminated; + + /* Acquire the Wait Lock */ + CsrAcquireWaitLock(); + + /* Do we have an active wait block? */ + if (CsrThread->WaitBlock) + { + /* Notify waiters of termination */ + CsrNotifyWaitBlock(CsrThread->WaitBlock, + NULL, + NULL, + NULL, + CsrProcessTerminating, + TRUE); + } + + /* Release the Wait Lock */ + CsrReleaseWaitLock(); + + /* Dereference the thread */ + CsrLockedDereferenceThread(CsrThread); + } + + /* Release the Process Lock and return success */ + CsrReleaseProcessLock(); + return STATUS_SUCCESS; +} + +/*++ + * @name CsrGetProcessLuid + * @implemented NT4 + * + * The CsrGetProcessLuid routine gets the LUID of the given process. + * + * @param hProcess + * Optional handle to the process whose LUID should be returned. + * + * @param Luid + * Pointer to a LUID Pointer which will receive the CSR Process' LUID. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks If hProcess is not supplied, then the current thread's token will + * be used. If that too is missing, then the current process' token + * will be used. + * + *--*/ +NTSTATUS +NTAPI +CsrGetProcessLuid(IN HANDLE hProcess OPTIONAL, + OUT PLUID Luid) +{ + HANDLE hToken = NULL; + NTSTATUS Status; + ULONG Length; + PTOKEN_STATISTICS TokenStats; + + /* Check if we have a handle to a CSR Process */ + if (!hProcess) + { + /* We don't, so try opening the Thread's Token */ + Status = NtOpenThreadToken(NtCurrentThread(), + TOKEN_QUERY, + FALSE, + &hToken); + + /* Check for success */ + if (!NT_SUCCESS(Status)) + { + /* If we got some other failure, then return and quit */ + if (Status != STATUS_NO_TOKEN) return Status; + + /* We don't have a Thread Token, use a Process Token */ + hProcess = NtCurrentProcess(); + hToken = NULL; + } + } + + /* Check if we have a token by now */ + if (!hToken) + { + /* No token yet, so open the Process Token */ + Status = NtOpenProcessToken(hProcess, + TOKEN_QUERY, + &hToken); + if (!NT_SUCCESS(Status)) + { + /* Still no token, return the error */ + return Status; + } + } + + /* Now get the size we'll need for the Token Information */ + Status = NtQueryInformationToken(hToken, + TokenStatistics, + NULL, + 0, + &Length); + + /* Allocate memory for the Token Info */ + if (!(TokenStats = RtlAllocateHeap(CsrHeap, 0, Length))) + { + /* Fail and close the token */ + NtClose(hToken); + return STATUS_NO_MEMORY; + } + + /* Now query the information */ + Status = NtQueryInformationToken(hToken, + TokenStatistics, + TokenStats, + Length, + &Length); + + /* Close the handle */ + NtClose(hToken); + + /* Check for success */ + if (NT_SUCCESS(Status)) + { + /* Return the LUID */ + *Luid = TokenStats->AuthenticationId; + } + + /* Free the query information */ + RtlFreeHeap(CsrHeap, 0, TokenStats); + + /* Return the Status */ + return Status; +} + +/*++ + * @name CsrImpersonateClient + * @implemented NT4 + * + * The CsrImpersonateClient will impersonate the given CSR Thread. + * + * @param CsrThread + * Pointer to the CSR Thread to impersonate. + * + * @return TRUE if impersonation succeeded, FALSE otherwise. + * + * @remarks Impersonation can be recursive. + * + *--*/ +BOOLEAN +NTAPI +CsrImpersonateClient(IN PCSR_THREAD CsrThread) +{ + NTSTATUS Status; + PCSR_THREAD CurrentThread = CsrGetClientThread(); + + /* Use the current thread if none given */ + if (!CsrThread) CsrThread = CurrentThread; + + /* Still no thread, something is wrong */ + if (!CsrThread) + { + /* Failure */ + return FALSE; + } + + /* Make the call */ + Status = NtImpersonateThread(NtCurrentThread(), + CsrThread->ThreadHandle, + &CsrSecurityQos); + + if (!NT_SUCCESS(Status)) + { + /* Failure */ + DPRINT1("CSRSS: Can't impersonate client thread - Status = %lx\n", Status); + // if (Status != STATUS_BAD_IMPERSONATION_LEVEL) DbgBreakPoint(); + return FALSE; + } + + /* Increase the impersonation count for the current thread */ + if (CurrentThread) ++CurrentThread->ImpersonationCount; + + /* Return Success */ + return TRUE; +} + +/*++ + * @name CsrLockProcessByClientId + * @implemented NT4 + * + * The CsrLockProcessByClientId routine locks the CSR Process corresponding + * to the given Process ID and optionally returns it. + * + * @param Pid + * Process ID corresponding to the CSR Process which will be locked. + * + * @param CsrProcess + * Optional pointer to a CSR Process pointer which will hold the + * CSR Process corresponding to the given Process ID. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks Locking a CSR Process is defined as acquiring an extra + * reference to it and returning with the Process Lock held. + * + *--*/ +NTSTATUS +NTAPI +CsrLockProcessByClientId(IN HANDLE Pid, + OUT PCSR_PROCESS *CsrProcess) +{ + PLIST_ENTRY NextEntry; + PCSR_PROCESS CurrentProcess = NULL; + NTSTATUS Status = STATUS_UNSUCCESSFUL; + + /* Acquire the lock */ + CsrAcquireProcessLock(); + + /* Assume failure */ + ASSERT(CsrProcess != NULL); + *CsrProcess = NULL; + + /* Setup the List Pointers */ + NextEntry = &CsrRootProcess->ListLink; + do + { + /* Get the Process */ + CurrentProcess = CONTAINING_RECORD(NextEntry, CSR_PROCESS, ListLink); + + /* Check for PID Match */ + if (CurrentProcess->ClientId.UniqueProcess == Pid) + { + Status = STATUS_SUCCESS; + break; + } + + /* Move to the next entry */ + NextEntry = NextEntry->Flink; + } while (NextEntry != &CsrRootProcess->ListLink); + + /* Check if we didn't find it in the list */ + if (!NT_SUCCESS(Status)) + { + /* Nothing found, release the lock */ + CsrReleaseProcessLock(); + } + else + { + /* Lock the found process and return it */ + CsrLockedReferenceProcess(CurrentProcess); + *CsrProcess = CurrentProcess; + } + + /* Return the result */ + return Status; +} + +/*++ + * @name CsrRevertToSelf + * @implemented NT4 + * + * The CsrRevertToSelf routine will attempt to remove an active impersonation. + * + * @param None. + * + * @return TRUE if the reversion was succesful, FALSE otherwise. + * + * @remarks Impersonation can be recursive; as such, the impersonation token + * will only be deleted once the CSR Thread's impersonaton count + * has reached zero. + * + *--*/ +BOOLEAN +NTAPI +CsrRevertToSelf(VOID) +{ + NTSTATUS Status; + PCSR_THREAD CurrentThread = CsrGetClientThread(); + HANDLE ImpersonationToken = NULL; + + /* Check if we have a Current Thread */ + if (CurrentThread) + { + /* Make sure impersonation is on */ + if (!CurrentThread->ImpersonationCount) + { + DPRINT1("CSRSS: CsrRevertToSelf called while not impersonating\n"); + // DbgBreakPoint(); + return FALSE; + } + else if ((--CurrentThread->ImpersonationCount) > 0) + { + /* Success; impersonation count decreased but still not zero */ + return TRUE; + } + } + + /* Impersonation has been totally removed, revert to ourselves */ + Status = NtSetInformationThread(NtCurrentThread(), + ThreadImpersonationToken, + &ImpersonationToken, + sizeof(HANDLE)); + + /* Return TRUE or FALSE */ + return NT_SUCCESS(Status); +} + +/*++ + * @name CsrSetBackgroundPriority + * @implemented NT4 + * + * The CsrSetBackgroundPriority routine sets the priority for the given CSR + * Process as a Background priority. + * + * @param CsrProcess + * Pointer to the CSR Process whose priority will be modified. + * + * @return None. + * + * @remarks None. + * + *--*/ +VOID +NTAPI +CsrSetBackgroundPriority(IN PCSR_PROCESS CsrProcess) +{ + PROCESS_PRIORITY_CLASS PriorityClass; + + /* Set the Foreground bit off */ + PriorityClass.Foreground = FALSE; + + /* Set the new Priority */ + NtSetInformationProcess(CsrProcess->ProcessHandle, + ProcessPriorityClass, + &PriorityClass, + sizeof(PriorityClass)); +} + +/*++ + * @name CsrSetForegroundPriority + * @implemented NT4 + * + * The CsrSetForegroundPriority routine sets the priority for the given CSR + * Process as a Foreground priority. + * + * @param CsrProcess + * Pointer to the CSR Process whose priority will be modified. + * + * @return None. + * + * @remarks None. + * + *--*/ +VOID +NTAPI +CsrSetForegroundPriority(IN PCSR_PROCESS CsrProcess) +{ + PROCESS_PRIORITY_CLASS PriorityClass; + + /* Set the Foreground bit on */ + PriorityClass.Foreground = TRUE; + + /* Set the new Priority */ + NtSetInformationProcess(CsrProcess->ProcessHandle, + ProcessPriorityClass, + &PriorityClass, + sizeof(PriorityClass)); +} + +/*++ + * @name CsrShutdownProcesses + * @implemented NT4 + * + * The CsrShutdownProcesses routine shuts down every CSR Process possible + * and calls each Server DLL's shutdown notification. + * + * @param CallerLuid + * Pointer to the LUID of the CSR Process that is ordering the + * shutdown. + * + * @param Flags + * Flags to send to the shutdown notification routine. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrShutdownProcesses(IN PLUID CallerLuid, + IN ULONG Flags) +{ + PLIST_ENTRY NextEntry; + PCSR_PROCESS CsrProcess; + NTSTATUS Status; + BOOLEAN FirstTry; + ULONG i; + PCSR_SERVER_DLL ServerDll; + ULONG Result = 0; /* Intentionally invalid enumeratee to silence compiler warning */ + + /* Acquire process lock */ + CsrAcquireProcessLock(); + + /* Add shutdown flag */ + CsrRootProcess->ShutdownFlags |= CsrShutdownSystem; + + /* Get the list pointers */ + NextEntry = CsrRootProcess->ListLink.Flink; + while (NextEntry != &CsrRootProcess->ListLink) + { + /* Get the Process */ + CsrProcess = CONTAINING_RECORD(NextEntry, CSR_PROCESS, ListLink); + + /* Move to the next entry */ + NextEntry = NextEntry->Flink; + + /* Remove the skip flag, set shutdown flags to 0 */ + CsrProcess->Flags &= ~CsrProcessSkipShutdown; + CsrProcess->ShutdownFlags = 0; + } + + /* Set shudown Priority */ + CsrSetToShutdownPriority(); + + /* Start looping */ + while (TRUE) + { + /* Find the next process to shutdown */ + CsrProcess = FindProcessForShutdown(CallerLuid); + if (!CsrProcess) break; + + /* Increase reference to process */ + CsrLockedReferenceProcess(CsrProcess); + + FirstTry = TRUE; + while (TRUE) + { + /* Loop all the servers */ + for (i = 0; i < CSR_SERVER_DLL_MAX; i++) + { + /* Get the current server */ + ServerDll = CsrLoadedServerDll[i]; + + /* Check if it's valid and if it has a Shutdown Process Callback */ + if (ServerDll && ServerDll->ShutdownProcessCallback) + { + /* Release the lock, make the callback, and acquire it back */ + CsrReleaseProcessLock(); + Result = ServerDll->ShutdownProcessCallback(CsrProcess, + Flags, + FirstTry); + CsrAcquireProcessLock(); + + /* Check the result */ + if (Result == CsrShutdownCsrProcess) + { + /* The callback unlocked the process */ + break; + } + else if (Result == CsrShutdownCancelled) + { + /* Check if this was a forced shutdown */ + if (Flags & EWX_FORCE) + { + DPRINT1("Process %x cancelled forced shutdown (Dll = %d)\n", + CsrProcess->ClientId.UniqueProcess, i); + DbgBreakPoint(); + } + + /* Shutdown was cancelled, unlock and exit */ + CsrReleaseProcessLock(); + Status = STATUS_CANCELLED; + goto Quickie; + } + } + } + + /* No matches during the first try, so loop again */ + if ((FirstTry) && (Result == CsrShutdownNonCsrProcess)) + { + FirstTry = FALSE; + continue; + } + + /* Second try, break out */ + break; + } + + /* We've reached the final loop here, so dereference */ + if (i == CSR_SERVER_DLL_MAX) CsrLockedDereferenceProcess(CsrProcess); + } + + /* Success path */ + CsrReleaseProcessLock(); + Status = STATUS_SUCCESS; + +Quickie: + /* Return to normal priority */ + CsrSetToNormalPriority(); + + return Status; +} + +/* FIXME: Temporary hack. This is really "CsrShutdownProcess", mostly. Used by winsrv */ +#if 0 +NTSTATUS +WINAPI +CsrEnumProcesses(IN CSRSS_ENUM_PROCESS_PROC EnumProc, + IN PVOID Context) +{ + PVOID* RealContext = (PVOID*)Context; + PLUID CallerLuid = RealContext[0]; + PCSR_PROCESS CsrProcess = NULL; + NTSTATUS Status = STATUS_UNSUCCESSFUL; + BOOLEAN FirstTry; + PLIST_ENTRY NextEntry; + ULONG Result = 0; + + /* Acquire process lock */ + CsrAcquireProcessLock(); + + /* Get the list pointers */ + NextEntry = CsrRootProcess->ListLink.Flink; + while (NextEntry != &CsrRootProcess->ListLink) + { + /* Get the Process */ + CsrProcess = CONTAINING_RECORD(NextEntry, CSR_PROCESS, ListLink); + + /* Move to the next entry */ + NextEntry = NextEntry->Flink; + + /* Remove the skip flag, set shutdown flags to 0 */ + CsrProcess->Flags &= ~CsrProcessSkipShutdown; + CsrProcess->ShutdownFlags = 0; + } + + /* Set shudown Priority */ + CsrSetToShutdownPriority(); + + /* Loop all processes */ + //DPRINT1("Enumerating for LUID: %lx %lx\n", CallerLuid->HighPart, CallerLuid->LowPart); + + /* Start looping */ + while (TRUE) + { + /* Find the next process to shutdown */ + FirstTry = TRUE; + if (!(CsrProcess = FindProcessForShutdown(CallerLuid))) + { + /* Done, quit */ + CsrReleaseProcessLock(); + Status = STATUS_SUCCESS; + goto Quickie; + } + +LoopAgain: + /* Release the lock, make the callback, and acquire it back */ + //DPRINT1("Found process: %lx\n", CsrProcess->ClientId.UniqueProcess); + CsrReleaseProcessLock(); + Result = (ULONG)EnumProc(CsrProcess, (PVOID)((ULONG_PTR)Context | FirstTry)); + CsrAcquireProcessLock(); + + /* Check the result */ + //DPRINT1("Result: %d\n", Result); + if (Result == CsrShutdownCsrProcess) + { + /* The callback unlocked the process */ + break; + } + else if (Result == CsrShutdownNonCsrProcess) + { + /* A non-CSR process, the callback didn't touch it */ + //continue; + } + else if (Result == CsrShutdownCancelled) + { + /* Shutdown was cancelled, unlock and exit */ + CsrReleaseProcessLock(); + Status = STATUS_CANCELLED; + goto Quickie; + } + + /* No matches during the first try, so loop again */ + if (FirstTry && Result == CsrShutdownNonCsrProcess) + { + FirstTry = FALSE; + goto LoopAgain; + } + } + +Quickie: + /* Return to normal priority */ + CsrSetToNormalPriority(); + return Status; +} +#endif + +/*++ + * @name CsrUnlockProcess + * @implemented NT4 + * + * The CsrUnlockProcess undoes a previous CsrLockProcessByClientId operation. + * + * @param CsrProcess + * Pointer to a previously locked CSR Process. + * + * @return STATUS_SUCCESS. + * + * @remarks This routine must be called with the Process Lock held. + * + *--*/ +NTSTATUS +NTAPI +CsrUnlockProcess(IN PCSR_PROCESS CsrProcess) +{ + /* Dereference the process */ + CsrLockedDereferenceProcess(CsrProcess); + + /* Release the lock and return */ + CsrReleaseProcessLock(); + return STATUS_SUCCESS; +} + +/* EOF */ Index: subsystems/win32/csrsrv/procsup.c =================================================================== --- subsystems/win32/csrsrv/procsup.c (rvision 58607) +++ subsystems/win32/csrsrv/procsup.c (copie de travail) Modification de proprits sur subsystems/win32/csrsrv/procsup.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win32/csrsrv/server.c =================================================================== --- subsystems/win32/csrsrv/server.c (rvision 0) +++ subsystems/win32/csrsrv/server.c (copie de travail) @@ -0,0 +1,661 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: subsystems/win32/csrsrv/server.c + * PURPOSE: CSR Server DLL Server Functions + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES *******************************************************************/ + +#include "srv.h" + +#define NDEBUG +#include + +/* DATA ***********************************************************************/ + +PCSR_API_ROUTINE CsrServerApiDispatchTable[CsrpMaxApiNumber] = +{ + CsrSrvClientConnect, + CsrSrvUnusedFunction, + CsrSrvUnusedFunction, + CsrSrvIdentifyAlertableThread, + CsrSrvSetPriorityClass +}; + +BOOLEAN CsrServerApiServerValidTable[CsrpMaxApiNumber] = +{ + TRUE, + FALSE, + TRUE, + TRUE, + TRUE +}; + +PCHAR CsrServerApiNameTable[CsrpMaxApiNumber] = +{ + "ClientConnect", + "ThreadConnect", + "ProfileControl", + "IdentifyAlertableThread", + "SetPriorityClass" +}; + +PCSR_SERVER_DLL CsrLoadedServerDll[CSR_SERVER_DLL_MAX]; +PVOID CsrSrvSharedSectionHeap = NULL; +PVOID CsrSrvSharedSectionBase = NULL; +PVOID *CsrSrvSharedStaticServerData = NULL; +ULONG CsrSrvSharedSectionSize = 0; +HANDLE CsrSrvSharedSection = NULL; + +/* PRIVATE FUNCTIONS **********************************************************/ + +/*++ + * @name CsrServerDllInitialization + * @implemented NT4 + * + * The CsrServerDllInitialization is the initialization routine + * for this Server DLL. + * + * @param LoadedServerDll + * Pointer to the CSR Server DLL structure representing this Server DLL. + * + * @return STATUS_SUCCESS. + * + * @remarks None. + * + *--*/ +CSR_SERVER_DLL_INIT(CsrServerDllInitialization) +{ + /* Setup the DLL Object */ + LoadedServerDll->ApiBase = 0; + LoadedServerDll->HighestApiSupported = CsrpMaxApiNumber; + LoadedServerDll->DispatchTable = CsrServerApiDispatchTable; + LoadedServerDll->ValidTable = CsrServerApiServerValidTable; + LoadedServerDll->NameTable = CsrServerApiNameTable; + LoadedServerDll->SizeOfProcessData = 0; + LoadedServerDll->ConnectCallback = NULL; + LoadedServerDll->DisconnectCallback = NULL; + + /* All done */ + return STATUS_SUCCESS; +} + +/*++ + * @name CsrLoadServerDll + * @implemented NT4 + * + * The CsrLoadServerDll routine loads a CSR Server DLL and calls its entrypoint. + * + * @param DllString + * Pointer to the CSR Server DLL to load and call. + * + * @param EntryPoint + * Pointer to the name of the server's initialization function. + * If this parameter is NULL, the default ServerDllInitialize + * will be assumed. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrLoadServerDll(IN PCHAR DllString, + IN PCHAR EntryPoint OPTIONAL, + IN ULONG ServerId) +{ + NTSTATUS Status; + ANSI_STRING DllName; + UNICODE_STRING TempString, ErrorString; + ULONG_PTR Parameters[2]; + HANDLE hServerDll = NULL; + ULONG Size; + PCSR_SERVER_DLL ServerDll; + STRING EntryPointString; + PCSR_SERVER_DLL_INIT_CALLBACK ServerDllInitProcedure; + ULONG Response; + + /* Check if it's beyond the maximum we support */ + if (ServerId >= CSR_SERVER_DLL_MAX) return STATUS_TOO_MANY_NAMES; + + /* Check if it's already been loaded */ + if (CsrLoadedServerDll[ServerId]) return STATUS_INVALID_PARAMETER; + + /* Convert the name to Unicode */ + ASSERT(DllString != NULL); + RtlInitAnsiString(&DllName, DllString); + Status = RtlAnsiStringToUnicodeString(&TempString, &DllName, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + /* If we are loading ourselves, don't actually load us */ + if (ServerId != CSRSRV_SERVERDLL_INDEX) + { + /* Load the DLL */ + Status = LdrLoadDll(NULL, 0, &TempString, &hServerDll); + if (!NT_SUCCESS(Status)) + { + /* Setup error parameters */ + Parameters[0] = (ULONG_PTR)&TempString; + Parameters[1] = (ULONG_PTR)&ErrorString; + RtlInitUnicodeString(&ErrorString, L"Default Load Path"); + + /* Send a hard error */ + NtRaiseHardError(Status, + 2, + 3, + Parameters, + OptionOk, + &Response); + } + + /* Get rid of the string */ + RtlFreeUnicodeString(&TempString); + if (!NT_SUCCESS(Status)) return Status; + } + + /* Allocate a CSR DLL Object */ + Size = sizeof(CSR_SERVER_DLL) + DllName.MaximumLength; + ServerDll = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, Size); + if (!ServerDll) + { + if (hServerDll) LdrUnloadDll(hServerDll); + return STATUS_NO_MEMORY; + } + + /* Set up the Object */ + ServerDll->Length = Size; + ServerDll->SharedSection = CsrSrvSharedSectionHeap; // Send to the server dll our shared heap pointer. + ServerDll->Event = CsrInitializationEvent; + ServerDll->Name.Length = DllName.Length; + ServerDll->Name.MaximumLength = DllName.MaximumLength; + ServerDll->Name.Buffer = (PCHAR)(ServerDll + 1); + if (DllName.Length) + { + strncpy(ServerDll->Name.Buffer, DllName.Buffer, DllName.Length); + } + ServerDll->ServerId = ServerId; + ServerDll->ServerHandle = hServerDll; + + /* Now get the entrypoint */ + if (hServerDll) + { + /* Initialize a string for the entrypoint, or use the default */ + RtlInitAnsiString(&EntryPointString, + EntryPoint ? EntryPoint : "ServerDllInitialization"); + + /* Get a pointer to it */ + Status = LdrGetProcedureAddress(hServerDll, + &EntryPointString, + 0, + (PVOID)&ServerDllInitProcedure); + } + else + { + /* No handle, so we are loading ourselves */ + ServerDllInitProcedure = CsrServerDllInitialization; + Status = STATUS_SUCCESS; + } + + /* Check if we got the pointer, and call it */ + if (NT_SUCCESS(Status)) + { + /* Get the result from the Server DLL */ + Status = ServerDllInitProcedure(ServerDll); + if (NT_SUCCESS(Status)) + { + /* + * Add this Server's Per-Process Data Size to the total that each + * process will need. + */ + CsrTotalPerProcessDataLength += ServerDll->SizeOfProcessData; + + /* Save the pointer in our list */ + CsrLoadedServerDll[ServerDll->ServerId] = ServerDll; + + /* Does it use our generic heap? */ + if (ServerDll->SharedSection != CsrSrvSharedSectionHeap) + { + /* No, save the pointer to its shared section in our list */ + CsrSrvSharedStaticServerData[ServerDll->ServerId] = ServerDll->SharedSection; + } + } + } + + if (!NT_SUCCESS(Status)) + { + /* Server Init failed, unload it */ + if (hServerDll) LdrUnloadDll(hServerDll); + + /* Delete the Object */ + RtlFreeHeap(CsrHeap, 0, ServerDll); + } + + /* Return to caller */ + return Status; +} + +/*++ + * @name CsrSrvClientConnect + * + * The CsrSrvClientConnect CSR API handles a new connection to a server DLL. + * + * @param ApiMessage + * Pointer to the CSR API Message for this request. + * + * @param ReplyCode + * Optional reply to this request. + * + * @return STATUS_SUCCESS in case of success, STATUS_INVALID_PARAMETER + * or STATUS_TOO_MANY_NAMES in case of failure. + * + * @remarks None. + * + *--*/ +CSR_API(CsrSrvClientConnect) +{ + NTSTATUS Status; + PCSR_CLIENT_CONNECT ClientConnect = &ApiMessage->Data.CsrClientConnect; + PCSR_SERVER_DLL ServerDll; + PCSR_PROCESS CurrentProcess = CsrGetClientThread()->Process; + + /* Set default reply */ + *ReplyCode = CsrReplyImmediately; + + /* Validate the ServerID */ + if (ClientConnect->ServerId >= CSR_SERVER_DLL_MAX) + { + return STATUS_TOO_MANY_NAMES; + } + else if (!CsrLoadedServerDll[ClientConnect->ServerId]) + { + return STATUS_INVALID_PARAMETER; + } + + /* Validate the Message Buffer */ + if (!(CsrValidateMessageBuffer(ApiMessage, + &ClientConnect->ConnectionInfo, + ClientConnect->ConnectionInfoSize, + sizeof(BYTE)))) + { + /* Fail due to buffer overflow or other invalid buffer */ + return STATUS_INVALID_PARAMETER; + } + + /* Load the Server DLL */ + ServerDll = CsrLoadedServerDll[ClientConnect->ServerId]; + + /* Check if it has a Connect Callback */ + if (ServerDll->ConnectCallback) + { + /* Call the callback */ + Status = ServerDll->ConnectCallback(CurrentProcess, + ClientConnect->ConnectionInfo, + &ClientConnect->ConnectionInfoSize); + } + else + { + /* Assume success */ + Status = STATUS_SUCCESS; + } + + /* Return status */ + return Status; +} + +/*++ + * @name CsrSrvCreateSharedSection + * + * The CsrSrvCreateSharedSection creates the Shared Section that all + * CSR Server DLLs and Clients can use to share data. + * + * @param ParameterValue + * Specially formatted string from our registry command-line which + * specifies various arguments for the shared section. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrSrvCreateSharedSection(IN PCHAR ParameterValue) +{ + PCHAR SizeValue = ParameterValue; + ULONG Size; + NTSTATUS Status; + LARGE_INTEGER SectionSize; + ULONG ViewSize = 0; + PPEB Peb = NtCurrentPeb(); + + /* If there's no parameter, fail */ + if (!ParameterValue) return STATUS_INVALID_PARAMETER; + + /* Find the first comma, and null terminate */ + while (*SizeValue) + { + if (*SizeValue == ',') + { + *SizeValue++ = ANSI_NULL; + break; + } + else + { + SizeValue++; + } + } + + /* Make sure it's valid */ + if (!*SizeValue) return STATUS_INVALID_PARAMETER; + + /* Convert it to an integer */ + Status = RtlCharToInteger(SizeValue, 0, &Size); + if (!NT_SUCCESS(Status)) return Status; + + /* Multiply by 1024 entries and round to page size */ + CsrSrvSharedSectionSize = ROUND_UP(Size * 1024, CsrNtSysInfo.PageSize); + + /* Create the Secion */ + SectionSize.LowPart = CsrSrvSharedSectionSize; + SectionSize.HighPart = 0; + Status = NtCreateSection(&CsrSrvSharedSection, + SECTION_ALL_ACCESS, + NULL, + &SectionSize, + PAGE_EXECUTE_READWRITE, + SEC_BASED | SEC_RESERVE, + NULL); + if (!NT_SUCCESS(Status)) return Status; + + /* Map the section */ + Status = NtMapViewOfSection(CsrSrvSharedSection, + NtCurrentProcess(), + &CsrSrvSharedSectionBase, + 0, + 0, + NULL, + &ViewSize, + ViewUnmap, + MEM_TOP_DOWN, + PAGE_EXECUTE_READWRITE); + if (!NT_SUCCESS(Status)) + { + /* Fail */ + NtClose(CsrSrvSharedSection); + return Status; + } + + /* FIXME: Write the value to registry */ + + /* The Heap is the same place as the Base */ + CsrSrvSharedSectionHeap = CsrSrvSharedSectionBase; + + /* Create the heap */ + if (!(RtlCreateHeap(HEAP_ZERO_MEMORY | HEAP_CLASS_7, + CsrSrvSharedSectionHeap, + CsrSrvSharedSectionSize, + PAGE_SIZE, + 0, + 0))) + { + /* Failure, unmap section and return */ + NtUnmapViewOfSection(NtCurrentProcess(), CsrSrvSharedSectionBase); + NtClose(CsrSrvSharedSection); + return STATUS_NO_MEMORY; + } + + /* Now allocate space from the heap for the Shared Data */ + CsrSrvSharedStaticServerData = RtlAllocateHeap(CsrSrvSharedSectionHeap, + HEAP_ZERO_MEMORY, + CSR_SERVER_DLL_MAX * sizeof(PVOID)); + if (!CsrSrvSharedStaticServerData) return STATUS_NO_MEMORY; + + /* Write the values to the PEB */ + Peb->ReadOnlySharedMemoryBase = CsrSrvSharedSectionBase; + Peb->ReadOnlySharedMemoryHeap = CsrSrvSharedSectionHeap; + Peb->ReadOnlyStaticServerData = CsrSrvSharedStaticServerData; + + /* Return */ + return STATUS_SUCCESS; +} + +/*++ + * @name CsrSrvAttachSharedSection + * + * The CsrSrvAttachSharedSection maps the CSR Shared Section into a new + * CSR Process' address space, and returns the pointers to the section + * through the Connection Info structure. + * + * @param CsrProcess + * Pointer to the CSR Process that is attempting a connection. + * + * @param ConnectInfo + * Pointer to the CSR Connection Info structure for the incoming + * connection. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrSrvAttachSharedSection(IN PCSR_PROCESS CsrProcess OPTIONAL, + OUT PCSR_CONNECTION_INFO ConnectInfo) +{ + NTSTATUS Status; + ULONG ViewSize = 0; + + /* Check if we have a process */ + if (CsrProcess) + { + /* Map the section into this process */ + Status = NtMapViewOfSection(CsrSrvSharedSection, + CsrProcess->ProcessHandle, + &CsrSrvSharedSectionBase, + 0, + 0, + NULL, + &ViewSize, + ViewUnmap, + SEC_NO_CHANGE, + PAGE_EXECUTE_READ); + if (!NT_SUCCESS(Status)) return Status; + } + + /* Write the values in the Connection Info structure */ + ConnectInfo->SharedSectionBase = CsrSrvSharedSectionBase; + ConnectInfo->SharedSectionHeap = CsrSrvSharedSectionHeap; + ConnectInfo->SharedSectionData = CsrSrvSharedStaticServerData; + + /* Return success */ + return STATUS_SUCCESS; +} + +/*++ + * @name CsrSrvIdentifyAlertableThread + * @implemented NT4 + * + * The CsrSrvIdentifyAlertableThread CSR API marks a CSR Thread as alertable. + * + * @param ApiMessage + * Pointer to the CSR API Message for this request. + * + * @param ReplyCode + * Pointer to an optional reply to this request. + * + * @return STATUS_SUCCESS. + * + * @remarks None. + * + *--*/ +CSR_API(CsrSrvIdentifyAlertableThread) +{ + PCSR_THREAD CsrThread = CsrGetClientThread(); + + /* Set the alertable flag */ + CsrThread->Flags |= CsrThreadAlertable; + + /* Return success */ + return STATUS_SUCCESS; +} + +/*++ + * @name CsrSrvSetPriorityClass + * @implemented NT4 + * + * The CsrSrvSetPriorityClass CSR API is deprecated. + * + * @param ApiMessage + * Pointer to the CSR API Message for this request. + * + * @param ReplyCode + * Pointer to an optional reply to this request. + * + * @return STATUS_SUCCESS. + * + * @remarks None. + * + *--*/ +CSR_API(CsrSrvSetPriorityClass) +{ + /* Deprecated */ + return STATUS_SUCCESS; +} + +/*++ + * @name CsrSrvUnusedFunction + * @implemented NT4 + * + * The CsrSrvUnusedFunction CSR API is a stub for deprecated APIs. + * + * The CsrSrvSetPriorityClass CSR API is deprecated. + * + * @param ApiMessage + * Pointer to the CSR API Message for this request. + * + * @param ReplyCode + * Pointer to an optional reply to this request. + * + * @return STATUS_INVALID_PARAMETER. + * + * @remarks CsrSrvSetPriorityClass does not use this stub because + * it must return success. + * + *--*/ +CSR_API(CsrSrvUnusedFunction) +{ + /* Deprecated */ + return STATUS_INVALID_PARAMETER; +} + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/*++ + * @name CsrSetCallingSpooler + * @implemented NT4 + * + * the CsrSetCallingSpooler routine is deprecated. + * + * @param Reserved + * Deprecated + * + * @return None. + * + * @remarks This routine was used in archaic versions of NT for Printer Drivers. + * + *--*/ +VOID +NTAPI +CsrSetCallingSpooler(ULONG Reserved) +{ + /* Deprecated */ + return; +} + +/*++ + * @name CsrUnhandledExceptionFilter + * @implemented NT5 + * + * The CsrUnhandledExceptionFilter routine handles all exceptions + * within SEH-protected blocks. + * + * @param ExceptionPointers + * System-defined Argument. + * + * @return EXCEPTION_EXECUTE_HANDLER. + * + * @remarks None. + * + *--*/ +EXCEPTION_DISPOSITION +NTAPI +CsrUnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo) +{ + SYSTEM_KERNEL_DEBUGGER_INFORMATION DebuggerInfo; + EXCEPTION_DISPOSITION Result = EXCEPTION_EXECUTE_HANDLER; + BOOLEAN OldValue; + NTSTATUS Status; + UNICODE_STRING ErrorSource; + ULONG_PTR ErrorParameters[4]; + ULONG Response; + + /* Check if a debugger is installed */ + Status = NtQuerySystemInformation(SystemKernelDebuggerInformation, + &DebuggerInfo, + sizeof(DebuggerInfo), + NULL); + + /* Check if this is Session 0, and the Debugger is Enabled */ + if ((NtCurrentPeb()->SessionId != 0) && (NT_SUCCESS(Status)) && + (DebuggerInfo.KernelDebuggerEnabled)) + { + /* Call the Unhandled Exception Filter */ + Result = RtlUnhandledExceptionFilter(ExceptionInfo); + if (Result != EXCEPTION_CONTINUE_EXECUTION) + { + /* We're going to raise an error. Get Shutdown Privilege first */ + Status = RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE, + TRUE, + TRUE, + &OldValue); + + /* Use the Process token if that failed */ + if (Status == STATUS_NO_TOKEN) + { + Status = RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE, + TRUE, + FALSE, + &OldValue); + } + + /* Initialize our Name String */ + RtlInitUnicodeString(&ErrorSource, L"Windows SubSystem"); + + /* Set the parameters */ + ErrorParameters[0] = (ULONG_PTR)&ErrorSource; + ErrorParameters[1] = ExceptionInfo->ExceptionRecord->ExceptionCode; + ErrorParameters[2] = (ULONG_PTR)ExceptionInfo->ExceptionRecord->ExceptionAddress; + ErrorParameters[3] = (ULONG_PTR)ExceptionInfo->ContextRecord; + + /* Bugcheck */ + Status = NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, + 4, + 1, + ErrorParameters, + OptionShutdownSystem, + &Response); + } + + /* Just terminate us */ + NtTerminateProcess(NtCurrentProcess(), + ExceptionInfo->ExceptionRecord->ExceptionCode); + } + + return Result; +} + +/* EOF */ Index: subsystems/win32/csrsrv/server.c =================================================================== --- subsystems/win32/csrsrv/server.c (rvision 58607) +++ subsystems/win32/csrsrv/server.c (copie de travail) Modification de proprits sur subsystems/win32/csrsrv/server.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win32/csrsrv/session.c =================================================================== --- subsystems/win32/csrsrv/session.c (rvision 0) +++ subsystems/win32/csrsrv/session.c (copie de travail) @@ -0,0 +1,568 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: subsystems/win32/csrsrv/session.c + * PURPOSE: CSR Server DLL Session Implementation + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES *******************************************************************/ + +#include "srv.h" + +#define NDEBUG +#include + +/* DATA ***********************************************************************/ + +RTL_CRITICAL_SECTION CsrNtSessionLock; +LIST_ENTRY CsrNtSessionList; + +PSB_API_ROUTINE CsrServerSbApiDispatch[SbpMaxApiNumber - SbpCreateSession] = +{ + CsrSbCreateSession, + CsrSbTerminateSession, + CsrSbForeignSessionComplete, + CsrSbCreateProcess +}; + +PCHAR CsrServerSbApiName[SbpMaxApiNumber - SbpCreateSession] = +{ + "SbCreateSession", + "SbTerminateSession", + "SbForeignSessionComplete", + "SbCreateProcess" +}; + +/* PRIVATE FUNCTIONS **********************************************************/ + +/*++ + * @name CsrInitializeNtSessionList + * + * The CsrInitializeNtSessionList routine sets up support for CSR Sessions. + * + * @param None + * + * @return None + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrInitializeNtSessionList(VOID) +{ + /* Initialize the Session List */ + InitializeListHead(&CsrNtSessionList); + + /* Initialize the Session Lock */ + return RtlInitializeCriticalSection(&CsrNtSessionLock); +} + +/*++ + * @name CsrAllocateNtSession + * + * The CsrAllocateNtSession routine allocates a new CSR NT Session. + * + * @param SessionId + * Session ID of the CSR NT Session to allocate. + * + * @return Pointer to the newly allocated CSR NT Session. + * + * @remarks None. + * + *--*/ +PCSR_NT_SESSION +NTAPI +CsrAllocateNtSession(IN ULONG SessionId) +{ + PCSR_NT_SESSION NtSession; + + /* Allocate an NT Session Object */ + NtSession = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, sizeof(CSR_NT_SESSION)); + if (NtSession) + { + /* Setup the Session Object */ + NtSession->SessionId = SessionId; + NtSession->ReferenceCount = 1; + + /* Insert it into the Session List */ + CsrAcquireNtSessionLock(); + InsertHeadList(&CsrNtSessionList, &NtSession->SessionLink); + CsrReleaseNtSessionLock(); + } + else + { + ASSERT(NtSession != NULL); + } + + /* Return the Session (or NULL) */ + return NtSession; +} + +/*++ + * @name CsrReferenceNtSession + * + * The CsrReferenceNtSession increases the reference count of a CSR NT Session. + * + * @param Session + * Pointer to the CSR NT Session to reference. + * + * @return None. + * + * @remarks None. + * + *--*/ +VOID +NTAPI +CsrReferenceNtSession(IN PCSR_NT_SESSION Session) +{ + /* Acquire the lock */ + CsrAcquireNtSessionLock(); + + /* Sanity checks */ + ASSERT(!IsListEmpty(&Session->SessionLink)); + ASSERT(Session->SessionId != 0); + ASSERT(Session->ReferenceCount != 0); + + /* Increase the reference count */ + Session->ReferenceCount++; + + /* Release the lock */ + CsrReleaseNtSessionLock(); +} + +/*++ + * @name CsrDereferenceNtSession + * + * The CsrDereferenceNtSession decreases the reference count of a + * CSR NT Session. + * + * @param Session + * Pointer to the CSR NT Session to reference. + * + * @param ExitStatus + * If this is the last reference to the session, this argument + * specifies the exit status. + * + * @return None. + * + * @remarks CsrDereferenceNtSession will complete the session if + * the last reference to it has been closed. + * + *--*/ +VOID +NTAPI +CsrDereferenceNtSession(IN PCSR_NT_SESSION Session, + IN NTSTATUS ExitStatus) +{ + /* Acquire the lock */ + CsrAcquireNtSessionLock(); + + /* Sanity checks */ + ASSERT(!IsListEmpty(&Session->SessionLink)); + ASSERT(Session->SessionId != 0); + ASSERT(Session->ReferenceCount != 0); + + /* Dereference the Session Object */ + if ((--Session->ReferenceCount) == 0) + { + /* Remove it from the list */ + RemoveEntryList(&Session->SessionLink); + + /* Release the lock */ + CsrReleaseNtSessionLock(); + + /* Tell SM that we're done here */ + SmSessionComplete(CsrSmApiPort, Session->SessionId, ExitStatus); + + /* Free the Session Object */ + RtlFreeHeap(CsrHeap, 0, Session); + } + else + { + /* Release the lock, the Session is still active */ + CsrReleaseNtSessionLock(); + } +} + +/* SESSION MANAGER FUNCTIONS **************************************************/ + +/*++ + * @name CsrSbCreateSession + * + * The CsrSbCreateSession API is called by the Session Manager whenever a new + * session is created. + * + * @param ApiMessage + * Pointer to the Session Manager API Message. + * + * @return TRUE in case of success, FALSE otherwise. + * + * @remarks The CsrSbCreateSession routine will initialize a new CSR NT + * Session and allocate a new CSR Process for the subsystem process. + * + *--*/ +BOOLEAN +NTAPI +CsrSbCreateSession(IN PSB_API_MSG ApiMessage) +{ + PSB_CREATE_SESSION_MSG CreateSession = &ApiMessage->CreateSession; + HANDLE hProcess, hThread; + PCSR_PROCESS CsrProcess; + PCSR_THREAD CsrThread; + PCSR_SERVER_DLL ServerDll; + PVOID ProcessData; + NTSTATUS Status; + KERNEL_USER_TIMES KernelTimes; + ULONG i; + + /* Save the Process and Thread Handles */ + hProcess = CreateSession->ProcessInfo.ProcessHandle; + hThread = CreateSession->ProcessInfo.ThreadHandle; + + /* Lock the Processes */ + CsrAcquireProcessLock(); + + /* Allocate a new process */ + CsrProcess = CsrAllocateProcess(); + if (!CsrProcess) + { + /* Fail */ + ApiMessage->ReturnValue = STATUS_NO_MEMORY; + CsrReleaseProcessLock(); + return TRUE; + } + + /* Set the exception port */ + Status = NtSetInformationProcess(hProcess, + ProcessExceptionPort, + &CsrApiPort, + sizeof(HANDLE)); + + /* Check for success */ + if (!NT_SUCCESS(Status)) + { + /* Fail the request */ + CsrDeallocateProcess(CsrProcess); + CsrReleaseProcessLock(); + + /* Strange as it seems, NTSTATUSes are actually returned */ + return (BOOLEAN)STATUS_NO_MEMORY; + } + + /* Get the Create Time */ + Status = NtQueryInformationThread(hThread, + ThreadTimes, + &KernelTimes, + sizeof(KERNEL_USER_TIMES), + NULL); + + /* Check for success */ + if (!NT_SUCCESS(Status)) + { + /* Fail the request */ + CsrDeallocateProcess(CsrProcess); + CsrReleaseProcessLock(); + + /* Strange as it seems, NTSTATUSes are actually returned */ + return (BOOLEAN)Status; + } + + /* Allocate a new Thread */ + CsrThread = CsrAllocateThread(CsrProcess); + if (!CsrThread) + { + /* Fail the request */ + CsrDeallocateProcess(CsrProcess); + CsrReleaseProcessLock(); + + ApiMessage->ReturnValue = STATUS_NO_MEMORY; + return TRUE; + } + + /* Setup the Thread Object */ + CsrThread->CreateTime = KernelTimes.CreateTime; + CsrThread->ClientId = CreateSession->ProcessInfo.ClientId; + CsrThread->ThreadHandle = hThread; + ProtectHandle(hThread); + CsrThread->Flags = 0; + + /* Insert it into the Process List */ + CsrInsertThread(CsrProcess, CsrThread); + + /* Setup Process Data */ + CsrProcess->ClientId = CreateSession->ProcessInfo.ClientId; + CsrProcess->ProcessHandle = hProcess; + CsrProcess->NtSession = CsrAllocateNtSession(CreateSession->SessionId); + + /* Set the Process Priority */ + CsrSetBackgroundPriority(CsrProcess); + + /* Get the first data location */ + ProcessData = &CsrProcess->ServerData[CSR_SERVER_DLL_MAX]; + + /* Loop every DLL */ + for (i = 0; i < CSR_SERVER_DLL_MAX; i++) + { + /* Get the current Server */ + ServerDll = CsrLoadedServerDll[i]; + + /* Check if the DLL is loaded and has Process Data */ + if (ServerDll && ServerDll->SizeOfProcessData) + { + /* Write the pointer to the data */ + CsrProcess->ServerData[i] = ProcessData; + + /* Move to the next data location */ + ProcessData = (PVOID)((ULONG_PTR)ProcessData + + ServerDll->SizeOfProcessData); + } + else + { + /* Nothing for this Process */ + CsrProcess->ServerData[i] = NULL; + } + } + + /* Insert the Process */ + CsrInsertProcess(NULL, CsrProcess); + + /* Activate the Thread */ + ApiMessage->ReturnValue = NtResumeThread(hThread, NULL); + + /* Release lock and return */ + CsrReleaseProcessLock(); + return TRUE; +} + +/*++ + * @name CsrSbForeignSessionComplete + * + * The CsrSbForeignSessionComplete API is called by the Session Manager + * whenever a foreign session is completed (ie: terminated). + * + * @param ApiMessage + * Pointer to the Session Manager API Message. + * + * @return TRUE in case of success, FALSE otherwise. + * + * @remarks The CsrSbForeignSessionComplete API is not yet implemented. + * + *--*/ +BOOLEAN +NTAPI +CsrSbForeignSessionComplete(IN PSB_API_MSG ApiMessage) +{ + /* Deprecated/Unimplemented in NT */ + ApiMessage->ReturnValue = STATUS_NOT_IMPLEMENTED; + return TRUE; +} + +/*++ + * @name CsrSbTerminateSession + * + * The CsrSbTerminateSession API is called by the Session Manager + * whenever a foreign session should be destroyed. + * + * @param ApiMessage + * Pointer to the Session Manager API Message. + * + * @return TRUE in case of success, FALSE otherwise. + * + * @remarks The CsrSbTerminateSession API is not yet implemented. + * + *--*/ +BOOLEAN +NTAPI +CsrSbTerminateSession(IN PSB_API_MSG ApiMessage) +{ + ApiMessage->ReturnValue = STATUS_NOT_IMPLEMENTED; + return TRUE; +} + +/*++ + * @name CsrSbCreateProcess + * + * The CsrSbCreateProcess API is called by the Session Manager + * whenever a foreign session is created and a new process should be started. + * + * @param ApiMessage + * Pointer to the Session Manager API Message. + * + * @return TRUE in case of success, FALSE otherwise. + * + * @remarks The CsrSbCreateProcess API is not yet implemented. + * + *--*/ +BOOLEAN +NTAPI +CsrSbCreateProcess(IN PSB_API_MSG ApiMessage) +{ + ApiMessage->ReturnValue = STATUS_NOT_IMPLEMENTED; + return TRUE; +} + +/*++ + * @name CsrSbApiHandleConnectionRequest + * + * The CsrSbApiHandleConnectionRequest routine handles and accepts a new + * connection request to the SM API LPC Port. + * + * @param ApiMessage + * Pointer to the incoming CSR API Message which contains the + * connection request. + * + * @return STATUS_SUCCESS in case of success, or status code which caused + * the routine to error. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrSbApiHandleConnectionRequest(IN PSB_API_MSG Message) +{ + NTSTATUS Status; + REMOTE_PORT_VIEW RemotePortView; + HANDLE hPort; + + /* Set the Port View Structure Length */ + RemotePortView.Length = sizeof(REMOTE_PORT_VIEW); + + /* Accept the connection */ + Status = NtAcceptConnectPort(&hPort, + NULL, + (PPORT_MESSAGE)Message, + TRUE, + NULL, + &RemotePortView); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: Sb Accept Connection failed %lx\n", Status); + return Status; + } + + /* Complete the Connection */ + Status = NtCompleteConnectPort(hPort); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: Sb Complete Connection failed %lx\n",Status); + } + + /* Return status */ + return Status; +} + +/*++ + * @name CsrSbApiRequestThread + * + * The CsrSbApiRequestThread routine handles incoming messages or connection + * requests on the SM API LPC Port. + * + * @param Parameter + * System-default user-defined parameter. Unused. + * + * @return The thread exit code, if the thread is terminated. + * + * @remarks Before listening on the port, the routine will first attempt + * to connect to the user subsystem. + * + *--*/ +VOID +NTAPI +CsrSbApiRequestThread(IN PVOID Parameter) +{ + NTSTATUS Status; + SB_API_MSG ReceiveMsg; + PSB_API_MSG ReplyMsg = NULL; + PVOID PortContext; + ULONG MessageType; + + /* Start the loop */ + while (TRUE) + { + /* Wait for a message to come in */ + Status = NtReplyWaitReceivePort(CsrSbApiPort, + &PortContext, + &ReplyMsg->h, + &ReceiveMsg.h); + + /* Check if we didn't get success */ + if (Status != STATUS_SUCCESS) + { + /* If we only got a warning, keep going */ + if (NT_SUCCESS(Status)) continue; + + /* We failed big time, so start out fresh */ + ReplyMsg = NULL; + DPRINT1("CSRSS: ReceivePort failed - Status == %X\n", Status); + continue; + } + + /* Save the message type */ + MessageType = ReceiveMsg.h.u2.s2.Type; + + /* Check if this is a connection request */ + if (MessageType == LPC_CONNECTION_REQUEST) + { + /* Handle connection request */ + CsrSbApiHandleConnectionRequest(&ReceiveMsg); + + /* Start over */ + ReplyMsg = NULL; + continue; + } + + /* Check if the port died */ + if (MessageType == LPC_PORT_CLOSED) + { + /* Close the handle if we have one */ + if (PortContext) NtClose((HANDLE)PortContext); + + /* Client died, start over */ + ReplyMsg = NULL; + continue; + } + else if (MessageType == LPC_CLIENT_DIED) + { + /* Client died, start over */ + ReplyMsg = NULL; + continue; + } + + /* + * It's an API Message, check if it's within limits. If it's not, + * the NT Behaviour is to set this to the Maximum API. + */ + if (ReceiveMsg.ApiNumber > SbpMaxApiNumber) + { + ReceiveMsg.ApiNumber = SbpMaxApiNumber; + DPRINT1("CSRSS: %lx is invalid Sb ApiNumber\n", ReceiveMsg.ApiNumber); + } + + /* Reuse the message */ + ReplyMsg = &ReceiveMsg; + + /* Make sure that the message is supported */ + if (ReceiveMsg.ApiNumber < SbpMaxApiNumber) + { + /* Call the API */ + if (!CsrServerSbApiDispatch[ReceiveMsg.ApiNumber](&ReceiveMsg)) + { + DPRINT1("CSRSS: %s Session Api called and failed\n", + CsrServerSbApiName[ReceiveMsg.ApiNumber]); + + /* It failed, so return nothing */ + ReplyMsg = NULL; + } + } + else + { + /* We don't support this API Number */ + ReplyMsg->ReturnValue = STATUS_NOT_IMPLEMENTED; + } + } +} + +/* EOF */ Index: subsystems/win32/csrsrv/session.c =================================================================== --- subsystems/win32/csrsrv/session.c (rvision 58607) +++ subsystems/win32/csrsrv/session.c (copie de travail) Modification de proprits sur subsystems/win32/csrsrv/session.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win32/csrsrv/srv.h =================================================================== --- subsystems/win32/csrsrv/srv.h (rvision 0) +++ subsystems/win32/csrsrv/srv.h (copie de travail) @@ -0,0 +1,61 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: subsystems/win32/csrsrv/srv.h + * PURPOSE: Main header - Definitions + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + * ReactOS Portable Systems Group + */ + +#ifndef _SRV_H +#define _SRV_H + +/* PSDK/NDK Headers */ +#include +#define WIN32_NO_STATUS +#include +#include +#include +#include // For EWX_FORCE +#define NTOS_MODE_USER +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include + +/* CSR Header */ +#include + +/* PSEH for SEH Support */ +#include + +/* Subsystem Manager Header */ +#include +#include + +/* Internal CSRSS Header */ +#include "api.h" + +/* Defines */ +#define SM_REG_KEY \ + L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Session Manager" + +#define SESSION_ROOT L"\\Sessions" +#define GLOBAL_ROOT L"\\GLOBAL??" +#define SYMLINK_NAME L"SymbolicLink" +#define SB_PORT_NAME L"SbAbiPort" +#define CSR_PORT_NAME L"ApiPort" +#define UNICODE_PATH_SEP L"\\" + +#define ROUND_UP(n, align) ROUND_DOWN(((ULONG)n) + (align) - 1, (align)) +#define ROUND_DOWN(n, align) (((ULONG)n) & ~((align) - 1l)) + +#endif // _SRV_H + +/* EOF */ Index: subsystems/win32/csrsrv/srv.h =================================================================== --- subsystems/win32/csrsrv/srv.h (rvision 58607) +++ subsystems/win32/csrsrv/srv.h (copie de travail) Modification de proprits sur subsystems/win32/csrsrv/srv.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win32/csrsrv/status.h =================================================================== --- subsystems/win32/csrsrv/status.h (rvision 0) +++ subsystems/win32/csrsrv/status.h (copie de travail) @@ -0,0 +1,111 @@ +/* + * CSRSRV Status + */ + +/* Organization + * + * api.c - Handles the LPC Reply/Request Threads which wait on Sb and Csr APIs. + * Also in charge of creating those threads and setting up the ports. + * Finally, it provides external APIs for validating the API buffers + * and doing server-to-server API calls. + * + * init.c - Handles initialization of CSRSRV, including command-line parsing, + * loading the Server DLLs, creating the Session Directories, setting + * up the DosDevices Object Directory, and initializing each component. + * + * procsup.c - Handles all internal functions dealing with the CSR Process Object, + * including de/allocation, de/referencing, un/locking, prority, and + * lookups. Also handles all external APIs which touch the CSR Process Object. + * + * server.c - Handles all internal functions related to loading and managing Server + * DLLs, as well as the routines handling the Shared Static Memory Section. + * Holds the API Dispatch/Valid/Name Tables and the public CSR_SERVER API + * interface. Also home of the SEH handler. + * + * session.c - Handles all internal functions dealing with the CSR Session Object, + * including de/allocation, de/referencing, and un/locking. Holds the SB API + * Dispatch/Name Tables and the public CsrSv API Interface for commmunication + * with the Session Manager. + * + * thredsup.c - Handles all internal functions dealing with the CSR Thread Object, + * including de/allocation, de/referencing, un/locking, impersonation, and + * lookups. Also handles all external APIs which touch the CSR Thread Object. + * + * wait.c - Handles all internal functions dealing with the CSR Wait Object, + * including de/allocation, de/referencing and un/locking. Also implements + * the external Wait API for creating, removing and/or notifying waits. + */ + +/* Exported APIs Location Status + *------------------------------------------------------------------- + * CsrAddStaticServerThread 753E679E 1 - server.c - IMPLEMENTED + * CsrCallServerFromServer 753E4FD9 2 - api.c - IMPLEMENTED + * CsrConnectToUser 753E4E48 3 - api.c - IMPLEMENTED + * CsrCreateProcess 753E6FD3 4 - procsup.c - IMPLEMENTED + * CsrCreateRemoteThread 753E73BD 5 - thredsup.c - IMPLEMENTED + * CsrCreateThread 753E72DA 6 - thredsup.c - IMPLEMENTED + * CsrCreateWait 753E770E 7 - wait.c - IMPLEMENTED + * CsrDebugProcess 753E7682 8 - procsup.c - IMPLEMENTED + * CsrDebugProcessStop 753E768A 9 - procsup.c - IMPLEMENTED + * CsrDereferenceProcess 753E6281 10 - procsup.c - IMPLEMENTED + * CsrDereferenceThread 753E6964 11 - thredsup.c - IMPLEMENTED + * CsrDereferenceWait 753E7886 12 - wait.c - IMPLEMENTED + * CsrDestroyProcess 753E7225 13 - procsup.c - IMPLEMENTED + * CsrDestroyThread 753E7478 14 - thredsup.c - IMPLEMENTED + * CsrExecServerThread 753E6841 15 - thredsup.c - IMPLEMENTED + * CsrGetProcessLuid 753E632F 16 - procsup.c - IMPLEMENTED + * CsrImpersonateClient 753E60F8 17 - thredsup.c - IMPLEMENTED + * CsrLockProcessByClientId 753E668F 18 - procsup.c - IMPLEMENTED + * CsrLockThreadByClientId 753E6719 19 - thredsup.c - IMPLEMENTED + * CsrMoveSatisfiedWait 753E7909 20 - wait.c - IMPLEMENTED + * CsrNotifyWait 753E782F 21 - wait.c - IMPLEMENTED + * CsrPopulateDosDevices 753E37A5 22 - init.c - IMPLEMENTED + * CsrQueryApiPort 753E4E42 23 - api.c - IMPLEMENTED + * CsrReferenceThread 753E61E5 24 - thredsup.c - IMPLEMENTED + * CsrRevertToSelf 753E615A 25 - thredsup.c - IMPLEMENTED + * CsrServerInitialization 753E3D75 26 - server.c - IMPLEMENTED + * CsrSetBackgroundPriority 753E5E87 27 - procsup.c - IMPLEMENTED + * CsrSetCallingSpooler 753E6425 28 - server.c - IMPLEMENTED + * CsrSetForegroundPriority 753E5E67 29 - procsup.c - IMPLEMENTED + * CsrShutdownProcesses 753E7547 30 - procsup.c - IMPLEMENTED + * CsrUnhandledExceptionFilter 753E3FE3 31 - server.c - IMPLEMENTED + * CsrUnlockProcess 753E66FD 32 - procsup.c - IMPLEMENTED + * CsrUnlockThread 753E7503 33 - thredsup.c - IMPLEMENTED + * CsrValidateMessageBuffer 753E528D 34 - api.c - IMPLEMENTED + * CsrValidateMessageString 753E5323 35 - api.c - IMPLEMENTED + */ + +/* Public CSR API Interface Status (server.c) + * CsrSrvClientConnect - IMPLEMENTED + * CsrSrvUnusedFunction - IMPLEMENTED + * CsrSrvIdentifyAlertableThread - IMPLEMENTED + * CsrSrvSetPriorityClass - IMPLEMENTED + */ + +/* Public SB API Interface Status (session.c) + * CsrSbCreateSession - IMPLEMENTED + * CsrSbForeignSessionComplete - IMPLEMENTED + * CsrSbTerminateSession - UNIMPLEMENTED + * CsrSbCreateProcess - UNIMPLEMENTED + */ + +/* What's missing: + * + * - SMSS needs to be partly re-written to match some things done here. + * Among other things, SmConnectToSm, SmCompleteSession and the other + * Sm* Exported APIs have to be properly implemented, as well as the + * callback calling and SM LPC APIs. [DONE!] + * + * - NTDLL needs to get the Csr* routines properly implemented. [DONE!] + * + * - KERNEL32, USER32 need to register with their servers properly. + * Additionally, user32 needs to have ClientThreadStartup implemented + * properly and do the syscall NtUserInitialize (I think) which also + * needs to be implemented in win32k.sys. All this should be less then + * 100 lines of code. [KERNEL32 50% DONE, USER32 NOT DONE] + * + * - The skeleton code for winsrv and basesrv which connects with CSR/CSRSRV + * needs to be written. [DONE!] + * + * - The kernel's LPC implementation needs to be made compatible. [DONE!] + */ Index: subsystems/win32/csrsrv/status.h =================================================================== --- subsystems/win32/csrsrv/status.h (rvision 58607) +++ subsystems/win32/csrsrv/status.h (copie de travail) Modification de proprits sur subsystems/win32/csrsrv/status.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win32/csrsrv/thredsup.c =================================================================== --- subsystems/win32/csrsrv/thredsup.c (rvision 0) +++ subsystems/win32/csrsrv/thredsup.c (copie de travail) @@ -0,0 +1,1058 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: subsystems/win32/csrsrv/thredsup.c + * PURPOSE: CSR Server DLL Thread Management + * PROGRAMMERS: ReactOS Portable Systems Group + * Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + +#define CsrHashThread(t) (HandleToUlong(t)&(256 - 1)) + +/* GLOBALS ********************************************************************/ + +LIST_ENTRY CsrThreadHashTable[256]; + + +/* PRIVATE FUNCTIONS **********************************************************/ + +/*++ + * @name ProtectHandle + * @implemented NT5.2 + * + * The ProtectHandle routine protects an object handle against closure. + * + * @return TRUE or FALSE. + * + * @remarks None. + * + *--*/ +BOOLEAN +NTAPI +ProtectHandle(IN HANDLE ObjectHandle) +{ + NTSTATUS Status; + OBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo; + + /* Query current state */ + Status = NtQueryObject(ObjectHandle, + ObjectHandleFlagInformation, + &HandleInfo, + sizeof(HandleInfo), + NULL); + if (NT_SUCCESS(Status)) + { + /* Enable protect from close */ + HandleInfo.ProtectFromClose = TRUE; + Status = NtSetInformationObject(ObjectHandle, + ObjectHandleFlagInformation, + &HandleInfo, + sizeof(HandleInfo)); + if (NT_SUCCESS(Status)) return TRUE; + } + + /* We failed to or set the state */ + return FALSE; +} + +/*++ + * @name UnProtectHandle + * @implemented NT5.2 + * + * The UnProtectHandle routine unprotects an object handle against closure. + * + * @return TRUE or FALSE. + * + * @remarks None. + * + *--*/ +BOOLEAN +NTAPI +UnProtectHandle(IN HANDLE ObjectHandle) +{ + NTSTATUS Status; + OBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo; + + /* Query current state */ + Status = NtQueryObject(ObjectHandle, + ObjectHandleFlagInformation, + &HandleInfo, + sizeof(HandleInfo), + NULL); + if (NT_SUCCESS(Status)) + { + /* Disable protect from close */ + HandleInfo.ProtectFromClose = FALSE; + Status = NtSetInformationObject(ObjectHandle, + ObjectHandleFlagInformation, + &HandleInfo, + sizeof(HandleInfo)); + if (NT_SUCCESS(Status)) return TRUE; + } + + /* We failed to or set the state */ + return FALSE; +} + +/*++ + * @name CsrAllocateThread + * + * The CsrAllocateThread routine allocates a new CSR Thread object. + * + * @param CsrProcess + * Pointer to the CSR Process which will contain this CSR Thread. + * + * @return Pointer to the newly allocated CSR Thread. + * + * @remarks None. + * + *--*/ +PCSR_THREAD +NTAPI +CsrAllocateThread(IN PCSR_PROCESS CsrProcess) +{ + PCSR_THREAD CsrThread; + + /* Allocate the structure */ + CsrThread = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, sizeof(CSR_THREAD)); + if (!CsrThread) return NULL; + + /* Reference the Thread and Process */ + CsrLockedReferenceThread(CsrThread); + CsrLockedReferenceProcess(CsrProcess); + + /* Set the Parent Process */ + CsrThread->Process = CsrProcess; + + /* Return Thread */ + return CsrThread; +} + +/*++ + * @name CsrLockedReferenceThread + * + * The CsrLockedReferenceThread references a CSR Thread while the + * Process Lock is already being held. + * + * @param CsrThread + * Pointer to the CSR Thread to be referenced. + * + * @return None. + * + * @remarks This routine will return with the Process Lock held. + * + *--*/ +VOID +NTAPI +CsrLockedReferenceThread(IN PCSR_THREAD CsrThread) +{ + /* Increment the reference count */ + ++CsrThread->ReferenceCount; +} + +/*++ + * @name CsrLocateThreadByClientId + * + * The CsrLocateThreadByClientId routine locates the CSR Thread and, + * optionally, its parent CSR Process, corresponding to a Client ID. + * + * @param Process + * Optional pointer to a CSR Process pointer which will contain + * the CSR Thread's parent. + * + * @param ClientId + * Pointer to a Client ID structure containing the Unique Thread ID + * to look up. + * + * @return Pointer to the CSR Thread corresponding to this CID, or NULL if + * none was found. + * + * @remarks None. + * + *--*/ +PCSR_THREAD +NTAPI +CsrLocateThreadByClientId(OUT PCSR_PROCESS *Process OPTIONAL, + IN PCLIENT_ID ClientId) +{ + ULONG i; + PLIST_ENTRY ListHead, NextEntry; + PCSR_THREAD FoundThread; + // ASSERT(ProcessStructureListLocked()); + + if (Process) *Process = NULL; + + /* Hash the Thread */ + i = CsrHashThread(ClientId->UniqueThread); + + /* Set the list pointers */ + ListHead = &CsrThreadHashTable[i]; + NextEntry = ListHead->Flink; + + /* Star the loop */ + while (NextEntry != ListHead) + { + /* Get the thread */ + FoundThread = CONTAINING_RECORD(NextEntry, CSR_THREAD, HashLinks); + + /* Move to the next entry */ + NextEntry = NextEntry->Flink; + + /* Compare the CID */ + // if (*(PULONGLONG)&FoundThread->ClientId == *(PULONGLONG)ClientId) + if ( FoundThread->ClientId.UniqueProcess == ClientId->UniqueProcess && + FoundThread->ClientId.UniqueThread == ClientId->UniqueThread ) + { + /* Match found, return the process */ + if (Process) *Process = FoundThread->Process; + + /* Return thread too */ + return FoundThread; + } + } + + /* Nothing found */ + return NULL; +} + +/*++ + * @name CsrLocateThreadInProcess + * + * The CsrLocateThreadInProcess routine locates the CSR Thread + * corresponding to a Client ID inside a specific CSR Process. + * + * @param Process + * Optional pointer to the CSR Process which contains the CSR Thread + * that will be looked up. + * + * @param ClientId + * Pointer to a Client ID structure containing the Unique Thread ID + * to look up. + * + * @return Pointer to the CSR Thread corresponding to this CID, or NULL if + * none was found. + * + * @remarks If the CsrProcess argument is NULL, the lookup will be done inside + * CsrRootProcess. + * + *--*/ +PCSR_THREAD +NTAPI +CsrLocateThreadInProcess(IN PCSR_PROCESS CsrProcess OPTIONAL, + IN PCLIENT_ID Cid) +{ + PLIST_ENTRY ListHead, NextEntry; + PCSR_THREAD FoundThread = NULL; + + /* Use the Root Process if none was specified */ + if (!CsrProcess) CsrProcess = CsrRootProcess; + + /* Save the List pointers */ + ListHead = &CsrProcess->ThreadList; + NextEntry = ListHead->Flink; + + /* Start the Loop */ + while (NextEntry != ListHead) + { + /* Get Thread Entry */ + FoundThread = CONTAINING_RECORD(NextEntry, CSR_THREAD, Link); + + /* Check for TID Match */ + if (FoundThread->ClientId.UniqueThread == Cid->UniqueThread) break; + + /* Move to the next entry */ + NextEntry = NextEntry->Flink; + } + + /* Return what we found */ + return FoundThread; +} + +/*++ + * @name CsrInsertThread + * + * The CsrInsertThread routine inserts a CSR Thread into its parent's + * Thread List and into the Thread Hash Table. + * + * @param Process + * Pointer to the CSR Process containing this CSR Thread. + * + * @param Thread + * Pointer to the CSR Thread to be inserted. + * + * @return None. + * + * @remarks None. + * + *--*/ +VOID +NTAPI +CsrInsertThread(IN PCSR_PROCESS Process, + IN PCSR_THREAD Thread) +{ + ULONG i; + // ASSERT(ProcessStructureListLocked()); + + /* Insert it into the Regular List */ + InsertTailList(&Process->ThreadList, &Thread->Link); + + /* Increase Thread Count */ + Process->ThreadCount++; + + /* Hash the Thread */ + i = CsrHashThread(Thread->ClientId.UniqueThread); + + /* Insert it there too */ + InsertHeadList(&CsrThreadHashTable[i], &Thread->HashLinks); +} + +/*++ + * @name CsrDeallocateThread + * + * The CsrDeallocateThread frees the memory associated with a CSR Thread. + * + * @param CsrThread + * Pointer to the CSR Thread to be freed. + * + * @return None. + * + * @remarks Do not call this routine. It is reserved for the internal + * thread management routines when a CSR Thread has been cleanly + * dereferenced and killed. + * + *--*/ +VOID +NTAPI +CsrDeallocateThread(IN PCSR_THREAD CsrThread) +{ + /* Free the process object from the heap */ + // ASSERT(CsrThread->WaitBlock == NULL); + RtlFreeHeap(CsrHeap, 0, CsrThread); +} + +/*++ + * @name CsrRemoveThread + * + * The CsrRemoveThread function undoes a CsrInsertThread operation and + * removes the CSR Thread from the the Hash Table and Thread List. + * + * @param CsrThread + * Pointer to the CSR Thread to remove. + * + * @return None. + * + * @remarks If this CSR Thread is the last one inside a CSR Process, the + * parent will be dereferenced and the CsrProcessLastThreadTerminated + * flag will be set. + * + * After executing this routine, the CSR Thread will have the + * CsrThreadInTermination flag set. + * + *--*/ +VOID +NTAPI +CsrRemoveThread(IN PCSR_THREAD CsrThread) +{ + ASSERT(ProcessStructureListLocked()); + + /* Remove it from the List */ + RemoveEntryList(&CsrThread->Link); + + /* Decreate the thread count of the process */ + CsrThread->Process->ThreadCount--; + + /* Remove it from the Hash List as well */ + if (CsrThread->HashLinks.Flink) RemoveEntryList(&CsrThread->HashLinks); + + /* Check if this is the last Thread */ + if (CsrThread->Process->ThreadCount == 0) + { + /* Check if it's not already been marked for deletion */ + if ((CsrThread->Process->Flags & CsrProcessLastThreadTerminated) == 0) + { + /* Let everyone know this process is about to lose the thread */ + CsrThread->Process->Flags |= CsrProcessLastThreadTerminated; + + /* Reference the Process */ + CsrLockedDereferenceProcess(CsrThread->Process); + } + } + + /* Mark the thread for deletion */ + CsrThread->Flags |= CsrThreadInTermination; +} + +/*++ + * @name CsrThreadRefcountZero + * + * The CsrThreadRefcountZero routine is executed when a CSR Thread has lost + * all its active references. It removes and de-allocates the CSR Thread. + * + * @param CsrThread + * Pointer to the CSR Thread that is to be deleted. + * + * @return None. + * + * @remarks Do not call this routine. It is reserved for the internal + * thread management routines when a CSR Thread has lost all + * its references. + * + * This routine is called with the Process Lock held. + * + *--*/ +VOID +NTAPI +CsrThreadRefcountZero(IN PCSR_THREAD CsrThread) +{ + PCSR_PROCESS CsrProcess = CsrThread->Process; + NTSTATUS Status; + ASSERT(ProcessStructureListLocked()); + + /* Remove this thread */ + CsrRemoveThread(CsrThread); + + /* Release the Process Lock */ + CsrReleaseProcessLock(); + + /* Close the NT Thread Handle */ + if (CsrThread->ThreadHandle) + { + UnProtectHandle(CsrThread->ThreadHandle); + Status = NtClose(CsrThread->ThreadHandle); + ASSERT(NT_SUCCESS(Status)); + } + + /* De-allocate the CSR Thread Object */ + CsrDeallocateThread(CsrThread); + + /* Remove a reference from the process */ + CsrDereferenceProcess(CsrProcess); +} + +/*++ + * @name CsrLockedDereferenceThread + * + * The CsrLockedDereferenceThread dereferences a CSR Thread while the + * Process Lock is already being held. + * + * @param CsrThread + * Pointer to the CSR Thread to be dereferenced. + * + * @return None. + * + * @remarks This routine will return with the Process Lock held. + * + *--*/ +VOID +NTAPI +CsrLockedDereferenceThread(IN PCSR_THREAD CsrThread) +{ + LONG LockCount; + + /* Decrease reference count */ + LockCount = --CsrThread->ReferenceCount; + ASSERT(LockCount >= 0); + if (LockCount == 0) + { + /* Call the generic cleanup code */ + CsrAcquireProcessLock(); + CsrThreadRefcountZero(CsrThread); + } +} + + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/*++ + * @name CsrAddStaticServerThread + * @implemented NT4 + * + * The CsrAddStaticServerThread routine adds a new CSR Thread to the + * CSR Server Process (CsrRootProcess). + * + * @param hThread + * Handle to an existing NT Thread to which to associate this + * CSR Thread. + * + * @param ClientId + * Pointer to the Client ID structure of the NT Thread to associate + * with this CSR Thread. + * + * @param ThreadFlags + * Initial CSR Thread Flags to associate to this CSR Thread. Usually + * CsrThreadIsServerThread. + * + * @return Pointer to the newly allocated CSR Thread. + * + * @remarks None. + * + *--*/ +PCSR_THREAD +NTAPI +CsrAddStaticServerThread(IN HANDLE hThread, + IN PCLIENT_ID ClientId, + IN ULONG ThreadFlags) +{ + PCSR_THREAD CsrThread; + + /* Get the Lock */ + CsrAcquireProcessLock(); + + /* Allocate the Server Thread */ + CsrThread = CsrAllocateThread(CsrRootProcess); + if (CsrThread) + { + /* Setup the Object */ + CsrThread->ThreadHandle = hThread; + ProtectHandle(hThread); + CsrThread->ClientId = *ClientId; + CsrThread->Flags = ThreadFlags; + + /* Insert it into the Thread List */ + InsertTailList(&CsrRootProcess->ThreadList, &CsrThread->Link); + + /* Increment the thread count */ + CsrRootProcess->ThreadCount++; + } + else + { + DPRINT1("CsrAddStaticServerThread: alloc failed for thread 0x%x\n", hThread); + } + + /* Release the Process Lock and return */ + CsrReleaseProcessLock(); + return CsrThread; +} + +/*++ + * @name CsrCreateRemoteThread + * @implemented NT4 + * + * The CsrCreateRemoteThread routine creates a CSR Thread object for + * an NT Thread which is not part of the current NT Process. + * + * @param hThread + * Handle to an existing NT Thread to which to associate this + * CSR Thread. + * + * @param ClientId + * Pointer to the Client ID structure of the NT Thread to associate + * with this CSR Thread. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrCreateRemoteThread(IN HANDLE hThread, + IN PCLIENT_ID ClientId) +{ + NTSTATUS Status; + HANDLE ThreadHandle; + PCSR_THREAD CsrThread; + PCSR_PROCESS CsrProcess; + KERNEL_USER_TIMES KernelTimes; + + /* Get the Thread Create Time */ + Status = NtQueryInformationThread(hThread, + ThreadTimes, + &KernelTimes, + sizeof(KernelTimes), + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to query thread times: %lx\n", Status); + return Status; + } + + /* Lock the Owner Process */ + Status = CsrLockProcessByClientId(ClientId->UniqueProcess, &CsrProcess); + if (!NT_SUCCESS(Status)) + { + DPRINT1("No known process for %lx\n", ClientId->UniqueProcess); + return Status; + } + + /* Make sure the thread didn't terminate */ + if (KernelTimes.ExitTime.QuadPart) + { + /* Unlock the process and return */ + CsrUnlockProcess(CsrProcess); + DPRINT1("Dead thread: %I64x\n", KernelTimes.ExitTime.QuadPart); + return STATUS_THREAD_IS_TERMINATING; + } + + /* Allocate a CSR Thread Structure */ + CsrThread = CsrAllocateThread(CsrProcess); + if (!CsrThread) + { + DPRINT1("CSRSRV: %s: out of memory!\n", __FUNCTION__); + CsrUnlockProcess(CsrProcess); + return STATUS_NO_MEMORY; + } + + /* Duplicate the Thread Handle */ + Status = NtDuplicateObject(NtCurrentProcess(), + hThread, + NtCurrentProcess(), + &ThreadHandle, + 0, + 0, + DUPLICATE_SAME_ACCESS); + /* Allow failure */ + if (!NT_SUCCESS(Status)) + { + DPRINT1("Thread duplication failed: %lx\n", Status); + ThreadHandle = hThread; + } + + /* Save the data we have */ + CsrThread->CreateTime = KernelTimes.CreateTime; + CsrThread->ClientId = *ClientId; + CsrThread->ThreadHandle = ThreadHandle; + ProtectHandle(ThreadHandle); + CsrThread->Flags = 0; + + /* Insert the Thread into the Process */ + CsrInsertThread(CsrProcess, CsrThread); + + /* Release the lock and return */ + CsrUnlockProcess(CsrProcess); + return STATUS_SUCCESS; +} + +/*++ + * @name CsrCreateThread + * @implemented NT4 + * + * The CsrCreateThread routine creates a CSR Thread object for an NT Thread. + * + * @param CsrProcess + * Pointer to the CSR Process which will contain the CSR Thread. + * + * @param hThread + * Handle to an existing NT Thread to which to associate this + * CSR Thread. + * + * @param ClientId + * Pointer to the Client ID structure of the NT Thread to associate + * with this CSR Thread. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrCreateThread(IN PCSR_PROCESS CsrProcess, + IN HANDLE hThread, + IN PCLIENT_ID ClientId, + IN BOOLEAN HaveClient) +{ + NTSTATUS Status; + PCSR_THREAD CsrThread, CurrentThread; + PCSR_PROCESS CurrentProcess; + CLIENT_ID CurrentCid; + KERNEL_USER_TIMES KernelTimes; + + if (HaveClient) + { + /* Get the current thread and CID */ + CurrentThread = CsrGetClientThread(); + CurrentCid = CurrentThread->ClientId; + + /* Acquire the Process Lock */ + CsrAcquireProcessLock(); + + /* Get the current Process and make sure the Thread is valid with this CID */ + CurrentThread = CsrLocateThreadByClientId(&CurrentProcess, &CurrentCid); + + /* Something is wrong if we get an empty thread back */ + if (!CurrentThread) + { + DPRINT1("CSRSRV: %s: invalid thread!\n", __FUNCTION__); + CsrReleaseProcessLock(); + return STATUS_THREAD_IS_TERMINATING; + } + } + else + { + /* Acquire the Process Lock */ + CsrAcquireProcessLock(); + } + + /* Get the Thread Create Time */ + Status = NtQueryInformationThread(hThread, + ThreadTimes, + (PVOID)&KernelTimes, + sizeof(KernelTimes), + NULL); + if (!NT_SUCCESS(Status)) + { + CsrReleaseProcessLock(); + return Status; + } + + /* Allocate a CSR Thread Structure */ + CsrThread = CsrAllocateThread(CsrProcess); + if (!CsrThread) + { + DPRINT1("CSRSRV: %s: out of memory!\n", __FUNCTION__); + CsrReleaseProcessLock(); + return STATUS_NO_MEMORY; + } + + /* Save the data we have */ + CsrThread->CreateTime = KernelTimes.CreateTime; + CsrThread->ClientId = *ClientId; + CsrThread->ThreadHandle = hThread; + ProtectHandle(hThread); + CsrThread->Flags = 0; + + /* Insert the Thread into the Process */ + CsrInsertThread(CsrProcess, CsrThread); + + /* Release the lock and return */ + CsrReleaseProcessLock(); + + return STATUS_SUCCESS; +} + +/*++ + * @name CsrDereferenceThread + * @implemented NT4 + * + * The CsrDereferenceThread routine removes a reference from a CSR Thread. + * + * @param CsrThread + * Pointer to the CSR Thread to dereference. + * + * @return None. + * + * @remarks If the reference count has reached zero (ie: the CSR Thread has + * no more active references), it will be deleted. + * + *--*/ +VOID +NTAPI +CsrDereferenceThread(IN PCSR_THREAD CsrThread) +{ + /* Acquire process lock */ + CsrAcquireProcessLock(); + + /* Decrease reference count */ + ASSERT(CsrThread->ReferenceCount > 0); + if ((--CsrThread->ReferenceCount) == 0) + { + /* Call the generic cleanup code */ + CsrThreadRefcountZero(CsrThread); + } + else + { + /* Just release the lock */ + CsrReleaseProcessLock(); + } +} + +/*++ + * @name CsrDestroyThread + * @implemented NT4 + * + * The CsrDestroyThread routine destroys the CSR Thread corresponding to + * a given Thread ID. + * + * @param Cid + * Pointer to the Client ID Structure corresponding to the CSR + * Thread which is about to be destroyed. + * + * @return STATUS_SUCCESS in case of success, STATUS_THREAD_IS_TERMINATING + * if the CSR Thread is already terminating. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrDestroyThread(IN PCLIENT_ID Cid) +{ + CLIENT_ID ClientId = *Cid; + PCSR_THREAD CsrThread; + PCSR_PROCESS CsrProcess; + + /* Acquire lock */ + CsrAcquireProcessLock(); + + /* Find the thread */ + CsrThread = CsrLocateThreadByClientId(&CsrProcess, + &ClientId); + + /* Make sure we got one back, and that it's not already gone */ + if (!CsrThread || (CsrThread->Flags & CsrThreadTerminated)) + { + /* Release the lock and return failure */ + CsrReleaseProcessLock(); + return STATUS_THREAD_IS_TERMINATING; + } + + /* Set the terminated flag */ + CsrThread->Flags |= CsrThreadTerminated; + + /* Acquire the Wait Lock */ + CsrAcquireWaitLock(); + + /* Do we have an active wait block? */ + if (CsrThread->WaitBlock) + { + /* Notify waiters of termination */ + CsrNotifyWaitBlock(CsrThread->WaitBlock, + NULL, + NULL, + NULL, + CsrProcessTerminating, + TRUE); + } + + /* Release the Wait Lock */ + CsrReleaseWaitLock(); + + /* Dereference the thread */ + CsrLockedDereferenceThread(CsrThread); + + /* Release the Process Lock and return success */ + CsrReleaseProcessLock(); + return STATUS_SUCCESS; +} + +/*++ + * @name CsrExecServerThread + * @implemented NT4 + * + * The CsrExecServerThread routine creates an NT Thread and then + * initializes a CSR Thread for it. + * + * @param ThreadHandler + * Pointer to the thread's startup routine. + * + * @param Flags + * Initial CSR Thread Flags to set to the CSR Thread. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks This routine is similar to CsrAddStaticServerThread, but it + * also creates an NT Thread instead of expecting one to already + * exist. + * + *--*/ +NTSTATUS +NTAPI +CsrExecServerThread(IN PVOID ThreadHandler, + IN ULONG Flags) +{ + PCSR_THREAD CsrThread; + HANDLE hThread; + CLIENT_ID ClientId; + NTSTATUS Status; + + /* Acquire process lock */ + CsrAcquireProcessLock(); + + /* Allocate a CSR Thread in the Root Process */ + ASSERT(CsrRootProcess != NULL); + CsrThread = CsrAllocateThread(CsrRootProcess); + if (!CsrThread) + { + /* Fail */ + CsrReleaseProcessLock(); + return STATUS_NO_MEMORY; + } + + /* Create the Thread */ + Status = RtlCreateUserThread(NtCurrentProcess(), + NULL, + FALSE, + 0, + 0, + 0, + ThreadHandler, + NULL, + &hThread, + &ClientId); + if (!NT_SUCCESS(Status)) + { + /* Fail */ + CsrDeallocateThread(CsrThread); + CsrReleaseProcessLock(); + return Status; + } + + /* Setup the Thread Object */ + CsrThread->ThreadHandle = hThread; + ProtectHandle(hThread); + CsrThread->ClientId = ClientId; + CsrThread->Flags = Flags; + + /* Insert it into the Thread List */ + InsertHeadList(&CsrRootProcess->ThreadList, &CsrThread->Link); + + /* Increase the thread count */ + CsrRootProcess->ThreadCount++; + + /* Return */ + CsrReleaseProcessLock(); + return Status; +} + +/*++ + * @name CsrLockThreadByClientId + * @implemented NT4 + * + * The CsrLockThreadByClientId routine locks the CSR Thread corresponding + * to the given Thread ID and optionally returns it. + * + * @param Tid + * Thread ID corresponding to the CSR Thread which will be locked. + * + * @param CsrThread + * Optional pointer to a CSR Thread pointer which will hold the + * CSR Thread corresponding to the given Thread ID. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise. + * + * @remarks Locking a CSR Thread is defined as acquiring an extra + * reference to it and returning with the Process Lock held. + * + *--*/ +NTSTATUS +NTAPI +CsrLockThreadByClientId(IN HANDLE Tid, + OUT PCSR_THREAD *CsrThread) +{ + PLIST_ENTRY NextEntry; + PCSR_THREAD CurrentThread = NULL; + NTSTATUS Status = STATUS_UNSUCCESSFUL; + ULONG i; + + /* Acquire the lock */ + CsrAcquireProcessLock(); + + /* Assume failure */ + ASSERT(CsrThread != NULL); + *CsrThread = NULL; + + /* Convert to Hash */ + i = CsrHashThread(Tid); + + /* Setup the List Pointers */ + NextEntry = CsrThreadHashTable[i].Flink; + + /* Start Loop */ + while (NextEntry != &CsrThreadHashTable[i]) + { + /* Get the Process */ + CurrentThread = CONTAINING_RECORD(NextEntry, CSR_THREAD, HashLinks); + + /* Check for PID Match */ + if ((CurrentThread->ClientId.UniqueThread == Tid) && + (CurrentThread->Flags & CsrThreadTerminated) == 0) + { + /* Get out of here */ + break; + } + + /* Move to the next entry */ + NextEntry = NextEntry->Flink; + } + + /* Nothing found if we got back to the list */ + if (NextEntry == &CsrThreadHashTable[i]) CurrentThread = NULL; + + /* Did the loop find something? */ + if (CurrentThread) + { + /* Reference the found thread */ + Status = STATUS_SUCCESS; + CsrLockedReferenceThread(CurrentThread); + *CsrThread = CurrentThread; + } + else + { + /* Nothing found, release the lock */ + Status = STATUS_UNSUCCESSFUL; + CsrReleaseProcessLock(); + } + + /* Return the status */ + return Status; +} + +/*++ + * @name CsrReferenceThread + * @implemented NT4 + * + * The CsrReferenceThread routine increases the active reference count of + * a CSR Thread. + * + * @param CsrThread + * Pointer to the CSR Thread whose reference count will be increased. + * + * @return None. + * + * @remarks Do not use this routine if the Process Lock is already held. + * + *--*/ +VOID +NTAPI +CsrReferenceThread(IN PCSR_THREAD CsrThread) +{ + /* Acquire process lock */ + CsrAcquireProcessLock(); + + /* Sanity checks */ + ASSERT(CsrThread->Flags & CsrThreadTerminated); // CSR_THREAD_DESTROYED in ASSERT + ASSERT(CsrThread->ReferenceCount != 0); + + /* Increment reference count */ + CsrThread->ReferenceCount++; + + /* Release the lock */ + CsrReleaseProcessLock(); +} + +/*++ + * @name CsrUnlockThread + * @implemented NT4 + * + * The CsrUnlockThread undoes a previous CsrLockThreadByClientId operation. + * + * @param CsrThread + * Pointer to a previously locked CSR Thread. + * + * @return STATUS_SUCCESS. + * + * @remarks This routine must be called with the Process Lock held. + * + *--*/ +NTSTATUS +NTAPI +CsrUnlockThread(IN PCSR_THREAD CsrThread) +{ + /* Dereference the Thread */ + ASSERT(ProcessStructureListLocked()); + CsrLockedDereferenceThread(CsrThread); + + /* Release the lock and return */ + CsrReleaseProcessLock(); + return STATUS_SUCCESS; +} + +/* EOF */ Index: subsystems/win32/csrsrv/thredsup.c =================================================================== --- subsystems/win32/csrsrv/thredsup.c (rvision 58607) +++ subsystems/win32/csrsrv/thredsup.c (copie de travail) Modification de proprits sur subsystems/win32/csrsrv/thredsup.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win32/csrsrv/wait.c =================================================================== --- subsystems/win32/csrsrv/wait.c (rvision 0) +++ subsystems/win32/csrsrv/wait.c (copie de travail) @@ -0,0 +1,451 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Client/Server Runtime SubSystem + * FILE: subsystems/win32/csrsrv/wait.c + * PURPOSE: CSR Server DLL Wait Implementation + * PROGRAMMERS: Emanuele Aliberti + * Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES *******************************************************************/ + +#include "srv.h" + +#define NDEBUG +#include + +/* DATA ***********************************************************************/ + +RTL_CRITICAL_SECTION CsrWaitListsLock; + +/* PRIVATE FUNCTIONS **********************************************************/ + +/*++ + * @name CsrInitializeWait + * + * The CsrInitializeWait routine initializes a CSR Wait Object. + * + * @param WaitFunction + * Pointer to the function that will handle this wait. + * + * @param CsrWaitThread + * Pointer to the CSR Thread that will perform the wait. + * + * @param WaitApiMessage + * Pointer to the CSR API Message associated to this wait. + * + * @param WaitContext + * Pointer to a user-defined parameter associated to this wait. + * + * @param NewWaitBlock + * Pointed to the initialized CSR Wait Block for this wait. + * + * @return TRUE in case of success, FALSE otherwise. + * + * @remarks None. + * + *--*/ +BOOLEAN +NTAPI +CsrInitializeWait(IN CSR_WAIT_FUNCTION WaitFunction, + IN PCSR_THREAD CsrWaitThread, + IN OUT PCSR_API_MESSAGE WaitApiMessage, + IN PVOID WaitContext, + OUT PCSR_WAIT_BLOCK *NewWaitBlock) +{ + ULONG Size; + PCSR_WAIT_BLOCK WaitBlock; + + /* Calculate the size of the wait block */ + Size = sizeof(CSR_WAIT_BLOCK) - + sizeof(WaitBlock->WaitApiMessage) + + WaitApiMessage->Header.u1.s1.TotalLength; + + /* Allocate the Wait Block */ + WaitBlock = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, Size); + if (!WaitBlock) + { + /* Fail */ + WaitApiMessage->Status = STATUS_NO_MEMORY; + return FALSE; + } + + /* Initialize it */ + WaitBlock->Size = Size; + WaitBlock->WaitThread = CsrWaitThread; + CsrWaitThread->WaitBlock = WaitBlock; + WaitBlock->WaitContext = WaitContext; + WaitBlock->WaitFunction = WaitFunction; + WaitBlock->UserWaitList.Flink = NULL; + WaitBlock->UserWaitList.Blink = NULL; + WaitBlock->WaitList = WaitBlock->UserWaitList; + + /* Copy the message */ + RtlMoveMemory(&WaitBlock->WaitApiMessage, + WaitApiMessage, + WaitApiMessage->Header.u1.s1.TotalLength); + + /* Return the block */ + *NewWaitBlock = WaitBlock; + return TRUE; +} + +/*++ + * @name CsrNotifyWaitBlock + * + * The CsrNotifyWaitBlock routine calls the wait function for a registered + * CSR Wait Block, and replies to the attached CSR API Message, if any. + * + * @param WaitBlock + * Pointer to the CSR Wait Block + * + * @param WaitList + * Pointer to the wait list for this wait. + * + * @param WaitArgument[1-2] + * User-defined values to pass to the wait function. + * + * @param WaitFlags + * Wait flags for this wait. + * + * @param DereferenceThread + * Specifies whether the CSR Thread should be dereferenced at the + * end of this wait. + * + * @return TRUE in case of success, FALSE otherwise. + * + * @remarks After a wait block is notified, the wait function becomes invalid. + * + *--*/ +BOOLEAN +NTAPI +CsrNotifyWaitBlock(IN PCSR_WAIT_BLOCK WaitBlock, + IN PLIST_ENTRY WaitList, + IN PVOID WaitArgument1, + IN PVOID WaitArgument2, + IN ULONG WaitFlags, + IN BOOLEAN DereferenceThread) +{ + /* Call the wait function */ + if (WaitBlock->WaitFunction(WaitList, + WaitBlock->WaitThread, + &WaitBlock->WaitApiMessage, + WaitBlock->WaitContext, + WaitArgument1, + WaitArgument2, + WaitFlags)) + { + /* The wait is done, clear the block */ + WaitBlock->WaitThread->WaitBlock = NULL; + + /* Check for captured arguments */ + if (WaitBlock->WaitApiMessage.CsrCaptureData) + { + /* Release them */ + CsrReleaseCapturedArguments(&WaitBlock->WaitApiMessage); + } + + /* Reply to the port */ + NtReplyPort(WaitBlock->WaitThread->Process->ClientPort, + (PPORT_MESSAGE)&WaitBlock->WaitApiMessage); + + /* Check if we should dereference the thread */ + if (DereferenceThread) + { + /* Remove it from the Wait List */ + if (WaitBlock->WaitList.Flink) + { + RemoveEntryList(&WaitBlock->WaitList); + } + + /* Remove it from the User Wait List */ + if (WaitBlock->UserWaitList.Flink) + { + RemoveEntryList(&WaitBlock->UserWaitList); + } + + /* Dereference the thread */ + CsrDereferenceThread(WaitBlock->WaitThread); + + /* Free the wait block */ + RtlFreeHeap(CsrHeap, 0, WaitBlock); + } + else + { + /* The wait is complete, but the thread is being kept alive */ + WaitBlock->WaitFunction = NULL; + } + + /* The wait succeeded */ + return TRUE; + } + + /* The wait failed */ + return FALSE; +} + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/*++ + * @name CsrCreateWait + * @implemented NT4 + * + * The CsrCreateWait routine creates a CSR Wait. + * + * @param WaitList + * Pointer to a list entry of the waits to associate. + * + * @param WaitFunction + * Pointer to the function that will handle this wait. + * + * @param CsrWaitThread + * Pointer to the CSR Thread that will perform the wait. + * + * @param WaitApiMessage + * Pointer to the CSR API Message associated to this wait. + * + * @param WaitContext + * Pointer to a user-defined parameter associated to this wait. + * + * @param UserWaitList + * Pointer to a list entry of the user-defined waits to associate. + * + * @return TRUE in case of success, FALSE otherwise. + * + * @remarks None. + * + *--*/ +BOOLEAN +NTAPI +CsrCreateWait(IN PLIST_ENTRY WaitList, + IN CSR_WAIT_FUNCTION WaitFunction, + IN PCSR_THREAD CsrWaitThread, + IN OUT PCSR_API_MESSAGE WaitApiMessage, + IN PVOID WaitContext, + IN PLIST_ENTRY UserWaitList OPTIONAL) +{ + PCSR_WAIT_BLOCK WaitBlock; + + /* Initialize the wait */ + if (!CsrInitializeWait(WaitFunction, + CsrWaitThread, + WaitApiMessage, + WaitContext, + &WaitBlock)) + { + return FALSE; + } + + /* Acquire the Wait Lock */ + CsrAcquireWaitLock(); + + /* Make sure the thread wasn't destroyed */ + if (CsrWaitThread->Flags & CsrThreadTerminated) + { + /* Fail the wait */ + CsrWaitThread->WaitBlock = NULL; + RtlFreeHeap(CsrHeap, 0, WaitBlock); + CsrReleaseWaitLock(); + return FALSE; + } + + /* Insert the wait in the queue */ + InsertTailList(WaitList, &WaitBlock->WaitList); + + /* Insert the User Wait too, if one was given */ + if (UserWaitList) InsertTailList(UserWaitList, &WaitBlock->UserWaitList); + + /* Return */ + CsrReleaseWaitLock(); + return TRUE; +} + +/*++ + * @name CsrDereferenceWait + * @implemented NT4 + * + * The CsrDereferenceWait routine dereferences a CSR Wait Block. + * + * @param WaitList + * Pointer to the Wait List associated to the wait. + + * @return None. + * + * @remarks None. + * + *--*/ +VOID +NTAPI +CsrDereferenceWait(IN PLIST_ENTRY WaitList) +{ + PLIST_ENTRY NextEntry; + PCSR_WAIT_BLOCK WaitBlock; + + /* Acquire the Process and Wait Locks */ + CsrAcquireProcessLock(); + CsrAcquireWaitLock(); + + /* Set the list pointers */ + NextEntry = WaitList->Flink; + + /* Start the loop */ + while (NextEntry != WaitList) + { + /* Get the wait block */ + WaitBlock = CONTAINING_RECORD(NextEntry, CSR_WAIT_BLOCK, WaitList); + + /* Move to the next entry */ + NextEntry = NextEntry->Flink; + + /* Check if there's no Wait Routine (satisfied wait) */ + if (WaitBlock->WaitFunction == NULL) + { + /* Remove it from the Wait List */ + if (WaitBlock->WaitList.Flink) + { + RemoveEntryList(&WaitBlock->WaitList); + } + + /* Remove it from the User Wait List */ + if (WaitBlock->UserWaitList.Flink) + { + RemoveEntryList(&WaitBlock->UserWaitList); + } + + /* Dereference the thread waiting on it */ + CsrDereferenceThread(WaitBlock->WaitThread); + + /* Free the block */ + RtlFreeHeap(CsrHeap, 0, WaitBlock); + } + } + + /* Release the locks */ + CsrReleaseWaitLock(); + CsrReleaseProcessLock(); +} + +/*++ + * @name CsrMoveSatisfiedWait + * @implemented NT5 + * + * The CsrMoveSatisfiedWait routine moves satisfied waits from a wait list + * to another list entry. + * + * @param NewEntry + * Pointer to a list entry where the satisfied waits will be added. + * + * @param WaitList + * Pointer to a list entry to analyze for satisfied waits. + * + * @return None. + * + * @remarks None. + * + *--*/ +VOID +NTAPI +CsrMoveSatisfiedWait(IN PLIST_ENTRY NewEntry, + IN PLIST_ENTRY WaitList) +{ + PLIST_ENTRY NextEntry; + PCSR_WAIT_BLOCK WaitBlock; + + /* Acquire the Wait Lock */ + CsrAcquireWaitLock(); + + /* Set the List pointers */ + NextEntry = WaitList->Flink; + + /* Start looping */ + while (NextEntry != WaitList) + { + /* Get the Wait block */ + WaitBlock = CONTAINING_RECORD(NextEntry, CSR_WAIT_BLOCK, WaitList); + + /* Go to the next entry */ + NextEntry = NextEntry->Flink; + + /* Check if there's no Wait Routine (satisfied wait) */ + if (WaitBlock->WaitFunction == NULL) + { + /* Remove it from the Wait Block Queue */ + RemoveEntryList(&WaitBlock->WaitList); + + /* Insert the new entry */ + InsertTailList(&WaitBlock->WaitList, NewEntry); + } + } + + /* Release the wait lock */ + CsrReleaseWaitLock(); +} + +/*++ + * @name CsrNotifyWait + * @implemented NT4 + * + * The CsrNotifyWait notifies a CSR Wait Block. + * + * @param WaitList + * Pointer to the list entry for this wait. + * + * @param WaitType + * Type of the wait to perform, either WaitAny or WaitAll. + * + * @param WaitArgument[1-2] + * User-defined argument to pass on to the wait function. + * + * @return TRUE in case of success, FALSE otherwise. + * + * @remarks None. + * + *--*/ +BOOLEAN +NTAPI +CsrNotifyWait(IN PLIST_ENTRY WaitList, + IN ULONG WaitType, + IN PVOID WaitArgument1, + IN PVOID WaitArgument2) +{ + PLIST_ENTRY NextEntry; + PCSR_WAIT_BLOCK WaitBlock; + BOOLEAN NotifySuccess = FALSE; + + /* Acquire the Wait Lock */ + CsrAcquireWaitLock(); + + /* Set the List pointers */ + NextEntry = WaitList->Flink; + + /* Start looping */ + while (NextEntry != WaitList) + { + /* Get the Wait block */ + WaitBlock = CONTAINING_RECORD(NextEntry, CSR_WAIT_BLOCK, WaitList); + + /* Go to the next entry */ + NextEntry = NextEntry->Flink; + + /* Check if there is a Wait Routine */ + if (WaitBlock->WaitFunction != NULL) + { + /* Notify the Waiter */ + NotifySuccess |= CsrNotifyWaitBlock(WaitBlock, + WaitList, + WaitArgument1, + WaitArgument2, + 0, + FALSE); + + /* We've already done a wait, so leave unless this is a Wait All */ + if (WaitType != WaitAll) break; + } + } + + /* Release the wait lock and return */ + CsrReleaseWaitLock(); + return NotifySuccess; +} + +/* EOF */ Index: subsystems/win32/csrsrv/wait.c =================================================================== --- subsystems/win32/csrsrv/wait.c (rvision 58607) +++ subsystems/win32/csrsrv/wait.c (copie de travail) Modification de proprits sur subsystems/win32/csrsrv/wait.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win32/csrss/CMakeLists.txt =================================================================== --- subsystems/win32/csrss/CMakeLists.txt (rvision 58607) +++ subsystems/win32/csrss/CMakeLists.txt (copie de travail) @@ -1,8 +1,7 @@ include_directories( - include - ${REACTOS_SOURCE_DIR}/include/reactos/subsys - ${REACTOS_SOURCE_DIR}/include/reactos/drivers) + ${REACTOS_SOURCE_DIR}/subsystems/win32/csrsrv/include + ${REACTOS_SOURCE_DIR}/include/reactos/subsys) add_executable(csrss csrss.c csrss.rc) @@ -11,5 +10,3 @@ add_importlibs(csrss ntdll csrsrv) add_dependencies(csrss psdk bugcodes) add_cd_file(TARGET csrss DESTINATION reactos/system32 FOR all) - -add_subdirectory(csrsrv) Index: subsystems/win32/csrss/csrss.c =================================================================== --- subsystems/win32/csrss/csrss.c (rvision 58607) +++ subsystems/win32/csrss/csrss.c (copie de travail) @@ -1,22 +1,19 @@ /* - * PROJECT: ReactOS Client Server Runtime SubSystem (CSRSS) * LICENSE: BSD - See COPYING.ARM in root directory + * PROJECT: ReactOS Client/Server Runtime SubSystem * FILE: subsystems/win32/csrss/csrss.c - * PURPOSE: Main Executable Code - * PROGRAMMERS: Alex Ionescu + * PURPOSE: CSRSS Process Main Executable Code + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) * ReactOS Portable Systems Group */ /* INCLUDES *******************************************************************/ -#define WIN32_NO_STATUS #define NTOS_MODE_USER +#include +#include -#include -#include -#include -#include -#include +#include #define NDEBUG #include @@ -45,7 +42,7 @@ { KPRIORITY BasePriority = (8 + 1) + 4; NTSTATUS Status; - //ULONG Response; + //ULONG Response; // see the #if 0 UNREFERENCED_PARAMETER(envp); UNREFERENCED_PARAMETER(DebugFlag); @@ -87,7 +84,7 @@ CsrpSetDefaultProcessHardErrorMode(); /* If this is Session 0, make sure killing us bugchecks the system */ - if (!NtCurrentPeb()->SessionId) RtlSetProcessIsCritical(TRUE, NULL, FALSE); + if (NtCurrentPeb()->SessionId == 0) RtlSetProcessIsCritical(TRUE, NULL, FALSE); /* Kill this thread. CSRSRV keeps us going */ NtTerminateThread(NtCurrentThread(), Status); Index: subsystems/win32/csrss/csrss.rc =================================================================== --- subsystems/win32/csrss/csrss.rc (rvision 58607) +++ subsystems/win32/csrss/csrss.rc (copie de travail) @@ -1,4 +1,4 @@ -#define REACTOS_STR_FILE_DESCRIPTION "Client/Server Runtime SubSystem Process\0" -#define REACTOS_STR_INTERNAL_NAME "csrss\0" -#define REACTOS_STR_ORIGINAL_FILENAME "csrss.exe\0" +#define REACTOS_STR_FILE_DESCRIPTION "Client/Server Runtime SubSystem Process" +#define REACTOS_STR_INTERNAL_NAME "csrss" +#define REACTOS_STR_ORIGINAL_FILENAME "csrss.exe" #include Index: subsystems/win/basesrv/basesrv.h =================================================================== --- subsystems/win/basesrv/basesrv.h (rvision 58607) +++ subsystems/win/basesrv/basesrv.h (copie de travail) @@ -1,11 +1,51 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS/Win32 Base enviroment Subsystem Server + * FILE: subsystems/win/basesrv/basesrv.h + * PURPOSE: Main header - Definitions + * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr) + */ + +#ifndef __BASESRV_H__ +#define __BASESRV_H__ + #pragma once /* PSDK/NDK Headers */ -#include +#define WIN32_NO_STATUS #include - #define NTOS_MODE_USER #include -#include +/* CSRSS Header */ +#include + +/* BASE Headers */ +#include #include + + +extern HANDLE BaseSrvHeap; +extern HANDLE BaseSrvSharedHeap; +extern PBASE_STATIC_SERVER_DATA BaseStaticServerData; + +/* dosdev.c */ +VOID BaseInitDefineDosDevice(VOID); +VOID BaseCleanupDefineDosDevice(VOID); + +CSR_API(BaseSrvDefineDosDevice); + +/* proc.c */ +CSR_API(BaseSrvGetTempFile); +CSR_API(BaseSrvCreateProcess); +CSR_API(BaseSrvCreateThread); +CSR_API(BaseSrvExitProcess); +CSR_API(BaseSrvGetProcessShutdownParam); +CSR_API(BaseSrvSetProcessShutdownParam); + +/* sndsntry.c */ +CSR_API(BaseSrvSoundSentryNotification); + +#endif // __BASESRV_H__ + +/* EOF */ Index: subsystems/win/basesrv/basesrv.rc =================================================================== --- subsystems/win/basesrv/basesrv.rc (rvision 58607) +++ subsystems/win/basesrv/basesrv.rc (copie de travail) @@ -1,5 +1,5 @@ #define REACTOS_VERSION_DLL -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS/Win32 base usermode server\0" -#define REACTOS_STR_INTERNAL_NAME "basesrv\0" -#define REACTOS_STR_ORIGINAL_FILENAME "basesrv.dll\0" +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Base API Server DLL" +#define REACTOS_STR_INTERNAL_NAME "basesrv" +#define REACTOS_STR_ORIGINAL_FILENAME "basesrv.dll" #include Index: subsystems/win/basesrv/basesrv.spec =================================================================== --- subsystems/win/basesrv/basesrv.spec (rvision 0) +++ subsystems/win/basesrv/basesrv.spec (copie de travail) @@ -0,0 +1,2 @@ +@ stdcall BaseSetProcessCreateNotify(ptr) +@ stdcall ServerDllInitialization(ptr) Index: subsystems/win/basesrv/basesrv.spec =================================================================== --- subsystems/win/basesrv/basesrv.spec (rvision 58607) +++ subsystems/win/basesrv/basesrv.spec (copie de travail) Modification de proprits sur subsystems/win/basesrv/basesrv.spec ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win/basesrv/CMakeLists.txt =================================================================== --- subsystems/win/basesrv/CMakeLists.txt (rvision 0) +++ subsystems/win/basesrv/CMakeLists.txt (copie de travail) @@ -0,0 +1,23 @@ + +include_directories(${REACTOS_SOURCE_DIR}/include/reactos/subsys) + +spec2def(basesrv.dll basesrv.spec) + +list(APPEND SOURCE + dosdev.c + init.c + proc.c + sndsntry.c + basesrv.rc + ${CMAKE_CURRENT_BINARY_DIR}/basesrv.def) + +add_library(basesrv SHARED ${SOURCE}) + +target_link_libraries(basesrv ${PSEH_LIB}) + +set_module_type(basesrv nativedll) # win32dll + +add_importlibs(basesrv ntdll csrsrv) + +add_dependencies(basesrv bugcodes) +add_cd_file(TARGET basesrv DESTINATION reactos/system32 FOR all) Index: subsystems/win/basesrv/CMakeLists.txt =================================================================== --- subsystems/win/basesrv/CMakeLists.txt (rvision 58607) +++ subsystems/win/basesrv/CMakeLists.txt (copie de travail) Modification de proprits sur subsystems/win/basesrv/CMakeLists.txt ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win/basesrv/dosdev.c =================================================================== --- subsystems/win/basesrv/dosdev.c (rvision 0) +++ subsystems/win/basesrv/dosdev.c (copie de travail) @@ -0,0 +1,556 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS/Win32 Base enviroment Subsystem Server + * FILE: subsystems/win/basesrv/dosdev.c + * PURPOSE: DOS Devices Management + * PROGRAMMERS: Pierre Schweitzer (pierre.schweitzer@reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include "basesrv.h" + +#define NDEBUG +#include + +/* GLOBALS ********************************************************************/ + +typedef struct _BASE_DOS_DEVICE_HISTORY_ENTRY +{ + LIST_ENTRY Entry; + UNICODE_STRING Device; + UNICODE_STRING Target; +} BASE_DOS_DEVICE_HISTORY_ENTRY, *PBASE_DOS_DEVICE_HISTORY_ENTRY; + +static RTL_CRITICAL_SECTION BaseDefineDosDeviceCritSec; +static LIST_ENTRY DosDeviceHistory; + +/* PRIVATE FUNCTIONS **********************************************************/ + +VOID BaseInitDefineDosDevice(VOID) +{ + RtlInitializeCriticalSection(&BaseDefineDosDeviceCritSec); + InitializeListHead(&DosDeviceHistory); +} + +VOID BaseCleanupDefineDosDevice(VOID) +{ + PLIST_ENTRY Entry, ListHead; + PBASE_DOS_DEVICE_HISTORY_ENTRY HistoryEntry; + + RtlDeleteCriticalSection(&BaseDefineDosDeviceCritSec); + + ListHead = &DosDeviceHistory; + Entry = ListHead->Flink; + while (Entry != ListHead) + { + HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY) + CONTAINING_RECORD(Entry, + BASE_DOS_DEVICE_HISTORY_ENTRY, + Entry); + Entry = Entry->Flink; + + if (HistoryEntry) + { + if (HistoryEntry->Target.Buffer) + { + RtlFreeHeap(BaseSrvHeap, + 0, + HistoryEntry->Target.Buffer); + } + if (HistoryEntry->Device.Buffer) + { + RtlFreeHeap(BaseSrvHeap, + 0, + HistoryEntry->Device.Buffer); + } + RtlFreeHeap(BaseSrvHeap, + 0, + HistoryEntry); + } + } +} + +/* PUBLIC SERVER APIS *********************************************************/ + +CSR_API(BaseSrvDefineDosDevice) +{ + NTSTATUS Status; + PBASE_DEFINE_DOS_DEVICE DefineDosDeviceRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.DefineDosDeviceRequest; + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE LinkHandle = NULL; + UNICODE_STRING DeviceName = {0}; + UNICODE_STRING RequestDeviceName = {0}; + UNICODE_STRING LinkTarget = {0}; + PUNICODE_STRING RequestLinkTarget; + ULONG Length; + SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY}; + SID_IDENTIFIER_AUTHORITY SystemAuthority = {SECURITY_NT_AUTHORITY}; + PSECURITY_DESCRIPTOR SecurityDescriptor; + PACL Dacl; + PSID AdminSid; + PSID SystemSid; + PSID WorldSid; + ULONG SidLength; + PBASE_DOS_DEVICE_HISTORY_ENTRY HistoryEntry; + PLIST_ENTRY Entry; + PLIST_ENTRY ListHead; + BOOLEAN Matched, AddHistory; + DWORD dwFlags; + PWSTR lpBuffer; + + DPRINT("BaseSrvDefineDosDevice entered, Flags:%d, DeviceName:%wZ, TargetName:%wZ\n", + DefineDosDeviceRequest->dwFlags, + &DefineDosDeviceRequest->DeviceName, + &DefineDosDeviceRequest->TargetName); + + Matched = AddHistory = FALSE; + HistoryEntry = NULL; + AdminSid = SystemSid = WorldSid = NULL; + SecurityDescriptor = NULL; + ListHead = &DosDeviceHistory; + dwFlags = DefineDosDeviceRequest->dwFlags; + + /* Validate the flags */ + if ( (dwFlags & 0xFFFFFFF0) || + ((dwFlags & DDD_EXACT_MATCH_ON_REMOVE) && + !(dwFlags & DDD_REMOVE_DEFINITION)) ) + { + return STATUS_INVALID_PARAMETER; + } + + Status = RtlEnterCriticalSection(&BaseDefineDosDeviceCritSec); + if (!NT_SUCCESS(Status)) + { + DPRINT1("RtlEnterCriticalSection() failed (Status %lx)\n", + Status); + return Status; + } + + _SEH2_TRY + { + Status = + RtlUpcaseUnicodeString(&RequestDeviceName, + &DefineDosDeviceRequest->DeviceName, + TRUE); + if (!NT_SUCCESS(Status)) + _SEH2_LEAVE; + + RequestLinkTarget = &DefineDosDeviceRequest->TargetName; + lpBuffer = (PWSTR) RtlAllocateHeap(BaseSrvHeap, + HEAP_ZERO_MEMORY, + RequestDeviceName.MaximumLength + 5 * sizeof(WCHAR)); + if (!lpBuffer) + { + DPRINT1("Failed to allocate memory\n"); + Status = STATUS_NO_MEMORY; + _SEH2_LEAVE; + } + + swprintf(lpBuffer, + L"\\??\\%wZ", + &RequestDeviceName); + RtlInitUnicodeString(&DeviceName, + lpBuffer); + InitializeObjectAttributes(&ObjectAttributes, + &DeviceName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtOpenSymbolicLinkObject(&LinkHandle, + DELETE | 0x1, + &ObjectAttributes); + if (NT_SUCCESS(Status)) + { + Status = NtQuerySymbolicLinkObject(LinkHandle, + &LinkTarget, + &Length); + if (!NT_SUCCESS(Status) && + Status == STATUS_BUFFER_TOO_SMALL) + { + LinkTarget.Length = 0; + LinkTarget.MaximumLength = Length; + LinkTarget.Buffer = (PWSTR) + RtlAllocateHeap(BaseSrvHeap, + HEAP_ZERO_MEMORY, + Length); + if (!LinkTarget.Buffer) + { + DPRINT1("Failed to allocate memory\n"); + Status = STATUS_NO_MEMORY; + _SEH2_LEAVE; + } + + Status = NtQuerySymbolicLinkObject(LinkHandle, + &LinkTarget, + &Length); + } + + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtQuerySymbolicLinkObject(%wZ) failed (Status %lx)\n", + &DeviceName, Status); + _SEH2_LEAVE; + } + + if ((dwFlags & DDD_REMOVE_DEFINITION)) + { + /* If no target name specified we remove the current symlink target */ + if (RequestLinkTarget->Length == 0) + Matched = TRUE; + else + { + if (dwFlags & DDD_EXACT_MATCH_ON_REMOVE) + Matched = !RtlCompareUnicodeString(RequestLinkTarget, + &LinkTarget, + TRUE); + else + Matched = RtlPrefixUnicodeString(RequestLinkTarget, + &LinkTarget, + TRUE); + } + + if (Matched && IsListEmpty(ListHead)) + { + /* Current symlink target macthed and there is nothing to revert to */ + RequestLinkTarget = NULL; + } + else if (Matched && !IsListEmpty(ListHead)) + { + /* + * Fetch the first history entry we come across for the device name. + * This will become the current symlink target for the device name. + */ + Matched = FALSE; + Entry = ListHead->Flink; + while (Entry != ListHead) + { + HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY) + CONTAINING_RECORD(Entry, + BASE_DOS_DEVICE_HISTORY_ENTRY, + Entry); + Matched = + !RtlCompareUnicodeString(&RequestDeviceName, + &HistoryEntry->Device, + FALSE); + if (Matched) + { + RemoveEntryList(&HistoryEntry->Entry); + RequestLinkTarget = &HistoryEntry->Target; + break; + } + Entry = Entry->Flink; + HistoryEntry = NULL; + } + + /* Nothing to revert to so delete the symlink */ + if (!Matched) + RequestLinkTarget = NULL; + } + else if (!Matched) + { + /* + * Locate a previous symlink target as we did not get + * a hit earlier. If we find one we need to remove it. + */ + Entry = ListHead->Flink; + while (Entry != ListHead) + { + HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY) + CONTAINING_RECORD(Entry, + BASE_DOS_DEVICE_HISTORY_ENTRY, + Entry); + Matched = + !RtlCompareUnicodeString(&RequestDeviceName, + &HistoryEntry->Device, + FALSE); + if (!Matched) + { + HistoryEntry = NULL; + Entry = Entry->Flink; + continue; + } + + Matched = FALSE; + if (dwFlags & DDD_EXACT_MATCH_ON_REMOVE) + { + if (!RtlCompareUnicodeString(RequestLinkTarget, + &HistoryEntry->Target, + TRUE)) + { + Matched = TRUE; + } + } + else if (RtlPrefixUnicodeString(RequestLinkTarget, + &HistoryEntry->Target, + TRUE)) + { + Matched = TRUE; + } + + if (Matched) + { + RemoveEntryList(&HistoryEntry->Entry); + break; + } + Entry = Entry->Flink; + HistoryEntry = NULL; + } + + /* Leave existing symlink as is */ + if (!Matched) + Status = STATUS_OBJECT_NAME_NOT_FOUND; + else + Status = STATUS_SUCCESS; + _SEH2_LEAVE; + } + } + else + { + AddHistory = TRUE; + } + + Status = NtMakeTemporaryObject(LinkHandle); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtMakeTemporaryObject(%wZ) failed (Status %lx)\n", + &DeviceName, Status); + _SEH2_LEAVE; + } + + Status = NtClose(LinkHandle); + LinkHandle = NULL; + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtClose(%wZ) failed (Status %lx)\n", + &DeviceName, Status); + _SEH2_LEAVE; + } + } + + /* Don't create symlink if we don't have a target */ + if (!RequestLinkTarget || RequestLinkTarget->Length == 0) + _SEH2_LEAVE; + + if (AddHistory) + { + HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY) + RtlAllocateHeap(BaseSrvHeap, + HEAP_ZERO_MEMORY, + sizeof(BASE_DOS_DEVICE_HISTORY_ENTRY)); + if (!HistoryEntry) + { + DPRINT1("Failed to allocate memory\n"); + Status = STATUS_NO_MEMORY; + _SEH2_LEAVE; + } + + HistoryEntry->Target.Buffer = + RtlAllocateHeap(BaseSrvHeap, + HEAP_ZERO_MEMORY, + LinkTarget.Length); + if (!HistoryEntry->Target.Buffer) + { + DPRINT1("Failed to allocate memory\n"); + Status = STATUS_NO_MEMORY; + _SEH2_LEAVE; + } + HistoryEntry->Target.Length = + HistoryEntry->Target.MaximumLength = + LinkTarget.Length; + RtlCopyUnicodeString(&HistoryEntry->Target, + &LinkTarget); + + HistoryEntry->Device.Buffer = + RtlAllocateHeap(BaseSrvHeap, + HEAP_ZERO_MEMORY, + RequestDeviceName.Length); + if (!HistoryEntry->Device.Buffer) + { + DPRINT1("Failed to allocate memory\n"); + Status = STATUS_NO_MEMORY; + _SEH2_LEAVE; + } + HistoryEntry->Device.Length = + HistoryEntry->Device.MaximumLength = + RequestDeviceName.Length; + RtlCopyUnicodeString(&HistoryEntry->Device, + &RequestDeviceName); + + /* Remember previous symlink target for this device */ + InsertHeadList(ListHead, + &HistoryEntry->Entry); + HistoryEntry = NULL; + } + + RtlAllocateAndInitializeSid(&WorldAuthority, + 1, + SECURITY_WORLD_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + &WorldSid); + + RtlAllocateAndInitializeSid(&SystemAuthority, + 1, + SECURITY_LOCAL_SYSTEM_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + &SystemSid); + + RtlAllocateAndInitializeSid(&SystemAuthority, + 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + &AdminSid); + + SidLength = RtlLengthSid(SystemSid) + + RtlLengthSid(AdminSid) + + RtlLengthSid(WorldSid); + Length = sizeof(ACL) + SidLength + 3 * sizeof(ACCESS_ALLOWED_ACE); + + SecurityDescriptor = RtlAllocateHeap(BaseSrvHeap, + 0, + SECURITY_DESCRIPTOR_MIN_LENGTH + Length); + if (!SecurityDescriptor) + { + DPRINT1("Failed to allocate memory\n"); + Status = STATUS_NO_MEMORY; + _SEH2_LEAVE; + } + + Dacl = (PACL)((ULONG_PTR)SecurityDescriptor + SECURITY_DESCRIPTOR_MIN_LENGTH); + Status = RtlCreateSecurityDescriptor(SecurityDescriptor, + SECURITY_DESCRIPTOR_REVISION); + if (!NT_SUCCESS(Status)) + { + DPRINT1("RtlCreateSecurityDescriptor() failed (Status %lx)\n", Status); + _SEH2_LEAVE; + } + + Status = RtlCreateAcl(Dacl, + Length, + ACL_REVISION); + if (!NT_SUCCESS(Status)) + { + DPRINT1("RtlCreateAcl() failed (Status %lx)\n", Status); + _SEH2_LEAVE; + } + + RtlAddAccessAllowedAce(Dacl, + ACL_REVISION, + GENERIC_ALL, + SystemSid); + RtlAddAccessAllowedAce(Dacl, + ACL_REVISION, + GENERIC_ALL, + AdminSid); + RtlAddAccessAllowedAce(Dacl, + ACL_REVISION, + STANDARD_RIGHTS_READ, + WorldSid); + + Status = RtlSetDaclSecurityDescriptor(SecurityDescriptor, + TRUE, + Dacl, + FALSE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("RtlSetDaclSecurityDescriptor() failed (Status %lx)\n", Status); + _SEH2_LEAVE; + } + + InitializeObjectAttributes(&ObjectAttributes, + &DeviceName, + OBJ_CASE_INSENSITIVE, + NULL, + SecurityDescriptor); + Status = NtCreateSymbolicLinkObject(&LinkHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes, + RequestLinkTarget); + if (NT_SUCCESS(Status)) + { + Status = NtMakePermanentObject(LinkHandle); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtMakePermanentObject(%wZ) failed (Status %lx)\n", + &DeviceName, Status); + } + } + else + { + DPRINT1("NtCreateSymbolicLinkObject(%wZ) failed (Status %lx)\n", + &DeviceName, Status); + } + } + _SEH2_FINALLY + { + RtlLeaveCriticalSection(&BaseDefineDosDeviceCritSec); + if (DeviceName.Buffer) + { + RtlFreeHeap(BaseSrvHeap, + 0, + DeviceName.Buffer); + } + if (LinkTarget.Buffer) + { + RtlFreeHeap(BaseSrvHeap, + 0, + LinkTarget.Buffer); + } + if (SecurityDescriptor) + { + RtlFreeHeap(BaseSrvHeap, + 0, + SecurityDescriptor); + } + + if (LinkHandle) NtClose(LinkHandle); + if (SystemSid) RtlFreeSid(SystemSid); + if (AdminSid) RtlFreeSid(AdminSid); + if (WorldSid) RtlFreeSid(WorldSid); + + RtlFreeUnicodeString(&RequestDeviceName); + + if (HistoryEntry) + { + if (HistoryEntry->Target.Buffer) + { + RtlFreeHeap(BaseSrvHeap, + 0, + HistoryEntry->Target.Buffer); + } + if (HistoryEntry->Device.Buffer) + { + RtlFreeHeap(BaseSrvHeap, + 0, + HistoryEntry->Device.Buffer); + } + RtlFreeHeap(BaseSrvHeap, + 0, + HistoryEntry); + } + } + _SEH2_END + + DPRINT("BaseSrvDefineDosDevice exit, Status: 0x%x\n", Status); + return Status; +} + +/* EOF */ Index: subsystems/win/basesrv/dosdev.c =================================================================== --- subsystems/win/basesrv/dosdev.c (rvision 58607) +++ subsystems/win/basesrv/dosdev.c (copie de travail) Modification de proprits sur subsystems/win/basesrv/dosdev.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win/basesrv/init.c =================================================================== --- subsystems/win/basesrv/init.c (rvision 58607) +++ subsystems/win/basesrv/init.c (copie de travail) @@ -1,72 +1,561 @@ /* - * init.c - ReactOS/Win32 base enviroment subsystem server - * - * ReactOS Operating System - * - * -------------------------------------------------------------------- - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * -------------------------------------------------------------------- + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS/Win32 Base enviroment Subsystem Server + * FILE: subsystems/win/basesrv/init.c + * PURPOSE: Initialization + * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr) */ + +/* INCLUDES *******************************************************************/ + #include "basesrv.h" #define NDEBUG #include -HANDLE BaseApiPort = (HANDLE) 0; +/* GLOBALS ********************************************************************/ -/********************************************************************** - * NAME PRIVATE - * BaseStaticServerThread/1 - */ -VOID WINAPI BaseStaticServerThread (PVOID x) +HANDLE BaseSrvDllInstance = NULL; + +/* Memory */ +HANDLE BaseSrvHeap = NULL; // Our own heap. +HANDLE BaseSrvSharedHeap = NULL; // Shared heap with CSR. (CsrSrvSharedSectionHeap) +PBASE_STATIC_SERVER_DATA BaseStaticServerData = NULL; // Data that we can share amongst processes. Initialized inside BaseSrvSharedHeap. + +// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3 +PCSR_API_ROUTINE BaseServerApiDispatchTable[BasepMaxApiNumber - BASESRV_FIRST_API_NUMBER] = { - NTSTATUS Status = STATUS_SUCCESS; - PPORT_MESSAGE Request = (PPORT_MESSAGE) x; - PPORT_MESSAGE Reply = NULL; - ULONG MessageType = 0; + BaseSrvCreateProcess, + BaseSrvCreateThread, + BaseSrvGetTempFile, + BaseSrvExitProcess, + // BaseSrvDebugProcess, + // BaseSrvCheckVDM, + // BaseSrvUpdateVDMEntry, + // BaseSrvGetNextVDMCommand, + // BaseSrvExitVDM, + // BaseSrvIsFirstVDM, + // BaseSrvGetVDMExitCode, + // BaseSrvSetReenterCount, + BaseSrvSetProcessShutdownParam, + BaseSrvGetProcessShutdownParam, + // BaseSrvNlsSetUserInfo, + // BaseSrvNlsSetMultipleUserInfo, + // BaseSrvNlsCreateSection, + // BaseSrvSetVDMCurDirs, + // BaseSrvGetVDMCurDirs, + // BaseSrvBatNotification, + // BaseSrvRegisterWowExec, + BaseSrvSoundSentryNotification, + // BaseSrvRefreshIniFileMapping, + BaseSrvDefineDosDevice, + // BaseSrvSetTermsrvAppInstallMode, + // BaseSrvNlsUpdateCacheCount, + // BaseSrvSetTermsrvClientTimeZone, + // BaseSrvSxsCreateActivationContext, + // BaseSrvRegisterThread, + // BaseSrvNlsGetUserInfo, +}; - DPRINT("BASESRV: %s called\n", __FUNCTION__); +BOOLEAN BaseServerApiServerValidTable[BasepMaxApiNumber - BASESRV_FIRST_API_NUMBER] = +{ + TRUE, // BaseSrvCreateProcess + TRUE, // BaseSrvCreateThread + TRUE, // BaseSrvGetTempFile + FALSE, // BaseSrvExitProcess + // FALSE, // BaseSrvDebugProcess + // TRUE, // BaseSrvCheckVDM + // TRUE, // BaseSrvUpdateVDMEntry + // TRUE, // BaseSrvGetNextVDMCommand + // TRUE, // BaseSrvExitVDM + // TRUE, // BaseSrvIsFirstVDM + // TRUE, // BaseSrvGetVDMExitCode + // TRUE, // BaseSrvSetReenterCount + TRUE, // BaseSrvSetProcessShutdownParam + TRUE, // BaseSrvGetProcessShutdownParam + // TRUE, // BaseSrvNlsSetUserInfo + // TRUE, // BaseSrvNlsSetMultipleUserInfo + // TRUE, // BaseSrvNlsCreateSection + // TRUE, // BaseSrvSetVDMCurDirs + // TRUE, // BaseSrvGetVDMCurDirs + // TRUE, // BaseSrvBatNotification + // TRUE, // BaseSrvRegisterWowExec + TRUE, // BaseSrvSoundSentryNotification + // TRUE, // BaseSrvRefreshIniFileMapping + TRUE, // BaseSrvDefineDosDevice + // FALSE, // BaseSrvSetTermsrvAppInstallMode + // FALSE, // BaseSrvNlsUpdateCacheCount + // FALSE, // BaseSrvSetTermsrvClientTimeZone + // FALSE, // BaseSrvSxsCreateActivationContext + // FALSE, // BaseSrvRegisterThread + // FALSE, // BaseSrvNlsGetUserInfo +}; - MessageType = Request->u2.s2.Type; - DPRINT("BASESRV: %s received a message (Type=%d)\n", - __FUNCTION__, MessageType); - switch (MessageType) - { - default: - Reply = Request; - Status = NtReplyPort (BaseApiPort, Reply); - break; - } +PCHAR BaseServerApiNameTable[BasepMaxApiNumber - BASESRV_FIRST_API_NUMBER] = +{ + "BaseCreateProcess", + "BaseCreateThread", + "BaseGetTempFile", + "BaseExitProcess", + // "BaseDebugProcess", + // "BaseCheckVDM", + // "BaseUpdateVDMEntry", + // "BaseGetNextVDMCommand", + // "BaseExitVDM", + // "BaseIsFirstVDM", + // "BaseGetVDMExitCode", + // "BaseSetReenterCount", + "BaseSetProcessShutdownParam", + "BaseGetProcessShutdownParam", + // "BaseNlsSetUserInfo", + // "BaseNlsSetMultipleUserInfo", + // "BaseNlsCreateSection", + // "BaseSetVDMCurDirs", + // "BaseGetVDMCurDirs", + // "BaseBatNotification", + // "BaseRegisterWowExec", + "BaseSoundSentryNotification", + // "BaseRefreshIniFileMapping", + "BaseDefineDosDevice", + // "BaseSetTermsrvAppInstallMode", + // "BaseNlsUpdateCacheCount", + // "BaseSetTermsrvClientTimeZone", + // "BaseSxsCreateActivationContext", + // "BaseRegisterThread", + // "BaseNlsGetUserInfo", +}; + + +/* FUNCTIONS ******************************************************************/ + +NTSTATUS +NTAPI +CreateBaseAcls(OUT PACL* Dacl, + OUT PACL* RestrictedDacl) +{ + PSID SystemSid, WorldSid, RestrictedSid; + SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; + SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY}; + NTSTATUS Status; + // UCHAR KeyValueBuffer[0x40]; + // PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo; + // UNICODE_STRING KeyName; + // ULONG ProtectionMode = 0; + ULONG AclLength; // , ResultLength; + // HANDLE hKey; + // OBJECT_ATTRIBUTES ObjectAttributes; + + /* Open the Session Manager Key */ + /* + RtlInitUnicodeString(&KeyName, SM_REG_KEY); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtOpenKey(&hKey, KEY_READ, &ObjectAttributes); + if (NT_SUCCESS(Status)) + { + /\* Read the key value *\/ + RtlInitUnicodeString(&KeyName, L"ProtectionMode"); + Status = NtQueryValueKey(hKey, + &KeyName, + KeyValuePartialInformation, + KeyValueBuffer, + sizeof(KeyValueBuffer), + &ResultLength); + + /\* Make sure it's what we expect it to be *\/ + KeyValuePartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION)KeyValueBuffer; + if ((NT_SUCCESS(Status)) && (KeyValuePartialInfo->Type == REG_DWORD) && + (*(PULONG)KeyValuePartialInfo->Data)) + { + /\* Save the Protection Mode *\/ + // ProtectionMode = *(PULONG)KeyValuePartialInfo->Data; + } + + /\* Close the handle *\/ + NtClose(hKey); + } + */ + + /* Allocate the System SID */ + Status = RtlAllocateAndInitializeSid(&NtAuthority, + 1, SECURITY_LOCAL_SYSTEM_RID, + 0, 0, 0, 0, 0, 0, 0, + &SystemSid); + ASSERT(NT_SUCCESS(Status)); + + /* Allocate the World SID */ + Status = RtlAllocateAndInitializeSid(&WorldAuthority, + 1, SECURITY_WORLD_RID, + 0, 0, 0, 0, 0, 0, 0, + &WorldSid); + ASSERT(NT_SUCCESS(Status)); + + /* Allocate the restricted SID */ + Status = RtlAllocateAndInitializeSid(&NtAuthority, + 1, SECURITY_RESTRICTED_CODE_RID, + 0, 0, 0, 0, 0, 0, 0, + &RestrictedSid); + ASSERT(NT_SUCCESS(Status)); + + /* Allocate one ACL with 3 ACEs each for one SID */ + AclLength = sizeof(ACL) + 3 * sizeof(ACCESS_ALLOWED_ACE) + + RtlLengthSid(SystemSid) + + RtlLengthSid(RestrictedSid) + + RtlLengthSid(WorldSid); + *Dacl = RtlAllocateHeap(BaseSrvHeap, 0, AclLength); + ASSERT(*Dacl != NULL); + + /* Set the correct header fields */ + Status = RtlCreateAcl(*Dacl, AclLength, ACL_REVISION2); + ASSERT(NT_SUCCESS(Status)); + + /* Give the appropriate rights to each SID */ + /* FIXME: Should check SessionId/ProtectionMode */ + Status = RtlAddAccessAllowedAce(*Dacl, ACL_REVISION2, DIRECTORY_QUERY | DIRECTORY_TRAVERSE | DIRECTORY_CREATE_OBJECT | DIRECTORY_CREATE_SUBDIRECTORY | READ_CONTROL, WorldSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(*Dacl, ACL_REVISION2, DIRECTORY_ALL_ACCESS, SystemSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(*Dacl, ACL_REVISION2, DIRECTORY_TRAVERSE, RestrictedSid); + ASSERT(NT_SUCCESS(Status)); + + /* Now allocate the restricted DACL */ + *RestrictedDacl = RtlAllocateHeap(BaseSrvHeap, 0, AclLength); + ASSERT(*RestrictedDacl != NULL); + + /* Initialize it */ + Status = RtlCreateAcl(*RestrictedDacl, AclLength, ACL_REVISION2); + ASSERT(NT_SUCCESS(Status)); + + /* And add the same ACEs as before */ + /* FIXME: Not really fully correct */ + Status = RtlAddAccessAllowedAce(*RestrictedDacl, ACL_REVISION2, DIRECTORY_QUERY | DIRECTORY_TRAVERSE | DIRECTORY_CREATE_OBJECT | DIRECTORY_CREATE_SUBDIRECTORY | READ_CONTROL, WorldSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(*RestrictedDacl, ACL_REVISION2, DIRECTORY_ALL_ACCESS, SystemSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(*RestrictedDacl, ACL_REVISION2, DIRECTORY_TRAVERSE, RestrictedSid); + ASSERT(NT_SUCCESS(Status)); + + /* The SIDs are captured, can free them now */ + RtlFreeHeap(BaseSrvHeap, 0, SystemSid); + RtlFreeHeap(BaseSrvHeap, 0, WorldSid); + RtlFreeHeap(BaseSrvHeap, 0, RestrictedSid); + return Status; } +VOID +NTAPI +BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll) +{ + NTSTATUS Status; + WCHAR Buffer[MAX_PATH]; + PWCHAR HeapBuffer; + UNICODE_STRING SystemRootString; + UNICODE_STRING UnexpandedSystemRootString = RTL_CONSTANT_STRING(L"%SystemRoot%"); + UNICODE_STRING BaseSrvCSDString; + UNICODE_STRING BaseSrvWindowsDirectory; + UNICODE_STRING BaseSrvWindowsSystemDirectory; + UNICODE_STRING BnoString; + OBJECT_ATTRIBUTES ObjectAttributes; + ULONG SessionId; + HANDLE BaseSrvNamedObjectDirectory; + HANDLE BaseSrvRestrictedObjectDirectory; + PACL BnoDacl, BnoRestrictedDacl; + PSECURITY_DESCRIPTOR BnoSd; + HANDLE SymHandle; + UNICODE_STRING DirectoryName, SymlinkName; + ULONG LuidEnabled; + RTL_QUERY_REGISTRY_TABLE BaseServerRegistryConfigurationTable[2] = + { + { + NULL, + RTL_QUERY_REGISTRY_DIRECT, + L"CSDVersion", + &BaseSrvCSDString, + REG_NONE, NULL, 0 + }, -NTSTATUS WINAPI ServerDllInitialization (ULONG ArgumentCount, LPWSTR *Argument) + {0} + }; + + /* Initialize the memory */ + BaseSrvHeap = RtlGetProcessHeap(); // Initialize our own heap. + BaseSrvSharedHeap = LoadedServerDll->SharedSection; // Get the CSR shared heap. + + /* Get the session ID */ + SessionId = NtCurrentPeb()->SessionId; + + /* Get the Windows directory */ + RtlInitEmptyUnicodeString(&SystemRootString, Buffer, sizeof(Buffer)); + Status = RtlExpandEnvironmentStrings_U(NULL, + &UnexpandedSystemRootString, + &SystemRootString, + NULL); + ASSERT(NT_SUCCESS(Status)); + + /* Create the base directory */ + Buffer[SystemRootString.Length / sizeof(WCHAR)] = UNICODE_NULL; + Status = RtlCreateUnicodeString(&BaseSrvWindowsDirectory, + SystemRootString.Buffer); + ASSERT(NT_SUCCESS(Status)); + + /* Create the system directory */ + wcscat(SystemRootString.Buffer, L"\\System32"); + Status = RtlCreateUnicodeString(&BaseSrvWindowsSystemDirectory, + SystemRootString.Buffer); + ASSERT(NT_SUCCESS(Status)); + + /* FIXME: Check Session ID */ + wcscpy(Buffer, L"\\BaseNamedObjects"); + RtlInitUnicodeString(&BnoString, Buffer); + + /* Allocate the server data */ + BaseStaticServerData = RtlAllocateHeap(BaseSrvSharedHeap, + HEAP_ZERO_MEMORY, + sizeof(BASE_STATIC_SERVER_DATA)); + ASSERT(BaseStaticServerData != NULL); + + /* Process timezone information */ + BaseStaticServerData->TermsrvClientTimeZoneId = TIME_ZONE_ID_INVALID; + BaseStaticServerData->TermsrvClientTimeZoneChangeNum = 0; + Status = NtQuerySystemInformation(SystemTimeOfDayInformation, + &BaseStaticServerData->TimeOfDay, + sizeof(BaseStaticServerData->TimeOfDay), + NULL); + ASSERT(NT_SUCCESS(Status)); + + /* Make a shared heap copy of the Windows directory */ + BaseStaticServerData->WindowsDirectory = BaseSrvWindowsDirectory; + HeapBuffer = RtlAllocateHeap(BaseSrvSharedHeap, + 0, + BaseSrvWindowsDirectory.MaximumLength); + ASSERT(HeapBuffer); + RtlCopyMemory(HeapBuffer, + BaseStaticServerData->WindowsDirectory.Buffer, + BaseSrvWindowsDirectory.MaximumLength); + BaseStaticServerData->WindowsDirectory.Buffer = HeapBuffer; + + /* Make a shared heap copy of the System directory */ + BaseStaticServerData->WindowsSystemDirectory = BaseSrvWindowsSystemDirectory; + HeapBuffer = RtlAllocateHeap(BaseSrvSharedHeap, + 0, + BaseSrvWindowsSystemDirectory.MaximumLength); + ASSERT(HeapBuffer); + RtlCopyMemory(HeapBuffer, + BaseStaticServerData->WindowsSystemDirectory.Buffer, + BaseSrvWindowsSystemDirectory.MaximumLength); + BaseStaticServerData->WindowsSystemDirectory.Buffer = HeapBuffer; + + /* This string is not used */ + RtlInitEmptyUnicodeString(&BaseStaticServerData->WindowsSys32x86Directory, + NULL, + 0); + + /* Make a shared heap copy of the BNO directory */ + BaseStaticServerData->NamedObjectDirectory = BnoString; + BaseStaticServerData->NamedObjectDirectory.MaximumLength = BnoString.Length + + sizeof(UNICODE_NULL); + HeapBuffer = RtlAllocateHeap(BaseSrvSharedHeap, + 0, + BaseStaticServerData->NamedObjectDirectory.MaximumLength); + ASSERT(HeapBuffer); + RtlCopyMemory(HeapBuffer, + BaseStaticServerData->NamedObjectDirectory.Buffer, + BaseStaticServerData->NamedObjectDirectory.MaximumLength); + BaseStaticServerData->NamedObjectDirectory.Buffer = HeapBuffer; + + /* + * Confirmed that in Windows, CSDNumber and RCNumber are actually Length + * and MaximumLength of the CSD String, since the same UNICODE_STRING is + * being queried twice, the first time as a ULONG! + * + * Somehow, in Windows this doesn't cause a buffer overflow, but it might + * in ReactOS, so this code is disabled until someone figures out WTF. + */ + BaseStaticServerData->CSDNumber = 0; + BaseStaticServerData->RCNumber = 0; + + /* Initialize the CSD string and query its value from the registry */ + RtlInitEmptyUnicodeString(&BaseSrvCSDString, Buffer, sizeof(Buffer)); + Status = RtlQueryRegistryValues(RTL_REGISTRY_WINDOWS_NT, + L"", + BaseServerRegistryConfigurationTable, + NULL, + NULL); + if (NT_SUCCESS(Status)) + { + /* Copy into the shared buffer */ + wcsncpy(BaseStaticServerData->CSDVersion, + BaseSrvCSDString.Buffer, + BaseSrvCSDString.Length / sizeof(WCHAR)); + } + else + { + /* NULL-terminate to indicate nothing is there */ + BaseStaticServerData->CSDVersion[0] = UNICODE_NULL; + } + + /* Cache the system information */ + Status = NtQuerySystemInformation(SystemBasicInformation, + &BaseStaticServerData->SysInfo, + sizeof(BaseStaticServerData->SysInfo), + NULL); + ASSERT(NT_SUCCESS(Status)); + + /* FIXME: Should query the registry for these */ + BaseStaticServerData->DefaultSeparateVDM = FALSE; + BaseStaticServerData->IsWowTaskReady = FALSE; + + /* Allocate a security descriptor and create it */ + BnoSd = RtlAllocateHeap(BaseSrvHeap, 0, 1024); + ASSERT(BnoSd); + Status = RtlCreateSecurityDescriptor(BnoSd, SECURITY_DESCRIPTOR_REVISION); + ASSERT(NT_SUCCESS(Status)); + + /* Create the BNO and \Restricted DACLs */ + Status = CreateBaseAcls(&BnoDacl, &BnoRestrictedDacl); + ASSERT(NT_SUCCESS(Status)); + + /* Set the BNO DACL as active for now */ + Status = RtlSetDaclSecurityDescriptor(BnoSd, TRUE, BnoDacl, FALSE); + ASSERT(NT_SUCCESS(Status)); + + /* Create the BNO directory */ + RtlInitUnicodeString(&BnoString, L"\\BaseNamedObjects"); + InitializeObjectAttributes(&ObjectAttributes, + &BnoString, + OBJ_OPENIF | OBJ_PERMANENT | OBJ_CASE_INSENSITIVE, + NULL, + BnoSd); + Status = NtCreateDirectoryObject(&BaseSrvNamedObjectDirectory, + DIRECTORY_ALL_ACCESS, + &ObjectAttributes); + ASSERT(NT_SUCCESS(Status)); + + /* Check if we are session 0 */ + if (SessionId == 0) + { + /* Mark this as a session 0 directory */ + Status = NtSetInformationObject(BaseSrvNamedObjectDirectory, + ObjectSessionInformation, + NULL, + 0); + ASSERT(NT_SUCCESS(Status)); + } + + /* Check if LUID device maps are enabled */ + Status = NtQueryInformationProcess(NtCurrentProcess(), + ProcessLUIDDeviceMapsEnabled, + &LuidEnabled, + sizeof(LuidEnabled), + NULL); + ASSERT(NT_SUCCESS(Status)); + BaseStaticServerData->LUIDDeviceMapsEnabled = LuidEnabled; + if (!BaseStaticServerData->LUIDDeviceMapsEnabled) + { + /* Make Global point back to BNO */ + RtlInitUnicodeString(&DirectoryName, L"Global"); + RtlInitUnicodeString(&SymlinkName, L"\\BaseNamedObjects"); + InitializeObjectAttributes(&ObjectAttributes, + &DirectoryName, + OBJ_OPENIF | OBJ_PERMANENT | OBJ_CASE_INSENSITIVE, + BaseSrvNamedObjectDirectory, + BnoSd); + Status = NtCreateSymbolicLinkObject(&SymHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes, + &SymlinkName); + if ((NT_SUCCESS(Status)) && SessionId == 0) NtClose(SymHandle); + + /* Make local point back to \Sessions\x\BNO */ + RtlInitUnicodeString(&DirectoryName, L"Local"); + ASSERT(SessionId == 0); + InitializeObjectAttributes(&ObjectAttributes, + &DirectoryName, + OBJ_OPENIF | OBJ_PERMANENT | OBJ_CASE_INSENSITIVE, + BaseSrvNamedObjectDirectory, + BnoSd); + Status = NtCreateSymbolicLinkObject(&SymHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes, + &SymlinkName); + if ((NT_SUCCESS(Status)) && SessionId == 0) NtClose(SymHandle); + + /* Make Session point back to BNOLINKS */ + RtlInitUnicodeString(&DirectoryName, L"Session"); + RtlInitUnicodeString(&SymlinkName, L"\\Sessions\\BNOLINKS"); + InitializeObjectAttributes(&ObjectAttributes, + &DirectoryName, + OBJ_OPENIF | OBJ_PERMANENT | OBJ_CASE_INSENSITIVE, + BaseSrvNamedObjectDirectory, + BnoSd); + Status = NtCreateSymbolicLinkObject(&SymHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes, + &SymlinkName); + if ((NT_SUCCESS(Status)) && SessionId == 0) NtClose(SymHandle); + + /* Create the BNO\Restricted directory and set the restricted DACL */ + RtlInitUnicodeString(&DirectoryName, L"Restricted"); + Status = RtlSetDaclSecurityDescriptor(BnoSd, TRUE, BnoRestrictedDacl, FALSE); + ASSERT(NT_SUCCESS(Status)); + InitializeObjectAttributes(&ObjectAttributes, + &DirectoryName, + OBJ_OPENIF | OBJ_PERMANENT | OBJ_CASE_INSENSITIVE, + BaseSrvNamedObjectDirectory, + BnoSd); + Status = NtCreateDirectoryObject(&BaseSrvRestrictedObjectDirectory, + DIRECTORY_ALL_ACCESS, + &ObjectAttributes); + ASSERT(NT_SUCCESS(Status)); + } + + /* Finally, set the pointer */ + LoadedServerDll->SharedSection = BaseStaticServerData; +} + +CSR_SERVER_DLL_INIT(ServerDllInitialization) { - NTSTATUS Status = STATUS_SUCCESS; + /* Setup the DLL Object */ + LoadedServerDll->ApiBase = BASESRV_FIRST_API_NUMBER; // ApiNumberBase + LoadedServerDll->HighestApiSupported = BasepMaxApiNumber; // MaxApiNumber + LoadedServerDll->DispatchTable = BaseServerApiDispatchTable; + LoadedServerDll->ValidTable = BaseServerApiServerValidTable; + LoadedServerDll->NameTable = BaseServerApiNameTable; + LoadedServerDll->SizeOfProcessData = 0; + LoadedServerDll->ConnectCallback = NULL; + LoadedServerDll->DisconnectCallback = NULL; + LoadedServerDll->ShutdownProcessCallback = NULL; - DPRINT("BASSRV: %s(%ld,...) called\n", __FUNCTION__, ArgumentCount); + BaseSrvDllInstance = LoadedServerDll->ServerHandle; - BaseApiPort = CsrQueryApiPort (); - Status = CsrAddStaticServerThread (BaseStaticServerThread); - if (NT_SUCCESS(Status)) - { - //TODO initialize the BASE server - } - return STATUS_SUCCESS; + BaseInitializeStaticServerData(LoadedServerDll); + + /* Initialize DOS devices management */ + BaseInitDefineDosDevice(); + + /* All done */ + return STATUS_SUCCESS; } +BOOL +NTAPI +DllMain(IN HINSTANCE hInstanceDll, + IN DWORD dwReason, + IN LPVOID lpReserved) +{ + UNREFERENCED_PARAMETER(hInstanceDll); + UNREFERENCED_PARAMETER(dwReason); + UNREFERENCED_PARAMETER(lpReserved); + + if (DLL_PROCESS_DETACH == dwReason) + { + BaseCleanupDefineDosDevice(); + } + + return TRUE; +} + /* EOF */ Index: subsystems/win/basesrv/proc.c =================================================================== --- subsystems/win/basesrv/proc.c (rvision 0) +++ subsystems/win/basesrv/proc.c (copie de travail) @@ -0,0 +1,246 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS/Win32 Base enviroment Subsystem Server + * FILE: subsystems/win/basesrv/proc.c + * PURPOSE: Process and Thread Management + * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include "basesrv.h" + +#define NDEBUG +#include + +/* PUBLIC SERVER APIS *********************************************************/ + +CSR_API(BaseSrvGetTempFile) +{ + static UINT BaseGetTempFileUnique = 0; + PBASE_GET_TEMP_FILE GetTempFile = &((PBASE_API_MESSAGE)ApiMessage)->Data.GetTempFile; + + /* Return 16-bits ID */ + GetTempFile->UniqueID = (++BaseGetTempFileUnique & 0xFFFF); + + DPRINT("Returning: %u\n", GetTempFile->UniqueID); + + return STATUS_SUCCESS; +} + +CSR_API(BaseSrvCreateProcess) +{ + NTSTATUS Status; + PBASE_CREATE_PROCESS CreateProcessRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.CreateProcessRequest; + HANDLE ProcessHandle, ThreadHandle; + PCSR_THREAD CsrThread; + PCSR_PROCESS Process; + ULONG Flags = 0, VdmPower = 0, DebugFlags = 0; + + /* Get the current client thread */ + CsrThread = CsrGetClientThread(); + ASSERT(CsrThread != NULL); + + Process = CsrThread->Process; + + /* Extract the flags out of the process handle */ + Flags = (ULONG_PTR)CreateProcessRequest->ProcessHandle & 3; + CreateProcessRequest->ProcessHandle = (HANDLE)((ULONG_PTR)CreateProcessRequest->ProcessHandle & ~3); + + /* Duplicate the process handle */ + Status = NtDuplicateObject(Process->ProcessHandle, + CreateProcessRequest->ProcessHandle, + NtCurrentProcess(), + &ProcessHandle, + 0, + 0, + DUPLICATE_SAME_ACCESS); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to duplicate process handle\n"); + return Status; + } + + /* Duplicate the thread handle */ + Status = NtDuplicateObject(Process->ProcessHandle, + CreateProcessRequest->ThreadHandle, + NtCurrentProcess(), + &ThreadHandle, + 0, + 0, + DUPLICATE_SAME_ACCESS); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to duplicate process handle\n"); + NtClose(ProcessHandle); + return Status; + } + + /* See if this is a VDM process */ + if (VdmPower) + { + /* Request VDM powers */ + Status = NtSetInformationProcess(ProcessHandle, + ProcessWx86Information, + &VdmPower, + sizeof(VdmPower)); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to get VDM powers\n"); + NtClose(ProcessHandle); + NtClose(ThreadHandle); + return Status; + } + } + + /* Flags conversion. FIXME: More need conversion */ + if (CreateProcessRequest->CreationFlags & CREATE_NEW_PROCESS_GROUP) + { + DebugFlags |= CsrProcessCreateNewGroup; + } + if ((Flags & 2) == 0) + { + /* We are launching a console process */ + DebugFlags |= CsrProcessIsConsoleApp; + } + + /* FIXME: SxS Stuff */ + + /* Call CSRSRV to create the CSR_PROCESS structure and the first CSR_THREAD */ + Status = CsrCreateProcess(ProcessHandle, + ThreadHandle, + &CreateProcessRequest->ClientId, + Process->NtSession, + DebugFlags, + NULL); + if (Status == STATUS_THREAD_IS_TERMINATING) + { + DPRINT1("Thread already dead\n"); + + /* Set the special reply value so we don't reply this message back */ + *ReplyCode = CsrReplyDeadClient; + + return Status; + } + + /* Check for other failures */ + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create process/thread structures: %lx\n", Status); + return Status; + } + + /* FIXME: Should notify user32 */ + + /* FIXME: VDM vodoo */ + + /* Return the result of this operation */ + return Status; +} + +CSR_API(BaseSrvCreateThread) +{ + NTSTATUS Status; + PBASE_CREATE_THREAD CreateThreadRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.CreateThreadRequest; + PCSR_THREAD CurrentThread; + HANDLE ThreadHandle; + PCSR_PROCESS CsrProcess; + + /* Get the current CSR thread */ + CurrentThread = CsrGetClientThread(); + if (!CurrentThread) + { + DPRINT1("Server Thread TID: [%lx.%lx]\n", + CreateThreadRequest->ClientId.UniqueProcess, + CreateThreadRequest->ClientId.UniqueThread); + return STATUS_SUCCESS; // server-to-server + } + + /* Get the CSR Process for this request */ + CsrProcess = CurrentThread->Process; + if (CsrProcess->ClientId.UniqueProcess != + CreateThreadRequest->ClientId.UniqueProcess) + { + /* This is a remote thread request -- is it within the server itself? */ + if (CreateThreadRequest->ClientId.UniqueProcess == NtCurrentTeb()->ClientId.UniqueProcess) + { + /* Accept this without any further work */ + return STATUS_SUCCESS; + } + + /* Get the real CSR Process for the remote thread's process */ + Status = CsrLockProcessByClientId(CreateThreadRequest->ClientId.UniqueProcess, + &CsrProcess); + if (!NT_SUCCESS(Status)) return Status; + } + + /* Duplicate the thread handle so we can own it */ + Status = NtDuplicateObject(CurrentThread->Process->ProcessHandle, + CreateThreadRequest->ThreadHandle, + NtCurrentProcess(), + &ThreadHandle, + 0, + 0, + DUPLICATE_SAME_ACCESS); + if (NT_SUCCESS(Status)) + { + /* Call CSRSRV to tell it about the new thread */ + Status = CsrCreateThread(CsrProcess, + ThreadHandle, + &CreateThreadRequest->ClientId, + TRUE); + } + + /* Unlock the process and return */ + if (CsrProcess != CurrentThread->Process) CsrUnlockProcess(CsrProcess); + return Status; +} + +CSR_API(BaseSrvExitProcess) +{ + PCSR_THREAD CsrThread = CsrGetClientThread(); + ASSERT(CsrThread != NULL); + + /* Set the special reply value so we don't reply this message back */ + *ReplyCode = CsrReplyDeadClient; + + /* Remove the CSR_THREADs and CSR_PROCESS */ + return CsrDestroyProcess(&CsrThread->ClientId, + (NTSTATUS)((PBASE_API_MESSAGE)ApiMessage)->Data.ExitProcessRequest.uExitCode); +} + +CSR_API(BaseSrvGetProcessShutdownParam) +{ + PBASE_GET_PROCESS_SHUTDOWN_PARAMS GetShutdownParametersRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.GetShutdownParametersRequest; + PCSR_THREAD CsrThread = CsrGetClientThread(); + ASSERT(CsrThread); + + GetShutdownParametersRequest->Level = CsrThread->Process->ShutdownLevel; + GetShutdownParametersRequest->Flags = CsrThread->Process->ShutdownFlags; + + return STATUS_SUCCESS; +} + +CSR_API(BaseSrvSetProcessShutdownParam) +{ + PBASE_SET_PROCESS_SHUTDOWN_PARAMS SetShutdownParametersRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.SetShutdownParametersRequest; + PCSR_THREAD CsrThread = CsrGetClientThread(); + ASSERT(CsrThread); + + CsrThread->Process->ShutdownLevel = SetShutdownParametersRequest->Level; + CsrThread->Process->ShutdownFlags = SetShutdownParametersRequest->Flags; + + return STATUS_SUCCESS; +} + +/* PUBLIC API *****************************************************************/ + +NTSTATUS +NTAPI +BaseSetProcessCreateNotify(IN BASE_PROCESS_CREATE_NOTIFY_ROUTINE ProcessCreateNotifyProc) +{ + DPRINT("BASESRV: %s(%08lx) called\n", __FUNCTION__, ProcessCreateNotifyProc); + return STATUS_NOT_IMPLEMENTED; +} + +/* EOF */ Index: subsystems/win/basesrv/proc.c =================================================================== --- subsystems/win/basesrv/proc.c (rvision 58607) +++ subsystems/win/basesrv/proc.c (copie de travail) Modification de proprits sur subsystems/win/basesrv/proc.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win/basesrv/sndsntry.c =================================================================== --- subsystems/win/basesrv/sndsntry.c (rvision 0) +++ subsystems/win/basesrv/sndsntry.c (copie de travail) @@ -0,0 +1,67 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS/Win32 Base enviroment Subsystem Server + * FILE: subsystems/win/basesrv/sndsntry.c + * PURPOSE: Sound Sentry Notifications + * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include "basesrv.h" + +#define NDEBUG +#include + +/* GLOBALS ********************************************************************/ + +typedef BOOL (WINAPI *PUSER_SOUND_SENTRY)(VOID); +BOOL NTAPI FirstSoundSentry(VOID); + +static PUSER_SOUND_SENTRY _UserSoundSentry = FirstSoundSentry; + +/* PRIVATE FUNCTIONS **********************************************************/ + +BOOL +NTAPI +FailSoundSentry(VOID) +{ + /* In case the function can't be found/is unimplemented */ + return FALSE; +} + +BOOL +NTAPI +FirstSoundSentry(VOID) +{ + UNICODE_STRING DllString = RTL_CONSTANT_STRING(L"winsrv"); + STRING FuncString = RTL_CONSTANT_STRING("_UserSoundSentry"); + HANDLE DllHandle; + NTSTATUS Status; + PUSER_SOUND_SENTRY NewSoundSentry = FailSoundSentry; + + /* Load winsrv manually */ + Status = LdrGetDllHandle(NULL, NULL, &DllString, &DllHandle); + if (NT_SUCCESS(Status)) + { + /* If it was found, get SoundSentry export */ + Status = LdrGetProcedureAddress(DllHandle, + &FuncString, + 0, + (PVOID*)&NewSoundSentry); + } + + /* Set it as the callback for the future, and call it */ + _UserSoundSentry = NewSoundSentry; + return _UserSoundSentry(); +} + +/* PUBLIC SERVER APIS *********************************************************/ + +CSR_API(BaseSrvSoundSentryNotification) +{ + /* Call the API and see if it succeeds */ + return (_UserSoundSentry() ? STATUS_SUCCESS : STATUS_ACCESS_DENIED); +} + +/* EOF */ Index: subsystems/win/basesrv/sndsntry.c =================================================================== --- subsystems/win/basesrv/sndsntry.c (rvision 58607) +++ subsystems/win/basesrv/sndsntry.c (copie de travail) Modification de proprits sur subsystems/win/basesrv/sndsntry.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: subsystems/win/CMakeLists.txt =================================================================== --- subsystems/win/CMakeLists.txt (rvision 0) +++ subsystems/win/CMakeLists.txt (copie de travail) @@ -0,0 +1,2 @@ + +add_subdirectory(basesrv) Index: subsystems/win/CMakeLists.txt =================================================================== --- subsystems/win/CMakeLists.txt (rvision 58607) +++ subsystems/win/CMakeLists.txt (copie de travail) Modification de proprits sur subsystems/win/CMakeLists.txt ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/CMakeLists.txt =================================================================== --- win32ss/CMakeLists.txt (rvision 58607) +++ win32ss/CMakeLists.txt (copie de travail) @@ -17,8 +17,9 @@ add_subdirectory(gdi/gdi32) add_subdirectory(reactx) +add_subdirectory(user/consrv) add_subdirectory(user/user32) -add_subdirectory(user/win32csr) +add_subdirectory(user/winsrv) spec2def(win32k.sys win32k.spec ADD_IMPORTLIB) @@ -105,7 +106,6 @@ user/ntuser/caret.c user/ntuser/class.c user/ntuser/clipboard.c - user/ntuser/csr.c user/ntuser/defwnd.c user/ntuser/desktop.c user/ntuser/display.c Index: win32ss/gdi/ntgdi/gdikdbgext.c =================================================================== --- win32ss/gdi/ntgdi/gdikdbgext.c (rvision 58607) +++ win32ss/gdi/ntgdi/gdikdbgext.c (copie de travail) @@ -14,7 +14,6 @@ extern PENTRY gpentHmgr; extern PULONG gpaulRefCount; -extern PEPROCESS gpepCSRSS; extern ULONG gulFirstUnused; Index: win32ss/include/ntuser.h =================================================================== --- win32ss/include/ntuser.h (rvision 58607) +++ win32ss/include/ntuser.h (copie de travail) @@ -1562,12 +1562,19 @@ NtUserCloseWindowStation( HWINSTA hWinSta); -DWORD -NTAPI +/* Console commands for NtUserConsoleControl */ +typedef enum _CONSOLECONTROL +{ + GuiConsoleWndClassAtom, + TuiConsoleWndClassAtom, +} CONSOLECONTROL, *PCONSOLECONTROL; + +NTSTATUS +APIENTRY NtUserConsoleControl( - DWORD dwUnknown1, - DWORD dwUnknown2, - DWORD dwUnknown3); + IN CONSOLECONTROL ConsoleCtrl, + IN PVOID ConsoleCtrlInfo, + IN DWORD ConsoleCtrlInfoLength); HANDLE NTAPI Index: win32ss/pch.h =================================================================== --- win32ss/pch.h (rvision 58607) +++ win32ss/pch.h (copie de travail) @@ -72,8 +72,9 @@ /* SEH support with PSEH */ #include -/* CSRSS header */ -#include +/* CSRSS Header */ +#include +#include /* Public Win32K headers */ #include Index: win32ss/user/consrv =================================================================== --- win32ss/user/consrv (rvision 58607) +++ win32ss/user/consrv (copie de travail) Modification de proprits sur win32ss/user/consrv ___________________________________________________________________ Added: bugtraq:url ## -0,0 +1 ## +http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID% \ No newline at end of property Added: bugtraq:message ## -0,0 +1 ## +See issue #%BUGID% for more details. \ No newline at end of property Added: tsvn:logminsize ## -0,0 +1 ## +10 \ No newline at end of property Added: bugtraq:logregex ## -0,0 +1,2 ## +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+) \ No newline at end of property Index: win32ss/user/consrv/alias.c =================================================================== --- win32ss/user/consrv/alias.c (rvision 0) +++ win32ss/user/consrv/alias.c (copie de travail) @@ -0,0 +1,586 @@ +/* + * LICENSE: GPL - See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/alias.c + * PURPOSE: Alias support functions + * PROGRAMMERS: Christoph Wittich + * Johannes Anderwald + */ + +/* INCLUDES *******************************************************************/ + +#include "consrv.h" +#include "conio.h" + +#define NDEBUG +#include + + +/* TYPES **********************************************************************/ + +typedef struct _ALIAS_ENTRY +{ + LPCWSTR lpSource; + LPCWSTR lpTarget; + struct _ALIAS_ENTRY* Next; +} ALIAS_ENTRY, *PALIAS_ENTRY; + +typedef struct _ALIAS_HEADER +{ + LPCWSTR lpExeName; + PALIAS_ENTRY Data; + struct _ALIAS_HEADER* Next; +} ALIAS_HEADER, *PALIAS_HEADER; + + +/* PRIVATE FUNCTIONS **********************************************************/ + +static +PALIAS_HEADER +IntFindAliasHeader(PALIAS_HEADER RootHeader, LPCWSTR lpExeName) +{ + while(RootHeader) + { + INT diff = _wcsicmp(RootHeader->lpExeName, lpExeName); + if (!diff) return RootHeader; + if (diff > 0) break; + + RootHeader = RootHeader->Next; + } + return NULL; +} + +PALIAS_HEADER +IntCreateAliasHeader(LPCWSTR lpExeName) +{ + PALIAS_HEADER Entry; + UINT dwLength = wcslen(lpExeName) + 1; + + Entry = RtlAllocateHeap(ConSrvHeap, 0, sizeof(ALIAS_HEADER) + sizeof(WCHAR) * dwLength); + if (!Entry) return Entry; + + Entry->lpExeName = (LPCWSTR)(Entry + 1); + wcscpy((PWCHAR)Entry->lpExeName, lpExeName); + Entry->Data = NULL; + Entry->Next = NULL; + return Entry; +} + +VOID +IntInsertAliasHeader(PALIAS_HEADER * RootHeader, PALIAS_HEADER NewHeader) +{ + PALIAS_HEADER CurrentHeader; + PALIAS_HEADER *LastLink = RootHeader; + + while ((CurrentHeader = *LastLink) != NULL) + { + INT Diff = _wcsicmp(NewHeader->lpExeName, CurrentHeader->lpExeName); + if (Diff < 0) break; + + LastLink = &CurrentHeader->Next; + } + + *LastLink = NewHeader; + NewHeader->Next = CurrentHeader; +} + +PALIAS_ENTRY +IntGetAliasEntry(PALIAS_HEADER Header, LPCWSTR lpSrcName) +{ + PALIAS_ENTRY RootHeader; + + if (Header == NULL) return NULL; + + RootHeader = Header->Data; + while(RootHeader) + { + INT diff; + DPRINT("IntGetAliasEntry->lpSource %S\n", RootHeader->lpSource); + diff = _wcsicmp(RootHeader->lpSource, lpSrcName); + if (!diff) return RootHeader; + if (diff > 0) break; + + RootHeader = RootHeader->Next; + } + return NULL; +} + +VOID +IntInsertAliasEntry(PALIAS_HEADER Header, PALIAS_ENTRY NewEntry) +{ + PALIAS_ENTRY CurrentEntry; + PALIAS_ENTRY *LastLink = &Header->Data; + + while ((CurrentEntry = *LastLink) != NULL) + { + INT Diff = _wcsicmp(NewEntry->lpSource, CurrentEntry->lpSource); + if (Diff < 0) break; + + LastLink = &CurrentEntry->Next; + } + + *LastLink = NewEntry; + NewEntry->Next = CurrentEntry; +} + +PALIAS_ENTRY +IntCreateAliasEntry(LPCWSTR lpSource, LPCWSTR lpTarget) +{ + UINT dwSource; + UINT dwTarget; + PALIAS_ENTRY Entry; + + dwSource = wcslen(lpSource) + 1; + dwTarget = wcslen(lpTarget) + 1; + + Entry = RtlAllocateHeap(ConSrvHeap, 0, sizeof(ALIAS_ENTRY) + sizeof(WCHAR) * (dwSource + dwTarget)); + if (!Entry) return Entry; + + Entry->lpSource = (LPCWSTR)(Entry + 1); + wcscpy((LPWSTR)Entry->lpSource, lpSource); + Entry->lpTarget = Entry->lpSource + dwSource; + wcscpy((LPWSTR)Entry->lpTarget, lpTarget); + Entry->Next = NULL; + + return Entry; +} + +UINT +IntGetConsoleAliasesExesLength(PALIAS_HEADER RootHeader) +{ + UINT length = 0; + + while(RootHeader) + { + length += (wcslen(RootHeader->lpExeName) + 1) * sizeof(WCHAR); + RootHeader = RootHeader->Next; + } + if (length) + length += sizeof(WCHAR); // last entry entry is terminated with 2 zero bytes + + return length; +} + +UINT +IntGetConsoleAliasesExes(PALIAS_HEADER RootHeader, LPWSTR TargetBuffer, UINT TargetBufferSize) +{ + UINT Offset = 0; + UINT Length; + + TargetBufferSize /= sizeof(WCHAR); + while(RootHeader) + { + Length = wcslen(RootHeader->lpExeName) + 1; + if (TargetBufferSize > Offset + Length) + { + wcscpy(&TargetBuffer[Offset], RootHeader->lpExeName); + Offset += Length; + } + else + { + break; + } + RootHeader = RootHeader->Next; + } + Length = min(Offset+1, TargetBufferSize); + TargetBuffer[Length] = L'\0'; + return Length * sizeof(WCHAR); +} + +UINT +IntGetAllConsoleAliasesLength(PALIAS_HEADER Header) +{ + UINT Length = 0; + PALIAS_ENTRY CurEntry = Header->Data; + + while(CurEntry) + { + Length += wcslen(CurEntry->lpSource); + Length += wcslen(CurEntry->lpTarget); + Length += 2; // zero byte and '=' + CurEntry = CurEntry->Next; + } + + if (Length) + { + return (Length+1) * sizeof(WCHAR); + } + return 0; +} + +UINT +IntGetAllConsoleAliases(PALIAS_HEADER Header, LPWSTR TargetBuffer, UINT TargetBufferLength) +{ + PALIAS_ENTRY CurEntry = Header->Data; + UINT Offset = 0; + UINT SrcLength, TargetLength; + + TargetBufferLength /= sizeof(WCHAR); + while(CurEntry) + { + SrcLength = wcslen(CurEntry->lpSource) + 1; + TargetLength = wcslen(CurEntry->lpTarget) + 1; + if (Offset + TargetLength + SrcLength >= TargetBufferLength) + break; + + wcscpy(&TargetBuffer[Offset], CurEntry->lpSource); + Offset += SrcLength; + TargetBuffer[Offset] = L'='; + wcscpy(&TargetBuffer[Offset], CurEntry->lpTarget); + Offset += TargetLength; + + CurEntry = CurEntry->Next; + } + TargetBuffer[Offset] = L'\0'; + return Offset * sizeof(WCHAR); +} + +VOID +IntDeleteAliasEntry(PALIAS_HEADER Header, PALIAS_ENTRY Entry) +{ + PALIAS_ENTRY *LastLink = &Header->Data; + PALIAS_ENTRY CurEntry; + + while ((CurEntry = *LastLink) != NULL) + { + if (CurEntry == Entry) + { + *LastLink = Entry->Next; + RtlFreeHeap(ConSrvHeap, 0, Entry); + return; + } + LastLink = &CurEntry->Next; + } +} + +VOID +IntDeleteAllAliases(PALIAS_HEADER RootHeader) +{ + PALIAS_HEADER Header, NextHeader; + PALIAS_ENTRY Entry, NextEntry; + + for (Header = RootHeader; Header; Header = NextHeader) + { + NextHeader = Header->Next; + for (Entry = Header->Data; Entry; Entry = NextEntry) + { + NextEntry = Entry->Next; + RtlFreeHeap(ConSrvHeap, 0, Entry); + } + RtlFreeHeap(ConSrvHeap, 0, Header); + } +} + + +/* PUBLIC SERVER APIS *********************************************************/ + +CSR_API(SrvAddConsoleAlias) +{ + PCONSOLE_ADDGETALIAS ConsoleAliasRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleAliasRequest; + PCONSOLE Console; + PALIAS_HEADER Header; + PALIAS_ENTRY Entry; + LPWSTR lpSource, lpTarget, lpExeName; + + DPRINT("SrvAddConsoleAlias entered ApiMessage %p\n", ApiMessage); + + if ( !CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&ConsoleAliasRequest->Source, + ConsoleAliasRequest->SourceLength, + sizeof(BYTE)) || + !CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&ConsoleAliasRequest->Target, + ConsoleAliasRequest->TargetLength, + sizeof(BYTE)) || + !CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&ConsoleAliasRequest->Exe, + ConsoleAliasRequest->ExeLength, + sizeof(BYTE)) ) + { + return STATUS_INVALID_PARAMETER; + } + + lpSource = ConsoleAliasRequest->Source; + lpTarget = (ConsoleAliasRequest->TargetLength != 0 ? ConsoleAliasRequest->Target : NULL); + lpExeName = ConsoleAliasRequest->Exe; + + DPRINT("SrvAddConsoleAlias lpSource %p lpExeName %p lpTarget %p\n", lpSource, lpExeName, lpTarget); + + if (lpExeName == NULL || lpSource == NULL) + { + return STATUS_INVALID_PARAMETER; + } + + ApiMessage->Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (!NT_SUCCESS(ApiMessage->Status)) + { + return ApiMessage->Status; + } + + Header = IntFindAliasHeader(Console->Aliases, lpExeName); + if (!Header && lpTarget != NULL) + { + Header = IntCreateAliasHeader(lpExeName); + if (!Header) + { + ConSrvReleaseConsole(Console, TRUE); + return STATUS_INSUFFICIENT_RESOURCES; + } + IntInsertAliasHeader(&Console->Aliases, Header); + } + + if (lpTarget == NULL) // Delete the entry + { + Entry = IntGetAliasEntry(Header, lpSource); + if (Entry) + { + IntDeleteAliasEntry(Header, Entry); + ApiMessage->Status = STATUS_SUCCESS; + } + else + { + ApiMessage->Status = STATUS_INVALID_PARAMETER; + } + ConSrvReleaseConsole(Console, TRUE); + return ApiMessage->Status; + } + + Entry = IntCreateAliasEntry(lpSource, lpTarget); + + if (!Entry) + { + ConSrvReleaseConsole(Console, TRUE); + return STATUS_INSUFFICIENT_RESOURCES; + } + + IntInsertAliasEntry(Header, Entry); + ConSrvReleaseConsole(Console, TRUE); + return STATUS_SUCCESS; +} + +CSR_API(SrvGetConsoleAlias) +{ + PCONSOLE_ADDGETALIAS ConsoleAliasRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleAliasRequest; + PCONSOLE Console; + PALIAS_HEADER Header; + PALIAS_ENTRY Entry; + UINT Length; + LPWSTR lpSource, lpTarget, lpExeName; + + DPRINT("SrvGetConsoleAlias entered ApiMessage %p\n", ApiMessage); + + if ( !CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&ConsoleAliasRequest->Source, + ConsoleAliasRequest->SourceLength, + sizeof(BYTE)) || + !CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&ConsoleAliasRequest->Target, + ConsoleAliasRequest->TargetLength, + sizeof(BYTE)) || + !CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&ConsoleAliasRequest->Exe, + ConsoleAliasRequest->ExeLength, + sizeof(BYTE)) ) + { + return STATUS_INVALID_PARAMETER; + } + + lpSource = ConsoleAliasRequest->Source; + lpTarget = ConsoleAliasRequest->Target; + lpExeName = ConsoleAliasRequest->Exe; + + DPRINT("SrvGetConsoleAlias lpExeName %p lpSource %p TargetBuffer %p TargetLength %u\n", + lpExeName, lpSource, lpTarget, ConsoleAliasRequest->TargetLength); + + if (ConsoleAliasRequest->ExeLength == 0 || lpTarget == NULL || + ConsoleAliasRequest->TargetLength == 0 || ConsoleAliasRequest->SourceLength == 0) + { + return STATUS_INVALID_PARAMETER; + } + + ApiMessage->Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (!NT_SUCCESS(ApiMessage->Status)) + { + return ApiMessage->Status; + } + + Header = IntFindAliasHeader(Console->Aliases, lpExeName); + if (!Header) + { + ConSrvReleaseConsole(Console, TRUE); + return STATUS_INVALID_PARAMETER; + } + + Entry = IntGetAliasEntry(Header, lpSource); + if (!Entry) + { + ConSrvReleaseConsole(Console, TRUE); + return STATUS_INVALID_PARAMETER; + } + + Length = (wcslen(Entry->lpTarget) + 1) * sizeof(WCHAR); + if (Length > ConsoleAliasRequest->TargetLength) + { + ConSrvReleaseConsole(Console, TRUE); + return STATUS_BUFFER_TOO_SMALL; + } + + wcscpy(lpTarget, Entry->lpTarget); + ConsoleAliasRequest->TargetLength = Length; + ConSrvReleaseConsole(Console, TRUE); + return STATUS_SUCCESS; +} + +CSR_API(SrvGetConsoleAliases) +{ + PCONSOLE_GETALLALIASES GetAllAliasesRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAllAliasesRequest; + PCONSOLE Console; + ULONG BytesWritten; + PALIAS_HEADER Header; + + if ( !CsrValidateMessageBuffer(ApiMessage, + (PVOID)&GetAllAliasesRequest->ExeName, + GetAllAliasesRequest->ExeLength, + sizeof(BYTE)) || + !CsrValidateMessageBuffer(ApiMessage, + (PVOID)&GetAllAliasesRequest->AliasesBuffer, + GetAllAliasesRequest->AliasesBufferLength, + sizeof(BYTE)) ) + { + return STATUS_INVALID_PARAMETER; + } + + if (GetAllAliasesRequest->ExeName == NULL) + { + return STATUS_INVALID_PARAMETER; + } + + ApiMessage->Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (!NT_SUCCESS(ApiMessage->Status)) + { + return ApiMessage->Status; + } + + Header = IntFindAliasHeader(Console->Aliases, GetAllAliasesRequest->ExeName); + if (!Header) + { + ConSrvReleaseConsole(Console, TRUE); + return STATUS_INVALID_PARAMETER; + } + + if (IntGetAllConsoleAliasesLength(Header) > GetAllAliasesRequest->AliasesBufferLength) + { + ConSrvReleaseConsole(Console, TRUE); + return STATUS_BUFFER_OVERFLOW; + } + + BytesWritten = IntGetAllConsoleAliases(Header, + GetAllAliasesRequest->AliasesBuffer, + GetAllAliasesRequest->AliasesBufferLength); + + GetAllAliasesRequest->AliasesBufferLength = BytesWritten; + ConSrvReleaseConsole(Console, TRUE); + return STATUS_SUCCESS; +} + +CSR_API(SrvGetConsoleAliasesLength) +{ + PCONSOLE_GETALLALIASESLENGTH GetAllAliasesLengthRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAllAliasesLengthRequest; + PCONSOLE Console; + PALIAS_HEADER Header; + UINT Length; + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID)&GetAllAliasesLengthRequest->ExeName, + GetAllAliasesLengthRequest->ExeLength, + sizeof(BYTE))) + { + return STATUS_INVALID_PARAMETER; + } + + if (GetAllAliasesLengthRequest->ExeName == NULL) + { + return STATUS_INVALID_PARAMETER; + } + + ApiMessage->Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (!NT_SUCCESS(ApiMessage->Status)) + { + return ApiMessage->Status; + } + + Header = IntFindAliasHeader(Console->Aliases, GetAllAliasesLengthRequest->ExeName); + if (!Header) + { + ConSrvReleaseConsole(Console, TRUE); + return STATUS_INVALID_PARAMETER; + } + + Length = IntGetAllConsoleAliasesLength(Header); + GetAllAliasesLengthRequest->Length = Length; + ConSrvReleaseConsole(Console, TRUE); + return STATUS_SUCCESS; +} + +CSR_API(SrvGetConsoleAliasExes) +{ + PCONSOLE_GETALIASESEXES GetAliasesExesRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAliasesExesRequest; + PCONSOLE Console; + UINT BytesWritten; + UINT ExesLength; + + DPRINT("SrvGetConsoleAliasExes entered\n"); + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID)&GetAliasesExesRequest->ExeNames, + GetAliasesExesRequest->Length, + sizeof(BYTE))) + { + return STATUS_INVALID_PARAMETER; + } + + ApiMessage->Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (!NT_SUCCESS(ApiMessage->Status)) + { + return ApiMessage->Status; + } + + ExesLength = IntGetConsoleAliasesExesLength(Console->Aliases); + + if (ExesLength > GetAliasesExesRequest->Length) + { + ConSrvReleaseConsole(Console, TRUE); + return STATUS_BUFFER_OVERFLOW; + } + + if (GetAliasesExesRequest->ExeNames == NULL) + { + ConSrvReleaseConsole(Console, TRUE); + return STATUS_INVALID_PARAMETER; + } + + BytesWritten = IntGetConsoleAliasesExes(Console->Aliases, + GetAliasesExesRequest->ExeNames, + GetAliasesExesRequest->Length); + + GetAliasesExesRequest->Length = BytesWritten; + ConSrvReleaseConsole(Console, TRUE); + return STATUS_SUCCESS; +} + +CSR_API(SrvGetConsoleAliasExesLength) +{ + PCONSOLE_GETALIASESEXESLENGTH GetAliasesExesLengthRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAliasesExesLengthRequest; + PCONSOLE Console; + DPRINT("SrvGetConsoleAliasExesLength entered\n"); + + ApiMessage->Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (NT_SUCCESS(ApiMessage->Status)) + { + GetAliasesExesLengthRequest->Length = IntGetConsoleAliasesExesLength(Console->Aliases); + ConSrvReleaseConsole(Console, TRUE); + } + return ApiMessage->Status; +} + +/* EOF */ Index: win32ss/user/consrv/alias.c =================================================================== --- win32ss/user/consrv/alias.c (rvision 58607) +++ win32ss/user/consrv/alias.c (copie de travail) Modification de proprits sur win32ss/user/consrv/alias.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/CMakeLists.txt =================================================================== --- win32ss/user/consrv/CMakeLists.txt (rvision 0) +++ win32ss/user/consrv/CMakeLists.txt (copie de travail) @@ -0,0 +1,33 @@ + +include_directories( + ${REACTOS_SOURCE_DIR}/include/reactos/subsys + ${REACTOS_SOURCE_DIR}/win32ss/include) + +spec2def(consrv.dll consrv.spec) + +list(APPEND SOURCE + alias.c + coninput.c + conoutput.c + console.c + guiconsole.c + guisettings.c + handle.c + init.c + lineinput.c + settings.c + tuiconsole.c + consrv.rc + ${CMAKE_CURRENT_BINARY_DIR}/consrv.def) + +add_library(consrv SHARED ${SOURCE}) + +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 ole32) + +add_dependencies(consrv bugcodes) +add_cd_file(TARGET consrv DESTINATION reactos/system32 FOR all) Index: win32ss/user/consrv/CMakeLists.txt =================================================================== --- win32ss/user/consrv/CMakeLists.txt (rvision 58607) +++ win32ss/user/consrv/CMakeLists.txt (copie de travail) Modification de proprits sur win32ss/user/consrv/CMakeLists.txt ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/coninput.c =================================================================== --- win32ss/user/consrv/coninput.c (rvision 0) +++ win32ss/user/consrv/coninput.c (copie de travail) @@ -0,0 +1,867 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/coninput.c + * PURPOSE: Console I/O functions + * PROGRAMMERS: + */ + +/* INCLUDES *******************************************************************/ + +#include "consrv.h" +#include "conio.h" + +#define NDEBUG +#include + + +/* GLOBALS ********************************************************************/ + +#define ConsoleInputUnicodeCharToAnsiChar(Console, dChar, sWChar) \ + WideCharToMultiByte((Console)->CodePage, 0, (sWChar), 1, (dChar), 1, NULL, NULL) + +#define ConsoleInputAnsiCharToUnicodeChar(Console, dWChar, sChar) \ + MultiByteToWideChar((Console)->CodePage, 0, (sChar), 1, (dWChar), 1) + + +typedef struct _GET_INPUT_INFO +{ + PCSR_THREAD CallingThread; // The thread which called the input API. + PCONSOLE_IO_HANDLE HandleEntry; // The handle data associated with the wait thread. + PCONSOLE_INPUT_BUFFER InputBuffer; // The input buffer corresponding to the handle. +} GET_INPUT_INFO, *PGET_INPUT_INFO; + + +/* PRIVATE FUNCTIONS **********************************************************/ + +static VOID FASTCALL +ConioInputEventToAnsi(PCONSOLE Console, PINPUT_RECORD InputEvent) +{ + if (InputEvent->EventType == KEY_EVENT) + { + WCHAR UnicodeChar = InputEvent->Event.KeyEvent.uChar.UnicodeChar; + InputEvent->Event.KeyEvent.uChar.UnicodeChar = 0; + ConsoleInputUnicodeCharToAnsiChar(Console, + &InputEvent->Event.KeyEvent.uChar.AsciiChar, + &UnicodeChar); + } +} + +static NTSTATUS FASTCALL +ConioProcessChar(PCONSOLE Console, + PINPUT_RECORD InputEvent) +{ + ConsoleInput *ConInRec; + + /* Check for pause or unpause */ + if (InputEvent->EventType == KEY_EVENT && InputEvent->Event.KeyEvent.bKeyDown) + { + WORD vk = InputEvent->Event.KeyEvent.wVirtualKeyCode; + if (!(Console->PauseFlags & PAUSED_FROM_KEYBOARD)) + { + DWORD cks = InputEvent->Event.KeyEvent.dwControlKeyState; + if (Console->InputBuffer.Mode & ENABLE_LINE_INPUT && + (vk == VK_PAUSE || (vk == 'S' && + (cks & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) && + !(cks & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED))))) + { + ConioPause(Console, PAUSED_FROM_KEYBOARD); + return STATUS_SUCCESS; + } + } + else + { + if ((vk < VK_SHIFT || vk > VK_CAPITAL) && vk != VK_LWIN && + vk != VK_RWIN && vk != VK_NUMLOCK && vk != VK_SCROLL) + { + ConioUnpause(Console, PAUSED_FROM_KEYBOARD); + return STATUS_SUCCESS; + } + } + } + + /* add event to the queue */ + ConInRec = RtlAllocateHeap(ConSrvHeap, 0, sizeof(ConsoleInput)); + if (ConInRec == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + ConInRec->InputEvent = *InputEvent; + InsertTailList(&Console->InputBuffer.InputEvents, &ConInRec->ListEntry); + + SetEvent(Console->InputBuffer.ActiveEvent); + CsrNotifyWait(&Console->InputBuffer.ReadWaitQueue, + WaitAny, + NULL, + NULL); + if (!IsListEmpty(&Console->InputBuffer.ReadWaitQueue)) + { + CsrDereferenceWait(&Console->InputBuffer.ReadWaitQueue); + } + + return STATUS_SUCCESS; +} + +static DWORD FASTCALL +ConioGetShiftState(PBYTE KeyState) +{ + DWORD ssOut = 0; + + if (KeyState[VK_CAPITAL] & 1) + ssOut |= CAPSLOCK_ON; + + if (KeyState[VK_NUMLOCK] & 1) + ssOut |= NUMLOCK_ON; + + if (KeyState[VK_SCROLL] & 1) + ssOut |= SCROLLLOCK_ON; + + if (KeyState[VK_SHIFT] & 0x80) + ssOut |= SHIFT_PRESSED; + + if (KeyState[VK_LCONTROL] & 0x80) + ssOut |= LEFT_CTRL_PRESSED; + if (KeyState[VK_RCONTROL] & 0x80) + ssOut |= RIGHT_CTRL_PRESSED; + + if (KeyState[VK_LMENU] & 0x80) + ssOut |= LEFT_ALT_PRESSED; + if (KeyState[VK_RMENU] & 0x80) + ssOut |= RIGHT_ALT_PRESSED; + + return ssOut; +} + +VOID WINAPI +ConioProcessKey(PCONSOLE Console, MSG* msg) +{ + static BYTE KeyState[256] = { 0 }; + /* MSDN mentions that you should use the last virtual key code received + * when putting a virtual key identity to a WM_CHAR message since multiple + * or translated keys may be involved. */ + static UINT LastVirtualKey = 0; + DWORD ShiftState; + UINT RepeatCount; + WCHAR UnicodeChar; + UINT VirtualKeyCode; + UINT VirtualScanCode; + BOOL Down = FALSE; + INPUT_RECORD er; + BOOLEAN Fake; // synthesized, not a real event + BOOLEAN NotChar; // message should not be used to return a character + + if (NULL == Console) + { + DPRINT1("No Active Console!\n"); + return; + } + + RepeatCount = 1; + VirtualScanCode = (msg->lParam >> 16) & 0xff; + Down = msg->message == WM_KEYDOWN || msg->message == WM_CHAR || + msg->message == WM_SYSKEYDOWN || msg->message == WM_SYSCHAR; + + GetKeyboardState(KeyState); + ShiftState = ConioGetShiftState(KeyState); + + if (msg->message == WM_CHAR || msg->message == WM_SYSCHAR) + { + VirtualKeyCode = LastVirtualKey; + UnicodeChar = msg->wParam; + } + else + { + WCHAR Chars[2]; + INT RetChars = 0; + + VirtualKeyCode = msg->wParam; + RetChars = ToUnicodeEx(VirtualKeyCode, + VirtualScanCode, + KeyState, + Chars, + 2, + 0, + 0); + UnicodeChar = (1 == RetChars ? Chars[0] : 0); + } + + er.EventType = KEY_EVENT; + er.Event.KeyEvent.bKeyDown = Down; + er.Event.KeyEvent.wRepeatCount = RepeatCount; + er.Event.KeyEvent.uChar.UnicodeChar = UnicodeChar; + er.Event.KeyEvent.dwControlKeyState = ShiftState; + er.Event.KeyEvent.wVirtualKeyCode = VirtualKeyCode; + er.Event.KeyEvent.wVirtualScanCode = VirtualScanCode; + + if (ConioProcessKeyCallback(Console, + msg, + KeyState[VK_MENU], + ShiftState, + VirtualKeyCode, + Down)) + { + return; + } + + Fake = UnicodeChar && + (msg->message != WM_CHAR && msg->message != WM_SYSCHAR && + msg->message != WM_KEYUP && msg->message != WM_SYSKEYUP); + NotChar = (msg->message != WM_CHAR && msg->message != WM_SYSCHAR); + if (NotChar) LastVirtualKey = msg->wParam; + + DPRINT("CONSRV: %s %s %s %s %02x %02x '%lc' %04x\n", + Down ? "down" : "up ", + (msg->message == WM_CHAR || msg->message == WM_SYSCHAR) ? + "char" : "key ", + Fake ? "fake" : "real", + NotChar ? "notc" : "char", + VirtualScanCode, + VirtualKeyCode, + (UnicodeChar >= L' ') ? UnicodeChar : L'.', + ShiftState); + + if (Fake) return; + + /* process Ctrl-C and Ctrl-Break */ + if (Console->InputBuffer.Mode & ENABLE_PROCESSED_INPUT && + er.Event.KeyEvent.bKeyDown && + ((er.Event.KeyEvent.wVirtualKeyCode == VK_PAUSE) || + (er.Event.KeyEvent.wVirtualKeyCode == 'C')) && + (er.Event.KeyEvent.dwControlKeyState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED) || KeyState[VK_CONTROL] & 0x80)) + { + DPRINT1("Console_Api Ctrl-C\n"); + ConSrvConsoleProcessCtrlEvent(Console, 0, CTRL_C_EVENT); + + if (Console->LineBuffer && !Console->LineComplete) + { + /* Line input is in progress; end it */ + Console->LinePos = Console->LineSize = 0; + Console->LineComplete = TRUE; + } + return; + } + + if (0 != (er.Event.KeyEvent.dwControlKeyState + & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED)) + && (VK_UP == er.Event.KeyEvent.wVirtualKeyCode + || VK_DOWN == er.Event.KeyEvent.wVirtualKeyCode)) + { + if (er.Event.KeyEvent.bKeyDown) + { + /* scroll up or down */ + if (VK_UP == er.Event.KeyEvent.wVirtualKeyCode) + { + /* only scroll up if there is room to scroll up into */ + if (Console->ActiveBuffer->CursorPosition.Y != Console->ActiveBuffer->ScreenBufferSize.Y - 1) + { + Console->ActiveBuffer->VirtualY = (Console->ActiveBuffer->VirtualY + + Console->ActiveBuffer->ScreenBufferSize.Y - 1) % + Console->ActiveBuffer->ScreenBufferSize.Y; + Console->ActiveBuffer->CursorPosition.Y++; + } + } + else + { + /* only scroll down if there is room to scroll down into */ + if (Console->ActiveBuffer->CursorPosition.Y != 0) + { + Console->ActiveBuffer->VirtualY = (Console->ActiveBuffer->VirtualY + 1) % + Console->ActiveBuffer->ScreenBufferSize.Y; + Console->ActiveBuffer->CursorPosition.Y--; + } + } + ConioDrawConsole(Console); + } + return; + } + ConioProcessChar(Console, &er); +} + +static NTSTATUS +WaitBeforeReading(IN PGET_INPUT_INFO InputInfo, + IN PCSR_API_MESSAGE ApiMessage, + IN CSR_WAIT_FUNCTION WaitFunction OPTIONAL, + IN BOOL CreateWaitBlock OPTIONAL) +{ + if (CreateWaitBlock) + { + PGET_INPUT_INFO CapturedInputInfo; + + CapturedInputInfo = RtlAllocateHeap(ConSrvHeap, 0, sizeof(GET_INPUT_INFO)); + if (!CapturedInputInfo) return STATUS_NO_MEMORY; + + RtlMoveMemory(CapturedInputInfo, InputInfo, sizeof(GET_INPUT_INFO)); + + if (!CsrCreateWait(&InputInfo->InputBuffer->ReadWaitQueue, + WaitFunction, + InputInfo->CallingThread, + ApiMessage, + CapturedInputInfo, + NULL)) + { + RtlFreeHeap(ConSrvHeap, 0, CapturedInputInfo); + return STATUS_NO_MEMORY; + } + } + + /* Wait for input */ + return STATUS_PENDING; +} + +static NTSTATUS +ReadInputBuffer(IN PGET_INPUT_INFO InputInfo, + IN BOOL Wait, + IN PCSR_API_MESSAGE ApiMessage, + IN BOOL CreateWaitBlock OPTIONAL); + +// Wait function CSR_WAIT_FUNCTION +static BOOLEAN +ReadInputBufferThread(IN PLIST_ENTRY WaitList, + IN PCSR_THREAD WaitThread, + IN PCSR_API_MESSAGE WaitApiMessage, + IN PVOID WaitContext, + IN PVOID WaitArgument1, + IN PVOID WaitArgument2, + IN ULONG WaitFlags) +{ + NTSTATUS Status; + PCONSOLE_GETINPUT GetInputRequest = &((PCONSOLE_API_MESSAGE)WaitApiMessage)->Data.GetInputRequest; + PGET_INPUT_INFO InputInfo = (PGET_INPUT_INFO)WaitContext; + + PCONSOLE_IO_HANDLE InputHandle = (PCONSOLE_IO_HANDLE)WaitArgument2; + + DPRINT1("ReadInputBufferThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags); + + /* + * If we are notified of the process termination via a call + * to CsrNotifyWaitBlock triggered by CsrDestroyProcess or + * CsrDestroyThread, just return. + */ + if (WaitFlags & CsrProcessTerminating) + { + Status = STATUS_THREAD_IS_TERMINATING; + goto Quit; + } + + /* + * Somebody is closing a handle to this input buffer, + * by calling ConSrvCloseHandleEntry. + * See whether we are linked to that handle (ie. we + * are a waiter for this handle), and if so, return. + * Otherwise, ignore the call and continue waiting. + */ + if (InputHandle != NULL) + { + Status = (InputHandle == InputInfo->HandleEntry ? STATUS_ALERTED + : STATUS_PENDING); + goto Quit; + } + + /* + * If we go there, that means we are notified for some new input. + * The console is therefore already locked. + */ + Status = ReadInputBuffer(InputInfo, + GetInputRequest->bRead, + WaitApiMessage, + FALSE); + +Quit: + if (Status != STATUS_PENDING) + { + WaitApiMessage->Status = Status; + RtlFreeHeap(ConSrvHeap, 0, InputInfo); + } + + return (Status == STATUS_PENDING ? FALSE : TRUE); +} + +static NTSTATUS +ReadInputBuffer(IN PGET_INPUT_INFO InputInfo, + IN BOOL Wait, // TRUE --> Read ; FALSE --> Peek + IN PCSR_API_MESSAGE ApiMessage, + IN BOOL CreateWaitBlock OPTIONAL) +{ + PCONSOLE_INPUT_BUFFER InputBuffer = InputInfo->InputBuffer; + + if (IsListEmpty(&InputBuffer->InputEvents)) + { + if (Wait) + { + return WaitBeforeReading(InputInfo, + ApiMessage, + ReadInputBufferThread, + CreateWaitBlock); + } + else + { + /* No input available and we don't wait, so we return success */ + return STATUS_SUCCESS; + } + } + else + { + PCONSOLE_GETINPUT GetInputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetInputRequest; + PLIST_ENTRY CurrentInput; + ConsoleInput* Input; + ULONG Length = GetInputRequest->Length; + PINPUT_RECORD InputRecord = GetInputRequest->InputRecord; + + /* Only get input if there is any */ + CurrentInput = InputBuffer->InputEvents.Flink; + + while ( CurrentInput != &InputBuffer->InputEvents && + GetInputRequest->InputsRead < Length ) + { + Input = CONTAINING_RECORD(CurrentInput, ConsoleInput, ListEntry); + + GetInputRequest->InputsRead++; + *InputRecord = Input->InputEvent; + + if (GetInputRequest->Unicode == FALSE) + { + ConioInputEventToAnsi(InputBuffer->Header.Console, InputRecord); + } + + InputRecord++; + CurrentInput = CurrentInput->Flink; + + if (Wait) // TRUE --> Read, we remove inputs from the buffer ; FALSE --> Peek, we keep inputs. + { + RemoveEntryList(&Input->ListEntry); + RtlFreeHeap(ConSrvHeap, 0, Input); + } + } + + if (IsListEmpty(&InputBuffer->InputEvents)) + { + ResetEvent(InputBuffer->ActiveEvent); + } + + /* We read all the inputs available, we return success */ + return STATUS_SUCCESS; + } +} + +static NTSTATUS +ReadChars(IN PGET_INPUT_INFO InputInfo, + IN PCSR_API_MESSAGE ApiMessage, + IN BOOL CreateWaitBlock OPTIONAL); + +// Wait function CSR_WAIT_FUNCTION +static BOOLEAN +ReadCharsThread(IN PLIST_ENTRY WaitList, + IN PCSR_THREAD WaitThread, + IN PCSR_API_MESSAGE WaitApiMessage, + IN PVOID WaitContext, + IN PVOID WaitArgument1, + IN PVOID WaitArgument2, + IN ULONG WaitFlags) +{ + NTSTATUS Status; + PGET_INPUT_INFO InputInfo = (PGET_INPUT_INFO)WaitContext; + + PCONSOLE_IO_HANDLE InputHandle = (PCONSOLE_IO_HANDLE)WaitArgument2; + + DPRINT1("ReadCharsThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags); + + /* + * If we are notified of the process termination via a call + * to CsrNotifyWaitBlock triggered by CsrDestroyProcess or + * CsrDestroyThread, just return. + */ + if (WaitFlags & CsrProcessTerminating) + { + Status = STATUS_THREAD_IS_TERMINATING; + goto Quit; + } + + /* + * Somebody is closing a handle to this input buffer, + * by calling ConSrvCloseHandleEntry. + * See whether we are linked to that handle (ie. we + * are a waiter for this handle), and if so, return. + * Otherwise, ignore the call and continue waiting. + */ + if (InputHandle != NULL) + { + Status = (InputHandle == InputInfo->HandleEntry ? STATUS_ALERTED + : STATUS_PENDING); + goto Quit; + } + + /* + * If we go there, that means we are notified for some new input. + * The console is therefore already locked. + */ + Status = ReadChars(InputInfo, + WaitApiMessage, + FALSE); + +Quit: + if (Status != STATUS_PENDING) + { + WaitApiMessage->Status = Status; + RtlFreeHeap(ConSrvHeap, 0, InputInfo); + } + + return (Status == STATUS_PENDING ? FALSE : TRUE); +} + +static NTSTATUS +ReadChars(IN PGET_INPUT_INFO InputInfo, + IN PCSR_API_MESSAGE ApiMessage, + IN BOOL CreateWaitBlock OPTIONAL) +{ + BOOL WaitForMoreToRead = TRUE; // TRUE : Wait if more to read ; FALSE : Don't wait. + + PCONSOLE_READCONSOLE ReadConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadConsoleRequest; + PCONSOLE_INPUT_BUFFER InputBuffer = InputInfo->InputBuffer; + PCONSOLE Console = InputBuffer->Header.Console; + PLIST_ENTRY CurrentEntry; + ConsoleInput *Input; + PCHAR Buffer = (PCHAR)ReadConsoleRequest->Buffer; + PWCHAR UnicodeBuffer = (PWCHAR)Buffer; + ULONG nNumberOfCharsToRead = ReadConsoleRequest->NrCharactersToRead; + + /* We haven't read anything (yet) */ + + if (InputBuffer->Mode & ENABLE_LINE_INPUT) + { + if (Console->LineBuffer == NULL) + { + /* Starting a new line */ + Console->LineMaxSize = max(256, nNumberOfCharsToRead); + Console->LineBuffer = RtlAllocateHeap(ConSrvHeap, 0, Console->LineMaxSize * sizeof(WCHAR)); + if (Console->LineBuffer == NULL) + { + return STATUS_NO_MEMORY; + } + Console->LineComplete = FALSE; + Console->LineUpPressed = FALSE; + Console->LineInsertToggle = 0; + Console->LineWakeupMask = ReadConsoleRequest->CtrlWakeupMask; + Console->LineSize = ReadConsoleRequest->NrCharactersRead; + Console->LinePos = Console->LineSize; + + /* + * Pre-filling the buffer is only allowed in the Unicode API, + * so we don't need to worry about ANSI <-> Unicode conversion. + */ + memcpy(Console->LineBuffer, Buffer, Console->LineSize * sizeof(WCHAR)); + if (Console->LineSize == Console->LineMaxSize) + { + Console->LineComplete = TRUE; + Console->LinePos = 0; + } + } + + /* If we don't have a complete line yet, process the pending input */ + while ( !Console->LineComplete && + !IsListEmpty(&InputBuffer->InputEvents) ) + { + /* Remove input event from queue */ + CurrentEntry = RemoveHeadList(&InputBuffer->InputEvents); + if (IsListEmpty(&InputBuffer->InputEvents)) + { + ResetEvent(InputBuffer->ActiveEvent); + } + Input = CONTAINING_RECORD(CurrentEntry, ConsoleInput, ListEntry); + + /* Only pay attention to key down */ + if (KEY_EVENT == Input->InputEvent.EventType + && Input->InputEvent.Event.KeyEvent.bKeyDown) + { + LineInputKeyDown(Console, &Input->InputEvent.Event.KeyEvent); + ReadConsoleRequest->ControlKeyState = Input->InputEvent.Event.KeyEvent.dwControlKeyState; + } + RtlFreeHeap(ConSrvHeap, 0, Input); + } + + /* Check if we have a complete line to read from */ + if (Console->LineComplete) + { + while ( ReadConsoleRequest->NrCharactersRead < nNumberOfCharsToRead && + Console->LinePos != Console->LineSize ) + { + WCHAR Char = Console->LineBuffer[Console->LinePos++]; + + if (ReadConsoleRequest->Unicode) + { + UnicodeBuffer[ReadConsoleRequest->NrCharactersRead] = Char; + } + else + { + ConsoleInputUnicodeCharToAnsiChar(Console, + &Buffer[ReadConsoleRequest->NrCharactersRead], + &Char); + } + + ReadConsoleRequest->NrCharactersRead++; + } + + if (Console->LinePos == Console->LineSize) + { + /* Entire line has been read */ + RtlFreeHeap(ConSrvHeap, 0, Console->LineBuffer); + Console->LineBuffer = NULL; + } + + WaitForMoreToRead = FALSE; + } + } + else + { + /* Character input */ + while ( ReadConsoleRequest->NrCharactersRead < nNumberOfCharsToRead && + !IsListEmpty(&InputBuffer->InputEvents) ) + { + /* Remove input event from queue */ + CurrentEntry = RemoveHeadList(&InputBuffer->InputEvents); + if (IsListEmpty(&InputBuffer->InputEvents)) + { + ResetEvent(InputBuffer->ActiveEvent); + } + Input = CONTAINING_RECORD(CurrentEntry, ConsoleInput, ListEntry); + + /* Only pay attention to valid ascii chars, on key down */ + if (KEY_EVENT == Input->InputEvent.EventType + && Input->InputEvent.Event.KeyEvent.bKeyDown + && Input->InputEvent.Event.KeyEvent.uChar.UnicodeChar != L'\0') + { + WCHAR Char = Input->InputEvent.Event.KeyEvent.uChar.UnicodeChar; + + if (ReadConsoleRequest->Unicode) + { + UnicodeBuffer[ReadConsoleRequest->NrCharactersRead] = Char; + } + else + { + ConsoleInputUnicodeCharToAnsiChar(Console, + &Buffer[ReadConsoleRequest->NrCharactersRead], + &Char); + } + + ReadConsoleRequest->NrCharactersRead++; + + /* Did read something */ + WaitForMoreToRead = FALSE; + } + RtlFreeHeap(ConSrvHeap, 0, Input); + } + } + + /* We haven't completed a read, so start a wait */ + if (WaitForMoreToRead == TRUE) + { + return WaitBeforeReading(InputInfo, + ApiMessage, + ReadCharsThread, + CreateWaitBlock); + } + else /* We read all what we wanted, we return success */ + { + return STATUS_SUCCESS; + } +} + + +/* PUBLIC SERVER APIS *********************************************************/ + +CSR_API(SrvReadConsole) +{ + NTSTATUS Status; + PCONSOLE_READCONSOLE ReadConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadConsoleRequest; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + PCONSOLE_IO_HANDLE HandleEntry; + PCONSOLE_INPUT_BUFFER InputBuffer; + GET_INPUT_INFO InputInfo; + + DPRINT("SrvReadConsole\n"); + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&ReadConsoleRequest->Buffer, + ReadConsoleRequest->BufferSize, + sizeof(BYTE))) + { + return STATUS_INVALID_PARAMETER; + } + + // if (Request->Data.ReadConsoleRequest.NrCharactersRead * sizeof(WCHAR) > nNumberOfCharsToRead * CharSize) + if (ReadConsoleRequest->NrCharactersRead > ReadConsoleRequest->NrCharactersToRead) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetInputBufferAndHandleEntry(ProcessData, ReadConsoleRequest->InputHandle, &InputBuffer, &HandleEntry, GENERIC_READ, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + ReadConsoleRequest->NrCharactersRead = 0; + + InputInfo.CallingThread = CsrGetClientThread(); + InputInfo.HandleEntry = HandleEntry; + InputInfo.InputBuffer = InputBuffer; + + Status = ReadChars(&InputInfo, + ApiMessage, + TRUE); + + ConSrvReleaseInputBuffer(InputBuffer, TRUE); + + if (Status == STATUS_PENDING) + *ReplyCode = CsrReplyPending; + + return Status; +} + +CSR_API(SrvGetConsoleInput) +{ + NTSTATUS Status; + PCONSOLE_GETINPUT GetInputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetInputRequest; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + PCONSOLE_IO_HANDLE HandleEntry; + PCONSOLE_INPUT_BUFFER InputBuffer; + GET_INPUT_INFO InputInfo; + + DPRINT("SrvGetConsoleInput\n"); + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&GetInputRequest->InputRecord, + GetInputRequest->Length, + sizeof(INPUT_RECORD))) + { + return STATUS_INVALID_PARAMETER; + } + + GetInputRequest->InputsRead = 0; + + Status = ConSrvGetInputBufferAndHandleEntry(ProcessData, GetInputRequest->InputHandle, &InputBuffer, &HandleEntry, GENERIC_READ, TRUE); + if(!NT_SUCCESS(Status)) return Status; + + InputInfo.CallingThread = CsrGetClientThread(); + InputInfo.HandleEntry = HandleEntry; + InputInfo.InputBuffer = InputBuffer; + + Status = ReadInputBuffer(&InputInfo, + GetInputRequest->bRead, + ApiMessage, + TRUE); + + ConSrvReleaseInputBuffer(InputBuffer, TRUE); + + if (Status == STATUS_PENDING) + *ReplyCode = CsrReplyPending; + + return Status; +} + +CSR_API(SrvWriteConsoleInput) +{ + NTSTATUS Status; + PCONSOLE_WRITEINPUT WriteInputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteInputRequest; + PINPUT_RECORD InputRecord; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + PCONSOLE_INPUT_BUFFER InputBuffer; + PCONSOLE Console; + DWORD Length; + DWORD i; + + DPRINT("SrvWriteConsoleInput\n"); + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&WriteInputRequest->InputRecord, + WriteInputRequest->Length, + sizeof(INPUT_RECORD))) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetInputBuffer(ProcessData, WriteInputRequest->InputHandle, &InputBuffer, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = InputBuffer->Header.Console; + InputRecord = WriteInputRequest->InputRecord; + Length = WriteInputRequest->Length; + + for (i = 0; i < Length && NT_SUCCESS(Status); i++) + { + if (!WriteInputRequest->Unicode && + InputRecord->EventType == KEY_EVENT) + { + CHAR AsciiChar = InputRecord->Event.KeyEvent.uChar.AsciiChar; + ConsoleInputAnsiCharToUnicodeChar(Console, + &InputRecord->Event.KeyEvent.uChar.UnicodeChar, + &AsciiChar); + } + + Status = ConioProcessChar(Console, InputRecord++); + } + + ConSrvReleaseInputBuffer(InputBuffer, TRUE); + + WriteInputRequest->Length = i; + + return Status; +} + +CSR_API(SrvFlushConsoleInputBuffer) +{ + NTSTATUS Status; + PCONSOLE_FLUSHINPUTBUFFER FlushInputBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.FlushInputBufferRequest; + PLIST_ENTRY CurrentEntry; + PCONSOLE_INPUT_BUFFER InputBuffer; + ConsoleInput* Input; + + DPRINT("SrvFlushConsoleInputBuffer\n"); + + Status = ConSrvGetInputBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + FlushInputBufferRequest->InputHandle, + &InputBuffer, + GENERIC_WRITE, + TRUE); + if(!NT_SUCCESS(Status)) return Status; + + /* Discard all entries in the input event queue */ + while (!IsListEmpty(&InputBuffer->InputEvents)) + { + CurrentEntry = RemoveHeadList(&InputBuffer->InputEvents); + Input = CONTAINING_RECORD(CurrentEntry, ConsoleInput, ListEntry); + /* Destroy the event */ + RtlFreeHeap(ConSrvHeap, 0, Input); + } + ResetEvent(InputBuffer->ActiveEvent); + + ConSrvReleaseInputBuffer(InputBuffer, TRUE); + + return STATUS_SUCCESS; +} + +CSR_API(SrvGetConsoleNumberOfInputEvents) +{ + NTSTATUS Status; + PCONSOLE_GETNUMINPUTEVENTS GetNumInputEventsRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetNumInputEventsRequest; + PCONSOLE_INPUT_BUFFER InputBuffer; + PLIST_ENTRY CurrentInput; + DWORD NumEvents; + + DPRINT("SrvGetConsoleNumberOfInputEvents\n"); + + Status = ConSrvGetInputBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), GetNumInputEventsRequest->InputHandle, &InputBuffer, GENERIC_READ, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + CurrentInput = InputBuffer->InputEvents.Flink; + /* GetNumInputEventsRequest->NumInputEvents = */ NumEvents = 0; + + /* If there are any events ... */ + while (CurrentInput != &InputBuffer->InputEvents) + { + CurrentInput = CurrentInput->Flink; + NumEvents++; + } + + ConSrvReleaseInputBuffer(InputBuffer, TRUE); + + GetNumInputEventsRequest->NumInputEvents = NumEvents; + + return STATUS_SUCCESS; +} + +/* EOF */ Index: win32ss/user/consrv/coninput.c =================================================================== --- win32ss/user/consrv/coninput.c (rvision 58607) +++ win32ss/user/consrv/coninput.c (copie de travail) Modification de proprits sur win32ss/user/consrv/coninput.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/conio.h =================================================================== --- win32ss/user/consrv/conio.h (rvision 0) +++ win32ss/user/consrv/conio.h (copie de travail) @@ -0,0 +1,278 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/conio.h + * PURPOSE: Internal console I/O interface + * PROGRAMMERS: + */ + +#pragma once + +#define CSR_DEFAULT_CURSOR_SIZE 25 +#define CURSOR_BLINK_TIME 500 + +/* Default attributes */ +#define DEFAULT_SCREEN_ATTRIB (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED) +#define DEFAULT_POPUP_ATTRIB (FOREGROUND_BLUE | FOREGROUND_RED | \ + BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY) + + +/************************************************************************ + * Screen buffer structure represents the win32 screen buffer object. * + * Internally, the portion of the buffer being shown CAN loop past the * + * bottom of the virtual buffer and wrap around to the top. Win32 does * + * not do this. I decided to do this because it eliminates the need to * + * do a massive memcpy() to scroll the contents of the buffer up to * + * scroll the screen on output, instead I just shift down the position * + * to be displayed, and let it wrap around to the top again. * + * The VirtualY member keeps track of the top Y coord that win32 * + * clients THINK is currently being displayed, because they think that * + * when the display reaches the bottom of the buffer and another line * + * being printed causes another line to scroll down, that the buffer IS * + * memcpy()'s up, and the bottom of the buffer is still displayed, but * + * internally, I just wrap back to the top of the buffer. * + ************************************************************************/ + +typedef struct _CONSOLE_SCREEN_BUFFER +{ + Object_t Header; /* Object header */ + LIST_ENTRY ListEntry; /* Entry in console's list of buffers */ + + BYTE *Buffer; /* CHAR_INFO */ /* Pointer to screen buffer */ + + COORD ScreenBufferSize; /* Size of this screen buffer */ + COORD CursorPosition; /* Current cursor position */ + + USHORT ShowX, ShowY; /* Beginning offset for the actual display area */ + USHORT VirtualY; /* Top row of buffer being displayed, reported to callers */ + + BOOLEAN CursorBlinkOn; + BOOLEAN ForceCursorOff; + ULONG CursorSize; + CONSOLE_CURSOR_INFO CursorInfo; // FIXME: Keep this member or not ?? + + WORD ScreenDefaultAttrib; /* Default screen char attribute */ + WORD PopupDefaultAttrib; /* Default popup char attribute */ + USHORT Mode; +} CONSOLE_SCREEN_BUFFER, *PCONSOLE_SCREEN_BUFFER; + +typedef struct _CONSOLE_INPUT_BUFFER +{ + Object_t Header; /* Object header */ + + ULONG InputBufferSize; /* Size of this input buffer */ + LIST_ENTRY InputEvents; /* List head for input event queue */ + HANDLE ActiveEvent; /* Event set when an input event is added in its queue */ + LIST_ENTRY ReadWaitQueue; /* List head for the queue of read wait blocks */ + + USHORT Mode; /* Console Input Buffer mode flags */ +} CONSOLE_INPUT_BUFFER, *PCONSOLE_INPUT_BUFFER; + +typedef struct ConsoleInput_t +{ + LIST_ENTRY ListEntry; + INPUT_RECORD InputEvent; +} ConsoleInput; + +typedef struct _FRONTEND_VTBL +{ + /* + * Internal interface (functions called by the console server only) + */ + VOID (WINAPI *CleanupConsole)(struct _CONSOLE* Console); + VOID (WINAPI *WriteStream)(struct _CONSOLE* Console, + SMALL_RECT* Block, + LONG CursorStartX, + LONG CursorStartY, + UINT ScrolledLines, + CHAR *Buffer, + UINT Length); + VOID (WINAPI *DrawRegion)(struct _CONSOLE* Console, + SMALL_RECT* Region); + BOOL (WINAPI *SetCursorInfo)(struct _CONSOLE* Console, + PCONSOLE_SCREEN_BUFFER ScreenBuffer); + BOOL (WINAPI *SetScreenInfo)(struct _CONSOLE* Console, + PCONSOLE_SCREEN_BUFFER ScreenBuffer, + UINT OldCursorX, + UINT OldCursorY); + BOOL (WINAPI *UpdateScreenInfo)(struct _CONSOLE* Console, + PCONSOLE_SCREEN_BUFFER ScreenBuffer); + NTSTATUS (WINAPI *ResizeBuffer)(struct _CONSOLE* Console, + PCONSOLE_SCREEN_BUFFER ScreenBuffer, + COORD Size); + VOID (WINAPI *ResizeTerminal)(struct _CONSOLE* Console); + BOOL (WINAPI *ProcessKeyCallback)(struct _CONSOLE* Console, + MSG* msg, + BYTE KeyStateMenu, + DWORD ShiftState, + UINT VirtualKeyCode, + BOOL Down); + VOID (WINAPI *RefreshInternalInfo)(struct _CONSOLE* Console); + + /* + * External interface (functions corresponding to the Console API) + */ + VOID (WINAPI *ChangeTitle)(struct _CONSOLE* Console); + BOOL (WINAPI *ChangeIcon)(struct _CONSOLE* Console, + HICON hWindowIcon); + HWND (WINAPI *GetConsoleWindowHandle)(struct _CONSOLE* Console); + +} FRONTEND_VTBL, *PFRONTEND_VTBL; + +#define ConioDrawRegion(Console, Region) (Console)->TermIFace.Vtbl->DrawRegion((Console), (Region)) +#define ConioWriteStream(Console, Block, CurStartX, CurStartY, ScrolledLines, Buffer, Length) \ + (Console)->TermIFace.Vtbl->WriteStream((Console), (Block), (CurStartX), (CurStartY), \ + (ScrolledLines), (Buffer), (Length)) +#define ConioSetCursorInfo(Console, Buff) (Console)->TermIFace.Vtbl->SetCursorInfo((Console), (Buff)) +#define ConioSetScreenInfo(Console, Buff, OldCursorX, OldCursorY) \ + (Console)->TermIFace.Vtbl->SetScreenInfo((Console), (Buff), (OldCursorX), (OldCursorY)) +#define ConioUpdateScreenInfo(Console, Buff) \ + (Console)->TermIFace.Vtbl->UpdateScreenInfo((Console), (Buff)) +#define ConioChangeTitle(Console) (Console)->TermIFace.Vtbl->ChangeTitle(Console) +#define ConioCleanupConsole(Console) (Console)->TermIFace.Vtbl->CleanupConsole(Console) +#define ConioChangeIcon(Console, hWindowIcon) (Console)->TermIFace.Vtbl->ChangeIcon((Console), (hWindowIcon)) +#define ConioResizeBuffer(Console, Buff, Size) (Console)->TermIFace.Vtbl->ResizeBuffer((Console), (Buff), (Size)) +#define ConioResizeTerminal(Console) (Console)->TermIFace.Vtbl->ResizeTerminal((Console)) +#define ConioProcessKeyCallback(Console, Msg, KeyStateMenu, ShiftState, VirtualKeyCode, Down) \ + (Console)->TermIFace.Vtbl->ProcessKeyCallback((Console), (Msg), (KeyStateMenu), (ShiftState), (VirtualKeyCode), (Down)) +#define ConioGetConsoleWindowHandle(Console) \ + (Console)->TermIFace.Vtbl->GetConsoleWindowHandle((Console)) +#define ConioRefreshInternalInfo(Console) \ + (Console)->TermIFace.Vtbl->RefreshInternalInfo((Console)) + +typedef struct _FRONTEND_IFACE +{ + PFRONTEND_VTBL Vtbl; /* Virtual table */ + PVOID Data; /* Private data */ + PVOID OldData; /* Reserved */ +} FRONTEND_IFACE, *PFRONTEND_IFACE; + +typedef struct _CONSOLE +{ + LONG ReferenceCount; /* Is incremented each time a handle to a screen-buffer or the input buffer of this console gets referenced, or the console gets locked */ + CRITICAL_SECTION Lock; + + struct _CONSOLE *Prev, *Next; /* Next and Prev consoles in console wheel */ + LIST_ENTRY ProcessList; /* List of processes owning the console. The first one is the so-called "Console Leader Process" */ + + FRONTEND_IFACE TermIFace; /* Frontend-specific interface */ + +/**************************** Input buffer and data ***************************/ + CONSOLE_INPUT_BUFFER InputBuffer; /* Input buffer of the console */ + + PWCHAR LineBuffer; /* Current line being input, in line buffered mode */ + WORD LineMaxSize; /* Maximum size of line in characters (including CR+LF) */ + WORD LineSize; /* Current size of line */ + WORD LinePos; /* Current position within line */ + BOOLEAN LineComplete; /* User pressed enter, ready to send back to client */ + BOOLEAN LineUpPressed; + BOOLEAN LineInsertToggle; /* Replace character over cursor instead of inserting */ + ULONG LineWakeupMask; /* Bitmap of which control characters will end line input */ + + BOOLEAN QuickEdit; + BOOLEAN InsertMode; + UINT CodePage; + UINT OutputCodePage; + + CONSOLE_SELECTION_INFO Selection; + +/******************************* Screen buffers *******************************/ + LIST_ENTRY BufferList; /* List of all screen buffers for this console */ + PCONSOLE_SCREEN_BUFFER ActiveBuffer; /* Pointer to currently active screen buffer */ + BYTE PauseFlags; + HANDLE UnpauseEvent; + LIST_ENTRY WriteWaitQueue; /* List head for the queue of write wait blocks */ + + DWORD HardwareState; /* _GDI_MANAGED, _DIRECT */ +/* BOOLEAN */ ULONG FullScreen; // Give the type of console: GUI (windowed) or TUI (fullscreen) + +/**************************** Aliases and Histories ***************************/ + struct _ALIAS_HEADER *Aliases; + LIST_ENTRY HistoryBuffers; + ULONG HistoryBufferSize; /* Size for newly created history buffers */ + ULONG NumberOfHistoryBuffers; /* Maximum number of history buffers allowed */ + BOOLEAN HistoryNoDup; /* Remove old duplicate history entries */ + +/****************************** Other properties ******************************/ + UNICODE_STRING OriginalTitle; /* Original title of console, the one when the console leader is launched. Always NULL-terminated */ + UNICODE_STRING Title; /* Title of console. Always NULL-terminated */ + +/* SIZE */ COORD ConsoleSize; /* The size of the console */ + COLORREF Colors[16]; /* Colour palette */ + +} CONSOLE, *PCONSOLE; + +/* CONSOLE_SELECTION_INFO dwFlags values */ +#define CONSOLE_NO_SELECTION 0x0 +#define CONSOLE_SELECTION_IN_PROGRESS 0x1 +#define CONSOLE_SELECTION_NOT_EMPTY 0x2 +#define CONSOLE_MOUSE_SELECTION 0x4 +#define CONSOLE_MOUSE_DOWN 0x8 + +/* HistoryFlags values */ +#define HISTORY_NO_DUP_FLAG 0x1 + +/* PauseFlags values (internal only) */ +#define PAUSED_FROM_KEYBOARD 0x1 +#define PAUSED_FROM_SCROLLBAR 0x2 +#define PAUSED_FROM_SELECTION 0x4 + +/* console.c */ +VOID WINAPI ConSrvDeleteConsole(PCONSOLE Console); +VOID WINAPI ConSrvInitConsoleSupport(VOID); +NTSTATUS WINAPI ConSrvInitConsole(OUT PCONSOLE* NewConsole, + IN OUT PCONSOLE_START_INFO ConsoleStartInfo, + IN PCSR_PROCESS ConsoleLeaderProcess); +VOID FASTCALL ConioPause(PCONSOLE Console, UINT Flags); +VOID FASTCALL ConioUnpause(PCONSOLE Console, UINT Flags); +ULONG FASTCALL ConSrvConsoleProcessCtrlEvent(PCONSOLE Console, + ULONG ProcessGroupId, + DWORD Event); + +/* coninput.c */ +#define ConSrvGetInputBuffer(ProcessData, Handle, Ptr, Access, LockConsole) \ + ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), NULL, \ + (Access), (LockConsole), CONIO_INPUT_BUFFER_MAGIC) +#define ConSrvGetInputBufferAndHandleEntry(ProcessData, Handle, Ptr, Entry, Access, LockConsole) \ + ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), (Entry), \ + (Access), (LockConsole), CONIO_INPUT_BUFFER_MAGIC) +#define ConSrvReleaseInputBuffer(Buff, IsConsoleLocked) \ + ConSrvReleaseObject(&(Buff)->Header, (IsConsoleLocked)) +VOID WINAPI ConioProcessKey(PCONSOLE Console, MSG* msg); + +/* conoutput.c */ +#define ConioRectHeight(Rect) \ + (((Rect)->Top) > ((Rect)->Bottom) ? 0 : ((Rect)->Bottom) - ((Rect)->Top) + 1) +#define ConioRectWidth(Rect) \ + (((Rect)->Left) > ((Rect)->Right) ? 0 : ((Rect)->Right) - ((Rect)->Left) + 1) +#define ConSrvGetScreenBuffer(ProcessData, Handle, Ptr, Access, LockConsole) \ + ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), NULL, \ + (Access), (LockConsole), CONIO_SCREEN_BUFFER_MAGIC) +#define ConSrvGetScreenBufferAndHandleEntry(ProcessData, Handle, Ptr, Entry, Access, LockConsole) \ + ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), (Entry), \ + (Access), (LockConsole), CONIO_SCREEN_BUFFER_MAGIC) +#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked) \ + ConSrvReleaseObject(&(Buff)->Header, (IsConsoleLocked)) +PBYTE FASTCALL ConioCoordToPointer(PCONSOLE_SCREEN_BUFFER Buf, ULONG X, ULONG Y); +VOID FASTCALL ConioDrawConsole(PCONSOLE Console); +NTSTATUS FASTCALL ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff, + CHAR *Buffer, DWORD Length, BOOL Attrib); +NTSTATUS FASTCALL ConSrvCreateScreenBuffer(IN OUT PCONSOLE Console, + OUT PCONSOLE_SCREEN_BUFFER* Buffer, + IN COORD ScreenBufferSize, + IN USHORT ScreenAttrib, + IN USHORT PopupAttrib, + IN BOOLEAN IsCursorVisible, + IN ULONG CursorSize); +VOID WINAPI ConioDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer); +DWORD FASTCALL ConioEffectiveCursorSize(PCONSOLE Console, DWORD Scale); + +/* alias.c */ +VOID IntDeleteAllAliases(struct _ALIAS_HEADER *RootHeader); + +/* lineinput.c */ +struct _HISTORY_BUFFER; +VOID FASTCALL HistoryDeleteBuffer(struct _HISTORY_BUFFER *Hist); +VOID FASTCALL LineInputKeyDown(PCONSOLE Console, KEY_EVENT_RECORD *KeyEvent); + +/* EOF */ Index: win32ss/user/consrv/conio.h =================================================================== --- win32ss/user/consrv/conio.h (rvision 58607) +++ win32ss/user/consrv/conio.h (copie de travail) Modification de proprits sur win32ss/user/consrv/conio.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/conoutput.c =================================================================== --- win32ss/user/consrv/conoutput.c (rvision 0) +++ win32ss/user/consrv/conoutput.c (copie de travail) @@ -0,0 +1,1500 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/conoutput.c + * PURPOSE: Console I/O functions + * PROGRAMMERS: + */ + +/* INCLUDES *******************************************************************/ + +#include "consrv.h" +#include "conio.h" + +#define NDEBUG +#include + + +/* GLOBALS ********************************************************************/ + +#define TAB_WIDTH 8 + +#define ConioInitRect(Rect, top, left, bottom, right) \ +do { \ + ((Rect)->Top) = top; \ + ((Rect)->Left) = left; \ + ((Rect)->Bottom) = bottom; \ + ((Rect)->Right) = right; \ +} while(0) + +#define ConioIsRectEmpty(Rect) \ + (((Rect)->Left > (Rect)->Right) || ((Rect)->Top > (Rect)->Bottom)) + +#define ConsoleUnicodeCharToAnsiChar(Console, dChar, sWChar) \ + WideCharToMultiByte((Console)->OutputCodePage, 0, (sWChar), 1, (dChar), 1, NULL, NULL) + +#define ConsoleAnsiCharToUnicodeChar(Console, dWChar, sChar) \ + MultiByteToWideChar((Console)->OutputCodePage, 0, (sChar), 1, (dWChar), 1) + + +/* PRIVATE FUNCTIONS **********************************************************/ + +PBYTE FASTCALL +ConioCoordToPointer(PCONSOLE_SCREEN_BUFFER Buff, ULONG X, ULONG Y) +{ + return &Buff->Buffer[2 * (((Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y) * Buff->ScreenBufferSize.X + X)]; +} + +static VOID FASTCALL +ClearLineBuffer(PCONSOLE_SCREEN_BUFFER Buff) +{ + PBYTE Ptr = ConioCoordToPointer(Buff, 0, Buff->CursorPosition.Y); + UINT Pos; + + for (Pos = 0; Pos < Buff->ScreenBufferSize.X; Pos++) + { + /* Fill the cell */ + *Ptr++ = ' '; + *Ptr++ = Buff->ScreenDefaultAttrib; + } +} + +NTSTATUS FASTCALL +ConSrvCreateScreenBuffer(IN OUT PCONSOLE Console, + OUT PCONSOLE_SCREEN_BUFFER* Buffer, + IN COORD ScreenBufferSize, + IN USHORT ScreenAttrib, + IN USHORT PopupAttrib, + IN BOOLEAN IsCursorVisible, + IN ULONG CursorSize) +{ + if (Console == NULL || Buffer == NULL) + return STATUS_INVALID_PARAMETER; + + *Buffer = RtlAllocateHeap(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(CONSOLE_SCREEN_BUFFER)); + if (NULL == *Buffer) + { + return STATUS_INSUFFICIENT_RESOURCES; + } + + (*Buffer)->Header.Type = CONIO_SCREEN_BUFFER_MAGIC; + (*Buffer)->Header.Console = Console; + (*Buffer)->Header.HandleCount = 0; + (*Buffer)->ScreenBufferSize = ScreenBufferSize; + + (*Buffer)->Buffer = RtlAllocateHeap(ConSrvHeap, HEAP_ZERO_MEMORY, (*Buffer)->ScreenBufferSize.X * (*Buffer)->ScreenBufferSize.Y * 2); + if (NULL == (*Buffer)->Buffer) + { + RtlFreeHeap(ConSrvHeap, 0, *Buffer); + return STATUS_INSUFFICIENT_RESOURCES; + } + + (*Buffer)->ShowX = 0; + (*Buffer)->ShowY = 0; + (*Buffer)->VirtualY = 0; + + (*Buffer)->CursorInfo.bVisible = (IsCursorVisible && (CursorSize != 0)); + (*Buffer)->CursorInfo.dwSize = min(max(CursorSize, 0), 100); + + (*Buffer)->ScreenDefaultAttrib = ScreenAttrib; + (*Buffer)->PopupDefaultAttrib = PopupAttrib; + /* initialize buffer to be empty with default attributes */ + for ((*Buffer)->CursorPosition.Y = 0 ; (*Buffer)->CursorPosition.Y < (*Buffer)->ScreenBufferSize.Y; (*Buffer)->CursorPosition.Y++) + { + ClearLineBuffer(*Buffer); + } + (*Buffer)->Mode = ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT; + (*Buffer)->CursorPosition = (COORD){0, 0}; + + InsertHeadList(&Console->BufferList, &(*Buffer)->ListEntry); + return STATUS_SUCCESS; +} + +static VOID FASTCALL +ConioNextLine(PCONSOLE_SCREEN_BUFFER Buff, SMALL_RECT* UpdateRect, UINT *ScrolledLines) +{ + /* If we hit bottom, slide the viewable screen */ + if (++Buff->CursorPosition.Y == Buff->ScreenBufferSize.Y) + { + Buff->CursorPosition.Y--; + if (++Buff->VirtualY == Buff->ScreenBufferSize.Y) + { + Buff->VirtualY = 0; + } + (*ScrolledLines)++; + ClearLineBuffer(Buff); + if (UpdateRect->Top != 0) + { + UpdateRect->Top--; + } + } + UpdateRect->Left = 0; + UpdateRect->Right = Buff->ScreenBufferSize.X - 1; + UpdateRect->Bottom = Buff->CursorPosition.Y; +} + +NTSTATUS FASTCALL +ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff, + CHAR *Buffer, DWORD Length, BOOL Attrib) +{ + UINT i; + PBYTE Ptr; + SMALL_RECT UpdateRect; + LONG CursorStartX, CursorStartY; + UINT ScrolledLines; + + CursorStartX = Buff->CursorPosition.X; + CursorStartY = Buff->CursorPosition.Y; + UpdateRect.Left = Buff->ScreenBufferSize.X; + UpdateRect.Top = Buff->CursorPosition.Y; + UpdateRect.Right = -1; + UpdateRect.Bottom = Buff->CursorPosition.Y; + ScrolledLines = 0; + + for (i = 0; i < Length; i++) + { + /* + * If we are in processed mode, interpret special characters and + * display them correctly. Otherwise, just put them into the buffer. + */ + if (Buff->Mode & ENABLE_PROCESSED_OUTPUT) + { + /* --- CR --- */ + if (Buffer[i] == '\r') + { + Buff->CursorPosition.X = 0; + UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CursorPosition.X); + UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CursorPosition.X); + continue; + } + /* --- LF --- */ + else if (Buffer[i] == '\n') + { + Buff->CursorPosition.X = 0; + ConioNextLine(Buff, &UpdateRect, &ScrolledLines); + continue; + } + /* --- BS --- */ + else if (Buffer[i] == '\b') + { + /* Only handle BS if we're not on the first pos of the first line */ + if (0 != Buff->CursorPosition.X || 0 != Buff->CursorPosition.Y) + { + if (0 == Buff->CursorPosition.X) + { + /* slide virtual position up */ + Buff->CursorPosition.X = Buff->ScreenBufferSize.X - 1; + Buff->CursorPosition.Y--; + UpdateRect.Top = min(UpdateRect.Top, (LONG)Buff->CursorPosition.Y); + } + else + { + Buff->CursorPosition.X--; + } + Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y); + Ptr[0] = ' '; + Ptr[1] = Buff->ScreenDefaultAttrib; + UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CursorPosition.X); + UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CursorPosition.X); + } + continue; + } + /* --- TAB --- */ + else if (Buffer[i] == '\t') + { + UINT EndX; + + UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CursorPosition.X); + EndX = (Buff->CursorPosition.X + TAB_WIDTH) & ~(TAB_WIDTH - 1); + EndX = min(EndX, Buff->ScreenBufferSize.X); + Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y); + while (Buff->CursorPosition.X < EndX) + { + *Ptr++ = ' '; + *Ptr++ = Buff->ScreenDefaultAttrib; + Buff->CursorPosition.X++; + } + UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CursorPosition.X - 1); + if (Buff->CursorPosition.X == Buff->ScreenBufferSize.X) + { + if (Buff->Mode & ENABLE_WRAP_AT_EOL_OUTPUT) + { + Buff->CursorPosition.X = 0; + ConioNextLine(Buff, &UpdateRect, &ScrolledLines); + } + else + { + Buff->CursorPosition.X--; + } + } + continue; + } + // /* --- BEL ---*/ + // else if (Buffer[i] == '\a') + // { + // // FIXME: This MUST BE moved to the terminal emulator frontend!! + // DPRINT1("Bell\n"); + // // SendNotifyMessage(Console->hWindow, PM_CONSOLE_BEEP, 0, 0); + // continue; + // } + } + UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CursorPosition.X); + UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CursorPosition.X); + Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y); + Ptr[0] = Buffer[i]; + if (Attrib) + { + Ptr[1] = Buff->ScreenDefaultAttrib; + } + Buff->CursorPosition.X++; + if (Buff->CursorPosition.X == Buff->ScreenBufferSize.X) + { + if (Buff->Mode & ENABLE_WRAP_AT_EOL_OUTPUT) + { + Buff->CursorPosition.X = 0; + ConioNextLine(Buff, &UpdateRect, &ScrolledLines); + } + else + { + Buff->CursorPosition.X = CursorStartX; + } + } + } + + if (!ConioIsRectEmpty(&UpdateRect) && Buff == Console->ActiveBuffer) + { + ConioWriteStream(Console, &UpdateRect, CursorStartX, CursorStartY, ScrolledLines, + Buffer, Length); + } + + return STATUS_SUCCESS; +} + +__inline BOOLEAN ConioGetIntersection( + SMALL_RECT* Intersection, + SMALL_RECT* Rect1, + SMALL_RECT* Rect2) +{ + if (ConioIsRectEmpty(Rect1) || + (ConioIsRectEmpty(Rect2)) || + (Rect1->Top > Rect2->Bottom) || + (Rect1->Left > Rect2->Right) || + (Rect1->Bottom < Rect2->Top) || + (Rect1->Right < Rect2->Left)) + { + /* The rectangles do not intersect */ + ConioInitRect(Intersection, 0, -1, 0, -1); + return FALSE; + } + + ConioInitRect(Intersection, + max(Rect1->Top, Rect2->Top), + max(Rect1->Left, Rect2->Left), + min(Rect1->Bottom, Rect2->Bottom), + min(Rect1->Right, Rect2->Right)); + + return TRUE; +} + +__inline BOOLEAN ConioGetUnion( + SMALL_RECT* Union, + SMALL_RECT* Rect1, + SMALL_RECT* Rect2) +{ + if (ConioIsRectEmpty(Rect1)) + { + if (ConioIsRectEmpty(Rect2)) + { + ConioInitRect(Union, 0, -1, 0, -1); + return FALSE; + } + else + { + *Union = *Rect2; + } + } + else if (ConioIsRectEmpty(Rect2)) + { + *Union = *Rect1; + } + else + { + ConioInitRect(Union, + min(Rect1->Top, Rect2->Top), + min(Rect1->Left, Rect2->Left), + max(Rect1->Bottom, Rect2->Bottom), + max(Rect1->Right, Rect2->Right)); + } + + return TRUE; +} + +/* + * Move from one rectangle to another. We must be careful about the order that + * this is done, to avoid overwriting parts of the source before they are moved. + */ +static VOID FASTCALL +ConioMoveRegion(PCONSOLE_SCREEN_BUFFER ScreenBuffer, + SMALL_RECT* SrcRegion, + SMALL_RECT* DstRegion, + SMALL_RECT* ClipRegion, + WORD Fill) +{ + int Width = ConioRectWidth(SrcRegion); + int Height = ConioRectHeight(SrcRegion); + int SX, SY; + int DX, DY; + int XDelta, YDelta; + int i, j; + + SY = SrcRegion->Top; + DY = DstRegion->Top; + YDelta = 1; + if (SY < DY) + { + /* Moving down: work from bottom up */ + SY = SrcRegion->Bottom; + DY = DstRegion->Bottom; + YDelta = -1; + } + for (i = 0; i < Height; i++) + { + PWORD SRow = (PWORD)ConioCoordToPointer(ScreenBuffer, 0, SY); + PWORD DRow = (PWORD)ConioCoordToPointer(ScreenBuffer, 0, DY); + + SX = SrcRegion->Left; + DX = DstRegion->Left; + XDelta = 1; + if (SX < DX) + { + /* Moving right: work from right to left */ + SX = SrcRegion->Right; + DX = DstRegion->Right; + XDelta = -1; + } + for (j = 0; j < Width; j++) + { + WORD Cell = SRow[SX]; + if (SX >= ClipRegion->Left && SX <= ClipRegion->Right + && SY >= ClipRegion->Top && SY <= ClipRegion->Bottom) + { + SRow[SX] = Fill; + } + if (DX >= ClipRegion->Left && DX <= ClipRegion->Right + && DY >= ClipRegion->Top && DY <= ClipRegion->Bottom) + { + DRow[DX] = Cell; + } + SX += XDelta; + DX += XDelta; + } + SY += YDelta; + DY += YDelta; + } +} + +VOID WINAPI +ConioDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer) +{ + PCONSOLE Console = Buffer->Header.Console; + + RemoveEntryList(&Buffer->ListEntry); + if (Buffer == Console->ActiveBuffer) + { + /* Deleted active buffer; switch to most recently created */ + Console->ActiveBuffer = NULL; + if (!IsListEmpty(&Console->BufferList)) + { + Console->ActiveBuffer = CONTAINING_RECORD(Console->BufferList.Flink, CONSOLE_SCREEN_BUFFER, ListEntry); + ConioDrawConsole(Console); + } + } + + RtlFreeHeap(ConSrvHeap, 0, Buffer->Buffer); + RtlFreeHeap(ConSrvHeap, 0, Buffer); +} + +VOID FASTCALL +ConioDrawConsole(PCONSOLE Console) +{ + SMALL_RECT Region; + + ConioInitRect(&Region, 0, 0, Console->ConsoleSize.Y - 1, Console->ConsoleSize.X - 1); + ConioDrawRegion(Console, &Region); +} + +static VOID FASTCALL +ConioComputeUpdateRect(PCONSOLE_SCREEN_BUFFER Buff, SMALL_RECT* UpdateRect, PCOORD Start, UINT Length) +{ + if (Buff->ScreenBufferSize.X <= Start->X + Length) + { + UpdateRect->Left = 0; + } + else + { + UpdateRect->Left = Start->X; + } + if (Buff->ScreenBufferSize.X <= Start->X + Length) + { + UpdateRect->Right = Buff->ScreenBufferSize.X - 1; + } + else + { + UpdateRect->Right = Start->X + Length - 1; + } + UpdateRect->Top = Start->Y; + UpdateRect->Bottom = Start->Y + (Start->X + Length - 1) / Buff->ScreenBufferSize.X; + if (Buff->ScreenBufferSize.Y <= UpdateRect->Bottom) + { + UpdateRect->Bottom = Buff->ScreenBufferSize.Y - 1; + } +} + +DWORD FASTCALL +ConioEffectiveCursorSize(PCONSOLE Console, DWORD Scale) +{ + DWORD Size = (Console->ActiveBuffer->CursorInfo.dwSize * Scale + 99) / 100; + /* If line input in progress, perhaps adjust for insert toggle */ + if (Console->LineBuffer && !Console->LineComplete && Console->LineInsertToggle) + return (Size * 2 <= Scale) ? (Size * 2) : (Size / 2); + return Size; +} + +static NTSTATUS +DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage, + IN PCSR_THREAD ClientThread, + IN BOOL CreateWaitBlock OPTIONAL); + +// Wait function CSR_WAIT_FUNCTION +static BOOLEAN +WriteConsoleThread(IN PLIST_ENTRY WaitList, + IN PCSR_THREAD WaitThread, + IN PCSR_API_MESSAGE WaitApiMessage, + IN PVOID WaitContext, + IN PVOID WaitArgument1, + IN PVOID WaitArgument2, + IN ULONG WaitFlags) +{ + NTSTATUS Status; + + DPRINT1("WriteConsoleThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags); + + /* + * If we are notified of the process termination via a call + * to CsrNotifyWaitBlock triggered by CsrDestroyProcess or + * CsrDestroyThread, just return. + */ + if (WaitFlags & CsrProcessTerminating) + { + Status = STATUS_THREAD_IS_TERMINATING; + goto Quit; + } + + Status = DoWriteConsole(WaitApiMessage, + WaitThread, + FALSE); + +Quit: + if (Status != STATUS_PENDING) + { + WaitApiMessage->Status = Status; + } + + return (Status == STATUS_PENDING ? FALSE : TRUE); +} + +static NTSTATUS +DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage, + IN PCSR_THREAD ClientThread, + IN BOOL CreateWaitBlock OPTIONAL) +{ + NTSTATUS Status = STATUS_SUCCESS; + PCONSOLE_WRITECONSOLE WriteConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleRequest; + PCONSOLE Console; + PCONSOLE_SCREEN_BUFFER Buff; + PCHAR Buffer; + DWORD Written = 0; + ULONG Length; + + Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(ClientThread->Process), WriteConsoleRequest->OutputHandle, &Buff, GENERIC_WRITE, FALSE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + // if (Console->PauseFlags & (PAUSED_FROM_KEYBOARD | PAUSED_FROM_SCROLLBAR | PAUSED_FROM_SELECTION)) + if (Console->PauseFlags && Console->UnpauseEvent != NULL) + { + if (CreateWaitBlock) + { + if (!CsrCreateWait(&Console->WriteWaitQueue, + WriteConsoleThread, + ClientThread, + ApiMessage, + NULL, + NULL)) + { + /* Fail */ + ConSrvReleaseScreenBuffer(Buff, FALSE); + return STATUS_NO_MEMORY; + } + } + + /* Wait until we un-pause the console */ + Status = STATUS_PENDING; + } + else + { + if (WriteConsoleRequest->Unicode) + { + Length = WideCharToMultiByte(Console->OutputCodePage, 0, + (PWCHAR)WriteConsoleRequest->Buffer, + WriteConsoleRequest->NrCharactersToWrite, + NULL, 0, NULL, NULL); + Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length); + if (Buffer) + { + WideCharToMultiByte(Console->OutputCodePage, 0, + (PWCHAR)WriteConsoleRequest->Buffer, + WriteConsoleRequest->NrCharactersToWrite, + Buffer, Length, NULL, NULL); + } + else + { + Status = STATUS_NO_MEMORY; + } + } + else + { + Buffer = (PCHAR)WriteConsoleRequest->Buffer; + } + + if (Buffer) + { + if (NT_SUCCESS(Status)) + { + Status = ConioWriteConsole(Console, Buff, Buffer, + WriteConsoleRequest->NrCharactersToWrite, TRUE); + if (NT_SUCCESS(Status)) + { + Written = WriteConsoleRequest->NrCharactersToWrite; + } + } + if (WriteConsoleRequest->Unicode) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); + } + } + + WriteConsoleRequest->NrCharactersWritten = Written; + } + + ConSrvReleaseScreenBuffer(Buff, FALSE); + return Status; +} + + +/* PUBLIC SERVER APIS *********************************************************/ + +CSR_API(SrvReadConsoleOutput) +{ + PCONSOLE_READOUTPUT ReadOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadOutputRequest; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + PCHAR_INFO CharInfo; + PCHAR_INFO CurCharInfo; + PCONSOLE_SCREEN_BUFFER Buff; + DWORD SizeX, SizeY; + NTSTATUS Status; + COORD BufferSize; + COORD BufferCoord; + SMALL_RECT ReadRegion; + SMALL_RECT ScreenRect; + DWORD i; + PBYTE Ptr; + LONG X, Y; + UINT CodePage; + + DPRINT("SrvReadConsoleOutput\n"); + + CharInfo = ReadOutputRequest->CharInfo; + ReadRegion = ReadOutputRequest->ReadRegion; + BufferSize = ReadOutputRequest->BufferSize; + BufferCoord = ReadOutputRequest->BufferCoord; + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&ReadOutputRequest->CharInfo, + BufferSize.X * BufferSize.Y, + sizeof(CHAR_INFO))) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetScreenBuffer(ProcessData, ReadOutputRequest->OutputHandle, &Buff, GENERIC_READ, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + /* FIXME: Is this correct? */ + CodePage = ProcessData->Console->OutputCodePage; + + SizeY = min(BufferSize.Y - BufferCoord.Y, ConioRectHeight(&ReadRegion)); + SizeX = min(BufferSize.X - BufferCoord.X, ConioRectWidth(&ReadRegion)); + ReadRegion.Bottom = ReadRegion.Top + SizeY; + ReadRegion.Right = ReadRegion.Left + SizeX; + + ConioInitRect(&ScreenRect, 0, 0, Buff->ScreenBufferSize.Y, Buff->ScreenBufferSize.X); + if (!ConioGetIntersection(&ReadRegion, &ScreenRect, &ReadRegion)) + { + ConSrvReleaseScreenBuffer(Buff, TRUE); + return STATUS_SUCCESS; + } + + for (i = 0, Y = ReadRegion.Top; Y < ReadRegion.Bottom; ++i, ++Y) + { + CurCharInfo = CharInfo + (i * BufferSize.X); + + Ptr = ConioCoordToPointer(Buff, ReadRegion.Left, Y); + for (X = ReadRegion.Left; X < ReadRegion.Right; ++X) + { + if (ReadOutputRequest->Unicode) + { + // ConsoleAnsiCharToUnicodeChar(ProcessData->Console, (PCHAR)Ptr++, &CurCharInfo->Char.UnicodeChar); + MultiByteToWideChar(CodePage, 0, + (PCHAR)Ptr++, 1, + &CurCharInfo->Char.UnicodeChar, 1); + } + else + { + CurCharInfo->Char.AsciiChar = *Ptr++; + } + CurCharInfo->Attributes = *Ptr++; + ++CurCharInfo; + } + } + + ConSrvReleaseScreenBuffer(Buff, TRUE); + + ReadOutputRequest->ReadRegion.Right = ReadRegion.Left + SizeX - 1; + ReadOutputRequest->ReadRegion.Bottom = ReadRegion.Top + SizeY - 1; + ReadOutputRequest->ReadRegion.Left = ReadRegion.Left; + ReadOutputRequest->ReadRegion.Top = ReadRegion.Top; + + return STATUS_SUCCESS; +} + +CSR_API(SrvWriteConsole) +{ + NTSTATUS Status; + PCONSOLE_WRITECONSOLE WriteConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleRequest; + + DPRINT("SrvWriteConsole\n"); + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID)&WriteConsoleRequest->Buffer, + WriteConsoleRequest->BufferSize, + sizeof(BYTE))) + { + return STATUS_INVALID_PARAMETER; + } + + Status = DoWriteConsole(ApiMessage, + CsrGetClientThread(), + TRUE); + + if (Status == STATUS_PENDING) + *ReplyCode = CsrReplyPending; + + return Status; +} + +CSR_API(SrvWriteConsoleOutput) +{ + PCONSOLE_WRITEOUTPUT WriteOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteOutputRequest; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + SHORT i, X, Y, SizeX, SizeY; + PCONSOLE Console; + PCONSOLE_SCREEN_BUFFER Buff; + SMALL_RECT ScreenBuffer; + CHAR_INFO* CurCharInfo; + SMALL_RECT WriteRegion; + CHAR_INFO* CharInfo; + COORD BufferCoord; + COORD BufferSize; + NTSTATUS Status; + PBYTE Ptr; + + DPRINT("SrvWriteConsoleOutput\n"); + + BufferSize = WriteOutputRequest->BufferSize; + BufferCoord = WriteOutputRequest->BufferCoord; + CharInfo = WriteOutputRequest->CharInfo; + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&WriteOutputRequest->CharInfo, + BufferSize.X * BufferSize.Y, + sizeof(CHAR_INFO))) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetScreenBuffer(ProcessData, + WriteOutputRequest->OutputHandle, + &Buff, + GENERIC_WRITE, + TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + WriteRegion = WriteOutputRequest->WriteRegion; + + SizeY = min(BufferSize.Y - BufferCoord.Y, ConioRectHeight(&WriteRegion)); + SizeX = min(BufferSize.X - BufferCoord.X, ConioRectWidth(&WriteRegion)); + WriteRegion.Bottom = WriteRegion.Top + SizeY - 1; + WriteRegion.Right = WriteRegion.Left + SizeX - 1; + + /* Make sure WriteRegion is inside the screen buffer */ + ConioInitRect(&ScreenBuffer, 0, 0, Buff->ScreenBufferSize.Y - 1, Buff->ScreenBufferSize.X - 1); + if (!ConioGetIntersection(&WriteRegion, &ScreenBuffer, &WriteRegion)) + { + ConSrvReleaseScreenBuffer(Buff, TRUE); + + /* It is okay to have a WriteRegion completely outside the screen buffer. + No data is written then. */ + return STATUS_SUCCESS; + } + + for (i = 0, Y = WriteRegion.Top; Y <= WriteRegion.Bottom; i++, Y++) + { + CurCharInfo = CharInfo + (i + BufferCoord.Y) * BufferSize.X + BufferCoord.X; + Ptr = ConioCoordToPointer(Buff, WriteRegion.Left, Y); + for (X = WriteRegion.Left; X <= WriteRegion.Right; X++) + { + CHAR AsciiChar; + if (WriteOutputRequest->Unicode) + { + ConsoleUnicodeCharToAnsiChar(Console, &AsciiChar, &CurCharInfo->Char.UnicodeChar); + } + else + { + AsciiChar = CurCharInfo->Char.AsciiChar; + } + *Ptr++ = AsciiChar; + *Ptr++ = CurCharInfo->Attributes; + CurCharInfo++; + } + } + + ConioDrawRegion(Console, &WriteRegion); + + ConSrvReleaseScreenBuffer(Buff, TRUE); + + WriteOutputRequest->WriteRegion.Right = WriteRegion.Left + SizeX - 1; + WriteOutputRequest->WriteRegion.Bottom = WriteRegion.Top + SizeY - 1; + WriteOutputRequest->WriteRegion.Left = WriteRegion.Left; + WriteOutputRequest->WriteRegion.Top = WriteRegion.Top; + + return STATUS_SUCCESS; +} + +CSR_API(SrvReadConsoleOutputString) +{ + NTSTATUS Status; + PCONSOLE_READOUTPUTCODE ReadOutputCodeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadOutputCodeRequest; + PCONSOLE Console; + PCONSOLE_SCREEN_BUFFER Buff; + USHORT CodeType; + DWORD Xpos, Ypos; + PVOID ReadBuffer; + DWORD i; + ULONG CodeSize; + BYTE Code; + + DPRINT("SrvReadConsoleOutputString\n"); + + CodeType = ReadOutputCodeRequest->CodeType; + switch (CodeType) + { + case CODE_ASCII: + CodeSize = sizeof(CHAR); + break; + + case CODE_UNICODE: + CodeSize = sizeof(WCHAR); + break; + + case CODE_ATTRIBUTE: + CodeSize = sizeof(WORD); + break; + + default: + return STATUS_INVALID_PARAMETER; + } + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&ReadOutputCodeRequest->pCode.pCode, + ReadOutputCodeRequest->NumCodesToRead, + CodeSize)) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), ReadOutputCodeRequest->OutputHandle, &Buff, GENERIC_READ, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + ReadBuffer = ReadOutputCodeRequest->pCode.pCode; + Xpos = ReadOutputCodeRequest->ReadCoord.X; + Ypos = (ReadOutputCodeRequest->ReadCoord.Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y; + + /* + * MSDN (ReadConsoleOutputAttribute and ReadConsoleOutputCharacter) : + * + * If the number of attributes (resp. characters) to be read from extends + * beyond the end of the specified screen buffer row, attributes (resp. + * characters) are read from the next row. If the number of attributes + * (resp. characters) to be read from extends beyond the end of the console + * screen buffer, attributes (resp. characters) up to the end of the console + * screen buffer are read. + * + * TODO: Do NOT loop up to NumCodesToRead, but stop before + * if we are going to overflow... + */ + for (i = 0; i < ReadOutputCodeRequest->NumCodesToRead; ++i) + { + Code = Buff->Buffer[2 * (Xpos + Ypos * Buff->ScreenBufferSize.X) + (CodeType == CODE_ATTRIBUTE ? 1 : 0)]; + + switch (CodeType) + { + case CODE_UNICODE: + ConsoleAnsiCharToUnicodeChar(Console, (PWCHAR)ReadBuffer, (PCHAR)&Code); + break; + + case CODE_ASCII: + *(PCHAR)ReadBuffer = (CHAR)Code; + break; + + case CODE_ATTRIBUTE: + *(PWORD)ReadBuffer = (WORD)Code; + break; + } + ReadBuffer = (PVOID)((ULONG_PTR)ReadBuffer + CodeSize); + + Xpos++; + + if (Xpos == Buff->ScreenBufferSize.X) + { + Xpos = 0; + Ypos++; + + if (Ypos == Buff->ScreenBufferSize.Y) + { + Ypos = 0; + } + } + } + + // switch (CodeType) + // { + // case CODE_UNICODE: + // *(PWCHAR)ReadBuffer = 0; + // break; + + // case CODE_ASCII: + // *(PCHAR)ReadBuffer = 0; + // break; + + // case CODE_ATTRIBUTE: + // *(PWORD)ReadBuffer = 0; + // break; + // } + + ReadOutputCodeRequest->EndCoord.X = Xpos; + ReadOutputCodeRequest->EndCoord.Y = (Ypos - Buff->VirtualY + Buff->ScreenBufferSize.Y) % Buff->ScreenBufferSize.Y; + + ConSrvReleaseScreenBuffer(Buff, TRUE); + + ReadOutputCodeRequest->CodesRead = (DWORD)((ULONG_PTR)ReadBuffer - (ULONG_PTR)ReadOutputCodeRequest->pCode.pCode) / CodeSize; + // <= ReadOutputCodeRequest->NumCodesToRead + + return STATUS_SUCCESS; +} + +CSR_API(SrvWriteConsoleOutputString) +{ + NTSTATUS Status; + PCONSOLE_WRITEOUTPUTCODE WriteOutputCodeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteOutputCodeRequest; + PCONSOLE Console; + PCONSOLE_SCREEN_BUFFER Buff; + USHORT CodeType; + PBYTE Buffer; // PUCHAR + PCHAR String, tmpString = NULL; + DWORD X, Y, Length; // , Written = 0; + ULONG CodeSize; + SMALL_RECT UpdateRect; + + DPRINT("SrvWriteConsoleOutputString\n"); + + CodeType = WriteOutputCodeRequest->CodeType; + switch (CodeType) + { + case CODE_ASCII: + CodeSize = sizeof(CHAR); + break; + + case CODE_UNICODE: + CodeSize = sizeof(WCHAR); + break; + + case CODE_ATTRIBUTE: + CodeSize = sizeof(WORD); + break; + + default: + return STATUS_INVALID_PARAMETER; + } + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&WriteOutputCodeRequest->pCode.pCode, + WriteOutputCodeRequest->Length, + CodeSize)) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + WriteOutputCodeRequest->OutputHandle, + &Buff, + GENERIC_WRITE, + TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + switch (CodeType) + { + case CODE_UNICODE: + { + Length = WideCharToMultiByte(Console->OutputCodePage, 0, + (PWCHAR)WriteOutputCodeRequest->pCode.UnicodeChar, + WriteOutputCodeRequest->Length, + NULL, 0, NULL, NULL); + tmpString = String = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length); + if (String) + { + WideCharToMultiByte(Console->OutputCodePage, 0, + (PWCHAR)WriteOutputCodeRequest->pCode.UnicodeChar, + WriteOutputCodeRequest->Length, + String, Length, NULL, NULL); + } + else + { + Status = STATUS_NO_MEMORY; + } + + break; + } + + case CODE_ASCII: + String = (PCHAR)WriteOutputCodeRequest->pCode.AsciiChar; + break; + + case CODE_ATTRIBUTE: + default: + // *(ReadBuffer++) = Code; + String = (PCHAR)WriteOutputCodeRequest->pCode.Attribute; + break; + } + + if (String && NT_SUCCESS(Status)) + { + X = WriteOutputCodeRequest->Coord.X; + Y = (WriteOutputCodeRequest->Coord.Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y; + Length = WriteOutputCodeRequest->Length; + Buffer = &Buff->Buffer[2 * (Y * Buff->ScreenBufferSize.X + X) + (CodeType == CODE_ATTRIBUTE ? 1 : 0)]; + + while (Length--) + { + *Buffer = *String++; + // ReadBuffer = (PVOID)((ULONG_PTR)ReadBuffer + CodeSize); + String = (PCHAR)((ULONG_PTR)String + CodeSize); + // Written++; + Buffer += 2; + if (++X == Buff->ScreenBufferSize.X) + { + if (++Y == Buff->ScreenBufferSize.Y) + { + Y = 0; + Buffer = Buff->Buffer + (CodeType == CODE_ATTRIBUTE ? 1 : 0); + } + X = 0; + } + } + + if (Buff == Console->ActiveBuffer) + { + ConioComputeUpdateRect(Buff, &UpdateRect, &WriteOutputCodeRequest->Coord, + WriteOutputCodeRequest->Length); + ConioDrawRegion(Console, &UpdateRect); + } + + // WriteOutputCodeRequest->EndCoord.X = X; + // WriteOutputCodeRequest->EndCoord.Y = (Y + Buff->ScreenBufferSize.Y - Buff->VirtualY) % Buff->ScreenBufferSize.Y; + } + + if (tmpString) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, tmpString); + } + + ConSrvReleaseScreenBuffer(Buff, TRUE); + + // WriteOutputCodeRequest->NrCharactersWritten = Written; + return Status; +} + +CSR_API(SrvFillConsoleOutput) +{ + NTSTATUS Status; + PCONSOLE_FILLOUTPUTCODE FillOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.FillOutputRequest; + PCONSOLE Console; + PCONSOLE_SCREEN_BUFFER Buff; + DWORD X, Y, Length; // , Written = 0; + USHORT CodeType; + BYTE Code; + PBYTE Buffer; + SMALL_RECT UpdateRect; + + DPRINT("SrvFillConsoleOutput\n"); + + Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), FillOutputRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + CodeType = FillOutputRequest->CodeType; + + X = FillOutputRequest->Coord.X; + Y = (FillOutputRequest->Coord.Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y; + Length = FillOutputRequest->Length; + Buffer = &Buff->Buffer[2 * (Y * Buff->ScreenBufferSize.X + X) + (CodeType == CODE_ATTRIBUTE ? 1 : 0)]; + + switch (CodeType) + { + case CODE_ASCII: + Code = (BYTE)FillOutputRequest->Code.AsciiChar; + break; + + case CODE_UNICODE: + ConsoleUnicodeCharToAnsiChar(Console, (PCHAR)&Code, &FillOutputRequest->Code.UnicodeChar); + break; + + case CODE_ATTRIBUTE: + Code = (BYTE)FillOutputRequest->Code.Attribute; + break; + + default: + ConSrvReleaseScreenBuffer(Buff, TRUE); + return STATUS_INVALID_PARAMETER; + } + + while (Length--) + { + *Buffer = Code; + Buffer += 2; + // Written++; + if (++X == Buff->ScreenBufferSize.X) + { + if (++Y == Buff->ScreenBufferSize.Y) + { + Y = 0; + Buffer = Buff->Buffer + (CodeType == CODE_ATTRIBUTE ? 1 : 0); + } + X = 0; + } + } + + if (Buff == Console->ActiveBuffer) + { + ConioComputeUpdateRect(Buff, &UpdateRect, &FillOutputRequest->Coord, + FillOutputRequest->Length); + ConioDrawRegion(Console, &UpdateRect); + } + + ConSrvReleaseScreenBuffer(Buff, TRUE); +/* + Length = FillOutputRequest->Length; + FillOutputRequest->NrCharactersWritten = Length; +*/ + return STATUS_SUCCESS; +} + +CSR_API(SrvGetConsoleCursorInfo) +{ + NTSTATUS Status; + PCONSOLE_GETSETCURSORINFO CursorInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CursorInfoRequest; + PCONSOLE_SCREEN_BUFFER Buff; + + DPRINT("SrvGetConsoleCursorInfo\n"); + + Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), CursorInfoRequest->OutputHandle, &Buff, GENERIC_READ, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + CursorInfoRequest->Info.bVisible = Buff->CursorInfo.bVisible; + CursorInfoRequest->Info.dwSize = Buff->CursorInfo.dwSize; + ConSrvReleaseScreenBuffer(Buff, TRUE); + + return STATUS_SUCCESS; +} + +CSR_API(SrvSetConsoleCursorInfo) +{ + NTSTATUS Status; + PCONSOLE_GETSETCURSORINFO CursorInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CursorInfoRequest; + PCONSOLE Console; + PCONSOLE_SCREEN_BUFFER Buff; + DWORD Size; + BOOL Visible; + + DPRINT("SrvSetConsoleCursorInfo\n"); + + Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), CursorInfoRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + Size = CursorInfoRequest->Info.dwSize; + Visible = CursorInfoRequest->Info.bVisible; + if (Size < 1) + { + Size = 1; + } + if (100 < Size) + { + Size = 100; + } + + if ( (Size != Buff->CursorInfo.dwSize) || + (Visible && ! Buff->CursorInfo.bVisible) || + (! Visible && Buff->CursorInfo.bVisible) ) + { + Buff->CursorInfo.dwSize = Size; + Buff->CursorInfo.bVisible = Visible; + + if (!ConioSetCursorInfo(Console, Buff)) + { + ConSrvReleaseScreenBuffer(Buff, TRUE); + return STATUS_UNSUCCESSFUL; + } + } + + ConSrvReleaseScreenBuffer(Buff, TRUE); + + return STATUS_SUCCESS; +} + +CSR_API(SrvSetConsoleCursorPosition) +{ + NTSTATUS Status; + PCONSOLE_SETCURSORPOSITION SetCursorPositionRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetCursorPositionRequest; + PCONSOLE Console; + PCONSOLE_SCREEN_BUFFER Buff; + LONG OldCursorX, OldCursorY; + LONG NewCursorX, NewCursorY; + + DPRINT("SrvSetConsoleCursorPosition\n"); + + Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetCursorPositionRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + NewCursorX = SetCursorPositionRequest->Position.X; + NewCursorY = SetCursorPositionRequest->Position.Y; + if ( NewCursorX < 0 || NewCursorX >= Buff->ScreenBufferSize.X || + NewCursorY < 0 || NewCursorY >= Buff->ScreenBufferSize.Y ) + { + ConSrvReleaseScreenBuffer(Buff, TRUE); + return STATUS_INVALID_PARAMETER; + } + OldCursorX = Buff->CursorPosition.X; + OldCursorY = Buff->CursorPosition.Y; + Buff->CursorPosition.X = NewCursorX; + Buff->CursorPosition.Y = NewCursorY; + if (Buff == Console->ActiveBuffer) + { + if (!ConioSetScreenInfo(Console, Buff, OldCursorX, OldCursorY)) + { + ConSrvReleaseScreenBuffer(Buff, TRUE); + return STATUS_UNSUCCESSFUL; + } + } + + ConSrvReleaseScreenBuffer(Buff, TRUE); + + return STATUS_SUCCESS; +} + +CSR_API(SrvSetConsoleTextAttribute) +{ + NTSTATUS Status; + PCONSOLE_SETTEXTATTRIB SetTextAttribRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetTextAttribRequest; + PCONSOLE Console; + PCONSOLE_SCREEN_BUFFER Buff; + + DPRINT("SrvSetConsoleTextAttribute\n"); + + Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetTextAttribRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + Buff->ScreenDefaultAttrib = SetTextAttribRequest->Attrib; + if (Buff == Console->ActiveBuffer) + { + if (!ConioUpdateScreenInfo(Console, Buff)) + { + ConSrvReleaseScreenBuffer(Buff, TRUE); + return STATUS_UNSUCCESSFUL; + } + } + + ConSrvReleaseScreenBuffer(Buff, TRUE); + + return STATUS_SUCCESS; +} + +CSR_API(SrvCreateConsoleScreenBuffer) +{ + NTSTATUS Status; + PCONSOLE_CREATESCREENBUFFER CreateScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CreateScreenBufferRequest; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + PCONSOLE Console; + PCONSOLE_SCREEN_BUFFER Buff; + + COORD ScreenBufferSize = (COORD){80, 25}; + USHORT ScreenAttrib = DEFAULT_SCREEN_ATTRIB; + USHORT PopupAttrib = DEFAULT_POPUP_ATTRIB; + BOOLEAN IsCursorVisible = TRUE; + ULONG CursorSize = CSR_DEFAULT_CURSOR_SIZE; + + DPRINT("SrvCreateConsoleScreenBuffer\n"); + + RtlEnterCriticalSection(&ProcessData->HandleTableLock); + + Status = ConSrvGetConsole(ProcessData, &Console, TRUE); + if (!NT_SUCCESS(Status)) + { + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return Status; + } + + if (Console->ActiveBuffer) + { + ScreenBufferSize = Console->ActiveBuffer->ScreenBufferSize; + if (ScreenBufferSize.X == 0) ScreenBufferSize.X = 80; + if (ScreenBufferSize.Y == 0) ScreenBufferSize.Y = 25; + + ScreenAttrib = Console->ActiveBuffer->ScreenDefaultAttrib; + PopupAttrib = Console->ActiveBuffer->PopupDefaultAttrib; + + IsCursorVisible = Console->ActiveBuffer->CursorInfo.bVisible; + CursorSize = Console->ActiveBuffer->CursorInfo.dwSize; + } + + Status = ConSrvCreateScreenBuffer(Console, + &Buff, + ScreenBufferSize, + ScreenAttrib, + PopupAttrib, + IsCursorVisible, + CursorSize); + if (NT_SUCCESS(Status)) + { + Status = ConSrvInsertObject(ProcessData, + &CreateScreenBufferRequest->OutputHandle, + &Buff->Header, + CreateScreenBufferRequest->Access, + CreateScreenBufferRequest->Inheritable, + CreateScreenBufferRequest->ShareMode); + } + + ConSrvReleaseConsole(Console, TRUE); + + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + + return Status; +} + +CSR_API(SrvGetConsoleScreenBufferInfo) +{ + NTSTATUS Status; + PCONSOLE_GETSCREENBUFFERINFO ScreenBufferInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScreenBufferInfoRequest; + PCONSOLE Console; + PCONSOLE_SCREEN_BUFFER Buff; + PCONSOLE_SCREEN_BUFFER_INFO pInfo = &ScreenBufferInfoRequest->Info; + + DPRINT("SrvGetConsoleScreenBufferInfo\n"); + + Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), ScreenBufferInfoRequest->OutputHandle, &Buff, GENERIC_READ, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + pInfo->dwSize = Buff->ScreenBufferSize; + pInfo->dwCursorPosition = Buff->CursorPosition; + pInfo->wAttributes = Buff->ScreenDefaultAttrib; + pInfo->srWindow.Left = Buff->ShowX; + pInfo->srWindow.Right = Buff->ShowX + Console->ConsoleSize.X - 1; + pInfo->srWindow.Top = Buff->ShowY; + pInfo->srWindow.Bottom = Buff->ShowY + Console->ConsoleSize.Y - 1; + pInfo->dwMaximumWindowSize = Buff->ScreenBufferSize; + + ConSrvReleaseScreenBuffer(Buff, TRUE); + + return STATUS_SUCCESS; +} + +CSR_API(SrvSetConsoleActiveScreenBuffer) +{ + NTSTATUS Status; + PCONSOLE_SETACTIVESCREENBUFFER SetScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetScreenBufferRequest; + PCONSOLE Console; + PCONSOLE_SCREEN_BUFFER Buff; + + DPRINT("SrvSetConsoleActiveScreenBuffer\n"); + + Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetScreenBufferRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + if (Buff == Console->ActiveBuffer) + { + ConSrvReleaseScreenBuffer(Buff, TRUE); + return STATUS_SUCCESS; + } + + /* If old buffer has no handles, it's now unreferenced */ + if (Console->ActiveBuffer->Header.HandleCount == 0) + { + ConioDeleteScreenBuffer(Console->ActiveBuffer); + } + + /* Tie console to new buffer */ + Console->ActiveBuffer = Buff; + + /* Redraw the console */ + ConioDrawConsole(Console); + + ConSrvReleaseScreenBuffer(Buff, TRUE); + + return STATUS_SUCCESS; +} + +CSR_API(SrvScrollConsoleScreenBuffer) +{ + PCONSOLE_SCROLLSCREENBUFFER ScrollScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScrollScreenBufferRequest; + PCONSOLE Console; + PCONSOLE_SCREEN_BUFFER Buff; + SMALL_RECT ScreenBuffer; + SMALL_RECT SrcRegion; + SMALL_RECT DstRegion; + SMALL_RECT UpdateRegion; + SMALL_RECT ScrollRectangle; + SMALL_RECT ClipRectangle; + NTSTATUS Status; + HANDLE OutputHandle; + BOOLEAN UseClipRectangle; + COORD DestinationOrigin; + CHAR_INFO Fill; + CHAR FillChar; + + DPRINT("SrvScrollConsoleScreenBuffer\n"); + + OutputHandle = ScrollScreenBufferRequest->OutputHandle; + UseClipRectangle = ScrollScreenBufferRequest->UseClipRectangle; + DestinationOrigin = ScrollScreenBufferRequest->DestinationOrigin; + Fill = ScrollScreenBufferRequest->Fill; + + Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), OutputHandle, &Buff, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + ScrollRectangle = ScrollScreenBufferRequest->ScrollRectangle; + + /* Make sure source rectangle is inside the screen buffer */ + ConioInitRect(&ScreenBuffer, 0, 0, Buff->ScreenBufferSize.Y - 1, Buff->ScreenBufferSize.X - 1); + if (!ConioGetIntersection(&SrcRegion, &ScreenBuffer, &ScrollRectangle)) + { + ConSrvReleaseScreenBuffer(Buff, TRUE); + return STATUS_SUCCESS; + } + + /* If the source was clipped on the left or top, adjust the destination accordingly */ + if (ScrollRectangle.Left < 0) + { + DestinationOrigin.X -= ScrollRectangle.Left; + } + if (ScrollRectangle.Top < 0) + { + DestinationOrigin.Y -= ScrollRectangle.Top; + } + + if (UseClipRectangle) + { + ClipRectangle = ScrollScreenBufferRequest->ClipRectangle; + if (!ConioGetIntersection(&ClipRectangle, &ClipRectangle, &ScreenBuffer)) + { + ConSrvReleaseScreenBuffer(Buff, TRUE); + return STATUS_SUCCESS; + } + } + else + { + ClipRectangle = ScreenBuffer; + } + + ConioInitRect(&DstRegion, + DestinationOrigin.Y, + DestinationOrigin.X, + DestinationOrigin.Y + ConioRectHeight(&SrcRegion) - 1, + DestinationOrigin.X + ConioRectWidth(&SrcRegion) - 1); + + if (ScrollScreenBufferRequest->Unicode) + ConsoleUnicodeCharToAnsiChar(Console, &FillChar, &Fill.Char.UnicodeChar); + else + FillChar = Fill.Char.AsciiChar; + + ConioMoveRegion(Buff, &SrcRegion, &DstRegion, &ClipRectangle, Fill.Attributes << 8 | (BYTE)FillChar); + + if (Buff == Console->ActiveBuffer) + { + ConioGetUnion(&UpdateRegion, &SrcRegion, &DstRegion); + if (ConioGetIntersection(&UpdateRegion, &UpdateRegion, &ClipRectangle)) + { + /* Draw update region */ + ConioDrawRegion(Console, &UpdateRegion); + } + } + + ConSrvReleaseScreenBuffer(Buff, TRUE); + + return STATUS_SUCCESS; +} + +CSR_API(SrvSetConsoleScreenBufferSize) +{ + NTSTATUS Status; + PCONSOLE_SETSCREENBUFFERSIZE SetScreenBufferSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetScreenBufferSizeRequest; + PCONSOLE_SCREEN_BUFFER Buff; + + Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetScreenBufferSizeRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Status = ConioResizeBuffer(Buff->Header.Console, Buff, SetScreenBufferSizeRequest->Size); + ConSrvReleaseScreenBuffer(Buff, TRUE); + + return Status; +} + +/* EOF */ Index: win32ss/user/consrv/conoutput.c =================================================================== --- win32ss/user/consrv/conoutput.c (rvision 58607) +++ win32ss/user/consrv/conoutput.c (copie de travail) Modification de proprits sur win32ss/user/consrv/conoutput.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/console.c =================================================================== --- win32ss/user/consrv/console.c (rvision 0) +++ win32ss/user/consrv/console.c (copie de travail) @@ -0,0 +1,1168 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/console.c + * PURPOSE: Console I/O functions + * PROGRAMMERS: + */ + +/* INCLUDES *******************************************************************/ + +#define COBJMACROS +#define NONAMELESSUNION + +#include "consrv.h" +#include "conio.h" +#include "settings.h" + +#include "guiconsole.h" + +#ifdef TUI_CONSOLE + #include "tuiconsole.h" +#endif + +#include +#include + +//#define NDEBUG +#include + + +/* PRIVATE FUNCTIONS **********************************************************/ + +#ifdef TUI_CONSOLE +static BOOL +DtbgIsDesktopVisible(VOID) +{ + return !((BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_ISCONSOLEMODE)); +} +#endif + +static ULONG +ConSrvConsoleCtrlEventTimeout(DWORD Event, + PCONSOLE_PROCESS_DATA ProcessData, + DWORD Timeout) +{ + ULONG Status = ERROR_SUCCESS; + HANDLE Thread; + + DPRINT("ConSrvConsoleCtrlEvent Parent ProcessId = %x\n", ProcessData->Process->ClientId.UniqueProcess); + + if (ProcessData->CtrlDispatcher) + { + Thread = CreateRemoteThread(ProcessData->Process->ProcessHandle, NULL, 0, + ProcessData->CtrlDispatcher, + UlongToPtr(Event), 0, NULL); + if (NULL == Thread) + { + Status = GetLastError(); + DPRINT1("Failed thread creation (Error: 0x%x)\n", Status); + } + else + { + DPRINT("We succeeded at creating ProcessData->CtrlDispatcher remote thread, ProcessId = %x, Process = 0x%p\n", ProcessData->Process->ClientId.UniqueProcess, ProcessData->Process); + WaitForSingleObject(Thread, Timeout); + CloseHandle(Thread); + } + } + + return Status; +} + +static ULONG +ConSrvConsoleCtrlEvent(DWORD Event, + PCONSOLE_PROCESS_DATA ProcessData) +{ + return ConSrvConsoleCtrlEventTimeout(Event, ProcessData, 0); +} + +ULONG FASTCALL +ConSrvConsoleProcessCtrlEvent(PCONSOLE Console, + ULONG ProcessGroupId, + DWORD Event) +{ + ULONG Status = ERROR_SUCCESS; + PLIST_ENTRY current_entry; + PCONSOLE_PROCESS_DATA current; + + /* + * Loop through the process list, from the most recent process + * (the active one) to the oldest one (the first created, i.e. + * the console leader process), and for each, send an event + * (new processes are inserted at the head of the console process list). + */ + current_entry = Console->ProcessList.Flink; + while (current_entry != &Console->ProcessList) + { + current = CONTAINING_RECORD(current_entry, CONSOLE_PROCESS_DATA, ConsoleLink); + current_entry = current_entry->Flink; + + /* + * Only processes belonging to the same process group are signaled. + * If the process group ID is zero, then all the processes are signaled. + */ + if (ProcessGroupId == 0 || current->Process->ProcessGroupId == ProcessGroupId) + { + Status = ConSrvConsoleCtrlEvent(Event, current); + } + } + + return Status; +} + +VOID FASTCALL +ConioPause(PCONSOLE Console, UINT Flags) +{ + Console->PauseFlags |= Flags; + if (!Console->UnpauseEvent) + Console->UnpauseEvent = CreateEvent(NULL, TRUE, FALSE, NULL); +} + +VOID FASTCALL +ConioUnpause(PCONSOLE Console, UINT Flags) +{ + Console->PauseFlags &= ~Flags; + + // if ((Console->PauseFlags & (PAUSED_FROM_KEYBOARD | PAUSED_FROM_SCROLLBAR | PAUSED_FROM_SELECTION)) == 0) + if (Console->PauseFlags == 0 && Console->UnpauseEvent) + { + SetEvent(Console->UnpauseEvent); + CloseHandle(Console->UnpauseEvent); + Console->UnpauseEvent = NULL; + + CsrNotifyWait(&Console->WriteWaitQueue, + WaitAll, + NULL, + NULL); + if (!IsListEmpty(&Console->WriteWaitQueue)) + { + CsrDereferenceWait(&Console->WriteWaitQueue); + } + } +} + +static BOOL +LoadShellLinkConsoleInfo(IN OUT PCONSOLE_START_INFO ConsoleStartInfo, + IN OUT PCONSOLE_INFO ConsoleInfo, + OUT LPWSTR IconPath, + IN SIZE_T IconPathLength, + OUT PINT piIcon) +{ +#define PATH_SEPARATOR L'\\' + + BOOL RetVal = FALSE; + LPWSTR LinkName = NULL; + SIZE_T Length = 0; + + if ((ConsoleStartInfo->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(ConsoleStartInfo->ConsoleTitle, PATH_SEPARATOR); + if (LinkName == NULL) + { + LinkName = ConsoleStartInfo->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, ConsoleStartInfo->ConsoleTitle, STGM_READ); + if (SUCCEEDED(hRes)) + { + /* + * Finally we can get the properties ! + * Update the old ones if needed. + */ + INT ShowCmd = 0; + // WORD HotKey = 0; + + /* Reset the name of the console with the name of the shortcut */ + Length = min(/*Length*/ Length - 4, // 4 == len(".lnk") + sizeof(ConsoleInfo->ConsoleTitle) / sizeof(ConsoleInfo->ConsoleTitle[0]) - 1); + wcsncpy(ConsoleInfo->ConsoleTitle, LinkName, Length); + ConsoleInfo->ConsoleTitle[Length] = L'\0'; + + /* Get the window showing command */ + hRes = IShellLinkW_GetShowCmd(pshl, &ShowCmd); + if (SUCCEEDED(hRes)) ConsoleStartInfo->ShowWindow = (WORD)ShowCmd; + + /* Get the hotkey */ + // hRes = pshl->GetHotkey(&ShowCmd); + // if (SUCCEEDED(hRes)) ConsoleStartInfo->HotKey = HotKey; + + /* Get the icon location, if any */ + hRes = IShellLinkW_GetIconLocation(pshl, IconPath, IconPathLength, piIcon); + if (!SUCCEEDED(hRes)) + { + IconPath[0] = L'\0'; + } + + // FIXME: Since we still don't load console properties from the shortcut, + // return false. When this will be done, we will return true instead. + RetVal = FALSE; + } + IPersistFile_Release(ppf); + } + IShellLinkW_Release(pshl); + } + } + CoUninitialize(); + + return RetVal; +} + +NTSTATUS WINAPI +ConSrvInitConsole(OUT PCONSOLE* NewConsole, + IN OUT PCONSOLE_START_INFO ConsoleStartInfo, + IN PCSR_PROCESS ConsoleLeaderProcess) +{ + NTSTATUS Status; + SECURITY_ATTRIBUTES SecurityAttributes; + CONSOLE_INFO ConsoleInfo; + SIZE_T Length = 0; + DWORD ProcessId = HandleToUlong(ConsoleLeaderProcess->ClientId.UniqueProcess); + PCONSOLE Console; + PCONSOLE_SCREEN_BUFFER NewBuffer; + BOOL GuiMode; + WCHAR Title[128]; + WCHAR IconPath[MAX_PATH + 1] = L""; + INT iIcon = 0; + + if (NewConsole == NULL) return STATUS_INVALID_PARAMETER; + *NewConsole = NULL; + + /* + * Allocate a console structure + */ + Console = RtlAllocateHeap(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(CONSOLE)); + if (NULL == Console) + { + DPRINT1("Not enough memory for console creation.\n"); + return STATUS_NO_MEMORY; + } + + /* + * Load the console settings + */ + + /* 1. Load the default settings */ + ConSrvGetDefaultSettings(&ConsoleInfo, ProcessId); + + /* 2. Get the title of the console (initialize ConsoleInfo.ConsoleTitle) */ + Length = min(wcslen(ConsoleStartInfo->ConsoleTitle), + sizeof(ConsoleInfo.ConsoleTitle) / sizeof(ConsoleInfo.ConsoleTitle[0]) - 1); + wcsncpy(ConsoleInfo.ConsoleTitle, ConsoleStartInfo->ConsoleTitle, Length); + ConsoleInfo.ConsoleTitle[Length] = L'\0'; + + /* + * 3. Check whether the process creating the console was launched + * via a shell-link. ConsoleInfo.ConsoleTitle may be updated by + * the name of the shortcut. + */ + if (ConsoleStartInfo->dwStartupFlags & STARTF_TITLEISLINKNAME) + { + if (!LoadShellLinkConsoleInfo(ConsoleStartInfo, + &ConsoleInfo, + IconPath, + MAX_PATH, + &iIcon)) + { + ConsoleStartInfo->dwStartupFlags &= ~STARTF_TITLEISLINKNAME; + } + } + + /* + * 4. Load the remaining console settings via the registry. + */ + if ((ConsoleStartInfo->dwStartupFlags & STARTF_TITLEISLINKNAME) == 0) + { + /* + * Either we weren't created by an app launched via a shell-link, + * or we failed to load shell-link console properties. + * Therefore, load the console infos for the application from the registry. + */ + ConSrvReadUserSettings(&ConsoleInfo, ProcessId); + + /* + * Now, update them with the properties the user might gave to us + * via the STARTUPINFO structure before calling CreateProcess + * (and which was transmitted via the ConsoleStartInfo structure). + * We therefore overwrite the values read in the registry. + */ + if (ConsoleStartInfo->dwStartupFlags & STARTF_USEFILLATTRIBUTE) + { + ConsoleInfo.ScreenAttrib = ConsoleStartInfo->FillAttribute; + } + if (ConsoleStartInfo->dwStartupFlags & STARTF_USECOUNTCHARS) + { + ConsoleInfo.ScreenBufferSize = ConsoleStartInfo->ScreenBufferSize; + } + if (ConsoleStartInfo->dwStartupFlags & STARTF_USESIZE) + { + // ConsoleInfo->ConsoleSize = ConsoleStartInfo->ConsoleWindowSize; + ConsoleInfo.ConsoleSize.X = (SHORT)ConsoleStartInfo->ConsoleWindowSize.cx; + ConsoleInfo.ConsoleSize.Y = (SHORT)ConsoleStartInfo->ConsoleWindowSize.cy; + } + /* + if (ConsoleStartInfo->dwStartupFlags & STARTF_RUNFULLSCREEN) + { + } + */ + } + + /* + * Initialize the console + */ + InitializeCriticalSection(&Console->Lock); + Console->ReferenceCount = 0; + InitializeListHead(&Console->ProcessList); + memcpy(Console->Colors, ConsoleInfo.Colors, sizeof(ConsoleInfo.Colors)); + Console->ConsoleSize = ConsoleInfo.ConsoleSize; + + /* + * Initialize the input buffer + */ + Console->InputBuffer.Header.Type = CONIO_INPUT_BUFFER_MAGIC; + Console->InputBuffer.Header.Console = Console; + + SecurityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES); + SecurityAttributes.lpSecurityDescriptor = NULL; + SecurityAttributes.bInheritHandle = TRUE; + Console->InputBuffer.ActiveEvent = CreateEventW(&SecurityAttributes, TRUE, FALSE, NULL); + if (NULL == Console->InputBuffer.ActiveEvent) + { + DeleteCriticalSection(&Console->Lock); + RtlFreeHeap(ConSrvHeap, 0, Console); + return STATUS_UNSUCCESSFUL; + } + + // TODO: Use the values from ConsoleInfo. + Console->InputBuffer.Mode = ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | + ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT; + Console->QuickEdit = ConsoleInfo.QuickEdit; + Console->InsertMode = ConsoleInfo.InsertMode; + InitializeListHead(&Console->InputBuffer.ReadWaitQueue); + InitializeListHead(&Console->InputBuffer.InputEvents); + Console->LineBuffer = NULL; + Console->CodePage = GetOEMCP(); + Console->OutputCodePage = GetOEMCP(); + + /* Initialize a new screen buffer with default settings */ + InitializeListHead(&Console->BufferList); + Status = ConSrvCreateScreenBuffer(Console, + &NewBuffer, + ConsoleInfo.ScreenBufferSize, + ConsoleInfo.ScreenAttrib, + ConsoleInfo.PopupAttrib, + TRUE, + ConsoleInfo.CursorSize); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ConSrvCreateScreenBuffer: failed, Status = 0x%08lx\n", Status); + CloseHandle(Console->InputBuffer.ActiveEvent); + DeleteCriticalSection(&Console->Lock); + RtlFreeHeap(ConSrvHeap, 0, Console); + return Status; + } + /* Make the new screen buffer active */ + Console->ActiveBuffer = NewBuffer; + Console->FullScreen = ConsoleInfo.FullScreen; + InitializeListHead(&Console->WriteWaitQueue); + + /* + * Initialize the history buffers + */ + InitializeListHead(&Console->HistoryBuffers); + Console->HistoryBufferSize = ConsoleInfo.HistoryBufferSize; + Console->NumberOfHistoryBuffers = ConsoleInfo.NumberOfHistoryBuffers; + Console->HistoryNoDup = ConsoleInfo.HistoryNoDup; + + /* Initialize the console title */ + RtlCreateUnicodeString(&Console->OriginalTitle, ConsoleInfo.ConsoleTitle); + if (ConsoleInfo.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, ConsoleInfo.ConsoleTitle); + } + + /* + * If we are not in GUI-mode, start the text-mode terminal emulator. + * If we fail, try to start the GUI-mode terminal emulator. + */ +#ifdef TUI_CONSOLE + GuiMode = DtbgIsDesktopVisible(); +#else + GuiMode = TRUE; +#endif + +#ifdef TUI_CONSOLE + if (!GuiMode) + { + DPRINT1("CONSRV: Opening text-mode terminal emulator\n"); + Status = TuiInitConsole(Console, + ConsoleStartInfo, + &ConsoleInfo, + ProcessId); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to open text-mode terminal emulator, switching to gui-mode, Status = 0x%08lx\n", Status); + GuiMode = TRUE; + } + } +#endif + + /* + * Try to open the GUI-mode terminal emulator. Two cases are possible: + * - We are in GUI-mode, therefore GuiMode == TRUE, the previous test-case + * failed and we start GUI-mode terminal emulator. + * - We are in text-mode, therefore GuiMode == FALSE, the previous test-case + * succeeded BUT we failed at starting text-mode terminal emulator. + * Then GuiMode was switched to TRUE in order to try to open the GUI-mode + * terminal emulator (Win32k will automatically switch to graphical mode, + * therefore no additional code is needed). + */ + if (GuiMode) + { + DPRINT1("CONSRV: Opening GUI-mode terminal emulator\n"); + Status = GuiInitConsole(Console, + ConsoleStartInfo, + &ConsoleInfo, + ProcessId, + IconPath, + iIcon); + if (!NT_SUCCESS(Status)) + { + DPRINT1("GuiInitConsole: failed, Status = 0x%08lx\n", Status); + RtlFreeUnicodeString(&Console->Title); + RtlFreeUnicodeString(&Console->OriginalTitle); + ConioDeleteScreenBuffer(NewBuffer); + CloseHandle(Console->InputBuffer.ActiveEvent); + DeleteCriticalSection(&Console->Lock); + RtlFreeHeap(ConSrvHeap, 0, Console); + return Status; + } + } + + /* Copy buffer contents to screen */ + ConioDrawConsole(Console); + + /* Return the newly created console to the caller and a success code too */ + *NewConsole = Console; + return STATUS_SUCCESS; +} + +VOID WINAPI +ConSrvInitConsoleSupport(VOID) +{ + DPRINT("CONSRV: ConSrvInitConsoleSupport()\n"); + + /* Should call LoadKeyboardLayout */ +} + +VOID WINAPI +ConSrvDeleteConsole(PCONSOLE Console) +{ + ConsoleInput *Event; + + DPRINT("ConSrvDeleteConsole\n"); + + /* Drain input event queue */ + while (Console->InputBuffer.InputEvents.Flink != &Console->InputBuffer.InputEvents) + { + Event = (ConsoleInput *) Console->InputBuffer.InputEvents.Flink; + Console->InputBuffer.InputEvents.Flink = Console->InputBuffer.InputEvents.Flink->Flink; + Console->InputBuffer.InputEvents.Flink->Flink->Blink = &Console->InputBuffer.InputEvents; + RtlFreeHeap(ConSrvHeap, 0, Event); + } + + ConioCleanupConsole(Console); + if (Console->LineBuffer) + RtlFreeHeap(ConSrvHeap, 0, Console->LineBuffer); + while (!IsListEmpty(&Console->HistoryBuffers)) + HistoryDeleteBuffer((struct _HISTORY_BUFFER *)Console->HistoryBuffers.Flink); + + ConioDeleteScreenBuffer(Console->ActiveBuffer); + if (!IsListEmpty(&Console->BufferList)) + { + DPRINT1("BUG: screen buffer list not empty\n"); + } + + CloseHandle(Console->InputBuffer.ActiveEvent); + if (Console->UnpauseEvent) CloseHandle(Console->UnpauseEvent); + DeleteCriticalSection(&Console->Lock); + + RtlFreeUnicodeString(&Console->OriginalTitle); + RtlFreeUnicodeString(&Console->Title); + IntDeleteAllAliases(Console->Aliases); + RtlFreeHeap(ConSrvHeap, 0, Console); +} + + +/* PUBLIC SERVER APIS *********************************************************/ + +CSR_API(SrvOpenConsole) +{ + NTSTATUS Status = STATUS_SUCCESS; + PCONSOLE_OPENCONSOLE OpenConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.OpenConsoleRequest; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + + OpenConsoleRequest->ConsoleHandle = INVALID_HANDLE_VALUE; + + RtlEnterCriticalSection(&ProcessData->HandleTableLock); + + if (ProcessData->Console) + { + DWORD DesiredAccess = OpenConsoleRequest->Access; + DWORD ShareMode = OpenConsoleRequest->ShareMode; + + PCONSOLE Console = ProcessData->Console; + Object_t *Object; + + EnterCriticalSection(&Console->Lock); + + if (OpenConsoleRequest->HandleType == HANDLE_OUTPUT) + { + Object = &Console->ActiveBuffer->Header; + } + else // HANDLE_INPUT + { + Object = &Console->InputBuffer.Header; + } + + if (((DesiredAccess & GENERIC_READ) && Object->ExclusiveRead != 0) || + ((DesiredAccess & GENERIC_WRITE) && Object->ExclusiveWrite != 0) || + (!(ShareMode & FILE_SHARE_READ) && Object->AccessRead != 0) || + (!(ShareMode & FILE_SHARE_WRITE) && Object->AccessWrite != 0)) + { + DPRINT1("Sharing violation\n"); + Status = STATUS_SHARING_VIOLATION; + } + else + { + Status = ConSrvInsertObject(ProcessData, + &OpenConsoleRequest->ConsoleHandle, + Object, + DesiredAccess, + OpenConsoleRequest->Inheritable, + ShareMode); + } + + LeaveCriticalSection(&Console->Lock); + } + + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + + return Status; +} + +CSR_API(SrvAllocConsole) +{ + NTSTATUS Status = STATUS_SUCCESS; + PCONSOLE_ALLOCCONSOLE AllocConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.AllocConsoleRequest; + PCSR_PROCESS CsrProcess = CsrGetClientThread()->Process; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrProcess); + + if (ProcessData->Console != NULL) + { + DPRINT1("Process already has a console\n"); + return STATUS_ACCESS_DENIED; + } + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&AllocConsoleRequest->ConsoleStartInfo, + 1, + sizeof(CONSOLE_START_INFO))) + { + return STATUS_INVALID_PARAMETER; + } + + /* + * We are about to create a new console. However when ConSrvNewProcess + * was called, we didn't know that we wanted to create a new console and + * therefore, we by default inherited the handles table from our parent + * process. It's only now that we notice that in fact we do not need + * them, because we've created a new console and thus we must use it. + * + * Therefore, free the console we can have and our handles table, + * and recreate a new one later on. + */ + ConSrvRemoveConsole(ProcessData); + + /* Initialize a new Console owned by the Console Leader Process */ + Status = ConSrvAllocateConsole(ProcessData, + &AllocConsoleRequest->InputHandle, + &AllocConsoleRequest->OutputHandle, + &AllocConsoleRequest->ErrorHandle, + AllocConsoleRequest->ConsoleStartInfo); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Console allocation failed\n"); + return Status; + } + + /* Return it to the caller */ + AllocConsoleRequest->Console = ProcessData->Console; + + /* Input Wait Handle */ + AllocConsoleRequest->InputWaitHandle = ProcessData->ConsoleEvent; + + /* Set the Property Dialog Handler */ + ProcessData->PropDispatcher = AllocConsoleRequest->PropDispatcher; + + /* Set the Ctrl Dispatcher */ + ProcessData->CtrlDispatcher = AllocConsoleRequest->CtrlDispatcher; + + return STATUS_SUCCESS; +} + +CSR_API(SrvAttachConsole) +{ + NTSTATUS Status = STATUS_SUCCESS; + PCONSOLE_ATTACHCONSOLE AttachConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.AttachConsoleRequest; + PCSR_PROCESS SourceProcess = NULL; // The parent process. + PCSR_PROCESS TargetProcess = CsrGetClientThread()->Process; // Ourselves. + HANDLE ProcessId = ULongToHandle(AttachConsoleRequest->ProcessId); + PCONSOLE_PROCESS_DATA SourceProcessData, TargetProcessData; + + TargetProcessData = ConsoleGetPerProcessData(TargetProcess); + + if (TargetProcessData->Console != NULL) + { + DPRINT1("Process already has a console\n"); + return STATUS_ACCESS_DENIED; + } + + /* Check whether we try to attach to the parent's console */ + if (ProcessId == ULongToHandle(ATTACH_PARENT_PROCESS)) + { + PROCESS_BASIC_INFORMATION ProcessInfo; + ULONG Length = sizeof(ProcessInfo); + + /* Get the real parent's ID */ + + Status = NtQueryInformationProcess(TargetProcess->ProcessHandle, + ProcessBasicInformation, + &ProcessInfo, + Length, &Length); + if (!NT_SUCCESS(Status)) + { + DPRINT1("SrvAttachConsole - Cannot retrieve basic process info, Status = %lu\n", Status); + return Status; + } + + ProcessId = ULongToHandle(ProcessInfo.InheritedFromUniqueProcessId); + } + + /* Lock the source process via its PID */ + Status = CsrLockProcessByClientId(ProcessId, &SourceProcess); + if (!NT_SUCCESS(Status)) return Status; + + SourceProcessData = ConsoleGetPerProcessData(SourceProcess); + + if (SourceProcessData->Console == NULL) + { + Status = STATUS_INVALID_HANDLE; + goto Quit; + } + + /* + * We are about to create a new console. However when ConSrvNewProcess + * was called, we didn't know that we wanted to create a new console and + * therefore, we by default inherited the handles table from our parent + * process. It's only now that we notice that in fact we do not need + * them, because we've created a new console and thus we must use it. + * + * Therefore, free the console we can have and our handles table, + * and recreate a new one later on. + */ + ConSrvRemoveConsole(TargetProcessData); + + /* + * Inherit the console from the parent, + * if any, otherwise return an error. + */ + Status = ConSrvInheritConsole(TargetProcessData, + SourceProcessData->Console, + TRUE, + &AttachConsoleRequest->InputHandle, + &AttachConsoleRequest->OutputHandle, + &AttachConsoleRequest->ErrorHandle); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Console inheritance failed\n"); + goto Quit; + } + + /* Return it to the caller */ + AttachConsoleRequest->Console = TargetProcessData->Console; + + /* Input Wait Handle */ + AttachConsoleRequest->InputWaitHandle = TargetProcessData->ConsoleEvent; + + /* Set the Property Dialog Handler */ + TargetProcessData->PropDispatcher = AttachConsoleRequest->PropDispatcher; + + /* Set the Ctrl Dispatcher */ + TargetProcessData->CtrlDispatcher = AttachConsoleRequest->CtrlDispatcher; + + Status = STATUS_SUCCESS; + +Quit: + /* Unlock the "source" process and exit */ + CsrUnlockProcess(SourceProcess); + return Status; +} + +CSR_API(SrvFreeConsole) +{ + DPRINT1("SrvFreeConsole\n"); + ConSrvRemoveConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process)); + return STATUS_SUCCESS; +} + +CSR_API(SrvSetConsoleMode) +{ +#define CONSOLE_INPUT_MODE_VALID ( ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | \ + ENABLE_ECHO_INPUT | ENABLE_WINDOW_INPUT | \ + ENABLE_MOUSE_INPUT | \ + ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS ) +#define CONSOLE_OUTPUT_MODE_VALID ( ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT ) + + NTSTATUS Status; + PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest; + Object_t* Object = NULL; + + Status = ConSrvGetObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + ConsoleModeRequest->ConsoleHandle, + &Object, NULL, GENERIC_WRITE, TRUE, 0); + if (!NT_SUCCESS(Status)) return Status; + + Status = STATUS_SUCCESS; + + if (CONIO_INPUT_BUFFER_MAGIC == Object->Type) + { + PCONSOLE_INPUT_BUFFER InputBuffer = (PCONSOLE_INPUT_BUFFER)Object; + InputBuffer->Mode = ConsoleModeRequest->ConsoleMode & CONSOLE_INPUT_MODE_VALID; + } + else if (CONIO_SCREEN_BUFFER_MAGIC == Object->Type) + { + PCONSOLE_SCREEN_BUFFER Buffer = (PCONSOLE_SCREEN_BUFFER)Object; + Buffer->Mode = ConsoleModeRequest->ConsoleMode & CONSOLE_OUTPUT_MODE_VALID; + } + else + { + Status = STATUS_INVALID_HANDLE; + } + + ConSrvReleaseObject(Object, TRUE); + + return Status; +} + +CSR_API(SrvGetConsoleMode) +{ + NTSTATUS Status; + PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest; + Object_t* Object = NULL; + + Status = ConSrvGetObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + ConsoleModeRequest->ConsoleHandle, + &Object, NULL, GENERIC_READ, TRUE, 0); + if (!NT_SUCCESS(Status)) return Status; + + Status = STATUS_SUCCESS; + + if (CONIO_INPUT_BUFFER_MAGIC == Object->Type) + { + PCONSOLE_INPUT_BUFFER InputBuffer = (PCONSOLE_INPUT_BUFFER)Object; + ConsoleModeRequest->ConsoleMode = InputBuffer->Mode; + } + else if (CONIO_SCREEN_BUFFER_MAGIC == Object->Type) + { + PCONSOLE_SCREEN_BUFFER Buffer = (PCONSOLE_SCREEN_BUFFER)Object; + ConsoleModeRequest->ConsoleMode = Buffer->Mode; + } + else + { + Status = STATUS_INVALID_HANDLE; + } + + ConSrvReleaseObject(Object, TRUE); + + return Status; +} + +CSR_API(SrvSetConsoleTitle) +{ + NTSTATUS Status; + PCONSOLE_GETSETCONSOLETITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest; + // PCSR_PROCESS Process = CsrGetClientThread()->Process; + PCONSOLE Console; + PWCHAR Buffer; + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID)&TitleRequest->Title, + TitleRequest->Length, + sizeof(BYTE))) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &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; +} + +CSR_API(SrvGetConsoleTitle) +{ + NTSTATUS Status; + PCONSOLE_GETSETCONSOLETITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest; + // PCSR_PROCESS Process = CsrGetClientThread()->Process; + PCONSOLE Console; + DWORD Length; + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID)&TitleRequest->Title, + TitleRequest->Length, + sizeof(BYTE))) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Can't get console\n"); + return Status; + } + + /* Copy title of the console to the user title buffer */ + if (TitleRequest->Length >= sizeof(WCHAR)) + { + Length = min(TitleRequest->Length - sizeof(WCHAR), Console->Title.Length); + memcpy(TitleRequest->Title, Console->Title.Buffer, Length); + TitleRequest->Title[Length / sizeof(WCHAR)] = L'\0'; + } + + TitleRequest->Length = Console->Title.Length; + + ConSrvReleaseConsole(Console, TRUE); + return STATUS_SUCCESS; +} + +/********************************************************************** + * HardwareStateProperty + * + * DESCRIPTION + * Set/Get the value of the HardwareState and switch + * between direct video buffer ouput and GDI windowed + * output. + * ARGUMENTS + * Client hands us a CONSOLE_GETSETHWSTATE object. + * We use the same object to Request. + * NOTE + * ConsoleHwState has the correct size to be compatible + * with NT's, but values are not. + */ +static NTSTATUS FASTCALL +SetConsoleHardwareState(PCONSOLE Console, DWORD ConsoleHwState) +{ + DPRINT1("Console Hardware State: %d\n", ConsoleHwState); + + if ((CONSOLE_HARDWARE_STATE_GDI_MANAGED == ConsoleHwState) + ||(CONSOLE_HARDWARE_STATE_DIRECT == ConsoleHwState)) + { + if (Console->HardwareState != ConsoleHwState) + { + /* TODO: implement switching from full screen to windowed mode */ + /* TODO: or back; now simply store the hardware state */ + Console->HardwareState = ConsoleHwState; + } + + return STATUS_SUCCESS; + } + + return STATUS_INVALID_PARAMETER_3; /* Client: (handle, set_get, [mode]) */ +} + +CSR_API(SrvGetConsoleHardwareState) +{ + NTSTATUS Status; + PCONSOLE_GETSETHWSTATE HardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HardwareStateRequest; + PCONSOLE_SCREEN_BUFFER Buff; + PCONSOLE Console; + + Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + HardwareStateRequest->OutputHandle, + &Buff, + GENERIC_READ, + TRUE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to get console handle in SrvGetConsoleHardwareState\n"); + return Status; + } + + Console = Buff->Header.Console; + HardwareStateRequest->State = Console->HardwareState; + + ConSrvReleaseScreenBuffer(Buff, TRUE); + + return Status; +} + +CSR_API(SrvSetConsoleHardwareState) +{ + NTSTATUS Status; + PCONSOLE_GETSETHWSTATE HardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HardwareStateRequest; + PCONSOLE_SCREEN_BUFFER Buff; + PCONSOLE Console; + + Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + HardwareStateRequest->OutputHandle, + &Buff, + GENERIC_READ, + TRUE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to get console handle in SrvSetConsoleHardwareState\n"); + return Status; + } + + DPRINT("Setting console hardware state.\n"); + Console = Buff->Header.Console; + Status = SetConsoleHardwareState(Console, HardwareStateRequest->State); + + ConSrvReleaseScreenBuffer(Buff, TRUE); + + return Status; +} + +CSR_API(SrvGetConsoleWindow) +{ + NTSTATUS Status; + PCONSOLE_GETWINDOW GetWindowRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetWindowRequest; + PCONSOLE Console; + + Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + GetWindowRequest->WindowHandle = ConioGetConsoleWindowHandle(Console); + ConSrvReleaseConsole(Console, TRUE); + + return STATUS_SUCCESS; +} + +CSR_API(SrvSetConsoleIcon) +{ + NTSTATUS Status; + PCONSOLE_SETICON SetIconRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetIconRequest; + PCONSOLE Console; + + Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Status = (ConioChangeIcon(Console, SetIconRequest->WindowIcon) + ? STATUS_SUCCESS + : STATUS_UNSUCCESSFUL); + + ConSrvReleaseConsole(Console, TRUE); + + return Status; +} + +CSR_API(SrvGetConsoleCP) +{ + NTSTATUS Status; + PCONSOLE_GETSETINPUTOUTPUTCP ConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleCPRequest; + PCONSOLE Console; + + DPRINT("SrvGetConsoleCP, getting %s Code Page\n", + ConsoleCPRequest->InputCP ? "Input" : "Output"); + + Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + ConsoleCPRequest->CodePage = (ConsoleCPRequest->InputCP ? Console->CodePage + : Console->OutputCodePage); + ConSrvReleaseConsole(Console, TRUE); + return STATUS_SUCCESS; +} + +CSR_API(SrvSetConsoleCP) +{ + NTSTATUS Status; + PCONSOLE_GETSETINPUTOUTPUTCP ConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleCPRequest; + PCONSOLE Console; + + DPRINT("SrvSetConsoleCP, setting %s Code Page\n", + ConsoleCPRequest->InputCP ? "Input" : "Output"); + + Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + if (IsValidCodePage(ConsoleCPRequest->CodePage)) + { + if (ConsoleCPRequest->InputCP) + Console->CodePage = ConsoleCPRequest->CodePage; + else + Console->OutputCodePage = ConsoleCPRequest->CodePage; + + ConSrvReleaseConsole(Console, TRUE); + return STATUS_SUCCESS; + } + + ConSrvReleaseConsole(Console, TRUE); + return STATUS_INVALID_PARAMETER; +} + +CSR_API(SrvGetConsoleProcessList) +{ + NTSTATUS Status; + PCONSOLE_GETPROCESSLIST GetProcessListRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetProcessListRequest; + PDWORD Buffer; + // PCSR_PROCESS Process = CsrGetClientThread()->Process; + PCONSOLE Console; + PCONSOLE_PROCESS_DATA current; + PLIST_ENTRY current_entry; + ULONG nItems = 0; + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID)&GetProcessListRequest->pProcessIds, + GetProcessListRequest->nMaxIds, + sizeof(DWORD))) + { + return STATUS_INVALID_PARAMETER; + } + + Buffer = GetProcessListRequest->pProcessIds; + + Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + for (current_entry = Console->ProcessList.Flink; + current_entry != &Console->ProcessList; + current_entry = current_entry->Flink) + { + current = CONTAINING_RECORD(current_entry, CONSOLE_PROCESS_DATA, ConsoleLink); + if (++nItems <= GetProcessListRequest->nMaxIds) + { + *Buffer++ = HandleToUlong(current->Process->ClientId.UniqueProcess); + } + } + + ConSrvReleaseConsole(Console, TRUE); + + GetProcessListRequest->nProcessIdsTotal = nItems; + return STATUS_SUCCESS; +} + +CSR_API(SrvGenerateConsoleCtrlEvent) +{ + NTSTATUS Status; + PCONSOLE_GENERATECTRLEVENT GenerateCtrlEventRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GenerateCtrlEventRequest; + PCONSOLE Console; + + Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Status = ConSrvConsoleProcessCtrlEvent(Console, + GenerateCtrlEventRequest->ProcessGroup, + GenerateCtrlEventRequest->Event); + + ConSrvReleaseConsole(Console, TRUE); + return Status; +} + +CSR_API(SrvGetConsoleSelectionInfo) +{ + NTSTATUS Status; + PCONSOLE_GETSELECTIONINFO GetSelectionInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetSelectionInfoRequest; + PCONSOLE Console; + + Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (NT_SUCCESS(Status)) + { + memset(&GetSelectionInfoRequest->Info, 0, sizeof(CONSOLE_SELECTION_INFO)); + if (Console->Selection.dwFlags != 0) + GetSelectionInfoRequest->Info = Console->Selection; + ConSrvReleaseConsole(Console, TRUE); + } + + return Status; +} + +/* EOF */ Index: win32ss/user/consrv/console.c =================================================================== --- win32ss/user/consrv/console.c (rvision 58607) +++ win32ss/user/consrv/console.c (copie de travail) Modification de proprits sur win32ss/user/consrv/console.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/consolecpl.h =================================================================== --- win32ss/user/consrv/consolecpl.h (rvision 0) +++ win32ss/user/consrv/consolecpl.h (copie de travail) @@ -0,0 +1,14 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/consolecpl.h + * PURPOSE: GUI front-end settings management - Header for console.dll + * PROGRAMMERS: Hermes Belusca - Maito + */ + +#pragma once + +#include "settings.h" +#include "guisettings.h" + +/* EOF */ Index: win32ss/user/consrv/consolecpl.h =================================================================== --- win32ss/user/consrv/consolecpl.h (rvision 58607) +++ win32ss/user/consrv/consolecpl.h (copie de travail) Modification de proprits sur win32ss/user/consrv/consolecpl.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/consrv.h =================================================================== --- win32ss/user/consrv/consrv.h (rvision 0) +++ win32ss/user/consrv/consrv.h (copie de travail) @@ -0,0 +1,204 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/consrv.h + * PURPOSE: Main header - Definitions + * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr) + */ + +#ifndef __CONSRV_H__ +#define __CONSRV_H__ + +#pragma once + +/* PSDK/NDK Headers */ +#include +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H +#include +#include +#include +#include +#include +#include +#include +#define NTOS_MODE_USER +#include +#include +#include +#include +#include +#include + +/* Public Win32K Headers */ +#include + +/* CSRSS Header */ +#include + +/* CONSOLE Headers */ +#include +#include + +#include "resource.h" + + +extern HINSTANCE ConSrvDllInstance; +extern HANDLE ConSrvHeap; + +/* Object type magic numbers */ +#define CONIO_INPUT_BUFFER_MAGIC 0x00000001 // --> Input-type handles +#define CONIO_SCREEN_BUFFER_MAGIC 0x00000002 // --> Output-type handles + +/* Common things to input/output/console objects */ +typedef struct Object_tt +{ + ULONG Type; + struct _CONSOLE *Console; + LONG AccessRead, AccessWrite; + LONG ExclusiveRead, ExclusiveWrite; + LONG HandleCount; +} Object_t; + + +typedef struct _CONSOLE_IO_HANDLE +{ + Object_t *Object; /* The object on which the handle points to */ + DWORD Access; + BOOL Inheritable; + DWORD ShareMode; +} CONSOLE_IO_HANDLE, *PCONSOLE_IO_HANDLE; + + +#define ConsoleGetPerProcessData(Process) \ + ((PCONSOLE_PROCESS_DATA)((Process)->ServerData[CONSRV_SERVERDLL_INDEX])) + +typedef struct _CONSOLE_PROCESS_DATA +{ + LIST_ENTRY ConsoleLink; + PCSR_PROCESS Process; // Process owning this structure. + HANDLE ConsoleEvent; + /* PCONSOLE */ struct _CONSOLE* Console; + /* PCONSOLE */ struct _CONSOLE* ParentConsole; + + BOOL ConsoleApp; // TRUE if it is a CUI app, FALSE otherwise. + + RTL_CRITICAL_SECTION HandleTableLock; + ULONG HandleTableSize; + PCONSOLE_IO_HANDLE HandleTable; // Length-varying table + + LPTHREAD_START_ROUTINE CtrlDispatcher; + LPTHREAD_START_ROUTINE PropDispatcher; // We hold the property dialog handler there, till all the GUI thingie moves out from CSRSS. +} CONSOLE_PROCESS_DATA, *PCONSOLE_PROCESS_DATA; + + +/* alias.c */ +CSR_API(SrvAddConsoleAlias); +CSR_API(SrvGetConsoleAlias); +CSR_API(SrvGetConsoleAliases); +CSR_API(SrvGetConsoleAliasesLength); +CSR_API(SrvGetConsoleAliasExes); +CSR_API(SrvGetConsoleAliasExesLength); + +/* coninput.c */ +CSR_API(SrvGetConsoleInput); +CSR_API(SrvWriteConsoleInput); +CSR_API(SrvReadConsole); +CSR_API(SrvFlushConsoleInputBuffer); +CSR_API(SrvGetConsoleNumberOfInputEvents); + +/* conoutput.c */ +CSR_API(SrvReadConsoleOutput); +CSR_API(SrvWriteConsoleOutput); +CSR_API(SrvReadConsoleOutputString); +CSR_API(SrvWriteConsoleOutputString); +CSR_API(SrvFillConsoleOutput); +CSR_API(SrvWriteConsole); +CSR_API(SrvSetConsoleCursorPosition); +CSR_API(SrvGetConsoleCursorInfo); +CSR_API(SrvSetConsoleCursorInfo); +CSR_API(SrvSetConsoleTextAttribute); +CSR_API(SrvCreateConsoleScreenBuffer); +CSR_API(SrvGetConsoleScreenBufferInfo); +CSR_API(SrvSetConsoleActiveScreenBuffer); +CSR_API(SrvScrollConsoleScreenBuffer); +CSR_API(SrvSetConsoleScreenBufferSize); + +/* console.c */ +CSR_API(SrvOpenConsole); +CSR_API(SrvAllocConsole); +CSR_API(SrvAttachConsole); +CSR_API(SrvFreeConsole); +CSR_API(SrvSetConsoleMode); +CSR_API(SrvGetConsoleMode); +CSR_API(SrvSetConsoleTitle); +CSR_API(SrvGetConsoleTitle); +CSR_API(SrvGetConsoleHardwareState); +CSR_API(SrvSetConsoleHardwareState); +CSR_API(SrvGetConsoleWindow); +CSR_API(SrvSetConsoleIcon); +CSR_API(SrvGetConsoleCP); +CSR_API(SrvSetConsoleCP); +CSR_API(SrvGetConsoleProcessList); +CSR_API(SrvGenerateConsoleCtrlEvent); +CSR_API(SrvGetConsoleSelectionInfo); + +/* handle.c */ +CSR_API(SrvCloseHandle); +CSR_API(SrvVerifyConsoleIoHandle); +CSR_API(SrvDuplicateHandle); + +NTSTATUS FASTCALL ConSrvInsertObject(PCONSOLE_PROCESS_DATA ProcessData, + PHANDLE Handle, + Object_t *Object, + DWORD Access, + BOOL Inheritable, + DWORD ShareMode); +NTSTATUS FASTCALL ConSrvRemoveObject(PCONSOLE_PROCESS_DATA ProcessData, + HANDLE Handle); +NTSTATUS FASTCALL ConSrvGetObject(PCONSOLE_PROCESS_DATA ProcessData, + HANDLE Handle, + Object_t** Object, + PCONSOLE_IO_HANDLE* Entry OPTIONAL, + DWORD Access, + BOOL LockConsole, + ULONG Type); +VOID FASTCALL ConSrvReleaseObject(Object_t *Object, + BOOL IsConsoleLocked); +NTSTATUS FASTCALL ConSrvAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData, + PHANDLE pInputHandle, + PHANDLE pOutputHandle, + PHANDLE pErrorHandle, + PCONSOLE_START_INFO ConsoleStartInfo); +NTSTATUS FASTCALL ConSrvInheritConsole(PCONSOLE_PROCESS_DATA ProcessData, + struct _CONSOLE* Console, + BOOL CreateNewHandlesTable, + PHANDLE pInputHandle, + PHANDLE pOutputHandle, + PHANDLE pErrorHandle); +VOID FASTCALL ConSrvRemoveConsole(PCONSOLE_PROCESS_DATA ProcessData); +NTSTATUS FASTCALL ConSrvGetConsole(PCONSOLE_PROCESS_DATA ProcessData, + struct _CONSOLE** Console, + BOOL LockConsole); +VOID FASTCALL ConSrvReleaseConsole(struct _CONSOLE* Console, + BOOL IsConsoleLocked); + +NTSTATUS NTAPI ConSrvNewProcess(PCSR_PROCESS SourceProcess, + PCSR_PROCESS TargetProcess); +NTSTATUS NTAPI ConSrvConnect(IN PCSR_PROCESS CsrProcess, + IN OUT PVOID ConnectionInfo, + IN OUT PULONG ConnectionInfoLength); +VOID NTAPI ConSrvDisconnect(PCSR_PROCESS Process); + +/* lineinput.c */ +CSR_API(SrvGetConsoleCommandHistoryLength); +CSR_API(SrvGetConsoleCommandHistory); +CSR_API(SrvExpungeConsoleCommandHistory); +CSR_API(SrvSetConsoleNumberOfCommands); +CSR_API(SrvGetConsoleHistory); +CSR_API(SrvSetConsoleHistory); + +#endif // __CONSRV_H__ + +/* EOF */ Index: win32ss/user/consrv/consrv.h =================================================================== --- win32ss/user/consrv/consrv.h (rvision 58607) +++ win32ss/user/consrv/consrv.h (copie de travail) Modification de proprits sur win32ss/user/consrv/consrv.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/consrv.rc =================================================================== --- win32ss/user/consrv/consrv.rc (rvision 0) +++ win32ss/user/consrv/consrv.rc (copie de travail) @@ -0,0 +1,15 @@ +#include +#include +#include "resource.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Console Server & Terminal Emulator DLL" +#define REACTOS_STR_INTERNAL_NAME "consrv" +#define REACTOS_STR_ORIGINAL_FILENAME "consrv.dll" +#include + +// IDI_CONSOLE ICON DISCARDABLE "res/terminal.ico" + +#include "rsrc.rc" Index: win32ss/user/consrv/consrv.rc =================================================================== --- win32ss/user/consrv/consrv.rc (rvision 58607) +++ win32ss/user/consrv/consrv.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/consrv.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/consrv.spec =================================================================== --- win32ss/user/consrv/consrv.spec (rvision 0) +++ win32ss/user/consrv/consrv.spec (copie de travail) @@ -0,0 +1 @@ +@ stdcall ConServerDllInitialization(ptr) Index: win32ss/user/consrv/consrv.spec =================================================================== --- win32ss/user/consrv/consrv.spec (rvision 58607) +++ win32ss/user/consrv/consrv.spec (copie de travail) Modification de proprits sur win32ss/user/consrv/consrv.spec ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/guiconsole.c =================================================================== --- win32ss/user/consrv/guiconsole.c (rvision 0) +++ win32ss/user/consrv/guiconsole.c (copie de travail) @@ -0,0 +1,2052 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/guiconsole.c + * PURPOSE: GUI front-end + * PROGRAMMERS: + */ + +/* INCLUDES *******************************************************************/ + +#include "consrv.h" +#include "conio.h" +#include "settings.h" +#include "guiconsole.h" +#include "guisettings.h" + +#define NDEBUG +#include + +/* +// Define wmemset(...) +#include +#define HAVE_WMEMSET +*/ + +/* GUI Console Window Class name */ +#define GUI_CONSOLE_WINDOW_CLASS L"ConsoleWindowClass" + +#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_CONSOLE_SET_TITLE (WM_APP + 4) + + +/* Not defined in any header file */ +// extern VOID WINAPI PrivateCsrssManualGuiCheck(LONG Check); +// From win32ss/user/win32csr/dllmain.c +VOID +WINAPI +PrivateCsrssManualGuiCheck(LONG Check) +{ + NtUserCallOneParam(Check, ONEPARAM_ROUTINE_CSRSS_GUICHECK); +} + +/* GLOBALS ********************************************************************/ + +/**************************************************************\ +\** Define the Console Leader Process for the console window **/ +#define GWLP_CONSOLEWND_ALLOC (2 * sizeof(LONG_PTR)) +#define GWLP_CONSOLE_LEADER_PID 0 +#define GWLP_CONSOLE_LEADER_TID 4 + +#define SetConsoleWndConsoleLeaderCID(GuiData) \ +do { \ + PCONSOLE_PROCESS_DATA ProcessData; \ + CLIENT_ID ConsoleLeaderCID; \ + ProcessData = CONTAINING_RECORD((GuiData)->Console->ProcessList.Blink, \ + CONSOLE_PROCESS_DATA, \ + ConsoleLink); \ + ConsoleLeaderCID = ProcessData->Process->ClientId; \ + SetWindowLongPtrW((GuiData)->hWindow, GWLP_CONSOLE_LEADER_PID, (LONG_PTR)(ConsoleLeaderCID.UniqueProcess)); \ + SetWindowLongPtrW((GuiData)->hWindow, GWLP_CONSOLE_LEADER_TID, (LONG_PTR)(ConsoleLeaderCID.UniqueThread )); \ +} while(0) +/**************************************************************/ + +static BOOL ConsInitialized = FALSE; +static HICON ghDefaultIcon = NULL; +static HICON ghDefaultIconSm = NULL; +static HCURSOR ghDefaultCursor = NULL; +static HWND NotifyWnd = NULL; + +typedef struct _GUICONSOLE_MENUITEM +{ + UINT uID; + const struct _GUICONSOLE_MENUITEM *SubMenu; + WORD wCmdID; +} GUICONSOLE_MENUITEM, *PGUICONSOLE_MENUITEM; + +static const GUICONSOLE_MENUITEM GuiConsoleEditMenuItems[] = +{ + { IDS_MARK, NULL, ID_SYSTEM_EDIT_MARK }, + { IDS_COPY, NULL, ID_SYSTEM_EDIT_COPY }, + { IDS_PASTE, NULL, ID_SYSTEM_EDIT_PASTE }, + { IDS_SELECTALL, NULL, ID_SYSTEM_EDIT_SELECTALL }, + { IDS_SCROLL, NULL, ID_SYSTEM_EDIT_SCROLL }, + { IDS_FIND, NULL, ID_SYSTEM_EDIT_FIND }, + + { 0, NULL, 0 } /* End of list */ +}; + +static const GUICONSOLE_MENUITEM GuiConsoleMainMenuItems[] = +{ + { IDS_EDIT, GuiConsoleEditMenuItems, 0 }, + { IDS_DEFAULTS, NULL, ID_SYSTEM_DEFAULTS }, + { IDS_PROPERTIES, NULL, ID_SYSTEM_PROPERTIES }, + + { 0, NULL, 0 } /* End of list */ +}; + +/* + * Default 16-color palette for foreground and background + * (corresponding flags in comments). + */ +const COLORREF s_Colors[16] = +{ + RGB(0, 0, 0), // (Black) + RGB(0, 0, 128), // BLUE + RGB(0, 128, 0), // GREEN + RGB(0, 128, 128), // BLUE | GREEN + RGB(128, 0, 0), // RED + RGB(128, 0, 128), // BLUE | RED + RGB(128, 128, 0), // GREEN | RED + RGB(192, 192, 192), // BLUE | GREEN | RED + + RGB(128, 128, 128), // (Grey) INTENSITY + RGB(0, 0, 255), // BLUE | INTENSITY + RGB(0, 255, 0), // GREEN | INTENSITY + RGB(0, 255, 255), // BLUE | GREEN | INTENSITY + RGB(255, 0, 0), // RED | INTENSITY + RGB(255, 0, 255), // BLUE | RED | INTENSITY + RGB(255, 255, 0), // GREEN | RED | INTENSITY + RGB(255, 255, 255) // BLUE | GREEN | RED | INTENSITY +}; + +/* FUNCTIONS ******************************************************************/ + +static VOID +GuiConsoleAppendMenuItems(HMENU hMenu, + const GUICONSOLE_MENUITEM *Items) +{ + UINT i = 0; + WCHAR szMenuString[255]; + HMENU hSubMenu; + + do + { + if (Items[i].uID != (UINT)-1) + { + if (LoadStringW(ConSrvDllInstance, + Items[i].uID, + szMenuString, + sizeof(szMenuString) / sizeof(szMenuString[0])) > 0) + { + if (Items[i].SubMenu != NULL) + { + hSubMenu = CreatePopupMenu(); + if (hSubMenu != NULL) + { + GuiConsoleAppendMenuItems(hSubMenu, + Items[i].SubMenu); + + if (!AppendMenuW(hMenu, + MF_STRING | MF_POPUP, + (UINT_PTR)hSubMenu, + szMenuString)) + { + DestroyMenu(hSubMenu); + } + } + } + else + { + AppendMenuW(hMenu, + MF_STRING, + Items[i].wCmdID, + szMenuString); + } + } + } + else + { + AppendMenuW(hMenu, + MF_SEPARATOR, + 0, + NULL); + } + i++; + } while(!(Items[i].uID == 0 && Items[i].SubMenu == NULL && Items[i].wCmdID == 0)); +} + +static VOID +GuiConsoleCreateSysMenu(HWND hWnd) +{ + HMENU hMenu; + hMenu = GetSystemMenu(hWnd, FALSE); + if (hMenu != NULL) + { + GuiConsoleAppendMenuItems(hMenu, GuiConsoleMainMenuItems); + DrawMenuBar(hWnd); + } +} + + +static VOID +GuiConsoleCopy(PGUI_CONSOLE_DATA GuiData); +static VOID +GuiConsolePaste(PGUI_CONSOLE_DATA GuiData); +static VOID +GuiConsoleUpdateSelection(PCONSOLE Console, PCOORD coord); +static VOID WINAPI +GuiDrawRegion(PCONSOLE Console, SMALL_RECT* Region); +static NTSTATUS WINAPI +GuiResizeBuffer(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER ScreenBuffer, COORD Size); +static VOID +GuiConsoleResizeWindow(PGUI_CONSOLE_DATA GuiData); + + +static LRESULT +GuiConsoleHandleSysMenuCommand(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam) +{ + LRESULT Ret = TRUE; + + switch (wParam) + { + case ID_SYSTEM_EDIT_MARK: + DPRINT1("Marking not handled yet\n"); + break; + + case ID_SYSTEM_EDIT_COPY: + GuiConsoleCopy(GuiData); + break; + + case ID_SYSTEM_EDIT_PASTE: + GuiConsolePaste(GuiData); + break; + + case ID_SYSTEM_EDIT_SELECTALL: + { + PCONSOLE Console = GuiData->Console; + COORD bottomRight = { 0, 0 }; + + bottomRight.X = Console->ConsoleSize.X - 1; + bottomRight.Y = Console->ConsoleSize.Y - 1; + GuiConsoleUpdateSelection(Console, &bottomRight); + break; + } + + case ID_SYSTEM_EDIT_SCROLL: + DPRINT1("Scrolling is not handled yet\n"); + break; + + case ID_SYSTEM_EDIT_FIND: + DPRINT1("Finding is not handled yet\n"); + break; + + case ID_SYSTEM_DEFAULTS: + GuiConsoleShowConsoleProperties(GuiData, TRUE); + break; + + case ID_SYSTEM_PROPERTIES: + GuiConsoleShowConsoleProperties(GuiData, FALSE); + break; + + default: + Ret = DefWindowProcW(GuiData->hWindow, WM_SYSCOMMAND, wParam, lParam); + break; + } + return Ret; +} + +static PGUI_CONSOLE_DATA +GuiGetGuiData(HWND hWnd) +{ + PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)GetWindowLongPtrW(hWnd, GWLP_USERDATA); + return ( ((GuiData == NULL) || (GuiData->hWindow == hWnd && GuiData->Console != NULL)) ? GuiData : NULL ); +} + +VOID +GuiConsoleMoveWindow(PGUI_CONSOLE_DATA GuiData) +{ + /* Move the window if needed (not positioned by the system) */ + if (!GuiData->GuiInfo.AutoPosition) + { + SetWindowPos(GuiData->hWindow, + NULL, + GuiData->GuiInfo.WindowOrigin.x, + GuiData->GuiInfo.WindowOrigin.y, + 0, + 0, + SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); + } +} + +static VOID +GuiConsoleResizeWindow(PGUI_CONSOLE_DATA GuiData) +{ + PCONSOLE Console = GuiData->Console; + SCROLLINFO sInfo; + + DWORD Width = Console->ConsoleSize.X * GuiData->CharWidth + + 2 * (GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXEDGE)); + DWORD Height = Console->ConsoleSize.Y * GuiData->CharHeight + + 2 * (GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYEDGE)) + GetSystemMetrics(SM_CYCAPTION); + + /* Set scrollbar sizes */ + sInfo.cbSize = sizeof(SCROLLINFO); + sInfo.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; + sInfo.nMin = 0; + if (Console->ActiveBuffer->ScreenBufferSize.Y > Console->ConsoleSize.Y) + { + sInfo.nMax = Console->ActiveBuffer->ScreenBufferSize.Y - 1; + sInfo.nPage = Console->ConsoleSize.Y; + sInfo.nPos = Console->ActiveBuffer->ShowY; + SetScrollInfo(GuiData->hWindow, SB_VERT, &sInfo, TRUE); + Width += GetSystemMetrics(SM_CXVSCROLL); + ShowScrollBar(GuiData->hWindow, SB_VERT, TRUE); + } + else + { + ShowScrollBar(GuiData->hWindow, SB_VERT, FALSE); + } + + if (Console->ActiveBuffer->ScreenBufferSize.X > Console->ConsoleSize.X) + { + sInfo.nMax = Console->ActiveBuffer->ScreenBufferSize.X - 1; + sInfo.nPage = Console->ConsoleSize.X; + sInfo.nPos = Console->ActiveBuffer->ShowX; + SetScrollInfo(GuiData->hWindow, SB_HORZ, &sInfo, TRUE); + Height += GetSystemMetrics(SM_CYHSCROLL); + ShowScrollBar(GuiData->hWindow, SB_HORZ, TRUE); + } + else + { + ShowScrollBar(GuiData->hWindow, SB_HORZ, FALSE); + } + + /* Resize the window */ + SetWindowPos(GuiData->hWindow, NULL, 0, 0, Width, Height, + SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); +} + +static BOOL +GuiConsoleHandleNcCreate(HWND hWnd, LPCREATESTRUCTW Create) +{ + PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)Create->lpCreateParams; + PCONSOLE Console; + HDC Dc; + HFONT OldFont; + TEXTMETRICW Metrics; + SIZE CharSize; + + if (NULL == GuiData) + { + DPRINT1("GuiConsoleNcCreate: No GUI data\n"); + return FALSE; + } + + Console = GuiData->Console; + + GuiData->hWindow = hWnd; + + GuiData->Font = CreateFontW(LOWORD(GuiData->GuiInfo.FontSize), + 0, // HIWORD(GuiData->GuiInfo.FontSize), + 0, + TA_BASELINE, + GuiData->GuiInfo.FontWeight, + FALSE, + FALSE, + FALSE, + OEM_CHARSET, + OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, + NONANTIALIASED_QUALITY, + FIXED_PITCH | GuiData->GuiInfo.FontFamily /* FF_DONTCARE */, + GuiData->GuiInfo.FaceName); + + if (NULL == GuiData->Font) + { + DPRINT1("GuiConsoleNcCreate: CreateFont failed\n"); + GuiData->hWindow = NULL; + SetEvent(GuiData->hGuiInitEvent); + return FALSE; + } + Dc = GetDC(GuiData->hWindow); + if (NULL == Dc) + { + DPRINT1("GuiConsoleNcCreate: GetDC failed\n"); + DeleteObject(GuiData->Font); + GuiData->hWindow = NULL; + SetEvent(GuiData->hGuiInitEvent); + return FALSE; + } + OldFont = SelectObject(Dc, GuiData->Font); + if (NULL == OldFont) + { + DPRINT1("GuiConsoleNcCreate: SelectObject failed\n"); + ReleaseDC(GuiData->hWindow, Dc); + DeleteObject(GuiData->Font); + GuiData->hWindow = NULL; + SetEvent(GuiData->hGuiInitEvent); + return FALSE; + } + if (!GetTextMetricsW(Dc, &Metrics)) + { + DPRINT1("GuiConsoleNcCreate: GetTextMetrics failed\n"); + SelectObject(Dc, OldFont); + ReleaseDC(GuiData->hWindow, Dc); + DeleteObject(GuiData->Font); + GuiData->hWindow = NULL; + SetEvent(GuiData->hGuiInitEvent); + return FALSE; + } + GuiData->CharWidth = Metrics.tmMaxCharWidth; + GuiData->CharHeight = Metrics.tmHeight + Metrics.tmExternalLeading; + + /* Measure real char width more precisely if possible. */ + if (GetTextExtentPoint32W(Dc, L"R", 1, &CharSize)) + GuiData->CharWidth = CharSize.cx; + + SelectObject(Dc, OldFont); + + ReleaseDC(GuiData->hWindow, Dc); + + // FIXME: Keep these instructions here ? /////////////////////////////////// + Console->ActiveBuffer->CursorBlinkOn = TRUE; + Console->ActiveBuffer->ForceCursorOff = FALSE; + //////////////////////////////////////////////////////////////////////////// + + SetWindowLongPtrW(GuiData->hWindow, GWLP_USERDATA, (DWORD_PTR)GuiData); + + SetTimer(GuiData->hWindow, CONGUI_UPDATE_TIMER, CONGUI_UPDATE_TIME, NULL); + GuiConsoleCreateSysMenu(GuiData->hWindow); + + /* Move and resize the window to the user's values */ + GuiConsoleMoveWindow(GuiData); + GuiData->WindowSizeLock = TRUE; + GuiConsoleResizeWindow(GuiData); + GuiData->WindowSizeLock = FALSE; + + SetEvent(GuiData->hGuiInitEvent); + + return (BOOL)DefWindowProcW(GuiData->hWindow, WM_NCCREATE, 0, (LPARAM)Create); +} + +static VOID +SmallRectToRect(PGUI_CONSOLE_DATA GuiData, PRECT Rect, PSMALL_RECT SmallRect) +{ + PCONSOLE Console = GuiData->Console; + PCONSOLE_SCREEN_BUFFER Buffer = Console->ActiveBuffer; + + Rect->left = (SmallRect->Left - Buffer->ShowX) * GuiData->CharWidth; + Rect->top = (SmallRect->Top - Buffer->ShowY) * GuiData->CharHeight; + Rect->right = (SmallRect->Right + 1 - Buffer->ShowX) * GuiData->CharWidth; + Rect->bottom = (SmallRect->Bottom + 1 - Buffer->ShowY) * GuiData->CharHeight; +} + +static VOID +GuiConsoleUpdateSelection(PCONSOLE Console, PCOORD coord) +{ + PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data; + RECT oldRect, newRect; + + SmallRectToRect(GuiData, &oldRect, &Console->Selection.srSelection); + + if(coord != NULL) + { + SMALL_RECT rc; + /* exchange left/top with right/bottom if required */ + rc.Left = min(Console->Selection.dwSelectionAnchor.X, coord->X); + rc.Top = min(Console->Selection.dwSelectionAnchor.Y, coord->Y); + rc.Right = max(Console->Selection.dwSelectionAnchor.X, coord->X); + rc.Bottom = max(Console->Selection.dwSelectionAnchor.Y, coord->Y); + + SmallRectToRect(GuiData, &newRect, &rc); + + if (Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) + { + if (memcmp(&rc, &Console->Selection.srSelection, sizeof(SMALL_RECT)) != 0) + { + HRGN rgn1, rgn2; + + /* calculate the region that needs to be updated */ + if((rgn1 = CreateRectRgnIndirect(&oldRect))) + { + if((rgn2 = CreateRectRgnIndirect(&newRect))) + { + if(CombineRgn(rgn1, rgn2, rgn1, RGN_XOR) != ERROR) + { + InvalidateRgn(GuiData->hWindow, rgn1, FALSE); + } + + DeleteObject(rgn2); + } + DeleteObject(rgn1); + } + } + } + else + { + InvalidateRect(GuiData->hWindow, &newRect, FALSE); + } + Console->Selection.dwFlags |= CONSOLE_SELECTION_NOT_EMPTY; + Console->Selection.srSelection = rc; + ConioPause(Console, PAUSED_FROM_SELECTION); + } + else + { + /* clear the selection */ + if (Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) + { + InvalidateRect(GuiData->hWindow, &oldRect, FALSE); + } + Console->Selection.dwFlags = CONSOLE_NO_SELECTION; + ConioUnpause(Console, PAUSED_FROM_SELECTION); + } +} + +static VOID +GuiConsolePaint(PCONSOLE Console, + PGUI_CONSOLE_DATA GuiData, + HDC hDC, + PRECT rc) +{ + PCONSOLE_SCREEN_BUFFER Buff; + ULONG TopLine, BottomLine, LeftChar, RightChar; + ULONG Line, Char, Start; + PBYTE From; + PWCHAR To; + BYTE LastAttribute, Attribute; + ULONG CursorX, CursorY, CursorHeight; + HBRUSH CursorBrush, OldBrush; + HFONT OldFont; + + Buff = Console->ActiveBuffer; + + /// LOCK /// EnterCriticalSection(&Buff->Header.Console->Lock); + + TopLine = rc->top / GuiData->CharHeight + Buff->ShowY; + BottomLine = (rc->bottom + (GuiData->CharHeight - 1)) / GuiData->CharHeight - 1 + Buff->ShowY; + LeftChar = rc->left / GuiData->CharWidth + Buff->ShowX; + RightChar = (rc->right + (GuiData->CharWidth - 1)) / GuiData->CharWidth - 1 + Buff->ShowX; + LastAttribute = ConioCoordToPointer(Buff, LeftChar, TopLine)[1]; + + SetTextColor(hDC, RGBFromAttrib(Console, TextAttribFromAttrib(LastAttribute))); + SetBkColor(hDC, RGBFromAttrib(Console, BkgdAttribFromAttrib(LastAttribute))); + + if (BottomLine >= Buff->ScreenBufferSize.Y) BottomLine = Buff->ScreenBufferSize.Y - 1; + if (RightChar >= Buff->ScreenBufferSize.X) RightChar = Buff->ScreenBufferSize.X - 1; + + OldFont = SelectObject(hDC, GuiData->Font); + + for (Line = TopLine; Line <= BottomLine; Line++) + { + WCHAR LineBuffer[80]; + From = ConioCoordToPointer(Buff, LeftChar, Line); + Start = LeftChar; + To = LineBuffer; + + for (Char = LeftChar; Char <= RightChar; Char++) + { + if (*(From + 1) != LastAttribute || (Char - Start == sizeof(LineBuffer) / sizeof(WCHAR))) + { + TextOutW(hDC, + (Start - Buff->ShowX) * GuiData->CharWidth, + (Line - Buff->ShowY) * GuiData->CharHeight, + LineBuffer, + Char - Start); + Start = Char; + To = LineBuffer; + Attribute = *(From + 1); + if (Attribute != LastAttribute) + { + SetTextColor(hDC, RGBFromAttrib(Console, TextAttribFromAttrib(Attribute))); + SetBkColor(hDC, RGBFromAttrib(Console, BkgdAttribFromAttrib(Attribute))); + LastAttribute = Attribute; + } + } + + MultiByteToWideChar(Console->OutputCodePage, + 0, + (PCHAR)From, + 1, + To, + 1); + To++; + From += 2; + } + + TextOutW(hDC, + (Start - Buff->ShowX) * GuiData->CharWidth, + (Line - Buff->ShowY) * GuiData->CharHeight, + LineBuffer, + RightChar - Start + 1); + } + + if (Buff->CursorInfo.bVisible && Buff->CursorBlinkOn && + !Buff->ForceCursorOff) + { + CursorX = Buff->CursorPosition.X; + CursorY = Buff->CursorPosition.Y; + if (LeftChar <= CursorX && CursorX <= RightChar && + TopLine <= CursorY && CursorY <= BottomLine) + { + CursorHeight = ConioEffectiveCursorSize(Console, GuiData->CharHeight); + From = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y) + 1; + + if (*From != DEFAULT_SCREEN_ATTRIB) + { + CursorBrush = CreateSolidBrush(RGBFromAttrib(Console, *From)); + } + else + { + CursorBrush = CreateSolidBrush(RGBFromAttrib(Console, Buff->ScreenDefaultAttrib)); + } + + OldBrush = SelectObject(hDC, CursorBrush); + PatBlt(hDC, + (CursorX - Buff->ShowX) * GuiData->CharWidth, + (CursorY - Buff->ShowY) * GuiData->CharHeight + (GuiData->CharHeight - CursorHeight), + GuiData->CharWidth, + CursorHeight, + PATCOPY); + SelectObject(hDC, OldBrush); + DeleteObject(CursorBrush); + } + } + + /// LOCK /// LeaveCriticalSection(&Buff->Header.Console->Lock); + + SelectObject(hDC, OldFont); +} + +static VOID +GuiConsoleHandlePaint(PGUI_CONSOLE_DATA GuiData, HDC hDCPaint) +{ + PCONSOLE Console = GuiData->Console; + HDC hDC; + PAINTSTRUCT ps; + + if (Console->ActiveBuffer == NULL) return; + + hDC = BeginPaint(GuiData->hWindow, &ps); + if (hDC != NULL && + ps.rcPaint.left < ps.rcPaint.right && + ps.rcPaint.top < ps.rcPaint.bottom) + { + if (Console->ActiveBuffer->Buffer != NULL) + { + EnterCriticalSection(&GuiData->Lock); + + GuiConsolePaint(Console, + GuiData, + hDC, + &ps.rcPaint); + + if (Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) + { + RECT rc; + SmallRectToRect(GuiData, &rc, &Console->Selection.srSelection); + + /* invert the selection */ + if (IntersectRect(&rc, + &ps.rcPaint, + &rc)) + { + PatBlt(hDC, + rc.left, + rc.top, + rc.right - rc.left, + rc.bottom - rc.top, + DSTINVERT); + } + } + + LeaveCriticalSection(&GuiData->Lock); + } + } + EndPaint(GuiData->hWindow, &ps); +} + +static VOID +GuiConsoleHandleKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM lParam) +{ + PCONSOLE Console = GuiData->Console; + MSG Message; + + Message.hwnd = GuiData->hWindow; + Message.message = msg; + Message.wParam = wParam; + Message.lParam = lParam; + + if(msg == WM_CHAR || msg == WM_SYSKEYDOWN) + { + /* clear the selection */ + GuiConsoleUpdateSelection(Console, NULL); + } + + ConioProcessKey(Console, &Message); +} + +static VOID +GuiInvalidateCell(PCONSOLE Console, UINT x, UINT y) +{ + SMALL_RECT CellRect = { x, y, x, y }; + GuiDrawRegion(Console, &CellRect); +} + +static VOID +GuiConsoleHandleTimer(PGUI_CONSOLE_DATA GuiData) +{ + PCONSOLE Console = GuiData->Console; + PCONSOLE_SCREEN_BUFFER Buff; + + SetTimer(GuiData->hWindow, CONGUI_UPDATE_TIMER, CURSOR_BLINK_TIME, NULL); + + Buff = Console->ActiveBuffer; + GuiInvalidateCell(Console, Buff->CursorPosition.X, Buff->CursorPosition.Y); + Buff->CursorBlinkOn = !Buff->CursorBlinkOn; + + if((GuiData->OldCursor.x != Buff->CursorPosition.X) || (GuiData->OldCursor.y != Buff->CursorPosition.Y)) + { + SCROLLINFO xScroll; + int OldScrollX = -1, OldScrollY = -1; + int NewScrollX = -1, NewScrollY = -1; + + xScroll.cbSize = sizeof(SCROLLINFO); + xScroll.fMask = SIF_POS; + // Capture the original position of the scroll bars and save them. + if(GetScrollInfo(GuiData->hWindow, SB_HORZ, &xScroll))OldScrollX = xScroll.nPos; + if(GetScrollInfo(GuiData->hWindow, SB_VERT, &xScroll))OldScrollY = xScroll.nPos; + + // If we successfully got the info for the horizontal scrollbar + if(OldScrollX >= 0) + { + if((Buff->CursorPosition.X < Buff->ShowX)||(Buff->CursorPosition.X >= (Buff->ShowX + Console->ConsoleSize.X))) + { + // Handle the horizontal scroll bar + if(Buff->CursorPosition.X >= Console->ConsoleSize.X) NewScrollX = Buff->CursorPosition.X - Console->ConsoleSize.X + 1; + else NewScrollX = 0; + } + else + { + NewScrollX = OldScrollX; + } + } + // If we successfully got the info for the vertical scrollbar + if(OldScrollY >= 0) + { + if((Buff->CursorPosition.Y < Buff->ShowY) || (Buff->CursorPosition.Y >= (Buff->ShowY + Console->ConsoleSize.Y))) + { + // Handle the vertical scroll bar + if(Buff->CursorPosition.Y >= Console->ConsoleSize.Y) NewScrollY = Buff->CursorPosition.Y - Console->ConsoleSize.Y + 1; + else NewScrollY = 0; + } + else + { + NewScrollY = OldScrollY; + } + } + + // Adjust scroll bars and refresh the window if the cursor has moved outside the visible area + // NOTE: OldScroll# and NewScroll# will both be -1 (initial value) if the info for the respective scrollbar + // was not obtained successfully in the previous steps. This means their difference is 0 (no scrolling) + // and their associated scrollbar is left alone. + if((OldScrollX != NewScrollX) || (OldScrollY != NewScrollY)) + { + Buff->ShowX = NewScrollX; + Buff->ShowY = NewScrollY; + ScrollWindowEx(GuiData->hWindow, + (OldScrollX - NewScrollX) * GuiData->CharWidth, + (OldScrollY - NewScrollY) * GuiData->CharHeight, + NULL, + NULL, + NULL, + NULL, + SW_INVALIDATE); + if(NewScrollX >= 0) + { + xScroll.nPos = NewScrollX; + SetScrollInfo(GuiData->hWindow, SB_HORZ, &xScroll, TRUE); + } + if(NewScrollY >= 0) + { + xScroll.nPos = NewScrollY; + SetScrollInfo(GuiData->hWindow, SB_VERT, &xScroll, TRUE); + } + UpdateWindow(GuiData->hWindow); + GuiData->OldCursor.x = Buff->CursorPosition.X; + GuiData->OldCursor.y = Buff->CursorPosition.Y; + } + } +} + +static VOID +GuiConsoleHandleClose(PGUI_CONSOLE_DATA GuiData) +{ + PCONSOLE Console = GuiData->Console; + + /// LOCK /// EnterCriticalSection(&Console->Lock); + + /* + * FIXME: Windows will wait up to 5 seconds for the thread to exit. + * We shouldn't wait here, though, since the console lock is entered. + * A copy of the thread list probably needs to be made. + */ + ConSrvConsoleProcessCtrlEvent(Console, 0, CTRL_CLOSE_EVENT); + + /// LOCK /// LeaveCriticalSection(&Console->Lock); +} + +static VOID +GuiConsoleHandleNcDestroy(PGUI_CONSOLE_DATA GuiData) +{ + KillTimer(GuiData->hWindow, CONGUI_UPDATE_TIMER); + GetSystemMenu(GuiData->hWindow, TRUE); + + SetWindowLongPtrW(GuiData->hWindow, GWLP_USERDATA, (DWORD_PTR)NULL); + GuiData->hWindow = NULL; +} + +static COORD +PointToCoord(PGUI_CONSOLE_DATA GuiData, LPARAM lParam) +{ + PCONSOLE Console = GuiData->Console; + PCONSOLE_SCREEN_BUFFER Buffer = Console->ActiveBuffer; + COORD Coord; + + Coord.X = Buffer->ShowX + ((short)LOWORD(lParam) / (int)GuiData->CharWidth); + Coord.Y = Buffer->ShowY + ((short)HIWORD(lParam) / (int)GuiData->CharHeight); + + /* Clip coordinate to ensure it's inside buffer */ + if (Coord.X < 0) + Coord.X = 0; + else if (Coord.X >= Buffer->ScreenBufferSize.X) + Coord.X = Buffer->ScreenBufferSize.X - 1; + + if (Coord.Y < 0) + Coord.Y = 0; + else if (Coord.Y >= Buffer->ScreenBufferSize.Y) + Coord.Y = Buffer->ScreenBufferSize.Y - 1; + + return Coord; +} + +static VOID +GuiConsoleLeftMouseDown(PGUI_CONSOLE_DATA GuiData, LPARAM lParam) +{ + PCONSOLE Console = GuiData->Console; + + Console->Selection.dwSelectionAnchor = PointToCoord(GuiData, lParam); + SetCapture(GuiData->hWindow); + Console->Selection.dwFlags |= CONSOLE_SELECTION_IN_PROGRESS | CONSOLE_MOUSE_SELECTION | CONSOLE_MOUSE_DOWN; + GuiConsoleUpdateSelection(Console, &Console->Selection.dwSelectionAnchor); +} + +static VOID +GuiConsoleLeftMouseUp(PGUI_CONSOLE_DATA GuiData, LPARAM lParam) +{ + PCONSOLE Console = GuiData->Console; + COORD c; + + if (!(Console->Selection.dwFlags & CONSOLE_MOUSE_DOWN)) return; + + c = PointToCoord(GuiData, lParam); + Console->Selection.dwFlags &= ~CONSOLE_MOUSE_DOWN; + GuiConsoleUpdateSelection(Console, &c); + ReleaseCapture(); +} + +static VOID +GuiConsoleMouseMove(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam) +{ + PCONSOLE Console = GuiData->Console; + COORD c; + + if (!(wParam & MK_LBUTTON)) return; + + if (!(Console->Selection.dwFlags & CONSOLE_MOUSE_DOWN)) return; + + c = PointToCoord(GuiData, lParam); /* TODO: Scroll buffer to bring c into view */ + GuiConsoleUpdateSelection(Console, &c); +} + +static VOID +GuiConsoleCopy(PGUI_CONSOLE_DATA GuiData) +{ + PCONSOLE Console = GuiData->Console; + + if (OpenClipboard(GuiData->hWindow) == TRUE) + { + HANDLE hData; + PBYTE ptr; + LPSTR data, dstPos; + ULONG selWidth, selHeight; + ULONG xPos, yPos, size; + + selWidth = Console->Selection.srSelection.Right - Console->Selection.srSelection.Left + 1; + selHeight = Console->Selection.srSelection.Bottom - Console->Selection.srSelection.Top + 1; + DPRINT("Selection is (%d|%d) to (%d|%d)\n", + Console->Selection.srSelection.Left, + Console->Selection.srSelection.Top, + Console->Selection.srSelection.Right, + Console->Selection.srSelection.Bottom); + + /* Basic size for one line and termination */ + size = selWidth + 1; + if (selHeight > 0) + { + /* Multiple line selections have to get \r\n appended */ + size += ((selWidth + 2) * (selHeight - 1)); + } + + /* Allocate memory, it will be passed to the system and may not be freed here */ + hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, size); + if (hData == NULL) + { + CloseClipboard(); + return; + } + data = GlobalLock(hData); + if (data == NULL) + { + CloseClipboard(); + return; + } + + DPRINT("Copying %dx%d selection\n", selWidth, selHeight); + dstPos = data; + + for (yPos = 0; yPos < selHeight; yPos++) + { + ptr = ConioCoordToPointer(Console->ActiveBuffer, + Console->Selection.srSelection.Left, + yPos + Console->Selection.srSelection.Top); + /* Copy only the characters, leave attributes alone */ + for (xPos = 0; xPos < selWidth; xPos++) + { + dstPos[xPos] = ptr[xPos * 2]; + } + dstPos += selWidth; + if (yPos != (selHeight - 1)) + { + strcat(data, "\r\n"); + dstPos += 2; + } + } + + DPRINT("Setting data <%s> to clipboard\n", data); + GlobalUnlock(hData); + + EmptyClipboard(); + SetClipboardData(CF_TEXT, hData); + CloseClipboard(); + } +} + +static VOID +GuiConsolePaste(PGUI_CONSOLE_DATA GuiData) +{ + PCONSOLE Console = GuiData->Console; + + if (OpenClipboard(GuiData->hWindow) == TRUE) + { + HANDLE hData; + LPSTR str; + size_t len; + + hData = GetClipboardData(CF_TEXT); + if (hData == NULL) + { + CloseClipboard(); + return; + } + + str = GlobalLock(hData); + if (str == NULL) + { + CloseClipboard(); + return; + } + DPRINT("Got data <%s> from clipboard\n", str); + len = strlen(str); + + // TODO: Push the text into the input buffer. + ConioWriteConsole(Console, Console->ActiveBuffer, str, len, TRUE); + + GlobalUnlock(hData); + CloseClipboard(); + } +} + +static VOID +GuiConsoleRightMouseDown(PGUI_CONSOLE_DATA GuiData) +{ + PCONSOLE Console = GuiData->Console; + + if (!(Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY)) + { + GuiConsolePaste(GuiData); + } + else + { + GuiConsoleCopy(GuiData); + + /* Clear the selection */ + GuiConsoleUpdateSelection(Console, NULL); + } +} + +static VOID +GuiConsoleGetMinMaxInfo(PGUI_CONSOLE_DATA GuiData, PMINMAXINFO minMaxInfo) +{ + PCONSOLE Console = GuiData->Console; + DWORD windx, windy; + + windx = CONGUI_MIN_WIDTH * GuiData->CharWidth + 2 * (GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXEDGE)); + windy = CONGUI_MIN_HEIGHT * GuiData->CharHeight + 2 * (GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYEDGE)) + GetSystemMetrics(SM_CYCAPTION); + + minMaxInfo->ptMinTrackSize.x = windx; + minMaxInfo->ptMinTrackSize.y = windy; + + windx = (Console->ActiveBuffer->ScreenBufferSize.X) * GuiData->CharWidth + 2 * (GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXEDGE)); + windy = (Console->ActiveBuffer->ScreenBufferSize.Y) * GuiData->CharHeight + 2 * (GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYEDGE)) + GetSystemMetrics(SM_CYCAPTION); + + if(Console->ConsoleSize.X < Console->ActiveBuffer->ScreenBufferSize.X) windy += GetSystemMetrics(SM_CYHSCROLL); // window currently has a horizontal scrollbar + if(Console->ConsoleSize.Y < Console->ActiveBuffer->ScreenBufferSize.Y) windx += GetSystemMetrics(SM_CXVSCROLL); // window currently has a vertical scrollbar + + minMaxInfo->ptMaxTrackSize.x = windx; + minMaxInfo->ptMaxTrackSize.y = windy; +} + +static VOID +GuiConsoleResize(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam) +{ + PCONSOLE Console = GuiData->Console; + + if ((GuiData->WindowSizeLock == FALSE) && + (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED || wParam == SIZE_MINIMIZED)) + { + PCONSOLE_SCREEN_BUFFER Buff = Console->ActiveBuffer; + DWORD windx, windy, charx, chary; + + GuiData->WindowSizeLock = TRUE; + + windx = LOWORD(lParam); + windy = HIWORD(lParam); + + // Compensate for existing scroll bars (because lParam values do not accommodate scroll bar) + if(Console->ConsoleSize.X < Buff->ScreenBufferSize.X) windy += GetSystemMetrics(SM_CYHSCROLL); // window currently has a horizontal scrollbar + if(Console->ConsoleSize.Y < Buff->ScreenBufferSize.Y) windx += GetSystemMetrics(SM_CXVSCROLL); // window currently has a vertical scrollbar + + charx = windx / GuiData->CharWidth; + chary = windy / GuiData->CharHeight; + + // Character alignment (round size up or down) + if((windx % GuiData->CharWidth) >= (GuiData->CharWidth / 2)) ++charx; + if((windy % GuiData->CharHeight) >= (GuiData->CharHeight / 2)) ++chary; + + // Compensate for added scroll bars in new window + if(charx < Buff->ScreenBufferSize.X)windy -= GetSystemMetrics(SM_CYHSCROLL); // new window will have a horizontal scroll bar + if(chary < Buff->ScreenBufferSize.Y)windx -= GetSystemMetrics(SM_CXVSCROLL); // new window will have a vertical scroll bar + + charx = windx / GuiData->CharWidth; + chary = windy / GuiData->CharHeight; + + // Character alignment (round size up or down) + if((windx % GuiData->CharWidth) >= (GuiData->CharWidth / 2)) ++charx; + if((windy % GuiData->CharHeight) >= (GuiData->CharHeight / 2)) ++chary; + + // Resize window + if((charx != Console->ConsoleSize.X) || (chary != Console->ConsoleSize.Y)) + { + Console->ConsoleSize.X = (charx <= Buff->ScreenBufferSize.X) ? charx : Buff->ScreenBufferSize.X; + Console->ConsoleSize.Y = (chary <= Buff->ScreenBufferSize.Y) ? chary : Buff->ScreenBufferSize.Y; + } + + GuiConsoleResizeWindow(GuiData); + + // Adjust the start of the visible area if we are attempting to show nonexistent areas + if((Buff->ScreenBufferSize.X - Buff->ShowX) < Console->ConsoleSize.X) Buff->ShowX = Buff->ScreenBufferSize.X - Console->ConsoleSize.X; + if((Buff->ScreenBufferSize.Y - Buff->ShowY) < Console->ConsoleSize.Y) Buff->ShowY = Buff->ScreenBufferSize.Y - Console->ConsoleSize.Y; + InvalidateRect(GuiData->hWindow, NULL, TRUE); + + GuiData->WindowSizeLock = FALSE; + } +} + +/* +// HACK: This functionality is standard for general scrollbars. Don't add it by hand. + +VOID +FASTCALL +GuiConsoleHandleScrollbarMenu(VOID) +{ + HMENU hMenu; + + hMenu = CreatePopupMenu(); + if (hMenu == NULL) + { + DPRINT("CreatePopupMenu failed\n"); + return; + } + + //InsertItem(hMenu, MIIM_STRING, MIIM_ID | MIIM_FTYPE | MIIM_STRING, 0, NULL, IDS_SCROLLHERE); + //InsertItem(hMenu, MFT_SEPARATOR, MIIM_FTYPE, 0, NULL, -1); + //InsertItem(hMenu, MIIM_STRING, MIIM_ID | MIIM_FTYPE | MIIM_STRING, 0, NULL, IDS_SCROLLTOP); + //InsertItem(hMenu, MIIM_STRING, MIIM_ID | MIIM_FTYPE | MIIM_STRING, 0, NULL, IDS_SCROLLBOTTOM); + //InsertItem(hMenu, MFT_SEPARATOR, MIIM_FTYPE, 0, NULL, -1); + //InsertItem(hMenu, MIIM_STRING, MIIM_ID | MIIM_FTYPE | MIIM_STRING, 0, NULL, IDS_SCROLLPAGE_UP); + //InsertItem(hMenu, MIIM_STRING, MIIM_ID | MIIM_FTYPE | MIIM_STRING, 0, NULL, IDS_SCROLLPAGE_DOWN); + //InsertItem(hMenu, MFT_SEPARATOR, MIIM_FTYPE, 0, NULL, -1); + //InsertItem(hMenu, MIIM_STRING, MIIM_ID | MIIM_FTYPE | MIIM_STRING, 0, NULL, IDS_SCROLLUP); + //InsertItem(hMenu, MIIM_STRING, MIIM_ID | MIIM_FTYPE | MIIM_STRING, 0, NULL, IDS_SCROLLDOWN); +} +*/ + +static +LRESULT +GuiConsoleHandleScroll(PGUI_CONSOLE_DATA GuiData, UINT uMsg, WPARAM wParam) +{ + PCONSOLE Console = GuiData->Console; + PCONSOLE_SCREEN_BUFFER Buff; + SCROLLINFO sInfo; + int fnBar; + int old_pos, Maximum; + PUSHORT pShowXY; + + if (GuiData == NULL) return FALSE; + + Buff = Console->ActiveBuffer; + + if (uMsg == WM_HSCROLL) + { + fnBar = SB_HORZ; + Maximum = Buff->ScreenBufferSize.X - Console->ConsoleSize.X; + pShowXY = &Buff->ShowX; + } + else + { + fnBar = SB_VERT; + Maximum = Buff->ScreenBufferSize.Y - Console->ConsoleSize.Y; + pShowXY = &Buff->ShowY; + } + + /* set scrollbar sizes */ + sInfo.cbSize = sizeof(SCROLLINFO); + sInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE | SIF_TRACKPOS; + + if (!GetScrollInfo(GuiData->hWindow, fnBar, &sInfo)) + { + return FALSE; + } + + old_pos = sInfo.nPos; + + switch (LOWORD(wParam)) + { + case SB_LINELEFT: + sInfo.nPos -= 1; + break; + + case SB_LINERIGHT: + sInfo.nPos += 1; + break; + + case SB_PAGELEFT: + sInfo.nPos -= sInfo.nPage; + break; + + case SB_PAGERIGHT: + sInfo.nPos += sInfo.nPage; + break; + + case SB_THUMBTRACK: + sInfo.nPos = sInfo.nTrackPos; + ConioPause(Console, PAUSED_FROM_SCROLLBAR); + break; + + case SB_THUMBPOSITION: + ConioUnpause(Console, PAUSED_FROM_SCROLLBAR); + break; + + case SB_TOP: + sInfo.nPos = sInfo.nMin; + break; + + case SB_BOTTOM: + sInfo.nPos = sInfo.nMax; + break; + + default: + break; + } + + sInfo.nPos = max(sInfo.nPos, 0); + sInfo.nPos = min(sInfo.nPos, Maximum); + + if (old_pos != sInfo.nPos) + { + USHORT OldX = Buff->ShowX; + USHORT OldY = Buff->ShowY; + *pShowXY = sInfo.nPos; + + ScrollWindowEx(GuiData->hWindow, + (OldX - Buff->ShowX) * GuiData->CharWidth, + (OldY - Buff->ShowY) * GuiData->CharHeight, + NULL, + NULL, + NULL, + NULL, + SW_INVALIDATE); + + sInfo.fMask = SIF_POS; + SetScrollInfo(GuiData->hWindow, fnBar, &sInfo, TRUE); + + UpdateWindow(GuiData->hWindow); + } + + return 0; +} + +static LRESULT CALLBACK +GuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + LRESULT Result = 0; + PGUI_CONSOLE_DATA GuiData = NULL; + + /* + * If it's the first time we create a window + * for the terminal, just initialize it. + */ + if (msg == WM_NCCREATE) + { + return (LRESULT)GuiConsoleHandleNcCreate(hWnd, (LPCREATESTRUCTW)lParam); + } + + /* + * Now the terminal window is initialized. + * Get the terminal data via the window's data. + * If there is no data, just go away. + */ + GuiData = GuiGetGuiData(hWnd); + if (GuiData == NULL) return 0; + + // TODO: If the console is about to be destroyed, leave the loop. + + /* Lock the console */ + EnterCriticalSection(&GuiData->Console->Lock); + + /* We have a console, start message dispatching. */ + switch (msg) + { + case WM_CLOSE: + GuiConsoleHandleClose(GuiData); + break; + + case WM_NCDESTROY: + GuiConsoleHandleNcDestroy(GuiData); + break; + + case WM_PAINT: + GuiConsoleHandlePaint(GuiData, (HDC)wParam); + break; + + case WM_KEYDOWN: + case WM_KEYUP: + case WM_SYSKEYDOWN: + case WM_SYSKEYUP: + case WM_CHAR: + GuiConsoleHandleKey(GuiData, msg, wParam, lParam); + break; + + case WM_TIMER: + GuiConsoleHandleTimer(GuiData); + break; + + case WM_LBUTTONDOWN: + GuiConsoleLeftMouseDown(GuiData, lParam); + break; + + case WM_LBUTTONUP: + GuiConsoleLeftMouseUp(GuiData, lParam); + break; + + case WM_RBUTTONDOWN: + GuiConsoleRightMouseDown(GuiData); + break; + + case WM_MOUSEMOVE: + GuiConsoleMouseMove(GuiData, wParam, lParam); + break; + + case WM_SYSCOMMAND: + Result = GuiConsoleHandleSysMenuCommand(GuiData, wParam, lParam); + break; + + case WM_HSCROLL: + case WM_VSCROLL: + Result = GuiConsoleHandleScroll(GuiData, msg, wParam); + break; + + case WM_GETMINMAXINFO: + GuiConsoleGetMinMaxInfo(GuiData, (PMINMAXINFO)lParam); + break; + + case WM_SIZE: + GuiConsoleResize(GuiData, wParam, lParam); + break; + + case PM_APPLY_CONSOLE_INFO: + GuiApplyUserSettings(GuiData, (HANDLE)wParam, (BOOL)lParam); + break; + + case PM_CONSOLE_BEEP: + DPRINT1("Beep !!\n"); + Beep(800, 200); + break; + + case PM_CONSOLE_SET_TITLE: + SetWindowText(GuiData->hWindow, GuiData->Console->Title.Buffer); + break; + + default: + Result = DefWindowProcW(GuiData->hWindow, msg, wParam, lParam); + break; + } + + /* Unlock the console */ + LeaveCriticalSection(&GuiData->Console->Lock); + + return Result; +} + + + +/****************************************************************************** + * GUI Terminal Initialization * + ******************************************************************************/ + +static LRESULT CALLBACK +GuiConsoleNotifyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + HWND NewWindow; + LONG WindowCount; + MSG Msg; + PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)lParam; + PCONSOLE Console = GuiData->Console; + + switch (msg) + { + case WM_CREATE: + { + SetWindowLongW(hWnd, GWL_USERDATA, 0); + return 0; + } + + case PM_CREATE_CONSOLE: + { + NewWindow = CreateWindowExW(WS_EX_CLIENTEDGE, + GUI_CONSOLE_WINDOW_CLASS, + Console->Title.Buffer, + WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + NULL, + NULL, + ConSrvDllInstance, + (PVOID)GuiData); + if (NULL != NewWindow) + { + WindowCount = GetWindowLongW(hWnd, GWL_USERDATA); + WindowCount++; + SetWindowLongW(hWnd, GWL_USERDATA, WindowCount); + + DPRINT1("Set icons via PM_CREATE_CONSOLE\n"); + if (GuiData->hIcon == NULL) + { + DPRINT1("Not really /o\\...\n"); + GuiData->hIcon = ghDefaultIcon; + GuiData->hIconSm = ghDefaultIconSm; + } + else if (GuiData->hIcon != ghDefaultIcon) + { + DPRINT1("Yes \\o/\n"); + SendMessageW(GuiData->hWindow, WM_SETICON, ICON_BIG, (LPARAM)GuiData->hIcon); + SendMessageW(GuiData->hWindow, WM_SETICON, ICON_SMALL, (LPARAM)GuiData->hIconSm); + } + + ShowWindow(NewWindow, (int)wParam); + } + + return (LRESULT)NewWindow; + } + + case PM_DESTROY_CONSOLE: + { + /* + * Window creation is done using a PostMessage(), so it's possible + * that the window that we want to destroy doesn't exist yet. + * So first empty the message queue. + */ + while(PeekMessageW(&Msg, NULL, 0, 0, PM_REMOVE)) + { + TranslateMessage(&Msg); + DispatchMessageW(&Msg); + } + + if (GuiData->hWindow != NULL) /* && DestroyWindow(GuiData->hWindow) */ + { + DestroyWindow(GuiData->hWindow); + + WindowCount = GetWindowLongW(hWnd, GWL_USERDATA); + WindowCount--; + SetWindowLongW(hWnd, GWL_USERDATA, WindowCount); + if (0 == WindowCount) + { + NotifyWnd = NULL; + DestroyWindow(hWnd); + DPRINT1("CONSRV: Going to quit the Gui Thread!!\n"); + PostQuitMessage(0); + } + } + + return 0; + } + + default: + return DefWindowProcW(hWnd, msg, wParam, lParam); + } +} + +static DWORD WINAPI +GuiConsoleGuiThread(PVOID Data) +{ + MSG msg; + PHANDLE GraphicsStartupEvent = (PHANDLE)Data; + + /* + * This thread dispatches all the console notifications to the notify window. + * It is common for all the console windows. + */ + + PrivateCsrssManualGuiCheck(+1); + + NotifyWnd = CreateWindowW(L"ConSrvCreateNotify", + L"", + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + NULL, + NULL, + ConSrvDllInstance, + NULL); + if (NULL == NotifyWnd) + { + PrivateCsrssManualGuiCheck(-1); + SetEvent(*GraphicsStartupEvent); + return 1; + } + + SetEvent(*GraphicsStartupEvent); + + while(GetMessageW(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessageW(&msg); + } + + DPRINT1("CONSRV: Quit the Gui Thread!!\n"); + PrivateCsrssManualGuiCheck(-1); + + return 1; +} + +static BOOL +GuiInit(VOID) +{ + WNDCLASSEXW wc; + ATOM ConsoleClassAtom; + + /* Exit if we were already initialized */ + // if (ConsInitialized) return TRUE; + + /* + * Initialize and register the different window classes, if needed. + */ + if (!ConsInitialized) + { + /* Initialize the notification window class */ + wc.cbSize = sizeof(WNDCLASSEXW); + wc.lpszClassName = L"ConSrvCreateNotify"; + wc.lpfnWndProc = GuiConsoleNotifyWndProc; + wc.style = 0; + wc.hInstance = ConSrvDllInstance; + wc.hIcon = NULL; + wc.hIconSm = NULL; + wc.hCursor = NULL; + wc.hbrBackground = NULL; + wc.lpszMenuName = NULL; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + if (RegisterClassExW(&wc) == 0) + { + DPRINT1("Failed to register GUI notify wndproc\n"); + return FALSE; + } + + /* Initialize the console window class */ + ghDefaultIcon = NULL; // LoadImageW(ConSrvDllInstance, MAKEINTRESOURCEW(IDI_CONSOLE), IMAGE_ICON, + // GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), + // LR_SHARED); + ghDefaultIconSm = NULL; // 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 = ConSrvDllInstance; + wc.hIcon = ghDefaultIcon; + wc.hIconSm = ghDefaultIconSm; + wc.hCursor = ghDefaultCursor; + wc.hbrBackground = CreateSolidBrush(RGB(0,0,0)); // FIXME: Use defaults from registry. + wc.lpszMenuName = NULL; + wc.cbClsExtra = 0; + wc.cbWndExtra = GWLP_CONSOLEWND_ALLOC; + + ConsoleClassAtom = RegisterClassExW(&wc); + if (ConsoleClassAtom == 0) + { + DPRINT1("Failed to register GUI console wndproc\n"); + return FALSE; + } + else + { + NtUserConsoleControl(GuiConsoleWndClassAtom, &ConsoleClassAtom, sizeof(ATOM)); + } + + ConsInitialized = TRUE; + } + + /* + * Set-up the notification window + */ + if (NULL == NotifyWnd) + { + HANDLE ThreadHandle; + HANDLE GraphicsStartupEvent; + + GraphicsStartupEvent = CreateEventW(NULL, FALSE, FALSE, NULL); + if (NULL == GraphicsStartupEvent) return FALSE; + + ThreadHandle = CreateThread(NULL, + 0, + GuiConsoleGuiThread, + (PVOID)&GraphicsStartupEvent, + 0, + NULL); + if (NULL == ThreadHandle) + { + CloseHandle(GraphicsStartupEvent); + DPRINT1("CONSRV: Failed to create graphics console thread. Expect problems\n"); + return FALSE; + } + SetThreadPriority(ThreadHandle, THREAD_PRIORITY_HIGHEST); + CloseHandle(ThreadHandle); + + WaitForSingleObject(GraphicsStartupEvent, INFINITE); + CloseHandle(GraphicsStartupEvent); + + if (NULL == NotifyWnd) + { + DPRINT1("CONSRV: Failed to create notification window.\n"); + return FALSE; + } + } + + // ConsInitialized = TRUE; + + return TRUE; +} + + + +/****************************************************************************** + * GUI Console Driver * + ******************************************************************************/ + +static VOID WINAPI +GuiCleanupConsole(PCONSOLE Console) +{ + PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data; + + SendMessageW(NotifyWnd, PM_DESTROY_CONSOLE, 0, (LPARAM)GuiData); + + DPRINT1("Destroying icons !! - GuiData->hIcon = 0x%p ; ghDefaultIcon = 0x%p ; GuiData->hIconSm = 0x%p ; ghDefaultIconSm = 0x%p\n", + GuiData->hIcon, ghDefaultIcon, GuiData->hIconSm, ghDefaultIconSm); + if (GuiData->hIcon != NULL && GuiData->hIcon != ghDefaultIcon) + { + DPRINT1("Destroy hIcon\n"); + DestroyIcon(GuiData->hIcon); + } + if (GuiData->hIconSm != NULL && GuiData->hIconSm != ghDefaultIconSm) + { + DPRINT1("Destroy hIconSm\n"); + DestroyIcon(GuiData->hIconSm); + } + + Console->TermIFace.Data = NULL; + DeleteCriticalSection(&GuiData->Lock); + RtlFreeHeap(ConSrvHeap, 0, GuiData); +} + +static VOID WINAPI +GuiWriteStream(PCONSOLE Console, SMALL_RECT* Region, LONG CursorStartX, LONG CursorStartY, + UINT ScrolledLines, CHAR *Buffer, UINT Length) +{ + PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data; + PCONSOLE_SCREEN_BUFFER Buff = Console->ActiveBuffer; + LONG CursorEndX, CursorEndY; + RECT ScrollRect; + + if (NULL == GuiData || NULL == GuiData->hWindow) + { + return; + } + + if (0 != ScrolledLines) + { + ScrollRect.left = 0; + ScrollRect.top = 0; + ScrollRect.right = Console->ConsoleSize.X * GuiData->CharWidth; + ScrollRect.bottom = Region->Top * GuiData->CharHeight; + + ScrollWindowEx(GuiData->hWindow, + 0, + -(ScrolledLines * GuiData->CharHeight), + &ScrollRect, + NULL, + NULL, + NULL, + SW_INVALIDATE); + } + + GuiDrawRegion(Console, Region); + + if (CursorStartX < Region->Left || Region->Right < CursorStartX + || CursorStartY < Region->Top || Region->Bottom < CursorStartY) + { + GuiInvalidateCell(Console, CursorStartX, CursorStartY); + } + + CursorEndX = Buff->CursorPosition.X; + CursorEndY = Buff->CursorPosition.Y; + if ((CursorEndX < Region->Left || Region->Right < CursorEndX + || CursorEndY < Region->Top || Region->Bottom < CursorEndY) + && (CursorEndX != CursorStartX || CursorEndY != CursorStartY)) + { + GuiInvalidateCell(Console, CursorEndX, CursorEndY); + } + + // Set up the update timer (very short interval) - this is a "hack" for getting the OS to + // repaint the window without having it just freeze up and stay on the screen permanently. + Buff->CursorBlinkOn = TRUE; + SetTimer(GuiData->hWindow, CONGUI_UPDATE_TIMER, CONGUI_UPDATE_TIME, NULL); +} + +static VOID WINAPI +GuiDrawRegion(PCONSOLE Console, SMALL_RECT* Region) +{ + PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data; + RECT RegionRect; + + SmallRectToRect(GuiData, &RegionRect, Region); + InvalidateRect(GuiData->hWindow, &RegionRect, FALSE); +} + +static BOOL WINAPI +GuiSetCursorInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff) +{ + if (Console->ActiveBuffer == Buff) + { + GuiInvalidateCell(Console, Buff->CursorPosition.X, Buff->CursorPosition.Y); + } + + return TRUE; +} + +static BOOL WINAPI +GuiSetScreenInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff, UINT OldCursorX, UINT OldCursorY) +{ + if (Console->ActiveBuffer == Buff) + { + /* Redraw char at old position (removes cursor) */ + GuiInvalidateCell(Console, OldCursorX, OldCursorY); + /* Redraw char at new position (shows cursor) */ + GuiInvalidateCell(Console, Buff->CursorPosition.X, Buff->CursorPosition.Y); + } + + return TRUE; +} + +static BOOL WINAPI +GuiUpdateScreenInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff) +{ + return TRUE; +} + +static NTSTATUS WINAPI +GuiResizeBuffer(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER ScreenBuffer, COORD Size) +{ + BYTE * Buffer; + DWORD Offset = 0; + BYTE * OldPtr; + USHORT CurrentY; + BYTE * OldBuffer; +#ifdef HAVE_WMEMSET + USHORT value = MAKEWORD(' ', ScreenBuffer->ScreenDefaultAttrib); +#else + DWORD i; +#endif + DWORD diff; + + /* Buffer size is not allowed to be smaller than window size */ + if (Size.X < Console->ConsoleSize.X || Size.Y < Console->ConsoleSize.Y) + return STATUS_INVALID_PARAMETER; + + if (Size.X == ScreenBuffer->ScreenBufferSize.X && Size.Y == ScreenBuffer->ScreenBufferSize.Y) + return STATUS_SUCCESS; + + Buffer = RtlAllocateHeap(ConSrvHeap, 0, Size.X * Size.Y * 2); + if (!Buffer) + return STATUS_NO_MEMORY; + + DPRINT1("Resizing (%d,%d) to (%d,%d)\n", ScreenBuffer->ScreenBufferSize.X, ScreenBuffer->ScreenBufferSize.Y, Size.X, Size.Y); + OldBuffer = ScreenBuffer->Buffer; + + for (CurrentY = 0; CurrentY < ScreenBuffer->ScreenBufferSize.Y && CurrentY < Size.Y; CurrentY++) + { + OldPtr = ConioCoordToPointer(ScreenBuffer, 0, CurrentY); + if (Size.X <= ScreenBuffer->ScreenBufferSize.X) + { + /* reduce size */ + RtlCopyMemory(&Buffer[Offset], OldPtr, Size.X * 2); + Offset += (Size.X * 2); + } + else + { + /* enlarge size */ + RtlCopyMemory(&Buffer[Offset], OldPtr, ScreenBuffer->ScreenBufferSize.X * 2); + Offset += (ScreenBuffer->ScreenBufferSize.X * 2); + + diff = Size.X - ScreenBuffer->ScreenBufferSize.X; + /* zero new part of it */ +#ifdef HAVE_WMEMSET + wmemset((PWCHAR)&Buffer[Offset], value, diff); +#else + for (i = 0; i < diff; i++) + { + Buffer[Offset++] = ' '; + Buffer[Offset++] = ScreenBuffer->ScreenDefaultAttrib; + } +#endif + } + } + + if (Size.Y > ScreenBuffer->ScreenBufferSize.Y) + { + diff = Size.X * (Size.Y - ScreenBuffer->ScreenBufferSize.Y); +#ifdef HAVE_WMEMSET + wmemset((PWCHAR)&Buffer[Offset], value, diff); +#else + for (i = 0; i < diff; i++) + { + Buffer[Offset++] = ' '; + Buffer[Offset++] = ScreenBuffer->ScreenDefaultAttrib; + } +#endif + } + + (void)InterlockedExchangePointer((PVOID volatile*)&ScreenBuffer->Buffer, Buffer); + RtlFreeHeap(ConSrvHeap, 0, OldBuffer); + ScreenBuffer->ScreenBufferSize = Size; + ScreenBuffer->VirtualY = 0; + + /* Ensure cursor and window are within buffer */ + if (ScreenBuffer->CursorPosition.X >= Size.X) + ScreenBuffer->CursorPosition.X = Size.X - 1; + if (ScreenBuffer->CursorPosition.Y >= Size.Y) + ScreenBuffer->CursorPosition.Y = Size.Y - 1; + if (ScreenBuffer->ShowX > Size.X - Console->ConsoleSize.X) + ScreenBuffer->ShowX = Size.X - Console->ConsoleSize.X; + if (ScreenBuffer->ShowY > Size.Y - Console->ConsoleSize.Y) + ScreenBuffer->ShowY = Size.Y - Console->ConsoleSize.Y; + + /* TODO: Should update scrollbar, but can't use anything that + * calls SendMessage or it could cause deadlock --> Use PostMessage */ + // TODO: Tell the terminal to resize its scrollbars. + + return STATUS_SUCCESS; +} + +static VOID WINAPI +GuiResizeTerminal(PCONSOLE Console) +{ + PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data; + + /* Resize the window to the user's values */ + GuiData->WindowSizeLock = TRUE; + GuiConsoleResizeWindow(GuiData); + GuiData->WindowSizeLock = FALSE; +} + +static BOOL WINAPI +GuiProcessKeyCallback(PCONSOLE Console, MSG* msg, BYTE KeyStateMenu, DWORD ShiftState, UINT VirtualKeyCode, BOOL Down) +{ + if ((ShiftState & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED) || KeyStateMenu & 0x80) && + (VirtualKeyCode == VK_ESCAPE || VirtualKeyCode == VK_TAB || VirtualKeyCode == VK_SPACE)) + { + DefWindowProcW(msg->hwnd, msg->message, msg->wParam, msg->lParam); + return TRUE; + } + + return FALSE; +} + +static VOID WINAPI +GuiRefreshInternalInfo(PCONSOLE Console) +{ + PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data; + + /* Update the console leader information held by the window */ + SetConsoleWndConsoleLeaderCID(GuiData); +} + +static VOID WINAPI +GuiChangeTitle(PCONSOLE Console) +{ + PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data; + PostMessageW(GuiData->hWindow, PM_CONSOLE_SET_TITLE, 0, 0); +} + +static BOOL WINAPI +GuiChangeIcon(PCONSOLE Console, HICON hWindowIcon) +{ + PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data; + HICON hIcon, hIconSm; + + if (hWindowIcon == NULL) + { + hIcon = ghDefaultIcon; + hIconSm = ghDefaultIconSm; + } + else + { + hIcon = CopyIcon(hWindowIcon); + hIconSm = CopyIcon(hWindowIcon); + } + + if (hIcon == NULL) + { + return FALSE; + } + + if (hIcon != GuiData->hIcon) + { + if (GuiData->hIcon != NULL && GuiData->hIcon != ghDefaultIcon) + { + DestroyIcon(GuiData->hIcon); + } + if (GuiData->hIconSm != NULL && GuiData->hIconSm != ghDefaultIconSm) + { + DestroyIcon(GuiData->hIconSm); + } + + GuiData->hIcon = hIcon; + GuiData->hIconSm = hIconSm; + + DPRINT1("Set icons in GuiChangeIcon\n"); + PostMessageW(GuiData->hWindow, WM_SETICON, ICON_BIG, (LPARAM)GuiData->hIcon); + PostMessageW(GuiData->hWindow, WM_SETICON, ICON_SMALL, (LPARAM)GuiData->hIconSm); + } + + return TRUE; +} + +static HWND WINAPI +GuiGetConsoleWindowHandle(PCONSOLE Console) +{ + PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data; + return GuiData->hWindow; +} + +static FRONTEND_VTBL GuiVtbl = +{ + GuiCleanupConsole, + GuiWriteStream, + GuiDrawRegion, + GuiSetCursorInfo, + GuiSetScreenInfo, + GuiUpdateScreenInfo, + GuiResizeBuffer, + GuiResizeTerminal, + GuiProcessKeyCallback, + GuiRefreshInternalInfo, + GuiChangeTitle, + GuiChangeIcon, + GuiGetConsoleWindowHandle +}; + +NTSTATUS FASTCALL +GuiInitConsole(PCONSOLE Console, + /*IN*/ PCONSOLE_START_INFO ConsoleStartInfo, + PCONSOLE_INFO ConsoleInfo, + DWORD ProcessId, + LPCWSTR IconPath, + INT IconIndex) +{ + PGUI_CONSOLE_DATA GuiData; + GUI_CONSOLE_INFO TermInfo; + + if (Console == NULL || ConsoleInfo == NULL) + return STATUS_INVALID_PARAMETER; + + /* Initialize the GUI terminal emulator */ + if (!GuiInit()) return STATUS_UNSUCCESSFUL; + + /* Initialize the console */ + Console->TermIFace.Vtbl = &GuiVtbl; + + GuiData = RtlAllocateHeap(ConSrvHeap, HEAP_ZERO_MEMORY, + sizeof(GUI_CONSOLE_DATA)); + if (!GuiData) + { + DPRINT1("CONSRV: Failed to create GUI_CONSOLE_DATA\n"); + return STATUS_UNSUCCESSFUL; + } + Console->TermIFace.Data = (PVOID)GuiData; + GuiData->Console = Console; + GuiData->hWindow = NULL; + + InitializeCriticalSection(&GuiData->Lock); + + + /* + * Load the terminal settings + */ + + /*********************************************** + * Adapted from ConSrvInitConsole in console.c * + ***********************************************/ + + /* 1. Load the default settings */ + GuiConsoleGetDefaultSettings(&TermInfo, ProcessId); + + /* 2. Load the remaining console settings via the registry. */ + if ((ConsoleStartInfo->dwStartupFlags & STARTF_TITLEISLINKNAME) == 0) + { + /* Load the terminal infos from the registry. */ + GuiConsoleReadUserSettings(&TermInfo, ConsoleInfo->ConsoleTitle, ProcessId); + + /* + * Now, update them with the properties the user might gave to us + * via the STARTUPINFO structure before calling CreateProcess + * (and which was transmitted via the ConsoleStartInfo structure). + * We therefore overwrite the values read in the registry. + */ + if (ConsoleStartInfo->dwStartupFlags & STARTF_USESHOWWINDOW) + { + TermInfo.ShowWindow = ConsoleStartInfo->ShowWindow; + } + if (ConsoleStartInfo->dwStartupFlags & STARTF_USEPOSITION) + { + TermInfo.AutoPosition = FALSE; + TermInfo.WindowOrigin = ConsoleStartInfo->ConsoleWindowOrigin; + } + /* + if (ConsoleStartInfo->dwStartupFlags & STARTF_RUNFULLSCREEN) + { + } + */ + } + + + /* + * Set up the GUI data + */ + + wcsncpy(GuiData->GuiInfo.FaceName, TermInfo.FaceName, LF_FACESIZE); + GuiData->GuiInfo.FontFamily = TermInfo.FontFamily; + GuiData->GuiInfo.FontSize = TermInfo.FontSize; + GuiData->GuiInfo.FontWeight = TermInfo.FontWeight; + GuiData->GuiInfo.UseRasterFonts = TermInfo.UseRasterFonts; + GuiData->GuiInfo.ShowWindow = TermInfo.ShowWindow; + GuiData->GuiInfo.AutoPosition = TermInfo.AutoPosition; + GuiData->GuiInfo.WindowOrigin = TermInfo.WindowOrigin; + + /* Initialize the icon handles to their default values */ + GuiData->hIcon = ghDefaultIcon; + GuiData->hIconSm = ghDefaultIconSm; + + /* Get the associated icon, if any */ + if (IconPath == NULL || *IconPath == L'\0') + { + IconPath = ConsoleStartInfo->AppPath; + IconIndex = 0; + } + DPRINT1("IconPath = %S ; IconIndex = %lu\n", (IconPath ? IconPath : L"n/a"), IconIndex); + if (IconPath) + { + HICON hIcon = NULL, hIconSm = NULL; + 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"); + GuiData->hIcon = hIcon; + GuiData->hIconSm = hIconSm; + } + } + + /* + * 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 the terminal window */ + PostMessageW(NotifyWnd, PM_CREATE_CONSOLE, GuiData->GuiInfo.ShowWindow, (LPARAM)GuiData); + + /* Wait until initialization has finished */ + WaitForSingleObject(GuiData->hGuiInitEvent, INFINITE); + CloseHandle(GuiData->hGuiInitEvent); + GuiData->hGuiInitEvent = NULL; + + /* Check whether we really succeeded in initializing the terminal window */ + if (GuiData->hWindow == NULL) + { + DPRINT1("GuiInitConsole - We failed at creating a new terminal window\n"); + // ConioCleanupConsole(Console); + GuiCleanupConsole(Console); + return STATUS_UNSUCCESSFUL; + } + + return STATUS_SUCCESS; +} + +/* EOF */ Index: win32ss/user/consrv/guiconsole.c =================================================================== --- win32ss/user/consrv/guiconsole.c (rvision 58607) +++ win32ss/user/consrv/guiconsole.c (copie de travail) Modification de proprits sur win32ss/user/consrv/guiconsole.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/guiconsole.h =================================================================== --- win32ss/user/consrv/guiconsole.h (rvision 0) +++ win32ss/user/consrv/guiconsole.h (copie de travail) @@ -0,0 +1,25 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/guiconsole.h + * PURPOSE: GUI front-end + * PROGRAMMERS: + */ + +#pragma once + +// #include "guisettings.h" + +#define CONGUI_MIN_WIDTH 10 +#define CONGUI_MIN_HEIGHT 10 +#define CONGUI_UPDATE_TIME 0 +#define CONGUI_UPDATE_TIMER 1 + +NTSTATUS FASTCALL GuiInitConsole(PCONSOLE Console, + /*IN*/ PCONSOLE_START_INFO ConsoleStartInfo, + PCONSOLE_INFO ConsoleInfo, + DWORD ProcessId, + LPCWSTR IconPath, + INT IconIndex); + +/* EOF */ Index: win32ss/user/consrv/guiconsole.h =================================================================== --- win32ss/user/consrv/guiconsole.h (rvision 58607) +++ win32ss/user/consrv/guiconsole.h (copie de travail) Modification de proprits sur win32ss/user/consrv/guiconsole.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/guisettings.c =================================================================== --- win32ss/user/consrv/guisettings.c (rvision 0) +++ win32ss/user/consrv/guisettings.c (copie de travail) @@ -0,0 +1,462 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/guisettings.c + * PURPOSE: GUI terminal emulator settings management + * PROGRAMMERS: Hermes Belusca - Maito + */ + +/* INCLUDES *******************************************************************/ + +#include "consrv.h" +#include "conio.h" +#include "settings.h" +#include "guiconsole.h" +#include "guisettings.h" + +#define NDEBUG +#include + + +VOID GuiConsoleMoveWindow(PGUI_CONSOLE_DATA GuiData); + +/* FUNCTIONS ******************************************************************/ + +BOOL +GuiConsoleReadUserSettings(IN OUT PGUI_CONSOLE_INFO TermInfo, + IN LPCWSTR ConsoleTitle, + IN DWORD ProcessId) +{ + /***************************************************** + * Adapted from ConSrvReadUserSettings in settings.c * + *****************************************************/ + + BOOL RetVal = FALSE; + HKEY hKey; + DWORD dwNumSubKeys = 0; + DWORD dwIndex; + DWORD dwType; + WCHAR szValueName[MAX_PATH]; + DWORD dwValueName; + WCHAR szValue[LF_FACESIZE] = L"\0"; + DWORD Value; + DWORD dwValue; + + if (!ConSrvOpenUserSettings(ProcessId, + ConsoleTitle, + &hKey, KEY_READ, + FALSE)) + { + DPRINT("ConSrvOpenUserSettings failed\n"); + return FALSE; + } + + if (RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, + &dwNumSubKeys, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) + { + DPRINT("GuiConsoleReadUserSettings: RegQueryInfoKey failed\n"); + RegCloseKey(hKey); + return FALSE; + } + + DPRINT("GuiConsoleReadUserSettings entered dwNumSubKeys %d\n", dwNumSubKeys); + + for (dwIndex = 0; dwIndex < dwNumSubKeys; dwIndex++) + { + dwValue = sizeof(Value); + dwValueName = MAX_PATH; // sizeof(szValueName)/sizeof(szValueName[0]) + + if (RegEnumValueW(hKey, dwIndex, szValueName, &dwValueName, NULL, &dwType, (BYTE*)&Value, &dwValue) != ERROR_SUCCESS) + { + if (dwType == REG_SZ) + { + /* + * Retry in case of string value + */ + dwValue = sizeof(szValue); + dwValueName = MAX_PATH; // sizeof(szValueName)/sizeof(szValueName[0]) + if (RegEnumValueW(hKey, dwIndex, szValueName, &dwValueName, NULL, NULL, (BYTE*)szValue, &dwValue) != ERROR_SUCCESS) + break; + } + else + { + break; + } + } + + if (!wcscmp(szValueName, L"FaceName")) + { + wcsncpy(TermInfo->FaceName, szValue, LF_FACESIZE); + RetVal = TRUE; + } + else if (!wcscmp(szValueName, L"FontFamily")) + { + TermInfo->FontFamily = Value; + RetVal = TRUE; + } + else if (!wcscmp(szValueName, L"FontSize")) + { + TermInfo->FontSize = Value; + RetVal = TRUE; + } + else if (!wcscmp(szValueName, L"FontWeight")) + { + TermInfo->FontWeight = Value; + RetVal = TRUE; + } + else if (!wcscmp(szValueName, L"WindowPosition")) + { + TermInfo->AutoPosition = FALSE; + TermInfo->WindowOrigin.x = LOWORD(Value); + TermInfo->WindowOrigin.y = HIWORD(Value); + RetVal = TRUE; + } + } + + RegCloseKey(hKey); + return RetVal; +} + +BOOL +GuiConsoleWriteUserSettings(IN OUT PGUI_CONSOLE_INFO TermInfo, + IN LPCWSTR ConsoleTitle, + IN DWORD ProcessId) +{ + /****************************************************** + * Adapted from ConSrvWriteUserSettings in settings.c * + ******************************************************/ + + BOOL GlobalSettings = (ConsoleTitle[0] == L'\0'); + HKEY hKey; + DWORD Storage = 0; + +#define SetConsoleSetting(SettingName, SettingType, SettingSize, Setting, DefaultValue) \ +do { \ + if (GlobalSettings || (!GlobalSettings && (*(Setting) != (DefaultValue)))) \ + { \ + RegSetValueExW(hKey, (SettingName), 0, (SettingType), (PBYTE)(Setting), (SettingSize)); \ + } \ + else \ + { \ + RegDeleteValue(hKey, (SettingName)); \ + } \ +} while (0) + + if (!ConSrvOpenUserSettings(ProcessId, + ConsoleTitle, + &hKey, KEY_WRITE, + TRUE)) + { + return FALSE; + } + + SetConsoleSetting(L"FaceName", REG_SZ, (wcslen(TermInfo->FaceName) + 1) * sizeof(WCHAR), TermInfo->FaceName, L'\0'); + SetConsoleSetting(L"FontFamily", REG_DWORD, sizeof(DWORD), &TermInfo->FontFamily, FF_DONTCARE); + SetConsoleSetting(L"FontSize", REG_DWORD, sizeof(DWORD), &TermInfo->FontSize, 0); + SetConsoleSetting(L"FontWeight", REG_DWORD, sizeof(DWORD), &TermInfo->FontWeight, FW_DONTCARE); + + if (TermInfo->AutoPosition == FALSE) + { + Storage = MAKELONG(TermInfo->WindowOrigin.x, TermInfo->WindowOrigin.y); + RegSetValueExW(hKey, L"WindowPosition", 0, REG_DWORD, (PBYTE)&Storage, sizeof(DWORD)); + } + else + { + RegDeleteValue(hKey, L"WindowPosition"); + } + + RegCloseKey(hKey); + return TRUE; +} + +VOID +GuiConsoleGetDefaultSettings(IN OUT PGUI_CONSOLE_INFO TermInfo, + IN DWORD ProcessId) +{ + /******************************************************* + * Adapted from ConSrvGetDefaultSettings in settings.c * + *******************************************************/ + + if (TermInfo == NULL) return; + + /* + * 1. Load the default values + */ + // wcsncpy(TermInfo->FaceName, L"DejaVu Sans Mono", LF_FACESIZE); + // TermInfo->FontSize = MAKELONG(12, 8); // 0x0008000C; // font is 8x12 + // TermInfo->FontSize = MAKELONG(16, 16); // font is 16x16 + // TermInfo->FontWeight = FW_NORMAL; + + wcsncpy(TermInfo->FaceName, L"Fixedsys", LF_FACESIZE); // HACK: !! + // TermInfo->FaceName[0] = L'\0'; + TermInfo->FontFamily = FF_DONTCARE; + TermInfo->FontSize = 0; + TermInfo->FontWeight = FW_DONTCARE; + TermInfo->UseRasterFonts = TRUE; + + TermInfo->ShowWindow = SW_SHOWNORMAL; + TermInfo->AutoPosition = TRUE; + TermInfo->WindowOrigin = (POINT){0, 0}; + + /* + * 2. Overwrite them with the ones stored in HKCU\Console. + * If the HKCU\Console key doesn't exist, create it + * and store the default values inside. + */ + if (!GuiConsoleReadUserSettings(TermInfo, L"", ProcessId)) + { + GuiConsoleWriteUserSettings(TermInfo, L"", ProcessId); + } +} + +VOID +GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData, + BOOL Defaults) +{ + NTSTATUS Status; + PCONSOLE Console = GuiData->Console; + PCONSOLE_PROCESS_DATA ProcessData; + HANDLE hSection = NULL, hClientSection = NULL; + LARGE_INTEGER SectionSize; + ULONG ViewSize = 0; + SIZE_T Length = 0; + PCONSOLE_PROPS pSharedInfo = NULL; + PGUI_CONSOLE_INFO GuiInfo = NULL; + + DPRINT("GuiConsoleShowConsoleProperties entered\n"); + + /* + * Create a memory section to share with the applet, and map it. + */ + /* Holds data for console.dll + console info + terminal-specific info */ + SectionSize.QuadPart = sizeof(CONSOLE_PROPS) + sizeof(GUI_CONSOLE_INFO); + Status = NtCreateSection(&hSection, + SECTION_ALL_ACCESS, + NULL, + &SectionSize, + PAGE_READWRITE, + SEC_COMMIT, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Error: Impossible to create a shared section ; Status = %lu\n", Status); + return; + } + + Status = NtMapViewOfSection(hSection, + NtCurrentProcess(), + (PVOID*)&pSharedInfo, + 0, + 0, + NULL, + &ViewSize, + ViewUnmap, + 0, + PAGE_READWRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Error: Impossible to map the shared section ; Status = %lu\n", Status); + NtClose(hSection); + return; + } + + + /* + * Setup the shared console properties structure. + */ + + /* Header */ + pSharedInfo->hConsoleWindow = GuiData->hWindow; + pSharedInfo->ShowDefaultParams = Defaults; + + /* Console information */ + pSharedInfo->ci.HistoryBufferSize = Console->HistoryBufferSize; + pSharedInfo->ci.NumberOfHistoryBuffers = Console->NumberOfHistoryBuffers; + pSharedInfo->ci.HistoryNoDup = Console->HistoryNoDup; + pSharedInfo->ci.FullScreen = Console->FullScreen; + pSharedInfo->ci.QuickEdit = Console->QuickEdit; + pSharedInfo->ci.InsertMode = Console->InsertMode; + pSharedInfo->ci.InputBufferSize = 0; + pSharedInfo->ci.ScreenBufferSize = Console->ActiveBuffer->ScreenBufferSize; + pSharedInfo->ci.ConsoleSize = Console->ConsoleSize; + pSharedInfo->ci.CursorBlinkOn; + pSharedInfo->ci.ForceCursorOff; + pSharedInfo->ci.CursorSize = Console->ActiveBuffer->CursorInfo.dwSize; + pSharedInfo->ci.ScreenAttrib = Console->ActiveBuffer->ScreenDefaultAttrib; + pSharedInfo->ci.PopupAttrib = Console->ActiveBuffer->PopupDefaultAttrib; + pSharedInfo->ci.CodePage; + + /* GUI Information */ + pSharedInfo->TerminalInfo.Size = sizeof(GUI_CONSOLE_INFO); + GuiInfo = pSharedInfo->TerminalInfo.TermInfo = (PGUI_CONSOLE_INFO)(pSharedInfo + 1); + wcsncpy(GuiInfo->FaceName, GuiData->GuiInfo.FaceName, LF_FACESIZE); + GuiInfo->FontSize = (DWORD)GuiData->GuiInfo.FontSize; + GuiInfo->FontWeight = GuiData->GuiInfo.FontWeight; + GuiInfo->UseRasterFonts = GuiData->GuiInfo.UseRasterFonts; + /// GuiInfo->WindowPosition = GuiData->GuiInfo.WindowPosition; + GuiInfo->AutoPosition = GuiData->GuiInfo.AutoPosition; + GuiInfo->WindowOrigin = GuiData->GuiInfo.WindowOrigin; + /* Offsetize */ + pSharedInfo->TerminalInfo.TermInfo = (PVOID)((ULONG_PTR)GuiInfo - (ULONG_PTR)pSharedInfo); + + /* Palette */ + memcpy(pSharedInfo->ci.Colors, Console->Colors, sizeof(Console->Colors)); + + /* Title of the console, original one corresponding to the one set by the console leader */ + Length = min(sizeof(pSharedInfo->ci.ConsoleTitle) / sizeof(pSharedInfo->ci.ConsoleTitle[0]) - 1, + Console->OriginalTitle.Length / sizeof(WCHAR)); + wcsncpy(pSharedInfo->ci.ConsoleTitle, Console->OriginalTitle.Buffer, Length); + pSharedInfo->ci.ConsoleTitle[Length] = L'\0'; + + + /* Unmap the view */ + NtUnmapViewOfSection(NtCurrentProcess(), pSharedInfo); + + /* Get the console leader process, our client */ + ProcessData = CONTAINING_RECORD(Console->ProcessList.Blink, + CONSOLE_PROCESS_DATA, + ConsoleLink); + + /* Duplicate the section handle for the client */ + Status = NtDuplicateObject(NtCurrentProcess(), + hSection, + ProcessData->Process->ProcessHandle, + &hClientSection, + 0, 0, DUPLICATE_SAME_ACCESS); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Error: Impossible to duplicate section handle for client ; Status = %lu\n", Status); + NtClose(hSection); + return; + } + + /* Start the properties dialog */ + if (ProcessData->PropDispatcher) + { + HANDLE Thread; + + Thread = CreateRemoteThread(ProcessData->Process->ProcessHandle, NULL, 0, + ProcessData->PropDispatcher, + (PVOID)hClientSection, 0, NULL); + if (NULL == Thread) + { + DPRINT1("Failed thread creation (Error: 0x%x)\n", GetLastError()); + return; + } + + DPRINT1("We succeeded at creating ProcessData->PropDispatcher remote thread, ProcessId = %x, Process = 0x%p\n", ProcessData->Process->ClientId.UniqueProcess, ProcessData->Process); + /// WaitForSingleObject(Thread, INFINITE); + CloseHandle(Thread); + } + + /* We have finished, close the section handle */ + NtClose(hSection); + return; +} + +NTSTATUS +GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData, + HANDLE hClientSection, + BOOL SaveSettings) +{ + NTSTATUS Status = STATUS_SUCCESS; + PCONSOLE Console = GuiData->Console; + PCONSOLE_PROCESS_DATA ProcessData; + HANDLE hSection = NULL; + ULONG ViewSize = 0; + PCONSOLE_PROPS pConInfo = NULL; + PCONSOLE_INFO ConInfo = NULL; + PTERMINAL_INFO TermInfo = NULL; + PGUI_CONSOLE_INFO GuiInfo = NULL; + + /// LOCK /// EnterCriticalSection(&Console->Lock); + + /* Get the console leader process, our client */ + ProcessData = CONTAINING_RECORD(Console->ProcessList.Blink, + CONSOLE_PROCESS_DATA, + ConsoleLink); + + /* Duplicate the section handle for ourselves */ + Status = NtDuplicateObject(ProcessData->Process->ProcessHandle, + hClientSection, + NtCurrentProcess(), + &hSection, + 0, 0, DUPLICATE_SAME_ACCESS); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Error when mapping client handle, Status = %lu\n", Status); + return Status; + } + + /* Get a view of the shared section */ + Status = NtMapViewOfSection(hSection, + NtCurrentProcess(), + (PVOID*)&pConInfo, + 0, + 0, + NULL, + &ViewSize, + ViewUnmap, + 0, + PAGE_READONLY); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Error when mapping view of file, Status = %lu\n", Status); + NtClose(hSection); + return Status; + } + + /* Check that the section is well-sized */ + if ( (ViewSize < sizeof(CONSOLE_PROPS)) || + (pConInfo->TerminalInfo.Size != sizeof(GUI_CONSOLE_INFO)) || + (ViewSize < sizeof(CONSOLE_PROPS) + pConInfo->TerminalInfo.Size) ) + { + DPRINT1("Error: section bad-sized: sizeof(Section) < sizeof(CONSOLE_PROPS) + sizeof(Terminal_specific_info)\n"); + Status = STATUS_INVALID_VIEW_SIZE; + goto Quit; + } + + // TODO: Check that GuiData->hWindow == pConInfo->hConsoleWindow + + /* Set the console informations */ + ConInfo = &pConInfo->ci; + ConSrvApplyUserSettings(Console, ConInfo); + + /* Set the terminal informations - De-offsetization of the pointer */ + TermInfo = &pConInfo->TerminalInfo; + GuiInfo = TermInfo->TermInfo = (PVOID)((ULONG_PTR)pConInfo + (ULONG_PTR)TermInfo->TermInfo); + + // memcpy(&GuiData->GuiInfo, GuiInfo, sizeof(GUI_CONSOLE_INFO)); + + /* Move the window to the user's values */ + GuiData->GuiInfo.AutoPosition = GuiInfo->AutoPosition; + GuiData->GuiInfo.WindowOrigin = GuiInfo->WindowOrigin; + GuiConsoleMoveWindow(GuiData); + + InvalidateRect(GuiData->hWindow, NULL, TRUE); + + + /* + * Save settings if needed + */ + + // FIXME: Do it in the console properties applet ?? + if (SaveSettings) + { + DWORD ProcessId = HandleToUlong(ProcessData->Process->ClientId.UniqueProcess); + ConSrvWriteUserSettings(ConInfo, ProcessId); + GuiConsoleWriteUserSettings(GuiInfo, ConInfo->ConsoleTitle, ProcessId); + } + + Status = STATUS_SUCCESS; + + /// LOCK /// LeaveCriticalSection(&Console->Lock); + +Quit: + /* Finally, close the section and return */ + NtUnmapViewOfSection(NtCurrentProcess(), pConInfo); + NtClose(hSection); + return Status; +} + +/* EOF */ Index: win32ss/user/consrv/guisettings.c =================================================================== --- win32ss/user/consrv/guisettings.c (rvision 58607) +++ win32ss/user/consrv/guisettings.c (copie de travail) Modification de proprits sur win32ss/user/consrv/guisettings.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/guisettings.h =================================================================== --- win32ss/user/consrv/guisettings.h (rvision 0) +++ win32ss/user/consrv/guisettings.h (copie de travail) @@ -0,0 +1,83 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/guisettings.h + * PURPOSE: GUI front-end settings management + * PROGRAMMERS: Hermes Belusca - Maito + * + * NOTE: Also used by console.dll + */ + +#pragma once + +// #include "guiconsole.h" + +#ifndef WM_APP + #define WM_APP 0x8000 +#endif +#define PM_APPLY_CONSOLE_INFO (WM_APP + 100) + +/* STRUCTURES *****************************************************************/ + +typedef struct _GUI_CONSOLE_INFO +{ + // FONTSIGNATURE FontSignature; + WCHAR FaceName[LF_FACESIZE]; + UINT FontFamily; + DWORD FontSize; + DWORD FontWeight; + BOOL UseRasterFonts; + + WORD ShowWindow; + BOOL AutoPosition; + POINT WindowOrigin; +} GUI_CONSOLE_INFO, *PGUI_CONSOLE_INFO; + +#ifndef CONSOLE_H__ // If we aren't included by console.dll + +typedef struct _GUI_CONSOLE_DATA +{ + CRITICAL_SECTION Lock; + HANDLE hGuiInitEvent; + BOOL WindowSizeLock; + POINT OldCursor; + + HWND hWindow; /* Handle to the console's window */ + HICON hIcon; /* Handle to the console's icon (big) */ + HICON hIconSm; /* Handle to the console's icon (small) */ + // COLORREF Colors[16]; + + // PVOID ScreenBuffer; /* Hardware screen buffer */ + + HFONT Font; + UINT CharWidth; + UINT CharHeight; + + PCONSOLE Console; /* Pointer to the owned console */ + GUI_CONSOLE_INFO GuiInfo; /* GUI terminal settings */ +} GUI_CONSOLE_DATA, *PGUI_CONSOLE_DATA; + +/* FUNCTIONS ******************************************************************/ + +BOOL +GuiConsoleReadUserSettings(IN OUT PGUI_CONSOLE_INFO TermInfo, + IN LPCWSTR ConsoleTitle, + IN DWORD ProcessId); +BOOL +GuiConsoleWriteUserSettings(IN OUT PGUI_CONSOLE_INFO TermInfo, + IN LPCWSTR ConsoleTitle, + IN DWORD ProcessId); +VOID +GuiConsoleGetDefaultSettings(IN OUT PGUI_CONSOLE_INFO TermInfo, + IN DWORD ProcessId); +VOID +GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData, + BOOL Defaults); +NTSTATUS +GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData, + HANDLE hClientSection, + BOOL SaveSettings); + +#endif + +/* EOF */ Index: win32ss/user/consrv/guisettings.h =================================================================== --- win32ss/user/consrv/guisettings.h (rvision 58607) +++ win32ss/user/consrv/guisettings.h (copie de travail) Modification de proprits sur win32ss/user/consrv/guisettings.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/handle.c =================================================================== --- win32ss/user/consrv/handle.c (rvision 0) +++ win32ss/user/consrv/handle.c (copie de travail) @@ -0,0 +1,847 @@ +/* + * LICENSE: GPL - See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/handle.c + * PURPOSE: Console I/O Handles functions + * PROGRAMMERS: + */ + +/* INCLUDES *******************************************************************/ + +#include "consrv.h" +#include "conio.h" + +//#define NDEBUG +#include + + +/* PRIVATE FUNCTIONS **********************************************************/ + +static INT +AdjustHandleCounts(PCONSOLE_IO_HANDLE Entry, INT Change) +{ + Object_t *Object = Entry->Object; + + DPRINT1("AdjustHandleCounts(0x%p, %d), Object = 0x%p, Object->HandleCount = %d, Object->Type = %lu\n", Entry, Change, Object, Object->HandleCount, Object->Type); + + if (Entry->Access & GENERIC_READ) Object->AccessRead += Change; + if (Entry->Access & GENERIC_WRITE) Object->AccessWrite += Change; + if (!(Entry->ShareMode & FILE_SHARE_READ)) Object->ExclusiveRead += Change; + if (!(Entry->ShareMode & FILE_SHARE_WRITE)) Object->ExclusiveWrite += Change; + + Object->HandleCount += Change; + + return Object->HandleCount; +} + +static VOID +ConSrvCreateHandleEntry(PCONSOLE_IO_HANDLE Entry) +{ + /// LOCK /// Object_t *Object = Entry->Object; + /// LOCK /// EnterCriticalSection(&Object->Console->Lock); + AdjustHandleCounts(Entry, +1); + /// LOCK /// LeaveCriticalSection(&Object->Console->Lock); +} + +static VOID +ConSrvCloseHandleEntry(PCONSOLE_IO_HANDLE Entry) +{ + Object_t *Object = Entry->Object; + if (Object != NULL) + { + /// LOCK /// PCONSOLE Console = Object->Console; + /// LOCK /// EnterCriticalSection(&Console->Lock); + + /* + * If this is a input handle, notify and dereference + * all the waits related to this handle. + */ + if (Object->Type == CONIO_INPUT_BUFFER_MAGIC) + { + PCONSOLE_INPUT_BUFFER InputBuffer = (PCONSOLE_INPUT_BUFFER)Object; + + /* + * Wake up all the writing waiters related to this handle for this + * input buffer, if any, then dereference them and purge them all + * from the list. + * To select them amongst all the waiters for this input buffer, + * pass the handle pointer to the waiters, then they will check + * whether or not they are related to this handle and if so, they + * return. + */ + CsrNotifyWait(&InputBuffer->ReadWaitQueue, + WaitAll, + NULL, + (PVOID)Entry); + if (!IsListEmpty(&InputBuffer->ReadWaitQueue)) + { + CsrDereferenceWait(&InputBuffer->ReadWaitQueue); + } + } + + /* If the last handle to a screen buffer is closed, delete it... */ + if (AdjustHandleCounts(Entry, -1) == 0) + { + if (Object->Type == CONIO_SCREEN_BUFFER_MAGIC) + { + PCONSOLE_SCREEN_BUFFER Buffer = (PCONSOLE_SCREEN_BUFFER)Object; + /* ...unless it's the only buffer left. Windows allows deletion + * even of the last buffer, but having to deal with a lack of + * any active buffer might be error-prone. */ + if (Buffer->ListEntry.Flink != Buffer->ListEntry.Blink) + ConioDeleteScreenBuffer(Buffer); + } + else if (Object->Type == CONIO_INPUT_BUFFER_MAGIC) + { + DPRINT1("Closing the input buffer\n"); + } + } + + /// LOCK /// LeaveCriticalSection(&Console->Lock); + Entry->Object = NULL; + } +} + + +/* Forward declaration, used in ConSrvInitHandlesTable */ +static VOID ConSrvFreeHandlesTable(PCONSOLE_PROCESS_DATA ProcessData); + +static NTSTATUS +ConSrvInitHandlesTable(IN OUT PCONSOLE_PROCESS_DATA ProcessData, + OUT PHANDLE pInputHandle, + OUT PHANDLE pOutputHandle, + OUT PHANDLE pErrorHandle) +{ + NTSTATUS Status; + HANDLE InputHandle = INVALID_HANDLE_VALUE, + OutputHandle = INVALID_HANDLE_VALUE, + ErrorHandle = INVALID_HANDLE_VALUE; + + /* + * Initialize the handles table. Use temporary variables to store + * the handles values in such a way that, if we fail, we don't + * return to the caller invalid handle values. + * + * Insert the IO handles. + */ + + RtlEnterCriticalSection(&ProcessData->HandleTableLock); + + /* Insert the Input handle */ + Status = ConSrvInsertObject(ProcessData, + &InputHandle, + &ProcessData->Console->InputBuffer.Header, + GENERIC_READ | GENERIC_WRITE, + TRUE, + FILE_SHARE_READ | FILE_SHARE_WRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to insert the input handle\n"); + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + ConSrvFreeHandlesTable(ProcessData); + return Status; + } + + /* Insert the Output handle */ + Status = ConSrvInsertObject(ProcessData, + &OutputHandle, + &ProcessData->Console->ActiveBuffer->Header, + GENERIC_READ | GENERIC_WRITE, + TRUE, + FILE_SHARE_READ | FILE_SHARE_WRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to insert the output handle\n"); + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + ConSrvFreeHandlesTable(ProcessData); + return Status; + } + + /* Insert the Error handle */ + Status = ConSrvInsertObject(ProcessData, + &ErrorHandle, + &ProcessData->Console->ActiveBuffer->Header, + GENERIC_READ | GENERIC_WRITE, + TRUE, + FILE_SHARE_READ | FILE_SHARE_WRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to insert the error handle\n"); + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + ConSrvFreeHandlesTable(ProcessData); + return Status; + } + + /* Return the newly created handles */ + *pInputHandle = InputHandle; + *pOutputHandle = OutputHandle; + *pErrorHandle = ErrorHandle; + + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return STATUS_SUCCESS; +} + +static NTSTATUS +ConSrvInheritHandlesTable(IN PCONSOLE_PROCESS_DATA SourceProcessData, + IN PCONSOLE_PROCESS_DATA TargetProcessData) +{ + NTSTATUS Status = STATUS_SUCCESS; + ULONG i; + + RtlEnterCriticalSection(&SourceProcessData->HandleTableLock); + + /* Inherit a handles table only if there is no already */ + if (TargetProcessData->HandleTable != NULL /* || TargetProcessData->HandleTableSize != 0 */) + { + Status = STATUS_UNSUCCESSFUL; /* STATUS_INVALID_PARAMETER */ + goto Quit; + } + + /* Allocate a new handle table for the child process */ + TargetProcessData->HandleTable = RtlAllocateHeap(ConSrvHeap, + HEAP_ZERO_MEMORY, + SourceProcessData->HandleTableSize + * sizeof(CONSOLE_IO_HANDLE)); + if (TargetProcessData->HandleTable == NULL) + { + Status = STATUS_NO_MEMORY; + goto Quit; + } + + TargetProcessData->HandleTableSize = SourceProcessData->HandleTableSize; + + /* + * Parse the parent process' handles table and, for each handle, + * do a copy of it and reference it, if the handle is inheritable. + */ + for (i = 0; i < SourceProcessData->HandleTableSize; i++) + { + if (SourceProcessData->HandleTable[i].Object != NULL && + SourceProcessData->HandleTable[i].Inheritable) + { + /* + * Copy the handle data and increment the reference count of the + * pointed object (via the call to ConSrvCreateHandleEntry). + */ + TargetProcessData->HandleTable[i] = SourceProcessData->HandleTable[i]; + ConSrvCreateHandleEntry(&TargetProcessData->HandleTable[i]); + } + } + +Quit: + RtlLeaveCriticalSection(&SourceProcessData->HandleTableLock); + return Status; +} + +static VOID +ConSrvFreeHandlesTable(PCONSOLE_PROCESS_DATA ProcessData) +{ + DPRINT1("ConSrvFreeHandlesTable\n"); + + RtlEnterCriticalSection(&ProcessData->HandleTableLock); + + if (ProcessData->HandleTable != NULL) + { + ULONG i; + + /* Close all console handles and free the handle table memory */ + for (i = 0; i < ProcessData->HandleTableSize; i++) + { + ConSrvCloseHandleEntry(&ProcessData->HandleTable[i]); + } + RtlFreeHeap(ConSrvHeap, 0, ProcessData->HandleTable); + ProcessData->HandleTable = NULL; + } + + ProcessData->HandleTableSize = 0; + + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); +} + +NTSTATUS +FASTCALL +ConSrvInsertObject(PCONSOLE_PROCESS_DATA ProcessData, + PHANDLE Handle, + Object_t *Object, + DWORD Access, + BOOL Inheritable, + DWORD ShareMode) +{ +#define IO_HANDLES_INCREMENT 2*3 + + ULONG i; + PCONSOLE_IO_HANDLE Block; + + RtlEnterCriticalSection(&ProcessData->HandleTableLock); + + for (i = 0; i < ProcessData->HandleTableSize; i++) + { + if (ProcessData->HandleTable[i].Object == NULL) + { + break; + } + } + if (i >= ProcessData->HandleTableSize) + { + Block = RtlAllocateHeap(ConSrvHeap, + HEAP_ZERO_MEMORY, + (ProcessData->HandleTableSize + + IO_HANDLES_INCREMENT) * sizeof(CONSOLE_IO_HANDLE)); + if (Block == NULL) + { + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return STATUS_UNSUCCESSFUL; + } + RtlCopyMemory(Block, + ProcessData->HandleTable, + ProcessData->HandleTableSize * sizeof(CONSOLE_IO_HANDLE)); + RtlFreeHeap(ConSrvHeap, 0, ProcessData->HandleTable); + ProcessData->HandleTable = Block; + ProcessData->HandleTableSize += IO_HANDLES_INCREMENT; + } + + ProcessData->HandleTable[i].Object = Object; + ProcessData->HandleTable[i].Access = Access; + ProcessData->HandleTable[i].Inheritable = Inheritable; + ProcessData->HandleTable[i].ShareMode = ShareMode; + ConSrvCreateHandleEntry(&ProcessData->HandleTable[i]); + *Handle = ULongToHandle((i << 2) | 0x3); + + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + + return STATUS_SUCCESS; +} + +NTSTATUS +FASTCALL +ConSrvRemoveObject(PCONSOLE_PROCESS_DATA ProcessData, + HANDLE Handle) +{ + ULONG_PTR h = (ULONG_PTR)Handle >> 2; + Object_t *Object; + + RtlEnterCriticalSection(&ProcessData->HandleTableLock); + + if (h >= ProcessData->HandleTableSize || + (Object = ProcessData->HandleTable[h].Object) == NULL) + { + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return STATUS_INVALID_HANDLE; + } + + DPRINT1("ConSrvRemoveObject - Process 0x%p, Release 0x%p\n", ProcessData->Process, &ProcessData->HandleTable[h]); + ConSrvCloseHandleEntry(&ProcessData->HandleTable[h]); + + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + + return STATUS_SUCCESS; +} + +NTSTATUS +FASTCALL +ConSrvGetObject(PCONSOLE_PROCESS_DATA ProcessData, + HANDLE Handle, + Object_t** Object, + PCONSOLE_IO_HANDLE* Entry OPTIONAL, + DWORD Access, + BOOL LockConsole, + ULONG Type) +{ + ULONG_PTR h = (ULONG_PTR)Handle >> 2; + PCONSOLE_IO_HANDLE HandleEntry = NULL; + Object_t* ObjectEntry = NULL; + + ASSERT(Object); + if (Entry) *Entry = NULL; + + // DPRINT("ConSrvGetObject, Object: %x, %x, %x\n", + // Object, Handle, ProcessData ? ProcessData->HandleTableSize : 0); + + RtlEnterCriticalSection(&ProcessData->HandleTableLock); + + if ( IsConsoleHandle(Handle) && + h < ProcessData->HandleTableSize ) + { + HandleEntry = &ProcessData->HandleTable[h]; + ObjectEntry = HandleEntry->Object; + } + + if ( HandleEntry == NULL || + ObjectEntry == NULL || + (HandleEntry->Access & Access) == 0 || + (Type != 0 && ObjectEntry->Type != Type) ) + { + DPRINT1("ConSrvGetObject returning invalid handle (%x) of type %lu with access %lu\n", Handle, Type, Access); + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return STATUS_INVALID_HANDLE; + } + + _InterlockedIncrement(&ObjectEntry->Console->ReferenceCount); + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + + if (LockConsole) EnterCriticalSection(&ObjectEntry->Console->Lock); + + /* Return the objects to the caller */ + *Object = ObjectEntry; + if (Entry) *Entry = HandleEntry; + + return STATUS_SUCCESS; +} + +VOID +FASTCALL +ConSrvReleaseObject(Object_t *Object, + BOOL IsConsoleLocked) +{ + ConSrvReleaseConsole(Object->Console, IsConsoleLocked); +} + +NTSTATUS +FASTCALL +ConSrvAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData, + PHANDLE pInputHandle, + PHANDLE pOutputHandle, + PHANDLE pErrorHandle, + PCONSOLE_START_INFO ConsoleStartInfo) +{ + NTSTATUS Status = STATUS_SUCCESS; + + /* Initialize a new Console owned by this process */ + Status = ConSrvInitConsole(&ProcessData->Console, ConsoleStartInfo, ProcessData->Process); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Console initialization failed\n"); + return Status; + } + + /* Initialize the handles table */ + Status = ConSrvInitHandlesTable(ProcessData, + pInputHandle, + pOutputHandle, + pErrorHandle); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to initialize the handles table\n"); + ConSrvDeleteConsole(ProcessData->Console); + ProcessData->Console = NULL; + return Status; + } + + /* Duplicate the Input Event */ + Status = NtDuplicateObject(NtCurrentProcess(), + ProcessData->Console->InputBuffer.ActiveEvent, + ProcessData->Process->ProcessHandle, + &ProcessData->ConsoleEvent, + EVENT_ALL_ACCESS, 0, 0); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtDuplicateObject() failed: %lu\n", Status); + ConSrvFreeHandlesTable(ProcessData); + ConSrvDeleteConsole(ProcessData->Console); + ProcessData->Console = NULL; + return Status; + } + + /* Insert the process into the processes list of the console */ + InsertHeadList(&ProcessData->Console->ProcessList, &ProcessData->ConsoleLink); + + /* Add a reference count because the process is tied to the console */ + _InterlockedIncrement(&ProcessData->Console->ReferenceCount); + + /* Update the internal info of the terminal */ + ConioRefreshInternalInfo(ProcessData->Console); + + return STATUS_SUCCESS; +} + +NTSTATUS +FASTCALL +ConSrvInheritConsole(PCONSOLE_PROCESS_DATA ProcessData, + PCONSOLE Console, + BOOL CreateNewHandlesTable, + PHANDLE pInputHandle, + PHANDLE pOutputHandle, + PHANDLE pErrorHandle) +{ + NTSTATUS Status = STATUS_SUCCESS; + + /* Inherit the console */ + ProcessData->Console = Console; + + if (CreateNewHandlesTable) + { + /* Initialize the handles table */ + Status = ConSrvInitHandlesTable(ProcessData, + pInputHandle, + pOutputHandle, + pErrorHandle); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to initialize the handles table\n"); + ProcessData->Console = NULL; + return Status; + } + } + + /* Duplicate the Input Event */ + Status = NtDuplicateObject(NtCurrentProcess(), + ProcessData->Console->InputBuffer.ActiveEvent, + ProcessData->Process->ProcessHandle, + &ProcessData->ConsoleEvent, + EVENT_ALL_ACCESS, 0, 0); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtDuplicateObject() failed: %lu\n", Status); + ConSrvFreeHandlesTable(ProcessData); // NOTE: Always free the handles table. + ProcessData->Console = NULL; + return Status; + } + + /* Insert the process into the processes list of the console */ + InsertHeadList(&ProcessData->Console->ProcessList, &ProcessData->ConsoleLink); + + /* Add a reference count because the process is tied to the console */ + _InterlockedIncrement(&ProcessData->Console->ReferenceCount); + + /* Update the internal info of the terminal */ + ConioRefreshInternalInfo(ProcessData->Console); + + return STATUS_SUCCESS; +} + +VOID +FASTCALL +ConSrvRemoveConsole(PCONSOLE_PROCESS_DATA ProcessData) +{ + PCONSOLE Console; + + DPRINT1("ConSrvRemoveConsole\n"); + + /* Close all console handles and free the handle table memory */ + ConSrvFreeHandlesTable(ProcessData); + + /* Detach process from console */ + Console = ProcessData->Console; + if (Console != NULL) + { + DPRINT1("ConSrvRemoveConsole - Console->ReferenceCount = %lu - We are going to decrement it !\n", Console->ReferenceCount); + ProcessData->Console = NULL; + + EnterCriticalSection(&Console->Lock); + DPRINT1("ConSrvRemoveConsole - Locking OK\n"); + + /* Remove ourselves from the console's list of processes */ + RemoveEntryList(&ProcessData->ConsoleLink); + + /* Update the internal info of the terminal */ + ConioRefreshInternalInfo(Console); + + /* Release the console */ + ConSrvReleaseConsole(Console, TRUE); + //CloseHandle(ProcessData->ConsoleEvent); + //ProcessData->ConsoleEvent = NULL; + } +} + +NTSTATUS +FASTCALL +ConSrvGetConsole(PCONSOLE_PROCESS_DATA ProcessData, + PCONSOLE* Console, + BOOL LockConsole) +{ + PCONSOLE ProcessConsole; + + RtlEnterCriticalSection(&ProcessData->HandleTableLock); + ProcessConsole = ProcessData->Console; + + if (!ProcessConsole) + { + *Console = NULL; + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return STATUS_INVALID_HANDLE; + } + + InterlockedIncrement(&ProcessConsole->ReferenceCount); + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + + if (LockConsole) EnterCriticalSection(&ProcessConsole->Lock); + + *Console = ProcessConsole; + + return STATUS_SUCCESS; +} + +VOID FASTCALL +ConSrvReleaseConsole(PCONSOLE Console, + BOOL IsConsoleLocked) +{ + if (IsConsoleLocked) LeaveCriticalSection(&Console->Lock); + + /* Decrement reference count */ + if (_InterlockedDecrement(&Console->ReferenceCount) == 0) + ConSrvDeleteConsole(Console); +} + +NTSTATUS +NTAPI +ConSrvNewProcess(PCSR_PROCESS SourceProcess, + PCSR_PROCESS TargetProcess) +{ + /************************************************************************** + * This function is called whenever a new process (GUI or CUI) is created. + * + * Copy the parent's handles table here if both the parent and the child + * processes are CUI. If we must actually create our proper console (and + * thus do not inherit from the console handles of the parent's), then we + * will clean this table in the next ConSrvConnect call. Why we are doing + * this? It's because here, we still don't know whether or not we must create + * a new console instead of inherit it from the parent, and, because in + * ConSrvConnect we don't have any reference to the parent process anymore. + **************************************************************************/ + + PCONSOLE_PROCESS_DATA SourceProcessData, TargetProcessData; + + /* An empty target process is invalid */ + if (!TargetProcess) return STATUS_INVALID_PARAMETER; + + TargetProcessData = ConsoleGetPerProcessData(TargetProcess); + + /**** HACK !!!! ****/ RtlZeroMemory(TargetProcessData, sizeof(*TargetProcessData)); + + /* Initialize the new (target) process */ + TargetProcessData->Process = TargetProcess; + TargetProcessData->ConsoleEvent = NULL; + TargetProcessData->Console = TargetProcessData->ParentConsole = NULL; + TargetProcessData->ConsoleApp = ((TargetProcess->Flags & CsrProcessIsConsoleApp) ? TRUE : FALSE); + + // Testing + TargetProcessData->HandleTableSize = 0; + TargetProcessData->HandleTable = NULL; + + RtlInitializeCriticalSection(&TargetProcessData->HandleTableLock); + + /* Do nothing if the source process is NULL */ + if (!SourceProcess) return STATUS_SUCCESS; + + SourceProcessData = ConsoleGetPerProcessData(SourceProcess); + + /* + * If both of the processes (parent and new child) are console applications, + * then try to inherit handles from the parent process. + */ + if ( SourceProcessData->Console != NULL && /* SourceProcessData->ConsoleApp */ + TargetProcessData->ConsoleApp ) + { + NTSTATUS Status; + + Status = ConSrvInheritHandlesTable(SourceProcessData, TargetProcessData); + if (!NT_SUCCESS(Status)) return Status; + + /* Temporary save the parent's console */ + TargetProcessData->ParentConsole = SourceProcessData->Console; + } + + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +ConSrvConnect(IN PCSR_PROCESS CsrProcess, + IN OUT PVOID ConnectionInfo, + IN OUT PULONG ConnectionInfoLength) +{ + /************************************************************************** + * This function is called whenever a CUI new process is created. + **************************************************************************/ + + NTSTATUS Status = STATUS_SUCCESS; + PCONSOLE_CONNECTION_INFO ConnectInfo = (PCONSOLE_CONNECTION_INFO)ConnectionInfo; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrProcess); + + if ( ConnectionInfo == NULL || + ConnectionInfoLength == NULL || + *ConnectionInfoLength != sizeof(CONSOLE_CONNECTION_INFO) ) + { + DPRINT1("CONSRV: Connection failed\n"); + return STATUS_UNSUCCESSFUL; + } + + /* If we don't need a console, then get out of here */ + if (!ConnectInfo->ConsoleNeeded || !ProcessData->ConsoleApp) // In fact, it is for GUI apps. + { + return STATUS_SUCCESS; + } + + /* If we don't have a console, then create a new one... */ + if (!ConnectInfo->Console || + ConnectInfo->Console != ProcessData->ParentConsole) + { + DPRINT1("ConSrvConnect - Allocate a new console\n"); + + /* + * We are about to create a new console. However when ConSrvNewProcess + * was called, we didn't know that we wanted to create a new console and + * therefore, we by default inherited the handles table from our parent + * process. It's only now that we notice that in fact we do not need + * them, because we've created a new console and thus we must use it. + * + * Therefore, free the console we can have and our handles table, + * and recreate a new one later on. + */ + ConSrvRemoveConsole(ProcessData); + + /* Initialize a new Console owned by the Console Leader Process */ + Status = ConSrvAllocateConsole(ProcessData, + &ConnectInfo->InputHandle, + &ConnectInfo->OutputHandle, + &ConnectInfo->ErrorHandle, + &ConnectInfo->ConsoleStartInfo); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Console allocation failed\n"); + return Status; + } + } + else /* We inherit it from the parent */ + { + DPRINT1("ConSrvConnect - Reuse current (parent's) console\n"); + + /* Reuse our current console */ + Status = ConSrvInheritConsole(ProcessData, + ConnectInfo->Console, + FALSE, + NULL, // &ConnectInfo->InputHandle, + NULL, // &ConnectInfo->OutputHandle, + NULL); // &ConnectInfo->ErrorHandle); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Console inheritance failed\n"); + return Status; + } + } + + /* Return it to the caller */ + ConnectInfo->Console = ProcessData->Console; + + /* Input Wait Handle */ + ConnectInfo->InputWaitHandle = ProcessData->ConsoleEvent; + + /* Set the Property Dialog Handler */ + ProcessData->PropDispatcher = ConnectInfo->PropDispatcher; + + /* Set the Ctrl Dispatcher */ + ProcessData->CtrlDispatcher = ConnectInfo->CtrlDispatcher; + + return STATUS_SUCCESS; +} + +VOID +NTAPI +ConSrvDisconnect(PCSR_PROCESS Process) +{ + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(Process); + + /************************************************************************** + * This function is called whenever a new process (GUI or CUI) is destroyed. + **************************************************************************/ + + DPRINT1("ConSrvDisconnect\n"); + + if ( ProcessData->Console != NULL || + ProcessData->HandleTable != NULL ) + { + DPRINT1("ConSrvDisconnect - calling ConSrvRemoveConsole\n"); + ConSrvRemoveConsole(ProcessData); + } + + RtlDeleteCriticalSection(&ProcessData->HandleTableLock); +} + + +/* PUBLIC SERVER APIS *********************************************************/ + +CSR_API(SrvCloseHandle) +{ + PCONSOLE_CLOSEHANDLE CloseHandleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CloseHandleRequest; + + return ConSrvRemoveObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + CloseHandleRequest->ConsoleHandle); +} + +CSR_API(SrvVerifyConsoleIoHandle) +{ + NTSTATUS Status = STATUS_SUCCESS; + PCONSOLE_VERIFYHANDLE VerifyHandleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.VerifyHandleRequest; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + HANDLE ConsoleHandle = VerifyHandleRequest->ConsoleHandle; + ULONG_PTR Index = (ULONG_PTR)ConsoleHandle >> 2; + + RtlEnterCriticalSection(&ProcessData->HandleTableLock); + + if (!IsConsoleHandle(ConsoleHandle) || + Index >= ProcessData->HandleTableSize || + ProcessData->HandleTable[Index].Object == NULL) + { + DPRINT("SrvVerifyConsoleIoHandle failed\n"); + Status = STATUS_INVALID_HANDLE; + } + + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + + return Status; +} + +CSR_API(SrvDuplicateHandle) +{ + PCONSOLE_IO_HANDLE Entry; + DWORD DesiredAccess; + PCONSOLE_DUPLICATEHANDLE DuplicateHandleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.DuplicateHandleRequest; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + HANDLE ConsoleHandle = DuplicateHandleRequest->ConsoleHandle; + ULONG_PTR Index = (ULONG_PTR)ConsoleHandle >> 2; + + RtlEnterCriticalSection(&ProcessData->HandleTableLock); + + if ( /** !IsConsoleHandle(ConsoleHandle) || **/ + Index >= ProcessData->HandleTableSize || + (Entry = &ProcessData->HandleTable[Index])->Object == NULL) + { + DPRINT1("Couldn't duplicate invalid handle %p\n", ConsoleHandle); + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return STATUS_INVALID_HANDLE; + } + + if (DuplicateHandleRequest->Options & DUPLICATE_SAME_ACCESS) + { + DesiredAccess = Entry->Access; + } + else + { + DesiredAccess = DuplicateHandleRequest->Access; + /* Make sure the source handle has all the desired flags */ + if ((Entry->Access & DesiredAccess) == 0) + { + DPRINT1("Handle %p only has access %X; requested %X\n", + ConsoleHandle, Entry->Access, DesiredAccess); + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return STATUS_INVALID_PARAMETER; + } + } + + ApiMessage->Status = ConSrvInsertObject(ProcessData, + &DuplicateHandleRequest->ConsoleHandle, // Use the new handle value! + Entry->Object, + DesiredAccess, + DuplicateHandleRequest->Inheritable, + Entry->ShareMode); + if (NT_SUCCESS(ApiMessage->Status) && + DuplicateHandleRequest->Options & DUPLICATE_CLOSE_SOURCE) + { + ConSrvCloseHandleEntry(Entry); + } + + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return ApiMessage->Status; +} + +/* EOF */ Index: win32ss/user/consrv/handle.c =================================================================== --- win32ss/user/consrv/handle.c (rvision 58607) +++ win32ss/user/consrv/handle.c (copie de travail) Modification de proprits sur win32ss/user/consrv/handle.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/init.c =================================================================== --- win32ss/user/consrv/init.c (rvision 0) +++ win32ss/user/consrv/init.c (copie de travail) @@ -0,0 +1,340 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/init.c + * PURPOSE: Initialization + * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr) + */ + +/* INCLUDES *******************************************************************/ + +#include "consrv.h" +#include "conio.h" + +#define NDEBUG +#include + +/* GLOBALS ********************************************************************/ + +HINSTANCE ConSrvDllInstance = NULL; + +/* Memory */ +HANDLE ConSrvHeap = NULL; // Our own heap. + +// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3 +// plus a little bit of Windows 7. +PCSR_API_ROUTINE ConsoleServerApiDispatchTable[ConsolepMaxApiNumber - CONSRV_FIRST_API_NUMBER] = +{ + SrvOpenConsole, + SrvGetConsoleInput, + SrvWriteConsoleInput, + SrvReadConsoleOutput, + SrvWriteConsoleOutput, + SrvReadConsoleOutputString, + SrvWriteConsoleOutputString, + SrvFillConsoleOutput, + SrvGetConsoleMode, + // SrvGetConsoleNumberOfFonts, + SrvGetConsoleNumberOfInputEvents, + SrvGetConsoleScreenBufferInfo, + SrvGetConsoleCursorInfo, + // SrvGetConsoleMouseInfo, + // SrvGetConsoleFontInfo, + // SrvGetConsoleFontSize, + // SrvGetConsoleCurrentFont, + SrvSetConsoleMode, + SrvSetConsoleActiveScreenBuffer, + SrvFlushConsoleInputBuffer, + // SrvGetLargestConsoleWindowSize, + SrvSetConsoleScreenBufferSize, + SrvSetConsoleCursorPosition, + SrvSetConsoleCursorInfo, + // SrvSetConsoleWindowInfo, + SrvScrollConsoleScreenBuffer, + SrvSetConsoleTextAttribute, + // SrvSetConsoleFont, + SrvSetConsoleIcon, + SrvReadConsole, + SrvWriteConsole, + SrvDuplicateHandle, + // SrvGetHandleInformation, + // SrvSetHandleInformation, + SrvCloseHandle, + SrvVerifyConsoleIoHandle, + SrvAllocConsole, + SrvFreeConsole, + SrvGetConsoleTitle, + SrvSetConsoleTitle, + SrvCreateConsoleScreenBuffer, + // SrvInvalidateBitMapRect, + // SrvVDMConsoleOperation, + // SrvSetConsoleCursor, + // SrvShowConsoleCursor, + // SrvConsoleMenuControl, + // SrvSetConsolePalette, + // SrvSetConsoleDisplayMode, + // SrvRegisterConsoleVDM, + SrvGetConsoleHardwareState, + SrvSetConsoleHardwareState, + // SrvGetConsoleDisplayMode, + SrvAddConsoleAlias, + SrvGetConsoleAlias, + SrvGetConsoleAliasesLength, + SrvGetConsoleAliasExesLength, + SrvGetConsoleAliases, + SrvGetConsoleAliasExes, + SrvExpungeConsoleCommandHistory, + SrvSetConsoleNumberOfCommands, + SrvGetConsoleCommandHistoryLength, + SrvGetConsoleCommandHistory, + // SrvSetConsoleCommandHistoryMode, + SrvGetConsoleCP, + SrvSetConsoleCP, + // SrvSetConsoleKeyShortcuts, + // SrvSetConsoleMenuClose, + // SrvConsoleNotifyLastClose, + SrvGenerateConsoleCtrlEvent, + // SrvGetConsoleKeyboardLayoutName, + SrvGetConsoleWindow, + // SrvGetConsoleCharType, + // SrvSetConsoleLocalEUDC, + // SrvSetConsoleCursorMode, + // SrvGetConsoleCursorMode, + // SrvRegisterConsoleOS2, + // SrvSetConsoleOS2OemFormat, + // SrvGetConsoleNlsMode, + // SrvSetConsoleNlsMode, + // SrvRegisterConsoleIME, + // SrvUnregisterConsoleIME, + // SrvGetConsoleLangId, + SrvAttachConsole, + SrvGetConsoleSelectionInfo, + SrvGetConsoleProcessList, + SrvGetConsoleHistory, + SrvSetConsoleHistory, +}; + +BOOLEAN ConsoleServerApiServerValidTable[ConsolepMaxApiNumber - CONSRV_FIRST_API_NUMBER] = +{ + FALSE, // SrvOpenConsole, + FALSE, // SrvGetConsoleInput, + FALSE, // SrvWriteConsoleInput, + FALSE, // SrvReadConsoleOutput, + FALSE, // SrvWriteConsoleOutput, + FALSE, // SrvReadConsoleOutputString, + FALSE, // SrvWriteConsoleOutputString, + FALSE, // SrvFillConsoleOutput, + FALSE, // SrvGetConsoleMode, + // FALSE, // SrvGetConsoleNumberOfFonts, + FALSE, // SrvGetConsoleNumberOfInputEvents, + FALSE, // SrvGetConsoleScreenBufferInfo, + FALSE, // SrvGetConsoleCursorInfo, + // FALSE, // SrvGetConsoleMouseInfo, + // FALSE, // SrvGetConsoleFontInfo, + // FALSE, // SrvGetConsoleFontSize, + // FALSE, // SrvGetConsoleCurrentFont, + FALSE, // SrvSetConsoleMode, + FALSE, // SrvSetConsoleActiveScreenBuffer, + FALSE, // SrvFlushConsoleInputBuffer, + // FALSE, // SrvGetLargestConsoleWindowSize, + FALSE, // SrvSetConsoleScreenBufferSize, + FALSE, // SrvSetConsoleCursorPosition, + FALSE, // SrvSetConsoleCursorInfo, + // FALSE, // SrvSetConsoleWindowInfo, + FALSE, // SrvScrollConsoleScreenBuffer, + FALSE, // SrvSetConsoleTextAttribute, + // FALSE, // SrvSetConsoleFont, + FALSE, // SrvSetConsoleIcon, + FALSE, // SrvReadConsole, + FALSE, // SrvWriteConsole, + FALSE, // SrvDuplicateHandle, + // FALSE, // SrvGetHandleInformation, + // FALSE, // SrvSetHandleInformation, + FALSE, // SrvCloseHandle, + FALSE, // SrvVerifyConsoleIoHandle, + FALSE, // SrvAllocConsole, + FALSE, // SrvFreeConsole, + FALSE, // SrvGetConsoleTitle, + FALSE, // SrvSetConsoleTitle, + FALSE, // SrvCreateConsoleScreenBuffer, + // FALSE, // SrvInvalidateBitMapRect, + // FALSE, // SrvVDMConsoleOperation, + // FALSE, // SrvSetConsoleCursor, + // FALSE, // SrvShowConsoleCursor, + // FALSE, // SrvConsoleMenuControl, + // FALSE, // SrvSetConsolePalette, + // FALSE, // SrvSetConsoleDisplayMode, + // FALSE, // SrvRegisterConsoleVDM, + FALSE, // SrvGetConsoleHardwareState, + FALSE, // SrvSetConsoleHardwareState, + // TRUE, // SrvGetConsoleDisplayMode, + FALSE, // SrvAddConsoleAlias, + FALSE, // SrvGetConsoleAlias, + FALSE, // SrvGetConsoleAliasesLength, + FALSE, // SrvGetConsoleAliasExesLength, + FALSE, // SrvGetConsoleAliases, + FALSE, // SrvGetConsoleAliasExes, + FALSE, // SrvExpungeConsoleCommandHistory, + FALSE, // SrvSetConsoleNumberOfCommands, + FALSE, // SrvGetConsoleCommandHistoryLength, + FALSE, // SrvGetConsoleCommandHistory, + // FALSE, // SrvSetConsoleCommandHistoryMode, + FALSE, // SrvGetConsoleCP, + FALSE, // SrvSetConsoleCP, + // FALSE, // SrvSetConsoleKeyShortcuts, + // FALSE, // SrvSetConsoleMenuClose, + // FALSE, // SrvConsoleNotifyLastClose, + FALSE, // SrvGenerateConsoleCtrlEvent, + // FALSE, // SrvGetConsoleKeyboardLayoutName, + FALSE, // SrvGetConsoleWindow, + // FALSE, // SrvGetConsoleCharType, + // FALSE, // SrvSetConsoleLocalEUDC, + // FALSE, // SrvSetConsoleCursorMode, + // FALSE, // SrvGetConsoleCursorMode, + // FALSE, // SrvRegisterConsoleOS2, + // FALSE, // SrvSetConsoleOS2OemFormat, + // FALSE, // SrvGetConsoleNlsMode, + // FALSE, // SrvSetConsoleNlsMode, + // FALSE, // SrvRegisterConsoleIME, + // FALSE, // SrvUnregisterConsoleIME, + // FALSE, // SrvGetConsoleLangId, + FALSE, // SrvAttachConsole, + FALSE, // SrvGetConsoleSelectionInfo, + FALSE, // SrvGetConsoleProcessList, + FALSE, // SrvGetConsoleHistory, + FALSE, // SrvSetConsoleHistory +}; + +PCHAR ConsoleServerApiNameTable[ConsolepMaxApiNumber - CONSRV_FIRST_API_NUMBER] = +{ + "OpenConsole", + "GetConsoleInput", + "WriteConsoleInput", + "ReadConsoleOutput", + "WriteConsoleOutput", + "ReadConsoleOutputString", + "WriteConsoleOutputString", + "FillConsoleOutput", + "GetConsoleMode", + // "GetConsoleNumberOfFonts", + "GetConsoleNumberOfInputEvents", + "GetConsoleScreenBufferInfo", + "GetConsoleCursorInfo", + // "GetConsoleMouseInfo", + // "GetConsoleFontInfo", + // "GetConsoleFontSize", + // "GetConsoleCurrentFont", + "SetConsoleMode", + "SetConsoleActiveScreenBuffer", + "FlushConsoleInputBuffer", + // "GetLargestConsoleWindowSize", + "SetConsoleScreenBufferSize", + "SetConsoleCursorPosition", + "SetConsoleCursorInfo", + // "SetConsoleWindowInfo", + "ScrollConsoleScreenBuffer", + "SetConsoleTextAttribute", + // "SetConsoleFont", + "SetConsoleIcon", + "ReadConsole", + "WriteConsole", + "DuplicateHandle", + // "GetHandleInformation", + // "SetHandleInformation", + "CloseHandle", + "VerifyConsoleIoHandle", + "AllocConsole", + "FreeConsole", + "GetConsoleTitle", + "SetConsoleTitle", + "CreateConsoleScreenBuffer", + // "InvalidateBitMapRect", + // "VDMConsoleOperation", + // "SetConsoleCursor", + // "ShowConsoleCursor", + // "ConsoleMenuControl", + // "SetConsolePalette", + // "SetConsoleDisplayMode", + // "RegisterConsoleVDM", + "GetConsoleHardwareState", + "SetConsoleHardwareState", + // "GetConsoleDisplayMode", + "AddConsoleAlias", + "GetConsoleAlias", + "GetConsoleAliasesLength", + "GetConsoleAliasExesLength", + "GetConsoleAliases", + "GetConsoleAliasExes", + "ExpungeConsoleCommandHistory", + "SetConsoleNumberOfCommands", + "GetConsoleCommandHistoryLength", + "GetConsoleCommandHistory", + // "SetConsoleCommandHistoryMode", + "GetConsoleCP", + "SetConsoleCP", + // "SetConsoleKeyShortcuts", + // "SetConsoleMenuClose", + // "ConsoleNotifyLastClose", + "GenerateConsoleCtrlEvent", + // "GetConsoleKeyboardLayoutName", + "GetConsoleWindow", + // "GetConsoleCharType", + // "SetConsoleLocalEUDC", + // "SetConsoleCursorMode", + // "GetConsoleCursorMode", + // "RegisterConsoleOS2", + // "SetConsoleOS2OemFormat", + // "GetConsoleNlsMode", + // "SetConsoleNlsMode", + // "RegisterConsoleIME", + // "UnregisterConsoleIME", + // "GetConsoleLangId", + "AttachConsole", + "GetConsoleSelectionInfo", + "GetConsoleProcessList", + "GetConsoleHistory", + "SetConsoleHistory", +}; + + +/* FUNCTIONS ******************************************************************/ + +CSR_SERVER_DLL_INIT(ConServerDllInitialization) +{ + /* Initialize the memory */ + ConSrvHeap = RtlGetProcessHeap(); + + ConSrvInitConsoleSupport(); + + /* Setup the DLL Object */ + LoadedServerDll->ApiBase = CONSRV_FIRST_API_NUMBER; + LoadedServerDll->HighestApiSupported = ConsolepMaxApiNumber; + LoadedServerDll->DispatchTable = ConsoleServerApiDispatchTable; + LoadedServerDll->ValidTable = ConsoleServerApiServerValidTable; + LoadedServerDll->NameTable = ConsoleServerApiNameTable; + LoadedServerDll->SizeOfProcessData = sizeof(CONSOLE_PROCESS_DATA); + LoadedServerDll->ConnectCallback = ConSrvConnect; + LoadedServerDll->DisconnectCallback = ConSrvDisconnect; + LoadedServerDll->NewProcessCallback = ConSrvNewProcess; + // LoadedServerDll->HardErrorCallback = ConSrvHardError; + LoadedServerDll->ShutdownProcessCallback = NULL; + + ConSrvDllInstance = LoadedServerDll->ServerHandle; + + /* All done */ + return STATUS_SUCCESS; +} + +BOOL +WINAPI +DllMain(IN HINSTANCE hInstanceDll, + IN DWORD dwReason, + IN LPVOID lpReserved) +{ + UNREFERENCED_PARAMETER(hInstanceDll); + UNREFERENCED_PARAMETER(dwReason); + UNREFERENCED_PARAMETER(lpReserved); + return TRUE; +} + +/* EOF */ Index: win32ss/user/consrv/init.c =================================================================== --- win32ss/user/consrv/init.c (rvision 58607) +++ win32ss/user/consrv/init.c (copie de travail) Modification de proprits sur win32ss/user/consrv/init.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/bg-BG.rc =================================================================== --- win32ss/user/consrv/lang/bg-BG.rc (rvision 0) +++ win32ss/user/consrv/lang/bg-BG.rc (copie de travail) @@ -0,0 +1,29 @@ +/* + * PROJECT: ReactOS CSRSS subsystem + * FILE: win32ss/user/consrv/lang/bg-BG.rc + * PURPOSE: Bulgarian resource file + */ + +LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_EDIT "Обработка" + IDS_MARK "Отбелязване" + IDS_COPY "Запомняне\tEnter" + IDS_PASTE "Поставяне" + IDS_SELECTALL "Избор на всичко" + IDS_SCROLL "Прелистване" + IDS_FIND "Търсене..." + IDS_DEFAULTS "Подразбирани" + IDS_PROPERTIES "Свойства" + IDS_SCROLLHERE "Прелистване тук" + IDS_SCROLLTOP "Прелистване до горе" + IDS_SCROLLBOTTOM "Прелистване до долу" + IDS_SCROLLPAGE_UP "Горна страница" + IDS_SCROLLPAGE_DOWN "Долна страница" + IDS_SCROLLUP "Прелистване нагоре" + IDS_SCROLLDOWN "Прелистване надолу" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/bg-BG.rc =================================================================== --- win32ss/user/consrv/lang/bg-BG.rc (rvision 58607) +++ win32ss/user/consrv/lang/bg-BG.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/bg-BG.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/cs-CZ.rc =================================================================== --- win32ss/user/consrv/lang/cs-CZ.rc (rvision 0) +++ win32ss/user/consrv/lang/cs-CZ.rc (copie de travail) @@ -0,0 +1,29 @@ +/* + * FILE: win32ss/user/consrv/lang/cs-CZ.rc + * TRANSLATOR: Radek Liska aka Black_Fox (radekliska at gmail dot com) + * UPDATED: 2011-04-09 + */ + +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_EDIT "Upravit" + IDS_MARK "Označit" + IDS_COPY "Kopírovat\tEnter" + IDS_PASTE "Vložit" + IDS_SELECTALL "Označit vše" + IDS_SCROLL "Posunout" + IDS_FIND "Najít..." + IDS_DEFAULTS "Výchozí" + IDS_PROPERTIES "Vlastnosti" + IDS_SCROLLHERE "Posunout sem" + IDS_SCROLLTOP "Posunout na začátek" + IDS_SCROLLBOTTOM "Posunout na konec" + IDS_SCROLLPAGE_UP "O stránku výše" + IDS_SCROLLPAGE_DOWN "O stránku níže" + IDS_SCROLLUP "Posunout nahoru" + IDS_SCROLLDOWN "Posunout dolů" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/cs-CZ.rc =================================================================== --- win32ss/user/consrv/lang/cs-CZ.rc (rvision 58607) +++ win32ss/user/consrv/lang/cs-CZ.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/cs-CZ.rc ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/de-DE.rc =================================================================== --- win32ss/user/consrv/lang/de-DE.rc (rvision 0) +++ win32ss/user/consrv/lang/de-DE.rc (copie de travail) @@ -0,0 +1,23 @@ +LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL + +STRINGTABLE +BEGIN + IDS_EDIT "Bearbeiten" + IDS_MARK "Markieren" + IDS_COPY "Kopieren\tEnter" + IDS_PASTE "Einfügen" + IDS_SELECTALL "Alles auswählen" + IDS_SCROLL "Scrollen" + IDS_FIND "Suchen..." + IDS_DEFAULTS "Standardwerte" + IDS_PROPERTIES "Eigenschaften" + IDS_SCROLLHERE "Hier scrollen" + IDS_SCROLLTOP "Ganz nach oben scrollen" + IDS_SCROLLBOTTOM "Ganz nach unten scrollen" + IDS_SCROLLPAGE_UP "Seite nach oben" + IDS_SCROLLPAGE_DOWN "Seite nach unten" + IDS_SCROLLUP "Nach oben scrollen" + IDS_SCROLLDOWN "Nach unten scrollen" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/de-DE.rc =================================================================== --- win32ss/user/consrv/lang/de-DE.rc (rvision 58607) +++ win32ss/user/consrv/lang/de-DE.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/de-DE.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/el-GR.rc =================================================================== --- win32ss/user/consrv/lang/el-GR.rc (rvision 0) +++ win32ss/user/consrv/lang/el-GR.rc (copie de travail) @@ -0,0 +1,23 @@ +LANGUAGE LANG_GREEK, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_EDIT "Επεξεργασία" + IDS_MARK "Μαρκάρισμα" + IDS_COPY "Αντιγραφή\tEnter" + IDS_PASTE "Επικόλληση" + IDS_SELECTALL "Επιλογή όλων" + IDS_SCROLL "Κύλιση" + IDS_FIND "Εύρεση..." + IDS_DEFAULTS "Προεπιλογή" + IDS_PROPERTIES "Ιδιότητες" + IDS_SCROLLHERE "Κύλιση εδώ" + IDS_SCROLLTOP "Αρχή" + IDS_SCROLLBOTTOM "Τέλος" + IDS_SCROLLPAGE_UP "Προηγούμενη σελίδα" + IDS_SCROLLPAGE_DOWN "Επόμενη σελίδα" + IDS_SCROLLUP "Κύλιση πάνω" + IDS_SCROLLDOWN "Κύλιση κάτω" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/el-GR.rc =================================================================== --- win32ss/user/consrv/lang/el-GR.rc (rvision 58607) +++ win32ss/user/consrv/lang/el-GR.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/el-GR.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/en-US.rc =================================================================== --- win32ss/user/consrv/lang/en-US.rc (rvision 0) +++ win32ss/user/consrv/lang/en-US.rc (copie de travail) @@ -0,0 +1,23 @@ +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +STRINGTABLE +BEGIN + IDS_EDIT "Edit" + IDS_MARK "Mark" + IDS_COPY "Copy\tEnter" + IDS_PASTE "Paste" + IDS_SELECTALL "Select All" + IDS_SCROLL "Scroll" + IDS_FIND "Find..." + IDS_DEFAULTS "Defaults" + IDS_PROPERTIES "Properties" + IDS_SCROLLHERE "Scroll here" + IDS_SCROLLTOP "Scroll top" + IDS_SCROLLBOTTOM "Scroll bottom" + IDS_SCROLLPAGE_UP "Page up" + IDS_SCROLLPAGE_DOWN "Page down" + IDS_SCROLLUP "Scroll up" + IDS_SCROLLDOWN "Scroll down" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/en-US.rc =================================================================== --- win32ss/user/consrv/lang/en-US.rc (rvision 58607) +++ win32ss/user/consrv/lang/en-US.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/en-US.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/es-ES.rc =================================================================== --- win32ss/user/consrv/lang/es-ES.rc (rvision 0) +++ win32ss/user/consrv/lang/es-ES.rc (copie de travail) @@ -0,0 +1,28 @@ +/* + * Spanish Language resource file + * Traducido por: Javier Remacha 2008-26-01 + */ + +LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL + +STRINGTABLE +BEGIN + IDS_EDIT "Editar" + IDS_MARK "Marcar" + IDS_COPY "Copiar\tIntroducir" + IDS_PASTE "Pegar" + IDS_SELECTALL "Seleccionar Todo" + IDS_SCROLL "Desplazar" + IDS_FIND "Buscar..." + IDS_DEFAULTS "Por defecto" + IDS_PROPERTIES "Propiedades" + IDS_SCROLLHERE "Desplazar aquí" + IDS_SCROLLTOP "Desplazar hasta arriba" + IDS_SCROLLBOTTOM "Desplazar hasta abajo" + IDS_SCROLLPAGE_UP "Subir página" + IDS_SCROLLPAGE_DOWN "Bajar página" + IDS_SCROLLUP "Desplazar arriba" + IDS_SCROLLDOWN "Desplazar abajo" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/es-ES.rc =================================================================== --- win32ss/user/consrv/lang/es-ES.rc (rvision 58607) +++ win32ss/user/consrv/lang/es-ES.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/es-ES.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/fr-FR.rc =================================================================== --- win32ss/user/consrv/lang/fr-FR.rc (rvision 0) +++ win32ss/user/consrv/lang/fr-FR.rc (copie de travail) @@ -0,0 +1,25 @@ +LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL + +/* Fixme : Translation could be really improved, with context + La traduction pourrait réellement être améliorée grâce au contexte */ +STRINGTABLE +BEGIN + IDS_EDIT "Éditer" + IDS_MARK "Marquer" + IDS_COPY "Copier\tEntrée" + IDS_PASTE "Coller" + IDS_SELECTALL "Tout sélectionner" + IDS_SCROLL "Défiler" + IDS_FIND "Trouver..." + IDS_DEFAULTS "Défauts" + IDS_PROPERTIES "Propriétés" + IDS_SCROLLHERE "Défiler ici" + IDS_SCROLLTOP "Défiler tout en haut" + IDS_SCROLLBOTTOM "Défiler tout en bas" + IDS_SCROLLPAGE_UP "Page précédente" + IDS_SCROLLPAGE_DOWN "Page suivante" + IDS_SCROLLUP "Défiler en haut" + IDS_SCROLLDOWN "Défiler en bas" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/fr-FR.rc =================================================================== --- win32ss/user/consrv/lang/fr-FR.rc (rvision 58607) +++ win32ss/user/consrv/lang/fr-FR.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/fr-FR.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/he-IL.rc =================================================================== --- win32ss/user/consrv/lang/he-IL.rc (rvision 0) +++ win32ss/user/consrv/lang/he-IL.rc (copie de travail) @@ -0,0 +1,23 @@ +LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_EDIT "ערוך" + IDS_MARK "סמן" + IDS_COPY "העתק\tEnter" + IDS_PASTE "הדבק" + IDS_SELECTALL "בחר הכל" + IDS_SCROLL "גלול" + IDS_FIND "מצא..." + IDS_DEFAULTS "ברירת מחדל" + IDS_PROPERTIES "מאפיינים" + IDS_SCROLLHERE "גלול לכאן" + IDS_SCROLLTOP "גלול למעלה" + IDS_SCROLLBOTTOM "גלול למטה" + IDS_SCROLLPAGE_UP "עמוד מעלה" + IDS_SCROLLPAGE_DOWN "עמוד מטה" + IDS_SCROLLUP "גלול מעלה" + IDS_SCROLLDOWN "גלול מטה" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/he-IL.rc =================================================================== --- win32ss/user/consrv/lang/he-IL.rc (rvision 58607) +++ win32ss/user/consrv/lang/he-IL.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/he-IL.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/id-ID.rc =================================================================== --- win32ss/user/consrv/lang/id-ID.rc (rvision 0) +++ win32ss/user/consrv/lang/id-ID.rc (copie de travail) @@ -0,0 +1,23 @@ +LANGUAGE LANG_INDONESIAN, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_EDIT "Edit" + IDS_MARK "Tandai" + IDS_COPY "Copy\tEnter" + IDS_PASTE "Paste" + IDS_SELECTALL "Pilih Semua" + IDS_SCROLL "Gulung" + IDS_FIND "Cari..." + IDS_DEFAULTS "Standar" + IDS_PROPERTIES "Properti" + IDS_SCROLLHERE "Gulung ke Sini" + IDS_SCROLLTOP "Gulung ke Atas" + IDS_SCROLLBOTTOM "Gulung ke Bawah" + IDS_SCROLLPAGE_UP "Halaman Naik" + IDS_SCROLLPAGE_DOWN "Halaman Turun" + IDS_SCROLLUP "Gulung Naik" + IDS_SCROLLDOWN "Gulung Turun" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/id-ID.rc =================================================================== --- win32ss/user/consrv/lang/id-ID.rc (rvision 58607) +++ win32ss/user/consrv/lang/id-ID.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/id-ID.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/it-IT.rc =================================================================== --- win32ss/user/consrv/lang/it-IT.rc (rvision 0) +++ win32ss/user/consrv/lang/it-IT.rc (copie de travail) @@ -0,0 +1,32 @@ +/* +* PROJECT: ReactOS Client/Server Runtime subsystem +* LICENSE: GPL - See COPYING in the top level directory +* FILE: win32ss/user/consrv/lang/it-IT.rc +* PURPOSE: Italian Translation +* PROGRAMMERS: +* Copyright (C) 2007 Daniele Forsi (dforsi at gmail.com) Italian Translation +*/ + +LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL + +STRINGTABLE +BEGIN + IDS_EDIT "Modifica" + IDS_MARK "Seleziona" + IDS_COPY "Copia\tInvio" + IDS_PASTE "Incolla" + IDS_SELECTALL "Seleziona tutto" + IDS_SCROLL "Scorri" + IDS_FIND "Trova..." + IDS_DEFAULTS "Impostazioni predefinite" + IDS_PROPERTIES "Proprietà" + IDS_SCROLLHERE "Scorri qui" + IDS_SCROLLTOP "Scorri in cima" + IDS_SCROLLBOTTOM "Scorri in fondo" + IDS_SCROLLPAGE_UP "Pagina sù" + IDS_SCROLLPAGE_DOWN "Pagina giù" + IDS_SCROLLUP "Scorri sù" + IDS_SCROLLDOWN "Scorri giù" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/it-IT.rc =================================================================== --- win32ss/user/consrv/lang/it-IT.rc (rvision 58607) +++ win32ss/user/consrv/lang/it-IT.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/it-IT.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/ja-JP.rc =================================================================== --- win32ss/user/consrv/lang/ja-JP.rc (rvision 0) +++ win32ss/user/consrv/lang/ja-JP.rc (copie de travail) @@ -0,0 +1,23 @@ +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_EDIT "編集" + IDS_MARK "範囲指定" + IDS_COPY "コピー\tEnter" + IDS_PASTE "貼り付け" + IDS_SELECTALL "すべて選択" + IDS_SCROLL "スクロール" + IDS_FIND "検索..." + IDS_DEFAULTS "規定値" + IDS_PROPERTIES "プロパティ" + IDS_SCROLLHERE "ここにスクロール" + IDS_SCROLLTOP "一番上にスクロール" + IDS_SCROLLBOTTOM "一番下にスクロール" + IDS_SCROLLPAGE_UP "Page up" + IDS_SCROLLPAGE_DOWN "Page down" + IDS_SCROLLUP "上にスクロール" + IDS_SCROLLDOWN "下にスクロール" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/ja-JP.rc =================================================================== --- win32ss/user/consrv/lang/ja-JP.rc (rvision 58607) +++ win32ss/user/consrv/lang/ja-JP.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/ja-JP.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/no-NO.rc =================================================================== --- win32ss/user/consrv/lang/no-NO.rc (rvision 0) +++ win32ss/user/consrv/lang/no-NO.rc (copie de travail) @@ -0,0 +1,23 @@ +LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL + +STRINGTABLE +BEGIN + IDS_EDIT "Rediger" + IDS_MARK "Merk" + IDS_COPY "Kopier\tEnter" + IDS_PASTE "Lim inn" + IDS_SELECTALL "Velg alt" + IDS_SCROLL "Rull" + IDS_FIND "Finn..." + IDS_DEFAULTS "Standard" + IDS_PROPERTIES "Egenskaper" + IDS_SCROLLHERE "Rull her" + IDS_SCROLLTOP "Rull til toppen" + IDS_SCROLLBOTTOM "Rull knapp" + IDS_SCROLLPAGE_UP "Side opp" + IDS_SCROLLPAGE_DOWN "Side ned" + IDS_SCROLLUP "Rull opp" + IDS_SCROLLDOWN "Rull ned" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/no-NO.rc =================================================================== --- win32ss/user/consrv/lang/no-NO.rc (rvision 58607) +++ win32ss/user/consrv/lang/no-NO.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/no-NO.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/pl-PL.rc =================================================================== --- win32ss/user/consrv/lang/pl-PL.rc (rvision 0) +++ win32ss/user/consrv/lang/pl-PL.rc (copie de travail) @@ -0,0 +1,31 @@ +/* + * translated by xrogers + * xxrogers@users.sourceforge.net + * https://sourceforge.net/projects/reactospl + * translation update by Olaf Siejka (Caemyr), Apr 2011 + * UTF-8 conversion by Caemyr (May, 2011) + */ + +LANGUAGE LANG_POLISH, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_EDIT "Edytuj" + IDS_MARK "Zaznacz" + IDS_COPY "Kopiuj\tWejdź" + IDS_PASTE "Wklej" + IDS_SELECTALL "Zaznacz wszystko" + IDS_SCROLL "Przewiń" + IDS_FIND "Znajdź..." + IDS_DEFAULTS "Ustawienia domyślne" + IDS_PROPERTIES "Właściwości" + IDS_SCROLLHERE "Przewiń tutaj" + IDS_SCROLLTOP "Przewiń na początek" + IDS_SCROLLBOTTOM "Przewiń na koniec" + IDS_SCROLLPAGE_UP "Poprzednia strona" + IDS_SCROLLPAGE_DOWN "Następna strona" + IDS_SCROLLUP "Przewiń do góry" + IDS_SCROLLDOWN "Przewiń na dół" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/pl-PL.rc =================================================================== --- win32ss/user/consrv/lang/pl-PL.rc (rvision 58607) +++ win32ss/user/consrv/lang/pl-PL.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/pl-PL.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/pt-BR.rc =================================================================== --- win32ss/user/consrv/lang/pt-BR.rc (rvision 0) +++ win32ss/user/consrv/lang/pt-BR.rc (copie de travail) @@ -0,0 +1,25 @@ +/* Translation and UTF-8 Conversion by mkbu95 (May, 2012) */ + +LANGUAGE LANG_PORTUGUESE, SUBLANG_NEUTRAL + +STRINGTABLE +BEGIN + IDS_EDIT "Editar" + IDS_MARK "Marcar" + IDS_COPY "Copiar\tEnter" + IDS_PASTE "Colar" + IDS_SELECTALL "Selecionar Tudo" + IDS_SCROLL "Rolar" + IDS_FIND "Procurar..." + IDS_DEFAULTS "Padrões" + IDS_PROPERTIES "Propriedades" + IDS_SCROLLHERE "Rolar aqui" + IDS_SCROLLTOP "Rolar até o topo" + IDS_SCROLLBOTTOM "Rolar até o fim" + IDS_SCROLLPAGE_UP "Page up" + IDS_SCROLLPAGE_DOWN "Page down" + IDS_SCROLLUP "Scroll up" + IDS_SCROLLDOWN "Scroll down" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/pt-BR.rc =================================================================== --- win32ss/user/consrv/lang/pt-BR.rc (rvision 58607) +++ win32ss/user/consrv/lang/pt-BR.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/pt-BR.rc ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/ro-RO.rc =================================================================== --- win32ss/user/consrv/lang/ro-RO.rc (rvision 0) +++ win32ss/user/consrv/lang/ro-RO.rc (copie de travail) @@ -0,0 +1,30 @@ +/* + * FILE: win32ss/user/consrv/lang/ro-RO.rc + * ReactOS Project (http://www.reactos.org) + * TRANSLATOR: Fulea Ștefan (PM on ReactOS Forum at fulea.stefan) + * CHANGE LOG: 2011-10-16 initial translation + */ + +LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL + +STRINGTABLE +BEGIN + IDS_EDIT "Editare" + IDS_MARK "Marchează" + IDS_COPY "Copiază\tEnter" + IDS_PASTE "Lipește" + IDS_SELECTALL "Selectează tot" + IDS_SCROLL "Derulează" + IDS_FIND "Găsire…" + IDS_DEFAULTS "Implicite" + IDS_PROPERTIES "Proprietăți" + IDS_SCROLLHERE "Derulează aici" + IDS_SCROLLTOP "Derulează la început" + IDS_SCROLLBOTTOM "Derulează la sfârșit" + IDS_SCROLLPAGE_UP "Pagina anterioară" + IDS_SCROLLPAGE_DOWN "Pagina următoare" + IDS_SCROLLUP "Derulează în sus" + IDS_SCROLLDOWN "Derulează în jos" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/ro-RO.rc =================================================================== --- win32ss/user/consrv/lang/ro-RO.rc (rvision 58607) +++ win32ss/user/consrv/lang/ro-RO.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/ro-RO.rc ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/ru-RU.rc =================================================================== --- win32ss/user/consrv/lang/ru-RU.rc (rvision 0) +++ win32ss/user/consrv/lang/ru-RU.rc (copie de travail) @@ -0,0 +1,23 @@ +LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_EDIT "Изменить" + IDS_MARK "Пометить" + IDS_COPY "Копировать\tEnter" + IDS_PASTE "Вставить" + IDS_SELECTALL "Выделить все" + IDS_SCROLL "Прокрутить" + IDS_FIND "Искать..." + IDS_DEFAULTS "Умолчания" + IDS_PROPERTIES "Свойства" + IDS_SCROLLHERE "Scroll Here" + IDS_SCROLLTOP "Scroll Top" + IDS_SCROLLBOTTOM "Прокрутить вниз" + IDS_SCROLLPAGE_UP "Вверх страницы" + IDS_SCROLLPAGE_DOWN "Вниз страницы" + IDS_SCROLLUP "Прокрутить вверх" + IDS_SCROLLDOWN "Scroll Down" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/ru-RU.rc =================================================================== --- win32ss/user/consrv/lang/ru-RU.rc (rvision 58607) +++ win32ss/user/consrv/lang/ru-RU.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/ru-RU.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/sk-SK.rc =================================================================== --- win32ss/user/consrv/lang/sk-SK.rc (rvision 0) +++ win32ss/user/consrv/lang/sk-SK.rc (copie de travail) @@ -0,0 +1,28 @@ +/* TRANSLATOR: Mário Kačmár /Mario Kacmar/ aka Kario (kario@szm.sk) + * DATE OF TR: 29-05-2008 + * LastChange: 12-04-2011 + */ + +LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_EDIT "Upraviť" + IDS_MARK "Označiť" + IDS_COPY "Kopírovať\tEnter" + IDS_PASTE "Vložiť" + IDS_SELECTALL "Vybrať všetko" + IDS_SCROLL "Rolovať" + IDS_FIND "Nájsť..." // Find + IDS_DEFAULTS "Predvolené" // Defaults + IDS_PROPERTIES "Vlastnosti" + IDS_SCROLLHERE "Rolovať sem" + IDS_SCROLLTOP "K hornému okraju" + IDS_SCROLLBOTTOM "K dolnému okraju" + IDS_SCROLLPAGE_UP "O stránku vyššie" + IDS_SCROLLPAGE_DOWN "O stránku nižšie" + IDS_SCROLLUP "Rolovať nahor" + IDS_SCROLLDOWN "Rolovať nadol" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/sk-SK.rc =================================================================== --- win32ss/user/consrv/lang/sk-SK.rc (rvision 58607) +++ win32ss/user/consrv/lang/sk-SK.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/sk-SK.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/sv-SE.rc =================================================================== --- win32ss/user/consrv/lang/sv-SE.rc (rvision 0) +++ win32ss/user/consrv/lang/sv-SE.rc (copie de travail) @@ -0,0 +1,30 @@ +/* + * PROJECT: ReactOS CSRSS subsystem + * FILE: win32ss/user/consrv/lang/sv-SE.rc + * PURPOSE: Swedish resource file + * Translation: Jaix Bly + */ + +LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL + +STRINGTABLE +BEGIN + IDS_EDIT "Redigera" + IDS_MARK "Markera" + IDS_COPY "Kopiera\tEnter" + IDS_PASTE "Klistra in" + IDS_SELECTALL "Markera Allt" + IDS_SCROLL "Skrolla" + IDS_FIND "Sök..." + IDS_DEFAULTS "Ursprunglig" + IDS_PROPERTIES "Egenskaper" + IDS_SCROLLHERE "Skrolla hit" + IDS_SCROLLTOP "Skrolla till topp" + IDS_SCROLLBOTTOM "Skrolla till botten" + IDS_SCROLLPAGE_UP "Sida upp" + IDS_SCROLLPAGE_DOWN "Sida ner" + IDS_SCROLLUP "Skrolla upp" + IDS_SCROLLDOWN "Skrolla ner" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/sv-SE.rc =================================================================== --- win32ss/user/consrv/lang/sv-SE.rc (rvision 58607) +++ win32ss/user/consrv/lang/sv-SE.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/sv-SE.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/tr-TR.rc =================================================================== --- win32ss/user/consrv/lang/tr-TR.rc (rvision 0) +++ win32ss/user/consrv/lang/tr-TR.rc (copie de travail) @@ -0,0 +1,43 @@ +/* + * Turkish resources + * + * Copyright 2012 Arda Tanrikulu + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_EDIT "Düzenle" + IDS_MARK "İşaretle" + IDS_COPY "Kopyala\tEnter" + IDS_PASTE "Yapıştır" + IDS_SELECTALL "Tümünü Seç" + IDS_SCROLL "Yuvarla" + IDS_FIND "Bul..." + IDS_DEFAULTS "Varsayılanlar" + IDS_PROPERTIES "Özellikler" + IDS_SCROLLHERE "Buraya yuvarla" + IDS_SCROLLTOP "Üste yuvarla" + IDS_SCROLLBOTTOM "Alta yuvarla" + IDS_SCROLLPAGE_UP "Sayfa yukarı" + IDS_SCROLLPAGE_DOWN "Sayfa aşağı" + IDS_SCROLLUP "Yukarı yuvarla" + IDS_SCROLLDOWN "Aşağı yuvarla" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/tr-TR.rc =================================================================== --- win32ss/user/consrv/lang/tr-TR.rc (rvision 58607) +++ win32ss/user/consrv/lang/tr-TR.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/tr-TR.rc ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/uk-UA.rc =================================================================== --- win32ss/user/consrv/lang/uk-UA.rc (rvision 0) +++ win32ss/user/consrv/lang/uk-UA.rc (copie de travail) @@ -0,0 +1,31 @@ +/* + * PROJECT: ReactOS CSRSS subsystem + * LICENSE: GPL - See COPYING in the top level directory + * FILE: win32ss/user/consrv/lang/uk-UA.rc + * PURPOSE: Ukraianian resource file + * TRANSLATOR: Artem Reznikov + */ + +LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_EDIT "Редагувати" + IDS_MARK "Виділити" + IDS_COPY "Копіювати\tEnter" + IDS_PASTE "Вставити" + IDS_SELECTALL "Виділити все" + IDS_SCROLL "Прокрутити" + IDS_FIND "Знайти..." + IDS_DEFAULTS "Замовчування" + IDS_PROPERTIES "Властивості" + IDS_SCROLLHERE "Прокрутити сюди" + IDS_SCROLLTOP "Прокрутити на початок" + IDS_SCROLLBOTTOM "Прокрутити на кінець" + IDS_SCROLLPAGE_UP "Попередня сотрінка" + IDS_SCROLLPAGE_DOWN "Наступна сторінка" + IDS_SCROLLUP "Прокрутити догори" + IDS_SCROLLDOWN "Прокрутити донизу" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/uk-UA.rc =================================================================== --- win32ss/user/consrv/lang/uk-UA.rc (rvision 58607) +++ win32ss/user/consrv/lang/uk-UA.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/uk-UA.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/zh-CN.rc =================================================================== --- win32ss/user/consrv/lang/zh-CN.rc (rvision 0) +++ win32ss/user/consrv/lang/zh-CN.rc (copie de travail) @@ -0,0 +1,23 @@ +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +STRINGTABLE +BEGIN + IDS_EDIT "编辑" + IDS_MARK "标记" + IDS_COPY "复制\tEnter" + IDS_PASTE "黏贴" + IDS_SELECTALL "全部选择" + IDS_SCROLL "滚动" + IDS_FIND "查找..." + IDS_DEFAULTS "默认" + IDS_PROPERTIES "属性" + IDS_SCROLLHERE "滚动到此" + IDS_SCROLLTOP "滚动至顶端" + IDS_SCROLLBOTTOM "滚动至末端" + IDS_SCROLLPAGE_UP "上一页" + IDS_SCROLLPAGE_DOWN "下一页" + IDS_SCROLLUP "向上滚动" + IDS_SCROLLDOWN "向下滚动" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/zh-CN.rc =================================================================== --- win32ss/user/consrv/lang/zh-CN.rc (rvision 58607) +++ win32ss/user/consrv/lang/zh-CN.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/zh-CN.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lang/zh-TW.rc =================================================================== --- win32ss/user/consrv/lang/zh-TW.rc (rvision 0) +++ win32ss/user/consrv/lang/zh-TW.rc (copie de travail) @@ -0,0 +1,23 @@ +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL + +STRINGTABLE +BEGIN + IDS_EDIT "編輯" + IDS_MARK "標記" + IDS_COPY "複製\tEnter" + IDS_PASTE "黏貼" + IDS_SELECTALL "全部選擇" + IDS_SCROLL "滾動" + IDS_FIND "尋找..." + IDS_DEFAULTS "預設" + IDS_PROPERTIES "屬性" + IDS_SCROLLHERE "滾動到此 " + IDS_SCROLLTOP "滾動到頂置" + IDS_SCROLLBOTTOM "滾動到末端" + IDS_SCROLLPAGE_UP "上一頁" + IDS_SCROLLPAGE_DOWN "下一頁" + IDS_SCROLLUP "向上滾動" + IDS_SCROLLDOWN "向下滾動" + + IDS_CONSOLE_TITLE "ReactOS Console" +END Index: win32ss/user/consrv/lang/zh-TW.rc =================================================================== --- win32ss/user/consrv/lang/zh-TW.rc (rvision 58607) +++ win32ss/user/consrv/lang/zh-TW.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/lang/zh-TW.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/lineinput.c =================================================================== --- win32ss/user/consrv/lineinput.c (rvision 0) +++ win32ss/user/consrv/lineinput.c (copie de travail) @@ -0,0 +1,621 @@ +/* + * LICENSE: GPL - See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/lineinput.c + * PURPOSE: Console line input functions + * PROGRAMMERS: Jeffrey Morlan + */ + +/* INCLUDES *******************************************************************/ + +#include "consrv.h" +#include "conio.h" + +#define NDEBUG +#include + +typedef struct _HISTORY_BUFFER +{ + LIST_ENTRY ListEntry; + UINT Position; + UINT MaxEntries; + UINT NumEntries; + PUNICODE_STRING Entries; + UNICODE_STRING ExeName; +} HISTORY_BUFFER, *PHISTORY_BUFFER; + + +/* PRIVATE FUNCTIONS **********************************************************/ + +static PHISTORY_BUFFER +HistoryCurrentBuffer(PCONSOLE Console) +{ + /* TODO: use actual EXE name sent from process that called ReadConsole */ + UNICODE_STRING ExeName = { 14, 14, L"cmd.exe" }; + PLIST_ENTRY Entry = Console->HistoryBuffers.Flink; + PHISTORY_BUFFER Hist; + + for (; Entry != &Console->HistoryBuffers; Entry = Entry->Flink) + { + Hist = CONTAINING_RECORD(Entry, HISTORY_BUFFER, ListEntry); + if (RtlEqualUnicodeString(&ExeName, &Hist->ExeName, FALSE)) + return Hist; + } + + /* Couldn't find the buffer, create a new one */ + Hist = RtlAllocateHeap(ConSrvHeap, 0, sizeof(HISTORY_BUFFER) + ExeName.Length); + if (!Hist) + return NULL; + Hist->MaxEntries = Console->HistoryBufferSize; + Hist->NumEntries = 0; + Hist->Entries = RtlAllocateHeap(ConSrvHeap, 0, Hist->MaxEntries * sizeof(UNICODE_STRING)); + if (!Hist->Entries) + { + RtlFreeHeap(ConSrvHeap, 0, Hist); + return NULL; + } + Hist->ExeName.Length = Hist->ExeName.MaximumLength = ExeName.Length; + Hist->ExeName.Buffer = (PWCHAR)(Hist + 1); + memcpy(Hist->ExeName.Buffer, ExeName.Buffer, ExeName.Length); + InsertHeadList(&Console->HistoryBuffers, &Hist->ListEntry); + return Hist; +} + +static VOID +HistoryAddEntry(PCONSOLE Console) +{ + UNICODE_STRING NewEntry; + PHISTORY_BUFFER Hist; + INT i; + + NewEntry.Length = NewEntry.MaximumLength = Console->LineSize * sizeof(WCHAR); + NewEntry.Buffer = Console->LineBuffer; + + if (!(Hist = HistoryCurrentBuffer(Console))) + return; + + /* Don't add blank or duplicate entries */ + if (NewEntry.Length == 0 || Hist->MaxEntries == 0 || + (Hist->NumEntries > 0 && + RtlEqualUnicodeString(&Hist->Entries[Hist->NumEntries - 1], &NewEntry, FALSE))) + { + return; + } + + if (Console->HistoryNoDup) + { + /* Check if this line has been entered before */ + for (i = Hist->NumEntries - 1; i >= 0; i--) + { + if (RtlEqualUnicodeString(&Hist->Entries[i], &NewEntry, FALSE)) + { + /* Just rotate the list to bring this entry to the end */ + NewEntry = Hist->Entries[i]; + memmove(&Hist->Entries[i], &Hist->Entries[i + 1], + (Hist->NumEntries - (i + 1)) * sizeof(UNICODE_STRING)); + Hist->Entries[Hist->NumEntries - 1] = NewEntry; + Hist->Position = Hist->NumEntries - 1; + return; + } + } + } + + if (Hist->NumEntries == Hist->MaxEntries) + { + /* List is full, remove oldest entry */ + RtlFreeUnicodeString(&Hist->Entries[0]); + memmove(&Hist->Entries[0], &Hist->Entries[1], + --Hist->NumEntries * sizeof(UNICODE_STRING)); + } + + if (NT_SUCCESS(RtlDuplicateUnicodeString(0, &NewEntry, &Hist->Entries[Hist->NumEntries]))) + Hist->NumEntries++; + Hist->Position = Hist->NumEntries - 1; +} + +static VOID +HistoryGetCurrentEntry(PCONSOLE Console, PUNICODE_STRING Entry) +{ + PHISTORY_BUFFER Hist; + if (!(Hist = HistoryCurrentBuffer(Console)) || Hist->NumEntries == 0) + Entry->Length = 0; + else + *Entry = Hist->Entries[Hist->Position]; +} + +static PHISTORY_BUFFER +HistoryFindBuffer(PCONSOLE Console, PUNICODE_STRING ExeName) +{ + PLIST_ENTRY Entry = Console->HistoryBuffers.Flink; + while (Entry != &Console->HistoryBuffers) + { + /* For the history APIs, the caller is allowed to give only part of the name */ + PHISTORY_BUFFER Hist = CONTAINING_RECORD(Entry, HISTORY_BUFFER, ListEntry); + if (RtlPrefixUnicodeString(ExeName, &Hist->ExeName, TRUE)) + return Hist; + Entry = Entry->Flink; + } + return NULL; +} + +VOID FASTCALL +HistoryDeleteBuffer(PHISTORY_BUFFER Hist) +{ + if (!Hist) return; + + while (Hist->NumEntries != 0) + RtlFreeUnicodeString(&Hist->Entries[--Hist->NumEntries]); + + RtlFreeHeap(ConSrvHeap, 0, Hist->Entries); + RemoveEntryList(&Hist->ListEntry); + RtlFreeHeap(ConSrvHeap, 0, Hist); +} + +static VOID +LineInputSetPos(PCONSOLE Console, UINT Pos) +{ + if (Pos != Console->LinePos && Console->InputBuffer.Mode & ENABLE_ECHO_INPUT) + { + PCONSOLE_SCREEN_BUFFER Buffer = Console->ActiveBuffer; + UINT OldCursorX = Buffer->CursorPosition.X; + UINT OldCursorY = Buffer->CursorPosition.Y; + INT XY = OldCursorY * Buffer->ScreenBufferSize.X + OldCursorX; + + XY += (Pos - Console->LinePos); + if (XY < 0) + XY = 0; + else if (XY >= Buffer->ScreenBufferSize.Y * Buffer->ScreenBufferSize.X) + XY = Buffer->ScreenBufferSize.Y * Buffer->ScreenBufferSize.X - 1; + + Buffer->CursorPosition.X = XY % Buffer->ScreenBufferSize.X; + Buffer->CursorPosition.Y = XY / Buffer->ScreenBufferSize.X; + ConioSetScreenInfo(Console, Buffer, OldCursorX, OldCursorY); + } + + Console->LinePos = Pos; +} + +static VOID +LineInputEdit(PCONSOLE Console, UINT NumToDelete, UINT NumToInsert, WCHAR *Insertion) +{ + UINT Pos = Console->LinePos; + UINT NewSize = Console->LineSize - NumToDelete + NumToInsert; + INT i; + + /* Make sure there's always enough room for ending \r\n */ + if (NewSize + 2 > Console->LineMaxSize) + return; + + memmove(&Console->LineBuffer[Pos + NumToInsert], + &Console->LineBuffer[Pos + NumToDelete], + (Console->LineSize - (Pos + NumToDelete)) * sizeof(WCHAR)); + memcpy(&Console->LineBuffer[Pos], Insertion, NumToInsert * sizeof(WCHAR)); + + if (Console->InputBuffer.Mode & ENABLE_ECHO_INPUT) + { + for (i = Pos; i < NewSize; i++) + { + CHAR AsciiChar; + WideCharToMultiByte(Console->OutputCodePage, 0, + &Console->LineBuffer[i], 1, + &AsciiChar, 1, NULL, NULL); + ConioWriteConsole(Console, Console->ActiveBuffer, &AsciiChar, 1, TRUE); + } + for (; i < Console->LineSize; i++) + { + ConioWriteConsole(Console, Console->ActiveBuffer, " ", 1, TRUE); + } + Console->LinePos = i; + } + + Console->LineSize = NewSize; + LineInputSetPos(Console, Pos + NumToInsert); +} + +static VOID +LineInputRecallHistory(PCONSOLE Console, INT Offset) +{ + PHISTORY_BUFFER Hist; + + if (!(Hist = HistoryCurrentBuffer(Console)) || Hist->NumEntries == 0) + return; + + Offset += Hist->Position; + Offset = max(Offset, 0); + Offset = min(Offset, Hist->NumEntries - 1); + Hist->Position = Offset; + + LineInputSetPos(Console, 0); + LineInputEdit(Console, Console->LineSize, + Hist->Entries[Offset].Length / sizeof(WCHAR), + Hist->Entries[Offset].Buffer); +} + +VOID FASTCALL +LineInputKeyDown(PCONSOLE Console, KEY_EVENT_RECORD *KeyEvent) +{ + UINT Pos = Console->LinePos; + PHISTORY_BUFFER Hist; + UNICODE_STRING Entry; + INT HistPos; + + switch (KeyEvent->wVirtualKeyCode) + { + case VK_ESCAPE: + /* Clear entire line */ + LineInputSetPos(Console, 0); + LineInputEdit(Console, Console->LineSize, 0, NULL); + return; + case VK_HOME: + /* Move to start of line. With ctrl, erase everything left of cursor */ + LineInputSetPos(Console, 0); + if (KeyEvent->dwControlKeyState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) + LineInputEdit(Console, Pos, 0, NULL); + return; + case VK_END: + /* Move to end of line. With ctrl, erase everything right of cursor */ + if (KeyEvent->dwControlKeyState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) + LineInputEdit(Console, Console->LineSize - Pos, 0, NULL); + else + LineInputSetPos(Console, Console->LineSize); + return; + case VK_LEFT: + /* Move left. With ctrl, move to beginning of previous word */ + if (KeyEvent->dwControlKeyState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) + { + while (Pos > 0 && Console->LineBuffer[Pos - 1] == L' ') Pos--; + while (Pos > 0 && Console->LineBuffer[Pos - 1] != L' ') Pos--; + } + else + { + Pos -= (Pos > 0); + } + LineInputSetPos(Console, Pos); + return; + case VK_RIGHT: + case VK_F1: + /* Move right. With ctrl, move to beginning of next word */ + if (KeyEvent->dwControlKeyState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) + { + while (Pos < Console->LineSize && Console->LineBuffer[Pos] != L' ') Pos++; + while (Pos < Console->LineSize && Console->LineBuffer[Pos] == L' ') Pos++; + LineInputSetPos(Console, Pos); + return; + } + else + { + /* Recall one character (but don't overwrite current line) */ + HistoryGetCurrentEntry(Console, &Entry); + if (Pos < Console->LineSize) + LineInputSetPos(Console, Pos + 1); + else if (Pos * sizeof(WCHAR) < Entry.Length) + LineInputEdit(Console, 0, 1, &Entry.Buffer[Pos]); + } + return; + case VK_INSERT: + /* Toggle between insert and overstrike */ + Console->LineInsertToggle = !Console->LineInsertToggle; + ConioSetCursorInfo(Console, Console->ActiveBuffer); + return; + case VK_DELETE: + /* Remove character to right of cursor */ + if (Pos != Console->LineSize) + LineInputEdit(Console, 1, 0, NULL); + return; + case VK_PRIOR: + /* Recall first history entry */ + LineInputRecallHistory(Console, -((WORD)-1)); + return; + case VK_NEXT: + /* Recall last history entry */ + LineInputRecallHistory(Console, +((WORD)-1)); + return; + case VK_UP: + case VK_F5: + /* Recall previous history entry. On first time, actually recall the + * current (usually last) entry; on subsequent times go back. */ + LineInputRecallHistory(Console, Console->LineUpPressed ? -1 : 0); + Console->LineUpPressed = TRUE; + return; + case VK_DOWN: + /* Recall next history entry */ + LineInputRecallHistory(Console, +1); + return; + case VK_F3: + /* Recall remainder of current history entry */ + HistoryGetCurrentEntry(Console, &Entry); + if (Pos * sizeof(WCHAR) < Entry.Length) + { + UINT InsertSize = (Entry.Length / sizeof(WCHAR) - Pos); + UINT DeleteSize = min(Console->LineSize - Pos, InsertSize); + LineInputEdit(Console, DeleteSize, InsertSize, &Entry.Buffer[Pos]); + } + return; + case VK_F6: + /* Insert a ^Z character */ + KeyEvent->uChar.UnicodeChar = 26; + break; + case VK_F7: + if (KeyEvent->dwControlKeyState & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)) + HistoryDeleteBuffer(HistoryCurrentBuffer(Console)); + return; + case VK_F8: + /* Search for history entries starting with input. */ + if (!(Hist = HistoryCurrentBuffer(Console)) || Hist->NumEntries == 0) + return; + + /* Like Up/F5, on first time start from current (usually last) entry, + * but on subsequent times start at previous entry. */ + if (Console->LineUpPressed) + Hist->Position = (Hist->Position ? Hist->Position : Hist->NumEntries) - 1; + Console->LineUpPressed = TRUE; + + Entry.Length = Console->LinePos * sizeof(WCHAR); + Entry.Buffer = Console->LineBuffer; + + /* Keep going backwards, even wrapping around to the end, + * until we get back to starting point */ + HistPos = Hist->Position; + do + { + if (RtlPrefixUnicodeString(&Entry, &Hist->Entries[HistPos], FALSE)) + { + Hist->Position = HistPos; + LineInputEdit(Console, Console->LineSize - Pos, + Hist->Entries[HistPos].Length / sizeof(WCHAR) - Pos, + &Hist->Entries[HistPos].Buffer[Pos]); + /* Cursor stays where it was */ + LineInputSetPos(Console, Pos); + return; + } + if (--HistPos < 0) HistPos += Hist->NumEntries; + } while (HistPos != Hist->Position); + return; + } + + if (KeyEvent->uChar.UnicodeChar == L'\b' && Console->InputBuffer.Mode & ENABLE_PROCESSED_INPUT) + { + /* backspace handling - if processed input enabled then we handle it here + * otherwise we treat it like a normal char. */ + if (Pos > 0) + { + LineInputSetPos(Console, Pos - 1); + LineInputEdit(Console, 1, 0, NULL); + } + } + else if (KeyEvent->uChar.UnicodeChar == L'\r') + { + HistoryAddEntry(Console); + + /* TODO: Expand aliases */ + + LineInputSetPos(Console, Console->LineSize); + Console->LineBuffer[Console->LineSize++] = L'\r'; + if (Console->InputBuffer.Mode & ENABLE_ECHO_INPUT) + ConioWriteConsole(Console, Console->ActiveBuffer, "\r", 1, TRUE); + + /* Add \n if processed input. There should usually be room for it, + * but an exception to the rule exists: the buffer could have been + * pre-filled with LineMaxSize - 1 characters. */ + if (Console->InputBuffer.Mode & ENABLE_PROCESSED_INPUT && + Console->LineSize < Console->LineMaxSize) + { + Console->LineBuffer[Console->LineSize++] = L'\n'; + if (Console->InputBuffer.Mode & ENABLE_ECHO_INPUT) + ConioWriteConsole(Console, Console->ActiveBuffer, "\n", 1, TRUE); + } + Console->LineComplete = TRUE; + Console->LinePos = 0; + } + else if (KeyEvent->uChar.UnicodeChar != L'\0') + { + if (KeyEvent->uChar.UnicodeChar < 0x20 && + Console->LineWakeupMask & (1 << KeyEvent->uChar.UnicodeChar)) + { + /* Control key client wants to handle itself (e.g. for tab completion) */ + Console->LineBuffer[Console->LineSize++] = L' '; + Console->LineBuffer[Console->LinePos] = KeyEvent->uChar.UnicodeChar; + Console->LineComplete = TRUE; + Console->LinePos = 0; + } + else + { + /* Normal character */ + BOOL Overstrike = Console->LineInsertToggle && Console->LinePos != Console->LineSize; + LineInputEdit(Console, Overstrike, 1, &KeyEvent->uChar.UnicodeChar); + } + } +} + + +/* PUBLIC SERVER APIS *********************************************************/ + +CSR_API(SrvGetConsoleCommandHistoryLength) +{ + PCONSOLE_GETCOMMANDHISTORYLENGTH GetCommandHistoryLengthRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetCommandHistoryLengthRequest; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + PCONSOLE Console; + NTSTATUS Status; + PHISTORY_BUFFER Hist; + ULONG Length = 0; + INT i; + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&GetCommandHistoryLengthRequest->ExeName.Buffer, + GetCommandHistoryLengthRequest->ExeName.Length, + sizeof(BYTE))) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetConsole(ProcessData, &Console, TRUE); + if (NT_SUCCESS(Status)) + { + Hist = HistoryFindBuffer(Console, &GetCommandHistoryLengthRequest->ExeName); + if (Hist) + { + for (i = 0; i < Hist->NumEntries; i++) + Length += Hist->Entries[i].Length + sizeof(WCHAR); + } + GetCommandHistoryLengthRequest->Length = Length; + ConSrvReleaseConsole(Console, TRUE); + } + return Status; +} + +CSR_API(SrvGetConsoleCommandHistory) +{ + PCONSOLE_GETCOMMANDHISTORY GetCommandHistoryRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetCommandHistoryRequest; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + PCONSOLE Console; + NTSTATUS Status; + PHISTORY_BUFFER Hist; + PBYTE Buffer = (PBYTE)GetCommandHistoryRequest->History; + ULONG BufferSize = GetCommandHistoryRequest->Length; + INT i; + + if ( !CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&GetCommandHistoryRequest->History, + GetCommandHistoryRequest->Length, + sizeof(BYTE)) || + !CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&GetCommandHistoryRequest->ExeName.Buffer, + GetCommandHistoryRequest->ExeName.Length, + sizeof(BYTE)) ) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetConsole(ProcessData, &Console, TRUE); + if (NT_SUCCESS(Status)) + { + Hist = HistoryFindBuffer(Console, &GetCommandHistoryRequest->ExeName); + if (Hist) + { + for (i = 0; i < Hist->NumEntries; i++) + { + if (BufferSize < (Hist->Entries[i].Length + sizeof(WCHAR))) + { + Status = STATUS_BUFFER_OVERFLOW; + break; + } + memcpy(Buffer, Hist->Entries[i].Buffer, Hist->Entries[i].Length); + Buffer += Hist->Entries[i].Length; + *(PWCHAR)Buffer = L'\0'; + Buffer += sizeof(WCHAR); + } + } + GetCommandHistoryRequest->Length = Buffer - (PBYTE)GetCommandHistoryRequest->History; + ConSrvReleaseConsole(Console, TRUE); + } + return Status; +} + +CSR_API(SrvExpungeConsoleCommandHistory) +{ + PCONSOLE_EXPUNGECOMMANDHISTORY ExpungeCommandHistoryRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ExpungeCommandHistoryRequest; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + PCONSOLE Console; + PHISTORY_BUFFER Hist; + NTSTATUS Status; + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&ExpungeCommandHistoryRequest->ExeName.Buffer, + ExpungeCommandHistoryRequest->ExeName.Length, + sizeof(BYTE))) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetConsole(ProcessData, &Console, TRUE); + if (NT_SUCCESS(Status)) + { + Hist = HistoryFindBuffer(Console, &ExpungeCommandHistoryRequest->ExeName); + HistoryDeleteBuffer(Hist); + ConSrvReleaseConsole(Console, TRUE); + } + return Status; +} + +CSR_API(SrvSetConsoleNumberOfCommands) +{ + PCONSOLE_SETHISTORYNUMBERCOMMANDS SetHistoryNumberCommandsRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetHistoryNumberCommandsRequest; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + PCONSOLE Console; + PHISTORY_BUFFER Hist; + NTSTATUS Status; + UINT MaxEntries = SetHistoryNumberCommandsRequest->NumCommands; + PUNICODE_STRING OldEntryList, NewEntryList; + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&SetHistoryNumberCommandsRequest->ExeName.Buffer, + SetHistoryNumberCommandsRequest->ExeName.Length, + sizeof(BYTE))) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetConsole(ProcessData, &Console, TRUE); + if (NT_SUCCESS(Status)) + { + Hist = HistoryFindBuffer(Console, &SetHistoryNumberCommandsRequest->ExeName); + if (Hist) + { + OldEntryList = Hist->Entries; + NewEntryList = RtlAllocateHeap(ConSrvHeap, 0, + MaxEntries * sizeof(UNICODE_STRING)); + if (!NewEntryList) + { + Status = STATUS_NO_MEMORY; + } + else + { + /* If necessary, shrink by removing oldest entries */ + for (; Hist->NumEntries > MaxEntries; Hist->NumEntries--) + { + RtlFreeUnicodeString(Hist->Entries++); + Hist->Position += (Hist->Position == 0); + } + + Hist->MaxEntries = MaxEntries; + Hist->Entries = memcpy(NewEntryList, Hist->Entries, + Hist->NumEntries * sizeof(UNICODE_STRING)); + RtlFreeHeap(ConSrvHeap, 0, OldEntryList); + } + } + ConSrvReleaseConsole(Console, TRUE); + } + return Status; +} + +CSR_API(SrvGetConsoleHistory) +{ + PCONSOLE_GETSETHISTORYINFO HistoryInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HistoryInfoRequest; + PCONSOLE Console; + NTSTATUS Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (NT_SUCCESS(Status)) + { + HistoryInfoRequest->HistoryBufferSize = Console->HistoryBufferSize; + HistoryInfoRequest->NumberOfHistoryBuffers = Console->NumberOfHistoryBuffers; + HistoryInfoRequest->dwFlags = Console->HistoryNoDup; + ConSrvReleaseConsole(Console, TRUE); + } + return Status; +} + +CSR_API(SrvSetConsoleHistory) +{ + PCONSOLE_GETSETHISTORYINFO HistoryInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HistoryInfoRequest; + PCONSOLE Console; + NTSTATUS Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); + if (NT_SUCCESS(Status)) + { + Console->HistoryBufferSize = HistoryInfoRequest->HistoryBufferSize; + Console->NumberOfHistoryBuffers = HistoryInfoRequest->NumberOfHistoryBuffers; + Console->HistoryNoDup = HistoryInfoRequest->dwFlags & HISTORY_NO_DUP_FLAG; + ConSrvReleaseConsole(Console, TRUE); + } + return Status; +} + +/* EOF */ Index: win32ss/user/consrv/lineinput.c =================================================================== --- win32ss/user/consrv/lineinput.c (rvision 58607) +++ win32ss/user/consrv/lineinput.c (copie de travail) Modification de proprits sur win32ss/user/consrv/lineinput.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/resource.h =================================================================== --- win32ss/user/consrv/resource.h (rvision 0) +++ win32ss/user/consrv/resource.h (copie de travail) @@ -0,0 +1,43 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/resource.h + * PURPOSE: Resource #defines + */ + +#pragma once + +#define ID_SYSTEM_EDIT_MARK 1001 +#define ID_SYSTEM_EDIT_COPY 1002 +#define ID_SYSTEM_EDIT_PASTE 1003 +#define ID_SYSTEM_EDIT_SELECTALL 1004 +#define ID_SYSTEM_EDIT_SCROLL 1005 +#define ID_SYSTEM_EDIT_FIND 1006 +#define ID_SYSTEM_DEFAULTS 1007 +#define ID_SYSTEM_PROPERTIES 1008 + +#define NCPOPUP_MENU 103 + +#define IDS_EDIT 204 +#define IDS_MARK 205 +#define IDS_COPY 206 +#define IDS_PASTE 207 +#define IDS_SELECTALL 208 +#define IDS_SCROLL 209 +#define IDS_FIND 210 +#define IDS_DEFAULTS 211 +#define IDS_PROPERTIES 212 + +// Scrollbar resource ids +#define IDS_SCROLLHERE 304 +#define IDS_SCROLLTOP 305 +#define IDS_SCROLLBOTTOM 306 +#define IDS_SCROLLPAGE_UP 307 +#define IDS_SCROLLPAGE_DOWN 308 +#define IDS_SCROLLUP 309 +#define IDS_SCROLLDOWN 310 + +#define IDI_CONSOLE 1 +#define IDS_CONSOLE_TITLE 500 + +/* EOF */ Index: win32ss/user/consrv/resource.h =================================================================== --- win32ss/user/consrv/resource.h (rvision 58607) +++ win32ss/user/consrv/resource.h (copie de travail) Modification de proprits sur win32ss/user/consrv/resource.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/rsrc.rc =================================================================== --- win32ss/user/consrv/rsrc.rc (rvision 0) +++ win32ss/user/consrv/rsrc.rc (copie de travail) @@ -0,0 +1,70 @@ +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +// UTF-8 +#pragma code_page(65001) +#ifdef LANGUAGE_BG_BG + #include "lang/bg-BG.rc" +#endif +#ifdef LANGUAGE_CS_CZ + #include "lang/cs-CZ.rc" +#endif +#ifdef LANGUAGE_DE_DE + #include "lang/de-DE.rc" +#endif +#ifdef LANGUAGE_EL_GR + #include "lang/el-GR.rc" +#endif +#ifdef LANGUAGE_EN_US + #include "lang/en-US.rc" +#endif +#ifdef LANGUAGE_ES_ES + #include "lang/es-ES.rc" +#endif +#ifdef LANGUAGE_FR_FR + #include "lang/fr-FR.rc" +#endif +#ifdef LANGUAGE_HE_IL + #include "lang/he-IL.rc" +#endif +#ifdef LANGUAGE_ID_ID + #include "lang/id-ID.rc" +#endif +#ifdef LANGUAGE_IT_IT + #include "lang/it-IT.rc" +#endif +#ifdef LANGUAGE_JA_JP + #include "lang/ja-JP.rc" +#endif +#ifdef LANGUAGE_NB_NO + #include "lang/no-NO.rc" +#endif +#ifdef LANGUAGE_PL_PL + #include "lang/pl-PL.rc" +#endif +#ifdef LANGUAGE_PT_BR + #include "lang/pt-BR.rc" +#endif +#ifdef LANGUAGE_RO_RO + #include "lang/ro-RO.rc" +#endif +#ifdef LANGUAGE_RU_RU + #include "lang/ru-RU.rc" +#endif +#ifdef LANGUAGE_SK_SK + #include "lang/sk-SK.rc" +#endif +#ifdef LANGUAGE_SV_SE + #include "lang/sv-SE.rc" +#endif +#ifdef LANGUAGE_TR_TR + #include "lang/tr-TR.rc" +#endif +#ifdef LANGUAGE_UK_UA + #include "lang/uk-UA.rc" +#endif +#ifdef LANGUAGE_ZH_CN + #include "lang/zh-CN.rc" +#endif +#ifdef LANGUAGE_ZH_TW + #include "lang/zh-TW.rc" +#endif Index: win32ss/user/consrv/rsrc.rc =================================================================== --- win32ss/user/consrv/rsrc.rc (rvision 58607) +++ win32ss/user/consrv/rsrc.rc (copie de travail) Modification de proprits sur win32ss/user/consrv/rsrc.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/settings.c =================================================================== --- win32ss/user/consrv/settings.c (rvision 0) +++ win32ss/user/consrv/settings.c (copie de travail) @@ -0,0 +1,487 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/settings.c + * PURPOSE: Consoles settings management + * PROGRAMMERS: Hermes Belusca - Maito + * + * NOTE: Adapted from existing code. + */ + +/* INCLUDES *******************************************************************/ + +#include "consrv.h" +#include "conio.h" +#include "settings.h" + +#include // for swprintf + +#define NDEBUG +#include + + +/* GLOBALS ********************************************************************/ + +extern const COLORREF s_Colors[16]; + + +/* FUNCTIONS ******************************************************************/ + +static VOID +TranslateConsoleName(OUT LPWSTR DestString, + IN LPCWSTR ConsoleName, + IN UINT MaxStrLen) +{ +#define PATH_SEPARATOR L'\\' + + UINT wLength; + + if ( DestString == NULL || ConsoleName == NULL || + *ConsoleName == L'\0' || MaxStrLen == 0 ) + { + return; + } + + wLength = GetWindowsDirectoryW(DestString, MaxStrLen); + if ((wLength > 0) && (_wcsnicmp(ConsoleName, DestString, wLength) == 0)) + { + wcsncpy(DestString, L"%SystemRoot%", MaxStrLen); + // FIXME: Fix possible buffer overflows there !!!!! + wcsncat(DestString, ConsoleName + wLength, MaxStrLen); + } + else + { + wcsncpy(DestString, ConsoleName, MaxStrLen); + } + + /* Replace path separators (backslashes) by underscores */ + while ((DestString = wcschr(DestString, PATH_SEPARATOR))) *DestString = L'_'; +} + +static BOOL +OpenUserRegistryPathPerProcessId(DWORD ProcessId, + PHKEY hResult, + REGSAM samDesired) +{ + BOOL bRet = TRUE; + HANDLE hProcessToken = NULL; + HANDLE hProcess; + BYTE Buffer[256]; + DWORD Length = 0; + UNICODE_STRING SidName; + PTOKEN_USER TokUser; + + hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | READ_CONTROL, FALSE, ProcessId); + if (!hProcess) + { + DPRINT("Error: OpenProcess failed(0x%x)\n", GetLastError()); + return FALSE; + } + + if (!OpenProcessToken(hProcess, TOKEN_QUERY, &hProcessToken)) + { + DPRINT("Error: OpenProcessToken failed(0x%x)\n", GetLastError()); + CloseHandle(hProcess); + return FALSE; + } + + if (!GetTokenInformation(hProcessToken, TokenUser, (PVOID)Buffer, sizeof(Buffer), &Length)) + { + DPRINT("Error: GetTokenInformation failed(0x%x)\n",GetLastError()); + CloseHandle(hProcessToken); + CloseHandle(hProcess); + return FALSE; + } + + TokUser = ((PTOKEN_USER)Buffer)->User.Sid; + if (!NT_SUCCESS(RtlConvertSidToUnicodeString(&SidName, TokUser, TRUE))) + { + DPRINT("Error: RtlConvertSidToUnicodeString failed(0x%x)\n", GetLastError()); + CloseHandle(hProcessToken); + CloseHandle(hProcess); + return FALSE; + } + + bRet = (RegOpenKeyExW(HKEY_USERS, + SidName.Buffer, + 0, + samDesired, + hResult) == ERROR_SUCCESS); + + RtlFreeUnicodeString(&SidName); + + CloseHandle(hProcessToken); + CloseHandle(hProcess); + + return bRet; +} + +/*static*/ BOOL +ConSrvOpenUserSettings(DWORD ProcessId, + LPCWSTR ConsoleTitle, + PHKEY hSubKey, + REGSAM samDesired, + BOOL bCreate) +{ + BOOL bRet = TRUE; + WCHAR szBuffer[MAX_PATH] = L"Console\\"; + WCHAR szBuffer2[MAX_PATH] = L""; + HKEY hKey; + + /* + * Console properties are stored under the HKCU\Console\* key. + * + * We use the original console title as the subkey name for storing + * console properties. We need to distinguish whether we were launched + * via the console application directly or via a shortcut. + * + * If the title of the console corresponds to a path (more precisely, + * if the title is of the form: C:\ReactOS\\), + * then use the corresponding unexpanded path and with the backslashes + * replaced by underscores, to make the registry happy, + * i.e. %SystemRoot%__ + */ + + /* Open the registry key where we saved the console properties */ + if (!OpenUserRegistryPathPerProcessId(ProcessId, &hKey, samDesired)) + { + DPRINT1("OpenUserRegistryPathPerProcessId failed\n"); + return FALSE; + } + + /* + * Try to open properties via the console title: + * to make the registry happy, replace all the + * backslashes by underscores. + */ + TranslateConsoleName(szBuffer2, ConsoleTitle, MAX_PATH); + + /* Create the registry path */ + wcsncat(szBuffer, szBuffer2, MAX_PATH); + + /* Create or open the registry key */ + if (bCreate) + { + /* Create the key */ + bRet = (RegCreateKeyExW(hKey, + szBuffer, + 0, NULL, + REG_OPTION_NON_VOLATILE, + samDesired, + NULL, + hSubKey, + NULL) == ERROR_SUCCESS); + } + else + { + /* Open the key */ + bRet = (RegOpenKeyExW(hKey, + szBuffer, + 0, + samDesired, + hSubKey) == ERROR_SUCCESS); + } + + /* Close the parent key and return success or not */ + RegCloseKey(hKey); + return bRet; +} + +BOOL +ConSrvReadUserSettings(IN OUT PCONSOLE_INFO ConsoleInfo, + IN DWORD ProcessId) +{ + BOOL RetVal = FALSE; + HKEY hKey; + DWORD dwNumSubKeys = 0; + DWORD dwIndex; + DWORD dwColorIndex = 0; + DWORD dwType; + WCHAR szValueName[MAX_PATH]; + DWORD dwValueName; + WCHAR szValue[LF_FACESIZE] = L"\0"; + DWORD Value; + DWORD dwValue; + + if (!ConSrvOpenUserSettings(ProcessId, + ConsoleInfo->ConsoleTitle, + &hKey, KEY_READ, + FALSE)) + { + DPRINT("ConSrvOpenUserSettings failed\n"); + return FALSE; + } + + if (RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, + &dwNumSubKeys, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) + { + DPRINT("ConSrvReadUserSettings: RegQueryInfoKey failed\n"); + RegCloseKey(hKey); + return FALSE; + } + + DPRINT("ConSrvReadUserSettings entered dwNumSubKeys %d\n", dwNumSubKeys); + + for (dwIndex = 0; dwIndex < dwNumSubKeys; dwIndex++) + { + dwValue = sizeof(Value); + dwValueName = MAX_PATH; // sizeof(szValueName)/sizeof(szValueName[0]) + + if (RegEnumValueW(hKey, dwIndex, szValueName, &dwValueName, NULL, &dwType, (BYTE*)&Value, &dwValue) != ERROR_SUCCESS) + { + if (dwType == REG_SZ) + { + /* + * Retry in case of string value + */ + dwValue = sizeof(szValue); + dwValueName = MAX_PATH; // sizeof(szValueName)/sizeof(szValueName[0]) + if (RegEnumValueW(hKey, dwIndex, szValueName, &dwValueName, NULL, NULL, (BYTE*)szValue, &dwValue) != ERROR_SUCCESS) + break; + } + else + { + break; + } + } + + /* Maybe it is UI-specific ?? */ + if (!wcsncmp(szValueName, L"ColorTable", wcslen(L"ColorTable"))) + { + dwColorIndex = 0; + swscanf(szValueName, L"ColorTable%2d", &dwColorIndex); + if (dwColorIndex < sizeof(ConsoleInfo->Colors)/sizeof(ConsoleInfo->Colors[0])) + { + ConsoleInfo->Colors[dwColorIndex] = Value; + RetVal = TRUE; + } + } + else if (!wcscmp(szValueName, L"HistoryBufferSize")) + { + ConsoleInfo->HistoryBufferSize = Value; + RetVal = TRUE; + } + else if (!wcscmp(szValueName, L"NumberOfHistoryBuffers")) + { + ConsoleInfo->NumberOfHistoryBuffers = Value; + RetVal = TRUE; + } + else if (!wcscmp(szValueName, L"HistoryNoDup")) + { + ConsoleInfo->HistoryNoDup = Value; + RetVal = TRUE; + } + else if (!wcscmp(szValueName, L"FullScreen")) + { + ConsoleInfo->FullScreen = Value; + RetVal = TRUE; + } + else if (!wcscmp(szValueName, L"QuickEdit")) + { + ConsoleInfo->QuickEdit = Value; + RetVal = TRUE; + } + else if (!wcscmp(szValueName, L"InsertMode")) + { + ConsoleInfo->InsertMode = Value; + RetVal = TRUE; + } + else if (!wcscmp(szValueName, L"ScreenBufferSize")) + { + ConsoleInfo->ScreenBufferSize.X = LOWORD(Value); + ConsoleInfo->ScreenBufferSize.Y = HIWORD(Value); + RetVal = TRUE; + } + else if (!wcscmp(szValueName, L"WindowSize")) + { + ConsoleInfo->ConsoleSize.X = LOWORD(Value); + ConsoleInfo->ConsoleSize.Y = HIWORD(Value); + RetVal = TRUE; + } + else if (!wcscmp(szValueName, L"CursorSize")) + { + ConsoleInfo->CursorSize = min(max(Value, 0), 100); + RetVal = TRUE; + } + else if (!wcscmp(szValueName, L"ScreenColors")) + { + ConsoleInfo->ScreenAttrib = Value; + RetVal = TRUE; + } + else if (!wcscmp(szValueName, L"PopupColors")) + { + ConsoleInfo->PopupAttrib = Value; + RetVal = TRUE; + } + } + + RegCloseKey(hKey); + return RetVal; +} + +BOOL +ConSrvWriteUserSettings(IN PCONSOLE_INFO ConsoleInfo, + IN DWORD ProcessId) +{ + BOOL GlobalSettings = (ConsoleInfo->ConsoleTitle[0] == L'\0'); + HKEY hKey; + DWORD Storage = 0; + +#define SetConsoleSetting(SettingName, SettingType, SettingSize, Setting, DefaultValue) \ +do { \ + if (GlobalSettings || (!GlobalSettings && (*(Setting) != (DefaultValue)))) \ + { \ + RegSetValueExW(hKey, (SettingName), 0, (SettingType), (PBYTE)(Setting), (SettingSize)); \ + } \ + else \ + { \ + RegDeleteValue(hKey, (SettingName)); \ + } \ +} while (0) + + WCHAR szValueName[15]; + UINT i; + + if (!ConSrvOpenUserSettings(ProcessId, + ConsoleInfo->ConsoleTitle, + &hKey, KEY_WRITE, + TRUE)) + { + return FALSE; + } + + for (i = 0 ; i < sizeof(ConsoleInfo->Colors)/sizeof(ConsoleInfo->Colors[0]) ; ++i) + { + /* + * Write only the new value if we are saving the global settings + * or we are saving settings for a particular console, which differs + * from the default ones. + */ + swprintf(szValueName, L"ColorTable%02d", i); + SetConsoleSetting(szValueName, REG_DWORD, sizeof(DWORD), &ConsoleInfo->Colors[i], s_Colors[i]); + } + + SetConsoleSetting(L"HistoryBufferSize", REG_DWORD, sizeof(DWORD), &ConsoleInfo->HistoryBufferSize, 50); + SetConsoleSetting(L"NumberOfHistoryBuffers", REG_DWORD, sizeof(DWORD), &ConsoleInfo->NumberOfHistoryBuffers, 4); + + Storage = ConsoleInfo->HistoryNoDup; + SetConsoleSetting(L"HistoryNoDup", REG_DWORD, sizeof(DWORD), &Storage, FALSE); + + Storage = ConsoleInfo->FullScreen; + SetConsoleSetting(L"FullScreen", REG_DWORD, sizeof(DWORD), &Storage, FALSE); + + Storage = ConsoleInfo->QuickEdit; + SetConsoleSetting(L"QuickEdit", REG_DWORD, sizeof(DWORD), &Storage, FALSE); + + Storage = ConsoleInfo->InsertMode; + SetConsoleSetting(L"InsertMode", REG_DWORD, sizeof(DWORD), &Storage, TRUE); + + Storage = MAKELONG(ConsoleInfo->ScreenBufferSize.X, ConsoleInfo->ScreenBufferSize.Y); + SetConsoleSetting(L"ScreenBufferSize", REG_DWORD, sizeof(DWORD), &Storage, MAKELONG(80, 300)); + + Storage = MAKELONG(ConsoleInfo->ConsoleSize.X, ConsoleInfo->ConsoleSize.Y); + SetConsoleSetting(L"WindowSize", REG_DWORD, sizeof(DWORD), &Storage, MAKELONG(80, 25)); + + SetConsoleSetting(L"CursorSize", REG_DWORD, sizeof(DWORD), &ConsoleInfo->CursorSize, CSR_DEFAULT_CURSOR_SIZE); + + Storage = ConsoleInfo->ScreenAttrib; + SetConsoleSetting(L"ScreenColors", REG_DWORD, sizeof(DWORD), &Storage, DEFAULT_SCREEN_ATTRIB); + + Storage = ConsoleInfo->PopupAttrib; + SetConsoleSetting(L"PopupColors", REG_DWORD, sizeof(DWORD), &Storage, DEFAULT_POPUP_ATTRIB); + + RegCloseKey(hKey); + return TRUE; +} + +VOID +ConSrvGetDefaultSettings(IN OUT PCONSOLE_INFO ConsoleInfo, + IN DWORD ProcessId) +{ + if (ConsoleInfo == NULL) return; + +/// HKCU,"Console","LoadConIme",0x00010003,1 + + /* + * 1. Load the default values + */ +// #define DEFAULT_HISTORY_COMMANDS_NUMBER 50 +// #define DEFAULT_HISTORY_BUFFERS_NUMBER 4 + ConsoleInfo->HistoryBufferSize = 50; + ConsoleInfo->NumberOfHistoryBuffers = 4; + ConsoleInfo->HistoryNoDup = FALSE; + + ConsoleInfo->FullScreen = FALSE; + ConsoleInfo->QuickEdit = FALSE; + ConsoleInfo->InsertMode = TRUE; + // ConsoleInfo->InputBufferSize; + ConsoleInfo->ScreenBufferSize = (COORD){80, 300}; + ConsoleInfo->ConsoleSize = (COORD){80, 25 }; + + ConsoleInfo->CursorBlinkOn; + ConsoleInfo->ForceCursorOff; + ConsoleInfo->CursorSize = CSR_DEFAULT_CURSOR_SIZE; // #define SMALL_SIZE 25 + + ConsoleInfo->ScreenAttrib = DEFAULT_SCREEN_ATTRIB; + ConsoleInfo->PopupAttrib = DEFAULT_POPUP_ATTRIB; + + memcpy(ConsoleInfo->Colors, s_Colors, sizeof(s_Colors)); + + // ConsoleInfo->CodePage; + + ConsoleInfo->ConsoleTitle[0] = L'\0'; + + /* + * 2. Overwrite them with the ones stored in HKCU\Console. + * If the HKCU\Console key doesn't exist, create it + * and store the default values inside. + */ + if (!ConSrvReadUserSettings(ConsoleInfo, ProcessId)) + { + ConSrvWriteUserSettings(ConsoleInfo, ProcessId); + } +} + +VOID +ConSrvApplyUserSettings(IN PCONSOLE Console, + IN PCONSOLE_INFO ConsoleInfo) +{ + PCONSOLE_SCREEN_BUFFER ActiveBuffer = Console->ActiveBuffer; + COORD BufSize; + BOOL SizeChanged = FALSE; + + /* + * Apply foreground and background colors for both screen and popup + * and copy the new palette. + */ + ActiveBuffer->ScreenDefaultAttrib = ConsoleInfo->ScreenAttrib; + ActiveBuffer->PopupDefaultAttrib = ConsoleInfo->PopupAttrib; + memcpy(Console->Colors, ConsoleInfo->Colors, sizeof(s_Colors)); // FIXME: Possible buffer overflow if s_colors is bigger than pConInfo->Colors. + + // TODO: Really update the screen attributes as FillConsoleOutputAttribute does. + + /* Apply cursor size */ + ActiveBuffer->CursorInfo.bVisible = (ConsoleInfo->CursorSize != 0); + ActiveBuffer->CursorInfo.dwSize = min(max(ConsoleInfo->CursorSize, 0), 100); + + /* Resize the console */ + if (ConsoleInfo->ConsoleSize.X != Console->ConsoleSize.X || + ConsoleInfo->ConsoleSize.Y != Console->ConsoleSize.Y) + { + Console->ConsoleSize = ConsoleInfo->ConsoleSize; + SizeChanged = TRUE; + } + + /* Resize its active screen-buffer */ + BufSize = ConsoleInfo->ScreenBufferSize; + if (BufSize.X != ActiveBuffer->ScreenBufferSize.X || + BufSize.Y != ActiveBuffer->ScreenBufferSize.Y) + { + if (NT_SUCCESS(ConioResizeBuffer(Console, ActiveBuffer, BufSize))) + SizeChanged = TRUE; + } + + if (SizeChanged) ConioResizeTerminal(Console); +} + +/* EOF */ Index: win32ss/user/consrv/settings.c =================================================================== --- win32ss/user/consrv/settings.c (rvision 58607) +++ win32ss/user/consrv/settings.c (copie de travail) Modification de proprits sur win32ss/user/consrv/settings.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/settings.h =================================================================== --- win32ss/user/consrv/settings.h (rvision 0) +++ win32ss/user/consrv/settings.h (copie de travail) @@ -0,0 +1,95 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/settings.h + * PURPOSE: Consoles settings management + * PROGRAMMERS: Hermes Belusca - Maito + * + * NOTE: Adapted from existing code. + */ + +#pragma once + +/* STRUCTURES *****************************************************************/ + +/* + * Structure used to hold terminal-specific information + */ +typedef struct _TERMINAL_INFO +{ + ULONG Size; /* Size of the memory buffer pointed by TermInfo */ + PVOID TermInfo; /* Address (or offset when talking to console.dll) of the memory buffer holding terminal information */ +} TERMINAL_INFO, *PTERMINAL_INFO; + +/* + * Structure used to hold console information + */ +typedef struct _CONSOLE_INFO +{ + ULONG HistoryBufferSize; + ULONG NumberOfHistoryBuffers; + BOOLEAN HistoryNoDup; + +/* BOOLEAN */ ULONG FullScreen; /* Give the type of console: GUI (windowed) or TUI (fullscreen) */ + BOOLEAN QuickEdit; + BOOLEAN InsertMode; + ULONG InputBufferSize; + COORD ScreenBufferSize; +/* SIZE */ COORD ConsoleSize; /* The size of the console */ + + BOOLEAN CursorBlinkOn; + BOOLEAN ForceCursorOff; + ULONG CursorSize; + + USHORT ScreenAttrib; // CHAR_INFO ScreenFillAttrib + USHORT PopupAttrib; + + COLORREF Colors[16]; /* Color palette */ + + ULONG CodePage; + + WCHAR ConsoleTitle[MAX_PATH + 1]; +} CONSOLE_INFO, *PCONSOLE_INFO; + +#define RGBFromAttrib(Console, Attribute) ((Console)->Colors[(Attribute) & 0xF]) +#define TextAttribFromAttrib(Attribute) ((Attribute) & 0xF) +#define BkgdAttribFromAttrib(Attribute) (((Attribute) >> 4) & 0xF) +#define MakeAttrib(TextAttrib, BkgdAttrib) (DWORD)((((BkgdAttrib) & 0xF) << 4) | ((TextAttrib) & 0xF)) + +/* + * Structure used to communicate with console.dll + */ +typedef struct _CONSOLE_PROPS +{ + HWND hConsoleWindow; + BOOL ShowDefaultParams; + + BOOLEAN AppliedConfig; + DWORD ActiveStaticControl; + + CONSOLE_INFO ci; /* Console-specific informations */ + TERMINAL_INFO TerminalInfo; /* Frontend-specific parameters */ +} CONSOLE_PROPS, *PCONSOLE_PROPS; + +/* FUNCTIONS ******************************************************************/ + +#ifndef CONSOLE_H__ // If we aren't included by console.dll + +BOOL ConSrvOpenUserSettings(DWORD ProcessId, + LPCWSTR ConsoleTitle, + PHKEY hSubKey, + REGSAM samDesired, + BOOL bCreate); + +BOOL ConSrvReadUserSettings(IN OUT PCONSOLE_INFO ConsoleInfo, + IN DWORD ProcessId); +BOOL ConSrvWriteUserSettings(IN PCONSOLE_INFO ConsoleInfo, + IN DWORD ProcessId); +VOID ConSrvGetDefaultSettings(IN OUT PCONSOLE_INFO ConsoleInfo, + IN DWORD ProcessId); +VOID ConSrvApplyUserSettings(IN PCONSOLE Console, + IN PCONSOLE_INFO ConsoleInfo); + +#endif + +/* EOF */ Index: win32ss/user/consrv/settings.h =================================================================== --- win32ss/user/consrv/settings.h (rvision 58607) +++ win32ss/user/consrv/settings.h (copie de travail) Modification de proprits sur win32ss/user/consrv/settings.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/tuiconsole.c =================================================================== --- win32ss/user/consrv/tuiconsole.c (rvision 0) +++ win32ss/user/consrv/tuiconsole.c (copie de travail) @@ -0,0 +1,626 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/tuiconsole.c + * PURPOSE: TUI terminal emulator + * PROGRAMMERS: + */ + +#ifdef TUI_CONSOLE + +#include "consrv.h" +#include "settings.h" +#include "tuiconsole.h" +#include + +#define NDEBUG +#include + + +/* GLOBALS ********************************************************************/ + +/* TUI Console Window Class name */ +#define TUI_CONSOLE_WINDOW_CLASS L"TuiConsoleWindowClass" + +typedef struct _TUI_CONSOLE_DATA +{ + CRITICAL_SECTION Lock; + // HANDLE hTuiInitEvent; + + HWND hWindow; + + PCONSOLE Console; + // TUI_CONSOLE_INFO TuiInfo; +} TUI_CONSOLE_DATA, *PTUI_CONSOLE_DATA; + +CRITICAL_SECTION ActiveConsoleLock; +static COORD PhysicalConsoleSize; +static HANDLE ConsoleDeviceHandle; +static PCONSOLE ActiveConsole; + +static BOOL ConsInitialized = FALSE; + +/******************************************************************************\ +|** BlueScreen Driver management **| +\**/ +/* Code taken and adapted from base/system/services/driver.c */ +static DWORD +ScmLoadDriver(LPCWSTR lpServiceName) +{ + NTSTATUS Status = STATUS_SUCCESS; + BOOLEAN WasPrivilegeEnabled = FALSE; + PWSTR pszDriverPath; + UNICODE_STRING DriverPath; + + /* Build the driver path */ + /* 52 = wcslen(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\") */ + pszDriverPath = RtlAllocateHeap(ConSrvHeap, + HEAP_ZERO_MEMORY, + (52 + wcslen(lpServiceName) + 1) * sizeof(WCHAR)); + if (pszDriverPath == NULL) + return ERROR_NOT_ENOUGH_MEMORY; + + wcscpy(pszDriverPath, + L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"); + wcscat(pszDriverPath, + lpServiceName); + + RtlInitUnicodeString(&DriverPath, + pszDriverPath); + + DPRINT(" Path: %wZ\n", &DriverPath); + + /* Acquire driver-loading privilege */ + Status = RtlAdjustPrivilege(SE_LOAD_DRIVER_PRIVILEGE, + TRUE, + FALSE, + &WasPrivilegeEnabled); + if (!NT_SUCCESS(Status)) + { + /* We encountered a failure, exit properly */ + DPRINT1("CONSRV: Cannot acquire driver-loading privilege, Status = 0x%08lx\n", Status); + goto done; + } + + Status = NtLoadDriver(&DriverPath); + + /* Release driver-loading privilege */ + RtlAdjustPrivilege(SE_LOAD_DRIVER_PRIVILEGE, + WasPrivilegeEnabled, + FALSE, + &WasPrivilegeEnabled); + +done: + RtlFreeHeap(ConSrvHeap, 0, pszDriverPath); + return RtlNtStatusToDosError(Status); +} + +#ifdef BLUESCREEN_DRIVER_UNLOADING +static DWORD +ScmUnloadDriver(LPCWSTR lpServiceName) +{ + NTSTATUS Status = STATUS_SUCCESS; + BOOLEAN WasPrivilegeEnabled = FALSE; + PWSTR pszDriverPath; + UNICODE_STRING DriverPath; + + /* Build the driver path */ + /* 52 = wcslen(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\") */ + pszDriverPath = RtlAllocateHeap(ConSrvHeap, + HEAP_ZERO_MEMORY, + (52 + wcslen(lpServiceName) + 1) * sizeof(WCHAR)); + if (pszDriverPath == NULL) + return ERROR_NOT_ENOUGH_MEMORY; + + wcscpy(pszDriverPath, + L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"); + wcscat(pszDriverPath, + lpServiceName); + + RtlInitUnicodeString(&DriverPath, + pszDriverPath); + + DPRINT(" Path: %wZ\n", &DriverPath); + + /* Acquire driver-unloading privilege */ + Status = RtlAdjustPrivilege(SE_LOAD_DRIVER_PRIVILEGE, + TRUE, + FALSE, + &WasPrivilegeEnabled); + if (!NT_SUCCESS(Status)) + { + /* We encountered a failure, exit properly */ + DPRINT1("CONSRV: Cannot acquire driver-unloading privilege, Status = 0x%08lx\n", Status); + goto done; + } + + Status = NtUnloadDriver(&DriverPath); + + /* Release driver-unloading privilege */ + RtlAdjustPrivilege(SE_LOAD_DRIVER_PRIVILEGE, + WasPrivilegeEnabled, + FALSE, + &WasPrivilegeEnabled); + +done: + RtlFreeHeap(ConSrvHeap, 0, pszDriverPath); + return RtlNtStatusToDosError(Status); +} +#endif +/**\ +\******************************************************************************/ + +static LRESULT CALLBACK +TuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + if (msg == WM_ACTIVATE) + { + if (LOWORD(wParam) != WA_INACTIVE) + { + SetFocus(hWnd); + ConioDrawConsole(ActiveConsole); + } + } + return DefWindowProcW(hWnd, msg, wParam, lParam); +} + +static BOOL FASTCALL +TuiSwapConsole(INT Next) +{ + static PCONSOLE SwapConsole = NULL; /* console we are thinking about swapping with */ + DWORD BytesReturned; + ANSI_STRING Title; + PVOID Buffer; + PCOORD pos; + + if (0 != Next) + { + /* alt-tab, swap consoles */ + /* move SwapConsole to next console, and print its title */ + EnterCriticalSection(&ActiveConsoleLock); + if (!SwapConsole) + { + SwapConsole = ActiveConsole; + } + + SwapConsole = (0 < Next ? SwapConsole->Next : SwapConsole->Prev); + Title.MaximumLength = RtlUnicodeStringToAnsiSize(&SwapConsole->Title); + Title.Length = 0; + Buffer = RtlAllocateHeap(ConSrvHeap, + 0, + sizeof(COORD) + Title.MaximumLength); + pos = (PCOORD )Buffer; + Title.Buffer = (PVOID)((ULONG_PTR)Buffer + sizeof( COORD )); + + RtlUnicodeStringToAnsiString(&Title, &SwapConsole->Title, FALSE); + pos->Y = PhysicalConsoleSize.Y / 2; + pos->X = (PhysicalConsoleSize.X - Title.Length) / 2; + /* redraw the console to clear off old title */ + ConioDrawConsole(ActiveConsole); + if (!DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER, + NULL, 0, Buffer, sizeof(COORD) + Title.Length, + &BytesReturned, NULL)) + { + DPRINT1( "Error writing to console\n" ); + } + RtlFreeHeap(ConSrvHeap, 0, Buffer); + LeaveCriticalSection(&ActiveConsoleLock); + + return TRUE; + } + else if (NULL != SwapConsole) + { + EnterCriticalSection(&ActiveConsoleLock); + if (SwapConsole != ActiveConsole) + { + /* first remove swapconsole from the list */ + SwapConsole->Prev->Next = SwapConsole->Next; + SwapConsole->Next->Prev = SwapConsole->Prev; + /* now insert before activeconsole */ + SwapConsole->Next = ActiveConsole; + SwapConsole->Prev = ActiveConsole->Prev; + ActiveConsole->Prev->Next = SwapConsole; + ActiveConsole->Prev = SwapConsole; + } + ActiveConsole = SwapConsole; + SwapConsole = NULL; + ConioDrawConsole(ActiveConsole); + LeaveCriticalSection(&ActiveConsoleLock); + return TRUE; + } + else + { + return FALSE; + } +} + +static BOOL WINAPI +TuiProcessKeyCallback(PCONSOLE Console, MSG* msg, BYTE KeyStateMenu, DWORD ShiftState, UINT VirtualKeyCode, BOOL Down) +{ + if (0 != (ShiftState & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED)) && + VK_TAB == VirtualKeyCode) + { + if (Down) + { + TuiSwapConsole(ShiftState & SHIFT_PRESSED ? -1 : 1); + } + + return TRUE; + } + else if (VK_MENU == VirtualKeyCode && !Down) + { + return TuiSwapConsole(0); + } + + return FALSE; +} + +static BOOL FASTCALL +TuiInit(DWORD OemCP) +{ + CONSOLE_SCREEN_BUFFER_INFO ScrInfo; + DWORD BytesReturned; + WNDCLASSEXW wc; + ATOM ConsoleClassAtom; + USHORT TextAttribute = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED; + + ScmLoadDriver(L"Blue"); + + ConsoleDeviceHandle = CreateFileW(L"\\\\.\\BlueScreen", FILE_ALL_ACCESS, 0, NULL, + OPEN_EXISTING, 0, NULL); + if (INVALID_HANDLE_VALUE == ConsoleDeviceHandle) + { + DPRINT1("Failed to open BlueScreen.\n"); + return FALSE; + } + + if (!DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_LOADFONT, + &OemCP, sizeof(OemCP), NULL, 0, + &BytesReturned, NULL)) + { + DPRINT1("Failed to load the font for codepage %d\n", OemCP); + /* Let's suppose the font is good enough to continue */ + } + + if (!DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE, + &TextAttribute, sizeof(TextAttribute), NULL, 0, + &BytesReturned, NULL)) + { + DPRINT1("Failed to set text attribute\n"); + } + + ActiveConsole = NULL; + InitializeCriticalSection(&ActiveConsoleLock); + if (!DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO, + NULL, 0, &ScrInfo, sizeof(ScrInfo), &BytesReturned, NULL)) + { + DPRINT1("Failed to get console info\n"); + return FALSE; + } + PhysicalConsoleSize = ScrInfo.dwSize; + + RtlZeroMemory(&wc, sizeof(WNDCLASSEXW)); + wc.cbSize = sizeof(WNDCLASSEXW); + wc.lpszClassName = TUI_CONSOLE_WINDOW_CLASS; + wc.lpfnWndProc = TuiConsoleWndProc; + wc.cbWndExtra = GWLP_CONSOLEWND_ALLOC; + wc.hInstance = ConSrvDllInstance; + + ConsoleClassAtom = RegisterClassExW(&wc); + if (ConsoleClassAtom == 0) + { + DPRINT1("Failed to register TUI console wndproc\n"); + return FALSE; + } + else + { + NtUserConsoleControl(TuiConsoleWndClassAtom, &ConsoleClassAtom, sizeof(ATOM)); + } + + return TRUE; +} + +static VOID FASTCALL +TuiCopyRect(char *Dest, PCONSOLE_SCREEN_BUFFER Buff, SMALL_RECT* Region) +{ + UINT SrcDelta, DestDelta; + LONG i; + PBYTE Src, SrcEnd; + + Src = ConioCoordToPointer(Buff, Region->Left, Region->Top); + SrcDelta = Buff->ScreenBufferSize.X * 2; + SrcEnd = Buff->Buffer + Buff->ScreenBufferSize.Y * Buff->ScreenBufferSize.X * 2; + DestDelta = ConioRectWidth(Region) * 2; + for (i = Region->Top; i <= Region->Bottom; i++) + { + memcpy(Dest, Src, DestDelta); + Src += SrcDelta; + if (SrcEnd <= Src) + { + Src -= Buff->ScreenBufferSize.Y * Buff->ScreenBufferSize.X * 2; + } + Dest += DestDelta; + } +} + +static VOID WINAPI +TuiDrawRegion(PCONSOLE Console, SMALL_RECT* Region) +{ + DWORD BytesReturned; + PCONSOLE_SCREEN_BUFFER Buff = Console->ActiveBuffer; + PCONSOLE_DRAW ConsoleDraw; + UINT ConsoleDrawSize; + + if (ActiveConsole != Console) + { + return; + } + + ConsoleDrawSize = sizeof(CONSOLE_DRAW) + + (ConioRectWidth(Region) * ConioRectHeight(Region)) * 2; + ConsoleDraw = RtlAllocateHeap(ConSrvHeap, 0, ConsoleDrawSize); + if (NULL == ConsoleDraw) + { + DPRINT1("RtlAllocateHeap failed\n"); + return; + } + ConsoleDraw->X = Region->Left; + ConsoleDraw->Y = Region->Top; + ConsoleDraw->SizeX = ConioRectWidth(Region); + ConsoleDraw->SizeY = ConioRectHeight(Region); + ConsoleDraw->CursorX = Buff->CursorPosition.X; + ConsoleDraw->CursorY = Buff->CursorPosition.Y; + + TuiCopyRect((char *) (ConsoleDraw + 1), Buff, Region); + + if (!DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_DRAW, + NULL, 0, ConsoleDraw, ConsoleDrawSize, &BytesReturned, NULL)) + { + DPRINT1("Failed to draw console\n"); + RtlFreeHeap(ConSrvHeap, 0, ConsoleDraw); + return; + } + + RtlFreeHeap(ConSrvHeap, 0, ConsoleDraw); +} + +static VOID WINAPI +TuiWriteStream(PCONSOLE Console, SMALL_RECT* Region, LONG CursorStartX, LONG CursorStartY, + UINT ScrolledLines, CHAR *Buffer, UINT Length) +{ + DWORD BytesWritten; + PCONSOLE_SCREEN_BUFFER Buff = Console->ActiveBuffer; + + if (ActiveConsole->ActiveBuffer != Buff) + { + return; + } + + if (!WriteFile(ConsoleDeviceHandle, Buffer, Length, &BytesWritten, NULL)) + { + DPRINT1("Error writing to BlueScreen\n"); + } +} + +static BOOL WINAPI +TuiSetCursorInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff) +{ + CONSOLE_CURSOR_INFO Info; + DWORD BytesReturned; + + if (ActiveConsole->ActiveBuffer != Buff) + { + return TRUE; + } + + Info.dwSize = ConioEffectiveCursorSize(Console, 100); + Info.bVisible = Buff->CursorInfo.bVisible; + + if (!DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_SET_CURSOR_INFO, + &Info, sizeof(Info), NULL, 0, &BytesReturned, NULL)) + { + DPRINT1( "Failed to set cursor info\n" ); + return FALSE; + } + + return TRUE; +} + +static BOOL WINAPI +TuiSetScreenInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff, UINT OldCursorX, UINT OldCursorY) +{ + CONSOLE_SCREEN_BUFFER_INFO Info; + DWORD BytesReturned; + + if (ActiveConsole->ActiveBuffer != Buff) + { + return TRUE; + } + + Info.dwCursorPosition = Buff->CursorPosition; + Info.wAttributes = Buff->ScreenDefaultAttrib; + + if (!DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO, + &Info, sizeof(CONSOLE_SCREEN_BUFFER_INFO), NULL, 0, + &BytesReturned, NULL)) + { + DPRINT1( "Failed to set cursor position\n" ); + return FALSE; + } + + return TRUE; +} + +static BOOL WINAPI +TuiUpdateScreenInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff) +{ + return TRUE; +} + +static VOID WINAPI +TuiChangeTitle(PCONSOLE Console) +{ +} + +static VOID WINAPI +TuiCleanupConsole(PCONSOLE Console) +{ + DestroyWindow(Console->hWindow); + + EnterCriticalSection(&ActiveConsoleLock); + + /* Switch to next console */ + if (ActiveConsole == Console) + { + ActiveConsole = Console->Next != Console ? Console->Next : NULL; + } + + if (Console->Next != Console) + { + Console->Prev->Next = Console->Next; + Console->Next->Prev = Console->Prev; + } + LeaveCriticalSection(&ActiveConsoleLock); + + if (NULL != ActiveConsole) + { + ConioDrawConsole(ActiveConsole); + } +} + +static BOOL WINAPI +TuiChangeIcon(PCONSOLE Console, HICON hWindowIcon) +{ + return TRUE; +} + +static HWND WINAPI +TuiGetConsoleWindowHandle(PCONSOLE Console) +{ + return Console->hWindow; +} + +static NTSTATUS WINAPI +TuiResizeBuffer(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER ScreenBuffer, COORD Size) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +static DWORD WINAPI +TuiConsoleThread(PVOID Data) +{ + PCONSOLE Console = (PCONSOLE) Data; + HWND NewWindow; + MSG msg; + + NewWindow = CreateWindowW(TUI_CONSOLE_WINDOW_CLASS, + Console->Title.Buffer, + 0, + -32000, -32000, 0, 0, + NULL, NULL, + ConSrvDllInstance, + (PVOID)Console); + if (NULL == NewWindow) + { + DPRINT1("CONSRV: Unable to create console window\n"); + return 1; + } + Console->hWindow = NewWindow; + + SetForegroundWindow(Console->hWindow); + + while (TRUE) + { + GetMessageW(&msg, 0, 0, 0); + DispatchMessage(&msg); + TranslateMessage(&msg); + + if (msg.message == WM_CHAR || msg.message == WM_SYSCHAR || + msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN || + msg.message == WM_KEYUP || msg.message == WM_SYSKEYUP) + { + ConioProcessKey(Console, &msg); + } + } + + return 0; +} + +static TERMINAL_VTBL TuiVtbl = +{ + TuiCleanupConsole, + TuiWriteStream, + TuiDrawRegion, + TuiSetCursorInfo, + TuiSetScreenInfo, + TuiUpdateScreenInfo, + TuiChangeTitle, + TuiChangeIcon, + TuiGetConsoleWindowHandle, + TuiResizeBuffer, + TuiProcessKeyCallback +}; + +NTSTATUS FASTCALL +TuiInitConsole(PCONSOLE Console, + PCONSOLE_INFO ConsoleInfo) +{ + HANDLE ThreadHandle; + + if (!ConsInitialized) + { + ConsInitialized = TRUE; + if (!TuiInit(Console->CodePage)) + { + ConsInitialized = FALSE; + return STATUS_UNSUCCESSFUL; + } + } + + Console->TermIFace.Vtbl = &TuiVtbl; + Console->hWindow = NULL; + Console->Size = PhysicalConsoleSize; + Console->ActiveBuffer->ScreenBufferSize = PhysicalConsoleSize; + + ThreadHandle = CreateThread(NULL, + 0, + TuiConsoleThread, + (PVOID)Console, + 0, + NULL); + if (NULL == ThreadHandle) + { + DPRINT1("CONSRV: Unable to create console thread\n"); + return STATUS_UNSUCCESSFUL; + } + CloseHandle(ThreadHandle); + + EnterCriticalSection(&ActiveConsoleLock); + if (NULL != ActiveConsole) + { + Console->Prev = ActiveConsole; + Console->Next = ActiveConsole->Next; + ActiveConsole->Next->Prev = Console; + ActiveConsole->Next = Console; + } + else + { + Console->Prev = Console; + Console->Next = Console; + } + ActiveConsole = Console; + LeaveCriticalSection(&ActiveConsoleLock); + + return STATUS_SUCCESS; +} + +PCONSOLE FASTCALL +TuiGetFocusConsole(VOID) +{ + return ActiveConsole; +} + +#endif + +/* EOF */ Index: win32ss/user/consrv/tuiconsole.c =================================================================== --- win32ss/user/consrv/tuiconsole.c (rvision 58607) +++ win32ss/user/consrv/tuiconsole.c (copie de travail) Modification de proprits sur win32ss/user/consrv/tuiconsole.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/consrv/tuiconsole.h =================================================================== --- win32ss/user/consrv/tuiconsole.h (rvision 0) +++ win32ss/user/consrv/tuiconsole.h (copie de travail) @@ -0,0 +1,15 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/consrv/tuiconsole.h + * PURPOSE: TUI terminal emulator + * PROGRAMMERS: + */ + +#include "conio.h" + +NTSTATUS FASTCALL TuiInitConsole(PCONSOLE Console, + PCONSOLE_INFO ConsoleInfo); +PCONSOLE FASTCALL TuiGetFocusConsole(VOID); + +/* EOF */ Index: win32ss/user/consrv/tuiconsole.h =================================================================== --- win32ss/user/consrv/tuiconsole.h (rvision 58607) +++ win32ss/user/consrv/tuiconsole.h (copie de travail) Modification de proprits sur win32ss/user/consrv/tuiconsole.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/ntuser/desktop.c =================================================================== --- win32ss/user/ntuser/desktop.c (rvision 58607) +++ win32ss/user/ntuser/desktop.c (copie de travail) @@ -2069,7 +2069,7 @@ // FIXME: IntSetThreadDesktop validates the desktop handle, it should happen // here too and set the NT error level. Q. Is it necessary to have the validation // in IntSetThreadDesktop? Is it needed there too? - if (hDesktop || (!hDesktop && CsrProcess == PsGetCurrentProcess())) + if (hDesktop || (!hDesktop && PsGetCurrentProcess() == gpepCSRSS)) ret = IntSetThreadDesktop(hDesktop, FALSE); UserLeave(); Index: win32ss/user/ntuser/hook.c =================================================================== --- win32ss/user/ntuser/hook.c (rvision 58607) +++ win32ss/user/ntuser/hook.c (copie de travail) @@ -94,7 +94,7 @@ ERR("IntHookModuleUnloaded: iHookID=%d\n", iHookID); - ppiCsr = PsGetProcessWin32Process(CsrProcess); + ppiCsr = PsGetProcessWin32Process(gpepCSRSS); ListEntry = pdesk->PtiList.Flink; while(ListEntry != &pdesk->PtiList) @@ -147,7 +147,7 @@ PPROCESSINFO ppiCsr; pti = PsGetCurrentThreadWin32Thread(); - ppiCsr = PsGetProcessWin32Process(CsrProcess); + ppiCsr = PsGetProcessWin32Process(gpepCSRSS); /* Fail if the api hook is already registered */ if(gpsi->dwSRVIFlags & SRVINFO_APIHOOK) Index: win32ss/user/ntuser/main.c =================================================================== --- win32ss/user/ntuser/main.c (rvision 58607) +++ win32ss/user/ntuser/main.c (copie de travail) @@ -304,6 +304,8 @@ if (ptiCurrent->KeyboardLayout) UserReferenceObject(ptiCurrent->KeyboardLayout); ptiCurrent->TIF_flags &= ~TIF_INCLEANUP; + if (Process == gpepCSRSS) /* If this thread is owned by CSRSS, mark it as such */ + ptiCurrent->TIF_flags |= TIF_CSRSSTHREAD; ptiCurrent->pcti = &ptiCurrent->cti; /* Initialize the CLIENTINFO */ Index: win32ss/user/ntuser/menu.c =================================================================== --- win32ss/user/ntuser/menu.c (rvision 58607) +++ win32ss/user/ntuser/menu.c (copie de travail) @@ -1527,14 +1527,13 @@ NTSTATUS Status; PEPROCESS CurrentProcess = PsGetCurrentProcess(); - if (CsrProcess != CurrentProcess) + if (gpepCSRSS != CurrentProcess) { /* - * CsrProcess does not have a Win32WindowStation - * - */ + * gpepCSRSS does not have a Win32WindowStation + */ - Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation, + Status = IntValidateWindowStationHandle(CurrentProcess->Win32WindowStation, KernelMode, 0, &WinStaObject); Index: win32ss/user/ntuser/ntstubs.c =================================================================== --- win32ss/user/ntuser/ntstubs.c (rvision 58607) +++ win32ss/user/ntuser/ntstubs.c (copie de travail) @@ -550,15 +550,66 @@ return 0; } -DWORD +NTSTATUS APIENTRY NtUserConsoleControl( - DWORD dwUnknown1, - DWORD dwUnknown2, - DWORD dwUnknown3) + IN CONSOLECONTROL ConsoleCtrl, + IN PVOID ConsoleCtrlInfo, + IN DWORD ConsoleCtrlInfoLength) { - STUB; - return 0; + NTSTATUS Status = STATUS_SUCCESS; + + /* Allow only Console Server to perform this operation (via CSRSS) */ + if (gpepCSRSS != PsGetCurrentProcess()) + return STATUS_ACCESS_DENIED; + + UserEnterExclusive(); + + switch (ConsoleCtrl) + { + case GuiConsoleWndClassAtom: + { + _SEH2_TRY + { + ProbeForRead(ConsoleCtrlInfo, ConsoleCtrlInfoLength, 1); + ASSERT(ConsoleCtrlInfoLength == sizeof(ATOM)); + gaGuiConsoleWndClass = *(ATOM*)ConsoleCtrlInfo; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + + break; + } + + case TuiConsoleWndClassAtom: + { + _SEH2_TRY + { + ProbeForRead(ConsoleCtrlInfo, ConsoleCtrlInfoLength, 1); + ASSERT(ConsoleCtrlInfoLength == sizeof(ATOM)); + gaTuiConsoleWndClass = *(ATOM*)ConsoleCtrlInfo; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + + break; + } + + default: + ERR("Calling invalid control %lu in NtUserConsoleControl\n", ConsoleCtrl); + Status = STATUS_INVALID_INFO_CLASS; + break; + } + + UserLeave(); + + return Status; } DWORD Index: win32ss/user/ntuser/ntuser.c =================================================================== --- win32ss/user/ntuser/ntuser.c (rvision 58607) +++ win32ss/user/ntuser/ntuser.c (copie de travail) @@ -20,7 +20,9 @@ BOOL gbInitialized; HINSTANCE hModClient = NULL; BOOL ClientPfnInit = FALSE; -PEPROCESS gpepCSRSS; +PEPROCESS gpepCSRSS = NULL; +ATOM gaGuiConsoleWndClass; +ATOM gaTuiConsoleWndClass; /* PRIVATE FUNCTIONS *********************************************************/ @@ -105,7 +107,7 @@ // Set W32PF_Flags |= (W32PF_READSCREENACCESSGRANTED | W32PF_IOWINSTA) // Create Event for Diconnect Desktop. - Status = UserCreateWinstaDirectoy(); + Status = UserCreateWinstaDirectory(); if (!NT_SUCCESS(Status)) return Status; /* Initialize Video. */ @@ -121,7 +123,9 @@ // Create ThreadInfo for this Thread! // { - GetW32ThreadInfo(); + /* Initialize the current thread. */ + Status = UserCreateThreadInfo(PsGetCurrentThread()); + if (!NT_SUCCESS(Status)) return Status; // Callback to User32 Client Thread Setup @@ -133,8 +137,6 @@ NtUserUpdatePerUserSystemParameters(0, TRUE); - CsrInit(); - if (gpsi->hbrGray == NULL) { hPattern55AABitmap = GreCreateBitmap(8, 8, 1, 1, (LPBYTE)wPattern55AA); Index: win32ss/user/ntuser/ntuser.h =================================================================== --- win32ss/user/ntuser/ntuser.h (rvision 58607) +++ win32ss/user/ntuser/ntuser.h (copie de travail) @@ -15,6 +15,9 @@ extern PPROCESSINFO gppiList; extern PPROCESSINFO ppiScrnSaver; extern PPROCESSINFO gppiInputProvider; +extern PEPROCESS gpepCSRSS; +extern ATOM gaGuiConsoleWndClass; +extern ATOM gaTuiConsoleWndClass; INIT_FUNCTION NTSTATUS NTAPI InitUserImpl(VOID); VOID FASTCALL CleanupUserImpl(VOID); Index: win32ss/user/ntuser/simplecall.c =================================================================== --- win32ss/user/ntuser/simplecall.c (rvision 58607) +++ win32ss/user/ntuser/simplecall.c (copie de travail) @@ -15,9 +15,8 @@ BOOL FASTCALL co_IntRegisterLogonProcess(HANDLE ProcessId, BOOL Register) { + NTSTATUS Status; PEPROCESS Process; - NTSTATUS Status; - CSR_API_MESSAGE Request; Status = PsLookupProcessByProcessId(ProcessId, &Process); @@ -52,17 +51,6 @@ ObDereferenceObject(Process); - Request.Type = MAKE_CSR_API(REGISTER_LOGON_PROCESS, CSR_GUI); - Request.Data.RegisterLogonProcessRequest.ProcessId = ProcessId; - Request.Data.RegisterLogonProcessRequest.Register = Register; - - Status = co_CsrNotify(&Request); - if (! NT_SUCCESS(Status)) - { - ERR("Failed to register logon process with CSRSS\n"); - return FALSE; - } - return TRUE; } @@ -350,7 +338,7 @@ BOOL Ret = TRUE; PPROCESSINFO ppi; PDWORD pdwLayout; - if ( PsGetCurrentProcess() == CsrProcess) + if ( PsGetCurrentProcess() == gpepCSRSS) { EngSetLastError(ERROR_INVALID_ACCESS); RETURN(FALSE); Index: win32ss/user/ntuser/userfuncs.h =================================================================== --- win32ss/user/ntuser/userfuncs.h (rvision 58607) +++ win32ss/user/ntuser/userfuncs.h (copie de travail) @@ -37,6 +37,10 @@ PWND FASTCALL IntGetWindowObject(HWND hWnd); +/*************** MAIN.C ***************/ + +NTSTATUS NTAPI UserCreateThreadInfo(struct _ETHREAD *Thread); + /*************** WINSTA.C ***************/ HWINSTA FASTCALL UserGetProcessWindowStation(VOID); Index: win32ss/user/ntuser/window.c =================================================================== --- win32ss/user/ntuser/window.c (rvision 58607) +++ win32ss/user/ntuser/window.c (copie de travail) @@ -3720,6 +3720,10 @@ DWORD APIENTRY NtUserQueryWindow(HWND hWnd, DWORD Index) { +/* Console Leader Process CID Window offsets */ +#define GWLP_CONSOLE_LEADER_PID 0 +#define GWLP_CONSOLE_LEADER_TID 4 + PWND pWnd; DWORD Result; DECLARE_RETURN(UINT); @@ -3735,12 +3739,36 @@ switch(Index) { case QUERY_WINDOW_UNIQUE_PROCESS_ID: - Result = (DWORD)IntGetWndProcessId(pWnd); + { + if ( (pWnd->head.pti->TIF_flags & TIF_CSRSSTHREAD) && + ( (pWnd->pcls->atomClassName == gaGuiConsoleWndClass) || + (pWnd->pcls->atomClassName == gaTuiConsoleWndClass) ) ) + { + // IntGetWindowLong(offset == GWLP_CONSOLE_LEADER_PID) + Result = (DWORD)(*((LONG_PTR*)((PCHAR)(pWnd + 1) + GWLP_CONSOLE_LEADER_PID))); + } + else + { + Result = (DWORD)IntGetWndProcessId(pWnd); + } break; + } case QUERY_WINDOW_UNIQUE_THREAD_ID: - Result = (DWORD)IntGetWndThreadId(pWnd); + { + if ( (pWnd->head.pti->TIF_flags & TIF_CSRSSTHREAD) && + ( (pWnd->pcls->atomClassName == gaGuiConsoleWndClass) || + (pWnd->pcls->atomClassName == gaTuiConsoleWndClass) ) ) + { + // IntGetWindowLong(offset == GWLP_CONSOLE_LEADER_TID) + Result = (DWORD)(*((LONG_PTR*)((PCHAR)(pWnd + 1) + GWLP_CONSOLE_LEADER_TID))); + } + else + { + Result = (DWORD)IntGetWndThreadId(pWnd); + } break; + } case QUERY_WINDOW_ACTIVE: Result = (DWORD)(pWnd->head.pti->MessageQueue->spwndActive ? UserHMGetHandle(pWnd->head.pti->MessageQueue->spwndActive) : 0); Index: win32ss/user/ntuser/winsta.c =================================================================== --- win32ss/user/ntuser/winsta.c (rvision 58607) +++ win32ss/user/ntuser/winsta.c (copie de travail) @@ -45,7 +45,7 @@ NTSTATUS NTAPI -UserCreateWinstaDirectoy() +UserCreateWinstaDirectory() { PPEB Peb; NTSTATUS Status; Index: win32ss/user/ntuser/winsta.h =================================================================== --- win32ss/user/ntuser/winsta.h (rvision 58607) +++ win32ss/user/ntuser/winsta.h (copie de travail) @@ -71,7 +71,7 @@ NTSTATUS NTAPI InitWindowStationImpl(VOID); -NTSTATUS NTAPI UserCreateWinstaDirectoy(); +NTSTATUS NTAPI UserCreateWinstaDirectory(); VOID APIENTRY IntWinStaObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters); NTSTATUS APIENTRY IntWinStaObjectParse(PWIN32_PARSEMETHOD_PARAMETERS Parameters); Index: win32ss/user/user32/include/user32.h =================================================================== --- win32ss/user/user32/include/user32.h (rvision 58607) +++ win32ss/user/user32/include/user32.h (copie de travail) @@ -38,8 +38,9 @@ #include #include -/* CSRSS Headers */ -#include +/* CSRSS Header */ +#include +#include /* Public Win32K Headers */ #include Index: win32ss/user/user32/include/user32p.h =================================================================== --- win32ss/user/user32/include/user32p.h (rvision 58607) +++ win32ss/user/user32/include/user32p.h (copie de travail) @@ -23,6 +23,7 @@ extern PPROCESSINFO g_ppi; extern ULONG_PTR g_ulSharedDelta; extern PSERVERINFO gpsi; +extern BOOLEAN gfLogonProcess; extern BOOLEAN gfServerProcess; extern PUSER_HANDLE_TABLE gHandleTable; extern PUSER_HANDLE_ENTRY gHandleEntries; Index: win32ss/user/user32/include/user_x.h =================================================================== --- win32ss/user/user32/include/user_x.h (rvision 58607) +++ win32ss/user/user32/include/user_x.h (copie de travail) @@ -109,4 +109,3 @@ #define HOOKID_TO_FLAG(HookId) (1 << ((HookId) + 1)) #define ISITHOOKED(HookId) (GetWin32ClientInfo()->fsHooks & HOOKID_TO_FLAG(HookId) ||\ (GetWin32ClientInfo()->pDeskInfo && GetWin32ClientInfo()->pDeskInfo->fsHooks & HOOKID_TO_FLAG(HookId))) - Index: win32ss/user/user32/misc/dllmain.c =================================================================== --- win32ss/user/user32/misc/dllmain.c (rvision 58607) +++ win32ss/user/user32/misc/dllmain.c (copie de travail) @@ -13,6 +13,7 @@ PUSER_HANDLE_ENTRY gHandleEntries = NULL; PSERVERINFO gpsi = NULL; ULONG_PTR g_ulSharedDelta; +BOOLEAN gfLogonProcess = FALSE; BOOLEAN gfServerProcess = FALSE; WCHAR szAppInit[KEY_LENGTH]; Index: win32ss/user/user32/misc/exit.c =================================================================== --- win32ss/user/user32/misc/exit.c (rvision 58607) +++ win32ss/user/user32/misc/exit.c (copie de travail) @@ -65,27 +65,25 @@ */ BOOL WINAPI ExitWindowsEx(UINT uFlags, - DWORD dwReserved) + DWORD dwReserved) { - CSR_API_MESSAGE Request; - ULONG CsrRequest; - NTSTATUS Status; + NTSTATUS Status; + USER_API_MESSAGE ApiMessage; - CsrRequest = MAKE_CSR_API(EXIT_REACTOS, CSR_GUI); - Request.Data.ExitReactosRequest.Flags = uFlags; - Request.Data.ExitReactosRequest.Reserved = dwReserved; + ApiMessage.Data.ExitReactosRequest.Flags = uFlags; + ApiMessage.Data.ExitReactosRequest.Reserved = dwReserved; - Status = CsrClientCallServer(&Request, - NULL, - CsrRequest, - sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(USERSRV_SERVERDLL_INDEX, UserpExitWindowsEx), + sizeof(CSRSS_EXIT_REACTOS)); + if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); - return(FALSE); + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; } - return(TRUE); + return TRUE; } @@ -95,24 +93,22 @@ BOOL WINAPI RegisterServicesProcess(DWORD ServicesProcessId) { - CSR_API_MESSAGE Request; - ULONG CsrRequest; - NTSTATUS Status; + NTSTATUS Status; + USER_API_MESSAGE ApiMessage; - CsrRequest = MAKE_CSR_API(REGISTER_SERVICES_PROCESS, CSR_GUI); - Request.Data.RegisterServicesProcessRequest.ProcessId = UlongToHandle(ServicesProcessId); + ApiMessage.Data.RegisterServicesProcessRequest.ProcessId = ServicesProcessId; - Status = CsrClientCallServer(&Request, - NULL, - CsrRequest, - sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(USERSRV_SERVERDLL_INDEX, UserpRegisterServicesProcess), + sizeof(CSRSS_REGISTER_SERVICES_PROCESS)); + if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); - return(FALSE); + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; } - return(TRUE); + return TRUE; } /* EOF */ Index: win32ss/user/user32/misc/misc.c =================================================================== --- win32ss/user/user32/misc/misc.c (rvision 58607) +++ win32ss/user/user32/misc/misc.c (copie de travail) @@ -42,7 +42,29 @@ WINAPI RegisterLogonProcess(DWORD dwProcessId, BOOL bRegister) { - return NtUserxRegisterLogonProcess(dwProcessId,bRegister); + gfLogonProcess = NtUserxRegisterLogonProcess(dwProcessId, bRegister); + + if (gfLogonProcess) + { + NTSTATUS Status; + USER_API_MESSAGE ApiMessage; + + ApiMessage.Data.RegisterLogonProcessRequest.ProcessId = dwProcessId; + ApiMessage.Data.RegisterLogonProcessRequest.Register = bRegister; + + Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(USERSRV_SERVERDLL_INDEX, UserpRegisterLogonProcess), + sizeof(CSRSS_REGISTER_LOGON_PROCESS)); + if (!NT_SUCCESS(Status)) + { + ERR("Failed to register logon process with CSRSS\n"); + SetLastError(RtlNtStatusToDosError(Status)); + // return FALSE; + } + } + + return gfLogonProcess; } /* @@ -50,27 +72,9 @@ */ BOOL WINAPI -SetLogonNotifyWindow (HWND Wnd, HWINSTA WinSta) +SetLogonNotifyWindow(HWND Wnd, HWINSTA WinSta) { - /* Maybe we should call NtUserSetLogonNotifyWindow and let that one inform CSRSS??? */ - CSR_API_MESSAGE Request; - ULONG CsrRequest; - NTSTATUS Status; - - CsrRequest = MAKE_CSR_API(SET_LOGON_NOTIFY_WINDOW, CSR_GUI); - Request.Data.SetLogonNotifyWindowRequest.LogonNotifyWindow = Wnd; - - Status = CsrClientCallServer(&Request, - NULL, - CsrRequest, - sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return(FALSE); - } - - return NtUserSetLogonNotifyWindow(Wnd); + return NtUserSetLogonNotifyWindow(Wnd); } /* @@ -78,10 +82,10 @@ */ BOOL WINAPI UpdatePerUserSystemParameters( - DWORD dwReserved, - BOOL bEnable) + DWORD dwReserved, + BOOL bEnable) { - return NtUserUpdatePerUserSystemParameters(dwReserved, bEnable); + return NtUserUpdatePerUserSystemParameters(dwReserved, bEnable); } PTHREADINFO Index: win32ss/user/winsrv/CMakeLists.txt =================================================================== --- win32ss/user/winsrv/CMakeLists.txt (rvision 0) +++ win32ss/user/winsrv/CMakeLists.txt (copie de travail) @@ -0,0 +1,27 @@ + +include_directories( + ${REACTOS_SOURCE_DIR}/include/reactos/subsys + ${REACTOS_SOURCE_DIR}/win32ss/include) + +spec2def(winsrv.dll winsrv.spec) + +list(APPEND SOURCE + harderror.c + init.c + register.c + shutdown.c + winsrv.rc + ${CMAKE_CURRENT_BINARY_DIR}/winsrv.def) + +add_library(winsrv SHARED ${SOURCE}) + +target_link_libraries(winsrv win32ksys ${PSEH_LIB}) # win32ksys because of NtUser...() + +set_module_type(winsrv win32dll UNICODE) + +# add_importlibs(winsrv psapi msvcrt kernel32 ntdll csrsrv) +add_importlibs(winsrv msvcrt kernel32 ntdll csrsrv) +add_delay_importlibs(winsrv user32 gdi32 advapi32) + +add_dependencies(winsrv bugcodes) +add_cd_file(TARGET winsrv DESTINATION reactos/system32 FOR all) Index: win32ss/user/winsrv/CMakeLists.txt =================================================================== --- win32ss/user/winsrv/CMakeLists.txt (rvision 58607) +++ win32ss/user/winsrv/CMakeLists.txt (copie de travail) Modification de proprits sur win32ss/user/winsrv/CMakeLists.txt ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/harderror.c =================================================================== --- win32ss/user/winsrv/harderror.c (rvision 0) +++ win32ss/user/winsrv/harderror.c (copie de travail) @@ -0,0 +1,586 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS User API Server DLL + * FILE: win32ss/user/winsrv/harderror.c + * PURPOSE: Hard errors + * PROGRAMMERS: Dmitry Philippov (shedon@mail.ru) + * Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include "winsrv.h" + +#define NDEBUG +#include + +#include + +#define IDTRYAGAIN 10 +#define IDCONTINUE 11 + +/* FUNCTIONS ******************************************************************/ + +static +NTSTATUS +CsrpGetClientFileName( + OUT PUNICODE_STRING ClientFileNameU, + HANDLE hProcess) +{ + PLIST_ENTRY ModuleListHead; + PLIST_ENTRY Entry; + PLDR_DATA_TABLE_ENTRY Module; + PPEB_LDR_DATA Ldr; + PROCESS_BASIC_INFORMATION ClientBasicInfo; + LDR_DATA_TABLE_ENTRY ModuleData; + PVOID ClientDllBase; + NTSTATUS Status; + PPEB Peb; + + /* Initialize string */ + ClientFileNameU->MaximumLength = 0; + ClientFileNameU->Length = 0; + ClientFileNameU->Buffer = NULL; + + /* Query process information */ + Status = NtQueryInformationProcess(hProcess, + ProcessBasicInformation, + &ClientBasicInfo, + sizeof(ClientBasicInfo), + NULL); + if (!NT_SUCCESS(Status)) return Status; + + Peb = ClientBasicInfo.PebBaseAddress; + if (!Peb) return STATUS_UNSUCCESSFUL; + + Status = NtReadVirtualMemory(hProcess, &Peb->Ldr, &Ldr, sizeof(Ldr), NULL); + if (!NT_SUCCESS(Status)) return Status; + + ModuleListHead = &Ldr->InLoadOrderModuleList; + Status = NtReadVirtualMemory(hProcess, + &ModuleListHead->Flink, + &Entry, + sizeof(Entry), + NULL); + if (!NT_SUCCESS(Status)) return Status; + + if (Entry == ModuleListHead) return STATUS_UNSUCCESSFUL; + + Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks); + + Status = NtReadVirtualMemory(hProcess, + Module, + &ModuleData, + sizeof(ModuleData), + NULL); + if (!NT_SUCCESS(Status)) return Status; + + Status = NtReadVirtualMemory(hProcess, + &Peb->ImageBaseAddress, + &ClientDllBase, + sizeof(ClientDllBase), + NULL); + if (!NT_SUCCESS(Status)) return Status; + + if (ClientDllBase != ModuleData.DllBase) return STATUS_UNSUCCESSFUL; + + ClientFileNameU->MaximumLength = ModuleData.BaseDllName.MaximumLength; + ClientFileNameU->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + ClientFileNameU->MaximumLength); + + Status = NtReadVirtualMemory(hProcess, + ModuleData.BaseDllName.Buffer, + ClientFileNameU->Buffer, + ClientFileNameU->MaximumLength, + NULL); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, ClientFileNameU->Buffer); + ClientFileNameU->Buffer = NULL; + ClientFileNameU->MaximumLength = 0; + return Status; + } + + ClientFileNameU->Length = wcslen(ClientFileNameU->Buffer)*sizeof(wchar_t); + DPRINT("ClientFileNameU=\'%wZ\'\n", &ClientFileNameU); + + return STATUS_SUCCESS; +} + +static +VOID +CsrpFreeStringParameters( + IN OUT PULONG_PTR Parameters, + IN PHARDERROR_MSG HardErrorMessage) +{ + ULONG nParam; + + /* Loop all parameters */ + for (nParam = 0; nParam < HardErrorMessage->NumberOfParameters; nParam++) + { + /* Check if the current parameter is a string */ + if (HardErrorMessage->UnicodeStringParameterMask & (1 << nParam) && Parameters[nParam]) + { + /* Free the string buffer */ + RtlFreeHeap(RtlGetProcessHeap(), 0, (PVOID)Parameters[nParam]); + } + } +} + +static +NTSTATUS +CsrpCaptureStringParameters( + OUT PULONG_PTR Parameters, + OUT PULONG SizeOfAllUnicodeStrings, + IN PHARDERROR_MSG HardErrorMessage, + HANDLE hProcess) +{ + ULONG nParam, Size = 0; + NTSTATUS Status = STATUS_SUCCESS; + UNICODE_STRING TempStringU, ParamStringU; + ANSI_STRING TempStringA; + + if (SizeOfAllUnicodeStrings) + *SizeOfAllUnicodeStrings = 0; + + /* Read all strings from client space */ + for (nParam = 0; nParam < HardErrorMessage->NumberOfParameters; nParam++) + { + Parameters[nParam] = 0; + + /* Check if the current parameter is a unicode string */ + if (HardErrorMessage->UnicodeStringParameterMask & (1 << nParam)) + { + /* Read the UNICODE_STRING from the process memory */ + Status = NtReadVirtualMemory(hProcess, + (PVOID)HardErrorMessage->Parameters[nParam], + &ParamStringU, + sizeof(ParamStringU), + NULL); + + if (!NT_SUCCESS(Status)) + break; + + /* Allocate a buffer for the string */ + TempStringU.MaximumLength = ParamStringU.Length; + TempStringU.Length = ParamStringU.Length; + TempStringU.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + TempStringU.MaximumLength); + + if (!TempStringU.Buffer) + { + DPRINT1("Cannot allocate memory %u\n", TempStringU.MaximumLength); + Status = STATUS_NO_MEMORY; + } + + /* Read the string buffer from the process memory */ + Status = NtReadVirtualMemory(hProcess, + ParamStringU.Buffer, + TempStringU.Buffer, + ParamStringU.Length, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtReadVirtualMemory failed with code: %lx\n", Status); + RtlFreeHeap(RtlGetProcessHeap(), 0, TempStringU.Buffer); + break; + } + + DPRINT("ParamString=\'%wZ\'\n", &TempStringU); + + /* Allocate a buffer for converted to ANSI string */ + TempStringA.MaximumLength = RtlUnicodeStringToAnsiSize(&TempStringU); + TempStringA.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + TempStringA.MaximumLength); + + if (!TempStringA.Buffer) + { + DPRINT1("Cannot allocate memory %u\n", TempStringA.MaximumLength); + RtlFreeHeap(RtlGetProcessHeap(), 0, TempStringU.Buffer); + Status = STATUS_NO_MEMORY; + break; + } + + /* Convert string to ANSI and free temporary buffer */ + Status = RtlUnicodeStringToAnsiString(&TempStringA, &TempStringU, FALSE); + RtlFreeHeap(RtlGetProcessHeap(), 0, TempStringU.Buffer); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, TempStringA.Buffer); + break; + } + + /* Note: RtlUnicodeStringToAnsiString returns NULL terminated string */ + Parameters[nParam] = (ULONG_PTR)TempStringA.Buffer; + Size += TempStringU.Length; + } + else + { + /* It's not a unicode string */ + Parameters[nParam] = HardErrorMessage->Parameters[nParam]; + } + } + + if (!NT_SUCCESS(Status)) + { + CsrpFreeStringParameters(Parameters, HardErrorMessage); + return Status; + } + + if (SizeOfAllUnicodeStrings) + *SizeOfAllUnicodeStrings = Size; + + return Status; +} + +static +NTSTATUS +CsrpFormatMessages( + OUT PUNICODE_STRING TextStringU, + OUT PUNICODE_STRING CaptionStringU, + IN PULONG_PTR Parameters, + IN ULONG SizeOfStrings, + IN PHARDERROR_MSG Message, + IN HANDLE hProcess) +{ + NTSTATUS Status; + UNICODE_STRING FileNameU, TempStringU, FormatU; + ANSI_STRING FormatA; + PMESSAGE_RESOURCE_ENTRY MessageResource; + PWSTR FormatString; + ULONG Size, ExceptionCode; + + /* Get the file name of the client process */ + CsrpGetClientFileName(&FileNameU, hProcess); + + /* Check if we have a file name */ + if (!FileNameU.Buffer) + { + /* No, use system */ + RtlInitUnicodeString(&FileNameU, L"System"); + } + + /* Get text string of the error code */ + Status = RtlFindMessage(GetModuleHandleW(L"ntdll"), + (ULONG_PTR)RT_MESSAGETABLE, + LANG_NEUTRAL, + Message->Status, + &MessageResource); + + if (NT_SUCCESS(Status)) + { + if (MessageResource->Flags) + { + RtlInitUnicodeString(&FormatU, (PWSTR)MessageResource->Text); + FormatA.Buffer = NULL; + } + else + { + RtlInitAnsiString(&FormatA, (PCHAR)MessageResource->Text); + RtlAnsiStringToUnicodeString(&FormatU, &FormatA, TRUE); + } + } + else + { + /* Fall back to hardcoded value */ + RtlInitUnicodeString(&FormatU, L"Unknown Hard Error"); + FormatA.Buffer = NULL; + } + + FormatString = FormatU.Buffer; + + /* Check whether a caption exists */ + if (FormatString[0] == L'{') + { + /* Set caption start */ + TempStringU.Buffer = ++FormatString; + + /* Get size of the caption */ + for (Size = 0; *FormatString != 0 && *FormatString != L'}'; Size++) + FormatString++; + + /* Skip '}', '\r', '\n' */ + FormatString += 3; + + TempStringU.Length = Size * sizeof(WCHAR); + TempStringU.MaximumLength = TempStringU.Length; + } + else + { + /* FIXME: Set string based on severity */ + RtlInitUnicodeString(&TempStringU, L"Application Error"); + } + + /* Calculate buffer length for the caption */ + CaptionStringU->MaximumLength = FileNameU.Length + TempStringU.Length + + 4 * sizeof(WCHAR); + + /* Allocate a buffer for the caption */ + CaptionStringU->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + CaptionStringU->MaximumLength); + + /* Append the file name, seperator and the caption text */ + CaptionStringU->Length = 0; + RtlAppendUnicodeStringToString(CaptionStringU, &FileNameU); + RtlAppendUnicodeToString(CaptionStringU, L" - "); + RtlAppendUnicodeStringToString(CaptionStringU, &TempStringU); + + /* Zero terminate the buffer */ + CaptionStringU->Buffer[CaptionStringU->Length / sizeof(WCHAR)] = 0; + + /* Free the file name buffer */ + RtlFreeUnicodeString(&FileNameU); + + /* Check if this is an exception message */ + if (Message->Status == STATUS_UNHANDLED_EXCEPTION) + { + ExceptionCode = Parameters[0]; + + /* Handle special cases */ + if (ExceptionCode == STATUS_ACCESS_VIOLATION) + { + Parameters[0] = Parameters[1]; + Parameters[1] = Parameters[3]; + if (Parameters[2]) Parameters[2] = (ULONG_PTR)L"written"; + else Parameters[2] = (ULONG_PTR)L"read"; + MessageResource = NULL; + } + else if (ExceptionCode == STATUS_IN_PAGE_ERROR) + { + Parameters[0] = Parameters[1]; + Parameters[1] = Parameters[3]; + MessageResource = NULL; + } + else + { + /* Fall back to hardcoded value */ + Parameters[2] = Parameters[1]; + Parameters[1] = Parameters[0]; + Parameters[0] = (ULONG_PTR)L"unknown software exception"; + } + + if (!MessageResource) + { + /* Get text string of the exception code */ + Status = RtlFindMessage(GetModuleHandleW(L"ntdll"), + (ULONG_PTR)RT_MESSAGETABLE, + LANG_NEUTRAL, + ExceptionCode, + &MessageResource); + + if (NT_SUCCESS(Status)) + { + if (FormatA.Buffer) RtlFreeUnicodeString(&FormatU); + + if (MessageResource->Flags) + { + RtlInitUnicodeString(&FormatU, (PWSTR)MessageResource->Text); + FormatA.Buffer = NULL; + } + else + { + RtlInitAnsiString(&FormatA, (PCHAR)MessageResource->Text); + RtlAnsiStringToUnicodeString(&FormatU, &FormatA, TRUE); + } + FormatString = FormatU.Buffer; + } + else + { + /* Fall back to hardcoded value */ + Parameters[2] = Parameters[1]; + Parameters[1] = Parameters[0]; + Parameters[0] = (ULONG_PTR)L"unknown software exception"; + } + } + } + + /* Calculate length of text buffer */ + TextStringU->MaximumLength = FormatU.Length + SizeOfStrings + 42 * sizeof(WCHAR); + + /* Allocate a buffer for the text */ + TextStringU->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + TextStringU->MaximumLength); + + /* Wrap in SEH to protect from invalid string parameters */ + _SEH2_TRY + { + /* Print the string into the buffer */ + StringCbPrintfW(TextStringU->Buffer, + TextStringU->MaximumLength, + FormatString, + Parameters[0], + Parameters[1], + Parameters[2], + Parameters[3]); + Status = STATUS_SUCCESS; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* Set error and free buffers */ + Status = _SEH2_GetExceptionCode(); + RtlFreeHeap(RtlGetProcessHeap(), 0, TextStringU->Buffer); + RtlFreeHeap(RtlGetProcessHeap(), 0, CaptionStringU->Buffer); + } + _SEH2_END + + if (NT_SUCCESS(Status)) + { + TextStringU->Length = wcslen(TextStringU->Buffer) * sizeof(WCHAR); + } + + if (FormatA.Buffer) RtlFreeUnicodeString(&FormatU); + + return Status; +} + +static +ULONG +CsrpMessageBox( + PWSTR Text, + PWSTR Caption, + ULONG ValidResponseOptions, + ULONG Severity) +{ + ULONG Type, MessageBoxResponse; + + /* Set the message box type */ + switch (ValidResponseOptions) + { + case OptionAbortRetryIgnore: + Type = MB_ABORTRETRYIGNORE; + break; + case OptionOk: + Type = MB_OK; + break; + case OptionOkCancel: + Type = MB_OKCANCEL; + break; + case OptionRetryCancel: + Type = MB_RETRYCANCEL; + break; + case OptionYesNo: + Type = MB_YESNO; + break; + case OptionYesNoCancel: + Type = MB_YESNOCANCEL; + break; + case OptionShutdownSystem: + Type = MB_RETRYCANCEL; // FIXME??? + break; + /* Anything else is invalid */ + default: + return ResponseNotHandled; + } + + /* Set severity */ + if (Severity == STATUS_SEVERITY_INFORMATIONAL) Type |= MB_ICONINFORMATION; + else if (Severity == STATUS_SEVERITY_WARNING) Type |= MB_ICONWARNING; + else if (Severity == STATUS_SEVERITY_ERROR) Type |= MB_ICONERROR; + + Type |= MB_SYSTEMMODAL | MB_SETFOREGROUND; + + DPRINT("Text = '%S', Caption = '%S', Severity = %d, Type = 0x%lx\n", + Text, Caption, Severity, Type); + + /* Display a message box */ + MessageBoxResponse = MessageBoxW(0, Text, Caption, Type); + + /* Return response value */ + switch (MessageBoxResponse) + { + case IDOK: return ResponseOk; + case IDCANCEL: return ResponseCancel; + case IDYES: return ResponseYes; + case IDNO: return ResponseNo; + case IDABORT: return ResponseAbort; + case IDIGNORE: return ResponseIgnore; + case IDRETRY: return ResponseRetry; + case IDTRYAGAIN: return ResponseTryAgain; + case IDCONTINUE: return ResponseContinue; + } + + return ResponseNotHandled; +} + +VOID +WINAPI +UserServerHardError( + IN PCSR_THREAD ThreadData, + IN PHARDERROR_MSG Message) +{ +#if DBG + PCSR_PROCESS ProcessData = ThreadData->Process; +#endif + ULONG_PTR Parameters[MAXIMUM_HARDERROR_PARAMETERS]; + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING TextU, CaptionU; + NTSTATUS Status; + HANDLE hProcess; + ULONG Size; + + /* Default to not handled */ + ASSERT(ProcessData != NULL); + Message->Response = ResponseNotHandled; + + /* Make sure we don't have too many parameters */ + if (Message->NumberOfParameters > MAXIMUM_HARDERROR_PARAMETERS) + Message->NumberOfParameters = MAXIMUM_HARDERROR_PARAMETERS; + + /* Initialize object attributes */ + InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL); + + /* Open client process */ + Status = NtOpenProcess(&hProcess, + PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, + &ObjectAttributes, + &Message->h.ClientId); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtOpenProcess failed with code: %lx\n", Status); + return; + } + + /* Capture all string parameters from the process memory */ + Status = CsrpCaptureStringParameters(Parameters, &Size, Message, hProcess); + if (!NT_SUCCESS(Status)) + { + NtClose(hProcess); + return; + } + + /* Format the caption and message box text */ + Status = CsrpFormatMessages(&TextU, + &CaptionU, + Parameters, + Size, + Message, + hProcess); + + /* Cleanup */ + CsrpFreeStringParameters(Parameters, Message); + NtClose(hProcess); + + if (!NT_SUCCESS(Status)) + { + return; + } + + /* Display the message box */ + Message->Response = CsrpMessageBox(TextU.Buffer, + CaptionU.Buffer, + Message->ValidResponseOptions, + (ULONG)Message->Status >> 30); + + RtlFreeUnicodeString(&TextU); + RtlFreeUnicodeString(&CaptionU); + + return; +} + +/* EOF */ Index: win32ss/user/winsrv/harderror.c =================================================================== --- win32ss/user/winsrv/harderror.c (rvision 58607) +++ win32ss/user/winsrv/harderror.c (copie de travail) Modification de proprits sur win32ss/user/winsrv/harderror.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/init.c =================================================================== --- win32ss/user/winsrv/init.c (rvision 58607) +++ win32ss/user/winsrv/init.c (copie de travail) @@ -1,129 +1,337 @@ /* - * init.c - ReactOS/Win32 Console+User Enviroment Subsystem Server - Initialization - * - * ReactOS Operating System - * - * -------------------------------------------------------------------- - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * -------------------------------------------------------------------- + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS User API Server DLL + * FILE: win32ss/user/winsrv/init.c + * PURPOSE: Initialization + * PROGRAMMERS: Dmitry Philippov (shedon@mail.ru) + * Hermes Belusca-Maito (hermes.belusca@sfr.fr) */ + +/* INCLUDES *******************************************************************/ + #include "winsrv.h" -//#define NDEBUG +#define NDEBUG #include -HANDLE WinSrvApiPort = NULL; +/* GLOBALS ********************************************************************/ -/********************************************************************** - * NAME PRIVATE - * ConStaticServerThread/1 - */ -VOID WINAPI ConStaticServerThread (PVOID x) +HINSTANCE UserServerDllInstance = NULL; + +/* Memory */ +HANDLE UserServerHeap = NULL; // Our own heap. + +// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3 +PCSR_API_ROUTINE UserServerApiDispatchTable[UserpMaxApiNumber - USERSRV_FIRST_API_NUMBER] = { - NTSTATUS Status = STATUS_SUCCESS; - PPORT_MESSAGE Request = (PPORT_MESSAGE) x; - PPORT_MESSAGE Reply = NULL; - ULONG MessageType = 0; + SrvExitWindowsEx, + // SrvEndTask, + // SrvLogon, + SrvRegisterServicesProcess, // Not present in Win7 + // SrvActivateDebugger, + // SrvGetThreadConsoleDesktop, // Not present in Win7 + // SrvDeviceEvent, + SrvRegisterLogonProcess, // Not present in Win7 + // SrvCreateSystemThreads, + // SrvRecordShutdownReason, + // SrvCancelShutdown, // Added in Vista + // SrvConsoleHandleOperation, // Added in Win7 + // SrvGetSetShutdownBlockReason, // Added in Vista +}; - DPRINT("WINSRV: %s(%08lx) called\n", __FUNCTION__, x); +BOOLEAN UserServerApiServerValidTable[UserpMaxApiNumber - USERSRV_FIRST_API_NUMBER] = +{ + FALSE, // SrvExitWindowsEx + // FALSE, // SrvEndTask + // FALSE, // SrvLogon + FALSE, // SrvRegisterServicesProcess + // FALSE, // SrvActivateDebugger + // TRUE, // SrvGetThreadConsoleDesktop + // FALSE, // SrvDeviceEvent + FALSE, // SrvRegisterLogonProcess + // FALSE, // SrvCreateSystemThreads + // FALSE, // SrvRecordShutdownReason + // FALSE, // SrvCancelShutdown + // FALSE, // SrvConsoleHandleOperation + // FALSE, // SrvGetSetShutdownBlockReason +}; - MessageType = Request->u2.s2.Type; - DPRINT("WINSRV: %s(%08lx) received a message (Type=%d)\n", - __FUNCTION__, x, MessageType); - switch (MessageType) - { - default: - Reply = Request; - Status = NtReplyPort (WinSrvApiPort, Reply); - break; - } +PCHAR UserServerApiNameTable[UserpMaxApiNumber - USERSRV_FIRST_API_NUMBER] = +{ + "SrvExitWindowsEx", + // "SrvEndTask", + // "SrvLogon", + "SrvRegisterServicesProcess", + // "SrvActivateDebugger", + // "SrvGetThreadConsoleDesktop", + // "SrvDeviceEvent", + "SrvRegisterLogonProcess", + // "SrvCreateSystemThreads", + // "SrvRecordShutdownReason", + // "SrvCancelShutdown", + // "SrvConsoleHandleOperation", + // "SrvGetSetShutdownBlockReason", +}; + + +/* FUNCTIONS ******************************************************************/ + +// PUSER_SOUND_SENTRY. Used in basesrv.dll +BOOL WINAPI _UserSoundSentry(VOID) +{ + // TODO: Do something. + return TRUE; } +ULONG +InitializeVideoAddressSpace(VOID) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING PhysMemName = RTL_CONSTANT_STRING(L"\\Device\\PhysicalMemory"); + NTSTATUS Status; + HANDLE PhysMemHandle; + PVOID BaseAddress; + LARGE_INTEGER Offset; + SIZE_T ViewSize; + CHAR IVTAndBda[1024+256]; + + /* Free the 1MB pre-reserved region. In reality, ReactOS should simply support us mapping the view into the reserved area, but it doesn't. */ + BaseAddress = 0; + ViewSize = 1024 * 1024; + Status = ZwFreeVirtualMemory(NtCurrentProcess(), + &BaseAddress, + &ViewSize, + MEM_RELEASE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Couldn't unmap reserved memory (%x)\n", Status); + return 0; + } + + /* Open the physical memory section */ + InitializeObjectAttributes(&ObjectAttributes, + &PhysMemName, + 0, + NULL, + NULL); + Status = ZwOpenSection(&PhysMemHandle, + SECTION_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Couldn't open \\Device\\PhysicalMemory\n"); + return 0; + } + + /* Map the BIOS and device registers into the address space */ + Offset.QuadPart = 0xa0000; + ViewSize = 0x100000 - 0xa0000; + BaseAddress = (PVOID)0xa0000; + Status = ZwMapViewOfSection(PhysMemHandle, + NtCurrentProcess(), + &BaseAddress, + 0, + ViewSize, + &Offset, + &ViewSize, + ViewUnmap, + 0, + PAGE_EXECUTE_READWRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Couldn't map physical memory (%x)\n", Status); + ZwClose(PhysMemHandle); + return 0; + } + + /* Close physical memory section handle */ + ZwClose(PhysMemHandle); + + if (BaseAddress != (PVOID)0xa0000) + { + DPRINT1("Couldn't map physical memory at the right address (was %x)\n", + BaseAddress); + return 0; + } + + /* Allocate some low memory to use for the non-BIOS + * parts of the v86 mode address space + */ + BaseAddress = (PVOID)0x1; + ViewSize = 0xa0000 - 0x1000; + Status = ZwAllocateVirtualMemory(NtCurrentProcess(), + &BaseAddress, + 0, + &ViewSize, + MEM_RESERVE | MEM_COMMIT, + PAGE_EXECUTE_READWRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to allocate virtual memory (Status %x)\n", Status); + return 0; + } + if (BaseAddress != (PVOID)0x0) + { + DPRINT1("Failed to allocate virtual memory at right address (was %x)\n", + BaseAddress); + return 0; + } + + /* Get the real mode IVT and BDA from the kernel */ + Status = NtVdmControl(VdmInitialize, IVTAndBda); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtVdmControl failed (status %x)\n", Status); + return 0; + } + + /* Return success */ + return 1; +} + /********************************************************************** - * NAME PRIVATE - * UserStaticServerThread/1 + * CsrpInitVideo/3 + * + * TODO: we need a virtual device for sessions other than + * TODO: the console one */ -VOID WINAPI UserStaticServerThread (PVOID x) +NTSTATUS +CsrpInitVideo(VOID) { - NTSTATUS Status = STATUS_SUCCESS; - PPORT_MESSAGE Request = (PPORT_MESSAGE) x; - PPORT_MESSAGE Reply = NULL; - ULONG MessageType = 0; + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\??\\DISPLAY1"); + IO_STATUS_BLOCK Iosb; + HANDLE VideoHandle = (HANDLE) 0; + NTSTATUS Status = STATUS_SUCCESS; - DPRINT("WINSRV: %s(%08lx) called\n", __FUNCTION__, x); + DPRINT("CSR: %s called\n", __FUNCTION__); - MessageType = Request->u2.s2.Type; - DPRINT("WINSRV: %s(%08lx) received a message (Type=%d)\n", - __FUNCTION__, x, MessageType); - switch (MessageType) - { - default: - Reply = Request; - Status = NtReplyPort (WinSrvApiPort, Reply); - break; - } + InitializeVideoAddressSpace(); + + InitializeObjectAttributes(&ObjectAttributes, + &DeviceName, + 0, + NULL, + NULL); + Status = NtOpenFile(&VideoHandle, + FILE_ALL_ACCESS, + &ObjectAttributes, + &Iosb, + 0, + 0); + if (NT_SUCCESS(Status)) + { + NtClose(VideoHandle); + } + + return Status; } -/*===================================================================== - * PUBLIC API - *===================================================================*/ +VOID +WINAPI +PrivateCsrssManualGuiCheck(LONG Check) +{ + NtUserCallOneParam(Check, ONEPARAM_ROUTINE_CSRSS_GUICHECK); +} -NTSTATUS WINAPI ConServerDllInitialization (ULONG ArgumentCount, - LPWSTR *Argument) +/*** HACK from win32csr... ***/ +static HHOOK hhk = NULL; + +LRESULT +CALLBACK +KeyboardHookProc(int nCode, + WPARAM wParam, + LPARAM lParam) { - NTSTATUS Status = STATUS_SUCCESS; - - DPRINT("WINSRV: %s called\n", __FUNCTION__); + return CallNextHookEx(hhk, nCode, wParam, lParam); +} +/*** END - HACK from win32csr... ***/ - // Get the listening port from csrsrv.dll - WinSrvApiPort = CsrQueryApiPort (); - if (NULL == WinSrvApiPort) - { - return STATUS_UNSUCCESSFUL; - } - // Register our message dispatcher - Status = CsrAddStaticServerThread (ConStaticServerThread); - if (NT_SUCCESS(Status)) - { - //TODO: perform the real console server internal initialization here - } - return Status; +DWORD +WINAPI +CreateSystemThreads(PVOID pParam) +{ + NtUserCallOneParam((DWORD)pParam, ONEPARAM_ROUTINE_CREATESYSTEMTHREADS); + DPRINT1("This thread should not terminate!\n"); + return 0; } -NTSTATUS WINAPI UserServerDllInitialization (ULONG ArgumentCount, - LPWSTR *Argument) +CSR_SERVER_DLL_INIT(UserServerDllInitialization) { - NTSTATUS Status = STATUS_SUCCESS; - - DPRINT("WINSRV: %s called\n", __FUNCTION__); +/*** From win32csr... ***/ + HANDLE ServerThread; + CLIENT_ID ClientId; + NTSTATUS Status; + UINT i; +/*** END - From win32csr... ***/ - // Get the listening port from csrsrv.dll - WinSrvApiPort = CsrQueryApiPort (); - if (NULL == WinSrvApiPort) - { - return STATUS_UNSUCCESSFUL; - } - // Register our message dispatcher - Status = CsrAddStaticServerThread (UserStaticServerThread); - if (NT_SUCCESS(Status)) - { - //TODO: perform the real user server internal initialization here - } - return Status; + /* Initialize the memory */ + UserServerHeap = RtlGetProcessHeap(); + + /* Initialize the video */ + CsrpInitVideo(); + NtUserInitialize(0, NULL, NULL); + PrivateCsrssManualGuiCheck(0); + + /* Setup the DLL Object */ + LoadedServerDll->ApiBase = USERSRV_FIRST_API_NUMBER; + LoadedServerDll->HighestApiSupported = UserpMaxApiNumber; + LoadedServerDll->DispatchTable = UserServerApiDispatchTable; + LoadedServerDll->ValidTable = UserServerApiServerValidTable; + LoadedServerDll->NameTable = UserServerApiNameTable; + LoadedServerDll->SizeOfProcessData = 0; + LoadedServerDll->ConnectCallback = NULL; + LoadedServerDll->DisconnectCallback = NULL; + LoadedServerDll->HardErrorCallback = UserServerHardError; + LoadedServerDll->ShutdownProcessCallback = NULL; + + UserServerDllInstance = LoadedServerDll->ServerHandle; + +/*** From win32csr... See r54125 ***/ + /* Start the Raw Input Thread and the Desktop Thread */ + for (i = 0; i < 2; ++i) + { + Status = RtlCreateUserThread(NtCurrentProcess(), NULL, TRUE, 0, 0, 0, (PTHREAD_START_ROUTINE)CreateSystemThreads, (PVOID)i, &ServerThread, &ClientId); + if (NT_SUCCESS(Status)) + { + NtResumeThread(ServerThread, NULL); + NtClose(ServerThread); + } + else + DPRINT1("Cannot start Raw Input Thread!\n"); + } +/*** END - From win32csr... ***/ + + /* All done */ + return STATUS_SUCCESS; } +BOOL +WINAPI +DllMain(IN HINSTANCE hInstanceDll, + IN DWORD dwReason, + IN LPVOID lpReserved) +{ + UNREFERENCED_PARAMETER(hInstanceDll); + UNREFERENCED_PARAMETER(dwReason); + UNREFERENCED_PARAMETER(lpReserved); + + if (DLL_PROCESS_ATTACH == dwReason) + { + DPRINT1("WINSRV - HACK: Use keyboard hook hack\n"); +/*** HACK from win32csr... ***/ +// +// HACK HACK HACK ReactOS to BOOT! Initialization BUG ALERT! See bug 5655. +// + hhk = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHookProc, NULL, 0); +// BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! +// BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! +// BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! BUG ALERT! + +/*** END - HACK from win32csr... ***/ + } + + return TRUE; +} + /* EOF */ Index: win32ss/user/winsrv/lang =================================================================== --- win32ss/user/winsrv/lang (rvision 58607) +++ win32ss/user/winsrv/lang (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang ___________________________________________________________________ Added: bugtraq:url ## -0,0 +1 ## +http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID% \ No newline at end of property Added: bugtraq:message ## -0,0 +1 ## +See issue #%BUGID% for more details. \ No newline at end of property Added: tsvn:logminsize ## -0,0 +1 ## +10 \ No newline at end of property Added: bugtraq:logregex ## -0,0 +1,2 ## +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+) \ No newline at end of property Index: win32ss/user/winsrv/lang/bg-BG.rc =================================================================== --- win32ss/user/winsrv/lang/bg-BG.rc (rvision 0) +++ win32ss/user/winsrv/lang/bg-BG.rc (copie de travail) @@ -0,0 +1,42 @@ +/* + * PROJECT: ReactOS CSRSS subsystem + * FILE: subsystems/win32/csrss/win32csr/lang/bg-BG.rc + * PURPOSE: Bulgarian resource file + */ + +LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION " - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT " ... ",IDC_STATIC,7,7,186,11 + CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT " , . , .", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "& ",IDC_END_NOW,150,71,60,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION " - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "",IDCANCEL,142,98,43,17 + PUSHBUTTON "& ",IDC_END_NOW,150,71,60,17 + LTEXT " .",IDC_STATIC,7,7,178,8 + LTEXT " , .", + IDC_STATIC,7,26,178,16 + LTEXT " , . , .", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/bg-BG.rc =================================================================== --- win32ss/user/winsrv/lang/bg-BG.rc (rvision 58607) +++ win32ss/user/winsrv/lang/bg-BG.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/bg-BG.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/cs-CZ.rc =================================================================== --- win32ss/user/winsrv/lang/cs-CZ.rc (rvision 0) +++ win32ss/user/winsrv/lang/cs-CZ.rc (copie de travail) @@ -0,0 +1,41 @@ +/* FILE: subsystems/win32/csrss/win32csr/lang/cs-CZ.rc + * TRANSLATOR: Radek Liska aka Black_Fox (radekliska at gmail dot com) + * UPDATED: 2011-04-09 + */ + +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ukonit program - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Probh ukonen programu... ekejte, prosm",IDC_STATIC,7,7,186,11 + CONTROL "Progress",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "IPokud zvolte okamit ukonen programu, vechna neuloen data budou ztracena. Kliknutm na Ukonit okamit ukonte program.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "&Ukonit okamit",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ukonit program - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Storno",IDCANCEL,142,98,43,17 + PUSHBUTTON "&Ukonit okamit",IDC_END_NOW,78,98,43,17 + LTEXT "Tento program neodpovd.",IDC_STATIC,7,7,178,8 + LTEXT "Kliknutm na Storno se lze vrtit do systmu ReactOS a ovit stav programu.", + IDC_STATIC,7,26,178,16 + LTEXT "Pokud zvolte okamit ukonen programu, vechna neuloen data budou ztracena. Kliknutm na Ukonit okamit ukonte program.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/cs-CZ.rc =================================================================== --- win32ss/user/winsrv/lang/cs-CZ.rc (rvision 58607) +++ win32ss/user/winsrv/lang/cs-CZ.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/cs-CZ.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/de-DE.rc =================================================================== --- win32ss/user/winsrv/lang/de-DE.rc (rvision 0) +++ win32ss/user/winsrv/lang/de-DE.rc (copie de travail) @@ -0,0 +1,36 @@ +LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Programm beenden - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Programm wird beendet...",IDC_STATIC,7,7,186,11 + CONTROL "Fortschritt",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "Wenn Sie das Programm sofort beenden, werden Sie eventuell ungespeicherte Daten verlieren. Um das Programm zu beenden, whlen Sie Jetzt beenden.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "J&etzt beenden",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Programm beenden - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Abbechen",IDCANCEL,142,98,43,17 + PUSHBUTTON "J&etzt beenden",IDC_END_NOW,78,98,43,17 + LTEXT "Das Programm reagiert nicht.",IDC_STATIC,7,7,178,8 + LTEXT "Um zu ReactOS zurckzukehren und den Status der Anwendung zu berprfen, whlen Sie Abbrechen.", + IDC_STATIC,7,26,178,16 + LTEXT "Wenn Sie das Programm sofort beenden, werden Sie eventuell ungespeicherte Daten verlieren. Um das Programm zu beenden, whlen Sie Jetzt beenden.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/de-DE.rc =================================================================== --- win32ss/user/winsrv/lang/de-DE.rc (rvision 58607) +++ win32ss/user/winsrv/lang/de-DE.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/de-DE.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/el-GR.rc =================================================================== --- win32ss/user/winsrv/lang/el-GR.rc (rvision 0) +++ win32ss/user/winsrv/lang/el-GR.rc (copie de travail) @@ -0,0 +1,36 @@ +LANGUAGE LANG_GREEK, SUBLANG_DEFAULT + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION " - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT " ... ",IDC_STATIC,7,7,186,11 + CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT " , . , ' '.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "& ",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION " - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "",IDCANCEL,142,98,43,17 + PUSHBUTTON "& ",IDC_END_NOW,78,98,43,17 + LTEXT " .",IDC_STATIC,7,7,178,8 + LTEXT " ReactOS , ''.", + IDC_STATIC,7,26,178,16 + LTEXT " , . , ' '.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/el-GR.rc =================================================================== --- win32ss/user/winsrv/lang/el-GR.rc (rvision 58607) +++ win32ss/user/winsrv/lang/el-GR.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/el-GR.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/en-US.rc =================================================================== --- win32ss/user/winsrv/lang/en-US.rc (rvision 0) +++ win32ss/user/winsrv/lang/en-US.rc (copie de travail) @@ -0,0 +1,36 @@ +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "End Program - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Ending Program... Please wait",IDC_STATIC,7,7,186,11 + CONTROL "Progress",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "If you choose to end the program immediately, you will lose any unsaved data. To end the program now, click End Now.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "&End Now",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "End Program - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Cancel",IDCANCEL,142,98,43,17 + PUSHBUTTON "&End Now",IDC_END_NOW,78,98,43,17 + LTEXT "This program is not responding.",IDC_STATIC,7,7,178,8 + LTEXT "To return to ReactOS and check the status of the program, click Cancel.", + IDC_STATIC,7,26,178,16 + LTEXT "If you choose to end the program immediately, you will lose any unsaved data. To end the program now, click End Now.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/en-US.rc =================================================================== --- win32ss/user/winsrv/lang/en-US.rc (rvision 58607) +++ win32ss/user/winsrv/lang/en-US.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/en-US.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/es-ES.rc =================================================================== --- win32ss/user/winsrv/lang/es-ES.rc (rvision 0) +++ win32ss/user/winsrv/lang/es-ES.rc (copie de travail) @@ -0,0 +1,41 @@ +/* + * Spanish Language resource file + * Traducido por: Javier Remacha 2008-26-01 + */ + +LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Finalizar programa - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Finalizando programa... Por favor, espere",IDC_STATIC,7,7,186,11 + CONTROL "Progreso",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "Si elige finalizar el programa ahora, perder todos los datos no guardados. Para finalizar el programa ahora, haga clic en Finalizar ahora.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "&Finalizar ahora",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Finalizar programa - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Cancelar",IDCANCEL,142,98,43,17 + PUSHBUTTON "&Finalizar ahora",IDC_END_NOW,78,98,43,17 + LTEXT "Este programa no responde.",IDC_STATIC,7,7,178,8 + LTEXT "Para volver a ReactOS y ver el estado del programa, haga clic en Cancelar.", + IDC_STATIC,7,26,178,16 + LTEXT "Si elige finalizar el programa ahora, perder todos los datos no guardados. Para finalizar el programa ahora, haga clic en Finalizar ahora.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/es-ES.rc =================================================================== --- win32ss/user/winsrv/lang/es-ES.rc (rvision 58607) +++ win32ss/user/winsrv/lang/es-ES.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/es-ES.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/fr-FR.rc =================================================================== --- win32ss/user/winsrv/lang/fr-FR.rc (rvision 0) +++ win32ss/user/winsrv/lang/fr-FR.rc (copie de travail) @@ -0,0 +1,36 @@ +LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Fin du programme - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Termine le programme... Veuillez patienter",IDC_STATIC,7,7,186,11 + CONTROL "Avancement",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "Si vous choisissez de terminer le programme immdiatement, vous perdrez toutes les donnes non sauvegardes. Pour terminer le programme maintenant, cliquez sur Terminer maintenant.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "T&erminer maintenant",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Fin du programme - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Annuler",IDCANCEL,142,98,43,17 + PUSHBUTTON "T&erminer maintenant",IDC_END_NOW,78,98,43,17 + LTEXT "Ce programme ne rpond pas.",IDC_STATIC,7,7,178,8 + LTEXT "Pour retourner ReactOS et vrifier l'tat du programme, cliquez sur Annuler.", + IDC_STATIC,7,26,178,16 + LTEXT "Si vous choisissez de terminer le programme immdiatement, vous perdrez toutes les donnes non sauvegardes. Pour terminer le programme maintenant, cliquez sur Terminer maintenant.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/fr-FR.rc =================================================================== --- win32ss/user/winsrv/lang/fr-FR.rc (rvision 58607) +++ win32ss/user/winsrv/lang/fr-FR.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/fr-FR.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/he-IL.rc =================================================================== --- win32ss/user/winsrv/lang/he-IL.rc (rvision 0) +++ win32ss/user/winsrv/lang/he-IL.rc (copie de travail) @@ -0,0 +1,36 @@ +LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "סיום תכנית - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "מסיים תכנית... נא להמתין",IDC_STATIC,7,7,186,11 + CONTROL "Progress",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "If you choose to end the program immediately, you will lose any unsaved data. To end the program now, click End Now.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "סיים כעת",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "סיום תכנית - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "ביטול",IDCANCEL,142,98,43,17 + PUSHBUTTON "סיים כעת",IDC_END_NOW,78,98,43,17 + LTEXT "התכנית אינה מגיבה",IDC_STATIC,7,7,178,8 + LTEXT "To return to ReactOS and check the status of the program, click Cancel", + IDC_STATIC,7,26,178,16 + LTEXT "If you choose to end the program immediately, you will lose any unsaved data. To end the program now, click End Now", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/he-IL.rc =================================================================== --- win32ss/user/winsrv/lang/he-IL.rc (rvision 58607) +++ win32ss/user/winsrv/lang/he-IL.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/he-IL.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/id-ID.rc =================================================================== --- win32ss/user/winsrv/lang/id-ID.rc (rvision 0) +++ win32ss/user/winsrv/lang/id-ID.rc (copie de travail) @@ -0,0 +1,36 @@ +LANGUAGE LANG_INDONESIAN, SUBLANG_DEFAULT + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Akhir Program - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Mengakhiri Program... Harap menunggu",IDC_STATIC,7,7,186,11 + CONTROL "Progres",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "Jika anda memilih untuk segera mengakhiri program, anda akan kehilangan data yang belum disimpan. Untuk mengakhiri program sekarang, klik Akhiri Sekarang.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "&Akhiri Sekarang",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Mengakhiri Program - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Batal",IDCANCEL,142,98,43,17 + PUSHBUTTON "&Akhiri Sekarang",IDC_END_NOW,78,98,43,17 + LTEXT "Program ini tidak merespon.",IDC_STATIC,7,7,178,8 + LTEXT "Untuk kembali ke ReactOS dan memeriksa status program, klik Batal.", + IDC_STATIC,7,26,178,16 + LTEXT "Jika anda memilih untuk segera mengakhiri program, anda akan kehilangan data yang belum disimpan. Untuk mengakhiri program sekarang, klik Akhiri Sekarang.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/id-ID.rc =================================================================== --- win32ss/user/winsrv/lang/id-ID.rc (rvision 58607) +++ win32ss/user/winsrv/lang/id-ID.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/id-ID.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/it-IT.rc =================================================================== --- win32ss/user/winsrv/lang/it-IT.rc (rvision 0) +++ win32ss/user/winsrv/lang/it-IT.rc (copie de travail) @@ -0,0 +1,45 @@ +/* +* PROJECT: ReactOS Client/Server Runtime subsystem +* LICENSE: GPL - See COPYING in the top level directory +* FILE: subsystems/win32/csrss/win32csr/lang/it-IT.rc +* PURPOSE: Italian Translation of subsystems/win32/csrss/win32csr/lang/en-US.rc +* PROGRAMMERS: +* Copyright (C) 2007 Daniele Forsi (dforsi at gmail.com) Italian Translation +*/ + +LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Arresto del programma - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Arresto del programma... Attendere",IDC_STATIC,7,7,186,11 + CONTROL "Progresso",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "Se si sceglie di terminare il programma immediatamente, si perderanno tutti i dati non salvati. Per terminare il programma ora, selezionare Termina ora.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "T&ermina ora",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Arresto del programma - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Annulla",IDCANCEL,142,98,43,17 + PUSHBUTTON "T&ermina ora",IDC_END_NOW,78,98,43,17 + LTEXT "Il programma non risponde.",IDC_STATIC,7,7,178,8 + LTEXT "Per tornare a ReactOS e controllare lo stato del programma, selezionare Annulla.", + IDC_STATIC,7,26,178,16 + LTEXT "Se si sceglie di terminare il programma immediatamente, si perderanno tutti i dati non salvati. Per terminare il programma ora, selezionare Termina ora.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/it-IT.rc =================================================================== --- win32ss/user/winsrv/lang/it-IT.rc (rvision 58607) +++ win32ss/user/winsrv/lang/it-IT.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/it-IT.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/ja-JP.rc =================================================================== --- win32ss/user/winsrv/lang/ja-JP.rc (rvision 0) +++ win32ss/user/winsrv/lang/ja-JP.rc (copie de travail) @@ -0,0 +1,36 @@ +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "vȌI - " +FONT 9, "MS UI Gothic" +BEGIN + LTEXT "vOIĂ܂... ΂炭҂",IDC_STATIC,7,7,186,11 + CONTROL "Progress",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "vOɏI悤IꍇAۑĂȂf[^ׂ͂Ď܂BvOIɂ[ɏI]NbNĂB", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "ɏI(&E)",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "vȌI - " +FONT 9, "MS UI Gothic" +BEGIN + DEFPUSHBUTTON "LZ",IDCANCEL,142,98,43,17 + PUSHBUTTON "ɏI(&E)",IDC_END_NOW,78,98,43,17 + LTEXT "̃vO͉Ă܂",IDC_STATIC,7,7,178,8 + LTEXT "ReactOS ɖ߂ăvȌԂmFɂ[LZ]NbNĂ", + IDC_STATIC,7,26,178,16 + LTEXT "vOɏI悤IꍇAۑĂȂf[^ׂ͂Ď܂BvO𒼂ɏIɂ[ɏI]NbNĂ", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 9, "MS UI Gothic", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/ja-JP.rc =================================================================== --- win32ss/user/winsrv/lang/ja-JP.rc (rvision 58607) +++ win32ss/user/winsrv/lang/ja-JP.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/ja-JP.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/no-NO.rc =================================================================== --- win32ss/user/winsrv/lang/no-NO.rc (rvision 0) +++ win32ss/user/winsrv/lang/no-NO.rc (copie de travail) @@ -0,0 +1,36 @@ +LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Avslutt program - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Avslutt Program... Vennligst vent",IDC_STATIC,7,7,186,11 + CONTROL "Progress",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "Hvis du velger avslutte programmet yeblikkelig, vil du miste alt data som ikke er lagret. For avslutte programmet n, Trykk p Avslutt n.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "&Avslutt n",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Avslutt program - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Avbryt",IDCANCEL,142,98,43,17 + PUSHBUTTON "&Avslutt n",IDC_END_NOW,78,98,43,17 + LTEXT "Programmet svarer ikke.",IDC_STATIC,7,7,178,8 + LTEXT "For returnere til ReactOS for sjekke statusen p programmet, trykk p avbryt.", + IDC_STATIC,7,26,178,16 + LTEXT "Hvis du velger avslutte programmet yeblikkelig, vil du miste alt data som ikke er lagret. For avslutte programmet n, Trykk p Avslutt n.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/no-NO.rc =================================================================== --- win32ss/user/winsrv/lang/no-NO.rc (rvision 58607) +++ win32ss/user/winsrv/lang/no-NO.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/no-NO.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/pl-PL.rc =================================================================== --- win32ss/user/winsrv/lang/pl-PL.rc (rvision 0) +++ win32ss/user/winsrv/lang/pl-PL.rc (copie de travail) @@ -0,0 +1,44 @@ +/* + * translated by xrogers + * xxrogers@users.sourceforge.net + * https://sourceforge.net/projects/reactospl + * translation update by Olaf Siejka (Caemyr), Apr 2011 + * UTF-8 conversion by Caemyr (May, 2011) + */ + +LANGUAGE LANG_POLISH, SUBLANG_DEFAULT + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Zakończ program - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Trwa zamykanie programu... Proszę czekać",IDC_STATIC,7,7,186,11 + CONTROL "Postęp",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "Jeśli zdecydujesz się zamknąć program natychmiastowo, utracisz wszelkie niezapisane dane. Aby zakończyć program, wciśnij Zakończ teraz.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "&Zakończ teraz",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Zakończ program - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Anuluj",IDCANCEL,142,98,43,17 + PUSHBUTTON "&Zakończ teraz",IDC_END_NOW,78,98,43,17 + LTEXT "Wybrany program nie odpowiada.",IDC_STATIC,7,7,178,8 + LTEXT "Aby powrócić do ReactOS i sprawdzić status programu, kliknij Anuluj.", + IDC_STATIC,7,26,178,16 + LTEXT "Jeśli zdecydujesz się zamknąć program natychmiastowo, utracisz wszelkie niezapisane dane. Aby zakończyć program, wciśnij Zakończ teraz.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/pl-PL.rc =================================================================== --- win32ss/user/winsrv/lang/pl-PL.rc (rvision 58607) +++ win32ss/user/winsrv/lang/pl-PL.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/pl-PL.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/pt-BR.rc =================================================================== --- win32ss/user/winsrv/lang/pt-BR.rc (rvision 0) +++ win32ss/user/winsrv/lang/pt-BR.rc (copie de travail) @@ -0,0 +1,38 @@ +/* Translation and UTF-8 Conversion by mkbu95 (May, 2012) */ + +LANGUAGE LANG_PORTUGUESE, SUBLANG_NEUTRAL + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Finalizar Programa - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Finalizando Programa... Por favor aguarde",IDC_STATIC,7,7,186,11 + CONTROL "Progress",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "Se você finalizar o programa imediatamente, você irá perder qualquer alteração não salva. Para finalizar o programa agora, pressione Finalizar Agora.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "&Finalizar Agora",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Finalizar Programa - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Cancelar",IDCANCEL,142,98,43,17 + PUSHBUTTON "&Finalizar Agora",IDC_END_NOW,78,98,43,17 + LTEXT "O programa não está respondendo.",IDC_STATIC,7,7,178,8 + LTEXT "Parar retornar ao ReactOS e verificar o estado do programa, pressione Cancelar.", + IDC_STATIC,7,26,178,16 + LTEXT "Se você finalizar o programa imediatamente, você irá perder qualquer alteração não salva. Para finalizar o programa agora, pressione Finalizar Agora.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/pt-BR.rc =================================================================== --- win32ss/user/winsrv/lang/pt-BR.rc (rvision 58607) +++ win32ss/user/winsrv/lang/pt-BR.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/pt-BR.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/ro-RO.rc =================================================================== --- win32ss/user/winsrv/lang/ro-RO.rc (rvision 0) +++ win32ss/user/winsrv/lang/ro-RO.rc (copie de travail) @@ -0,0 +1,43 @@ +/* + * FILE: subsystems/win32/csrss/win32csr/lang/ro-RO.rc + * ReactOS Project (http://www.reactos.org) + * TRANSLATOR: Fulea Ștefan (PM on ReactOS Forum at fulea.stefan) + * CHANGE LOG: 2011-10-16 initial translation + */ + +LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Terminare execuție - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Terminare execuție… așteptați",IDC_STATIC,7,7,186,11 + CONTROL "Progress", IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "Dacă alegeți închiderea forțată, riscați pierderi de date. Pentru a forța închiderea, apăsați „Termină forțat”.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "Termină &forțat",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Terminare execuție - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "A&nulează", IDCANCEL,142,98,43,17 + PUSHBUTTON "Termină &forțat",IDC_END_NOW,78,98,43,17 + LTEXT "Acest program nu răspunde.",IDC_STATIC,7,7,178,8 + LTEXT "Pentru a vă întoarce în ReactOS și a verifica starea programului, apăsați „Anulează”.", + IDC_STATIC,7,26,178,16 + LTEXT "Dacă alegeți închiderea imediată a programului, riscați pierderi de date. Pentru a forța închiderea, apăsați „Termină forțat”.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/ro-RO.rc =================================================================== --- win32ss/user/winsrv/lang/ro-RO.rc (rvision 58607) +++ win32ss/user/winsrv/lang/ro-RO.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/ro-RO.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/ru-RU.rc =================================================================== --- win32ss/user/winsrv/lang/ru-RU.rc (rvision 0) +++ win32ss/user/winsrv/lang/ru-RU.rc (copie de travail) @@ -0,0 +1,36 @@ +LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Завершение программы - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Завершение программы... Пажалуйста подождите",IDC_STATIC,7,7,186,11 + CONTROL "Progress",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "Если вы завершите программу сейчас, то вы можете потерять несохраненные данные. Чтобы завешить программу сейчас нажмите ""Завершить""", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "&Завешить",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Завершение программы - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Отмена",IDCANCEL,142,98,43,17 + PUSHBUTTON "&Завершить",IDC_END_NOW,78,98,43,17 + LTEXT "Эта программа не отвечает.",IDC_STATIC,7,7,178,8 + LTEXT "Для возврата в ReactOS и сохранения данных нажмите ""Отмена"".", + IDC_STATIC,7,26,178,16 + LTEXT "Если вы завершите программу сейчас, то вы можете потерять несохраненные данные. Чтобы завешить программу сейчас нажмите ""Завершить"".", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/ru-RU.rc =================================================================== --- win32ss/user/winsrv/lang/ru-RU.rc (rvision 58607) +++ win32ss/user/winsrv/lang/ru-RU.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/ru-RU.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/sk-SK.rc =================================================================== --- win32ss/user/winsrv/lang/sk-SK.rc (rvision 0) +++ win32ss/user/winsrv/lang/sk-SK.rc (copie de travail) @@ -0,0 +1,41 @@ +/* TRANSLATOR: Mrio Kamr /Mario Kacmar/ aka Kario (kario@szm.sk) + * DATE OF TR: 29-05-2008 + * LastChange: 12-04-2011 + */ + +LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ukonenie programu - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Ukonujem program... Pokajte, prosm.",IDC_STATIC,7,7,186,11 + CONTROL "Progress",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "Ak zvolte okamit ukonenie programu, stratte vetky neuloen daje. Ak chcete program ukoni okamite, kliknite na tlaidlo Ukoni ihne.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "&Ukoni ihne",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ukonenie programu - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Zrui",IDCANCEL,142,98,43,17 + PUSHBUTTON "&Ukoni ihne",IDC_END_NOW,78,98,43,17 + LTEXT "Tento program neodpoved.",IDC_STATIC,7,7,178,8 + LTEXT "Pre nvrat do systmu ReactOS a overenie stavu programu kliknite na tlaidlo Zrui.", + IDC_STATIC,7,26,178,16 + LTEXT "Ak zvolte okamit ukonenie programu, stratte vetky neuloen daje. Ak chcete program ukoni okamite, kliknite na tlaidlo Ukoni ihne.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/sk-SK.rc =================================================================== --- win32ss/user/winsrv/lang/sk-SK.rc (rvision 58607) +++ win32ss/user/winsrv/lang/sk-SK.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/sk-SK.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/sv-SE.rc =================================================================== --- win32ss/user/winsrv/lang/sv-SE.rc (rvision 0) +++ win32ss/user/winsrv/lang/sv-SE.rc (copie de travail) @@ -0,0 +1,43 @@ +/* + * PROJECT: ReactOS CSRSS subsystem + * FILE: subsystems/win32/csrss/win32csr/lang/sv-SE.rc + * PURPOSE: Swedish resource file + * Translation: Jaix Bly + */ + +LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "End Program - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Avsluta Program... Var vnlig vnta",IDC_STATIC,7,7,186,11 + CONTROL "Progress",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "Om du vljer att avsluta programmet omedelbart kommer du att frlora all osparad data. Fr att avsluta programmet, klicka Avsluta nu.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "&Avsluta Nu",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Avsluta Program - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Avbryt",IDCANCEL,142,98,43,17 + PUSHBUTTON "&Avsluta Nu",IDC_END_NOW,78,98,43,17 + LTEXT "Detta programmet svarar inte.",IDC_STATIC,7,7,178,8 + LTEXT "Fr att terg till ReactOS och underska programmets status klicka Avbryt.", + IDC_STATIC,7,26,178,16 + LTEXT "m du vljer att avsluta programmet omedelbart kommer du att frlora all osparad data. Fr att avsluta programmet, klicka Avsluta nu.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/sv-SE.rc =================================================================== --- win32ss/user/winsrv/lang/sv-SE.rc (rvision 58607) +++ win32ss/user/winsrv/lang/sv-SE.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/sv-SE.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/tr-TR.rc =================================================================== --- win32ss/user/winsrv/lang/tr-TR.rc (rvision 0) +++ win32ss/user/winsrv/lang/tr-TR.rc (copie de travail) @@ -0,0 +1,56 @@ +/* + * Turkish resources + * + * Copyright 2012 Arda Tanrikulu + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Programı Sonlandır - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Program Sonlandırılıyor... Lütfen bekleyin",IDC_STATIC,7,7,186,11 + CONTROL "İşlem",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "Programı hemen kapatmayı seçerseniz, kaydedilmemiş veriyi kaybedersiniz. Programdan şimdi çıkmak için Şimdi Sonlandır'ı tıklatın.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "&Şimdi Sonlandır",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "End Program - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "İptal",IDCANCEL,142,98,43,17 + PUSHBUTTON "Şimdi Sonlandır",IDC_END_NOW,78,98,43,17 + LTEXT "Bu program yanıt vermiyor.",IDC_STATIC,7,7,178,8 + LTEXT "ReactOS'a dönmek ve programın durumunu denetlemek için İptal'i tıklatın.", + IDC_STATIC,7,26,178,16 + LTEXT "Programı hemen kapatmayı seçerseniz, kaydedilmemiş veriyi kaybedersiniz. Programdan şimdi çıkmak için Şimdi Sonlandır'ı tıklatın.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/tr-TR.rc =================================================================== --- win32ss/user/winsrv/lang/tr-TR.rc (rvision 58607) +++ win32ss/user/winsrv/lang/tr-TR.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/tr-TR.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/uk-UA.rc =================================================================== --- win32ss/user/winsrv/lang/uk-UA.rc (rvision 0) +++ win32ss/user/winsrv/lang/uk-UA.rc (copie de travail) @@ -0,0 +1,44 @@ +/* + * PROJECT: ReactOS CSRSS subsystem + * LICENSE: GPL - See COPYING in the top level directory + * FILE: subsystems/win32/csrss/win32csr/lang/uk-UA.rc + * PURPOSE: Ukraianian resource file + * TRANSLATOR: Artem Reznikov + */ + +LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Завершення програми - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Завершення програми... Зачекайте",IDC_STATIC,7,7,186,11 + CONTROL "Прогрес",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "Якщо завершити програму негайно, то можна втратити всі незбережені дані. Щоб завершити програму зараз, натисніть 'Завершити зараз'", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "&Завершити зараз",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Завершення програми - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Скасувати",IDCANCEL,142,98,43,17 + PUSHBUTTON "&Завершити зараз",IDC_END_NOW,78,98,43,17 + LTEXT "Ця програма не відповідає.",IDC_STATIC,7,7,178,8 + LTEXT "Щоб повернутися у ReactOS і перевірити стан програми, натисніть 'Скасувати'.", + IDC_STATIC,7,26,178,16 + LTEXT "Якщо завершити програму негайно, то можна втратити всі незбережені дані. Щоб завершити програму зараз, натисніть 'Завершити зараз'.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/uk-UA.rc =================================================================== --- win32ss/user/winsrv/lang/uk-UA.rc (rvision 58607) +++ win32ss/user/winsrv/lang/uk-UA.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/uk-UA.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/zh-CN.rc =================================================================== --- win32ss/user/winsrv/lang/zh-CN.rc (rvision 0) +++ win32ss/user/winsrv/lang/zh-CN.rc (copie de travail) @@ -0,0 +1,36 @@ +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "ֹ - " +FONT 9, "MS Shell Dlg" +BEGIN + LTEXT "ֹ... ȴ",IDC_STATIC,7,7,186,11 + CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "ѡֹʧȥδݡҪ򣬵ֹ", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "ֹ(&E)",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "ֹ - " +FONT 9, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "ȡ",IDCANCEL,142,98,43,17 + PUSHBUTTON "ֹ(&E)",IDC_END_NOW,78,98,43,17 + LTEXT "˳δӦ",IDC_STATIC,7,7,178,8 + LTEXT "Ҫ ReactOS ó״̬ȡ", + IDC_STATIC,7,26,178,16 + LTEXT "ѡֹʧȥδݡҪ򣬵ֹ", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 9, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/zh-CN.rc =================================================================== --- win32ss/user/winsrv/lang/zh-CN.rc (rvision 58607) +++ win32ss/user/winsrv/lang/zh-CN.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/zh-CN.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/lang/zh-TW.rc =================================================================== --- win32ss/user/winsrv/lang/zh-TW.rc (rvision 0) +++ win32ss/user/winsrv/lang/zh-TW.rc (copie de travail) @@ -0,0 +1,36 @@ +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "{" +FONT 9, "MS Shell Dlg" +BEGIN + LTEXT "b{... еy",IDC_STATIC,7,7,186,11 + CONTROL "Progress",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "pGzܥߧY{AzNhҦxsơCYnߧY{AЫUߧYC", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "ߧY(&E)",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "{ - " +FONT 9, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "",IDCANCEL,142,98,43,17 + PUSHBUTTON "ߧY(&E) ",IDC_END_NOW,78,98,43,17 + LTEXT "{åT",IDC_STATIC,7,7,178,8 + LTEXT "Yn^ ReactOS ˵{AAЫU", + IDC_STATIC,7,26,178,16 + LTEXT "pGzܥߧY{AzNhҦxsơCYnߧY{AЫUߧYC", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 9, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END Index: win32ss/user/winsrv/lang/zh-TW.rc =================================================================== --- win32ss/user/winsrv/lang/zh-TW.rc (rvision 58607) +++ win32ss/user/winsrv/lang/zh-TW.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/lang/zh-TW.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/register.c =================================================================== --- win32ss/user/winsrv/register.c (rvision 0) +++ win32ss/user/winsrv/register.c (copie de travail) @@ -0,0 +1,69 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS User API Server DLL + * FILE: win32ss/user/winsrv/register.c + * PURPOSE: Register logon window and services process + * PROGRAMMERS: Eric Kohl + * Hermes Belusca-Maito (hermes.belusca@sfr.fr) + */ + +/* INCLUDES *******************************************************************/ + +#include "winsrv.h" + +#define NDEBUG +#include + +/* GLOBALS ********************************************************************/ + +static BOOLEAN ServicesProcessIdValid = FALSE; +static ULONG_PTR ServicesProcessId = 0; + +ULONG_PTR LogonProcessId = 0; + +/* PUBLIC SERVER APIS *********************************************************/ + +CSR_API(SrvRegisterLogonProcess) +{ + PCSRSS_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest = &((PUSER_API_MESSAGE)ApiMessage)->Data.RegisterLogonProcessRequest; + + if (RegisterLogonProcessRequest->Register) + { + if (LogonProcessId != 0) + return STATUS_LOGON_SESSION_EXISTS; + + LogonProcessId = RegisterLogonProcessRequest->ProcessId; + } + else + { + if (ApiMessage->Header.ClientId.UniqueProcess != (HANDLE)LogonProcessId) + { + DPRINT1("Current logon process 0x%x, can't deregister from process 0x%x\n", + LogonProcessId, ApiMessage->Header.ClientId.UniqueProcess); + return STATUS_NOT_LOGON_PROCESS; + } + + LogonProcessId = 0; + } + + return STATUS_SUCCESS; +} + +CSR_API(SrvRegisterServicesProcess) +{ + PCSRSS_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest = &((PUSER_API_MESSAGE)ApiMessage)->Data.RegisterServicesProcessRequest; + + if (ServicesProcessIdValid == TRUE) + { + /* Only accept a single call */ + return STATUS_INVALID_PARAMETER; + } + else + { + ServicesProcessId = RegisterServicesProcessRequest->ProcessId; + ServicesProcessIdValid = TRUE; + return STATUS_SUCCESS; + } +} + +/* EOF */ Index: win32ss/user/winsrv/register.c =================================================================== --- win32ss/user/winsrv/register.c (rvision 58607) +++ win32ss/user/winsrv/register.c (copie de travail) Modification de proprits sur win32ss/user/winsrv/register.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/resource.h =================================================================== --- win32ss/user/winsrv/resource.h (rvision 0) +++ win32ss/user/winsrv/resource.h (copie de travail) @@ -0,0 +1,19 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS User API Server DLL + * FILE: win32ss/user/winsrv/resource.h + * PURPOSE: Resource #defines + */ + +#pragma once + +#define IDD_END_NOW 10 +#define IDD_NOT_RESPONDING 11 +#define IDD_SWITCH_APP 12 + +#define IDC_STATIC -1 +#define IDC_PROGRESS 101 +#define IDC_END_NOW 102 +#define IDC_STATIC_CUR_APP 103 + +/* EOF */ Index: win32ss/user/winsrv/resource.h =================================================================== --- win32ss/user/winsrv/resource.h (rvision 58607) +++ win32ss/user/winsrv/resource.h (copie de travail) Modification de proprits sur win32ss/user/winsrv/resource.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/rsrc.rc =================================================================== --- win32ss/user/winsrv/rsrc.rc (rvision 0) +++ win32ss/user/winsrv/rsrc.rc (copie de travail) @@ -0,0 +1,71 @@ +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +#ifdef LANGUAGE_BG_BG + #include "lang/bg-BG.rc" +#endif +#ifdef LANGUAGE_CS_CZ + #include "lang/cs-CZ.rc" +#endif +#ifdef LANGUAGE_DE_DE + #include "lang/de-DE.rc" +#endif +#ifdef LANGUAGE_EL_GR + #include "lang/el-GR.rc" +#endif +#ifdef LANGUAGE_EN_US + #include "lang/en-US.rc" +#endif +#ifdef LANGUAGE_ES_ES + #include "lang/es-ES.rc" +#endif +#ifdef LANGUAGE_FR_FR + #include "lang/fr-FR.rc" +#endif +#ifdef LANGUAGE_ID_ID + #include "lang/id-ID.rc" +#endif +#ifdef LANGUAGE_IT_IT + #include "lang/it-IT.rc" +#endif +#ifdef LANGUAGE_JA_JP + #include "lang/ja-JP.rc" +#endif +#ifdef LANGUAGE_NB_NO + #include "lang/no-NO.rc" +#endif +#ifdef LANGUAGE_SK_SK + #include "lang/sk-SK.rc" +#endif +#ifdef LANGUAGE_SV_SE + #include "lang/sv-SE.rc" +#endif +#ifdef LANGUAGE_ZH_CN + #include "lang/zh-CN.rc" +#endif +#ifdef LANGUAGE_ZH_TW + #include "lang/zh-TW.rc" +#endif + +// UTF-8 +#pragma code_page(65001) +#ifdef LANGUAGE_HE_IL + #include "lang/he-IL.rc" +#endif +#ifdef LANGUAGE_PL_PL + #include "lang/pl-PL.rc" +#endif +#ifdef LANGUAGE_PT_BR + #include "lang/pt-BR.rc" +#endif +#ifdef LANGUAGE_RO_RO + #include "lang/ro-RO.rc" +#endif +#ifdef LANGUAGE_RU_RU + #include "lang/ru-RU.rc" +#endif +#ifdef LANGUAGE_UK_UA + #include "lang/uk-UA.rc" +#endif +#ifdef LANGUAGE_TR_TR + #include "lang/tr-TR.rc" +#endif Index: win32ss/user/winsrv/rsrc.rc =================================================================== --- win32ss/user/winsrv/rsrc.rc (rvision 58607) +++ win32ss/user/winsrv/rsrc.rc (copie de travail) Modification de proprits sur win32ss/user/winsrv/rsrc.rc ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/shutdown.c =================================================================== --- win32ss/user/winsrv/shutdown.c (rvision 0) +++ win32ss/user/winsrv/shutdown.c (copie de travail) @@ -0,0 +1,933 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS User API Server DLL + * FILE: win32ss/user/winsrv/shutdown.c + * PURPOSE: Logout/shutdown + * PROGRAMMERS: + */ + +/* INCLUDES *******************************************************************/ + +#include "winsrv.h" +#include + +#define NDEBUG +#include + +/* GLOBALS ********************************************************************/ + +typedef struct tagSHUTDOWN_SETTINGS +{ + BOOL AutoEndTasks; + DWORD HungAppTimeout; + DWORD WaitToKillAppTimeout; +} SHUTDOWN_SETTINGS, *PSHUTDOWN_SETTINGS; + +#define DEFAULT_AUTO_END_TASKS FALSE +#define DEFAULT_HUNG_APP_TIMEOUT 5000 +#define DEFAULT_WAIT_TO_KILL_APP_TIMEOUT 20000 + +typedef struct tagNOTIFY_CONTEXT +{ + DWORD ProcessId; + UINT Msg; + WPARAM wParam; + LPARAM lParam; + HDESK Desktop; + HDESK OldDesktop; + DWORD StartTime; + DWORD QueryResult; + HWND Dlg; + DWORD EndNowResult; + BOOL ShowUI; + HANDLE UIThread; + HWND WndClient; + PSHUTDOWN_SETTINGS ShutdownSettings; + LPTHREAD_START_ROUTINE SendMessageProc; +} NOTIFY_CONTEXT, *PNOTIFY_CONTEXT; + +#define QUERY_RESULT_ABORT 0 +#define QUERY_RESULT_CONTINUE 1 +#define QUERY_RESULT_TIMEOUT 2 +#define QUERY_RESULT_ERROR 3 +#define QUERY_RESULT_FORCE 4 + +typedef void (WINAPI *INITCOMMONCONTROLS_PROC)(void); + +typedef struct tagMESSAGE_CONTEXT +{ + HWND Wnd; + UINT Msg; + WPARAM wParam; + LPARAM lParam; + DWORD Timeout; +} MESSAGE_CONTEXT, *PMESSAGE_CONTEXT; + +typedef struct tagPROCESS_ENUM_CONTEXT +{ + UINT ProcessCount; + PCSR_PROCESS *ProcessData; + TOKEN_ORIGIN TokenOrigin; + DWORD ShellProcess; + DWORD CsrssProcess; +} PROCESS_ENUM_CONTEXT, *PPROCESS_ENUM_CONTEXT; + + +/* FUNCTIONS ******************************************************************/ + +/* +NTSTATUS FASTCALL +Win32CsrEnumProcesses(CSRSS_ENUM_PROCESS_PROC EnumProc, + PVOID Context) +{ + return CsrEnumProcesses(EnumProc, Context); +} +*/ + +static void FASTCALL +UpdateProgressBar(HWND ProgressBar, PNOTIFY_CONTEXT NotifyContext) +{ + DWORD Passed; + + Passed = GetTickCount() - NotifyContext->StartTime; + Passed -= NotifyContext->ShutdownSettings->HungAppTimeout; + if (NotifyContext->ShutdownSettings->WaitToKillAppTimeout < Passed) + { + Passed = NotifyContext->ShutdownSettings->WaitToKillAppTimeout; + } + SendMessageW(ProgressBar, PBM_SETPOS, Passed / 2, 0); +} + +static INT_PTR CALLBACK +EndNowDlgProc(HWND Dlg, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + INT_PTR Result; + PNOTIFY_CONTEXT NotifyContext; + HWND ProgressBar; + DWORD TitleLength; + int Len; + LPWSTR Title; + + switch(Msg) + { + case WM_INITDIALOG: + NotifyContext = (PNOTIFY_CONTEXT) lParam; + NotifyContext->EndNowResult = QUERY_RESULT_ABORT; + SetWindowLongPtrW(Dlg, DWLP_USER, (LONG_PTR) lParam); + TitleLength = SendMessageW(NotifyContext->WndClient, WM_GETTEXTLENGTH, + 0, 0) + + GetWindowTextLengthW(Dlg); + Title = HeapAlloc(UserServerHeap, 0, (TitleLength + 1) * sizeof(WCHAR)); + if (NULL != Title) + { + Len = GetWindowTextW(Dlg, Title, TitleLength + 1); + SendMessageW(NotifyContext->WndClient, WM_GETTEXT, + TitleLength + 1 - Len, (LPARAM) (Title + Len)); + SetWindowTextW(Dlg, Title); + HeapFree(UserServerHeap, 0, Title); + } + ProgressBar = GetDlgItem(Dlg, IDC_PROGRESS); + SendMessageW(ProgressBar, PBM_SETRANGE32, 0, + NotifyContext->ShutdownSettings->WaitToKillAppTimeout / 2); + UpdateProgressBar(ProgressBar, NotifyContext); + SetTimer(Dlg, 0, 200, NULL); + Result = FALSE; + break; + + case WM_TIMER: + NotifyContext = (PNOTIFY_CONTEXT) GetWindowLongPtrW(Dlg, DWLP_USER); + ProgressBar = GetDlgItem(Dlg, IDC_PROGRESS); + UpdateProgressBar(ProgressBar, NotifyContext); + Result = TRUE; + break; + + case WM_COMMAND: + if (BN_CLICKED == HIWORD(wParam) && IDC_END_NOW == LOWORD(wParam)) + { + NotifyContext = (PNOTIFY_CONTEXT) GetWindowLongPtrW(Dlg, DWLP_USER); + NotifyContext->EndNowResult = QUERY_RESULT_FORCE; + SendMessageW(Dlg, WM_CLOSE, 0, 0); + Result = TRUE; + } + else + { + Result = FALSE; + } + break; + + case WM_CLOSE: + DestroyWindow(Dlg); + Result = TRUE; + break; + + case WM_DESTROY: + NotifyContext = (PNOTIFY_CONTEXT) GetWindowLongPtrW(Dlg, DWLP_USER); + NotifyContext->Dlg = NULL; + KillTimer(Dlg, 0); + PostQuitMessage(NotifyContext->EndNowResult); + Result = TRUE; + break; + + default: + Result = FALSE; + break; + } + + return Result; +} + +static void +CallInitCommonControls() +{ + static BOOL Initialized = FALSE; + HMODULE Lib; + INITCOMMONCONTROLS_PROC InitProc; + + if (Initialized) return; + + Lib = LoadLibraryW(L"COMCTL32.DLL"); + if (NULL == Lib) return; + + InitProc = (INITCOMMONCONTROLS_PROC) GetProcAddress(Lib, "InitCommonControls"); + if (NULL == InitProc) return; + + (*InitProc)(); + + Initialized = TRUE; +} + +static DWORD WINAPI +EndNowThreadProc(LPVOID Parameter) +{ + PNOTIFY_CONTEXT NotifyContext = (PNOTIFY_CONTEXT) Parameter; + MSG Msg; + + SetThreadDesktop(NotifyContext->Desktop); + SwitchDesktop(NotifyContext->Desktop); + CallInitCommonControls(); + NotifyContext->Dlg = CreateDialogParam(UserServerDllInstance, + MAKEINTRESOURCE(IDD_END_NOW), NULL, + EndNowDlgProc, (LPARAM) NotifyContext); + if (NULL == NotifyContext->Dlg) + { + return 0; + } + ShowWindow(NotifyContext->Dlg, SW_SHOWNORMAL); + + while (GetMessageW(&Msg, NULL, 0, 0)) + { + if (! IsDialogMessage(NotifyContext->Dlg, &Msg)) + { + TranslateMessage(&Msg); + DispatchMessageW(&Msg); + } + } + + return Msg.wParam; +} + +static DWORD WINAPI +SendQueryEndSession(LPVOID Parameter) +{ + PMESSAGE_CONTEXT Context = (PMESSAGE_CONTEXT) Parameter; + DWORD_PTR Result; + + if (SendMessageTimeoutW(Context->Wnd, WM_QUERYENDSESSION, Context->wParam, + Context->lParam, SMTO_NORMAL, Context->Timeout, + &Result)) + { + return Result ? QUERY_RESULT_CONTINUE : QUERY_RESULT_ABORT; + } + + return 0 == GetLastError() ? QUERY_RESULT_TIMEOUT : QUERY_RESULT_ERROR; +} + +static DWORD WINAPI +SendEndSession(LPVOID Parameter) +{ + PMESSAGE_CONTEXT Context = (PMESSAGE_CONTEXT) Parameter; + DWORD_PTR Result; + + if (Context->wParam) + { + if (SendMessageTimeoutW(Context->Wnd, WM_ENDSESSION, Context->wParam, + Context->lParam, SMTO_NORMAL, Context->Timeout, + &Result)) + { + return QUERY_RESULT_CONTINUE; + } + return 0 == GetLastError() ? QUERY_RESULT_TIMEOUT : QUERY_RESULT_ERROR; + } + else + { + SendMessage(Context->Wnd, WM_ENDSESSION, Context->wParam, + Context->lParam); + return QUERY_RESULT_CONTINUE; + } +} + +static BOOL CALLBACK +NotifyTopLevelEnum(HWND Wnd, LPARAM lParam) +{ + PNOTIFY_CONTEXT NotifyContext = (PNOTIFY_CONTEXT) lParam; + MESSAGE_CONTEXT MessageContext; + DWORD Now, Passed; + DWORD Timeout, WaitStatus; + DWORD ProcessId; + HANDLE MessageThread; + HANDLE Threads[2]; + + if (0 == GetWindowThreadProcessId(Wnd, &ProcessId)) + { + NotifyContext->QueryResult = QUERY_RESULT_ERROR; + return FALSE; + } + + if (ProcessId == NotifyContext->ProcessId) + { + Now = GetTickCount(); + if (0 == NotifyContext->StartTime) + { + NotifyContext->StartTime = Now; + } + /* Note: Passed is computed correctly even when GetTickCount() wraps due + to unsigned arithmetic */ + Passed = Now - NotifyContext->StartTime; + MessageContext.Wnd = Wnd; + MessageContext.Msg = NotifyContext->Msg; + MessageContext.wParam = NotifyContext->wParam; + MessageContext.lParam = NotifyContext->lParam; + MessageContext.Timeout = NotifyContext->ShutdownSettings->HungAppTimeout; + if (! NotifyContext->ShutdownSettings->AutoEndTasks) + { + MessageContext.Timeout += NotifyContext->ShutdownSettings->WaitToKillAppTimeout; + } + if (Passed < MessageContext.Timeout) + { + MessageContext.Timeout -= Passed; + MessageThread = CreateThread(NULL, 0, NotifyContext->SendMessageProc, + (LPVOID) &MessageContext, 0, NULL); + if (NULL == MessageThread) + { + NotifyContext->QueryResult = QUERY_RESULT_ERROR; + return FALSE; + } + Timeout = NotifyContext->ShutdownSettings->HungAppTimeout; + if (Passed < Timeout) + { + Timeout -= Passed; + WaitStatus = WaitForSingleObjectEx(MessageThread, Timeout, FALSE); + } + else + { + WaitStatus = WAIT_TIMEOUT; + } + if (WAIT_TIMEOUT == WaitStatus) + { + NotifyContext->WndClient = Wnd; + if (NULL == NotifyContext->UIThread && NotifyContext->ShowUI) + { + NotifyContext->UIThread = CreateThread(NULL, 0, + EndNowThreadProc, + (LPVOID) NotifyContext, + 0, NULL); + } + Threads[0] = MessageThread; + Threads[1] = NotifyContext->UIThread; + WaitStatus = WaitForMultipleObjectsEx(NULL == NotifyContext->UIThread ? + 1 : 2, + Threads, FALSE, INFINITE, + FALSE); + if (WAIT_OBJECT_0 == WaitStatus) + { + if (! GetExitCodeThread(MessageThread, &NotifyContext->QueryResult)) + { + NotifyContext->QueryResult = QUERY_RESULT_ERROR; + } + } + else if (WAIT_OBJECT_0 + 1 == WaitStatus) + { + if (! GetExitCodeThread(NotifyContext->UIThread, + &NotifyContext->QueryResult)) + { + NotifyContext->QueryResult = QUERY_RESULT_ERROR; + } + } + else + { + NotifyContext->QueryResult = QUERY_RESULT_ERROR; + } + if (WAIT_OBJECT_0 != WaitStatus) + { + TerminateThread(MessageThread, QUERY_RESULT_TIMEOUT); + } + } + else if (WAIT_OBJECT_0 == WaitStatus) + { + if (! GetExitCodeThread(MessageThread, + &NotifyContext->QueryResult)) + { + NotifyContext->QueryResult = QUERY_RESULT_ERROR; + } + } + else + { + NotifyContext->QueryResult = QUERY_RESULT_ERROR; + } + CloseHandle(MessageThread); + } + else + { + NotifyContext->QueryResult = QUERY_RESULT_TIMEOUT; + } + } + + return QUERY_RESULT_CONTINUE == NotifyContext->QueryResult; +} + +static BOOL CALLBACK +NotifyDesktopEnum(LPWSTR DesktopName, LPARAM lParam) +{ + PNOTIFY_CONTEXT Context = (PNOTIFY_CONTEXT) lParam; + + Context->Desktop = OpenDesktopW(DesktopName, 0, FALSE, + DESKTOP_ENUMERATE | DESKTOP_SWITCHDESKTOP); + if (NULL == Context->Desktop) + { + DPRINT1("OpenDesktop failed with error %d\n", GetLastError()); + Context->QueryResult = QUERY_RESULT_ERROR; + return FALSE; + } + + Context->OldDesktop = GetThreadDesktop(GetCurrentThreadId()); + SwitchDesktop(Context->Desktop); + + EnumDesktopWindows(Context->Desktop, NotifyTopLevelEnum, lParam); + + SwitchDesktop(Context->OldDesktop); + + CloseDesktop(Context->Desktop); + + return QUERY_RESULT_CONTINUE == Context->QueryResult; +} + +static BOOL FASTCALL +NotifyTopLevelWindows(PNOTIFY_CONTEXT Context) +{ + HWINSTA WindowStation; + + WindowStation = GetProcessWindowStation(); + if (NULL == WindowStation) + { + DPRINT1("GetProcessWindowStation failed with error %d\n", GetLastError()); + return TRUE; + } + + EnumDesktopsW(WindowStation, NotifyDesktopEnum, (LPARAM) Context); + + return TRUE; +} + +/*** Taken from win32ss/user/consrv/console.c ***/ +BOOL FASTCALL +DtbgIsDesktopVisible(VOID) +{ + return !((BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_ISCONSOLEMODE)); +} + +/* TODO: Find an other way to do it. */ +#if 0 +VOID FASTCALL +ConioConsoleCtrlEventTimeout(DWORD Event, PCSR_PROCESS ProcessData, DWORD Timeout) +{ + HANDLE Thread; + + DPRINT("ConioConsoleCtrlEvent Parent ProcessId = %x\n", ProcessData->ClientId.UniqueProcess); + + if (ProcessData->CtrlDispatcher) + { + + Thread = CreateRemoteThread(ProcessData->ProcessHandle, NULL, 0, + (LPTHREAD_START_ROUTINE) ProcessData->CtrlDispatcher, + UlongToPtr(Event), 0, NULL); + if (NULL == Thread) + { + DPRINT1("Failed thread creation (Error: 0x%x)\n", GetLastError()); + return; + } + WaitForSingleObject(Thread, Timeout); + CloseHandle(Thread); + } +} +#endif +/************************************************/ + +static BOOL FASTCALL +NotifyAndTerminateProcess(PCSR_PROCESS ProcessData, + PSHUTDOWN_SETTINGS ShutdownSettings, + UINT Flags) +{ + NOTIFY_CONTEXT Context; + HANDLE Process; + DWORD QueryResult = QUERY_RESULT_CONTINUE; + + Context.QueryResult = QUERY_RESULT_CONTINUE; + + if (0 == (Flags & EWX_FORCE)) + { + // TODO: Find an other way whether or not the process has a console. +#if 0 + if (NULL != ProcessData->Console) + { + ConioConsoleCtrlEventTimeout(CTRL_LOGOFF_EVENT, ProcessData, + ShutdownSettings->WaitToKillAppTimeout); + } + else +#endif + { + Context.ProcessId = (DWORD_PTR) ProcessData->ClientId.UniqueProcess; + Context.wParam = 0; + Context.lParam = (0 != (Flags & EWX_INTERNAL_FLAG_LOGOFF) ? + ENDSESSION_LOGOFF : 0); + Context.StartTime = 0; + Context.UIThread = NULL; + Context.ShowUI = DtbgIsDesktopVisible(); + Context.Dlg = NULL; + Context.ShutdownSettings = ShutdownSettings; + Context.SendMessageProc = SendQueryEndSession; + + NotifyTopLevelWindows(&Context); + + Context.wParam = (QUERY_RESULT_ABORT != Context.QueryResult); + Context.lParam = (0 != (Flags & EWX_INTERNAL_FLAG_LOGOFF) ? + ENDSESSION_LOGOFF : 0); + Context.SendMessageProc = SendEndSession; + Context.ShowUI = DtbgIsDesktopVisible() && + (QUERY_RESULT_ABORT != Context.QueryResult); + QueryResult = Context.QueryResult; + Context.QueryResult = QUERY_RESULT_CONTINUE; + + NotifyTopLevelWindows(&Context); + + if (NULL != Context.UIThread) + { + if (NULL != Context.Dlg) + { + SendMessageW(Context.Dlg, WM_CLOSE, 0, 0); + } + else + { + TerminateThread(Context.UIThread, QUERY_RESULT_ERROR); + } + CloseHandle(Context.UIThread); + } + } + + if (QUERY_RESULT_ABORT == QueryResult) + { + return FALSE; + } + } + + /* Terminate this process */ + Process = OpenProcess(PROCESS_TERMINATE, FALSE, + (DWORD_PTR) ProcessData->ClientId.UniqueProcess); + if (NULL == Process) + { + DPRINT1("Unable to open process %d, error %d\n", ProcessData->ClientId.UniqueProcess, + GetLastError()); + return TRUE; + } + TerminateProcess(Process, 0); + CloseHandle(Process); + + return TRUE; +} + +#if 0 +static NTSTATUS WINAPI +ExitReactosProcessEnum(PCSR_PROCESS ProcessData, PVOID Data) +{ + HANDLE Process; + HANDLE Token; + TOKEN_ORIGIN Origin; + DWORD ReturnLength; + PPROCESS_ENUM_CONTEXT Context = (PPROCESS_ENUM_CONTEXT) Data; + PCSR_PROCESS *NewData; + + /* Do not kill winlogon or csrss */ + if ((DWORD_PTR) ProcessData->ClientId.UniqueProcess == Context->CsrssProcess || + ProcessData->ClientId.UniqueProcess == LogonProcessId) + { + return STATUS_SUCCESS; + } + + /* Get the login session of this process */ + Process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, + (DWORD_PTR) ProcessData->ClientId.UniqueProcess); + if (NULL == Process) + { + DPRINT1("Unable to open process %d, error %d\n", ProcessData->ClientId.UniqueProcess, + GetLastError()); + return STATUS_UNSUCCESSFUL; + } + + if (! OpenProcessToken(Process, TOKEN_QUERY, &Token)) + { + DPRINT1("Unable to open token for process %d, error %d\n", + ProcessData->ClientId.UniqueProcess, GetLastError()); + CloseHandle(Process); + return STATUS_UNSUCCESSFUL; + } + CloseHandle(Process); + + if (! GetTokenInformation(Token, TokenOrigin, &Origin, + sizeof(TOKEN_ORIGIN), &ReturnLength)) + { + DPRINT1("GetTokenInformation failed for process %d with error %d\n", + ProcessData->ClientId.UniqueProcess, GetLastError()); + CloseHandle(Token); + return STATUS_UNSUCCESSFUL; + } + CloseHandle(Token); + + /* This process will be killed if it's in the correct logon session */ + if (RtlEqualLuid(&(Context->TokenOrigin.OriginatingLogonSession), + &(Origin.OriginatingLogonSession))) + { + /* Kill the shell process last */ + if ((DWORD_PTR) ProcessData->ClientId.UniqueProcess == Context->ShellProcess) + { + ProcessData->ShutdownLevel = 0; + } + NewData = HeapAlloc(UserServerHeap, 0, (Context->ProcessCount + 1) + * sizeof(PCSR_PROCESS)); + if (NULL == NewData) + { + return STATUS_NO_MEMORY; + } + if (0 != Context->ProcessCount) + { + memcpy(NewData, Context->ProcessData, + Context->ProcessCount * sizeof(PCSR_PROCESS)); + HeapFree(UserServerHeap, 0, Context->ProcessData); + } + Context->ProcessData = NewData; + Context->ProcessData[Context->ProcessCount] = ProcessData; + Context->ProcessCount++; + } + + return STATUS_SUCCESS; +} +#endif + +static int +ProcessDataCompare(const void *Elem1, const void *Elem2) +{ + const PCSR_PROCESS *ProcessData1 = (PCSR_PROCESS *) Elem1; + const PCSR_PROCESS *ProcessData2 = (PCSR_PROCESS *) Elem2; + + if ((*ProcessData1)->ShutdownLevel < (*ProcessData2)->ShutdownLevel) + { + return +1; + } + else if ((*ProcessData2)->ShutdownLevel < (*ProcessData1)->ShutdownLevel) + { + return -1; + } + else if ((*ProcessData1)->ClientId.UniqueProcess < (*ProcessData2)->ClientId.UniqueProcess) + { + return +1; + } + else if ((*ProcessData2)->ClientId.UniqueProcess < (*ProcessData1)->ClientId.UniqueProcess) + { + return -1; + } + + return 0; +} + +static DWORD FASTCALL +GetShutdownSettings(HKEY DesktopKey, LPCWSTR ValueName, DWORD DefaultValue) +{ + BYTE ValueBuffer[16]; + LONG ErrCode; + DWORD Type; + DWORD ValueSize; + UNICODE_STRING StringValue; + ULONG Value; + + ValueSize = sizeof(ValueBuffer); + ErrCode = RegQueryValueExW(DesktopKey, ValueName, NULL, &Type, ValueBuffer, + &ValueSize); + if (ERROR_SUCCESS != ErrCode) + { + DPRINT("GetShutdownSettings for %S failed with error code %ld\n", + ValueName, ErrCode); + return DefaultValue; + } + + if (REG_SZ == Type) + { + RtlInitUnicodeString(&StringValue, (LPCWSTR) ValueBuffer); + if (! NT_SUCCESS(RtlUnicodeStringToInteger(&StringValue, 10, &Value))) + { + DPRINT1("Unable to convert value %S for setting %S\n", + StringValue.Buffer, ValueName); + return DefaultValue; + } + return (DWORD) Value; + } + else if (REG_DWORD == Type) + { + return *((DWORD *) ValueBuffer); + } + + DPRINT1("Unexpected registry type %d for setting %S\n", Type, ValueName); + return DefaultValue; +} + +static void FASTCALL +LoadShutdownSettings(PSID Sid, PSHUTDOWN_SETTINGS ShutdownSettings) +{ + static WCHAR Subkey[] = L"\\Control Panel\\Desktop"; + LPWSTR StringSid; + WCHAR InitialKeyName[128]; + LPWSTR KeyName; + HKEY DesktopKey; + LONG ErrCode; + + ShutdownSettings->AutoEndTasks = DEFAULT_AUTO_END_TASKS; + ShutdownSettings->HungAppTimeout = DEFAULT_HUNG_APP_TIMEOUT; + ShutdownSettings->WaitToKillAppTimeout = DEFAULT_WAIT_TO_KILL_APP_TIMEOUT; + + if (! ConvertSidToStringSidW(Sid, &StringSid)) + { + DPRINT1("ConvertSidToStringSid failed with error %d, using default shutdown settings\n", + GetLastError()); + return; + } + if (wcslen(StringSid) + wcslen(Subkey) + 1 <= + sizeof(InitialKeyName) / sizeof(WCHAR)) + { + KeyName = InitialKeyName; + } + else + { + KeyName = HeapAlloc(UserServerHeap, 0, + (wcslen(StringSid) + wcslen(Subkey) + 1) * + sizeof(WCHAR)); + if (NULL == KeyName) + { + DPRINT1("Failed to allocate memory, using default shutdown settings\n"); + LocalFree(StringSid); + return; + } + } + wcscat(wcscpy(KeyName, StringSid), Subkey); + LocalFree(StringSid); + + ErrCode = RegOpenKeyExW(HKEY_USERS, KeyName, 0, KEY_QUERY_VALUE, &DesktopKey); + if (KeyName != InitialKeyName) + { + HeapFree(UserServerHeap, 0, KeyName); + } + if (ERROR_SUCCESS != ErrCode) + { + DPRINT1("RegOpenKeyEx failed with error %ld, using default shutdown settings\n", ErrCode); + return; + } + + ShutdownSettings->AutoEndTasks = (BOOL) GetShutdownSettings(DesktopKey, L"AutoEndTasks", + (DWORD) DEFAULT_AUTO_END_TASKS); + ShutdownSettings->HungAppTimeout = GetShutdownSettings(DesktopKey, + L"HungAppTimeout", + DEFAULT_HUNG_APP_TIMEOUT); + ShutdownSettings->WaitToKillAppTimeout = GetShutdownSettings(DesktopKey, + L"WaitToKillAppTimeout", + DEFAULT_WAIT_TO_KILL_APP_TIMEOUT); + + RegCloseKey(DesktopKey); +} + +static NTSTATUS FASTCALL +InternalExitReactos(DWORD ProcessId, DWORD ThreadId, UINT Flags) +{ + HANDLE CallerThread; + HANDLE CallerToken; + NTSTATUS Status; + PROCESS_ENUM_CONTEXT Context; + DWORD ReturnLength; + HWND ShellWnd; + UINT ProcessIndex; + char FixedUserInfo[64]; + TOKEN_USER *UserInfo; + SHUTDOWN_SETTINGS ShutdownSettings; + + if (ProcessId != (DWORD_PTR) LogonProcessId) + { + DPRINT1("Internal ExitWindowsEx call not from winlogon\n"); + return STATUS_ACCESS_DENIED; + } + + DPRINT1("FIXME: Need to close all user processes!\n"); + return STATUS_SUCCESS; + + CallerThread = OpenThread(THREAD_QUERY_INFORMATION, FALSE, ThreadId); + if (NULL == CallerThread) + { + DPRINT1("OpenThread failed with error %d\n", GetLastError()); + return STATUS_UNSUCCESSFUL; + } + if (! OpenThreadToken(CallerThread, TOKEN_QUERY, FALSE, &CallerToken)) + { + DPRINT1("OpenThreadToken failed with error %d\n", GetLastError()); + CloseHandle(CallerThread); + return STATUS_UNSUCCESSFUL; + } + CloseHandle(CallerThread); + + Context.ProcessCount = 0; + Context.ProcessData = NULL; + if (! GetTokenInformation(CallerToken, TokenOrigin, &Context.TokenOrigin, + sizeof(TOKEN_ORIGIN), &ReturnLength)) + { + DPRINT1("GetTokenInformation failed with error %d\n", GetLastError()); + CloseHandle(CallerToken); + return STATUS_UNSUCCESSFUL; + } + if (! GetTokenInformation(CallerToken, TokenUser, FixedUserInfo, + sizeof(FixedUserInfo), &ReturnLength)) + { + if (sizeof(FixedUserInfo) < ReturnLength) + { + UserInfo = HeapAlloc(UserServerHeap, 0, ReturnLength); + if (NULL == UserInfo) + { + DPRINT1("Unable to allocate %u bytes for user info\n", + (unsigned) ReturnLength); + CloseHandle(CallerToken); + return STATUS_NO_MEMORY; + } + if (! GetTokenInformation(CallerToken, TokenUser, UserInfo, + ReturnLength, &ReturnLength)) + { + DPRINT1("GetTokenInformation failed with error %d\n", + GetLastError()); + HeapFree(UserServerHeap, 0, UserInfo); + CloseHandle(CallerToken); + return STATUS_UNSUCCESSFUL; + } + } + else + { + DPRINT1("GetTokenInformation failed with error %d\n", GetLastError()); + CloseHandle(CallerToken); + return STATUS_UNSUCCESSFUL; + } + } + else + { + UserInfo = (TOKEN_USER *) FixedUserInfo; + } + CloseHandle(CallerToken); + LoadShutdownSettings(UserInfo->User.Sid, &ShutdownSettings); + if (UserInfo != (TOKEN_USER *) FixedUserInfo) + { + HeapFree(UserServerHeap, 0, UserInfo); + } + Context.CsrssProcess = GetCurrentProcessId(); + ShellWnd = GetShellWindow(); + if (NULL == ShellWnd) + { + DPRINT("No shell present\n"); + Context.ShellProcess = 0; + } + else if (0 == GetWindowThreadProcessId(ShellWnd, &Context.ShellProcess)) + { + DPRINT1("Can't get process id of shell window\n"); + Context.ShellProcess = 0; + } + + // Status = Win32CsrEnumProcesses(ExitReactosProcessEnum, &Context); + if (! NT_SUCCESS(Status)) + { + DPRINT1("Failed to enumerate registered processes, status 0x%x\n", + Status); + if (NULL != Context.ProcessData) + { + HeapFree(UserServerHeap, 0, Context.ProcessData); + } + return Status; + } + + qsort(Context.ProcessData, Context.ProcessCount, sizeof(PCSR_PROCESS), + ProcessDataCompare); + + /* Terminate processes, stop if we find one kicking and screaming it doesn't + want to die */ + Status = STATUS_SUCCESS; + for (ProcessIndex = 0; + ProcessIndex < Context.ProcessCount && NT_SUCCESS(Status); + ProcessIndex++) + { + if (! NotifyAndTerminateProcess(Context.ProcessData[ProcessIndex], + &ShutdownSettings, Flags)) + { + Status = STATUS_REQUEST_ABORTED; + } + } + + /* Cleanup */ + if (NULL != Context.ProcessData) + { + HeapFree(UserServerHeap, 0, Context.ProcessData); + } + + return Status; +} + +static NTSTATUS FASTCALL +UserExitReactos(DWORD UserProcessId, UINT Flags) +{ + NTSTATUS Status; + + /* FIXME Inside 2000 says we should impersonate the caller here */ + Status = NtUserCallTwoParam(UserProcessId, Flags, TWOPARAM_ROUTINE_EXITREACTOS); + + /* If the message isn't handled, the return value is 0, so 0 doesn't indicate + success. Success is indicated by a 1 return value, if anything besides 0 + or 1 it's a NTSTATUS value */ + if (1 == Status) + { + Status = STATUS_SUCCESS; + } + else if (0 == Status) + { + Status = STATUS_NOT_IMPLEMENTED; + } + + return Status; +} + + +/* PUBLIC SERVER APIS *********************************************************/ + +CSR_API(SrvExitWindowsEx) +{ + PCSRSS_EXIT_REACTOS ExitReactosRequest = &((PUSER_API_MESSAGE)ApiMessage)->Data.ExitReactosRequest; + + if (0 == (ExitReactosRequest->Flags & EWX_INTERNAL_FLAG)) + { + return UserExitReactos((DWORD_PTR) ApiMessage->Header.ClientId.UniqueProcess, + ExitReactosRequest->Flags); + } + else + { + return InternalExitReactos((DWORD_PTR) ApiMessage->Header.ClientId.UniqueProcess, + (DWORD_PTR) ApiMessage->Header.ClientId.UniqueThread, + ExitReactosRequest->Flags); + } +} + +/* EOF */ Index: win32ss/user/winsrv/shutdown.c =================================================================== --- win32ss/user/winsrv/shutdown.c (rvision 58607) +++ win32ss/user/winsrv/shutdown.c (copie de travail) Modification de proprits sur win32ss/user/winsrv/shutdown.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/user/winsrv/winsrv.h =================================================================== --- win32ss/user/winsrv/winsrv.h (rvision 58607) +++ win32ss/user/winsrv/winsrv.h (copie de travail) @@ -1,12 +1,75 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS User API Server DLL + * FILE: win32ss/user/winsrv/winsrv.h + * PURPOSE: Main header - Definitions + * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr) + */ + +#ifndef __WINSRV_H__ +#define __WINSRV_H__ + #pragma once /* PSDK/NDK Headers */ -#include -#include - +#include +#include +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H +#include +#include +#include +#include +#include #define NTOS_MODE_USER -#include +#include +#include +#include +#include +#include +#include -#include -#include -#include +/* Public Win32K Headers */ +#include + +/* PSEH for SEH Support */ +#include + +/* External Winlogon Header */ +#include + +/* CSRSS Header */ +#include + +/* USER Headers */ +#include + +/* Public Win32 Headers */ +#include + +#include "resource.h" + + +extern HINSTANCE UserServerDllInstance; +extern HANDLE UserServerHeap; + +extern ULONG_PTR LogonProcessId; + +/* init.c */ +BOOL WINAPI _UserSoundSentry(VOID); + +/* harderror.c */ +VOID WINAPI UserServerHardError(IN PCSR_THREAD ThreadData, + IN PHARDERROR_MSG Message); + +/* register.c */ +CSR_API(SrvRegisterServicesProcess); +CSR_API(SrvRegisterLogonProcess); + +/* shutdown.c */ +CSR_API(SrvExitWindowsEx); + +#endif // __WINSRV_H__ + +/* EOF */ Index: win32ss/user/winsrv/winsrv.rc =================================================================== --- win32ss/user/winsrv/winsrv.rc (rvision 58607) +++ win32ss/user/winsrv/winsrv.rc (copie de travail) @@ -1,4 +1,13 @@ -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS/Win32 console+user usermode server\0" -#define REACTOS_STR_INTERNAL_NAME "winsrv\0" -#define REACTOS_STR_ORIGINAL_FILENAME "winsrv.exe\0" +#include +#include +#include "resource.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS User API Server DLL" +#define REACTOS_STR_INTERNAL_NAME "winsrv" +#define REACTOS_STR_ORIGINAL_FILENAME "winsrv.dll" #include + +#include "rsrc.rc" Index: win32ss/user/winsrv/winsrv.spec =================================================================== --- win32ss/user/winsrv/winsrv.spec (rvision 0) +++ win32ss/user/winsrv/winsrv.spec (copie de travail) @@ -0,0 +1,2 @@ +@ stdcall UserServerDllInitialization(ptr) +@ stdcall _UserSoundSentry() Index: win32ss/user/winsrv/winsrv.spec =================================================================== --- win32ss/user/winsrv/winsrv.spec (rvision 58607) +++ win32ss/user/winsrv/winsrv.spec (copie de travail) Modification de proprits sur win32ss/user/winsrv/winsrv.spec ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: win32ss/win32kp.h =================================================================== --- win32ss/win32kp.h (rvision 58607) +++ win32ss/win32kp.h (copie de travail) @@ -100,7 +100,6 @@ #include "user/ntuser/vis.h" #include "user/ntuser/userfuncs.h" #include "user/ntuser/scroll.h" -#include "user/ntuser/csr.h" #include "user/ntuser/winpos.h" #include "user/ntuser/callback.h"