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

📄 main.c

📁 PGP8.0源码 请认真阅读您的文件包然后写出其具体功能
💻 C
字号:
/*__________________________________________________________________________
 Copyright (C) 2002 PGP Corporation
 All rights reserved.
 
 $Id: main.c,v 1.11 2002/08/06 20:10:32 dallen Exp $
__________________________________________________________________________*/
#include "precomp.h"
#include "pgpClientLib.h"

#ifdef _WIN32 
static char szAppName[] = "PGPmail" ;
#else
static char szAppName[] = "PGPtls16" ;
#endif

BOOL PassesAndString(char *szCommand,int *passes,char **szString)
{
	int index;

	*passes=0;
	*szString=NULL;

	/* /w<space>blah */
	if(strlen(szCommand)<=3)
		return FALSE;

	index=3;

	*szString=&(szCommand[index]);

	while(isdigit((int)szCommand[index])&&(szCommand[index]!=0))
	{
		index++;
	}

	if((index!=3)&&(szCommand[index]==' '))
	{
		*szString=&(szCommand[index+1]);
		szCommand[index]=0;
		*passes=atoi(&(szCommand[3]));
	}
	
	if(*szString==NULL)
		return FALSE;

	return TRUE;
}

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
		    LPSTR szCmdLine, int iCmdShow)
{
	MSG         msg ;
	HWND        hwnd ;
	WNDCLASS    wndclass ; 
	int WinHeight;
	HACCEL hAccel;

	g_hinst = hInstance ;

	LoadString (g_hinst, IDS_SZAPP, szApp, sizeof(szApp));

	if(*szCmdLine)
	{
		FILELIST *ListHead;

		if(!PGPscInit(NULL,&PGPsc,&PGPtls,0))
			return TRUE;

		wndclass.style			= 0;
		wndclass.lpfnWndProc	= (WNDPROC)HiddenWndProc;
		wndclass.cbClsExtra		= 0;
		wndclass.cbWndExtra		= 0;
		wndclass.hInstance		= hInstance;
		wndclass.hIcon			= 0;
		wndclass.hCursor		= 0;
		wndclass.hbrBackground	= 0;
		wndclass.lpszMenuName	= 0;
		wndclass.lpszClassName	= "PGPtools_Hidden_Window";

		RegisterClass(&wndclass);

		hwnd = CreateWindow("PGPtools_Hidden_Window", 
					"PGPtools_Hidden_Window", WS_OVERLAPPEDWINDOW, 
					CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
					CW_USEDEFAULT, NULL, NULL, hInstance, NULL );

		ShowWindow(hwnd, SW_HIDE);
		UpdateWindow(hwnd);

		if(strlen(szCmdLine)>3)
		{
			// Free space wipe from command line
			if(!strncmp (szCmdLine, "/w",2))
			{
				BOOL RetVal;
				char *szString;
				int passes;

				if(PassesAndString(szCmdLine,&passes,&szString))
				{
					RetVal=PGPscFreeSpaceWipeCmdLine(hwnd,PGPsc,szString,passes,TRUE);
					PGPscDestroy(hwnd,PGPsc,PGPtls);

					if(RetVal)
						return 0; // SAGE 0 Completed Successfully
				}

				return 6; // SAGE 6 Unsuccessful; error writing to drive
			}

			// Directory wipe from command line
			if(!strncmp (szCmdLine, "/d",2))
			{
				BOOL RetVal;
				FILELIST *fl,*fllast,*flprev,*flindex;
				char *szString;
				int passes;

				if(PassesAndString(szCmdLine,&passes,&szString))
				{
					fl=NULL;
					PGPscAddToFileList(&fl,szString,NULL,NULL);

					// Get rid of last entry (directory itself)
					// We want directory to always stick around 
					// (temp, recycled, etc)
					flindex=fl;
					fllast=flprev=NULL;

					while(flindex!=NULL)
					{
						flprev=fllast;
						fllast=flindex;
						flindex=flindex->next;
					}

					if(flprev==NULL)
					{
						fl=NULL;
					}
					else
					{
						flprev->next=NULL;
					}

					if(fllast!=NULL)
					{
						PGPscFreeFileList(fllast);
					}
					// end rid of last entry

					if(fl!=NULL)
					{
						RetVal=PGPscWipeFileList(hwnd,PGPsc,fl,WIPE_DONOTWARN|WIPE_DONOTERROR,passes);
					}

					PGPscDestroy(hwnd,PGPsc,PGPtls);

					if(RetVal)
						return 0; // SAGE 0 Completed Successfully
				}

				return 6; // SAGE 6 Unsuccessful; error writing to drive
			}
		}

		ListHead=PGPscCmdLineToFileList(szCmdLine);

		PGPscDecryptFileList(hwnd,szApp,PGPsc,PGPtls,ListHead);

		PGPscDestroy(hwnd,PGPsc,PGPtls);
		return TRUE;
	}
 
	if(PGPscWindowExists(szAppName,TRUE)) 
		return TRUE;
    
	if(!PGPscInit(NULL,&PGPsc,&PGPtls,
			kPGPclEnableNewUserWizard | kPGPclForceNewUserWizard))
	{
		return TRUE;
	}

	PGPscInitDirectory();	// Change to a better directory than
							// install for file operations

	wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
	wndclass.lpfnWndProc   = (WNDPROC) PGPtoolsWndProc ;
	wndclass.cbClsExtra    = 0 ;
	wndclass.cbWndExtra    = 0 ;
	wndclass.hInstance     = hInstance ;
	wndclass.hIcon         = LoadIcon (g_hinst,
								MAKEINTRESOURCE(IDI_TOOLSICO)) ;
	wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
	wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
	wndclass.lpszMenuName  = NULL;//MAKEINTRESOURCE(IDR_PGPTOOLSMENU);
	wndclass.lpszClassName = szAppName ;

	RegisterClass(&wndclass) ;
	
	hAccel=LoadAccelerators(hInstance,MAKEINTRESOURCE(IDR_ACCELERATOR1));

	WinHeight=120;

	hwnd = CreateWindow(  szAppName, szAppName,
                          WS_OVERLAPPED | WS_CAPTION | WS_MINIMIZEBOX | 
						  WS_SIZEBOX| WS_SYSMENU,
	                      CW_USEDEFAULT, CW_USEDEFAULT,
	                      450,       
						  WinHeight,
                          NULL,NULL, hInstance, NULL) ;

	ShowWindow (hwnd, iCmdShow) ;
	UpdateWindow (hwnd); 

	while (GetMessage (&msg, NULL, 0, 0))
	{
		if(!TranslateAccelerator(hwnd,hAccel,&msg))
		{
			if(!IsDialogMessage( hwnd, &msg ))
			{
				TranslateMessage (&msg) ;
				DispatchMessage (&msg) ;
			}
		}
	}
     
	PGPscDestroy(hwnd,PGPsc,PGPtls);

	return msg.wParam ;
}     

/*__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 + -