Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow writing output file and set office version to 0x00 0x00 if unknown #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions evilclippy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ static public void Main(string[] args)
// Temp path to unzip OpenXML files to
String unzipTempPath = "";

// Output filename
String outputFile = "";


// Start parsing command line arguments
var p = new OptionSet() {
Expand Down Expand Up @@ -117,6 +120,8 @@ static public void Main(string[] args)
v => optionViewableVBA = v != null },
{ "v", "Increase debug message verbosity.",
v => { if (v != null) ++verbosity; } },
{ "o|outputfile=", "Write to the given filename.",
v => outputFile = v },
{ "h|help", "Show this message and exit.",
v => optionShowHelp = v != null },
};
Expand Down Expand Up @@ -150,7 +155,11 @@ static public void Main(string[] args)
// End parsing command line arguments

// OLE Filename (make a copy so we don't overwrite the original)
outFilename = getOutFilename(filename);
if (outputFile == "") {
outFilename = getOutFilename(filename);
} else {
outFilename = outputFile;
}
string oleFilename = outFilename;

// Attempt to unzip as docm or xlsm OpenXML format
Expand Down Expand Up @@ -540,8 +549,10 @@ private static byte[] ReplaceOfficeVersionInVBAProject(byte[] moduleStream, stri
version[1] = 0x00;
break;
default:
Console.WriteLine("ERROR: Incorrect MS Office version specified - skipping this step.");
return moduleStream;
Console.WriteLine("ERROR: Incorrect MS Office version specified - setting 0x00 0x00.");
version[0] = 0x00;
version[1] = 0x00;
break;
}

Console.WriteLine("Targeting pcode on Office version: " + officeVersion);
Expand Down