hlink: Use wide-char string literals.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2020-10-03 20:28:12 +02:00 committed by Alexandre Julliard
parent 69e612c512
commit d9e109fd92
4 changed files with 14 additions and 29 deletions

View File

@ -98,8 +98,6 @@ static ULONG WINAPI IHlinkBC_fnRelease (IHlinkBrowseContext* iface)
return ref;
}
static const WCHAR szIdent[] = {'W','I','N','E','H','L','I','N','K',0};
static HRESULT WINAPI IHlinkBC_Register(IHlinkBrowseContext* iface,
DWORD dwReserved, IUnknown *piunk, IMoniker *pimk, DWORD *pdwRegister)
{
@ -111,7 +109,7 @@ static HRESULT WINAPI IHlinkBC_Register(IHlinkBrowseContext* iface,
FIXME("(%p)->(%i %p %p %p)\n", This, dwReserved, piunk, pimk, pdwRegister);
hr = CreateItemMoniker(NULL, szIdent, &mon);
hr = CreateItemMoniker(NULL, L"WINEHLINK", &mon);
if (FAILED(hr))
return hr;
CreateGenericComposite(mon, pimk, &composite);
@ -137,7 +135,7 @@ static HRESULT WINAPI IHlinkBC_GetObject(IHlinkBrowseContext* iface,
TRACE("(%p)->(%p, %d, %p)\n", This, pimk, fBindifRootRegistered, ppiunk);
hr = CreateItemMoniker(NULL, szIdent, &mon);
hr = CreateItemMoniker(NULL, L"WINEHLINK", &mon);
if (FAILED(hr)) return hr;
CreateGenericComposite(mon, pimk, &composite);

View File

@ -245,10 +245,9 @@ static HRESULT ExtServ_ImplSetAdditionalHeaders(ExtensionService* This, LPCWSTR
len = lstrlenW(pwzAdditionalHeaders);
if(len && pwzAdditionalHeaders[len-1] != '\n' && pwzAdditionalHeaders[len-1] != '\r') {
static const WCHAR endlW[] = {'\r','\n',0};
This->headers = heap_alloc(len*sizeof(WCHAR) + sizeof(endlW));
This->headers = heap_alloc(len*sizeof(WCHAR) + sizeof(L"\r\n"));
memcpy(This->headers, pwzAdditionalHeaders, len*sizeof(WCHAR));
memcpy(This->headers+len, endlW, sizeof(endlW));
memcpy(This->headers+len, L"\r\n", sizeof(L"\r\n"));
}else {
This->headers = hlink_strdupW(pwzAdditionalHeaders);
}

View File

@ -273,8 +273,6 @@ HRESULT WINAPI HlinkIsShortcut(LPCWSTR pwzFileName)
{
int len;
static const WCHAR url_ext[] = {'.','u','r','l',0};
TRACE("(%s)\n", debugstr_w(pwzFileName));
if(!pwzFileName)
@ -284,7 +282,7 @@ HRESULT WINAPI HlinkIsShortcut(LPCWSTR pwzFileName)
if(len < 0)
return S_FALSE;
return wcsicmp(pwzFileName+len, url_ext) ? S_FALSE : S_OK;
return wcsicmp(pwzFileName+len, L".url") ? S_FALSE : S_OK;
}
/***********************************************************************
@ -297,25 +295,16 @@ HRESULT WINAPI HlinkGetSpecialReference(ULONG uReference, LPWSTR *ppwzReference)
WCHAR *buf;
HKEY hkey;
static const WCHAR start_pageW[] = {'S','t','a','r','t',' ','P','a','g','e',0};
static const WCHAR search_pageW[] = {'S','e','a','r','c','h',' ','P','a','g','e',0};
static const WCHAR ie_main_keyW[] =
{'S','o','f','t','w','a','r','e',
'\\','M','i','c','r','o','s','o','f','t','\\',
'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r',
'\\','M','a','i','n',0};
TRACE("(%u %p)\n", uReference, ppwzReference);
*ppwzReference = NULL;
switch(uReference) {
case HLSR_HOME:
value_name = start_pageW;
value_name = L"Start Page";
break;
case HLSR_SEARCHPAGE:
value_name = search_pageW;
value_name = L"Search Page";
break;
case HLSR_HISTORYFOLDER:
return E_NOTIMPL;
@ -323,7 +312,7 @@ HRESULT WINAPI HlinkGetSpecialReference(ULONG uReference, LPWSTR *ppwzReference)
return E_INVALIDARG;
}
res = RegOpenKeyW(HKEY_CURRENT_USER, ie_main_keyW, &hkey);
res = RegOpenKeyW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Internet Explorer\\Main", &hkey);
if(res != ERROR_SUCCESS) {
WARN("Could not open key: %u\n", res);
return HRESULT_FROM_WIN32(res);
@ -380,8 +369,7 @@ HRESULT WINAPI HlinkUpdateStackItem(IHlinkFrame *frame, IHlinkBrowseContext *bc,
HRESULT WINAPI HlinkParseDisplayName(LPBC pibc, LPCWSTR pwzDisplayName, BOOL fNoForceAbs,
ULONG *pcchEaten, IMoniker **ppimk)
{
static const WCHAR file_colonW[] = {'f','i','l','e',':'};
ULONG eaten = 0;
ULONG eaten = 0, len;
HRESULT hres;
TRACE("(%p %s %x %p %p)\n", pibc, debugstr_w(pwzDisplayName), fNoForceAbs, pcchEaten, ppimk);
@ -389,9 +377,10 @@ HRESULT WINAPI HlinkParseDisplayName(LPBC pibc, LPCWSTR pwzDisplayName, BOOL fNo
if(fNoForceAbs)
FIXME("Unsupported fNoForceAbs\n");
if(!wcsnicmp(pwzDisplayName, file_colonW, ARRAY_SIZE(file_colonW))) {
pwzDisplayName += ARRAY_SIZE(file_colonW);
eaten += ARRAY_SIZE(file_colonW);
len = ARRAY_SIZE(L"file:") - 1;
if(!wcsnicmp(pwzDisplayName, L"file:", len)) {
pwzDisplayName += len;
eaten += len;
while(*pwzDisplayName == '/') {
pwzDisplayName++;

View File

@ -537,13 +537,12 @@ static HRESULT WINAPI IHlink_fnNavigate(IHlink *iface, DWORD flags, IBindCtx *us
}
else
{
static const WCHAR szOpen[] = {'o','p','e','n',0};
LPWSTR target = NULL;
r = IHlink_GetStringReference(iface, HLINKGETREF_DEFAULT, &target, NULL);
if (SUCCEEDED(r) && target)
{
ShellExecuteW(NULL, szOpen, target, NULL, NULL, SW_SHOW);
ShellExecuteW(NULL, L"open", target, NULL, NULL, SW_SHOW);
CoTaskMemFree(target);
r = DRAGDROP_S_DROP;
}