I was just reading about the reference operator (&), and it got me thinking. Can I read and print the entire contents of the system RAM? What would happen?
Probably the computer would crash as it tried to load several GB of RAM into the same amount of RAM... but if you freed the RAM you used before you used any more... could you not iterate through every memory location (in my case, 264 locations, or something) and print EVERY variable in the entire system?
Edit:
What about video RAM?
I'm waiting for some major x86 guru to come along and tell everyone to do this:
1 2 3 4 5 6
mov AX, CX ; Yay! Registers!
mov CX, BX
mov BX, AX ; oh wait AX is the same as it started as :l
db hello "Hello!"
OFFSET hello
; I probably got something SEVERELY wrong -- I don't even know assembler...
You can't access whole RAM unless... You'll write a custom driver... There's a source code of driver like this but i can't find it right now(google for it yourself).
Hope this helps.
Edit:
Thanks Bazzy. I thought I could read everything. Is this some kind of defence against malware? Because surely malware intends to destroy, not read. Stupid malware...
Null; with that code; are you writing directly to the video RAM? :3
Most CPUs have "priviledge levels" to protect the system from inappropriate accesses. The OS itself operates at the highest priviledge level... user programs operate at lower levels (simplified version).
As this is a hardware security measure; I'm guessing assembler won't help? Unless of course... I made a bootstrap like the GRUB command line (if you have no OSes on the menu.lst file while using GRUB, it opens a command line. I found that out after accidentally deleting the entire file when I was messing around with Vi. No idea how that happened. I had to boot my live CD (lucky I had it!) to edit it (I had a backup)).
That's my current ultimate goal of programming - to make a usable text-based OS.
Or one that draws those cool blue message boxes (like in Bash).
There are only two ways to do this:
1. Write your own OS. The OS will run at the highest privilege level and be able to access everything directly.
2. Write a kernel driver that will run at the same level as the kernel. This is how kernel-level debuggers work. SoftICE, for example, was able to access a process' memory arbitrarily and pause all other processes in the system.
I'd love to have my own Os. The kernel would be called Kernel Sanders, the shell would be Harlam, the source would be referred to as the Recipe, programs as Spices.
Freed memory would be Kernel Freed Chicken and all error messages "Would you like fries with that?"
The options on dialogue boxes would be'Medium', 'Large' and 'Small'. The releases would be named things like Hardy Hen, Feisty Fowl and Ready Rooster.
When shutting down, the message would be 'Enjoy your meal'. Upon boot, it would be 'What can I get you?' (username) and 'What drink would you like with that?'
Anyone ever hear of Cheat Engine? That was able to gain access to all (or at least most) of the variables that are used in any program. I wonder how that works... It's open source, but it's in Delphi, so I'm not going to try to figure out how it works.
I don't remember what they are, but I'm pretty sure there are OS functions to ask for high-priviledge access to the system -- I'm pretty sure that you also need debug priviledges.
I heard there was a SetPrivilege(), but I try to avoid the windows API. Some functions are unreliable, and with vista and XP SP2/3, I doubt it'll work.
Ah well.
Was the error Bazzy mentioned SIGSEV? I was debugging a vRAM writing program and it said I got that 'segmentation error'. Using try... catch didn't work either.
What i meant was that the API and MSDN don't always seem to 'agree'. One might be out of date, because alot of win32 API functions don't work with the examples.
Then again I guess I should be grateful. It's not like microsoft to give anything out...
One might be out of date, because alot of win32 API functions don't work with the examples.
A lot? You must have terrible luck or a really updated reference. I haven't found a single discrepancy in the MSDN, yet. Then again, I usually try to avoid system calls.
Then again I guess I should be grateful. It's not like microsoft to give anything out...
Yes. Who would want programmers writing software for your operating system, making it more useful than a pile of drivers on top of a kernel.
That has occurred to me, but it's still unlike them to give things out for free.
And 'alot' was an overstatement, I guess.
And before anyone mentions that Microsoft once donated 2000 lines of code to the Linux Kernel,
1. That was, I think, to avoid getting sued after they called Linus Torvalds and the GNU Project 'cancer' and 'communists'
And 2, based on the fact the NT kernel comprises 15 million lines, and Linus Torvalds' contribution to his own kernel stands at about 2% of the total (and assuming the two kernels are of comparative sizes in lines of code), I wouldn't say 2000 lines was very much.
That has occurred to me, but it's still unlike them to give things out for free.
It's more profitable to have a lot of programmers who know how to write software for your platform and can thus give it increased value, than to charge money for it (for the reference, that is).
It's not about giving things out for free. Like I said, it's the difference between a worthless OS and one that runs a lot of applications, and between wasting millions in code that doesn't sell and actually making money from it.
The NT kernel is 40 million LOC, I've heard. The Linux kernel is 5 million LOC.
I fail to see how any of this is relevant, though.
Personally, I think this "let's hate Microsoft" thing is old. What about Apple? At least MS doesn't put ridiculous price tags on products it later markets to idiots.
And Google is making me nervous.
Oh, don't get me started with apple...
And I don't hate Microsoft, alot of excellent stuff comes from Redmond. I hear they've got Reversi.
But they do seem to have an affinity for stealing ideas. And did you know that Windows was a failed project at DEC (think VMS). In fact MS got sued because they kept the exact same code, even with the same comments when the DEC programmers moved to ms. And who could neglect to mention visual studio? You don't need to do what you're paid to do, you can just use a bunch of drag and drop tools to build a web browser with an input box and progress bar.
I would consider getting a job at Microsoft, but I doubt they employ people from the UK and anyway, the US government wouldn't allow it.
IBM sounds like a better choice, although with all these super computers and human brains they build for themselves, I'm not quite sure how they earn money.
But they do seem to have an affinity for stealing ideas. And did you know that Windows was a failed project at DEC (think VMS).
Well, as I understand it, the mouse was rejected by Xerox executives and sold to Apple. There's actually a lot of this going on in the industry.
Personally, I prefer a world where everyone copies everyone than one encumbered by patents. Don't you think it's better to know that CTRL+Z does the same everywhere?
Originality is fine, but constant originality is impossible and leads to confusion through abolition of standards.
IBM sounds like a better choice
Did you know that from the mid-60s to the early 90s IBM was in Microsoft's place as the Evil Empire (see the Jargon File)?
although with all these super computers and human brains they build for themselves, I'm not quite sure how they earn money.
They sell time on the supercomputers, obviously. Does this question even need asking?
No, I didn't know that about IBM.
Now I get to call them usurpers, too!
And why are you nervous about google? I used to use Chrome, until I read the ToS. Lucky I don't use credit/debit cards yet. Anyway, IE6 is much safer.
I only liked chrome because the GUI made my day. It was a pleasure to use. Good thing one of the Firefox 4 mockups looks similar but better. I loved the design of chrome.