📄 installer.c
字号:
if (us_err = NIFFindDesignNote( h_PgpTemplate, mpc_SUBFORMNM_PGP,
NOTE_CLASS_FORM, &nid))
goto errJump;
if (us_err = us_PgpEnableEmailForm( mpc_FORMNM_MEMO, TRUE,
h_MailTemplate,
h_PgpTemplate, FALSE, NULL))
goto errJump;
if (us_err = us_PgpEnableEmailForm( mpc_FORMNM_REPLY, TRUE,
h_MailTemplate,
h_PgpTemplate, FALSE, NULL))
goto errJump;
if (us_err = us_PgpEnableEmailForm( mpc_FORMNM_REPLY_WH, TRUE,
h_MailTemplate,
h_PgpTemplate, FALSE, NULL))
goto errJump;
if (us_err = us_PgpEnableEmailForm( mpc_FORMNM_DEFAULT, FALSE,
h_MailTemplate,
h_PgpTemplate, FALSE, NULL))
goto errJump;
errJump:
if (h_PgpTemplate)
if ((us_error = NSFDbClose( h_PgpTemplate)) && !us_err)
us_err = us_error;
if ((us_error = NSFDbClose( h_MailTemplate)) && !us_err)
us_err = us_error;
return us_err;
} //xus_RefreshPgpTemplateForms(
/** xus_UninstallNotesComponents( ***
Controls the removal of the PGP Notes Plugin according to the instructions
provided by the caller. A complete removal process is two-stage, and the
caller may choose to suppress either of the stages: (1) remove the plug-in
from a specified set of Notes Mail databases and (2) delete the PGP Plugin
Template from the specified Domino server.
--- parameters & return ----
pc_SERVERNM: pointer to the name of the server on which all the Notes Mail
databases reside
pc_EXTFILENM_PGP_TEMPLATE: Optional. Pointer to the extended filename of the
PGP Plugin Template database. Provision of string indicates that caller
wishes to delete the template from the given server. A pass of NULL
indicates that the template should not be removed.
pc_EXTFILENM_MAIL_TEMPLATE: Optional. Pointer to the extended filename of the
Notes Mail template from which the specified PGP-enabled Notes Mail
databases inherit their design. Required only if plug-in components are
to be removed from particular Notes Mail databases.
pc_EXTFILENM_DB_LIST: Optional. Pointer to a string indicating the extended
filename of a text file that contains the list of extended filenames of
the the Notes Mail databases from which the PGP Plug-In should be
removed. The filenames must be delimited by a pipe character or linefeed
character; whitespace surrounding each filename is ignored. A pass of
NULL indicates that any list of Notes Mail databases to be enabled is
provided via the pc_MailDbs parameter.
pc_MailDbs: Optional Input & Undefined Output. Pointer to a string indicating
the extended filenames of the particular Notes Mail databases from which
the plug-in is to be removed. Each filename must be delimited by a pipe
character or linefeed character; whitespace surrounding each filename is
ignored. String will be tokenized and therefore changed in a way not
worth defining (see documentation on standard strtok() function if
understanding is required). Parameter is ignored if the
pc_EXTFILENM_DB_LIST parameter is non-NULL. A pass of NULL indicates that
plug-in components need not be removed from any Notes Mail databases.
RETURN:
eus_SUCCESS if no error occured
mus_EXCEPTION_HANDLED if any Notes API or module-defined error occurs
undefined error code if some sort of subsystem error occurs (memory
depletion, file system access denied, etc.)
--- revision history -------
8/9/00 PR: changed to the __stdcall calling convention to force the function
to clean up the stack itself
9/20/99 PR: created */
STATUS __stdcall xus_UninstallNotesComponents(
char pc_SERVERNM[],
char pc_EXTFILENM_PGP_TEMPLATE[],
char pc_EXTFILENM_MAIL_TEMPLATE[],
const char pc_EXTFILENM_DB_LIST[],
char pc_MailDbs[]) {
const BOOL f_PGP_TEMPLATE = pc_EXTFILENM_PGP_TEMPLATE &&
*pc_EXTFILENM_PGP_TEMPLATE,
f_DB_LIST = pc_EXTFILENM_DB_LIST && *pc_EXTFILENM_DB_LIST,
f_MAIL_DBS = pc_MailDbs && *pc_MailDbs;
char pc_netFileNmPgpTemplate[ MAXPATH];
STATUS us_err;
BOOL f_failure = FALSE;
if (!mh_mainWnd) {
MessageBox( NULL, "PGPinstl.dll failed to attach to an apporpriate\n"
"application parent window",
mpc_APPNM, MB_ICONSTOP);
return !eus_SUCCESS;
}
if (!( pc_SERVERNM && (f_PGP_TEMPLATE || (f_DB_LIST || f_MAIL_DBS) &&
pc_EXTFILENM_MAIL_TEMPLATE &&
*pc_EXTFILENM_MAIL_TEMPLATE))) {
MessageBox( mh_mainWnd, "Incorrect parameters provided to\n"
"xus_UninstallNotesComponents",
mpc_APPNM, MB_ICONSTOP);
return !eus_SUCCESS;
}
//if requested, uninstall the PGP Notes Plug-In from the specified Notes
// Mail databases
if (f_DB_LIST || f_MAIL_DBS) {
DBHANDLE h;
char * pc_mereErrLog, pc[ NSF_INFO_SIZE];
STATUS us_error;
//if we are able to open and validate the specified Notes Mail
// template...
if (us_err = eus_OpenMailTemplate( pc_EXTFILENM_MAIL_TEMPLATE,
pc_SERVERNM, &h, pc))
return us_err;
if (!h)
return mus_HANDLED_EXCEPTION;
//carry out the uninstall on all the specified databases
us_err = us_RollBackMailDbs( h, pc_SERVERNM, pc,
pc_EXTFILENM_MAIL_TEMPLATE,
f_DB_LIST ?
pc_EXTFILENM_DB_LIST : NULL,
pc_MailDbs, &pc_mereErrLog);
if ((us_error = NSFDbClose( h)) && !us_err)
us_err = us_error;
//if any non-fatal errors occurred during the uninstall, let the user
// know about them
if (pc_mereErrLog) {
FILE * pfl;
if (f_failure = !( pfl = fopen( "PGPLog.txt", "wtc")))
goto errJump;
fprintf( pfl, pc_mereErrLog);
fclose( pfl); //failure ignored
MessageBox( mh_mainWnd, f_DB_LIST ? "Some databases could "
"not be processed. Refer to\nPGPLog.txt "
"in the Notes Program directory for "
"details." : pc_mereErrLog,
mpc_APPNM, MB_ICONEXCLAMATION);
free( pc_mereErrLog);
} //if (pc_mereErrLog)
if (us_err || f_failure)
goto errJump;
} //if (f_DB_LIST || f_MAIL_DBS)
//if requested, delete PGP template from server
if (f_PGP_TEMPLATE) {
//should verify that it is the plug-in template??
OSPathNetConstruct( NULL, pc_SERVERNM, pc_EXTFILENM_PGP_TEMPLATE,
pc_netFileNmPgpTemplate);
us_err = NSFDbDelete( pc_netFileNmPgpTemplate);
}
errJump:
if (us_err) {
char pc_msg[ 512] = "An unexpected error occurred, translated by "
"Notes as\n\"";
OSLoadString( mh_Instance, ERR( us_err), pc_msg + strlen( pc_msg),
(WORD) (512 - 2 - strlen( pc_msg)));
sprintf( pc_msg + strlen( pc_msg), "\" (%hx)", us_err);
MessageBox( mh_mainWnd, pc_msg, mpc_APPNM, MB_ICONSTOP);
us_err = mus_HANDLED_EXCEPTION;
}
return us_err + f_failure;
} //xus_UninstallNotesComponents(
/** us_OpenMailTemplate( ***
Attempts to open the specified Notes Mail template on the given server and
validate that it is in fact a mail template. If the specified databae cannot
be opened or validated for anticipated reasons, the user is informed of the
findings via a message box.
--- parameters & return ----
pc_FILENM: pointer to the extended filename of the Notes Mail template to be
opened
ph: Pointer to the variable in which to store the handle of the database if
successfully opened and validated. Guaranteed to be NULL if not
successfully opened and validated.
RETURN: eus_SUCCESS if no error occured; the Notes API error code otherwise
--- revision history -------
9/20/99 PR: created */
static STATUS us_OpenMailTemplate( char pc_FILENM[],
char pc_SERVERNM[],
DBHANDLE *const ph,
char *const pc_class) {
char pc[ 0x400];
STATUS us_err;
_ASSERTE( pc_FILENM && *pc_FILENM && pc_SERVERNM && ph);
if (!( us_err = eus_OpenMailTemplate( pc_FILENM, pc_SERVERNM, ph,
pc_class)))
return eus_SUCCESS;
//if an anticipated error occurred in opening the Notes Mail template,
// inform the user accordingly
switch (ERR( us_err)) {
case ERR_NOEXIST: {
const char *const ppc_PART[] = {"The template \'", "\' was "
"not located\non the "
"server \'", "\'"};
sprintf( pc, "%s%s%s%s%s", ppc_PART[0], pc_FILENM, ppc_PART[1],
pc_SERVERNM, ppc_PART[2]);
break;
}case ERR_NOACCESS: {
const char *const ppc_PART[] = {"You do not have access to "
"the\ntemplate \'",
"\' on server \'", "\'"};
sprintf( pc, "%s%s%s%s%s", ppc_PART[0], pc_FILENM, ppc_PART[1],
pc_SERVERNM, ppc_PART[2]);
break;
}case ERR_DIRECTORY: {
const char *const ppc_PART[] = {"The name \'", "\' is a "
"directory name,\nnot a template "
"on the server \'", "\'"};
sprintf( pc, "%s%s%s%s%s", ppc_PART[0], pc_FILENM, ppc_PART[1],
pc_SERVERNM, ppc_PART[2]);
break;
}case mi_ERR_NOT_MAIL_DB: {
const char *const ppc_PART[] = {"The database \'", "\' does "
"not seem to be a Notes "
"Mail\ntemplate "};
sprintf( pc, "%s%s%s", ppc_PART[0], pc_FILENM, ppc_PART[1]);
break;
}case mi_ERR_NOT_TEMPLATE: {
const char *const ppc_PART[] = {"A Notes Mail template "
"database with a template design "
"name is needed.\nCurrently \'",
"\' on server \'", "\' does not "
"have\na template design name."};
sprintf( pc, "%s%s%s%s%s", ppc_PART[0], pc_FILENM, ppc_PART[1],
pc_SERVERNM, ppc_PART[2]);
break;
}default:
return us_err;
} //switch (ERR( us_err))
MessageBox( mh_mainWnd, pc, mpc_APPNM, MB_ICONSTOP);
return eus_SUCCESS;
} //us_OpenMailTemplate(
/** us_RollBackMailDbs( ***
Removes PGP Plug-In components from the specified list of 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_TEMPLATE: handle to the Notes Mail template to be used in refreshing
each Notes Mail database from which the plug-in is to be removed
pc_SERVERNM: pointer to the name of the server on which all the Notes Mail
databases reside
pc_CLASS: Pointer to the class name associated with the Notes Mail template.
Serves as a protection against refreshing any Notes Mail database from
a template which does not correspond to its design-class name.
pc_EXTFILENM_MAIL_TEMPLATE: Pointer to the extended filename of the Notes
Mail template whose handle was passed. Utilized only for setting
environment information appropriately.
pc_EXTFILENM_DB_LIST: Optional. Pointer to a string indicating the extended
filename of a text file that contains the list of extended filenames of
the the Notes Mail databases from which the PGP Plug-In should be
removed. The filenames must be delimited by a pipe character or linefeed
character; whitespace surrounding each filename is ignored. A pass of
NULL indicates that any list of Notes Mail databases to be enabled is
provided via the pc_MailDbs parameter.
pc_MailDbs: Optional Input & Undefined Output. Pointer to a string indicating
the extended filenames of the particular Notes Mail databases to PGP
enable. Each filename must be delimited by a pipe character or linefeed
character; whitespace surrounding each filename is ignored. String will
be tokenized and therefore changed in a way not worth defining (see
documentation on standard strtok() function if understanding is
required). Parameter is ignored if the pc_EXTFILENM_DB_LIST parameter is
non-NULL. A pass of NULL indicates that no explicitly named Notes Mail
database are to be enabled by the procedure.
ppc_mereErrLog: Input & Output. Pointer to the variable that points to a
running log of non-fatal errors being tracked by the codestream. If this
procedure determines a database to be invalid for removal of the PGP
Plug-In, a description of the cause will be appended to the log.
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_RollBackMailDbs( DBHANDLE h_TEMPLATE,
char pc_SERVERNM[],
char pc_CLASS[],
char pc_EXTFILENM_MAIL_TEMPLATE[],
const char pc_EXTFILENM_DB_LIST[],
char * pc_MailDbs,
char * *const ppc_mereErrLog) {
char * pc_db, * pc_log = NULL, * pc;
DBHANDLE h_db = NULL;
EnvInfo t_env;
STATUS us_err, us_error;
BOOL f_failure = FALSE;
_ASSERTE( h_TEMPLATE && pc_SERVERNM && pc_CLASS &&
(pc_EXTFILENM_DB_LIST ||
pc_MailDbs) && ppc_mereErrLog);
*ppc_mereErrLog = NULL;
//Set environment information for the uninstall. Includes obtaining the
// NoteIDs associated with the e-mail forms in the mail template which
// will replace the PGP-enabled forms in the specified mail databases
memset( &t_env, NULL, sizeof( EnvInfo));
t_env.h_template = h_TEMPLATE;
strcpy( t_env.pc_DbClass, pc_CLASS);
if (us_err = us_GetSourceEnvInfo( NULL, pc_EXTFILENM_MAIL_TEMPLATE,
&t_env))
return us_err;
//if the user specified the special text file of mail-database paths,
// retrieve that file's contents into the mail-database input string
if (pc_EXTFILENM_DB_LIST)
if (f_failure = !f_LoadTextFileEntire( pc_EXTFILENM_DB_LIST,
&pc_MailDbs))
goto errJump;
//strip any trailing whitespace from the mail-database input string
pc = pc_MailDbs + strlen( pc_MailDbs) - 1;
while (*pc == ' ' || *pc == '\t')
*(pc--) = NULL;
//if there are any mail databases to update...
if (pc_db = strtok( pc_MailDbs, mpc_DELIMITER))
//for each mail database to update...
do {
//determine the extended file name of the database
while (*pc_db == ' ' || *pc_db == '\t')
pc_db++;
if (!*pc_db)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -