--- step6/stretch.asm	1970-01-01 00:00:00 +0000
+++ step7/stretch.asm	1970-01-01 00:00:00 +0000
@@ -1,107 +1,87 @@
 BITS 64
 
-%define align(n,r) (((n+(r-1))/r)*r)
-
-; DOS Header
+                            ; DOS Header
     dw 'MZ'                 ; e_magic
     dw 0                    ; [UNUSED] e_cblp
-    dw 0                    ; [UNUSED] c_cp
-    dw 0                    ; [UNUSED] e_crlc
-    dw 0                    ; [UNUSED] e_cparhdr
-    dw 0                    ; [UNUSED] e_minalloc
-    dw 0                    ; [UNUSED] e_maxalloc
-    dw 0                    ; [UNUSED] e_ss
-    dw 0                    ; [UNUSED] e_sp
-    dw 0                    ; [UNUSED] e_csum
-    dw 0                    ; [UNUSED] e_ip
-    dw 0                    ; [UNUSED] e_cs
-    dw 0                    ; [UNUSED] e_lfarlc
-    dw 0                    ; [UNUSED] e_ovno
-    times 4 dw 0            ; [UNUSED] e_res
-    dw 0                    ; [UNUSED] e_oemid
-    dw 0                    ; [UNUSED] e_oeminfo
-    times 10 dw 0           ; [UNUSED] e_res2
-    dd pe_hdr               ; e_lfanew
-
-; PE Header
-pe_hdr:
-    dw 'PE', 0              ; Signature
-
-; Image File Header
-    dw 0x8664               ; Machine
-    dw 0x01                 ; NumberOfSections
-    dd 0                    ; [UNUSED] TimeDateStamp
-    dd 0                    ; PointerToSymbolTable
-    dd 0                    ; NumberOfSymbols
-    dw opt_hdr_size         ; SizeOfOptionalHeader
-    dw 0x22                 ; Characteristics
-
-; Optional Header, COFF Standard Fields
-opt_hdr:
-    dw 0x020b               ; Magic (PE32+)
-    db 0x0e                 ; MajorLinkerVersion
-    db 0x16                 ; MinorLinkerVersion
-    dd code_size            ; SizeOfCode
-    dd 0                    ; SizeOfInitializedData
-    dd 0                    ; SizeOfUninitializedData
-    dd entry                ; AddressOfEntryPoint
-    dd iatbl                ; BaseOfCode
-
-; Optional Header, NT Additional Fields
-    dq 0x000140000000       ; ImageBase
-    dd 0x10                 ; SectionAlignment
-    dd 0x10                 ; FileAlignment
-    dw 0x06                 ; MajorOperatingSystemVersion
-    dw 0                    ; MinorOperatingSystemVersion
-    dw 0                    ; MajorImageVersion
-    dw 0                    ; MinorImageVersion
-    dw 0x06                 ; MajorSubsystemVersion
-    dw 0                    ; MinorSubsystemVersion
-    dd 0                    ; Reserved1
-    dd file_size            ; SizeOfImage
-    dd hdr_size             ; SizeOfHeaders
-    dd 0                    ; CheckSum
-    dw 0x02                 ; Subsystem (Windows GUI)
-    dw 0x8160               ; DllCharacteristics
-    dq 0x100000             ; SizeOfStackReserve
-    dq 0x1000               ; SizeOfStackCommit
-    dq 0x100000             ; SizeOfHeapReserve
-    dq 0x1000               ; SizeOfHeapCommit
-    dd 0                    ; LoaderFlags
-    dd 0x02                 ; NumberOfRvaAndSizes
+pe_hdr:                                                 ; PE Header
+    dw 'PE'                 ; [UNUSED] c_cp             ; Signature
+    dw 0                    ; [UNUSED] e_crlc           ; Signature (Cont)
+                                                        ; Image File Header
+    dw 0x8664               ; [UNUSED] e_cparhdr        ; Machine
+code:
+symbol:                                                                                     ; Symbol
+    dw 0x01                 ; [UNUSED] e_minalloc       ; NumberOfSections                  ; [UNUSED] Function Order
+    db 'MessageBoxW', 0                                                                     ; Function Name
+    times 14-($-symbol) db 0; [UNUSED] e_maxalloc       ; [UNUSED] TimeDateStamp
+                            ; [UNUSED] e_ss             ; [UNUSED] TimeDateStamp (Cont)
+                            ; [UNUSED] e_sp             ; [UNUSED] PointerToSymbolTable
+                            ; [UNUSED] e_csum           ; [UNUSED] PointerToSymbolTable (Cont)
+                            ; [UNUSED] e_ip             ; [UNUSED] NumberOfSymbols
+                            ; [UNUSED] e_cs             ; [UNUSED] NumberOfSymbols (Cont)
+    dw opt_hdr_size         ; [UNUSED] e_lfarlc         ; SizeOfOptionalHeader
+    dw 0x22                 ; [UNUSED] e_ovno           ; Characteristics
+opt_hdr:                                                ; Optional Header, COFF Standard Fields
+    dw 0x020b               ; [UNUSED] e_res            ; Magic (PE32+)
+    db 0                    ; [UNUSED] e_res (Cont)     ; [UNUSED] MajorLinkerVersion
+    db 0                    ; [UNUSED] e_res (Cont)     ; [UNUSED] MinorLinkerVersion
+    dd code_size            ; [UNUSED] e_res (Cont)     ; SizeOfCode
+    dw 0                    ; [UNUSED] e_oemid          ; [UNUSED] SizeOfInitializedData
+    dw 0                    ; [UNUSED] e_oeminfo        ; [UNUSED] SizeOfInitializedData (Cont)
+    dd 0                    ; [UNUSED] e_res2           ; [UNUSED] SizeOfUninitializedData
+    dd entry                ; [UNUSED] e_res2 (Cont)    ; AddressOfEntryPoint
+    dd code                 ; [UNUSED] e_res2 (Cont)    ; BaseOfCode
+                                                        ; Optional Header, NT Additional Fields
+    dq 0x000140000000       ; [UNUSED] e_res2 (Cont)    ; ImageBase
+    dd pe_hdr               ; e_lfanew                  ; [MODIFIED] SectionAlignment (0x10 -> 0x04)
+    dd 0x04                                             ; [MODIFIED] FileAlignment (0x10)
+    dw 0x06                                             ; [UNUSED] MajorOperatingSystemVersion
+    dw 0                                                ; [UNUSED] MinorOperatingSystemVersion
+    dw 0                                                ; [UNUSED] MajorImageVersion
+    dw 0                                                ; [UNUSED] MinorImageVersion
+    dw 0x06                                             ; MajorSubsystemVersion
+    dw 0                                                ; MinorSubsystemVersion
+    dd 0                                                ; [UNUSED] Reserved1
+    dd file_size                                        ; SizeOfImage
+    dd hdr_size                                         ; SizeOfHeaders
+    dd 0                                                ; [UNUSED] CheckSum
+    dw 0x02                                             ; Subsystem (Windows GUI)
+    dw 0x8160                                           ; DllCharacteristics
+    dq 0x100000                                         ; SizeOfStackReserve
+    dq 0x1000                                           ; SizeOfStackCommit
+    dq 0x100000                                         ; SizeOfHeapReserve
+dll_name:                                                                                   ; DLLName
+    db 'USER32.dll', 0                                                                      ; DLLName
+    times 12-($-dll_name) db 0                          ; [UNUSED] SizeOfHeapCommit
+                                                        ; [UNUSED] LoaderFlags
+    dd 0x02                                             ; [MODIFIED] NumberOfRvaAndSizes (0x10)
 
 ; Optional Header, Data Directories
