diff -r f46d163ffba2 -r 6d6683c2895b Program.cs --- a/Program.cs Fri Apr 30 20:53:40 2010 +0000 +++ b/Program.cs Sat May 01 12:12:37 2010 +0000 @@ -57,6 +57,9 @@ new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); #endif + if (!AllRequiredFilesAvailable()) + Environment.Exit(0); + Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); using (GUI.MainForm form = new GUI.MainForm()) { @@ -67,6 +70,37 @@ } } + private static bool IsFileAvailable(string fileName) { + string path = Path.GetDirectoryName(Application.ExecutablePath) + + Path.DirectorySeparatorChar; + + if (!File.Exists(path + fileName)) { + MessageBox.Show("The following file could not be found: " + fileName + + "\nPlease extract all files from the zip archive.", "Error", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + return true; + } + + private static bool AllRequiredFilesAvailable() { + if (!IsFileAvailable("Aga.Controls.dll")) + return false; + + if (IntPtr.Size == 4) { + if (!IsFileAvailable("WinRing0.dll")) + return false; + if (!IsFileAvailable("WinRing0.sys")) + return false; + } else { + if (!IsFileAvailable("WinRing0x64.dll")) + return false; + if (!IsFileAvailable("WinRing0x64.sys")) + return false; + } + return true; + } + private static void ReportException(Exception e) { CrashReportForm form = new CrashReportForm(); form.Exception = e;