Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Copyright 2017 The Chromium Authors. All rights reserved.
- // Use of this source code is governed by a BSD-style license that can be
- // found in the LICENSE file.
- #include <stdint.h>
- #include "base/clang_profiling_buildflags.h"
- #include "build/build_config.h"
- #include "chrome/installer/mini_installer/mini_installer.h"
- // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx
- extern "C" IMAGE_DOS_HEADER __ImageBase;
- extern "C" int __stdcall MainEntryPoint() {
- mini_installer::ProcessExitResult result =
- mini_installer::WMain(reinterpret_cast<HMODULE>(&__ImageBase));
- ::ExitProcess(result.exit_code);
- }
- // Executables instrumented with ASAN need CRT functions. We do not use
- // the /ENTRY switch for ASAN instrumented executable and a "main" function
- // is required.
- extern "C" int WINAPI wWinMain(HINSTANCE /* instance */,
- HINSTANCE /* previous_instance */,
- LPWSTR /* command_line */,
- int /* command_show */) {
- return MainEntryPoint();
- }
- // We don't link with the CRT (this is enforced through use of the /ENTRY linker
- // flag) so we have to implement CRT functions that the compiler generates calls
- // to.
- extern "C" {
- __attribute__((used))
- void* memset(void* dest, int c, size_t count) {
- uint8_t* scan = reinterpret_cast<uint8_t*>(dest);
- while (count--)
- *scan++ = static_cast<uint8_t>(c);
- return dest;
- }
- __attribute__((used))
- void* memcpy(void* destination, const void* source, size_t count) {
- auto* dst = reinterpret_cast<uint8_t*>(destination);
- auto* src = reinterpret_cast<const uint8_t*>(source);
- while (count--)
- *dst++ = *src++;
- return destination;
- }
- } // extern "C"
Add Comment
Please, Sign In to add comment