Commit graph

50582 commits

Author SHA1 Message Date
Alex Ionescu 0e2219f054 [NTOSKRNL]: MOV CRX, YYY and MOV YYY, CRX, as well as the DR equivalents were not correctly detected as privileged instructions in the GPF handler. Fixes Winetests.
[NTOSKRNL]: The "Write" bit in the x86 Error Code is not bit 1, it is bit 2. Fix all the GPF handlers to check for bit 2 instead when determining if an exception was due to read or write. Fixes Winetests.
I'll say it nicely this time for Timo: when you rewrite ASM, do it carefully :)

svn path=/trunk/; revision=55735
2012-02-20 06:43:54 +00:00
Alex Ionescu 1e172203a6 [NTOSKRNL]: Implement ProcessDebugObjectHandle and a bunch more query/set process classes. Fixes Winetests.
[NTOSKRNL]: We should not be setting *ReturnLength in most failure cases, so no longer do so. Fixes Winetests.

svn path=/trunk/; revision=55734
2012-02-20 06:42:02 +00:00
Alex Ionescu 62930b0461 [RTL]: Force RtlIpToString APIs to behave inexplicably like on Windows, returning -1 instead of crashing when sprintfing to a NULL pointer.
svn path=/trunk/; revision=55733
2012-02-20 06:37:13 +00:00
Alex Ionescu d3418a128b [KERNEL32]: Add support for NO_DEBUG_INHERIT in CreateProcess. Fixes a winetest.
svn path=/trunk/; revision=55732
2012-02-20 06:36:17 +00:00
Alex Ionescu 4e027af35c [NTOSKRNL]: NtQuerySystemInformation(SystemProcessInformation) should skip zombie processes, and it should use the KTHREAD ThreadListEntry, not the ETHREAD ThreadListEntry. Fixes winetest since Idle Threads are int he former, not the latter (verified and Windows does this too).
svn path=/trunk/; revision=55731
2012-02-20 06:35:05 +00:00
Sir Richard 8fa73c4dc6 [NTDLL_WINETEST]: Skip an obviously nonsensical test of trying to sprintf into NULL.
svn path=/trunk/; revision=55730
2012-02-20 01:13:50 +00:00
Alex Ionescu 19a5d85926 [NTDLL/RTL]: Implement RtlGet/SetThreadErrorMode.
[NTDLL/RTL]: Fix RtlIpv4AddressToStringA and RtlIpv4AddressToStringW to work like in Windows (and crash with a NULL buffer).

svn path=/trunk/; revision=55729
2012-02-20 01:13:31 +00:00
Alex Ionescu 9d05ce3297 [NTOSKRNL]: Fix ntdll:om winetest. When querying for filenames if the caller did not specify a buffer large enough (which they normally don't, initially), we would just fail but not tell them how large to request it (so they'd get back an uninitailized huge value).
svn path=/trunk/; revision=55728
2012-02-20 00:11:24 +00:00
Giannis Adamopoulos b65af38817 [user32_apitest]
- Test the initial desktop and window station of processes

svn path=/trunk/; revision=55727
2012-02-19 23:46:06 +00:00
Giannis Adamopoulos 97e75d9ef2 [win32k]
- remove assertions from the process callout checking that ppiCurrent->rpdeskStartup and ppiCurrent->hdeskStartup are valid. This can happen in case we fail to open the initial desktop or window station

svn path=/trunk/; revision=55726
2012-02-19 23:29:28 +00:00
Cameron Gutman 69d0df4728 [USBEHCI]
- Try to fix reset bugs in my code and remove hacks
- Don't clear extra bits when acknowledging a port connect status change
[USBOHCI]
- Code cleanup
- No functional change

svn path=/trunk/; revision=55725
2012-02-19 22:22:45 +00:00
Giannis Adamopoulos 850d4b4ddf [ntoskrnl]
- Fix a crash in KiSystemCall that was caused because PsConvertToGuiThread may have switched to a large kernel stack, but still returned with failure because win32k did not succeed. To fix it reload the trap frame after the call before checking for success.

svn path=/trunk/; revision=55724
2012-02-19 22:05:25 +00:00
Alex Ionescu d46e167a87 sigh.
svn path=/trunk/; revision=55723
2012-02-19 20:23:56 +00:00
Alex Ionescu ca2598c831 [CSRSRV]: Some misc cleanup of dead code. No functional change.
svn path=/trunk/; revision=55722
2012-02-19 20:16:36 +00:00
Alex Ionescu 79ef1a1380 [CSRSRV]: Heh, fix a bug, which I think caused the crash in CSRSS during other process' crashes.
svn path=/trunk/; revision=55721
2012-02-19 20:13:07 +00:00
Alex Ionescu 0e457a22c3 [CSRSRV/KERNEL32]: Close the last big architectural known issue: we were not notifying CSRSRV of server threads within server-to-server situations. Port and fix CsrCreateRemoteThread from CSRSRV2, and call it from Kernel32 now when running inside the server itself. Also fix BaseProcessStart not to exit the whole process during an exception.
At this point, other issues are unknown regressions.

svn path=/trunk/; revision=55720
2012-02-19 20:09:49 +00:00
Alex Ionescu 339ee42bae [NTOSKRNL]: The ExitTime in ETHREAD is unionized and only valid if the thread actually exited, so don't always return the raw value -- return 0 if the thread is still alive. Fixes code which uses ExitTime != 0 to tell if a thread is still alive or not -- everyone always thought all ReactOS threads are always dead.
svn path=/trunk/; revision=55719
2012-02-19 20:08:11 +00:00
Alex Ionescu 682a93c9f9 [CSRSRV]: Sometimes too much of a hybrid is no longer a good thing. Rewrite the CSRSRV API loop to match (almost -- except the actual API conversion which is different in ReactOS) the CSRSRV2 loop, with the correct handling of datagrams, errors, exceptions, death messages, etc...
[CSRSRV]: Add special handling for certain messages (similar to how "Reply" is used in CSRSRV2) so that we don't keep replying to the wrong thead. For example, during an ExitProcess, special handling is needed at the end of the loop.
[CSRSRV]: Remove the last few remaining legacy process management function and use the correct CsrLock/Unlock APIs instead. No longer leak references for every process like crazy. Fully manage proc/thread/session reference counts now.
At this point it looks like there might just be one issue left before this thing works right (minus potential regressions due to missed hacks).

svn path=/trunk/; revision=55718
2012-02-19 19:40:28 +00:00
Alex Ionescu 0181638af5 [KERNEL32/CSRSRV]: Handle ExitProcess CSRSS message and implement CsrDestroyProcess to do so. Also implement CsrDestroyThread for future purposes.
svn path=/trunk/; revision=55717
2012-02-19 18:46:05 +00:00
Alex Ionescu 860a4e8855 [CSRSRV]: Don't bail out incorrectly if we get a LPC_EXCEPTION. Also DPRINT1 when we get one.
svn path=/trunk/; revision=55716
2012-02-19 18:23:31 +00:00
Alex Ionescu bb061c1598 [CSRSRV]: Implement support for exception messages now that these get sent.
svn path=/trunk/; revision=55715
2012-02-19 18:05:49 +00:00
Johannes Anderwald 607a047392 [USBCCGP]
- Remove assert hit during install of hid devices

svn path=/trunk/; revision=55714
2012-02-19 15:43:18 +00:00
Alex Ionescu 2a5d344d96 [CSRSRV/KERNEL32]: Do the Windows thing and send a unified LPC message when a new process is created, which includes the thread information as well, instead of sending two LPC messages per process. Perf++.
[CSRSRV/kERNEL32]: Switch to using the Windows CSRSS message structure for a new process, minus the bInheritHandles field which we still support for ReactOS compatibility.
[CSRSRV]: Port CsrCreateProcess from CSRSRV2, rewrite CsrSrvCreateProcess to use this API, and add required ReactOS compatibility hacks. A lot of stuff is still not supported, but the minimum (ie: previous ReactOS functionality) has been maintained during the transition. Processes are now tracked correctly, but there are still refcount leaks (known, to be fixed later).
Will let this breathe for a bit now to catch regressions. Work can now continue back on the kernel32 side while that happens.

svn path=/trunk/; revision=55711
2012-02-19 11:39:07 +00:00
Alex Ionescu 83ad639dc9 [CSRSRV]: It seems safe to now enable the #if0'ed out functionality of CsrCreateThread, as all thread/processes are tracked properly now.
svn path=/trunk/; revision=55710
2012-02-19 11:34:45 +00:00
Stefan Ginsberg b2cabd4df9 [NTOSKRNL]
- Fix KiEnterV86Mode's check for TRAP_DEBUG to #if instead of #ifdef, it is either defined to 1 or 0, like DBG.

