Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

BOOL WINAPI CryptRegisterOIDFunction ( DWORD  dwEncodingType,
LPCSTR  pszFuncName,
LPCSTR  pszOID,
LPCWSTR  pwszDll,
LPCSTR  pszOverrideFuncName 
)

Definition at line 596 of file oid.c.

Referenced by DllRegisterServer().

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     /* Native does nothing pwszDll is NULL */
00607     if (!pwszDll)
00608         return TRUE;
00609 
00610     /* I'm not matching MS bug for bug here, because I doubt any app depends on
00611      * it:  native "succeeds" if pszFuncName is NULL, but the nonsensical entry
00612      * it creates would never be used.
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     /* write the values */
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 }


Generated on Fri Feb 10 05:27:54 2012 for ReactOS by doxygen 1.6.3

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.