Commit ed0520e2 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent 23d3b123
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment