ra=edburns
author=  Nikolay Igotti

Added and removed files - continued previous checkin.
This commit is contained in:
edburns%acm.org 2001-07-12 20:26:30 +00:00
Родитель efc7c81088
Коммит 3aa0b68c56
48 изменённых файлов: 3605 добавлений и 1716 удалений

Просмотреть файл

@ -0,0 +1 @@
.classes.list

Просмотреть файл

@ -0,0 +1 @@
.classes.list

Просмотреть файл

@ -0,0 +1,33 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is The Waterfall Java Plugin Module
#
# The Initial Developer of the Original Code is Sun Microsystems Inc
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
# All Rights Reserved.
#
# $Id: FileListExt.mk,v 1.1 2001/07/12 20:25:23 edburns%acm.org Exp $
#
# Contributor(s):
#
# Nikolay N. Igotti <nikolay.igotti@Sun.Com>
#
FILES_java = \
sun/jvmp/av/WFAppletViewerImpl.java \
sun/jvmp/av/AVFactory.java \
sun/jvmp/av/WFProxyHandler.java \
sun/jvmp/av/WFAppletPanel.java \
sun/jvmp/av/AVClassLoader.java \
sun/jvmp/av/WFAuthenticatorImpl.java \
sun/jvmp/av/protocol/http/Handler.java \
sun/jvmp/av/protocol/http/HttpURLConnection.java

Просмотреть файл

@ -8,42 +8,40 @@
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
#
# The Original Code is The Waterfall Java Plugin Module
#
#
# The Initial Developer of the Original Code is Sun Microsystems Inc
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
# All Rights Reserved.
#
# $Id: GNUmakefile,v 1.1 2001/05/10 18:12:22 edburns%acm.org Exp $
#
#
# Contributor(s):
#
# Nikolay N. Igotti <inn@sparc.spb.su>
# $Id: GNUmakefile,v 1.1 2001/07/12 20:25:24 edburns%acm.org Exp $
#
# Contributor(s):
#
# Nikolay N. Igotti <nikolay.igotti@Sun.Com>
#
BUILDDIR = ../..
JAVASRCDIR = ../../../../java
CLASSDESTDIR = ../../../unix/ext/jpav
ADDCLASSPATH=../../../unix/classes:../../../unix/ext/jpav
PATH_SEP=:
CLASSDESTDIR = ../../../unix/ext/av
ADDCLASSPATH=../../../unix/classes:../../../unix/ext/av
include FileListExt.mk
include $(BUILDDIR)/Defs.gmk
include $(BUILDDIR)/Rules.gmk
all: jpav.jar
all: av.jar
jpav.jar: classes
av.jar: classes
@if [ -s .classes.list ]; then \
echo -n "Creating jpav.jar..."; \
echo -n "Creating av.jar..."; \
cd $(CLASSDESTDIR); \
$(RM) manifest.tmp; \
echo "Factory-Class: sun.jvmp.jpav.JavaPluginAVFactory" >> manifest.tmp ; \
echo "Protocol-Handlers: sun.jvmp.jpav.protocol.jdk12" >> manifest.tmp ; \
$(JAR_CMD) cfm jpav.jar manifest.tmp sun ; \
$(MV) jpav.jar .. ;\
echo "Factory-Class: sun.jvmp.av.AVFactory" >> manifest.tmp ; \
$(JAR_CMD) cfm av.jar manifest.tmp sun ; \
$(MV) av.jar .. ;\
echo " done."; fi

Просмотреть файл

@ -8,54 +8,50 @@
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
#
# The Original Code is The Waterfall Java Plugin Module
#
#
# The Initial Developer of the Original Code is Sun Microsystems Inc
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
# All Rights Reserved.
#
# $Id: makefile.win,v 1.1 2001/05/10 18:12:22 edburns%acm.org Exp $
#
#
# Contributor(s):
#
# Nikolay N. Igotti <inn@sparc.spb.su>
# $Id: makefile.win,v 1.1 2001/07/12 20:25:25 edburns%acm.org Exp $
#
# Contributor(s):
#
# Nikolay N. Igotti <nikolay.igotti@Sun.Com>
#
BUILDDIR = ..\..
JAVASRCDIR = ..\..\..\..\java
CLASSDESTDIR = ..\..\..\win32\ext\jpav
ADDCLASSPATH=..\..\..\win32\classes;..\..\..\win32\ext\jpav
EDBURNS=edburns
PATH_SEP=;
CLASSDESTDIR = ..\..\..\win32\ext\av
ADDCLASSPATH=..\..\..\win32\classes;..\..\..\win32\ext\av
PKG3=sun.jvmp.jpav
PKG4=sun.jvmp.jpav.protocol.jdk12.http
PKG15=sun.jvmp.jpav.protocol.jdk12.https
PKG16=sun.jvmp.jpav.protocol.jdk12.ftp
PKG17=sun.jvmp.jpav.protocol.jdk12.gopher
PKG18=sun.jvmp.jpav.protocol.jdk12.jar
PKG3=sun.jvmp.av
PKG4=sun.jvmp.av.protocol.http
PKG15=sun.jvmp.av.protocol.https
PKG16=sun.jvmp.av.protocol.ftp
PKG17=sun.jvmp.av.protocol.gopher
!include FileListExt.mk
# ugly, but nmake is pretty stupid in substitutions
CLASSDESTDIR=..\..\..\win32\ext\jpav
FILES_class = $(FILES_java:sun/jvmp=../../../win32/ext/jpav/sun/jvmp)
CLASSDESTDIR=..\..\..\win32\ext\av
FILES_class = $(FILES_java:sun/jvmp=../../../win32/ext/av/sun/jvmp)
!include $(BUILDDIR)\defs.mk
!include $(BUILDDIR)\rules.mk
all: jpav.jar
all: av.jar
jpav.jar: classes
av.jar: classes
@IF EXIST manifest.tmp $(DEL) manifest.tmp
@ echo Creating jpav.jar...
@ echo Creating av.jar...
@ cd $(CLASSDESTDIR)
@$(JAR_CMD) cfm jpav.jar <<manifest.tmp sun
Factory-Class: sun.jvmp.jpav.JavaPluginAVFactory
Protocol-Handlers: sun.jvmp.jpav.protocol.jdk12
@$(JAR_CMD) cfm av.jar <<manifest.tmp sun
Factory-Class: sun.jvmp.av.AVFactory
<<
-@$(DEL) ..\jpav.jar manifest.tmp
@$(MV) jpav.jar ..
-@$(DEL) ..\av.jar manifest.tmp
@$(MV) av.jar ..
@ echo Done

Просмотреть файл

@ -1,46 +0,0 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is The Waterfall Java Plugin Module
#
# The Initial Developer of the Original Code is Sun Microsystems Inc
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
# All Rights Reserved.
#
# $Id: FileListExt.mk,v 1.1 2001/05/10 18:12:22 edburns%acm.org Exp $
#
#
# Contributor(s):
#
# Nikolay N. Igotti <inn@sparc.spb.su>
FILES_java = \
sun/jvmp/jpav/ActivatorAppletContext.java \
sun/jvmp/jpav/ActivatorAppletPanel.java \
sun/jvmp/jpav/AppletMessageHandler.java \
sun/jvmp/jpav/ActivatorClassLoader.java \
sun/jvmp/jpav/ClassLoaderInfo.java \
sun/jvmp/jpav/ActivatorProxyHandler.java \
sun/jvmp/jpav/CookieHandler.java \
sun/jvmp/jpav/ProxyHandler.java \
sun/jvmp/jpav/JavaPluginAVFactory.java \
sun/jvmp/jpav/RMIActivatorSocketFactory.java \
sun/jvmp/jpav/protocol/jdk12/http/HttpClient.java \
sun/jvmp/jpav/protocol/jdk12/http/HttpURLConnection.java \
sun/jvmp/jpav/protocol/jdk12/http/Handler.java \
sun/jvmp/jpav/protocol/jdk12/http/SocksSocket.java \
sun/jvmp/jpav/protocol/jdk12/https/BrowserHttpsInputStream.java \
sun/jvmp/jpav/protocol/jdk12/https/BrowserHttpsOutputStream.java \
sun/jvmp/jpav/protocol/jdk12/https/BrowserHttpsURLConnection.java \
sun/jvmp/jpav/protocol/jdk12/https/Handler.java \
sun/jvmp/jpav/protocol/jdk12/ftp/Handler.java \
sun/jvmp/jpav/protocol/jdk12/gopher/Handler.java \
sun/jvmp/jpav/protocol/jdk12/jar/Handler.java

Просмотреть файл

@ -0,0 +1,10 @@
wflog.out
wflog.err
plugin.policy
Helper.libXm.so.4
plugin_host
wf-bin.tgz
wfrelease
wf.jar
classes
ext

Просмотреть файл

@ -1,42 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: plugin.policy,v 1.2 2001/05/11 23:31:37 edburns%acm.org Exp $
*
*
* Contributor(s):
*
* Nikolay N. Igotti <inn@sparc.spb.su>
*/
grant codeBase "file:${jvmp.home}/classes/" {
permission java.security.AllPermission;
};
grant codeBase "file:${jvmp.home}/wf.jar" {
permission java.security.AllPermission;
};
grant {
permission java.lang.RuntimePermission "accessClassInPackage.sun.jvmp";
permission java.lang.RuntimePermission "accessClassInPackage.sun.jvmp.applet";
permission java.lang.RuntimePermission "accessClassInPackage.sun.security.action";
permission java.lang.RuntimePermission "accessClassInPackage.sun.awt.image";
permission java.lang.RuntimePermission "accessClassInPackage.sun.audio";
permission java.lang.RuntimePermission "accessClassInPackage.sun.applet";
permission java.lang.RuntimePermission "modifyThread";
};

Просмотреть файл

@ -0,0 +1,16 @@
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is The Waterfall Java Plugin Module
The Initial Developer of the Original Code is Sun Microsystems Inc
Portions created by Sun Microsystems Inc are Copyright (C) 2001
All Rights Reserved.

Просмотреть файл

@ -0,0 +1,102 @@
#!/usr/bin/perl
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is The Waterfall Java Plugin Module
#
# The Initial Developer of the Original Code is Sun Microsystems Inc
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
# All Rights Reserved.
#
# $Id: add_legal.pl,v 1.1 2001/07/12 20:25:38 edburns%acm.org Exp $
#
# Contributor(s):
#
# Nikolay N. Igotti <nikolay.igotti@Sun.Com>
#
require "rules.pl";
$relpath = "";
sub get_type
{
my ($name) = @_;
foreach (keys %mapping)
{
return $mapping{$_} if ($name =~ /$_/);
}
return undef;
}
sub handle_file
{
my ($file, $name) = @_;
my $type = get_type($name);
open(FILE, $file) || die "cannot read $file: $!";
#print "name=$name type=$type\n";
my @lines = <FILE>;
close(FILE);
my @newlines;
if ($type) {
my ($pre, $com1, $com2, $com3) =
($prefixes{$type}, $comments_start{$type},
$comments_middle{$type}, $comments_end{$type});
if (!$com1 || !com2 || !com3) {
print "not defined comments for type $type - skipping...\n";
@newlines = @lines;
} else {
@newlines = proceed($file, $type, @lines);
}
} else {
print "skipped $file...\n";
@newlines = @lines;
}
my $newname = "$newtree/$relpath$name";
open(FILE, ">$newname") || die "cannot write to $newname: $!"; ;
foreach (@newlines) {
print FILE $_;
}
close(FILE);
}
sub handle_dir
{
my ($dir, $short) = @_;
my $oldrelpath = $relpath;
$relpath .= $short."/" if ($short);
opendir(DIR, $dir) || die "can't opendir $dir: $!";
my $newdir = "$newtree/$relpath";
mkdir $newdir unless (-d $newdir);
# it will remove all starting with dot entries
my @entries = grep { !/^\.$/ && !/^\.\.$/} readdir(DIR);
closedir DIR;
my @filez = grep { -f "$dir/$_"} @entries;
foreach (@filez) { handle_file("$dir/$_", $_); }
my @dirz = grep { -d "$dir/$_" && !$ignore_dirs{$_}} @entries;
foreach (@dirz) {
print "Handling $relpath$_...\n";
handle_dir("$dir/$_", $_);
}
$relpath = $oldrelpath;
}
open(LIC, $license) || die "can't read license file $license: $!";
@lic = <LIC>;
close (LIC);
handle_dir($oldtree, "");

Просмотреть файл

@ -0,0 +1,15 @@
Copyright issues with Waterfall.
COPYRIGTH POLICY:
Waterfall intended to be GPL'ed, or maybe MPL'ed.
DEPENDNCIES:
This product was inspired by Java Plugin (and designed to replace it)
so I used some of Java Plugin code. Code itself is licensed under Sun's JDK
license. So to obtain clean GPL'ed implementation we need:
- rewrite applet viewer (sun/jvmp/applet)
- rewrite Java LiveConnect related code in Mozilla extension (C code is clean)
but Mozilla extension isn't official part of Waterfall.

Просмотреть файл

