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
20213e49
Commit
20213e49
authored
Jul 02, 2008
by
Kai Blin
Committed by
Alexandre Julliard
Jul 03, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netapi32: Make sure NetUserGetInfo can find the current user.
parent
bdf180d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
access.c
dlls/netapi32/access.c
+29
-1
access.c
dlls/netapi32/tests/access.c
+5
-0
No files found.
dlls/netapi32/access.c
View file @
20213e49
...
...
@@ -105,6 +105,34 @@ static struct sam_user* NETAPI_FindUser(LPCWSTR UserName)
return
NULL
;
}
static
BOOL
NETAPI_IsCurrentUser
(
LPCWSTR
username
)
{
LPWSTR
curr_user
=
NULL
;
DWORD
dwSize
;
BOOL
ret
=
FALSE
;
dwSize
=
LM20_UNLEN
+
1
;
curr_user
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwSize
);
if
(
!
curr_user
)
{
ERR
(
"Failed to allocate memory for user name.
\n
"
);
goto
end
;
}
if
(
!
GetUserNameW
(
curr_user
,
&
dwSize
))
{
ERR
(
"Failed to get current user's user name.
\n
"
);
goto
end
;
}
if
(
!
lstrcmpW
(
curr_user
,
username
))
{
ret
=
TRUE
;
}
end:
HeapFree
(
GetProcessHeap
(),
0
,
curr_user
);
return
ret
;
}
/************************************************************
* NetUserAdd (NETAPI32.@)
*/
...
...
@@ -226,7 +254,7 @@ NetUserGetInfo(LPCWSTR servername, LPCWSTR username, DWORD level,
return
NERR_InvalidComputer
;
}
if
(
!
NETAPI_FindUser
(
username
))
if
(
!
NETAPI_FindUser
(
username
)
&&
!
NETAPI_IsCurrentUser
(
username
)
)
{
TRACE
(
"User %s is unknown.
\n
"
,
debugstr_w
(
username
));
return
NERR_UserNotFound
;
...
...
dlls/netapi32/tests/access.c
View file @
20213e49
...
...
@@ -142,6 +142,11 @@ static void run_usergetinfo_tests(void)
pNetApiBufferFree
(
ui0
);
pNetApiBufferFree
(
ui10
);
/* NetUserGetInfo should always work for the current user. */
rc
=
pNetUserGetInfo
(
NULL
,
user_name
,
0
,
(
LPBYTE
*
)
&
ui0
);
ok
(
rc
==
NERR_Success
,
"NetUsetGetInfo for current user failed: 0x%08x.
\n
"
,
rc
);
pNetApiBufferFree
(
ui0
);
/* errors handling */
rc
=
pNetUserGetInfo
(
NULL
,
sTestUserName
,
10000
,
(
LPBYTE
*
)
&
ui0
);
ok
(
rc
==
ERROR_INVALID_LEVEL
,
"Invalid Level: rc=%d
\n
"
,
rc
);
...
...
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