GW2RegisterOutputMemory
GW2RegisterOutputMemory 関数は、Glasswall によって生成された managed file を配置するメモリ位置をセッションに登録します。この関数を使用すると、そのセッションで Manage & Protect Process Mode が有効になります。
- C++
- C#
- Java
- Python
- JavaScript
概要
セッション 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 */
概要
public int RegisterOutputMemory(
int session,
out IntPtr outputBufferPtr,
ref UIntPtr outputBufferLengthPtr)
戻り値
整数の GW2_RetStatus 列挙値を返します。負の数は失敗を示します。
概要
import com.glasswall.core2javabridge.*;
public int GW2RegisterOutputMemory(int session) throws GlasswallException
説明
GW2RegisterOutputMemory 関数は、session で指定されたセッションの出力ファイルの出力先として使用するメモリバッファを登録します。
出力ファイルを取得するには、GW2RunSession を呼び出した後に GetOutputBuffer を呼び出す必要があります。
戻り値
GW2RegisterOutputMemory 関数は、GW2_RetStatus 列挙を int に変換して返します。エラーが発生した場合、値は負になります。0 は成功を示します。詳細については、API Overview/Return types を参照してください。
GlasswallException 例外は、session が無効な場合にスローされます。
概要 - データの取得
import com.glasswall.core2javabridge.*;
public byte[] GetOutputBuffer(int session) throws GlasswallException
説明
session で指定されたセッションに関連付けられた出力バッファを、GetOutputBuffer 関数が取得します。
戻り値
GetOutputBuffer 関数は、出力ファイルを含む byte[] を返します。GW2RegisterOutputMemory と GW2RunSession が呼び出されていない場合、またはファイルが非準拠である場合、これは null になります。
GlasswallException 例外は、session が無効な場合にスローされます。
概要
指定されたセッションに対して出力ファイルを登録します。output_file が None の場合、ファイルは 'buffer' および 'buffer_length' 属性として返されます。
def register_output(self, session, output_file: Optional[str] = None):
""" Register an output file for the given session. If output_file is None the file will be returned as 'buffer' and 'buffer_length' attributes.
Args:
session (int): The session integer.
output_file (Optional[str]): If specified, during run session the file will be written to output_file, otherwise the file will be written to the glasswall.GwReturnObj 'buffer' and 'buffer_length' attributes.
Returns:
gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attribute 'status' indicating the result of the function call. If output_file is None (memory mode), 'buffer', and 'buffer_length' are included containing the file content and file size.
"""
戻り値
gw_return_object (glasswall.GwReturnObj): 関数呼び出しの結果を示す属性 'status' を持つ GwReturnObj インスタンスです。output_file が None(メモリモード)の場合、ファイル内容とファイルサイズを含む 'buffer' および 'buffer_length' が含まれます。
status 属性は整数の GW2_RetStatus enum 値です。負の数は失敗を示します。
概要
この関数は、管理対象コンテンツを配置する場所と、そのコンテンツのサイズ変数を配置する場所を登録します。
/**
* @param {number} session The ID of the session.
* @param {string} outputBuffer The specified output path. Must be different to the specified input file path.
* @param {string} outputLength The size of the file buffer
*/
GW2RegisterOutputMemory(
session,
outputBuffer,
outputLength)
戻り値
整数の GW2_RetStatus 列挙値を返します。負の数は失敗を示します。