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.

292 lines
8.1 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. // All rights reserved.
  5. //
  6. // Module Name:
  7. // supplib.h
  8. //
  9. // Description:
  10. // This file contains defs for the supplib exports, macros etc...
  11. // It is included by setupmgr.h. Don't include this file directly.
  12. //
  13. //----------------------------------------------------------------------------
  14. #define MAX_INILINE_LEN 1024 // Buffer length for line in answer file
  15. #define MAX_ININAME_LEN 127 // Max chars for [SectionName] and KeyName
  16. //
  17. // Count of chars macro
  18. //
  19. #define StrBuffSize(x) ( sizeof(x) / sizeof(TCHAR) )
  20. //
  21. // Growing list of renamed C run-time functions.
  22. //
  23. #define lstrdup _wcsdup
  24. #define lstrlwr _wcslwr
  25. #define lstrchr wcschr
  26. #define lstrncmp wcsncmp
  27. #define lsprintf _stprintf
  28. //
  29. // settngs.c
  30. //
  31. // The below routines are how setupmgr writes out it's settings to the
  32. // answer file, the udf, etc.
  33. //
  34. // We queue up what to write to these files, and when all settings have
  35. // been queued, we flush it to disk. See supplib\settngs.c for details.
  36. //
  37. typedef enum {
  38. SETTING_QUEUE_ANSWERS,
  39. SETTING_QUEUE_UDF,
  40. SETTING_QUEUE_ORIG_ANSWERS,
  41. SETTING_QUEUE_ORIG_UDF,
  42. SETTING_QUEUE_TXTSETUP_OEM
  43. } QUEUENUM;
  44. BOOL SettingQueue_AddSetting(LPTSTR lpSection,
  45. LPTSTR lpKey,
  46. LPTSTR lpValue,
  47. QUEUENUM dwWhichQueue);
  48. VOID SettingQueue_MarkVolatile(LPTSTR lpSection,
  49. QUEUENUM dwWhichQueue);
  50. VOID SettingQueue_Empty(QUEUENUM dwWhichQueue);
  51. BOOL SettingQueue_Flush(LPTSTR lpFileName,
  52. QUEUENUM dwWhichQueue);
  53. VOID SettingQueue_Copy(QUEUENUM dwFrom, QUEUENUM dwTo);
  54. VOID SettingQueue_RemoveSection( LPTSTR lpSection, QUEUENUM dwWhichQueue );
  55. VOID
  56. LoadOriginalSettingsLow(HWND hwnd,
  57. LPTSTR lpFileName,
  58. QUEUENUM dwWhichQueue);
  59. //
  60. // namelist.c
  61. //
  62. // Struct that stores "name lists". These are useful for arbitrary
  63. // length listboxes such as "computername" and "printers" dialog.
  64. //
  65. // Any NAMELIST declared must be initialized to { 0 } before use.
  66. //
  67. typedef struct {
  68. UINT AllocedSize; // private: how big is *Names? (malloced size)
  69. UINT nEntries; // private: how many entries
  70. TCHAR **Names; // private: list of names
  71. } NAMELIST, *PNAMELIST;
  72. EXTERN_C VOID ResetNameList(NAMELIST *pNameList);
  73. EXTERN_C UINT GetNameListSize(NAMELIST *pNameList);
  74. EXTERN_C TCHAR *GetNameListName(NAMELIST *pNameList, UINT idx);
  75. EXTERN_C BOOL RemoveNameFromNameList(NAMELIST *pNameList, TCHAR *NameToRemove);
  76. EXTERN_C VOID RemoveNameFromNameListIdx(NAMELIST *pNameList, UINT idx);
  77. EXTERN_C INT FindNameInNameList(NAMELIST *pNameList, TCHAR *String);
  78. EXTERN_C BOOL AddNameToNameList(NAMELIST *pNameList, TCHAR *String);
  79. EXTERN_C BOOL AddNameToNameListIdx(NAMELIST *pNameList,
  80. TCHAR *String,
  81. UINT idx);
  82. EXTERN_C BOOL AddNameToNameListNoDuplicates( NAMELIST *pNameList,
  83. TCHAR *String );
  84. //
  85. // exports from fonts.c
  86. //
  87. VOID SetControlFont(
  88. IN HFONT hFont,
  89. IN HWND hwnd,
  90. IN INT nId);
  91. VOID SetupFonts(
  92. IN HINSTANCE hInstance,
  93. IN HWND hwnd,
  94. IN HFONT *pBigBoldFont,
  95. IN HFONT *pBoldFont);
  96. VOID DestroyFonts(
  97. IN HFONT hBigBoldFont,
  98. IN HFONT hBoldFont);
  99. //
  100. // exports from msg.c
  101. //
  102. //
  103. // Assert macros. Pass only ANSI strings (no unicode).
  104. //
  105. #if DBG
  106. EXTERN_C VOID __cdecl SetupMgrAssert(char *pszFile, int iLine, char *pszFormat, ...);
  107. #define Assert( exp ) \
  108. if (!(exp)) \
  109. SetupMgrAssert( __FILE__ , __LINE__ , #exp )
  110. #define AssertMsg( exp, msg ) \
  111. if (!(exp)) \
  112. SetupMgrAssert( __FILE__ , __LINE__ , msg )
  113. #define AssertMsg1( exp, msg, a1 ) \
  114. if (!(exp)) \
  115. SetupMgrAssert( __FILE__ , __LINE__ , msg, a1 )
  116. #define AssertMsg2( exp, msg, a1, a2 ) \
  117. if (!(exp)) \
  118. SetupMgrAssert( __FILE__ , __LINE__ , msg, a1, a2 )
  119. #else
  120. #define Assert( exp )
  121. #define AssertMsg( exp, msg )
  122. #define AssertMsg1( exp, msg, a1 )
  123. #define AssertMsg2( exp, msg, a1, a2 )
  124. #endif // DBG
  125. //
  126. // Bit-flags for ReportError()
  127. //
  128. // Choose either:
  129. // MSGTYPE_ERR
  130. // MSGTYPE_WARN
  131. // MSGTYPE_YESNO
  132. // MSGTYPE_RETRYCANCEL
  133. //
  134. // These can be or'red in at will:
  135. // MSGTYPE_WIN32
  136. //
  137. // Notes:
  138. // - Don't fiddle with the actual values of these constants unless
  139. // you fiddle with the ReportError() function as well.
  140. //
  141. // - 8 bits are reserved for the "MajorType". Callers don't need to
  142. // worry about this. If you're enhancing ReportError(), you do need
  143. // to worry about this.
  144. //
  145. #define MSGTYPE_ERR 0x01 // error icon + ok button
  146. #define MSGTYPE_WARN 0x02 // warning icon + ok button
  147. #define MSGTYPE_YESNO 0x04 // question icon + yes & no buttons
  148. #define MSGTYPE_RETRYCANCEL 0x08 // erro icon + retry & cancel buttons
  149. #define MSGTYPE_WIN32 0x100 // also report Win32 error msg
  150. #if DBG
  151. int
  152. __cdecl
  153. ReportError(
  154. HWND hwnd, // calling window
  155. DWORD dwMsgType, // combo of MSGTYPE_*
  156. LPTSTR lpMessageStr, // passed to sprintf
  157. ...);
  158. #endif // DBG
  159. int
  160. __cdecl
  161. ReportErrorId(
  162. HWND hwnd, // calling window
  163. DWORD dwMsgType, // combo of MSGTYPE_*
  164. UINT StringId, // resource id, passed to sprintf
  165. ...);
  166. //
  167. // exports from pathsup.c
  168. //
  169. EXTERN_C BOOL __cdecl ConcatenatePaths(LPTSTR lpBuffer, ...);
  170. LPTSTR ParseDriveLetterOrUnc(LPTSTR lpFileName);
  171. LPTSTR MyGetFullPath(LPTSTR lpFileName);
  172. VOID GetComputerNameFromUnc( IN TCHAR *szFullUncPath, OUT TCHAR *szComputerName, IN DWORD cbSize );
  173. BOOL GetPathFromPathAndFilename( IN LPTSTR lpPathAndFileName, OUT TCHAR *szPath, IN DWORD cbSize );
  174. LONGLONG MyGetDiskFreeSpace(LPTSTR Drive);
  175. LONGLONG MySetupQuerySpaceRequiredOnDrive(HDSKSPC hDiskSpace, LPTSTR Drive);
  176. BOOL IsPathOnLocalDiskDrive(LPCTSTR lpPath);
  177. BOOL DoesFolderExist(LPTSTR lpFolder);
  178. BOOL DoesFileExist(LPTSTR lpFileName);
  179. BOOL DoesPathExist(LPTSTR lpPathName);
  180. BOOL EnsureDirExists(LPTSTR lpDirName);
  181. VOID ILFreePriv(LPITEMIDLIST pidl);
  182. BOOL GetAnswerFileName(HWND hwnd, LPTSTR lpFileName, BOOL bSavingFile);
  183. INT ShowBrowseFolder( IN HWND hwnd,
  184. IN TCHAR *szFileFilter,
  185. IN TCHAR *szFileExtension,
  186. IN DWORD dwFlags,
  187. IN TCHAR *szStartingPath,
  188. IN OUT TCHAR *szFileNameAndPath );
  189. VOID GetPlatform( OUT TCHAR *pBuffer );
  190. //
  191. // exports from chknames.c
  192. //
  193. BOOL IsNetNameValid( LPTSTR NameToCheck );
  194. BOOL IsValidComputerName( LPTSTR ComputerName );
  195. BOOL IsValidNetShareName( LPTSTR NetShareName );
  196. BOOL IsValidFileName8_3( LPTSTR FileName );
  197. BOOL IsValidPathNameNoRoot8_3( LPTSTR PathName );
  198. //
  199. // string.c
  200. //
  201. LPTSTR MyLoadString(IN UINT StringId);
  202. LPTSTR CleanLeadSpace(LPTSTR Buffer);
  203. VOID CleanTrailingSpace(TCHAR *pszBuffer);
  204. LPTSTR CleanSpaceAndQuotes(LPTSTR Buffer);
  205. VOID ConvertQuestionsToNull( IN OUT TCHAR *pszString );
  206. EXTERN_C TCHAR* lstrcatn( IN TCHAR *pszString1, IN const TCHAR *pszString2, IN INT iMaxLength );
  207. VOID DoubleNullStringToNameList( TCHAR *szDoubleNullString, NAMELIST *pNameList );
  208. EXTERN_C BOOL GetCommaDelimitedEntry( OUT TCHAR szIPString[], IN OUT TCHAR **pBuffer );
  209. VOID StripQuotes( IN OUT TCHAR *);
  210. BOOL DoesContainWhiteSpace( LPCTSTR p );
  211. //
  212. // Exports from & macros for fileio.c
  213. //
  214. FILE* My_fopen( LPWSTR FileName,
  215. LPWSTR Mode );
  216. int My_fputs( LPWSTR Buffer,
  217. FILE* fp );
  218. LPWSTR My_fgets( LPWSTR Buffer,
  219. int MaxChars,
  220. FILE* fp );
  221. #define My_fclose fclose
  222. //
  223. // Export from chknames.c
  224. //
  225. extern LPTSTR IllegalNetNameChars;
  226. //
  227. // listbox.c
  228. //
  229. VOID OnUpButtonPressed( IN HWND hwnd, IN WORD ListBoxControlID );
  230. VOID OnDownButtonPressed( IN HWND hwnd, IN WORD ListBoxControlID );
  231. VOID SetArrows( IN HWND hwnd,
  232. IN WORD ListBoxControlID,
  233. IN WORD UpButtonControlID,
  234. IN WORD DownButtonControlID );