@ -0,0 +1,159 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is The Waterfall Java Plugin Module
#
# The Initial Developer of the Original Code is Sun Microsystems Inc
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
# All Rights Reserved.
#
# $Id: rules.pl,v 1.1 2001/07/12 20:25:40 edburns%acm.org Exp $
#
# Contributor(s):
#
# Nikolay N. Igotti <nikolay.igotti@Sun.Com>
#
$post_license = <<EOF
Contributor(s):
Nikolay N. Igotti <nikolay.igotti\@Sun.Com>
EOF
;
# trick to prevent CVS from rewriting those comments
$post_license = "\$"."Id: CVS comments placeholder "."Exp \$\n".$post_license;
$license = "/work/checkin/MPL.txt";
$oldtree = "/work/checkin/wf";
$newtree = "/work/checkin/wf.new";
%mapping = (
".*\\.cpp\$" => "cpp",
".*\\.c\$" => "c",
".*\\.h\$" => "h",
".*\\.java\$" => "java",
".*\\.bat\$" => "bat",
".*\\.BAT\$" => "bat",
".*\\.policy" => "policy",
".*\\.sh" => "sh",
".*\\.csh" => "csh",
"GNUmakefile" => "GNUmakefile",
"Makefile" => "Makefile",
"makefile\\.win" => "makefile.win",
".*\\.mk" => "mk",
".*\\.gmk" => "gmk",
".*\\.pl" => "pl"
);
%prefixes = (
"cpp" => "-*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- ",
"c" => "-*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-",
"java" => "-*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-",
"h" => "-*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-"
);
%comments_start = (
"cpp" => "/* ",
"c" => "/* ",
"h" => "/* ",
"policy" => "/* ",
"sh" => "# ",
"csh" => "# ",
"pl" => "# ",
"GNUmakefile" => "# ",
"Makefile" => "# ",
"makefile.win"=> "# ",
"java" => "/* ",
"bat" => "\@REM ",
"BAT" => "\@REM ",
"mk" => "# ",
"gmk" => "# "
);
%comments_middle = (
"cpp" => " * ",
"c" => " * ",
"h" => " * ",
"policy" => " * ",
"java" => " * ",
"sh" => "# ",
"csh" => "# ",
"pl" => "# ",
"GNUmakefile" => "# ",
"Makefile" => "# ",
"makefile.win"=> "# ",
"mk" => "# ",
"gmk" => "# ",
"bat" => "\@REM ",
"BAT" => "\@REM "
);
%comments_end = (
"cpp" => " */",
"c" => " */",
"h" => " */",
"policy" => " */",
"sh" => "# ",
"csh" => "# ",
"pl" => "# ",
"GNUmakefile" => "# ",
"Makefile" => "# ",
"makefile.win"=> "# ",
"java" => " */ ",
"bat" => "\@REM ",
"BAT" => "\@REM ",
"mk" => "# ",
"gmk" => "# "
);
%ignore_dirs = (
"CVS" => 1
);
# filtering procedure:
# input - filename, type, list of file strings
# output - list of file strings
sub proceed
{
my ($file, $type, @lines) = @_;
my @newlines;
my ($pre, $com1, $com2, $com3) =
($prefixes{$type}, $comments_start{$type},
$comments_middle{$type}, $comments_end{$type});
# in shell scripts add only after #!<smth> execution comment
if ($type eq "sh" || $type eq "csh" || $type eq "pl") {
$_ = $lines[0];
push @newlines, shift @lines if (/^\#\S*\!/);
}
push @newlines, "$com1$pre\n";
push @newlines, "$com2\n" if ($pre);
foreach (@lic) {
push @newlines, "$com2$_";
}
my @post = split('\n', $post_license);
foreach (@post) {
push @newlines, "$com2$_\n";
}
push @newlines, "$com3\n\n";
foreach (@lines) {
push @newlines, $_;
}
return @newlines;
}

Просмотреть файл

@ -0,0 +1 @@
‰PNG

Просмотреть файл

@ -0,0 +1 @@
‰PNG

Просмотреть файл

@ -0,0 +1,89 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: JSException.java,v 1.1 2001/07/12 20:25:44 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package netscape.javascript;
// exception that can be thrown by LiveConnect in Mozilla.
public class JSException extends RuntimeException {
// Exception type supported by JavaScript 1.4 in Mozilla
public static final int EXCEPTION_TYPE_EMPTY = -1;
public static final int EXCEPTION_TYPE_VOID = 0;
public static final int EXCEPTION_TYPE_OBJECT = 1;
public static final int EXCEPTION_TYPE_FUNCTION = 2;
public static final int EXCEPTION_TYPE_STRING = 3;
public static final int EXCEPTION_TYPE_NUMBER = 4;
public static final int EXCEPTION_TYPE_BOOLEAN = 5;
public static final int EXCEPTION_TYPE_ERROR = 6;
public JSException() {
this(null);
}
public JSException(String s) {
this(s, null, -1, null, -1);
}
public JSException(String s, String filename, int lineno, String source,
int tokenIndex) {
super(s);
this.message = s;
this.filename = filename;
this.lineno = lineno;
this.source = source;
this.tokenIndex = tokenIndex;
this.wrappedExceptionType = EXCEPTION_TYPE_EMPTY;
}
public JSException(int wrappedExceptionType, Object wrappedException) {
this();
this.wrappedExceptionType = wrappedExceptionType;
this.wrappedException = wrappedException;
}
protected String message = null;
protected String filename = null;
protected int lineno = -1;
protected String source = null;
protected int tokenIndex = -1;
private int wrappedExceptionType = -1;
private Object wrappedException = null;
public int getWrappedExceptionType() {
return wrappedExceptionType;
}
public Object getWrappedException() {
return wrappedException;
}
}

Просмотреть файл

@ -0,0 +1,93 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: JSObject.java,v 1.1 2001/07/12 20:25:45 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package netscape.javascript;
import java.applet.Applet;
import java.applet.AppletContext;
import sun.jvmp.javascript.JSContext;
public abstract class JSObject {
/**
* Call to JS
**/
public abstract Object call(String methodName,
Object args[])
throws JSException;
/**
* Evaluate JS expression
*/
public abstract Object eval(String s) throws JSException;
/**
* Obtain member of JS object
*/
public abstract Object getMember(String name) throws JSException;
/**
* Set member of JS object
*/
public abstract void setMember(String name, Object value) throws JSException;
/**
* Remove member of JS object
*/
public abstract void removeMember(String name) throws JSException;
/**
* Obtain slot of JS object
*/
public abstract Object getSlot(int index) throws JSException;
/**
* Set slot of JS object
*/
public abstract void setSlot(int index, Object value) throws JSException;
/**
* Returns a JSObject for the window containing the given applet.
*/
public static JSObject getWindow(Applet applet) throws JSException {
AppletContext c = applet.getAppletContext();
JSObject ret = null;
if (c instanceof sun.jvmp.javascript.JSContext)
{
JSContext j = (JSContext) c;
ret = j.getJSObject();
}
if (ret == null)
throw new JSException("AppletContext doesn\'t provide correct JSContext");
else
return ret;
}
}

Просмотреть файл

@ -0,0 +1,45 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: JSUtil.java,v 1.1 2001/07/12 20:25:46 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package netscape.javascript;
import java.io.*;
public class JSUtil {
/* Return the stack trace of an exception or error as a String */
public static String getStackTrace(Throwable t) {
ByteArrayOutputStream captureStream;
PrintWriter p;
captureStream = new ByteArrayOutputStream();
p = new PrintWriter(captureStream);
t.printStackTrace(p);
p.flush();
return captureStream.toString();
}
}

Просмотреть файл

@ -0,0 +1,255 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: ConsoleWindow.java,v 1.1 2001/07/12 20:25:49 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp;
import java.awt.*;
import java.awt.event.*;
import java.util.Enumeration;
class ConsoleWindow extends Frame {
PluggableJVM m_jvm = null;
int debugLevel = 10;
/*
* Create the new console window
*/
public ConsoleWindow(PluggableJVM jvm) {
super("Waterfall Java Console");
m_jvm = jvm;
setResizable(true);
setLayout(new BorderLayout());
textArea = new TextArea();
add(textArea, BorderLayout.CENTER);
Button clear = new Button("Clear");
Button close = new Button("Close");
Panel panel = new Panel();
panel.setLayout(new FlowLayout(FlowLayout.CENTER));
panel.add(clear);
panel.add(new Label(" "));
panel.add(close);
KeyListener keyListener = new KeyAdapter() {
public void keyPressed(KeyEvent evt) {
switch (evt.getKeyCode()) {
// those events passed to default handlers
case KeyEvent.VK_KP_DOWN:
case KeyEvent.VK_KP_UP:
case KeyEvent.VK_KP_LEFT:
case KeyEvent.VK_KP_RIGHT:
case KeyEvent.VK_DOWN:
case KeyEvent.VK_UP:
case KeyEvent.VK_LEFT:
case KeyEvent.VK_RIGHT:
case KeyEvent.VK_PAGE_UP:
case KeyEvent.VK_PAGE_DOWN:
case KeyEvent.VK_END:
case KeyEvent.VK_HOME:
return;
}
switch (evt.getKeyChar()) {
case '?':
case 'h':
case 'H':
printHelp();
break;
case 't':
case 'T':
dumpThreads();
break;
case 'g':
case 'G':
System.out.println("running garbage collector...");
System.gc();
System.out.println("done.");
break;
case 'f':
case 'F':
System.out.println("finalize objects...");
System.runFinalization();
System.out.println("done.");
break;
case 'm':
case 'M':
Runtime r = Runtime.getRuntime();
System.out.println("Memory usage: free "+
r.freeMemory() +
" of total " +
r.totalMemory());
break;
case 'c':
case 'C':
textArea.setText("");
break;
case 'q':
case 'Q':
hide();
break;
case 'o':
case 'O':
dumpObjs();
break;
case 'V':
m_jvm.setDebugLevel(++debugLevel);
System.out.println("new debug level="+debugLevel);
break;
case 'v':
m_jvm.setDebugLevel(--debugLevel);
System.out.println("new debug level="+debugLevel);
break;
default:
}
// don't propagate further
evt.consume();
}
public void keyReleased(KeyEvent evt) {
}
public void keyTyped(KeyEvent evt) {
}
};
addKeyListener(keyListener);
textArea.addKeyListener(keyListener);
WindowListener windowEventListener = new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
dispose();
}
};
addWindowListener(windowEventListener);
int rgb = SystemColor.control.getRGB();
panel.setBackground(new Color(rgb));
add(panel, BorderLayout.SOUTH);
clear.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
synchronized (textArea) {
textArea.setText("");
};
}
});
close.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
hide();
}
});
setSize(400,300);
pack();
}
void printHelp()
{
System.out.println("Waterfall Java Console commands:");
System.out.println(" h - print this message");
System.out.println(" t - print all Java threads");
System.out.println(" g - run garbage collector");
System.out.println(" f - finalize objects in finalizer queue");
System.out.println(" m - print memory usage");
System.out.println(" c - clear console");
System.out.println(" q - close console");
System.out.println(" o - show all objects");
System.out.println(" V/v - increase/decrease verbosity");
}
void dumpThreads()
{
System.out.println("Threads list:");
Thread t = Thread.currentThread();
ThreadGroup tg = t.getThreadGroup();
// find root thread group
while (tg.getParent() != null) tg = tg.getParent();
// now dump leafs
dumpThreadGroup(tg);
}
void dumpThreadGroup(ThreadGroup tg)
{
if (tg == null) return;
int cnt = tg.activeCount();
System.out.println(" Thread group "+tg.getName());
Thread[] tlist = new Thread [cnt];
cnt = tg.enumerate(tlist);
for (int i=0; i < cnt; i++)
System.out.println(" "+tlist[i]);
int tgcnt = tg.activeGroupCount();
ThreadGroup[] tglist = new ThreadGroup[tgcnt];
tgcnt = tg.enumerate(tglist);
for (int i=0; i < tgcnt; i++)
dumpThreadGroup(tglist[i]);
}
void dumpObjs()
{
System.out.println("Registered extensions:");
for (Enumeration e = m_jvm.getAllExtensions(); e.hasMoreElements();)
{
WaterfallExtension ext = (WaterfallExtension)e.nextElement();
if (ext != null) System.out.println(" " + ext);
}
System.out.println("Registered windows:");
for (Enumeration e = m_jvm.getAllFrames(); e.hasMoreElements();)
{
NativeFrame nf = (NativeFrame)e.nextElement();
if (nf != null) System.out.println(" " + nf);
}
System.out.println("Registered objects:");
for (Enumeration e = m_jvm.getAllPeers(); e.hasMoreElements();)
{
HostObjectPeer p = (HostObjectPeer)e.nextElement();
if (p != null) System.out.println(" " + p);
}
System.out.println("Registered threads:");
for (Enumeration e = m_jvm.getAllThreads(); e.hasMoreElements();)
{
NativeThread t = (NativeThread)e.nextElement();
if (t != null) System.out.println(" " + t);
}
System.out.println("Registered synchro objects:");
for (Enumeration e = m_jvm.getAllSynchroObjects(); e.hasMoreElements();)
{
SynchroObject so = (SynchroObject)e.nextElement();
if (so != null) System.out.println(" " + so);
}
return;
}
public void append(String text) {
synchronized (textArea) {
textArea.append(text);
};
}
private TextArea textArea;
}

Просмотреть файл

@ -0,0 +1,80 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: DebugOutputStream.java,v 1.1 2001/07/12 20:25:50 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp;
import java.io.*;
public class DebugOutputStream extends OutputStream
{
ConsoleWindow console;
FileOutputStream log;
public DebugOutputStream(ConsoleWindow console,
String filename)
{
this.console = console;
if (filename != null)
{
String wfHome = System.getProperty("jvmp.home");
try {
File file = new File(wfHome, filename);
if (file.exists()) file.delete();
log = new FileOutputStream(file);
} catch (IOException e) {
e.printStackTrace();
}
}
}
public synchronized void write(byte b[], int off, int len)
throws IOException
{
if (console != null)
console.append(new String(b, off, len));
if (log != null)
{
try {
log.write(b, off, len);
} catch (IOException e) {
if (console != null)
console.append(e.toString());
}
}
}
public synchronized void write(int b) throws IOException
{
System.err.println("char write: "+b);
// inefficient implementation, but short writes shouldn't happen often
byte buf[] = new byte[1];
buf[0] = (byte)b;
write(buf, 0, 1);
}
public synchronized void flush() throws IOException {
if (log != null) log.flush();
}
}

Просмотреть файл

@ -0,0 +1,55 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: AppletManager.java,v 1.1 2001/07/12 20:25:54 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.applet;
import sun.jvmp.*;
import java.util.Hashtable;
public class AppletManager
{
PluggableJVM jvm;
public AppletManager(PluggableJVM jvm)
{
this.jvm = jvm;
}
public WFAppletViewer createAppletViewer(WFAppletContext ctx,
BrowserSupport support,
Hashtable atts)
{
if (jvm == null) return null;
AppletViewerArgs arg = new AppletViewerArgs(ctx, support, atts, jvm);
WFAppletViewer av = null;
try {
av = (WFAppletViewer)jvm.getServiceByCID(WFAppletViewer.CID, arg);
} catch (ClassCastException cce) {
jvm.trace("WFAppletViewer interface not implemented by applet viewer",
PluggableJVM.LOG_ERROR);
}
return av;
}
};

Просмотреть файл

@ -0,0 +1,48 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: AppletViewerArgs.java,v 1.1 2001/07/12 20:25:56 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.applet;
import sun.jvmp.BrowserSupport;
import java.util.Hashtable;
import sun.jvmp.PluggableJVM;
public class AppletViewerArgs
{
public AppletViewerArgs(WFAppletContext ctx,
BrowserSupport support,
Hashtable atts,
PluggableJVM jvm)
{
this.ctx = ctx;
this.support = support;
this.atts = atts;
this.jvm = jvm;
}
public WFAppletContext ctx;
public BrowserSupport support;
public Hashtable atts;
public PluggableJVM jvm;
}

Просмотреть файл

@ -0,0 +1,39 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: ProxyHandler.java,v 1.1 2001/07/12 20:25:56 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.applet;
import java.net.URL;
public interface ProxyHandler {
/* getProxyInfo takes a particular URL and returns its proxy setting.
*/
ProxyInfo getProxyInfo(URL u);
}

Просмотреть файл

@ -0,0 +1,121 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: ProxyInfo.java,v 1.1 2001/07/12 20:25:56 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.applet;
public class ProxyInfo {
String proxyHost;
int proxyPort = -1;
String socksProxyHost;
int socksProxyPort = -1;
public ProxyInfo(String pinfo) {
this(pinfo, null);
}
public ProxyInfo(String pinfo, String spinfo) {
// handle HTTP proxy settings
// accepted format is http://somehost.somedomain.com:port
if (pinfo != null)
{
int i = pinfo.indexOf("//");
// XXX: should I do smth meaningful with protocol
if (i >= 0) pinfo = pinfo.substring(i + 2);
i = pinfo.indexOf(":");
if (i < 0)
{
proxyHost = pinfo;
proxyPort = 3128; // or 80?
}
else
{
proxyHost = pinfo.substring(0, i);
try {
proxyPort = Integer.parseInt(pinfo.substring(i + 1));
} catch (NumberFormatException e) {
proxyPort = 3128;
}
}
}
// handle SOCKS proxy settings
// accepted format is host:port
if (spinfo != null)
{
int i = spinfo.indexOf(":");
if (i < 0)
{
socksProxyHost = spinfo;
socksProxyPort = 1080;
}
else
{
socksProxyHost = spinfo.substring(0, i);
try {
socksProxyPort
= Integer.parseInt(spinfo.substring(i + 1));
} catch (NumberFormatException e) {
socksProxyPort = 1080;
}
}
}
}
public ProxyInfo(String proxy, int port) {
this(proxy, port, null, -1);
}
public ProxyInfo(String proxy, int port, String socksProxy, int socksPort)
{
this.proxyHost = proxy;
this.proxyPort = port;
this.socksProxyHost = socksProxy;
this.socksProxyPort = socksPort;
}
public String getProxy() {
return proxyHost;
}
public int getPort() {
return proxyPort;
}
public String getSocksProxy() {
return socksProxyHost;
}
public int getSocksPort() {
return socksProxyPort;
}
public boolean isProxyUsed() {
return (proxyHost != null || socksProxyHost != null);
}
public boolean isSocksUsed() {
return (socksProxyHost != null);
}
}

Просмотреть файл

@ -0,0 +1,38 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: ProxyType.java,v 1.1 2001/07/12 20:25:57 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.applet;
public interface ProxyType {
/**
* Proxy config type
**/
public static final int PROXY_TYPE_NO_PROXY = 0;
public static final int PROXY_TYPE_MANUAL = 1;
public static final int PROXY_TYPE_AUTOCONFIG = 2;
}

Просмотреть файл

@ -0,0 +1,40 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: WFAppletClassLoader.java,v 1.1 2001/07/12 20:25:57 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.applet;
import sun.applet.*;
import java.net.*;
import java.security.*;
import java.io.*;
public class WFAppletClassLoader extends AppletClassLoader
{
private URL base;
public WFAppletClassLoader(URL base) {
super(base);
this.base = base;
}
};

Просмотреть файл

