clexpire.c
来自「PGP8.0源码 请认真阅读您的文件包然后写出其具体功能」· C语言 代码 · 共 272 行
C
272 行
/*____________________________________________________________________________
Copyright (C) 2002 PGP Corporation
All rights reserved.
CLexpire.c - product timeout routines (from Brett Thomas)
$Id: CLexpire.c,v 1.39 2002/11/18 01:42:30 sdas Exp $
____________________________________________________________________________*/
#include "pgpPFLConfig.h"
// project header files
#include "PGPclx.h"
// system header files
#include <assert.h>
#if PGP_BETA
#ifndef PGP_BETA_DAYS
#error "beta period not defined"
#else
#if !PGP_BETA_DAYS
#error "invalid beta period"
#endif
#endif
#endif
extern HINSTANCE g_hInst;
typedef struct _TIMEOUTSTRUCT
{
CHAR* pszMessageText;
CHAR* pszCaptionText;
} TIMEOUTSTRUCT;
// local globals
static DWORD aTimeoutIds[] = { // Help IDs
IDC_UPGRADE, IDH_PGPCLLIC_EXPIRERENEW,
0,0
};
// ____________________________________
//
// dialog procedure for timeout dialog
static BOOL WINAPI
sTimeoutDlgProc (
HWND hdlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
{
TIMEOUTSTRUCT* ptos;
ptos = (TIMEOUTSTRUCT*)lParam;
SetWindowText (GetDlgItem (hdlg, IDC_MESSAGETEXT), \
ptos->pszMessageText);
SetWindowText (hdlg, ptos->pszCaptionText);
return TRUE;
}
case WM_DESTROY:
{
break;
}
case WM_HELP:
case WM_CONTEXTMENU:
{
return PGPclHtmlHelp (hdlg, uMsg, wParam, lParam,
(char*)kPGPclHelpFile, aTimeoutIds);
}
case WM_QUIT:
case WM_CLOSE:
{
EndDialog (hdlg, FALSE);
break;
}
case WM_COMMAND:
{
switch (wParam)
{
case IDC_UPGRADE:
{
char szWebLink[100];
Sleep (150);
LoadString (g_hInst, IDS_PGPSTORE,
szWebLink, sizeof (szWebLink));
PGPclWebBrowse (szWebLink);
break;
}
case IDCANCEL:
{
EndDialog(hdlg, FALSE);
break;
}
}
return TRUE;
}
}
return FALSE;
}
// ____________________________________
//
// actually display the dialog with supplied strings
static PGPError
sTimeoutDialog (
HWND hwndParent,
CHAR* pszMessage,
CHAR* pszCaption)
{
TIMEOUTSTRUCT tos;
WNDCLASS wndclass;
memset (&wndclass, 0x00, sizeof(WNDCLASS));
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = (WNDPROC)DefDlgProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = DLGWINDOWEXTRA;
wndclass.hInstance = g_hInst;
wndclass.hIcon = LoadIcon (g_hInst, MAKEINTRESOURCE(IDI_KEYICON));
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = "PGPLICENSECLASS";
RegisterClass (&wndclass);
tos.pszMessageText = pszMessage;
tos.pszCaptionText = pszCaption;
DialogBoxParam(g_hInst,
MAKEINTRESOURCE(IDD_LICENSETIMEOUT), hwndParent,
sTimeoutDlgProc, (LPARAM) &tos);
return kPGPError_NoErr;
}
// ____________________________________
//
// display messagebox with appropriate timed-out text
void PGPclExport
PGPclDisplayTimeoutMessage (
HWND hwnd,
BOOL bBeta,
INT iGraceDays,
BOOL bOperation)
{
CHAR szCaption[64];
CHAR szBuf1[512];
CHAR szBuf2[512];
if (bBeta)
{
LoadString (g_hInst,
IDS_BETATIMEOUT, szBuf1, sizeof(szBuf1));
wsprintf (szBuf2, szBuf1, PGP_BETA_DAYS);
sTimeoutDialog (hwnd, szBuf2, "PGP Beta Expiration");
}
else
{
if (bOperation)
{
if (iGraceDays > 0)
{
LoadString (g_hInst,
IDS_OPERATIONGRACED, szBuf1, sizeof(szBuf1));
wsprintf (szBuf2, szBuf1, iGraceDays);
}
else
{
LoadString (g_hInst,
IDS_OPERATIONDISABLED, szBuf2, sizeof(szBuf2));
}
}
else
{
if (iGraceDays > 0)
{
LoadString (g_hInst,
IDS_MODULEGRACEEXPIRED, szBuf1, sizeof(szBuf1));
wsprintf (szBuf2, szBuf1, iGraceDays);
}
else
{
LoadString (g_hInst,
IDS_MODULEEXPIRED, szBuf2, sizeof(szBuf2));
}
}
if (PGPlnEvaluation ())
{
LoadString (g_hInst,
IDS_EVALEXPIRECAPTION, szCaption, sizeof(szCaption));
LoadString (g_hInst,
IDS_EVALEXPIRETEXT, szBuf1, sizeof(szBuf1));
}
else
{
LoadString (g_hInst,
IDS_LICENSEEXPIRECAPTION, szCaption, sizeof(szCaption));
LoadString (g_hInst,
IDS_LICENSEEXPIRETEXT, szBuf1, sizeof(szBuf1));
}
lstrcat (szBuf1, szBuf2);
sTimeoutDialog (hwnd, szBuf1, szCaption);
}
}
// ____________________________________
//
// wrappers for use by the Notes plugin
PGPBoolean PGPclExport
PGPclPGPdesktopEnabled (void)
{
return PGPlnDesktop();
}
PGPBoolean PGPclExport
PGPclPGPmailEnabled (void)
{
return PGPlnPGPmailEnabled ();
}
PGPError PGPclExport
PGPclIsExpired (
HWND hwnd,
PGPclExpType type)
{
return PGPlnIsExpired (hwnd, (PGPlnExpType)type);
}
PGPError PGPclExport
PGPclEvalExpired (
HWND hwnd,
PGPclExpType type)
{
// there is no more PGPlnEvalExpired
return PGPlnIsExpired (hwnd, (PGPlnExpType)type);
}
PGPError PGPclExport
PGPclIsAuthorized (void)
{
return PGPlnIsAuthorized ();
}
PGPError PGPclExport
PGPclEnterprise (void)
{
return PGPlnEnterprise ();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?