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

📄 install.c

📁 著名的加密软件的应用于电子邮件中
💻 C
📖 第 1 页 / 共 2 页
字号:
		if(*p1 == '\\')
		{
			*p2 = '\\';
			++p2;
		}
		*p2 = *p1;
		++p2;
		++p1;
	}
	*p2 = '\0';

	printf("Writing temporary reg file...");

	if((ouf = fopen("pgp.reg", "w")))
	{
		fprintf(ouf, "REGEDIT4\n\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\.asc]\n\
   @=\"PGP Armored Encrypted File\"\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\.aexpk]\n\
   @=\"PGP Armored Extracted Public Key\"\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\.bexpk]\n\
   @=\"PGP Binary Extracted Public Key\"\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\.pgp]\n\
   @=\"PGP Encrypted File\"\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\.prvkr]\n\
   @=\"PGP Private Keyring\"\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\.pubkr]\n\
   @=\"PGP Public Keyring\"\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\.sig]\n\
   @=\"PGP Detached Signature File\"\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\.pkr]\n\
   @=\"PGP Public Keyring\"\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\.skr]\n\
   @=\"PGP Private Keyring\"\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\*\\shellex\\ContextMenuHandlers\\PGP Shell Extension]\n\
   @=\"{969223c0-26aa-11d0-90ee-444553540000}\"\n");

		/*
		 * PGP File type handlers
		 */

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\PGP Encrypted File]\n\
   @=\"PGP Encrypted File\"\n\
   \"DefaultIcon\"=\"pgpwctx.dll,-104\"\n\
   \"shell\\open\\command\"=\"%s\\\\pgptray.exe %%1\"\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\PGP Encrypted File\\DefaultIcon]\n\
   @=\"pgpwctx.dll,-104\"\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\PGP Armored Encrypted File]\n\
   @=\"PGP Armored Encrypted File\"\n\
   \"shell\\open\\command\"=\"%s\\\\pgptray.exe %%1\"\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\PGP Armored Encrypted File\\DefaultIcon]\n\
   @=\"pgpwctx.dll,-103\"\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\PGP Armored Extracted Public Key]\n\
   @=\"PGP Armored Extracted Public Key\"\n\
   \"shell\\open\\command\"=\"%s\\\\pgptray.exe %%1\"\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\PGP Armored Extracted Public Key\\DefaultIcon]\n\
   @=\"pgpwctx.dll,-107\"\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\PGP Binary Extracted Public Key]\n\
   @=\"PGP Binary Extracted Public Key\"\n\
   \"shell\\open\\command\"=\"%s\\\\pgptray.exe %%1\"\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\PGP Binary Extracted Public Key\\DefaultIcon]\n\
   @=\"pgpwctx.dll,-107\"\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\PGP Detached Signature File]\n\
   @=\"PGP Detached Signature File\"\n\
   \"shell\\open\\command\"=\"%s\\\\pgptray.exe %%1\"\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\PGP Detached Signature File\\DefaultIcon]\n\
   @=\"pgpwctx.dll,-102\"\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\PGP Private Keyring]\n\
   @=\"PGP Private Keyring\"\n\
   \"shell\\open\\command\"=\"%s\\\\pgptray.exe %%1\"\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\PGP Private Keyring\\DefaultIcon]\n\
   @=\"pgpwctx.dll,-105\"\n");

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\PGP Public Keyring]\n\
   @=\"PGP Public Keyring\"\n\
   \"shell\\open\\command\"=\"%s\\\\pgptray.exe %%1\"\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_CLASSES_ROOT\\PGP Public Keyring\\DefaultIcon]\n\
   @=\"pgpwctx.dll,-106\"\n");

		/*
		 * Current User keys
		 */


		fprintf(ouf, "\
[HKEY_CURRENT_USER\\Software\\PGP\\PGP\\]\n\
   @=\" \"\n\
   \"AutoGet\"=\"0\"\n\
   \"Company Name\"=\"\"\n\
   \"Encode_Flags\"=\"2\"\n\
   \"Port\"=\"11371\"\n\
   \"Serial Number\"=\"\"\n\
   \"Server\"=\"horowitz.surfnet.nl\"\n\
   \"User\"=\"\"\n\
   \"Version\"=\"for Personal Privacy ver. 5.0\"\n");

		fprintf(ouf, "\
[HKEY_CURRENT_USER\\Software\\PGP\\PGP\\PGPkeys\\]\n\
   @=\" \"\n\
   \"ExePath\"=\"%s\\\\PGPkeys.exe\"\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_CURRENT_USER\\Software\\PGP\\PGPlib\\]\n\
   @=\" \"\n\
   \"MailEncryptPGPMIME\"=\"false\"\n\
   \"MailSignPGPMIME\"=\"false\"\n\
   \"PubRing\"=\"%s\\\\pubring.pkr\"\n\
   \"SecRing\"=\"%s\\\\secring.skr\"\n",
   temp_install_dir, temp_install_dir);

		fprintf(ouf, "\
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\");

		fprintf(ouf, "\
{969223c0-26aa-11d0-90ee-444553540000}\\InProcServer32\\]\n\
   @=\"pgpwctx.dll\"\n\
   \"ThreadingModel\"=\"Apartment\"\n");

		fprintf(ouf, "\
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\PGP Armored Encrypted File\\");
		fprintf(ouf, "shell\\open\\command\\]\n\
   @=\"%s\\\\pgptray.exe %%1\"\n", temp_install_dir);

		fprintf(ouf, "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\");
		fprintf(ouf, "PGP Armored Extracted Public Key\\shell\\");
		fprintf(ouf, "open\\command\\]\n\
   @=\"%s\\\\pgptray.exe %%1\"\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\PGP Binary Extracted Public Key\\");
		fprintf(ouf, "shell\\open\\command\\]\n\
   @=\"%s\\\\pgptray.exe %%1\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\PGP Detached Signature File\\");
		fprintf(ouf, "shell\\open\\command\\]\n\
   @=\"%s\\\\pgptray.exe %%1\"\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\PGP Encrypted File\\");
		fprintf(ouf, "shell\\open\\command\\]\n\
   @=\"%s\\\\pgptray.exe %%1\"\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\PGP Private Keyring\\");
		fprintf(ouf, "shell\\open\\command\\]\n\
   @=\"%s\\\\pgptray.exe %%1\"\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\PGP Public Keyring\\");
		fprintf(ouf, "shell\\open\\command\\]\n\
   @=\"%s\\\\pgptray.exe %%1\"\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Exchange\\Client\\Extensions\\]\n");
		fprintf(ouf, "   @\" \"\n\
   \"PGP Plugin\"=\"4.0;pgpExch.dll;1;01000111111100;1001110\"\n");

		fprintf(ouf, "\
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
		fprintf(ouf, "App Paths\\PGPKEYS.EXE\\]\n\
   @=\"%s\\\\PGPKEYS.EXE\"\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
		fprintf(ouf, "App Paths\\PGPKEYS.EXE\\Path]\n\
   @=\"%s\"\n", temp_install_dir);

		fprintf(ouf, "\
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
		fprintf(ouf, "\
Shell Extensions\\Approved\\]\n\
   @=\"pgpwctx.dll\"\n\
   \"{969223c0-26aa-11d0-90ee-444553540000}\"=\"Shell Extension\"\n\
[HKEY_LOCAL_MACHINE\\SOFTWARE\\PGP\\PGP\\PGPkeys\\ExePath]\n\
   @=\"%s\\\\PGPkeys.exe\"\n", temp_install_dir);

		fclose(ouf);

		printf("Complete.\n");

		sei=(SHELLEXECUTEINFO *)malloc(sizeof(SHELLEXECUTEINFO));
		memset(sei,0x00,sizeof(SHELLEXECUTEINFO));

		sei->cbSize=sizeof(SHELLEXECUTEINFO);
		sei->fMask = SEE_MASK_NOCLOSEPROCESS;
		sei->hwnd=NULL;
		sei->lpVerb=NULL;
		sei->lpFile="pgp.reg";
		sei->lpParameters=NULL;
		sei->lpDirectory=NULL;
		sei->nShow=SW_SHOWNORMAL;

		ShellExecuteEx(sei);

		if(sei->hInstApp <= (HINSTANCE) SE_ERR_DLLNOTFOUND)
		{
			if(sei->hInstApp == (HINSTANCE) SE_ERR_NOASSOC ||
			   sei->hInstApp == (HINSTANCE) SE_ERR_ASSOCINCOMPLETE)
			{
				printf("Unable to execute regedit!\n\n");
			}
		}
		else
			printf("Complete!\n\n");

		free(sei);

		printf("PGP 5.0 Installation Complete!\n");
	}
	else
	{
		printf("Unable to write pgp.reg!  Registry keys not added!\n");
	}
}

void create_dir(char *install_dir)
{
	char segment[MAX_PATH], *p, c, sysbuf[1024];

	strcpy(segment, install_dir);

	printf("Creating directory %s:\n", install_dir);

	p = segment;

	while(*p)
	{
		while(*p && *p != '\\')
			++p;

		if(p > segment && *(p -1) != ':')
		{
			c = *p;
			*p = '\0';
			printf("Creating \"%s\"\n", segment);
			sprintf(sysbuf, "mkdir \"%s\"", segment);
			system(sysbuf);
			*p = c;
			if(*p)
				++p;
		}
		else
			++p;
	}
}

⌨️ 快捷键说明

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