주요 콘텐츠로 건너뛰기

GW2RegisterOutputMemory

GW2RegisterOutputMemory 함수는 Glasswall에서 생성한 관리 파일을 session에 배치할 메모리 위치를 등록합니다. 이 함수를 사용하면 해당 session에 대해 Manage & Protect Process Mode가 활성화됩니다.

개요

session session에 대해 GW2RegisterOutputMemory 함수는 관리된 콘텐츠를 배치할 위치와 관리된 콘텐츠의 바이트 단위 크기를 배치할 위치를 등록합니다. 관리 파일 콘텐츠에 대한 포인터는 outputBuffer가 가리키는 객체에 배치되고, 관리된 데이터의 바이트 단위 크기는 outputLength가 가리키는 size_t 객체에 배치됩니다. 관리 파일 콘텐츠는 GW2CloseSession을 사용하여 session을 닫을 때 삭제됩니다. 이 함수를 사용하면 해당 session에 대해 Manage and Protect Process Mode가 활성화됩니다.

#include "glasswall.core2.api.h"
int GW2RegisterOutputMemory(Session session, char **outputBuffer, size_t *outputLength);

반환값

정수 GW2_RetStatus enum 값을 반환합니다. 음수는 실패를 나타냅니다.

예제


#include "glasswall.core2.api.h"

HANDLE session = GW2OpenSession();
char *managed_content = NULL;
size_t size = 0;

if (!session)
/* deal with error */
else
{
if (GW2RegisterOutputMemory(session, &managed_content, &size) < 0)
/* deal with error */
else
/* continue processing */
...
}

/* later */
if (GW2CloseSession(session) < 0)
/* error closing session */
else
/* managed file content has been deleted */