-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_msi.c
50 lines (34 loc) · 1.09 KB
/
test_msi.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#define WIN32_LEAN_AND_MEAN
#include "Windows.h"
#include <msi.h>
#include <msiquery.h>
#include <stdio.h>
typedef UINT (__stdcall *OnInstall_ptr)(MSIHANDLE hInstall);
typedef UINT (__stdcall *OnUnInstall_ptr)(MSIHANDLE hInstall);
int main()
{
HMODULE hMod = LoadLibraryW(L"UnRAR0.dll");
if (hMod)
{
UINT res_OnInstall = ERROR_SUCCESS;
OnInstall_ptr OnInstall_fp = (OnInstall_ptr)GetProcAddress(hMod, "OnInstall");
if (OnInstall_fp)
{
res_OnInstall = OnInstall_fp((MSIHANDLE)0);
if (res_OnInstall != ERROR_SUCCESS) {
return res_OnInstall;
}
}
UINT res_OnUnInstall = ERROR_SUCCESS;
OnUnInstall_ptr OnUnInstall_fp = (OnUnInstall_ptr)GetProcAddress(hMod, "OnUnInstall");
if (OnUnInstall_fp)
{
res_OnUnInstall = OnUnInstall_fp((MSIHANDLE)0);
if (res_OnUnInstall != ERROR_SUCCESS) {
return res_OnUnInstall;
}
}
return 0;
}
return __LINE__;
}