Bulletproof Installs: A Developer's Guide to Install Programs for Windows

Bulletproof Installs: A Developer's Guide to Install Programs for Windows

by Leslie Easter

Paperback

$37.87 $44.99 Save 16% Current price is $37.87, Original price is $44.99. You Save 16%.

Product Details

ISBN-13: 9780137980918
Publisher: Prentice Hall Professional Technical Reference
Publication date: 09/21/1998
Pages: 472
Product dimensions: 7.00(w) x 9.22(h) x 1.38(d)

Read an Excerpt

PREFACE:
Preface

This book has been a long time coming. It originally was written for InstallShield 3.0, however, I was just wrapping up when the release date of InstallShield 5.0 was announced. It didn't make much sense to release the book until it had been updated. By the time the book had been rewritten, which was a serious undertaking given the vast differences between the two products, InstallShield 5.1 was rumored to come about. And once again, it was back into the trenches. Finally, IÕve caught up.

Writing a book to support a software product is not an easy task. Especially when it's done while on the road. I've spent much of the last year and a half traveling around the world performing InstallShield training and consulting. Much of this book comes from those experiences. I truly enjoy writing install programs and passing on what I've learned to others. It's my deepest hope that this book will in some way be useful to you.

No one book could possibly teach you all that you need to know about install development. As I've told all of my classes, there are three books that all install developers must own; These are prerequisite readings.
First and foremost, get and read a copy of Code Complete by Steve McConnell (ISBN 1556154844). This is a Microsoft Press book and is widely available. It discusses all the needtoknow stuff about programming without focusing on a specific language. Not only is it applicable to InstallScript, but to any other development language. Next is The Windows Interface Guidelines for Software Design. This is another Microsoft Press book (ISBN 1556156790). While this book is available on the MSDN CDROM, you mustobtain a hardcopy. It is produced in highresolution color with heavy stock paper. This book is sure to be a constant resource as you write install programs for Windows 95 and NT. Finally, read Alan Cooper's book on user interface design. This is an easy and entertaining read. His book is published by IDG and is entitled About Face: The Essentials of User Interface Design (ISBN 1568843224). These references should help fill in any gaps this book may leave behind.

Writing a book about install programming couldn't be done without providing some sample code. I made the decision to use InstallShield for a number of reasons. The best being that it is the biggest player in the install development market. The InstallShield development environment is used in the vast majority of shipping software. Since it is the most prevalent, it means that the majority of readers will be familiar with the product. It's also the most extensible. For the install projects that I have worked on in the last five years, this has been my reason for using InstallShield. It's a powerful tool with lots of flexibility. And like all others it takes time and patience to learn. If you're not using InstallShield, you may still find this book worthwhile. Many of the concepts that are covered aren't specific to InstallShield but to the Windows operating systems.

Acknowledgments
While this book was written by me, its contributors were many and far more than can be listed here. Foremost were the students that attended the InstallShield Corporation and The Orange Brain Company InstallShield training classes I taught. It was through your patience, understanding, and diligence that this book came about. The class room environment was ideal for clarifying the concepts that made their way into this book. Your comments were insightful and your questions astute. Thanks to all students past and present.

This book could not have been written without the help and guidance of the good folks at InstallShield. InstallShield is truly a remarkable company and I predict it will continue to grow in this highly competitive software industry. Along those lines, I would like to extend a special thanks to Howard Berg for keeping me busy and productive all over the globe. To David Washburn thanks for the conversation, company, and coffee. It's always my good fortune to travel with you. May we soon join forces again. To Michael Byrne a special thanks for overseeing the companion CDROM project. It's an honor to have it accompany this book. Most importantly, thanks to Viresh Bhatia for his wisdom and insight. This book sprang out of an idea that he passed on to me over two years ago. What a long trip this has been.

The people at PrenticeHall have been very good to me. I would like to thank two people in particular: Stephen Solomon and Joanne Anzalone. Stephen had the vision that a book such as this was sorely needed. His guidance and suggestions made it all possible. Thanks for taking the chance. Joanne formed and created what you hold in your hands. Her experience and talent more than compensated for my first time venture into the world of "serious" writing.

Finally, I would like to acknowledge the people that have helped me in my career. To the people at Intel: Steve Bindewald, Peter Auseklis, and Marcia Petty. To the people at Microsoft: Rob Short, David Robinson, Ted Kummert, John Parchem, Luis Reyes, John Cooper, Lluis Abello, Jane Howell, and Bob Fries. To the people at Fidelity Investments: Rob Cannata, Roy Dixit, Partho Ghosh, and Chris Parsons. To my friends where ever they may roam: Chris Card, Greg Smith, Chris Rowley, John Trustman, Rich Brennan, and Sam Mahaney. You have all shaped my life and this book wouldn't exist without your help. I don't keep in contact nearly enough, but I think of you often.


Table of Contents

List of Figures
xv(14)
List of Tables
xxix(4)
Foreword xxxiii(2)
Preface xxxv(1)
Acknowledgments xxxvi
1 What Is an Install Program?
1(4)
1.1 The Basic Definition
1(4)
2 Designing an Install Program
5(16)
2.1 Architecture
7(4)
2.2 Assimilate
11(1)
2.2.1 Know the Application
11(1)
2.2.2 Know the Operating System
12(1)
2.3 Implementing the Architecture
12(9)
2.3.1 Evaluation
13(3)
2.3.1.1 User Input
16(2)
2.3.1.2 Components and File Groups
18(1)
2.3.2 File Transfer
18(1)
2.3.3 Uninstalling
19(1)
2.3.4 Binding
20(1)
2.3.5 Cleaning Up
20(1)
3 InstallShield File and Directory Organization
21(78)
3.1 What Is Installed by InstallShield
21(19)
3.1.1 Dialog Sampler
22(1)
3.1.2 Examples
23(3)
3.1.3 GeneralData and GeneralLink
26(6)
3.1.4 Help
32(1)
3.1.5 Include
33(1)
3.1.6 Program
33(2)
3.1.7 Redistributable
35(1)
3.1.8 TemplateData and TemplateLink
35(2)
3.1.9 My Installations
37(2)
3.1.10 Putting It All Together
39(1)
3.2 How InstallShield Builds Your Install Program
40(1)
3.3 How InstallShield Runs Your Program
41(7)
3.4 The InstallShield Wizards
48(25)
3.4.1 Wizards That Create Projects
48(1)
3.4.1.1 Project Wizard
48(1)
3.4.1.2 Visual Basic Wizard
49(3)
3.4.2 Wizards That Assist Projects
52(1)
3.4.2.1 Function Wizard
52(2)
3.4.2.2 Component Wizard
54(1)
3.4.2.3 PDF Wizard
54(10)
3.4.3 Wizards That Build Projects
64(1)
3.4.3.1 Media Build Wizard
65(5)
3.4.3.2 Send Media To... Wizard
70(1)
3.4.4 Accessing the Wizards
71(2)
3.5 The InstallShield Templates
73(3)
3.5.1 ActiveX Data Objects (ADO) Template
74(1)
3.5.2 DirectX Template
74(1)
3.5.3 MFC Template
74(1)
3.5.4 ODBC-DAO-RDO Template
75(1)
3.5.5 OLE DB Template
75(1)
3.5.6 Template One
75(1)
3.5.7 Template Two
76(1)
3.5.8 Visual Basic 5 Template
76(1)
3.6 The InstallShield IDE
76(16)
3.6.1 Projects Pane
77(1)
3.6.2 Output Pane
78(2)
3.6.3 Text Editor Pane
80(1)
3.6.4 Project Workspace Pane
81(1)
3.6.4.1 Script Files
81(1)
3.6.4.2 Component
82(1)
3.6.4.3 File Groups
83(1)
3.6.4.4 Setup Type
83(1)
3.6.4.5 Setup Files
84(2)
3.6.4.6 Resources
86(6)
3.6.4.7 Media
92(1)
3.7 InstallScript Framework
92(6)
3.7.1 #include Statements
93(1)
3.7.2 #define Statements
94(1)
3.7.3 Function and Variable Declarations
95(1)
3.7.4 Main Program
96(1)
3.7.5 Function Implementation
97(1)
3.8 Summary
98(1)
4 Creating a Simple Install Program
99(54)
4.1 Running the Project Wizard
100(2)
4.2 Applying the Finishing Touches
112(6)
4.3 Running the Install Program
118(1)
4.4 Examining the Built-in Capabilities
119(12)
4.4.1 Uninstall Log File
119(1)
4.4.2 Registry Keys
119(1)
4.4.3 Uninstalling an Active Application
120(1)
4.4.4 Silent Install
121(8)
4.4.5 Locked Files
129(2)
4.5 Understanding the Generated Code
131(20)
4.5.1 CheckRequirements
134(2)
4.5.2 SetupInstall
136(2)
4.5.3 SetupScreen
138(1)
4.5.4 ShowDialogs
139(5)
4.5.5 ProcessBeforeDataMove
144(2)
4.5.6 MoveFileData
146(1)
4.5.7 ProcessAfterDataMove
147(1)
4.5.8 SetupRegistry
148(1)
4.5.9 SetupFolders
148(1)
4.5.10 CleanUpInstall
149(2)
4.6 Summary
151(2)
5 Explaining InstallScript
153(18)
5.1 InstallScript Notation
153(9)
5.1.1 Variables
154(1)
5.1.2 Data Types
154(8)
5.2 Naming Variables
162(2)
5.3 Programming Constructs
164(6)
5.3.1 Abort
164(1)
5.3.2 Goto
164(1)
5.3.3 Return
165(1)
5.3.4 If...then...endif
165(2)
5.3.5 Switch...case...endswitch
167(1)
5.3.6 For...endfor
168(1)
5.3.7 Repeat...until
169(1)
5.3.8 While...endwhile
169(1)
5.4 Summary
170(1)
6 Understanding the Operating System
171(48)
6.1 Adding a Start Menu Entry
171(5)
6.2 The Registry
176(13)
6.2.1 Private Application Key
180(1)
6.2.2 Per Application Path Key
181(2)
6.2.3 Uninstall Key
183(2)
6.2.4 Shared DLL Key
185(1)
6.2.5 File Extension Key
186(2)
6.2.6 Run and RunOnce Keys
188(1)
6.3 Locked Files
189(5)
6.3.1 Windows 95
192(1)
6.3.2 Windows NT 4.0
192(1)
6.3.3 InstallShield Locked File Routines
193(1)
6.4 Shared Files
194(6)
6.4.1 Application-Shared Files
195(3)
6.4.2 System-Shared Files
198(2)
6.4.3 Wrapping Up on Shared Files
200(1)
6.5 Core Components
200(5)
6.5.1 Redistribution Package
200(1)
6.5.2 InstallShield Program
201(1)
6.5.3 Individual Files
201(3)
6.5.4 Summary of Core Components
204(1)
6.6 Self-Registering Files
205(8)
6.6.1 Batch Mode
210(1)
6.6.2 Self-Registration Postponed
211(2)
6.7 Rights and Permissions
213(4)
6.7.1 Determining User Privileges
213(3)
6.7.2 Common versus Personal Access
216(1)
6.8 Summary
217(2)
7 Defining the InstallShield API
219(62)
7.1 InstallShield API Categories
220(39)
7.1.1 Batch File, Path Buffer, and Configuration
222(3)
7.1.2 Initialization File
225(2)
7.1.3 Dialogs
227(6)
7.1.3.1 Component Dialogs
233(2)
7.1.4 Custom Dialogs
235(2)
7.1.5 Files and Folders and Long Filenames
237(4)
7.1.6 Shell
241(1)
7.1.7 Registry
242(2)
7.1.8 Extensibility, Miscellaneous, and User Interface
244(6)
7.1.9 Information
250(3)
7.1.10 Version Checking
253(1)
7.1.11 String Handling, List Handling, and Component
254(5)
7.2 Undocumented
259(21)
7.2.1 View Objects
260(1)
7.2.1.1 ComponentViewCreate
261(1)
7.2.1.2 ComponentViewCreateWindow
262(1)
7.2.1.3 ComponentViewDestroy
262(1)
7.2.1.4 ComponentViewRefresh
262(1)
7.2.1.5 ComponentViewSelectAll
263(1)
7.2.1.6 ComponentViewSetInfo
263(1)
7.2.1.7 SdComponentDialogEx
264(2)
7.2.1.8 SdComponentDlgCheckSpace
266(1)
7.2.1.9 SdCreateComponentView
266(1)
7.2.1.10 SdDisplayNameFromSetupType
266(1)
7.2.1.11 SdOptionlnit
267(1)
7.2.1.12 SdSetupTypeFromDisplayName
267(1)
7.2.2 Message Handling
268(1)
7.2.2.1 SdCloseDlg
269(1)
7.2.2.2 SdDiskSpace
270(1)
7.2.2.3 SdDoStdButton
270(1)
7.2.2.4 SdEnablement
271(1)
7.2.2.5 SdError
271(1)
7.2.2.6 SdGenerallnit
271(1)
7.2.2.7 SdGetTextExtent
272(1)
7.2.2.8 SdlsStdButton
272(1)
7.2.2.9 SdOptionsButtonslnit
273(1)
7.2.2.10 SdOptionSetState
274(1)
7.2.2.11 SdPluglnProductName
274(1)
7.2.2.12 SdSetSequentialltems
275(1)
7.2.2.13 SdSetStatic
275(1)
7.2.2.14 SdUnlnit
275(1)
7.2.3 Sd-dialog Private
276(1)
7.2.3.1 SdFinishlnit32
276(1)
7.2.3.2 SdRegEnableButton
277(1)
7.2.3.3 SdRegExEnableButton
277(1)
7.2.4 Information
277(1)
7.2.4.1 SdGetUserCompanyInfo
278(1)
7.2.4.2 SdlsShellExplorer
278(1)
7.2.5 Strings
279(1)
7.2.5.1 SdRemoveEndSpace
279(1)
7.2.6 Prototyped
279(1)
7.3 Summary
280(1)
8 Creating a Standard Install Program
281(34)
8.1 OBR Viewer
282(1)
8.2 Creating File Groups and Components
282(16)
8.2.1 Assigning Files to File Groups
289(1)
8.2.2 Setting File Group Properties
290(1)
8.2.3 Assigning File Groups to Components
290(1)
8.2.4 Setting Components Properties
290(8)
8.3 Running the Install Program
298(1)
8.3.1 Install Locations
298(1)
8.3.2 Uninstalling
298(1)
8.4 Adding a Start Menu Entry
299(2)
8.4.1 Via Code
299(1)
8.4.2 Via Shell Object
300(1)
8.5 Adding to the Application Search Path
301(2)
8.6 Creating a File Extension Registry Key
303(8)
8.6.1 Via Code
306(3)
8.6.2 Via Registry Set
309(2)
8.7 Adding to the Final Wizard Page
311(3)
8.8 Summary
314(1)
9 Creating a Custom User Interface
315(54)
9.1 Wizard Page Basics
315(8)
9.2 User Interface Design
323(1)
9.3 User Interface Controls
324(9)
9.3.1 Button Controls
325(3)
9.3.2 List Box Controls
328(4)
9.3.3 Static Text and Edit Boxes
332(1)
9.4 Layout and Design
333(4)
9.5 Creating a Resource DLL
337(5)
9.6 Making Your Own Wizard Page
342(8)
9.6.1 Integrating the DLL
348(2)
9.7 Writing a Message Handling Routine
350(15)
9.7.1 Generic Message Handler Template
350(4)
9.7.2 Adding Initialization Logic
354(4)
9.7.3 Adding DLG_INIT and NEXT Message Processing
358(7)
9.8 Customizing an InstallShield Dialog
365(2)
9.9 Summary
367(2)
10 Importing Routines
369(24)
10.1 The Nature of an Application
369(5)
10.2 The Anatomy of a Dynamic Link Library
374(2)
10.2.1 A Resource DLL
375(1)
10.2.2 A Support DLL
376(1)
10.3 The Windows API
376(1)
10.4 InstallShield's Function Prototype
377(2)
10.5 Data Type Conversion
379(2)
10.6 Using the Windows API
381(5)
10.6.1 Example One: Beep! Beep!
383(1)
10.6.2 Example Two: Flash Window
384(1)
10.6.3 Example Three: Get Current Directory
385(1)
10.7 The WinSub Module
386(3)
10.8 Handy Windows API Routines
389(2)
10.9 Summary
391(2)
11 Creating an Advanced Install Program
393(74)
11.1 Install Programs and Graphics
393(7)
11.1.1 Replacing the Wizard Page Graphic
394(1)
11.1.2 Displaying a Background Graphic
395(1)
11.1.3 Billboarding
396(2)
11.1.4 Playing an .AVI or .WAV File during the File Transfer
398(2)
11.2 InstallScript Modules
400(24)
11.2.1 OBCommon
401(2)
11.2.1.1 _ASSERT
403(1)
11.2.1.2 _Announce
404(1)
11.2.1.3 _ChangeToParentDirectory
404(1)
11.2.1.4 _CheckForNTPermissions
405(1)
11.2.1.5 _CheckForPendingReboot
405(1)
11.2.1.6 _CompareDates
406(1)
11.2.1.7 _ComponentGetFiles
406(1)
11.2.1.8 _ConvertListToString
407(1)
11.2.1.9 _ConvertPathListToFileList
407(1)
11.2.1.10 _FindStringInList
407(1)
11.2.1.11 _GetAppPathFromFileExtension
408(1)
11.2.1.12 _GetCurrentControlFocus
409(1)
11.2.1.13 _GetFileDateTime
409(1)
11.2.1.14 _IsDUNInstalled
410(1)
11.2.1.15 _ListAppend
410(1)
11.2.1.16 _ListEmpty
411(1)
11.2.1.17 _MakeCommaDelimited
411(1)
11.2.1.18 _PadString
411(1)
11.2.1.19 _PollForWindow
412(1)
11.2.1.20 _RefreshDesktop
413(1)
11.2.1.21 _RegisterAppFiles
413(1)
11.2.1.22 _RemoveChar
414(1)
11.2.1.23 _ReplaceTextInString
414(1)
11.2.1.24 _ValidateFilename
415(1)
11.2.2 OBCmpErr
415(2)
11.2.2.1 _RetrieveComponentErrorString
417(1)
11.2.2.2 _HandleComponentError
417(1)
11.2.3 OBLog
418(1)
11.2.3.1 _CreateLogFile
419(1)
11.2.3.2 _LogBrowserInfo
419(1)
11.2.3.3 _LogComponentFileTransfer
420(2)
11.2.3.4 _LogSystemConfig
422(1)
11.2.3.5 _MakeLogHeader
423(1)
11.2.3.6 _WriteToLog
423(1)
11.3 A Final Look at the OBR Viewer
424(29)
11.3.1 Refreshing the Desktop
424(2)
11.3.2 Using the Registry for Install-specific Data
426(4)
11.3.3 Another Look at Silent Installations
430(1)
11.3.3.1 Record Mode
431(4)
11.3.3.2 Silent Mode
435(2)
11.3.3.3 Finishing Touches
437(3)
11.3.4 Extending the Wizard Page Functionality
440(1)
11.3.4.1 Saving State
441(4)
11.3.4.2 Operating on Controls
445(5)
11.3.5 Advanced Considerations
450(1)
11.3.5.1 NT Security
451(1)
11.3.5.2 Pending Reboot
451(1)
11.3.5.3 Putting It All Together
452(1)
11.4 Customizing the InstallShield Environment
453(13)
11.4.1 Making Your Own InstallShield Template
453(5)
11.4.2 Adding to the Function Wizard
458(3)
11.4.3 Customizing the Project Wizard
461(5)
11.5 Summary
466(1)
Index 467

