How do I execute a *.dll file

北城余情 提交于 2019-11-27 00:17:49

问题


I have a DLL file and want to execute it on Windows. I obtained this DLL from a Challenge site which alleges the DLL should be executed independently.


回答1:


To run the functions in a DLL, first find out what those functions are using any PE (Portable Executable) analysis program (e.g. Dependency Walker). Then use RUNDLL32.EXE with this syntax:

 RUNDLL32.EXE <dllname>,<entrypoint> <optional arguments>

dllname is the path and name of your dll file, entrypoint is the function name, and optional arguments are the function arguments




回答2:


You can execute a function defined in a DLL file by using the rundll command. You can explore the functions available by using Dependency Walker.




回答3:


While many people have pointed out that you can't execute dlls directly and should use rundll32.exe to execute exported functions instead, here is a screenshot of an actual dll file running just like an executable:

While you cannot run dll files directly, I suspect it is possible to run them from another process using a WinAPI function CreateProcess:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx




回答4:


.DLL files are not executable in the sense that .EXE/.COM/.BAT files are executable, so I'm not sure what you mean.

You can use the Dependency Walker application that comes with the Windows SDK to interrogate a .DLL and see what functions are exported by the file.




回答5:


You can't "execute" a DLL. You can execute functions within the DLL, as explained in the other answers. Although .EXE files and .DLL files are essentially identical in terms of format, the distinguishing feature of an .EXE is that it contains a designated "entry point" to go and do the thing the EXE was created to do. DLLs actually have something similar, but the purpose of the "dll main" is just to perform initialization and not fulfill the primary purpose of the DLL; that is for the (presumably) various other functions it contains.

You can execute any of the functions exported by a DLL, assuming you know which one you want to execute; an EXE may contain a whole lot of functions, but one and only one is specially designated to be executed simply by "running" it.




回答6:


To Run a .dll file..First find out what are functions it is exporting..Dll files will excecute the functions specified in the Export Category..To know what function it is Exporting refer "filealyzer" Application..It will show you the export function under "PE EXPORT" Category..Notedown the function name-- Then open the command prompt,Type Rundll32 dllname,functionname (dllname--name of your dll) (Functionname-- name of the function you found under the PE Export) Note:Makesure that your command prompt location is your dll file location




回答7:


It should be mentioned that since it is entirely possible to run DLL's just as any other executable, it has long been considered a security issue. As such, there have been a number of security improvements and registry hacks (sorry no longer have ref-links) that prevents running DLL's from regular user space without extra privileges.

As a good example. I recall making these hacks, but since I no longer remember what exactly I did. I can no longer run any DLLs from normal user shell environment, even though starting various Win apps from GUI works just fine.

That said, one should definitely read "Dynamic-Link Library Security" and "Best Practices to Prevent DLL Hijacking".




回答8:


The following series of steps might be helpful:

  1. Open Windows Explorer
  2. In the top-left corner, click "Organize"
  3. select "Folder and Search Options"
  4. Switch to the "View" tab
  5. Scroll down and uncheck "Hide file extensions for known file types"
  6. Click OK
  7. Now find the dll file
  8. Right-click on it and select "Rename"
  9. Change the extension(what comes after the last .) and change it to .exe


来源:https://stackoverflow.com/questions/3044395/how-do-i-execute-a-dll-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!