コード例 #1
0
BOOL WINAPI MpqAddFileFromBuffer_stub(MPQHANDLE hMPQ, LPVOID lpBuffer, DWORD dwLength, LPCSTR lpFileName, DWORD dwFlags)
{
	LoadSFMpqDll();
	if (hSFMpq) {
		*(FARPROC *)&MpqAddFileFromBuffer = GetProcAddress(hSFMpq,"MpqAddFileFromBuffer");
		if (MpqAddFileFromBuffer) return MpqAddFileFromBuffer(hMPQ,lpBuffer,dwLength,lpFileName,dwFlags);
	}
	return FALSE;
}
コード例 #2
0
ファイル: FileIO.cpp プロジェクト: jjf28/Chkdraft
bool BufferToArchive(MPQHANDLE &hMpq, const buffer &buf, const std::string &mpqFilePath)
{
    if ( hMpq == nullptr )
        CHKD_ERR("NULL MPQ file specified for writing buffer");
    else
    {
        DWORD dataSize = (DWORD)buf.size();
        LPVOID dataPointer = (LPVOID)buf.getPtr(0);
        if ( MpqAddFileFromBuffer(hMpq, dataPointer, dataSize, mpqFilePath.c_str(), MAFA_COMPRESS | MAFA_REPLACE_EXISTING) == TRUE )
            return true;
        else
            CHKD_ERR("Failed to add buffered file to archive");
    }
    return false;
}