svn path=/trunk/; revision=55709
2012-02-19 10:38:38 +00:00
Alex Ionescu 7991c9c192 [CSRSRV]: Let's see if touching the CSR header file kills CSRSRV again. Re-enable the #if'0ed code that merely added a few fields to the create process structure. I think we no longer have weird fucked up dependencies on exact structure byte sizes. I hope.
svn path=/trunk/; revision=55708
2012-02-19 10:19:16 +00:00
Alex Ionescu 8306172b6a [CSRSRV]: Properly implement CsrSrvCreateThread now that the worker thread issue is fixed. CSR_THREAD's are now created for everyone, and CSRSS succesfully duplicates their thread handle! Also, while connections from unknown threads are still allowed (in case I missed something), we do warn on the console about these guys now.
svn path=/trunk/; revision=55707
2012-02-19 10:12:14 +00:00
Alex Ionescu 07ea12ee5b [RTL/NTDLL/KERNEL32]: Rtl provides worker queue and timer queue functionality, which queues a worker thread associated with a caller-supplied callback. In Windows, Rtl by default calls RtlCreateUserThread, but as soon as kernel32 loads, it's DllMain calls an exported function RtlSetThreadPoolStartFunc which changes that default to a special Base function that calls CreateRemoteThread instead. The net result is that Win32 processes using the Rtl functionality get their threads properly registered with CSRSS. In ReactOS, this did not happen, so when those threads called into CSRSS, CSRSS had no CSR_THREAD structure/state for them, which is why CsrCreateThread (and the API loop) are so badly hacked. This commit implements RtlSetThreadPoolStartFunc, implements the kernel32 base functions which wrap CreateRemoteThread, and implements the rtl functions which wrap RtlCreateUserThread. Services, Setup, and any ReactOS application using RPC now have the worker threads correctly registered.
svn path=/trunk/; revision=55706
2012-02-19 10:06:31 +00:00
Alex Ionescu 55e9cddf05 [CSRSRV]: Take a refernece to the client thread since we are dereffing it...
svn path=/trunk/; revision=55705
2012-02-19 10:00:47 +00:00
Alex Ionescu f34ec165f6 [CSRSRV]: Port CsrLockedReferenceThread from CSRSRV2.
svn path=/trunk/; revision=55704
2012-02-19 09:57:00 +00:00
Alex Ionescu 131b6d2ea6 [CSRSRV2]: Bugfix, don't dereference the thread instead of referencing it!
svn path=/trunk/; revision=55703
2012-02-19 09:54:41 +00:00
Johannes Anderwald 83e2f62323 [USBSTOR]
- Fix bugs introduced in rev 55695

svn path=/trunk/; revision=55702
2012-02-19 09:45:54 +00:00
Thomas Faber f9a5be185d [NTOSKRNL]
- Make Trap debugging usable again. Suggested by Stefan.

svn path=/trunk/; revision=55701
2012-02-19 08:38:09 +00:00
Alex Ionescu 59ac9cae89 [CSRSRV]: Fix scenario when a new thread is being created from within CSRSRV and it could not register itself due to the new server-to-server support. Fixes CTRL-C and using the "X" button in a console window to close it, which had regressed since the server-to-server commit.
svn path=/trunk/; revision=55700
2012-02-19 07:22:37 +00:00
Alex Ionescu 7d4a765fe0 [CSRSRV]: I confused ShutdownCallback with DisconnectCallback. What win32csr needs is actually the later. Fixed that. Also removed CallProcessDeleted since we already call the Disconnectcallback from CsrRemoveProcess, which we do call in CSRSRV. Enabled the code that was disabled.
svn path=/trunk/; revision=55699
2012-02-19 06:44:09 +00:00
Alex Ionescu 002ef4e66b [CSRSRV]: Switch to the CSRSRV2 model of having a dynamic amount of threads handling CSRSS requests depending on how many are deadlocked, instead of creating a thread for every single client. CSRSRV now has about 2 API threads instead of 16.
svn path=/trunk/; revision=55698
2012-02-19 06:32:17 +00:00
Alex Ionescu 86597860d2 [CSRSRV]: No longer accept connections from unknown processes.
svn path=/trunk/; revision=55697
2012-02-19 04:18:33 +00:00
Alex Ionescu e403a8e2e1 [CSRSRV/WIN32CSR]: Remove all the code that was setting new values for DataLength/TotalLength in the LPC header. I have no idea why the code was doing this. I suspect it's partly to blame for why changing the structures of the CSRSS messages caused bizarre failures. Perhaps this behavior was needed with the original winsock-based LPC implementation that I rewrote back in 2006?
svn path=/trunk/; revision=55696
2012-02-19 03:51:36 +00:00
Johannes Anderwald 53bd8f1e21 [USBSTOR]
- Queue inquriry & format capacity command with an irp

