How to use wingapi WIMUnmountImage or WIMUnmountImagehandler?

0

I have a problem with this function:

MountPath := PWideChar(Amount_dir);
WimFileName := PWideChar(Awim_file);
ImageIndex := Aimage_index;

hwim := 0;
himage := 0;

dwHandleFlags := 0;
dwCommitFlags := 0;
dwError := 0;

bRet := WIMGetMountedImageHandle(MountPath, dwHandleFlags, @hWim, @hImage);
if not bRet then
begin
  dwError := GetLastError();
  progress(0, 'Error ' + dwError.ToString + ' attempting to obtain an image handle.');
end;

if bRet then
begin
  bRet := WIMUnmountImageHandle(hImage, 0);
  if not bRet then
  begin
    dwError := GetLastError();
    progress(0, 'Error ' + dwError.ToString + ' attempting to unmount the image');
  end;
end;

if hImage > 0 then
begin
  bRet := WIMCloseHandle(hImage)
end;

if hWim > 0 then
begin
  bRet := WIMCloseHandle(hWim)
end;

bRet := WIMUnregisterLogFile(PWideChar('C:\wimapi_unmount_image.log'));

My result:

Error 3242328343 attempting to unmount the image

Output LogFile:

[696] ImageUnmarshallHandle: Reconstituting wim at C:\Users\Michael\Desktop\timago_x64_2_11_hen.wim.
[696] [0x8007000e] StateStoreGetMountedImageWimbootEntries:(1191): Für diesen Vorgang ist nicht genügend Speicher verfügbar.
[696] [0x80004005] DeleteAndRestoreDirectory:(333): Unbekannter Fehler
[696] [0xc1420117] DeleteAndRestoreDirectory:(334)
[696] [0xc1420117] RestoreMountDirectory:(420)
[696] [0xc1420117] WIMUnmountImageHandle:(1661)

Size of wim 360MB Free disk space 45GB

There is no problem when i use "dism.exe /unmount-wim". Mount, apply and capture works with the API. The Code is for Delphi. Sample: MS C++ WIMGAPI

delphi
imaging
asked on Stack Overflow Oct 14, 2017 by michl2007

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0