Thread: Direct memory access?

  1. #31
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    How is asking for direct access to the hard drive akin to a malicious program?
    It's not per se but there is a reason this type of access is a bit more involved than just using the filesystem. Unless someone is writing a low-level util or something there is never a reason to gain direct access to the hard drive.

    Here is a snippet from the original post:

    Is there ANY way using C, C++, and/or assembly that lets you directly access memory of a computer? Like the actual basic hard drive in bytes or something. ....
    ...directly access memory of a computer...

    Yeah they are called variables and arrays. Why would you want to access any memory except that which you own or have allocated in a thread or DLL?

    Like the actual basic hard drive in bytes or something. ....

    First the memory bytes have nothing to do with the hard drive bytes (with the exception of virtual memory). You normally access the hard drive bytes via a filesystem that has folders and files. Low-level access is possible but rarely needed.

    So the simple answer is we access memory every day in every program we write. If you are accessing files then you are accessing hard drive bytes.

    Hence my suspicion.

  2. #32
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Bubba, from what you quoted it's pretty clear to me that he is talking about hard drive memory - not RAM.

    First the memory bytes have nothing to do with the hard drive bytes (with the exception of virtual memory)
    A hard drive is memory. Just because the data doesn't go away when you pull power doesn't make it something different.

    You normally access the hard drive bytes via a filesystem that has folders and files. Low-level access is possible but rarely needed.
    I agree, but it's still fun to mess around with. One of my first Linux projects was writing my own filesystem. It was tough to do, and simple by modern filesystem standards, but it was fun and I learned a lot. I see no reason to discourage people from taking on this type of exercise if they want to learn about how block devices work.

  3. #33
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by bithub View Post
    A hard drive is memory. Just because the data doesn't go away when you pull power doesn't make it something different.
    I don't know if you should go as far as to call the hard drive a memory? DRAM, our typical memory, and hard drives are entirely different technology.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #34
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    even DRAM's are different though. Its still memory. storage in teh HDD is just non-volatile, as apposed to system memory which is volatile. Its still RAM, and hence memory. How it is accessed and the nature of the underlying technology is different, but so what.

  5. #35
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    I'd say that hdds are not RAM, because they require seeks and time for the platter to spin around.

  6. #36
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Quote Originally Posted by robwhit View Post
    I'd say that hdds are not RAM, because they require seeks and time for the platter to spin around.
    Not all non-volatile data is stored on platter hard drives. What about flash memory for instance?

  7. #37
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Flash is another different technology. Hard Drives I don't consider memory. Although flash is memory.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #38
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Quote Originally Posted by bithub View Post
    Not all non-volatile data is stored on platter hard drives. What about flash memory for instance?
    flash is non-volatile, maybe, but that doesn't make it a hard disk drive.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. tools for finding memory leaks
    By stanlvw in forum C++ Programming
    Replies: 4
    Last Post: 04-03-2009, 11:41 AM
  2. Question regarding Memory Leak
    By clegs in forum C++ Programming
    Replies: 29
    Last Post: 12-07-2007, 01:57 AM
  3. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  4. quick question on direct file access
    By Stevek in forum C++ Programming
    Replies: 2
    Last Post: 03-21-2003, 01:33 AM
  5. Memory Access Error when using Strcpy()
    By fgs3124 in forum C Programming
    Replies: 2
    Last Post: 03-15-2002, 03:07 PM