6

The Windows CNG Cryptographic Primitive Functions have return values of type NTSTATUS. Several possible (symbolic) return values are mentioned, for example STATUS_AUTH_TAG_MISMATCH for the BCryptDecrypt function.

These symbols are not defined in bcrypt.h, nor in any other header file mentioned in the documentation. I can not use them in my code because they can not be resolved. Where are they located?

Reinier Torenbeek
  • 16,669
  • 7
  • 46
  • 69
  • Also see [Compile errors when using C++ and bcrypt header](https://stackoverflow.com/q/57472787/608639). Apparently Microsoft forgt to include their own `` header in ``. Microsoft screwed this up badly. – jww Aug 19 '19 at 10:16

1 Answers1

7

They are defined in:

ntstatus.h
Fiddling Bits
  • 8,712
  • 3
  • 28
  • 46
  • Thanks, got it. When I include that file, I get lots of warnings though, like `warning C4005: 'STATUS_WAIT_0' : macro redefinition`. The previous definition is in `winnt.h`, which gets included from `windows.h`. Am I supposed/allowed at all to include `ntstatus.h` directly? – Reinier Torenbeek Jun 09 '15 at 02:10
  • 5
    I found the answer to my comment [here](http://www.mschaef.com/blog/tech/win32/windows_h_is_wierd.html), had to add `#define WIN32_NO_STATUS` and `#undef WIN32_NO_STATUS` around the `#include windows.h`. Maybe you can add that to your answer. – Reinier Torenbeek Jun 09 '15 at 02:24
  • But not for some platforms; see [What header to include for an NTSTATUS when building for ARM platforms?](http://stackoverflow.com/q/36963346) – jww May 02 '16 at 00:13