Commit graph

41364 commits

Author SHA1 Message Date
Sir Richard 34fa6fb97b [CSRSRV]: Move the new process/thread management functions into new, dedicated files. Export some of the functions, so that win32csr can use them by linking to csrsrv. Last change needed for barebones user-mode shutdown support.
svn path=/trunk/; revision=46052
2010-03-10 06:49:53 +00:00
Sir Richard 1cd9cb22ef [CSRSS]: Split off CSRSS into a more Windows-friendly model. CSRSS.EXE is simply a stub which loads CSRSRV.DLL, where all the actual code is present.
[CSRSRV]: Mostly moved all the current CSRSS code into CSRSRV, with some very minor changes to get it workking.
[CSRSRV]: Add some more code from Alex's CSRSRV, such as thread dereferencing/deallocation, hacked to work.
[CSRSRV]: Make CsrTerminateProcess destroy each CSR thread in that process, otherwise we were always leaking a handle, so processes never died. Because of this, primary tokens would remain "in use", and when umpnpmgr attempted to do a "Create Process as User" for the second+ time, the call would fail since the token from the first process was still around. This fixed that regression from the mailing list.

svn path=/trunk/; revision=46051
2010-03-10 04:59:39 +00:00
Timo Kreuzer e0c972bf4e [FREELDR] Define _BLDR_ for WDK header compatibility
[HAL] Define _NTHALDLL_ for WDK header compatibility, get rif of DECLSPEC_IMPORT header hack
[NDK/RTL] Fix some Rtl prototypes (PCHAR -> PCCH)
[NDK] Fix ZwOpenEvent prototype
[NTIFS] Fix definition of NTKERNELAPI, move some types, fix PRTL_ALLOCATE_STRING_ROUTINE, PRTL_REALLOCATE_STRING_ROUTINE, PRTL_FREE_STRING_ROUTINE, define CTL_CODE, DEVICE_TYPE_FROM_CTL_CODE, FILE_ANY_ACCESS, FILE_SPECIAL_ACCESS, FILE_READ_ACCESS, FILE_WRITE_ACCESS identical to wdm.h, remove duplicate RtlGenerate8dot3Name, remove ZwOpenEvent
[NTPOAPI] Guard some types with #ifndef _PO_DDK_
[WDM] Create reactos compatible definition of NTKERNELAPI, add KDPC_WATCHDOG_INFORMATION, BATTERY_REPORTING_SCALE, fix ALIGN_UP_POINTER_BY, guard some types with #ifndef _PO_DDK_, update POWER_INFORMATION_LEVEL, make some FILE_DEVICE_ definitions identical to ntifs.h, fix HalAllocateCommonBuffer

svn path=/branches/header-work/; revision=46050
2010-03-10 04:16:52 +00:00
Sir Richard fc4574d166 [NTOS]: No good deed goes unpunished. Continuing the novel/saga from a couple of days ago, it seems that now that impersonation works, various code paths are being tickled into existence. For example, it would seem parts of the system now attempt setting primary tokens. This would cause an assertion, since PspAssignPrimaryToken incorrectly dereferenced the token (leading to a double-dereference) due to an off-by-! mistake.
svn path=/trunk/; revision=46049
2010-03-10 04:12:25 +00:00
Sir Richard 90fa1d0343 [CSRSS]: Differentiate between first-try and second-try shutdown. In the first try, the console server should defer to the user/win32k server to attempt shutdown for a non-console app. However, if we end up with a second try because this did not happen, then the console server takes matters in its own hands and calls the CTRL-C handler (with some exceptions, such as system/service apps, or apps not belonging to the LUID).
svn path=/trunk/; revision=46048
2010-03-10 03:35:18 +00:00
Sir Richard cbe3e09f61 [KERNEL32]: As indicated by the comment, kernel32 should always connect to the console server, even for non-console apps (the latter will just basically ignore the request). This is needed to (at minimum) setup the Ctrl-C handler, as otherwise, only "true console" apps will have a handler, even though internally, all apps have such a handler. This is what CSRSS needs to call internally for shutting down non-GUI apps, for example. (The default CTRL-C handler will just call ExitProcess).
svn path=/trunk/; revision=46047
2010-03-10 03:32:17 +00:00
Timo Kreuzer e6baa6f072 merge r46045
svn path=/trunk/; revision=46046
2010-03-10 00:56:07 +00:00
Timo Kreuzer ce0d1d6fe7 [ASM]
Don't check for _MSC_VER to decide if the assembly source is going to be compiled with ML or AS, instead check for _USE_ML
Fixes compiling .S files with AS, when using MSVC

svn path=/branches/header-work/; revision=46045
2010-03-10 00:31:06 +00:00
Hervé Poussineau 4c956b83a7 Link SCSI miniport drivers only to scsiport
svn path=/trunk/; revision=46044
2010-03-09 22:36:52 +00:00
James Tabor 2d2f8b9404 - [User32] sync spy to wine 1.1.40
svn path=/trunk/; revision=46043
2010-03-09 21:14:52 +00:00
Sir Richard 4f05a88e82 [KERNEL32/CSRSS]: Register new Win32 threads with CSRSS. Add a bunch of lookup, creation, allocation, hashing and CSR thread management routines from the unused CSRSRV in trunk.
[CSRSS]: Bang in the new thread support in a bunch of places, including creating static server threads. It's very hacked and handle duplication doesn't work 100% reliably, but it gets the job done.
[CSRSS]: Add CsrGetProcessLuid, CsrImpersonateClient, CsrRevertToSelf, CsrShutdownProcesses, CsrFindProcessForShutdown required for user-mode shutdown. Right now we are able to reliably enumerate user apps (in the user LUID) and then service/system apps (in the LOCAL SYSTEM LUID).

svn path=/trunk/; revision=46042
2010-03-09 20:23:22 +00:00
Sir Richard e2d31e88e4 [KERNEL32]: Bug fix CTRL-C handler registration/deregistration/notification, needed for correct console shutdown behavior.
svn path=/trunk/; revision=46041
2010-03-09 20:13:19 +00:00
Sir Richard 9c91a4dc46 [CSRSS]: Fix yet another bug in the unused csrss code.
svn path=/trunk/; revision=46040
2010-03-09 18:22:25 +00:00
Amine Khaldi c7dddd299d [NTIFS]
- Group related definitions
- Add missing *_INCREMENT, SYSTEM_PAGE_PRIORITY_BITS, SYSTEM_PAGE_PRIORITY_LEVELS and INVALID_PROCESSOR_INDEX definitions
- KAPC_STATE : ApcListHead[2] -> ApcListHead[MaximumMode]
- KQUEUE : make CurrentCount volatile
- Add several missing Ke* functions declarations

svn path=/branches/header-work/; revision=46039
2010-03-09 18:03:40 +00:00
Sylvain Petreolle f316f00072 Convert battery.inf to UTF-16
Add French translation.
Add battery.inf and fdc.inf to syssetup process.

Floppy disk controllers and batteries now appear correctly in device manager.
Dedicated to aicom ;)

svn path=/trunk/; revision=46038
2010-03-09 17:21:29 +00:00
Amine Khaldi f731de8f45 [NTIFS]
- Group related definitions
- Add REPARSE_*, FILE_PIPE_CLIENT_PROCESS_BUFFER_EX, VIRTUAL_STORAGE_TYPE, STORAGE_QUERY_DEPENDENT_VOLUME_* and PUBLIC_OBJECT_* structures
- Add LINK_TRACKING_INFORMATION_TYPE, LINK_TRACKING_INFORMATION and REMOTE_LINK_TRACKING_INFORMATION enums
- Update OBJECT_INFORMATION_CLASS and FILE_PIPE_CLIENT_PROCESS_BUFFER definitions
- Add REPARSE_GUID_DATA_BUFFER_HEADER_SIZE, IsReparseTag*, FSCTL_LMR_* and FSCTL_PIPE_* macros
- Add missing MAXIMUM_REPARSE_DATA_BUFFER_SIZE, IO_REPARSE_TAG_*, FILE_PIPE_COMPUTER_NAME_LENGTH and QUERY_DEPENDENT_VOLUME_REQUEST_FLAG_* definitions

svn path=/branches/header-work/; revision=46037
2010-03-09 17:12:58 +00:00
Amine Khaldi bbd3c8b4e0 [NTIFS]
- More work on FS related structures and definitions

svn path=/branches/header-work/; revision=46036
2010-03-09 16:31:24 +00:00
Amine Khaldi 11dd9b69ab [NTIFS]
- Add several missing FS related enums, structures and definitions

svn path=/branches/header-work/; revision=46035
2010-03-09 16:02:52 +00:00
Amine Khaldi 62a30e7a24 [NTIFS]
- Group related definitions
- Add CSV_NAMESPACE_INFO, FSCTL_QUERY_FAT_BPB_BUFFER and several missing FS related structures and definitions
- Add a bunch of FSCTL_* macros

svn path=/branches/header-work/; revision=46034
2010-03-09 15:06:29 +00:00
Amine Khaldi eef0d5c8c9 [NTIFS]
- Group related definitions
- Add several missing Nt* function declarations
- Add REMOTE_PROTOCOL_FLAG_LOOPBACK, REMOTE_PROTOCOL_FLAG_OFFLINEseveral and several FILE_* definitions
- Add missing FILE_* structures

svn path=/branches/header-work/; revision=46033
2010-03-09 13:53:15 +00:00
Amine Khaldi 626fe6be42 - Add a couple of Lsa* function declarations
- Add missing MSV1_0* related definitions, enums, structs and macros

svn path=/branches/header-work/; revision=46030
2010-03-09 13:11:21 +00:00
Sir Richard 6b007be4cd [NTOS]: While attempting to ressucitate the user-mode shutdown code in CSRSS (disabled since 2006), it seemed clear that one of the main steps is to obtain the caller's LUID in order to kill the right processes. This LUID is obtained from the current thread's token, and we know it's the callers since we're supposed to impersonate the caller. Unfortunately, impersonation failed, making the whole process fail.
Impersonation failed because NtImpersonateThread was actually inverting the THREAD_IMPERSONATE rights, asking the client thread for the server's permissions, and vice versa. Fixing this resulted in yet another failure.
        Analysis of this failure showed that even opening the server (ie: current) thread for THREAD_DIRECT_IMPERSONATION failed, which is unusual since the current thread should have access to all its rights. This is determined in PspCreateThread when the ETHREAD->GrantedAccess field is set.
        Continuing onto this path, tracing revealed that GrantedAccess was merely 0x1607F and not 0x1F3FF as expected, meaning that not all rights were given, including the impersonate right (0x200), explaining the failure, but not the deeper reason behind it.
        Attempting to identify which code path set this GrantedAccess, the SepAccessCheck routine came to light. A bug there caused MAXIMUM_ALLOWED accesses to fail in certain scenarios, such as when the object had no security descriptor, because MAXIMUM_ALLOWED would be granted as an absolute value, when instead of it is a flag that should grant GENERIC_ALL. Fixing that bug, the failure continued.
        Further analysis identified that the Administrators SID was being found with GENERIC_READ + WRITE + EXECUTE access, and no SID was found for GENERIC_ALL access. This happened when searching the system token's default DACL, which is assigned to the kernel (but for kernel-mode callers, this check was skipped), smss, winlogon, etc.
        The code for creating this system token was heavily hacked, so the function to create the system token, as well as NtCreateToken were refactored to use a common piece of token-creating code. Furthermode, the system token was correctly created with Local System as the user, and Administrators as one of the groups. Finally, SeDefaultDacl was used (already setup properly) instead of a badly configured Default DACL. The new shared code also correctly sets the SE_GROUP_ENABLED flag on all SE_GROUP_MANDATORY groups, and scans tokens to set the TOKEN_HAS_ADMIN_GROUP and TOKEN_HAS_TRAVERSE_PRIVILEGE flags which were not previously set.
        With the correct system token and default DACL, the Local System SID was now found, but the failure continued. This was revealed to be due to an even deeper rooted problem, as the SepIsSidInToken routine checked for SE_GROUP_ENABLED before listing a SID as "present". Although this is correct for actual groups, the User SID will never have the SE_GROUP_ENABLED flag as it is not a group. This caused any granted access ACE belonging to a user (instead of a group) to be ignored, causing either access check failures, or limited rights returned (in the MAXIMUM_ALLOWED case).
        Upon fixing this bug, the NtImpersonateThread call finally returned success, since the rights were now correct. Promptly upon calling NtOpenThreadToken to query the LUID however, the system ASSERTED with FALSE.
        The code at fault was a line in NtOpenThreadTokenEx which forcefully ASSERTed if the impersonation code path was taken, presumably because this was never tested, and ReactOS would actually always fail impersonation attempts due to the bugs fixed above. This routine was thus quickly reworked to fix some mistakes (such as forgetting to actually impersonate the client, incorrect referencing/dereferencing of thread/tokens, and assumptions about DACL creation success).
        Having fixed the NtOpenThreadTokenEx routine, the LUID query now went through for the impersonated token, but soon causing a user-mode crash, due to an incorrect parameter reference in the CsrGetProcessLuid function in the csrsrv code by Alex (which I copy/pasted to reduce code duplication).
        Fixing this final bug finally allowed the correct LUID to be queried and I was able to continue development of not-yet-commited user-mode shutdown code.

svn path=/trunk/; revision=46028
2010-03-09 10:35:58 +00:00
Sir Richard b36899aa50 [WIN32K]: Stub-plement NtUserSetInformationThread for UserInitiateShutdown and UserEndShutdown. I think we're supposed to notify Winlogon at some point, and check for races. Part of new shutdown code.
svn path=/trunk/; revision=46027
2010-03-09 09:26:46 +00:00
James Tabor d5c439798c - [User32_winetest] Restore Timer test.
svn path=/trunk/; revision=46026
2010-03-09 03:48:43 +00:00
James Tabor c03ec91188 - [User32] Fix timer crash when calling proc.
svn path=/trunk/; revision=46025
2010-03-09 03:48:05 +00:00
Timo Kreuzer 5277616bbf merge r46023
svn path=/branches/header-work/; revision=46024
2010-03-09 03:00:48 +00:00
Sir Richard 7a43a3001f [SETUPLDR]: Fix build breakage caused by hpoussin, by linking minihal into setupldr as well.
svn path=/trunk/; revision=46023
2010-03-09 02:29:25 +00:00
Timo Kreuzer a93c72eafc revert part of 46020, adding back po types
svn path=/branches/header-work/; revision=46022
2010-03-09 00:45:15 +00:00
Amine Khaldi a00acb2a1b Sync with trunk head
svn path=/branches/header-work/; revision=46021
2010-03-09 00:19:55 +00:00
Timo Kreuzer 68ea0b876e - Move some definitions from wdm.h to ntpoapi.h
- Add ALIGN_DOWN_BY, ALIGN_UP_BY, ALIGN_DOWN_POINTER_BY, ALIGN_UP_POINTER_BY
- fix pshpack1.h inclusion
- PCHAR -> PSTR in RtlAssert

svn path=/branches/header-work/; revision=46020
2010-03-09 00:17:56 +00:00
Amine Khaldi eb68457183 [NTIFS]
- Group related definitions
- Add NtSetInformationThread function declaration
- Add SE_ADT_PARAMETER_TYPE enum
- Add SE_ADT_OBJECT_TYPE, SE_ADT_PARAMETER_ARRAY_ENTRY, SE_ADT_ACCESS_REASON and SE_ADT_PARAMETER_ARRAY structures
- Add SE_MAX_AUDIT_PARAMETERS, SE_MAX_GENERIC_AUDIT_PARAMETERS, SE_ADT_PARAMETERS_* and SE_ADT_PARAMETER_* definitions
- Add LSAP_SE_ADT_PARAMETER_ARRAY_TRUE_SIZE macro

svn path=/branches/header-work/; revision=46019
2010-03-08 23:02:39 +00:00
Amine Khaldi 79a0a4193d [NTIFS]
- Group related definitions
- Add several Rtl* function declarations
- Add RTL_SYSTEM_VOLUME_INFORMATION_FOLDER, DEVICE_TYPE, FILE_DEVICE_*, METHOD_* and FILE_*_ACCESS definitions
- Add CTL_CODE, DEVICE_TYPE_FROM_CTL_CODE and METHOD_FROM_CTL_CODE macros

svn path=/branches/header-work/; revision=46018
2010-03-08 22:30:14 +00:00
Hervé Poussineau 61fef12a72 [freeldr] Load an additional SCSI driver if present (NTBOOTSYS.SYS on boot partition), to increase number of known storage devices.
Works only with very simple miniport drivers.

svn path=/trunk/; revision=46017
2010-03-08 22:04:38 +00:00
Hervé Poussineau e10fbe352c [headers] Fix type of PRTL_HEAP_PARAMETERS in ifssupp.h. Will be required soon
svn path=/trunk/; revision=46016
2010-03-08 21:42:18 +00:00
Hervé Poussineau 37d9cf31a4 Fix include directories
svn path=/trunk/; revision=46015
2010-03-08 21:40:29 +00:00
Amine Khaldi 302f7374fa [NTIFS]
- Group related definitions
- Add several Rtl* function declarations (See diff for details)
- Add MAX_UNICODE_STACK_BUFFER_LENGTH definition
- RtlConvertSidToUnicodeString : DestinationString -> UnicodeString

svn path=/branches/header-work/; revision=46014
2010-03-08 21:38:43 +00:00
James Tabor d89923519b [User32]
- David Hedberg Fix return value for EDIT_EM_Scroll and case where EM_SCROLL with page down results in trying to scroll up past the beginning. Sync to wine 1.1.40.

svn path=/trunk/; revision=46013
2010-03-08 21:24:47 +00:00
James Tabor 8b48dd5b7c - [User32_winetest]
- Msg : Remove more tests from service. test_timers crashed on a callback which passed months ago. The rest are related to TrackMouseEvent and capture.

svn path=/trunk/; revision=46012
2010-03-08 21:20:18 +00:00
Cameron Gutman be17352b40 [CMBATT]
- Add initial cmbatt driver which mostly stubs
 - All it does right now is register a battery device with the battc driver
[BATTC]
 - Add a nearly complete battc driver (the only stuff missing is WMI)
 - Tested with our stubbed cmbatt driver but testing on Windows would be nice too
[BATTERY.INF]
 - Added battery.inf to install battery devices
[MISC]
 - Add cmbatt.sys, battc.sys, and battery.inf to bootcd
 - We still need to implement compbatt.sys
 - PS: Janderwald, you stole my commit number ;)

svn path=/trunk/; revision=46011
2010-03-08 21:09:25 +00:00
Daniel Reimer f780908ae4 Polish translation update by Maciej Bialas.
svn path=/trunk/; revision=46010
2010-03-08 21:08:20 +00:00
James Tabor 6e96e3015c - Fix a crash in user32 winetest msg.
svn path=/trunk/; revision=46009
2010-03-08 21:04:00 +00:00
Timo Kreuzer dfe13ea582 Add some types and contants to ntpoapi.h
svn path=/branches/header-work/; revision=46008
2010-03-08 21:00:56 +00:00
James Tabor f8fced000d [User32]
- Andrew Nguyen : Ensure That WM_INITDIALOG passes the first tabstop control handle to the dialog procedure.
- Henri Verbeet : Also show dialogs right after a WM_TIMER message.

svn path=/trunk/; revision=46007
2010-03-08 20:57:24 +00:00
James Tabor 63f9072074 - [User32_winetest]
- Win : Remove test_capture from service. This is related to TrackMouseEvent issues which use SetCapture.

svn path=/trunk/; revision=46006
2010-03-08 20:52:04 +00:00
Aleksey Bragin f5a35ee9b2 [PSDK]
- Update all IDLs to Wine-1.1.40. If you feel some of your change was lost, it wasn't needed for building. Please recommit if you still think it's of a high value.

svn path=/trunk/; revision=46005
2010-03-08 20:51:33 +00:00
Sir Richard 8a4845b409 [NTOS]: Have I/O Manager Volume Device Objects register with the Power Manager so that they can receive dope.
[NTOS]: Reimplement NtShutdownSystem.
[NTOS]: Implement NtSetSystemPowerState for the shutdown/reboot cases.
[NTOS]: Use the dope from the volume device objects to flush all writeable (non-floppy) devices. Pending hard-disk changes are now flushed to disks before shutdown.
[NTOS]: Flush \\REGISTRY during shutdown. This flushes all pending changes.
[NTOS]: Call into Cc to flush lazy writer during shutdown.
[NTOS]: Stop killing processes on shutdown. The kernel should not be doing this.
[NTOS]: Don't only shutdown disk file systems, but also cdrom and tape.
[NTOS]: Don't only notify drivers of first-chance shutdown -- also parse the last-change shutdown list.
[NTOS]: Reference drivers registering for shutdown notifications so that they remain loaded for them to get the notification at shutdown.
[NTOS]: Notify drivers that have registered/opened the Power State callback.
[NTOS]: A lot of the Po* power state code is highly simplified, but provides a good roadmap to anyone interested in this functionality long-term.

svn path=/trunk/; revision=46004
2010-03-08 20:47:10 +00:00
Sir Richard c14fc3dc56 [CMLIB]: Just use UNIMPLEMENTED.
svn path=/trunk/; revision=46003
2010-03-08 20:46:53 +00:00
Eric Kohl 02f2e242ff SEH-Protect the call to RSetServiceStatus in SetServiceStatus. This keeps services from crashing when the connection to the service manager fails.
svn path=/trunk/; revision=46002
2010-03-08 20:42:48 +00:00
Sir Richard a15d2634ea [NTOS]: Implement CmSetLazyFlushState to disable lazy writing in the Cm.
[NTOS]: Implement ExSwapInWorkerThreads to in-swap any worker threads when needed.
[NTOS]: Add HAL stubs for HalEndOfBoot and HalSetWakeEnable since most HALs set this to NULL.
[DDK]: Add some missing definitions.

svn path=/trunk/; revision=46001
2010-03-08 20:37:24 +00:00
Johannes Anderwald 95a13b7f8f - Silent traces
svn path=/trunk/; revision=46000
2010-03-08 20:30:51 +00:00