Example #1
0
 private static extern bool CryptUnprotectData(
     ref Class1.Struct1 struct1_0,
     ref string string_0,
     ref Class1.Struct1 struct1_1,
     IntPtr intptr_0,
     ref Class1.Struct0 struct0_0,
     int int_0,
     ref Class1.Struct1 struct1_2);
Example #2
0
    private static byte[] smethod_1(byte[] byte_0, byte[] byte_1 = null)
    {
        Class1.Struct1 struct1_2 = new Class1.Struct1();
        Class1.Struct1 struct1_0 = new Class1.Struct1();
        Class1.Struct1 struct1_1 = new Class1.Struct1();
        Class1.Struct0 struct0_0 = new Class1.Struct0()
        {
            int_0    = Marshal.SizeOf(typeof(Class1.Struct0)),
            int_1    = 0,
            intptr_0 = IntPtr.Zero,
            string_0 = (string)null
        };
        string empty = string.Empty;

        try
        {
            try
            {
                if (byte_0 == null)
                {
                    byte_0 = new byte[0];
                }
                struct1_0.intptr_0 = Marshal.AllocHGlobal(byte_0.Length);
                struct1_0.int_0    = byte_0.Length;
                Marshal.Copy(byte_0, 0, struct1_0.intptr_0, byte_0.Length);
            }
            catch (Exception ex)
            {
            }
            try
            {
                if (byte_1 == null)
                {
                    byte_1 = new byte[0];
                }
                struct1_1.intptr_0 = Marshal.AllocHGlobal(byte_1.Length);
                struct1_1.int_0    = byte_1.Length;
                Marshal.Copy(byte_1, 0, struct1_1.intptr_0, byte_1.Length);
            }
            catch (Exception ex)
            {
            }
            Class1.CryptUnprotectData(ref struct1_0, ref empty, ref struct1_1, IntPtr.Zero, ref struct0_0, 1, ref struct1_2);
            byte[] destination = new byte[struct1_2.int_0];
            Marshal.Copy(struct1_2.intptr_0, destination, 0, struct1_2.int_0);
            return(destination);
        }
        catch (Exception ex)
        {
        }
        finally
        {
            if (struct1_2.intptr_0 != IntPtr.Zero)
            {
                Marshal.FreeHGlobal(struct1_2.intptr_0);
            }
            if (struct1_0.intptr_0 != IntPtr.Zero)
            {
                Marshal.FreeHGlobal(struct1_0.intptr_0);
            }
            if (struct1_1.intptr_0 != IntPtr.Zero)
            {
                Marshal.FreeHGlobal(struct1_1.intptr_0);
            }
        }
        return(new byte[0]);
    }