DWORD *len)
{
OSStatus status;
- UInt32 i;
- UInt32 cred_blob_len;
+ UInt32 i, cred_blob_len;
void *cred_blob;
- LPWSTR domain = NULL;
- LPWSTR user = NULL;
+ WCHAR *user = NULL;
BOOL user_name_present = FALSE;
SecKeychainAttributeInfo info;
SecKeychainAttributeList *attr_list;
- UInt32 info_tags[] = { kSecServerItemAttr, kSecSecurityDomainItemAttr, kSecAccountItemAttr,
+ UInt32 info_tags[] = { kSecServiceItemAttr, kSecAccountItemAttr,
kSecCommentItemAttr, kSecCreationDateItemAttr };
info.count = sizeof(info_tags)/sizeof(info_tags[0]);
info.tag = info_tags;
{
switch (attr_list->attr[i].tag)
{
- case kSecServerItemAttr:
- TRACE("kSecServerItemAttr: %.*s\n", (int)attr_list->attr[i].length,
+ case kSecServiceItemAttr:
+ TRACE("kSecServiceItemAttr: %.*s\n", (int)attr_list->attr[i].length,
(char *)attr_list->attr[i].data);
if (!attr_list->attr[i].data) continue;
if (buffer)
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';
*len += (str_len + 1) * sizeof(WCHAR);
}
break;
- case kSecSecurityDomainItemAttr:
- {
- INT str_len;
- TRACE("kSecSecurityDomainItemAttr: %.*s\n", (int)attr_list->attr[i].length,
- (char *)attr_list->attr[i].data);
- 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);
- domain = HeapAlloc(GetProcessHeap(), 0, (str_len + 1) * sizeof(WCHAR));
- MultiByteToWideChar(CP_UTF8, 0, attr_list->attr[i].data,
- attr_list->attr[i].length, domain, str_len);
- domain[str_len] = '\0';
- break;
- }
case kSecCreationDateItemAttr:
TRACE("kSecCreationDateItemAttr: %.*s\n", (int)attr_list->attr[i].length,
(char *)attr_list->attr[i].data);
credential->LastWritten.dwHighDateTime = win_time.u.HighPart;
}
break;
+ default:
+ FIXME("unhandled attribute %lu\n", attr_list->attr[i].tag);
+ break;
}
}
INT str_len;
if (buffer)
credential->UserName = (LPWSTR)buffer;
- if (domain)
- {
- str_len = strlenW(domain);
- *len += (str_len + 1) * sizeof(WCHAR);
- if (buffer)
- {
- memcpy(credential->UserName, domain, str_len * sizeof(WCHAR));
- /* FIXME: figure out when to use an '@' */
- credential->UserName[str_len] = '\\';
- buffer += (str_len + 1) * sizeof(WCHAR);
- }
- }
str_len = strlenW(user);
*len += (str_len + 1) * sizeof(WCHAR);
if (buffer)
TRACE("UserName = %s\n", debugstr_w(credential->UserName));
}
}
- HeapFree(GetProcessHeap(), 0, user);
- HeapFree(GetProcessHeap(), 0, domain);
+ heap_free(user);
if (cred_blob)
{
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);
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;
}
{
OSStatus status;
SecKeychainItemRef keychain_item;
- char *username;
- char *domain = NULL;
- char *password;
- char *servername;
- UInt32 userlen;
- UInt32 domainlen = 0;
- UInt32 pwlen;
- UInt32 serverlen;
- LPCWSTR p;
+ char *username, *password, *servername;
+ UInt32 userlen, pwlen, serverlen;
SecKeychainAttribute attrs[1];
SecKeychainAttributeList attr_list;
if (credential->AttributeCount)
FIXME("custom attributes not supported\n");
- p = strchrW(credential->UserName, '\\');
- if (p)
- {
- domainlen = WideCharToMultiByte(CP_UTF8, 0, credential->UserName,
- p - credential->UserName, NULL, 0, NULL, NULL);
- domain = HeapAlloc(GetProcessHeap(), 0, (domainlen + 1) * sizeof(*domain));
- WideCharToMultiByte(CP_UTF8, 0, credential->UserName, p - credential->UserName,
- domain, domainlen, NULL, NULL);
- domain[domainlen] = '\0';
- p++;
- }
- else
- p = credential->UserName;
- userlen = WideCharToMultiByte(CP_UTF8, 0, p, -1, NULL, 0, NULL, NULL);
- username = HeapAlloc(GetProcessHeap(), 0, userlen * sizeof(*username));
- WideCharToMultiByte(CP_UTF8, 0, p, -1, username, userlen, NULL, NULL);
+ userlen = WideCharToMultiByte(CP_UTF8, 0, credential->UserName, -1, NULL, 0, NULL, NULL);
+ 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(*domain));
+ password = heap_alloc(pwlen * sizeof(*password));
WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)credential->CredentialBlob,
credential->CredentialBlobSize / sizeof(WCHAR), password, pwlen, NULL, NULL);
- TRACE("adding server %s, domain %s, username %s using Keychain\n", servername, domain, username);
- status = SecKeychainAddInternetPassword(NULL, strlen(servername), servername,
- strlen(domain), domain, strlen(username),
- username, 0, NULL, 0,
- 0 /* no protocol */,
- kSecAuthenticationTypeDefault,
- strlen(password), password, &keychain_item);
+ TRACE("adding server %s, username %s using Keychain\n", servername, username);
+ status = SecKeychainAddGenericPassword(NULL, strlen(servername), servername, strlen(username),
+ username, strlen(password), password, &keychain_item);
if (status != noErr)
- ERR("SecKeychainAddInternetPassword returned %ld\n", status);
+ ERR("SecKeychainAddGenericPassword returned %ld\n", status);
if (status == errSecDuplicateItem)
{
- SecKeychainItemRef keychain_item;
-
- status = SecKeychainFindInternetPassword(NULL, strlen(servername), servername,
- strlen(domain), domain,
- strlen(username), username,
- 0, NULL /* any path */, 0,
- 0 /* any protocol */,
- 0 /* any authentication type */,
- 0, NULL, &keychain_item);
+ status = SecKeychainFindGenericPassword(NULL, strlen(servername), servername, strlen(username),
+ username, NULL, NULL, &keychain_item);
if (status != noErr)
- ERR("SecKeychainFindInternetPassword returned %ld\n", status);
+ ERR("SecKeychainFindGenericPassword returned %ld\n", status);
}
- HeapFree(GetProcessHeap(), 0, domain);
- 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)
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
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)
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);
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;
}
debugstr_w(target_name));
p = strchrW(filter, '*');
- ret = CompareStringW(GetThreadLocale(), 0, filter,
+ 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;
}
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;
TRACE("comparing filter %s to target name %s\n", debugstr_w(filter), debugstr_w(target_name));
p = strchrW(filter, '*');
- ret = CompareStringW(GetThreadLocale(), 0, filter,
+ 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;
}
SecKeychainGetUserInteractionAllowed(&saved_user_interaction_allowed);
SecKeychainSetUserInteractionAllowed(false);
- status = SecKeychainSearchCreateFromAttributes(NULL, kSecInternetPasswordItemClass, NULL, &search);
+ status = SecKeychainSearchCreateFromAttributes(NULL, kSecGenericPasswordItemClass, NULL, &search);
if (status == noErr)
{
while (SecKeychainSearchCopyNext(search, &item) == noErr)
{
SecKeychainAttributeInfo info;
SecKeychainAttributeList *attr_list;
- UInt32 info_tags[] = { kSecServerItemAttr };
+ UInt32 info_tags[] = { kSecServiceItemAttr };
BOOL match;
info.count = sizeof(info_tags)/sizeof(info_tags[0]);
}
else
*len += sizeof(CREDENTIALW);
- if (attr_list->count != 1 || attr_list->attr[0].tag != kSecServerItemAttr)
+ if (attr_list->count != 1 || attr_list->attr[0].tag != kSecServiceItemAttr)
{
SecKeychainItemFreeAttributesAndData(attr_list, NULL);
continue;
}
- TRACE("server item: %.*s\n", (int)attr_list->attr[0].length, (char *)attr_list->attr[0].data);
+ TRACE("service item: %.*s\n", (int)attr_list->attr[0].length, (char *)attr_list->attr[0].data);
match = mac_credential_matches_filter(attr_list->attr[0].data, attr_list->attr[0].length, filter);
SecKeychainItemFreeAttributesAndData(attr_list, NULL);
if (!match) continue;
{
OSStatus status;
SecKeychainSearchRef search;
- status = SecKeychainSearchCreateFromAttributes(NULL, kSecInternetPasswordItemClass, NULL, &search);
+ status = SecKeychainSearchCreateFromAttributes(NULL, kSecGenericPasswordItemClass, NULL, &search);
if (status == noErr)
{
SecKeychainItemRef item;
{
SecKeychainAttributeInfo info;
SecKeychainAttributeList *attr_list;
- UInt32 info_tags[] = { kSecServerItemAttr };
+ UInt32 info_tags[] = { kSecServiceItemAttr };
LPWSTR target_name;
INT str_len;
info.count = sizeof(info_tags)/sizeof(info_tags[0]);
WARN("SecKeychainItemCopyAttributesAndData returned status %ld\n", status);
continue;
}
- if (attr_list->count != 1 || attr_list->attr[0].tag != kSecServerItemAttr)
+ if (attr_list->count != 1 || attr_list->attr[0].tag != kSecServiceItemAttr)
{
CFRelease(item);
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);
}
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);
ret = CredDeleteW(TargetNameW, Type, Flags);
- HeapFree(GetProcessHeap(), 0, TargetNameW);
+ heap_free(TargetNameW);
return ret;
}
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)
{
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);
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);
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);
ret = ERROR_NOT_FOUND;
if (ret != ERROR_SUCCESS)
{
- HeapFree(GetProcessHeap(), 0, target_name);
+ heap_free(target_name);
RegCloseKey(hkeyMgr);
SetLastError(ret);
return FALSE;
if (ret == ERROR_SUCCESS)
{
- buffer = HeapAlloc(GetProcessHeap(), 0, len);
+ buffer = heap_alloc(len);
*Credentials = (PCREDENTIALW *)buffer;
if (buffer)
{
ret = ERROR_OUTOFMEMORY;
}
- HeapFree(GetProcessHeap(), 0, target_name);
+ heap_free(target_name);
RegCloseKey(hkeyMgr);
if (ret != ERROR_SUCCESS)
*/
VOID WINAPI CredFree(PVOID Buffer)
{
- HeapFree(GetProcessHeap(), 0, Buffer);
+ heap_free(Buffer);
}
/******************************************************************************
}
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);
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);
{
OSStatus status;
SecKeychainSearchRef search;
- status = SecKeychainSearchCreateFromAttributes(NULL, kSecInternetPasswordItemClass, NULL, &search);
+ status = SecKeychainSearchCreateFromAttributes(NULL, kSecGenericPasswordItemClass, NULL, &search);
if (status == noErr)
{
SecKeychainItemRef item;
{
SecKeychainAttributeInfo info;
SecKeychainAttributeList *attr_list;
- UInt32 info_tags[] = { kSecServerItemAttr };
+ UInt32 info_tags[] = { kSecServiceItemAttr };
LPWSTR target_name;
INT str_len;
info.count = sizeof(info_tags)/sizeof(info_tags[0]);
WARN("SecKeychainItemCopyAttributesAndData returned status %ld\n", status);
continue;
}
- if (attr_list->count != 1 || attr_list->attr[0].tag != kSecServerItemAttr)
+ if (attr_list->count != 1 || attr_list->attr[0].tag != kSecServiceItemAttr)
{
CFRelease(item);
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);
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));
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);
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);
ret = CredReadDomainCredentialsW(TargetInformationW, Flags, Size, &CredentialsW);
- HeapFree(GetProcessHeap(), 0, TargetInformationW);
+ heap_free(TargetInformationW);
if (ret)
{
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);
}
len = convert_PCREDENTIALA_to_PCREDENTIALW(Credential, NULL, 0);
- CredentialW = HeapAlloc(GetProcessHeap(), 0, len);
+ CredentialW = heap_alloc(len);
if (!CredentialW)
{
SetLastError(ERROR_OUTOFMEMORY);
ret = CredWriteW(CredentialW, Flags);
- HeapFree(GetProcessHeap(), 0, CredentialW);
+ heap_free(CredentialW);
return ret;
}
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",
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;
}
static UINT cred_encode( const char *bin, unsigned int len, WCHAR *cred )
{
- static char enc[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789#-";
+ static const char enc[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789#-";
UINT n = 0, x;
while (len > 0)
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;
{
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;
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;
}
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;
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);
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;
}