Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/installer/mini_installer/mini_installer.h" | |
| 6 | |
| 7 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx | |
| 8 extern "C" IMAGE_DOS_HEADER __ImageBase; | |
| 9 | |
| 10 extern "C" int __stdcall MainEntryPoint() { | |
| 11 mini_installer::ProcessExitResult result = | |
| 12 mini_installer::WMain(reinterpret_cast<HMODULE>(&__ImageBase)); | |
| 13 ::ExitProcess(result.exit_code); | |
| 14 } | |
| 15 | |
| 16 #if defined(ADDRESS_SANITIZER) | |
| 17 // Executables instrumented with ASAN need CRT functions. We do not use | |
| 18 // the /ENTRY switch for ASAN instrumented executable and a "main" function | |
| 19 // is required. | |
| 20 extern "C" int WINAPI wWinMain(HINSTANCE /* instance */, | |
| 21 HINSTANCE /* previous_instance */, | |
| 22 LPWSTR /* command_line */, | |
| 23 int /* command_show */) { | |
| 24 return MainEntryPoint(); | |
| 25 } | |
| 26 #endif | |
| 27 | |
| 28 // VC Express editions don't come with the memset CRT obj file and linking to | |
| 29 // the obj files between versions becomes a bit problematic. Therefore, | |
| 30 // simply implement memset. | |
| 31 // | |
| 32 // This also avoids having to explicitly set the __sse2_available hack when | |
| 33 // linking with both the x64 and x86 obj files which is required when not | |
| 34 // linking with the std C lib in certain instances (including Chromium) with | |
| 35 // MSVC. __sse2_available determines whether to use SSE2 intructions with | |
| 36 // std C lib routines, and is set by MSVC's std C lib implementation normally. | |
| 37 extern "C" { | |
| 38 #pragma function(memset) | |
| 39 void* memset(void* dest, int c, size_t count) { | |
| 40 void* start = dest; | |
|
bcwhite
2017/01/27 14:59:19
How about:
char* ptr = reinterpret_cast<char*>(d
grt (UTC plus 2)
2017/01/27 15:18:37
This code was simply moved from mini_installer.cc
| |
| 41 while (count--) { | |
| 42 *reinterpret_cast<char*>(dest) = static_cast<char>(c); | |
| 43 dest = reinterpret_cast<char*>(dest) + 1; | |
| 44 } | |
| 45 return start; | |
| 46 } | |
| 47 } // extern "C" | |
| OLD | NEW |