Skip to content

Remove many alternate codepaths for _CRT_APP and _ONECORE#6190

Merged
StephanTLavavej merged 13 commits intomicrosoft:mainfrom
StephanTLavavej:appendectomy
Apr 2, 2026
Merged

Remove many alternate codepaths for _CRT_APP and _ONECORE#6190
StephanTLavavej merged 13 commits intomicrosoft:mainfrom
StephanTLavavej:appendectomy

Conversation

@StephanTLavavej
Copy link
Copy Markdown
Member

As I mentioned in #6187, we don't need most of our _CRT_APP guards anymore. @amyw-msft explained:

All the banned API restrictions were lifted back in 2020, and all the devices/OS versions that would have had a runtime issue with using a desktop-only API have been out of support for a long time now. Shouldn't be any issue with this. [...] there are still APIs that are banned in the sense that you can't use the user32 UI stuff in a UWP sandbox. It's the deployment time blocks that historically prevented common Win32 API use in Store apps (and forced us to create the uwp variants) that are gone.

I understand _ONECORE less, and I believe our codebase has been equally confused about the difference, but I believe that we can also remove most of those guards too. Since deployment time blocks are a thing of the past, I think we can rely on "if it builds, it's good". (My internal MSVC-PR-632910 merged on 2025-05-05 got our build using the WinSDK's mincore.lib for OneCore builds, instead of weird "mystery meat" libs, increasing my confidence that our builds are cromulent.)

Getting rid of these alternate codepaths increases maintainability (since we almost exclusively test desktop configurations). In a few cases they may even improve functionality (e.g. by preferentially using GetTempPath2W). I want to merge this at the beginning of the 14.52 cycle, so if we discover problems, we can easily revert part or all of these changes.

Commits

  • filesystem.cpp: Use CreateSymbolicLinkW.
  • filesystem.cpp: Use CreateHardLinkW.
  • filesystem.cpp: Use CreateDirectoryExW.
  • filesys.cpp: Use CreateSymbolicLinkW.
  • filesys.cpp: Use CreateHardLinkW.
  • filesys.cpp: Use _wgetcwd.
  • filesys.cpp: Use _wchdir.
  • winapisupp.cpp: Use CreateSymbolicLinkW.
  • taskscheduler.cpp: Use GetModuleHandleExW.
  • [OneCore] filesystem.cpp: Use AreFileApisANSI.
  • [OneCore] filesys.cpp: Use AreFileApisANSI.
  • [OneCore] filesystem.cpp: Use GetModuleHandleW to load GetTempPath2W.
  • [OneCore] winapisupp.cpp: Use GetModuleHandleW to load GetTempPath2W.

This has passed an internal build and stlimport test pass.

@StephanTLavavej StephanTLavavej requested a review from a team as a code owner March 29, 2026 17:50
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Mar 29, 2026
@github-project-automation github-project-automation Bot moved this to Initial Review in STL Code Reviews Mar 29, 2026
@StephanTLavavej StephanTLavavej moved this from Initial Review to Final Review in STL Code Reviews Mar 29, 2026
@StephanTLavavej StephanTLavavej moved this from Final Review to Ready To Merge in STL Code Reviews Mar 31, 2026
@StephanTLavavej
Copy link
Copy Markdown
Member Author

I'm mirroring this to the MSVC-internal repo. Please notify me if any further changes are pushed, otherwise no action is required.

@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Merging in STL Code Reviews Apr 1, 2026
@StephanTLavavej StephanTLavavej merged commit acde038 into microsoft:main Apr 2, 2026
49 checks passed
@github-project-automation github-project-automation Bot moved this from Merging to Done in STL Code Reviews Apr 2, 2026
@StephanTLavavej StephanTLavavej deleted the appendectomy branch April 2, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants