chromium之mini_installer

 

Transfer from: http: //www.xue163.com/182/6/1822338.html#pinglun

 

This article explains the simple installation of the program mini_installer chromium

When compiling mini_installer, you want to change the parameters to compile the component is set to static_library, otherwise the compilation will be reported out of mini_staller "mini_installer.exe is incompatible with the component build" error

 

python build\gyp_chromium -D"component=static_library"

 

Before compiling may need to be emptied before re-compile the results, run empty after the completion of the compiler.

 

ninja -C out\Release -t clean
ninja -C out\Release mini_installer

Before this step would chromium recompiled, so before emptying need to consider whether to use shared_library compiled before chromium needs to be saved.

 

On the distinction static_library and shared_library, and my personal understanding is:

static library: runtime library functions are dependent contained at compile time to compiled object code, the program can be run on a machine without these libraries.
shared library: runtime library functions dependent at compile time is not included in the compiled object code, but these functions belong to which library records and their address information in the library down.
When using these functions, it will belong to the library functions according to the information coming under load recorded.

mini_installer project under src \ chrome \ installer, the entrance is mini_installer.cc

Mini_installer.exe work is relatively simple, mainly carried out the following work.

 

  1. Determine the working directory, the working directory is the directory extracting package, this directory by GetTempPath function to determine, under win7 is C: \ Users \% USERNAME% \ AppData \ Local \ Temp,% USERNAME% is the current user's name. In the Temp directory will create a format similar CR_B4D84.tmp folder, this package is used to extract the installation files.
  2. Extract the installation files in the folder CR_B4D84.tmp will get two files setup.exe and CHROME.PACKED.7Z
  3. Create a process to run setup.exe, and wait for the installer to complete the installation process.
  4. CR_B4D84.tmp delete the temporary folder. CR_B4D84.tmp whether to delete the temporary folder, determined by the function ShouldDeleteExtractedFiles. In order to make the program does not delete the temporary folder CR_B4D84.tmp, need to add an entry in the \ HKEY_CURRENT_USER \ Software registry under \ Chromium. The name is ChromeInstallerCleanup, the type of a string value, the value "0."

 

 

These are the work of mini_installer.exe, in the process, creates a process to run setup.exe.

 

setup.exe code looks more complicated, it is implemented in the code, setup_main.cc mainly include:

Determining installation directory, Chromium installation is divided into two, one is the system install, the other is the user install, installation path are acquired by PathProviderWin function, the specific code base_paths_win.cc.

If a system install, installation directory CSIDL_PROGRAM_FILES, corresponding to C: \ Program Files

If a user install, installation directory CSIDL_LOCAL_APPDATA, my win7 system corresponds to C: \ Users \% USERNAME% \ AppData \ Local \

Above the base path, will add Chromium \ Application \ obtain the target path, the path generation in InstallerState :: Initialize function, and save it in target_path_ in.

 

Invoke the installation function InstallProducts, the main function of the work done in InstallProductsHelper.

1、CreateTemporaryAndUnpackDirectories函数

生成temp_path:C:\Users\%USERNAME%\AppData\Local\Chromium\Application\Temp

Generating a decompression path unpack_path: C: \ Users \% USERNAME% \ AppData \ Local \ Chromium \ Application \ Temp \ source

2, instance initialization rchivePatchHelper archive_helper

UncompressAndPatchChromeArchive function

For the first time decompression, decompression CHROME.PACKED.7Z in unpack_path directory, get chrome.7Z

UnPackArchive function

A second decompression, decompression chrome.7Z get Chrome-bin directory

Installer_version get the version number of the currently installed from the Chrome-bin directory

3, Setup function call InstallOrUpdateProduct

The function call InstallNewVersion function, which contains a series of operations install_list installation program, including creating directories, copying files and modify the registry and so on.

Addition operation is mounted in AddInstallWorkItems install_list function, then call install_list-> Do () to perform operations.

If an error occurs during installation, the call install_list-> Rollback () rollback.

Transfer from: http: //www.xue163.com/182/6/1822338.html#pinglun

 

This article explains the simple installation of the program mini_installer chromium

When compiling mini_installer, you want to change the parameters to compile the component is set to static_library, otherwise the compilation will be reported out of mini_staller "mini_installer.exe is incompatible with the component build" error

 

python build\gyp_chromium -D"component=static_library"

 

Before compiling may need to be emptied before re-compile the results, run empty after the completion of the compiler.

 

ninja -C out\Release -t clean
ninja -C out\Release mini_installer

Before this step would chromium recompiled, so before emptying need to consider whether to use shared_library compiled before chromium needs to be saved.

 

On the distinction static_library and shared_library, and my personal understanding is:

static library: runtime library functions are dependent contained at compile time to compiled object code, the program can be run on a machine without these libraries.
shared library: runtime library functions dependent at compile time is not included in the compiled object code, but these functions belong to which library records and their address information in the library down.
When using these functions, it will belong to the library functions according to the information coming under load recorded.

mini_installer project under src \ chrome \ installer, the entrance is mini_installer.cc

Mini_installer.exe work is relatively simple, mainly carried out the following work.

 

  1. Determine the working directory, the working directory is the directory extracting package, this directory by GetTempPath function to determine, under win7 is C: \ Users \% USERNAME% \ AppData \ Local \ Temp,% USERNAME% is the current user's name. In the Temp directory will create a format similar CR_B4D84.tmp folder, this package is used to extract the installation files.
  2. Extract the installation files in the folder CR_B4D84.tmp will get two files setup.exe and CHROME.PACKED.7Z
  3. Create a process to run setup.exe, and wait for the installer to complete the installation process.
  4. CR_B4D84.tmp delete the temporary folder. CR_B4D84.tmp whether to delete the temporary folder, determined by the function ShouldDeleteExtractedFiles. In order to make the program does not delete the temporary folder CR_B4D84.tmp, need to add an entry in the \ HKEY_CURRENT_USER \ Software registry under \ Chromium. The name is ChromeInstallerCleanup, the type of a string value, the value "0."

 

 

These are the work of mini_installer.exe, in the process, creates a process to run setup.exe.

 

setup.exe code looks more complicated, it is implemented in the code, setup_main.cc mainly include:

Determining installation directory, Chromium installation is divided into two, one is the system install, the other is the user install, installation path are acquired by PathProviderWin function, the specific code base_paths_win.cc.

If a system install, installation directory CSIDL_PROGRAM_FILES, corresponding to C: \ Program Files

If a user install, installation directory CSIDL_LOCAL_APPDATA, my win7 system corresponds to C: \ Users \% USERNAME% \ AppData \ Local \

Above the base path, will add Chromium \ Application \ obtain the target path, the path generation in InstallerState :: Initialize function, and save it in target_path_ in.

 

Invoke the installation function InstallProducts, the main function of the work done in InstallProductsHelper.

1、CreateTemporaryAndUnpackDirectories函数

生成temp_path:C:\Users\%USERNAME%\AppData\Local\Chromium\Application\Temp

Generating a decompression path unpack_path: C: \ Users \% USERNAME% \ AppData \ Local \ Chromium \ Application \ Temp \ source

2, instance initialization rchivePatchHelper archive_helper

UncompressAndPatchChromeArchive function

For the first time decompression, decompression CHROME.PACKED.7Z in unpack_path directory, get chrome.7Z

UnPackArchive function

A second decompression, decompression chrome.7Z get Chrome-bin directory

Installer_version get the version number of the currently installed from the Chrome-bin directory

3, Setup function call InstallOrUpdateProduct

The function call InstallNewVersion function, which contains a series of operations install_list installation program, including creating directories, copying files and modify the registry and so on.

Addition operation is mounted in AddInstallWorkItems install_list function, then call install_list-> Do () to perform operations.

If an error occurs during installation, the call install_list-> Rollback () rollback.

Guess you like

Origin www.cnblogs.com/loveyj/p/11239331.html
Recommended