| 1 | $COMPILE EXE
|
|---|
| 2 |
|
|---|
| 3 | Open "TESTVIR!.COM" For BINARY As #1
|
|---|
| 4 | Get$ #1, 512, VirusBase$
|
|---|
| 5 |
|
|---|
| 6 | If len(VirusBase$)>446 Then print "Image too long!": end
|
|---|
| 7 | VirusBase$ = VirusBase$ + string$(446-len(VirusBase$), 0)
|
|---|
| 8 |
|
|---|
| 9 | LocalMBR$ = AiRBOOT_LoadSector(1)
|
|---|
| 10 | VirusMBR$ = VirusBase$ + Mid$(LocalMBR$, 447)
|
|---|
| 11 |
|
|---|
| 12 | AiRBOOT_WriteSector 1, VirusMBR$
|
|---|
| 13 | AiRBOOT_WriteSector 50, LocalMBR$
|
|---|
| 14 | print "Test-Virus installed."
|
|---|
| 15 |
|
|---|
| 16 | Function AiRBOOT_LoadSector (byval Sector%) as STRING
|
|---|
| 17 | SectorBuffer$ = string$(512, 0)
|
|---|
| 18 | SectorPtr??? = StrPtr32(SectorBuffer$)
|
|---|
| 19 | AiRBOOT_LoadSector_Retry:
|
|---|
| 20 | ! mov ax, &h0201 ; load one sector
|
|---|
| 21 | ! mov ch, 0
|
|---|
| 22 | ! mov cl, Sector%
|
|---|
| 23 | ! mov dx, &h0080 ; load to harddisc 0, head 0
|
|---|
| 24 | ! les bx, SectorPtr???
|
|---|
| 25 | ! int &h13
|
|---|
| 26 | ! jnc AiRBOOT_LoadSector_Success
|
|---|
| 27 | ! mov ah, &h00 ; reset disc
|
|---|
| 28 | ! mov dl, &h80
|
|---|
| 29 | ! int &h13
|
|---|
| 30 | ! jmp AiRBOOT_LoadSector_Retry
|
|---|
| 31 | AiRBOOT_LoadSector_Success:
|
|---|
| 32 | FUNCTION = SectorBuffer$
|
|---|
| 33 | End Function
|
|---|
| 34 |
|
|---|
| 35 | Sub AIRBOOT_WriteSector (byval Sector%, byval SectorBuffer$)
|
|---|
| 36 | SectorBuffer$ = SectorBuffer$ + string$(512-len(SectorBuffer$), 0)
|
|---|
| 37 | SectorPtr??? = StrPtr32(SectorBuffer$)
|
|---|
| 38 | AiRBOOT_WriteSector_Retry:
|
|---|
| 39 | ! mov ax, &h0301 ; write one sector
|
|---|
| 40 | ! mov ch, 0
|
|---|
| 41 | ! mov cl, Sector%
|
|---|
| 42 | ! mov dx, &h0080 ; write to harddisc 0, head 0
|
|---|
| 43 | ! les bx, SectorPtr???
|
|---|
| 44 | ! int &h13
|
|---|
| 45 | ! jnc AiRBOOT_WriteSector_Success
|
|---|
| 46 | ! mov ah, &h00 ; reset disc
|
|---|
| 47 | ! mov dl, &h80
|
|---|
| 48 | ! int &h13
|
|---|
| 49 | ! jmp AiRBOOT_WriteSector_Retry
|
|---|
| 50 | AiRBOOT_WriteSector_Success:
|
|---|
| 51 | End Sub
|
|---|