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引 ...
随机推荐
- c# Datagridview 设置单位格为编辑状态(in editing mode)
private void dataGridView1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Tab && ...
- CSS 控制元素 上下左右居中
不说废话,直接 搞起..... 首先,我们将题目 <css控制元素上下左右居中> 分析一下哈,我是将其分成了4部分信息: 1.CSS控制: 只用 CSS 来达成目的 2.元素: 不只是d ...
- Python面试题之容器(Collections)
容器(Collections) Python附带一个模块,它包含许多容器数据类型,名字叫作collections.我们将讨论它的作用和用法. 我们将讨论的是: defaultdict coun ...
- wyx20162314实验报告二
北京电子科技学院BESTI实验报告 课程:程序设计与数据结构 班级: 1623 姓名: 王译潇 学号:20162310 指导教师:娄佳鹏老师.王志强老师 实验日期:2017年3月26号 实验密级: 非 ...
- iOS设计模式探索
常用的 23 种设计模式 不管是 .NET 中的 C# 语言,还是 Java.VB.NET.C++ 或 Objective-C 语言,面向对象语言在设计模式的层面上都是相通的,只不过在设计模式的具体实 ...
- React Native混合开发中必须要学会点FlexBox布局
在前面的案例中,界面的搭建都是采用CSS的布局,基于盒子模型,依赖 display属性 , position属性, float属性.但对于那些特殊布局非常不方便,比如,垂直居中. 一种全新的针对web ...
- 非法字符: '\ufeff' 解决方案|错误: 需要class, interface或enum
解决方案,把文件用Editplus打开,UTF-8+BOM编码的文件转为普通的UTF-8文件
- Linux系统下强大的lsof命令使用宝典
lsof命令简介: lsof(list open files)是一个列出当前系统打开文件的工具.在linux环境下,任何事物都以文件的形式存在,通过文件不仅仅可以访问常规数据,还可以访问网络连接和硬件 ...
- Win10易升是什么?如何彻底关闭Windows10易升?
很多朋友反馈在使用电脑的时候,突然弹出一个微软Windows10易升的界面,那么Win10易升是什么,怎么样才可以彻底关闭Win10易升呢? win10易升是什么 1.易升是微软官方发布的升级助理或者 ...
- AngularJS的思考
AngularJS实践 什么是AngularJS AngularJS的核心理念是什么? 在我看来,Angualr的核心思想是:Template + Scope => HTML, Template ...