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
ce6a7595
Commit
ce6a7595
authored
Mar 19, 2007
by
Kai Blin
Committed by
Alexandre Julliard
Mar 20, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netapi32: Add test for adding/deleting users.
parent
36d5515d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
1 deletion
+60
-1
access.c
dlls/netapi32/tests/access.c
+55
-1
lmaccess.h
include/lmaccess.h
+5
-0
No files found.
dlls/netapi32/tests/access.c
View file @
ce6a7595
...
...
@@ -20,7 +20,6 @@
#include <stdarg.h>
#include <wine/test.h>
#include <windef.h>
#include <winbase.h>
#include <winerror.h>
...
...
@@ -28,6 +27,8 @@
#include <lmerr.h>
#include <lmapibuf.h>
#include "wine/test.h"
WCHAR
user_name
[
UNLEN
+
1
];
WCHAR
computer_name
[
MAX_COMPUTERNAME_LENGTH
+
1
];
...
...
@@ -36,6 +37,9 @@ static const WCHAR sAdminUserName[] = {'A','d','m','i','n','i','s','t','r','a','
static
const
WCHAR
sGuestUserName
[]
=
{
'G'
,
'u'
,
'e'
,
's'
,
't'
,
0
};
static
const
WCHAR
sNonexistentUser
[]
=
{
'N'
,
'o'
,
'n'
,
'e'
,
'x'
,
'i'
,
's'
,
't'
,
'e'
,
'n'
,
't'
,
' '
,
'U'
,
's'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
sTestUserName
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'u'
,
's'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
sTestUserOldPass
[]
=
{
'o'
,
'l'
,
'd'
,
'p'
,
'a'
,
's'
,
's'
,
0
};
static
const
WCHAR
sTestUserNewPass
[]
=
{
'n'
,
'e'
,
'w'
,
'p'
,
'a'
,
's'
,
's'
,
0
};
static
const
WCHAR
sBadNetPath
[]
=
{
'\\'
,
'\\'
,
'B'
,
'a'
,
' '
,
' '
,
'p'
,
'a'
,
't'
,
'h'
,
0
};
static
const
WCHAR
sInvalidName
[]
=
{
'\\'
,
0
};
static
const
WCHAR
sInvalidName2
[]
=
{
'\\'
,
'\\'
,
0
};
...
...
@@ -46,6 +50,9 @@ static NET_API_STATUS (WINAPI *pNetApiBufferSize)(LPVOID,LPDWORD)=NULL;
static
NET_API_STATUS
(
WINAPI
*
pNetQueryDisplayInformation
)(
LPWSTR
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
LPDWORD
,
PVOID
*
)
=
NULL
;
static
NET_API_STATUS
(
WINAPI
*
pNetUserGetInfo
)(
LPCWSTR
,
LPCWSTR
,
DWORD
,
LPBYTE
*
)
=
NULL
;
static
NET_API_STATUS
(
WINAPI
*
pNetUserModalsGet
)(
LPCWSTR
,
DWORD
,
LPBYTE
*
)
=
NULL
;
static
NET_API_STATUS
(
WINAPI
*
pNetUserAdd
)(
LPCWSTR
,
DWORD
,
LPBYTE
,
LPDWORD
)
=
NULL
;
static
NET_API_STATUS
(
WINAPI
*
pNetUserChangePassword
)(
LPCWSTR
,
LPCWSTR
,
LPCWSTR
,
LPCWSTR
)
=
NULL
;
static
NET_API_STATUS
(
WINAPI
*
pNetUserDel
)(
LPCWSTR
,
LPCWSTR
)
=
NULL
;
static
int
init_access_tests
(
void
)
{
...
...
@@ -192,6 +199,49 @@ static void run_usermodalsget_tests(void)
pNetApiBufferFree
(
umi2
);
}
static
void
run_userhandling_tests
(
void
)
{
NET_API_STATUS
ret
;
USER_INFO_1
usri
;
if
(
!
pNetUserAdd
||
!
pNetUserChangePassword
||
!
pNetUserDel
)
{
skip
(
"Functions for modifying the user database missing. Skipping test.
\n
"
);
return
;
}
usri
.
usri1_name
=
(
LPWSTR
)
sTestUserName
;
usri
.
usri1_password
=
(
LPWSTR
)
sTestUserOldPass
;
usri
.
usri1_priv
=
USER_PRIV_USER
;
usri
.
usri1_home_dir
=
NULL
;
usri
.
usri1_comment
=
NULL
;
usri
.
usri1_flags
=
UF_SCRIPT
;
usri
.
usri1_script_path
=
NULL
;
ret
=
pNetUserAdd
(
NULL
,
1
,
(
LPBYTE
)
&
usri
,
NULL
);
if
(
ret
==
ERROR_ACCESS_DENIED
)
{
skip
(
"Insufficient permissions to add users. Skipping test.
\n
"
);
return
;
}
if
(
ret
==
NERR_UserExists
)
{
skip
(
"User already exists, skipping test to not mess up the system
\n
"
);
return
;
}
ok
(
ret
==
NERR_Success
,
"Adding user failed with error 0x%08x
\n
"
,
ret
);
if
(
ret
!=
NERR_Success
)
return
;
ret
=
pNetUserChangePassword
(
NULL
,
sTestUserName
,
sTestUserOldPass
,
sTestUserNewPass
);
todo_wine
ok
(
ret
==
NERR_Success
,
"Changing the password failed.
\n
"
);
ret
=
pNetUserDel
(
NULL
,
sTestUserName
);
todo_wine
ok
(
ret
==
NERR_Success
,
"Deleting the user failed.
\n
"
);
}
START_TEST
(
access
)
{
HMODULE
hnetapi32
=
LoadLibraryA
(
"netapi32.dll"
);
...
...
@@ -200,6 +250,9 @@ START_TEST(access)
pNetQueryDisplayInformation
=
(
void
*
)
GetProcAddress
(
hnetapi32
,
"NetQueryDisplayInformation"
);
pNetUserGetInfo
=
(
void
*
)
GetProcAddress
(
hnetapi32
,
"NetUserGetInfo"
);
pNetUserModalsGet
=
(
void
*
)
GetProcAddress
(
hnetapi32
,
"NetUserModalsGet"
);
pNetUserAdd
=
(
void
*
)
GetProcAddress
(
hnetapi32
,
"NetUserAdd"
);
pNetUserChangePassword
=
(
void
*
)
GetProcAddress
(
hnetapi32
,
"NetUserChangePassword"
);
pNetUserDel
=
(
void
*
)
GetProcAddress
(
hnetapi32
,
"NetUserDel"
);
if
(
!
pNetApiBufferSize
)
trace
(
"It appears there is no netapi32 functionality on this platform
\n
"
);
...
...
@@ -208,5 +261,6 @@ START_TEST(access)
run_usergetinfo_tests
();
run_querydisplayinformation1_tests
();
run_usermodalsget_tests
();
run_userhandling_tests
();
}
}
include/lmaccess.h
View file @
ce6a7595
...
...
@@ -440,6 +440,11 @@ typedef struct _LOCALGROUP_USERS_INFO_0 {
LPWSTR
lgrui0_name
;
}
LOCALGROUP_USERS_INFO_0
,
*
PLOCALGROUP_USERS_INFO_0
,
*
LPLOCALGROUP_USERS_INFO_0
;
#define USER_PRIV_GUEST 0
#define USER_PRIV_USER 1
#define USER_PRIV_ADMIN 2
#define USER_PRIV_MASK 3
#define LOCALGROUP_NAME_PARMNUM 1
#define LOCALGROUP_COMMENT_PARMNUM 2
...
...
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