Hardware/Ring0.cs
changeset 380 573f1fff48b2
parent 379 7af3aaeb42e9
     1.1 --- a/Hardware/Ring0.cs	Sat Aug 11 21:48:54 2012 +0000
     1.2 +++ b/Hardware/Ring0.cs	Sun Sep 23 18:37:43 2012 +0000
     1.3 @@ -46,29 +46,29 @@
     1.4          IOControlCode.Access.Read);
     1.5  
     1.6      private static string GetTempFileName() {
     1.7 -
     1.8 -      // try to get a file in the temporary folder
     1.9 -      try {
    1.10 -        return Path.GetTempFileName();        
    1.11 -      } catch (IOException) { 
    1.12 -          // some I/O exception
    1.13 -        } 
    1.14 -        catch (UnauthorizedAccessException) { 
    1.15 -          // we do not have the right to create a file in the temp folder
    1.16 -        }
    1.17 -        catch (NotSupportedException) {
    1.18 -          // invalid path format of the TMP system environment variable
    1.19 -        }
    1.20 -
    1.21 -      // if this failed, we try to create one in the application folder
    1.22 +      
    1.23 +      // try to create one in the application folder
    1.24        string fileName = Path.ChangeExtension(
    1.25 -        Assembly.GetExecutingAssembly().Location, ".sys");
    1.26 +        Assembly.GetEntryAssembly().Location, ".sys");
    1.27        try {
    1.28          using (FileStream stream = File.Create(fileName)) {
    1.29            return fileName;
    1.30          }        
    1.31        } catch (IOException) { } 
    1.32          catch (UnauthorizedAccessException) { }
    1.33 +
    1.34 +      // if this failed, try to get a file in the temporary folder
    1.35 +      try {
    1.36 +        return Path.GetTempFileName();        
    1.37 +      } catch (IOException) { 
    1.38 +          // some I/O exception
    1.39 +      } 
    1.40 +      catch (UnauthorizedAccessException) { 
    1.41 +        // we do not have the right to create a file in the temp folder
    1.42 +      }
    1.43 +      catch (NotSupportedException) {
    1.44 +        // invalid path format of the TMP system environment variable
    1.45 +      }
    1.46       
    1.47        return null;
    1.48      }