copyright year updated 4

This commit is contained in:
honfika@gmail.com
2015-01-13 21:03:15 +01:00
parent f93f0b23e6
commit 1d33920a23
23 changed files with 3736 additions and 3618 deletions

View File

@@ -14,7 +14,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
/* Flash assembler language lexer specification */
package com.jpexs.decompiler.flash.abc.avm2.parser.pcode;

View File

@@ -14,7 +14,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.abc.avm2.parser.AVM2ParseException;

View File

@@ -14,7 +14,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
/* Method info lexer specification */
package com.jpexs.decompiler.flash.abc.methodinfo_parser;

View File

@@ -14,7 +14,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
/* Flash assembler language lexer specification */
package com.jpexs.decompiler.flash.action.parser.pcode;

View File

@@ -14,7 +14,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.parser.script;
import com.jpexs.decompiler.flash.action.parser.ActionParseException;

View File

@@ -14,7 +14,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.tags.text;
/**

View File

@@ -14,7 +14,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.types.annotations.parser;
import java.util.Stack;

View File

@@ -12,8 +12,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
* License along with this library.
*/
package com.jpexs.decompiler.flash;

View File

@@ -1,227 +1,227 @@
/*
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle or the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jpexs.decompiler.flash.gui.helpers;
import java.awt.Component;
import java.awt.Container;
import javax.swing.Spring;
import javax.swing.SpringLayout;
/**
* A 1.4 file that provides utility methods for creating form- or grid-style
* layouts with SpringLayout. These utilities are used by several programs, such
* as SpringBox and SpringCompactGrid.
*/
public class SpringUtilities {
/**
* A debugging utility that prints to stdout the component's minimum,
* preferred, and maximum sizes.
*
* @param c
*/
public static void printSizes(Component c) {
System.out.println("minimumSize = " + c.getMinimumSize());
System.out.println("preferredSize = " + c.getPreferredSize());
System.out.println("maximumSize = " + c.getMaximumSize());
}
/**
* Aligns the first <code>rows</code> * <code>cols</code> components of
* <code>parent</code> in a grid. Each component is as big as the maximum
* preferred width and height of the components. The parent is made just big
* enough to fit them all.
*
* @param parent
* @param rows number of rows
* @param cols number of columns
* @param initialX x location to start the grid at
* @param initialY y location to start the grid at
* @param xPad x padding between cells
* @param yPad y padding between cells
*/
public static void makeGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout) parent.getLayout();
} catch (ClassCastException exc) {
System.err.println("The first argument to makeGrid must use SpringLayout.");
return;
}
Spring xPadSpring = Spring.constant(xPad);
Spring yPadSpring = Spring.constant(yPad);
Spring initialXSpring = Spring.constant(initialX);
Spring initialYSpring = Spring.constant(initialY);
int max = rows * cols;
//Calculate Springs that are the max of the width/height so that all
//cells have the same size.
Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0)).
getWidth();
Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0)).
getHeight();
for (int i = 1; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(
parent.getComponent(i));
maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth());
maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight());
}
//Apply the new width/height Spring. This forces all the
//components to have the same size.
for (int i = 0; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(
parent.getComponent(i));
cons.setWidth(maxWidthSpring);
cons.setHeight(maxHeightSpring);
}
//Then adjust the x/y constraints of all the cells so that they
//are aligned in a grid.
SpringLayout.Constraints lastCons = null;
SpringLayout.Constraints lastRowCons = null;
for (int i = 0; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(
parent.getComponent(i));
if (i % cols == 0) { //start of new row
lastRowCons = lastCons;
cons.setX(initialXSpring);
} else { //x position depends on previous component
cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST),
xPadSpring));
}
if (i / cols == 0) { //first row
cons.setY(initialYSpring);
} else { //y position depends on previous row
cons.setY(Spring.sum(lastRowCons.getConstraint(SpringLayout.SOUTH),
yPadSpring));
}
lastCons = cons;
}
//Set the parent's size.
SpringLayout.Constraints pCons = layout.getConstraints(parent);
pCons.setConstraint(SpringLayout.SOUTH,
Spring.sum(
Spring.constant(yPad),
lastCons.getConstraint(SpringLayout.SOUTH)));
pCons.setConstraint(SpringLayout.EAST,
Spring.sum(
Spring.constant(xPad),
lastCons.getConstraint(SpringLayout.EAST)));
}
/* Used by makeCompactGrid. */
private static SpringLayout.Constraints getConstraintsForCell(
int row, int col,
Container parent,
int cols) {
SpringLayout layout = (SpringLayout) parent.getLayout();
Component c = parent.getComponent(row * cols + col);
return layout.getConstraints(c);
}
/**
* Aligns the first <code>rows</code> * <code>cols</code> components of
* <code>parent</code> in a grid. Each component in a column is as wide as
* the maximum preferred width of the components in that column; height is
* similarly determined for each row. The parent is made just big enough to
* fit them all.
*
* @param parent
* @param rows number of rows
* @param cols number of columns
* @param initialX x location to start the grid at
* @param initialY y location to start the grid at
* @param xPad x padding between cells
* @param yPad y padding between cells
*/
public static void makeCompactGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout) parent.getLayout();
} catch (ClassCastException exc) {
System.err.println("The first argument to makeCompactGrid must use SpringLayout.");
return;
}
//Align all cells in each column and make them the same width.
Spring x = Spring.constant(initialX);
for (int c = 0; c < cols; c++) {
Spring width = Spring.constant(0);
for (int r = 0; r < rows; r++) {
width = Spring.max(width,
getConstraintsForCell(r, c, parent, cols).
getWidth());
}
for (int r = 0; r < rows; r++) {
SpringLayout.Constraints constraints
= getConstraintsForCell(r, c, parent, cols);
constraints.setX(x);
constraints.setWidth(width);
}
x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad)));
}
//Align all cells in each row and make them the same height.
Spring y = Spring.constant(initialY);
for (int r = 0; r < rows; r++) {
Spring height = Spring.constant(0);
for (int c = 0; c < cols; c++) {
height = Spring.max(height,
getConstraintsForCell(r, c, parent, cols).
getHeight());
}
for (int c = 0; c < cols; c++) {
SpringLayout.Constraints constraints
= getConstraintsForCell(r, c, parent, cols);
constraints.setY(y);
constraints.setHeight(height);
}
y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad)));
}
//Set the parent's size.
SpringLayout.Constraints pCons = layout.getConstraints(parent);
pCons.setConstraint(SpringLayout.SOUTH, y);
pCons.setConstraint(SpringLayout.EAST, x);
}
}
/*
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle or the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jpexs.decompiler.flash.gui.helpers;
import java.awt.Component;
import java.awt.Container;
import javax.swing.Spring;
import javax.swing.SpringLayout;
/**
* A 1.4 file that provides utility methods for creating form- or grid-style
* layouts with SpringLayout. These utilities are used by several programs, such
* as SpringBox and SpringCompactGrid.
*/
public class SpringUtilities {
/**
* A debugging utility that prints to stdout the component's minimum,
* preferred, and maximum sizes.
*
* @param c
*/
public static void printSizes(Component c) {
System.out.println("minimumSize = " + c.getMinimumSize());
System.out.println("preferredSize = " + c.getPreferredSize());
System.out.println("maximumSize = " + c.getMaximumSize());
}
/**
* Aligns the first <code>rows</code> * <code>cols</code> components of
* <code>parent</code> in a grid. Each component is as big as the maximum
* preferred width and height of the components. The parent is made just big
* enough to fit them all.
*
* @param parent
* @param rows number of rows
* @param cols number of columns
* @param initialX x location to start the grid at
* @param initialY y location to start the grid at
* @param xPad x padding between cells
* @param yPad y padding between cells
*/
public static void makeGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout) parent.getLayout();
} catch (ClassCastException exc) {
System.err.println("The first argument to makeGrid must use SpringLayout.");
return;
}
Spring xPadSpring = Spring.constant(xPad);
Spring yPadSpring = Spring.constant(yPad);
Spring initialXSpring = Spring.constant(initialX);
Spring initialYSpring = Spring.constant(initialY);
int max = rows * cols;
//Calculate Springs that are the max of the width/height so that all
//cells have the same size.
Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0)).
getWidth();
Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0)).
getHeight();
for (int i = 1; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(
parent.getComponent(i));
maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth());
maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight());
}
//Apply the new width/height Spring. This forces all the
//components to have the same size.
for (int i = 0; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(
parent.getComponent(i));
cons.setWidth(maxWidthSpring);
cons.setHeight(maxHeightSpring);
}
//Then adjust the x/y constraints of all the cells so that they
//are aligned in a grid.
SpringLayout.Constraints lastCons = null;
SpringLayout.Constraints lastRowCons = null;
for (int i = 0; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(
parent.getComponent(i));
if (i % cols == 0) { //start of new row
lastRowCons = lastCons;
cons.setX(initialXSpring);
} else { //x position depends on previous component
cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST),
xPadSpring));
}
if (i / cols == 0) { //first row
cons.setY(initialYSpring);
} else { //y position depends on previous row
cons.setY(Spring.sum(lastRowCons.getConstraint(SpringLayout.SOUTH),
yPadSpring));
}
lastCons = cons;
}
//Set the parent's size.
SpringLayout.Constraints pCons = layout.getConstraints(parent);
pCons.setConstraint(SpringLayout.SOUTH,
Spring.sum(
Spring.constant(yPad),
lastCons.getConstraint(SpringLayout.SOUTH)));
pCons.setConstraint(SpringLayout.EAST,
Spring.sum(
Spring.constant(xPad),
lastCons.getConstraint(SpringLayout.EAST)));
}
/* Used by makeCompactGrid. */
private static SpringLayout.Constraints getConstraintsForCell(
int row, int col,
Container parent,
int cols) {
SpringLayout layout = (SpringLayout) parent.getLayout();
Component c = parent.getComponent(row * cols + col);
return layout.getConstraints(c);
}
/**
* Aligns the first <code>rows</code> * <code>cols</code> components of
* <code>parent</code> in a grid. Each component in a column is as wide as
* the maximum preferred width of the components in that column; height is
* similarly determined for each row. The parent is made just big enough to
* fit them all.
*
* @param parent
* @param rows number of rows
* @param cols number of columns
* @param initialX x location to start the grid at
* @param initialY y location to start the grid at
* @param xPad x padding between cells
* @param yPad y padding between cells
*/
public static void makeCompactGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout) parent.getLayout();
} catch (ClassCastException exc) {
System.err.println("The first argument to makeCompactGrid must use SpringLayout.");
return;
}
//Align all cells in each column and make them the same width.
Spring x = Spring.constant(initialX);
for (int c = 0; c < cols; c++) {
Spring width = Spring.constant(0);
for (int r = 0; r < rows; r++) {
width = Spring.max(width,
getConstraintsForCell(r, c, parent, cols).
getWidth());
}
for (int r = 0; r < rows; r++) {
SpringLayout.Constraints constraints
= getConstraintsForCell(r, c, parent, cols);
constraints.setX(x);
constraints.setWidth(width);
}
x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad)));
}
//Align all cells in each row and make them the same height.
Spring y = Spring.constant(initialY);
for (int r = 0; r < rows; r++) {
Spring height = Spring.constant(0);
for (int c = 0; c < cols; c++) {
height = Spring.max(height,
getConstraintsForCell(r, c, parent, cols).
getHeight());
}
for (int c = 0; c < cols; c++) {
SpringLayout.Constraints constraints
= getConstraintsForCell(r, c, parent, cols);
constraints.setY(y);
constraints.setHeight(height);
}
y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad)));
}
//Set the parent's size.
SpringLayout.Constraints pCons = layout.getConstraints(parent);
pCons.setConstraint(SpringLayout.SOUTH, y);
pCons.setConstraint(SpringLayout.EAST, x);
}
}

View File

@@ -1,32 +1,44 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.sun.jna.platform.win32;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WinDef.LONG;
import com.sun.jna.platform.win32.WinDef.LPVOID;
import com.sun.jna.platform.win32.WinDef.WORD;
import java.util.Arrays;
import java.util.List;
/**
*
* @author JPEXS
*/
public class BITMAP extends Structure {
public LONG bmType;
public LONG bmWidth;
public LONG bmHeight;
public LONG bmWidthBytes;
public WORD bmPlanes;
public WORD bmBitsPixel;
public LPVOID bmBits;
@Override
protected List getFieldOrder() {
return Arrays.asList("bmType", "bmWidth", "bmHeight", "bmWidthBytes", "bmPlanes", "bmBitsPixel", "bmBits");
}
}
/*
* Copyright (C) 2010-2015 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sun.jna.platform.win32;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WinDef.LONG;
import com.sun.jna.platform.win32.WinDef.LPVOID;
import com.sun.jna.platform.win32.WinDef.WORD;
import java.util.Arrays;
import java.util.List;
/**
*
* @author JPEXS
*/
public class BITMAP extends Structure {
public LONG bmType;
public LONG bmWidth;
public LONG bmHeight;
public LONG bmWidthBytes;
public WORD bmPlanes;
public WORD bmBitsPixel;
public LPVOID bmBits;
@Override
protected List getFieldOrder() {
return Arrays.asList("bmType", "bmWidth", "bmHeight", "bmWidthBytes", "bmPlanes", "bmBitsPixel", "bmBits");
}
}

View File

@@ -1,320 +1,332 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.sun.jna.platform.win32;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WinDef.DWORD;
import com.sun.jna.platform.win32.WinDef.HBITMAP;
import com.sun.jna.platform.win32.WinDef.HDC;
import com.sun.jna.platform.win32.WinDef.HRGN;
import com.sun.jna.platform.win32.WinGDI.BITMAPINFO;
import com.sun.jna.platform.win32.WinGDI.BITMAPINFOHEADER;
import com.sun.jna.platform.win32.WinGDI.RGNDATA;
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.ptr.PointerByReference;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
/**
* Definition (incomplete) of <code>gdi32.dll</code>.
*/
public interface Gdi32 extends StdCallLibrary {
Gdi32 INSTANCE = (Gdi32) Native.loadLibrary("gdi32", Gdi32.class,
W32APIOptions.DEFAULT_OPTIONS);
/**
* The ExtCreateRegion function creates a region from the specified region
* and transformation data.
*
* @param lpXform Pointer to an XFORM structure that defines the
* transformation to be performed on the region. If this pointer is NULL,
* the identity transformation is used.
* @param nCount Specifies the number of bytes pointed to by lpRgnData.
* @param lpRgnData Pointer to a RGNDATA structure that contains the region
* data in logical units.
* @return If the function succeeds, the return value is the value of the
* region. If the function fails, the return value is NULL. To get extended
* error information, call GetLastError.
*/
public HRGN ExtCreateRegion(Pointer lpXform, int nCount, RGNDATA lpRgnData);
/**
* The CombineRgn function combines two regions and stores the result in a
* third region. The two regions are combined according to the specified
* mode.
*
* @param hrgnDest Handle to a new region with dimensions defined by
* combining two other regions.
* @param hrgnSrc1 Handle to the first of two regions to be combined.
* @param hrgnSrc2 Handle to the second of two regions to be combined.
* @param fnCombineMode Specifies a mode indicating how the two regions will
* be combined.
* @return The return value specifies the type of the resulting region.
*/
int CombineRgn(HRGN hrgnDest, HRGN hrgnSrc1, HRGN hrgnSrc2,
int fnCombineMode);
/**
* The CreateRectRgn function creates a rectangular region.
*
* @param nLeftRect Specifies the x-coordinate of the upper-left corner of
* the region in logical units.
* @param nTopRect Specifies the y-coordinate of the upper-left corner of
* the region in logical units.
* @param nRightRect Specifies the x-coordinate of the lower-right corner of
* the region in logical units.
* @param nBottomRect Specifies the y-coordinate of the lower-right corner
* of the region in logical units.
* @return If the function succeeds, the return value is the handle to the
* region. If the function fails, the return value is NULL. To get extended
* error information, call GetLastError.
*/
HRGN CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect,
int nBottomRect);
/**
* The CreateRoundRectRgn function creates a rectangular region with rounded
* corners.
*
* @param nLeftRect Specifies the x-coordinate of the upper-left corner of
* the region in logical units.
* @param nTopRect Specifies the y-coordinate of the upper-left corner of
* the region in logical units.
* @param nRightRect Specifies the x-coordinate of the lower-right corner of
* the region in logical units.
* @param nBottomRect Specifies the y-coordinate of the lower-right corner
* of the region in logical units.
* @param nWidthEllipse Specifies the width of the ellipse used to create
* the rounded corners in logical units.
* @param nHeightEllipse Specifies the height of the ellipse used to create
* the rounded corners in logical units.
* @return If the function succeeds, the return value is the handle to the
* region. If the function fails, the return value is NULL. To get extended
* error information, call GetLastError.
*/
HRGN CreateRoundRectRgn(int nLeftRect, int nTopRect, int nRightRect,
int nBottomRect, int nWidthEllipse, int nHeightEllipse);
/**
* The CreatePolyPolygonRgn function creates a region consisting of a series
* of polygons. The polygons can overlap.
*
* @param lppt Pointer to an array of POINT structures that define the
* vertices of the polygons in logical units. The polygons are specified
* consecutively. Each polygon is presumed closed and each vertex is
* specified only once.
* @param lpPolyCounts Pointer to an array of integers, each of which
* specifies the number of points in one of the polygons in the array
* pointed to by lppt.
* @param nCount Specifies the total number of integers in the array pointed
* to by lpPolyCounts.
* @param fnPolyFillMode Specifies the fill mode used to determine which
* pixels are in the region.
* @return If the function succeeds, the return value is the handle to the
* region. If the function fails, the return value is zero. To get extended
* error information, call GetLastError.
*/
HRGN CreatePolyPolygonRgn(WinUser.POINT[] lppt, int[] lpPolyCounts,
int nCount, int fnPolyFillMode);
/**
* The SetRectRgn function converts a region into a rectangular region with
* the specified coordinates.
*
* @param hrgn Handle to the region.
* @param nLeftRect Specifies the x-coordinate of the upper-left corner of
* the rectangular region in logical units.
* @param nTopRect Specifies the y-coordinate of the upper-left corner of
* the rectangular region in logical units.
* @param nRightRect Specifies the x-coordinate of the lower-right corner of
* the rectangular region in logical units.
* @param nBottomRect Specifies the y-coordinate of the lower-right corner
* of the rectangular region in logical units.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
boolean SetRectRgn(HRGN hrgn, int nLeftRect, int nTopRect, int nRightRect,
int nBottomRect);
/**
* The SetPixel function sets the pixel at the specified coordinates to the
* specified color.
*
* @param hDC Handle to the device context.
* @param x Specifies the x-coordinate, in logical units, of the point to be
* set.
* @param y Specifies the y-coordinate, in logical units, of the point to be
* set.
* @param crColor Specifies the color to be used to paint the point. To
* create a COLORREF color value, use the RGB macro.
* @return If the function succeeds, the return value is the RGB value that
* the function sets the pixel to. This value may differ from the color
* specified by crColor; that occurs when an exact match for the specified
* color cannot be found. If the function fails, the return value is 1. To
* get extended error information, call GetLastError. This can be the
* following value.
*/
int SetPixel(HDC hDC, int x, int y, int crColor);
/**
* The CreateCompatibleDC function creates a memory device context (DC)
* compatible with the specified device.
*
* @param hDC Handle to an existing DC. If this handle is NULL, the function
* creates a memory DC compatible with the application's current screen.
* @return If the function succeeds, the return value is the handle to a
* memory DC. If the function fails, the return value is NULL. To get
* extended error information, call GetLastError.
*/
HDC CreateCompatibleDC(HDC hDC);
/**
* The DeleteDC function deletes the specified device context (DC).
*
* @param hDC Handle to the device context.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
boolean DeleteDC(HDC hDC);
/**
* The CreateDIBitmap function creates a compatible bitmap (DDB) from a DIB
* and, optionally, sets the bitmap bits.
*
* @param hDC Handle to a device context.
* @param lpbmih Pointer to a bitmap information header structure, which may
* be one of those shown in the following table.
* @param fdwInit Specifies how the system initializes the bitmap bits.
* @param lpbInit Pointer to an array of bytes containing the initial bitmap
* data.
* @param lpbmi Pointer to a BITMAPINFO structure that describes the
* dimensions and color format of the array pointed to by the lpbInit
* parameter.
* @param fuUsage Specifies whether the bmiColors member of the BITMAPINFO
* structure was initialized and, if so, whether bmiColors contains explicit
* red, green, blue (RGB) values or palette indexes. The fuUsage parameter
* must be one of the following values.
* @return If the function succeeds, the return value is a handle to the
* compatible bitmap. If the function fails, the return value is NULL. To
* get extended error information, call GetLastError.
*/
HBITMAP CreateDIBitmap(HDC hDC, BITMAPINFOHEADER lpbmih, int fdwInit,
Pointer lpbInit, BITMAPINFO lpbmi, int fuUsage);
/**
* The CreateDIBSection function creates a DIB that applications can write
* to directly. The function gives you a pointer to the location of the
* bitmap bit values. You can supply a handle to a file-mapping object that
* the function will use to create the bitmap, or you can let the system
* allocate the memory for the bitmap.
*
* @param hDC Handle to a device context. If the value of iUsage is
* DIB_PAL_COLORS, the function uses this device context's logical palette
* to initialize the DIB colors.
* @param pbmi Pointer to a BITMAPINFO structure that specifies various
* attributes of the DIB, including the bitmap dimensions and colors.
* @param iUsage Specifies the type of data contained in the bmiColors array
* member of the BITMAPINFO structure pointed to by pbmi (either logical
* palette indexes or literal RGB values).
* @param ppvBits Pointer to a variable that receives a pointer to the
* location of the DIB bit values.
* @param hSection Handle to a file-mapping object that the function will
* use to create the DIB. This parameter can be NULL.
* @param dwOffset Specifies the offset from the beginning of the
* file-mapping object referenced by hSection where storage for the bitmap
* bit values is to begin.
* @return Specifies the offset from the beginning of the file-mapping
* object referenced by hSection where storage for the bitmap bit values is
* to begin.
*/
HBITMAP CreateDIBSection(HDC hDC, BITMAPINFO pbmi, int iUsage,
PointerByReference ppvBits, Pointer hSection, int dwOffset);
/**
* The CreateCompatibleBitmap function creates a bitmap compatible with the
* device that is associated with the specified device context.
*
* @param hDC Handle to a device context.
* @param width Specifies the bitmap width, in pixels.
* @param height Specifies the bitmap height, in pixels.
* @return If the function succeeds, the return value is a handle to the
* compatible bitmap (DDB). If the function fails, the return value is NULL.
* To get extended error information, call GetLastError.
*/
HBITMAP CreateCompatibleBitmap(HDC hDC, int width, int height);
/**
* The SelectObject function selects an object into the specified device
* context (DC). The new object replaces the previous object of the same
* type.
*
* @param hDC Handle to the DC.
* @param hGDIObj Handle to the object to be selected.
* @return If the selected object is not a region and the function succeeds,
* the return value is a handle to the object being replaced. If the
* selected object is a region and the function succeeds, the return value
* is one of the REGION values.
*/
HANDLE SelectObject(HDC hDC, HANDLE hGDIObj);
/**
* The DeleteObject function deletes a logical pen, brush, font, bitmap,
* region, or palette, freeing all system resources associated with the
* object. After the object is deleted, the specified handle is no longer
* valid.
*
* @param hObject Handle to a logical pen, brush, font, bitmap, region, or
* palette.
* @return If the function succeeds, the return value is nonzero. If the
* specified handle is not valid or is currently selected into a DC, the
* return value is zero. To get extended error information, call
* GetLastError.
*/
boolean DeleteObject(HANDLE hObject);
/**
* The GetDeviceCaps function retrieves device-specific information for the
* specified device.
*
* @param hdc A handle to the DC.
* @param nIndex The item to be returned.
* @return The return value specifies the value of the desired item. When
* <i>nIndex</i> is <code>BITSPIXEL</code> and the device has 15bpp or
* 16bpp, the return value is 16.
*/
int GetDeviceCaps(HDC hdc, int nIndex);
/**
* The GetDIBits function retrieves the bits fo the specified compatible
* bitmap and copies them into a buffer as a DIB using the specified format.
*
* @param hdc A handle to the device context.
* @param hbmp A handle to the bitmap. This must be a compatible bitmap
* (DDB).
* @param uStartScan The first scan line to retrieve
* @param cScanLines The number of scan lines to retrieve.
* @param lpvBits A pointer to a buffer to receive the bitmap data. If this
* parameter is <code>null</code>, the function passes the dimensions and
* format of the bitmap to the {@link BITMAPINFO} structure pointed to by
* the <i>lpbi</i> parameter.
* @param lpbi A pointer to a {@link BITMAPINFO} structure that specifies
* the desired format for the DIB data.
* @param uUsage The format of the bmiColors member of the {@link
* BITMAPINFO} structure.
* @return
*/
int GetDIBits(HDC hdc, HBITMAP hbmp, int uStartScan, int cScanLines, Pointer lpvBits, BITMAPINFO lpbi, int uUsage);
int GetObject(HANDLE hgdiobj, int cbBuffer, Structure lpvObject);
DWORD GetPixel(HDC hdc, int nXPos, int nYPos);
HANDLE CreateSolidBrush(DWORD crColor);
}
/*
* Copyright (C) 2010-2015 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sun.jna.platform.win32;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WinDef.DWORD;
import com.sun.jna.platform.win32.WinDef.HBITMAP;
import com.sun.jna.platform.win32.WinDef.HDC;
import com.sun.jna.platform.win32.WinDef.HRGN;
import com.sun.jna.platform.win32.WinGDI.BITMAPINFO;
import com.sun.jna.platform.win32.WinGDI.BITMAPINFOHEADER;
import com.sun.jna.platform.win32.WinGDI.RGNDATA;
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.ptr.PointerByReference;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
/**
* Definition (incomplete) of <code>gdi32.dll</code>.
*/
public interface Gdi32 extends StdCallLibrary {
Gdi32 INSTANCE = (Gdi32) Native.loadLibrary("gdi32", Gdi32.class,
W32APIOptions.DEFAULT_OPTIONS);
/**
* The ExtCreateRegion function creates a region from the specified region
* and transformation data.
*
* @param lpXform Pointer to an XFORM structure that defines the
* transformation to be performed on the region. If this pointer is NULL,
* the identity transformation is used.
* @param nCount Specifies the number of bytes pointed to by lpRgnData.
* @param lpRgnData Pointer to a RGNDATA structure that contains the region
* data in logical units.
* @return If the function succeeds, the return value is the value of the
* region. If the function fails, the return value is NULL. To get extended
* error information, call GetLastError.
*/
public HRGN ExtCreateRegion(Pointer lpXform, int nCount, RGNDATA lpRgnData);
/**
* The CombineRgn function combines two regions and stores the result in a
* third region. The two regions are combined according to the specified
* mode.
*
* @param hrgnDest Handle to a new region with dimensions defined by
* combining two other regions.
* @param hrgnSrc1 Handle to the first of two regions to be combined.
* @param hrgnSrc2 Handle to the second of two regions to be combined.
* @param fnCombineMode Specifies a mode indicating how the two regions will
* be combined.
* @return The return value specifies the type of the resulting region.
*/
int CombineRgn(HRGN hrgnDest, HRGN hrgnSrc1, HRGN hrgnSrc2,
int fnCombineMode);
/**
* The CreateRectRgn function creates a rectangular region.
*
* @param nLeftRect Specifies the x-coordinate of the upper-left corner of
* the region in logical units.
* @param nTopRect Specifies the y-coordinate of the upper-left corner of
* the region in logical units.
* @param nRightRect Specifies the x-coordinate of the lower-right corner of
* the region in logical units.
* @param nBottomRect Specifies the y-coordinate of the lower-right corner
* of the region in logical units.
* @return If the function succeeds, the return value is the handle to the
* region. If the function fails, the return value is NULL. To get extended
* error information, call GetLastError.
*/
HRGN CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect,
int nBottomRect);
/**
* The CreateRoundRectRgn function creates a rectangular region with rounded
* corners.
*
* @param nLeftRect Specifies the x-coordinate of the upper-left corner of
* the region in logical units.
* @param nTopRect Specifies the y-coordinate of the upper-left corner of
* the region in logical units.
* @param nRightRect Specifies the x-coordinate of the lower-right corner of
* the region in logical units.
* @param nBottomRect Specifies the y-coordinate of the lower-right corner
* of the region in logical units.
* @param nWidthEllipse Specifies the width of the ellipse used to create
* the rounded corners in logical units.
* @param nHeightEllipse Specifies the height of the ellipse used to create
* the rounded corners in logical units.
* @return If the function succeeds, the return value is the handle to the
* region. If the function fails, the return value is NULL. To get extended
* error information, call GetLastError.
*/
HRGN CreateRoundRectRgn(int nLeftRect, int nTopRect, int nRightRect,
int nBottomRect, int nWidthEllipse, int nHeightEllipse);
/**
* The CreatePolyPolygonRgn function creates a region consisting of a series
* of polygons. The polygons can overlap.
*
* @param lppt Pointer to an array of POINT structures that define the
* vertices of the polygons in logical units. The polygons are specified
* consecutively. Each polygon is presumed closed and each vertex is
* specified only once.
* @param lpPolyCounts Pointer to an array of integers, each of which
* specifies the number of points in one of the polygons in the array
* pointed to by lppt.
* @param nCount Specifies the total number of integers in the array pointed
* to by lpPolyCounts.
* @param fnPolyFillMode Specifies the fill mode used to determine which
* pixels are in the region.
* @return If the function succeeds, the return value is the handle to the
* region. If the function fails, the return value is zero. To get extended
* error information, call GetLastError.
*/
HRGN CreatePolyPolygonRgn(WinUser.POINT[] lppt, int[] lpPolyCounts,
int nCount, int fnPolyFillMode);
/**
* The SetRectRgn function converts a region into a rectangular region with
* the specified coordinates.
*
* @param hrgn Handle to the region.
* @param nLeftRect Specifies the x-coordinate of the upper-left corner of
* the rectangular region in logical units.
* @param nTopRect Specifies the y-coordinate of the upper-left corner of
* the rectangular region in logical units.
* @param nRightRect Specifies the x-coordinate of the lower-right corner of
* the rectangular region in logical units.
* @param nBottomRect Specifies the y-coordinate of the lower-right corner
* of the rectangular region in logical units.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
boolean SetRectRgn(HRGN hrgn, int nLeftRect, int nTopRect, int nRightRect,
int nBottomRect);
/**
* The SetPixel function sets the pixel at the specified coordinates to the
* specified color.
*
* @param hDC Handle to the device context.
* @param x Specifies the x-coordinate, in logical units, of the point to be
* set.
* @param y Specifies the y-coordinate, in logical units, of the point to be
* set.
* @param crColor Specifies the color to be used to paint the point. To
* create a COLORREF color value, use the RGB macro.
* @return If the function succeeds, the return value is the RGB value that
* the function sets the pixel to. This value may differ from the color
* specified by crColor; that occurs when an exact match for the specified
* color cannot be found. If the function fails, the return value is 1. To
* get extended error information, call GetLastError. This can be the
* following value.
*/
int SetPixel(HDC hDC, int x, int y, int crColor);
/**
* The CreateCompatibleDC function creates a memory device context (DC)
* compatible with the specified device.
*
* @param hDC Handle to an existing DC. If this handle is NULL, the function
* creates a memory DC compatible with the application's current screen.
* @return If the function succeeds, the return value is the handle to a
* memory DC. If the function fails, the return value is NULL. To get
* extended error information, call GetLastError.
*/
HDC CreateCompatibleDC(HDC hDC);
/**
* The DeleteDC function deletes the specified device context (DC).
*
* @param hDC Handle to the device context.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
boolean DeleteDC(HDC hDC);
/**
* The CreateDIBitmap function creates a compatible bitmap (DDB) from a DIB
* and, optionally, sets the bitmap bits.
*
* @param hDC Handle to a device context.
* @param lpbmih Pointer to a bitmap information header structure, which may
* be one of those shown in the following table.
* @param fdwInit Specifies how the system initializes the bitmap bits.
* @param lpbInit Pointer to an array of bytes containing the initial bitmap
* data.
* @param lpbmi Pointer to a BITMAPINFO structure that describes the
* dimensions and color format of the array pointed to by the lpbInit
* parameter.
* @param fuUsage Specifies whether the bmiColors member of the BITMAPINFO
* structure was initialized and, if so, whether bmiColors contains explicit
* red, green, blue (RGB) values or palette indexes. The fuUsage parameter
* must be one of the following values.
* @return If the function succeeds, the return value is a handle to the
* compatible bitmap. If the function fails, the return value is NULL. To
* get extended error information, call GetLastError.
*/
HBITMAP CreateDIBitmap(HDC hDC, BITMAPINFOHEADER lpbmih, int fdwInit,
Pointer lpbInit, BITMAPINFO lpbmi, int fuUsage);
/**
* The CreateDIBSection function creates a DIB that applications can write
* to directly. The function gives you a pointer to the location of the
* bitmap bit values. You can supply a handle to a file-mapping object that
* the function will use to create the bitmap, or you can let the system
* allocate the memory for the bitmap.
*
* @param hDC Handle to a device context. If the value of iUsage is
* DIB_PAL_COLORS, the function uses this device context's logical palette
* to initialize the DIB colors.
* @param pbmi Pointer to a BITMAPINFO structure that specifies various
* attributes of the DIB, including the bitmap dimensions and colors.
* @param iUsage Specifies the type of data contained in the bmiColors array
* member of the BITMAPINFO structure pointed to by pbmi (either logical
* palette indexes or literal RGB values).
* @param ppvBits Pointer to a variable that receives a pointer to the
* location of the DIB bit values.
* @param hSection Handle to a file-mapping object that the function will
* use to create the DIB. This parameter can be NULL.
* @param dwOffset Specifies the offset from the beginning of the
* file-mapping object referenced by hSection where storage for the bitmap
* bit values is to begin.
* @return Specifies the offset from the beginning of the file-mapping
* object referenced by hSection where storage for the bitmap bit values is
* to begin.
*/
HBITMAP CreateDIBSection(HDC hDC, BITMAPINFO pbmi, int iUsage,
PointerByReference ppvBits, Pointer hSection, int dwOffset);
/**
* The CreateCompatibleBitmap function creates a bitmap compatible with the
* device that is associated with the specified device context.
*
* @param hDC Handle to a device context.
* @param width Specifies the bitmap width, in pixels.
* @param height Specifies the bitmap height, in pixels.
* @return If the function succeeds, the return value is a handle to the
* compatible bitmap (DDB). If the function fails, the return value is NULL.
* To get extended error information, call GetLastError.
*/
HBITMAP CreateCompatibleBitmap(HDC hDC, int width, int height);
/**
* The SelectObject function selects an object into the specified device
* context (DC). The new object replaces the previous object of the same
* type.
*
* @param hDC Handle to the DC.
* @param hGDIObj Handle to the object to be selected.
* @return If the selected object is not a region and the function succeeds,
* the return value is a handle to the object being replaced. If the
* selected object is a region and the function succeeds, the return value
* is one of the REGION values.
*/
HANDLE SelectObject(HDC hDC, HANDLE hGDIObj);
/**
* The DeleteObject function deletes a logical pen, brush, font, bitmap,
* region, or palette, freeing all system resources associated with the
* object. After the object is deleted, the specified handle is no longer
* valid.
*
* @param hObject Handle to a logical pen, brush, font, bitmap, region, or
* palette.
* @return If the function succeeds, the return value is nonzero. If the
* specified handle is not valid or is currently selected into a DC, the
* return value is zero. To get extended error information, call
* GetLastError.
*/
boolean DeleteObject(HANDLE hObject);
/**
* The GetDeviceCaps function retrieves device-specific information for the
* specified device.
*
* @param hdc A handle to the DC.
* @param nIndex The item to be returned.
* @return The return value specifies the value of the desired item. When
* <i>nIndex</i> is <code>BITSPIXEL</code> and the device has 15bpp or
* 16bpp, the return value is 16.
*/
int GetDeviceCaps(HDC hdc, int nIndex);
/**
* The GetDIBits function retrieves the bits fo the specified compatible
* bitmap and copies them into a buffer as a DIB using the specified format.
*
* @param hdc A handle to the device context.
* @param hbmp A handle to the bitmap. This must be a compatible bitmap
* (DDB).
* @param uStartScan The first scan line to retrieve
* @param cScanLines The number of scan lines to retrieve.
* @param lpvBits A pointer to a buffer to receive the bitmap data. If this
* parameter is <code>null</code>, the function passes the dimensions and
* format of the bitmap to the {@link BITMAPINFO} structure pointed to by
* the <i>lpbi</i> parameter.
* @param lpbi A pointer to a {@link BITMAPINFO} structure that specifies
* the desired format for the DIB data.
* @param uUsage The format of the bmiColors member of the {@link
* BITMAPINFO} structure.
* @return
*/
int GetDIBits(HDC hdc, HBITMAP hbmp, int uStartScan, int cScanLines, Pointer lpvBits, BITMAPINFO lpbi, int uUsage);
int GetObject(HANDLE hgdiobj, int cbBuffer, Structure lpvObject);
DWORD GetPixel(HDC hdc, int nXPos, int nYPos);
HANDLE CreateSolidBrush(DWORD crColor);
}

