⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 PGP8.0源码 请认真阅读您的文件包然后写出其具体功能
💻 C
字号:
/*__________________________________________________________________________
 Copyright (C) 2002 PGP Corporation
 All rights reserved.
 
 $Id: main.c,v 1.14 2002/11/13 23:43:55 wjb Exp $
__________________________________________________________________________*/
#include "precomp.h"

HINSTANCE g_hinst;
void *PGPsc = NULL;		// PGP context of current instance
void *PGPtls = NULL;	// TLS context of current instance
PGPKeyDBRef g_KeyDB = NULL;
PGPKeyIterRef g_KeyIter = NULL;
HANDLE hGlobalMutex = NULL;
BOOL g_bDisable=FALSE;
BOOL g_bChecked=FALSE;
DWORD g_nPurgeCacheMsg=0;

__declspec(dllexport) void AttachICQPlugin(HWND hwnd);

BOOL WINAPI DllMain (HINSTANCE hinstDll, 
			DWORD fdwReason,
			LPVOID lpvReserved)
{
 	if (DLL_PROCESS_ATTACH == fdwReason)
		g_hinst=hinstDll;

	return TRUE;
}

__declspec(dllexport) void AttachICQPlugin(HWND hwndRichEdit)
{
	PPLUGININFO plugin;
	char filename[MAX_PATH];
	char szVersion[100];

	if(g_bDisable)
	{
		return;
	}

	if(!g_bChecked)
	{
		g_bChecked=TRUE;

		GetModuleFileName(NULL, filename, MAX_PATH);

		strcpy(szVersion,"Unknown");

		GetVersionOfFile (filename,
			szVersion,
			100);

		if((strcmp(szVersion,"99a Beta"))&&
			(strcmp(szVersion,"99b Beta"))&&
			(strcmp(szVersion,"99b Alpha"))&&
			(strcmp(szVersion,"2000a Beta"))&&
			(strcmp(szVersion,"2000b Alpha"))&&
			(strncmp(szVersion,"ICQ Build 5.0.",14))&& // 5.0.5.3619
			(strncmp(szVersion,"ICQ Build 5.1.",14))&& // 5.1.8.3659 2001b
			(strcmp(szVersion,"2002a Beta")))
		{
			DWORD dwRetries;

			GetRetries(szVersion,&dwRetries);

			if(dwRetries==0xdeadbeef)
			{
				g_bDisable=TRUE;
				return;
			}

			if(dwRetries<2)
			{
				dwRetries++;

				SaveRetries(szVersion,dwRetries);

				if(IDYES==MessageBox(NULL,
					"The PGP ICQ plugin has not been tested with\n"
					"this version of ICQ, would you like to disable\n"
					"the plugin?\n",szVersion,
					MB_YESNO|MB_SETFOREGROUND|MB_ICONSTOP))
				{
					g_bDisable=TRUE;
					SaveRetries(szVersion,0xdeadbeef);
					return;
				}
				else
				{
					if(dwRetries==1)
					{
						MessageBox(NULL,
							"You will be given one more chance to disable\n"
							"the plugin next time you run ICQ in case you\n"
							"find problems.",szVersion,
							MB_OK|MB_SETFOREGROUND|MB_ICONINFORMATION);
					}
				}
			}
		}

		// If first run and ICQ 2000a, also put up no
		// split window support.

		if((!strcmp(szVersion,"99b Alpha"))||
			(!strncmp(szVersion,"2000",4))||
			(!strncmp(szVersion,"2002",4)))
		{
			DWORD dwRetries;

			GetRetries(szVersion,&dwRetries);

			// We work with this, so just set it to one
			// for now and nix it for later with two
			if(dwRetries==0)
			{
				dwRetries=2;
				SaveRetries(szVersion,dwRetries);
				dwRetries=1;
			}

			if(dwRetries==1)
			{
				MessageBox(NULL,
					"The PGPicq plugin does not support sending\n"
					"messages using ICQ's new split message mode\n"
					"window feature. Please use the single message\n"
					"mode window for PGP.\n\n"
					"You can switch between the two by pressing the\n"
					"message mode button at the bottom of the\n"
					"message composition window.",
					szVersion,
					MB_OK|MB_SETFOREGROUND|MB_ICONINFORMATION);
			}
		}
	}

	plugin = CreatePluginInfo(hwndRichEdit);
	
	if (plugin == NULL)
		return;

	// Save away old proc
	SetProp(hwndRichEdit, "oldproc", 
		(HANDLE) GetWindowLong(hwndRichEdit, GWL_WNDPROC)); 

	// Store the pointer to the plugin information
	SavePluginInfo(hwndRichEdit, plugin); 

	SetWindowLong(hwndRichEdit, GWL_WNDPROC, (DWORD) ReceiveWndProc);
	return;
}

/*__Editor_settings____

	Local Variables:
	tab-width: 4
	End:
	vi: ts=4 sw=4
	vim: si
_____________________*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -