Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Results of ReadProcessMemory()

Results of ReadProcessMemory()

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++performance
16 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D David Crow

    Are you talking about big-endian vs. little endian?


    "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

    M Offline
    M Offline
    Micie
    wrote on last edited by
    #5

    Are you waiting for my reaction? I don't u'stand last solution made by 4apai. Could some1 make this with comments? And what do u mean by big-endian and little-endian? I'm newb in C++ things, that's why I'm here.. where I can get answers for my questions :rolleyes: **__________ I'm made in C++... and I'm proud of it!_**

    D 1 Reply Last reply
    0
    • M Micie

      Are you waiting for my reaction? I don't u'stand last solution made by 4apai. Could some1 make this with comments? And what do u mean by big-endian and little-endian? I'm newb in C++ things, that's why I'm here.. where I can get answers for my questions :rolleyes: **__________ I'm made in C++... and I'm proud of it!_**

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #6

      Micie wrote: Are you waiting for my reaction? Well, since I did ask for clarification, a reaction response would be nice. Micie wrote: I don't u'stand last solution made by 4apai. Could some1 make this with comments? I assume the code snippet provided was to reverse the bytes of a 32-bit number. Isn't that what you requested? Micie wrote: And what do u mean by big-endian and little-endian? Try these sites for a description of endianness: http://www.webopedia.com/TERM/b/big\_endian.html http://whatis.techtarget.com/definition/0,,sid9\_gci211659,00.html http://www.netrino.com/Publications/Glossary/Endianness.html http://support.microsoft.com/default.aspx?scid=kb;en-us;102025


      "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

      J 1 Reply Last reply
      0
      • D David Crow

        Micie wrote: Are you waiting for my reaction? Well, since I did ask for clarification, a reaction response would be nice. Micie wrote: I don't u'stand last solution made by 4apai. Could some1 make this with comments? I assume the code snippet provided was to reverse the bytes of a 32-bit number. Isn't that what you requested? Micie wrote: And what do u mean by big-endian and little-endian? Try these sites for a description of endianness: http://www.webopedia.com/TERM/b/big\_endian.html http://whatis.techtarget.com/definition/0,,sid9\_gci211659,00.html http://www.netrino.com/Publications/Glossary/Endianness.html http://support.microsoft.com/default.aspx?scid=kb;en-us;102025


        "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

        J Offline
        J Offline
        jmkhael
        wrote on last edited by
        #7

        Just for the info: He wanted: bytes in memory: 00218040 bytes in result: 40802100 4api suggested: to reverse u can use following code: for (DWORD x=0x00408021, i=0, r=0; i<32; i+=4, r+=(((x << i) & 0xf0000000) >> (28 - i))); but this will reverse the whole order, not byte by byte. inputing 00218040, will result in 12080400 which is not what was requested Papa while (TRUE) Papa.WillLove ( Bebe ) ;

        M 4 D 3 Replies Last reply
        0
        • J jmkhael

          Just for the info: He wanted: bytes in memory: 00218040 bytes in result: 40802100 4api suggested: to reverse u can use following code: for (DWORD x=0x00408021, i=0, r=0; i<32; i+=4, r+=(((x << i) & 0xf0000000) >> (28 - i))); but this will reverse the whole order, not byte by byte. inputing 00218040, will result in 12080400 which is not what was requested Papa while (TRUE) Papa.WillLove ( Bebe ) ;

          M Offline
          M Offline
          Micie
          wrote on last edited by
          #8

          That's what I mean! :) Thanks Papa for help - my system is working in little-endian. **__________ I'm made in C++... and I'm proud of it!_**

          1 Reply Last reply
          0
          • J jmkhael

            Just for the info: He wanted: bytes in memory: 00218040 bytes in result: 40802100 4api suggested: to reverse u can use following code: for (DWORD x=0x00408021, i=0, r=0; i<32; i+=4, r+=(((x << i) & 0xf0000000) >> (28 - i))); but this will reverse the whole order, not byte by byte. inputing 00218040, will result in 12080400 which is not what was requested Papa while (TRUE) Papa.WillLove ( Bebe ) ;

            4 Offline
            4 Offline
            4apai
            wrote on last edited by
            #9

            u'r the observant one) i dont pretend to get the same result as he wrote. People can make mistakes. i'm too) but he wrote: "In the results I recieve a pointer to void type as every1 know with bytes from memory. But they are reversed =\" it was quaternion reversion... bit-by-bit reversion has following syntaxis: for (DWORD x=0x00408021, i=0, r=0; i<32; i++, r+=(((x << i) & 0x80000000) >> (31 - i))); // r = 0x84010200 but it still dont get needed result. or i made some mistakes in algorythm. it'll be the hometask) i think its not a kind a reversion. maybe the truth is in the words of DavidCrow (about the endian).

            J 1 Reply Last reply
            0
            • 4 4apai

              u'r the observant one) i dont pretend to get the same result as he wrote. People can make mistakes. i'm too) but he wrote: "In the results I recieve a pointer to void type as every1 know with bytes from memory. But they are reversed =\" it was quaternion reversion... bit-by-bit reversion has following syntaxis: for (DWORD x=0x00408021, i=0, r=0; i<32; i++, r+=(((x << i) & 0x80000000) >> (31 - i))); // r = 0x84010200 but it still dont get needed result. or i made some mistakes in algorythm. it'll be the hometask) i think its not a kind a reversion. maybe the truth is in the words of DavidCrow (about the endian).

              J Offline
              J Offline
              jmkhael
              wrote on last edited by
              #10

              Its not "bit by bit", but "byte by byte" :) (try saying it 20 times :omg: ) 00 40 80 21 (little end in) would be 21 80 40 00 (big end in) As suggested in the first post, the cast into the correct type give him the relevant result, and the compiler will handle it gladly :) Papa while (TRUE) Papa.WillLove ( Bebe ) ;

              4 1 Reply Last reply
              0
              • J jmkhael

                Its not "bit by bit", but "byte by byte" :) (try saying it 20 times :omg: ) 00 40 80 21 (little end in) would be 21 80 40 00 (big end in) As suggested in the first post, the cast into the correct type give him the relevant result, and the compiler will handle it gladly :) Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                4 Offline
                4 Offline
                4apai
                wrote on last edited by
                #11

                :))))) 4apai. p.s. finally code sample: for (DWORD x=0x00408021, i=0, r=0; i<32; i+=8, r+=(((x << i) & 0xff000000) >> (24 - i))); // r = 0x21804000 i do it!!!)

                M 1 Reply Last reply
                0
                • 4 4apai

                  :))))) 4apai. p.s. finally code sample: for (DWORD x=0x00408021, i=0, r=0; i<32; i+=8, r+=(((x << i) & 0xff000000) >> (24 - i))); // r = 0x21804000 i do it!!!)

                  M Offline
                  M Offline
                  Micie
                  wrote on last edited by
                  #12

                  Gratz and thanks :) Could you translate now how u done it? I don't u'stand everything starting from r+= ... Just do as big comment as you can. :) Thanks in advance ^^ **__________ I'm made in C++... and I'm proud of it!_**

                  4 1 Reply Last reply
                  0
                  • M Micie

                    Gratz and thanks :) Could you translate now how u done it? I don't u'stand everything starting from r+= ... Just do as big comment as you can. :) Thanks in advance ^^ **__________ I'm made in C++... and I'm proud of it!_**

                    4 Offline
                    4 Offline
                    4apai
                    wrote on last edited by
                    #13

                    for (DWORD x=0x00408021, i=0, r=0; i<32; i+=8, r+=(((x << i) & 0xff000000) >> (24 - i))); (((x << i) & 0xff000000) >> (24 - i))); << - its left bitshift operation for example: 0x00408021 << 8 = 0x40802100; then we need to trim right side of value to leave only first byte: 0x40802100 & 0xff000000 = 0x40000000; then we put this byte in reverse-order by specifiing bits for right bitshift operation 0x40000000 >> 16 = 0x00004000; finally we add this temporary value to our result variable. 4apai.

                    M 1 Reply Last reply
                    0
                    • 4 4apai

                      for (DWORD x=0x00408021, i=0, r=0; i<32; i+=8, r+=(((x << i) & 0xff000000) >> (24 - i))); (((x << i) & 0xff000000) >> (24 - i))); << - its left bitshift operation for example: 0x00408021 << 8 = 0x40802100; then we need to trim right side of value to leave only first byte: 0x40802100 & 0xff000000 = 0x40000000; then we put this byte in reverse-order by specifiing bits for right bitshift operation 0x40000000 >> 16 = 0x00004000; finally we add this temporary value to our result variable. 4apai.

                      M Offline
                      M Offline
                      Micie
                      wrote on last edited by
                      #14

                      Thank you very much for every post written in this thread. :rose: That's what I wanted and expected! :-D **__________ I'm made in C++... and I'm proud of it!_**

                      1 Reply Last reply
                      0
                      • J jmkhael

                        Just for the info: He wanted: bytes in memory: 00218040 bytes in result: 40802100 4api suggested: to reverse u can use following code: for (DWORD x=0x00408021, i=0, r=0; i<32; i+=4, r+=(((x << i) & 0xf0000000) >> (28 - i))); but this will reverse the whole order, not byte by byte. inputing 00218040, will result in 12080400 which is not what was requested Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                        D Offline
                        D Offline
                        David Crow
                        wrote on last edited by
                        #15

                        I did not test the code, which is why I qualified my statement with "I assume." Whether it worked as intended or not, I've no clue.


                        "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

                        J 1 Reply Last reply
                        0
                        • D David Crow

                          I did not test the code, which is why I qualified my statement with "I assume." Whether it worked as intended or not, I've no clue.


                          "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

                          J Offline
                          J Offline
                          jmkhael
                          wrote on last edited by
                          #16

                          I totaly agree with you, just wanted to make it clear for the original poster that the code, as it was, wasn't of any help, thus this was corrected. Thanks again, and regards, Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups