home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / w3_syst / setup.arj / BINCODE.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-25  |  10.4 KB  |  224 lines

  1. // BINCODE.H - The header file
  2.  
  3.  
  4. // The following must be defined as _either_ SIMPLESETUP or COMPLEXSETUP
  5. //
  6. // Be sure to have these same lines in bincode1.h!!!
  7.  
  8. //#define SIMPLESETUP
  9. #define COMPLEXSETUP
  10.  
  11.  
  12. #define WINPROC  long FAR PASCAL
  13. #define DLGPROC  BOOL FAR PASCAL
  14. #define WINDOWS_PARAMS HWND hWnd, unsigned msg, WORD wParam, LONG lParam
  15. #define DIALOG_PARAMS  HWND hDlg, unsigned msg, WORD wParam, LONG lParam
  16.  
  17. /************************ Function Prototypes *******************************/
  18.  
  19. //----------------- BINCODE.C's Functions ----------------------------------
  20.  
  21. int     PASCAL WinMain            ( HANDLE, HANDLE, LPSTR, int             );
  22. BOOL    CheckForEnoughDiskSpace   ( void                                   );
  23. int     DisplayDialogBox          ( LPSTR, FARPROC                         );
  24. WINPROC WndProc                   ( WINDOWS_PARAMS                         );
  25. void    BackupProgmanIniFile      ( void                                   );
  26.  
  27. //----------------- IO.C's Functions ----------------------------------------
  28.  
  29. BOOL    DosCopy                   ( LPSTR, LPSTR                           );
  30. BOOL    CopyFile                  ( LPSTR, LPSTR, LPSTR, BOOL              );
  31. void    DosDelete                 ( char *                                 );
  32. int     DosMakeDir                ( LPSTR                                  );
  33. void    InfFileOpen               ( void                                   );
  34. void    InfFileClose              ( void                                   );
  35. int     FileRead                  ( HANDLE, LPSTR, WORD                    );
  36. void    CheckForCRLFandComment    ( WORD *, WORD, LPSTR                    );
  37. int     PositionInfPointer        ( LPSTR                                  );
  38.  
  39. BOOL    InitLZExpand              ( BOOL                                   );
  40. void    DeInitLZExpand            ( void                                   );
  41. BOOL    DosExpandCopy             ( LPSTR, LPSTR                           );
  42.  
  43. //----------------- DIALOGS.C's Functions -----------------------------------
  44.  
  45. void    CenterDialog              ( HWND                                   );
  46. BOOL    ReallyCancel              ( HWND                                   );
  47. DLGPROC StartUpDlgProc            ( DIALOG_PARAMS                          );
  48. BOOL    FixupDirectory            ( char *                                 );
  49. DLGPROC InstallDirDlgProc         ( DIALOG_PARAMS                          );
  50.  
  51. #ifdef COMPLEXSETUP
  52.  
  53. int     IndexGivenIndex           ( int                                    );
  54. void    AddItem                   ( HWND, HWND, int, BOOL                  );
  55. BOOL    InPreviousSelection       ( int *, int *, int, int                 );
  56. DLGPROC SelectDlgProc             ( DIALOG_PARAMS                          );
  57.  
  58. #endif
  59.  
  60. DLGPROC InsertDiskDlgProc         ( DIALOG_PARAMS                          );
  61. LPSTR   CreateSourceDir           ( int                                    );
  62. LPSTR   CreateSourceDisk          ( int                                    );
  63. void    ChangeSourceDir           ( int                                    );
  64. LPSTR   CreateDestDir             ( int                                    );
  65. DLGPROC FileCopyDlgProc           ( DIALOG_PARAMS                          );
  66. void    GetNextFileNumber         ( int *, int *                           );
  67. DLGPROC IconCopyDlgProc           ( DIALOG_PARAMS                          );
  68.  
  69. //----------------- PARSE.C's Functions -------------------------------------
  70.  
  71. BOOL    JunkCharacter             ( char                                   );
  72. BOOL    LoadLine                  ( void                                   );
  73. void    ParseLine                 ( char *, int *                          );
  74. void    AddDiskInfo               ( void                                   );
  75. void    FillDiskInfoStructures    ( void                                   );
  76. void    SetFlags                  ( char *, int *                          );
  77. void    AddFileInfo               ( int *                                  );
  78. void    FillFileInfoStructures    ( void                                   );
  79. void    AddDirInfo                ( void                                   );
  80. void    FillDirInfoStructures     ( void                                   );
  81. void    AddProgmanInfo            ( void                                   );
  82. void    FillProgmanInfoStructures ( void                                   );
  83. int     TokenValue                ( char *                                 );
  84. void    FillGlobalInfoStructures  ( void                                   );
  85.    
  86.  
  87. //----------------- PROGDDE.C's Functions -----------------------------------
  88.  
  89. WINPROC ddeWndProc                ( WINDOWS_PARAMS                         );
  90. BOOL    ddeInit                   ( HANDLE                                 );
  91. BOOL    ddeTerminate              ( HWND                                   );
  92. void    SetProgmanSize            ( void                                   );
  93. HWND    ddeSendInitiate           ( ATOM, ATOM                             );
  94. HWND    ddeInitiate               ( LPSTR, LPSTR                           );
  95. BOOL    ddeWait                   ( HWND                                   );
  96. BOOL    ddeExec                   ( HWND, LPSTR                            );
  97. BOOL    fmActivate                ( PSTR                                   );
  98. BOOL    fmMinimize                ( PSTR                                   );
  99. HWND    ProgmanManageGroup        ( LPSTR, LPSTR, BOOL                     );
  100. BOOL    ProgManClose              ( void                                   );
  101. BOOL    ProgmanAddItem            ( PSTR, PSTR                             );
  102.  
  103. //----------------- DOS.ASM's Gloabl Functions ------------------------------
  104.  
  105. extern LONG  FAR PASCAL DosDiskFreeSpace ( int   iDrive                    );
  106. extern int   FAR PASCAL DosMkDir         ( LPSTR szDir                     );
  107. extern int   FAR PASCAL DosValidDir      ( LPSTR szDir                     );
  108.  
  109. /****************************************************************************/
  110.  
  111. #define INFFILENAME "SETUP.INF"     // .INF file name
  112.  
  113. #define MAXFILES 50                 // Must equal or surpass number of files in
  114.                                     // INF file.
  115.  
  116. #define MAXDISKS 5                  // Must equal or surpass number of disks
  117. #define MAXDIRS  5                  // Must equal or surpass number of child
  118.                                     // child directories + 1 (parent)
  119.  
  120. #define CHUNKSIZE   (WORD)8192      // INF file cache size
  121. #define SECTIONSIZE (WORD)32768     // Max size of a INF section
  122.  
  123. #define ID_PACKAGENAME 1            // .INF file parse section tokens
  124. #define ID_CAPTIONNAME 2
  125.  
  126.  
  127. typedef struct
  128.   {
  129.   BOOL    bSelected;                // TRUE copies the file
  130.   BOOL    bCompressed;              // TRUE uses DosExpandCopy vs DosCopy
  131.   BOOL    bInvisible;               // TRUE allows user to select file
  132.   BOOL    bProgmanIcon;             // TRUE puts this file in ProgMan
  133.   int     ExtraFiles;               // Number of dependant preceding files
  134.   int     Index;                    // Position in listbox (if visible)
  135.  
  136.   char    ProgmanGroupNumber;       // progman group number
  137.   char    DiskNumber;               // Installation Disk Number 
  138.   char    DirectoryNumber;          // Destination Directory number
  139.  
  140.   LONG    BytesRequired;            // Size of file, in bytes
  141.  
  142.   char    szMasterSrcDir[64];       // Source directory on floppy
  143.   char    szFileName[64];           // Source file name
  144.   char    szProgManName[32];        // Progman name
  145.   char    szDescription[80];        // Description of the program (listbox entry)
  146.   char    szComment[80];            // Comment about the program (info box)
  147.   } FILEINFO;
  148.  
  149. typedef struct
  150.   {
  151.   char    DiskNumber;               // Installation disk number, 0-9, A-Z
  152.   char    szSrcDir[64];             // Source directory
  153.   char    szDiskTitle[64];          // Name of disk
  154.   } DISKINFO;
  155.  
  156. typedef struct
  157.   {
  158.   char    szDirectory[64];          // Name of destination directory
  159.   char    szDescription[64];        // Description of Destination directory
  160.   } DIRINFO;
  161.  
  162. typedef struct
  163.   {
  164.   char    szCaption[64];            // Name of the caption on the window
  165.   char    szGroupFilename[64];      // Name of the filename of the group
  166.   } PMANINFO;
  167.  
  168. #ifdef INMAIN
  169.  
  170. unsigned char Buffer[16385];        // Disk copy buffer
  171.  
  172. int       NumFiles;                 // Number of files in .INF
  173. int       NumDisks;                 // Number of disks
  174. int       NumDirs;                  // Number of directories
  175. int       NumPManGroups;            // Number of Progman Group Windows
  176. FILEINFO  FileInfo[MAXFILES];       // Actual .INF file, all parsed up
  177. DISKINFO  DiskInfo[MAXDISKS];       // Actual .INF file, all parsed up
  178. DIRINFO   DirInfo [MAXDIRS];        // Actual .INF file, all parsed up
  179. PMANINFO  PManInfo[MAXDIRS];        // Actual .INF file, all parsed up
  180. HANDLE    hInfFile;                 // .INF File handle
  181. HANDLE    hBuffer;                  // Cache for Inf file Section
  182. HANDLE    hBuffer1;                 // Cache for .INF file
  183. LPSTR     szBuffer;                 // .INF file section information
  184. LPSTR     szBuffer1;                // .INF file cache pointer
  185. HANDLE    ghInst;                   // Instance
  186. HWND      ghWnd;                    // Parent Handle
  187. HWND      ghWndDDE;                 // DDE Window Handle
  188. char      szCurrentInstallDir[80];  // Where SETUP.EXE was run from
  189.  
  190. char      szPackageName[80];
  191. char      szCaptionName[80];
  192. char      szAppName[] = "BINCODE";
  193.  
  194. BOOL      CopyError;
  195.  
  196.  
  197. #endif
  198. #ifndef INMAIN
  199.  
  200. extern unsigned  char Buffer[16385];
  201. extern int       NumFiles;
  202. extern int       NumDisks;            
  203. extern int       NumDirs;              
  204. extern int       NumPManGroups;         
  205. extern FILEINFO  FileInfo[MAXFILES];
  206. extern DISKINFO  DiskInfo[MAXDISKS];  
  207. extern DIRINFO   DirInfo [MAXDIRS];    
  208. extern PMANINFO  PManInfo[MAXDIRS];     
  209. extern HANDLE    hInfFile;              
  210. extern HANDLE    hBuffer;               
  211. extern HANDLE    hBuffer1;              
  212. extern LPSTR     szBuffer;              
  213. extern LPSTR     szBuffer1;             
  214. extern HANDLE    ghInst;
  215. extern HWND      ghWnd; 
  216. extern HWND      ghWndDDE;           
  217. extern char      szCurrentInstallDir[80];
  218. extern char      szPackageName[80];
  219. extern char      szCaptionName[80];
  220. extern char      szAppName[];
  221. extern BOOL      CopyError;
  222.  
  223. #endif
  224.