error on calling dismapi.dll function-DISMMountImage in c#

Tarun25

New Member
Messages
1
hello,
I wanted to call dismapi.dll function in c# code.
when I call function DismInitialize() its working fine.
next step I want to mount .Wim image file using DismMountImage() function.I got error 122,unable to mount image
int hr="Marshal.GetLastWin32Error()"


I am calling DismMountImage as-

[DllImport(@"C:\Windows\System32\CompatTel\dismapi. dll", CharSet = CharSet.Unicode, SetLastError = true)]

[return: MarshalAs(UnmanagedType.Error)]

public static extern int DismMountImage(
[MarshalAs(UnmanagedType.LPWStr)] string ImageFilePath,
[MarshalAs(UnmanagedType.LPWStr)] string MountPath,
UInt32 ImageIndex,
[MarshalAs(UnmanagedType.LPWStr)] string ImageName,
DismImageIdentifier ImageIdentifier,
UInt32 Flags

);

what is wrong in this???
any help appreciated..
Thank You
 

My Computer

System One

  • OS
    windows 7
Back
Top