sync advapi32/cred.c to wine 1.1.19

svn path=/trunk/; revision=40651
This commit is contained in:
Christoph von Wittich 2009-04-22 15:58:37 +00:00
parent 645d7a7c73
commit d3936f5816

View file

@ -67,7 +67,7 @@ static DWORD read_credential_blob(HKEY hkey, const BYTE key_data[KEY_SIZE],
struct ustring data;
struct ustring key;
ret = RegQueryValueExW(hkey, wszPasswordValue, 0, &type, (LPVOID)credential_blob,
ret = RegQueryValueExW(hkey, wszPasswordValue, 0, &type, credential_blob,
credential_blob_size);
if (ret != ERROR_SUCCESS)
return ret;
@ -161,10 +161,7 @@ static DWORD registry_read_credential(HKEY hkey, PCREDENTIALW credential,
ret = RegQueryValueExW(hkey, wszUserNameValue, 0, &type, (LPVOID)credential->UserName,
&count);
if (ret == ERROR_FILE_NOT_FOUND)
{
credential->UserName = NULL;
ret = ERROR_SUCCESS;
}
else if (ret != ERROR_SUCCESS)
return ret;
else if (type != REG_SZ)
@ -182,10 +179,7 @@ static DWORD registry_read_credential(HKEY hkey, PCREDENTIALW credential,
credential->CredentialBlob = (LPBYTE)buffer;
ret = read_credential_blob(hkey, key_data, credential->CredentialBlob, &count);
if (ret == ERROR_FILE_NOT_FOUND)
{
credential->CredentialBlob = NULL;
ret = ERROR_SUCCESS;
}
else if (ret != ERROR_SUCCESS)
return ret;
credential->CredentialBlobSize = count;
@ -459,7 +453,7 @@ static DWORD write_credential_blob(HKEY hkey, LPCWSTR target_name, DWORD type,
data.Buffer = encrypted_credential_blob;
SystemFunction032(&data, &key);
ret = RegSetValueExW(hkey, wszPasswordValue, 0, REG_BINARY, (LPVOID)encrypted_credential_blob, credential_blob_size);
ret = RegSetValueExW(hkey, wszPasswordValue, 0, REG_BINARY, encrypted_credential_blob, credential_blob_size);
HeapFree(GetProcessHeap(), 0, encrypted_credential_blob);
return ret;
@ -646,7 +640,7 @@ static DWORD get_cred_mgr_encryption_key(HKEY hkeyMgr, BYTE key_data[KEY_SIZE])
memcpy(key_data, my_key_data, KEY_SIZE);
count = KEY_SIZE;
ret = RegQueryValueExW(hkeyMgr, wszEncryptionKeyValue, NULL, &type, (LPVOID)key_data,
ret = RegQueryValueExW(hkeyMgr, wszEncryptionKeyValue, NULL, &type, key_data,
&count);
if (ret == ERROR_SUCCESS)
{
@ -667,14 +661,14 @@ static DWORD get_cred_mgr_encryption_key(HKEY hkeyMgr, BYTE key_data[KEY_SIZE])
*(DWORD *)(key_data + 4) = value;
ret = RegSetValueExW(hkeyMgr, wszEncryptionKeyValue, 0, REG_BINARY,
(LPVOID)key_data, KEY_SIZE);
key_data, KEY_SIZE);
if (ret == ERROR_ACCESS_DENIED)
{
ret = open_cred_mgr_key(&hkeyMgr, TRUE);
if (ret == ERROR_SUCCESS)
{
ret = RegSetValueExW(hkeyMgr, wszEncryptionKeyValue, 0, REG_BINARY,
(LPVOID)key_data, KEY_SIZE);
key_data, KEY_SIZE);
RegCloseKey(hkeyMgr);
}
}