im trying to create a keylogger that can run off a usb and can save to a log file on the usb for my home computers to tell if someone other than me has been using them i've looked online for example code but haven't found much that's readable much less understandable.
... keyloggers are often used for bad purposes and this is a lot like asking how to write a virus. Your intentions may be pure, but the question is suspect and gets you some ... questionable answers online.
Windows makes it pretty easy to write one. Should be able to do this with some basic directinput commands. It is much harder to write one that the user can't detect or counter, but to just DO it is little more than reading the keyboard in a loop; IIRC you can use something similar to a peek such that you can see what was typed without lifting it from the input buffer. If not you have to read it and put it back, but I am almost certain that isn't required.
I would just run it on the machine, not tied to some USB thing. That seems ... odd? You can get a USB to run things upon plug-in but that is also usually disabled by anyone computer literate.
Also this feels like the wrong way to go about this. If you don't want people to use the machine, disable all the default accounts and lock down the user accounts with passwords. IF you do want them to have limited access, put in a guest account with appropriate settings. If the suspects are computer literate, you also want to password your bios and deny booting from anything that is not the C drive boot disk.
i have multiple computers in my house so i wanted something plug and play with each hence the usb plus i have people coming in and out of my house constantly sorry for any concern i might have caused. my computers are locked down but a few people know my password and i don't like the idea of having to change the passwords of 5 computers just cause a family member is messing with my accounts also if you could go into more detail about not allowing boot from anything but the c drive that would be much appreciated.
your computer's bios can be password protected (used to be pulling it off the motherboard and putting it back would clear it, but I doubt that is still true?) and set to prevent booting from other places. Its just straight up settings, with words like "boot from CD Y/N" ... you can google online if you can't figure it out but its really simple (a picture may be worth more than words). You have to hit something when you boot to get into the bios screen, I forget what it is currently, probably f12 (?). This is a requirement of most secure computers (as booting from cd or usb can compromise the machine) so there are probably instructions online as well for compliance.
I am not concerned, but the virus thing is why you get really odd code samples and confusing stuff around the topic online.
used to be pulling it off the motherboard and putting it back would clear it, but I doubt that is still true?
Typically CMOS settings, including passwords, can be cleared by removing the battery and moving a jumper to discharge the capacitor. I could be wrong, but I believe some modern UEFI BIOSes with secure boot can be permanently locked down even if the battery runs out.
I have to agree. If you don't want other people messing around with your computers then the solution is to just change your passwords and lock your screens when you get up. Just know if someone has used your device is not going to stop them.