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 !