Example #1
0
        /// <summary>
        ///   Read a string resource.
        /// </summary>
        /// <param name = "lpRes">Pointer to the beginning of a string resource.</param>
        internal void Read(IntPtr lpRes)
        {
            _header = (ResourceHeader) Marshal.PtrToStructure(lpRes, typeof (ResourceHeader));

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

            var pValue = ResourceUtil.Align(pKey.ToInt32() + (_key.Length + 1)*Marshal.SystemDefaultCharSize);
            _value = ((_header.wValueLength > 0) ? Marshal.PtrToStringUni(pValue, _header.wValueLength) : null);
        }
Example #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 a 32 bit boundary.</returns>
        internal virtual IntPtr Read(IntPtr lpRes)
        {
            _header = (ResourceHeader) Marshal.PtrToStructure(lpRes, typeof (ResourceHeader));

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

            return ResourceUtil.Align(pBlockKey.ToInt32() + (_key.Length + 1)*Marshal.SystemDefaultCharSize);
        }