Current News
Archived News
Search News
Discussion Forum


Old Forum
Install Programs More Downloads...
Troubleshooting
Source Code
Format Specs.
Misc. Information
Non-SF Stuff
Links




ShadowFlare [Sun, 25 Oct 2009 07:09:30 +0000 (01:09 -0600)]
SFmpqapi.bas
SFmpqapi.cpp
SFmpqapi.h
SFmpqapi_no-lib.h

index e6d38e6..0e42b71 100644 (file)
@@ -199,6 +199,7 @@ Public Const SFILE_INFO_HASH_INDEX As Long = &HC 'Hash index of file in MPQ
 Public Const SFILE_LIST_MEMORY_LIST  As Long = &H1 ' Specifies that lpFilelists is a file list from memory, rather than being a list of file lists\r
 Public Const SFILE_LIST_ONLY_KNOWN   As Long = &H2 ' Only list files that the function finds a name for\r
 Public Const SFILE_LIST_ONLY_UNKNOWN As Long = &H4 ' Only list files that the function does not find a name for\r
+Public Const SFILE_LIST_FLAG_UNKNOWN As Long = &H8 ' Use without SFILE_LIST_ONLY_KNOWN or SFILE_LIST_FLAG_UNKNOWN to list all files, but set dwFileExists to 3 if file's name is not found\r
 \r
 Public Const SFILE_TYPE_MPQ As Long = &H1\r
 Public Const SFILE_TYPE_FILE As Long = &H2\r
index 0579c2c..86631f4 100644 (file)
@@ -1526,7 +1526,10 @@ BOOL SFMPQAPI WINAPI SFileListFiles(MPQHANDLE hMPQ, LPCSTR lpFileLists, FILELIST
                                lpListBuffer[i].dwCompressedSize = mpqOpenArc->lpBlockTable[dwBlockIndex].dwCompressedSize;
                                lpListBuffer[i].dwFullSize = mpqOpenArc->lpBlockTable[dwBlockIndex].dwFullSize;
                                lpListBuffer[i].dwFlags = mpqOpenArc->lpBlockTable[dwBlockIndex].dwFlags;
-                               lpListBuffer[i].dwFileExists=0xFFFFFFFF;
+                               if (dwFlags & SFILE_LIST_FLAG_UNKNOWN)
+                                       lpListBuffer[i].dwFileExists = 1;
+                               else
+                                       lpListBuffer[i].dwFileExists=0xFFFFFFFF;
                                SetFilePointer(mpqOpenArc->hFile,mpqOpenArc->dwMPQStart+mpqOpenArc->lpBlockTable[dwBlockIndex].dwFileOffset+0x40,0,FILE_BEGIN);
                                ReadFile(mpqOpenArc->hFile,lpListBuffer[i].szFileName,260,&tsz,0);
 
@@ -1537,6 +1540,10 @@ BOOL SFMPQAPI WINAPI SFileListFiles(MPQHANDLE hMPQ, LPCSTR lpFileLists, FILELIST
                                }
                                else {
                                        sprintf(lpListBuffer[i].szFileName,UNKNOWN_OUT,i);
+                                       if (dwFlags & SFILE_LIST_FLAG_UNKNOWN) {
+                                               lpListBuffer[i].dwFileExists |= 2;
+                                       }
+
                                        if (dwFlags&SFILE_LIST_ONLY_KNOWN) {
                                                lpListBuffer[i].dwFileExists = 0;
                                        }
@@ -1690,7 +1697,10 @@ BOOL SFMPQAPI WINAPI SFileListFiles(MPQHANDLE hMPQ, LPCSTR lpFileLists, FILELIST
                        lpListBuffer[i].dwCompressedSize = mpqOpenArc->lpBlockTable[dwBlockIndex].dwCompressedSize;
                        lpListBuffer[i].dwFullSize = mpqOpenArc->lpBlockTable[dwBlockIndex].dwFullSize;
                        lpListBuffer[i].dwFlags = mpqOpenArc->lpBlockTable[dwBlockIndex].dwFlags;
-                       lpListBuffer[i].dwFileExists=0xFFFFFFFF;
+                       if (dwFlags & SFILE_LIST_FLAG_UNKNOWN)
+                               lpListBuffer[i].dwFileExists = 1;
+                       else
+                               lpListBuffer[i].dwFileExists=0xFFFFFFFF;
                        for (j=0;j<dwTotalLines;j++) {
                                if (mpqOpenArc->lpHashTable[i].dwNameHashA==lpdwNameHashA[j] && mpqOpenArc->lpHashTable[i].dwNameHashB==lpdwNameHashB[j]) {
                                        strncpy(lpListBuffer[i].szFileName,lpNames[j],260);
@@ -1701,6 +1711,10 @@ BOOL SFMPQAPI WINAPI SFileListFiles(MPQHANDLE hMPQ, LPCSTR lpFileLists, FILELIST
                                }
                                if (j+1==dwTotalLines) {
                                        sprintf(lpListBuffer[i].szFileName,UNKNOWN_OUT,i);
+                                       if (dwFlags & SFILE_LIST_FLAG_UNKNOWN) {
+                                               lpListBuffer[i].dwFileExists |= 2;
+                                       }
+
                                        if (dwFlags&SFILE_LIST_ONLY_KNOWN) {
                                                lpListBuffer[i].dwFileExists = 0;
                                        }
index 7fe313d..5626028 100644 (file)
@@ -281,6 +281,7 @@ long SFMPQAPI __inline SFMpqCompareVersion();
 #define SFILE_LIST_MEMORY_LIST  0x01 // Specifies that lpFilelists is a file list from memory, rather than being a list of file lists
 #define SFILE_LIST_ONLY_KNOWN   0x02 // Only list files that the function finds a name for
 #define SFILE_LIST_ONLY_UNKNOWN 0x04 // Only list files that the function does not find a name for
+#define SFILE_LIST_FLAG_UNKNOWN 0x08 // Use without SFILE_LIST_ONLY_KNOWN or SFILE_LIST_FLAG_UNKNOWN to list all files, but set dwFileExists to 3 if file's name is not found
 
 // SFileOpenArchive flags
 #define SFILE_OPEN_HARD_DISK_FILE 0x0000 //Open archive without regard to the drive type it resides on
index 72bb672..06e04fb 100644 (file)
@@ -265,6 +265,7 @@ long SFMpqCompareVersion();
 #define SFILE_LIST_MEMORY_LIST  0x01 // Specifies that lpFilelists is a file list from memory, rather than being a list of file lists
 #define SFILE_LIST_ONLY_KNOWN   0x02 // Only list files that the function finds a name for
 #define SFILE_LIST_ONLY_UNKNOWN 0x04 // Only list files that the function does not find a name for
+#define SFILE_LIST_FLAG_UNKNOWN 0x08 // Use without SFILE_LIST_ONLY_KNOWN or SFILE_LIST_FLAG_UNKNOWN to list all files, but set dwFileExists to 3 if file's name is not found
 
 // SFileOpenArchive flags
 #define SFILE_OPEN_HARD_DISK_FILE 0x0000 //Open archive without regard to the drive type it resides on