📄 bootstrap.java
字号:
/*
* Bootstrap.java -
*
* This file is part of the Jawin Project: http://jawinproject.sourceforge.net/
*
* Please consult the LICENSE file in the project root directory,
* or at the project site before using this software.
*/
/* $Id: Bootstrap.java,v 1.6 2004/06/14 19:51:59 arosii_moa Exp $ */
package org.jawin;
import java.io.File;
/**
* Jawin internal class with native entry points used to bootstrap Jawin.
* All native functions are package scoped to prevent outsiders calling them.
* <br><br>
* Most applications should not need to call {@link #init()} as this is
* automatically called from all classes containing native methods.
*
* @version $Revision: 1.6 $
* @author Stuart Halloway, http://www.relevancellc.com/halloway/weblog/
*/
public class Bootstrap {
static {
String hardLib = System.getProperty("org.jawin.hardlib");
if (hardLib != null) {
if (!(new File(hardLib).isAbsolute())) {
String userDir = System.getProperty("user.dir");
hardLib = userDir + java.io.File.separator + hardLib;
}
System.err.println("Loading jawin from hardcoded path " + hardLib);
System.load(hardLib);
} else {
String libName = System.getProperty("org.jawin.lib");
if (libName == null) {
libName = "jawin";
}
System.loadLibrary(libName);
}
// init the three base interfaces.
DispatchPtr.init(); // IDispatch
IEnumVariant.init(); // IEnumVariant
UnknownPtr.init(); // IUnknown
}
/**
* private constructor to avoid instantiation, as this class only contains
* static methods.
*/
private Bootstrap() {
// never called
}
/**
* call to initialize Jawin (work actually done in static initializer).
*/
public static void init() {}
/*
* functions used by FuncPtr for managing libraries (dll's) and
* native exposed functions in these.
*/
static native int loadLibrary(String lib) throws COMException;
static native int loadFunction(int lib, String function) throws COMException;
static native void freeLibrary(int lib) throws COMException;
/**
* Revokes a GIT entry. Called only by {@link org.jawin.IdentityManager}
*/
static native void revokeGIT(int peer) throws COMException;
/**
* Jawin caches guids under an integer token, to avoid the overhead
* of marshalling GUIDs back and forth
*/
static native int registerGUID(byte[] guid) throws COMException;
/**
* @throws COMException if the requested interface is not supported.
*/
static native int queryInterface(int unknown, int guidToken) throws COMException;
static native int unmarshalFromGIT(int peer, int guidToken) throws COMException;
static native int marshalToGIT(int unknown, int guidToken) throws COMException;
/**
* vtable call with no args, used for AddRef and Release
*/
static native int directCOM(int unknown, int vtableOffset);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -