LoadEnclaveData function
Loads data into an uninitialized enclave that you created by calling CreateEnclave.
Syntax
BOOL WINAPI 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_opt_ LPDWORD lpEnclaveError );
Parameters
- hProcess [in]
-
A handle to the process for which the enclave was created.
- lpAddress [in]
-
The address in the enclave where you want to load the data.
- lpBuffer [in]
-
A pointer to the data the you want to load into the enclave.
- nSize [in]
-
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.
- flProtect [in]
-
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_GUARD
- PAGE_NOCACHE
- PAGE_WRITECOMBINE
- PAGE_NOACCESS
For the ENCLAVE_TYPE_SGX enclave type, this value can include the enclave specific constants that the following table describes.
Constant Description 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. - lpPageInformation [in]
-
A pointer to information that describes the pages that you want to add to the enclave. For the ENCLAVE_TYPE_SGX enclave type, the lpPageInformation parameter is not used.
- dwInfoLength [in]
-
The length of the structure that the lpPageInformation parameter points to, in bytes. For the ENCLAVE_TYPE_SGX enclave type, this value must be 0.
- lpNumberOfBytesWritten [out]
-
A pointer to a variable that receives the number of bytes that LoadEnclaveData copied into the enclave.
- lpEnclaveError [out, optional]
-
An optional pointer to a variable that receives an enclave error code that is architecture-specific. For the ENCLAVE_TYPE_SGX enclave type, the lpEnclaveError parameter is not used.
Return value
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.
| Return code | Description |
|---|---|
|
An failure specific to the underlying enclave architecture occurred. The value for the lpEnclaveError parameter contains the architecture-specific error. For the ENCLAVE_TYPE_SGX enclave type, this value is not used for this function. |
|
The value of the dwInfoLength parameter did not match the value expected based on the value specified for the lpPageInformation parameter. |
Remarks
To initialize the enclave after you load data into the enclave, call InitializeEnclave.
Requirements
|
Minimum supported client |
Windows 10 [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2016 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also