Decompression software value-added thinking in installation production

xiaoxiao2021-03-06  41

Introduction to decompression software should not solidly self-seating, fully extended to the field of installation and production, this article introduces the concept of triggers, the right to throw bricks. First, the purely unpacking process of the trigger is to restore the directory and files in the package to the process of specifying the physical path, and our commonly used WinZip, WinRAR and other decompression software belong to this. The installation process is actually the unpacking process plus a configuration and control process, for example, you need to register the COM component, you need to create a virtual directory, you need to write to the registration table, you need to create shortcuts, and so on. The trigger is used to control and extend the plugins of the unpacking process, and most of the installation process can be completed by custom triggers. Software vendors can provide triggers with certain features prior custom, users can complete the required configuration and control operations as needed to configure the format, while the user can customize the flip-flop. There are four types of triggers:

(1) Adding before (2) before the decomposition element (3) After decomposing element (4)

Element: refers to a document or directory, a package is also an element. Decomposition: Refers to restore. Decompose element: refers to restore files or restores directories.

"Decomposition Directory" refers to all subdirectories and files in this directory after being restored.

Second, the design trigger trigger is a normal DLL developed in accordance with a certain specification, which must export a function called Execute.

Each element can have multiple triggers. That is, each element may have multiple decomposition front trigger, or multiple decomposition triggers may be executed in turn. However, as long as there is a decomposition trigger represents an opposition, the decomposition process of the element will be canceled, and the trigger will not be executed after the decomposition.

(1) prototype declaration: extern "c" __declspec (dllexport) long __stdcall execute (element * pele)

(2) Enumeration: Enum {etc, etc, etc}; // element type: file, directory, package. Enum {tsbefore, tsafter}; // Trigger condition: Before decomposition, decomposition.

(3) Input parameters: typedef struct {hwnd m_hwnd; // Main window handle idispatch * m_pxmldoc; // Unpacking XML control file char m_szpackpath [max_path]; // User specified unpacking physical full path. Char m_szelementpath [max_path]; // The current to decompose the full path in the package in the package. Long m_nelementtype; // element type. Long m_ntriggersitual; // trigger the condition. Element;

(4) Return value: (a) -1: Exit the entire unpacking process; (b) 0: Cancel the decomposition process of this element; (only valid for the decomposition trigger) (C) 1: success;

(5) Error Description The unpacking process may have errors when calling the trigger, as follows: (a) is not a valid DLL file; (b) DLL file does not exist; (c) Exporting Execute function; (d) Execute The function prototype is incorrect; (e) The Execute function is exception; the unpacking process will ask the inquiry when the above error is detected or exiting the entire unpacking process. Obviously, if the above error occurs before the element decomposition, the decomposition process of the element will be canceled, and the trigger will not be executed after the decomposition. Third, configure the trigger (1) format

(2) Description (a) can configure a separate trigger for each element. At this time, use the tag, which represents the file name of the flip-flop, and the FOR indicates the full path of the target element in the package, and when indicates the trigger condition. Special note is that for = "" means package. (B) You can set a universal trigger for all elements. At this time, use the tag, filename indicates the file name of the flip-flop, and the FOR represents the element type, and when means triggered. (C) If there is only "universal trigger" on an element, "independent trigger", whether it is in the decomposition or decomposition before decomposition, the "independent trigger" is performed first after the "universal flip flop" is executed first.

Fourth, the built-in trigger, for example, the unpacking process can have some "package decomposition" type triggers, functions, and configurations as described below.

(1) Creating a virtual directory

Note: Name represents the full path to the Directory of the packet corresponding to the virtual directory. Special note is that PATH = "" means that the physical path specified by the user is. When the virtual directory already exists and CreateNew = "1" is removed, then creation first.

(2) Register COM components

Note: Path represents the full path to files in the package you need to register. CopyTo said copy to the specified physical directory (or% win%,% sys%,% temp%), and the specified physical directory is not automatically created. Sometimes you can set the file to other physical directories without registering, you can set the NOREG property.

(3) Write registry

(4) Run an Exe program

Note: Path indicates the full path to the files that you need to run. WaiteXit indicates whether the unpacking process needs to wait for the EXE to run. (5) Creating shortcuts

Suspend

(6)

slightly

转载请注明原文地址:https://www.9cbs.com/read-55221.html

New Post(0)