Home | Info | Community | Development | myReactOS | Contact Us
[static]
Definition at line 794 of file oid.c.
Referenced by CryptRegisterDefaultOIDFunction().
00796 { 00797 LPWSTR ret; 00798 00799 if (!multi) 00800 { 00801 /* FIXME: ignoring index, is that okay? */ 00802 ret = CryptMemAlloc((lstrlenW(toAdd) + 2) * sizeof(WCHAR)); 00803 if (ret) 00804 { 00805 /* copy string, including NULL terminator */ 00806 memcpy(ret, toAdd, (lstrlenW(toAdd) + 1) * sizeof(WCHAR)); 00807 /* add terminating empty string */ 00808 *(ret + lstrlenW(toAdd) + 1) = 0; 00809 } 00810 } 00811 else 00812 { 00813 DWORD len = CRYPT_GetMultiStringCharacterLen(multi); 00814 00815 ret = CryptMemRealloc(multi, (len + lstrlenW(toAdd) + 1) * 00816 sizeof(WCHAR)); 00817 if (ret) 00818 { 00819 LPWSTR spotToAdd; 00820 00821 if (index == CRYPT_REGISTER_LAST_INDEX) 00822 spotToAdd = ret + len - 1; 00823 else 00824 { 00825 DWORD i; 00826 00827 /* FIXME: if index is too large for the string, toAdd is 00828 * added to the end. Is that okay? 00829 */ 00830 for (i = 0, spotToAdd = ret; i < index && *spotToAdd; 00831 spotToAdd += lstrlenW(spotToAdd) + 1) 00832 ; 00833 } 00834 if (spotToAdd) 00835 { 00836 /* Copy existing string "right" */ 00837 memmove(spotToAdd + lstrlenW(toAdd) + 1, spotToAdd, 00838 (len - (spotToAdd - ret)) * sizeof(WCHAR)); 00839 /* Copy new string */ 00840 memcpy(spotToAdd, toAdd, (lstrlenW(toAdd) + 1) * sizeof(WCHAR)); 00841 } 00842 else 00843 { 00844 CryptMemFree(ret); 00845 ret = NULL; 00846 } 00847 } 00848 } 00849 return ret; 00850 }