Advertisement
aveyo

Add_DISMinfo_contextmenu_to_iso_esd_wim_vhd_cab_msu

Apr 24th, 2018 (edited)
7,941
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
REG 7.59 KB | None | 0 0
  1. Windows Registry Editor Version 5.00
  2.  
  3. ;5th version adds support for iso images, and uses WIMINFO powershell snippet for iso, esd, wim (does not need admin rights)
  4. ;4th version uses dism and Get-WimInfo instead of Get-ImageInfo (for outdated win7); force entry to appear (7-zip shell issue)
  5. ;3rd version adds support for vhd images, and lists all existing indexes details (detecting them adds a bit of slow at start)
  6. ;2nd version adds support for msu, and blindly listed first 3 indexes details, fast, but could list 'error"
  7. ;1st version undo (HCU unreliable, more so if having 7-Zip shell extensions, hence switched to HKCR)
  8.  
  9. ;========================================================================================
  10. [-HKEY_CLASSES_ROOT\.iso\shell\DISMinfo]
  11.  
  12. [HKEY_CLASSES_ROOT\.iso\shell\DISMinfo]
  13. "MUIVerb"="DISM Info"
  14. "Icon"="HelpPane.exe"
  15.  
  16. [HKEY_CLASSES_ROOT\.iso\shell\DISMinfo\command]
  17. @="powershell -nop -c iex((11..45|%%{(gp 'Registry::HKCR\\WIMINFO' $_ -ea 0).$_})-join[char]10);'%1';''; WIMINFO '%1'; timeout -1"
  18.  
  19. ;========================================================================================
  20. [-HKEY_CLASSES_ROOT\Windows.IsoFile\shell\DISMinfo]
  21.  
  22. [HKEY_CLASSES_ROOT\Windows.IsoFile\shell\DISMinfo]
  23. "MUIVerb"="DISM Info"
  24. "Icon"="HelpPane.exe"
  25.  
  26. [HKEY_CLASSES_ROOT\Windows.IsoFile\shell\DISMinfo\command]
  27. @="powershell -nop -c iex((11..45|%%{(gp 'Registry::HKCR\\WIMINFO' $_ -ea 0).$_})-join[char]10);'%1';''; WIMINFO '%1'; timeout -1"
  28.  
  29. ;========================================================================================
  30. [-HKEY_CLASSES_ROOT\.esd\shell\DISMinfo]
  31.  
  32. [HKEY_CLASSES_ROOT\.esd\shell\DISMinfo]
  33. "MUIVerb"="DISM Info"
  34. "Icon"="HelpPane.exe"
  35.  
  36. [HKEY_CLASSES_ROOT\.esd\shell\DISMinfo\command]
  37. @="powershell -nop -c iex((11..45|%%{(gp 'Registry::HKCR\\WIMINFO' $_ -ea 0).$_})-join[char]10);'%1';''; WIMINFO '%1'; timeout -1"
  38.  
  39. ;========================================================================================
  40. [-HKEY_CLASSES_ROOT\.wim\shell\DISMinfo]
  41.  
  42. [HKEY_CLASSES_ROOT\.wim\shell\DISMinfo]
  43. "MUIVerb"="DISM Info"
  44. "Icon"="HelpPane.exe"
  45.  
  46. [HKEY_CLASSES_ROOT\.wim\shell\DISMinfo\command]
  47. @="powershell -nop -c iex((11..45|%%{(gp 'Registry::HKCR\\WIMINFO' $_ -ea 0).$_})-join[char]10);'%1';''; WIMINFO '%1'; timeout -1"
  48.  
  49. ;========================================================================================
  50. [HKEY_CLASSES_ROOT\7-Zip.wim\shell\DISMinfo]
  51. "MUIVerb"="DISM Info"
  52. "Icon"="HelpPane.exe"
  53.  
  54. [HKEY_CLASSES_ROOT\7-Zip.wim\shell\DISMinfo\command]
  55. @="powershell -nop -c iex((11..45|%%{(gp 'Registry::HKCR\\WIMINFO' $_ -ea 0).$_})-join[char]10);'%1';''; WIMINFO '%1'; timeout -1"
  56.  
  57. ;========================================================================================
  58. [-HKEY_CLASSES_ROOT\Windows.VhdFile\shell\DISMinfo]
  59.  
  60. [HKEY_CLASSES_ROOT\Windows.VhdFile\shell\DISMinfo]
  61. "MUIVerb"="DISM Info"
  62. "Icon"="HelpPane.exe"
  63. "CommandFlags"=dword:00000010
  64.  
  65. [HKEY_CLASSES_ROOT\Windows.VhdFile\shell\DISMinfo\command]
  66. @="powershell -win 1 -nop -c \"start powershell -Args '-c \\\"$host.ui.rawui.windowtitle=''DISM Info'';$w=''%1'';$w;$c=(dism /Get-ImageInfo /ImageFile:$w) | sls ''Index'';for($i=1;$i -le $c.count;$i++){dism /Get-ImageInfo /ImageFile:$w /Index:$i;write-host (''=''*60)};timeout -1\\\"' -verb RunAs\""
  67.  
  68. ;========================================================================================
  69. [-HKEY_CLASSES_ROOT\.cab\shell\DISMinfo]
  70.  
  71. [HKEY_CLASSES_ROOT\.cab\shell\DISMinfo]
  72. "MUIVerb"="DISM Info"
  73. "Icon"="HelpPane.exe"
  74. "CommandFlags"=dword:00000010
  75.  
  76. [HKEY_CLASSES_ROOT\.cab\shell\DISMinfo\command]
  77. @="powershell -win 1 -nop -c \"start cmd -Args '/c title DISM Info& dism /Online /Get-PackageInfo /PackagePath:\\\"%1\\\" &timeout -1' -verb RunAs\""
  78.  
  79. ;========================================================================================
  80. [-HKEY_CLASSES_ROOT\CABFolder\shell\DISMinfo]
  81.  
  82. [HKEY_CLASSES_ROOT\CABFolder\shell\DISMinfo]
  83. "MUIVerb"="DISM Info"
  84. "Icon"="HelpPane.exe"
  85. "CommandFlags"=dword:00000010
  86.  
  87. [HKEY_CLASSES_ROOT\CABFolder\shell\DISMinfo\command]
  88. @="powershell -win 1 -nop -c \"start cmd -Args '/c title DISM Info& dism /Online /Get-PackageInfo /PackagePath:\\\"%1\\\" &timeout -1' -verb RunAs\""
  89.  
  90. ;========================================================================================
  91. [-HKEY_CLASSES_ROOT\Microsoft.System.Update.1\shell\DISMinfo]
  92.  
  93. [HKEY_CLASSES_ROOT\Microsoft.System.Update.1\shell\DISMinfo]
  94. "MUIVerb"="DISM Info"
  95. "Icon"="HelpPane.exe"
  96.  
  97. [HKEY_CLASSES_ROOT\Microsoft.System.Update.1\shell\DISMinfo\command]
  98. @="powershell -win 1 -nop -c \"start cmd -Args '/c title DISM Info& pushd \\\"%%temp%%\\\" &mkdir disminfo &Expand -F:*Properties.txt \\\"%1\\\" disminfo &pushd disminfo &type *.txt &del /f /q *.* &timeout -1'\""
  99.  
  100. ;========================================================================================
  101. ; WIMINFO powershell snippet not requiring admin rights
  102. [HKEY_CLASSES_ROOT\WIMINFO]
  103. "11"="function WIMINFO ($file = 'install.esd', $index = 0, $output = 0) { :info while ($true) {"
  104. "12"="  #:: Quick ISO ESD WIM info by AveYo v1"
  105. "13"="  #:: args = file, image index or 0 for all, output 0 for simple, 1 for xml text, 2 for xml object"
  106. "14"="  #:: by default returns simple image index, version, arch, lang, edition - example: 6,19041.631,x64,en-US,Professional"
  107. "15"="  $block = 2097152; $bytes = new-object 'Byte[]' ($block); $begin = [uint64]0; $final = [uint64]0; $limit = [uint64]0"
  108. "16"="  $steps = [int]([uint64]([IO.FileInfo]$file).Length / $block - 1); $encoding = [Text.Encoding]::GetEncoding(28591)"
  109. "17"="  $find1 = $encoding.GetString([Text.Encoding]::Unicode.GetBytes('</INSTALLATIONTYPE>'))"
  110. "18"="  $find2 = $encoding.GetString([Text.Encoding]::Unicode.GetBytes('</WIM>'))"
  111. "19"="  $f = new-object IO.FileStream ($file, 3, 1, 1); $p = 0; $p = $f.Seek(0, 2)"
  112. "20"="  for ($o = 1; $o -le $steps; $o++) { "
  113. "21"="    $p = $f.Seek(-$block, 1); $r = $f.Read($bytes, 0, $block); if ($r -ne $block) {write-host invalid block $r; break}"
  114. "22"="    $u = [Text.Encoding]::GetEncoding(28591).GetString($bytes); $t = $u.LastIndexOf($find1, [StringComparison]::Ordinal) "
  115. "23"="    if ($t -ge 0) {"
  116. "24"="      $f.Seek(($t -$block), 1) >''"
  117. "25"="      for ($o = 1; $o -le $block; $o++) { $f.Seek(-2, 1) >''; if ($f.ReadByte() -eq 0xfe) {$begin = $f.Position; break} }"
  118. "26"="      $limit = $f.Length - $begin; if ($limit -lt $block) {$x = $limit} else {$x = $block}"
  119. "27"="      $bytes = new-object 'Byte[]' ($x); $r = $f.Read($bytes, 0, $x); "
  120. "28"="      $u = [Text.Encoding]::GetEncoding(28591).GetString($bytes); $t = $u.IndexOf($find2, [StringComparison]::Ordinal)"
  121. "29"="      if ($t -ge 0) {$f.Seek(($t + 12 -$x), 1) >''; $final = $f.Position} ; break"
  122. "30"="    } else { $p = $f.Seek(-$block, 1)} "
  123. "31"="  }"
  124. "32"="  if ($begin -gt 0 -and $final -gt $begin) {"
  125. "33"="    $x = $final - $begin; $f.Seek(-$x, 1) >''; $bytes = new-object 'Byte[]' ($x); $r = $f.Read($bytes, 0, $x)"
  126. "34"="    if ($r -ne $x) {break}"
  127. "35"="    [xml]$xml = [Text.Encoding]::Unicode.GetString($bytes); $f.Dispose()"
  128. "36"="  } else {$f.Dispose()}"
  129. "37"="  break :info } "
  130. "38"="  if ($output -eq 0) {$simple = ''; foreach ($i in $xml.WIM.IMAGE) {if ($index -gt 0 -and $($i.INDEX)-ne $index) {continue}"
  131. "39"="    $simple += \"$($i.INDEX),$($I.WINDOWS.VERSION.BUILD).$($I.WINDOWS.VERSION.SPBUILD),\""
  132. "40"="    $simple += \"$(('x64','x86')[$I.WINDOWS.ARCH-eq'0']),$($I.WINDOWS.LANGUAGES.LANGUAGE),$($I.WINDOWS.EDITIONID)`r`n\""
  133. "41"="  } ; return $simple }"
  134. "42"="  if ($output -eq 1) {[console]::OutputEncoding=[Text.Encoding]::UTF8; $xml.Save([Console]::Out); ''} "
  135. "43"="  if ($output -eq 2) {return $xml}"
  136. "44"="}"
  137. "45"="$host.ui.rawui.windowtitle = 'DISM Info'"
  138.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement