Original article: InstallShield Integrated Installation of msde2000 (1) fishout licensed release
Original post address: http://blog.csdn.net/fishout/archive/2009/10/26/4730086.aspx
Program, which brings about several problems:
1. It cannot be uninstalled along with the application installation;
2. msde2000 installation is not possible;
3. If you cancel the installation, the program cannot be completely rolled back;
4. It cannot be installed in the same directory as the application.
If you use the pre-installation feature in InstallShield, you can only use it in the MSI project, and you cannot flexibly control the installation process and implement the above features. Therefore, we need a method, it is used to integrate msde2000 during installation. This is because many applications require SQL server support, while msde2000 is indeed a good choice. Aside from copyright, it is sufficient to be fully compatible with SQL and Support 2 GB of data, if you can solve the integration problem during installation, it will greatly facilitate the distribution of applications.
Next I will introduce this method through a specific instance.
Objective 1: achieve the minimum installation that is uncontrollable.
I. Data preparation:
1. Download the SQL Server 2000 Desktop Engine (MSDE) component (SQL2000.MSDE-KB884525-SP4-x86.exe)
2. Double-click the downloaded EXE file, decompress it to c: \ sql2ksp4, browse to c: \ sql2ksp4 \ msdein the running state, find the setup.exe file, double-click it, click confirm, and enter the installation parameter after setup.exe: instanceName = "fishout" securitymode = SQL sapwd = "[email protected]"/L * V C: \ msdelog. log, and click "OK" (InstanceName = "Instance name", sapwd = "password", which can be modified by yourself. The following uses the Instance name "fishout" as an example ), after installation, do not start the service or restart the machine: \ Program Files \ Microsoft SQL Server \ MSSQL $ fishout \ The binn, data, and log folders in the folder are retained, and the rest are deleted.
3. Prepare the Registry portal. Open the Registry Editor and Navigate to HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server. Delete unnecessary sub-keys to make them look like:
Add two strings to the protocollist attribute under the subkey of supersocketnetlib: TCP/NP, right-click Microsoft SQL Server, and select export registry. The file name is arbitrary, open and edit the exported registry file and replace the installation path "C: \ Program Files \ Microsoft SQL Server" with "<targetdir>". The modified registry file is as follows:
View plaincopy to clipboardprint?
- Windows Registry Editor Version 5.00
- [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server]
- "Installedinstances" = hex (7):, 4f ,\
- 00
- "Ssrpactiveserver" = ""
- "Sqlmdacregrefcount" = DWORD: 00000001
- [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout]
- [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout \ MSSQLServer]
- "Auditlevel" = DWORD: 00000000
- "Defaultlogin" = "guest"
- "Listenon" = hex (7): 53,00, 53,00, 4D, 00 ,\
- , 00, 4E, 54, 00, 4C, 00
- "Loginmode" = DWORD: 00000000
- "Map _" = "\\"
- "Map #" = "-"
- "Map $" = ""
- "Sethostname" = DWORD: 00000000
- "Tapeloadwaittime" = DWORD: ffffffff
- "Uptime_pid" = DWORD: 000000c8
- "Uptime_time_utc" = HEX: 0e, 55,77, E8, 59,58, CA, 01
- [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout \ MSSQLServer \ CurrentVersion]
- "CurrentVersion" = "8.00.194"
- "Registeredowner" = ""
- "Serialnumber" = ""
- "Csdversionnumber" = DWORD: 00000400
- "Csdversion" = "8.00.1100"
- "Language" = DWORD: 00000804
- "Checksum" = HEX: 38,30, 32,32, 63,31, 35,38, 61,65, 37,64, 34,63, 64,37, 35,30, 64,61, 30 ,\
- 33,34, 62,36, 30,31, 34,32, 63,62, 61,66, 37,30, 33,30, 38,35, 35,65, 62,64, 63,34, 34 ,\
- 36,62, 61,37, 35,64, 61,62, 37,30, 34,66, 37,33, 65,35, 30,37, 64,65, 37,34, 30,39, 31 ,\
- , 65, 63 ,\
- , 30, 66 ,\
- 62,61, 39,64, 61,64, 65,30, 36,36, 30,66, 31,62, 63,63, 35,32, 37,33, 63,32, 62,33, 30 ,\
- 36,31, 66,66, 61,64, 65,36, 65,32, 30,36, 38,34, 33,64, 00
- [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout \ MSSQLServer \ Parameters]
- "Sqlarg0" = "-D <targetdir> \ MSSQL $ fishout \ data \ master. MDF"
- "Sqlarg1" = "-E <targetdir> \ MSSQL $ fishout \ log \ errorlog"
- "Sqlarg2" = "-l <targetdir> \ MSSQL $ fishout \ data \ mastlog. LDF"
- [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout \ MSSQLServer \ supersocketnetlib]
- "Protocollist" = hex (7):, 00, 00, 00
- [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout \ MSSQLServer \ supersocketnetlib \ NP]
- "Pipename" = "\\\\\ pipe \\ MSSQL $ fishout \ SQL \ QUERY"
- [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout \ MSSQLServer \ supersocketnetlib \ Tcp]
- "TcpHideFlag" = DWORD: 00000000
- "Tcpdynamicports" = "0"
- "Tcpport" = "0"
- [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout \ setup]
- "Featurename" = "sqlrun"
- "Firststart" = DWORD: 00000000
- "Productcode" = "{E09B48B5-E141-427A-AB0C-D3605127224A }"
- "Sqldataroot" = "<targetdir> \ MSSQL $ fishout"
- "Sqlpath" = "<targetdir> \ MSSQL $ fishout"
- "Edition" = "Desktop Engine"
- "Patchlevel" = "8.4.2039"
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server] "installedinstances" = hex (7):, 4f,, \ 00 "ssrpactiveserver" = "" sqlmdacregrefcount "= DWORD: 00000001 [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout] [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout \ MSSQLServer] "auditlevel" = DWORD: 00000000 "defaultlogin" = "guest" "listenon" = hex (7): 53,00, 53,00, 4D, 00, 00, 00, \ 53,00, 4E, 54, 00, 4C, 00, 00 "loginmode" = DWORD: 00000000 "map _" = "\" "map #" = "-" "map $" = "sethostname" = DWORD: 00000000 "tapeloadwaittime" = DWORD: ffffffff "uptime_pid" = DWORD: 000000c8 "uptime_time_utc" = HEX: 0e, 55,77, E8, 59,58, CA, 01 [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout \ MSSQLServer \ CurrentVersion] "CurrentVersion" = "8.00.194" "registeredowner" = "" serialnumber "=" csdversionnumber" = DWORD: 00000400 "csdversion" = "8.00.1100" "language" = DWORD: 00000804 "checksum" = HEX: 38,30, 32,32, 63,31, 35,38, 61,65, 37,64, 34,63, 64,37, 35,30, 64, 61, 30, \ 33,34, 62,36, 30,31, 34,32, random, 61,66, 37,30, 33,30, 38,35, 35,65, random, 63,34, 34, \ 36,62, 61,37, 35,64, 61,62,,, 63, \, 30,, 63, 00 [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout \ MSSQLServer \ Parameters] "sqlarg0" = "-D <targetdir >\\ MSSQL $ fishout \ data \ master. MDF "" sqlarg1 "="-E <targetdir> \ MSSQL $ fishout \ log \ errorlog "" sqlarg2 "="-l <targetdir> \ MSSQL $ fishout \ \ data \ mastlog. LDF "[HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout \ MSSQLServer \ supersocketnetlib]" protocollist "= hex (7,, 00, 00 [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout \ MSSQLServer \ supersocketnetlib \ NP] "pipename" = "\\\\. \ PIPE \ MSSQL $ fishout \ SQL \ QUERY "[HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout \ MSSQLServer \ supersocketnetlib \ Tcp]" TcpHideFlag "= DWORD: 00000000 "tcpdynamicports" = "0" "tcpport" = "0" [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft SQL Server \ fishout \ setup] "featurename" = "sqlrun" "firststart" = DWORD: 00000000 "productcode" = "{E09B48B5-E141-427A-AB0C-D3605127224A}" "sqldataroot" = "<targetdir> \ MSSQL $ fishout" "sqlpath" = "<targetdir> \ MSSQL $ fishout" "Edition "=" Desktop Engine "" patchlevel "=" 8.4.2039"
2. Design and make the installation program:
1. Create an installscript project in InstallShield, name it mdse2000, create a new Files folder under the project folder, copy the MSSQL $ fishout folder under the installation directory to project files, and copy C: \ windows \ system32 \ msvcp71.dll and msvcr71.dll files to files \ MSSQL $ fishout \ binn (do not forget this file), set the targetdir content in product properties: <folder_applications> \ Microsoft SQL Server: add the MSSQL $ fishout folder in files to application target folder.
2. Import the registry. In the Registry registry portal, right-click destination computer, click New registry set, rename it to mdse2000, right-click it, and click Import reg file ..., import the modified registry settings, and check the associated Installation File Group on the right.
3. Click defaultfeature in the installation script to generate an installed event. The Code is as follows:
View plaincopy to clipboardprint?
- Export prototype defaultfeature_installed ();
- Function defaultfeature_installed ()
- Number nvservicestate;
- String szservicename, szservicedisplayname, szservicedescription, szservicepathfile, szstartserviceargs;
- Bool bstartservice;
- Begin
- // Install the service
- Szservicename = "MSSQL $ fishout ";
- Szservicedisplayname = "MSSQL $ fishout ";
- Szservicedescription = "";
- Szservicepathfile = targetdir ^ "MSSQL $ fishout \ binn \ sqlservr.exe-sfishout ";
- Bstartservice = true;
- Szstartserviceargs = "";
- If (servicegetservicestate (szservicename, nvservicestate)> = iserr_success) then
- // Stop and uninstall the original service
- Servicestopservice (szservicename );
- Serviceremoveservice (szservicename );
- Endif;
- Serviceaddservice (szservicename, szservicedisplayname, szservicedescription, szservicepathfile, bstartservice, szstartserviceargs );
- End;
Export prototype initialize (); function invoke () number nvservicestate; string szservicename, szservicedisplayname, szservicedescription, alias, szstartserviceargs; bool bstartservice; begin // install the service szservicename = "MSSQL $ fishout "; szservicedisplayname = "MSSQL $ fishout"; szservicedescription = ""; szservicepathfile = targetdir ^ "MSSQL $ fishout \ binn \ sqls Ervr.exe-sfishout "; bstartservice = true; szstartserviceargs =" "; if (servicegetservicestate (szservicename, nvservicestate)> = listener) Then // stop and uninstall the original service servicestopservice (szservicename ); serviceremoveservice (szservicename); endif; serviceaddservice (szservicename, szservicedisplayname, szservicedescription, szservicepathfile, bstartservice, szstartserviceargs); end; 4. compile and generate the installer It can be seen that the generated installation package is only 12.4 MB, which is much smaller than Microsoft's original installation package, which is very conducive to network transmission and application distribution. However, there is a fatal drawback, the installation path cannot be changed. This problem can be solved in the next section.