Compare commits
2 Commits
48bf7cb4e8
...
0e016a9b54
Author | SHA1 | Date |
---|---|---|
Robinson | 0e016a9b54 | |
Robinson | ad8db3cffc |
|
@ -23,7 +23,7 @@ Maven Info
|
|||
<dependency>
|
||||
<groupId>com.dorkbox</groupId>
|
||||
<artifactId>PeParser</artifactId>
|
||||
<version>3.2</version>
|
||||
<version>3.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
@ -33,7 +33,7 @@ Gradle Info
|
|||
```
|
||||
dependencies {
|
||||
...
|
||||
implementation("com.dorkbox:PeParser:3.2")
|
||||
implementation("com.dorkbox:PeParser:3.3")
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ object Extras {
|
|||
// set for the project
|
||||
const val description = "Windows PE (Portable Executable) file parser for Java 8+"
|
||||
const val group = "com.dorkbox"
|
||||
const val version = "3.2"
|
||||
const val version = "3.3"
|
||||
|
||||
// set as project.ext
|
||||
const val name = "PeParser"
|
||||
|
@ -54,6 +54,7 @@ object Extras {
|
|||
GradleUtils.load("$projectDir/../../gradle.properties", Extras)
|
||||
GradleUtils.defaults()
|
||||
GradleUtils.compileConfiguration(JavaVersion.VERSION_1_8)
|
||||
GradleUtils.jpms(JavaVersion.VERSION_1_9)
|
||||
|
||||
licensing {
|
||||
license(License.APACHE_2) {
|
||||
|
@ -63,17 +64,6 @@ licensing {
|
|||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
setSrcDirs(listOf("src"))
|
||||
|
||||
// want to include java files for the source. 'setSrcDirs' resets includes...
|
||||
include("**/*.java")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.jar.get().apply {
|
||||
manifest {
|
||||
// https://docs.oracle.com/javase/tutorial/deployment/jar/packageman.html
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012 dorkbox, llc
|
||||
* Copyright 2023 dorkbox, llc
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -13,6 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package dorkbox.peParser
|
||||
|
||||
import dorkbox.os.OS
|
||||
|
@ -37,7 +38,7 @@ class PE {
|
|||
/**
|
||||
* Gets the version number.
|
||||
*/
|
||||
val version = "3.2"
|
||||
val version = "3.3"
|
||||
private const val PE_OFFSET_LOCATION = 0x3c
|
||||
private val PE_SIG = "PE\u0000\u0000".toByteArray()
|
||||
|
||||
|
@ -141,12 +142,15 @@ class PE {
|
|||
private fun fromInputStream(inputStream: InputStream) {
|
||||
val baos = ByteArrayOutputStream(8192)
|
||||
val buffer = ByteArray(4096)
|
||||
var read = 0
|
||||
|
||||
var read: Int
|
||||
while (inputStream.read(buffer).also { read = it } > 0) {
|
||||
baos.write(buffer, 0, read)
|
||||
}
|
||||
|
||||
baos.flush()
|
||||
inputStream.close()
|
||||
|
||||
val bytes = baos.toByteArray()
|
||||
invalidFile = bytes.size == 0
|
||||
fileBytes = ByteArray(bytes)
|
||||
|
@ -226,7 +230,7 @@ class PE {
|
|||
"PE signature not found. The given file is not a PE file. $OS.LINE_SEPARATOR"
|
||||
}
|
||||
private val pEOffset: Int
|
||||
private get() {
|
||||
get() {
|
||||
fileBytes!!.mark()
|
||||
fileBytes!!.seek(PE_OFFSET_LOCATION)
|
||||
val read: Int = fileBytes!!.readUShort(2).toInt()
|
||||
|
@ -268,15 +272,18 @@ class PE {
|
|||
if (mainEntry.type === DirEntry.RESOURCE) {
|
||||
val directoryEntries = LinkedList<ResourceDirectoryEntry?>()
|
||||
val resourceEntries = LinkedList<ResourceDirectoryEntry?>()
|
||||
var entry: ResourceDirectoryEntry? = null
|
||||
val root = mainEntry.data as ResourceDirectoryHeader?
|
||||
|
||||
for (rootEntry in root!!.entries) {
|
||||
collect(directoryEntries, resourceEntries, rootEntry)
|
||||
directoryEntries.add(rootEntry)
|
||||
}
|
||||
|
||||
var entry: ResourceDirectoryEntry?
|
||||
while (directoryEntries.poll().also { entry = it } != null) {
|
||||
collect(directoryEntries, resourceEntries, entry)
|
||||
}
|
||||
|
||||
var largest: ResourceDataEntry? = null
|
||||
for (resourceEntry in resourceEntries) {
|
||||
val dataEntry = resourceEntry!!.resourceDataEntry
|
||||
|
|
|
@ -13,9 +13,5 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package dorkbox.peParser.misc
|
||||
|
||||
import dorkbox.peParser.misc.MachineTypeType
|
||||
import dorkbox.peParser.misc.MagicNumberType
|
||||
import dorkbox.peParser.misc.ResourceTypes
|
||||
import dorkbox.peParser.misc.SubsystemType
|
||||
package dorkbox.peParser.misc;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package dorkbox.jna;
|
||||
package dorkbox.peParser;
|
||||
|
||||
/**
|
||||
* Required for intellij to not complain regarding `module-info` for a multi-release jar.
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright 2021 dorkbox, llc
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package dorkbox.peParser.headers;
|
||||
|
||||
/**
|
||||
* Required for intellij to not complain regarding `module-info` for a multi-release jar.
|
||||
* This file is completely ignored by the gradle build process
|
||||
*/
|
||||
public
|
||||
class EmptyClass {}
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright 2021 dorkbox, llc
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package dorkbox.peParser.misc;
|
||||
|
||||
/**
|
||||
* Required for intellij to not complain regarding `module-info` for a multi-release jar.
|
||||
* This file is completely ignored by the gradle build process
|
||||
*/
|
||||
public
|
||||
class EmptyClass {}
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright 2021 dorkbox, llc
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package dorkbox.peParser.types;
|
||||
|
||||
/**
|
||||
* Required for intellij to not complain regarding `module-info` for a multi-release jar.
|
||||
* This file is completely ignored by the gradle build process
|
||||
*/
|
||||
public
|
||||
class EmptyClass {}
|
|
@ -1,21 +1,14 @@
|
|||
module dorkbox.jna {
|
||||
exports dorkbox.jna;
|
||||
exports dorkbox.jna.rendering;
|
||||
exports dorkbox.jna.linux;
|
||||
exports dorkbox.jna.linux.structs;
|
||||
exports dorkbox.jna.macos;
|
||||
exports dorkbox.jna.macos.cocoa;
|
||||
exports dorkbox.jna.macos.foundation;
|
||||
exports dorkbox.jna.windows;
|
||||
exports dorkbox.jna.windows.structs;
|
||||
module dorkbox.pe {
|
||||
exports dorkbox.peParser;
|
||||
exports dorkbox.peParser.headers;
|
||||
exports dorkbox.peParser.misc;
|
||||
exports dorkbox.peParser.types;
|
||||
|
||||
requires transitive dorkbox.collections;
|
||||
requires transitive dorkbox.byteUtils;
|
||||
requires transitive dorkbox.hexUtils;
|
||||
requires transitive dorkbox.updates;
|
||||
requires transitive dorkbox.os;
|
||||
requires transitive dorkbox.utilities;
|
||||
|
||||
requires transitive kotlin.stdlib;
|
||||
|
||||
requires static com.sun.jna;
|
||||
requires static com.sun.jna.platform;
|
||||
|
||||
requires static org.slf4j;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue