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. Adding binaries to a registry?

Adding binaries to a registry?

Scheduled Pinned Locked Moved C / C++ / MFC
windows-adminhelpquestion
6 Posts 4 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.
  • K Offline
    K Offline
    kDevloper
    wrote on last edited by
    #1

    Hi all, i am trying to add a set of binaries to registry but the size of the value i am trying to add is giving me 825243701 :doh: . any help is appriciated. Regards, KDevloper

    S H 2 Replies Last reply
    0
    • K kDevloper

      Hi all, i am trying to add a set of binaries to registry but the size of the value i am trying to add is giving me 825243701 :doh: . any help is appriciated. Regards, KDevloper

      S Offline
      S Offline
      Sarath C
      wrote on last edited by
      #2

      Check Registry value limits[^] It's better not to store huge data inside registry. it will increase the registry size, of the registry and also affects the performance. As per the recommendation from MSFT, data above 2KB should be stored as file.

      -Sarath. "Great hopes make everything great possible" - Benjamin Franklin

      My blog - Sharing My Thoughts

      K 1 Reply Last reply
      0
      • S Sarath C

        Check Registry value limits[^] It's better not to store huge data inside registry. it will increase the registry size, of the registry and also affects the performance. As per the recommendation from MSFT, data above 2KB should be stored as file.

        -Sarath. "Great hopes make everything great possible" - Benjamin Franklin

        My blog - Sharing My Thoughts

        K Offline
        K Offline
        kDevloper
        wrote on last edited by
        #3

        Even i restricted the size the value does not appear at the registry.Below is the code: CString szRegData = "NEW"; CString strData = "abcd"; HKEY hMainKey; DWORD dwsize = strData.GetLength(); if(RegOpenKey(HKEY_LOCAL_MACHINE,"Software\\abc\\abc\\Current Version",&hMainKey)==ERROR_SUCCESS) { if(RegSetValueEx(hMainKey,szRegData,NULL,REG_BINARY,(LPBYTE)strData.GetBuffer(),dwsize)==ERROR_SUCCESS) { strData.ReleaseBuffer(); RegCloseKey(hMainKey); return TRUE; } RegCloseKey(hMainKey); } Thanks &Regards, kDevloper

        C 1 Reply Last reply
        0
        • K kDevloper

          Even i restricted the size the value does not appear at the registry.Below is the code: CString szRegData = "NEW"; CString strData = "abcd"; HKEY hMainKey; DWORD dwsize = strData.GetLength(); if(RegOpenKey(HKEY_LOCAL_MACHINE,"Software\\abc\\abc\\Current Version",&hMainKey)==ERROR_SUCCESS) { if(RegSetValueEx(hMainKey,szRegData,NULL,REG_BINARY,(LPBYTE)strData.GetBuffer(),dwsize)==ERROR_SUCCESS) { strData.ReleaseBuffer(); RegCloseKey(hMainKey); return TRUE; } RegCloseKey(hMainKey); } Thanks &Regards, kDevloper

          C Offline
          C Offline
          CPallini
          wrote on last edited by
          #4

          Why are you trying to add a string as binary data? Are you doing a UNICODE build? Who (or, probably, what) is giving you '825243701'? Where are you at 8:30 pm of yesterday (to complete the enquiry... :rolleyes: )? :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          K 1 Reply Last reply
          0
          • C CPallini

            Why are you trying to add a string as binary data? Are you doing a UNICODE build? Who (or, probably, what) is giving you '825243701'? Where are you at 8:30 pm of yesterday (to complete the enquiry... :rolleyes: )? :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            K Offline
            K Offline
            kDevloper
            wrote on last edited by
            #5

            Hi Palini, It's not a kind of UNICODE Build, i have a set of values as say "12324323242300000",which i need to add to registry as REG_BINARY. The earlier vaue was as a result of a different way of implementation. but lets forget the giant value. i hope the lines of code will be my final way to implement :-D . Hey wat's dat " WER r u at...." Regards, KDevloper

            1 Reply Last reply
            0
            • K kDevloper

              Hi all, i am trying to add a set of binaries to registry but the size of the value i am trying to add is giving me 825243701 :doh: . any help is appriciated. Regards, KDevloper

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #6

              See Registry Wrapper Class (CRegistry). Free source code ...[^] for more help.

              Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

              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