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
5d869cad
Commit
5d869cad
authored
Aug 12, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netapi32: Convert the Unix library to the __wine_unix_call interface.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fe6c2516
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
24 deletions
+78
-24
Makefile.in
dlls/netapi32/Makefile.in
+1
-0
netapi32.c
dlls/netapi32/netapi32.c
+29
-17
unixlib.c
dlls/netapi32/unixlib.c
+0
-0
unixlib.h
dlls/netapi32/unixlib.h
+48
-7
No files found.
dlls/netapi32/Makefile.in
View file @
5d869cad
...
...
@@ -2,6 +2,7 @@ EXTRADEFS = -D_SVRAPI_
MODULE
=
netapi32.dll
IMPORTLIB
=
netapi32
IMPORTS
=
rpcrt4 iphlpapi ws2_32 advapi32 dnsapi
EXTRALIBS
=
-Wl
,--subsystem,unixlib
EXTRADLLFLAGS
=
-mno-cygwin
...
...
dlls/netapi32/netapi32.c
View file @
5d869cad
...
...
@@ -55,21 +55,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
DEFINE_GUID
(
GUID_NULL
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
static
HINSTANCE
netapi32_instanc
e
;
static
unixlib_handle_t
samba_handl
e
;
static
INIT_ONCE
init_once
=
INIT_ONCE_STATIC_INIT
;
#define SAMBA_CALL(func, args) __wine_unix_call( samba_handle, unix_ ## func, args )
static
const
struct
samba_funcs
*
samba_funcs
;
static
INIT_ONCE
init_once
=
INIT_ONCE_STATIC_INIT
;
static
BOOL
WINAPI
load_samba
(
INIT_ONCE
*
once
,
void
*
param
,
void
**
context
)
{
__wine_init_unix_lib
(
netapi32_instance
,
DLL_PROCESS_ATTACH
,
NULL
,
&
samba_funcs
);
SAMBA_CALL
(
netapi_init
,
NULL
);
return
TRUE
;
}
static
BOOL
samba_init
(
void
)
{
return
InitOnceExecuteOnce
(
&
init_once
,
load_samba
,
NULL
,
NULL
)
&&
samba_funcs
;
return
samba_handle
&&
InitOnceExecuteOnce
(
&
init_once
,
load_samba
,
NULL
,
NULL
)
;
}
/************************************************************
...
...
@@ -96,7 +96,8 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
switch
(
fdwReason
)
{
case
DLL_PROCESS_ATTACH
:
netapi32_instance
=
hinstDLL
;
NtQueryVirtualMemory
(
GetCurrentProcess
(),
hinstDLL
,
MemoryWineUnixFuncs
,
&
samba_handle
,
sizeof
(
samba_handle
),
NULL
);
DisableThreadLibraryCalls
(
hinstDLL
);
NetBIOSInit
();
NetBTInit
();
...
...
@@ -186,12 +187,14 @@ NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bu
if
(
samba_init
())
{
ULONG
size
=
1024
;
struct
server_getinfo_params
params
=
{
servername
,
level
,
NULL
,
&
size
};
for
(;;)
{
if
(
!
(
*
bufptr
=
malloc
(
size
)))
return
ERROR_OUTOFMEMORY
;
ret
=
samba_funcs
->
server_getinfo
(
servername
,
level
,
*
bufptr
,
&
size
);
if
(
ret
)
free
(
*
bufptr
);
if
(
!
(
params
.
buffer
=
malloc
(
size
)))
return
ERROR_OUTOFMEMORY
;
ret
=
SAMBA_CALL
(
server_getinfo
,
&
params
);
if
(
!
ret
)
*
bufptr
=
params
.
buffer
;
else
free
(
params
.
buffer
);
if
(
ret
!=
ERROR_INSUFFICIENT_BUFFER
)
return
ret
;
}
}
...
...
@@ -488,7 +491,11 @@ NET_API_STATUS WINAPI NetShareDel(LMSTR servername, LMSTR netname, DWORD reserve
if
(
!
local
)
{
if
(
samba_init
())
return
samba_funcs
->
share_del
(
servername
,
netname
,
reserved
);
if
(
samba_init
())
{
struct
share_del_params
params
=
{
servername
,
netname
,
reserved
};
return
SAMBA_CALL
(
share_del
,
&
params
);
}
FIXME
(
"remote computers not supported
\n
"
);
}
...
...
@@ -519,7 +526,11 @@ NET_API_STATUS WINAPI NetShareAdd(LMSTR servername,
if
(
!
local
)
{
if
(
samba_init
())
return
samba_funcs
->
share_add
(
servername
,
level
,
buf
,
parm_err
);
if
(
samba_init
())
{
struct
share_add_params
params
=
{
servername
,
level
,
buf
,
parm_err
};
return
SAMBA_CALL
(
share_add
,
&
params
);
}
FIXME
(
"remote computers not supported
\n
"
);
}
...
...
@@ -978,12 +989,14 @@ NET_API_STATUS WINAPI NetWkstaGetInfo( LMSTR servername, DWORD level,
if
(
samba_init
())
{
ULONG
size
=
1024
;
struct
wksta_getinfo_params
params
=
{
servername
,
level
,
NULL
,
&
size
};
for
(;;)
{
if
(
!
(
*
bufptr
=
malloc
(
size
)))
return
ERROR_OUTOFMEMORY
;
ret
=
samba_funcs
->
wksta_getinfo
(
servername
,
level
,
*
bufptr
,
&
size
);
if
(
ret
)
free
(
*
bufptr
);
if
(
!
(
params
.
buffer
=
malloc
(
size
)))
return
ERROR_OUTOFMEMORY
;
ret
=
SAMBA_CALL
(
wksta_getinfo
,
&
params
);
if
(
!
ret
)
*
bufptr
=
params
.
buffer
;
else
free
(
params
.
buffer
);
if
(
ret
!=
ERROR_INSUFFICIENT_BUFFER
)
return
ret
;
}
}
...
...
@@ -2054,12 +2067,11 @@ NET_API_STATUS WINAPI NetUserChangePassword(LPCWSTR domainname, LPCWSTR username
LPCWSTR
oldpassword
,
LPCWSTR
newpassword
)
{
struct
sam_user
*
user
;
struct
change_password_params
params
=
{
domainname
,
username
,
oldpassword
,
newpassword
};
TRACE
(
"(%s, %s, ..., ...)
\n
"
,
debugstr_w
(
domainname
),
debugstr_w
(
username
));
if
(
!
samba_init
())
return
ERROR_DLL_INIT_FAILED
;
if
(
!
samba_funcs
->
change_password
(
domainname
,
username
,
oldpassword
,
newpassword
))
if
(
samba_init
()
&&
!
SAMBA_CALL
(
change_password
,
&
params
))
return
NERR_Success
;
if
(
domainname
)
...
...
dlls/netapi32/unixlib.c
View file @
5d869cad
This diff is collapsed.
Click to expand it.
dlls/netapi32/unixlib.h
View file @
5d869cad
...
...
@@ -18,12 +18,53 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
struct
samba_funcs
#include "wine/unixlib.h"
struct
server_getinfo_params
{
const
WCHAR
*
server
;
DWORD
level
;
void
*
buffer
;
ULONG
*
size
;
};
struct
share_add_params
{
const
WCHAR
*
server
;
DWORD
level
;
const
BYTE
*
info
;
DWORD
*
err
;
};
struct
share_del_params
{
const
WCHAR
*
server
;
const
WCHAR
*
share
;
DWORD
reserved
;
};
struct
wksta_getinfo_params
{
const
WCHAR
*
server
;
DWORD
level
;
void
*
buffer
;
ULONG
*
size
;
};
struct
change_password_params
{
const
WCHAR
*
domain
;
const
WCHAR
*
user
;
const
WCHAR
*
old
;
const
WCHAR
*
new
;
};
enum
samba_funcs
{
NET_API_STATUS
(
WINAPI
*
server_getinfo
)(
const
WCHAR
*
server
,
DWORD
level
,
void
*
buffer
,
ULONG
*
size
);
NET_API_STATUS
(
WINAPI
*
share_add
)(
const
WCHAR
*
server
,
DWORD
level
,
const
BYTE
*
buffer
,
DWORD
*
err
);
NET_API_STATUS
(
WINAPI
*
share_del
)(
const
WCHAR
*
server
,
const
WCHAR
*
share
,
DWORD
reserved
);
NET_API_STATUS
(
WINAPI
*
wksta_getinfo
)(
const
WCHAR
*
server
,
DWORD
level
,
void
*
buffer
,
ULONG
*
size
);
NET_API_STATUS
(
WINAPI
*
change_password
)(
const
WCHAR
*
domain
,
const
WCHAR
*
user
,
const
WCHAR
*
old
,
const
WCHAR
*
new
);
unix_netapi_init
,
unix_server_getinfo
,
unix_share_add
,
unix_share_del
,
unix_wksta_getinfo
,
unix_change_password
,
};
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