shlwapi-AssocGetPerceivedType: Fixed error checking for RegGetValueW based on feedback from Thomas Faber.

This commit is contained in:
Sebastian Lackner 2015-05-31 21:51:48 +02:00
parent e7ab8d7b04
commit da512da861
2 changed files with 11 additions and 9 deletions

View File

@ -4631,7 +4631,7 @@ if test "$enable_shlwapi_AssocGetPerceivedType" -eq 1; then
patch_apply shlwapi-AssocGetPerceivedType/0002-shlwapi-Implement-AssocGetPerceivedType.patch
(
echo '+ { "Mark Jansen", "shlwapi/tests: Add tests for AssocGetPerceivedType.", 1 },';
echo '+ { "Mark Jansen", "shlwapi: Implement AssocGetPerceivedType.", 1 },';
echo '+ { "Mark Jansen", "shlwapi: Implement AssocGetPerceivedType.", 2 },';
) >> "$patchlist"
fi

View File

@ -1,15 +1,17 @@
From a1f22f7261c4da3fd7aaf4012583e8ab82808be7 Mon Sep 17 00:00:00 2001
From 58962c007d986f7c269c10816c21b73fc8a23754 Mon Sep 17 00:00:00 2001
From: Mark Jansen <learn0more@gmail.com>
Date: Sun, 10 May 2015 03:38:01 +0200
Subject: shlwapi: Implement AssocGetPerceivedType.
Subject: shlwapi: Implement AssocGetPerceivedType. (v2)
Changes in v2:
* Fixed error checking for RegGetValueW based on feedback from Thomas Faber.
---
dlls/shlwapi/assoc.c | 228 +++++++++++++++++++++++++++++++++++++++++++--
dlls/shlwapi/tests/assoc.c | 7 +-
2 files changed, 225 insertions(+), 10 deletions(-)
diff --git a/dlls/shlwapi/assoc.c b/dlls/shlwapi/assoc.c
index 62c101d..38385dd 100644
index 62c101d..a5cb4b1 100644
--- a/dlls/shlwapi/assoc.c
+++ b/dlls/shlwapi/assoc.c
@@ -102,6 +102,174 @@ HRESULT WINAPI AssocCreate(CLSID clsid, REFIID refiid, void **lpInterface)
@ -219,8 +221,8 @@ index 62c101d..38385dd 100644
+ {
+ WCHAR Buffer[100] = { 0 };
+ DWORD Size = sizeof(Buffer);
+ if (SUCCEEDED(RegGetValueW(HKEY_CLASSES_ROOT, lpszExt, PerceivedTypeKey,
+ RRF_RT_REG_SZ, NULL, Buffer, &Size)))
+ if (RegGetValueW(HKEY_CLASSES_ROOT, lpszExt, PerceivedTypeKey,
+ RRF_RT_REG_SZ, NULL, Buffer, &Size) == ERROR_SUCCESS)
+ {
+ Info = AssocFindByType(Buffer);
+ }
@ -229,8 +231,8 @@ index 62c101d..38385dd 100644
+ WCHAR KeyName[MAX_PATH] = { 0 };
+ snprintfW(KeyName, MAX_PATH, SystemFileAssociationsKey, lpszExt);
+ Size = sizeof(Buffer);
+ if (SUCCEEDED(RegGetValueW(HKEY_CLASSES_ROOT, KeyName, PerceivedTypeKey,
+ RRF_RT_REG_SZ, NULL, Buffer, &Size)))
+ if (RegGetValueW(HKEY_CLASSES_ROOT, KeyName, PerceivedTypeKey,
+ RRF_RT_REG_SZ, NULL, Buffer, &Size) == ERROR_SUCCESS)
+ {
+ Info = AssocFindByType(Buffer);
+ }
@ -285,5 +287,5 @@ index 2b4e0ad..b4576d9 100644
}
}
--
2.4.0
2.4.2