Accessing Physical Memory

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sharaola
    New Member
    • Dec 2008
    • 10

    Accessing Physical Memory

    Direct question , please direct answer

    Want to access physical memory as 0x80 in my code
    like

    Code:
    namespace ff
    {
        class Program
        {
            unsafe static void Main(string[] args)
            {
                int* f = (int*)0x80;
                Console.Write("{0}", *f);
            }
        }
    }

    Please answer with a solution , not only explanation
    using winxp , visualstudio200 5
    thanks in advance
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Direct Answer: I agree, you want to do that.

    Comment

    • Sharaola
      New Member
      • Dec 2008
      • 10

      #3
      Originally posted by Plater
      Direct Answer: I agree, you want to do that.
      What a nonsense answer ???!!!! :S

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Originally posted by Sharaola
        What a nonsense answer ???!!!! :S
        Just like your question, which there wasn't one.

        Did this not work:
        [code=c#]
        unsafe static void Main(string[] args)
        {
        int* f = (int*)0x80;
        Console.Write(" {0}", *f);
        }
        [/code]

        How do you know it didn't work?
        Did you run in debug and look at the memory contents?

        Comment

        • Sharaola
          New Member
          • Dec 2008
          • 10

          #5
          Originally posted by Plater
          Just like your question, which there wasn't one.

          Did this not work:
          [code=c#]
          unsafe static void Main(string[] args)
          {
          int* f = (int*)0x80;
          Console.Write(" {0}", *f);
          }
          [/code]

          How do you know it didn't work?
          Did you run in debug and look at the memory contents?
          Of course man i did , and it didn't work

          Briefly , Windows doesn't give you the permission to access the physical address " only virtual ones " , so how can write a code to take this privilage and pass those limits

          Please answer briefly with the solution
          Last edited by Curtis Rutland; Dec 18 '08, 03:30 PM. Reason: removed bolding

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            Write a c++ dll that does it for you, try using memorymappedIO if need be?
            Then DLLImport the dll?

            Comment

            • Sharaola
              New Member
              • Dec 2008
              • 10

              #7
              Originally posted by Plater
              Write a c++ dll that does it for you, try using memorymappedIO if need be?
              Then DLLImport the dll?
              How ?? , please more explantion

              Comment

              • Curtis Rutland
                Recognized Expert Specialist
                • Apr 2008
                • 3264

                #8
                The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. This includes handing out fully coded solutions. Please attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

                Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

                Originally posted by Sharaola
                Direct question , please direct answer
                .....
                Please answer with a solution , not only explanation
                using winxp , visualstudio200 5
                This isn't ExpertsExchange or RentACoder. We won't do your work for you; we help you do your own work. So asking us not to answer with an explanation goes against this site's policies.

                I suggest you take that attitude elsewhere.

                MODERATOR

                Comment

                • Frinavale
                  Recognized Expert Expert
                  • Oct 2006
                  • 9749

                  #9
                  Why do you want to access physical memory anyways?
                  You don't know what's in it...and worse, you don't know what's using it so if you modify it you could damage something.

                  Why would you want to do this?

                  We cannot help you if you don't explain what you are trying to do, what you have tried, and what the problem is that you are having.

                  We are willing to help you understand your problem so that you can find a solution, however we will never outright give you a solution...that 's just not how we work here....and even if I we wanted to give you an answer, we couldn't because you are trying to...hmm there's no way to put this nicely....becau se you're trying to do something kind of stupid. Like I said, accessing physical memory Not a good idea because you do not know what it is, what it's used for, or what's using it.


                  Anyways, I have renamed your thread so that it better reflects your question.

                  In the future please use a more descriptive title for your thread. This will help you to receive help more quickly and without the sarcasm that you've seen here.

                  -Moderator Frinny

                  Comment

                  • Sharaola
                    New Member
                    • Dec 2008
                    • 10

                    #10
                    Originally posted by Frinavale
                    Why do you want to access physical memory anyways?
                    You don't know what's in it...and worse, you don't know what's using it so if you modify it you could damage something.

                    Why would you want to do this?

                    We cannot help you if you don't explain what you are trying to do, what you have tried, and what the problem is that you are having.

                    We are willing to help you understand your problem so that you can find a solution, however we will never outright give you a solution...that 's just not how we work here....and even if I we wanted to give you an answer, we couldn't because you are trying to...hmm there's no way to put this nicely....becau se you're trying to do something kind of stupid. Like I said, accessing physical memory Not a good idea because you do not know what it is, what it's used for, or what's using it.


                    Anyways, I have renamed your thread so that it better reflects your question.

                    In the future please use a more descriptive title for your thread. This will help you to receive help more quickly and without the sarcasm that you've seen here.

                    -Moderator Frinny
                    "you're trying to do something kind of stupid".
                    Behave yourself because i know what to do specifcally

                    "I have renamed your thread"
                    you should inform me before doing such an action , as a kind of politness

                    Finally thanks you for your toughness

                    Comment

                    • Curtis Rutland
                      Recognized Expert Specialist
                      • Apr 2008
                      • 3264

                      #11
                      Originally posted by Sharaola
                      ...i know what to do specifcally...
                      If you know what to do specifically, why do you need our help?


                      Originally posted by Sharaola
                      "I have renamed your thread"
                      you should inform me before doing such an action , as a kind of politness
                      As a matter of fact, we shouldn't. Many OPs abandon threads, and if we waited for OP approval, we'd have a big mess. It's part of our job as Moderators to exercise our privileges when and how we see fit.


                      The fact that we are all Moderators on this forum should indicate something to you...we know what we are doing; we are staff.

                      If you have a problem with the way we are handling this situation, feel free to contact an administrator.

                      Comment

                      • Sharaola
                        New Member
                        • Dec 2008
                        • 10

                        #12
                        "you're trying to do something kind of stupid".
                        Behave yourself

                        Y didn't you comment about this ??

                        Comment

                        • Curtis Rutland
                          Recognized Expert Specialist
                          • Apr 2008
                          • 3264

                          #13
                          If you want to discuss this further, please do so via PM. This is a public forum for question/answer, not a place to discuss the rules of the forum.

                          Comment

                          • Sharaola
                            New Member
                            • Dec 2008
                            • 10

                            #14
                            Originally posted by insertAlias
                            If you want to discuss this further, please do so via PM. This is a public forum for question/answer, not a place to discuss the rules of the forum.
                            You should tell this to whose called frinavale first

                            Comment

                            • Banfa
                              Recognized Expert Expert
                              • Feb 2006
                              • 9067

                              #15
                              It is not clear why you would want to access physical memory and normally a program would not require this, although device drivers may require access to the physical addresses of the devices they drive.

                              The windows operating system generally prevents direct access to any hardware, all accesses routed via the HAL (Hardware Abstraction Layer Architecture of Windows NT - Wikipedia, the free encyclopedia) which is one of the ways that Windows manages to run correctly on so many different types of hardware.

                              All programs run in their own virtual memory space which has bits of physical memory they own mapped into it but you have no control of which bits of physical memory are assigned to your program, again that is under the control of Windows.

                              So as has been said direct access to physical memory is not a good idea in Windows as you have no idea of the true owner of that memory or what accessing it may do (especially if you write to it), because of this Windows does rather a good job of preventing it.

                              Comment

                              Working...