secur32: Remove the SECUR32_ALLOC() macro around HeapAlloc().

This commit is contained in:
Michael Stefaniuc 2007-12-05 21:52:20 +01:00 committed by Alexandre Julliard
parent 1c28273686
commit d117938f7a
5 changed files with 24 additions and 30 deletions

View file

@ -748,7 +748,7 @@ static SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextW(
if (fContextReq & ISC_REQ_ALLOCATE_MEMORY)
{
pOutput->pBuffers[token_idx].pvBuffer = SECUR32_ALLOC(bin_len);
pOutput->pBuffers[token_idx].pvBuffer = HeapAlloc(GetProcessHeap(), 0, bin_len);
pOutput->pBuffers[token_idx].cbBuffer = bin_len;
}
else if (pOutput->pBuffers[token_idx].cbBuffer < bin_len)

View file

@ -169,7 +169,7 @@ PWSTR SECUR32_strdupW(PCWSTR str)
if (str)
{
ret = (PWSTR)SECUR32_ALLOC((lstrlenW(str) + 1) * sizeof(WCHAR));
ret = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(str) + 1) * sizeof(WCHAR));
if (ret)
lstrcpyW(ret, str);
}
@ -188,7 +188,7 @@ PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str)
if (charsNeeded)
{
ret = (PWSTR)SECUR32_ALLOC(charsNeeded * sizeof(WCHAR));
ret = HeapAlloc(GetProcessHeap(), 0, charsNeeded * sizeof(WCHAR));
if (ret)
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, charsNeeded);
}
@ -211,7 +211,7 @@ PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str)
if (charsNeeded)
{
ret = (PSTR)SECUR32_ALLOC(charsNeeded);
ret = HeapAlloc(GetProcessHeap(), 0, charsNeeded);
if (ret)
WideCharToMultiByte(CP_ACP, 0, str, -1, ret, charsNeeded,
NULL, NULL);
@ -663,8 +663,8 @@ static void SECUR32_freeProviders(void)
{
LIST_FOR_EACH_ENTRY(package, &packageTable->table, SecurePackage, entry)
{
SECUR32_FREE(package->infoW.Name);
SECUR32_FREE(package->infoW.Comment);
HeapFree(GetProcessHeap(), 0, package->infoW.Name);
HeapFree(GetProcessHeap(), 0, package->infoW.Comment);
}
HeapFree(GetProcessHeap(), 0, packageTable);
@ -675,7 +675,7 @@ static void SECUR32_freeProviders(void)
{
LIST_FOR_EACH_ENTRY(provider, &providerTable->table, SecureProvider, entry)
{
SECUR32_FREE(provider->moduleName);
HeapFree(GetProcessHeap(), 0, provider->moduleName);
if (provider->lib)
FreeLibrary(provider->lib);
}
@ -698,7 +698,7 @@ static void SECUR32_freeProviders(void)
*/
SECURITY_STATUS WINAPI FreeContextBuffer(PVOID pv)
{
SECUR32_FREE(pv);
HeapFree(GetProcessHeap(), 0, pv);
return SEC_E_OK;
}
@ -731,7 +731,7 @@ SECURITY_STATUS WINAPI EnumerateSecurityPackagesW(PULONG pcPackages,
}
if (bytesNeeded)
{
*ppPackageInfo = (PSecPkgInfoW)SECUR32_ALLOC(bytesNeeded);
*ppPackageInfo = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
if (*ppPackageInfo)
{
ULONG i = 0;
@ -796,7 +796,7 @@ static PSecPkgInfoA thunk_PSecPkgInfoWToA(ULONG cPackages,
bytesNeeded += WideCharToMultiByte(CP_ACP, 0, info[i].Comment,
-1, NULL, 0, NULL, NULL);
}
ret = (PSecPkgInfoA)SECUR32_ALLOC(bytesNeeded);
ret = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
if (ret)
{
PSTR nextString;

View file

@ -24,12 +24,6 @@
#include <sys/types.h>
#include "wine/list.h"
/* Memory allocation functions for memory accessible by callers of secur32.
* The details are implementation specific.
*/
#define SECUR32_ALLOC(bytes) HeapAlloc(GetProcessHeap(), 0, (bytes))
#define SECUR32_FREE(p) HeapFree(GetProcessHeap(), 0, (p))
typedef struct _SecureProvider
{
struct list entry;
@ -119,7 +113,7 @@ SecurePackage *SECUR32_findPackageW(PCWSTR packageName);
SecurePackage *SECUR32_findPackageA(PCSTR packageName);
/* A few string helpers; will return NULL if str is NULL. Free return with
* SECUR32_FREE */
* HeapFree */
PWSTR SECUR32_strdupW(PCWSTR str);
PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str);
PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str);

View file

@ -76,8 +76,8 @@ SECURITY_STATUS SEC_ENTRY thunk_AcquireCredentialsHandleW(
ret = AcquireCredentialsHandleA(principal, package, fCredentialsUse,
pvLogonID, pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential,
ptsExpiry);
SECUR32_FREE(principal);
SECUR32_FREE(package);
HeapFree(GetProcessHeap(), 0, principal);
HeapFree(GetProcessHeap(), 0, package);
}
else
ret = SEC_E_SECPKG_NOT_FOUND;
@ -259,7 +259,7 @@ SECURITY_STATUS SEC_ENTRY thunk_InitializeSecurityContextW(
phCredential, phContext, target, fContextReq, Reserved1,
TargetDataRep, pInput, Reserved2, phNewContext, pOutput,
pfContextAttr, ptsExpiry);
SECUR32_FREE(target);
HeapFree(GetProcessHeap(), 0, target);
}
else
ret = SEC_E_UNSUPPORTED_FUNCTION;
@ -337,8 +337,8 @@ SECURITY_STATUS SEC_ENTRY thunk_AddCredentialsW(PCredHandle hCredentials,
ret = package->provider->fnTableA.AddCredentialsA(
cred, szPrincipal, szPackage, fCredentialUse, pAuthData,
pGetKeyFn, pvGetKeyArgument, ptsExpiry);
SECUR32_FREE(szPrincipal);
SECUR32_FREE(szPackage);
HeapFree(GetProcessHeap(), 0, szPrincipal);
HeapFree(GetProcessHeap(), 0, szPackage);
}
else
ret = SEC_E_UNSUPPORTED_FUNCTION;
@ -372,7 +372,7 @@ static PSecPkgInfoA _copyPackageInfoFlatWToA(const SecPkgInfoW *infoW)
NULL, 0, NULL, NULL);
bytesNeeded += commentLen;
}
ret = (PSecPkgInfoA)SECUR32_ALLOC(bytesNeeded);
ret = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
if (ret)
{
PSTR nextString = (PSTR)((PBYTE)ret + sizeof(SecPkgInfoA));
@ -597,7 +597,7 @@ static PSecPkgInfoW _copyPackageInfoFlatAToW(const SecPkgInfoA *infoA)
NULL, 0);
bytesNeeded += commentLen * sizeof(WCHAR);
}
ret = (PSecPkgInfoW)SECUR32_ALLOC(bytesNeeded);
ret = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
if (ret)
{
PWSTR nextString = (PWSTR)((PBYTE)ret + sizeof(SecPkgInfoW));
@ -894,6 +894,6 @@ SECURITY_STATUS SEC_ENTRY thunk_ImportSecurityContextW(
TRACE("%s %p %p %p\n", debugstr_w(pszPackage), pPackedContext, Token,
phContext);
ret = ImportSecurityContextA(package, pPackedContext, Token, phContext);
SECUR32_FREE(package);
HeapFree(GetProcessHeap(), 0, package);
return ret;
}

View file

@ -41,7 +41,7 @@ static SECURITY_STATUS SECUR32_makeSecHandle(PSecHandle phSec,
if (phSec && package && realHandle)
{
PSecHandle newSec = (PSecHandle)SECUR32_ALLOC(sizeof(SecHandle));
PSecHandle newSec = HeapAlloc(GetProcessHeap(), 0, sizeof(SecHandle));
if (newSec)
{
@ -169,7 +169,7 @@ SECURITY_STATUS WINAPI FreeCredentialsHandle(
ret = package->provider->fnTableW.FreeCredentialsHandle(cred);
else
ret = SEC_E_INVALID_HANDLE;
SECUR32_FREE(cred);
HeapFree(GetProcessHeap(), 0, cred);
}
else
ret = SEC_E_INVALID_HANDLE;
@ -465,7 +465,7 @@ SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext)
ret = package->provider->fnTableW.DeleteSecurityContext(ctxt);
else
ret = SEC_E_INVALID_HANDLE;
SECUR32_FREE(ctxt);
HeapFree(GetProcessHeap(), 0, ctxt);
}
else
ret = SEC_E_INVALID_HANDLE;
@ -710,7 +710,7 @@ SECURITY_STATUS WINAPI QuerySecurityPackageInfoA(SEC_CHAR *pszPackageName,
package->infoW.Comment, -1, NULL, 0, NULL, NULL);
bytesNeeded += commentLen;
}
*ppPackageInfo = (PSecPkgInfoA)SECUR32_ALLOC(bytesNeeded);
*ppPackageInfo = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
if (*ppPackageInfo)
{
PSTR nextString = (PSTR)((PBYTE)*ppPackageInfo +
@ -772,7 +772,7 @@ SECURITY_STATUS WINAPI QuerySecurityPackageInfoW(SEC_WCHAR *pszPackageName,
commentLen = lstrlenW(package->infoW.Comment) + 1;
bytesNeeded += commentLen * sizeof(WCHAR);
}
*ppPackageInfo = (PSecPkgInfoW)SECUR32_ALLOC(bytesNeeded);
*ppPackageInfo = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
if (*ppPackageInfo)
{
PWSTR nextString = (PWSTR)((PBYTE)*ppPackageInfo +