ESD Support

Feb 15, 2015 at 12:06 PM
I was wondering if it's possible to get the amount of images in an ESD file?

Thanks.
Coordinator
Feb 17, 2015 at 4:51 PM
I think it all depends on what version of the Asset and Deployment Kit (ADK) that you're using. I have Windows 8.1 with the Windows 8.1 ADK and I'm able to open un-encrypted ESD files:
using(var handle = WimgApi.CreateFile(@"install.esd", WimFileAccess.Read, WimCreationDisposition.OpenExisting, WimCreateFileOptions.None, WimCompressionType.None))
{
    WimgApi.SetTemporaryPath(handle, Environment.GetEnvironmentVariable("TEMP"));

    Console.WriteLine("{0} images", WimgApi.GetImageCount(handle));
}
I don't know a lot about the ESD format but from what I can tell, it is supported by the latest version of the Windows Imaging API. My code simply calls into the native assembly. So as long as your platform supports ESD, then this managed wrapper should work as well.
Feb 17, 2015 at 11:20 PM
Edited Feb 17, 2015 at 11:27 PM
Thanks for your reply. :) I pretty much copied and paste what you put and it crashes on the var handle = .... line

Image

For some reason it returns wimHandle.IsInvalid = true. It works if a .wim is selected and DISM can get the image information fine too. :)

Windows 10 TP :)

My aim is to get the amount of images and then give the user a chance to export them images to wim.
Coordinator
Feb 18, 2015 at 3:36 AM
That exception is related to not being able to load an assembly because the bitness doesn't match. Are you compiling as AnyCPU or a specific processor architecture?

Could you send me your project for debugging?
Feb 18, 2015 at 8:54 AM
Edited Feb 18, 2015 at 8:54 AM
Yeah it is set to AnyCPU. It's strange that it works with boot.wim though but not boot.esd

Here you go :)

wincert.net/leli55PK/Test.7z

Thanks
Feb 21, 2015 at 9:43 PM
Have you had a chance to look at this? :)

Hope you're well.
Liam.
Feb 26, 2015 at 9:42 PM
Just an update. I've tried it with Windows 8.1 ADK and on Windows 8.1 itself even with the same code as you and still no luck.

I've now posted on the MSDN forums and shall keep you updated :)

Thanks.
Coordinator
Feb 28, 2015 at 2:58 AM
Sorry for the delay. I tried it out and it crashed for me too. I doubt its this managed wrapper that is doing it. I'd imagine you'd hit the same exception if you called into dism.dll yourself. I would definitely follow-up with Microsoft.

You could also try to narrow it down by writing a quick app in C++ to see if that works. If so, then the wrapper could be the problem.