#include <WinAPI.au3> Global $nBytes ConsoleWrite("Boot-Image X-tract (by MKISH)" & @crlf & @crlf & "USAGE: bootext.exe <PATH> <IMGNAME>") If $CmdLine[0] = 0 then Exit If NOT FileExists($CmdLine[1]) then Exit $PATH = $CmdLine[1] $RESULT = $CmdLine[2] $hFile = _WinAPI_CreateFile("." & $PATH, 2,2) $xBuffer = DllStructCreate("byte["& 4 & "]") _WinAPI_SetFilePointer($hFile, 0x11*0x800 + 0x47) _WinAPI_ReadFile($hFile, DllStructGetPtr($xBuffer), 4, $nBytes) $sText1 = DllStructGetData($xBuffer, 1) $dBuffer = DllStructCreate("byte["& 4 & "]") _WinAPI_SetFilePointer($hFile, 0x800 * Int($sText1) + 0x20 + 0x8) _WinAPI_ReadFile($hFile, DllStructGetPtr($dBuffer), 4, $nBytes) $sText2 = DllStructGetData($dBuffer, 1) $fBuffer = DllStructCreate("byte["& 1 & "]") _WinAPI_SetFilePointer($hFile, 0x800 * Int($sText1) + 0x20 + 1) _WinAPI_ReadFile($hFile, DllStructGetPtr($fBuffer), 1, $nBytes) $sTextd = DllStructGetData($fBuffer, 1) $pBuffer = DllStructCreate("byte["& 2 & "]") _WinAPI_SetFilePointer($hFile, 0x800 * Int($sText1) + 0x20 + 0x6) _WinAPI_ReadFile($hFile, DllStructGetPtr($pBuffer), 2, $nBytes) $sText3 = SecCount() $zBuffer = DllStructCreate("byte[" & $sText3 * 0x200 & "]") _WinAPI_SetFilePointer($hFile, 0x800 * Int($sText2)) _WinAPI_ReadFile($hFile, DllStructGetPtr($zBuffer), $sText3 * 0x200, $nBytes) $sText4 = DllStructGetData($zBuffer, 1) FileWrite("" & $RESULT, $sText4) _WinAPI_CloseHandle($hFile) Func SecCount() $fBuffer = DllStructCreate("byte["& 1 & "]") _WinAPI_SetFilePointer($hFile, 0x800 * Int($sText1) + 0x20 + 1) _WinAPI_ReadFile($hFile, DllStructGetPtr($fBuffer), 1, $nBytes) Switch DllStructGetData($fBuffer, 1) Case 0x00 Return Int(DllStructGetData($pBuffer, 1)) Case 0x01 Return Int(0x50 * 0x02 * 0x0F) Case 0x02 Return Int(0x50 * 0x02 * 0x12) Case 0x03 Return Int(0x50 * 0x02 * 0x24) EndSwitch EndFunc
Just compile this as CUI App. Hope it is of use to somebody. Useful suggestions are welcome.
EDIT:
The link is working now. A bugfix
Edited by MKISH, 22 October 2012 - 05:04 PM.







