Skip to content

Instantly share code, notes, and snippets.

@0xbadfca11
Created June 29, 2017 15:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xbadfca11/d31ba1d1543aac615f1945c6670382c7 to your computer and use it in GitHub Desktop.
Save 0xbadfca11/d31ba1d1543aac615f1945c6670382c7 to your computer and use it in GitHub Desktop.
WslLaunchInteractive
#define WIN32_LEAN_AND_MEAN
#define _ATL_NO_AUTOMATIC_NAMESPACE
#include <windows.h>
#include <atlbase.h>
#include <wslapi.h>
int main()
{
if (auto WslLaunchInteractivePtr = AtlGetProcAddressFn(LoadLibraryExW(L"wslapi", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32), WslLaunchInteractive))
{
ULONG exit_code;
WslLaunchInteractivePtr(L"Legacy", L"/bin/echo WSL", FALSE, &exit_code);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment