src/os/windows/vm/jvm_windows.h

Fri, 15 Apr 2011 09:34:43 -0400

author
zgu
date
Fri, 15 Apr 2011 09:34:43 -0400
changeset 3031
b1cbb0907b36
parent 2314
f95d63e2154a
child 3344
11c26bfcf8c7
permissions
-rw-r--r--

7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
Summary: Created Windows Dll wrapped to handle jdk6 and jdk7 platform requirements, also provided more restictive Dll search orders for Windows system Dlls.
Reviewed-by: acorn, dcubed, ohair, alanb

duke@435 1 /*
stefank@2314 2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 #ifndef _JAVASOFT_JVM_MD_H_
duke@435 26 #define _JAVASOFT_JVM_MD_H_
duke@435 27
duke@435 28 /*
duke@435 29 * This file is currently collecting system-specific dregs for the
duke@435 30 * JNI conversion, which should be sorted out later.
duke@435 31 */
duke@435 32
zgu@3031 33 // JDK7 requires VS2010
zgu@3031 34 #if _MSC_VER >= 1600
zgu@3031 35 // JDK7 minimum platform requirement: Windows XP
zgu@3031 36 #if _WIN32_WINNT < 0x0501
zgu@3031 37 #undef _WIN32_WINNT
zgu@3031 38 #define _WIN32_WINNT 0x0501
zgu@3031 39 #endif
zgu@3031 40 #endif
zgu@3031 41
duke@435 42 #include <windows.h>
duke@435 43
zgu@3031 44 #if _MSC_VER <= 1200
zgu@3031 45 // Psapi.h doesn't come with Visual Studio 6; it can be downloaded as Platform
zgu@3031 46 // SDK from Microsoft. Here are the definitions copied from Psapi.h
zgu@3031 47 typedef struct _MODULEINFO {
zgu@3031 48 LPVOID lpBaseOfDll;
zgu@3031 49 DWORD SizeOfImage;
zgu@3031 50 LPVOID EntryPoint;
zgu@3031 51 } MODULEINFO, *LPMODULEINFO;
zgu@3031 52
zgu@3031 53 #else
zgu@3031 54 #include <Psapi.h>
zgu@3031 55 #endif
zgu@3031 56
zgu@3031 57
zgu@3031 58
zgu@3031 59 #include <Tlhelp32.h>
duke@435 60
duke@435 61 // #include "jni.h"
duke@435 62
duke@435 63 #define JNI_ONLOAD_SYMBOLS {"_JNI_OnLoad@8", "JNI_OnLoad"}
duke@435 64 #define JNI_ONUNLOAD_SYMBOLS {"_JNI_OnUnload@8", "JNI_OnUnload"}
duke@435 65 #define JVM_ONLOAD_SYMBOLS {"_JVM_OnLoad@12", "JVM_OnLoad"}
duke@435 66 #define AGENT_ONLOAD_SYMBOLS {"_Agent_OnLoad@12", "Agent_OnLoad"}
duke@435 67 #define AGENT_ONUNLOAD_SYMBOLS {"_Agent_OnUnload@4", "Agent_OnUnload"}
duke@435 68 #define AGENT_ONATTACH_SYMBOLS {"_Agent_OnAttach@12", "Agent_OnAttach"}
duke@435 69
duke@435 70 #define JNI_LIB_PREFIX ""
duke@435 71 #define JNI_LIB_SUFFIX ".dll"
duke@435 72
duke@435 73 struct dirent {
duke@435 74 char d_name[MAX_PATH];
duke@435 75 };
duke@435 76
duke@435 77 typedef struct {
duke@435 78 struct dirent dirent;
duke@435 79 char *path;
duke@435 80 HANDLE handle;
duke@435 81 WIN32_FIND_DATA find_data;
duke@435 82 } DIR;
duke@435 83
duke@435 84 #include <stdlib.h>
duke@435 85
duke@435 86 #define JVM_MAXPATHLEN _MAX_PATH
duke@435 87
duke@435 88 #define JVM_R_OK 4
duke@435 89 #define JVM_W_OK 2
duke@435 90 #define JVM_X_OK 1
duke@435 91 #define JVM_F_OK 0
duke@435 92
duke@435 93 #ifdef __cplusplus
duke@435 94 extern "C" {
duke@435 95 #endif
duke@435 96
duke@435 97 JNIEXPORT void * JNICALL
duke@435 98 JVM_GetThreadInterruptEvent();
duke@435 99
duke@435 100 #ifdef __cplusplus
duke@435 101 } /* extern "C" */
duke@435 102 #endif /* __cplusplus */
duke@435 103
duke@435 104 /*
duke@435 105 * File I/O
duke@435 106 */
duke@435 107
duke@435 108 // #include <sys/types.h>
duke@435 109 // #include <sys/stat.h>
duke@435 110 // #include <fcntl.h>
duke@435 111 // #include <errno.h>
duke@435 112
duke@435 113 /* O Flags */
duke@435 114
duke@435 115 #define JVM_O_RDONLY O_RDONLY
duke@435 116 #define JVM_O_WRONLY O_WRONLY
duke@435 117 #define JVM_O_RDWR O_RDWR
duke@435 118 #define JVM_O_O_APPEND O_APPEND
duke@435 119 #define JVM_O_EXCL O_EXCL
duke@435 120 #define JVM_O_CREAT O_CREAT
duke@435 121 #define JVM_O_DELETE O_TEMPORARY
duke@435 122
duke@435 123 /* Signals */
duke@435 124
duke@435 125 #define JVM_SIGINT SIGINT
duke@435 126 #define JVM_SIGTERM SIGTERM
duke@435 127
duke@435 128 #define SHUTDOWN1_SIGNAL SIGINT /* Shutdown Hooks support. */
duke@435 129 #define SHUTDOWN2_SIGNAL SIGTERM
duke@435 130
duke@435 131 #endif /* !_JAVASOFT_JVM_MD_H_ */

mercurial