author | ctornqvi |
Mon, 03 Nov 2014 11:34:13 -0800 | |
changeset 27467 | cdc1d5bc86cf |
parent 26682 | f339669ba825 |
child 30143 | 7e99f2b4bae5 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
22891
1f5d1fff23fa
6546236: Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler
fparain
parents:
18943
diff
changeset
|
2 |
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1623
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1623
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1623
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef OS_WINDOWS_VM_OS_WINDOWS_HPP |
26 |
#define OS_WINDOWS_VM_OS_WINDOWS_HPP |
|
1 | 27 |
// Win32_OS defines the interface to windows operating systems |
28 |
||
22852
1063026e8cee
8028471: PPC64 (part 215): opto: Extend ImplicitNullCheck optimization.
goetz
parents:
18943
diff
changeset
|
29 |
// Information about the protection of the page at address '0' on this os. |
1063026e8cee
8028471: PPC64 (part 215): opto: Extend ImplicitNullCheck optimization.
goetz
parents:
18943
diff
changeset
|
30 |
static bool zero_page_read_protected() { return true; } |
1063026e8cee
8028471: PPC64 (part 215): opto: Extend ImplicitNullCheck optimization.
goetz
parents:
18943
diff
changeset
|
31 |
|
25468
5331df506290
8048241: Introduce umbrella header os.inline.hpp and clean up includes
goetz
parents:
23527
diff
changeset
|
32 |
// File conventions |
5331df506290
8048241: Introduce umbrella header os.inline.hpp and clean up includes
goetz
parents:
23527
diff
changeset
|
33 |
static const char* file_separator() { return "\\"; } |
5331df506290
8048241: Introduce umbrella header os.inline.hpp and clean up includes
goetz
parents:
23527
diff
changeset
|
34 |
static const char* line_separator() { return "\r\n"; } |
5331df506290
8048241: Introduce umbrella header os.inline.hpp and clean up includes
goetz
parents:
23527
diff
changeset
|
35 |
static const char* path_separator() { return ";"; } |
5331df506290
8048241: Introduce umbrella header os.inline.hpp and clean up includes
goetz
parents:
23527
diff
changeset
|
36 |
|
1 | 37 |
class win32 { |
12735
3e2e491f4f69
7165755: OS Information much longer on linux than other platforms
nloodin
parents:
10494
diff
changeset
|
38 |
friend class os; |
26682
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
39 |
friend unsigned __stdcall java_start(class Thread*); |
1 | 40 |
|
41 |
protected: |
|
42 |
static int _vm_page_size; |
|
43 |
static int _vm_allocation_granularity; |
|
44 |
static int _processor_type; |
|
45 |
static int _processor_level; |
|
46 |
static julong _physical_memory; |
|
47 |
static size_t _default_stack_size; |
|
48 |
static bool _is_nt; |
|
1421
a7ef1a3b2644
6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents:
1
diff
changeset
|
49 |
static bool _is_windows_2003; |
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
7397
diff
changeset
|
50 |
static bool _is_windows_server; |
26682
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
51 |
static bool _has_exit_bug; |
22891
1f5d1fff23fa
6546236: Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler
fparain
parents:
18943
diff
changeset
|
52 |
static bool _has_performance_count; |
1 | 53 |
|
12735
3e2e491f4f69
7165755: OS Information much longer on linux than other platforms
nloodin
parents:
10494
diff
changeset
|
54 |
static void print_windows_version(outputStream* st); |
3e2e491f4f69
7165755: OS Information much longer on linux than other platforms
nloodin
parents:
10494
diff
changeset
|
55 |
|
1 | 56 |
public: |
57 |
// Windows-specific interface: |
|
58 |
static void initialize_system_info(); |
|
59 |
static void setmode_streams(); |
|
60 |
||
61 |
// Processor info as provided by NT |
|
62 |
static int processor_type() { return _processor_type; } |
|
63 |
// Processor level may not be accurate on non-NT systems |
|
64 |
static int processor_level() { |
|
65 |
assert(is_nt(), "use vm_version instead"); |
|
66 |
return _processor_level; |
|
67 |
} |
|
68 |
static julong available_memory(); |
|
69 |
static julong physical_memory() { return _physical_memory; } |
|
70 |
||
10246
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
71 |
// load dll from Windows system directory or Windows directory |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
72 |
static HINSTANCE load_Windows_dll(const char* name, char *ebuf, int ebuflen); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
73 |
|
26682
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
74 |
private: |
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
75 |
enum Ept { EPT_THREAD, EPT_PROCESS, EPT_PROCESS_DIE }; |
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
76 |
// Wrapper around _endthreadex(), exit() and _exit() |
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
77 |
static int exit_process_or_thread(Ept what, int exit_code); |
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
78 |
|
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
79 |
static void initialize_performance_counter(); |
22891
1f5d1fff23fa
6546236: Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler
fparain
parents:
18943
diff
changeset
|
80 |
|
1 | 81 |
public: |
82 |
// Generic interface: |
|
83 |
||
84 |
// Trace number of created threads |
|
85 |
static intx _os_thread_limit; |
|
86 |
static volatile intx _os_thread_count; |
|
87 |
||
88 |
// Tells whether the platform is NT or Windown95 |
|
89 |
static bool is_nt() { return _is_nt; } |
|
90 |
||
8119
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
7397
diff
changeset
|
91 |
// Tells whether this is a server version of Windows |
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
7397
diff
changeset
|
92 |
static bool is_windows_server() { return _is_windows_server; } |
81eef1b06988
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
7397
diff
changeset
|
93 |
|
1421
a7ef1a3b2644
6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents:
1
diff
changeset
|
94 |
// Tells whether the platform is Windows 2003 |
a7ef1a3b2644
6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents:
1
diff
changeset
|
95 |
static bool is_windows_2003() { return _is_windows_2003; } |
a7ef1a3b2644
6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents:
1
diff
changeset
|
96 |
|
26682
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
97 |
// Tells whether there can be the race bug during process exit on this platform |
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
98 |
static bool has_exit_bug() { return _has_exit_bug; } |
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
99 |
|
1 | 100 |
// Returns the byte size of a virtual memory page |
101 |
static int vm_page_size() { return _vm_page_size; } |
|
102 |
||
103 |
// Returns the size in bytes of memory blocks which can be allocated. |
|
104 |
static int vm_allocation_granularity() { return _vm_allocation_granularity; } |
|
105 |
||
106 |
// Read the headers for the executable that started the current process into |
|
107 |
// the structure passed in (see winnt.h). |
|
108 |
static void read_executable_headers(PIMAGE_NT_HEADERS); |
|
109 |
||
110 |
// Default stack size for the current process. |
|
111 |
static size_t default_stack_size() { return _default_stack_size; } |
|
112 |
||
113 |
#ifndef _WIN64 |
|
114 |
// A wrapper to install a structured exception handler for fast JNI accesors. |
|
115 |
static address fast_jni_accessor_wrapper(BasicType); |
|
116 |
#endif |
|
117 |
||
18683
a6418e038255
8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents:
13963
diff
changeset
|
118 |
static void call_test_func_with_wrapper(void (*funcPtr)(void)); |
a6418e038255
8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents:
13963
diff
changeset
|
119 |
|
1 | 120 |
// filter function to ignore faults on serializations page |
121 |
static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e); |
|
122 |
}; |
|
123 |
||
18943 | 124 |
/* |
125 |
* Crash protection for the watcher thread. Wrap the callback |
|
126 |
* with a __try { call() } |
|
127 |
* To be able to use this - don't take locks, don't rely on destructors, |
|
128 |
* don't make OS library calls, don't allocate memory, don't print, |
|
129 |
* don't call code that could leave the heap / memory in an inconsistent state, |
|
130 |
* or anything else where we are not in control if we suddenly jump out. |
|
131 |
*/ |
|
132 |
class WatcherThreadCrashProtection : public StackObj { |
|
133 |
public: |
|
134 |
WatcherThreadCrashProtection(); |
|
135 |
bool call(os::CrashProtectionCallback& cb); |
|
136 |
}; |
|
137 |
||
13195 | 138 |
class PlatformEvent : public CHeapObj<mtInternal> { |
1 | 139 |
private: |
140 |
double CachePad [4] ; // increase odds that _Event is sole occupant of cache line |
|
141 |
volatile int _Event ; |
|
142 |
HANDLE _ParkHandle ; |
|
143 |
||
144 |
public: // TODO-FIXME: make dtor private |
|
145 |
~PlatformEvent() { guarantee (0, "invariant") ; } |
|
146 |
||
147 |
public: |
|
148 |
PlatformEvent() { |
|
149 |
_Event = 0 ; |
|
150 |
_ParkHandle = CreateEvent (NULL, false, false, NULL) ; |
|
151 |
guarantee (_ParkHandle != NULL, "invariant") ; |
|
152 |
} |
|
153 |
||
154 |
// Exercise caution using reset() and fired() - they may require MEMBARs |
|
155 |
void reset() { _Event = 0 ; } |
|
156 |
int fired() { return _Event; } |
|
157 |
void park () ; |
|
158 |
void unpark () ; |
|
159 |
int park (jlong millis) ; |
|
160 |
} ; |
|
161 |
||
162 |
||
163 |
||
13195 | 164 |
class PlatformParker : public CHeapObj<mtInternal> { |
1 | 165 |
protected: |
166 |
HANDLE _ParkEvent ; |
|
167 |
||
168 |
public: |
|
169 |
~PlatformParker () { guarantee (0, "invariant") ; } |
|
170 |
PlatformParker () { |
|
171 |
_ParkEvent = CreateEvent (NULL, true, false, NULL) ; |
|
172 |
guarantee (_ParkEvent != NULL, "invariant") ; |
|
173 |
} |
|
174 |
||
175 |
} ; |
|
7397 | 176 |
|
10246
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
177 |
// JDK7 requires VS2010 |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
178 |
#if _MSC_VER < 1600 |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
179 |
#define JDK6_OR_EARLIER 1 |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
180 |
#endif |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
181 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
182 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
183 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
184 |
class WinSock2Dll: AllStatic { |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
185 |
public: |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
186 |
static BOOL WSAStartup(WORD, LPWSADATA); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
187 |
static struct hostent* gethostbyname(const char *name); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
188 |
static BOOL WinSock2Available(); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
189 |
#ifdef JDK6_OR_EARLIER |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
190 |
private: |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
191 |
static int (PASCAL FAR* _WSAStartup)(WORD, LPWSADATA); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
192 |
static struct hostent *(PASCAL FAR *_gethostbyname)(...); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
193 |
static BOOL initialized; |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
194 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
195 |
static void initialize(); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
196 |
#endif |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
197 |
}; |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
198 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
199 |
class Kernel32Dll: AllStatic { |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
200 |
public: |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
201 |
static BOOL SwitchToThread(); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
202 |
static SIZE_T GetLargePageMinimum(); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
203 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
204 |
static BOOL SwitchToThreadAvailable(); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
205 |
static BOOL GetLargePageMinimumAvailable(); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
206 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
207 |
// Help tools |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
208 |
static BOOL HelpToolsAvailable(); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
209 |
static HANDLE CreateToolhelp32Snapshot(DWORD,DWORD); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
210 |
static BOOL Module32First(HANDLE,LPMODULEENTRY32); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
211 |
static BOOL Module32Next(HANDLE,LPMODULEENTRY32); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
212 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
213 |
static void GetNativeSystemInfo(LPSYSTEM_INFO); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
214 |
|
10494 | 215 |
// NUMA calls |
216 |
static BOOL NumaCallsAvailable(); |
|
217 |
static LPVOID VirtualAllocExNuma(HANDLE, LPVOID, SIZE_T, DWORD, DWORD, DWORD); |
|
218 |
static BOOL GetNumaHighestNodeNumber(PULONG); |
|
219 |
static BOOL GetNumaNodeProcessorMask(UCHAR, PULONGLONG); |
|
220 |
||
13195 | 221 |
// Stack walking |
222 |
static USHORT RtlCaptureStackBackTrace(ULONG, ULONG, PVOID*, PULONG); |
|
223 |
||
10246
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
224 |
private: |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
225 |
// GetLargePageMinimum available on Windows Vista/Windows Server 2003 |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
226 |
// and later |
10494 | 227 |
// NUMA calls available Windows Vista/WS2008 and later |
228 |
||
10246
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
229 |
static SIZE_T (WINAPI *_GetLargePageMinimum)(void); |
10494 | 230 |
static LPVOID (WINAPI *_VirtualAllocExNuma) (HANDLE, LPVOID, SIZE_T, DWORD, DWORD, DWORD); |
231 |
static BOOL (WINAPI *_GetNumaHighestNodeNumber) (PULONG); |
|
232 |
static BOOL (WINAPI *_GetNumaNodeProcessorMask) (UCHAR, PULONGLONG); |
|
13195 | 233 |
static USHORT (WINAPI *_RtlCaptureStackBackTrace)(ULONG, ULONG, PVOID*, PULONG); |
10246
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
234 |
static BOOL initialized; |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
235 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
236 |
static void initialize(); |
10494 | 237 |
static void initializeCommon(); |
10246
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
238 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
239 |
#ifdef JDK6_OR_EARLIER |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
240 |
private: |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
241 |
static BOOL (WINAPI *_SwitchToThread)(void); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
242 |
static HANDLE (WINAPI* _CreateToolhelp32Snapshot)(DWORD,DWORD); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
243 |
static BOOL (WINAPI* _Module32First)(HANDLE,LPMODULEENTRY32); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
244 |
static BOOL (WINAPI* _Module32Next)(HANDLE,LPMODULEENTRY32); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
245 |
static void (WINAPI *_GetNativeSystemInfo)(LPSYSTEM_INFO); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
246 |
#endif |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
247 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
248 |
}; |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
249 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
250 |
class Advapi32Dll: AllStatic { |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
251 |
public: |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
252 |
static BOOL AdjustTokenPrivileges(HANDLE, BOOL, PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
253 |
static BOOL OpenProcessToken(HANDLE, DWORD, PHANDLE); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
254 |
static BOOL LookupPrivilegeValue(LPCTSTR, LPCTSTR, PLUID); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
255 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
256 |
static BOOL AdvapiAvailable(); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
257 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
258 |
#ifdef JDK6_OR_EARLIER |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
259 |
private: |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
260 |
static BOOL (WINAPI *_AdjustTokenPrivileges)(HANDLE, BOOL, PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
261 |
static BOOL (WINAPI *_OpenProcessToken)(HANDLE, DWORD, PHANDLE); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
262 |
static BOOL (WINAPI *_LookupPrivilegeValue)(LPCTSTR, LPCTSTR, PLUID); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
263 |
static BOOL initialized; |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
264 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
265 |
static void initialize(); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
266 |
#endif |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
267 |
}; |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
268 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
269 |
class PSApiDll: AllStatic { |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
270 |
public: |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
271 |
static BOOL EnumProcessModules(HANDLE, HMODULE *, DWORD, LPDWORD); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
272 |
static DWORD GetModuleFileNameEx(HANDLE, HMODULE, LPTSTR, DWORD); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
273 |
static BOOL GetModuleInformation(HANDLE, HMODULE, LPMODULEINFO, DWORD); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
274 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
275 |
static BOOL PSApiAvailable(); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
276 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
277 |
#ifdef JDK6_OR_EARLIER |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
278 |
private: |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
279 |
static BOOL (WINAPI *_EnumProcessModules)(HANDLE, HMODULE *, DWORD, LPDWORD); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
280 |
static BOOL (WINAPI *_GetModuleFileNameEx)(HANDLE, HMODULE, LPTSTR, DWORD);; |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
281 |
static BOOL (WINAPI *_GetModuleInformation)(HANDLE, HMODULE, LPMODULEINFO, DWORD); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
282 |
static BOOL initialized; |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
283 |
|
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
284 |
static void initialize(); |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
285 |
#endif |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
286 |
}; |
adee0cf4c981
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents:
8119
diff
changeset
|
287 |
|
7397 | 288 |
#endif // OS_WINDOWS_VM_OS_WINDOWS_HPP |