summaryrefslogtreecommitdiffstats
path: root/sandbox
diff options
context:
space:
mode:
authormmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-14 00:41:45 +0000
committermmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-14 00:41:45 +0000
commit5115474e2e2c773b53fc1e111426e8924deeadb7 (patch)
tree6bdd56cdd544a3b331db7612781ae347739c4e82 /sandbox
parent609990b5b4254601504935427483e3fc22cfde80 (diff)
downloadchromium_src-5115474e2e2c773b53fc1e111426e8924deeadb7.zip
chromium_src-5115474e2e2c773b53fc1e111426e8924deeadb7.tar.gz
chromium_src-5115474e2e2c773b53fc1e111426e8924deeadb7.tar.bz2
Use %ls instead of %s in wprintf format strings for wchar_t fields.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@846 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/sandbox_poc/main_ui_window.cc8
-rw-r--r--sandbox/src/file_policy_test.cc14
-rw-r--r--sandbox/tools/finder/main.cc10
-rw-r--r--sandbox/tools/launcher/launcher.cc12
4 files changed, 22 insertions, 22 deletions
diff --git a/sandbox/sandbox_poc/main_ui_window.cc b/sandbox/sandbox_poc/main_ui_window.cc
index fdef50d..be68cdb 100644
--- a/sandbox/sandbox_poc/main_ui_window.cc
+++ b/sandbox/sandbox_poc/main_ui_window.cc
@@ -426,7 +426,7 @@ DWORD MainUIWindow::ListenPipe() {
FILE_ATTRIBUTE_NORMAL,
NULL); // No template
if (INVALID_HANDLE_VALUE == logfile_handle) {
- AddDebugMessage(L"Failed to open \"%s\" for logging. Error %d",
+ AddDebugMessage(L"Failed to open \"%ls\" for logging. Error %d",
file_to_open.GetBuffer(), ::GetLastError());
logfile_handle = NULL;
}
@@ -524,7 +524,7 @@ bool MainUIWindow::SpawnTarget() {
}
wchar_t * arguments = new wchar_t[size_call];
- wnsprintf(arguments, static_cast<int>(size_call), L"%s %s \"%s\" %s",
+ wnsprintf(arguments, static_cast<int>(size_call), L"%ls %ls \"%ls\" %ls",
spawn_target_.c_str(), entry_point_.c_str(),
dll_path_.c_str(), log_pipe);
@@ -553,7 +553,7 @@ bool MainUIWindow::SpawnTarget() {
bool return_value = false;
if (sandbox::SBOX_ALL_OK != result) {
AddDebugMessage(
- L"Failed to spawn target %s w/args (%s), sandbox error code: %d",
+ L"Failed to spawn target %ls w/args (%ls), sandbox error code: %d",
spawn_target_.c_str(), arguments, result);
return_value = false;
} else {
@@ -592,7 +592,7 @@ bool MainUIWindow::SpawnTarget() {
::ResumeThread(target_.hThread);
- AddDebugMessage(L"Successfully spawned target w/args (%s)", arguments);
+ AddDebugMessage(L"Successfully spawned target w/args (%ls)", arguments);
return_value = true;
}
diff --git a/sandbox/src/file_policy_test.cc b/sandbox/src/file_policy_test.cc
index cb66fa4..54fe56e 100644
--- a/sandbox/src/file_policy_test.cc
+++ b/sandbox/src/file_policy_test.cc
@@ -359,9 +359,9 @@ TEST(FilePolicyTest, AllowReadOnly) {
temp_file_name));
wchar_t command_read[MAX_PATH + 20] = {0};
- wsprintf(command_read, L"File_Create Read \"%s\"", temp_file_name);
+ wsprintf(command_read, L"File_Create Read \"%ls\"", temp_file_name);
wchar_t command_write[MAX_PATH + 20] = {0};
- wsprintf(command_write, L"File_Create Write \"%s\"", temp_file_name);
+ wsprintf(command_write, L"File_Create Write \"%ls\"", temp_file_name);
// Verify that we have read access after revert.
EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(command_read));
@@ -389,7 +389,7 @@ TEST(FilePolicyTest, AllowWildcard) {
EXPECT_TRUE(runner.AddFsRule(TargetPolicy::FILES_ALLOW_ANY, temp_directory));
wchar_t command_write[MAX_PATH + 20] = {0};
- wsprintf(command_write, L"File_Create Write \"%s\"", temp_file_name);
+ wsprintf(command_write, L"File_Create Write \"%ls\"", temp_file_name);
// Verify that we have write access after revert.
EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(command_write));
@@ -481,19 +481,19 @@ TEST(FilePolicyTest, TestRename) {
wchar_t command[MAX_PATH*2 + 20] = {0};
- wsprintf(command, L"File_Rename \"%s\" \"%s\"", temp_file_name1,
+ wsprintf(command, L"File_Rename \"%ls\" \"%ls\"", temp_file_name1,
temp_file_name2);
EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(command));
- wsprintf(command, L"File_Rename \"%s\" \"%s\"", temp_file_name3,
+ wsprintf(command, L"File_Rename \"%ls\" \"%ls\"", temp_file_name3,
temp_file_name4);
EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(command));
- wsprintf(command, L"File_Rename \"%s\" \"%s\"", temp_file_name5,
+ wsprintf(command, L"File_Rename \"%ls\" \"%ls\"", temp_file_name5,
temp_file_name6);
EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(command));
- wsprintf(command, L"File_Rename \"%s\" \"%s\"", temp_file_name7,
+ wsprintf(command, L"File_Rename \"%ls\" \"%ls\"", temp_file_name7,
temp_file_name8);
EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(command));
diff --git a/sandbox/tools/finder/main.cc b/sandbox/tools/finder/main.cc
index 7037bfa..75e081d 100644
--- a/sandbox/tools/finder/main.cc
+++ b/sandbox/tools/finder/main.cc
@@ -33,13 +33,13 @@
#define PARAM_IS(y) (argc > i) && (_wcsicmp(argv[i], y) == 0)
void PrintUsage(wchar_t *application_name) {
- wprintf(L"\n\nUsage: \n %s --token type --object ob1 [ob2 ob3] "
+ wprintf(L"\n\nUsage: \n %ls --token type --object ob1 [ob2 ob3] "
L"--access ac1 [ac2 ac3] [--log filename]", application_name);
wprintf(L"\n\n Token Types : \n\tLOCKDOWN \n\tRESTRICTED "
L"\n\tLIMITED_USER \n\tINTERACTIVE_USER \n\tNON_ADMIN \n\tUNPROTECTED");
wprintf(L"\n Object Types: \n\tREG \n\tFILE \n\tKERNEL");
wprintf(L"\n Access Types: \n\tR \n\tW \n\tALL");
- wprintf(L"\n\nSample: \n %s --token LOCKDOWN --object REG FILE KERNEL "
+ wprintf(L"\n\nSample: \n %ls --token LOCKDOWN --object REG FILE KERNEL "
L"--access R W ALL", application_name);
}
@@ -84,7 +84,7 @@ int wmain(int argc, wchar_t* argv[]) {
} else if (PARAM_IS(L"UNPROTECTED")) {
token_type = sandbox::USER_UNPROTECTED;
} else {
- wprintf(L"\nAbord. Invalid token type \"%s\"", argv[i]);
+ wprintf(L"\nAbord. Invalid token type \"%ls\"", argv[i]);
PrintUsage(app_name);
return -1;
}
@@ -130,7 +130,7 @@ int wmain(int argc, wchar_t* argv[]) {
return -1;
}
} else {
- wprintf(L"\nAbord. Unrecognized parameter \"%s\"", argv[i]);
+ wprintf(L"\nAbord. Unrecognized parameter \"%ls\"", argv[i]);
PrintUsage(app_name);
return -1;
}
@@ -155,7 +155,7 @@ int wmain(int argc, wchar_t* argv[]) {
if (log_file.GetLength()) {
errno_t err = _wfopen_s(&file_output, log_file, L"w");
if (err) {
- wprintf(L"\nAbord, Cannot open file \"%s\"", log_file.GetBuffer());
+ wprintf(L"\nAbord, Cannot open file \"%ls\"", log_file.GetBuffer());
return -1;
}
} else {
diff --git a/sandbox/tools/launcher/launcher.cc b/sandbox/tools/launcher/launcher.cc
index 3e7dd3d..fd8d272 100644
--- a/sandbox/tools/launcher/launcher.cc
+++ b/sandbox/tools/launcher/launcher.cc
@@ -39,7 +39,7 @@
#define PARAM_IS(y) (argc > i) && (_wcsicmp(argv[i], y) == 0)
void PrintUsage(const wchar_t *application_name) {
- wprintf(L"\n\nUsage: \n %s --main level --init level --job level cmd_line ",
+ wprintf(L"\n\nUsage: \n %ls --main level --init level --job level cmd_line ",
application_name);
wprintf(L"\n\n Levels : \n\tLOCKDOWN \n\tRESTRICTED "
L"\n\tLIMITED_USER \n\tINTERACTIVE_USER \n\tNON_ADMIN \n\tUNPROTECTED");
@@ -119,7 +119,7 @@ int wmain(int argc, wchar_t *argv[]) {
i++;
if (argc > i) {
if (!GetTokenLevelFromString(argv[i], &primary_level)) {
- wprintf(L"\nAbord, Unrecognized main token level \"%s\"", argv[i]);
+ wprintf(L"\nAbord, Unrecognized main token level \"%ls\"", argv[i]);
PrintUsage(app_name);
return -1;
}
@@ -128,7 +128,7 @@ int wmain(int argc, wchar_t *argv[]) {
i++;
if (argc > i) {
if (!GetTokenLevelFromString(argv[i], &impersonation_level)) {
- wprintf(L"\nAbord, Unrecognized init token level \"%s\"", argv[i]);
+ wprintf(L"\nAbord, Unrecognized init token level \"%ls\"", argv[i]);
PrintUsage(app_name);
return -1;
}
@@ -137,7 +137,7 @@ int wmain(int argc, wchar_t *argv[]) {
i++;
if (argc > i) {
if (!GetJobLevelFromString(argv[i], &job_level)) {
- wprintf(L"\nAbord, Unrecognized job security level \"%s\"", argv[i]);
+ wprintf(L"\nAbord, Unrecognized job security level \"%ls\"", argv[i]);
PrintUsage(app_name);
return -1;
}
@@ -156,7 +156,7 @@ int wmain(int argc, wchar_t *argv[]) {
return -1;
}
- wprintf(L"\nLaunching command line: \"%s\"\n", command_line.GetBuffer());
+ wprintf(L"\nLaunching command line: \"%ls\"\n", command_line.GetBuffer());
HANDLE job_handle;
DWORD err_code = sandbox::StartRestrictedProcessInJob(
@@ -178,4 +178,4 @@ int wmain(int argc, wchar_t *argv[]) {
::CloseHandle(job_handle);
return 0;
-} \ No newline at end of file
+}