ReactOS 0.4.16-dev-853-g88d9285
GetModuleFileNameA.cpp
Go to the documentation of this file.
1//
2// GetModuleFileNameA.cpp
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// Definition of __acrt_GetModuleFileNameA.
7//
8
10
12 HMODULE const hModule,
13 char * const lpFilename,
14 DWORD const nSize
15 )
16{
17 size_t const wide_buffer_size = MAX_PATH + 1;
18 wchar_t wide_buffer[wide_buffer_size];
19
20 DWORD const amount_copied = GetModuleFileNameW(
21 hModule,
22 wide_buffer,
23 wide_buffer_size
24 );
25
26 if (amount_copied == 0) {
28 return 0;
29 }
30
31 __crt_no_alloc_win32_buffer<char> filename_buffer(lpFilename, static_cast<size_t>(nSize));
32
34 wide_buffer,
35 filename_buffer,
37 );
38
39 return static_cast<DWORD>(filename_buffer.size());
40}
DWORD __cdecl __acrt_GetModuleFileNameA(HMODULE const hModule, char *const lpFilename, DWORD const nSize)
#define __cdecl
Definition: accygwin.h:79
void __cdecl __acrt_errno_map_os_error(unsigned long)
Definition: errno.cpp:91
errno_t __acrt_wcs_to_mbs_cp(wchar_t const *const null_terminated_input_string, __crt_win32_buffer< char, ResizePolicy > &win32_buffer, unsigned int const code_page)
unsigned int __acrt_get_utf8_acp_compatibility_codepage()
HMODULE hModule
Definition: animate.c:44
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
static char * cvt(double arg, int ndigits, int *decpt, int *sign, char *buf, int eflag)
Definition: fcvtbuf.c:45
unsigned long DWORD
Definition: ntddk_ex.h:95
int errno_t
Definition: corecrt.h:615
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2109