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
ca80c55a
Commit
ca80c55a
authored
Aug 19, 2006
by
Robert Reif
Committed by
Alexandre Julliard
Aug 21, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: LookupAccountSid buffer size query tests.
parent
39b77ec5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
2 deletions
+54
-2
security.c
dlls/advapi32/tests/security.c
+54
-2
No files found.
dlls/advapi32/tests/security.c
View file @
ca80c55a
...
@@ -880,6 +880,7 @@ static void test_LookupAccountSid(void)
...
@@ -880,6 +880,7 @@ static void test_LookupAccountSid(void)
SID_IDENTIFIER_AUTHORITY
SIDAuthNT
=
{
SECURITY_NT_AUTHORITY
};
SID_IDENTIFIER_AUTHORITY
SIDAuthNT
=
{
SECURITY_NT_AUTHORITY
};
char
account
[
MAX_PATH
],
domain
[
MAX_PATH
];
char
account
[
MAX_PATH
],
domain
[
MAX_PATH
];
DWORD
acc_size
,
dom_size
;
DWORD
acc_size
,
dom_size
;
DWORD
real_acc_size
,
real_dom_size
;
PSID
pUsersSid
=
NULL
;
PSID
pUsersSid
=
NULL
;
SID_NAME_USE
use
;
SID_NAME_USE
use
;
BOOL
ret
;
BOOL
ret
;
...
@@ -899,18 +900,69 @@ static void test_LookupAccountSid(void)
...
@@ -899,18 +900,69 @@ static void test_LookupAccountSid(void)
if
(
!
ret
&&
(
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
))
if
(
!
ret
&&
(
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
))
return
;
return
;
real_acc_size
=
MAX_PATH
;
real_dom_size
=
MAX_PATH
;
ret
=
LookupAccountSidA
(
NULL
,
pUsersSid
,
account
,
&
real_acc_size
,
domain
,
&
real_dom_size
,
&
use
);
ok
(
ret
,
"LookupAccountSid() Expected TRUE, got FALSE
\n
"
);
/* try NULL account */
/* try NULL account */
acc_size
=
MAX_PATH
;
acc_size
=
MAX_PATH
;
dom_size
=
MAX_PATH
;
dom_size
=
MAX_PATH
;
ret
=
LookupAccountSid
(
NULL
,
pUsersSid
,
NULL
,
&
acc_size
,
domain
,
&
dom_size
,
&
use
);
ret
=
LookupAccountSid
A
(
NULL
,
pUsersSid
,
NULL
,
&
acc_size
,
domain
,
&
dom_size
,
&
use
);
ok
(
ret
,
"LookupAccountSid() Expected TRUE, got FALSE
\n
"
);
ok
(
ret
,
"LookupAccountSid() Expected TRUE, got FALSE
\n
"
);
/* try NULL domain */
/* try NULL domain */
acc_size
=
MAX_PATH
;
acc_size
=
MAX_PATH
;
dom_size
=
MAX_PATH
;
dom_size
=
MAX_PATH
;
ret
=
LookupAccountSid
(
NULL
,
pUsersSid
,
account
,
&
acc_size
,
NULL
,
&
dom_size
,
&
use
);
ret
=
LookupAccountSid
A
(
NULL
,
pUsersSid
,
account
,
&
acc_size
,
NULL
,
&
dom_size
,
&
use
);
ok
(
ret
,
"LookupAccountSid() Expected TRUE, got FALSE
\n
"
);
ok
(
ret
,
"LookupAccountSid() Expected TRUE, got FALSE
\n
"
);
/* try a small account buffer */
acc_size
=
1
;
dom_size
=
MAX_PATH
;
account
[
0
]
=
0
;
ret
=
LookupAccountSidA
(
NULL
,
pUsersSid
,
account
,
&
acc_size
,
domain
,
&
dom_size
,
&
use
);
ok
(
!
ret
,
"LookupAccountSid() Expected FALSE got TRUE
\n
"
);
ok
(
GetLastError
()
==
ERROR_NOT_ENOUGH_MEMORY
,
"LookupAccountSid() Expected ERROR_NOT_ENOUGH_MEMORY, got %lu
\n
"
,
GetLastError
());
/* try a 0 sized account buffer */
acc_size
=
0
;
dom_size
=
MAX_PATH
;
account
[
0
]
=
0
;
ret
=
LookupAccountSidA
(
NULL
,
pUsersSid
,
account
,
&
acc_size
,
domain
,
&
dom_size
,
&
use
);
/* this can fail or succeed depending on OS version but the size will always be returned */
ok
(
acc_size
==
real_acc_size
,
"LookupAccountSid() Expected acc_size = %lu, got %lu
\n
"
,
real_acc_size
,
acc_size
);
/* try a 0 sized account buffer */
acc_size
=
0
;
dom_size
=
MAX_PATH
;
ret
=
LookupAccountSidA
(
NULL
,
pUsersSid
,
NULL
,
&
acc_size
,
domain
,
&
dom_size
,
&
use
);
/* this can fail or succeed depending on OS version but the size will always be returned */
ok
(
acc_size
==
real_acc_size
,
"LookupAccountSid() Expected acc_size = %lu, got %lu
\n
"
,
real_acc_size
,
acc_size
);
/* try a small domain buffer */
dom_size
=
1
;
acc_size
=
MAX_PATH
;
account
[
0
]
=
0
;
ret
=
LookupAccountSidA
(
NULL
,
pUsersSid
,
account
,
&
acc_size
,
domain
,
&
dom_size
,
&
use
);
ok
(
!
ret
,
"LookupAccountSid() Expected FALSE got TRUE
\n
"
);
ok
(
GetLastError
()
==
ERROR_NOT_ENOUGH_MEMORY
,
"LookupAccountSid() Expected ERROR_NOT_ENOUGH_MEMORY, got %lu
\n
"
,
GetLastError
());
/* try a 0 sized domain buffer */
dom_size
=
0
;
acc_size
=
MAX_PATH
;
account
[
0
]
=
0
;
ret
=
LookupAccountSidA
(
NULL
,
pUsersSid
,
account
,
&
acc_size
,
domain
,
&
dom_size
,
&
use
);
/* this can fail or succeed depending on OS version but the size will always be returned */
ok
(
dom_size
==
real_dom_size
,
"LookupAccountSid() Expected dom_size = %lu, got %lu
\n
"
,
real_dom_size
,
dom_size
);
/* try a 0 sized domain buffer */
dom_size
=
0
;
acc_size
=
MAX_PATH
;
ret
=
LookupAccountSidA
(
NULL
,
pUsersSid
,
account
,
&
acc_size
,
NULL
,
&
dom_size
,
&
use
);
/* this can fail or succeed depending on OS version but the size will always be returned */
ok
(
acc_size
==
real_acc_size
,
"LookupAccountSid() Expected dom_size = %lu, got %lu
\n
"
,
real_dom_size
,
dom_size
);
pCreateWellKnownSid
=
(
fnCreateWellKnownSid
)
GetProcAddress
(
hmod
,
"CreateWellKnownSid"
);
pCreateWellKnownSid
=
(
fnCreateWellKnownSid
)
GetProcAddress
(
hmod
,
"CreateWellKnownSid"
);
if
(
pCreateWellKnownSid
&&
pConvertSidToStringSidA
)
if
(
pCreateWellKnownSid
&&
pConvertSidToStringSidA
)
...
...
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