error on calling DISMMountImage function from c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • poooooo
    New Member
    • Feb 2015
    • 1

    error on calling DISMMountImage function from c#

    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
    Code:
    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
    Last edited by Rabbit; Sep 14 '15, 04:11 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
Working...