/// <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 = (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) * Marshal.SystemDefaultCharSize)); }
/// <summary> /// Read a string resource. /// </summary> /// <param name="lpRes">Pointer to the beginning of a string resource.</param> internal 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) * Marshal.SystemDefaultCharSize); _value = ((_header.wValueLength > 0) ? Marshal.PtrToStringUni(pValue, _header.wValueLength) : null); }