Commit graph

76 commits

Author SHA1 Message Date
Hermès Bélusca-Maïto 3a4f8f455f Sync with trunk r58740.
svn path=/branches/ros-csrss/; revision=58741
2013-04-13 18:49:50 +00:00
Hermès Bélusca-Maïto d070d323fb [KERNEL32-CONSRV]
- Implement GetLargestConsoleWindowSize (and add a DPRINT to see what happens when Far 1.65 is launched).
- Implement SetConsoleWindowInfo in kernel32 and pre-implement its CONSRV counterpart.

svn path=/branches/ros-csrss/; revision=58726
2013-04-09 15:21:14 +00:00
Hermès Bélusca-Maïto 3a7f8d36e8 [BASESRV-CONSRV-WINSRV]
Code reorganization only: put public server apis definitions in a dedicated include to be included in the respective init.c files.

svn path=/branches/ros-csrss/; revision=58718
2013-04-07 23:39:39 +00:00
Hermès Bélusca-Maïto 463b98e376 Sync with trunk r58687.
svn path=/branches/ros-csrss/; revision=58690
2013-04-06 15:28:22 +00:00
Hermès Bélusca-Maïto 8a45602a5b [KERNEL32-CONSRV]
Implement (Get/Set)ConsoleDisplayMode.

[PSDK]
Reorganize wincon.h a little bit and add few new flags from MSDN / Wine's wincon.h (which was up-to-date compared to ours) and from https://sites.google.com/site/marckupper/utilities/setconsolemode (the ENABLE_AUTO_POSITION flag which happens to be set by default for consoles on Windows Vista+).

[CONSRV]
- Fix the implementation of Srv(Get/Set)ConsoleMode.
- Try to fix some mouse handling problems.
- Add a TEMPORARY HACK!!!! to circumvent one of the many bugs we have in user32/win32k concerning handling right-mouse clicks on windows titlebars.
The comment:
/*
 * HACK: !! Because, when we deal with WM_RBUTTON* and we do not
 * call after that DefWindowProc, on ReactOS, right-clicks on the
 * (non-client) application title-bar does not display the system
 * menu and does not trigger a WM_NCRBUTTONUP message too.
 * See: http://git.reactos.org/?p=reactos.git;a=blob;f=reactos/win32ss/user/user32/windows/defwnd.c;hb=HEAD#l1103
 * and line 1135 too.
 */

Tested with Far Manager 3 (TM)

Happy Easter !!

svn path=/branches/ros-csrss/; revision=58632
2013-04-01 00:23:34 +00:00
Hermès Bélusca-Maïto b0125170ac [PSDK]
Introduce GET_KEYSTATE_WPARAM, GET_NCHITTEST_WPARAM, GET_XBUTTON_WPARAM macros.

[CONSRV]
Fix double-click, mouse scrolling and add support for control keys.

svn path=/branches/ros-csrss/; revision=58623
2013-03-31 00:34:13 +00:00
Hermès Bélusca-Maïto e1f0919480 [CONSRV]
- Compile with Vista+ defines.
- Add basic mouse events support. Tested with Far Manager.

svn path=/branches/ros-csrss/; revision=58620
2013-03-30 22:54:47 +00:00
Hermès Bélusca-Maïto 1e1a59fb22 Synchronize with trunk r58606.
svn path=/branches/ros-csrss/; revision=58607
2013-03-24 19:05:43 +00:00
Hermès Bélusca-Maïto 53eba1ba5f [CONSOLE.DLL-CONSRV]
- Further separate properties of the GUI terminal front-end and those independent of the UI.
- Fix some console initialization steps.