@ -0,0 +1,190 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: WFAppletContext.java,v 1.1 2001/07/12 20:25:58 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.applet;
import java.applet.*;
import java.util.*;
import sun.applet.*;
import java.awt.*;
import java.net.*;
import java.io.*;
import java.lang.reflect.*;
import sun.awt.image.URLImageSource;
public abstract class WFAppletContext implements AppletContext
{
public AudioClip getAudioClip(URL url) {
System.getSecurityManager().checkConnect(url.getHost(), url.getPort());
synchronized (audioClips) {
// first try cached data
AudioClip clip = (AudioClip)getFromCache(audioClips, url);
if (clip == null) {
clip = new AppletAudioClip(url);
putToCache(audioClips, url, clip);
}
return clip;
}
}
public Image getImage(URL url) {
System.getSecurityManager().checkConnect(url.getHost(), url.getPort());
synchronized (images) {
// first try cached data
Image img = (Image)getFromCache(images, url);
if (img == null) {
img =
Toolkit.getDefaultToolkit().createImage(new URLImageSource(url));;
putToCache(images, url, img);
}
return img;
}
}
public Applet getApplet(String name) {
name = name.toLowerCase();
for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) {
AppletPanel p = (AppletPanel)e.nextElement();
String param = p.getParameter("name");
if (param != null) {
param = param.toLowerCase();
}
if (name.equals(param) &&
p.getDocumentBase().equals(appletPanel.getDocumentBase())) {
try {
if (!checkConnect(appletPanel.getCodeBase().getHost(),
p.getCodeBase().getHost()))
return null;
} catch (InvocationTargetException ee) {
showStatus(ee.getTargetException().getMessage());
return null;
} catch (Exception ee) {
showStatus(ee.getMessage());
return null;
}
return p.getApplet();
}
}
return null;
}
public Enumeration getApplets() {
Vector v = new Vector();
for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) {
AppletPanel p = (AppletPanel)e.nextElement();
if (p.getDocumentBase().equals(appletPanel.getDocumentBase())) {
try {
checkConnect(appletPanel.getCodeBase().getHost(),
p.getCodeBase().getHost());
v.addElement(p.getApplet());
} catch (InvocationTargetException ee) {
showStatus(ee.getTargetException().getMessage());
} catch (Exception ee) {
showStatus(ee.getMessage());
}
}
}
return v.elements();
}
private boolean checkConnect(String sourceHostName, String targetHostName)
throws SecurityException, InvocationTargetException, Exception
{
SocketPermission panelSp =
new SocketPermission(sourceHostName,
"connect");
SocketPermission sp =
new SocketPermission(targetHostName,
"connect");
if (panelSp.implies(sp)) {
return true;
}
return false;
}
// separate methods to easily work around situation when weak refs
// not accesible
Object getFromCache(Hashtable cache,
Object key)
{
Object result = null;
try {
java.lang.ref.WeakReference ref =
(java.lang.ref.WeakReference)cache.get(key);
if (ref != null) result = ref.get();
} catch (Exception e) {
// if no weak refs - use cache what gives memory impact
result = cache.get(key);
}
return result;
}
void putToCache(Hashtable cache,
Object key,
Object value)
{
try {
cache.put(key, new java.lang.ref.WeakReference(value));
} catch (Exception e) {
// if no weak refs - use cache what gives memory impact
cache.put(key, value);
}
}
abstract public void showDocument(URL url);
abstract public void showDocument(URL url, String target);
abstract public void showStatus(String status);
public void addAppletInContext(AppletPanel appletPanel) {
this.appletPanel = appletPanel;
appletPanels.addElement(appletPanel);
}
public void removeAppletFromContext(AppletPanel applet) {
appletPanels.removeElement(applet);
}
public java.util.Iterator getStreamKeys() {
return null;
}
public java.io.InputStream getStream(String s) {
return null;
}
public void setStream(String s, java.io.InputStream str) {
}
private AppletPanel appletPanel;
private static Vector appletPanels = new Vector();
private static Hashtable audioClips = new Hashtable();
private static Hashtable images = new Hashtable();
}

Просмотреть файл

@ -0,0 +1,61 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: WFAppletSecurityManager.java,v 1.1 2001/07/12 20:26:00 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
/**
* this class created for 3 reasons:
* - to hide from extension developers sun.applet.* classes
* - to give extension developers basic point for security decisions, like
* security code can do:
* sm = System.getSecurityManager();
* if (sm instanceof sun.jvmp.applet.WFAppletSecurityManager)
* {
* Class[] clazz = mgr.getExecutionStackContext();
* and return codesource properly
* }
* - to allow fix bugs in sun.applet.* security manager
**/
package sun.jvmp.applet;
import java.security.*;
public class WFAppletSecurityManager extends sun.applet.AppletSecurity {
public WFAppletSecurityManager() {
}
public Class[] getExecutionStackContext()
{
return super.getClassContext();
}
}

Просмотреть файл

@ -0,0 +1,69 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: WFAppletViewer.java,v 1.1 2001/07/12 20:26:01 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.applet;
import java.net.URL;
import java.awt.Frame;
import java.applet.Applet;
/**
* interface to be implemented by different applet viewer implementation
**/
public interface WFAppletViewer
{
/**
* applet lifetime control
**/
public void startApplet();
public void stopApplet();
// timeout is time allowed for applet to complete its shutdown
// after all it just got destroyed
public void destroyApplet(int timeout);
/**
* Returns current status of applet loading, possible values - see below
**/
public int getLoadingStatus();
/**
* Get currently viewed object
*/
public Applet getApplet();
/**
* two methods to be used to supply applet with
* rendering context and real document base later than it created.
* Applet viewer shouldn't try to start applet before both are supplied.
**/
public void setDocumentBase(URL docbase);
public void setWindow(Frame f);
public final static String CID = "@sun.com/wf/applets/appletviewer;1";
public final static int STATUS_STARTED = 1;
public final static int STATUS_ERROR = 2;
public final static int STATUS_UNKNOWN = 3;
public final static int STATUS_LOADING = 4;
public final static int STATUS_STOPPED = 5;
};

Просмотреть файл

@ -0,0 +1,101 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: AVClassLoader.java,v 1.1 2001/07/12 20:26:04 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.av;
import java.net.URL;
import sun.applet.*;
import java.net.*;
import java.security.*;
import java.io.*;
import java.util.Enumeration;
public class AVClassLoader extends sun.jvmp.applet.WFAppletClassLoader
{
private URL base;
public AVClassLoader(URL base) {
super(base);
this.base = base;
}
/* this code is workaround for subtle bug/feature in JDK1.3.1 and 1.4,
related to loading applets behind proxy */
protected PermissionCollection getPermissions(CodeSource codesource)
{
PermissionCollection sysPerms = null;
Policy policy = (Policy)
AccessController.doPrivileged(
new PrivilegedAction() {
public Object run()
{
return Policy.getPolicy();
}});
if (policy != null)
sysPerms = policy.getPermissions(new CodeSource(null, null));
else
sysPerms = new Permissions();
final PermissionCollection perms = sysPerms;
if (base != null && base.getHost() != null)
perms.add(new SocketPermission(base.getHost()+":1-",
"accept,connect,resolve"));
URL url = codesource.getLocation();
if (url.getProtocol().equals("file")) {
String path = url.getFile().replace('/', File.separatorChar);
if (!path.endsWith(File.separator)) {
int endIndex = path.lastIndexOf(File.separatorChar);
if (endIndex != -1) {
path = path.substring(0, endIndex+1) + "-";
perms.add(new FilePermission(path, "read"));
}
}
perms.add(new SocketPermission("localhost", "connect,accept"));
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
try {
String host = InetAddress.getLocalHost().getHostName();
perms.add(new SocketPermission(host,"connect,accept"));
} catch (UnknownHostException uhe) {
}
return null;
}
});
if (base.getProtocol().equals("file")) {
String bpath = base.getFile().replace('/', File.separatorChar);
if (bpath.endsWith(File.separator)) {
bpath += "-";
}
perms.add(new FilePermission(bpath, "read"));
}
}
//for (Enumeration e=perms.elements();e.hasMoreElements();)
// System.err.println("p="+e.nextElement());
return perms;
}
};

Просмотреть файл

@ -0,0 +1,171 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: AVFactory.java,v 1.1 2001/07/12 20:26:05 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.av;
import sun.jvmp.*;
import sun.jvmp.applet.*;
import java.util.*;
import java.security.*;
import java.net.*;
import java.awt.Frame;
import java.applet.Applet;
public class AVFactory implements sun.jvmp.ObjectFactory
{
Vector cids;
Hashtable permsHash;
Permissions permsForAll;
boolean inited=false;
CodeSource codesource;
PluggableJVM jvm;
static AVFactory instance = null;
public static ObjectFactory getFactory(PluggableJVM jvm,
CodeSource codesource)
throws ComponentException
{
if (instance == null)
instance = new AVFactory(jvm, codesource);
return instance;
}
protected AVFactory(PluggableJVM jvm, CodeSource codesource)
throws ComponentException
{
cids = new Vector();
cids.addElement(WFAppletViewer.CID);
permsHash = new Hashtable();
this.jvm = jvm;
this.codesource = codesource;
// XXX: rewrite with policy file
permsForAll = new Permissions();
permsForAll.add(new java.lang.RuntimePermission("accessClassInPackage.sun.jvmp.av"));
permsForAll.add(new java.lang.RuntimePermission("accessClassInPackage.sun.jvmp.av.protocol.http"));
permsForAll.add(new java.lang.RuntimePermission("accessClassInPackage.sun.jvmp.av.protocol.ftp"));
permsForAll.add(new java.lang.RuntimePermission("accessClassInPackage.sun.jvmp.av.protocol.jar"));
permsForAll.add(new java.lang.RuntimePermission("accessClassInPackage.sun.jvmp.av.protocol.https"));
permsForAll.add(new java.lang.RuntimePermission("accessClassInPackage.sun.jvmp.av.protocol.gopher"));
jvm.registerProtocolHandlers(this.getClass().getClassLoader(), "sun.jvmp.av.protocol");
}
public String getName()
{
return "Waterfall applet viewer";
}
public Enumeration getCIDs()
{
return cids.elements();
}
public boolean handleConflict(String cid,
ObjectFactory f)
{
return true;
}
public Object instantiate(String cid, Object arg)
{
AppletViewerArgs a;
try {
a = (AppletViewerArgs)arg;
} catch (ClassCastException e) {
return null;
}
initEnvironment(a.support);
if ((cid == null) || (!WFAppletViewer.CID.equals(cid)) || (a == null))
return null;
return new WFAppletViewerImpl(a.jvm, a.ctx, a.support, a.atts);
}
public PermissionCollection getPermissions(CodeSource codesource)
{
// pity, but no clone() here
Permissions p = new Permissions();
for (Enumeration e=permsForAll.elements(); e.hasMoreElements(); )
p.add((Permission)e.nextElement());
if (codesource != null && codesource.getLocation() != null)
{
Permissions p1 = (Permissions)permsHash.get(codesource);
if (p1 != null)
{
for (Enumeration e=p1.elements(); e.hasMoreElements(); )
p.add((Permission)e.nextElement());
}
}
return p;
}
void initEnvironment(BrowserSupport support)
{
if (inited) return;
Properties props = new Properties(System.getProperties());
props.put("browser", "sun.jvmp");
props.put("browser.vendor", "Sun Microsystems Inc.");
props.put("http.agent", "Waterfall Applet Viewer/1.0");
props.put("package.restrict.access.sun", "true");
props.put("package.restrict.access.netscape", "false");
props.put("package.restrict.definition.java", "true");
props.put("package.restrict.definition.sun", "true");
props.put("package.restrict.definition.netscape", "true");
props.put("java.version.applet", "true");
props.put("java.vendor.applet", "true");
props.put("java.vendor.url.applet", "true");
props.put("java.class.version.applet", "true");
props.put("os.name.applet", "true");
props.put("os.version.applet", "true");
props.put("os.arch.applet", "true");
props.put("file.separator.applet", "true");
props.put("path.separator.applet", "true");
props.put("line.separator.applet", "true");
System.setProperties(props);
ProxyHandler handler
= getDefaultProxyHandler(ProxyType.PROXY_TYPE_AUTOCONFIG,
null,
null,
support);
try {
WFProxyHandler.setDefaultProxyHandler(handler);
Authenticator.setDefault(new WFAuthenticatorImpl());
} catch(Throwable e) {
PluggableJVM.trace(e, PluggableJVM.LOG_WARNING);
}
}
protected static ProxyHandler
getDefaultProxyHandler(int proxyType,
String proxyList,
String proxyOverride,
BrowserSupport ctx)
{
return new WFProxyHandler(proxyType,
proxyList,
proxyOverride,
ctx);
}
}

Просмотреть файл

@ -0,0 +1,366 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: WFAppletPanel.java,v 1.1 2001/07/12 20:26:06 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.av;
import java.applet.*;
import sun.applet.*;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.*;
import java.awt.*;
import sun.jvmp.*;
import sun.jvmp.applet.*;
import java.io.IOException;
// wrapper for JDK's applet viewer implementation
public class WFAppletPanel extends AppletPanel implements ProxyType
{
PluggableJVM jvm;
Frame viewFrame;
int width;
int height;
URL documentURL;
URL baseURL;
WFAppletContext appletContext;
protected Hashtable atts;
private boolean inited = false;
private String myJars;
public WFAppletPanel(PluggableJVM jvm,
WFAppletContext appletContext,
Hashtable atts)
{
if (appletContext == null)
throw new IllegalArgumentException("AppletContext");
this.atts = atts;
this.jvm = jvm;
this.appletContext = appletContext;
appletContext.addAppletInContext(this);
}
public void init()
{
super.init();
sendEvent(APPLET_LOAD);
sendEvent(APPLET_INIT);
}
public void appletStart()
{
if (inited) sendEvent(APPLET_START);
}
public void appletStop()
{
sendEvent(APPLET_STOP);
}
public int getLoadingStatus()
{
switch (status)
{
case APPLET_START:
return WFAppletViewer.STATUS_STARTED;
case APPLET_STOP:
return WFAppletViewer.STATUS_STOPPED;
case APPLET_ERROR:
return WFAppletViewer.STATUS_ERROR;
case APPLET_LOAD:
return WFAppletViewer.STATUS_LOADING;
default:
return WFAppletViewer.STATUS_UNKNOWN;
}
}
public void onClose(final int timeOut)
{
appletContext.removeAppletFromContext(this);
Thread killer = new Thread(new Runnable() {
public void run() {
if (status==APPLET_LOAD) stopLoading();
sendEvent(APPLET_STOP);
sendEvent(APPLET_DESTROY);
sendEvent(APPLET_DISPOSE);
sendEvent(APPLET_QUIT);
}
});
killer.start();
}
public URL getDocumentBase()
{
return documentURL;
}
public void setDocumentBase(URL url)
{
documentURL = url;
initCodebase();
tryToInit();
}
public int getWidth()
{
String w = getParameter("width");
if (w != null) return Integer.valueOf(w).intValue();
return 0;
}
public int getHeight()
{
String h = getParameter("height");
if (h != null) return Integer.valueOf(h).intValue();
return 0;
}
public String getSerializedObject()
{
return null;
}
public String getJarFiles()
{
return myJars;
}
public String getParameter(String name) {
name = name.toLowerCase();
if (atts.get(name) != null) {
return (String) atts.get(name);
} else {
String value=null;
try {
value = getParameterFromHTML(name);
} catch (Throwable e) {
jvm.trace(e, PluggableJVM.LOG_WARNING);
}
if (value != null)
atts.put(name.toLowerCase(), value);
return value;
}
}
public Hashtable getParameters()
{
return (Hashtable) atts.clone();
}
public URL getCodeBase()
{
return baseURL;
}
public String getCode()
{
String code = getParameter("java_code");
if (code==null)
code=getParameter("code");
return code;
}
public AppletContext getAppletContext()
{
return appletContext;
}
public void setParameter(String name, Object value) {
name = name.toLowerCase();
atts.put(name, value.toString());
}
public void setWindow(Frame f)
{
if (f == null)
{
// maybe create new top level Frame
jvm.trace("Got zero Frame for SetWindow",
PluggableJVM.LOG_ERROR);
return;
}
f.setLayout(null);
Applet a = getApplet();
if (a == null) {
try {
int wd = Integer.parseInt(getParameter("width"));
int ht = Integer.parseInt(getParameter("height"));
this.width = wd;
this.height = ht;
} catch (NumberFormatException e) {
setParameter("width", new Integer(width));
setParameter("height", new Integer(height));
}
} else {
setParameter("width", new Integer(width));
setParameter("height", new Integer(height));
setSize(width, height);
a.resize(width, height);
a.setVisible(true);
}
setBounds(0, 0, width, height);
if (this.viewFrame == f) return;
this.viewFrame = f;
f.add(this);
f.show();
f.setBounds(0, 0, width, height);
tryToInit();
}
public void paint(Graphics g)
{
if (getApplet() == null && g != null) {
setBackground(Color.lightGray);
g.setColor(Color.black);
Dimension d = getSize();
Font fontOld = g.getFont();
FontMetrics fm = null;
if (fontOld != null)
fm = g.getFontMetrics(fontOld);
String str = getStatusString();;
// Display message on the screen if the applet is not started yet.
if (d != null && fm != null)
g.drawString(str, (d.width - fm.stringWidth(str))/ 2,
(d.height + fm.getAscent())/ 2);
}
}
protected String getParameterFromHTML(String name)
{
return null;
}
protected void loadJarFiles(AppletClassLoader loader)
throws IOException, InterruptedException
{
// Cache option as read from the Html page tag
String copt;
// Cache Archive value as read from the Html page tag
String carch;
// Cache Version value as read from the Html page tag
String cver;
// Vector to store the names of the jar files to be cached
Vector jname = new Vector();
// Vector to store actual version numbers
Vector jVersion = new Vector();
// Figure out the list of all required JARs.
String raw = getParameter("java_archive");
if (raw == null)
{
raw = getParameter("archive");
}
// no jars required
if (raw == null)
{
return;
}
myJars = raw;
super.loadJarFiles(loader);
return;
}
protected AppletClassLoader createClassLoader(final URL codebase)
{
return new AVClassLoader(codebase);
}
private String getStatusString()
{
switch (status)
{
case APPLET_START:
return "Applet started.";
case APPLET_STOP:
return "Applet stopped.";
case APPLET_ERROR:
return "Error loading applet.";
case APPLET_LOAD:
return "WF loading applet...";
default:
// just for user's convinience ;)
return "loading applet...";
//return "Unknown status";
}
}
private void tryToInit() {
//jvm.trace("tryToInit()", PluggableJVM.LOG_DEBUG);
if (!inited && viewFrame != null && getDocumentBase() != null)
{
inited = true;
Thread starter = new Thread(new Runnable() {
public void run() {
//jvm.trace("real Init()", PluggableJVM.LOG_DEBUG);
init();
sendEvent(APPLET_START);
}
});
starter.start();
}
}
private void initCodebase()
{
String att = getParameter("java_codebase");
if (att == null) att = getParameter("codebase");
if (att != null) {
if (!att.endsWith("/")) att += "/";
try {
baseURL = new URL(documentURL, att);
} catch (MalformedURLException e) {
}
}
if (baseURL == null) {
String file = documentURL.getFile();
int i = file.lastIndexOf('/');
if (i > 0 && i < file.length() - 1) {
try {
baseURL = new URL(documentURL, file.substring(0, i + 1));
} catch (MalformedURLException e) {
}
}
}
if (baseURL == null) baseURL = documentURL;
}
}

