MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / wmain

Function wmain

app/wmain.cpp:7–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5extern int __cdecl main(int, char*[]);
6
7int wmain(int argc, wchar_t* argv[]) {
8 char** args;
9 int nbytes = static_cast<int>(sizeof(char*) * (argc + 1));
10 HANDLE heap = GetProcessHeap();
11
12 for (int i = 0; i < argc; ++i)
13 nbytes += WideCharToMultiByte(CP_UTF8, 0, argv[i], -1, nullptr, 0, nullptr, nullptr);
14
15 args = reinterpret_cast<char**>(HeapAlloc(heap, 0, nbytes));
16 args[0] = reinterpret_cast<char*>(args + argc + 1);
17
18 for (int i = 0; i < argc; ++i)
19 args[i + 1] = args[i] + WideCharToMultiByte(CP_UTF8, 0, argv[i], -1, args[i], nbytes, nullptr, nullptr);
20
21 args[argc] = nullptr;
22
23 argc = main(argc, args);
24 HeapFree(heap, 0, args);
25 return argc;
26}
27
28int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) {
29 (void)hInstance;

Callers 1

wWinMainFunction · 0.85

Calls 1

mainFunction · 0.70

Tested by

no test coverage detected