Skip to content

Fix missing header for UWP build - #1348

Closed
thexai wants to merge 1 commit into
microsoft:devfrom
thexai:uwp-2
Closed

Fix missing header for UWP build#1348
thexai wants to merge 1 commit into
microsoft:devfrom
thexai:uwp-2

Conversation

@thexai

@thexai thexai commented Aug 1, 2026

Copy link
Copy Markdown

Follow-up of #1340

This header is necessary to build for UWP because NTSTATUS is not defined in <winternl.h> (for WINAPI_PARTITION_APP).

Not noticed before because in my private UWP patch Bcrypt is not dynamically loaded and bcrypt.h was already present.

I have now tested this exact PR and Bcrypt works with dynamic loading on UWP.

Header is need only for NTSTATUS definition.

@daanx

daanx commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Darn -- just too late for v3.4.4 but it'll be in the next one :-) It is strange to include bcrypt.h just for NTSTATUS -- what would be the official header to include for universal apps?

@thexai

thexai commented Aug 1, 2026

Copy link
Copy Markdown
Author

I think NTSTATUS is not defined in any official header for universal apps directly but since BCryptGenRandom uses it and is compatible with UWP Apps (https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom), is defined also in bcrypt.h (only for this).

After all, since mimalloc uses BCryptGenRandom is not bad idea include the header for Windows.

@daanx

daanx commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Ah I see; let me think a bit on this as mimalloc is still used on older platforms and we need to make sure bcrypt.h is available there. Maybe we should just define NTSTATUS if it isn't defined yet.

@thexai

thexai commented Aug 1, 2026

Copy link
Copy Markdown
Author

Maybe we should just define NTSTATUS if it isn't defined yet.

This is an alternative, but it should work from Windows Vista onwards...

@thexai

thexai commented Aug 1, 2026

Copy link
Copy Markdown
Author

Oh! seems this is already fixed in dev branch:

typedef LONG (__stdcall *PNtAllocateVirtualMemoryEx)(HANDLE, PVOID*, SIZE_T*, ULONG, ULONG, MI_MEM_EXTENDED_PARAMETER*, ULONG); // avoid NTSTATUS as it is not defined on xbox (pr #1084)

So this PR isn't needed here.

@thexai thexai closed this Aug 1, 2026
Sign up for free to 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