diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 17:49:27 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 17:49:27 +0000 |
commit | 31d4b9aeca4cad27fa1d02796b79b0352df03fb1 (patch) | |
tree | 1912e4580b40d7b92173ba518b4abb367a800f5a /chrome/installer/mini_installer | |
parent | 28937b29b58e9aa1989349335ef83995e008098e (diff) | |
download | chromium_src-31d4b9aeca4cad27fa1d02796b79b0352df03fb1.zip chromium_src-31d4b9aeca4cad27fa1d02796b79b0352df03fb1.tar.gz chromium_src-31d4b9aeca4cad27fa1d02796b79b0352df03fb1.tar.bz2 |
Make mini_installer changes for 3 stage updates.
BUG=12832
TEST=Build a mini_installer that has setup.exe patch only and make sure the installer still works.
Review URL: http://codereview.chromium.org/115839
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17494 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/mini_installer')
-rw-r--r-- | chrome/installer/mini_installer/mini_installer.cc | 354 | ||||
-rw-r--r-- | chrome/installer/mini_installer/mini_installer.h | 23 | ||||
-rw-r--r-- | chrome/installer/mini_installer/pe_resource.cc | 6 | ||||
-rw-r--r-- | chrome/installer/mini_installer/pe_resource.h | 8 |
4 files changed, 231 insertions, 160 deletions
diff --git a/chrome/installer/mini_installer/mini_installer.cc b/chrome/installer/mini_installer/mini_installer.cc index d82efaa..722f404 100644 --- a/chrome/installer/mini_installer/mini_installer.cc +++ b/chrome/installer/mini_installer/mini_installer.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -31,7 +31,6 @@ #include <windows.h> #include <Shellapi.h> #include <shlwapi.h> -#include <stdlib.h> #include "chrome/installer/mini_installer/mini_installer.h" #include "chrome/installer/mini_installer/pe_resource.h" @@ -44,36 +43,39 @@ namespace mini_installer { // This structure passes data back and forth for the processing // of resource callbacks. struct Context { - // We really have a single string that is used for all operations. - // We keep two pointers to it as follows: - // [uncompress command]' '[path to exe]\[name of file] - // | | - // Context->full_path Context->name - wchar_t* full_path; // input to the call back method - wchar_t* name; // input/output from the call back method (contains file name) - size_t max_name_size; // input (contains the size of buffer "name") + // Input to the call back method. Specifies the dir to save resources. + const wchar_t* base_path; + // First output from call back method. Full path of Chrome archive. + wchar_t* chrome_resource_path; + // Size of chrome_resource_path buffer + size_t chrome_resource_path_size; + // Second output from call back method. Full path of Setup archive/exe. + wchar_t* setup_resource_path; + // Size of setup_resource_path buffer + size_t setup_resource_path_size; }; +// Returns true if the given two ASCII characters are same (ignoring case). +bool EqualASCIICharI(wchar_t a, wchar_t b) { + if (a >= L'A' && a <= L'Z') + a = a + (L'a' - L'A'); + if (b >= L'A' && b <= L'Z') + b = b + (L'a' - L'A'); + return (a == b); +} // Takes the path to file and returns a pointer to the filename component. For // exmaple for input of c:\full\path\to\file.ext it returns pointer to file.ext. -// It also checks that there is an extension (of length 3) in file name and -// the size of path is at least 7. It returns NULL if extension or path -// separator is not found. +// It returns NULL if extension or path separator is not found. wchar_t* GetNameFromPathExt(wchar_t* path, size_t size) { - const int kMinPath = 7; - const int kExtSize = 4; - if ((size < kMinPath) || (path[size - kExtSize] != L'.')) { + if (size <= 1) return NULL; - } - wchar_t* current = &path[size - kExtSize]; - while (L'\\' != *current) { + + wchar_t* current = &path[size - 1]; + while (current != path && L'\\' != *current) --current; - if (current == path) { - return NULL; - } - } - return (current + 1); + + return (current == path) ? NULL : (current + 1); } @@ -81,24 +83,43 @@ wchar_t* GetNameFromPathExt(wchar_t* path, size_t size) { // Returns true if the source was copied successfully otherwise returns false. // Parameter src is assumed to be NULL terminated and the NULL character is // copied over to string dest. -bool SafeStrCopy(wchar_t* dest, const wchar_t* src, size_t dest_size) { +bool SafeStrCopy(wchar_t* dest, size_t dest_size, const wchar_t* src) { for (size_t length = 0; length < dest_size; ++dest, ++src, ++length) { *dest = *src; - if (L'\0' == *src) { + if (L'\0' == *src) return true; - } } return false; } +// Safer replacement for lstrcat function. +bool SafeStrCat(wchar_t* dest, size_t dest_size, const wchar_t* src) { + int str_len = ::lstrlen(dest); + return SafeStrCopy(dest + str_len, dest_size - str_len, src); +} + // Function to check if a string (specified by str) ends with another string // (specified by end_str). -bool StrEndsWith(wchar_t *str, wchar_t *end_str) { - if (str == NULL || end_str == NULL || lstrlen(str) < lstrlen(end_str)) +bool StrEndsWith(const wchar_t *str, const wchar_t *end_str) { + if (str == NULL || end_str == NULL) return false; for (int i = lstrlen(str) - 1, j = lstrlen(end_str) - 1; j >= 0; --i, --j) { - if (str[i] != end_str[j]) + if (i < 0 || !EqualASCIICharI(str[i], end_str[j])) + return false; + } + + return true; +} + +// Function to check if a string (specified by str) starts with another string +// (specified by start_str). +bool StrStartsWith(const wchar_t *str, const wchar_t *start_str) { + if (str == NULL || start_str == NULL) + return false; + + for (int i = 0; start_str[i] != L'\0'; ++i) { + if (!EqualASCIICharI(str[i], start_str[i])) return false; } @@ -111,7 +132,6 @@ bool ReadValueFromRegistry(HKEY root_key, const wchar_t *sub_key, const wchar_t *value_name, wchar_t *value, size_t size) { HKEY key; - if ((::RegOpenKeyEx(root_key, sub_key, NULL, KEY_READ, &key) == ERROR_SUCCESS) && (::RegQueryValueEx(key, value_name, NULL, NULL, @@ -152,21 +172,19 @@ bool RunProcessAndWait(const wchar_t* exe_path, wchar_t* cmdline, int* exit_code) { STARTUPINFOW si = {sizeof(si)}; PROCESS_INFORMATION pi = {0}; - if (!::CreateProcessW(exe_path, cmdline, NULL, NULL, FALSE, CREATE_NO_WINDOW, - NULL, NULL, &si, &pi)) { + if (!::CreateProcess(exe_path, cmdline, NULL, NULL, FALSE, CREATE_NO_WINDOW, + NULL, NULL, &si, &pi)) return false; - } + DWORD wr = ::WaitForSingleObject(pi.hProcess, INFINITE); - if (WAIT_OBJECT_0 != wr) { + if (WAIT_OBJECT_0 != wr) return false; - } bool ret = true; if (exit_code) { if (!::GetExitCodeProcess(pi.hProcess, - reinterpret_cast<DWORD*>(exit_code))) { + reinterpret_cast<DWORD*>(exit_code))) ret = false; - } } ::CloseHandle(pi.hProcess); ::CloseHandle(pi.hThread); @@ -174,10 +192,10 @@ bool RunProcessAndWait(const wchar_t* exe_path, wchar_t* cmdline, } -// Windows defined callback used in the EnumResourceNamesW call. For each +// Windows defined callback used in the EnumResourceNames call. For each // matching resource found, the callback is invoked and at this point we write -// it to disk and possibly uncompress it. Resources of type BL -// are assumed to be LZ compressed and are uncompressed using 'expand.exe'. +// it to disk. We expect resource names to start with 'chrome' or 'setup'. Any +// other name is treated as an error. BOOL CALLBACK OnResourceFound(HMODULE module, const wchar_t* type, wchar_t* name, LONG_PTR context) { if (NULL == context) { @@ -192,79 +210,136 @@ BOOL CALLBACK OnResourceFound(HMODULE module, const wchar_t* type, return FALSE; } - // Note that the copy operation actually replaces the file name part of - // ctx->full_path - if ((!SafeStrCopy(ctx->name, name, ctx->max_name_size)) || - (!resource.WriteToDisk(ctx->full_path))) { + wchar_t full_path[MAX_PATH]; + if (!SafeStrCopy(full_path, _countof(full_path), ctx->base_path) || + !SafeStrCat(full_path, _countof(full_path), name) || + !resource.WriteToDisk(full_path)) return FALSE; - } - // If this is LZ compressed resource, uncompress it using the existing - // program in the system32 folder named 'expand.exe'. - if (0 == ::lstrcmpiW(type, kLZCResourceType)) { - wchar_t expand_cmd[MAX_PATH * 2] = UNCOMPRESS_CMD; - ::lstrcatW(expand_cmd, L"\""); - ::lstrcatW(expand_cmd, ctx->full_path); - ::lstrcatW(expand_cmd, L"\""); - int exit_code = 0; - if (!RunProcessAndWait(NULL, expand_cmd, &exit_code) || - (exit_code != 0)) { - // Somehow we failed to uncompress the file. Exit now and leave the file - // behind for postmortem analysis. + if (StrStartsWith(name, kChromePrefix)) { + if (!SafeStrCopy(ctx->chrome_resource_path, + ctx->chrome_resource_path_size, full_path)) return FALSE; - } - // Uncompression was successful, delete the source but it is not critical - // if that fails. - ::DeleteFileW(ctx->full_path); + } else if (StrStartsWith(name, kSetupPrefix)) { + if (!SafeStrCopy(ctx->setup_resource_path, + ctx->setup_resource_path_size, full_path)) + return FALSE; + } else { + // Resources should either start with 'chrome' or 'setup'. We dont handle + // anything else. + return FALSE; } + return TRUE; } -// Finds and writes to disk all resources of various types. Returns false -// if there is a problem in writing any resource to disk. +// Finds and writes to disk resources of various types. Returns false +// if there is a problem in writing any resource to disk. setup.exe resource +// can come in one of three possible forms: +// - Resource type 'B7', compressed using LZMA (*.7z) +// - Resource type 'BL', compressed using LZ (*.ex_) +// - Resource type 'BN', uncompressed (*.exe) +// If setup.exe is present in more than one form, the precedence order is +// BN < BL < B7 bool UnpackBinaryResources(HMODULE module, const wchar_t* base_path, - bool* unpacked_setup, wchar_t* archive_name) { - *unpacked_setup = false; - + wchar_t* archive_path, size_t archive_path_size, + wchar_t* setup_path, size_t setup_path_size) { // Prepare the input to OnResourceFound method that needs a location where // it will write all the resources. - wchar_t module_path[MAX_PATH]; - if (!SafeStrCopy(module_path, base_path, _countof(module_path))) { + Context context = {base_path, archive_path, archive_path_size, + setup_path, setup_path_size}; + + // Get the resources of type 'B7'. + // We need a chrome archive to do the installation. So if there + // is a problem in fetching B7 resource, just return error. + if ((!::EnumResourceNames(module, kLZMAResourceType, OnResourceFound, + LONG_PTR(&context))) || + (::lstrlen(archive_path) <= 0)) return false; - } - size_t length = ::lstrlen(module_path); - wchar_t* name = (wchar_t *) module_path + length; - Context context = {module_path, name, MAX_PATH - length}; - - // Get the resources of type 'B7' - if (!::EnumResourceNamesW(module, kLZMAResourceType, OnResourceFound, - LONG_PTR(&context))) { - // We need a compressed archive to do the installation. So if there - // is a problem in fetching B7 resource, just return error. + + // Generate the setup.exe path where we patch/uncompress setup resource. + wchar_t setup_dest_path[MAX_PATH] = {0}; + if (!SafeStrCopy(setup_dest_path, _countof(setup_dest_path), + context.base_path) || + !SafeStrCat(setup_dest_path, _countof(setup_dest_path), kSetupName)) return false; - } else { - ::lstrcpy(archive_name, name); - } - // Get the resources of type 'BL'. setup.exe can be sent as 'BL' or 'BN'. - // So if we get 'resource not found' error just ignore it. - if (!::EnumResourceNamesW(module, kLZCResourceType, OnResourceFound, - LONG_PTR(&context))) { - if (::GetLastError() != ERROR_RESOURCE_TYPE_NOT_FOUND) { + // If we found setup 'B7' resource, handle it. + if (::lstrlen(setup_path) > 0) { + wchar_t cmd_line[MAX_PATH * 3] = {0}; + // Get the path to setup.exe first. + if (!GetSetupExePathFromRegistry(cmd_line, _countof(cmd_line))) return false; - } - } else if (0 == ::lstrcmpiW(name, kSetupLZName)) { - *unpacked_setup = true; + + if (!SafeStrCat(cmd_line, _countof(cmd_line), kCmdUpdateSetupExe) || + !SafeStrCat(cmd_line, _countof(cmd_line), L"=\"") || + !SafeStrCat(cmd_line, _countof(cmd_line), setup_path) || + !SafeStrCat(cmd_line, _countof(cmd_line), L"\"") || + !SafeStrCat(cmd_line, _countof(cmd_line), kCmdNewSetupExe) || + !SafeStrCat(cmd_line, _countof(cmd_line), L"=\"") || + !SafeStrCat(cmd_line, _countof(cmd_line), setup_dest_path) || + !SafeStrCat(cmd_line, _countof(cmd_line), L"\"")) + return false; + + int exit_code = 0; + if (!RunProcessAndWait(NULL, cmd_line, &exit_code) || + (exit_code != 0)) + return FALSE; + + if (!SafeStrCopy(setup_path, setup_path_size, setup_dest_path)) + return false; + + return true; } - if (!::EnumResourceNamesW(module, kBinResourceType, OnResourceFound, - LONG_PTR(&context))) { - if (::GetLastError() != ERROR_RESOURCE_TYPE_NOT_FOUND) { + // setup.exe wasn't sent as 'B7', lets see if it was sent as 'BL' + if ((!::EnumResourceNames(module, kLZCResourceType, OnResourceFound, + LONG_PTR(&context))) && + (::GetLastError() != ERROR_RESOURCE_TYPE_NOT_FOUND)) + return false; + + if (::lstrlen(setup_path) > 0) { + // Uncompress LZ compressed resource using the existing + // program in the system32 folder named 'expand.exe'. + wchar_t expand_cmd[MAX_PATH * 3] = {0}; + if (!SafeStrCopy(expand_cmd, _countof(expand_cmd), UNCOMPRESS_CMD) || + !SafeStrCat(expand_cmd, _countof(expand_cmd), L"\"") || + !SafeStrCat(expand_cmd, _countof(expand_cmd), setup_path) || + !SafeStrCat(expand_cmd, _countof(expand_cmd), L"\" \"") || + !SafeStrCat(expand_cmd, _countof(expand_cmd), setup_dest_path) || + !SafeStrCat(expand_cmd, _countof(expand_cmd), L"\"")) + return false; + + // If we fail to uncompress the file, exit now and leave the file + // behind for postmortem analysis. + int exit_code = 0; + if (!RunProcessAndWait(NULL, expand_cmd, &exit_code) || + (exit_code != 0)) return false; + + // Uncompression was successful, delete the source but it is not critical + // if that fails. + ::DeleteFile(setup_path); + if (!SafeStrCopy(setup_path, setup_path_size, setup_dest_path)) + return false; + + return true; + } + + // setup.exe still not found. So finally check is it was sent as 'BN' + if ((!::EnumResourceNames(module, kBinResourceType, OnResourceFound, + LONG_PTR(&context))) && + (::GetLastError() != ERROR_RESOURCE_TYPE_NOT_FOUND)) + return false; + + if (::lstrlen(setup_path) > 0) { + if (!::lstrcmpi(setup_path, setup_dest_path)) { + ::CopyFile(setup_path, setup_dest_path, false); + if (!SafeStrCopy(setup_path, setup_path_size, setup_dest_path)) + return false; } - } else if (0 == ::lstrcmpiW(name, kSetupName)) { - *unpacked_setup = true; + return true; } return true; @@ -275,8 +350,8 @@ bool UnpackBinaryResources(HMODULE module, const wchar_t* base_path, // this method and simply skip making any changes in case of error. void AppendCommandLineFlags(wchar_t* buffer, int size) { wchar_t full_exe_path[MAX_PATH]; - int len = ::GetModuleFileNameW(NULL, full_exe_path, MAX_PATH); - if (len <= 0 && len >= MAX_PATH) + int len = ::GetModuleFileName(NULL, full_exe_path, _countof(full_exe_path)); + if (len <= 0 || len >= _countof(full_exe_path)) return; wchar_t* exe_name = GetNameFromPathExt(full_exe_path, len); @@ -307,34 +382,29 @@ void AppendCommandLineFlags(wchar_t* buffer, int size) { } // Executes setup.exe, waits for it to finish and returns the exit code. -bool RunSetup(bool have_upacked_setup, const wchar_t* base_path, - const wchar_t* archive_name, int* exit_code) { +bool RunSetup(const wchar_t* archive_path, const wchar_t* setup_path, + int* exit_code) { // There could be three full paths in the command line for setup.exe (path // to exe itself, path to archive and path to log file), so we declare // total size as three + one additional to hold command line options. wchar_t cmd_line[MAX_PATH * 4]; // Get the path to setup.exe first. - if (have_upacked_setup) { - if (!SafeStrCopy(cmd_line, L"\"", _countof(cmd_line)) || - !::lstrcat(cmd_line, base_path) || - !::lstrcat(cmd_line, kSetupName) || - !::lstrcat(cmd_line, L"\"")) { + if (::lstrlen(setup_path) > 0) { + if (!SafeStrCopy(cmd_line, _countof(cmd_line), L"\"") || + !SafeStrCat(cmd_line, _countof(cmd_line), setup_path) || + !SafeStrCat(cmd_line, _countof(cmd_line), L"\"")) return false; - } - } else { - if (!GetSetupExePathFromRegistry(cmd_line, sizeof(cmd_line))) { - return false; - } + } else if (!GetSetupExePathFromRegistry(cmd_line, _countof(cmd_line))) { + return false; } // Append the command line param for chrome archive file - if (!::lstrcat(cmd_line, L" --install-archive=\"") || - !::lstrcat(cmd_line, base_path) || - !::lstrcat(cmd_line, archive_name) || - !::lstrcat(cmd_line, L"\"")) { + if (!SafeStrCat(cmd_line, _countof(cmd_line), kCmdInstallArchive) || + !SafeStrCat(cmd_line, _countof(cmd_line), L"=\"") || + !SafeStrCat(cmd_line, _countof(cmd_line), archive_path) || + !SafeStrCat(cmd_line, _countof(cmd_line), L"\"")) return false; - } // Get any command line option specified for mini_installer and pass them // on to setup.exe @@ -343,18 +413,12 @@ bool RunSetup(bool have_upacked_setup, const wchar_t* base_path, return (RunProcessAndWait(NULL, cmd_line, exit_code)); } - +// Deletes given files and working dir. void DeleteExtractedFiles(const wchar_t* base_path, - const wchar_t* archive_name) { - wchar_t file_path[MAX_PATH]; - // Delete setup.exe. - SafeStrCopy(file_path, base_path, MAX_PATH); - ::lstrcat(file_path, kSetupName); - ::DeleteFile(file_path); - // Delete chrome archive file. - SafeStrCopy(file_path, base_path, MAX_PATH); - ::lstrcat(file_path, archive_name); - ::DeleteFile(file_path); + const wchar_t* archive_path, + const wchar_t* setup_path) { + ::DeleteFile(archive_path); + ::DeleteFile(setup_path); // Delete the temp dir (if it is empty, otherwise fail). ::RemoveDirectory(base_path); } @@ -363,21 +427,21 @@ void DeleteExtractedFiles(const wchar_t* base_path, // mini_installer payload. bool GetWorkDir(HMODULE module, wchar_t* work_dir) { wchar_t base_path[MAX_PATH]; - DWORD len = ::GetTempPath(MAX_PATH, base_path); - if (len >= MAX_PATH || len <= 0) { + DWORD len = ::GetTempPath(_countof(base_path), base_path); + if (len >= _countof(base_path) || len <= 0) { // Problem in getting TEMP path so just use current directory as base path - len = ::GetModuleFileNameW(module, base_path, MAX_PATH); - if (len >= MAX_PATH || len <= 0) + len = ::GetModuleFileName(module, base_path, _countof(base_path)); + if (len >= _countof(base_path) || len <= 0) return false; // Can't even get current directory? Return with error. wchar_t* name = GetNameFromPathExt(base_path, len); *name = L'\0'; } wchar_t temp_name[MAX_PATH]; - if (!GetTempFileName(base_path, L"CR_", 0, temp_name)) + if (!GetTempFileName(base_path, kTempPrefix, 0, temp_name)) return false; // Didn't get any temp name to use. Return error. - len = GetLongPathName(temp_name, work_dir, MAX_PATH); - if (len >= MAX_PATH || len <= 0) + len = GetLongPathName(temp_name, work_dir, _countof(temp_name)); + if (len >= _countof(temp_name) || len <= 0) return false; // Couldn't get full path to temp dir. Return error. // GetTempFileName creates the file as well so delete it before creating @@ -388,33 +452,31 @@ bool GetWorkDir(HMODULE module, wchar_t* work_dir) { return true; } +// Main function. First gets a working dir, unpacks the resources and finally +// executes setup.exe to do the install/upgrade. int WMain(HMODULE module) { // First get a path where we can extract payload wchar_t base_path[MAX_PATH]; if (!GetWorkDir(module, base_path)) return 101; - wchar_t archive_name[MAX_PATH]; // len(archive_name) < MAX_PATH-len(base_path) - bool have_upacked_setup; - if (!UnpackBinaryResources(module, base_path, - &have_upacked_setup, archive_name)) { + wchar_t archive_path[MAX_PATH] = {0}; + wchar_t setup_path[MAX_PATH] = {0}; + if (!UnpackBinaryResources(module, base_path, archive_path, MAX_PATH, + setup_path, MAX_PATH)) return 102; - } - int setup_exit_code = 103; - if (!RunSetup(have_upacked_setup, base_path, - archive_name, &setup_exit_code)) { - return setup_exit_code; - } + int exit_code = 103; + if (!RunSetup(archive_path, setup_path, &exit_code)) + return exit_code; wchar_t value[4]; if ((!ReadValueFromRegistry(HKEY_CURRENT_USER, kCleanupRegistryKey, kCleanupRegistryValueName, value, 4)) || - (value[0] != L'0')) { - DeleteExtractedFiles(base_path, archive_name); - } + (value[0] != L'0')) + DeleteExtractedFiles(base_path, archive_path, setup_path); - return setup_exit_code; + return exit_code; } } // namespace mini_installer diff --git a/chrome/installer/mini_installer/mini_installer.h b/chrome/installer/mini_installer/mini_installer.h index 1ae3656..b1afc19 100644 --- a/chrome/installer/mini_installer/mini_installer.h +++ b/chrome/installer/mini_installer/mini_installer.h @@ -1,20 +1,29 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_INSTALLER_MINI_INSTALLER__ -#define CHROME_INSTALLER_MINI_INSTALLER__ +#ifndef CHROME_INSTALLER_MINI_INSTALLER_ +#define CHROME_INSTALLER_MINI_INSTALLER_ // The windows command line to uncompress a LZ compressed file. It is a define // because we need the string to be writable. We don't need the full path // since it is located in windows\system32 and is available since windows2k. -#define UNCOMPRESS_CMD L"expand.exe -r " +#define UNCOMPRESS_CMD L"expand.exe " namespace mini_installer { -// The installer filename. The installer can be compressed or uncompressed. +// Various filenames const wchar_t kSetupName[] = L"setup.exe"; -const wchar_t kSetupLZName[] = L"setup.ex_"; +const wchar_t kChromePrefix[] = L"chrome"; +const wchar_t kSetupPrefix[] = L"setup"; + +// setup.exe command line arguements +const wchar_t kCmdInstallArchive[] = L" --install-archive"; +const wchar_t kCmdUpdateSetupExe[] = L" --update-setup-exe"; +const wchar_t kCmdNewSetupExe[] = L" --new-setup-exe"; + +// Temp directory prefix that this process creates +const wchar_t kTempPrefix[] = L"CR_"; // The resource types that would be unpacked from the mini installer. // 'BN' is uncompressed binary and 'BL' is LZ compressed binary. @@ -46,4 +55,4 @@ const wchar_t kManifestFilename[] = L"packed_files.txt"; } // namespace mini_installer -#endif // CHROME_INSTALLER_MINI_INSTALLER__ +#endif // CHROME_INSTALLER_MINI_INSTALLER_ diff --git a/chrome/installer/mini_installer/pe_resource.cc b/chrome/installer/mini_installer/pe_resource.cc index ff840be..ce63627 100644 --- a/chrome/installer/mini_installer/pe_resource.cc +++ b/chrome/installer/mini_installer/pe_resource.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,7 +10,7 @@ PEResource::PEResource(HRSRC resource, HMODULE module) PEResource::PEResource(const wchar_t* name, const wchar_t* type, HMODULE module) : resource_(NULL), module_(module) { - resource_ = ::FindResourceW(module, name, type); + resource_ = ::FindResource(module, name, type); } bool PEResource::IsValid() { @@ -33,7 +33,7 @@ bool PEResource::WriteToDisk(const wchar_t* full_path) { return false; } size_t resource_size = Size(); - HANDLE out_file = ::CreateFileW(full_path, GENERIC_WRITE, 0, NULL, + HANDLE out_file = ::CreateFile(full_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (INVALID_HANDLE_VALUE == out_file) { return false; diff --git a/chrome/installer/mini_installer/pe_resource.h b/chrome/installer/mini_installer/pe_resource.h index dc33990..1f4dbac 100644 --- a/chrome/installer/mini_installer/pe_resource.h +++ b/chrome/installer/mini_installer/pe_resource.h @@ -1,9 +1,9 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_INSTALLER_MINI_INSTALLER_PE_RESOURCE__ -#define CHROME_INSTALLER_MINI_INSTALLER_PE_RESOURCE__ +#ifndef CHROME_INSTALLER_MINI_INSTALLER_PE_RESOURCE_ +#define CHROME_INSTALLER_MINI_INSTALLER_PE_RESOURCE_ #include <windows.h> @@ -38,4 +38,4 @@ class PEResource { HMODULE module_; }; -#endif // CHROME_INSTALLER_MINI_INSTALLER_PE_RESOURCE__ +#endif // CHROME_INSTALLER_MINI_INSTALLER_PE_RESOURCE_ |