Nikolay Sivov : shlwapi/tests: Fix uninitialized data access in tests ( Valgrind).
Alexandre Julliard
julliard at wine.codeweavers.com
Sat Jan 9 03:32:18 CST 2016
Module: wine
Branch: master
Commit: ed0520e2e2a4c15eebc4f97a6f6d8258ad9387b7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ed0520e2e2a4c15eebc4f97a6f6d8258ad9387b7
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Thu Jan 7 23:14:55 2016 +0300
shlwapi/tests: Fix uninitialized data access in tests (Valgrind).
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/shlwapi/ordinal.c | 2 +-
dlls/shlwapi/tests/ordinal.c | 41 +++++++++++++++++++++--------------------
2 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c
index e3d021f..334607e 100644
--- a/dlls/shlwapi/ordinal.c
+++ b/dlls/shlwapi/ordinal.c
@@ -4842,7 +4842,7 @@ typedef struct SHELL_USER_PERMISSION { /* ...and this should be in shlwapi.h */
* NOTES
* Call should free returned descriptor with LocalFree
*/
-PSECURITY_DESCRIPTOR WINAPI GetShellSecurityDescriptor(PSHELL_USER_PERMISSION *apUserPerm, int cUserPerm)
+PSECURITY_DESCRIPTOR WINAPI GetShellSecurityDescriptor(const PSHELL_USER_PERMISSION *apUserPerm, int cUserPerm)
{
PSID *sidlist;
PSID cur_user = NULL;
diff --git a/dlls/shlwapi/tests/ordinal.c b/dlls/shlwapi/tests/ordinal.c
index afccd3a..2a1eaed 100644
--- a/dlls/shlwapi/tests/ordinal.c
+++ b/dlls/shlwapi/tests/ordinal.c
@@ -72,6 +72,23 @@ static HWND (WINAPI *pSHSetParentHwnd)(HWND, HWND);
static HRESULT (WINAPI *pIUnknown_GetClassID)(IUnknown*, CLSID*);
static HRESULT (WINAPI *pDllGetVersion)(DLLVERSIONINFO2*);
+typedef struct SHELL_USER_SID {
+ SID_IDENTIFIER_AUTHORITY sidAuthority;
+ DWORD dwUserGroupID;
+ DWORD dwUserID;
+} SHELL_USER_SID, *PSHELL_USER_SID;
+typedef struct SHELL_USER_PERMISSION {
+
+ SHELL_USER_SID susID;
+ DWORD dwAccessType;
+ BOOL fInherit;
+ DWORD dwAccessMask;
+ DWORD dwInheritMask;
+ DWORD dwInheritAccessMask;
+} SHELL_USER_PERMISSION, *PSHELL_USER_PERMISSION;
+
+static SECURITY_DESCRIPTOR* (WINAPI *pGetShellSecurityDescriptor)(const SHELL_USER_PERMISSION**,int);
+
static HMODULE hmlang;
static HRESULT (WINAPI *pLcidToRfc1766A)(LCID, LPSTR, INT);
@@ -676,40 +693,23 @@ static void test_fdsa(void)
HeapFree(GetProcessHeap(), 0, mem);
}
-
-typedef struct SHELL_USER_SID {
- SID_IDENTIFIER_AUTHORITY sidAuthority;
- DWORD dwUserGroupID;
- DWORD dwUserID;
-} SHELL_USER_SID, *PSHELL_USER_SID;
-typedef struct SHELL_USER_PERMISSION {
- SHELL_USER_SID susID;
- DWORD dwAccessType;
- BOOL fInherit;
- DWORD dwAccessMask;
- DWORD dwInheritMask;
- DWORD dwInheritAccessMask;
-} SHELL_USER_PERMISSION, *PSHELL_USER_PERMISSION;
static void test_GetShellSecurityDescriptor(void)
{
- SHELL_USER_PERMISSION supCurrentUserFull = {
+ static const SHELL_USER_PERMISSION supCurrentUserFull = {
{ {SECURITY_NULL_SID_AUTHORITY}, 0, 0 },
ACCESS_ALLOWED_ACE_TYPE, FALSE,
GENERIC_ALL, 0, 0 };
#define MY_INHERITANCE 0xBE /* invalid value to proof behavior */
- SHELL_USER_PERMISSION supEveryoneDenied = {
+ static const SHELL_USER_PERMISSION supEveryoneDenied = {
{ {SECURITY_WORLD_SID_AUTHORITY}, SECURITY_WORLD_RID, 0 },
ACCESS_DENIED_ACE_TYPE, TRUE,
GENERIC_WRITE, MY_INHERITANCE | 0xDEADBA00, GENERIC_READ };
- PSHELL_USER_PERMISSION rgsup[2] = {
+ const SHELL_USER_PERMISSION* rgsup[2] = {
&supCurrentUserFull, &supEveryoneDenied,
};
SECURITY_DESCRIPTOR* psd;
- SECURITY_DESCRIPTOR* (WINAPI*pGetShellSecurityDescriptor)(PSHELL_USER_PERMISSION*,int);
void *pChrCmpIW = GetProcAddress(hShlwapi, "ChrCmpIW");
- pGetShellSecurityDescriptor=(void*)GetProcAddress(hShlwapi,(char*)475);
-
if(!pGetShellSecurityDescriptor)
{
win_skip("GetShellSecurityDescriptor not available\n");
@@ -3064,6 +3064,7 @@ static void init_pointers(void)
MAKEFUNC(SHFormatDateTimeA, 353);
MAKEFUNC(SHFormatDateTimeW, 354);
MAKEFUNC(SHIShellFolder_EnumObjects, 404);
+ MAKEFUNC(GetShellSecurityDescriptor, 475);
MAKEFUNC(SHGetObjectCompatFlags, 476);
MAKEFUNC(IUnknown_QueryServiceExec, 484);
MAKEFUNC(SHGetShellKey, 491);
More information about the wine-cvs
mailing list