svn path=/branches/ros-csrss/; revision=58605
2013-03-24 17:08:10 +00:00
Hermès Bélusca-Maïto c70f992aa1 Synchronize with trunk r58528.
svn path=/branches/ros-csrss/; revision=58529
2013-03-16 22:10:42 +00:00
Hermès Bélusca-Maïto 17c0fa64de [PSDK]
- Define all the missing STARTF_* flags needed for the STARTUPINFO structure (taken from http://msdn.microsoft.com/en-us/library/windows/desktop/ms686331(v=vs.85).aspx).
  Amongst them is the STARTF_TITLEISLINKNAME flag that I use in the console server to determine whether a console app was started from a shell link, and if so, extract
  the name of the link and its icon.

- Define all the missing SEE_MASK_* flags needed for the SHELLEXECUTEINFO structure, but the Windows 8 flag (taken from http://msdn.microsoft.com/en-us/library/windows/desktop/bb759784(v=vs.85).aspx).
  Furthermore I add three undocumented flags, SEE_MASK_HASLINKNAME, SEE_MASK_HASTITLE and SEE_MASK_FLAG_SEPVDM. These three flags are undocumented and even 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 (see http://msdn.microsoft.com/en-us/library/windows/desktop/bb773217(v=vs.85).aspx).
  So I affect them a range of values which seems to be strangely empty (see the code). 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.

svn path=/branches/ros-csrss/; revision=58479
2013-03-13 01:19:43 +00:00
Hermès Bélusca-Maïto e2d2cb40e2 [CSRSRV]
Clarify few parts of code; remove unneeded comments and DPRINTs; start documentation of the CsrCreateProcess routine.

[BASESRV-CONSRV-WINSRV]
Correct the sizes of the API tables.

[SM]
Correct the API names.

svn path=/branches/ros-csrss/; revision=58464
2013-03-10 19:37:33 +00:00
Hermès Bélusca-Maïto 840ea98cba Synchronize with trunk r58457.
svn path=/branches/ros-csrss/; revision=58458
2013-03-10 01:01:36 +00:00
Hermès Bélusca-Maïto 5819952ab9 [CONSRV-USER32-WINSRV]
Pre-synchrosize with trunk, by applying some changes from revision r58411.

svn path=/branches/ros-csrss/; revision=58455
2013-03-09 21:52:12 +00:00
Hermès Bélusca-Maïto 62f4efcc97 [KERNEL32-CONSRV]
Remove the old implementation of GetConsoleInputWaitHandle which was commented-out for some time.

[BASESRV]
Correct few names.

svn path=/branches/ros-csrss/; revision=58454
2013-03-09 21:21:37 +00:00
Hermès Bélusca-Maïto c708f46621 [NTDLL]
Fix CsrCaptureTimeout (verified against Windows Server 2003).

[KERNEL32-CSRSRV-BASESRV-CONSRV-WINSRV]
Clean the code: remove unuseful comments and dprints, reorganize a little bit few source files.

svn path=/branches/ros-csrss/; revision=58453
2013-03-09 21:08:23 +00:00
Hermès Bélusca-Maïto 28842d99ad [CONSOLE.DLL-KERNEL32-CONSRV]
Fix the console properties dialog, when launching and transmitting console properties. Before, the properties dialog was directly launched by the console server (consrv), running with CSRSS (System) privileges, what constituted a security hole. Now, I create a remote thread in the running process owning the console for launching the properties dialog (thus it has only user privileges, and not System ones anymore). For that purpose, I basically took the technique described in the following paper (Cesar Cerrudo, "Story of a dumb patch", http://www.argeniss.com/research/MSBugPaper.pdf or http://www.scn.rain.com/~neighorn/PDF/MSBugPaper.pdf), where basically the console server shares the console properties via a shared memory section with the console properties dialog dll. The address of the thread which launches the dialog in the context of the console app is given to the console server the same way as we do for the control handler (called e.g. when you press Ctrl-C, etc...)
Of course this is quite hackish, because you have the GUI interface split between the console server and the console properties dialog dll. Something far more elegant would be to put all the GUI thingie into a dedicated dll or exe, running with the same privileges as the console program itself (a kind of console -- or terminal -- emulator).

[CONSOLE.DLL]
Fix retriving / setting colors.c and other things.

[CONSRV.DLL]
- Fix retrieving / setting console properties from the registry (via the HKCU\Console\* keys), via the shell shortcuts (not totally done at the moment, because somebody has to implement properly that thing : http://msdn.microsoft.com/en-us/library/windows/desktop/bb773359(v=vs.85).aspx (NT_CONSOLE_PROPS structure stored as a shortcut data block) (at application launching time), and via the console properties dialog.
- Few DPRINTs removed.

svn path=/branches/ros-csrss/; revision=58415
2013-03-03 15:35:12 +00:00
Hermès Bélusca-Maïto 8f8ab2e68c [PSDK]
- Add ENABLE_INSERT_MODE, ENABLE_QUICK_EDIT_MODE and ENABLE_EXTENDED_FLAGS flags.
- Add GetConsoleAliasExesA/W and GetConsoleAliasExesLengthA/W api definitions.

[DOSKEY]
Remove unneeded definitions since now these are declared in the psdk.

svn path=/branches/ros-csrss/; revision=58345
2013-02-20 22:28:14 +00:00
Hermès Bélusca-Maïto f4d53fbd91 [KERNEL32-CONSRV]
- Introduce a CONSOLE_PROPS structure to hold console properties such as its title or startup attributes it should have. Initialized at console application launch time. I have to see how could it be possible to merge this structure with some parts of the GUI_CONSOLE_DATA structure and of the ConsoleInfo structure from console.dll (in /dll/cpl).
- Use a helper function to initialize the CONSOLE_PROPS structure in kernel32, at console app start or when calling AllocConsole.
- In BasepInitConsole, do initialization of CONSOLE_PROPS and related only if we are about to launch a console app.

[CONSRV]
- Adapt CONSOLE_CONNECTION_INFO and CONSOLE_ALLOCCONSOLE structures to take into account CONSOLE_PROPS.
- Fix the way we are setting console titles.
- Add experimental support for loading console properties and title and icon from shell links, thanks to the helper LoadShellLinkInfo. However I'm using there Shell COM facility to extract link properties (I could do it "the RAW way", however I would then know the format of link files, that I don't know and that I don't want to mix up with the console code). Therefore I must add dependencies to uuid and ole32 libraries. Note that icons are used in GUI consoles only (use the PrivateExtractIconExW function to retrieve both handles to the big and small icons at the same time).

Part 1/2

[CONSRV]
- Remove an unuseful xxxInitScreenBuffer function in the virtual functions console table.
- In GUI_CONSOLE_DATA structure and related functions, temporarily explicitely mark which members may be used for both GUI and TUI consoles (for a future simplification).
- Add temporary debug prints when we are setting console icon, to see the flow of calls (will be removed just before merging back to trunk).
- Add temporary debug prints in ConSrvInitConsoleScreenBuffer and ConioDeleteScreenBuffer, to figure out how SBs are initialized.

svn path=/branches/ros-csrss/; revision=58305
2013-02-10 12:36:57 +00:00
Hermès Bélusca-Maïto bb519801e2 - Sync with trunk r58248 to bring the latest changes from Amine (headers) and others (hebrew translation, etc...)
- Include only the necessary headers in csrss/csrsrv/basesrv/consrv/winsrv.

svn path=/branches/ros-csrss/; revision=58249
2013-01-28 22:45:53 +00:00
Hermès Bélusca-Maïto b75ee7fd14 [CSRSRV]
- Zero-out some allocated memory.
- During my investigations preceding the implementation of AttachConsole (r58166), I wanted (in a first attempt; finally I've found a better way to achieve what I wanted to do) to retrieve the CSR_PROCESS structure of the parent of a given process. I've found the 'Parent' member in the CSR_PROCESS structure, however this member was always initialized to NULL when new processes were created via CsrCreateProcess (and via the call to CsrInsertProcess). After looking at some informating here (http://svn.reactos.org/svn/reactos/trunk/reactos/include/subsys/csr/server.h?r1=17363&r2=17362&pathrev=17363) and there (http://forum.sysinternals.com/csrwalker-processes-detection-from-user-mode_topic15457.html), I became convinced that the 'Parent' member was unexistent starting from Windows Server 2003. Also, after much more investigation, I've found that the CsrInsertProcess function was called with only two parameters starting from Windows Server 2003 (and still continues in Windows 7), the always-NULL paramater being removed.
Therefore, I remove that unneeded parameter from CsrInsertProcess and the corresponding 'Parent' member from CSR_PROCESS.

svn path=/branches/ros-csrss/; revision=58232
2013-01-26 21:23:10 +00:00
Hermès Bélusca-Maïto 573e7edb6f [KERNEL32]
Fix support for CONIN$ and CONOUT$, and add support for CON special file
(now, writing to C:\CON or C:\somepath\CONIN$ or C:\anotherpath\CONOUT$ works).

svn path=/branches/ros-csrss/; revision=58182
2013-01-16 00:16:06 +00:00
Hermès Bélusca-Maïto df7477717c [KERNEL32]
- Correct a error return code (in AllocConsole).
- Implement AttachConsole (inspired by AllocConsole).

[CONSRV]
- Correct a error return code (in AllocConsole).
- Introduce helper functions to simplify console-initialization code.
- Implement server-side of AttachConsole (I used pieces of code from ConsoleNewProcess, ConsoleConnect and SrvAllocConsole).

Some debug prints were introduced (for debug-purposes :P), will be removed when all things work.

TODO: have a look on the handles code.

svn path=/branches/ros-csrss/; revision=58166
2013-01-13 17:07:25 +00:00
Hermès Bélusca-Maïto 122303c4ea Sync with trunk r58151 to bring the latest changes from Amine and Timo.
svn path=/branches/ros-csrss/; revision=58152
2013-01-09 20:12:23 +00:00
Hermès Bélusca-Maïto 86fa2ba4e0 [KERNEL32-CONSRV]
Rename some structures (CSRSS_... ---> CONSOLE_...) and clarify what the ConsoleHandle members are for (--> OutputHandle or InputHandle).
No code changes otherwise.

svn path=/branches/ros-csrss/; revision=58119
2013-01-05 23:10:12 +00:00
Hermès Bélusca-Maïto 51aa122e2d Sync with trunk r58113.
svn path=/branches/ros-csrss/; revision=58114
2013-01-04 13:36:15 +00:00
Hermès Bélusca-Maïto e635242284 [KERNEL32/BASESRV]
Remove now unneeded bInheritHandles member / parameter.

svn path=/branches/ros-csrss/; revision=58097
2013-01-01 23:41:42 +00:00
Hermès Bélusca-Maïto d820098fa6 [KERNEL32/BASESRV/CONSRV]
- Fix console apps initialization.
- Introduce a helper function InitConsoleCtrlHandling for initializing console control handling.
- We now initialize the new created console when connecting the client (kernel32) to the server (consrv) by calling CsrClientConnectToServer with real parameters (not dummy ones).
- Add/activate some debug prints (will be removed when all things work).

Part 1/2

svn path=/branches/ros-csrss/; revision=58096
2013-01-01 23:36:19 +00:00
Hermès Bélusca-Maïto 2e57ad7cbd [CONSRV]
I replaced by error the mask 0x10000003 by 0x3, which had as an effect to match handles of value 0xffffffff (invalid_handle_value). Fichtre !

svn path=/branches/ros-csrss/; revision=58064
2012-12-30 22:00:20 +00:00
Hermès Bélusca-Maïto c0399e88a6 [KERNEL32/CONSRV]
- Code reorganization.
- In particular, move IsConsoleHandle macro to a place which it can be used by both kernel32 and consrv.

svn path=/branches/ros-csrss/; revision=58063
2012-12-30 21:02:12 +00:00
Hermès Bélusca-Maïto d6769b4364 [KERNEL32-CONSRV]
* HANDLE_TYPE --> CONSOLE_HANDLE_TYPE because it hits "previous" definition of this enumeration (a totally different one from win32ss/include/ntuser.h)
* Temporarily add a dummy member to the CONSOLE_CONNECTION_INFO structure, to make MSVC happy.

svn path=/branches/ros-csrss/; revision=58055
2012-12-30 13:25:50 +00:00
Hermès Bélusca-Maïto dba80b614b Sync with trunk revision r58045 to bring the corrections on configure.cmd and on widl/wpp.
svn path=/branches/ros-csrss/; revision=58046
2012-12-29 20:57:10 +00:00
Hermès Bélusca-Maïto f44e914e80 Sync with trunk r58033.
svn path=/branches/ros-csrss/; revision=58034
2012-12-28 23:37:33 +00:00
Hermès Bélusca-Maïto 3d2c0a805b - Synchronize up to trunk's revision r57864.
- [CONSRV/WINSRV] Add langage definition support.

svn path=/branches/ros-csrss/; revision=57865
2012-12-10 23:01:20 +00:00
Hermès Bélusca-Maïto ca2cc847d2 [CONSRV]
- Delete all the remnants of Win32CsrValidateBuffer calls, which were replaced by standard CsrValidateMessageBuffer calls, and therefore delete the unused server.c file.
- Adapt WriteConsole API to use CSR waits. This replaces the old event-based waiting.

TODO: Dereference all the waits in Console->WriteWaitQueue.

svn path=/branches/ros-csrss/; revision=57819
2012-12-08 16:13:16 +00:00
Hermès Bélusca-Maïto 0da8c7abf0 [CONSRV]
"Reply Already Sent" and not already done !

svn path=/branches/ros-csrss/; revision=57818
2012-12-08 00:45:41 +00:00
Hermès Bélusca-Maïto 0d59b8df65 [KERNEL32]
- Simplify IntGetConsoleInput and IntReadConsole.

[CONSRV]
- Implement event waiting for reading console input buffer with CSR wait blocks. This replaces the event-based waiting which, after being moved from client-side (kernel32) to server-side (see r57721), made all consoles hang when one of them was waiting for new input.

TODO: Dereference all the waits in Console->ReadWaitQueue.

svn path=/branches/ros-csrss/; revision=57817
2012-12-08 00:39:24 +00:00
Hermès Bélusca-Maïto 80d0bde839 [CSRSRV/BASESRV/CONSRV/WINSRV]
- Add a useful CHECK_API_MSG_SIZE macro to check whether a server message structure can hold in a CSR_API_MESSAGE structure. These checks are required because LPC will use the generic CSR_API_MESSAGE structure for communicating all the different servers' messages, and thus we avoid possible buffer overflows with this method.
- Effectively use this macro for all the server message structures.
- Remove a hack regarding the maximum data size we can pass through the CSR LPC port.
- Remove the now unused CSRSS_HEADER_SIZE symbol.

svn path=/branches/ros-csrss/; revision=57810
2012-12-06 23:43:31 +00:00
Hermès Bélusca-Maïto ae20fbcb81 [CSRSRV]
- Comment on the size of some members of the CSR_WAIT_BLOCK structure.
- Initialize the WaitBlock member of CSR_THREAD to a valid value when creating a wait block, and NULLify it when we release a wait block.
- ALWAYS USE offsets in CSR_CAPTURE_BUFFER structure, instead of real pointers !! It is needed when their base address change (eg. during a CSR wait, their base address, corresponding to the address of an CSR API message, change) (found when testing CSR waits with the console).

svn path=/branches/ros-csrss/; revision=57806
2012-12-05 23:21:41 +00:00
Hermès Bélusca-Maïto 014c8dde50 Well, "Types".
svn path=/branches/ros-csrss/; revision=57802
2012-12-04 23:04:54 +00:00
Hermès Bélusca-Maïto 2599e85e27 [CSRSRV]
- Correct a misspelling 'CsrThreadAltertable' -> 'CsrThreadAlertable'.
- Introduce CSR_REPLY_CODEs instead of using hardcoded values, and use them with CSR_API_ROUTINE-type functions. They correspond to which decision CSRSRV should take after a server function is called: answer to the client or not, and perform according tasks.

[BASESRV]
Use CSR_REPLY_CODEs.

svn path=/branches/ros-csrss/; revision=57801
2012-12-04 23:01:54 +00:00
Hermès Bélusca-Maïto 24087a3b01 Synchronize up to trunk's revision r57784.
svn path=/branches/ros-csrss/; revision=57785
2012-11-30 21:32:42 +00:00
Hermès Bélusca-Maïto 2d18c1a929 Synchronize up to trunk's revision r57756.
svn path=/branches/ros-csrss/; revision=57757
2012-11-24 13:02:15 +00:00
Hermès Bélusca-Maïto 60e03ccee8 [KERNEL32]
Deactivate the code of GetConsoleInputWaitHandle, because it calls a function that doesn't seem to appear in the console server apis listed in http://j00ru.vexillium.org/csrss_list/api_list.html (and that I haven't included in the console server apis list), until I find a better solution. It fixes compilation.

[CONSRV]
- Code reorganization
- Introduce the CONSOLE_CONNECTION_INFO structure needed for initializing consoles when launching a program (see http://svn.reactos.org/svn/reactos/trunk/reactos/lib/kernel32/misc/dllmain.c?r1=16826&r2=16825&pathrev=16826), instead of calling AllocConsole. Not used at this time.

Now the branch compiles.

svn path=/branches/ros-csrss/; revision=57749
2012-11-23 19:37:20 +00:00
Hermès Bélusca-Maïto 90229a39a0 [KERNEL32/CONSRV]
- Merge IntWriteConsoleOutputCharacter and WriteConsoleOutputAttribute functions into IntWriteConsoleOutputCode helper functions, which is used inside WriteConsoleOutputAttribute and WriteConsoleOutputCharacterW/A.
- In server-side, merge CsrWriteConsoleOutputChar and CsrWriteConsoleOutputAttrib into the server API SrvWriteConsoleOutputString.
- The structures CSRSS_WRITE_CONSOLE_OUTPUT_CHAR and CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB are merged into CSRSS_WRITE_CONSOLE_OUTPUT_CODE.

[CONSRV]
- Add a CsrValidateMessageBuffer usage.

svn path=/branches/ros-csrss/; revision=57740
2012-11-19 23:26:36 +00:00
Hermès Bélusca-Maïto 5e77b6714d Forgot this part.
svn path=/branches/ros-csrss/; revision=57739
2012-11-19 21:52:59 +00:00
Hermès Bélusca-Maïto e71f1dd200 [KERNEL32/CONSRV]
- Merge IntFillConsoleOutputCharacter and FillConsoleOutputAttribute functions into IntFillConsoleOutputCode helper and make it used by FillConsoleOutputAttribute/CharacterW/A.
- In server-side, CsrFillOutputChar and CsrFillOutputAttrib are merged into SrvFillConsoleOutput.
- Merge CSRSS_FILL_OUTPUT and CSRSS_FILL_OUTPUT_ATTRIB structures into CSRSS_FILL_OUTPUT.

svn path=/branches/ros-csrss/; revision=57734
2012-11-18 17:06:48 +00:00
Hermès Bélusca-Maïto e505499a2c [CONSRV]
CsrSetTextAttrib --> SrvSetConsoleTextAttribute and activate it in the list of APIs indices.

svn path=/branches/ros-csrss/; revision=57732
2012-11-18 14:30:25 +00:00
Hermès Bélusca-Maïto de31fffea8 [KERNEL32/CONSRV]
- Use new structures and api indices namings (as usual).

[CONSRV]
- Merge CSRSS_SET_TITLE and CSRSS_GET_TITLE into CSRSS_CONSOLE_TITLE.
- Merge CSRSS_GET_CONSOLE_(OUTPUT_)CP and CSRSS_SET_CONSOLE_(OUTPUT_)CP into CSRSS_CONSOLE_CP.
- NtDuplicateObject(GetCurrentProcess(), ... ---> NtDuplicateObject(NtCurrentProcess(), ...
- Use CsrValidateMessageBuffer instead of Win32CsrValidateBuffer.
- Use CONSOLE_PROCESS_DATA structure.

TODO: Remove a DPRINT1 checkpoint in SrvAllocConsole after future tests are OK.

svn path=/branches/ros-csrss/; revision=57727
2012-11-18 13:10:03 +00:00
Hermès Bélusca-Maïto 3a0d4c3269 [KERNEL32]
- Add some NULL checks.
- Use new structures and api indices namings.

svn path=/branches/ros-csrss/; revision=57726
2012-11-17 23:45:14 +00:00