GW2RegisterOutputMemory
GW2RegisterOutputMemory 함수는 Glasswall에서 생성한 관리 파일을 session에 배치할 메모리 위치를 등록합니다. 이 함수를 사용하면 해당 session에 대해 Manage & Protect Process Mode가 활성화됩니다.
- C++
- C#
- Java
- Python
- JavaScript
개요
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 */
개요
public int RegisterOutputMemory(
int session,
out IntPtr outputBufferPtr,
ref UIntPtr outputBufferLengthPtr)
반환값
정수 GW2_RetStatus enum 값을 반환합니다. 음수는 실패를 나타냅니다.
개요
import com.glasswall.core2javabridge.*;
public int GW2RegisterOutputMemory(int session) throws GlasswallException
설명
GW2RegisterOutputMemory 함수는 session으로 지정된 session의 출력 파일에 대한 출력으로 사용할 메모리 버퍼를 등록합니다.
출력 파일을 가져오려면 GW2RunSession을 호출한 후 GetOutputBuffer를 호출해야 합니다.
반환값
GW2RegisterOutputMemory 함수는 GW2_RetStatus 열거형을 int로 변환하여 반환합니다. 오류가 발생한 경우 값은 음수가 됩니다. 0은 성공을 나타냅니다. 자세한 내용은 API 개요/반환 형식을 참조하세요.
GlasswallException 예외는 session이 유효하지 않으면 발생합니다.
개요 - 데이터 검색
import com.glasswall.core2javabridge.*;
public byte[] GetOutputBuffer(int session) throws GlasswallException
설명
GetOutputBuffer 함수는 session으로 지정된 세션과 연결된 출력 버퍼를 가져옵니다.
반환값
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 enum 값을 반환합니다. 음수는 실패를 나타냅니다.