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.

112 lines
3.4 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. ccfapi.cpp
  5. Abstract:
  6. Prototype of CCcfApiApp, the MFC application object for CCFAPI32.DLL.
  7. Author:
  8. Jeff Parham (jeffparh) 13-Dec-1995
  9. Revision History:
  10. --*/
  11. #ifndef __AFXWIN_H__
  12. #error include 'stdafx.h' before including this file for PCH
  13. #endif
  14. #include "resource.h" // main symbols
  15. class CCcfApiApp : public CWinApp
  16. {
  17. public:
  18. // constructor
  19. CCcfApiApp();
  20. // error API
  21. void SetLastError( DWORD dwLastError );
  22. DWORD GetLastError();
  23. void SetLastLlsError( NTSTATUS nt );
  24. DWORD GetLastLlsError();
  25. BOOL IsConnectionDropped();
  26. CString GetLastErrorString();
  27. void DisplayLastError();
  28. // help API
  29. LPCTSTR GetHelpFileName();
  30. // CCF API
  31. DWORD CertificateEnter( HWND hWndParent, LPCSTR pszServerName, LPCSTR pszProductName, LPCSTR pszVendor, DWORD dwFlags, LPCSTR pszSourceToUse );
  32. DWORD CertificateRemove( HWND hWndParent, LPCSTR pszServerName, LPCSTR pszProductName, LPCSTR pszVendor, DWORD dwFlags, LPCSTR pszSourceToUse );
  33. // Overrides
  34. // ClassWizard generated virtual function overrides
  35. //{{AFX_VIRTUAL(CCcfApiApp)
  36. //}}AFX_VIRTUAL
  37. //{{AFX_MSG(CCcfApiApp)
  38. // NOTE - the ClassWizard will add and remove member functions here.
  39. // DO NOT EDIT what you see in these blocks of generated code !
  40. //}}AFX_MSG
  41. DECLARE_MESSAGE_MAP()
  42. private:
  43. DWORD m_LastError;
  44. NTSTATUS m_LastLlsError;
  45. CString m_strHelpFileName;
  46. };
  47. // return the name of the CCF UI help file
  48. inline LPCTSTR CCcfApiApp::GetHelpFileName()
  49. { return m_strHelpFileName; }
  50. // set last general error
  51. inline void CCcfApiApp::SetLastError( DWORD dwLastError )
  52. { m_LastError = dwLastError; }
  53. // get last general error
  54. inline DWORD CCcfApiApp::GetLastError()
  55. { return m_LastError; }
  56. // set last license server API error
  57. inline void CCcfApiApp::SetLastLlsError( NTSTATUS nt )
  58. { m_LastLlsError = nt; m_LastError = (DWORD) nt; }
  59. // get last license server API error
  60. inline DWORD CCcfApiApp::GetLastLlsError()
  61. { return m_LastLlsError; }
  62. // did the last license server call fail because of a lack of connectivity?
  63. inline BOOL CCcfApiApp::IsConnectionDropped()
  64. { return ( (m_LastLlsError == STATUS_INVALID_HANDLE) ||
  65. (m_LastLlsError == RPC_NT_SERVER_UNAVAILABLE) ||
  66. (m_LastLlsError == RPC_NT_SS_CONTEXT_MISMATCH) ||
  67. (m_LastLlsError == RPC_S_SERVER_UNAVAILABLE) ||
  68. (m_LastLlsError == RPC_S_CALL_FAILED) ); }
  69. /////////////////////////////////////////////////////////////////////////////
  70. // maximum amount of data to request at a time from license server
  71. #define LLS_PREFERRED_LENGTH ((DWORD)-1L)
  72. extern CCcfApiApp theApp;
  73. extern "C"
  74. {
  75. DWORD APIENTRY NoCertificateEnter( HWND hWnd, LPCSTR pszServerName, LPCSTR pszProductName, LPCSTR pszVendor, DWORD dwFlags );
  76. DWORD APIENTRY NoCertificateRemove( HWND hWnd, LPCSTR pszServerName, DWORD dwFlags, DWORD dwLicenseLevel, LPVOID pvLicenseInfo );
  77. #ifdef OBSOLETE
  78. DWORD APIENTRY PaperCertificateEnter( HWND hWnd, LPCSTR pszServerName, LPCSTR pszProductName, LPCSTR pszVendor, DWORD dwFlags );
  79. DWORD APIENTRY PaperCertificateRemove( HWND hWnd, LPCSTR pszServerName, DWORD dwFlags, DWORD dwLicenseLevel, LPVOID pvLicenseInfo );
  80. #endif // OBSOLETE
  81. }