diff -r 7af3aaeb42e9 -r 573f1fff48b2 Hardware/Ring0.cs --- a/Hardware/Ring0.cs Sat Aug 11 21:48:54 2012 +0000 +++ b/Hardware/Ring0.cs Sun Sep 23 18:37:43 2012 +0000 @@ -46,29 +46,29 @@ IOControlCode.Access.Read); private static string GetTempFileName() { - - // try to get a file in the temporary folder - try { - return Path.GetTempFileName(); - } catch (IOException) { - // some I/O exception - } - catch (UnauthorizedAccessException) { - // we do not have the right to create a file in the temp folder - } - catch (NotSupportedException) { - // invalid path format of the TMP system environment variable - } - - // if this failed, we try to create one in the application folder + + // try to create one in the application folder string fileName = Path.ChangeExtension( - Assembly.GetExecutingAssembly().Location, ".sys"); + Assembly.GetEntryAssembly().Location, ".sys"); try { using (FileStream stream = File.Create(fileName)) { return fileName; } } catch (IOException) { } catch (UnauthorizedAccessException) { } + + // if this failed, try to get a file in the temporary folder + try { + return Path.GetTempFileName(); + } catch (IOException) { + // some I/O exception + } + catch (UnauthorizedAccessException) { + // we do not have the right to create a file in the temp folder + } + catch (NotSupportedException) { + // invalid path format of the TMP system environment variable + } return null; }