-
Notifications
You must be signed in to change notification settings - Fork 0
/
WinMain.c
34 lines (29 loc) · 1.33 KB
/
WinMain.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#define _WIN32_WINNT _WIN32_WINNT_WIN10
#include <initguid.h>
#include <windows.h>
#include <appmodel.h>
#include <shobjidl.h>
int WinMainCRTStartup()
{
CoInitialize(NULL);
IPackageDebugSettings *pPackageDebugSettings = NULL;
CoCreateInstance(&CLSID_PackageDebugSettings, NULL, CLSCTX_INPROC_SERVER, &IID_IPackageDebugSettings,
(LPVOID *)&pPackageDebugSettings);
PWSTR packageFamilyNames[] = {L"Microsoft.MinecraftUWP_8wekyb3d8bbwe",
L"Microsoft.MinecraftWindowsBeta_8wekyb3d8bbwe"};
for (int i = 0; i < 2; i++)
{
UINT32 count = 0, bufferLength = 0;
if (GetPackagesByPackageFamily(packageFamilyNames[i], &count, NULL, &bufferLength, NULL) !=
ERROR_INSUFFICIENT_BUFFER)
continue;
PWSTR packageFullName = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * bufferLength);
GetPackagesByPackageFamily(packageFamilyNames[i], &count, HeapAlloc(GetProcessHeap(), 0, sizeof(PWSTR) * count),
&bufferLength, packageFullName);
pPackageDebugSettings->lpVtbl->EnableDebugging(pPackageDebugSettings, packageFullName, NULL, NULL);
}
pPackageDebugSettings->lpVtbl->Release(pPackageDebugSettings);
CoUninitialize();
ExitProcess(0);
return 0;
}