When a user installs the software, the CD is placed into the optical drive, and the CD runs automatically for installation. How does this function be implemented? This example describes how to create an "automatically installed CD program ". The executable file is executed during automatic playback of the disc, the Autorun. ICO is the disc icon, and the autorun. inf is an INI file. As long as these files are included in the CD, the CD will automatically run when it is placed into the optical drive.
Development Process:
(1) create a project named autorun, a console application.
(2) Main program code.
1 using Microsoft. Win32;
2 using system;
3 using system. diagnostics;
4 using system. IO;
5 internal class Autorun
6 {
7 Private Static void main (string [] ARGs)
8 {
9 processstartinfo info1 = new processstartinfo ();
10 process process1 = new process ();
11 string basefile = appdomain. currentdomain. basedirectory;
12 console. writeline ("Boot installation ...");
13 info1.filename = basefile + "application installation package .exe ";
14 process1.startinfo = info1;
15 process1.start ();
16 process1.waitforexit ();
17 process1.close ();
18 console. writeline ("program installation completed ");
19}
20}
(3rd runtime program, the executable file is named “autorun.exe ", which is the file opened during automatic playback of the CD. This file is used to guide the application installation package for installation.
(4) Select an icon named "autorun. ICO", which is displayed when the drive is read.
(5th, when the optical disc is used, the original autorun.icow.{autorun.inf;{{autorun.exe "and the installation package of the application to be installed are put together in the burning file to the CD.
Autorun. inf Creates a text file and saves it as INF. The content is as follows:
[Autorun]
Open = Autorun. exe
Icon = Autorun. ICO
Summary:
You can develop the following programs based on this instance:
1. Design a multimedia promotional disc.
2. Create a backdoor program.
Problem:
Autorun.exe is automatically started every time the optical disk is released. A DoS interface is displayed, which is obviously unfriendly! I don't know how to solve this problem?