Skip to content

Commit

Permalink
platform: JNA updated to 4.1.0 (code)
Browse files Browse the repository at this point in the history
  • Loading branch information
trespasserw committed Sep 21, 2015
1 parent 30a7f90 commit a6507bc
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
import com.sun.jna.win32.W32APIFunctionMapper;
import com.sun.jna.win32.W32APITypeMapper;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.sun.jna.Library.OPTION_FUNCTION_MAPPER;
Expand Down Expand Up @@ -123,8 +125,15 @@ boolean CryptUnprotectData(DATA_BLOB pDataIn,
DATA_BLOB pDataOut);

class DATA_BLOB extends Structure implements Structure.ByReference {
private static final List __FIELDS = Arrays.asList("cbData", "pbData");

public W32API.DWORD cbData;
public Pointer pbData;

@Override
protected List getFieldOrder() {
return __FIELDS;
}
}
}

Expand Down
23 changes: 23 additions & 0 deletions platform/util/src/com/intellij/ui/mac/foundation/Foundation.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
Expand Down Expand Up @@ -350,16 +352,25 @@ public void drain() {
}

public static class NSRect extends Structure implements Structure.ByValue {
private static final List __FIELDS = Arrays.asList("origin", "size");

public NSPoint origin;
public NSSize size;

public NSRect(double x, double y, double w, double h) {
origin = new NSPoint(x, y);
size = new NSSize(w, h);
}

@Override
protected List getFieldOrder() {
return __FIELDS;
}
}

public static class NSPoint extends Structure implements Structure.ByValue {
private static final List __FIELDS = Arrays.asList("x", "y");

public CGFloat x;
public CGFloat y;

Expand All @@ -372,9 +383,16 @@ public NSPoint(double x, double y) {
this.x = new CGFloat(x);
this.y = new CGFloat(y);
}

@Override
protected List getFieldOrder() {
return __FIELDS;
}
}

public static class NSSize extends Structure implements Structure.ByValue {
private static final List __FIELDS = Arrays.asList("width", "height");

public CGFloat width;
public CGFloat height;

Expand All @@ -387,6 +405,11 @@ public NSSize(double width, double height) {
this.width = new CGFloat(width);
this.height = new CGFloat(height);
}

@Override
protected List getFieldOrder() {
return __FIELDS;
}
}

public static class CGFloat implements NativeMapped {
Expand Down
18 changes: 18 additions & 0 deletions updater/src/com/intellij/updater/Win32RestartManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.LongByReference;

import java.util.Arrays;
import java.util.List;

public interface Win32RestartManager extends Library {

Win32RestartManager INSTANCE = (Win32RestartManager) Native.loadLibrary("Rstrtmgr", Win32RestartManager.class);
Expand All @@ -30,18 +33,33 @@ public interface Win32RestartManager extends Library {
int CCH_RM_MAX_SVC_NAME = 63;

class RmUniqueProcess extends Structure {
private static final List __FIELDS = Arrays.asList("dwProcessId", "ProcessStartTime");

public int dwProcessId;
public WinBase.FILETIME ProcessStartTime;

@Override
protected List getFieldOrder() {
return __FIELDS;
}
}

class RmProcessInfo extends Structure {
private static final List __FIELDS = Arrays.asList(
"Process", "strAppName", "strServiceShortName", "ApplicationType", "AppStatus", "TSSessionId", "bRestartable");

public RmUniqueProcess Process;
public char[] strAppName = new char[CCH_RM_MAX_APP_NAME + 1];
public char[] strServiceShortName = new char[CCH_RM_MAX_SVC_NAME + 1];
public int ApplicationType;
public WinDef.LONG AppStatus;
public int TSSessionId;
public boolean bRestartable;

@Override
protected List getFieldOrder() {
return __FIELDS;
}
}

int RmGetList(int dwSessionHandle,
Expand Down

0 comments on commit a6507bc

Please sign in to comment.