示例#1
0
        private static bool smethod_2(byte byte_0, out Hardware.Class5 class5_0)
        {
            int num  = 0;
            int num2 = 0;

            Hardware.Class2 @class = new Hardware.Class2();
            class5_0 = new Hardware.Class5();
            int num3;

            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                num3 = Hardware.CreateFile("\\\\.\\Smartvsd", 0u, 0, 0, 1, 0, 0);
            }
            else
            {
                num3 = Hardware.CreateFile("\\\\.\\PhysicalDrive" + byte_0, 3221225472u, 3, 0, 3, 0, 0);
            }
            if (num3 != -1)
            {
                @class.byte_0          = (byte)num;
                @class.int_0           = Marshal.SizeOf(class5_0);
                @class.class1_0.byte_5 = (byte)(160 | num << 4);
                @class.class1_0.byte_6 = 236;
                @class.class1_0.byte_1 = 1;
                @class.class1_0.byte_2 = 1;
                if (Hardware.DeviceIoControl(num3, 508040, @class, Marshal.SizeOf(@class), class5_0, Marshal.SizeOf(class5_0), ref num2, 0) != 0)
                {
                    return(true);
                }
            }
            return(false);
        }
示例#2
0
 public static byte[] CalculateID()
 {
     byte[] array = null;
     using (BinaryWriter binaryWriter = new BinaryWriter(new MemoryStream()))
     {
         int num = (Environment.ProcessorCount > 2) ? (Environment.ProcessorCount / 2) : Environment.ProcessorCount;
         if (num <= 0)
         {
             num = 1;
         }
         binaryWriter.Write(num);
         byte[] array2 = new byte[]
         {
             85,
             137,
             229,
             87,
             139,
             125,
             16,
             106,
             1,
             88,
             83,
             15,
             162,
             137,
             7,
             137,
             87,
             4,
             91,
             95,
             137,
             236,
             93,
             194,
             16,
             0
         };
         byte[] array3 = new byte[]
         {
             83,
             72,
             199,
             192,
             1,
             0,
             0,
             0,
             15,
             162,
             65,
             137,
             0,
             65,
             137,
             80,
             4,
             91,
             195
         };
         byte[] array4 = new byte[8];
         byte[] array5;
         if (IntPtr.Size == 8)
         {
             array5 = array3;
         }
         else
         {
             array5 = array2;
         }
         IntPtr intPtr = new IntPtr(array5.Length);
         int    num2;
         if (!Hardware.VirtualProtect(array5, intPtr, 64, out num2))
         {
             Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
         }
         intPtr = new IntPtr(array4.Length);
         if (Hardware.CallWindowProcW(array5, IntPtr.Zero, 0, array4, intPtr) == IntPtr.Zero)
         {
             byte[] result = array;
             return(result);
         }
         binaryWriter.Write(array4);
         Hardware.Class5 @class    = new Hardware.Class5();
         string          pathRoot  = Path.GetPathRoot(Environment.SystemDirectory);
         Hardware.Class5 class2    = new Hardware.Class5();
         string          pathRoot2 = Path.GetPathRoot(Environment.CurrentDirectory);
         if (Hardware.smethod_1(pathRoot, out @class) && Hardware.smethod_1(pathRoot2, out class2))
         {
             binaryWriter.Write(@class.class4_0.char_2);
             binaryWriter.Write(@class.class4_0.char_0);
             binaryWriter.Write(class2.class4_0.char_2);
             binaryWriter.Write(class2.class4_0.char_0);
         }
         else
         {
             uint value  = 0u;
             uint value2 = 0u;
             uint num3   = 0u;
             uint num4   = 0u;
             if (!Hardware.GetVolumeInformation(pathRoot, null, 0, out value, out num3, out num4, null, 0u))
             {
                 byte[] result = array;
                 return(result);
             }
             if (!Hardware.GetVolumeInformation(pathRoot2, null, 0, out value2, out num3, out num4, null, 0u))
             {
                 byte[] result = array;
                 return(result);
             }
             binaryWriter.Write(value);
             binaryWriter.Write(value2);
         }
         binaryWriter.BaseStream.Position = 0L;
         array = new MD5CryptoServiceProvider().ComputeHash(binaryWriter.BaseStream);
     }
     return(array);
 }
示例#3
0
 private static extern int DeviceIoControl(int int_7, int int_8, [In][Out] Hardware.Class2 class2_0, int int_9, [In][Out] Hardware.Class5 class5_0, int int_10, ref int int_11, int int_12);