GW2RegisterOutFile

Prev Next

The GW2RegisterOutFile function registers the destination for the managed file produced by Glasswall. Using this function activates the Manage & Protect Process Mode for the session.

Synopsis

For session session the GW2RegisterOutFile function registers the file whose name is the string pointed to by outputFileBuffer as the destination file for the managed file produced by Glasswall. The base name of the path must be different to the base name registered using the GW2RegisterInputFile function. Using this function activates the Manage & Protect Process Mode for the session.

#include "glasswall.core2.api.h"
int GW2RegisterOutFile(Session session, const char *outputFilePath);

Returns

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

Example

    #include "glasswall.core2.api.h"

    HANDLE session = GW2OpenSession();
    if (!session)
        /* deal with error */
    else
    {
        if (GW2RegisterOutFile(session, "managed_file.docx") < 0)
            /* deal with error */
        else
            /* continue processing */
            ...
    }

    /* later */
    if (GW2CloseSession(session) < 0)
        /* error closing session */

Synopsis

public int RegisterOutFile(
    int session,
    string outputFilePath)

Returns

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

Synopsis

import com.glasswall.core2javabridge.*;

public int GW2RegisterOutFile(int session, String outputFilePath) throws GlasswallException, NullPointerException

(Deprecated)
public int GW2RegisterOutFile(int session, byte[] outputFilePath) throws GlasswallException, NullPointerException

Note:

The GW2RegisterOutFile function parameters have been updated to use String in place of byte[]. The original function has been deprecated.

Returns

The GW2RegisterOutFile function returns a GW2_RetStatus enumeration converted to int. The value will be negative if an error occurred. 0 indicates success.

Please refer to API Overview for Return Types and their details.

A NullPointerException exception will be thrown if outputFilePath is null or empty.

A GlasswallException exception will be thrown if session is invalid, if the outputFilePath could not be retrieved, or if the outputFilePath could not be converted to UTF-8.

Synopsis

Register an output file for the given session. If output_file is None the file will be returned as 'buffer' and 'buffer_length' attributes.

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.
    """

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.

The status attribute is an integer GW2_RetStatus enum value. Negative numbers indicate a failure.

Synopsis

This function registers a destination file for the managed file produced by Glasswall.

/**
 * @param {number} session The ID of the session.
 * @param {string} outputFilePath The specified output path. Must be different to the specified input file path.
 */

GW2RegisterOutFile(
    session,
    outputFilePath)

Returns

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