wscript: 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-11-03 23:34:33 +01:00 committed by Alexandre Julliard
parent 908c837b17
commit 4e3c4d6f1d
2 changed files with 12 additions and 30 deletions

View File

@ -33,8 +33,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(wscript);
#define BUILDVERSION 16535
static const WCHAR wshNameW[] = {'W','i','n','d','o','w','s',' ','S','c','r','i','p','t',' ','H','o','s','t',0};
static const WCHAR wshVersionW[] = {'5','.','8'};
VARIANT_BOOL wshInteractive =
@ -49,10 +47,8 @@ static HRESULT to_string(VARIANT *src, BSTR *dst)
VARIANT v;
HRESULT hres;
static const WCHAR nullW[] = {'n','u','l','l',0};
if(V_VT(src) == VT_NULL) {
*dst = SysAllocString(nullW);
*dst = SysAllocString(L"null");
return *dst ? S_OK : E_OUTOFMEMORY;
}
@ -73,9 +69,7 @@ static void print_string(const WCHAR *string)
char *buf;
if(wshInteractive) {
static const WCHAR windows_script_hostW[] =
{'W','i','n','d','o','w','s',' ','S','c','r','i','p','t',' ','H','o','s','t',0};
MessageBoxW(NULL, string, windows_script_hostW, MB_OK);
MessageBoxW(NULL, string, L"Windows Script Host", MB_OK);
return;
}
@ -163,7 +157,7 @@ static HRESULT WINAPI Host_get_Name(IHost *iface, BSTR *out_Name)
{
WINE_TRACE("(%p)\n", out_Name);
if(!(*out_Name = SysAllocString(wshNameW)))
if(!(*out_Name = SysAllocString(L"Windows Script Host")))
return E_OUTOFMEMORY;
return S_OK;
}

View File

@ -47,9 +47,6 @@
#endif
WINE_DEFAULT_DEBUG_CHANNEL(wscript);
static const WCHAR wscriptW[] = {'W','S','c','r','i','p','t',0};
static const WCHAR wshW[] = {'W','S','H',0};
WCHAR scriptFullName[MAX_PATH];
ITypeInfo *host_ti;
@ -86,7 +83,7 @@ static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface,
{
WINE_TRACE("(%s %x %p %p)\n", wine_dbgstr_w(pstrName), dwReturnMask, ppunkItem, ppti);
if(lstrcmpW(pstrName, wshW) && lstrcmpW(pstrName, wscriptW))
if(lstrcmpW(pstrName, L"WSH") && lstrcmpW(pstrName, L"WScript"))
return E_FAIL;
if(dwReturnMask & SCRIPTINFO_ITYPEINFO) {
@ -223,9 +220,7 @@ static BOOL load_typelib(void)
ITypeLib *typelib;
HRESULT hres;
static const WCHAR wscript_exeW[] = {'w','s','c','r','i','p','t','.','e','x','e',0};
hres = LoadTypeLib(wscript_exeW, &typelib);
hres = LoadTypeLib(L"wscript.exe", &typelib);
if(FAILED(hres))
return FALSE;
@ -245,9 +240,6 @@ static BOOL get_engine_clsid(const WCHAR *ext, CLSID *clsid)
HKEY hkey;
HRESULT hres;
static const WCHAR script_engineW[] =
{'\\','S','c','r','i','p','t','E','n','g','i','n','e',0};
res = RegOpenKeyW(HKEY_CLASSES_ROOT, ext, &hkey);
if(res != ERROR_SUCCESS)
return FALSE;
@ -260,7 +252,7 @@ static BOOL get_engine_clsid(const WCHAR *ext, CLSID *clsid)
WINE_TRACE("fileid is %s\n", wine_dbgstr_w(fileid));
lstrcatW(fileid, script_engineW);
lstrcatW(fileid, L"\\ScriptEngine");
res = RegOpenKeyW(HKEY_CLASSES_ROOT, fileid, &hkey);
if(res != ERROR_SUCCESS)
return FALSE;
@ -319,11 +311,11 @@ static BOOL init_engine(IActiveScript *script, IActiveScriptParse *parser)
if(FAILED(hres))
return FALSE;
hres = IActiveScript_AddNamedItem(script, wscriptW, SCRIPTITEM_ISVISIBLE);
hres = IActiveScript_AddNamedItem(script, L"WScript", SCRIPTITEM_ISVISIBLE);
if(FAILED(hres))
return FALSE;
hres = IActiveScript_AddNamedItem(script, wshW, SCRIPTITEM_ISVISIBLE);
hres = IActiveScript_AddNamedItem(script, L"WSH", SCRIPTITEM_ISVISIBLE);
if(FAILED(hres))
return FALSE;
@ -387,10 +379,6 @@ static void run_script(const WCHAR *filename, IActiveScript *script, IActiveScri
static BOOL set_host_properties(const WCHAR *prop)
{
static const WCHAR nologoW[] = {'n','o','l','o','g','o',0};
static const WCHAR iactive[] = {'i',0};
static const WCHAR batch[] = {'b',0};
if(*prop == '/') {
++prop;
if(*prop == '/')
@ -399,12 +387,12 @@ static BOOL set_host_properties(const WCHAR *prop)
else
++prop;
if(wcsicmp(prop, iactive) == 0)
if(wcsicmp(prop, L"i") == 0)
wshInteractive = VARIANT_TRUE;
else if(wcsicmp(prop, batch) == 0)
else if(wcsicmp(prop, L"b") == 0)
wshInteractive = VARIANT_FALSE;
else if(wcsicmp(prop, nologoW) == 0)
WINE_FIXME("ignored %s switch\n", debugstr_w(nologoW));
else if(wcsicmp(prop, L"nologo") == 0)
WINE_FIXME("ignored %s switch\n", debugstr_w(L"nologo"));
else
{
WINE_FIXME("unsupported switch %s\n", debugstr_w(prop));