aboutsummaryrefslogtreecommitdiff
path: root/dep/CascLib/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'dep/CascLib/src/common')
-rw-r--r--dep/CascLib/src/common/FileStream.cpp2
-rw-r--r--dep/CascLib/src/common/RootHandler.cpp14
-rw-r--r--dep/CascLib/src/common/RootHandler.h12
3 files changed, 24 insertions, 4 deletions
diff --git a/dep/CascLib/src/common/FileStream.cpp b/dep/CascLib/src/common/FileStream.cpp
index 7e0dd3cd484..22d7fceb4c2 100644
--- a/dep/CascLib/src/common/FileStream.cpp
+++ b/dep/CascLib/src/common/FileStream.cpp
@@ -74,6 +74,7 @@ static bool BaseFile_Create(TFileStream * pStream)
handle = open(pStream->szFileName, O_RDWR | O_CREAT | O_TRUNC | O_LARGEFILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if(handle == -1)
{
+ pStream->Base.File.hFile = INVALID_HANDLE_VALUE;
SetLastError(errno);
return false;
}
@@ -123,6 +124,7 @@ static bool BaseFile_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD
intptr_t handle;
// Open the file
+ pStream->Base.File.hFile = INVALID_HANDLE_VALUE;
handle = open(szFileName, oflag | O_LARGEFILE);
if(handle == -1)
{
diff --git a/dep/CascLib/src/common/RootHandler.cpp b/dep/CascLib/src/common/RootHandler.cpp
index 0ecbee981fb..2940e3f0cae 100644
--- a/dep/CascLib/src/common/RootHandler.cpp
+++ b/dep/CascLib/src/common/RootHandler.cpp
@@ -23,13 +23,13 @@ int RootHandler_Insert(TRootHandler * pRootHandler, const char * szFileName, LPB
return pRootHandler->Insert(pRootHandler, szFileName, pbEncodingKey);
}
-LPBYTE RootHandler_Search(TRootHandler * pRootHandler, struct _TCascSearch * pSearch, PDWORD PtrFileSize, PDWORD PtrLocaleFlags)
+LPBYTE RootHandler_Search(TRootHandler * pRootHandler, struct _TCascSearch * pSearch, PDWORD PtrFileSize, PDWORD PtrLocaleFlags, PDWORD PtrFileDataId)
{
// Check if the root structure is valid at all
if(pRootHandler == NULL)
return NULL;
- return pRootHandler->Search(pRootHandler, pSearch, PtrFileSize, PtrLocaleFlags);
+ return pRootHandler->Search(pRootHandler, pSearch, PtrFileSize, PtrLocaleFlags, PtrFileDataId);
}
void RootHandler_EndSearch(TRootHandler * pRootHandler, struct _TCascSearch * pSearch)
@@ -76,3 +76,13 @@ void RootHandler_Close(TRootHandler * pRootHandler)
pRootHandler->Close(pRootHandler);
}
}
+
+DWORD RootHandler_GetFileId(TRootHandler * pRootHandler, const char * szFileName)
+{
+ // Check if the root structure is valid at all
+ if(pRootHandler == NULL)
+ return NULL;
+
+ return pRootHandler->GetFileId(pRootHandler, szFileName);
+}
+
diff --git a/dep/CascLib/src/common/RootHandler.h b/dep/CascLib/src/common/RootHandler.h
index e1869e351cc..d1b66e501d8 100644
--- a/dep/CascLib/src/common/RootHandler.h
+++ b/dep/CascLib/src/common/RootHandler.h
@@ -37,7 +37,8 @@ typedef LPBYTE (*ROOT_SEARCH)(
struct TRootHandler * pRootHandler, // Pointer to an initialized root handler
struct _TCascSearch * pSearch, // Pointer to the initialized search structure
PDWORD PtrFileSize, // Pointer to receive file size (optional)
- PDWORD PtrLocaleFlags // Pointer to receive locale flags (optional)
+ PDWORD PtrLocaleFlags, // Pointer to receive locale flags (optional)
+ PDWORD PtrFileDataId // Pointer to FileDataID (optional)
);
typedef void (*ROOT_ENDSEARCH)(
@@ -63,6 +64,11 @@ typedef void (*ROOT_CLOSE)(
struct TRootHandler * pRootHandler // Pointer to an initialized root handler
);
+typedef DWORD(*ROOT_GETFILEID)(
+struct TRootHandler * pRootHandler, // Pointer to an initialized root handler
+ const char * szFileName // Pointer to the name of a file
+ );
+
struct TRootHandler
{
ROOT_INSERT Insert; // Inserts an existing file name
@@ -71,6 +77,7 @@ struct TRootHandler
ROOT_GETKEY GetKey; // Retrieves encoding key for a file name
ROOT_DUMP Dump;
ROOT_CLOSE Close; // Closing the root file
+ ROOT_GETFILEID GetFileId; // Returns File Id for a given Filename
DWORD dwRootFlags; // Root flags - see the ROOT_FLAG_XXX
};
@@ -79,10 +86,11 @@ struct TRootHandler
// Public functions
int RootHandler_Insert(TRootHandler * pRootHandler, const char * szFileName, LPBYTE pbEncodingKey);
-LPBYTE RootHandler_Search(TRootHandler * pRootHandler, struct _TCascSearch * pSearch, PDWORD PtrFileSize, PDWORD PtrLocaleFlags);
+LPBYTE RootHandler_Search(TRootHandler * pRootHandler, struct _TCascSearch * pSearch, PDWORD PtrFileSize, PDWORD PtrLocaleFlags, PDWORD PtrFileDataId);
void RootHandler_EndSearch(TRootHandler * pRootHandler, struct _TCascSearch * pSearch);
LPBYTE RootHandler_GetKey(TRootHandler * pRootHandler, const char * szFileName);
void RootHandler_Dump(struct _TCascStorage * hs, LPBYTE pbRootHandler, DWORD cbRootHandler, const TCHAR * szNameFormat, const TCHAR * szListFile, int nDumpLevel);
void RootHandler_Close(TRootHandler * pRootHandler);
+DWORD RootHandler_GetFileId(TRootHandler * pRootHandler, const char * szFileName);
#endif // __ROOT_HANDLER_H__