Preface

PREFACE:
Preface

This book has been a long time coming. It originally was written for InstallShield 3.0, however, I was just wrapping up when the release date of InstallShield 5.0 was announced. It didn't make much sense to release the book until it had been updated. By the time the book had been rewritten, which was a serious undertaking given the vast differences between the two products, InstallShield 5.1 was rumored to come about. And once again, it was back into the trenches. Finally, IÕve caught up.

Writing a book to support a software product is not an easy task. Especially when it's done while on the road. I've spent much of the last year and a half traveling around the world performing InstallShield training and consulting. Much of this book comes from those experiences. I truly enjoy writing install programs and passing on what I've learned to others. It's my deepest hope that this book will in some way be useful to you.

No one book could possibly teach you all that you need to know about install development. As I've told all of my classes, there are three books that all install developers must own; These are prerequisite readings.
First and foremost, get and read a copy of Code Complete by Steve McConnell (ISBN 1556154844). This is a Microsoft Press book and is widely available. It discusses all the needtoknow stuff about programming without focusing on a specific language. Not only is it applicable to InstallScript, but to any other development language. Next is The Windows Interface Guidelines for Software Design. This is another Microsoft Press book (ISBN 1556156790). While this book is available on the MSDN CDROM, youmustobtain a hardcopy. It is produced in highresolution color with heavy stock paper. This book is sure to be a constant resource as you write install programs for Windows 95 and NT. Finally, read Alan Cooper's book on user interface design. This is an easy and entertaining read. His book is published by IDG and is entitled About Face: The Essentials of User Interface Design (ISBN 1568843224). These references should help fill in any gaps this book may leave behind.

Writing a book about install programming couldn't be done without providing some sample code. I made the decision to use InstallShield for a number of reasons. The best being that it is the biggest player in the install development market. The InstallShield development environment is used in the vast majority of shipping software. Since it is the most prevalent, it means that the majority of readers will be familiar with the product. It's also the most extensible. For the install projects that I have worked on in the last five years, this has been my reason for using InstallShield. It's a powerful tool with lots of flexibility. And like all others it takes time and patience to learn. If you're not using InstallShield, you may still find this book worthwhile. Many of the concepts that are covered aren't specific to InstallShield but to the Windows operating systems.

Acknowledgments
While this book was written by me, its contributors were many and far more than can be listed here. Foremost were the students that attended the InstallShield Corporation and The Orange Brain Company InstallShield training classes I taught. It was through your patience, understanding, and diligence that this book came about. The class room environment was ideal for clarifying the concepts that made their way into this book. Your comments were insightful and your questions astute. Thanks to all students past and present.

This book could not have been written without the help and guidance of the good folks at InstallShield. InstallShield is truly a remarkable company and I predict it will continue to grow in this highly competitive software industry. Along those lines, I would like to extend a special thanks to Howard Berg for keeping me busy and productive all over the globe. To David Washburn thanks for the conversation, company, and coffee. It's always my good fortune to travel with you. May we soon join forces again. To Michael Byrne a special thanks for overseeing the companion CDROM project. It's an honor to have it accompany this book. Most importantly, thanks to Viresh Bhatia for his wisdom and insight. This book sprang out of an idea that he passed on to me over two years ago. What a long trip this has been.

The people at PrenticeHall have been very good to me. I would like to thank two people in particular: Stephen Solomon and Joanne Anzalone. Stephen had the vision that a book such as this was sorely needed. His guidance and suggestions made it all possible. Thanks for taking the chance. Joanne formed and created what you hold in your hands. Her experience and talent more than compensated for my first time venture into the world of "serious" writing.

Finally, I would like to acknowledge the people that have helped me in my career. To the people at Intel: Steve Bindewald, Peter Auseklis, and Marcia Petty. To the people at Microsoft: Rob Short, David Robinson, Ted Kummert, John Parchem, Luis Reyes, John Cooper, Lluis Abello, Jane Howell, and Bob Fries. To the people at Fidelity Investments: Rob Cannata, Roy Dixit, Partho Ghosh, and Chris Parsons. To my friends where ever they may roam: Chris Card, Greg Smith, Chris Rowley, John Trustman, Rich Brennan, and Sam Mahaney. You have all shaped my life and this book wouldn't exist without your help. I don't keep in contact nearly enough, but I think of you often.


Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews