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.

235 lines
4.0 KiB

  1. /*****************************************************************************\
  2. * MODULE: inetppui.cxx
  3. *
  4. * The module contains routines for handling the authentication dialog
  5. * for internet priting
  6. *
  7. * Copyright (C) 2000 Microsoft Corporation
  8. *
  9. * History:
  10. * 03/31/00 WeihaiC Created
  11. *
  12. \*****************************************************************************/
  13. #include "precomp.h"
  14. #include "priv.h"
  15. HINSTANCE ghInst = NULL;
  16. #ifndef MODULE
  17. #define MODULE "INETPPUI: "
  18. #endif
  19. #ifdef DEBUG
  20. MODULE_DEBUG_INIT( DBG_ERROR | DBG_WARNING |DBG_TRACE| DBG_INFO , DBG_ERROR );
  21. #else
  22. MODULE_DEBUG_INIT( DBG_ERROR | DBG_WARNING, DBG_ERROR );
  23. #endif
  24. BOOL
  25. AddPortUI(
  26. PCWSTR pszServer,
  27. HWND hWnd,
  28. PCWSTR pszMonitorNameIn,
  29. PWSTR *ppszPortNameOut
  30. )
  31. {
  32. BOOL bRet = FALSE;
  33. DBGMSG (DBG_TRACE, ("Enter AddPortUI\n"));
  34. SetLastError (ERROR_NOT_SUPPORTED);
  35. DBGMSG (DBG_TRACE, ("Leave AddPortUI (Ret=%d)\n", bRet));
  36. return bRet;
  37. }
  38. BOOL
  39. DeletePortUI(
  40. PCWSTR pServerName,
  41. HWND hWnd,
  42. PCWSTR pPortName
  43. )
  44. {
  45. BOOL bRet = FALSE;
  46. DWORD dwLE;
  47. DBGMSG (DBG_TRACE, ("Enter DeletePortUI\n"));
  48. {
  49. TDeletePortDlg Dlg (pServerName, hWnd, pPortName);
  50. if (Dlg.bValid()) {
  51. bRet = Dlg.PromptDialog(ghInst);
  52. if (!bRet) {
  53. dwLE = Dlg.dwLastError ();
  54. }
  55. }
  56. else {
  57. TXcvDlg::DisplayErrorMsg (ghInst, hWnd, IDS_DELETE_PORT, ERROR_DEVICE_REINITIALIZATION_NEEDED);
  58. bRet = TRUE;
  59. }
  60. }
  61. if (!bRet) {
  62. SetLastError (dwLE);
  63. }
  64. DBGMSG (DBG_TRACE, ("Leave DeletePortUI (Ret=%d)\n", bRet));
  65. return bRet;
  66. }
  67. BOOL
  68. ConfigurePortUI(
  69. PCWSTR pServerName,
  70. HWND hWnd,
  71. PCWSTR pPortName
  72. )
  73. {
  74. DBGMSG (DBG_TRACE, ("Enter ConfigurePortUI\n"));
  75. BOOL bRet = FALSE;
  76. DWORD dwLE;
  77. {
  78. TConfigDlg Dlg (pServerName, hWnd, pPortName);
  79. if (Dlg.bValid()) {
  80. bRet = Dlg.PromptDialog(ghInst);
  81. if (!bRet) {
  82. dwLE = Dlg.dwLastError ();
  83. }
  84. }
  85. else {
  86. TXcvDlg::DisplayErrorMsg (ghInst, hWnd, IDS_CONFIG_ERR, ERROR_DEVICE_REINITIALIZATION_NEEDED);
  87. bRet = TRUE;
  88. }
  89. }
  90. if (!bRet) {
  91. SetLastError (dwLE);
  92. }
  93. DBGMSG (DBG_TRACE, ("Leave ConfigurePortUI (Ret=%d)\n", bRet));
  94. return bRet;
  95. }
  96. //
  97. // Common string definitions
  98. //
  99. DWORD LocalMonDebug;
  100. MONITORUI MonitorUI =
  101. {
  102. sizeof(MONITORUI),
  103. AddPortUI,
  104. ConfigurePortUI,
  105. DeletePortUI
  106. };
  107. extern "C" {
  108. BOOL WINAPI
  109. DllMain (
  110. HINSTANCE hModule,
  111. DWORD dwReason,
  112. LPVOID lpRes)
  113. {
  114. INITCOMMONCONTROLSEX icc;
  115. switch (dwReason) {
  116. case DLL_PROCESS_ATTACH:
  117. ghInst = hModule;
  118. //
  119. // Initialize the common controls, needed for fusion applications
  120. // because standard controls were moved to comctl32.dll
  121. //
  122. InitCommonControls();
  123. icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
  124. icc.dwICC = ICC_STANDARD_CLASSES;
  125. InitCommonControlsEx(&icc);
  126. return TRUE;
  127. case DLL_PROCESS_DETACH:
  128. return TRUE;
  129. }
  130. UNREFERENCED_PARAMETER( lpRes );
  131. return TRUE;
  132. }
  133. }
  134. PMONITORUI
  135. InitializePrintMonitorUI(
  136. VOID
  137. )
  138. {
  139. return &MonitorUI;
  140. }
  141. /*****************************************************************************\
  142. *
  143. * These function are for linking with spllib.
  144. *
  145. \*****************************************************************************/
  146. EXTERN_C
  147. LPVOID
  148. DllAllocSplMem(
  149. DWORD cb
  150. )
  151. {
  152. return LocalAlloc(LPTR, cb);
  153. }
  154. EXTERN_C
  155. BOOL
  156. DllFreeSplMem(
  157. LPVOID pMem
  158. )
  159. {
  160. LocalFree(pMem);
  161. return TRUE;
  162. }
  163. EXTERN_C
  164. BOOL
  165. DllFreeSplStr(
  166. LPWSTR lpStr
  167. )
  168. {
  169. LocalFree(lpStr);
  170. return TRUE;
  171. }