diff --git a/configure b/configure
index 2646b0b81a6de01deae00781e185c2f3e0b299d3..5f8b931335bedc54707f7a8f3a1d68b7db453319 100755
--- a/configure
+++ b/configure
@@ -15288,6 +15288,7 @@ wine_fn_config_dll monodebg.vxd enable_win16
 wine_fn_config_dll mountmgr.sys enable_mountmgr_sys
 wine_fn_config_dll mouse.drv16 enable_win16
 wine_fn_config_dll mpr enable_mpr implib,po
+wine_fn_config_test dlls/mpr/tests mpr_test
 wine_fn_config_dll mprapi enable_mprapi implib
 wine_fn_config_dll msacm.dll16 enable_win16
 wine_fn_config_dll msacm32.drv enable_msacm32_drv
diff --git a/configure.ac b/configure.ac
index a85459d66117d62bb311868188db3ee8ab2105b2..67a0af687ecaa4eea72a5348b83cdb221c54fc38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2704,6 +2704,7 @@ WINE_CONFIG_DLL(monodebg.vxd,enable_win16)
 WINE_CONFIG_DLL(mountmgr.sys)
 WINE_CONFIG_DLL(mouse.drv16,enable_win16)
 WINE_CONFIG_DLL(mpr,,[implib,po])
+WINE_CONFIG_TEST(dlls/mpr/tests)
 WINE_CONFIG_DLL(mprapi,,[implib])
 WINE_CONFIG_DLL(msacm.dll16,enable_win16)
 WINE_CONFIG_DLL(msacm32.drv)
diff --git a/dlls/mpr/tests/Makefile.in b/dlls/mpr/tests/Makefile.in
new file mode 100644
index 0000000000000000000000000000000000000000..655c49b8836dba1dd32602defa0a50c37d15cae6
--- /dev/null
+++ b/dlls/mpr/tests/Makefile.in
@@ -0,0 +1,7 @@
+TESTDLL   = mpr.dll
+IMPORTS   = mpr
+
+C_SRCS = \
+	mpr.c
+
+@MAKE_TEST_RULES@
diff --git a/dlls/mpr/tests/mpr.c b/dlls/mpr/tests/mpr.c
new file mode 100644
index 0000000000000000000000000000000000000000..d54d80dba42d799254af41a545f97d585f98fd90
--- /dev/null
+++ b/dlls/mpr/tests/mpr.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2012 Andrew Eikum for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define COBJMACROS
+
+#include <stdio.h>
+
+#include "windows.h"
+#include "winnetwk.h"
+#include "wine/test.h"
+
+static void test_WNetGetUniversalName(void)
+{
+    DWORD ret;
+    char buffer[1024];
+    DWORD drive_type, info_size;
+    char driveA[] = "A:\\";
+    WCHAR driveW[] = {'A',':','\\',0};
+
+    for(; *driveA <= 'Z'; ++*driveA, ++*driveW){
+        drive_type = GetDriveTypeW(driveW);
+
+        info_size = sizeof(buffer);
+        ret = WNetGetUniversalNameA(driveA, UNIVERSAL_NAME_INFO_LEVEL,
+                buffer, &info_size);
+
+        if(drive_type == DRIVE_REMOTE)
+            ok(ret == WN_NO_ERROR, "WNetGetUniversalNameA failed: %08x\n", ret);
+        else
+            ok(ret == ERROR_NOT_CONNECTED, "WNetGetUniversalNameA gave wrong error: %08x\n", ret);
+
+        ok(info_size == sizeof(buffer), "Got wrong size: %u\n", info_size);
+
+        info_size = sizeof(buffer);
+        ret = WNetGetUniversalNameW(driveW, UNIVERSAL_NAME_INFO_LEVEL,
+                buffer, &info_size);
+
+        if(drive_type == DRIVE_REMOTE)
+            ok(ret == WN_NO_ERROR, "WNetGetUniversalNameW failed: %08x\n", ret);
+        else
+            ok(ret == ERROR_NOT_CONNECTED, "WNetGetUniversalNameW gave wrong error: %08x\n", ret);
+
+        ok(info_size == sizeof(buffer), "Got wrong size: %u\n", info_size);
+    }
+}
+
+START_TEST(mpr)
+{
+    test_WNetGetUniversalName();
+}
diff --git a/dlls/mpr/wnet.c b/dlls/mpr/wnet.c
index 946f47e74f2a5316b372b7c86c629cf68dd07816..bdc7ad08d7222897b7f8e076abad759a2359742d 100644
--- a/dlls/mpr/wnet.c
+++ b/dlls/mpr/wnet.c
@@ -1892,6 +1892,12 @@ DWORD WINAPI WNetGetUniversalNameA ( LPCSTR lpLocalPath, DWORD dwInfoLevel,
     {
         LPUNIVERSAL_NAME_INFOA info = lpBuffer;
 
+        if (GetDriveTypeA(lpLocalPath) != DRIVE_REMOTE)
+        {
+            err = ERROR_NOT_CONNECTED;
+            break;
+        }
+
         size = sizeof(*info) + lstrlenA(lpLocalPath) + 1;
         if (*lpBufferSize < size)
         {
@@ -1900,7 +1906,6 @@ DWORD WINAPI WNetGetUniversalNameA ( LPCSTR lpLocalPath, DWORD dwInfoLevel,
         }
         info->lpUniversalName = (char *)info + sizeof(*info);
         lstrcpyA(info->lpUniversalName, lpLocalPath);
-        *lpBufferSize = size;
         err = WN_NO_ERROR;
         break;
     }
@@ -1934,6 +1939,12 @@ DWORD WINAPI WNetGetUniversalNameW ( LPCWSTR lpLocalPath, DWORD dwInfoLevel,
     {
         LPUNIVERSAL_NAME_INFOW info = lpBuffer;
 
+        if (GetDriveTypeW(lpLocalPath) != DRIVE_REMOTE)
+        {
+            err = ERROR_NOT_CONNECTED;
+            break;
+        }
+
         size = sizeof(*info) + (lstrlenW(lpLocalPath) + 1) * sizeof(WCHAR);
         if (*lpBufferSize < size)
         {
@@ -1942,7 +1953,6 @@ DWORD WINAPI WNetGetUniversalNameW ( LPCWSTR lpLocalPath, DWORD dwInfoLevel,
         }
         info->lpUniversalName = (LPWSTR)((char *)info + sizeof(*info));
         lstrcpyW(info->lpUniversalName, lpLocalPath);
-        *lpBufferSize = size;
         err = WN_NO_ERROR;
         break;
     }