aboutsummaryrefslogtreecommitdiff
path: root/template/c/snip-win32-formaterror.c
diff options
context:
space:
mode:
Diffstat (limited to 'template/c/snip-win32-formaterror.c')
-rw-r--r--template/c/snip-win32-formaterror.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/template/c/snip-win32-formaterror.c b/template/c/snip-win32-formaterror.c
new file mode 100644
index 0000000..bfb88f7
--- /dev/null
+++ b/template/c/snip-win32-formaterror.c
@@ -0,0 +1,13 @@
+void* pbuf;
+FormatMessageA(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPSTR) &pbuf,
+ 0,
+ NULL
+);
+
+{{_cursor_}}
+LocalFree(pbuf);