-
-
Save rphillips/cc82312ce59d4c3cdf7c to your computer and use it in GitHub Desktop.
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
local Error = require('core').Error | |
local ffi = require('ffi') | |
local fmt = require('string').format | |
ffi.cdef[[ | |
typedef unsigned long MSIHANDLE; | |
typedef unsigned int UINT, DWORD; | |
typedef char CHAR; | |
typedef CHAR *NPSTR, *LPSTR, *PSTR; | |
typedef const CHAR *LPCSTR, *LPTSTR, *LPCTSTR, *PCSTR; | |
enum { | |
ERROR_SUCCESS = 0L, | |
ERROR_MORE_DATA = 234L | |
}; | |
UINT MsiOpenPackageA(const char* szPackagePath, MSIHANDLE *hProduct); | |
UINT MsiGetProductPropertyA(MSIHANDLE hProduct, LPCTSTR szProperty, LPTSTR lpValueBuf, DWORD *pcchValueBuf); | |
UINT MsiCloseHandle(MSIHANDLE hAny); | |
]] | |
local msilib = ffi.load("Msi") | |
local msi_path = 'out.msi' | |
local phProduct = ffi.new('MSIHANDLE[1]') | |
local ret = msilib.MsiOpenPackageA(msi_path, phProduct); | |
if ret ~= ffi.C.ERROR_SUCCESS then | |
error(ret) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment