Skip to content

Commit

Permalink
Fixed #50, improved #49
Browse files Browse the repository at this point in the history
  • Loading branch information
yhs0602 committed Apr 29, 2019
1 parent 5931abb commit cba0a25
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 44 deletions.
Binary file modified .gradle/5.1.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/5.1.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/5.1.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/5.1.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/5.1.1/javaCompile/classAnalysis.bin
Binary file not shown.
Binary file modified .gradle/5.1.1/javaCompile/javaCompile.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
111 changes: 76 additions & 35 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ public String toString() {
if (fileContents == null) {
return "The file has not been configured. You should setup manually in the first page before you can see the details.";
}
StringBuilder builder=new StringBuilder("");
StringBuilder builder = new StringBuilder(this instanceof RawFile ?
"The file has not been configured. You should setup manually in the first page before you can see the details."
+ System.lineSeparator()
: "");
builder.append(/*R.getString(R.string.FileSize)*/"File Size:").append(Integer.toHexString(fileContents.length))
.append(ls);
builder.append(MainActivity.context.getString(R.string.FoffsCS)).append(Long.toHexString(codeBase))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2177,12 +2177,12 @@ private void AfterReadFully(File file) throws IOException {
AfterParse();
} catch (NotThisFormatException f) {
ShowAlertDialog(this, "Failed to parse the file. please setup manually.", "");
setParsedFile(new RawFile(file));
setParsedFile(new RawFile(file, filecontent));
AllowRawSetup();
//failed to parse the file. please setup manually.
} catch (Exception g) {
AlertError("Unexpected exception: failed to parse the file. please setup manually.", g);
setParsedFile(new RawFile(file));
setParsedFile(new RawFile(file, filecontent));
AllowRawSetup();
}
}
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/com/kyhsgeekcode/disassembler/PEFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.boris.pecoff4j.RVAConverter;
import org.boris.pecoff4j.io.PEParser;

import java.io.EOFException;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
Expand All @@ -28,9 +29,10 @@ public PEFile(File file, byte[] filec) throws IOException, NotThisFormatExceptio
{
try {
pe = PEParser.parse(file);
}catch(NegativeArraySizeException e)
{
}catch(NegativeArraySizeException e) {
throw new NotThisFormatException(/*"PECOFFJ's Parser threw an exception."*/);
} catch (EOFException e) {
throw new RuntimeException("The PE parser threw EOFException. The file may be corrupted.");
}
if (pe == null || pe.getSignature() == null || !pe.getSignature().isValid())
{
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/java/com/kyhsgeekcode/disassembler/RawFile.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.kyhsgeekcode.disassembler;

import java.io.*;
import java.io.File;

public class RawFile extends AbstractFile
{
public RawFile(File file)
{

public RawFile(File file, byte[] filecontent) {
this.fileContents = filecontent;
}

}

0 comments on commit cba0a25

Please sign in to comment.