Commit d452c757 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

rpcrt4: Use wide-char string literals.

parent 875f506b
......@@ -41,11 +41,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
static void format_clsid( WCHAR *buffer, const CLSID *clsid )
{
static const WCHAR clsid_formatW[] = {'{','%','0','8','X','-','%','0','4','X','-','%','0','4','X','-',
'%','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};
swprintf( buffer, 39, clsid_formatW, clsid->Data1, clsid->Data2, clsid->Data3,
swprintf( buffer, 39, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
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] );
......@@ -222,15 +219,6 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
const ProxyFileInfo **pProxyFileList,
const CLSID *pclsid)
{
static const WCHAR bothW[] = {'B','o','t','h',0};
static const WCHAR clsidW[] = {'C','L','S','I','D','\\',0};
static const WCHAR clsid32W[] = {'P','r','o','x','y','S','t','u','b','C','l','s','i','d','3','2',0};
static const WCHAR interfaceW[] = {'I','n','t','e','r','f','a','c','e','\\',0};
static const WCHAR psfactoryW[] = {'P','S','F','a','c','t','o','r','y','B','u','f','f','e','r',0};
static const WCHAR numformatW[] = {'%','u',0};
static const WCHAR nummethodsW[] = {'N','u','m','M','e','t','h','o','d','s',0};
static const WCHAR inprocserverW[] = {'I','n','P','r','o','c','S','e','r','v','e','r','3','2',0};
static const WCHAR threadingmodelW[] = {'T','h','r','e','a','d','i','n','g','M','o','d','e','l',0};
WCHAR clsid[39], keyname[50], module[MAX_PATH];
HKEY key, subkey;
DWORD len;
......@@ -257,15 +245,15 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
TRACE("registering %s %s => %s\n",
debugstr_a(name), debugstr_guid(proxy->header.piid), debugstr_w(clsid));
lstrcpyW( keyname, interfaceW );
lstrcpyW( keyname, L"Interface\\" );
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 );
swprintf(num, ARRAY_SIZE(num), numformatW, proxy->header.DispatchTableCount);
RegSetValueW( key, nummethodsW, REG_SZ, num, 0 );
RegSetValueW( key, L"ProxyStubClsid32", REG_SZ, clsid, 0 );
swprintf(num, ARRAY_SIZE(num), L"%u", proxy->header.DispatchTableCount);
RegSetValueW( key, L"NumMethods", REG_SZ, num, 0 );
RegCloseKey(key);
}
}
......@@ -273,16 +261,16 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
}
/* register clsid to point to module */
lstrcpyW( keyname, clsidW );
lstrcpyW( keyname, L"CLSID\\" );
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(key, NULL, 0, REG_SZ, (const BYTE *)L"PSFactoryBuffer", sizeof(L"PSFactoryBuffer"));
if (RegCreateKeyW(key, L"InProcServer32", &subkey) == ERROR_SUCCESS) {
RegSetValueExW(subkey, NULL, 0, REG_SZ, (LPBYTE)module, (lstrlenW(module)+1)*sizeof(WCHAR));
RegSetValueExW(subkey, threadingmodelW, 0, REG_SZ, (const BYTE *)bothW, sizeof(bothW));
RegSetValueExW(subkey, L"ThreadingModel", 0, REG_SZ, (const BYTE *)L"Both", sizeof(L"Both"));
RegCloseKey(subkey);
}
RegCloseKey(key);
......@@ -299,8 +287,6 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
const ProxyFileInfo **pProxyFileList,
const CLSID *pclsid)
{
static const WCHAR clsidW[] = {'C','L','S','I','D','\\',0};
static const WCHAR interfaceW[] = {'I','n','t','e','r','f','a','c','e','\\',0};
WCHAR keyname[50];
WCHAR clsid[39];
......@@ -321,7 +307,7 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
TRACE("unregistering %s %s\n", debugstr_a(name), debugstr_guid(proxy->header.piid));
lstrcpyW( keyname, interfaceW );
lstrcpyW( keyname, L"Interface\\" );
format_clsid( keyname + lstrlenW(keyname), proxy->header.piid );
RegDeleteTreeW(HKEY_CLASSES_ROOT, keyname);
}
......@@ -329,7 +315,7 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
}
/* unregister clsid */
lstrcpyW( keyname, clsidW );
lstrcpyW( keyname, L"CLSID\\" );
lstrcatW( keyname, clsid );
RegDeleteTreeW(HKEY_CLASSES_ROOT, keyname);
......
......@@ -676,7 +676,6 @@ RPC_STATUS WINAPI RpcStringBindingParseW( RPC_WSTR StringBinding, RPC_WSTR *ObjU
RPC_WSTR *Endpoint, RPC_WSTR *Options)
{
const WCHAR *data, *next;
static const WCHAR ep_opt[] = {'e','n','d','p','o','i','n','t','=',0};
BOOL endpoint_already_found = FALSE;
TRACE("(%s,%p,%p,%p,%p,%p)\n", debugstr_w(StringBinding),
......@@ -740,7 +739,7 @@ RPC_STATUS WINAPI RpcStringBindingParseW( RPC_WSTR StringBinding, RPC_WSTR *ObjU
else HeapFree(GetProcessHeap(), 0, opt);
endpoint_already_found = TRUE;
} else {
if (wcsncmp(opt, ep_opt, lstrlenW(ep_opt)) == 0) {
if (wcsncmp(opt, L"endpoint=", lstrlenW(L"endpoint=")) == 0) {
/* endpoint option */
if (endpoint_already_found) goto fail;
if (Endpoint) *Endpoint = unescape_string_binding_componentW(next+1, -1);
......
......@@ -78,7 +78,6 @@ static const struct epm_endpoints
static BOOL start_rpcss(void)
{
static const WCHAR rpcssW[] = {'R','p','c','S','s',0};
SC_HANDLE scm, service;
SERVICE_STATUS_PROCESS status;
BOOL ret = FALSE;
......@@ -90,7 +89,7 @@ static BOOL start_rpcss(void)
ERR( "failed to open service manager\n" );
return FALSE;
}
if (!(service = OpenServiceW( scm, rpcssW, SERVICE_START | SERVICE_QUERY_STATUS )))
if (!(service = OpenServiceW( scm, L"RpcSs", SERVICE_START | SERVICE_QUERY_STATUS )))
{
ERR( "failed to open RpcSs service\n" );
CloseServiceHandle( scm );
......
......@@ -1874,7 +1874,6 @@ static RPC_STATUS rpcrt4_http_check_response(HINTERNET hor)
static RPC_STATUS rpcrt4_http_internet_connect(RpcConnection_http *httpc)
{
static const WCHAR wszUserAgent[] = {'M','S','R','P','C',0};
LPWSTR proxy = NULL;
LPWSTR user = NULL;
LPWSTR password = NULL;
......@@ -1912,12 +1911,9 @@ static RPC_STATUS rpcrt4_http_internet_connect(RpcConnection_http *httpc)
for (option = httpc->common.NetworkOptions; option;
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 (!wcsnicmp(option, wszRpcProxy, ARRAY_SIZE(wszRpcProxy)-1))
if (!wcsnicmp(option, L"RpcProxy=", ARRAY_SIZE(L"RpcProxy=")-1))
{
const WCHAR *value_start = option + ARRAY_SIZE(wszRpcProxy)-1;
const WCHAR *value_start = option + ARRAY_SIZE(L"RpcProxy=")-1;
const WCHAR *value_end;
const WCHAR *p;
......@@ -1934,9 +1930,9 @@ static RPC_STATUS rpcrt4_http_internet_connect(RpcConnection_http *httpc)
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 (!wcsnicmp(option, wszHttpProxy, ARRAY_SIZE(wszHttpProxy)-1))
else if (!wcsnicmp(option, L"HttpProxy=", ARRAY_SIZE(L"HttpProxy=")-1))
{
const WCHAR *value_start = option + ARRAY_SIZE(wszHttpProxy)-1;
const WCHAR *value_start = option + ARRAY_SIZE(L"HttpProxy=")-1;
const WCHAR *value_end;
value_end = wcschr(option, ',');
......@@ -1949,7 +1945,7 @@ static RPC_STATUS rpcrt4_http_internet_connect(RpcConnection_http *httpc)
FIXME("unhandled option %s\n", debugstr_w(option));
}
httpc->app_info = InternetOpenW(wszUserAgent, proxy ? INTERNET_OPEN_TYPE_PROXY : INTERNET_OPEN_TYPE_PRECONFIG,
httpc->app_info = InternetOpenW(L"MSRPC", proxy ? INTERNET_OPEN_TYPE_PROXY : INTERNET_OPEN_TYPE_PRECONFIG,
NULL, NULL, INTERNET_FLAG_ASYNC);
if (!httpc->app_info)
{
......@@ -2062,11 +2058,9 @@ static RPC_STATUS send_echo_request(HINTERNET req, RpcHttpAsyncData *async_data,
static RPC_STATUS insert_content_length_header(HINTERNET request, DWORD len)
{
static const WCHAR fmtW[] =
{'C','o','n','t','e','n','t','-','L','e','n','g','t','h',':',' ','%','u','\r','\n',0};
WCHAR header[ARRAY_SIZE(fmtW) + 10];
WCHAR header[ARRAY_SIZE(L"Content-Length: %u\r\n") + 10];
swprintf(header, ARRAY_SIZE(header), fmtW, len);
swprintf(header, ARRAY_SIZE(header), L"Content-Length: %u\r\n", len);
if ((HttpAddRequestHeadersW(request, header, -1, HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD))) return RPC_S_OK;
return RPC_S_SERVER_UNAVAILABLE;
}
......@@ -2379,12 +2373,6 @@ static void destroy_authinfo(struct authinfo *info)
HeapFree(GetProcessHeap(), 0, info);
}
static const WCHAR basicW[] = {'B','a','s','i','c',0};
static const WCHAR ntlmW[] = {'N','T','L','M',0};
static const WCHAR passportW[] = {'P','a','s','s','p','o','r','t',0};
static const WCHAR digestW[] = {'D','i','g','e','s','t',0};
static const WCHAR negotiateW[] = {'N','e','g','o','t','i','a','t','e',0};
static const struct
{
const WCHAR *str;
......@@ -2393,11 +2381,11 @@ static const struct
}
auth_schemes[] =
{
{ basicW, ARRAY_SIZE(basicW) - 1, RPC_C_HTTP_AUTHN_SCHEME_BASIC },
{ ntlmW, ARRAY_SIZE(ntlmW) - 1, RPC_C_HTTP_AUTHN_SCHEME_NTLM },
{ passportW, ARRAY_SIZE(passportW) - 1, RPC_C_HTTP_AUTHN_SCHEME_PASSPORT },
{ digestW, ARRAY_SIZE(digestW) - 1, RPC_C_HTTP_AUTHN_SCHEME_DIGEST },
{ negotiateW, ARRAY_SIZE(negotiateW) - 1, RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE }
{ L"Basic", ARRAY_SIZE(L"Basic") - 1, RPC_C_HTTP_AUTHN_SCHEME_BASIC },
{ L"NTLM", ARRAY_SIZE(L"NTLM") - 1, RPC_C_HTTP_AUTHN_SCHEME_NTLM },
{ L"Passport", ARRAY_SIZE(L"Passport") - 1, RPC_C_HTTP_AUTHN_SCHEME_PASSPORT },
{ L"Digest", ARRAY_SIZE(L"Digest") - 1, RPC_C_HTTP_AUTHN_SCHEME_DIGEST },
{ L"Negotiate", ARRAY_SIZE(L"Negotiate") - 1, RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE }
};
static DWORD auth_scheme_from_header( const WCHAR *header )
......@@ -2458,7 +2446,7 @@ static RPC_STATUS do_authorization(HINTERNET request, SEC_WCHAR *servername,
case RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE:
{
static SEC_WCHAR ntlmW[] = {'N','T','L','M',0}, negotiateW[] = {'N','e','g','o','t','i','a','t','e',0};
static SEC_WCHAR ntlmW[] = L"NTLM", negotiateW[] = L"Negotiate";
SECURITY_STATUS ret;
SecBufferDesc out_desc, in_desc;
SecBuffer out, in;
......@@ -2634,7 +2622,6 @@ static void drain_content(HINTERNET request, RpcHttpAsyncData *async_data, HANDL
static RPC_STATUS authorize_request(RpcConnection_http *httpc, HINTERNET request)
{
static const WCHAR authW[] = {'A','u','t','h','o','r','i','z','a','t','i','o','n',':','\r','\n',0};
struct authinfo *info = NULL;
RPC_STATUS status;
BOOL ret;
......@@ -2658,7 +2645,7 @@ static RPC_STATUS authorize_request(RpcConnection_http *httpc, HINTERNET request
}
if (info->scheme != RPC_C_HTTP_AUTHN_SCHEME_BASIC)
HttpAddRequestHeadersW(request, authW, -1, HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD);
HttpAddRequestHeadersW(request, L"Authorization:\r\n", -1, HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD);
destroy_authinfo(info);
return status;
......@@ -2691,8 +2678,8 @@ static BOOL is_secure(RpcConnection_http *httpc)
static RPC_STATUS set_auth_cookie(RpcConnection_http *httpc, const WCHAR *value)
{
static WCHAR httpW[] = {'h','t','t','p',0};
static WCHAR httpsW[] = {'h','t','t','p','s',0};
static WCHAR httpW[] = L"http";
static WCHAR httpsW[] = L"https";
URL_COMPONENTSW uc;
DWORD len;
WCHAR *url;
......@@ -2737,12 +2724,8 @@ static RPC_STATUS set_auth_cookie(RpcConnection_http *httpc, const WCHAR *value)
static RPC_STATUS rpcrt4_ncacn_http_open(RpcConnection* Connection)
{
RpcConnection_http *httpc = (RpcConnection_http *)Connection;
static const WCHAR wszVerbIn[] = {'R','P','C','_','I','N','_','D','A','T','A',0};
static const WCHAR wszVerbOut[] = {'R','P','C','_','O','U','T','_','D','A','T','A',0};
static const WCHAR wszRpcProxyPrefix[] = {'/','r','p','c','/','r','p','c','p','r','o','x','y','.','d','l','l','?',0};
static const WCHAR wszColon[] = {':',0};
static const WCHAR wszAcceptType[] = {'a','p','p','l','i','c','a','t','i','o','n','/','r','p','c',0};
LPCWSTR wszAcceptTypes[] = { wszAcceptType, NULL };
static const WCHAR wszRpcProxyPrefix[] = L"/rpc/rpcproxy.dll?";
LPCWSTR wszAcceptTypes[] = { L"application/rpc", NULL };
DWORD flags;
WCHAR *url;
RPC_STATUS status;
......@@ -2777,7 +2760,7 @@ 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);
lstrcatW(url, wszColon);
lstrcatW(url, L":");
MultiByteToWideChar(CP_ACP, 0, Connection->Endpoint, -1, url+lstrlenW(url), strlen(Connection->Endpoint)+1);
secure = is_secure(httpc);
......@@ -2794,7 +2777,7 @@ static RPC_STATUS rpcrt4_ncacn_http_open(RpcConnection* Connection)
HeapFree(GetProcessHeap(), 0, url);
return status;
}
httpc->in_request = HttpOpenRequestW(httpc->session, wszVerbIn, url, NULL, NULL, wszAcceptTypes,
httpc->in_request = HttpOpenRequestW(httpc->session, L"RPC_IN_DATA", url, NULL, NULL, wszAcceptTypes,
flags, (DWORD_PTR)httpc->async_data);
if (!httpc->in_request)
{
......@@ -2820,7 +2803,7 @@ static RPC_STATUS rpcrt4_ncacn_http_open(RpcConnection* Connection)
drain_content(httpc->in_request, httpc->async_data, httpc->cancel_event);
}
httpc->out_request = HttpOpenRequestW(httpc->session, wszVerbOut, url, NULL, NULL, wszAcceptTypes,
httpc->out_request = HttpOpenRequestW(httpc->session, L"RPC_OUT_DATA", url, NULL, NULL, wszAcceptTypes,
flags, (DWORD_PTR)httpc->async_data);
HeapFree(GetProcessHeap(), 0, url);
if (!httpc->out_request)
......
......@@ -1165,7 +1165,6 @@ enum firewall_op
static HRESULT set_firewall( enum firewall_op op )
{
static const WCHAR testW[] = {'r','p','c','r','t','4','_','t','e','s','t',0};
HRESULT hr, init;
INetFwMgr *mgr = NULL;
INetFwPolicy *policy = NULL;
......@@ -1205,7 +1204,7 @@ static HRESULT set_firewall( enum firewall_op op )
hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
if (hr != S_OK) goto done;
name = SysAllocString( testW );
name = SysAllocString( L"rpcrt4_test" );
hr = INetFwAuthorizedApplication_put_Name( app, name );
SysFreeString( name );
ok( hr == S_OK, "got %08x\n", hr );
......
......@@ -245,9 +245,6 @@ static void (__cdecl *test_handle)(ctx_handle_t ctx_handle);
/* type check statements generated in header file */
fnprintf *p_printf = printf;
static const WCHAR helloW[] = { 'H','e','l','l','o',0 };
static const WCHAR worldW[] = { 'W','o','r','l','d','!',0 };
static BOOL is_interp;
static void set_interp_interface(void)
......@@ -833,10 +830,10 @@ void __cdecl s_get_namesw(int *n, wstr_array_t *names)
wstr_array_t list;
list = MIDL_user_allocate(2 * sizeof(list[0]));
list[0] = MIDL_user_allocate(sizeof(helloW));
lstrcpyW(list[0], helloW);
list[1] = MIDL_user_allocate(sizeof(worldW));
lstrcpyW(list[1], worldW);
list[0] = MIDL_user_allocate(sizeof(L"Hello"));
lstrcpyW(list[0], L"Hello");
list[1] = MIDL_user_allocate(sizeof(L"World!"));
lstrcpyW(list[1], L"World!");
*names = list;
*n = 2;
......@@ -1157,7 +1154,7 @@ static void
basic_tests(void)
{
char string[] = "I am a string";
WCHAR wstring[] = {'I',' ','a','m',' ','a',' ','w','s','t','r','i','n','g', 0};
WCHAR wstring[] = L"I am a wstring";
int f[5] = {1, 3, 0, -2, -4};
vector_t a = {1, 3, 7};
vector_t vec1 = {4, -2, 1}, vec2 = {-5, 2, 3}, *pvec2 = &vec2;
......@@ -1599,8 +1596,8 @@ pointer_tests(void)
namesw = NULL;
get_namesw(&n, &namesw);
ok(n == 2, "expected 2, got %d\n", n);
ok(!lstrcmpW(namesw[0], helloW), "expected Hello, got %s\n", wine_dbgstr_w(namesw[0]));
ok(!lstrcmpW(namesw[1], worldW), "expected World!, got %s\n", wine_dbgstr_w(namesw[1]));
ok(!lstrcmpW(namesw[0], L"Hello"), "expected Hello, got %s\n", wine_dbgstr_w(namesw[0]));
ok(!lstrcmpW(namesw[1], L"World!"), "expected World!, got %s\n", wine_dbgstr_w(namesw[1]));
MIDL_user_free(namesw[0]);
MIDL_user_free(namesw[1]);
MIDL_user_free(namesw);
......@@ -2464,7 +2461,6 @@ enum firewall_op
static HRESULT set_firewall( enum firewall_op op )
{
static const WCHAR testW[] = {'r','p','c','r','t','4','_','t','e','s','t',0};
HRESULT hr, init;
INetFwMgr *mgr = NULL;
INetFwPolicy *policy = NULL;
......@@ -2504,7 +2500,7 @@ static HRESULT set_firewall( enum firewall_op op )
hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
if (hr != S_OK) goto done;
name = SysAllocString( testW );
name = SysAllocString( L"rpcrt4_test" );
hr = INetFwAuthorizedApplication_put_Name( app, name );
SysFreeString( name );
ok( hr == S_OK, "got %08x\n", hr );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment