GW2RegisterOutputMemory
Ang GW2RegisterOutputMemory function ay nagrerehistro ng lokasyon sa memorya kung saan ilalagay sa isang session ang managed file na ginawa ng Glasswall. Ang paggamit ng function na ito ay nag-a-activate ng Manage & Protect Process Mode para sa session.
- C++
- C#
- Java
- Python
- JavaScript
Buod
Para sa session na session, nirerehistro ng GW2RegisterOutputMemory function kung saan ilalagay ang managed content, at kung saan ilalagay ang laki sa bytes ng managed content. Ang pointer sa nilalaman ng managed file ay ilalagay sa object na tinutukoy ng outputBuffer at ang laki sa bytes ng managed data ay ilalagay sa size_t object na tinutukoy ng outputLength. Made-delete ang nilalaman ng managed file kapag isinara ang session gamit ang GW2CloseSession. Ang paggamit ng function na ito ay nag-a-activate ng Manage and Protect Process Mode para sa session.
#include "glasswall.core2.api.h"
int GW2RegisterOutputMemory(Session session, char **outputBuffer, size_t *outputLength);
Ibinabalik
Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.
Halimbawa
#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 */
Buod
public int RegisterOutputMemory(
int session,
out IntPtr outputBufferPtr,
ref UIntPtr outputBufferLengthPtr)
Ibinabalik
Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.
Buod
import com.glasswall.core2javabridge.*;
public int GW2RegisterOutputMemory(int session) throws GlasswallException
Paglalarawan
Ang GW2RegisterOutputMemory function ay nagrerehistro ng memory buffer na gagamitin bilang output para sa output file ng session na tinukoy ng session.
Kakailanganin mong tawagin ang GetOutputBuffer pagkatapos tawagin ang GW2RunSession upang makuha ang output file.
Ibinabalik
Ang GW2RegisterOutputMemory function ay nagbabalik ng GW2_RetStatus enumeration na kino-convert sa int. Magiging negatibo ang value kung may naganap na error. Ang 0 ay nagsasaad ng tagumpay. Sumangguni sa API Overview/Return types para sa mga detalye.
Isang GlasswallException exception ang ita-throw kung hindi valid ang session.
Buod - Kunin ang Data
import com.glasswall.core2javabridge.*;
public byte[] GetOutputBuffer(int session) throws GlasswallException
Paglalarawan
Kinukuha ng function na GetOutputBuffer ang output buffer na nauugnay sa session na tinukoy ng session.
Ibinabalik
Ang function na GetOutputBuffer ay nagbabalik ng isang byte[] na naglalaman ng output file. Ito ay magiging null kung ang GW2RegisterOutputMemory at GW2RunSession ay hindi pa natawag, o kung ang file ay non-conforming.
Isang GlasswallException exception ang ita-throw kung hindi valid ang session.
Buod
Magrehistro ng output file para sa ibinigay na session. Kung ang output_file ay None, ibabalik ang file bilang mga attribute na 'buffer' at '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.
"""
Ibinabalik
gw_return_object (glasswall.GwReturnObj): Isang instance ng GwReturnObj na may attribute na 'status' na nagsasaad ng resulta ng function call. Kung ang output_file ay None (memory mode), kasama ang 'buffer' at 'buffer_length' na naglalaman ng nilalaman ng file at laki ng file.
Ang status attribute ay isang integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng failure.
Buod
Inirerehistro ng function na ito kung saan ilalagay ang managed content, at kung saan ilalagay ang size variable ng content.
/**
* @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)
Ibinabalik
Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.