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

📄 installer.c

📁 PGP8.0源码 请认真阅读您的文件包然后写出其具体功能
💻 C
📖 第 1 页 / 共 5 页
字号:
										h_template, pt_ENV->nid_PgpSubform, 
										pc = pt_ENV->pc_DbClass, NULL))
		return us_err;
	if (us_err = eus_ReplaceDesignNote( h_TARGET, NOTE_CLASS_FORM, 
												mpc_FORMNM_MEMO, h_src, 
												pt_ENV->nid_Memo, pc, NULL))
		return us_err;
	if (us_err = eus_ReplaceDesignNote( h_TARGET, NOTE_CLASS_FORM, 
												mpc_FORMNM_REPLY, h_src, 
												pt_ENV->nid_Reply, pc, NULL))
		return us_err;
	if (us_err = eus_ReplaceDesignNote( h_TARGET, NOTE_CLASS_FORM, 
											mpc_FORMNM_REPLY_WH, h_src, 
											pt_ENV->nid_ReplyWH, pc, NULL))
		return us_err;
	if (pt_ENV->nid_Default)
		us_err = eus_ReplaceDesignNote( h_TARGET, NOTE_CLASS_FORM, 
											mpc_FORMNM_DEFAULT, h_src, 
											pt_ENV->nid_Default, pc, NULL);

	return us_err;
} //us_RefreshMailDb(


/** us_RollBackMailDb( ***
Removes PGP Plug-In components from the specified Notes Mail database and in 
conjunction refreshes the database's e-mail forms (Memo, Reply, Reply With 
History, (Default)) from the Notes Mail template which was specified by the 
user in the uninstall wizard.

--- parameters & return ----
H: handle to the Notes Mail database from which the PGP Plug-In should be 
	removed
pt_ENV: pointer to the information structure describing the installation 
	environment, information about the Notes Mail template in particular
pc_EXTFILENM: Pointer to the extended filename of the Notes Mail database 
	being processed. Only used in non-fatal error logging.
ppc_mereErrLog: Input & Output. Pointer to the non-fatal error log currently 
	underway. Log will be appended to if the design-class name of the mail 
	database being processed does not correspond to the class name of the 
	mail template database.
RETURN:
	eus_SUCCESS if no error occured
	!eus_SUCCESS if obviously invalid parameters were passed in the procedure 
		call
	ERR_MEMORY if an insufficient-memory condition was encountered
	the Notes API error code otherwise

--- revision history -------
9/20/99 PR: created			*/
static STATUS us_RollBackMailDb( DBHANDLE  H, 
									EnvInfo *const  pt_ENV, 
									const char  pc_EXTFILENM[], 
									char * *const  ppc_mereErrLog)	{
	char  pc_class[ NSF_INFO_SIZE];
	DBHANDLE  h_src;
	STATUS  us_err;

	_ASSERTE( H && pt_ENV && pt_ENV->h_template && pt_ENV->nid_Memo && 
								pt_ENV->nid_Reply && pt_ENV->nid_ReplyWH && 
								pc_EXTFILENM && ppc_mereErrLog);

	//if the design class of the mail database does not correspond to the 
	//	class name held by the mail template, log the non-fatal condition and 
	//	short-circuit
	if (us_err = eus_getDbDesignClass( H, pc_class))
		return us_err;
	if (stricmp( pc_class, pt_ENV->pc_DbClass) != ei_SAME)	{
		static const char *const  ppc_PART[] = {"+ The design-class \'", 
									"\' for mail database\n   \'", "\' "
									"differs from the class name\n   \'", 
									"\' of the Notes Mail template \'", "\'."
									"\n   For safety, the PGP Plugin can be "
									"removed only if the\n   database's "
									"design-class name corresponds to the "
									"class\n   name of the mail template."};

		static UINT  ui_lenParts;

		char * pc;
		UINT  ui;

		if (!ui_lenParts)
			ui_lenParts = strlen( ppc_PART[0]) + strlen( ppc_PART[1]) + 
													strlen( ppc_PART[2]) + 
													strlen( ppc_PART[3]) + 
													strlen( ppc_PART[4]) + 1;

		if (!*ppc_mereErrLog)
			if (!f_StartMereErrLog( ppc_mereErrLog))
				return ERR_MEMORY;
		if (!( pc = realloc( *ppc_mereErrLog, (ui = strlen( 
										*ppc_mereErrLog)) + ui_lenParts + 
										strlen( pc_class) + strlen( 
										pc_EXTFILENM) + strlen( 
										pt_ENV->pc_DbClass) + strlen( 
										pt_ENV->pc_extFileNmTemplate))))	{
			free( *ppc_mereErrLog);
			*ppc_mereErrLog = NULL;
			return ERR_MEMORY;
		}
		sprintf( (*ppc_mereErrLog = pc) + ui, "\n%s%s%s%s%s%s%s%s%s", 
								ppc_PART[0], pc_class, ppc_PART[1], 
								pc_EXTFILENM, ppc_PART[2], 
								pt_ENV->pc_DbClass, ppc_PART[3], 
								pt_ENV->pc_extFileNmTemplate, ppc_PART[4]);

		return eus_SUCCESS;
	} //if (stricmp( pc_class, 

	//replace the Reply, Memo, Reply With History and, if needed, (Default) 
	//	forms in the mail database with their counterparts in the mail 
	//	template
	if (us_err = eus_ReplaceDesignNote( H, NOTE_CLASS_FORM, mpc_FORMNM_MEMO, 
												h_src = pt_ENV->h_template, 
												pt_ENV->nid_Memo, NULL, NULL))
		return us_err;
	if (us_err = eus_ReplaceDesignNote( H, NOTE_CLASS_FORM, mpc_FORMNM_REPLY, 
										h_src, pt_ENV->nid_Reply, NULL, NULL))
		return us_err;
	if (us_err = eus_ReplaceDesignNote( H, NOTE_CLASS_FORM, 
											mpc_FORMNM_REPLY_WH, h_src, 
											pt_ENV->nid_ReplyWH, NULL, NULL))
		return us_err;
	if (pt_ENV->nid_Default)
		us_err = eus_ReplaceDesignNote( H, NOTE_CLASS_FORM, 
											mpc_FORMNM_DEFAULT, h_src, 
											pt_ENV->nid_Default, NULL, NULL);

	//remove the PGP Plug-In subform from the mail database
	return eus_RemoveDesignNote( H, NOTE_CLASS_FORM, mpc_SUBFORMNM_PGP);
} //us_RollBackMailDb(


