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的更多相关文章

  1. 使用rundll32.exe绕过应用程序白名单(多种方法)

    0x00 前言 本文演示了白名单AppLocker bypass的最常见和最熟悉的技术.我们知道,出于安全原因,系统管理员添加组策略来限制本地用户的应用程序执行.在上一篇文章中,我们讨论了“ Wind ...

  2. rundll32.exe文件详解

    平时很常听到有些朋友说:呀,我系统的注册表启动项目有rundll32.exe,系统进程也有rundll32.exe,是不是病毒呀?这是对rundll32.exe接口不了解,其实其原理非常简单,了解并掌 ...

  3. RunDll32.exe 详解及[Windows批处理]清除IE缓存

    Rundll32命令详解 文件作用:执行32位DLL文件中的内部函数 位置:X:(当前系统分区)\windows\system32 命令语法: Rundll32.exe DLLname,Functio ...

  4. rundll32.exe的相关使用语句

    命令列: rundll32.exe shell32.dll,Control_RunDLL 功能: 显示控制面板 命令列: rundll32.exe shell32.dll,Control_RunDLL ...

  5. 命令行下的“蒙面歌王”rundll32.exe

    在Windows系统中,为了节省内存和实现代码重用,微软在Windows操作系统中实现了一种共享函数库的方式.这就是DLL(Dynamic Link Library)文件,即动态链接库,这种库包含了可 ...

  6. httpd.exe你的电脑中缺失msvcr110.dll怎么办(WIN2008服务器环境装WAMP2.5出现的问题)

    httpd.exe你的电脑中缺失msvcr110.dll怎么办 去微软官方下载相应的文件 1 打开上面说的网址 Download and install, if you not have it alr ...

  7. c:\Windows\system32\rundll32.exe Windows无法访问指定设备、路径或文件,你可能没有适当的权限访问该项目

    非常懂如何修改权限的可以尝试,否则老老实实地重新注册的系统的.dll文件 重新注册方法如下: WIN+R下输入命令: cmd /c for %i in (%windir%\system32\*.dll ...

  8. 运行EXE文件,系统提示缺少api-ms-win-crt-runtime-l1-1-0.dll,解决方法!!

    api-ms-win-crt-runtime-l1-1-0.dll是一个Windows系统的应用程序拓展文件,也叫动态链接库文件.这个文件能帮助绝大多数用户解决在安装或启动部分游戏软件时出现计算机中丢 ...

  9. 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 ...

随机推荐

  1. 下面哪些属于JSTL中的表达式操作标签。(选择1项)

    A.<c:out> B.<c:if> C.<c:url> D.<c:catch> 解答:A

  2. MathType中空格个数怎么显示

    在使用Word文档的时候很时候用原软件自带的公式编辑器不是很好用,也不方法.MathType就是来解决这个问题的,但是一些用户在使用过程中发现不会看究竟输了多少空格,只能估摸大概.下面本MathTyp ...

  3. gradlew assembleRelease打包之前的配置

    http://blog.csdn.net/qq_15527709/article/details/70146061

  4. WPS长文档编辑技巧之二:对样式的设置与修改

    目录:       1.使用系统内置样式 2.如何修改样式 3.如何自定义样式 4.在文档使用多级编号 5.结合样式编辑文档大纲 6.利用文档结构图查看大纲结构 正文: 1.使用系统内置样式 在使用样 ...

  5. java基础---->final关键字的使用

    这里介绍一些java基础关于final的使用,文字说明部分摘自java语言规范.心甘情愿这四个字,透着一股卑微,但也有藏不住的勇敢. Final关键字的说明 一.关于final变量规范说明 .A fi ...

  6. docker的私有仓库的搭建

    author: headsen chen date:2018-06-30  23:14:16 服务端(私有仓库:centos7_64位),使用端:centos6_64位 1.仓库的搭建: 安装dock ...

  7. 【BZOJ4598】[Sdoi2016]模式字符串 树分治+hash

    [BZOJ4598][Sdoi2016]模式字符串 Description 给出n个结点的树结构T,其中每一个结点上有一个字符,这里我们所说的字符只考虑大写字母A到Z,再给出长度为m的模式串s,其中每 ...

  8. 【BZOJ4254】Aerial Tramway 树形DP

    [BZOJ4254]Aerial Tramway 题意:给你一座山上n点的坐标,让你在山里建m条缆车,要求缆车两端的高度必须相等,且中间经过的点的高度都小于缆车的高度.并且不能存在一个点位于至少k条缆 ...

  9. 《从零开始学Swift》学习笔记(Day 66)——Cocoa Touch设计模式及应用之通知机制

    原创文章,欢迎转载.转载请注明:关东升的博客 通知(Notification)机制是基于观察者(Observer)模式也叫发布/订阅(Publish/Subscribe)模式,是 MVC( 模型-视图 ...

  10. NIO概览

    NIO专题:http://developer.51cto.com/art/201112/307172.htm 一.新IO概述: 新IO和传统IO都是用于进行输入/输出,相比于传统IO面向流的处理方式, ...