rpcrt4: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-06-19 10:32:06 +02:00
parent d15d53b2e9
commit eadb037ba1
11 changed files with 42 additions and 63 deletions

View File

@ -4,6 +4,8 @@ IMPORTLIB = rpcrt4
IMPORTS = uuid advapi32
DELAYIMPORTS = iphlpapi wininet secur32 user32 ws2_32 oleaut32
EXTRADLLFLAGS = -mno-cygwin
ndr_types_EXTRAIDLFLAGS = -Oicf
C_SRCS = \

View File

@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#define COBJMACROS

View File

@ -18,9 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
@ -36,7 +33,6 @@
#include "rpcproxy.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "cpsf.h"
@ -49,7 +45,7 @@ static void format_clsid( WCHAR *buffer, const CLSID *clsid )
'%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X',
'%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','}',0};
sprintfW( buffer, clsid_formatW, clsid->Data1, clsid->Data2, clsid->Data3,
swprintf( buffer, 39, clsid_formatW, clsid->Data1, clsid->Data2, clsid->Data3,
clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3],
clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] );
@ -261,14 +257,14 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
TRACE("registering %s %s => %s\n",
debugstr_a(name), debugstr_guid(proxy->header.piid), debugstr_w(clsid));
strcpyW( keyname, interfaceW );
format_clsid( keyname + strlenW(keyname), proxy->header.piid );
lstrcpyW( keyname, interfaceW );
format_clsid( keyname + lstrlenW(keyname), proxy->header.piid );
if (RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key) == ERROR_SUCCESS) {
WCHAR num[10];
if (name)
RegSetValueExA(key, NULL, 0, REG_SZ, (const BYTE *)name, strlen(name)+1);
RegSetValueW( key, clsid32W, REG_SZ, clsid, 0 );
sprintfW(num, numformatW, proxy->header.DispatchTableCount);
swprintf(num, ARRAY_SIZE(num), numformatW, proxy->header.DispatchTableCount);
RegSetValueW( key, nummethodsW, REG_SZ, num, 0 );
RegCloseKey(key);
}
@ -277,15 +273,15 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
}
/* register clsid to point to module */
strcpyW( keyname, clsidW );
strcatW( keyname, clsid );
lstrcpyW( keyname, clsidW );
lstrcatW( keyname, clsid );
len = GetModuleFileNameW(hDll, module, ARRAY_SIZE(module));
if (len && len < sizeof(module)) {
TRACE("registering CLSID %s => %s\n", debugstr_w(clsid), debugstr_w(module));
if (RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key) == ERROR_SUCCESS) {
RegSetValueExW(key, NULL, 0, REG_SZ, (const BYTE *)psfactoryW, sizeof(psfactoryW));
if (RegCreateKeyW(key, inprocserverW, &subkey) == ERROR_SUCCESS) {
RegSetValueExW(subkey, NULL, 0, REG_SZ, (LPBYTE)module, (strlenW(module)+1)*sizeof(WCHAR));
RegSetValueExW(subkey, NULL, 0, REG_SZ, (LPBYTE)module, (lstrlenW(module)+1)*sizeof(WCHAR));
RegSetValueExW(subkey, threadingmodelW, 0, REG_SZ, (const BYTE *)bothW, sizeof(bothW));
RegCloseKey(subkey);
}
@ -325,16 +321,16 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
TRACE("unregistering %s %s\n", debugstr_a(name), debugstr_guid(proxy->header.piid));
strcpyW( keyname, interfaceW );
format_clsid( keyname + strlenW(keyname), proxy->header.piid );
lstrcpyW( keyname, interfaceW );
format_clsid( keyname + lstrlenW(keyname), proxy->header.piid );
RegDeleteTreeW(HKEY_CLASSES_ROOT, keyname);
}
pProxyFileList++;
}
/* unregister clsid */
strcpyW( keyname, clsidW );
strcatW( keyname, clsid );
lstrcpyW( keyname, clsidW );
lstrcatW( keyname, clsid );
RegDeleteTreeW(HKEY_CLASSES_ROOT, keyname);
return S_OK;

View File

@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#define COBJMACROS

View File

@ -42,7 +42,6 @@
#include "rpcndr.h"
#include "ndrtypes.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
@ -1871,7 +1870,7 @@ static inline void array_compute_and_size_conformance(
else
{
TRACE("string=%s\n", debugstr_w((LPCWSTR)pMemory));
pStubMsg->ActualCount = strlenW((LPCWSTR)pMemory)+1;
pStubMsg->ActualCount = lstrlenW((LPCWSTR)pMemory)+1;
}
if (pFormat[1] == FC_STRING_SIZED)
@ -1994,7 +1993,7 @@ static inline void array_compute_and_write_conformance(
else
{
TRACE("string=%s\n", debugstr_w((LPCWSTR)pMemory));
pStubMsg->ActualCount = strlenW((LPCWSTR)pMemory)+1;
pStubMsg->ActualCount = lstrlenW((LPCWSTR)pMemory)+1;
}
if (pFormat[1] == FC_STRING_SIZED)
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 2, 0);

View File

@ -23,9 +23,6 @@
* - Some types of binding handles
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>

View File

@ -26,7 +26,6 @@
#include "rpcndr.h"
#include "winternl.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "rpc_binding.h"
@ -93,7 +92,7 @@ static BOOL compare_networkoptions(LPCWSTR opts1, LPCWSTR opts2)
return TRUE;
if ((opts1 == NULL) || (opts2 == NULL))
return FALSE;
return !strcmpW(opts1, opts2);
return !wcscmp(opts1, opts2);
}
RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr,
@ -154,7 +153,7 @@ RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr,
(!NetworkAddr || !assoc->NetworkAddr || !strcmp(NetworkAddr, assoc->NetworkAddr)) &&
!strcmp(Endpoint, assoc->Endpoint) &&
((!assoc->NetworkOptions == !NetworkOptions) &&
(!NetworkOptions || !strcmpW(NetworkOptions, assoc->NetworkOptions))))
(!NetworkOptions || !wcscmp(NetworkOptions, assoc->NetworkOptions))))
{
assoc->refs++;
*assoc_out = assoc;

View File

@ -31,7 +31,6 @@
#include "winnls.h"
#include "winerror.h"
#include "winternl.h"
#include "wine/unicode.h"
#include "rpc.h"
#include "rpcndr.h"
@ -94,7 +93,7 @@ LPWSTR RPCRT4_strndupW(LPCWSTR src, INT slen)
DWORD len;
LPWSTR s;
if (!src) return NULL;
if (slen == -1) slen = strlenW(src);
if (slen == -1) slen = lstrlenW(src);
len = slen;
s = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR));
memcpy(s, src, len*sizeof(WCHAR));
@ -322,7 +321,7 @@ static LPSTR RPCRT4_strconcatA(LPSTR dst, LPCSTR src)
static LPWSTR RPCRT4_strconcatW(LPWSTR dst, LPCWSTR src)
{
DWORD len = strlenW(dst), slen = strlenW(src);
DWORD len = lstrlenW(dst), slen = lstrlenW(src);
LPWSTR ndst = HeapReAlloc(GetProcessHeap(), 0, dst, (len+slen+2)*sizeof(WCHAR));
if (!ndst)
{
@ -435,7 +434,7 @@ static RPC_WSTR unescape_string_binding_componentW(
{
RPC_WSTR component, p;
if (len == -1) len = strlenW(string_binding);
if (len == -1) len = lstrlenW(string_binding);
component = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*component));
if (!component) return NULL;
@ -521,11 +520,11 @@ RPC_STATUS WINAPI RpcStringBindingComposeW( RPC_WSTR ObjUuid, RPC_WSTR Protseq,
debugstr_w( Options ), StringBinding);
/* overestimate for each component for escaping of delimiters */
if (ObjUuid && *ObjUuid) len += strlenW(ObjUuid) * 2 + 1;
if (Protseq && *Protseq) len += strlenW(Protseq) * 2 + 1;
if (NetworkAddr && *NetworkAddr) len += strlenW(NetworkAddr) * 2;
if (Endpoint && *Endpoint) len += strlenW(Endpoint) * 2 + 2;
if (Options && *Options) len += strlenW(Options) * 2 + 2;
if (ObjUuid && *ObjUuid) len += lstrlenW(ObjUuid) * 2 + 1;
if (Protseq && *Protseq) len += lstrlenW(Protseq) * 2 + 1;
if (NetworkAddr && *NetworkAddr) len += lstrlenW(NetworkAddr) * 2;
if (Endpoint && *Endpoint) len += lstrlenW(Endpoint) * 2 + 2;
if (Options && *Options) len += lstrlenW(Options) * 2 + 2;
data = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
*StringBinding = data;
@ -741,7 +740,7 @@ RPC_STATUS WINAPI RpcStringBindingParseW( RPC_WSTR StringBinding, RPC_WSTR *ObjU
else HeapFree(GetProcessHeap(), 0, opt);
endpoint_already_found = TRUE;
} else {
if (strncmpW(opt, ep_opt, strlenW(ep_opt)) == 0) {
if (wcsncmp(opt, ep_opt, lstrlenW(ep_opt)) == 0) {
/* endpoint option */
if (endpoint_already_found) goto fail;
if (Endpoint) *Endpoint = unescape_string_binding_componentW(next+1, -1);
@ -1320,7 +1319,7 @@ static RPC_STATUS RpcQualityOfService_Create(const RPC_SECURITY_QOS *qos_src, BO
if (unicode)
http_credentials_dst->ServerCertificateSubject =
RPCRT4_strndupW(http_credentials_src->ServerCertificateSubject,
strlenW(http_credentials_src->ServerCertificateSubject));
lstrlenW(http_credentials_src->ServerCertificateSubject));
else
http_credentials_dst->ServerCertificateSubject =
RPCRT4_strdupAtoW((char *)http_credentials_src->ServerCertificateSubject);

View File

@ -20,9 +20,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>

View File

@ -39,7 +39,6 @@
#include "wininet.h"
#include "winternl.h"
#include "winioctl.h"
#include "wine/unicode.h"
#include "rpc.h"
#include "rpcndr.h"
@ -1912,38 +1911,38 @@ static RPC_STATUS rpcrt4_http_internet_connect(RpcConnection_http *httpc)
}
for (option = httpc->common.NetworkOptions; option;
option = (strchrW(option, ',') ? strchrW(option, ',')+1 : NULL))
option = (wcschr(option, ',') ? wcschr(option, ',')+1 : NULL))
{
static const WCHAR wszRpcProxy[] = {'R','p','c','P','r','o','x','y','=',0};
static const WCHAR wszHttpProxy[] = {'H','t','t','p','P','r','o','x','y','=',0};
if (!strncmpiW(option, wszRpcProxy, ARRAY_SIZE(wszRpcProxy)-1))
if (!wcsnicmp(option, wszRpcProxy, ARRAY_SIZE(wszRpcProxy)-1))
{
const WCHAR *value_start = option + ARRAY_SIZE(wszRpcProxy)-1;
const WCHAR *value_end;
const WCHAR *p;
value_end = strchrW(option, ',');
value_end = wcschr(option, ',');
if (!value_end)
value_end = value_start + strlenW(value_start);
value_end = value_start + lstrlenW(value_start);
for (p = value_start; p < value_end; p++)
if (*p == ':')
{
port = atoiW(p+1);
port = wcstol(p+1, NULL, 10);
value_end = p;
break;
}
TRACE("RpcProxy value is %s\n", debugstr_wn(value_start, value_end-value_start));
servername = RPCRT4_strndupW(value_start, value_end-value_start);
}
else if (!strncmpiW(option, wszHttpProxy, ARRAY_SIZE(wszHttpProxy)-1))
else if (!wcsnicmp(option, wszHttpProxy, ARRAY_SIZE(wszHttpProxy)-1))
{
const WCHAR *value_start = option + ARRAY_SIZE(wszHttpProxy)-1;
const WCHAR *value_end;
value_end = strchrW(option, ',');
value_end = wcschr(option, ',');
if (!value_end)
value_end = value_start + strlenW(value_start);
value_end = value_start + lstrlenW(value_start);
TRACE("HttpProxy value is %s\n", debugstr_wn(value_start, value_end-value_start));
proxy = RPCRT4_strndupW(value_start, value_end-value_start);
}
@ -2068,7 +2067,7 @@ static RPC_STATUS insert_content_length_header(HINTERNET request, DWORD len)
{'C','o','n','t','e','n','t','-','L','e','n','g','t','h',':',' ','%','u','\r','\n',0};
WCHAR header[ARRAY_SIZE(fmtW) + 10];
sprintfW(header, fmtW, len);
swprintf(header, ARRAY_SIZE(header), fmtW, len);
if ((HttpAddRequestHeadersW(request, header, -1, HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD))) return RPC_S_OK;
return RPC_S_SERVER_UNAVAILABLE;
}
@ -2407,7 +2406,7 @@ static DWORD auth_scheme_from_header( const WCHAR *header )
unsigned int i;
for (i = 0; i < ARRAY_SIZE(auth_schemes); i++)
{
if (!strncmpiW( header, auth_schemes[i].str, auth_schemes[i].len ) &&
if (!wcsnicmp( header, auth_schemes[i].str, auth_schemes[i].len ) &&
(header[auth_schemes[i].len] == ' ' || !header[auth_schemes[i].len])) return auth_schemes[i].scheme;
}
return 0;
@ -2474,7 +2473,7 @@ static RPC_STATUS do_authorization(HINTERNET request, SEC_WCHAR *servername,
if (creds->AuthnSchemes[0] == RPC_C_HTTP_AUTHN_SCHEME_NTLM) scheme = ntlmW;
else scheme = negotiateW;
scheme_len = strlenW( scheme );
scheme_len = lstrlenW( scheme );
if (!*auth_ptr)
{
@ -2511,7 +2510,7 @@ static RPC_STATUS do_authorization(HINTERNET request, SEC_WCHAR *servername,
p = auth_value + scheme_len;
if (!first && *p == ' ')
{
int len = strlenW(++p);
int len = lstrlenW(++p);
in.cbBuffer = decode_base64(p, len, NULL);
if (!(in.pvBuffer = HeapAlloc(GetProcessHeap(), 0, in.cbBuffer))) break;
decode_base64(p, len, in.pvBuffer);
@ -2779,8 +2778,8 @@ static RPC_STATUS rpcrt4_ncacn_http_open(RpcConnection* Connection)
memcpy(url, wszRpcProxyPrefix, sizeof(wszRpcProxyPrefix));
MultiByteToWideChar(CP_ACP, 0, Connection->NetworkAddr, -1, url+ARRAY_SIZE(wszRpcProxyPrefix)-1,
strlen(Connection->NetworkAddr)+1);
strcatW(url, wszColon);
MultiByteToWideChar(CP_ACP, 0, Connection->Endpoint, -1, url+strlenW(url), strlen(Connection->Endpoint)+1);
lstrcatW(url, wszColon);
MultiByteToWideChar(CP_ACP, 0, Connection->Endpoint, -1, url+lstrlenW(url), strlen(Connection->Endpoint)+1);
secure = is_secure(httpc);
credentials = has_credentials(httpc);

View File

@ -28,8 +28,6 @@
* NT-based native rpcrt4's. Commonly-used transport for self-to-self RPC's.
*/
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@ -46,7 +44,6 @@
#include "ntsecapi.h"
#include "iptypes.h"
#include "iphlpapi.h"
#include "wine/unicode.h"
#include "rpc.h"
#include "ole2.h"
@ -618,7 +615,7 @@ RPC_STATUS WINAPI UuidFromStringW(RPC_WSTR s, UUID *uuid)
if (!s) return UuidCreateNil( uuid );
if (strlenW(s) != 36) return RPC_S_INVALID_STRING_UUID;
if (lstrlenW(s) != 36) return RPC_S_INVALID_STRING_UUID;
if ((s[8]!='-') || (s[13]!='-') || (s[18]!='-') || (s[23]!='-'))
return RPC_S_INVALID_STRING_UUID;