Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
c98513f9
Commit
c98513f9
authored
Apr 07, 2009
by
Ge van Geldorp
Committed by
Alexandre Julliard
Apr 07, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
secur32/tests: Add simple tests for GetUserNameExA/W().
parent
dcb3e52e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
0 deletions
+86
-0
secur32.c
dlls/secur32/tests/secur32.c
+86
-0
No files found.
dlls/secur32/tests/secur32.c
View file @
c98513f9
...
...
@@ -32,6 +32,8 @@ static HMODULE secdll;
static
BOOLEAN
(
WINAPI
*
pGetComputerObjectNameA
)(
EXTENDED_NAME_FORMAT
NameFormat
,
LPSTR
lpNameBuffer
,
PULONG
lpnSize
);
static
BOOLEAN
(
WINAPI
*
pGetComputerObjectNameW
)(
EXTENDED_NAME_FORMAT
NameFormat
,
LPWSTR
lpNameBuffer
,
PULONG
lpnSize
);
static
BOOLEAN
(
WINAPI
*
pGetUserNameExA
)(
EXTENDED_NAME_FORMAT
NameFormat
,
LPSTR
lpNameBuffer
,
PULONG
lpnSize
);
static
BOOLEAN
(
WINAPI
*
pGetUserNameExW
)(
EXTENDED_NAME_FORMAT
NameFormat
,
LPWSTR
lpNameBuffer
,
PULONG
lpnSize
);
static
PSecurityFunctionTableA
(
SEC_ENTRY
*
pInitSecurityInterfaceA
)(
void
);
static
PSecurityFunctionTableW
(
SEC_ENTRY
*
pInitSecurityInterfaceW
)(
void
);
...
...
@@ -94,6 +96,82 @@ static void testGetComputerObjectNameW(void)
}
}
static
void
testGetUserNameExA
(
void
)
{
char
name
[
256
];
ULONG
size
;
BOOLEAN
rc
;
int
i
;
for
(
i
=
0
;
i
<
(
sizeof
(
formats
)
/
sizeof
(
formats
[
0
]));
i
++
)
{
size
=
sizeof
(
name
);
ZeroMemory
(
name
,
sizeof
(
name
));
rc
=
pGetUserNameExA
(
formats
[
i
],
name
,
&
size
);
ok
(
rc
||
((
formats
[
i
]
==
NameUnknown
)
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
))
||
(
GetLastError
()
==
ERROR_CANT_ACCESS_DOMAIN_INFO
)
||
(
GetLastError
()
==
ERROR_NO_SUCH_DOMAIN
)
||
(
GetLastError
()
==
ERROR_NO_SUCH_USER
)
||
(
GetLastError
()
==
ERROR_NONE_MAPPED
)
||
(
GetLastError
()
==
ERROR_ACCESS_DENIED
),
"GetUserNameExA(%d) failed: %d
\n
"
,
formats
[
i
],
GetLastError
());
}
size
=
0
;
rc
=
pGetUserNameExA
(
NameSamCompatible
,
NULL
,
&
size
);
ok
(
!
rc
&&
GetLastError
()
==
ERROR_MORE_DATA
,
"Expected fail with ERROR_MORE_DATA, got %d with %u
\n
"
,
rc
,
GetLastError
());
ok
(
size
!=
0
,
"Expected size to be set to required size
\n
"
);
size
=
0
;
rc
=
pGetUserNameExA
(
NameSamCompatible
,
name
,
&
size
);
ok
(
!
rc
&&
GetLastError
()
==
ERROR_MORE_DATA
,
"Expected fail with ERROR_MORE_DATA, got %d with %u
\n
"
,
rc
,
GetLastError
());
ok
(
size
!=
0
,
"Expected size to be set to required size
\n
"
);
size
=
1
;
name
[
0
]
=
0xff
;
rc
=
pGetUserNameExA
(
NameSamCompatible
,
name
,
&
size
);
ok
(
!
rc
&&
GetLastError
()
==
ERROR_MORE_DATA
,
"Expected fail with ERROR_MORE_DATA, got %d with %u
\n
"
,
rc
,
GetLastError
());
ok
(
1
<
size
,
"Expected size to be set to required size
\n
"
);
ok
(
name
[
0
]
==
(
char
)
0xff
,
"Expected unchanged buffer
\n
"
);
}
static
void
testGetUserNameExW
(
void
)
{
WCHAR
nameW
[
256
];
ULONG
size
;
BOOLEAN
rc
;
int
i
;
for
(
i
=
0
;
i
<
(
sizeof
(
formats
)
/
sizeof
(
formats
[
0
]));
i
++
)
{
size
=
sizeof
(
nameW
);
ZeroMemory
(
nameW
,
sizeof
(
nameW
));
rc
=
pGetUserNameExW
(
formats
[
i
],
nameW
,
&
size
);
ok
(
rc
||
((
formats
[
i
]
==
NameUnknown
)
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
))
||
(
GetLastError
()
==
ERROR_CANT_ACCESS_DOMAIN_INFO
)
||
(
GetLastError
()
==
ERROR_NO_SUCH_DOMAIN
)
||
(
GetLastError
()
==
ERROR_NO_SUCH_USER
)
||
(
GetLastError
()
==
ERROR_NONE_MAPPED
)
||
(
GetLastError
()
==
ERROR_ACCESS_DENIED
),
"GetUserNameExW(%d) failed: %d
\n
"
,
formats
[
i
],
GetLastError
());
}
size
=
0
;
rc
=
pGetUserNameExW
(
NameSamCompatible
,
NULL
,
&
size
);
ok
(
!
rc
&&
GetLastError
()
==
ERROR_MORE_DATA
,
"Expected fail with ERROR_MORE_DATA, got %d with %u
\n
"
,
rc
,
GetLastError
());
ok
(
size
!=
0
,
"Expected size to be set to required size
\n
"
);
size
=
0
;
rc
=
pGetUserNameExW
(
NameSamCompatible
,
nameW
,
&
size
);
ok
(
!
rc
&&
GetLastError
()
==
ERROR_MORE_DATA
,
"Expected fail with ERROR_MORE_DATA, got %d with %u
\n
"
,
rc
,
GetLastError
());
ok
(
size
!=
0
,
"Expected size to be set to required size
\n
"
);
size
=
1
;
nameW
[
0
]
=
0xff
;
rc
=
pGetUserNameExW
(
NameSamCompatible
,
nameW
,
&
size
);
ok
(
!
rc
&&
GetLastError
()
==
ERROR_MORE_DATA
,
"Expected fail with ERROR_MORE_DATA, got %d with %u
\n
"
,
rc
,
GetLastError
());
ok
(
1
<
size
,
"Expected size to be set to required size
\n
"
);
ok
(
nameW
[
0
]
==
(
WCHAR
)
0xff
,
"Expected unchanged buffer
\n
"
);
}
static
void
test_InitSecurityInterface
(
void
)
{
PSecurityFunctionTableA
sftA
;
...
...
@@ -137,6 +215,8 @@ START_TEST(secur32)
{
pGetComputerObjectNameA
=
(
PVOID
)
GetProcAddress
(
secdll
,
"GetComputerObjectNameA"
);
pGetComputerObjectNameW
=
(
PVOID
)
GetProcAddress
(
secdll
,
"GetComputerObjectNameW"
);
pGetUserNameExA
=
(
PVOID
)
GetProcAddress
(
secdll
,
"GetUserNameExA"
);
pGetUserNameExW
=
(
PVOID
)
GetProcAddress
(
secdll
,
"GetUserNameExW"
);
pInitSecurityInterfaceA
=
(
PVOID
)
GetProcAddress
(
secdll
,
"InitSecurityInterfaceA"
);
pInitSecurityInterfaceW
=
(
PVOID
)
GetProcAddress
(
secdll
,
"InitSecurityInterfaceW"
);
...
...
@@ -146,6 +226,12 @@ START_TEST(secur32)
if
(
pGetComputerObjectNameW
)
testGetComputerObjectNameW
();
if
(
pGetUserNameExA
)
testGetUserNameExA
();
if
(
pGetUserNameExW
)
testGetUserNameExW
();
test_InitSecurityInterface
();
FreeLibrary
(
secdll
);
...
...
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