File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ failedSerializeOutput = "Failed to serialize output: %{err}"
4949failedLoadLibrary = " Failed to load dismapi.dll. Ensure DISM is available on this system."
5050functionNotFound = " Failed to find function '%{name}' in dismapi.dll"
5151initializeFailed = " DismInitialize failed: HRESULT %{hr}"
52+ notSupportedAppx = " This resource currently is not supported when installed via Appx"
5253openSessionFailed = " DismOpenSession failed: HRESULT %{hr}"
5354getFeatureInfoFailed = " DismGetFeatureInfo failed for '%{name}': HRESULT %{hr}"
5455enableFeatureFailed = " DismEnableFeature failed for '%{name}': HRESULT %{hr}"
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ const DISM_PACKAGE_NONE: i32 = 0;
1414const ERROR_SUCCESS_REBOOT_REQUIRED : i32 = 3010 ;
1515const DISMAPI_E_UNKNOWN_FEATURE : i32 = 0x800F080Cu32 as i32 ;
1616const DISMAPI_E_CAPABILITY_NOT_APPLICABLE : i32 = 0x800F0825u32 as i32 ;
17+ const REGDB_E_CLASSNOTREG : i32 = 0x80040154u32 as i32 ;
1718const LOAD_LIBRARY_SEARCH_SYSTEM32 : u32 = 0x0000_0800 ;
1819
1920#[ link( name = "kernel32" ) ]
@@ -243,6 +244,9 @@ impl DismSessionHandle {
243244
244245 unsafe {
245246 let hr = dism_initialize ( DISM_LOG_ERRORS , std:: ptr:: null ( ) , std:: ptr:: null ( ) ) ;
247+ if hr == REGDB_E_CLASSNOTREG {
248+ return Err ( t ! ( "dism.notSupportedAppx" ) . to_string ( ) ) ;
249+ }
246250 if hr < 0 {
247251 return Err ( t ! ( "dism.initializeFailed" , hr = format!( "0x{:08X}" , hr as u32 ) ) . to_string ( ) ) ;
248252 }
@@ -255,6 +259,10 @@ impl DismSessionHandle {
255259 std:: ptr:: null ( ) ,
256260 & mut session,
257261 ) ;
262+ if hr == REGDB_E_CLASSNOTREG {
263+ ( api. shutdown ) ( ) ;
264+ return Err ( t ! ( "dism.notSupportedAppx" ) . to_string ( ) ) ;
265+ }
258266 if hr < 0 {
259267 ( api. shutdown ) ( ) ;
260268 return Err ( t ! ( "dism.openSessionFailed" , hr = format!( "0x{:08X}" , hr as u32 ) ) . to_string ( ) ) ;
You can’t perform that action at this time.
0 commit comments