Commit 5ba0e02b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use WNetAddConnection2 directly

parent efa68b29
...@@ -34,13 +34,21 @@ libsdp_plugin_la_CFLAGS = $(AM_CFLAGS) ...@@ -34,13 +34,21 @@ libsdp_plugin_la_CFLAGS = $(AM_CFLAGS)
libsdp_plugin_la_LIBADD = $(AM_LIBADD) libsdp_plugin_la_LIBADD = $(AM_LIBADD)
libsdp_plugin_la_DEPENDENCIES = libsdp_plugin_la_DEPENDENCIES =
libaccess_smb_plugin_la_SOURCES = smb.c
libaccess_smb_plugin_la_CFLAGS = $(AM_CFLAGS)
libaccess_smb_plugin_la_LIBADD = $(AM_LIBADD)
if HAVE_WIN32
libaccess_smb_plugin_la_LIBADD += -lmpr
endif
libaccess_smb_plugin_la_DEPENDENCIES =
libvlc_LTLIBRARIES += $(LTLIBaccess_smb)
SOURCES_access_directory = directory.c SOURCES_access_directory = directory.c
SOURCES_access_dv = dv.c SOURCES_access_dv = dv.c
SOURCES_access_udp = udp.c SOURCES_access_udp = udp.c
SOURCES_access_tcp = tcp.c SOURCES_access_tcp = tcp.c
SOURCES_access_http = http.c SOURCES_access_http = http.c
SOURCES_access_ftp = ftp.c SOURCES_access_ftp = ftp.c
SOURCES_access_smb = smb.c
SOURCES_access_gnomevfs = gnomevfs.c SOURCES_access_gnomevfs = gnomevfs.c
SOURCES_access_eyetv = eyetv.m SOURCES_access_eyetv = eyetv.m
SOURCES_dvdnav = dvdnav.c SOURCES_dvdnav = dvdnav.c
...@@ -175,7 +183,8 @@ libvlc_LTLIBRARIES += libdtv_plugin.la ...@@ -175,7 +183,8 @@ libvlc_LTLIBRARIES += libdtv_plugin.la
endif endif
EXTRA_LTLIBRARIES += \ EXTRA_LTLIBRARIES += \
libaccess_rtmp_plugin.la \ libaccess_rtmp_plugin.la \
libaccess_shm_plugin.la libaccess_shm_plugin.la \
libaccess_smb_plugin.la \
$(NULL)
...@@ -363,28 +363,12 @@ static void Win32AddConnection( access_t *p_access, char *psz_path, ...@@ -363,28 +363,12 @@ static void Win32AddConnection( access_t *p_access, char *psz_path,
char *psz_user, char *psz_pwd, char *psz_user, char *psz_pwd,
char *psz_domain ) char *psz_domain )
{ {
DWORD WINAPI (*OurWNetAddConnection2)( LPNETRESOURCE, LPCTSTR, LPCTSTR, DWORD );
char psz_remote[MAX_PATH], psz_server[MAX_PATH], psz_share[MAX_PATH]; char psz_remote[MAX_PATH], psz_server[MAX_PATH], psz_share[MAX_PATH];
NETRESOURCE net_resource; NETRESOURCE net_resource;
DWORD i_result; DWORD i_result;
char *psz_parser; char *psz_parser;
VLC_UNUSED( psz_domain ); VLC_UNUSED( psz_domain );
HINSTANCE hdll = LoadLibrary(_T("MPR.DLL"));
if( !hdll )
{
msg_Warn( p_access, "couldn't load mpr.dll" );
return;
}
OurWNetAddConnection2 =
(void *)GetProcAddress( hdll, _T("WNetAddConnection2A") );
if( !OurWNetAddConnection2 )
{
msg_Warn( p_access, "couldn't find WNetAddConnection2 in mpr.dll" );
return;
}
memset( &net_resource, 0, sizeof(net_resource) ); memset( &net_resource, 0, sizeof(net_resource) );
net_resource.dwType = RESOURCETYPE_DISK; net_resource.dwType = RESOURCETYPE_DISK;
...@@ -402,7 +386,7 @@ static void Win32AddConnection( access_t *p_access, char *psz_path, ...@@ -402,7 +386,7 @@ static void Win32AddConnection( access_t *p_access, char *psz_path,
snprintf( psz_remote, sizeof( psz_remote ), "\\\\%s\\%s", psz_server, psz_share ); snprintf( psz_remote, sizeof( psz_remote ), "\\\\%s\\%s", psz_server, psz_share );
net_resource.lpRemoteName = psz_remote; net_resource.lpRemoteName = psz_remote;
i_result = OurWNetAddConnection2( &net_resource, psz_pwd, psz_user, 0 ); i_result = WNetAddConnection2( &net_resource, psz_pwd, psz_user, 0 );
if( i_result != NO_ERROR ) if( i_result != NO_ERROR )
{ {
...@@ -417,7 +401,5 @@ static void Win32AddConnection( access_t *p_access, char *psz_path, ...@@ -417,7 +401,5 @@ static void Win32AddConnection( access_t *p_access, char *psz_path,
{ {
msg_Dbg( p_access, "failed to connect to %s", psz_remote ); msg_Dbg( p_access, "failed to connect to %s", psz_remote );
} }
FreeLibrary( hdll );
} }
#endif // WIN32 #endif // WIN32
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment