示例#1
0
        public override IntPtr Read(IntPtr hModule, IntPtr lpRes)
        {
            _resources = new Dictionary <string, ResourceTable>();
            IntPtr pFixedFileInfo = _header.Read(lpRes);

            _fixedfileinfo = (Kernel32.VS_FIXEDFILEINFO)Marshal.PtrToStructure(
                pFixedFileInfo, typeof(Kernel32.VS_FIXEDFILEINFO));

            IntPtr pChild = ResourceUtil.Align(pFixedFileInfo.ToInt32() + _header.Header.wValueLength);

            while (pChild.ToInt32() < (lpRes.ToInt32() + _header.Header.wLength))
            {
                ResourceTable rc = new ResourceTable(pChild);
                switch (rc.Key)
                {
                case "StringFileInfo":
                    rc = new StringFileInfo(pChild);
                    break;

                default:
                    rc = new VarFileInfo(pChild);
                    break;
                }

                _resources.Add(rc.Key, rc);
                pChild = ResourceUtil.Align(pChild.ToInt32() + rc.Header.wLength);
            }

            return(new IntPtr(lpRes.ToInt32() + _header.Header.wLength));
        }
示例#2
0
        /// <summary>
        /// Read the resource header, return a pointer to the end of it.
        /// </summary>
        /// <param name="lpRes">top of header</param>
        /// <returns>end of header, after the key, aligned at 32bit</returns>
        public virtual IntPtr Read(IntPtr lpRes)
        {
            _header = (Kernel32.RESOURCE_HEADER)Marshal.PtrToStructure(
                lpRes, typeof(Kernel32.RESOURCE_HEADER));

            IntPtr pBlockKey = new IntPtr(lpRes.ToInt32() + Marshal.SizeOf(_header));

            _key = Marshal.PtrToStringUni(pBlockKey);

            return(ResourceUtil.Align(pBlockKey.ToInt32() + (_key.Length + 1) * 2));
        }
        public void Read(IntPtr lpRes)
        {
            _header = (Kernel32.RESOURCE_HEADER)Marshal.PtrToStructure(
                lpRes, typeof(Kernel32.RESOURCE_HEADER));

            IntPtr pKey = new IntPtr(lpRes.ToInt32() + Marshal.SizeOf(_header));

            _key = Marshal.PtrToStringUni(pKey);

            IntPtr pValue = ResourceUtil.Align(pKey.ToInt32() + (_key.Length + 1) * 2);

            _value = _header.wValueLength > 0 ? Marshal.PtrToStringUni(pValue, _header.wValueLength) : null;
        }
示例#4
0
        public override IntPtr Read(IntPtr lpRes)
        {
            _variables = new Dictionary <string, VarTable>();
            IntPtr pChild = base.Read(lpRes);

            while (pChild.ToInt32() < (lpRes.ToInt32() + _header.wLength))
            {
                VarTable res = new VarTable(pChild);
                _variables.Add(res.Key, res);
                pChild = ResourceUtil.Align(pChild.ToInt32() + res.Header.wLength);
            }

            return(new IntPtr(lpRes.ToInt32() + _header.wLength));
        }