简体   繁体   English

如何打开 DLL 文件以查看其中写入的内容?

[英]How can I open DLL files to see what is written inside?

I lost the solution of a class library.我失去了类库的解决方案。 Can I open the DLL file which is created by the class library ?我可以打开类库创建的 DLL 文件吗?

You are better off with a decompiler like Redgate's .NET Reflector or JetBrains ' ReSharper decompiler.最好使用 Redgate 的.NET ReflectorJetBrainsReSharper反编译器等反编译器。

There are open source ones also, like:也有开源的,比如:

Follow the below steps...请按照以下步骤...

  1. Go to the Start Menu.转到开始菜单。
  2. Type Visual Studio Tool .键入Visual Studio 工具
  3. Go to the folder above.转到上面的文件夹。
  4. Click on "Developer Command Prompt for VS 2013" in the case of Visual Studio 2013 or just "Visual Studio Command Prompt " in case of Visual Studio 2010 .Visual Studio 2013的情况下单击“VS 2013 的开发人员命令提示符”,在Visual Studio 2010的情况下单击“Visual Studio 命令提示符”。
  5. After the command prompt loaded to the screen, type ILDASM.EXE press ENTER.命令提示符加载到屏幕后,键入ILDASM.EXE按 ENTER。
  6. An ILDASM window will open.将打开一个ILDASM窗口。 Drag the .dll file to the window from your folder..dll文件从您的文件夹拖到窗口中。 Or click on menu FileNew .或点击菜单FileNew Then add the required .dll file.然后添加所需的.dll文件。
  7. After the above steps, the manifest and .dll file will appear.经过以上步骤,就会出现manifest和.dll文件。 Double click on those files to see what they contain.双击这些文件以查看它们包含的内容。

I think you have downloaded the .NET Reflector & this FileGenerator plugin http://filegenreflector.codeplex.com/ , If you do,我想你已经下载了 .NET Reflector 和这个 FileGenerator 插件http://filegenreflector.codeplex.com/ ,如果你这样做了,

  1. Open up the Reflector.exe,打开 Reflector.exe,

  2. Go to View and click Add-Ins,转到查看并单击加载项,

  3. In the Add-Ins window click Add...,在加载项窗口中单击添加...,

  4. Then find the dll you have downloaded然后找到你下载的dll

  5. FileGenerator.dll (witch came wth the FileGenerator plugin), FileGenerator.dll(女巫带有 FileGenerator 插件),

  6. Then close the Add-Ins window.然后关闭加载项窗口。

  7. Go to File and click Open and choose the dll that you want to decompile,转到文件并单击打开并选择要反编译的dll,

  8. After you have opend it, it will appear in the tree view,打开它后,它会出现在树形视图中,

  9. Go to Tools and click Generate Files(Crtl+Shift+G),转到工具并单击生成文件(Crtl+Shift+G),

  10. select the output directory and select appropriate settings as your wish, Click generate files.选择输出目录并根据需要选择适当的设置,单击生成文件。

OR或者

use http://ilspy.net/使用http://ilspy.net/

You cannot get the exact code, but you can get a decompiled version of it.你不能得到确切的代码,但你可以得到它的反编译版本。

The most popular (and best) tool is Reflector , but there are also other .NET decompilers (such as Dis# ).最受欢迎(也是最好的)工具是Reflector ,但也有其他 .NET 反编译器(例如Dis# )。

You can also decompile the CIL using ILDASM , which comes bundled with the .NET Framework SDK tools.您还可以使用与 .NET Framework SDK 工具捆绑在一起的ILDASMCIL进行反编译。

I use JetBrains' dotPeek software.我使用 JetBrains 的dotPeek软件。 You can try that too.你也可以试试。

Telerik's Just Decompile is the best I've used. Telerik 的Just Decompile是我用过的最好的。 It's free once you sign up with an email.使用电子邮件注册后,它是免费的。

Open the .dll file with Visual Studio.使用 Visual Studio 打开.dll文件。 Or a resource editor.或资源编辑器。

*.dll files are archive files opened with WinZip , 7-Zip , etc. That isn't to say that all .dll files are archives. *.dll 文件是使用WinZip7-Zip等打开的存档文件。这并不是说所有 .dll 文件都是存档文件。 You can save anything with the .dll extension.您可以使用 .dll 扩展名保存任何内容。 However, most Windows .dll files are generated to be archives.但是,大多数 Windows .dll 文件生成为存档。 Examples of this are Windows > twain_32.dll which is an archive file.这方面的示例是 Windows > twain_32.dll,它是一个存档文件。 However, twain.dll is not.但是, twain.dll不是。 If you look at twain.dll you will see an MZŽ as the first three notepad characters which denotes a compiled C file/program or part of a program.如果您查看 twain.dll,您会看到一个 MZŽ 作为前三个记事本字符,表示已编译的 C 文件/程序或程序的一部分。 Whereas MZ seems to be an archive.而 MZ 似乎是一个档案。

Also, most .exe files are archives mostly containing an icon image, etc. For the file and the windows installer packages as well, they contain all the information the program needs to run images, movies, etc. and also directories including installation information and plain text files.此外,大多数 .exe 文件是主要包含图标图像等的档案。对于文件和 Windows 安装程序包,它们包含程序运行图像、电影等所需的所有信息,以及包括安装信息和目录在内的目录。纯文本文件。

I have a game here, game.exe , and it contains Java class files and image a pointer directing the .exe to run a .bat file.我在这里有一个游戏game.exe ,它包含 Java 类文件和图像指针,指示 .exe 运行 .bat 文件。 Obviously, your .bat file will run a javac call from the archive and run the game.显然,您的 .bat 文件将从存档中运行javac调用并运行游戏。 There are also a few .dll archives containing Java class files.还有一些包含 Java 类文件的 .dll 档案。

[autorun]
ICON=AUTORUN\MINCRAFTLOGO.ICO
standard icon redirect here .ico is an image file within a .dll file within a .exe file. So the image seen on the .exe file is the minecraft logo. This is in a file called autorun.inf. Second example

[discstarter]
    startpage=Autostart\Disk1.html
    uselanguagestartpage=1
    windowcaption=Solid Edge
    licensee=Siemens PLM Software
    productguid=05B227DF-DB00-4934-B3C8-40B7D8FAA54A
    singleinstance=1
    hidesplashscreen=1
    noscrollbars=0
    showstatusbar=1
    splashscreentime=0
    windowwidth=750
    windowheight=775
    buttondir=Autostart
    toolbarcolor=16777215
    toolbar=goback,goforward,gohome,print,exit
    [autorun]
    open=autostart.exe
    icon=Autostart\ENGINE.ICO

This is the solid edge autorun.inf file contained in solidedge.exe Autostart\ is the Autostart.dll directory.这是solidedge.exe 中包含的solidedge autorun.inf文件 Autostart\ 是Autostart.dll目录。 open=autostart.exe specifies the autostart.exe file to run from within the original solidedge.exe archive. open=autostart.exe 指定要从原始 solidedge.exe 存档中运行的 autostart.exe 文件。 Here is a sample program using the .dll (dynamic link library) files: Creating And Using DLLs .这是一个使用 .dll(动态链接库)文件的示例程序: 创建和使用 DLL

It also shows how they are created.它还显示了它们是如何创建的。 As you can see, the contents of the DLL file file is called by an EXE file file as I previously explained.如您所见,DLL文件文件的内容是由EXE文件文件调用的,正如我之前解释的那样。 Also there is a tutorial here Walkthrough: Create and use your own Dynamic Link Library (C++) , and, as I said before, 7-Zip or WinZip will open a dynamic link library as an archive as long as you have the .dll file.这里还有一个教程Walkthrough: Create and use your own Dynamic Link Library (C++) ,正如我之前所说,只要你有 .dll 文件,7-Zip 或 WinZip 就会打开一个动态链接库作为存档. If the contents of the dynamic link library have been compiled obviously, you need a program which can read the file.如果动态链接库的内容已经被明显编译,则需要一个可以读取该文件的程序。

However, since .dll files are by definition just archive library files, the DLL file itself should be readable and not a compiled C or C# file, etc., etc. Basically, .dll files are archives.但是,由于 .dll 文件根据定义只是存档库文件,因此 DLL 文件本身应该是可读的,而不是编译后的 C 或 C# 文件等。基本上,.dll 文件是存档文件。 Well, they should be when a .dll file is created in Visual Studio.好吧,它们应该是在 Visual Studio 中创建 .dll 文件时。 The DLL file is created and any information you store in the DLL file file is encrypted. DLL 文件被创建并且您存储在 DLL 文件文件中的任何信息都被加密。 Mostly, this encryption is handled by Visual Studio itself and generally isn't edited by hand.大多数情况下,这种加密是由 Visual Studio 本身处理的,通常不是手动编辑的。 When you read a .dll file contents as a .exe, the contents are automatically decrypted.当您将 .dll 文件内容作为 .exe 读取时,内容会自动解密。 Now when we talk about compiling a program we are changing the contents into bytecode the machine easily interprets.现在,当我们谈论编译程序时,我们正在将内容更改为机器易于解释的字节码。

This file size would be smaller than the original file of the same contents.此文件大小将小于相同内容的原始文件。 However, the filesize is larger, suggesting that the file has actually been encrypted.但是,文件大小较大,表明该文件实际上已被加密。 It is probably to stop people reading their code.这可能是为了阻止人们阅读他们的代码。 As a result, the reading of .dll contents is termed decryption and not decompilation.因此,读取 .dll 内容称为解密而不是反编译。 Decompilation would convert the already-compiled .txt files to unreadable byte code.反编译会将已编译的 .txt 文件转换为不可读的字节码。 The use of standard .dll files is by definition not open source, because it involves the deliberate obfuscation of byte code.标准 .dll 文件的使用根据定义不是开源的,因为它涉及故意混淆字节码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM