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

  1. InpOut32 CSharpExample.cs hacking

    /************************************************************************************ * InpOut32 CSh ...

  2. Qt 控制watchdog app hacking

    /************************************************************************** * Qt 控制watchdog app hack ...

  3. Qt 获取usb设备信息 hacking

    /************************************************************************** * Qt 获取usb设备信息 hacking * ...

  4. eclipse mingw cpp开发环境

    Eclipse开发c++ 对比:微软的VC++6.0:太老了,对win7兼容不好, 现在微软的Visual Studio:安装包太大,好几个G,装了一堆你不需要的东西,要钱,教 育版申请麻烦 DOS下 ...

  5. OK335xS Qt network hacking

    /********************************************************************** * OK335xS Qt network hacking ...

  6. Android Mokoid Open Source Project hacking

    /***************************************************************************** * Android Mokoid Open ...

  7. Qt Quick Hello World hacking

    /********************************************************************************************* * Qt ...

  8. Qt QML referenceexamples attached Demo hacking

    /********************************************************************************************* * Qt ...

  9. 使用“Cocos引擎”创建的cpp工程如何在VS中调试Cocos2d-x源码

    前段时间Cocos2d-x更新了一个Cocos引擎,这是一个集合源码,IDE,Studio这一家老小的整合包,我们可以使用这个Cocos引擎来创建我们的项目. 在Cocos2d-x被整合到Cocos引 ...

随机推荐

  1. kubernetes1.9 手动安装

    一.创建TLS证书和秘钥: 1.安装 CFSSL: wget https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 chmod +x cfssl_linux-amd ...

  2. ThinkPHP框架基础知识二

    一.空操作和空控制器处理 空操作:没有指定的操作方法:空控制器:没有指定控制器,例如: http://网址/index.php/Home/Main/login  正常 http://网址/index. ...

  3. $python虚拟化运行环境——virtualenv

    介绍 virtualenv是一种虚拟化环境,可以理解为创建了一个虚拟化的pyhon运行空间,可以从新安装各种库,而与本机环境互不影响,互相隔离. 安装及使用 首先要安装包管理工具pip(pip的使用详 ...

  4. 官方online ddl

    一.5.6版本online DDL 操作 In Place Rebuilds Table Concurrent DML Only Modifies Metadata 说明 add/create sec ...

  5. 【Flask】Flask常用信号

    使用信号分为3步,第一是定义一个信号,第二是监听一个信号,第三是发送一个信号. 1. 定义信号:定义信号需要使用到blinker这个包的Namespace类来创建一个命名空间.比如定义一个在访问了某个 ...

  6. 20145120黄玄曦《网络对抗》Web基础

    20145120黄玄曦<网络对抗>Web基础 回答问题 (1)什么是表单 表单在网页中主要负责数据采集功能.一个表单有三个基本组成部分: 表单标签:这里面包含了处理表单数据所用CGI程序的 ...

  7. Java_Chapter6_类与对象

    6.1 类与对象的概念 6.2 定义类 class Cylinder { double radius; int height; double pi; void setCylinder(double r ...

  8. Python学习之:pycharm配置

    最近需要做一些小工具,听说Python不错,就学习一下.工欲善其事必先利其器,一个好的IDE对于学习一门新知识是很有帮助的,边写代码边换IDE,纠结了几天,最终还是选择了pycharm,之前觉得不够好 ...

  9. SQLite教程

    SQLite教程 http://www.runoob.com/sqlite/sqlite-date-time.html SQLite管理工具http://www.sqliteexpert.com/do ...

  10. 使用buildroot创建自己的交叉编译工具链【转】

    本文转载自:https://blog.csdn.net/linczone/article/details/45894181 使用buildroot创建自己的交叉编译工具链 关键字:buildroot ...