Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
39802508
Commit
39802508
authored
Oct 14, 2023
by
Zebediah Figura
Committed by
Alexandre Julliard
Oct 16, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Add more tests for GetSecurityInfo().
parent
c05973d0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
1 deletion
+95
-1
security.c
dlls/advapi32/tests/security.c
+93
-0
accctrl.h
include/accctrl.h
+2
-1
No files found.
dlls/advapi32/tests/security.c
View file @
39802508
...
@@ -4782,6 +4782,7 @@ static void test_GetSecurityInfo(void)
...
@@ -4782,6 +4782,7 @@ static void test_GetSecurityInfo(void)
SID_IDENTIFIER_AUTHORITY
sia
=
{
SECURITY_NT_AUTHORITY
};
SID_IDENTIFIER_AUTHORITY
sia
=
{
SECURITY_NT_AUTHORITY
};
int
domain_users_ace_id
=
-
1
,
admins_ace_id
=
-
1
,
i
;
int
domain_users_ace_id
=
-
1
,
admins_ace_id
=
-
1
,
i
;
DWORD
sid_size
=
sizeof
(
admin_ptr
),
l
=
sizeof
(
b
);
DWORD
sid_size
=
sizeof
(
admin_ptr
),
l
=
sizeof
(
b
);
SECURITY_ATTRIBUTES
sa
=
{.
nLength
=
sizeof
(
sa
)};
PSID
admin_sid
=
(
PSID
)
admin_ptr
,
user_sid
;
PSID
admin_sid
=
(
PSID
)
admin_ptr
,
user_sid
;
char
sd
[
SECURITY_DESCRIPTOR_MIN_LENGTH
];
char
sd
[
SECURITY_DESCRIPTOR_MIN_LENGTH
];
BOOL
owner_defaulted
,
group_defaulted
;
BOOL
owner_defaulted
,
group_defaulted
;
...
@@ -4796,6 +4797,24 @@ static void test_GetSecurityInfo(void)
...
@@ -4796,6 +4797,24 @@ static void test_GetSecurityInfo(void)
BYTE
flags
;
BYTE
flags
;
DWORD
ret
;
DWORD
ret
;
static
const
SE_OBJECT_TYPE
kernel_types
[]
=
{
SE_FILE_OBJECT
,
SE_KERNEL_OBJECT
,
SE_WMIGUID_OBJECT
,
};
static
const
SE_OBJECT_TYPE
invalid_types
[]
=
{
SE_UNKNOWN_OBJECT_TYPE
,
SE_DS_OBJECT
,
SE_DS_OBJECT_ALL
,
SE_PROVIDER_DEFINED_OBJECT
,
SE_REGISTRY_WOW64_32KEY
,
SE_REGISTRY_WOW64_64KEY
,
0xdeadbeef
,
};
if
(
!
pSetSecurityInfo
)
if
(
!
pSetSecurityInfo
)
{
{
win_skip
(
"[Get|Set]SecurityInfo is not available
\n
"
);
win_skip
(
"[Get|Set]SecurityInfo is not available
\n
"
);
...
@@ -4984,6 +5003,80 @@ static void test_GetSecurityInfo(void)
...
@@ -4984,6 +5003,80 @@ static void test_GetSecurityInfo(void)
"Builtin Admins ACE has unexpected mask (0x%lx != 0x%x)
\n
"
,
ace
->
Mask
,
PROCESS_ALL_ACCESS
);
"Builtin Admins ACE has unexpected mask (0x%lx != 0x%x)
\n
"
,
ace
->
Mask
,
PROCESS_ALL_ACCESS
);
}
}
LocalFree
(
pSD
);
LocalFree
(
pSD
);
ret
=
GetSecurityInfo
(
NULL
,
SE_FILE_OBJECT
,
DACL_SECURITY_INFORMATION
,
NULL
,
NULL
,
NULL
,
NULL
,
&
pSD
);
ok
(
ret
==
ERROR_INVALID_HANDLE
,
"got error %lu
\n
"
,
ret
);
ret
=
GetSecurityInfo
(
GetCurrentProcess
(),
SE_FILE_OBJECT
,
DACL_SECURITY_INFORMATION
,
NULL
,
NULL
,
NULL
,
NULL
,
&
pSD
);
ok
(
!
ret
,
"got error %lu
\n
"
,
ret
);
LocalFree
(
pSD
);
sa
.
lpSecurityDescriptor
=
sd
;
obj
=
CreateEventA
(
&
sa
,
TRUE
,
TRUE
,
NULL
);
pDacl
=
(
PACL
)
&
dacl
;
for
(
size_t
i
=
0
;
i
<
ARRAY_SIZE
(
kernel_types
);
++
i
)
{
winetest_push_context
(
"Type %#x"
,
kernel_types
[
i
]);
ret
=
GetSecurityInfo
(
NULL
,
kernel_types
[
i
],
DACL_SECURITY_INFORMATION
,
NULL
,
NULL
,
NULL
,
NULL
,
&
pSD
);
ok
(
ret
==
ERROR_INVALID_HANDLE
,
"got error %lu
\n
"
,
ret
);
ret
=
GetSecurityInfo
(
GetCurrentProcess
(),
kernel_types
[
i
],
DACL_SECURITY_INFORMATION
,
NULL
,
NULL
,
NULL
,
NULL
,
&
pSD
);
ok
(
!
ret
,
"got error %lu
\n
"
,
ret
);
LocalFree
(
pSD
);
ret
=
GetSecurityInfo
(
obj
,
kernel_types
[
i
],
DACL_SECURITY_INFORMATION
,
NULL
,
NULL
,
NULL
,
NULL
,
&
pSD
);
ok
(
!
ret
,
"got error %lu
\n
"
,
ret
);
LocalFree
(
pSD
);
ret
=
SetSecurityInfo
(
NULL
,
kernel_types
[
i
],
DACL_SECURITY_INFORMATION
,
NULL
,
NULL
,
pDacl
,
NULL
);
ok
(
ret
==
ERROR_INVALID_HANDLE
,
"got error %lu
\n
"
,
ret
);
ret
=
SetSecurityInfo
(
obj
,
kernel_types
[
i
],
DACL_SECURITY_INFORMATION
,
NULL
,
NULL
,
pDacl
,
NULL
);
ok
(
!
ret
||
ret
==
ERROR_NO_SECURITY_ON_OBJECT
/* win 7 */
,
"got error %lu
\n
"
,
ret
);
winetest_pop_context
();
}
ret
=
GetSecurityInfo
(
GetCurrentProcess
(),
SE_REGISTRY_KEY
,
DACL_SECURITY_INFORMATION
,
NULL
,
NULL
,
NULL
,
NULL
,
&
pSD
);
todo_wine
ok
(
ret
==
ERROR_INVALID_HANDLE
,
"got error %lu
\n
"
,
ret
);
ret
=
GetSecurityInfo
(
obj
,
SE_REGISTRY_KEY
,
DACL_SECURITY_INFORMATION
,
NULL
,
NULL
,
NULL
,
NULL
,
&
pSD
);
todo_wine
ok
(
ret
==
ERROR_INVALID_HANDLE
,
"got error %lu
\n
"
,
ret
);
CloseHandle
(
obj
);
for
(
size_t
i
=
0
;
i
<
ARRAY_SIZE
(
invalid_types
);
++
i
)
{
winetest_push_context
(
"Type %#x"
,
invalid_types
[
i
]);
ret
=
GetSecurityInfo
(
NULL
,
invalid_types
[
i
],
DACL_SECURITY_INFORMATION
,
NULL
,
NULL
,
NULL
,
NULL
,
&
pSD
);
ok
(
ret
==
ERROR_INVALID_HANDLE
,
"got error %lu
\n
"
,
ret
);
ret
=
GetSecurityInfo
((
HANDLE
)
0xdeadbeef
,
invalid_types
[
i
],
DACL_SECURITY_INFORMATION
,
NULL
,
NULL
,
NULL
,
NULL
,
&
pSD
);
todo_wine
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"got error %lu
\n
"
,
ret
);
ret
=
SetSecurityInfo
(
NULL
,
invalid_types
[
i
],
DACL_SECURITY_INFORMATION
,
NULL
,
NULL
,
pDacl
,
NULL
);
ok
(
ret
==
ERROR_INVALID_HANDLE
,
"got error %lu
\n
"
,
ret
);
ret
=
SetSecurityInfo
((
HANDLE
)
0xdeadbeef
,
invalid_types
[
i
],
DACL_SECURITY_INFORMATION
,
NULL
,
NULL
,
pDacl
,
NULL
);
todo_wine
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"got error %lu
\n
"
,
ret
);
winetest_pop_context
();
}
}
}
static
void
test_GetSidSubAuthority
(
void
)
static
void
test_GetSidSubAuthority
(
void
)
...
...
include/accctrl.h
View file @
39802508
...
@@ -39,7 +39,8 @@ typedef enum _SE_OBJECT_TYPE
...
@@ -39,7 +39,8 @@ typedef enum _SE_OBJECT_TYPE
SE_DS_OBJECT_ALL
,
SE_DS_OBJECT_ALL
,
SE_PROVIDER_DEFINED_OBJECT
,
SE_PROVIDER_DEFINED_OBJECT
,
SE_WMIGUID_OBJECT
,
SE_WMIGUID_OBJECT
,
SE_REGISTRY_WOW64_32KEY
SE_REGISTRY_WOW64_32KEY
,
SE_REGISTRY_WOW64_64KEY
,
}
SE_OBJECT_TYPE
;
}
SE_OBJECT_TYPE
;
typedef
enum
_TRUSTEE_TYPE
typedef
enum
_TRUSTEE_TYPE
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment