Omnimaga

General Discussion => Technology and Development => Computer Programming => Topic started by: matthias1992 on August 19, 2010, 03:59:39 pm

Title: x86 Assembly help needed
Post by: matthias1992 on August 19, 2010, 03:59:39 pm
I am trying to make a bootloader that deletes a file at startup. Any moderator or admin, feel free to delte this topic if I am breaking some rule by posting this because my intentions with the bootloader might not fit within the rules (< I don't think my school will like it, hint ^^) I take full responsibilty though. This is what I got so far:
Code: [Select]
model small
org 7c00h
.data
Name db 'C:\program files\netsupport manager\client32.ini'
.code
lea dx, Name
mov ax,0x7141
int 0x21
times 0x0200-2-($-$$) db 0
dw 0xAA55
Would this work, theaoretically I mean. I don't want to risk messing up my system because of this. Is their a way I could implent a safety measure? Note that I know very little about x86 asm and that this is just what I managed to come up with after some reading on bootloaders and deleting files in asm.
Title: Re: x86 Assembly help needed
Post by: qazz42 on August 19, 2010, 04:03:04 pm
What do want to delete, a block?

if so, then I dont now ;)
Title: Re: x86 Assembly help needed
Post by: matthias1992 on August 19, 2010, 04:11:52 pm
No the file Client32.ini
Without that file a certain piece of monitoring software will fail to run, allowing me to visit the net freely instead of getting those annoying webblocks (which you can't surpass with proxies)
Title: Re: x86 Assembly help needed
Post by: alberthrocks on August 19, 2010, 04:27:42 pm
This looks more or less like Windows assembly than true x86 assembly.
Windows assembly is just accessing the Windows functions via assembly. Quite a few demoscenes and such use this for the nice speed.
x86 assembly, on the other hand, has direct access to hardware.

This to me doesn't look like working bootloader code.
True x86 assembly isn't that simple. You need to set up lots of stuff: IRQs, ACPI, HDD access, protected mode, etc.
And you need code to read NTFS, which this thing doesn't look like.

My suggestion: don't try to write a bootloader unless you really know what you are doing.
If you are writing a bootloader:
  - Borrow code from others! GRUB is a FOSS bootloader. It can chainload to other bootloaders, which is something you want to do.
    It might recognize NTFS as well, but I'm not sure.
    Heck, you could even just write a GRUB conf file that deletes the file for you, and then chainloads! ;) (Not sure if it's possible tho)
If you don't want to go insane from x86 assembly:
  - Use Linux/DOS to remove the file(s). DOS can possibly chainload, but not Linux. (You need to reboot into Windows) DOS is harder to
    implement, Linux is easier. FreeDOS is a good starting point if you use DOS. Barebones Ubuntu (or others) is a good place to start if
    you use Linux.
Title: Re: x86 Assembly help needed
Post by: Empyreal on August 27, 2010, 05:20:18 pm
As near as I can tell, this is DOS assembly.  INT 0x21 is a software interrupt.  You won't be able to use it if the operating system isn't loaded.  And there's no way Windows is going to allow a real mode application to delete a protected file.
Since your goal seems to be to just delete the file, I have to ask...  If you can install a bootloader on your school computers, then you are also most likely capable of loading different operating system as well.  Right?  It'd be a lot easier to delete the file from there.  That said, I find it a little odd that the school's computers would allow either course of action (the installation of a bootloader or booting into a different operating system).  Are you sure this is the case?
Title: Re: x86 Assembly help needed
Post by: alberthrocks on August 27, 2010, 11:17:00 pm
I think the easiest way is to boot into Puppy Linux, delete the file, and reboot. Simple, and a lot more fun doing it. ;)