setup.cpp (001d9c42) | setup.cpp (97c864cc) |
---|---|
1/************************************************************** | 1/************************************************************** |
2 * | 2 * |
3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at | 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at |
10 * | 10 * |
11 * http://www.apache.org/licenses/LICENSE-2.0 | 11 * http://www.apache.org/licenses/LICENSE-2.0 |
12 * | 12 * |
13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. | 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. |
19 * | 19 * |
20 *************************************************************/ 21 22 23 24#define WIN // scope W32 API 25 26#if defined _MSC_VER 27#pragma warning(push, 1) --- 137 unchanged lines hidden (view full) --- 165 delete [] m_ppLanguageList; 166 } 167 168 time_t aTime; 169 time( &aTime ); 170 tm *pTime = localtime( &aTime ); // Convert time to struct tm form 171 172 Log( TEXT( "End: %s\n\r\n\r\n" ), _tasctime( pTime ) ); | 20 *************************************************************/ 21 22 23 24#define WIN // scope W32 API 25 26#if defined _MSC_VER 27#pragma warning(push, 1) --- 137 unchanged lines hidden (view full) --- 165 delete [] m_ppLanguageList; 166 } 167 168 time_t aTime; 169 time( &aTime ); 170 tm *pTime = localtime( &aTime ); // Convert time to struct tm form 171 172 Log( TEXT( "End: %s\n\r\n\r\n" ), _tasctime( pTime ) ); |
173 | 173 |
174 if ( m_pLogFile ) fclose( m_pLogFile ); 175 176 if ( m_pTmpName ) 177 { 178 _tremove( m_pTmpName ); 179 free( m_pTmpName ); 180 } 181 --- 34 unchanged lines hidden (view full) --- 216 return false; 217 } 218 219 if ( ! GetCmdLineParameters( &m_pCmdLine ) ) 220 return false; 221 222 m_hMapFile = CreateFileMapping( 223 INVALID_HANDLE_VALUE, // use paging file | 174 if ( m_pLogFile ) fclose( m_pLogFile ); 175 176 if ( m_pTmpName ) 177 { 178 _tremove( m_pTmpName ); 179 free( m_pTmpName ); 180 } 181 --- 34 unchanged lines hidden (view full) --- 216 return false; 217 } 218 219 if ( ! GetCmdLineParameters( &m_pCmdLine ) ) 220 return false; 221 222 m_hMapFile = CreateFileMapping( 223 INVALID_HANDLE_VALUE, // use paging file |
224 NULL, // default security | 224 NULL, // default security |
225 PAGE_READWRITE, // read/write access | 225 PAGE_READWRITE, // read/write access |
226 0, // max. object size 227 sizeof( int ), // buffer size | 226 0, // max. object size 227 sizeof( int ), // buffer size |
228 sMemMapName ); 229 if ( m_hMapFile ) 230 { 231 m_pMSIErrorCode = (int*) MapViewOfFile( m_hMapFile, // handle to map object 232 FILE_MAP_ALL_ACCESS, // read/write permission | 228 sMemMapName ); 229 if ( m_hMapFile ) 230 { 231 m_pMSIErrorCode = (int*) MapViewOfFile( m_hMapFile, // handle to map object 232 FILE_MAP_ALL_ACCESS, // read/write permission |
233 0, | |
234 0, | 233 0, |
234 0, |
|
235 sizeof( int ) ); 236 if ( m_pMSIErrorCode ) 237 *m_pMSIErrorCode = 0; 238 else 239 OutputDebugStringFormat( TEXT("Could not map view of file (%d).\n"), GetLastError() ); 240 } 241 else 242 OutputDebugStringFormat( TEXT("Could not create file mapping object (%d).\n"), GetLastError() ); 243 244 Log( TEXT("Starting: %s\r\n"), m_pModuleFile ); 245 Log( TEXT(" CommandLine=<%s>\r\n"), m_pCmdLine ); | 235 sizeof( int ) ); 236 if ( m_pMSIErrorCode ) 237 *m_pMSIErrorCode = 0; 238 else 239 OutputDebugStringFormat( TEXT("Could not map view of file (%d).\n"), GetLastError() ); 240 } 241 else 242 OutputDebugStringFormat( TEXT("Could not create file mapping object (%d).\n"), GetLastError() ); 243 244 Log( TEXT("Starting: %s\r\n"), m_pModuleFile ); 245 Log( TEXT(" CommandLine=<%s>\r\n"), m_pCmdLine ); |
246 | 246 |
247 if ( m_bQuiet ) 248 Log( TEXT(" Using quiet install mode\r\n") ); 249 250 time_t aTime; 251 time( &aTime ); 252 tm* pTime = localtime( &aTime ); 253 Log( TEXT(" Begin: %s\n"), _tasctime( pTime ) ); 254 --- 22 unchanged lines hidden (view full) --- 277 278 nRet = GetPrivateProfileSection( pSection, *pRetBuf, rSize, pFileName ); 279 } 280 } 281 282 if ( !nRet ) 283 { 284 SetError( WIN::GetLastError() ); | 247 if ( m_bQuiet ) 248 Log( TEXT(" Using quiet install mode\r\n") ); 249 250 time_t aTime; 251 time( &aTime ); 252 tm* pTime = localtime( &aTime ); 253 Log( TEXT(" Begin: %s\n"), _tasctime( pTime ) ); 254 --- 22 unchanged lines hidden (view full) --- 277 278 nRet = GetPrivateProfileSection( pSection, *pRetBuf, rSize, pFileName ); 279 } 280 } 281 282 if ( !nRet ) 283 { 284 SetError( WIN::GetLastError() ); |
285 | 285 |
286 TCHAR sBuf[80]; 287 StringCchPrintf( sBuf, 80, TEXT("ERROR: GetPrivateProfileSection(): GetLastError returned %u\r\n"), GetError() ); 288 Log( sBuf ); 289 return false; 290 } 291 else if ( nRet + 2 > rSize ) 292 { 293 SetError( ERROR_OUTOFMEMORY ); --- 40 unchanged lines hidden (view full) --- 334 { 335 LPTSTR pCurLine = pRetBuf; 336 while ( *pCurLine ) 337 { 338 LPTSTR pName = 0; 339 LPTSTR pValue = 0; 340 341 pCurLine += GetNameValue( pCurLine, &pName, &pValue ); | 286 TCHAR sBuf[80]; 287 StringCchPrintf( sBuf, 80, TEXT("ERROR: GetPrivateProfileSection(): GetLastError returned %u\r\n"), GetError() ); 288 Log( sBuf ); 289 return false; 290 } 291 else if ( nRet + 2 > rSize ) 292 { 293 SetError( ERROR_OUTOFMEMORY ); --- 40 unchanged lines hidden (view full) --- 334 { 335 LPTSTR pCurLine = pRetBuf; 336 while ( *pCurLine ) 337 { 338 LPTSTR pName = 0; 339 LPTSTR pValue = 0; 340 341 pCurLine += GetNameValue( pCurLine, &pName, &pValue ); |
342 | 342 |
343 if ( lstrcmpi( TEXT( "database" ), pName ) == 0 ) 344 { 345 m_pDatabase = pValue; 346 Log( TEXT( " Database = %s\r\n" ), pValue ); 347 } 348 else if ( lstrcmpi( TEXT( "msiversion" ), pName ) == 0 ) 349 { 350 m_pReqVersion = pValue; --- 49 unchanged lines hidden (view full) --- 400 nNext = GetNameValue( pCurLine, &pName, &pValue ); 401 if ( lstrcmpi( TEXT( "count" ), pName ) == 0 ) 402 { 403 Log( TEXT( " Languages = %s\r\n" ), pValue ); 404 m_nLanguageCount = _tcstol( pValue, &pLastChar, 10 ); 405 pCurLine += nNext; 406 delete [] pValue; 407 } | 343 if ( lstrcmpi( TEXT( "database" ), pName ) == 0 ) 344 { 345 m_pDatabase = pValue; 346 Log( TEXT( " Database = %s\r\n" ), pValue ); 347 } 348 else if ( lstrcmpi( TEXT( "msiversion" ), pName ) == 0 ) 349 { 350 m_pReqVersion = pValue; --- 49 unchanged lines hidden (view full) --- 400 nNext = GetNameValue( pCurLine, &pName, &pValue ); 401 if ( lstrcmpi( TEXT( "count" ), pName ) == 0 ) 402 { 403 Log( TEXT( " Languages = %s\r\n" ), pValue ); 404 m_nLanguageCount = _tcstol( pValue, &pLastChar, 10 ); 405 pCurLine += nNext; 406 delete [] pValue; 407 } |
408 | 408 |
409 m_ppLanguageList = new LanguageDataX*[ m_nLanguageCount ]; 410 411 for ( int i=0; i < m_nLanguageCount; i++ ) 412 { 413 if ( !*pCurLine ) 414 { 415 m_nLanguageCount = i; 416 break; 417 } | 409 m_ppLanguageList = new LanguageDataX*[ m_nLanguageCount ]; 410 411 for ( int i=0; i < m_nLanguageCount; i++ ) 412 { 413 if ( !*pCurLine ) 414 { 415 m_nLanguageCount = i; 416 break; 417 } |
418 | 418 |
419 pCurLine += GetNameValue( pCurLine, &pName, &pValue ); 420 m_ppLanguageList[ i ] = new LanguageDataX( pValue ); 421 Log( TEXT( " Language = %s\r\n" ), pValue ); 422 423 if ( m_ppLanguageList[ i ]->m_pTransform ) 424 Log( TEXT( " Transform = %s\r\n" ), m_ppLanguageList[ i ]->m_pTransform ); 425 426 delete [] pValue; 427 } 428 } | 419 pCurLine += GetNameValue( pCurLine, &pName, &pValue ); 420 m_ppLanguageList[ i ] = new LanguageDataX( pValue ); 421 Log( TEXT( " Language = %s\r\n" ), pValue ); 422 423 if ( m_ppLanguageList[ i ]->m_pTransform ) 424 Log( TEXT( " Transform = %s\r\n" ), m_ppLanguageList[ i ]->m_pTransform ); 425 426 delete [] pValue; 427 } 428 } |
429 | 429 |
430 if ( pRetBuf ) 431 delete [] pRetBuf; 432 } 433 434 if ( sProfilePath && ! m_pTmpName ) 435 delete [] sProfilePath; 436 437 return bRet; --- 31 unchanged lines hidden (view full) --- 469 bRet = false; 470 } 471 else 472 { 473 if ( pFilePart ) 474 *pFilePart = '\0'; 475 StringCchCopy( pBaseDir, nPatternLen, pPattern ); 476 StringCchCat( pPattern, nPatternLen, TEXT("*.msp") ); | 430 if ( pRetBuf ) 431 delete [] pRetBuf; 432 } 433 434 if ( sProfilePath && ! m_pTmpName ) 435 delete [] sProfilePath; 436 437 return bRet; --- 31 unchanged lines hidden (view full) --- 469 bRet = false; 470 } 471 else 472 { 473 if ( pFilePart ) 474 *pFilePart = '\0'; 475 StringCchCopy( pBaseDir, nPatternLen, pPattern ); 476 StringCchCat( pPattern, nPatternLen, TEXT("*.msp") ); |
477 | 477 |
478 WIN32_FIND_DATA aFindFileData; | 478 WIN32_FIND_DATA aFindFileData; |
479 | 479 |
480 HANDLE hFindPatches = FindFirstFile( pPattern, &aFindFileData ); | 480 HANDLE hFindPatches = FindFirstFile( pPattern, &aFindFileData ); |
481 | 481 |
482 if ( hFindPatches != INVALID_HANDLE_VALUE ) 483 { 484 if ( ! IsPatchInstalled( pBaseDir, aFindFileData.cFileName ) ) 485 AddFileToPatchList( pBaseDir, aFindFileData.cFileName ); | 482 if ( hFindPatches != INVALID_HANDLE_VALUE ) 483 { 484 if ( ! IsPatchInstalled( pBaseDir, aFindFileData.cFileName ) ) 485 AddFileToPatchList( pBaseDir, aFindFileData.cFileName ); |
486 | 486 |
487 while ( FindNextFile( hFindPatches, &aFindFileData ) ) 488 { 489 if ( ! IsPatchInstalled( pBaseDir, aFindFileData.cFileName ) ) 490 AddFileToPatchList( pBaseDir, aFindFileData.cFileName ); 491 } 492 493 if ( m_pPatchFiles != NULL ) 494 StringCchCat( m_pPatchFiles, MAX_STR_LENGTH, TEXT("\"") ); 495 496 FindClose( hFindPatches ); 497 } 498 } 499 500 delete [] pPattern; 501 delete [] pBaseDir; | 487 while ( FindNextFile( hFindPatches, &aFindFileData ) ) 488 { 489 if ( ! IsPatchInstalled( pBaseDir, aFindFileData.cFileName ) ) 490 AddFileToPatchList( pBaseDir, aFindFileData.cFileName ); 491 } 492 493 if ( m_pPatchFiles != NULL ) 494 StringCchCat( m_pPatchFiles, MAX_STR_LENGTH, TEXT("\"") ); 495 496 FindClose( hFindPatches ); 497 } 498 } 499 500 delete [] pPattern; 501 delete [] pBaseDir; |
502 | 502 |
503 return bRet; 504} 505 506//-------------------------------------------------------------------------- 507boolean SetupAppX::GetPathToFile( TCHAR* pFileName, TCHAR** pPath ) 508{ | 503 return bRet; 504} 505 506//-------------------------------------------------------------------------- 507boolean SetupAppX::GetPathToFile( TCHAR* pFileName, TCHAR** pPath ) 508{ |
509 // generate the path to the file = szModuleFile + FileName 510 // note: FileName is a relative path | 509 // generate the path to the file = szModuleFile + FileName 510 // note: FileName is a relative path |
511 512 boolean bRet = true; 513 514 int nTempPath = lstrlen( m_pModuleFile ) + lstrlen( pFileName ) + 2; // 1 for null terminator, 1 for back slash 515 TCHAR* pTempPath = new TCHAR[ nTempPath ]; 516 517 // find 'setup.exe' in the path so we can remove it 518 TCHAR *pFilePart = 0; --- 9 unchanged lines hidden (view full) --- 528 529 StringCchCat( pTempPath, nTempPath, pFileName ); 530 531 int nPath = 2 * nTempPath; 532 *pPath = new TCHAR[ nPath ]; 533 534 // normalize the path 535 int nReturn = GetFullPathName( pTempPath, nPath, *pPath, &pFilePart ); | 511 512 boolean bRet = true; 513 514 int nTempPath = lstrlen( m_pModuleFile ) + lstrlen( pFileName ) + 2; // 1 for null terminator, 1 for back slash 515 TCHAR* pTempPath = new TCHAR[ nTempPath ]; 516 517 // find 'setup.exe' in the path so we can remove it 518 TCHAR *pFilePart = 0; --- 9 unchanged lines hidden (view full) --- 528 529 StringCchCat( pTempPath, nTempPath, pFileName ); 530 531 int nPath = 2 * nTempPath; 532 *pPath = new TCHAR[ nPath ]; 533 534 // normalize the path 535 int nReturn = GetFullPathName( pTempPath, nPath, *pPath, &pFilePart ); |
536 | 536 |
537 if ( nReturn > nPath ) 538 { 539 // try again, with larger buffer 540 delete [] (*pPath); 541 nPath = nReturn; 542 *pPath = new TCHAR[ nPath ]; | 537 if ( nReturn > nPath ) 538 { 539 // try again, with larger buffer 540 delete [] (*pPath); 541 nPath = nReturn; 542 *pPath = new TCHAR[ nPath ]; |
543 | 543 |
544 nReturn = GetFullPathName( pTempPath, nPath, *pPath, &pFilePart ); 545 } | 544 nReturn = GetFullPathName( pTempPath, nPath, *pPath, &pFilePart ); 545 } |
546 | 546 |
547 if ( 0 == nReturn ) 548 { 549 // error -- invalid path 550 SetError( WIN::GetLastError() ); 551 bRet = false; 552 } 553 } 554 --- 17 unchanged lines hidden (view full) --- 572int SetupAppX::GetNameValue( TCHAR* pLine, TCHAR** pName, TCHAR** pValue ) 573{ 574 int nRet = lstrlen( pLine ) + 1; 575 *pValue = 0; 576 577 if ( nRet == 1 ) 578 return nRet; 579 | 547 if ( 0 == nReturn ) 548 { 549 // error -- invalid path 550 SetError( WIN::GetLastError() ); 551 bRet = false; 552 } 553 } 554 --- 17 unchanged lines hidden (view full) --- 572int SetupAppX::GetNameValue( TCHAR* pLine, TCHAR** pName, TCHAR** pValue ) 573{ 574 int nRet = lstrlen( pLine ) + 1; 575 *pValue = 0; 576 577 if ( nRet == 1 ) 578 return nRet; 579 |
580 LPTSTR pChar = pLine; 581 LPTSTR pLast = NULL; 582 | 580 LPTSTR pChar = pLine; 581 LPTSTR pLast = NULL; 582 |
583 // Skip leading spaces. 584 while (' ' == *pChar || '\t' == *pChar) 585 pChar = CharNext( pChar ); | 583 // Skip leading spaces. 584 while (' ' == *pChar || '\t' == *pChar) 585 pChar = CharNext( pChar ); |
586 | 586 |
587 *pName = pChar; 588 589 // look for the end of the name 590 while( *pChar && (' ' != *pChar) && 591 ( '\t' != *pChar ) && ( '=' != *pChar ) ) 592 pChar = CharNext( pChar ); 593 594 if ( ! *pChar ) --- 19 unchanged lines hidden (view full) --- 614 615//-------------------------------------------------------------------------- 616boolean SetupAppX::ChooseLanguage( long& rLanguage ) 617{ 618 rLanguage = 0; 619 620 if ( m_bQuiet ) 621 return true; | 587 *pName = pChar; 588 589 // look for the end of the name 590 while( *pChar && (' ' != *pChar) && 591 ( '\t' != *pChar ) && ( '=' != *pChar ) ) 592 pChar = CharNext( pChar ); 593 594 if ( ! *pChar ) --- 19 unchanged lines hidden (view full) --- 614 615//-------------------------------------------------------------------------- 616boolean SetupAppX::ChooseLanguage( long& rLanguage ) 617{ 618 rLanguage = 0; 619 620 if ( m_bQuiet ) 621 return true; |
622 | 622 |
623 // When there are none or only one language, there is nothing 624 // to do here 625 if ( m_nLanguageCount > 1 ) 626 { 627 TCHAR *sString = new TCHAR[ MAX_LANGUAGE_LEN ]; 628 629 LANGID nUserDefLang = GetUserDefaultLangID(); 630 LANGID nSysDefLang = GetSystemDefaultLangID(); | 623 // When there are none or only one language, there is nothing 624 // to do here 625 if ( m_nLanguageCount > 1 ) 626 { 627 TCHAR *sString = new TCHAR[ MAX_LANGUAGE_LEN ]; 628 629 LANGID nUserDefLang = GetUserDefaultLangID(); 630 LANGID nSysDefLang = GetSystemDefaultLangID(); |
631 | 631 |
632 int nUserPrimary = PRIMARYLANGID( nUserDefLang ); 633 int nSysPrimary = PRIMARYLANGID( nSysDefLang ); 634 635 long nUserIndex = -1; 636 long nUserPrimIndex = -1; 637 long nSystemIndex = -1; 638 long nSystemPrimIndex = -1; 639 long nParamIndex = -1; --- 58 unchanged lines hidden (view full) --- 698 return true; 699} 700 701//-------------------------------------------------------------------------- 702HMODULE SetupAppX::LoadMsiLibrary() 703{ 704 HMODULE hMsi = NULL; 705 HKEY hInstKey = NULL; | 632 int nUserPrimary = PRIMARYLANGID( nUserDefLang ); 633 int nSysPrimary = PRIMARYLANGID( nSysDefLang ); 634 635 long nUserIndex = -1; 636 long nUserPrimIndex = -1; 637 long nSystemIndex = -1; 638 long nSystemPrimIndex = -1; 639 long nParamIndex = -1; --- 58 unchanged lines hidden (view full) --- 698 return true; 699} 700 701//-------------------------------------------------------------------------- 702HMODULE SetupAppX::LoadMsiLibrary() 703{ 704 HMODULE hMsi = NULL; 705 HKEY hInstKey = NULL; |
706 | 706 |
707 // find registered location of Msi.dll 708 if ( ERROR_SUCCESS == RegOpenKeyEx( HKEY_LOCAL_MACHINE, sInstKey, 0, KEY_READ, &hInstKey ) ) 709 { 710 long nRet = ERROR_SUCCESS; 711 TCHAR *sMsiFolder = new TCHAR[ MAX_PATH + 1 ]; 712 DWORD dwMsiFolderSize = MAX_PATH + 1; 713 DWORD dwType = 0; 714 --- 16 unchanged lines hidden (view full) --- 731 732 if ( SUCCEEDED( StringCchCopy( pMsiLocation, nLength, sMsiFolder ) ) && 733 SUCCEEDED( StringCchCat( pMsiLocation, nLength, sMsiDll ) ) ) 734 { 735 hMsi = LoadLibrary( pMsiLocation ); 736 } 737 } 738 } | 707 // find registered location of Msi.dll 708 if ( ERROR_SUCCESS == RegOpenKeyEx( HKEY_LOCAL_MACHINE, sInstKey, 0, KEY_READ, &hInstKey ) ) 709 { 710 long nRet = ERROR_SUCCESS; 711 TCHAR *sMsiFolder = new TCHAR[ MAX_PATH + 1 ]; 712 DWORD dwMsiFolderSize = MAX_PATH + 1; 713 DWORD dwType = 0; 714 --- 16 unchanged lines hidden (view full) --- 731 732 if ( SUCCEEDED( StringCchCopy( pMsiLocation, nLength, sMsiFolder ) ) && 733 SUCCEEDED( StringCchCat( pMsiLocation, nLength, sMsiDll ) ) ) 734 { 735 hMsi = LoadLibrary( pMsiLocation ); 736 } 737 } 738 } |
739 | 739 |
740 if ( !hMsi ) // use the default location 741 { 742 hMsi = LoadLibrary( sMsiDll ); 743 } 744 745 return hMsi; 746} 747 748//-------------------------------------------------------------------------- 749LPCTSTR SetupAppX::GetPathToMSI() 750{ 751 LPTSTR sMsiPath = NULL; 752 HKEY hInstKey = NULL; 753 TCHAR *sMsiFolder = new TCHAR[ MAX_PATH + 1 ]; 754 DWORD nMsiFolderSize = MAX_PATH + 1; | 740 if ( !hMsi ) // use the default location 741 { 742 hMsi = LoadLibrary( sMsiDll ); 743 } 744 745 return hMsi; 746} 747 748//-------------------------------------------------------------------------- 749LPCTSTR SetupAppX::GetPathToMSI() 750{ 751 LPTSTR sMsiPath = NULL; 752 HKEY hInstKey = NULL; 753 TCHAR *sMsiFolder = new TCHAR[ MAX_PATH + 1 ]; 754 DWORD nMsiFolderSize = MAX_PATH + 1; |
755 | 755 |
756 sMsiFolder[0] = '\0'; 757 758 // find registered location of Msi.dll 759 if ( ERROR_SUCCESS == RegOpenKeyEx( HKEY_LOCAL_MACHINE, sInstKey, 0, KEY_READ, &hInstKey ) ) 760 { 761 LONG nRet = ERROR_SUCCESS; 762 DWORD dwType = 0; 763 --- 6 unchanged lines hidden (view full) --- 770 771 nRet = RegQueryValueEx( hInstKey, sInstLocValue, NULL, &dwType, 772 (BYTE*)sMsiFolder, &nMsiFolderSize ); 773 } 774 775 if ( ERROR_SUCCESS != nRet || dwType != REG_SZ || nMsiFolderSize == 0 ) 776 sMsiFolder[0] = '\0'; 777 } | 756 sMsiFolder[0] = '\0'; 757 758 // find registered location of Msi.dll 759 if ( ERROR_SUCCESS == RegOpenKeyEx( HKEY_LOCAL_MACHINE, sInstKey, 0, KEY_READ, &hInstKey ) ) 760 { 761 LONG nRet = ERROR_SUCCESS; 762 DWORD dwType = 0; 763 --- 6 unchanged lines hidden (view full) --- 770 771 nRet = RegQueryValueEx( hInstKey, sInstLocValue, NULL, &dwType, 772 (BYTE*)sMsiFolder, &nMsiFolderSize ); 773 } 774 775 if ( ERROR_SUCCESS != nRet || dwType != REG_SZ || nMsiFolderSize == 0 ) 776 sMsiFolder[0] = '\0'; 777 } |
778 | 778 |
779 if ( sMsiFolder[0] == '\0' ) // use the default location 780 { 781 Log( TEXT( " Could not find path to msiexec.exe in registry" ) ); 782 783 DWORD nRet = WIN::GetSystemDirectory( sMsiFolder, nMsiFolderSize ); 784 if ( nRet > nMsiFolderSize ) 785 { 786 delete [] sMsiFolder; --- 28 unchanged lines hidden (view full) --- 815 816 return sMsiPath; 817} 818 819//-------------------------------------------------------------------------- 820boolean SetupAppX::LaunchInstaller( LPCTSTR pParam ) 821{ 822 LPCTSTR sMsiPath = GetPathToMSI(); | 779 if ( sMsiFolder[0] == '\0' ) // use the default location 780 { 781 Log( TEXT( " Could not find path to msiexec.exe in registry" ) ); 782 783 DWORD nRet = WIN::GetSystemDirectory( sMsiFolder, nMsiFolderSize ); 784 if ( nRet > nMsiFolderSize ) 785 { 786 delete [] sMsiFolder; --- 28 unchanged lines hidden (view full) --- 815 816 return sMsiPath; 817} 818 819//-------------------------------------------------------------------------- 820boolean SetupAppX::LaunchInstaller( LPCTSTR pParam ) 821{ 822 LPCTSTR sMsiPath = GetPathToMSI(); |
823 | 823 |
824 if ( !sMsiPath ) 825 { 826 Log( TEXT( "ERROR: msiexec not found!" ) ); 827 SetError( ERROR_FILE_NOT_FOUND ); 828 return false; 829 } | 824 if ( !sMsiPath ) 825 { 826 Log( TEXT( "ERROR: msiexec not found!" ) ); 827 SetError( ERROR_FILE_NOT_FOUND ); 828 return false; 829 } |
830 | 830 |
831 STARTUPINFO aSUI; 832 PROCESS_INFORMATION aPI; 833 834 Log( TEXT( " Will install using <%s>\r\n" ), sMsiPath ); | 831 STARTUPINFO aSUI; 832 PROCESS_INFORMATION aPI; 833 834 Log( TEXT( " Will install using <%s>\r\n" ), sMsiPath ); |
835 Log( TEXT( " Prameters are: %s\r\n" ), pParam ); | 835 Log( TEXT( " Parameters are: %s\r\n" ), pParam ); |
836 837 OutputDebugStringFormat( TEXT( " Will install using <%s>\r\n" ), sMsiPath ); | 836 837 OutputDebugStringFormat( TEXT( " Will install using <%s>\r\n" ), sMsiPath ); |
838 OutputDebugStringFormat( TEXT( " Prameters are: %s\r\n" ), pParam ); | 838 OutputDebugStringFormat( TEXT( " Parameters are: %s\r\n" ), pParam ); |
839 840 ZeroMemory( (void*)&aPI, sizeof( PROCESS_INFORMATION ) ); 841 ZeroMemory( (void*)&aSUI, sizeof( STARTUPINFO ) ); 842 843 aSUI.cb = sizeof(STARTUPINFO); 844 aSUI.dwFlags = STARTF_USESHOWWINDOW; 845 aSUI.wShowWindow = SW_SHOW; 846 --- 93 unchanged lines hidden (view full) --- 940 nParLen += lstrlen( PARAM_REG_ALL_MSO_TYPES ); 941 942 if ( m_pAdvertise ) 943 nParLen += lstrlen( m_pAdvertise ) + 1; // one for the space 944 else if ( m_bIsMinorUpgrade ) 945 nParLen += lstrlen( PARAM_MINOR_UPGRADE ); 946 else 947 nParLen += lstrlen( PARAM_PACKAGE ); | 839 840 ZeroMemory( (void*)&aPI, sizeof( PROCESS_INFORMATION ) ); 841 ZeroMemory( (void*)&aSUI, sizeof( STARTUPINFO ) ); 842 843 aSUI.cb = sizeof(STARTUPINFO); 844 aSUI.dwFlags = STARTF_USESHOWWINDOW; 845 aSUI.wShowWindow = SW_SHOW; 846 --- 93 unchanged lines hidden (view full) --- 940 nParLen += lstrlen( PARAM_REG_ALL_MSO_TYPES ); 941 942 if ( m_pAdvertise ) 943 nParLen += lstrlen( m_pAdvertise ) + 1; // one for the space 944 else if ( m_bIsMinorUpgrade ) 945 nParLen += lstrlen( PARAM_MINOR_UPGRADE ); 946 else 947 nParLen += lstrlen( PARAM_PACKAGE ); |
948 | 948 |
949 nParLen += lstrlen( pDataBasePath ) + 3; // two quotes, one null | 949 nParLen += lstrlen( pDataBasePath ) + 3; // two quotes, one null |
950 | 950 |
951 if ( NeedReboot() ) 952 nParLen += lstrlen( PARAM_REBOOT ); 953 954 if ( m_pPatchFiles ) 955 { 956 nParLen += lstrlen( PARAM_PATCH ); 957 nParLen += lstrlen( m_pPatchFiles ); 958 } --- 87 unchanged lines hidden (view full) --- 1046 WIN::LoadString( m_hInst, IDS_FILE_NOT_FOUND, sTmp, MAX_TEXT_LENGTH ); 1047 StringCchPrintf( sError, MAX_TEXT_LENGTH, sTmp, m_pErrorText ); 1048 break; 1049 case ERROR_INVALID_DATA: // 13 1050 WIN::LoadString( m_hInst, IDS_INVALID_PROFILE, sError, MAX_TEXT_LENGTH ); 1051 break; 1052 case ERROR_OUTOFMEMORY: WIN::LoadString( m_hInst, IDS_OUTOFMEM, sError, MAX_TEXT_LENGTH ); 1053 break; | 951 if ( NeedReboot() ) 952 nParLen += lstrlen( PARAM_REBOOT ); 953 954 if ( m_pPatchFiles ) 955 { 956 nParLen += lstrlen( PARAM_PATCH ); 957 nParLen += lstrlen( m_pPatchFiles ); 958 } --- 87 unchanged lines hidden (view full) --- 1046 WIN::LoadString( m_hInst, IDS_FILE_NOT_FOUND, sTmp, MAX_TEXT_LENGTH ); 1047 StringCchPrintf( sError, MAX_TEXT_LENGTH, sTmp, m_pErrorText ); 1048 break; 1049 case ERROR_INVALID_DATA: // 13 1050 WIN::LoadString( m_hInst, IDS_INVALID_PROFILE, sError, MAX_TEXT_LENGTH ); 1051 break; 1052 case ERROR_OUTOFMEMORY: WIN::LoadString( m_hInst, IDS_OUTOFMEM, sError, MAX_TEXT_LENGTH ); 1053 break; |
1054 case ERROR_INSTALL_USEREXIT: | 1054 case ERROR_INSTALL_USEREXIT: |
1055 WIN::LoadString( m_hInst, IDS_USER_CANCELLED, sError, MAX_TEXT_LENGTH ); 1056 break; 1057 case ERROR_INSTALL_ALREADY_RUNNING: // 1618 1058 WIN::LoadString( m_hInst, IDS_ALREADY_RUNNING, sError, MAX_TEXT_LENGTH ); 1059 break; 1060 case ERROR_INSTALL_SOURCE_ABSENT: 1061 WIN::LoadString( m_hInst, IDS_NOMSI, sError, MAX_TEXT_LENGTH ); 1062 break; --- 98 unchanged lines hidden (view full) --- 1161 if ( !hMsi ) 1162 { 1163 Log( TEXT( "Error: No MSI found!\r\n" ) ); 1164 SetError( (UINT) ERROR_SETUP_NOT_FOUND ); 1165 } 1166 else 1167 { 1168 PFnDllGetVersion pDllGetVersion = (PFnDllGetVersion) GetProcAddress( hMsi, MSIAPI_DllGetVersion ); | 1055 WIN::LoadString( m_hInst, IDS_USER_CANCELLED, sError, MAX_TEXT_LENGTH ); 1056 break; 1057 case ERROR_INSTALL_ALREADY_RUNNING: // 1618 1058 WIN::LoadString( m_hInst, IDS_ALREADY_RUNNING, sError, MAX_TEXT_LENGTH ); 1059 break; 1060 case ERROR_INSTALL_SOURCE_ABSENT: 1061 WIN::LoadString( m_hInst, IDS_NOMSI, sError, MAX_TEXT_LENGTH ); 1062 break; --- 98 unchanged lines hidden (view full) --- 1161 if ( !hMsi ) 1162 { 1163 Log( TEXT( "Error: No MSI found!\r\n" ) ); 1164 SetError( (UINT) ERROR_SETUP_NOT_FOUND ); 1165 } 1166 else 1167 { 1168 PFnDllGetVersion pDllGetVersion = (PFnDllGetVersion) GetProcAddress( hMsi, MSIAPI_DllGetVersion ); |
1169 | 1169 |
1170 if ( pDllGetVersion ) 1171 { 1172 DLLVERSIONINFO aInfo; | 1170 if ( pDllGetVersion ) 1171 { 1172 DLLVERSIONINFO aInfo; |
1173 | 1173 |
1174 aInfo.cbSize = sizeof( DLLVERSIONINFO ); 1175 if ( NOERROR == pDllGetVersion( &aInfo ) ) 1176 { 1177 TCHAR pMsiVersion[ VERSION_SIZE ]; 1178 StringCchPrintf( pMsiVersion, VERSION_SIZE, TEXT("%d.%d.%4d"), 1179 aInfo.dwMajorVersion, 1180 aInfo.dwMinorVersion, 1181 aInfo.dwBuildNumber ); --- 9 unchanged lines hidden (view full) --- 1191 bRet = true; 1192 } 1193 if ( aInfo.dwMajorVersion >= 3 ) 1194 m_bSupportsPatch = true; 1195 else 1196 Log( TEXT("Warning: Patching not supported! MSI-Version <%s>\r\n"), pMsiVersion ); 1197 } 1198 } | 1174 aInfo.cbSize = sizeof( DLLVERSIONINFO ); 1175 if ( NOERROR == pDllGetVersion( &aInfo ) ) 1176 { 1177 TCHAR pMsiVersion[ VERSION_SIZE ]; 1178 StringCchPrintf( pMsiVersion, VERSION_SIZE, TEXT("%d.%d.%4d"), 1179 aInfo.dwMajorVersion, 1180 aInfo.dwMinorVersion, 1181 aInfo.dwBuildNumber ); --- 9 unchanged lines hidden (view full) --- 1191 bRet = true; 1192 } 1193 if ( aInfo.dwMajorVersion >= 3 ) 1194 m_bSupportsPatch = true; 1195 else 1196 Log( TEXT("Warning: Patching not supported! MSI-Version <%s>\r\n"), pMsiVersion ); 1197 } 1198 } |
1199 | 1199 |
1200 FreeLibrary( hMsi ); 1201 } 1202 1203 return bRet; 1204} 1205 1206//-------------------------------------------------------------------------- 1207boolean SetupAppX::CheckForUpgrade() --- 22 unchanged lines hidden (view full) --- 1230 else 1231 { 1232 Log( TEXT( " Didn't Find Upgrade Key in Registry -> continue with standard installation!\r\n" ) ); 1233 return true; 1234 } 1235 1236 if ( m_pProductVersion && ( _tcslen( m_pProductVersion ) > 0 ) ) 1237 { | 1200 FreeLibrary( hMsi ); 1201 } 1202 1203 return bRet; 1204} 1205 1206//-------------------------------------------------------------------------- 1207boolean SetupAppX::CheckForUpgrade() --- 22 unchanged lines hidden (view full) --- 1230 else 1231 { 1232 Log( TEXT( " Didn't Find Upgrade Key in Registry -> continue with standard installation!\r\n" ) ); 1233 return true; 1234 } 1235 1236 if ( m_pProductVersion && ( _tcslen( m_pProductVersion ) > 0 ) ) 1237 { |
1238 TCHAR *sProductVersion = new TCHAR[ MAX_PATH + 1 ]; 1239 DWORD nSize = MAX_PATH + 1; | 1238 TCHAR *sProductVersion = new TCHAR[ MAX_PATH + 1 ]; 1239 DWORD nSize = MAX_PATH + 1; |
1240 1241 sProductVersion[0] = '\0'; 1242 1243 // get product version 1244 if ( ERROR_SUCCESS == RegQueryValueEx( hInstKey, PRODUCT_VERSION, NULL, NULL, (LPBYTE)sProductVersion, &nSize ) ) 1245 { 1246 if ( lstrcmpi( sProductVersion, m_pProductVersion ) == 0 ) 1247 { --- 206 unchanged lines hidden (view full) --- 1454 nCount -= 1; 1455 } 1456 } 1457 1458 pChar = CharNext( pChar ); 1459 nCount += 1; 1460 } 1461 } | 1240 1241 sProductVersion[0] = '\0'; 1242 1243 // get product version 1244 if ( ERROR_SUCCESS == RegQueryValueEx( hInstKey, PRODUCT_VERSION, NULL, NULL, (LPBYTE)sProductVersion, &nSize ) ) 1245 { 1246 if ( lstrcmpi( sProductVersion, m_pProductVersion ) == 0 ) 1247 { --- 206 unchanged lines hidden (view full) --- 1454 nCount -= 1; 1455 } 1456 } 1457 1458 pChar = CharNext( pChar ); 1459 nCount += 1; 1460 } 1461 } |
1462 | 1462 |
1463 if ( pArg ) 1464 { 1465 *pArg = new TCHAR[ nCount ]; 1466 StringCchCopyN ( *pArg, nCount, pFirst, nCount-1 ); 1467 } | 1463 if ( pArg ) 1464 { 1465 *pArg = new TCHAR[ nCount ]; 1466 StringCchCopyN ( *pArg, nCount, pFirst, nCount-1 ); 1467 } |
1468 | 1468 |
1469 if ( pNext ) 1470 *pNext = CharNext( pChar ); | 1469 if ( pNext ) 1470 *pNext = CharNext( pChar ); |
1471 | 1471 |
1472 return ERROR_SUCCESS; 1473} 1474 1475//-------------------------------------------------------------------------- 1476boolean SetupAppX::GetCmdLineParameters( LPTSTR *pCmdLine ) 1477{ 1478 int nRet = ERROR_SUCCESS; 1479 LPTSTR pStart = NULL; --- 73 unchanged lines hidden (view full) --- 1553 nRet = ERROR_OUTOFMEMORY; 1554 break; 1555 } 1556 1557 if ( bAppend ) 1558 m_pLogFile = _tfopen( pFileName, TEXT( "ab" ) ); 1559 else 1560 m_pLogFile = _tfopen( pFileName, TEXT( "wb" ) ); | 1472 return ERROR_SUCCESS; 1473} 1474 1475//-------------------------------------------------------------------------- 1476boolean SetupAppX::GetCmdLineParameters( LPTSTR *pCmdLine ) 1477{ 1478 int nRet = ERROR_SUCCESS; 1479 LPTSTR pStart = NULL; --- 73 unchanged lines hidden (view full) --- 1553 nRet = ERROR_OUTOFMEMORY; 1554 break; 1555 } 1556 1557 if ( bAppend ) 1558 m_pLogFile = _tfopen( pFileName, TEXT( "ab" ) ); 1559 else 1560 m_pLogFile = _tfopen( pFileName, TEXT( "wb" ) ); |
1561 | 1561 |
1562 delete [] pFileName; 1563 } 1564 } 1565 else if ( (*pSub) == 'q' || (*pSub) == 'Q' ) 1566 { // --- Handle quiet file parameter --- 1567 pSub = CharNext( pSub ); 1568 if ( ! (*pSub) || (*pSub) == 'n' || (*pSub) == 'N' ) 1569 m_bQuiet = true; --- 80 unchanged lines hidden (view full) --- 1650//-------------------------------------------------------------------------- 1651boolean SetupAppX::IsAdmin() 1652{ 1653 if ( IsWin9x() ) 1654 return true; 1655 1656 PSID aPsidAdmin; 1657 SID_IDENTIFIER_AUTHORITY aAuthority = SECURITY_NT_AUTHORITY; | 1562 delete [] pFileName; 1563 } 1564 } 1565 else if ( (*pSub) == 'q' || (*pSub) == 'Q' ) 1566 { // --- Handle quiet file parameter --- 1567 pSub = CharNext( pSub ); 1568 if ( ! (*pSub) || (*pSub) == 'n' || (*pSub) == 'N' ) 1569 m_bQuiet = true; --- 80 unchanged lines hidden (view full) --- 1650//-------------------------------------------------------------------------- 1651boolean SetupAppX::IsAdmin() 1652{ 1653 if ( IsWin9x() ) 1654 return true; 1655 1656 PSID aPsidAdmin; 1657 SID_IDENTIFIER_AUTHORITY aAuthority = SECURITY_NT_AUTHORITY; |
1658 | 1658 |
1659 if ( !AllocateAndInitializeSid( &aAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, 1660 DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, 1661 &aPsidAdmin ) ) 1662 return false; 1663 1664 BOOL bIsAdmin = FALSE; 1665 | 1659 if ( !AllocateAndInitializeSid( &aAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, 1660 DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, 1661 &aPsidAdmin ) ) 1662 return false; 1663 1664 BOOL bIsAdmin = FALSE; 1665 |
1666 if ( GetOSVersion() >= 5 ) | 1666 if ( GetOSVersion() >= 5 ) |
1667 { 1668 HMODULE hAdvapi32 = LoadLibrary( ADVAPI32_DLL ); | 1667 { 1668 HMODULE hAdvapi32 = LoadLibrary( ADVAPI32_DLL ); |
1669 | 1669 |
1670 if ( !hAdvapi32 ) 1671 bIsAdmin = FALSE; 1672 else 1673 { 1674 PFnCheckTokenMembership pfnCheckTokenMembership = (PFnCheckTokenMembership) GetProcAddress( hAdvapi32, ADVAPI32API_CheckTokenMembership); 1675 if ( !pfnCheckTokenMembership || !pfnCheckTokenMembership( NULL, aPsidAdmin, &bIsAdmin ) ) 1676 bIsAdmin = FALSE; 1677 } --- 21 unchanged lines hidden (view full) --- 1699 szInfoBuffer = new UCHAR[ dwRetInfoBufferSize ]; 1700 dwInfoBufferSize = dwRetInfoBufferSize; 1701 bSuccess = WIN::GetTokenInformation( hAccessToken, TokenGroups, 1702 szInfoBuffer, dwInfoBufferSize, 1703 &dwRetInfoBufferSize ) == TRUE; 1704 } 1705 1706 WIN::CloseHandle( hAccessToken ); | 1670 if ( !hAdvapi32 ) 1671 bIsAdmin = FALSE; 1672 else 1673 { 1674 PFnCheckTokenMembership pfnCheckTokenMembership = (PFnCheckTokenMembership) GetProcAddress( hAdvapi32, ADVAPI32API_CheckTokenMembership); 1675 if ( !pfnCheckTokenMembership || !pfnCheckTokenMembership( NULL, aPsidAdmin, &bIsAdmin ) ) 1676 bIsAdmin = FALSE; 1677 } --- 21 unchanged lines hidden (view full) --- 1699 szInfoBuffer = new UCHAR[ dwRetInfoBufferSize ]; 1700 dwInfoBufferSize = dwRetInfoBufferSize; 1701 bSuccess = WIN::GetTokenInformation( hAccessToken, TokenGroups, 1702 szInfoBuffer, dwInfoBufferSize, 1703 &dwRetInfoBufferSize ) == TRUE; 1704 } 1705 1706 WIN::CloseHandle( hAccessToken ); |
1707 | 1707 |
1708 if ( bSuccess ) 1709 { 1710 PTOKEN_GROUPS pGroups = (PTOKEN_GROUPS)(UCHAR*) szInfoBuffer; 1711 for( i=0; i<pGroups->GroupCount; i++ ) 1712 { 1713 if( WIN::EqualSid( aPsidAdmin, pGroups->Groups[i].Sid ) ) 1714 { 1715 bIsAdmin = TRUE; 1716 break; 1717 } 1718 } 1719 } | 1708 if ( bSuccess ) 1709 { 1710 PTOKEN_GROUPS pGroups = (PTOKEN_GROUPS)(UCHAR*) szInfoBuffer; 1711 for( i=0; i<pGroups->GroupCount; i++ ) 1712 { 1713 if( WIN::EqualSid( aPsidAdmin, pGroups->Groups[i].Sid ) ) 1714 { 1715 bIsAdmin = TRUE; 1716 break; 1717 } 1718 } 1719 } |
1720 | 1720 |
1721 delete [] szInfoBuffer; 1722 } 1723 } | 1721 delete [] szInfoBuffer; 1722 } 1723 } |
1724 | 1724 |
1725 WIN::FreeSid( aPsidAdmin ); 1726 1727 return bIsAdmin ? true : false; 1728} 1729 1730//-------------------------------------------------------------------------- 1731LPTSTR SetupAppX::CopyIniFile( LPCTSTR pIniFile ) 1732{ 1733 m_pTmpName = _ttempnam( TEXT( "C:\\" ), TEXT( "Setup" ) ); 1734 1735 if ( !m_pTmpName ) 1736 { 1737 Log( TEXT( "ERROR: Could not create temp file\n" ) ); 1738 return NULL; 1739 } | 1725 WIN::FreeSid( aPsidAdmin ); 1726 1727 return bIsAdmin ? true : false; 1728} 1729 1730//-------------------------------------------------------------------------- 1731LPTSTR SetupAppX::CopyIniFile( LPCTSTR pIniFile ) 1732{ 1733 m_pTmpName = _ttempnam( TEXT( "C:\\" ), TEXT( "Setup" ) ); 1734 1735 if ( !m_pTmpName ) 1736 { 1737 Log( TEXT( "ERROR: Could not create temp file\n" ) ); 1738 return NULL; 1739 } |
1740 | 1740 |
1741 FILE *pOut = _tfopen( m_pTmpName, TEXT( "wb" ) ); 1742 FILE *pIn = _tfopen( pIniFile, TEXT( "rb" ) ); 1743 1744 if ( pOut && pIn ) 1745 { 1746 size_t nRead, nWritten; 1747 BYTE pBuf[1024]; 1748 --- 7 unchanged lines hidden (view full) --- 1756 break; 1757 } 1758 nRead = fread( pBuf, sizeof( BYTE ), 1024, pIn ); 1759 } 1760 } 1761 1762 if ( pOut ) fclose( pOut ); 1763 if ( pIn ) fclose( pIn ); | 1741 FILE *pOut = _tfopen( m_pTmpName, TEXT( "wb" ) ); 1742 FILE *pIn = _tfopen( pIniFile, TEXT( "rb" ) ); 1743 1744 if ( pOut && pIn ) 1745 { 1746 size_t nRead, nWritten; 1747 BYTE pBuf[1024]; 1748 --- 7 unchanged lines hidden (view full) --- 1756 break; 1757 } 1758 nRead = fread( pBuf, sizeof( BYTE ), 1024, pIn ); 1759 } 1760 } 1761 1762 if ( pOut ) fclose( pOut ); 1763 if ( pIn ) fclose( pIn ); |
1764 | 1764 |
1765 return m_pTmpName; 1766} 1767 1768//-------------------------------------------------------------------------- 1769void SetupAppX::ConvertNewline( LPTSTR pText ) const 1770{ 1771 int i=0; | 1765 return m_pTmpName; 1766} 1767 1768//-------------------------------------------------------------------------- 1769void SetupAppX::ConvertNewline( LPTSTR pText ) const 1770{ 1771 int i=0; |
1772 | 1772 |
1773 while ( pText[i] != 0 ) 1774 { 1775 if ( ( pText[i] == '\\' ) && ( pText[i+1] == 'n' ) ) 1776 { 1777 pText[i] = 0x0d; 1778 pText[i+1] = 0x0a; 1779 i+=2; 1780 } 1781 else 1782 i+=1; 1783 } 1784} 1785 1786//-------------------------------------------------------------------------- 1787LPTSTR SetupAppX::SetProdToAppTitle( LPCTSTR pProdName ) 1788{ 1789 if ( !pProdName ) return m_pAppTitle; 1790 1791 LPTSTR pAppProdTitle = new TCHAR[ MAX_STR_CAPTION ]; | 1773 while ( pText[i] != 0 ) 1774 { 1775 if ( ( pText[i] == '\\' ) && ( pText[i+1] == 'n' ) ) 1776 { 1777 pText[i] = 0x0d; 1778 pText[i+1] = 0x0a; 1779 i+=2; 1780 } 1781 else 1782 i+=1; 1783 } 1784} 1785 1786//-------------------------------------------------------------------------- 1787LPTSTR SetupAppX::SetProdToAppTitle( LPCTSTR pProdName ) 1788{ 1789 if ( !pProdName ) return m_pAppTitle; 1790 1791 LPTSTR pAppProdTitle = new TCHAR[ MAX_STR_CAPTION ]; |
1792 pAppProdTitle[0] = '\0'; 1793 | 1792 pAppProdTitle[0] = '\0'; 1793 |
1794 WIN::LoadString( m_hInst, IDS_APP_PROD_TITLE, pAppProdTitle, MAX_STR_CAPTION ); 1795 1796 int nAppLen = lstrlen( pAppProdTitle ); 1797 int nProdLen = lstrlen( pProdName ); 1798 1799 if ( ( nAppLen == 0 ) || ( nProdLen == 0 ) ) 1800 { 1801 delete [] pAppProdTitle; --- 263 unchanged lines hidden --- | 1794 WIN::LoadString( m_hInst, IDS_APP_PROD_TITLE, pAppProdTitle, MAX_STR_CAPTION ); 1795 1796 int nAppLen = lstrlen( pAppProdTitle ); 1797 int nProdLen = lstrlen( pProdName ); 1798 1799 if ( ( nAppLen == 0 ) || ( nProdLen == 0 ) ) 1800 { 1801 delete [] pAppProdTitle; --- 263 unchanged lines hidden --- |