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
7b55bc45
Commit
7b55bc45
authored
Apr 30, 2003
by
Juan Lang
Committed by
Alexandre Julliard
Apr 30, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better API compliance and test case for NetWkstaTransportEnum.
parent
86666c51
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
2 deletions
+61
-2
wksta.c
dlls/netapi32/tests/wksta.c
+52
-0
wksta.c
dlls/netapi32/wksta.c
+9
-2
No files found.
dlls/netapi32/tests/wksta.c
View file @
7b55bc45
...
...
@@ -31,6 +31,8 @@ static NET_API_STATUS (WINAPI *pNetApiBufferFree)(LPVOID)=NULL;
static
NET_API_STATUS
(
WINAPI
*
pNetApiBufferSize
)(
LPVOID
,
LPDWORD
)
=
NULL
;
static
NET_API_STATUS
(
WINAPI
*
pNetpGetComputerName
)(
LPWSTR
*
)
=
NULL
;
static
NET_API_STATUS
(
WINAPI
*
pNetWkstaUserGetInfo
)(
LPWSTR
,
DWORD
,
PBYTE
*
)
=
NULL
;
static
NET_API_STATUS
(
WINAPI
*
pNetWkstaTransportEnum
)(
LPWSTR
,
DWORD
,
LPBYTE
*
,
DWORD
,
LPDWORD
,
LPDWORD
,
LPDWORD
)
=
NULL
;
WCHAR
user_name
[
UNLEN
+
1
];
WCHAR
computer_name
[
MAX_COMPUTERNAME_LENGTH
+
1
];
...
...
@@ -116,6 +118,54 @@ static void run_wkstausergetinfo_tests(void)
"Invalid level"
);
}
static
void
run_wkstatransportenum_tests
(
void
)
{
LPBYTE
bufPtr
;
NET_API_STATUS
apiReturn
;
DWORD
entriesRead
,
totalEntries
;
if
(
!
pNetWkstaTransportEnum
)
return
;
/* 1st check: is param 2 (level) correct? (only if param 5 passed?) */
apiReturn
=
pNetWkstaTransportEnum
(
NULL
,
1
,
NULL
,
MAX_PREFERRED_LENGTH
,
NULL
,
&
totalEntries
,
NULL
);
ok
(
apiReturn
==
ERROR_INVALID_LEVEL
,
"Invalid level"
);
/* 2nd check: is param 5 passed? (only if level passes?) */
apiReturn
=
pNetWkstaTransportEnum
(
NULL
,
0
,
NULL
,
MAX_PREFERRED_LENGTH
,
NULL
,
&
totalEntries
,
NULL
);
/* if no network adapter present, bail, the rest of the test will fail */
if
(
apiReturn
==
ERROR_NETWORK_UNREACHABLE
)
return
;
ok
(
apiReturn
==
STATUS_ACCESS_VIOLATION
,
"access violation"
);
/* 3rd check: is param 3 passed? */
apiReturn
=
pNetWkstaTransportEnum
(
NULL
,
0
,
NULL
,
MAX_PREFERRED_LENGTH
,
NULL
,
NULL
,
NULL
);
ok
(
apiReturn
==
STATUS_ACCESS_VIOLATION
,
"STATUS_ACCESS_VIOLATION"
);
/* 4th check: is param 6 passed? */
apiReturn
=
pNetWkstaTransportEnum
(
NULL
,
0
,
&
bufPtr
,
MAX_PREFERRED_LENGTH
,
&
entriesRead
,
NULL
,
NULL
);
ok
(
apiReturn
==
RPC_X_NULL_REF_POINTER
,
"null pointer"
);
/* final check: valid return, actually get data back */
apiReturn
=
pNetWkstaTransportEnum
(
NULL
,
0
,
&
bufPtr
,
MAX_PREFERRED_LENGTH
,
&
entriesRead
,
&
totalEntries
,
NULL
);
ok
(
apiReturn
==
NERR_Success
,
"NetWkstaTransportEnum is successful"
);
if
(
apiReturn
==
NERR_Success
)
{
/* WKSTA_TRANSPORT_INFO_0 *transports = (WKSTA_TRANSPORT_INFO_0 *)bufPtr; */
ok
(
bufPtr
!=
NULL
,
"got data back"
);
ok
(
entriesRead
>
0
,
"read at least one transport"
);
ok
(
totalEntries
>
0
,
"at least one transport"
);
NetApiBufferFree
(
bufPtr
);
}
}
START_TEST
(
wksta
)
{
HMODULE
hnetapi32
=
LoadLibraryA
(
"netapi32.dll"
);
...
...
@@ -123,11 +173,13 @@ START_TEST(wksta)
pNetApiBufferSize
=
(
void
*
)
GetProcAddress
(
hnetapi32
,
"NetApiBufferSize"
);
pNetpGetComputerName
=
(
void
*
)
GetProcAddress
(
hnetapi32
,
"NetpGetComputerName"
);
pNetWkstaUserGetInfo
=
(
void
*
)
GetProcAddress
(
hnetapi32
,
"NetWkstaUserGetInfo"
);
pNetWkstaTransportEnum
=
(
void
*
)
GetProcAddress
(
hnetapi32
,
"NetWkstaTransportEnum"
);
if
(
!
pNetApiBufferSize
)
trace
(
"It appears there is no netapi32 functionality on this platform
\n
"
);
if
(
init_wksta_tests
())
{
run_get_comp_name_tests
();
run_wkstausergetinfo_tests
();
run_wkstatransportenum_tests
();
}
}
dlls/netapi32/wksta.c
View file @
7b55bc45
...
...
@@ -89,6 +89,13 @@ NetWkstaTransportEnum(LPCWSTR ServerName, DWORD level, LPBYTE* pbuf,
PWKSTA_TRANSPORT_INFO_0
ti
;
int
i
,
size_needed
,
n_adapt
=
enum_hw
();
if
(
n_adapt
==
0
)
return
ERROR_NETWORK_UNREACHABLE
;
if
(
!
read_entries
)
return
STATUS_ACCESS_VIOLATION
;
if
(
!
total_entries
||
!
pbuf
)
return
RPC_X_NULL_REF_POINTER
;
size_needed
=
n_adapt
*
(
sizeof
(
WKSTA_TRANSPORT_INFO_0
)
*
13
*
sizeof
(
WCHAR
));
if
(
prefmaxlen
==
MAX_PREFERRED_LENGTH
)
...
...
@@ -115,8 +122,8 @@ NetWkstaTransportEnum(LPCWSTR ServerName, DWORD level, LPBYTE* pbuf,
TRACE
(
"%d of %d:ti at %p transport_address at %p %s
\n
"
,
i
,
n_adapt
,
ti
,
ti
->
wkti0_transport_address
,
debugstr_w
(
ti
->
wkti0_transport_address
));
}
if
(
read_entries
)
*
read_entries
=
n_adapt
;
if
(
total_entries
)
*
total_entries
=
n_adapt
;
*
read_entries
=
n_adapt
;
*
total_entries
=
n_adapt
;
if
(
hresume
)
*
hresume
=
0
;
break
;
}
...
...
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