예제 #1
0
        public string DoQuery(string query)
        {
            IntPtr viewhandle = IntPtr.Zero;
            IntPtr nothing    = IntPtr.Zero;
            int    nres       = CallMsi.MsiDatabaseOpenView(dbhandle, query, ref viewhandle);

            nres = CallMsi.MsiViewExecute(viewhandle, nothing);
            IntPtr rechandle = IntPtr.Zero;

            nres = CallMsi.MsiViewFetch(viewhandle, ref rechandle);
            if (0 != nres)           // No data
            {
                CallMsi.MsiCloseHandle(viewhandle);
                return(null);
            }
            int           outlen  = 255;
            StringBuilder outbuff = new StringBuilder(outlen);

            nres = CallMsi.MsiRecordGetString(rechandle, 1, outbuff, ref outlen);
            int rel = CallMsi.MsiCloseHandle(viewhandle);

            rel = CallMsi.MsiCloseHandle(rechandle);
            if (0 != nres)           // No data
            {
                return(null);
            }
            return(outbuff.ToString());
        }
예제 #2
0
 public void InternalDispose(bool disposing)
 {
     CallMsi.MsiCloseHandle(dbhandle);
     dbhandle = IntPtr.Zero;
 }