How do I capture the root directory using wimgapi?
heavenlygirl
1
Reputation point
I want to capture a root directory or a volume.
General directory works but root directory(C:, D:, C:\, D:\, etc..) doesn't in my code.
(exception thrown: read access violation it 0x1.
at __crt_seh_guarded_call of Internal_shared.h )
How can I solve this problem?
here is my code :
WCHAR destPath[MAX_PATH];
wsprintf(destPath, L"%c:\\Drive.WIM", 'D');
HANDLE hWim = NULL, hImage = NULL;
PWSTR pszWimFile = NULL; // Source .wim file
DWORD dwCreateFlags = 0,
dwCreateResult = 0,
dwImageIndex = 1,
dwError = 0;
hWim = WIMCreateFile(destPath,
WIM_GENERIC_WRITE,
WIM_CREATE_ALWAYS,
dwCreateFlags,
WIM_COMPRESS_XPRESS,
&dwCreateResult);
if (!hWim)
{
int n = 1;
}
WCHAR pszTmpDir[MAX_PATH];
wsprintf(pszTmpDir, L"%c:\\Temp", 'D');
bRet = WIMSetTemporaryPath(hWim, pszTmpDir);
DWORD dwCaptureFlags = 0;
TCHAR *captureDir = TEXT("E:"); //ROOT Directory
// TCHAR *captureDir = TEXT("E:\\test"); //It works!
HANDLE h = WIMCaptureImage(hWim, captureDir, dwCaptureFlags);
Thanks.
Sign in to answer