| 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 <stdint.h> |
| 6 |
| 7 #include "chrome/installer/mini_installer/mini_installer.h" |
| 8 |
| 9 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx |
| 10 extern "C" IMAGE_DOS_HEADER __ImageBase; |
| 11 |
| 12 extern "C" int __stdcall MainEntryPoint() { |
| 13 mini_installer::ProcessExitResult result = |
| 14 mini_installer::WMain(reinterpret_cast<HMODULE>(&__ImageBase)); |
| 15 ::ExitProcess(result.exit_code); |
| 16 } |
| 17 |
| 18 #if defined(ADDRESS_SANITIZER) |
| 19 // Executables instrumented with ASAN need CRT functions. We do not use |
| 20 // the /ENTRY switch for ASAN instrumented executable and a "main" function |
| 21 // is required. |
| 22 extern "C" int WINAPI wWinMain(HINSTANCE /* instance */, |
| 23 HINSTANCE /* previous_instance */, |
| 24 LPWSTR /* command_line */, |
| 25 int /* command_show */) { |
| 26 return MainEntryPoint(); |
| 27 } |
| 28 #endif |
| 29 |
| 30 // VC Express editions don't come with the memset CRT obj file and linking to |
| 31 // the obj files between versions becomes a bit problematic. Therefore, |
| 32 // simply implement memset. |
| 33 // |
| 34 // This also avoids having to explicitly set the __sse2_available hack when |
| 35 // linking with both the x64 and x86 obj files which is required when not |
| 36 // linking with the std C lib in certain instances (including Chromium) with |
| 37 // MSVC. __sse2_available determines whether to use SSE2 intructions with |
| 38 // std C lib routines, and is set by MSVC's std C lib implementation normally. |
| 39 extern "C" { |
| 40 #pragma function(memset) |
| 41 void* memset(void* dest, int c, size_t count) { |
| 42 uint8_t* scan = reinterpret_cast<uint8_t*>(dest); |
| 43 while (count--) |
| 44 *scan++ = static_cast<uint8_t>(c); |
| 45 return dest; |
| 46 } |
| 47 } // extern "C" |
| OLD | NEW |