mirror of
https://github.com/reactos/reactos.git
synced 2024-06-28 17:01:28 +00:00
[MPR]
Provide ReactOS specific implementation for WNetGetConnection(), we cannot use Wine's due to Wine specific MountMgr calls. svn path=/trunk/; revision=71984
This commit is contained in:
parent
1ce557f97e
commit
0ee9e9b016
|
@ -45,3 +45,68 @@ Index: mpr.spec
|
|||
22 stdcall @(long) MPR_Alloc
|
||||
23 stdcall @(ptr long) MPR_ReAlloc
|
||||
24 stdcall @(ptr) MPR_Free
|
||||
Index: wnet.c
|
||||
===================================================================
|
||||
--- wnet.c (revision 71983)
|
||||
+++ wnet.c (working copy)
|
||||
@@ -48,6 +48,9 @@
|
||||
PF_NPGetResourceInformation getResourceInformation;
|
||||
PF_NPAddConnection addConnection;
|
||||
PF_NPAddConnection3 addConnection3;
|
||||
+#ifdef __REACTOS__
|
||||
+ PF_NPGetConnection getConnection;
|
||||
+#endif
|
||||
} WNetProvider, *PWNetProvider;
|
||||
|
||||
typedef struct _WNetProviderTable
|
||||
@@ -196,6 +199,9 @@
|
||||
}
|
||||
provider->addConnection = MPR_GETPROC(NPAddConnection);
|
||||
provider->addConnection3 = MPR_GETPROC(NPAddConnection3);
|
||||
+#ifdef __REACTOS__
|
||||
+ provider->getConnection = MPR_GETPROC(NPGetConnection);
|
||||
+#endif
|
||||
TRACE("NPAddConnection %p\n", provider->addConnection);
|
||||
TRACE("NPAddConnection3 %p\n", provider->addConnection3);
|
||||
providerTable->numProviders++;
|
||||
@@ -1949,6 +1955,7 @@
|
||||
/* find the network connection for a given drive; helper for WNetGetConnection */
|
||||
static DWORD get_drive_connection( WCHAR letter, LPWSTR remote, LPDWORD size )
|
||||
{
|
||||
+#ifndef __REACTOS__
|
||||
char buffer[1024];
|
||||
struct mountmgr_unix_drive *data = (struct mountmgr_unix_drive *)buffer;
|
||||
HANDLE mgr;
|
||||
@@ -1991,6 +1998,32 @@
|
||||
}
|
||||
CloseHandle( mgr );
|
||||
return ret;
|
||||
+#else
|
||||
+ DWORD ret = WN_NO_NETWORK;
|
||||
+ DWORD index;
|
||||
+ WCHAR local[3] = {letter, ':', 0};
|
||||
+
|
||||
+ if (providerTable != NULL)
|
||||
+ {
|
||||
+ for (index = 0; index < providerTable->numProviders; index++)
|
||||
+ {
|
||||
+ if(providerTable->table[index].getCaps(WNNC_CONNECTION) &
|
||||
+ WNNC_CON_GETCONNECTIONS)
|
||||
+ {
|
||||
+ if (providerTable->table[index].getConnection)
|
||||
+ ret = providerTable->table[index].getConnection(
|
||||
+ local, remote, size);
|
||||
+ else
|
||||
+ ret = WN_NO_NETWORK;
|
||||
+ if (ret == WN_SUCCESS || ret == WN_MORE_DATA)
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (ret)
|
||||
+ SetLastError(ret);
|
||||
+ return ret;
|
||||
+#endif
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
|
|
@ -48,6 +48,9 @@ typedef struct _WNetProvider
|
|||
PF_NPGetResourceInformation getResourceInformation;
|
||||
PF_NPAddConnection addConnection;
|
||||
PF_NPAddConnection3 addConnection3;
|
||||
#ifdef __REACTOS__
|
||||
PF_NPGetConnection getConnection;
|
||||
#endif
|
||||
} WNetProvider, *PWNetProvider;
|
||||
|
||||
typedef struct _WNetProviderTable
|
||||
|
@ -196,6 +199,9 @@ static void _tryLoadProvider(PCWSTR provider)
|
|||
}
|
||||
provider->addConnection = MPR_GETPROC(NPAddConnection);
|
||||
provider->addConnection3 = MPR_GETPROC(NPAddConnection3);
|
||||
#ifdef __REACTOS__
|
||||
provider->getConnection = MPR_GETPROC(NPGetConnection);
|
||||
#endif
|
||||
TRACE("NPAddConnection %p\n", provider->addConnection);
|
||||
TRACE("NPAddConnection3 %p\n", provider->addConnection3);
|
||||
providerTable->numProviders++;
|
||||
|
@ -1949,6 +1955,7 @@ DWORD WINAPI WNetGetConnectionA( LPCSTR lpLocalName,
|
|||
/* find the network connection for a given drive; helper for WNetGetConnection */
|
||||
static DWORD get_drive_connection( WCHAR letter, LPWSTR remote, LPDWORD size )
|
||||
{
|
||||
#ifndef __REACTOS__
|
||||
char buffer[1024];
|
||||
struct mountmgr_unix_drive *data = (struct mountmgr_unix_drive *)buffer;
|
||||
HANDLE mgr;
|
||||
|
@ -1991,6 +1998,32 @@ static DWORD get_drive_connection( WCHAR letter, LPWSTR remote, LPDWORD size )
|
|||
}
|
||||
CloseHandle( mgr );
|
||||
return ret;
|
||||
#else
|
||||
DWORD ret = WN_NO_NETWORK;
|
||||
DWORD index;
|
||||
WCHAR local[3] = {letter, ':', 0};
|
||||
|
||||
if (providerTable != NULL)
|
||||
{
|
||||
for (index = 0; index < providerTable->numProviders; index++)
|
||||
{
|
||||
if(providerTable->table[index].getCaps(WNNC_CONNECTION) &
|
||||
WNNC_CON_GETCONNECTIONS)
|
||||
{
|
||||
if (providerTable->table[index].getConnection)
|
||||
ret = providerTable->table[index].getConnection(
|
||||
local, remote, size);
|
||||
else
|
||||
ret = WN_NO_NETWORK;
|
||||
if (ret == WN_SUCCESS || ret == WN_MORE_DATA)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ret)
|
||||
SetLastError(ret);
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
|
Loading…
Reference in a new issue