Merge
This commit is contained in:
commit
4ce35dcaa5
@ -48,6 +48,9 @@ include Exportedfiles.gmk
|
|||||||
ifeq ($(PLATFORM), solaris)
|
ifeq ($(PLATFORM), solaris)
|
||||||
OTHER_LDLIBS += -ldoor
|
OTHER_LDLIBS += -ldoor
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(PLATFORM), windows)
|
||||||
|
EXTRA_LIBS += psapi.lib
|
||||||
|
endif
|
||||||
|
|
||||||
vpath %.c $(PLATFORM_SRC)/native/sun/tools/attach
|
vpath %.c $(PLATFORM_SRC)/native/sun/tools/attach
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ OTHER_INCLUDES += \
|
|||||||
# Rules
|
# Rules
|
||||||
#
|
#
|
||||||
CLASSDESTDIR = $(TEMPDIR)/classes
|
CLASSDESTDIR = $(TEMPDIR)/classes
|
||||||
JAVAHFLAGS += -classpath $(CLASSDESTDIR)
|
JAVAHFLAGS += -Xbootclasspath/p:$(CLASSDESTDIR)
|
||||||
|
|
||||||
include $(BUILDDIR)/common/Mapfile-vers.gmk
|
include $(BUILDDIR)/common/Mapfile-vers.gmk
|
||||||
|
|
||||||
|
@ -547,13 +547,8 @@ public final class NetworkInterface {
|
|||||||
if (displayName != null) {
|
if (displayName != null) {
|
||||||
result += " (" + displayName + ")";
|
result += " (" + displayName + ")";
|
||||||
}
|
}
|
||||||
result += " index: "+index+" addresses:\n";
|
|
||||||
for (Enumeration e = getInetAddresses(); e.hasMoreElements(); ) {
|
|
||||||
InetAddress addr = (InetAddress)e.nextElement();
|
|
||||||
result += addr+";\n";
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
private static native void init();
|
|
||||||
|
|
||||||
|
private static native void init();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -249,10 +249,10 @@ public final class SignedObject implements Serializable {
|
|||||||
* a stream.
|
* a stream.
|
||||||
*/
|
*/
|
||||||
private void readObject(java.io.ObjectInputStream s)
|
private void readObject(java.io.ObjectInputStream s)
|
||||||
throws java.io.IOException, ClassNotFoundException
|
throws java.io.IOException, ClassNotFoundException {
|
||||||
{
|
java.io.ObjectInputStream.GetField fields = s.readFields();
|
||||||
s.defaultReadObject();
|
content = ((byte[])fields.get("content", null)).clone();
|
||||||
content = content.clone();
|
signature = ((byte[])fields.get("signature", null)).clone();
|
||||||
signature = signature.clone();
|
thealgorithm = (String)fields.get("thealgorithm", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,7 @@ import javax.accessibility.*;
|
|||||||
|
|
||||||
import sun.awt.AppContext;
|
import sun.awt.AppContext;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.security.PrivilegedAction;
|
import java.security.*;
|
||||||
import java.security.AccessController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of the Icon interface that paints Icons
|
* An implementation of the Icon interface that paints Icons
|
||||||
@ -81,32 +80,51 @@ public class ImageIcon implements Icon, Serializable, Accessible {
|
|||||||
ImageObserver imageObserver;
|
ImageObserver imageObserver;
|
||||||
String description = null;
|
String description = null;
|
||||||
|
|
||||||
|
// Fields for twisted backward compatibility only. DO NOT USE.
|
||||||
protected final static Component component;
|
protected final static Component component;
|
||||||
protected final static MediaTracker tracker;
|
protected final static MediaTracker tracker;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
component = new Component() {};
|
component = AccessController.doPrivileged(new PrivilegedAction<Component>() {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
public Component run() {
|
||||||
public Object run() {
|
|
||||||
try {
|
try {
|
||||||
|
final Component component = createNoPermsComponent();
|
||||||
|
|
||||||
// 6482575 - clear the appContext field so as not to leak it
|
// 6482575 - clear the appContext field so as not to leak it
|
||||||
Field appContextField =
|
Field appContextField =
|
||||||
Component.class.getDeclaredField("appContext");
|
|
||||||
|
Component.class.getDeclaredField("appContext");
|
||||||
appContextField.setAccessible(true);
|
appContextField.setAccessible(true);
|
||||||
appContextField.set(component, null);
|
appContextField.set(component, null);
|
||||||
}
|
|
||||||
catch (NoSuchFieldException e) {
|
return component;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
// We don't care about component.
|
||||||
|
// So don't prevent class initialisation.
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
tracker = new MediaTracker(component);
|
tracker = new MediaTracker(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Component createNoPermsComponent() {
|
||||||
|
// 7020198 - set acc field to no permissions and no subject
|
||||||
|
// Note, will have appContext set.
|
||||||
|
return AccessController.doPrivileged(
|
||||||
|
new PrivilegedAction<Component>() {
|
||||||
|
public Component run() {
|
||||||
|
return new Component() {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new AccessControlContext(new ProtectionDomain[]{
|
||||||
|
new ProtectionDomain(null, null)
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Id used in loading images from MediaTracker.
|
* Id used in loading images from MediaTracker.
|
||||||
*/
|
*/
|
||||||
|
@ -509,6 +509,9 @@ public class DrawImage implements DrawImagePipe
|
|||||||
* edges thus has to be h*2+2 in length
|
* edges thus has to be h*2+2 in length
|
||||||
*/
|
*/
|
||||||
int edges[] = new int[(dy2-dy1)*2+2];
|
int edges[] = new int[(dy2-dy1)*2+2];
|
||||||
|
// It is important that edges[0]=edges[1]=0 when we call
|
||||||
|
// Transform in case it must return early and we would
|
||||||
|
// not want to render anything on an error condition.
|
||||||
helper.Transform(tmpmaskblit, srcData, tmpData,
|
helper.Transform(tmpmaskblit, srcData, tmpData,
|
||||||
AlphaComposite.Src, null,
|
AlphaComposite.Src, null,
|
||||||
itx, interpType,
|
itx, interpType,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -653,6 +653,13 @@ final class Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
debug(keyword + ": " + lib);
|
debug(keyword + ": " + lib);
|
||||||
|
|
||||||
|
// Check to see if full path is specified to prevent the DLL
|
||||||
|
// preloading attack
|
||||||
|
if (!(new File(lib)).isAbsolute()) {
|
||||||
|
throw new ConfigurationException(
|
||||||
|
"Absolute path required for library value: " + lib);
|
||||||
|
}
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -236,7 +236,8 @@ public final class Secmod {
|
|||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
}
|
}
|
||||||
if (modules == null) {
|
if (modules == null) {
|
||||||
List<Module> modules = (List<Module>)nssGetModuleList(nssHandle);
|
List<Module> modules = (List<Module>)nssGetModuleList(nssHandle,
|
||||||
|
nssLibDir);
|
||||||
this.modules = Collections.unmodifiableList(modules);
|
this.modules = Collections.unmodifiableList(modules);
|
||||||
}
|
}
|
||||||
return modules;
|
return modules;
|
||||||
@ -358,7 +359,7 @@ public final class Secmod {
|
|||||||
* A representation of one PKCS#11 slot in a PKCS#11 module.
|
* A representation of one PKCS#11 slot in a PKCS#11 module.
|
||||||
*/
|
*/
|
||||||
public static final class Module {
|
public static final class Module {
|
||||||
// name of the native library
|
// path of the native library
|
||||||
final String libraryName;
|
final String libraryName;
|
||||||
// descriptive name used by NSS
|
// descriptive name used by NSS
|
||||||
final String commonName;
|
final String commonName;
|
||||||
@ -371,8 +372,10 @@ public final class Secmod {
|
|||||||
// trust attributes. Used for the KEYSTORE and TRUSTANCHOR modules only
|
// trust attributes. Used for the KEYSTORE and TRUSTANCHOR modules only
|
||||||
private Map<Bytes,TrustAttributes> trust;
|
private Map<Bytes,TrustAttributes> trust;
|
||||||
|
|
||||||
Module(String libraryName, String commonName, boolean fips, int slot) {
|
Module(String libraryDir, String libraryName, String commonName,
|
||||||
|
boolean fips, int slot) {
|
||||||
ModuleType type;
|
ModuleType type;
|
||||||
|
|
||||||
if ((libraryName == null) || (libraryName.length() == 0)) {
|
if ((libraryName == null) || (libraryName.length() == 0)) {
|
||||||
// must be softtoken
|
// must be softtoken
|
||||||
libraryName = System.mapLibraryName(SOFTTOKEN_LIB_NAME);
|
libraryName = System.mapLibraryName(SOFTTOKEN_LIB_NAME);
|
||||||
@ -397,7 +400,7 @@ public final class Secmod {
|
|||||||
+ "module: " + libraryName + ", " + commonName);
|
+ "module: " + libraryName + ", " + commonName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.libraryName = libraryName;
|
this.libraryName = (new File(libraryDir, libraryName)).getPath();
|
||||||
this.commonName = commonName;
|
this.commonName = commonName;
|
||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
@ -752,6 +755,6 @@ public final class Secmod {
|
|||||||
|
|
||||||
private static native boolean nssInit(String functionName, long handle, String configDir);
|
private static native boolean nssInit(String functionName, long handle, String configDir);
|
||||||
|
|
||||||
private static native Object nssGetModuleList(long handle);
|
private static native Object nssGetModuleList(long handle, String libDir);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "jni.h"
|
#include "jni.h"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
|
#include "jdk_util_md.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -1971,6 +1971,13 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage
|
|||||||
return data->abortFlag;
|
return data->abortFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cinfo->output_components <= 0 ||
|
||||||
|
cinfo->image_width > (0xffffffffu / (unsigned int)cinfo->output_components))
|
||||||
|
{
|
||||||
|
JNU_ThrowByName(env, "javax/imageio/IIOException",
|
||||||
|
"Invalid number of output components");
|
||||||
|
return data->abortFlag;
|
||||||
|
}
|
||||||
|
|
||||||
// Allocate a 1-scanline buffer
|
// Allocate a 1-scanline buffer
|
||||||
scanLinePtr = (JSAMPROW)malloc(cinfo->image_width*cinfo->output_components);
|
scanLinePtr = (JSAMPROW)malloc(cinfo->image_width*cinfo->output_components);
|
||||||
|
@ -186,7 +186,11 @@ JNIEXPORT void JNICALL Java_sun_font_SunLayoutEngine_nativeLayout
|
|||||||
jchar buffer[256];
|
jchar buffer[256];
|
||||||
jchar* chars = buffer;
|
jchar* chars = buffer;
|
||||||
if (len > 256) {
|
if (len > 256) {
|
||||||
chars = (jchar*)malloc(len * sizeof(jchar));
|
size_t size = len * sizeof(jchar);
|
||||||
|
if (size / sizeof(jchar) != len) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
chars = (jchar*)malloc(size);
|
||||||
if (chars == 0) {
|
if (chars == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,94 @@ static TransformInterpFunc BicubicInterpStub;
|
|||||||
TransformInterpFunc *pBilinearFunc = BilinearInterp;
|
TransformInterpFunc *pBilinearFunc = BilinearInterp;
|
||||||
TransformInterpFunc *pBicubicFunc = BicubicInterp;
|
TransformInterpFunc *pBicubicFunc = BicubicInterp;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The dxydxy parameters of the inverse transform determine how
|
||||||
|
* quickly we step through the source image. For tiny scale
|
||||||
|
* factors (on the order of 1E-16 or so) the stepping distances
|
||||||
|
* are huge. The image has been scaled so small that stepping
|
||||||
|
* a single pixel in device space moves the sampling point by
|
||||||
|
* billions (or more) pixels in the source image space. These
|
||||||
|
* huge stepping values can overflow the whole part of the longs
|
||||||
|
* we use for the fixed point stepping equations and so we need
|
||||||
|
* a more robust solution. We could simply iterate over every
|
||||||
|
* device pixel, use the inverse transform to transform it back
|
||||||
|
* into the source image coordinate system and then test it for
|
||||||
|
* being in range and sample pixel-by-pixel, but that is quite
|
||||||
|
* a bit more expensive. Fortunately, if the scale factors are
|
||||||
|
* so tiny that we overflow our long values then the number of
|
||||||
|
* pixels we are planning to visit should be very tiny. The only
|
||||||
|
* exception to that rule is if the scale factor along one
|
||||||
|
* dimension is tiny (creating the huge stepping values), and
|
||||||
|
* the scale factor along the other dimension is fairly regular
|
||||||
|
* or an up-scale. In that case we have a lot of pixels along
|
||||||
|
* the direction of the larger axis to sample, but few along the
|
||||||
|
* smaller axis. Though, pessimally, with an added shear factor
|
||||||
|
* such a linearly tiny image could have bounds that cover a large
|
||||||
|
* number of pixels. Such odd transformations should be very
|
||||||
|
* rare and the absolute limit on calculations would involve a
|
||||||
|
* single reverse transform of every pixel in the output image
|
||||||
|
* which is not fast, but it should not cause an undue stall
|
||||||
|
* of the rendering software.
|
||||||
|
*
|
||||||
|
* The specific test we will use is to calculate the inverse
|
||||||
|
* transformed values of every corner of the destination bounds
|
||||||
|
* (in order to be user-clip independent) and if we can
|
||||||
|
* perform a fixed-point-long inverse transform of all of
|
||||||
|
* those points without overflowing we will use the fast
|
||||||
|
* fixed point algorithm. Otherwise we will use the safe
|
||||||
|
* per-pixel transform algorithm.
|
||||||
|
* The 4 corners are 0,0, 0,dsth, dstw,0, dstw,dsth
|
||||||
|
* Transformed they are:
|
||||||
|
* tx, ty
|
||||||
|
* tx +dxdy*H, ty +dydy*H
|
||||||
|
* tx+dxdx*W, ty+dydx*W
|
||||||
|
* tx+dxdx*W+dxdy*H, ty+dydx*W+dydy*H
|
||||||
|
*/
|
||||||
|
/* We reject coordinates not less than 1<<30 so that the distance between */
|
||||||
|
/* any 2 of them is less than 1<<31 which would overflow into the sign */
|
||||||
|
/* bit of a signed long value used to represent fixed point coordinates. */
|
||||||
|
#define TX_FIXED_UNSAFE(v) (fabs(v) >= (1<<30))
|
||||||
|
static jboolean
|
||||||
|
checkOverflow(jint dxoff, jint dyoff,
|
||||||
|
SurfaceDataBounds *pBounds,
|
||||||
|
TransformInfo *pItxInfo,
|
||||||
|
jdouble *retx, jdouble *rety)
|
||||||
|
{
|
||||||
|
jdouble x, y;
|
||||||
|
|
||||||
|
x = dxoff+pBounds->x1+0.5; /* Center of pixel x1 */
|
||||||
|
y = dyoff+pBounds->y1+0.5; /* Center of pixel y1 */
|
||||||
|
Transform_transform(pItxInfo, &x, &y);
|
||||||
|
*retx = x;
|
||||||
|
*rety = y;
|
||||||
|
if (TX_FIXED_UNSAFE(x) || TX_FIXED_UNSAFE(y)) {
|
||||||
|
return JNI_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
x = dxoff+pBounds->x2-0.5; /* Center of pixel x2-1 */
|
||||||
|
y = dyoff+pBounds->y1+0.5; /* Center of pixel y1 */
|
||||||
|
Transform_transform(pItxInfo, &x, &y);
|
||||||
|
if (TX_FIXED_UNSAFE(x) || TX_FIXED_UNSAFE(y)) {
|
||||||
|
return JNI_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
x = dxoff+pBounds->x1+0.5; /* Center of pixel x1 */
|
||||||
|
y = dyoff+pBounds->y2-0.5; /* Center of pixel y2-1 */
|
||||||
|
Transform_transform(pItxInfo, &x, &y);
|
||||||
|
if (TX_FIXED_UNSAFE(x) || TX_FIXED_UNSAFE(y)) {
|
||||||
|
return JNI_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
x = dxoff+pBounds->x2-0.5; /* Center of pixel x2-1 */
|
||||||
|
y = dyoff+pBounds->y2-0.5; /* Center of pixel y2-1 */
|
||||||
|
Transform_transform(pItxInfo, &x, &y);
|
||||||
|
if (TX_FIXED_UNSAFE(x) || TX_FIXED_UNSAFE(y)) {
|
||||||
|
return JNI_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return JNI_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill the edge buffer with pairs of coordinates representing the maximum
|
* Fill the edge buffer with pairs of coordinates representing the maximum
|
||||||
* left and right pixels of the destination surface that should be processed
|
* left and right pixels of the destination surface that should be processed
|
||||||
@ -82,21 +170,19 @@ TransformInterpFunc *pBicubicFunc = BicubicInterp;
|
|||||||
* Only pixels that map back through the specified (inverse) transform to a
|
* Only pixels that map back through the specified (inverse) transform to a
|
||||||
* source coordinate that falls within the (0, 0, sw, sh) bounds of the
|
* source coordinate that falls within the (0, 0, sw, sh) bounds of the
|
||||||
* source image should be processed.
|
* source image should be processed.
|
||||||
* pEdgeBuf points to an array of jints that holds MAXEDGES*2 values.
|
* pEdges points to an array of jints that holds 2 + numedges*2 values where
|
||||||
* If more storage is needed, then this function allocates a new buffer.
|
* numedges should match (pBounds->y2 - pBounds->y1).
|
||||||
* In either case, a pointer to the buffer actually used to store the
|
* The first two jints in pEdges should be set to y1 and y2 and every pair
|
||||||
* results is returned.
|
* of jints after that represent the xmin,xmax of all pixels in range of
|
||||||
* The caller is responsible for freeing the buffer if the return value
|
* the transformed blit for the corresponding scanline.
|
||||||
* is not the same as the original pEdgeBuf passed in.
|
|
||||||
*/
|
*/
|
||||||
static jint *
|
static void
|
||||||
calculateEdges(jint *pEdgeBuf,
|
calculateEdges(jint *pEdges,
|
||||||
SurfaceDataBounds *pBounds,
|
SurfaceDataBounds *pBounds,
|
||||||
TransformInfo *pItxInfo,
|
TransformInfo *pItxInfo,
|
||||||
jlong xbase, jlong ybase,
|
jlong xbase, jlong ybase,
|
||||||
juint sw, juint sh)
|
juint sw, juint sh)
|
||||||
{
|
{
|
||||||
jint *pEdges;
|
|
||||||
jlong dxdxlong, dydxlong;
|
jlong dxdxlong, dydxlong;
|
||||||
jlong dxdylong, dydylong;
|
jlong dxdylong, dydylong;
|
||||||
jlong drowxlong, drowylong;
|
jlong drowxlong, drowylong;
|
||||||
@ -111,10 +197,8 @@ calculateEdges(jint *pEdgeBuf,
|
|||||||
dy1 = pBounds->y1;
|
dy1 = pBounds->y1;
|
||||||
dx2 = pBounds->x2;
|
dx2 = pBounds->x2;
|
||||||
dy2 = pBounds->y2;
|
dy2 = pBounds->y2;
|
||||||
if ((dy2-dy1) > MAXEDGES) {
|
*pEdges++ = dy1;
|
||||||
pEdgeBuf = malloc(2 * (dy2-dy1) * sizeof (*pEdges));
|
*pEdges++ = dy2;
|
||||||
}
|
|
||||||
pEdges = pEdgeBuf;
|
|
||||||
|
|
||||||
drowxlong = (dx2-dx1-1) * dxdxlong;
|
drowxlong = (dx2-dx1-1) * dxdxlong;
|
||||||
drowylong = (dx2-dx1-1) * dydxlong;
|
drowylong = (dx2-dx1-1) * dydxlong;
|
||||||
@ -155,10 +239,22 @@ calculateEdges(jint *pEdgeBuf,
|
|||||||
ybase += dydylong;
|
ybase += dydylong;
|
||||||
dy1++;
|
dy1++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pEdgeBuf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
Transform_SafeHelper(JNIEnv *env,
|
||||||
|
SurfaceDataOps *srcOps,
|
||||||
|
SurfaceDataOps *dstOps,
|
||||||
|
SurfaceDataRasInfo *pSrcInfo,
|
||||||
|
SurfaceDataRasInfo *pDstInfo,
|
||||||
|
NativePrimitive *pMaskBlitPrim,
|
||||||
|
CompositeInfo *pCompInfo,
|
||||||
|
TransformHelperFunc *pHelperFunc,
|
||||||
|
TransformInterpFunc *pInterpFunc,
|
||||||
|
RegionData *pClipInfo, TransformInfo *pItxInfo,
|
||||||
|
jint *pData, jint *pEdges,
|
||||||
|
jint dxoff, jint dyoff, jint sw, jint sh);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: sun_java2d_loops_TransformHelper
|
* Class: sun_java2d_loops_TransformHelper
|
||||||
* Method: Transform
|
* Method: Transform
|
||||||
@ -187,12 +283,14 @@ Java_sun_java2d_loops_TransformHelper_Transform
|
|||||||
jint maxlinepix;
|
jint maxlinepix;
|
||||||
TransformHelperFunc *pHelperFunc;
|
TransformHelperFunc *pHelperFunc;
|
||||||
TransformInterpFunc *pInterpFunc;
|
TransformInterpFunc *pInterpFunc;
|
||||||
jint edgebuf[MAXEDGES * 2];
|
jdouble xorig, yorig;
|
||||||
|
jint numedges;
|
||||||
jint *pEdges;
|
jint *pEdges;
|
||||||
jdouble x, y;
|
jint edgebuf[2 + MAXEDGES * 2];
|
||||||
jlong xbase, ybase;
|
union {
|
||||||
jlong dxdxlong, dydxlong;
|
jlong align;
|
||||||
jlong dxdylong, dydylong;
|
jint data[LINE_SIZE];
|
||||||
|
} rgb;
|
||||||
|
|
||||||
#ifdef MAKE_STUBS
|
#ifdef MAKE_STUBS
|
||||||
static int th_initialized;
|
static int th_initialized;
|
||||||
@ -269,39 +367,62 @@ Java_sun_java2d_loops_TransformHelper_Transform
|
|||||||
if (srcOps->Lock(env, srcOps, &srcInfo, pHelperPrim->srcflags)
|
if (srcOps->Lock(env, srcOps, &srcInfo, pHelperPrim->srcflags)
|
||||||
!= SD_SUCCESS)
|
!= SD_SUCCESS)
|
||||||
{
|
{
|
||||||
|
/* edgeArray should already contain zeros for min/maxy */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (dstOps->Lock(env, dstOps, &dstInfo, pMaskBlitPrim->dstflags)
|
if (dstOps->Lock(env, dstOps, &dstInfo, pMaskBlitPrim->dstflags)
|
||||||
!= SD_SUCCESS)
|
!= SD_SUCCESS)
|
||||||
{
|
{
|
||||||
SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
|
SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
|
||||||
|
/* edgeArray should already contain zeros for min/maxy */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Region_IntersectBounds(&clipInfo, &dstInfo.bounds);
|
Region_IntersectBounds(&clipInfo, &dstInfo.bounds);
|
||||||
|
|
||||||
Transform_GetInfo(env, itxform, &itxInfo);
|
numedges = (dstInfo.bounds.y2 - dstInfo.bounds.y1);
|
||||||
dxdxlong = DblToLong(itxInfo.dxdx);
|
if (numedges > MAXEDGES) {
|
||||||
dydxlong = DblToLong(itxInfo.dydx);
|
pEdges = malloc((2 + 2 * numedges) * sizeof (*pEdges));
|
||||||
dxdylong = DblToLong(itxInfo.dxdy);
|
if (pEdges == NULL) {
|
||||||
dydylong = DblToLong(itxInfo.dydy);
|
SurfaceData_InvokeUnlock(env, dstOps, &dstInfo);
|
||||||
x = dxoff+dstInfo.bounds.x1+0.5; /* Center of pixel x1 */
|
SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
|
||||||
y = dyoff+dstInfo.bounds.y1+0.5; /* Center of pixel y1 */
|
/* edgeArray should already contain zeros for min/maxy */
|
||||||
Transform_transform(&itxInfo, &x, &y);
|
return;
|
||||||
xbase = DblToLong(x);
|
}
|
||||||
ybase = DblToLong(y);
|
} else {
|
||||||
|
pEdges = edgebuf;
|
||||||
|
}
|
||||||
|
|
||||||
pEdges = calculateEdges(edgebuf, &dstInfo.bounds, &itxInfo,
|
Transform_GetInfo(env, itxform, &itxInfo);
|
||||||
xbase, ybase, sx2-sx1, sy2-sy1);
|
|
||||||
|
|
||||||
if (!Region_IsEmpty(&clipInfo)) {
|
if (!Region_IsEmpty(&clipInfo)) {
|
||||||
srcOps->GetRasInfo(env, srcOps, &srcInfo);
|
srcOps->GetRasInfo(env, srcOps, &srcInfo);
|
||||||
dstOps->GetRasInfo(env, dstOps, &dstInfo);
|
dstOps->GetRasInfo(env, dstOps, &dstInfo);
|
||||||
if (srcInfo.rasBase && dstInfo.rasBase) {
|
if (srcInfo.rasBase == NULL || dstInfo.rasBase == NULL) {
|
||||||
union {
|
pEdges[0] = pEdges[1] = 0;
|
||||||
jlong align;
|
} else if (checkOverflow(dxoff, dyoff, &dstInfo.bounds,
|
||||||
jint data[LINE_SIZE];
|
&itxInfo, &xorig, &yorig))
|
||||||
} rgb;
|
{
|
||||||
|
Transform_SafeHelper(env, srcOps, dstOps,
|
||||||
|
&srcInfo, &dstInfo,
|
||||||
|
pMaskBlitPrim, &compInfo,
|
||||||
|
pHelperFunc, pInterpFunc,
|
||||||
|
&clipInfo, &itxInfo, rgb.data, pEdges,
|
||||||
|
dxoff, dyoff, sx2-sx1, sy2-sy1);
|
||||||
|
} else {
|
||||||
SurfaceDataBounds span;
|
SurfaceDataBounds span;
|
||||||
|
jlong dxdxlong, dydxlong;
|
||||||
|
jlong dxdylong, dydylong;
|
||||||
|
jlong xbase, ybase;
|
||||||
|
|
||||||
|
dxdxlong = DblToLong(itxInfo.dxdx);
|
||||||
|
dydxlong = DblToLong(itxInfo.dydx);
|
||||||
|
dxdylong = DblToLong(itxInfo.dxdy);
|
||||||
|
dydylong = DblToLong(itxInfo.dydy);
|
||||||
|
xbase = DblToLong(xorig);
|
||||||
|
ybase = DblToLong(yorig);
|
||||||
|
|
||||||
|
calculateEdges(pEdges, &dstInfo.bounds, &itxInfo,
|
||||||
|
xbase, ybase, sx2-sx1, sy2-sy1);
|
||||||
|
|
||||||
Region_StartIteration(env, &clipInfo);
|
Region_StartIteration(env, &clipInfo);
|
||||||
while (Region_NextIteration(&clipInfo, &span)) {
|
while (Region_NextIteration(&clipInfo, &span)) {
|
||||||
@ -318,8 +439,8 @@ Java_sun_java2d_loops_TransformHelper_Transform
|
|||||||
|
|
||||||
/* Note - process at most one scanline at a time. */
|
/* Note - process at most one scanline at a time. */
|
||||||
|
|
||||||
dx1 = pEdges[(dy1 - dstInfo.bounds.y1) * 2];
|
dx1 = pEdges[(dy1 - dstInfo.bounds.y1) * 2 + 2];
|
||||||
dx2 = pEdges[(dy1 - dstInfo.bounds.y1) * 2 + 1];
|
dx2 = pEdges[(dy1 - dstInfo.bounds.y1) * 2 + 3];
|
||||||
if (dx1 < span.x1) dx1 = span.x1;
|
if (dx1 < span.x1) dx1 = span.x1;
|
||||||
if (dx2 > span.x2) dx2 = span.x2;
|
if (dx2 > span.x2) dx2 = span.x2;
|
||||||
|
|
||||||
@ -376,21 +497,124 @@ Java_sun_java2d_loops_TransformHelper_Transform
|
|||||||
}
|
}
|
||||||
SurfaceData_InvokeRelease(env, dstOps, &dstInfo);
|
SurfaceData_InvokeRelease(env, dstOps, &dstInfo);
|
||||||
SurfaceData_InvokeRelease(env, srcOps, &srcInfo);
|
SurfaceData_InvokeRelease(env, srcOps, &srcInfo);
|
||||||
|
} else {
|
||||||
|
pEdges[0] = pEdges[1] = 0;
|
||||||
}
|
}
|
||||||
SurfaceData_InvokeUnlock(env, dstOps, &dstInfo);
|
SurfaceData_InvokeUnlock(env, dstOps, &dstInfo);
|
||||||
SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
|
SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
|
||||||
if (!JNU_IsNull(env, edgeArray)) {
|
if (!JNU_IsNull(env, edgeArray)) {
|
||||||
(*env)->SetIntArrayRegion(env, edgeArray, 0, 1, &dstInfo.bounds.y1);
|
(*env)->SetIntArrayRegion(env, edgeArray, 0, 2+numedges*2, pEdges);
|
||||||
(*env)->SetIntArrayRegion(env, edgeArray, 1, 1, &dstInfo.bounds.y2);
|
|
||||||
(*env)->SetIntArrayRegion(env, edgeArray,
|
|
||||||
2, (dstInfo.bounds.y2 - dstInfo.bounds.y1)*2,
|
|
||||||
pEdges);
|
|
||||||
}
|
}
|
||||||
if (pEdges != edgebuf) {
|
if (pEdges != edgebuf) {
|
||||||
free(pEdges);
|
free(pEdges);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
Transform_SafeHelper(JNIEnv *env,
|
||||||
|
SurfaceDataOps *srcOps,
|
||||||
|
SurfaceDataOps *dstOps,
|
||||||
|
SurfaceDataRasInfo *pSrcInfo,
|
||||||
|
SurfaceDataRasInfo *pDstInfo,
|
||||||
|
NativePrimitive *pMaskBlitPrim,
|
||||||
|
CompositeInfo *pCompInfo,
|
||||||
|
TransformHelperFunc *pHelperFunc,
|
||||||
|
TransformInterpFunc *pInterpFunc,
|
||||||
|
RegionData *pClipInfo, TransformInfo *pItxInfo,
|
||||||
|
jint *pData, jint *pEdges,
|
||||||
|
jint dxoff, jint dyoff, jint sw, jint sh)
|
||||||
|
{
|
||||||
|
SurfaceDataBounds span;
|
||||||
|
jint dx1, dx2;
|
||||||
|
jint dy1, dy2;
|
||||||
|
jint i, iy;
|
||||||
|
|
||||||
|
dy1 = pDstInfo->bounds.y1;
|
||||||
|
dy2 = pDstInfo->bounds.y2;
|
||||||
|
dx1 = pDstInfo->bounds.x1;
|
||||||
|
dx2 = pDstInfo->bounds.x2;
|
||||||
|
pEdges[0] = dy1;
|
||||||
|
pEdges[1] = dy2;
|
||||||
|
for (iy = dy1; iy < dy2; iy++) {
|
||||||
|
jint i = (iy - dy1) * 2;
|
||||||
|
/* row spans are set to max,min until we find a pixel in range below */
|
||||||
|
pEdges[i + 2] = dx2;
|
||||||
|
pEdges[i + 3] = dx1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Region_StartIteration(env, pClipInfo);
|
||||||
|
while (Region_NextIteration(pClipInfo, &span)) {
|
||||||
|
dy1 = span.y1;
|
||||||
|
dy2 = span.y2;
|
||||||
|
while (dy1 < dy2) {
|
||||||
|
dx1 = span.x1;
|
||||||
|
dx2 = span.x2;
|
||||||
|
i = (dy1 - pDstInfo->bounds.y1) * 2;
|
||||||
|
while (dx1 < dx2) {
|
||||||
|
jdouble x, y;
|
||||||
|
jlong xlong, ylong;
|
||||||
|
|
||||||
|
x = dxoff + dx1 + 0.5;
|
||||||
|
y = dyoff + dy1 + 0.5;
|
||||||
|
Transform_transform(pItxInfo, &x, &y);
|
||||||
|
xlong = DblToLong(x);
|
||||||
|
ylong = DblToLong(y);
|
||||||
|
|
||||||
|
/* Process only pixels with centers in bounds
|
||||||
|
* Test double values to avoid overflow in conversion
|
||||||
|
* to long values and then also test the long values
|
||||||
|
* in case they rounded up and out of bounds during
|
||||||
|
* the conversion.
|
||||||
|
*/
|
||||||
|
if (x >= 0 && y >= 0 && x < sw && y < sh &&
|
||||||
|
WholeOfLong(xlong) < sw &&
|
||||||
|
WholeOfLong(ylong) < sh)
|
||||||
|
{
|
||||||
|
void *pDst;
|
||||||
|
|
||||||
|
if (pEdges[i + 2] > dx1) {
|
||||||
|
pEdges[i + 2] = dx1;
|
||||||
|
}
|
||||||
|
if (pEdges[i + 3] <= dx1) {
|
||||||
|
pEdges[i + 3] = dx1 + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get IntArgbPre pixel data from source */
|
||||||
|
(*pHelperFunc)(pSrcInfo,
|
||||||
|
pData, 1,
|
||||||
|
xlong, 0,
|
||||||
|
ylong, 0);
|
||||||
|
|
||||||
|
/* Interpolate result pixels if needed */
|
||||||
|
if (pInterpFunc) {
|
||||||
|
(*pInterpFunc)(pData, 1,
|
||||||
|
FractOfLong(xlong-LongOneHalf), 0,
|
||||||
|
FractOfLong(ylong-LongOneHalf), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Store/Composite interpolated pixels into dest */
|
||||||
|
pDst = PtrCoord(pDstInfo->rasBase,
|
||||||
|
dx1, pDstInfo->pixelStride,
|
||||||
|
dy1, pDstInfo->scanStride);
|
||||||
|
(*pMaskBlitPrim->funcs.maskblit)(pDst, pData,
|
||||||
|
0, 0, 0,
|
||||||
|
1, 1,
|
||||||
|
pDstInfo, pSrcInfo,
|
||||||
|
pMaskBlitPrim,
|
||||||
|
pCompInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Increment to next input pixel */
|
||||||
|
dx1++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Increment to next scanline */
|
||||||
|
dy1++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Region_EndIteration(env, pClipInfo);
|
||||||
|
}
|
||||||
|
|
||||||
#define BL_INTERP_V1_to_V2_by_F(v1, v2, f) \
|
#define BL_INTERP_V1_to_V2_by_F(v1, v2, f) \
|
||||||
(((v1)<<8) + ((v2)-(v1))*(f))
|
(((v1)<<8) + ((v2)-(v1))*(f))
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -74,7 +74,7 @@ JNIEXPORT jboolean JNICALL Java_sun_security_pkcs11_Secmod_nssInit
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobject JNICALL Java_sun_security_pkcs11_Secmod_nssGetModuleList
|
JNIEXPORT jobject JNICALL Java_sun_security_pkcs11_Secmod_nssGetModuleList
|
||||||
(JNIEnv *env, jclass thisClass, jlong jHandle)
|
(JNIEnv *env, jclass thisClass, jlong jHandle, jstring jLibDir)
|
||||||
{
|
{
|
||||||
FPTR_GetDBModuleList getModuleList =
|
FPTR_GetDBModuleList getModuleList =
|
||||||
(FPTR_GetDBModuleList)findFunction(env, jHandle, "SECMOD_GetDefaultModuleList");
|
(FPTR_GetDBModuleList)findFunction(env, jHandle, "SECMOD_GetDefaultModuleList");
|
||||||
@ -104,8 +104,8 @@ JNIEXPORT jobject JNICALL Java_sun_security_pkcs11_Secmod_nssGetModuleList
|
|||||||
jList = (*env)->NewObject(env, jListClass, jListConstructor);
|
jList = (*env)->NewObject(env, jListClass, jListConstructor);
|
||||||
|
|
||||||
jModuleClass = (*env)->FindClass(env, "sun/security/pkcs11/Secmod$Module");
|
jModuleClass = (*env)->FindClass(env, "sun/security/pkcs11/Secmod$Module");
|
||||||
jModuleConstructor = (*env)->GetMethodID
|
jModuleConstructor = (*env)->GetMethodID(env, jModuleClass, "<init>",
|
||||||
(env, jModuleClass, "<init>", "(Ljava/lang/String;Ljava/lang/String;ZI)V");
|
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZI)V");
|
||||||
|
|
||||||
while (list != NULL) {
|
while (list != NULL) {
|
||||||
module = list->module;
|
module = list->module;
|
||||||
@ -124,7 +124,8 @@ JNIEXPORT jobject JNICALL Java_sun_security_pkcs11_Secmod_nssGetModuleList
|
|||||||
}
|
}
|
||||||
jFIPS = module->isFIPS;
|
jFIPS = module->isFIPS;
|
||||||
for (i = 0; i < module->slotCount; i++ ) {
|
for (i = 0; i < module->slotCount; i++ ) {
|
||||||
jModule = (*env)->NewObject(env, jModuleClass, jModuleConstructor, jDllName, jCommonName, jFIPS, i);
|
jModule = (*env)->NewObject(env, jModuleClass, jModuleConstructor,
|
||||||
|
jLibDir, jDllName, jCommonName, jFIPS, i);
|
||||||
(*env)->CallVoidMethod(env, jList, jAdd, jModule);
|
(*env)->CallVoidMethod(env, jList, jAdd, jModule);
|
||||||
}
|
}
|
||||||
list = list->next;
|
list = list->next;
|
||||||
|
26
jdk/src/solaris/native/common/jdk_util_md.h
Normal file
26
jdk/src/solaris/native/common/jdk_util_md.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation. Oracle designates this
|
||||||
|
* particular file as subject to the "Classpath" exception as provided
|
||||||
|
* by Oracle in the LICENSE file that accompanied this code.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Currently, there are no unix specific functions defined.
|
@ -126,16 +126,6 @@ public class WindowsAttachProvider extends HotSpotAttachProvider {
|
|||||||
* of the process list.
|
* of the process list.
|
||||||
*/
|
*/
|
||||||
private List<VirtualMachineDescriptor> listJavaProcesses() {
|
private List<VirtualMachineDescriptor> listJavaProcesses() {
|
||||||
// ensure that process status helper is loaded (psapi.dll)
|
|
||||||
if (!isProcessStatusHelperInitialized) {
|
|
||||||
synchronized (WindowsAttachProvider.class) {
|
|
||||||
if (!isProcessStatusHelperInitialized) {
|
|
||||||
initializeProcessStatusHelper();
|
|
||||||
isProcessStatusHelperInitialized = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<VirtualMachineDescriptor> list =
|
ArrayList<VirtualMachineDescriptor> list =
|
||||||
new ArrayList<VirtualMachineDescriptor>();
|
new ArrayList<VirtualMachineDescriptor>();
|
||||||
|
|
||||||
@ -172,12 +162,6 @@ public class WindowsAttachProvider extends HotSpotAttachProvider {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
// indicates if psapi.dll has been initialized
|
|
||||||
private static volatile boolean isProcessStatusHelperInitialized;
|
|
||||||
|
|
||||||
// loads psapi
|
|
||||||
private static native void initializeProcessStatusHelper();
|
|
||||||
|
|
||||||
// enumerates processes using psapi's EnumProcesses
|
// enumerates processes using psapi's EnumProcesses
|
||||||
private static native int enumProcesses(int[] processes, int max);
|
private static native int enumProcesses(int[] processes, int max);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -38,3 +38,25 @@ int JDK_InitJvmHandle() {
|
|||||||
void* JDK_FindJvmEntry(const char* name) {
|
void* JDK_FindJvmEntry(const char* name) {
|
||||||
return (void*) GetProcAddress(jvm_handle, name);
|
return (void*) GetProcAddress(jvm_handle, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT HMODULE JDK_LoadSystemLibrary(const char* name) {
|
||||||
|
HMODULE handle = NULL;
|
||||||
|
char path[MAX_PATH];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (GetSystemDirectory(path, sizeof(path)) != 0) {
|
||||||
|
strcat(path, "\\");
|
||||||
|
strcat(path, name);
|
||||||
|
handle = LoadLibrary(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (handle == NULL) {
|
||||||
|
if (GetWindowsDirectory(path, sizeof(path)) != 0) {
|
||||||
|
strcat(path, "\\");
|
||||||
|
strcat(path, name);
|
||||||
|
handle = LoadLibrary(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
42
jdk/src/windows/native/common/jdk_util_md.h
Normal file
42
jdk/src/windows/native/common/jdk_util_md.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation. Oracle designates this
|
||||||
|
* particular file as subject to the "Classpath" exception as provided
|
||||||
|
* by Oracle in the LICENSE file that accompanied this code.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef JDK_UTIL_MD_H
|
||||||
|
#define JDK_UTIL_MD_H
|
||||||
|
|
||||||
|
#include "jni.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
JNIEXPORT HMODULE JDK_LoadSystemLibrary(const char* name);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* JDK_UTIL_MD_H */
|
@ -117,7 +117,7 @@ HRESULT D3DPipelineManager::InitD3D(void)
|
|||||||
{
|
{
|
||||||
typedef IDirect3D9 * WINAPI FnDirect3DCreate9(UINT SDKVersion);
|
typedef IDirect3D9 * WINAPI FnDirect3DCreate9(UINT SDKVersion);
|
||||||
|
|
||||||
hLibD3D9 = ::LoadLibrary(TEXT("d3d9.dll"));
|
hLibD3D9 = JDK_LoadSystemLibrary("d3d9.dll");
|
||||||
if (hLibD3D9 == NULL) {
|
if (hLibD3D9 == NULL) {
|
||||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "InitD3D: no d3d9.dll");
|
J2dRlsTraceLn(J2D_TRACE_ERROR, "InitD3D: no d3d9.dll");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "J2D_GL/wglext.h"
|
#include "J2D_GL/wglext.h"
|
||||||
#include "OGLFuncMacros.h"
|
#include "OGLFuncMacros.h"
|
||||||
|
#include <jdk_util.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Core WGL functions
|
* Core WGL functions
|
||||||
@ -60,7 +61,7 @@ typedef const char *(GLAPIENTRY *wglGetExtensionsStringARBType)(HDC hdc);
|
|||||||
#define OGL_LIB_IS_UNINITIALIZED() \
|
#define OGL_LIB_IS_UNINITIALIZED() \
|
||||||
(OGL_LIB_HANDLE == 0)
|
(OGL_LIB_HANDLE == 0)
|
||||||
#define OGL_OPEN_LIB() \
|
#define OGL_OPEN_LIB() \
|
||||||
OGL_LIB_HANDLE = LoadLibrary(L"opengl32.dll")
|
OGL_LIB_HANDLE = JDK_LoadSystemLibrary("opengl32.dll")
|
||||||
#define OGL_CLOSE_LIB() \
|
#define OGL_CLOSE_LIB() \
|
||||||
FreeLibrary(OGL_LIB_HANDLE)
|
FreeLibrary(OGL_LIB_HANDLE)
|
||||||
#define OGL_GET_PROC_ADDRESS(f) \
|
#define OGL_GET_PROC_ADDRESS(f) \
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <Psapi.h>
|
||||||
|
|
||||||
#include "jni.h"
|
#include "jni.h"
|
||||||
#include "jni_util.h"
|
#include "jni_util.h"
|
||||||
@ -96,41 +97,6 @@ Java_sun_tools_attach_WindowsAttachProvider_volumeFlags(JNIEnv *env, jclass cls,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Process status helper library functions
|
|
||||||
*/
|
|
||||||
static BOOL (WINAPI *_EnumProcesses) (DWORD *, DWORD, DWORD *);
|
|
||||||
static BOOL (WINAPI *_EnumProcessModules)(HANDLE, HMODULE *, DWORD, LPDWORD);
|
|
||||||
static DWORD (WINAPI *_GetModuleBaseName) (HANDLE, HMODULE, LPTSTR, DWORD);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: sun_tools_attach_WindowsAttachProvider
|
|
||||||
* Method: initializeProcessStatusHelper
|
|
||||||
* Signature: ()V
|
|
||||||
*/
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
Java_sun_tools_attach_WindowsAttachProvider_initializeProcessStatusHelper(JNIEnv *env, jclass cls)
|
|
||||||
{
|
|
||||||
HINSTANCE psapi = LoadLibrary("PSAPI.DLL") ;
|
|
||||||
if (psapi != NULL) {
|
|
||||||
_EnumProcesses = (BOOL(WINAPI *)(DWORD *, DWORD, DWORD *))
|
|
||||||
GetProcAddress(psapi, "EnumProcesses") ;
|
|
||||||
_EnumProcessModules = (BOOL(WINAPI *)(HANDLE, HMODULE *, DWORD, LPDWORD))
|
|
||||||
GetProcAddress(psapi, "EnumProcessModules");
|
|
||||||
_GetModuleBaseName = (DWORD(WINAPI *)(HANDLE, HMODULE, LPTSTR, DWORD))
|
|
||||||
GetProcAddress(psapi, "GetModuleBaseNameA");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((_EnumProcesses == NULL) ||
|
|
||||||
(_EnumProcessModules == NULL) ||
|
|
||||||
(_GetModuleBaseName == NULL))
|
|
||||||
{
|
|
||||||
JNU_ThrowInternalError(env, "Unable to initialize process status helper library");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: sun_tools_attach_WindowsAttachProvider
|
* Class: sun_tools_attach_WindowsAttachProvider
|
||||||
* Method: enumProcesses
|
* Method: enumProcesses
|
||||||
@ -147,7 +113,7 @@ Java_sun_tools_attach_WindowsAttachProvider_enumProcesses(JNIEnv *env, jclass cl
|
|||||||
size = max * sizeof(DWORD);
|
size = max * sizeof(DWORD);
|
||||||
ptr = (DWORD*)malloc(size);
|
ptr = (DWORD*)malloc(size);
|
||||||
if (ptr != NULL) {
|
if (ptr != NULL) {
|
||||||
BOOL res = (*_EnumProcesses)(ptr, size, &bytesReturned);
|
BOOL res = EnumProcesses(ptr, size, &bytesReturned);
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
result = (jint)(bytesReturned / sizeof(DWORD));
|
result = (jint)(bytesReturned / sizeof(DWORD));
|
||||||
(*env)->SetIntArrayRegion(env, arr, 0, (jsize)result, (jint*)ptr);
|
(*env)->SetIntArrayRegion(env, arr, 0, (jsize)result, (jint*)ptr);
|
||||||
@ -192,13 +158,13 @@ Java_sun_tools_attach_WindowsAttachProvider_isLibraryLoadedByProcess(JNIEnv *env
|
|||||||
size = 1024 * sizeof(HMODULE);
|
size = 1024 * sizeof(HMODULE);
|
||||||
ptr = (HMODULE*)malloc(size);
|
ptr = (HMODULE*)malloc(size);
|
||||||
if (ptr != NULL) {
|
if (ptr != NULL) {
|
||||||
BOOL res = (*_EnumProcessModules)(hProcess, ptr, size, &bytesReturned);
|
BOOL res = EnumProcessModules(hProcess, ptr, size, &bytesReturned);
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
int count = bytesReturned / sizeof(HMODULE);
|
int count = bytesReturned / sizeof(HMODULE);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < count) {
|
while (i < count) {
|
||||||
char base[256];
|
char base[256];
|
||||||
BOOL res = (*_GetModuleBaseName)(hProcess, ptr[i], base, sizeof(base));
|
BOOL res = GetModuleBaseName(hProcess, ptr[i], base, sizeof(base));
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
if (strcmp(base, lib) == 0) {
|
if (strcmp(base, lib) == 0) {
|
||||||
result = JNI_TRUE;
|
result = JNI_TRUE;
|
||||||
|
@ -32,13 +32,13 @@
|
|||||||
|
|
||||||
|
|
||||||
/* kernel32 */
|
/* kernel32 */
|
||||||
typedef HINSTANCE (WINAPI* LoadLibraryFunc) (LPCTSTR);
|
typedef HINSTANCE (WINAPI* GetModuleHandleFunc) (LPCTSTR);
|
||||||
typedef FARPROC (WINAPI* GetProcAddressFunc)(HMODULE, LPCSTR);
|
typedef FARPROC (WINAPI* GetProcAddressFunc)(HMODULE, LPCSTR);
|
||||||
|
|
||||||
/* only on Windows 64-bit or 32-bit application running under WOW64 */
|
/* only on Windows 64-bit or 32-bit application running under WOW64 */
|
||||||
typedef BOOL (WINAPI *IsWow64ProcessFunc) (HANDLE, PBOOL);
|
typedef BOOL (WINAPI *IsWow64ProcessFunc) (HANDLE, PBOOL);
|
||||||
|
|
||||||
static LoadLibraryFunc _LoadLibrary;
|
static GetModuleHandleFunc _GetModuleHandle;
|
||||||
static GetProcAddressFunc _GetProcAddress;
|
static GetProcAddressFunc _GetProcAddress;
|
||||||
static IsWow64ProcessFunc _IsWow64Process;
|
static IsWow64ProcessFunc _IsWow64Process;
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ static void jstring_to_cstring(JNIEnv* env, jstring jstr, char* cstr, int len);
|
|||||||
#define MAX_PIPE_NAME_LENGTH 256
|
#define MAX_PIPE_NAME_LENGTH 256
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
LoadLibraryFunc _LoadLibrary;
|
GetModuleHandleFunc _GetModuleHandle;
|
||||||
GetProcAddressFunc _GetProcAddress;
|
GetProcAddressFunc _GetProcAddress;
|
||||||
char jvmLib[MAX_LIBNAME_LENGTH]; /* "jvm.dll" */
|
char jvmLib[MAX_LIBNAME_LENGTH]; /* "jvm.dll" */
|
||||||
char func1[MAX_FUNC_LENGTH];
|
char func1[MAX_FUNC_LENGTH];
|
||||||
@ -96,7 +96,7 @@ static DWORD WINAPI thread_func(DataBlock *pData)
|
|||||||
HINSTANCE h;
|
HINSTANCE h;
|
||||||
EnqueueOperationFunc addr;
|
EnqueueOperationFunc addr;
|
||||||
|
|
||||||
h = pData->_LoadLibrary(pData->jvmLib);
|
h = pData->_GetModuleHandle(pData->jvmLib);
|
||||||
if (h == NULL) {
|
if (h == NULL) {
|
||||||
return ERR_OPEN_JVM_FAIL;
|
return ERR_OPEN_JVM_FAIL;
|
||||||
}
|
}
|
||||||
@ -131,15 +131,10 @@ static void thread_end (void) {
|
|||||||
JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_init
|
JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_init
|
||||||
(JNIEnv *env, jclass cls)
|
(JNIEnv *env, jclass cls)
|
||||||
{
|
{
|
||||||
HINSTANCE h = LoadLibrary("kernel32");
|
// All following APIs exist on Windows XP with SP2/Windows Server 2008
|
||||||
if (h != NULL) {
|
_GetModuleHandle = (GetModuleHandleFunc)GetModuleHandle;
|
||||||
_LoadLibrary = (LoadLibraryFunc) GetProcAddress(h, "LoadLibraryA");
|
_GetProcAddress = (GetProcAddressFunc)GetProcAddress;
|
||||||
_GetProcAddress = (GetProcAddressFunc)GetProcAddress(h, "GetProcAddress");
|
_IsWow64Process = (IsWow64ProcessFunc)IsWow64Process;
|
||||||
_IsWow64Process = (IsWow64ProcessFunc)GetProcAddress(h, "IsWow64Process");
|
|
||||||
}
|
|
||||||
if (_LoadLibrary == NULL || _GetProcAddress == NULL) {
|
|
||||||
JNU_ThrowInternalError(env, "Unable to get address of LoadLibraryA or GetProcAddress");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -375,7 +370,7 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_enqueue
|
|||||||
/*
|
/*
|
||||||
* Setup data to copy to target process
|
* Setup data to copy to target process
|
||||||
*/
|
*/
|
||||||
data._LoadLibrary = _LoadLibrary;
|
data._GetModuleHandle = _GetModuleHandle;
|
||||||
data._GetProcAddress = _GetProcAddress;
|
data._GetProcAddress = _GetProcAddress;
|
||||||
|
|
||||||
strcpy(data.jvmLib, "jvm");
|
strcpy(data.jvmLib, "jvm");
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
JvmSymbols* lookupJvmSymbols() {
|
JvmSymbols* lookupJvmSymbols() {
|
||||||
JvmSymbols* syms = (JvmSymbols*)malloc(sizeof(JvmSymbols));
|
JvmSymbols* syms = (JvmSymbols*)malloc(sizeof(JvmSymbols));
|
||||||
if (syms != NULL) {
|
if (syms != NULL) {
|
||||||
HINSTANCE jvm = LoadLibrary("jvm.dll");
|
HINSTANCE jvm = GetModuleHandle("jvm.dll");
|
||||||
if (jvm == NULL) {
|
if (jvm == NULL) {
|
||||||
free(syms);
|
free(syms);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "DllUtil.h"
|
#include "DllUtil.h"
|
||||||
|
#include <jdk_util.h>
|
||||||
|
|
||||||
// Disable warning about using this in the initializer list.
|
// Disable warning about using this in the initializer list.
|
||||||
#pragma warning( disable : 4355)
|
#pragma warning( disable : 4355)
|
||||||
@ -40,7 +41,7 @@ DllUtil::~DllUtil()
|
|||||||
HMODULE DllUtil::GetModule()
|
HMODULE DllUtil::GetModule()
|
||||||
{
|
{
|
||||||
if (!module) {
|
if (!module) {
|
||||||
module = ::LoadLibrary(name);
|
module = JDK_LoadSystemLibrary(name);
|
||||||
}
|
}
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
@ -60,7 +61,7 @@ DwmAPI & DwmAPI::GetInstance()
|
|||||||
}
|
}
|
||||||
|
|
||||||
DwmAPI::DwmAPI() :
|
DwmAPI::DwmAPI() :
|
||||||
DllUtil(_T("DWMAPI.DLL")),
|
DllUtil("DWMAPI.DLL"),
|
||||||
DwmIsCompositionEnabledFunction((DllUtil*)this, "DwmIsCompositionEnabled"),
|
DwmIsCompositionEnabledFunction((DllUtil*)this, "DwmIsCompositionEnabled"),
|
||||||
DwmGetWindowAttributeFunction((DllUtil*)this, "DwmGetWindowAttribute")
|
DwmGetWindowAttributeFunction((DllUtil*)this, "DwmGetWindowAttribute")
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ class DllUtil {
|
|||||||
FARPROC GetProcAddress(LPCSTR name);
|
FARPROC GetProcAddress(LPCSTR name);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DllUtil(const TCHAR * name) : name(name), module(NULL) {}
|
DllUtil(const char * name) : name(name), module(NULL) {}
|
||||||
virtual ~DllUtil();
|
virtual ~DllUtil();
|
||||||
|
|
||||||
HMODULE GetModule();
|
HMODULE GetModule();
|
||||||
@ -68,7 +68,7 @@ class DllUtil {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const TCHAR * const name;
|
const char * const name;
|
||||||
HMODULE module;
|
HMODULE module;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -120,15 +120,15 @@ static BOOL initShellProcs()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// Load libraries
|
// Load libraries
|
||||||
libShell32 = LoadLibrary(TEXT("shell32.dll"));
|
libShell32 = JDK_LoadSystemLibrary("shell32.dll");
|
||||||
if (libShell32 == NULL) {
|
if (libShell32 == NULL) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
libUser32 = LoadLibrary(TEXT("user32.dll"));
|
libUser32 = JDK_LoadSystemLibrary("user32.dll");
|
||||||
if (libUser32 == NULL) {
|
if (libUser32 == NULL) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
libComCtl32 = LoadLibrary(TEXT("comctl32.dll"));
|
libComCtl32 = JDK_LoadSystemLibrary("comctl32.dll");
|
||||||
if (libComCtl32 == NULL) {
|
if (libComCtl32 == NULL) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1021,7 +1021,8 @@ JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIconResource
|
|||||||
(JNIEnv* env, jclass cls, jstring libName, jint iconID,
|
(JNIEnv* env, jclass cls, jstring libName, jint iconID,
|
||||||
jint cxDesired, jint cyDesired, jboolean useVGAColors)
|
jint cxDesired, jint cyDesired, jboolean useVGAColors)
|
||||||
{
|
{
|
||||||
HINSTANCE libHandle = LoadLibrary(JNU_GetStringPlatformChars(env, libName, NULL));
|
const char *pLibName = env->GetStringUTFChars(libName, NULL);
|
||||||
|
HINSTANCE libHandle = (HINSTANCE)JDK_LoadSystemLibrary(pLibName);
|
||||||
if (libHandle != NULL) {
|
if (libHandle != NULL) {
|
||||||
UINT fuLoad = (useVGAColors && !IS_WINXP) ? LR_VGACOLOR : 0;
|
UINT fuLoad = (useVGAColors && !IS_WINXP) ? LR_VGACOLOR : 0;
|
||||||
return ptr_to_jlong(LoadImage(libHandle, MAKEINTRESOURCE(iconID),
|
return ptr_to_jlong(LoadImage(libHandle, MAKEINTRESOURCE(iconID),
|
||||||
|
@ -150,7 +150,7 @@ static PFNGETTHEMETRANSITIONDURATION GetThemeTransitionDuration = NULL;
|
|||||||
|
|
||||||
BOOL InitThemes() {
|
BOOL InitThemes() {
|
||||||
static HMODULE hModThemes = NULL;
|
static HMODULE hModThemes = NULL;
|
||||||
hModThemes = LoadLibrary(TEXT("UXTHEME.DLL"));
|
hModThemes = JDK_LoadSystemLibrary("UXTHEME.DLL");
|
||||||
DTRACE_PRINTLN1("InitThemes hModThemes = %x\n", hModThemes);
|
DTRACE_PRINTLN1("InitThemes hModThemes = %x\n", hModThemes);
|
||||||
if(hModThemes) {
|
if(hModThemes) {
|
||||||
DTRACE_PRINTLN("Loaded UxTheme.dll\n");
|
DTRACE_PRINTLN("Loaded UxTheme.dll\n");
|
||||||
|
@ -284,7 +284,7 @@ AwtFileDialog::Show(void *p)
|
|||||||
file = (jstring)env->GetObjectField(target, AwtFileDialog::fileID);
|
file = (jstring)env->GetObjectField(target, AwtFileDialog::fileID);
|
||||||
if (file != NULL) {
|
if (file != NULL) {
|
||||||
LPCTSTR tmp = JNU_GetStringPlatformChars(env, file, NULL);
|
LPCTSTR tmp = JNU_GetStringPlatformChars(env, file, NULL);
|
||||||
_tcscpy(fileBuffer, tmp);
|
_tcsncpy(fileBuffer, tmp, bufferLimit - 2); // the fileBuffer is double null terminated string
|
||||||
JNU_ReleaseStringPlatformChars(env, file, tmp);
|
JNU_ReleaseStringPlatformChars(env, file, tmp);
|
||||||
} else {
|
} else {
|
||||||
fileBuffer[0] = _T('\0');
|
fileBuffer[0] = _T('\0');
|
||||||
|
@ -43,12 +43,13 @@ extern "C"
|
|||||||
mlibSysFnS_t tempSysFns;
|
mlibSysFnS_t tempSysFns;
|
||||||
mlib_status ret = MLIB_SUCCESS;
|
mlib_status ret = MLIB_SUCCESS;
|
||||||
|
|
||||||
/* Try to load library. Routine should find the library successfully
|
/* Try to receive handle for the library. Routine should find
|
||||||
* because this library is already loaded to the process space by
|
* the library successfully because this library is already
|
||||||
* the System.loadLibrary() call. Here we just need to get handle to
|
* loaded to the process space by the System.loadLibrary() call.
|
||||||
* initialize the pointers to required mlib routines.
|
* Here we just need to get handle to initialize the pointers to
|
||||||
|
* required mlib routines.
|
||||||
*/
|
*/
|
||||||
hDLL = ::LoadLibrary(TEXT("mlib_image.dll"));
|
hDLL = ::GetModuleHandle(TEXT("mlib_image.dll"));
|
||||||
|
|
||||||
if (hDLL == NULL) {
|
if (hDLL == NULL) {
|
||||||
return MLIB_FAILURE;
|
return MLIB_FAILURE;
|
||||||
@ -94,9 +95,6 @@ extern "C"
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != MLIB_SUCCESS) {
|
|
||||||
::FreeLibrary(hDLL);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ void AwtTextArea::Dispose()
|
|||||||
LPCTSTR AwtTextArea::GetClassName() {
|
LPCTSTR AwtTextArea::GetClassName() {
|
||||||
static BOOL richedLibraryLoaded = FALSE;
|
static BOOL richedLibraryLoaded = FALSE;
|
||||||
if (!richedLibraryLoaded) {
|
if (!richedLibraryLoaded) {
|
||||||
::LoadLibrary(TEXT("RICHED20.DLL"));
|
JDK_LoadSystemLibrary("RICHED20.DLL");
|
||||||
richedLibraryLoaded = TRUE;
|
richedLibraryLoaded = TRUE;
|
||||||
}
|
}
|
||||||
return RICHEDIT_CLASS;
|
return RICHEDIT_CLASS;
|
||||||
|
@ -185,7 +185,7 @@ void AwtTrayIcon::InitNID(UINT uID)
|
|||||||
int shellVersion = 5; // WIN_2000
|
int shellVersion = 5; // WIN_2000
|
||||||
// MSDN: DllGetVersion should not be implicitly called, but rather
|
// MSDN: DllGetVersion should not be implicitly called, but rather
|
||||||
// loaded using GetProcAddress
|
// loaded using GetProcAddress
|
||||||
HMODULE hShell = LoadLibrary(TEXT("Shell32.dll"));
|
HMODULE hShell = JDK_LoadSystemLibrary("Shell32.dll");
|
||||||
if (hShell != NULL) {
|
if (hShell != NULL) {
|
||||||
DLLGETVERSIONPROC proc = (DLLGETVERSIONPROC)GetProcAddress(hShell, "DllGetVersion");
|
DLLGETVERSIONPROC proc = (DLLGETVERSIONPROC)GetProcAddress(hShell, "DllGetVersion");
|
||||||
if (proc != NULL) {
|
if (proc != NULL) {
|
||||||
|
@ -63,7 +63,7 @@ SetProcessDPIAwareProperty()
|
|||||||
|
|
||||||
bAlreadySet = TRUE;
|
bAlreadySet = TRUE;
|
||||||
|
|
||||||
HMODULE hLibUser32Dll = ::LoadLibrary(TEXT("user32.dll"));
|
HMODULE hLibUser32Dll = JDK_LoadSystemLibrary("user32.dll");
|
||||||
|
|
||||||
if (hLibUser32Dll != NULL) {
|
if (hLibUser32Dll != NULL) {
|
||||||
SetProcessDPIAwareFunc *lpSetProcessDPIAware =
|
SetProcessDPIAwareFunc *lpSetProcessDPIAware =
|
||||||
|
@ -47,6 +47,7 @@ extern "C" {
|
|||||||
// standard Java headers
|
// standard Java headers
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <jni_util.h>
|
#include <jni_util.h>
|
||||||
|
#include <jdk_util.h>
|
||||||
|
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
_handle = NULL; \
|
_handle = NULL; \
|
||||||
*(pnpt) = NULL; \
|
*(pnpt) = NULL; \
|
||||||
buf[0] = 0; \
|
buf[0] = 0; \
|
||||||
jvm = LoadLibrary("jvm.dll"); \
|
jvm = GetModuleHandle("jvm.dll"); \
|
||||||
if ( jvm == NULL ) NPT_ERROR("Cannot find jvm.dll"); \
|
if ( jvm == NULL ) NPT_ERROR("Cannot find jvm.dll"); \
|
||||||
GetModuleFileName(jvm, buf, FILENAME_MAX); \
|
GetModuleFileName(jvm, buf, FILENAME_MAX); \
|
||||||
lastSlash = strrchr(buf, '\\'); \
|
lastSlash = strrchr(buf, '\\'); \
|
||||||
|
68
jdk/test/java/awt/image/BufferedImage/TinyScale.java
Normal file
68
jdk/test/java/awt/image/BufferedImage/TinyScale.java
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* @test %W% %E%
|
||||||
|
* @bug 7016495
|
||||||
|
* @summary Test tiny scales of BufferedImage
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.geom.*;
|
||||||
|
import java.awt.image.*;
|
||||||
|
|
||||||
|
public class TinyScale {
|
||||||
|
static double tinyscales[] = {
|
||||||
|
1E-0,
|
||||||
|
1E-1,
|
||||||
|
1E-2,
|
||||||
|
1E-3,
|
||||||
|
1E-4,
|
||||||
|
1E-5,
|
||||||
|
1E-6,
|
||||||
|
1E-7,
|
||||||
|
1E-8,
|
||||||
|
1E-9,
|
||||||
|
1E-10,
|
||||||
|
1E-11,
|
||||||
|
1E-12,
|
||||||
|
1E-13,
|
||||||
|
1E-14,
|
||||||
|
1E-15,
|
||||||
|
1E-16,
|
||||||
|
1E-17,
|
||||||
|
1E-18,
|
||||||
|
1E-19,
|
||||||
|
1E-20,
|
||||||
|
1E-21,
|
||||||
|
1E-22,
|
||||||
|
1E-23,
|
||||||
|
1E-24,
|
||||||
|
1E-25,
|
||||||
|
1E-26,
|
||||||
|
1E-27,
|
||||||
|
1E-28,
|
||||||
|
1E-29,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void test(BufferedImage rendImg, BufferedImage drawImg, double s) {
|
||||||
|
Graphics2D g = drawImg.createGraphics();
|
||||||
|
g.transform(new AffineTransform(s, 0.0, -1.0, 1.0, 0.0, 0.0));
|
||||||
|
g.drawImage(rendImg,
|
||||||
|
-rendImg.getWidth() / 2,
|
||||||
|
-rendImg.getHeight() / 2,
|
||||||
|
null);
|
||||||
|
g.drawImage(rendImg, 0, 0, null);
|
||||||
|
g.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
BufferedImage rendImg =
|
||||||
|
new BufferedImage(100, 100, BufferedImage.TYPE_3BYTE_BGR);
|
||||||
|
BufferedImage drawImg =
|
||||||
|
new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
for (double s: tinyscales) {
|
||||||
|
test(rendImg, drawImg, s);
|
||||||
|
for (int i = 0; args.length > 0 && i < 10; i++) {
|
||||||
|
test(rendImg, drawImg, Math.random()*s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
71
jdk/test/java/security/SignedObject/Correctness.java
Normal file
71
jdk/test/java/security/SignedObject/Correctness.java
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 6618658
|
||||||
|
* @summary Deserialization allows creation of mutable SignedObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.ObjectInputStream;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
|
import java.security.KeyPair;
|
||||||
|
import java.security.KeyPairGenerator;
|
||||||
|
import java.security.Signature;
|
||||||
|
import java.security.SignedObject;
|
||||||
|
|
||||||
|
|
||||||
|
public class Correctness {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
|
String SIGALG = "SHA1withRSA";
|
||||||
|
KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
|
||||||
|
KeyPair kp = kpg.generateKeyPair();
|
||||||
|
|
||||||
|
SignedObject so1 = new SignedObject("Hello", kp.getPrivate(),
|
||||||
|
Signature.getInstance(SIGALG));
|
||||||
|
|
||||||
|
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
|
||||||
|
ObjectOutputStream out = new ObjectOutputStream(byteOut);
|
||||||
|
out.writeObject(so1);
|
||||||
|
out.close();
|
||||||
|
|
||||||
|
byte[] data = byteOut.toByteArray();
|
||||||
|
|
||||||
|
SignedObject so2 = (SignedObject)new ObjectInputStream(
|
||||||
|
new ByteArrayInputStream(data)).readObject();
|
||||||
|
|
||||||
|
if (!so2.getObject().equals("Hello")) {
|
||||||
|
throw new Exception("Content changed");
|
||||||
|
}
|
||||||
|
if (!so2.getAlgorithm().equals(SIGALG)) {
|
||||||
|
throw new Exception("Signature algorithm unknown");
|
||||||
|
}
|
||||||
|
if (!so2.verify(kp.getPublic(), Signature.getInstance(SIGALG))) {
|
||||||
|
throw new Exception("Not verified");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
jdk/test/sun/security/pkcs11/Provider/Absolute.cfg
Normal file
10
jdk/test/sun/security/pkcs11/Provider/Absolute.cfg
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#
|
||||||
|
# Configuration file to allow the SunPKCS11 provider to utilize
|
||||||
|
# the Solaris Cryptographic Framework, if it is available
|
||||||
|
#
|
||||||
|
|
||||||
|
name = Absolute
|
||||||
|
|
||||||
|
description = SunPKCS11 using a relative path
|
||||||
|
|
||||||
|
library = ./libpkcs11.so
|
63
jdk/test/sun/security/pkcs11/Provider/Absolute.java
Normal file
63
jdk/test/sun/security/pkcs11/Provider/Absolute.java
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @bug 7003952
|
||||||
|
* @summary load DLLs and launch executables using fully qualified path
|
||||||
|
*/
|
||||||
|
import java.security.*;
|
||||||
|
import java.lang.reflect.*;
|
||||||
|
import sun.security.pkcs11.*;
|
||||||
|
|
||||||
|
public class Absolute {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
Constructor cons;
|
||||||
|
try {
|
||||||
|
Class clazz = Class.forName("sun.security.pkcs11.SunPKCS11");
|
||||||
|
cons = clazz.getConstructor(new Class[] {String.class});
|
||||||
|
} catch (Exception ex) {
|
||||||
|
System.out.println("Skipping test - no PKCS11 provider available");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String config =
|
||||||
|
System.getProperty("test.src", ".") + "/Absolute.cfg";
|
||||||
|
|
||||||
|
try {
|
||||||
|
Object obj = cons.newInstance(new Object[] {config});
|
||||||
|
} catch (InvocationTargetException ite) {
|
||||||
|
Throwable cause = ite.getCause();
|
||||||
|
if (cause instanceof ProviderException) {
|
||||||
|
Throwable cause2 = cause.getCause();
|
||||||
|
if ((cause2 == null) ||
|
||||||
|
!cause2.getMessage().startsWith(
|
||||||
|
"Absolute path required for library value:")) {
|
||||||
|
// rethrow
|
||||||
|
throw (ProviderException) cause;
|
||||||
|
}
|
||||||
|
System.out.println("Caught expected Exception: \n" + cause2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user