/*----------------------------------------------------------------------- * * File: INSTALL_DES2.C * * Copyright (c) 1995-2000 Intel Corporation. All rights reserved. *----------------------------------------------------------------------- */ /* ** install_des2 [ -u ] -s [-d ] */ #include #include #include #include #include #include #include #include "installerr.h" #include "desguid.h" CSSM_GUID des2_ex_guid = des2_ex_guid_init; INSTALL_ERROR install( const char* ModulePath, const char* ManifestPath ) { INSTALL_ERROR eError = INSTALL_SUCCESS; CSSM_BOOL bResult; CSSM_RETURN Rtn; char FullDstName[_MAX_PATH], FullSrcName[_MAX_PATH], FullHlpName[_MAX_PATH]; Rtn = MDS_RegisterModule( des2_ex_guid, "des2", /* module root */ ".exe", /* module extension */ ModulePath, /* module path */ ManifestPath, /* manifest path */ MDS_APPLICATION ); if( Rtn != CSSM_OK ) { eError = INSTALL_MDS_REGISTRY_ERROR; printf( "MDS Registration failed!\n" ); } return( eError ); } INSTALL_ERROR uninstall( ) { INSTALL_ERROR eError = INSTALL_SUCCESS; CSSM_RETURN Rtn; Rtn = MDS_DeRegisterModule( des2_ex_guid, MDS_APPLICATION ); if( Rtn != CSSM_OK ) { eError = INSTALL_MDS_REGISTRY_ERROR; printf( "MDS deregistration failed!\n" ); } return( eError ); } void main( int argc, char* argv[] ) { INSTALL_ERROR eError = INSTALL_SUCCESS; int index = 0, uninstall_flag = 0, source_flag = 0, destination_flag = 0; char SourcePath[_MAX_PATH]; char DestPath[_MAX_PATH]; char FullSrcName[_MAX_PATH]; char FullSrcPath[_MAX_PATH]; char FullDstPath[_MAX_PATH]; memset( SourcePath, 0, _MAX_PATH ); memset( DestPath, 0, _MAX_PATH ); memset( FullSrcName, 0, _MAX_PATH ); memset( FullSrcPath, 0, _MAX_PATH ); memset( FullDstPath, 0, _MAX_PATH ); index = argc-1; /* parse command line */ while( index ) { /* assign paths if necessary */ if( source_flag == 1 ) { strcpy( SourcePath, argv[argc-index] ); source_flag++; } if( destination_flag == 1 ) { strcpy( DestPath, argv[argc-index] ); destination_flag++; } if( !strcmp( argv[argc-index], "-u") && !uninstall_flag ) { uninstall_flag = 1; } else if( !strcmp( argv[argc-index], "-s") && !source_flag ) { source_flag = 1; } else if( !stricmp( argv[argc-index], "-d") && !destination_flag ) { destination_flag = 1; } index--; } if ( uninstall_flag ) { eError = uninstall( ); if(INSTALL_SUCCESS != eError) { printf( "Uninstall failed.\n" ); exit(1); } else { printf( "Uninstall completed successfully.\n" ); exit(0); } } if( !destination_flag ) { GetSystemDirectory( DestPath, _MAX_PATH ); } eError = install( SourcePath, DestPath ); if(INSTALL_SUCCESS != eError) { printf( "Install failed.\n" ); exit(1); } else { printf( "Install completed successfully.\n" ); exit(0); } }