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. Registry and binary

Registry and binary

Scheduled Pinned Locked Moved C / C++ / MFC
questionwindows-admin
3 Posts 3 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.
  • L Offline
    L Offline
    locoone
    wrote on last edited by
    #1

    im trying to write 40 01 00 20 (hex) to the registry as a binary number it is writing but it come out as 32 00 00 00 can someone show me the right way DWORD value = 40,01,00,20; DWORD dwvalue = sizeof(DWORD); RegSetValueEx( hKey, "Attributes", 0, REG_BINARY, (LPBYTE) &value, dwvalue ); "Attributes"=hex:50,01,00,20 ok i found that if i do it as value = 0x20000150; it will put it in the registry as 50 01 00 20 why does it turn it around?

    K P 2 Replies Last reply
    0
    • L locoone

      im trying to write 40 01 00 20 (hex) to the registry as a binary number it is writing but it come out as 32 00 00 00 can someone show me the right way DWORD value = 40,01,00,20; DWORD dwvalue = sizeof(DWORD); RegSetValueEx( hKey, "Attributes", 0, REG_BINARY, (LPBYTE) &value, dwvalue ); "Attributes"=hex:50,01,00,20 ok i found that if i do it as value = 0x20000150; it will put it in the registry as 50 01 00 20 why does it turn it around?

      K Offline
      K Offline
      kakan
      wrote on last edited by
      #2

      locoone wrote:

      DWORD value = 40,01,00,20;

      How did you get that line through the compiler?? Try this: DWORD value = 0x40 << 24 | 0x1 << 16 | 0x0 << 8 | 0x20; Regarding: "Attributes"=hex:50,01,00,20 ok i found that if i do it as value = 0x20000150; it will put it in the registry as 50 01 00 20 why does it turn it around? It's beacuse Intel CPU's uses little endian, which stores numerical values in a "byte swapped" order. Other CPU's may use big endian.

      Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson

      1 Reply Last reply
      0
      • L locoone

        im trying to write 40 01 00 20 (hex) to the registry as a binary number it is writing but it come out as 32 00 00 00 can someone show me the right way DWORD value = 40,01,00,20; DWORD dwvalue = sizeof(DWORD); RegSetValueEx( hKey, "Attributes", 0, REG_BINARY, (LPBYTE) &value, dwvalue ); "Attributes"=hex:50,01,00,20 ok i found that if i do it as value = 0x20000150; it will put it in the registry as 50 01 00 20 why does it turn it around?

        P Offline
        P Offline
        prasad_som
        wrote on last edited by
        #3

        locoone wrote:

        why does it turn it around?

        Should not bother you, as you should read it back correctly.

        Prasad Notifier using ATL | Operator new[],delete[][^]

        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