Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DISM.exe Return Codes?

I have a program that calls the dism.exe program and it runs a few commands in the background. Right now, I only check for a return code of 0 or anything else in order to show a process failed or succeeded. What could i cross examine the return code with in order to get an accurate return error. Which returns are the DISM referenced to?

like image 736
Tyler Avatar asked Oct 30 '22 23:10

Tyler


1 Answers

The link provided in the comment DISMAPI Error Messages provides a very few error code, but in my experience, these are not the most common error codes returned by DISM.exe.

In my scenarios, I mostly use dism.exe /Online ... and here's what I found so far:

  • ERROR_SUCCESS_REBOOT_REQUIRED ~ 3010 (0xBC2) when /Add-Package requires a reboot.
  • ERROR_BAD_FORMAT ~ 11 (0xB) when you hand /Add-Package a package that is not applicable to this operating system (e.g. an x86 package for a x64 Windows)
  • ERROR_PATH_NOT_FOUND ~ 3 when the file you hand to /PackagePath doesn't exist
  • ERROR_ELEVATION_REQUIRED ~ 740 (0x2E4) when you're not running as admin.

Additional Links:

  • https://learn.microsoft.com/en-us/windows/desktop/Debug/system-error-codes
  • https://github.com/jeffkl/ManagedDism/blob/master/dismapi.h
like image 123
Martin Ba Avatar answered Nov 10 '22 10:11

Martin Ba