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.

110 lines
3.4 KiB

  1. // AddFSPDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ConfigTest.h"
  5. #include "AddFSPDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. typedef unsigned long ULONG_PTR, *PULONG_PTR;
  12. typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
  13. #include "..\..\..\inc\fxsapip.h"
  14. #define USE_EXTENDED_FSPI
  15. #include "..\..\..\inc\faxdev.h"
  16. #include "..\..\..\inc\faxdevex.h"
  17. #include "..\..\inc\efspimp.h"
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CAddFSPDlg dialog
  20. CAddFSPDlg::CAddFSPDlg(HANDLE hFax, CWnd* pParent /*=NULL*/)
  21. : CDialog(CAddFSPDlg::IDD, pParent),
  22. m_hFax (hFax)
  23. {
  24. //{{AFX_DATA_INIT(CAddFSPDlg)
  25. m_cstrFriendlyName = _T("");
  26. m_bAbortParent = FALSE;
  27. m_bAbortRecipient = FALSE;
  28. m_bAutoRetry = FALSE;
  29. m_bBroadcast = FALSE;
  30. m_bMultisend = FALSE;
  31. m_bScheduling = FALSE;
  32. m_bSimultaneousSendRecieve = FALSE;
  33. m_cstrGUID = _T("");
  34. m_cstrImageName = _T("");
  35. m_cstrTSPName = _T("");
  36. m_iVersion = 0;
  37. //}}AFX_DATA_INIT
  38. }
  39. void CAddFSPDlg::DoDataExchange(CDataExchange* pDX)
  40. {
  41. CDialog::DoDataExchange(pDX);
  42. //{{AFX_DATA_MAP(CAddFSPDlg)
  43. DDX_Text(pDX, IDC_FRIENDLY_NAME, m_cstrFriendlyName);
  44. DDX_Check(pDX, IDC_FSPI_CAP_ABORT_PARENT, m_bAbortParent);
  45. DDX_Check(pDX, IDC_FSPI_CAP_ABORT_RECIPIENT, m_bAbortRecipient);
  46. DDX_Check(pDX, IDC_FSPI_CAP_AUTO_RETRY, m_bAutoRetry);
  47. DDX_Check(pDX, IDC_FSPI_CAP_BROADCAST, m_bBroadcast);
  48. DDX_Check(pDX, IDC_FSPI_CAP_MULTISEND, m_bMultisend);
  49. DDX_Check(pDX, IDC_FSPI_CAP_SCHEDULING, m_bScheduling);
  50. DDX_Check(pDX, IDC_FSPI_CAP_SIMULTANEOUS_SEND_RECEIVE, m_bSimultaneousSendRecieve);
  51. DDX_Text(pDX, IDC_GUID, m_cstrGUID);
  52. DDX_Text(pDX, IDC_IMAGENAME, m_cstrImageName);
  53. DDX_Text(pDX, IDC_TSPNAME, m_cstrTSPName);
  54. DDX_Radio(pDX, IDC_VERSION1, m_iVersion);
  55. //}}AFX_DATA_MAP
  56. }
  57. BEGIN_MESSAGE_MAP(CAddFSPDlg, CDialog)
  58. //{{AFX_MSG_MAP(CAddFSPDlg)
  59. ON_BN_CLICKED(IDADD, OnAdd)
  60. //}}AFX_MSG_MAP
  61. END_MESSAGE_MAP()
  62. /////////////////////////////////////////////////////////////////////////////
  63. // CAddFSPDlg message handlers
  64. void CAddFSPDlg::OnAdd()
  65. {
  66. if (!UpdateData ())
  67. {
  68. return;
  69. }
  70. DWORD dwFSPIVersion = m_iVersion ? FSPI_API_VERSION_2 : FSPI_API_VERSION_1;
  71. DWORD dwCapabilities = m_bAbortParent ? FSPI_CAP_ABORT_PARENT : 0 |
  72. m_bAbortRecipient ? FSPI_CAP_ABORT_RECIPIENT : 0 |
  73. m_bAutoRetry ? FSPI_CAP_AUTO_RETRY : 0 |
  74. m_bBroadcast ? FSPI_CAP_BROADCAST : 0 |
  75. m_bMultisend ? FSPI_CAP_MULTISEND : 0 |
  76. m_bScheduling ? FSPI_CAP_SCHEDULING : 0 |
  77. m_bSimultaneousSendRecieve ? FSPI_CAP_SIMULTANEOUS_SEND_RECEIVE : 0;
  78. if (!FaxRegisterServiceProviderEx (
  79. m_hFax,
  80. m_cstrGUID,
  81. m_cstrFriendlyName,
  82. m_cstrImageName,
  83. m_cstrTSPName,
  84. dwFSPIVersion,
  85. dwCapabilities))
  86. {
  87. CString cs;
  88. cs.Format ("Failed while calling FaxRegisterServiceProviderEx (%ld)",
  89. GetLastError ());
  90. AfxMessageBox (cs, MB_OK | MB_ICONHAND);
  91. return;
  92. }
  93. else
  94. {
  95. AfxMessageBox ("FSP successfully added. You need to restart the service for the change to take effect", MB_OK | MB_ICONHAND);
  96. }
  97. }