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.

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