Thanks to Jim Tabor, Mark Jansen & Thomas Faber
By squashed backmerge of the following commits:
--------------
[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 and CORE-16769. KsStudio still needs retested.
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. See CORE-13019 and CORE-13907.
cherry picked from commit 0.4.14-dev-1241-g
915a5764a9
--------------
[USER32] Fix null return.
See CORE-16769.
cherry picked from commit 0.4.14-dev-1240-g
d8add40e89
CP_UTF8 validation was not strict. 5- or 6-byte length sequences are invalid in RFC 3629 UTF-8. CORE-16468
- Fix MultiByteToWideChar(CP_UTF8, ...) by making check strict.
This will definitely fix regression CORE-16678 which was introduced or unhidden by
0.4.13-dev-927-g
e85664a3d8
and was also reported to bring ros a bit closer towards displaying japanese in ros Notepad with MS Gothic,
but I am not sure, whether it is enough for that already when backported on its own.
cherry picked from commit 0.4.14-dev-193-g
a63678c9a9
Fixes symptom "MSVCPP2017 setup crash due to missing export"
The issue very likely got introduced by
0.4.13-dev-986-g
029b8f2cf9
because our loader exports stuff from neweer Windows versions
since then in case an executables manifest states compatibility.
Original commit message from patches author William Kent:
Stub GetCurrentPackageId() (#1942)
* [KERNEL32] Add stub implementation for GetCurrentPackageId() function
This Windows 8+ function is called by WiX bundles (EXE-based installers) upon exit, if the export is present. If it is a stub in the spec, they will crash, even if they are coded to be compatible with Windows XP/ReactOS.
Also add GetCurrentPackageId() forwarder to apiset.
cherry picked from commit 0.4.14-dev-482-g
192926ee02
Symptom "Far Manager 3.0 Build 5200 can not load NetBox.dll"
due to uncaught exception when accessing GetSystemTimePreciseAsFileTime().
The symptom started to show with 0.4.13-dev-986-g
029b8f2cf9
as LDR exposes more Vista+ stuff since then.
The fix is a selective backmerge of master PR-1963
- Add some cleanup code in failure code paths, instead of asserting.
- Move BasepNotifyCsrOfThread() helper to the only file where it is used.
- Don't use ERROR_DBGBREAK in failure paths but just DPRINT the error
message: we handle the failures properly.
- When creating the remote thread, sync its service tag with the parent
thread's one.
- kernel32!BaseCreateStack() is compatible with ntdll!RtlpCreateUserStack().
- When checking whether a stack guard page can be added, its size has to
be accounted for in the checking logic.
- We have to satisfy the PEB::MinimumStackCommit constraint.
- We cannot use PEB::GuaranteedStackBytes in BaseCreateStack() since it is
nowhere initialized (default is 0). It gets initialized to a non-zero
value when the user manually calls SetThreadStackGuarantee().
https://www.installsetupconfig.com/win32programming/windowsthreadsprocessapis7_6.html
- RtlpCreateUserStack(): Fix memory leak in failure case.
- RtlpFreeUserStack() doesn't need to return anything.
See also commit 1bc59379 (r59868).
CORE-11319
- Add support for LUIDDeviceMapsEnabled;
- Broadcast proper message in case of device removal;
- Use less memory for strings management;
- Make code a bit cleaner.
by using TEB static unicode string (which is already
preallocated).
Also, properly handle RtlUnicodeStringToAnsiString failures.
Finally, make sure output buffer is properly 0 terminated.
There is no need to compile our DLLs as shared libraries since we are
managing symbols exports and imports through spec files.
On my system, this reduces the configure-time by a factor of two.
* [WIN32K] Fix handle calculation in DbgGdiHTIntegrityCheck
* [NOTEPAD] Fix MSVC warnings
* [PSDK] Simplify *PROC definitions in windef.h
* [VIDEOPRT] Don't try to use NtVdmControl on x64
* [FREELDR] Fix some macros
* [CRT] Make qsort 64 bit compatible
* [NTOS] Use #ifndef _WIN64 instead of #ifdef _M_IX86 around C_ASSERTs
* [FAST486] Fix 64 bit warnings and change DWORD to ULONG, so it can be used in kernel mode
* [APPHELP_APITEST] Fix 64 bit issue
The PROCESS_DEVICEMAP_INFORMATION union has 2 fields, one is a handle, the other one is a structure of 36 bytes (independent of architecture). The handle forces 64 bit alignment on 64 bit builds, making the structure 4 bytes bigger than on 32 bit builds. The site is checked in NtQueryInformationProcess (case ProcessDeviceMap). The expected size on x64 is the size of the Query structure without alignment. autocheck correctly passes the site of the Query union member, while smss passes the full size of PROCESS_DEVICEMAP_INFORMATION. Packing the structure is not an option, since it is defined in public headers without packing. Using the original headers sizeof(PROCESS_DEVICEMAP_INFORMATION) is 0x28, sizeof(PROCESS_DEVICEMAP_INFORMATION::Query) is 0x24.
- Implement EnumSystemFirmwareTables
- Implement GetSystemFirmwareTable
These functions currently using registry workaround and can be improved later.
CORE-12105