- [KMTEST:IOFILESYSTEM] Add support for NTFS
- [KMTEST:IODEVICEOBJECT] Work around a Windows 7 bug, account for struct size changes on x64, accept Vista+ behavior
- [KMTEST:EXPOOLS] Accept pool being promoted to NonPaged on Vista+, accept 2GB allocation on x64, guard an undocumented behavior
- [KMTEST:CMSECURITY] Add tests for Vista-Win8.1
- Move BIOS-specific `EXTENDED_GEOMETRY` structure to pcdisk.c
- Zero out the transfer buffer for INT 13h, function 48h before
invocation. This ensures that any random data is removed and
that some broken BIOSes behave better.
- Use a more suitable type for the pointer to the transfer buffer,
so that we can use more human-manageable member names in TRACEs
instead of magic buffer offsets.
Which is also an addendum to commit b3f11cfb38 (r17484).
The Enhanced Disk Drive Specification tells us that if the (far) pointer
to the Device Parameter Table Extension is set to FFFF:FFFF, the pointer
is invalid.
However there are some BIOSes, incl UEFI ones when running in Legacy
mode (e.g. GIGABYTE UEFI DualBIOS), that set this pointer to 0000:0000
instead, which is also an invalid value.
[COM_APITEST]
- Add NTDDI version gating to classes and interfaces in tests
- Remove rigid offset tests. Instead, offsets to known interfaces can be logged by defining LOG_COM_INTERFACE_OFFSETS.
- Replace the noreg member of the known interfaces array with a function pointer that can be used to determine if a com test should be globally registered depending on the current NTDDI version. I could probably replace this with a min and max registered NTDDI value, but I thought this was confusing for interfaces that are never globally registered.
[INCLUDE/REACTOS]
- Rename the existing interface definition for IShellBrowserService to IShellBrowserService_XP at {1307EE17-EA83-49EB-96B2-3A28E2D7048A}. This only exists on XP and Server 2003, no earlier or later versions.
- Rename IID_IShellBrowserServce to IID_IShellBrowserService since this definition is correct for Windows 7+ at {DFBC7E30-F9E5-455F-88F8-FA98C1E494CA}
- Add an interface definition for IShellBrowserService4 at {F5A24314-5B8B-44FA-BC2E-31285544B520}. This definition for IShellBrowserService exists for Vista only and no other version.
[PSDK]
- Add a define for NTDDI_WIN7SP1. While this isn't defined in the public Windows headers, it clearly exists in private headers because it is referenced in the public WinBase.h header.
CORE-20336
Move some code in win32ss/gdi/ntgdi/dibobj.c into win32ss/gdi/gdi32/objects/bitmap.c.
Condition "YSrc = 0;" on "if (Height + YDest + 1 < ScanLines)" which fixes some gdi32:bitmap regressions.
- [INCLUDE/WINE] Add synced Wine headers for the iphlpapi winetest to use. This helps us slowly decouple our headers and wine's headers.
- [PSDK] Add definitions we are missing for other winetest syncs.
- [WINETESTS][APITESTS] Fix breaking changes, remove duplicate definitions for debugstr_guid.
- Add a tristate option to accept either true or false for the bStdOutput and bStdError tests
- Use this new option on the four tests that are inconsistent.
CORE-19104
- Use `NtPowerInformation()` and the `IS_PWR_*` macros instead.
- Fancy shutdown dialog:
* Enable or disable the hibernate/sleep buttons depending on
the previously-determined available shutdown options.
* Don't invoke `ExitWindowsEx()` or `SetSuspendState()` directly
within Msgina, but return a suitable `WLX_SAS_ACTION_SHUTDOWN_*`
value, like what's done by the classic dialog. The power action
proper is then performed by the caller of the shutdown dialog:
either Shell32 or Winlogon.
CORE-19104
This fixes failure to create or open the `PowerProfileRegistrySemaphore`,
when it has been first created by a Process1 using powrprof from a "User1",
and while this process stays running, the semaphore is attempted to be
re-created (or opened) by another Process2 using powrprof from a different
"User2".
For example, this happens when "User1" is either the LocalSystem account
with the Process1 being Winlogon.exe (via the msgina.dll -> powrprof.dll
dependency), or, "Administrator" with the explorer.exe process when opening
the "Shutdown" dialog (via the shell32.dll -> runtime-loading of msgina.dll
-> powrprof.dll dependency),
AND,
"User2" being a non-administrator user and Process2 being explorer.exe,
again when opening the "Shutdown" dialog. In this situation, msgina.dll
fails to be loaded, because powrprof.dll fails in its `DllMain()` routine
-- see log excerpt below --, and the shell falls back to a minimal shutdown
confirmation dialog.
```
err:(dll\win32\powrprof\powrprof.c:1420) Couldn't create Semaphore: 5
(dll\ntdll\ldr\ldrinit.c:879) LDR: DLL_PROCESS_ATTACH for dll "powrprof.dll" (InitRoutine: 7ADC6DB0) failed
(dll\win32\kernel32\client\loader.c:386) LoadLibraryExW(msgina.dll) failing with status c0000142
err:(dll\win32\powrprof\powrprof.c:1420) Couldn't create Semaphore: 5
(dll\ntdll\ldr\ldrinit.c:879) LDR: DLL_PROCESS_ATTACH for dll "powrprof.dll" (InitRoutine: 7ADC6DB0) failed
(dll\win32\kernel32\client\loader.c:386) LoadLibraryExW(msgina.dll) failing with status c0000142
(dll\ntdll\ldr\ldrutils.c:2340) Image explorer.exe has no exports, but were trying to get procedure (null). BaseAddress asked 0x00400000, got entry BA 0x00400000
err:(win32ss\user\user32\windows\messagebox.c:1048) MessageBox: L"Do you want to shutdown?"
```
- Reimplement `RtlUnhandledExceptionFilter()` by just calling
`RtlUnhandledExceptionFilter2()`.
- Return an adequate exception filter value `EXCEPTION_CONTINUE_SEARCH`
from `RtlUnhandledExceptionFilter2()`, instead of some random error.
If `ExceptionCode` is `STATUS_POSSIBLE_DEADLOCK` however, return
`EXCEPTION_CONTINUE_EXECUTION` instead, as shown by a test from Whindmar Saksit.
- The second parameter of `RtlUnhandledExceptionFilter2()` is not
a flag, but a pointer to string `PCSTR` !
See https://skanthak.hier-im-netz.de/download/NTDLL.H
who is the only one online who has the correct definition,
whose usage I've double-checked on Win7 ntdll.dll.
This is used in the `<function_name>` slot in the displayed
debugger message:
```
*** An Access Violation occurred in <program_command_line>:<function_name>
The instruction at <address> tried to write to a NULL pointer
```
For example, see: https://community.osr.com/t/access-violation/33435
- Validate the opened `WinSta0_DesktopSwitch` handle;
- Don't pass the `ahEvents` array containing a NULL pointer to
`MsgWaitForMultipleObjects()`, but provide the correct number
of non-NULL handles, otherwise the function fails and the code
ends up busy-looping.
- Validate the `MsgWaitForMultipleObjects()` result: bail out if
`WAIT_FAILED` is returned.
- Validate the event index passed to `CRegWatcher::InitEvent()`
and `CRegWatcher::OnEvent()`.
- Rename `WATCHENTRY_MAX` to `WI_REGEVTS_MAX` and add it in the
`WATCH_INDEX` enumeration.
- Fix some code comments.
- Don't hardcode buffer sizes.
- `ShowWindow()` 2nd parameter is an `SW_*` flag, not `TRUE`/`FALSE`.
- The "FIXME: Add battery page" comment is outdated since commit 4bdbb3092c
- Use standard `IDC_STATIC` instead of `-1` for resource control IDs.
- `AUTOCHECKBOX` already contains `WS_TABSTOP`, no need to add it explicitly.
- Reformat file headers.
Add Wow64PrepareForException handler, which is well documented as a hook for KiUserExceptionDispatcher (see e.g. https://github.com/brew02/KiUserExceptionDispatcherHook) and used by ntdll_winetest.
This also reloads rcx and rdx for the call to RtlDispatchException from the stack instead of relying on the registers to be set up by the kernel, which again is a feature used by ntdll_winetest, which calls this function from a hook with zeroed registers.
Add useful macros, similar to the powrprof.dll `IsPwr*()` functions,
but that are suitable when one has a `SYSTEM_POWER_CAPABILITIES`
structure initialized from `NtPowerInformation(SystemPowerCapabilities)`.
- `IS_PWR_SUSPEND_ALLOWED()`, equivalent to `IsPwrSuspendAllowed()`,
indicating whether any of the S1, S2, S3 sleep states are supported.
- `IS_PWR_HIBERNATE_ALLOWED()`, equivalent to `IsPwrHibernateAllowed()`,
indicating whether the S4 sleep state is supported and the
hibernation file is present.
- `IS_PWR_POWEROFF_ALLOWED()`, equivalent to `IsPwrShutdownAllowed()`,
indicating whether the S5 "soft-off" state is supported.
CORE-20343
The 3-second timeout FIXME (instead of waiting indefinitely), made in the
COMPBATT worker thread for the `IOCTL_BATTERY_QUERY_STATUS` case, was done
because _*our*_ BATTC handler expects the batteries to always support the
BTP (Battery Trip Point) feature for signaling a change of battery status,
but in the cases where it isn't supported, any waits it tried for the
battery to notify about a status change would never happen.
Furthermore, following commit 3a6e0d4b65, the `SetStatusNotify()` call
(_which always fails if the battery doesn't support the BTP feature_)
would now always exit the `IOCTL_BATTERY_QUERY_STATUS` handling without
any waiting nor battery polling [^1], and this would cause the COMPBATT
worker thread to busy-poll again forever.
The timeout FIXME is now moved to BATTC, instead of COMPBATT, since the
actual fixes should be in BATTC. In particular, it should queue all the
query IOCTLs and then serve them, either using the StatusNotify (BTP)
functionality if the battery supports it, or if not, do a very-slow
battery polling.
I've also increased the timeout a little bit more (5 seconds and not 3).
[^1]: Per the ACPI specification, it is expected that the operating system
performs battery polling if the battery doesn't support BTP, see:
https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/10_Power_Source_and_Power_Meter_Devices/Power_Source_and_Power_Meter_Devices.html#btp-battery-trip-point
Previously the function waited for the conditions *after* querying the status, and then returned the old status. Also, if querying failed, it waited and when the wait timed out it returned STATUS_SUCCESS without returning any data. If the call to SetStatusNotify failed and there was no timeout, it would wait forever.
This is all fixed now.