1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Roll My Own

Discussion in 'Software Development' started by -Fabez-, Oct 13, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. -Fabez-

    -Fabez- Thread Starter

    Joined:
    Jul 28, 2008
    Messages:
    1,899
    As a way of practising my coding abilities I would like to make several projects, however I am unsure about how to start or where to go from there. Below are the projects I would like to make along with some information about each one.

    1) An operating system: Only a basic one, perhaps using the Linux kernel and moving on from there like in Linux From Scratch. The trouble with this one is all of the sites I have been through don't explain in a clear, detailed manor. However I do know I will need to make a boot-strapper and other such programs, but don't know how.

    2) Password protecting a file: I want to create a small program that will combine any chosen .Exe file with another .Exe that will check for a password and run the password protected .Exe if the password provided is correct. The end result of merging the two files would be a .Exe that will execute the password .Exe first as well as the first .Exe having access to the second one and vice-versa.

    3) Remote learning software: A good example of this is ClassLink, but I have no idea which language to use or where to start. Any pointers or advice would be much appreciated.

    4) Windows GUI editor: A small tool to change the look of Windows Xp's or Windows Vista's GUI, like the close and minimize buttons and the title bar in windows, with little overhead.
     
  2. mt2002

    mt2002

    Joined:
    Sep 14, 2005
    Messages:
    919
    Check out my site :) OS Development Series Speaking of OS's, my previous post was for developing a merging program for my (real) systems boot loader :)

    The only thing is that my series starts at the boot loader stage and moves onto a MSVC++ kernel. If you want to use an existing bootloader (like GRUB) you can try JamesM's tutorials
     
  3. pvc_

    pvc_

    Joined:
    Feb 17, 2008
    Messages:
    490
    For the OS, you'd be better off creating a OS simulator than an actual OS. I actually happen to take an OS class in university right now, and we have to code an OS simulator. The nice thing about the simulator is that you wont have to worry about drivers and the actual hardware, instead you focus on the OS design, CPU scheduling, threads and processes...but I guess it depends on wether you want to deal with the drivers or not...

    For the Windows GUI editor, I think you first have to figure out how you can create your own windows skin, and then you can import that into the list of windows templates or whatever.

    Password protection: I did something similar to this when I was designing my own application installer. It works similar to the file binder programs that "h4ackers" use to send you trojans hidden in other programs. essentially, you'll have to make 2 separate programs. One that creates the "combined" executables and one that will be the one that does the password checking. The one that does the exe creation will read the password checker and will write it to a separate file, then will make a header to define the size and position of the "hidden executable" in that file. Then it will read the executable that you want to protect and writes it after the header to that same file.
    The second application which will be the password protector will read itself till it finds the header and then will find the exe that it's hiding and writes it to another separate file and then executes it if the password is correct.
    Finding the hidden exe at the correct position will be the most challenging part, but once you understand the concept, getting it done shouldn't take you longer than a week.
    One last thing that you might have to do is to delete the extracted executables, once they are terminated.
     
  4. -Fabez-

    -Fabez- Thread Starter

    Joined:
    Jul 28, 2008
    Messages:
    1,899
    Thanks for your replies :D mt202 I am going to read through your website and pvc_, I am going to look into Os stimulators. For the GUI editor, I have read somewhere about patching Uxtheme.dll, so how would I go about patching it ? For the password protection of a .Exe I understand the need for two files, one to check the password, another to bind it to the users chosen .Exe, but do not get how to bind them and specify which one should run first and have them be able to accsess each other. Any input would be gratefully appreciated, thanks :D
     
  5. pvc_

    pvc_

    Joined:
    Feb 17, 2008
    Messages:
    490
    Let's refer to the password program as the "stub." With the binder program you'll be writting the stub as well as the header and the program you are trying to protect, to a new file (back to back). So, you'll end up with a single file. When you execute that single file, the OS goes to the header part of the stub (this header is generated by the compiler) and reads the size of the Stub and executes it. So, when the stub is loaded, you have to code it to read itself and extract the hidden program and write it to a temporary location.

    The secret is that you can add whatever you want to the end of executables, images,... The OS simply doesn't care about what you add to the end of the files because every file has a header containing the size of the file. That header tells the OS, the actual size of a program. Although, keep in mind that you won't be able to load a program into notepad and modify it because notepad changes the encoding of sequential files. However, if you load a program into a hex editor, you can add as much garbage to the end of it as you want without changing the properties of the program.
     
  6. -Fabez-

    -Fabez- Thread Starter

    Joined:
    Jul 28, 2008
    Messages:
    1,899
    I understand the binding program will write the password protection file, then the file being protected to a single file. I dont understand about what happens when it is executed, how binding them in the first place works and how the code can read itself. Thanks for explaining a lot of things, but could you clarify on the questions above please ?
     
  7. pvc_

    pvc_

    Joined:
    Feb 17, 2008
    Messages:
    490
    A program is nothing but a sequential file. You can read it the same way you read a text file; you can even open it in a notepad. What I mean by reading itself is that you would read your Binded Progarm as binary, then you will split it in half and then you write the second half to another location. Then if the password is correct, you would use shell to execute it (the second half) from the new location. As I said before, when you execute that single file, the OS would only care about the Stub program and will only execute the stub; this means everything else is ignored (the second half of the binded file is ignored).
     
  8. -Fabez-

    -Fabez- Thread Starter

    Joined:
    Jul 28, 2008
    Messages:
    1,899
    Thanks a lot :D That clarifies a lot of things. Now I only have two more questions, how do I bind them together and distinguish where the stub ends and the file binded to it starts as well as how to define the password protection file as the stub to be executed when the combined .Exe is run.
     
  9. pvc_

    pvc_

    Joined:
    Feb 17, 2008
    Messages:
    490
    Since you write the stub first, it will be executed like any other application and you dont have to worry about anything; just give the file a .exe extension and you'll be set. To distinguish them, you'll have to design your own header/footer that will tell you what the size of the each program is. Then search for it when you wanna split the files. It'd be probably easier to put the header at the bottom of the whole thing (in that case it'd be a footer). That way you can just seek to the end of file and grab the footer.
     
  10. -Fabez-

    -Fabez- Thread Starter

    Joined:
    Jul 28, 2008
    Messages:
    1,899
    After some research, I stumbled upon ADS, this method works fine for binding two or more files together and I could implement my password protection program but, it only works on NTFS file systems, so now my only problem is implementing it on other Windows file systems, any input would be much appreciated :D For the remote learning software, what would be the most efficient way to transfer screen shots, videos of what the user is doing and other data types ? I thought about using Python as it is easy to done some of the things I want to do, but it will be slow compared to languages like C and C++. For the Windows GUI editor, how would I replace resources on the fly ? An example of a program like this is True Transparency. Thanks -Fabez-
     
  11. pvc_

    pvc_

    Joined:
    Feb 17, 2008
    Messages:
    490
    didn't know it doesnt work on FAT, but I won't worry much about it because most people use NTFS. However, to work around it, you can replace all the programs that you want to protect with a password protection program, which will connect to a database to get the path to a "secret" folder where the programs are hidden and protected. To accomplish this, you can just associate the name of the programs with their executation path.
    To transfer screen shots, you can take the screen shot of the active portions of the screen and transfer those to cut-down on bandwidth usage. I'm not sure what exactly you're trying to do, but FTP is a good choice for file transfer.
     
  12. -Fabez-

    -Fabez- Thread Starter

    Joined:
    Jul 28, 2008
    Messages:
    1,899
    I did a test using Mt2002's code from his other thread and it binded the two .Exe's successfully, and running the output runs the first program that was entered, so how would I run the second program, would I need to jump to directly after the end of the first one and how would I, or is there another method ? Finally does anyone have any idea's on items 3 and 4 ? Thanks -Fabez-
     
  13. mt2002

    mt2002

    Joined:
    Sep 14, 2005
    Messages:
    919
    I havn't touched it in a little while but directly jumping to it does not work (Not inside of Windows, anyways.) Through my testing, the 2nd program is never loaded directly after the 1st when loaded into memory by Windows (Which is required for it to work).

    I suspect Windows only loads the first program from the image do to the 1st programs header information size data matching that of only the 1st program.

    It may also be possible that Windows loads the segments within the programs in different locations in the address space rather then as a flat binary image that may be causing it to not work. I dont know though as I dont know how Windows loads *.exe programs in memory.

    Perhaps someone can find anything?

    Ill see if I can experiment with it further tomorrow...Who knows, mabey find a way to get it working in Windows ;)
     
  14. pvc_

    pvc_

    Joined:
    Feb 17, 2008
    Messages:
    490
    I don't think windows loads the second program, it just grabs the size of the first program from the header and loads the first program. However, one thing you can look at is dll injection (also known as rootkits or process hijacking). With dll injection they load the second program as a dll into the first program. Although, I think my method is far easier to implement and saves you a lot of headache.
     
  15. -Fabez-

    -Fabez- Thread Starter

    Joined:
    Jul 28, 2008
    Messages:
    1,899
    Thanks for your replies, pvc_ you have a good idea, but somebody could just navagate to the secret folder and run the files. Mt2002 would it be possible to make a variable in the first program containing its length in bytes and when the second program needs to be run, jump to that variable plus one byte, resulting in the start of the second program ?
     
  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/758838

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice