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.

145 lines
4.2 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. paper.h
  5. Abstract:
  6. Paper certificate dialog prototype.
  7. Author:
  8. Jeff Parham (jeffparh) 13-Dec-1995
  9. Revision History:
  10. --*/
  11. // constrained by number of bits allowed for it in KeyCode (see below)
  12. #define MAX_NUM_LICENSES ( 4095 )
  13. // XOR mask for key code value; this is so that the high bits that are
  14. // usually set for the key code need not be entered -- they only need
  15. // be entered if the high bits are _not_ set
  16. #define KEY_CODE_MASK ( 0xF0000000 )
  17. class CPaperSourceDlg : public CDialog
  18. {
  19. // Construction
  20. public:
  21. CPaperSourceDlg(CWnd* pParent = NULL); // standard constructor
  22. ~CPaperSourceDlg();
  23. DWORD CertificateEnter( LPCSTR pszServerName, LPCSTR pszProductName, LPCSTR pszVendor, DWORD dwFlags );
  24. DWORD CertificateRemove( LPCSTR pszServerName, DWORD dwFlags, PLLS_LICENSE_INFO_1 pLicenseInfo );
  25. BOOL ConnectServer();
  26. BOOL ConnectEnterprise();
  27. NTSTATUS ConnectTo( BOOL bUseEnterprise, CString strServerName, PLLS_HANDLE phLls );
  28. void AbortDialogIfNecessary();
  29. void GetProductList();
  30. DWORD ComputeActivationCode();
  31. NTSTATUS AddLicense();
  32. BOOL m_bProductListRetrieved;
  33. DWORD m_dwEnterFlags;
  34. CString m_strServerName;
  35. LLS_HANDLE m_hLls;
  36. LLS_HANDLE m_hEnterpriseLls;
  37. // KeyCode format:
  38. //
  39. // 31....................................0
  40. // | 2 | 2 | 16 | 12 |
  41. // A B C D
  42. //
  43. // ModesAllowed = A
  44. // Bit field: bit 0 = allow per seat
  45. // bit 1 = allow per server
  46. //
  47. // FlipsAllowed = B
  48. // Bit field: bit 0 = allow flip from per seat
  49. // bit 1 = allow flip from per server
  50. // (THIS IS CURRENTLY UNIMPLEMENTED.)
  51. //
  52. // ExpirationDate = C
  53. // Bit field: bits 0-6 = years since 1980
  54. // bits 7-10 = month (1-12)
  55. // bits 11-15 = day (1-31)
  56. //
  57. // NumLicenses = D
  58. DWORD KeyCodeToNumLicenses( DWORD dwKeyCode );
  59. DWORD KeyCodeToFlipsAllowed( DWORD dwKeyCode );
  60. DWORD KeyCodeToModesAllowed( DWORD dwKeyCode );
  61. DWORD KeyCodeToExpirationDate( DWORD dwKeyCode );
  62. // Dialog Data
  63. //{{AFX_DATA(CPaperSourceDlg)
  64. enum { IDD = IDD_CERT_SOURCE_PAPER };
  65. CSpinButtonCtrl m_spinLicenses;
  66. CComboBox m_cboxProductName;
  67. CString m_strActivationCode;
  68. CString m_strKeyCode;
  69. CString m_strSerialNumber;
  70. CString m_strVendor;
  71. CString m_strProductName;
  72. CString m_strComment;
  73. int m_nDontInstallAllLicenses;
  74. int m_nLicenses;
  75. int m_nLicenseMode;
  76. //}}AFX_DATA
  77. // Overrides
  78. // ClassWizard generated virtual function overrides
  79. //{{AFX_VIRTUAL(CPaperSourceDlg)
  80. public:
  81. virtual void WinHelp(DWORD dwData, UINT nCmd = HELP_CONTEXT);
  82. protected:
  83. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  84. //}}AFX_VIRTUAL
  85. // Implementation
  86. protected:
  87. void EnableOrDisableOK();
  88. // Generated message map functions
  89. //{{AFX_MSG(CPaperSourceDlg)
  90. afx_msg void OnUpdateActivationCode();
  91. afx_msg void OnUpdateKeyCode();
  92. afx_msg void OnUpdateVendor();
  93. virtual BOOL OnInitDialog();
  94. virtual void OnOK();
  95. afx_msg void OnUpdateSerialNumber();
  96. afx_msg void OnUpdateProductName();
  97. afx_msg void OnDropDownProductName();
  98. afx_msg void OnHelp();
  99. afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
  100. afx_msg void OnDestroy();
  101. afx_msg void OnAllLicenses();
  102. afx_msg void OnSomeLicenses();
  103. afx_msg void OnDeltaPosSpinLicenses(NMHDR* pNMHDR, LRESULT* pResult);
  104. //}}AFX_MSG
  105. DECLARE_MESSAGE_MAP()
  106. };
  107. ///////////////////////////////////
  108. inline DWORD CPaperSourceDlg::KeyCodeToNumLicenses( DWORD dwKeyCode )
  109. { return ( dwKeyCode & 0x00000FFF ); }
  110. inline DWORD CPaperSourceDlg::KeyCodeToModesAllowed( DWORD dwKeyCode )
  111. { return ( dwKeyCode >> 30 ); }
  112. inline DWORD CPaperSourceDlg::KeyCodeToFlipsAllowed( DWORD dwKeyCode )
  113. { return ( ( dwKeyCode >> 28 ) & 0x3 ); }