hotspot/src/os/windows/vm/os_windows.hpp
changeset 10246 adee0cf4c981
parent 8119 81eef1b06988
child 10494 3f347ed8bd3c
--- a/hotspot/src/os/windows/vm/os_windows.hpp	Sat Jul 23 10:42:20 2011 -0400
+++ b/hotspot/src/os/windows/vm/os_windows.hpp	Fri Apr 15 09:34:43 2011 -0400
@@ -24,7 +24,6 @@
 
 #ifndef OS_WINDOWS_VM_OS_WINDOWS_HPP
 #define OS_WINDOWS_VM_OS_WINDOWS_HPP
-
 // Win32_OS defines the interface to windows operating systems
 
 class win32 {
@@ -55,6 +54,9 @@
   static julong available_memory();
   static julong physical_memory() { return _physical_memory; }
 
+  // load dll from Windows system directory or Windows directory
+  static HINSTANCE load_Windows_dll(const char* name, char *ebuf, int ebuflen);
+
  public:
   // Generic interface:
 
@@ -132,4 +134,100 @@
 
 } ;
 
+// JDK7 requires VS2010
+#if _MSC_VER < 1600
+#define JDK6_OR_EARLIER 1
+#endif
+
+
+
+class WinSock2Dll: AllStatic {
+public:
+  static BOOL WSAStartup(WORD, LPWSADATA);
+  static struct hostent* gethostbyname(const char *name);
+  static BOOL WinSock2Available();
+#ifdef JDK6_OR_EARLIER
+private:
+  static int (PASCAL FAR* _WSAStartup)(WORD, LPWSADATA);
+  static struct hostent *(PASCAL FAR *_gethostbyname)(...);
+  static BOOL initialized;
+
+  static void initialize();
+#endif
+};
+
+class Kernel32Dll: AllStatic {
+public:
+  static BOOL SwitchToThread();
+  static SIZE_T GetLargePageMinimum();
+
+  static BOOL SwitchToThreadAvailable();
+  static BOOL GetLargePageMinimumAvailable();
+
+  // Help tools
+  static BOOL HelpToolsAvailable();
+  static HANDLE CreateToolhelp32Snapshot(DWORD,DWORD);
+  static BOOL Module32First(HANDLE,LPMODULEENTRY32);
+  static BOOL Module32Next(HANDLE,LPMODULEENTRY32);
+
+  static BOOL GetNativeSystemInfoAvailable();
+  static void GetNativeSystemInfo(LPSYSTEM_INFO);
+
+private:
+  // GetLargePageMinimum available on Windows Vista/Windows Server 2003
+  // and later
+  static SIZE_T (WINAPI *_GetLargePageMinimum)(void);
+  static BOOL initialized;
+
+  static void initialize();
+
+#ifdef JDK6_OR_EARLIER
+private:
+  static BOOL (WINAPI *_SwitchToThread)(void);
+  static HANDLE (WINAPI* _CreateToolhelp32Snapshot)(DWORD,DWORD);
+  static BOOL (WINAPI* _Module32First)(HANDLE,LPMODULEENTRY32);
+  static BOOL (WINAPI* _Module32Next)(HANDLE,LPMODULEENTRY32);
+  static void (WINAPI *_GetNativeSystemInfo)(LPSYSTEM_INFO);
+#endif
+
+};
+
+class Advapi32Dll: AllStatic {
+public:
+  static BOOL AdjustTokenPrivileges(HANDLE, BOOL, PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD);
+  static BOOL OpenProcessToken(HANDLE, DWORD, PHANDLE);
+  static BOOL LookupPrivilegeValue(LPCTSTR, LPCTSTR, PLUID);
+
+  static BOOL AdvapiAvailable();
+
+#ifdef JDK6_OR_EARLIER
+private:
+  static BOOL (WINAPI *_AdjustTokenPrivileges)(HANDLE, BOOL, PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD);
+  static BOOL (WINAPI *_OpenProcessToken)(HANDLE, DWORD, PHANDLE);
+  static BOOL (WINAPI *_LookupPrivilegeValue)(LPCTSTR, LPCTSTR, PLUID);
+  static BOOL initialized;
+
+  static void initialize();
+#endif
+};
+
+class PSApiDll: AllStatic {
+public:
+  static BOOL EnumProcessModules(HANDLE, HMODULE *, DWORD, LPDWORD);
+  static DWORD GetModuleFileNameEx(HANDLE, HMODULE, LPTSTR, DWORD);
+  static BOOL GetModuleInformation(HANDLE, HMODULE, LPMODULEINFO, DWORD);
+
+  static BOOL PSApiAvailable();
+
+#ifdef JDK6_OR_EARLIER
+private:
+  static BOOL (WINAPI *_EnumProcessModules)(HANDLE, HMODULE *, DWORD, LPDWORD);
+  static BOOL (WINAPI *_GetModuleFileNameEx)(HANDLE, HMODULE, LPTSTR, DWORD);;
+  static BOOL (WINAPI *_GetModuleInformation)(HANDLE, HMODULE, LPMODULEINFO, DWORD);
+  static BOOL initialized;
+
+  static void initialize();
+#endif
+};
+
 #endif // OS_WINDOWS_VM_OS_WINDOWS_HPP