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.

108 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. #define MAX_BUF_SIZE 256
  17. TDeletePortDlg::TDeletePortDlg (
  18. LPCWSTR pServerName,
  19. HWND hWnd,
  20. LPCWSTR pszPortName):
  21. TXcvDlg (pServerName, hWnd, pszPortName)
  22. {
  23. if (m_bAdmin) {
  24. m_bValid = TRUE;
  25. }
  26. else {
  27. m_dwLE = ERROR_ACCESS_DENIED;
  28. m_bValid = FALSE;
  29. }
  30. }
  31. TDeletePortDlg::~TDeletePortDlg ()
  32. {
  33. }
  34. BOOL
  35. TDeletePortDlg::GetString (
  36. LPWSTR lpszBuf,
  37. DWORD dwSize,
  38. UINT iStringID)
  39. {
  40. return LoadString(m_hInst, iStringID, lpszBuf, dwSize);
  41. }
  42. BOOL
  43. TDeletePortDlg::PromptDialog (
  44. HINSTANCE hInst)
  45. {
  46. BOOL bRet = TRUE;
  47. m_hInst = hInst;
  48. if (!DoDeletePort ()) {
  49. DisplayLastError (m_hWnd, IDS_DELETE_PORT);
  50. //
  51. // The call actually failed. Since we already displayed the error message
  52. // we need to disable the popup from printui.
  53. //
  54. m_dwLE = ERROR_CANCELLED;
  55. bRet = FALSE;
  56. }
  57. return bRet;
  58. }
  59. BOOL
  60. TDeletePortDlg::DoDeletePort ()
  61. {
  62. static CONST WCHAR cszDeletePort [] = INET_XCV_DELETE_PORT;
  63. DWORD dwStatus;
  64. BOOL bRet = FALSE;
  65. DWORD dwNeeded;
  66. if (XcvData (m_hXcvPort,
  67. cszDeletePort,
  68. (PBYTE) m_pszPortName,
  69. sizeof (WCHAR) * (lstrlen (m_pszPortName) + 1),
  70. NULL,
  71. 0,
  72. &dwNeeded,
  73. &dwStatus)) {
  74. if (dwStatus == ERROR_SUCCESS) {
  75. // The port has been deleted.
  76. bRet = TRUE;
  77. }
  78. else
  79. SetLastError (dwStatus);
  80. }
  81. else
  82. //
  83. // The server might be running an old version of inetpp which does not support XcvData
  84. // We need to fail the call
  85. //
  86. SetLastError (ERROR_NOT_SUPPORTED);
  87. return bRet;
  88. }