Example #1
0
        private static int AcmDriverEnumFunc(IntPtr hadid, int dwInstance, int fdwSupport)
        {
            ACMDRIVERDETAILS details = new ACMDRIVERDETAILS();

            details.cbStruct = Marshal.SizeOf(details);
            AcmNativeMethods.acmDriverDetails(hadid, ref details, 0);
            _listDetails.Add(AcmDriverInfo.FromDriverDetails(details, hadid.ToInt32()));
            return(1);
        }
Example #2
0
        internal static AcmDriverInfo FromDriverDetails(ACMDRIVERDETAILS details, int driverId)
        {
            AcmDriverInfo info = new AcmDriverInfo();

            info.DriverId    = driverId;
            info.Flags       = details.fdwSupport;
            info.ShortName   = details.szShortName;
            info.LongName    = details.szLongName;
            info.Description = details.szFeatures;
            info._formats    = new List <AcmFormatInfo>();
            IntPtr hDrv;

            AcmNativeMethods.acmDriverOpen(out hDrv, driverId, 0);
            ACMFORMATTAGDETAILS afdt = new ACMFORMATTAGDETAILS();

            afdt.cbStruct = Marshal.SizeOf(afdt);
            IntPtr pafd = Marshal.AllocHGlobal(afdt.cbStruct);

            Marshal.StructureToPtr(afdt, pafd, false);
            AcmNativeMethods.acmFormatTagEnum(hDrv, /*ref afdt*/ pafd, info.AcmFormatTagEnumCB, (int)hDrv, 0);
            Marshal.FreeHGlobal(pafd);
            AcmNativeMethods.acmDriverClose(hDrv, 0);
            return(info);
        }