Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
011c5b8f
Commit
011c5b8f
authored
Jun 27, 2009
by
Louis Lenders
Committed by
Alexandre Julliard
Jun 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Add a few tests for GetSidSubAuthority and SetLastError correctly.
parent
0ca3b3b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
0 deletions
+37
-0
security.c
dlls/advapi32/security.c
+2
-0
security.c
dlls/advapi32/tests/security.c
+35
-0
No files found.
dlls/advapi32/security.c
View file @
011c5b8f
...
@@ -1073,6 +1073,7 @@ GetSidIdentifierAuthority( PSID pSid )
...
@@ -1073,6 +1073,7 @@ GetSidIdentifierAuthority( PSID pSid )
PDWORD
WINAPI
PDWORD
WINAPI
GetSidSubAuthority
(
PSID
pSid
,
DWORD
nSubAuthority
)
GetSidSubAuthority
(
PSID
pSid
,
DWORD
nSubAuthority
)
{
{
SetLastError
(
ERROR_SUCCESS
);
return
RtlSubAuthoritySid
(
pSid
,
nSubAuthority
);
return
RtlSubAuthoritySid
(
pSid
,
nSubAuthority
);
}
}
...
@@ -1085,6 +1086,7 @@ GetSidSubAuthority( PSID pSid, DWORD nSubAuthority )
...
@@ -1085,6 +1086,7 @@ GetSidSubAuthority( PSID pSid, DWORD nSubAuthority )
PUCHAR
WINAPI
PUCHAR
WINAPI
GetSidSubAuthorityCount
(
PSID
pSid
)
GetSidSubAuthorityCount
(
PSID
pSid
)
{
{
SetLastError
(
ERROR_SUCCESS
);
return
RtlSubAuthorityCountSid
(
pSid
);
return
RtlSubAuthorityCountSid
(
pSid
);
}
}
...
...
dlls/advapi32/tests/security.c
View file @
011c5b8f
...
@@ -92,6 +92,9 @@ typedef BOOL (WINAPI *fnSetFileSecurityA)(LPCSTR, SECURITY_INFORMATION,
...
@@ -92,6 +92,9 @@ typedef BOOL (WINAPI *fnSetFileSecurityA)(LPCSTR, SECURITY_INFORMATION,
static
DWORD
(
WINAPI
*
pGetNamedSecurityInfoA
)(
LPSTR
,
SE_OBJECT_TYPE
,
SECURITY_INFORMATION
,
static
DWORD
(
WINAPI
*
pGetNamedSecurityInfoA
)(
LPSTR
,
SE_OBJECT_TYPE
,
SECURITY_INFORMATION
,
PSID
*
,
PSID
*
,
PACL
*
,
PACL
*
,
PSID
*
,
PSID
*
,
PACL
*
,
PACL
*
,
PSECURITY_DESCRIPTOR
*
);
PSECURITY_DESCRIPTOR
*
);
static
PDWORD
(
WINAPI
*
pGetSidSubAuthority
)(
PSID
,
DWORD
);
static
PUCHAR
(
WINAPI
*
pGetSidSubAuthorityCount
)(
PSID
);
static
BOOL
(
WINAPI
*
pIsValidSid
)(
PSID
);
typedef
DWORD
(
WINAPI
*
fnRtlAdjustPrivilege
)(
ULONG
,
BOOLEAN
,
BOOLEAN
,
PBOOLEAN
);
typedef
DWORD
(
WINAPI
*
fnRtlAdjustPrivilege
)(
ULONG
,
BOOLEAN
,
BOOLEAN
,
PBOOLEAN
);
typedef
BOOL
(
WINAPI
*
fnCreateWellKnownSid
)(
WELL_KNOWN_SID_TYPE
,
PSID
,
PSID
,
DWORD
*
);
typedef
BOOL
(
WINAPI
*
fnCreateWellKnownSid
)(
WELL_KNOWN_SID_TYPE
,
PSID
,
PSID
,
DWORD
*
);
typedef
BOOL
(
WINAPI
*
fnDuplicateTokenEx
)(
HANDLE
,
DWORD
,
LPSECURITY_ATTRIBUTES
,
typedef
BOOL
(
WINAPI
*
fnDuplicateTokenEx
)(
HANDLE
,
DWORD
,
LPSECURITY_ATTRIBUTES
,
...
@@ -160,6 +163,9 @@ static void init(void)
...
@@ -160,6 +163,9 @@ static void init(void)
pSetFileSecurityA
=
(
fnSetFileSecurityA
)
GetProcAddress
(
hmod
,
"SetFileSecurityA"
);
pSetFileSecurityA
=
(
fnSetFileSecurityA
)
GetProcAddress
(
hmod
,
"SetFileSecurityA"
);
pCreateWellKnownSid
=
(
fnCreateWellKnownSid
)
GetProcAddress
(
hmod
,
"CreateWellKnownSid"
);
pCreateWellKnownSid
=
(
fnCreateWellKnownSid
)
GetProcAddress
(
hmod
,
"CreateWellKnownSid"
);
pGetNamedSecurityInfoA
=
(
void
*
)
GetProcAddress
(
hmod
,
"GetNamedSecurityInfoA"
);
pGetNamedSecurityInfoA
=
(
void
*
)
GetProcAddress
(
hmod
,
"GetNamedSecurityInfoA"
);
pGetSidSubAuthority
=
(
void
*
)
GetProcAddress
(
hmod
,
"GetSidSubAuthority"
);
pGetSidSubAuthorityCount
=
(
void
*
)
GetProcAddress
(
hmod
,
"GetSidSubAuthorityCount"
);
pIsValidSid
=
(
void
*
)
GetProcAddress
(
hmod
,
"IsValidSid"
);
pMakeSelfRelativeSD
=
(
void
*
)
GetProcAddress
(
hmod
,
"MakeSelfRelativeSD"
);
pMakeSelfRelativeSD
=
(
void
*
)
GetProcAddress
(
hmod
,
"MakeSelfRelativeSD"
);
pSetEntriesInAclW
=
(
void
*
)
GetProcAddress
(
hmod
,
"SetEntriesInAclW"
);
pSetEntriesInAclW
=
(
void
*
)
GetProcAddress
(
hmod
,
"SetEntriesInAclW"
);
pSetSecurityDescriptorControl
=
(
void
*
)
GetProcAddress
(
hmod
,
"SetSecurityDescriptorControl"
);
pSetSecurityDescriptorControl
=
(
void
*
)
GetProcAddress
(
hmod
,
"SetSecurityDescriptorControl"
);
...
@@ -3176,6 +3182,34 @@ static void test_GetSecurityInfo(void)
...
@@ -3176,6 +3182,34 @@ static void test_GetSecurityInfo(void)
CloseHandle
(
obj
);
CloseHandle
(
obj
);
}
}
static
void
test_GetSidSubAuthority
(
void
)
{
PSID
psid
=
NULL
;
if
(
!
pGetSidSubAuthority
||
!
pConvertStringSidToSidA
||
!
pIsValidSid
||
!
pGetSidSubAuthorityCount
)
{
win_skip
(
"Some functions not available
\n
"
);
return
;
}
/* Note: on windows passing in an invalid index like -1, lets GetSidSubAuthority return 0x05000000 but
still GetLastError returns ERROR_SUCCESS then. We don't test these unlikely cornercases here for now */
ok
(
pConvertStringSidToSidA
(
"S-1-5-21-93476-23408-4576"
,
&
psid
),
"ConvertStringSidToSidA failed
\n
"
);
ok
(
pIsValidSid
(
psid
),
"Sid is not valid
\n
"
);
SetLastError
(
0xbebecaca
);
ok
(
*
pGetSidSubAuthorityCount
(
psid
)
==
4
,
"GetSidSubAuthorityCount gave %d expected 4
\n
"
,
*
pGetSidSubAuthorityCount
(
psid
));
ok
(
GetLastError
()
==
0
,
"GetLastError returned %d instead of 0
\n
"
,
GetLastError
());
SetLastError
(
0xbebecaca
);
ok
(
*
pGetSidSubAuthority
(
psid
,
0
)
==
21
,
"GetSidSubAuthority gave %d expected 21"
,
*
pGetSidSubAuthority
(
psid
,
0
));
ok
(
GetLastError
()
==
0
,
"GetLastError returned %d instead of 0
\n
"
,
GetLastError
());
SetLastError
(
0xbebecaca
);
ok
(
*
pGetSidSubAuthority
(
psid
,
1
)
==
93476
,
"GetSidSubAuthority gave %d expected 93476"
,
*
pGetSidSubAuthority
(
psid
,
1
));
ok
(
GetLastError
()
==
0
,
"GetLastError returned %d instead of 0
\n
"
,
GetLastError
());
SetLastError
(
0xbebecaca
);
todo_wine
ok
(
*
pGetSidSubAuthority
(
psid
,
4
)
==
0
,
"GetSidSubAuthority gave %d,expected 0
\n
"
,
*
pGetSidSubAuthority
(
psid
,
4
));
ok
(
GetLastError
()
==
0
,
"GetLastError returned %d instead of 0
\n
"
,
GetLastError
());
LocalFree
(
psid
);
}
START_TEST
(
security
)
START_TEST
(
security
)
{
{
init
();
init
();
...
@@ -3205,4 +3239,5 @@ START_TEST(security)
...
@@ -3205,4 +3239,5 @@ START_TEST(security)
test_PrivateObjectSecurity
();
test_PrivateObjectSecurity
();
test_acls
();
test_acls
();
test_GetSecurityInfo
();
test_GetSecurityInfo
();
test_GetSidSubAuthority
();
}
}
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