advapi32: Switch to heap helpers in the rest of the code.

This commit is contained in:
Nikolay Sivov 2014-08-29 10:45:26 +04:00 committed by Alexandre Julliard
parent 5f52333d34
commit ae1d5912fe
3 changed files with 75 additions and 75 deletions

View File

@ -59,7 +59,7 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
BOOL ret;
DWORD sizeW = *lpSize;
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, sizeW * sizeof(WCHAR) )))
if (!(buffer = heap_alloc( sizeW * sizeof(WCHAR) )))
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return FALSE;
@ -71,7 +71,7 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
else
*lpSize = sizeW;
HeapFree( GetProcessHeap(), 0, buffer );
heap_free( buffer );
return ret;
}

View File

@ -39,6 +39,8 @@
#include "wine/unicode.h"
#include "wine/debug.h"
#include "advapi32_misc.h"
WINE_DEFAULT_DEBUG_CHANNEL(cred);
/* the size of the ARC4 key used to encrypt the password data */
@ -324,7 +326,7 @@ static DWORD mac_read_credential_from_item(SecKeychainItemRef item, BOOL require
if (!attr_list->attr[i].data) continue;
str_len = MultiByteToWideChar(CP_UTF8, 0, attr_list->attr[i].data,
attr_list->attr[i].length, NULL, 0);
user = HeapAlloc(GetProcessHeap(), 0, (str_len + 1) * sizeof(WCHAR));
user = heap_alloc((str_len + 1) * sizeof(WCHAR));
MultiByteToWideChar(CP_UTF8, 0, attr_list->attr[i].data,
attr_list->attr[i].length, user, str_len);
user[str_len] = '\0';
@ -388,7 +390,7 @@ static DWORD mac_read_credential_from_item(SecKeychainItemRef item, BOOL require
TRACE("UserName = %s\n", debugstr_w(credential->UserName));
}
}
HeapFree(GetProcessHeap(), 0, user);
heap_free(user);
if (cred_blob)
{
@ -426,7 +428,7 @@ static DWORD write_credential_blob(HKEY hkey, LPCWSTR target_name, DWORD type,
key.Length = key.MaximumLength = KEY_SIZE;
key.Buffer = (unsigned char *)key_data;
encrypted_credential_blob = HeapAlloc(GetProcessHeap(), 0, credential_blob_size);
encrypted_credential_blob = heap_alloc(credential_blob_size);
if (!encrypted_credential_blob) return ERROR_OUTOFMEMORY;
memcpy(encrypted_credential_blob, credential_blob, credential_blob_size);
@ -435,7 +437,7 @@ static DWORD write_credential_blob(HKEY hkey, LPCWSTR target_name, DWORD type,
SystemFunction032(&data, &key);
ret = RegSetValueExW(hkey, wszPasswordValue, 0, REG_BINARY, encrypted_credential_blob, credential_blob_size);
HeapFree(GetProcessHeap(), 0, encrypted_credential_blob);
heap_free(encrypted_credential_blob);
return ret;
}
@ -511,15 +513,15 @@ static DWORD mac_write_credential(const CREDENTIALW *credential, BOOL preserve_b
FIXME("custom attributes not supported\n");
userlen = WideCharToMultiByte(CP_UTF8, 0, credential->UserName, -1, NULL, 0, NULL, NULL);
username = HeapAlloc(GetProcessHeap(), 0, userlen * sizeof(*username));
username = heap_alloc(userlen * sizeof(*username));
WideCharToMultiByte(CP_UTF8, 0, credential->UserName, -1, username, userlen, NULL, NULL);
serverlen = WideCharToMultiByte(CP_UTF8, 0, credential->TargetName, -1, NULL, 0, NULL, NULL);
servername = HeapAlloc(GetProcessHeap(), 0, serverlen * sizeof(*servername));
servername = heap_alloc(serverlen * sizeof(*servername));
WideCharToMultiByte(CP_UTF8, 0, credential->TargetName, -1, servername, serverlen, NULL, NULL);
pwlen = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)credential->CredentialBlob,
credential->CredentialBlobSize / sizeof(WCHAR), NULL, 0, NULL, NULL);
password = HeapAlloc(GetProcessHeap(), 0, pwlen * sizeof(*password));
password = heap_alloc(pwlen * sizeof(*password));
WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)credential->CredentialBlob,
credential->CredentialBlobSize / sizeof(WCHAR), password, pwlen, NULL, NULL);
@ -535,11 +537,11 @@ static DWORD mac_write_credential(const CREDENTIALW *credential, BOOL preserve_b
if (status != noErr)
ERR("SecKeychainFindGenericPassword returned %ld\n", status);
}
HeapFree(GetProcessHeap(), 0, username);
HeapFree(GetProcessHeap(), 0, servername);
heap_free(username);
heap_free(servername);
if (status != noErr)
{
HeapFree(GetProcessHeap(), 0, password);
heap_free(password);
return ERROR_GEN_FAILURE;
}
if (credential->Comment)
@ -549,7 +551,7 @@ static DWORD mac_write_credential(const CREDENTIALW *credential, BOOL preserve_b
attrs[0].tag = kSecCommentItemAttr;
attrs[0].length = WideCharToMultiByte(CP_UTF8, 0, credential->Comment, -1, NULL, 0, NULL, NULL);
if (attrs[0].length) attrs[0].length--;
attrs[0].data = HeapAlloc(GetProcessHeap(), 0, attrs[0].length);
attrs[0].data = heap_alloc(attrs[0].length);
WideCharToMultiByte(CP_UTF8, 0, credential->Comment, -1, attrs[0].data, attrs[0].length, NULL, NULL);
}
else
@ -561,8 +563,8 @@ static DWORD mac_write_credential(const CREDENTIALW *credential, BOOL preserve_b
preserve_blob ? 0 : strlen(password),
preserve_blob ? NULL : password);
if (credential->Comment)
HeapFree(GetProcessHeap(), 0, attrs[0].data);
HeapFree(GetProcessHeap(), 0, password);
heap_free(attrs[0].data);
heap_free(password);
/* FIXME: set TargetAlias attribute */
CFRelease(keychain_item);
if (status != noErr)
@ -646,7 +648,7 @@ static LPWSTR get_key_name_for_target(LPCWSTR target_name, DWORD type)
len += sizeof(wszDomPasswdPrefix)/sizeof(wszDomPasswdPrefix[0]);
}
key_name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
key_name = heap_alloc(len * sizeof(WCHAR));
if (!key_name) return NULL;
strcpyW(key_name, prefix);
@ -674,13 +676,13 @@ static BOOL registry_credential_matches_filter(HKEY hkeyCred, LPCWSTR filter)
else if (type != REG_SZ)
return FALSE;
target_name = HeapAlloc(GetProcessHeap(), 0, count);
target_name = heap_alloc(count);
if (!target_name)
return FALSE;
ret = RegQueryValueExW(hkeyCred, NULL, 0, &type, (LPVOID)target_name, &count);
if (ret != ERROR_SUCCESS || type != REG_SZ)
{
HeapFree(GetProcessHeap(), 0, target_name);
heap_free(target_name);
return FALSE;
}
@ -692,7 +694,7 @@ static BOOL registry_credential_matches_filter(HKEY hkeyCred, LPCWSTR filter)
(p && !p[1] ? p - filter : -1), target_name,
(p && !p[1] ? p - filter : -1)) == CSTR_EQUAL;
HeapFree(GetProcessHeap(), 0, target_name);
heap_free(target_name);
return ret;
}
@ -753,7 +755,7 @@ static BOOL mac_credential_matches_filter(void *data, UInt32 data_len, const WCH
if (!filter) return TRUE;
len = MultiByteToWideChar(CP_UTF8, 0, data, data_len, NULL, 0);
if (!(target_name = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)))) return FALSE;
if (!(target_name = heap_alloc((len + 1) * sizeof(WCHAR)))) return FALSE;
MultiByteToWideChar(CP_UTF8, 0, data, data_len, target_name, len);
target_name[len] = 0;
@ -763,7 +765,7 @@ static BOOL mac_credential_matches_filter(void *data, UInt32 data_len, const WCH
ret = CompareStringW(GetThreadLocale(), NORM_IGNORECASE, filter,
(p && !p[1] ? p - filter : -1), target_name,
(p && !p[1] ? p - filter : -1)) == CSTR_EQUAL;
HeapFree(GetProcessHeap(), 0, target_name);
heap_free(target_name);
return ret;
}
@ -863,17 +865,17 @@ static DWORD mac_delete_credential(LPCWSTR TargetName)
continue;
}
str_len = MultiByteToWideChar(CP_UTF8, 0, attr_list->attr[0].data, attr_list->attr[0].length, NULL, 0);
target_name = HeapAlloc(GetProcessHeap(), 0, (str_len + 1) * sizeof(WCHAR));
target_name = heap_alloc((str_len + 1) * sizeof(WCHAR));
MultiByteToWideChar(CP_UTF8, 0, attr_list->attr[0].data, attr_list->attr[0].length, target_name, str_len);
/* nul terminate */
target_name[str_len] = '\0';
if (strcmpiW(TargetName, target_name))
{
CFRelease(item);
HeapFree(GetProcessHeap(), 0, target_name);
heap_free(target_name);
continue;
}
HeapFree(GetProcessHeap(), 0, target_name);
heap_free(target_name);
SecKeychainItemFreeAttributesAndData(attr_list, NULL);
SecKeychainItemDelete(item);
CFRelease(item);
@ -1086,7 +1088,7 @@ BOOL WINAPI CredDeleteA(LPCSTR TargetName, DWORD Type, DWORD Flags)
}
len = MultiByteToWideChar(CP_ACP, 0, TargetName, -1, NULL, 0);
TargetNameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
TargetNameW = heap_alloc(len * sizeof(WCHAR));
if (!TargetNameW)
{
SetLastError(ERROR_OUTOFMEMORY);
@ -1096,7 +1098,7 @@ BOOL WINAPI CredDeleteA(LPCSTR TargetName, DWORD Type, DWORD Flags)
ret = CredDeleteW(TargetNameW, Type, Flags);
HeapFree(GetProcessHeap(), 0, TargetNameW);
heap_free(TargetNameW);
return ret;
}
@ -1151,7 +1153,7 @@ BOOL WINAPI CredDeleteW(LPCWSTR TargetName, DWORD Type, DWORD Flags)
key_name = get_key_name_for_target(TargetName, Type);
ret = RegDeleteKeyW(hkeyMgr, key_name);
HeapFree(GetProcessHeap(), 0, key_name);
heap_free(key_name);
RegCloseKey(hkeyMgr);
if (ret != ERROR_SUCCESS)
{
@ -1180,7 +1182,7 @@ BOOL WINAPI CredEnumerateA(LPCSTR Filter, DWORD Flags, DWORD *Count,
if (Filter)
{
len = MultiByteToWideChar(CP_ACP, 0, Filter, -1, NULL, 0);
FilterW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
FilterW = heap_alloc(len * sizeof(WCHAR));
if (!FilterW)
{
SetLastError(ERROR_OUTOFMEMORY);
@ -1193,16 +1195,16 @@ BOOL WINAPI CredEnumerateA(LPCSTR Filter, DWORD Flags, DWORD *Count,
if (!CredEnumerateW(FilterW, Flags, Count, &CredentialsW))
{
HeapFree(GetProcessHeap(), 0, FilterW);
heap_free(FilterW);
return FALSE;
}
HeapFree(GetProcessHeap(), 0, FilterW);
heap_free(FilterW);
len = *Count * sizeof(PCREDENTIALA);
for (i = 0; i < *Count; i++)
len += convert_PCREDENTIALW_to_PCREDENTIALA(CredentialsW[i], NULL, 0);
*Credentials = HeapAlloc(GetProcessHeap(), 0, len);
*Credentials = heap_alloc(len);
if (!*Credentials)
{
CredFree(CredentialsW);
@ -1271,7 +1273,7 @@ BOOL WINAPI CredEnumerateW(LPCWSTR Filter, DWORD Flags, DWORD *Count,
return FALSE;
}
target_name = HeapAlloc(GetProcessHeap(), 0, (target_name_len+1)*sizeof(WCHAR));
target_name = heap_alloc((target_name_len+1)*sizeof(WCHAR));
if (!target_name)
{
RegCloseKey(hkeyMgr);
@ -1291,7 +1293,7 @@ BOOL WINAPI CredEnumerateW(LPCWSTR Filter, DWORD Flags, DWORD *Count,
ret = ERROR_NOT_FOUND;
if (ret != ERROR_SUCCESS)
{
HeapFree(GetProcessHeap(), 0, target_name);
heap_free(target_name);
RegCloseKey(hkeyMgr);
SetLastError(ret);
return FALSE;
@ -1300,7 +1302,7 @@ BOOL WINAPI CredEnumerateW(LPCWSTR Filter, DWORD Flags, DWORD *Count,
if (ret == ERROR_SUCCESS)
{
buffer = HeapAlloc(GetProcessHeap(), 0, len);
buffer = heap_alloc(len);
*Credentials = (PCREDENTIALW *)buffer;
if (buffer)
{
@ -1320,7 +1322,7 @@ BOOL WINAPI CredEnumerateW(LPCWSTR Filter, DWORD Flags, DWORD *Count,
ret = ERROR_OUTOFMEMORY;
}
HeapFree(GetProcessHeap(), 0, target_name);
heap_free(target_name);
RegCloseKey(hkeyMgr);
if (ret != ERROR_SUCCESS)
@ -1336,7 +1338,7 @@ BOOL WINAPI CredEnumerateW(LPCWSTR Filter, DWORD Flags, DWORD *Count,
*/
VOID WINAPI CredFree(PVOID Buffer)
{
HeapFree(GetProcessHeap(), 0, Buffer);
heap_free(Buffer);
}
/******************************************************************************
@ -1357,7 +1359,7 @@ BOOL WINAPI CredReadA(LPCSTR TargetName, DWORD Type, DWORD Flags, PCREDENTIALA *
}
len = MultiByteToWideChar(CP_ACP, 0, TargetName, -1, NULL, 0);
TargetNameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
TargetNameW = heap_alloc(len * sizeof(WCHAR));
if (!TargetNameW)
{
SetLastError(ERROR_OUTOFMEMORY);
@ -1367,13 +1369,13 @@ BOOL WINAPI CredReadA(LPCSTR TargetName, DWORD Type, DWORD Flags, PCREDENTIALA *
if (!CredReadW(TargetNameW, Type, Flags, &CredentialW))
{
HeapFree(GetProcessHeap(), 0, TargetNameW);
heap_free(TargetNameW);
return FALSE;
}
HeapFree(GetProcessHeap(), 0, TargetNameW);
heap_free(TargetNameW);
len = convert_PCREDENTIALW_to_PCREDENTIALA(CredentialW, NULL, 0);
*Credential = HeapAlloc(GetProcessHeap(), 0, len);
*Credential = heap_alloc(len);
if (!*Credential)
{
SetLastError(ERROR_OUTOFMEMORY);
@ -1452,22 +1454,22 @@ BOOL WINAPI CredReadW(LPCWSTR TargetName, DWORD Type, DWORD Flags, PCREDENTIALW
continue;
}
str_len = MultiByteToWideChar(CP_UTF8, 0, attr_list->attr[0].data, attr_list->attr[0].length, NULL, 0);
target_name = HeapAlloc(GetProcessHeap(), 0, (str_len + 1) * sizeof(WCHAR));
target_name = heap_alloc((str_len + 1) * sizeof(WCHAR));
MultiByteToWideChar(CP_UTF8, 0, attr_list->attr[0].data, attr_list->attr[0].length, target_name, str_len);
/* nul terminate */
target_name[str_len] = '\0';
if (strcmpiW(TargetName, target_name))
{
CFRelease(item);
HeapFree(GetProcessHeap(), 0, target_name);
heap_free(target_name);
continue;
}
HeapFree(GetProcessHeap(), 0, target_name);
heap_free(target_name);
SecKeychainItemFreeAttributesAndData(attr_list, NULL);
ret = mac_read_credential_from_item(item, TRUE, NULL, NULL, &len);
if (ret == ERROR_SUCCESS)
{
*Credential = HeapAlloc(GetProcessHeap(), 0, len);
*Credential = heap_alloc(len);
if (*Credential)
{
len = sizeof(**Credential);
@ -1510,7 +1512,7 @@ BOOL WINAPI CredReadW(LPCWSTR TargetName, DWORD Type, DWORD Flags, PCREDENTIALW
key_name = get_key_name_for_target(TargetName, Type);
ret = RegOpenKeyExW(hkeyMgr, key_name, 0, KEY_QUERY_VALUE, &hkeyCred);
HeapFree(GetProcessHeap(), 0, key_name);
heap_free(key_name);
if (ret != ERROR_SUCCESS)
{
TRACE("credentials for target name %s not found\n", debugstr_w(TargetName));
@ -1522,7 +1524,7 @@ BOOL WINAPI CredReadW(LPCWSTR TargetName, DWORD Type, DWORD Flags, PCREDENTIALW
ret = registry_read_credential(hkeyCred, NULL, key_data, NULL, &len);
if (ret == ERROR_SUCCESS)
{
*Credential = HeapAlloc(GetProcessHeap(), 0, len);
*Credential = heap_alloc(len);
if (*Credential)
{
len = sizeof(**Credential);
@ -1585,7 +1587,7 @@ BOOL WINAPI CredReadDomainCredentialsA(PCREDENTIAL_TARGET_INFORMATIONA TargetInf
if (TargetInformation->PackageName)
len += MultiByteToWideChar(CP_ACP, 0, TargetInformation->PackageName, -1, NULL, 0) * sizeof(WCHAR);
TargetInformationW = HeapAlloc(GetProcessHeap(), 0, len);
TargetInformationW = heap_alloc(len);
if (!TargetInformationW)
{
SetLastError(ERROR_OUTOFMEMORY);
@ -1656,7 +1658,7 @@ BOOL WINAPI CredReadDomainCredentialsA(PCREDENTIAL_TARGET_INFORMATIONA TargetInf
ret = CredReadDomainCredentialsW(TargetInformationW, Flags, Size, &CredentialsW);
HeapFree(GetProcessHeap(), 0, TargetInformationW);
heap_free(TargetInformationW);
if (ret)
{
@ -1667,7 +1669,7 @@ BOOL WINAPI CredReadDomainCredentialsA(PCREDENTIAL_TARGET_INFORMATIONA TargetInf
for (i = 0; i < *Size; i++)
len += convert_PCREDENTIALW_to_PCREDENTIALA(CredentialsW[i], NULL, 0);
*Credentials = HeapAlloc(GetProcessHeap(), 0, len);
*Credentials = heap_alloc(len);
if (!*Credentials)
{
CredFree(CredentialsW);
@ -1729,7 +1731,7 @@ BOOL WINAPI CredWriteA(PCREDENTIALA Credential, DWORD Flags)
}
len = convert_PCREDENTIALA_to_PCREDENTIALW(Credential, NULL, 0);
CredentialW = HeapAlloc(GetProcessHeap(), 0, len);
CredentialW = heap_alloc(len);
if (!CredentialW)
{
SetLastError(ERROR_OUTOFMEMORY);
@ -1740,7 +1742,7 @@ BOOL WINAPI CredWriteA(PCREDENTIALA Credential, DWORD Flags)
ret = CredWriteW(CredentialW, Flags);
HeapFree(GetProcessHeap(), 0, CredentialW);
heap_free(CredentialW);
return ret;
}
@ -1833,7 +1835,7 @@ BOOL WINAPI CredWriteW(PCREDENTIALW Credential, DWORD Flags)
ret = RegCreateKeyExW(hkeyMgr, key_name, 0, NULL,
Credential->Persist == CRED_PERSIST_SESSION ? REG_OPTION_VOLATILE : REG_OPTION_NON_VOLATILE,
KEY_READ|KEY_WRITE, NULL, &hkeyCred, NULL);
HeapFree(GetProcessHeap(), 0, key_name);
heap_free(key_name);
if (ret != ERROR_SUCCESS)
{
TRACE("credentials for target name %s not found\n",
@ -1889,13 +1891,13 @@ BOOL WINAPI CredMarshalCredentialA( CRED_MARSHAL_TYPE type, PVOID cred, LPSTR *o
if ((ret = CredMarshalCredentialW( type, cred, &outW )))
{
int len = WideCharToMultiByte( CP_ACP, 0, outW, -1, NULL, 0, NULL, NULL );
if (!(*out = HeapAlloc( GetProcessHeap(), 0, len )))
if (!(*out = heap_alloc( len )))
{
HeapFree( GetProcessHeap(), 0, outW );
heap_free( outW );
return FALSE;
}
WideCharToMultiByte( CP_ACP, 0, outW, -1, *out, len, NULL, NULL );
HeapFree( GetProcessHeap(), 0, outW );
heap_free( outW );
}
return ret;
}
@ -1953,7 +1955,7 @@ BOOL WINAPI CredMarshalCredentialW( CRED_MARSHAL_TYPE type, PVOID cred, LPWSTR *
case CertCredential:
{
size = (sizeof(cert->rgbHashOfCert) + 2) * 4 / 3;
if (!(p = HeapAlloc( GetProcessHeap(), 0, (size + 4) * sizeof(WCHAR) ))) return FALSE;
if (!(p = heap_alloc( (size + 4) * sizeof(WCHAR) ))) return FALSE;
p[0] = '@';
p[1] = '@';
p[2] = 'A' + type;
@ -1965,7 +1967,7 @@ BOOL WINAPI CredMarshalCredentialW( CRED_MARSHAL_TYPE type, PVOID cred, LPWSTR *
{
len = strlenW( target->UserName );
size = (sizeof(DWORD) + len * sizeof(WCHAR) + 2) * 4 / 3;
if (!(p = HeapAlloc( GetProcessHeap(), 0, (size + 4) * sizeof(WCHAR) ))) return FALSE;
if (!(p = heap_alloc( (size + 4) * sizeof(WCHAR) ))) return FALSE;
p[0] = '@';
p[1] = '@';
p[2] = 'A' + type;
@ -1998,11 +2000,11 @@ BOOL WINAPI CredUnmarshalCredentialA( LPCSTR cred, PCRED_MARSHAL_TYPE type, PVOI
if (cred)
{
int len = MultiByteToWideChar( CP_ACP, 0, cred, -1, NULL, 0 );
if (!(credW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return FALSE;
if (!(credW = heap_alloc( len * sizeof(WCHAR) ))) return FALSE;
MultiByteToWideChar( CP_ACP, 0, cred, -1, credW, len );
}
ret = CredUnmarshalCredentialW( credW, type, out );
HeapFree( GetProcessHeap(), 0, credW );
heap_free( credW );
return ret;
}
@ -2088,7 +2090,7 @@ BOOL WINAPI CredUnmarshalCredentialW( LPCWSTR cred, PCRED_MARSHAL_TYPE type, PVO
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
if (!(cert = HeapAlloc( GetProcessHeap(), 0, sizeof(*cert) ))) return FALSE;
if (!(cert = heap_alloc( sizeof(*cert) ))) return FALSE;
memcpy( cert->rgbHashOfCert, hash, sizeof(cert->rgbHashOfCert) );
cert->cbSize = sizeof(*cert);
*out = cert;
@ -2106,10 +2108,10 @@ BOOL WINAPI CredUnmarshalCredentialW( LPCWSTR cred, PCRED_MARSHAL_TYPE type, PVO
return FALSE;
}
buflen = sizeof(*target) + size + sizeof(WCHAR);
if (!(target = HeapAlloc( GetProcessHeap(), 0, buflen ))) return FALSE;
if (!(target = heap_alloc( buflen ))) return FALSE;
if (!cred_decode( cred + 9, len - 6, (char *)(target + 1) ))
{
HeapFree( GetProcessHeap(), 0, target );
heap_free( target );
return FALSE;
}
target->UserName = (WCHAR *)(target + 1);
@ -2185,11 +2187,11 @@ BOOL WINAPI CredIsMarshaledCredentialA(LPCSTR name)
if (name)
{
len = MultiByteToWideChar(CP_ACP, 0, name, -1, NULL, 0);
nameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
nameW = heap_alloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, name, -1, nameW, len);
}
res = CredIsMarshaledCredentialW(nameW);
HeapFree(GetProcessHeap(), 0, nameW);
heap_free(nameW);
return res;
}

View File

@ -59,7 +59,7 @@ BOOL WINAPI BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
backupW = SERV_dup(lpBackupFileName);
ret = BackupEventLogW(hEventLog, backupW);
HeapFree(GetProcessHeap(), 0, backupW);
heap_free(backupW);
return ret;
}
@ -116,7 +116,7 @@ BOOL WINAPI ClearEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
backupW = SERV_dup(lpBackupFileName);
ret = ClearEventLogW(hEventLog, backupW);
HeapFree(GetProcessHeap(), 0, backupW);
heap_free(backupW);
return ret;
}
@ -447,8 +447,8 @@ HANDLE WINAPI OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName )
uncnameW = SERV_dup(lpUNCServerName);
filenameW = SERV_dup(lpFileName);
handle = OpenBackupEventLogW(uncnameW, filenameW);
HeapFree(GetProcessHeap(), 0, uncnameW);
HeapFree(GetProcessHeap(), 0, filenameW);
heap_free(uncnameW);
heap_free(filenameW);
return handle;
}
@ -506,8 +506,8 @@ HANDLE WINAPI OpenEventLogA( LPCSTR uncname, LPCSTR source )
uncnameW = SERV_dup(uncname);
sourceW = SERV_dup(source);
handle = OpenEventLogW(uncnameW, sourceW);
HeapFree(GetProcessHeap(), 0, uncnameW);
HeapFree(GetProcessHeap(), 0, sourceW);
heap_free(uncnameW);
heap_free(sourceW);
return handle;
}
@ -688,7 +688,7 @@ BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD d
if (wNumStrings == 0) return TRUE;
if (!lpStrings) return TRUE;
wideStrArray = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWSTR) * wNumStrings);
wideStrArray = heap_alloc(sizeof(LPWSTR) * wNumStrings);
for (i = 0; i < wNumStrings; i++)
{
RtlCreateUnicodeStringFromAsciiz(&str, lpStrings[i]);
@ -697,10 +697,8 @@ BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD d
ret = ReportEventW(hEventLog, wType, wCategory, dwEventID, lpUserSid,
wNumStrings, dwDataSize, (LPCWSTR *)wideStrArray, lpRawData);
for (i = 0; i < wNumStrings; i++)
{
HeapFree( GetProcessHeap(), 0, wideStrArray[i] );
}
HeapFree(GetProcessHeap(), 0, wideStrArray);
heap_free( wideStrArray[i] );
heap_free(wideStrArray);
return ret;
}