Skip to content

Instantly share code, notes, and snippets.

@0xbadfca11
Last active March 5, 2018 05:20
Show Gist options
  • Save 0xbadfca11/09bf8efefcdc6e1681370f4ff5335056 to your computer and use it in GitHub Desktop.
Save 0xbadfca11/09bf8efefcdc6e1681370f4ff5335056 to your computer and use it in GitHub Desktop.
BOOLEAN WINAPI RtlAreLongPathsEnabled()
#include <windows.h>
#include <atlalloc.h>
#include <atlcore.h>
#include <clocale>
#include <cstdio>
int wmain(int, PWSTR argv[])
{
setlocale(LC_ALL, "");
IFDYNAMICGETCACHEDFUNCTIONTYPEDEF(L"ntdll", BOOLEAN(WINAPI*)(), "RtlAreLongPathsEnabled", RtlAreLongPathsEnabled)
{
printf("RtlAreLongPathsEnabled()=%d\n", RtlAreLongPathsEnabled());
}
if (!CreateDirectoryW(argv[1], nullptr))
{
ATL::CHeapPtr<WCHAR> msg;
ATLENSURE(msg.Allocate(USHRT_MAX));
ATLENSURE(FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), 0, msg, USHRT_MAX, nullptr));
_putws(msg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment