Windows, JNI library: fix with WIN32_LEAN_AND_MEAN
Bazel's JNI library can now be compiled with
`--copt=-DWIN32_LEAN_AND_MEAN`.
Closes #7695.
PiperOrigin-RevId: 238003483
diff --git a/src/main/native/windows/file-jni.cc b/src/main/native/windows/file-jni.cc
index 99b95d8..09934ec 100644
--- a/src/main/native/windows/file-jni.cc
+++ b/src/main/native/windows/file-jni.cc
@@ -12,7 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
diff --git a/src/main/native/windows/file.cc b/src/main/native/windows/file.cc
index c0d41a3..efe99c9 100644
--- a/src/main/native/windows/file.cc
+++ b/src/main/native/windows/file.cc
@@ -12,8 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include <stdint.h> // uint8_t
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+
#include <windows.h>
+#include <WinIoCtl.h>
+
+#include <stdint.h> // uint8_t
#include <memory>
#include <sstream>
diff --git a/src/main/native/windows/jni-util.cc b/src/main/native/windows/jni-util.cc
index a60fc49..85aaaef 100644
--- a/src/main/native/windows/jni-util.cc
+++ b/src/main/native/windows/jni-util.cc
@@ -12,7 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
+
#include <windows.h>
#include <algorithm>
diff --git a/src/main/native/windows/processes-jni.cc b/src/main/native/windows/processes-jni.cc
index 045bd02..281fc85 100644
--- a/src/main/native/windows/processes-jni.cc
+++ b/src/main/native/windows/processes-jni.cc
@@ -12,7 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
#include <wchar.h>
#include <windows.h>