1 //
2 // LoadLibraryExA.cpp
3 //
4 //      Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // Definition of __acrt_LoadLibraryExA.
7 //
8 
9 #include <corecrt_internal_win32_buffer.h>
10 
__acrt_LoadLibraryExA(LPCSTR const lpFilename,HANDLE const hFile,DWORD const dwFlags)11 HMODULE __cdecl __acrt_LoadLibraryExA(
12     LPCSTR const lpFilename,
13     HANDLE const hFile,
14     DWORD const  dwFlags
15     )
16 {
17     __crt_internal_win32_buffer<wchar_t> wide_file_name;
18 
19     errno_t const cvt1 = __acrt_mbs_to_wcs_cp(
20         lpFilename,
21         wide_file_name,
22         __acrt_get_utf8_acp_compatibility_codepage()
23         );
24 
25     if (cvt1 != 0) {
26         return nullptr;
27     }
28 
29     return ::LoadLibraryExW(
30         wide_file_name.data(),
31         hFile,
32         dwFlags
33         );
34 }
35