Exemple #1
0
        internal VerUtilVersionReleaseLabel(IntPtr pReleaseLabel, IntPtr wzVersion)
        {
            var releaseLabel = (VerUtil.VersionReleaseLabelStruct)Marshal.PtrToStructure(pReleaseLabel, typeof(VerUtil.VersionReleaseLabelStruct));

            this.IsNumeric = releaseLabel.fNumeric;
            this.Value     = releaseLabel.dwValue;
            this.Label     = VerUtil.VersionStringFromOffset(wzVersion, releaseLabel.cchLabelOffset, releaseLabel.cchLabel);
        }
Exemple #2
0
        internal VerUtilVersion(VerUtil.VersionHandle handle)
        {
            this.Handle = handle;

            var pVersion = handle.DangerousGetHandle();
            var version  = (VerUtil.VersionStruct)Marshal.PtrToStructure(pVersion, typeof(VerUtil.VersionStruct));

            this.Version       = Marshal.PtrToStringUni(version.sczVersion);
            this.Major         = version.dwMajor;
            this.Minor         = version.dwMinor;
            this.Patch         = version.dwPatch;
            this.Revision      = version.dwRevision;
            this.ReleaseLabels = new VerUtilVersionReleaseLabel[version.cReleaseLabels];
            this.Metadata      = VerUtil.VersionStringFromOffset(version.sczVersion, version.cchMetadataOffset);
            this.IsInvalid     = version.fInvalid;

            for (var i = 0; i < version.cReleaseLabels; ++i)
            {
                var offset        = i * Marshal.SizeOf(typeof(VerUtil.VersionReleaseLabelStruct));
                var pReleaseLabel = new IntPtr(version.rgReleaseLabels.ToInt64() + offset);
                this.ReleaseLabels[i] = new VerUtilVersionReleaseLabel(pReleaseLabel, version.sczVersion);
            }
        }