/** f_LoadTextFile( ***


--- parameters & return ----


--- revision history -------
2/6/99 PR: created			*/
//DOC!!
static BOOL f_LoadTextFileEntire( const char  pc_EXTFILENM[], 
								   char * *const  ppc)	{
	FILE * pfl;
	int  i;
	char * pc = NULL;
	BOOL  f_failure;

	_ASSERTE( pc_EXTFILENM && ppc);

	*ppc = NULL;

	if (!( pfl = fopen( pc_EXTFILENM, "rt")))
		return FALSE;

	if (f_failure = (i = filelength( fileno( pfl))) < 0)
		goto errJump;

	if (i)	{
		if (f_failure = !( pc = malloc( i + 1)))
			goto errJump;

		i = fread( pc, 1, i, pfl);
		if (f_failure = ferror( pfl))
			goto errJump;
		pc[ i] = NULL;
	} //if (i)

errJump:
	if (fclose( pfl) == EOF)
		if (!f_failure)
			f_failure = TRUE;

	if (pc)
		if (!f_failure)
			*ppc = pc;
		else 
			free( pc);

	return !f_failure;
} //f_LoadTextFileEntire(


/** f_StartMereErrLog( ***


--- parameters & return ----

RETURN: eus_SUCCESS if no error occured; the Notes API error code otherwise

--- revision history -------
1/24/99 PR: created			*/
//DOC!!
static __inline BOOL f_StartMereErrLog( char * *const  ppc_mereErrLog)	{
	const char  pc_MERE_ERR_LOG_START[] = "The following issues occurred "
												"with respect to the\nPGP "
												"Lotus Notes Plugin:";

	_ASSERTE( ppc_mereErrLog);

	*ppc_mereErrLog = NULL;

	if (!( *ppc_mereErrLog = malloc( sizeof( pc_MERE_ERR_LOG_START))))
		return FALSE;

	strcpy( *ppc_mereErrLog, pc_MERE_ERR_LOG_START);

	return TRUE;
} //f_StartMereErrLog(


/** us_InsertSubformTop( ***


--- parameters & return ----

RETURN: eus_SUCCESS if no error occured; the Notes API error code otherwise

--- revision history -------
3/16/00 PR: adjusted to handle way R5 subform insertion must be done to avoid 
	duplicate actions showing in the user-interface
2/23/00 PR: minor token renaming
1/15/99 PR: created			*/
//DOC!!
static STATUS us_InsertSubformTop( NOTEHANDLE  h_FORM, 
									char  pc_SUBFORMNM[])	{
	const WORD  us_MAX_STYLE_ID = 0xFFFF;

	RtfContext  t_RtfContextForm/*, t_RtfContextSubform*/;
	BOOL  f_found/*, f_SubformRtfContextInitialized = FALSE*/;
	STATUS  us_err;

	_ASSERTE( h_FORM && pc_SUBFORMNM && *pc_SUBFORMNM);

	//if the subform is already included in the form, short-circuit with 
	//	failure
	if (us_err = eus_TestTextListItemHasEntry( h_FORM, SUBFORM_ITEM_NAME, 
													pc_SUBFORMNM, &f_found))
		return us_err;
	if (f_found)
		return !eus_SUCCESS;

	//initialize resources associated with the rich-text handling we're going 
	//	to do with the form
	if (us_err = eus_InitializeRtfContext( h_FORM, ITEM_NAME_TEMPLATE, 
													NULL, &t_RtfContextForm))
		return us_err;

	if (us_err = eus_InsertSubformTop( &t_RtfContextForm, pc_SUBFORMNM))
		goto errJump;

	//commit changes to the form's rich-text field to the form note
	if (us_err = eus_CommitChangedRtf( h_FORM, ITEM_NAME_TEMPLATE, 
														&t_RtfContextForm))
		goto errJump;

	//add the subform name to the form's subforms text-list field
	us_err = NSFItemAppendTextList( h_FORM, SUBFORM_ITEM_NAME, pc_SUBFORMNM, 
										(WORD) strlen( pc_SUBFORMNM), FALSE);

errJump:
	ef_FreeRtfContext( &t_RtfContextForm);

	return us_err;
} //us_InsertSubformTop(


