InpOut32 InputTest.cpp hacking
/************************************************************************************
* InpOut32 InputTest.cpp hacking
* 说明:
* 跟一下InputTest.cpp中InpOut32怎么使用。
*
* 2017-6-5 深圳 龙华樟坑村 曾剑锋
***********************************************************************************/ // InpoutTest.cpp : Defines the entry point for the console application.
// #include "stdafx.h"
#include "windows.h"
#include "stdio.h" // 函数类型指针定义
typedef void (__stdcall *lpOut32)(short, short);
typedef short (__stdcall *lpInp32)(short);
typedef BOOL (__stdcall *lpIsInpOutDriverOpen)(void);
typedef BOOL (__stdcall *lpIsXP64Bit)(void); //Some global function pointers (messy but fine for an example)
// 函数指针声明,gfpOut32 = global function pointer Inpout32
lpOut32 gfpOut32;
lpInp32 gfpInp32;
lpIsInpOutDriverOpen gfpIsInpOutDriverOpen;
lpIsXP64Bit gfpIsXP64Bit; /**
* 下面链接中有解释以下Beep、StopBeep代码中的含义:
* How does the following code make PC beeps?
* https://stackoverflow.com/questions/5987683/how-does-the-following-code-make-pc-beeps
*/
void Beep(unsigned int freq)
{
gfpOut32(0x43, 0xB6);
gfpOut32(0x42, (freq & 0xFF));
gfpOut32(0x42, (freq >> ));
Sleep();
gfpOut32(0x61, gfpInp32(0x61) | 0x03);
} void StopBeep()
{
gfpOut32(0x61, (gfpInp32(0x61) & 0xFC));
} int main(int argc, char* argv[])
{
if(argc<)
{
//too few command line arguments, show usage
printf("Error : too few arguments\n\n***** Usage *****\n\nInpoutTest read <ADDRESS> \nor \nInpoutTest write <ADDRESS> <DATA>\n\n\n\n\n");
}
else
{
//Dynamically load the DLL at runtime (not linked at compile time)
// 在运行的时候动态加载DLL
HINSTANCE hInpOutDll ;
hInpOutDll = LoadLibrary ( "InpOut32.DLL" ) ; //The 32bit DLL. If we are building x64 C++
//applicaiton then use InpOutx64.dll
if ( hInpOutDll != NULL )
{
// 获取函数操作指针
gfpOut32 = (lpOut32)GetProcAddress(hInpOutDll, "Out32");
gfpInp32 = (lpInp32)GetProcAddress(hInpOutDll, "Inp32");
gfpIsInpOutDriverOpen = (lpIsInpOutDriverOpen)GetProcAddress(hInpOutDll, "IsInpOutDriverOpen");
gfpIsXP64Bit = (lpIsXP64Bit)GetProcAddress(hInpOutDll, "IsXP64Bit"); if (gfpIsInpOutDriverOpen())
{
//Make some noise through the PC Speaker - hey it can do more that a single beep using InpOut32
// 制造一些不同频率的噪声
Beep();
Sleep();
Beep();
Sleep();
Beep();
Sleep();
StopBeep(); if(!strcmp(argv[],"read"))
{
// 字符串转数字,并读取相关地址上的数据
short iPort = atoi(argv[]);
WORD wData = gfpInp32(iPort); //Read the port
printf("Data read from address %s is %d \n\n\n\n", argv[], wData);
}
else if(!strcmp(argv[],"write"))
{
if(argc<)
{
printf("Error in arguments supplied");
printf("\n***** Usage *****\n\nInpoutTest read <ADDRESS> \nor \nInpoutTest write <ADDRESS> <DATA>\n\n\n\n\n");
}
else
{
// 字符串转数字,并写入数据到相关地址上
short iPort = atoi(argv[]);
WORD wData = atoi(argv[]);
gfpOut32(iPort, wData);
printf("data written to %s\n\n\n", argv[]);
}
}
}
else
{
printf("Unable to open InpOut32 Driver!\n");
} //All done
FreeLibrary ( hInpOutDll ) ;
return ;
}
else
{
printf("Unable to load InpOut32 DLL!\n");
return -;
}
}
return -;
}
InpOut32 InputTest.cpp hacking的更多相关文章
- InpOut32 CSharpExample.cs hacking
/************************************************************************************ * InpOut32 CSh ...
- Qt 控制watchdog app hacking
/************************************************************************** * Qt 控制watchdog app hack ...
- Qt 获取usb设备信息 hacking
/************************************************************************** * Qt 获取usb设备信息 hacking * ...
- eclipse mingw cpp开发环境
Eclipse开发c++ 对比:微软的VC++6.0:太老了,对win7兼容不好, 现在微软的Visual Studio:安装包太大,好几个G,装了一堆你不需要的东西,要钱,教 育版申请麻烦 DOS下 ...
- OK335xS Qt network hacking
/********************************************************************** * OK335xS Qt network hacking ...
- Android Mokoid Open Source Project hacking
/***************************************************************************** * Android Mokoid Open ...
- Qt Quick Hello World hacking
/********************************************************************************************* * Qt ...
- Qt QML referenceexamples attached Demo hacking
/********************************************************************************************* * Qt ...
- 使用“Cocos引擎”创建的cpp工程如何在VS中调试Cocos2d-x源码
前段时间Cocos2d-x更新了一个Cocos引擎,这是一个集合源码,IDE,Studio这一家老小的整合包,我们可以使用这个Cocos引擎来创建我们的项目. 在Cocos2d-x被整合到Cocos引 ...
随机推荐
- Python3.x:获取登录界面校验码图片
Python3.x:获取登录界面校验码图片 实例代码: # python3 # author lizm # datetime 2018-06-01 18:00:00 # -*- coding: utf ...
- BeatSaber节奏光剑插件开发官方教程1-创建一个插件模板
原文:https://wiki.assistant.moe/modding/intro 一.简介 Beat Saber 开发环境:unity2018.C#..NET framework 4.6. 此教 ...
- JVM调优总结(二)
Java对象的大小 基本数据的类型的大小是固定的,这里就不多说了.对于非基本类型的Java对象,其大小就值得商榷. 在Java中,一个空Object对象的大小是8byte,这个大小只是保存堆中一个没有 ...
- Windows 10 调节缩略图背景透明度
A goal is a dream with a deadline. Much effort, much prosperity. 用Windows 10 的朋友都知道 win10 确实挺好用,但是做的 ...
- 编程练习赛11B 物品价值(装压dp)
题意:每个物品有m(m<=10)种属性和一个价格,你有n种物品从中任意选择一些物品,让每种属性恰好有奇数个物品拥有,输出满足条件的最大价值和 题解:一看就是明显的01背包问题,但是价格乘以个数的 ...
- Python学习(二)——深度学习入门介绍
课程二:深度学习入门 讲师:David (数据分析工程师) 这门课主要介绍了很多神经网络的基本原理,非常非常基础的了解. 零.思维导图预览: 一.深度神经网络 1.神经元 ...
- scala学习手记40 - case表达式里的模式变量和常量
再来看一下之前的一段代码: def process(input: Any) { input match { case (a: Int, b: Int) => println("Proc ...
- Android Studio混淆打包
1.apk混淆打包 如果要对apk进行混淆,你要先告知gradle这个app需要混淆,并告知其混淆规则. 告知gradle需要混淆的代码 在Project/app/build.gradle中把mini ...
- js进阶---12-11、jquery如何给动态创建出来的元素绑定事件
js进阶---12-11.jquery如何给动态创建出来的元素绑定事件 一.总结 一句话总结:通过事件委托的方式,通过on方法 1.on方法在事件绑定的时候,data方式带额外参数时,字符串参数和其它 ...
- HTTP和HTTPS的区别和联系
超文本传输协议HTTP协议被用于在Web浏览器和网站服务器之间传递信息,HTTP协议以明文方式发送内容,不提供任何方式的数据加密,如果攻击者截取了Web浏览器和网站服务器之间的传输报文,就可以直接读懂 ...