mpr: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-06-11 08:29:30 +02:00
parent c1a01fd399
commit 1e117a5682
3 changed files with 27 additions and 29 deletions

View File

@ -2,6 +2,8 @@ MODULE = mpr.dll
IMPORTLIB = mpr IMPORTLIB = mpr
IMPORTS = user32 advapi32 IMPORTS = user32 advapi32
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ C_SRCS = \
auth.c \ auth.c \
mpr_main.c \ mpr_main.c \

View File

@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
@ -32,7 +30,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(mpr); WINE_DEFAULT_DEBUG_CHANNEL(mpr);
#include "wine/unicode.h"
#include "mprres.h" #include "mprres.h"

View File

@ -33,7 +33,6 @@
#define WINE_MOUNTMGR_EXTENSIONS #define WINE_MOUNTMGR_EXTENSIONS
#include "ddk/mountmgr.h" #include "ddk/mountmgr.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "mprres.h" #include "mprres.h"
#include "wnetpriv.h" #include "wnetpriv.h"
@ -136,7 +135,7 @@ static void _tryLoadProvider(PCWSTR provider)
HKEY hKey; HKEY hKey;
TRACE("%s\n", debugstr_w(provider)); TRACE("%s\n", debugstr_w(provider));
snprintfW(serviceName, ARRAY_SIZE(serviceName), serviceFmt, servicePrefix, provider); swprintf(serviceName, ARRAY_SIZE(serviceName), serviceFmt, servicePrefix, provider);
serviceName[ARRAY_SIZE(serviceName) - 1] = '\0'; serviceName[ARRAY_SIZE(serviceName) - 1] = '\0';
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, serviceName, 0, KEY_READ, &hKey) == if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, serviceName, 0, KEY_READ, &hKey) ==
ERROR_SUCCESS) ERROR_SUCCESS)
@ -297,7 +296,7 @@ void wnetInit(HINSTANCE hInstDll)
* allocate space for */ * allocate space for */
for (ptr = providers, numToAllocate = 1; ptr; ) for (ptr = providers, numToAllocate = 1; ptr; )
{ {
ptr = strchrW(ptr, ','); ptr = wcschr(ptr, ',');
if (ptr) { if (ptr) {
numToAllocate++; numToAllocate++;
ptr++; ptr++;
@ -327,7 +326,7 @@ void wnetInit(HINSTANCE hInstDll)
for (ptr = providers; ptr; ) for (ptr = providers; ptr; )
{ {
ptrPrev = ptr; ptrPrev = ptr;
ptr = strchrW(ptr, ','); ptr = wcschr(ptr, ',');
if (ptr) if (ptr)
*ptr++ = '\0'; *ptr++ = '\0';
_tryLoadProvider(ptrPrev); _tryLoadProvider(ptrPrev);
@ -368,7 +367,7 @@ static DWORD _findProviderIndexW(LPCWSTR lpProvider)
for (i = 0; i < providerTable->numProviders && for (i = 0; i < providerTable->numProviders &&
ret == BAD_PROVIDER_INDEX; i++) ret == BAD_PROVIDER_INDEX; i++)
if (!strcmpW(lpProvider, providerTable->table[i].name)) if (!lstrcmpW(lpProvider, providerTable->table[i].name))
ret = i; ret = i;
} }
return ret; return ret;
@ -393,10 +392,10 @@ static LPNETRESOURCEW _copyNetResourceForEnumW(LPNETRESOURCEW lpNet)
ret->lpLocalName = ret->lpComment = ret->lpProvider = NULL; ret->lpLocalName = ret->lpComment = ret->lpProvider = NULL;
if (lpNet->lpRemoteName) if (lpNet->lpRemoteName)
{ {
len = strlenW(lpNet->lpRemoteName) + 1; len = lstrlenW(lpNet->lpRemoteName) + 1;
ret->lpRemoteName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); ret->lpRemoteName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (ret->lpRemoteName) if (ret->lpRemoteName)
strcpyW(ret->lpRemoteName, lpNet->lpRemoteName); lstrcpyW(ret->lpRemoteName, lpNet->lpRemoteName);
} }
} }
} }
@ -806,7 +805,7 @@ DWORD WINAPI WNetOpenEnumW( DWORD dwScope, DWORD dwType, DWORD dwUsage,
PWSTR RemoteName = lpNet->lpRemoteName; PWSTR RemoteName = lpNet->lpRemoteName;
if ((lpNet->dwUsage & RESOURCEUSAGE_CONTAINER) && if ((lpNet->dwUsage & RESOURCEUSAGE_CONTAINER) &&
RemoteName && !strcmpW(RemoteName, lpNet->lpProvider)) RemoteName && !lstrcmpW(RemoteName, lpNet->lpProvider))
lpNet->lpRemoteName = NULL; lpNet->lpRemoteName = NULL;
ret = providerTable->table[index].openEnum( ret = providerTable->table[index].openEnum(
@ -835,7 +834,7 @@ DWORD WINAPI WNetOpenEnumW( DWORD dwScope, DWORD dwType, DWORD dwUsage,
} }
else else
{ {
if (lpNet->lpComment && !strcmpW(lpNet->lpComment, if (lpNet->lpComment && !lstrcmpW(lpNet->lpComment,
providerTable->entireNetwork)) providerTable->entireNetwork))
{ {
/* comment matches the "Entire Network", enumerate /* comment matches the "Entire Network", enumerate
@ -960,7 +959,7 @@ static DWORD _countProviderBytesW(PWNetProvider provider)
if (provider) if (provider)
{ {
ret = sizeof(NETRESOURCEW); ret = sizeof(NETRESOURCEW);
ret += 2 * (strlenW(provider->name) + 1) * sizeof(WCHAR); ret += 2 * (lstrlenW(provider->name) + 1) * sizeof(WCHAR);
} }
else else
ret = 0; ret = 0;
@ -1017,14 +1016,14 @@ static DWORD _enumerateProvidersW(PWNetEnumerator enumerator, LPDWORD lpcCount,
RESOURCEUSAGE_RESERVED; RESOURCEUSAGE_RESERVED;
resource->lpLocalName = NULL; resource->lpLocalName = NULL;
resource->lpRemoteName = strNext; resource->lpRemoteName = strNext;
strcpyW(resource->lpRemoteName, lstrcpyW(resource->lpRemoteName,
providerTable->table[i + enumerator->providerIndex].name); providerTable->table[i + enumerator->providerIndex].name);
strNext += strlenW(resource->lpRemoteName) + 1; strNext += lstrlenW(resource->lpRemoteName) + 1;
resource->lpComment = NULL; resource->lpComment = NULL;
resource->lpProvider = strNext; resource->lpProvider = strNext;
strcpyW(resource->lpProvider, lstrcpyW(resource->lpProvider,
providerTable->table[i + enumerator->providerIndex].name); providerTable->table[i + enumerator->providerIndex].name);
strNext += strlenW(resource->lpProvider) + 1; strNext += lstrlenW(resource->lpProvider) + 1;
} }
enumerator->providerIndex += count; enumerator->providerIndex += count;
*lpcCount = count; *lpcCount = count;
@ -1211,7 +1210,7 @@ static DWORD _enumerateContextW(PWNetEnumerator enumerator, LPDWORD lpcCount,
if (!providerTable) if (!providerTable)
return WN_NO_NETWORK; return WN_NO_NETWORK;
cchEntireNetworkLen = strlenW(providerTable->entireNetwork) + 1; cchEntireNetworkLen = lstrlenW(providerTable->entireNetwork) + 1;
bytesNeeded = sizeof(NETRESOURCEW) + cchEntireNetworkLen * sizeof(WCHAR); bytesNeeded = sizeof(NETRESOURCEW) + cchEntireNetworkLen * sizeof(WCHAR);
if (*lpBufferSize < bytesNeeded) if (*lpBufferSize < bytesNeeded)
{ {
@ -1234,7 +1233,7 @@ static DWORD _enumerateContextW(PWNetEnumerator enumerator, LPDWORD lpcCount,
*/ */
lpNet->lpComment = (LPWSTR)((LPBYTE)lpBuffer + *lpBufferSize - lpNet->lpComment = (LPWSTR)((LPBYTE)lpBuffer + *lpBufferSize -
(cchEntireNetworkLen * sizeof(WCHAR))); (cchEntireNetworkLen * sizeof(WCHAR)));
strcpyW(lpNet->lpComment, providerTable->entireNetwork); lstrcpyW(lpNet->lpComment, providerTable->entireNetwork);
ret = WN_SUCCESS; ret = WN_SUCCESS;
} }
if (ret == WN_SUCCESS) if (ret == WN_SUCCESS)
@ -1274,7 +1273,7 @@ static DWORD _copyStringToEnumW(const WCHAR *source, DWORD* left, void** end)
DWORD len; DWORD len;
WCHAR* local = *end; WCHAR* local = *end;
len = strlenW(source) + 1; len = lstrlenW(source) + 1;
len *= sizeof(WCHAR); len *= sizeof(WCHAR);
if (*left < len) if (*left < len)
return WN_MORE_DATA; return WN_MORE_DATA;
@ -1949,9 +1948,9 @@ static DWORD use_connection_pre_set_accessnameW(struct use_connection_context *c
DWORD len; DWORD len;
if (local_name) if (local_name)
len = strlenW(local_name); len = lstrlenW(local_name);
else else
len = strlenW(ctxt->resource->lpRemoteName); len = lstrlenW(ctxt->resource->lpRemoteName);
if (++len > *ctxt->buffer_size) if (++len > *ctxt->buffer_size)
{ {
@ -1970,12 +1969,12 @@ static void use_connection_set_accessnameW(struct use_connection_context *ctxt,
WCHAR *accessname = ctxt->accessname; WCHAR *accessname = ctxt->accessname;
if (local_name) if (local_name)
{ {
strcpyW(accessname, local_name); lstrcpyW(accessname, local_name);
if (ctxt->result) if (ctxt->result)
*ctxt->result = CONNECT_LOCALDRIVE; *ctxt->result = CONNECT_LOCALDRIVE;
} }
else else
strcpyW(accessname, ctxt->resource->lpRemoteName); lstrcpyW(accessname, ctxt->resource->lpRemoteName);
} }
static DWORD wnet_use_provider( struct use_connection_context *ctxt, NETRESOURCEW * netres, WNetProvider *provider, BOOLEAN redirect ) static DWORD wnet_use_provider( struct use_connection_context *ctxt, NETRESOURCEW * netres, WNetProvider *provider, BOOLEAN redirect )
@ -2082,13 +2081,13 @@ static DWORD wnet_use_connection( struct use_connection_context *ctxt )
KEY_ALL_ACCESS, NULL, &network, NULL) == ERROR_SUCCESS) KEY_ALL_ACCESS, NULL, &network, NULL) == ERROR_SUCCESS)
{ {
DWORD dword_arg = RESOURCETYPE_DISK; DWORD dword_arg = RESOURCETYPE_DISK;
DWORD len = (strlenW(provider->name) + 1) * sizeof(WCHAR); DWORD len = (lstrlenW(provider->name) + 1) * sizeof(WCHAR);
static const WCHAR empty[1] = {0}; static const WCHAR empty[1] = {0};
RegSetValueExW(network, connectionType, 0, REG_DWORD, (const BYTE *)&dword_arg, sizeof(DWORD)); RegSetValueExW(network, connectionType, 0, REG_DWORD, (const BYTE *)&dword_arg, sizeof(DWORD));
RegSetValueExW(network, providerName, 0, REG_SZ, (const BYTE *)provider->name, len); RegSetValueExW(network, providerName, 0, REG_SZ, (const BYTE *)provider->name, len);
RegSetValueExW(network, providerType, 0, REG_DWORD, (const BYTE *)&provider->dwNetType, sizeof(DWORD)); RegSetValueExW(network, providerType, 0, REG_DWORD, (const BYTE *)&provider->dwNetType, sizeof(DWORD));
len = (strlenW(netres.lpRemoteName) + 1) * sizeof(WCHAR); len = (lstrlenW(netres.lpRemoteName) + 1) * sizeof(WCHAR);
RegSetValueExW(network, remotePath, 0, REG_SZ, (const BYTE *)netres.lpRemoteName, len); RegSetValueExW(network, remotePath, 0, REG_SZ, (const BYTE *)netres.lpRemoteName, len);
len = sizeof(empty); len = sizeof(empty);
RegSetValueExW(network, userName, 0, REG_SZ, (const BYTE *)empty, len); RegSetValueExW(network, userName, 0, REG_SZ, (const BYTE *)empty, len);
@ -2296,7 +2295,7 @@ DWORD WINAPI WNetCancelConnection2W( LPCWSTR lpName, DWORD dwFlags, BOOL fForce
HKEY user_profile; HKEY user_profile;
/* FIXME: Only remove it if that's a drive letter */ /* FIXME: Only remove it if that's a drive letter */
if (isalphaW(lpName[0]) && lpName[1] == ':' && if (iswalpha(lpName[0]) && lpName[1] == ':' &&
RegOpenCurrentUser(KEY_ALL_ACCESS, &user_profile) == ERROR_SUCCESS) RegOpenCurrentUser(KEY_ALL_ACCESS, &user_profile) == ERROR_SUCCESS)
{ {
WCHAR subkey[10] = {'N', 'e', 't', 'w', 'o', 'r', 'k', '\\', lpName[0], 0}; WCHAR subkey[10] = {'N', 'e', 't', 'w', 'o', 'r', 'k', '\\', lpName[0], 0};
@ -3005,7 +3004,7 @@ DWORD WINAPI WNetGetProviderNameW( DWORD dwNetType,
; ;
if (i < providerTable->numProviders) if (i < providerTable->numProviders)
{ {
DWORD sizeNeeded = strlenW(providerTable->table[i].name) + 1; DWORD sizeNeeded = lstrlenW(providerTable->table[i].name) + 1;
if (*lpBufferSize < sizeNeeded) if (*lpBufferSize < sizeNeeded)
{ {
@ -3014,7 +3013,7 @@ DWORD WINAPI WNetGetProviderNameW( DWORD dwNetType,
} }
else else
{ {
strcpyW(lpProvider, providerTable->table[i].name); lstrcpyW(lpProvider, providerTable->table[i].name);
ret = WN_SUCCESS; ret = WN_SUCCESS;
/* FIXME: is *lpBufferSize set to the number of characters /* FIXME: is *lpBufferSize set to the number of characters
* copied? */ * copied? */