qmgr: 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-11 22:05:23 +02:00 committed by Alexandre Julliard
parent aabd2b54b2
commit b0a64a8104
7 changed files with 30 additions and 61 deletions

View File

@ -452,14 +452,13 @@ static DWORD CALLBACK progress_callback_local(LARGE_INTEGER totalSize, LARGE_INT
static BOOL transfer_file_local(BackgroundCopyFileImpl *file, const WCHAR *tmpname)
{
static const WCHAR fileW[] = {'f','i','l','e',':','/','/',0};
BackgroundCopyJobImpl *job = file->owner;
const WCHAR *ptr;
BOOL ret;
transitionJobState(job, BG_JOB_STATE_QUEUED, BG_JOB_STATE_TRANSFERRING);
if (lstrlenW(file->info.RemoteName) > 7 && !wcsnicmp(file->info.RemoteName, fileW, 7))
if (lstrlenW(file->info.RemoteName) > 7 && !wcsnicmp(file->info.RemoteName, L"file://", 7))
ptr = file->info.RemoteName + 7;
else
ptr = file->info.RemoteName;
@ -476,7 +475,6 @@ static BOOL transfer_file_local(BackgroundCopyFileImpl *file, const WCHAR *tmpna
BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job)
{
static const WCHAR prefix[] = {'B','I','T', 0};
WCHAR tmpDir[MAX_PATH], tmpName[MAX_PATH];
WCHAR host[MAX_PATH];
URL_COMPONENTSW uc;
@ -490,7 +488,7 @@ BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job)
return FALSE;
}
if (!GetTempFileNameW(tmpDir, prefix, 0, tmpName))
if (!GetTempFileNameW(tmpDir, L"BIT", 0, tmpName))
{
ERR("Couldn't create temp file: %d\n", GetLastError());
/* Guessing on what state this should give us */

View File

@ -105,7 +105,6 @@ VOID WINAPI
ServiceMain(DWORD dwArgc, LPWSTR *lpszArgv)
{
HANDLE fileTxThread;
static const WCHAR qmgr_nameW[] = {'B','I','T','S',0};
DWORD threadId;
TRACE("\n");
@ -115,7 +114,7 @@ ServiceMain(DWORD dwArgc, LPWSTR *lpszArgv)
return;
}
status_handle = RegisterServiceCtrlHandlerExW(qmgr_nameW, ServiceHandler, NULL);
status_handle = RegisterServiceCtrlHandlerExW(L"BITS", ServiceHandler, NULL);
if (!status_handle) {
ERR("failed to register handler: %u\n", GetLastError());
return;

View File

@ -29,11 +29,6 @@
/* Globals used by many tests */
#define NUM_FILES 2 /* At least two. */
static const WCHAR test_remoteNameA[] = {'r','e','m','o','t','e','A', 0};
static const WCHAR test_localNameA[] = {'l','o','c','a','l','A', 0};
static const WCHAR test_remoteNameB[] = {'r','e','m','o','t','e','B', 0};
static const WCHAR test_localNameB[] = {'l','o','c','a','l','B', 0};
static const WCHAR test_displayName[] = {'T', 'e', 's', 't', 0};
static const ULONG test_fileCount = NUM_FILES;
static IBackgroundCopyJob *test_job;
static IBackgroundCopyManager *test_manager;
@ -79,10 +74,10 @@ static HRESULT test_create_manager(void)
IBackgroundCopyJob *job;
GUID jobId;
hres = IBackgroundCopyManager_CreateJob(manager, test_displayName, BG_JOB_TYPE_DOWNLOAD, &jobId, &job);
hres = IBackgroundCopyManager_CreateJob(manager, L"Test", BG_JOB_TYPE_DOWNLOAD, &jobId, &job);
if (hres == S_OK)
{
hres = addFileHelper(job, test_localNameA, test_remoteNameA);
hres = addFileHelper(job, L"localA", L"remoteA");
if (hres != S_OK)
win_skip("AddFile() with file:// protocol failed. Tests will be skipped.\n");
IBackgroundCopyJob_Release(job);
@ -105,17 +100,16 @@ static BOOL setup(void)
if(hres != S_OK)
return FALSE;
hres = IBackgroundCopyManager_CreateJob(test_manager, test_displayName,
BG_JOB_TYPE_DOWNLOAD, &test_jobId,
&test_job);
hres = IBackgroundCopyManager_CreateJob(test_manager, L"Test", BG_JOB_TYPE_DOWNLOAD,
&test_jobId, &test_job);
if(hres != S_OK)
{
IBackgroundCopyManager_Release(test_manager);
return FALSE;
}
if (addFileHelper(test_job, test_localNameA, test_remoteNameA) != S_OK
|| addFileHelper(test_job, test_localNameB, test_remoteNameB) != S_OK
if (addFileHelper(test_job, L"localA", L"remoteA") != S_OK
|| addFileHelper(test_job, L"localB", L"remoteB") != S_OK
|| IBackgroundCopyJob_EnumFiles(test_job, &test_enumFiles) != S_OK)
{
IBackgroundCopyJob_Release(test_job);

View File

@ -26,8 +26,6 @@
#include "bits.h"
/* Globals used by many tests */
static const WCHAR test_displayNameA[] = {'T','e','s','t','A', 0};
static const WCHAR test_displayNameB[] = {'T','e','s','t','B', 0};
static IBackgroundCopyManager *test_manager;
static IBackgroundCopyJob *test_jobA;
static IBackgroundCopyJob *test_jobB;
@ -54,9 +52,8 @@ static BOOL setup(void)
if(hres != S_OK)
return FALSE;
hres = IBackgroundCopyManager_CreateJob(test_manager, test_displayNameA,
BG_JOB_TYPE_DOWNLOAD, &test_jobIdA,
&test_jobA);
hres = IBackgroundCopyManager_CreateJob(test_manager, L"TestA", BG_JOB_TYPE_DOWNLOAD,
&test_jobIdA, &test_jobA);
if(hres != S_OK)
return FALSE;
@ -64,9 +61,8 @@ static BOOL setup(void)
if(hres != S_OK)
return FALSE;
hres = IBackgroundCopyManager_CreateJob(test_manager, test_displayNameB,
BG_JOB_TYPE_DOWNLOAD, &test_jobIdB,
&test_jobB);
hres = IBackgroundCopyManager_CreateJob(test_manager, L"TestB", BG_JOB_TYPE_DOWNLOAD,
&test_jobIdB, &test_jobB);
if(hres != S_OK)
return FALSE;

View File

@ -28,11 +28,8 @@
#include "bits.h"
/* Globals used by many tests */
static const WCHAR test_remoteName[] = {'r','e','m','o','t','e', 0};
static const WCHAR test_localName[] = {'l','o','c','a','l', 0};
static WCHAR test_localFile[MAX_PATH];
static WCHAR test_remoteUrl[MAX_PATH];
static const WCHAR test_displayName[] = {'T','e','s','t', 0};
static IBackgroundCopyJob *test_job;
static IBackgroundCopyManager *test_manager;
static IEnumBackgroundCopyFiles *test_enumFiles;
@ -76,10 +73,10 @@ static HRESULT test_create_manager(void)
IBackgroundCopyJob *job;
GUID jobId;
hres = IBackgroundCopyManager_CreateJob(manager, test_displayName, BG_JOB_TYPE_DOWNLOAD, &jobId, &job);
hres = IBackgroundCopyManager_CreateJob(manager, L"Test", BG_JOB_TYPE_DOWNLOAD, &jobId, &job);
if (hres == S_OK)
{
hres = addFileHelper(job, test_localName, test_remoteName);
hres = addFileHelper(job, L"local", L"remote");
if (hres != S_OK)
win_skip("AddFile() with file:// protocol failed. Tests will be skipped.\n");
IBackgroundCopyJob_Release(job);
@ -106,7 +103,7 @@ static BOOL setup(void)
if(hres != S_OK)
return FALSE;
hres = IBackgroundCopyManager_CreateJob(test_manager, test_displayName,
hres = IBackgroundCopyManager_CreateJob(test_manager, L"Test",
BG_JOB_TYPE_DOWNLOAD, &test_jobId, &test_job);
if(hres != S_OK)
{
@ -114,7 +111,7 @@ static BOOL setup(void)
return FALSE;
}
if (addFileHelper(test_job, test_localName, test_remoteName) != S_OK
if (addFileHelper(test_job, L"local", L"remote") != S_OK
|| IBackgroundCopyJob_EnumFiles(test_job, &test_enumFiles) != S_OK)
{
IBackgroundCopyJob_Release(test_job);

View File

@ -29,7 +29,6 @@
#include "bits2_5.h"
/* Globals used by many tests */
static const WCHAR test_displayName[] = {'T', 'e', 's', 't', 0};
static WCHAR test_remotePathA[MAX_PATH];
static WCHAR test_remotePathB[MAX_PATH];
static WCHAR test_localPathA[MAX_PATH];
@ -62,7 +61,7 @@ static HRESULT test_create_manager(void)
static void init_paths(void)
{
WCHAR tmpDir[MAX_PATH];
WCHAR prefix[] = {'q', 'm', 'g', 'r', 0};
WCHAR prefix[] = L"qmgr";
GetTempPathW(MAX_PATH, tmpDir);
@ -89,8 +88,7 @@ static BOOL setup(void)
if(hres != S_OK)
return FALSE;
hres = IBackgroundCopyManager_CreateJob(test_manager, test_displayName,
test_type, &test_jobId, &test_job);
hres = IBackgroundCopyManager_CreateJob(test_manager, L"Test", test_type, &test_jobId, &test_job);
if(hres != S_OK)
{
IBackgroundCopyManager_Release(test_manager);
@ -119,7 +117,7 @@ static BOOL check_bits20(void)
(void **)&manager);
if (hres != S_OK) return FALSE;
hres = IBackgroundCopyManager_CreateJob(manager, test_displayName, test_type, &test_jobId, &job);
hres = IBackgroundCopyManager_CreateJob(manager, L"Test", test_type, &test_jobId, &job);
if (hres != S_OK)
{
IBackgroundCopyManager_Release(manager);
@ -152,7 +150,7 @@ static BOOL check_bits25(void)
(void **)&manager);
if (hres != S_OK) return FALSE;
hres = IBackgroundCopyManager_CreateJob(manager, test_displayName, test_type, &test_jobId, &job);
hres = IBackgroundCopyManager_CreateJob(manager, L"Test", test_type, &test_jobId, &job);
if (hres != S_OK)
{
IBackgroundCopyManager_Release(manager);
@ -203,7 +201,7 @@ static void test_GetName(void)
hres = IBackgroundCopyJob_GetDisplayName(test_job, &displayName);
ok(hres == S_OK, "GetName failed: %08x\n", hres);
ok(lstrcmpW(displayName, test_displayName) == 0, "Got incorrect type\n");
ok(lstrcmpW(displayName, L"Test") == 0, "Got incorrect type\n");
CoTaskMemFree(displayName);
}
@ -390,7 +388,6 @@ static void test_CompleteLocal(void)
/* Test a complete transfer for local files */
static void test_CompleteLocalURL(void)
{
static const WCHAR prot[] = {'f','i','l','e',':','/','/', 0};
static const int timeout_sec = 30;
WCHAR *urlA, *urlB;
HRESULT hres;
@ -414,9 +411,9 @@ static void test_CompleteLocalURL(void)
return;
}
lstrcpyW(urlA, prot);
lstrcpyW(urlA, L"file://");
lstrcatW(urlA, test_remotePathA);
lstrcpyW(urlB, prot);
lstrcpyW(urlB, L"file://");
lstrcatW(urlB, test_remotePathB);
hres = IBackgroundCopyJob_AddFile(test_job, urlA, test_localPathA);
@ -506,10 +503,7 @@ static void test_Cancel(void)
static void test_HttpOptions(void)
{
static const WCHAR urlW[] =
{'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',0};
static const WCHAR winetestW[] =
{'W','i','n','e',':',' ','t','e','s','t','\r','\n',0};
static const WCHAR winetestW[] = L"Wine: test\r\n";
static const unsigned int timeout = 30;
HRESULT hr;
IBackgroundCopyJobHttpOptions *options;
@ -520,7 +514,7 @@ static void test_HttpOptions(void)
ULONG flags, orig_flags;
DeleteFileW(test_localPathA);
hr = IBackgroundCopyJob_AddFile(test_job, urlW, test_localPathA);
hr = IBackgroundCopyJob_AddFile(test_job, L"http://test.winehq.org/", test_localPathA);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IBackgroundCopyJob_QueryInterface(test_job, &IID_IBackgroundCopyJobHttpOptions, (void **)&options);

View File

@ -50,7 +50,6 @@ static HRESULT test_create_manager(void)
static void test_CreateJob(void)
{
/* Job information */
static const WCHAR copyNameW[] = {'T', 'e', 's', 't', 0};
IBackgroundCopyJob* job = NULL;
GUID tmpId;
HRESULT hres;
@ -64,9 +63,7 @@ static void test_CreateJob(void)
ok(hres == S_OK, "got 0x%08x\n", hres);
/* Create bits job */
hres = IBackgroundCopyManager_CreateJob(manager, copyNameW,
BG_JOB_TYPE_DOWNLOAD, &tmpId,
&job);
hres = IBackgroundCopyManager_CreateJob(manager, L"Test", BG_JOB_TYPE_DOWNLOAD, &tmpId, &job);
ok(hres == S_OK, "CreateJob failed: %08x\n", hres);
res = IBackgroundCopyJob_Release(job);
@ -78,8 +75,6 @@ static void test_EnumJobs(void)
{
/* Job Enumerator */
IEnumBackgroundCopyJobs* enumJobs;
static const WCHAR copyNameW[] = {'T', 'e', 's', 't', 0};
IBackgroundCopyManager *manager = NULL;
IBackgroundCopyJob *job = NULL;
HRESULT hres;
@ -91,9 +86,7 @@ static void test_EnumJobs(void)
(void **) &manager);
ok(hres == S_OK, "got 0x%08x\n", hres);
hres = IBackgroundCopyManager_CreateJob(manager, copyNameW,
BG_JOB_TYPE_DOWNLOAD, &tmpId,
&job);
hres = IBackgroundCopyManager_CreateJob(manager, L"Test", BG_JOB_TYPE_DOWNLOAD, &tmpId, &job);
ok(hres == S_OK, "got 0x%08x\n", hres);
hres = IBackgroundCopyManager_EnumJobs(manager, 0, &enumJobs);
@ -107,7 +100,6 @@ static void test_EnumJobs(void)
static void run_child(WCHAR *secret)
{
static const WCHAR format[] = {'%','s',' ','q','m','g','r',' ','%','s', 0};
WCHAR cmdline[MAX_PATH];
PROCESS_INFORMATION info;
STARTUPINFOW startup;
@ -115,7 +107,7 @@ static void run_child(WCHAR *secret)
memset(&startup, 0, sizeof startup);
startup.cb = sizeof startup;
wsprintfW(cmdline, format, progname, secret);
wsprintfW(cmdline, L"%s qmgr %s", progname, secret);
ok(CreateProcessW(NULL, cmdline, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
wait_child_process(info.hProcess);
ok(CloseHandle(info.hProcess), "CloseHandle\n");
@ -144,7 +136,6 @@ static void do_child(const char *secretA)
static void test_globalness(void)
{
static const WCHAR format[] = {'t','e','s','t','_','%','u', 0};
WCHAR secretName[MAX_PATH];
IEnumBackgroundCopyJobs* enumJobs;
IBackgroundCopyManager *manager = NULL;
@ -154,7 +145,7 @@ static void test_globalness(void)
(void **) &manager);
ok(hres == S_OK, "got 0x%08x\n", hres);
wsprintfW(secretName, format, GetTickCount());
wsprintfW(secretName, L"test_%u", GetTickCount());
run_child(secretName);
hres = IBackgroundCopyManager_EnumJobs(manager, 0, &enumJobs);