[PR #14822] [MERGED] Consolidate NTSTATUS and remove INLINE_NSTATUS_FROM_WIN32 #30264

Open
opened 2026-01-31 09:39:40 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/14822
Author: @DHowett
Created: 2/10/2023
Status: Merged
Merged: 2/14/2023
Merged by: @DHowett

Base: mainHead: dev/duhowett/remove-nonstandard-ntstatus-macros


📝 Commits (10+)

  • 023eb0b S_OK is not an NTSTATUS
  • a693883 VERIFY_SUCCESS_NTSTATUS (ours) -> VERIFY_NT_SUCCESS (WEX)
  • bee4881 VERIFY_IS_TRUE(NT_SUCCESS()) -> VERIFY_NT_SUCCESS()
  • 5b76f4e NT_SUCCESS (ours) -> SUCCEEDED_NTSTATUS (wil)
  • 88f1318 Remove all unsafe uses of NTSTATUS_FROM_WIN32 (double-evaluation)
  • 551d210 Remove INLINE_NTSTATUS_FROM_WIN32 and all custom NTSTATUS
  • 97898b1 Make it compile now, too!
  • 39285c6 oh no, do we have another file i copied this from with no formatting
  • da020b3 Fix audit mode errors (thanks!)
  • 4c556f3 Replace !SUCCEEDED_NTSTATUS with FAILED_NTSTATUS

📊 Changes

60 files changed (+361 additions, -545 deletions)

View changed files

📝 src/cascadia/TerminalAzBridge/pch.h (+0 -2)
📝 src/cascadia/UnitTests_TerminalCore/ConptyRoundtripTests.cpp (+9 -9)
📝 src/cascadia/UnitTests_TerminalCore/pch.h (+19 -7)
📝 src/cascadia/WindowsTerminal/pch.h (+0 -2)
📝 src/host/CommandListPopup.cpp (+1 -1)
📝 src/host/CommandNumberPopup.cpp (+1 -1)
📝 src/host/CopyFromCharPopup.cpp (+1 -1)
📝 src/host/CopyToCharPopup.cpp (+1 -1)
📝 src/host/_stream.cpp (+4 -4)
📝 src/host/conddkrefs.h (+2 -99)
📝 src/host/conserv.h (+0 -1)
📝 src/host/consoleInformation.cpp (+2 -2)
📝 src/host/directio.cpp (+4 -4)
📝 src/host/exe/exemain.cpp (+2 -2)
📝 src/host/input.cpp (+1 -1)
📝 src/host/ntprivapi.cpp (+19 -5)
📝 src/host/ntprivapi.hpp (+1 -25)
📝 src/host/output.cpp (+1 -1)
📝 src/host/popup.cpp (+1 -1)
📝 src/host/precomp.h (+1 -1)

...and 40 more files

📄 Description

This PR makes the following project-wide changes/replacements as a first step in
cleaning up our use of NTSTATUS.

  • Rewriting any uses of NTSTATUS_FROM_WIN32 that were vulnerable to multiple evaluation bugs
    • This is required because the macro version of NTSTATUS_FROM_WIN32 evaluates its argument twice
  • Removing all our local redefinitions of NTSTATUS in favor of that of winternl.h
    • Because of this, we got to (had to?) remove some old transclusions from conddkrefs.h
  • NT_SUCCESS (ours) -> SUCCEEDED_NTSTATUS (wil)
  • VERIFY_IS_TRUE(NT_SUCCESS()) (overly elaborate) -> VERIFY_NT_SUCCESS (WEX)
  • VERIFY_SUCCESS_NTSTATUS (ours) -> VERIFY_NT_SUCCESS (WEX)
  • One bad use of S_OK as an NTSTATUS -> STATUS_SUCCESS
  • Removing NTSTATUS from any projects that do not use it

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/14822 **Author:** [@DHowett](https://github.com/DHowett) **Created:** 2/10/2023 **Status:** ✅ Merged **Merged:** 2/14/2023 **Merged by:** [@DHowett](https://github.com/DHowett) **Base:** `main` ← **Head:** `dev/duhowett/remove-nonstandard-ntstatus-macros` --- ### 📝 Commits (10+) - [`023eb0b`](https://github.com/microsoft/terminal/commit/023eb0be7e717fc9756525b5ed3934b477d93212) S_OK is not an NTSTATUS - [`a693883`](https://github.com/microsoft/terminal/commit/a693883815a6cb402008c46d8eb633401b35d9fa) VERIFY_SUCCESS_NTSTATUS (ours) -> VERIFY_NT_SUCCESS (WEX) - [`bee4881`](https://github.com/microsoft/terminal/commit/bee48815cac1f6891ca3ae4ae57dc75c86594b4e) VERIFY_IS_TRUE(NT_SUCCESS()) -> VERIFY_NT_SUCCESS() - [`5b76f4e`](https://github.com/microsoft/terminal/commit/5b76f4effb77bade02cfb60283fb615557766f3a) NT_SUCCESS (ours) -> SUCCEEDED_NTSTATUS (wil) - [`88f1318`](https://github.com/microsoft/terminal/commit/88f13186c594140fe206c17abc44ae4f24ee397b) Remove all unsafe uses of NTSTATUS_FROM_WIN32 (double-evaluation) - [`551d210`](https://github.com/microsoft/terminal/commit/551d2106ca86115e9937ea2ac2870c0a9c469bb8) Remove INLINE_NTSTATUS_FROM_WIN32 and all custom NTSTATUS - [`97898b1`](https://github.com/microsoft/terminal/commit/97898b17234515a91da8d6daf3d88b970d2d67a1) Make it compile now, too! - [`39285c6`](https://github.com/microsoft/terminal/commit/39285c6bd361f2424dd44b9b4b2a6a7c4a19d1ad) oh no, do we have another file i copied this from with no formatting - [`da020b3`](https://github.com/microsoft/terminal/commit/da020b3498009fb898e63d63977372ed0c5b0c11) Fix audit mode errors (thanks!) - [`4c556f3`](https://github.com/microsoft/terminal/commit/4c556f3f1ffc6223d011a8f423d711271bf5bf1c) Replace !SUCCEEDED_NTSTATUS with FAILED_NTSTATUS ### 📊 Changes **60 files changed** (+361 additions, -545 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalAzBridge/pch.h` (+0 -2) 📝 `src/cascadia/UnitTests_TerminalCore/ConptyRoundtripTests.cpp` (+9 -9) 📝 `src/cascadia/UnitTests_TerminalCore/pch.h` (+19 -7) 📝 `src/cascadia/WindowsTerminal/pch.h` (+0 -2) 📝 `src/host/CommandListPopup.cpp` (+1 -1) 📝 `src/host/CommandNumberPopup.cpp` (+1 -1) 📝 `src/host/CopyFromCharPopup.cpp` (+1 -1) 📝 `src/host/CopyToCharPopup.cpp` (+1 -1) 📝 `src/host/_stream.cpp` (+4 -4) 📝 `src/host/conddkrefs.h` (+2 -99) 📝 `src/host/conserv.h` (+0 -1) 📝 `src/host/consoleInformation.cpp` (+2 -2) 📝 `src/host/directio.cpp` (+4 -4) 📝 `src/host/exe/exemain.cpp` (+2 -2) 📝 `src/host/input.cpp` (+1 -1) 📝 `src/host/ntprivapi.cpp` (+19 -5) 📝 `src/host/ntprivapi.hpp` (+1 -25) 📝 `src/host/output.cpp` (+1 -1) 📝 `src/host/popup.cpp` (+1 -1) 📝 `src/host/precomp.h` (+1 -1) _...and 40 more files_ </details> ### 📄 Description This PR makes the following project-wide changes/replacements as a first step in cleaning up our use of `NTSTATUS`. * Rewriting any uses of `NTSTATUS_FROM_WIN32` that were vulnerable to multiple evaluation bugs * This is required because the macro version of `NTSTATUS_FROM_WIN32` evaluates its argument twice * Removing all our local redefinitions of `NTSTATUS` in favor of that of `winternl.h` * Because of this, we got to (had to?) remove some old transclusions from `conddkrefs.h` * `NT_SUCCESS` (ours) -> `SUCCEEDED_NTSTATUS` (wil) * `VERIFY_IS_TRUE(NT_SUCCESS())` (overly elaborate) -> `VERIFY_NT_SUCCESS` (WEX) * `VERIFY_SUCCESS_NTSTATUS` (ours) -> `VERIFY_NT_SUCCESS` (WEX) * One bad use of S_OK as an NTSTATUS -> `STATUS_SUCCESS` * Removing `NTSTATUS` from any projects that do not use it --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:39:40 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30264