GW2RegisterExportMemory
ฟังก์ชัน GW2RegisterExportMemory จะลงทะเบียนตำแหน่งหน่วยความจำสำหรับจัดเก็บไฟล์ที่ส่งออก การใช้ฟังก์ชันนี้จะเปิดใช้งาน Export Process Mode สำหรับ session
- C++
- C#
- Java
- Python
- JavaScript
สรุป
สำหรับ session session ฟังก์ชัน GW2RegisterExportMemory จะลงทะเบียนตำแหน่งที่จะวางเนื้อหาที่ส่งออก และตำแหน่งที่จะวางขนาดเป็นไบต์ของเนื้อหาที่ส่งออก พอยน์เตอร์ไปยังเนื้อหาที่ส่งออกจะถูกวางไว้ในอ็อบเจ็กต์ที่ exportFileBuffer ชี้อยู่ และขนาดเป็นไบต์ของข้อมูลที่ส่งออกจะถูกวางไว้ในอ็อบเจ็กต์ size_t ที่ exportFileBufferLength ชี้อยู่ เนื้อหาที่ส่งออกจะถูกลบเมื่อปิด session โดยใช้ GW2CloseSession การใช้ฟังก์ชันนี้จะเปิดใช้งาน Export Process Mode สำหรับ session
#include "glasswall.core2.api.h"
int GW2RegisterExportMemory(Session session,
char **exportFileBuffer,
size_t *exportFileBufferLength);
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว
สรุป
public int RegisterExportMemory(
int session,
out IntPtr exportFileBufferPtr,
ref UIntPtr exportBufferLengthPtr)
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว
สรุป
import com.glasswall.core2javabridge.*;
public int GW2RegisterExportMemory(int session) throws GlasswallException
คำอธิบาย
ฟังก์ชัน GW2RegisterExportMemory ลงทะเบียนบัฟเฟอร์หน่วยความจำเพื่อใช้เป็นเอาต์พุตสำหรับไฟล์ที่ส่งออก สำหรับเซสชันที่ระบุโดย session เรียก GetExportBuffer หลังจากเรียก GW2RunSession แล้ว เพื่อดึงข้อมูลที่ส่งออกกลับมา
ส่งกลับ
ฟังก์ชัน GW2RegisterExportMemory ส่งกลับค่า enumeration GW2_RetStatus ที่แปลงเป็น int ค่าเป็นลบหากเกิดข้อผิดพลาด 0 หมายถึงสำเร็จ โปรดดูรายละเอียดใน API Overview/Return types
ระบบจะโยนข้อยกเว้น GlasswallException หาก session ไม่ถูกต้อง
เรื่องย่อ - ดึงข้อมูล
import com.glasswall.core2javabridge.*;
public byte[] GetExportBuffer(int session) throws GlasswallException
คำอธิบาย
ฟังก์ชัน GetExportBuffer ดึงเนื้อหาของ export buffer ที่เชื่อมโยงกับเซสชันที่ระบุโดย session
ส่งกลับ
ฟังก์ชัน GetExportBuffer ส่งกลับ byte[] ที่มีไฟล์ที่ส่งออก ค่านี้จะเป็น null หากยังไม่ได้เรียก GW2RegisterExportMemory และ GW2RunSession หรือหากไฟล์ไม่เป็นไปตามข้อกำหนด
ระบบจะโยนข้อยกเว้น GlasswallException หาก session ไม่ถูกต้อง
สรุป
ลงทะเบียนไฟล์ที่จะส่งออกสำหรับ session ที่กำหนด ไฟล์ส่งออกจะถูกสร้างขึ้นระหว่างการเรียก run_session ของ session
def register_export(self, session: int, output_file: Optional[str] = None):
""" Registers a file to be exported for the given session. The export file will be created during the session's run_session call.
Args:
session (int): The session integer.
output_file (Optional[str]): Default None. The file path where the export will be written. None exports the file in memory.
Returns:
gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attribute 'status' indicating the result of the function call and 'session', the session integer. 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): อินสแตนซ์ GwReturnObj ที่มีแอตทริบิวต์ 'status' ระบุผลลัพธ์ของการเรียกฟังก์ชัน และ 'session' ซึ่งเป็นจำนวนเต็มของ session หาก output_file เป็น None (โหมดหน่วยความจำ) จะมี 'buffer' และ 'buffer_length' รวมอยู่ด้วย ซึ่งประกอบด้วยเนื้อหาไฟล์และขนาดไฟล์
แอตทริบิวต์ status เป็นค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงความล้มเหลว
สรุป
ฟังก์ชันนี้ลงทะเบียนตำแหน่งหน่วยความจำสำหรับการส่งออกกับเซสชันที่ระบุ
/**
*
* @param {number} session The ID of the session.
* @param {string} exportFileBuffer A pointer to the specified memory location.
* @param {number} exportLength The size of the file buffer.
*/
GW2RegisterExportMemory(session, exportFileBuffer, exportLength)
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว