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.

105 lines
2.2 KiB

  1. /*****************************************************************************\
  2. * MODULE: configdlg.cxx
  3. *
  4. * The module contains routines for handling the authentication dialog
  5. * for internet priting
  6. *
  7. * Copyright (C) 1996-1998 Microsoft Corporation
  8. *
  9. * History:
  10. * 07/31/98 WeihaiC Created
  11. * 04/10/00 WeihaiC Moved it to client side
  12. *
  13. \*****************************************************************************/
  14. #include "precomp.h"
  15. #include "priv.h"
  16. TDeletePortDlg::TDeletePortDlg (
  17. LPCWSTR pServerName,
  18. HWND hWnd,
  19. LPCWSTR pszPortName):
  20. TXcvDlg (pServerName, hWnd, pszPortName)
  21. {
  22. if (m_bAdmin) {
  23. m_bValid = TRUE;
  24. }
  25. else {
  26. m_dwLE = ERROR_ACCESS_DENIED;
  27. m_bValid = FALSE;
  28. }
  29. }
  30. TDeletePortDlg::~TDeletePortDlg ()
  31. {
  32. }
  33. BOOL
  34. TDeletePortDlg::GetString (
  35. LPWSTR lpszBuf,
  36. DWORD dwSize,
  37. UINT iStringID)
  38. {
  39. return LoadString(m_hInst, iStringID, lpszBuf, dwSize);
  40. }
  41. BOOL
  42. TDeletePortDlg::PromptDialog (
  43. HINSTANCE hInst)
  44. {
  45. BOOL bRet = TRUE;
  46. m_hInst = hInst;
  47. if (!DoDeletePort ()) {
  48. DisplayLastError (m_hWnd, IDS_DELETE_PORT);
  49. //
  50. // The call actually failed. Since we already displayed the error message
  51. // we need to disable the popup from printui.
  52. //
  53. m_dwLE = ERROR_CANCELLED;
  54. bRet = FALSE;
  55. }
  56. return bRet;
  57. }
  58. BOOL
  59. TDeletePortDlg::DoDeletePort ()
  60. {
  61. DWORD dwStatus;
  62. BOOL bRet = FALSE;
  63. DWORD dwNeeded;
  64. if (XcvData (m_hXcvPort,
  65. INET_XCV_DELETE_PORT,
  66. (PBYTE) m_pszPortName,
  67. sizeof (WCHAR) * (lstrlen (m_pszPortName) + 1),
  68. NULL,
  69. 0,
  70. &dwNeeded,
  71. &dwStatus)) {
  72. if (dwStatus == ERROR_SUCCESS) {
  73. // The port has been deleted.
  74. bRet = TRUE;
  75. }
  76. else
  77. SetLastError (dwStatus);
  78. }
  79. else
  80. //
  81. // The server might be running an old version of inetpp which does not support XcvData
  82. // We need to fail the call
  83. //
  84. SetLastError (ERROR_NOT_SUPPORTED);
  85. return bRet;
  86. }