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.

136 lines
3.8 KiB

  1. /*
  2. * SULIB.H - Windows/DOS Setup common code
  3. *
  4. * Modification History:
  5. *
  6. *
  7. * 3/23/89 Toddla combined common.h and prototypes into this file
  8. * 1/28/91 MichaelE Added AUDIO_CARDS_SECT for different audio card choices.
  9. * 4/17/91 Removed some DOS.ASM routines not used anywhere.
  10. * 5/29/91 JKLin added prototype for IsCDROMDrive function
  11. *
  12. */
  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. /* flags for _llseek */
  19. #define SEEK_CUR 1
  20. #define SEEK_END 2
  21. #define SEEK_SET 0
  22. #define MAXFILESPECLEN MAX_PATH /* drive: + path length max + Null Byte */
  23. #define MAX_INF_LINE_LEN 256 /* Maximum length of any .inf line */
  24. #define MAX_SYS_INF_LEN 256 /* ##: + 8.3 + NULL */
  25. #define MAX_SECT_NAME_LEN 40 /* Max length of a section Name. */
  26. #define MAX_FILE_SPEC MAX_PATH // 8.3 + X: + NULL.
  27. #define DISK_SECT "disks"
  28. #define OEMDISK_SECT "oemdisks"
  29. /* Return codes from 'file exists' dialog */
  30. enum {
  31. CopyNeither, // User wants to cancel if file exists
  32. CopyCurrent, // User wants to use current file
  33. CopyNew // User wants to copy new file
  34. };
  35. #define SLASH(c) ((c) == '/' || (c) == '\\')
  36. #define CHSEPSTR "\\"
  37. #define COMMA ','
  38. #define SPACE ' '
  39. /* Globals and routines for .inf file parsing */
  40. typedef LPSTR PINF;
  41. extern PINF infOpen(LPSTR szInf);
  42. extern void infClose(PINF pinf);
  43. extern PINF infSetDefault(PINF pinf);
  44. extern PINF infFindSection(PINF pinf, LPSTR szSection);
  45. extern BOOL infGetProfileString(PINF pinf, LPSTR szSection, LPSTR szItem,LPSTR szBuf);
  46. extern BOOL infParseField(PINF szData, int n, LPSTR szBuf);
  47. extern PINF infNextLine(PINF pinf);
  48. extern int infLineCount(PINF pinf);
  49. extern BOOL infLookup(LPSTR szInf, LPSTR szBuf);
  50. extern PINF FindInstallableDriversSection(PINF pinf);
  51. /* Message types for FileCopy callback function */
  52. typedef BOOL (*FPFNCOPY) (int,DWORD,LPSTR);
  53. #define COPY_ERROR 0x0001
  54. #define COPY_INSERTDISK 0x0003
  55. #define COPY_QUERYCOPY 0x0004
  56. #define COPY_START 0x0005
  57. #define COPY_END 0x0006
  58. #define COPY_EXISTS 0x0007
  59. extern UINT FileCopy (LPSTR szSource, LPSTR szDir, FPFNCOPY fpfnCopy, UINT fCopy);
  60. /* Option Flag values for FileCopy */
  61. #define FC_FILE 0x0000
  62. #define FC_LIST 0x0001
  63. #define FC_SECTION 0x0002
  64. #define FC_QUALIFIED 0x0008
  65. #define FC_DEST_QUALIFIED 0x0010
  66. #define FC_LISTTYPE 0x0020
  67. #define FC_CALLBACK_WITH_VER 0x0040
  68. #define FC_ABORT 0
  69. #define FC_IGNORE 1
  70. #define FC_RETRY 2
  71. #define FC_ERROR_LOADED_DRIVER 0x80
  72. /* External functions from copy.c */
  73. extern BOOL ExpandFileName(LPSTR szFile, LPSTR szPath);
  74. extern void catpath(LPSTR path, LPSTR sz);
  75. extern BOOL fnFindFile(char *);
  76. extern LPSTR FileName(LPSTR szPath);
  77. extern LPSTR RemoveDiskId(LPSTR szPath);
  78. extern LPSTR StripPathName(LPSTR szPath);
  79. extern BOOL IsFileKernelDriver(LPSTR szPath);
  80. /*******************************************************************
  81. *
  82. * Global Variables
  83. *
  84. *******************************************************************/
  85. // Path to the directory where we found the .inf file
  86. extern char szSetupPath[MAX_PATH];
  87. // Path to the user's disk(s)
  88. extern char szDiskPath[MAX_PATH]; // Path to the default drive -
  89. //
  90. extern BOOL bRetry;
  91. // Name of the driver being installed
  92. extern char szDrv[120];
  93. //
  94. extern char szFileError[50];
  95. // Parent window for file copy dialogues
  96. HWND hMesgBoxParent;
  97. // TRUE on copying first file to prompt user if file already exists
  98. // FALSE for subsequent copies
  99. extern BOOL bQueryExist;