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 Small banner for links to this site: |
diff --git a/SFmpqapi.bas b/SFmpqapi.bas
--- a/SFmpqapi.bas
+++ b/SFmpqapi.bas
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
diff --git a/SFmpqapi.cpp b/SFmpqapi.cpp
--- a/SFmpqapi.cpp
+++ b/SFmpqapi.cpp
@@ -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;
}
diff --git a/SFmpqapi.h b/SFmpqapi.h
--- a/SFmpqapi.h
+++ b/SFmpqapi.h
#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
diff --git a/SFmpqapi_no-lib.h b/SFmpqapi_no-lib.h
--- a/SFmpqapi_no-lib.h
+++ b/SFmpqapi_no-lib.h
#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
|