fix #741, maybe, by removing MOTW from external cores before interrogating them. Will it still trigger when running them, if that's done somehow before interrogating them? (untested)
This commit is contained in:
parent
c61d432fd6
commit
569113f2f8
|
@ -83,7 +83,8 @@ namespace BizHawk.Client.ApiHawk
|
|||
ToolStripMenuItem item = null;
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
BizHawk.Common.Win32Hacks.RemoveMOTW(fileName);
|
||||
externalToolFile = Assembly.LoadFrom(fileName);
|
||||
object[] attributes = externalToolFile.GetCustomAttributes(typeof(BizHawkExternalToolAttribute), false);
|
||||
if (attributes != null && attributes.Count() == 1)
|
||||
|
|
|
@ -65,6 +65,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
//some people are getting MOTW through a combination of browser used to download bizhawk, and program used to dearchive it
|
||||
WhackAllMOTW(dllDir);
|
||||
|
||||
//We need to do it here too... otherwise people get exceptions when externaltools we distribute try to startup
|
||||
|
||||
//in case assembly resolution fails, such as if we moved them into the dll subdiretory, this event handler can reroute to them
|
||||
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
|
||||
|
||||
|
@ -318,13 +320,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
static extern uint SetDllDirectory(string lpPathName);
|
||||
|
||||
[DllImport("kernel32.dll", EntryPoint = "DeleteFileW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)]
|
||||
static extern bool DeleteFileW([MarshalAs(UnmanagedType.LPWStr)]string lpFileName);
|
||||
static void RemoveMOTW(string path)
|
||||
{
|
||||
DeleteFileW(path + ":Zone.Identifier");
|
||||
}
|
||||
|
||||
static void WhackAllMOTW(string dllDir)
|
||||
{
|
||||
var todo = new Queue<DirectoryInfo>(new[] { new DirectoryInfo(dllDir) });
|
||||
|
@ -333,9 +328,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
var di = todo.Dequeue();
|
||||
foreach (var disub in di.GetDirectories()) todo.Enqueue(disub);
|
||||
foreach (var fi in di.GetFiles("*.dll"))
|
||||
RemoveMOTW(fi.FullName);
|
||||
Win32Hacks.RemoveMOTW(fi.FullName);
|
||||
foreach (var fi in di.GetFiles("*.exe"))
|
||||
RemoveMOTW(fi.FullName);
|
||||
Win32Hacks.RemoveMOTW(fi.FullName);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -166,9 +166,9 @@ namespace BizHawk.Client.MultiHawk
|
|||
var di = todo.Dequeue();
|
||||
foreach (var disub in di.GetDirectories()) todo.Enqueue(disub);
|
||||
foreach (var fi in di.GetFiles("*.dll"))
|
||||
RemoveMOTW(fi.FullName);
|
||||
Win32Hacks.RemoveMOTW(fi.FullName);
|
||||
foreach (var fi in di.GetFiles("*.exe"))
|
||||
RemoveMOTW(fi.FullName);
|
||||
Win32Hacks.RemoveMOTW(fi.FullName);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -259,4 +259,14 @@ namespace BizHawk.Common
|
|||
|
||||
}
|
||||
|
||||
public static class Win32Hacks
|
||||
{
|
||||
[DllImport("kernel32.dll", EntryPoint = "DeleteFileW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)]
|
||||
static extern bool DeleteFileW([MarshalAs(UnmanagedType.LPWStr)]string lpFileName);
|
||||
|
||||
public static void RemoveMOTW(string path)
|
||||
{
|
||||
DeleteFileW(path + ":Zone.Identifier");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue