Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sj6219 authored and lucasg committed May 25, 2020
1 parent 4855512 commit 00ddfcf
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions ClrPhlib/include/ClrPhlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ namespace Dependencies {
// Check if the PE is 32-bit
bool IsWow64Dll();

// Check if the PE is 32-bit
bool IsArm32Dll();

// Return the ApiSetSchema
ApiSetSchema^ GetApiSetSchema();

Expand Down
8 changes: 7 additions & 1 deletion ClrPhlib/src/managed/PE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,10 @@ String^ PE::GetManifest()
bool PE::IsWow64Dll()
{
return ((Properties->Machine & 0xffff ) == IMAGE_FILE_MACHINE_I386);
}
}

bool PE::IsArm32Dll()
{
return ((Properties->Machine & 0xffff) == IMAGE_FILE_MACHINE_ARMNT);
}

9 changes: 6 additions & 3 deletions DependenciesGui/DependencyWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public bool OpenPeviewer(object Context)
}

PeviewerProcess.StartInfo.FileName = String.Format("\"{0:s}\"", programPath);
PeviewerProcess.StartInfo.Arguments = Filepath;
PeviewerProcess.StartInfo.Arguments = String.Format("\"{0:s}\"", Filepath);
return PeviewerProcess.Start();
}

Expand Down Expand Up @@ -463,8 +463,11 @@ private void ProcessPe(Dictionary<string, ImportContext> NewTreeContexts, PE new
Environment.SpecialFolder WindowsSystemFolder = (this.Pe.IsWow64Dll()) ?
Environment.SpecialFolder.SystemX86 :
Environment.SpecialFolder.System;
string User32Filepath = Path.Combine(Environment.GetFolderPath(WindowsSystemFolder), "user32.dll");
string MsCoreeFilepath = Path.Combine(Environment.GetFolderPath(WindowsSystemFolder), "mscoree.dll");

string systemPath = (this.Pe.IsArm32Dll()) ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "SysArm32")
: Environment.GetFolderPath(WindowsSystemFolder);
string User32Filepath = Path.Combine(systemPath, "user32.dll");
string MsCoreeFilepath = Path.Combine(systemPath, "mscoree.dll");

foreach (PeImportDll DllImport in PeImports)
{
Expand Down
3 changes: 2 additions & 1 deletion DependenciesLib/FindPeModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ public static Tuple<ModuleSearchStrategy, string> FindPeFromDefault(PE RootPe, s
Environment.SpecialFolder WindowsSystemFolder = (Wow64Dll) ?
Environment.SpecialFolder.SystemX86 :
Environment.SpecialFolder.System;
String WindowsSystemFolderPath = Environment.GetFolderPath(WindowsSystemFolder);
String WindowsSystemFolderPath = (RootPe.IsArm32Dll()) ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "SysArm32")
: Environment.GetFolderPath(WindowsSystemFolder);


// -1. Look in Sxs manifest (copious reversing needed)
Expand Down

0 comments on commit 00ddfcf

Please sign in to comment.