You don't need to copy registry keys with SpeechLib
You can use SpObjectTokenCategory.SetId with the 2nd registry path to get the voices.
Test :
// Add reference to : Microsoft Speech Object Library (SAPI)
At beginning :
SpVoice voice = new SpVoice();
Then :
{
ISpVoice pVoice = (ISpVoice)voice;
SpObjectTokenCategory otc = new SpObjectTokenCategory();
//otc.SetId("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices");
otc.SetId("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCore\\Voices");
ISpeechObjectTokens tokenEnum = otc.EnumerateTokens();
int nTokenCount = tokenEnum.Count;
Console.WriteLine("Number of voices: {0}", nTokenCount);
foreach (ISpeechObjectToken sot in tokenEnum)
{
Console.WriteLine("Voice : {0}", sot.GetDescription());
{
pVoice.SetVoice((ISpObjectToken)sot);
try
{
uint n = 0;
pVoice.Speak("Hello! This is a test", 0, out n);
}
catch (System.Exception ex)
{
Console.WriteLine("Cannot speak with the voice : {0}", sot.GetDescription());
}
Marshal.ReleaseComObject(sot);
}
}
}