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.

1019 lines
27 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. winfax.cpp
  5. Abstract:
  6. A wrapper DLL that provides old WinFax.dll support from the new (private) DLL
  7. Author:
  8. Eran Yariv (EranY) Jun, 2000
  9. Revision History:
  10. Remarks:
  11. FAXAPI is defined in the sources file as the name of the private DLL to actualy use.
  12. --*/
  13. #define _WINFAX_
  14. #include <winfax.h>
  15. #include <DebugEx.h>
  16. #include <faxutil.h>
  17. #include <tchar.h>
  18. #include <faxreg.h>
  19. #include <FaxUIConstants.h>
  20. extern "C"
  21. DWORD
  22. DllMain(
  23. HINSTANCE hInstance,
  24. DWORD dwReason,
  25. LPVOID lpvContext
  26. )
  27. {
  28. BOOL bRes = TRUE;
  29. DBG_ENTER (TEXT("DllMain"), bRes, TEXT("Reason = %d"), dwReason);
  30. switch (dwReason)
  31. {
  32. case DLL_PROCESS_ATTACH:
  33. DisableThreadLibraryCalls( hInstance );
  34. break;
  35. case DLL_PROCESS_DETACH:
  36. HeapCleanup();
  37. break;
  38. }
  39. return bRes;
  40. }
  41. /****************************************************************************
  42. L e g a c y f u n c t i o n s w r a p p e r s
  43. ****************************************************************************/
  44. extern "C"
  45. BOOL
  46. WINAPI WinFaxAbort(
  47. HANDLE FaxHandle, // handle to the fax server
  48. DWORD JobId // identifier of fax job to terminate
  49. )
  50. {
  51. return FaxAbort (FaxHandle, JobId);
  52. }
  53. extern "C"
  54. BOOL
  55. WINAPI WinFaxAccessCheck(
  56. HANDLE FaxHandle, // handle to the fax server
  57. DWORD AccessMask // set of access level bit flags
  58. )
  59. {
  60. return FaxAccessCheck (FaxHandle, AccessMask);
  61. }
  62. extern "C"
  63. BOOL
  64. WINAPI WinFaxClose(
  65. HANDLE FaxHandle // fax handle to close
  66. )
  67. {
  68. return FaxClose (FaxHandle);
  69. }
  70. extern "C"
  71. BOOL
  72. WINAPI WinFaxCompleteJobParamsA(
  73. PFAX_JOB_PARAMA *JobParams, // pointer to
  74. // job information structure
  75. PFAX_COVERPAGE_INFOA *CoverpageInfo // pointer to
  76. // cover page structure
  77. )
  78. {
  79. return FaxCompleteJobParamsA (JobParams, CoverpageInfo);
  80. }
  81. extern "C"
  82. BOOL
  83. WINAPI WinFaxCompleteJobParamsW(
  84. PFAX_JOB_PARAMW *JobParams, // pointer to
  85. // job information structure
  86. PFAX_COVERPAGE_INFOW *CoverpageInfo // pointer to
  87. // cover page structure
  88. )
  89. {
  90. return FaxCompleteJobParamsW (JobParams, CoverpageInfo);
  91. }
  92. extern "C"
  93. BOOL
  94. WINAPI WinFaxConnectFaxServerA(
  95. LPCSTR MachineName OPTIONAL, // fax server name
  96. LPHANDLE FaxHandle // handle to the fax server
  97. )
  98. {
  99. if (IsLocalMachineNameA (MachineName))
  100. {
  101. //
  102. // Windows 2000 supported only local fax connection.
  103. // Prevent apps that use the Windows 2000 API from connection to remote fax servers.
  104. //
  105. return FaxConnectFaxServerA (MachineName, FaxHandle);
  106. }
  107. else
  108. {
  109. DBG_ENTER (TEXT("WinFaxConnectFaxServerA"), TEXT("MachineName = %s"), MachineName);
  110. SetLastError (ERROR_ACCESS_DENIED);
  111. return FALSE;
  112. }
  113. }
  114. extern "C"
  115. BOOL
  116. WINAPI WinFaxConnectFaxServerW(
  117. LPCWSTR MachineName OPTIONAL, // fax server name
  118. LPHANDLE FaxHandle // handle to the fax server
  119. )
  120. {
  121. if (IsLocalMachineNameW (MachineName))
  122. {
  123. //
  124. // Windows 2000 supported only local fax connection.
  125. // Prevent apps that use the Windows 2000 API from connection to remote fax servers.
  126. //
  127. return FaxConnectFaxServerW (MachineName, FaxHandle);
  128. }
  129. else
  130. {
  131. DBG_ENTER (TEXT("WinFaxConnectFaxServerA"), TEXT("MachineName = %s"), MachineName);
  132. SetLastError (ERROR_ACCESS_DENIED);
  133. return FALSE;
  134. }
  135. }
  136. extern "C"
  137. BOOL
  138. WINAPI WinFaxEnableRoutingMethodA(
  139. HANDLE FaxPortHandle, // fax port handle
  140. LPCSTR RoutingGuid, // GUID that identifies the fax routing method
  141. BOOL Enabled // fax routing method enable/disable flag
  142. )
  143. {
  144. return FaxEnableRoutingMethodA (FaxPortHandle, RoutingGuid, Enabled);
  145. }
  146. extern "C"
  147. BOOL
  148. WINAPI WinFaxEnableRoutingMethodW(
  149. HANDLE FaxPortHandle, // fax port handle
  150. LPCWSTR RoutingGuid, // GUID that identifies the fax routing method
  151. BOOL Enabled // fax routing method enable/disable flag
  152. )
  153. {
  154. return FaxEnableRoutingMethodW (FaxPortHandle, RoutingGuid, Enabled);
  155. }
  156. extern "C"
  157. BOOL
  158. WINAPI WinFaxEnumGlobalRoutingInfoA(
  159. HANDLE FaxHandle, //handle to the fax server
  160. PFAX_GLOBAL_ROUTING_INFOA *RoutingInfo,
  161. //buffer to receive global routing structures
  162. LPDWORD MethodsReturned //number of global routing structures returned
  163. )
  164. {
  165. return FaxEnumGlobalRoutingInfoA (FaxHandle, RoutingInfo, MethodsReturned);
  166. }
  167. extern "C"
  168. BOOL
  169. WINAPI WinFaxEnumGlobalRoutingInfoW(
  170. HANDLE FaxHandle, //handle to the fax server
  171. PFAX_GLOBAL_ROUTING_INFOW *RoutingInfo,
  172. //buffer to receive global routing structures
  173. LPDWORD MethodsReturned //number of global routing structures returned
  174. )
  175. {
  176. return FaxEnumGlobalRoutingInfoW (FaxHandle, RoutingInfo, MethodsReturned);
  177. }
  178. extern "C"
  179. BOOL
  180. WINAPI WinFaxEnumJobsA(
  181. HANDLE FaxHandle, // handle to the fax server
  182. PFAX_JOB_ENTRYA *JobEntry, // buffer to receive array of job data
  183. LPDWORD JobsReturned // number of fax job structures returned
  184. )
  185. {
  186. return FaxEnumJobsA (FaxHandle, JobEntry, JobsReturned);
  187. }
  188. extern "C"
  189. BOOL
  190. WINAPI WinFaxEnumJobsW(
  191. HANDLE FaxHandle, // handle to the fax server
  192. PFAX_JOB_ENTRYW *JobEntry, // buffer to receive array of job data
  193. LPDWORD JobsReturned // number of fax job structures returned
  194. )
  195. {
  196. return FaxEnumJobsW (FaxHandle, JobEntry, JobsReturned);
  197. }
  198. extern "C"
  199. BOOL
  200. WINAPI WinFaxEnumPortsA(
  201. HANDLE FaxHandle, // handle to the fax server
  202. PFAX_PORT_INFOA *PortInfo, // buffer to receive array of port data
  203. LPDWORD PortsReturned // number of fax port structures returned
  204. )
  205. {
  206. return FaxEnumPortsA (FaxHandle, PortInfo, PortsReturned);
  207. }
  208. extern "C"
  209. BOOL
  210. WINAPI WinFaxEnumPortsW(
  211. HANDLE FaxHandle, // handle to the fax server
  212. PFAX_PORT_INFOW *PortInfo, // buffer to receive array of port data
  213. LPDWORD PortsReturned // number of fax port structures returned
  214. )
  215. {
  216. return FaxEnumPortsW (FaxHandle, PortInfo, PortsReturned);
  217. }
  218. extern "C"
  219. BOOL
  220. WINAPI WinFaxEnumRoutingMethodsA(
  221. HANDLE FaxPortHandle, // fax port handle
  222. PFAX_ROUTING_METHODA *RoutingMethod,
  223. // buffer to receive routing method data
  224. LPDWORD MethodsReturned // number of routing method structures returned
  225. )
  226. {
  227. return FaxEnumRoutingMethodsA (FaxPortHandle, RoutingMethod, MethodsReturned);
  228. }
  229. extern "C"
  230. BOOL
  231. WINAPI WinFaxEnumRoutingMethodsW(
  232. HANDLE FaxPortHandle, // fax port handle
  233. PFAX_ROUTING_METHODW *RoutingMethod,
  234. // buffer to receive routing method data
  235. LPDWORD MethodsReturned // number of routing method structures returned
  236. )
  237. {
  238. return FaxEnumRoutingMethodsW (FaxPortHandle, RoutingMethod, MethodsReturned);
  239. }
  240. extern "C"
  241. VOID
  242. WINAPI WinFaxFreeBuffer(
  243. LPVOID Buffer // pointer to buffer to free
  244. )
  245. {
  246. return FaxFreeBuffer (Buffer);
  247. }
  248. extern "C"
  249. BOOL
  250. WINAPI WinFaxGetConfigurationA(
  251. HANDLE FaxHandle, // handle to the fax server
  252. PFAX_CONFIGURATIONA *FaxConfig // structure to receive configuration data
  253. )
  254. {
  255. return FaxGetConfigurationA (FaxHandle, FaxConfig);
  256. }
  257. extern "C"
  258. BOOL
  259. WINAPI WinFaxGetConfigurationW(
  260. HANDLE FaxHandle, // handle to the fax server
  261. PFAX_CONFIGURATIONW *FaxConfig // structure to receive configuration data
  262. )
  263. {
  264. return FaxGetConfigurationW (FaxHandle, FaxConfig);
  265. }
  266. extern "C"
  267. BOOL
  268. WINAPI WinFaxGetDeviceStatusA(
  269. HANDLE FaxPortHandle, // fax port handle
  270. PFAX_DEVICE_STATUSA *DeviceStatus
  271. // structure to receive fax device data
  272. )
  273. {
  274. return FaxGetDeviceStatusA (FaxPortHandle, DeviceStatus);
  275. }
  276. extern "C"
  277. BOOL
  278. WINAPI WinFaxGetDeviceStatusW(
  279. HANDLE FaxPortHandle, // fax port handle
  280. PFAX_DEVICE_STATUSW *DeviceStatus
  281. // structure to receive fax device data
  282. )
  283. {
  284. return FaxGetDeviceStatusW (FaxPortHandle, DeviceStatus);
  285. }
  286. extern "C"
  287. BOOL
  288. WINAPI WinFaxGetJobA(
  289. HANDLE FaxHandle, // handle to the fax server
  290. DWORD JobId, // fax job identifier
  291. PFAX_JOB_ENTRYA *JobEntry // pointer to job data structure
  292. )
  293. {
  294. return FaxGetJobA (FaxHandle, JobId, JobEntry);
  295. }
  296. extern "C"
  297. BOOL
  298. WINAPI WinFaxGetJobW(
  299. HANDLE FaxHandle, // handle to the fax server
  300. DWORD JobId, // fax job identifier
  301. PFAX_JOB_ENTRYW *JobEntry // pointer to job data structure
  302. )
  303. {
  304. return FaxGetJobW (FaxHandle, JobId, JobEntry);
  305. }
  306. extern "C"
  307. BOOL
  308. WINAPI WinFaxGetLoggingCategoriesA(
  309. HANDLE FaxHandle, // handle to the fax server
  310. PFAX_LOG_CATEGORYA *Categories, // buffer to receive category data
  311. LPDWORD NumberCategories // number of logging categories returned
  312. )
  313. {
  314. return FaxGetLoggingCategoriesA (FaxHandle, Categories, NumberCategories);
  315. }
  316. extern "C"
  317. BOOL
  318. WINAPI WinFaxGetLoggingCategoriesW(
  319. HANDLE FaxHandle, // handle to the fax server
  320. PFAX_LOG_CATEGORYW *Categories, // buffer to receive category data
  321. LPDWORD NumberCategories // number of logging categories returned
  322. )
  323. {
  324. return FaxGetLoggingCategoriesW (FaxHandle, Categories, NumberCategories);
  325. }
  326. extern "C"
  327. BOOL
  328. WINAPI WinFaxGetPageData(
  329. HANDLE FaxHandle, // handle to the fax server
  330. DWORD JobId, // fax job identifier
  331. LPBYTE *Buffer, // buffer to receive first page of data
  332. LPDWORD BufferSize, // size of buffer, in bytes
  333. LPDWORD ImageWidth, // page image width, in pixels
  334. LPDWORD ImageHeight // page image height, in pixels
  335. )
  336. {
  337. return FaxGetPageData (FaxHandle, JobId, Buffer, BufferSize, ImageWidth, ImageHeight);
  338. }
  339. extern "C"
  340. BOOL
  341. WINAPI WinFaxGetPortA(
  342. HANDLE FaxPortHandle, // fax port handle
  343. PFAX_PORT_INFOA *PortInfo // structure to receive port data
  344. )
  345. {
  346. return FaxGetPortA (FaxPortHandle, PortInfo);
  347. }
  348. extern "C"
  349. BOOL
  350. WINAPI WinFaxGetPortW(
  351. HANDLE FaxPortHandle, // fax port handle
  352. PFAX_PORT_INFOW *PortInfo // structure to receive port data
  353. )
  354. {
  355. return FaxGetPortW (FaxPortHandle, PortInfo);
  356. }
  357. extern "C"
  358. BOOL
  359. WINAPI WinFaxGetRoutingInfoA(
  360. HANDLE FaxPortHandle, // fax port handle
  361. LPCSTR RoutingGuid, // GUID that identifies fax routing method
  362. LPBYTE *RoutingInfoBuffer,
  363. // buffer to receive routing method data
  364. LPDWORD RoutingInfoBufferSize
  365. // size of buffer, in bytes
  366. )
  367. {
  368. return FaxGetRoutingInfoA (FaxPortHandle, RoutingGuid, RoutingInfoBuffer, RoutingInfoBufferSize);
  369. }
  370. extern "C"
  371. BOOL
  372. WINAPI WinFaxGetRoutingInfoW(
  373. HANDLE FaxPortHandle, // fax port handle
  374. LPCWSTR RoutingGuid, // GUID that identifies fax routing method
  375. LPBYTE *RoutingInfoBuffer,
  376. // buffer to receive routing method data
  377. LPDWORD RoutingInfoBufferSize
  378. // size of buffer, in bytes
  379. )
  380. {
  381. return FaxGetRoutingInfoW (FaxPortHandle, RoutingGuid, RoutingInfoBuffer, RoutingInfoBufferSize);
  382. }
  383. extern "C"
  384. BOOL
  385. WINAPI WinFaxInitializeEventQueue(
  386. HANDLE FaxHandle, // handle to the fax server
  387. HANDLE CompletionPort, // handle to an I/O completion port
  388. ULONG_PTR CompletionKey, // completion key value
  389. HWND hWnd, // handle to the notification window
  390. UINT MessageStart // window message base event number
  391. )
  392. {
  393. return FaxInitializeEventQueue (FaxHandle, CompletionPort, CompletionKey, hWnd, MessageStart);
  394. }
  395. extern "C"
  396. BOOL
  397. WINAPI WinFaxOpenPort(
  398. HANDLE FaxHandle, // handle to the fax server
  399. DWORD DeviceId, // receiving device identifier
  400. DWORD Flags, // set of port access level bit flags
  401. LPHANDLE FaxPortHandle // fax port handle
  402. )
  403. {
  404. return FaxOpenPort (FaxHandle, DeviceId, Flags, FaxPortHandle);
  405. }
  406. extern "C"
  407. BOOL
  408. WINAPI WinFaxPrintCoverPageA(
  409. CONST FAX_CONTEXT_INFOA *FaxContextInfo,
  410. // pointer to device context structure
  411. CONST FAX_COVERPAGE_INFOA *CoverPageInfo
  412. // pointer to local cover page structure
  413. )
  414. {
  415. return FaxPrintCoverPageA (FaxContextInfo, CoverPageInfo);
  416. }
  417. extern "C"
  418. BOOL
  419. WINAPI WinFaxPrintCoverPageW(
  420. CONST FAX_CONTEXT_INFOW *FaxContextInfo,
  421. // pointer to device context structure
  422. CONST FAX_COVERPAGE_INFOW *CoverPageInfo
  423. // pointer to local cover page structure
  424. )
  425. {
  426. return FaxPrintCoverPageW (FaxContextInfo, CoverPageInfo);
  427. }
  428. WINFAXAPI
  429. BOOL
  430. WINAPI
  431. FaxRegisterServiceProviderW (
  432. IN LPCWSTR lpcwstrDeviceProvider,
  433. IN LPCWSTR lpcwstrFriendlyName,
  434. IN LPCWSTR lpcwstrImageName,
  435. IN LPCWSTR lpcwstrTspName
  436. )
  437. {
  438. HKEY hKey = NULL;
  439. HKEY hProviderKey = NULL;
  440. DWORD dwRes;
  441. DWORD Disposition = REG_OPENED_EXISTING_KEY;
  442. DEBUG_FUNCTION_NAME(TEXT("FaxRegisterServiceProviderW"));
  443. if (!lpcwstrDeviceProvider ||
  444. !lpcwstrFriendlyName ||
  445. !lpcwstrImageName ||
  446. !lpcwstrTspName)
  447. {
  448. SetLastError(ERROR_INVALID_PARAMETER);
  449. DebugPrintEx(DEBUG_ERR, _T("At least one of the given strings is NULL."));
  450. return FALSE;
  451. }
  452. if (MAX_FAX_STRING_LEN < _tcslen (lpcwstrFriendlyName) ||
  453. MAX_FAX_STRING_LEN < _tcslen (lpcwstrImageName) ||
  454. MAX_FAX_STRING_LEN < _tcslen (lpcwstrTspName) ||
  455. MAX_FAX_STRING_LEN < _tcslen (lpcwstrDeviceProvider))
  456. {
  457. SetLastError(ERROR_INVALID_PARAMETER);
  458. DebugPrintEx(DEBUG_ERR, _T("At least one of the given strings is too long."));
  459. return FALSE;
  460. }
  461. //
  462. // Try to open the registry key of the providers
  463. //
  464. hKey = OpenRegistryKey(HKEY_LOCAL_MACHINE,
  465. REGKEY_DEVICE_PROVIDER_KEY,
  466. TRUE, // Create if not existing
  467. 0);
  468. if (!hKey)
  469. {
  470. //
  471. // Failed - this is probably not a local call.
  472. //
  473. DebugPrintEx(
  474. DEBUG_ERR,
  475. TEXT("Failed to open providers key (ec = %ld)"),
  476. GetLastError ());
  477. return FALSE;
  478. }
  479. //
  480. // Try to create this FSP's key
  481. //
  482. dwRes = RegCreateKeyEx(
  483. hKey,
  484. lpcwstrDeviceProvider,
  485. 0,
  486. NULL,
  487. 0,
  488. KEY_ALL_ACCESS,
  489. NULL,
  490. &hProviderKey,
  491. &Disposition);
  492. if (ERROR_SUCCESS != dwRes)
  493. {
  494. DebugPrintEx(
  495. DEBUG_ERR,
  496. TEXT("Failed to create provider key (ec = %ld)"),
  497. dwRes);
  498. goto exit;
  499. }
  500. if (REG_OPENED_EXISTING_KEY == Disposition)
  501. {
  502. DebugPrintEx(
  503. DEBUG_ERR,
  504. TEXT("Provider already exist (orovider name: %s)."),
  505. lpcwstrDeviceProvider);
  506. dwRes = ERROR_ALREADY_EXISTS;
  507. goto exit;
  508. }
  509. //
  510. // Write provider's data into the key
  511. //
  512. if (!SetRegistryString (hProviderKey, REGVAL_FRIENDLY_NAME, lpcwstrFriendlyName))
  513. {
  514. dwRes = GetLastError ();
  515. DebugPrintEx(
  516. DEBUG_ERR,
  517. TEXT("Error writing string value (ec = %ld)"),
  518. dwRes);
  519. goto exit;
  520. }
  521. if (!SetRegistryStringExpand (hProviderKey, REGVAL_IMAGE_NAME, lpcwstrImageName))
  522. {
  523. dwRes = GetLastError ();
  524. DebugPrintEx(
  525. DEBUG_ERR,
  526. TEXT("Error writing auto-expand string value (ec = %ld)"),
  527. dwRes);
  528. goto exit;
  529. }
  530. if (!SetRegistryString (hProviderKey, REGVAL_PROVIDER_NAME, lpcwstrTspName))
  531. {
  532. dwRes = GetLastError ();
  533. DebugPrintEx(
  534. DEBUG_ERR,
  535. TEXT("Error writing string value (ec = %ld)"),
  536. dwRes);
  537. goto exit;
  538. }
  539. if (!SetRegistryDword (hProviderKey, REGVAL_PROVIDER_API_VERSION, FSPI_API_VERSION_1))
  540. {
  541. dwRes = GetLastError ();
  542. DebugPrintEx(
  543. DEBUG_ERR,
  544. TEXT("Error writing DWORD value (ec = %ld)"),
  545. dwRes);
  546. goto exit;
  547. }
  548. Assert (ERROR_SUCCESS == dwRes);
  549. //
  550. // Adding an FSP is always local.
  551. // If we don't have a fax printer installed, this is the time to install one.
  552. //
  553. AddOrVerifyLocalFaxPrinter();
  554. exit:
  555. if (hKey)
  556. {
  557. DWORD dw;
  558. if (ERROR_SUCCESS != dwRes &&
  559. REG_OPENED_EXISTING_KEY != Disposition)
  560. {
  561. //
  562. // Delete provider's key on failure, only if it was created now
  563. //
  564. dw = RegDeleteKey (hKey, lpcwstrDeviceProvider);
  565. if (ERROR_SUCCESS != dw)
  566. {
  567. DebugPrintEx(
  568. DEBUG_ERR,
  569. TEXT("Error deleting provider key (ec = %ld)"),
  570. dw);
  571. }
  572. }
  573. dw = RegCloseKey (hKey);
  574. if (ERROR_SUCCESS != dw)
  575. {
  576. DebugPrintEx(
  577. DEBUG_ERR,
  578. TEXT("Error closing providers key (ec = %ld)"),
  579. dw);
  580. }
  581. }
  582. if (hProviderKey)
  583. {
  584. DWORD dw = RegCloseKey (hProviderKey);
  585. if (ERROR_SUCCESS != dw)
  586. {
  587. DebugPrintEx(
  588. DEBUG_ERR,
  589. TEXT("Error closing provider key (ec = %ld)"),
  590. dw);
  591. }
  592. }
  593. if (ERROR_SUCCESS != dwRes)
  594. {
  595. SetLastError (dwRes);
  596. return FALSE;
  597. }
  598. return TRUE;
  599. } // FaxRegisterServiceProviderW
  600. WINFAXAPI
  601. BOOL
  602. WINAPI
  603. FaxUnregisterServiceProviderW (
  604. IN LPCWSTR lpcwstrDeviceProvider
  605. )
  606. {
  607. HKEY hProvidersKey = NULL;
  608. LONG lRes = ERROR_SUCCESS;
  609. LONG lRes2;
  610. DEBUG_FUNCTION_NAME(TEXT("FaxUnregisterServiceProviderW"));
  611. if (!lpcwstrDeviceProvider)
  612. {
  613. SetLastError(ERROR_INVALID_PARAMETER);
  614. DebugPrintEx(DEBUG_ERR, _T("lpcwstrDeviceProvider is NULL."));
  615. return FALSE;
  616. }
  617. //
  618. // Try to open the registry key of the providers
  619. //
  620. hProvidersKey = OpenRegistryKey(
  621. HKEY_LOCAL_MACHINE,
  622. REGKEY_DEVICE_PROVIDER_KEY,
  623. FALSE, // Do not create if not existing
  624. 0);
  625. if (!hProvidersKey)
  626. {
  627. //
  628. // Failed - this is probably not a local call.
  629. //
  630. DebugPrintEx(
  631. DEBUG_ERR,
  632. TEXT("Failed to open providers key (ec = %ld)"),
  633. GetLastError ());
  634. return FALSE;
  635. }
  636. lRes = RegDeleteKey (hProvidersKey, lpcwstrDeviceProvider);
  637. if (ERROR_SUCCESS != lRes)
  638. {
  639. DebugPrintEx(
  640. DEBUG_ERR,
  641. TEXT("Error deleting provider key (ec = %ld)"),
  642. lRes);
  643. }
  644. lRes2 = RegCloseKey (hProvidersKey);
  645. if (ERROR_SUCCESS != lRes2)
  646. {
  647. DebugPrintEx(
  648. DEBUG_ERR,
  649. TEXT("Error closing provider key (ec = %ld)"),
  650. lRes2);
  651. }
  652. if (ERROR_SUCCESS != lRes)
  653. {
  654. SetLastError (lRes);
  655. return FALSE;
  656. }
  657. return TRUE;
  658. } // FaxUnegisterServiceProviderW
  659. extern "C"
  660. BOOL
  661. WINAPI WinFaxRegisterRoutingExtensionW(
  662. HANDLE FaxHandle, // handle to the fax server
  663. LPCWSTR ExtensionName, // fax routing extension DLL name
  664. LPCWSTR FriendlyName, // fax routing extension user-friendly name
  665. LPCWSTR ImageName, // path to fax routing extension DLL
  666. PFAX_ROUTING_INSTALLATION_CALLBACKW CallBack, // pointer to fax
  667. // routing installation callback function
  668. LPVOID Context // pointer to context information
  669. )
  670. {
  671. return FaxRegisterRoutingExtensionW (FaxHandle, ExtensionName, FriendlyName, ImageName, CallBack, Context);
  672. }
  673. extern "C"
  674. BOOL
  675. WINAPI WinFaxSendDocumentA(
  676. HANDLE FaxHandle, // handle to the fax server
  677. LPCSTR FileName, // file with data to transmit
  678. PFAX_JOB_PARAMA JobParams, // pointer to job information structure
  679. CONST FAX_COVERPAGE_INFOA *CoverpageInfo OPTIONAL,
  680. // pointer to local cover page structure
  681. LPDWORD FaxJobId // fax job identifier
  682. )
  683. {
  684. return FaxSendDocumentA (FaxHandle, FileName, JobParams, CoverpageInfo, FaxJobId);
  685. }
  686. extern "C"
  687. BOOL
  688. WINAPI WinFaxSendDocumentW(
  689. HANDLE FaxHandle, // handle to the fax server
  690. LPCWSTR FileName, // file with data to transmit
  691. PFAX_JOB_PARAMW JobParams, // pointer to job information structure
  692. CONST FAX_COVERPAGE_INFOW *CoverpageInfo OPTIONAL,
  693. // pointer to local cover page structure
  694. LPDWORD FaxJobId // fax job identifier
  695. )
  696. {
  697. return FaxSendDocumentW (FaxHandle, FileName, JobParams, CoverpageInfo, FaxJobId);
  698. }
  699. extern "C"
  700. BOOL
  701. WINAPI WinFaxSendDocumentForBroadcastA(
  702. HANDLE FaxHandle, // handle to the fax server
  703. LPCSTR FileName, // fax document file name
  704. LPDWORD FaxJobId, // fax job identifier
  705. PFAX_RECIPIENT_CALLBACKA FaxRecipientCallback,
  706. // pointer to fax recipient callback function
  707. LPVOID Context // pointer to context information
  708. )
  709. {
  710. return FaxSendDocumentForBroadcastA (FaxHandle, FileName, FaxJobId, FaxRecipientCallback, Context);
  711. }
  712. extern "C"
  713. BOOL
  714. WINAPI WinFaxSendDocumentForBroadcastW(
  715. HANDLE FaxHandle, // handle to the fax server
  716. LPCWSTR FileName, // fax document file name
  717. LPDWORD FaxJobId, // fax job identifier
  718. PFAX_RECIPIENT_CALLBACKW FaxRecipientCallback,
  719. // pointer to fax recipient callback function
  720. LPVOID Context // pointer to context information
  721. )
  722. {
  723. return FaxSendDocumentForBroadcastW (FaxHandle, FileName, FaxJobId, FaxRecipientCallback, Context);
  724. }
  725. extern "C"
  726. BOOL
  727. WINAPI WinFaxSetConfigurationA(
  728. HANDLE FaxHandle, // handle to the fax server
  729. CONST FAX_CONFIGURATIONA *FaxConfig // new configuration data
  730. )
  731. {
  732. return FaxSetConfigurationA (FaxHandle, FaxConfig);
  733. }
  734. extern "C"
  735. BOOL
  736. WINAPI WinFaxSetConfigurationW(
  737. HANDLE FaxHandle, // handle to the fax server
  738. CONST FAX_CONFIGURATIONW *FaxConfig // new configuration data
  739. )
  740. {
  741. return FaxSetConfigurationW (FaxHandle, FaxConfig);
  742. }
  743. extern "C"
  744. BOOL
  745. WINAPI WinFaxSetGlobalRoutingInfoA(
  746. HANDLE FaxHandle, //handle to the fax server
  747. CONST FAX_GLOBAL_ROUTING_INFOA *RoutingInfo
  748. //pointer to global routing information structure
  749. )
  750. {
  751. return FaxSetGlobalRoutingInfoA (FaxHandle, RoutingInfo);
  752. }
  753. extern "C"
  754. BOOL
  755. WINAPI WinFaxSetGlobalRoutingInfoW(
  756. HANDLE FaxHandle, //handle to the fax server
  757. CONST FAX_GLOBAL_ROUTING_INFOW *RoutingInfo
  758. //pointer to global routing information structure
  759. )
  760. {
  761. return FaxSetGlobalRoutingInfoW (FaxHandle, RoutingInfo);
  762. }
  763. extern "C"
  764. BOOL
  765. WINAPI WinFaxSetJobA(
  766. HANDLE FaxHandle, // handle to the fax server
  767. DWORD JobId, // fax job identifier
  768. DWORD Command, // job command value
  769. CONST FAX_JOB_ENTRYA *JobEntry
  770. // pointer to job information structure
  771. )
  772. {
  773. return FaxSetJobA (FaxHandle, JobId, Command, JobEntry);
  774. }
  775. extern "C"
  776. BOOL
  777. WINAPI WinFaxSetJobW(
  778. HANDLE FaxHandle, // handle to the fax server
  779. DWORD JobId, // fax job identifier
  780. DWORD Command, // job command value
  781. CONST FAX_JOB_ENTRYW *JobEntry
  782. // pointer to job information structure
  783. )
  784. {
  785. return FaxSetJobW (FaxHandle, JobId, Command, JobEntry);
  786. }
  787. extern "C"
  788. BOOL
  789. WINAPI WinFaxSetLoggingCategoriesA(
  790. HANDLE FaxHandle, // handle to the fax server
  791. CONST FAX_LOG_CATEGORYA *Categories,
  792. // new logging categories data
  793. DWORD NumberCategories // number of category structures
  794. )
  795. {
  796. return FaxSetLoggingCategoriesA (FaxHandle, Categories, NumberCategories);
  797. }
  798. extern "C"
  799. BOOL
  800. WINAPI WinFaxSetLoggingCategoriesW(
  801. HANDLE FaxHandle, // handle to the fax server
  802. CONST FAX_LOG_CATEGORYW *Categories,
  803. // new logging categories data
  804. DWORD NumberCategories // number of category structures
  805. )
  806. {
  807. return FaxSetLoggingCategoriesW (FaxHandle, Categories, NumberCategories);
  808. }
  809. extern "C"
  810. BOOL
  811. WINAPI WinFaxSetPortA(
  812. HANDLE FaxPortHandle, // fax port handle
  813. CONST FAX_PORT_INFOA *PortInfo // new port configuration data
  814. )
  815. {
  816. return FaxSetPortA (FaxPortHandle, PortInfo);
  817. }
  818. extern "C"
  819. BOOL
  820. WINAPI WinFaxSetPortW(
  821. HANDLE FaxPortHandle, // fax port handle
  822. CONST FAX_PORT_INFOW *PortInfo // new port configuration data
  823. )
  824. {
  825. return FaxSetPortW (FaxPortHandle, PortInfo);
  826. }
  827. extern "C"
  828. BOOL
  829. WINAPI WinFaxSetRoutingInfoA(
  830. HANDLE FaxPortHandle, // fax port handle
  831. LPCSTR RoutingGuid, // GUID that identifies fax routing method
  832. CONST BYTE *RoutingInfoBuffer,
  833. // buffer with routing method data
  834. DWORD RoutingInfoBufferSize
  835. // size of buffer, in bytes
  836. )
  837. {
  838. return FaxSetRoutingInfoA (FaxPortHandle, RoutingGuid, RoutingInfoBuffer, RoutingInfoBufferSize);
  839. }
  840. extern "C"
  841. BOOL
  842. WINAPI WinFaxSetRoutingInfoW(
  843. HANDLE FaxPortHandle, // fax port handle
  844. LPCWSTR RoutingGuid, // GUID that identifies fax routing method
  845. CONST BYTE *RoutingInfoBuffer,
  846. // buffer with routing method data
  847. DWORD RoutingInfoBufferSize
  848. // size of buffer, in bytes
  849. )
  850. {
  851. return FaxSetRoutingInfoW (FaxPortHandle, RoutingGuid, RoutingInfoBuffer, RoutingInfoBufferSize);
  852. }
  853. extern "C"
  854. BOOL
  855. WINAPI WinFaxStartPrintJobA(
  856. LPCSTR PrinterName, // printer for fax job
  857. CONST FAX_PRINT_INFOA *PrintInfo,
  858. // print job information structure
  859. LPDWORD FaxJobId, // fax job identifier
  860. PFAX_CONTEXT_INFOA FaxContextInfo
  861. // pointer to device context structure
  862. )
  863. {
  864. return FaxStartPrintJobA (PrinterName, PrintInfo, FaxJobId, FaxContextInfo);
  865. }
  866. extern "C"
  867. BOOL
  868. WINAPI WinFaxStartPrintJobW(
  869. LPCWSTR PrinterName, // printer for fax job
  870. CONST FAX_PRINT_INFOW *PrintInfo,
  871. // print job information structure
  872. LPDWORD FaxJobId, // fax job identifier
  873. PFAX_CONTEXT_INFOW FaxContextInfo
  874. // pointer to device context structure
  875. )
  876. {
  877. return FaxStartPrintJobW (PrinterName, PrintInfo, FaxJobId, FaxContextInfo);
  878. }