Using RUNDLL32.exe to call a function within a dll
Using RUNDLL32.exe to call a function within a dll
Rundll32 is a utility included with Windows that allows you to execute an exported DLL-function from a command line.
Consider the following (exported) function in a DLL:
#include <windows.h>
extern "C" __declspec (dllexport) void __cdecl rdl (
HWND hwnd, // handle to owner window
HINSTANCE hinst, // instance handle for the DLL
LPTSTR lpCmdLine, // string the DLL will parse
int nCmdShow // show state
)
{
::MessageBox(0,lpCmdLine,0,0);
}
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved)
{
return TRUE;
}
The function rdl within the dll can now be called using rundll32:
rundll32 c:\path\to\dll\rdl.dll,rdl hallo
Note: the function rdl is specified with __declspec (dllexport). This is needed in order to export the function such that its address can be gotten with GetProcAddress. rundll32 used GetProcAddress. Also, the function rdl is specified with extern "C" and __cdecl so that rdl is not name-mangled (in case it is compiled with a c++ compiler).
Printing an HTML document
rundll32.exe %windir%\system32\mshtml.dll,PrintHTML "C:\x.html"
Note, the document name (at least on my system) needs to be enclosed in quotes.
Using RUNDLL32.exe to call a function within a dll的更多相关文章
- 使用rundll32.exe绕过应用程序白名单(多种方法)
0x00 前言 本文演示了白名单AppLocker bypass的最常见和最熟悉的技术.我们知道,出于安全原因,系统管理员添加组策略来限制本地用户的应用程序执行.在上一篇文章中,我们讨论了“ Wind ...
- rundll32.exe文件详解
平时很常听到有些朋友说:呀,我系统的注册表启动项目有rundll32.exe,系统进程也有rundll32.exe,是不是病毒呀?这是对rundll32.exe接口不了解,其实其原理非常简单,了解并掌 ...
- RunDll32.exe 详解及[Windows批处理]清除IE缓存
Rundll32命令详解 文件作用:执行32位DLL文件中的内部函数 位置:X:(当前系统分区)\windows\system32 命令语法: Rundll32.exe DLLname,Functio ...
- rundll32.exe的相关使用语句
命令列: rundll32.exe shell32.dll,Control_RunDLL 功能: 显示控制面板 命令列: rundll32.exe shell32.dll,Control_RunDLL ...
- 命令行下的“蒙面歌王”rundll32.exe
在Windows系统中,为了节省内存和实现代码重用,微软在Windows操作系统中实现了一种共享函数库的方式.这就是DLL(Dynamic Link Library)文件,即动态链接库,这种库包含了可 ...
- httpd.exe你的电脑中缺失msvcr110.dll怎么办(WIN2008服务器环境装WAMP2.5出现的问题)
httpd.exe你的电脑中缺失msvcr110.dll怎么办 去微软官方下载相应的文件 1 打开上面说的网址 Download and install, if you not have it alr ...
- c:\Windows\system32\rundll32.exe Windows无法访问指定设备、路径或文件,你可能没有适当的权限访问该项目
非常懂如何修改权限的可以尝试,否则老老实实地重新注册的系统的.dll文件 重新注册方法如下: WIN+R下输入命令: cmd /c for %i in (%windir%\system32\*.dll ...
- 运行EXE文件,系统提示缺少api-ms-win-crt-runtime-l1-1-0.dll,解决方法!!
api-ms-win-crt-runtime-l1-1-0.dll是一个Windows系统的应用程序拓展文件,也叫动态链接库文件.这个文件能帮助绝大多数用户解决在安装或启动部分游戏软件时出现计算机中丢 ...
- You may experience an access violation when you access an STL object through a pointer or reference in a different DLL or EXE
Symptoms When accessing an STL object created in one DLL or EXE through a pointer or reference in a ...
随机推荐
- java中不用BigInteger实现超大整数的乘法操作
昨天看到一个题目:计算1234!,不能用BigInteger类 众所周知阶乘的数据会非常大,经常使用的int和long型根本不够用.一般想到的仅仅有BigInteger类,可是题目中明白说了不能用,所 ...
- install phalcon on mac with XAMPP
首先使用brew安装对应版本的phalcon,参考https://docs.phalconphp.com/en/latest/reference/tutorial.html 安装好后会有 phalco ...
- 如何在ChemDraw中打出符号π
很多人日常使用ChemDraw是一款非常优秀的化学绘图软件,在其绘制化学结构式或者反应式的过程中,常常需要添加各种符号.比如有的用户会需要输入希腊字符π,但是不知道用什么方法添加.本教程就来给大家介绍 ...
- Activity 5秒 Broadcast 10秒 Service 20秒
第一:什么会引发ANR? 在Android里,应用程序的响应性是由Activity Manager和WindowManager系统服务监视的 .当它监测到以下情况中的一个时,Android就会针对特定 ...
- C语言while语句
在C语言中,共有三大常用的程序结构: 顺序结构:代码从前往后执行,没有任何“拐弯抹角”: 选择结构:也叫分支结构,重点要掌握 if else.switch 以及条件运算符: 循环结构:重复执行同一段代 ...
- js小功能实现
发送随机数手机验证码60秒倒计时 mm.mobileCheck = function(t){ var mobile = $("#user_mobile").val(); if(&q ...
- python练习题集合-2
author:headsen chen date:2018-06-01 15:39:26 习题17,文件的更多操作 [root@localhost py]# echo > cc.txt [ro ...
- Objective-C代码学习大纲(2)
2011-05-11 14:06 佚名 otierney 字号:T | T 本文为台湾出版的<Objective-C学习大纲>的翻译文档,系统介绍了Objective-C代码,很多名词为台 ...
- android how to deal with data when listview refresh
如何解决listview数据刷新,下拉刷新,上拉加载更多时,图片不闪烁. 在Activity的onResume()方法中将adaper和listView重新再绑定一次. listView.setAda ...
- js 中的变量声明提前总结
一.var 声明 ES6之前,js 中声明变量基本上用 var 关键字: 1.如果访问未声明的变量,会报错:ReferenceError 2.声明了未赋值,值为 undefined,跟前面的报错是两回 ...