Leaked source code of windows server 2003
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.

141 lines
4.4 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. #define SIZEOF(array) (sizeof(array)/sizeof((array)[0]))
  19. // INF_PARSE_XXX macros are to be used with the return code from InfParseField()
  20. #define INF_PARSE_FAILED(n) ((n) != ERROR_SUCCESS && (n) != ERROR_NOT_FOUND)
  21. #define INF_PARSE_SUCCESS(n) ((n) == ERROR_SUCCESS || (n) == ERROR_NOT_FOUND)
  22. /* flags for _llseek */
  23. #define SEEK_CUR 1
  24. #define SEEK_END 2
  25. #define SEEK_SET 0
  26. #define MAXFILESPECLEN MAX_PATH /* drive: + path length max + Null Byte */
  27. #define MAX_INF_LINE_LEN 256 /* Maximum length of any .inf line */
  28. #define MAX_SYS_INF_LEN 256 /* ##: + 8.3 + NULL */
  29. #define MAX_SECT_NAME_LEN 40 /* Max length of a section Name. */
  30. #define MAX_FILE_SPEC MAX_PATH // 8.3 + X: + NULL.
  31. #define DISK_SECT TEXT("disks")
  32. #define OEMDISK_SECT TEXT("oemdisks")
  33. /* Return codes from 'file exists' dialog */
  34. enum {
  35. CopyNeither, // User wants to cancel if file exists
  36. CopyCurrent, // User wants to use current file
  37. CopyNew // User wants to copy new file
  38. };
  39. #define SLASH(c) ((c) == TEXT('/') || (c) == TEXT('\\'))
  40. #define CHSEPSTR TEXT("\\")
  41. #define COMMA TEXT(',')
  42. #define SPACE TEXT(' ')
  43. /* Globals and routines for .inf file parsing */
  44. typedef LPTSTR PINF;
  45. extern PINF infOpen(LPTSTR szInf);
  46. extern void infClose(PINF pinf);
  47. extern PINF infSetDefault(PINF pinf);
  48. extern PINF infFindSection(PINF pinf, LPTSTR szSection);
  49. extern LONG infGetProfileString(PINF pinf, LPTSTR szSection, LPTSTR szItem, LPTSTR szBuf, size_t cchBuf);
  50. extern LONG infParseField(PINF szData, int n, LPTSTR szBuf, size_t cchBuf);
  51. extern PINF infNextLine(PINF pinf);
  52. extern int infLineCount(PINF pinf);
  53. extern BOOL infLookup(LPTSTR szInf, LPTSTR szBuf);
  54. extern PINF FindInstallableDriversSection(PINF pinf);
  55. /* Message types for FileCopy callback function */
  56. typedef BOOL (*FPFNCOPY) (int,DWORD_PTR,LPTSTR);
  57. #define COPY_ERROR 0x0001
  58. #define COPY_INSERTDISK 0x0003
  59. #define COPY_QUERYCOPY 0x0004
  60. #define COPY_START 0x0005
  61. #define COPY_END 0x0006
  62. #define COPY_EXISTS 0x0007
  63. extern UINT FileCopy (LPTSTR szSource, LPTSTR szDir, FPFNCOPY fpfnCopy, UINT fCopy);
  64. /* Option Flag values for FileCopy */
  65. #define FC_FILE 0x0000
  66. #define FC_LIST 0x0001
  67. #define FC_SECTION 0x0002
  68. #define FC_QUALIFIED 0x0008
  69. #define FC_DEST_QUALIFIED 0x0010
  70. #define FC_LISTTYPE 0x0020
  71. #define FC_CALLBACK_WITH_VER 0x0040
  72. #define FC_ABORT 0
  73. #define FC_IGNORE 1
  74. #define FC_RETRY 2
  75. #define FC_ERROR_LOADED_DRIVER 0x80
  76. /* External functions from copy.c */
  77. extern LONG ExpandFileName(LPTSTR szFile, LPTSTR szPath);
  78. extern void catpath(LPTSTR path, LPTSTR sz);
  79. extern BOOL fnFindFile(TCHAR *);
  80. extern LPTSTR FileName(LPTSTR szPath);
  81. extern LPTSTR RemoveDiskId(LPTSTR szPath);
  82. extern LPTSTR StripPathName(LPTSTR szPath);
  83. extern BOOL IsFileKernelDriver(LPTSTR szPath);
  84. /*******************************************************************
  85. *
  86. * Global Variables
  87. *
  88. *******************************************************************/
  89. // Path to the directory where we found the .inf file
  90. extern TCHAR szSetupPath[MAX_PATH];
  91. // Path to the user's disk(s)
  92. extern TCHAR szDiskPath[MAX_PATH]; // Path to the default drive -
  93. //
  94. extern BOOL bRetry;
  95. // Name of the driver being installed
  96. extern TCHAR szDrv[120];
  97. //
  98. extern TCHAR szFileError[50];
  99. // Parent window for file copy dialogues
  100. HWND hMesgBoxParent;
  101. // TRUE on copying first file to prompt user if file already exists
  102. // FALSE for subsequent copies
  103. extern BOOL bQueryExist;