summaryrefslogtreecommitdiff
path: root/chromium/base/win/pe_image_test.cc
blob: a0b9ed160111d357406d32c2cef479e9b4fe9ea5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2015 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 <windows.h>

#include <cfgmgr32.h>
#include <shlobj.h>

#pragma comment(linker, "/export:FwdExport=KERNEL32.CreateFileA")

extern "C" {

__declspec(dllexport) void ExportFunc1() {
  // Call into user32.dll.
  HWND dummy = GetDesktopWindow();
  SetWindowTextA(dummy, "dummy");
}

__declspec(dllexport) void ExportFunc2() {
  // Call into cfgmgr32.dll.
  CM_MapCrToWin32Err(CR_SUCCESS, ERROR_SUCCESS);

  // Call into shell32.dll.
  PWSTR path = nullptr;
  if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Public, 0, nullptr, &path)))
    CoTaskMemFree(path);

  // Call into kernel32.dll.
  HANDLE h = CreateEvent(nullptr, FALSE, FALSE, nullptr);
  CloseHandle(h);
}

}  // extern "C"