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.

3039 lines
56 KiB

  1. /*++
  2. Copyright (c) 1990 - 1995 Microsoft Corporation
  3. Module Name:
  4. local.h
  5. Abstract:
  6. Header file for Local Print Providor
  7. Author:
  8. Dave Snipp (DaveSn) 15-Mar-1991
  9. Revision History:
  10. 06-Jun-1995 MuhuntS DRIVER_INFO_3, PRINTER_INFO_5 changes
  11. 17-May-1992 ChuckC Added CreateSplUniStr, DeleteSplUniStr.
  12. 27 June 94 MattFe pIniSpooler
  13. 10 July 94 MattFe Spl entry points for Caching
  14. --*/
  15. #include <ntfytab.h>
  16. #include "splcom.h"
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. //
  21. // Defines to make code more readable.
  22. //
  23. #define ONEDAY 60*24
  24. #define BROADCAST TRUE
  25. #define NO_BROADCAST FALSE
  26. #define UPDATE_DS_ONLY 3
  27. #define CHANGEID_ONLY 2
  28. #define UPDATE_CHANGEID 1
  29. #define KEEP_CHANGEID 0
  30. #define OVERWRITE_EXISTING_FILE FALSE
  31. #define FIRST_FILE_TIME_GREATER_THAN_SECOND 1
  32. #define NO_COPY_IF_TARGET_EXISTS TRUE
  33. #define OVERWRITE_IF_TARGET_EXISTS FALSE
  34. #define USE_SCRATCH_DIR TRUE
  35. #define IMPERSONATE_USER TRUE
  36. #define DO_NOT_IMPERSONATE_USER FALSE
  37. #define STRINGS_ARE_EQUAL 0
  38. #define ONE_MINUTE 60*1000
  39. #define TEN_MINUTES 10*ONE_MINUTE
  40. #define TWO_MINUTES 2*ONE_MINUTE
  41. #define SEVEN_MINUTES 7*ONE_MINUTE
  42. #define FIFTEEN_MINUTES 15*ONE_MINUTE
  43. #define HOUR_OF_MINUTES 60
  44. #define ONE_HOUR ONE_MINUTE*HOUR_OF_MINUTES
  45. #define DAY_OF_HOURS 24
  46. #define DAY_OF_MINUTES DAY_OF_HOURS*60
  47. #define DEFAULT_NUMBER_MASTER_AND_BACKUP 3
  48. #define DEFAULT_NUMBER_BROWSE_WORKSTATIONS 2
  49. #define DEFAULT_REFRESH_TIMES_PER_DECAY_PERIOD 2;
  50. #define FIND_ANY_VERSION TRUE
  51. #define FIND_COMPATIBLE_VERSION FALSE
  52. #define DRIVER_UPGRADE 2
  53. #define DRIVER_SEARCH 4
  54. #define NT3X_VERSION TRUE
  55. #define CURRENT_VERSION FALSE
  56. #define MAX_JOB_FAILURES 5
  57. #define MAX_STATIC_ALLOC 2048
  58. // Default timeout values we will return
  59. #define DEFAULT_DNS_TIMEOUT 15000
  60. #define DEFAULT_TX_TIMEOUT 45000
  61. // Pruning definitions
  62. #define PRUNE_DOWNLEVEL_NEVER 0
  63. #define PRUNE_DOWNLEVEL_NICELY 1
  64. #define PRUNE_DOWNLEVEL_AGGRESSIVELY 2
  65. // Default pruning settings
  66. #define DS_PRINTQUEUE_VERSION_WIN2000 4
  67. #define DEFAULT_PRUNE_DOWNLEVEL PRUNE_DOWNLEVEL_NEVER // Never delete downlevel PQ
  68. #define DEFAULT_PRUNING_PRIORITY THREAD_PRIORITY_NORMAL
  69. #define DEFAULT_PRUNING_RETRIES 2
  70. #define DEFAULT_PRUNING_INTERVAL (DAY_OF_MINUTES/(DEFAULT_PRUNING_RETRIES + 1)) // 8 hrs
  71. #define DEFAULT_PRUNING_RETRY_LOG 0
  72. #define MAX_PRUNING_RETRIES 10
  73. // Default printQueue settings
  74. #define IMMORTAL 1
  75. #define DEFAULT_IMMORTAL !IMMORTAL
  76. #define DEFAULT_VERIFY_PUBLISHED_STATE INFINITE // This is the interval
  77. #define DEFAULT_PRINT_PUBLISH_POLICY 1
  78. #define SERVER_THREAD_OFF 0
  79. #define SERVER_THREAD_ON 1
  80. #define SERVER_THREAD_UNCONFIGURED 2
  81. // Default policy values
  82. #define KM_PRINTERS_ARE_BLOCKED 1 // 1 = blocked, 0 = not blocked
  83. #define SERVER_DEFAULT_KM_PRINTERS_ARE_BLOCKED 1
  84. #define WKS_DEFAULT_KM_PRINTERS_ARE_BLOCKED 0
  85. extern DWORD DefaultKMPrintersAreBlocked;
  86. extern DWORD gdwServerInstallTimeOut;
  87. #define INIT_TIME TRUE
  88. #define NON_INIT_TIME FALSE
  89. extern WCHAR *szPrinterData;
  90. extern WCHAR *szConfigurationKey;
  91. extern WCHAR *szDataFileKey;
  92. extern WCHAR *szDriverVersion;
  93. extern WCHAR *szTempDir;
  94. extern WCHAR *szDriversKey;
  95. extern WCHAR *szPrintersKey;
  96. extern WCHAR *szDirectory;
  97. extern WCHAR *szDriverIni;
  98. extern WCHAR *szDriverFile;
  99. extern WCHAR *szDriverFileEntry;
  100. extern WCHAR *szDriverDataFile;
  101. extern WCHAR *szDriverConfigFile;
  102. extern WCHAR *szDriverDir;
  103. extern WCHAR *szPrintProcDir;
  104. extern WCHAR *szPrinterDir;
  105. extern WCHAR *szClusterPrinterDir;
  106. extern WCHAR *szPrinterIni;
  107. extern WCHAR *szAllShadows;
  108. extern WCHAR *szNullPort;
  109. extern WCHAR *szComma;
  110. extern WCHAR *szName;
  111. extern WCHAR *szShare;
  112. extern WCHAR *szPort;
  113. extern WCHAR *szPrintProcessor;
  114. extern WCHAR *szDatatype;
  115. extern WCHAR *szPublishPoint;
  116. extern WCHAR *szCommonName;
  117. extern WCHAR *szObjectGUID;
  118. extern WCHAR *szDsKeyUpdate;
  119. extern WCHAR *szDsKeyUpdateForeground;
  120. extern WCHAR *szAction;
  121. extern WCHAR *szDriver;
  122. extern WCHAR *szLocation;
  123. extern WCHAR *szDescription;
  124. extern WCHAR *szAttributes;
  125. extern WCHAR *szStatus;
  126. extern WCHAR *szPriority;
  127. extern WCHAR *szDefaultPriority;
  128. extern WCHAR *szUntilTime;
  129. extern WCHAR *szStartTime;
  130. extern WCHAR *szParameters;
  131. extern WCHAR *szSepFile;
  132. extern WCHAR *szDevMode;
  133. extern WCHAR *szSecurity;
  134. extern WCHAR *szSpoolDir;
  135. extern WCHAR *szNetMsgDll;
  136. extern WCHAR *szTimeLastChange;
  137. extern WCHAR *szTotalJobs;
  138. extern WCHAR *szTotalBytes;
  139. extern WCHAR *szTotalPages;
  140. extern WCHAR *szHelpFile;
  141. extern WCHAR *szMonitor;
  142. extern WCHAR *szDependentFiles;
  143. extern WCHAR *szPreviousNames;
  144. extern WCHAR *szDNSTimeout;
  145. extern WCHAR *szTXTimeout;
  146. extern WCHAR *szNull;
  147. extern WCHAR *szPendingUpgrades;
  148. extern WCHAR *szMfgName;
  149. extern WCHAR *szOEMUrl;
  150. extern WCHAR *szHardwareID;
  151. extern WCHAR *szProvider;
  152. extern WCHAR *szDriverDate;
  153. extern WCHAR *szLongVersion;
  154. extern WCHAR *szClusDrvTimeStamp;
  155. extern HANDLE hInst;
  156. extern LPWSTR szPrintShare;
  157. extern LPWSTR szPrtProcsShare;
  158. extern HKEY hPrinterRootKey, hPrintersKey;
  159. extern PINISPOOLER pLocalIniSpooler;
  160. extern HANDLE SchedulerSignal;
  161. extern HANDLE PowerManagementSignal;
  162. extern DWORD dwSchedulerThreadPriority;
  163. extern CRITICAL_SECTION SpoolerSection;
  164. #if DBG
  165. extern HANDLE hcsSpoolerSection;
  166. #endif
  167. extern HANDLE WinStaDllHandle;
  168. extern PINIENVIRONMENT pThisEnvironment;
  169. extern WCHAR *szPrintProcKey;
  170. extern WCHAR *szEnvironment;
  171. extern WCHAR *szMajorVersion;
  172. extern WCHAR *szMinorVersion;
  173. extern WCHAR *szRegistryRoot;
  174. extern WCHAR *szEMFThrottle;
  175. extern WCHAR *szFlushShadowFileBuffers;
  176. extern WCHAR *szClusterDriverRoot;
  177. extern WCHAR *szClusterNonAwareMonitors;
  178. extern LPWSTR szRemoteDoc;
  179. extern LPWSTR szLocalDoc;
  180. extern LPWSTR szFastPrintTimeout;
  181. extern WCHAR *szPrintPublishPolicy;
  182. extern LPWSTR szRaw;
  183. extern DWORD dwUpgradeFlag;
  184. #define CHECK_SCHEDULER() SetEvent(SchedulerSignal)
  185. extern DWORD dwFastPrintWaitTimeout;
  186. extern DWORD dwPortThreadPriority;
  187. extern DWORD dwFastPrintThrottleTimeout;
  188. extern DWORD dwFastPrintSlowDownThreshold;
  189. extern DWORD dwWritePrinterSleepTime;
  190. extern DWORD dwServerThreadPriority;
  191. extern DWORD dwEnableBroadcastSpoolerStatus;
  192. extern DWORD ServerThreadTimeout;
  193. extern DWORD ServerThreadRunning;
  194. extern DWORD NetPrinterDecayPeriod;
  195. extern DWORD RefreshTimesPerDecayPeriod;
  196. extern HANDLE ServerThreadSemaphore;
  197. extern BOOL bNetInfoReady;
  198. extern DWORD FirstAddNetPrinterTickCount;
  199. extern DWORD BrowsePrintWorkstations;
  200. extern DWORD dwFlushShadowFileBuffers;
  201. extern DWORD dwMajorVersion;
  202. extern DWORD dwMinorVersion;
  203. extern DWORD dwUniquePrinterSessionID;
  204. extern DWORD PortToPrinterStatusMappings[];
  205. extern WCHAR *szSpooler;
  206. extern LPCTSTR pszLocalOnlyToken;
  207. extern LPCTSTR pszLocalsplOnlyToken;
  208. typedef DWORD NOTIFYVECTOR[NOTIFY_TYPE_MAX];
  209. typedef NOTIFYVECTOR *PNOTIFYVECTOR;
  210. #define ZERONV(dest) \
  211. dest[0] = dest[1] = 0
  212. #define COPYNV(dest, src) \
  213. { dest[0] = src[0]; dest[1] = src[1]; }
  214. #define ADDNV(dest, src) \
  215. { dest[0] |= src[0]; dest[1] |= src[1]; }
  216. #define SIZE_OF_MAP(count) ( (count) / 8 + 1)
  217. #define SETBIT(map, pos) ((map)[(pos) / 8] |= (1 << ((pos) & 7) ))
  218. #define RESETBIT(map, pos) ((map)[(pos) / 8] &= ~(1 << ((pos) & 7) ))
  219. #define GETBIT(map, id) ((map)[id / 8] & ( 1 << ((id) & 7) ) )
  220. extern NOTIFYVECTOR NVPrinterStatus;
  221. extern NOTIFYVECTOR NVPrinterSD;
  222. extern NOTIFYVECTOR NVJobStatus;
  223. extern NOTIFYVECTOR NVJobStatusString;
  224. extern NOTIFYVECTOR NVJobStatusAndString;
  225. extern NOTIFYVECTOR NVPurge;
  226. extern NOTIFYVECTOR NVDeletedJob;
  227. extern NOTIFYVECTOR NVAddJob;
  228. extern NOTIFYVECTOR NVSpoolJob;
  229. extern NOTIFYVECTOR NVWriteJob;
  230. extern NOTIFYVECTOR NVPrinterAll;
  231. extern NOTIFYVECTOR NVJobPrinted;
  232. extern BOOL (*pfnPrinterEvent)();
  233. extern BOOL fW3SvcInstalled; // Says if IIS or "Peer web Server" is installed on the local machine.
  234. extern PWCHAR szW3Root; // The WWWRoot dir, e.g. c:\inetpub\wwwroot
  235. extern OSVERSIONINFO OsVersionInfo;
  236. extern OSVERSIONINFOEX OsVersionInfoEx;
  237. extern WCHAR *gszNT4EMF;
  238. extern WCHAR *gszNT5EMF;
  239. extern WCHAR *ipszRegistryClusRepository;
  240. extern WCHAR *szDriversDirectory;
  241. extern WCHAR *szDriversKey;
  242. extern WCHAR *szWin95Environment;
  243. typedef struct _JOBDATA {
  244. struct _JOBDATA *pNext;
  245. PINIJOB pIniJob;
  246. SIZE_T MemoryUse;
  247. DWORD dwWaitTime;
  248. DWORD dwScheduleTime;
  249. DWORD dwNumberOfTries;
  250. } JOBDATA, *PJOBDATA;
  251. typedef struct _Strings {
  252. DWORD nElements;
  253. PWSTR ppszString[1];
  254. } STRINGS, *PSTRINGS;
  255. typedef struct _INTERNAL_DRV_FILE {
  256. LPWSTR pFileName;
  257. DWORD dwVersion;
  258. HANDLE hFileHandle;
  259. BOOL bUpdated;
  260. } INTERNAL_DRV_FILE, *PINTERNAL_DRV_FILE;
  261. extern DWORD dwNumberOfEMFJobsRendering;
  262. extern BOOL bUseEMFScheduling;
  263. extern SIZE_T TotalMemoryForRendering;
  264. extern SIZE_T AvailMemoryForRendering;
  265. extern DWORD dwLastScheduleTime;
  266. extern PJOBDATA pWaitingList;
  267. extern PJOBDATA pScheduleList;
  268. #define JOB_SCHEDULE_LIST 0x00000001
  269. #define JOB_WAITING_LIST 0x00000002
  270. #define SPL_FIRST_JOB 0x00000001
  271. #define SPL_USE_MEMORY 0x00000002
  272. typedef BOOL (*PFNSPOOLER_MAP)( HANDLE h, PINISPOOLER pIniSpooler );
  273. typedef BOOL (*PFNPRINTER_MAP)( HANDLE h, PINIPRINTER pIniPrinter );
  274. #define DBG_CLUSTER 0x200
  275. VOID
  276. RunForEachSpooler(
  277. HANDLE h,
  278. PFNSPOOLER_MAP pfnMap
  279. );
  280. VOID
  281. RunForEachPrinter(
  282. PINISPOOLER pIniSpooler,
  283. HANDLE h,
  284. PFNPRINTER_MAP pfnMap
  285. );
  286. BOOL
  287. DsUpdateAllDriverKeys(
  288. HANDLE h,
  289. PINISPOOLER pIniSpooler
  290. );
  291. VOID
  292. InitializeLocalspl(
  293. VOID
  294. );
  295. VOID
  296. EnterSplSem(
  297. VOID
  298. );
  299. VOID
  300. LeaveSplSem(
  301. VOID
  302. );
  303. #if DBG
  304. extern HANDLE ghbtClusterRef;
  305. extern PDBG_POINTERS gpDbgPointers;
  306. VOID
  307. SplInSem(
  308. VOID
  309. );
  310. VOID
  311. SplOutSem(
  312. VOID
  313. );
  314. #else
  315. #define SplInSem()
  316. #define SplOutSem()
  317. #endif
  318. PDEVMODE
  319. AllocDevMode(
  320. PDEVMODE pDevMode
  321. );
  322. BOOL
  323. FreeDevMode(
  324. PDEVMODE pDevMode
  325. );
  326. PINIENTRY
  327. FindIniKey(
  328. PINIENTRY pIniEntry,
  329. LPWSTR lpName
  330. );
  331. VOID
  332. RemoveFromJobList(
  333. PINIJOB pIniJob,
  334. DWORD dwJobList
  335. );
  336. BOOL
  337. CheckSepFile(
  338. LPWSTR lpFileName
  339. );
  340. int
  341. DoSeparator(
  342. PSPOOL
  343. );
  344. BOOL
  345. DestroyDirectory(
  346. LPWSTR lpPrinterDir
  347. );
  348. DWORD
  349. GetFullNameFromId(
  350. PINIPRINTER pIniPrinter,
  351. DWORD JobId,
  352. BOOL fJob,
  353. LPWSTR pFileName,
  354. BOOL Remote
  355. );
  356. DWORD
  357. GetPrinterDirectory(
  358. PINIPRINTER pIniPrinter,
  359. BOOL Remote,
  360. LPWSTR pFileName,
  361. DWORD MaxLength,
  362. PINISPOOLER pIniSpooler
  363. );
  364. BOOL
  365. CreateSpoolDirectory(
  366. PINISPOOLER pIniSpooler
  367. );
  368. VOID
  369. CreatePrintProcDirectory(
  370. LPWSTR lpEnvironment,
  371. PINISPOOLER pIniSpooler
  372. );
  373. VOID
  374. ProcessShadowJobs(
  375. PINIPRINTER pIniPrinter,
  376. PINISPOOLER pIniSpooler
  377. );
  378. PINIJOB
  379. ReadShadowJob(
  380. LPWSTR szDir,
  381. PWIN32_FIND_DATA pFindFileData,
  382. PINISPOOLER pIniSpooler
  383. );
  384. BOOL
  385. WriteShadowJob(
  386. IN PINIJOB pIniJob,
  387. IN BOOL bLeaveCS
  388. );
  389. BOOL
  390. BuildAllPrinters(
  391. VOID
  392. );
  393. BOOL
  394. BuildEnvironmentInfo(
  395. PINISPOOLER pIniSpooler
  396. );
  397. BOOL
  398. BuildPrinterInfo(
  399. PINISPOOLER pIniSpooler,
  400. BOOL UpdateChangeID
  401. );
  402. VOID
  403. ReadJobInfo(
  404. PWIN32_FIND_DATA pFindFileData
  405. );
  406. BOOL
  407. BuildAllPorts(
  408. );
  409. BOOL
  410. BuildDriverInfo(
  411. HKEY hEnvironmentKey,
  412. PINIENVIRONMENT pIniEnvironment,
  413. PINISPOOLER pIniSpooler
  414. );
  415. BOOL
  416. BuildTrueDependentFileField(
  417. LPWSTR pDriverPath,
  418. LPWSTR pDataFile,
  419. LPWSTR pConfigFile,
  420. LPWSTR pHelpFile,
  421. LPWSTR pInputDependentFiles,
  422. LPWSTR *ppDependentFiles
  423. );
  424. DWORD
  425. GetDriverVersionDirectory(
  426. LPWSTR pDir,
  427. DWORD MaxLength,
  428. PINISPOOLER pIniSpooler,
  429. PINIENVIRONMENT pIniEnvironment,
  430. PINIVERSION pIniVersion,
  431. PINIDRIVER pIniDriver,
  432. LPWSTR lpRemote
  433. );
  434. PINIVERSION
  435. FindVersionForDriver(
  436. PINIENVIRONMENT pIniEnvironment,
  437. PINIDRIVER pIniDriver
  438. );
  439. BOOL
  440. BuildPrintProcInfo(
  441. HKEY hEnvironmentKey,
  442. PINIENVIRONMENT pIniEnvironment,
  443. PINISPOOLER pIniSpooler
  444. );
  445. BOOL MoveNewDriverRelatedFiles(
  446. LPWSTR pNewDir,
  447. LPWSTR pCurrDir,
  448. LPWSTR pOldDir,
  449. PINTERNAL_DRV_FILE pInternalDriverFiles,
  450. DWORD dwFileCount,
  451. LPBOOL pbDriverFileMoved,
  452. LPBOOL pbConfigFileMoved
  453. );
  454. typedef BOOL (*PFNREBUILD)(LPWSTR, PWIN32_FIND_DATA);
  455. BOOL
  456. Rebuild(
  457. LPWSTR lpDirectory,
  458. PFNREBUILD pfn
  459. );
  460. BOOL
  461. RemoveFromList(
  462. PINIENTRY *ppIniHead,
  463. PINIENTRY pIniEntry
  464. );
  465. PINIDRIVER
  466. GetDriver(
  467. HKEY hVersionKey,
  468. LPWSTR DriverName,
  469. PINISPOOLER pIniSpooler,
  470. PINIENVIRONMENT pIniEnvironment,
  471. PINIVERSION pIniVersion
  472. );
  473. DWORD
  474. GetDriverDirectory(
  475. LPWSTR lpDir,
  476. DWORD MaxLength,
  477. PINIENVIRONMENT lpEnvironment,
  478. LPWSTR lpRemotePath,
  479. PINISPOOLER pIniSpooler
  480. );
  481. DWORD
  482. GetProcessorDirectory(
  483. LPWSTR *lpDir,
  484. LPWSTR lpEnvironment,
  485. PINISPOOLER pIniSpooler
  486. );
  487. LPWSTR
  488. GetFileName(
  489. LPWSTR pPathName
  490. );
  491. BOOL
  492. CopyDriverFile(
  493. LPWSTR lpEnvironment,
  494. LPWSTR lpFileName
  495. );
  496. BOOL
  497. CreateCompleteDirectory(
  498. LPWSTR lpDir
  499. );
  500. BOOL
  501. OpenMonitorPort(
  502. PINIPORT pIniPort,
  503. PINIMONITOR *ppIniLangMonitor,
  504. LPWSTR pszPrinterName,
  505. BOOL bWaitForEvent
  506. );
  507. BOOL
  508. CloseMonitorPort(
  509. PINIPORT pIniPort,
  510. BOOL bWaitForEvent
  511. );
  512. VOID
  513. ShutdownPorts(
  514. PINISPOOLER pIniSpooler
  515. );
  516. BOOL
  517. CreatePortThread(
  518. PINIPORT pIniPort
  519. );
  520. #define WAIT TRUE
  521. #define NOWAIT FALSE
  522. BOOL
  523. DestroyPortThread(
  524. PINIPORT pIniPort,
  525. BOOL bShutdown
  526. );
  527. DWORD
  528. PortThread(
  529. PINIPORT pIniPort
  530. );
  531. BOOL
  532. DeleteJob(
  533. PINIJOB pIniJob,
  534. BOOL bBroadcast
  535. );
  536. VOID
  537. DeleteJobCheck(
  538. PINIJOB pIniJob
  539. );
  540. BOOL
  541. UpdateWinIni(
  542. PINIPRINTER pIniPrinter
  543. );
  544. PKEYDATA
  545. CreateTokenList(
  546. LPWSTR pKeyData
  547. );
  548. PINIPORT
  549. CreatePortEntry(
  550. LPWSTR pPortName,
  551. PINIMONITOR pIniMonitor,
  552. PINISPOOLER pIniSpooler
  553. );
  554. VOID
  555. GetPrinterPorts(
  556. PINIPRINTER pIniPrinter,
  557. LPWSTR pszPorts,
  558. DWORD *pcbNeeded
  559. );
  560. DWORD
  561. SchedulerThread(
  562. PINISPOOLER pIniSpooler
  563. );
  564. BOOL
  565. UpdatePrinterIni(
  566. PINIPRINTER pIniPrinter,
  567. DWORD dwChangeID
  568. );
  569. BOOL
  570. UpdatePrinterNetworkName(
  571. PINIPRINTER pIniPrinter,
  572. LPWSTR pszPorts
  573. );
  574. BOOL
  575. NoConfigCahngeUpdatePrinterIni(
  576. PINIPRINTER pIniPrinter
  577. );
  578. BOOL
  579. SetLocalPrinter(
  580. PINIPRINTER pIniPrinter,
  581. DWORD Level,
  582. PBYTE pPrinterInfo,
  583. PDWORD pdwPrinterVector,
  584. DWORD SecurityInformation
  585. );
  586. BOOL
  587. CopyPrinterDevModeToIniPrinter(
  588. IN OUT PINIPRINTER pIniPrinter,
  589. IN LPDEVMODE pDevMode
  590. );
  591. VOID
  592. MonitorThread(
  593. PINIPORT pIniMonitor
  594. );
  595. BOOL
  596. InitializeForms(
  597. PINISPOOLER pIniSpooler
  598. );
  599. BOOL
  600. InitializeNet(
  601. VOID
  602. );
  603. BOOL
  604. ShareThisPrinter(
  605. PINIPRINTER pIniPrinter,
  606. LPWSTR pShareName,
  607. BOOL Share
  608. );
  609. DWORD
  610. AddPrintShare(
  611. PINISPOOLER pIniSpooler
  612. );
  613. PINIJOB
  614. FindJob(
  615. PINIPRINTER pIniPrinter,
  616. DWORD JobId,
  617. PDWORD pPosition
  618. );
  619. PINIJOB
  620. FindServerJob(
  621. PINISPOOLER pIniSpooler,
  622. DWORD JobId,
  623. PDWORD pPosition,
  624. PINIPRINTER* ppIniPrinter
  625. );
  626. PINIJOB
  627. FindIniJob (
  628. PSPOOL pSpool,
  629. DWORD JobId
  630. );
  631. DWORD
  632. GetJobSessionId (
  633. PSPOOL pSpool,
  634. DWORD JobId
  635. );
  636. BOOL
  637. MyName(
  638. LPWSTR pName,
  639. PINISPOOLER pIniSpooler
  640. );
  641. BOOL
  642. IsValidPrinterName(
  643. IN LPCWSTR pszPrinter,
  644. IN DWORD cchMax
  645. );
  646. BOOL
  647. RefreshMachineNamesCache(
  648. );
  649. BOOL
  650. CheckMyName(
  651. LPWSTR pName,
  652. PINISPOOLER pIniSpooler
  653. );
  654. PINISPOOLER
  655. FindSpoolerByNameIncRef(
  656. LPTSTR pszName,
  657. LPCTSTR *ppszLocalName OPTIONAL
  658. );
  659. VOID
  660. FindSpoolerByNameDecRef(
  661. PINISPOOLER pIniSpooler
  662. );
  663. PINISPOOLER
  664. FindSpoolerByName(
  665. LPTSTR pszName,
  666. LPCTSTR *ppszLocalName OPTIONAL
  667. );
  668. HANDLE
  669. AddNetPrinter(
  670. LPBYTE pPrinterInfo,
  671. PINISPOOLER pIniSpooler
  672. );
  673. BOOL
  674. CreateServerThread(
  675. VOID
  676. );
  677. BOOL
  678. GetSid(
  679. PHANDLE hToken
  680. );
  681. BOOL
  682. SetCurrentSid(
  683. HANDLE phToken
  684. );
  685. BOOL
  686. LocalEnumPrinters(
  687. DWORD Flags,
  688. LPWSTR Name,
  689. DWORD Level,
  690. LPBYTE pPrinterEnum,
  691. DWORD cbBuf,
  692. LPDWORD pcbNeeded,
  693. LPDWORD pcReturned
  694. );
  695. DWORD
  696. LocalOpenPrinter(
  697. LPWSTR pPrinterName,
  698. LPHANDLE phPrinter,
  699. LPPRINTER_DEFAULTS pDefault
  700. );
  701. DWORD
  702. LocalOpenPrinterEx(
  703. LPWSTR pPrinterName,
  704. LPHANDLE phPrinter,
  705. LPPRINTER_DEFAULTS pDefault,
  706. LPBYTE pSplClientInfo,
  707. DWORD dwLevel
  708. );
  709. BOOL
  710. LocalSetJob(
  711. HANDLE hPrinter,
  712. DWORD JobId,
  713. DWORD Level,
  714. LPBYTE pJob,
  715. DWORD Command
  716. );
  717. BOOL
  718. LocalGetJob(
  719. HANDLE hPrinter,
  720. DWORD JobId,
  721. DWORD Level,
  722. LPBYTE pJob,
  723. DWORD cbBuf,
  724. LPDWORD pcbNeeded
  725. );
  726. BOOL
  727. LocalEnumJobs(
  728. HANDLE hPrinter,
  729. DWORD FirstJob,
  730. DWORD NoJobs,
  731. DWORD Level,
  732. LPBYTE pJob,
  733. DWORD cbBuf,
  734. LPDWORD pcbNeeded,
  735. LPDWORD pcReturned
  736. );
  737. HANDLE
  738. LocalAddPrinter(
  739. LPWSTR pName,
  740. DWORD Level,
  741. LPBYTE pPrinter
  742. );
  743. HANDLE
  744. LocalAddPrinterEx(
  745. LPWSTR pName,
  746. DWORD Level,
  747. LPBYTE pPrinter,
  748. LPBYTE pSplClientInfo,
  749. DWORD dwClientInfoLevel
  750. );
  751. BOOL
  752. DeletePrinterForReal(
  753. PINIPRINTER pIniPrinter,
  754. BOOL bIsInitTime
  755. );
  756. BOOL
  757. LocalDeletePrinter(
  758. HANDLE hPrinter
  759. );
  760. BOOL
  761. LocalAddPrinterConnection(
  762. LPWSTR pName
  763. );
  764. BOOL
  765. LocalDeletePrinterConnection(
  766. LPWSTR pName
  767. );
  768. BOOL
  769. LocalAddPrinterDriver(
  770. LPWSTR pName,
  771. DWORD Level,
  772. LPBYTE pDriverInfo
  773. );
  774. BOOL
  775. LocalAddPrinterDriverEx(
  776. LPWSTR pName,
  777. DWORD Level,
  778. LPBYTE pDriverInfo,
  779. DWORD dwFileCopyFlags
  780. );
  781. LocalAddDriverCatalog(
  782. IN HANDLE hPrinter,
  783. IN DWORD dwLevel,
  784. IN VOID *pvDriverInfCatInfo,
  785. IN DWORD dwCatalogCopyFlags
  786. );
  787. BOOL
  788. LocalEnumPrinterDrivers(
  789. LPWSTR pName,
  790. LPWSTR pEnvironment,
  791. DWORD Level,
  792. LPBYTE pDriverInfo,
  793. DWORD cbBuf,
  794. LPDWORD pcbNeeded,
  795. LPDWORD pcReturned
  796. );
  797. BOOL
  798. LocalGetPrinterDriverDirectory(
  799. LPWSTR pName,
  800. LPWSTR pEnvironment,
  801. DWORD Level,
  802. LPBYTE pDriverDirectory,
  803. DWORD cbBuf,
  804. LPDWORD pcbNeeded
  805. );
  806. BOOL
  807. LocalDeletePrinterDriver(
  808. LPWSTR pName,
  809. LPWSTR pEnvironment,
  810. LPWSTR pDriverName
  811. );
  812. BOOL
  813. LocalDeletePrinterDriverEx(
  814. LPWSTR pName,
  815. LPWSTR pEnvironment,
  816. LPWSTR pDriverName,
  817. DWORD dwDeleteFlag,
  818. DWORD dwVersionNum
  819. );
  820. BOOL
  821. LocalAddPerMachineConnection(
  822. LPCWSTR pServer,
  823. LPCWSTR pPrinterName,
  824. LPCWSTR pPrintServer,
  825. LPCWSTR pProvider
  826. );
  827. BOOL
  828. LocalDeletePerMachineConnection(
  829. LPCWSTR pServer,
  830. LPCWSTR pPrinterName
  831. );
  832. BOOL
  833. LocalEnumPerMachineConnections(
  834. LPCWSTR pServer,
  835. LPBYTE pPrinterEnum,
  836. DWORD cbBuf,
  837. LPDWORD pcbNeeded,
  838. LPDWORD pcReturned
  839. );
  840. BOOL
  841. LocalAddPrintProcessor(
  842. LPWSTR pName,
  843. LPWSTR pEnvironment,
  844. LPWSTR pPathName,
  845. LPWSTR pPrintProcessorName
  846. );
  847. BOOL
  848. LocalEnumPrintProcessors(
  849. LPWSTR pName,
  850. LPWSTR pEnvironment,
  851. DWORD Level,
  852. LPBYTE pPrintProcessorInfo,
  853. DWORD cbBuf,
  854. LPDWORD pcbNeeded,
  855. LPDWORD pcReturned
  856. );
  857. BOOL
  858. LocalGetPrintProcessorDirectory(
  859. LPWSTR pName,
  860. LPWSTR pEnvironment,
  861. DWORD Level,
  862. LPBYTE pPrintProcessorInfo,
  863. DWORD cbBuf,
  864. LPDWORD pcbNeeded
  865. );
  866. BOOL
  867. LocalDeletePrintProcessor(
  868. LPWSTR pName,
  869. LPWSTR pEnvironment,
  870. LPWSTR pPrintProcessorName
  871. );
  872. BOOL
  873. LocalEnumPrintProcessorDatatypes(
  874. LPWSTR pName,
  875. LPWSTR pPrintProcessorName,
  876. DWORD Level,
  877. LPBYTE pDatatypes,
  878. DWORD cbBuf,
  879. LPDWORD pcbNeeded,
  880. LPDWORD pcReturned
  881. );
  882. DWORD
  883. LocalStartDocPrinter(
  884. HANDLE hPrinter,
  885. DWORD Level,
  886. LPBYTE pDocInfo
  887. );
  888. BOOL
  889. LocalStartPagePrinter(
  890. HANDLE hPrinter
  891. );
  892. BOOL
  893. LocalGetSpoolFileHandle(
  894. HANDLE hPrinter,
  895. LPWSTR *pSpoolDir,
  896. LPHANDLE phFile,
  897. HANDLE hSpoolerProcess,
  898. HANDLE hAppProcess
  899. );
  900. BOOL
  901. LocalCommitSpoolData(
  902. HANDLE hPrinter,
  903. DWORD cbCommit
  904. );
  905. BOOL
  906. LocalCloseSpoolFileHandle(
  907. HANDLE hPrinter
  908. );
  909. BOOL
  910. LocalFlushPrinter(
  911. HANDLE hPrinter,
  912. LPVOID pBuf,
  913. DWORD cbBuf,
  914. LPDWORD pcWritten,
  915. DWORD cSleep
  916. );
  917. DWORD
  918. LocalSendRecvBidiData(
  919. HANDLE hPrinter,
  920. LPCTSTR pAction,
  921. PBIDI_REQUEST_CONTAINER pReqData,
  922. PBIDI_RESPONSE_CONTAINER* ppResData
  923. );
  924. BOOL
  925. LocalWritePrinter(
  926. HANDLE hPrinter,
  927. LPVOID pBuf,
  928. DWORD cbBuf,
  929. LPDWORD pcWritten
  930. );
  931. BOOL
  932. LocalSeekPrinter(
  933. HANDLE hPrinter,
  934. LARGE_INTEGER liDistanceToMove,
  935. PLARGE_INTEGER pliNewPointer,
  936. DWORD dwMoveMethod,
  937. BOOL bWritePrinter
  938. );
  939. BOOL
  940. LocalEndPagePrinter(
  941. HANDLE hPrinter
  942. );
  943. BOOL
  944. LocalAbortPrinter(
  945. HANDLE hPrinter
  946. );
  947. BOOL
  948. LocalReadPrinter(
  949. HANDLE hPrinter,
  950. LPVOID pBuf,
  951. DWORD cbBuf,
  952. LPDWORD pNoBytesRead
  953. );
  954. BOOL
  955. SplReadPrinter(
  956. HANDLE hPrinter,
  957. LPBYTE *pBuf,
  958. DWORD cbBuf
  959. );
  960. BOOL
  961. LocalEndDocPrinter(
  962. HANDLE hPrinter
  963. );
  964. BOOL
  965. LocalAddJob(
  966. HANDLE hPrinter,
  967. DWORD Level,
  968. LPBYTE pData,
  969. DWORD cbBuf,
  970. LPDWORD pcbNeeded
  971. );
  972. BOOL
  973. LocalScheduleJob(
  974. HANDLE hPrinter,
  975. DWORD JobId
  976. );
  977. DWORD
  978. LocalWaitForPrinterChange(
  979. HANDLE hPrinter,
  980. DWORD Flags
  981. );
  982. BOOL
  983. SetSpoolClosingChange(
  984. PSPOOL pSpool
  985. );
  986. BOOL
  987. SetPrinterChange(
  988. PINIPRINTER pIniPrinter,
  989. PINIJOB pIniJob,
  990. PDWORD pdwNotifyVectors,
  991. DWORD Flags,
  992. PINISPOOLER pIniSpooler
  993. );
  994. BOOL
  995. LocalEnumMonitors(
  996. LPWSTR pName,
  997. DWORD Level,
  998. LPBYTE pMonitors,
  999. DWORD cbBuf,
  1000. LPDWORD pcbNeeded,
  1001. LPDWORD pcReturned
  1002. );
  1003. BOOL
  1004. LocalEnumPorts(
  1005. LPWSTR pName,
  1006. DWORD Level,
  1007. LPBYTE pPorts,
  1008. DWORD cbBuf,
  1009. LPDWORD pcbNeeded,
  1010. LPDWORD pcReturned
  1011. );
  1012. BOOL
  1013. LocalAddPort(
  1014. LPWSTR pName,
  1015. HWND hWnd,
  1016. LPWSTR pMonitorName
  1017. );
  1018. BOOL
  1019. LocalConfigurePort(
  1020. LPWSTR pName,
  1021. HWND hWnd,
  1022. LPWSTR pPortName
  1023. );
  1024. BOOL
  1025. LocalDeletePort(
  1026. LPWSTR pName,
  1027. HWND hWnd,
  1028. LPWSTR pPortName
  1029. );
  1030. BOOL
  1031. LocalXcvData(
  1032. HANDLE hXcv,
  1033. LPCWSTR pszDataName,
  1034. PBYTE pInputData,
  1035. DWORD cbInputData,
  1036. PBYTE pOutputData,
  1037. DWORD cbOutputData,
  1038. PDWORD pcbOutputNeeded,
  1039. PDWORD pdwStatus
  1040. );
  1041. DWORD
  1042. XcvOpen(
  1043. PCWSTR pszServer,
  1044. PCWSTR pszObject,
  1045. DWORD dwType,
  1046. PPRINTER_DEFAULTS pDefault,
  1047. PHANDLE phXcv,
  1048. PINISPOOLER pIniSpooler
  1049. );
  1050. BOOL
  1051. XcvClose(
  1052. PINIXCV pIniXcv
  1053. );
  1054. BOOL
  1055. XcvDeletePort(
  1056. PINIXCV pIniXcv,
  1057. PCWSTR pszDataName,
  1058. PBYTE pInputData,
  1059. DWORD cbInputData,
  1060. PBYTE pOutputData,
  1061. DWORD cbOutputData,
  1062. PDWORD pcbOutputNeeded,
  1063. PDWORD pdwStatus,
  1064. PINISPOOLER pIniSpooler
  1065. );
  1066. BOOL
  1067. XcvAddPort(
  1068. PINIXCV pIniXcv,
  1069. PCWSTR pszDataName,
  1070. PBYTE pInputData,
  1071. DWORD cbInputData,
  1072. PBYTE pOutputData,
  1073. DWORD cbOutputData,
  1074. PDWORD pcbOutputNeeded,
  1075. PDWORD pdwStatus,
  1076. PINISPOOLER pIniSpooler
  1077. );
  1078. BOOL
  1079. AddPortToSpooler(
  1080. PCWSTR pName,
  1081. PINIMONITOR pIniMonitor,
  1082. PINISPOOLER pIniSpooler
  1083. );
  1084. BOOL
  1085. DeletePortFromSpoolerStart(
  1086. PINIPORT pIniPort
  1087. );
  1088. BOOL
  1089. DeletePortFromSpoolerEnd(
  1090. PINIPORT pIniPort,
  1091. PINISPOOLER pIniSpooler,
  1092. BOOL bSuccess
  1093. );
  1094. HANDLE
  1095. LocalCreatePrinterIC(
  1096. HANDLE hPrinter,
  1097. LPDEVMODE pDevMode
  1098. );
  1099. BOOL
  1100. LocalPlayGdiScriptOnPrinterIC(
  1101. HANDLE hPrinterIC,
  1102. LPBYTE pIn,
  1103. DWORD cIn,
  1104. LPBYTE pOut,
  1105. DWORD cOut,
  1106. DWORD ul
  1107. );
  1108. BOOL
  1109. LocalDeletePrinterIC(
  1110. HANDLE hPrinterIC
  1111. );
  1112. DWORD
  1113. LocalPrinterMessageBox(
  1114. HANDLE hPrinter,
  1115. DWORD Error,
  1116. HWND hWnd,
  1117. LPWSTR pText,
  1118. LPWSTR pCaption,
  1119. DWORD dwType
  1120. );
  1121. BOOL
  1122. LocalAddMonitor(
  1123. LPWSTR pName,
  1124. DWORD Level,
  1125. LPBYTE pMonitors
  1126. );
  1127. BOOL
  1128. LocalDeleteMonitor(
  1129. LPWSTR pName,
  1130. LPWSTR pEnvironment,
  1131. LPWSTR pMonitorName
  1132. );
  1133. BOOL
  1134. LocalFindFirstPrinterChangeNotification(
  1135. HANDLE hPrinter,
  1136. DWORD fdwFlags,
  1137. DWORD fdwOptions,
  1138. HANDLE hNotify,
  1139. PDWORD pfdwStatus,
  1140. PVOID pvReserved0,
  1141. PVOID pvReserved1
  1142. );
  1143. BOOL
  1144. LocalFindClosePrinterChangeNotification(
  1145. HANDLE hPrinter
  1146. );
  1147. PINIPRINTPROC
  1148. FindDatatype(
  1149. PINIPRINTPROC pDefaultPrintProc,
  1150. LPWSTR pDatatype
  1151. );
  1152. PINIPRINTPROC
  1153. InitializePrintProcessor(
  1154. HINSTANCE hLibrary,
  1155. PINIENVIRONMENT pIniEnvironment,
  1156. LPWSTR pPrintProcessorName,
  1157. LPWSTR pDLLName
  1158. );
  1159. HRESULT
  1160. InitializeLocalPrintProcessor(
  1161. IN PINIENVIRONMENT pIniEnvironment
  1162. );
  1163. BOOL
  1164. BuildOtherNamesFromMachineName(
  1165. LPWSTR **ppszOtherNames,
  1166. DWORD *cOtherNames
  1167. );
  1168. VOID
  1169. FreeOtherNames(
  1170. PWSTR **ppszMyOtherNames,
  1171. DWORD *cOtherNames
  1172. );
  1173. PINIPRINTPROC
  1174. LoadPrintProcessor(
  1175. PINIENVIRONMENT pIniEnvironment,
  1176. LPWSTR pPrintProcessorName,
  1177. LPWSTR pPathName,
  1178. PINISPOOLER pIniSpooler
  1179. );
  1180. PINIMONITOR
  1181. CreateMonitorEntry(
  1182. LPWSTR pMonitorDll,
  1183. LPWSTR pMonitorName,
  1184. PINISPOOLER pIniSpooler
  1185. );
  1186. PINIPORT
  1187. FindIniPortFromIniPrinter(
  1188. PINIPRINTER pIniPrinter
  1189. );
  1190. BOOL
  1191. GetPrintDriverVersion(
  1192. IN LPCWSTR pszFileName,
  1193. OUT LPDWORD pdwFileMajorVersion,
  1194. OUT LPDWORD pdwFileMinorVersion
  1195. );
  1196. BOOL
  1197. GetBinaryVersion(
  1198. IN PCWSTR pszFileName,
  1199. OUT PDWORD pdwFileMajorVersion,
  1200. OUT PDWORD pdwFileMinorVersion
  1201. );
  1202. BOOL
  1203. IsSpecialDriver(
  1204. IN PINIDRIVER pIniDriver,
  1205. IN PINIPRINTPROC pIniProc,
  1206. IN PINISPOOLER pIniSpooler
  1207. );
  1208. BOOL
  1209. IsLocalFile (
  1210. IN LPCWSTR pszFileName,
  1211. IN PINISPOOLER pIniSpooler
  1212. );
  1213. BOOL
  1214. IsEXEFile(
  1215. IN LPCWSTR pszFileName
  1216. );
  1217. LPBYTE
  1218. PackStringToEOB(
  1219. IN LPWSTR pszSource,
  1220. IN LPBYTE pEnd
  1221. );
  1222. LPVOID
  1223. MakePTR (
  1224. IN LPVOID pBuf,
  1225. IN DWORD Quantity
  1226. );
  1227. DWORD
  1228. MakeOffset (
  1229. IN LPVOID pFirst,
  1230. IN LPVOID pSecond
  1231. );
  1232. BOOL
  1233. ConvertDriverInfoToBLOB (
  1234. IN LPBYTE pDriverInfo,
  1235. IN DWORD Level
  1236. );
  1237. BOOL
  1238. ConvertBLOBToDriverInfo (
  1239. IN LPBYTE pDriverInfo,
  1240. IN DWORD Level
  1241. )
  1242. ;
  1243. LPWSTR
  1244. GetErrorString(
  1245. DWORD Error
  1246. );
  1247. DWORD
  1248. KMPrintersAreBlocked(
  1249. );
  1250. #define NULL_TERMINATED 0
  1251. INT
  1252. AnsiToUnicodeString(
  1253. LPSTR pAnsi,
  1254. LPWSTR pUnicode,
  1255. DWORD StringLength
  1256. );
  1257. int
  1258. Message(
  1259. HWND hwnd,
  1260. DWORD Type,
  1261. int CaptionID,
  1262. int TextID,
  1263. ...
  1264. );
  1265. DWORD
  1266. PromptWriteError(
  1267. PSPOOL pSpool,
  1268. PHANDLE phThread,
  1269. PDWORD pdwThreadId
  1270. );
  1271. DWORD
  1272. InitializeEventLogging(
  1273. PINISPOOLER pIniSpooler
  1274. );
  1275. VOID
  1276. SplLogEventWorker(
  1277. IN PINISPOOLER pIniSpooler,
  1278. IN WORD EventType,
  1279. IN NTSTATUS EventID,
  1280. IN BOOL bInSplSem,
  1281. IN LPWSTR pFirstString,
  1282. IN va_list vargs
  1283. );
  1284. VOID
  1285. SplLogEvent(
  1286. PINISPOOLER pIniSpooler,
  1287. WORD EventType,
  1288. NTSTATUS EventID,
  1289. BOOL bInSplSem,
  1290. LPWSTR pFirstString,
  1291. ...
  1292. );
  1293. VOID
  1294. SplLogEventExternal(
  1295. IN WORD EventType,
  1296. IN DWORD EventID,
  1297. IN LPWSTR pFirstString,
  1298. ...
  1299. );
  1300. #define IDS_LOCALSPOOLER 100
  1301. #define IDS_ERROR_WRITING_TO_PORT 101
  1302. #define IDS_ERROR_WRITING_TO_DISK 102
  1303. #define IDS_PRINTER_DRIVERS 104
  1304. #define IDS_UNNAMED 105
  1305. #define IDS_ERROR_WRITING_GENERAL 106
  1306. #define IDS_REMOTE_DOC 107
  1307. #define IDS_LOCAL_DOC 108
  1308. #define IDS_FASTPRINT_TIMEOUT 109
  1309. #define IDS_DRIVER_CHECKPOINT 110
  1310. // Maximum length of a builtin form
  1311. //
  1312. #define FORM_NAME_LEN 31
  1313. #define CUSTOM_NAME_LEN 31
  1314. #define FORM_DATA_LEN 32
  1315. // String table Ids for builtin form names
  1316. //
  1317. #define IDS_FORM_LETTER 200
  1318. #define IDS_FORM_LETTER_SMALL 201
  1319. #define IDS_FORM_TABLOID 202
  1320. #define IDS_FORM_LEDGER 203
  1321. #define IDS_FORM_LEGAL 204
  1322. #define IDS_FORM_STATEMENT 205
  1323. #define IDS_FORM_EXECUTIVE 206
  1324. #define IDS_FORM_A3 207
  1325. #define IDS_FORM_A4 208
  1326. #define IDS_FORM_A4_SMALL 209
  1327. #define IDS_FORM_A5 210
  1328. #define IDS_FORM_B4 211
  1329. #define IDS_FORM_B5 212
  1330. #define IDS_FORM_FOLIO 213
  1331. #define IDS_FORM_QUARTO 214
  1332. #define IDS_FORM_10X14 215
  1333. #define IDS_FORM_11X17 216
  1334. #define IDS_FORM_NOTE 217
  1335. #define IDS_FORM_ENVELOPE9 218
  1336. #define IDS_FORM_ENVELOPE10 219
  1337. #define IDS_FORM_ENVELOPE11 220
  1338. #define IDS_FORM_ENVELOPE12 221
  1339. #define IDS_FORM_ENVELOPE14 222
  1340. #define IDS_FORM_ENVELOPE_CSIZE_SHEET 223
  1341. #define IDS_FORM_ENVELOPE_DSIZE_SHEET 224
  1342. #define IDS_FORM_ENVELOPE_ESIZE_SHEET 225
  1343. #define IDS_FORM_ENVELOPE_DL 226
  1344. #define IDS_FORM_ENVELOPE_C5 227
  1345. #define IDS_FORM_ENVELOPE_C3 228
  1346. #define IDS_FORM_ENVELOPE_C4 229
  1347. #define IDS_FORM_ENVELOPE_C6 230
  1348. #define IDS_FORM_ENVELOPE_C65 231
  1349. #define IDS_FORM_ENVELOPE_B4 232
  1350. #define IDS_FORM_ENVELOPE_B5 233
  1351. #define IDS_FORM_ENVELOPE_B6 234
  1352. #define IDS_FORM_ENVELOPE 235
  1353. #define IDS_FORM_ENVELOPE_MONARCH 236
  1354. #define IDS_FORM_SIX34_ENVELOPE 237
  1355. #define IDS_FORM_US_STD_FANFOLD 238
  1356. #define IDS_FORM_GMAN_STD_FANFOLD 239
  1357. #define IDS_FORM_GMAN_LEGAL_FANFOLD 240
  1358. #if(WINVER >= 0x0400)
  1359. #define IDS_FORM_ISO_B4 241
  1360. #define IDS_FORM_JAPANESE_POSTCARD 242
  1361. #define IDS_FORM_9X11 243
  1362. #define IDS_FORM_10X11 244
  1363. #define IDS_FORM_15X11 245
  1364. #define IDS_FORM_ENV_INVITE 246
  1365. #define IDS_FORM_LETTER_EXTRA 247
  1366. #define IDS_FORM_LEGAL_EXTRA 248
  1367. #define IDS_FORM_TABLOID_EXTRA 249
  1368. #define IDS_FORM_A4_EXTRA 250
  1369. #define IDS_FORM_LETTER_TRANSVERSE 251
  1370. #define IDS_FORM_A4_TRANSVERSE 252
  1371. #define IDS_FORM_LETTER_EXTRA_TRANSVERSE 253
  1372. #define IDS_FORM_A_PLUS 254
  1373. #define IDS_FORM_B_PLUS 255
  1374. #define IDS_FORM_LETTER_PLUS 256
  1375. #define IDS_FORM_A4_PLUS 257
  1376. #define IDS_FORM_A5_TRANSVERSE 258
  1377. #define IDS_FORM_B5_TRANSVERSE 259
  1378. #define IDS_FORM_A3_EXTRA 260
  1379. #define IDS_FORM_A5_EXTRA 261
  1380. #define IDS_FORM_B5_EXTRA 262
  1381. #define IDS_FORM_A2 263
  1382. #define IDS_FORM_A3_TRANSVERSE 264
  1383. #define IDS_FORM_A3_EXTRA_TRANSVERSE 265
  1384. #define IDS_FORM_DBL_JAPANESE_POSTCARD 266
  1385. #define IDS_FORM_A6 267
  1386. #define IDS_FORM_JENV_KAKU2 268
  1387. #define IDS_FORM_JENV_KAKU3 269
  1388. #define IDS_FORM_JENV_CHOU3 270
  1389. #define IDS_FORM_JENV_CHOU4 271
  1390. #define IDS_FORM_LETTER_ROTATED 272
  1391. #define IDS_FORM_A3_ROTATED 273
  1392. #define IDS_FORM_A4_ROTATED 274
  1393. #define IDS_FORM_A5_ROTATED 275
  1394. #define IDS_FORM_B4_JIS_ROTATED 276
  1395. #define IDS_FORM_B5_JIS_ROTATED 277
  1396. #define IDS_FORM_JAPANESE_POSTCARD_ROTATED 278
  1397. #define IDS_FORM_DBL_JAPANESE_POSTCARD_ROTATED 279
  1398. #define IDS_FORM_A6_ROTATED 280
  1399. #define IDS_FORM_JENV_KAKU2_ROTATED 281
  1400. #define IDS_FORM_JENV_KAKU3_ROTATED 282
  1401. #define IDS_FORM_JENV_CHOU3_ROTATED 283
  1402. #define IDS_FORM_JENV_CHOU4_ROTATED 284
  1403. #define IDS_FORM_B6_JIS 285
  1404. #define IDS_FORM_B6_JIS_ROTATED 286
  1405. #define IDS_FORM_12X11 287
  1406. #define IDS_FORM_JENV_YOU4 288
  1407. #define IDS_FORM_JENV_YOU4_ROTATED 289
  1408. #define IDS_FORM_P16K 290
  1409. #define IDS_FORM_P32K 291
  1410. #define IDS_FORM_P32KBIG 292
  1411. #define IDS_FORM_PENV_1 293
  1412. #define IDS_FORM_PENV_2 294
  1413. #define IDS_FORM_PENV_3 295
  1414. #define IDS_FORM_PENV_4 296
  1415. #define IDS_FORM_PENV_5 297
  1416. #define IDS_FORM_PENV_6 298
  1417. #define IDS_FORM_PENV_7 299
  1418. #define IDS_FORM_PENV_8 300
  1419. #define IDS_FORM_PENV_9 301
  1420. #define IDS_FORM_PENV_10 302
  1421. #define IDS_FORM_P16K_ROTATED 303
  1422. #define IDS_FORM_P32K_ROTATED 304
  1423. #define IDS_FORM_P32KBIG_ROTATED 305
  1424. #define IDS_FORM_PENV_1_ROTATED 306
  1425. #define IDS_FORM_PENV_2_ROTATED 307
  1426. #define IDS_FORM_PENV_3_ROTATED 308
  1427. #define IDS_FORM_PENV_4_ROTATED 309
  1428. #define IDS_FORM_PENV_5_ROTATED 310
  1429. #define IDS_FORM_PENV_6_ROTATED 311
  1430. #define IDS_FORM_PENV_7_ROTATED 312
  1431. #define IDS_FORM_PENV_8_ROTATED 313
  1432. #define IDS_FORM_PENV_9_ROTATED 314
  1433. #define IDS_FORM_PENV_10_ROTATED 315
  1434. #define IDS_FORM_RESERVED_48 316
  1435. #define IDS_FORM_RESERVED_49 317
  1436. #define IDS_FORM_CUSTOMPAD 318
  1437. #endif /* WINVER >= 0x0400 */
  1438. VOID LogJobPrinted(
  1439. PINIJOB pIniJob
  1440. );
  1441. #define MAP_READABLE 0
  1442. #define MAP_SETTABLE 1
  1443. DWORD
  1444. MapJobStatus(
  1445. DWORD Type,
  1446. DWORD Status
  1447. );
  1448. DWORD
  1449. MapPrinterStatus(
  1450. DWORD Type,
  1451. DWORD Status
  1452. );
  1453. BOOL
  1454. OpenPrinterPortW(
  1455. LPWSTR pPrinterName,
  1456. HANDLE *pHandle,
  1457. LPPRINTER_DEFAULTS pDefault
  1458. );
  1459. VOID
  1460. BroadcastChange(
  1461. PINISPOOLER pIniSpooler,
  1462. DWORD Message,
  1463. WPARAM wParam,
  1464. LPARAM lParam
  1465. );
  1466. VOID
  1467. MyMessageBeep(
  1468. DWORD fuType,
  1469. PINISPOOLER pIniSpooler
  1470. );
  1471. VOID
  1472. SendJobAlert(
  1473. PINIJOB pIniJob
  1474. );
  1475. BOOL
  1476. CheckDataTypes(
  1477. PINIPRINTPROC pIniPrintProc,
  1478. LPWSTR pDatatype
  1479. );
  1480. BOOL
  1481. ValidatePortTokenList(
  1482. IN OUT PKEYDATA pKeyData,
  1483. IN PINISPOOLER pIniSpooler,
  1484. IN BOOL bInitialize,
  1485. OUT BOOL *pbNoPorts OPTIONAL
  1486. );
  1487. VOID
  1488. FreePortTokenList(
  1489. PKEYDATA pKeyData
  1490. );
  1491. DWORD
  1492. ValidatePrinterInfo(
  1493. IN PPRINTER_INFO_2 pPrinter,
  1494. IN PINISPOOLER pIniSpooler,
  1495. IN PINIPRINTER pIniPrinter OPTIONAL,
  1496. OUT LPWSTR* ppszLocalName OPTIONAL
  1497. );
  1498. BOOL
  1499. DeletePortEntry(
  1500. PINIPORT pIniPort
  1501. );
  1502. BOOL
  1503. GetTokenHandle(
  1504. PHANDLE pTokenHandle
  1505. );
  1506. VOID
  1507. LogJobInfo(
  1508. PINISPOOLER pIniSpooler,
  1509. NTSTATUS EventId,
  1510. DWORD JobId,
  1511. LPWSTR pDocumentName,
  1512. LPWSTR pUser,
  1513. LPWSTR pPrinterName,
  1514. DWORD curPos
  1515. );
  1516. LONG
  1517. Myatol(
  1518. LPWSTR nptr
  1519. );
  1520. ULONG_PTR
  1521. atox(
  1522. LPCWSTR psz
  1523. );
  1524. DWORD
  1525. DeleteSubkeys(
  1526. HKEY hKey,
  1527. PINISPOOLER pIniSpooler
  1528. );
  1529. DWORD
  1530. RemoveRegKey(
  1531. IN LPTSTR pszKey
  1532. );
  1533. DWORD
  1534. CreateClusterSpoolerEnvironmentsStructure(
  1535. IN PINISPOOLER pIniSpooler
  1536. );
  1537. DWORD
  1538. CopyNewerOrOlderFiles(
  1539. IN LPCWSTR pszSourceDir,
  1540. IN LPCWSTR pszMasterDir,
  1541. IN BOOL (WINAPI *pfn)(LPWSTR, LPWSTR)
  1542. );
  1543. PINIENVIRONMENT
  1544. GetLocalArchEnv(
  1545. IN PINISPOOLER pIniSpooler
  1546. );
  1547. DWORD
  1548. ClusterFindLanguageMonitor(
  1549. IN LPCWSTR pszMonitor,
  1550. IN LPCWSTR pszEnvName,
  1551. IN PINISPOOLER pIniSpooler
  1552. );
  1553. DWORD
  1554. ReadTimeStamp(
  1555. IN HKEY hkRoot,
  1556. IN OUT SYSTEMTIME *pSysTime,
  1557. IN LPCWSTR pszSubKey1,
  1558. IN LPCWSTR pszSubKey2,
  1559. IN LPCWSTR pszSubKey3,
  1560. IN LPCWSTR pszSubKey4,
  1561. IN LPCWSTR pszSubKey5,
  1562. IN PINISPOOLER pIniSpooler
  1563. );
  1564. DWORD
  1565. WriteTimeStamp(
  1566. IN HKEY hkRoot,
  1567. IN SYSTEMTIME SysTime,
  1568. IN LPCWSTR pszSubKey1,
  1569. IN LPCWSTR pszSubKey2,
  1570. IN LPCWSTR pszSubKey3,
  1571. IN LPCWSTR pszSubKey4,
  1572. IN LPCWSTR pszSubKey5,
  1573. IN PINISPOOLER pIniSpooler
  1574. );
  1575. BOOL
  1576. ClusterCheckDriverChanged(
  1577. IN HKEY hClusterVersionKey,
  1578. IN LPCWSTR pszDriver,
  1579. IN LPCWSTR pszEnv,
  1580. IN LPCWSTR pszVer,
  1581. IN PINISPOOLER pIniSpooler
  1582. );
  1583. DWORD
  1584. RunProcess(
  1585. IN LPCWSTR pszExe,
  1586. IN LPCWSTR pszCommand,
  1587. IN DWORD dwTimeOut,
  1588. OUT LPDWORD pdwExitCode OPTIONAL
  1589. );
  1590. DWORD
  1591. CopyICMFromLocalDiskToClusterDisk(
  1592. IN PINISPOOLER pIniSpooler
  1593. );
  1594. DWORD
  1595. CopyICMFromClusterDiskToLocalDisk(
  1596. IN PINISPOOLER pIniSpooler
  1597. );
  1598. DWORD
  1599. CreateProtectedDirectory(
  1600. IN LPCWSTR pszDir
  1601. );
  1602. DWORD
  1603. AddLocalDriverToClusterSpooler(
  1604. IN LPCWSTR pszDriver,
  1605. IN PINISPOOLER pIniSpooler
  1606. );
  1607. DWORD
  1608. StrCatPrefixMsz(
  1609. IN LPCWSTR pszPerfix,
  1610. IN LPWSTR pszzFiles,
  1611. IN OUT LPWSTR *ppszFullPathFiles
  1612. );
  1613. DWORD
  1614. ClusterSplDeleteUpgradeKey(
  1615. IN LPCWSTR pszResourceID
  1616. );
  1617. DWORD
  1618. ClusterSplReadUpgradeKey(
  1619. IN LPCWSTR pszResourceID,
  1620. OUT LPDWORD pdwValue
  1621. );
  1622. DWORD
  1623. CopyFileToDirectory(
  1624. IN LPCWSTR pszFullFileName,
  1625. IN LPCWSTR pszDestDir,
  1626. IN LPCWSTR pszDir1,
  1627. IN LPCWSTR pszDir2,
  1628. IN LPCWSTR pszDir3
  1629. );
  1630. DWORD
  1631. InstallMonitorFromCluster(
  1632. IN LPCWSTR pszName,
  1633. IN LPCWSTR pszEnvName,
  1634. IN LPCWSTR pszEnvDir,
  1635. IN PINISPOOLER pIniSpooler
  1636. );
  1637. PINIDRIVER
  1638. FindLocalDriver(
  1639. PINISPOOLER pIniSpooler,
  1640. LPWSTR pz
  1641. );
  1642. BOOL
  1643. FindLocalDriverAndVersion(
  1644. PINISPOOLER pIniSpooler,
  1645. LPWSTR pz,
  1646. PINIDRIVER *ppIniDriver,
  1647. PINIVERSION *ppIniVersion
  1648. );
  1649. BOOL
  1650. IsKMPD(
  1651. LPWSTR pDriverName
  1652. );
  1653. BOOL
  1654. IniDriverIsKMPD (
  1655. PINISPOOLER pIniSpooler,
  1656. PINIENVIRONMENT pIniEnvironment,
  1657. PINIVERSION pIniVersion,
  1658. PINIDRIVER pIniDriver
  1659. );
  1660. PINIDRIVER
  1661. FindCompatibleDriver(
  1662. PINIENVIRONMENT pIniEnvironment,
  1663. PINIVERSION * ppIniVersion,
  1664. LPWSTR pDriverName,
  1665. DWORD dwMajorVersion,
  1666. int FindAnyDriver
  1667. );
  1668. VOID
  1669. QueryUpgradeFlag(
  1670. PINISPOOLER pIniSpooler
  1671. );
  1672. BOOL
  1673. LocalAddPortEx(
  1674. LPWSTR pName,
  1675. DWORD Level,
  1676. LPBYTE pBuffer,
  1677. LPWSTR pMonitorName
  1678. );
  1679. BOOL
  1680. ValidateSpoolHandle(
  1681. PSPOOL pSpool,
  1682. DWORD dwDisallowMask
  1683. );
  1684. PSECURITY_DESCRIPTOR
  1685. MapPrinterSDToShareSD(
  1686. PSECURITY_DESCRIPTOR pPrinterSD
  1687. );
  1688. BOOL
  1689. CallDevQueryPrint(
  1690. LPWSTR pPrinterName,
  1691. LPDEVMODE pDevMode,
  1692. LPWSTR ErrorString,
  1693. DWORD dwErrorString,
  1694. DWORD dwPrinterFlags,
  1695. DWORD dwJobFlags
  1696. );
  1697. BOOL
  1698. InitializeWinSpoolDrv(
  1699. VOID
  1700. );
  1701. VOID
  1702. FixDevModeDeviceName(
  1703. LPWSTR pPrinterName,
  1704. PDEVMODE pDevMode,
  1705. DWORD cbDevMode
  1706. );
  1707. VOID
  1708. RemoveOldNetPrinters(
  1709. PPRINTER_INFO_1 pCurrentPrinterInfo1,
  1710. PINISPOOLER pIniSpooler
  1711. );
  1712. PINIJOB
  1713. AssignFreeJobToFreePort(
  1714. PINIPORT pIniPort,
  1715. DWORD *pTimeToWait
  1716. );
  1717. BOOL
  1718. ValidRawDatatype(
  1719. LPWSTR pszDataType);
  1720. BOOL
  1721. InternalAddPrinterDriverEx(
  1722. LPWSTR pName,
  1723. DWORD Level,
  1724. LPBYTE pDriverInfo,
  1725. DWORD dwFileCopyFlags,
  1726. PINISPOOLER pIniSpooler,
  1727. BOOL bUseScratchDir,
  1728. BOOL bImpersonateOnCreate
  1729. );
  1730. VOID
  1731. CheckSizeDetectionThread(
  1732. VOID
  1733. );
  1734. VOID
  1735. Upgrade31DriversRegistryForAllEnvironments(
  1736. PINISPOOLER pIniSpooler
  1737. );
  1738. VOID
  1739. UpgradeForms(
  1740. PINISPOOLER pIniSpooler
  1741. );
  1742. HANDLE
  1743. CreatePrinterHandle(
  1744. LPWSTR pPrinterName,
  1745. LPWSTR pFullMachineName,
  1746. PINIPRINTER pIniPrinter,
  1747. PINIPORT pIniPort,
  1748. PINIPORT pIniNetPort,
  1749. PINIJOB pIniJob,
  1750. DWORD TypeofHandle,
  1751. HANDLE hPort,
  1752. PPRINTER_DEFAULTS pDefaults,
  1753. PINISPOOLER pIniSpooler,
  1754. DWORD AccessRequested,
  1755. LPBYTE pSplClientInfo,
  1756. DWORD dwLevel,
  1757. HANDLE hReadFile
  1758. );
  1759. DWORD
  1760. CreateServerHandle(
  1761. LPWSTR pPrinterName,
  1762. LPHANDLE pPrinterHandle,
  1763. LPPRINTER_DEFAULTS pDefaults,
  1764. PINISPOOLER pIniSpooler,
  1765. DWORD dwTypeofHandle
  1766. );
  1767. PINIPRINTER
  1768. FindPrinterShare(
  1769. LPCWSTR pShareName,
  1770. PINISPOOLER pIniSpooler
  1771. );
  1772. BOOL
  1773. GetSpoolerPolicy(
  1774. PWSTR pszValue,
  1775. PBYTE pData,
  1776. PDWORD pcbData
  1777. );
  1778. DWORD
  1779. GetDwPolicy(
  1780. PWSTR pszName,
  1781. DWORD dwDefault
  1782. );
  1783. PINIJOB
  1784. CreateJobEntry(
  1785. PSPOOL pSpool,
  1786. DWORD Level,
  1787. LPBYTE pDocInfo,
  1788. DWORD JobId,
  1789. BOOL bRemote,
  1790. DWORD JobStatus,
  1791. LPWSTR pMachineName
  1792. );
  1793. BOOL
  1794. DeletePrinterCheck(
  1795. PINIPRINTER pIniPrinter
  1796. );
  1797. VOID
  1798. DeleteSpoolerCheck(
  1799. PINISPOOLER pIniSpooler
  1800. );
  1801. BOOL
  1802. DeletePrinterIni(
  1803. PINIPRINTER pIniPrinter
  1804. );
  1805. DWORD
  1806. SplDeleteThisKey(
  1807. HKEY hParentKey, // handle to parent of key to delete
  1808. HKEY hThisKey, // handle of key to delete
  1809. LPWSTR pThisKeyName, // name of this key
  1810. BOOL bDeleteNullKey, // if *pThisKeyName is NULL, delete it if TRUE
  1811. PINISPOOLER pIniSpooler
  1812. );
  1813. BOOL
  1814. CopyPrinterIni(
  1815. PINIPRINTER pIniPrinter,
  1816. LPWSTR pNewName
  1817. );
  1818. BOOL
  1819. UpdateString(
  1820. LPWSTR* ppszCur,
  1821. LPWSTR pszNew);
  1822. BOOL
  1823. SetPrinterPorts(
  1824. PSPOOL pSpool,
  1825. PINIPRINTER pIniPrinter,
  1826. PKEYDATA pKeyData
  1827. );
  1828. VOID
  1829. InternalDeletePrinter(
  1830. PINIPRINTER pIniPrinter
  1831. );
  1832. BOOL
  1833. PurgePrinter(
  1834. PINIPRINTER pIniPrinter
  1835. );
  1836. BOOL
  1837. AddIniPrinterToIniPort(
  1838. PINIPORT pIniPort,
  1839. PINIPRINTER pIniPrinter
  1840. );
  1841. BOOL
  1842. AddIniPortToIniPrinter(
  1843. PINIPRINTER pIniPrinter,
  1844. PINIPORT pIniPort
  1845. );
  1846. LPCWSTR
  1847. FindFileName(
  1848. LPCWSTR pPathName
  1849. );
  1850. VOID
  1851. UpdateJobAttributes(
  1852. PINIJOB pIniJob
  1853. );
  1854. BOOL
  1855. InternalCopyFile(
  1856. HANDLE hFile,
  1857. PWIN32_FIND_DATA pSourceFileData,
  1858. LPWSTR pTagetFileName,
  1859. BOOL bOverWriteIfTargetExists
  1860. );
  1861. BOOL
  1862. UpdateFile(
  1863. PINIVERSION pIniVersion,
  1864. HANDLE hSourceFile,
  1865. LPWSTR pSourceFile,
  1866. DWORD dwVersion,
  1867. LPWSTR pDestDir,
  1868. DWORD dwFileCopyFlags,
  1869. BOOL bImpersonateOnCreate,
  1870. LPBOOL pbFileUpdated,
  1871. LPBOOL pbFileMoved,
  1872. BOOL bSameEnvironment,
  1873. BOOL bWin95Environment
  1874. );
  1875. BOOL
  1876. PrinterCreateKey(
  1877. HKEY hKey,
  1878. LPWSTR pSubKey,
  1879. PHKEY phkResult,
  1880. PDWORD pdwLastError,
  1881. PINISPOOLER pIniSpooler
  1882. );
  1883. BOOL
  1884. RegSetString(
  1885. HANDLE hPrinterKey,
  1886. LPWSTR pValueName,
  1887. LPWSTR pStringValue,
  1888. PDWORD pdwLastError,
  1889. PINISPOOLER pIniSpooler
  1890. );
  1891. BOOL
  1892. RegSetDWord(
  1893. HANDLE hPrinterKey,
  1894. LPWSTR pValueName,
  1895. DWORD dwParam,
  1896. PDWORD pdwLastError,
  1897. PINISPOOLER pIniSpooler
  1898. );
  1899. VOID
  1900. CheckAndUpdatePrinterRegAll(
  1901. PINISPOOLER pIniSpooler,
  1902. LPWSTR pszPrinterName,
  1903. LPWSTR pszPort,
  1904. BOOL bDelete
  1905. );
  1906. BOOL
  1907. ForEachPrinterCallDriverDrvUpgrade(
  1908. PINISPOOLER pIniSpooler,
  1909. PINIDRIVER pIniDriver,
  1910. LPCWSTR pOldDriverDir,
  1911. PINTERNAL_DRV_FILE pInternalDriverFile,
  1912. DWORD dwFileCount,
  1913. LPBYTE pDriverInfo
  1914. );
  1915. BOOL
  1916. bBitIsSet(
  1917. LPBYTE pUpdateStatus,
  1918. DWORD dwPosition
  1919. );
  1920. VOID
  1921. SetBit(
  1922. LPBYTE pUpdateStatus,
  1923. DWORD dwPosition
  1924. );
  1925. BOOL
  1926. DeleteAllFilesInDirectory(
  1927. LPWSTR pDirectory,
  1928. BOOL bWaitForReboot
  1929. );
  1930. BOOL
  1931. DeleteAllFilesAndDirectory(
  1932. LPWSTR pDirectory,
  1933. BOOL bWaitForReboot
  1934. );
  1935. VOID
  1936. DeleteDirectoryRecursively(
  1937. LPCWSTR pDirectory,
  1938. BOOL bWaitForReboot
  1939. );
  1940. DWORD
  1941. CreateNumberedTempDirectory(
  1942. LPCWSTR pszDirectory,
  1943. LPWSTR *ppszTempDirectory
  1944. );
  1945. VOID
  1946. Upgrade35Forms(
  1947. HKEY hFormsKey,
  1948. PINISPOOLER pIniSpooler
  1949. );
  1950. BOOL
  1951. UpgradeDriverData(
  1952. PINISPOOLER pIniSpooler
  1953. );
  1954. BOOL
  1955. FileExists(
  1956. LPWSTR pFileName
  1957. );
  1958. BOOL
  1959. DirectoryExists(
  1960. LPWSTR pDirectoryName
  1961. );
  1962. PINIVERSION
  1963. FindVersionEntry(
  1964. PINIENVIRONMENT pIniEnvironment,
  1965. DWORD dwVersion
  1966. );
  1967. BOOL
  1968. CreateDirectoryWithoutImpersonatingUser(
  1969. LPWSTR pDirectory
  1970. );
  1971. VOID
  1972. InsertVersionList(
  1973. PINIVERSION* pIniVersionHead,
  1974. PINIVERSION pIniVersion
  1975. );
  1976. BOOL
  1977. SameMultiSz(
  1978. LPWSTR pszz1,
  1979. LPWSTR pszz2
  1980. );
  1981. int
  1982. wstrcmpEx(
  1983. LPCWSTR s1,
  1984. LPCWSTR s2,
  1985. BOOL bCaseSensitive
  1986. );
  1987. BOOL
  1988. RegSetString(
  1989. HANDLE hKey,
  1990. LPWSTR pValueName,
  1991. LPWSTR pStringValue,
  1992. PDWORD pdwLastError,
  1993. PINISPOOLER pIniSpooler
  1994. );
  1995. BOOL
  1996. RegSetDWord(
  1997. HANDLE hKey,
  1998. LPWSTR pValueName,
  1999. DWORD dwParam,
  2000. PDWORD pdwLastError,
  2001. PINISPOOLER pIniSpooler
  2002. );
  2003. BOOL
  2004. RegSetBinaryData(
  2005. HKEY hKey,
  2006. LPWSTR pValueName,
  2007. LPBYTE pData,
  2008. DWORD cbData,
  2009. PDWORD pdwLastError,
  2010. PINISPOOLER pIniSpooler
  2011. );
  2012. BOOL
  2013. RegSetMultiString(
  2014. HANDLE hKey,
  2015. LPWSTR pValueName,
  2016. LPWSTR pStringValue,
  2017. DWORD cbString,
  2018. PDWORD pdwLastError,
  2019. PINISPOOLER pIniSpooler
  2020. );
  2021. BOOL
  2022. RegGetString(
  2023. HANDLE hKey,
  2024. LPWSTR pValueName,
  2025. LPWSTR *ppValue,
  2026. LPDWORD pcchCount,
  2027. PDWORD pdwLastError,
  2028. BOOL bFailIfNotFound,
  2029. PINISPOOLER pIniSpooler
  2030. );
  2031. BOOL
  2032. RegGetMultiSzString(
  2033. HANDLE hKey,
  2034. LPWSTR pValueName,
  2035. LPWSTR *ppValue,
  2036. LPDWORD pcchValue,
  2037. PDWORD pdwLastError,
  2038. BOOL bFailIfNotFound,
  2039. PINISPOOLER pIniSpooler
  2040. );
  2041. DWORD
  2042. ValidatePrinterName(
  2043. LPWSTR pszNewName,
  2044. PINISPOOLER pIniSpooler,
  2045. PINIPRINTER pIniPrinter,
  2046. LPWSTR *ppszLocalName
  2047. );
  2048. DWORD
  2049. ValidatePrinterShareName(
  2050. LPWSTR pszNewShareName,
  2051. PINISPOOLER pIniSpooler,
  2052. PINIPRINTER pIniPrinter
  2053. );
  2054. BOOL
  2055. AllocOrUpdateStringAndTestSame(
  2056. IN LPWSTR *ppString,
  2057. IN LPCWSTR pNewValue,
  2058. IN LPCWSTR pOldValue,
  2059. IN BOOL bCaseSensitive,
  2060. IN OUT BOOL *pbFail,
  2061. IN OUT BOOL *pbIdentical
  2062. );
  2063. BOOL
  2064. AllocOrUpdateString(
  2065. IN LPWSTR *ppString,
  2066. IN LPCWSTR pNewValue,
  2067. IN LPCWSTR pOldValue,
  2068. IN BOOL bCaseSensitive,
  2069. IN OUT BOOL *bFail
  2070. );
  2071. VOID
  2072. FreeStructurePointers(
  2073. LPBYTE lpStruct,
  2074. LPBYTE lpStruct2,
  2075. LPDWORD lpOffsets);
  2076. VOID
  2077. CopyNewOffsets(
  2078. LPBYTE pStruct,
  2079. LPBYTE pTempStruct,
  2080. LPDWORD lpOffsets
  2081. );
  2082. LPWSTR
  2083. GetConfigFilePath(
  2084. IN PINIPRINTER pIniPrinter
  2085. );
  2086. PDEVMODE
  2087. ConvertDevModeToSpecifiedVersion(
  2088. IN PINIPRINTER pIniPrinter,
  2089. IN PDEVMODE pDevMode,
  2090. IN LPWSTR pszConfigFile, OPTIONAL
  2091. IN LPWSTR pszPrinterNameWithToken, OPTIONAL
  2092. IN BOOL bNt35xVersion
  2093. );
  2094. BOOL
  2095. CreateRedirectionThread(
  2096. PINIPORT pIniPort
  2097. );
  2098. VOID
  2099. RemoveDeviceName(
  2100. PINIPORT pIniPort
  2101. );
  2102. BOOL
  2103. IsPortType(
  2104. LPWSTR pPort,
  2105. LPWSTR pPrefix
  2106. );
  2107. BOOL
  2108. LocalSetPort(
  2109. LPWSTR pszName,
  2110. LPWSTR pszPortName,
  2111. DWORD dwLevel,
  2112. LPBYTE pPortInfo
  2113. );
  2114. DWORD
  2115. SetPrinterDataServer(
  2116. PINISPOOLER pIniSpooler,
  2117. LPWSTR pValueName,
  2118. DWORD Type,
  2119. LPBYTE pData,
  2120. DWORD cbData
  2121. );
  2122. BOOL
  2123. BuildPrintObjectProtection(
  2124. IN PUCHAR AceType,
  2125. IN DWORD AceCount,
  2126. IN PSID *AceSid,
  2127. IN ACCESS_MASK *AceMask,
  2128. IN BYTE *InheritFlags,
  2129. IN PSID OwnerSid,
  2130. IN PSID GroupSid,
  2131. IN PGENERIC_MAPPING GenericMap,
  2132. OUT PSECURITY_DESCRIPTOR *ppSecurityDescriptor
  2133. );
  2134. INT
  2135. UnicodeToAnsiString(
  2136. LPWSTR pUnicode,
  2137. LPSTR pAnsi,
  2138. DWORD StringLength
  2139. );
  2140. LPWSTR
  2141. AnsiToUnicodeStringWithAlloc(
  2142. LPSTR pAnsi
  2143. );
  2144. VOID
  2145. FreeIniSpoolerOtherNames(
  2146. PINISPOOLER pIniSpooler
  2147. );
  2148. VOID
  2149. FreeIniMonitor(
  2150. PINIMONITOR pIniMonitor
  2151. );
  2152. DWORD
  2153. RestartJob(
  2154. PINIJOB pIniJob
  2155. );
  2156. BOOL
  2157. IsCallViaRPC(
  2158. IN VOID
  2159. );
  2160. VOID
  2161. UpdateReferencesToChainedJobs(
  2162. PINISPOOLER pIniSpooler
  2163. );
  2164. BOOL
  2165. PrinterDriverEvent(
  2166. PINIPRINTER pIniPrinter,
  2167. INT PrinterEvent,
  2168. LPARAM lParam
  2169. );
  2170. BOOL
  2171. SetPrinterShareInfo(
  2172. PINIPRINTER pIniPrinter
  2173. );
  2174. VOID
  2175. LinkPortToSpooler(
  2176. PINIPORT pIniPort,
  2177. PINISPOOLER pIniSpooler
  2178. );
  2179. VOID
  2180. DelinkPortFromSpooler(
  2181. PINIPORT pIniPort,
  2182. PINISPOOLER pIniSpooler
  2183. );
  2184. DWORD
  2185. FinalInitAfterRouterInitComplete(
  2186. DWORD dwUpgrade,
  2187. PINISPOOLER pIniSpooler
  2188. );
  2189. VOID
  2190. InstallWebPrnSvc(
  2191. PINISPOOLER pIniSpooler
  2192. );
  2193. void
  2194. WebShare(
  2195. LPWSTR pShareName
  2196. );
  2197. void
  2198. WebUnShare(
  2199. LPWSTR pShareName
  2200. );
  2201. DWORD
  2202. OpenPrinterKey(
  2203. PINIPRINTER pIniPrinter,
  2204. REGSAM samDesired,
  2205. HANDLE *phKey,
  2206. LPCWSTR pKeyName,
  2207. BOOL bOpen
  2208. );
  2209. DWORD
  2210. GetIniDriverAndDirForThisMachine(
  2211. IN PINIPRINTER pIniPrinter,
  2212. OUT LPWSTR pszDriverDir,
  2213. OUT PINIDRIVER *ppIniDriver
  2214. );
  2215. BOOL
  2216. CopyAllFilesAndDeleteOldOnes(
  2217. PINIVERSION pIniVersion,
  2218. PINTERNAL_DRV_FILE pInternalDriverFile,
  2219. DWORD dwFileCount,
  2220. LPWSTR pDestDir,
  2221. DWORD dwFileCopyFlags,
  2222. BOOL bImpersonateOnCreate,
  2223. LPBOOL pbFileMoved,
  2224. BOOL bSameEnvironment,
  2225. BOOL bWin95Environment
  2226. );
  2227. BOOL LocalDriverUnloadComplete(
  2228. LPWSTR pDriverFile);
  2229. VOID PendingDriverUpgrades(
  2230. LPWSTR pDriverFile);
  2231. BOOL
  2232. GenerateDirectoryNamesForCopyFilesKey(
  2233. PSPOOL pSpool,
  2234. HKEY hKey,
  2235. LPWSTR *ppszSourceDir,
  2236. LPWSTR *ppszTargetDir,
  2237. DWORD cbMax
  2238. );
  2239. LPWSTR
  2240. BuildFilesCopiedAsAString(
  2241. PINTERNAL_DRV_FILE pInternalDriverFile,
  2242. DWORD dwCount
  2243. );
  2244. VOID
  2245. SeekPrinterSetEvent(
  2246. PINIJOB pIniJob,
  2247. HANDLE hFile,
  2248. BOOL bEndDoc
  2249. );
  2250. VOID
  2251. SetPortErrorEvent(
  2252. PINIPORT pIniPort
  2253. );
  2254. BOOL
  2255. DeleteIniPrinterDevNode(
  2256. PINIPRINTER pIniPrinter
  2257. );
  2258. VOID
  2259. SplConfigChange(
  2260. );
  2261. BOOL
  2262. DeletePrinterInAllConfigs(
  2263. PINIPRINTER pIniPrinter
  2264. );
  2265. BOOL
  2266. WritePrinterOnlineStatusInCurrentConfig(
  2267. PINIPRINTER pIniPrinter
  2268. );
  2269. BOOL
  2270. IsDsPresent(
  2271. VOID
  2272. );
  2273. PWSTR
  2274. FixDelim(
  2275. PCWSTR pszInBuffer,
  2276. WCHAR wcDelim
  2277. );
  2278. PWSTR
  2279. Array2DelimString(
  2280. PSTRINGS pStringArray,
  2281. WCHAR wcDelim
  2282. );
  2283. PSTRINGS
  2284. ShortNameArray2LongNameArray(
  2285. PSTRINGS pShortNames
  2286. );
  2287. PSTRINGS
  2288. DelimString2Array(
  2289. PCWSTR pszDelimString,
  2290. WCHAR wcDelim
  2291. );
  2292. BOOL
  2293. ValidateXcvHandle(
  2294. PINIXCV pIniXcv
  2295. );
  2296. VOID
  2297. FreeStringArray(
  2298. PSTRINGS pStrings
  2299. );
  2300. PSTRINGS
  2301. AllocStringArray(
  2302. DWORD nStrings
  2303. );
  2304. VOID
  2305. GetRegistryLocation(
  2306. HANDLE hKey,
  2307. LPCWSTR pszPath,
  2308. PHANDLE phKeyOut,
  2309. LPCWSTR *ppszPathOut
  2310. );
  2311. PWSTR
  2312. GetPrinterUrl(
  2313. PSPOOL pSpool
  2314. );
  2315. VOID
  2316. ClearJobError(
  2317. PINIJOB pIniJob
  2318. );
  2319. DWORD
  2320. DeletePrinterSubkey(
  2321. PINIPRINTER pIniPrinter,
  2322. PWSTR pKeyName
  2323. );
  2324. BOOL
  2325. UpdateDriverFileRefCnt(
  2326. PINIENVIRONMENT pIniEnvironment,
  2327. PINIVERSION pIniVersion,
  2328. PINIDRIVER pIniDriver,
  2329. LPCWSTR pDirectory,
  2330. DWORD dwDeleteFlag,
  2331. BOOL bIncrementFlag
  2332. );
  2333. BOOL
  2334. LocalRefreshPrinterChangeNotification(
  2335. HANDLE hPrinter,
  2336. DWORD dwColor,
  2337. PVOID pPrinterNotifyRefresh,
  2338. LPVOID* ppPrinterNotifyInfo
  2339. );
  2340. BOOL
  2341. CopyRegistryKeys(
  2342. HKEY hSourceParentKey,
  2343. LPWSTR szSourceKey,
  2344. HKEY hDestParentKey,
  2345. LPWSTR szDestKey,
  2346. PINISPOOLER pIniSpooler
  2347. );
  2348. BOOL
  2349. CopyPrinters(
  2350. HKEY hSourceParentKey,
  2351. LPWSTR szSourceKey,
  2352. HKEY hDestParentKey,
  2353. LPWSTR szDestKey,
  2354. BOOL bTruncated
  2355. );
  2356. BOOL
  2357. SplDeleteFile(
  2358. LPCTSTR lpFileName
  2359. );
  2360. BOOL
  2361. SplMoveFileEx(
  2362. LPCTSTR lpExistingFileName,
  2363. LPCTSTR lpNewFileName,
  2364. DWORD dwFlags
  2365. );
  2366. BOOL
  2367. IsRunningNTServer (
  2368. LPBOOL pIsServer
  2369. );
  2370. DWORD
  2371. GetDefaultForKMPrintersBlockedPolicy (
  2372. );
  2373. ULONG_PTR
  2374. AlignToRegType(
  2375. IN ULONG_PTR Data,
  2376. IN DWORD RegType
  2377. );
  2378. BOOL
  2379. InternalINFInstallDriver(
  2380. LPDRIVER_INFO_7 pDriverInfo
  2381. );
  2382. DWORD
  2383. GetServerInstallTimeOut(
  2384. );
  2385. DWORD
  2386. ReadOverlapped( HANDLE hFile,
  2387. LPVOID lpBuffer,
  2388. DWORD nNumberOfBytesToRead,
  2389. LPDWORD lpNumberOfBytesRead );
  2390. BOOL
  2391. WriteOverlapped( HANDLE hFile,
  2392. LPVOID lpBuffer,
  2393. DWORD nNumberOfBytesToRead,
  2394. LPDWORD lpNumberOfBytesRead );
  2395. #ifdef _HYDRA_
  2396. DWORD
  2397. GetClientSessionId(
  2398. );
  2399. BOOL
  2400. ShowThisPrinter(
  2401. PINIPRINTER pIniPrinter
  2402. );
  2403. DWORD
  2404. DetermineJobSessionId(
  2405. PSPOOL pSpool
  2406. );
  2407. typedef BOOLEAN
  2408. (*PWINSTATION_SEND_MESSAGEW)(
  2409. HANDLE hServer,
  2410. ULONG LogonId,
  2411. LPWSTR pTitle,
  2412. ULONG TitleLength,
  2413. LPWSTR pMessage,
  2414. ULONG MessageLength,
  2415. ULONG Style,
  2416. ULONG Timeout,
  2417. PULONG pResponse,
  2418. BOOL DoNotWait
  2419. );
  2420. int
  2421. WinStationMessage(
  2422. DWORD SessionId,
  2423. HWND hWnd,
  2424. DWORD Type,
  2425. int CaptionID,
  2426. int TextID,
  2427. ...
  2428. );
  2429. int
  2430. WinStationMessageBox(
  2431. DWORD SessionId,
  2432. HWND hWnd,
  2433. LPCWSTR lpText,
  2434. LPCWSTR lpCaption,
  2435. UINT uType
  2436. );
  2437. BOOL
  2438. InitializeMessageBoxFunction(
  2439. );
  2440. VOID
  2441. LogFatalPortError(
  2442. IN PINISPOOLER pIniSpooler,
  2443. IN PCWSTR pszName
  2444. );
  2445. VOID
  2446. FreeIniEnvironment(
  2447. IN PINIENVIRONMENT pIniEnvironment
  2448. );
  2449. VOID
  2450. DeleteIniVersion(
  2451. IN PINIENVIRONMENT pIniEnvironment,
  2452. IN PINIVERSION pIniVersion
  2453. );
  2454. VOID
  2455. FreeIniDriver(
  2456. IN PINIENVIRONMENT pIniEnvironment,
  2457. IN PINIVERSION pIniVersion,
  2458. IN PINIDRIVER pIniDriver
  2459. );
  2460. VOID
  2461. FreeIniPrintProc(
  2462. IN PINIPRINTPROC pIniPrintProc
  2463. );
  2464. BOOL
  2465. MergeMultiSz(
  2466. IN PCWSTR pszMultiSz1,
  2467. IN DWORD cchMultiSz1,
  2468. IN PCWSTR pszMultiSz2,
  2469. IN DWORD cchMultiSz2,
  2470. OUT PWSTR *ppszMultiSzMerge,
  2471. OUT DWORD *pcchMultiSzMerge OPTIONAL
  2472. );
  2473. VOID
  2474. AddMultiSzNoDuplicates(
  2475. IN PCWSTR pszMultiSzIn,
  2476. IN OUT PWSTR pszNewMultiSz
  2477. );
  2478. DWORD
  2479. GetMultiSZLen(
  2480. IN LPWSTR pMultiSzSrc
  2481. );
  2482. DWORD
  2483. CheckShareSame(
  2484. IN PINIPRINTER pIniPrinter,
  2485. IN SHARE_INFO_502 *pShareInfo502,
  2486. OUT BOOL *pbSame
  2487. );
  2488. #endif
  2489. BOOL
  2490. RetrieveMasqPrinterInfo(
  2491. IN PSPOOL pSpool,
  2492. OUT PRINTER_INFO_2 **ppPrinterInfo
  2493. );
  2494. DWORD
  2495. GetPrinterInfoFromRouter(
  2496. IN HANDLE hMasqPrinter,
  2497. OUT PRINTER_INFO_2 **ppPrinterInfo
  2498. );
  2499. DWORD
  2500. AsyncPopulateMasqPrinterCache(
  2501. IN VOID *ThreadData
  2502. );
  2503. //
  2504. // WMI macros to fill the WMI data struct.
  2505. //
  2506. #define SplWmiCopyEndJobData(WmiData, pIniJob, CreateInfo) \
  2507. { \
  2508. if ((pIniJob)->pDatatype && \
  2509. (_wcsnicmp((pIniJob)->pDatatype, L"TEXT", 4) == 0)) \
  2510. (WmiData)->uJobData.eDataType = eDataTypeTEXT; \
  2511. else if ((pIniJob)->pDatatype && \
  2512. (_wcsnicmp((pIniJob)->pDatatype, L"NT EMF", 6) == 0)) \
  2513. (WmiData)->uJobData.eDataType = eDataTypeEMF; \
  2514. else \
  2515. (WmiData)->uJobData.eDataType = eDataTypeRAW; \
  2516. (WmiData)->uJobData.ulSize = (pIniJob)->Size; \
  2517. (WmiData)->uJobData.ulPages = (pIniJob)->cPagesPrinted; \
  2518. (WmiData)->uJobData.ulPagesPerSide = (pIniJob)->dwJobNumberOfPagesPerSide; \
  2519. (WmiData)->uJobData.sFilesOpened = 0; \
  2520. (WmiData)->uJobData.sFilesOpened += \
  2521. (((CreateInfo) & FP_SHD_CREATED) ? 1 : 0); \
  2522. (WmiData)->uJobData.sFilesOpened += \
  2523. (((CreateInfo) & FP_SPL_WRITER_CREATED) ? 1 : 0); \
  2524. (WmiData)->uJobData.sFilesOpened += \
  2525. (((CreateInfo) & FP_SPL_READER_CREATED) ? 1 : 0); \
  2526. }
  2527. #define SplWmiCopyRenderedData(WmiData, pDevmode) \
  2528. { \
  2529. DWORD dmFields = (pDevmode)->dmFields; \
  2530. if (dmFields | DM_YRESOLUTION) { \
  2531. (WmiData)->uEmfData.sXRes = (pDevmode)->dmPrintQuality; \
  2532. (WmiData)->uEmfData.sYRes = (pDevmode)->dmYResolution; \
  2533. (WmiData)->uEmfData.sQuality = 0; \
  2534. } \
  2535. else if (dmFields | DM_PRINTQUALITY) { \
  2536. (WmiData)->uEmfData.sQuality = (pDevmode)->dmPrintQuality; \
  2537. (WmiData)->uEmfData.sXRes = 0; \
  2538. (WmiData)->uEmfData.sYRes = 0; \
  2539. } \
  2540. else { \
  2541. (WmiData)->uEmfData.sQuality = 0; \
  2542. (WmiData)->uEmfData.sXRes = 0; \
  2543. (WmiData)->uEmfData.sYRes = 0; \
  2544. } \
  2545. (WmiData)->uEmfData.sColor = (dmFields | DM_COLOR \
  2546. ? (pDevmode)->dmColor \
  2547. : 0); \
  2548. (WmiData)->uEmfData.sCopies = (dmFields | DM_COPIES \
  2549. ? (pDevmode)->dmCopies \
  2550. : 0); \
  2551. (WmiData)->uEmfData.sTTOption = (dmFields | DM_TTOPTION \
  2552. ? (pDevmode)->dmTTOption \
  2553. : 0); \
  2554. (WmiData)->uEmfData.ulICMMethod = (dmFields | DM_ICMMETHOD \
  2555. ? (pDevmode)->dmICMMethod \
  2556. : 0); \
  2557. (WmiData)->uEmfData.ulSize = 0;\
  2558. }
  2559. #ifdef __cplusplus
  2560. }
  2561. #endif