Does anyone know how to use the WIM imaging format? What i am trying to do is figure out how to transpose this piece of code to VB.Net:
BOOL
WINAPI
WIMApplyImage(
IN HANDLE hImage,
IN LPWSTR lpszPath,
IN DWORD dwApplyFlags
);
Parameters
hImage
[in] A handle to a volume image returned by the WIMLoadImage or WIMCaptureImage functions.
lpszPath
[in] A pointer to a null-terminated string containing the root drive or directory path where the image data will be applied. The specified path must not exceed MAX_PATH characters in length.
dwApplyFlags
[in] Specifies how the file is to be treated and what features are to be used.
Flag Description
WIM_FLAG_VERIFY
Verified that files match original data.
WIM_FLAG_INDEX
Specifies that the image is to be sequentially read for caching or performance purposes.
WIM_FLAG_NO_APPLY
Applies the image without physically creating directories or files. Useful for obtaining a list of files and directories in the image.
WIM_FLAG_FILEINFO
Sends a WIM_MSG_FILEINFO message during the apply operation.
Return ValueIf the function succeeds, then the return value is nonzero.
If the function fails, then the return value is zero. To obtain extended error information, call the GetLastError function.
RemarksTo obtain more information during an image apply, see the WIMRegisterMessageCallback function.
To obtain the list of files in an image without actually applying the image, specify the WIM_FLAG_NO_APPLY flag and register a callback that handles the WIM_MSG_PROCESS message. To obtain additional file information from the WIM_MSG_FILEINFO message, specify the WIM_FLAG_FILEINFO.
The second part is:
Captures an image from a directory path and stores it in an image file.
C++
HANDLE
WINAPI
WIMCaptureImage(
IN HANDLE hWim,
IN LPWSTR lpszPath,
IN DWORD dwCaptureFlags
);
Parameters
hWim
[in] The handle to a .wim file returned by WIMCreateFile.
lpszPath
[in] A pointer to a null-terminated string containing the root drive or directory path from where the image data will be captured. The specified path must not exceed MAX_PATH characters in length.
dwCaptureFlags
[in] Specifies the features to use during the capture.
Flag Description
WIM_FLAG_VERIFY
Capture will verify single-instance files byte by byte.
Return ValueIf the function succeeds, then the return value is a handle to an object representing the volume image. If the function fails, then the return value is NULL. To obtain extended error information, call GetLastError.
RemarksTo obtain information during an image capture, see the WIMRegisterMessageCallback function.
The last is :
Registers a function to be called with imaging-specific data. For information about the messages that can be handled, see Messages.
C++
DWORD
WINAPI
WIMRegisterMessageCallback(
IN_OPT HANDLE hWim
IN FARPROC fpMessageProc,
IN_OPT LPVOID lpvUserData
);
Parameters
hWim
[in optional] The handle to a WIM file returned by WIMCreateFile.
fpMessageProc
[in] A pointer to an application-defined callback function. For more information, see the WIMMessageCallback function.
lpvUserData
[in] A pointer that specifies an application-defined value to be passed to the callback function.
Return ValueIf the function succeeds, then the return value is the zero-based index of the callback. If the function fails, then the return value is INVALID_CALLBACK_VALUE (0xFFFFFFFF). To obtain extended error information, call the GetLastError function.
RemarksIf a WIM handle is specified, the callback function will only receive messages regarding that WIM file. If no handle is specified, then the callback function will receive messages for all image handles.
Call the WIMUnregisterMessageCallback function when the callback function is no longer required.
Thanx in advance !
Page 1 of 1
WIMGAPI
#2
Posted 29 August 2006 - 11:34 PM
nevermind, after exhaustive research and some uncommon sense...i've figured out what i needed...
#3
Posted 29 August 2006 - 11:47 PM
Which was what? Please tell us, don't say you found it, and then go away..
#4
Posted 07 October 2006 - 09:59 AM
Hi
I am also trying to write an ImageX app. However, I don't want to use .Net because there is no official support for this in WinPE 2. Even if .Net was added to WinPE 2, then we could only load WinPE in Ram on systems with 1Gb of memory or more. As it is WinPE 2 needs over 256Mb of ram and adding .Net would probably leave little free ram.
If anyone has the wimgapi.dll working with VB6 and can supply me with some basic VB6 code for using it I would be very grateful.
Thanks
I am also trying to write an ImageX app. However, I don't want to use .Net because there is no official support for this in WinPE 2. Even if .Net was added to WinPE 2, then we could only load WinPE in Ram on systems with 1Gb of memory or more. As it is WinPE 2 needs over 256Mb of ram and adding .Net would probably leave little free ram.
If anyone has the wimgapi.dll working with VB6 and can supply me with some basic VB6 code for using it I would be very grateful.
Thanks
#5
Posted 27 November 2006 - 07:50 PM
I wrote a VB6 disk imaging app using SmartWim instead of the wimgapi sdk because of the hanging issues and lack of event sinking to script clients. SmartWim is an ActiveX component from http://www.smartdeploy.com that is based on the Wimgapi SDK and works flawlessly in VB, VBScript, DHTML, etc.
For instance, here is some VB6 code that applies an image while displaying a progress bar:
' In a form
Private WithEvents objSmartWim As SmartWim
Private Sub Command1_Click()
Dim ResultCode As swcError
Set objSmartWim = New SmartWim
objSmartWim.File = "C:\Image.wim"
objSmartWim.Name = "My Test Image"
objSmartWim.Path = "C:\Test"
ResultCode = objSmartWim.ApplyImage()
MsgBox objSmartWim.GetErrorDescription(ResultCode)
Set objSmartWim = Nothing
End Sub
Private Sub objSmartWim_Progress(ByVal nPercent As Integer, ByVal nSeconds As Long)
ProgressBar1.Value = nPercent
End Sub
That's it! No hangs, no gigantic declare sections, etc.
Have fun...
For instance, here is some VB6 code that applies an image while displaying a progress bar:
' In a form
Private WithEvents objSmartWim As SmartWim
Private Sub Command1_Click()
Dim ResultCode As swcError
Set objSmartWim = New SmartWim
objSmartWim.File = "C:\Image.wim"
objSmartWim.Name = "My Test Image"
objSmartWim.Path = "C:\Test"
ResultCode = objSmartWim.ApplyImage()
MsgBox objSmartWim.GetErrorDescription(ResultCode)
Set objSmartWim = Nothing
End Sub
Private Sub objSmartWim_Progress(ByVal nPercent As Integer, ByVal nSeconds As Long)
ProgressBar1.Value = nPercent
End Sub
That's it! No hangs, no gigantic declare sections, etc.
Have fun...
- ← VB.net, Reading 'X' number of Bytes from a file
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- Some general Questions about vb.net →
Share this topic:
Page 1 of 1



Help
Back to top









