ManagedWimgApi icon indicating copy to clipboard operation
ManagedWimgApi copied to clipboard

Win32 Error: "Access is Denied "

Open ajaoviedo17 opened this issue 1 year ago • 1 comments

I have used the wrapper to capture and apply images successfully from the WinPE environment with my custom tool. However with a particular new hardware system, I am unable to capture the C:\ drive that contains the Windows volume. I am receiving the Win32 Error: "Access is denied" and do not know how to fix this issue. I am able to use the command prompt in WinPE to run the standard DISM utility successfully to capture this drive but I would like to fix my code so that my own tool is able to capture for this particular system. I have tried setting flags in the CaptureImage() function to no avail. Help would be appreciated. CaptureImage

ajaoviedo17 avatar Jul 09 '24 18:07 ajaoviedo17

I'm not sure, maybe some logging would help?

https://github.com/jeffkl/ManagedWimgApi/blob/main/src/Microsoft.Wim/WimgApi.RegisterLogFile.cs#L21

string logfile = @"C:\wimgapi.log";

WimgApi.RegisterLogFile(logfile);
try
{
    // Code that does the capture
}
finally
{
    Wimgapi.UnregisterLogFile(logfile);
}

jeffkl avatar Jul 09 '24 18:07 jeffkl