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.

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