') + ')', '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); } })(); })(); Running windows programs under litebox on linux by Vadiml1024 · Pull Request #712 · microsoft/litebox · GitHub
Skip to content

Running windows programs under litebox on linux - #712

Open
Vadim Lebedev (Vadiml1024) wants to merge 675 commits into
microsoft:mainfrom
Vadiml1024:main
Open

Running windows programs under litebox on linux#712
Vadim Lebedev (Vadiml1024) wants to merge 675 commits into
microsoft:mainfrom
Vadiml1024:main

Conversation

@Vadiml1024

Copy link
Copy Markdown

This PR extends Microsoft's LiteBox library OS with a new Windows-on-Linux execution capability — the inverse of the upstream Linux-on-Windows feature. Key additions include:

litebox_shim_windows — a PE/COFF parser with full header validation, section loading, relocation (DIR64/ASLR) support, and comprehensive error handling.
litebox_platform_linux_for_windows — a Linux platform abstraction layer for future Windows binary execution.
litebox_runner_windows_on_linux_userland — a CLI runner for inspecting and executing Windows PE binaries on Linux.
C++ exception handling infrastructure for Windows-on-Linux (WIP).
A GitHub Actions workflow to automate opening PRs back to the upstream microsoft/litebox repository.

…nux-support-again
Phase 22: Reduce Windows-on-Linux stub count 22→14
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…per review
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…s doc and instructions
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…-support-again
Phase 23: Eliminate all remaining Windows-on-Linux stubs
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…tatus
docs: remove duplicate content from windows_on_linux_status.md
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Consolidate CI and other workflows into ci.yml
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…inux-support-another-one
Phase 24: Extended USER32 + new GDI32 headless stubs for GUI program support
…VERSION.dll support
- Add SystemTime struct and GetSystemTime/GetLocalTime using libc gmtime_r/localtime_r
- Add SystemTimeToFileTime/FileTimeToSystemTime for FILETIME conversion
- Add GetTickCount (32-bit wrapper around GetTickCount64)
- Add LocalAlloc/LocalFree delegating to HeapAlloc/HeapFree
- Add InterlockedIncrement/Decrement/Exchange/ExchangeAdd/CompareExchange/CompareExchange64
- Add IsWow64Process (always returns TRUE with is_wow64=FALSE)
- Add GetNativeSystemInfo (delegates to GetSystemInfo)
- Promote AtomicI32/AtomicI64/Ordering to module-level imports in kernel32.rs
- Add shell32.rs: CommandLineToArgvW, SHGetFolderPathW, ShellExecuteW, SHCreateDirectoryExW
- Add version.rs: GetFileVersionInfoSizeW, GetFileVersionInfoW, VerQueryValueW (stubs)
- Register all new functions in function_table.rs and dll.rs
- Update test_dll_manager_creation to expect 12 DLLs (SHELL32 + VERSION added)
- 384 tests passing (up from 367 in Phase 24)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…move non-standard CSIDL_TEMP)
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…ator, LocalFree return, E_FAIL constant, SystemTimeToFileTime validation
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…inux-support-yet-again
Phase 25: Time APIs, interlocked ops, SHELL32.dll, VERSION.dll
…r name APIs
- Add CreateMutexW/A, OpenMutexW, ReleaseMutex
- Add CreateSemaphoreW/A, OpenSemaphoreW, ReleaseSemaphore
- Add WaitForSingleObject/WaitForMultipleObjects support for mutex/semaphore handles
- Add SetConsoleMode, SetConsoleTitleW/A, GetConsoleTitleW
- Add AllocConsole, FreeConsole, GetConsoleWindow
- Add lstrlenA, lstrcpyW/A, lstrcmpW/A, lstrcmpiW/A
- Add OutputDebugStringW/A
- Add GetDriveTypeW, GetLogicalDrives, GetLogicalDriveStringsW
- Add GetDiskFreeSpaceExW, GetVolumeInformationW
- Add GetComputerNameW/ExW
- Add GetUserNameW/A (ADVAPI32)
- Update function_table.rs and dll.rs exports
- Update ratchet.rs global count from 39 to 42
- Fix pre-existing clippy cast_signed issue in shell32.rs
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use 'needed' variable (instead of utf16.len() + 1) for consistency in GetUserNameW size assignment
- Keep libc import clean (use 'use libc;' form consistently)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…Computer Name APIs
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…ame consistency
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…inux-support-one-more-time
Phase 26: Mutex/Semaphore, Console, String, Drive/Volume, and Identity APIs
Add thread management, file times, character APIs, window utilities,
system directory paths, and temp file name generation.
KERNEL32 additions (15 functions):
- SetThreadPriority / GetThreadPriority (no-op, always normal priority)
- SuspendThread / ResumeThread (no-op, always returns 0)
- OpenThread (looks up handle in THREAD_HANDLES registry)
- GetExitCodeThread (returns STILL_ACTIVE or actual exit code)
- OpenProcess (returns pseudo-handle for current process only)
- GetProcessTimes (returns wall-clock creation time, zero CPU times)
- GetFileTime (reads fstat timestamps for open file handles)
- CompareFileTime (three-way comparison of FILETIME values)
- FileTimeToLocalFileTime (applies local timezone offset)
- GetSystemDirectoryW (returns C:\Windows\System32)
- GetWindowsDirectoryW (returns C:\Windows)
- GetTempFileNameW (generates unique temp file name with prefix)
USER32 additions (15 functions):
- CharUpperW / CharLowerW (in-place or single-char wide conversion)
- CharUpperA / CharLowerA (in-place or single-char ANSI conversion)
- IsCharAlphaW / IsCharAlphaNumericW / IsCharUpperW / IsCharLowerW
- IsWindow / IsWindowEnabled / IsWindowVisible (headless: always FALSE)
- EnableWindow / GetWindowTextW / SetWindowTextW / GetParent (headless stubs)
Also updates function_table.rs and dll.rs with all new exports.
Adds 27 new unit tests covering all new functions.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use wrapping_add/wrapping_mul in GetProcessTimes for explicit overflow behavior
- Use i128 intermediate cast in FileTimeToLocalFileTime to avoid i64 overflow
for extreme timezone offsets, then reinterpret as u64 for wrapping_add
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…-apis
Phase 45: Windows GUI APIs (USER32/GDI32), Vulkan-1 stubs, and C GUI test program
…kages, ratchet update
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
… improve docs
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…ading test
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…upport
Add `real_vulkan` feature for pass-through to host Vulkan ICD loader
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…lure
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Integrate C Windows GUI API test program into CI workflow
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
sync-branch: rebase local main onto upstream and auto-resolve conflicts
- Merge upstream/main into fork with fork's code winning conflicts
- Rename change_address_space() back to load() for upstream compatibility
- Add clean_up() and new_user_page_table() methods for user_context support
- Add user_context module declaration and imports
- Remove duplicate NtdllApi impl and imports in linux_for_windows
- Fix stale modular_bitfield imports in optee
- Fix duplicate imports in linux_kernel
- Update ratchet counts for upstream changes
- Create docs/rebasing.md with detailed conflict log
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
- litebox_platform_linux_userland/src/lib.rs: Fix CoW region overlap
check to also detect when a previous region extends into the new range
- litebox_common_linux/src/loader.rs: Use checked_add for trampoline
offset validation to prevent overflow with malformed ELF inputs
- litebox_rtld_audit/rtld_audit.c: Harden align_up against zero alignment
and overflow; validate max_addr before pointer arithmetic to prevent
invalid trampoline address computation
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Merge microsoft/litebox upstream main into fork with conflict resolution
Merge signal infrastructure and SIGINT support from copilot/rebase-on-microsoft-main
@Vadiml1024

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

2 participants

@Vadiml1024