') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); std.os.windows: eliminate forwarder function in kernel32 by qilme · Pull Request #25766 · ziglang/zig · GitHub
Skip to content

std.os.windows: eliminate forwarder function in kernel32 - #25766

Merged
squeek502 merged 6 commits into
ziglang:masterfrom
qilme:std_os_windows
Oct 31, 2025
Merged

std.os.windows: eliminate forwarder function in kernel32#25766
squeek502 merged 6 commits into
ziglang:masterfrom
qilme:std_os_windows

Conversation

@qilme

Copy link
Copy Markdown
Contributor

@alexrp
alexrp requested a review from squeek502October 30, 2025 09:55

@squeek502squeek502 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to fully delete the functions from kernel32.zig and update any callsites to use the corresponding ntdll functions directly. Having functions in the kernel32 namespace that are actually ntdll functions is confusing more than it is helpful, and making breaking changes to kernel32.zig is fine.

@qilme
qilmeforce-pushed the std_os_windows branch 2 times, most recently from 60f1571 to 8f09e89CompareOctober 30, 2025 10:50
@qilme
qilme requested a review from squeek502October 30, 2025 11:02
kernel32.AddVectoredExceptionHandler -> ntdll.RtlAddVectoredExceptionHandler
kernel32.RemoveVectoredExceptionHandler -> ntdll.RtlRemoveVectoredExceptionHandler
kernel32.ExitProcess -> ntdll.RtlExitUserProcess
kernel32.InitializeCriticalSection -> ntdll.RtlInitializeCriticalSection
kernel32.EnterCriticalSection -> ntdll.RtlEnterCriticalSection
kernel32.LeaveCriticalSection -> ntdll.RtlLeaveCriticalSection
kernel32.DeleteCriticalSection -> ntdll.RtlDeleteCriticalSection
kernel32.TryAcquireSRWLockExclusive -> ntdll.RtlTryAcquireSRWLockExclusive
kernel32.AcquireSRWLockExclusive -> ntdll.RtlAcquireSRWLockExclusive
kernel32.ReleaseSRWLockExclusive -> ntdll.RtlReleaseSRWLockExclusive
kernel32.WakeConditionVariable -> ntdll.RtlWakeConditionVariable
kernel32.WakeAllConditionVariable -> ntdll.RtlWakeAllConditionVariable
kernel32.HeapReAlloc -> ntdll.RtlReAllocateHeap
kernel32.HeapAlloc -> ntdll.RtlAllocateHeap
kernel32.HeapFree -> ntdll.RtlFreeHeap
Comment threadlib/std/os/windows/ntdll.zig Outdated
Comment threadlib/std/os/windows/kernel32.zig
Comment threadlib/std/os/windows/ntdll.zig Outdated

@squeek502squeek502 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on!

@squeek502
squeek502 enabled auto-merge (squash) October 31, 2025 08:03
@qilme

Copy link
Copy Markdown
ContributorAuthor

Sorry for i accidentally clicked update branch manually instead of letting the auto-merge run.

@squeek502

Copy link
Copy Markdown
Member

No worries!

@squeek502
squeek502 merged commit 8347791 into ziglang:masterOct 31, 2025
9 checks passed
@andrewrk

Copy link
Copy Markdown
Member

Nice change, thank you!

jedisct1 added a commit to jedisct1/zig that referenced this pull request Nov 1, 2025
* master:
Implement threaded BLAKE3 (ziglang#25587)
std: Skip element comparisons if `mem.order` args point to same memory
std.Target: bump vulkan max version to 1.4.331
std.Target: bump opencl/nvcl max version to 3.0.19
std.Target: bump cuda max version to 13.0.2
std.Target: bump amdhsa max version to 7.1.0
std.Target: bump wasi max version to 0.3.0
std.Target: bump dragonfly max version to 6.4.2
std.Target: bump linux max version to 6.17
std.Target: bump fuchsia max version to 28.0.0
std.Target: bump contiki max version to 5.1.0
test: remove some unsupported x86_64 darwin targets from llvm_targets
std.os.windows: eliminate forwarder function in kernel32 (ziglang#25766)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@qilme@squeek502@andrewrk@Rocknest