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
adf48a3c
Commit
adf48a3c
authored
Nov 15, 2005
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Nov 15, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for RtlAllocateAndInitializeSid, make it pass under Wine.
parent
96e15748
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
26 deletions
+51
-26
sec.c
dlls/ntdll/sec.c
+26
-26
rtl.c
dlls/ntdll/tests/rtl.c
+25
-0
No files found.
dlls/ntdll/sec.c
View file @
adf48a3c
...
...
@@ -135,41 +135,41 @@ NTSTATUS WINAPI RtlAllocateAndInitializeSid (
DWORD
nSubAuthority6
,
DWORD
nSubAuthority7
,
PSID
*
pSid
)
{
SID
*
tmp_sid
;
TRACE
(
"(%p, 0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p)
\n
"
,
TRACE
(
"(%p, 0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p)
\n
"
,
pIdentifierAuthority
,
nSubAuthorityCount
,
nSubAuthority0
,
nSubAuthority1
,
nSubAuthority2
,
nSubAuthority3
,
nSubAuthority4
,
nSubAuthority5
,
nSubAuthority6
,
nSubAuthority7
,
pSid
);
if
(
!
(
*
pSid
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
RtlLengthRequiredSid
(
nSubAuthorityCount
))))
return
STATUS_NO_MEMORY
;
if
(
nSubAuthorityCount
>
8
)
return
STATUS_INVALID_SID
;
((
SID
*
)
*
pSid
)
->
Revision
=
SID_REVISION
;
if
(
!
(
tmp_sid
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
RtlLengthRequiredSid
(
nSubAuthorityCount
))))
return
STATUS_NO_MEMORY
;
if
(
pIdentifierAuthority
)
memcpy
(
&
((
SID
*
)
*
pSid
)
->
IdentifierAuthority
,
pIdentifierAuthority
,
sizeof
(
SID_IDENTIFIER_AUTHORITY
));
*
RtlSubAuthorityCountSid
(
*
pSid
)
=
nSubAuthorityCount
;
if
(
nSubAuthorityCount
>
0
)
*
RtlSubAuthoritySid
(
*
pSid
,
0
)
=
nSubAuthority0
;
if
(
nSubAuthorityCount
>
1
)
*
RtlSubAuthoritySid
(
*
pSid
,
1
)
=
nSubAuthority1
;
if
(
nSubAuthorityCount
>
2
)
*
RtlSubAuthoritySid
(
*
pSid
,
2
)
=
nSubAuthority2
;
if
(
nSubAuthorityCount
>
3
)
*
RtlSubAuthoritySid
(
*
pSid
,
3
)
=
nSubAuthority3
;
if
(
nSubAuthorityCount
>
4
)
*
RtlSubAuthoritySid
(
*
pSid
,
4
)
=
nSubAuthority4
;
if
(
nSubAuthorityCount
>
5
)
*
RtlSubAuthoritySid
(
*
pSid
,
5
)
=
nSubAuthority5
;
if
(
nSubAuthorityCount
>
6
)
*
RtlSubAuthoritySid
(
*
pSid
,
6
)
=
nSubAuthority6
;
if
(
nSubAuthorityCount
>
7
)
*
RtlSubAuthoritySid
(
*
pSid
,
7
)
=
nSubAuthority7
;
tmp_sid
->
Revision
=
SID_REVISION
;
return
STATUS_SUCCESS
;
if
(
pIdentifierAuthority
)
memcpy
(
&
tmp_sid
->
IdentifierAuthority
,
pIdentifierAuthority
,
sizeof
(
SID_IDENTIFIER_AUTHORITY
));
tmp_sid
->
SubAuthorityCount
=
nSubAuthorityCount
;
switch
(
nSubAuthorityCount
)
{
case
8
:
tmp_sid
->
SubAuthority
[
7
]
=
nSubAuthority7
;
case
7
:
tmp_sid
->
SubAuthority
[
6
]
=
nSubAuthority6
;
case
6
:
tmp_sid
->
SubAuthority
[
5
]
=
nSubAuthority5
;
case
5
:
tmp_sid
->
SubAuthority
[
4
]
=
nSubAuthority4
;
case
4
:
tmp_sid
->
SubAuthority
[
3
]
=
nSubAuthority3
;
case
3
:
tmp_sid
->
SubAuthority
[
2
]
=
nSubAuthority2
;
case
2
:
tmp_sid
->
SubAuthority
[
1
]
=
nSubAuthority1
;
case
1
:
tmp_sid
->
SubAuthority
[
0
]
=
nSubAuthority0
;
break
;
}
*
pSid
=
tmp_sid
;
return
STATUS_SUCCESS
;
}
/******************************************************************************
* RtlEqualSid [NTDLL.@]
*
...
...
dlls/ntdll/tests/rtl.c
View file @
adf48a3c
...
...
@@ -64,6 +64,8 @@ static BOOLEAN (WINAPI * pRtlIsValidIndexHandle)(const RTL_HANDLE_TABLE *, ULO
static
NTSTATUS
(
WINAPI
*
pRtlDestroyHandleTable
)(
RTL_HANDLE_TABLE
*
);
static
RTL_HANDLE
*
(
WINAPI
*
pRtlAllocateHandle
)(
RTL_HANDLE_TABLE
*
,
ULONG
*
);
static
BOOLEAN
(
WINAPI
*
pRtlFreeHandle
)(
RTL_HANDLE_TABLE
*
,
RTL_HANDLE
*
);
static
NTSTATUS
(
WINAPI
*
pRtlAllocateAndInitializeSid
)(
PSID_IDENTIFIER_AUTHORITY
,
BYTE
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
PSID
*
);
static
NTSTATUS
(
WINAPI
*
pRtlFreeSid
)(
PSID
);
#define LEN 16
static
const
char
*
src_src
=
"This is a test!"
;
/* 16 bytes long, incl NUL */
static
ULONG
src_aligned_block
[
4
];
...
...
@@ -93,6 +95,8 @@ static void InitFunctionPtrs(void)
pRtlDestroyHandleTable
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlDestroyHandleTable"
);
pRtlAllocateHandle
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlAllocateHandle"
);
pRtlFreeHandle
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlFreeHandle"
);
pRtlAllocateAndInitializeSid
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlAllocateAndInitializeSid"
);
pRtlFreeSid
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlFreeSid"
);
}
strcpy
((
char
*
)
src_aligned_block
,
src_src
);
ok
(
strlen
(
src
)
==
15
,
"Source must be 16 bytes long!
\n
"
);
...
...
@@ -878,6 +882,25 @@ static void test_HandleTables(void)
ok
(
status
==
STATUS_SUCCESS
,
"RtlDestroyHandleTable failed with error 0x%08lx
\n
"
,
status
);
}
static
void
test_RtlAllocateAndInitializeSid
(
void
)
{
NTSTATUS
ret
;
SID_IDENTIFIER_AUTHORITY
sia
=
{{
1
,
2
,
3
,
4
,
5
,
6
}};
PSID
psid
;
ret
=
pRtlAllocateAndInitializeSid
(
&
sia
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
&
psid
);
ok
(
!
ret
,
"RtlAllocateAndInitializeSid error %08lx
\n
"
,
ret
);
ret
=
pRtlFreeSid
(
psid
);
ok
(
!
ret
,
"RtlFreeSid error %08lx
\n
"
,
ret
);
/* these tests crash on XP
ret = pRtlAllocateAndInitializeSid(NULL, 0, 1, 2, 3, 4, 5, 6, 7, 8, &psid);
ret = pRtlAllocateAndInitializeSid(&sia, 0, 1, 2, 3, 4, 5, 6, 7, 8, NULL);*/
ret
=
pRtlAllocateAndInitializeSid
(
&
sia
,
9
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
&
psid
);
ok
(
ret
==
STATUS_INVALID_SID
,
"wrong error %08lx
\n
"
,
ret
);
}
START_TEST
(
rtl
)
{
InitFunctionPtrs
();
...
...
@@ -908,4 +931,6 @@ START_TEST(rtl)
test_RtlComputeCrc32
();
if
(
pRtlInitializeHandleTable
)
test_HandleTables
();
if
(
pRtlAllocateAndInitializeSid
)
test_RtlAllocateAndInitializeSid
();
}
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