Commit Graph

4499 Commits

Author SHA1 Message Date
dmex b34a4b4d8d Add PH_RESTRICT 2026-04-15 13:42:00 +10:00
dmex dc5f405ee5 Fix format type check and size-unit bounds
Use a masked comparison ((format->Type & FormatTypeMask) == MultiByteStringFormatType) so the Type field is matched correctly when it contains flags. Tighten the size-unit loop condition by requiring i+1 < sizeof(PhSizeUnitNamesCounted)/sizeof(PH_STRINGREF) to avoid out-of-bounds access when the code references the next unit.
2026-04-15 13:28:37 +10:00
dmex 6c554913ee Update guisuplistview.cpp 2026-04-13 16:42:09 +10:00
dmex 0428b61140 Update guisup.h 2026-04-13 16:05:22 +10:00
dmex b98cfd9334 Update guisuplistview.cpp 2026-04-13 16:05:13 +10:00
dmex 5990044b62 Add phnt.vcxitems, GUIDs and update IListView interfaces 2026-04-13 16:01:03 +10:00
dmex fa519d93be Adjust APIs and fix refcount in util 2026-04-13 12:49:24 +10:00
dmex 853021a2c3 Read Condition->Value with acquire semantics
Use ReadULongPtrAcquire to read Condition->Value into a local variable before checking the PH_QUEUED_LOCK_WAITERS flag and passing the value to PhpfWakeQueuedLockEx. This prevents re-reading races and ensures proper acquire memory ordering in PhfPulseCondition and PhfPulseAllCondition while preserving existing wake semantics.
2026-04-13 12:16:38 +10:00
dmex 5656f7f573 Support unknown Content-Length and buffer sizing
Add optional TotalLength to PhHttpReadDataToBuffer to allow pre-allocation when the total size is known; otherwise fall back to page-sized allocation and ensure reallocation grows enough for incoming chunks. Update callers to pass 0 when unknown. Change PhHttpDownloadToFile to tolerate missing Content-Length (common with chunked transfers): query Content-Length optionally, avoid failing if absent, only set file size hint and compute percent/progress when a total is available, and only validate final size when total was provided. Replace several WinHttp option queries to use the request handle instead of the session handle (certificate, request times, connection stats, extended error), switch PhHttpQueryStatusCode to use WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, and add a null-check in the WinHTTP status callback to avoid dereferencing a null context. Small cleanups: ensure allocation/resizing logic always meets needed capacity.
2026-04-13 12:12:55 +10:00
dmex 4cc413b67c Read fastlock value with acquire semantics
Replace direct load of FastLock->Value with ReadULongAcquire(&FastLock->Value) to enforce acquire memory ordering before the CAS in the fast-lock acquisition loop. This ensures proper ordering and visibility when acquiring the exclusive fast lock.
2026-04-13 11:51:40 +10:00
dmex b0e373d10f Fix scrolling, column indexing and layout bugs
Fixes HScrollVisible when computing HScrollHeight; correctly handle fixed column indexing when copying columns (return fixed column for index 0 and adjust lookup); fix centered text rectangle calculation to use TextRect.left + width; and adjust PhTnpEnsureVisibleNode call to pass the focused node index (remove off-by-one). These changes correct visual/layout issues and off-by-one errors when interacting with columns and node focus.
2026-04-13 11:42:23 +10:00
dmex 831336f5db Fix incorrect variables passed in PhApiSetResolveToHost
Use the correct variables parentNameFilePart to PhCompareStringRef instead of apiSetNameShort to compare the intended name parts, and pass &context to PhEnumWindows in PhEndWindowSession instead of &clientId so the window enumeration callback receives the proper context. These changes correct mismatched argument usage and ensure callbacks and comparisons operate on the right data.
2026-04-13 04:14:11 +10:00
dmex 099371f83c Fix sizeof usage and cleanup on error paths 2026-04-13 04:10:44 +10:00
dmex f26cf92454 Update nativepipe.c 2026-04-13 03:32:58 +10:00
dmex e6558dcdf5 Update phnative.h 2026-04-13 03:31:52 +10:00
dmex a215315479 Update phnative.h 2026-04-13 03:30:12 +10:00
Johnny Shaw 2df5e68bad phlib nativefile fix sal 2026-04-11 22:22:52 -06:00
dmex 3039832f2e Add support for / or - command line arguments 2026-04-12 11:09:57 +10:00
dmex 6c9368b54a Update SAL annotations 2026-04-12 10:54:21 +10:00
dmex 2346c8c0da Update apistubs.cpp 2026-04-12 10:54:21 +10:00
dmex 736945e66e add CONST qualifiers to static sort function arrays and use proper _CoreCrt* function-pointer types; 2026-04-10 16:01:36 +10:00
dmex 54a5d25a5b Update apiimport.c 2026-04-09 21:01:09 +10:00
dmex 65f5032280 Update apiimport.h 2026-04-09 20:57:52 +10:00
dmex c415778b16 Add HighResolution flag to PhSetWaitableTimer 2026-04-09 20:57:41 +10:00
dmex 5083e2800f Update treenewp.h 2026-04-09 19:33:28 +10:00
dmex 5d4428adbf Add scroll anchoring to treenew
Introduce scroll-anchoring support to the treenew control: add explanatory comments and anchoring behavior. Define anchor-related macros and declare helper APIs (PhTnpGetMaxVScrollPosition, PhTnpFindFlatListNode, PhTnpPrepareVScrollAnchor, PhTnpGetAnchoredVScrollPosition) used to snapshot/restore viewport during structural updates to avoid visible jumps.
2026-04-09 16:14:05 +10:00
dmex 77b60a8138 Bump HTTP version to 3.0 for a release request, tidy MSIX packaging steps, and refactor CMake build
Add routines to download GitHub IP ranges and Azure service tags and return address prefixes Bump HTTP version to 3.0 for a release request, tidy MSIX packaging steps, and update author year.
2026-04-08 10:24:41 +10:00
dmex 8b519eac3e Return system window brush in theme control #2874 2026-04-08 10:15:29 +10:00
dmex 8aa6a340e2 Add new native API declarations (process IO/VM counters, basic process enumeration helpers, mutant/event APIs) to phnative.h, Rename build version APIs and add native APIs 2026-04-08 05:27:21 +10:00
dmex 75dc02c1bd Update queuedlock.c 2026-04-08 00:05:52 +10:00
dmex f7796ce36f Use NoFence workqueue
The queue lock already provides synchronization, so using the NoFence variants removes redundant memory fences and reduces overhead without changing semantics.
2026-04-07 23:26:42 +10:00
dmex 7bc6c71dfd Add analysis lock assumptions and braces
Replace __analysis_assume_lock_acquired annotations with the standardized _Analysis_assume_lock_acquired_ calls and add explicit braces around case branches. The annotations are inserted before releasing/acquiring queued locks, critical sections and fast locks to aid static analysis; wrapping the case bodies in scopes prevents scoping issues and potential warnings. No functional behavior changes intended.
2026-04-07 23:25:50 +10:00
dmex beb239adb9 Use NoFence for provider lists 2026-04-07 23:24:41 +10:00
dmex 3d68a6c146 Use NoFence or debug/callback lists 2026-04-07 23:21:10 +10:00
dmex f76415964f Use NoFence for debug object lists
PhDbgObjectListLock (queued exclusive), so the NoFence variants avoid redundant memory fences and reduce overhead during debug object insertion/removal.
2026-04-07 23:01:18 +10:00
dmex ed1228abab Update apistubs.cpp 2026-04-06 09:44:59 +10:00
dmex 0f206b2bfd Update mapimg.h 2026-04-05 23:31:26 +10:00
dmex 1fa6dbed4c Improve Rich header parsing and checksum validation
Improve Rich header validation/robustness:
- Simplified/decrypted rich header loop and compute buffer end pointer; use PhMappedImageProbe and SEH to guard mapped memory accesses.
- Validate richHeaderLength alignment to PRODITEM size and derive entry count from length instead of scanning.
- Reworked hash handling to use a length variable returned by PhFinalHash and pass the actual hash length to PhBufferToHexString.
- Replace ProdIdHeader number/count assignment to use the finalized entry array count/items.
- Implement full Rich checksum computation (DOS header + entries) with rotations and per-entry contribution, validate against stored key and return STATUS_INVALID_IMAGE_HASH on mismatch.
- Make Rich total-length vs NT headers offset non-fatal (keep an assert in DEBUG builds) and fall back to NT headers offset as boundary.
- Minor bounds-check and formatting fixes in dynamic relocations and other hash output conversions.
These changes improve safety against malformed or tampered PE Rich headers and reduce crash potential when parsing mapped images.
2026-04-05 21:05:51 +10:00
dmex 4df243b093 Update mapimg.c 2026-04-05 21:00:49 +10:00
dmex c5033bd98c Update basesup.c 2026-04-05 20:58:50 +10:00
dmex 93419b169c Update apistubs.cpp 2026-04-05 20:58:13 +10:00
dmex b6fea7fce5 Update wslsup.c 2026-04-04 16:59:17 +11:00
dmex e16c69c552 Update verify.c 2026-04-04 16:59:08 +11:00
dmex 076c6f1f0b Update phutil.h 2026-04-04 11:51:29 +11:00
dmex 72d8feb13f Update verify.c 2026-04-04 11:49:53 +11:00
dmex ef03f8131c Update sync.c 2026-04-04 11:49:06 +11:00
dmex cc3aed0f43 Update wslsup.c 2026-04-04 11:48:39 +11:00
dmex 3a66e4d7e1 Fix rare crash from Win32k bug during SetWindowPos
Remove SWP_HIDEWINDOW in SetWindowPos calls, adding SWP_NOZORDER instead. This keeps the tooltip from being forced topmost or explicitly hidden when it's already topmost and processing show messages - Fix rare crash from win32k https://learn.microsoft.com/en-us/windows/win32/controls/implement-in-place-tooltips
2026-04-04 11:48:12 +11:00
dmex 419100148b Document rundown and init helper APIs 2026-04-04 03:20:52 +11:00
dmex 2058eb9af8 Use stack allocations and add error checks
Replace heap allocations with PhAllocateStack across multiple functions in phlib/nativefile.c, add NULL checks that return STATUS_INSUFFICIENT_RESOURCES, and switch PhFree calls to PhFreeStack. Also capture and check status from NtQueryVolumeInformationFile to handle failures early, and improve PhDeleteDirectoryWin32 comments and logic (opening flags, enumeration/deletion flow, and idempotent success when the directory no longer exists). Includes minor clarity/comments around direct I/O alignment and bypass I/O usage.
2026-04-04 03:17:03 +11:00