Repository: starofrainnight/winio
Branch: master
Commit: b095609124b4
Files: 47
Total size: 120.9 KB
Directory structure:
gitextract_uomszmgh/
├── .gitignore
├── LICENSE
├── README.md
├── Samples/
│ ├── DumpPhys/
│ │ ├── DumpPhys/
│ │ │ ├── DumpPhys.csproj
│ │ │ ├── DumpPhys.manifest
│ │ │ ├── Form1.Designer.cs
│ │ │ ├── Form1.cs
│ │ │ ├── Form1.resx
│ │ │ ├── Program.cs
│ │ │ └── Properties/
│ │ │ ├── AssemblyInfo.cs
│ │ │ ├── Resources.Designer.cs
│ │ │ ├── Resources.resx
│ │ │ ├── Settings.Designer.cs
│ │ │ └── Settings.settings
│ │ ├── DumpPhys.sln
│ │ └── DumpPhys.suo
│ └── DumpPort/
│ ├── DumpPort/
│ │ ├── DumpPort.csproj
│ │ ├── DumpPort.manifest
│ │ ├── Form1.Designer.cs
│ │ ├── Form1.cs
│ │ ├── Form1.resx
│ │ ├── Program.cs
│ │ └── Properties/
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── DumpPort.sln
│ └── DumpPort.suo
└── Source/
├── Dll/
│ ├── InstDrv.cpp
│ ├── Phys32.cpp
│ ├── Phys32.h
│ ├── Port32.cpp
│ ├── Port32.h
│ ├── WinIo.aps
│ ├── WinIo.cpp
│ ├── WinIo.def
│ ├── WinIo.rc
│ ├── WinIo.sln
│ ├── WinIo.suo
│ ├── WinIo.vcproj
│ ├── resource.h
│ └── winio.h
└── Drv/
├── MAKEFILE
├── SOURCES
├── WinIo.c
└── winio_nt.h
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# Ignore vscode files
.vscode
================================================
FILE: LICENSE
================================================
END USER LICENSE AGREEMENT
Software License Agreement for WinIo
The following terms apply to all files associated with the software unless
explicitly disclaimed in individual files.
IMPORTANT- PLEASE READ CAREFULLY: BY INSTALLING THE SOFTWARE (AS DEFINED BELOW),
OR COPYING THE SOFTWARE, YOU (EITHER ON BEHALF OF YOURSELF AS AN INDIVIDUAL OR
ON BEHALF OF AN ENTITY AS ITS AUTHORIZED REPRESENTATIVE) AGREE TO ALL OF THE
TERMS OF THIS END USER LICENSE AGREEMENT ("AGREEMENT") REGARDING YOUR USE OF
THE SOFTWARE. IF YOU DO NOT AGREE WITH ALL OF THE TERMS OF THIS AGREEMENT, DO
NOT INSTALL, COPY OR OTHERWISE USE THE SOFTWARE.
1. GRANT OF LICENSE: Subject to the terms below, Yariv Kaplan ("AUTHOR") hereby
grants you a non-exclusive, non-transferable, non-assignable license to install
and to use the downloadable version of WinIo ("SOFTWARE").
a. Redistributable Code. You may reproduce and distribute the object code form
of the SOFTWARE solely in conjunction with, and as part of, your application
("Permitted Application"); provided that you comply with the following:
If you redistribute any portion of the Redistributable Code, you agree that:
(i) you will only distribute the Redistributable Code in conjunction with, and
as part of, your Permitted Application which adds significant functionality to
the Redistributable Code and that distribution of the Permitted Application does
not compete with the AUTHOR's distribution of the SOFTWARE;
(ii) you will include a valid copyright notice on your Permitted Application;
(iii) you will not permit further redistribution of the Redistributable Code;
(iv) you will indemnify, hold harmless, and defend the AUTHOR from and against
any claims or lawsuits, including attorneys' fees, that arise or result from
the use or distribution of your Permitted Application.
b. License to use Source Code. You may not sell, lease, rent, transfer or
sublicense the source code of this SOFTWARE.
2. MODIFICATION: SOFTWARE Source Code may be modified without the prior written
permission of the AUTHOR. Any modifications made to the SOFTWARE will continue
to be subject to the terms and conditions of this AGREEMENT.
3. COPYRIGHT: All rights, title, and copyrights in and to the SOFTWARE and any
copies of the SOFTWARE are owned by the AUTHOR. The SOFTWARE is protected by
copyright laws and international treaty provisions. Therefore, you must treat
the SOFTWARE like any other copyrighted material.
4. TITLE: You acknowledge that no title to the intellectual property in the
SOFTWARE is transferred to you. Title, ownership, rights, and intellectual
property rights in and to the SOFTWARE shall remain the exclusive property of
the AUTHOR. The SOFTWARE is protected by copyright laws of the United States
and international treaties.
5. LIMITATION OF LIABILITY: You must assume the entire risk of using the
SOFTWARE.
IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS
SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHOR
HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
AND THE AUTHOR HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
ENHANCEMENTS, OR MODIFICATIONS.
================================================
FILE: README.md
================================================
# WinIo
The WinIo library allows 32-bit and 64-bit Windows applications to directly access I/O ports and physical memory.
## Copyright
This library was written by Yariv Kaplan, which could be download from www.internals.com.
**WARNING!** This library is strictly copyrighted! All rights are claimed belongs to Yariv Kaplan (even the codes you modified). You must read the LICENESE of WinIo library carefully if you want to use this library (neither generated binaries or source code).
## Why have this repository?
Because www.internals.com is down latest, I couldn't download it, so fork this useful library for backup purpose.
The tag 2.0 is the version that supported win9X.
Lastest viewable content from www.internals.com could be access from [archive.org](http://web.archive.org/web/20160410042019/http://www.internals.com/) .
## Redistributable Files
The redistributable files are provided in the \binaries directory (WinIo32.dll, WinIo32.sys and WinIo64.dll) and should be included in the installation package for your application. The WinIo64.sys file must be replaced with a version that is signed with a public code signing certificate (see below).
The WinIo files must be placed in the same directory as your application's executable file.
## Privilege Requirements
WinIo requires administrative privileges to run properly. This can be achieved by:
- Using WinIo from a service running as LocalSystem (SE_LOAD_DRIVER_NAME privilege must be explicitly enabled).
- Embedding a manifest file in the application that requests privilege elevation.
- Requiring the user to choose the "Run as Administrator" option when launching the application.
The included C# samples demonstrate using an embedded manifest file to request privilege elevation.
## Driver Signing Requirements on 64-bit Systems
64-bit versions of Windows only load device drivers that are signed by a code signing certificate issued by a public CA such as Verisign, Thawte, etc. WinIo64.sys must not be deployed on production machines unless a code signing certificate is obtained and used to sign this file. The bundled copy of WinIo64.sys is signed with a self-signed certificate and can only be used on development/test machines with Windows running in a special "test" mode. In order to use the bundled version of WinIo64.sys, you need to take the following steps:
- Open an elevated command window by right-clicking the icon and clicking "Run as Administrator".
- Type the following command to enable test-signing:
bcdedit.exe /set TESTSIGNING ON
- Reboot the machine
For more information on Windows driver signing requirements, please refer to http://www.microsoft.com/whdc/winlogo/drvsign/kmcs_walkthrough.mspx.
## More Help
If you want any further advance help information, just read the WinIo.chm which
bundled with released WinIo.zip .
================================================
FILE: Samples/DumpPhys/DumpPhys/DumpPhys.csproj
================================================
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1103585F-D85D-4599-8858-C0D3E9D7419F}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DumpPhys</RootNamespace>
<AssemblyName>DumpPhys</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<ApplicationManifest>DumpPhys.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<SubType>Designer</SubType>
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="DumpPhys.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
================================================
FILE: Samples/DumpPhys/DumpPhys/DumpPhys.manifest
================================================
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
================================================
FILE: Samples/DumpPhys/DumpPhys/Form1.Designer.cs
================================================
namespace DumpPhys
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.btnGetValue = new System.Windows.Forms.Button();
this.btnSetValue = new System.Windows.Forms.Button();
this.btnQuit = new System.Windows.Forms.Button();
this.txtPhysAddr = new System.Windows.Forms.TextBox();
this.txtValue = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(30, 138);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(176, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Please enter physical address (hex):";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(30, 167);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(63, 13);
this.label2.TabIndex = 1;
this.label2.Text = "Value (hex):";
//
// btnGetValue
//
this.btnGetValue.Location = new System.Drawing.Point(32, 231);
this.btnGetValue.Name = "btnGetValue";
this.btnGetValue.Size = new System.Drawing.Size(75, 23);
this.btnGetValue.TabIndex = 2;
this.btnGetValue.Text = "Get Value";
this.btnGetValue.UseVisualStyleBackColor = true;
this.btnGetValue.Click += new System.EventHandler(this.btnGetValue_Click);
//
// btnSetValue
//
this.btnSetValue.Location = new System.Drawing.Point(138, 231);
this.btnSetValue.Name = "btnSetValue";
this.btnSetValue.Size = new System.Drawing.Size(75, 23);
this.btnSetValue.TabIndex = 3;
this.btnSetValue.Text = "Set Value";
this.btnSetValue.UseVisualStyleBackColor = true;
this.btnSetValue.Click += new System.EventHandler(this.btnSetValue_Click);
//
// btnQuit
//
this.btnQuit.Location = new System.Drawing.Point(244, 231);
this.btnQuit.Name = "btnQuit";
this.btnQuit.Size = new System.Drawing.Size(75, 23);
this.btnQuit.TabIndex = 4;
this.btnQuit.Text = "Quit";
this.btnQuit.UseVisualStyleBackColor = true;
this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click);
//
// txtPhysAddr
//
this.txtPhysAddr.Location = new System.Drawing.Point(212, 135);
this.txtPhysAddr.Name = "txtPhysAddr";
this.txtPhysAddr.Size = new System.Drawing.Size(108, 20);
this.txtPhysAddr.TabIndex = 5;
//
// txtValue
//
this.txtValue.Location = new System.Drawing.Point(99, 164);
this.txtValue.MaxLength = 8;
this.txtValue.Name = "txtValue";
this.txtValue.Size = new System.Drawing.Size(59, 20);
this.txtValue.TabIndex = 6;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(81, 22);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(188, 39);
this.label3.TabIndex = 7;
this.label3.Text = "DumpPhys";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(63, 73);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(225, 16);
this.label4.TabIndex = 8;
this.label4.Text = "Copyright 1998-2010 by Yariv Kaplan";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(117, 102);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(117, 16);
this.label5.TabIndex = 9;
this.label5.Text = "www.internals.com";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(350, 272);
this.ControlBox = false;
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.txtValue);
this.Controls.Add(this.txtPhysAddr);
this.Controls.Add(this.btnQuit);
this.Controls.Add(this.btnSetValue);
this.Controls.Add(this.btnGetValue);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "Form1";
this.Text = "DumpPhys - www.internals.com";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnGetValue;
private System.Windows.Forms.Button btnSetValue;
private System.Windows.Forms.Button btnQuit;
private System.Windows.Forms.TextBox txtPhysAddr;
private System.Windows.Forms.TextBox txtValue;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
}
}
================================================
FILE: Samples/DumpPhys/DumpPhys/Form1.cs
================================================
// ---------------------------------------------------- //
// WinIo v3.0 //
// Direct Hardware Access Under Windows //
// Copyright 1998-2010 Yariv Kaplan //
// http://www.internals.com //
// ---------------------------------------------------- //
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace DumpPhys
{
public unsafe partial class Form1 : Form
{
[DllImport("kernel32.dll")]
private extern static IntPtr LoadLibrary(String DllName);
[DllImport("kernel32.dll")]
private extern static IntPtr GetProcAddress(IntPtr hModule, String ProcName);
[DllImport("kernel32")]
private extern static bool FreeLibrary(IntPtr hModule);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate bool InitializeWinIoType();
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate bool GetPhysLongType(IntPtr PhysAddr, UInt32 *pPhysVal);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate bool SetPhysLongType(IntPtr PhysAddr, UInt32 PhysVal);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate bool ShutdownWinIoType();
IntPtr hMod;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// Check if this is a 32 bit or 64 bit system
if (IntPtr.Size == 4)
{
hMod = LoadLibrary("WinIo32.dll");
txtPhysAddr.MaxLength = 8;
txtPhysAddr.Text = "00000000";
}
else if (IntPtr.Size == 8)
{
hMod = LoadLibrary("WinIo64.dll");
txtPhysAddr.MaxLength = 16;
txtPhysAddr.Text = "0000000000000000";
}
if (hMod == IntPtr.Zero)
{
MessageBox.Show("Can't find WinIo dll.\nMake sure the WinIo library files are located in the same directory as your executable file.", "DumpPhys", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.Close();
}
IntPtr pFunc = GetProcAddress(hMod, "InitializeWinIo");
if (pFunc != IntPtr.Zero)
{
InitializeWinIoType InitializeWinIo = (InitializeWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(InitializeWinIoType));
bool Result = InitializeWinIo();
if (!Result)
{
MessageBox.Show("Error returned from InitializeWinIo.\nMake sure you are running with administrative privileges and that the WinIo library files are located in the same directory as your executable file.", "DumpPhys", MessageBoxButtons.OK, MessageBoxIcon.Error);
FreeLibrary(hMod);
this.Close();
}
}
btnGetValue_Click(this, null);
}
private void btnGetValue_Click(object sender, EventArgs e)
{
IntPtr pFunc = GetProcAddress(hMod, "GetPhysLong");
if (pFunc != IntPtr.Zero)
{
UInt32 PhysVal;
UInt64 PhysAddr64;
PhysAddr64 = UInt64.Parse(txtPhysAddr.Text, System.Globalization.NumberStyles.HexNumber);
GetPhysLongType GetPhysLong = (GetPhysLongType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(GetPhysLongType));
// Call WinIo to get value
bool Result = GetPhysLong((IntPtr)PhysAddr64, &PhysVal);
if (Result)
{
txtValue.Text = PhysVal.ToString("X");
}
else
{
MessageBox.Show("Error returned from GetPhysLong", "DumpPhys", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void btnQuit_Click(object sender, EventArgs e)
{
IntPtr pFunc = GetProcAddress(hMod, "ShutdownWinIo");
if (pFunc != IntPtr.Zero)
{
ShutdownWinIoType ShutdownWinIo = (ShutdownWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(ShutdownWinIoType));
ShutdownWinIo();
FreeLibrary(hMod);
}
this.Close();
}
private void btnSetValue_Click(object sender, EventArgs e)
{
IntPtr pFunc = GetProcAddress(hMod, "SetPhysLong");
if (pFunc != IntPtr.Zero)
{
UInt32 PhysVal;
UInt64 PhysAddr64;
PhysAddr64 = UInt64.Parse(txtPhysAddr.Text, System.Globalization.NumberStyles.HexNumber);
PhysVal = UInt32.Parse(txtValue.Text, System.Globalization.NumberStyles.HexNumber);
SetPhysLongType SetPhysLong = (SetPhysLongType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(SetPhysLongType));
// Call WinIo to set value
bool Result = SetPhysLong((IntPtr)PhysAddr64, PhysVal);
if (!Result)
{
MessageBox.Show("Error returned from SetPhysLong", "DumpPhys", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
}
================================================
FILE: Samples/DumpPhys/DumpPhys/Form1.resx
================================================
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
================================================
FILE: Samples/DumpPhys/DumpPhys/Program.cs
================================================
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace DumpPhys
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
================================================
FILE: Samples/DumpPhys/DumpPhys/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DumpPhys")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("www.internals.com")]
[assembly: AssemblyProduct("DumpPhys")]
[assembly: AssemblyCopyright("Copyright © Yariv Kaplan 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("16fd1afb-d769-4e14-89ba-eef3670c272b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Samples/DumpPhys/DumpPhys/Properties/Resources.Designer.cs
================================================
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DumpPhys.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DumpPhys.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
================================================
FILE: Samples/DumpPhys/DumpPhys/Properties/Resources.resx
================================================
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
================================================
FILE: Samples/DumpPhys/DumpPhys/Properties/Settings.Designer.cs
================================================
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DumpPhys.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
================================================
FILE: Samples/DumpPhys/DumpPhys/Properties/Settings.settings
================================================
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
================================================
FILE: Samples/DumpPhys/DumpPhys.sln
================================================
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DumpPhys", "DumpPhys\DumpPhys.csproj", "{1103585F-D85D-4599-8858-C0D3E9D7419F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1103585F-D85D-4599-8858-C0D3E9D7419F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1103585F-D85D-4599-8858-C0D3E9D7419F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1103585F-D85D-4599-8858-C0D3E9D7419F}.Debug|x86.ActiveCfg = Debug|x86
{1103585F-D85D-4599-8858-C0D3E9D7419F}.Debug|x86.Build.0 = Debug|x86
{1103585F-D85D-4599-8858-C0D3E9D7419F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1103585F-D85D-4599-8858-C0D3E9D7419F}.Release|Any CPU.Build.0 = Release|Any CPU
{1103585F-D85D-4599-8858-C0D3E9D7419F}.Release|x86.ActiveCfg = Release|x86
{1103585F-D85D-4599-8858-C0D3E9D7419F}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: Samples/DumpPort/DumpPort/DumpPort.csproj
================================================
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DumpPort</RootNamespace>
<AssemblyName>DumpPort</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<ApplicationManifest>DumpPort.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<SubType>Designer</SubType>
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="DumpPort.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
================================================
FILE: Samples/DumpPort/DumpPort/DumpPort.manifest
================================================
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
================================================
FILE: Samples/DumpPort/DumpPort/Form1.Designer.cs
================================================
namespace DumpPort
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnGetValue = new System.Windows.Forms.Button();
this.btnSetValue = new System.Windows.Forms.Button();
this.btnQuit = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.txtPortAddr = new System.Windows.Forms.TextBox();
this.txtValue = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btnGetValue
//
this.btnGetValue.Location = new System.Drawing.Point(32, 220);
this.btnGetValue.Name = "btnGetValue";
this.btnGetValue.Size = new System.Drawing.Size(75, 23);
this.btnGetValue.TabIndex = 0;
this.btnGetValue.Text = "Get Value";
this.btnGetValue.UseVisualStyleBackColor = true;
this.btnGetValue.Click += new System.EventHandler(this.btnGetValue_Click);
//
// btnSetValue
//
this.btnSetValue.Location = new System.Drawing.Point(137, 220);
this.btnSetValue.Name = "btnSetValue";
this.btnSetValue.Size = new System.Drawing.Size(75, 23);
this.btnSetValue.TabIndex = 1;
this.btnSetValue.Text = "Set Value";
this.btnSetValue.UseVisualStyleBackColor = true;
this.btnSetValue.Click += new System.EventHandler(this.btnSetValue_Click);
//
// btnQuit
//
this.btnQuit.Location = new System.Drawing.Point(242, 220);
this.btnQuit.Name = "btnQuit";
this.btnQuit.Size = new System.Drawing.Size(75, 23);
this.btnQuit.TabIndex = 2;
this.btnQuit.Text = "Quit";
this.btnQuit.UseVisualStyleBackColor = true;
this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(44, 140);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(156, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Please enter port address (hex):";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(44, 170);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(63, 13);
this.label2.TabIndex = 4;
this.label2.Text = "Value (hex):";
//
// txtPortAddr
//
this.txtPortAddr.Location = new System.Drawing.Point(206, 137);
this.txtPortAddr.MaxLength = 4;
this.txtPortAddr.Name = "txtPortAddr";
this.txtPortAddr.Size = new System.Drawing.Size(36, 20);
this.txtPortAddr.TabIndex = 5;
this.txtPortAddr.Text = "0";
//
// txtValue
//
this.txtValue.Location = new System.Drawing.Point(113, 167);
this.txtValue.MaxLength = 2;
this.txtValue.Name = "txtValue";
this.txtValue.Size = new System.Drawing.Size(23, 20);
this.txtValue.TabIndex = 6;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(87, 19);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(174, 39);
this.label3.TabIndex = 7;
this.label3.Text = "DumpPort";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(62, 69);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(225, 16);
this.label4.TabIndex = 8;
this.label4.Text = "Copyright 1998-2010 by Yariv Kaplan";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(116, 97);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(117, 16);
this.label5.TabIndex = 9;
this.label5.Text = "www.internals.com";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(348, 263);
this.ControlBox = false;
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.txtValue);
this.Controls.Add(this.txtPortAddr);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnQuit);
this.Controls.Add(this.btnSetValue);
this.Controls.Add(this.btnGetValue);
this.Name = "Form1";
this.Text = "DumpPort - www.internals.com";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnGetValue;
private System.Windows.Forms.Button btnSetValue;
private System.Windows.Forms.Button btnQuit;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtPortAddr;
private System.Windows.Forms.TextBox txtValue;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
}
}
================================================
FILE: Samples/DumpPort/DumpPort/Form1.cs
================================================
// ---------------------------------------------------- //
// WinIo v3.0 //
// Direct Hardware Access Under Windows //
// Copyright 1998-2010 Yariv Kaplan //
// http://www.internals.com //
// ---------------------------------------------------- //
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace DumpPort
{
public unsafe partial class Form1 : Form
{
[DllImport("kernel32.dll")]
private extern static IntPtr LoadLibrary(String DllName);
[DllImport("kernel32.dll")]
private extern static IntPtr GetProcAddress(IntPtr hModule, String ProcName);
[DllImport("kernel32")]
private extern static bool FreeLibrary(IntPtr hModule);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate bool InitializeWinIoType();
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate bool GetPortValType(UInt16 PortAddr, UInt32* pPortVal, UInt16 Size);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate bool SetPortValType(UInt16 PortAddr, UInt32 PortVal, UInt16 Size);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate bool ShutdownWinIoType();
IntPtr hMod;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// Check if this is a 32 bit or 64 bit system
if (IntPtr.Size == 4)
{
hMod = LoadLibrary("WinIo32.dll");
}
else if (IntPtr.Size == 8)
{
hMod = LoadLibrary("WinIo64.dll");
}
if (hMod == IntPtr.Zero)
{
MessageBox.Show("Can't find WinIo dll.\nMake sure the WinIo library files are located in the same directory as your executable file.", "DumpPort", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.Close();
}
IntPtr pFunc = GetProcAddress(hMod, "InitializeWinIo");
if (pFunc != IntPtr.Zero)
{
InitializeWinIoType InitializeWinIo = (InitializeWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(InitializeWinIoType));
bool Result = InitializeWinIo();
if (!Result)
{
MessageBox.Show("Error returned from InitializeWinIo.\nMake sure you are running with administrative privileges and that the WinIo library files are located in the same directory as your executable file.", "DumpPort", MessageBoxButtons.OK, MessageBoxIcon.Error);
FreeLibrary(hMod);
this.Close();
}
}
btnGetValue_Click(this, null);
}
private void btnQuit_Click(object sender, EventArgs e)
{
IntPtr pFunc = GetProcAddress(hMod, "ShutdownWinIo");
if (pFunc != IntPtr.Zero)
{
ShutdownWinIoType ShutdownWinIo = (ShutdownWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(ShutdownWinIoType));
ShutdownWinIo();
FreeLibrary(hMod);
}
this.Close();
}
private void btnGetValue_Click(object sender, EventArgs e)
{
IntPtr pFunc = GetProcAddress(hMod, "GetPortVal");
if (pFunc != IntPtr.Zero)
{
UInt16 PortAddr;
UInt32 PortVal;
PortAddr = UInt16.Parse(txtPortAddr.Text, System.Globalization.NumberStyles.HexNumber);
GetPortValType GetPortVal = (GetPortValType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(GetPortValType));
// Call WinIo to get value
bool Result = GetPortVal(PortAddr, &PortVal, 1);
if (Result)
{
txtValue.Text = PortVal.ToString("X");
}
else
{
MessageBox.Show("Error returned from GetPortVal", "DumpPort", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void btnSetValue_Click(object sender, EventArgs e)
{
IntPtr pFunc = GetProcAddress(hMod, "SetPortVal");
if (pFunc != IntPtr.Zero)
{
UInt16 PortAddr;
UInt32 PortVal;
PortAddr = UInt16.Parse(txtPortAddr.Text, System.Globalization.NumberStyles.HexNumber);
PortVal = UInt32.Parse(txtValue.Text, System.Globalization.NumberStyles.HexNumber);
SetPortValType SetPortVal = (SetPortValType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(SetPortValType));
// Call WinIo to set value
bool Result = SetPortVal(PortAddr, PortVal, 1 );
if (!Result)
{
MessageBox.Show("Error returned from SetPortVal", "DumpPort", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
}
================================================
FILE: Samples/DumpPort/DumpPort/Form1.resx
================================================
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
================================================
FILE: Samples/DumpPort/DumpPort/Program.cs
================================================
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace DumpPort
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
================================================
FILE: Samples/DumpPort/DumpPort/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DumpPort")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("www.internals.com")]
[assembly: AssemblyProduct("DumpPort")]
[assembly: AssemblyCopyright("Copyright © Yariv Kaplan 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e4aa10c8-3c4e-4ea5-8461-4da84bf602f5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Samples/DumpPort/DumpPort/Properties/Resources.Designer.cs
================================================
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DumpPort.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DumpPort.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
================================================
FILE: Samples/DumpPort/DumpPort/Properties/Resources.resx
================================================
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
================================================
FILE: Samples/DumpPort/DumpPort/Properties/Settings.Designer.cs
================================================
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DumpPort.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
================================================
FILE: Samples/DumpPort/DumpPort/Properties/Settings.settings
================================================
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
================================================
FILE: Samples/DumpPort/DumpPort.sln
================================================
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DumpPort", "DumpPort\DumpPort.csproj", "{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Debug|x86.ActiveCfg = Debug|x86
{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Debug|x86.Build.0 = Debug|x86
{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Release|Any CPU.Build.0 = Release|Any CPU
{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Release|x86.ActiveCfg = Release|x86
{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: Source/Dll/InstDrv.cpp
================================================
// ---------------------------------------------------- //
// WinIo v3.0 //
// Direct Hardware Access Under Windows //
// Copyright 1998-2010 Yariv Kaplan //
// http://www.internals.com //
// ---------------------------------------------------- //
#include <windows.h>
#include "winio.h"
bool _stdcall InstallWinIoDriver(PWSTR pszWinIoDriverPath, bool IsDemandLoaded)
{
SC_HANDLE hSCManager;
SC_HANDLE hService;
// Remove any previous instance of the driver
RemoveWinIoDriver();
hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (hSCManager)
{
// Install the driver
hService = CreateService(hSCManager,
L"WINIO",
L"WINIO",
SERVICE_ALL_ACCESS,
SERVICE_KERNEL_DRIVER,
(IsDemandLoaded == true) ? SERVICE_DEMAND_START : SERVICE_SYSTEM_START,
SERVICE_ERROR_NORMAL,
pszWinIoDriverPath,
NULL,
NULL,
NULL,
NULL,
NULL);
CloseServiceHandle(hSCManager);
if (hService == NULL)
return false;
}
else
return false;
CloseServiceHandle(hService);
return true;
}
bool _stdcall RemoveWinIoDriver()
{
SC_HANDLE hSCManager;
SC_HANDLE hService;
LPQUERY_SERVICE_CONFIG pServiceConfig;
DWORD dwBytesNeeded;
DWORD cbBufSize;
bool bResult;
StopWinIoDriver();
hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (!hSCManager)
{
return false;
}
hService = OpenService(hSCManager, L"WINIO", SERVICE_ALL_ACCESS);
CloseServiceHandle(hSCManager);
if (!hService)
{
return false;
}
bResult = QueryServiceConfig(hService, NULL, 0, &dwBytesNeeded);
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
cbBufSize = dwBytesNeeded;
pServiceConfig = (LPQUERY_SERVICE_CONFIG)malloc(cbBufSize);
bResult = QueryServiceConfig(hService, pServiceConfig, cbBufSize, &dwBytesNeeded);
if (!bResult)
{
free(pServiceConfig);
CloseServiceHandle(hService);
return bResult;
}
// If service is set to load automatically, don't delete it!
if (pServiceConfig->dwStartType == SERVICE_DEMAND_START)
{
bResult = DeleteService(hService);
}
}
CloseServiceHandle(hService);
return bResult;
}
bool _stdcall StartWinIoDriver()
{
SC_HANDLE hSCManager;
SC_HANDLE hService;
bool bResult;
hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (hSCManager)
{
hService = OpenService(hSCManager, L"WINIO", SERVICE_ALL_ACCESS);
CloseServiceHandle(hSCManager);
if (hService)
{
bResult = StartService(hService, 0, NULL) || GetLastError() == ERROR_SERVICE_ALREADY_RUNNING;
CloseServiceHandle(hService);
}
else
return false;
}
else
return false;
return bResult;
}
bool _stdcall StopWinIoDriver()
{
SC_HANDLE hSCManager;
SC_HANDLE hService;
SERVICE_STATUS ServiceStatus;
bool bResult;
hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (hSCManager)
{
hService = OpenService(hSCManager, L"WINIO", SERVICE_ALL_ACCESS);
CloseServiceHandle(hSCManager);
if (hService)
{
bResult = ControlService(hService, SERVICE_CONTROL_STOP, &ServiceStatus);
CloseServiceHandle(hService);
}
else
return false;
}
else
return false;
return bResult;
}
================================================
FILE: Source/Dll/Phys32.cpp
================================================
// ---------------------------------------------------- //
// WinIo v3.0 //
// Direct Hardware Access Under Windows //
// Copyright 1998-2010 Yariv Kaplan //
// http://www.internals.com //
// ---------------------------------------------------- //
#include <windows.h>
#include <winioctl.h>
#include "phys32.h"
#include "..\drv\winio_nt.h"
#include "winio.h"
PBYTE _stdcall MapPhysToLin(tagPhysStruct &PhysStruct)
{
PBYTE pbLinAddr = NULL;
DWORD dwBytesReturned;
if (!IsWinIoInitialized)
return false;
if (!DeviceIoControl(hDriver, IOCTL_WINIO_MAPPHYSTOLIN, &PhysStruct,
sizeof(tagPhysStruct), &PhysStruct, sizeof(tagPhysStruct),
&dwBytesReturned, NULL))
{
return NULL;
}
return (PBYTE)PhysStruct.pvPhysMemLin;
}
bool _stdcall UnmapPhysicalMemory(tagPhysStruct &PhysStruct)
{
DWORD dwBytesReturned;
if (!IsWinIoInitialized)
{
return false;
}
if (!DeviceIoControl(hDriver, IOCTL_WINIO_UNMAPPHYSADDR, &PhysStruct,
sizeof(tagPhysStruct), NULL, 0, &dwBytesReturned, NULL))
{
return false;
}
return true;
}
// Support functions
bool _stdcall GetPhysLong(PBYTE pbPhysAddr, PDWORD pdwPhysVal)
{
PDWORD pdwLinAddr;
tagPhysStruct PhysStruct;
if (!IsWinIoInitialized)
return false;
if (g_Is64BitOS)
{
PhysStruct.pvPhysAddress = (DWORD64)pbPhysAddr;
}
else
{
// Avoid sign extension issues
PhysStruct.pvPhysAddress = (DWORD64)(DWORD32)pbPhysAddr;
}
PhysStruct.dwPhysMemSizeInBytes = 4;
pdwLinAddr = (PDWORD)MapPhysToLin(PhysStruct);
if (pdwLinAddr == NULL)
return false;
*pdwPhysVal = *pdwLinAddr;
UnmapPhysicalMemory(PhysStruct);
return true;
}
bool _stdcall SetPhysLong(PBYTE pbPhysAddr, DWORD dwPhysVal)
{
PDWORD pdwLinAddr;
tagPhysStruct PhysStruct;
if (!IsWinIoInitialized)
return false;
if (g_Is64BitOS)
{
PhysStruct.pvPhysAddress = (DWORD64)pbPhysAddr;
}
else
{
// Avoid sign extension issues
PhysStruct.pvPhysAddress = (DWORD64)(DWORD32)pbPhysAddr;
}
PhysStruct.dwPhysMemSizeInBytes = 4;
pdwLinAddr = (PDWORD)MapPhysToLin(PhysStruct);
if (pdwLinAddr == NULL)
return false;
*pdwLinAddr = dwPhysVal;
UnmapPhysicalMemory(PhysStruct);
return true;
}
================================================
FILE: Source/Dll/Phys32.h
================================================
#ifndef PHYS32_H
#define PHYS32_H
extern DWORD (WINAPI *VxDCall)(DWORD Service, DWORD EAX_Reg, DWORD ECX_Reg);
#endif
================================================
FILE: Source/Dll/Port32.cpp
================================================
// ---------------------------------------------------- //
// WinIo v3.0 //
// Direct Hardware Access Under Windows //
// Copyright 1998-2010 Yariv Kaplan //
// http://www.internals.com //
// ---------------------------------------------------- //
#include <windows.h>
#include <winioctl.h>
#include <conio.h>
#include "port32.h"
#include "..\drv\winio_nt.h"
#include "winio.h"
bool _stdcall GetPortVal(WORD wPortAddr, PDWORD pdwPortVal, BYTE bSize)
{
if (!IsWinIoInitialized)
{
return false;
}
#ifdef _WIN64
tagPortStruct PortStruct;
DWORD dwBytesReturned;
PortStruct.bSize = bSize;
PortStruct.wPortAddr = wPortAddr;
return DeviceIoControl(hDriver, IOCTL_WINIO_READPORT, &PortStruct, sizeof(PortStruct),
pdwPortVal, sizeof(DWORD), &dwBytesReturned, NULL);
#elif _WIN32
// If this is a 64 bit OS, we must use the driver to access I/O ports even if the application is 32 bit
if (g_Is64BitOS)
{
tagPortStruct PortStruct;
DWORD dwBytesReturned;
PortStruct.bSize = bSize;
PortStruct.wPortAddr = wPortAddr;
return DeviceIoControl(hDriver, IOCTL_WINIO_READPORT, &PortStruct, sizeof(PortStruct),
pdwPortVal, sizeof(DWORD), &dwBytesReturned, NULL);
}
else
{
switch (bSize)
{
case 1:
*pdwPortVal = _inp(wPortAddr);
break;
case 2:
*pdwPortVal = _inpw(wPortAddr);
break;
case 4:
*pdwPortVal = _inpd(wPortAddr);
break;
}
}
#endif
return true;
}
bool _stdcall SetPortVal(WORD wPortAddr, DWORD dwPortVal, BYTE bSize)
{
if (!IsWinIoInitialized)
{
return false;
}
#ifdef _WIN64
tagPortStruct PortStruct;
DWORD dwBytesReturned;
PortStruct.bSize = bSize;
PortStruct.dwPortVal = dwPortVal;
PortStruct.wPortAddr = wPortAddr;
return DeviceIoControl(hDriver, IOCTL_WINIO_WRITEPORT, &PortStruct, sizeof(PortStruct),
NULL, 0, &dwBytesReturned, NULL);
#elif _WIN32
// If this is a 64 bit OS, we must use the driver to access I/O ports even if the application is 32 bit
if (g_Is64BitOS)
{
tagPortStruct PortStruct;
DWORD dwBytesReturned;
PortStruct.bSize = bSize;
PortStruct.dwPortVal = dwPortVal;
PortStruct.wPortAddr = wPortAddr;
return DeviceIoControl(hDriver, IOCTL_WINIO_WRITEPORT, &PortStruct, sizeof(PortStruct),
NULL, 0, &dwBytesReturned, NULL);
}
else
{
switch (bSize)
{
case 1:
_outp(wPortAddr, dwPortVal);
break;
case 2:
_outpw(wPortAddr, (WORD)dwPortVal);
break;
case 4:
_outpd(wPortAddr, dwPortVal);
break;
}
}
#endif
return true;
}
================================================
FILE: Source/Dll/Port32.h
================================================
#ifndef PORT32_H
#define PORT32_H
#pragma pack(1)
struct GDT_DESCRIPTOR
{
WORD Limit_0_15;
WORD Base_0_15;
BYTE Base_16_23;
BYTE Type : 4;
BYTE System : 1;
BYTE DPL : 2;
BYTE Present : 1;
BYTE Limit_16_19 : 4;
BYTE Available : 1;
BYTE Reserved : 1;
BYTE D_B : 1;
BYTE Granularity : 1;
BYTE Base_24_31;
};
struct CALLGATE_DESCRIPTOR
{
WORD Offset_0_15;
WORD Selector;
WORD ParamCount : 5;
WORD Unused : 3;
WORD Type : 4;
WORD System : 1;
WORD DPL : 2;
WORD Present : 1;
WORD Offset_16_31;
};
struct GDTR
{
WORD wGDTLimit;
DWORD dwGDTBase;
};
#pragma pack()
#endif
================================================
FILE: Source/Dll/WinIo.cpp
================================================
// ---------------------------------------------------- //
// WinIo v3.0 //
// Direct Hardware Access Under Windows //
// Copyright 1998-2010 Yariv Kaplan //
// http://www.internals.com //
// ---------------------------------------------------- //
#define _WIN32_WINNT 0x0501
#include <windows.h>
#include <winioctl.h>
#include "phys32.h"
#include "..\drv\winio_nt.h"
#include "winio.h"
HANDLE hDriver = INVALID_HANDLE_VALUE;
bool IsWinIoInitialized = false;
wchar_t szWinIoDriverPath[32768];
bool g_Is64BitOS;
typedef UINT (WINAPI* GETSYSTEMWOW64DIRECTORY)(LPTSTR, UINT);
BOOL Is64BitOS()
{
#ifdef _WIN64
return TRUE;
#else
GETSYSTEMWOW64DIRECTORY getSystemWow64Directory;
HMODULE hKernel32;
TCHAR Wow64Directory[32767];
hKernel32 = GetModuleHandle(TEXT("kernel32.dll"));
if (hKernel32 == NULL)
{
//
// This shouldn't happen, but if we can't get
// kernel32's module handle then assume we are
// on x86. We won't ever install 32-bit drivers
// on 64-bit machines, we just want to catch it
// up front to give users a better error message.
//
return FALSE;
}
getSystemWow64Directory = (GETSYSTEMWOW64DIRECTORY)GetProcAddress(hKernel32, "GetSystemWow64DirectoryW");
if (getSystemWow64Directory == NULL)
{
//
// This most likely means we are running
// on Windows 2000, which didn't have this API
// and didn't have a 64-bit counterpart.
//
return FALSE;
}
if ((getSystemWow64Directory(Wow64Directory, _countof(Wow64Directory)) == 0) &&
(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)) {
return FALSE;
}
//
// GetSystemWow64Directory succeeded
// so we are on a 64-bit OS.
//
return TRUE;
#endif
}
bool GetDriverPath()
{
PWSTR pszSlash;
if (!GetModuleFileName(GetModuleHandle(NULL), szWinIoDriverPath, sizeof(szWinIoDriverPath)))
return false;
pszSlash = wcsrchr(szWinIoDriverPath, '\\');
if (pszSlash)
pszSlash[1] = 0;
else
return false;
if (g_Is64BitOS)
wcscat(szWinIoDriverPath, L"winio64.sys");
else
wcscat(szWinIoDriverPath, L"winio32.sys");
return true;
}
bool __stdcall InitializeWinIo()
{
bool bResult;
DWORD dwBytesReturned;
g_Is64BitOS = Is64BitOS();
hDriver = CreateFile(L"\\\\.\\WINIO",
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
// If the driver is not running, install it
if (hDriver == INVALID_HANDLE_VALUE)
{
GetDriverPath();
bResult = InstallWinIoDriver(szWinIoDriverPath, true);
if (!bResult)
return false;
bResult = StartWinIoDriver();
if (!bResult)
return false;
hDriver = CreateFile(L"\\\\.\\WINIO",
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (hDriver == INVALID_HANDLE_VALUE)
return false;
}
// Enable I/O port access for this process if running on a 32 bit OS
if (!g_Is64BitOS)
{
if (!DeviceIoControl(hDriver, IOCTL_WINIO_ENABLEDIRECTIO, NULL,
0, NULL, 0, &dwBytesReturned, NULL))
{
return false;
}
}
IsWinIoInitialized = true;
return true;
}
void _stdcall ShutdownWinIo()
{
DWORD dwBytesReturned;
if (hDriver != INVALID_HANDLE_VALUE)
{
// Disable I/O port access if running on a 32 bit OS
if (!g_Is64BitOS)
{
DeviceIoControl(hDriver, IOCTL_WINIO_DISABLEDIRECTIO, NULL,
0, NULL, 0, &dwBytesReturned, NULL);
}
CloseHandle(hDriver);
}
RemoveWinIoDriver();
IsWinIoInitialized = false;
}
================================================
FILE: Source/Dll/WinIo.def
================================================
EXPORTS
InitializeWinIo
ShutdownWinIo
MapPhysToLin
UnmapPhysicalMemory
GetPhysLong
SetPhysLong
GetPortVal
SetPortVal
InstallWinIoDriver
RemoveWinIoDriver
================================================
FILE: Source/Dll/WinIo.rc
================================================
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,0,0,0
PRODUCTVERSION 3,0,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x29L
#else
FILEFLAGS 0x28L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", " "
VALUE "CompanyName", "www.internals.com"
VALUE "FileDescription", "WinIo"
VALUE "FileVersion", "3.0"
VALUE "InternalName", "WinIo"
VALUE "LegalCopyright", "Copyright 1998-2010, Yariv Kaplan"
VALUE "LegalTrademarks", " "
VALUE "OriginalFilename", "WinIo.dll"
VALUE "PrivateBuild", " "
VALUE "ProductName", "WinIo"
VALUE "ProductVersion", "3.0"
VALUE "SpecialBuild", " "
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
================================================
FILE: Source/Dll/WinIo.sln
================================================
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinIo", "WinIo.vcproj", "{DE9A75D4-D640-41B8-893B-A384FAF00738}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DE9A75D4-D640-41B8-893B-A384FAF00738}.Debug|Win32.ActiveCfg = Debug|Win32
{DE9A75D4-D640-41B8-893B-A384FAF00738}.Debug|Win32.Build.0 = Debug|Win32
{DE9A75D4-D640-41B8-893B-A384FAF00738}.Debug|x64.ActiveCfg = Debug|x64
{DE9A75D4-D640-41B8-893B-A384FAF00738}.Debug|x64.Build.0 = Debug|x64
{DE9A75D4-D640-41B8-893B-A384FAF00738}.Release|Win32.ActiveCfg = Release|Win32
{DE9A75D4-D640-41B8-893B-A384FAF00738}.Release|Win32.Build.0 = Release|Win32
{DE9A75D4-D640-41B8-893B-A384FAF00738}.Release|x64.ActiveCfg = Release|x64
{DE9A75D4-D640-41B8-893B-A384FAF00738}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: Source/Dll/WinIo.vcproj
================================================
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="WinIo"
ProjectGUID="{DE9A75D4-D640-41B8-893B-A384FAF00738}"
RootNamespace="WinIo"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)x86\$(ConfigurationName)"
IntermediateDirectory="x86\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WINIO_DLL"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName)32.dll"
LinkIncremental="2"
ModuleDefinitionFile=".\WinIo.def"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WINIO_DLL"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName)64.dll"
LinkIncremental="2"
ModuleDefinitionFile=".\WinIo.def"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)x86\$(ConfigurationName)"
IntermediateDirectory="x86\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\BuildLog.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WINIO_DLL"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName)32.dll"
LinkIncremental="1"
ModuleDefinitionFile=".\WinIo.def"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WINIO_DLL"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName)64.dll"
LinkIncremental="1"
ModuleDefinitionFile=".\WinIo.def"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\InstDrv.cpp"
>
</File>
<File
RelativePath=".\Phys32.cpp"
>
</File>
<File
RelativePath=".\Port32.cpp"
>
</File>
<File
RelativePath=".\WinIo.cpp"
>
</File>
<File
RelativePath=".\WinIo.def"
>
</File>
<File
RelativePath=".\WinIo.rc"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
================================================
FILE: Source/Dll/resource.h
================================================
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by WinIo.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
================================================
FILE: Source/Dll/winio.h
================================================
#ifndef WINIO_H
#define WINIO_H
#include "..\drv\winio_nt.h"
#ifndef WINIO_DLL
#define WINIO_API _declspec(dllimport)
#else
#define WINIO_API
#endif
extern "C"
{
WINIO_API bool _stdcall InitializeWinIo();
WINIO_API void _stdcall ShutdownWinIo();
WINIO_API PBYTE _stdcall MapPhysToLin(tagPhysStruct &PhysStruct);
WINIO_API bool _stdcall UnmapPhysicalMemory(tagPhysStruct &PhysStruct);
WINIO_API bool _stdcall GetPhysLong(PBYTE pbPhysAddr, PDWORD pdwPhysVal);
WINIO_API bool _stdcall SetPhysLong(PBYTE pbPhysAddr, DWORD dwPhysVal);
WINIO_API bool _stdcall GetPortVal(WORD wPortAddr, PDWORD pdwPortVal, BYTE bSize);
WINIO_API bool _stdcall SetPortVal(WORD wPortAddr, DWORD dwPortVal, BYTE bSize);
WINIO_API bool _stdcall InstallWinIoDriver(PWSTR pszWinIoDriverPath, bool IsDemandLoaded = false);
WINIO_API bool _stdcall RemoveWinIoDriver();
}
extern HANDLE hDriver;
extern bool IsWinIoInitialized;
extern bool g_Is64BitOS;
bool _stdcall StartWinIoDriver();
bool _stdcall StopWinIoDriver();
#endif
================================================
FILE: Source/Drv/MAKEFILE
================================================
#
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
# file to this component. This file merely indirects to the real make file
# that is shared by all the driver components of the Windows NT DDK
#
!INCLUDE $(NTMAKEENV)\makefile.def
================================================
FILE: Source/Drv/SOURCES
================================================
TARGETNAME=WinIo
TARGETPATH=.
TARGETTYPE=DRIVER
NTDEBUG=ntsd
SOURCES= winio.c
================================================
FILE: Source/Drv/WinIo.c
================================================
// ---------------------------------------------------- //
// WinIo v3.0 //
// Direct Hardware Access for Windows //
// Copyright 1998-2010 Yariv Kaplan //
// http://www.internals.com //
// ---------------------------------------------------- //
#include <ntddk.h>
#include "winio_nt.h"
#define IOPM_SIZE 0x2000
typedef char IOPM[IOPM_SIZE];
// Function definition section
// -----------------------------------------------------------------
NTSTATUS WinIoDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
void WinIoUnload(IN PDRIVER_OBJECT DriverObject);
NTSTATUS UnmapPhysicalMemory(HANDLE PhysicalMemoryHandle, PVOID pPhysMemLin, PVOID PhysSection);
NTSTATUS MapPhysicalMemoryToLinearSpace(PVOID pPhysAddress,
SIZE_T PhysMemSizeInBytes,
PVOID *ppPhysMemLin,
HANDLE *pPhysicalMemoryHandle,
PVOID *ppPhysSection);
#ifndef AMD64
void Ke386SetIoAccessMap(int, IOPM *);
void Ke386QueryIoAccessMap(int, IOPM *);
void Ke386IoSetAccessProcess(PEPROCESS, int);
#endif
// -----------------------------------------------------------------
// Installable driver initialization entry point.
// This entry point is called directly by the I/O system.
NTSTATUS DriverEntry (IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath)
{
UNICODE_STRING DeviceNameUnicodeString;
UNICODE_STRING DeviceLinkUnicodeString;
NTSTATUS ntStatus;
PDEVICE_OBJECT DeviceObject = NULL;
KdPrint(("Entering DriverEntry"));
RtlInitUnicodeString (&DeviceNameUnicodeString, L"\\Device\\WinIo");
// Create a device object
ntStatus = IoCreateDevice (DriverObject,
0,
&DeviceNameUnicodeString,
FILE_DEVICE_WINIO,
0,
FALSE,
&DeviceObject);
if (NT_SUCCESS(ntStatus))
{
// Create dispatch points for device control, create, close.
DriverObject->MajorFunction[IRP_MJ_CREATE] =
DriverObject->MajorFunction[IRP_MJ_CLOSE] =
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = WinIoDispatch;
DriverObject->DriverUnload = WinIoUnload;
// Create a symbolic link, e.g. a name that a Win32 app can specify
// to open the device.
RtlInitUnicodeString (&DeviceLinkUnicodeString, L"\\DosDevices\\WinIo");
ntStatus = IoCreateSymbolicLink (&DeviceLinkUnicodeString,
&DeviceNameUnicodeString);
if (!NT_SUCCESS(ntStatus))
{
// Symbolic link creation failed- note this & then delete the
// device object (it's useless if a Win32 app can't get at it).
KdPrint(("ERROR: IoCreateSymbolicLink failed"));
IoDeleteDevice (DeviceObject);
}
}
else
{
KdPrint(("ERROR: IoCreateDevice failed"));
}
KdPrint(("Leaving DriverEntry"));
return ntStatus;
}
// Process the IRPs sent to this device
NTSTATUS WinIoDispatch(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION IrpStack;
ULONG dwInputBufferLength;
ULONG dwOutputBufferLength;
ULONG dwIoControlCode;
PVOID pvIOBuffer;
NTSTATUS ntStatus;
IOPM* pIOPM = NULL;
struct tagPhysStruct PhysStruct;
struct tagPortStruct PortStruct;
struct tagPhysStruct32 *pPhysStruct32 = NULL;
KdPrint(("Entering WinIoDispatch"));
// Init to default settings
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IrpStack = IoGetCurrentIrpStackLocation(Irp);
// Get the pointer to the input/output buffer and it's length
pvIOBuffer = Irp->AssociatedIrp.SystemBuffer;
dwInputBufferLength = IrpStack->Parameters.DeviceIoControl.InputBufferLength;
dwOutputBufferLength = IrpStack->Parameters.DeviceIoControl.OutputBufferLength;
switch (IrpStack->MajorFunction)
{
case IRP_MJ_CREATE:
KdPrint(("IRP_MJ_CREATE"));
break;
case IRP_MJ_CLOSE:
KdPrint(("IRP_MJ_CLOSE"));
break;
case IRP_MJ_DEVICE_CONTROL:
KdPrint(("IRP_MJ_DEVICE_CONTROL"));
dwIoControlCode = IrpStack->Parameters.DeviceIoControl.IoControlCode;
switch (dwIoControlCode)
{
// The Ke386 calls are no longer available on x64 Windows
#ifndef AMD64
case IOCTL_WINIO_ENABLEDIRECTIO:
KdPrint(("IOCTL_WINIO_ENABLEDIRECTIO"));
pIOPM = MmAllocateNonCachedMemory(sizeof(IOPM));
if (pIOPM)
{
RtlZeroMemory(pIOPM, sizeof(IOPM));
Ke386IoSetAccessProcess(PsGetCurrentProcess(), 1);
Ke386SetIoAccessMap(1, pIOPM);
IrpStack->FileObject->FsContext2 = pIOPM;
}
else
Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
break;
case IOCTL_WINIO_DISABLEDIRECTIO:
KdPrint(("IOCTL_WINIO_DISABLEDIRECTIO"));
pIOPM = (IOPM *)IrpStack->FileObject->FsContext2;
if (pIOPM)
{
Ke386IoSetAccessProcess(PsGetCurrentProcess(), 0);
Ke386SetIoAccessMap(1, pIOPM);
MmFreeNonCachedMemory(pIOPM, sizeof(IOPM));
}
break;
#endif
case IOCTL_WINIO_WRITEPORT:
KdPrint(("IOCTL_WINIO_WRITEPORT"));
if (dwInputBufferLength)
{
memcpy (&PortStruct, pvIOBuffer, dwInputBufferLength);
switch (PortStruct.bSize)
{
case 1:
WRITE_PORT_UCHAR((PUCHAR)(USHORT)PortStruct.wPortAddr, (UCHAR)PortStruct.dwPortVal);
break;
case 2:
WRITE_PORT_USHORT((PUSHORT)(USHORT)PortStruct.wPortAddr, (USHORT)PortStruct.dwPortVal);
break;
case 4:
WRITE_PORT_ULONG((PULONG)(USHORT)PortStruct.wPortAddr, PortStruct.dwPortVal);
break;
}
}
else
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
break;
case IOCTL_WINIO_READPORT:
KdPrint(("IOCTL_WINIO_READPORT"));
if (dwInputBufferLength)
{
memcpy (&PortStruct, pvIOBuffer, dwInputBufferLength);
switch (PortStruct.bSize)
{
case 1:
PortStruct.dwPortVal = (ULONG)READ_PORT_UCHAR((PUCHAR)(USHORT)PortStruct.wPortAddr);
break;
case 2:
PortStruct.dwPortVal = (ULONG)READ_PORT_USHORT((PUSHORT)(USHORT)PortStruct.wPortAddr);
break;
case 4:
PortStruct.dwPortVal = READ_PORT_ULONG((PULONG)(USHORT)PortStruct.wPortAddr);
break;
}
memcpy (pvIOBuffer, &PortStruct.dwPortVal, sizeof(PortStruct.dwPortVal));
Irp->IoStatus.Information = sizeof(PortStruct.dwPortVal);
}
else
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
break;
case IOCTL_WINIO_MAPPHYSTOLIN:
KdPrint(("IOCTL_WINIO_MAPPHYSTOLIN"));
if (dwInputBufferLength)
{
memcpy (&PhysStruct, pvIOBuffer, dwInputBufferLength);
ntStatus = MapPhysicalMemoryToLinearSpace((PVOID)PhysStruct.pvPhysAddress,
(SIZE_T)PhysStruct.dwPhysMemSizeInBytes,
(PVOID *)&PhysStruct.pvPhysMemLin,
(HANDLE *)&PhysStruct.PhysicalMemoryHandle,
(PVOID *)&PhysStruct.pvPhysSection);
if (NT_SUCCESS(ntStatus))
{
memcpy (pvIOBuffer, &PhysStruct, dwInputBufferLength);
Irp->IoStatus.Information = dwInputBufferLength;
}
Irp->IoStatus.Status = ntStatus;
}
else
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
break;
case IOCTL_WINIO_UNMAPPHYSADDR:
KdPrint(("IOCTL_WINIO_UNMAPPHYSADDR"));
if (dwInputBufferLength)
{
memcpy (&PhysStruct, pvIOBuffer, dwInputBufferLength);
ntStatus = UnmapPhysicalMemory((HANDLE)PhysStruct.PhysicalMemoryHandle, (PVOID)PhysStruct.pvPhysMemLin, (PVOID)PhysStruct.pvPhysSection);
Irp->IoStatus.Status = ntStatus;
}
else
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
break;
default:
KdPrint(("ERROR: Unknown IRP_MJ_DEVICE_CONTROL"));
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
break;
}
break;
}
// DON'T get cute and try to use the status field of the irp in the
// return status. That IRP IS GONE as soon as you call IoCompleteRequest.
ntStatus = Irp->IoStatus.Status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
// We never have pending operation so always return the status code.
KdPrint(("Leaving WinIoDispatch"));
return ntStatus;
}
// Delete the associated device and return
void WinIoUnload(IN PDRIVER_OBJECT DriverObject)
{
UNICODE_STRING DeviceLinkUnicodeString;
NTSTATUS ntStatus;
KdPrint(("Entering WinIoUnload"));
RtlInitUnicodeString (&DeviceLinkUnicodeString, L"\\DosDevices\\WinIo");
ntStatus = IoDeleteSymbolicLink (&DeviceLinkUnicodeString);
if (NT_SUCCESS(ntStatus))
{
IoDeleteDevice (DriverObject->DeviceObject);
}
else
{
KdPrint(("ERROR: IoDeleteSymbolicLink"));
}
KdPrint(("Leaving WinIoUnload"));
}
NTSTATUS MapPhysicalMemoryToLinearSpace(PVOID pPhysAddress,
SIZE_T PhysMemSizeInBytes,
PVOID *ppPhysMemLin,
HANDLE *pPhysicalMemoryHandle,
PVOID *ppPhysSection)
{
UNICODE_STRING PhysicalMemoryUnicodeString;
OBJECT_ATTRIBUTES ObjectAttributes;
PHYSICAL_ADDRESS ViewBase;
NTSTATUS ntStatus;
PHYSICAL_ADDRESS pStartPhysAddress;
PHYSICAL_ADDRESS pEndPhysAddress;
BOOLEAN Result1, Result2;
ULONG IsIOSpace;
unsigned char *pbPhysMemLin = NULL;
KdPrint(("Entering MapPhysicalMemoryToLinearSpace"));
RtlInitUnicodeString (&PhysicalMemoryUnicodeString, L"\\Device\\PhysicalMemory");
InitializeObjectAttributes (&ObjectAttributes,
&PhysicalMemoryUnicodeString,
OBJ_CASE_INSENSITIVE,
(HANDLE) NULL,
(PSECURITY_DESCRIPTOR) NULL);
*pPhysicalMemoryHandle = NULL;
*ppPhysSection = NULL;
ntStatus = ZwOpenSection (pPhysicalMemoryHandle, SECTION_ALL_ACCESS, &ObjectAttributes);
if (NT_SUCCESS(ntStatus))
{
ntStatus = ObReferenceObjectByHandle (*pPhysicalMemoryHandle,
SECTION_ALL_ACCESS,
(POBJECT_TYPE) NULL,
KernelMode,
ppPhysSection,
(POBJECT_HANDLE_INFORMATION) NULL);
if (NT_SUCCESS(ntStatus))
{
pStartPhysAddress.QuadPart = (ULONGLONG)(ULONG_PTR)pPhysAddress;
pEndPhysAddress.QuadPart = pStartPhysAddress.QuadPart + PhysMemSizeInBytes;
IsIOSpace = 0;
Result1 = HalTranslateBusAddress (1, 0, pStartPhysAddress, &IsIOSpace, &pStartPhysAddress);
IsIOSpace = 0;
Result2 = HalTranslateBusAddress (1, 0, pEndPhysAddress, &IsIOSpace, &pEndPhysAddress);
if (Result1 && Result2)
{
// Let ZwMapViewOfSection pick a linear address
PhysMemSizeInBytes = (SIZE_T)pEndPhysAddress.QuadPart - (SIZE_T)pStartPhysAddress.QuadPart;
ViewBase = pStartPhysAddress;
ntStatus = ZwMapViewOfSection (*pPhysicalMemoryHandle,
(HANDLE) -1,
&pbPhysMemLin,
0L,
PhysMemSizeInBytes,
&ViewBase,
&PhysMemSizeInBytes,
ViewShare,
0,
PAGE_READWRITE | PAGE_NOCACHE);
// If the physical memory is already mapped with a different caching attribute, try again
if (ntStatus == STATUS_CONFLICTING_ADDRESSES)
{
ntStatus = ZwMapViewOfSection (*pPhysicalMemoryHandle,
(HANDLE) -1,
&pbPhysMemLin,
0L,
PhysMemSizeInBytes,
&ViewBase,
&PhysMemSizeInBytes,
ViewShare,
0,
PAGE_READWRITE);
}
if (!NT_SUCCESS(ntStatus))
KdPrint(("ERROR: ZwMapViewOfSection failed"));
else
{
pbPhysMemLin += pStartPhysAddress.QuadPart - ViewBase.QuadPart;
*ppPhysMemLin = pbPhysMemLin;
}
}
else
KdPrint(("ERROR: HalTranslateBusAddress failed"));
}
else
KdPrint(("ERROR: ObReferenceObjectByHandle failed"));
}
else
KdPrint(("ERROR: ZwOpenSection failed"));
if (!NT_SUCCESS(ntStatus))
ZwClose(*pPhysicalMemoryHandle);
KdPrint(("Leaving MapPhysicalMemoryToLinearSpace"));
return ntStatus;
}
NTSTATUS UnmapPhysicalMemory(HANDLE PhysicalMemoryHandle, PVOID pPhysMemLin, PVOID pPhysSection)
{
NTSTATUS ntStatus;
KdPrint(("Entering UnmapPhysicalMemory"));
ntStatus = ZwUnmapViewOfSection((HANDLE)-1, pPhysMemLin);
if (!NT_SUCCESS(ntStatus))
KdPrint(("ERROR: UnmapViewOfSection failed"));
if (pPhysSection)
ObDereferenceObject(pPhysSection);
ZwClose(PhysicalMemoryHandle);
KdPrint(("Leaving UnmapPhysicalMemory"));
return ntStatus;
}
================================================
FILE: Source/Drv/winio_nt.h
================================================
#ifndef WINIONT_H
#define WINIONT_H
// Define the various device type values. Note that values used by Microsoft
// Corporation are in the range 0-32767, and 32768-65535 are reserved for use
// by customers.
#define FILE_DEVICE_WINIO 0x00008010
// Macro definition for defining IOCTL and FSCTL function control codes.
// Note that function codes 0-2047 are reserved for Microsoft Corporation,
// and 2048-4095 are reserved for customers.
#define WINIO_IOCTL_INDEX 0x810
// Define our own private IOCTL
#define IOCTL_WINIO_MAPPHYSTOLIN CTL_CODE(FILE_DEVICE_WINIO, \
WINIO_IOCTL_INDEX, \
METHOD_BUFFERED, \
FILE_ANY_ACCESS)
#define IOCTL_WINIO_UNMAPPHYSADDR CTL_CODE(FILE_DEVICE_WINIO, \
WINIO_IOCTL_INDEX + 1, \
METHOD_BUFFERED, \
FILE_ANY_ACCESS)
#define IOCTL_WINIO_ENABLEDIRECTIO CTL_CODE(FILE_DEVICE_WINIO, \
WINIO_IOCTL_INDEX + 2, \
METHOD_BUFFERED, \
FILE_ANY_ACCESS)
#define IOCTL_WINIO_DISABLEDIRECTIO CTL_CODE(FILE_DEVICE_WINIO, \
WINIO_IOCTL_INDEX + 3, \
METHOD_BUFFERED, \
FILE_ANY_ACCESS)
#define IOCTL_WINIO_READPORT CTL_CODE(FILE_DEVICE_WINIO, \
WINIO_IOCTL_INDEX + 4, \
METHOD_BUFFERED, \
FILE_ANY_ACCESS)
#define IOCTL_WINIO_WRITEPORT CTL_CODE(FILE_DEVICE_WINIO, \
WINIO_IOCTL_INDEX + 5, \
METHOD_BUFFERED, \
FILE_ANY_ACCESS)
#pragma pack(push)
#pragma pack(1)
struct tagPhysStruct
{
DWORD64 dwPhysMemSizeInBytes;
DWORD64 pvPhysAddress;
DWORD64 PhysicalMemoryHandle;
DWORD64 pvPhysMemLin;
DWORD64 pvPhysSection;
};
struct tagPortStruct
{
USHORT wPortAddr;
ULONG dwPortVal;
UCHAR bSize;
};
#pragma pack(pop)
#endif
gitextract_uomszmgh/
├── .gitignore
├── LICENSE
├── README.md
├── Samples/
│ ├── DumpPhys/
│ │ ├── DumpPhys/
│ │ │ ├── DumpPhys.csproj
│ │ │ ├── DumpPhys.manifest
│ │ │ ├── Form1.Designer.cs
│ │ │ ├── Form1.cs
│ │ │ ├── Form1.resx
│ │ │ ├── Program.cs
│ │ │ └── Properties/
│ │ │ ├── AssemblyInfo.cs
│ │ │ ├── Resources.Designer.cs
│ │ │ ├── Resources.resx
│ │ │ ├── Settings.Designer.cs
│ │ │ └── Settings.settings
│ │ ├── DumpPhys.sln
│ │ └── DumpPhys.suo
│ └── DumpPort/
│ ├── DumpPort/
│ │ ├── DumpPort.csproj
│ │ ├── DumpPort.manifest
│ │ ├── Form1.Designer.cs
│ │ ├── Form1.cs
│ │ ├── Form1.resx
│ │ ├── Program.cs
│ │ └── Properties/
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── DumpPort.sln
│ └── DumpPort.suo
└── Source/
├── Dll/
│ ├── InstDrv.cpp
│ ├── Phys32.cpp
│ ├── Phys32.h
│ ├── Port32.cpp
│ ├── Port32.h
│ ├── WinIo.aps
│ ├── WinIo.cpp
│ ├── WinIo.def
│ ├── WinIo.rc
│ ├── WinIo.sln
│ ├── WinIo.suo
│ ├── WinIo.vcproj
│ ├── resource.h
│ └── winio.h
└── Drv/
├── MAKEFILE
├── SOURCES
├── WinIo.c
└── winio_nt.h
SYMBOL INDEX (58 symbols across 17 files)
FILE: Samples/DumpPhys/DumpPhys/Form1.Designer.cs
class Form1 (line 3) | partial class Form1
method Dispose (line 14) | protected override void Dispose(bool disposing)
method InitializeComponent (line 29) | private void InitializeComponent()
FILE: Samples/DumpPhys/DumpPhys/Form1.cs
class Form1 (line 20) | public unsafe partial class Form1 : Form
method LoadLibrary (line 22) | [DllImport("kernel32.dll")]
method GetProcAddress (line 25) | [DllImport("kernel32.dll")]
method FreeLibrary (line 28) | [DllImport("kernel32")]
method Form1 (line 45) | public Form1()
method Form1_Load (line 50) | private void Form1_Load(object sender, EventArgs e)
method btnGetValue_Click (line 91) | private void btnGetValue_Click(object sender, EventArgs e)
method btnQuit_Click (line 118) | private void btnQuit_Click(object sender, EventArgs e)
method btnSetValue_Click (line 133) | private void btnSetValue_Click(object sender, EventArgs e)
FILE: Samples/DumpPhys/DumpPhys/Program.cs
class Program (line 7) | static class Program
method Main (line 12) | [STAThread]
FILE: Samples/DumpPhys/DumpPhys/Properties/Resources.Designer.cs
class Resources (line 22) | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resource...
method Resources (line 31) | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Mic...
FILE: Samples/DumpPhys/DumpPhys/Properties/Settings.Designer.cs
class Settings (line 14) | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
FILE: Samples/DumpPort/DumpPort/Form1.Designer.cs
class Form1 (line 3) | partial class Form1
method Dispose (line 14) | protected override void Dispose(bool disposing)
method InitializeComponent (line 29) | private void InitializeComponent()
FILE: Samples/DumpPort/DumpPort/Form1.cs
class Form1 (line 21) | public unsafe partial class Form1 : Form
method LoadLibrary (line 23) | [DllImport("kernel32.dll")]
method GetProcAddress (line 26) | [DllImport("kernel32.dll")]
method FreeLibrary (line 29) | [DllImport("kernel32")]
method Form1 (line 46) | public Form1()
method Form1_Load (line 51) | private void Form1_Load(object sender, EventArgs e)
method btnQuit_Click (line 88) | private void btnQuit_Click(object sender, EventArgs e)
method btnGetValue_Click (line 103) | private void btnGetValue_Click(object sender, EventArgs e)
method btnSetValue_Click (line 130) | private void btnSetValue_Click(object sender, EventArgs e)
FILE: Samples/DumpPort/DumpPort/Program.cs
class Program (line 7) | static class Program
method Main (line 12) | [STAThread]
FILE: Samples/DumpPort/DumpPort/Properties/Resources.Designer.cs
class Resources (line 22) | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resource...
method Resources (line 31) | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Mic...
FILE: Samples/DumpPort/DumpPort/Properties/Settings.Designer.cs
class Settings (line 14) | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
FILE: Source/Dll/InstDrv.cpp
function InstallWinIoDriver (line 11) | bool _stdcall InstallWinIoDriver(PWSTR pszWinIoDriverPath, bool IsDemand...
function RemoveWinIoDriver (line 54) | bool _stdcall RemoveWinIoDriver()
function StartWinIoDriver (line 108) | bool _stdcall StartWinIoDriver()
function StopWinIoDriver (line 138) | bool _stdcall StopWinIoDriver()
FILE: Source/Dll/Phys32.cpp
function PBYTE (line 15) | PBYTE _stdcall MapPhysToLin(tagPhysStruct &PhysStruct)
function UnmapPhysicalMemory (line 34) | bool _stdcall UnmapPhysicalMemory(tagPhysStruct &PhysStruct)
function GetPhysLong (line 54) | bool _stdcall GetPhysLong(PBYTE pbPhysAddr, PDWORD pdwPhysVal)
function SetPhysLong (line 87) | bool _stdcall SetPhysLong(PBYTE pbPhysAddr, DWORD dwPhysVal)
FILE: Source/Dll/Port32.cpp
function GetPortVal (line 16) | bool _stdcall GetPortVal(WORD wPortAddr, PDWORD pdwPortVal, BYTE bSize)
function SetPortVal (line 76) | bool _stdcall SetPortVal(WORD wPortAddr, DWORD dwPortVal, BYTE bSize)
FILE: Source/Dll/Port32.h
type GDT_DESCRIPTOR (line 6) | struct GDT_DESCRIPTOR
type CALLGATE_DESCRIPTOR (line 23) | struct CALLGATE_DESCRIPTOR
type GDTR (line 36) | struct GDTR
FILE: Source/Dll/WinIo.cpp
function BOOL (line 24) | BOOL Is64BitOS()
function GetDriverPath (line 72) | bool GetDriverPath()
function InitializeWinIo (line 95) | bool __stdcall InitializeWinIo()
function ShutdownWinIo (line 155) | void _stdcall ShutdownWinIo()
FILE: Source/Drv/WinIo.c
function NTSTATUS (line 36) | NTSTATUS DriverEntry (IN PDRIVER_OBJECT DriverObject,
function NTSTATUS (line 99) | NTSTATUS WinIoDispatch(IN PDEVICE_OBJECT DeviceObject,
function WinIoUnload (line 319) | void WinIoUnload(IN PDRIVER_OBJECT DriverObject)
function NTSTATUS (line 343) | NTSTATUS MapPhysicalMemoryToLinearSpace(PVOID pPhysAddress,
function NTSTATUS (line 459) | NTSTATUS UnmapPhysicalMemory(HANDLE PhysicalMemoryHandle, PVOID pPhysMem...
FILE: Source/Drv/winio_nt.h
type tagPhysStruct (line 51) | struct tagPhysStruct
type tagPortStruct (line 60) | struct tagPortStruct
Condensed preview — 47 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (138K chars).
[
{
"path": ".gitignore",
"chars": 300,
"preview": "# Prerequisites\n*.d\n\n# Compiled Object files\n*.slo\n*.lo\n*.o\n*.obj\n\n# Precompiled Headers\n*.gch\n*.pch\n\n# Compiled Dynamic"
},
{
"path": "LICENSE",
"chars": 3482,
"preview": "END USER LICENSE AGREEMENT\n\nSoftware License Agreement for WinIo\nThe following terms apply to all files associated with "
},
{
"path": "README.md",
"chars": 2842,
"preview": "# WinIo\n\nThe WinIo library allows 32-bit and 64-bit Windows applications to directly access I/O ports and physical memor"
},
{
"path": "Samples/DumpPhys/DumpPhys/DumpPhys.csproj",
"chars": 5877,
"preview": "<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"3.5\">\r\n <Pro"
},
{
"path": "Samples/DumpPhys/DumpPhys/DumpPhys.manifest",
"chars": 389,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "Samples/DumpPhys/DumpPhys/Form1.Designer.cs",
"chars": 7705,
"preview": "namespace DumpPhys\r\n{\r\n partial class Form1\r\n {\r\n /// <summary>\r\n /// Required designer variable.\r\n "
},
{
"path": "Samples/DumpPhys/DumpPhys/Form1.cs",
"chars": 5801,
"preview": "// ---------------------------------------------------- //\r\n// WinIo v3.0 //\r\n"
},
{
"path": "Samples/DumpPhys/DumpPhys/Form1.resx",
"chars": 5814,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<root>\r\n <!-- \r\n Microsoft ResX Schema \r\n \r\n Version 2.0\r\n \r\n Th"
},
{
"path": "Samples/DumpPhys/DumpPhys/Program.cs",
"chars": 475,
"preview": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Windows.Forms;\r\n\r\nnamespace DumpPhys\r\n{\r\n static class"
},
{
"path": "Samples/DumpPhys/DumpPhys/Properties/AssemblyInfo.cs",
"chars": 1290,
"preview": "using System.Reflection;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\n\r\n// General I"
},
{
"path": "Samples/DumpPhys/DumpPhys/Properties/Resources.Designer.cs",
"chars": 2841,
"preview": "//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n// This code"
},
{
"path": "Samples/DumpPhys/DumpPhys/Properties/Resources.resx",
"chars": 5610,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<root>\r\n <!-- \r\n Microsoft ResX Schema \r\n \r\n Version 2.0\r\n \r\n T"
},
{
"path": "Samples/DumpPhys/DumpPhys/Properties/Settings.Designer.cs",
"chars": 1087,
"preview": "//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n// This code"
},
{
"path": "Samples/DumpPhys/DumpPhys/Properties/Settings.settings",
"chars": 247,
"preview": "<?xml version='1.0' encoding='utf-8'?>\r\n<SettingsFile xmlns=\"http://schemas.microsoft.com/VisualStudio/2004/01/settings"
},
{
"path": "Samples/DumpPhys/DumpPhys.sln",
"chars": 1266,
"preview": "\r\nMicrosoft Visual Studio Solution File, Format Version 10.00\r\n# Visual Studio 2008\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-"
},
{
"path": "Samples/DumpPort/DumpPort/DumpPort.csproj",
"chars": 5877,
"preview": "<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"3.5\">\r\n <Pro"
},
{
"path": "Samples/DumpPort/DumpPort/DumpPort.manifest",
"chars": 389,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "Samples/DumpPort/DumpPort/Form1.Designer.cs",
"chars": 7787,
"preview": "namespace DumpPort\r\n{\r\n partial class Form1\r\n {\r\n /// <summary>\r\n /// Required designer variable.\r\n "
},
{
"path": "Samples/DumpPort/DumpPort/Form1.cs",
"chars": 5581,
"preview": "// ---------------------------------------------------- //\r\n// WinIo v3.0 //\r\n"
},
{
"path": "Samples/DumpPort/DumpPort/Form1.resx",
"chars": 5814,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<root>\r\n <!-- \r\n Microsoft ResX Schema \r\n \r\n Version 2.0\r\n \r\n Th"
},
{
"path": "Samples/DumpPort/DumpPort/Program.cs",
"chars": 475,
"preview": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Windows.Forms;\r\n\r\nnamespace DumpPort\r\n{\r\n static class"
},
{
"path": "Samples/DumpPort/DumpPort/Properties/AssemblyInfo.cs",
"chars": 1290,
"preview": "using System.Reflection;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\n\r\n// General I"
},
{
"path": "Samples/DumpPort/DumpPort/Properties/Resources.Designer.cs",
"chars": 2841,
"preview": "//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n// This code"
},
{
"path": "Samples/DumpPort/DumpPort/Properties/Resources.resx",
"chars": 5610,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<root>\r\n <!-- \r\n Microsoft ResX Schema \r\n \r\n Version 2.0\r\n \r\n T"
},
{
"path": "Samples/DumpPort/DumpPort/Properties/Settings.Designer.cs",
"chars": 1087,
"preview": "//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n// This code"
},
{
"path": "Samples/DumpPort/DumpPort/Properties/Settings.settings",
"chars": 247,
"preview": "<?xml version='1.0' encoding='utf-8'?>\r\n<SettingsFile xmlns=\"http://schemas.microsoft.com/VisualStudio/2004/01/settings"
},
{
"path": "Samples/DumpPort/DumpPort.sln",
"chars": 1266,
"preview": "\r\nMicrosoft Visual Studio Solution File, Format Version 10.00\r\n# Visual Studio 2008\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-"
},
{
"path": "Source/Dll/InstDrv.cpp",
"chars": 3387,
"preview": "// ---------------------------------------------------- //\r\n// WinIo v3.0 //\r\n"
},
{
"path": "Source/Dll/Phys32.cpp",
"chars": 2364,
"preview": "// ---------------------------------------------------- //\r\n// WinIo v3.0 //\r\n"
},
{
"path": "Source/Dll/Phys32.h",
"chars": 124,
"preview": "#ifndef PHYS32_H\r\n#define PHYS32_H\r\n\r\nextern DWORD (WINAPI *VxDCall)(DWORD Service, DWORD EAX_Reg, DWORD ECX_Reg);\r\n\r\n#e"
},
{
"path": "Source/Dll/Port32.cpp",
"chars": 2711,
"preview": "// ---------------------------------------------------- //\r\n// WinIo v3.0 //\r\n"
},
{
"path": "Source/Dll/Port32.h",
"chars": 741,
"preview": "#ifndef PORT32_H\r\n#define PORT32_H\r\n\r\n#pragma pack(1)\r\n\r\nstruct GDT_DESCRIPTOR\r\n{\r\n WORD Limit_0_15;\r\n WORD Base_0_15;"
},
{
"path": "Source/Dll/WinIo.cpp",
"chars": 3714,
"preview": "// ---------------------------------------------------- //\r\n// WinIo v3.0 //\r\n"
},
{
"path": "Source/Dll/WinIo.def",
"chars": 165,
"preview": "EXPORTS\r\nInitializeWinIo\r\nShutdownWinIo\r\nMapPhysToLin\r\nUnmapPhysicalMemory\r\nGetPhysLong\r\nSetPhysLong\r\nGetPortVal\r\nSetPor"
},
{
"path": "Source/Dll/WinIo.rc",
"chars": 2470,
"preview": "// Microsoft Visual C++ generated resource script.\r\n//\r\n#include \"resource.h\"\r\n\r\n#define APSTUDIO_READONLY_SYMBOLS\r\n////"
},
{
"path": "Source/Dll/WinIo.sln",
"chars": 1227,
"preview": "\r\nMicrosoft Visual Studio Solution File, Format Version 10.00\r\n# Visual Studio 2008\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-"
},
{
"path": "Source/Dll/WinIo.vcproj",
"chars": 7880,
"preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\r\n<VisualStudioProject\r\n\tProjectType=\"Visual C++\"\r\n\tVersion=\"9.00\"\r\n\tName=\""
},
{
"path": "Source/Dll/resource.h",
"chars": 409,
"preview": "//{{NO_DEPENDENCIES}}\r\n// Microsoft Developer Studio generated include file.\r\n// Used by WinIo.rc\r\n//\r\n\r\n// Next default"
},
{
"path": "Source/Dll/winio.h",
"chars": 1054,
"preview": "#ifndef WINIO_H\r\n#define WINIO_H\r\n\r\n#include \"..\\drv\\winio_nt.h\"\r\n\r\n#ifndef WINIO_DLL\r\n#define WINIO_API _declspec(dllim"
},
{
"path": "Source/Drv/MAKEFILE",
"chars": 267,
"preview": "#\r\n# DO NOT EDIT THIS FILE!!! Edit .\\sources. if you want to add a new source\r\n# file to this component. This file mer"
},
{
"path": "Source/Drv/SOURCES",
"chars": 85,
"preview": "TARGETNAME=WinIo\r\nTARGETPATH=.\r\nTARGETTYPE=DRIVER\r\nNTDEBUG=ntsd\r\n\r\nSOURCES= winio.c\r\n"
},
{
"path": "Source/Drv/WinIo.c",
"chars": 12239,
"preview": "// ---------------------------------------------------- //\r\n// WinIo v3.0 //\r\n"
},
{
"path": "Source/Drv/winio_nt.h",
"chars": 1721,
"preview": "#ifndef WINIONT_H\r\n#define WINIONT_H\r\n\r\n// Define the various device type values. Note that values used by Microsoft\r\n/"
}
]
// ... and 4 more files (download for full content)
About this extraction
This page contains the full source code of the starofrainnight/winio GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 47 files (120.9 KB), approximately 31.6k tokens, and a symbol index with 58 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.