summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorNeeraj Singh <neerajsi@microsoft.com>2022-03-10 22:43:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-03-10 23:10:22 (GMT)
commit19d3f228c8df7e946278c96fb52acf1cea0f6a7a (patch)
tree2a4ff4edc2d7862dcd7c363f82adaf1e1bc3fc76 /compat
parentc2162907e9aa884bdb70208389cb99b181620d51 (diff)
downloadgit-19d3f228c8df7e946278c96fb52acf1cea0f6a7a.zip
git-19d3f228c8df7e946278c96fb52acf1cea0f6a7a.tar.gz
git-19d3f228c8df7e946278c96fb52acf1cea0f6a7a.tar.bz2
wrapper: make inclusion of Windows csprng header tightly scoped
Including NTSecAPI.h in git-compat-util.h causes build errors in any other file that includes winternl.h. NTSecAPI.h was included in order to get access to the RtlGenRandom cryptographically secure PRNG. This change scopes the inclusion of ntsecapi.h to wrapper.c, which is the only place that it's actually needed. The build breakage is due to the definition of UNICODE_STRING in NtSecApi.h: #ifndef _NTDEF_ typedef LSA_UNICODE_STRING UNICODE_STRING, *PUNICODE_STRING; typedef LSA_STRING STRING, *PSTRING ; #endif LsaLookup.h: typedef struct _LSA_UNICODE_STRING { USHORT Length; USHORT MaximumLength; #ifdef MIDL_PASS [size_is(MaximumLength/2), length_is(Length/2)] #endif // MIDL_PASS PWSTR Buffer; } LSA_UNICODE_STRING, *PLSA_UNICODE_STRING; winternl.h also defines UNICODE_STRING: typedef struct _UNICODE_STRING { USHORT Length; USHORT MaximumLength; PWSTR Buffer; } UNICODE_STRING; typedef UNICODE_STRING *PUNICODE_STRING; Both definitions have equivalent layouts. Apparently these internal Windows headers aren't designed to be included together. This is an oversight in the headers and does not represent an incompatibility between the APIs. Signed-off-by: Neeraj Singh <neerajsi@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
-rw-r--r--compat/winansi.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/compat/winansi.c b/compat/winansi.c
index 936a80a..3abe8dd 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -4,11 +4,6 @@
#undef NOGDI
-/*
- * Including the appropriate header file for RtlGenRandom causes MSVC to see a
- * redefinition of types in an incompatible way when including headers below.
- */
-#undef HAVE_RTLGENRANDOM
#include "../git-compat-util.h"
#include <wingdi.h>
#include <winreg.h>