Просмотреть файл

@ -0,0 +1,83 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: WFAppletViewerImpl.java,v 1.1 2001/07/12 20:26:07 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.av;
import sun.jvmp.*;
import sun.jvmp.applet.*;
import java.util.Hashtable;
import java.applet.*;
import java.net.URL;
import java.awt.Frame;
class WFAppletViewerImpl implements WFAppletViewer
{
WFAppletPanel av;
WFAppletViewerImpl(PluggableJVM jvm,
WFAppletContext ctx,
BrowserSupport support,
Hashtable atts)
{
av = new WFAppletPanel(jvm, ctx, atts);
}
public void startApplet()
{
av.appletStart();
}
public void stopApplet()
{
av.appletStop();
}
public void destroyApplet(int timeout)
{
av.onClose(timeout);
}
public int getLoadingStatus()
{
return av.getLoadingStatus();
}
public void setDocumentBase(URL docbase)
{
av.setDocumentBase(docbase);
}
public void setWindow(Frame f)
{
av.setWindow(f);
}
public Applet getApplet()
{
return av.getApplet();
}
}

Просмотреть файл

@ -0,0 +1,152 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: WFAuthenticatorImpl.java,v 1.1 2001/07/12 20:26:07 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.av;
import java.net.*;
import java.security.*;
import java.awt.*;
import java.awt.event.*;
public class WFAuthenticatorImpl extends Authenticator
{
protected synchronized PasswordAuthentication getPasswordAuthentication()
{
PasswordAuthentication pass = null;
try
{
InetAddress host = getRequestingSite();
String hostName = "<<unknown>>";
if (host != null) hostName = host.toString();
pass = askUser(hostName,
getRequestingPrompt(),
getRequestingScheme());
}
catch (Exception e)
{
// do nothing here
e.printStackTrace();
}
return pass;
}
protected PasswordAuthentication askUser(String host,
String prompt,
String scheme)
{
AuthDialog dlg = new AuthDialog(host, prompt, scheme);
return dlg.askUser();
}
}
class AuthDialog extends Frame
{
TextField user;
TextField passwd;
PasswordAuthentication auth;
AuthDialog(String host,
String prompt,
String scheme)
{
super("Authentication dialog");
//System.err.println("h="+host+" p="+prompt+" s="+scheme);
setLayout(new BorderLayout());
setResizable(true);
Panel p1 = new Panel();
p1.setLayout(new BorderLayout());
user = new TextField(15);
passwd = new TextField(15);
passwd.setEchoChar('*');
p1.add(new Label("Auth request for "+host),
BorderLayout.NORTH);
p1.add(new Label(prompt), BorderLayout.SOUTH);
Panel p2 = new Panel();
p2.setLayout(new BorderLayout());
Panel p21 = new Panel();
p21.setLayout(new FlowLayout(FlowLayout.LEFT));
p21.add(new Label("Username: "));
p21.add(user);
Panel p22 = new Panel();
p22.setLayout(new FlowLayout(FlowLayout.LEFT));
p22.add(new Label("Password: "));
p22.add(passwd);
p2.add(p21, BorderLayout.NORTH);
p2.add(p22, BorderLayout.SOUTH);
Panel p3 = new Panel();
p3.setLayout(new FlowLayout(FlowLayout.CENTER));
Button ok = new Button("OK");
ok.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
synchronized (user) {
auth = new PasswordAuthentication(user.getText(),
passwd.getText().toCharArray());
user.notify();
}
}
});
p3.add(ok);
Button cancel = new Button("Cancel");
cancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
auth = null;
synchronized (user) {
// System.err.println("u="+user.getText()+" p="+passwd.getText());
user.notify();
}
}
});
p3.add(cancel);
add(p1, BorderLayout.NORTH);
add(p3, BorderLayout.SOUTH);
add(p2, BorderLayout.CENTER);
setSize(320,180);
}
PasswordAuthentication askUser()
{
show();
try {
synchronized (user) {
user.wait();
}
} catch (InterruptedException e) {}
hide();
return auth;
}
}

Просмотреть файл

@ -0,0 +1,112 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: WFProxyHandler.java,v 1.1 2001/07/12 20:26:07 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.av;
import java.net.URL;
import java.util.Hashtable;
import java.util.StringTokenizer;
import sun.jvmp.*;
import sun.jvmp.applet.*;
public class WFProxyHandler implements ProxyHandler, ProxyType {
private int proxyType = PROXY_TYPE_NO_PROXY;
private String proxyList = null;
private String proxyOverride = null;
private Hashtable proxyCache = null;
private BrowserSupport support = null;
public WFProxyHandler(int proxyType,
String proxyList,
String proxyOverride,
BrowserSupport sup)
{
this.proxyType = proxyType;
this.proxyList = proxyList;
this.proxyOverride = proxyOverride;
this.support = sup;
// XXX: implement me
if (proxyType == PROXY_TYPE_MANUAL)
{
PluggableJVM.trace("Manual proxy config not supported yet",
PluggableJVM.LOG_ERROR);
}
proxyCache = new Hashtable();
}
public synchronized ProxyInfo getProxyInfo(URL u)
{
ProxyInfo pinfo = null;
try {
pinfo = (ProxyInfo) proxyCache.get(u.getProtocol()
+ u.getHost()
+ u.getPort());
// currently the only way to get proxy is to ask it from browser
if (pinfo != null)
return pinfo;
if (support == null)
pinfo = null;
else
pinfo = support.getProxyInfoForURL(u);
proxyCache.put(u.getProtocol() + u.getHost() + u.getPort(), pinfo);
}
catch (Exception e) {
PluggableJVM.trace("Proxy is not configured",
PluggableJVM.LOG_ERROR);
PluggableJVM.trace(e, PluggableJVM.LOG_ERROR);
pinfo = new ProxyInfo(null, -1);
}
return pinfo;
}
// The current default proxy handler
private static ProxyHandler handler;
public static ProxyHandler getDefaultProxyHandler()
{
return handler;
}
public static void setDefaultProxyHandler(ProxyHandler newDefault)
{
handler = newDefault;
}
}

Просмотреть файл

@ -0,0 +1,43 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: Handler.java,v 1.1 2001/07/12 20:26:09 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.av.protocol.http;
import java.net.*;
import java.io.IOException;
public class Handler extends sun.net.www.protocol.http.Handler
{
public URLConnection openConnection(URL u)
throws IOException
{
return new HttpURLConnection(u, this);
}
}

Просмотреть файл

@ -0,0 +1,102 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: HttpURLConnection.java,v 1.1 2001/07/12 20:26:11 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.av.protocol.http;
import java.io.*;
import java.util.*;
import java.security.*;
import sun.net.*;
import java.net.*;
import sun.net.www.*;
import sun.jvmp.applet.*;
import sun.jvmp.av.*;
class HttpURLConnection extends sun.net.www.protocol.http.HttpURLConnection
{
protected String proxy = null;
protected int proxyPort = -1;
public HttpURLConnection(URL u, Handler handler)
throws IOException
{
super(u, handler);
ProxyHandler p = WFProxyHandler.getDefaultProxyHandler();
ProxyInfo pi = (p != null) ? p.getProxyInfo(u) : null;
if (pi != null)
{
this.proxy = pi.getProxy();
this.proxyPort = pi.getPort();
//System.err.println("for url="+url+" proxy="+proxy);
}
}
public synchronized void connect()
throws IOException
{
if (connected) return;
try {
AccessController.doPrivileged(new PrivilegedExceptionAction()
{
public Object run() throws IOException {
http = new sun.net.www.http.HttpClient(url, proxy, proxyPort);
ps = (PrintStream)http.getOutputStream();
return null;
}
});
} catch (PrivilegedActionException e) {
IOException ioe = (IOException)e.getException();
System.err.println("rethrown security exception");
throw ioe;
}
connected = true;
}
public synchronized InputStream getInputStream()
throws IOException
{
if (!connected) connect();
return super.getInputStream();
}
public Permission getPermission() throws IOException
{
if (proxy != null)
{
return new java.net.SocketPermission(proxy+":"+proxyPort,
"connect,accept,resolve");
}
return null;
}
}

Просмотреть файл

@ -0,0 +1,36 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: JSContext.java,v 1.1 2001/07/12 20:26:14 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.javascript;
/**
* Interface to be implemented by applet context if it likes to
* provide LiveConnect functionality
**/
public interface JSContext {
netscape.javascript.JSObject getJSObject();
}

Просмотреть файл

@ -0,0 +1,266 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: MozillaAppletPeer.java,v 1.3 2001/07/12 20:26:17 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.mozilla;
import sun.jvmp.*;
import sun.jvmp.security.*;
import sun.jvmp.applet.*;
import java.util.Hashtable;
import java.net.URL;
import java.net.MalformedURLException;
import java.applet.*;
import java.awt.Frame;
public class MozillaAppletPeer extends WFAppletContext
implements HostObjectPeer, sun.jvmp.javascript.JSContext
{
private int m_id;
private int m_winid;
private long m_params = 0;
MozillaPeerFactory m_factory;
WFAppletViewer m_viewer = null;
private boolean m_stopped = true;
protected netscape.javascript.JSObject
m_js = null;
PluggableJVM jvm;
MozillaAppletPeer(MozillaHostObjectPeer fake, int id)
{
m_factory = fake.m_factory;;
jvm = m_factory.m_jvm;
jvm.trace("CREATED APPLET OBJECT: "+this,
PluggableJVM.LOG_DEBUG);
m_id = id;
m_winid = 0;
}
public int getID()
{
return m_id;
}
public void setID(int id)
{
if (m_id != 0) return;
m_id = id;
}
public int handleEvent(SecurityCaps caps, int eventID, long eventData)
{
int retval = 0;
//jvm.trace("GOT EVENT "+eventID+"!!!");
switch (eventID)
{
case PE_CREATE:
retval = 1;
break;
case PE_SETTYPE:
jvm.trace("SETTYPE called twice - IGNORED",
PluggableJVM.LOG_WARNING);
retval = 1;
break;
case PE_SETWINDOW:
jvm.trace("PE_SETWINDOW", PluggableJVM.LOG_DEBUG);
m_winid = (int)eventData;
retval = handleSetWindow();
break;
case PE_NEWPARAMS:
m_params = eventData;
retval = handleNewParams();
break;
case PE_DESTROY:
retval = destroy(caps);
break;
case PE_STOP:
retval = 1;
// do it before stop, as after we can't be sure
// our browser peer is still alive
m_stopped = true;
if (m_viewer != null) m_viewer.stopApplet();
break;
case PE_START:
retval = 1;
m_stopped = false;
m_viewer.startApplet();
break;
case PE_GETPEER:
// this call is handled in both ways - direct and
// queued as policy on place where to handle
// JS calls can be changed on Mozilla side
// At least for now it works OK with both cases
retval = handleCall(caps, PE_GETPEER, eventData);
break;
default:
retval = 0;
}
return retval;
}
public int handleCall(SecurityCaps caps, int arg1, long arg2)
{
int retval = 0;
switch (arg1)
{
case PE_GETPEER:
if (m_viewer == null) break;
Object o = null;
switch (m_viewer.getLoadingStatus())
{
case WFAppletViewer.STATUS_STARTED:
o = m_viewer.getApplet();
break;
case WFAppletViewer.STATUS_ERROR:
o = null;
break;
default:
jvm.trace("XXX: Applet loading in progress....",
PluggableJVM.LOG_WARNING);
// here we just return NULL, as for the moment no valid
// applet object exist - if someone really needs this
// object - call later
break;
}
nativeReturnJObject(o, arg2);
retval = 1;
break;
default:
retval = 0;
}
return retval;
}
public int destroy(SecurityCaps caps)
{
jvm.trace("DESTROY", PluggableJVM.LOG_DEBUG);
finalizeParams();
m_params = 0;
m_stopped = true;
if (m_viewer != null) {
m_viewer.destroyApplet(2500);
m_viewer = null;
}
return 1;
}
public HostObjectPeerFactory getFactory()
{
return m_factory;
}
private int handleNewParams()
{
String[][] params = getParams();
String[] keys = params[0];
String[] vals = params[1];
URL docbase;
Hashtable hparams = new Hashtable();
for (int i=0; i < keys.length; i++)
hparams.put(keys[i].toLowerCase(), vals[i]);
//hparams.put("OWNER", this);
//hparams.put("ID", new Integer(m_id));
try
{
docbase = new URL((String)hparams.get("docbase"));
}
catch (MalformedURLException e)
{
jvm.trace("invalid docbase due "+e,
PluggableJVM.LOG_ERROR);
return 0;
}
m_viewer = m_factory.m_mgr.createAppletViewer(this,
m_factory,
hparams);
m_viewer.setDocumentBase(docbase);
return handleSetWindow();
}
private int handleSetWindow()
{
if (m_stopped) return 0;
if (m_winid != 0) {
Frame f = jvm.getFrameWithId(m_winid);
if (f != null) m_viewer.setWindow(f);
}
return 1;
}
/**
* From AppletContext
*/
public void showStatus(String string)
{
//PluggableJVM.trace("Status: "+string);
// calls back peer in Mozilla
if (m_stopped) return;
nativeShowStatus(string);
}
public void showDocument(URL url, String target)
{
// never pass events after stop() - otherwise
// we'll crash the browser
if (m_stopped) return;
// calls back peer in Mozilla
nativeShowDocument(url.toString(), target);
}
public void showDocument(URL url)
{
showDocument(url, "_top");
}
/**
* From JSContext
*/
public netscape.javascript.JSObject getJSObject()
{
// check if we got params from browser - fail otherwise
if (m_params == 0) return null;
if (m_js == null)
m_js = m_factory.getJSObject(m_params);
return m_js;
}
// duplicates of nsIJavaObjectInfo methods
// funny way to return 2 arrays of strings
native protected String[][] getParams();
native protected void finalizeParams();
native protected boolean nativeShowStatus(String status);
native protected boolean nativeShowDocument(String url,
String target);
// method to write jobject ret to native pointer ptr
native protected void nativeReturnJObject(Object ret, long ptr);
// XXX: add others
};

Просмотреть файл

@ -0,0 +1,106 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: MozillaHostObjectPeer.java,v 1.3 2001/07/12 20:26:18 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.mozilla;
import sun.jvmp.*;
import sun.jvmp.security.*;
public class MozillaHostObjectPeer implements HostObjectPeer
{
private int m_id = 0;
private long m_data = 0;
private HostObjectPeer m_realPeer = null;
MozillaPeerFactory m_factory = null;
public MozillaHostObjectPeer(MozillaPeerFactory factory, int version)
{
m_factory = factory;
}
public int getID()
{
return m_id;
}
public void setID(int id)
{
if (m_id != 0) return;
m_id = id;
}
public int handleEvent(SecurityCaps caps, int eventID, long eventData)
{
int retval = 0;
// forward functionality to the real peer
if (m_realPeer != null)
return m_realPeer.handleEvent(caps, eventID, eventData);
switch (eventID)
{
case PE_CREATE:
retval = 1;
break;
case PE_SETTYPE:
switch((int)eventData)
{
case PT_APPLET:
case PT_OBJECT:
m_realPeer = new MozillaAppletPeer(this, m_id);
// maybe send CREATE event from here?
retval = 1;
break;
default:
m_factory.m_jvm.trace("Unknown tag type",
PluggableJVM.LOG_WARNING);
break;
}
break;
default:
retval = 0;
break;
}
return retval;
}
public int destroy(SecurityCaps caps)
{
if (m_realPeer != null)
return m_realPeer.destroy(caps);
return 0;
}
public int handleCall(SecurityCaps caps, int arg1, long arg2)
{
if (m_realPeer != null)
return m_realPeer.handleCall(caps, arg1, arg2);
return 0;
}
public HostObjectPeerFactory getFactory()
{
return m_factory;
}
};

Просмотреть файл

@ -0,0 +1,263 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: MozillaPeerFactory.java,v 1.3 2001/07/12 20:26:18 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.mozilla;
import sun.jvmp.*;
import sun.jvmp.security.*;
import sun.jvmp.applet.*;
import java.net.*;
import java.util.StringTokenizer;
import java.util.*;
import java.security.*;
import java.lang.reflect.*;
public class MozillaPeerFactory implements HostObjectPeerFactory,
AccessControlDecider,
BrowserSupport
{
protected final String cid = "@sun.com/wf/mozilla/appletpeer;1";
protected final int version = 1;
PluggableJVM m_jvm = null;
protected long m_params = 0;
protected int m_id;
private static boolean initialized = false;
protected URL[] m_codebase;
AppletManager m_mgr;
Constructor jsConstructor;
protected MozillaPeerFactory(PluggableJVM jvm, long data)
throws Exception
{
loadLibrary();
m_jvm = jvm;
m_params = data;
/* as we could load only one factory, this will allow
generic operations, like JS evaluation, to be performed without
any applets at all */
try {
Class jsClass = Class.forName("sun.jvmp.mozilla.JSObject");
jsConstructor = jsClass.getDeclaredConstructor(new Class[]{Long.class});
Field eval = jsClass.getDeclaredField("m_evaluator");
eval.setLong(null, data);
} catch (Exception e) {
jsConstructor = null;
jvm.trace("Liveconnect not inited - sorry", PluggableJVM.LOG_ERROR);
jvm.trace(e, PluggableJVM.LOG_ERROR);
}
m_mgr = new AppletManager(jvm);
try {
m_codebase = null;
URLClassLoader cl =
(URLClassLoader)this.getClass().getClassLoader();
if (cl != null) m_codebase = cl.getURLs();
} catch (ClassCastException e) {
// do nothing here
}
System.setSecurityManager(new MozillaSecurityManager());
}
netscape.javascript.JSObject getJSObject(long params)
{
if (jsConstructor == null) return null;
netscape.javascript.JSObject jso = null;
try {
Object o = jsConstructor.newInstance(new Object[]{new Long(params)});
jso = (netscape.javascript.JSObject)o;
} catch (Exception e) {
m_jvm.trace(e, PluggableJVM.LOG_ERROR);
}
return jso;
}
public static HostObjectPeerFactory start(PluggableJVM jvm, Long data)
{
MozillaPeerFactory factory = null;
try {
factory = new MozillaPeerFactory(jvm, data.longValue());
} catch (Exception e) {
jvm.trace("MOZILLA FACTORY NOT CREATED", PluggableJVM.LOG_ERROR);
e.printStackTrace();
return null;
}
return factory;
}
public String getCID()
{
return cid;
}
public HostObjectPeer create(int version)
{
return new MozillaHostObjectPeer(this, version);
}
public int handleEvent(SecurityCaps caps,
int eventID,
long eventData)
{
return 1;
}
private native int nativeHandleCall(int arg1, long arg2);
public int handleCall(SecurityCaps caps, int arg1, long arg2)
{
int rv = 0;
if (arg1 > 0)
rv = nativeHandleCall(arg1, arg2);
else
rv = 1;
return rv;
}
public int destroy(SecurityCaps caps)
{
return 1;
}
public PermissionCollection getPermissions(CodeSource codesource)
{
Permissions perms = new Permissions();
URL location = codesource.getLocation();
if (m_codebase != null && location != null) {
for (int i=0; i<m_codebase.length; i++)
{
// XXX: maybe I'm totally wrong here
if (location.equals(m_codebase[i]))
{
PluggableJVM.trace("extension granted all permissions to own codesource "+codesource,
PluggableJVM.LOG_WARNING);
perms.add(new java.security.AllPermission());
return perms;
}
}
}
perms.add(new RuntimePermission("accessClassInPackage.sun.jvmp.mozilla"));
return perms;
}
private void loadLibrary() throws UnsatisfiedLinkError
{
String libname = "wf_moz6";
try
{
System.loadLibrary(libname);
}
catch (UnsatisfiedLinkError ex)
{
PluggableJVM.trace("System could not load DLL: " + libname,
PluggableJVM.LOG_ERROR);
PluggableJVM.trace("Path is:" +
System.getProperty("java.library.path"),
PluggableJVM.LOG_WARNING);
PluggableJVM.trace(ex.toString(),
PluggableJVM.LOG_WARNING);
throw ex;
};
}
/**
* AccessControlDecider methods
*/
public int decide(CallingContext ctx, String principal, int cap_no)
{
return NA;
}
public boolean belongs(int cap_no)
{
return false;
}
/**
* BrowserSupport methods
*/
public ProxyInfo getProxyInfoForURL(URL url)
{
String s = nativeGetProxyInfoForURL(url.toString());
m_jvm.trace("Proxy string for:\""+
url.toString() +"\" is \""+s+"\"",
PluggableJVM.LOG_DEBUG);
ProxyInfo info = extractAutoProxySetting(s);
return info;
}
public URLConnection getConnectionForURL(URL url)
{
return null;
}
private native String nativeGetProxyInfoForURL(String s);
private ProxyInfo extractAutoProxySetting(String s)
{
if (s != null)
{
StringTokenizer st = new StringTokenizer(s, ";", false);
if (st.hasMoreTokens())
{
String pattern = st.nextToken();
int i = pattern.indexOf("PROXY");
if (i != -1) {
// "PROXY" is specified
return new ProxyInfo(pattern.substring(i + 6));
}
i = pattern.indexOf("SOCKS");
if (i != -1)
{
// "SOCKS" is specified
return new ProxyInfo(null, pattern.substring(i + 6));
}
}
}
// proxy string contains 'DIRECT' or unrecognized text
return new ProxyInfo(null, -1);
}
public int getID()
{
return m_id;
}
public void setID(int id)
{
if (m_id != 0) return;
m_id = id;
}
}

Просмотреть файл

@ -0,0 +1,75 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: MozillaSecurityManager.java,v 1.3 2001/07/12 20:26:18 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
package sun.jvmp.mozilla;
import sun.jvmp.*;
import sun.jvmp.security.*;
import sun.jvmp.applet.*;
import java.security.*;
public class MozillaSecurityManager extends WFAppletSecurityManager
{
java.net.SocketPermission resolvePerm =
new java.net.SocketPermission("*", "resolve");
public void checkPackageAccess(final String p)
{
//System.err.println("checkPackageAccesss: "+p);
// this check used to prevent infinite recursion when calling implies()
// in JavaScriptProtectionDomain,, as it has to load some classes
if (p.equals("sun.jvmp.mozilla"))
{
return;
}
super.checkPackageAccess(p);
}
public void checkPermission(Permission p)
{
// this kludge is workaround for some bug/feature in Sun's JDK
// 1.3.1 and 1.4 related to handling proxies and applets
if (p != null && p instanceof java.net.SocketPermission)
{
String action = ((java.net.SocketPermission)p).getActions();
if ("resolve".equals(action)) return;
//AccessControlContext c = AccessController.getContext();
//System.err.println("p="+p+" ctx="+c);
}
super.checkPermission(p);
}
}

Просмотреть файл

@ -1,112 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: Aptest.java,v 1.1 2001/05/10 18:12:36 edburns%acm.org Exp $
*
*
* Contributor(s):
*
* Nikolay N. Igotti <inn@sparc.spb.su>
*/
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.text.*;
import java.net.*;
public class Aptest extends Applet implements Runnable {
Thread timer; // The thread that displays clock
int lastxs, lastys, lastxm,
lastym, lastxh, lastyh; // Dimensions used to draw hands
SimpleDateFormat formatter; // Formats the date displayed
String lastdate; // String to hold date displayed
Font clockFaceFont; // Font for number display on clock
Date currentDate; // Used to get date to display
Color handColor; // Color of main hands and dial
Color numberColor; // Color of second hand and numbers
public void init() {
Button b1 = new Button("Show status");
b1.setBounds(0, 0, 40, 40);
b1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
AppletContext ctx = getAppletContext();
ctx.showStatus("DONE SHOW STATUS");
}
});
Button b2 = new Button("Show document");
b2.setBounds(0, 0, 40, 40);
b2.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
AppletContext ctx = getAppletContext();
try {
ctx.showDocument(new URL("http://www.sun.com"));
} catch (Exception ex) {}
}
});
setLayout(new FlowLayout(FlowLayout.CENTER));
add(b1);
add(b2);
resize(300,300); // Set clock window size
}
public void start() {
timer = new Thread(this);
timer.start();
}
public void stop() {
timer = null;
}
public void run() {
Thread me = Thread.currentThread();
while (timer == me) {
try {
Thread.currentThread().sleep(100);
} catch (InterruptedException e) {
}
}
}
public void update(Graphics g) {
paint(g);
}
public String getAppletInfo() {
return "Title: A Clock \nAuthor: Rachel Gollub, 1995 \nAn analog clock.";
}
public String[][] getParameterInfo() {
String[][] info = {
{"bgcolor", "hexadecimal RGB number", "The background color. Default is the color of your browser."},
{"fgcolor1", "hexadecimal RGB number", "The color of the hands and dial. Default is blue."},
{"fgcolor2", "hexadecimal RGB number", "The color of the seconds hand and numbers. Default is dark gray."}
};
return info;
}
}

Просмотреть файл

@ -1,329 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: UnixShell.c,v 1.1 2001/05/10 18:12:37 edburns%acm.org Exp $
*
*
* Contributor(s):
*
* Nikolay N. Igotti <inn@sparc.spb.su>
*/
/* -*- Mode: C; tab-width: 4; -*- */
/******************************************************************************
* Copyright (c) 1996 Netscape Communications. All rights reserved.
******************************************************************************/
/*
* UnixShell.c
*
* Netscape Client Plugin API
* - Function that need to be implemented by plugin developers
*
* This file defines a "Template" plugin that plugin developers can use
* as the basis for a real plugin. This shell just provides empty
* implementations of all functions that the plugin can implement
* that will be called by Netscape (the NPP_xxx methods defined in
* npapi.h).
*
* dp Suresh <dp@netscape.com>
*
*/
#include <stdio.h>
#include "npapi.h"
/***********************************************************************
* Instance state information about the plugin.
*
* PLUGIN DEVELOPERS:
* Use this struct to hold per-instance information that you'll
* need in the various functions in this file.
***********************************************************************/
typedef struct _PluginInstance
{
int nothing;
} PluginInstance;
/***********************************************************************
*
* Empty implementations of plugin API functions
*
* PLUGIN DEVELOPERS:
* You will need to implement these functions as required by your
* plugin.
*
***********************************************************************/
char*
NPP_GetMIMEDescription(void)
{
return("mime/type:sample:Template Only");
}
NPError
NPP_GetValue(void *future, NPPVariable variable, void *value)
{
NPError err = NPERR_NO_ERROR;
switch (variable) {
case NPPVpluginNameString:
*((char **)value) = "Template plugin";
break;
case NPPVpluginDescriptionString:
*((char **)value) =
"This plugins handles nothing. This is only"
" a template.";
break;
default:
err = NPERR_GENERIC_ERROR;
}
return err;
}
NPError
NPP_Initialize(void)
{
return NPERR_NO_ERROR;
}
jref
NPP_GetJavaClass()
{
return NULL;
}
void
NPP_Shutdown(void)
{
}
NPError
NPP_New(NPMIMEType pluginType,
NPP instance,
uint16 mode,
int16 argc,
char* argn[],
char* argv[],
NPSavedData* saved)
{
PluginInstance* This;
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
instance->pdata = NPN_MemAlloc(sizeof(PluginInstance));
This = (PluginInstance*) instance->pdata;
if (This != NULL)
return NPERR_NO_ERROR;
else
return NPERR_OUT_OF_MEMORY_ERROR;
}
NPError
NPP_Destroy(NPP instance, NPSavedData** save)
{
PluginInstance* This;
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
This = (PluginInstance*) instance->pdata;
/* PLUGIN DEVELOPERS:
* If desired, call NP_MemAlloc to create a
* NPSavedDate structure containing any state information
* that you want restored if this plugin instance is later
* recreated.
*/
if (This != NULL) {
NPN_MemFree(instance->pdata);
instance->pdata = NULL;
}
return NPERR_NO_ERROR;
}
NPError
NPP_SetWindow(NPP instance, NPWindow* window)
{
PluginInstance* This;
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
if (window == NULL)
return NPERR_NO_ERROR;
This = (PluginInstance*) instance->pdata;
/*
* PLUGIN DEVELOPERS:
* Before setting window to point to the
* new window, you may wish to compare the new window
* info to the previous window (if any) to note window
* size changes, etc.
*/
return NPERR_NO_ERROR;
}
NPError
NPP_NewStream(NPP instance,
NPMIMEType type,
NPStream *stream,
NPBool seekable,
uint16 *stype)
{
NPByteRange range;
PluginInstance* This;
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
This = (PluginInstance*) instance->pdata;
return NPERR_NO_ERROR;
}
/* PLUGIN DEVELOPERS:
* These next 2 functions are directly relevant in a plug-in which
* handles the data in a streaming manner. If you want zero bytes
* because no buffer space is YET available, return 0. As long as
* the stream has not been written to the plugin, Navigator will
* continue trying to send bytes. If the plugin doesn't want them,
* just return some large number from NPP_WriteReady(), and
* ignore them in NPP_Write(). For a NP_ASFILE stream, they are
* still called but can safely be ignored using this strategy.
*/
int32 STREAMBUFSIZE = 0X0FFFFFFF; /* If we are reading from a file in NPAsFile
* mode so we can take any size stream in our
* write call (since we ignore it) */
int32
NPP_WriteReady(NPP instance, NPStream *stream)
{
PluginInstance* This;
if (instance != NULL)
This = (PluginInstance*) instance->pdata;
return STREAMBUFSIZE;
}
int32
NPP_Write(NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer)
{
if (instance != NULL)
{
PluginInstance* This = (PluginInstance*) instance->pdata;
}
return len; /* The number of bytes accepted */
}
NPError
NPP_DestroyStream(NPP instance, NPStream *stream, NPError reason)
{
PluginInstance* This;
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
This = (PluginInstance*) instance->pdata;
return NPERR_NO_ERROR;
}
void
NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname)
{
PluginInstance* This;
if (instance != NULL)
This = (PluginInstance*) instance->pdata;
}
void
NPP_Print(NPP instance, NPPrint* printInfo)
{
if(printInfo == NULL)
return;
if (instance != NULL) {
PluginInstance* This = (PluginInstance*) instance->pdata;
if (printInfo->mode == NP_FULL) {
/*
* PLUGIN DEVELOPERS:
* If your plugin would like to take over
* printing completely when it is in full-screen mode,
* set printInfo->pluginPrinted to TRUE and print your
* plugin as you see fit. If your plugin wants Netscape
* to handle printing in this case, set
* printInfo->pluginPrinted to FALSE (the default) and
* do nothing. If you do want to handle printing
* yourself, printOne is true if the print button
* (as opposed to the print menu) was clicked.
* On the Macintosh, platformPrint is a THPrint; on
* Windows, platformPrint is a structure
* (defined in npapi.h) containing the printer name, port,
* etc.
*/
void* platformPrint =
printInfo->print.fullPrint.platformPrint;
NPBool printOne =
printInfo->print.fullPrint.printOne;
/* Do the default*/
printInfo->print.fullPrint.pluginPrinted = FALSE;
}
else { /* If not fullscreen, we must be embedded */
/*
* PLUGIN DEVELOPERS:
* If your plugin is embedded, or is full-screen
* but you returned false in pluginPrinted above, NPP_Print
* will be called with mode == NP_EMBED. The NPWindow
* in the printInfo gives the location and dimensions of
* the embedded plugin on the printed page. On the
* Macintosh, platformPrint is the printer port; on
* Windows, platformPrint is the handle to the printing
* device context.
*/
NPWindow* printWindow =
&(printInfo->print.embedPrint.window);
void* platformPrint =
printInfo->print.embedPrint.platformPrint;
}
}
}

Просмотреть файл

@ -1,85 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: common.h,v 1.1 2001/05/10 18:12:36 edburns%acm.org Exp $
*
*
* Contributor(s):
*
* Nikolay N. Igotti <inn@sparc.spb.su>
*/
#ifndef _common_h
#define _common_h
#include "npapi.h"
/***********************************************************************
* Instance state information about the plugin.
*
* PLUGIN DEVELOPERS:
* Use this struct to hold per-instance information that you'll
* need in the various functions in this file.
***********************************************************************/
typedef struct _PluginInstance
{
void* info; /* really "this" */
NPP m_peer;
jint m_id;
jint m_wid;
int16 m_argc;
char** m_argn;
char** m_argv;
char* m_docbase;
} PluginInstance;
typedef struct _GlobalData
{
#ifdef XP_UNIX
Display* m_dpy;
/* message queue ID of shared memory transport in host -> JVM direction */
int m_msgid;
/* message queue ID of shared memory transport in JVM -> host direction */
int m_msgid1;
/* XID of widget used to notify browser about our requests */
XID m_xid;
#endif
} GlobalData;
#define PE_NOPE 0
#define PE_CREATE 1
#define PE_SETWINDOW 2
#define PE_DESTROY 3
#define PE_START 4
#define PE_STOP 5
#define PE_NEWPARAMS 6
#define PE_SETTYPE 7
#define PV_UNKNOWN 0
#define PV_MOZILLA6 1
#define PV_MOZILLA4 2
#define PT_UNKNOWN 0
#define PT_EMBED 1
#define PT_OBJECT 2
#define PT_APPLET 3
#define PT_PLUGLET 4
#define WFNetscape4VendorID 2 /* Netscape 4 */
#define WFNetscape4ExtVersion 1
#endif

Просмотреть файл

@ -1,667 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: jri.h,v 1.1 2001/05/10 18:12:36 edburns%acm.org Exp $
*
*
* Contributor(s):
*
* Nikolay N. Igotti <inn@sparc.spb.su>
*/
/* -*- Mode: C; tab-width: 4; -*- */
/*******************************************************************************
* Java Runtime Interface
* Copyright (c) 1996 Netscape Communications Corporation. All rights reserved.
******************************************************************************/
#ifndef JRI_H
#define JRI_H
#include "jritypes.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*******************************************************************************
* JRIEnv
******************************************************************************/
/* The type of the JRIEnv interface. */
typedef struct JRIEnvInterface JRIEnvInterface;
/* The type of a JRIEnv instance. */
typedef const JRIEnvInterface* JRIEnv;
/*******************************************************************************
* JRIEnv Operations
******************************************************************************/
#define JRI_DefineClass(env, classLoader, buf, bufLen) \
(((*(env))->DefineClass)(env, JRI_DefineClass_op, classLoader, buf, bufLen))
#define JRI_FindClass(env, name) \
(((*(env))->FindClass)(env, JRI_FindClass_op, name))
#define JRI_Throw(env, obj) \
(((*(env))->Throw)(env, JRI_Throw_op, obj))
#define JRI_ThrowNew(env, clazz, message) \
(((*(env))->ThrowNew)(env, JRI_ThrowNew_op, clazz, message))
#define JRI_ExceptionOccurred(env) \
(((*(env))->ExceptionOccurred)(env, JRI_ExceptionOccurred_op))
#define JRI_ExceptionDescribe(env) \
(((*(env))->ExceptionDescribe)(env, JRI_ExceptionDescribe_op))
#define JRI_ExceptionClear(env) \
(((*(env))->ExceptionClear)(env, JRI_ExceptionClear_op))
#define JRI_NewGlobalRef(env, ref) \
(((*(env))->NewGlobalRef)(env, JRI_NewGlobalRef_op, ref))
#define JRI_DisposeGlobalRef(env, gref) \
(((*(env))->DisposeGlobalRef)(env, JRI_DisposeGlobalRef_op, gref))
#define JRI_GetGlobalRef(env, gref) \
(((*(env))->GetGlobalRef)(env, JRI_GetGlobalRef_op, gref))
#define JRI_SetGlobalRef(env, gref, ref) \
(((*(env))->SetGlobalRef)(env, JRI_SetGlobalRef_op, gref, ref))
#define JRI_IsSameObject(env, a, b) \
(((*(env))->IsSameObject)(env, JRI_IsSameObject_op, a, b))
#define JRI_NewObject(env) ((*(env))->NewObject)
#define JRI_NewObjectV(env, clazz, methodID, args) \
(((*(env))->NewObjectV)(env, JRI_NewObject_op_va_list, clazz, methodID, args))
#define JRI_NewObjectA(env, clazz, method, args) \
(((*(env))->NewObjectA)(env, JRI_NewObject_op_array, clazz, methodID, args))
#define JRI_GetObjectClass(env, obj) \
(((*(env))->GetObjectClass)(env, JRI_GetObjectClass_op, obj))
#define JRI_IsInstanceOf(env, obj, clazz) \
(((*(env))->IsInstanceOf)(env, JRI_IsInstanceOf_op, obj, clazz))
#define JRI_GetMethodID(env, clazz, name, sig) \
(((*(env))->GetMethodID)(env, JRI_GetMethodID_op, clazz, name, sig))
#define JRI_CallMethod(env) ((*(env))->CallMethod)
#define JRI_CallMethodV(env, obj, methodID, args) \
(((*(env))->CallMethodV)(env, JRI_CallMethod_op_va_list, obj, methodID, args))
#define JRI_CallMethodA(env, obj, methodID, args) \
(((*(env))->CallMethodA)(env, JRI_CallMethod_op_array, obj, methodID, args))
#define JRI_CallMethodBoolean(env) ((*(env))->CallMethodBoolean)
#define JRI_CallMethodBooleanV(env, obj, methodID, args) \
(((*(env))->CallMethodBooleanV)(env, JRI_CallMethodBoolean_op_va_list, obj, methodID, args))
#define JRI_CallMethodBooleanA(env, obj, methodID, args) \
(((*(env))->CallMethodBooleanA)(env, JRI_CallMethodBoolean_op_array, obj, methodID, args))
#define JRI_CallMethodByte(env) ((*(env))->CallMethodByte)
#define JRI_CallMethodByteV(env, obj, methodID, args) \
(((*(env))->CallMethodByteV)(env, JRI_CallMethodByte_op_va_list, obj, methodID, args))
#define JRI_CallMethodByteA(env, obj, methodID, args) \
(((*(env))->CallMethodByteA)(env, JRI_CallMethodByte_op_array, obj, methodID, args))
#define JRI_CallMethodChar(env) ((*(env))->CallMethodChar)
#define JRI_CallMethodCharV(env, obj, methodID, args) \
(((*(env))->CallMethodCharV)(env, JRI_CallMethodChar_op_va_list, obj, methodID, args))
#define JRI_CallMethodCharA(env, obj, methodID, args) \
(((*(env))->CallMethodCharA)(env, JRI_CallMethodChar_op_array, obj, methodID, args))
#define JRI_CallMethodShort(env) ((*(env))->CallMethodShort)
#define JRI_CallMethodShortV(env, obj, methodID, args) \
(((*(env))->CallMethodShortV)(env, JRI_CallMethodShort_op_va_list, obj, methodID, args))
#define JRI_CallMethodShortA(env, obj, methodID, args) \
(((*(env))->CallMethodShortA)(env, JRI_CallMethodShort_op_array, obj, methodID, args))
#define JRI_CallMethodInt(env) ((*(env))->CallMethodInt)
#define JRI_CallMethodIntV(env, obj, methodID, args) \
(((*(env))->CallMethodIntV)(env, JRI_CallMethodInt_op_va_list, obj, methodID, args))
#define JRI_CallMethodIntA(env, obj, methodID, args) \
(((*(env))->CallMethodIntA)(env, JRI_CallMethodInt_op_array, obj, methodID, args))
#define JRI_CallMethodLong(env) ((*(env))->CallMethodLong)
#define JRI_CallMethodLongV(env, obj, methodID, args) \
(((*(env))->CallMethodLongV)(env, JRI_CallMethodLong_op_va_list, obj, methodID, args))
#define JRI_CallMethodLongA(env, obj, methodID, args) \
(((*(env))->CallMethodLongA)(env, JRI_CallMethodLong_op_array, obj, methodID, args))
#define JRI_CallMethodFloat(env) ((*(env))->CallMethodFloat)
#define JRI_CallMethodFloatV(env, obj, methodID, args) \
(((*(env))->CallMethodFloatV)(env, JRI_CallMethodFloat_op_va_list, obj, methodID, args))
#define JRI_CallMethodFloatA(env, obj, methodID, args) \
(((*(env))->CallMethodFloatA)(env, JRI_CallMethodFloat_op_array, obj, methodID, args))
#define JRI_CallMethodDouble(env) ((*(env))->CallMethodDouble)
#define JRI_CallMethodDoubleV(env, obj, methodID, args) \
(((*(env))->CallMethodDoubleV)(env, JRI_CallMethodDouble_op_va_list, obj, methodID, args))
#define JRI_CallMethodDoubleA(env, obj, methodID, args) \
(((*(env))->CallMethodDoubleA)(env, JRI_CallMethodDouble_op_array, obj, methodID, args))
#define JRI_GetFieldID(env, clazz, name, sig) \
(((*(env))->GetFieldID)(env, JRI_GetFieldID_op, clazz, name, sig))
#define JRI_GetField(env, obj, fieldID) \
(((*(env))->GetField)(env, JRI_GetField_op, obj, fieldID))
#define JRI_GetFieldBoolean(env, obj, fieldID) \
(((*(env))->GetFieldBoolean)(env, JRI_GetFieldBoolean_op, obj, fieldID))
#define JRI_GetFieldByte(env, obj, fieldID) \
(((*(env))->GetFieldByte)(env, JRI_GetFieldByte_op, obj, fieldID))
#define JRI_GetFieldChar(env, obj, fieldID) \
(((*(env))->GetFieldChar)(env, JRI_GetFieldChar_op, obj, fieldID))
#define JRI_GetFieldShort(env, obj, fieldID) \
(((*(env))->GetFieldShort)(env, JRI_GetFieldShort_op, obj, fieldID))
#define JRI_GetFieldInt(env, obj, fieldID) \
(((*(env))->GetFieldInt)(env, JRI_GetFieldInt_op, obj, fieldID))
#define JRI_GetFieldLong(env, obj, fieldID) \
(((*(env))->GetFieldLong)(env, JRI_GetFieldLong_op, obj, fieldID))
#define JRI_GetFieldFloat(env, obj, fieldID) \
(((*(env))->GetFieldFloat)(env, JRI_GetFieldFloat_op, obj, fieldID))
#define JRI_GetFieldDouble(env, obj, fieldID) \
(((*(env))->GetFieldDouble)(env, JRI_GetFieldDouble_op, obj, fieldID))
#define JRI_SetField(env, obj, fieldID, value) \
(((*(env))->SetField)(env, JRI_SetField_op, obj, fieldID, value))
#define JRI_SetFieldBoolean(env, obj, fieldID, value) \
(((*(env))->SetFieldBoolean)(env, JRI_SetFieldBoolean_op, obj, fieldID, value))
#define JRI_SetFieldByte(env, obj, fieldID, value) \
(((*(env))->SetFieldByte)(env, JRI_SetFieldByte_op, obj, fieldID, value))
#define JRI_SetFieldChar(env, obj, fieldID, value) \
(((*(env))->SetFieldChar)(env, JRI_SetFieldChar_op, obj, fieldID, value))
#define JRI_SetFieldShort(env, obj, fieldID, value) \
(((*(env))->SetFieldShort)(env, JRI_SetFieldShort_op, obj, fieldID, value))
#define JRI_SetFieldInt(env, obj, fieldID, value) \
(((*(env))->SetFieldInt)(env, JRI_SetFieldInt_op, obj, fieldID, value))
#define JRI_SetFieldLong(env, obj, fieldID, value) \
(((*(env))->SetFieldLong)(env, JRI_SetFieldLong_op, obj, fieldID, value))
#define JRI_SetFieldFloat(env, obj, fieldID, value) \
(((*(env))->SetFieldFloat)(env, JRI_SetFieldFloat_op, obj, fieldID, value))
#define JRI_SetFieldDouble(env, obj, fieldID, value) \
(((*(env))->SetFieldDouble)(env, JRI_SetFieldDouble_op, obj, fieldID, value))
#define JRI_IsSubclassOf(env, a, b) \
(((*(env))->IsSubclassOf)(env, JRI_IsSubclassOf_op, a, b))
#define JRI_GetStaticMethodID(env, clazz, name, sig) \
(((*(env))->GetStaticMethodID)(env, JRI_GetStaticMethodID_op, clazz, name, sig))
#define JRI_CallStaticMethod(env) ((*(env))->CallStaticMethod)
#define JRI_CallStaticMethodV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodV)(env, JRI_CallStaticMethod_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodA)(env, JRI_CallStaticMethod_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodBoolean(env) ((*(env))->CallStaticMethodBoolean)
#define JRI_CallStaticMethodBooleanV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodBooleanV)(env, JRI_CallStaticMethodBoolean_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodBooleanA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodBooleanA)(env, JRI_CallStaticMethodBoolean_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodByte(env) ((*(env))->CallStaticMethodByte)
#define JRI_CallStaticMethodByteV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodByteV)(env, JRI_CallStaticMethodByte_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodByteA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodByteA)(env, JRI_CallStaticMethodByte_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodChar(env) ((*(env))->CallStaticMethodChar)
#define JRI_CallStaticMethodCharV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodCharV)(env, JRI_CallStaticMethodChar_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodCharA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodCharA)(env, JRI_CallStaticMethodChar_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodShort(env) ((*(env))->CallStaticMethodShort)
#define JRI_CallStaticMethodShortV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodShortV)(env, JRI_CallStaticMethodShort_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodShortA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodShortA)(env, JRI_CallStaticMethodShort_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodInt(env) ((*(env))->CallStaticMethodInt)
#define JRI_CallStaticMethodIntV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodIntV)(env, JRI_CallStaticMethodInt_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodIntA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodIntA)(env, JRI_CallStaticMethodInt_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodLong(env) ((*(env))->CallStaticMethodLong)
#define JRI_CallStaticMethodLongV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodLongV)(env, JRI_CallStaticMethodLong_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodLongA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodLongA)(env, JRI_CallStaticMethodLong_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodFloat(env) ((*(env))->CallStaticMethodFloat)
#define JRI_CallStaticMethodFloatV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodFloatV)(env, JRI_CallStaticMethodFloat_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodFloatA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodFloatA)(env, JRI_CallStaticMethodFloat_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodDouble(env) ((*(env))->CallStaticMethodDouble)
#define JRI_CallStaticMethodDoubleV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodDoubleV)(env, JRI_CallStaticMethodDouble_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodDoubleA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodDoubleA)(env, JRI_CallStaticMethodDouble_op_array, clazz, methodID, args))
#define JRI_GetStaticFieldID(env, clazz, name, sig) \
(((*(env))->GetStaticFieldID)(env, JRI_GetStaticFieldID_op, clazz, name, sig))
#define JRI_GetStaticField(env, clazz, fieldID) \
(((*(env))->GetStaticField)(env, JRI_GetStaticField_op, clazz, fieldID))
#define JRI_GetStaticFieldBoolean(env, clazz, fieldID) \
(((*(env))->GetStaticFieldBoolean)(env, JRI_GetStaticFieldBoolean_op, clazz, fieldID))
#define JRI_GetStaticFieldByte(env, clazz, fieldID) \
(((*(env))->GetStaticFieldByte)(env, JRI_GetStaticFieldByte_op, clazz, fieldID))
#define JRI_GetStaticFieldChar(env, clazz, fieldID) \
(((*(env))->GetStaticFieldChar)(env, JRI_GetStaticFieldChar_op, clazz, fieldID))
#define JRI_GetStaticFieldShort(env, clazz, fieldID) \
(((*(env))->GetStaticFieldShort)(env, JRI_GetStaticFieldShort_op, clazz, fieldID))
#define JRI_GetStaticFieldInt(env, clazz, fieldID) \
(((*(env))->GetStaticFieldInt)(env, JRI_GetStaticFieldInt_op, clazz, fieldID))
#define JRI_GetStaticFieldLong(env, clazz, fieldID) \
(((*(env))->GetStaticFieldLong)(env, JRI_GetStaticFieldLong_op, clazz, fieldID))
#define JRI_GetStaticFieldFloat(env, clazz, fieldID) \
(((*(env))->GetStaticFieldFloat)(env, JRI_GetStaticFieldFloat_op, clazz, fieldID))
#define JRI_GetStaticFieldDouble(env, clazz, fieldID) \
(((*(env))->GetStaticFieldDouble)(env, JRI_GetStaticFieldDouble_op, clazz, fieldID))
#define JRI_SetStaticField(env, clazz, fieldID, value) \
(((*(env))->SetStaticField)(env, JRI_SetStaticField_op, clazz, fieldID, value))
#define JRI_SetStaticFieldBoolean(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldBoolean)(env, JRI_SetStaticFieldBoolean_op, clazz, fieldID, value))
#define JRI_SetStaticFieldByte(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldByte)(env, JRI_SetStaticFieldByte_op, clazz, fieldID, value))
#define JRI_SetStaticFieldChar(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldChar)(env, JRI_SetStaticFieldChar_op, clazz, fieldID, value))
#define JRI_SetStaticFieldShort(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldShort)(env, JRI_SetStaticFieldShort_op, clazz, fieldID, value))
#define JRI_SetStaticFieldInt(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldInt)(env, JRI_SetStaticFieldInt_op, clazz, fieldID, value))
#define JRI_SetStaticFieldLong(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldLong)(env, JRI_SetStaticFieldLong_op, clazz, fieldID, value))
#define JRI_SetStaticFieldFloat(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldFloat)(env, JRI_SetStaticFieldFloat_op, clazz, fieldID, value))
#define JRI_SetStaticFieldDouble(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldDouble)(env, JRI_SetStaticFieldDouble_op, clazz, fieldID, value))
#define JRI_NewString(env, unicode, len) \
(((*(env))->NewString)(env, JRI_NewString_op, unicode, len))
#define JRI_GetStringLength(env, string) \
(((*(env))->GetStringLength)(env, JRI_GetStringLength_op, string))
#define JRI_GetStringChars(env, string) \
(((*(env))->GetStringChars)(env, JRI_GetStringChars_op, string))
#define JRI_NewStringUTF(env, utf, len) \
(((*(env))->NewStringUTF)(env, JRI_NewStringUTF_op, utf, len))
#define JRI_GetStringUTFLength(env, string) \
(((*(env))->GetStringUTFLength)(env, JRI_GetStringUTFLength_op, string))
#define JRI_GetStringUTFChars(env, string) \
(((*(env))->GetStringUTFChars)(env, JRI_GetStringUTFChars_op, string))
#define JRI_NewScalarArray(env, length, elementSig, initialElements) \
(((*(env))->NewScalarArray)(env, JRI_NewScalarArray_op, length, elementSig, initialElements))
#define JRI_GetScalarArrayLength(env, array) \
(((*(env))->GetScalarArrayLength)(env, JRI_GetScalarArrayLength_op, array))
#define JRI_GetScalarArrayElements(env, array) \
(((*(env))->GetScalarArrayElements)(env, JRI_GetScalarArrayElements_op, array))
#define JRI_NewObjectArray(env, length, elementClass, initialElement) \
(((*(env))->NewObjectArray)(env, JRI_NewObjectArray_op, length, elementClass, initialElement))
#define JRI_GetObjectArrayLength(env, array) \
(((*(env))->GetObjectArrayLength)(env, JRI_GetObjectArrayLength_op, array))
#define JRI_GetObjectArrayElement(env, array, index) \
(((*(env))->GetObjectArrayElement)(env, JRI_GetObjectArrayElement_op, array, index))
#define JRI_SetObjectArrayElement(env, array, index, value) \
(((*(env))->SetObjectArrayElement)(env, JRI_SetObjectArrayElement_op, array, index, value))
#define JRI_RegisterNatives(env, clazz, nameAndSigArray, nativeProcArray) \
(((*(env))->RegisterNatives)(env, JRI_RegisterNatives_op, clazz, nameAndSigArray, nativeProcArray))
#define JRI_UnregisterNatives(env, clazz) \
(((*(env))->UnregisterNatives)(env, JRI_UnregisterNatives_op, clazz))
/*******************************************************************************
* JRIEnv Interface
******************************************************************************/
struct java_lang_ClassLoader;
struct java_lang_Class;
struct java_lang_Throwable;
struct java_lang_Object;
struct java_lang_String;
struct JRIEnvInterface {
void* reserved0;
void* reserved1;
void* reserved2;
void* reserved3;
struct java_lang_Class* (*FindClass)(JRIEnv* env, jint op, const char* a);
void (*Throw)(JRIEnv* env, jint op, struct java_lang_Throwable* a);
void (*ThrowNew)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b);
struct java_lang_Throwable* (*ExceptionOccurred)(JRIEnv* env, jint op);
void (*ExceptionDescribe)(JRIEnv* env, jint op);
void (*ExceptionClear)(JRIEnv* env, jint op);
jglobal (*NewGlobalRef)(JRIEnv* env, jint op, void* a);
void (*DisposeGlobalRef)(JRIEnv* env, jint op, jglobal a);
void* (*GetGlobalRef)(JRIEnv* env, jint op, jglobal a);
void (*SetGlobalRef)(JRIEnv* env, jint op, jglobal a, void* b);
jbool (*IsSameObject)(JRIEnv* env, jint op, void* a, void* b);
void* (*NewObject)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
void* (*NewObjectV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
void* (*NewObjectA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
struct java_lang_Class* (*GetObjectClass)(JRIEnv* env, jint op, void* a);
jbool (*IsInstanceOf)(JRIEnv* env, jint op, void* a, struct java_lang_Class* b);
jint (*GetMethodID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
void* (*CallMethod)(JRIEnv* env, jint op, void* a, jint b, ...);
void* (*CallMethodV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
void* (*CallMethodA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jbool (*CallMethodBoolean)(JRIEnv* env, jint op, void* a, jint b, ...);
jbool (*CallMethodBooleanV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jbool (*CallMethodBooleanA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jbyte (*CallMethodByte)(JRIEnv* env, jint op, void* a, jint b, ...);
jbyte (*CallMethodByteV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jbyte (*CallMethodByteA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jchar (*CallMethodChar)(JRIEnv* env, jint op, void* a, jint b, ...);
jchar (*CallMethodCharV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jchar (*CallMethodCharA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jshort (*CallMethodShort)(JRIEnv* env, jint op, void* a, jint b, ...);
jshort (*CallMethodShortV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jshort (*CallMethodShortA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jint (*CallMethodInt)(JRIEnv* env, jint op, void* a, jint b, ...);
jint (*CallMethodIntV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jint (*CallMethodIntA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jlong (*CallMethodLong)(JRIEnv* env, jint op, void* a, jint b, ...);
jlong (*CallMethodLongV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jlong (*CallMethodLongA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jfloat (*CallMethodFloat)(JRIEnv* env, jint op, void* a, jint b, ...);
jfloat (*CallMethodFloatV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jfloat (*CallMethodFloatA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jdouble (*CallMethodDouble)(JRIEnv* env, jint op, void* a, jint b, ...);
jdouble (*CallMethodDoubleV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jdouble (*CallMethodDoubleA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jint (*GetFieldID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
void* (*GetField)(JRIEnv* env, jint op, void* a, jint b);
jbool (*GetFieldBoolean)(JRIEnv* env, jint op, void* a, jint b);
jbyte (*GetFieldByte)(JRIEnv* env, jint op, void* a, jint b);
jchar (*GetFieldChar)(JRIEnv* env, jint op, void* a, jint b);
jshort (*GetFieldShort)(JRIEnv* env, jint op, void* a, jint b);
jint (*GetFieldInt)(JRIEnv* env, jint op, void* a, jint b);
jlong (*GetFieldLong)(JRIEnv* env, jint op, void* a, jint b);
jfloat (*GetFieldFloat)(JRIEnv* env, jint op, void* a, jint b);
jdouble (*GetFieldDouble)(JRIEnv* env, jint op, void* a, jint b);
void (*SetField)(JRIEnv* env, jint op, void* a, jint b, void* c);
void (*SetFieldBoolean)(JRIEnv* env, jint op, void* a, jint b, jbool c);
void (*SetFieldByte)(JRIEnv* env, jint op, void* a, jint b, jbyte c);
void (*SetFieldChar)(JRIEnv* env, jint op, void* a, jint b, jchar c);
void (*SetFieldShort)(JRIEnv* env, jint op, void* a, jint b, jshort c);
void (*SetFieldInt)(JRIEnv* env, jint op, void* a, jint b, jint c);
void (*SetFieldLong)(JRIEnv* env, jint op, void* a, jint b, jlong c);
void (*SetFieldFloat)(JRIEnv* env, jint op, void* a, jint b, jfloat c);
void (*SetFieldDouble)(JRIEnv* env, jint op, void* a, jint b, jdouble c);
jbool (*IsSubclassOf)(JRIEnv* env, jint op, struct java_lang_Class* a, struct java_lang_Class* b);
jint (*GetStaticMethodID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
void* (*CallStaticMethod)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
void* (*CallStaticMethodV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
void* (*CallStaticMethodA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jbool (*CallStaticMethodBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jbool (*CallStaticMethodBooleanV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jbool (*CallStaticMethodBooleanA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jbyte (*CallStaticMethodByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jbyte (*CallStaticMethodByteV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jbyte (*CallStaticMethodByteA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jchar (*CallStaticMethodChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jchar (*CallStaticMethodCharV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jchar (*CallStaticMethodCharA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jshort (*CallStaticMethodShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jshort (*CallStaticMethodShortV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jshort (*CallStaticMethodShortA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jint (*CallStaticMethodInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jint (*CallStaticMethodIntV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jint (*CallStaticMethodIntA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jlong (*CallStaticMethodLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jlong (*CallStaticMethodLongV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jlong (*CallStaticMethodLongA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jfloat (*CallStaticMethodFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jfloat (*CallStaticMethodFloatV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jfloat (*CallStaticMethodFloatA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jdouble (*CallStaticMethodDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jdouble (*CallStaticMethodDoubleV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jdouble (*CallStaticMethodDoubleA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jint (*GetStaticFieldID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
void* (*GetStaticField)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jbool (*GetStaticFieldBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jbyte (*GetStaticFieldByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jchar (*GetStaticFieldChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jshort (*GetStaticFieldShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jint (*GetStaticFieldInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jlong (*GetStaticFieldLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jfloat (*GetStaticFieldFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jdouble (*GetStaticFieldDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
void (*SetStaticField)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, void* c);
void (*SetStaticFieldBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jbool c);
void (*SetStaticFieldByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jbyte c);
void (*SetStaticFieldChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jchar c);
void (*SetStaticFieldShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jshort c);
void (*SetStaticFieldInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jint c);
void (*SetStaticFieldLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jlong c);
void (*SetStaticFieldFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jfloat c);
void (*SetStaticFieldDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jdouble c);
struct java_lang_String* (*NewString)(JRIEnv* env, jint op, const jchar* a, jint b);
jint (*GetStringLength)(JRIEnv* env, jint op, struct java_lang_String* a);
const jchar* (*GetStringChars)(JRIEnv* env, jint op, struct java_lang_String* a);
struct java_lang_String* (*NewStringUTF)(JRIEnv* env, jint op, const jbyte* a, jint b);
jint (*GetStringUTFLength)(JRIEnv* env, jint op, struct java_lang_String* a);
const jbyte* (*GetStringUTFChars)(JRIEnv* env, jint op, struct java_lang_String* a);
void* (*NewScalarArray)(JRIEnv* env, jint op, jint a, const char* b, const jbyte* c);
jint (*GetScalarArrayLength)(JRIEnv* env, jint op, void* a);
jbyte* (*GetScalarArrayElements)(JRIEnv* env, jint op, void* a);
void* (*NewObjectArray)(JRIEnv* env, jint op, jint a, struct java_lang_Class* b, void* c);
jint (*GetObjectArrayLength)(JRIEnv* env, jint op, void* a);
void* (*GetObjectArrayElement)(JRIEnv* env, jint op, void* a, jint b);
void (*SetObjectArrayElement)(JRIEnv* env, jint op, void* a, jint b, void* c);
void (*RegisterNatives)(JRIEnv* env, jint op, struct java_lang_Class* a, char** b, void** c);
void (*UnregisterNatives)(JRIEnv* env, jint op, struct java_lang_Class* a);
struct java_lang_Class* (*DefineClass)(JRIEnv* env, jint op, struct java_lang_ClassLoader* a, jbyte* b, jsize bLen);
};
/*******************************************************************************
* JRIEnv Operation IDs
******************************************************************************/
typedef enum JRIEnvOperations {
JRI_Reserved0_op,
JRI_Reserved1_op,
JRI_Reserved2_op,
JRI_Reserved3_op,
JRI_FindClass_op,
JRI_Throw_op,
JRI_ThrowNew_op,
JRI_ExceptionOccurred_op,
JRI_ExceptionDescribe_op,
JRI_ExceptionClear_op,
JRI_NewGlobalRef_op,
JRI_DisposeGlobalRef_op,
JRI_GetGlobalRef_op,
JRI_SetGlobalRef_op,
JRI_IsSameObject_op,
JRI_NewObject_op,
JRI_NewObject_op_va_list,
JRI_NewObject_op_array,
JRI_GetObjectClass_op,
JRI_IsInstanceOf_op,
JRI_GetMethodID_op,
JRI_CallMethod_op,
JRI_CallMethod_op_va_list,
JRI_CallMethod_op_array,
JRI_CallMethodBoolean_op,
JRI_CallMethodBoolean_op_va_list,
JRI_CallMethodBoolean_op_array,
JRI_CallMethodByte_op,
JRI_CallMethodByte_op_va_list,
JRI_CallMethodByte_op_array,
JRI_CallMethodChar_op,
JRI_CallMethodChar_op_va_list,
JRI_CallMethodChar_op_array,
JRI_CallMethodShort_op,
JRI_CallMethodShort_op_va_list,
JRI_CallMethodShort_op_array,
JRI_CallMethodInt_op,
JRI_CallMethodInt_op_va_list,
JRI_CallMethodInt_op_array,
JRI_CallMethodLong_op,
JRI_CallMethodLong_op_va_list,
JRI_CallMethodLong_op_array,
JRI_CallMethodFloat_op,
JRI_CallMethodFloat_op_va_list,
JRI_CallMethodFloat_op_array,
JRI_CallMethodDouble_op,
JRI_CallMethodDouble_op_va_list,
JRI_CallMethodDouble_op_array,
JRI_GetFieldID_op,
JRI_GetField_op,
JRI_GetFieldBoolean_op,
JRI_GetFieldByte_op,
JRI_GetFieldChar_op,
JRI_GetFieldShort_op,
JRI_GetFieldInt_op,
JRI_GetFieldLong_op,
JRI_GetFieldFloat_op,
JRI_GetFieldDouble_op,
JRI_SetField_op,
JRI_SetFieldBoolean_op,
JRI_SetFieldByte_op,
JRI_SetFieldChar_op,
JRI_SetFieldShort_op,
JRI_SetFieldInt_op,
JRI_SetFieldLong_op,
JRI_SetFieldFloat_op,
JRI_SetFieldDouble_op,
JRI_IsSubclassOf_op,
JRI_GetStaticMethodID_op,
JRI_CallStaticMethod_op,
JRI_CallStaticMethod_op_va_list,
JRI_CallStaticMethod_op_array,
JRI_CallStaticMethodBoolean_op,
JRI_CallStaticMethodBoolean_op_va_list,
JRI_CallStaticMethodBoolean_op_array,
JRI_CallStaticMethodByte_op,
JRI_CallStaticMethodByte_op_va_list,
JRI_CallStaticMethodByte_op_array,
JRI_CallStaticMethodChar_op,
JRI_CallStaticMethodChar_op_va_list,
JRI_CallStaticMethodChar_op_array,
JRI_CallStaticMethodShort_op,
JRI_CallStaticMethodShort_op_va_list,
JRI_CallStaticMethodShort_op_array,
JRI_CallStaticMethodInt_op,
JRI_CallStaticMethodInt_op_va_list,
JRI_CallStaticMethodInt_op_array,
JRI_CallStaticMethodLong_op,
JRI_CallStaticMethodLong_op_va_list,
JRI_CallStaticMethodLong_op_array,
JRI_CallStaticMethodFloat_op,
JRI_CallStaticMethodFloat_op_va_list,
JRI_CallStaticMethodFloat_op_array,
JRI_CallStaticMethodDouble_op,
JRI_CallStaticMethodDouble_op_va_list,
JRI_CallStaticMethodDouble_op_array,
JRI_GetStaticFieldID_op,
JRI_GetStaticField_op,
JRI_GetStaticFieldBoolean_op,
JRI_GetStaticFieldByte_op,
JRI_GetStaticFieldChar_op,
JRI_GetStaticFieldShort_op,
JRI_GetStaticFieldInt_op,
JRI_GetStaticFieldLong_op,
JRI_GetStaticFieldFloat_op,
JRI_GetStaticFieldDouble_op,
JRI_SetStaticField_op,
JRI_SetStaticFieldBoolean_op,
JRI_SetStaticFieldByte_op,
JRI_SetStaticFieldChar_op,
JRI_SetStaticFieldShort_op,
JRI_SetStaticFieldInt_op,
JRI_SetStaticFieldLong_op,
JRI_SetStaticFieldFloat_op,
JRI_SetStaticFieldDouble_op,
JRI_NewString_op,
JRI_GetStringLength_op,
JRI_GetStringChars_op,
JRI_NewStringUTF_op,
JRI_GetStringUTFLength_op,
JRI_GetStringUTFChars_op,
JRI_NewScalarArray_op,
JRI_GetScalarArrayLength_op,
JRI_GetScalarArrayElements_op,
JRI_NewObjectArray_op,
JRI_GetObjectArrayLength_op,
JRI_GetObjectArrayElement_op,
JRI_SetObjectArrayElement_op,
JRI_RegisterNatives_op,
JRI_UnregisterNatives_op,
JRI_DefineClass_op
} JRIEnvOperations;
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* JRI_H */
/******************************************************************************/

Просмотреть файл

@ -1,196 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: jri_md.h,v 1.1 2001/05/10 18:12:36 edburns%acm.org Exp $
*
*
* Contributor(s):
*
* Nikolay N. Igotti <inn@sparc.spb.su>
*/
/* -*- Mode: C; tab-width: 4; -*- */
/*******************************************************************************
* Java Runtime Interface - Machine Dependent Types
* Copyright (c) 1996 Netscape Communications Corporation. All rights reserved.
******************************************************************************/
#ifndef JRI_MD_H
#define JRI_MD_H
#include <assert.h>
#include "jni.h"
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************************
* WHAT'S UP WITH THIS FILE?
*
* This is where we define the mystical JRI_PUBLIC_API macro that works on all
* platforms. If you're running with Visual C++, Symantec C, or Borland's
* development environment on the PC, you're all set. Or if you're on the Mac
* with Metrowerks, Symantec or MPW with SC you're ok too. For UNIX it shouldn't
* matter.
*
* On UNIX though you probably care about a couple of other symbols though:
* IS_LITTLE_ENDIAN must be defined for little-endian systems
* HAVE_LONG_LONG must be defined on systems that have 'long long' integers
* HAVE_ALIGNED_LONGLONGS must be defined if long-longs must be 8 byte aligned
* HAVE_ALIGNED_DOUBLES must be defined if doubles must be 8 byte aligned
* IS_64 must be defined on 64-bit machines (like Dec Alpha)
******************************************************************************/
/* DLL Entry modifiers... */
/* PC */
#if defined(XP_PC) || defined(_WINDOWS) || defined(WIN32) || defined(_WIN32)
# include <windows.h>
# if defined(_MSC_VER)
# if defined(WIN32) || defined(_WIN32)
# define JRI_PUBLIC_API(ResultType) _declspec(dllexport) ResultType
# define JRI_CALLBACK
# else /* !_WIN32 */
# if defined(_WINDLL)
# define JRI_PUBLIC_API(ResultType) ResultType __cdecl __export __loadds
# define JRI_CALLBACK __loadds
# else /* !WINDLL */
# define JRI_PUBLIC_API(ResultType) ResultType __cdecl __export
# define JRI_CALLBACK __export
# endif /* !WINDLL */
# endif /* !_WIN32 */
# elif defined(__BORLANDC__)
# if defined(WIN32) || defined(_WIN32)
# define JRI_PUBLIC_API(ResultType) __export ResultType
# define JRI_CALLBACK
# else /* !_WIN32 */
# define JRI_PUBLIC_API(ResultType) ResultType _cdecl _export _loadds
# define JRI_CALLBACK _loadds
# endif
# else
# error Unsupported PC development environment.
# endif
# ifndef IS_LITTLE_ENDIAN
# define IS_LITTLE_ENDIAN
# endif
/* Mac */
#elif macintosh || Macintosh || THINK_C
# if defined(__MWERKS__) /* Metrowerks */
# if !__option(enumsalwaysint)
# error You need to define 'Enums Always Int' for your project.
# endif
# if defined(GENERATING68K) && !GENERATINGCFM
# if !__option(fourbyteints)
# error You need to define 'Struct Alignment: 68k' for your project.
# endif
# endif /* !GENERATINGCFM */
# elif defined(__SC__) /* Symantec */
# error What are the Symantec defines? (warren@netscape.com)
# elif macintosh && applec /* MPW */
# error Please upgrade to the latest MPW compiler (SC).
# else
# error Unsupported Mac development environment.
# endif
# define JRI_PUBLIC_API(ResultType) ResultType
# define JRI_CALLBACK
/* Unix or else */
#else
# define JRI_PUBLIC_API(ResultType) ResultType
# define JRI_CALLBACK
#endif
#ifndef FAR /* for non-Win16 */
#define FAR
#endif
/******************************************************************************/
/* Java Scalar Types */
typedef unsigned char jbool;
#ifdef IS_64 /* XXX ok for alpha, but not right on all 64-bit architectures */
typedef unsigned int juint;
typedef int jint;
#else
typedef unsigned long juint;
#endif
/******************************************************************************/
/*
** JDK Stuff -- This stuff is still needed while we're using the JDK
** dynamic linking strategy to call native methods.
*/
typedef union JRI_JDK_stack_item {
/* Non pointer items */
jint i;
jfloat f;
jint o;
/* Pointer items */
void *h;
void *p;
unsigned char *addr;
#ifdef IS_64
double d;
long l; /* == 64bits! */
#endif
} JRI_JDK_stack_item;
typedef union JRI_JDK_Java8Str {
jint x[2];
jdouble d;
jlong l;
void *p;
float f;
} JRI_JDK_Java8;
#ifdef HAVE_ALIGNED_LONGLONGS
#define JRI_GET_INT64(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \
((_t).x[1] = ((jint*)(_addr))[1]), \
(_t).l )
#define JRI_SET_INT64(_t, _addr, _v) ( (_t).l = (_v), \
((jint*)(_addr))[0] = (_t).x[0], \
((jint*)(_addr))[1] = (_t).x[1] )
#else
#define JRI_GET_INT64(_t,_addr) (*(jlong*)(_addr))
#define JRI_SET_INT64(_t, _addr, _v) (*(jlong*)(_addr) = (_v))
#endif
/* If double's must be aligned on doubleword boundaries then define this */
#ifdef HAVE_ALIGNED_DOUBLES
#define JRI_GET_DOUBLE(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \
((_t).x[1] = ((jint*)(_addr))[1]), \
(_t).d )
#define JRI_SET_DOUBLE(_t, _addr, _v) ( (_t).d = (_v), \
((jint*)(_addr))[0] = (_t).x[0], \
((jint*)(_addr))[1] = (_t).x[1] )
#else
#define JRI_GET_DOUBLE(_t,_addr) (*(jdouble*)(_addr))
#define JRI_SET_DOUBLE(_t, _addr, _v) (*(jdouble*)(_addr) = (_v))
#endif
/******************************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* JRI_MD_H */
/******************************************************************************/

Просмотреть файл

@ -1,193 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: jritypes.h,v 1.1 2001/05/10 18:12:36 edburns%acm.org Exp $
*
*
* Contributor(s):
*
* Nikolay N. Igotti <inn@sparc.spb.su>
*/
/* -*- Mode: C; tab-width: 4; -*- */
/*******************************************************************************
* Java Runtime Interface
* Copyright (c) 1996 Netscape Communications Corporation. All rights reserved.
******************************************************************************/
#ifndef JRITYPES_H
#define JRITYPES_H
#include "jri_md.h"
#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************************
* Types
******************************************************************************/
struct JRIEnvInterface;
typedef void* JRIRef;
typedef void* JRIGlobalRef;
typedef jint JRIInterfaceID[4];
typedef jint JRIFieldID;
typedef jint JRIMethodID;
/* synonyms: */
typedef JRIGlobalRef jglobal;
typedef JRIRef jref;
typedef union JRIValue {
jbool z;
jbyte b;
jchar c;
jshort s;
jint i;
jlong l;
jfloat f;
jdouble d;
jref r;
} JRIValue;
typedef enum JRIBoolean {
JRIFalse = 0,
JRITrue = 1
} JRIBoolean;
typedef enum JRIConstant {
JRIUninitialized = -1
} JRIConstant;
/* convenience types: */
#define JRIConstructorMethodName "<init>"
/*******************************************************************************
* Signature Construction Macros
******************************************************************************/
/*
** These macros can be used to construct signature strings. Hopefully their names
** are a little easier to remember than the single character they correspond to.
** For example, to specify the signature of the method:
**
** public int read(byte b[], int off, int len);
**
** you could write something like this in C:
**
** char* readSig = JRISigMethod(JRISigArray(JRISigByte)
** JRISigInt
** JRISigInt) JRISigInt;
**
** Of course, don't put commas between the types.
*/
#define JRISigArray(T) "[" T
#define JRISigByte "B"
#define JRISigChar "C"
#define JRISigClass(name) "L" name ";"
#define JRISigFloat "F"
#define JRISigDouble "D"
#define JRISigMethod(args) "(" args ")"
#define JRISigNoArgs ""
#define JRISigInt "I"
#define JRISigLong "J"
#define JRISigShort "S"
#define JRISigVoid "V"
#define JRISigBoolean "Z"
/*******************************************************************************
* Environments
******************************************************************************/
extern JRI_PUBLIC_API(const struct JRIEnvInterface**)
JRI_GetCurrentEnv(void);
/*******************************************************************************
* Specific Scalar Array Types
******************************************************************************/
/*
** The JRI Native Method Interface does not support boolean arrays. This
** is to allow Java runtime implementations to optimize boolean array
** storage. Using the ScalarArray operations on boolean arrays is bound
** to fail, so convert any boolean arrays to byte arrays in Java before
** passing them to a native method.
*/
#define JRI_NewByteArray(env, length, initialValues) \
JRI_NewScalarArray(env, length, JRISigByte, (jbyte*)(initialValues))
#define JRI_GetByteArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetByteArrayElements(env, array) \
JRI_GetScalarArrayElements(env, array)
#define JRI_NewCharArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jchar)), JRISigChar, (jbyte*)(initialValues))
#define JRI_GetCharArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetCharArrayElements(env, array) \
((jchar*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewShortArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jshort)), JRISigShort, (jbyte*)(initialValues))
#define JRI_GetShortArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetShortArrayElements(env, array) \
((jshort*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewIntArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jint)), JRISigInt, (jbyte*)(initialValues))
#define JRI_GetIntArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetIntArrayElements(env, array) \
((jint*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewLongArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jlong)), JRISigLong, (jbyte*)(initialValues))
#define JRI_GetLongArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetLongArrayElements(env, array) \
((jlong*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewFloatArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jfloat)), JRISigFloat, (jbyte*)(initialValues))
#define JRI_GetFloatArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetFloatArrayElements(env, array) \
((jfloat*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewDoubleArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jdouble)), JRISigDouble, (jbyte*)(initialValues))
#define JRI_GetDoubleArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetDoubleArrayElements(env, array) \
((jdouble*)JRI_GetScalarArrayElements(env, array))
/******************************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* JRITYPES_H */
/******************************************************************************/

Просмотреть файл

@ -0,0 +1,127 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is The Waterfall Java Plugin Module
*
* The Initial Developer of the Original Code is Sun Microsystems Inc
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: installer.c,v 1.1 2001/07/12 20:26:30 edburns%acm.org Exp $
*
* Contributor(s):
*
* Nikolay N. Igotti <nikolay.igotti@Sun.Com>
*/
#include <windows.h>
#include <stdio.h>
//#include "dialogs.h"
//#include "ifuncns.h"
#define CLASS_NAME "WFInstall"
/* global variables */
HINSTANCE hInst;
HANDLE hAccelTable;
HWND hDlgUninstall;
HWND hDlgMessage;
HWND hWndMain;
LPSTR szEGlobalAlloc;
LPSTR szEStringLoad;
LPSTR szEDllLoad;
LPSTR szEStringNull;
LPSTR szTempSetupPath;
LPSTR szClassName;
LPSTR szUninstallDir;
LPSTR szTempDir;
LPSTR szOSTempDir;
LPSTR szFileIniUninstall;
LPSTR gszSharedFilename;
ULONG ulOSType;
DWORD dwScreenX;
DWORD dwScreenY;
void Log(char* str)
{
MessageBox(hWndMain, str, NULL, MB_ICONEXCLAMATION);
}
BOOL InitApplication(HINSTANCE hInstance)
{
WNDCLASS wc;
wc.style = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW;
wc.lpfnWndProc = DefDlgProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = DLGWINDOWEXTRA;
wc.hInstance = hInstance;
//wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_UNINSTALL));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wc.lpszMenuName = NULL;
wc.lpszClassName = szClassName;
return(RegisterClass(&wc));
}
HRESULT Initialize(HINSTANCE hInstance)
{
szClassName = (LPSTR)GlobalAlloc(GMEM_FIXED|GMEM_ZEROINIT, 50);
lstrcpy(szClassName, CLASS_NAME);
Log(szClassName);
return(0);
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow)
{
/***********************************************************************/
/* HANDLE hInstance; handle for this instance */
/* HANDLE hPrevInstance; handle for possible previous instances */
/* LPSTR lpszCmdLine; long pointer to exec command line */
/* int nCmdShow; Show code for main window display */
/***********************************************************************/
MSG msg;
if(!hPrevInstance)
{
hInst = GetModuleHandle(NULL);
Log("1");
if(Initialize(hInst))
{
Log("2");
PostQuitMessage(1);
}
else if(!InitApplication(hInst))
{
Log("3");
PostQuitMessage(1);
}
}
Log("4");
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return(msg.wParam);
} /* End of WinMain */