Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1259 lines
21 KiB

  1. /*++
  2. Copyright (c) 1990-1995 Microsoft Corporation
  3. Module Name:
  4. local.h
  5. Abstract:
  6. Header file for Remote Print Providor
  7. Author:
  8. Dave Snipp (DaveSn) 15-Mar-1991
  9. Revision History:
  10. 16-Jun-1992 JohnRo net print vs. UNICODE.
  11. July 12 1994 Matthew Felton (MattFe) Caching
  12. --*/
  13. #ifndef _WIN32SPLLOCAL_H_
  14. #define _WIN32SPLLOCAL_H_
  15. // ID in the PRINTMAN.HLP file for the Browse Network dialog.
  16. // This must not clash with IDs used in other places.
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #define CALL_LM_OPEN TRUE
  21. #define DO_NOT_CALL_LM_OPEN FALSE
  22. #define GET_SECURITY_DESCRIPTOR 3
  23. #define DO_NOT_USE_SCRATCH_DIR FALSE
  24. #define STRINGS_ARE_EQUAL 0
  25. //
  26. // These define the values we fake out for a GetPrinter level 5 and EnumPrinter
  27. // level 5 for the port Timeouts.
  28. //
  29. enum
  30. {
  31. kDefaultDnsTimeout = 15000,
  32. kDefaultTxTimeout = 45000
  33. };
  34. typedef enum
  35. {
  36. kCheckPnPPolicy,
  37. kDownloadDriver,
  38. kDontDownloadDriver
  39. } EDriverDownload;
  40. #define MAX(a,b) ((a) > (b) ? (a) : (b))
  41. #define MIN(a,b) ((a) < (b) ? (a) : (b))
  42. extern HANDLE hInst;
  43. extern CRITICAL_SECTION SpoolerSection;
  44. extern WCHAR *szRegistryPath;
  45. extern WCHAR *szRegistryPortNames;
  46. extern PWCHAR pszRaw;
  47. extern HANDLE hNetApi;
  48. extern NET_API_STATUS (*pfnNetServerEnum)();
  49. extern NET_API_STATUS (*pfnNetWkstaUserGetInfo)();
  50. extern NET_API_STATUS (*pfnNetApiBufferFree)();
  51. extern WCHAR szPrintProvidorName[];
  52. extern WCHAR szPrintProvidorDescription[];
  53. extern WCHAR szPrintProvidorComment[];
  54. extern WCHAR *szLoggedOnDomain;
  55. extern WCHAR *szRegistryConnections;
  56. extern WCHAR szRegistryWin32Root[];
  57. extern WCHAR szOldLocationOfServersKey[];
  58. extern const WCHAR gszRegistryPrinterPolicies[];
  59. extern PWCHAR szWin32SplDirectory;
  60. extern PWINIPORT pIniFirstPort;
  61. extern PWSPOOL pFirstWSpool;
  62. extern WCHAR szMachineName[];
  63. extern PWCHAR pszMonitorName;
  64. extern PWCHAR gpSystemDir;
  65. extern PWCHAR gpWin32SplDir;
  66. extern const WCHAR gszOpenPrinterThreadLimit[];
  67. extern const WCHAR pszCnvrtdmToken[];
  68. extern const WCHAR pszDrvConvert[];
  69. extern DWORD cThisMajorVersion;
  70. extern DWORD cThisMinorVersion;
  71. extern DWORD gdwThisGetVersion;
  72. extern WCHAR *szVersion;
  73. extern WCHAR *szName;
  74. extern WCHAR *szConfigurationFile;
  75. extern WCHAR *szDataFile;
  76. extern WCHAR *szDriver;
  77. extern WCHAR *szEnvironment;
  78. extern DWORD dwSyncOpenPrinter;
  79. extern UINT cOpenPrinterThreads;
  80. extern const WCHAR gszPointAndPrintPolicies[];
  81. extern const WCHAR gszPointAndPrintRestricted[];
  82. extern const WCHAR gszPointAndPrintInForest[];
  83. extern const WCHAR gszPointAndPrintTrustedServers[];
  84. extern const WCHAR gszPointAndPrintServerList[];
  85. extern BOOL gbMachineInDomain;
  86. extern DWORD dwOpenPrinterThreadTimeOut;
  87. #define IDS_LANMAN_PRINT_SHARE 100
  88. #define IDS_NOTHING_TO_CONFIGURE 101
  89. #define IDS_WINDOWS_NT_REMOTE_PRINTERS 102
  90. #define IDS_MICROSOFT_WINDOWS_NETWORK 103
  91. #define IDS_REMOTE_PRINTERS 104
  92. #define IDS_MONITOR_NAME 105
  93. #define IDS_PORT_NAME 106
  94. #define MAX_PRINTER_INFO0 2*MAX_PATH*sizeof(WCHAR) + sizeof( PRINTER_INFO_STRESSW)
  95. BOOL
  96. MyName(
  97. LPWSTR pName
  98. );
  99. BOOL
  100. MyUNCName(
  101. LPWSTR pName
  102. );
  103. BOOL
  104. Initialize(
  105. VOID
  106. );
  107. VOID
  108. SplInSem(
  109. VOID
  110. );
  111. VOID
  112. SplOutSem(
  113. VOID
  114. );
  115. VOID
  116. EnterSplSem(
  117. VOID
  118. );
  119. VOID
  120. LeaveSplSem(
  121. VOID
  122. );
  123. PWINIPORT
  124. FindPort(
  125. LPWSTR pName,
  126. PWINIPORT pFirstPort
  127. );
  128. BOOL
  129. LMSetJob(
  130. HANDLE hPrinter,
  131. DWORD JobId,
  132. DWORD Level,
  133. LPBYTE pJob,
  134. DWORD Command
  135. );
  136. BOOL
  137. LMGetJob(
  138. HANDLE hPrinter,
  139. DWORD JobId,
  140. DWORD Level,
  141. LPBYTE pJob,
  142. DWORD cbBuf,
  143. LPDWORD pcbNeeded
  144. );
  145. BOOL
  146. LMEnumJobs(
  147. HANDLE hPrinter,
  148. DWORD FirstJob,
  149. DWORD NoJobs,
  150. DWORD Level,
  151. LPBYTE pJob,
  152. DWORD cbBuf,
  153. LPDWORD pcbNeeded,
  154. LPDWORD pcReturned
  155. );
  156. BOOL
  157. LMOpenPrinter(
  158. LPWSTR pPrinterName,
  159. LPHANDLE phPrinter,
  160. LPPRINTER_DEFAULTS pDefault
  161. );
  162. BOOL
  163. LMSetPrinter(
  164. HANDLE hPrinter,
  165. DWORD Level,
  166. LPBYTE pPrinter,
  167. DWORD Command
  168. );
  169. BOOL
  170. LMGetPrinter(
  171. HANDLE hPrinter,
  172. DWORD Level,
  173. LPBYTE pPrinter,
  174. DWORD cbBuf,
  175. LPDWORD pcbNeeded
  176. );
  177. BOOL
  178. LMEnumPorts(
  179. LPWSTR pName,
  180. DWORD Level,
  181. LPBYTE pPorts,
  182. DWORD cbBuf,
  183. LPDWORD pcbNeeded,
  184. LPDWORD pcReturned
  185. );
  186. DWORD
  187. LMStartDocPrinter(
  188. HANDLE hPrinter,
  189. DWORD Level,
  190. LPBYTE pDocInfo
  191. );
  192. BOOL
  193. LMStartPagePrinter(
  194. HANDLE hPrinter
  195. );
  196. BOOL
  197. LMWritePrinter(
  198. HANDLE hPrinter,
  199. LPVOID pBuf,
  200. DWORD cbBuf,
  201. LPDWORD pcWritten
  202. );
  203. BOOL
  204. LMEndPagePrinter(
  205. HANDLE hPrinter
  206. );
  207. BOOL
  208. LMAbortPrinter(
  209. HANDLE hPrinter
  210. );
  211. BOOL
  212. LMReadPrinter(
  213. HANDLE hPrinter,
  214. LPVOID pBuf,
  215. DWORD cbBuf,
  216. LPDWORD pNoBytesRead
  217. );
  218. BOOL
  219. LMEndDocPrinter(
  220. HANDLE hPrinter
  221. );
  222. BOOL
  223. LMAddJob(
  224. HANDLE hPrinter,
  225. DWORD Level,
  226. LPBYTE pData,
  227. DWORD cbBuf,
  228. LPDWORD pcbNeeded
  229. );
  230. BOOL
  231. LMScheduleJob(
  232. HANDLE hPrinter,
  233. DWORD JobId
  234. );
  235. DWORD
  236. LMGetPrinterData(
  237. HANDLE hPrinter,
  238. LPTSTR pValueName,
  239. LPDWORD pType,
  240. LPBYTE pData,
  241. DWORD nSize,
  242. LPDWORD pcbNeeded
  243. );
  244. DWORD
  245. LMSetPrinterData(
  246. HANDLE hPrinter,
  247. LPTSTR pValueName,
  248. DWORD Type,
  249. LPBYTE pData,
  250. DWORD cbData
  251. );
  252. BOOL
  253. LMClosePrinter(
  254. HANDLE hPrinter
  255. );
  256. DWORD
  257. LMWaitForPrinterChange(
  258. HANDLE hPrinter,
  259. DWORD Flags
  260. );
  261. VOID
  262. LMSetSpoolChange(
  263. PWSPOOL pSpool
  264. );
  265. BOOL
  266. LMFindFirstPrinterChangeNotification(
  267. HANDLE hPrinter,
  268. DWORD fdwFlags,
  269. DWORD fdwOptions,
  270. HANDLE hPrinterLocal,
  271. PDWORD pfdwStatus);
  272. BOOL
  273. LMFindClosePrinterChangeNotification(
  274. HANDLE hPrinter);
  275. VOID
  276. LMSetSpoolerChange(
  277. PWSPOOL pSpool);
  278. BOOL
  279. LMDeletePort(
  280. LPWSTR pName,
  281. HWND hWnd,
  282. LPWSTR pPortName
  283. );
  284. BOOL
  285. LMEnumMonitors(
  286. LPWSTR pName,
  287. DWORD Level,
  288. LPBYTE pMonitors,
  289. DWORD cbBuf,
  290. LPDWORD pcbNeeded,
  291. LPDWORD pcReturned
  292. );
  293. PWINIPORT
  294. CreatePortEntry(
  295. LPWSTR pPortName,
  296. PPWINIPORT ppFirstPort
  297. );
  298. BOOL
  299. DeletePortEntry(
  300. LPWSTR pPortName,
  301. PPWINIPORT ppFirstPort
  302. );
  303. DWORD
  304. CreateRegistryEntry(
  305. LPWSTR pPortName
  306. );
  307. HKEY
  308. GetClientUserHandle(
  309. IN REGSAM samDesired
  310. );
  311. DWORD
  312. IsOlderThan(
  313. DWORD i,
  314. DWORD j
  315. );
  316. DWORD
  317. AddEntrytoLMCache(
  318. LPWSTR pServerName,
  319. LPWSTR pShareName
  320. );
  321. DWORD
  322. FindEntryinLMCache(
  323. LPWSTR pServerName,
  324. LPWSTR pShareName
  325. );
  326. VOID
  327. DeleteEntryfromLMCache(
  328. LPWSTR pServerName,
  329. LPWSTR pShareName
  330. );
  331. DWORD
  332. FindEntryinWin32LMCache(
  333. LPWSTR pServerName
  334. );
  335. VOID
  336. DeleteEntryfromWin32LMCache(
  337. LPWSTR pServerName
  338. );
  339. DWORD
  340. AddEntrytoWin32LMCache(
  341. LPWSTR pServerName
  342. );
  343. HANDLE
  344. AddPrinterConnectionToCache(
  345. LPWSTR pName,
  346. HANDLE hPrinter,
  347. LPDRIVER_INFO_2W pDriverInfo
  348. );
  349. VOID
  350. RefreshFormsCache(
  351. PWSPOOL pSpool
  352. );
  353. VOID
  354. RefreshDriverDataCache(
  355. PWSPOOL pSpool
  356. );
  357. VOID
  358. RefreshPrinterDataCache(
  359. PWSPOOL pSpool
  360. );
  361. DWORD
  362. EnumerateAndCopyKey(
  363. PWSPOOL pSpool,
  364. LPWSTR pKeyName
  365. );
  366. BOOL
  367. CacheGetForm(
  368. HANDLE hPrinter,
  369. LPWSTR pFormName,
  370. DWORD Level,
  371. LPBYTE pForm,
  372. DWORD cbBuf,
  373. LPDWORD pcbNeeded
  374. );
  375. BOOL
  376. RemoteGetForm(
  377. HANDLE hPrinter,
  378. LPWSTR pFormName,
  379. DWORD Level,
  380. LPBYTE pForm,
  381. DWORD cbBuf,
  382. LPDWORD pcbNeeded
  383. );
  384. BOOL
  385. CacheEnumForms(
  386. HANDLE hPrinter,
  387. DWORD Level,
  388. LPBYTE pForm,
  389. DWORD cbBuf,
  390. LPDWORD pcbNeeded,
  391. LPDWORD pcReturned
  392. );
  393. BOOL
  394. RemoteEnumForms(
  395. HANDLE hPrinter,
  396. DWORD Level,
  397. LPBYTE pForm,
  398. DWORD cbBuf,
  399. LPDWORD pcbNeeded,
  400. LPDWORD pcReturned
  401. );
  402. DWORD
  403. CacheGetPrinterData(
  404. HANDLE hPrinter,
  405. LPWSTR pValueName,
  406. LPDWORD pType,
  407. LPBYTE pData,
  408. DWORD nSize,
  409. LPDWORD pcbNeeded
  410. );
  411. DWORD
  412. CacheGetPrinterDataEx(
  413. HANDLE hPrinter,
  414. LPCWSTR pKeyName,
  415. LPCWSTR pValueName,
  416. LPDWORD pType,
  417. LPBYTE pData,
  418. DWORD nSize,
  419. LPDWORD pcbNeeded
  420. );
  421. DWORD
  422. RemoteGetPrinterData(
  423. HANDLE hPrinter,
  424. LPWSTR pValueName,
  425. LPDWORD pType,
  426. LPBYTE pData,
  427. DWORD nSize,
  428. LPDWORD pcbNeeded
  429. );
  430. DWORD
  431. RemoteGetPrinterDataEx(
  432. HANDLE hPrinter,
  433. LPCWSTR pKeyName,
  434. LPCWSTR pValueName,
  435. LPDWORD pType,
  436. LPBYTE pData,
  437. DWORD nSize,
  438. LPDWORD pcbNeeded
  439. );
  440. DWORD
  441. RemoteEnumPrinterData(
  442. HANDLE hPrinter,
  443. DWORD dwIndex,
  444. LPWSTR pValueName,
  445. DWORD cbValueName,
  446. LPDWORD pcbValueName,
  447. LPDWORD pType,
  448. LPBYTE pData,
  449. DWORD cbData,
  450. LPDWORD pcbData
  451. );
  452. DWORD
  453. RemoteEnumPrinterDataEx(
  454. HANDLE hPrinter,
  455. LPCWSTR pKeyName,
  456. LPBYTE pEnumValues,
  457. DWORD cbEnumValues,
  458. LPDWORD pcbEnumValues,
  459. LPDWORD pnEnumValues
  460. );
  461. DWORD
  462. CacheEnumPrinterDataEx(
  463. HANDLE hPrinter,
  464. LPCWSTR pKeyName,
  465. LPBYTE pEnumValues,
  466. DWORD cbEnumValues,
  467. LPDWORD pcbEnumValues,
  468. LPDWORD pnEnumValues
  469. );
  470. DWORD
  471. RemoteEnumPrinterKey(
  472. HANDLE hPrinter,
  473. LPCWSTR pKeyName,
  474. LPWSTR pSubkey,
  475. DWORD cbSubkey,
  476. LPDWORD pcbSubkey
  477. );
  478. DWORD
  479. CacheEnumPrinterKey(
  480. HANDLE hPrinter,
  481. LPCWSTR pKeyName,
  482. LPWSTR pSubkey,
  483. DWORD cbSubkey,
  484. LPDWORD pcbSubkey
  485. );
  486. DWORD
  487. RemoteDeletePrinterData(
  488. HANDLE hPrinter,
  489. LPWSTR pValueName
  490. );
  491. DWORD
  492. RemoteDeletePrinterDataEx(
  493. HANDLE hPrinter,
  494. LPCWSTR pKeyName,
  495. LPCWSTR pValueName
  496. );
  497. DWORD
  498. RemoteDeletePrinterKey(
  499. HANDLE hPrinter,
  500. LPCWSTR pKeyName
  501. );
  502. DWORD
  503. RemoteSetPrinterDataEx(
  504. HANDLE hPrinter,
  505. LPCTSTR pKeyName,
  506. LPCTSTR pValueName,
  507. DWORD Type,
  508. LPBYTE pData,
  509. DWORD cbData
  510. );
  511. BOOL
  512. RemoteXcvData(
  513. HANDLE hXcv,
  514. PCWSTR pszDataName,
  515. PBYTE pInputData,
  516. DWORD cbInputData,
  517. PBYTE pOutputData,
  518. DWORD cbOutputData,
  519. PDWORD pcbOutputNeeded,
  520. PDWORD pdwStatus
  521. );
  522. LPWSTR
  523. RemoveBackslashesForRegistryKey(
  524. LPWSTR pSource,
  525. const LPWSTR pScratch
  526. );
  527. LPBYTE
  528. CopyPrinterNameToPrinterInfo(
  529. LPWSTR pServerName,
  530. LPWSTR pPrinterName,
  531. DWORD Level,
  532. LPBYTE pPrinter,
  533. LPBYTE pEnd
  534. );
  535. BOOL
  536. GetPrintSystemVersion(
  537. );
  538. BOOL Win32IsGoingToFile(
  539. HANDLE hPrinter,
  540. LPWSTR pOutputFile
  541. );
  542. LPWSTR
  543. FormatPrinterForRegistryKey(
  544. LPCWSTR pSource, /* The string from which backslashes are to be removed. */
  545. LPWSTR pScratch, /* Scratch buffer for the function to write in; */
  546. DWORD cchScratchLen /* must be at least as long as pSource. */
  547. );
  548. LPWSTR
  549. FormatRegistryKeyForPrinter(
  550. LPWSTR pSource, /* The string from which backslashes are to be added. */
  551. LPWSTR pScratch, /* Scratch buffer for the function to write in; */
  552. DWORD cchScratchLen /* must be at least as long as pSource. */
  553. );
  554. DWORD
  555. InitializePortNames(
  556. );
  557. BOOL
  558. WIN32FindFirstPrinterChangeNotification(
  559. HANDLE hPrinter,
  560. DWORD fdwFlags,
  561. DWORD fdwOptions,
  562. HANDLE hNotify,
  563. PDWORD pfdwStatus,
  564. PVOID pvReserved0,
  565. PVOID pvReserved1);
  566. BOOL
  567. WIN32FindClosePrinterChangeNotification(
  568. HANDLE hPrinter);
  569. /* VALIDATE_NAME macro:
  570. *
  571. * pName is valid if:
  572. *
  573. * pName is non-null
  574. *
  575. * AND first 2 characters of pName are "\\"
  576. *
  577. */
  578. #define VALIDATE_NAME(pName) \
  579. ((pName) && *(pName) == L'\\' && *((pName)+1) == L'\\')
  580. typedef struct _GENERIC_CONTAINER {
  581. DWORD Level;
  582. LPBYTE pData;
  583. } GENERIC_CONTAINER, *PGENERIC_CONTAINER, *LPGENERIC_CONTAINER ;
  584. BOOL
  585. RemoteOpenPrinter(
  586. LPWSTR pPrinterName,
  587. LPHANDLE phPrinter,
  588. LPPRINTER_DEFAULTSW pDefault,
  589. BOOL CallLMOpenPrinter
  590. );
  591. BOOL
  592. RemoteClosePrinter(
  593. HANDLE hPrinter
  594. );
  595. BOOL
  596. RemoteGetPrinterDriverDirectory(
  597. LPWSTR pName,
  598. LPWSTR pEnvironment,
  599. DWORD Level,
  600. LPBYTE pDriverDirectory,
  601. DWORD cbBuf,
  602. LPDWORD pcbNeeded
  603. );
  604. BOOL
  605. RemoteGetPrinterDriver(
  606. HANDLE hPrinter,
  607. LPWSTR pEnvironment,
  608. DWORD Level,
  609. LPBYTE pDriverInfo,
  610. DWORD cbBuf,
  611. LPDWORD pcbNeeded
  612. );
  613. BOOL
  614. CacheGetPrinterDriver(
  615. HANDLE hPrinter,
  616. LPWSTR pEnvironment,
  617. DWORD Level,
  618. LPBYTE pDriverInfo,
  619. DWORD cbBuf,
  620. LPDWORD pcbNeeded
  621. );
  622. BOOL
  623. PrinterConnectionExists(
  624. LPWSTR pPrinterName
  625. );
  626. BOOL
  627. AddPrinterConnectionPrivate(
  628. LPWSTR pName
  629. );
  630. BOOL
  631. CacheOpenPrinter(
  632. LPWSTR pName,
  633. LPHANDLE phPrinter,
  634. LPPRINTER_DEFAULTS pDefault
  635. );
  636. VOID
  637. IncThreadCount(
  638. VOID
  639. );
  640. VOID
  641. DecThreadCount(
  642. VOID
  643. );
  644. BOOL
  645. GetSid(
  646. PHANDLE phToken
  647. );
  648. BOOL
  649. SetCurrentSid(
  650. HANDLE hToken
  651. );
  652. BOOL
  653. DoAsyncRemoteOpenPrinter(
  654. PWSPOOL pSpool,
  655. LPPRINTER_DEFAULTS pDefault
  656. );
  657. DWORD
  658. RemoteOpenPrinterThread(
  659. PWIN32THREAD pThread
  660. );
  661. BOOL
  662. CacheClosePrinter(
  663. HANDLE hPrinter
  664. );
  665. VOID
  666. FreepSpool(
  667. PWSPOOL pSpool
  668. );
  669. BOOL
  670. DoRemoteOpenPrinter(
  671. LPWSTR pPrinterName,
  672. LPPRINTER_DEFAULTS pDefault,
  673. PWSPOOL pSpool
  674. );
  675. PWSPOOL
  676. AllocWSpool(
  677. VOID
  678. );
  679. BOOL
  680. CacheSyncRpcHandle(
  681. PWSPOOL pSpool
  682. );
  683. BOOL
  684. ValidateW32SpoolHandle(
  685. PWSPOOL pSpool
  686. );
  687. #define SYNCRPCHANDLE( pSpool ) if ( !CacheSyncRpcHandle( pSpool ) ) { SplOutSem(); return FALSE; }
  688. #define VALIDATEW32HANDLE( pSpool ) if ( !ValidateW32SpoolHandle( pSpool ) ) return FALSE;
  689. BOOL
  690. CacheResetPrinter(
  691. HANDLE hPrinter,
  692. LPPRINTER_DEFAULTS pDefault
  693. );
  694. BOOL
  695. RemoteResetPrinter(
  696. HANDLE hPrinter,
  697. LPPRINTER_DEFAULTS pDefault
  698. );
  699. BOOL
  700. CopypDefaults(
  701. LPPRINTER_DEFAULTSW pSrc,
  702. LPPRINTER_DEFAULTSW pDest
  703. );
  704. BOOL
  705. CopypDefaultTopSpool(
  706. PWSPOOL pSpool,
  707. LPPRINTER_DEFAULTSW pDefault
  708. );
  709. HANDLE
  710. MySplCreateSpooler(
  711. LPWSTR pMachineName
  712. );
  713. VOID
  714. RefreshCompletePrinterCache(
  715. IN PWSPOOL pSpool,
  716. IN EDriverDownload eDriverDownload
  717. );
  718. VOID
  719. ConvertRemoteInfoToLocalInfo(
  720. PPRINTER_INFO_2 pRemoteInfo
  721. );
  722. VOID
  723. RefreshPrinter(
  724. PWSPOOL pSpool
  725. );
  726. VOID
  727. RefreshPrinterInfo7(
  728. PWSPOOL pSpool
  729. );
  730. BOOL
  731. CacheWritePrinter(
  732. HANDLE hPrinter,
  733. LPVOID pBuf,
  734. DWORD cbBuf,
  735. LPDWORD pcWritten
  736. );
  737. BOOL
  738. RemoteEnumPorts(
  739. LPWSTR pName,
  740. DWORD Level,
  741. LPBYTE pPort,
  742. DWORD cbBuf,
  743. LPDWORD pcbNeeded,
  744. LPDWORD pcReturned
  745. );
  746. BOOL
  747. RemoteAddPort(
  748. LPWSTR pName,
  749. HWND hWnd,
  750. LPWSTR pMonitorName
  751. );
  752. BOOL
  753. RemoteConfigurePort(
  754. LPWSTR pName,
  755. HWND hWnd,
  756. LPWSTR pPortName
  757. );
  758. BOOL
  759. RemoteDeletePort(
  760. LPWSTR pName,
  761. HWND hWnd,
  762. LPWSTR pPortName
  763. );
  764. BOOL
  765. RemoteAddPortEx(
  766. LPWSTR pName,
  767. DWORD Level,
  768. LPBYTE lpBuffer,
  769. LPWSTR lpMonitorName
  770. );
  771. LPBYTE
  772. CopyIniPortToPort(
  773. PWINIPORT pIniPort,
  774. DWORD Level,
  775. LPBYTE pPortInfo,
  776. LPBYTE pEnd
  777. );
  778. DWORD
  779. GetPortSize(
  780. PWINIPORT pIniPort,
  781. DWORD Level
  782. );
  783. BOOL
  784. CacheWriteRegistryExtra(
  785. LPWSTR pName,
  786. HKEY hPrinterKey,
  787. PWCACHEINIPRINTEREXTRA pExtraData
  788. );
  789. PWCACHEINIPRINTEREXTRA
  790. CacheReadRegistryExtra(
  791. HKEY hPrinterKey
  792. );
  793. PWCACHEINIPRINTEREXTRA
  794. AllocExtraData(
  795. PPRINTER_INFO_2W pPrinterInfo2,
  796. DWORD cbPrinterInfo2
  797. );
  798. VOID
  799. CacheFreeExtraData(
  800. PWCACHEINIPRINTEREXTRA pExtraData
  801. );
  802. BOOL
  803. RemoteGetPrinter(
  804. HANDLE hPrinter,
  805. DWORD Level,
  806. LPBYTE pPrinter,
  807. DWORD cbBuf,
  808. LPDWORD pcbNeeded
  809. );
  810. BOOL
  811. CacheGetPrinter(
  812. HANDLE hPrinter,
  813. DWORD Level,
  814. LPBYTE pPrinter,
  815. DWORD cbBuf,
  816. LPDWORD pcbNeeded
  817. );
  818. DWORD
  819. GetCachePrinterInfoSize(
  820. PWCACHEINIPRINTEREXTRA pExtraData
  821. );
  822. VOID
  823. DownAndMarshallUpStructure(
  824. LPBYTE lpStructure,
  825. LPBYTE lpSource,
  826. LPDWORD lpOffsets
  827. );
  828. VOID
  829. CacheCopyPrinterInfo(
  830. PPRINTER_INFO_2W pDestination,
  831. PPRINTER_INFO_2W pPrinterInfo2,
  832. DWORD cbPrinterInfo2
  833. );
  834. HRESULT
  835. ConsistencyCheckCache(
  836. IN PWSPOOL pSpool,
  837. IN EDriverDownload eDriverDownload
  838. );
  839. BOOL
  840. CopyFileWithoutImpersonation(
  841. LPCWSTR lpExistingFileName,
  842. LPCWSTR lpNewFileName,
  843. BOOL bFailIfExists,
  844. BOOL bImpersonateOnCreate
  845. );
  846. BOOL
  847. InternalDeletePrinterConnection(
  848. LPWSTR pName,
  849. BOOL bNotifyDriver
  850. );
  851. BOOL
  852. RefreshPrinterDriver(
  853. IN PWSPOOL pSpool,
  854. IN LPWSTR pszDriverName,
  855. IN EDriverDownload eDriverDownload
  856. );
  857. BOOL
  858. RefreshPrinterCopyFiles(
  859. PWSPOOL pSpool
  860. );
  861. BOOL
  862. OpenCachePrinterOnly(
  863. LPWSTR pName,
  864. LPHANDLE phSplPrinter,
  865. LPHANDLE phIniSpooler,
  866. LPPRINTER_DEFAULTS pDefault,
  867. BOOL bOpenOnly
  868. );
  869. BOOL
  870. RemoteEndDocPrinter(
  871. HANDLE hPrinter
  872. );
  873. BOOL
  874. RemoteAddPrinterDriver(
  875. LPWSTR pName,
  876. DWORD Level,
  877. PBYTE pDriverInfo
  878. );
  879. BOOL
  880. DownloadDriverFiles(
  881. PWSPOOL pSpool,
  882. LPBYTE pDriverInfo,
  883. DWORD dwLevel
  884. );
  885. PWSTR
  886. StripString(
  887. PWSTR pszString,
  888. PCWSTR pszStrip,
  889. PCWSTR pszTerminator
  890. );
  891. BOOL
  892. BuildOtherNamesFromMachineName(
  893. LPWSTR **ppszOtherNames,
  894. DWORD *cOtherNames
  895. );
  896. VOID
  897. FreeOtherNames(
  898. LPWSTR **ppszMyOtherNames,
  899. DWORD *cOtherNames
  900. );
  901. BOOL
  902. CopyDriversLocally(
  903. PWSPOOL pSpool,
  904. LPWSTR pEnvironment,
  905. LPBYTE pDriverInfo,
  906. DWORD dwLevel,
  907. DWORD cbDriverInfo,
  908. LPDWORD pcbNeeded
  909. );
  910. VOID
  911. QueryTrustedDriverInformation(
  912. VOID
  913. );
  914. BOOL
  915. ValidRawDatatype(
  916. LPCWSTR pszDatatype
  917. );
  918. BOOL
  919. DoDevModeConversionAndBuildNewPrinterInfo2(
  920. IN LPPRINTER_INFO_2 pInPrinter2,
  921. IN DWORD dwInSize,
  922. IN OUT LPBYTE pOutBuf,
  923. IN DWORD dwOutSize,
  924. IN OUT LPDWORD pcbNeeded,
  925. IN PWSPOOL pSpool
  926. );
  927. HANDLE
  928. LoadDriverFiletoConvertDevmodeFromPSpool(
  929. HANDLE hSplPrinter
  930. );
  931. DWORD
  932. GetPolicy();
  933. BOOL
  934. AddDriverFromLocalCab(
  935. LPTSTR pszDriverName,
  936. LPHANDLE pIniSpooler
  937. );
  938. BOOL
  939. IsTrustedPathConfigured(
  940. VOID
  941. );
  942. BOOL
  943. IsAdminAccess(
  944. IN PRINTER_DEFAULTS *pDefaults
  945. );
  946. HRESULT
  947. DoesPolicyAllowPrinterConnectionsToServer(
  948. IN PCWSTR pszQueue,
  949. OUT BOOL *pbAllowPointAndPrint
  950. );
  951. HRESULT
  952. AreWeOnADomain(
  953. OUT BOOL *pbDomain
  954. );
  955. HRESULT
  956. GetServerNameFromPrinterName(
  957. IN PCWSTR pszQueue,
  958. OUT PWSTR *ppszServerName
  959. );
  960. HRESULT
  961. IsServerExplicitlyTrusted(
  962. IN HKEY hKeyPolicy,
  963. IN PCWSTR pszServerName,
  964. OUT BOOL *pbServerTrusted
  965. );
  966. HRESULT
  967. IsServerInSameForest(
  968. IN PCWSTR pszServerName,
  969. OUT BOOL *pbServerInSameForest
  970. );
  971. HRESULT
  972. GetDNSNameFromServerName(
  973. IN PCWSTR pszServerName,
  974. OUT PWSTR *ppszFullyQualified
  975. );
  976. HRESULT
  977. UnicodeToAnsiString(
  978. IN PCWSTR pszUnicode,
  979. OUT PSTR *ppszAnsi
  980. );
  981. LPWSTR
  982. AnsiToUnicodeStringWithAlloc(
  983. IN LPSTR pAnsi
  984. );
  985. HRESULT
  986. CheckSamePhysicalAddress(
  987. IN PCWSTR pszServer1,
  988. IN PCWSTR pszServer2,
  989. OUT BOOL *pbSameAddress
  990. );
  991. HRESULT
  992. CheckUserPrintAdmin(
  993. OUT BOOL *pbUserAdmin
  994. );
  995. HRESULT
  996. GetFullyQualifiedDomainName(
  997. IN PCWSTR pszServerName,
  998. OUT PWSTR *ppszFullyQualified
  999. );
  1000. VOID
  1001. WaitAndAcquireRpcHandle(
  1002. IN PWSPOOL pSpool
  1003. );
  1004. //
  1005. // The defines are used for policy install of printer drivers
  1006. // for point and print. Currently the policy is hardcoded to
  1007. // only be SERVER_INF_INSTALL
  1008. //
  1009. #define SERVER_INSTALL_ONLY 1
  1010. #define INF_INSTALL_ONLY 2
  1011. #define SERVER_INF_INSTALL 4
  1012. #define INF_SERVER_INSTALL 8
  1013. //
  1014. // Functions for Open Printer Thread Pool
  1015. //
  1016. HRESULT
  1017. BindThreadToHandle(
  1018. IN PWSPOOL pSpool
  1019. );
  1020. HRESULT
  1021. ReturnThreadFromHandle(
  1022. IN PWSPOOL pSpool
  1023. );
  1024. HRESULT
  1025. BackgroundThreadFinished(
  1026. IN OUT PWIN32THREAD *ppThread,
  1027. IN OUT PWSPOOL pBackgroundHandle
  1028. );
  1029. #ifdef __cplusplus
  1030. }
  1031. #endif
  1032. #endif // _WIN32SPLLOCAL_H_