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
62e5b627
Commit
62e5b627
authored
Aug 07, 2008
by
Dan Hipschman
Committed by
Alexandre Julliard
Aug 18, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Implement GetSecurityInfo.
parent
790e6dcd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
2 deletions
+92
-2
security.c
dlls/advapi32/security.c
+60
-2
security.c
dlls/advapi32/tests/security.c
+32
-0
No files found.
dlls/advapi32/security.c
View file @
62e5b627
...
...
@@ -2710,6 +2710,22 @@ BOOL WINAPI PrivilegedServiceAuditAlarmW( LPCWSTR SubsystemName, LPCWSTR Service
/******************************************************************************
* GetSecurityInfo [ADVAPI32.@]
*
* Retrieves a copy of the security descriptor associated with an object.
*
* PARAMS
* hObject [I] A handle for the object.
* ObjectType [I] The type of object.
* SecurityInfo [I] A bitmask indicating what info to retrieve.
* ppsidOwner [O] If non-null, receives a pointer to the owner SID.
* ppsidGroup [O] If non-null, receives a pointer to the group SID.
* ppDacl [O] If non-null, receives a pointer to the DACL.
* ppSacl [O] If non-null, receives a pointer to the SACL.
* ppSecurityDescriptor [O] Receives a pointer to the security descriptor,
* which must be freed with LocalFree.
*
* RETURNS
* ERROR_SUCCESS if all's well, and a WIN32 error code otherwise.
*/
DWORD
WINAPI
GetSecurityInfo
(
HANDLE
hObject
,
SE_OBJECT_TYPE
ObjectType
,
...
...
@@ -2718,8 +2734,50 @@ DWORD WINAPI GetSecurityInfo(
PSECURITY_DESCRIPTOR
*
ppSecurityDescriptor
)
{
FIXME
(
"stub!
\n
"
);
return
ERROR_BAD_PROVIDER
;
PSECURITY_DESCRIPTOR
sd
;
NTSTATUS
status
;
ULONG
n1
,
n2
;
BOOL
present
,
defaulted
;
status
=
NtQuerySecurityObject
(
hObject
,
SecurityInfo
,
NULL
,
0
,
&
n1
);
if
(
status
!=
STATUS_BUFFER_TOO_SMALL
&&
status
!=
STATUS_SUCCESS
)
return
RtlNtStatusToDosError
(
status
);
sd
=
LocalAlloc
(
0
,
n1
);
if
(
!
sd
)
return
ERROR_NOT_ENOUGH_MEMORY
;
status
=
NtQuerySecurityObject
(
hObject
,
SecurityInfo
,
sd
,
n1
,
&
n2
);
if
(
status
!=
STATUS_SUCCESS
)
{
LocalFree
(
sd
);
return
RtlNtStatusToDosError
(
status
);
}
if
(
ppsidOwner
)
{
*
ppsidOwner
=
NULL
;
GetSecurityDescriptorOwner
(
sd
,
ppsidOwner
,
&
defaulted
);
}
if
(
ppsidGroup
)
{
*
ppsidGroup
=
NULL
;
GetSecurityDescriptorGroup
(
sd
,
ppsidGroup
,
&
defaulted
);
}
if
(
ppDacl
)
{
*
ppDacl
=
NULL
;
GetSecurityDescriptorDacl
(
sd
,
&
present
,
ppDacl
,
&
defaulted
);
}
if
(
ppSacl
)
{
*
ppSacl
=
NULL
;
GetSecurityDescriptorSacl
(
sd
,
&
present
,
ppSacl
,
&
defaulted
);
}
if
(
ppSecurityDescriptor
)
*
ppSecurityDescriptor
=
sd
;
return
ERROR_SUCCESS
;
}
/******************************************************************************
...
...
dlls/advapi32/tests/security.c
View file @
62e5b627
...
...
@@ -2483,6 +2483,37 @@ static void test_acls(void)
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"InitializeAcl(-1) failed with error %d
\n
"
,
GetLastError
());
}
static
void
test_GetSecurityInfo
(
void
)
{
HANDLE
obj
;
PSECURITY_DESCRIPTOR
sd
;
PSID
owner
,
group
;
PACL
dacl
;
DWORD
ret
;
/* Create something. Files have lots of associated security info. */
obj
=
CreateFile
(
myARGV
[
0
],
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
!
obj
)
{
skip
(
"Couldn't create an object for GetSecurityInfo test
\n
"
);
return
;
}
ret
=
GetSecurityInfo
(
obj
,
SE_FILE_OBJECT
,
OWNER_SECURITY_INFORMATION
|
GROUP_SECURITY_INFORMATION
|
DACL_SECURITY_INFORMATION
,
&
owner
,
&
group
,
&
dacl
,
NULL
,
&
sd
);
ok
(
ret
==
ERROR_SUCCESS
,
"GetSecurityInfo returned %d
\n
"
,
ret
);
ok
(
sd
!=
NULL
,
"GetSecurityInfo
\n
"
);
ok
(
owner
!=
NULL
,
"GetSecurityInfo
\n
"
);
ok
(
group
!=
NULL
,
"GetSecurityInfo
\n
"
);
ok
(
dacl
!=
NULL
,
"GetSecurityInfo
\n
"
);
ok
(
IsValidAcl
(
dacl
),
"GetSecurityInfo
\n
"
);
LocalFree
(
sd
);
CloseHandle
(
obj
);
}
START_TEST
(
security
)
{
init
();
...
...
@@ -2511,4 +2542,5 @@ START_TEST(security)
test_ConvertSecurityDescriptorToString
();
test_PrivateObjectSecurity
();
test_acls
();
test_GetSecurityInfo
();
}
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