View File

@@ -1,29 +1,41 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.sun.jna.platform.win32;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WinDef.DWORD;
import com.sun.jna.platform.win32.WinDef.HBITMAP;
import java.util.Arrays;
import java.util.List;
/**
*
* @author JPEXS
*/
public class ICONINFO extends Structure {
public boolean fIcon;
public DWORD xHotspot;
public DWORD yHotspot;
public HBITMAP hbmMask;
public HBITMAP hbmColor;
@Override
protected List getFieldOrder() {
return Arrays.asList("fIcon", "xHotspot", "yHotspot", "hbmMask", "hbmColor");
}
}
/*
* Copyright (C) 2010-2015 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sun.jna.platform.win32;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WinDef.DWORD;
import com.sun.jna.platform.win32.WinDef.HBITMAP;
import java.util.Arrays;
import java.util.List;
/**
*
* @author JPEXS
*/
public class ICONINFO extends Structure {
public boolean fIcon;
public DWORD xHotspot;
public DWORD yHotspot;
public HBITMAP hbmMask;
public HBITMAP hbmColor;
@Override
protected List getFieldOrder() {
return Arrays.asList("fIcon", "xHotspot", "yHotspot", "hbmMask", "hbmColor");
}
}

View File

@@ -1,5 +1,5 @@
/* Copyright (c) 2007 Timothy Wall, All Rights Reserved
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either

View File

@@ -1,33 +1,45 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.sun.jna.platform.win32;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.BaseTSD.SIZE_T;
import java.util.Arrays;
import java.util.List;
/**
*
* @author JPEXS
*/
public class MEMORY_BASIC_INFORMATION extends Structure {
public Pointer baseAddress;
public Pointer allocationBase;
public NativeLong allocationProtect;
public SIZE_T regionSize;
public NativeLong state;
public NativeLong protect;
public NativeLong type;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"baseAddress", "allocationBase", "allocationProtect",
"regionSize", "state", "protect", "type"});
}
}
/*
* Copyright (C) 2010-2015 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sun.jna.platform.win32;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.BaseTSD.SIZE_T;
import java.util.Arrays;
import java.util.List;
/**
*
* @author JPEXS
*/
public class MEMORY_BASIC_INFORMATION extends Structure {
public Pointer baseAddress;
public Pointer allocationBase;
public NativeLong allocationProtect;
public SIZE_T regionSize;
public NativeLong state;
public NativeLong protect;
public NativeLong type;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"baseAddress", "allocationBase", "allocationProtect",
"regionSize", "state", "protect", "type"});
}
}

View File

@@ -1,85 +1,97 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.sun.jna.platform.win32;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import java.util.Arrays;
import java.util.List;
public class PROCESSENTRY32 extends Structure {
public static class ByReference extends PROCESSENTRY32 implements Structure.ByReference {
public ByReference() {
}
public ByReference(Pointer memory) {
super(memory);
}
}
public PROCESSENTRY32() {
dwSize = new WinDef.DWORD(size());
}
public PROCESSENTRY32(Pointer memory) {
super(memory);
read();
}
/**
* The size of the structure, in bytes. Before calling the Process32First
* function, set this member to sizeof(PROCESSENTRY32). If you do not
* initialize dwSize, Process32First fails.
*/
public WinDef.DWORD dwSize;
/**
* This member is no longer used and is always set to zero.
*/
public WinDef.DWORD cntUsage;
/**
* The process identifier.
*/
public WinNT.DWORD th32ProcessID;
/**
* This member is no longer used and is always set to zero.
*/
public BaseTSD.ULONG_PTR th32DefaultHeapID;
/**
* This member is no longer used and is always set to zero.
*/
public WinDef.DWORD th32ModuleID;
/**
* The number of execution threads started by the process.
*/
public WinDef.DWORD cntThreads;
/**
* The identifier of the process that created this process (its parent
* process).
*/
public WinDef.DWORD th32ParentProcessID;
/**
* The base priority of any threads created by this process.
*/
public WinDef.LONG pcPriClassBase;
/**
* This member is no longer used, and is always set to zero.
*/
public WinDef.DWORD dwFlags;
/**
* The name of the executable file for the process. To retrieve the full
* path to the executable file, call the Module32First function and check
* the szExePath member of the MODULEENTRY32 structure that is returned.
* However, if the calling process is a 32-bit process, you must call the
* QueryFullProcessImageName function to retrieve the full path of the
* executable file for a 64-bit process.
*/
public char[] szExeFile = new char[WinDef.MAX_PATH];
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"dwSize", "cntUsage", "th32ProcessID", "th32DefaultHeapID", "th32ModuleID", "cntThreads", "th32ParentProcessID", "pcPriClassBase", "dwFlags", "szExeFile"});
}
}
/*
* Copyright (C) 2010-2015 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sun.jna.platform.win32;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import java.util.Arrays;
import java.util.List;
public class PROCESSENTRY32 extends Structure {
public static class ByReference extends PROCESSENTRY32 implements Structure.ByReference {
public ByReference() {
}
public ByReference(Pointer memory) {
super(memory);
}
}
public PROCESSENTRY32() {
dwSize = new WinDef.DWORD(size());
}
public PROCESSENTRY32(Pointer memory) {
super(memory);
read();
}
/**
* The size of the structure, in bytes. Before calling the Process32First
* function, set this member to sizeof(PROCESSENTRY32). If you do not
* initialize dwSize, Process32First fails.
*/
public WinDef.DWORD dwSize;
/**
* This member is no longer used and is always set to zero.
*/
public WinDef.DWORD cntUsage;
/**
* The process identifier.
*/
public WinNT.DWORD th32ProcessID;
/**
* This member is no longer used and is always set to zero.
*/
public BaseTSD.ULONG_PTR th32DefaultHeapID;
/**
* This member is no longer used and is always set to zero.
*/
public WinDef.DWORD th32ModuleID;
/**
* The number of execution threads started by the process.
*/
public WinDef.DWORD cntThreads;
/**
* The identifier of the process that created this process (its parent
* process).
*/
public WinDef.DWORD th32ParentProcessID;
/**
* The base priority of any threads created by this process.
*/
public WinDef.LONG pcPriClassBase;
/**
* This member is no longer used, and is always set to zero.
*/
public WinDef.DWORD dwFlags;
/**
* The name of the executable file for the process. To retrieve the full
* path to the executable file, call the Module32First function and check
* the szExePath member of the MODULEENTRY32 structure that is returned.
* However, if the calling process is a 32-bit process, you must call the
* QueryFullProcessImageName function to retrieve the full path of the
* executable file for a 64-bit process.
*/
public char[] szExeFile = new char[WinDef.MAX_PATH];
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"dwSize", "cntUsage", "th32ProcessID", "th32DefaultHeapID", "th32ModuleID", "cntThreads", "th32ParentProcessID", "pcPriClassBase", "dwFlags", "szExeFile"});
}
}

View File

@@ -1,22 +1,34 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.sun.jna.platform.win32;
import com.sun.jna.Native;
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.win32.StdCallLibrary;
/**
*
* @author petrik
*/
public interface Psapi extends StdCallLibrary {
Psapi INSTANCE = (Psapi) Native.loadLibrary("Psapi", Psapi.class);
//For some Windows 7 Versions and older down to XP
//boolean EnumProcesses(int[] ProcessIDsOut, int size, int[] BytesReturned);
int GetProcessImageFileNameW(HANDLE Process, char[] outputname, int lenght);
}
/*
* Copyright (C) 2010-2015 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sun.jna.platform.win32;
import com.sun.jna.Native;
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.win32.StdCallLibrary;
/**
*
* @author petrik
*/
public interface Psapi extends StdCallLibrary {
Psapi INSTANCE = (Psapi) Native.loadLibrary("Psapi", Psapi.class);
//For some Windows 7 Versions and older down to XP
//boolean EnumProcesses(int[] ProcessIDsOut, int size, int[] BytesReturned);
int GetProcessImageFileNameW(HANDLE Process, char[] outputname, int lenght);
}

View File

@@ -1,36 +1,52 @@
package com.sun.jna.platform.win32;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.WString;
import com.sun.jna.platform.win32.WinDef.HINSTANCE;
import com.sun.jna.platform.win32.WinDef.HWND;
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.platform.win32.WinReg.HKEY;
import java.util.Arrays;
import java.util.List;
public class SHELLEXECUTEINFO extends Structure {
public int cbSize = size();
public int fMask;
public HWND hwnd;
public WString lpVerb;
public WString lpFile;
public WString lpParameters;
public WString lpDirectory;
public int nShow;
public HINSTANCE hInstApp;
public Pointer lpIDList;
public WString lpClass;
public HKEY hKeyClass;
public int dwHotKey;
public HANDLE hMonitor;
public HANDLE hProcess;
@Override
protected List<String> getFieldOrder() {
return Arrays.asList(new String[]{"cbSize", "fMask", "hwnd", "lpVerb", "lpFile", "lpParameters", "lpDirectory", "nShow", "hInstApp", "lpIDList",
"lpClass", "hKeyClass", "dwHotKey", "hMonitor", "hProcess"});
}
}
/*
* Copyright (C) 2010-2015 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sun.jna.platform.win32;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.WString;
import com.sun.jna.platform.win32.WinDef.HINSTANCE;
import com.sun.jna.platform.win32.WinDef.HWND;
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.platform.win32.WinReg.HKEY;
import java.util.Arrays;
import java.util.List;
public class SHELLEXECUTEINFO extends Structure {
public int cbSize = size();
public int fMask;
public HWND hwnd;
public WString lpVerb;
public WString lpFile;
public WString lpParameters;
public WString lpDirectory;
public int nShow;
public HINSTANCE hInstApp;
public Pointer lpIDList;
public WString lpClass;
public HKEY hKeyClass;
public int dwHotKey;
public HANDLE hMonitor;
public HANDLE hProcess;
@Override
protected List<String> getFieldOrder() {
return Arrays.asList(new String[]{"cbSize", "fMask", "hwnd", "lpVerb", "lpFile", "lpParameters", "lpDirectory", "nShow", "hInstApp", "lpIDList",
"lpClass", "hKeyClass", "dwHotKey", "hMonitor", "hProcess"});
}
}

View File

@@ -1,29 +1,41 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.sun.jna.platform.win32;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WinDef.DWORD;
import com.sun.jna.platform.win32.WinDef.HICON;
import java.util.Arrays;
import java.util.List;
/**
*
* @author JPEXS
*/
public class SHFILEINFO extends Structure {
public HICON hIcon;
public int iIcon;
public DWORD dwAttributes;
public char[] szDisplayName = new char[260];
public char[] szTypeName = new char[80];
@Override
protected List getFieldOrder() {
return Arrays.asList("hIcon", "iIcon", "dwAttributes", "szDisplayName", "szTypeName");
}
}
/*
* Copyright (C) 2010-2015 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sun.jna.platform.win32;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WinDef.DWORD;
import com.sun.jna.platform.win32.WinDef.HICON;
import java.util.Arrays;
import java.util.List;
/**
*
* @author JPEXS
*/
public class SHFILEINFO extends Structure {
public HICON hIcon;
public int iIcon;
public DWORD dwAttributes;
public char[] szDisplayName = new char[260];
public char[] szTypeName = new char[80];
@Override
protected List getFieldOrder() {
return Arrays.asList("hIcon", "iIcon", "dwAttributes", "szDisplayName", "szTypeName");
}
}

View File

@@ -1,5 +1,5 @@
/* Copyright (c) 2007 Timothy Wall, All Rights Reserved
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,130 +1,142 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.sun.jna.platform.win32;
/**
*
* @author petrik
*/
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WinDef.RECT;
import com.sun.jna.win32.StdCallLibrary;
import java.util.Arrays;
import java.util.List;
/**
* Ported from WinGDI.h. Microsoft Windows SDK 6.0A.
*
* @author dblock[at]dblock.org
*/
public interface WinGDI extends StdCallLibrary {
public int RDH_RECTANGLES = 1;
public class RGNDATAHEADER extends Structure {
public int dwSize = size();
public int iType = RDH_RECTANGLES; // required
public int nCount;
public int nRgnSize;
public RECT rcBound;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"dwSize", "iType", "nCount", "nRgnSize", "rcBound"});
}
}
public class RGNDATA extends Structure {
public RGNDATAHEADER rdh;
public byte[] Buffer;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"rdh", "Buffer"});
}
public RGNDATA() {
this(1);
}
public RGNDATA(int bufferSize) {
Buffer = new byte[bufferSize];
allocateMemory();
}
}
public int RGN_AND = 1;
public int RGN_OR = 2;
public int RGN_XOR = 3;
public int RGN_DIFF = 4;
public int RGN_COPY = 5;
public int ERROR = 0;
public int NULLREGION = 1;
public int SIMPLEREGION = 2;
public int COMPLEXREGION = 3;
public int ALTERNATE = 1;
public int WINDING = 2;
public int BI_RGB = 0;
public int BI_RLE8 = 1;
public int BI_RLE4 = 2;
public int BI_BITFIELDS = 3;
public int BI_JPEG = 4;
public int BI_PNG = 5;
public class BITMAPINFOHEADER extends Structure {
public int biSize = size();
public int biWidth;
public int biHeight;
public short biPlanes;
public short biBitCount;
public int biCompression;
public int biSizeImage;
public int biXPelsPerMeter;
public int biYPelsPerMeter;
public int biClrUsed;
public int biClrImportant;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"biSize", "biWidth", "biHeight", "biPlanes", "biBitCount", "biCompression", "biSizeImage", "biXPelsPerMeter", "biYPelsPerMeter", "biClrUsed", "biClrImportant"});
}
}
public class RGBQUAD extends Structure {
public byte rgbBlue;
public byte rgbGreen;
public byte rgbRed;
public byte rgbReserved = 0;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"rgbBlue", "rgbGreen", "rgbRed", "rgbReserved"});
}
}
public class BITMAPINFO extends Structure {
public BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER();
public RGBQUAD[] bmiColors = new RGBQUAD[1];
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"bmiHeader", "bmiColors"});
}
public BITMAPINFO() {
this(1);
}
public BITMAPINFO(int size) {
bmiColors = new RGBQUAD[size];
}
}
public int DIB_RGB_COLORS = 0;
public int DIB_PAL_COLORS = 1;
}
/*
* Copyright (C) 2010-2015 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sun.jna.platform.win32;
/**
*
* @author JPEXS
*/
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WinDef.RECT;
import com.sun.jna.win32.StdCallLibrary;
import java.util.Arrays;
import java.util.List;
/**
* Ported from WinGDI.h. Microsoft Windows SDK 6.0A.
*
* @author dblock[at]dblock.org
*/
public interface WinGDI extends StdCallLibrary {
public int RDH_RECTANGLES = 1;
public class RGNDATAHEADER extends Structure {
public int dwSize = size();
public int iType = RDH_RECTANGLES; // required
public int nCount;
public int nRgnSize;
public RECT rcBound;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"dwSize", "iType", "nCount", "nRgnSize", "rcBound"});
}
}
public class RGNDATA extends Structure {
public RGNDATAHEADER rdh;
public byte[] Buffer;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"rdh", "Buffer"});
}
public RGNDATA() {
this(1);
}
public RGNDATA(int bufferSize) {
Buffer = new byte[bufferSize];
allocateMemory();
}
}
public int RGN_AND = 1;
public int RGN_OR = 2;
public int RGN_XOR = 3;
public int RGN_DIFF = 4;
public int RGN_COPY = 5;
public int ERROR = 0;
public int NULLREGION = 1;
public int SIMPLEREGION = 2;
public int COMPLEXREGION = 3;
public int ALTERNATE = 1;
public int WINDING = 2;
public int BI_RGB = 0;
public int BI_RLE8 = 1;
public int BI_RLE4 = 2;
public int BI_BITFIELDS = 3;
public int BI_JPEG = 4;
public int BI_PNG = 5;
public class BITMAPINFOHEADER extends Structure {
public int biSize = size();
public int biWidth;
public int biHeight;
public short biPlanes;
public short biBitCount;
public int biCompression;
public int biSizeImage;
public int biXPelsPerMeter;
public int biYPelsPerMeter;
public int biClrUsed;
public int biClrImportant;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"biSize", "biWidth", "biHeight", "biPlanes", "biBitCount", "biCompression", "biSizeImage", "biXPelsPerMeter", "biYPelsPerMeter", "biClrUsed", "biClrImportant"});
}
}
public class RGBQUAD extends Structure {
public byte rgbBlue;
public byte rgbGreen;
public byte rgbRed;
public byte rgbReserved = 0;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"rgbBlue", "rgbGreen", "rgbRed", "rgbReserved"});
}
}
public class BITMAPINFO extends Structure {
public BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER();
public RGBQUAD[] bmiColors = new RGBQUAD[1];
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"bmiHeader", "bmiColors"});
}
public BITMAPINFO() {
this(1);
}
public BITMAPINFO(int size) {
bmiColors = new RGBQUAD[size];
}
}
public int DIB_RGB_COLORS = 0;
public int DIB_PAL_COLORS = 1;
}

View File

@@ -1,18 +1,18 @@
/*
* Copyright (C) 2010-2015 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* Copyright (C) 2010-2015 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package sample;
import org.testng.annotations.Test;