René's URL Explorer Experiment
Title: Restore legacy Windows support (XP, Win9x, WinCE) in the Windows VFS by guilt · Pull Request #55 · sqlite/sqlite · GitHub
Open Graph Title: Restore legacy Windows support (XP, Win9x, WinCE) in the Windows VFS by guilt · Pull Request #55 · sqlite/sqlite
X Title: Restore legacy Windows support (XP, Win9x, WinCE) in the Windows VFS by guilt · Pull Request #55 · sqlite/sqlite
Description: Restore legacy Windows support (XP, Win9x, WinCE) in the Windows VFS
Reverses the removal of Windows XP, Windows 9x/ME and Windows CE support
from the VFS layer in 3.54.0, without discarding anything that landed in
the meantime.
5 files changed, 2206 insertions(+), 375 deletions(-) across 7 commits,
based on 6e35c19f17.
What is restored
src/os_win.c, src/os_win.h and src/mutex_w32.c are put back to a
state where they build and run on Windows NT4/2000/XP, Windows 9x/ME and
Windows CE:
The aSyscall[] override table is back to its full 87 entries, with the
wide-character and CE-only entries guarded so they compile to NULL
thunks rather than vanishing.
SRWLOCK mutexes are replaced by CRITICAL_SECTION again, since SRWLOCK
is Vista-and-later.
ANSI (A-suffixed) code paths are reinstated behind osIsNT().
SQLITE_WIN32_VOLATILE and SQLITE_OS_WINCE support return.
Nothing upstream added since the removal was reverted — the restore was
checked feature-by-feature against the current tree, and
SQLITE_WIN32_HAS_GETTICKCOUNT64 was added so GetTickCount64 is guarded
rather than assumed.
Bugs found in the restored code
Five real defects turned up while getting this working. The first two were
latent in the restored code; the next three only became visible once
binaries were inspected at the import-table level.
1. Calling-convention mismatch in the shims (crash).
winGetFileSizeEx and winSetFilePointerEx were declared __cdecl, but
the thunk table casts every entry through WINAPI (__stdcall). The
callee popped 4 bytes where the caller expected 8, so the caller's
&x was not the address the callee wrote to. The bogus file size then
caused a NULL write later in sqlite3_open. Declared WINAPI instead.
2. LPWSTR/LPCSTR mismatch in winDelete().
The converted filename was declared LPWSTR, but
winConvertFromUtf8Filename() only returns a wide string when
osIsNT() is true. On the ANSI path it returns a narrow char* that was
passed to the A-suffixed thunks uncast. Cast at all four use sites,
matching what winOpen() already does.
3. GetNativeSystemInfo broke every Win9x load.
The entry was the only one in the table with no availability guard, and
the table takes each API's address at static init — so the linker adds
the symbol to the import table whether or not any code calls it. The
loader then refuses to start the executable on Win9x before any runtime
guard could run. It was also dead: osGetNativeSystemInfo has no call
sites anywhere in the tree. Added SQLITE_WIN32_HAS_GETNATIVESYSTEMINFO
alongside the existing SQLITE_WIN32_HAS_GETTICKCOUNT64.
4. Same class of bug: GetSystemTimeAsFileTime and
TryEnterCriticalSection.
Both are absent on Windows 95 and both were statically imported.
GetSystemTimeAsFileTime is now behind
SQLITE_WIN32_HAS_GETSYSTEMTIMEASFILETIME, which widens the existing
Windows CE fallback (GetSystemTime + SystemTimeToFileTime) to cover
Windows 95 as well. That fallback was also missing an error check in
winRandomness() — SystemTimeToFileTime() can fail, and the old code
would have XORed uninitialized stack bytes into the entropy pool.
TryEnterCriticalSection is now behind SQLITE_MUTEX_HAVE_TRYENTER,
which folds SQLITE_OS_WINNT together with the version check and also
guards winMutex_isNt and the sqlite3_win32_is_nt() prototype.
Note that Windows 95 and Windows NT 4.0 both report _WIN32_WINNT as
0x0400, so SQLITE_OS_WINNT is what separates them. Every existing
configuration compiles to exactly the same code as before; only an
explicit SQLITE_OS_WINNT=0 build changes.
5. tool/win95gs.c — the MinGW CRT's own Win98 import.
With SQLite's own code clean, a MinGW-linked binary still would not load
on Windows 95. crt2.o calls __security_init_cookie() on every start,
and the only definition in the toolchain lives in an archive member that
also imports GetSystemTimeAsFileTime. No compiler flag avoids it — the
reference is from crt2.o, not from user code. This file defines the
four symbols that member provides so the linker never extracts it.
It is not part of the amalgamation and no makefile references it; it is
linked in by hand for a deliberate Windows 95 build. Two details are
load-bearing and fail silently by falling back to the archive member: the
C identifiers need two underscores so cdecl decoration yields the three
crt2.o asks for, and they must be cdecl rather than WINAPI.
Verification
test/testopen.c is a standalone smoke test for the Windows VFS with a
structured exception filter that reports exception code, faulting address
and read/write. That is what makes the calling-convention bug diagnosable
at all — without it an access violation just kills the process silently.
Its --ansi option sets sqlite3_os_type = 1 before the first database
access, which is the mechanism os_win.c documents for emulating Win98
on a modern host.
MSVC x86, nmake /f Makefile.msc:
testopen.exe --wal ALL PASSED
testopen.exe --ansi --wal ALL PASSED
The second is the first runtime exercise the restored ANSI paths have had.
MinGW-W64 i686-w64-mingw32-gcc 8.1.0 — 0 errors on all five targets,
only a pre-existing sigterm_handler warning from shell.c:
target
flags
post-Win95 imports
nt4
_WIN32_WINNT=0x0400
none
win95
+SQLITE_OS_WINNT=0 +OMIT_WAL +MAX_MMAP_SIZE=0 + win95gs.c
none
win98
+SQLITE_OS_WINNT=0 +OMIT_WAL +MAX_MMAP_SIZE=0
none
xp
_WIN32_WINNT=0x0501
GetNativeSystemInfo (correct)
vista
_WIN32_WINNT=0x0600
+ GetTickCount64 (correct)
The Win95 import table now contains only KERNEL32, msvcrt.dll and USER32,
and its PE header still declares OS version 4.0. MinGW is the toolchain
that matters here because it links msvcrt.dll rather than the
Vista-and-later ucrtbase.
Also clean: tclsh tool/renumber-win-thunk.tcl src/os_win.c, and
0 errors out of 13,780 testfixture tests across
attach, corrupt, io, lock, wal, wal2, wal3.
Limitations
Windows CE is compile-only. The CE branches are restored and build,
but there is no CE toolchain or SDK here, so they have never executed.
A SQLITE_OS_WINNT=0 build must pass SQLITE_OMIT_WAL=1 and
SQLITE_MAX_MMAP_SIZE=0. That is an existing upstream requirement —
WAL and mmap rely on the NT kernel — and SQLite raises an #error if
they are left on.
Untested on real legacy hardware; the Win9x behaviour is exercised by
building against the legacy API surface and by the Win98 emulation mode
above, not by running on an actual Windows 9x machine.
Commits
6c81103580 Restore legacy Windows support (XP, Win9x, WinCE) in the VFS layer
9b025c5122 Fix calling-convention mismatch in the GetFileSizeEx/SetFilePointerEx shims
9fdf6d1ae3 Fix LPWSTR/LPCSTR type mismatch in winDelete()'s ANSI branch
9b5d0aac39 Add a standalone smoke test for the Windows VFS, including the Win9x paths
422344d1cd Stop GetNativeSystemInfo from breaking Win9x loads
7b3b18041d Stop GetSystemTimeAsFileTime and TryEnterCriticalSection from breaking Win9x loads
8d5d67378e Add a Windows 95 build helper that defeats the MinGW CRT's Win98 import
Open Graph Description: Restore legacy Windows support (XP, Win9x, WinCE) in the Windows VFS
Reverses the removal of Windows XP, Windows 9x/ME and Windows CE support
from the VFS layer in 3.54.0, without discarding anythi...
X Description: Restore legacy Windows support (XP, Win9x, WinCE) in the Windows VFS
Reverses the removal of Windows XP, Windows 9x/ME and Windows CE support
from the VFS layer in 3.54.0, without discarding anythi...
Opengraph URL: https://github.com/sqlite/sqlite/pull/55
X: @github
direct link
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:635327b4-4198-860e-8f22-0bf1a928001e |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9422:1E69A9:710E8:9E7EC:6AFE12B8 |
| html-safe-nonce | 8e311f9a2c9da1db860730f9783c6f88da5bb92a8f36d30e41d7d3fe88e05a0b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDIyOjFFNjlBOTo3MTBFODo5RTdFQzo2QUZFMTJCOCIsInZpc2l0b3JfaWQiOiIyODQ0MDgxNTY1MTQ5ODI3NzY4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 33286a31586a25d1c8d66b389542d0f987806b1502104099b4beb8bf894433c2 |
| hovercard-subject-tag | pull_request:4825313133 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | ///pull_requests/show/files |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/sqlite/sqlite/pull/55/files |
| twitter:image | https://avatars.githubusercontent.com/u/195178?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/195178?s=400&v=4 |
| og:image:alt | Restore legacy Windows support (XP, Win9x, WinCE) in the Windows VFS
Reverses the removal of Windows XP, Windows 9x/ME and Windows CE support
from the VFS layer in 3.54.0, without discarding anythi... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3cd8a1d79ccbf9aecac62781f79072482a49047fb982b8c9e2ad4aca8bf6a9af |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/sqlite/sqlite git https://github.com/sqlite/sqlite.git |
| octolytics-dimension-user_id | 48680494 |
| octolytics-dimension-user_login | sqlite |
| octolytics-dimension-repository_id | 176278485 |
| octolytics-dimension-repository_nwo | sqlite/sqlite |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 176278485 |
| octolytics-dimension-repository_network_root_nwo | sqlite/sqlite |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 05539640a34afe6142a519483d78ddd766a1304a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Skip to content | https://github.com/sqlite/sqlite/pull/55/files#start-of-content |
| https://github.com/ |
| Sign in | https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsqlite%2Fsqlite%2Fpull%2F55%2Ffiles |
| GitHubRepository hosting, code review, and collaboration | https://github.com/platform |
| CopilotAI coding agent for tasks, projects, and automated work | https://github.com/features/copilot |
| ActionsCI/CD and automation | https://github.com/features/actions |
| Code QualityQuality analysis, fixes, and enforcement | https://github.com/features/code-quality |
| CodespacesCloud development environments | https://github.com/features/codespaces |
| Code SecurityVulnerability detection and remediation | https://github.com/security/advanced-security/code-security |
| Secret ProtectionSecret scanning and leak prevention | https://github.com/security/advanced-security/secret-protection |
| All Features | https://github.com/features |
| Documentation | https://docs.github.com/en |
| Training | https://learn.github.com/skills |
| Certifications | https://learn.github.com/credentials |
| Build with Copilot | https://github.com/features/ai |
| Customize Copilot | https://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview |
| Integrations | https://github.com/marketplace |
| Trending repos | https://github.com/trending |
| GitHub Sponsors | https://github.com/open-source/sponsors |
| Developer articles | https://github.com/resources/articles |
| ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place. | https://github.blog/changelog/ |
| Enterprises | https://github.com/enterprise |
| Team | https://github.com/team |
| Startups | https://github.com/enterprise/startups |
| Nonprofits | https://github.com/solutions/industry/nonprofits |
| Healthcare | https://github.com/solutions/industry/healthcare |
| Financial services | https://github.com/solutions/industry/financial-services |
| Manufacturing | https://github.com/solutions/industry/manufacturing |
| Government | https://github.com/solutions/industry/government |
| See all industries | https://github.com/solutions/industry |
| Why GitHub | https://github.com/why-github |
| Customer Stories | https://github.com/customer-stories |
| Business insights | https://github.com/solutions/executive-insights |
| Trust Center | https://github.com/trust-center |
| GitHub Advanced SecurityEnterprise-grade code security | https://github.com/security/advanced-security |
| Copilot for businessEnterprise-grade AI features | https://github.com/features/copilot/copilot-business |
| Premium SupportEnterprise-grade 24/7 support | https://github.com/enterprise/premium-support |
| Documentation | https://docs.github.com/en |
| Resource center | https://github.com/resources |
| Blog | https://github.blog/ |
| Events & webinars | https://github.com/resources/events |
| Community Forum | https://github.com/orgs/community/discussions |
| Customer Stories | https://github.com/customer-stories |
| Integrations | https://github.com/marketplace |
| Customer support | https://help.github.com/ |
| Training | https://learn.github.com/skills |
| GitHub Status | https://www.githubstatus.com/ |
| About | https://github.com/about |
| Partners | https://github.com/partners |
| Changelog | https://github.blog/changelog/ |
| GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub. | https://githubuniverse.com/ |
| Pricing | https://github.com/pricing |
| Sign in | https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsqlite%2Fsqlite%2Fpull%2F55%2Ffiles |
| Sign up | https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=sqlite%2Fsqlite |
| Reload | https://github.com/sqlite/sqlite/pull/55/files |
| Reload | https://github.com/sqlite/sqlite/pull/55/files |
| Reload | https://github.com/sqlite/sqlite/pull/55/files |
| sqlite | https://github.com/sqlite |
| sqlite | https://github.com/sqlite/sqlite |
| Code | https://github.com/sqlite/sqlite |
| Pull requests26 (26) | https://github.com/sqlite/sqlite/pulls |
| Actions | https://github.com/sqlite/sqlite/actions |
| Security and quality | https://github.com/sqlite/sqlite/security |
| Insights | https://github.com/sqlite/sqlite/pulse |
| Sign up for GitHub
| https://github.com/signup?return_to=%2Fsqlite%2Fsqlite%2Fissues%2Fnew%2Fchoose |
| terms of service | https://docs.github.com/terms |
| privacy statement | https://docs.github.com/privacy |
| Sign in | https://github.com/login?return_to=%2Fsqlite%2Fsqlite%2Fissues%2Fnew%2Fchoose |
| guilt | https://github.com/guilt |
| sqlite:master | https://github.com/sqlite/sqlite/tree/master |
| guilt:master | https://github.com/guilt/sqlite9x/tree/master |
|
Conversation
0
| https://github.com/sqlite/sqlite/pull/55 |
|
Commits
7
| https://github.com/sqlite/sqlite/pull/55/commits |
|
Checks
0
| https://github.com/sqlite/sqlite/pull/55/checks |
|
Files changed
| https://github.com/sqlite/sqlite/pull/55/files |
| Please reload this page | https://github.com/sqlite/sqlite/pull/55/files |
|
Restore legacy Windows support (XP, Win9x, WinCE) in the Windows VFS
| https://github.com/sqlite/sqlite/pull/55/files#top |
|
Show all changes
7 commits
| https://github.com/sqlite/sqlite/pull/55/files |
|
6c81103
Restore legacy Windows support (XP, Win9x, WinCE) in the VFS layer
guilt Oct 12, 2026
| https://github.com/sqlite/sqlite/pull/55/commits/6c81103580d306e6d924b81bd4475ae825cd97c6 |
|
9b025c5
Fix calling-convention mismatch in the GetFileSizeEx/SetFilePointerEx…
guilt Oct 12, 2026
| https://github.com/sqlite/sqlite/pull/55/commits/9b025c5122d91f2a2d675cc2c90069e182ae6bbb |
|
9fdf6d1
Fix LPWSTR/LPCSTR type mismatch in winDelete()'s ANSI branch
guilt Oct 12, 2026
| https://github.com/sqlite/sqlite/pull/55/commits/9fdf6d1ae3bbd4f7ae3d6bea58679b4688620bbf |
|
9b5d0aa
Add a standalone smoke test for the Windows VFS, including the Win9x …
guilt Oct 12, 2026
| https://github.com/sqlite/sqlite/pull/55/commits/9b5d0aac3904fee668441df4afdf792c1dcf8c08 |
|
422344d
Stop GetNativeSystemInfo from breaking Win9x loads
guilt Oct 12, 2026
| https://github.com/sqlite/sqlite/pull/55/commits/422344d1cd407c966a9725a157dda7f394713d7a |
|
7b3b180
Stop GetSystemTimeAsFileTime and TryEnterCriticalSection from breakin…
guilt Oct 12, 2026
| https://github.com/sqlite/sqlite/pull/55/commits/7b3b18041dc2401b5118f585e84f16c391497c46 |
|
8d5d673
Add a Windows 95 build helper that defeats the MinGW CRT's Win98 import
guilt Oct 12, 2026
| https://github.com/sqlite/sqlite/pull/55/commits/8d5d67378efed102625933825edb452316205d2a |
|
Clear filters
| https://github.com/sqlite/sqlite/pull/55/files |
| Please reload this page | https://github.com/sqlite/sqlite/pull/55/files |
| Please reload this page | https://github.com/sqlite/sqlite/pull/55/files |
|
mutex_w32.c
| https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
|
os_win.c
| https://github.com/sqlite/sqlite/pull/55/files#diff-e147255e097b77756e44b3b8939c8fbf69ce8fc9b5f3a800d28e68eb92807568 |
|
os_win.h
| https://github.com/sqlite/sqlite/pull/55/files#diff-67a4c6fe791b5d8494e88c43b95603d35e726708e242909f3de549f05defbd00 |
|
testopen.c
| https://github.com/sqlite/sqlite/pull/55/files#diff-fcf2170aca251d4b1db5d3103a50e5c3976a33904457fb0ccc21cc8a9374b071 |
|
win95gs.c
| https://github.com/sqlite/sqlite/pull/55/files#diff-cc9a905cc540a9eb9be323c67e31340a01971a7c3216dcc27274c8fc99546ed7 |
| src/mutex_w32.c | https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
|
View file
| https://github.com/sqlite/sqlite/blob/8d5d67378efed102625933825edb452316205d2a/src/mutex_w32.c |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/sqlite/sqlite/pull/55/{{ revealButtonHref }} |
|
| https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
|
| https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
|
| https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
|
| https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
|
| https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
|
| https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
|
| https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
|
| https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
|
| https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
|
| https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
|
| https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
|
| https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
|
| https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
|
| https://github.com/sqlite/sqlite/pull/55/files#diff-98f7a6124858c92cf8a2c779270c51c7379ff8f4a1f348e83bcf302113b1bf1c |
| Please reload this page | https://github.com/sqlite/sqlite/pull/55/files |
|
| https://github.com |
| Terms | https://docs.github.com/site-policy/github-terms/github-terms-of-service |
| Privacy | https://docs.github.com/site-policy/privacy-policies/github-privacy-statement |
| Security | https://github.com/security |
| Status | https://www.githubstatus.com/ |
| Community | https://github.community/ |
| Docs | https://docs.github.com/ |
| Contact | https://support.github.com?tags=dotcom-footer |
Viewport: width=device-width
URLs of crawlers that visited me.