LoadEnclaveData function (enclaveapi.h)
Loads data into an uninitialized enclave that you created by calling CreateEnclave.
BOOL LoadEnclaveData( [in] HANDLE hProcess, [in] LPVOID lpAddress, [in] LPCVOID lpBuffer, [in] SIZE_T nSize, [in] DWORD flProtect, [in] LPCVOID lpPageInformation, [in] DWORD dwInfoLength, [out] PSIZE_T lpNumberOfBytesWritten, [out, optional] LPDWORD lpEnclaveError );
A handle to the process for which the enclave was created.
The address in the enclave where you want to load the data.
A pointer to the data the you want to load into the enclave.
The size of the data that you want to load into the enclave, in bytes. This value must be a whole-number multiple of the page size.
The memory protection to use for the pages that you want to add to the enclave. For a list of memory protection values, see memory protection constants. This value must not include the following constants:
|PAGE_ENCLAVE_THREAD_CONTROL||The page contains a thread control structure (TCS).|
|PAGE_ENCLAVE_UNVALIDATED||The page contents that you supply are excluded from measurement with the EEXTEND instruction of the Intel Software Guard Extensions programming model.|
A pointer to information that describes the pages that you want to add to the enclave. The lpPageInformation parameter is not used.
The length of the structure that the lpPageInformation parameter points to, in bytes. This value must be 0.
A pointer to a variable that receives the number of bytes that LoadEnclaveData copied into the enclave.
[out, optional] lpEnclaveError
An optional pointer to a variable that receives an enclave error code that is architecture-specific. The lpEnclaveError parameter is not used.
If all of the data is loaded into the enclave successfully, the return value is nonzero. Otherwise, the return value is zero. To get extended error information, call GetLastError.
For a list of common error codes, see System Error Codes. The following error codes also apply for this function.
||The value of the dwInfoLength parameter did not match the value expected based on the value specified for the lpPageInformation parameter.|
To initialize the enclave after you load data into the enclave, call InitializeEnclave.
LoadEnclaveData is only supported enclaves that have the ENCLAVE_TYPE_SGX enclave type.
|Minimum supported client||Windows 10 [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2016 [desktop apps | UWP apps]|
|Header||enclaveapi.h (include Winbase.h)|
|DLL||Api-ms-win-core-enclave-l1-1-0.dll; kernel32.dll; KernelBase.dll|