[
  {
    "path": ".gitignore",
    "content": "# 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 libraries\n*.so\n*.dylib\n*.dll\n\n# Fortran module files\n*.mod\n*.smod\n\n# Compiled Static libraries\n*.lai\n*.la\n*.a\n*.lib\n\n# Executables\n*.exe\n*.out\n*.app\n\n# Ignore vscode files\n.vscode"
  },
  {
    "path": "LICENSE",
    "content": "END USER LICENSE AGREEMENT\n\nSoftware License Agreement for WinIo\nThe following terms apply to all files associated with the software unless\nexplicitly disclaimed in individual files.\n\nIMPORTANT- PLEASE READ CAREFULLY: BY INSTALLING THE SOFTWARE (AS DEFINED BELOW),\nOR COPYING THE SOFTWARE, YOU (EITHER ON BEHALF OF YOURSELF AS AN INDIVIDUAL OR\nON BEHALF OF AN ENTITY AS ITS AUTHORIZED REPRESENTATIVE) AGREE TO ALL OF THE\nTERMS OF THIS END USER LICENSE AGREEMENT (\"AGREEMENT\") REGARDING YOUR USE OF\nTHE SOFTWARE. IF YOU DO NOT AGREE WITH ALL OF THE TERMS OF THIS AGREEMENT, DO\nNOT INSTALL, COPY OR OTHERWISE USE THE SOFTWARE.\n\n1. GRANT OF LICENSE: Subject to the terms below, Yariv Kaplan (\"AUTHOR\") hereby\ngrants you a non-exclusive, non-transferable, non-assignable license to install\nand to use the downloadable version of WinIo (\"SOFTWARE\").\n\na. Redistributable Code. You may reproduce and distribute the object code form\nof the SOFTWARE solely in conjunction with, and as part of, your application\n(\"Permitted Application\"); provided that you comply with the following:\n\nIf you redistribute any portion of the Redistributable Code, you agree that:\n\n(i) you will only distribute the Redistributable Code in conjunction with, and\nas part of, your Permitted Application which adds significant functionality to\nthe Redistributable Code and that distribution of the Permitted Application does\nnot compete with the AUTHOR's distribution of the SOFTWARE;\n\n(ii) you will include a valid copyright notice on your Permitted Application;\n\n(iii) you will not permit further redistribution of the Redistributable Code;\n\n(iv) you will indemnify, hold harmless, and defend the AUTHOR from and against\nany claims or lawsuits, including attorneys' fees, that arise or result from\nthe use or distribution of your Permitted Application.\n\nb. License to use Source Code. You may not sell, lease, rent, transfer or\nsublicense the source code of this SOFTWARE.\n\n2. MODIFICATION: SOFTWARE Source Code may be modified without the prior written\npermission of the AUTHOR. Any modifications made to the SOFTWARE will continue\nto be subject to the terms and conditions of this AGREEMENT.\n\n3. COPYRIGHT: All rights, title, and copyrights in and to the SOFTWARE and any\ncopies of the SOFTWARE are owned by the AUTHOR. The SOFTWARE is protected by\ncopyright laws and international treaty provisions. Therefore, you must treat\nthe SOFTWARE like any other copyrighted material.\n\n4. TITLE: You acknowledge that no title to the intellectual property in the\nSOFTWARE is transferred to you. Title, ownership, rights, and intellectual\nproperty rights in and to the SOFTWARE shall remain the exclusive property of\nthe AUTHOR. The SOFTWARE is protected by copyright laws of the United States\nand international treaties.\n\n5. LIMITATION OF LIABILITY: You must assume the entire risk of using the\nSOFTWARE.\n\nIN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,\nSPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS\nSOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHOR\nHAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nTHE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED\nTO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR\nPURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN \"AS IS\" BASIS,\nAND THE AUTHOR HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,\nENHANCEMENTS, OR MODIFICATIONS.\n"
  },
  {
    "path": "README.md",
    "content": "# WinIo\n\nThe WinIo library allows 32-bit and 64-bit Windows applications to directly access I/O ports and physical memory.\n\n## Copyright\n\nThis library was written by Yariv Kaplan, which could be download from www.internals.com.\n\n**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).\n\n## Why have this repository?\n\nBecause www.internals.com is down latest, I couldn't download it, so fork this useful library for backup purpose.\n\nThe tag 2.0 is the version that supported win9X.\n\nLastest viewable content from www.internals.com could be access from [archive.org](http://web.archive.org/web/20160410042019/http://www.internals.com/) .\n\n## Redistributable Files\n\nThe 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).\n\nThe WinIo files must be placed in the same directory as your application's executable file.\n\n## Privilege Requirements\n\nWinIo requires administrative privileges to run properly. This can be achieved by:\n\n- Using WinIo from a service running as LocalSystem (SE_LOAD_DRIVER_NAME privilege must be explicitly enabled).\n- Embedding a manifest file in the application that requests privilege elevation.\n- Requiring the user to choose the \"Run as Administrator\" option when launching the application.\n\nThe included C# samples demonstrate using an embedded manifest file to request privilege elevation.\n\n## Driver Signing Requirements on 64-bit Systems\n\n64-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:\n\n- Open an elevated command window by right-clicking the icon and clicking \"Run as Administrator\".\n- Type the following command to enable test-signing:\n\n  bcdedit.exe /set TESTSIGNING ON\n\n- Reboot the machine\n\nFor more information on Windows driver signing requirements, please refer to http://www.microsoft.com/whdc/winlogo/drvsign/kmcs_walkthrough.mspx.\n\n## More Help\n\nIf you want any further advance help information, just read the WinIo.chm which\nbundled with released WinIo.zip .\n"
  },
  {
    "path": "Samples/DumpPhys/DumpPhys/DumpPhys.csproj",
    "content": "﻿<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"3.5\">\r\n  <PropertyGroup>\r\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\r\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\r\n    <ProductVersion>9.0.21022</ProductVersion>\r\n    <SchemaVersion>2.0</SchemaVersion>\r\n    <ProjectGuid>{1103585F-D85D-4599-8858-C0D3E9D7419F}</ProjectGuid>\r\n    <OutputType>WinExe</OutputType>\r\n    <AppDesignerFolder>Properties</AppDesignerFolder>\r\n    <RootNamespace>DumpPhys</RootNamespace>\r\n    <AssemblyName>DumpPhys</AssemblyName>\r\n    <FileUpgradeFlags>\r\n    </FileUpgradeFlags>\r\n    <OldToolsVersion>2.0</OldToolsVersion>\r\n    <UpgradeBackupLocation>\r\n    </UpgradeBackupLocation>\r\n    <PublishUrl>publish\\</PublishUrl>\r\n    <Install>true</Install>\r\n    <InstallFrom>Disk</InstallFrom>\r\n    <UpdateEnabled>false</UpdateEnabled>\r\n    <UpdateMode>Foreground</UpdateMode>\r\n    <UpdateInterval>7</UpdateInterval>\r\n    <UpdateIntervalUnits>Days</UpdateIntervalUnits>\r\n    <UpdatePeriodically>false</UpdatePeriodically>\r\n    <UpdateRequired>false</UpdateRequired>\r\n    <MapFileExtensions>true</MapFileExtensions>\r\n    <ApplicationRevision>0</ApplicationRevision>\r\n    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>\r\n    <IsWebBootstrapper>false</IsWebBootstrapper>\r\n    <UseApplicationTrust>false</UseApplicationTrust>\r\n    <BootstrapperEnabled>true</BootstrapperEnabled>\r\n    <ApplicationManifest>DumpPhys.manifest</ApplicationManifest>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\r\n    <DebugSymbols>true</DebugSymbols>\r\n    <DebugType>full</DebugType>\r\n    <Optimize>false</Optimize>\r\n    <OutputPath>bin\\Debug\\</OutputPath>\r\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\r\n    <DebugType>pdbonly</DebugType>\r\n    <Optimize>true</Optimize>\r\n    <OutputPath>bin\\Release\\</OutputPath>\r\n    <DefineConstants>TRACE</DefineConstants>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|x86' \">\r\n    <DebugSymbols>true</DebugSymbols>\r\n    <OutputPath>bin\\x86\\Debug\\</OutputPath>\r\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\r\n    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r\n    <DebugType>full</DebugType>\r\n    <PlatformTarget>x86</PlatformTarget>\r\n    <ErrorReport>prompt</ErrorReport>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|x86' \">\r\n    <OutputPath>bin\\x86\\Release\\</OutputPath>\r\n    <DefineConstants>TRACE</DefineConstants>\r\n    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r\n    <Optimize>true</Optimize>\r\n    <DebugType>pdbonly</DebugType>\r\n    <PlatformTarget>x86</PlatformTarget>\r\n    <ErrorReport>prompt</ErrorReport>\r\n  </PropertyGroup>\r\n  <ItemGroup>\r\n    <Reference Include=\"System\" />\r\n    <Reference Include=\"System.Data\" />\r\n    <Reference Include=\"System.Deployment\" />\r\n    <Reference Include=\"System.Drawing\" />\r\n    <Reference Include=\"System.Windows.Forms\" />\r\n    <Reference Include=\"System.Xml\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Compile Include=\"Form1.cs\">\r\n      <SubType>Form</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Form1.Designer.cs\">\r\n      <DependentUpon>Form1.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Program.cs\" />\r\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\r\n    <EmbeddedResource Include=\"Form1.resx\">\r\n      <SubType>Designer</SubType>\r\n      <DependentUpon>Form1.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Properties\\Resources.resx\">\r\n      <Generator>ResXFileCodeGenerator</Generator>\r\n      <LastGenOutput>Resources.Designer.cs</LastGenOutput>\r\n      <SubType>Designer</SubType>\r\n    </EmbeddedResource>\r\n    <Compile Include=\"Properties\\Resources.Designer.cs\">\r\n      <AutoGen>True</AutoGen>\r\n      <DependentUpon>Resources.resx</DependentUpon>\r\n      <DesignTime>True</DesignTime>\r\n    </Compile>\r\n    <None Include=\"DumpPhys.manifest\" />\r\n    <None Include=\"Properties\\Settings.settings\">\r\n      <Generator>SettingsSingleFileGenerator</Generator>\r\n      <LastGenOutput>Settings.Designer.cs</LastGenOutput>\r\n    </None>\r\n    <Compile Include=\"Properties\\Settings.Designer.cs\">\r\n      <AutoGen>True</AutoGen>\r\n      <DependentUpon>Settings.settings</DependentUpon>\r\n      <DesignTimeSharedInput>True</DesignTimeSharedInput>\r\n    </Compile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <BootstrapperPackage Include=\"Microsoft.Net.Framework.2.0\">\r\n      <Visible>False</Visible>\r\n      <ProductName>.NET Framework 2.0 %28x86%29</ProductName>\r\n      <Install>true</Install>\r\n    </BootstrapperPackage>\r\n    <BootstrapperPackage Include=\"Microsoft.Net.Framework.3.0\">\r\n      <Visible>False</Visible>\r\n      <ProductName>.NET Framework 3.0 %28x86%29</ProductName>\r\n      <Install>false</Install>\r\n    </BootstrapperPackage>\r\n    <BootstrapperPackage Include=\"Microsoft.Net.Framework.3.5\">\r\n      <Visible>False</Visible>\r\n      <ProductName>.NET Framework 3.5</ProductName>\r\n      <Install>false</Install>\r\n    </BootstrapperPackage>\r\n  </ItemGroup>\r\n  <Import Project=\"$(MSBuildBinPath)\\Microsoft.CSharp.targets\" />\r\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r\n       Other similar extension points exist, see Microsoft.Common.targets.\r\n  <Target Name=\"BeforeBuild\">\r\n  </Target>\r\n  <Target Name=\"AfterBuild\">\r\n  </Target>\r\n  -->\r\n  <PropertyGroup>\r\n    <PostBuildEvent>\r\n    </PostBuildEvent>\r\n  </PropertyGroup>\r\n</Project>"
  },
  {
    "path": "Samples/DumpPhys/DumpPhys/DumpPhys.manifest",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\r\n  <trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\">\r\n    <security>\r\n      <requestedPrivileges>\r\n        <requestedExecutionLevel level=\"requireAdministrator\" uiAccess=\"false\"/>\r\n      </requestedPrivileges>\r\n    </security>\r\n  </trustInfo>\r\n</assembly>"
  },
  {
    "path": "Samples/DumpPhys/DumpPhys/Form1.Designer.cs",
    "content": "namespace DumpPhys\r\n{\r\n    partial class Form1\r\n    {\r\n        /// <summary>\r\n        /// Required designer variable.\r\n        /// </summary>\r\n        private System.ComponentModel.IContainer components = null;\r\n\r\n        /// <summary>\r\n        /// Clean up any resources being used.\r\n        /// </summary>\r\n        /// <param name=\"disposing\">true if managed resources should be disposed; otherwise, false.</param>\r\n        protected override void Dispose(bool disposing)\r\n        {\r\n            if (disposing && (components != null))\r\n            {\r\n                components.Dispose();\r\n            }\r\n            base.Dispose(disposing);\r\n        }\r\n\r\n        #region Windows Form Designer generated code\r\n\r\n        /// <summary>\r\n        /// Required method for Designer support - do not modify\r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        private void InitializeComponent()\r\n        {\r\n            this.label1 = new System.Windows.Forms.Label();\r\n            this.label2 = new System.Windows.Forms.Label();\r\n            this.btnGetValue = new System.Windows.Forms.Button();\r\n            this.btnSetValue = new System.Windows.Forms.Button();\r\n            this.btnQuit = new System.Windows.Forms.Button();\r\n            this.txtPhysAddr = new System.Windows.Forms.TextBox();\r\n            this.txtValue = new System.Windows.Forms.TextBox();\r\n            this.label3 = new System.Windows.Forms.Label();\r\n            this.label4 = new System.Windows.Forms.Label();\r\n            this.label5 = new System.Windows.Forms.Label();\r\n            this.SuspendLayout();\r\n            // \r\n            // label1\r\n            // \r\n            this.label1.AutoSize = true;\r\n            this.label1.Location = new System.Drawing.Point(30, 138);\r\n            this.label1.Name = \"label1\";\r\n            this.label1.Size = new System.Drawing.Size(176, 13);\r\n            this.label1.TabIndex = 0;\r\n            this.label1.Text = \"Please enter physical address (hex):\";\r\n            // \r\n            // label2\r\n            // \r\n            this.label2.AutoSize = true;\r\n            this.label2.Location = new System.Drawing.Point(30, 167);\r\n            this.label2.Name = \"label2\";\r\n            this.label2.Size = new System.Drawing.Size(63, 13);\r\n            this.label2.TabIndex = 1;\r\n            this.label2.Text = \"Value (hex):\";\r\n            // \r\n            // btnGetValue\r\n            // \r\n            this.btnGetValue.Location = new System.Drawing.Point(32, 231);\r\n            this.btnGetValue.Name = \"btnGetValue\";\r\n            this.btnGetValue.Size = new System.Drawing.Size(75, 23);\r\n            this.btnGetValue.TabIndex = 2;\r\n            this.btnGetValue.Text = \"Get Value\";\r\n            this.btnGetValue.UseVisualStyleBackColor = true;\r\n            this.btnGetValue.Click += new System.EventHandler(this.btnGetValue_Click);\r\n            // \r\n            // btnSetValue\r\n            // \r\n            this.btnSetValue.Location = new System.Drawing.Point(138, 231);\r\n            this.btnSetValue.Name = \"btnSetValue\";\r\n            this.btnSetValue.Size = new System.Drawing.Size(75, 23);\r\n            this.btnSetValue.TabIndex = 3;\r\n            this.btnSetValue.Text = \"Set Value\";\r\n            this.btnSetValue.UseVisualStyleBackColor = true;\r\n            this.btnSetValue.Click += new System.EventHandler(this.btnSetValue_Click);\r\n            // \r\n            // btnQuit\r\n            // \r\n            this.btnQuit.Location = new System.Drawing.Point(244, 231);\r\n            this.btnQuit.Name = \"btnQuit\";\r\n            this.btnQuit.Size = new System.Drawing.Size(75, 23);\r\n            this.btnQuit.TabIndex = 4;\r\n            this.btnQuit.Text = \"Quit\";\r\n            this.btnQuit.UseVisualStyleBackColor = true;\r\n            this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click);\r\n            // \r\n            // txtPhysAddr\r\n            // \r\n            this.txtPhysAddr.Location = new System.Drawing.Point(212, 135);\r\n            this.txtPhysAddr.Name = \"txtPhysAddr\";\r\n            this.txtPhysAddr.Size = new System.Drawing.Size(108, 20);\r\n            this.txtPhysAddr.TabIndex = 5;\r\n            // \r\n            // txtValue\r\n            // \r\n            this.txtValue.Location = new System.Drawing.Point(99, 164);\r\n            this.txtValue.MaxLength = 8;\r\n            this.txtValue.Name = \"txtValue\";\r\n            this.txtValue.Size = new System.Drawing.Size(59, 20);\r\n            this.txtValue.TabIndex = 6;\r\n            // \r\n            // label3\r\n            // \r\n            this.label3.AutoSize = true;\r\n            this.label3.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r\n            this.label3.Location = new System.Drawing.Point(81, 22);\r\n            this.label3.Name = \"label3\";\r\n            this.label3.Size = new System.Drawing.Size(188, 39);\r\n            this.label3.TabIndex = 7;\r\n            this.label3.Text = \"DumpPhys\";\r\n            // \r\n            // label4\r\n            // \r\n            this.label4.AutoSize = true;\r\n            this.label4.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r\n            this.label4.Location = new System.Drawing.Point(63, 73);\r\n            this.label4.Name = \"label4\";\r\n            this.label4.Size = new System.Drawing.Size(225, 16);\r\n            this.label4.TabIndex = 8;\r\n            this.label4.Text = \"Copyright 1998-2010 by Yariv Kaplan\";\r\n            // \r\n            // label5\r\n            // \r\n            this.label5.AutoSize = true;\r\n            this.label5.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r\n            this.label5.Location = new System.Drawing.Point(117, 102);\r\n            this.label5.Name = \"label5\";\r\n            this.label5.Size = new System.Drawing.Size(117, 16);\r\n            this.label5.TabIndex = 9;\r\n            this.label5.Text = \"www.internals.com\";\r\n            // \r\n            // Form1\r\n            // \r\n            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r\n            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r\n            this.ClientSize = new System.Drawing.Size(350, 272);\r\n            this.ControlBox = false;\r\n            this.Controls.Add(this.label5);\r\n            this.Controls.Add(this.label4);\r\n            this.Controls.Add(this.label3);\r\n            this.Controls.Add(this.txtValue);\r\n            this.Controls.Add(this.txtPhysAddr);\r\n            this.Controls.Add(this.btnQuit);\r\n            this.Controls.Add(this.btnSetValue);\r\n            this.Controls.Add(this.btnGetValue);\r\n            this.Controls.Add(this.label2);\r\n            this.Controls.Add(this.label1);\r\n            this.Name = \"Form1\";\r\n            this.Text = \"DumpPhys - www.internals.com\";\r\n            this.Load += new System.EventHandler(this.Form1_Load);\r\n            this.ResumeLayout(false);\r\n            this.PerformLayout();\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private System.Windows.Forms.Label label1;\r\n        private System.Windows.Forms.Label label2;\r\n        private System.Windows.Forms.Button btnGetValue;\r\n        private System.Windows.Forms.Button btnSetValue;\r\n        private System.Windows.Forms.Button btnQuit;\r\n        private System.Windows.Forms.TextBox txtPhysAddr;\r\n        private System.Windows.Forms.TextBox txtValue;\r\n        private System.Windows.Forms.Label label3;\r\n        private System.Windows.Forms.Label label4;\r\n        private System.Windows.Forms.Label label5;\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Samples/DumpPhys/DumpPhys/Form1.cs",
    "content": "// ---------------------------------------------------- //\r\n//                      WinIo v3.0                      //\r\n//          Direct Hardware Access Under Windows        //\r\n//           Copyright 1998-2010 Yariv Kaplan           //\r\n//               http://www.internals.com               //\r\n// ---------------------------------------------------- //\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Data;\r\nusing System.Drawing;\r\nusing System.Text;\r\nusing System.Windows.Forms;\r\nusing System.Runtime.InteropServices;\r\nusing System.Diagnostics;\r\n\r\nnamespace DumpPhys\r\n{\r\n    public unsafe partial class Form1 : Form\r\n    {\r\n        [DllImport(\"kernel32.dll\")]\r\n        private extern static IntPtr LoadLibrary(String DllName);\r\n\r\n        [DllImport(\"kernel32.dll\")]\r\n        private extern static IntPtr GetProcAddress(IntPtr hModule, String ProcName);\r\n\r\n        [DllImport(\"kernel32\")]\r\n        private extern static bool FreeLibrary(IntPtr hModule);\r\n\r\n        [UnmanagedFunctionPointer(CallingConvention.StdCall)]\r\n        private delegate bool InitializeWinIoType();\r\n\r\n        [UnmanagedFunctionPointer(CallingConvention.StdCall)]\r\n        private delegate bool GetPhysLongType(IntPtr PhysAddr, UInt32 *pPhysVal);\r\n\r\n        [UnmanagedFunctionPointer(CallingConvention.StdCall)]\r\n        private delegate bool SetPhysLongType(IntPtr PhysAddr, UInt32 PhysVal);\r\n\r\n        [UnmanagedFunctionPointer(CallingConvention.StdCall)]\r\n        private delegate bool ShutdownWinIoType();\r\n\r\n        IntPtr hMod;\r\n\r\n        public Form1()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void Form1_Load(object sender, EventArgs e)\r\n        {\r\n            // Check if this is a 32 bit or 64 bit system\r\n            if (IntPtr.Size == 4)\r\n            {\r\n                hMod = LoadLibrary(\"WinIo32.dll\");\r\n                txtPhysAddr.MaxLength = 8;\r\n                txtPhysAddr.Text = \"00000000\";\r\n                \r\n            }\r\n            else if (IntPtr.Size == 8)\r\n            {\r\n                hMod = LoadLibrary(\"WinIo64.dll\");\r\n                txtPhysAddr.MaxLength = 16;\r\n                txtPhysAddr.Text = \"0000000000000000\";\r\n            }\r\n\r\n            if (hMod == IntPtr.Zero)\r\n            {\r\n                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);\r\n                this.Close();\r\n            }\r\n\r\n            IntPtr pFunc = GetProcAddress(hMod, \"InitializeWinIo\");\r\n\r\n            if (pFunc != IntPtr.Zero)\r\n            {\r\n                InitializeWinIoType InitializeWinIo = (InitializeWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(InitializeWinIoType));\r\n                bool Result = InitializeWinIo();\r\n\r\n                if (!Result)\r\n                {\r\n                    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);\r\n                    FreeLibrary(hMod);\r\n                    this.Close();\r\n                }\r\n            }\r\n\r\n            btnGetValue_Click(this, null);\r\n        }\r\n\r\n        private void btnGetValue_Click(object sender, EventArgs e)\r\n        {\r\n            IntPtr pFunc = GetProcAddress(hMod, \"GetPhysLong\");\r\n\r\n            if (pFunc != IntPtr.Zero)\r\n            {\r\n                UInt32 PhysVal;\r\n                UInt64 PhysAddr64;\r\n\r\n                PhysAddr64 = UInt64.Parse(txtPhysAddr.Text, System.Globalization.NumberStyles.HexNumber);\r\n\r\n                GetPhysLongType GetPhysLong = (GetPhysLongType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(GetPhysLongType));\r\n\r\n                // Call WinIo to get value\r\n                bool Result = GetPhysLong((IntPtr)PhysAddr64, &PhysVal);\r\n\r\n                if (Result)\r\n                {\r\n                    txtValue.Text = PhysVal.ToString(\"X\");\r\n                }\r\n                else\r\n                {\r\n                    MessageBox.Show(\"Error returned from GetPhysLong\", \"DumpPhys\", MessageBoxButtons.OK, MessageBoxIcon.Error);\r\n                }\r\n            }\r\n        }\r\n\r\n        private void btnQuit_Click(object sender, EventArgs e)\r\n        {\r\n            IntPtr pFunc = GetProcAddress(hMod, \"ShutdownWinIo\");\r\n\r\n            if (pFunc != IntPtr.Zero)\r\n            {\r\n                ShutdownWinIoType ShutdownWinIo = (ShutdownWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(ShutdownWinIoType));\r\n\r\n                ShutdownWinIo();\r\n                FreeLibrary(hMod);\r\n            }\r\n            \r\n            this.Close();\r\n        }\r\n\r\n        private void btnSetValue_Click(object sender, EventArgs e)\r\n        {\r\n            IntPtr pFunc = GetProcAddress(hMod, \"SetPhysLong\");\r\n\r\n            if (pFunc != IntPtr.Zero)\r\n            {\r\n                UInt32 PhysVal;\r\n                UInt64 PhysAddr64;\r\n\r\n                PhysAddr64 = UInt64.Parse(txtPhysAddr.Text, System.Globalization.NumberStyles.HexNumber);\r\n                PhysVal = UInt32.Parse(txtValue.Text, System.Globalization.NumberStyles.HexNumber);\r\n\r\n                SetPhysLongType SetPhysLong = (SetPhysLongType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(SetPhysLongType));\r\n\r\n                // Call WinIo to set value\r\n                bool Result = SetPhysLong((IntPtr)PhysAddr64, PhysVal);\r\n\r\n                if (!Result)\r\n                {\r\n                    MessageBox.Show(\"Error returned from SetPhysLong\", \"DumpPhys\", MessageBoxButtons.OK, MessageBoxIcon.Error);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Samples/DumpPhys/DumpPhys/Form1.resx",
    "content": "<?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    The primary goals of this format is to allow a simple XML format \r\n    that is mostly human readable. The generation and parsing of the \r\n    various data types are done through the TypeConverter classes \r\n    associated with the data types.\r\n    \r\n    Example:\r\n    \r\n    ... ado.net/XML headers & schema ...\r\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\r\n    <resheader name=\"version\">2.0</resheader>\r\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\r\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\r\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\r\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\r\n    </data>\r\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\r\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\r\n        <comment>This is a comment</comment>\r\n    </data>\r\n                \r\n    There are any number of \"resheader\" rows that contain simple \r\n    name/value pairs.\r\n    \r\n    Each data row contains a name, and value. The row also contains a \r\n    type or mimetype. Type corresponds to a .NET class that support \r\n    text/value conversion through the TypeConverter architecture. \r\n    Classes that don't support this are serialized and stored with the \r\n    mimetype set.\r\n    \r\n    The mimetype is used for serialized objects, and tells the \r\n    ResXResourceReader how to depersist the object. This is currently not \r\n    extensible. For a given mimetype the value must be set accordingly:\r\n    \r\n    Note - application/x-microsoft.net.object.binary.base64 is the format \r\n    that the ResXResourceWriter will generate, however the reader can \r\n    read any of the formats listed below.\r\n    \r\n    mimetype: application/x-microsoft.net.object.binary.base64\r\n    value   : The object must be serialized with \r\n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\r\n            : and then encoded with base64 encoding.\r\n    \r\n    mimetype: application/x-microsoft.net.object.soap.base64\r\n    value   : The object must be serialized with \r\n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r\n            : and then encoded with base64 encoding.\r\n\r\n    mimetype: application/x-microsoft.net.object.bytearray.base64\r\n    value   : The object must be serialized into a byte array \r\n            : using a System.ComponentModel.TypeConverter\r\n            : and then encoded with base64 encoding.\r\n    -->\r\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\r\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\r\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\r\n      <xsd:complexType>\r\n        <xsd:choice maxOccurs=\"unbounded\">\r\n          <xsd:element name=\"metadata\">\r\n            <xsd:complexType>\r\n              <xsd:sequence>\r\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\r\n              </xsd:sequence>\r\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\r\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\r\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\r\n              <xsd:attribute ref=\"xml:space\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n          <xsd:element name=\"assembly\">\r\n            <xsd:complexType>\r\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\r\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n          <xsd:element name=\"data\">\r\n            <xsd:complexType>\r\n              <xsd:sequence>\r\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\r\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\r\n              </xsd:sequence>\r\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\r\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\r\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\r\n              <xsd:attribute ref=\"xml:space\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n          <xsd:element name=\"resheader\">\r\n            <xsd:complexType>\r\n              <xsd:sequence>\r\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\r\n              </xsd:sequence>\r\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n        </xsd:choice>\r\n      </xsd:complexType>\r\n    </xsd:element>\r\n  </xsd:schema>\r\n  <resheader name=\"resmimetype\">\r\n    <value>text/microsoft-resx</value>\r\n  </resheader>\r\n  <resheader name=\"version\">\r\n    <value>2.0</value>\r\n  </resheader>\r\n  <resheader name=\"reader\">\r\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r\n  </resheader>\r\n  <resheader name=\"writer\">\r\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r\n  </resheader>\r\n</root>"
  },
  {
    "path": "Samples/DumpPhys/DumpPhys/Program.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Windows.Forms;\r\n\r\nnamespace DumpPhys\r\n{\r\n    static class Program\r\n    {\r\n        /// <summary>\r\n        /// The main entry point for the application.\r\n        /// </summary>\r\n        [STAThread]\r\n        static void Main()\r\n        {\r\n            Application.EnableVisualStyles();\r\n            Application.SetCompatibleTextRenderingDefault(false);\r\n            Application.Run(new Form1());\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Samples/DumpPhys/DumpPhys/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\n\r\n// General Information about an assembly is controlled through the following \r\n// set of attributes. Change these attribute values to modify the information\r\n// associated with an assembly.\r\n[assembly: AssemblyTitle(\"DumpPhys\")]\r\n[assembly: AssemblyDescription(\"\")]\r\n[assembly: AssemblyConfiguration(\"\")]\r\n[assembly: AssemblyCompany(\"www.internals.com\")]\r\n[assembly: AssemblyProduct(\"DumpPhys\")]\r\n[assembly: AssemblyCopyright(\"Copyright © Yariv Kaplan 2010\")]\r\n[assembly: AssemblyTrademark(\"\")]\r\n[assembly: AssemblyCulture(\"\")]\r\n\r\n// Setting ComVisible to false makes the types in this assembly not visible \r\n// to COM components.  If you need to access a type in this assembly from \r\n// COM, set the ComVisible attribute to true on that type.\r\n[assembly: ComVisible(false)]\r\n\r\n// The following GUID is for the ID of the typelib if this project is exposed to COM\r\n[assembly: Guid(\"16fd1afb-d769-4e14-89ba-eef3670c272b\")]\r\n\r\n// Version information for an assembly consists of the following four values:\r\n//\r\n//      Major Version\r\n//      Minor Version \r\n//      Build Number\r\n//      Revision\r\n//\r\n[assembly: AssemblyVersion(\"1.0.0.0\")]\r\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\r\n"
  },
  {
    "path": "Samples/DumpPhys/DumpPhys/Properties/Resources.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.4927\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace DumpPhys.Properties {\r\n    using System;\r\n    \r\n    \r\n    /// <summary>\r\n    ///   A strongly-typed resource class, for looking up localized strings, etc.\r\n    /// </summary>\r\n    // This class was auto-generated by the StronglyTypedResourceBuilder\r\n    // class via a tool like ResGen or Visual Studio.\r\n    // To add or remove a member, edit your .ResX file then rerun ResGen\r\n    // with the /str option, or rebuild your VS project.\r\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Resources.Tools.StronglyTypedResourceBuilder\", \"2.0.0.0\")]\r\n    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\r\n    internal class Resources {\r\n        \r\n        private static global::System.Resources.ResourceManager resourceMan;\r\n        \r\n        private static global::System.Globalization.CultureInfo resourceCulture;\r\n        \r\n        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"Microsoft.Performance\", \"CA1811:AvoidUncalledPrivateCode\")]\r\n        internal Resources() {\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Returns the cached ResourceManager instance used by this class.\r\n        /// </summary>\r\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        internal static global::System.Resources.ResourceManager ResourceManager {\r\n            get {\r\n                if (object.ReferenceEquals(resourceMan, null)) {\r\n                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(\"DumpPhys.Properties.Resources\", typeof(Resources).Assembly);\r\n                    resourceMan = temp;\r\n                }\r\n                return resourceMan;\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Overrides the current thread's CurrentUICulture property for all\r\n        ///   resource lookups using this strongly typed resource class.\r\n        /// </summary>\r\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        internal static global::System.Globalization.CultureInfo Culture {\r\n            get {\r\n                return resourceCulture;\r\n            }\r\n            set {\r\n                resourceCulture = value;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Samples/DumpPhys/DumpPhys/Properties/Resources.resx",
    "content": "﻿<?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    The primary goals of this format is to allow a simple XML format \r\n    that is mostly human readable. The generation and parsing of the \r\n    various data types are done through the TypeConverter classes \r\n    associated with the data types.\r\n    \r\n    Example:\r\n    \r\n    ... ado.net/XML headers & schema ...\r\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\r\n    <resheader name=\"version\">2.0</resheader>\r\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\r\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\r\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\r\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\r\n    </data>\r\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\r\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\r\n        <comment>This is a comment</comment>\r\n    </data>\r\n                \r\n    There are any number of \"resheader\" rows that contain simple \r\n    name/value pairs.\r\n    \r\n    Each data row contains a name, and value. The row also contains a \r\n    type or mimetype. Type corresponds to a .NET class that support \r\n    text/value conversion through the TypeConverter architecture. \r\n    Classes that don't support this are serialized and stored with the \r\n    mimetype set.\r\n    \r\n    The mimetype is used for serialized objects, and tells the \r\n    ResXResourceReader how to depersist the object. This is currently not \r\n    extensible. For a given mimetype the value must be set accordingly:\r\n    \r\n    Note - application/x-microsoft.net.object.binary.base64 is the format \r\n    that the ResXResourceWriter will generate, however the reader can \r\n    read any of the formats listed below.\r\n    \r\n    mimetype: application/x-microsoft.net.object.binary.base64\r\n    value   : The object must be serialized with \r\n            : System.Serialization.Formatters.Binary.BinaryFormatter\r\n            : and then encoded with base64 encoding.\r\n    \r\n    mimetype: application/x-microsoft.net.object.soap.base64\r\n    value   : The object must be serialized with \r\n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r\n            : and then encoded with base64 encoding.\r\n\r\n    mimetype: application/x-microsoft.net.object.bytearray.base64\r\n    value   : The object must be serialized into a byte array \r\n            : using a System.ComponentModel.TypeConverter\r\n            : and then encoded with base64 encoding.\r\n    -->\r\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\r\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\r\n      <xsd:complexType>\r\n        <xsd:choice maxOccurs=\"unbounded\">\r\n          <xsd:element name=\"metadata\">\r\n            <xsd:complexType>\r\n              <xsd:sequence>\r\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\r\n              </xsd:sequence>\r\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\r\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\r\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n          <xsd:element name=\"assembly\">\r\n            <xsd:complexType>\r\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\r\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n          <xsd:element name=\"data\">\r\n            <xsd:complexType>\r\n              <xsd:sequence>\r\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\r\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\r\n              </xsd:sequence>\r\n              <xsd:attribute name=\"name\" type=\"xsd:string\" msdata:Ordinal=\"1\" />\r\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\r\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n          <xsd:element name=\"resheader\">\r\n            <xsd:complexType>\r\n              <xsd:sequence>\r\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\r\n              </xsd:sequence>\r\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n        </xsd:choice>\r\n      </xsd:complexType>\r\n    </xsd:element>\r\n  </xsd:schema>\r\n  <resheader name=\"resmimetype\">\r\n    <value>text/microsoft-resx</value>\r\n  </resheader>\r\n  <resheader name=\"version\">\r\n    <value>2.0</value>\r\n  </resheader>\r\n  <resheader name=\"reader\">\r\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r\n  </resheader>\r\n  <resheader name=\"writer\">\r\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r\n  </resheader>\r\n</root>"
  },
  {
    "path": "Samples/DumpPhys/DumpPhys/Properties/Settings.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.4927\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace DumpPhys.Properties {\r\n    \r\n    \r\n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\r\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator\", \"9.0.0.0\")]\r\n    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {\r\n        \r\n        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));\r\n        \r\n        public static Settings Default {\r\n            get {\r\n                return defaultInstance;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Samples/DumpPhys/DumpPhys/Properties/Settings.settings",
    "content": "﻿<?xml version='1.0' encoding='utf-8'?>\r\n<SettingsFile xmlns=\"http://schemas.microsoft.com/VisualStudio/2004/01/settings\" CurrentProfile=\"(Default)\">\r\n  <Profiles>\r\n    <Profile Name=\"(Default)\" />\r\n  </Profiles>\r\n  <Settings />\r\n</SettingsFile>\r\n"
  },
  {
    "path": "Samples/DumpPhys/DumpPhys.sln",
    "content": "﻿\r\nMicrosoft Visual Studio Solution File, Format Version 10.00\r\n# Visual Studio 2008\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"DumpPhys\", \"DumpPhys\\DumpPhys.csproj\", \"{1103585F-D85D-4599-8858-C0D3E9D7419F}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug|Any CPU = Debug|Any CPU\r\n\t\tDebug|x86 = Debug|x86\r\n\t\tRelease|Any CPU = Release|Any CPU\r\n\t\tRelease|x86 = Release|x86\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{1103585F-D85D-4599-8858-C0D3E9D7419F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{1103585F-D85D-4599-8858-C0D3E9D7419F}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{1103585F-D85D-4599-8858-C0D3E9D7419F}.Debug|x86.ActiveCfg = Debug|x86\r\n\t\t{1103585F-D85D-4599-8858-C0D3E9D7419F}.Debug|x86.Build.0 = Debug|x86\r\n\t\t{1103585F-D85D-4599-8858-C0D3E9D7419F}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{1103585F-D85D-4599-8858-C0D3E9D7419F}.Release|Any CPU.Build.0 = Release|Any CPU\r\n\t\t{1103585F-D85D-4599-8858-C0D3E9D7419F}.Release|x86.ActiveCfg = Release|x86\r\n\t\t{1103585F-D85D-4599-8858-C0D3E9D7419F}.Release|x86.Build.0 = Release|x86\r\n\tEndGlobalSection\r\n\tGlobalSection(SolutionProperties) = preSolution\r\n\t\tHideSolutionNode = FALSE\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "Samples/DumpPort/DumpPort/DumpPort.csproj",
    "content": "﻿<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"3.5\">\r\n  <PropertyGroup>\r\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\r\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\r\n    <ProductVersion>9.0.21022</ProductVersion>\r\n    <SchemaVersion>2.0</SchemaVersion>\r\n    <ProjectGuid>{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}</ProjectGuid>\r\n    <OutputType>WinExe</OutputType>\r\n    <AppDesignerFolder>Properties</AppDesignerFolder>\r\n    <RootNamespace>DumpPort</RootNamespace>\r\n    <AssemblyName>DumpPort</AssemblyName>\r\n    <FileUpgradeFlags>\r\n    </FileUpgradeFlags>\r\n    <OldToolsVersion>2.0</OldToolsVersion>\r\n    <UpgradeBackupLocation>\r\n    </UpgradeBackupLocation>\r\n    <PublishUrl>publish\\</PublishUrl>\r\n    <Install>true</Install>\r\n    <InstallFrom>Disk</InstallFrom>\r\n    <UpdateEnabled>false</UpdateEnabled>\r\n    <UpdateMode>Foreground</UpdateMode>\r\n    <UpdateInterval>7</UpdateInterval>\r\n    <UpdateIntervalUnits>Days</UpdateIntervalUnits>\r\n    <UpdatePeriodically>false</UpdatePeriodically>\r\n    <UpdateRequired>false</UpdateRequired>\r\n    <MapFileExtensions>true</MapFileExtensions>\r\n    <ApplicationRevision>0</ApplicationRevision>\r\n    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>\r\n    <IsWebBootstrapper>false</IsWebBootstrapper>\r\n    <UseApplicationTrust>false</UseApplicationTrust>\r\n    <BootstrapperEnabled>true</BootstrapperEnabled>\r\n    <ApplicationManifest>DumpPort.manifest</ApplicationManifest>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\r\n    <DebugSymbols>true</DebugSymbols>\r\n    <DebugType>full</DebugType>\r\n    <Optimize>false</Optimize>\r\n    <OutputPath>bin\\Debug\\</OutputPath>\r\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\r\n    <DebugType>pdbonly</DebugType>\r\n    <Optimize>true</Optimize>\r\n    <OutputPath>bin\\Release\\</OutputPath>\r\n    <DefineConstants>TRACE</DefineConstants>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|x86' \">\r\n    <DebugSymbols>true</DebugSymbols>\r\n    <OutputPath>bin\\x86\\Debug\\</OutputPath>\r\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\r\n    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r\n    <DebugType>full</DebugType>\r\n    <PlatformTarget>x86</PlatformTarget>\r\n    <ErrorReport>prompt</ErrorReport>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|x86' \">\r\n    <OutputPath>bin\\x86\\Release\\</OutputPath>\r\n    <DefineConstants>TRACE</DefineConstants>\r\n    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r\n    <Optimize>true</Optimize>\r\n    <DebugType>pdbonly</DebugType>\r\n    <PlatformTarget>x86</PlatformTarget>\r\n    <ErrorReport>prompt</ErrorReport>\r\n  </PropertyGroup>\r\n  <ItemGroup>\r\n    <Reference Include=\"System\" />\r\n    <Reference Include=\"System.Data\" />\r\n    <Reference Include=\"System.Deployment\" />\r\n    <Reference Include=\"System.Drawing\" />\r\n    <Reference Include=\"System.Windows.Forms\" />\r\n    <Reference Include=\"System.Xml\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Compile Include=\"Form1.cs\">\r\n      <SubType>Form</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Form1.Designer.cs\">\r\n      <DependentUpon>Form1.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Program.cs\" />\r\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\r\n    <EmbeddedResource Include=\"Form1.resx\">\r\n      <SubType>Designer</SubType>\r\n      <DependentUpon>Form1.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Properties\\Resources.resx\">\r\n      <Generator>ResXFileCodeGenerator</Generator>\r\n      <LastGenOutput>Resources.Designer.cs</LastGenOutput>\r\n      <SubType>Designer</SubType>\r\n    </EmbeddedResource>\r\n    <Compile Include=\"Properties\\Resources.Designer.cs\">\r\n      <AutoGen>True</AutoGen>\r\n      <DependentUpon>Resources.resx</DependentUpon>\r\n      <DesignTime>True</DesignTime>\r\n    </Compile>\r\n    <None Include=\"DumpPort.manifest\" />\r\n    <None Include=\"Properties\\Settings.settings\">\r\n      <Generator>SettingsSingleFileGenerator</Generator>\r\n      <LastGenOutput>Settings.Designer.cs</LastGenOutput>\r\n    </None>\r\n    <Compile Include=\"Properties\\Settings.Designer.cs\">\r\n      <AutoGen>True</AutoGen>\r\n      <DependentUpon>Settings.settings</DependentUpon>\r\n      <DesignTimeSharedInput>True</DesignTimeSharedInput>\r\n    </Compile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <BootstrapperPackage Include=\"Microsoft.Net.Framework.2.0\">\r\n      <Visible>False</Visible>\r\n      <ProductName>.NET Framework 2.0 %28x86%29</ProductName>\r\n      <Install>true</Install>\r\n    </BootstrapperPackage>\r\n    <BootstrapperPackage Include=\"Microsoft.Net.Framework.3.0\">\r\n      <Visible>False</Visible>\r\n      <ProductName>.NET Framework 3.0 %28x86%29</ProductName>\r\n      <Install>false</Install>\r\n    </BootstrapperPackage>\r\n    <BootstrapperPackage Include=\"Microsoft.Net.Framework.3.5\">\r\n      <Visible>False</Visible>\r\n      <ProductName>.NET Framework 3.5</ProductName>\r\n      <Install>false</Install>\r\n    </BootstrapperPackage>\r\n  </ItemGroup>\r\n  <Import Project=\"$(MSBuildBinPath)\\Microsoft.CSharp.targets\" />\r\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r\n       Other similar extension points exist, see Microsoft.Common.targets.\r\n  <Target Name=\"BeforeBuild\">\r\n  </Target>\r\n  <Target Name=\"AfterBuild\">\r\n  </Target>\r\n  -->\r\n  <PropertyGroup>\r\n    <PostBuildEvent>\r\n    </PostBuildEvent>\r\n  </PropertyGroup>\r\n</Project>"
  },
  {
    "path": "Samples/DumpPort/DumpPort/DumpPort.manifest",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\r\n  <trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\">\r\n    <security>\r\n      <requestedPrivileges>\r\n        <requestedExecutionLevel level=\"requireAdministrator\" uiAccess=\"false\"/>\r\n      </requestedPrivileges>\r\n    </security>\r\n  </trustInfo>\r\n</assembly>"
  },
  {
    "path": "Samples/DumpPort/DumpPort/Form1.Designer.cs",
    "content": "namespace DumpPort\r\n{\r\n    partial class Form1\r\n    {\r\n        /// <summary>\r\n        /// Required designer variable.\r\n        /// </summary>\r\n        private System.ComponentModel.IContainer components = null;\r\n\r\n        /// <summary>\r\n        /// Clean up any resources being used.\r\n        /// </summary>\r\n        /// <param name=\"disposing\">true if managed resources should be disposed; otherwise, false.</param>\r\n        protected override void Dispose(bool disposing)\r\n        {\r\n            if (disposing && (components != null))\r\n            {\r\n                components.Dispose();\r\n            }\r\n            base.Dispose(disposing);\r\n        }\r\n\r\n        #region Windows Form Designer generated code\r\n\r\n        /// <summary>\r\n        /// Required method for Designer support - do not modify\r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        private void InitializeComponent()\r\n        {\r\n            this.btnGetValue = new System.Windows.Forms.Button();\r\n            this.btnSetValue = new System.Windows.Forms.Button();\r\n            this.btnQuit = new System.Windows.Forms.Button();\r\n            this.label1 = new System.Windows.Forms.Label();\r\n            this.label2 = new System.Windows.Forms.Label();\r\n            this.txtPortAddr = new System.Windows.Forms.TextBox();\r\n            this.txtValue = new System.Windows.Forms.TextBox();\r\n            this.label3 = new System.Windows.Forms.Label();\r\n            this.label4 = new System.Windows.Forms.Label();\r\n            this.label5 = new System.Windows.Forms.Label();\r\n            this.SuspendLayout();\r\n            // \r\n            // btnGetValue\r\n            // \r\n            this.btnGetValue.Location = new System.Drawing.Point(32, 220);\r\n            this.btnGetValue.Name = \"btnGetValue\";\r\n            this.btnGetValue.Size = new System.Drawing.Size(75, 23);\r\n            this.btnGetValue.TabIndex = 0;\r\n            this.btnGetValue.Text = \"Get Value\";\r\n            this.btnGetValue.UseVisualStyleBackColor = true;\r\n            this.btnGetValue.Click += new System.EventHandler(this.btnGetValue_Click);\r\n            // \r\n            // btnSetValue\r\n            // \r\n            this.btnSetValue.Location = new System.Drawing.Point(137, 220);\r\n            this.btnSetValue.Name = \"btnSetValue\";\r\n            this.btnSetValue.Size = new System.Drawing.Size(75, 23);\r\n            this.btnSetValue.TabIndex = 1;\r\n            this.btnSetValue.Text = \"Set Value\";\r\n            this.btnSetValue.UseVisualStyleBackColor = true;\r\n            this.btnSetValue.Click += new System.EventHandler(this.btnSetValue_Click);\r\n            // \r\n            // btnQuit\r\n            // \r\n            this.btnQuit.Location = new System.Drawing.Point(242, 220);\r\n            this.btnQuit.Name = \"btnQuit\";\r\n            this.btnQuit.Size = new System.Drawing.Size(75, 23);\r\n            this.btnQuit.TabIndex = 2;\r\n            this.btnQuit.Text = \"Quit\";\r\n            this.btnQuit.UseVisualStyleBackColor = true;\r\n            this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click);\r\n            // \r\n            // label1\r\n            // \r\n            this.label1.AutoSize = true;\r\n            this.label1.Location = new System.Drawing.Point(44, 140);\r\n            this.label1.Name = \"label1\";\r\n            this.label1.Size = new System.Drawing.Size(156, 13);\r\n            this.label1.TabIndex = 3;\r\n            this.label1.Text = \"Please enter port address (hex):\";\r\n            // \r\n            // label2\r\n            // \r\n            this.label2.AutoSize = true;\r\n            this.label2.Location = new System.Drawing.Point(44, 170);\r\n            this.label2.Name = \"label2\";\r\n            this.label2.Size = new System.Drawing.Size(63, 13);\r\n            this.label2.TabIndex = 4;\r\n            this.label2.Text = \"Value (hex):\";\r\n            // \r\n            // txtPortAddr\r\n            // \r\n            this.txtPortAddr.Location = new System.Drawing.Point(206, 137);\r\n            this.txtPortAddr.MaxLength = 4;\r\n            this.txtPortAddr.Name = \"txtPortAddr\";\r\n            this.txtPortAddr.Size = new System.Drawing.Size(36, 20);\r\n            this.txtPortAddr.TabIndex = 5;\r\n            this.txtPortAddr.Text = \"0\";\r\n            // \r\n            // txtValue\r\n            // \r\n            this.txtValue.Location = new System.Drawing.Point(113, 167);\r\n            this.txtValue.MaxLength = 2;\r\n            this.txtValue.Name = \"txtValue\";\r\n            this.txtValue.Size = new System.Drawing.Size(23, 20);\r\n            this.txtValue.TabIndex = 6;\r\n            // \r\n            // label3\r\n            // \r\n            this.label3.AutoSize = true;\r\n            this.label3.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r\n            this.label3.Location = new System.Drawing.Point(87, 19);\r\n            this.label3.Name = \"label3\";\r\n            this.label3.Size = new System.Drawing.Size(174, 39);\r\n            this.label3.TabIndex = 7;\r\n            this.label3.Text = \"DumpPort\";\r\n            // \r\n            // label4\r\n            // \r\n            this.label4.AutoSize = true;\r\n            this.label4.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r\n            this.label4.Location = new System.Drawing.Point(62, 69);\r\n            this.label4.Name = \"label4\";\r\n            this.label4.Size = new System.Drawing.Size(225, 16);\r\n            this.label4.TabIndex = 8;\r\n            this.label4.Text = \"Copyright 1998-2010 by Yariv Kaplan\";\r\n            // \r\n            // label5\r\n            // \r\n            this.label5.AutoSize = true;\r\n            this.label5.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r\n            this.label5.Location = new System.Drawing.Point(116, 97);\r\n            this.label5.Name = \"label5\";\r\n            this.label5.Size = new System.Drawing.Size(117, 16);\r\n            this.label5.TabIndex = 9;\r\n            this.label5.Text = \"www.internals.com\";\r\n            // \r\n            // Form1\r\n            // \r\n            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r\n            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r\n            this.ClientSize = new System.Drawing.Size(348, 263);\r\n            this.ControlBox = false;\r\n            this.Controls.Add(this.label5);\r\n            this.Controls.Add(this.label4);\r\n            this.Controls.Add(this.label3);\r\n            this.Controls.Add(this.txtValue);\r\n            this.Controls.Add(this.txtPortAddr);\r\n            this.Controls.Add(this.label2);\r\n            this.Controls.Add(this.label1);\r\n            this.Controls.Add(this.btnQuit);\r\n            this.Controls.Add(this.btnSetValue);\r\n            this.Controls.Add(this.btnGetValue);\r\n            this.Name = \"Form1\";\r\n            this.Text = \"DumpPort - www.internals.com\";\r\n            this.Load += new System.EventHandler(this.Form1_Load);\r\n            this.ResumeLayout(false);\r\n            this.PerformLayout();\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private System.Windows.Forms.Button btnGetValue;\r\n        private System.Windows.Forms.Button btnSetValue;\r\n        private System.Windows.Forms.Button btnQuit;\r\n        private System.Windows.Forms.Label label1;\r\n        private System.Windows.Forms.Label label2;\r\n        private System.Windows.Forms.TextBox txtPortAddr;\r\n        private System.Windows.Forms.TextBox txtValue;\r\n        private System.Windows.Forms.Label label3;\r\n        private System.Windows.Forms.Label label4;\r\n        private System.Windows.Forms.Label label5;\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Samples/DumpPort/DumpPort/Form1.cs",
    "content": "// ---------------------------------------------------- //\r\n//                      WinIo v3.0                      //\r\n//          Direct Hardware Access Under Windows        //\r\n//           Copyright 1998-2010 Yariv Kaplan           //\r\n//               http://www.internals.com               //\r\n// ---------------------------------------------------- //\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Data;\r\nusing System.Drawing;\r\nusing System.Text;\r\nusing System.Windows.Forms;\r\nusing System.Runtime.InteropServices;\r\nusing System.Diagnostics;\r\n\r\n\r\nnamespace DumpPort\r\n{\r\n    public unsafe partial class Form1 : Form\r\n    {\r\n        [DllImport(\"kernel32.dll\")]\r\n        private extern static IntPtr LoadLibrary(String DllName);\r\n\r\n        [DllImport(\"kernel32.dll\")]\r\n        private extern static IntPtr GetProcAddress(IntPtr hModule, String ProcName);\r\n\r\n        [DllImport(\"kernel32\")]\r\n        private extern static bool FreeLibrary(IntPtr hModule);\r\n\r\n        [UnmanagedFunctionPointer(CallingConvention.StdCall)]\r\n        private delegate bool InitializeWinIoType();\r\n\r\n        [UnmanagedFunctionPointer(CallingConvention.StdCall)]\r\n        private delegate bool GetPortValType(UInt16 PortAddr, UInt32* pPortVal, UInt16 Size);\r\n\r\n        [UnmanagedFunctionPointer(CallingConvention.StdCall)]\r\n        private delegate bool SetPortValType(UInt16 PortAddr, UInt32 PortVal, UInt16 Size);\r\n\r\n        [UnmanagedFunctionPointer(CallingConvention.StdCall)]\r\n        private delegate bool ShutdownWinIoType();\r\n\r\n        IntPtr hMod;\r\n\r\n        public Form1()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void Form1_Load(object sender, EventArgs e)\r\n        {\r\n            // Check if this is a 32 bit or 64 bit system\r\n            if (IntPtr.Size == 4)\r\n            {\r\n                hMod = LoadLibrary(\"WinIo32.dll\");\r\n\r\n            }\r\n            else if (IntPtr.Size == 8)\r\n            {\r\n                hMod = LoadLibrary(\"WinIo64.dll\");\r\n            }\r\n\r\n            if (hMod == IntPtr.Zero)\r\n            {\r\n                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);\r\n                this.Close();\r\n            }\r\n\r\n            IntPtr pFunc = GetProcAddress(hMod, \"InitializeWinIo\");\r\n\r\n            if (pFunc != IntPtr.Zero)\r\n            {\r\n                InitializeWinIoType InitializeWinIo = (InitializeWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(InitializeWinIoType));\r\n                bool Result = InitializeWinIo();\r\n\r\n                if (!Result)\r\n                {\r\n                    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);\r\n                    FreeLibrary(hMod);\r\n                    this.Close();\r\n                }\r\n            }\r\n\r\n            btnGetValue_Click(this, null);\r\n        }\r\n\r\n        private void btnQuit_Click(object sender, EventArgs e)\r\n        {\r\n            IntPtr pFunc = GetProcAddress(hMod, \"ShutdownWinIo\");\r\n\r\n            if (pFunc != IntPtr.Zero)\r\n            {\r\n                ShutdownWinIoType ShutdownWinIo = (ShutdownWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(ShutdownWinIoType));\r\n\r\n                ShutdownWinIo();\r\n                FreeLibrary(hMod);\r\n            }\r\n          \r\n            this.Close();\r\n        }\r\n\r\n        private void btnGetValue_Click(object sender, EventArgs e)\r\n        {\r\n            IntPtr pFunc = GetProcAddress(hMod, \"GetPortVal\");\r\n\r\n            if (pFunc != IntPtr.Zero)\r\n            {\r\n                UInt16 PortAddr;\r\n                UInt32 PortVal;\r\n\r\n                PortAddr = UInt16.Parse(txtPortAddr.Text, System.Globalization.NumberStyles.HexNumber);\r\n\r\n                GetPortValType GetPortVal = (GetPortValType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(GetPortValType));\r\n\r\n                // Call WinIo to get value\r\n                bool Result = GetPortVal(PortAddr, &PortVal, 1);\r\n\r\n                if (Result)\r\n                {\r\n                    txtValue.Text = PortVal.ToString(\"X\");\r\n                }\r\n                else\r\n                {\r\n                    MessageBox.Show(\"Error returned from GetPortVal\", \"DumpPort\", MessageBoxButtons.OK, MessageBoxIcon.Error);\r\n                }\r\n            }\r\n        }\r\n\r\n        private void btnSetValue_Click(object sender, EventArgs e)\r\n        {\r\n            IntPtr pFunc = GetProcAddress(hMod, \"SetPortVal\");\r\n\r\n            if (pFunc != IntPtr.Zero)\r\n            {\r\n                UInt16 PortAddr;\r\n                UInt32 PortVal;\r\n\r\n                PortAddr = UInt16.Parse(txtPortAddr.Text, System.Globalization.NumberStyles.HexNumber);\r\n                PortVal = UInt32.Parse(txtValue.Text, System.Globalization.NumberStyles.HexNumber);\r\n\r\n                SetPortValType SetPortVal = (SetPortValType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(SetPortValType));\r\n\r\n                // Call WinIo to set value\r\n                bool Result = SetPortVal(PortAddr, PortVal, 1 );\r\n\r\n                if (!Result)\r\n                {\r\n                    MessageBox.Show(\"Error returned from SetPortVal\", \"DumpPort\", MessageBoxButtons.OK, MessageBoxIcon.Error);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Samples/DumpPort/DumpPort/Form1.resx",
    "content": "<?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    The primary goals of this format is to allow a simple XML format \r\n    that is mostly human readable. The generation and parsing of the \r\n    various data types are done through the TypeConverter classes \r\n    associated with the data types.\r\n    \r\n    Example:\r\n    \r\n    ... ado.net/XML headers & schema ...\r\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\r\n    <resheader name=\"version\">2.0</resheader>\r\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\r\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\r\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\r\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\r\n    </data>\r\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\r\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\r\n        <comment>This is a comment</comment>\r\n    </data>\r\n                \r\n    There are any number of \"resheader\" rows that contain simple \r\n    name/value pairs.\r\n    \r\n    Each data row contains a name, and value. The row also contains a \r\n    type or mimetype. Type corresponds to a .NET class that support \r\n    text/value conversion through the TypeConverter architecture. \r\n    Classes that don't support this are serialized and stored with the \r\n    mimetype set.\r\n    \r\n    The mimetype is used for serialized objects, and tells the \r\n    ResXResourceReader how to depersist the object. This is currently not \r\n    extensible. For a given mimetype the value must be set accordingly:\r\n    \r\n    Note - application/x-microsoft.net.object.binary.base64 is the format \r\n    that the ResXResourceWriter will generate, however the reader can \r\n    read any of the formats listed below.\r\n    \r\n    mimetype: application/x-microsoft.net.object.binary.base64\r\n    value   : The object must be serialized with \r\n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\r\n            : and then encoded with base64 encoding.\r\n    \r\n    mimetype: application/x-microsoft.net.object.soap.base64\r\n    value   : The object must be serialized with \r\n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r\n            : and then encoded with base64 encoding.\r\n\r\n    mimetype: application/x-microsoft.net.object.bytearray.base64\r\n    value   : The object must be serialized into a byte array \r\n            : using a System.ComponentModel.TypeConverter\r\n            : and then encoded with base64 encoding.\r\n    -->\r\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\r\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\r\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\r\n      <xsd:complexType>\r\n        <xsd:choice maxOccurs=\"unbounded\">\r\n          <xsd:element name=\"metadata\">\r\n            <xsd:complexType>\r\n              <xsd:sequence>\r\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\r\n              </xsd:sequence>\r\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\r\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\r\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\r\n              <xsd:attribute ref=\"xml:space\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n          <xsd:element name=\"assembly\">\r\n            <xsd:complexType>\r\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\r\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n          <xsd:element name=\"data\">\r\n            <xsd:complexType>\r\n              <xsd:sequence>\r\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\r\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\r\n              </xsd:sequence>\r\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\r\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\r\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\r\n              <xsd:attribute ref=\"xml:space\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n          <xsd:element name=\"resheader\">\r\n            <xsd:complexType>\r\n              <xsd:sequence>\r\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\r\n              </xsd:sequence>\r\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n        </xsd:choice>\r\n      </xsd:complexType>\r\n    </xsd:element>\r\n  </xsd:schema>\r\n  <resheader name=\"resmimetype\">\r\n    <value>text/microsoft-resx</value>\r\n  </resheader>\r\n  <resheader name=\"version\">\r\n    <value>2.0</value>\r\n  </resheader>\r\n  <resheader name=\"reader\">\r\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r\n  </resheader>\r\n  <resheader name=\"writer\">\r\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r\n  </resheader>\r\n</root>"
  },
  {
    "path": "Samples/DumpPort/DumpPort/Program.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Windows.Forms;\r\n\r\nnamespace DumpPort\r\n{\r\n    static class Program\r\n    {\r\n        /// <summary>\r\n        /// The main entry point for the application.\r\n        /// </summary>\r\n        [STAThread]\r\n        static void Main()\r\n        {\r\n            Application.EnableVisualStyles();\r\n            Application.SetCompatibleTextRenderingDefault(false);\r\n            Application.Run(new Form1());\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Samples/DumpPort/DumpPort/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\n\r\n// General Information about an assembly is controlled through the following \r\n// set of attributes. Change these attribute values to modify the information\r\n// associated with an assembly.\r\n[assembly: AssemblyTitle(\"DumpPort\")]\r\n[assembly: AssemblyDescription(\"\")]\r\n[assembly: AssemblyConfiguration(\"\")]\r\n[assembly: AssemblyCompany(\"www.internals.com\")]\r\n[assembly: AssemblyProduct(\"DumpPort\")]\r\n[assembly: AssemblyCopyright(\"Copyright © Yariv Kaplan 2010\")]\r\n[assembly: AssemblyTrademark(\"\")]\r\n[assembly: AssemblyCulture(\"\")]\r\n\r\n// Setting ComVisible to false makes the types in this assembly not visible \r\n// to COM components.  If you need to access a type in this assembly from \r\n// COM, set the ComVisible attribute to true on that type.\r\n[assembly: ComVisible(false)]\r\n\r\n// The following GUID is for the ID of the typelib if this project is exposed to COM\r\n[assembly: Guid(\"e4aa10c8-3c4e-4ea5-8461-4da84bf602f5\")]\r\n\r\n// Version information for an assembly consists of the following four values:\r\n//\r\n//      Major Version\r\n//      Minor Version \r\n//      Build Number\r\n//      Revision\r\n//\r\n[assembly: AssemblyVersion(\"1.0.0.0\")]\r\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\r\n"
  },
  {
    "path": "Samples/DumpPort/DumpPort/Properties/Resources.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.4927\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace DumpPort.Properties {\r\n    using System;\r\n    \r\n    \r\n    /// <summary>\r\n    ///   A strongly-typed resource class, for looking up localized strings, etc.\r\n    /// </summary>\r\n    // This class was auto-generated by the StronglyTypedResourceBuilder\r\n    // class via a tool like ResGen or Visual Studio.\r\n    // To add or remove a member, edit your .ResX file then rerun ResGen\r\n    // with the /str option, or rebuild your VS project.\r\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Resources.Tools.StronglyTypedResourceBuilder\", \"2.0.0.0\")]\r\n    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\r\n    internal class Resources {\r\n        \r\n        private static global::System.Resources.ResourceManager resourceMan;\r\n        \r\n        private static global::System.Globalization.CultureInfo resourceCulture;\r\n        \r\n        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"Microsoft.Performance\", \"CA1811:AvoidUncalledPrivateCode\")]\r\n        internal Resources() {\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Returns the cached ResourceManager instance used by this class.\r\n        /// </summary>\r\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        internal static global::System.Resources.ResourceManager ResourceManager {\r\n            get {\r\n                if (object.ReferenceEquals(resourceMan, null)) {\r\n                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(\"DumpPort.Properties.Resources\", typeof(Resources).Assembly);\r\n                    resourceMan = temp;\r\n                }\r\n                return resourceMan;\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Overrides the current thread's CurrentUICulture property for all\r\n        ///   resource lookups using this strongly typed resource class.\r\n        /// </summary>\r\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        internal static global::System.Globalization.CultureInfo Culture {\r\n            get {\r\n                return resourceCulture;\r\n            }\r\n            set {\r\n                resourceCulture = value;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Samples/DumpPort/DumpPort/Properties/Resources.resx",
    "content": "﻿<?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    The primary goals of this format is to allow a simple XML format \r\n    that is mostly human readable. The generation and parsing of the \r\n    various data types are done through the TypeConverter classes \r\n    associated with the data types.\r\n    \r\n    Example:\r\n    \r\n    ... ado.net/XML headers & schema ...\r\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\r\n    <resheader name=\"version\">2.0</resheader>\r\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\r\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\r\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\r\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\r\n    </data>\r\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\r\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\r\n        <comment>This is a comment</comment>\r\n    </data>\r\n                \r\n    There are any number of \"resheader\" rows that contain simple \r\n    name/value pairs.\r\n    \r\n    Each data row contains a name, and value. The row also contains a \r\n    type or mimetype. Type corresponds to a .NET class that support \r\n    text/value conversion through the TypeConverter architecture. \r\n    Classes that don't support this are serialized and stored with the \r\n    mimetype set.\r\n    \r\n    The mimetype is used for serialized objects, and tells the \r\n    ResXResourceReader how to depersist the object. This is currently not \r\n    extensible. For a given mimetype the value must be set accordingly:\r\n    \r\n    Note - application/x-microsoft.net.object.binary.base64 is the format \r\n    that the ResXResourceWriter will generate, however the reader can \r\n    read any of the formats listed below.\r\n    \r\n    mimetype: application/x-microsoft.net.object.binary.base64\r\n    value   : The object must be serialized with \r\n            : System.Serialization.Formatters.Binary.BinaryFormatter\r\n            : and then encoded with base64 encoding.\r\n    \r\n    mimetype: application/x-microsoft.net.object.soap.base64\r\n    value   : The object must be serialized with \r\n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r\n            : and then encoded with base64 encoding.\r\n\r\n    mimetype: application/x-microsoft.net.object.bytearray.base64\r\n    value   : The object must be serialized into a byte array \r\n            : using a System.ComponentModel.TypeConverter\r\n            : and then encoded with base64 encoding.\r\n    -->\r\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\r\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\r\n      <xsd:complexType>\r\n        <xsd:choice maxOccurs=\"unbounded\">\r\n          <xsd:element name=\"metadata\">\r\n            <xsd:complexType>\r\n              <xsd:sequence>\r\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\r\n              </xsd:sequence>\r\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\r\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\r\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n          <xsd:element name=\"assembly\">\r\n            <xsd:complexType>\r\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\r\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n          <xsd:element name=\"data\">\r\n            <xsd:complexType>\r\n              <xsd:sequence>\r\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\r\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\r\n              </xsd:sequence>\r\n              <xsd:attribute name=\"name\" type=\"xsd:string\" msdata:Ordinal=\"1\" />\r\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\r\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n          <xsd:element name=\"resheader\">\r\n            <xsd:complexType>\r\n              <xsd:sequence>\r\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\r\n              </xsd:sequence>\r\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\r\n            </xsd:complexType>\r\n          </xsd:element>\r\n        </xsd:choice>\r\n      </xsd:complexType>\r\n    </xsd:element>\r\n  </xsd:schema>\r\n  <resheader name=\"resmimetype\">\r\n    <value>text/microsoft-resx</value>\r\n  </resheader>\r\n  <resheader name=\"version\">\r\n    <value>2.0</value>\r\n  </resheader>\r\n  <resheader name=\"reader\">\r\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r\n  </resheader>\r\n  <resheader name=\"writer\">\r\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r\n  </resheader>\r\n</root>"
  },
  {
    "path": "Samples/DumpPort/DumpPort/Properties/Settings.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.4927\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace DumpPort.Properties {\r\n    \r\n    \r\n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\r\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator\", \"9.0.0.0\")]\r\n    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {\r\n        \r\n        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));\r\n        \r\n        public static Settings Default {\r\n            get {\r\n                return defaultInstance;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Samples/DumpPort/DumpPort/Properties/Settings.settings",
    "content": "﻿<?xml version='1.0' encoding='utf-8'?>\r\n<SettingsFile xmlns=\"http://schemas.microsoft.com/VisualStudio/2004/01/settings\" CurrentProfile=\"(Default)\">\r\n  <Profiles>\r\n    <Profile Name=\"(Default)\" />\r\n  </Profiles>\r\n  <Settings />\r\n</SettingsFile>\r\n"
  },
  {
    "path": "Samples/DumpPort/DumpPort.sln",
    "content": "﻿\r\nMicrosoft Visual Studio Solution File, Format Version 10.00\r\n# Visual Studio 2008\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"DumpPort\", \"DumpPort\\DumpPort.csproj\", \"{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug|Any CPU = Debug|Any CPU\r\n\t\tDebug|x86 = Debug|x86\r\n\t\tRelease|Any CPU = Release|Any CPU\r\n\t\tRelease|x86 = Release|x86\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Debug|x86.ActiveCfg = Debug|x86\r\n\t\t{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Debug|x86.Build.0 = Debug|x86\r\n\t\t{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Release|Any CPU.Build.0 = Release|Any CPU\r\n\t\t{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Release|x86.ActiveCfg = Release|x86\r\n\t\t{8E2C04F3-BDE2-49A4-8736-DE12944D5DDF}.Release|x86.Build.0 = Release|x86\r\n\tEndGlobalSection\r\n\tGlobalSection(SolutionProperties) = preSolution\r\n\t\tHideSolutionNode = FALSE\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "Source/Dll/InstDrv.cpp",
    "content": "// ---------------------------------------------------- //\r\n//                      WinIo v3.0                      //\r\n//\t\t\t\t Direct Hardware Access Under Windows\t//\r\n//           Copyright 1998-2010 Yariv Kaplan           //\r\n//               http://www.internals.com               //\r\n// ---------------------------------------------------- //\r\n\r\n#include <windows.h>\r\n#include \"winio.h\"\r\n\r\nbool _stdcall InstallWinIoDriver(PWSTR pszWinIoDriverPath, bool IsDemandLoaded)\r\n{\r\n\tSC_HANDLE hSCManager;\r\n\tSC_HANDLE hService;\r\n\r\n\t// Remove any previous instance of the driver\r\n\r\n\tRemoveWinIoDriver();\r\n\r\n\thSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);\r\n\r\n\tif (hSCManager)\r\n\t{\r\n\t\t// Install the driver\r\n\r\n\t\thService = CreateService(hSCManager,\r\n\t\t\tL\"WINIO\",\r\n\t\t\tL\"WINIO\",\r\n\t\t\tSERVICE_ALL_ACCESS,\r\n\t\t\tSERVICE_KERNEL_DRIVER,\r\n\t\t\t(IsDemandLoaded == true) ? SERVICE_DEMAND_START : SERVICE_SYSTEM_START,\r\n\t\t\tSERVICE_ERROR_NORMAL,\r\n\t\t\tpszWinIoDriverPath,\r\n\t\t\tNULL,\r\n\t\t\tNULL,\r\n\t\t\tNULL,\r\n\t\t\tNULL,\r\n\t\t\tNULL);\r\n\r\n\t\tCloseServiceHandle(hSCManager);\r\n\r\n\t\tif (hService == NULL)\r\n\t\t\treturn false;\r\n\t}\r\n\telse\r\n\t\treturn false;\r\n\r\n\tCloseServiceHandle(hService);\r\n\r\n\treturn true;\r\n}\r\n\r\n\r\nbool _stdcall RemoveWinIoDriver()\r\n{\r\n\tSC_HANDLE hSCManager;\r\n\tSC_HANDLE hService;\r\n\tLPQUERY_SERVICE_CONFIG pServiceConfig;\r\n\tDWORD dwBytesNeeded;\r\n\tDWORD cbBufSize;\r\n\tbool bResult;\r\n\r\n\tStopWinIoDriver();\r\n\r\n\thSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);\r\n\r\n\tif (!hSCManager)\r\n\t{\r\n\t\treturn false;\r\n\t}\r\n\r\n\thService = OpenService(hSCManager, L\"WINIO\", SERVICE_ALL_ACCESS);\r\n\tCloseServiceHandle(hSCManager);\r\n\r\n\tif (!hService)\r\n\t{\r\n\t\treturn false;\r\n\t}\r\n\r\n\tbResult = QueryServiceConfig(hService, NULL, 0, &dwBytesNeeded);\r\n\r\n\tif (GetLastError() == ERROR_INSUFFICIENT_BUFFER)\r\n\t{\r\n\t\tcbBufSize = dwBytesNeeded;\r\n\t\tpServiceConfig = (LPQUERY_SERVICE_CONFIG)malloc(cbBufSize);\r\n\t\tbResult = QueryServiceConfig(hService, pServiceConfig, cbBufSize, &dwBytesNeeded);\r\n\r\n\t\tif (!bResult)\r\n\t\t{\r\n\t\t\tfree(pServiceConfig);\r\n\t\t\tCloseServiceHandle(hService);\r\n\t\t\treturn bResult;\r\n\t\t}\r\n\r\n\t\t// If service is set to load automatically, don't delete it!\r\n\t\tif (pServiceConfig->dwStartType == SERVICE_DEMAND_START)\r\n\t\t{\r\n\t\t\tbResult = DeleteService(hService);\r\n\t\t}\r\n\t}\r\n\r\n\tCloseServiceHandle(hService);\r\n\r\n\treturn bResult;\r\n}\r\n\r\n\r\nbool _stdcall StartWinIoDriver()\r\n{\r\n\tSC_HANDLE hSCManager;\r\n\tSC_HANDLE hService;\r\n\tbool bResult;\r\n\r\n\thSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);\r\n\r\n\tif (hSCManager)\r\n\t{\r\n\t\thService = OpenService(hSCManager, L\"WINIO\", SERVICE_ALL_ACCESS);\r\n\r\n\t\tCloseServiceHandle(hSCManager);\r\n\r\n\t\tif (hService)\r\n\t\t{\r\n\t\t\tbResult = StartService(hService, 0, NULL) || GetLastError() == ERROR_SERVICE_ALREADY_RUNNING;\r\n\r\n\t\t\tCloseServiceHandle(hService);\r\n\t\t}\r\n\t\telse\r\n\t\t\treturn false;\r\n\t}\r\n\telse\r\n\t\treturn false;\r\n\r\n\treturn bResult;\r\n}\r\n\r\n\r\nbool _stdcall StopWinIoDriver()\r\n{\r\n\tSC_HANDLE hSCManager;\r\n\tSC_HANDLE hService;\r\n\tSERVICE_STATUS ServiceStatus;\r\n\tbool bResult;\r\n\r\n\thSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);\r\n\r\n\tif (hSCManager)\r\n\t{\r\n\t\thService = OpenService(hSCManager, L\"WINIO\", SERVICE_ALL_ACCESS);\r\n\r\n\t\tCloseServiceHandle(hSCManager);\r\n\r\n\t\tif (hService)\r\n\t\t{\r\n\t\t\tbResult = ControlService(hService, SERVICE_CONTROL_STOP, &ServiceStatus);\r\n\r\n\t\t\tCloseServiceHandle(hService);\r\n\t\t}\r\n\t\telse\r\n\t\t\treturn false;\r\n\t}\r\n\telse\r\n\t\treturn false;\r\n\r\n\treturn bResult;\r\n}"
  },
  {
    "path": "Source/Dll/Phys32.cpp",
    "content": "// ---------------------------------------------------- //\r\n//                      WinIo v3.0                      //\r\n//\t\t\t\t Direct Hardware Access Under Windows\t//\r\n//           Copyright 1998-2010 Yariv Kaplan           //\r\n//               http://www.internals.com               //\r\n// ---------------------------------------------------- //\r\n\r\n#include <windows.h>\r\n#include <winioctl.h>\r\n#include \"phys32.h\"\r\n#include \"..\\drv\\winio_nt.h\"\r\n#include \"winio.h\"\r\n\r\n\r\nPBYTE _stdcall MapPhysToLin(tagPhysStruct &PhysStruct)\r\n{\r\n\tPBYTE pbLinAddr = NULL;\r\n\tDWORD dwBytesReturned;\r\n\r\n\tif (!IsWinIoInitialized)\r\n\t\treturn false;\r\n\r\n\tif (!DeviceIoControl(hDriver, IOCTL_WINIO_MAPPHYSTOLIN, &PhysStruct,\r\n\t\tsizeof(tagPhysStruct), &PhysStruct, sizeof(tagPhysStruct),\r\n\t\t&dwBytesReturned, NULL))\r\n\t{\r\n\t\treturn NULL;\r\n\t}\r\n\r\n\treturn (PBYTE)PhysStruct.pvPhysMemLin;\r\n}\r\n\r\n\r\nbool _stdcall UnmapPhysicalMemory(tagPhysStruct &PhysStruct)\r\n{\r\n\tDWORD dwBytesReturned;\r\n\r\n\tif (!IsWinIoInitialized)\r\n\t{\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif (!DeviceIoControl(hDriver, IOCTL_WINIO_UNMAPPHYSADDR, &PhysStruct,\r\n\t\tsizeof(tagPhysStruct), NULL, 0, &dwBytesReturned, NULL))\r\n\t{\r\n\t\treturn false;\r\n\t}\r\n\r\n\treturn true;\r\n}\r\n\r\n// Support functions\r\n\r\nbool _stdcall GetPhysLong(PBYTE pbPhysAddr, PDWORD pdwPhysVal)\r\n{\r\n\tPDWORD pdwLinAddr;\r\n\ttagPhysStruct PhysStruct;\r\n\r\n\tif (!IsWinIoInitialized)\r\n\t\treturn false;\r\n\r\n\tif (g_Is64BitOS)\r\n\t{\r\n\t\tPhysStruct.pvPhysAddress = (DWORD64)pbPhysAddr;\r\n\t}\r\n\telse\r\n\t{\r\n\t\t// Avoid sign extension issues\r\n\t\tPhysStruct.pvPhysAddress = (DWORD64)(DWORD32)pbPhysAddr;\r\n\t}\r\n\r\n\tPhysStruct.dwPhysMemSizeInBytes = 4;\r\n\r\n\tpdwLinAddr = (PDWORD)MapPhysToLin(PhysStruct);\r\n\r\n\tif (pdwLinAddr == NULL)\r\n\t\treturn false;\r\n\r\n\t*pdwPhysVal = *pdwLinAddr;\r\n\r\n\tUnmapPhysicalMemory(PhysStruct);\r\n\r\n\treturn true;\r\n}\r\n\r\n\r\nbool _stdcall SetPhysLong(PBYTE pbPhysAddr, DWORD dwPhysVal)\r\n{\r\n\tPDWORD pdwLinAddr;\r\n\ttagPhysStruct PhysStruct;\r\n\r\n\tif (!IsWinIoInitialized)\r\n\t\treturn false;\r\n\r\n\tif (g_Is64BitOS)\r\n\t{\r\n\t\tPhysStruct.pvPhysAddress = (DWORD64)pbPhysAddr;\r\n\t}\r\n\telse\r\n\t{\r\n\t\t// Avoid sign extension issues\r\n\t\tPhysStruct.pvPhysAddress = (DWORD64)(DWORD32)pbPhysAddr;\r\n\t}\r\n\r\n\tPhysStruct.dwPhysMemSizeInBytes = 4;\r\n\r\n\tpdwLinAddr = (PDWORD)MapPhysToLin(PhysStruct);\r\n\r\n\tif (pdwLinAddr == NULL)\r\n\t\treturn false;\r\n\r\n\t*pdwLinAddr = dwPhysVal;\r\n\r\n\tUnmapPhysicalMemory(PhysStruct);\r\n\r\n\treturn true;\r\n}\r\n"
  },
  {
    "path": "Source/Dll/Phys32.h",
    "content": "#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#endif"
  },
  {
    "path": "Source/Dll/Port32.cpp",
    "content": "// ---------------------------------------------------- //\r\n//                      WinIo v3.0                      //\r\n//\t\t\t\t Direct Hardware Access Under Windows\t//\r\n//           Copyright 1998-2010 Yariv Kaplan           //\r\n//               http://www.internals.com               //\r\n// ---------------------------------------------------- //\r\n\r\n#include <windows.h>\r\n#include <winioctl.h>\r\n#include <conio.h>\r\n#include \"port32.h\"\r\n#include \"..\\drv\\winio_nt.h\"\r\n#include \"winio.h\"\r\n\r\n\r\nbool _stdcall GetPortVal(WORD wPortAddr, PDWORD pdwPortVal, BYTE bSize)\r\n{\r\n\tif (!IsWinIoInitialized)\r\n\t{\r\n\t\treturn false;\r\n\t}\r\n\r\n#ifdef _WIN64\r\n\ttagPortStruct PortStruct;\r\n\tDWORD dwBytesReturned;\r\n\r\n\tPortStruct.bSize = bSize;\r\n\tPortStruct.wPortAddr = wPortAddr;\r\n\r\n\treturn DeviceIoControl(hDriver, IOCTL_WINIO_READPORT, &PortStruct, sizeof(PortStruct),\r\n\t\tpdwPortVal, sizeof(DWORD), &dwBytesReturned, NULL);\r\n\r\n\r\n#elif _WIN32\r\n\t// If this is a 64 bit OS, we must use the driver to access I/O ports even if the application is 32 bit\r\n\tif (g_Is64BitOS)\r\n\t{\r\n\t\ttagPortStruct PortStruct;\r\n\t\tDWORD dwBytesReturned;\r\n\r\n\t\tPortStruct.bSize = bSize;\r\n\t\tPortStruct.wPortAddr = wPortAddr;\r\n\r\n\t\treturn DeviceIoControl(hDriver, IOCTL_WINIO_READPORT, &PortStruct, sizeof(PortStruct),\r\n\t\t\tpdwPortVal, sizeof(DWORD), &dwBytesReturned, NULL);\r\n\t}\r\n\telse\r\n\t{\r\n\t\tswitch (bSize)\r\n\t\t{\r\n\t\tcase 1:\r\n\r\n\t\t\t*pdwPortVal = _inp(wPortAddr);\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase 2:\r\n\r\n\t\t\t*pdwPortVal = _inpw(wPortAddr);\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase 4:\r\n\r\n\t\t\t*pdwPortVal = _inpd(wPortAddr);\r\n\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n#endif\r\n\r\n\treturn true;\r\n}\r\n\r\n\r\nbool _stdcall SetPortVal(WORD wPortAddr, DWORD dwPortVal, BYTE bSize)\r\n{\r\n\tif (!IsWinIoInitialized)\r\n\t{\r\n\t\treturn false;\r\n\t}\r\n\r\n#ifdef _WIN64\r\n\ttagPortStruct PortStruct;\r\n\tDWORD dwBytesReturned;\r\n\r\n\tPortStruct.bSize = bSize;\r\n\tPortStruct.dwPortVal = dwPortVal;\r\n\tPortStruct.wPortAddr = wPortAddr;\r\n\r\n\treturn DeviceIoControl(hDriver, IOCTL_WINIO_WRITEPORT, &PortStruct, sizeof(PortStruct),\r\n\t\tNULL, 0, &dwBytesReturned, NULL);\r\n#elif _WIN32\r\n\t// If this is a 64 bit OS, we must use the driver to access I/O ports even if the application is 32 bit\r\n\tif (g_Is64BitOS)\r\n\t{\r\n\t\ttagPortStruct PortStruct;\r\n\t\tDWORD dwBytesReturned;\r\n\r\n\t\tPortStruct.bSize = bSize;\r\n\t\tPortStruct.dwPortVal = dwPortVal;\r\n\t\tPortStruct.wPortAddr = wPortAddr;\r\n\r\n\t\treturn DeviceIoControl(hDriver, IOCTL_WINIO_WRITEPORT, &PortStruct, sizeof(PortStruct),\r\n\t\t\tNULL, 0, &dwBytesReturned, NULL);\r\n\t}\r\n\telse\r\n\t{\r\n\t\tswitch (bSize)\r\n\t\t{\r\n\t\tcase 1:\r\n\r\n\t\t\t_outp(wPortAddr, dwPortVal);\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase 2:\r\n\r\n\t\t\t_outpw(wPortAddr, (WORD)dwPortVal);\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase 4:\r\n\r\n\t\t\t_outpd(wPortAddr, dwPortVal);\r\n\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n#endif\r\n\r\n\treturn true;\r\n}\r\n"
  },
  {
    "path": "Source/Dll/Port32.h",
    "content": "#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;\r\n  BYTE Base_16_23;\r\n  BYTE Type         : 4;\r\n  BYTE System       : 1;\r\n  BYTE DPL          : 2;\r\n  BYTE Present      : 1;\r\n  BYTE Limit_16_19  : 4;\r\n  BYTE Available    : 1;\r\n  BYTE Reserved     : 1;\r\n  BYTE D_B          : 1;\r\n  BYTE Granularity  : 1;\r\n  BYTE Base_24_31;\r\n};\r\n\r\nstruct CALLGATE_DESCRIPTOR\r\n{\r\n  WORD Offset_0_15;\r\n  WORD Selector;\r\n  WORD ParamCount   : 5;\r\n  WORD Unused       : 3;\r\n  WORD Type         : 4;\r\n  WORD System       : 1;\r\n  WORD DPL          : 2;\r\n  WORD Present      : 1;\r\n  WORD Offset_16_31;\r\n};\r\n\r\nstruct GDTR\r\n{\r\n  WORD wGDTLimit;\r\n  DWORD dwGDTBase;\r\n};\r\n\r\n#pragma pack()\r\n\r\n#endif"
  },
  {
    "path": "Source/Dll/WinIo.cpp",
    "content": "// ---------------------------------------------------- //\r\n//                      WinIo v3.0                      //\r\n//\t\t\t\t Direct Hardware Access Under Windows\t//\r\n//           Copyright 1998-2010 Yariv Kaplan           //\r\n//               http://www.internals.com               //\r\n// ---------------------------------------------------- //\r\n\r\n#define _WIN32_WINNT 0x0501\r\n\r\n#include <windows.h>\r\n#include <winioctl.h>\r\n#include \"phys32.h\"\r\n#include \"..\\drv\\winio_nt.h\"\r\n#include \"winio.h\"\r\n\r\nHANDLE hDriver = INVALID_HANDLE_VALUE;\r\nbool IsWinIoInitialized = false;\r\nwchar_t szWinIoDriverPath[32768];\r\nbool g_Is64BitOS;\r\n\r\n\r\ntypedef UINT (WINAPI* GETSYSTEMWOW64DIRECTORY)(LPTSTR, UINT);\r\n\r\nBOOL Is64BitOS()\r\n{\r\n#ifdef _WIN64\r\n\treturn TRUE;\r\n#else\r\n\tGETSYSTEMWOW64DIRECTORY getSystemWow64Directory;\r\n\tHMODULE hKernel32;\r\n\tTCHAR Wow64Directory[32767];\r\n\r\n\thKernel32 = GetModuleHandle(TEXT(\"kernel32.dll\"));\r\n\tif (hKernel32 == NULL)\r\n\t{\r\n\t\t//\r\n\t\t// This shouldn't happen, but if we can't get \r\n\t\t// kernel32's module handle then assume we are \r\n\t\t// on x86. We won't ever install 32-bit drivers\r\n\t\t// on 64-bit machines, we just want to catch it \r\n\t\t// up front to give users a better error message.\r\n\t\t//\r\n\t\treturn FALSE;\r\n\t}\r\n\r\n\tgetSystemWow64Directory = (GETSYSTEMWOW64DIRECTORY)GetProcAddress(hKernel32, \"GetSystemWow64DirectoryW\");\r\n\r\n\tif (getSystemWow64Directory == NULL)\r\n\t{\r\n\t\t//\r\n\t\t// This most likely means we are running \r\n\t\t// on Windows 2000, which didn't have this API \r\n\t\t// and didn't have a 64-bit counterpart.\r\n\t\t//\r\n\t\treturn FALSE;\r\n\t}\r\n\r\n\tif ((getSystemWow64Directory(Wow64Directory, _countof(Wow64Directory)) == 0) &&\r\n\t\t(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)) {\r\n\t\t\treturn FALSE;\r\n\t}\r\n\r\n\t//\r\n\t// GetSystemWow64Directory succeeded \r\n\t// so we are on a 64-bit OS.\r\n\t//\r\n\treturn TRUE;\r\n#endif\r\n}\r\n\r\n\r\nbool GetDriverPath()\r\n{\r\n\tPWSTR pszSlash;\r\n\r\n\tif (!GetModuleFileName(GetModuleHandle(NULL), szWinIoDriverPath, sizeof(szWinIoDriverPath)))\r\n\t\treturn false;\r\n\r\n\tpszSlash = wcsrchr(szWinIoDriverPath, '\\\\');\r\n\r\n\tif (pszSlash)\r\n\t\tpszSlash[1] = 0;\r\n\telse\r\n\t\treturn false;\r\n\r\n\tif (g_Is64BitOS)\r\n\t\twcscat(szWinIoDriverPath, L\"winio64.sys\");\r\n\telse\r\n\t\twcscat(szWinIoDriverPath, L\"winio32.sys\");\r\n\r\n\treturn true;\r\n}\r\n\r\n\r\nbool __stdcall InitializeWinIo()\r\n{\r\n\tbool bResult;\r\n\tDWORD dwBytesReturned;\r\n\r\n\tg_Is64BitOS = Is64BitOS();\r\n\r\n\thDriver = CreateFile(L\"\\\\\\\\.\\\\WINIO\",\r\n\t\tGENERIC_READ | GENERIC_WRITE,\r\n\t\t0,\r\n\t\tNULL,\r\n\t\tOPEN_EXISTING,\r\n\t\tFILE_ATTRIBUTE_NORMAL,\r\n\t\tNULL);\r\n\r\n\t// If the driver is not running, install it\r\n\r\n\tif (hDriver == INVALID_HANDLE_VALUE)\r\n\t{\t\t\r\n\t\tGetDriverPath();\r\n\r\n\t\tbResult = InstallWinIoDriver(szWinIoDriverPath, true);\r\n\r\n\t\tif (!bResult)\r\n\t\t\treturn false;\r\n\r\n\t\tbResult = StartWinIoDriver();\r\n\r\n\t\tif (!bResult)\r\n\t\t\treturn false;\r\n\r\n\t\thDriver = CreateFile(L\"\\\\\\\\.\\\\WINIO\",\r\n\t\t\tGENERIC_READ | GENERIC_WRITE,\r\n\t\t\tFILE_SHARE_READ | FILE_SHARE_WRITE,\r\n\t\t\tNULL,\r\n\t\t\tOPEN_EXISTING,\r\n\t\t\tFILE_ATTRIBUTE_NORMAL,\r\n\t\t\tNULL);\r\n\r\n\t\tif (hDriver == INVALID_HANDLE_VALUE)\r\n\t\t\treturn false;\r\n\t}\r\n\r\n\t// Enable I/O port access for this process if running on a 32 bit OS\r\n\r\n\tif (!g_Is64BitOS)\r\n\t{\r\n\t\tif (!DeviceIoControl(hDriver, IOCTL_WINIO_ENABLEDIRECTIO, NULL,\r\n\t\t\t0, NULL, 0, &dwBytesReturned, NULL))\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\tIsWinIoInitialized = true;\r\n\r\n\treturn true;\r\n}\r\n\r\n\r\nvoid _stdcall ShutdownWinIo()\r\n{\r\n\tDWORD dwBytesReturned;\r\n\r\n\tif (hDriver != INVALID_HANDLE_VALUE)\r\n\t{\r\n\t\t// Disable I/O port access if running on a 32 bit OS\r\n\r\n\t\tif (!g_Is64BitOS)\r\n\t\t{\r\n\t\t\tDeviceIoControl(hDriver, IOCTL_WINIO_DISABLEDIRECTIO, NULL,\r\n\t\t\t\t0, NULL, 0, &dwBytesReturned, NULL);\r\n\t\t}\r\n\r\n\t\tCloseHandle(hDriver);\r\n\r\n\t}\r\n\r\n\tRemoveWinIoDriver();\r\n\r\n\tIsWinIoInitialized = false;\r\n}\r\n"
  },
  {
    "path": "Source/Dll/WinIo.def",
    "content": "EXPORTS\r\nInitializeWinIo\r\nShutdownWinIo\r\nMapPhysToLin\r\nUnmapPhysicalMemory\r\nGetPhysLong\r\nSetPhysLong\r\nGetPortVal\r\nSetPortVal\r\nInstallWinIoDriver\r\nRemoveWinIoDriver\r\n"
  },
  {
    "path": "Source/Dll/WinIo.rc",
    "content": "// Microsoft Visual C++ generated resource script.\r\n//\r\n#include \"resource.h\"\r\n\r\n#define APSTUDIO_READONLY_SYMBOLS\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Generated from the TEXTINCLUDE 2 resource.\r\n//\r\n#include \"afxres.h\"\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n#undef APSTUDIO_READONLY_SYMBOLS\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n// English (U.S.) resources\r\n\r\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n#ifdef _WIN32\r\nLANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\r\n#pragma code_page(1252)\r\n#endif //_WIN32\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Version\r\n//\r\n\r\nVS_VERSION_INFO VERSIONINFO\r\n FILEVERSION 3,0,0,0\r\n PRODUCTVERSION 3,0,0,0\r\n FILEFLAGSMASK 0x3fL\r\n#ifdef _DEBUG\r\n FILEFLAGS 0x29L\r\n#else\r\n FILEFLAGS 0x28L\r\n#endif\r\n FILEOS 0x40004L\r\n FILETYPE 0x2L\r\n FILESUBTYPE 0x0L\r\nBEGIN\r\n    BLOCK \"StringFileInfo\"\r\n    BEGIN\r\n        BLOCK \"040904b0\"\r\n        BEGIN\r\n            VALUE \"Comments\", \" \"\r\n            VALUE \"CompanyName\", \"www.internals.com\"\r\n            VALUE \"FileDescription\", \"WinIo\"\r\n            VALUE \"FileVersion\", \"3.0\"\r\n            VALUE \"InternalName\", \"WinIo\"\r\n            VALUE \"LegalCopyright\", \"Copyright  1998-2010, Yariv Kaplan\"\r\n            VALUE \"LegalTrademarks\", \" \"\r\n            VALUE \"OriginalFilename\", \"WinIo.dll\"\r\n            VALUE \"PrivateBuild\", \" \"\r\n            VALUE \"ProductName\", \"WinIo\"\r\n            VALUE \"ProductVersion\", \"3.0\"\r\n            VALUE \"SpecialBuild\", \" \"\r\n        END\r\n    END\r\n    BLOCK \"VarFileInfo\"\r\n    BEGIN\r\n        VALUE \"Translation\", 0x409, 1200\r\n    END\r\nEND\r\n\r\n\r\n#ifdef APSTUDIO_INVOKED\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// TEXTINCLUDE\r\n//\r\n\r\n1 TEXTINCLUDE \r\nBEGIN\r\n    \"resource.h\\0\"\r\nEND\r\n\r\n2 TEXTINCLUDE \r\nBEGIN\r\n    \"#include \"\"afxres.h\"\"\\r\\n\"\r\n    \"\\0\"\r\nEND\r\n\r\n3 TEXTINCLUDE \r\nBEGIN\r\n    \"\\r\\n\"\r\n    \"\\0\"\r\nEND\r\n\r\n#endif    // APSTUDIO_INVOKED\r\n\r\n#endif    // English (U.S.) resources\r\n/////////////////////////////////////////////////////////////////////////////\r\n\r\n\r\n\r\n#ifndef APSTUDIO_INVOKED\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Generated from the TEXTINCLUDE 3 resource.\r\n//\r\n\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n#endif    // not APSTUDIO_INVOKED\r\n\r\n"
  },
  {
    "path": "Source/Dll/WinIo.sln",
    "content": "﻿\r\nMicrosoft Visual Studio Solution File, Format Version 10.00\r\n# Visual Studio 2008\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"WinIo\", \"WinIo.vcproj\", \"{DE9A75D4-D640-41B8-893B-A384FAF00738}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug|Win32 = Debug|Win32\r\n\t\tDebug|x64 = Debug|x64\r\n\t\tRelease|Win32 = Release|Win32\r\n\t\tRelease|x64 = Release|x64\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{DE9A75D4-D640-41B8-893B-A384FAF00738}.Debug|Win32.ActiveCfg = Debug|Win32\r\n\t\t{DE9A75D4-D640-41B8-893B-A384FAF00738}.Debug|Win32.Build.0 = Debug|Win32\r\n\t\t{DE9A75D4-D640-41B8-893B-A384FAF00738}.Debug|x64.ActiveCfg = Debug|x64\r\n\t\t{DE9A75D4-D640-41B8-893B-A384FAF00738}.Debug|x64.Build.0 = Debug|x64\r\n\t\t{DE9A75D4-D640-41B8-893B-A384FAF00738}.Release|Win32.ActiveCfg = Release|Win32\r\n\t\t{DE9A75D4-D640-41B8-893B-A384FAF00738}.Release|Win32.Build.0 = Release|Win32\r\n\t\t{DE9A75D4-D640-41B8-893B-A384FAF00738}.Release|x64.ActiveCfg = Release|x64\r\n\t\t{DE9A75D4-D640-41B8-893B-A384FAF00738}.Release|x64.Build.0 = Release|x64\r\n\tEndGlobalSection\r\n\tGlobalSection(SolutionProperties) = preSolution\r\n\t\tHideSolutionNode = FALSE\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "Source/Dll/WinIo.vcproj",
    "content": "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\r\n<VisualStudioProject\r\n\tProjectType=\"Visual C++\"\r\n\tVersion=\"9.00\"\r\n\tName=\"WinIo\"\r\n\tProjectGUID=\"{DE9A75D4-D640-41B8-893B-A384FAF00738}\"\r\n\tRootNamespace=\"WinIo\"\r\n\tKeyword=\"Win32Proj\"\r\n\tTargetFrameworkVersion=\"131072\"\r\n\t>\r\n\t<Platforms>\r\n\t\t<Platform\r\n\t\t\tName=\"Win32\"\r\n\t\t/>\r\n\t\t<Platform\r\n\t\t\tName=\"x64\"\r\n\t\t/>\r\n\t</Platforms>\r\n\t<ToolFiles>\r\n\t</ToolFiles>\r\n\t<Configurations>\r\n\t\t<Configuration\r\n\t\t\tName=\"Debug|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionDir)x86\\$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"x86\\$(ConfigurationName)\"\r\n\t\t\tConfigurationType=\"2\"\r\n\t\t\tCharacterSet=\"1\"\r\n\t\t\tBuildLogFile=\"$(IntDir)\\BuildLog.htm\"\r\n\t\t\t>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tOptimization=\"0\"\r\n\t\t\t\tPreprocessorDefinitions=\"WINIO_DLL\"\r\n\t\t\t\tMinimalRebuild=\"true\"\r\n\t\t\t\tBasicRuntimeChecks=\"3\"\r\n\t\t\t\tRuntimeLibrary=\"1\"\r\n\t\t\t\tUsePrecompiledHeader=\"0\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"true\"\r\n\t\t\t\tDebugInformationFormat=\"4\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedResourceCompilerTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)\\$(ProjectName)32.dll\"\r\n\t\t\t\tLinkIncremental=\"2\"\r\n\t\t\t\tModuleDefinitionFile=\".\\WinIo.def\"\r\n\t\t\t\tGenerateDebugInformation=\"true\"\r\n\t\t\t\tSubSystem=\"2\"\r\n\t\t\t\tRandomizedBaseAddress=\"1\"\r\n\t\t\t\tDataExecutionPrevention=\"0\"\r\n\t\t\t\tTargetMachine=\"1\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCALinkTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManifestTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXDCMakeTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCBscMakeTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCFxCopTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAppVerifierTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"\r\n\t\t\t/>\r\n\t\t</Configuration>\r\n\t\t<Configuration\r\n\t\t\tName=\"Debug|x64\"\r\n\t\t\tOutputDirectory=\"$(SolutionDir)$(PlatformName)\\$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(PlatformName)\\$(ConfigurationName)\"\r\n\t\t\tConfigurationType=\"2\"\r\n\t\t\tCharacterSet=\"1\"\r\n\t\t\t>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"\r\n\t\t\t\tTargetEnvironment=\"3\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tOptimization=\"0\"\r\n\t\t\t\tPreprocessorDefinitions=\"WINIO_DLL\"\r\n\t\t\t\tMinimalRebuild=\"true\"\r\n\t\t\t\tBasicRuntimeChecks=\"3\"\r\n\t\t\t\tRuntimeLibrary=\"1\"\r\n\t\t\t\tUsePrecompiledHeader=\"0\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"true\"\r\n\t\t\t\tDebugInformationFormat=\"3\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedResourceCompilerTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)\\$(ProjectName)64.dll\"\r\n\t\t\t\tLinkIncremental=\"2\"\r\n\t\t\t\tModuleDefinitionFile=\".\\WinIo.def\"\r\n\t\t\t\tGenerateDebugInformation=\"true\"\r\n\t\t\t\tSubSystem=\"2\"\r\n\t\t\t\tRandomizedBaseAddress=\"1\"\r\n\t\t\t\tDataExecutionPrevention=\"0\"\r\n\t\t\t\tTargetMachine=\"17\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCALinkTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManifestTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXDCMakeTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCBscMakeTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCFxCopTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAppVerifierTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"\r\n\t\t\t/>\r\n\t\t</Configuration>\r\n\t\t<Configuration\r\n\t\t\tName=\"Release|Win32\"\r\n\t\t\tOutputDirectory=\"$(SolutionDir)x86\\$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"x86\\$(ConfigurationName)\"\r\n\t\t\tConfigurationType=\"2\"\r\n\t\t\tCharacterSet=\"1\"\r\n\t\t\tWholeProgramOptimization=\"1\"\r\n\t\t\tBuildLogFile=\"$(IntDir)\\BuildLog.htm\"\r\n\t\t\t>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tPreprocessorDefinitions=\"WINIO_DLL\"\r\n\t\t\t\tRuntimeLibrary=\"0\"\r\n\t\t\t\tUsePrecompiledHeader=\"0\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"true\"\r\n\t\t\t\tDebugInformationFormat=\"3\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedResourceCompilerTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)\\$(ProjectName)32.dll\"\r\n\t\t\t\tLinkIncremental=\"1\"\r\n\t\t\t\tModuleDefinitionFile=\".\\WinIo.def\"\r\n\t\t\t\tGenerateDebugInformation=\"true\"\r\n\t\t\t\tSubSystem=\"2\"\r\n\t\t\t\tOptimizeReferences=\"2\"\r\n\t\t\t\tEnableCOMDATFolding=\"2\"\r\n\t\t\t\tRandomizedBaseAddress=\"1\"\r\n\t\t\t\tDataExecutionPrevention=\"0\"\r\n\t\t\t\tTargetMachine=\"1\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCALinkTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManifestTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXDCMakeTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCBscMakeTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCFxCopTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAppVerifierTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"\r\n\t\t\t/>\r\n\t\t</Configuration>\r\n\t\t<Configuration\r\n\t\t\tName=\"Release|x64\"\r\n\t\t\tOutputDirectory=\"$(SolutionDir)$(PlatformName)\\$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(PlatformName)\\$(ConfigurationName)\"\r\n\t\t\tConfigurationType=\"2\"\r\n\t\t\tCharacterSet=\"1\"\r\n\t\t\tWholeProgramOptimization=\"1\"\r\n\t\t\t>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"\r\n\t\t\t\tTargetEnvironment=\"3\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tPreprocessorDefinitions=\"WINIO_DLL\"\r\n\t\t\t\tRuntimeLibrary=\"0\"\r\n\t\t\t\tUsePrecompiledHeader=\"0\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"true\"\r\n\t\t\t\tDebugInformationFormat=\"3\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedResourceCompilerTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tOutputFile=\"$(OutDir)\\$(ProjectName)64.dll\"\r\n\t\t\t\tLinkIncremental=\"1\"\r\n\t\t\t\tModuleDefinitionFile=\".\\WinIo.def\"\r\n\t\t\t\tGenerateDebugInformation=\"true\"\r\n\t\t\t\tSubSystem=\"2\"\r\n\t\t\t\tOptimizeReferences=\"2\"\r\n\t\t\t\tEnableCOMDATFolding=\"2\"\r\n\t\t\t\tRandomizedBaseAddress=\"1\"\r\n\t\t\t\tDataExecutionPrevention=\"0\"\r\n\t\t\t\tTargetMachine=\"17\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCALinkTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManifestTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXDCMakeTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCBscMakeTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCFxCopTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAppVerifierTool\"\r\n\t\t\t/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"\r\n\t\t\t/>\r\n\t\t</Configuration>\r\n\t</Configurations>\r\n\t<References>\r\n\t</References>\r\n\t<Files>\r\n\t\t<Filter\r\n\t\t\tName=\"Source Files\"\r\n\t\t\tFilter=\"cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx\"\r\n\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\"\r\n\t\t\t>\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\".\\InstDrv.cpp\"\r\n\t\t\t\t>\r\n\t\t\t</File>\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\".\\Phys32.cpp\"\r\n\t\t\t\t>\r\n\t\t\t</File>\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\".\\Port32.cpp\"\r\n\t\t\t\t>\r\n\t\t\t</File>\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\".\\WinIo.cpp\"\r\n\t\t\t\t>\r\n\t\t\t</File>\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\".\\WinIo.def\"\r\n\t\t\t\t>\r\n\t\t\t</File>\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\".\\WinIo.rc\"\r\n\t\t\t\t>\r\n\t\t\t</File>\r\n\t\t</Filter>\r\n\t\t<Filter\r\n\t\t\tName=\"Header Files\"\r\n\t\t\tFilter=\"h;hpp;hxx;hm;inl;inc;xsd\"\r\n\t\t\tUniqueIdentifier=\"{93995380-89BD-4b04-88EB-625FBE52EBFB}\"\r\n\t\t\t>\r\n\t\t</Filter>\r\n\t\t<Filter\r\n\t\t\tName=\"Resource Files\"\r\n\t\t\tFilter=\"rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav\"\r\n\t\t\tUniqueIdentifier=\"{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}\"\r\n\t\t\t>\r\n\t\t</Filter>\r\n\t</Files>\r\n\t<Globals>\r\n\t</Globals>\r\n</VisualStudioProject>\r\n"
  },
  {
    "path": "Source/Dll/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\r\n// Microsoft Developer Studio generated include file.\r\n// Used by WinIo.rc\r\n//\r\n\r\n// Next default values for new objects\r\n// \r\n#ifdef APSTUDIO_INVOKED\r\n#ifndef APSTUDIO_READONLY_SYMBOLS\r\n#define _APS_NEXT_RESOURCE_VALUE        101\r\n#define _APS_NEXT_COMMAND_VALUE         40001\r\n#define _APS_NEXT_CONTROL_VALUE         1000\r\n#define _APS_NEXT_SYMED_VALUE           101\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "Source/Dll/winio.h",
    "content": "#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(dllimport)\r\n#else\r\n#define WINIO_API \r\n#endif\r\n\r\nextern \"C\"\r\n{\r\n  WINIO_API bool _stdcall InitializeWinIo();\r\n  WINIO_API void _stdcall ShutdownWinIo();\r\n  WINIO_API PBYTE _stdcall MapPhysToLin(tagPhysStruct &PhysStruct);\r\n  WINIO_API bool _stdcall UnmapPhysicalMemory(tagPhysStruct &PhysStruct);\r\n  WINIO_API bool _stdcall GetPhysLong(PBYTE pbPhysAddr, PDWORD pdwPhysVal);\r\n  WINIO_API bool _stdcall SetPhysLong(PBYTE pbPhysAddr, DWORD dwPhysVal);\r\n  WINIO_API bool _stdcall GetPortVal(WORD wPortAddr, PDWORD pdwPortVal, BYTE bSize);\r\n  WINIO_API bool _stdcall SetPortVal(WORD wPortAddr, DWORD dwPortVal, BYTE bSize);\r\n  WINIO_API bool _stdcall InstallWinIoDriver(PWSTR pszWinIoDriverPath, bool IsDemandLoaded = false);\r\n  WINIO_API bool _stdcall RemoveWinIoDriver();\r\n}\r\n\r\nextern HANDLE hDriver;\r\nextern bool IsWinIoInitialized;\r\nextern bool g_Is64BitOS;\r\n\r\nbool _stdcall StartWinIoDriver();\r\nbool _stdcall StopWinIoDriver();\r\n\r\n#endif\r\n"
  },
  {
    "path": "Source/Drv/MAKEFILE",
    "content": "#\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 merely indirects to the real make file\r\n# that is shared by all the driver components of the Windows NT DDK\r\n#\r\n\r\n!INCLUDE $(NTMAKEENV)\\makefile.def\r\n"
  },
  {
    "path": "Source/Drv/SOURCES",
    "content": "TARGETNAME=WinIo\r\nTARGETPATH=.\r\nTARGETTYPE=DRIVER\r\nNTDEBUG=ntsd\r\n\r\nSOURCES= winio.c\r\n"
  },
  {
    "path": "Source/Drv/WinIo.c",
    "content": "// ---------------------------------------------------- //\r\n//                      WinIo v3.0                      //\r\n//\t\t\t\t\tDirect Hardware Access for Windows\t//\r\n//           Copyright 1998-2010 Yariv Kaplan           //\r\n//               http://www.internals.com               //\r\n// ---------------------------------------------------- //\r\n\r\n#include <ntddk.h>\r\n#include \"winio_nt.h\"\r\n\r\n#define IOPM_SIZE 0x2000\r\ntypedef char IOPM[IOPM_SIZE];\r\n\r\n// Function definition section\r\n// -----------------------------------------------------------------\r\nNTSTATUS WinIoDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);\r\nvoid WinIoUnload(IN PDRIVER_OBJECT DriverObject);\r\nNTSTATUS UnmapPhysicalMemory(HANDLE PhysicalMemoryHandle, PVOID pPhysMemLin, PVOID PhysSection);\r\nNTSTATUS MapPhysicalMemoryToLinearSpace(PVOID pPhysAddress,\r\n\t\t\t\t\t\t\t\t\t\tSIZE_T PhysMemSizeInBytes,\r\n\t\t\t\t\t\t\t\t\t\tPVOID *ppPhysMemLin,\r\n\t\t\t\t\t\t\t\t\t\tHANDLE *pPhysicalMemoryHandle,\r\n\t\t\t\t\t\t\t\t\t\tPVOID *ppPhysSection);\r\n\r\n#ifndef AMD64\r\nvoid Ke386SetIoAccessMap(int, IOPM *);\r\nvoid Ke386QueryIoAccessMap(int, IOPM *);\r\nvoid Ke386IoSetAccessProcess(PEPROCESS, int);\r\n#endif\r\n\r\n// -----------------------------------------------------------------\r\n\r\n// Installable driver initialization entry point.\r\n// This entry point is called directly by the I/O system.\r\n\r\nNTSTATUS DriverEntry (IN PDRIVER_OBJECT DriverObject,\r\n\t\t\t\t\t  IN PUNICODE_STRING RegistryPath)\r\n{\r\n\tUNICODE_STRING  DeviceNameUnicodeString;\r\n\tUNICODE_STRING  DeviceLinkUnicodeString;\r\n\tNTSTATUS        ntStatus;\r\n\tPDEVICE_OBJECT  DeviceObject = NULL;\r\n\r\n\tKdPrint((\"Entering DriverEntry\"));\r\n\r\n\tRtlInitUnicodeString (&DeviceNameUnicodeString, L\"\\\\Device\\\\WinIo\");\r\n\r\n\t// Create a device object \r\n\r\n\tntStatus = IoCreateDevice (DriverObject,\r\n\t\t0,\r\n\t\t&DeviceNameUnicodeString,\r\n\t\tFILE_DEVICE_WINIO,\r\n\t\t0,\r\n\t\tFALSE,\r\n\t\t&DeviceObject);\r\n\r\n\tif (NT_SUCCESS(ntStatus))\r\n\t{\r\n\t\t// Create dispatch points for device control, create, close.\r\n\r\n\t\tDriverObject->MajorFunction[IRP_MJ_CREATE]\t\t   =\r\n\t\tDriverObject->MajorFunction[IRP_MJ_CLOSE]\t\t   =\r\n\t\tDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = WinIoDispatch;\r\n\t\tDriverObject->DriverUnload                         = WinIoUnload;\r\n\r\n\t\t// Create a symbolic link, e.g. a name that a Win32 app can specify\r\n\t\t// to open the device.\r\n\r\n\t\tRtlInitUnicodeString (&DeviceLinkUnicodeString, L\"\\\\DosDevices\\\\WinIo\");\r\n\r\n\t\tntStatus = IoCreateSymbolicLink (&DeviceLinkUnicodeString,\r\n\t\t\t&DeviceNameUnicodeString);\r\n\r\n\t\tif (!NT_SUCCESS(ntStatus))\r\n\t\t{\r\n\t\t\t// Symbolic link creation failed- note this & then delete the\r\n\t\t\t// device object (it's useless if a Win32 app can't get at it).\r\n\r\n\t\t\tKdPrint((\"ERROR: IoCreateSymbolicLink failed\"));\r\n\r\n\t\t\tIoDeleteDevice (DeviceObject);\r\n\t\t}\r\n\r\n\t}\r\n\telse\r\n\t{\r\n\t\tKdPrint((\"ERROR: IoCreateDevice failed\"));\r\n\t}\r\n\r\n\tKdPrint((\"Leaving DriverEntry\"));\r\n\r\n\treturn ntStatus;\r\n}\r\n\r\n\r\n// Process the IRPs sent to this device\r\n\r\nNTSTATUS WinIoDispatch(IN PDEVICE_OBJECT DeviceObject,\r\n\t\t\t\t\t   IN PIRP Irp)\r\n{\r\n\tPIO_STACK_LOCATION IrpStack;\r\n\tULONG              dwInputBufferLength;\r\n\tULONG              dwOutputBufferLength;\r\n\tULONG              dwIoControlCode;\r\n\tPVOID              pvIOBuffer;\r\n\tNTSTATUS           ntStatus;\r\n\tIOPM*\t\t\t   pIOPM = NULL;\r\n\tstruct             tagPhysStruct PhysStruct;\r\n\tstruct             tagPortStruct PortStruct;\r\n\tstruct             tagPhysStruct32 *pPhysStruct32 = NULL;\r\n\r\n\tKdPrint((\"Entering WinIoDispatch\"));\r\n\r\n\t// Init to default settings\r\n\r\n\tIrp->IoStatus.Status      = STATUS_SUCCESS;\r\n\tIrp->IoStatus.Information = 0;\r\n\r\n\tIrpStack = IoGetCurrentIrpStackLocation(Irp);\r\n\r\n\t// Get the pointer to the input/output buffer and it's length\r\n\r\n\tpvIOBuffer           = Irp->AssociatedIrp.SystemBuffer;\r\n\tdwInputBufferLength  = IrpStack->Parameters.DeviceIoControl.InputBufferLength;\r\n\tdwOutputBufferLength = IrpStack->Parameters.DeviceIoControl.OutputBufferLength;\r\n\r\n\tswitch (IrpStack->MajorFunction)\r\n\t{\r\n\tcase IRP_MJ_CREATE:\r\n\r\n\t\tKdPrint((\"IRP_MJ_CREATE\"));\r\n\r\n\t\tbreak;\r\n\r\n\tcase IRP_MJ_CLOSE:\r\n\r\n\t\tKdPrint((\"IRP_MJ_CLOSE\"));\r\n\r\n\t\tbreak;\r\n\r\n\tcase IRP_MJ_DEVICE_CONTROL:\r\n\r\n\t\tKdPrint((\"IRP_MJ_DEVICE_CONTROL\"));\r\n\r\n\t\tdwIoControlCode = IrpStack->Parameters.DeviceIoControl.IoControlCode;\r\n\r\n\t\tswitch (dwIoControlCode)\r\n\t\t{\r\n\t\t\t// The Ke386 calls are no longer available on x64 Windows\r\n\r\n#ifndef AMD64\r\n\tcase IOCTL_WINIO_ENABLEDIRECTIO:\r\n\r\n\t\tKdPrint((\"IOCTL_WINIO_ENABLEDIRECTIO\"));\r\n\r\n\t\tpIOPM = MmAllocateNonCachedMemory(sizeof(IOPM));\r\n\r\n\t\tif (pIOPM)\r\n\t\t{\r\n\t\t\tRtlZeroMemory(pIOPM, sizeof(IOPM));\r\n\r\n\t\t\tKe386IoSetAccessProcess(PsGetCurrentProcess(), 1);\r\n\t\t\tKe386SetIoAccessMap(1, pIOPM);\r\n\t\t\tIrpStack->FileObject->FsContext2 = pIOPM;\r\n\t\t}\r\n\t\telse\r\n\t\t\tIrp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;\r\n\r\n\t\tbreak;\r\n\r\n\tcase IOCTL_WINIO_DISABLEDIRECTIO:\r\n\r\n\t\tKdPrint((\"IOCTL_WINIO_DISABLEDIRECTIO\"));\r\n\r\n\t\tpIOPM = (IOPM *)IrpStack->FileObject->FsContext2;\r\n\r\n\t\tif (pIOPM)\r\n\t\t{\r\n\t\t\tKe386IoSetAccessProcess(PsGetCurrentProcess(), 0);\r\n\t\t\tKe386SetIoAccessMap(1, pIOPM);\r\n\t\t\tMmFreeNonCachedMemory(pIOPM, sizeof(IOPM));\r\n\t\t}\r\n\r\n\t\tbreak;\r\n#endif\r\n\r\n\tcase IOCTL_WINIO_WRITEPORT:\r\n\r\n\t\tKdPrint((\"IOCTL_WINIO_WRITEPORT\"));\r\n\r\n\t\tif (dwInputBufferLength)\r\n\t\t{\r\n\t\t\tmemcpy (&PortStruct, pvIOBuffer, dwInputBufferLength);\r\n\r\n\t\t\tswitch (PortStruct.bSize)\r\n\t\t\t{\r\n\t\t\tcase 1:\r\n\t\t\t\tWRITE_PORT_UCHAR((PUCHAR)(USHORT)PortStruct.wPortAddr, (UCHAR)PortStruct.dwPortVal);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 2:\r\n\t\t\t\tWRITE_PORT_USHORT((PUSHORT)(USHORT)PortStruct.wPortAddr, (USHORT)PortStruct.dwPortVal);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 4:\r\n\t\t\t\tWRITE_PORT_ULONG((PULONG)(USHORT)PortStruct.wPortAddr, PortStruct.dwPortVal);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t\tIrp->IoStatus.Status = STATUS_INVALID_PARAMETER;\r\n\r\n\t\tbreak;\r\n\r\n\tcase IOCTL_WINIO_READPORT:\r\n\r\n\t\tKdPrint((\"IOCTL_WINIO_READPORT\"));\r\n\r\n\t\tif (dwInputBufferLength)\r\n\t\t{\r\n\t\t\tmemcpy (&PortStruct, pvIOBuffer, dwInputBufferLength);\r\n\r\n\t\t\tswitch (PortStruct.bSize)\r\n\t\t\t{\r\n\t\t\tcase 1:\r\n\t\t\t\tPortStruct.dwPortVal = (ULONG)READ_PORT_UCHAR((PUCHAR)(USHORT)PortStruct.wPortAddr);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 2:\r\n\t\t\t\tPortStruct.dwPortVal = (ULONG)READ_PORT_USHORT((PUSHORT)(USHORT)PortStruct.wPortAddr);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 4:\r\n\t\t\t\tPortStruct.dwPortVal = READ_PORT_ULONG((PULONG)(USHORT)PortStruct.wPortAddr);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tmemcpy (pvIOBuffer, &PortStruct.dwPortVal, sizeof(PortStruct.dwPortVal));\r\n\t\t\tIrp->IoStatus.Information = sizeof(PortStruct.dwPortVal);\r\n\t\t}\r\n\t\telse\r\n\t\t\tIrp->IoStatus.Status = STATUS_INVALID_PARAMETER;\r\n\r\n\t\tbreak;\r\n\r\n\tcase IOCTL_WINIO_MAPPHYSTOLIN:\r\n\r\n\t\tKdPrint((\"IOCTL_WINIO_MAPPHYSTOLIN\"));\r\n\r\n\t\tif (dwInputBufferLength)\r\n\t\t{\r\n\t\t\tmemcpy (&PhysStruct, pvIOBuffer, dwInputBufferLength);\r\n\r\n\t\t\tntStatus = MapPhysicalMemoryToLinearSpace((PVOID)PhysStruct.pvPhysAddress,\r\n\t\t\t\t(SIZE_T)PhysStruct.dwPhysMemSizeInBytes,\r\n\t\t\t\t(PVOID *)&PhysStruct.pvPhysMemLin,\r\n\t\t\t\t(HANDLE *)&PhysStruct.PhysicalMemoryHandle,\r\n\t\t\t\t(PVOID *)&PhysStruct.pvPhysSection);\r\n\r\n\t\t\tif (NT_SUCCESS(ntStatus))\r\n\t\t\t{\r\n\t\t\t\tmemcpy (pvIOBuffer, &PhysStruct, dwInputBufferLength);\r\n\t\t\t\tIrp->IoStatus.Information = dwInputBufferLength;\r\n\t\t\t}\r\n\r\n\t\t\tIrp->IoStatus.Status = ntStatus;\r\n\t\t}\r\n\t\telse\r\n\t\t\tIrp->IoStatus.Status = STATUS_INVALID_PARAMETER;\r\n\r\n\t\tbreak;\r\n\r\n\tcase IOCTL_WINIO_UNMAPPHYSADDR:\r\n\r\n\t\tKdPrint((\"IOCTL_WINIO_UNMAPPHYSADDR\"));\r\n\r\n\t\tif (dwInputBufferLength)\r\n\t\t{\r\n\t\t\tmemcpy (&PhysStruct, pvIOBuffer, dwInputBufferLength);\r\n\r\n\t\t\tntStatus = UnmapPhysicalMemory((HANDLE)PhysStruct.PhysicalMemoryHandle, (PVOID)PhysStruct.pvPhysMemLin, (PVOID)PhysStruct.pvPhysSection);\r\n\r\n\t\t\tIrp->IoStatus.Status = ntStatus;\r\n\t\t}\r\n\t\telse\r\n\t\t\tIrp->IoStatus.Status = STATUS_INVALID_PARAMETER;\r\n\r\n\t\tbreak;\r\n\r\n\tdefault:\r\n\r\n\t\tKdPrint((\"ERROR: Unknown IRP_MJ_DEVICE_CONTROL\"));\r\n\r\n\t\tIrp->IoStatus.Status = STATUS_INVALID_PARAMETER;\r\n\r\n\t\tbreak;\r\n\t\t}\r\n\r\n\t\tbreak;\r\n\t}\r\n\r\n\t// DON'T get cute and try to use the status field of the irp in the\r\n\t// return status.  That IRP IS GONE as soon as you call IoCompleteRequest.\r\n\r\n\tntStatus = Irp->IoStatus.Status;\r\n\r\n\tIoCompleteRequest (Irp, IO_NO_INCREMENT);\r\n\r\n\t// We never have pending operation so always return the status code.\r\n\r\n\tKdPrint((\"Leaving WinIoDispatch\"));\r\n\r\n\treturn ntStatus;\r\n}\r\n\r\n// Delete the associated device and return\r\n\r\nvoid WinIoUnload(IN PDRIVER_OBJECT DriverObject)\r\n{\r\n\tUNICODE_STRING DeviceLinkUnicodeString;\r\n\tNTSTATUS ntStatus;\r\n\r\n\tKdPrint((\"Entering WinIoUnload\"));\r\n\r\n\tRtlInitUnicodeString (&DeviceLinkUnicodeString, L\"\\\\DosDevices\\\\WinIo\");\r\n\r\n\tntStatus = IoDeleteSymbolicLink (&DeviceLinkUnicodeString);\r\n\r\n\tif (NT_SUCCESS(ntStatus))\r\n\t{\r\n\t\tIoDeleteDevice (DriverObject->DeviceObject);\r\n\t}\r\n\telse\r\n\t{\r\n\t\tKdPrint((\"ERROR: IoDeleteSymbolicLink\"));\r\n\t}\r\n\r\n\tKdPrint((\"Leaving WinIoUnload\"));\r\n}\r\n\r\n\r\nNTSTATUS MapPhysicalMemoryToLinearSpace(PVOID pPhysAddress,\r\n\t\t\t\t\t\t\t\t\t\tSIZE_T PhysMemSizeInBytes,\r\n\t\t\t\t\t\t\t\t\t\tPVOID *ppPhysMemLin,\r\n\t\t\t\t\t\t\t\t\t\tHANDLE *pPhysicalMemoryHandle,\r\n\t\t\t\t\t\t\t\t\t\tPVOID *ppPhysSection)\r\n{\r\n\tUNICODE_STRING     PhysicalMemoryUnicodeString;\r\n\tOBJECT_ATTRIBUTES  ObjectAttributes;\r\n\tPHYSICAL_ADDRESS   ViewBase;\r\n\tNTSTATUS           ntStatus;\r\n\tPHYSICAL_ADDRESS   pStartPhysAddress;\r\n\tPHYSICAL_ADDRESS   pEndPhysAddress;\r\n\tBOOLEAN            Result1, Result2;\r\n\tULONG              IsIOSpace;\r\n\tunsigned char     *pbPhysMemLin = NULL;\r\n\r\n\tKdPrint((\"Entering MapPhysicalMemoryToLinearSpace\"));\r\n\r\n\tRtlInitUnicodeString (&PhysicalMemoryUnicodeString, L\"\\\\Device\\\\PhysicalMemory\");\r\n\r\n\tInitializeObjectAttributes (&ObjectAttributes,\r\n\t\t&PhysicalMemoryUnicodeString,\r\n\t\tOBJ_CASE_INSENSITIVE,\r\n\t\t(HANDLE) NULL,\r\n\t\t(PSECURITY_DESCRIPTOR) NULL);\r\n\r\n\t*pPhysicalMemoryHandle = NULL;\r\n\t*ppPhysSection = NULL;\r\n\r\n\tntStatus = ZwOpenSection (pPhysicalMemoryHandle, SECTION_ALL_ACCESS, &ObjectAttributes);\r\n\r\n\tif (NT_SUCCESS(ntStatus))\r\n\t{\r\n\r\n\t\tntStatus = ObReferenceObjectByHandle (*pPhysicalMemoryHandle,\r\n\t\t\tSECTION_ALL_ACCESS,\r\n\t\t\t(POBJECT_TYPE) NULL,\r\n\t\t\tKernelMode,\r\n\t\t\tppPhysSection,\r\n\t\t\t(POBJECT_HANDLE_INFORMATION) NULL);\r\n\r\n\t\tif (NT_SUCCESS(ntStatus))\r\n\t\t{\r\n\t\t\tpStartPhysAddress.QuadPart = (ULONGLONG)(ULONG_PTR)pPhysAddress;\r\n\r\n\t\t\tpEndPhysAddress.QuadPart = pStartPhysAddress.QuadPart + PhysMemSizeInBytes;\r\n\r\n\t\t\tIsIOSpace = 0;\r\n\r\n\t\t\tResult1 = HalTranslateBusAddress (1, 0, pStartPhysAddress, &IsIOSpace, &pStartPhysAddress);\r\n\r\n\t\t\tIsIOSpace = 0;\r\n\r\n\t\t\tResult2 = HalTranslateBusAddress (1, 0, pEndPhysAddress, &IsIOSpace, &pEndPhysAddress);\r\n\r\n\t\t\tif (Result1 && Result2)\r\n\t\t\t{\r\n\t\t\t\t// Let ZwMapViewOfSection pick a linear address\r\n\r\n\t\t\t\tPhysMemSizeInBytes = (SIZE_T)pEndPhysAddress.QuadPart - (SIZE_T)pStartPhysAddress.QuadPart;\r\n\r\n\t\t\t\tViewBase = pStartPhysAddress;\r\n\r\n\t\t\t\tntStatus = ZwMapViewOfSection (*pPhysicalMemoryHandle,\r\n\t\t\t\t\t(HANDLE) -1,\r\n\t\t\t\t\t&pbPhysMemLin,\r\n\t\t\t\t\t0L,\r\n\t\t\t\t\tPhysMemSizeInBytes,\r\n\t\t\t\t\t&ViewBase,\r\n\t\t\t\t\t&PhysMemSizeInBytes,\r\n\t\t\t\t\tViewShare,\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tPAGE_READWRITE | PAGE_NOCACHE);\r\n\r\n\t\t\t\t// If the physical memory is already mapped with a different caching attribute, try again\r\n\t\t\t\tif (ntStatus == STATUS_CONFLICTING_ADDRESSES)\r\n\t\t\t\t{\r\n\t\t\t\t\tntStatus = ZwMapViewOfSection (*pPhysicalMemoryHandle,\r\n\t\t\t\t\t\t(HANDLE) -1,\r\n\t\t\t\t\t\t&pbPhysMemLin,\r\n\t\t\t\t\t\t0L,\r\n\t\t\t\t\t\tPhysMemSizeInBytes,\r\n\t\t\t\t\t\t&ViewBase,\r\n\t\t\t\t\t\t&PhysMemSizeInBytes,\r\n\t\t\t\t\t\tViewShare,\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tPAGE_READWRITE);\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t\tif (!NT_SUCCESS(ntStatus))\r\n\t\t\t\t\tKdPrint((\"ERROR: ZwMapViewOfSection failed\"));\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tpbPhysMemLin += pStartPhysAddress.QuadPart - ViewBase.QuadPart;\r\n\t\t\t\t\t*ppPhysMemLin = pbPhysMemLin;\r\n\t\t\t\t}  \r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\tKdPrint((\"ERROR: HalTranslateBusAddress failed\"));\r\n\t\t}\r\n\t\telse\r\n\t\t\tKdPrint((\"ERROR: ObReferenceObjectByHandle failed\"));\r\n\t}\r\n\telse\r\n\t\tKdPrint((\"ERROR: ZwOpenSection failed\"));\r\n\r\n\tif (!NT_SUCCESS(ntStatus))\r\n\t\tZwClose(*pPhysicalMemoryHandle);\r\n\r\n\tKdPrint((\"Leaving MapPhysicalMemoryToLinearSpace\"));\r\n\r\n\treturn ntStatus;\r\n}\r\n\r\n\r\nNTSTATUS UnmapPhysicalMemory(HANDLE PhysicalMemoryHandle, PVOID pPhysMemLin, PVOID pPhysSection)\r\n{\r\n\tNTSTATUS ntStatus;\r\n\r\n\tKdPrint((\"Entering UnmapPhysicalMemory\"));\r\n\r\n\tntStatus = ZwUnmapViewOfSection((HANDLE)-1, pPhysMemLin);\r\n\r\n\tif (!NT_SUCCESS(ntStatus))\r\n\t\tKdPrint((\"ERROR: UnmapViewOfSection failed\"));\r\n\r\n\tif (pPhysSection)\r\n\t\tObDereferenceObject(pPhysSection);\r\n\r\n\tZwClose(PhysicalMemoryHandle);\r\n\r\n\tKdPrint((\"Leaving UnmapPhysicalMemory\"));\r\n\r\n\treturn ntStatus;\r\n}\r\n"
  },
  {
    "path": "Source/Drv/winio_nt.h",
    "content": "#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// Corporation are in the range 0-32767, and 32768-65535 are reserved for use\r\n// by customers.\r\n\r\n#define FILE_DEVICE_WINIO 0x00008010\r\n\r\n// Macro definition for defining IOCTL and FSCTL function control codes.\r\n// Note that function codes 0-2047 are reserved for Microsoft Corporation,\r\n// and 2048-4095 are reserved for customers.\r\n\r\n#define WINIO_IOCTL_INDEX 0x810\r\n\r\n// Define our own private IOCTL\r\n\r\n#define IOCTL_WINIO_MAPPHYSTOLIN     CTL_CODE(FILE_DEVICE_WINIO,  \\\r\n\tWINIO_IOCTL_INDEX,      \\\r\n\tMETHOD_BUFFERED,        \\\r\n\tFILE_ANY_ACCESS)\r\n\r\n#define IOCTL_WINIO_UNMAPPHYSADDR    CTL_CODE(FILE_DEVICE_WINIO,  \\\r\n\tWINIO_IOCTL_INDEX + 1,  \\\r\n\tMETHOD_BUFFERED,        \\\r\n\tFILE_ANY_ACCESS)\r\n\r\n#define IOCTL_WINIO_ENABLEDIRECTIO   CTL_CODE(FILE_DEVICE_WINIO,  \\\r\n\tWINIO_IOCTL_INDEX + 2,   \\\r\n\tMETHOD_BUFFERED,         \\\r\n\tFILE_ANY_ACCESS)\r\n\r\n#define IOCTL_WINIO_DISABLEDIRECTIO  CTL_CODE(FILE_DEVICE_WINIO,  \\\r\n\tWINIO_IOCTL_INDEX + 3,   \\\r\n\tMETHOD_BUFFERED,         \\\r\n\tFILE_ANY_ACCESS)\r\n\r\n#define IOCTL_WINIO_READPORT\t\t CTL_CODE(FILE_DEVICE_WINIO,  \\\r\n\tWINIO_IOCTL_INDEX + 4,   \\\r\n\tMETHOD_BUFFERED,         \\\r\n\tFILE_ANY_ACCESS)\r\n\r\n#define IOCTL_WINIO_WRITEPORT\t\t CTL_CODE(FILE_DEVICE_WINIO,  \\\r\n\tWINIO_IOCTL_INDEX + 5,   \\\r\n\tMETHOD_BUFFERED,         \\\r\n\tFILE_ANY_ACCESS)\r\n\r\n#pragma pack(push)\r\n#pragma pack(1)\r\n\r\nstruct tagPhysStruct\r\n{\r\n\tDWORD64 dwPhysMemSizeInBytes;\r\n\tDWORD64 pvPhysAddress;\r\n\tDWORD64 PhysicalMemoryHandle;\r\n\tDWORD64 pvPhysMemLin;\r\n\tDWORD64 pvPhysSection;\r\n};\r\n\r\nstruct tagPortStruct\r\n{\r\n\tUSHORT wPortAddr;\r\n\tULONG dwPortVal;\r\n\tUCHAR bSize;\r\n};\r\n\r\n#pragma pack(pop)\r\n\r\n#endif\r\n"
  }
]