| 242 | } |
| 243 | |
| 244 | DWORD InsertAssetFile( |
| 245 | TCascStorage * hs, |
| 246 | CASC_FILE_TREE & FileTree, |
| 247 | char * szFileName, |
| 248 | size_t nPlainName, // Offset of the plain name in the name template |
| 249 | LPBYTE pbCKey, |
| 250 | LPBYTE pbGuid) |
| 251 | { |
| 252 | PCASC_CKEY_ENTRY pCKeyEntry; |
| 253 | DWORD dwErrCode = ERROR_SUCCESS; |
| 254 | BYTE GuidReversed[8]; |
| 255 | |
| 256 | // Try to find the CKey |
| 257 | if((pCKeyEntry = FindCKeyEntry_CKey(hs, pbCKey)) != NULL) |
| 258 | { |
| 259 | // Save the character at the end of the name (dot or EOS) |
| 260 | char chSaveChar = szFileName[nPlainName + 16]; |
| 261 | |
| 262 | // Imprint the GUID as binary value |
| 263 | BinaryReverse64(GuidReversed, pbGuid); |
| 264 | StringFromBinary(GuidReversed, sizeof(GuidReversed), szFileName + nPlainName); |
| 265 | szFileName[nPlainName + 16] = chSaveChar; |
| 266 | |
| 267 | // Insert the asset to the file tree |
| 268 | if(FileTree.InsertByName(pCKeyEntry, szFileName) == NULL) |
| 269 | dwErrCode = ERROR_NOT_ENOUGH_MEMORY; |
| 270 | } |
| 271 | return dwErrCode; |
| 272 | } |
| 273 | |
| 274 | //----------------------------------------------------------------------------- |
| 275 | // Handler definition for OVERWATCH root file |
no test coverage detected