Commit graph

239 commits

Author SHA1 Message Date
Joachim Henze c7d9b470e6 [0.4.9][NTOS:MM] Fix Regression, "Precision" demo executable doesn't load CORE-12400 (#503), + follow-up (#5002)
This fixes the "Farbrausch - Precision" demo
https://files.scene.org/view/parties/2006/assembly06/in64/fr-048_precision_by_farbrausch.zip
from not loading any longer.
It broke by SVN r72989 == git 63bbaff803

The fix is a combined backport of 2 commits:
1.)
0.4.10-dev-136-g c7eb46d9fd (#503)
where Mark Jansen aimed to fix loading executables treated with the binary packer "mPress".
This is what fixed the "Farbrausch - Precision" demo as well.
Marks commit back then referenced CORE-12582 and CORE-14556 although it never was enough to solve any of the 2 tickets entirely.
I do just reference them here again to preserve that ancient (questionable) linkage.

2.)
Since Marks commit back then introduced a very severe regression as well, I do have to port back also the following commit:
0.4.15-dev-5589-g 0d4a8d0ea6 (#5002)
to prevent me to introduce into older releases the bug
CORE-18797 "SizeOfRawData of BSS section should not be processed"
(which had many duplicates, e.g. Doom95, compiled with Watcom-C-compilers would not longer work without that)

-------------

I felt the need to underline that I have tested that porting back the following commit
0.4.10-dev-474-g dfff8ed0d8
is *NOT* needed in the older branches to prevent
CORE14838 "Antivir 6 deadlocks RtlpWaitForCriticalSection when 'scanning the process list'"
although the JIRA-tickets referenced the same unhiding commit 0.4.10-dev-136-g c7eb46d9fd for the master branch.
I consider that as being a temporary workaround that has been applied to master, which seems to be not needed in the older branches,
and it may be possible that we may get rid of that on master too at some point in the future.

------------

NTOSKRNL binary size unchanged:
releases/0.4.9 RosBEWin2.1.6 GCC4.7.2dbg  4.311.552 -> 4.311.552
releases/0.4.8 RosBEWin2.1.6 GCC4.7.2dbg  4.296.704 -> 4.296.704
releases/0.4.7 RosBEWin2.1.6 GCC4.7.2dbg  4.231.168 -> 4.231.168
2023-12-18 15:01:30 +01:00
Joachim Henze 7c7b7e348c [0.4.9][PARPORT] Fix I/O port length check, [REACTOS] Logging & formatting, e.g. CORE-14388 CORE-19105
Ports back a real fix:
0.4.15-dev-1173-g ba09834c5e [PARPORT] Fix I/O port length check

Ports back logging and formatting:
0.4.15-dev-6794-g 4eace8d762 [IPHLPAPI] Silence obsolete FIXME in GetAdaptersAddresses (#5834) CORE-14388
0.4.15-dev-6438-g b12ab486d8 [MUP] Mute DPRINT1's that slow down shared folder accesses (#5545) CORE-19105

And mutes some other loggings as well for stuff, that I either never want to port back, e.g. the IMM-implementations,
or which is not really helpful in the older branches:
fixme:(win32ss/user/user32/misc/imm.c:446) WINNLSEnableIME is UNIMPLEMENTED!
fixme:(../dll/win32/iphlpapi/address.c:290) GetAdaptersAddresses - Semi Stub: Family 2, Flags 0x0000002e, Reserved 00000000, pAdapterAddress 00000000, pOutBufLen 0143EBD4.

when browsing the startmenu:
fixme:(dll/win32/comctl32/toolbar.c:394) [00080086] TBSTYLE_REGISTERDROP not implemented
fixme:(dll/win32/comctl32/toolbar.c:5636) [00080086] response 2045774661 not handled to NM_CUSTOMDRAW (CDDS_PREERASE)
fixme:(dll/win32/comctl32/toolbar.c:5673) [00080086] response 3225142 not handled to NM_CUSTOMDRAW (CDDS_POSTERASE)
fixme:(dll/win32/comctl32/toolbar.c:5636) [000200BA] response 9 not handled to NM_CUSTOMDRAW (CDDS_PREERASE)
fixme:(dll/win32/comctl32/toolbar.c:5636) [00080086] response 2288892 not handled to NM_CUSTOMDRAW (CDDS_PREERASE)
fixme:(dll/win32/comctl32/toolbar.c:5673) [00080086] response 3291448 not handled to NM_CUSTOMDRAW (CDDS_POSTERASE)

and a bigger block regarding the parallel port during booting:
(drivers/parallel/parport/parport.c:127) Parport DriverEntry
(drivers/parallel/parport/fdo.c:391) AddDevice(B0B50548 B0FED980)
(drivers/parallel/parport/fdo.c:25) AddDeviceInternal()
(drivers/parallel/parport/fdo.c:513) FdoPnp()
(drivers/parallel/parport/fdo.c:582) IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS
(drivers/parallel/parport/fdo.c:513) FdoPnp()
(drivers/parallel/parport/fdo.c:546) IRP_MJ_PNP / IRP_MN_START_DEVICE
(drivers/parallel/parport/misc.c:42) Calling lower device B0FED980
(drivers/parallel/parport/fdo.c:116) FdoStartDevice ()
(drivers/parallel/parport/fdo.c:160) Port: BaseAddress 0x378  Length 8
(drivers/parallel/parport/fdo.c:160) Port: BaseAddress 0x778  Length 8
(drivers/parallel/parport/fdo.c:174) Interrupt: Level 20  Vector 55
(drivers/parallel/parport/fdo.c:195) New LPT port: Base 0x378
(drivers/parallel/parport/fdo.c:513) FdoPnp()
(drivers/parallel/parport/fdo.c:586) Unknown minor function 0x9
(drivers/parallel/parport/fdo.c:513) FdoPnp()
(drivers/parallel/parport/fdo.c:586) Unknown minor function 0x14
(drivers/parallel/parport/fdo.c:513) FdoPnp()
(drivers/parallel/parport/fdo.c:564) IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations
(drivers/parallel/parport/fdo.c:351) FdoQueryBusRelations()
(drivers/parallel/parport/fdo.c:233) FdoCreateRawParallelPdo()
(drivers/parallel/parport/fdo.c:378) Done
(drivers/parallel/parport/pdo.c:165) PdoPnp()
2023-11-05 13:37:22 +01:00
Joachim Henze 93b6e9e13d [0.4.9][NTOS][WIN32SS][UDFS] Fix double free in ObCreateObject, fix retvals CORE-14271
Backport the following commits:
0.4.15-dev-6401-g 53b30e3f3b [NTOSKRNL][NTGDI] Formatting addendum, no functional change
0.4.15-dev-5487-g e7bbbf049e [NTOS] Fix double free on allocation failure in ObCreateObject
partially 0.4.13-dev-358-g 38db074491 [WIN32SS][UDFS] Misc addendum to CORE-14271 (#1529)
0.4.12-dev-648-g 17af7f0c27 [UDFS] Correctly check SeSinglePrivilegeCheck() return value (#1324) CORE-14271
0.4.12-dev-552-g 0483a5a380 [NTOS:OB] Correctly check SeSinglePrivilegeCheck() return value (#1323) CORE-14271
partially 0.4.10-dev-528-g 2c909db295 [NTOS:OB] Remove duplicated ObpTypeObjectType from ob.h

Just for verifying that the size didn't increase anywhere:

ntoskrnl.exe GCC8.4.0dbg RosBEWin2.2.2 master               5.124.096
ntoskrnl.exe GCC4.7.2dbg RosBEWin2.1.6 0.4.14  4.413.440 -> 4.413.440
ntoskrnl.exe GCC4.7.2dbg RosBEWin2.1.6 0.4.13  4.367.360 -> 4.367.360
ntoskrnl.exe GCC4.7.2dbg RosBEWin2.1.6 0.4.12  4.377.600 -> 4.377.600
ntoskrnl.exe GCC4.7.2dbg RosBEWin2.1.6 0.4.11  4.377.088 -> 4.377.088
ntoskrnl.exe GCC4.7.2dbg RosBEWin2.1.6 0.4.10  4.344.320 -> 4.344.320
ntoskrnl.exe GCC4.7.2dbg RosBEWin2.1.6 0.4. 9  4.311.552 -> 4.311.552
ntoskrnl.exe GCC4.7.2dbg RosBEWin2.1.6 0.4. 8  4.296.704 -> 4.296.704
ntoskrnl.exe GCC4.7.2dbg RosBEWin2.1.6 0.4. 7  4.231.168 -> 4.231.168

udfs.sys     GCC8.4.0dbg RosBEWin2.2.2 master             835.584
udfs.sys     GCC4.7.2dbg RosBEWin2.1.6 0.4.14  745.472 -> 745.472
udfs.sys     GCC4.7.2dbg RosBEWin2.1.6 0.4.13  745.472 -> 745.472
udfs.sys     GCC4.7.2dbg RosBEWin2.1.6 0.4.12  749.568 -> 749.568
udfs.sys     GCC4.7.2dbg RosBEWin2.1.6 0.4.11  749.568 -> 749.568
udfs.sys     GCC4.7.2dbg RosBEWin2.1.6 0.4.10  749.568 -> 749.568
udfs.sys     GCC4.7.2dbg RosBEWin2.1.6 0.4. 9  749.568 -> 749.568
udfs.sys     GCC4.7.2dbg RosBEWin2.1.6 0.4. 8  749.568 -> 749.568
udfs.sys     GCC4.7.2dbg RosBEWin2.1.6 0.4. 7  749.568 -> 749.568

user32.dll   GCC8.4.0dbg RosBEWin2.2.2 master               1.585.152
user32.dll   GCC4.7.2dbg RosBEWin2.1.6 0.4.14  1.448.448 -> 1.448.448
user32.dll   GCC4.7.2dbg RosBEWin2.1.6 0.4.13  1.445.376 -> 1.445.376
user32.dll   GCC4.7.2dbg RosBEWin2.1.6 0.4.12  1.455.616 -> 1.455.616
user32.dll   GCC4.7.2dbg RosBEWin2.1.6 0.4.11  1.453.056 -> 1.453.056
user32.dll   GCC4.7.2dbg RosBEWin2.1.6 0.4.10  1.434.624 -> 1.434.624
user32.dll   GCC4.7.2dbg RosBEWin2.1.6 0.4. 9  1.422.336 -> 1.422.336
user32.dll   GCC4.7.2dbg RosBEWin2.1.6 0.4. 8  1.421.824 -> 1.421.824
user32.dll   GCC4.7.2dbg RosBEWin2.1.6 0.4. 7  1.418.752 -> 1.418.752

win32k.sys   GCC8.4.0dbg RosBEWin2.2.2 master               3.477.504
win32k.sys   GCC4.7.2dbg RosBEWin2.1.6 0.4.14  2.904.064 -> 2.904.064
win32k.sys   GCC4.7.2dbg RosBEWin2.1.6 0.4.13  2.895.872 -> 2.895.872
win32k.sys   GCC4.7.2dbg RosBEWin2.1.6 0.4.12  2.887.680 -> 2.887.680
win32k.sys   GCC4.7.2dbg RosBEWin2.1.6 0.4.11  2.867.200 -> 2.867.200
win32k.sys   GCC4.7.2dbg RosBEWin2.1.6 0.4.10  2.863.104 -> 2.863.104
win32k.sys   GCC4.7.2dbg RosBEWin2.1.6 0.4. 9  2.834.432 -> 2.834.432
win32k.sys   GCC4.7.2dbg RosBEWin2.1.6 0.4. 8  2.830.336 -> 2.830.336
win32k.sys   GCC4.7.2dbg RosBEWin2.1.6 0.4. 7  2.830.336 -> 2.830.336
2023-08-02 00:53:35 +02:00
Joachim Henze c461964dcc [0.4.9][NTOS:MM] Fix BSOD0x1E
Port back
0.4.12-dev-973-g d29e216f99
[NTOSKRNL] In MmCreateImageSection, properly check whether cache was initialized
This fixes a crash that occurs if nul is typed in cmd.exe (BSOD0x1E)
----------
Port back also some unrelated formatting-improvements within section.c, e.g.: return(xyz) -> return xyz
A *partial* port of
0.4.15-dev-1793-g b7eb0fddf3
2023-02-28 04:09:07 +01:00
Joachim Henze 7730d1874f [0.4.9][REACTOS] Fix '\n.' typos CORE-18103
The same set of matches affected branches all the way down to releases/0.4.7
Fix picked from 0.4.14-dev-1010-g 1a83762ccc
2022-03-25 19:03:48 +01:00
Joachim Henze efaef5832c [0.4.9][WIN32SS][RTL] Fix regression CORE-16769 + BSOD 0x50 CORE-13907
The main motivation to port all that back is to get rid of Win32K-BSODs 0x50 like CORE-13907
that could be triggered by user-mode-applications.
Technical reason was CORE-14857 "RtlImageNtHeaderEx needs SEH" and issues with hooks+callbacks.
All other tickets mentioned in here were regressions that we experienced on the long
journey towards perfecting the fixes on master head, and those were not happening yet in the older builds,
so they are mentioned in here only to allow tracking where that code went into.

Thanks to Jim Tabor, Mark Jansen & Thomas Faber
By squashed backmerge of the following commits:
0.4.15-dev-3440-g a89844f740
0.4.15-dev-3430-g 9cff384c22
0.4.14-dev-1287-g 568b6d0558
0.4.14-dev-1255-g 177ae91bf6
0.4.14-dev-1241-g 915a5764a9
0.4.14-dev-1240-g d8add40e89
0.4.14-dev-1002-g feb7df42b4

JIRA-tickets: CORE-13907, CORE-16769, CORE-14857, CORE-17856, CORE-17857, partially CORE-13019.
We also had some more dupes of CORE-13907 in JIRA, but I linked all of them (transitively)
towards the initial report, and resolved them without setting a fixVer for them.

In more detail:
--------------
[USER32] Fix BSOD 0x50 in 'WineVDM + Castle Of Winds' CORE-17856 CORE-17857

CORE-17856 BSOD 0x50 when starting Castle of the Winds second time, with WineVDM
CORE-17857 BSOD 0x50 on shutdown after closing Castle of the Winds with WineVDM

0.4.15-dev-3430-g 9cff384c22
0.4.15-dev-3440-g a89844f740
--------------
[NTUSER] Fix Strings and Format to Hooks

Allocate heap instead of data segment to be used for callbacks on user side.
Move and correct initial hook call out setup. Use it in more than one hook call.

This fixes issues with strings out of alignment and use of kernel pointers.

See CORE-13907 (HXD-portable BSOD) and CORE-16769 (HXD-portable exception)

Small wow update.

cherry picked from commit 0.4.14-dev-1287-g 568b6d0558
--------------
[RTL] Introduce RtlpImageNtHeader,
which implements the required functionality.
ntdll and ntoskrnl now have a wrapper for this, with SEH.
This protects the function against malformed / bad images,
whilst still being able to use the code in freeldr et al.
Idea from Thomas.
CORE-14857

cherry picked from commit 0.4.14-dev-1255-g 177ae91bf6
--------------
[WIN32SS] Form Sanity to Hook Callbacks

Fix WH_CALLWNDPROC/RET data to user hook calls.
Helps with CORE-13907 "(HXD-portable BSOD)"
Fixes the logging of "(win32ss/user/ntuser/callback.c:748) err: Failure to make Callback! Status 0xc00000fd" within CORE-13019, but not the whole ticket.

cherry picked from commit 0.4.14-dev-1241-g 915a5764a9
--------------
[USER32] Fix null return.

See CORE-16769 "HxD 1.7.7.0 portable unhandled exception"

cherry picked from commit 0.4.14-dev-1240-g d8add40e89
--------------
[WIN32SS] Fix a typo in dbg print

cherry picked from commit 0.4.14-dev-1002-g feb7df42b4
2022-03-17 14:02:17 +01:00
Joachim Henze e9fe2a29e4 [0.4.9][NTOSKRNL] Mute noisy DPRINT 'SectionObject has ImageSection' during shutdown CORE-18029
All releases/0.4.8 until and including releases/0.4.14 were affected by the following logspam
during shutdown:
(../ntoskrnl/mm/section.c:4839) SectionObject has ImageSection
triggered 2 times for bootcd, but triggered 83 times for livecd.

Today I found out by chance, that we started to trigger it with the switch from CDFS to CDFS_NEW with
0.4.8-dev-164-g ec6b3ecbe4

We 'suffered' from that logspam for many years now and it did never help us in any way.
And during 0.4.15-dev'ing with the MM rewrite, the logging was entirely removed in the NTOSKRNL.
2022-01-27 20:19:24 +01:00
Joachim Henze 4e0a41bcb8 [0.4.9][NTOS/MM] Properly handle page faults in regions marked with PAGE_NOACCESS or PAGE_GUARD CORE-14694
This was part of the commits for ROSTESTS-110, but much more important:
It fixes CORE-14694 "reproducible BSOD 0x1A MEMORY_MANAGEMENT in OllyDbg v2.01"

Fix picked from 0.4.11-dev-650-g 47ac7a2b28

which also requires me to "Move up MmAlterViewAttributes() for later use in MmNotPresentFaultSectionView()"
like it was done in: 0.4.11-dev-649-g 47ac7a2b28
Ofc I moved the function up individually in each branch I do port this back to, without modifying the func.
2021-11-15 01:15:55 +01:00
Joachim Henze 16f9af86b5 [0.4.9][NTOS][USERSRV] Silence noisy debug output.
picked from 0.4.13-dev-82-g f5471b7b4b
2020-12-21 08:52:41 +01:00
Joachim Henze 9fdd9cf24c [0.4.9][NTOSKRNL] Demote some noisy dprints
picked from 0.4.13-dev-988-g 1539fb1414
2020-12-21 06:19:01 +01:00
Joachim Henze fcd06d286b [0.4.9][NTOSKRNL] Restore section layout for NTOSKRNL to fix BSOD regression CORE-14683
Thomas Faber thinks that it's a bit more
safe to just move "after .rsrc" instead of the proper "after .reloc".
A temporary tribute until ROSBE-154 will be fixed properly.

For now we use this just for NTOSKRNL, but not for drivers yet, see
MODULE TYPE sdk/cmake/gcc.cmake
As using also for drivers would immediately lead to BSODs like CORE-16183.
To allow installing DVDWritenow without BSOD,
we need the script at least for ntoskrnl!

The regression was introduced by SVN r55835 == git
6ebf8c2537

This patch (after .rsrc) was already committed into 0.4.15-dev-220-g
d28677795e
2020-10-31 16:39:40 +01:00
Timo Kreuzer ca8fbad361 [0.4.9][NTOS] Fix a regression in the PE loader CORE-11717
which caused images to be loaded up to MmHighestUserAddress,
thus overwriting the shared user page.

This is now fixed by using MM_HIGHEST_VAD_ADDRESS as the margin instead.
This commit allows again to load WIN32K.sys of Win2K3SP2
which regressed by SVN 67793 == git
3565260212

fix cherry picked from commit 0.4.14-dev-143-g
56da95671c
2020-10-22 15:50:57 +02:00
Joachim Henze f5c37a88d3 [0.4.9][NTOS:CC] Access SectionObjectPointers without lock in CcRosInitializ…
…eFileCache. CORE-14691

kmtest:NtCreateSection calls CcInitializeCacheMap with a
NULL value for SectionObjectPointers. This will cause an exception when
trying to access it, which in Windows can be handled gracefully.
However accessing it while holding ViewLock means the lock will not be
released, leading to an APC_INDEX_MISMATCH bugcheck.

This solves the problem by allocating SharedCacheMap outside the lock,
then freeing it again under lock if another thread has updated SharedCacheMap
in the mean time. This is also What Windows Does(TM).

The 100%-chance BSOD in kmtest:NtCreateSection was a regression
introduced by 0.4.10-dev-20-g
8a8cb4d890
which we once ported back into 0.4.9-RC-13-g
09f068086d
to support building ros on ros. That's why 0.4.9 is also in need of a fix.

The BSOD fix was cherry picked from 0.4.10-dev-191-g
1d398057a3
2020-10-04 12:52:08 +02:00
Pierre Schweitzer 9bccee3237 [0.4.9] cherry-pick [NTOSKRNL] Addendum to 8a8cb4d: don't print uninit pointer.
(cherry picked from commit 2cf9a69bce)
2018-05-26 14:12:49 +02:00
Pierre Schweitzer 09f068086d [0.4.9] cherry-pick [NTOSKRNL] Only consider SharedCacheMap value once ViewLock is acquired.
This avoids a really nasty race condition in our cache controler where
two concurrents could try to initialize cache on the same file.
This had two nasty effects: first shared map was purely leaked and erased
by the second one. And the private cache map, allocated on the first shared
cache map couldn't be freed and was leading to Mm BSOD (free in a middle of
a block).

This was often triggered while building ReactOS on ReactOS (with multi threads).
With that patch, I cannot crash anylonger while building ReactOS.

CORE-14634

(cherry picked from commit 8a8cb4d890)
2018-05-26 14:12:42 +02:00
Hermès Bélusca-Maïto de87a936ce
[NTOS] Demote an ASSERT to a mere DPRINT since we only support registry hives with cluster size == 1 in any case so far (other sizes are UNIMPLEMENTED!) 2018-05-19 22:07:06 +02:00
Pierre Schweitzer 7eca874824
[NTOSKRNL] Fix FsRtlStackOverflow work item free.
Oneliner of the day... This typo just prevented the
whole feature to work properly. Because any allocated
work item would miserably fail to be freed.

This will obviously help real world FSD relying on
StackOverflow worker from FsRtl to work better!

CORE-14611
2018-05-10 10:49:17 +02:00
Pierre Schweitzer 65e29b4b1f
[NTOSKRNL] Optimize a bit deferred writes.
In the lazy writer run, first post items that are queued for this.
Only then, start executing deferred writes if any.
If there were any, reschedule immediately a lazy writer run, to keep
Cc warm and to make it unqueue write faster in case of high IOs situation.
To make second lazy writer run happen faster, we keep our state active to
use short delay (1s) instead of standard idle (3s).
2018-05-02 23:33:45 +02:00
Pierre Schweitzer 54c049bd6e
[NTOKSNRL] Always flush dirty VACB.
Recent changes seem to show that it's not
required to be exclusive on VACB to be able
to flush it.

This commit goes with f2c44aa and fixes the
last issues going with copying huge files.
There are no longer BSODs (be it in Mm or Cc).
I could, with 750MB RAM extract a 2GB file from
a 53MB archive and copy a 2,5GB file from a VBox
share to the disk. Note that writes are often
deferred, so if copy works, it's not that fast for now.

Note that it also brings some beloved behavior from
Windows: copy times are totally unreliable now when
writes are deferred. Little remaining times when
actively copying, high remaining times when deferred
writes in action. And goes between both... Sorry! ;-)

https://xkcd.com/612/

CORE-9696
CORE-11175
2018-04-30 22:24:30 +02:00
Pierre Schweitzer 74c5d8b6bd
[NTOSKRNL] Free unused VACB when required.
Same mechanism exists in Windows (even their Cc
is way different from ours...) where when Cc is
out of memory (in their case, out of VACB), we
will start scavenge old & unused VACB to free
some of the memory.

It's useful in case we're operating we big files
operations, we may run out of memory where to map
VACB for them, so start to scavenge VACB to free
some of that memory.

With this, I am able to install Qt 4.8.6 with 2,5GB of RAM,
scavenging acting when needed!

CORE-12081
CORE-14582
2018-04-30 12:10:24 +02:00
Pierre Schweitzer cc54e51495
[NTOSKRNL] Unmark dirty first, and then write.
This will avoid trying to flush twice a dirty VACB under
high IOs pressure.

CORE-14584
2018-04-30 10:36:19 +02:00
Pierre Schweitzer f2c44aa483
[NTOSKRNL] Fix lazy writer for in-use VACB.
Adjusting refcount and enabling lazy-write for pinned
VACB makes it actually more efficient, often purging
data to disk, reducing memory stress for the system.

This is required for defering writes.

This commit unfortunately (?) reverts a previous revert.

CORE-12081
CORE-14582
CORE-14313
2018-04-29 20:42:53 +02:00
Pierre Schweitzer 2ea6de8a42
[NTOSKRNL] Also try to extract name from FCB when leaking VACB 2018-04-27 19:01:35 +02:00
Pierre Schweitzer 43836b0fbb
[NTOSKRNL] In !filecache, try to display FCB name
When no name is set in the file object, try to read the name
from the FCB. We only support FastFAT (ours) FCB for now.

This is clearly a hack, but for a kdbg command, so ;-)
2018-04-27 18:57:30 +02:00
Pierre Schweitzer 579a784e04
[NTOSKNRL] In case we leak a VACB, debug as much information as possible.
CORE-14578
2018-04-27 14:14:56 +02:00
Pierre Schweitzer fcf83315dc
[NTOSKRNL] Noisily dereference mapped VACB on cache release.
It seems that on process killing, some VACB may be deleted while
still mapped. With current reference counting, they will actually
not be deleted, but leaked, and an ASSERT will be triggered.

CORE-14578
2018-04-27 10:23:06 +02:00
Jason Johnson 054c11a02c Correctly bugcheck if we aren't returning a usermode thread (#506)
Cause a corresponding bug check to occur for the reason of the user context flag being zero (a system thread), instead of using DbgBreakPoint.
2018-04-24 23:07:02 +01:00
Hermès Bélusca-Maïto e616a456c0
[NTOSKRNL] Minor PnP enhancements.
- For non-PnP devices reported to the PnP manager through the
  IoReportDetectedDevice() function, store the corresponding
  service/driver name and (non-)legacy information inside their
  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\ entries.
- Drivers flagged as "DRVO_BUILTIN_DRIVER" (basically, only those
  created via a IoCreateDriver() call) have their "Service" name that
  contain "\Driver\", which should be stripped before being used in
  building e.g. the corresponding "DETECTEDxxx" PnP compatible IDs.
  CORE-14247

- Use explicit REG_OPTION_NON_VOLATILE flag where needed in the
  IopCreateDeviceKeyPath() calls.
- Save NULL-terminated REG-SZ string properties in the enumeration tree
  for each device enumerated inside \Enum\Root\.
- Always use upcased key name for the "LEGACY_***" elements in \Enum\Root\.
- Add a default "ConfigFlags" value for the legacy elements.
- Simplify few parts of code.
2018-04-22 16:52:45 +02:00
Hermès Bélusca-Maïto fa103197ad
[NTOSKRNL] Whitespace fixes only. 2018-04-22 16:52:40 +02:00
Hermès Bélusca-Maïto 45012aa486
[NTOSKRNL] Set the DRVO_BUILTIN_DRIVER DriverObject flag when a built-in driver is created using IoCreateDriver(). 2018-04-22 16:52:38 +02:00
Hermès Bélusca-Maïto 635775d249
[NTOSKRNL] Set flags the standard way. 2018-04-22 16:52:36 +02:00
Timo Kreuzer e49ef251b7 [NTOS:MM] Fix ViewSize parameter passed to MiInsertVadEx() from MiCreatePebOrTeb()
The size is in bytes, not in pages! On x86 we got away with it, since PEB and TEB require only a single page and the 1 passed to MiInsertVadEx() was aligned up to PAGE_SIZE. On x64 this doesn't work, since the size is 2 pages.
2018-04-22 15:06:19 +02:00
Thomas Faber d82ccaa2a2
[NTOS:PNP] Use pool tagging for DEVICE_ACTION_DATA. CORE-10456 2018-04-18 16:13:14 +02:00
Thomas Faber 121146e651
[NTOS:PNP] Rename IopDeviceRelations* to IopDeviceAction*. CORE-10456 2018-04-18 16:12:56 +02:00
Pierre Schweitzer fd3a6c1089 [NTOSKRNL] Properly reset VACB on free
CID 1434271
2018-04-15 22:52:53 +02:00
Pierre Schweitzer 953dc72dad [NTOSKRNL] Drop the VACB lock.
This has have several benefits for ReactOS Cc:
- It helps reducing potential deadlocks situations in Cc
- It speeds up ReactOS by reducing locks
- It gets us a bit closer to Windows VACB

CORE-14349
2018-04-15 22:52:53 +02:00
Pierre Schweitzer 40017a54f9 [NTOSKRNL] Use interlocked operations when dealing with map count.
CORE-14349
2018-04-15 22:52:53 +02:00
Pierre Schweitzer 1b672981e2 [NTOSKRNL] Map the VACB in kernel space before inserting it in lists.
The avoids race conditions where attempts to read from disk to
not fully initialized VACB were performed.
Also, added more debug prints in such situations.

CORE-14349
2018-04-15 22:52:53 +02:00
Pierre Schweitzer 42df4683d7 [NTOSKRNL] Add extra sanity checks for VACB lists.
We now always initialize list members from the VACB
and make sure the list entry has properly been removed
from the list before free.

CORE-14349
2018-04-15 22:52:53 +02:00
Thomas Faber b54e5c689c
[NTOS:MM] Do not map two pages into hyperspace in MiCopyFromUserPage. CORE-14548
Doing this is not only wrong because it acquires the same spinlock twice,
it also completely breaks the TLB flushing logic in MiMapPageInHyperSpace.
If the PTE with Offset 1 is still valid when a wrap-around to 0 happens,
the TLB flush on wrap-around will not clear the entry for this previous page.
After another loop around all hyperspace pages, page 1 is re-used but its
TLB entry has not been flushed, which may result into incorrect translation.
2018-04-15 20:07:21 +02:00
Serge Gautherie 6618a2fd2c [NTOS:CC] Use UNIMPLEMENTED_ONCE instead of custom code
- Rewrite e319f85e67.
2018-04-07 12:00:10 +02:00
Mark Jansen a5f12908df
[NTOSKRNL] Fix IopValidateID using uninitialized var, reset SeparatorsCount in the MultiSz case. 2018-04-05 22:06:31 +02:00
Timo Kreuzer 6b1ca75899
[REACTOS] Fix 64 bit build (#465)
* [HAL] Simplify HalpReboot() and make it portable
* [NTOS:MM] Cast constant to PVOID
* [BINPATCH] Fix 64 bit build
* [VFDDRV] Fix 64 bit build and buffer overruns
* [USBOHCI] Fix structure alignment issues
* [ATL_APITEST] Fix 64 bit build
* [XDK] Update unwind structures in winnt.h
* [NTDLL_APITEST] Fix 64 bit build
* [NTDLL_WINETEST] Fix 64 bit build
* [TFTPD] Fix x64 build
* [USBPORT] Fix a C_ASSERT
* [DSOUND] Fix x64 build
* [HAL] Remove obsolete GetPteAddress() macro
2018-04-03 15:13:17 -06:00
Hermès Bélusca-Maïto c54aaacc8e
[NTOSKRNL] Formatting fix only. 2018-04-01 22:51:24 +02:00
Hermès Bélusca-Maïto 6cefd1242d
[NTOSKRNL] Simplify NtRaiseHardError() by merging the terminating blocks.
- Return the status codes provided by the Ex(p)RaiseHardError() calls.
- Fix the return values in case of failure.
2018-04-01 22:50:56 +02:00
Hermès Bélusca-Maïto ea390c2b3f
[NTOSKRNL] ExRaiseHardError(): Protect strings copy to user-mode space inside a SEH block. 2018-04-01 22:50:44 +02:00
Hermès Bélusca-Maïto 842605e3ef
[NTOSKRNL] Don't emit hard errors for the calling thread if hard errors have been disabled for this thread on user-mode side. 2018-04-01 22:50:33 +02:00
Hermès Bélusca-Maïto 3a0ecb3dc8
[NTOSKRNL] Don't hardcode flag values for DefaultHardErrorProcessing. 2018-04-01 22:50:16 +02:00
Hermès Bélusca-Maïto 1fadfea053
[NTOSKRNL] Update Doxygen descriptions for NtRaiseHardError, ExRaiseHardError, ExpRaiseHardError and NtSetDefaultHardErrorPort. 2018-04-01 22:39:32 +02:00
Hermès Bélusca-Maïto f0729b30bb
[NTOSKRNL] Forbid processes without the Tcb prvilege to perform a user-mode hard-error BSOD. 2018-04-01 22:39:31 +02:00