Created
October 17, 2017 04:18
-
-
Save yuk7/edcd4a468aaacc8438389dc4b4464fab to your computer and use it in GitHub Desktop.
WSL API Test code for Register Distribution. Windows 10 64bit FCU or later only. I tested with mingw-w64 64bit gcc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <windows.h> | |
typedef int (WINAPI *FUNC)(PCWSTR,PCWSTR); | |
int main() | |
{ | |
HMODULE hmod; | |
FUNC func; | |
hmodule = LoadLibrary(TEXT("wslapi.dll")); | |
if (hmod == NULL) { | |
printf("ERROR:wslapi.dll load failed"); | |
return 1; | |
} | |
func = (FUNC)GetProcAddress(hmod, "WslRegisterDistribution"); | |
if (func == NULL) { | |
FreeLibrary(hmod); | |
printf("ERROR:GetProcAddress failed"); | |
return 1; | |
} | |
int a = func(L"Test",L"install.tar.gz"); | |
printf("%d",a); | |
FreeLibrary(hmod); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment