| 760 | // SFileGetFileSize |
| 761 | |
| 762 | DWORD 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 | |
| 809 | DWORD STORMAPI SFileSetFilePointer(HANDLE hFile, LONG lFilePos, LONG * plFilePosHigh, DWORD dwMoveMethod) |
| 810 | { |
no test coverage detected