如何在exe中提取dll
答案:2 悬赏:20 手机版
解决时间 2021-01-30 03:41
- 提问者网友:两耳就是菩提
- 2021-01-29 08:09
请各位看清问题再回答
最佳答案
- 五星知识达人网友:逃夭
- 2021-01-29 09:25
using System;
using System.Runtime.InteropServices;
using System.Drawing;
namespace WindowsAppTmp
{
public class ExtractIcon
{
[DllImport("Shell32.dll")]
private static extern int SHGetFileInfo
(
string pszPath,
uint dwFileAttributes,
out SHFILEINFO psfi,
uint cbfileInfo,
SHGFI uFlags
);
[StructLayout(LayoutKind.Sequential)]
private struct SHFILEINFO
{
public SHFILEINFO(bool b)
{
hIcon=IntPtr.Zero;iIcon=0;dwAttributes=0;szDisplayName="";szTypeName="";
}
public IntPtr hIcon;
public int iIcon;
public uint dwAttributes;
[MarshalAs(UnmanagedType.LPStr, SizeConst=260)]
public string szDisplayName;
[MarshalAs(UnmanagedType.LPStr, SizeConst=80)]
public string szTypeName;
};
private ExtractIcon()
{
}
private enum SHGFI
{
SmallIcon = 0x00000001,
LargeIcon = 0x00000000,
Icon = 0x00000100,
DisplayName = 0x00000200,
Typename = 0x00000400,
SysIconIndex = 0x00004000,
UseFileAttributes = 0x00000010
}
public static Icon GetIcon(string strPath, bool bSmall)
{
SHFILEINFO info = new SHFILEINFO(true);
int cbFileInfo = Marshal.SizeOf(info);
SHGFI flags;
if (bSmall)
flags = SHGFI.Icon|SHGFI.SmallIcon|SHGFI.UseFileAttributes;
else
flags = SHGFI.Icon|SHGFI.LargeIcon|SHGFI.UseFileAttributes;
SHGetFileInfo(strPath, 256, out info,(uint)cbFileInfo, flags);
return Icon.FromHandle(info.hIcon);
}
}
}
using System;
using System.Windows.Forms;
using System.Drawing;
namespace MyForm {
public class CreatedForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button;
private Label label;
public static void Main( )
{
Application.Run( new CreatedForm( ) );
}
public CreatedForm()
{
InitializeComponents();
}
void InitializeComponents() {
//
// Set up generated class form
//
this.SuspendLayout();
this.Name = "form";
this.Size = new System.Drawing.Size(200, 96);
this.Text = "Test";
//
// Set up member button
//
button = new System.Windows.Forms.Button();
button.Name = "button";
button.Location = new System.Drawing.Point(56, 24);
button.Size = new Size(100,22);
button.Text = "按钮";
button.Anchor = (System.Windows.Forms.AnchorStyles.Top|System.Windows.Forms.AnchorStyles.Left);
button.TabIndex = 0;
this.Controls.Add(button);
button.Click+=new EventHandler(this.button_Click);
this.ResumeLayout(false);
//
label = new Label();
//label.Text = "文件图标";
label.Location=new Point(5,5);
label.Size = new Size(40,40);
this.Controls.Add(label);
}
protected void button_Click(object sender, System.EventArgs e)
{
//Stream myStream;
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = "c:\\" ;
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
openFileDialog1.FilterIndex = 2 ;
openFileDialog1.RestoreDirectory = true ;
if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
if((openFileDialog1.OpenFile())!= null)
{
//label.Text=openFileDialog1.FileName;
label.Image=WindowsAppTmp.ExtractIcon.GetIcon(openFileDialog1.FileName, false).ToBitmap();
//Console.WriteLine(openFileDialog1.FileName);
}
}
}
}
}
using System.Runtime.InteropServices;
using System.Drawing;
namespace WindowsAppTmp
{
public class ExtractIcon
{
[DllImport("Shell32.dll")]
private static extern int SHGetFileInfo
(
string pszPath,
uint dwFileAttributes,
out SHFILEINFO psfi,
uint cbfileInfo,
SHGFI uFlags
);
[StructLayout(LayoutKind.Sequential)]
private struct SHFILEINFO
{
public SHFILEINFO(bool b)
{
hIcon=IntPtr.Zero;iIcon=0;dwAttributes=0;szDisplayName="";szTypeName="";
}
public IntPtr hIcon;
public int iIcon;
public uint dwAttributes;
[MarshalAs(UnmanagedType.LPStr, SizeConst=260)]
public string szDisplayName;
[MarshalAs(UnmanagedType.LPStr, SizeConst=80)]
public string szTypeName;
};
private ExtractIcon()
{
}
private enum SHGFI
{
SmallIcon = 0x00000001,
LargeIcon = 0x00000000,
Icon = 0x00000100,
DisplayName = 0x00000200,
Typename = 0x00000400,
SysIconIndex = 0x00004000,
UseFileAttributes = 0x00000010
}
public static Icon GetIcon(string strPath, bool bSmall)
{
SHFILEINFO info = new SHFILEINFO(true);
int cbFileInfo = Marshal.SizeOf(info);
SHGFI flags;
if (bSmall)
flags = SHGFI.Icon|SHGFI.SmallIcon|SHGFI.UseFileAttributes;
else
flags = SHGFI.Icon|SHGFI.LargeIcon|SHGFI.UseFileAttributes;
SHGetFileInfo(strPath, 256, out info,(uint)cbFileInfo, flags);
return Icon.FromHandle(info.hIcon);
}
}
}
using System;
using System.Windows.Forms;
using System.Drawing;
namespace MyForm {
public class CreatedForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button;
private Label label;
public static void Main( )
{
Application.Run( new CreatedForm( ) );
}
public CreatedForm()
{
InitializeComponents();
}
void InitializeComponents() {
//
// Set up generated class form
//
this.SuspendLayout();
this.Name = "form";
this.Size = new System.Drawing.Size(200, 96);
this.Text = "Test";
//
// Set up member button
//
button = new System.Windows.Forms.Button();
button.Name = "button";
button.Location = new System.Drawing.Point(56, 24);
button.Size = new Size(100,22);
button.Text = "按钮";
button.Anchor = (System.Windows.Forms.AnchorStyles.Top|System.Windows.Forms.AnchorStyles.Left);
button.TabIndex = 0;
this.Controls.Add(button);
button.Click+=new EventHandler(this.button_Click);
this.ResumeLayout(false);
//
label = new Label();
//label.Text = "文件图标";
label.Location=new Point(5,5);
label.Size = new Size(40,40);
this.Controls.Add(label);
}
protected void button_Click(object sender, System.EventArgs e)
{
//Stream myStream;
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = "c:\\" ;
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
openFileDialog1.FilterIndex = 2 ;
openFileDialog1.RestoreDirectory = true ;
if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
if((openFileDialog1.OpenFile())!= null)
{
//label.Text=openFileDialog1.FileName;
label.Image=WindowsAppTmp.ExtractIcon.GetIcon(openFileDialog1.FileName, false).ToBitmap();
//Console.WriteLine(openFileDialog1.FileName);
}
}
}
}
}
全部回答
- 1楼网友:往事隔山水
- 2021-01-29 09:46
源文件进行了重新的编译。从来就没听说过有什么软件能对c语言生成的exe进行反编译,要不然微软也不用把xp卖那么贵了。其他语言的可能好一些,你可以试一试游戏资源提取工具 fmv-extractor中文版,这是迅雷地址,不要抱太大希望
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