Skip to content

Commit

Permalink
src/ :add arch-inst.c
Browse files Browse the repository at this point in the history
  • Loading branch information
yuk7 committed Oct 17, 2017
1 parent cbc4331 commit 96309a1
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/arch-inst.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2017 yuk7
* Author: yuk7 <[email protected]>
*
* Released under the MIT license
* http://opensource.org/licenses/mit-license.php
*/

#include <stdio.h>
#include <windows.h>

typedef int (WINAPI *FUNC)(PCWSTR,PCWSTR);

int main()
{
HMODULE hmod;
FUNC func;

hmod = LoadLibrary(TEXT("wslapi.dll"));
if (hmod == NULL) {
printf("ERROR:wslapi.dll load failed\n");
return 1;
}


func = (FUNC)GetProcAddress(hmod, "WslRegisterDistribution");
if (func == NULL) {
FreeLibrary(hmod);
printf("ERROR:GetProcAddress failed\n");
return 1;
}

printf("Installing...\n\n");
int a = func(L"Arch",L"rootfs.tar.gz");
if(a != 0)
{
printf("ERROR:Installation Failed! 0x%x",a);
return 1;
}
printf("Installation Complete!",a);
return 0;
}

0 comments on commit 96309a1

Please sign in to comment.