00227 {
00228 BOOL ret = TRUE;
00229 struct OIDFunctionSet *set;
00230
00231 TRACE("(%p, %d, %s, %d, %p, %08x)\n", hModule, dwEncodingType,
00232 debugstr_a(pszFuncName), cFuncEntry, rgFuncEntry, dwFlags);
00233
00234 set = CryptInitOIDFunctionSet(pszFuncName, 0);
00235 if (set)
00236 {
00237 DWORD i;
00238
00239 EnterCriticalSection(&set->cs);
00240 for (i = 0; ret && i < cFuncEntry; i++)
00241 {
00242 struct OIDFunction *func;
00243
00244 if (!IS_INTOID(rgFuncEntry[i].pszOID))
00245 func = CryptMemAlloc(sizeof(struct OIDFunction)
00246 + strlen(rgFuncEntry[i].pszOID) + 1);
00247 else
00248 func = CryptMemAlloc(sizeof(struct OIDFunction));
00249 if (func)
00250 {
00251 func->encoding = GET_CERT_ENCODING_TYPE(dwEncodingType);
00252 if (!IS_INTOID(rgFuncEntry[i].pszOID))
00253 {
00254 LPSTR oid;
00255
00256 oid = (LPSTR)((LPBYTE)func + sizeof(*func));
00257 strcpy(oid, rgFuncEntry[i].pszOID);
00258 func->entry.pszOID = oid;
00259 }
00260 else
00261 func->entry.pszOID = rgFuncEntry[i].pszOID;
00262 func->entry.pvFuncAddr = rgFuncEntry[i].pvFuncAddr;
00263 list_add_tail(&set->functions, &func->next);
00264 }
00265 else
00266 ret = FALSE;
00267 }
00268 LeaveCriticalSection(&set->cs);
00269 }
00270 else
00271 ret = FALSE;
00272 return ret;
00273 }