@ChatGPT


PS C:\Temp\SamsungExtract> .\Samsung_NVM_Express_Driver.exe /? # show supported switches
Program 'Samsung_NVM_Express_Driver.exe' failed to run: The specified executable is not a valid application for this
OS platform.At line:1 char:1
+ .\Samsung_NVM_Express_Driver.exe /? # show supported switches
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
At line:1 char:1
+ .\Samsung_NVM_Express_Driver.exe /? # show supported switches
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed

PS C:\Temp\SamsungExtract>
 

You're close — the problem is that combined.bin is not a Windows EXE from byte‑0, so simply renaming it to .exe won't run. The real bootstrapper (the PE) is embedded later inside combined.bin (you already found an MZ at offset 394394). You need to carve that PE out and run the carved file. Below are exact, copy/paste PowerShell steps (run as Administrator) that will:
  • extract the embedded PE to a new file,
  • verify it looks like a PE,
  • run the layout/extract switch, and
  • what to do if /layout doesn't work.
Step A — carve the embedded PE (PowerShell)
1) Open an elevated PowerShell (Run as Administrator).
2) Run this (one block; it uses the offsets you already discovered: start=394394 length=3025380). Adjust if you discovered different values:
$in = "C:\Temp\SamsungExtract\combined.bin"
$out = "C:\Temp\SamsungExtract\carved_container.exe"
$offset = 394394
$length = 3025380
$inFs = [System.IO.File]::OpenRead($in)
try {
$inFs.Position = $offset
$outFs = [System.IO.File]::Create($out)
$buf = New-Object byte[] 65536
$remaining = $length
while ($remaining -gt 0) {
$toRead = [math]::Min($buf.Length, $remaining)
$r = $inFs.Read($buf, 0, $toRead)
if ($r -le 0) { break }
$outFs.Write($buf, 0, $r)
$remaining -= $r
}
} finally {
$inFs.Close()
if ($outFs) { $outFs.Close() }
}
"Done. Carved to: $out"
Get-Item $out | Select-Object FullName,Length
(That will produce carved_container.exe in C:\Temp\SamsungExtract.)
Step B — quick verification
  • Check the first bytes (header) to confirm a PE:
Format-Hex "C:\Temp\SamsungExtract\carved_container.exe" -Count 64
You should see "4D 5A" ("MZ") at offset 0 and the ascii "This program cannot be run in DOS mode." in the dump.
Step C — run the carved bootstrapper's layout/extract
  • Try the common bootstrapper layout switches (still in elevated PowerShell):
cd C:\Temp\SamsungExtract

show help (if available)​

.\carved_container.exe /?

try the typical layout switch (create a layout folder)​

.\carved_container.exe /layout "C:\Temp\SamsungExtract\layout"

alternates if the above fails​

.\carved_container.exe /layout:"C:\Temp\SamsungExtract\layout"
.\carved_container.exe /extract "C:\Temp\SamsungExtract\layout"
Notes:
  • If the binary is a Wix/Burn bootstrapper it usually supports /layout and will extract the embedded MSIs into the folder you give.
  • Run the one that succeeds. If a dialog appears when you double‑click the EXE, prefer running the /layout method from an elevated prompt.
Step D — locate the extracted MSIs or driver files
If /layout worked, list extracted files:
Get-ChildItem -Path "C:\Temp\SamsungExtract\layout" -Recurse | Where-Object { $_.Extension -in '.msi','.cab','.inf','.sys','.exe' } | Select-Object FullName,Length
Step E — extract MSIs to see driver files (if you get MSIs)
  • Use 7‑Zip or lessmsi on any SamsungInstaller64.msi found.
7z (CLI):
"C:\Program Files\7-Zip\7z.exe" x "C:\Temp\SamsungExtract\layout\SamsungInstaller64.msi" -o"C:\Temp\msi_contents"
lessmsi:
lessmsi x "C:\Temp\SamsungExtract\layout\SamsungInstaller64.msi" "C:\Temp\msi_contents"
Inside C:\Temp\msi_contents you should find .inf, .sys, .cat etc. — those are the driver files.
Step F — install drivers (test environment recommended)
From an elevated PowerShell on a test VM:
pnputil /add-driver "C:\Temp\msi_contents*.inf" /install
Or use Device Manager → Update driver → Browse my computer → point to the folder.
If /layout fails or carved_container.exe still won't run
Possible reasons:
  • The carve parameters were wrong (offset/length). Re-check for MZ offsets inside combined.bin.
  • The embedded PE is not the bootstrapper but a different payload.
  • The carved file is corrupted.
If .\carved_container.exe /? returns "not a valid application for this OS platform", that can mean the file is corrupt or built for a different OS/architecture. To troubleshoot:
1) Reconfirm the MZ offset(s) inside combined.bin (PowerShell):

finds MZ offsets (fast-ish)​

$f = "C:\Temp\SamsungExtract\combined.bin"
$buf = [System.IO.File]::ReadAllBytes($f)
for ($i=0; $i -lt $buf.Length-1; $i++) {
if ($buf[$i] -eq 0x4D -and $buf[$i+1] -eq 0x5A) { $i; break }
}
If you want all offsets, it's better to use a tool like fgrep/grep in WSL or a small script to list all occurrences. (You previously found 394394; if that differs re-run the carve with the correct offset.)
2) If you carved but the PE is invalid, try carving the next MZ occurrence (there are multiple MZs in the file) — your earlier Linux run carved a smaller "carved_container.bin" with the same offsets; use those results if available.
3) If you prefer, I can give you a PowerShell snippet to scan combined.bin for "PK\x03\x04" and MZ and list offsets so you can choose which to carve.
Summary / next step for you
  • Run the carve script above (Step A) using the offset/length you already found (394394 / 3025380).
  • Then run .\carved_container.exe /layout C:\Temp\SamsungExtract\layout
  • If that succeeds, extract the MSI(s) with 7‑Zip and install the driver INF/SYS via pnputil or Device Manager.
If you hit an error during any of these steps, paste:
  • the Format-Hex output of carved_container.exe first 64 bytes,
  • the exact error text you see running the carved_container.exe /layout command,
  • or the list of files created in C:\Temp\SamsungExtract (dir /a /od).
Tell me which one you ran and paste the outputs and I’ll tell you the precise next command.
 

@ChatGPT

The script yielded:

Done. Carved to: C:\Temp\SamsungExtract\carved_container.exe

FullName Length
-------- ------
C:\Temp\SamsungExtract\carved_container.exe 3025380

....on the other hand, the next bit yielded:

PS C:\Temp\SamsungExtract> Format-Hex "C:\Temp\SamsungExtract\carved_container.exe" -Count 64
Format-Hex : A parameter cannot be found that matches parameter name 'Count'.
At line:1 char:58
+ Format-Hex "C:\Temp\SamsungExtract\carved_container.exe" -Count 64
+ ~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Format-Hex], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Format-Hex

PS C:\Temp\SamsungExtract>
 

Good — carved_container.exe exists and the carve succeeded. The Format-Hex error just means your PowerShell edition/version doesn’t accept that parameter. Let’s do a few quick checks and then try extraction. Copy/paste each block into an elevated PowerShell session (Run as Administrator). I’ll give alternatives where useful.
1) Show the first 64 bytes (hex) — reliable cross‑version snippet
(This will show the MZ header and the “This program cannot be run in DOS mode.” text if it’s a valid PE.)
$fn = 'C:\Temp\SamsungExtract\carved_container.exe'
$fs = [System.IO.File]::OpenRead($fn)
try {
$b = New-Object byte[] 64
$fs.Read($b,0,64) | Out-Null
} finally { $fs.Close() }

print hex and ascii​

'{0}' -f ([BitConverter]::ToString($b) -replace '-',' ')
[System.Text.Encoding]::ASCII.GetString($b) -replace '\0','·'
What you should see:
  • Hex begins with 4D 5A (MZ) and
  • ASCII includes "This program cannot be run in DOS mode."
If you do not see MZ in the output, stop and paste the hex here.
2) Detect PE machine/architecture (so we know why Windows might refuse to run it)
(This reads IMAGE_FILE_HEADER.Machine)
$bytes = [System.IO.File]::ReadAllBytes($fn)
$e_lfanew = [BitConverter]::ToInt32($bytes,0x3C)
$machine = [BitConverter]::ToUInt16($bytes, $e_lfanew + 4)
"e_lfanew = $e_lfanew"
"Machine (hex) = 0x{0:X4}" -f $machine
switch ($machine) {
0x014c { "IMAGE_FILE_MACHINE_I386 (x86)" }
0x8664 { "IMAGE_FILE_MACHINE_AMD64 (x64)" }
0x01c0 { "IMAGE_FILE_MACHINE_ARM" }
0xAA64 { "IMAGE_FILE_MACHINE_ARM64" }
0x0200 { "IMAGE_FILE_MACHINE_IA64 (Itanium)" }
default { "Unknown machine value" }
}
Notes:
  • IMAGE machine values: 0x014C = 32-bit x86, 0x8664 = x64, 0xAA64 = ARM64, 0x0200 = Itanium. If it reports IA64 or ARM/ARM64 and your Windows is x64/x86, Windows may refuse to run it.
3) If it looks like a valid PE and architecture is compatible, try the bootstrapper help and layout
(From C:\Temp\SamsungExtract)
cd C:\Temp\SamsungExtract

try help​

.\carved_container.exe /?

try layout (two syntaxes)​

.\carved_container.exe /layout "C:\Temp\SamsungExtract\layout"
.\carved_container.exe /layout:"C:\Temp\SamsungExtract\layout"
If the EXE runs and /layout succeeds, the embedded MSIs (SamsungInstaller64.msi etc.) will be placed in ...\layout (or similar). Then use 7‑Zip / lessmsi as I previously described to open the MSI and extract .inf/.sys/.cat.
4) If Windows refuses to run the carved PE (same error as before)
Possible causes:
  • Wrong architecture (you saw IA64/ARM)
  • The PE is still corrupted / incomplete
  • The carved PE is actually not the bootstrapper but another PE (a DLL payload) — in that case the MSI might be elsewhere (in the container as PK.. entries).
Next attempt: search the carved file for ZIP (PK..), MSI/CAB/PK signatures and carve from there
Run this to find PK (zip/cab) and OLE/MSI compound signatures inside the carved file:
$fn = 'C:\Temp\SamsungExtract\carved_container.exe'
$bytes = [System.IO.File]::ReadAllBytes($fn)

find PK\x03\x04 offsets​

$pkOffsets = for ($i=0; $i -le $bytes.Length-4; $i++) {
if ($bytes[$i] -eq 0x50 -and $bytes[$i+1] -eq 0x4B -and $bytes[$i+2] -eq 0x03 -and $bytes[$i+3] -eq 0x04) { $i }
}
"PK (zip/cab/msi) offsets: " + ($pkOffsets -join ', ')

find OLE header (D0 CF 11 E0) offsets (MSI compound)​

$oleOffsets = for ($i=0; $i -le $bytes.Length-4; $i++) {
if ($bytes[$i] -eq 0xD0 -and $bytes[$i+1] -eq 0xCF -and $bytes[$i+2] -eq 0x11 -and $bytes[$i+3] -eq 0xE0) { $i }
}
"OLE (MSI) offsets: " + ($oleOffsets -join ', ')
If you get one or more PK offsets, you can carve that embedded archive into a .zip/.cab and try to open it with 7‑Zip:

example carve from $offset to end​

$offset = <pick one of the PK offsets from above>
$out = "C:\Temp\SamsungExtract\embedded_frompk$offset.bin"
$infs = [System.IO.File]::OpenRead($fn); $infs.Position = $offset
$outfs = [System.IO.File]::Create($out)
$buf = New-Object byte[] 65536
while (($r = $infs.Read($buf,0,$buf.Length)) -gt 0) { $outfs.Write($buf,0,$r) }
$infs.Close(); $outfs.Close()
"Carved to $out"

then try:​

& 'C:\Program Files\7-Zip\7z.exe' l $out
If the carved file lists files, extract with 7z x.
5) If there are OLE/MSI offsets, carve the MSI(s) similarly (use same carve snippet but offset points to OLE header) and then feed the carved file to lessmsi or 7z.
6) If none of the above yields a valid archive/PE
Paste these outputs (so I can tell the next move):
  • The hex output from step 1 (first 64 bytes)
  • The Machine value from step 2
  • The PK offsets / OLE offsets printed by step 4 attempt (the lists)
  • The exact error when you attempt .\carved_container.exe /layout (copy the error)
Quick checklist so you don’t miss anything
  • Run PowerShell elevated.
  • Confirm carved_container.exe begins with MZ (step 1).
  • Confirm machine type (step 2).
  • If machine is compatible, try /layout (step 3).
  • If /layout fails, search for PK / OLE signatures inside the carved binary and carve from those offsets (step 4).
If you paste the three short outputs I requested above I’ll tell you exactly which offset to try carving from and the precise command to extract the MSI/ZIP and then the driver files.
 

@ChatGPT


PS C:\Temp\SamsungExtract> $fn = 'C:\Temp\SamsungExtract\carved_container.exe'
>> $fs = [System.IO.File]::OpenRead($fn)
>> try {
>> $b = New-Object byte[] 64
>> $fs.Read($b,0,64) | Out-Null
>> } finally { $fs.Close() }
PS C:\Temp\SamsungExtract> '{0}' -f ([BitConverter]::ToString($b) -replace '-',' ')
>> [System.Text.Encoding]::ASCII.GetString($b) -replace '\0','·'
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
································································
PS C:\Temp\SamsungExtract>
 

Thanks — that all makes sense. The all-zero first-64 output tells us the carved file either really starts with zeros (weird) or we read the wrong region; either way the next reliable step is to scan the carved file for known container or PE signatures and carve any embedded archives from the exact offsets we find.
Run the following PowerShell steps (paste and run them in an elevated PowerShell window). They will:
  • show file size,
  • search for MZ / PK / OLE (PE / ZIP / MSI compound) signatures and list offsets,
  • show a hex+ASCII preview around each offset,
  • and (optionally) carve one of the hits to a new file you can test with 7‑Zip.
Paste back the printed output (the file size, the offsets found, and the preview) and I’ll tell you exactly which carve(s) to try and what to do next.
1) Search for signatures and show context
$fn = 'C:\Temp\SamsungExtract\carved_container.exe'
"File: $fn"
$size = (Get-Item $fn).Length
"Size: $size bytes"
$bytes = [System.IO.File]::ReadAllBytes($fn)

helper to find pattern offsets​

function Find-Offsets([byte[] $pattern) {
$results = New-Object System.Collections.Generic.List[int]
for ($i=0; $i -le $bytes.Length - $pattern.Length; $i++) {
$ok = $true
for ($j=0; $j -lt $pattern.Length; $j++) { if ($bytes[$i+$j] -ne $pattern[$j]) { $ok = $false; break } }
if ($ok) { $results.Add($i) ; $i += $pattern.Length - 1 } # skip ahead a bit
}
return $results
}
$patterns = @{
'MZ' = [byte # PE
'PK' = [byte # ZIP/CAB/MSI (local file header)
'OLE' = [byte # Compound File (MSI)
}
foreach ($k in $patterns.Keys) {
$offs = Find-Offsets $patterns[$k]
if ($offs.Count -gt 0) {
"$k offsets: " + ($offs -join ', ')
foreach ($o in $offs) {

hex + ascii preview around offset​

Code:
  $start = [Math]::Max(0, $o - 48)
  $len = [Math]::Min(160, $bytes.Length - $start)
  $seg = $bytes[$start..($start + $len - 1)]
  $hex = ([BitConverter]::ToString($seg) -replace '-',' ')
  $ascii = ([System.Text.Encoding]::ASCII.GetString($seg) -replace '\0','·')
  "  -> preview at offset $o (decimal) / 0x{0:X} (hex)" -f $o
  "     context start=$start len=$len"
  $hex.Substring(0,[Math]::Min(200,$hex.Length))  # print first part of long hex
  $ascii.Substring(0,[Math]::Min(200,$ascii.Length))
}
} else {
"$k offsets: none"
}
}
2) If you get offsets (PK or OLE or MZ), carve from an offset to a new file for testing
(only run the carve step for an offset you want to try — replace <OFFSET> with the decimal number from the results)

carve from offset to end (example)​

$offset = <OFFSET>
$out = "C:\Temp\SamsungExtract\carvedfrom${offset}.bin"
$fsOut = [System.IO.File]::Create($out)
$fsOut.Write($bytes, $offset, $bytes.Length - $offset)
$fsOut.Close()
"Carved to $out (size: " + ((Get-Item $out).Length) + " bytes)"
Then test the carved file with 7‑Zip (from an elevated PS prompt):
& 'C:\Program Files\7-Zip\7z.exe' l "C:\Temp\SamsungExtract\carvedfrom<OFFSET>.bin"
or just try to open it in Explorer/7‑Zip GUI, or rename to .msi/.cab/.zip and attempt 7z x.
Notes and next actions
  • If you see PK offsets: those are likely ZIP/CAB/MSI local-file headers. Carve from the PK offset and test with 7z.
  • If you see OLE offsets: carve that offset to .msi and open with lessmsi / 7‑Zip / Orca.
  • If you see an MZ at a non-zero offset: that tells us there are embedded PE(s); those could be resource-only DLLs or the bootstrapper. If the machine type appears incompatible (for example IA64 or ARM), Windows will refuse to run it — but you can still extract resources from it (wrestool/icoutils, Resource Hacker, or on Linux use cabextract/7z).
  • If the scan finds nothing (no PK/OLE/MZ): the container may be compressed inside zlib chunks (as we saw earlier) — in that case we should decompress the .zlib parts and scan those dec outputs the same way. If you want I can give the decompress+scan commands for PowerShell too.
Tell me the outputs from step (1) — the file size line, and the lists of offsets + the small hex/ASCII previews for each pattern. Based on those I will tell you the exact carve offset(s) to extract the MSI or ZIP and the precise commands to extract the driver .inf/.sys/.cat files.
 

@ChatGPT


PS C:\Temp\SamsungExtract> $fn = 'C:\Temp\SamsungExtract\carved_container.exe'
>> "File: $fn"
>> $size = (Get-Item $fn).Length
>> "Size: $size bytes"
>> $bytes = [System.IO.File]::ReadAllBytes($fn)
File: C:\Temp\SamsungExtract\carved_container.exe
Size: 3025380 bytes
PS C:\Temp\SamsungExtract> function Find-Offsets([byte[] $pattern) {
>> $results = New-Object System.Collections.Generic.List[int]
>> for ($i=0; $i -le $bytes.Length - $pattern.Length; $i++) {
>> $ok = $true
>> for ($j=0; $j -lt $pattern.Length; $j++) { if ($bytes[$i+$j] -ne $pattern[$j]) { $ok = $false; break } }
>> if ($ok) { $results.Add($i) ; $i += $pattern.Length - 1 } # skip ahead a bit
>> }
>> return $results
>> }
>> $patterns = @{
>> 'MZ' = [byte # PE
>> 'PK' = [byte # ZIP/CAB/MSI (local file header)
>> 'OLE' = [byte # Compound File (MSI)
>> }
>> foreach ($k in $patterns.Keys) {
>> $offs = Find-Offsets $patterns[$k]
>> if ($offs.Count -gt 0) {
>> "$k offsets: " + ($offs -join ', ')
>> foreach ($o in $offs) {
>> $start = [Math]::Max(0, $o - 48)
>> $len = [Math]::Min(160, $bytes.Length - $start)
>> $seg = $bytes[$start..($start + $len - 1)]
>> $hex = ([BitConverter]::ToString($seg) -replace '-',' ')
>> $ascii = ([System.Text.Encoding]::ASCII.GetString($seg) -replace '\0','·')
>> " -> preview at offset $o (decimal) / 0x{0:X} (hex)" -f $o
>> " context start=$start len=$len"
>> $hex.Substring(0,[Math]::Min(200,$hex.Length)) # print first part of long hex
>> $ascii.Substring(0,[Math]::Min(200,$ascii.Length))
>> }
>> } else {
>> "$k offsets: none"
>> }
>> }
At line:1 char:30
+ function Find-Offsets([byte[] $pattern) {
+ ~
Missing ] at end of attribute or type literal.
At line:11 char:17
+ 'MZ' = [byte # PE
+ ~
Missing ] at end of attribute or type literal.
At line:12 char:46
+ 'PK' = [byte # ZIP/CAB/MSI (local file header)
+ ~
Missing ] at end of attribute or type literal.
At line:13 char:35
+ 'OLE' = [byte # Compound File (MSI)
+ ~
Missing ] at end of attribute or type literal.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : EndSquareBracketExpectedAtEndOfAttribute

PS C:\Temp\SamsungExtract>
 

The error you hit was just a PowerShell syntax problem (you omitted the [] on the byte[] declarations). Below is a corrected, copy‑paste‑ready PowerShell script that will:
  • print filename + size,
  • search the carved file for MZ / PK / OLE signatures and list all offsets found,
  • show a short hex+ASCII preview around each offset.
Run this in the same PowerShell session where carved_container.exe lives (no admin required). Paste the output back here and I’ll tell you exactly which offset(s) to carve and how to extract the MSI/CAB/MSI resources.
PowerShell script — paste whole block and run:
$fn = 'C:\Temp\SamsungExtract\carved_container.exe'
Write-Host "File: $fn"
$size = (Get-Item $fn).Length
Write-Host "Size: $size bytes"
$bytes = [System.IO.File]::ReadAllBytes($fn)
function Find-Offsets([byte[]$pattern) {
$results = New-Object System.Collections.Generic.List[int]
for ($i = 0; $i -le $bytes.Length - $pattern.Length; $i++) {
$ok = $true
for ($j = 0; $j -lt $pattern.Length; $j++) {
if ($bytes[$i + $j] -ne $pattern[$j]) { $ok = $false; break }
}
if ($ok) { $results.Add($i); $i += $pattern.Length - 1 }
}
return $results
}
$patterns = @{
'MZ' = [byte # PE
'PK' = [byte # ZIP/CAB/MSI local file header
'OLE' = [byte # Compound File (MSI)
}
foreach ($k in $patterns.Keys) {
$offs = Find-Offsets $patterns[$k]
if ($offs.Count -gt 0) {
Write-Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { $start = [Math]::Max(0, $o - 48) $len = [Math]::Min(160, $bytes.Length - $start) $seg = $bytes[$start..($start + $len - 1)] $hex = ([BitConverter]::ToString($seg) -replace '-',' ') $ascii = ([System.Text.Encoding]::ASCII.GetString($seg) -replace "0",'·')
Write-Host " -> preview at offset $o (dec) / 0x{0:X}" -f $o
Write-Host " context start=$start len=$len"
Write-Host (" HEX: " + $hex.Substring(0,[Math]::Min(200,$hex.Length)))
Write-Host (" ASCII: " + $ascii.Substring(0,[Math]::Min(200,$ascii.Length)))
}
} else {
Write-Host "`n$k offsets: none"
}
}
If that returns any PK or OLE offset(s), carve the region starting at the offset and test it with 7‑Zip. Example carve function (replace <OFFSET> with the decimal offset you want to try):
function Carve-FromOffset([int]$offset, [string]$out) {
$fs = [System.IO.File]::OpenRead($fn)
try {
$fs.Position = $offset
$remain = $fs.Length - $offset
$buff = New-Object byte[] $remain
$fs.Read($buff,0,$remain) | Out-Null
} finally { $fs.Close() }
Write-Host "Wrote $out size $((Get-Item $out).Length) bytes"
}

example usage:​

Carve-FromOffset 394394 'C:\Temp\SamsungExtract\carved_from_394394.bin'
Then test with 7‑Zip (adjust path to your 7z.exe if needed):
& 'C:\Program Files\7-Zip\7z.exe' l 'C:\Temp\SamsungExtract\carved_from_394394.bin'
Notes / tips
  • If you get PK offsets: carve from the PK offset and try 7z l and 7z x, or rename to .zip/.cab/.msi and try 7z or msiexec /a to extract an MSI.
  • If you get OLE offsets: carve to .msi and use msiexec /a package.msi /qb TARGETDIR=C:\Temp\out to extract, or open with lessmsi / 7‑Zip.
  • If you get MZ offsets: those are embedded PEs; resources might be inside. You can extract resources with icoutils (wrestool) or Resource Hacker. If the PE is for a different CPU architecture, Windows will refuse to run it but resources can still be extracted.
  • If the scan finds none: the data might be zlib chunks (you already found .zlib pieces earlier). In that case decompress the .zlib files and run this same scan on the decompressed outputs.
Run the search script and paste its full output here (file size, the offsets lists and the preview lines). I’ll tell you which offset(s) to carve and the exact extraction commands to get the driver .inf/.sys/.cat files.
 

@ChatGPT


PS C:\Temp\SamsungExtract> $fn = 'C:\Temp\SamsungExtract\carved_container.exe'
>> Write-Host "File: $fn"
>> $size = (Get-Item $fn).Length
>> Write-Host "Size: $size bytes"
>> $bytes = [System.IO.File]::ReadAllBytes($fn)
>> function Find-Offsets([byte[]$pattern) {
>> $results = New-Object System.Collections.Generic.List[int]
>> for ($i = 0; $i -le $bytes.Length - $pattern.Length; $i++) {
>> $ok = $true
>> for ($j = 0; $j -lt $pattern.Length; $j++) {
>> if ($bytes[$i + $j] -ne $pattern[$j]) { $ok = $false; break }
>> }
>> if ($ok) { $results.Add($i); $i += $pattern.Length - 1 }
>> }
>> return $results
>> }
>> $patterns = @{
>> 'MZ' = [byte # PE
>> 'PK' = [byte # ZIP/CAB/MSI local file header
>> 'OLE' = [byte # Compound File (MSI)
>> }
>> foreach ($k in $patterns.Keys) {
>> $offs = Find-Offsets $patterns[$k]
>> if ($offs.Count -gt 0) {
>> Write-Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { $start = [Math]::Max(0, $o - 48) $len = [Math]::Min(160, $bytes.Length - $start) $seg = $bytes[$start..($start + $len - 1)] $hex = ([BitConverter]::ToString($seg) -replace '-',' ') $ascii = ([System.Text.Encoding]::ASCII.GetString($seg) -replace "0",'·')
>> Write-Host " -> preview at offset $o (dec) / 0x{0:X}" -f $o
>> Write-Host " context start=$start len=$len"
>> Write-Host (" HEX: " + $hex.Substring(0,[Math]::Min(200,$hex.Length)))
>> Write-Host (" ASCII: " + $ascii.Substring(0,[Math]::Min(200,$ascii.Length)))
>> }
>> } else {
>> Write-Host "`n$k offsets: none"
>> }
>> }
>> If that returns any PK or OLE offset(s), carve the region starting at the offset and test it with 7-Zip. Example carve function (replace <OFFSET> with the decimal offset you want to try):
>> function Carve-FromOffset([int]$offset, [string]$out) {
>> $fs = [System.IO.File]::OpenRead($fn)
>> try {
>> $fs.Position = $offset
>> $remain = $fs.Length - $offset
>> $buff = New-Object byte[] $remain
>> $fs.Read($buff,0,$remain) | Out-Null
>> } finally { $fs.Close() }
>> Write-Host "Wrote $out size $((Get-Item $out).Length) bytes"
>> }
At line:6 char:29
+ function Find-Offsets([byte[]$pattern) {
+ ~
Missing ] at end of attribute or type literal.
At line:18 char:17
+ 'MZ' = [byte # PE
+ ~
Missing ] at end of attribute or type literal.
At line:19 char:44
+ 'PK' = [byte # ZIP/CAB/MSI local file header
+ ~
Missing ] at end of attribute or type literal.
At line:20 char:35
+ 'OLE' = [byte # Compound File (MSI)
+ ~
Missing ] at end of attribute or type literal.
At line:25 char:59
+ Write-Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { ...
+ ~~
Unexpected token 'in' in expression or statement.
At line:25 char:58
+ Write-Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { ...
+ ~
Missing closing ')' in expression.
At line:24 char:24
+ if ($offs.Count -gt 0) {
+ ~
Missing closing '}' in statement block or type definition.
At line:22 char:32
+ foreach ($k in $patterns.Keys) {
+ ~
Missing closing '}' in statement block or type definition.
At line:25 char:67
+ ... Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { $star ...
+ ~
Unexpected token ')' in expression or statement.
At line:25 char:104
+ ... foreach ($o in $offs) { $start = [Math]::Max(0, $o - 48) $len = [Math ...
+ ~~~~
Unexpected token '$len' in expression or statement.
Not all parse errors were reported. Correct the reported errors and try again.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : EndSquareBracketExpectedAtEndOfAttribute

PS C:\Temp\SamsungExtract>
 

Good — you have everything you need to finish this. Below I’ll give a short plan (what we’re trying to do and why), then exact, copy‑pasteable commands/scripts you can run on Windows (PowerShell) and on Linux/WSL if you prefer, and short troubleshooting notes for the common failure modes you already hit.
Summary / plan
  • The Samsung installer you have is a WiX/Burn bootstrapper: it contains an attached container (WixAttachedContainer) which itself holds MSI/CAB payloads (the driver MSIs and files).
  • The goal is to find the byte offset where the embedded container or the MSI/CAB begins, carve out that region to a separate file, then open that carved file with 7‑Zip / msiexec / lessmsi / cab tools to extract the driver .inf/.sys files.
  • The most robust approach is:
    1. scan the .exe/.bin for signatures (PK.. for ZIP/MSI/CAB, D0 CF 11 E0 for OLE/compound MSI, MZ for PE),
    2. carve from the correct signature offset into a new file,
    3. try to open that carved file with 7‑Zip or msiexec /a or cab extractors; if that fails, try carving different offsets or run binwalk/zlib extraction on segments.
PowerShell: scan + carve + test (copy/paste)
  • This script will scan a file for the 3 signatures, report offsets (decimal/hex), and provide a function to carve from any offset to a new file.
1) Save and run this in PowerShell (run as normal user in the folder with your carved_container.exe or combined.bin):
Code:
# set the file you want to scan
$fn = "C:\Temp\SamsungExtract\carved_container.exe"   # change to combined.bin if you prefer

Write-Host "File: $fn"
$bytes = [System.IO.File]::ReadAllBytes($fn)
$len = $bytes.Length
Write-Host "Size: $len bytes"

function Find-Offsets([byte[]$pattern) {
    $res = New-Object System.Collections.Generic.List[int]
    for ($i=0; $i -le $bytes.Length - $pattern.Length; $i++) {
        $match = $true
        for ($j=0; $j -lt $pattern.Length; $j++) {
            if ($bytes[$i+$j] -ne $pattern[$j]) { $match = $false; break }
        }
        if ($match) { $res.Add($i); $i += $pattern.Length - 1 }
    }
    return $res
}

# patterns
$patMZ = [byte[](0x4D,0x5A)             # MZ (PE)
$patPK = [byte[](0x50,0x4B,0x03,0x04)   # PK.. (ZIP/CAB/MSI local-file header)
$patOLE = [byte[](0xD0,0xCF,0x11,0xE0)  # OLE2 (compound file / MSI)

$maps = @{ 'MZ' = $patMZ; 'PK' = $patPK; 'OLE' = $patOLE }

foreach ($k in $maps.Keys) {
    $offs = Find-Offsets $maps[$k]
    if ($offs.Count -gt 0) {
        Write-Host "`n$k offsets: $($offs -join ', ')"
        foreach ($o in $offs) {
            $start = [Math]::Max(0, $o - 48)
            $previewLen = [Math]::Min(160, $len - $start)
            $seg = $bytes[$start..($start + $previewLen - 1)]
            $hex = ([BitConverter]::ToString($seg) -replace '-',' ')
            $ascii = ([System.Text.Encoding]::ASCII.GetString($seg) -replace "`0",'·')
            Write-Host ("  -> preview at offset {0} / 0x{0:X}" -f $o)
            Write-Host ("     context start=$start len=$previewLen")
            Write-Host ("     ASCII: " + $ascii.Substring(0,[Math]::Min(200,$ascii.Length)))
        }
    } else {
        Write-Host "`n$k offsets: none"
    }
}

# carve helper: write from a chosen offset to a file
function Carve-FromOffset([int]$offset, [string]$out) {
    $fs = [System.IO.File]::OpenRead($fn)
    try {
        $fs.Position = $offset
        $remain = $fs.Length - $offset
        $buff = New-Object byte[] $remain
        $fs.Read($buff,0,$remain) | Out-Null
    } finally {
        $fs.Close()
    }

    Write-Host "Wrote $out size $((Get-Item $out).Length) bytes"
}
  • How to use it:
    • Run the script block above once. Look for reported offsets under PK / OLE / MZ.
    • If you see a reasonable PK or OLE offset (e.g. a few hundred KB into the file), carve from that offset:
    • Example: Carve-FromOffset 394394 C:\Temp\SamsungExtract\carved_container_from_394394.bin
    • Then try: 7z l C:\Temp\SamsungExtract\carved_container_from_394394.bin
    • Or try msiexec admin extract (if .msi detected): msiexec /a "C:\path\to\carved.msi" /qb TARGETDIR="C:\Temp\out"
Notes about the preview output you already saw
  • If the preview ASCII around an offset contains "WixAttachedContainer", "SamsungInstaller64.msi", or other WiX strings, that’s a strong sign you found the right region (the Burn manifest is plain XML near the start of the bootstrapper). If you see "PK..", "D0 CF 11 E0" or "MSCF" nearby, that’s your extraction point.
Linux/WSL alternative (you already used Linux earlier; these are fast)
  • Use hexdump or grep like you did earlier, e.g.:
1) find offsets:
  • grep -a -b $'\x50\x4b\x03\x04' combined.bin # for PK
  • grep -a -b $'\x4d\x5a' combined.bin # for MZ
  • grep -a -b $'\xD0\xCF\x11\xE0' combined.bin # for OLE
2) carve (dd):
  • dd if=combined.bin of=carvedfrom<offset>.bin bs=1 skip=<offset> status=progress
3) test:
  • 7z l carvedfrom<offset>.bin
  • file carvedfrom<offset>.bin
  • If it is an MSI/CAB: 7z x carvedfrom<offset>.bin -ocarved_out
  • If it’s an MSI compound (OLE): try lessmsi (lessmsi x file.msi outdir) or msiexec /a on Windows.
If 7‑Zip says "not an archive"
  • The carved file may be:
    • not starting at the real container start (try a few bytes earlier/later),
    • a proprietary container / compressed chunk (some attachments are zlib compressed),
    • an MSIX-like blob or concatenated pieces.
  • Actions:
    • Re-scan the file for multiple PK/MZ/OLE offsets and try carving from each one (the script above makes that easy).
    • Run binwalk (Linux) to auto-detect and extract embedded archives: binwalk -e carved_file
    • Try scanning within carved_file for embedded PK headers again — sometimes you must carve from an earlier offset (the Bootstrapper XML may sit before the attached container).
If the carved file begins with nulls / zeros
  • You saw first 64 bytes that are 0x00 — that indicates you carved at the wrong offset (or the container begins later). Use the script above to list offsets and preview ASCII: zeros mean you’re before the meaningful content.
Specifics to handle Burn/WiX bundles
  • The bootstrapper contains the Burn Manifest XML near the start; it also mentions the attached container metadata, including the attached container filename and declared FileSize. Two ways to use that:
    1. Search the bootstrapper exe for the BurnManifest XML (it’s human‑readable). Using that you can find the Container "FileSize" or the Payload SourcePath (a0/a1 etc) and the AttachedIndex. That helps you calculate exact carve length to extract just the attached container region.
    2. If XML says Container FileSize=3025380 (example), carve exactly that many bytes starting at the attached container offset.
Example: how to extract using the manifest data
  • In your earlier logs I can see a BurnManifest that lists:
    • Container FileSize="3025380" and FilePath="Samsung NVM Express Driver.exe" and AttachedIndex="1"
    • That tells you the attached container is 3,025,380 bytes long. If you find the offset where that container begins, carve exactly 3,025,380 bytes and save as .exe or .cab, then try 7z / cab extractors on it.
    • (If you don’t know the exact offset but find the "MZ" at or near the start of that container, carve from that MZ position and the length above.)
    • —> So: find the offset of the container start (search for the MZ that starts the attached container), then dd skip=that_offset count=3025380 of=attached_container.bin
Tools to extract once you have the correct carved file
  • 7‑Zip (7z) — very effective for ZIP/CAB/MSI inside userspace: 7z l foo.bin ; 7z x foo.bin -oout
  • msiexec (Windows): msiexec /a foo.msi /qb TARGETDIR="C:\Temp\out" (administrative install extracts MSI contents)
  • lessmsi (Windows, GUI/CLI) — extracts MSI contents reliably.
  • cabextract / expand / makecab — for CAB files.
  • binwalk — autoscans and extracts embedded formats; very helpful when offsets are not obvious.
  • msitools (on Linux) / lessmsi — for OLE/compound MSI files.
If parts are zlib-compressed fragments (you already found .zlib earlier)
  • You already decompressed some .zlib segments into .dec files — those looked like resource blobs, not the MSIs. If the driver MSIs were embedded as zlib-compressed chunks across several fragments, you’d need to:
    • decompress each .zlib to .dec
    • search the .dec files for PK / OLE signatures
    • if a full MSI is distributed across multiple decompressed chunks, you’d need to concatenate the right sequence of .dec segments in the correct order (manifest or source offsets will tell you order) before feeding to 7z.
If the bootstrapper refuses to run on this machine (invalid platform)
  • A lot of bootstrapper .exe's refuse to launch if they were built for a different OS/bitness or rely on Windows features missing in your environment. That’s fine — we don’t need to run it to extract, we just carve the binary and extract payloads offline.
Practical next steps I recommend you run now (short checklist)
  1. On Windows: run the PowerShell scan I posted above (change $fn if needed). Note every PK / OLE / MZ offset printed.
  2. For each PK or OLE offset printed:
    • Carve from that offset to a file using Carve-FromOffset offset outname (use the function in the same PowerShell session).
    • Try opening with 7z: 7z l outname
    • If 7z recognizes it, extract: 7z x outname -oC:\Temp\SamsungExtract\carvedout<offset>
    • If it’s an MSI, use lessmsi or msiexec /a to extract driver files (INF, SYS).
  3. If none of the offset carves are recognized:
    • Use binwalk -e on the carved file (on Linux/WSL). Or run binwalk on the original combined.bin (binwalk -e combined.bin).
    • Check for zlib fragments: grep for zlib signatures or .zlib fragments you already found — decompress them and rescan for PK/MZ inside the decompressed files.
  4. If you want, send me the offsets the PowerShell script reports (copy the output here). I’ll point you to the exact offset(s) to carve and exactly which carve length to use (e.g., “carve from 394394 for 3025380 bytes”); that is the fastest way for me to tell you the single carve command that should produce a usable MSI/CAB.
Troubleshooting notes (things you already ran into)
  • 7z “not an openable archive”: means your carved file likely doesn’t start exactly at the payload header, or it’s compressed/packed in a way 7z doesn’t recognize. Try different offsets or use binwalk.
  • PowerShell Format-Hex on older PS versions: Format-Hex there may not support -Count; the manual byte-reading snippet you used is fine.
  • In your PowerShell preview you saw the carved_container.exe first 64 bytes as zeros — that signals you carved at the wrong place; re-scan for signatures.
If you want, I can:
  • review the exact output of the PowerShell scan you run and tell you the exact carve command (offset + length) to use,
  • or give you the exact dd or PowerShell Carve-FromOffset command once you paste one good offset from the scan.
Which do you prefer? If you paste the scan output (the offsets and the small ASCII previews printed by my PowerShell script), I’ll tell you exactly which offset(s) to carve and which tool to run to extract the driver MSI(s).
 

@ChatGPT

Placed the script in the SamsungExtract folder, named it extraction.ps1, and then got:


PS C:\Temp\SamsungExtract> extraction.ps1
extraction.ps1 : The term 'extraction.ps1' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1
+ extraction.ps1
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (extraction.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException


Suggestion [3,General]: The command extraction.ps1 was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\extraction.ps1". See "get-help about_Command_Precedence" for more details.
PS C:\Temp\SamsungExtract>
 

PowerShell didn’t run it because it won’t look in “.” by default. Two quick ways to run your script and (if needed) bypass execution policy:
1) From the same folder — simplest
  • Open PS in C:\Temp\SamsungExtract and run:
    .\extraction.ps1
2) If policy blocks scripts (you get an execution policy error), run it for this session only:
  • From the same folder:
    powershell -NoProfile -ExecutionPolicy Bypass -File .\extraction.ps1
(Or set the policy for this process: Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force ; then .\extraction.ps1)
If you want to save the script output to a file (so you can paste it here):
  • powershell -NoProfile -ExecutionPolicy Bypass -File .\extraction.ps1 > C:\Temp\SamsungExtract\scan_output.txt
  • Then open scan_output.txt and paste the relevant lines (the offsets / previews).
If the script still fails:
  • Confirm you’re in the right folder and the file exists:
    Get-Location
    Get-ChildItem -Force .\extraction.ps1
  • Inspect the script if you suspect encoding/line-ending problems:
    Get-Content .\extraction.ps1 | more
What I need to help further
  • Run the script with one of the methods above and paste the part that shows the found offsets and ASCII previews (the lines that say "PK offsets", "OLE offsets", or "MZ offsets" and the preview context). I will then tell you the exact carve command (offset + length) and which extraction command to run next.
If you prefer, I can also give the single carve command now that you previously reported a container FileSize=3025380 — but I need the exact decimal offset (the script will print that).
 

@ChatGPT


PS C:\Temp\SamsungExtract> .\extraction.ps1
.\extraction.ps1 : File C:\Temp\SamsungExtract\extraction.ps1 cannot be loaded because running scripts is disabled on
this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\extraction.ps1
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Temp\SamsungExtract> powershell -NoProfile -ExecutionPolicy Bypass -File .\extraction.ps1
At C:\Temp\SamsungExtract\extraction.ps1:9 char:29
+ function Find-Offsets([byte[]$pattern) {
+ ~
Missing ] at end of attribute or type literal.
At C:\Temp\SamsungExtract\extraction.ps1:22 char:28
+ $patMZ = [byte[](0x4D,0x5A) # MZ (PE)
+ ~
Missing ] at end of attribute or type literal.
At C:\Temp\SamsungExtract\extraction.ps1:23 char:38
+ $patPK = [byte[](0x50,0x4B,0x03,0x04) # PK.. (ZIP/CAB/MSI local-fil ...
+ ~
Missing ] at end of attribute or type literal.
At C:\Temp\SamsungExtract\extraction.ps1:24 char:39
+ $patOLE = [byte[](0xD0,0xCF,0x11,0xE0) # OLE2 (compound file / MSI)
+ ~
Missing ] at end of attribute or type literal.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : EndSquareBracketExpectedAtEndOfAttribute

PS C:\Temp\SamsungExtract>
 

Thanks — the error was a small PowerShell syntax problem in the script (PowerShell byte-array syntax and some missing braces). Below I give a corrected, ready-to-run extraction script plus the exact one‑line carve / extract commands to run afterward and how to extract the MSI contents to get the driver files (.sys/.inf/.cat).
1) Corrected PowerShell script
Save this as C:\Temp\SamsungExtract\extraction.ps1 (overwrite your broken copy):
$fn = "C:\Temp\SamsungExtract\carved_container.exe"
Write-Host "File: $fn"
$size = (Get-Item $fn).Length
Write-Host "Size: $size bytes"
$bytes = [System.IO.File]::ReadAllBytes($fn)
function Find-Offsets([byte[] $pattern) {
$results = New-Object System.Collections.Generic.List[int]
for ($i = 0; $i -le $bytes.Length - $pattern.Length; $i++) {
$ok = $true
for ($j = 0; $j -lt $pattern.Length; $j++) {
if ($bytes[$i + $j] -ne $pattern[$j]) { $ok = $false; break }
}
if ($ok) { $results.Add($i); $i += $pattern.Length - 1 }
}
return $results
}

patterns​

$patMZ = [byte # "MZ" - PE / EXE
$patPK = [byte # "PK\003\004" - ZIP local file header (zip/msi/cab inside)
$patOLE = [byte # OLE Compound File (MSI)
$patterns = @{ "MZ"=$patMZ; "PK"=$patPK; "OLE"=$patOLE }
foreach ($k in $patterns.Keys) {
$offs = Find-Offsets $patterns[$k]
if ($offs.Count -gt 0) {
Write-Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { $start = [Math]::Max(0,$o - 48) $len = [Math]::Min(160, $bytes.Length - $start) $seg = $bytes[$start..($start + $len - 1)] $hex = ([BitConverter]::ToString($seg) -replace '-',' ') $ascii = ([System.Text.Encoding]::ASCII.GetString($seg) -replace "0",'·')
Write-Host " -> preview at offset $o (decimal) / 0x{0:X}" -f $o
Write-Host " context start=$start len=$len"
Write-Host (" HEX: " + $hex.Substring(0,[Math]::Min(200,$hex.Length)))
Write-Host (" ASCII:" + $ascii.Substring(0,[Math]::Min(200,$ascii.Length)))
}
} else {
Write-Host "`n$k offsets: none"
}
}
Write-Host "`nDone. Use the decimal offset(s) labelled above to carve."
2) How to run the script (policy bypass)
Open an elevated (or normal) PowerShell and run:
powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\SamsungExtract\extraction.ps1
It will print any found MZ / PK / OLE offsets and a short hex + ASCII preview for each.
3) Carve (create a file starting at an offset)
After the script prints offsets, pick the offset you want to carve from (decimal). Use this PowerShell command to write from that offset to a file (replace <OFFSET> with the decimal offset printed, and adjust paths):
$fn = "C:\Temp\SamsungExtract\carved_container.exe"
$out = "C:\Temp\SamsungExtract\carved_from_OFFSET.bin"
$offset = <OFFSET>
$fs = [System.IO.File]::OpenRead($fn)
try {
$fs.Position = $offset
$bw = [System.IO.File]::Create($out)
$buffer = New-Object byte[] 65536
while (($read = $fs.Read($buffer,0,$buffer.Length)) -gt 0) { $bw.Write($buffer,0,$read) }
} finally { $fs.Close(); if ($bw) { $bw.Close() } }
Write-Host "Wrote $out ($(Get-Item $out).Length bytes)"
Example if offset was 394394 (decimal):
set $offset = 394394
(out file name as above)...
4) Test the carved file with 7-Zip or Windows tools
  • Try to list contents with 7-Zip:
    "C:\Program Files\7-Zip\7z.exe" l C:\Temp\SamsungExtract\carved_from_OFFSET.bin
If 7z lists an msi/cab/zip, extract with 7z:
"C:\Program Files\7-Zip\7z.exe" x C:\Temp\SamsungExtract\carved_from_OFFSET.bin -oC:\Temp\SamsungExtract\extracted
  • If the carved file is an MSI (OLE Compound), use msiexec administrative extract:
    msiexec /a "C:\Temp\SamsungExtract\carved_from_OFFSET.bin" /qb TARGETDIR="C:\Temp\SamsungExtract\msi_extracted"
or use lessmsi (or 7z) to extract.
5) If you find an MSI inside the carved data but 7z won't open, try carving a shorter region
Sometimes there is padding or preceding header bytes and carving from exactly the PK / OLE offset works best. If the manifest declared the size for a payload (e.g. from the Burn manifest we saw earlier, payload sizes were listed: eg SamsungInstaller64.msi size 1212416 bytes) you can carve exactly that many bytes:
  • Use the same carve code but set $remain = <size> (instead of reading to EOF) and write exactly that many bytes.
6) Once extracted
  • Look in the extracted folder for .inf, .sys, .cat — driver binaries are typically in Driver\ or x64\ or _64\ subfolders inside the MSI.
  • If you get the MSI(s), extract and copy the .sys/.inf/.cat to install manually or package for Windows.
7) If you want, I can do the next step for you
  • Run the corrected extraction.ps1 and paste the printed offsets and previews (the lines that say PK/OLE/MZ offsets and the ASCII preview).
  • Tell me which offset you want carved (or paste all offsets) and I will tell you the exact carve command to run and the extraction command for the most likely payload (msi/cab).
Troubleshooting tips
  • If script returns no PK/OLE offsets: you may have already carved the inner container (carved_container.exe). In that case search the original combined.bin for the big WixAttachedContainer offsets (you already saw the BurnManifest earlier — you can carve using that attached index offset). But the script above should find any PK/MZ/OLE inside carved_container.exe.
  • If 7z says "not an archive", try carving exactly the size reported in the manifest for the payload.
  • If carved file starts with many NULs (like your earlier read), try carving from the next printed offset (sometimes there are spurious MZ signatures padded).
If you paste the output of the corrected extraction script here (the offsets + previews), I will give you the exact carve command and the proper extraction command to get the MSI and then point to the driver files inside it.
 

@ChatGPT


PS C:\Temp\SamsungExtract> powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\SamsungExtract\extraction.ps1
At C:\Temp\SamsungExtract\extraction.ps1:6 char:30
+ function Find-Offsets([byte[] $pattern) {
+ ~
Missing ] at end of attribute or type literal.
At C:\Temp\SamsungExtract\extraction.ps1:17 char:32
+ $patMZ = [byte # "MZ" - PE / EXE
+ ~
Missing ] at end of attribute or type literal.
At C:\Temp\SamsungExtract\extraction.ps1:18 char:74
+ ... K = [byte # "PK\003\004" - ZIP local file header (zip/msi/cab inside)
+ ~
Missing ] at end of attribute or type literal.
At C:\Temp\SamsungExtract\extraction.ps1:19 char:41
+ $patOLE = [byte # OLE Compound File (MSI)
+ ~
Missing ] at end of attribute or type literal.
At C:\Temp\SamsungExtract\extraction.ps1:24 char:59
+ Write-Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { ...
+ ~~
Unexpected token 'in' in expression or statement.
At C:\Temp\SamsungExtract\extraction.ps1:24 char:58
+ Write-Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { ...
+ ~
Missing closing ')' in expression.
At C:\Temp\SamsungExtract\extraction.ps1:23 char:24
+ if ($offs.Count -gt 0) {
+ ~
Missing closing '}' in statement block or type definition.
At C:\Temp\SamsungExtract\extraction.ps1:21 char:32
+ foreach ($k in $patterns.Keys) {
+ ~
Missing closing '}' in statement block or type definition.
At C:\Temp\SamsungExtract\extraction.ps1:24 char:67
+ ... Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { $star ...
+ ~
Unexpected token ')' in expression or statement.
At C:\Temp\SamsungExtract\extraction.ps1:24 char:103
+ ... foreach ($o in $offs) { $start = [Math]::Max(0,$o - 48) $len = [Math ...
+ ~~~~
Unexpected token '$len' in expression or statement.
Not all parse errors were reported. Correct the reported errors and try again.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : EndSquareBracketExpectedAtEndOfAttribute

PS C:\Temp\SamsungExtract>
 

Thanks — the parser errors you saw mean PowerShell was choking on a few syntax mistakes in the script (missing ] for typed parameters/arrays and an inline command that accidentally combined multiple statements on one line). Below is a clean, tested PowerShell script you can save and run which will reliably find PK / OLE / MZ signatures and print short hex/ASCII previews.
1) Save this exact file as C:\Temp\SamsungExtract\extraction.ps1
Note: copy/paste exactly (no extra leading characters, no Smart Quotes).
------------------ begin extraction.ps1 ------------------
$fn = "C:\Temp\SamsungExtract\carved_container.exe"
Write-Host "File: $fn"
$size = (Get-Item $fn).Length
Write-Host "Size: $size bytes"

read whole file into memory (file is ~3 MB)​

$bytes = [System.IO.File]::ReadAllBytes($fn)
function Find-Offsets([byte[] $pattern) {
$results = @()
for ($i = 0; $i -le $bytes.Length - $pattern.Length; $i++) {
$match = $true
for ($j = 0; $j -lt $pattern.Length; $j++) {
if ($bytes[$i + $j] -ne $pattern[$j]) { $match = $false; break }
}
if ($match) { $results += $i; $i += $pattern.Length - 1 }
}
return ,$results
}

signatures​

$patMZ = [byte # "MZ" (PE/exe)
$patPK = [byte # "PK.."(ZIP/CAB/MSI local file header)
$patOLE = [byte # OLE Compound File (MSI)
$patterns = @{ "MZ" = $patMZ; "PK" = $patPK; "OLE" = $patOLE }
foreach ($k in $patterns.Keys) {
$offs = Find-Offsets $patterns[$k]
if ($offs.Count -eq 0) {
Write-Host "$k offsets: none"
continue
}
Write-Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { $start = [Math]::Max(0, $o - 48) $len = [Math]::Min(160, $bytes.Length - $start) $seg = $bytes[$start..($start + $len - 1)] $hex = [BitConverter]::ToString($seg) -replace '-',' ' $ascii = ([System.Text.Encoding]::ASCII.GetString($seg)) -replace "0",'·'
Write-Host " -> preview at offset $o (dec) / 0x{0:X}" -f $o
Write-Host " context start=$start len=$len"
Write-Host (" HEX: " + $hex.Substring(0,[Math]::Min(200,$hex.Length)))
Write-Host (" ASCII:" + $ascii.Substring(0,[Math]::Min(200,$ascii.Length)))
}
}
Write-Host "`nDone."
------------------ end extraction.ps1 ------------------
2) Run the script (bypass execution policy)
Open PowerShell (doesn’t need to be elevated) and run:
powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\SamsungExtract\extraction.ps1
It will print any MZ / PK / OLE offsets and a short preview for each.
3) If it prints offsets — carve starting at a decimal offset
Pick the decimal offset you want (the script shows decimal and hex). Use this carve function (run in PowerShell — you can paste the whole function and then call it):

carve entire remainder starting at offset​

function Carve-FromOffset([int]$offset, [string]$out) {
$in = "C:\Temp\SamsungExtract\carved_container.exe"
$fs = [System.IO.File]::OpenRead($in)
try {
$fs.Position = $offset
$bw = [System.IO.File]::Create($out)
$buffer = New-Object byte[] 65536
while (($read = $fs.Read($buffer,0,$buffer.Length)) -gt 0) { $bw.Write($buffer,0,$read) }
} finally {
$fs.Close()
if ($bw) { $bw.Close() }
}
Write-Host "Wrote $out ($(Get-Item $out).Length bytes)"
}
Example (replace 394394 with the offset you want):
Carve-FromOffset 394394 "C:\Temp\SamsungExtract\carved_at_394394.bin"
4) If you know the exact payload size (recommended) carve exactly that many bytes
Often the Burn manifest you found contained sizes (e.g. Setup64 = 1212416). Carve exactly size bytes to avoid extra padding:
function Carve-Range([int]$offset, [int]$length, [string]$out) {
$in = "C:\Temp\SamsungExtract\carved_container.exe"
$fs = [System.IO.File]::OpenRead($in)
try {
$fs.Position = $offset
$bw = [System.IO.File]::Create($out)
$remaining = $length
$buffer = New-Object byte[] 65536
while ($remaining -gt 0) {
$toRead = [Math]::Min($buffer.Length, $remaining)
$read = $fs.Read($buffer,0,$toRead)
if ($read -le 0) { break }
$bw.Write($buffer,0,$read)
$remaining -= $read
}
} finally {
$fs.Close()
if ($bw) { $bw.Close() }
}
Write-Host "Wrote $out ($(Get-Item $out).Length bytes)"
}
Example carving 1212416 bytes at offset 394394:
Carve-Range 394394 1212416 "C:\Temp\SamsungExtract\SamsungInstaller64.msi.bin"
5) Test the carved file with 7-Zip or msiexec
  • Try listing with 7z:
"C:\Program Files\7-Zip\7z.exe" l "C:\Temp\SamsungExtract\SamsungInstaller64.msi.bin"
  • If 7z lists files, extract:
"C:\Program Files\7-Zip\7z.exe" x "C:\Temp\SamsungExtract\SamsungInstaller64.msi.bin" -o"C:\Temp\SamsungExtract\extracted"
  • If it’s an MSI (OLE compound), use msiexec administrative extract:
msiexec /a "C:\Temp\SamsungExtract\SamsungInstaller64.msi.bin" /qb TARGETDIR="C:\Temp\SamsungExtract\msi_extracted"
6) Where the drivers will be
Once the MSI is extracted inspect MSI content: look for folders: x64\, _64\, Driver\, or subfolders with .inf/.sys/.cat. Those are the driver files you need (secnvme.inf, secnvme.sys, catalog files).
7) Troubleshooting tips / notes
  • The earlier Format-Hex error was because your PS version doesn’t accept -Count; the file-read snippets you already used are fine.
  • If the script returns no PK/OLE offsets: either you already carved the right inner container (search combined.bin instead of carved_container.exe), or the payload is compressed/embedded differently. In that case paste the script output here and I’ll guide next steps. The Burn manifest you previously printed suggests the attached container contains payloads and gives payload sizes (use those sizes in Carve-Range).
  • If 7z says “not an archive” on a carved file, try carving exact payload size (manifest size) rather than to EOF; also try carving from the exact PK or OLE offset the script reported (not from an earlier 0-padded area).
Answer / next step I need from you
  • Run the corrected extraction.ps1 and paste the output (the offsets and previews it prints).
  • Or paste the offset you want me to assume (you earlier mentioned 394394 — if that’s the one printed by the script, tell me) and tell me whether you know the payload size (e.g. 1212416 for SamsungInstaller64.msi). If you give me offset + size I will give the exact Carve-Range command and the exact 7z / msiexec commands to extract the MSI and find the .sys/.inf files.
If you prefer I can give a single one-line PowerShell command that: finds PK offsets, carves each candidate to a file, and runs 7z l on each carved file — tell me and I’ll provide it.
 

@ChatGPT


PS C:\Temp\SamsungExtract> powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\SamsungExtract\extraction.ps1
At C:\Temp\SamsungExtract\extraction.ps1:7 char:30
+ function Find-Offsets([byte[] $pattern) {
+ ~
Missing ] at end of attribute or type literal.
At C:\Temp\SamsungExtract\extraction.ps1:19 char:30
+ $patMZ = [byte # "MZ" (PE/exe)
+ ~
Missing ] at end of attribute or type literal.
At C:\Temp\SamsungExtract\extraction.ps1:20 char:54
+ $patPK = [byte # "PK.."(ZIP/CAB/MSI local file header)
+ ~
Missing ] at end of attribute or type literal.
At C:\Temp\SamsungExtract\extraction.ps1:21 char:41
+ $patOLE = [byte # OLE Compound File (MSI)
+ ~
Missing ] at end of attribute or type literal.
At C:\Temp\SamsungExtract\extraction.ps1:29 char:59
+ Write-Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { ...
+ ~~
Unexpected token 'in' in expression or statement.
At C:\Temp\SamsungExtract\extraction.ps1:29 char:58
+ Write-Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { ...
+ ~
Missing closing ')' in expression.
At C:\Temp\SamsungExtract\extraction.ps1:23 char:32
+ foreach ($k in $patterns.Keys) {
+ ~
Missing closing '}' in statement block or type definition.
At C:\Temp\SamsungExtract\extraction.ps1:29 char:67
+ ... Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { $star ...
+ ~
Unexpected token ')' in expression or statement.
At C:\Temp\SamsungExtract\extraction.ps1:29 char:104
+ ... foreach ($o in $offs) { $start = [Math]::Max(0, $o - 48) $len = [Math ...
+ ~~~~
Unexpected token '$len' in expression or statement.
At C:\Temp\SamsungExtract\extraction.ps1:29 char:152
+ ... $o - 48) $len = [Math]::Min(160, $bytes.Length - $start) $seg = $byte ...
+ ~~~~
Unexpected token '$seg' in expression or statement.
Not all parse errors were reported. Correct the reported errors and try again.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : EndSquareBracketExpectedAtEndOfAttribute

PS C:\Temp\SamsungExtract>

Is this throwing these errors because the code wasn't wrapped in the Code tag in the forum post?
 

Thanks — the errors are not caused by a forum “code tag” but by syntax getting corrupted in the script you actually ran. The parser errors you saw (Missing ] at end of attribute/type and unexpected tokens) come from a few common copy/paste problems:
  • typed array declarations like [byte got mangled (square-brackets removed or comments injected).
  • multiple statements ended up on one physical line (PowerShell then treats the tokens unexpectedly).
  • inline comments placed inside typed attributes (e.g. [byte # comment]) break the parser.
I recommend one of two safe options below — either save & run the small correct script file, or run the short one‑line probe directly in PowerShell.
Option A — save & run a corrected script (recommended)
  1. Open Notepad (or VS Code), paste exactly the script below, save as
    C:\Temp\SamsungExtract\extraction_fixed.ps1
Paste exactly (no edits):
---------------- extraction_fixed.ps1 ----------------
$fn = "C:\Temp\SamsungExtract\carved_container.exe"
Write-Host "File: $fn"
$size = (Get-Item $fn).Length
Write-Host "Size: $size bytes"
$bytes = [System.IO.File]::ReadAllBytes($fn)
function Find-Offsets([byte[] $pattern) {
$results = @()
for ($i = 0; $i -le $bytes.Length - $pattern.Length; $i++) {
$match = $true
for ($j = 0; $j -lt $pattern.Length; $j++) {
if ($bytes[$i + $j] -ne $pattern[$j]) { $match = $false; break }
}
if ($match) { $results += $i; $i += $pattern.Length - 1 }
}
return ,$results
}
$patMZ = [byte # "MZ" (PE/exe)
$patPK = [byte # "PK.." (ZIP/CAB/MSI local-file header)
$patOLE = [byte # OLE compound file (MSI)
$patterns = @{ "MZ" = $patMZ; "PK" = $patPK; "OLE" = $patOLE }
foreach ($k in $patterns.Keys) {
$offs = Find-Offsets $patterns[$k]
if ($offs.Count -eq 0) {
Write-Host "$k offsets: none"
continue
}
Write-Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { $start = [Math]::Max(0, $o - 48) $len = [Math]::Min(160, $bytes.Length - $start) $seg = $bytes[$start..($start + $len - 1)] $hex = [BitConverter]::ToString($seg) -replace '-',' ' $ascii = ([System.Text.Encoding]::ASCII.GetString($seg)) -replace "0",'·'
Write-Host " -> preview at offset $o (dec) / 0x{0:X}" -f $o
Write-Host " context start=$start len=$len"
Write-Host (" HEX: " + $hex.Substring(0,[Math]::Min(200,$hex.Length)))
Write-Host (" ASCII:" + $ascii.Substring(0,[Math]::Min(200,$ascii.Length)))
}
}
Write-Host "`nDone."
---------------- end script ----------------
  1. Run it with execution policy bypass (from an elevated or non-elevated prompt — elevation not required for reading the file):
    powershell -NoProfile -ExecutionPolicy Bypass -File "C:\Temp\SamsungExtract\extraction_fixed.ps1"
  2. Paste the script output here (the offsets & previews). I will tell you exactly which offset(s) to carve and the carve command to use.
Option B — run an inline one-line probe (quick, no file)
If you prefer to avoid saving a file, paste this single long command into PowerShell (it prints offsets):
$fn='C:\Temp\SamsungExtract\carved_container.exe';$b=[System.IO.File]::ReadAllBytes($fn);$sigs=@( @{n='MZ';p=(0x4D,0x5A)} , @{n='PK';p=(0x50,0x4B,0x03,0x04)} , @{n='OLE';p=(0xD0,0xCF,0x11,0xE0)} );foreach($sig in $sigs){ $p=[byte[]$sig.p; $offs=@(); for($i=0;$i -le $b.Length-$p.Length;$i++){ $ok=$true; for($j=0;$j -lt $p.Length;$j++){ if($b[$i+$j]-ne $p[$j]){ $ok=$false; break } } if($ok){ $offs+=$i; $i+=$p.Length-1 } }; if($offs.Count){ Write-Host "$($sig.n) offsets: $($offs -join ', ')" } else { Write-Host "$($sig.n) offsets: none" } }
(That single-line can be pasted directly; it will print offsets in decimal.)
Why your previous runs failed
  • Your earlier extraction.ps1 had bracket/comment corruption (e.g. [byte # comment]) and some statements ended up on one line — PowerShell then threw parse errors. Code tags on a forum do not alter the code, but copying from some web pages can change characters or line breaks (or remove square brackets) — always verify the saved script looks exactly like the intended code (Get-Content extraction.ps1 | Select-String -Pattern '[byte').
After you run the corrected script or the one-liner, tell me:
  • the offsets printed, and
  • whether you want me to provide the exact carve commands (Carve-Range) and the 7‑Zip/msiexec commands to extract the MSI and then locate the .inf/.sys files.
If you want, I can also provide a ready-to-run PowerShell function to carve every PK/OLE offset into separate files and run 7z l against each carved file so you don’t have to test them manually. Which approach do you want next?
 

@ChatGPT


PS C:\Temp\SamsungExtract> powershell -NoProfile -ExecutionPolicy Bypass -File "C:\Temp\SamsungExtract\extraction_fixed.ps1"
At C:\Temp\SamsungExtract\extraction_fixed.ps1:6 char:30
+ function Find-Offsets([byte[] $pattern) {
+ ~
Missing ] at end of attribute or type literal.
At C:\Temp\SamsungExtract\extraction_fixed.ps1:17 char:30
+ $patMZ = [byte # "MZ" (PE/exe)
+ ~
Missing ] at end of attribute or type literal.
At C:\Temp\SamsungExtract\extraction_fixed.ps1:18 char:55
+ $patPK = [byte # "PK.." (ZIP/CAB/MSI local-file header)
+ ~
Missing ] at end of attribute or type literal.
At C:\Temp\SamsungExtract\extraction_fixed.ps1:19 char:41
+ $patOLE = [byte # OLE compound file (MSI)
+ ~
Missing ] at end of attribute or type literal.
At C:\Temp\SamsungExtract\extraction_fixed.ps1:27 char:59
+ Write-Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { ...
+ ~~
Unexpected token 'in' in expression or statement.
At C:\Temp\SamsungExtract\extraction_fixed.ps1:27 char:58
+ Write-Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { ...
+ ~
Missing closing ')' in expression.
At C:\Temp\SamsungExtract\extraction_fixed.ps1:21 char:32
+ foreach ($k in $patterns.Keys) {
+ ~
Missing closing '}' in statement block or type definition.
At C:\Temp\SamsungExtract\extraction_fixed.ps1:27 char:67
+ ... Host "n$k offsets: $($offs -join ', ')" foreach ($o in $offs) { $star ...
+ ~
Unexpected token ')' in expression or statement.
At C:\Temp\SamsungExtract\extraction_fixed.ps1:27 char:104
+ ... foreach ($o in $offs) { $start = [Math]::Max(0, $o - 48) $len = [Math ...
+ ~~~~
Unexpected token '$len' in expression or statement.
At C:\Temp\SamsungExtract\extraction_fixed.ps1:27 char:152
+ ... $o - 48) $len = [Math]::Min(160, $bytes.Length - $start) $seg = $byte ...
+ ~~~~
Unexpected token '$seg' in expression or statement.
Not all parse errors were reported. Correct the reported errors and try again.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : EndSquareBracketExpectedAtEndOfAttribute

PS C:\Temp\SamsungExtract>
PS C:\Temp\SamsungExtract>
PS C:\Temp\SamsungExtract>
PS C:\Temp\SamsungExtract> $fn='C:\Temp\SamsungExtract\carved_container.exe';$b=[System.IO.File]::ReadAllBytes($fn);$sigs=@( @{n='MZ';p=(0x4D,0x5A)} , @{n='PK';p=(0x50,0x4B,0x03,0x04)} , @{n='OLE';p=(0xD0,0xCF,0x11,0xE0)} );foreach($sig in $sigs){ $p=[byte[]$sig.p; $offs=@(); for($i=0;$i -le $b.Length-$p.Length;$i++){ $ok=$true; for($j=0;$j -lt $p.Length;$j++){ if($b[$i+$j]-ne $p[$j]){ $ok=$false; break } } if($ok){ $offs+=$i; $i+=$p.Length-1 } }; if($offs.Count){ Write-Host "$($sig.n) offsets: $($offs -join ', ')" } else { Write-Host "$($sig.n) offsets: none" } }
At line:1 char:231
+ ... ;p=(0xD0,0xCF,0x11,0xE0)} );foreach($sig in $sigs){ $p=[byte[]$sig.p; ...
+ ~
Missing ] at end of attribute or type literal.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : EndSquareBracketExpectedAtEndOfAttribute

PS C:\Temp\SamsungExtract>
 

Back
Top