📄 genericstub.java
字号:
//******************************************************************
// Released under the DevelopMentor OpenSource Software License.
// Please consult the LICENSE file in the project root directory,
// or at http://www.develop.com for details before using this
// software.
//******************************************************************
package com.develop.jawin.marshal;
import com.develop.io.*;
import com.develop.jawin.constants.*;
import com.develop.jawin.*;
import com.develop.util.*;
import java.io.*;
public class GenericStub implements DispatchConstants {
public static final boolean traceWin32 =
(null != System.getProperty("com.develop.jawin.traceWin32"));
public static final boolean traceCom =
(null != System.getProperty("com.develop.jawin.traceCom"));
public static final boolean traceDispatch =
(null != System.getProperty("com.develop.jawin.traceDispatch"));
static final String sep =
"-----------------------------------------------------------";
static {
Bootstrap.init();
}
public static int findN(String str, String find, int n) {
int found = 0;
for (int loop=-1; loop<n; loop++) {
found = str.indexOf(find, found+1);
if (found == -1) return -1;
}
return found;
}
public static String immediateCaller() {
Exception e = new Exception();
StringWriter w = new StringWriter();
PrintWriter pw = new PrintWriter(w);
e.printStackTrace(pw);
String s = w.toString();
int start = s.lastIndexOf("com.develop.jawin");
start = s.indexOf("at ", start);
if (start == -1) return "";
int end = s.indexOf(")", start);
if (end == -1) return "";
return s.substring(start, end+1);
}
public static native int registerCustomString(String custom);
public static byte[] win32Invoke(int peer, String instructions, int stackBytes,
int totalBytes, byte[] stack, Object[] objectArgs)
throws COMException
{
if (traceWin32)
{
System.out.println(sep);
System.out.println(immediateCaller());
System.out.println("GenericStub.win32Invoke " + instructions);
System.out.println(HexFormatter.convertBytesToString(stack, 8, true));
}
byte[] result = win32Invoke0(peer, instructions, stackBytes, totalBytes, stack, objectArgs);
if (traceWin32) {
System.out.println("GenericStub.comInvoke result");
System.out.println(HexFormatter.convertBytesToString(result, 8, true));
}
return result;
}
private static native byte[] win32Invoke0(int peer, String instructions, int stackBytes,
int totalBytes, byte[] stack, Object[] objectArgs);
public static byte[] dispatchInvoke(String instructions, int stackSize, int callsize, byte[] call, String meth, int flags, int peer, int unknown) {
if (traceDispatch) {
System.out.println(sep);
System.out.println(immediateCaller());
System.out.println("GenericStub.dispatchInvoke " + instructions);
System.out.println(HexFormatter.convertBytesToString(call, 8, true));
}
byte[] result = dispatchInvoke0(instructions, stackSize,
callsize, call, meth, flags, peer, unknown);
if (traceDispatch) {
System.out.println("GenericStub.dispatchInvoke result");
System.out.println(HexFormatter.convertBytesToString(result, 8, true));
}
return result;
}
private static native byte[] dispatchInvoke0(String instructions, int stackSize, int callsize, byte[] call, String meth, int flags, int peer, int unknown);
public static byte[] comInvokeString(String instructions, int stackSize, int arraySize, byte[] call, Object[] objectArgs,
int vtable, int guidToken, int peer, int unknown)
throws COMException, IOException
{
if (traceCom) {
System.out.println(sep);
System.out.println(immediateCaller());
System.out.println("GenericStub.comInvoke");
System.out.println(HexFormatter.convertBytesToString(call, 8, true));
}
byte[] result = comInvokeString0(instructions, stackSize, arraySize, call, objectArgs,
vtable, guidToken, peer, unknown);
if (traceCom) {
System.out.println("GenericStub.comInvoke result");
System.out.println(HexFormatter.convertBytesToString(result, 8, true));
}
return result;
}
private static native byte[] comInvokeString0(String instructions, int stackSize, int ArraySize, byte[] call, Object[] objectArgs,
int vtable, int guidToken, int peer, int unknown);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -