Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

152 lines
4.7 KiB

  1. #ifndef INSTALL_H
  2. #define INSTALL_H
  3. ///////////////////////////////////////////////////////////////////////////////
  4. #define SECTION 512 // Maximum size of section
  5. #define MAXSTR 256
  6. #define UNLIST_LINE 1
  7. #define NO_UNLIST_LINE 0
  8. #define WEC_RESTART 0x42
  9. #define DESC_SYS 3
  10. #define DESC_INF 2
  11. #define DESC_EXE 1
  12. #define DESC_NOFILE 0
  13. #define FALLOC(n) ((VOID *)GlobalAlloc(GPTR, n))
  14. #define FFREE(n) GlobalFree(n)
  15. #define ALLOC(n) (VOID *)LocalAlloc(LPTR,n)
  16. #define FREE(p) LocalFree(p)
  17. #define REALLOC(p,n) LocalRealloc(p,n,LMEM_MOVEABLE)
  18. #define SEEK_CUR 1
  19. #define SEEK_END 2
  20. #define SEEK_SET 0
  21. #define MAXFILESPECLEN MAX_PATH /* drive: + path length max + Null Byte */
  22. #define MAX_INF_LINE_LEN 256 /* Maximum length of any .inf line */
  23. #define MAX_SYS_INF_LEN 256 /* ##: + 8.3 + NULL */
  24. #define MAX_SECT_NAME_LEN 40 /* Max length of a section Name. */
  25. #define MAX_FILE_SPEC MAX_PATH // 8.3 + X: + NULL.
  26. #define DISK_SECT TEXT("disks")
  27. #define OEMDISK_SECT TEXT("oemdisks")
  28. /* Return codes from 'file exists' dialog */
  29. enum {
  30. CopyNeither, // User wants to cancel if file exists
  31. CopyCurrent, // User wants to use current file
  32. CopyNew // User wants to copy new file
  33. };
  34. #define SLASH(c) ((c) == TEXT('/')|| (c) == TEXT('\\'))
  35. #define CHSEPSTR TEXT("\\")
  36. #define COMMA TEXT(',')
  37. #define SPACE TEXT(' ')
  38. /* Globals and routines for .inf file parsing */
  39. typedef LPTSTR PINF;
  40. /* Message types for FileCopy callback function */
  41. typedef BOOL (*FPFNCOPY) (int,DWORD_PTR,LPTSTR);
  42. #define COPY_ERROR 0x0001
  43. #define COPY_INSERTDISK 0x0003
  44. #define COPY_QUERYCOPY 0x0004
  45. #define COPY_START 0x0005
  46. #define COPY_END 0x0006
  47. #define COPY_EXISTS 0x0007
  48. /* Option Flag values for FileCopy */
  49. #define FC_FILE 0x0000
  50. #define FC_LIST 0x0001
  51. #define FC_SECTION 0x0002
  52. #define FC_QUALIFIED 0x0008
  53. #define FC_DEST_QUALIFIED 0x0010
  54. #define FC_LISTTYPE 0x0020
  55. #define FC_CALLBACK_WITH_VER 0x0040
  56. #define FC_ABORT 0
  57. #define FC_IGNORE 1
  58. #define FC_RETRY 2
  59. #define FC_ERROR_LOADED_DRIVER 0x80
  60. /*******************************************************************
  61. *
  62. * Global Variables
  63. *
  64. *******************************************************************/
  65. // Path to the directory where we found the .inf file
  66. extern char szSetupPath[MAX_PATH];
  67. // Path to the user's disk(s)
  68. extern char szDiskPath[MAX_PATH]; // Path to the default drive -
  69. //
  70. extern BOOL bRetry;
  71. // Name of the driver being installed
  72. extern char szDrv[120];
  73. //
  74. extern char szFileError[50];
  75. // Parent window for file copy dialogues
  76. extern HWND hMesgBoxParent;
  77. // TRUE on copying first file to prompt user if file already exists
  78. // FALSE for subsequent copies
  79. extern BOOL bQueryExist;
  80. ///////////////////////////////////////////////////////////////////////////////
  81. BOOL DefCopyCallback(int msg, DWORD_PTR n, LPTSTR szFile);
  82. UINT FileCopy (LPTSTR szSource, LPTSTR szDir, FPFNCOPY fpfnCopy, UINT fCopy, HWND hPar, BOOL fQuery);
  83. LONG TryCopy(LPTSTR, LPTSTR, LPTSTR, FPFNCOPY);
  84. BOOL GetDiskPath(LPTSTR Disk, LPTSTR szPath);
  85. BOOL ExpandFileName(LPTSTR szFile, LPTSTR szPath);
  86. void catpath(LPTSTR path, LPTSTR sz);
  87. LPTSTR FileName(LPTSTR szPath);
  88. LPTSTR RemoveDiskId(LPTSTR szPath);
  89. LPTSTR StripPathName(LPTSTR szPath);
  90. BOOL IsFileKernelDriver(LPTSTR szPath);
  91. UINT ConvertFlagToValue(DWORD dwFlags);
  92. BOOL IsValidDiskette(int iDrive);
  93. BOOL IsDiskInDrive(int iDisk);
  94. BOOL GetInstallPath(LPTSTR szDirOfSrc);
  95. BOOL wsInfParseInit(void);
  96. void wsStartWait();
  97. void wsEndWait();
  98. int fDialog(int id, HWND hwnd, DLGPROC fpfn);
  99. UINT wsCopyError(int n, LPTSTR szFile);
  100. UINT wsInsertDisk(LPTSTR Disk, LPTSTR szSrcPath);
  101. INT_PTR wsDiskDlg(HWND hDlg, UINT uiMessage, UINT wParam, LPARAM lParam);
  102. UINT wsCopySingleStatus(int msg, DWORD_PTR n, LPTSTR szFile);
  103. INT_PTR wsExistDlg(HWND hDlg, UINT uiMessage, UINT wParam, LPARAM lParam);
  104. VOID RemoveSpaces(LPTSTR szPath, LPTSTR szEdit);
  105. PINF infLoadFile(int fh);
  106. PINF infOpen(LPTSTR szInf);
  107. void infClose(PINF pinf);
  108. UINT_PTR FindSection(PINF pInf, LPTSTR pszSect);
  109. BOOL fnGetDataString(PINF npszData, LPTSTR szDataStr, LPTSTR szBuf);
  110. PINF infSetDefault(PINF pinf);
  111. PINF infFindSection(PINF pinf, LPTSTR szSection);
  112. BOOL infGetProfileString(PINF pinf, LPTSTR szSection,LPTSTR szItem,LPTSTR szBuf);
  113. BOOL infParseField(PINF szData, int n, LPTSTR szBuf);
  114. int infLineCount(PINF pinf);
  115. PINF infNextLine(PINF pinf);
  116. int infLineCount(PINF pinf);
  117. PINF infFindInstallableDriversSection(PINF pinf);
  118. #endif