ข้ามไปยังเนื้อหาหลัก

GW2RegisterOutputMemory

ฟังก์ชัน GW2RegisterOutputMemory ลงทะเบียนตำแหน่งหน่วยความจำสำหรับวางไฟล์ที่ถูกจัดการซึ่งสร้างโดย Glasswall ให้กับ session การใช้ฟังก์ชันนี้จะเปิดใช้งาน Manage & Protect Process Mode สำหรับ session.

สรุป

สำหรับ session session ฟังก์ชัน GW2RegisterOutputMemory จะลงทะเบียนตำแหน่งที่จะวางเนื้อหาที่ถูกจัดการ และตำแหน่งที่จะวางขนาดเป็นไบต์ของเนื้อหาที่ถูกจัดการ พอยน์เตอร์ไปยังเนื้อหาไฟล์ที่ถูกจัดการจะถูกวางไว้ในอ็อบเจ็กต์ที่ outputBuffer ชี้ไป และขนาดเป็นไบต์ของข้อมูลที่ถูกจัดการจะถูกวางไว้ในอ็อบเจ็กต์ size_t ที่ outputLength ชี้ไป เนื้อหาไฟล์ที่ถูกจัดการจะถูกลบเมื่อปิด session โดยใช้ GW2CloseSession การใช้ฟังก์ชันนี้จะเปิดใช้งาน Manage and Protect Process Mode สำหรับ session.

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

ส่งกลับ

ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว

ตัวอย่าง


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