You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2006/05/23 11:49:32 UTC
svn commit: r408861 - /tomcat/connectors/trunk/jni/native/os/win32/system.c
Author: mturk
Date: Tue May 23 02:49:31 2006
New Revision: 408861
URL: http://svn.apache.org/viewvc?rev=408861&view=rev
Log:
When compiling for post XPsp1 target do not use
deprecated NtQuerySystemInformation function.
Modified:
tomcat/connectors/trunk/jni/native/os/win32/system.c
Modified: tomcat/connectors/trunk/jni/native/os/win32/system.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/native/os/win32/system.c?rev=408861&r1=408860&r2=408861&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/native/os/win32/system.c (original)
+++ tomcat/connectors/trunk/jni/native/os/win32/system.c Tue May 23 02:49:31 2006
@@ -36,7 +36,9 @@
#pragma warning(push)
#pragma warning(disable : 4201)
+#if (_WIN32_WINNT < 0x0502)
#include <winternl.h>
+#endif
#include <psapi.h>
#pragma warning(pop)
@@ -49,10 +51,11 @@
static char dll_file_name[MAX_PATH];
typedef BOOL (WINAPI *pfnGetSystemTimes)(LPFILETIME, LPFILETIME, LPFILETIME);
-typedef NTSTATUS (WINAPI *pfnNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
-
static pfnGetSystemTimes fnGetSystemTimes = NULL;
+#if (_WIN32_WINNT < 0x0502)
+typedef NTSTATUS (WINAPI *pfnNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
static pfnNtQuerySystemInformation fnNtQuerySystemInformation = NULL;
+#endif
BOOL
WINAPI
@@ -76,6 +79,7 @@
if (fnGetSystemTimes == NULL) {
FreeLibrary(h_kernel);
h_kernel = NULL;
+#if (_WIN32_WINNT < 0x0502)
if ((h_ntdll = LoadLibrary("ntdll.dll")) != NULL)
fnNtQuerySystemInformation =
(pfnNtQuerySystemInformation)GetProcAddress(h_ntdll,
@@ -85,6 +89,7 @@
FreeLibrary(h_ntdll);
h_ntdll = NULL;
}
+#endif
}
GetModuleFileName(instance, dll_file_name, sizeof(dll_file_name));
break;
@@ -317,6 +322,7 @@
else
goto cleanup;
}
+#if (_WIN32_WINNT < 0x0502)
else if (fnNtQuerySystemInformation) {
BYTE buf[2048]; /* This should ne enough for 32 processors */
NTSTATUS rs = (*fnNtQuerySystemInformation)(SystemProcessorPerformanceInformation,
@@ -334,6 +340,7 @@
else
goto cleanup;
}
+#endif
pvals[7] = st[0];
pvals[8] = st[1];
pvals[9] = st[2];
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org