/** us_RefreshPgpTemplate( ***
Replaces the design of the target Domino environment's PGP Plugin Template 
database with the design of the plug-in template residing in the installer.

--- parameters & return ----
h_PGP_TEMPLATE: handle to the PGP Plugin Template already existing in the 
	target Domino environment
pc_EXTFILENM_SRC_PGP_TEMPLATE: pointer to the extended filename of the 
	PGP Plugin Template copied by the installation process to the local 
	system
pc_EXTFILENM_MAIL_TEMPLATE: Pointer to the extended filename of the Notes 
	Mail template on the given server. An item with this parameter's contents 
	is stored on the About Document of the destination PGP Plugin Template 
	in order to provide a default when the refresh button on the document is 
	pressed.
pnid_subform: Output. Pointer to the NoteID structure in which to store the 
	NoteID associated with the PGP Plug-In subform in the production copy of 
	the PGP Plugin Template database.
RETURN: eus_SUCCESS if no error occured; the Notes API error code otherwise

--- revision history -------
9/20/99 PR
+ logic adjustment to utilize common code and to adhere to the recast of the 
  installation routine
+ completed standard documentation

2/6/99 PR: created			*/
static STATUS us_RefreshPgpTemplate( 
									DBHANDLE  h_PGP_TEMPLATE, 
									char  pc_EXTFILENM_SRC_PGP_TEMPLATE[], 
									char  pc_EXTFILENM_MAIL_TEMPLATE[], 
									NOTEID *const  pnid_subform)	{
	DBHANDLE  h_srcTemplate;
	NOTEID  nid_subform, nid_AbtDoc, nid_AbtDocLib;
	STATUS  us_err, us_error;

	_ASSERTE( h_PGP_TEMPLATE && pc_EXTFILENM_SRC_PGP_TEMPLATE && 
																pnid_subform);

	*pnid_subform = NULL;

	//get a handle on the local, source template the install process placed
	if (us_err = eus_OpenTemplate( pc_EXTFILENM_SRC_PGP_TEMPLATE, epc_NULL, 
														&h_srcTemplate, NULL))
		return us_err;

	//prepare the source template's PGP design elements for production use 
	//	(signing them, mainly)
	if (us_err = us_PrepPgpTemplateProductionDesign( h_srcTemplate, FALSE, 
												pc_EXTFILENM_MAIL_TEMPLATE, 
												&nid_subform, &nid_AbtDoc, 
												&nid_AbtDocLib, NULL))
		goto errJump;

	//refresh the About Document, About-Document script library, Icon 
	//	document and PGP Plug-In subform design elements in the target 
	//	template with the elements in the source template brought in by the 
	//	installer
	if (us_err = eus_ReplaceDesignNote( h_PGP_TEMPLATE, NOTE_CLASS_INFO, 
													NULL, h_srcTemplate, 
													nid_AbtDoc, NULL, NULL))
		goto errJump;
	if (us_err = eus_ReplaceDesignNote( h_PGP_TEMPLATE, NOTE_CLASS_ICON, 
												NULL, h_srcTemplate, 
												NULL, (char *) TRUE, NULL))
		goto errJump;
	if (us_err = eus_ReplaceDesignNote( h_PGP_TEMPLATE, NOTE_CLASS_FILTER, 
											mpc_ABT_DOC_LIB, h_srcTemplate, 
											nid_AbtDocLib, NULL, NULL))
		goto errJump;
	us_err = eus_ReplaceDesignNote( h_PGP_TEMPLATE, NOTE_CLASS_FORM, 
											mpc_SUBFORMNM_PGP, h_srcTemplate, 
											nid_subform, NULL, pnid_subform);

errJump:
	if (h_srcTemplate)
		if ((us_error = NSFDbClose( h_srcTemplate)) && !us_err)
			us_err = us_error;

	return us_err;
} //us_RefreshPgpTemplate(


/** us_Pr

⌨️ 快捷键说明

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