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.

595 lines
12 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. faxui.h
  5. Abstract:
  6. Fax driver user interface header file
  7. Environment:
  8. Fax driver user interface
  9. Revision History:
  10. 01/09/96 -davidx-
  11. Created it.
  12. dd-mm-yy -author-
  13. description
  14. --*/
  15. #ifndef _FAXUI_H_
  16. #define _FAXUI_H_
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #define ISOLATION_AWARE_ENABLED 1
  21. #include <windows.h>
  22. #include <shellapi.h>
  23. #include <fxsapip.h>
  24. #include "faxlib.h"
  25. #include <faxres.h>
  26. #include <winddiui.h>
  27. #include <commctrl.h>
  28. #include <windowsx.h>
  29. #include <prsht.h>
  30. #include <shlwapi.h>
  31. #ifdef FAX_SCAN_ENABLED
  32. #include <twain.h>
  33. #endif
  34. #include "registry.h"
  35. #include "resource.h"
  36. #include "faxsendw.h"
  37. #include "faxroute.h"
  38. #include <shlobj.h>
  39. #include <shfusion.h>
  40. //
  41. // DLL Initialization
  42. //
  43. BOOL InitializeDll();
  44. VOID UnInitializeDll();
  45. //
  46. // Data structure maintained by the fax driver user interface
  47. //
  48. typedef struct
  49. {
  50. PVOID startSign;
  51. HANDLE hPrinter;
  52. HANDLE hheap;
  53. DRVDEVMODE devmode;
  54. PFNCOMPROPSHEET pfnComPropSheet;
  55. HANDLE hComPropSheet;
  56. HANDLE hFaxOptsPage;
  57. BOOL hasPermission;
  58. BOOL configDefault;
  59. LPTSTR pHelpFile;
  60. INT cForms;
  61. LPTSTR pFormNames;
  62. PWORD pPapers;
  63. PVOID endSign;
  64. } UIDATA, *PUIDATA;
  65. //
  66. // Check if a UIDATA structure is valid
  67. //
  68. #define ValidUiData(p) ((p) && (p) == (p)->startSign && (p) == (p)->endSign)
  69. //
  70. // Combine DEVMODE information:
  71. // start with the driver default
  72. // then merge with the system default
  73. // then merge with the user default
  74. // finally merge with the input devmode
  75. //
  76. VOID
  77. GetCombinedDevmode(
  78. PDRVDEVMODE pdmOut,
  79. PDEVMODE pdmIn,
  80. HANDLE hPrinter,
  81. PPRINTER_INFO_2 pPrinterInfo2,
  82. BOOL publicOnly
  83. );
  84. //
  85. // Fill in the data structure used by the fax driver user interface
  86. //
  87. PUIDATA
  88. FillUiData(
  89. HANDLE hPrinter,
  90. PDEVMODE pdmInput
  91. );
  92. //
  93. // Calling common UI DLL entry point dynamically
  94. //
  95. LONG
  96. CallCompstui(
  97. HWND hwndOwner,
  98. PFNPROPSHEETUI pfnPropSheetUI,
  99. LPARAM lParam,
  100. PDWORD pResult
  101. );
  102. //
  103. // Retrieves a list of supported paper sizes
  104. //
  105. DWORD
  106. EnumPaperSizes(
  107. PVOID pOutput,
  108. FORM_INFO_1 *pFormsDB,
  109. DWORD cForms,
  110. INT wCapability
  111. );
  112. #define CCHBINNAME 24 // max length for bin names
  113. #define CCHPAPERNAME 64 // max length for form names
  114. //
  115. // Display an error message dialog
  116. //
  117. INT
  118. DisplayErrorMessage(
  119. HWND hwndParent,
  120. UINT uiType,
  121. INT iErrorCode,
  122. ...
  123. );
  124. #define MAX_TITLE_LEN 128
  125. #define MAX_FORMAT_LEN 128
  126. #define MAX_MESSAGE_LEN 512
  127. // Data structures used by the user mode DLL to associate private
  128. // information with a printer device context (PDEV to be exactly)
  129. //
  130. typedef struct {
  131. PVOID pNext; // Points to the next item in the linked list
  132. HANDLE hPrinter; // Printer handle
  133. HANDLE hMappingFile; // Handle to the mapping file
  134. HANDLE hPreviewFile; // Handle to the preview file (document body)
  135. HANDLE hMapping; // Handle to the mapping object
  136. PMAP_TIFF_PAGE_HEADER pPreviewTiffPage; // View of the mapping containing the preview page
  137. HDC hdc; // Handle to the device context
  138. INT pageCount; // Number of pages in the document
  139. DWORD jobId; // Current job ID
  140. INT jobType; // Job type
  141. BOOL directPrinting; // Direct printing and skip the fax wizard
  142. BOOL bShowPrintPreview; // Indicates the user requested print preview
  143. BOOL bPreviewAborted; // Set to TRUE if an unrecoverable error occurred
  144. // concering print preview
  145. BOOL bAttachment; // TRUE for Direct printing of an attachment
  146. LPTSTR pPrintFile; // print to file file name
  147. LPTSTR pPriority; // Fax priority
  148. LPTSTR pReceiptFlags; // Flags of FAX_ENUM_DELIVERY_REPORT_TYPES
  149. LPTSTR pReceiptAddress; // Email address or computer name
  150. TCHAR szPreviewFile[MAX_PATH]; // Preview file name
  151. TCHAR coverPage[MAX_PATH]; // Cover page filename
  152. BOOL bServerCoverPage; // Is the cover page a server based cover page.
  153. LPTSTR pSubject; // Subject string
  154. LPTSTR pNoteMessage; // Note message string
  155. DRVDEVMODE devmode; // The first field must be a current version devmode
  156. DWORD dwNumberOfRecipients;
  157. PFAX_PERSONAL_PROFILE lpRecipientsInfo;
  158. PFAX_PERSONAL_PROFILE lpSenderInfo;
  159. LPTSTR lptstrServerName;
  160. LPTSTR lptstrPrinterName;
  161. TCHAR tstrTifName[MAX_PATH]; // Cover page filename
  162. PVOID signature; // Signature
  163. } DOCEVENTUSERMEM, *PDOCEVENTUSERMEM;
  164. #define ValidPDEVUserMem(p) \
  165. ((p) && (p) == (p)->signature)
  166. //
  167. // Mark the user mode memory structure
  168. //
  169. #define MarkPDEVUserMem(p) \
  170. { (p)->signature = (p)->devmode.dmPrivate.pUserMem = (p); }
  171. //
  172. // Fax prefix and extension for temporary preview files
  173. //
  174. #define FAX_PREFIX TEXT("fxs")
  175. //
  176. // Different types of print job
  177. //
  178. #define JOBTYPE_DIRECT 0
  179. #define JOBTYPE_NORMAL 1
  180. //
  181. // Free up the user mode memory associated with each PDEV
  182. //
  183. VOID
  184. FreePDEVUserMem(
  185. PDOCEVENTUSERMEM pDocEventUserMem
  186. );
  187. //
  188. // Global variable declarations
  189. //
  190. extern CRITICAL_SECTION faxuiSemaphore;
  191. extern HANDLE g_hResource;
  192. extern BOOL oleInitialized;
  193. extern PDOCEVENTUSERMEM gDocEventUserMemList;
  194. extern HANDLE g_hModule; // DLL instance handle
  195. #define EnterDrvSem() EnterCriticalSection(&faxuiSemaphore)
  196. #define LeaveDrvSem() LeaveCriticalSection(&faxuiSemaphore)
  197. INT_PTR
  198. UserInfoDlgProc(
  199. HWND hDlg,
  200. UINT message,
  201. WPARAM wParam,
  202. LPARAM lParam
  203. );
  204. //
  205. // Global variables and macros
  206. //
  207. extern HANDLE g_hFaxSvcHandle;
  208. extern BOOL g_bUserCanQuerySettings;
  209. extern BOOL g_bUserCanChangeSettings;
  210. extern PFAX_PORT_INFO_EX g_pFaxPortInfo; // port information
  211. extern DWORD g_dwPortsNum; // number of available fax devices
  212. extern BOOL g_bPortInfoChanged; // TRUE if selected port info in g_pFaxPortInfo
  213. // has been changed by device property sheet
  214. #ifndef ARRAYSIZE
  215. #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
  216. #endif
  217. #define RESOURCE_STRING_LEN 256
  218. #define MAX_DEVICE_NAME MAX_PATH
  219. #define MAX_FIELD_LEN 512
  220. #define MAX_ARCHIVE_DIR MAX_PATH - 16
  221. #define CSID_LIMIT 20
  222. #define TSID_LIMIT 20
  223. #define MIN_RING_COUNT 1
  224. #define MAX_RING_COUNT 99
  225. #define DEFAULT_RING_COUNT 2
  226. #define MIN_TIMEOUT 10
  227. #define MAX_TIMEOUT 30
  228. #define DEFAULT_TIMEOUT 10
  229. #define RM_FOLDER 0
  230. #define RM_PRINT 1
  231. #define RM_COUNT 2 // number of routing methods
  232. #define INFO_SIZE (MAX_PATH * sizeof(TCHAR) + sizeof(DWORD))
  233. static const LPCTSTR RoutingGuids[RM_COUNT] = {
  234. REGVAL_RM_FOLDER_GUID, // RM_FOLDER
  235. REGVAL_RM_PRINTING_GUID // RM_PRINT
  236. };
  237. typedef struct _COLUMN_HEADER {
  238. UINT uResourceId; // header string resource id
  239. INT ColumnWidth; // column width
  240. } COLUMN_HEADER, *PCOLUMN_HEADER;
  241. #define Notify_Change(hDlg) { \
  242. HWND hwndSheet = GetParent( hDlg ); \
  243. PropSheet_Changed( hwndSheet, hDlg ); \
  244. } \
  245. #define Notify_UnChange(hDlg) { \
  246. HWND hwndSheet = GetParent( hDlg ); \
  247. PropSheet_UnChanged( hwndSheet, hDlg ); \
  248. } \
  249. //
  250. // Functions in devinfo.c
  251. //
  252. BOOL
  253. FillInDeviceInfo(
  254. HWND hDlg
  255. );
  256. BOOL
  257. DoInitDeviceList(
  258. HWND hDlg
  259. );
  260. BOOL
  261. ValidateControl(
  262. HWND hDlg,
  263. INT iItem
  264. );
  265. BOOL
  266. ChangePriority(
  267. HWND hDlg,
  268. BOOL bMoveUp
  269. );
  270. BOOL
  271. DoSaveDeviceList(
  272. HWND hDlg // window handle of the device info page
  273. );
  274. void
  275. DisplayDeviceProperty(
  276. HWND hDlg
  277. );
  278. HMENU
  279. CreateContextMenu(
  280. VOID
  281. );
  282. INT_PTR
  283. DeviceInfoDlgProc(
  284. HWND hDlg,
  285. UINT message,
  286. WPARAM wParam,
  287. LPARAM lParam
  288. );
  289. INT_PTR
  290. CALLBACK
  291. ConfigOptionDlgProc(
  292. HWND hDlg,
  293. UINT uMsg,
  294. WPARAM wParam,
  295. LPARAM lParam
  296. );
  297. //
  298. // Functions in archfldr.c
  299. //
  300. INT_PTR
  301. ArchiveInfoDlgProc(
  302. HWND hDlg,
  303. UINT message,
  304. WPARAM wParam,
  305. LPARAM lParam
  306. );
  307. INT_PTR
  308. RemoteInfoDlgProc(
  309. HWND hDlg,
  310. UINT message,
  311. WPARAM wParam,
  312. LPARAM lParam
  313. );
  314. //
  315. // Functions in statopts.c
  316. //
  317. BOOL
  318. ValidateNotification(
  319. HWND hDlg
  320. );
  321. INT_PTR
  322. StatusOptionDlgProc(
  323. HWND hDlg,
  324. UINT message,
  325. WPARAM wParam,
  326. LPARAM lParam
  327. );
  328. //
  329. // Functions in devprop.c
  330. //
  331. int InitReceiveInfo(
  332. HWND hDlg
  333. );
  334. int SaveReceiveInfo(
  335. HWND hDlg
  336. );
  337. BOOL
  338. ValidateSend(
  339. HWND hDlg
  340. );
  341. BOOL
  342. ValidateReceive(
  343. HWND hDlg
  344. );
  345. INT_PTR CALLBACK
  346. DevSendDlgProc(
  347. IN HWND hDlg,
  348. IN UINT message,
  349. IN WPARAM wParam,
  350. IN LPARAM lParam
  351. );
  352. INT_PTR CALLBACK
  353. DevRecvDlgProc(
  354. IN HWND hDlg,
  355. IN UINT message,
  356. IN WPARAM wParam,
  357. IN LPARAM lParam
  358. );
  359. INT_PTR CALLBACK
  360. DevCleanupDlgProc(
  361. IN HWND hDlg,
  362. IN UINT message,
  363. IN WPARAM wParam,
  364. IN LPARAM lParam
  365. );
  366. //
  367. // Functions in util.c
  368. //
  369. VOID
  370. InitializeStringTable(
  371. VOID
  372. );
  373. VOID
  374. DeInitializeStringTable(
  375. VOID
  376. );
  377. LPTSTR
  378. GetString(
  379. DWORD ResourceId
  380. );
  381. BOOL IsLocalPrinter(
  382. LPTSTR pPrinterName
  383. );
  384. VOID
  385. DisConnect(
  386. );
  387. BOOL
  388. Connect(
  389. HWND hDlg,
  390. BOOL bDisplayErrorMessage
  391. );
  392. BOOL
  393. DirectoryExists(
  394. LPTSTR pDirectoryName
  395. );
  396. BOOL
  397. FaxDeviceEnableRoutingMethod(
  398. HANDLE hFaxHandle,
  399. DWORD dwDeviceId,
  400. LPCTSTR pRoutingGuid,
  401. LONG Enabled
  402. );
  403. BOOL
  404. BrowseForDirectory(
  405. HWND hDlg,
  406. INT hResource,
  407. DWORD dwMaxPath,
  408. LPTSTR title
  409. );
  410. LPTSTR
  411. ValidatePath(
  412. LPTSTR szPath
  413. );
  414. PFAX_PORT_INFO_EX
  415. FindPortInfo(
  416. DWORD dwDeviceId
  417. );
  418. void
  419. PageEnable(
  420. HWND hDlg,
  421. BOOL bEnable
  422. );
  423. DWORD
  424. CountUsedFaxDevices();
  425. BOOL
  426. IsDeviceInUse(
  427. DWORD dwDeviceId
  428. );
  429. VOID
  430. NotifyDeviceUsageChanged ();
  431. //
  432. // Functions in security.cpp
  433. //
  434. HPROPSHEETPAGE
  435. CreateFaxSecurityPage();
  436. void
  437. ReleaseFaxSecurity();
  438. void
  439. ReleaseActivationContext();
  440. HANDLE
  441. GetFaxActivationContext();
  442. //
  443. // Explicitly imported functions from shlwapi.dll
  444. //
  445. typedef BOOL
  446. (WINAPI *PPATHISRELATIVEW)(LPCWSTR);
  447. typedef BOOL
  448. (WINAPI *PPATHMAKEPRETTYW)(LPCWSTR);
  449. typedef HRESULT
  450. (WINAPI *PSHAUTOCOMPLETE)(HWND, DWORD);
  451. extern PPATHISRELATIVEW g_pPathIsRelativeW;
  452. extern PPATHMAKEPRETTYW g_pPathMakePrettyW;
  453. extern PSHAUTOCOMPLETE g_pSHAutoComplete;
  454. #ifdef __cplusplus
  455. }
  456. #endif
  457. #endif // !_FAXUI_H_