private void materialFlatButton3_Click(object sender, EventArgs e)
        {
            bool correctdump = false;

            if (Directory.Exists(input.Text + "\\MSXC"))
            {
                if (Directory.Exists(input.Text + "\\Licenses"))
                {
                    correctdump = true;
                }
            }
            if (correctdump)
            {
                IFileSystemImage ifsi = new MsftFileSystemImage();
                ifsi.ChooseImageDefaultsForMediaType(IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DISK);
                ifsi.FileSystemsToCreate = FsiFileSystems.FsiFileSystemUDF;
                ifsi.VolumeName          = "DVD_ROM";
                ifsi.Root.AddTree(input.Text, true); //use a valid folder
                                                     //this will implement the Write method for the formatter
                IStream imagestream = ifsi.CreateResultImage().ImageStream;
                if (imagestream != null)
                {
                    System.Runtime.InteropServices.ComTypes.STATSTG stat;
                    imagestream.Stat(out stat, 0x01);
                    IStream newStream;
                    if (0 == SHCreateStreamOnFile
                            (output.Text, 0x00001001, out newStream) && newStream != null)
                    {
                        IntPtr inBytes  = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(long)));
                        IntPtr outBytes = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(long)));
                        try
                        {
                            imagestream.CopyTo(newStream, stat.cbSize, inBytes, outBytes);
                            Marshal.ReleaseComObject(imagestream);
                            imagestream = null;
                            newStream.Commit(0);
                        }
                        finally
                        {
                            Marshal.ReleaseComObject(newStream);
                            Marshal.FreeHGlobal(inBytes);
                            Marshal.FreeHGlobal(outBytes);
                            if (imagestream != null)
                            {
                                Marshal.ReleaseComObject(imagestream);
                            }
                        }
                    }
                }
                Marshal.ReleaseComObject(ifsi);
                MessageBox.Show("Dump converted to iso");
            }
            else
            {
                MessageBox.Show("The path given: \n" + input.Text + "\n" + "appears to be an incorrect dump, check this path and try again" + "\n" + "if you still get this error you should try redumping the title" + "\n" + "in the case that all of the suggestions have failed you should" + "\n" + "ask for help on the Xbox One homebrew discord");
            }
        }
Esempio n. 2
0
 private static int CopyToImpl(IntPtr thisPtr, IntPtr streamPointer, long numberOfBytes, out long numberOfBytesRead, out long numberOfBytesWritten)
 {
     numberOfBytesRead    = 0L;
     numberOfBytesWritten = 0L;
     try
     {
         IStream stream = (IStream)CppObjectShadow.ToShadow <ComStreamShadow>(thisPtr).Callback;
         numberOfBytesRead = stream.CopyTo((IStream) new ComStream(streamPointer), numberOfBytes, out numberOfBytesWritten);
     }
     catch (Exception ex)
     {
         return((int)Result.GetResultFromException(ex));
     }
     return(Result.Ok.Code);
 }
Esempio n. 3
0
 private static int CopyToImpl(IntPtr thisPtr, IntPtr streamPointer, long numberOfBytes, out long numberOfBytesRead, out long numberOfBytesWritten)
 {
     numberOfBytesRead    = 0;
     numberOfBytesWritten = 0;
     try
     {
         IStreamShadow shadow   = ToShadow <IStreamShadow>(thisPtr);
         IStream       callback = ((IStream)shadow.Callback);
         numberOfBytesRead = callback.CopyTo(new ComStream(streamPointer), numberOfBytes, out numberOfBytesWritten);
     }
     catch (Exception exception)
     {
         return((int)Result.GetResultFromException(exception));
     }
     return(Result.Ok.Code);
 }
Esempio n. 4
0
        /// <summary>
        /// Copy the contents of one string into another one.
        /// </summary>
        /// <param name="source">The source stream.</param>
        /// <param name="target">The target stream.</param>
        public static void CopyContents(IStream source, IStream target)
        {
            IntPtr aux = IntPtr.Zero;

            source.CopyTo(target, long.MaxValue, aux, aux);
        }
Esempio n. 5
0
        // note, these won't be read by PS2?
        //Created by Joshua Bylotas
        //http://www.ivorymatter.com
        public static void CreateISOImage(string Name, string dir, string ISOPath)
        {
            //Create File System Object to write to and set properties
            IFileSystemImage ifsi = new MsftFileSystemImage();

            ifsi.ChooseImageDefaultsForMediaType(IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHR_DUALLAYER);

            ifsi.FileSystemsToCreate = FsiFileSystems.FsiFileSystemISO9660
                                       | FsiFileSystems.FsiFileSystemUDF;

            // ifsi.ISO9660InterchangeLevel = 1;
            // ifsi.UDFRevision = 0x0102;

            ifsi.VolumeName = Name;

            //string[] folders = System.IO.Directory.GetDirectories(dir);
            //string[] files = System.IO.Directory.GetFiles(dir);
            //for (int i = 0; i < folders.Count; i++)
            //{
            //    ifsi.Root.Addd
            //}



            ifsi.Root.AddTree(dir, false);

            //this will implement the Write method for the formatter
            IStream imagestream = ifsi.CreateResultImage().ImageStream;

            if (imagestream != null)
            {
                System.Runtime.InteropServices.ComTypes.STATSTG stat;
                imagestream.Stat(out stat, 0x01);

                IStream newStream;
                SHCreateStreamOnFile(ISOPath, 0x00001001, out newStream);
                if (newStream != null)
                {
                    IntPtr inBytes  = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(long)));
                    IntPtr outBytes = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(long)));
                    try
                    {
                        imagestream.CopyTo(newStream, stat.cbSize, inBytes, outBytes);
                        Marshal.ReleaseComObject(imagestream);
                        imagestream = null;
                        newStream.Commit(0);
                    }
                    finally
                    {
                        Marshal.ReleaseComObject(newStream);
                        Marshal.FreeHGlobal(inBytes);
                        Marshal.FreeHGlobal(outBytes);
                        if (imagestream != null)
                        {
                            Marshal.ReleaseComObject(imagestream);
                        }
                    }
                }
            }
            Marshal.ReleaseComObject(ifsi);
        }