MCPcopy Create free account
hub / github.com/diasurgical/devilution / SFileGetFileSize

Function SFileGetFileSize

3rdParty/StormLib/src/SFileReadFile.cpp:762–807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

760// SFileGetFileSize
761
762DWORD STORMAPI SFileGetFileSize(HANDLE hFile, LPDWORD pdwFileSizeHigh)
763{
764 ULONGLONG FileSize;
765 TMPQFile * hf = (TMPQFile *)hFile;
766
767 // Validate the file handle before we go on
768 if(IsValidFileHandle(hFile))
769 {
770 // Make sure that the variable is initialized
771 FileSize = 0;
772
773 // If the file is patched file, we have to get the size of the last version
774 if(hf->hfPatch != NULL)
775 {
776 // Walk through the entire patch chain, take the last version
777 while(hf != NULL)
778 {
779 // Get the size of the currently pointed version
780 FileSize = hf->pFileEntry->dwFileSize;
781
782 // Move to the next patch file in the hierarchy
783 hf = hf->hfPatch;
784 }
785 }
786 else
787 {
788 // Is it a local file ?
789 if(hf->pStream != NULL)
790 {
791 FileStream_GetSize(hf->pStream, &FileSize);
792 }
793 else
794 {
795 FileSize = hf->dwDataSize;
796 }
797 }
798
799 // If opened from archive, return file size
800 if(pdwFileSizeHigh != NULL)
801 *pdwFileSizeHigh = (DWORD)(FileSize >> 32);
802 return (DWORD)FileSize;
803 }
804
805 SetLastError(ERROR_INVALID_HANDLE);
806 return SFILE_INVALID_SIZE;
807}
808
809DWORD STORMAPI SFileSetFilePointer(HANDLE hFile, LONG lFilePos, LONG * plFilePosHigh, DWORD dwMoveMethod)
810{

Callers 9

sound_file_loadFunction · 0.85
music_startFunction · 0.85
SFileDdaBeginExFunction · 0.85
SBmpLoadImageFunction · 0.85
SVidPlayBeginFunction · 0.85
WGetFileSizeFunction · 0.85
pfile_read_heroFunction · 0.85
pfile_readFunction · 0.85
SFileSetFilePointerFunction · 0.85

Calls 3

IsValidFileHandleFunction · 0.85
FileStream_GetSizeFunction · 0.85
SetLastErrorFunction · 0.85

Tested by

no test coverage detected