This topic is well-covered in the Fiddler book, which is a helpful reference to programming with FiddlerCore.
To machine-trust a root, your code must be running as Administrator and must use the .NET APIs:
private static bool setMachineTrust(X509Certificate2 oRootCert)
{
try
{
X509Store certStore = new X509Store(StoreName.Root,
StoreLocation.LocalMachine);
certStore.Open(OpenFlags.ReadWrite);
try
{
certStore.Add(oRootCert);
}
finally
{
certStore.Close();
}
return true;
}
catch (Exception eX)
{
return false;
}
}