Windows NT 4.0 source code leak
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.

1414 lines
47 KiB

4 years ago
  1. /* ---File: printman.h ----------------------------------------------------
  2. *
  3. * Description:
  4. * NT/LanMan 2.0 Print Manager Windows Application Header file which
  5. * contains common definitions, constants, typedefs, external
  6. * declarations, function prototypes, etc.
  7. *
  8. * This document contains confidential/proprietary information.
  9. * Copyright (c) 1990-1992 Microsoft Corporation, All Rights Reserved.
  10. *
  11. * Revision History:
  12. * [00] 21-Nov-90 stevecat created
  13. * [01] 03-Jan-91 stevecat Modified to use Windows MDI
  14. * [02] 25-Mar-91 stevecat Modified to use NT WINSPOOL APIs
  15. * [03] 13-Jan-92 stevecat New PrintMan UI
  16. *
  17. * ---------------------------------------------------------------------- */
  18. #define MSCTLS /* Use common controls for status bars and headers */
  19. //==========================================================================
  20. // Include files
  21. //==========================================================================
  22. // C Runtime
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25. #include <string.h>
  26. // Windows
  27. /*
  28. * To help reduce the amount of memory required by the C compiler's
  29. * preprocessor pass, reduce the amount of preprocessor work as much
  30. * as possible. The various NO* #defines for the Windows SDK include
  31. * file (WINDOWS.H) help cut down on memory usage by the preprocessor.
  32. * In addition, the removal of the COMM functions of Windows will
  33. * eliminate some warnings generated by the Microsoft C Compiler at
  34. * warning levels 3 and 4 (due to the bitfield structures in WINDOWS.H).
  35. */
  36. /* Windows 3.0 toolkit */
  37. #define NOATOM /* Atom Manager routines */
  38. #define NOCLIPBOARD /* Clipboard routines */
  39. #define NOCOMM /* to eliminate lint warnings in windows.h */
  40. #define NODEFERWINDOWPOS /* DeferWindowPos routines */
  41. #define NOGDICAPMASKS /* CC_*, LC_*, PC_*, CP_*, TC_*, RC_ */
  42. #define NOKANJI /* Kanji support stuff. */
  43. #define NOMETAFILE /* typedef METAFILEPICT */
  44. #define NOMINMAX /* No min(a,b) or max(a,b) */
  45. #define NOOPENFILE /* OpenFile (), OemToAnsi, AnsiToOem, and OF_* */
  46. #define NOPROFILER /* Profiler interface. */
  47. #define NOSOUND /* Sound driver routines */
  48. #undef OEMRESOURCE /* OEM Resource values */
  49. #undef NOLSTRING /* using lstrlen () */
  50. #include <windows.h>
  51. #include <winuserp.h>
  52. #include <tchar.h>
  53. #include <wchar.h>
  54. #include <sedapi.h>
  55. #include <winspool.h>
  56. // Print Manager specific
  57. #include "pmdef.h"
  58. #include "setupdlg.h"
  59. #include <port1632.h>
  60. #include <commctrl.h>
  61. #include <comctrlp.h> // for TB_SETINDENT message
  62. #ifdef HEAPCHECK
  63. #include "heap.h"
  64. #endif
  65. //==========================================================================
  66. // Debug Macros
  67. //==========================================================================
  68. // NOTE: These macros will print out the Module name, Source file name and
  69. // line number where the RIP occurred.
  70. //
  71. // NOTE: Use of these macros require the string "strProgram" to always be
  72. // defined in global data space. (e.g. TCHAR *strProgram = "PLOTTER";)
  73. //
  74. // NOTE: The RIP() macro requires that a Message parameter be present, but
  75. // RIP("") and RIP(NULL) are valid if no message is required.
  76. //
  77. #if DBG
  78. /* Quick fix:
  79. *
  80. * Ensure DbgPrint and DbgBreakPoint are prototyped,
  81. * so that we're not screwed by STDCALL.
  82. */
  83. VOID
  84. DbgBreakPoint(
  85. VOID
  86. );
  87. VOID DbgMsg( CHAR *MsgFormat, ... );
  88. #define GLOBAL_DEBUG_FLAGS Debug
  89. extern DWORD GLOBAL_DEBUG_FLAGS;
  90. #define DBG_NONE 0x00000000
  91. #define DBG_INFO 0x00000001
  92. #define DBG_WARNING 0x00000002
  93. #define DBG_ERROR 0x00000004
  94. #define DBG_TRACE 0x00000008
  95. #define DBG_THREADS 0x00000010
  96. #define DBG_ALLOC 0x00000020
  97. #define DBG_MUTEX 0x00000040
  98. /* These flags are not used as arguments to the DBGMSG macro.
  99. * You have to set the high word of the global variable to cause it to break.
  100. * It is ignored if used with DBGMSG.
  101. * (Here mainly for explanatory purposes.)
  102. */
  103. #define DBG_BREAK_ON_WARNING ( DBG_WARNING << 16 )
  104. #define DBG_BREAK_ON_ERROR ( DBG_ERROR << 16 )
  105. /* Double braces are needed for this one, e.g.:
  106. *
  107. * DBGMSG( DBG_ERROR, ( "Error code %d", Error ) );
  108. *
  109. * This is because we can't use variable parameter lists in macros.
  110. * The statement gets pre-processed to a semi-colon in non-debug mode.
  111. *
  112. * Set the global variable GLOBAL_DEBUG_FLAGS via the debugger.
  113. * Setting the flag in the low word causes that level to be printed;
  114. * setting the high word causes a break into the debugger.
  115. * E.g. setting it to 0x00040006 will print out all warning and error
  116. * messages, and break on errors.
  117. */
  118. #define DBGMSG( Level, MsgAndArgs ) \
  119. { \
  120. if( ( Level & 0xFFFF ) & GLOBAL_DEBUG_FLAGS ) \
  121. DbgMsg MsgAndArgs; \
  122. if( ( Level << 16 ) & GLOBAL_DEBUG_FLAGS ) \
  123. DbgBreakPoint(); \
  124. }
  125. #else
  126. #define DBGMSG( level, args )
  127. #endif // DBG
  128. //==========================================================================
  129. // Definitions
  130. //==========================================================================
  131. typedef CREATESTRUCT PORTCREATESTRUCT;
  132. typedef WNDCLASS PORTWNDCLASS;
  133. #define NOQUEUEFIELDS 4
  134. #define NOJOBFIELDS 6
  135. //
  136. // Extra fields on Win struct to hold info in MDI window
  137. //
  138. #define GWL_PMDIWIN 0 // Ptr to QUEUE struct for this window
  139. // IDM_ constants for menu IDs
  140. // Note these double as IDs for the corresponding help messages
  141. // Printer Menu
  142. #define IDM_PRINTER 1100
  143. #define IDM_CONNECTTOPRINTER 1101
  144. #define IDM_REMOVECONNECTION 1102 /* This menu item no longer exists, */
  145. /* but the toolbar button does, and */
  146. /* there is help associated with it. */
  147. #define IDM_PROPERTIES 1103
  148. #define IDM_PRINTER_PAUSE 1104
  149. #define IDM_PRINTER_RESUME 1105
  150. #define IDM_FORMS 1106
  151. #define IDM_INSTALLPRINTER 1107
  152. #define IDM_DELETEPRINTER 1108
  153. #define IDM_PURGEPRINTER 1109
  154. #define IDM_SERVERVIEWER 1110
  155. #define IDM_EXIT 1111
  156. #define IDM_RETURN 1112 // used for de-minimizing child window
  157. // Document Menu
  158. #define IDM_DOCUMENT 1200
  159. #define IDM_REMOVEDOC 1201
  160. #define IDM_DOCTAILS 1202
  161. #define IDM_DOCUMENT_PAUSE 1203
  162. #define IDM_DOCUMENT_RESUME 1204
  163. #define IDM_RESTART 1205
  164. // Options Menu
  165. #define IDM_OPTIONS 1300
  166. #define IDM_FONT 1301
  167. #define IDM_REFRESHRATE 1302
  168. #define IDM_TOOLBAR 1303
  169. #define IDM_STATUSBAR 1304
  170. #define IDM_SAVESETTINGS 1305
  171. // Security Menu
  172. #define IDM_SECURITY 1400
  173. #define IDM_PERMISSIONS 1401
  174. #define IDM_AUDITING 1402
  175. #define IDM_OWNER 1403
  176. // Window Menu
  177. #define IDM_WINDOW 1500
  178. #define IDM_CASCADE 1501
  179. #define IDM_TILEHORZ 1502
  180. #define IDM_TILEVERT 1503
  181. #define IDM_ARRANGE 1504
  182. #define IDM_REFRESH 1505
  183. #define IDM_CLOSE 1506
  184. #define IDM_CLOSEALL 1507
  185. // Help Menu
  186. #define IDM_HELP 1600
  187. #define IDM_HELP_CONTENTS 1601
  188. #define IDM_HELP_SEARCH 1602
  189. #define IDM_HELP_HOWTOUSE 1603
  190. #define IDM_ABOUT 1604
  191. // Tab command for accelerator table.
  192. // This causes tab to be translated to a command.
  193. // This ID must not coincide with a menu ID.
  194. #define IDC_TAB 1650
  195. // IDs for extra help messages for popups and menu items that don't have IDs.
  196. #define IDS_HELPFIRSTPOPUP 1700
  197. #define IDS_HELPPRINTER 1700 // These five must be consecutive
  198. #define IDS_HELPDOCUMENT 1701
  199. #define IDS_HELPOPTIONS 1702
  200. #define IDS_HELPSECURITY 1703
  201. #define IDS_HELPWINDOW 1704
  202. #define IDS_HELPHELP 1705
  203. #define IDS_HELP_MDIWINDOW 1706
  204. #define IDS_HELP_MOVINGDOCUMENT 1707
  205. #define IDM_FIRSTCHILD 1000
  206. // Resource file string table section entry ids
  207. #define IDS_PRINTMANAGER 600
  208. #define IDS_MESSAGE_TITLE IDS_PRINTMANAGER
  209. #define IDS_COULDNOTOPENPRINTER 601
  210. #define IDS_CONFIRMDELETE 602
  211. #define IDS_PRINTER 603
  212. #define IDS_DEFAULT 604
  213. #define IDS_DEFAULTLABEL 605
  214. #define IDS_UNTITLED 606
  215. #define IDS_CREATEPRINTER 610
  216. #define IDS_OTHER 611
  217. #define IDS_UNNAMED 612
  218. #define IDS_PRINTERDETAILS 613
  219. #define IDS_SELECTSEPARATORPAGE 614
  220. #define IDS_SEPARATORFILES 615
  221. #define IDS_SEPARATORFILTER 616
  222. #define IDS_ALLFILES 617
  223. #define IDS_ALLFILTER 618
  224. #define IDS_COULDNOTCREATEPRINTER 621
  225. #define IDS_COULDNOTSETPRINTER 622
  226. #define IDS_COULDNOTDELETEPRINTER 623
  227. #define IDS_COULDNOTPAUSEPRINTER 624
  228. #define IDS_COULDNOTRESUMEPRINTING 625
  229. #define IDS_COULDNOTPURGEPRINTER 626
  230. #define IDS_COULDNOTPAUSEDOCUMENT 627
  231. #define IDS_COULDNOTRESUMEDOCUMENT 628
  232. #define IDS_COULDNOTLOADLIBRARY 629
  233. #define IDS_COULDNOTFINDPROCEDURE 630
  234. #define IDS_PRINT 632
  235. #define IDS_ADMINISTER 633
  236. #define IDS_ADMINISTERDOCUMENTS 634
  237. #define IDS_NOACCESS 635
  238. #define IDS_COULDNOTENUMERATEPRINTERS 636
  239. #define IDS_COULDNOTFINDINFFILE 637
  240. #define IDS_DELETEALLPRINTJOBS_S 639
  241. #define IDS_SERVERUNAVAILABLE 641
  242. #define IDS_SERVERUNAVAILABLEONSTART 642
  243. #define IDS_MUSTSUPPLYVALIDNAME 643
  244. #define IDS_COULDNOTADDPORT 644
  245. #define IDS_COULDNOTCONNECTTOPRINTER 645
  246. #define IDS_SERVERVIEWERTITLE 646
  247. #define IDS_COULDNOTOPENSERVERREFRESH 648
  248. #define IDS_COULDNOTGETSERVERINFO 649
  249. #define IDS_COULDNOTSHOWHELP 650
  250. #define IDS_COULDNOTREMOVEDOCUMENT 652
  251. #define IDS_FORMSONTHISCOMPUTER 653
  252. #define IDS_COULDNOTADDFORM 654
  253. #define IDS_COULDNOTDELETEFORM 655
  254. #define IDS_COULDNOTSETFORM 656
  255. #define IDS_INSUFFPRIV_DELETEPRINTER 661
  256. #define IDS_INSUFFPRIV_PAUSEPRINTER 662
  257. #define IDS_INSUFFPRIV_RESUMEPRINTING 663
  258. #define IDS_INSUFFPRIV_PURGEPRINTER 664
  259. #define IDS_INSUFFPRIV_PAUSEDOCUMENT 665
  260. #define IDS_INSUFFPRIV_RESUMEDOCUMENT 666
  261. #define IDS_INSUFFPRIV_DELETEDOCUMENT 667
  262. #define IDS_INSUFFPRIV_ADDPORT 668
  263. #define IDS_INSUFFPRIV_DELETEPORT 669
  264. #define IDS_INSUFFPRIV_SECURITY 670
  265. #define IDS_ERRORRUNNINGSETUP 672
  266. #define IDS_COULDNOTREMOVECONNECTION 673
  267. #define IDS_COULDNOTDELETEPORT 675
  268. #define IDS_CONFIRMDELETEREMOTE 676
  269. #define IDS_CONFIRMDELETECONNECTION 677
  270. #define IDS_INCHES 678
  271. #define IDS_CENTIMETERS 679
  272. #define IDS_BYTES 680
  273. #define IDS_SHARENAMEMAYBETOOLONG 681
  274. #define IDS_COULDNOTUPDATESECURITY 684
  275. #define IDS_PERMISSIONNOLONGERGRANTED 685
  276. #define IDS_FAILUREREOPENINGPRINTER 686
  277. #define IDS_INSUFFPRIV_RESTARTDOCUMENT 687
  278. #define IDS_COULDNOTRESTARTDOCUMENT 688
  279. #define IDS_CANNOTGETSECURITYINFO 689
  280. #define IDS_ACCESSDENIED 690
  281. #define IDS_UNKNOWN_ERROR 691
  282. #define IDS_PERMISSIONS_EDITOR_FAILED 692
  283. #define IDS_AUDIT_DIALOG_FAILED 693
  284. #define IDS_TAKE_OWNERSHIP_FAILED 694
  285. #define IDS_COULDNOTSETDEVMODE 695
  286. // #define IDS_ADD_PORT 696
  287. #define IDS_CANNOT_COPY_DRIVER_FILES 697
  288. #define IDS_ERROR_VALIDATING_ACCESS 698
  289. #define IDS_NO_PRINT_PROCESSORS 699
  290. #define IDS_GETTING_PRINTER_INFO 700
  291. #define IDS_SAVE_SETTINGS 701
  292. #define IDS_AUDIT_PRINT 702
  293. #define IDS_AUDIT_ADMINISTER 703
  294. #define IDS_AUDIT_DELETE 704
  295. #define IDS_CHANGE_PERMISSIONS 705
  296. #define IDS_TAKE_OWNERSHIP 706
  297. #define IDS_INSUFF_PRIV_AUDITING 707
  298. #define IDS_COULD_NOT_VIEW_SERVER 708
  299. #define IDS_INVALID_PRINTER_STATE 709
  300. // 710
  301. #define IDS_OPEN_PRINTER_FAILED 711
  302. #define IDS_INSUFFPRIV_DOCUMENT_SETTINGS 712
  303. #define IDS_COULDNOTSETDOCUMENT 713
  304. #define IDS_COULDNOTSETDOCUMENTTIMES 714
  305. #define IDS_COULD_NOT_REORDER_JOB 715
  306. #define IDS_NO_DRIVERS_INSTALLED 716
  307. #define IDS_NO_DRIVER_ON_SERVER 717
  308. #define IDS_PRINTER_PROPERTIES_FAILED 718
  309. #define IDS_PRINTER_NOT_LOADED 719
  310. //
  311. // For SetupDlg support:
  312. //
  313. #define IDS_PRINTER_TYPE 800
  314. #define IDS_MONITOR_TYPE 801
  315. #define IDS_PRINTER_INSTALL_TITLE 810
  316. #define IDS_MONITOR_INSTALL_TITLE 811
  317. #define IDS_PRINTER_SELECT_TITLE 820
  318. #define IDS_MONITOR_SELECT_TITLE 821
  319. #define IDS_FIRST_HEADER_PRINTER 160 // Job display Column Header titles
  320. #define IDS_FIRST_HEADER_SERVER 170 // Job display Column Header titles
  321. #define STATUS 192 // Status messages
  322. #define IDS_PAUSEDON_S 192
  323. #define IDS_PRINTING_S 193
  324. #define IDS_ERRORPRINTING_S 194
  325. #define IDS_NOJOBSTOPRINT 195
  326. #define IDS_PAGESCOMPLETED_D 196
  327. #define IDS_DOCUMENTSQUEUED_D 197
  328. #define IDS_PAGESCOMPLETED_D 196
  329. #define IDS_DOCUMENTSQUEUED_D 197
  330. #define IDS_PAUSED 213
  331. #define IDS_ERROR 214
  332. #define IDS_PENDING_DELETION 215
  333. #define IDS_READY 216
  334. #define IDS_OFFLINE 220
  335. #define IDS_PAPEROUT 221
  336. #define IDS_DELETING 222
  337. #define IDS_SPOOLING 223
  338. #define IDS_PRINTING 224
  339. #define IDS_NOSTATUS 225
  340. #define IDS_ACCESS_DENIED 226
  341. #define IDS_STATUS_UNKNOWN 227
  342. #define IDS_ERROR_N 228
  343. #define IDS_STATUS_LOADING 229
  344. #define IDS_PRINTED 230
  345. #define IDS_PRINTANDSPOOL 231
  346. #define IDS_PAPER_JAM 232
  347. #define IDS_MANUAL_FEED 233
  348. #define IDS_IO_ACTIVE 234
  349. #define IDS_BUSY 235
  350. #define IDS_OUTPUT_BIN_FULL 236
  351. #define IDS_NOT_AVAILABLE 237
  352. #define IDS_WAITING 238
  353. #define IDS_PROCESSING 239
  354. #define IDS_INITIALIZING 240
  355. #define IDS_WARMING_UP 241
  356. #define IDS_TONER_LOW 242
  357. #define IDS_NO_TONER 243
  358. #define IDS_PAGE_PUNT 244
  359. #define IDS_USER_INTERVENTION 245
  360. #define IDS_OUT_OF_MEMORY 246
  361. #define IDS_DOOR_OPEN 247
  362. #define IDS_PAPER_PROBLEM 248
  363. /* Child window control IDs
  364. */
  365. // Button IDs
  366. #define IDB_PAUSERESUME 1
  367. #define IDB_DELETE 2
  368. // Other IDs
  369. #define ID_OBJLIST 7 // List box in MDI windows
  370. #ifdef MSCTLS
  371. #define ID_STATUSBAR 8 // Frame window status bar
  372. #define ID_HEADER 9 // MDI movable headers
  373. #define ID_TOOLBAR 10 // Toolbar ID
  374. #endif /* MSCTLS */
  375. /* Icons:
  376. */
  377. #define IDI_PRINTMAN 1
  378. #define IDI_SERVER 2
  379. #define IDI_CONNECT 3
  380. #define IDI_SHARED 4
  381. #define IDC_REORDER 5
  382. // Toolbar combo-box constants
  383. #define IDTB_CB_PRINTERS 5 // Toolbar Combobox control ID
  384. #define MAX_PRINTER_NAME_LEN 32 // Toolbar combobox max string length
  385. #define MAX_PRINTER_DESC_LEN 64
  386. #define MAX_SHARE_NAME_LEN 12
  387. #define K 1024 // Kilobyte
  388. #define TBZ 256 // Text output buffer size
  389. #define NBZ 10*K // Network API buffer size
  390. /* These values are used in the LocalAlloc() call in InitInstance() routine
  391. * to get queue names and nicknames from .INI file.
  392. */
  393. #define KEYBZ 1*K // Keyname Buffer size
  394. #define VALBZ 256 // Value Buffer size (on stack)
  395. #define NOSELECTION (DWORD)(-1) // No Print Job selected index value
  396. #define DYTOOLBAR 27
  397. //
  398. // Toolbar ICON bitmap stuff
  399. #define BITMAPS 100
  400. #define TOOLBAR 101
  401. #define FILES_WIDTH 16
  402. #define FILES_HEIGHT 16
  403. /* Indexes of bitmaps for Server and Printer viewer status */
  404. #define BM_IND_STATUS_XBASE 0
  405. #define BM_IND_STATUS_YBASE 0
  406. #define BM_IND_PRINTER_READY 0
  407. #define BM_IND_PRINTER_PAUSED 1
  408. #define BM_IND_PRINTER_ERROR 2
  409. #define BM_IND_DOCUMENT_PRINTING 3
  410. #define BM_IND_DOCUMENT_PAUSED 4
  411. #define BM_IND_DOCUMENT_ERROR 5
  412. #define MSG_ERROR MB_OK | MB_ICONSTOP
  413. #define MSG_WARNING MB_OK | MB_ICONEXCLAMATION
  414. #define MSG_INFORMATION MB_OK | MB_ICONINFORMATION
  415. #define MSG_YESNO MB_YESNO | MB_ICONQUESTION
  416. #define MSG_CONFIRMATION MB_OKCANCEL | MB_ICONEXCLAMATION
  417. #define MDIWIN_PRINTER 0
  418. #define MDIWIN_LOCALPRINTER 0
  419. #define MDIWIN_SERVER 1
  420. #define MDIWIN_NETWORKPRINTER 2
  421. #define MDIWIN_LOCALNETWORKPRINTER 3 /* Local printer which looks like a network printer */
  422. /* Datatypes used in printer and server lists:
  423. */
  424. #define MDIDATA_DWORD 0
  425. #define MDIDATA_DWORD_BLANK_IF_ZERO 1
  426. #define MDIDATA_PSZ 2
  427. #define MDIDATA_PSZ_UNTITLED_IF_NULL 3
  428. #define MDIDATA_TIME 4
  429. #define MDIDATA_SIZE 5
  430. #define MDIDATA_PRINTER_STATUS 6
  431. #define MDIDATA_JOB_STATUS 7
  432. #define MDIDATA_ICON 8
  433. /* Indices of column headings for the job list for each printer:
  434. */
  435. #define MDIHEAD_JOB_STATUS 0
  436. #define MDIHEAD_JOB_DOCNAME 1
  437. #define MDIHEAD_JOB_OWNER 2
  438. #define MDIHEAD_JOB_PRINTEDAT 3
  439. #define MDIHEAD_JOB_PAGES 4
  440. #define MDIHEAD_JOB_SIZE 5
  441. #define MDIHEAD_JOB_PRIORITY 6
  442. #define MDIHEAD_JOB_COUNT 7
  443. /* Indices of column headings for the printer list for each server:
  444. */
  445. #define MDIHEAD_PRINTER_PRINTER 0
  446. #define MDIHEAD_PRINTER_STATUS 1
  447. #define MDIHEAD_PRINTER_JOBS 2
  448. #define MDIHEAD_PRINTER_PORT 3
  449. #define MDIHEAD_PRINTER_TYPE 4
  450. #define MDIHEAD_PRINTER_COUNT 5
  451. /* This should not clash with any of the PRINTER_STATUS_* values in winspool.h:
  452. */
  453. #define PRINTER_STATUS_UNKNOWN 0x80000000
  454. #define PRINTER_STATUS_ACCESS_DENIED 0x40000000
  455. #define PRINTER_STATUS_LOADING 0x20000000
  456. /* The next value is the largest number of headers in any MDI window:
  457. */
  458. #define MAX_HEADERS MDIHEAD_JOB_COUNT
  459. /* Space for 16x16 status bitmaps:
  460. */
  461. #define STATUS_BITMAP_WIDTH 16
  462. #define STATUS_BITMAP_HEIGHT 16
  463. #define STATUS_BITMAP_MARGIN 4 /* (either side) */
  464. #define STATUS_BITMAP_SPACE ( STATUS_BITMAP_WIDTH + ( 2 * STATUS_BITMAP_MARGIN ) )
  465. /* These are the push-button bitmap widths:
  466. */
  467. #define DXBUTTON 24
  468. #define DYBUTTON 22
  469. // #ifdef JAPAN
  470. #define RESOURCE_STRING_LENGTH 160
  471. // #else
  472. // #define RESOURCE_STRING_LENGTH 80
  473. // endif
  474. #define TIME_STRING_LENGTH 20
  475. #define ENTRYFIELD_LENGTH 256
  476. #define REPAINT_NONE 0
  477. #define REPAINT_IF_CHANGED 1
  478. #define REPAINT_FORCE 2
  479. /* International time stuff:
  480. */
  481. #define TIMESEP_LENGTH 2
  482. #define AM 0
  483. #define PM 1
  484. #define AMPM_LENGTH 9
  485. /* For OpenPrinterForSpecifiedAccess
  486. * (this must not clash with PRINTER_ACCESS_ADMINISTER,
  487. * PRINTER_ACCESS_USE or READ_CONTROL):
  488. */
  489. #define PRINTER_ACCESS_HIGHEST_PERMITTED 0x41ACCE55
  490. #define PRINTER_ACCESS_DENIED 0x00000000
  491. /* Print Manager private messages:
  492. */
  493. #define WM_STATUS_CHANGED WM_USER
  494. #define WM_UPDATE_STATUS WM_USER+1
  495. #define WM_UPDATE_LIST WM_USER+2
  496. #define WM_UPDATE_DEFAULT WM_USER+3
  497. #define WM_PRINTER_ADDED WM_USER+4
  498. #define WM_REFRESH_ERROR WM_USER+5
  499. #define WM_THREAD_ERROR WM_USER+6
  500. #define WM_DELETE_PRINTER WM_USER+7
  501. /* Define some constants to make parameters to CreateEvent a tad less obscure:
  502. */
  503. #define EVENT_RESET_MANUAL TRUE
  504. #define EVENT_RESET_AUTOMATIC FALSE
  505. #define EVENT_INITIAL_STATE_SIGNALED TRUE
  506. #define EVENT_INITIAL_STATE_NOT_SIGNALED FALSE
  507. #define CREATE_PRINTER_SHARED 0x00000001
  508. #define CREATE_PRINTER_ICONIC 0x00000002
  509. #define ALL_FLAGS_ARE_SET( Flags, Mask ) ( ( (Flags) & (Mask) ) == (Mask) )
  510. //==========================================================================
  511. // Macros
  512. //==========================================================================
  513. #define WPARAM_ID(wParam) LOWORD(wParam)
  514. #define ZERO_OUT( pStructure ) memset( (pStructure), 0, sizeof( *(pStructure) ) )
  515. #define GETPRINTMAN_DATA( hwnd ) \
  516. (PPRINTMAN_DATA)GetWindowLong( hwnd, GWL_USERDATA )
  517. #define SETDLGITEMFONT(hwnd, id, hfont) \
  518. SendDlgItemMessage(hwnd, id, WM_SETFONT, (WPARAM)hfont, 0L)
  519. #define ADDCOMBOSTRING(hwnd, id, string) \
  520. SendDlgItemMessage(hwnd, id, CB_ADDSTRING, 0, (LONG)string)
  521. #define INSERTCOMBOSTRING(hwnd, id, i, string) \
  522. SendDlgItemMessage(hwnd, id, CB_INSERTSTRING, (WPARAM)i, (LONG)string)
  523. #define SETCOMBOSELECT(hwnd, id, i) \
  524. SendDlgItemMessage(hwnd, id, CB_SETCURSEL, (WPARAM)i, 0L)
  525. #define GETCOMBOSELECT(hwnd, id) \
  526. SendDlgItemMessage(hwnd, id, CB_GETCURSEL, 0, 0L)
  527. #define GETCOMBOTEXT(hwnd, id, i, string) \
  528. SendDlgItemMessage(hwnd, id, CB_GETLBTEXT, (WPARAM)i, (LONG)string)
  529. #define GETCOMBOSELECTTEXT(hwnd, id, string) \
  530. GETCOMBOTEXT(hwnd, id, GETCOMBOSELECT(hwnd, id), string)
  531. #define FINDCOMBOSTRING(hwnd, id, string) \
  532. SendDlgItemMessage(hwnd, id, CB_FINDSTRING, -1, (LONG)string)
  533. #define RESETLIST(hwnd, id) \
  534. SendDlgItemMessage(hwnd, id, LB_RESETCONTENT, 0, 0L);
  535. #define SETLISTSELECT(hwnd, id, i) \
  536. SendDlgItemMessage(hwnd, id, LB_SETCURSEL, (WPARAM)i, 0L)
  537. #define GETLISTSELECT(hwnd, id) \
  538. SendDlgItemMessage(hwnd, id, LB_GETCURSEL, 0, 0L )
  539. #define GETLISTTEXT(hwnd, id, i, string) \
  540. SendDlgItemMessage(hwnd, id, LB_GETTEXT, (WPARAM)i, (LONG)string)
  541. #define GETLISTSELECTTEXT(hwnd, id, string) \
  542. GETLISTTEXT(hwnd, id, GETLISTSELECT(hwnd, id), string)
  543. #define IS_BUTTON_ENABLED(idCommand) (BOOL)LOWORD(SendMessage( hwndToolbar, \
  544. TB_ISBUTTONENABLED, \
  545. idCommand,\
  546. 0L ))
  547. #define SEND_THREAD_MESSAGE( hWnd, msg, wparam, lparam ) \
  548. WaitForSingleObject( ThreadMessageRead, INFINITE ), \
  549. ThreadMessage.hwnd = (hWnd), \
  550. ThreadMessage.message = (msg), \
  551. ThreadMessage.wParam = (WPARAM)(wparam), \
  552. ThreadMessage.lParam = (LPARAM)(lparam), \
  553. SetEvent( ThreadMessageWritten )
  554. #define DISPATCH_THREAD_MESSAGE( pMsg ) \
  555. PostMessage( (pMsg)->hwnd, (pMsg)->message, (pMsg)->wParam, (pMsg)->lParam ), \
  556. SetEvent( ThreadMessageRead )
  557. /* ENUM_* macros designed so that spooler Enum* calls can be made
  558. * without worrying about reallocating buffers when required.
  559. * They call EnumGeneric, which does the appropriate reallocation,
  560. * making it completely transparent to the caller,
  561. * as they take exactly the same parameters as the corresponding
  562. * spooler API.
  563. * Any buffer passed in must have been allocated via AllocSplMem.
  564. */
  565. #define ENUM_PRINTERS( Flags, Name, Level, pPrinterEnum, cbBuf, pcbNeeded, pcReturned ) \
  566. EnumGeneric( (PROC)EnumPrinters, \
  567. (Level), \
  568. (LPBYTE *)&(pPrinterEnum), \
  569. (cbBuf), \
  570. (pcbNeeded), \
  571. (pcReturned), \
  572. (PVOID)(Flags), \
  573. (Name), \
  574. NULL )
  575. #define ENUM_JOBS( hPrinter, FirstJob, NoJobs, Level, pJob, cbBuf, pcbNeeded, pcReturned ) \
  576. EnumGeneric( (PROC)EnumJobs, \
  577. (Level), \
  578. (LPBYTE *)&(pJob), \
  579. (cbBuf), \
  580. (pcbNeeded), \
  581. (pcReturned), \
  582. (PVOID)(hPrinter), \
  583. (PVOID)(FirstJob), \
  584. (PVOID)(NoJobs) )
  585. #define ENUM_PORTS( pName, Level, pPorts, cbBuf, pcbNeeded, pcReturned ) \
  586. EnumGeneric( (PROC)EnumPorts, \
  587. (Level), \
  588. (PBYTE *)&(pPorts), \
  589. (cbBuf), \
  590. (pcbNeeded), \
  591. (pcReturned), \
  592. (pName), \
  593. NULL, \
  594. NULL )
  595. //==========================================================================
  596. // Typedefs and Structure Definitions
  597. //==========================================================================
  598. //**************************************************************************
  599. //
  600. // QUEUE is a linked-list structure containing printer information
  601. //
  602. //**************************************************************************
  603. // NOTE:
  604. //
  605. /* SETUP_DATA
  606. *
  607. * This is allocated in Printer Properties dialog
  608. * for installable printer drivers read in from the PRINTER.INI file.
  609. */
  610. typedef struct _SETUP_DATA
  611. {
  612. PTCHAR pOption;
  613. // PTCHAR pOptionText;
  614. }
  615. SETUP_DATA, *PSETUP_DATA;
  616. typedef struct _PRINTMAN_DATA
  617. {
  618. PVOID Unused;
  619. }
  620. PRINTMAN_DATA, *PPRINTMAN_DATA;
  621. typedef struct _COLUMN
  622. {
  623. INT Width;
  624. PTCHAR Text;
  625. INT Datatype; // Type of data displayed in this column
  626. INT Offset; // Offset of the data from pData in MDIWIN_INFO
  627. }
  628. COLUMN, *PCOLUMN;
  629. typedef int (WINAPI *REFRESHPROC)(); // new 32-bit version
  630. typedef VOID (WINAPI *INITTHREADPROC)();
  631. typedef BOOL (WINAPI *CHECKQUITPROC)();
  632. typedef struct _MDIWIN_INFO
  633. {
  634. /* 00 */ DWORD WindowType; //
  635. /* 04 */ HWND hwndList; // Queue/Job list box Window
  636. /* 08 */ HWND hwndHeader;
  637. /* 0c */ DWORD TopIndex;
  638. /* 10 */ DWORD cNumLines; // Number of lines in client area
  639. /* 14 */ PBYTE *ppData; // Generic data pointer
  640. /* 18 */ int DataSize; // E.g. sizeof JOB_INFO_2
  641. /* 1c */ PDWORD pcObjects; // E.g. how many printers or jobs
  642. /* 20 */ int cColumns; // Number of headings
  643. /* 24 */ PCOLUMN pColumns; // Heading positions
  644. /* 28 */ int IconStatus; // Offset into *ppData for status icon
  645. /* 2c */ DWORD ObjSelected;
  646. /* 30 */ PDWORD pSelObjId;
  647. /* 34 */ DWORD DragPosition; // Used for reordering print jobs in Printer
  648. /* 38 */ DWORD PrevSelection; // For toggling selection with space bar
  649. /* 3c */ PBYTE *ppSelData; // Generic data pointer
  650. /* 40 */ DWORD IdOffset;
  651. /* 44 */ PDWORD pFirstEnumObj;
  652. /* 48 */ PDWORD pcEnumObjs;
  653. /* 4c */ REFRESHPROC pfnRefresh; // Call this when we get a refresh request
  654. /* 50 */ CHECKQUITPROC pfnCheckQuit;
  655. /* 54 */ INITTHREADPROC pfnInitThread; // Called at beginning of worker thread, can be NULL
  656. /* 58 */ HANDLE RefreshSignal; // Event is signaled if refresh allowed
  657. /* 5c */ HICON hicon;
  658. /* 60 */ PVOID pContext; // pQueue etc.
  659. /* 64 */ HWND hwnd;
  660. /* 68 */ BOOL Alive;
  661. /* 6c */ PHANDLE phWaitObject; // hPrinter or hServer
  662. /* 70 */ DWORD ThreadId;
  663. /* 74 */ DWORD WaitFlags; // Changes to wait for
  664. /* 78 */ DWORD Changes; // Changes that happened
  665. /* 7c */ HANDLE DataMutex;
  666. /* 80 */ DWORD Status;
  667. #ifdef SEP_WAITHANDLE
  668. PHANDLE phMain;
  669. #endif
  670. #if DBG
  671. /* 84 */ DWORD DataMutexOwner;
  672. /* 88 */ DWORD DataMutexCount;
  673. #endif /* DBG */
  674. } MDIWIN_INFO, *PMDIWIN_INFO;
  675. typedef struct _QUEUE { // que
  676. /* 00 */ DWORD AccessGranted; // Administer, User or READ_CONTROL
  677. /* 04 */ LPTSTR pServerName;
  678. /* 08 */ LPTSTR pPrinterName;
  679. /* 0c */ HANDLE hPrinter;
  680. /* 10 */ DWORD cbPrinterBuf; // Size of LPPRINTER struct buffer
  681. /* 14 */ LPPRINTER_INFO_2 pPrinter; // Spooler PRINTER structure pointer
  682. /* 18 */ DWORD cbJobsBuf; // Size of LPJOB buffer
  683. /* 1c */ LPJOB_INFO_2 pJobs; // Print Job array pointer
  684. /* 20 */ DWORD cJobs; // Actual Count of Jobs in pJobs buffer
  685. /* 24 */ DWORD SelJobId; // Job Id of selected print job
  686. /* 28 */ DWORD cbSelJob;
  687. /* 2c */ LPJOB_INFO_2 pSelJob;
  688. /* 30 */ DWORD FirstEnumJob;
  689. /* 34 */ DWORD cEnumJobs;
  690. /* 38 */ DWORD Error;
  691. /* 3c */ PMDIWIN_INFO pMDIWinInfo;
  692. #ifdef SEP_WAITHANDLE
  693. HANDLE hPrinterWait;
  694. #endif
  695. #if 0
  696. /* 40 */ HANDLE WaitForInit; // Event signaled or NULL if initialization complete
  697. #endif
  698. } QUEUE;
  699. typedef struct _SERVER_CONTEXT
  700. {
  701. /* 00 */ DWORD AccessGranted; // Administer, User or READ_CONTROL
  702. /* 04 */ LPTSTR pServerName;
  703. /* 08 */ HANDLE hServer;
  704. /* 0c */ LPPRINTER_INFO_2 pPrinters;
  705. /* 10 */ DWORD cPrinters;
  706. /* 14 */ DWORD cbPrinters;
  707. /* 18 */ DWORD SelPrinterId;
  708. /* 1c */ LPPRINTER_INFO_2 pSelPrinter;
  709. /* 20 */ DWORD FirstEnumPrinter;
  710. /* 24 */ DWORD cEnumPrinters;
  711. /* 28 */ DWORD Error;
  712. /* 2c */ PMDIWIN_INFO pMDIWinInfo;
  713. HANDLE hServerWait;
  714. }
  715. SERVER_CONTEXT, *PSERVER_CONTEXT;
  716. /*
  717. Each member of a PRT_PROP_DRIVER array points to the translatable name
  718. of a printer driver. If it is already installed the Installed flag
  719. is TRUE, and Index is an index into an array of DRIVER_INFO_1 structures.
  720. If it is not installed, Installed is FALSE, and Index specifies a
  721. SETUP_DATA element in the linked list.
  722. The idea behind this is that it is now possible to sort the driver names
  723. alphabetically on pName regardless of whether the driver is installed,
  724. thus making the distinction more or less transparent to the user.
  725. The only difference is that the SETUP utility will be invoked
  726. if the user selects a non-installed driver then presses OK in the
  727. Printer Properties or Create Printer dialog.
  728. +-----------------+ +-----------------+
  729. | PRT_PROP_DRIVER | | PRT_PROP_DRIVER |
  730. +-+-----------+---+ +-+-----------+---+
  731. +--| pName +--| pName
  732. | +-----------+ | +-----------+
  733. | | Installed | TRUE | | Installed | FALSE
  734. | +-----------+ | +-----------+
  735. | | Index | M | | Index | N
  736. | +-----------+ | +-----------+
  737. | |
  738. | |
  739. | Mth element in | Nth element in Buffer of strings
  740. | array returned by | linked list returned by
  741. | EnumPrinterDrivers: | of options and text: GetOptionList:
  742. | +---------------+ | +------------+ +--------------------+
  743. | | DRIVER_INFO_1 | | | SETUP_DATA | | "Printer N-1" |
  744. | +-+-------+-----+ | +-+----------+--+ +--------------------+
  745. | +--| pName | | | pOption |---->| "My Laser Printer" |
  746. | | +-------+ | +-------------+ +--------------------+
  747. | | | +--| pOptionText | | "Printer N+1" |
  748. | | | | +-------------+ +--------------------+
  749. | | | | | pNext | | "Printer N+2" |
  750. | | | | +-------------+ +--------------------+
  751. | | | |
  752. | | | |
  753. | | | |
  754. +-+-> "IQ Spottyjet Printer" +-+-> "Mein Laser-Drucker"
  755. (translatable)
  756. */
  757. typedef struct _PRT_PROP_DRIVER
  758. {
  759. PTCHAR pName;
  760. BOOL Installed;
  761. DWORD Index; /* of LPPRINTER_INFO_2 if Installed, */
  762. } /* otherwise PSETUP_DATA */
  763. PRT_PROP_DRIVERS, *PPRT_PROP_DRIVER;
  764. typedef struct _PRT_PROP_DLG_DATA
  765. {
  766. DWORD AccessGranted;
  767. LPPRINTER_INFO_2 pPrinter;
  768. LPPRINTER_INFO_2 pNewPrinter;
  769. LPTSTR pPrinterName;
  770. LPTSTR pServerName;
  771. PMDIWIN_INFO pMDIWinInfo;
  772. HANDLE hPrinter;
  773. BOOL DriverChanged;
  774. LPPRINTPROCESSOR_INFO_1 pPrintProcessors;
  775. DWORD cbPrintProcessors;
  776. DWORD cPrintProcessors;
  777. DWORD PrintProcessorSelected;
  778. LPDATATYPES_INFO_1 pDatatypes;
  779. DWORD cbDatatypes;
  780. DWORD cDatatypes;
  781. DWORD DatatypeSelected;
  782. BOOL DetailsUpdated;
  783. BOOL PortChanged;
  784. DWORD DriverSelected;
  785. DWORD PortSelected;
  786. LPTSTR pAdditionalPorts;
  787. BOOL PrinterShared;
  788. DWORD ServerAccessGranted;
  789. HANDLE hPrtPropDlgWnd;
  790. INFPARMS InfParms;
  791. } PRT_PROP_DLG_DATA, *PPRT_PROP_DLG_DATA;
  792. typedef struct _FORMS_DLG_DATA
  793. {
  794. DWORD AccessGranted;
  795. LPTSTR pServerName;
  796. HANDLE hPrinter;
  797. PFORM_INFO_1 pFormInfo;
  798. DWORD cForms;
  799. BOOL Units; /* TRUE == metric */
  800. } FORMS_DLG_DATA, *PFORMS_DLG_DATA;
  801. typedef struct _SEL_MON_DLG_DATA
  802. {
  803. INFPARMS InfParms;
  804. } SEL_MON_DLG_DATA, *PSEL_MON_DLG_DATA;
  805. /* registry.c */
  806. /* REGISTRY_ENTRY
  807. *
  808. * Passed to WriteRegistryData and ReadRegistryData.
  809. * It contains information about the data to be written to
  810. * or read from the registry contained in the buffer pointed at
  811. * by the pData parameter.
  812. */
  813. typedef struct _REGISTRY_ENTRY
  814. {
  815. DWORD Type; /* Type of data (passed to RegSetValueEx) */
  816. DWORD Size; /* Size of data (passed to RegSetValueEx) */
  817. }
  818. REGISTRY_ENTRY, *PREGISTRY_ENTRY;
  819. typedef HANDLE HQUEUE;
  820. typedef QUEUE * PQUEUE;
  821. typedef QUEUE FAR * LPQUEUE;
  822. //**************************************************************************
  823. //
  824. // SPIN button control structs and definitions
  825. //
  826. //**************************************************************************
  827. #ifndef NOARROWS
  828. typedef struct
  829. {
  830. short lineup; /* lineup/down, pageup/down are relative */
  831. short linedown; /* changes. top/bottom and the thumb */
  832. short pageup; /* elements are absolute locations, with */
  833. short pagedown; /* top & bottom used as limits. */
  834. short top;
  835. short bottom;
  836. short thumbpos;
  837. short thumbtrack;
  838. BOOL wrap; /* allow wraparound? */
  839. BYTE flags; /* flags set on return */
  840. } ARROWVSCROLL;
  841. typedef ARROWVSCROLL FAR *LPARROWVSCROLL;
  842. #define UNKNOWNCOMMAND 1
  843. #define OVERFLOW 2
  844. #define UNDERFLOW 4
  845. #endif
  846. //==========================================================================
  847. // External Data Declarations
  848. //==========================================================================
  849. #if DBG
  850. extern DWORD GLOBAL_DEBUG_FLAGS;
  851. #endif
  852. extern TCHAR szPrintManagerClass[];
  853. extern TCHAR szMenuClass[];
  854. extern TCHAR szLocalPrinterClass[];
  855. extern TCHAR szNetworkPrinterClass[];
  856. extern TCHAR szServerWindowClass[];
  857. extern HANDLE hHeap;
  858. extern HANDLE hInst;
  859. extern HANDLE hRes;
  860. extern HWND hwndClient;
  861. extern HWND hwndToolbar;
  862. extern HWND hwndFrame;
  863. extern HWND hwndPrinterList;
  864. extern UINT idTimer;
  865. extern TCHAR *strProgram;
  866. extern TCHAR szNtLanMan[];
  867. extern CHAR szSedDiscretionaryAclEditor[];
  868. extern TCHAR strUntitled[20];
  869. extern TCHAR strStatusName[128];
  870. extern TCHAR strStatusStatus[128];
  871. extern TCHAR strStatusWaiting[128];
  872. extern TCHAR strStatusHelp[128];
  873. extern int dxDefaultLabel;
  874. extern int dyDefaultLabel;
  875. extern int dyDriveItem;
  876. extern int dyBorder;
  877. extern HBITMAP hbmBitmaps;
  878. extern HBITMAP hbmDefault;
  879. extern HDC hdcMem;
  880. extern DWORD cx;
  881. extern DWORD cy;
  882. extern LPTSTR pCurrentServer;
  883. extern HFONT hfontHelv;
  884. extern HFONT hfontHelvBold;
  885. extern DWORD SysColorHighlight;
  886. extern DWORD SysColorWindow;
  887. extern DWORD SysColorBtnFace;
  888. extern DWORD SysColorBtnText;
  889. extern DWORD SysColorBtnShadow;
  890. extern int iBackground;
  891. extern int iBackgroundSel;
  892. extern int iButtonFace;
  893. extern int iButtonShadow;
  894. extern TCHAR szInternational[];
  895. extern BOOL TwentyFourHourClock;
  896. // #ifdef JAPAN /* v-hirot July.07.1993 for New Prefix */
  897. extern BOOL TimePrefix;
  898. // #endif
  899. extern BOOL bJapan;
  900. extern BOOL MetricMeasurement;
  901. extern TCHAR szTimeSep[TIMESEP_LENGTH];
  902. extern TCHAR szAMPM[2][AMPM_LENGTH];
  903. extern BOOL TimeFormatLeadingZero;
  904. extern TCHAR szDecimalPoint[2];
  905. extern DWORD DecimalDigits;
  906. extern DWORD LeadingZero;
  907. extern HCURSOR hcursorArrow;
  908. extern HCURSOR hcursorSizeWE;
  909. extern HCURSOR hcursorWait;
  910. extern HICON hiconPrinter;
  911. extern HICON hiconServer;
  912. extern HICON hiconConnect;
  913. extern HICON hiconShared;
  914. extern TCHAR szPrintManHlp[];
  915. extern WCHAR szLPrintManHlp[];
  916. extern UINT WM_Help;
  917. extern BOOL bToolBar;
  918. extern DWORD LocalPermission;
  919. extern BOOL NetworkInstalled;
  920. extern PTCHAR szWindows;
  921. extern PTCHAR szDevices;
  922. extern PTCHAR szDevice;
  923. extern BOOL ExpectingNotifyChangeKeyValue;
  924. //==========================================================================
  925. // External Function Declaration and Prototypes
  926. //==========================================================================
  927. /* arrow.c */
  928. short ArrowVScrollProc(short wScroll, short nCurrent, LPARROWVSCROLL lpAVS);
  929. BOOL OddArrowWindow(HWND);
  930. BOOL ValidateEntry( HWND hwnd, WORD CtlId, LPARROWVSCROLL lpAVS );
  931. /*
  932. * Extern functions in dialogs.c
  933. */
  934. // Dialog procedures
  935. BOOL APIENTRY DocDetailsDlg (HWND hWnd, UINT usMsg, WPARAM wParam, LONG lParam);
  936. BOOL APIENTRY PrtPropDlg (HWND hWnd, UINT usMsg, WPARAM wParam, LONG lParam);
  937. BOOL APIENTRY InstallDriverDlg (HWND hWnd, UINT usMsg, WPARAM wParam, LONG lParam);
  938. BOOL APIENTRY SelectDriverDlg(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
  939. BOOL APIENTRY RemovePrinterDlg(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
  940. BOOL APIENTRY SelectMonitorDlg(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
  941. BOOL CALLBACK GreyText( HWND hwnd, LPARAM lParam );
  942. // Other (These should probably be in UTIL.C */
  943. DWORD ConvertChartoTime (LPTSTR string);
  944. void ConvertSystemTimeToChar(SYSTEMTIME *pSystemTime, LPTSTR String);
  945. void ConvertTimetoChar (DWORD Hour, DWORD Minutes, LPTSTR string);
  946. void ConvertMinutestoChar (DWORD Minutes, LPTSTR string);
  947. BOOL CreateNewPrinter( HWND hWnd, PPRT_PROP_DLG_DATA pPrtPropDlgData );
  948. LPTSTR GetString(int id);
  949. LPTSTR GetStringParms(int id, ...);
  950. #ifdef LATER
  951. BOOL APIENTRY ConnectDlg (HWND hWnd, WORD usMsg, WPARAM wParam, LONG lParam);
  952. BOOL APIENTRY DeleteDriverDlg (HWND hWnd, WORD usMsg, WPARAM wParam, LONG lParam);
  953. BOOL APIENTRY SetServerFocusDlg (HWND hWnd, WORD usMsg, WPARAM wParam, LONG lParam);
  954. BOOL APIENTRY PrinterDlg (HWND hWnd, WORD usMsg, WPARAM wParam, LONG lParam);
  955. BOOL APIENTRY MorePrinterDlg (HWND hWnd, WORD usMsg, WPARAM wParam, LONG lParam);
  956. BOOL APIENTRY NewDriverDlg (HWND hWnd, WORD usMsg, WPARAM wParam, LONG lParam);
  957. // Other
  958. void SetPrinterProperties (HWND hWnd, PQUEUE pQueue);
  959. void SetSuggestedFields (HWND hWnd, PQUEUE pQueue);
  960. void SetupJobProperties (HWND hWnd, PQUEUE pQueue);
  961. void SetupPrintProc (HWND hWnd, PQUEUE pQueue);
  962. #endif // LATER
  963. /*
  964. * Extern functions in forms.c
  965. */
  966. BOOL APIENTRY FormsDlg( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam );
  967. /*
  968. * Extern functions in printer.c
  969. */
  970. PQUEUE AllocQueue (LPTSTR pPrinterName);
  971. BOOL CheckError (HWND hWnd, DWORD Error);
  972. DWORD DeleteQJ (HWND hwnd, PQUEUE pQueue);
  973. BOOL DestroyPrinter(PQUEUE pQueue);
  974. VOID DestroyMDIWinInfo( PMDIWIN_INFO pInfo );
  975. void ErrorMsgBox (HWND hwnd, LPTSTR lpszMsg);
  976. BOOL GetJobs( PVOID pContext, PDWORD pFlags );
  977. BOOL FreeQueue (PQUEUE pQueue);
  978. BOOL InitQueueInfo (PQUEUE pQueue, PDWORD pError);
  979. DWORD PauseResumeQJ( HANDLE hPrinter, LPPRINTER_INFO_2 pPrinter,
  980. LPJOB_INFO_2 pJobs, DWORD JobSelected );
  981. BOOL OpenPrinterForSpecifiedAccess(
  982. LPTSTR pName,
  983. LPHANDLE pHandle,
  984. DWORD AccessRequested,
  985. OPTIONAL PDWORD pAccessGranted );
  986. /*
  987. * Extern functions in printman.c
  988. */
  989. // WndProcs
  990. long FrameWndProc (HWND hWnd, UINT message, WPARAM wParam, LONG lParam);
  991. long APIENTRY MDIListWndProc (HWND hWnd, UINT msg, WPARAM wParam, LONG lParam);
  992. long APIENTRY MDIWndProc (HWND hWnd, UINT msg, WPARAM wParam, LONG lParam);
  993. // Other
  994. HWND CreateQueueWindow(
  995. HWND hWnd,
  996. PQUEUE pQueue,
  997. DWORD Status,
  998. DWORD WindowType,
  999. DWORD Flags
  1000. );
  1001. void DisplayInfo( HWND hWnd, HDC hDC, LPRECT pPaintRect, PMDIWIN_INFO pMDIWinInfo);
  1002. void DrawLine (HDC hDC, LPRECT pRect, LPTSTR pStr, BOOL bInv);
  1003. BOOL InitApplication (HANDLE hInstance, LPHANDLE lphAccel);
  1004. BOOL InitQueueChildWindows (HWND hWnd);
  1005. void Refresh (HWND hwnd, PMDIWIN_INFO pInfo, DWORD RepaintOption);
  1006. void SetJobButtonText (PQUEUE pQueue, DWORD Status);
  1007. void SetPrinterButtonText (PQUEUE pQueue, DWORD Status);
  1008. VOID UpdateStatus(HWND hWnd);
  1009. BOOL DisplayStatusIcon( HDC hdc, PRECT prect, int Datatype, PBYTE pData, BOOL Highlight );
  1010. int Message(HWND hwnd, DWORD Type, int CaptionID, int TextID, ...);
  1011. int GetErrorStringID( DWORD ErrorID );
  1012. FARPROC LoadLibraryGetProcAddress(HWND hwnd, LPTSTR LibraryName, LPCSTR ProcName,
  1013. PHANDLE phLibrary);
  1014. LPBYTE GetPrinterInfo( IN DWORD Flags,
  1015. IN LPTSTR Name,
  1016. IN DWORD Level,
  1017. IN LPBYTE pPrinters,
  1018. OUT LPDWORD pcbPrinters,
  1019. OUT LPDWORD pcReturned,
  1020. OPTIONAL OUT LPDWORD pcbNeeded,
  1021. OPTIONAL OUT PDWORD pError );
  1022. int GetJobStatusString( DWORD Status, LPTSTR string );
  1023. VOID
  1024. SetWindowTypeIcon(
  1025. PQUEUE pQueue,
  1026. DWORD WindowType,
  1027. DWORD Flags);
  1028. VOID FrameCommandRefresh(HWND hWnd);
  1029. /*
  1030. * Extern functions in toolbar.c
  1031. */
  1032. HWND PMCreateToolbar( BOOL NetworkAccess );
  1033. void CheckTBButton(DWORD idCommand);
  1034. void EnableCheckTBButtons(HWND hwndActive);
  1035. void GetDefaultLabelExtent(HWND hWnd);
  1036. BOOL LoadBitmaps();
  1037. void LoadDefaultLabel();
  1038. LONG ToolbarWndProc(HWND hWnd, UINT wMsg, DWORD wParam, LONG lParam);
  1039. BOOL AddToPrinterList (HWND hwnd);
  1040. void UpdateDefaultList ();
  1041. VOID ToolbarCommandSelChange(BOOL bCompareDefault);
  1042. /*
  1043. * Extern functions in util.c
  1044. */
  1045. LPVOID AllocSplMem (DWORD cb);
  1046. LPTSTR AllocSplStr (LPTSTR lpStr);
  1047. BOOL FreeSplMem (LPVOID pMem);
  1048. BOOL FreeSplStr (LPTSTR lpStr);
  1049. LPVOID ReallocSplMem (LPVOID lpOldMem, DWORD cbNew);
  1050. BOOL ReallocSplStr (LPTSTR *plpStr, LPTSTR lpStr);
  1051. BOOL EnumGeneric( IN PROC fnEnum,
  1052. IN DWORD Level,
  1053. IN PBYTE *ppEnumData,
  1054. IN DWORD cbBuf,
  1055. OUT LPDWORD pcbReturned,
  1056. OUT LPDWORD pcReturned,
  1057. IN PVOID Arg1,
  1058. IN PVOID Arg2,
  1059. IN PVOID Arg3 );
  1060. BOOL GetGeneric( IN PROC fnGet,
  1061. IN DWORD Level,
  1062. IN PBYTE *ppGetData,
  1063. IN DWORD cbBuf,
  1064. OUT LPDWORD pcbReturned,
  1065. IN PVOID Arg1,
  1066. IN PVOID Arg2 );
  1067. VOID ShowHelp(HWND hWnd, UINT Type, DWORD Data);
  1068. LONG GetCountryCode(VOID);
  1069. LPTSTR
  1070. GetErrorString(
  1071. DWORD Error
  1072. );
  1073. DWORD ReportFailure( HWND hwndParent,
  1074. DWORD idInsufficientPrivilege,
  1075. DWORD idDefaultError );
  1076. LPWSTR GetUnicodeString(int id);
  1077. LPTSTR Make8dot3Name( LPTSTR pName );
  1078. BOOL Is8dot3Name( LPTSTR pName );
  1079. /*
  1080. * Extern functions in registry.c
  1081. */
  1082. DWORD WriteRegistryData( LPTSTR pEntryNode,
  1083. LPTSTR pEntryName,
  1084. LPBYTE pData,
  1085. PREGISTRY_ENTRY pEntry );
  1086. DWORD ReadRegistryData( LPTSTR pEntryNode,
  1087. LPTSTR pEntryName,
  1088. LPBYTE pData,
  1089. PREGISTRY_ENTRY pEntry );
  1090. typedef DWORD (CALLBACK *ENUMREGPROC)( PVOID pContext, PTCHAR pEnumData, PVOID pvParam );
  1091. DWORD EnumRegistryValues( LPTSTR pEntryNode,
  1092. ENUMREGPROC pfnEnum,
  1093. PVOID pContext );
  1094. DWORD DeleteRegistryValues( LPTSTR pNode );
  1095. /*
  1096. * Extern functions in security.c
  1097. */
  1098. BOOL GetMaximumServerAccess( LPTSTR pServerName,
  1099. PDWORD pAccessGranted,
  1100. PHANDLE phServer OPTIONAL );
  1101. void CallDiscretionaryAclEditor( HWND hwnd, PQUEUE pPrinterContext );
  1102. void CallSystemAclEditor(HWND hwnd, PQUEUE pPrinterContext);
  1103. void CallTakeOwnershipDialog(HWND hwnd, PQUEUE pPrinterContext);
  1104. BOOL CheckPrinterAccessForAuditing( LPTSTR pPrinterName, PHANDLE phPrinter );
  1105. /*
  1106. * Extern functions in reconn.c
  1107. */
  1108. DWORD RemoveFromReconnectList(LPTSTR pszRemotePath) ;
  1109. DWORD AddToReconnectList(LPTSTR pszRemotePath) ;
  1110. /*
  1111. * Extern functions in threads.c
  1112. */
  1113. #if DBG
  1114. VOID DbgProtected( DWORD OwningThread );
  1115. VOID DbgNotProtected( DWORD OwningThread );
  1116. #endif /* DBG */
  1117. DWORD
  1118. OpenThreadObject(
  1119. LPWSTR pszName,
  1120. PHANDLE phPrinter,
  1121. PDWORD pdwAccessGranted,
  1122. DWORD WindowType );
  1123. VOID
  1124. ReopenPrinter(
  1125. PVOID pContext,
  1126. DWORD WindowType,
  1127. BOOL bWait);
  1128. VOID
  1129. RefreshThread(
  1130. PMDIWIN_INFO pInfo
  1131. );
  1132. VOID
  1133. LocalServerThread(
  1134. HANDLE hServer
  1135. );
  1136. VOID
  1137. InitQueueThread(
  1138. PVOID pContext
  1139. );
  1140. VOID
  1141. InitServerWindowThread(
  1142. PVOID pContext
  1143. );
  1144. BOOL
  1145. CheckQuitQueue(
  1146. PVOID pContext);
  1147. #if DBG
  1148. VOID EnterProtectedData( PMDIWIN_INFO pInfo );
  1149. VOID LeaveProtectedData( PMDIWIN_INFO pInfo );
  1150. VOID EnterProtectedHandle( PMDIWIN_INFO pInfo );
  1151. VOID LeaveProtectedHandle( PMDIWIN_INFO pInfo );
  1152. #define DBG_IN_PROTECTED_DATA( pInfo ) DbgProtected( pInfo->DataMutexOwner )
  1153. #define DBG_OUT_PROTECTED_DATA( pInfo ) DbgNotProtected( pInfo->DataMutexOwner )
  1154. #define DBG_IN_PROTECTED_HANDLE( pInfo )
  1155. #define DBG_OUT_PROTECTED_HANDLE( pInfo )
  1156. #define ENTER_PROTECTED_DATA( pInfo ) EnterProtectedData( pInfo )
  1157. #define LEAVE_PROTECTED_DATA( pInfo ) LeaveProtectedData( pInfo )
  1158. #define ENTER_PROTECTED_HANDLE( pInfo )
  1159. #define LEAVE_PROTECTED_HANDLE( pInfo )
  1160. #else /* NOT DBG */
  1161. #define DBG_IN_PROTECTED_DATA( pInfo )
  1162. #define DBG_OUT_PROTECTED_DATA( pInfo )
  1163. #define DBG_IN_PROTECTED_HANDLE( pInfo )
  1164. #define DBG_OUT_PROTECTED_HANDLE( pInfo )
  1165. #define ENTER_PROTECTED_DATA( pInfo ) WaitForSingleObject( pInfo->DataMutex, INFINITE )
  1166. #define LEAVE_PROTECTED_DATA( pInfo ) ReleaseMutex( pInfo->DataMutex )
  1167. #define ENTER_PROTECTED_HANDLE( pInfo )
  1168. #define LEAVE_PROTECTED_HANDLE( pInfo )
  1169. #endif /* DBG */
  1170. #define NULLC TEXT('\0')
  1171. #define SPACE TEXT(' ')
  1172. #define BACKSLASH TEXT('\\')
  1173. #define NEWLINE TEXT('\n')
  1174. #define RETURN TEXT('\r')
  1175. #define TAB TEXT('\t')
  1176. #define THOUSANDSEPSWITCH 32768
  1177. #define SPACE_CHAR TEXT(' ')
  1178. #define COMMA_CHAR TEXT(',')
  1179. extern TCHAR ThousandSeparator;
  1180. ULONG FormatFileSize (IN DWORD rgfSwitchs, IN PLARGE_INTEGER FileSize, IN DWORD Width, OUT PTCHAR FormattedSize);