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.

478 lines
11 KiB

  1. /*++
  2. Copyright (c) 1990-1998, Microsoft Corporation All rights reserved.
  3. Module Name:
  4. comdlg32.h
  5. Abstract:
  6. This module contains the private header information for the Win32
  7. common dialogs.
  8. Revision History:
  9. --*/
  10. #ifndef COMDLG_COMDLG32
  11. #define COMDLG_COMDLG32
  12. //
  13. // Include Files.
  14. //
  15. #include <w4warn.h>
  16. /*
  17. * Level 4 warnings to be turned on.
  18. * Do not disable any more level 4 warnings.
  19. */
  20. #pragma warning(disable:4306) // 'type cast' : conversion from 'LANGID' to 'LPVOID ' of greater size
  21. #pragma warning(disable:4245) // 'initializing' : conversion from 'HRESULT' to 'DWORD', signed/unsigned mismatch
  22. #pragma warning(disable:4213) // nonstandard extension used : cast on l-value
  23. #pragma warning(disable:4305) // 'type cast' : truncation from 'LPVOID ' to 'LANGID'
  24. #pragma warning(disable:4127) // conditional expression is constant
  25. #pragma warning(disable:4189) // 'hEnum' : local variable is initialized but not referenced
  26. #pragma warning(disable:4057) // 'function' : 'const LPCSTR ' differs in indirection to slightly different base types f 'BYTE [32]'
  27. #pragma warning(disable:4706) // assignment within conditional expression
  28. #pragma warning(disable:4701) // local variable 'lFract' may be used without having been initialized
  29. #pragma warning(disable:4702) // unreachable code
  30. #include "isz.h"
  31. #include "cderr.h"
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. //
  36. // Constant Declarations.
  37. //
  38. #define SEM_NOERROR 0x8003
  39. //
  40. // There really should be no "max" path lengths, but for now,
  41. // since unc will take up RMLEN (lmcons.h), make it 98.
  42. //
  43. #define CCHUNCPATH 98
  44. #define CCHNETPATH 358
  45. #define MAX_THREADS 128
  46. #define CHAR_A TEXT('a')
  47. #define CHAR_CAP_A TEXT('A')
  48. #define CHAR_C TEXT('c')
  49. #define CHAR_Z TEXT('z')
  50. #define CHAR_NULL TEXT('\0')
  51. #define CHAR_COLON TEXT(':')
  52. #define CHAR_BSLASH TEXT('\\')
  53. #define CHAR_DOT TEXT('.')
  54. #define CHAR_QMARK TEXT('?')
  55. #define CHAR_STAR TEXT('*')
  56. #define CHAR_SLASH TEXT('/')
  57. #define CHAR_SPACE TEXT(' ')
  58. #define CHAR_QUOTE TEXT('"')
  59. #define CHAR_PLUS TEXT('+')
  60. #define CHAR_LTHAN TEXT('<')
  61. #define CHAR_BAR TEXT('|')
  62. #define CHAR_COMMA TEXT(',')
  63. #define CHAR_LBRACKET TEXT('[')
  64. #define CHAR_RBRACKET TEXT(']')
  65. #define CHAR_EQUAL TEXT('=')
  66. #define CHAR_SEMICOLON TEXT(';')
  67. #define STR_BLANK TEXT("")
  68. #define STR_SEMICOLON TEXT(";")
  69. #define IS_DOTEND(ch) ((ch) == CHAR_DOT || (ch) == 0 || ((ch) != CHAR_STAR))
  70. #define PARSE_DIRECTORYNAME -1
  71. #define PARSE_INVALIDDRIVE -2
  72. #define PARSE_INVALIDPERIOD -3
  73. #define PARSE_MISSINGDIRCHAR -4
  74. #define PARSE_INVALIDCHAR -5
  75. #define PARSE_INVALIDDIRCHAR -6
  76. #define PARSE_INVALIDSPACE -7
  77. #define PARSE_EXTENSIONTOOLONG -8
  78. #define PARSE_FILETOOLONG -9
  79. #define PARSE_EMPTYSTRING -10
  80. #define PARSE_WILDCARDINDIR -11
  81. #define PARSE_WILDCARDINFILE -12
  82. #define PARSE_INVALIDNETPATH -13
  83. #define PARSE_NOXMEMORY -14
  84. #define OF_FILENOTFOUND 2
  85. #define OF_PATHNOTFOUND 3
  86. #define OF_NOFILEHANDLES 4
  87. #define OF_ACCESSDENIED 5 // OF_NODISKINFLOPPY
  88. #define OF_WRITEPROTECTION 19
  89. #define OF_SHARINGVIOLATION 32
  90. #define OF_NETACCESSDENIED 65
  91. #define OF_DISKFULL 82
  92. #define OF_INT24FAILURE 83
  93. #define OF_CREATENOMODIFY 96
  94. #define OF_NODRIVE 97
  95. #define OF_PORTNAME 98
  96. #define OF_LAZYREADONLY 99
  97. #define OF_DISKFULL2 112
  98. #ifndef DCE_UNICODIZED
  99. #define DeviceCapabilitiesExA DeviceCapabilitiesEx
  100. #endif
  101. //
  102. // Used to determine which type of message to send to the app.
  103. //
  104. #define COMDLG_ANSI 0x0
  105. #define COMDLG_WIDE 0x1
  106. #define HNULL ((HANDLE) 0)
  107. #define cbResNameMax 32
  108. #define cbDlgNameMax 32
  109. //
  110. // Platform specific definitions.
  111. //
  112. #ifdef WINNT
  113. #define IS16BITWOWAPP(p) ((p)->Flags & CD_WOWAPP)
  114. #else
  115. #define IS16BITWOWAPP(p) (GetProcessDword(0, GPD_FLAGS) & GPF_WIN16_PROCESS)
  116. #endif
  117. #ifdef WX86
  118. #define ISWX86APP(p) ((p)->Flags & CD_WX86APP)
  119. #define GETGENERICHOOKFN(p,fn) (ISWX86APP(p) ? Wx86GetX86Callback((p)->fn) : (p)->fn)
  120. #else
  121. #define ISWX86APP(p) (FALSE)
  122. #define GETGENERICHOOKFN(p,fn) ((p)->fn)
  123. #endif
  124. #define GETHOOKFN(p) GETGENERICHOOKFN(p,lpfnHook)
  125. #define GETPRINTHOOKFN(p) GETGENERICHOOKFN(p,lpfnPrintHook)
  126. #define GETSETUPHOOKFN(p) GETGENERICHOOKFN(p,lpfnSetupHook)
  127. #define GETPAGEPAINTHOOKFN(p) GETGENERICHOOKFN(p,lpfnPagePaintHook)
  128. #ifndef CD_WX86APP
  129. #define CD_WX86APP (0) // Nothing special if we don't have it defined
  130. #endif
  131. //
  132. // Typedef Declarations.
  133. //
  134. //
  135. // External Declarations.
  136. //
  137. extern HINSTANCE g_hinst; // instance handle of library
  138. extern SHORT cyCaption, cyBorder, cyVScroll;
  139. extern SHORT cxVScroll, cxBorder, cxSize;
  140. extern TCHAR szNull[];
  141. extern TCHAR szStar[];
  142. extern TCHAR szStarDotStar[];
  143. extern BOOL bMouse; // system has a mouse
  144. extern BOOL bCursorLock;
  145. extern BOOL bWLO; // running with WLO
  146. extern BOOL bDBCS; // running DBCS
  147. extern WORD wWinVer; // windows version
  148. extern WORD wDOSVer; // DOS version
  149. extern BOOL g_bUserPressedCancel; // user pressed cancel button
  150. //
  151. // initialized via RegisterWindowMessage
  152. //
  153. extern UINT msgWOWLFCHANGE;
  154. extern UINT msgWOWDIRCHANGE;
  155. extern UINT msgWOWCHOOSEFONT_GETLOGFONT;
  156. extern UINT msgLBCHANGEA;
  157. extern UINT msgSHAREVIOLATIONA;
  158. extern UINT msgFILEOKA;
  159. extern UINT msgCOLOROKA;
  160. extern UINT msgSETRGBA;
  161. extern UINT msgHELPA;
  162. extern UINT msgLBCHANGEW;
  163. extern UINT msgSHAREVIOLATIONW;
  164. extern UINT msgFILEOKW;
  165. extern UINT msgCOLOROKW;
  166. extern UINT msgSETRGBW;
  167. extern UINT msgHELPW;
  168. extern UINT g_cfCIDA;
  169. extern DWORD g_tlsLangID;
  170. //
  171. // Function Prototypes.
  172. //
  173. VOID TermFind(void);
  174. VOID TermColor(void);
  175. VOID TermFont(void);
  176. VOID TermFile(void);
  177. VOID TermPrint(void);
  178. void FreeImports(void);
  179. //
  180. // dlgs.c
  181. //
  182. VOID
  183. HourGlass(
  184. BOOL bOn);
  185. void
  186. StoreExtendedError(
  187. DWORD dwError);
  188. DWORD
  189. GetStoredExtendedError(void);
  190. HBITMAP WINAPI
  191. LoadAlterBitmap(
  192. int id,
  193. DWORD rgbReplace,
  194. DWORD rgbInstead);
  195. VOID
  196. AddNetButton(
  197. HWND hDlg,
  198. HANDLE hInstance,
  199. int dyBottomMargin,
  200. BOOL bAddAccel,
  201. BOOL bTryLowerRight,
  202. BOOL bTryLowerLeft);
  203. BOOL
  204. IsNetworkInstalled(void);
  205. int CDLoadStringEx(UINT uiCP, HINSTANCE hInstance, UINT uID, LPTSTR lpBuffer, int nBufferMax);
  206. int CDLoadString(HINSTANCE hInstance, UINT uID, LPTSTR lpBuffer, int nBufferMax);
  207. LANGID
  208. GetDialogLanguage(
  209. HWND hwndOwner,
  210. HANDLE hDlgTemplate);
  211. //
  212. // parse.c
  213. //
  214. int
  215. ParseFileNew(
  216. LPTSTR pszPath,
  217. int *pnExtOffset,
  218. BOOL bWowApp,
  219. BOOL bNewStyle);
  220. int
  221. ParseFileOld(
  222. LPTSTR pszPath,
  223. int *pnExtOffset,
  224. int *pnOldExt,
  225. BOOL bWowApp,
  226. BOOL bNewStyle);
  227. DWORD
  228. ParseFile(
  229. LPTSTR lpstrFileName,
  230. BOOL bLFNFileSystem,
  231. BOOL bWowApp,
  232. BOOL bNewStyle);
  233. LPTSTR
  234. PathRemoveBslash(
  235. LPTSTR lpszPath);
  236. BOOL
  237. IsWild(
  238. LPCTSTR lpsz);
  239. VOID
  240. AppendExt(
  241. LPTSTR lpszPath,
  242. LPCTSTR lpExtension,
  243. BOOL bWildcard);
  244. BOOL
  245. IsUNC(
  246. LPCTSTR lpszPath);
  247. BOOL
  248. PortName(
  249. LPTSTR lpszFileName);
  250. BOOL
  251. IsDirectory(
  252. LPTSTR pszPath);
  253. int
  254. WriteProtectedDirCheck(
  255. LPCTSTR lpszFile);
  256. BOOL
  257. FOkToWriteOver(
  258. HWND hDlg,
  259. LPTSTR szFileName);
  260. int
  261. CreateFileDlg(
  262. HWND hDlg,
  263. LPTSTR szPath);
  264. //
  265. // Fileopen specific stuff stashed here so we can free it upon
  266. // a DLL_PROCESS_DETACH.
  267. //
  268. typedef struct _OFN_DISKINFO {
  269. UINT cchLen; // number of chars allocated in 4 lptstrs
  270. LPTSTR lpAbbrName; // single line form
  271. LPTSTR lpMultiName; // drop-down form
  272. LPTSTR lpName; // true form (for comparisons)
  273. LPTSTR lpPath; // path prefix (a:, or \\server\share) for file searches
  274. TCHAR wcDrive; // drive letter, 0 for unc
  275. BOOL bCasePreserved;
  276. DWORD dwType;
  277. BOOL bValid;
  278. } OFN_DISKINFO;
  279. #define MAX_DISKS 100
  280. #define WNETENUM_BUFFSIZE 0x4000
  281. //
  282. // Defines for AddNetButton.
  283. //
  284. #define FILE_LEFT_MARGIN 5
  285. #define FILE_RIGHT_MARGIN 3
  286. #define FILE_TOP_MARGIN 0
  287. #define FILE_BOTTOM_MARGIN 3
  288. #ifdef WX86
  289. //
  290. // Wx86 support for calling from RISC into x86 hooks
  291. //
  292. PVOID
  293. Wx86GetX86Callback(
  294. PVOID lpfnHook);
  295. typedef PVOID
  296. (*PALLOCCALLBX86)(
  297. PVOID pfnx86,
  298. ULONG CBParamType,
  299. PVOID ThunkDebug,
  300. PULONG pLogFlags);
  301. extern PALLOCCALLBX86 pfnAllocCallBx86;
  302. #endif
  303. #ifdef __cplusplus
  304. }; // extern "C"
  305. #endif
  306. // For WOW support on WINNT
  307. #ifdef WINNT
  308. VOID Ssync_ANSI_UNICODE_Struct_For_WOW(HWND hDlg, BOOL fDirection, DWORD dwID);
  309. VOID Ssync_ANSI_UNICODE_CC_For_WOW(HWND hDlg, BOOL f_ANSI_to_UNICODE);
  310. VOID Ssync_ANSI_UNICODE_CF_For_WOW(HWND hDlg, BOOL f_ANSI_to_UNICODE);
  311. VOID Ssync_ANSI_UNICODE_OFN_For_WOW(HWND hDlg, BOOL f_ANSI_to_UNICODE);
  312. VOID Ssync_ANSI_UNICODE_PD_For_WOW(HWND hDlg, BOOL f_ANSI_to_UNICODE);
  313. #endif
  314. // For nested FileOpen/Save common dialog support (something several 16-bit apps
  315. // are known to do). We keep a list of all the dialogs that are active for each
  316. // thread in a process. We make the assumption that common dialogs are THREAD
  317. // modal -- so the first CURDLG struct in the list for a given thread is the
  318. // currently active dialog (has the focus) for that thread. The ptr to the head
  319. // of the list is stored in the thread local storage (TLS) for the thread --
  320. // indexed by g_tlsiCurDlg. Bug #100453 et. al.
  321. typedef struct _CURDLG {
  322. DWORD dwCurDlgNum; // incremental dlg number (per process)
  323. LPTSTR lpstrCurDir; // current directory for the current dialog
  324. struct _CURDLG *next;
  325. } CURDLG;
  326. typedef CURDLG *LPCURDLG;
  327. //Macro to check if the given structure is the new structure.
  328. #define IS_NEW_OFN(pOFN) (pOFN->lStructSize >= sizeof(OPENFILENAME))
  329. // moved from prnsetup.h
  330. #define DN_PADDINGCHARS 16 // extra devnames padding
  331. //
  332. // Some local constants taken from printui.dll
  333. //
  334. enum
  335. {
  336. //
  337. // INTERNET_MAX_HOST_NAME_LENGTH is decalred in wininet.h
  338. //
  339. kDNSMax = INTERNET_MAX_HOST_NAME_LENGTH,
  340. kServerBufMax = kDNSMax + 2 + 1,
  341. //
  342. // Max printer name should really be MAX_PATH, but if you create
  343. // a max path printer and connect to it remotely, win32spl prepends
  344. // "\\server\" to it, causing it to exceed max path. The new UI
  345. // therefore makes the max path MAX_PATH-kServerLenMax, but we still
  346. // allow the old case to work.
  347. //
  348. kPrinterBufMax = MAX_PATH + kServerBufMax + 1,
  349. //
  350. // The initial hint for EnumPrinters API.
  351. //
  352. kInitialPrinterHint = 0x400,
  353. };
  354. #ifdef __cplusplus
  355. extern "C" {
  356. #endif
  357. HRESULT
  358. ThunkDevNamesA2W(
  359. IN HGLOBAL hDevNamesA,
  360. IN OUT HGLOBAL *phDevNamesW
  361. );
  362. HRESULT
  363. ThunkDevNamesW2A(
  364. IN HGLOBAL hDevNamesW,
  365. IN OUT HGLOBAL *phDevNamesA
  366. );
  367. HRESULT
  368. InvokeAddPrinterWizardModal(
  369. IN HWND hwnd,
  370. OUT BOOL *pbPrinterAdded
  371. );
  372. #ifdef __cplusplus
  373. }; // extern "C"
  374. #endif
  375. #endif // !COMDLG_COMDLG32