pe_image_test.cc 854 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2015 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. #include <windows.h>
  5. #include <cfgmgr32.h>
  6. #include <shlobj.h>
  7. #pragma comment(linker, "/export:FwdExport=KERNEL32.CreateFileA")
  8. extern "C" {
  9. __declspec(dllexport) void ExportFunc1() {
  10. // Call into user32.dll.
  11. HWND dummy = GetDesktopWindow();
  12. SetWindowTextA(dummy, "dummy");
  13. }
  14. __declspec(dllexport) void ExportFunc2() {
  15. // Call into cfgmgr32.dll.
  16. CM_MapCrToWin32Err(CR_SUCCESS, ERROR_SUCCESS);
  17. // Call into shell32.dll.
  18. PWSTR path = nullptr;
  19. if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Public, 0, nullptr, &path)))
  20. CoTaskMemFree(path);
  21. // Call into kernel32.dll.
  22. HANDLE h = CreateEvent(nullptr, FALSE, FALSE, nullptr);
  23. CloseHandle(h);
  24. }
  25. } // extern "C"