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
dbe3269c
Commit
dbe3269c
authored
Nov 25, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mountmgr: Pass a Unix interface name in the dhcp_request_params ioctl.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5e42498e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
58 deletions
+45
-58
dhcpcsvc.c
dlls/dhcpcsvc/dhcpcsvc.c
+18
-3
Makefile.in
dlls/mountmgr.sys/Makefile.in
+1
-1
dbus.c
dlls/mountmgr.sys/dbus.c
+7
-21
diskarb.c
dlls/mountmgr.sys/diskarb.c
+7
-18
mountmgr.c
dlls/mountmgr.sys/mountmgr.c
+9
-12
mountmgr.h
dlls/mountmgr.sys/mountmgr.h
+2
-2
mountmgr.h
include/ddk/mountmgr.h
+1
-1
No files found.
dlls/dhcpcsvc/dhcpcsvc.c
View file @
dbe3269c
...
...
@@ -20,6 +20,7 @@
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "dhcpcsdk.h"
#include "winioctl.h"
#include "winternl.h"
...
...
@@ -62,6 +63,20 @@ static DWORD get_adapter_luid( const WCHAR *adapter, NET_LUID *luid )
return
ConvertInterfaceNameToLuidW
(
adapter
,
luid
);
}
#define IF_NAMESIZE 16
static
DWORD
get_adapter_name
(
const
WCHAR
*
adapter
,
char
*
unix_name
,
DWORD
len
)
{
WCHAR
unix_nameW
[
IF_NAMESIZE
];
NET_LUID
luid
;
DWORD
ret
;
if
((
ret
=
get_adapter_luid
(
adapter
,
&
luid
)))
return
ret
;
if
((
ret
=
ConvertInterfaceLuidToAlias
(
&
luid
,
unix_nameW
,
ARRAY_SIZE
(
unix_nameW
)
)))
return
ret
;
if
(
!
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
unix_nameW
,
-
1
,
unix_name
,
len
,
NULL
,
NULL
))
return
ERROR_INVALID_PARAMETER
;
return
ERROR_SUCCESS
;
}
DWORD
WINAPI
DhcpRequestParams
(
DWORD
flags
,
void
*
reserved
,
WCHAR
*
adapter
,
DHCPCAPI_CLASSID
*
class_id
,
DHCPCAPI_PARAMS_ARRAY
send_params
,
DHCPCAPI_PARAMS_ARRAY
recv_params
,
BYTE
*
buf
,
DWORD
*
buflen
,
WCHAR
*
request_id
)
...
...
@@ -69,15 +84,15 @@ DWORD WINAPI DhcpRequestParams( DWORD flags, void *reserved, WCHAR *adapter, DHC
struct
mountmgr_dhcp_request_params
*
query
;
DWORD
i
,
size
,
err
;
BYTE
*
src
,
*
dst
;
NET_LUID
luid
;
HANDLE
mgr
;
char
unix_name
[
IF_NAMESIZE
];
TRACE
(
"(%08x, %p, %s, %p, %u, %u, %p, %p, %s)
\n
"
,
flags
,
reserved
,
debugstr_w
(
adapter
),
class_id
,
send_params
.
nParams
,
recv_params
.
nParams
,
buf
,
buflen
,
debugstr_w
(
request_id
)
);
if
(
!
adapter
||
!
buflen
)
return
ERROR_INVALID_PARAMETER
;
if
(
flags
!=
DHCPCAPI_REQUEST_SYNCHRONOUS
)
FIXME
(
"unsupported flags %08x
\n
"
,
flags
);
if
((
err
=
get_adapter_
luid
(
adapter
,
&
luid
)))
return
err
;
if
((
err
=
get_adapter_
name
(
adapter
,
unix_name
,
sizeof
(
unix_name
)
)))
return
err
;
for
(
i
=
0
;
i
<
send_params
.
nParams
;
i
++
)
FIXME
(
"send option %u not supported
\n
"
,
send_params
.
Params
->
OptionId
);
...
...
@@ -94,7 +109,7 @@ DWORD WINAPI DhcpRequestParams( DWORD flags, void *reserved, WCHAR *adapter, DHC
}
for
(
i
=
0
;
i
<
recv_params
.
nParams
;
i
++
)
query
->
params
[
i
].
id
=
recv_params
.
Params
[
i
].
OptionId
;
query
->
count
=
recv_params
.
nParams
;
query
->
adapter
=
luid
;
strcpy
(
query
->
unix_name
,
unix_name
)
;
if
(
!
DeviceIoControl
(
mgr
,
IOCTL_MOUNTMGR_QUERY_DHCP_REQUEST_PARAMS
,
query
,
size
,
query
,
size
,
NULL
,
NULL
))
{
...
...
dlls/mountmgr.sys/Makefile.in
View file @
dbe3269c
MODULE
=
mountmgr.sys
IMPORTS
=
uuid advapi32 ntoskrnl
DELAYIMPORTS
=
user32
iphlpapi
DELAYIMPORTS
=
user32
EXTRAINCL
=
$(DBUS_CFLAGS)
$(HAL_CFLAGS)
EXTRALIBS
=
$(DISKARBITRATION_LIBS)
$(SYSTEMCONFIGURATION_LIBS)
$(CORESERVICES_LIBS)
$(SECURITY_LIBS)
...
...
dlls/mountmgr.sys/dbus.c
View file @
dbe3269c
...
...
@@ -38,9 +38,6 @@
#define USE_WS_PREFIX
#include "winsock2.h"
#include "ws2ipdef.h"
#include "nldef.h"
#include "netioapi.h"
#include "inaddr.h"
#include "ip2string.h"
#include "dhcpcsdk.h"
...
...
@@ -998,26 +995,15 @@ static DBusMessage *device_by_iface_request( const char *iface )
return
reply
;
}
#define IF_NAMESIZE 16
static
BOOL
map_adapter_name
(
const
NET_LUID
*
luid
,
char
*
unix_name
,
DWORD
len
)
{
WCHAR
unix_nameW
[
IF_NAMESIZE
];
if
(
ConvertInterfaceLuidToAlias
(
luid
,
unix_nameW
,
ARRAY_SIZE
(
unix_nameW
)
))
return
FALSE
;
return
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
unix_nameW
,
-
1
,
unix_name
,
len
,
NULL
,
NULL
)
!=
0
;
}
static
DBusMessage
*
dhcp4_config_request
(
const
NET_LUID
*
adapter
)
static
DBusMessage
*
dhcp4_config_request
(
const
char
*
iface
)
{
static
const
char
*
device
=
"org.freedesktop.NetworkManager.Device"
;
static
const
char
*
dhcp4_config
=
"Dhcp4Config"
;
char
iface
[
IF_NAMESIZE
];
DBusMessage
*
request
,
*
reply
;
DBusMessageIter
iter
;
DBusError
error
;
const
char
*
path
=
NULL
;
if
(
!
map_adapter_name
(
adapter
,
iface
,
sizeof
(
iface
)
))
return
NULL
;
if
(
!
(
reply
=
device_by_iface_request
(
iface
)))
return
NULL
;
p_dbus_message_iter_init
(
reply
,
&
iter
);
...
...
@@ -1047,7 +1033,7 @@ static DBusMessage *dhcp4_config_request( const NET_LUID *adapter )
return
reply
;
}
static
DBusMessage
*
dhcp4_config_options_request
(
const
NET_LUID
*
adapter
)
static
DBusMessage
*
dhcp4_config_options_request
(
const
char
*
unix_name
)
{
static
const
char
*
dhcp4_config
=
"org.freedesktop.NetworkManager.DHCP4Config"
;
static
const
char
*
options
=
"Options"
;
...
...
@@ -1056,7 +1042,7 @@ static DBusMessage *dhcp4_config_options_request( const NET_LUID *adapter )
DBusError
error
;
const
char
*
path
=
NULL
;
if
(
!
(
reply
=
dhcp4_config_request
(
adapter
)))
return
NULL
;
if
(
!
(
reply
=
dhcp4_config_request
(
unix_name
)))
return
NULL
;
p_dbus_message_iter_init
(
reply
,
&
iter
);
if
(
p_dbus_message_iter_get_arg_type
(
&
iter
)
==
DBUS_TYPE_VARIANT
)
...
...
@@ -1106,13 +1092,13 @@ static const char *dhcp4_config_option_next_dict_entry( DBusMessageIter *iter, D
return
name
;
}
static
DBusMessage
*
dhcp4_config_option_request
(
const
NET_LUID
*
adapter
,
const
char
*
option
,
const
char
**
value
)
static
DBusMessage
*
dhcp4_config_option_request
(
const
char
*
unix_name
,
const
char
*
option
,
const
char
**
value
)
{
DBusMessage
*
reply
;
DBusMessageIter
iter
,
variant
;
const
char
*
name
;
if
(
!
(
reply
=
dhcp4_config_options_request
(
adapter
)))
return
NULL
;
if
(
!
(
reply
=
dhcp4_config_options_request
(
unix_name
)))
return
NULL
;
*
value
=
NULL
;
p_dbus_message_iter_init
(
reply
,
&
iter
);
...
...
@@ -1152,7 +1138,7 @@ static const char *map_option( ULONG option )
}
}
ULONG
get_dhcp_request_param
(
const
NET_LUID
*
adapter
,
struct
mountmgr_dhcp_request_param
*
param
,
char
*
buf
,
ULONG
offset
,
ULONG
get_dhcp_request_param
(
const
char
*
unix_name
,
struct
mountmgr_dhcp_request_param
*
param
,
char
*
buf
,
ULONG
offset
,
ULONG
size
)
{
DBusMessage
*
reply
;
...
...
@@ -1161,7 +1147,7 @@ ULONG get_dhcp_request_param( const NET_LUID *adapter, struct mountmgr_dhcp_requ
param
->
offset
=
param
->
size
=
0
;
if
(
!
(
reply
=
dhcp4_config_option_request
(
adapter
,
map_option
(
param
->
id
),
&
value
)))
return
0
;
if
(
!
(
reply
=
dhcp4_config_option_request
(
unix_name
,
map_option
(
param
->
id
),
&
value
)))
return
0
;
switch
(
param
->
id
)
{
...
...
dlls/mountmgr.sys/diskarb.c
View file @
dbe3269c
...
...
@@ -42,8 +42,6 @@
#define USE_WS_PREFIX
#include "winsock2.h"
#include "ws2ipdef.h"
#include "nldef.h"
#include "netioapi.h"
#include "dhcpcsdk.h"
#include "wine/debug.h"
...
...
@@ -258,22 +256,14 @@ static UInt8 map_option( ULONG option )
}
}
#define IF_NAMESIZE 16
static
BOOL
map_adapter_name
(
const
NET_LUID
*
luid
,
WCHAR
*
unix_name
,
DWORD
len
)
{
return
!
ConvertInterfaceLuidToAlias
(
luid
,
unix_name
,
len
);
}
static
CFStringRef
find_service_id
(
const
NET_LUID
*
adapter
)
static
CFStringRef
find_service_id
(
const
char
*
unix_name
)
{
SCPreferencesRef
prefs
;
SCNetworkSetRef
set
=
NULL
;
CFArrayRef
services
=
NULL
;
CFStringRef
id
,
ret
=
NULL
;
WCHAR
unix_name
[
IF_NAMESIZE
];
CFIndex
i
;
if
(
!
map_adapter_name
(
adapter
,
unix_name
,
ARRAY_SIZE
(
unix_name
)
))
return
NULL
;
if
(
!
(
prefs
=
SCPreferencesCreate
(
NULL
,
CFSTR
(
"mountmgr.sys"
),
NULL
)))
return
NULL
;
if
(
!
(
set
=
SCNetworkSetCopyCurrent
(
prefs
)))
goto
done
;
if
(
!
(
services
=
SCNetworkSetCopyServices
(
set
)))
goto
done
;
...
...
@@ -281,15 +271,14 @@ static CFStringRef find_service_id( const NET_LUID *adapter )
for
(
i
=
0
;
i
<
CFArrayGetCount
(
services
);
i
++
)
{
SCNetworkServiceRef
service
;
UniChar
buf
[
IF_NAMESIZE
]
=
{
0
}
;
char
buf
[
16
]
;
CFStringRef
name
;
service
=
CFArrayGetValueAtIndex
(
services
,
i
);
name
=
SCNetworkInterfaceGetBSDName
(
SCNetworkServiceGetInterface
(
service
)
);
if
(
name
&&
CFStringGet
Length
(
name
)
<
ARRAY_SIZE
(
buf
))
if
(
name
&&
CFStringGet
CString
(
name
,
buf
,
sizeof
(
buf
),
kCFStringEncodingUTF8
))
{
CFStringGetCharacters
(
name
,
CFRangeMake
(
0
,
CFStringGetLength
(
name
)),
buf
);
if
(
!
lstrcmpW
(
buf
,
unix_name
)
&&
(
id
=
SCNetworkServiceGetServiceID
(
service
)))
if
(
!
strcmp
(
buf
,
unix_name
)
&&
(
id
=
SCNetworkServiceGetServiceID
(
service
)))
{
ret
=
CFStringCreateCopy
(
NULL
,
id
);
break
;
...
...
@@ -304,10 +293,10 @@ done:
return
ret
;
}
ULONG
get_dhcp_request_param
(
const
NET_LUID
*
adapter
,
struct
mountmgr_dhcp_request_param
*
param
,
char
*
buf
,
ULONG
offset
,
ULONG
get_dhcp_request_param
(
const
char
*
unix_name
,
struct
mountmgr_dhcp_request_param
*
param
,
char
*
buf
,
ULONG
offset
,
ULONG
size
)
{
CFStringRef
service_id
=
find_service_id
(
adapter
);
CFStringRef
service_id
=
find_service_id
(
unix_name
);
CFDictionaryRef
dict
;
CFDataRef
value
;
DWORD
ret
=
0
;
...
...
@@ -373,7 +362,7 @@ ULONG get_dhcp_request_param( const NET_LUID *adapter, struct mountmgr_dhcp_requ
#elif !defined(SONAME_LIBDBUS_1)
ULONG
get_dhcp_request_param
(
const
NET_LUID
*
adapter
,
struct
mountmgr_dhcp_request_param
*
param
,
char
*
buf
,
ULONG
offset
,
ULONG
get_dhcp_request_param
(
const
char
*
unix_name
,
struct
mountmgr_dhcp_request_param
*
param
,
char
*
buf
,
ULONG
offset
,
ULONG
size
)
{
FIXME
(
"support not compiled in
\n
"
);
...
...
dlls/mountmgr.sys/mountmgr.c
View file @
dbe3269c
...
...
@@ -246,7 +246,6 @@ static NTSTATUS define_unix_drive( const void *in_buff, SIZE_T insize )
{
const
struct
mountmgr_unix_drive
*
input
=
in_buff
;
const
char
*
mount_point
=
NULL
,
*
device
=
NULL
;
unsigned
int
i
;
WCHAR
letter
=
tolowerW
(
input
->
letter
);
if
(
letter
<
'a'
||
letter
>
'z'
)
return
STATUS_INVALID_PARAMETER
;
...
...
@@ -258,16 +257,12 @@ static NTSTATUS define_unix_drive( const void *in_buff, SIZE_T insize )
if
(
input
->
mount_point_offset
)
{
mount_point
=
(
const
char
*
)
in_buff
+
input
->
mount_point_offset
;
for
(
i
=
input
->
mount_point_offset
;
i
<
insize
;
i
++
)
if
(
!*
((
const
char
*
)
in_buff
+
i
))
break
;
if
(
i
>=
insize
)
return
STATUS_INVALID_PARAMETER
;
if
(
!
memchr
(
mount_point
,
0
,
insize
-
input
->
mount_point_offset
))
return
STATUS_INVALID_PARAMETER
;
}
if
(
input
->
device_offset
)
{
device
=
(
const
char
*
)
in_buff
+
input
->
device_offset
;
for
(
i
=
input
->
device_offset
;
i
<
insize
;
i
++
)
if
(
!*
((
const
char
*
)
in_buff
+
i
))
break
;
if
(
i
>=
insize
)
return
STATUS_INVALID_PARAMETER
;
if
(
!
memchr
(
device
,
0
,
insize
-
input
->
device_offset
))
return
STATUS_INVALID_PARAMETER
;
}
if
(
input
->
type
!=
DRIVE_NO_ROOT_DIR
)
...
...
@@ -305,7 +300,6 @@ static NTSTATUS define_shell_folder( const void *in_buff, SIZE_T insize )
const
char
*
home
;
char
*
buffer
=
NULL
,
*
backup
=
NULL
,
*
homelink
=
NULL
;
struct
stat
st
;
unsigned
int
i
;
if
(
input
->
folder_offset
>=
insize
||
input
->
folder_size
>
insize
-
input
->
folder_offset
||
input
->
symlink_offset
>=
insize
)
...
...
@@ -315,9 +309,7 @@ static NTSTATUS define_shell_folder( const void *in_buff, SIZE_T insize )
if
(
input
->
symlink_offset
)
{
link
=
(
const
char
*
)
in_buff
+
input
->
symlink_offset
;
for
(
i
=
input
->
symlink_offset
;
i
<
insize
;
i
++
)
if
(
!*
((
const
char
*
)
in_buff
+
i
))
break
;
if
(
i
>=
insize
)
return
STATUS_INVALID_PARAMETER
;
if
(
!
memchr
(
link
,
0
,
insize
-
input
->
symlink_offset
))
return
STATUS_INVALID_PARAMETER
;
if
(
!
link
[
0
])
link
=
NULL
;
}
...
...
@@ -459,11 +451,16 @@ static void WINAPI query_dhcp_request_params( TP_CALLBACK_INSTANCE *instance, vo
goto
err
;
}
if
(
!
memchr
(
query
->
unix_name
,
0
,
sizeof
(
query
->
unix_name
)
))
{
irp
->
IoStatus
.
u
.
Status
=
STATUS_INVALID_PARAMETER
;
goto
err
;
}
offset
=
FIELD_OFFSET
(
struct
mountmgr_dhcp_request_params
,
params
[
query
->
count
]);
for
(
i
=
0
;
i
<
query
->
count
;
i
++
)
{
offset
+=
get_dhcp_request_param
(
&
query
->
adapter
,
&
query
->
params
[
i
],
(
char
*
)
query
,
offset
,
outsize
-
offset
);
offset
+=
get_dhcp_request_param
(
query
->
unix_name
,
&
query
->
params
[
i
],
(
char
*
)
query
,
offset
,
outsize
-
offset
);
if
(
offset
>
outsize
)
{
if
(
offset
>=
sizeof
(
query
->
size
))
query
->
size
=
offset
;
...
...
dlls/mountmgr.sys/mountmgr.h
View file @
dbe3269c
...
...
@@ -108,5 +108,5 @@ extern struct mount_point *add_volume_mount_point( DEVICE_OBJECT *device, UNICOD
extern
void
delete_mount_point
(
struct
mount_point
*
mount
)
DECLSPEC_HIDDEN
;
extern
void
set_mount_point_id
(
struct
mount_point
*
mount
,
const
void
*
id
,
unsigned
int
id_len
)
DECLSPEC_HIDDEN
;
extern
ULONG
get_dhcp_request_param
(
const
NET_LUID
*
adapter
,
struct
mountmgr_dhcp_request_param
*
param
,
char
*
buf
,
ULONG
offset
,
ULONG
size
)
DECLSPEC_HIDDEN
;
extern
ULONG
get_dhcp_request_param
(
const
char
*
unix_name
,
struct
mountmgr_dhcp_request_param
*
param
,
char
*
buf
,
ULONG
offset
,
ULONG
size
)
DECLSPEC_HIDDEN
;
include/ddk/mountmgr.h
View file @
dbe3269c
...
...
@@ -131,7 +131,7 @@ struct mountmgr_dhcp_request_params
{
ULONG
size
;
ULONG
count
;
NET_LUID
adapter
;
char
unix_name
[
16
]
;
struct
mountmgr_dhcp_request_param
params
[
1
];
};
...
...
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