Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: sandbox/win/sandbox_poc/pocdll/spyware.cc

Issue 543923002: win/clang: Fix all remaining -Wformat warnings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "sandbox/win/sandbox_poc/pocdll/exports.h" 8 #include "sandbox/win/sandbox_poc/pocdll/exports.h"
9 #include "sandbox/win/sandbox_poc/pocdll/utils.h" 9 #include "sandbox/win/sandbox_poc/pocdll/utils.h"
10 10
11 // This file contains the tests used to verify the security of the system by 11 // This file contains the tests used to verify the security of the system by
12 // using some spying techniques. 12 // using some spying techniques.
13 13
14 void POCDLL_API TestSpyKeys(HANDLE log) { 14 void POCDLL_API TestSpyKeys(HANDLE log) {
15 HandleToFile handle2file; 15 HandleToFile handle2file;
16 FILE *output = handle2file.Translate(log, "w"); 16 FILE *output = handle2file.Translate(log, "w");
17 17
18 if (RegisterHotKey(NULL, 1, 0, 0x42)) { 18 if (RegisterHotKey(NULL, 1, 0, 0x42)) {
19 fprintf(output, "[GRANTED] successfully registered hotkey\r\n"); 19 fprintf(output, "[GRANTED] successfully registered hotkey\r\n");
20 UnregisterHotKey(NULL, 1); 20 UnregisterHotKey(NULL, 1);
21 } else { 21 } else {
22 fprintf(output, "[BLOCKED] Failed to register hotkey. Error = %d\r\n", 22 fprintf(output, "[BLOCKED] Failed to register hotkey. Error = %ld\r\n",
23 ::GetLastError()); 23 ::GetLastError());
24 } 24 }
25 25
26 fprintf(output, "[INFO] Logging keystrokes for 15 seconds\r\n"); 26 fprintf(output, "[INFO] Logging keystrokes for 15 seconds\r\n");
27 fflush(output); 27 fflush(output);
28 base::string16 logged; 28 base::string16 logged;
29 DWORD tick = ::GetTickCount() + 15000; 29 DWORD tick = ::GetTickCount() + 15000;
30 while (tick > ::GetTickCount()) { 30 while (tick > ::GetTickCount()) {
31 for (int i = 0; i < 256; ++i) { 31 for (int i = 0; i < 256; ++i) {
32 if (::GetAsyncKeyState(i) & 1) { 32 if (::GetAsyncKeyState(i) & 1) {
(...skipping 23 matching lines...) Expand all
56 56
57 for (int x = 0; x < 10; ++x) { 57 for (int x = 0; x < 10; ++x) {
58 for (int y = 0; y < 10; ++y) { 58 for (int y = 0; y < 10; ++y) {
59 if (::GetPixel(screen_dc, x, y) != pixel_color) { 59 if (::GetPixel(screen_dc, x, y) != pixel_color) {
60 fprintf(output, "[GRANTED] Read pixel on screen\r\n"); 60 fprintf(output, "[GRANTED] Read pixel on screen\r\n");
61 return; 61 return;
62 } 62 }
63 } 63 }
64 } 64 }
65 65
66 fprintf(output, "[BLOCKED] Read pixel on screen. Error = %d\r\n", 66 fprintf(output, "[BLOCKED] Read pixel on screen. Error = %ld\r\n",
67 ::GetLastError()); 67 ::GetLastError());
68 } 68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698