Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

82 lines
1.9 KiB

#include "precomp.h"
DWORD
ExportPoliciesToFile(
HANDLE hSrcPolicyStore,
HANDLE hDesPolicyStore
)
{
DWORD dwError = 0;
PIPSEC_POLICY_STORE pDesPolicyStore = NULL;
PIPSEC_POLICY_DATA * ppIpsecPolicyData = NULL;
DWORD dwNumPolicyObjects = 0;
pDesPolicyStore = (PIPSEC_POLICY_STORE) hDesPolicyStore;
dwError = ExportFilterDataToFile(
hSrcPolicyStore,
pDesPolicyStore
);
dwError = ExportNegPolDataToFile(
hSrcPolicyStore,
pDesPolicyStore
);
dwError = ExportISAKMPDataToFile(
hSrcPolicyStore,
pDesPolicyStore
);
BAIL_ON_WIN32_ERROR(dwError);
dwError = ExportPolicyDataToFile(
hSrcPolicyStore,
pDesPolicyStore,
&ppIpsecPolicyData,
&dwNumPolicyObjects
);
BAIL_ON_WIN32_ERROR(dwError);
dwError = ExportNFADataToFile(
hSrcPolicyStore,
pDesPolicyStore,
ppIpsecPolicyData,
dwNumPolicyObjects
);
BAIL_ON_WIN32_ERROR(dwError);
dwError = EnablePrivilege(
SE_BACKUP_NAME
);
BAIL_ON_WIN32_ERROR(dwError);
_wremove(pDesPolicyStore->pszFileName);
dwError = RegSaveKeyW(
pDesPolicyStore->hRegistryKey,
pDesPolicyStore->pszFileName,
NULL
);
BAIL_ON_WIN32_ERROR(dwError);
error:
if (ppIpsecPolicyData) {
FreeMulIpsecPolicyData(
ppIpsecPolicyData,
dwNumPolicyObjects
);
}
FlushRegSaveKey(
pDesPolicyStore->hRegistryKey
);
return (dwError);
}