Beispiel #1
0
        /// <summary>
        /// Get a module's property value.
        /// </summary>
        /// <typeparam name="T">The type of property to get.</typeparam>
        /// <param name="moduleName">The module name.</param>
        /// <param name="propertyName">The property name. Properties are described in the ‘Synopsis’ subsection of the
        /// module's documentation.</param>
        /// <param name="value">The value read from the module.</param>
        public void PropertyGet <T>(string moduleName, string propertyName, out T value)
            where T : unmanaged
        {
            value = default;

            GCHandle gch = GCHandle.Alloc(value, GCHandleType.Pinned);

            PropertyGet(moduleName, propertyName, gch.AddrOfPinnedObject());
            value = PInvokeHelper.PtrToRefStructure <T>(gch.AddrOfPinnedObject());
            gch.Free();
        }