メイン コンテンツにスキップ

GW2GetFileTypeID

すべてのファイルタイプには、Glasswall Engine 内で関連付けられた ID があります。この API は、指定された関連ファイル拡張子に対する Glasswall のファイルタイプ ID を文字列形式で提供します。


#include "glasswall.core2.api.h"

int GW2GetFileTypeID(
Session session,
const char *fileType,
size_t *bufferLength,
char **outputBuffer);

パラメーター

session GW2OpenSession によって返されるセッションの ID

fileType ファイル拡張子を含む文字列。例: "bmp"

bufferLength outputBuffer が指すメモリのバイト単位のサイズが設定される出力パラメーターです。

outputBuffer 指定された拡張子に関連付けられたファイルタイプ ID が格納される、文字列ポインターの出力パラメーターです。このポインターで使用されるメモリをユーザーが解放する必要は ありません

戻り値

  関数呼び出しが成功したかどうかを示す整数を返します。負の数は失敗を示します。リターンコードの説明については、Return Types テーブルを参照してください。成功した場合、outputBuffer にはファイルタイプ ID が格納されます。


#include "glasswall.core2.api.h"

char *outbuf = NULL;
size_t buflen = 0;

if (GW2OpenSession() < 0)
/* error opening session */
else
{
int status = GW2GetFileTypeID(session, fileType, &buflen, &outbuf);

/* outbuf points to a buffer containing the XML file.
* Either process the data pointed to, or copy the data and process it
* after GW2CloseSession is called
*/

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