[MPR]
authorPierre Schweitzer <pierre@reactos.org>
Fri, 30 Dec 2016 20:30:28 +0000 (20:30 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Fri, 30 Dec 2016 20:30:28 +0000 (20:30 +0000)
Enumerate connections capability before looking for functions entry points.
This is a major fix, because it allows VBoxSF to work without a hack, and without necessarily make a connection from the NP to the VBoxSF driver.

Already sent upstream.

ROSAPPS-303
CORE-11757

svn path=/trunk/; revision=73489

reactos/dll/win32/mpr/mpr_ros.diff
reactos/dll/win32/mpr/wnet.c

index 349f7ac..cea15b7 100644 (file)
@@ -64,7 +64,8 @@ Index: wnet.c
                          provider->addConnection3 = MPR_GETPROC(NPAddConnection3);\r
                          provider->cancelConnection = MPR_GETPROC(NPCancelConnection);\r
 +#ifdef __REACTOS__\r
-+                        provider->getConnection = MPR_GETPROC(NPGetConnection);\r
++                        if (connectCap & WNNC_CON_GETCONNECTIONS)\r
++                            provider->getConnection = MPR_GETPROC(NPGetConnection);\r
 +#endif\r
                          TRACE("NPAddConnection %p\n", provider->addConnection);\r
                          TRACE("NPAddConnection3 %p\n", provider->addConnection3);\r
index 4c47ec1..1cdddeb 100644 (file)
@@ -171,6 +171,7 @@ static void _tryLoadProvider(PCWSTR provider)
                     TRACE("loaded lib %p\n", hLib);
                     if (getCaps)
                     {
+                        DWORD connectCap;
                         PWNetProvider provider =
                          &providerTable->table[providerTable->numProviders];
 
@@ -204,11 +205,16 @@ static void _tryLoadProvider(PCWSTR provider)
                                 WARN("Couldn't load enumeration functions\n");
                             }
                         }
-                        provider->addConnection = MPR_GETPROC(NPAddConnection);
+                        connectCap = getCaps(WNNC_CONNECTION);
+                        if (connectCap & WNNC_CON_ADDCONNECTION)
+                            provider->addConnection = MPR_GETPROC(NPAddConnection);
+                        if (connectCap & WNNC_CON_ADDCONNECTION3)
                         provider->addConnection3 = MPR_GETPROC(NPAddConnection3);
-                        provider->cancelConnection = MPR_GETPROC(NPCancelConnection);
+                        if (connectCap & WNNC_CON_CANCELCONNECTION)
+                            provider->cancelConnection = MPR_GETPROC(NPCancelConnection);
 #ifdef __REACTOS__
-                        provider->getConnection = MPR_GETPROC(NPGetConnection);
+                        if (connectCap & WNNC_CON_GETCONNECTIONS)
+                            provider->getConnection = MPR_GETPROC(NPGetConnection);
 #endif
                         TRACE("NPAddConnection %p\n", provider->addConnection);
                         TRACE("NPAddConnection3 %p\n", provider->addConnection3);