00598 {
00599 LONG r;
00600 HKEY hKey;
00601 LPSTR szKey;
00602
00603 TRACE("(%x, %s, %s, %s, %s)\n", dwEncodingType, debugstr_a(pszFuncName),
00604 debugstr_a(pszOID), debugstr_w(pwszDll), debugstr_a(pszOverrideFuncName));
00605
00606
00607 if (!pwszDll)
00608 return TRUE;
00609
00610
00611
00612
00613
00614 if (!pszFuncName || !pszOID)
00615 {
00616 SetLastError(E_INVALIDARG);
00617 return FALSE;
00618 }
00619
00620 szKey = CRYPT_GetKeyName(dwEncodingType, pszFuncName, pszOID);
00621 TRACE("Key name is %s\n", debugstr_a(szKey));
00622
00623 if (!szKey)
00624 return FALSE;
00625
00626 r = RegCreateKeyA(HKEY_LOCAL_MACHINE, szKey, &hKey);
00627 CryptMemFree(szKey);
00628
00629 if (r != ERROR_SUCCESS) goto error_close_key;
00630
00631
00632 if (pszOverrideFuncName)
00633 {
00634 r = RegSetValueExA(hKey, "FuncName", 0, REG_SZ,
00635 (const BYTE*)pszOverrideFuncName, lstrlenA(pszOverrideFuncName) + 1);
00636 if (r != ERROR_SUCCESS) goto error_close_key;
00637 }
00638 r = RegSetValueExW(hKey, DllW, 0, REG_SZ, (const BYTE*) pwszDll,
00639 (lstrlenW(pwszDll) + 1) * sizeof (WCHAR));
00640
00641 error_close_key:
00642
00643 RegCloseKey(hKey);
00644
00645 if (r != ERROR_SUCCESS)
00646 {
00647 SetLastError(r);
00648 return FALSE;
00649 }
00650
00651 return TRUE;
00652 }