| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 <windows.h> | 5 #include <windows.h> |
| 6 #include <CommCtrl.h> | 6 #include <CommCtrl.h> |
| 7 #include <commdlg.h> | 7 #include <commdlg.h> |
| 8 #include <stdarg.h> |
| 8 #include <time.h> | 9 #include <time.h> |
| 9 #include <windowsx.h> | 10 #include <windowsx.h> |
| 10 #include <atlbase.h> | 11 #include <atlbase.h> |
| 11 #include <atlsecurity.h> | 12 #include <atlsecurity.h> |
| 12 #include <algorithm> | 13 #include <algorithm> |
| 13 #include <sstream> | 14 #include <sstream> |
| 14 | 15 |
| 15 #include "sandbox/win/sandbox_poc/main_ui_window.h" | 16 #include "sandbox/win/sandbox_poc/main_ui_window.h" |
| 16 #include "base/logging.h" | 17 #include "base/logging.h" |
| 17 #include "sandbox/win/sandbox_poc/resource.h" | 18 #include "sandbox/win/sandbox_poc/resource.h" |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 } | 618 } |
| 618 | 619 |
| 619 void MainUIWindow::AddDebugMessage(const wchar_t* format, ...) { | 620 void MainUIWindow::AddDebugMessage(const wchar_t* format, ...) { |
| 620 DCHECK(format); | 621 DCHECK(format); |
| 621 if (!format) | 622 if (!format) |
| 622 return; | 623 return; |
| 623 | 624 |
| 624 const int kMaxDebugBuffSize = 1024; | 625 const int kMaxDebugBuffSize = 1024; |
| 625 | 626 |
| 626 va_list arg_list; | 627 va_list arg_list; |
| 627 #if _MSC_VER >= 1900 | 628 va_start(arg_list, format); |
| 628 __crt_va_start(arg_list, format); | |
| 629 #else | |
| 630 _crt_va_start(arg_list, format); | |
| 631 #endif | |
| 632 | 629 |
| 633 wchar_t text[kMaxDebugBuffSize + 1]; | 630 wchar_t text[kMaxDebugBuffSize + 1]; |
| 634 vswprintf_s(text, kMaxDebugBuffSize, format, arg_list); | 631 vswprintf_s(text, kMaxDebugBuffSize, format, arg_list); |
| 635 text[kMaxDebugBuffSize] = L'\0'; | 632 text[kMaxDebugBuffSize] = L'\0'; |
| 636 | 633 |
| 637 InsertLineInListView(text); | 634 InsertLineInListView(text); |
| 638 } | 635 } |
| 639 | 636 |
| 640 | 637 |
| 641 void MainUIWindow::InsertLineInListView(wchar_t* debug_message) { | 638 void MainUIWindow::InsertLineInListView(wchar_t* debug_message) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 664 item.iItem = ListView_GetItemCount(list_view_); | 661 item.iItem = ListView_GetItemCount(list_view_); |
| 665 item.iSubItem = 0; | 662 item.iSubItem = 0; |
| 666 item.mask = LVIF_TEXT | LVIF_PARAM; | 663 item.mask = LVIF_TEXT | LVIF_PARAM; |
| 667 item.pszText = message_time; | 664 item.pszText = message_time; |
| 668 item.lParam = 0; | 665 item.lParam = 0; |
| 669 | 666 |
| 670 ListView_InsertItem(list_view_, &item); | 667 ListView_InsertItem(list_view_, &item); |
| 671 | 668 |
| 672 delete[] message_time; | 669 delete[] message_time; |
| 673 } | 670 } |
| OLD | NEW |