MCPcopy Create free account
hub / github.com/Scobalula/Greyhound / CascGetFileSize64

Function CascGetFileSize64

src/External/CascLib/src/CascReadFile.cpp:1065–1103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1063//
1064
1065bool WINAPI CascGetFileSize64(HANDLE hFile, PULONGLONG PtrFileSize)
1066{
1067 TCascFile * hf;
1068 DWORD dwErrCode;
1069
1070 // Validate the file pointer
1071 if(PtrFileSize == NULL)
1072 {
1073 SetCascError(ERROR_INVALID_PARAMETER);
1074 return false;
1075 }
1076
1077 // Validate the file handle
1078 if((hf = TCascFile::IsValid(hFile)) == NULL)
1079 {
1080 SetCascError(ERROR_INVALID_HANDLE);
1081 return false;
1082 }
1083
1084 // If the content key is zeros, we treat the file as a file with size of 0
1085 if(hf->ContentSize == 0)
1086 {
1087 PtrFileSize[0] = 0;
1088 return true;
1089 }
1090
1091 // ENCODING on older storages: Content size is not present in the BUILD file
1092 // For that reason, we need to query the content size from the file frames
1093 dwErrCode = EnsureFileSpanFramesLoaded(hf);
1094 if(dwErrCode != ERROR_SUCCESS)
1095 {
1096 SetCascError(dwErrCode);
1097 return false;
1098 }
1099
1100 // Give the file size to the caller
1101 PtrFileSize[0] = hf->ContentSize;
1102 return true;
1103}
1104
1105DWORD WINAPI CascGetFileSize(HANDLE hFile, PDWORD PtrFileSizeHigh)
1106{

Callers 3

Storage_SeekFilesFunction · 0.85
CascGetFileSizeFunction · 0.85
SizeMethod · 0.85

Calls 2

SetCascErrorFunction · 0.85

Tested by 1

Storage_SeekFilesFunction · 0.68