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. RegCreateKeyEx

RegCreateKeyEx

Scheduled Pinned Locked Moved C / C++ / MFC
windows-adminsecurityhelp
2 Posts 2 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.
  • I Offline
    I Offline
    Its due when
    wrote on last edited by
    #1

    Hi All, Im creating a dll and I want to put in the code a way to create a registry key. Im only trying to do something very simple - (1) Create a registry key & (2) Have a vaule pointing to the root of c:\ Ive just tried the basic regcreatekeyex method and although it compiles it does not actually create anything and I think ive missed something very fundamental here (please forgive the noobie status). Here is the code: DWORD dwRes, dwDisposition; SECURITY_ATTRIBUTES sa; LONG lRes; HKEY hkSub = NULL; lRes = RegCreateKeyEx(HKEY_CURRENT_USER, "mykey", 0, "", 0, KEY_READ | KEY_WRITE, &sa, &hkSub, &dwDisposition); It compiles fine but when i run regedit and try to find "mykey" it comes up with nothing. Any help would be greatly appreciated. Thanks Nic :confused:

    G 1 Reply Last reply
    0
    • I Its due when

      Hi All, Im creating a dll and I want to put in the code a way to create a registry key. Im only trying to do something very simple - (1) Create a registry key & (2) Have a vaule pointing to the root of c:\ Ive just tried the basic regcreatekeyex method and although it compiles it does not actually create anything and I think ive missed something very fundamental here (please forgive the noobie status). Here is the code: DWORD dwRes, dwDisposition; SECURITY_ATTRIBUTES sa; LONG lRes; HKEY hkSub = NULL; lRes = RegCreateKeyEx(HKEY_CURRENT_USER, "mykey", 0, "", 0, KEY_READ | KEY_WRITE, &sa, &hkSub, &dwDisposition); It compiles fine but when i run regedit and try to find "mykey" it comes up with nothing. Any help would be greatly appreciated. Thanks Nic :confused:

      G Offline
      G Offline
      GDavy
      wrote on last edited by
      #2

      try: lRes = RegCreateKeyEx(HKEY_CURRENT_USER, "mykey", 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &hkSub, &dwDisposition); Since you don^t fill the security attributes struct, passing a NULL pointer should do what you want. Same with classname..... Greetings, Davy

      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