The hard drive protection lock of the assembly source code

Source: Internet
Author: User

I wrote a hard drive lock in the previous period, took out to exchange with everybody, at the same time have a question, hope everybody can help me to think about.

First of all, I would introduce my program, I was written in a compilation, the program has 2 files: Hdlock.exe

Hdlock.dat, where Hdlock.dat is the hard drive lock that I wrote for loading the hard drive 0 column 0 1 fan, Hdlock.exe realizes

(1) Put the hdlock.dat into the hard disk 0 columns 0 1 fan and set the password of the hard drive Lock, (2) Modify the password, (3) Uninstall the hard drive lock

Here, first introduce the Hdlock.dat, because the hard drive lock itself is limited by space, must be strictly controlled in 1bdH bytes, (Know why?) Therefore, we can not use MASM first write the original program, and then compile, I basically use the debug a command of a one-time write out, I have these disassembly out, plus some comments, for everyone to see, learn from each other.

This section moves the entire hard drive lock from 0000:7C00 to 0000:0600 to avoid being overwritten by code that is later read in

0f6d:0100 1E Pushds

0f6d:0101 modified pushes

0f6d:0102 B90001 movcx,0100

0f6d:0105 BF0006 movdi,0600

0f6d:0108 B80000 movax,0000

0f6d:010b 8ed8 Movds,ax

0f6d:010d 8ec0 Moves,ax

0f6d:010f be007c movsi,7c00

0f6d:0112 F2 REPNZ

0f6d:0113 A5 MOVSW

0f6d:0114 ea1a060000 jmp0000:061a Long jump to the moved code, that is, starting from 011a

0f6d:0119 NOP

0f6d:011a EB09 JMP0125

This section initializes the screen to display the string "PASSWORD"

0f6d:0125 B80006 movax,0600

0f6d:0128 b7f0 movbh,f0

0F6D:012A B90000 movcx,0000

0f6d:012d ba4f18 movdx,184f

0f6d:0130 CD10 INT10 Initialization screen (foreground is black, background is gray, character flashes)

0f6d:0132 b21a movdl,1a

0f6d:0134 be1c06 movsi,061c, display characters from 061cH (because the program will be read into 0000:0600 places,

; It actually shows the string starting at 11cH now.

0f6d:0137 B402 movah,02

0f6d:0139 B610 movdh,10

0f6d:013b B700 movbh,00

0f6d:013d CD10 INT10; set cursor position (10H row 1aH column)

0f6d:013f 8a04 Moval,[si]

0f6d:0141 3c00 cmpal,00

0f6d:0143 741B JZ0160, whether the string has been displayed, is skipped to read the password from the keyboard

0f6d:0145 B409 movah,09

0f6d:0147 B90100 movcx,0001

0f6d:014a B700 movbh,00

0f6d:014c B370 movbl,70

0F6D:014E CD10 INT10; display a character

0f6d:0150 FEC2 incdl; the cursor moves back one

0f6d:0152 INCSI; The character pointer moves back one

0f6d:0153 EBE2 JMP0137; Continue to display the next character

0f6d:011c db ' Passward ' 00; string for display

; Reading passwords from the keyboard

0f6d:0160 B90400 movcx,0004

0f6d:0163 B80000 movax,0000

0f6d:0166 8ec0 Moves,ax

0f6d:0168 BF0108 movdi,0801

0f6d:016b F3 RepZ

0f6d:016c AB STOSW, opening a buffer of 8 bytes at the beginning of 0000:0801

;(marked with 00H) for storing passwords that are read from the keyboard (password

; up to 8 characters, at least 0 characters)

0f6d:016d B90900 movcx,0009; read up to 9 keyboard (of course the 9th time is to read it all over)

0f6d:0170 BF0108 movdi,0801; start writing passwords from 801H

0f6d:0173 B223 movdl,23

0f6d:0175 B400 movah,00

0f6d:0177 CD16 INT16 Reading keyboard

0f6d:0179 3c0d cmpal,0d

0f6d:017b 7479 Jz01f6; is a carriage return jumps to the password comparison place

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.