-    dd 0                    ; Export, RVA
-    dd 0                    ; Export, Size
-    dd itbl                 ; Import, RVA
-    dd itbl_size            ; Import, Size
+    dd 0                    ; [UNUSED] Export, RVA
+    dd 0                    ; [UNUSED] Export, Size
+iatbl:                                                  ; Import Address Directory
+    dd itbl                 ; Import, RVA               ; [USEDAFTERLOAD] DLLFuncEntry
+    dd itbl_size            ; Import, Size              ; [USEDAFTERLOAD] DLLFuncEntry (Cont)
+iatbl_size equ $-iatbl
 
 opt_hdr_size equ $-opt_hdr
 
-; Section Table
-    section_name db '.'     ; Name
+                            ; Section Table
+    section_name db '.', 0  ; Name
     times 8-($-section_name) db 0
     dd sect_size            ; VirtualSize
     dd iatbl                ; VirtualAddress
     dd code_size            ; SizeOfRawData
     dd iatbl                ; PointerToRawData
-    dd 0                    ; PointerToRelocations
-    dd 0                    ; PointerToLinenumbers
-    dw 0                    ; NumberOfRelocations
-    dw 0                    ; NumberOfLinenumbers
-    dd 0x60000020           ; Characteristics
-
+content:                                                ; Strings
+    db 0x41,0x00,0x42,0x00,0x43,0x00,0x44,0x00
+    db 0x45,0x00,0x46,0x00,0x47,0x00,0,0
+                            ; [UNUSED] PointerToRelocations
+                            ; [UNUSED] PointerToLinenumbers
+                            ; [UNUSED] NumberOfRelocations
+                            ; [UNUSED] NumberOfLinenumbers
+                            ; [UNUSED] Characteristics
 hdr_size equ $-$$
 
-code:
-; Import Address Directory
-iatbl:
-    dq symbol
-    dq 0
-
-iatbl_size equ $-iatbl
-
-; Strings
 title:
     db 0x3d,0xd8,0xaf,0xdc,0x20,0x00,0x54,0x00
     db 0x69,0x00,0x6e,0x00,0x79,0x00,0x50,0x00
@@ -109,9 +89,6 @@
     db 0x20,0x00,0x57,0x00,0x69,0x00,0x6e,0x00
     db 0x64,0x00,0x6f,0x00,0x77,0x00,0x73,0x00
     db 0x20,0x00,0x31,0x00,0x30,0x00,0,0
-content:
-    db 0x41,0x00,0x42,0x00,0x43,0x00,0x44,0x00
-    db 0x45,0x00,0x46,0x00,0x47,0x00,0,0
 
 ; Entry
 entry:
@@ -121,34 +98,16 @@
     xor ecx, ecx            ; hWnd
     jmp [rel iatbl]         ; MessageBoxW
 
-    times align($-$$,16)-($-$$) db 0xcc
-
-; Import Directory
-itbl:
+itbl:                       ; Import Directory
     dq intbl                ; OriginalFirstThunk
-    dd 0                    ; TimeDateStamp
+    dd 0                    ; [UNUSED] TimeDateStamp
     dd dll_name             ; ForwarderChain
     dd iatbl                ; Name
-    dq 0                    ; FirstThunk
-
+intbl:                                                  ; Import Name Table
+    dq symbol               ; [UNUSED] FirstThunk       ; Symbol
+    dq 0                                                ; nullptr
 itbl_size equ $-itbl
 
-; Import Name Table
-intbl:
-    dq symbol
-    dq 0
-
-; Symbol
-symbol:
-    dw 0x0294               ; [UNUSED] Function Order
-    db 'MessageBoxW', 0     ; Function Name
-dll_name:
-    db 'USER32.dll', 0
-    db 0
-
 sect_size equ $-code
-
-    times align($-$$,16)-($-$$) db 0
-
 code_size equ $-code
 file_size equ $-$$
