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
b452e628
Commit
b452e628
authored
Aug 10, 2016
by
Pierre Schweitzer
Committed by
Alexandre Julliard
Aug 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpr: Implement local name automatic redirection for disks.
Signed-off-by:
Pierre Schweitzer
<
pierre@reactos.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8b6fa5c9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
23 deletions
+42
-23
wnet.c
dlls/mpr/wnet.c
+42
-23
No files found.
dlls/mpr/wnet.c
View file @
b452e628
...
@@ -1581,18 +1581,18 @@ struct use_connection_context
...
@@ -1581,18 +1581,18 @@ struct use_connection_context
void
*
accessname
;
void
*
accessname
;
DWORD
*
buffer_size
;
DWORD
*
buffer_size
;
DWORD
*
result
;
DWORD
*
result
;
DWORD
(
*
pre_set_accessname
)(
struct
use_connection_context
*
);
DWORD
(
*
pre_set_accessname
)(
struct
use_connection_context
*
,
WCHAR
*
);
void
(
*
set_accessname
)(
struct
use_connection_context
*
);
void
(
*
set_accessname
)(
struct
use_connection_context
*
,
WCHAR
*
);
};
};
static
DWORD
use_connection_pre_set_accessnameW
(
struct
use_connection_context
*
ctxt
)
static
DWORD
use_connection_pre_set_accessnameW
(
struct
use_connection_context
*
ctxt
,
WCHAR
*
local_name
)
{
{
if
(
ctxt
->
accessname
&&
ctxt
->
buffer_size
&&
*
ctxt
->
buffer_size
)
if
(
ctxt
->
accessname
&&
ctxt
->
buffer_size
&&
*
ctxt
->
buffer_size
)
{
{
DWORD
len
;
DWORD
len
;
if
(
ctxt
->
resource
->
lpLocalN
ame
)
if
(
local_n
ame
)
len
=
strlenW
(
ctxt
->
resource
->
lpLocalN
ame
);
len
=
strlenW
(
local_n
ame
);
else
else
len
=
strlenW
(
ctxt
->
resource
->
lpRemoteName
);
len
=
strlenW
(
ctxt
->
resource
->
lpRemoteName
);
...
@@ -1608,11 +1608,11 @@ static DWORD use_connection_pre_set_accessnameW(struct use_connection_context *c
...
@@ -1608,11 +1608,11 @@ static DWORD use_connection_pre_set_accessnameW(struct use_connection_context *c
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
}
}
static
void
use_connection_set_accessnameW
(
struct
use_connection_context
*
ctxt
)
static
void
use_connection_set_accessnameW
(
struct
use_connection_context
*
ctxt
,
WCHAR
*
local_name
)
{
{
WCHAR
*
accessname
=
ctxt
->
accessname
;
WCHAR
*
accessname
=
ctxt
->
accessname
;
if
(
ctxt
->
resource
->
lpLocalN
ame
)
if
(
local_n
ame
)
strcpyW
(
accessname
,
ctxt
->
resource
->
lpLocalN
ame
);
strcpyW
(
accessname
,
local_n
ame
);
else
else
strcpyW
(
accessname
,
ctxt
->
resource
->
lpRemoteName
);
strcpyW
(
accessname
,
ctxt
->
resource
->
lpRemoteName
);
}
}
...
@@ -1621,29 +1621,42 @@ static DWORD wnet_use_connection( struct use_connection_context *ctxt )
...
@@ -1621,29 +1621,42 @@ static DWORD wnet_use_connection( struct use_connection_context *ctxt )
{
{
WNetProvider
*
provider
;
WNetProvider
*
provider
;
DWORD
index
,
ret
,
caps
;
DWORD
index
,
ret
,
caps
;
BOOL
redirect
=
FALSE
;
WCHAR
letter
[
3
]
=
{
'Z'
,
':'
,
0
};
NETRESOURCEW
netres
;
if
(
!
providerTable
||
providerTable
->
numProviders
==
0
)
if
(
!
providerTable
||
providerTable
->
numProviders
==
0
)
return
WN_NO_NETWORK
;
return
WN_NO_NETWORK
;
if
(
!
ctxt
->
resource
)
if
(
!
ctxt
->
resource
)
return
ERROR_INVALID_PARAMETER
;
return
ERROR_INVALID_PARAMETER
;
netres
=
*
ctxt
->
resource
;
if
(
!
ctxt
->
resource
->
lpProvider
)
if
(
!
netres
.
lpLocalName
&&
(
ctxt
->
flags
&
CONNECT_REDIRECT
)
)
{
{
FIXME
(
"Networking provider selection is not implemented.
\n
"
);
if
(
netres
.
dwType
!=
RESOURCETYPE_DISK
&&
netres
.
dwType
!=
RESOURCETYPE_PRINT
)
return
ERROR_BAD_DEV_TYPE
;
if
(
netres
.
dwType
==
RESOURCETYPE_PRINT
)
{
FIXME
(
"Local device selection is not implemented for printers.
\n
"
);
return
WN_NO_NETWORK
;
return
WN_NO_NETWORK
;
}
}
if
(
!
ctxt
->
resource
->
lpLocalName
&&
(
ctxt
->
flags
&
CONNECT_REDIRECT
))
redirect
=
TRUE
;
netres
.
lpLocalName
=
letter
;
}
if
(
!
netres
.
lpProvider
)
{
{
FIXME
(
"
Locale device
selection is not implemented.
\n
"
);
FIXME
(
"
Networking provider
selection is not implemented.
\n
"
);
return
WN_NO_NETWORK
;
return
WN_NO_NETWORK
;
}
}
if
(
ctxt
->
flags
&
CONNECT_INTERACTIVE
)
if
(
ctxt
->
flags
&
CONNECT_INTERACTIVE
)
return
ERROR_BAD_NET_NAME
;
return
ERROR_BAD_NET_NAME
;
index
=
_findProviderIndexW
(
ctxt
->
resource
->
lpProvider
);
index
=
_findProviderIndexW
(
netres
.
lpProvider
);
if
(
index
==
BAD_PROVIDER_INDEX
)
if
(
index
==
BAD_PROVIDER_INDEX
)
return
ERROR_BAD_PROVIDER
;
return
ERROR_BAD_PROVIDER
;
...
@@ -1652,17 +1665,23 @@ static DWORD wnet_use_connection( struct use_connection_context *ctxt )
...
@@ -1652,17 +1665,23 @@ static DWORD wnet_use_connection( struct use_connection_context *ctxt )
if
(
!
(
caps
&
(
WNNC_CON_ADDCONNECTION
|
WNNC_CON_ADDCONNECTION3
)))
if
(
!
(
caps
&
(
WNNC_CON_ADDCONNECTION
|
WNNC_CON_ADDCONNECTION3
)))
return
ERROR_BAD_PROVIDER
;
return
ERROR_BAD_PROVIDER
;
if
((
ret
=
ctxt
->
pre_set_accessname
(
ctxt
)))
if
((
ret
=
ctxt
->
pre_set_accessname
(
ctxt
,
netres
.
lpLocalName
)))
return
ret
;
return
ret
;
ret
=
WN_ACCESS_DENIED
;
ret
=
WN_ACCESS_DENIED
;
do
{
if
((
caps
&
WNNC_CON_ADDCONNECTION3
)
&&
provider
->
addConnection3
)
if
((
caps
&
WNNC_CON_ADDCONNECTION3
)
&&
provider
->
addConnection3
)
ret
=
provider
->
addConnection3
(
ctxt
->
hwndOwner
,
ctxt
->
resource
,
ctxt
->
password
,
ctxt
->
userid
,
ctxt
->
flags
);
ret
=
provider
->
addConnection3
(
ctxt
->
hwndOwner
,
&
netres
,
ctxt
->
password
,
ctxt
->
userid
,
ctxt
->
flags
);
else
if
((
caps
&
WNNC_CON_ADDCONNECTION
)
&&
provider
->
addConnection
)
else
if
((
caps
&
WNNC_CON_ADDCONNECTION
)
&&
provider
->
addConnection
)
ret
=
provider
->
addConnection
(
ctxt
->
resource
,
ctxt
->
password
,
ctxt
->
userid
);
ret
=
provider
->
addConnection
(
&
netres
,
ctxt
->
password
,
ctxt
->
userid
);
if
(
ret
!=
NO_ERROR
&&
redirect
)
letter
[
0
]
-=
1
;
}
while
(
redirect
&&
ret
==
WN_ALREADY_CONNECTED
&&
letter
[
0
]
>=
'C'
);
if
(
ret
==
WN_SUCCESS
&&
ctxt
->
accessname
)
if
(
ret
==
WN_SUCCESS
&&
ctxt
->
accessname
)
ctxt
->
set_accessname
(
ctxt
);
ctxt
->
set_accessname
(
ctxt
,
netres
.
lpLocalName
);
return
ret
;
return
ret
;
}
}
...
@@ -1694,14 +1713,14 @@ DWORD WINAPI WNetUseConnectionW( HWND hwndOwner, NETRESOURCEW *resource, LPCWSTR
...
@@ -1694,14 +1713,14 @@ DWORD WINAPI WNetUseConnectionW( HWND hwndOwner, NETRESOURCEW *resource, LPCWSTR
return
wnet_use_connection
(
&
ctxt
);
return
wnet_use_connection
(
&
ctxt
);
}
}
static
DWORD
use_connection_pre_set_accessnameA
(
struct
use_connection_context
*
ctxt
)
static
DWORD
use_connection_pre_set_accessnameA
(
struct
use_connection_context
*
ctxt
,
WCHAR
*
local_name
)
{
{
if
(
ctxt
->
accessname
&&
ctxt
->
buffer_size
&&
*
ctxt
->
buffer_size
)
if
(
ctxt
->
accessname
&&
ctxt
->
buffer_size
&&
*
ctxt
->
buffer_size
)
{
{
DWORD
len
;
DWORD
len
;
if
(
ctxt
->
resourceA
->
lpLocalN
ame
)
if
(
local_n
ame
)
len
=
strlen
(
ctxt
->
resourceA
->
lpLocalName
)
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
local_name
,
-
1
,
NULL
,
0
,
NULL
,
NULL
)
-
1
;
else
else
len
=
strlen
(
ctxt
->
resourceA
->
lpRemoteName
);
len
=
strlen
(
ctxt
->
resourceA
->
lpRemoteName
);
...
@@ -1717,11 +1736,11 @@ static DWORD use_connection_pre_set_accessnameA(struct use_connection_context *c
...
@@ -1717,11 +1736,11 @@ static DWORD use_connection_pre_set_accessnameA(struct use_connection_context *c
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
}
}
static
void
use_connection_set_accessnameA
(
struct
use_connection_context
*
ctxt
)
static
void
use_connection_set_accessnameA
(
struct
use_connection_context
*
ctxt
,
WCHAR
*
local_name
)
{
{
char
*
accessname
=
ctxt
->
accessname
;
char
*
accessname
=
ctxt
->
accessname
;
if
(
ctxt
->
resourceA
->
lpLocalN
ame
)
if
(
local_n
ame
)
strcpy
(
accessname
,
ctxt
->
resourceA
->
lpLocalName
);
WideCharToMultiByte
(
CP_ACP
,
0
,
local_name
,
-
1
,
accessname
,
*
ctxt
->
buffer_size
,
NULL
,
NULL
);
else
else
strcpy
(
accessname
,
ctxt
->
resourceA
->
lpRemoteName
);
strcpy
(
accessname
,
ctxt
->
resourceA
->
lpRemoteName
);
}
}
...
...
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