Example #1
0
// Adds a listfile into the MPQ archive.
int WINAPI SFileAddListFile(HANDLE hMpq, const char * szListFile)
{
    TMPQArchive * ha = (TMPQArchive *)hMpq;
    int nError = ERROR_SUCCESS;

    // Add the listfile for each MPQ in the patch chain
    while(ha != NULL)
    {
        if(szListFile != NULL)
            SFileAddExternalListFile(ha, hMpq, szListFile);
        else
            SFileAddInternalListFile(ha, hMpq);

        // Also, add three special files to the listfile:
        // (listfile) itself, (attributes) and (signature)
        SListFileCreateNodeForAllLocales(ha, LISTFILE_NAME);
        SListFileCreateNodeForAllLocales(ha, SIGNATURE_NAME);
        SListFileCreateNodeForAllLocales(ha, ATTRIBUTES_NAME);

        // Move to the next archive in the chain
        ha = ha->haPatch;
    }

    return nError;
}
Example #2
0
// Adds a listfile into the MPQ archive.
int WINAPI SFileAddListFile(HANDLE hMpq, const char * szListFile)
{
    TMPQArchive * ha = (TMPQArchive *)hMpq;
    int nError = ERROR_SUCCESS;

    // Add the listfile for each MPQ in the patch chain
	TMPQArchive* halist[MAX_PATCH_NUM + 1] = {0};
	halist[0] = ha;
	if (ha != NULL)
	{
		DWORD nCount = 1;
		for (DWORD i = 0; i < ha->dwPatchCount; ++i)
		{
			halist[1+i] = ha->haPatchList[i];
			++nCount;
		}

		for (DWORD i = 0; i < nCount; ++i)
		{
			ha = halist[i];

			if(szListFile != NULL)
				SFileAddExternalListFile(ha, hMpq, szListFile);
			else
				SFileAddInternalListFile(ha, hMpq);

			// Also, add three special files to the listfile:
			// (listfile) itself, (attributes) and (signature)
			SListFileCreateNodeForAllLocales(ha, LISTFILE_NAME);
			SListFileCreateNodeForAllLocales(ha, SIGNATURE_NAME);
			SListFileCreateNodeForAllLocales(ha, ATTRIBUTES_NAME);
		}
	}

    return nError;
}
Example #3
0
static int SFileAddArbitraryListFile(
    TMPQArchive * ha,
    HANDLE hListFile)
{
    TListFileCache * pCache = NULL;
    size_t nLength;
    char szFileName[MAX_PATH];

    // Create the listfile cache for that file
    pCache = CreateListFileCache(hListFile, NULL);
    if(pCache != NULL)
    {
        // Load the node list. Add the node for every locale in the archive
        while((nLength = ReadListFileLine(pCache, szFileName, sizeof(szFileName))) > 0)
            SListFileCreateNodeForAllLocales(ha, szFileName);

        // Delete the cache
        FreeListFileCache(pCache);
    }
    
    return (pCache != NULL) ? ERROR_SUCCESS : ERROR_FILE_CORRUPT;
}