Skip to content

Commit 32d14ec

Browse files
committed
Removed unused native items
1 parent 3f3b773 commit 32d14ec

3 files changed

Lines changed: 12 additions & 115 deletions

File tree

build.gradle

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,23 @@ apply plugin: 'java'
22
apply plugin: 'maven'
33

44
group = 'com.beaudoin.jmm'
5-
version = '1.3'
5+
version = '1.4'
66

77
repositories {
88
mavenCentral()
99

1010
maven { url "https://jitpack.io" }
11+
12+
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
13+
1114
}
1215

1316
dependencies {
14-
compile "net.java.dev.jna:jna-platform:4.2.2"
1517
compile "net.openhft:zero-allocation-hashing:0.6"
18+
compile "net.java.dev.jna:jna:$jna_version"
19+
compile "net.java.dev.jna:jna-platform:$jna_version"
20+
}
21+
22+
buildscript {
23+
ext.jna_version = '4.3.0-SNAPSHOT'
1624
}

src/main/java/com/beaudoin/jmm/natives/unix/unix.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import com.sun.jna.*;
2828

29-
import java.util.Arrays;
3029
import java.util.List;
3130

3231
/**
@@ -49,7 +48,7 @@ public static class iovec extends Structure {
4948

5049
@Override
5150
protected List<String> getFieldOrder() {
52-
return Arrays.asList("iov_base", "iov_len");
51+
return createFieldsOrder("iov_base", "iov_len");
5352
}
5453

5554
}

src/main/java/com/beaudoin/jmm/natives/win32/Kernel32.java

Lines changed: 1 addition & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,9 @@
2828
import com.sun.jna.Native;
2929
import com.sun.jna.NativeLibrary;
3030
import com.sun.jna.Pointer;
31-
import com.sun.jna.Structure;
3231
import com.sun.jna.platform.win32.Tlhelp32;
33-
import com.sun.jna.platform.win32.WinDef;
3432
import com.sun.jna.win32.W32APIOptions;
3533

36-
import java.util.Arrays;
37-
import java.util.List;
38-
3934
public final class Kernel32 {
4035

4136
static {
@@ -50,115 +45,10 @@ public final class Kernel32 {
5045

5146
public static native boolean Process32Next(Pointer pointer, Tlhelp32.PROCESSENTRY32 entry);
5247

53-
public static native boolean Module32NextW(Pointer pointer, Kernel32.MODULEENTRY32W entry);
48+
public static native boolean Module32NextW(Pointer pointer, Tlhelp32.MODULEENTRY32W entry);
5449

5550
public static native long ReadProcessMemory(Pointer process, Pointer address, MemoryBuffer memory, int size, int written);
5651

5752
public static native long WriteProcessMemory(Pointer process, Pointer address, MemoryBuffer memory, int size, int written);
5853

59-
/**
60-
* Describes an entry from a list of the modules belonging to the specified
61-
* process.
62-
*
63-
* @see <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms684225(v=vs.85).aspx">MSDN</a>
64-
*/
65-
public static class MODULEENTRY32W extends Structure {
66-
67-
public static final int MAX_MODULE_NAME32 = 255;
68-
69-
/**
70-
* A representation of a MODULEENTRY32 structure as a reference
71-
*/
72-
public static class ByReference extends MODULEENTRY32W implements Structure.ByReference {
73-
public ByReference() {
74-
}
75-
76-
public ByReference(Pointer memory) {
77-
super(memory);
78-
}
79-
}
80-
81-
/**
82-
* The size of the structure, in bytes. Before calling the Module32First
83-
* function, set this member to sizeof(MODULEENTRY32). If you do not
84-
* initialize dwSize, Module32First fails.
85-
*/
86-
public WinDef.DWORD dwSize;
87-
88-
/**
89-
* This member is no longer used, and is always set to one.
90-
*/
91-
public WinDef.DWORD th32ModuleID;
92-
93-
/**
94-
* The identifier of the process whose modules are to be examined.
95-
*/
96-
public WinDef.DWORD th32ProcessID;
97-
98-
/**
99-
* The load count of the module, which is not generally meaningful, and
100-
* usually equal to 0xFFFF.
101-
*/
102-
public WinDef.DWORD GlblcntUsage;
103-
104-
/**
105-
* The load count of the module (same as GlblcntUsage), which is not
106-
* generally meaningful, and usually equal to 0xFFFF.
107-
*/
108-
public WinDef.DWORD ProccntUsage;
109-
110-
/**
111-
* The base address of the module in the context of the owning process.
112-
*/
113-
public Pointer modBaseAddr;
114-
115-
/**
116-
* The size of the module, in bytes.
117-
*/
118-
public WinDef.DWORD modBaseSize;
119-
120-
/**
121-
* A handle to the module in the context of the owning process.
122-
*/
123-
public WinDef.HMODULE hModule;
124-
125-
/**
126-
* The module name.
127-
*/
128-
public char[] szModule = new char[MAX_MODULE_NAME32 + 1];
129-
130-
/**
131-
* The module path.
132-
*/
133-
public char[] szExePath = new char[com.sun.jna.platform.win32.Kernel32.MAX_PATH];
134-
135-
public MODULEENTRY32W() {
136-
dwSize = new WinDef.DWORD(size());
137-
}
138-
139-
public MODULEENTRY32W(Pointer memory) {
140-
super(memory);
141-
read();
142-
}
143-
144-
/**
145-
* @return The module name.
146-
*/
147-
public String szModule() {
148-
return Native.toString(this.szModule);
149-
}
150-
151-
/**
152-
* @return The module path.
153-
*/
154-
public String szExePath() {
155-
return Native.toString(this.szExePath);
156-
}
157-
158-
@Override
159-
protected List<String> getFieldOrder() {
160-
return Arrays.asList("dwSize", "th32ModuleID", "th32ProcessID", "GlblcntUsage", "ProccntUsage", "modBaseAddr", "modBaseSize", "hModule", "szModule", "szExePath");
161-
}
162-
}
163-
16454
}

0 commit comments

Comments
 (0)