GW2RegisterOutputMemory
GW2RegisterOutputMemory function, Glasswall द्वारा उत्पादित managed file को किसी session में रखने के लिए memory location रजिस्टर करता है। इस function का उपयोग करने से session के लिए Manage & Protect Process Mode सक्रिय हो जाता है।
- C++
- C#
- Java
- Python
- JavaScript
सारांश
session session के लिए, GW2RegisterOutputMemory function यह रजिस्टर करता है कि managed content कहाँ रखा जाना है, और managed content का आकार bytes में कहाँ रखा जाना है। managed file content का एक pointer, outputBuffer द्वारा point किए गए object में रखा जाएगा और managed data का आकार bytes में, outputLength द्वारा point किए गए size_t object में रखा जाएगा। session को GW2CloseSession का उपयोग करके बंद करने पर managed file content हटा दिया जाएगा। इस function का उपयोग करने से 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 function, session द्वारा निर्दिष्ट session के लिए output file के output के रूप में उपयोग किए जाने वाले एक memory buffer को रजिस्टर करता है।
output file प्राप्त करने के लिए, GW2RunSession को कॉल करने के बाद आपको GetOutputBuffer को कॉल करना होगा।
रिटर्न
GW2RegisterOutputMemory function, GW2_RetStatus enumeration को int में convert करके लौटाता है। यदि कोई त्रुटि हुई है, तो मान negative होगा। 0 सफलता को दर्शाता है। विवरण के लिए API Overview/Return types देखें।
A GlasswallException exception will be thrown if session is invalid.
सारांश - डेटा प्राप्त करें
import com.glasswall.core2javabridge.*;
public byte[] GetOutputBuffer(int session) throws GlasswallException
विवरण
The GetOutputBuffer फ़ंक्शन session द्वारा निर्दिष्ट session से संबद्ध output buffer को प्राप्त करता है।
रिटर्न
GetOutputBuffer फ़ंक्शन output file को शामिल करने वाला एक byte[] लौटाता है। यदि GW2RegisterOutputMemory और GW2RunSession को कॉल नहीं किया गया है, या यदि फ़ाइल non-conforming है, तो यह null होगा।
A GlasswallException exception will be thrown if session is invalid.
सारांश
दिए गए session के लिए एक output file register करें। यदि output_file None है, तो file 'buffer' और '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.
"""
रिटर्न
gw_return_object (glasswall.GwReturnObj): 'status' attribute के साथ एक GwReturnObj instance, जो function call के परिणाम को दर्शाता है। यदि output_file None है (memory mode), तो file content और file size को शामिल करते हुए 'buffer' और 'buffer_length' शामिल किए जाते हैं।
status attribute एक integer GW2_RetStatus enum value है। Negative numbers विफलता को दर्शाते हैं।
सारांश
यह फ़ंक्शन रजिस्टर करता है कि managed content को कहाँ रखा जाना है, और content के size variable को कहाँ रखना है।
/**
* @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 मान लौटाता है। नकारात्मक संख्याएँ विफलता को दर्शाती हैं।