18 #include "sisxsifpluginactiveimpl.h" // CSisxSifPluginActiveImpl |
18 #include "sisxsifpluginactiveimpl.h" // CSisxSifPluginActiveImpl |
19 #include "sisxsifpluginuihandlerbase.h" // CSisxSifPluginUiHandlerBase |
19 #include "sisxsifpluginuihandlerbase.h" // CSisxSifPluginUiHandlerBase |
20 #include "sisxsifpluginuihandler.h" // CSisxSifPluginUiHandler |
20 #include "sisxsifpluginuihandler.h" // CSisxSifPluginUiHandler |
21 #include "sisxsifpluginuihandlersilent.h" // CSisxSifPluginUiHandlerSilent |
21 #include "sisxsifpluginuihandlersilent.h" // CSisxSifPluginUiHandlerSilent |
22 #include "sisxsifplugininstallparams.h" // CSisxSifPluginInstallParams |
22 #include "sisxsifplugininstallparams.h" // CSisxSifPluginInstallParams |
|
23 #include "sisxsifpluginerrorhandler.h" // CSisxSifPluginErrorHandler |
23 #include "sisxsifcleanuputils.h" // CleanupResetAndDestroyPushL |
24 #include "sisxsifcleanuputils.h" // CleanupResetAndDestroyPushL |
|
25 #include "sisxsifpluginerrors.h" // Error codes |
24 #include "sisxsifplugin.pan" // Panic codes |
26 #include "sisxsifplugin.pan" // Panic codes |
25 #include <usif/sif/sifcommon.h> // Usif::CComponentInfo |
27 #include <usif/sif/sifcommon.h> // Usif::CComponentInfo |
26 #include <usif/scr/scr.h> // RSoftwareComponentRegistry |
28 #include <usif/scr/scr.h> // RSoftwareComponentRegistry |
27 #include <usif/usiferror.h> // SIF error codes |
|
28 #include <swi/sisinstallerrors.h> // SWI error codes |
|
29 #include <swi/asynclauncher.h> // Swi::CAsyncLauncher |
29 #include <swi/asynclauncher.h> // Swi::CAsyncLauncher |
30 #include <swi/sisregistrysession.h> // RSisRegistrySession |
30 #include <swi/sisregistrysession.h> // RSisRegistrySession |
31 #include "sisregistrywritablesession.h" // RSisRegistryWritableSession |
31 #include "sisregistrywritablesession.h" // RSisRegistryWritableSession |
32 #include <e32property.h> // RProperty |
32 #include <e32property.h> // RProperty |
33 #include <sacls.h> // KUidSwiLatestInstallation |
33 #include <sacls.h> // KUidSwiLatestInstallation |
702 // |
704 // |
703 void CSisxSifPluginActiveImpl::DoHandleErrorL( TInt aError ) |
705 void CSisxSifPluginActiveImpl::DoHandleErrorL( TInt aError ) |
704 { |
706 { |
705 FLOG_1( _L("CSisxSifPluginActiveImpl::DoHandleErrorL(), aError=%d"), aError ); |
707 FLOG_1( _L("CSisxSifPluginActiveImpl::DoHandleErrorL(), aError=%d"), aError ); |
706 |
708 |
707 TErrorCategory category = ErrorCategory( aError ); |
709 iErrorHandler->SetErrorCode( aError ); |
708 if( iOutputParams ) |
710 if( iOutputParams ) |
709 { |
711 { |
710 iOutputParams->AddIntL( KSifOutParam_ErrCode, aError ); |
712 iErrorHandler->FillOutputParamsL( *iOutputParams ); |
711 iOutputParams->AddIntL( KSifOutParam_ExtendedErrCode, aError ); |
|
712 iOutputParams->AddIntL( KSifOutParam_ErrCategory, category ); |
|
713 // TODO: how to get error message and detailed error message? |
|
714 // iOutputParams->AddStringL( KSifOutParam_ErrMessage, TBD ); |
|
715 // iOutputParams->AddStringL( KSifOutParam_ErrMessageDetails, TBD ); |
|
716 } |
713 } |
717 |
714 |
718 if( aError != KErrNone && aError != KErrCancel ) |
715 if( aError != KErrNone && aError != KErrCancel ) |
719 { |
716 { |
720 // TODO: proper error messages |
717 iUiHandler->DisplayFailedL( *iErrorHandler ); |
721 iUiHandler->DisplayFailedL( category, aError, KNullDesC, KNullDesC ); |
718 } |
722 } |
719 |
723 |
720 iUiHandler->PublishCompletionL( *iErrorHandler ); |
724 // TODO: proper error messages |
|
725 iUiHandler->PublishCompletionL( category, aError, KNullDesC, KNullDesC ); |
|
726 } |
|
727 |
|
728 // --------------------------------------------------------------------------- |
|
729 // CSisxSifPluginActiveImpl::ErrorCategory() |
|
730 // --------------------------------------------------------------------------- |
|
731 // |
|
732 TErrorCategory CSisxSifPluginActiveImpl::ErrorCategory( TInt aErrorCode ) |
|
733 { |
|
734 switch( aErrorCode ) |
|
735 { |
|
736 // System-wide error codes |
|
737 case KErrNone: |
|
738 return ENone; |
|
739 case KErrNotFound: |
|
740 case KErrGeneral: |
|
741 return EUnexpectedError; |
|
742 case KErrCancel: |
|
743 return EUserCancelled; |
|
744 case KErrNoMemory: |
|
745 return ELowMemory; |
|
746 case KErrNotSupported: |
|
747 case KErrArgument: |
|
748 case KErrTotalLossOfPrecision: |
|
749 case KErrBadHandle: |
|
750 case KErrOverflow: |
|
751 case KErrUnderflow: |
|
752 case KErrAlreadyExists: |
|
753 case KErrPathNotFound: |
|
754 case KErrDied: |
|
755 return EUnexpectedError; |
|
756 case KErrInUse: |
|
757 return EInstallerBusy; |
|
758 case KErrServerTerminated: |
|
759 case KErrServerBusy: |
|
760 case KErrCompletion: |
|
761 case KErrNotReady: |
|
762 case KErrUnknown: |
|
763 return EUnexpectedError; |
|
764 case KErrCorrupt: |
|
765 return ECorruptedPackage; |
|
766 case KErrAccessDenied: |
|
767 return ESecurityError; |
|
768 case KErrLocked: |
|
769 case KErrWrite: |
|
770 case KErrDisMounted: |
|
771 case KErrEof: |
|
772 return EUnexpectedError; |
|
773 case KErrDiskFull: |
|
774 return ELowDiskSpace; |
|
775 case KErrBadDriver: |
|
776 case KErrBadName: |
|
777 case KErrCommsLineFail: |
|
778 case KErrCommsFrame: |
|
779 case KErrCommsOverrun: |
|
780 case KErrCommsParity: |
|
781 case KErrTimedOut: |
|
782 case KErrCouldNotConnect: |
|
783 case KErrCouldNotDisconnect: |
|
784 case KErrDisconnected: |
|
785 case KErrBadLibraryEntryPoint: |
|
786 case KErrBadDescriptor: |
|
787 case KErrAbort: |
|
788 case KErrTooBig: |
|
789 case KErrDivideByZero: |
|
790 case KErrBadPower: |
|
791 case KErrDirFull: |
|
792 case KErrHardwareNotAvailable: |
|
793 case KErrSessionClosed: |
|
794 return EUnexpectedError; |
|
795 case KErrPermissionDenied: |
|
796 return ESecurityError; |
|
797 case KErrExtensionNotSupported: |
|
798 case KErrCommsBreak: |
|
799 case KErrNoSecureTime: |
|
800 return EUnexpectedError; |
|
801 |
|
802 // Native SW Installer error codes |
|
803 case KErrSISFieldIdMissing: |
|
804 case KErrSISFieldLengthMissing: |
|
805 case KErrSISFieldLengthInvalid: |
|
806 case KErrSISStringInvalidLength: |
|
807 case KErrSISSignedControllerSISControllerMissing: |
|
808 case KErrSISControllerSISInfoMissing: |
|
809 case KErrSISInfoSISUidMissing: |
|
810 case KErrSISInfoSISNamesMissing: |
|
811 return ECorruptedPackage; |
|
812 case KErrSISFieldBufferTooShort: |
|
813 return EUnexpectedError; |
|
814 case KErrSISStringArrayInvalidElement: |
|
815 case KErrSISInfoSISVendorNamesMissing: |
|
816 case KErrSISInfoSISVersionMissing: |
|
817 case KErrSISControllerSISSupportedLanguagesMissing: |
|
818 case KErrSISSupportedLanguagesInvalidElement: |
|
819 case KErrSISLanguageInvalidLength: |
|
820 case KErrSISContentsSISSignedControllerMissing: |
|
821 case KErrSISContentsSISDataMissing: |
|
822 case KErrSISDataSISFileDataUnitMissing: |
|
823 case KErrSISFileDataUnitTargetMissing: |
|
824 case KErrSISFileOptionsMissing: |
|
825 case KErrSISFileDataUnitDescriptorMissing: |
|
826 case KErrSISFileDataDescriptionMissing: |
|
827 case KErrSISContentsMissing: |
|
828 case KErrSISEmbeddedControllersMissing: |
|
829 case KErrSISEmbeddedDataUnitsMissing: |
|
830 case KErrSISControllerOptionsMissing: |
|
831 case KErrSISExpressionMissing: |
|
832 case KErrSISExpressionStringValueMissing: |
|
833 case KErrSISOptionsStringMissing: |
|
834 case KErrSISFileOptionsExpressionMissing: |
|
835 case KErrSISExpressionHeadValueMissing: |
|
836 case KErrSISEmbeddedSISOptionsMissing: |
|
837 case KErrSISInfoSISUpgradeRangeMissing: |
|
838 case KErrSISDependencyMissingUid: |
|
839 case KErrSISDependencyMissingVersion: |
|
840 case KErrSISDependencyMissingNames: |
|
841 case KErrSISPrerequisitesMissingDependency: |
|
842 case KErrSISControllerMissingPrerequisites: |
|
843 case KErrSISUpgradeRangeMissingVersion: |
|
844 case KErrSISUnexpectedFieldType: |
|
845 case KErrSISExpressionUnknownOperator: |
|
846 case KErrSISArrayReadError: |
|
847 case KErrSISArrayTypeMismatch: |
|
848 case KErrSISInvalidStringLength: |
|
849 case KErrSISCompressionNotSupported: |
|
850 case KErrSISTooDeeplyEmbedded: |
|
851 return ECorruptedPackage; |
|
852 case KErrSISInvalidTargetFile: |
|
853 case KErrSISWouldOverWrite: |
|
854 return ESecurityError; |
|
855 case KErrSISInfoMissingRemoveDirectories: |
|
856 return ECorruptedPackage; |
|
857 case KErrSISNotEnoughSpaceToInstall: |
|
858 return ELowDiskSpace; |
|
859 case KErrInstallerLeave: |
|
860 case KErrPolicyFileCorrupt: |
|
861 return EUnexpectedError; |
|
862 case KErrSignatureSchemeNotSupported: |
|
863 case KErrDigestNotSupported: |
|
864 return EApplicationNotCompatible; |
|
865 case KErrBadHash: |
|
866 return ECorruptedPackage; |
|
867 case KErrSecurityError: |
|
868 return ESecurityError; |
|
869 case KErrBadUsage: |
|
870 case KErrInvalidType: |
|
871 case KErrInvalidExpression: |
|
872 case KErrExpressionToComplex: |
|
873 return EUnexpectedError; |
|
874 case KErrMissingBasePackage: |
|
875 case KErrInvalidUpgrade: |
|
876 return EApplicationNotCompatible; |
|
877 case KErrInvalidEclipsing: |
|
878 return ESecurityError; |
|
879 case KErrWrongHeaderFormat: |
|
880 return EUnexpectedError; |
|
881 case KErrCapabilitiesMismatch: |
|
882 return ESecurityError; |
|
883 case KErrLegacySisFile: |
|
884 case KErrInvalidSoftwareTypeRegistrationFile: |
|
885 return EApplicationNotCompatible; |
|
886 |
|
887 // Other error codes |
|
888 default: |
|
889 __ASSERT_DEBUG( EFalse, Panic( ESisxSifUnknownErrorCode ) ); |
|
890 return EUnexpectedError; |
|
891 } |
|
892 } |
721 } |
893 |
722 |
894 // --------------------------------------------------------------------------- |
723 // --------------------------------------------------------------------------- |
895 // CSisxSifPluginActiveImpl::SetFileL() |
724 // CSisxSifPluginActiveImpl::SetFileL() |
896 // --------------------------------------------------------------------------- |
725 // --------------------------------------------------------------------------- |
1000 // CSisxSifPluginActiveImpl::StartSilentInstallingL() |
829 // CSisxSifPluginActiveImpl::StartSilentInstallingL() |
1001 // --------------------------------------------------------------------------- |
830 // --------------------------------------------------------------------------- |
1002 // |
831 // |
1003 void CSisxSifPluginActiveImpl::StartSilentInstallingL() |
832 void CSisxSifPluginActiveImpl::StartSilentInstallingL() |
1004 { |
833 { |
|
834 // TODO: fix this, removed temporarily to allow installations |
|
835 #ifdef _NOT_DEFINED_ |
1005 const CComponentInfo::CNode& rootNode( iComponentInfo->RootNodeL() ); |
836 const CComponentInfo::CNode& rootNode( iComponentInfo->RootNodeL() ); |
1006 TBool isAuthenticated = ( rootNode.Authenticity() == EAuthenticated ); |
837 TBool isAuthenticated = ( rootNode.Authenticity() == EAuthenticated ); |
1007 |
838 |
1008 // AllowUntrusted option is needed to install untrusted packages. |
839 // AllowUntrusted option is needed to install untrusted packages. |
1009 if( !isAuthenticated && !iInstallParams->AllowUntrusted() ) |
840 if( !isAuthenticated && ( iInstallParams->AllowUntrusted() != EAllowed ) ) |
1010 { |
841 { |
1011 FLOG( _L("Attempt to install unsigned package silently without AllowUntrusted option") ); |
842 FLOG( _L("Attempt to install unsigned package silently without AllowUntrusted option") ); |
|
843 iErrorHandler->SetExtendedErrorCode( ENeedsAllowUntrustedParameter ); |
1012 CompleteClientRequest( KErrPermissionDenied ); |
844 CompleteClientRequest( KErrPermissionDenied ); |
1013 } |
845 } |
1014 // GrantCapabilities option is needed to install packages that require user capabilities |
846 // GrantCapabilities option is needed to install packages that require user capabilities |
1015 else if( RequiresUserCapabilityL( rootNode ) && !iInstallParams->GrantCapabilities() ) |
847 else if( RequiresUserCapabilityL( rootNode ) && |
|
848 ( iInstallParams->GrantCapabilities() != EAllowed ) ) |
1016 { |
849 { |
1017 FLOG( _L("Attempt to grant user capabilities silently without GrantCapabilities option") ); |
850 FLOG( _L("Attempt to grant user capabilities silently without GrantCapabilities option") ); |
|
851 iErrorHandler->SetExtendedErrorCode( ENeedsGrantCapabilitiesParameter ); |
1018 CompleteClientRequest( KErrPermissionDenied ); |
852 CompleteClientRequest( KErrPermissionDenied ); |
1019 } |
853 } |
1020 // AllFiles capability is needed to install untrusted packages that contains exe/dll binaries |
854 // AllFiles capability is needed to install untrusted packages that contains exe/dll binaries |
1021 else if( !isAuthenticated && rootNode.HasExecutable() && !iHasAllFilesCapability ) |
855 else if( !isAuthenticated && rootNode.HasExecutable() && !iHasAllFilesCapability ) |
1022 { |
856 { |
1023 FLOG( _L("Attempt to install untrusted binaries silently without AllFiles capability") ); |
857 FLOG( _L("Attempt to install untrusted binaries silently without AllFiles capability") ); |
|
858 iErrorHandler->SetExtendedErrorCode( EAllFilesCapabilityRequired ); |
1024 CompleteClientRequest( KErrPermissionDenied ); |
859 CompleteClientRequest( KErrPermissionDenied ); |
1025 } |
860 } |
1026 else |
861 else |
|
862 #endif |
1027 { |
863 { |
1028 StartInstallingL(); |
864 StartInstallingL(); |
1029 } |
865 } |
1030 } |
866 } |
1031 |
867 |