mpr: Don't succeed if drive is not remote in WNetGetUniversalName.
This commit is contained in:
parent
110249d664
commit
76880ff933
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
TESTDLL = mpr.dll
|
||||
IMPORTS = mpr
|
||||
|
||||
C_SRCS = \
|
||||
mpr.c
|
||||
|
||||
@MAKE_TEST_RULES@
|
|
@ -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();
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue