メイン コンテンツにスキップ

GW2RegisterOutputMemory

GW2RegisterOutputMemory 関数は、Glasswall によって生成された managed file を配置するメモリ位置をセッションに登録します。この関数を使用すると、そのセッションで Manage & Protect Process Mode が有効になります。

概要

セッション session に対して、GW2RegisterOutputMemory 関数は、managed content を配置する場所と、その managed content のバイト単位のサイズを配置する場所を登録します。managed file content へのポインタは outputBuffer が指すオブジェクトに配置され、managed data のバイト単位のサイズは outputLength が指す size_t オブジェクトに配置されます。managed file content は、GW2CloseSession を使用してセッションを閉じると削除されます。この関数を使用すると、そのセッションで Manage and Protect Process Mode が有効になります。

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

戻り値

整数の GW2_RetStatus 列挙値を返します。負の数は失敗を示します。


#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 */