• 0

Need to create binary registry key


Question

I have a small binary file. Using the contents of this file I need to create a registry key in binary format.

Regedit won't allow paste when creating a new REG_BINARY key. Any other way to do it?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I already tried that. It's obviously in hex format. Was trying to save some programming effort.

Specifically this reg_binary value is for a digital certificate private key. Maybe there is a utility that can import a private key into a certificate store (a.k.a. a registry key)?

BTW: I have pvkimport.exe but. The private key I need to import is from the personal certificate store. Which in Windows XP is stored in the file system and not the registry.

Edited by U.N.C.L.E.
Link to comment
Share on other sites

  • 0

Here is how you would do it with C/C++

HKEY hkey;
	LONG ret;
	unsigned char binaryData[] = something;

	ret = RegOpenKeyEx(	HKEY_CURRENT_USER,
      "Software\\myapp\\",
      0,
      KEY_ALL_ACCESS,
      &hkey);
	if(ret != ERROR_SUCCESS) return false;

	ret = RegSetValueEx(hkey,"someKeyName",0,REG_BINARY,binaryData,sizeof(binaryData));
	if(ret != ERROR_SUCCESS) return false;

	return true;

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.