Stanislav Motylkov
f234cb6e59
[NTOS:CM] Do not create ProcessorNameString value if there is no Brand String
...
If the CPU does support CPUID instruction but does not have the Brand String,
the legacy name detection should be performed either in CIM_Processor (WMI),
in the Processor device driver, or in the application itself.
The deleted Intel CPU name detection code can go to the WMI at some point.
In fact Windows XP and 2003 kernels do not have any strings of that kind.
This effectively reverts the hack committed 6 years ago in 7a985425
(r63798)
that was intended to workaround CORE-7952.
CORE-17413
2020-12-30 19:38:41 +03:00
Victor Perevertkin
8ee88d3bd5
[NTOS:PNP] Send removal IRPs to a file system device object for mounted devices
...
If a DeviceObject has VPB attached, it should be treated in a special way
CORE-16106
2020-12-27 18:40:33 +03:00
Hermès Bélusca-Maïto
a748350fc9
[NTOS:IO] Fail if the driver name passed to NtLoadDriver() is an empty string.
...
Otherwise an assertion on the driver name is hit later on.
Can be reproduced by calling NtLoadDriver with a valid UNICODE_STRING
of Length == 0.
2020-12-27 00:52:00 +01:00
Hermès Bélusca-Maïto
44511f0809
[NTOS:IO] Minor formatting only.
...
Making IopLoadUnloadDriver() looking similar to IopUnloadDriver().
2020-12-27 00:51:59 +01:00
Jérôme Gardou
bd0445dbf2
[NTOS/FSRTL] Implement FsRtlAcquireToCreateMappedSection using filter callbacks
2020-12-22 11:37:53 +01:00
Jérôme Gardou
ef4c7ae978
[NTOS:IO] Validate input parameters in NtQueryDirectoryFile
...
It turns out this is not the job of the FS driver
2020-12-22 11:06:38 +01:00
Jérôme Gardou
1d1dba51db
[NTOS:IO] Do not set Shared property of the file if we are failing in IoCheckShareAccess
2020-12-22 11:05:00 +01:00
Jérôme Gardou
a6c0af2e21
[NTOS:IO] Do not pass bogus file offset to the FS in NtReadFile & NtWriteFile
2020-12-22 11:02:33 +01:00
Jérôme Gardou
96ae15ac4b
[NTOS:MM] Fix more 64 bit arithmetics
2020-12-15 10:08:25 +01:00
Jérôme Gardou
abcbd44641
[NTOS:MM] Fix passing section size to MiCreatePagingFileMap & fix maximum size check
...
Also return the right status instead of stupidly asserting when failing to allocate memory.
2020-12-14 18:22:18 +01:00
Jérôme Gardou
8631e75837
[NTOS:CC] Acquire the master lock after freeing the VACB in CcRosFlushDirtyPages
...
Fixes a random ASSERT
2020-12-09 18:06:42 +01:00
Jérôme Gardou
3d4cf8d2d8
[NTOS/FSRTL] Fix MCB tests
...
- Fix behaviour when adding or removing entries in the middle of an existing run
- Do not touch output parameters when failing, caller might rely on this.
2020-12-08 11:48:00 +01:00
Victor Perevertkin
016dc28793
[NTOS:CONFIG] Release the lock in a failure case in CmLoadKey
...
This is a workaround, the real issue is still not resolved
CORE-17263
2020-12-08 13:44:27 +03:00
Hermès Bélusca-Maïto
3d980c4a2c
[NTOS:FSTUB] Addendum to 29615fee
and 8d2fe541: Further remove useless casts.
...
Also, fix the MBR checksum calculation (missing ~CheckSum + 1), to fix
the calculation in accordance with how MS calculates the MBR checksums
(and what we do as well in
https://github.com/reactos/reactos/blob/master/base/setup/lib/utils/partlist.c#L1581
https://github.com/reactos/reactos/blob/master/boot/freeldr/freeldr/arch/i386/hwdisk.c#L291
).
2020-12-07 22:52:42 +01:00
Hermès Bélusca-Maïto
fd053237cb
[NTOS:FSTUB] Minor formatting; put the PAGED_CODE() macros in evidence (instead of being lost in the declarations).
2020-12-07 22:51:15 +01:00
Victor Perevertkin
29615feeb6
[FSTUB] Fix bugs from 8d2fe54188
...
The buffer is now PUCHAR or PVOID everywhere
2020-12-07 19:50:51 +03:00
Victor Perevertkin
8d2fe54188
[FSTUB] Fix out of bounds access in IoReadDiskSignature
...
- Convert PARTITION_TABLE_OFFSET to the number of bytes instead of
(number of bytes) / 2. This avoids many confusing casts
- Use a cache aligned buffer for MBR
2020-12-07 14:43:34 +03:00
Victor Perevertkin
582ca68696
[NTOS:PNP] Improve and refactor PnP notifications
...
- BUGFIX: do not call IoGetRelatedTargetDevice while guarded mutex is acquired
(the function issues an APC, but they are disabled inside a critical section)
- BUGFIX: only the beginning of a structure for GUID_PNP_CUSTOM_NOTIFICATION was copied and queued.
Just pass it as-is to a subscriber, without copying
- Don't convert event GUID to string, store and compare GUID struct itself
- Split IopNotifyPlugPlayNotification into 3 functions for each type of notification
(less stack usage and for future changes)
- Move initialization code for notifications into a separate routine
- Use separate lists and locks for every type of notification
- Put "TargetDeviceChange" notifications into their place inside DEVICE_NODE
2020-12-05 22:25:40 +03:00
Victor Perevertkin
e3198fb644
[NTOS:PNP] Check if APCs are enabled before waiting inside IopSynchronousCall
2020-12-05 22:25:39 +03:00
Victor Perevertkin
9eafb2971f
[NTOS:CONFIG] Comment out the assertion until fixed
...
CORE-17263
2020-12-05 22:17:08 +03:00
Jérôme Gardou
0db79d4aa9
[NTOSKRNL:FSRTL] Fix memory corruption when pruning tunnel cache
2020-12-04 16:08:14 +01:00
Thomas Faber
828d5fa93e
[NTOS:IO] Reduce stack usage in IopLoadServiceModule. CORE-17215
2020-11-27 12:44:35 +01:00
Thomas Faber
2858ff53ce
[NTOS:KD] Avoid large stack buffer in KdpPrint. CORE-17215
2020-11-27 10:31:45 +01:00
Thomas Faber
ae1d272add
[NTOS:PNP] Avoid recursion in IopTraverseDeviceTree(Node). CORE-17215
2020-11-27 10:31:41 +01:00
Hervé Poussineau
1a3c607f53
[NTOS:KD] Change the way we detect if exception if from KernelMode/UserMode
...
CORE-17381
2020-11-22 18:17:59 +01:00
Hervé Poussineau
44c6df4b27
[NTOS:KD] Correctly define previous mode when entering KDBG (addendum to 0c76bbfe98
)
2020-11-17 14:23:36 +01:00
Jérôme Gardou
9e7071e8fb
[NTOSKRNL] DO not disable optimisations when compiling with CLang
2020-11-16 16:58:10 +01:00
Jérôme Gardou
e00922a0fe
[NTOSKRNL] Link memcmp to the import lib when using CLang
...
CLang performs some optimisations on e.g. strcmp, but memcmp is not exported by ntoskrnl
2020-11-16 16:58:10 +01:00
Hervé Poussineau
d6d5caec7c
[NTOS:KD] Move some KDBG-specific variables to KDBG-specific file
2020-11-16 08:55:04 +01:00
Hervé Poussineau
0c76bbfe98
[NTOS:KD] Merge KdpReportExceptionStateChange() with kd64 version
2020-11-16 08:55:04 +01:00
Hervé Poussineau
baa47fa5e0
[NTOS:KD] Use a PCONTEXT instead of a PKTRAP_FRAME in KDBG
2020-11-16 08:55:03 +01:00
Hervé Poussineau
ba37323a62
[NTOS:KD] Move some declarations where they belong
2020-11-16 08:55:03 +01:00
Hervé Poussineau
67e9cc00b2
[NTOS:KD] Remove useless define
...
KdbEnterDebuggerException() is only called when KDBG is defined.
2020-11-16 08:55:03 +01:00
Hervé Poussineau
95faf65ebf
[NTOS:KD] Remove useless variables/members
...
Those where only set and never read.
2020-11-16 08:55:03 +01:00
Hervé Poussineau
8d3a395101
[NTOS:KD] Remove Bochs port debugging
...
You can use serial port debugging instead.
2020-11-16 08:55:03 +01:00
Hervé Poussineau
8a62f277d8
[NTOS:KD] Remove useless implementation of BREAKPOINT_PRINT in KdSystemDebugControl
...
This is (as expected) handled in KdpTrap(), which also calls KdpPrint().
2020-11-16 08:55:03 +01:00
Hervé Poussineau
1eda7d7e99
[NTOS:KD] Merge KdpReportCommandStringStateChange() with kd64 version
2020-11-16 08:55:03 +01:00
Hervé Poussineau
6f7835d30c
[NTOS:KD] Merge KdpReportLoadSymbolsStateChange() with kd64 version
2020-11-16 08:55:03 +01:00
Hervé Poussineau
e31be4ec25
[NTOS:KD] Merge KdEnableDebuggerWithLock()/KdDisableDebuggerWithLock() with kd64 version
2020-11-16 08:55:03 +01:00
Hervé Poussineau
ebb6f29e69
[NTOS:KD] Merge KdEnterDebugger()/KdExitDebugger() with kd64 version
2020-11-16 08:55:03 +01:00
Hervé Poussineau
81b184741d
[NTOS:KD] Remove useless uses of _WINKD_
2020-11-16 08:55:03 +01:00
Hervé Poussineau
329b9fa2fb
[NTOS:KD] Merge KdpReport() with kd64 version
2020-11-16 08:55:03 +01:00
Hervé Poussineau
a8662c73a5
[NTOS:KD] Merge KdpTrap() with kd64 version
2020-11-16 08:55:03 +01:00
Hervé Poussineau
5730394bd0
[NTOS:KD] Merge KdpPrintString()/KdpPromptString() with kd64 version
2020-11-16 08:55:03 +01:00
Hervé Poussineau
d5fe15e5e6
[NTOS:KD] Merge KdpStub with kd64 version
2020-11-16 08:55:03 +01:00
Hervé Poussineau
c2946ced92
[NTOS:KD] Remove some now useless tests on _WINKD_
2020-11-16 08:55:03 +01:00
Hervé Poussineau
660948ce6f
[NTOS:KD] Merge some more functions with kd64
...
Functions are KdIsThisAKdTrap, KdUpdateDataBlock, KdEnterDebugger,
KdExitDebugger, KdRefreshDebuggerNotPresent, KdDisableDebugger,
KdEnableDebuggerWithLock, KdEnableDebugger, KdSystemDebugControl
2020-11-16 08:55:03 +01:00
Hervé Poussineau
d0e2fada23
[NTOS:KD] Rename KdpEnterDebuggerException to KdpTrap + add KdpStub forwarder
...
This removes somes uses of _WINKD_ macro.
2020-11-16 08:55:02 +01:00
Hervé Poussineau
4d84c856ad
[NTOS:KD] Merge KdInitDebugger with kd64 version + move variable declarations to kd64/kddata.c
...
Remove now unused file kd/kdinit.c
2020-11-16 08:55:02 +01:00
Hervé Poussineau
777a2d94da
[NTOS:KD] Import KdpCallInitRoutine() into KdDebuggerInitialize1()
2020-11-16 08:55:02 +01:00
Hervé Poussineau
9b43a3a067
[NTOS:KD] Move implementation of banner display from each debug output type to common code
2020-11-16 08:55:02 +01:00
Hervé Poussineau
6025df33a5
[NTOS:KD] Make implementation of KdInitSystem more similar with the kd64 one
...
Move some kd initializations into KdDebuggerInitialize0() function.
2020-11-16 08:55:02 +01:00
Hervé Poussineau
f417a53743
[NTOS:KD] Compile all kd64 files in kdbg mode
2020-11-16 08:55:02 +01:00
Hervé Poussineau
e09554a06c
[NTOS:KD] Merge KdPowerTransition/KdChangeOption with kd64 version
2020-11-16 08:55:02 +01:00
Hervé Poussineau
453edbb5da
[NTOS:KD] Implement empty versions of KdDebuggerInitialize0/KdSendPacket/KdReceivePacket
...
Move KdDebuggerInitialize1 to common code.
Add #defines to local names to prevent clashes with kdcom.dll
2020-11-16 08:55:02 +01:00
Hervé Poussineau
b18529de28
[NTOS:KD] Merge KdPollBreakIn() with kd64 version
2020-11-16 08:55:02 +01:00
Hervé Poussineau
1bee6bb8f3
[NTOS:KD] Remove invalid configuration (not _WINKD_ on amd64)
...
This was not working, as the file ntoskrnl/kd/amd64/kd.c was non-existent.
2020-11-16 08:55:02 +01:00
Hervé Poussineau
458f4edfd5
[NTOS:KD] Remove 'support' for Pice. It was only setting a flag.
2020-11-16 08:55:02 +01:00
Hervé Poussineau
0e391eecd1
[NTOS:KD] Remove GDB stubs
...
drivers/base/kdgdb/ should be used instead.
2020-11-16 08:55:02 +01:00
Hervé Poussineau
083cf05f7b
[NTOS:KDBG] Remove useless file
2020-11-16 08:55:02 +01:00
Hervé Poussineau
129e009a2c
[NTOS:IO] Do not translate resources of type CmResourceTypeDevicePrivate
...
CmResourceTypeDevicePrivate resources are created the the bus driver, for its own later use,
when children devices will receive the IRP_MN_START_DEVICE.
Do not translate them, as they have no meaning outside bus driver.
2020-11-15 18:38:37 +01:00
Thomas Faber
507c442473
[NTOS:CM] Implement support for KeyValuePartialInformationAlign64. CORE-17358
2020-11-14 15:11:00 +01:00
Serge Gautherie
b910409a4a
[NTOS:KDBG] Add some missing OBJ_KERNEL_HANDLE
...
CORE-10207
2020-11-14 12:00:24 +01:00
Victor Perevertkin
d6ef8f97e9
[NTOS:PNP] Enumerate the device tree after loading boot drivers and HAL
2020-11-10 01:59:49 +03:00
Timo Kreuzer
e67b62251f
[NTOS:MM] Handle PXE/PPE gaps in MiDeleteVirtualAddresses
2020-11-07 20:16:41 +01:00
Timo Kreuzer
274bc4de1c
[NTOS:SE] Fix handling of relative security descriptors in SeQuerySecurityDescriptorInfo
2020-11-07 15:54:47 +01:00
Hermès Bélusca-Maïto
ce55fef1e5
[NTOS:EX] Move the C_ASSERT UUID_CACHED_VALUES_STRUCT.GuidInit to a better place, where the structure is defined.
2020-11-06 01:06:12 +01:00
Hermès Bélusca-Maïto
3c722e35b1
[CMD][SERVMAN][SHELL32][WINSPOOL][ROSAPPS][NTOS:PNP] Fix my build.
2020-11-06 01:06:11 +01:00
Victor Perevertkin
5c7ce4475e
[REACTOS] Cleanup INIT and some PAGE section allocations
...
- Change INIT_FUNCTION and INIT_SECTION to CODE_SEG("INIT") and DATA_SEG("INIT") respectively
- Remove INIT_FUNCTION from function prototypes
- Remove alloc_text pragma calls as they are not needed anymore
2020-11-02 21:45:31 +03:00
Victor Perevertkin
658f742c2d
[NDK][CMAKE] Introduce DATA_SEG and CODE_SEG macro
...
These are for putting code and data to non-default sections
At the same time, move INIT section attributes declaration to cmake files
2020-11-02 21:27:06 +03:00
Timo Kreuzer
17fa04f10b
[NTOS:MM:X64] Fix MM_WAIT_ENTRY on x64
2020-11-01 09:32:27 +01:00
Timo Kreuzer
d4b4cf7448
[NTOS:MM] Make sure PXEs/PPEs and PDEs are always MM_EXECUTE_READWRITE
...
This is required since the NX protection proagates from the highest level, enforcing NX on the entire range, independent of whether lower level P*Es have the bit set or not. It might be useful to add a platform specific constant to allow making page tables NX on architectures that have a different behavior.
2020-11-01 09:32:27 +01:00
Timo Kreuzer
d55811f160
[NTOS:MM:X64] Fix session space initialization on x64
2020-11-01 09:32:27 +01:00
Timo Kreuzer
9095dbf5a5
[NTOS:MM:X64] Implement MmCreatePageFileMapping and MmDeletePageFileMapping
2020-11-01 09:32:27 +01:00
Timo Kreuzer
8980850d56
[NTOS:MM:X64] Simplify and fix x64 mapping code
...
- Use demand-zero-ptes in MiGetPteForProcess
- Handle NoExecute in MiSetPteProtection
- Fix MmIsPageSwapEntry
- Fix MmGetPageFileMapping
- remove obsolete functions.
2020-11-01 09:32:27 +01:00
Timo Kreuzer
0726cfce10
[NTOS:MM:X64] Handle PPEs and PXEs as well in MmInitializeProcessAddressSpace()
...
But don't set up the PFNs for the initial process on x64, as these have already been set up.
2020-11-01 09:32:27 +01:00
Timo Kreuzer
48d1bd2c88
[NTOS:MM:X64] On x64 allocate a VAD for the shared user page
2020-11-01 09:32:27 +01:00
Timo Kreuzer
a5d47ff72b
[NTOS:MM:X64] On x64 reserve the address range between FFFF800000000000 and FFFFF68000000000 in MiInitSystemMemoryAreas()
2020-11-01 09:32:27 +01:00
Timo Kreuzer
a8ba58fbb0
[NTOS:MM:X64] Improve x64 Mm initialization
...
* Move MiBuildPfnDatabaseFromPageTables into MiBuildPfnDatabase
* Make sure to call MmInitializeProcessAddressSpace() from the x64 version of MiInitMachineDependent()
* Handle result of MmInitializeProcessAddressSpace in MiInitMachineDependent (Should do the same for x86)
* Remove obsolete x64 debug print
2020-11-01 09:32:27 +01:00
Serge Gautherie
81be201d98
[NTOS:CC] CcMdl*Complete(): Return if FastIO succeeded ( #3303 )
...
CORE-17342
2020-10-31 15:18:02 +01:00
Timo Kreuzer
bdd4d5d8d8
[NTOS:KE:X64] Set the exception frame as well in KiInitializeContextThread
2020-10-31 14:23:16 +01:00
Timo Kreuzer
f66a7e2e48
[NTOS:KE:X64] Zero out the context in KiDispatchException
2020-10-31 14:23:16 +01:00
Timo Kreuzer
637183a12c
[NTOS:KE:X64] Handle pending user APC on syscall exit (should be done on trap exit, too)
2020-10-31 14:23:16 +01:00
Timo Kreuzer
2a8c680dbe
[NTOS:KE:X64][NTDLL:X64] Implement KiUserExceptionDispatcher and fix KiDispatchExceptionToUser
2020-10-31 14:23:16 +01:00
Timo Kreuzer
1bfacf06f7
[NTOS:KE:X64] Zero out volatiles when returning from a system call
2020-10-31 14:23:16 +01:00
Timo Kreuzer
a016ccd117
[NTOS:KE:X64][ASM:X64] Fix delivery of APCs
...
- Deliver pending APCs on trap exit
- Pass the trapframe of KiApcInterrupt to KiDeliverApcs, not NULL.
- Fix parameter passing from KiSwapContext to KiSwapContextInternal and KiSwapContextResume, so that the ApcBypass parameter is not uninitialized
- Fix return value of KiSwapContextResume to correctly indicate whether we want to have APCs directly delivered or not (when there are non, or when delivery is suppressed)
2020-10-31 14:23:16 +01:00
Timo Kreuzer
fdc1261fb7
[NTOS:KE:X64][NTDLL:X64] Implement x64 version of user callback code
2020-10-31 14:23:16 +01:00
Timo Kreuzer
52d1bb5ec9
[NTOS:KE:X64] Simplify KiInitializeUserApc
2020-10-31 14:23:16 +01:00
Timo Kreuzer
aaa86d078e
[NTOS:KE:X64] Move KiInitializeUserApc to usercall.c
2020-10-31 14:23:16 +01:00
Timo Kreuzer
fbdff437fd
[NTOS:KE:X64] Implement flushing the GDI batch
2020-10-31 14:23:16 +01:00
Timo Kreuzer
c86c55ace7
[NTOS:KE:X64] Change the logic of KeSwitchKernelStack and friends to be standards conforming
...
The previous version (like the x86 one) used a combination of C and asm code, called from C code to switch the stack. This is problematic, since there is no guarantee what assumptions C code makes about the stack (i.e. it can place any kind of stack pointers into registers or on the stack itself.) The new algorithm returns back to the systemcall entry point in asm, which then calls KiConvertToGuiThread, which is also asm and calls KeSwitchKernelStack ...
2020-10-31 14:23:16 +01:00
Timo Kreuzer
18b1aafd82
[NTOS:KE:X64] Improve kernel stack switching on GUI system calls
...
To be 100% correct and not rely on assumptions, stack switching can only be done when all previous code - starting with the syscall entry point - is pure asm code, since we can't rely on the C compiler to not use stack addresses in a way that is not transparent. Therefore the new code uses the same mechanism as for normal system calls, returning the address of the asm function KiConvertToGuiThread, which is then called like an Nt* function would be called normally. KiConvertToGuiThread then allocated a new stack, switches to it (which is now fine, since all the code is asm), frees the old stack, calls PsConvertToGuiThread (which now will not try to allocate another stack, since we already have one) and then jumps into the middle of KiSystemCallEntry64, where the system call is handled again.
Also simplify KiSystemCallEntry64 a bit by copying the first parameters into the trap frame, avoiding to allocate additional stack space for the call to KiSystemCallHandler, which now overlaps with the space that is allocated for the Nt* function.
Finally fix the locations where r10 and r11 are stored, which is TrapFrame->Rcx and TrapFrame->EFlags, based on the situation in user mode.
2020-10-31 14:23:16 +01:00
Timo Kreuzer
a6732905b8
[NTOS:KE:X64] Implement KiConvertToGuiThread, KeSwitchKernelStack and support for win32k syscalls in KiSystemCallHandler
2020-10-31 14:23:16 +01:00
Timo Kreuzer
fe6752f852
[NTOS:KE:X64] Fix bugs in KeContextToTrapFrame and KeTrapFrameToContext
...
Set valid EFlags, the non-volatiles need to be taken from the exception frame, because the ones from the trap frame might not be set.
2020-10-31 14:23:16 +01:00
Timo Kreuzer
a662c6f180
[NTOS:KE:X64] Silence KiRundownThread, it has nothing to do
2020-10-31 14:23:16 +01:00
Timo Kreuzer
eda01e5be7
[NTOS:KE:X64] Fix KiWriteSystemTime
2020-10-31 14:23:16 +01:00
Timo Kreuzer
8ec888487a
[ASM:X64] ASSERT that interrupts are enabled, when returning to user mode
2020-10-31 14:23:16 +01:00
Jérôme Gardou
f26754e6dd
[NTOSKRNL] Completely disable optimizations when using GDB
2020-10-21 13:11:20 +02:00
Jérôme Gardou
15dd31377a
Revert "[NTOS/MM] Initialize process Working set and start implementing adding entries to it"
...
This reverts commit 5abc016401
.
Not ready for prime time
2020-10-20 15:56:53 +02:00
Jérôme Gardou
1c528cbf84
Revert "[NTOS/MM]
...
- Fix PFNs tracing
- Add private pages to the process working set"
This reverts commit 4c5351bf55
.
Not ready for prime time
2020-10-20 15:56:21 +02:00