Commit d117938f authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

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

parent 1c282736
...@@ -748,7 +748,7 @@ static SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextW( ...@@ -748,7 +748,7 @@ static SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextW(
if (fContextReq & ISC_REQ_ALLOCATE_MEMORY) 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; pOutput->pBuffers[token_idx].cbBuffer = bin_len;
} }
else if (pOutput->pBuffers[token_idx].cbBuffer < bin_len) else if (pOutput->pBuffers[token_idx].cbBuffer < bin_len)
......
...@@ -169,7 +169,7 @@ PWSTR SECUR32_strdupW(PCWSTR str) ...@@ -169,7 +169,7 @@ PWSTR SECUR32_strdupW(PCWSTR str)
if (str) if (str)
{ {
ret = (PWSTR)SECUR32_ALLOC((lstrlenW(str) + 1) * sizeof(WCHAR)); ret = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(str) + 1) * sizeof(WCHAR));
if (ret) if (ret)
lstrcpyW(ret, str); lstrcpyW(ret, str);
} }
...@@ -188,7 +188,7 @@ PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str) ...@@ -188,7 +188,7 @@ PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str)
if (charsNeeded) if (charsNeeded)
{ {
ret = (PWSTR)SECUR32_ALLOC(charsNeeded * sizeof(WCHAR)); ret = HeapAlloc(GetProcessHeap(), 0, charsNeeded * sizeof(WCHAR));
if (ret) if (ret)
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, charsNeeded); MultiByteToWideChar(CP_ACP, 0, str, -1, ret, charsNeeded);
} }
...@@ -211,7 +211,7 @@ PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str) ...@@ -211,7 +211,7 @@ PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str)
if (charsNeeded) if (charsNeeded)
{ {
ret = (PSTR)SECUR32_ALLOC(charsNeeded); ret = HeapAlloc(GetProcessHeap(), 0, charsNeeded);
if (ret) if (ret)
WideCharToMultiByte(CP_ACP, 0, str, -1, ret, charsNeeded, WideCharToMultiByte(CP_ACP, 0, str, -1, ret, charsNeeded,
NULL, NULL); NULL, NULL);
...@@ -663,8 +663,8 @@ static void SECUR32_freeProviders(void) ...@@ -663,8 +663,8 @@ static void SECUR32_freeProviders(void)
{ {
LIST_FOR_EACH_ENTRY(package, &packageTable->table, SecurePackage, entry) LIST_FOR_EACH_ENTRY(package, &packageTable->table, SecurePackage, entry)
{ {
SECUR32_FREE(package->infoW.Name); HeapFree(GetProcessHeap(), 0, package->infoW.Name);
SECUR32_FREE(package->infoW.Comment); HeapFree(GetProcessHeap(), 0, package->infoW.Comment);
} }
HeapFree(GetProcessHeap(), 0, packageTable); HeapFree(GetProcessHeap(), 0, packageTable);
...@@ -675,7 +675,7 @@ static void SECUR32_freeProviders(void) ...@@ -675,7 +675,7 @@ static void SECUR32_freeProviders(void)
{ {
LIST_FOR_EACH_ENTRY(provider, &providerTable->table, SecureProvider, entry) LIST_FOR_EACH_ENTRY(provider, &providerTable->table, SecureProvider, entry)
{ {
SECUR32_FREE(provider->moduleName); HeapFree(GetProcessHeap(), 0, provider->moduleName);
if (provider->lib) if (provider->lib)
FreeLibrary(provider->lib); FreeLibrary(provider->lib);
} }
...@@ -698,7 +698,7 @@ static void SECUR32_freeProviders(void) ...@@ -698,7 +698,7 @@ static void SECUR32_freeProviders(void)
*/ */
SECURITY_STATUS WINAPI FreeContextBuffer(PVOID pv) SECURITY_STATUS WINAPI FreeContextBuffer(PVOID pv)
{ {
SECUR32_FREE(pv); HeapFree(GetProcessHeap(), 0, pv);
return SEC_E_OK; return SEC_E_OK;
} }
...@@ -731,7 +731,7 @@ SECURITY_STATUS WINAPI EnumerateSecurityPackagesW(PULONG pcPackages, ...@@ -731,7 +731,7 @@ SECURITY_STATUS WINAPI EnumerateSecurityPackagesW(PULONG pcPackages,
} }
if (bytesNeeded) if (bytesNeeded)
{ {
*ppPackageInfo = (PSecPkgInfoW)SECUR32_ALLOC(bytesNeeded); *ppPackageInfo = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
if (*ppPackageInfo) if (*ppPackageInfo)
{ {
ULONG i = 0; ULONG i = 0;
...@@ -796,7 +796,7 @@ static PSecPkgInfoA thunk_PSecPkgInfoWToA(ULONG cPackages, ...@@ -796,7 +796,7 @@ static PSecPkgInfoA thunk_PSecPkgInfoWToA(ULONG cPackages,
bytesNeeded += WideCharToMultiByte(CP_ACP, 0, info[i].Comment, bytesNeeded += WideCharToMultiByte(CP_ACP, 0, info[i].Comment,
-1, NULL, 0, NULL, NULL); -1, NULL, 0, NULL, NULL);
} }
ret = (PSecPkgInfoA)SECUR32_ALLOC(bytesNeeded); ret = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
if (ret) if (ret)
{ {
PSTR nextString; PSTR nextString;
......
...@@ -24,12 +24,6 @@ ...@@ -24,12 +24,6 @@
#include <sys/types.h> #include <sys/types.h>
#include "wine/list.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 typedef struct _SecureProvider
{ {
struct list entry; struct list entry;
...@@ -119,7 +113,7 @@ SecurePackage *SECUR32_findPackageW(PCWSTR packageName); ...@@ -119,7 +113,7 @@ SecurePackage *SECUR32_findPackageW(PCWSTR packageName);
SecurePackage *SECUR32_findPackageA(PCSTR packageName); SecurePackage *SECUR32_findPackageA(PCSTR packageName);
/* A few string helpers; will return NULL if str is NULL. Free return with /* A few string helpers; will return NULL if str is NULL. Free return with
* SECUR32_FREE */ * HeapFree */
PWSTR SECUR32_strdupW(PCWSTR str); PWSTR SECUR32_strdupW(PCWSTR str);
PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str); PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str);
PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str); PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str);
......
...@@ -76,8 +76,8 @@ SECURITY_STATUS SEC_ENTRY thunk_AcquireCredentialsHandleW( ...@@ -76,8 +76,8 @@ SECURITY_STATUS SEC_ENTRY thunk_AcquireCredentialsHandleW(
ret = AcquireCredentialsHandleA(principal, package, fCredentialsUse, ret = AcquireCredentialsHandleA(principal, package, fCredentialsUse,
pvLogonID, pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential, pvLogonID, pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential,
ptsExpiry); ptsExpiry);
SECUR32_FREE(principal); HeapFree(GetProcessHeap(), 0, principal);
SECUR32_FREE(package); HeapFree(GetProcessHeap(), 0, package);
} }
else else
ret = SEC_E_SECPKG_NOT_FOUND; ret = SEC_E_SECPKG_NOT_FOUND;
...@@ -259,7 +259,7 @@ SECURITY_STATUS SEC_ENTRY thunk_InitializeSecurityContextW( ...@@ -259,7 +259,7 @@ SECURITY_STATUS SEC_ENTRY thunk_InitializeSecurityContextW(
phCredential, phContext, target, fContextReq, Reserved1, phCredential, phContext, target, fContextReq, Reserved1,
TargetDataRep, pInput, Reserved2, phNewContext, pOutput, TargetDataRep, pInput, Reserved2, phNewContext, pOutput,
pfContextAttr, ptsExpiry); pfContextAttr, ptsExpiry);
SECUR32_FREE(target); HeapFree(GetProcessHeap(), 0, target);
} }
else else
ret = SEC_E_UNSUPPORTED_FUNCTION; ret = SEC_E_UNSUPPORTED_FUNCTION;
...@@ -337,8 +337,8 @@ SECURITY_STATUS SEC_ENTRY thunk_AddCredentialsW(PCredHandle hCredentials, ...@@ -337,8 +337,8 @@ SECURITY_STATUS SEC_ENTRY thunk_AddCredentialsW(PCredHandle hCredentials,
ret = package->provider->fnTableA.AddCredentialsA( ret = package->provider->fnTableA.AddCredentialsA(
cred, szPrincipal, szPackage, fCredentialUse, pAuthData, cred, szPrincipal, szPackage, fCredentialUse, pAuthData,
pGetKeyFn, pvGetKeyArgument, ptsExpiry); pGetKeyFn, pvGetKeyArgument, ptsExpiry);
SECUR32_FREE(szPrincipal); HeapFree(GetProcessHeap(), 0, szPrincipal);
SECUR32_FREE(szPackage); HeapFree(GetProcessHeap(), 0, szPackage);
} }
else else
ret = SEC_E_UNSUPPORTED_FUNCTION; ret = SEC_E_UNSUPPORTED_FUNCTION;
...@@ -372,7 +372,7 @@ static PSecPkgInfoA _copyPackageInfoFlatWToA(const SecPkgInfoW *infoW) ...@@ -372,7 +372,7 @@ static PSecPkgInfoA _copyPackageInfoFlatWToA(const SecPkgInfoW *infoW)
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
bytesNeeded += commentLen; bytesNeeded += commentLen;
} }
ret = (PSecPkgInfoA)SECUR32_ALLOC(bytesNeeded); ret = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
if (ret) if (ret)
{ {
PSTR nextString = (PSTR)((PBYTE)ret + sizeof(SecPkgInfoA)); PSTR nextString = (PSTR)((PBYTE)ret + sizeof(SecPkgInfoA));
...@@ -597,7 +597,7 @@ static PSecPkgInfoW _copyPackageInfoFlatAToW(const SecPkgInfoA *infoA) ...@@ -597,7 +597,7 @@ static PSecPkgInfoW _copyPackageInfoFlatAToW(const SecPkgInfoA *infoA)
NULL, 0); NULL, 0);
bytesNeeded += commentLen * sizeof(WCHAR); bytesNeeded += commentLen * sizeof(WCHAR);
} }
ret = (PSecPkgInfoW)SECUR32_ALLOC(bytesNeeded); ret = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
if (ret) if (ret)
{ {
PWSTR nextString = (PWSTR)((PBYTE)ret + sizeof(SecPkgInfoW)); PWSTR nextString = (PWSTR)((PBYTE)ret + sizeof(SecPkgInfoW));
...@@ -894,6 +894,6 @@ SECURITY_STATUS SEC_ENTRY thunk_ImportSecurityContextW( ...@@ -894,6 +894,6 @@ SECURITY_STATUS SEC_ENTRY thunk_ImportSecurityContextW(
TRACE("%s %p %p %p\n", debugstr_w(pszPackage), pPackedContext, Token, TRACE("%s %p %p %p\n", debugstr_w(pszPackage), pPackedContext, Token,
phContext); phContext);
ret = ImportSecurityContextA(package, pPackedContext, Token, phContext); ret = ImportSecurityContextA(package, pPackedContext, Token, phContext);
SECUR32_FREE(package); HeapFree(GetProcessHeap(), 0, package);
return ret; return ret;
} }
...@@ -41,7 +41,7 @@ static SECURITY_STATUS SECUR32_makeSecHandle(PSecHandle phSec, ...@@ -41,7 +41,7 @@ static SECURITY_STATUS SECUR32_makeSecHandle(PSecHandle phSec,
if (phSec && package && realHandle) if (phSec && package && realHandle)
{ {
PSecHandle newSec = (PSecHandle)SECUR32_ALLOC(sizeof(SecHandle)); PSecHandle newSec = HeapAlloc(GetProcessHeap(), 0, sizeof(SecHandle));
if (newSec) if (newSec)
{ {
...@@ -169,7 +169,7 @@ SECURITY_STATUS WINAPI FreeCredentialsHandle( ...@@ -169,7 +169,7 @@ SECURITY_STATUS WINAPI FreeCredentialsHandle(
ret = package->provider->fnTableW.FreeCredentialsHandle(cred); ret = package->provider->fnTableW.FreeCredentialsHandle(cred);
else else
ret = SEC_E_INVALID_HANDLE; ret = SEC_E_INVALID_HANDLE;
SECUR32_FREE(cred); HeapFree(GetProcessHeap(), 0, cred);
} }
else else
ret = SEC_E_INVALID_HANDLE; ret = SEC_E_INVALID_HANDLE;
...@@ -465,7 +465,7 @@ SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext) ...@@ -465,7 +465,7 @@ SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext)
ret = package->provider->fnTableW.DeleteSecurityContext(ctxt); ret = package->provider->fnTableW.DeleteSecurityContext(ctxt);
else else
ret = SEC_E_INVALID_HANDLE; ret = SEC_E_INVALID_HANDLE;
SECUR32_FREE(ctxt); HeapFree(GetProcessHeap(), 0, ctxt);
} }
else else
ret = SEC_E_INVALID_HANDLE; ret = SEC_E_INVALID_HANDLE;
...@@ -710,7 +710,7 @@ SECURITY_STATUS WINAPI QuerySecurityPackageInfoA(SEC_CHAR *pszPackageName, ...@@ -710,7 +710,7 @@ SECURITY_STATUS WINAPI QuerySecurityPackageInfoA(SEC_CHAR *pszPackageName,
package->infoW.Comment, -1, NULL, 0, NULL, NULL); package->infoW.Comment, -1, NULL, 0, NULL, NULL);
bytesNeeded += commentLen; bytesNeeded += commentLen;
} }
*ppPackageInfo = (PSecPkgInfoA)SECUR32_ALLOC(bytesNeeded); *ppPackageInfo = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
if (*ppPackageInfo) if (*ppPackageInfo)
{ {
PSTR nextString = (PSTR)((PBYTE)*ppPackageInfo + PSTR nextString = (PSTR)((PBYTE)*ppPackageInfo +
...@@ -772,7 +772,7 @@ SECURITY_STATUS WINAPI QuerySecurityPackageInfoW(SEC_WCHAR *pszPackageName, ...@@ -772,7 +772,7 @@ SECURITY_STATUS WINAPI QuerySecurityPackageInfoW(SEC_WCHAR *pszPackageName,
commentLen = lstrlenW(package->infoW.Comment) + 1; commentLen = lstrlenW(package->infoW.Comment) + 1;
bytesNeeded += commentLen * sizeof(WCHAR); bytesNeeded += commentLen * sizeof(WCHAR);
} }
*ppPackageInfo = (PSecPkgInfoW)SECUR32_ALLOC(bytesNeeded); *ppPackageInfo = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
if (*ppPackageInfo) if (*ppPackageInfo)
{ {
PWSTR nextString = (PWSTR)((PBYTE)*ppPackageInfo + PWSTR nextString = (PWSTR)((PBYTE)*ppPackageInfo +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment