1 /* 2 * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. 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 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 # include "incls/_precompiled.incl" 26 # include "incls/_hpi_windows.cpp.incl" 27 28 typedef jint (JNICALL *init_t)(GetInterfaceFunc *, void *); 29 30 void hpi::initialize_get_interface(vm_calls_t *callbacks) 31 { 32 // Build name of HPI. 33 char lib_name[JVM_MAXPATHLEN]; 34 35 if (HPILibPath && HPILibPath[0]) { 36 strncpy(lib_name, HPILibPath, JVM_MAXPATHLEN - 1); 37 lib_name[JVM_MAXPATHLEN - 1] = '\0'; 38 } else { 39 os::jvm_path(lib_name, sizeof lib_name); 40 41 #ifdef PRODUCT 42 const char *hpi_lib = "\\hpi.dll"; 43 #else 44 char *ptr = strrchr(lib_name, '\\'); 45 // On Win98 GetModuleFileName() returns the path in the upper case. 46 assert(_strnicmp(ptr, "\\jvm",4) == 0, "invalid library name"); | 1 /* 2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. 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 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "oops/oop.inline.hpp" 27 #include "runtime/hpi.hpp" 28 #include "runtime/os.hpp" 29 30 typedef jint (JNICALL *init_t)(GetInterfaceFunc *, void *); 31 32 void hpi::initialize_get_interface(vm_calls_t *callbacks) 33 { 34 // Build name of HPI. 35 char lib_name[JVM_MAXPATHLEN]; 36 37 if (HPILibPath && HPILibPath[0]) { 38 strncpy(lib_name, HPILibPath, JVM_MAXPATHLEN - 1); 39 lib_name[JVM_MAXPATHLEN - 1] = '\0'; 40 } else { 41 os::jvm_path(lib_name, sizeof lib_name); 42 43 #ifdef PRODUCT 44 const char *hpi_lib = "\\hpi.dll"; 45 #else 46 char *ptr = strrchr(lib_name, '\\'); 47 // On Win98 GetModuleFileName() returns the path in the upper case. 48 assert(_strnicmp(ptr, "\\jvm",4) == 0, "invalid library name"); |