DismInitialize function
[Some information relates to pre-released product which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.]
Initializes DISM API. DismInitialize must be called once per process, before calling any other DISM API functions.
Syntax
HRESULT WINAPI DismInitialize(
_In_ DismLogLevel LogLevel,
_In_opt_ PCWSTR LogFilePath,
_In_opt_ PCWSTR ScratchDirectory
);
Parameters
LogLevel [in]
A DismLogLevel enumeration value, such as DismLogErrorsWarnings.
LogFilePath [in, optional]
Optional. A relative or absolute path to a log file. All messages generated will be logged to this path. If NULL, the default log path, %windir%\Logs\DISM\dism.log, will be used.
ScratchDirectory [in, optional]
Optional. A relative or absolute path to a scratch directory. DISM API will use this directory for internal operations. If NULL, the default temp directory, \Windows\%Temp%, will be used.
Return value
Returns S_OK on success.
Returns DISMAPI_E_DISMAPI_ALREADY_INITIALIZED if DismInitialize has already been called by the process without a matching call to DismShutdown.
Returns HRESULT_FROM_WIN32(ERROR_ELEVATION_REQUIRED)
if the process is not elevated.
Remarks
The client code must call DismInitialize once per process. DISM API will serialize concurrent calls to DismInitialize. The first call will succeed and the others will fail. For more information, see Using the DISM API.
Example
HRESULT hr = S_OK;
DismLogLevel Level = DismLogErrorsWarningsInfo;
hr = DismInitialize(Level, NULL, NULL);
Requirements
REquirement | Description |
---|---|
Supported host platforms: | DISM API can be used on any operating system supported by the Windows Assessment and Deployment Kit (Windows ADK). For more information, see the Windows ADK Technical Reference |
Minimum supported client | Windows 7 [desktop apps only] |
Minimum supported server | Windows Server 2008 R2 [desktop apps only] |
Header | DismAPI.h |
Library | DismAPI.lib |
DLL | DismAPI.dll |