IAPEDecompress * __stdcall CreateIAPEDecompressEx2(CAPEInfo * pAPEInfo, int nStartBlock, int nFinishBlock, int * pErrorCode) { int nErrorCode = ERROR_SUCCESS; IAPEDecompress * pAPEDecompress = CreateIAPEDecompressCore(pAPEInfo, nStartBlock, nFinishBlock, &nErrorCode); if (pErrorCode) *pErrorCode = nErrorCode; return pAPEDecompress; }
IAPEDecompress * __stdcall CreateIAPEDecompressEx(CIO * pIO, int * pErrorCode) { int nErrorCode = ERROR_UNDEFINED; CAPEInfo * pAPEInfo = new CAPEInfo(&nErrorCode, pIO); IAPEDecompress * pAPEDecompress = CreateIAPEDecompressCore(pAPEInfo, -1, -1, &nErrorCode); if (pErrorCode) *pErrorCode = nErrorCode; return pAPEDecompress; }
IAPEDecompress * __stdcall CreateIAPEDecompress(const str_utf16 * pFilename, int * pErrorCode) { // error check the parameters if ((pFilename == NULL) || (wcslen(pFilename) == 0)) { if (pErrorCode) *pErrorCode = ERROR_BAD_PARAMETER; return NULL; } // variables int nErrorCode = ERROR_UNDEFINED; CAPEInfo * pAPEInfo = NULL; int nStartBlock = -1; int nFinishBlock = -1; // get the extension const str_utf16 * pExtension = &pFilename[wcslen(pFilename)]; while ((pExtension > pFilename) && (*pExtension != '.')) pExtension--; // take the appropriate action (based on the extension) if (wcsicmp(pExtension, L".apl") == 0) { // "link" file (.apl linked large APE file) CAPELink APELink(pFilename); if (APELink.GetIsLinkFile()) { pAPEInfo = new CAPEInfo(&nErrorCode, APELink.GetImageFilename(), new CAPETag(pFilename, TRUE)); nStartBlock = APELink.GetStartBlock(); nFinishBlock = APELink.GetFinishBlock(); } } else if ((wcsicmp(pExtension, L".mac") == 0) || (wcsicmp(pExtension, L".ape") == 0)) { // plain .ape file pAPEInfo = new CAPEInfo(&nErrorCode, pFilename); } // fail if we couldn't get the file information if (pAPEInfo == NULL) { if (pErrorCode) *pErrorCode = ERROR_INVALID_INPUT_FILE; return NULL; } // create and return IAPEDecompress * pAPEDecompress = CreateIAPEDecompressCore(pAPEInfo, nStartBlock, nFinishBlock, &nErrorCode); if (pErrorCode) *pErrorCode = nErrorCode; return pAPEDecompress; }