* Sync up to trunk head (r64921).

svn path=/branches/shell-experiments/; revision=64922
This commit is contained in:
Amine Khaldi 2014-10-23 12:17:44 +00:00
parent 06e986393a
commit 121e60dbda
44 changed files with 873 additions and 769 deletions

View file

@ -68,7 +68,7 @@ SaveServicesToFile(PMAIN_WND_INFO Info,
LVText,
i,
k);
if (_tcslen(LVText))
if (dwTextLength != 0)
{
WriteFile(hFile,
LVText,

View file

@ -178,4 +178,16 @@ extern NTMARTA NtMartaStatic;
DWORD CheckNtMartaPresent(VOID);
/* heap allocation helpers */
static void *heap_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
static inline void *heap_alloc( size_t len )
{
return HeapAlloc( GetProcessHeap(), 0, len );
}
static inline BOOL heap_free( void *mem )
{
return HeapFree( GetProcessHeap(), 0, mem );
}
#endif /* __ADVAPI32_H */

View file

@ -681,4 +681,4 @@
@ stub WmiSetSingleItemA
@ stub WmiSetSingleItemW
@ stub Wow64Win32ApiEntry
@ stub WriteEncryptedFileRaw
@ stdcall WriteEncryptedFileRaw(ptr ptr ptr)

View file

@ -1802,7 +1802,7 @@ BOOL WINAPI CryptHashSessionKey (HCRYPTHASH hHash, HCRYPTKEY hKey, DWORD dwFlags
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI CryptImportKey (HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen,
BOOL WINAPI CryptImportKey (HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen,
HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey)
{
PCRYPTPROV prov = (PCRYPTPROV)hProv;
@ -1922,7 +1922,7 @@ BOOL WINAPI CryptSignHashA (HCRYPTHASH hHash, DWORD dwKeySpec, LPCSTR sDescripti
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI CryptSetHashParam (HCRYPTHASH hHash, DWORD dwParam, CONST BYTE *pbData, DWORD dwFlags)
BOOL WINAPI CryptSetHashParam (HCRYPTHASH hHash, DWORD dwParam, const BYTE *pbData, DWORD dwFlags)
{
PCRYPTPROV prov;
PCRYPTHASH hash = (PCRYPTHASH)hHash;
@ -1956,7 +1956,7 @@ BOOL WINAPI CryptSetHashParam (HCRYPTHASH hHash, DWORD dwParam, CONST BYTE *pbDa
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI CryptSetKeyParam (HCRYPTKEY hKey, DWORD dwParam, CONST BYTE *pbData, DWORD dwFlags)
BOOL WINAPI CryptSetKeyParam (HCRYPTKEY hKey, DWORD dwParam, const BYTE *pbData, DWORD dwFlags)
{
PCRYPTPROV prov;
PCRYPTKEY key = (PCRYPTKEY)hKey;
@ -2131,7 +2131,7 @@ BOOL WINAPI CryptSetProviderExA (LPCSTR pszProvName, DWORD dwProvType, DWORD *pd
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI CryptSetProvParam (HCRYPTPROV hProv, DWORD dwParam, CONST BYTE *pbData, DWORD dwFlags)
BOOL WINAPI CryptSetProvParam (HCRYPTPROV hProv, DWORD dwParam, const BYTE *pbData, DWORD dwFlags)
{
PCRYPTPROV prov = (PCRYPTPROV)hProv;
@ -2147,7 +2147,7 @@ BOOL WINAPI CryptSetProvParam (HCRYPTPROV hProv, DWORD dwParam, CONST BYTE *pbDa
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (dwFlags & PP_USE_HARDWARE_RNG)
if (dwParam == PP_USE_HARDWARE_RNG)
{
FIXME("PP_USE_HARDWARE_RNG: What do I do with this?\n");
FIXME("\tLetting the CSP decide.\n");
@ -2190,7 +2190,7 @@ BOOL WINAPI CryptSetProvParam (HCRYPTPROV hProv, DWORD dwParam, CONST BYTE *pbDa
* NULL. It is supported only for compatibility with Microsoft's Cryptographic
* Providers.
*/
BOOL WINAPI CryptVerifySignatureW (HCRYPTHASH hHash, CONST BYTE *pbSignature, DWORD dwSigLen,
BOOL WINAPI CryptVerifySignatureW (HCRYPTHASH hHash, const BYTE *pbSignature, DWORD dwSigLen,
HCRYPTKEY hPubKey, LPCWSTR sDescription, DWORD dwFlags)
{
PCRYPTHASH hash = (PCRYPTHASH)hHash;
@ -2218,7 +2218,7 @@ BOOL WINAPI CryptVerifySignatureW (HCRYPTHASH hHash, CONST BYTE *pbSignature, DW
*
* See CryptVerifySignatureW.
*/
BOOL WINAPI CryptVerifySignatureA (HCRYPTHASH hHash, CONST BYTE *pbSignature, DWORD dwSigLen,
BOOL WINAPI CryptVerifySignatureA (HCRYPTHASH hHash, const BYTE *pbSignature, DWORD dwSigLen,
HCRYPTKEY hPubKey, LPCSTR sDescription, DWORD dwFlags)
{
LPWSTR wsDescription;
@ -2362,3 +2362,22 @@ NTSTATUS WINAPI SystemFunction041(PVOID memory, ULONG length, ULONG flags)
return STATUS_SUCCESS;
}
#endif /* !__REACTOS __ */
/******************************************************************************
* WriteEncryptedFileRaw (ADVAPI32.@)
*
* Import encrypted files
*
* PARAMS
* import [I] pointer to the import callback function
* callback [I] pointer to the application defined context
* context [I] pointer to the system context
* RETURNS
* Success: ERROR_SUCCESS
* Failure: NTSTATUS error code
*/
DWORD WINAPI WriteEncryptedFileRaw(PFE_IMPORT_FUNC import, PVOID callback, PVOID context)
{
FIXME("(%p, %p, %p): stub\n", import, callback, context);
return ERROR_CALL_NOT_IMPLEMENTED;
}

View file

@ -45,15 +45,15 @@ typedef struct tagPROVFUNCS
BOOL (WINAPI *pCPGetKeyParam)(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags);
BOOL (WINAPI *pCPGetProvParam)(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags);
BOOL (WINAPI *pCPGetUserKey)(HCRYPTPROV hProv, DWORD dwKeySpec, HCRYPTKEY *phUserKey);
BOOL (WINAPI *pCPHashData)(HCRYPTPROV hProv, HCRYPTHASH hHash, CONST BYTE *pbData, DWORD dwDataLen, DWORD dwFlags);
BOOL (WINAPI *pCPHashData)(HCRYPTPROV hProv, HCRYPTHASH hHash, const BYTE *pbData, DWORD dwDataLen, DWORD dwFlags);
BOOL (WINAPI *pCPHashSessionKey)(HCRYPTPROV hProv, HCRYPTHASH hHash, HCRYPTKEY hKey, DWORD dwFlags);
BOOL (WINAPI *pCPImportKey)(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey);
BOOL (WINAPI *pCPImportKey)(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey);
BOOL (WINAPI *pCPReleaseContext)(HCRYPTPROV hProv, DWORD dwFlags);
BOOL (WINAPI *pCPSetHashParam)(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwParam, CONST BYTE *pbData, DWORD dwFlags);
BOOL (WINAPI *pCPSetKeyParam)(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam, CONST BYTE *pbData, DWORD dwFlags);
BOOL (WINAPI *pCPSetProvParam)(HCRYPTPROV hProv, DWORD dwParam, CONST BYTE *pbData, DWORD dwFlags);
BOOL (WINAPI *pCPSetHashParam)(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwParam, const BYTE *pbData, DWORD dwFlags);
BOOL (WINAPI *pCPSetKeyParam)(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam, const BYTE *pbData, DWORD dwFlags);
BOOL (WINAPI *pCPSetProvParam)(HCRYPTPROV hProv, DWORD dwParam, const BYTE *pbData, DWORD dwFlags);
BOOL (WINAPI *pCPSignHash)(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwKeySpec, LPCWSTR sDescription, DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);
BOOL (WINAPI *pCPVerifySignature)(HCRYPTPROV hProv, HCRYPTHASH hHash, CONST BYTE *pbSignature, DWORD dwSigLen, HCRYPTKEY hPubKey, LPCWSTR sDescription, DWORD dwFlags);
BOOL (WINAPI *pCPVerifySignature)(HCRYPTPROV hProv, HCRYPTHASH hHash, const BYTE *pbSignature, DWORD dwSigLen, HCRYPTKEY hPubKey, LPCWSTR sDescription, DWORD dwFlags);
} PROVFUNCS, *PPROVFUNCS;
#define MAGIC_CRYPTPROV 0xA39E741F

View file

@ -236,15 +236,13 @@ static DWORD mac_read_credential_from_item(SecKeychainItemRef item, BOOL require
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;
@ -294,8 +292,8 @@ static DWORD mac_read_credential_from_item(SecKeychainItemRef item, BOOL require
{
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)
@ -324,7 +322,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';
@ -352,20 +350,6 @@ static DWORD mac_read_credential_from_item(SecKeychainItemRef item, BOOL require
*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);
@ -382,6 +366,9 @@ static DWORD mac_read_credential_from_item(SecKeychainItemRef item, BOOL require
credential->LastWritten.dwHighDateTime = win_time.u.HighPart;
}
break;
default:
FIXME("unhandled attribute %lu\n", attr_list->attr[i].tag);
break;
}
}
@ -390,18 +377,6 @@ static DWORD mac_read_credential_from_item(SecKeychainItemRef item, BOOL require
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)
@ -411,8 +386,7 @@ static DWORD mac_read_credential_from_item(SecKeychainItemRef item, BOOL require
TRACE("UserName = %s\n", debugstr_w(credential->UserName));
}
}
HeapFree(GetProcessHeap(), 0, user);
HeapFree(GetProcessHeap(), 0, domain);
heap_free(user);
if (cred_blob)
{
@ -450,7 +424,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);
@ -459,7 +433,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;
}
@ -520,15 +494,8 @@ static DWORD mac_write_credential(const CREDENTIALW *credential, BOOL preserve_b
{
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;
@ -541,61 +508,36 @@ static DWORD mac_write_credential(const CREDENTIALW *credential, BOOL preserve_b
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)
@ -605,7 +547,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
@ -617,8 +559,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)
@ -702,7 +644,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);
@ -730,13 +672,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;
}
@ -744,11 +686,11 @@ static BOOL registry_credential_matches_filter(HKEY hkeyCred, LPCWSTR 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;
}
@ -809,17 +751,17 @@ 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;
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;
}
@ -835,14 +777,14 @@ static DWORD mac_enumerate_credentials(LPCWSTR filter, PCREDENTIALW *credentials
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]);
@ -861,12 +803,12 @@ static DWORD mac_enumerate_credentials(LPCWSTR filter, PCREDENTIALW *credentials
}
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;
@ -893,7 +835,7 @@ static DWORD mac_delete_credential(LPCWSTR TargetName)
{
OSStatus status;
SecKeychainSearchRef search;
status = SecKeychainSearchCreateFromAttributes(NULL, kSecInternetPasswordItemClass, NULL, &search);
status = SecKeychainSearchCreateFromAttributes(NULL, kSecGenericPasswordItemClass, NULL, &search);
if (status == noErr)
{
SecKeychainItemRef item;
@ -901,7 +843,7 @@ static DWORD mac_delete_credential(LPCWSTR TargetName)
{
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]);
@ -913,23 +855,23 @@ static DWORD mac_delete_credential(LPCWSTR TargetName)
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);
@ -1142,7 +1084,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);
@ -1152,7 +1094,7 @@ BOOL WINAPI CredDeleteA(LPCSTR TargetName, DWORD Type, DWORD Flags)
ret = CredDeleteW(TargetNameW, Type, Flags);
HeapFree(GetProcessHeap(), 0, TargetNameW);
heap_free(TargetNameW);
return ret;
}
@ -1207,7 +1149,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)
{
@ -1236,7 +1178,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);
@ -1249,16 +1191,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);
@ -1327,7 +1269,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);
@ -1347,7 +1289,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;
@ -1356,7 +1298,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)
{
@ -1376,7 +1318,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)
@ -1392,7 +1334,7 @@ BOOL WINAPI CredEnumerateW(LPCWSTR Filter, DWORD Flags, DWORD *Count,
*/
VOID WINAPI CredFree(PVOID Buffer)
{
HeapFree(GetProcessHeap(), 0, Buffer);
heap_free(Buffer);
}
/******************************************************************************
@ -1413,7 +1355,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);
@ -1423,13 +1365,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);
@ -1481,7 +1423,7 @@ BOOL WINAPI CredReadW(LPCWSTR TargetName, DWORD Type, DWORD Flags, PCREDENTIALW
{
OSStatus status;
SecKeychainSearchRef search;
status = SecKeychainSearchCreateFromAttributes(NULL, kSecInternetPasswordItemClass, NULL, &search);
status = SecKeychainSearchCreateFromAttributes(NULL, kSecGenericPasswordItemClass, NULL, &search);
if (status == noErr)
{
SecKeychainItemRef item;
@ -1489,7 +1431,7 @@ BOOL WINAPI CredReadW(LPCWSTR TargetName, DWORD Type, DWORD Flags, PCREDENTIALW
{
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]);
@ -1502,28 +1444,28 @@ BOOL WINAPI CredReadW(LPCWSTR TargetName, DWORD Type, DWORD Flags, PCREDENTIALW
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);
@ -1566,7 +1508,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));
@ -1578,7 +1520,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);
@ -1641,7 +1583,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);
@ -1712,7 +1654,7 @@ BOOL WINAPI CredReadDomainCredentialsA(PCREDENTIAL_TARGET_INFORMATIONA TargetInf
ret = CredReadDomainCredentialsW(TargetInformationW, Flags, Size, &CredentialsW);
HeapFree(GetProcessHeap(), 0, TargetInformationW);
heap_free(TargetInformationW);
if (ret)
{
@ -1723,7 +1665,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);
@ -1785,7 +1727,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);
@ -1796,7 +1738,7 @@ BOOL WINAPI CredWriteA(PCREDENTIALA Credential, DWORD Flags)
ret = CredWriteW(CredentialW, Flags);
HeapFree(GetProcessHeap(), 0, CredentialW);
heap_free(CredentialW);
return ret;
}
@ -1889,7 +1831,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",
@ -1945,20 +1887,20 @@ 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;
}
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)
@ -2009,7 +1951,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;
@ -2021,7 +1963,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;
@ -2054,11 +1996,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;
}
@ -2144,7 +2086,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;
@ -2162,10 +2104,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);
@ -2241,11 +2183,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

@ -54,6 +54,7 @@ static const WCHAR szLangGroupsKeyName[] = {
'L','a','n','g','u','a','g','e',' ','G','r','o','u','p','s',0
};
#ifndef __REACTOS__
/* Charset to codepage map, sorted by name. */
static const struct charset_entry
{
@ -114,7 +115,7 @@ static const struct charset_entry
{ "KOI8U", 21866 },
{ "UTF8", CP_UTF8 }
};
#endif
struct locale_name
{
@ -139,6 +140,7 @@ static LCID lcid_LC_PAPER;
static LCID lcid_LC_MEASUREMENT;
static LCID lcid_LC_TELEPHONE;
#ifndef __REACTOS__
/* Copy Ascii string to Unicode without using codepages */
static inline void strcpynAtoW( WCHAR *dst, const char *src, size_t n )
{
@ -149,7 +151,7 @@ static inline void strcpynAtoW( WCHAR *dst, const char *src, size_t n )
}
if (n) *dst = 0;
}
#endif
/***********************************************************************
* get_lcid_codepage
@ -1278,6 +1280,9 @@ BOOL WINAPI GetStringTypeW( DWORD type, LPCWSTR src, INT count, LPWORD chartype
if ((c>=0x0600)&&(c<=0x06FF)) type3 |= C3_KASHIDA;
if ((c>=0x3000)&&(c<=0x303F)) type3 |= C3_SYMBOL;
if ((c>=0xD800)&&(c<=0xDBFF)) type3 |= C3_HIGHSURROGATE;
if ((c>=0xDC00)&&(c<=0xDFFF)) type3 |= C3_LOWSURROGATE;
if ((c>=0xFF00)&&(c<=0xFF60)) type3 |= C3_FULLWIDTH;
if ((c>=0xFF00)&&(c<=0xFF20)) type3 |= C3_SYMBOL;
if ((c>=0xFF3B)&&(c<=0xFF40)) type3 |= C3_SYMBOL;
@ -1386,17 +1391,35 @@ BOOL WINAPI GetStringTypeExA( LCID locale, DWORD type, LPCSTR src, INT count, LP
return GetStringTypeA(locale, type, src, count, chartype);
}
/*************************************************************************
* LCMapStringW (KERNEL32.@)
* LCMapStringEx (KERNEL32.@)
*
* See LCMapStringA.
* Map characters in a locale sensitive string.
*
* PARAMS
* name [I] Locale name for the conversion.
* flags [I] Flags controlling the mapping (LCMAP_ constants from "winnls.h")
* src [I] String to map
* srclen [I] Length of src in chars, or -1 if src is NUL terminated
* dst [O] Destination for mapped string
* dstlen [I] Length of dst in characters
* version [I] reserved, must be NULL
* reserved [I] reserved, must be NULL
* lparam [I] reserved, must be 0
*
* RETURNS
* Success: The length of the mapped string in dst, including the NUL terminator.
* Failure: 0. Use GetLastError() to determine the cause.
*/
INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
LPWSTR dst, INT dstlen)
INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen,
LPNLSVERSIONINFO version, LPVOID reserved, LPARAM lparam)
{
LPWSTR dst_ptr;
if (version) FIXME("unsupported version structure %p\n", version);
if (reserved) FIXME("unsupported reserved pointer %p\n", reserved);
if (lparam) FIXME("unsupported lparam %lx\n", lparam);
if (!src || !srclen || dstlen < 0)
{
SetLastError(ERROR_INVALID_PARAMETER);
@ -1415,8 +1438,6 @@ INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
if (!dstlen) dst = NULL;
lcid = ConvertDefaultLocale(lcid);
if (flags & LCMAP_SORTKEY)
{
INT ret;
@ -1428,8 +1449,8 @@ INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
if (srclen < 0) srclen = strlenW(src);
TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n",
lcid, flags, debugstr_wn(src, srclen), srclen, dst, dstlen);
TRACE("(%s,0x%08x,%s,%d,%p,%d)\n",
debugstr_w(name), flags, debugstr_wn(src, srclen), srclen, dst, dstlen);
ret = wine_get_sortkey(flags, src, srclen, (char *)dst, dstlen);
if (ret == 0)
@ -1448,8 +1469,8 @@ INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
if (srclen < 0) srclen = strlenW(src) + 1;
TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n",
lcid, flags, debugstr_wn(src, srclen), srclen, dst, dstlen);
TRACE("(%s,0x%08x,%s,%d,%p,%d)\n",
debugstr_w(name), flags, debugstr_wn(src, srclen), srclen, dst, dstlen);
if (!dst) /* return required string length */
{
@ -1517,6 +1538,20 @@ INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
return dst_ptr - dst;
}
/*************************************************************************
* LCMapStringW (KERNEL32.@)
*
* See LCMapStringA.
*/
INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
LPWSTR dst, INT dstlen)
{
TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n",
lcid, flags, debugstr_wn(src, srclen), srclen, dst, dstlen);
return LCMapStringEx(NULL, flags, src, srclen, dst, dstlen, NULL, NULL, 0);
}
/*************************************************************************
* LCMapStringA (KERNEL32.@)
*
@ -1586,7 +1621,7 @@ INT WINAPI LCMapStringA(LCID lcid, DWORD flags, LPCSTR src, INT srclen,
goto map_string_exit;
}
dstlenW = LCMapStringW(lcid, flags, srcW, srclenW, NULL, 0);
dstlenW = LCMapStringEx(NULL, flags, srcW, srclenW, NULL, 0, NULL, NULL, 0);
if (!dstlenW)
goto map_string_exit;
@ -1597,7 +1632,7 @@ INT WINAPI LCMapStringA(LCID lcid, DWORD flags, LPCSTR src, INT srclen,
goto map_string_exit;
}
LCMapStringW(lcid, flags, srcW, srclenW, dstW, dstlenW);
LCMapStringEx(NULL, flags, srcW, srclenW, dstW, dstlenW, NULL, NULL, 0);
ret = WideCharToMultiByte(locale_cp, 0, dstW, dstlenW, dst, dstlen, NULL, NULL);
HeapFree(GetProcessHeap(), 0, dstW);
@ -1944,18 +1979,6 @@ static BOOL NLS_GetLanguageGroupName(LGRPID lgrpid, LPWSTR szName, ULONG nameSiz
return bRet;
}
/* Registry keys for NLS related information */
static const WCHAR szCountryListName[] = {
'\\','R','e','g','i','s','t','r','y','\\',
'M','a','c','h','i','n','e','\\','S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
'T','e','l','e','p','h','o','n','y','\\',
'C','o','u','n','t','r','y',' ','L','i','s','t','\0'
};
/* Callback function ptrs for EnumSystemLanguageGroupsA/W */
typedef struct
{

View file

@ -694,7 +694,7 @@ cleanup:
{
TRACE_(I8042PRT, "IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_KEYBOARD_QUERY_INDICATORS\n");
if (Stack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS))
if (Stack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS))
{
Status = STATUS_BUFFER_TOO_SMALL;
}

View file

@ -68,6 +68,16 @@ $FuncEndName
fixme
MEND
#define CR 13
#define LF 10
#define NUL 0
#define ASCII dcb
MACRO
UNIMPLEMENTED $Name
MEND
#else
/* Compatibility define */

View file

@ -11061,9 +11061,9 @@ RtlCheckBit(
# define __assert_annotationW(msg) __annotation(L"Debug", L"AssertFail", msg)
#else
# define __assert_annotationA(msg) \
DbgPrint("Assertion %s(%d): %s", __FILE__, __LINE__, msg)
DbgPrint("Assertion failed at %s(%d): %s\n", __FILE__, __LINE__, msg)
# define __assert_annotationW(msg) \
DbgPrint("Assertion %s(%d): %S", __FILE__, __LINE__, msg)
DbgPrint("Assertion failed at %s(%d): %S\n", __FILE__, __LINE__, msg)
#endif
#define NT_VERIFY(exp) \

View file

@ -1277,6 +1277,12 @@ typedef DWORD (WINAPI *APPLICATION_RECOVERY_CALLBACK)(PVOID);
#define MAKEINTATOM(i) (LPTSTR)((ULONG_PTR)((WORD)(i)))
#endif
typedef DWORD
(WINAPI *PFE_IMPORT_FUNC)(
_Out_writes_bytes_to_(*ulLength, *ulLength) PBYTE pbData,
_In_opt_ PVOID pvCallbackContext,
_Inout_ PULONG ulLength);
/* Functions */
#ifndef UNDER_CE
int APIENTRY WinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPSTR, _In_ int);
@ -3142,6 +3148,7 @@ BOOL WINAPI WinLoadTrustProvider(GUID*);
BOOL WINAPI Wow64DisableWow64FsRedirection(PVOID*);
BOOLEAN WINAPI Wow64EnableWow64FsRedirection(_In_ BOOLEAN);
BOOL WINAPI Wow64RevertWow64FsRedirection(PVOID);
DWORD WINAPI WriteEncryptedFileRaw(_In_ PFE_IMPORT_FUNC, _In_opt_ PVOID, _In_ PVOID);
BOOL WINAPI WriteFile(HANDLE,LPCVOID,DWORD,LPDWORD,LPOVERLAPPED);
BOOL WINAPI WriteFileEx(HANDLE,LPCVOID,DWORD,LPOVERLAPPED,LPOVERLAPPED_COMPLETION_ROUTINE);
BOOL WINAPI WriteFileGather(HANDLE,FILE_SEGMENT_ELEMENT*,DWORD,LPDWORD,LPOVERLAPPED);

View file

@ -190,7 +190,7 @@ VOID
(NTAPI *FAST486_IO_READ_PROC)
(
PFAST486_STATE State,
ULONG Port,
USHORT Port,
PVOID Buffer,
ULONG DataCount,
UCHAR DataSize
@ -201,7 +201,7 @@ VOID
(NTAPI *FAST486_IO_WRITE_PROC)
(
PFAST486_STATE State,
ULONG Port,
USHORT Port,
PVOID Buffer,
ULONG DataCount,
UCHAR DataSize

View file

@ -3113,9 +3113,9 @@ RtlCheckBit(
# define __assert_annotationW(msg) __annotation(L"Debug", L"AssertFail", msg)
#else
# define __assert_annotationA(msg) \
DbgPrint("Assertion %s(%d): %s", __FILE__, __LINE__, msg)
DbgPrint("Assertion failed at %s(%d): %s\n", __FILE__, __LINE__, msg)
# define __assert_annotationW(msg) \
DbgPrint("Assertion %s(%d): %S", __FILE__, __LINE__, msg)
DbgPrint("Assertion failed at %s(%d): %S\n", __FILE__, __LINE__, msg)
#endif
#define NT_VERIFY(exp) \

View file

@ -149,7 +149,7 @@ Fast486MemWriteCallback(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG
static VOID
NTAPI
Fast486IoReadCallback(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG DataCount, UCHAR DataSize)
Fast486IoReadCallback(PFAST486_STATE State, USHORT Port, PVOID Buffer, ULONG DataCount, UCHAR DataSize)
{
UNREFERENCED_PARAMETER(State);
UNREFERENCED_PARAMETER(Port);
@ -160,7 +160,7 @@ Fast486IoReadCallback(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG Data
static VOID
NTAPI
Fast486IoWriteCallback(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG DataCount, UCHAR DataSize)
Fast486IoWriteCallback(PFAST486_STATE State, USHORT Port, PVOID Buffer, ULONG DataCount, UCHAR DataSize)
{
UNREFERENCED_PARAMETER(State);
UNREFERENCED_PARAMETER(Port);

View file

@ -362,7 +362,7 @@ RtlClearBits(
/* Clear what's left */
NumberToClear &= (_BITCOUNT - 1);
if (NumberToClear)
if (NumberToClear != 0)
{
Mask = MAXINDEX << NumberToClear;
*Buffer &= Mask;
@ -422,7 +422,7 @@ RtlSetBits(
/* Set what's left */
NumberToSet &= (_BITCOUNT - 1);
if (NumberToSet)
if (NumberToSet != 0)
{
Mask = MAXINDEX << NumberToSet;
*Buffer |= ~Mask;

View file

@ -2,31 +2,29 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of _chkstk and _alloca_probe
* FILE: lib/sdk/crt/math/amd64/chkstk_asm.s
* FILE: lib/sdk/crt/except/arm/chkstk_asm.s
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
* Yuntian Zhang (yuntian.zh@gmail.com)
*/
/* INCLUDES ******************************************************************/
#include <asm.inc>
#include <kxarm.h>
/* CODE **********************************************************************/
.code64
TEXTAREA
MsgUnimplemented:
.ascii "Unimplemented", CR, LF, NUL
MsgUnimplemented ASCII "Unimplemented", CR, LF, NUL
FUNC __chkstk
.endprolog
LEAF_ENTRY __chkstk
UNIMPLEMENTED chkstk
ret
ENDFUNC
bx lr
LEAF_END __chkstk
FUNC __alloca_probe
.endprolog
LEAF_ENTRY __alloca_probe
UNIMPLEMENTED alloca_probe
ret
ENDFUNC
bx lr
LEAF_END __alloca_probe
END
END
/* EOF */

View file

@ -1,6 +1,4 @@
#include <asm.inc>
#ifdef _M_IX86
#define SYM(name) _##name
#define IMPSYM(name) __imp__##name
@ -9,6 +7,10 @@
#define IMPSYM(name) __imp_##name
#endif
#if (defined(_M_IX86) || defined(_M_AMD64))
#include <asm.inc>
MACRO(CREATE_ALIAS1, alias, target)
#ifdef _USE_ML
EXTERN SYM(&target):PROC
@ -32,124 +34,148 @@ MACRO(CREATE_ALIAS, alias, target)
CREATE_ALIAS2 &alias, &target
ENDM
CREATE_ALIAS access, _access
CREATE_ALIAS chdir, _chdir
CREATE_ALIAS chmod, _chmod
CREATE_ALIAS chsize, _chsize
CREATE_ALIAS close, _close
CREATE_ALIAS creat, _creat
CREATE_ALIAS cwait, _cwait
CREATE_ALIAS2 daylight, _daylight
CREATE_ALIAS dup, _dup
CREATE_ALIAS dup2, _dup2
CREATE_ALIAS ecvt, _ecvt
CREATE_ALIAS eof, _eof
CREATE_ALIAS execl, _execl
CREATE_ALIAS execle, _execle
CREATE_ALIAS execlp, _execlp
CREATE_ALIAS execlpe, _execlpe
CREATE_ALIAS execv, _execv
CREATE_ALIAS execve, _execve
CREATE_ALIAS execvp, _execvp
CREATE_ALIAS execvpe, _execvpe
CREATE_ALIAS fcvt, _fcvt
CREATE_ALIAS fdopen, _fdopen
CREATE_ALIAS fgetchar, _fgetchar
CREATE_ALIAS fgetwchar, _fgetwchar
CREATE_ALIAS filelength, _filelength
CREATE_ALIAS fileno, _fileno
CREATE_ALIAS fpreset, _fpreset
CREATE_ALIAS fputchar, _fputchar
CREATE_ALIAS fputwchar, _fputwchar
CREATE_ALIAS fstat, _fstat
CREATE_ALIAS ftime, _ftime
CREATE_ALIAS gcvt, _gcvt
CREATE_ALIAS getch, _getch
CREATE_ALIAS getche, _getche
CREATE_ALIAS getcwd, _getcwd
CREATE_ALIAS getpid, _getpid
CREATE_ALIAS getw, _getw
CREATE_ALIAS heapwalk, _heapwalk
CREATE_ALIAS isatty, _isatty
CREATE_ALIAS itoa, _itoa
CREATE_ALIAS kbhit, _kbhit
CREATE_ALIAS lfind, _lfind
CREATE_ALIAS lsearch, _lsearch
CREATE_ALIAS lseek, _lseek
CREATE_ALIAS ltoa, _ltoa
CREATE_ALIAS memccpy, _memccpy
CREATE_ALIAS memicmp, _memicmp
CREATE_ALIAS mkdir, _mkdir
CREATE_ALIAS mktemp, _mktemp
CREATE_ALIAS open, _open
CREATE_ALIAS pclose, _pclose
CREATE_ALIAS popen, _popen
CREATE_ALIAS putch, _putch
CREATE_ALIAS putenv, _putenv
CREATE_ALIAS putw, _putw
CREATE_ALIAS read, _read
CREATE_ALIAS rmdir, _rmdir
CREATE_ALIAS rmtmp, _rmtmp
CREATE_ALIAS searchenv, _searchenv
CREATE_ALIAS setmode, _setmode
CREATE_ALIAS snprintf, _snprintf
CREATE_ALIAS sopen, _sopen
CREATE_ALIAS spawnl, _spawnl
CREATE_ALIAS spawnle, _spawnle
CREATE_ALIAS spawnlp, _spawnlp
CREATE_ALIAS spawnlpe, _spawnlpe
CREATE_ALIAS spawnv, _spawnv
CREATE_ALIAS spawnve, _spawnve
CREATE_ALIAS spawnvp, _spawnvp
CREATE_ALIAS spawnvpe, _spawnvpe
CREATE_ALIAS stat, _stat
CREATE_ALIAS strcmpi, _strcmpi
CREATE_ALIAS strdup, _strdup
CREATE_ALIAS stricmp, _stricmp
CREATE_ALIAS stricoll, _stricoll
CREATE_ALIAS strlwr, _strlwr
CREATE_ALIAS strnicmp, _strnicmp
CREATE_ALIAS strnset, _strnset
CREATE_ALIAS strrev, _strrev
CREATE_ALIAS strset, _strset
CREATE_ALIAS strupr, _strupr
CREATE_ALIAS swab, _swab
CREATE_ALIAS tell, _tell
CREATE_ALIAS tempnam, _tempnam
CREATE_ALIAS2 timezone, _timezone
CREATE_ALIAS2 tzname, _tzname
CREATE_ALIAS tzset, _tzset
CREATE_ALIAS umask, _umask
CREATE_ALIAS ungetch, _ungetch
CREATE_ALIAS unlink, _unlink
CREATE_ALIAS utime, _utime
CREATE_ALIAS wcsdup, _wcsdup
CREATE_ALIAS wcsicmp, _wcsicmp
CREATE_ALIAS wcsicoll, _wcsicoll
CREATE_ALIAS wcslwr, _wcslwr
CREATE_ALIAS wcsnicmp, _wcsnicmp
CREATE_ALIAS wcsnset, _wcsnset
CREATE_ALIAS wcsrev, _wcsrev
CREATE_ALIAS wcsset, _wcsset
CREATE_ALIAS wcsupr, _wcsupr
CREATE_ALIAS wpopen, _wpopen
CREATE_ALIAS write, _write
// non-ANSI functions declared in math.h
CREATE_ALIAS j0, _j0
CREATE_ALIAS j1, _j1
CREATE_ALIAS jn, _jn
CREATE_ALIAS y0, _y0
CREATE_ALIAS y1, _y1
CREATE_ALIAS yn, _yn
CREATE_ALIAS chgsign, _chgsign
CREATE_ALIAS scalb, _scalb
CREATE_ALIAS finite, _finite
CREATE_ALIAS fpclass, _fpclass
// C99 functions
CREATE_ALIAS cabs, _cabs
CREATE_ALIAS hypot, _hypot
CREATE_ALIAS logb, _logb
CREATE_ALIAS nextafter, _nextafter
#elif defined(_M_ARM)
END
#include <kxarm.h>
MACRO
CREATE_ALIAS1 $alias, $target
IMPORT SYM($alias), WEAK SYM($target)
MEND
MACRO
CREATE_ALIAS2 $alias, $target
IMPORT IMPSYM($alias), WEAK IMPSYM($target)
MEND
MACRO
CREATE_ALIAS $alias, $target
CREATE_ALIAS1 $alias, $target
CREATE_ALIAS2 $alias, $target
MEND
#else
#error "Unsupported platform."
#endif
/* Do not remove indentation, this would break ARM build! */
CREATE_ALIAS access, _access
CREATE_ALIAS chdir, _chdir
CREATE_ALIAS chmod, _chmod
CREATE_ALIAS chsize, _chsize
CREATE_ALIAS close, _close
CREATE_ALIAS creat, _creat
CREATE_ALIAS cwait, _cwait
CREATE_ALIAS2 daylight, _daylight
CREATE_ALIAS dup, _dup
CREATE_ALIAS dup2, _dup2
CREATE_ALIAS ecvt, _ecvt
CREATE_ALIAS eof, _eof
CREATE_ALIAS execl, _execl
CREATE_ALIAS execle, _execle
CREATE_ALIAS execlp, _execlp
CREATE_ALIAS execlpe, _execlpe
CREATE_ALIAS execv, _execv
CREATE_ALIAS execve, _execve
CREATE_ALIAS execvp, _execvp
CREATE_ALIAS execvpe, _execvpe
CREATE_ALIAS fcvt, _fcvt
CREATE_ALIAS fdopen, _fdopen
CREATE_ALIAS fgetchar, _fgetchar
CREATE_ALIAS fgetwchar, _fgetwchar
CREATE_ALIAS filelength, _filelength
CREATE_ALIAS fileno, _fileno
CREATE_ALIAS fpreset, _fpreset
CREATE_ALIAS fputchar, _fputchar
CREATE_ALIAS fputwchar, _fputwchar
CREATE_ALIAS fstat, _fstat
CREATE_ALIAS ftime, _ftime
CREATE_ALIAS gcvt, _gcvt
CREATE_ALIAS getch, _getch
CREATE_ALIAS getche, _getche
CREATE_ALIAS getcwd, _getcwd
CREATE_ALIAS getpid, _getpid
CREATE_ALIAS getw, _getw
CREATE_ALIAS heapwalk, _heapwalk
CREATE_ALIAS isatty, _isatty
CREATE_ALIAS itoa, _itoa
CREATE_ALIAS kbhit, _kbhit
CREATE_ALIAS lfind, _lfind
CREATE_ALIAS lsearch, _lsearch
CREATE_ALIAS lseek, _lseek
CREATE_ALIAS ltoa, _ltoa
CREATE_ALIAS memccpy, _memccpy
CREATE_ALIAS memicmp, _memicmp
CREATE_ALIAS mkdir, _mkdir
CREATE_ALIAS mktemp, _mktemp
CREATE_ALIAS open, _open
CREATE_ALIAS pclose, _pclose
CREATE_ALIAS popen, _popen
CREATE_ALIAS putch, _putch
CREATE_ALIAS putenv, _putenv
CREATE_ALIAS putw, _putw
CREATE_ALIAS read, _read
CREATE_ALIAS rmdir, _rmdir
CREATE_ALIAS rmtmp, _rmtmp
CREATE_ALIAS searchenv, _searchenv
CREATE_ALIAS setmode, _setmode
CREATE_ALIAS snprintf, _snprintf
CREATE_ALIAS sopen, _sopen
CREATE_ALIAS spawnl, _spawnl
CREATE_ALIAS spawnle, _spawnle
CREATE_ALIAS spawnlp, _spawnlp
CREATE_ALIAS spawnlpe, _spawnlpe
CREATE_ALIAS spawnv, _spawnv
CREATE_ALIAS spawnve, _spawnve
CREATE_ALIAS spawnvp, _spawnvp
CREATE_ALIAS spawnvpe, _spawnvpe
CREATE_ALIAS stat, _stat
CREATE_ALIAS strcmpi, _strcmpi
CREATE_ALIAS strdup, _strdup
CREATE_ALIAS stricmp, _stricmp
CREATE_ALIAS stricoll, _stricoll
CREATE_ALIAS strlwr, _strlwr
CREATE_ALIAS strnicmp, _strnicmp
CREATE_ALIAS strnset, _strnset
CREATE_ALIAS strrev, _strrev
CREATE_ALIAS strset, _strset
CREATE_ALIAS strupr, _strupr
CREATE_ALIAS swab, _swab
CREATE_ALIAS tell, _tell
CREATE_ALIAS tempnam, _tempnam
CREATE_ALIAS2 timezone, _timezone
CREATE_ALIAS2 tzname, _tzname
CREATE_ALIAS tzset, _tzset
CREATE_ALIAS umask, _umask
CREATE_ALIAS ungetch, _ungetch
CREATE_ALIAS unlink, _unlink
CREATE_ALIAS utime, _utime
CREATE_ALIAS wcsdup, _wcsdup
CREATE_ALIAS wcsicmp, _wcsicmp
CREATE_ALIAS wcsicoll, _wcsicoll
CREATE_ALIAS wcslwr, _wcslwr
CREATE_ALIAS wcsnicmp, _wcsnicmp
CREATE_ALIAS wcsnset, _wcsnset
CREATE_ALIAS wcsrev, _wcsrev
CREATE_ALIAS wcsset, _wcsset
CREATE_ALIAS wcsupr, _wcsupr
CREATE_ALIAS wpopen, _wpopen
CREATE_ALIAS write, _write
// non-ANSI functions declared in math.h
CREATE_ALIAS j0, _j0
CREATE_ALIAS j1, _j1
CREATE_ALIAS jn, _jn
CREATE_ALIAS y0, _y0
CREATE_ALIAS y1, _y1
CREATE_ALIAS yn, _yn
CREATE_ALIAS chgsign, _chgsign
CREATE_ALIAS scalb, _scalb
CREATE_ALIAS finite, _finite
CREATE_ALIAS fpclass, _fpclass
// C99 functions
CREATE_ALIAS cabs, _cabs
CREATE_ALIAS hypot, _hypot
CREATE_ALIAS logb, _logb
CREATE_ALIAS nextafter, _nextafter
END

View file

@ -141,7 +141,9 @@ void __cdecl _invalid_parameter(const wchar_t *expr, const wchar_t *func,
else
{
ERR( "%s:%u %s: %s %lx\n", debugstr_w(file), line, debugstr_w(func), debugstr_w(expr), arg );
#if _MSVCR_VER > 0 // FIXME: possible improvement: use a global variable in the DLL
RaiseException( STATUS_INVALID_CRUNTIME_PARAMETER, EXCEPTION_NONCONTINUABLE, 0, NULL );
#endif
}
}

View file

@ -256,8 +256,8 @@ check Wine current souces first as it may already be fixed.
reactos/lib/3rdparty/strmbase # Synced to Wine-1.7.27
advapi32 -
reactos/dll/win32/advapi32/crypt/*.c # Synced to Wine-1.7.1
reactos/dll/win32/advapi32/sec/cred.c # Synced to Wine-1.7.1
reactos/dll/win32/advapi32/crypt/*.c # Synced to Wine-1.7.27
reactos/dll/win32/advapi32/sec/cred.c # Synced to Wine-1.7.27
reactos/dll/win32/advapi32/sec/sid.c # Out of Sync
gdi32 -

View file

@ -310,15 +310,9 @@ IopLoadServiceModule(
HANDLE CCSKey, ServiceKey;
PVOID BaseAddress;
ASSERT(ServiceName->Length);
DPRINT("IopLoadServiceModule(%wZ, 0x%p)\n", ServiceName, ModuleObject);
/* FIXME: This check may be removed once the bug is fixed */
if (ServiceName->Buffer == NULL)
{
DPRINT1("If you see this, please report to Fireball or hpoussin!\n");
return STATUS_UNSUCCESSFUL;
}
if (ExpInTextModeSetup)
{
/* We have no registry, but luckily we know where all the drivers are */

View file

@ -310,11 +310,9 @@ IopLogWorker(IN PVOID Parameter)
/* We do, query its name */
Status = ObQueryNameString(LogEntry->DeviceObject,
ObjectNameInfo,
sizeof(OBJECT_NAME_INFORMATION) +
100 -
DriverNameLength,
sizeof(Buffer),
&ReturnedLength);
if ((!NT_SUCCESS(Status)) || !(ObjectNameInfo->Name.Length))
if (!NT_SUCCESS(Status) || (ObjectNameInfo->Name.Length == 0))
{
/* Setup an empty name */
ObjectNameInfo->Name.Length = 0;
@ -371,6 +369,7 @@ IopLogWorker(IN PVOID Parameter)
{
ExFreePool(PoolObjectNameInfo);
PoolObjectNameInfo = NULL;
ObjectNameInfo = (POBJECT_NAME_INFORMATION)&Buffer;
}
/* Go to the next string buffer position */

View file

@ -273,12 +273,12 @@ static VOID WINAPI EmulatorDebugBreakBop(LPWORD Stack)
DebugBreak();
}
static BYTE WINAPI Port61hRead(ULONG Port)
static BYTE WINAPI Port61hRead(USHORT Port)
{
return Port61hState;
}
static VOID WINAPI Port61hWrite(ULONG Port, BYTE Data)
static VOID WINAPI Port61hWrite(USHORT Port, BYTE Data)
{
// BOOLEAN SpeakerStateChange = FALSE;
BYTE OldPort61hState = Port61hState;

View file

@ -342,13 +342,13 @@ VOID CmosWriteData(BYTE Value)
SelectedRegister = CMOS_REG_STATUS_D;
}
BYTE WINAPI CmosReadPort(ULONG Port)
BYTE WINAPI CmosReadPort(USHORT Port)
{
ASSERT(Port == CMOS_DATA_PORT);
return CmosReadData();
}
VOID WINAPI CmosWritePort(ULONG Port, BYTE Data)
VOID WINAPI CmosWritePort(USHORT Port, BYTE Data)
{
if (Port == CMOS_ADDRESS_PORT)
CmosWriteAddress(Data);

View file

@ -154,7 +154,7 @@ static VOID PicWriteData(BYTE Port, BYTE Value)
Pic->Initialization = FALSE;
}
static BYTE WINAPI PicReadPort(ULONG Port)
static BYTE WINAPI PicReadPort(USHORT Port)
{
switch (Port)
{
@ -174,7 +174,7 @@ static BYTE WINAPI PicReadPort(ULONG Port)
return 0;
}
static VOID WINAPI PicWritePort(ULONG Port, BYTE Data)
static VOID WINAPI PicWritePort(USHORT Port, BYTE Data)
{
switch (Port)
{

View file

@ -59,7 +59,7 @@ static VOID PS2SendCommand(PPS2_PORT Port, BYTE Command)
if (Port->DeviceCommand) Port->DeviceCommand(Port->Param, Command);
}
static BYTE WINAPI PS2ReadPort(ULONG Port)
static BYTE WINAPI PS2ReadPort(USHORT Port)
{
if (Port == PS2_CONTROL_PORT)
{
@ -87,7 +87,7 @@ static BYTE WINAPI PS2ReadPort(ULONG Port)
return 0;
}
static VOID WINAPI PS2WritePort(ULONG Port, BYTE Data)
static VOID WINAPI PS2WritePort(USHORT Port, BYTE Data)
{
if (Port == PS2_CONTROL_PORT)
{

View file

@ -275,7 +275,7 @@ static VOID PitWriteData(BYTE Channel, BYTE Value)
}
}
static BYTE WINAPI PitReadPort(ULONG Port)
static BYTE WINAPI PitReadPort(USHORT Port)
{
switch (Port)
{
@ -290,7 +290,7 @@ static BYTE WINAPI PitReadPort(ULONG Port)
return 0;
}
static VOID WINAPI PitWritePort(ULONG Port, BYTE Data)
static VOID WINAPI PitWritePort(USHORT Port, BYTE Data)
{
switch (Port)
{

View file

@ -1462,7 +1462,7 @@ static VOID VgaUpdateTextCursor(VOID)
CursorMoved = FALSE;
}
static BYTE WINAPI VgaReadPort(ULONG Port)
static BYTE WINAPI VgaReadPort(USHORT Port)
{
DPRINT("VgaReadPort: Port 0x%X\n", Port);
@ -1554,7 +1554,7 @@ static BYTE WINAPI VgaReadPort(ULONG Port)
return 0;
}
static VOID WINAPI VgaWritePort(ULONG Port, BYTE Data)
static VOID WINAPI VgaWritePort(USHORT Port, BYTE Data)
{
DPRINT("VgaWritePort: Port 0x%X, Data 0x%02X\n", Port, Data);

View file

@ -58,7 +58,7 @@ EMULATOR_IOPORT_HANDLERS IoPortProc[EMULATOR_MAX_IOPORTS_NUM] = {{NULL}};
/* PUBLIC FUNCTIONS ***********************************************************/
UCHAR
IOReadB(ULONG Port)
IOReadB(USHORT Port)
{
if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
IoPortProc[Port].IoHandlers.InB)
@ -82,7 +82,7 @@ IOReadB(ULONG Port)
}
VOID
IOReadStrB(ULONG Port,
IOReadStrB(USHORT Port,
PUCHAR Buffer,
ULONG Count)
{
@ -105,7 +105,7 @@ IOReadStrB(ULONG Port,
}
VOID
IOWriteB(ULONG Port,
IOWriteB(USHORT Port,
UCHAR Buffer)
{
if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
@ -127,7 +127,7 @@ IOWriteB(ULONG Port,
}
VOID
IOWriteStrB(ULONG Port,
IOWriteStrB(USHORT Port,
PUCHAR Buffer,
ULONG Count)
{
@ -150,7 +150,7 @@ IOWriteStrB(ULONG Port,
}
USHORT
IOReadW(ULONG Port)
IOReadW(USHORT Port)
{
if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
IoPortProc[Port].IoHandlers.InW)
@ -177,7 +177,7 @@ IOReadW(ULONG Port)
}
VOID
IOReadStrW(ULONG Port,
IOReadStrW(USHORT Port,
PUSHORT Buffer,
ULONG Count)
{
@ -200,7 +200,7 @@ IOReadStrW(ULONG Port,
}
VOID
IOWriteW(ULONG Port,
IOWriteW(USHORT Port,
USHORT Buffer)
{
if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
@ -223,7 +223,7 @@ IOWriteW(ULONG Port,
}
VOID
IOWriteStrW(ULONG Port,
IOWriteStrW(USHORT Port,
PUSHORT Buffer,
ULONG Count)
{
@ -246,7 +246,7 @@ IOWriteStrW(ULONG Port,
}
ULONG
IOReadD(ULONG Port)
IOReadD(USHORT Port)
{
if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
IoPortProc[Port].IoHandlers.InD)
@ -265,7 +265,7 @@ IOReadD(ULONG Port)
}
VOID
IOReadStrD(ULONG Port,
IOReadStrD(USHORT Port,
PULONG Buffer,
ULONG Count)
{
@ -281,7 +281,7 @@ IOReadStrD(ULONG Port,
}
VOID
IOWriteD(ULONG Port,
IOWriteD(USHORT Port,
ULONG Buffer)
{
if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
@ -298,7 +298,7 @@ IOWriteD(ULONG Port,
}
VOID
IOWriteStrD(ULONG Port,
IOWriteStrD(USHORT Port,
PULONG Buffer,
ULONG Count)
{
@ -314,7 +314,7 @@ IOWriteStrD(ULONG Port,
}
VOID RegisterIoPort(ULONG Port,
VOID RegisterIoPort(USHORT Port,
EMULATOR_INB_PROC InHandler,
EMULATOR_OUTB_PROC OutHandler)
{
@ -332,7 +332,7 @@ VOID RegisterIoPort(ULONG Port,
IoPortProc[Port].hVdd = INVALID_HANDLE_VALUE;
}
VOID UnregisterIoPort(ULONG Port)
VOID UnregisterIoPort(USHORT Port)
{
/*
* Put automagically all the fields to zero:
@ -344,7 +344,7 @@ VOID UnregisterIoPort(ULONG Port)
VOID WINAPI
EmulatorReadIo(PFAST486_STATE State,
ULONG Port,
USHORT Port,
PVOID Buffer,
ULONG DataCount,
UCHAR DataSize)
@ -419,7 +419,7 @@ EmulatorReadIo(PFAST486_STATE State,
VOID WINAPI
EmulatorWriteIo(PFAST486_STATE State,
ULONG Port,
USHORT Port,
PVOID Buffer,
ULONG DataCount,
UCHAR DataSize)

View file

@ -16,79 +16,79 @@
/* FUNCTIONS ******************************************************************/
typedef UCHAR (WINAPI *EMULATOR_INB_PROC)(ULONG Port);
typedef USHORT (WINAPI *EMULATOR_INW_PROC)(ULONG Port);
typedef ULONG (WINAPI *EMULATOR_IND_PROC)(ULONG Port);
typedef UCHAR (WINAPI *EMULATOR_INB_PROC)(USHORT Port);
typedef USHORT (WINAPI *EMULATOR_INW_PROC)(USHORT Port);
typedef ULONG (WINAPI *EMULATOR_IND_PROC)(USHORT Port);
typedef VOID (WINAPI *EMULATOR_INSB_PROC)(ULONG Port, PUCHAR Buffer, ULONG Count);
typedef VOID (WINAPI *EMULATOR_INSW_PROC)(ULONG Port, PUSHORT Buffer, ULONG Count);
typedef VOID (WINAPI *EMULATOR_INSD_PROC)(ULONG Port, PULONG Buffer, ULONG Count);
typedef VOID (WINAPI *EMULATOR_INSB_PROC)(USHORT Port, PUCHAR Buffer, ULONG Count);
typedef VOID (WINAPI *EMULATOR_INSW_PROC)(USHORT Port, PUSHORT Buffer, ULONG Count);
typedef VOID (WINAPI *EMULATOR_INSD_PROC)(USHORT Port, PULONG Buffer, ULONG Count);
typedef VOID (WINAPI *EMULATOR_OUTB_PROC)(ULONG Port, UCHAR Data);
typedef VOID (WINAPI *EMULATOR_OUTW_PROC)(ULONG Port, USHORT Data);
typedef VOID (WINAPI *EMULATOR_OUTD_PROC)(ULONG Port, ULONG Data);
typedef VOID (WINAPI *EMULATOR_OUTB_PROC)(USHORT Port, UCHAR Data);
typedef VOID (WINAPI *EMULATOR_OUTW_PROC)(USHORT Port, USHORT Data);
typedef VOID (WINAPI *EMULATOR_OUTD_PROC)(USHORT Port, ULONG Data);
typedef VOID (WINAPI *EMULATOR_OUTSB_PROC)(ULONG Port, PUCHAR Buffer, ULONG Count);
typedef VOID (WINAPI *EMULATOR_OUTSW_PROC)(ULONG Port, PUSHORT Buffer, ULONG Count);
typedef VOID (WINAPI *EMULATOR_OUTSD_PROC)(ULONG Port, PULONG Buffer, ULONG Count);
typedef VOID (WINAPI *EMULATOR_OUTSB_PROC)(USHORT Port, PUCHAR Buffer, ULONG Count);
typedef VOID (WINAPI *EMULATOR_OUTSW_PROC)(USHORT Port, PUSHORT Buffer, ULONG Count);
typedef VOID (WINAPI *EMULATOR_OUTSD_PROC)(USHORT Port, PULONG Buffer, ULONG Count);
UCHAR
IOReadB(ULONG Port);
IOReadB(USHORT Port);
VOID
IOReadStrB(ULONG Port,
IOReadStrB(USHORT Port,
PUCHAR Buffer,
ULONG Count);
VOID
IOWriteB(ULONG Port,
IOWriteB(USHORT Port,
UCHAR Buffer);
VOID
IOWriteStrB(ULONG Port,
IOWriteStrB(USHORT Port,
PUCHAR Buffer,
ULONG Count);
USHORT
IOReadW(ULONG Port);
IOReadW(USHORT Port);
VOID
IOReadStrW(ULONG Port,
IOReadStrW(USHORT Port,
PUSHORT Buffer,
ULONG Count);
VOID
IOWriteW(ULONG Port,
IOWriteW(USHORT Port,
USHORT Buffer);
VOID
IOWriteStrW(ULONG Port,
IOWriteStrW(USHORT Port,
PUSHORT Buffer,
ULONG Count);
ULONG
IOReadD(ULONG Port);
IOReadD(USHORT Port);
VOID
IOReadStrD(ULONG Port,
IOReadStrD(USHORT Port,
PULONG Buffer,
ULONG Count);
VOID
IOWriteD(ULONG Port,
IOWriteD(USHORT Port,
ULONG Buffer);
VOID
IOWriteStrD(ULONG Port,
IOWriteStrD(USHORT Port,
PULONG Buffer,
ULONG Count);
VOID RegisterIoPort(ULONG Port,
VOID RegisterIoPort(USHORT Port,
EMULATOR_INB_PROC InHandler,
EMULATOR_OUTB_PROC OutHandler);
VOID UnregisterIoPort(ULONG Port);
VOID UnregisterIoPort(USHORT Port);
VOID WINAPI EmulatorReadIo
(
PFAST486_STATE State,
ULONG Port,
USHORT Port,
PVOID Buffer,
ULONG DataCount,
UCHAR DataSize
@ -97,7 +97,7 @@ VOID WINAPI EmulatorReadIo
VOID WINAPI EmulatorWriteIo
(
PFAST486_STATE State,
ULONG Port,
USHORT Port,
PVOID Buffer,
ULONG DataCount,
UCHAR DataSize

View file

@ -1,6 +1,6 @@
set(USE_DIBLIB FALSE)
set(USE_NEW_CURSORICON FALSE)
set(USE_NEW_CURSORICON TRUE)
# Give WIN32 subsystem its own project.
PROJECT(WIN32SS)

View file

@ -248,10 +248,10 @@ IntDestroyClass(IN OUT PCLS Class)
#ifdef NEW_CURSORICON
if (Class->spicn)
UserDereferenceObject(Class->spicn);
if (Class->spicnSm)
UserDereferenceObject(Class->spicnSm);
if (Class->spcur)
UserDereferenceObject(Class->spcur);
if (Class->spicnSm)
UserDereferenceObject(Class->spicnSm);
#else
if (Class->hIconSmIntern)
IntClassDestroyIcon(Class->hIconSmIntern);
@ -838,6 +838,16 @@ IntMoveClassToSharedHeap(IN OUT PCLS Class,
NewClass->rpdeskParent = NULL;
NewClass->pclsBase = NewClass;
#ifdef NEW_CURSORICON
if (NewClass->spcur)
UserReferenceObject(NewClass->spcur);
if (NewClass->spicn)
UserReferenceObject(NewClass->spicn);
if (NewClass->spicnSm)
UserReferenceObject(NewClass->spicnSm);
#endif
/* Replace the class in the list */
(void)InterlockedExchangePointer((PVOID*)*ClassLinkPtr,
NewClass);
@ -1966,18 +1976,31 @@ UserSetClassLongPtr(IN PCLS Class,
if (NewLong && !Class->spicnSm)
{
/* Create the new small icon from the new large(?) one */
HICON SmallIconHandle = co_IntCopyImage(
HICON SmallIconHandle = NULL;
if((NewIcon->CURSORF_flags & (CURSORF_LRSHARED | CURSORF_FROMRESOURCE))
== (CURSORF_LRSHARED | CURSORF_FROMRESOURCE))
{
SmallIconHandle = co_IntCopyImage(
(HICON)NewLong,
IMAGE_ICON,
UserGetSystemMetrics( SM_CXSMICON ),
UserGetSystemMetrics( SM_CYSMICON ),
0);
LR_COPYFROMRESOURCE | LR_SHARED);
}
if (!SmallIconHandle)
{
/* Retry without copying from resource */
SmallIconHandle = co_IntCopyImage(
(HICON)NewLong,
IMAGE_ICON,
UserGetSystemMetrics( SM_CXSMICON ),
UserGetSystemMetrics( SM_CYSMICON ),
LR_SHARED);
}
if (SmallIconHandle)
{
/* So use it */
NewSmallIcon = Class->spicnSm = UserGetCurIconObject(SmallIconHandle);
/* Let the handle go, we have the reference on the object */
NtUserDestroyCursor(SmallIconHandle, FALSE);
Class->CSF_flags |= CSF_CACHEDSMICON;
}
}

View file

@ -63,9 +63,9 @@ PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon)
return NULL;
}
if(UserObjectInDestroy(hCurIcon))
if (UserObjectInDestroy(hCurIcon))
{
ERR("Requesting destroyed cursor.\n");
WARN("Requesting invalid/destroyed cursor.\n");
EngSetLastError(ERROR_INVALID_CURSOR_HANDLE);
return NULL;
}
@ -155,6 +155,36 @@ IntDestroyCurIconObject(
{
PCURICON_OBJECT CurIcon = Object;
/* Try finding it in its process cache */
if (CurIcon->CURSORF_flags & CURSORF_LRSHARED)
{
PPROCESSINFO ppi;
ppi = CurIcon->head.ppi;
if (ppi->pCursorCache == CurIcon)
{
ppi->pCursorCache = CurIcon->pcurNext;
UserDereferenceObject(CurIcon);
}
else
{
PCURICON_OBJECT CacheCurIcon = ppi->pCursorCache;
while (CacheCurIcon)
{
if (CacheCurIcon->pcurNext == CurIcon)
{
CacheCurIcon->pcurNext = CurIcon->pcurNext;
break;
}
CacheCurIcon = CacheCurIcon->pcurNext;
}
/* We must have found it! */
ASSERT(CacheCurIcon != NULL);
UserDereferenceObject(CurIcon);
}
}
/* We just mark the handle as being destroyed.
* Deleting all the stuff will be deferred to the actual struct free. */
return UserDeleteObject(CurIcon->head.h, TYPE_CURSOR);
@ -204,32 +234,12 @@ FreeCurIconObject(
if (CurIcon->CURSORF_flags & CURSORF_LRSHARED)
{
PPROCESSINFO ppi;
if (!IS_INTRESOURCE(CurIcon->strName.Buffer))
ExFreePoolWithTag(CurIcon->strName.Buffer, TAG_STRING);
if (CurIcon->atomModName)
RtlDeleteAtomFromAtomTable(gAtomTable, CurIcon->atomModName);
CurIcon->strName.Buffer = NULL;
CurIcon->atomModName = 0;
/* Try finding it in its process cache */
ppi = CurIcon->head.ppi;
if (ppi->pCursorCache == CurIcon)
ppi->pCursorCache = CurIcon->pcurNext;
else
{
PCURICON_OBJECT CacheCurIcon= ppi->pCursorCache;
while (CacheCurIcon)
{
if (CacheCurIcon->pcurNext == CurIcon)
{
CacheCurIcon->pcurNext = CurIcon->pcurNext;
break;
}
CacheCurIcon = CacheCurIcon->pcurNext;
}
}
}
/* Finally free the thing */
@ -634,40 +644,36 @@ NtUserDestroyCursor(
_In_ BOOL bForce)
{
BOOL ret;
PCURICON_OBJECT CurIcon = NULL;
TRACE("Enter NtUserDestroyCursorIcon\n");
TRACE("Enter NtUserDestroyCursorIcon (%p, %u)\n", hCurIcon, bForce);
UserEnterExclusive();
if (!bForce)
{
/* Maybe we have good reasons not to destroy this object */
PCURICON_OBJECT CurIcon = UserGetCurIconObject(hCurIcon);
ULONG Flags;
CurIcon = UserGetCurIconObject(hCurIcon);
if (!CurIcon)
{
ret = FALSE;
goto leave;
}
if (!bForce)
{
/* Maybe we have good reasons not to destroy this object */
if (CurIcon->head.ppi != PsGetCurrentProcessWin32Process())
{
/* No way, you're not touching my cursor */
ret = FALSE;
UserDereferenceObject(CurIcon);
goto leave;
}
Flags = CurIcon->CURSORF_flags;
UserDereferenceObject(CurIcon);
if (Flags & CURSORF_CURRENT)
if (CurIcon->CURSORF_flags & CURSORF_CURRENT)
{
WARN("Trying to delete current cursor!\n");
ret = FALSE;
goto leave;
}
if (Flags & CURSORF_LRSHARED)
if (CurIcon->CURSORF_flags & CURSORF_LRSHARED)
{
WARN("Trying to delete shared cursor.\n");
/* This one is not an error */
@ -677,9 +683,11 @@ NtUserDestroyCursor(
}
/* Destroy the handle */
ret = UserDeleteObject(hCurIcon, TYPE_CURSOR);
ret = IntDestroyCurIconObject(CurIcon);
leave:
if (CurIcon)
UserDereferenceObject(CurIcon);
TRACE("Leave NtUserDestroyCursorIcon, ret=%i\n", ret);
UserLeave();
return ret;
@ -842,7 +850,7 @@ NtUserSetCursor(
PCURICON_OBJECT pcurOld, pcurNew;
HCURSOR hOldCursor = NULL;
TRACE("Enter NtUserSetCursor\n");
TRACE("Enter NtUserSetCursor: %p\n", hCursor);
UserEnterExclusive();
if (hCursor)
@ -863,6 +871,10 @@ NtUserSetCursor(
pcurOld = UserSetCursor(pcurNew, FALSE);
if (pcurOld)
{
hOldCursor = pcurOld->head.h;
/* See if it was destroyed in the meantime */
if (UserObjectInDestroy(hOldCursor))
hOldCursor = NULL;
pcurOld->CURSORF_flags &= ~CURSORF_CURRENT;
UserDereferenceObject(pcurOld);
}

View file

@ -61,7 +61,7 @@ IntKeyboardGetIndicatorTrans(HANDLE hKeyboardDevice,
while (pRet)
{
Status = NtDeviceIoControlFile(hKeyboardDevice,
Status = ZwDeviceIoControlFile(hKeyboardDevice,
NULL,
NULL,
NULL,
@ -104,8 +104,7 @@ static
NTSTATUS APIENTRY
IntKeyboardUpdateLeds(HANDLE hKeyboardDevice,
WORD wVk,
WORD wScanCode,
BOOL bEnabled)
WORD wScanCode)
{
NTSTATUS Status;
UINT i;
@ -133,13 +132,10 @@ IntKeyboardUpdateLeds(HANDLE hKeyboardDevice,
if (LedFlag)
{
if (bEnabled)
gIndicators.LedFlags |= LedFlag;
else
gIndicators.LedFlags = ~LedFlag;
gIndicators.LedFlags ^= LedFlag;
/* Update the lights on the hardware */
Status = NtDeviceIoControlFile(hKeyboardDevice,
Status = ZwDeviceIoControlFile(hKeyboardDevice,
NULL,
NULL,
NULL,
@ -164,10 +160,10 @@ UserInitKeyboard(HANDLE hKeyboardDevice)
{
NTSTATUS Status;
IO_STATUS_BLOCK Block;
/*
IntKeyboardGetIndicatorTrans(hKeyboardDevice, &gpKeyboardIndicatorTrans);
Status = NtDeviceIoControlFile(hKeyboardDevice,
Status = ZwDeviceIoControlFile(hKeyboardDevice,
NULL,
NULL,
NULL,
@ -186,9 +182,9 @@ UserInitKeyboard(HANDLE hKeyboardDevice)
gIndicators.LedFlags & KEYBOARD_NUM_LOCK_ON);
SET_KEY_LOCKED(gafAsyncKeyState, VK_SCROLL,
gIndicators.LedFlags & KEYBOARD_SCROLL_LOCK_ON);
*/
// FIXME: Need device driver to work! HID support more than one!!!!
Status = NtDeviceIoControlFile(hKeyboardDevice,
Status = ZwDeviceIoControlFile(hKeyboardDevice,
NULL,
NULL,
NULL,
@ -808,8 +804,7 @@ ProcessKeyEvent(WORD wVk, WORD wScanCode, DWORD dwFlags, BOOL bInjected, DWORD d
/* Update keyboard LEDs */
IntKeyboardUpdateLeds(ghKeyboardDevice,
wSimpleVk,
wScanCode,
IS_KEY_LOCKED(gafAsyncKeyState, wSimpleVk));
wScanCode);
}
/* Call WH_KEYBOARD_LL hook */

View file

@ -1677,17 +1677,31 @@ PWND FASTCALL IntCreateWindow(CREATESTRUCTW* Cs,
#ifdef NEW_CURSORICON
if (Class->spicn && !Class->spicnSm)
{
HICON IconSmHandle = co_IntCopyImage(
HICON IconSmHandle = NULL;
if((Class->spicn->CURSORF_flags & (CURSORF_LRSHARED | CURSORF_FROMRESOURCE))
== (CURSORF_LRSHARED | CURSORF_FROMRESOURCE))
{
IconSmHandle = co_IntCopyImage(
UserHMGetHandle(Class->spicn),
IMAGE_ICON,
UserGetSystemMetrics( SM_CXSMICON ),
UserGetSystemMetrics( SM_CYSMICON ),
0);
LR_COPYFROMRESOURCE | LR_SHARED);
}
if (!IconSmHandle)
{
/* Retry without copying from resource */
IconSmHandle = co_IntCopyImage(
UserHMGetHandle(Class->spicn),
IMAGE_ICON,
UserGetSystemMetrics( SM_CXSMICON ),
UserGetSystemMetrics( SM_CYSMICON ),
LR_SHARED);
}
if (IconSmHandle)
{
Class->spicnSm = UserGetCurIconObject(IconSmHandle);
/* We can delete the handle, only the pointer is of interest */
NtUserDestroyCursor(IconSmHandle, FALSE);
Class->CSF_flags |= CSF_CACHEDSMICON;
}
}

View file

@ -714,15 +714,15 @@ IntGetClassLongA(PWND Wnd, PCLS Class, int nIndex)
break;
#ifdef NEW_CURSORICON
case GCLP_HCURSOR:
Ret = Class->spcur ? (ULONG_PTR)((PPROCMARKHEAD)DesktopPtrToUser(Class->spcur))->h : 0;
Ret = Class->spcur ? (ULONG_PTR)((PPROCMARKHEAD)SharedPtrToUser(Class->spcur))->h : 0;
break;
case GCLP_HICON:
Ret = Class->spicn ? (ULONG_PTR)((PPROCMARKHEAD)DesktopPtrToUser(Class->spicn))->h : 0;
Ret = Class->spicn ? (ULONG_PTR)((PPROCMARKHEAD)SharedPtrToUser(Class->spicn))->h : 0;
break;
case GCLP_HICONSM:
Ret = Class->spicnSm ? (ULONG_PTR)((PPROCMARKHEAD)DesktopPtrToUser(Class->spicnSm))->h : 0;
Ret = Class->spicnSm ? (ULONG_PTR)((PPROCMARKHEAD)SharedPtrToUser(Class->spicnSm))->h : 0;
break;
#else
case GCLP_HCURSOR:
@ -805,15 +805,15 @@ IntGetClassLongW (PWND Wnd, PCLS Class, int nIndex)
#ifdef NEW_CURSORICON
case GCLP_HCURSOR:
Ret = Class->spcur ? (ULONG_PTR)((PPROCMARKHEAD)DesktopPtrToUser(Class->spcur))->h : 0;
Ret = Class->spcur ? (ULONG_PTR)((PPROCMARKHEAD)SharedPtrToUser(Class->spcur))->h : 0;
break;
case GCLP_HICON:
Ret = Class->spicn ? (ULONG_PTR)((PPROCMARKHEAD)DesktopPtrToUser(Class->spicn))->h : 0;
Ret = Class->spicn ? (ULONG_PTR)((PPROCMARKHEAD)SharedPtrToUser(Class->spicn))->h : 0;
break;
case GCLP_HICONSM:
Ret = Class->spicnSm ? (ULONG_PTR)((PPROCMARKHEAD)DesktopPtrToUser(Class->spicnSm))->h : 0;
Ret = Class->spicnSm ? (ULONG_PTR)((PPROCMARKHEAD)SharedPtrToUser(Class->spicnSm))->h : 0;
break;
#else
case GCLP_HCURSOR:

View file

@ -393,10 +393,11 @@ get_best_icon_file_entry(
WORD i;
const CURSORICONFILEDIRENTRY* entry;
/* Check our file is what it claims to be */
if ( dwFileSize < sizeof(*dir) )
return NULL;
if ( dwFileSize < (sizeof(*dir) + sizeof(dir->idEntries[0])*(dir->idCount-1)) )
if (dwFileSize < (sizeof(*dir) + FIELD_OFFSET(CURSORICONFILEDIR, idEntries[dir->idCount])))
return NULL;
/*
@ -418,7 +419,8 @@ get_best_icon_file_entry(
fakeEntry = &fakeDir->idEntries[i];
entry = &dir->idEntries[i];
/* Take this as an occasion to perform a size check */
if((entry->dwDIBOffset + entry->dwDIBSize) > dwFileSize)
if ((entry->dwDIBOffset > dwFileSize)
|| ((entry->dwDIBOffset + entry->dwDIBSize) > dwFileSize))
{
ERR("Corrupted icon file?.\n");
HeapFree(GetProcessHeap(), 0, fakeDir);
@ -1260,12 +1262,12 @@ CURSORICON_LoadFromFileW(
cursorData.rt = (USHORT)((ULONG_PTR)(bIcon ? RT_ICON : RT_CURSOR));
/* Do the dance */
if(!CURSORICON_GetCursorDataFromBMI(&cursorData, (BITMAPINFO*)&bits[entry->dwDIBOffset]))
if(!CURSORICON_GetCursorDataFromBMI(&cursorData, (BITMAPINFO*)(&bits[entry->dwDIBOffset])))
goto end;
hCurIcon = NtUserxCreateEmptyCurObject(FALSE);
if(!hCurIcon)
goto end_error;
goto end;
/* Tell win32k */
if(!NtUserSetCursorIconData(hCurIcon, NULL, NULL, &cursorData))
@ -1283,6 +1285,7 @@ end_error:
DeleteObject(cursorData.hbmMask);
if(cursorData.hbmColor) DeleteObject(cursorData.hbmColor);
if(cursorData.hbmAlpha) DeleteObject(cursorData.hbmAlpha);
UnmapViewOfFile(bits);
return NULL;
}
@ -1681,8 +1684,9 @@ CURSORICON_CopyImage(
{
HICON ret = NULL;
ICONINFO ii;
CURSORDATA CursorData;
if(fuFlags & LR_COPYFROMRESOURCE)
if (fuFlags & LR_COPYFROMRESOURCE)
{
/* Get the icon module/resource names */
UNICODE_STRING ustrModule;
@ -1694,14 +1698,14 @@ CURSORICON_CopyImage(
ustrRsrc.MaximumLength = 256;
ustrModule.Buffer = HeapAlloc(GetProcessHeap(), 0, ustrModule.MaximumLength);
if(!ustrModule.Buffer)
if (!ustrModule.Buffer)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL;
}
/* Keep track of the buffer for the resource, NtUserGetIconInfo might overwrite it */
pvBuf = HeapAlloc(GetProcessHeap(), 0, ustrRsrc.MaximumLength);
if(!pvBuf)
if (!pvBuf)
{
HeapFree(GetProcessHeap(), 0, ustrModule.Buffer);
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
@ -1742,7 +1746,7 @@ CURSORICON_CopyImage(
{
ustrRsrc.MaximumLength *= 2;
pvBuf = HeapReAlloc(GetProcessHeap(), 0, ustrRsrc.Buffer, ustrRsrc.MaximumLength);
if(!pvBuf)
if (!pvBuf)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
goto leave;
@ -1753,11 +1757,11 @@ CURSORICON_CopyImage(
/* NULL-terminate our strings */
ustrModule.Buffer[ustrModule.Length/sizeof(WCHAR)] = 0;
if(!IS_INTRESOURCE(ustrRsrc.Buffer))
if (!IS_INTRESOURCE(ustrRsrc.Buffer))
ustrRsrc.Buffer[ustrRsrc.Length/sizeof(WCHAR)] = 0;
/* Get the module handle */
if(!GetModuleHandleExW(0, ustrModule.Buffer, &hModule))
if (!GetModuleHandleExW(0, ustrModule.Buffer, &hModule))
{
/* This should never happen */
ERR("Invalid handle?.\n");
@ -1766,7 +1770,13 @@ CURSORICON_CopyImage(
}
/* Call the relevant function */
ret = CURSORICON_LoadImageW(hModule, ustrRsrc.Buffer, cxDesired, cyDesired, fuFlags & LR_DEFAULTSIZE, bIcon);
ret = CURSORICON_LoadImageW(
hModule,
ustrRsrc.Buffer,
cxDesired,
cyDesired,
fuFlags & (LR_DEFAULTSIZE | LR_SHARED),
bIcon);
FreeLibrary(hModule);
@ -1781,24 +1791,40 @@ CURSORICON_CopyImage(
}
/* This is a regular copy */
if(fuFlags & ~LR_COPYDELETEORG)
if (fuFlags & ~(LR_COPYDELETEORG | LR_SHARED))
FIXME("Unimplemented flags: 0x%08x\n", fuFlags);
if(!GetIconInfo(hicon, &ii))
if (!GetIconInfo(hicon, &ii))
{
ERR("GetIconInfo failed.\n");
return NULL;
}
ret = CreateIconIndirect(&ii);
/* This is CreateIconIndirect with the LR_SHARED coat added */
if (!CURSORICON_GetCursorDataFromIconInfo(&CursorData, &ii))
goto Leave;
if (fuFlags & LR_SHARED)
CursorData.CURSORF_flags |= CURSORF_LRSHARED;
ret = NtUserxCreateEmptyCurObject(FALSE);
if (!ret)
goto Leave;
if (!NtUserSetCursorIconData(ret, NULL, NULL, &CursorData))
{
NtUserDestroyCursor(ret, TRUE);
goto Leave;
}
Leave:
DeleteObject(ii.hbmMask);
if(ii.hbmColor) DeleteObject(ii.hbmColor);
if (ii.hbmColor) DeleteObject(ii.hbmColor);
if(ret && (fuFlags & LR_COPYDELETEORG))
if (ret && (fuFlags & LR_COPYDELETEORG))
DestroyIcon(hicon);
return hicon;
return ret;
}
NTSTATUS WINAPI
@ -2196,7 +2222,7 @@ int WINAPI LookupIconIdFromDirectoryEx(
/* No inferior or equal depth available. Get the smallest bigger one */
BitCount = 0xFFFF;
iIndex = 0;
iIndex = -1;
for(i = 0; i < dir->idCount; i++)
{
entry = &dir->idEntries[i];
@ -2222,8 +2248,10 @@ int WINAPI LookupIconIdFromDirectoryEx(
BitCount = entry->wBitCount;
}
}
if (iIndex >= 0)
return dir->idEntries[iIndex].wResId;
return 0;
}
HICON WINAPI CreateIcon(