-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.cpp
More file actions
29 lines (23 loc) · 746 Bytes
/
utils.cpp
File metadata and controls
29 lines (23 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "utils.h"
#include <iostream>
void PrintHR(HRESULT hr)
{
LPSTR lpMsgBuf = nullptr;
DWORD ret = 0;
HMODULE modules[] = {GetModuleHandle(TEXT("imapi2.dll")),
GetModuleHandle(TEXT("imapi2fs.dll")), nullptr};
for (const auto &hModule : modules)
{
ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_HMODULE,
hModule, hr,
0, // MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
lpMsgBuf, 0, nullptr);
if (ret != 0)
{
printf(" Returned %08x: %s\n", hr, lpMsgBuf);
break;
}
}
LocalFree(lpMsgBuf);
}