]> git.sesse.net Git - vlc/commitdiff
Use WNetAddConnection2 directly
authorRémi Denis-Courmont <remi@remlab.net>
Tue, 23 Aug 2011 15:54:55 +0000 (18:54 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 23 Aug 2011 15:32:38 +0000 (18:32 +0300)
modules/access/Modules.am
modules/access/smb.c

index b2b041eed4898a2b8cc314ecb770094adb725421..2db7a4ccfd18f1b3501abb95e8fe972fdf9e57d7 100644 (file)
@@ -34,13 +34,21 @@ libsdp_plugin_la_CFLAGS = $(AM_CFLAGS)
 libsdp_plugin_la_LIBADD = $(AM_LIBADD)
 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_dv = dv.c
 SOURCES_access_udp = udp.c
 SOURCES_access_tcp = tcp.c
 SOURCES_access_http = http.c
 SOURCES_access_ftp = ftp.c
-SOURCES_access_smb = smb.c
 SOURCES_access_gnomevfs = gnomevfs.c
 SOURCES_access_eyetv = eyetv.m
 SOURCES_dvdnav = dvdnav.c
@@ -175,7 +183,8 @@ libvlc_LTLIBRARIES += libdtv_plugin.la
 endif
 
 
-
 EXTRA_LTLIBRARIES += \
        libaccess_rtmp_plugin.la \
-       libaccess_shm_plugin.la
+       libaccess_shm_plugin.la \
+       libaccess_smb_plugin.la \
+       $(NULL)
index d2e44b1b52bbf482bf796129741684e120a7fc5e..693f920bf2b521859159df45b7de70625ef190f0 100644 (file)
@@ -363,28 +363,12 @@ static void Win32AddConnection( access_t *p_access, char *psz_path,
                                 char *psz_user, char *psz_pwd,
                                 char *psz_domain )
 {
-    DWORD WINAPI (*OurWNetAddConnection2)( LPNETRESOURCE, LPCTSTR, LPCTSTR, DWORD );
     char psz_remote[MAX_PATH], psz_server[MAX_PATH], psz_share[MAX_PATH];
     NETRESOURCE net_resource;
     DWORD i_result;
     char *psz_parser;
     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) );
     net_resource.dwType = RESOURCETYPE_DISK;
 
@@ -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 );
     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 )
     {
@@ -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 );
     }
-
-    FreeLibrary( hdll );
 }
 #endif // WIN32