Skip to main content
Version: 16.8.2

GW2RegisterOutputMemory

The GW2RegisterOutputMemory function registers the memory location to place the managed file produced by Glasswall to a session. Using this function activates the Manage & Protect Process Mode for the session.

Synopsis

For session session, the GW2RegisterOutputMemory function registers where the managed content is to be placed, and where to place the size in bytes of the managed content. A pointer to the managed file content will be placed in the object pointed to by outputBuffer and the size in bytes of the managed data will be placed in the size_t object pointed to by outputLength. The managed file content will be deleted when the session is closed using GW2CloseSession. Using this function activates the Manage and Protect Process Mode for the session.

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

Returns

Returns an integer GW2_RetStatus enum value. Negative numbers indicate a failure.

Example


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