xref: /aosp_15_r20/external/cronet/base/win/pe_image_test.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2015 The Chromium Authors
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 <windows.h>
6 
7 #include <cfgmgr32.h>
8 #include <shlobj.h>
9 
10 #pragma comment(linker, "/export:FwdExport=KERNEL32.CreateFileA")
11 
12 extern "C" {
13 
ExportFunc1()14 __declspec(dllexport) void ExportFunc1() {
15   // Call into user32.dll.
16   HWND dummy = GetDesktopWindow();
17   SetWindowTextA(dummy, "dummy");
18 }
19 
ExportFunc2()20 __declspec(dllexport) void ExportFunc2() {
21   // Call into cfgmgr32.dll.
22   CM_MapCrToWin32Err(CR_SUCCESS, ERROR_SUCCESS);
23 
24   // Call into shell32.dll.
25   PWSTR path = nullptr;
26   if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Public, 0, nullptr, &path)))
27     CoTaskMemFree(path);
28 
29   // Call into kernel32.dll.
30   HANDLE h = CreateEvent(nullptr, FALSE, FALSE, nullptr);
31   CloseHandle(h);
32 }
33 
34 }  // extern "C"
35