// Create a CServiceConfig object.
HRESULT hr = CoCreateInstance(CLSID_CServiceConfig, NULL, CLSCTX_INPROC_SERVER,
IID_IUnknown, (void**)&pUnknownCSC);
if (FAILED(hr)) throw(hr);
// Query for the IServiceInheritanceConfig interface.
hr = pUnknownCSC->QueryInterface(IID_IServiceInheritanceConfig,
(void**)&pInheritanceConfig);
if (FAILED(hr)) throw(hr);
// Inherit the current context before using transactions.
hr = pInheritanceConfig->ContainingContextTreatment(CSC_Inherit);
if (FAILED(hr)) throw(hr);
// Query for the IServiceTransactionConfig interface.
hr = pUnknownCSC->QueryInterface(IID_IServiceTransactionConfig,
(void**)&pTransactionConfig);
if (FAILED(hr)) throw(hr);
// Configure transactions to always create a new one.
hr = pTransactionConfig->ConfigureTransaction(CSC_NewTransaction);
if (FAILED(hr)) throw(hr);
// Set the isolation level of the transactions to ReadCommitted.
hr = pTransactionConfig->IsolationLevel(
COMAdminTxIsolationLevelReadCommitted);
if (FAILED(hr)) throw(hr);
// Set the transaction time-out to 1 minute.
hr = pTransactionConfig->TransactionTimeout(60);
if (FAILED(hr)) throw(hr);