/// <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; }