向注册表写入项一般步骤分为3步:
1. 根据输入的root key和注册表路径(或称sub key),打开相应的注册表项。相关Windows API为:
LONG WINAPI RegCreateKeyEx( _In_ HKEY hKey, _In_ LPCTSTR lpSubKey, _Reserved_ DWORD Reserved, _In_opt_ LPTSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition );参考: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724844(v=vs.85).aspx