If I understand you correctly, you just want to split the string "HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Firefox" into substrings "HKEY_LOCAL_MACHINE" and "SOFTWARE\Mozilla\Firefox". There are no Win32 API functions for that exact purpose, but you can use the find() and substr() methods of C++'s std::wstring class, eg:
#include <string>
std::wstring keyname = ...; // "HKEY_LOCAL_MACHINE\\SOFTWARE\\Mozilla\\Firefox"
std::wstring::size_type pos = keyname.find(L'\\');
if (pos != std::wstring::npos)
{
std::wstring root = keyname.substr(0, pos);
std::wstring key = keyname.substr(pos+1);
// use root and key as needed...
}
Alternative, you can use std::wistringstream and std::getline():
#include <string>
#include <sstream>
std::wstring keyname = ...; // "HKEY_LOCAL_MACHINE\\SOFTWARE\\Mozilla\\Firefox"
std::wstring root, key;
std::wistringstream iss(keyname);
if (std::getline(iss, root, L'\\') && std::getline(iss, key))
{
// use root and key as needed...
}