| 896 | } |
| 897 | |
| 898 | bool WINAPI CascImportKeysFromFile(HANDLE hStorage, LPCTSTR szFileName) |
| 899 | { |
| 900 | TFileStream * pFileStream; |
| 901 | ULONGLONG FileSize = 0; |
| 902 | LPSTR szKeyList; |
| 903 | bool bResult = false; |
| 904 | |
| 905 | // Open the file |
| 906 | if((pFileStream = FileStream_OpenFile(szFileName, STREAM_FLAG_READ_ONLY)) != NULL) |
| 907 | { |
| 908 | // Load the entire file to memory, up to 10 MB |
| 909 | if(FileStream_GetSize(pFileStream, &FileSize) && FileSize < 0xA00000) |
| 910 | { |
| 911 | DWORD FileSize32 = (DWORD)FileSize; |
| 912 | |
| 913 | // Allocate buffer for the key stream |
| 914 | if((szKeyList = CASC_ALLOC<char>(FileSize32 + 1)) != NULL) |
| 915 | { |
| 916 | // Read the entire file and terminate it with zero |
| 917 | FileStream_Read(pFileStream, NULL, szKeyList, FileSize32); |
| 918 | szKeyList[FileSize] = 0; |
| 919 | |
| 920 | // Import the buffer |
| 921 | bResult = CascImportKeysFromString(hStorage, szKeyList); |
| 922 | CASC_FREE(szKeyList); |
| 923 | } |
| 924 | } |
| 925 | else |
| 926 | SetCascError(ERROR_FILE_TOO_LARGE); |
| 927 | |
| 928 | FileStream_Close(pFileStream); |
| 929 | } |
| 930 | |
| 931 | return bResult; |
| 932 | } |
| 933 | |
| 934 | DWORD CascDirectCopy(LPBYTE pbOutBuffer, PDWORD pcbOutBuffer, LPBYTE pbInBuffer, DWORD cbInBuffer) |
| 935 | { |
nothing calls this directly
no test coverage detected