Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: chrome/installer/mini_installer/mini_installer.cc

Issue 6693015: Switch out the setup api for using the cabinet API directly.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // mini_installer.exe is the first exe that is run when chrome is being 5 // mini_installer.exe is the first exe that is run when chrome is being
6 // installed or upgraded. It is designed to be extremely small (~5KB with no 6 // installed or upgraded. It is designed to be extremely small (~5KB with no
7 // extra resources linked) and it has two main jobs: 7 // extra resources linked) and it has two main jobs:
8 // 1) unpack the resources (possibly decompressing some) 8 // 1) unpack the resources (possibly decompressing some)
9 // 2) run the real installer (setup.exe) with appropiate flags. 9 // 2) run the real installer (setup.exe) with appropiate flags.
10 // 10 //
(...skipping 16 matching lines...) Expand all
27 27
28 // having the linker merge the sections is saving us ~500 bytes. 28 // having the linker merge the sections is saving us ~500 bytes.
29 #pragma comment(linker, "/MERGE:.rdata=.text") 29 #pragma comment(linker, "/MERGE:.rdata=.text")
30 30
31 #include <windows.h> 31 #include <windows.h>
32 #include <setupapi.h> 32 #include <setupapi.h>
33 #include <shellapi.h> 33 #include <shellapi.h>
34 #include <shlwapi.h> 34 #include <shlwapi.h>
35 35
36 #include "chrome/installer/mini_installer/appid.h" 36 #include "chrome/installer/mini_installer/appid.h"
37 #include "chrome/installer/mini_installer/decompress.h"
37 #include "chrome/installer/mini_installer/mini_installer.h" 38 #include "chrome/installer/mini_installer/mini_installer.h"
38 #include "chrome/installer/mini_installer/pe_resource.h" 39 #include "chrome/installer/mini_installer/pe_resource.h"
39 40
40 // Required linker symbol. See remarks above. 41 // Required linker symbol. See remarks above.
41 extern "C" unsigned int __sse2_available = 0; 42 extern "C" unsigned int __sse2_available = 0;
42 43
43 namespace mini_installer { 44 namespace mini_installer {
44 45
45 // This structure passes data back and forth for the processing 46 // This structure passes data back and forth for the processing
46 // of resource callbacks. 47 // of resource callbacks.
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 } 502 }
502 503
503 // setup.exe wasn't sent as 'B7', lets see if it was sent as 'BL' 504 // setup.exe wasn't sent as 'B7', lets see if it was sent as 'BL'
504 if ((!::EnumResourceNames(module, kLZCResourceType, OnResourceFound, 505 if ((!::EnumResourceNames(module, kLZCResourceType, OnResourceFound,
505 LONG_PTR(&context))) && 506 LONG_PTR(&context))) &&
506 (::GetLastError() != ERROR_RESOURCE_TYPE_NOT_FOUND)) 507 (::GetLastError() != ERROR_RESOURCE_TYPE_NOT_FOUND))
507 return false; 508 return false;
508 509
509 if (::lstrlen(setup_path) > 0) { 510 if (::lstrlen(setup_path) > 0) {
510 // Uncompress LZ compressed resource. Setup is packed with 'MSCF' 511 // Uncompress LZ compressed resource. Setup is packed with 'MSCF'
511 // as opposed to old DOS way of 'SZDD'. Hence use SetupInstallFile 512 // as opposed to old DOS way of 'SZDD'. Hence we don't use LZCopy.
512 // instead of LZCopy. 513 bool success = mini_installer::Expand(setup_path, setup_dest_path);
513 // Note that the API will automatically delete the original file 514 DeleteFile(setup_path);
514 // if the extraction was successful. 515 if (success) {
515 if (!SetupInstallFile(NULL, NULL, setup_path, NULL, setup_dest_path, 516 if (!SafeStrCopy(setup_path, setup_path_size, setup_dest_path)) {
516 SP_COPY_DELETESOURCE | SP_COPY_SOURCE_ABSOLUTE, 517 ::DeleteFile(setup_dest_path);
517 NULL, NULL)) 518 success = false;
518 return false; 519 }
520 }
519 521
520 if (!SafeStrCopy(setup_path, setup_path_size, setup_dest_path)) 522 return success;
521 return false;
522
523 return true;
524 } 523 }
525 524
526 // setup.exe still not found. So finally check is it was sent as 'BN' 525 // setup.exe still not found. So finally check is it was sent as 'BN'
527 if ((!::EnumResourceNames(module, kBinResourceType, OnResourceFound, 526 if ((!::EnumResourceNames(module, kBinResourceType, OnResourceFound,
528 LONG_PTR(&context))) && 527 LONG_PTR(&context))) &&
529 (::GetLastError() != ERROR_RESOURCE_TYPE_NOT_FOUND)) 528 (::GetLastError() != ERROR_RESOURCE_TYPE_NOT_FOUND))
530 return false; 529 return false;
531 530
532 if (::lstrlen(setup_path) > 0) { 531 if (::lstrlen(setup_path) > 0) {
533 if (!::lstrcmpi(setup_path, setup_dest_path)) { 532 if (!::lstrcmpi(setup_path, setup_dest_path)) {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 return exit_code; 696 return exit_code;
698 } 697 }
699 698
700 } // namespace mini_installer 699 } // namespace mini_installer
701 700
702 701
703 int MainEntryPoint() { 702 int MainEntryPoint() {
704 int result = mini_installer::WMain(::GetModuleHandle(NULL)); 703 int result = mini_installer::WMain(::GetModuleHandle(NULL));
705 ::ExitProcess(result); 704 ::ExitProcess(result);
706 } 705 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698