shlwapi/tests: Fix uninitialized data access in tests (Valgrind).

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-01-07 23:14:55 +03:00 committed by Alexandre Julliard
parent 23d3b123db
commit ed0520e2e2
2 changed files with 22 additions and 21 deletions

View File

@ -4842,7 +4842,7 @@ typedef struct SHELL_USER_PERMISSION { /* ...and this should be in shlwapi.h */
* NOTES * NOTES
* Call should free returned descriptor with LocalFree * 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 *sidlist;
PSID cur_user = NULL; PSID cur_user = NULL;

View File

@ -72,6 +72,23 @@ static HWND (WINAPI *pSHSetParentHwnd)(HWND, HWND);
static HRESULT (WINAPI *pIUnknown_GetClassID)(IUnknown*, CLSID*); static HRESULT (WINAPI *pIUnknown_GetClassID)(IUnknown*, CLSID*);
static HRESULT (WINAPI *pDllGetVersion)(DLLVERSIONINFO2*); 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 HMODULE hmlang;
static HRESULT (WINAPI *pLcidToRfc1766A)(LCID, LPSTR, INT); static HRESULT (WINAPI *pLcidToRfc1766A)(LCID, LPSTR, INT);
@ -676,40 +693,23 @@ static void test_fdsa(void)
HeapFree(GetProcessHeap(), 0, mem); 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) static void test_GetShellSecurityDescriptor(void)
{ {
SHELL_USER_PERMISSION supCurrentUserFull = { static const SHELL_USER_PERMISSION supCurrentUserFull = {
{ {SECURITY_NULL_SID_AUTHORITY}, 0, 0 }, { {SECURITY_NULL_SID_AUTHORITY}, 0, 0 },
ACCESS_ALLOWED_ACE_TYPE, FALSE, ACCESS_ALLOWED_ACE_TYPE, FALSE,
GENERIC_ALL, 0, 0 }; GENERIC_ALL, 0, 0 };
#define MY_INHERITANCE 0xBE /* invalid value to proof behavior */ #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 }, { {SECURITY_WORLD_SID_AUTHORITY}, SECURITY_WORLD_RID, 0 },
ACCESS_DENIED_ACE_TYPE, TRUE, ACCESS_DENIED_ACE_TYPE, TRUE,
GENERIC_WRITE, MY_INHERITANCE | 0xDEADBA00, GENERIC_READ }; GENERIC_WRITE, MY_INHERITANCE | 0xDEADBA00, GENERIC_READ };
PSHELL_USER_PERMISSION rgsup[2] = { const SHELL_USER_PERMISSION* rgsup[2] = {
&supCurrentUserFull, &supEveryoneDenied, &supCurrentUserFull, &supEveryoneDenied,
}; };
SECURITY_DESCRIPTOR* psd; SECURITY_DESCRIPTOR* psd;
SECURITY_DESCRIPTOR* (WINAPI*pGetShellSecurityDescriptor)(PSHELL_USER_PERMISSION*,int);
void *pChrCmpIW = GetProcAddress(hShlwapi, "ChrCmpIW"); void *pChrCmpIW = GetProcAddress(hShlwapi, "ChrCmpIW");
pGetShellSecurityDescriptor=(void*)GetProcAddress(hShlwapi,(char*)475);
if(!pGetShellSecurityDescriptor) if(!pGetShellSecurityDescriptor)
{ {
win_skip("GetShellSecurityDescriptor not available\n"); win_skip("GetShellSecurityDescriptor not available\n");
@ -3064,6 +3064,7 @@ static void init_pointers(void)
MAKEFUNC(SHFormatDateTimeA, 353); MAKEFUNC(SHFormatDateTimeA, 353);
MAKEFUNC(SHFormatDateTimeW, 354); MAKEFUNC(SHFormatDateTimeW, 354);
MAKEFUNC(SHIShellFolder_EnumObjects, 404); MAKEFUNC(SHIShellFolder_EnumObjects, 404);
MAKEFUNC(GetShellSecurityDescriptor, 475);
MAKEFUNC(SHGetObjectCompatFlags, 476); MAKEFUNC(SHGetObjectCompatFlags, 476);
MAKEFUNC(IUnknown_QueryServiceExec, 484); MAKEFUNC(IUnknown_QueryServiceExec, 484);
MAKEFUNC(SHGetShellKey, 491); MAKEFUNC(SHGetShellKey, 491);