Changeset 21353 for trunk/src/advapi32/crypt.c
- Timestamp:
- Feb 21, 2010, 5:30:47 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/advapi32/crypt.c
r21326 r21353 200 200 201 201 #define CRYPT_GetProvFunc(name) \ 202 if ( !(provider->pFuncs->p##name = ( void*)GetProcAddress(provider->hModule, #name)) ) goto error202 if ( !(provider->pFuncs->p##name = (fn##name *)GetProcAddress(provider->hModule, #name)) ) goto error 203 203 #define CRYPT_GetProvFuncOpt(name) \ 204 provider->pFuncs->p##name = ( void*)GetProcAddress(provider->hModule, #name)204 provider->pFuncs->p##name = (fn##name *)GetProcAddress(provider->hModule, #name) 205 205 static PCRYPTPROV CRYPT_LoadProvider(PCWSTR pImage) 206 206 { … … 208 208 DWORD errorcode = ERROR_NOT_ENOUGH_MEMORY; 209 209 210 if ( !(provider = CRYPT_Alloc(sizeof(CRYPTPROV))) ) goto error;211 if ( !(provider->pFuncs = CRYPT_Alloc(sizeof(PROVFUNCS))) ) goto error;212 if ( !(provider->pVTable = CRYPT_Alloc(sizeof(VTableProvStruc))) ) goto error;210 if ( !(provider = (PCRYPTPROV)CRYPT_Alloc(sizeof(CRYPTPROV))) ) goto error; 211 if ( !(provider->pFuncs = (PPROVFUNCS)CRYPT_Alloc(sizeof(PROVFUNCS))) ) goto error; 212 if ( !(provider->pVTable = (PVTableProvStruc)CRYPT_Alloc(sizeof(VTableProvStruc))) ) goto error; 213 213 if ( !(provider->hModule = LoadLibraryW(pImage)) ) 214 214 { … … 325 325 uuid.Data4[6], uuid.Data4[7] ); 326 326 RegSetValueExW(key, machineGuidW, 0, REG_SZ, 327 ( constBYTE *)buf,327 (BYTE *)buf, 328 328 (lstrlenW(buf)+1)*sizeof(WCHAR)); 329 329 } … … 417 417 goto error; 418 418 } 419 if(!(provname = CRYPT_Alloc(len)))419 if(!(provname = (PWSTR)CRYPT_Alloc(len))) 420 420 { 421 421 RegCloseKey(key); … … 433 433 RegCloseKey(key); 434 434 } else { 435 if ( !(provname = CRYPT_Alloc((strlenW(pszProvider) +1)*sizeof(WCHAR))) )435 if ( !(provname = (PWSTR)CRYPT_Alloc((strlenW(pszProvider) +1)*sizeof(WCHAR))) ) 436 436 { 437 437 SetLastError(ERROR_NOT_ENOUGH_MEMORY); … … 471 471 goto error; 472 472 } 473 if (!(temp = CRYPT_Alloc(len)))473 if (!(temp = (PWSTR)CRYPT_Alloc(len))) 474 474 { 475 475 RegCloseKey(key); … … 487 487 RegCloseKey(key); 488 488 len = ExpandEnvironmentStringsW(temp, NULL, 0); 489 if ( !(imagepath = CRYPT_Alloc(len*sizeof(WCHAR))) )489 if ( !(imagepath = (PWSTR)CRYPT_Alloc(len*sizeof(WCHAR))) ) 490 490 { 491 491 SetLastError(ERROR_NOT_ENOUGH_MEMORY); … … 660 660 661 661 pProv->refcount--; 662 if (pProv->refcount <= 0)662 if (pProv->refcount == 0) 663 663 { 664 664 ret = pProv->pFuncs->pCPReleaseContext(pProv->hPrivate, dwFlags); … … 757 757 return FALSE; 758 758 } 759 if ( !(hash = CRYPT_Alloc(sizeof(CRYPTHASH))) )759 if ( !(hash = (PCRYPTHASH)CRYPT_Alloc(sizeof(CRYPTHASH))) ) 760 760 { 761 761 SetLastError(ERROR_NOT_ENOUGH_MEMORY); … … 851 851 return FALSE; 852 852 } 853 if ( !(key = CRYPT_Alloc(sizeof(CRYPTKEY))) )853 if ( !(key = (PCRYPTKEY)CRYPT_Alloc(sizeof(CRYPTKEY))) ) 854 854 { 855 855 SetLastError(ERROR_NOT_ENOUGH_MEMORY); … … 984 984 } 985 985 986 if ( !(newhash = CRYPT_Alloc(sizeof(CRYPTHASH))) )986 if ( !(newhash = (PCRYPTHASH)CRYPT_Alloc(sizeof(CRYPTHASH))) ) 987 987 { 988 988 SetLastError(ERROR_NOT_ENOUGH_MEMORY); … … 1037 1037 } 1038 1038 1039 if ( !(newkey = CRYPT_Alloc(sizeof(CRYPTKEY))) )1039 if ( !(newkey = (PCRYPTKEY)CRYPT_Alloc(sizeof(CRYPTKEY))) ) 1040 1040 { 1041 1041 SetLastError(ERROR_NOT_ENOUGH_MEMORY); … … 1159 1159 NULL, NULL, NULL, NULL, NULL, NULL); 1160 1160 1161 if (!(provNameW = CRYPT_Alloc(*pcbProvName * sizeof(WCHAR))))1161 if (!(provNameW = (WCHAR *)CRYPT_Alloc(*pcbProvName * sizeof(WCHAR)))) 1162 1162 { 1163 1163 SetLastError(ERROR_NOT_ENOUGH_MEMORY); … … 1213 1213 if(!CryptEnumProvidersW(dwIndex, pdwReserved, dwFlags, pdwProvType, NULL, &bufsize)) 1214 1214 return FALSE; 1215 if ( pszProvName && !(str = CRYPT_Alloc(bufsize)) )1215 if ( pszProvName && !(str = (PWSTR)CRYPT_Alloc(bufsize)) ) 1216 1216 { 1217 1217 SetLastError(ERROR_NOT_ENOUGH_MEMORY); … … 1296 1296 } 1297 1297 keylen++; 1298 if ( !(keyname = CRYPT_Alloc(keylen*sizeof(WCHAR))) )1298 if ( !(keyname = (PWSTR)CRYPT_Alloc(keylen*sizeof(WCHAR))) ) 1299 1299 { 1300 1300 SetLastError(ERROR_NOT_ENOUGH_MEMORY); … … 1342 1342 if(!CryptEnumProviderTypesW(dwIndex, pdwReserved, dwFlags, pdwProvType, NULL, &bufsize)) 1343 1343 return FALSE; 1344 if ( pszTypeName && !(str = CRYPT_Alloc(bufsize)) )1344 if ( pszTypeName && !(str = (PWSTR)CRYPT_Alloc(bufsize)) ) 1345 1345 { 1346 1346 SetLastError(ERROR_NOT_ENOUGH_MEMORY); … … 1435 1435 return FALSE; 1436 1436 } 1437 if ( !(key = CRYPT_Alloc(sizeof(CRYPTKEY))) )1437 if ( !(key = (PCRYPTKEY)CRYPT_Alloc(sizeof(CRYPTKEY))) ) 1438 1438 { 1439 1439 SetLastError(ERROR_NOT_ENOUGH_MEMORY); … … 1540 1540 1541 1541 CryptGetDefaultProviderW(dwProvType, pdwReserved, dwFlags, NULL, &bufsize); 1542 if ( pszProvName && !(str = CRYPT_Alloc(bufsize)) )1542 if ( pszProvName && !(str = (PWSTR)CRYPT_Alloc(bufsize)) ) 1543 1543 { 1544 1544 SetLastError(ERROR_NOT_ENOUGH_MEMORY); … … 1703 1703 return FALSE; 1704 1704 } 1705 if ( !(key = CRYPT_Alloc(sizeof(CRYPTKEY))) )1705 if ( !(key = (PCRYPTKEY)CRYPT_Alloc(sizeof(CRYPTKEY))) ) 1706 1706 { 1707 1707 SetLastError(ERROR_NOT_ENOUGH_MEMORY); … … 1829 1829 } 1830 1830 1831 if ( !(importkey = CRYPT_Alloc(sizeof(CRYPTKEY))) )1831 if ( !(importkey = (PCRYPTKEY)CRYPT_Alloc(sizeof(CRYPTKEY))) ) 1832 1832 { 1833 1833 SetLastError(ERROR_NOT_ENOUGH_MEMORY); … … 2067 2067 if (dwFlags & CRYPT_DELETE_DEFAULT) 2068 2068 { 2069 RegDeleteValueW(hTypeKey,nameW);2069 RegDeleteValueW(hTypeKey, (WCHAR*)nameW); 2070 2070 } 2071 2071 else … … 2087 2087 CRYPT_Free(keyname); 2088 2088 2089 if (RegSetValueExW(hTypeKey, nameW, 0, REG_SZ, ( constBYTE *)pszProvName,2089 if (RegSetValueExW(hTypeKey, nameW, 0, REG_SZ, (BYTE *)pszProvName, 2090 2090 (strlenW(pszProvName) + 1)*sizeof(WCHAR))) 2091 2091 {
Note:
See TracChangeset
for help on using the changeset viewer.