Source code of Windows XP (NT5)
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.
|
|
#include "precomp.h"
DWORD ExportNegPolDataToFile( HANDLE hSrcPolicyStore, PIPSEC_POLICY_STORE pDesPolicyStore ) { DWORD dwError = 0; PIPSEC_NEGPOL_DATA * ppIpsecNegPolData = NULL; DWORD dwNumNegPolObjects = 0; DWORD i = 0; PIPSEC_NEGPOL_DATA pIpsecNegPolData = NULL;
dwError = IPSecEnumNegPolData( hSrcPolicyStore, &ppIpsecNegPolData, &dwNumNegPolObjects ); BAIL_ON_WIN32_ERROR(dwError);
for (i = 0; i < dwNumNegPolObjects; i++) {
pIpsecNegPolData = *(ppIpsecNegPolData + i);
dwError = RegCreateNegPolData( pDesPolicyStore->hRegistryKey, pDesPolicyStore->pszIpsecRootContainer, pIpsecNegPolData ); BAIL_ON_WIN32_ERROR(dwError);
}
error:
if (ppIpsecNegPolData) { FreeMulIpsecNegPolData( ppIpsecNegPolData, dwNumNegPolObjects ); }
return (dwError); }
DWORD ImportNegPolDataFromFile( PIPSEC_POLICY_STORE pSrcPolicyStore, HANDLE hDesPolicyStore ) { DWORD dwError = 0; PIPSEC_NEGPOL_DATA * ppIpsecNegPolData = NULL; DWORD dwNumNegPolObjects = 0; DWORD i = 0; PIPSEC_NEGPOL_DATA pIpsecNegPolData = NULL;
dwError = RegEnumNegPolData( pSrcPolicyStore->hRegistryKey, pSrcPolicyStore->pszIpsecRootContainer, &ppIpsecNegPolData, &dwNumNegPolObjects ); BAIL_ON_WIN32_ERROR(dwError);
for (i = 0; i < dwNumNegPolObjects; i++) {
pIpsecNegPolData = *(ppIpsecNegPolData + i);
dwError = IPSecCreateNegPolData( hDesPolicyStore, pIpsecNegPolData ); if (dwError == ERROR_OBJECT_ALREADY_EXISTS) { dwError = IPSecSetNegPolData( hDesPolicyStore, pIpsecNegPolData ); BAIL_ON_WIN32_ERROR(dwError); } BAIL_ON_WIN32_ERROR(dwError);
}
error:
if (ppIpsecNegPolData) { FreeMulIpsecNegPolData( ppIpsecNegPolData, dwNumNegPolObjects ); }
return (dwError); }
|