diff -b -B -r -d -u SDN-Makesis-srcrelApr03/appinst/inc/INSTFORM.H SDN-Makesis-srcrelApr03-patchedOct03/appinst/inc/INSTFORM.H --- SDN-Makesis-srcrelApr03/appinst/inc/INSTFORM.H Tue Apr 15 16:39:08 2003 +++ SDN-Makesis-srcrelApr03-patchedOct03/appinst/inc/INSTFORM.H Thu Oct 30 14:10:35 2003 @@ -84,6 +84,7 @@ enum TInstFileType { EInstFileTypeSimple = 0, // Simple file to be copied to destination + EInstFileTypeDir, // Folder to be copied to destination EInstFileTypeText, // Text file to be displayed (and discarded) EInstFileTypeComponent, // Component file to be installed EInstFileTypeRun, // File to be run (and discarded) diff -b -B -r -d -u SDN-Makesis-srcrelApr03/appinst/makesis/CRTSIS.CPP SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis/CRTSIS.CPP --- SDN-Makesis-srcrelApr03/appinst/makesis/CRTSIS.CPP Mon Apr 28 17:51:38 2003 +++ SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis/CRTSIS.CPP Thu Oct 30 19:20:20 2003 @@ -406,7 +406,7 @@ // Returns : Success or failure (actually TRUE or throws an EGeneratorException { m_hFile = ::MakeSISOpenFile(pszTargetFile, GENERIC_WRITE, CREATE_ALWAYS); - if(m_hFile == INVALID_HANDLE_VALUE) throw ErrCannotWriteFile; + if(m_hFile == INVALID_HANDLE_VALUE) STUPID_THROW( ErrCannotWriteFile ) m_stubFile=fIsStub; // convert any text files to unicode if necessary if (SizeOfChar()!=1 && !m_stubFile) CheckUnicodeTextFiles(); @@ -486,11 +486,11 @@ m_pSISWriter->GetObserver()->DoErrMsg(fName); delete [] fName; #endif - throw excp; + STUPID_THROW( excp ) } HANDLE hInFile = ::MakeSISOpenFile(pNode->file->pszSource, GENERIC_READ, OPEN_EXISTING); if(hInFile == INVALID_HANDLE_VALUE) - throw ErrCannotOpenFile; + STUPID_THROW( ErrCannotOpenFile ) if (converted) pNode->file->dwSize=::GetFileSize(hInFile, NULL); ::CloseHandle(hInFile); } @@ -585,18 +585,18 @@ if (m_bWriteChain) { hInFile = ::MakeSISOpenFile(pSignature->pszChainFile, GENERIC_READ, OPEN_EXISTING); - if (hInFile == INVALID_HANDLE_VALUE) throw ErrCannotOpenFile; + if (hInFile == INVALID_HANDLE_VALUE) STUPID_THROW( ErrCannotOpenFile ) } else { //write certificate verbatim hInFile = ::MakeSISOpenFile(pSignature->pszB64File, GENERIC_READ, OPEN_EXISTING); - if (hInFile == INVALID_HANDLE_VALUE) throw ErrCannotOpenFile; + if (hInFile == INVALID_HANDLE_VALUE) STUPID_THROW( ErrCannotOpenFile ) } size=::GetFileSize(hInFile, NULL) + sizeof (TInstCertBlock); ::CloseHandle(hInFile); - if (size==0xFFFFFFFF) throw ErrCannotOpenFile; + if (size==0xFFFFFFFF) STUPID_THROW( ErrCannotOpenFile ) } #endif m_dwOffCapabilities = m_dwOffCertificates+size; @@ -824,7 +824,7 @@ // Write the buffer DWORD dwNumBytes; if(!::WriteFile(m_hFile, (LPVOID)&iiHead, sizeof(TInstInstallation), &dwNumBytes, NULL)) - throw ErrFailedToWriteHeader; + STUPID_THROW( ErrFailedToWriteHeader ) m_dwCurrCode = m_dwOffCode; @@ -841,7 +841,7 @@ DWORD dwLangCount = m_pSISWriter->GetNoLanguages(); const LANGNODE *pLNode = m_pSISWriter->GetLanguageBase(); WORD *pLang = new WORD[dwLangCount]; - if (!pLang) throw ErrNotEnoughMemory; + if (!pLang) STUPID_THROW( ErrNotEnoughMemory ) WORD wCount = 0; while(pLNode) @@ -852,7 +852,7 @@ DWORD dwNumBytes; if(!::WriteFile(m_hFile, (LPVOID)pLang, sizeof(WORD) * dwLangCount, &dwNumBytes, NULL)) - throw ErrFailedToWriteLanguages; + STUPID_THROW( ErrFailedToWriteLanguages ) Crc((void *)pLang, sizeof(WORD) * dwLangCount); @@ -871,7 +871,7 @@ { // write type if(!::WriteFile(m_hFile, (LPVOID)&pNode->iPackageLineType, sizeof(TInstPackageLineType), &dwNumBytes, NULL)) - throw ErrFailedToWriteFilesBlock; + STUPID_THROW( ErrFailedToWriteFilesBlock ) Crc((void *)&pNode->iPackageLineType, sizeof(TInstPackageLineType)); // write specific PKG node data switch (pNode->iPackageLineType) @@ -899,7 +899,7 @@ DWORD stringSizes; DWORD size=CalcConditionExprSize(pNode->cond, &stringSizes); if(!::WriteFile(m_hFile, (LPVOID)&size, sizeof(DWORD), &dwNumBytes, NULL)) - throw ErrFailedToWriteFilesBlock; + STUPID_THROW( ErrFailedToWriteFilesBlock ) Crc((void *)&size, sizeof(DWORD)); WriteConditionNodeL(pNode); } @@ -923,7 +923,7 @@ ConfigureFileNode(pFNode, &ifFile); if(!::WriteFile(m_hFile, (LPVOID)&ifFile, sizeof(ifFile), &dwNumBytes, NULL)) - throw ErrFailedToWriteFilesBlock; + STUPID_THROW( ErrFailedToWriteFilesBlock ) // CRC Crc((void *)&ifFile, sizeof(ifFile)); @@ -938,7 +938,7 @@ while(pNode && (wNumLang < wMaxLangs)) { if (!::WriteFile(m_hFile, (LPVOID)&pNode->file->dwSize, sizeof(DWORD), &dwNumBytes, NULL)) - throw ErrFailedToWriteFilesBlock; + STUPID_THROW( ErrFailedToWriteFilesBlock ) // CRC Crc((void *)&pNode->file->dwSize, sizeof(DWORD)); @@ -953,7 +953,7 @@ while(pNode && (wNumLang < wMaxLangs)) { if(!::WriteFile(m_hFile, (LPVOID)&m_dwCurrCode, sizeof(DWORD), &dwNumBytes, NULL)) - throw ErrFailedToWriteFilesBlock; + STUPID_THROW( ErrFailedToWriteFilesBlock ) // CRC Crc((void *)&m_dwCurrCode, sizeof(DWORD)); @@ -969,7 +969,7 @@ { if (!::WriteFile(m_hFile, (LPVOID)&pNode->file->dwUncompressedSize, sizeof(DWORD), &dwNumBytes, NULL)) - throw ErrFailedToWriteFilesBlock; + STUPID_THROW( ErrFailedToWriteFilesBlock ) Crc((void *)&pNode->file->dwUncompressedSize, sizeof(DWORD)); @@ -983,7 +983,7 @@ mimeType.iStringPtr=m_dwCurrString; m_dwCurrString += mimeType.iCount; if (!::WriteFile(m_hFile, (LPVOID)&mimeType, sizeof(TInstString), &dwNumBytes, NULL)) - throw ErrFailedToWriteFilesBlock; + STUPID_THROW( ErrFailedToWriteFilesBlock ) Crc((void *)&mimeType, sizeof(TInstString)); } @@ -1015,7 +1015,7 @@ const PKGLINEOPTIONS* pONode=pNode->option; DWORD dwNumOptions=pONode->dwNumOptions; if (!::WriteFile(m_hFile, (LPVOID)&dwNumOptions, sizeof(DWORD), &dwNumBytes, NULL)) - throw ErrFailedToWriteOptionsBlock; + STUPID_THROW( ErrFailedToWriteOptionsBlock ) // CRC Crc((void *)&dwNumOptions, sizeof(DWORD)); const LANGSTRINGNODE *pLSNode = pONode->pLangStringBase; @@ -1026,7 +1026,7 @@ { dwLength = wcslen(pLSNode->pszString) * SizeOfChar(); if(!::WriteFile(m_hFile, (LPVOID)&dwLength, sizeof(DWORD), &dwNumBytes, NULL)) - throw ErrFailedToWriteOptionsBlock; + STUPID_THROW( ErrFailedToWriteOptionsBlock ) // CRC Crc((void *)&dwLength, sizeof(DWORD)); pLSNode = pLSNode->pNext; @@ -1035,7 +1035,7 @@ for(j=0;jGetNoLanguages();j++) { if(!::WriteFile(m_hFile, (LPVOID)&m_dwCurrString, sizeof(DWORD), &dwNumBytes, NULL)) - throw ErrFailedToWriteOptionsBlock; + STUPID_THROW( ErrFailedToWriteOptionsBlock ) // CRC Crc((void *)&m_dwCurrString, sizeof(DWORD)); m_dwCurrString += wcslen(pLSNode->pszString) * SizeOfChar(); @@ -1047,7 +1047,7 @@ for (i=0;iexprType; if(!WriteFile(m_hFile, (LPVOID)&iceExpr, sizeof(TInstCondExpr), &dwNumBytes, NULL)) - throw ErrFailedToWriteConditionBlock; + STUPID_THROW( ErrFailedToWriteConditionBlock ) // CRC Crc((void *)&iceExpr, sizeof(TInstCondExpr)); switch (expr->exprType) @@ -1104,7 +1104,7 @@ prim.iString.iStringPtr = m_dwCurrString; m_dwCurrString += prim.iString.iCount; if(!WriteFile(m_hFile, (LPVOID)&prim, sizeof(TInstCondPrim), &dwNumBytes, NULL)) - throw ErrFailedToWriteConditionBlock; + STUPID_THROW( ErrFailedToWriteConditionBlock ) // CRC Crc((void *)&prim, sizeof(TInstCondPrim)); } @@ -1114,7 +1114,7 @@ { prim.iNumber=expr->pPrim->dwNumber; if(!WriteFile(m_hFile, (LPVOID)&prim, sizeof(TInstCondPrim), &dwNumBytes, NULL)) - throw ErrFailedToWriteConditionBlock; + STUPID_THROW( ErrFailedToWriteConditionBlock ) // CRC Crc((void *)&prim, sizeof(TInstCondPrim)); } @@ -1143,7 +1143,7 @@ DWORD dwNumBytes; if(!WriteFile(m_hFile, (LPVOID)&idDepend, sizeof(TInstDependency), &dwNumBytes, NULL)) - throw ErrFailedToWriteDependencyBlock; + STUPID_THROW( ErrFailedToWriteDependencyBlock ) // CRC Crc((void *)&idDepend, sizeof(idDepend)); @@ -1156,7 +1156,7 @@ DWORD dwNumBytes; if(!::WriteFile(m_hFile, (LPVOID)&dwLength, sizeof(DWORD), &dwNumBytes, NULL)) - throw ErrFailedToWriteDependencyBlock; + STUPID_THROW( ErrFailedToWriteDependencyBlock ) // CRC Crc((void *)&dwLength, sizeof(DWORD)); @@ -1168,7 +1168,7 @@ { DWORD dwNumBytes; if(!::WriteFile(m_hFile, (LPVOID)&m_dwCurrString, sizeof(DWORD), &dwNumBytes, NULL)) - throw ErrFailedToWriteDependencyBlock; + STUPID_THROW( ErrFailedToWriteDependencyBlock ) // CRC Crc((void *)&m_dwCurrString, sizeof(DWORD)); @@ -1200,7 +1200,7 @@ { //open certificate chain hInFile = ::MakeSISOpenFile(pSignature->pszChainFile, GENERIC_READ, OPEN_EXISTING); - if(hInFile == INVALID_HANDLE_VALUE) throw ErrCannotOpenFile; + if(hInFile == INVALID_HANDLE_VALUE) STUPID_THROW( ErrCannotOpenFile ) } @@ -1210,13 +1210,13 @@ { //open public key file (pre-converted from Base64) hInFile = ::MakeSISOpenFile(pSignature->pszB64File, GENERIC_READ, OPEN_EXISTING); - if(hInFile == INVALID_HANDLE_VALUE) throw ErrCannotOpenFile; + if(hInFile == INVALID_HANDLE_VALUE) STUPID_THROW( ErrCannotOpenFile ) } dwFileSize = ::GetFileSize(hInFile, NULL); - if (dwFileSize==0xFFFFFFFF) throw ErrCannotOpenFile; + if (dwFileSize==0xFFFFFFFF) STUPID_THROW( ErrCannotOpenFile ) TInstCertBlock CertBlock; @@ -1247,7 +1247,7 @@ pBuf = new BYTE[dwFileSize + sizeof (TInstCertBlock)]; - if (!pBuf) throw ErrNotEnoughMemory; + if (!pBuf) STUPID_THROW( ErrNotEnoughMemory ) memcpy(pBuf, (LPVOID)&CertBlock, sizeof (TInstCertBlock)); @@ -1255,10 +1255,10 @@ if(!::ReadFile(hInFile, (LPVOID)pBuf2, dwFileSize, &dwNumBytes, NULL)) - throw ErrCannotReadFile; + STUPID_THROW( ErrCannotReadFile ) if(!::WriteFile(m_hFile, (LPVOID)pBuf, dwFileSize + sizeof (TInstCertBlock), &dwNumBytes, NULL)) - throw ErrFailedToWriteCertificatesBlock; + STUPID_THROW( ErrFailedToWriteCertificatesBlock ) // CRC Crc((void *)pBuf, dwNumBytes); @@ -1285,7 +1285,7 @@ DWORD dwNumBytes; if(!WriteFile(m_hFile, (LPVOID)&idCapability, sizeof(TInstCapability), &dwNumBytes, NULL)) - throw ErrFailedToWriteCapabilitiesBlock; + STUPID_THROW( ErrFailedToWriteCapabilitiesBlock ) // CRC Crc((void *)&idCapability, sizeof(TInstCapability)); @@ -1307,7 +1307,7 @@ DWORD* pdwPos = new DWORD [dwCount]; DWORD i = 0; - if (!pdwLength || !pdwPos) throw ErrNotEnoughMemory; + if (!pdwLength || !pdwPos) STUPID_THROW( ErrNotEnoughMemory ) while(pLSNode) { @@ -1320,11 +1320,11 @@ DWORD dwNumBytes; if(!::WriteFile(m_hFile, (LPVOID)pdwLength, dwCount * sizeof(DWORD), &dwNumBytes, NULL)) - throw ErrFailedToWriteStringsBlock; + STUPID_THROW( ErrFailedToWriteStringsBlock ) Crc((void *)pdwLength, sizeof(DWORD) * dwCount); if(!::WriteFile(m_hFile, (LPVOID)pdwPos, dwCount * sizeof(DWORD), &dwNumBytes, NULL)) - throw ErrFailedToWriteStringsBlock; + STUPID_THROW( ErrFailedToWriteStringsBlock ) Crc((void *)pdwPos, sizeof(DWORD) * dwCount); // Put PKG lines strings ---------------------------------------------------------------- @@ -1451,17 +1451,17 @@ { HANDLE hInFile = ::MakeSISOpenFile(pNode->file->pszSource, GENERIC_READ, OPEN_EXISTING); if(hInFile == INVALID_HANDLE_VALUE) - throw ErrCannotOpenFile; + STUPID_THROW( ErrCannotOpenFile ) BYTE *pBuf = new BYTE[pNode->file->dwSize]; - if (!pBuf) throw ErrNotEnoughMemory; + if (!pBuf) STUPID_THROW( ErrNotEnoughMemory ) DWORD dwNumBytes; if(!::ReadFile(hInFile, (LPVOID)pBuf, pNode->file->dwSize, &dwNumBytes, NULL)) - throw ErrCannotReadFile; + STUPID_THROW( ErrCannotReadFile ) if(!::WriteFile(m_hFile, (LPVOID)pBuf, pNode->file->dwSize, &dwNumBytes, NULL)) - throw ErrCannotWriteFile; + STUPID_THROW( ErrCannotWriteFile ) // CRC Crc((void *)pBuf, pNode->file->dwSize); @@ -1478,11 +1478,11 @@ Verbage(_T("Writing crc")); if(::SetFilePointer(m_hFile, sizeof(TInstUID) + sizeof(DWORD), NULL, FILE_BEGIN) == 0xFFFFFFFF) - throw ErrFailedToWriteCRC; + STUPID_THROW( ErrFailedToWriteCRC ) DWORD dwNumBytes; if(!::WriteFile(m_hFile, (LPVOID)&m_wCheck, sizeof(WORD), &dwNumBytes, NULL)) - throw ErrFailedToWriteCRC; + STUPID_THROW( ErrFailedToWriteCRC ) } void CSISFileGeneratorBase::WriteSignatureL(LPCWSTR pszTargetFile) @@ -1523,13 +1523,13 @@ CPrivateKey* pKey = new CPrivateKey; - if (!pKey) throw ErrNotEnoughMemory; + if (!pKey) STUPID_THROW( ErrNotEnoughMemory ) pKey->LoadKey(fName, pszPassword); if (pKey->Loaded() == FALSE) { - throw ErrCannotOpenFile; + STUPID_THROW( ErrCannotOpenFile ) } @@ -1537,7 +1537,7 @@ CHash* pHash = NULL; pHash = new CSHA1; - if (!pHash) throw ErrNotEnoughMemory; + if (!pHash) STUPID_THROW( ErrNotEnoughMemory ) char hash[HASHLEN]; @@ -1556,7 +1556,7 @@ if (pKey->KeyType() == EDSAPrivateKey) { pHash = new CDSA; - if (!pHash) throw ErrNotEnoughMemory; + if (!pHash) STUPID_THROW( ErrNotEnoughMemory ) pHash->SetKey(pKey->GetKeyPtr()); // hash will contain the computed SHA-1 signed by DSA @@ -1566,7 +1566,7 @@ // encrypt hash to create digital signature CEncrypt* crypto = new CEncrypt; - if (!crypto) throw ErrNotEnoughMemory; + if (!crypto) STUPID_THROW( ErrNotEnoughMemory ) char ciphertext[CIPHERTEXTLEN]; @@ -1584,7 +1584,7 @@ pHash->HexStringToBytes(hash, string2char); if (!crypto->Encrypt(string2char, (unsigned char*)ciphertext, fName, pszPassword, &KeyLen, &ciphertype)) - throw ErrCannotOpenFile; + STUPID_THROW( ErrCannotOpenFile ) } delete [] pszPassword; @@ -1594,10 +1594,10 @@ // now read in unsigned SIS file & write out new SIS file with appended signature HANDLE hSISFile = ::MakeSISOpenFile(pszTargetFile, GENERIC_READ, OPEN_EXISTING); - if(hSISFile == INVALID_HANDLE_VALUE) throw ErrCannotOpenFile; + if(hSISFile == INVALID_HANDLE_VALUE) STUPID_THROW( ErrCannotOpenFile ) // double check file size is as expected - if (TargetLen != ::GetFileSize(hSISFile, NULL)) throw ErrFailedToWriteSignatureBlock; + if (TargetLen != ::GetFileSize(hSISFile, NULL)) STUPID_THROW( ErrFailedToWriteSignatureBlock ) if (pKey->KeyType() == EDSAPrivateKey) { @@ -1605,11 +1605,11 @@ } unsigned char* pFileBuf = new unsigned char[TargetLen + KeyLen]; - if (!pFileBuf) throw ErrNotEnoughMemory; + if (!pFileBuf) STUPID_THROW( ErrNotEnoughMemory ) DWORD dwNumBytes; if(!::ReadFile(hSISFile, (LPVOID)pFileBuf, TargetLen, &dwNumBytes, NULL)) - throw ErrCannotReadFile; + STUPID_THROW( ErrCannotReadFile ) ::CloseHandle(hSISFile); @@ -1632,10 +1632,10 @@ //write new SIS file to disk (hash is now appended) HANDLE hOutFile = ::MakeSISOpenFile(pszTargetFile, GENERIC_WRITE, OPEN_EXISTING); - if(hOutFile == INVALID_HANDLE_VALUE) throw ErrCannotOpenFile; + if(hOutFile == INVALID_HANDLE_VALUE) STUPID_THROW( ErrCannotOpenFile ) if(!::WriteFile(hOutFile, (LPVOID)pFileBuf, TargetLen + KeyLen, &dwNumBytes, NULL)) - throw ErrCannotWriteFile; + STUPID_THROW( ErrCannotWriteFile ) ::CloseHandle(hOutFile); @@ -1685,7 +1685,7 @@ CPrivateKey* pKey = new CPrivateKey; - if (!pKey) throw ErrNotEnoughMemory; + if (!pKey) STUPID_THROW( ErrNotEnoughMemory ) pKey->LoadKey(fName, pszPassword); @@ -1694,7 +1694,7 @@ if (pKey->Loaded() == FALSE) { - throw ErrCannotOpenFile; + STUPID_THROW( ErrCannotOpenFile ) } else { @@ -1833,11 +1833,11 @@ if (pNode->file->type == EInstFileTypeComponent) { HANDLE hFile = ::MakeSISOpenFile(pNode->file->pszSource,GENERIC_READ, OPEN_EXISTING); - if (hFile==INVALID_HANDLE_VALUE) throw ErrCannotOpenFile; + if (hFile==INVALID_HANDLE_VALUE) STUPID_THROW( ErrCannotOpenFile ) TInstInstallation header; DWORD dwBytesRead; if (!::ReadFile(hFile,(LPVOID) &header,sizeof(TInstInstallation),&dwBytesRead,NULL)) - throw ErrCannotReadFile; + STUPID_THROW( ErrCannotReadFile ) ::CloseHandle(hFile); spaceNeeded = header.iMaximumSpaceNeeded; } @@ -1894,11 +1894,11 @@ BOOL zlibInit = FALSE; hUncompressedFile = ::MakeSISOpenFile(pNode->file->pszSource, GENERIC_READ, OPEN_EXISTING); - if(hUncompressedFile == INVALID_HANDLE_VALUE) throw ErrCannotOpenFile; + if(hUncompressedFile == INVALID_HANDLE_VALUE) STUPID_THROW( ErrCannotOpenFile ) dwUncompressedFileSize = ::GetFileSize(hUncompressedFile, NULL); hCompressedFile = ::MakeSISOpenFile(pszOutputFname, GENERIC_WRITE|GENERIC_READ, CREATE_NEW); - if (hCompressedFile==INVALID_HANDLE_VALUE) throw ErrCannotOpenFile; + if (hCompressedFile==INVALID_HANDLE_VALUE) STUPID_THROW( ErrCannotOpenFile ) BYTE *pbInputBuffer = new BYTE [bufferSize]; BYTE *pbOutputBuffer = new BYTE [bufferSize]; @@ -1906,7 +1906,7 @@ try { - if (!pbOutputBuffer || !pbInputBuffer) throw ErrNotEnoughMemory; + if (!pbOutputBuffer || !pbInputBuffer) STUPID_THROW( ErrNotEnoughMemory ) compressionState.zalloc = NULL; compressionState.zfree = NULL; @@ -1917,7 +1917,7 @@ zlibInit = TRUE; zlibErr = deflateInit(&compressionState,Z_DEFAULT_COMPRESSION); - if (zlibErr != Z_OK) throw ErrFailedCompression; + if (zlibErr != Z_OK) STUPID_THROW( ErrFailedCompression ) while ((zlibErr = deflate(&compressionState,Z_NO_FLUSH)) == Z_OK) { @@ -1936,7 +1936,7 @@ if (compressionState.avail_out == 0) WriteToCompressedFile(hCompressedFile, pbOutputBuffer,compressionState, bufferSize); } - if (zlibErr != Z_STREAM_END) throw ErrFailedCompression; + if (zlibErr != Z_STREAM_END) STUPID_THROW( ErrFailedCompression ) WriteToCompressedFile(hCompressedFile, pbOutputBuffer,compressionState, bufferSize); } catch(...) @@ -1969,7 +1969,7 @@ compressionState.avail_in = dwNumBytes; } else - throw ErrCannotReadFile; + STUPID_THROW( ErrCannotReadFile ) } void CSISFileGeneratorBase::WriteToCompressedFile(HANDLE hFile,BYTE *pbBuffer,z_stream &compressionState, int bufferSize) @@ -1981,7 +1981,7 @@ compressionState.avail_out = dwNumBytes; } else - throw ErrCannotWriteFile; + STUPID_THROW( ErrCannotWriteFile ) } // =========================================================================== @@ -1999,7 +1999,7 @@ long len = wcslen(pStr); T* buf = new T[len + 1]; - if (!buf) throw ErrNotEnoughMemory; + if (!buf) STUPID_THROW( ErrNotEnoughMemory ) for(int i = 0; i < len; ++i) buf[i] = (T)pStr[i]; @@ -2007,7 +2007,7 @@ // And write it to the file DWORD dwNumBytes; if(!::WriteFile(hFile, (LPVOID)buf, len * sizeof(T), &dwNumBytes, NULL)) - throw ErrFailedToWriteStringsBlock; + STUPID_THROW( ErrFailedToWriteStringsBlock ) // CRC Crc((void *)buf, len * sizeof(T)); @@ -2025,7 +2025,7 @@ long len = wcslen(pStr); char* buf = new char[len + 1]; - if (!buf) throw ErrNotEnoughMemory; + if (!buf) STUPID_THROW( ErrNotEnoughMemory ) for(int i = 0; i < len; ++i) buf[i] = (char)pStr[i]; @@ -2033,7 +2033,7 @@ // And write it to the file DWORD dwNumBytes; if(!::WriteFile(hFile, (LPVOID)buf, len, &dwNumBytes, NULL)) - throw ErrFailedToWriteStringsBlock; + STUPID_THROW( ErrFailedToWriteStringsBlock ) // CRC Crc((void *)buf, len); @@ -2083,7 +2083,7 @@ //create our PKCS7 aware object CPKCS7* pPKCS7 = new CPKCS7; - if (!pPKCS7) throw ErrNotEnoughMemory; + if (!pPKCS7) STUPID_THROW( ErrNotEnoughMemory ) status = pPKCS7->ConvertSigned(fNameCrt, fNameTmp); //status = pPKCS7->ConvertBase64(fNameCrt, fNameTmp); @@ -2117,7 +2117,7 @@ } if (!keyMatchesCert) - throw ErrCertFileKeyFileMismatch; + STUPID_THROW( ErrCertFileKeyFileMismatch ) delete pKey; delete pPKCS7; @@ -2125,7 +2125,7 @@ //create a Base64 convertor object CB64Decrypt* pB64 = new CB64Decrypt; - if (!pB64) throw ErrNotEnoughMemory; + if (!pB64) STUPID_THROW( ErrNotEnoughMemory ) if (m_bWriteChain) { Only in SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis: Filedirent.h diff -b -B -r -d -u SDN-Makesis-srcrelApr03/appinst/makesis/MAKESIS.CPP SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis/MAKESIS.CPP --- SDN-Makesis-srcrelApr03/appinst/makesis/MAKESIS.CPP Tue Apr 15 16:06:38 2003 +++ SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis/MAKESIS.CPP Thu Oct 30 14:27:25 2003 @@ -23,12 +23,12 @@ // Set up the cout stream so that we can use it with either narrow or wide // chars at build time using namespace std; -#undef OUT // coz it's an IDL thing... +#undef STUPID_OUT // coz it's an IDL thing... #ifdef _UNICODE -#define OUT wcout +#define STUPID_OUT wcout #else -#define OUT cout +#define STUPID_OUT cout #endif // =========================================================================== @@ -68,11 +68,11 @@ { LPCWSTR fileNameU=m_CmdOptions.TargetFile(); #ifdef _UNICODE - OUT << _T("Created ") << fileNameU << endl; + STUPID_OUT << _T("Created ") << fileNameU << endl; #else DWORD len=wcslen(fileNameU); LPSTR fileName=MakeMBCSString(fileNameU,CP_ACP,len); - OUT << _T("Created ") << fileName << endl; + STUPID_OUT << _T("Created ") << fileName << endl; #endif err=0; } @@ -102,11 +102,11 @@ HANDLE hFile=0; #ifdef _UNICODE - OUT << _T("Processing ") << m_CmdOptions.SourceFile() << _T("...") << endl; + STUPID_OUT << _T("Processing ") << m_CmdOptions.SourceFile() << _T("...") << endl; #else DWORD length=wcslen(m_CmdOptions.SourceFile()); LPSTR fName=MakeMBCSString(m_CmdOptions.SourceFile(), CP_ACP, length); - OUT << _T("Processing ") << fName << _T("...") << endl; + STUPID_OUT << _T("Processing ") << fName << _T("...") << endl; delete [] fName; #endif @@ -132,7 +132,7 @@ { hFile = ::MakeSISOpenFile(m_CmdOptions.SourceFile(),GENERIC_READ,OPEN_EXISTING); } - if (hFile==INVALID_HANDLE_VALUE) throw ErrCannotOpenFile; + if (hFile==INVALID_HANDLE_VALUE) STUPID_THROW( ErrCannotOpenFile ) // Set the search path if(m_CmdOptions.Flags() & CParseCmd::EOptDirectory) psr.SetSearchDirectory(m_CmdOptions.SearchPath()); @@ -185,13 +185,13 @@ minor = KInstallerVersion % 100; // Show the title - OUT << endl << _T("MakeSIS, version ") << major << _T(".") << minor << endl; - OUT << _T("A utility for creating Software Installation (SIS) files.") << endl; + STUPID_OUT << endl << _T("MakeSIS, version ") << major << _T(".") << minor << endl; + STUPID_OUT << _T("A utility for creating Software Installation (SIS) files.") << endl; #ifdef _DEBUG - OUT << _T("Development Version") << endl; + STUPID_OUT << _T("Development Version") << endl; #endif - OUT << _T("Copyright (c) 2000 Symbian Ltd. All rights reserved.") << endl; - OUT << endl; + STUPID_OUT << _T("Copyright (c) 2000 Symbian Ltd. All rights reserved.") << endl; + STUPID_OUT << endl; } void CMakeSIS::ShowUtilsError(TUtilsException err) @@ -237,42 +237,42 @@ break; case ErrUnknownLanguagesId: DoErrMsg(_T("unknown language specified")); - OUT << _T(" Usage : &aa,bb,...zz") << endl; - OUT << _T(" AF - Afrikaans, SQ - Albanian, AH - Amharic") << endl; - OUT << _T(" AR - Arabic, HY - Armenian, AU - Australian") << endl; - OUT << _T(" AS - Austrian, BE - Belarussian, BN - Bengali")<< endl; - OUT << _T(" BG - Bulgarian, MY - Burmese, CA - Catalan") << endl; - OUT << _T(" TC - Taiwan Chinese, HK - Hong Kong Chinese")<< endl; - OUT << _T(" ZH - PRC Chinese")<< endl; - OUT << _T(" HR - Croatian, CS - Czech, DA - Danish, DU - Dutch") << endl; - OUT << _T(" EN - English, AM - American English, CE - Canadian English")<< endl; - OUT << _T(" IE - International English, SF - South African English") << endl; - OUT << _T(" ET - Estonian, FA - Farsi, FI - Finnish, BL - Belgian Flemish") << endl; - OUT << _T(" FR - French, BF - Belgian French, CF - Canadian French")<< endl; - OUT << _T(" IF - International French, SF - Swiss French")<< endl; - OUT << _T(" GD - Scots Gaelic, KA - Georgian, GE - German") << endl; - OUT << _T(" SG - Swiss German, EL - Greek, GU - Gujarati")<< endl; - OUT << _T(" HE - Hebrew, HI - Hindi, HU - Hungarian") << endl; - OUT << _T(" IC - Icelandic, IN - Indonesian, GA - Irish")<< endl; - OUT << _T(" IT - Italian, SZ - Swiss Italian, JA - Japanese, ") << endl; - OUT << _T(" KN - Kannada, KK - Kazakh, KM - Khmer")<< endl; - OUT << _T(" KO - Korean, LO - Laothian, LV - Latvian") << endl; - OUT << _T(" LT - Lithuanian, MK - Macedonian, MS - Malay") << endl; - OUT << _T(" ML - Malayalam, MR - Marathi, MO - Moldovian") << endl; - OUT << _T(" MN - Mongolian, NZ - New Zealand, NO - Norwegian") << endl; - OUT << _T(" NN - Norwegian Nynorsk, PL - Polish, PO - Portuguese")<< endl; - OUT << _T(" BP - Brazilian Portuguese, PA - Punjabi, RO - Romanian") << endl; - OUT << _T(" RU - Russian, SR - Serbian, SI - Sinhalese") << endl; - OUT << _T(" SK - Slovak, SL - Slovenian, SO - Somali")<< endl; - OUT << _T(" SP - Spanish, OS - International Spanish") << endl; - OUT << _T(" LS - Latin American Spanish")<< endl; - OUT << _T(" SH - Swahili, SW - Swedish, FS - Finland Swedish") << endl; - OUT << _T(" TL - Tagalog, TA - Tamil, TE - Telugu, TH - Thai") << endl; - OUT << _T(" BO - Tibetan, TI - Tigrinya, TU - Turkish")<< endl; - OUT << _T(" CT - Cyprus Turkish, TK - Turkmen, UK - Ukrainian") << endl; - OUT << _T(" UR - Urdu") << endl; + STUPID_OUT << _T(" Usage : &aa,bb,...zz") << endl; + STUPID_OUT << _T(" AF - Afrikaans, SQ - Albanian, AH - Amharic") << endl; + STUPID_OUT << _T(" AR - Arabic, HY - Armenian, AU - Australian") << endl; + STUPID_OUT << _T(" AS - Austrian, BE - Belarussian, BN - Bengali")<< endl; + STUPID_OUT << _T(" BG - Bulgarian, MY - Burmese, CA - Catalan") << endl; + STUPID_OUT << _T(" TC - Taiwan Chinese, HK - Hong Kong Chinese")<< endl; + STUPID_OUT << _T(" ZH - PRC Chinese")<< endl; + STUPID_OUT << _T(" HR - Croatian, CS - Czech, DA - Danish, DU - Dutch") << endl; + STUPID_OUT << _T(" EN - English, AM - American English, CE - Canadian English")<< endl; + STUPID_OUT << _T(" IE - International English, SF - South African English") << endl; + STUPID_OUT << _T(" ET - Estonian, FA - Farsi, FI - Finnish, BL - Belgian Flemish") << endl; + STUPID_OUT << _T(" FR - French, BF - Belgian French, CF - Canadian French")<< endl; + STUPID_OUT << _T(" IF - International French, SF - Swiss French")<< endl; + STUPID_OUT << _T(" GD - Scots Gaelic, KA - Georgian, GE - German") << endl; + STUPID_OUT << _T(" SG - Swiss German, EL - Greek, GU - Gujarati")<< endl; + STUPID_OUT << _T(" HE - Hebrew, HI - Hindi, HU - Hungarian") << endl; + STUPID_OUT << _T(" IC - Icelandic, IN - Indonesian, GA - Irish")<< endl; + STUPID_OUT << _T(" IT - Italian, SZ - Swiss Italian, JA - Japanese, ") << endl; + STUPID_OUT << _T(" KN - Kannada, KK - Kazakh, KM - Khmer")<< endl; + STUPID_OUT << _T(" KO - Korean, LO - Laothian, LV - Latvian") << endl; + STUPID_OUT << _T(" LT - Lithuanian, MK - Macedonian, MS - Malay") << endl; + STUPID_OUT << _T(" ML - Malayalam, MR - Marathi, MO - Moldovian") << endl; + STUPID_OUT << _T(" MN - Mongolian, NZ - New Zealand, NO - Norwegian") << endl; + STUPID_OUT << _T(" NN - Norwegian Nynorsk, PL - Polish, PO - Portuguese")<< endl; + STUPID_OUT << _T(" BP - Brazilian Portuguese, PA - Punjabi, RO - Romanian") << endl; + STUPID_OUT << _T(" RU - Russian, SR - Serbian, SI - Sinhalese") << endl; + STUPID_OUT << _T(" SK - Slovak, SL - Slovenian, SO - Somali")<< endl; + STUPID_OUT << _T(" SP - Spanish, OS - International Spanish") << endl; + STUPID_OUT << _T(" LS - Latin American Spanish")<< endl; + STUPID_OUT << _T(" SH - Swahili, SW - Swedish, FS - Finland Swedish") << endl; + STUPID_OUT << _T(" TL - Tagalog, TA - Tamil, TE - Telugu, TH - Thai") << endl; + STUPID_OUT << _T(" BO - Tibetan, TI - Tigrinya, TU - Turkish")<< endl; + STUPID_OUT << _T(" CT - Cyprus Turkish, TK - Turkmen, UK - Ukrainian") << endl; + STUPID_OUT << _T(" UR - Urdu") << endl; //Put reserved here - OUT << _T(" VI - Vietnamese, CY - Welsh, ZU - Zulu") << endl; + STUPID_OUT << _T(" VI - Vietnamese, CY - Welsh, ZU - Zulu") << endl; break; case ErrLanguagesAlreadyDefined: DoErrMsg(_T("the languages have already been defined")); @@ -285,20 +285,20 @@ break; case ErrNoMainDependency: DoErrMsg(_T("missing main component dependency")); - OUT << _T("a dependency is required upon the main component being "); + STUPID_OUT << _T("a dependency is required upon the main component being "); switch (m_SISWriter.GetType()) { case EInstSISConfig: - OUT << _T("configured") << endl; + STUPID_OUT << _T("configured") << endl; break; case EInstSISPatch: - OUT << _T("patched") << endl; + STUPID_OUT << _T("patched") << endl; break; case EInstSISUpgrade: - OUT << _T("upgraded") << endl; + STUPID_OUT << _T("upgraded") << endl; break; } - OUT << _T("the header UID should equal the UID of the main component and dependency") << endl; + STUPID_OUT << _T("the header UID should equal the UID of the main component and dependency") << endl; break; case ErrFileNotFound: DoErrMsg(_T("file not found")); @@ -308,17 +308,17 @@ break; case ErrBadCondFormat: DoErrMsg(_T("incorrect condition format")); - OUT << _T(" Usage : IF condition") << endl; - OUT << _T(" ELSEIF condition") << endl; - OUT << _T(" ELSE") << endl; - OUT << _T(" ENDIF") << endl << endl; - OUT << _T(" condition : var op \"string\"") << endl; - OUT << _T(" var op number") << endl; - OUT << _T(" EXISTS \"filename\"") << endl; - OUT << _T(" (condition)AND(condition)") << endl; - OUT << _T(" (condition)OR(condition)") << endl; - OUT << _T(" NOT(condition)") << endl << endl; - OUT << _T(" op : = <> > < >= <=") << endl; + STUPID_OUT << _T(" Usage : IF condition") << endl; + STUPID_OUT << _T(" ELSEIF condition") << endl; + STUPID_OUT << _T(" ELSE") << endl; + STUPID_OUT << _T(" ENDIF") << endl << endl; + STUPID_OUT << _T(" condition : var op \"string\"") << endl; + STUPID_OUT << _T(" var op number") << endl; + STUPID_OUT << _T(" EXISTS \"filename\"") << endl; + STUPID_OUT << _T(" (condition)AND(condition)") << endl; + STUPID_OUT << _T(" (condition)OR(condition)") << endl; + STUPID_OUT << _T(" NOT(condition)") << endl << endl; + STUPID_OUT << _T(" op : = <> > < >= <=") << endl; break; case ErrReadFailed: DoErrMsg(_T("failed to read file")); @@ -340,29 +340,29 @@ break; case ErrUnknownVariable: DoErrMsg(_T("unknown variable name")); - OUT << _T(" Known variables :") << endl; - OUT << _T(" Manufacturer, ManufacturerHardwareRev, ManufacturerSoftwareRev,") << endl; - OUT << _T(" ManufacturerSoftwareBuild") << endl; - OUT << _T(" Model") << endl; - OUT << _T(" MachineUid") << endl; - OUT << _T(" DeviceFamily, DeviceFamilyRev") << endl; - OUT << _T(" CPU, CPUArch, CPUABI, CPUSpeed") << endl; - OUT << _T(" SystemTickPeriod") << endl; - OUT << _T(" MemoryRAM, MemoryROM, MemoryPageSize") << endl; - OUT << _T(" PowerBackup") << endl; - OUT << _T(" Keyboard, KeyboardDeviceKeys, KeyboardAppKeys, KeyboardClick,") << endl; - OUT << _T(" KeyboardClickVolumeMax") << endl; - OUT << _T(" DisplayXPixels, DisplayYPixels, DisplayXTwips, DisplayYTwips,") << endl; - OUT << _T(" DisplayColors, DisplayContrastMax") << endl; - OUT << _T(" Backlight") << endl; - OUT << _T(" Pen, PenX, PenY, PenDisplayOn, PenClick, PenClickVolumeMax") << endl; - OUT << _T(" Mouse, MouseX, MouseY, MouseButtons") << endl; - OUT << _T(" CaseSwitch") << endl; - OUT << _T(" LEDs") << endl; - OUT << _T(" IntegratedPhone") << endl; - OUT << _T(" NumHalAttributes") << endl; - OUT << _T(" Language") << endl; - OUT << _T(" RemoteInstall") << endl; + STUPID_OUT << _T(" Known variables :") << endl; + STUPID_OUT << _T(" Manufacturer, ManufacturerHardwareRev, ManufacturerSoftwareRev,") << endl; + STUPID_OUT << _T(" ManufacturerSoftwareBuild") << endl; + STUPID_OUT << _T(" Model") << endl; + STUPID_OUT << _T(" MachineUid") << endl; + STUPID_OUT << _T(" DeviceFamily, DeviceFamilyRev") << endl; + STUPID_OUT << _T(" CPU, CPUArch, CPUABI, CPUSpeed") << endl; + STUPID_OUT << _T(" SystemTickPeriod") << endl; + STUPID_OUT << _T(" MemoryRAM, MemoryROM, MemoryPageSize") << endl; + STUPID_OUT << _T(" PowerBackup") << endl; + STUPID_OUT << _T(" Keyboard, KeyboardDeviceKeys, KeyboardAppKeys, KeyboardClick,") << endl; + STUPID_OUT << _T(" KeyboardClickVolumeMax") << endl; + STUPID_OUT << _T(" DisplayXPixels, DisplayYPixels, DisplayXTwips, DisplayYTwips,") << endl; + STUPID_OUT << _T(" DisplayColors, DisplayContrastMax") << endl; + STUPID_OUT << _T(" Backlight") << endl; + STUPID_OUT << _T(" Pen, PenX, PenY, PenDisplayOn, PenClick, PenClickVolumeMax") << endl; + STUPID_OUT << _T(" Mouse, MouseX, MouseY, MouseButtons") << endl; + STUPID_OUT << _T(" CaseSwitch") << endl; + STUPID_OUT << _T(" LEDs") << endl; + STUPID_OUT << _T(" IntegratedPhone") << endl; + STUPID_OUT << _T(" NumHalAttributes") << endl; + STUPID_OUT << _T(" Language") << endl; + STUPID_OUT << _T(" RemoteInstall") << endl; break; case ErrUninstallNeedsWaitEnd: DoErrMsg(_T("RW/RUNWAITEND option required with RR/RUNREMOVE or RB/RUNBOTH options")); @@ -468,13 +468,13 @@ void CMakeSIS::ShowUsage() // Write command line help to STDOUT (cout/wcout) { - OUT << _T("Usage : MakeSIS [-h] [-v] [-s] [-d directory] [-p password] pkgfile [sisfile]") << endl << endl; - OUT << _T(" Options : -h Show help page") << endl; - OUT << _T(" Options : -v Verbose output to screen") << endl; - OUT << _T(" Options : -s Create stub SIS file") << endl; - OUT << _T(" Options : -d Specify a directory path to search") << endl; - OUT << _T(" Options : -p Specify a password to decrypt private key") << endl << endl; - OUT << _T(" use -h option to see pkgfile format") << endl; + STUPID_OUT << _T("Usage : MakeSIS [-h] [-v] [-s] [-d directory] [-p password] pkgfile [sisfile]") << endl << endl; + STUPID_OUT << _T(" Options : -h Show help page") << endl; + STUPID_OUT << _T(" Options : -v Verbose output to screen") << endl; + STUPID_OUT << _T(" Options : -s Create stub SIS file") << endl; + STUPID_OUT << _T(" Options : -d Specify a directory path to search") << endl; + STUPID_OUT << _T(" Options : -p Specify a password to decrypt private key") << endl << endl; + STUPID_OUT << _T(" use -h option to see pkgfile format") << endl; } void CMakeSIS::ShowSyntax() @@ -482,74 +482,74 @@ { // Show the title ShowBanner(); - OUT << _T("MakeSIS PKG File format help") << endl; - OUT << _T("============================") << endl << endl; - OUT << _T("&aa,bb,...,zz Define languages used in installation. Choose from:-") << endl; - OUT << _T(" AF - Afrikaans, SQ - Albanian, AH - Amharic") << endl; - OUT << _T(" AR - Arabic, HY - Armenian, AU - Australian") << endl; - OUT << _T(" AS - Austrian, BE - Belarussian, BN - Bengali")<< endl; - OUT << _T(" BG - Bulgarian, MY - Burmese, CA - Catalan") << endl; - OUT << _T(" TC - Taiwan Chinese, HK - Hong Kong Chinese")<< endl; - OUT << _T(" ZH - PRC Chinese")<< endl; - OUT << _T(" HR - Croatian, CS - Czech, DA - Danish, DU - Dutch") << endl; - OUT << _T(" EN - English, AM - American English, CE - Canadian English")<< endl; - OUT << _T(" IE - International English, SF - South African English") << endl; - OUT << _T(" ET - Estonian, FA - Farsi, FI - Finnish, BL - Belgian Flemish") << endl; - OUT << _T(" FR - French, BF - Belgian French, CF - Canadian French")<< endl; - OUT << _T(" IF - International French, SF - Swiss French")<< endl; - OUT << _T(" GD - Scots Gaelic, KA - Georgian, GE - German") << endl; - OUT << _T(" SG - Swiss German, EL - Greek, GU - Gujarati")<< endl; - OUT << _T(" HE - Hebrew, HI - Hindi, HU - Hungarian") << endl; - OUT << _T(" IC - Icelandic, IN - Indonesian, GA - Irish")<< endl; - OUT << _T(" IT - Italian, SZ - Swiss Italian, JA - Japanese, ") << endl; - OUT << _T(" KN - Kannada, KK - Kazakh, KM - Khmer")<< endl; - OUT << _T(" KO - Korean, LO - Laothian, LV - Latvian") << endl; - OUT << _T(" LT - Lithuanian, MK - Macedonian, MS - Malay") << endl; - OUT << _T(" ML - Malayalam, MR - Marathi, MO - Moldovian") << endl; - OUT << _T(" MN - Mongolian, NZ - New Zealand, NO - Norwegian") << endl; - OUT << _T(" NN - Norwegian Nynorsk, PL - Polish, PO - Portuguese")<< endl; - OUT << _T(" BP - Brazilian Portuguese, PA - Punjabi, RO - Romanian") << endl; - OUT << _T(" RU - Russian, SR - Serbian, SI - Sinhalese") << endl; - OUT << _T(" SK - Slovak, SL - Slovenian, SO - Somali")<< endl; - OUT << _T(" SP - Spanish, OS - International Spanish") << endl; - OUT << _T(" LS - Latin American Spanish")<< endl; - OUT << _T(" SH - Swahili, SW - Swedish, FS - Finland Swedish") << endl; - OUT << _T(" TL - Tagalog, TA - Tamil, TE - Telugu, TH - Thai") << endl; - OUT << _T(" BO - Tibetan, TI - Tigrinya, TU - Turkish")<< endl; - OUT << _T(" CT - Cyprus Turkish, TK - Turkmen, UK - Ukrainian") << endl; - OUT << _T(" UR - Urdu") << endl; + STUPID_OUT << _T("MakeSIS PKG File format help") << endl; + STUPID_OUT << _T("============================") << endl << endl; + STUPID_OUT << _T("&aa,bb,...,zz Define languages used in installation. Choose from:-") << endl; + STUPID_OUT << _T(" AF - Afrikaans, SQ - Albanian, AH - Amharic") << endl; + STUPID_OUT << _T(" AR - Arabic, HY - Armenian, AU - Australian") << endl; + STUPID_OUT << _T(" AS - Austrian, BE - Belarussian, BN - Bengali")<< endl; + STUPID_OUT << _T(" BG - Bulgarian, MY - Burmese, CA - Catalan") << endl; + STUPID_OUT << _T(" TC - Taiwan Chinese, HK - Hong Kong Chinese")<< endl; + STUPID_OUT << _T(" ZH - PRC Chinese")<< endl; + STUPID_OUT << _T(" HR - Croatian, CS - Czech, DA - Danish, DU - Dutch") << endl; + STUPID_OUT << _T(" EN - English, AM - American English, CE - Canadian English")<< endl; + STUPID_OUT << _T(" IE - International English, SF - South African English") << endl; + STUPID_OUT << _T(" ET - Estonian, FA - Farsi, FI - Finnish, BL - Belgian Flemish") << endl; + STUPID_OUT << _T(" FR - French, BF - Belgian French, CF - Canadian French")<< endl; + STUPID_OUT << _T(" IF - International French, SF - Swiss French")<< endl; + STUPID_OUT << _T(" GD - Scots Gaelic, KA - Georgian, GE - German") << endl; + STUPID_OUT << _T(" SG - Swiss German, EL - Greek, GU - Gujarati")<< endl; + STUPID_OUT << _T(" HE - Hebrew, HI - Hindi, HU - Hungarian") << endl; + STUPID_OUT << _T(" IC - Icelandic, IN - Indonesian, GA - Irish")<< endl; + STUPID_OUT << _T(" IT - Italian, SZ - Swiss Italian, JA - Japanese, ") << endl; + STUPID_OUT << _T(" KN - Kannada, KK - Kazakh, KM - Khmer")<< endl; + STUPID_OUT << _T(" KO - Korean, LO - Laothian, LV - Latvian") << endl; + STUPID_OUT << _T(" LT - Lithuanian, MK - Macedonian, MS - Malay") << endl; + STUPID_OUT << _T(" ML - Malayalam, MR - Marathi, MO - Moldovian") << endl; + STUPID_OUT << _T(" MN - Mongolian, NZ - New Zealand, NO - Norwegian") << endl; + STUPID_OUT << _T(" NN - Norwegian Nynorsk, PL - Polish, PO - Portuguese")<< endl; + STUPID_OUT << _T(" BP - Brazilian Portuguese, PA - Punjabi, RO - Romanian") << endl; + STUPID_OUT << _T(" RU - Russian, SR - Serbian, SI - Sinhalese") << endl; + STUPID_OUT << _T(" SK - Slovak, SL - Slovenian, SO - Somali")<< endl; + STUPID_OUT << _T(" SP - Spanish, OS - International Spanish") << endl; + STUPID_OUT << _T(" LS - Latin American Spanish")<< endl; + STUPID_OUT << _T(" SH - Swahili, SW - Swedish, FS - Finland Swedish") << endl; + STUPID_OUT << _T(" TL - Tagalog, TA - Tamil, TE - Telugu, TH - Thai") << endl; + STUPID_OUT << _T(" BO - Tibetan, TI - Tigrinya, TU - Turkish")<< endl; + STUPID_OUT << _T(" CT - Cyprus Turkish, TK - Turkmen, UK - Ukrainian") << endl; + STUPID_OUT << _T(" UR - Urdu") << endl; //Put reserved here - OUT << _T(" VI - Vietnamese, CY - Welsh, ZU - Zulu") << endl; + STUPID_OUT << _T(" VI - Vietnamese, CY - Welsh, ZU - Zulu") << endl; - OUT << _T("#{\"NAMEaa\", ... \"NAMEzz\"},(UID), Major, Minor, Build, Options") << endl; - OUT << _T(" Define file header, including name, uid and version") << endl; - OUT << _T("*PrivateKeyFile,CertificateChainFile,[KEY=password]") << endl; - OUT << _T(" Digitally sign the SIS file") << endl; - OUT << _T("\"Source\"-\"Destination\",Options") << endl; - OUT << _T(" File to be installed/viewed") << endl; - OUT << _T("@\"Component\",(UID)") << endl; - OUT << _T(" Sub-component with UID to be installed") << endl; - OUT << _T("(UID),Major,Minor,Build,{\"DEPENDaa\", ... \"DEPENDzz\"}") << endl; - OUT << _T(" Define a dependency on another component version") << endl; - OUT << _T("{ Start of a language block") << endl; - OUT << _T("\"Source\" A file to install within a language block") << endl; - OUT << _T("@\"Component\" A component to install within a language block") << endl; - OUT << _T("}-\"Destination\", Options") << endl; - OUT << _T(" End a language block containing files") << endl; - OUT << _T("},(UID) End a language block containing components") << endl; - OUT << _T("IF condition Start of block which is installed if condition evaluates") << endl; - OUT << _T(" to TRUE at install time. Condition format is of the form:-") << endl; - OUT << _T(" condition : variable op number") << endl; - OUT << _T(" EXISTS \"filename\"") << endl; - OUT << _T(" (condition)AND(condition)") << endl; - OUT << _T(" (condition)OR(condition)") << endl; - OUT << _T(" NOT(condition)") << endl; - OUT << _T(" op : = <> > < >= <=") << endl; - OUT << _T("ELSEIF condition Block which is installed if a previous condition block") << endl; - OUT << _T(" was not evaluated and condition is TRUE") << endl; - OUT << _T("ELSE Block which is installed if no previous condition blocks") << endl; - OUT << _T(" were evaluated") << endl; - OUT << _T("ENDIF Marks end of condition block(s)") << endl; + STUPID_OUT << _T("#{\"NAMEaa\", ... \"NAMEzz\"},(UID), Major, Minor, Build, Options") << endl; + STUPID_OUT << _T(" Define file header, including name, uid and version") << endl; + STUPID_OUT << _T("*PrivateKeyFile,CertificateChainFile,[KEY=password]") << endl; + STUPID_OUT << _T(" Digitally sign the SIS file") << endl; + STUPID_OUT << _T("\"Source\"-\"Destination\",Options") << endl; + STUPID_OUT << _T(" File to be installed/viewed") << endl; + STUPID_OUT << _T("@\"Component\",(UID)") << endl; + STUPID_OUT << _T(" Sub-component with UID to be installed") << endl; + STUPID_OUT << _T("(UID),Major,Minor,Build,{\"DEPENDaa\", ... \"DEPENDzz\"}") << endl; + STUPID_OUT << _T(" Define a dependency on another component version") << endl; + STUPID_OUT << _T("{ Start of a language block") << endl; + STUPID_OUT << _T("\"Source\" A file to install within a language block") << endl; + STUPID_OUT << _T("@\"Component\" A component to install within a language block") << endl; + STUPID_OUT << _T("}-\"Destination\", Options") << endl; + STUPID_OUT << _T(" End a language block containing files") << endl; + STUPID_OUT << _T("},(UID) End a language block containing components") << endl; + STUPID_OUT << _T("IF condition Start of block which is installed if condition evaluates") << endl; + STUPID_OUT << _T(" to TRUE at install time. Condition format is of the form:-") << endl; + STUPID_OUT << _T(" condition : variable op number") << endl; + STUPID_OUT << _T(" EXISTS \"filename\"") << endl; + STUPID_OUT << _T(" (condition)AND(condition)") << endl; + STUPID_OUT << _T(" (condition)OR(condition)") << endl; + STUPID_OUT << _T(" NOT(condition)") << endl; + STUPID_OUT << _T(" op : = <> > < >= <=") << endl; + STUPID_OUT << _T("ELSEIF condition Block which is installed if a previous condition block") << endl; + STUPID_OUT << _T(" was not evaluated and condition is TRUE") << endl; + STUPID_OUT << _T("ELSE Block which is installed if no previous condition blocks") << endl; + STUPID_OUT << _T(" were evaluated") << endl; + STUPID_OUT << _T("ENDIF Marks end of condition block(s)") << endl; } void CMakeSIS::DoVerbage(const _TCHAR* pszText) const @@ -573,17 +573,17 @@ { LPCWSTR fileNameU=m_CmdOptions.SourceFile(); #ifdef _UNICODE - OUT << fileNameU; + STUPID_OUT << fileNameU; #else DWORD len=wcslen(fileNameU); LPSTR fileName=MakeMBCSString(fileNameU,CP_ACP,len); - OUT << fileName; + STUPID_OUT << fileName; delete [] fileName; #endif - OUT << _T("(") << m_wLineNo << _T(")") << _T(" : "); + STUPID_OUT << _T("(") << m_wLineNo << _T(")") << _T(" : "); } - OUT << pszText1 << pszText2 << endl; + STUPID_OUT << pszText1 << pszText2 << endl; } // main function - constructs a CMakeSIS object and calls it's run method Only in SDN-Makesis-srcrelApr03/appinst/makesis: Makesis.ncb Only in SDN-Makesis-srcrelApr03/appinst/makesis: Makesis.opt Only in SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis: Makesis.sln Only in SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis: Makesis.suo Only in SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis: Makesis.vcproj diff -b -B -r -d -u SDN-Makesis-srcrelApr03/appinst/makesis/PARSECMD.CPP SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis/PARSECMD.CPP --- SDN-Makesis-srcrelApr03/appinst/makesis/PARSECMD.CPP Tue Apr 15 16:06:40 2003 +++ SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis/PARSECMD.CPP Thu Oct 30 14:27:25 2003 @@ -34,7 +34,7 @@ { // Test the number of arguments if(argc == 1) - throw ErrInsufficientArgs; + STUPID_THROW( ErrInsufficientArgs ) int wCount = 1; // Parse the command line @@ -46,7 +46,7 @@ else { if(argv[wCount][1] == '\0') - throw ErrBadCommandFlag; + STUPID_THROW( ErrBadCommandFlag ) switch(argv[wCount][1]) { case 'h' : // Help. i.e Show Syntax @@ -82,7 +82,7 @@ #endif break; default : // Uh-Oh... - throw ErrBadCommandFlag; + STUPID_THROW( ErrBadCommandFlag ) } wCount++; } @@ -101,7 +101,7 @@ #endif } else - throw ErrNoSourceFile; + STUPID_THROW( ErrNoSourceFile ) if(wCount < argc) { @@ -134,7 +134,7 @@ } // Is the dir path legal? if(wCount < 1) - throw ErrBadCommandFlag; + STUPID_THROW( ErrBadCommandFlag ) // Check for trailing backslash if(m_pszDir[wCount - 1] != '\\') @@ -148,11 +148,11 @@ { // Check that the filename is valid if (wcslen(pszTarget) < (wcslen(DESTFILE) + sizeof(WCHAR))) - throw ErrBadTargetFile; + STUPID_THROW( ErrBadTargetFile ) else { if (wcsicmp(&pszTarget[wcslen(pszTarget) - (wcslen(DESTFILE))], DESTFILE) != 0) - throw ErrBadTargetFile; + STUPID_THROW( ErrBadTargetFile ) else wcscpy(m_pszTarget, pszTarget); } @@ -164,11 +164,11 @@ { // Check that the filename is valid if (wcslen(pszSource) < (wcslen(SOURCEFILE) + sizeof(WCHAR))) - throw ErrBadSourceFile; + STUPID_THROW( ErrBadSourceFile ) else { if (wcsicmp(&pszSource[wcslen(pszSource) - (wcslen(SOURCEFILE))], SOURCEFILE) != 0) - throw ErrBadSourceFile; + STUPID_THROW( ErrBadSourceFile ) else wcscpy(m_pszSource, pszSource); } diff -b -B -r -d -u SDN-Makesis-srcrelApr03/appinst/makesis/PARSECMD.H SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis/PARSECMD.H --- SDN-Makesis-srcrelApr03/appinst/makesis/PARSECMD.H Tue Apr 15 16:06:40 2003 +++ SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis/PARSECMD.H Thu Oct 30 14:40:41 2003 @@ -33,7 +33,7 @@ public: CParseCmd(); - ParseCommandLine(int argc, _TCHAR *argv[]); + BOOL ParseCommandLine(int argc, _TCHAR *argv[]); BOOL ShowSyntax() const { return m_fShowSyntax; } DWORD Flags() const { return m_dwOptions; } diff -b -B -r -d -u SDN-Makesis-srcrelApr03/appinst/makesis/PARSEPKG.H SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis/PARSEPKG.H --- SDN-Makesis-srcrelApr03/appinst/makesis/PARSEPKG.H Mon Apr 28 17:40:22 2003 +++ SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis/PARSEPKG.H Thu Oct 30 15:20:44 2003 @@ -478,6 +478,8 @@ MParserObserver *m_pObserver; // The obseverer object inline void Verbage(const _TCHAR* pszText); // Wrapper for MParserObserver::Verbage() BOOL DoesExist(LPWSTR pszFile, DWORD *pdwSize); // Does the component file exist, how big is it + BOOL DoesDirExist(LPWSTR pszFile); // Does the component dir exist + void ProcessFolderL( LPCWSTR pszFolder, LPCWSTR pszDestination ); WORD m_nLineNo; // The line we are currently on BOOL m_fInLangBlock; // Are we processing a language block BOOL m_fInLangFileBlock; // Are we processing a language dependent file block diff -b -B -r -d -u SDN-Makesis-srcrelApr03/appinst/makesis/Parsepkg.cpp SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis/Parsepkg.cpp --- SDN-Makesis-srcrelApr03/appinst/makesis/Parsepkg.cpp Mon Apr 28 18:51:12 2003 +++ SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis/Parsepkg.cpp Thu Oct 30 19:58:58 2003 @@ -15,45 +15,47 @@ #include #include #include -#include +#include #include #include "ParsePkg.h" #include "ParseCmd.h" #include "CrtSIS.h" +#include "FileDirEnt.h" + // =========================================================================== // CONSTANTS // =========================================================================== // Set up the cout stream so that we can use it with either narrow or wide // chars at build time -#undef OUT // coz it's an IDL thing... +#undef STUPID_OUT // coz it's an IDL thing... #ifdef _UNICODE -#define OUT wcout +#define STUPID_OUT wcout #else -#define OUT cout +#define STUPID_OUT cout #endif // Parse options lookups const SParseOpt KHeaderOptions[] = - { -// {L"I8", 0}, +{ + // {L"I8", 0}, {L"IU", EInstIsUnicode}, -// {L"ID", EInstIsDistributable}, + // {L"ID", EInstIsDistributable}, {L"SH", EInstShutdownApps}, {L"NC", EInstNoCompress}, -// {L"I8BITCHARS", 0}, + // {L"I8BITCHARS", 0}, {L"IUNICODE", EInstIsUnicode}, -// {L"ISDISTRIBUTABLE",EInstIsDistributable}, + // {L"ISDISTRIBUTABLE",EInstIsDistributable}, {L"SHUTDOWNAPPS", EInstShutdownApps}, {L"NOCOMPRESS", EInstNoCompress}, - }; +}; #define NUMHEADEROPTIONS (sizeof(KHeaderOptions)/sizeof(SParseOpt)) const SParseOpt KSISTypes[] = - { +{ {L"SA", EInstSISApp}, {L"SY", EInstSISSystem}, {L"SO", EInstSISOption}, @@ -66,26 +68,28 @@ {L"SISCONFIG", EInstSISConfig}, {L"SISPATCH", EInstSISPatch}, {L"SISUPGRADE", EInstSISUpgrade}, - }; +}; #define NUMSISTYPEOPTIONS (sizeof(KSISTypes)/sizeof(SParseOpt)) const SParseOpt KTypeOptions[] = - { +{ {L"FF", EInstFileTypeSimple}, + {L"FD", EInstFileTypeDir}, {L"FT", EInstFileTypeText}, {L"FR", EInstFileTypeRun}, {L"FN", EInstFileTypeNull}, {L"FM", EInstFileTypeMime}, {L"FILE", EInstFileTypeSimple}, + {L"FILEDIR", EInstFileTypeDir}, {L"FILETEXT", EInstFileTypeText}, {L"FILERUN", EInstFileTypeRun}, {L"FILENULL", EInstFileTypeNull}, {L"FILEMIME", EInstFileTypeMime}, - }; +}; #define NUMTYPEOPTIONS (sizeof(KTypeOptions)/sizeof(SParseOpt)) const SParseOpt KTextOptions[] = - { +{ {L"TC", EInstFileTextOptionContinue}, {L"TS", EInstFileTextOptionSkipOneIfNo}, {L"TA", EInstFileTextOptionAbortIfNo}, @@ -94,39 +98,39 @@ {L"TEXTSKIP", EInstFileTextOptionSkipOneIfNo}, {L"TEXTABORT", EInstFileTextOptionAbortIfNo}, {L"TEXTEXIT", EInstFileTextOptionExitIfNo}, - }; +}; #define NUMTEXTOPTIONS (sizeof(KTextOptions)/sizeof(SParseOpt)) const SParseOpt KRunOptions[] = - { +{ {L"RI", EInstFileRunOptionInstallOnly}, {L"RR", EInstFileRunOptionRemoveOnly}, {L"RB", EInstFileRunOptionInstallAndRemove}, {L"RUNINSTALL", EInstFileRunOptionInstallOnly}, {L"RUNREMOVE", EInstFileRunOptionRemoveOnly}, {L"RUNBOTH", EInstFileRunOptionInstallAndRemove} - }; +}; #define NUMRUNOPTIONS (sizeof(KRunOptions)/sizeof(SParseOpt)) const SParseOpt KCtrlOptions[] = - { +{ {L"RS", EInstRunSendEnd}, {L"RW", EInstRunWaitEnd}, {L"RUNSENDEND", EInstRunSendEnd}, {L"RUNWAITEND", EInstRunWaitEnd}, - }; +}; #define NUMCTRLOPTIONS (sizeof(KCtrlOptions)/sizeof(SParseOpt)) // Parse options lookups #define MAXTOKENLEN 30 struct SParseToken - { +{ WCHAR pszOpt[MAXTOKENLEN]; DWORD dwOpt; - }; +}; const SParseToken KTokens[] = - { +{ {L"if", IF_TOKEN}, {L"elseif", ELSEIF_TOKEN}, {L"else", ELSE_TOKEN}, @@ -139,12 +143,12 @@ {L"or", OR_TOKEN}, {L"type", TYPE_TOKEN}, {L"key", KEY_TOKEN}, - }; +}; #define NUMPARSETOKENS (sizeof(KTokens)/sizeof(SParseToken)) // Language options const SParseOpt KLangOptions[] = - { +{ {L"EN", ELangEnglish}, {L"FR", ELangFrench}, {L"GE", ELangGerman}, @@ -247,11 +251,11 @@ //{L"??", ELangOther }, //{L"??", ELangNone } - }; +}; #define NUMLANGOPTIONS (sizeof(KLangOptions)/sizeof(SParseOpt)) const SParseToken KVariableLookupTable[] = - { +{ {L"Manufacturer", HALData::EManufacturer}, {L"ManufacturerHardwareRev", HALData::EManufacturerHardwareRev}, {L"ManufacturerSoftwareRev", HALData::EManufacturerSoftwareRev}, @@ -325,7 +329,7 @@ {L"Language", EVarLanguage}, {L"RemoteInstall", EVarRemoteInstall}, - }; +}; #define NUMVAROPTIONS (sizeof(KVariableLookupTable)/sizeof(SParseOpt)) @@ -339,14 +343,14 @@ m_fInLangFileBlock(0), // Are we processing a language dependent file block m_wCurrLang(0), // If we are in a lang/lang file block - which lang are we processing m_pSISWriter(NULL) // Stuff all our intermediate data in here - { +{ memset((void *)m_pszSearchDir, 0x0000, MAX_PATH * sizeof(WCHAR)); - } +} void CParsePkg::SetSearchDirectory(LPCWSTR pszPath) // Purpose : Sets the search directory // Inputs : pszPath - The directory path (including trailing backslash!) - { +{ wcscpy(m_pszSearchDir, pszPath); DWORD len=wcslen(m_pszSearchDir); if(len>0 && m_pszSearchDir[len-1] != '\\') // Ensure a trialing backslash @@ -354,14 +358,14 @@ m_pszSearchDir[len] = '\\'; m_pszSearchDir[len+1] = '\0'; } - } +} void CParsePkg::ParseL(HANDLE hFile, CSISWriter *pWriter, BOOL fIsStub, MParserObserver *pObserver /*= NULL*/) // Purpose : Check the contents of an input line and defers parsing to the appropriate ParseXXXL() // method // Inputs : m_pkgPtr - The line to process // Returns : Success or failure (actually, always TRUE - failure causes an exception to be thrown) - { +{ assert(hFile != INVALID_HANDLE_VALUE); assert(pWriter); @@ -405,7 +409,7 @@ break; default : { - throw ErrUnknownLine; + STUPID_THROW( ErrUnknownLine ) } } } @@ -419,13 +423,13 @@ DWORD dwUid=m_pSISWriter->GetUID(); while (depend && dwUid!=depend->dwUID) depend=depend->pNext; - if (!depend) throw ErrNoMainDependency; + if (!depend) STUPID_THROW( ErrNoMainDependency ) } - } +} void CParsePkg::ParseEmbeddedBlockL() - { +{ while(m_token!=EOF_TOKEN) { switch (m_token) @@ -460,15 +464,15 @@ return; } } - } +} void CParsePkg::ParseLanguagesL() // Parses the language definition line - { +{ Verbage(_T("processing languages")); if(m_pSISWriter->GetNoLanguages()) - throw ErrLanguagesAlreadyDefined; + STUPID_THROW( ErrLanguagesAlreadyDefined ) for(;;) { @@ -480,45 +484,45 @@ if(!wcsicmp(m_tokenValue.pszString, KLangOptions[wLoop].pszOpt)) { // found match LANGNODE *pNode = new LANGNODE; - if (!pNode) throw ErrNotEnoughMemory; + if (!pNode) STUPID_THROW( ErrNotEnoughMemory ) pNode->wLang = (WORD)KLangOptions[wLoop].dwOpt; m_pSISWriter->AddLanguageNode(pNode); break; } } if(wLoop == NUMLANGOPTIONS) - throw ErrUnknownLanguagesId; + STUPID_THROW( ErrUnknownLanguagesId ) } else if (m_token==NUMERIC_TOKEN && m_tokenValue.dwNumber>=0 && m_tokenValue.dwNumber<=1000) // language codes may be given as a numeric value { LANGNODE *pNode = new LANGNODE; - if (!pNode) throw ErrNotEnoughMemory; + if (!pNode) STUPID_THROW( ErrNotEnoughMemory ) pNode->wLang = (WORD)m_tokenValue.dwNumber; m_pSISWriter->AddLanguageNode(pNode); } else - throw ErrUnknownLanguagesId; + STUPID_THROW( ErrUnknownLanguagesId ) GetNextToken(); if (m_token!=',') return; GetNextToken(); } - } +} void CParsePkg::ParseHeaderL() // Parses the pkg header line - { +{ Verbage(_T("processing header")); if(m_pSISWriter->AreLangStringInit()) - throw ErrHeaderAlreadyDefined; + STUPID_THROW( ErrHeaderAlreadyDefined ) // Test if there are languages defined, if there are none then add english if(!m_pSISWriter->GetNoLanguages()) { Verbage(_T("no languages defined, assuming English only")); LANGNODE *pNode = new LANGNODE; - if (!pNode) throw ErrNotEnoughMemory; + if (!pNode) STUPID_THROW( ErrNotEnoughMemory ) pNode->wLang = ELangEnglish; m_pSISWriter->AddLanguageNode(pNode); } @@ -530,7 +534,7 @@ GetNextToken(); ExpectToken(QUOTED_STRING_TOKEN); LANGSTRINGNODE *pLSNode = new LANGSTRINGNODE; - if (!pLSNode) throw ErrNotEnoughMemory; + if (!pLSNode) STUPID_THROW( ErrNotEnoughMemory ) wcscpy(pLSNode->pszString,m_tokenValue.pszString); m_pSISWriter->AddLangStringNode(pLSNode); GetNextToken(); @@ -600,29 +604,39 @@ if (!narrow) dwFlags|=EInstIsUnicode; m_pSISWriter->SetVersionInfo(dwUID, wMajor, wMinor, dwBuild, (TSISType)dwType, (WORD)dwFlags); - } +} void CParsePkg::ParseFileL() // Parses a file definition line - { +{ Verbage(_T("processing file")); if(!m_pSISWriter->AreLangStringInit()) - throw ErrHeaderNotDefined; + STUPID_THROW( ErrHeaderNotDefined ) PKGLINENODE *pNode = new PKGLINENODE; - if (!pNode) throw ErrNotEnoughMemory; + if (!pNode) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)pNode, '\0', sizeof(PKGLINENODE)); pNode->iPackageLineType=EInstPkgLineFile; pNode->file = new PKGLINEFILE; - if (!pNode->file) throw ErrNotEnoughMemory; + if (!pNode->file) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)pNode->file, '\0', sizeof(PKGLINEFILE)); pNode->file->type=EInstFileTypeSimple; wcscpy(pNode->file->pszSource, m_tokenValue.pszString); if (pNode->file->pszSource[0] && !DoesExist(pNode->file->pszSource, &pNode->file->dwSize)) - throw ErrFileNotFound; + { + if ( !DoesDirExist(pNode->file->pszSource)) + { + wprintf( L"%s\n", pNode->file->pszSource ); + STUPID_THROW( ErrFileNotFound ) + } + else + { + pNode->file->type=EInstFileTypeDir; + } + } GetNextToken(); ExpectToken('-'); @@ -632,7 +646,7 @@ // BAW-5CQEA5 Check for invalid destination (i.e starts with ':') if ( wcslen(m_tokenValue.pszString) > 0 && m_tokenValue.pszString[0] == ':' ) - throw ErrBadDestinationPath; + STUPID_THROW( ErrBadDestinationPath ) // ANN-5ESFPV If there is no drive specified, assume it's C: if ((wcslen(m_tokenValue.pszString) < 3) || @@ -686,7 +700,7 @@ // if running when uninstall then must use wait end option if (options&(EInstFileRunOptionRemoveOnly|EInstFileRunOptionInstallAndRemove) && !(options&EInstRunWaitEnd)) - throw ErrUninstallNeedsWaitEnd; + STUPID_THROW( ErrUninstallNeedsWaitEnd ) pNode->file->options.iRunOption=(TInstFileRunOption)options; break; case EInstFileTypeMime: @@ -695,7 +709,7 @@ pNode->file->options.iMimeOption=(TInstFileMimeOption)options; break; default: - throw ErrBadOption; + STUPID_THROW( ErrBadOption ) break; } } @@ -708,23 +722,34 @@ pNode->file->pszSource[0]='\0'; } + if ( pNode->file->type == EInstFileTypeDir ) + { + ProcessFolderL( pNode->file->pszSource, pNode->file->pszDest ); + delete pNode; + } + else + { + wprintf( L"Adding %s\n", pNode->file->pszSource ); + //wprintf( L"-> %s\n", pNode->file->pszDest ); + m_pSISWriter->AddPkgLineNode(pNode); } +} void CParsePkg::ParsePackageL() // Parses a package (component SIS file) line - { +{ Verbage(_T("processing embedded package file")); if(!m_pSISWriter->AreLangStringInit()) - throw ErrHeaderNotDefined; + STUPID_THROW( ErrHeaderNotDefined ) PKGLINENODE *pNode = new PKGLINENODE; - if (!pNode) throw ErrNotEnoughMemory; + if (!pNode) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)pNode, '\0', sizeof(PKGLINENODE)); pNode->iPackageLineType=EInstPkgLineFile; pNode->file = new PKGLINEFILE; - if (!pNode->file) throw ErrNotEnoughMemory; + if (!pNode->file) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)pNode->file, '\0', sizeof(PKGLINEFILE)); pNode->file->type=EInstFileTypeComponent; @@ -732,12 +757,16 @@ ExpectToken(QUOTED_STRING_TOKEN); if (!FullPath(pNode->file->pszSource, m_tokenValue.pszString, MAX_PATH)) { - throw ErrCannotGetFullPath; + printf( "Full path failed: %s\n", pNode->file->pszSource ); + STUPID_THROW( ErrCannotGetFullPath ) } // Test that the file exists if(!DoesExist(pNode->file->pszSource, &pNode->file->dwSize)) - throw ErrFileNotFound; + { + printf( "File not found: %s\n", pNode->file->pszSource ); + STUPID_THROW( ErrFileNotFound ) + } GetNextToken(); ExpectToken(','); @@ -755,7 +784,7 @@ HANDLE hEmbeddedFile = ::MakeSISOpenFile(pNode->file->pszSource, GENERIC_READ, OPEN_EXISTING); if (hEmbeddedFile == INVALID_HANDLE_VALUE) { - throw ErrReadFailed; + STUPID_THROW( ErrReadFailed ) } else { @@ -765,33 +794,33 @@ &numberOfBytesRead,NULL); if (!ok) { - throw ErrReadFailed; + STUPID_THROW( ErrReadFailed ) } if (embeddedUID != pNode->file->options.iComponentUid) { - throw ErrUIDMismatch; + STUPID_THROW( ErrUIDMismatch ) } CloseHandle(hEmbeddedFile); } // Test that the filename is *.SIS if(wcsicmp(&pNode->file->pszSource[wcslen(pNode->file->pszSource) - wcslen(DESTFILE)], DESTFILE)) - throw ErrPackageNotASISFile; + STUPID_THROW( ErrPackageNotASISFile ) pNode->file->pszDest[0] = '\0'; m_pSISWriter->AddPkgLineNode(pNode); - } +} void CParsePkg::ParseDependencyL() // Parses a dependency line - { +{ Verbage(_T("processing dependency")); if(!m_pSISWriter->AreLangStringInit()) - throw ErrHeaderNotDefined; + STUPID_THROW( ErrHeaderNotDefined ) DEPENDNODE *pNode = new DEPENDNODE; - if (!pNode) throw ErrNotEnoughMemory; + if (!pNode) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)pNode, '\0', sizeof(DEPENDNODE)); ExpectToken(NUMERIC_TOKEN); @@ -831,7 +860,7 @@ GetNextToken(); ExpectToken(QUOTED_STRING_TOKEN); LANGSTRINGNODE *pLSNode = new LANGSTRINGNODE; - if (!pLSNode) throw ErrNotEnoughMemory; + if (!pLSNode) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)pLSNode, '\0', sizeof(LANGSTRINGNODE)); wcscpy(pLSNode->pszString,m_tokenValue.pszString); GetNextToken(); @@ -845,7 +874,7 @@ GetNextToken(); m_pSISWriter->AddDependencyNode(pNode); - } +} void CParsePkg::ParseSignatureL() { @@ -853,7 +882,7 @@ Verbage(_T("processing signature")); if(!m_pSISWriter->AreLangStringInit()) - throw ErrHeaderNotDefined; + STUPID_THROW( ErrHeaderNotDefined ) // If generating a stub file then once have signature line don't need to // process rest of PKG file @@ -862,7 +891,7 @@ ExpectToken(QUOTED_STRING_TOKEN); SIGNATURENODE* pSig = new SIGNATURENODE; - if (!pSig) throw ErrNotEnoughMemory; + if (!pSig) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)pSig, '\0', sizeof(SIGNATURENODE)); wcscpy(pSig->pszPrivateKey,m_tokenValue.pszString); @@ -892,7 +921,7 @@ // Test that the files exist if (!DoesExist(pSig->pszPrivateKey, &dwSize) || !DoesExist(pSig->pszPublicKey, &dwSize)) - throw ErrFileNotFound; + STUPID_THROW( ErrFileNotFound ) GetNextToken(); @@ -919,11 +948,11 @@ void CParsePkg::ParseCapabilityL() // Parses a capability line - { +{ Verbage(_T("processing capability")); if(!m_pSISWriter->AreLangStringInit()) - throw ErrHeaderNotDefined; + STUPID_THROW( ErrHeaderNotDefined ) ExpectToken('('); do @@ -931,7 +960,7 @@ GetNextToken(); CAPABILITYNODE *pNode = new CAPABILITYNODE; - if (!pNode) throw ErrNotEnoughMemory; + if (!pNode) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)pNode, '\0', sizeof(CAPABILITYNODE)); ExpectToken(NUMERIC_TOKEN); @@ -947,11 +976,11 @@ } while (m_token==','); ExpectToken(')'); GetNextToken(); - } +} void CParsePkg::ParseOptionsBlockL() // To parse an options block - { +{ WORD wNumLangs; LANGSTRINGNODE *pLSNode; @@ -961,11 +990,11 @@ GetNextToken(); PKGLINENODE *pNode = new PKGLINENODE; - if (!pNode) throw ErrNotEnoughMemory; + if (!pNode) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)pNode, '\0', sizeof(PKGLINENODE)); pNode->iPackageLineType=EInstPkgLineOption; pNode->option = new PKGLINEOPTIONS; - if (!pNode->option) throw ErrNotEnoughMemory; + if (!pNode->option) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)pNode->option, '\0', sizeof(PKGLINEOPTIONS)); for (;;) { @@ -977,7 +1006,7 @@ { ExpectToken(QUOTED_STRING_TOKEN); pLSNode = new LANGSTRINGNODE; - if (!pLSNode) throw ErrNotEnoughMemory; + if (!pLSNode) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)pLSNode, '\0', sizeof(LANGSTRINGNODE)); wcscpy(pLSNode->pszString,m_tokenValue.pszString); pLSNode->pNext=pNode->option->pLangStringBase; @@ -1002,26 +1031,26 @@ GetNextToken(); m_pSISWriter->AddPkgLineNode(pNode); - } +} void CParsePkg::ParseLanguageBlockL() // To parse the start of a language block - { +{ Verbage(_T("processing language block")); if(!m_pSISWriter->AreLangStringInit()) - throw ErrHeaderNotDefined; + STUPID_THROW( ErrHeaderNotDefined ) BOOL packages=(m_token=='@'); for (DWORD m_wCurrLang = 0; m_wCurrLangGetNoLanguages(); m_wCurrLang++) { PKGLINENODE *pNode = new PKGLINENODE; - if (!pNode) throw ErrNotEnoughMemory; + if (!pNode) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)pNode, '\0', sizeof(PKGLINENODE)); pNode->iPackageLineType=EInstPkgLineLanguageFile; pNode->file = new PKGLINEFILE; - if (!pNode->file) throw ErrNotEnoughMemory; + if (!pNode->file) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)pNode->file, '\0', sizeof(PKGLINEFILE)); if (packages) { @@ -1037,7 +1066,7 @@ wcscpy(pNode->file->pszSource,m_tokenValue.pszString); // Test that the file exists if(!DoesExist(pNode->file->pszSource, &pNode->file->dwSize)) - throw ErrFileNotFound; + STUPID_THROW( ErrFileNotFound ) m_pSISWriter->AddPkgLineNode(pNode); GetNextToken(); } @@ -1065,7 +1094,7 @@ { GetNextToken(); ParseOption(KTypeOptions,NUMTYPEOPTIONS, &dwType); - if ((TInstFileType)dwType==EInstFileTypeNull) throw ErrBadOption; + if ((TInstFileType)dwType==EInstFileTypeNull) STUPID_THROW( ErrBadOption ) if ((TInstFileType)dwType==EInstFileTypeMime) { ExpectToken(','); @@ -1093,7 +1122,7 @@ // if running when uninstall then must use wait end option if (dwOptions&(EInstFileRunOptionRemoveOnly|EInstFileRunOptionInstallAndRemove) && !(dwOptions&EInstRunWaitEnd)) - throw ErrUninstallNeedsWaitEnd; + STUPID_THROW( ErrUninstallNeedsWaitEnd ) break; case EInstFileTypeMime: if (m_token==',') @@ -1103,7 +1132,7 @@ } break; default: - throw ErrBadOption; + STUPID_THROW( ErrBadOption ) break; } } @@ -1126,10 +1155,10 @@ GetNextToken(); } - } +} void CParsePkg::ParseIfBlockL() - { +{ Verbage(_T("processing IF block")); ParseConditionL(EInstPkgLineCondIf); @@ -1152,27 +1181,27 @@ ExpectToken(ENDIF_TOKEN); ParseConditionL(EInstPkgLineCondEndIf); GetNextToken(); - } +} void CParsePkg::ParseCommentL() // Purpose : Parses a comment line (Does nothing, just throws the line away) // Inputs : m_pkgPtr - The string to parse // Returns : Success or failure - { +{ Verbage(_T("processing comment")); // parse to end of line while (m_pkgChar && m_pkgChar!='\r') GetNextChar(); GetNextToken(); - } +} void CParsePkg::ParseConditionL(TInstPackageLineType type) // Purpose : Parses a condition line // Inputs : m_pkgPtr - The string to parse // returns : Success or failure (actually, always TRUE - failure causes an exception to be thrown) - { +{ PKGLINENODE *pNode = new PKGLINENODE; - if (!pNode) throw ErrNotEnoughMemory; + if (!pNode) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)pNode, '\0', sizeof(PKGLINENODE)); pNode->iPackageLineType=type; @@ -1186,15 +1215,15 @@ } m_pSISWriter->AddPkgLineNode(pNode); - } +} PKGLINECONDITION* CParsePkg::ParseExpr() - { +{ return ParseLogicalOp(); - } +} PKGLINECONDITION* CParsePkg::ParseLogicalOp() - { +{ PKGLINECONDITION* left=ParseRelation(); for (;;) { @@ -1204,7 +1233,7 @@ case OR_TOKEN: { PKGLINECONDITION* expr=new PKGLINECONDITION; - if (!expr) throw ErrNotEnoughMemory; + if (!expr) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)expr, '\0', sizeof(PKGLINECONDITION)); if (m_token==AND_TOKEN) expr->exprType=EInstCondLogOpAnd; @@ -1220,10 +1249,10 @@ return left; } } - } +} PKGLINECONDITION* CParsePkg::ParseRelation() - { +{ PKGLINECONDITION* left=ParseUnary(); switch (m_token) { @@ -1235,7 +1264,7 @@ case NE_TOKEN: { PKGLINECONDITION* expr=new PKGLINECONDITION; - if (!expr) throw ErrNotEnoughMemory; + if (!expr) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)expr, '\0', sizeof(PKGLINECONDITION)); switch (m_token) { @@ -1265,16 +1294,16 @@ } } return left; - } +} PKGLINECONDITION* CParsePkg::ParseUnary() - { +{ switch (m_token) { case NOT_TOKEN: { PKGLINECONDITION* expr=new PKGLINECONDITION; - if (!expr) throw ErrNotEnoughMemory; + if (!expr) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)expr, '\0', sizeof(PKGLINECONDITION)); if (m_token==EXISTS_TOKEN) expr->exprType=EInstCondFuncExists; @@ -1289,7 +1318,7 @@ GetNextToken(); ExpectToken('('); PKGLINECONDITION* expr=new PKGLINECONDITION; - if (!expr) throw ErrNotEnoughMemory; + if (!expr) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)expr, '\0', sizeof(PKGLINECONDITION)); expr->exprType=EInstCondFuncAppCap; GetNextToken(); @@ -1310,7 +1339,7 @@ GetNextToken(); ExpectToken('('); PKGLINECONDITION* expr=new PKGLINECONDITION; - if (!expr) throw ErrNotEnoughMemory; + if (!expr) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)expr, '\0', sizeof(PKGLINECONDITION)); GetNextToken(); if (token==EXISTS_TOKEN) @@ -1331,28 +1360,28 @@ default: return ParseFactor(); } - } +} PKGLINECONDITION* CParsePkg::ParseFactor() - { +{ PKGLINECONDITION* expr; switch (m_token) { - case '(': +case '(': { GetNextToken(); expr=ParseExpr(); ExpectToken(')'); } break; - case QUOTED_STRING_TOKEN: - case ALPHA_TOKEN: - case NUMERIC_TOKEN: +case QUOTED_STRING_TOKEN: +case ALPHA_TOKEN: +case NUMERIC_TOKEN: { expr=new PKGLINECONDITION; - if (!expr) throw ErrNotEnoughMemory; + if (!expr) STUPID_THROW( ErrNotEnoughMemory ) memset((void *)expr, '\0', sizeof(PKGLINECONDITION)); expr->pPrim=new VARIANTVAL; - if (!expr->pPrim) throw ErrNotEnoughMemory; + if (!expr->pPrim) STUPID_THROW( ErrNotEnoughMemory ) switch (m_token) { case QUOTED_STRING_TOKEN: @@ -1369,7 +1398,7 @@ temp=&m_tokenValue.pszString[6]; DWORD optionNum = wcstol(temp, &end, 10); if (end==temp || errno==ERANGE) - throw ErrUnknownVariable; + STUPID_THROW( ErrUnknownVariable ) expr->pPrim->dwNumber = EVarOptionBase+optionNum; } else @@ -1385,7 +1414,7 @@ } } if(wLoop == NUMVAROPTIONS) - throw ErrUnknownVariable; + STUPID_THROW( ErrUnknownVariable ) } } break; @@ -1396,16 +1425,16 @@ } } break; - default: - throw ErrBadCondFormat; +default: + STUPID_THROW( ErrBadCondFormat ) } GetNextToken(); return expr; - } +} DWORD CParsePkg::ParseOption(const SParseOpt* options, DWORD dwNumOptions, DWORD* pdwOptions) // Parse the options part of an input line - { +{ DWORD option=0; ExpectToken(ALPHA_TOKEN); // Look for the option @@ -1418,14 +1447,14 @@ } } if(wLoop == dwNumOptions) - throw ErrBadOption; + STUPID_THROW( ErrBadOption ) *pdwOptions |= option; GetNextToken(); return option; - } +} void CParsePkg::ExpectToken(TOKEN aToken) - { +{ if (m_token!=aToken) { if (m_pObserver) @@ -1448,12 +1477,12 @@ } m_pObserver->DoErrMsg(msg); } - throw ErrUnexpectedToken; - } + STUPID_THROW( ErrUnexpectedToken ) } +} const _TCHAR* CParsePkg::GetTokenText(TOKEN aToken) - { +{ switch(aToken) { case NUMERIC_TOKEN: @@ -1487,15 +1516,19 @@ default: return _T("?"); } - } +} void CParsePkg::GetNextToken() // lexical analyzer - { +{ // skip any white space & CR's - while (m_pkgChar == '\r' || isspace(m_pkgChar)) + WCHAR lastChar = 0; + while (m_pkgChar == '\r' || m_pkgChar == '\n' || isspace(m_pkgChar)) { - if (m_pkgChar == '\r' && m_pObserver) m_pObserver->SetLineNumber(++m_nLineNo); + if (m_pkgChar == '\r' && lastChar != '\n' && m_pObserver) m_pObserver->SetLineNumber(++m_nLineNo); + else if (m_pkgChar == '\n' && lastChar != '\r' && m_pObserver) m_pObserver->SetLineNumber(++m_nLineNo); + + lastChar = m_pkgChar; GetNextChar(); } @@ -1563,14 +1596,14 @@ m_token=m_pkgChar; GetNextChar(); } - } +} BOOL CParsePkg::GetStringToken() // Purpose : Parse a quoted string from the input line // Inputs : m_pkgPtr - The string to parse // pszString - The output string // wMaxLength - The max length of pszString - { +{ DWORD wCount = 0; BOOL done=FALSE; BOOL finished=FALSE; @@ -1588,7 +1621,7 @@ GetNextChar(); } if(m_pkgChar == '\0') - throw ErrBadString; + STUPID_THROW( ErrBadString ) GetNextChar(); done=TRUE; } @@ -1609,10 +1642,10 @@ m_tokenValue.pszString[wCount] = L'\0'; return done; - } +} WORD CParsePkg::ParseEscapeChars() - { +{ WORD found=0; WCHAR temp[MAX_STRING]; while (m_pkgChar == '<') @@ -1639,7 +1672,7 @@ } DWORD num=m_tokenValue.dwNumber; // watch for CP1252 escapes which aren't appropriate for UNICODE - if (num>=0x80 && num<=0x9F) throw ErrInvalidEscape; + if (num>=0x80 && num<=0x9F) STUPID_THROW( ErrInvalidEscape ) DWORD len=wcslen(temp); wcscpy(m_tokenValue.pszString,temp); if (len+2<=MAX_STRING) @@ -1651,14 +1684,14 @@ GetNextChar(); } return found; - } +} void CParsePkg::GetAlphaNumericToken() // Purpose : Parse an alphanumeric string from the input line // Inputs : m_pkgPtr - The string to parse // pszString - The output string // wMaxLength - The max length of pszString - { +{ WORD wCount = 0; while(m_pkgChar && __iscsym(m_pkgChar)) { @@ -1667,11 +1700,11 @@ GetNextChar(); } m_tokenValue.pszString[wCount] = L'\0'; - } +} BOOL CParsePkg::IsNumericToken() // Purpose : Determines if the next lexeme is a numeric token - { +{ BOOL lexemeIsNumber = FALSE; if (iswdigit(m_pkgChar)) lexemeIsNumber = TRUE; @@ -1688,14 +1721,14 @@ } return lexemeIsNumber; - } +} void CParsePkg::GetNumericToken() // Purpose : Parse a number from the input line // Inputs : m_pkgPtr - The string to parse // pdwNumber - The output number - { +{ WCHAR temp[MAX_STRING]; LPWSTR end; BOOL hexString = FALSE; @@ -1705,25 +1738,25 @@ temp[0]=m_pkgChar; if (!::ReadFile(m_file, &temp[1], (MAX_STRING-2)*2, &dwBytesRead, NULL) || dwBytesRead==0) - throw ErrReadFailed; + STUPID_THROW( ErrReadFailed ) temp[1+dwBytesRead/2]='\0'; hexString = (!wcsnicmp(temp, L"0x", 2) || !wcsnicmp(&temp[1], L"0x", 2)); m_tokenValue.dwNumber = wcstol(temp, &end, (hexString) ? 16 : 10); - if (end==temp) throw ErrReadFailed; + if (end==temp) STUPID_THROW( ErrReadFailed ) if (errno==ERANGE) - throw ErrNumberOutOfRange; + STUPID_THROW( ErrNumberOutOfRange ) ::SetFilePointer(m_file, fileOffset+(end-temp-1)*2, NULL, FILE_BEGIN); GetNextChar(); - } +} void CParsePkg::GetNextChar() - { +{ DWORD dwBytesRead; if (!::ReadFile(m_file, (LPVOID)&m_pkgChar, sizeof(WCHAR), &dwBytesRead, NULL) || dwBytesRead!=sizeof(WCHAR)) m_pkgChar='\0'; - } +} BOOL CParsePkg::DoesExist(LPWSTR pszFile, DWORD *pdwSize) // Purpose : Attempt to determine whether the file exists (w. or W.out the search path), and gets @@ -1731,7 +1764,7 @@ // Inputs : pszFile - The file to find (as a UNICODE string) // pdwSize - store its size here (set to zero if not found) // Returns : Yes or No - { +{ BOOL fFound = FALSE; *pdwSize = 0; @@ -1766,10 +1799,125 @@ catch (TUtilsException excp) { // ignore error if writing a stub file - if (!m_stubFile) throw excp; - m_pObserver->DoVerbage(_T("warning :file does not exist")); + if (!m_stubFile) STUPID_THROW( excp ) + m_pObserver->DoVerbage(_T("warning: file does not exist")); + fFound=TRUE; + } + return fFound; +} + + +BOOL CParsePkg::DoesDirExist(LPWSTR pszFile) +// Purpose : Attempt to determine whether the dir exists (w. or W.out the search path). +// Inputs : pszFile - The dir to find (as a UNICODE string) +// Returns : Yes or No +{ + BOOL fFound = FALSE; + + try + { + DWORD attributes = ::GetFileAttributesW( pszFile ); + if ( attributes == FILE_ATTRIBUTE_DIRECTORY ) + { + fFound = TRUE; + } + else + { + // If we are using a search directory + if(m_pszSearchDir[0] != '\0') + { + WCHAR pszNewPath[MAX_PATH]; + wcscpy(pszNewPath, m_pszSearchDir); + wcscat(pszNewPath, pszFile); + + DWORD attributes = ::GetFileAttributesW( pszNewPath ); + if ( attributes == FILE_ATTRIBUTE_DIRECTORY ) + { + fFound = TRUE; + } + } + } + } + catch (TUtilsException excp) + { + // ignore error if writing a stub file + if (!m_stubFile) STUPID_THROW( excp ) + m_pObserver->DoVerbage(_T("warning: file does not exist")); fFound=TRUE; } return fFound; +} + + + + +void CParsePkg::ProcessFolderL( LPCWSTR pszSourceFolder, LPCWSTR pszDestinationFolder ) +{ + WCHAR folder[ MAX_PATH ]; + wcscpy( folder, pszSourceFolder ); + if ( folder[ wcslen( folder ) - 1 ] != '\\' ) + { + wprintf( L"WARNING: Appending \\ to folder name %s\n" , folder ); + wcscat( folder, L"\\" ); + } + + WCHAR destination[ MAX_PATH ]; + wcscpy( destination, pszDestinationFolder ); + if ( destination[ wcslen( destination ) - 1 ] != '\\' ) + { + wprintf( L"WARNING: Appending \\ to destination %s\n" , destination ); + wcscat( destination, L"\\" ); + } + + wprintf( L"Adding folder %s\n", folder ); + //wprintf( L"-> %s\n", pNode->file->pszDest ); + + DIR * dir = opendir( folder ); + if ( dir == NULL ) + { + STUPID_THROW( ErrFileNotFound ) + } + + while ( dirent * entry = readdir( dir ) ) + { + if ( wcscmp( L".", entry->d_name ) == 0 ) + { + continue; + } + if ( wcscmp( L"..", entry->d_name ) == 0 ) + { + continue; + } + if ( wcscmp( L"CVS", entry->d_name ) == 0 ) + { + continue; } + PKGLINENODE *pNode = new PKGLINENODE; + if (!pNode) STUPID_THROW( ErrNotEnoughMemory ) + memset((void *)pNode, '\0', sizeof(PKGLINENODE)); + pNode->iPackageLineType=EInstPkgLineFile; + pNode->file = new PKGLINEFILE; + if (!pNode->file) STUPID_THROW( ErrNotEnoughMemory ) + memset((void *)pNode->file, '\0', sizeof(PKGLINEFILE)); + pNode->file->type=EInstFileTypeSimple; + wcscpy(pNode->file->pszSource, folder ); + wcscat(pNode->file->pszSource, entry->d_name ); + wcscpy(pNode->file->pszDest, destination ); + wcscat(pNode->file->pszDest, entry->d_name ); + + if ( DoesDirExist( pNode->file->pszSource ) ) + { + wcscat(pNode->file->pszSource, L"\\" ); + wcscat(pNode->file->pszDest, L"\\" ); + ProcessFolderL( pNode->file->pszSource, pNode->file->pszDest ); + delete pNode; + } + else + { + m_pSISWriter->AddPkgLineNode(pNode); + } + } + + closedir( dir ); +} \ No newline at end of file diff -b -B -r -d -u SDN-Makesis-srcrelApr03/appinst/makesis/UTILS.CPP SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis/UTILS.CPP --- SDN-Makesis-srcrelApr03/appinst/makesis/UTILS.CPP Mon Apr 28 15:38:04 2003 +++ SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis/UTILS.CPP Thu Oct 30 14:27:25 2003 @@ -25,7 +25,7 @@ // get num unicode chars required DWORD len = MultiByteToWideChar(codePage, 0, mbStr, length, NULL, 0); unicodeStr = new WCHAR[len+1]; - if (!unicodeStr) throw ErrNotEnoughMemory; + if (!unicodeStr) STUPID_THROW( ErrNotEnoughMemory ) // convert MultiByteToWideChar(codePage, 0, mbStr, length, unicodeStr, len); unicodeStr[len]='\0'; @@ -41,7 +41,7 @@ // get num unicode chars required DWORD len = WideCharToMultiByte(codePage, 0, uniStr, length, NULL, 0, NULL, NULL); mbStr = new CHAR[len+1]; - if (!mbStr) throw ErrNotEnoughMemory; + if (!mbStr) STUPID_THROW( ErrNotEnoughMemory ) // convert WideCharToMultiByte(codePage, 0, uniStr, length, mbStr, len, NULL, NULL); mbStr[len]='\0'; @@ -59,7 +59,7 @@ HANDLE hFile = ::MakeSISOpenFile(fileName, GENERIC_READ, OPEN_EXISTING); if(hFile == INVALID_HANDLE_VALUE) - throw ErrCannotOpenFile; + STUPID_THROW( ErrCannotOpenFile ) // Make sure we're at the beginning of the file ::SetFilePointer(hFile, 0L, NULL, FILE_BEGIN); @@ -68,7 +68,7 @@ ::CloseHandle(hFile); - if (!ok) throw ErrCannotReadFile; + if (!ok) STUPID_THROW( ErrCannotReadFile ) if (dwNumBytes==sizeof(WCHAR) && pBuf==0xFEFF) { @@ -99,15 +99,15 @@ // open file & get file size hFile = ::MakeSISOpenFile(fileName, GENERIC_READ, OPEN_EXISTING); - if(hFile == INVALID_HANDLE_VALUE) throw ErrCannotOpenFile; + if(hFile == INVALID_HANDLE_VALUE) STUPID_THROW( ErrCannotOpenFile ) fileSize = ::GetFileSize(hFile, NULL); // read in whole file pBuf = new WCHAR [fileSize/2]; - if (!pBuf) throw ErrNotEnoughMemory; + if (!pBuf) STUPID_THROW( ErrNotEnoughMemory ) ok=::ReadFile(hFile, (LPVOID)pBuf, fileSize, &dwNumBytes, NULL); ::CloseHandle(hFile); - if (!ok) throw ErrCannotReadFile; + if (!ok) STUPID_THROW( ErrCannotReadFile ) // convert text to little endian unicode for (DWORD i=0; i + +#define STUPID_THROW( ex ) { printf( "[%s:%d] %s\n", __FUNCTION__, __LINE__, # ex ); throw ex; } + + + // =========================================================================== // INCLUDES // =========================================================================== Only in SDN-Makesis-srcrelApr03-patchedOct03/appinst/makesis: test Only in SDN-Makesis-srcrelApr03-patchedOct03/ezlib/Zlib: zlib.sln Only in SDN-Makesis-srcrelApr03-patchedOct03/ezlib/Zlib: zlib.suo Only in SDN-Makesis-srcrelApr03-patchedOct03/ezlib/Zlib: zlib.vcproj