svn path=/trunk/; revision=55695
2012-02-19 02:47:35 +00:00
Alex Ionescu fa51806949 Missed these guys.
svn path=/trunk/; revision=55694
2012-02-19 02:25:31 +00:00
Alex Ionescu d68458a259 [NTOSKRNL]: Implement ThreadBreakOnTermination for the SET case.
Cleanup some dbgprints.

svn path=/trunk/; revision=55693
2012-02-19 02:24:52 +00:00
Alex Ionescu 37d7c2aa03 [CSRSRV/WIN32CSR]: Make Win32CSR much closer to a real CSRSS Server DLL than before, and make calling the Server callbacks compatible with the correct CSR_SERVER_DLL structure. API dispatching is still all wrong, though.
svn path=/trunk/; revision=55692
2012-02-19 01:53:58 +00:00
Johannes Anderwald 6e38e0e13c [USBEHCI]
- Remove assertion which no longer holds
- Delete old queue head after a new queue head has been sucessfully fetched 

svn path=/trunk/; revision=55691
2012-02-19 00:16:50 +00:00
Alex Ionescu 727c97602e [NTOSKRNL]: When you rewrite my ASM code, get it right, dumbasses. Thanks Stefan.
svn path=/trunk/; revision=55690
2012-02-19 00:08:50 +00:00
Alex Ionescu 1966e04ee2 [CSRSRV]: Remove a bunch of hacks and don't attach the shared section when CSRSS is connecting to itself (which happens because our Win32k does that). Things are cleaner now :)
svn path=/trunk/; revision=55689
2012-02-19 00:04:05 +00:00
Alex Ionescu 28f0bba7b4 [NTOSKRNL]: Implement SeCheckPrivilegedObject and call it in the two cases where it's needed (when changing process priority) instead of spamming the debug log that we're not doing the check.
[NTOSKRNL]: Implement ProcessUserModeIOPL info level (and implement Ke386SetIopl) instead of spamming we can't do this.
[NTOSKRNL]: Implement ProcessExecuteOptions info level (and implement MmSetExecuteOptions) instead of spamming we can't do this.
[NDK]: Add NoExecute Flags based on ProcessHacker.
No longer spammed to death for every process all the time.

svn path=/trunk/; revision=55688
2012-02-18 23:59:31 +00:00
Johannes Anderwald 656f87b67c [USBOHCI]
- Don't preserve command status values when notifying controller of a new bulk / control endpoint
- Abort pipe & reset data toggle in the sync reset routine
- Allocate interface descriptors and endpoint handles when creating the configuration descriptor
- Implement routine for allocating chained descriptors 
- Implement data toggle for bulk&interrupt transfers
- Mass storage devices should now work in real hardware with OHCI controller
- Tested in real hardware with NEC Corporation USB [1033:0035] (rev 43)

svn path=/trunk/; revision=55687
2012-02-18 23:23:13 +00:00
Amine Khaldi 87a7ba545c * Get rid of $Id$ usage and the related svn property.
svn path=/trunk/; revision=55685
2012-02-18 22:57:24 +00:00
Alex Ionescu 3bd63cad35 [KERNEL32]: Try to connect to the Console Server when initializing console support. For normal apps, won't do anything since ConnectionInfo == NULL (to hack around the fact there's no server in ReactOS for this), but for DLLs running inside of CSRSS, because we now support Server-to-Server, the call will detect that and not fail. This fixes the "failed to give us console" error when kernel32 inside of csrss tries to get a console (which it shouldn't). There's still user32 to cleanup.
svn path=/trunk/; revision=55684
2012-02-18 22:29:46 +00:00
Stefan Ginsberg c718e04922 [NTOSKRNL]
KdInitSystem may be called after system set up if /CRASHDEBUG is enabled and a bugcheck or NMI occurs. With the INIT discard/delete now implemented, and KdInitSystem marked for INIT, this would have resulted in a crash...during a system crash, if /CRASHDEBUG had been enabled. Fun.

svn path=/trunk/; revision=55680
2012-02-18 13:39:08 +00:00