Is it possible to get stream from WimFileSystem?

Mar 25, 2010 at 10:10 AM

I have multi image in a single wim, and I am trying to split the image from the WIM,  once i using the code

WimFile file = new WimFile(File.Open(args[0], FileMode.Open));
WimFilesystem img= file.GetImage(1);

I just can operate every single file in this image, is it possbile to get a stream for the whole image, so that I can get bits from the stream and write it into a file?


thanks a lot






Mar 25, 2010 at 6:58 PM

Hi Ray,

That concept doesn't work for WIM files.  Unlike virtual disk images, WIM files are more like Zip files or CAB files - there's no concept of a single stream within the WIM file, instead each file is stored as its own stream.



Mar 27, 2010 at 11:32 AM

Thanks a lot for the reply, but I checkd MS released WIMGAPI, there is the function like


[DllImport("wimgapi.dll", EntryPoint = "WIMExportImage", SetLastError = true)]
        public static extern int  WIMExportImage(
            IntPtr  hImage,
            IntPtr  hWim ,
            Int32  dwApplyFlags


 hWim is just a handle for createfile,does it mean, it just transfer each file from a Image to another WIM?



Mar 27, 2010 at 2:06 PM

It looks like it.

WIM is a bit strange in that each WIM can have multiple separate directory trees within it - each directory tree is an 'image' in WIM terminology, and does correspond to an image that was added to the WIM.  However, it doesn't mean there's a conventional disk image under the covers.



Mar 27, 2010 at 2:24 PM

hmm,, interesting,  I am trying to develope a "WIM server" to restore file in remote site, so what I can do is just transfer every file to local disk....


Thanks a lot for your kindly help!