├── .gitattributes ├── .gitignore ├── README.md ├── code ├── Package │ ├── package.VcxProj │ ├── package.VcxProj.Filters │ └── package.VcxProj.user ├── installer │ ├── ApplicationForDrivers1.aps │ ├── Readme.htm │ ├── TapInstall.h │ ├── TapInstall.vcxproj │ ├── TapInstall.vcxproj.filters │ ├── TapInstall.vcxproj.user │ ├── netcfgapi.cpp │ ├── netcfgapi.h │ ├── resource.h │ ├── stdafx.cpp │ ├── stdafx.h │ ├── tapinstall.cpp │ └── tapinstall.rc ├── sys │ ├── 60 │ │ ├── ndisprot60.vcxproj │ │ ├── ndisprot60.vcxproj.Filters │ │ ├── ndisprot60.vcxproj.user │ │ ├── precompsrc.c │ │ ├── wtapdrv.inf │ │ └── wtapdrv.rc │ ├── 630 │ │ ├── ndisprot630.vcxproj │ │ ├── ndisprot630.vcxproj.Filters │ │ ├── ndisprot630.vcxproj.user │ │ ├── precompsrc.c │ │ ├── wtapdrv630.inf │ │ └── wtapdrv630.rc │ ├── debug.c │ ├── debug.h │ ├── excallbk.c │ ├── macros.h │ ├── ndisbind.c │ ├── ndisprot.h │ ├── ntdisp.c │ ├── precomp.h │ ├── protuser.h │ ├── recv.c │ └── send.c ├── test │ ├── prottest.c │ ├── prottest.vcxproj │ ├── prottest.vcxproj.Filters │ └── prottest.vcxproj.user ├── wintap.htm ├── wintap.sln ├── wintap.v11.suo ├── wintap │ ├── wintap.c │ ├── wintap.vcxproj │ ├── wintap.vcxproj.Filters │ └── wintap.vcxproj.user └── x64 │ └── VistaDebug │ ├── package.cer │ ├── prottest.exe │ ├── setup.exe │ ├── setup.pdb │ ├── wintap.exe │ ├── wintap.pdb │ ├── wtapdrv.cat │ ├── wtapdrv.inf │ ├── wtapdrv.pdb │ └── wtapdrv.sys ├── description.html └── description ├── 84ada392-ed9e-43d3-9c3e-f99f948be6cbBrand.css ├── Brand.css ├── Combined.css ├── Galleries.css ├── Layout.css ├── d0a480a2-d1c4-4159-af59-5aa4abd59cb0Combined.css ├── iframedescription.css ├── offline.js └── wiretap.jpg /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | 38 | # Directories potentially created on remote AFP share 39 | .AppleDB 40 | .AppleDesktop 41 | Network Trash Folder 42 | Temporary Items 43 | .apdisk 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | To be clear - this is a proof of concept project from 2013. It is not maintained and has not been tested in a very long time. 2 | 3 | ------------------------- 4 | 5 | WinTap is a packet sniffer and soft-tap developed to mirror packets flowing through an Ethernet interface. It is purely based on the NDIS which allows us to sniff packets and rewrite them to a second interface acting as a soft-tap. WinTap consists of two components, 6 | 7 | 1. NDIS 6.0 based protocol driver. 8 | 2. User mode soft-tap. 9 | 10 | These two act in tandem to create a soft-tap, where the protocol driver sniffs the traffic and delivers to the user mode application. User mode application does the redirection logic and returns the packets to be rewritten to second interface. 11 | 12 | Please read the description.html for more details. 13 | -------------------------------------------------------------------------------- /code/Package/package.VcxProj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Win8 Debug 6 | Win32 7 | 8 | 9 | Win8 Release 10 | Win32 11 | 12 | 13 | Win7 Debug 14 | Win32 15 | 16 | 17 | Win7 Release 18 | Win32 19 | 20 | 21 | Vista Debug 22 | Win32 23 | 24 | 25 | Vista Release 26 | Win32 27 | 28 | 29 | Win8 Debug 30 | x64 31 | 32 | 33 | Win8 Release 34 | x64 35 | 36 | 37 | Win7 Debug 38 | x64 39 | 40 | 41 | Win7 Release 42 | x64 43 | 44 | 45 | Vista Debug 46 | x64 47 | 48 | 49 | Vista Release 50 | x64 51 | 52 | 53 | 54 | WindowsKernelModeDriver8.0 55 | Utility 56 | Package 57 | true 58 | Win8 Debug 59 | 60 | 61 | $(VCTargetsPath11) 62 | 63 | 64 | 65 | {DD1E0781-2BAE-498B-9993-C0B54A3C30C1} 66 | {1A7EF6D1-66EB-4C0C-8A92-581B8AC97100} 67 | $(MSBuildProjectName) 68 | 69 | 70 | Windows8 71 | true 72 | 73 | 74 | Windows8 75 | false 76 | 77 | 78 | Windows7 79 | true 80 | 81 | 82 | Windows7 83 | false 84 | 85 | 86 | Vista 87 | true 88 | 89 | 90 | Vista 91 | false 92 | 93 | 94 | Windows8 95 | true 96 | 97 | 98 | Windows8 99 | false 100 | 101 | 102 | Windows7 103 | true 104 | 105 | 106 | Windows7 107 | false 108 | 109 | 110 | Vista 111 | true 112 | 113 | 114 | Vista 115 | false 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | DbgengKernelDebugger 127 | False 128 | False 129 | None 130 | 131 | 132 | 133 | 134 | 135 | %PathToInf% 136 | False 137 | False 138 | True 139 | 140 | 133563 141 | $(OutDir) 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | {92e567c1-ef36-496e-b86d-eb8d0e5d9ea1} 160 | 161 | 162 | {103384f3-2df5-4366-b5f6-ba75d5fc701f} 163 | 164 | 165 | {4aaaab44-4c4e-413c-a916-b87dae084fc1} 166 | 167 | 168 | 169 | 170 | 171 | -------------------------------------------------------------------------------- /code/Package/package.VcxProj.Filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | {841B5871-7215-47E6-B784-AC3E36ACCBC2} 7 | 8 | 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | {90E50036-7BAB-4E83-A0E0-8BD2F798B380} 11 | 12 | 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 14 | {45825571-F6F8-43C6-9B7D-3B6496F4A36B} 15 | 16 | 17 | inf;inv;inx;mof;mc; 18 | {30327BE0-07B3-4ED0-8588-CC23045D4073} 19 | 20 | 21 | -------------------------------------------------------------------------------- /code/Package/package.VcxProj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | CN="WDKTestCert Admin,130117326078655508" | BDF15746B4587E8CC40E621743B4529CB10C9CD1 5 | 6 | 7 | CN="WDKTestCert Admin,130117326078655508" | BDF15746B4587E8CC40E621743B4529CB10C9CD1 8 | False 9 | False 10 | None 11 | 12 | 13 | C:\Program Files (x86)\Windows Kits\8.0\Testing\Tests\DefaultDriverPackageInstallationTask\DefaultDriverPackageInstallationTask.dll 14 | w2k8vm 15 | w2k8vm 16 | 17 | Microsoft.DriverKit.DefaultDriverPackageInstallationClass.PerformDefaultDriverPackageInstallation 18 | %PathToInf% 19 | False 20 | 21 | -------------------------------------------------------------------------------- /code/installer/ApplicationForDrivers1.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/code/installer/ApplicationForDrivers1.aps -------------------------------------------------------------------------------- /code/installer/Readme.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/code/installer/Readme.htm -------------------------------------------------------------------------------- /code/installer/TapInstall.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2015, Defensive Depth (Defensivedepth.com) 3 | * 4 | * All rights reserved. 5 | * 6 | * This file is part of WinTAP. 7 | * WinTAP is dual-licensed under the MIT License http://opensource.org/licenses/MIT, 8 | * as well as the GNU General Public License, version 3. 9 | * 10 | * GPL 3: 11 | * WinTAP is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * WinTAP is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with WinTAP. If not, see . 23 | * 24 | * 25 | */ 26 | 27 | #ifndef _PROTINSTALL_H_ 28 | #define _PROTINSTALL_H_ 29 | 30 | //////////////////////////////////////////////////////////////////////////// 31 | //// Device Naming String Definitions 32 | // 33 | 34 | // 35 | // "Friendly" Name 36 | // 37 | #define NDISPROT_FRIENDLY_NAME_A "WinTap Protocol Driver" 38 | #define NDISPROT_FRIENDLY_NAME_W L"WinTap Protocol Driver" 39 | 40 | #ifdef UNICODE 41 | #define NDISPROT_FRIENDLY_NAME NDISPROT_FRIENDLY_NAME_W 42 | #else 43 | #define NDISPROT_FRIENDLY_NAME NDISPROT_FRIENDLY_NAME_A 44 | #endif 45 | 46 | // 47 | // Protocol Name 48 | // ------------- 49 | // This is the name of the protocol, and is a parameter passed to 50 | // NdisRegisterProtocol(). 51 | // 52 | #define NDISPROT_PROTOCOL_NAME_W L"WINTAP" 53 | #define NDISPROT_PROTOCOL_NAME_A "WINTAP" 54 | 55 | #ifdef UNICODE 56 | #define NDISPROT_PROTOCOL_NAME NDISPROT_PROTOCOL_NAME_W 57 | #else 58 | #define NDISPROT_PROTOCOL_NAME NDISPROT_PROTOCOL_NAME_A 59 | #endif 60 | 61 | // 62 | // Driver WDM Device Object Name 63 | // ----------------------------- 64 | // This is the name of the NDISPROT driver WDM device object. 65 | // 66 | #define NDISPROT_WDM_DEVICE_NAME_W L"\\Device\\WINTAP" 67 | #define NDISPROT_WDM_DEVICE_NAME_A "\\Device\\WINTAP" 68 | 69 | #ifdef UNICODE 70 | #define NDISPROT_WDM_DEVICE_NAME NDISPROT_WDM_DEVICE_NAME_W 71 | #else 72 | #define NDISPROT_WDM_DEVICE_NAME NDISPROT_WDM_DEVICE_NAME_A 73 | #endif 74 | 75 | // 76 | // Driver Device WDM Symbolic Link 77 | // ------------------------------- 78 | // This is the name of the NDISPROT driver device WDM symbolic link. This 79 | // is a user-visible name that can be used by Win32 applications to access 80 | // the NDISPROT driver WDM interface. 81 | // 82 | #define NDISPROT_WDM_SYMBOLIC_LINK_W L"\\DosDevices\\WINTAP" 83 | #define NDISPROT_WDM_SYMBOLIC_LINK_A "\\DosDevices\\WINTAP" 84 | 85 | #ifdef UNICODE 86 | #define NDISPROT_WDM_SYMBOLIC_LINK NDISPROT_WDM_SYMBOLIC_LINK_W 87 | #else 88 | #define NDISPROT_WDM_SYMBOLIC_LINK NDISPROT_WDM_SYMBOLIC_LINK_A 89 | #endif 90 | 91 | // 92 | // Driver WDM Device Filename 93 | // -------------------------- 94 | // This is the name that Win32 applications pass to CreateFile to open 95 | // the TPA-REDIR symbolic link. 96 | // 97 | #define NDISPROT_WDM_DEVICE_FILENAME_W L"\\\\.\\WINTAP" 98 | #define NDISPROT_WDM_DEVICE_FILENAME_A "\\\\.\\WINTAP" 99 | 100 | #ifdef UNICODE 101 | #define NDISPROT_WDM_DEVICE_FILENAME NDISPROT_WDM_DEVICE_FILENAME_W 102 | #else 103 | #define NDISPROT_WDM_DEVICE_FILENAME NDISPROT_WDM_DEVICE_FILENAME_A 104 | #endif 105 | 106 | // 107 | // Driver INF File and PnP ID Names 108 | // 109 | #define NDISPROT_SERVICE_PNP_DEVICE_ID_A "WINTAP_TAPROTO" 110 | #define NDISPROT_SERVICE_PNP_DEVICE_ID_W L"WINTAP_TAPROTO" 111 | 112 | #define NDISPROT_SERVICE_INF_FILE_A "WTAPDRV" 113 | #define NDISPROT_SERVICE_INF_FILE_W L"WTAPDRV" 114 | 115 | #ifdef UNICODE 116 | #define NDISPROT_SERVICE_PNP_DEVICE_ID NDISPROT_SERVICE_PNP_DEVICE_ID_W 117 | #define NDISPROT_SERVICE_INF_FILE NDISPROT_SERVICE_INF_FILE_W 118 | #else 119 | #define NDISPROT_SERVICE_PNP_DEVICE_ID NDISPROT_SERVICE_PNP_DEVICE_ID_A 120 | #define NDISPROT_SERVICE_INF_FILE NDISPROT_SERVICE_INF_FILE_A 121 | #endif 122 | 123 | ///////////////////////////////////////////////////////////////////////////// 124 | //// Registry Path Strings 125 | // 126 | 127 | #define NDISPROT_REGSTR_PATH_PARAMETERS_W L"WINTAP\\Parameters" 128 | #define NDISPROT_REGSTR_PATH_PARAMETERS_A "WINTAP\\Parameters" 129 | 130 | #ifdef UNICODE 131 | #define NDISPROT_REGSTR_PATH_PARAMETERS NDISPROT_REGSTR_PATH_PARAMETERS_W 132 | #else 133 | #define NDISPROT_REGSTR_PATH_PARAMETERS NDISPROT_REGSTR_PATH_PARAMETERS_A 134 | #endif 135 | 136 | 137 | ///////////////////////////////////////////////////////////////////////////// 138 | //// Registry Key Strings 139 | // 140 | 141 | #define NDISPROT_REGSTR_KEY_PARAMETERS_W L"Parameters" 142 | #define NDISPROT_REGSTR_KEY_PARAMETERS_A "Parameters" 143 | 144 | #ifdef UNICODE 145 | #define NDISPROT_REGSTR_KEY_PARAMETERS NDISPROT_REGSTR_KEY_PARAMETERS_W 146 | #else 147 | #define NDISPROT_REGSTR_KEY_PARAMETERS NDISPROT_REGSTR_KEY_PARAMETERS_A 148 | #endif 149 | 150 | #endif // _PROTINSTALL_H_ 151 | -------------------------------------------------------------------------------- /code/installer/TapInstall.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Win8 Debug 6 | Win32 7 | 8 | 9 | Win8 Release 10 | Win32 11 | 12 | 13 | Win7 Debug 14 | Win32 15 | 16 | 17 | Win7 Release 18 | Win32 19 | 20 | 21 | Vista Debug 22 | Win32 23 | 24 | 25 | Vista Release 26 | Win32 27 | 28 | 29 | Win8 Debug 30 | x64 31 | 32 | 33 | Win8 Release 34 | x64 35 | 36 | 37 | Win7 Debug 38 | x64 39 | 40 | 41 | Win7 Release 42 | x64 43 | 44 | 45 | Vista Debug 46 | x64 47 | 48 | 49 | Vista Release 50 | x64 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | {0408E75F-D236-4E40-AD43-88BD39C9DF3A} 69 | {504102d4-2172-473c-8adf-cd96e308f257} 70 | v4.5 71 | 11.0 72 | Win8 Debug 73 | Win32 74 | 75 | 76 | WinTap 77 | $(VCTargetsPath11) 78 | setup 79 | 80 | 81 | WindowsApplicationForDrivers8.0 82 | Application 83 | 84 | 85 | 86 | Windows8 87 | true 88 | 89 | 90 | Windows8 91 | false 92 | 93 | 94 | Windows7 95 | true 96 | 97 | 98 | Windows7 99 | false 100 | 101 | 102 | Vista 103 | true 104 | 105 | 106 | Vista 107 | false 108 | 109 | 110 | Windows8 111 | true 112 | 113 | 114 | Windows8 115 | false 116 | 117 | 118 | Windows7 119 | true 120 | 121 | 122 | Windows7 123 | false 124 | 125 | 126 | Vista 127 | true 128 | 129 | 130 | Vista 131 | false 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | false 142 | 143 | 144 | false 145 | $(SolutionDir)$(Platform)\$(ConfigurationName)\ 146 | 147 | 148 | 149 | setupapi.lib;%(AdditionalDependencies) 150 | RequireAdministrator 151 | 152 | 153 | WIN32;_DEBUG;_CONSOLE;_X86_=1;i386=1;STD_CALL;UNICODE;_UNICODE;%(PreprocessorDefinitions) 154 | StdCall 155 | false 156 | 157 | 158 | 159 | 160 | _WIN64;_AMD64_;AMD64;UNICODE;_UNICODE;%(PreprocessorDefinitions) 161 | StdCall 162 | false 163 | 164 | 165 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;setupapi.lib;%(AdditionalDependencies) 166 | RequireAdministrator 167 | 168 | 169 | 170 | 171 | 172 | -------------------------------------------------------------------------------- /code/installer/TapInstall.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | 29 | 30 | Header Files 31 | 32 | 33 | Header Files 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | 43 | 44 | Resource Files 45 | 46 | 47 | -------------------------------------------------------------------------------- /code/installer/TapInstall.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | /install 5 | 6 | 7 | WindowsLocalDebugger 8 | 9 | -------------------------------------------------------------------------------- /code/installer/netcfgapi.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2015, Defensive Depth (Defensivedepth.com) 3 | * 4 | * All rights reserved. 5 | * 6 | * This file is part of WinTAP. 7 | * WinTAP is dual-licensed under the MIT License http://opensource.org/licenses/MIT, 8 | * as well as the GNU General Public License, version 3. 9 | * 10 | * GPL 3: 11 | * WinTAP is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * WinTAP is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with WinTAP. If not, see . 23 | * 24 | * 25 | */ 26 | 27 | #include "stdafx.h" 28 | #include "NetCfgAPI.h" 29 | 30 | HRESULT HrGetINetCfg ( 31 | IN BOOL fGetWriteLock, 32 | IN LPCTSTR lpszAppName, 33 | OUT INetCfg** ppnc, 34 | OUT LPTSTR *lpszLockedBy 35 | ) 36 | { 37 | INetCfg *pnc = NULL; 38 | INetCfgLock *pncLock = NULL; 39 | HRESULT hr = S_OK; 40 | 41 | // 42 | // Initialize the output parameters. 43 | // 44 | 45 | *ppnc = NULL; 46 | 47 | if ( lpszLockedBy ) 48 | { 49 | *lpszLockedBy = NULL; 50 | } 51 | // 52 | // Initialize COM 53 | // 54 | 55 | hr = CoInitialize( NULL ); 56 | 57 | if ( hr == S_OK ) { 58 | 59 | // 60 | // Create the object implementing INetCfg. 61 | // 62 | 63 | hr = CoCreateInstance( CLSID_CNetCfg, 64 | NULL, CLSCTX_INPROC_SERVER, 65 | IID_INetCfg, 66 | (void**)&pnc ); 67 | if ( hr == S_OK ) { 68 | 69 | if ( fGetWriteLock ) { 70 | 71 | // 72 | // Get the locking reference 73 | // 74 | 75 | hr = pnc->QueryInterface( IID_INetCfgLock, (LPVOID *)&pncLock ); 76 | if ( hr == S_OK ) { 77 | 78 | // 79 | // Attempt to lock the INetCfg for read/write 80 | // 81 | 82 | hr = pncLock->AcquireWriteLock( LOCK_TIME_OUT, 83 | lpszAppName, 84 | lpszLockedBy); 85 | if (hr == S_FALSE ) { 86 | hr = NETCFG_E_NO_WRITE_LOCK; 87 | } 88 | } 89 | } 90 | 91 | if ( hr == S_OK ) { 92 | 93 | // 94 | // Initialize the INetCfg object. 95 | // 96 | 97 | hr = pnc->Initialize( NULL ); 98 | 99 | if ( hr == S_OK ) { 100 | *ppnc = pnc; 101 | pnc->AddRef(); 102 | } 103 | else { 104 | 105 | // 106 | // Initialize failed, if obtained lock, release it 107 | // 108 | 109 | if ( pncLock ) { 110 | pncLock->ReleaseWriteLock(); 111 | } 112 | } 113 | } 114 | 115 | ReleaseRef( pncLock ); 116 | ReleaseRef( pnc ); 117 | } 118 | 119 | // 120 | // In case of error, uninitialize COM. 121 | // 122 | 123 | if ( hr != S_OK ) { 124 | CoUninitialize(); 125 | } 126 | } 127 | 128 | return hr; 129 | } 130 | 131 | HRESULT HrReleaseINetCfg ( 132 | IN INetCfg* pnc, 133 | IN BOOL fHasWriteLock 134 | ) 135 | { 136 | INetCfgLock *pncLock = NULL; 137 | HRESULT hr = S_OK; 138 | 139 | // 140 | // Uninitialize INetCfg 141 | // 142 | 143 | hr = pnc->Uninitialize(); 144 | 145 | // 146 | // If write lock is present, unlock it 147 | // 148 | 149 | if ( hr == S_OK && fHasWriteLock ) { 150 | 151 | // 152 | // Get the locking reference 153 | // 154 | 155 | hr = pnc->QueryInterface( IID_INetCfgLock, 156 | (LPVOID *)&pncLock); 157 | if ( hr == S_OK ) { 158 | hr = pncLock->ReleaseWriteLock(); 159 | ReleaseRef( pncLock ); 160 | } 161 | } 162 | 163 | ReleaseRef( pnc ); 164 | 165 | // 166 | // Uninitialize COM. 167 | // 168 | 169 | CoUninitialize(); 170 | 171 | return hr; 172 | } 173 | 174 | HRESULT HrInstallNetComponent( 175 | IN INetCfg *pnc, 176 | IN LPCTSTR lpszComponentId, 177 | IN const GUID *pguidClass, 178 | IN LPCTSTR lpszInfFullPath 179 | ) 180 | { 181 | DWORD dwError; 182 | HRESULT hr = S_OK; 183 | WCHAR szDrive[ _MAX_DRIVE ]; 184 | WCHAR szDir[ _MAX_DIR ]; 185 | WCHAR szDirWithDrive[_MAX_DRIVE+_MAX_DIR]; 186 | WCHAR szfname[ _MAX_FNAME ]; 187 | WCHAR szExt[ _MAX_EXT ]; 188 | 189 | // 190 | // If full path to INF has been specified, the INF 191 | // needs to be copied using Setup API to ensure that any other files 192 | // that the primary INF copies will be correctly found by Setup API 193 | // 194 | if ( lpszInfFullPath ) 195 | { 196 | // 197 | // Get the path where the INF file is. 198 | // 199 | _wsplitpath_s( lpszInfFullPath, szDrive, _countof(szDrive), szDir, _countof(szDir), szfname, _countof(szfname), szExt, _countof(szExt) ); 200 | 201 | wcscpy_s( szDirWithDrive, szDrive ); 202 | wcscpy_s( szDirWithDrive, szDir ); 203 | 204 | // 205 | // Copy the Service INF file to the \Windows\Inf Folder 206 | // 207 | if ( !SetupCopyOEMInf( 208 | lpszInfFullPath, 209 | szDirWithDrive, // Other files are in the same dir as primary INF 210 | SPOST_PATH, // First param is path to INF 211 | 0, // Default copy style 212 | NULL, // Name of the INF after it's copied to %windir%\inf 213 | 0, // Max buf. size for the above 214 | NULL, // Required size if non-null 215 | NULL) // Optionally get the filename part of Inf name after it is copied. 216 | ) 217 | { 218 | dwError = GetLastError(); 219 | 220 | hr = HRESULT_FROM_WIN32( dwError ); 221 | } 222 | } 223 | 224 | if ( S_OK == hr ) 225 | { 226 | // 227 | // Install the network component. 228 | // 229 | hr = HrInstallComponent( pnc, lpszComponentId, pguidClass ); 230 | 231 | if ( hr == S_OK ) 232 | { 233 | // 234 | // On success, apply the changes 235 | // 236 | hr = pnc->Apply(); 237 | } 238 | } 239 | 240 | return hr; 241 | } 242 | 243 | HRESULT HrInstallComponent( 244 | IN INetCfg* pnc, 245 | IN LPCTSTR szComponentId, 246 | IN const GUID* pguidClass 247 | ) 248 | { 249 | INetCfgClassSetup *pncClassSetup = NULL; 250 | INetCfgComponent *pncc = NULL; 251 | OBO_TOKEN OboToken; 252 | HRESULT hr = S_OK; 253 | 254 | // 255 | // OBO_TOKEN specifies on whose behalf this 256 | // component is being installed. 257 | // Set it to OBO_USER so that szComponentId will be installed 258 | // on behalf of the user. 259 | // 260 | 261 | ZeroMemory( &OboToken, 262 | sizeof(OboToken) ); 263 | OboToken.Type = OBO_USER; 264 | 265 | // 266 | // Get component's setup class reference. 267 | // 268 | hr = pnc->QueryNetCfgClass ( pguidClass, 269 | IID_INetCfgClassSetup, 270 | (void**)&pncClassSetup ); 271 | 272 | if ( hr == S_OK ) 273 | { 274 | hr = pncClassSetup->Install( szComponentId, 275 | &OboToken, 276 | 0, 277 | 0, // Upgrade from build number. 278 | NULL, // Answerfile name 279 | NULL, // Answerfile section name 280 | &pncc ); // Reference after the component 281 | if ( S_OK == hr ) { // is installed. 282 | 283 | // 284 | // we don't need to use pncc (INetCfgComponent), release it 285 | // 286 | 287 | ReleaseRef( pncc ); 288 | } 289 | 290 | ReleaseRef( pncClassSetup ); 291 | } 292 | 293 | return hr; 294 | } 295 | 296 | HRESULT HrUninstallNetComponent( 297 | IN INetCfg* pnc, 298 | IN LPCTSTR szComponentId 299 | ) 300 | { 301 | INetCfgComponent *pncc = NULL; 302 | INetCfgClass *pncClass = NULL; 303 | INetCfgClassSetup *pncClassSetup = NULL; 304 | OBO_TOKEN OboToken; 305 | GUID guidClass; 306 | HRESULT hr = S_OK; 307 | 308 | // 309 | // OBO_TOKEN specifies on whose behalf this 310 | // component is being installed. 311 | // Set it to OBO_USER so that szComponentId will be installed 312 | // on behalf of the user. 313 | // 314 | 315 | ZeroMemory( &OboToken, 316 | sizeof(OboToken) ); 317 | OboToken.Type = OBO_USER; 318 | 319 | // 320 | // Get the component's reference. 321 | // 322 | 323 | hr = pnc->FindComponent( szComponentId, 324 | &pncc ); 325 | 326 | if (S_OK == hr) { 327 | 328 | // 329 | // Get the component's class GUID. 330 | // 331 | 332 | hr = pncc->GetClassGuid( &guidClass ); 333 | 334 | if ( hr == S_OK ) { 335 | 336 | // 337 | // Get component's class reference. 338 | // 339 | 340 | hr = pnc->QueryNetCfgClass( &guidClass, 341 | IID_INetCfgClass, 342 | (void**)&pncClass ); 343 | if ( hr == S_OK ) { 344 | 345 | // 346 | // Get Setup reference. 347 | // 348 | 349 | hr = pncClass->QueryInterface( IID_INetCfgClassSetup, 350 | (void**)&pncClassSetup ); 351 | if ( hr == S_OK ) { 352 | 353 | hr = pncClassSetup->DeInstall( pncc, 354 | &OboToken, 355 | NULL); 356 | if ( hr == S_OK ) { 357 | 358 | // 359 | // Apply the changes 360 | // 361 | 362 | hr = pnc->Apply(); 363 | } 364 | 365 | ReleaseRef( pncClassSetup ); 366 | } 367 | 368 | ReleaseRef( pncClass ); 369 | } 370 | } 371 | 372 | ReleaseRef( pncc ); 373 | } 374 | 375 | return hr; 376 | } 377 | 378 | VOID ReleaseRef (IN IUnknown* punk) 379 | { 380 | if ( punk ) { 381 | punk->Release(); 382 | } 383 | 384 | return; 385 | } 386 | 387 | -------------------------------------------------------------------------------- /code/installer/netcfgapi.h: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | // 3 | // Microsoft Windows 4 | // Copyright (C) Microsoft Corporation, 2001. 5 | // 6 | // File: N E T C F G A P I . H 7 | // 8 | // Contents: Functions Prototypes 9 | // 10 | // Notes: 11 | // 12 | // Author: Alok Sinha 15-May-01 13 | // 14 | //---------------------------------------------------------------------------- 15 | 16 | #ifndef _NETCFGAPI_H_INCLUDED 17 | 18 | #define _NETCFGAPI_H_INCLUDED 19 | 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #define LOCK_TIME_OUT 5000 32 | 33 | HRESULT HrGetINetCfg (IN BOOL fGetWriteLock, 34 | IN LPCTSTR lpszAppName, 35 | OUT INetCfg** ppnc, 36 | OUT LPTSTR *lpszLockedBy); 37 | 38 | HRESULT HrReleaseINetCfg (INetCfg* pnc, 39 | BOOL fHasWriteLock); 40 | 41 | HRESULT HrInstallNetComponent (IN INetCfg *pnc, 42 | IN LPCTSTR szComponentId, 43 | IN const GUID *pguildClass, 44 | IN LPCTSTR lpszInfFullPath); 45 | 46 | HRESULT HrInstallComponent(IN INetCfg* pnc, 47 | IN LPCTSTR szComponentId, 48 | IN const GUID* pguidClass); 49 | 50 | HRESULT HrUninstallNetComponent(IN INetCfg* pnc, 51 | IN LPCTSTR szComponentId); 52 | 53 | VOID ReleaseRef (IUnknown* punk); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /code/installer/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by ApplicationForDrivers1.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /code/installer/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // ProtInstall.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /code/installer/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | 9 | #include 10 | #include 11 | 12 | // TODO: reference additional headers your program requires here 13 | #include 14 | #include 15 | #include 16 | #include "TapInstall.h" 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | 23 | -------------------------------------------------------------------------------- /code/installer/tapinstall.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2015, Defensive Depth (Defensivedepth.com) 3 | * 4 | * All rights reserved. 5 | * 6 | * This file is part of WinTAP. 7 | * WinTAP is dual-licensed under the MIT License http://opensource.org/licenses/MIT, 8 | * as well as the GNU General Public License, version 3. 9 | * 10 | * GPL 3: 11 | * WinTAP is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * WinTAP is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with WinTAP. If not, see . 23 | * 24 | * 25 | */ 26 | 27 | // tapinstall.cpp : Defines the entry point for the console application. 28 | // 29 | 30 | #include "stdafx.h" 31 | #include "netcfgapi.h" 32 | 33 | #define APP_NAME L"WTapInstall" 34 | 35 | BOOLEAN bVerbose = TRUE; 36 | 37 | VOID __cdecl ErrMsg (HRESULT hr, LPCTSTR lpFmt, ...) 38 | { 39 | LPTSTR lpSysMsg; 40 | TCHAR buf[400]; 41 | SIZE_T offset = 0L; 42 | va_list vArgList; 43 | 44 | if ( hr != 0 ) 45 | { 46 | wsprintf( buf, L"Error %#lx: ", hr ); 47 | } 48 | else 49 | { 50 | buf[0] = 0; 51 | } 52 | 53 | offset = wcslen( buf ); 54 | 55 | va_start( vArgList, lpFmt ); 56 | vswprintf_s( buf+offset, _countof(buf)-offset, lpFmt, vArgList ); 57 | va_end( vArgList ); 58 | 59 | 60 | if ( hr != 0 ) { 61 | FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | 62 | FORMAT_MESSAGE_FROM_SYSTEM | 63 | FORMAT_MESSAGE_IGNORE_INSERTS, 64 | NULL, 65 | hr, 66 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 67 | (LPTSTR)&lpSysMsg, 68 | 0, 69 | NULL 70 | ); 71 | 72 | if ( lpSysMsg ) 73 | { 74 | offset = wcslen( buf ); 75 | swprintf_s( buf+offset, _countof(buf)-offset, L"\n\nPossible cause:\n\n" ); 76 | offset = wcslen( buf ); 77 | wcscat_s( buf+offset, _countof(buf)-offset, lpSysMsg ); 78 | LocalFree( (HLOCAL)lpSysMsg ); 79 | } 80 | } 81 | 82 | wprintf( buf ); 83 | return; 84 | } 85 | 86 | DWORD GetServiceInfFilePath( 87 | IN LPTSTR lpFilename, 88 | IN DWORD nSize 89 | ) 90 | { 91 | // Get Path to This Module 92 | DWORD nResult; 93 | WCHAR szDrive[ _MAX_DRIVE ]; 94 | WCHAR szDir[ _MAX_DIR ]; 95 | WCHAR szFname[ _MAX_FNAME ]; 96 | WCHAR szExt[ _MAX_EXT ]; 97 | 98 | nResult = GetModuleFileName( NULL, lpFilename, nSize ); 99 | 100 | if( nResult == 0 ) 101 | { 102 | return 0; 103 | } 104 | 105 | _wsplitpath_s( lpFilename, szDrive, _countof(szDrive), szDir, _countof(szDir), szFname, _countof(szFname), szExt, _countof(szExt) ); 106 | _wmakepath_s( lpFilename, nSize, szDrive, szDir, NDISPROT_SERVICE_INF_FILE, L".inf" ); 107 | 108 | return (DWORD )wcslen( lpFilename ); 109 | } 110 | 111 | HRESULT InstallSpecifiedComponent( 112 | IN LPTSTR lpszInfFile, 113 | IN LPTSTR lpszPnpID, 114 | IN const GUID *pguidClass 115 | ) 116 | { 117 | INetCfg *pnc; 118 | LPTSTR lpszApp; 119 | HRESULT hr; 120 | 121 | hr = HrGetINetCfg( TRUE, APP_NAME, &pnc, &lpszApp ); 122 | 123 | if ( hr == S_OK ) 124 | { 125 | // 126 | // Install the network component. 127 | // 128 | hr = HrInstallNetComponent( 129 | pnc, 130 | lpszPnpID, 131 | pguidClass, 132 | lpszInfFile 133 | ); 134 | 135 | if ( (hr == S_OK) || (hr == NETCFG_S_REBOOT) ) 136 | { 137 | hr = pnc->Apply(); 138 | } 139 | else 140 | { 141 | if ( hr != HRESULT_FROM_WIN32(ERROR_CANCELLED) ) 142 | { 143 | ErrMsg( hr, L"Couldn't install the network component." ); 144 | } 145 | } 146 | 147 | HrReleaseINetCfg( pnc, TRUE ); 148 | } 149 | else 150 | { 151 | if ( (hr == NETCFG_E_NO_WRITE_LOCK) && lpszApp ) 152 | { 153 | ErrMsg( hr, L"%s currently holds the lock, try later.", lpszApp ); 154 | CoTaskMemFree( lpszApp ); 155 | } 156 | else 157 | { 158 | ErrMsg( hr, L"Couldn't the get notify object interface." ); 159 | } 160 | } 161 | 162 | return hr; 163 | } 164 | 165 | DWORD InstallDriver() 166 | { 167 | DWORD nResult; 168 | 169 | wprintf( L"Installing %s...\n", NDISPROT_FRIENDLY_NAME ); 170 | 171 | // Get Path to Service INF File 172 | // ---------------------------- 173 | // The INF file is assumed to be in the same folder as this application... 174 | WCHAR szFileFullPath[ _MAX_PATH ]; 175 | 176 | nResult = GetServiceInfFilePath( szFileFullPath, MAX_PATH ); 177 | 178 | if( nResult == 0 ) 179 | { 180 | _tprintf( _T("Unable to get INF file path.\n") ); 181 | return 0; 182 | } 183 | 184 | wprintf( L"INF Path: %s\n", szFileFullPath ); 185 | HRESULT hr = S_OK; 186 | wprintf( L"PnpID: %s\n", NDISPROT_SERVICE_PNP_DEVICE_ID ); 187 | 188 | hr = InstallSpecifiedComponent( 189 | szFileFullPath, 190 | NDISPROT_SERVICE_PNP_DEVICE_ID, 191 | &GUID_DEVCLASS_NETTRANS 192 | ); 193 | 194 | if( hr != S_OK ) 195 | { 196 | ErrMsg( hr, L"InstallSpecifiedComponent\n" ); 197 | } 198 | 199 | return 0; 200 | } 201 | 202 | DWORD UninstallDriver() 203 | { 204 | wprintf( L"Uninstalling %s...\n", NDISPROT_FRIENDLY_NAME ); 205 | 206 | INetCfg *pnc; 207 | INetCfgComponent *pncc; 208 | INetCfgClass *pncClass; 209 | INetCfgClassSetup *pncClassSetup; 210 | LPTSTR lpszApp; 211 | GUID guidClass; 212 | OBO_TOKEN obo; 213 | HRESULT hr; 214 | 215 | hr = HrGetINetCfg( TRUE, APP_NAME, &pnc, &lpszApp ); 216 | 217 | if ( hr == S_OK ) { 218 | 219 | // 220 | // Get a reference to the network component to uninstall. 221 | // 222 | hr = pnc->FindComponent( NDISPROT_SERVICE_PNP_DEVICE_ID, &pncc ); 223 | 224 | if ( hr == S_OK ) 225 | { 226 | // 227 | // Get the class GUID. 228 | // 229 | hr = pncc->GetClassGuid( &guidClass ); 230 | 231 | if ( hr == S_OK ) 232 | { 233 | // 234 | // Get a reference to component's class. 235 | // 236 | 237 | hr = pnc->QueryNetCfgClass( &guidClass, IID_INetCfgClass, (PVOID *)&pncClass ); 238 | if ( hr == S_OK ) 239 | { 240 | // 241 | // Get the setup interface. 242 | // 243 | 244 | hr = pncClass->QueryInterface( IID_INetCfgClassSetup, 245 | (LPVOID *)&pncClassSetup ); 246 | 247 | if ( hr == S_OK ) 248 | { 249 | // 250 | // Uninstall the component. 251 | // 252 | 253 | ZeroMemory( &obo, sizeof(OBO_TOKEN) ); 254 | 255 | obo.Type = OBO_USER; 256 | 257 | hr = pncClassSetup->DeInstall( pncc, &obo, NULL ); 258 | if ( (hr == S_OK) || (hr == NETCFG_S_REBOOT) ) 259 | { 260 | hr = pnc->Apply(); 261 | 262 | if ( (hr != S_OK) && (hr != NETCFG_S_REBOOT) ) 263 | { 264 | ErrMsg( hr, 265 | L"Couldn't apply the changes after" 266 | L" uninstalling %s.", 267 | NDISPROT_SERVICE_PNP_DEVICE_ID ); 268 | } 269 | } 270 | else 271 | { 272 | ErrMsg( hr, 273 | L"Failed to uninstall %s.", 274 | NDISPROT_SERVICE_PNP_DEVICE_ID ); 275 | } 276 | 277 | ReleaseRef( pncClassSetup ); 278 | } 279 | else 280 | { 281 | ErrMsg( hr, 282 | L"Couldn't get an interface to setup class." ); 283 | } 284 | 285 | ReleaseRef( pncClass ); 286 | } 287 | else 288 | { 289 | ErrMsg( hr, 290 | L"Couldn't get a pointer to class interface " 291 | L"of %s.", 292 | NDISPROT_SERVICE_PNP_DEVICE_ID ); 293 | } 294 | } 295 | else 296 | { 297 | ErrMsg( hr, 298 | L"Couldn't get the class guid of %s.", 299 | NDISPROT_SERVICE_PNP_DEVICE_ID ); 300 | } 301 | 302 | ReleaseRef( pncc ); 303 | } 304 | else 305 | { 306 | ErrMsg( hr, 307 | L"Couldn't get an interface pointer to %s.", 308 | NDISPROT_SERVICE_PNP_DEVICE_ID ); 309 | } 310 | 311 | HrReleaseINetCfg( pnc, 312 | TRUE ); 313 | } 314 | else 315 | { 316 | if ( (hr == NETCFG_E_NO_WRITE_LOCK) && lpszApp ) 317 | { 318 | ErrMsg( hr, 319 | L"%s currently holds the lock, try later.", 320 | lpszApp ); 321 | 322 | CoTaskMemFree( lpszApp ); 323 | } 324 | else 325 | { 326 | ErrMsg( hr, L"Couldn't get the notify object interface." ); 327 | } 328 | } 329 | 330 | return 0; 331 | } 332 | 333 | int __cdecl wmain(int argc, _TCHAR* argv[]) // __stdcall 334 | { 335 | SetConsoleTitle( L"Installing NDIS Intermediate Filter Driver" ); 336 | 337 | if( argc < 2 ) 338 | { 339 | return 0; 340 | } 341 | 342 | if( argc > 2 ) 343 | { 344 | if( _tcsicmp( argv[2], _T("/v") ) == 0 ) 345 | { 346 | bVerbose = TRUE; 347 | } 348 | } 349 | 350 | if( argc > 2 ) 351 | { 352 | if( _tcsicmp( argv[2], _T("/hide") ) == 0 ) 353 | { 354 | bVerbose = FALSE; 355 | } 356 | } 357 | 358 | if( !bVerbose ) 359 | { 360 | ShowWindow( GetConsoleWindow(), SW_HIDE ); 361 | } 362 | 363 | // Handle Driver Install 364 | if( _tcsicmp( argv[1], _T("/Install") ) == 0 ) 365 | { 366 | return InstallDriver(); 367 | } 368 | 369 | // Handle Driver Uninstall 370 | if( _tcsicmp( argv[1], _T("/Uninstall") ) == 0 ) 371 | { 372 | return UninstallDriver(); 373 | } 374 | 375 | return 0; 376 | } 377 | 378 | -------------------------------------------------------------------------------- /code/installer/tapinstall.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/code/installer/tapinstall.rc -------------------------------------------------------------------------------- /code/sys/60/ndisprot60.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Win8 Debug 6 | Win32 7 | 8 | 9 | Win7 Debug 10 | Win32 11 | 12 | 13 | Vista Debug 14 | Win32 15 | 16 | 17 | Win8 Release 18 | Win32 19 | 20 | 21 | Win7 Release 22 | Win32 23 | 24 | 25 | Vista Release 26 | Win32 27 | 28 | 29 | Win8 Debug 30 | x64 31 | 32 | 33 | Win7 Debug 34 | x64 35 | 36 | 37 | Vista Debug 38 | x64 39 | 40 | 41 | Win8 Release 42 | x64 43 | 44 | 45 | Win7 Release 46 | x64 47 | 48 | 49 | Vista Release 50 | x64 51 | 52 | 53 | 54 | WDM 55 | WindowsKernelModeDriver8.0 56 | Driver 57 | 58 | 59 | $(VCTargetsPath11) 60 | Win8 Debug 61 | Win32 62 | DbgengKernelDebugger 63 | DbgengRemoteDebugger 64 | {06C7E51E-80CA-4906-BE28-5894EB061747} 65 | 66 | 67 | 68 | {92E567C1-EF36-496E-B86D-EB8D0E5D9EA1} 69 | $(MSBuildProjectName) 70 | wtapdrv 71 | 72 | 73 | Win8 74 | True 75 | 76 | 77 | Win7 78 | True 79 | 80 | 81 | Vista 82 | True 83 | 84 | 85 | Win8 86 | False 87 | 88 | 89 | Win7 90 | False 91 | 92 | 93 | Vista 94 | False 95 | 96 | 97 | Win8 98 | True 99 | 100 | 101 | Win7 102 | True 103 | 104 | 105 | Vista 106 | True 107 | 108 | 109 | Win8 110 | False 111 | 112 | 113 | Win7 114 | False 115 | 116 | 117 | Vista 118 | False 119 | 120 | 121 | 122 | $(IntDir) 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | wtapdrv 163 | 164 | 165 | true 166 | 167 | 168 | 169 | %(PreprocessorDefinitions);NDIS_WDM=1;NDIS60=1 170 | true 171 | Level4 172 | 173 | 174 | %(PreprocessorDefinitions);NDIS_WDM=1;NDIS60=1 175 | 176 | 177 | %(PreprocessorDefinitions);NDIS_WDM=1;NDIS60=1 178 | 179 | 180 | 181 | 182 | %(AdditionalDependencies);$(DDK_LIB_PATH)\ndis.lib;$(DDK_LIB_PATH)\wdmsec.lib 183 | 184 | 185 | %(AdditionalIncludeDirectories);.. 186 | 187 | 188 | %(AdditionalIncludeDirectories);.. 189 | 190 | 191 | true 192 | 193 | 194 | %(AdditionalIncludeDirectories);.. 195 | 196 | 197 | 198 | 199 | ..;%(AdditionalIncludeDirectories) 200 | precomp.h 201 | Use 202 | $(IntDir)\precomp.h.pch 203 | 204 | 205 | ..;%(AdditionalIncludeDirectories) 206 | precomp.h 207 | Use 208 | $(IntDir)\precomp.h.pch 209 | 210 | 211 | ..;%(AdditionalIncludeDirectories) 212 | precomp.h 213 | Use 214 | $(IntDir)\precomp.h.pch 215 | 216 | 217 | ..;%(AdditionalIncludeDirectories) 218 | precomp.h 219 | Use 220 | $(IntDir)\precomp.h.pch 221 | 222 | 223 | ..;%(AdditionalIncludeDirectories) 224 | precomp.h 225 | Use 226 | $(IntDir)\precomp.h.pch 227 | 228 | 229 | ..;%(AdditionalIncludeDirectories) 230 | precomp.h 231 | Use 232 | $(IntDir)\precomp.h.pch 233 | 234 | 235 | ..;%(AdditionalIncludeDirectories) 236 | precomp.h 237 | Create 238 | $(IntDir)\precomp.h.pch 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | -------------------------------------------------------------------------------- /code/sys/60/ndisprot60.vcxproj.Filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | {1AF41903-BEE5-4944-A37C-DDA964EBC27E} 7 | 8 | 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | {9697091E-3D0D-4A62-8550-9ADB26F3D6EC} 11 | 12 | 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 14 | {A4DC62FE-3733-4EA6-8955-9C897A74986F} 15 | 16 | 17 | inf;inv;inx;mof;mc; 18 | {21C80EC5-D41E-4B85-95E8-E6F98F99BF74} 19 | 20 | 21 | 22 | 23 | Source Files 24 | 25 | 26 | Source Files 27 | 28 | 29 | Source Files 30 | 31 | 32 | Source Files 33 | 34 | 35 | Source Files 36 | 37 | 38 | Source Files 39 | 40 | 41 | Source Files 42 | 43 | 44 | 45 | 46 | Resource Files 47 | 48 | 49 | 50 | 51 | Driver Files 52 | 53 | 54 | 55 | 56 | Header Files 57 | 58 | 59 | Header Files 60 | 61 | 62 | Header Files 63 | 64 | 65 | Header Files 66 | 67 | 68 | Header Files 69 | 70 | 71 | -------------------------------------------------------------------------------- /code/sys/60/ndisprot60.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | CN="WDKTestCert Admin,130117326078655508" | BDF15746B4587E8CC40E621743B4529CB10C9CD1 5 | 6 | -------------------------------------------------------------------------------- /code/sys/60/precompsrc.c: -------------------------------------------------------------------------------- 1 | #include "precomp.h" -------------------------------------------------------------------------------- /code/sys/60/wtapdrv.inf: -------------------------------------------------------------------------------- 1 | ;------------------------------------------------------------------------- 2 | ; WTAPDRV.INF -- WinTap Protocol Driver 3 | ; 4 | ; Copyright 2013-2015, Defensive Depth (Defensivedepth.com) 5 | ; 6 | ; This file is part of WinTAP. 7 | ; WinTAP is dual-licensed under the MIT License http://opensource.org/licenses/MIT, 8 | ; as well as the GNU General Public License, version 3. 9 | ; 10 | ; GPL 3: 11 | ; WinTAP is free software: you can redistribute it and/or modify 12 | ; it under the terms of the GNU General Public License as published by 13 | ; the Free Software Foundation, either version 3 of the License, or 14 | ; (at your option) any later version. 15 | ; 16 | ; WinTAP is distributed in the hope that it will be useful, 17 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ; GNU General Public License for more details. 20 | ; 21 | ; You should have received a copy of the GNU General Public License 22 | ; along with WinTAP. If not, see . 23 | ; 24 | ; 25 | ;------------------------------------------------------------------------- 26 | [version] 27 | Signature = "$Windows NT$" 28 | Class = NetTrans 29 | ClassGUID = {4d36e975-e325-11ce-bfc1-08002be10318} 30 | Provider = %Mfg% 31 | DriverVer = 10/05/2013,1.1 32 | CatalogFile = wtapdrv.cat 33 | 34 | 35 | [Manufacturer] 36 | %Mfg%=WTAP,NTx86,NTia64,NTamd64 37 | 38 | [WTAP.NTx86] 39 | %Svc_Desc%=Install, WINTAP_TAPROTO 40 | 41 | [WTAP.NTia64] 42 | %Svc_Desc%=Install, WINTAP_TAPROTO 43 | 44 | [WTAP.NTamd64] 45 | %Svc_Desc%=Install, WINTAP_TAPROTO 46 | 47 | ;------------------------------------------------------------------------- 48 | ; Installation Section 49 | ;------------------------------------------------------------------------- 50 | [Install] 51 | AddReg=Inst_Ndi 52 | Characteristics=0x0 ; 53 | CopyFiles=CpyFiles_Sys 54 | 55 | ;------------------------------------------------------------------------- 56 | ; Ndi installation support 57 | ;------------------------------------------------------------------------- 58 | [Inst_Ndi] 59 | HKR,Ndi,Service,,"wintap" 60 | HKR,Ndi,HelpText,,%Svc_HelpText% 61 | HKR,Ndi\Interfaces, UpperRange,, noupper 62 | HKR,"Ndi\Interfaces","LowerRange",,"ndis5,ndis4,ndis5_prot" 63 | 64 | ;------------------------------------------------------------------------- 65 | ; Service installation support 66 | ;------------------------------------------------------------------------- 67 | [Install.Services] 68 | AddService=wintap,,WinTap_Service_Inst 69 | 70 | [WinTap_Service_Inst] 71 | DisplayName = %Svc_Desc% 72 | ServiceType = 1 ;SERVICE_KERNEL_DRIVER 73 | StartType = 2 ;SERVICE_AUTO_START 74 | ErrorControl = 1 ;SERVICE_ERROR_NORMAL 75 | ServiceBinary = %12%\wtapdrv.sys 76 | LoadOrderGroup = NDIS 77 | Description = %Svc_Desc% 78 | 79 | [Install.Remove.Services] 80 | DelService=wintap,0x200 81 | 82 | ;------------------------------------------------------------------------- 83 | ; Declare Destination Directories for file copy/deletion 84 | ;------------------------------------------------------------------------- 85 | [SourceDisksNames] 86 | 1=%DiskDescription%,"",, 87 | 88 | [SourceDisksFiles] 89 | wtapdrv.sys=1 90 | 91 | 92 | [DestinationDirs] 93 | CpyFiles_Sys = 12 ; DIRID_DRIVERS 94 | 95 | 96 | ;------------------------------------------------------------------------- 97 | ; Files to Copy/Delete - Referenced by Install and Remove sections above 98 | ;------------------------------------------------------------------------- 99 | [CpyFiles_Sys] 100 | wtapdrv.sys,,,2 101 | 102 | [Strings] 103 | Mfg = "Aczire Solutions" 104 | DiskDescription = "WinTap Protocol Driver Disk" 105 | Svc_Desc = "WinTap Protocol Driver" 106 | Svc_HelpText = "WinTap driver to support user-mode I/O on NICs" 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /code/sys/60/wtapdrv.rc: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 6 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 7 | IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR 8 | PURPOSE. 9 | 10 | Module Name: 11 | 12 | ndisprot.rc 13 | 14 | Abstract: 15 | 16 | Internal resource file for driver. 17 | 18 | --*/ 19 | 20 | #include 21 | #include 22 | 23 | #define VER_FILETYPE VFT_DRV 24 | #define VER_FILESUBTYPE VFT2_DRV_NETWORK 25 | 26 | #define VER_FILEDESCRIPTION_STR "WinTap User mode I/O Driver" 27 | #define VER_INTERNALNAME_STR "WTAPDRV.SYS" 28 | #define VER_ORIGINALFILENAME_STR "WTAPDRV.SYS" 29 | #define VER_LANGNEUTRAL 30 | 31 | #define VER_FILEVERSION 1,10,00,0000 32 | #define VER_FILEVERSION_STR "1.10.00.0000" 33 | 34 | #undef VER_PRODUCTVERSION 35 | #define VER_PRODUCTVERSION VER_FILEVERSION 36 | 37 | #undef VER_PRODUCTVERSION_STR 38 | #define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR 39 | 40 | #define VER_LEGALCOPYRIGHT_STR "Copyright (C) 2013 Aczire Solutions" 41 | 42 | #undef VER_COMPANYNAME_STR 43 | #define VER_COMPANYNAME_STR "Aczire Solutions" 44 | 45 | #undef VER_PRODUCTNAME_STR 46 | #define VER_PRODUCTNAME_STR "WinTap Protocol Driver" 47 | 48 | #include "common.ver" 49 | 50 | -------------------------------------------------------------------------------- /code/sys/630/ndisprot630.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Win8 Debug 6 | Win32 7 | 8 | 9 | Win7 Debug 10 | Win32 11 | 12 | 13 | Win8 Release 14 | Win32 15 | 16 | 17 | Win7 Release 18 | Win32 19 | 20 | 21 | Win8 Debug 22 | x64 23 | 24 | 25 | Win7 Debug 26 | x64 27 | 28 | 29 | Win8 Release 30 | x64 31 | 32 | 33 | Win7 Release 34 | x64 35 | 36 | 37 | 38 | WDM 39 | WindowsKernelModeDriver8.0 40 | Driver 41 | 42 | 43 | $(VCTargetsPath11) 44 | Win8 Debug 45 | Win32 46 | DbgengKernelDebugger 47 | DbgengRemoteDebugger 48 | {4874AB6B-ADAC-4AF7-A902-FF94E5C976E9} 49 | 50 | 51 | 52 | {E20AF61D-A0B3-4728-B777-60FAF4381D07} 53 | $(MSBuildProjectName) 54 | wtapdrv630 55 | 56 | 57 | Win8 58 | True 59 | 60 | 61 | Win7 62 | True 63 | 64 | 65 | Win8 66 | False 67 | 68 | 69 | Win7 70 | False 71 | 72 | 73 | Win8 74 | True 75 | 76 | 77 | Win7 78 | True 79 | 80 | 81 | Win8 82 | False 83 | 84 | 85 | Win7 86 | False 87 | 88 | 89 | 90 | $(IntDir) 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | wtapdrv630 119 | 120 | 121 | 122 | %(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1 123 | true 124 | Level4 125 | 126 | 127 | %(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1 128 | 129 | 130 | %(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1 131 | 132 | 133 | 134 | 135 | %(AdditionalIncludeDirectories);.. 136 | 137 | 138 | %(AdditionalIncludeDirectories);.. 139 | 140 | 141 | 142 | 143 | %(AdditionalIncludeDirectories);.. 144 | 145 | 146 | %(AdditionalDependencies);$(DDK_LIB_PATH)\ndis.lib;$(DDK_LIB_PATH)\wdmsec.lib 147 | 148 | 149 | 150 | 151 | ..;%(AdditionalIncludeDirectories) 152 | precomp.h 153 | Use 154 | $(IntDir)\precomp.h.pch 155 | 156 | 157 | ..;%(AdditionalIncludeDirectories) 158 | precomp.h 159 | Use 160 | $(IntDir)\precomp.h.pch 161 | 162 | 163 | ..;%(AdditionalIncludeDirectories) 164 | precomp.h 165 | Use 166 | $(IntDir)\precomp.h.pch 167 | 168 | 169 | ..;%(AdditionalIncludeDirectories) 170 | precomp.h 171 | Use 172 | $(IntDir)\precomp.h.pch 173 | 174 | 175 | ..;%(AdditionalIncludeDirectories) 176 | precomp.h 177 | Use 178 | $(IntDir)\precomp.h.pch 179 | 180 | 181 | ..;%(AdditionalIncludeDirectories) 182 | precomp.h 183 | Use 184 | $(IntDir)\precomp.h.pch 185 | 186 | 187 | ..;%(AdditionalIncludeDirectories) 188 | precomp.h 189 | Create 190 | $(IntDir)\precomp.h.pch 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /code/sys/630/ndisprot630.vcxproj.Filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | {DE852568-A28B-4619-815D-E9301F84DC77} 7 | 8 | 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | {D7DADB88-73CD-485E-AB35-15133D60D103} 11 | 12 | 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 14 | {EF598EEC-4E42-4B4E-92B7-F4D2CC4DFB83} 15 | 16 | 17 | inf;inv;inx;mof;mc; 18 | {2D12604E-E9E8-40DE-859D-5AE89CF3BC6F} 19 | 20 | 21 | 22 | 23 | Source Files 24 | 25 | 26 | Source Files 27 | 28 | 29 | Source Files 30 | 31 | 32 | Source Files 33 | 34 | 35 | Source Files 36 | 37 | 38 | Source Files 39 | 40 | 41 | Source Files 42 | 43 | 44 | 45 | 46 | Resource Files 47 | 48 | 49 | 50 | 51 | Driver Files 52 | 53 | 54 | -------------------------------------------------------------------------------- /code/sys/630/ndisprot630.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | CN="WDKTestCert Admin,130117326078655508" | BDF15746B4587E8CC40E621743B4529CB10C9CD1 5 | 6 | -------------------------------------------------------------------------------- /code/sys/630/precompsrc.c: -------------------------------------------------------------------------------- 1 | #include "precomp.h" -------------------------------------------------------------------------------- /code/sys/630/wtapdrv630.inf: -------------------------------------------------------------------------------- 1 | ;------------------------------------------------------------------------- 2 | ; NDISPROT630.INF -- Sample NDIS Protocol Driver 3 | ; 4 | ; Copyright 2013-2015, Defensive Depth (Defensivedepth.com) 5 | ; 6 | ; This file is part of WinTAP. 7 | ; WinTAP is dual-licensed under the MIT License http://opensource.org/licenses/MIT, 8 | ; as well as the GNU General Public License, version 3. 9 | ; 10 | ; GPL 3: 11 | ; WinTAP is free software: you can redistribute it and/or modify 12 | ; it under the terms of the GNU General Public License as published by 13 | ; the Free Software Foundation, either version 3 of the License, or 14 | ; (at your option) any later version. 15 | ; 16 | ; WinTAP is distributed in the hope that it will be useful, 17 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ; GNU General Public License for more details. 20 | ; 21 | ; You should have received a copy of the GNU General Public License 22 | ; along with WinTAP. If not, see . 23 | ; 24 | ;------------------------------------------------------------------------- 25 | [version] 26 | Signature = "$Windows NT$" 27 | Class = NetTrans 28 | ClassGUID = {4d36e975-e325-11ce-bfc1-08002be10318} 29 | Provider = %Msft% 30 | DriverVer = 07/16/2010,4.2 31 | CatalogFile = ndisprot630.cat 32 | 33 | 34 | [Manufacturer] 35 | %Msft%=MSFT,NTx86,NTia64,NTamd64,NTarm 36 | 37 | [MSFT.NTx86] 38 | %NDISPROT_Desc%=Install, MS_NDISPROT 39 | 40 | [MSFT.NTia64] 41 | %NDISPROT_Desc%=Install, MS_NDISPROT 42 | 43 | [MSFT.NTamd64] 44 | %NDISPROT_Desc%=Install, MS_NDISPROT 45 | 46 | [MSFT.NTarm] 47 | %NDISPROT_Desc%=Install, MS_NDISPROT 48 | 49 | ;------------------------------------------------------------------------- 50 | ; Installation Section 51 | ;------------------------------------------------------------------------- 52 | [Install] 53 | AddReg=Inst_Ndi 54 | Characteristics=0x0 ; 55 | CopyFiles=CpyFiles_Sys 56 | 57 | ;------------------------------------------------------------------------- 58 | ; Ndi installation support 59 | ;------------------------------------------------------------------------- 60 | [Inst_Ndi] 61 | HKR,Ndi,Service,,"Ndisprot" 62 | HKR,Ndi,HelpText,,%NDISPROT_HelpText% 63 | HKR,Ndi\Interfaces, UpperRange,, noupper 64 | HKR,"Ndi\Interfaces","LowerRange",,"ndis5,ndis4,ndis5_prot" 65 | 66 | ;------------------------------------------------------------------------- 67 | ; Service installation support 68 | ;------------------------------------------------------------------------- 69 | [Install.Services] 70 | AddService=Ndisprot,,NDISPROT_Service_Inst 71 | 72 | [NDISPROT_Service_Inst] 73 | DisplayName = %NDISPROT_Desc% 74 | ServiceType = 1 ;SERVICE_KERNEL_DRIVER 75 | StartType = 3 ;SERVICE_DEMAND_START 76 | ErrorControl = 1 ;SERVICE_ERROR_NORMAL 77 | ServiceBinary = %12%\ndisprot630.sys 78 | LoadOrderGroup = NDIS 79 | Description = %NDISPROT_Desc% 80 | AddReg = NdisImPlatformBinding_Reg 81 | 82 | [NdisImPlatformBinding_Reg] 83 | ; By default, when an LBFO team or Bridge is created, all protocols will be 84 | ; unbound from the underlying members and bound to the TNic(s). This keyword 85 | ; allows a component to opt out of the default behavior 86 | ; To prevent binding this protocol to the TNic(s): 87 | ; HKR, Parameters, NdisImPlatformBindingOptions,0x00010001,1 ; Do not bind to TNic 88 | ; To prevent unbinding this protocol from underlying members: 89 | ; HKR, Parameters, NdisImPlatformBindingOptions,0x00010001,2 ; Do not unbind from Members 90 | ; To prevent both binding to TNic and unbinding from members: 91 | ; HKR, Parameters, NdisImPlatformBindingOptions,0x00010001,3 ; Do not bind to TNic or unbind from Members 92 | HKR, Parameters, NdisImPlatformBindingOptions,0x00010001,0 ; Subscribe to default behavior 93 | 94 | [Install.Remove.Services] 95 | DelService=Ndisprot,0x200 96 | 97 | ;------------------------------------------------------------------------- 98 | ; Declare Destination Directories for file copy/deletion 99 | ;------------------------------------------------------------------------- 100 | [SourceDisksNames] 101 | 1=%DiskDescription%,"",, 102 | 103 | [SourceDisksFiles] 104 | ndisprot630.sys=1 105 | 106 | 107 | [DestinationDirs] 108 | CpyFiles_Sys = 12 ; DIRID_DRIVERS 109 | 110 | 111 | ;------------------------------------------------------------------------- 112 | ; Files to Copy/Delete - Referenced by Install and Remove sections above 113 | ;------------------------------------------------------------------------- 114 | [CpyFiles_Sys] 115 | Ndisprot630.sys,,,2 116 | 117 | [Strings] 118 | Msft = "Microsoft" 119 | DiskDescription = "Microsoft Ndisprot Sample Protocol Driver Disk" 120 | NDISPROT_Desc = "Sample NDIS Protocol Driver" 121 | NDISPROT_HelpText = "A driver to support user-mode I/O on NDIS devices" 122 | 123 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /code/sys/630/wtapdrv630.rc: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 6 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 7 | IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR 8 | PURPOSE. 9 | 10 | Module Name: 11 | 12 | ndisprot.rc 13 | 14 | Abstract: 15 | 16 | Internal resource file for driver. 17 | 18 | --*/ 19 | 20 | #include 21 | #include 22 | 23 | #define VER_FILETYPE VFT_DRV 24 | #define VER_FILESUBTYPE VFT2_DRV_NETWORK 25 | 26 | #define VER_FILEDESCRIPTION_STR "WinTap User mode I/O Driver" 27 | #define VER_INTERNALNAME_STR "WTAPDRV630.SYS" 28 | #define VER_ORIGINALFILENAME_STR "WTAPDRV630.SYS" 29 | #define VER_LANGNEUTRAL 30 | 31 | #define VER_FILEVERSION 1,10,00,0000 32 | #define VER_FILEVERSION_STR "1.10.00.0000" 33 | 34 | #undef VER_PRODUCTVERSION 35 | #define VER_PRODUCTVERSION VER_FILEVERSION 36 | 37 | #undef VER_PRODUCTVERSION_STR 38 | #define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR 39 | 40 | #define VER_LEGALCOPYRIGHT_STR "Copyright (C) 2013 Aczire Solutions" 41 | 42 | #undef VER_COMPANYNAME_STR 43 | #define VER_COMPANYNAME_STR "Aczire Solutions" 44 | 45 | #undef VER_PRODUCTNAME_STR 46 | #define VER_PRODUCTNAME_STR "WinTap Protocol Driver" 47 | 48 | #include "common.ver" 49 | 50 | -------------------------------------------------------------------------------- /code/sys/debug.c: -------------------------------------------------------------------------------- 1 | // This module contains all debug-related code. 2 | /* 3 | * Copyright 2013-2015, Defensive Depth (Defensivedepth.com) 4 | * 5 | * All rights reserved. 6 | * 7 | * This file is part of WinTAP. 8 | * WinTAP is dual-licensed under the MIT License http://opensource.org/licenses/MIT, 9 | * as well as the GNU General Public License, version 3. 10 | * 11 | * GPL 3: 12 | * WinTAP is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 3 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * WinTAP is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with WinTAP. If not, see . 24 | * 25 | * 26 | */ 27 | 28 | #include 29 | 30 | #define __FILENUMBER 'GBED' 31 | 32 | #if DBG 33 | 34 | INT ndisprotDebugLevel=DL_EXTRA_LOUD; 35 | 36 | NDIS_SPIN_LOCK ndisprotDbgLogLock; 37 | 38 | PNPROTD_ALLOCATION ndisprotdMemoryHead = (PNPROTD_ALLOCATION)NULL; 39 | PNPROTD_ALLOCATION ndisprotdMemoryTail = (PNPROTD_ALLOCATION)NULL; 40 | ULONG ndisprotdAllocCount = 0; // how many allocated so far (unfreed) 41 | 42 | NDIS_SPIN_LOCK ndisprotdMemoryLock; 43 | BOOLEAN ndisprotdInitDone = FALSE; 44 | 45 | 46 | PVOID 47 | ndisprotAuditAllocMem( 48 | PVOID pPointer, 49 | ULONG Size, 50 | ULONG FileNumber, 51 | ULONG LineNumber 52 | ) 53 | { 54 | PVOID pBuffer; 55 | PNPROTD_ALLOCATION pAllocInfo; 56 | 57 | if (!ndisprotdInitDone) 58 | { 59 | NdisAllocateSpinLock(&(ndisprotdMemoryLock)); 60 | ndisprotdInitDone = TRUE; 61 | } 62 | 63 | NdisAllocateMemoryWithTag( 64 | (PVOID *)&pAllocInfo, 65 | Size+sizeof(NPROTD_ALLOCATION), 66 | (ULONG)'oiuN' 67 | ); 68 | 69 | if (pAllocInfo == (PNPROTD_ALLOCATION)NULL) 70 | { 71 | DEBUGP(DL_VERY_LOUD+50, 72 | ("ndisprotAuditAllocMem: file %d, line %d, Size %d failed!\n", 73 | FileNumber, LineNumber, Size)); 74 | pBuffer = NULL; 75 | } 76 | else 77 | { 78 | pBuffer = (PVOID)&(pAllocInfo->UserData); 79 | NPROT_SET_MEM(pBuffer, 0xaf, Size); 80 | pAllocInfo->Signature = NPROTD_MEMORY_SIGNATURE; 81 | pAllocInfo->FileNumber = FileNumber; 82 | pAllocInfo->LineNumber = LineNumber; 83 | pAllocInfo->Size = Size; 84 | pAllocInfo->Location = (ULONG_PTR)pPointer; 85 | pAllocInfo->Next = (PNPROTD_ALLOCATION)NULL; 86 | 87 | NdisAcquireSpinLock(&(ndisprotdMemoryLock)); 88 | 89 | pAllocInfo->Prev = ndisprotdMemoryTail; 90 | if (ndisprotdMemoryTail == (PNPROTD_ALLOCATION)NULL) 91 | { 92 | // empty list 93 | ndisprotdMemoryHead = ndisprotdMemoryTail = pAllocInfo; 94 | } 95 | else 96 | { 97 | ndisprotdMemoryTail->Next = pAllocInfo; 98 | } 99 | ndisprotdMemoryTail = pAllocInfo; 100 | 101 | ndisprotdAllocCount++; 102 | NdisReleaseSpinLock(&(ndisprotdMemoryLock)); 103 | } 104 | 105 | DEBUGP(DL_VERY_LOUD+100, 106 | ("ndisprotAuditAllocMem: file %c%c%c%c, line %d, %d bytes, [0x%p] <- 0x%p\n", 107 | (CHAR)(FileNumber & 0xff), 108 | (CHAR)((FileNumber >> 8) & 0xff), 109 | (CHAR)((FileNumber >> 16) & 0xff), 110 | (CHAR)((FileNumber >> 24) & 0xff), 111 | LineNumber, Size, pPointer, pBuffer)); 112 | 113 | return (pBuffer); 114 | 115 | } 116 | 117 | 118 | VOID 119 | ndisprotAuditFreeMem( 120 | PVOID Pointer 121 | ) 122 | { 123 | PNPROTD_ALLOCATION pAllocInfo; 124 | 125 | NdisAcquireSpinLock(&(ndisprotdMemoryLock)); 126 | 127 | pAllocInfo = CONTAINING_RECORD(Pointer, NPROTD_ALLOCATION, UserData); 128 | 129 | if (pAllocInfo->Signature != NPROTD_MEMORY_SIGNATURE) 130 | { 131 | DEBUGP(DL_ERROR, 132 | ("ndisprotAuditFreeMem: unknown buffer 0x%p!\n", Pointer)); 133 | NdisReleaseSpinLock(&(ndisprotdMemoryLock)); 134 | #if DBG 135 | DbgBreakPoint(); 136 | #endif 137 | return; 138 | } 139 | 140 | pAllocInfo->Signature = (ULONG)'DEAD'; 141 | if (pAllocInfo->Prev != (PNPROTD_ALLOCATION)NULL) 142 | { 143 | pAllocInfo->Prev->Next = pAllocInfo->Next; 144 | } 145 | else 146 | { 147 | ndisprotdMemoryHead = pAllocInfo->Next; 148 | } 149 | if (pAllocInfo->Next != (PNPROTD_ALLOCATION)NULL) 150 | { 151 | pAllocInfo->Next->Prev = pAllocInfo->Prev; 152 | } 153 | else 154 | { 155 | ndisprotdMemoryTail = pAllocInfo->Prev; 156 | } 157 | ndisprotdAllocCount--; 158 | NdisReleaseSpinLock(&(ndisprotdMemoryLock)); 159 | 160 | NdisFreeMemory(pAllocInfo, 0, 0); 161 | } 162 | 163 | 164 | VOID 165 | ndisprotAuditShutdown( 166 | VOID 167 | ) 168 | { 169 | if (ndisprotdInitDone) 170 | { 171 | if (ndisprotdAllocCount != 0) 172 | { 173 | DEBUGP(DL_ERROR, ("AuditShutdown: unfreed memory, %d blocks!\n", 174 | ndisprotdAllocCount)); 175 | DEBUGP(DL_ERROR, ("MemoryHead: 0x%p, MemoryTail: 0x%p\n", 176 | ndisprotdMemoryHead, ndisprotdMemoryTail)); 177 | DbgBreakPoint(); 178 | { 179 | PNPROTD_ALLOCATION pAllocInfo; 180 | 181 | while (ndisprotdMemoryHead != (PNPROTD_ALLOCATION)NULL) 182 | { 183 | pAllocInfo = ndisprotdMemoryHead; 184 | DEBUGP(DL_INFO, ("AuditShutdown: will free 0x%p\n", pAllocInfo)); 185 | ndisprotAuditFreeMem(&(pAllocInfo->UserData)); 186 | } 187 | } 188 | } 189 | ndisprotdInitDone = FALSE; 190 | } 191 | } 192 | 193 | #define MAX_HD_LENGTH 128 194 | 195 | VOID 196 | DbgPrintHexDump( 197 | IN PUCHAR pBuffer, 198 | IN ULONG Length 199 | ) 200 | /*++ 201 | 202 | Routine Description: 203 | 204 | Print a hex dump of the given contiguous buffer. If the length 205 | is too long, we truncate it. 206 | 207 | Arguments: 208 | 209 | pBuffer - Points to start of data to be dumped 210 | Length - Length of above. 211 | 212 | Return Value: 213 | 214 | None 215 | 216 | --*/ 217 | { 218 | ULONG i; 219 | 220 | if (Length > MAX_HD_LENGTH) 221 | { 222 | Length = MAX_HD_LENGTH; 223 | } 224 | 225 | for (i = 0; i < Length; i++) 226 | { 227 | // 228 | // Check if we are at the end of a line 229 | // 230 | if ((i > 0) && ((i & 0xf) == 0)) 231 | { 232 | DbgPrint("\n"); 233 | } 234 | 235 | // 236 | // Print addr if we are at start of a new line 237 | // 238 | if ((i & 0xf) == 0) 239 | { 240 | DbgPrint("%08p ", pBuffer); 241 | } 242 | 243 | DbgPrint(" %02x", *pBuffer++); 244 | } 245 | 246 | // 247 | // Terminate the last line. 248 | // 249 | if (Length > 0) 250 | { 251 | DbgPrint("\n"); 252 | } 253 | } 254 | #endif // DBG 255 | 256 | 257 | #if DBG_SPIN_LOCK 258 | ULONG ndisprotdSpinLockInitDone = 0; 259 | NDIS_SPIN_LOCK ndisprotdLockLock; 260 | 261 | VOID 262 | ndisprotAllocateSpinLock( 263 | IN PNPROT_LOCK pLock, 264 | IN ULONG FileNumber, 265 | IN ULONG LineNumber 266 | ) 267 | { 268 | if (ndisprotdSpinLockInitDone == 0) 269 | { 270 | ndisprotdSpinLockInitDone = 1; 271 | NdisAllocateSpinLock(&(ndisprotdLockLock)); 272 | } 273 | 274 | NdisAcquireSpinLock(&(ndisprotdLockLock)); 275 | pLock->Signature = NPROTL_SIG; 276 | pLock->TouchedByFileNumber = FileNumber; 277 | pLock->TouchedInLineNumber = LineNumber; 278 | pLock->IsAcquired = 0; 279 | pLock->OwnerThread = 0; 280 | NdisAllocateSpinLock(&(pLock->NdisLock)); 281 | NdisReleaseSpinLock(&(ndisprotdLockLock)); 282 | } 283 | 284 | VOID 285 | ndisprotFreeSpinLock( 286 | IN PNPROT_LOCK pLock, 287 | IN ULONG FileNumber, 288 | IN ULONG LineNumber 289 | ) 290 | { 291 | 292 | NdisAcquireSpinLock(&(ndisprotdLockLock)); 293 | pLock->Signature = NUIOL_SIG; 294 | pLock->TouchedByFileNumber = FileNumber; 295 | pLock->TouchedInLineNumber = LineNumber; 296 | pLock->IsAcquired = 0; 297 | pLock->OwnerThread = 0; 298 | NdisFreeSpinLock(&(pLock->NdisLock)); 299 | NdisReleaseSpinLock(&(ndisprotdLockLock)); 300 | } 301 | 302 | VOID 303 | ndisprotFreeDbgLock( 304 | VOID 305 | ) 306 | { 307 | 308 | ASSERT(ndisprotdSpinLockInitDone == 1); 309 | 310 | ndisprotdSpinLockInitDone = 0; 311 | NdisFreeSpinLock(&(ndisprotdLockLock)); 312 | } 313 | 314 | VOID 315 | ndisprotAcquireSpinLock( 316 | IN PNPROT_LOCK pLock, 317 | IN BOOLEAN DispatchLevel, 318 | IN ULONG FileNumber, 319 | IN ULONG LineNumber 320 | ) 321 | { 322 | PKTHREAD pThread; 323 | 324 | pThread = KeGetCurrentThread(); 325 | if (DispatchLevel == TRUE) 326 | { 327 | NdisDprAcquireSpinLock(&(ndisprotdLockLock)); 328 | } 329 | else 330 | { 331 | NdisAcquireSpinLock(&(ndisprotdLockLock)); 332 | } 333 | if (pLock->Signature != NPROTL_SIG) 334 | { 335 | DbgPrint("Trying to acquire uninited lock 0x%x, File %c%c%c%c, Line %d\n", 336 | pLock, 337 | (CHAR)(FileNumber & 0xff), 338 | (CHAR)((FileNumber >> 8) & 0xff), 339 | (CHAR)((FileNumber >> 16) & 0xff), 340 | (CHAR)((FileNumber >> 24) & 0xff), 341 | LineNumber); 342 | DbgBreakPoint(); 343 | } 344 | 345 | if (pLock->IsAcquired != 0) 346 | { 347 | if (pLock->OwnerThread == pThread) 348 | { 349 | DbgPrint("Detected multiple locking!: pLock 0x%x, File %c%c%c%c, Line %d\n", 350 | pLock, 351 | (CHAR)(FileNumber & 0xff), 352 | (CHAR)((FileNumber >> 8) & 0xff), 353 | (CHAR)((FileNumber >> 16) & 0xff), 354 | (CHAR)((FileNumber >> 24) & 0xff), 355 | LineNumber); 356 | DbgPrint("pLock 0x%x already acquired in File %c%c%c%c, Line %d\n", 357 | pLock, 358 | (CHAR)(pLock->TouchedByFileNumber & 0xff), 359 | (CHAR)((pLock->TouchedByFileNumber >> 8) & 0xff), 360 | (CHAR)((pLock->TouchedByFileNumber >> 16) & 0xff), 361 | (CHAR)((pLock->TouchedByFileNumber >> 24) & 0xff), 362 | pLock->TouchedInLineNumber); 363 | DbgBreakPoint(); 364 | } 365 | } 366 | 367 | pLock->IsAcquired++; 368 | if (DispatchLevel == TRUE) 369 | { 370 | NdisDprReleaseSpinLock(&(ndisprotdLockLock)); 371 | NdisDprAcquireSpinLock(&(pLock->NdisLock)); 372 | } 373 | else 374 | { 375 | NdisReleaseSpinLock(&(ndisprotdLockLock)); 376 | NdisAcquireSpinLock(&(pLock->NdisLock)); 377 | } 378 | 379 | // 380 | // Mark this lock. 381 | // 382 | pLock->OwnerThread = pThread; 383 | pLock->TouchedByFileNumber = FileNumber; 384 | pLock->TouchedInLineNumber = LineNumber; 385 | } 386 | 387 | 388 | VOID 389 | ndisprotReleaseSpinLock( 390 | IN PNPROT_LOCK pLock, 391 | IN BOOLEAN DispatchLevel, 392 | IN ULONG FileNumber, 393 | IN ULONG LineNumber 394 | ) 395 | { 396 | NdisDprAcquireSpinLock(&(ndisprotdLockLock)); 397 | if (pLock->Signature != NPROTL_SIG) 398 | { 399 | DbgPrint("Trying to release uninited lock 0x%x, File %c%c%c%c, Line %d\n", 400 | pLock, 401 | (CHAR)(FileNumber & 0xff), 402 | (CHAR)((FileNumber >> 8) & 0xff), 403 | (CHAR)((FileNumber >> 16) & 0xff), 404 | (CHAR)((FileNumber >> 24) & 0xff), 405 | LineNumber); 406 | DbgBreakPoint(); 407 | } 408 | 409 | if (pLock->IsAcquired == 0) 410 | { 411 | DbgPrint("Detected release of unacquired lock 0x%x, File %c%c%c%c, Line %d\n", 412 | pLock, 413 | (CHAR)(FileNumber & 0xff), 414 | (CHAR)((FileNumber >> 8) & 0xff), 415 | (CHAR)((FileNumber >> 16) & 0xff), 416 | (CHAR)((FileNumber >> 24) & 0xff), 417 | LineNumber); 418 | DbgBreakPoint(); 419 | } 420 | pLock->TouchedByFileNumber = FileNumber; 421 | pLock->TouchedInLineNumber = LineNumber; 422 | pLock->IsAcquired--; 423 | pLock->OwnerThread = 0; 424 | NdisDprReleaseSpinLock(&(ndisprotdLockLock)); 425 | if (DispatchLevel == TRUE) 426 | { 427 | NdisDprReleaseSpinLock(&(pLock->NdisLock)); 428 | } 429 | else 430 | { 431 | NdisReleaseSpinLock(&(pLock->NdisLock)); 432 | } 433 | } 434 | #endif // DBG_SPIN_LOCK 435 | -------------------------------------------------------------------------------- /code/sys/debug.h: -------------------------------------------------------------------------------- 1 | // Debug macros for WinTap 2 | /* 3 | * Copyright 2013-2015, Defensive Depth (Defensivedepth.com) 4 | * 5 | * All rights reserved. 6 | * 7 | * This file is part of WinTAP. 8 | * WinTAP is dual-licensed under the MIT License http://opensource.org/licenses/MIT, 9 | * as well as the GNU General Public License, version 3. 10 | * 11 | * GPL 3: 12 | * WinTAP is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 3 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * WinTAP is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with WinTAP. If not, see . 24 | * 25 | * 26 | */ 27 | 28 | #ifndef _NPROTDEBUG__H 29 | #define _NPROTDEBUG__H 30 | 31 | // 32 | // Message verbosity: lower values indicate higher urgency 33 | // 34 | #define DL_EXTRA_LOUD 20 35 | #define DL_VERY_LOUD 10 36 | #define DL_LOUD 8 37 | #define DL_INFO 6 38 | #define DL_WARN 4 39 | #define DL_ERROR 2 40 | #define DL_FATAL 0 41 | 42 | #if DBG_SPIN_LOCK 43 | 44 | typedef struct _NPROT_LOCK 45 | { 46 | ULONG Signature; 47 | ULONG IsAcquired; 48 | PKTHREAD OwnerThread; 49 | ULONG TouchedByFileNumber; 50 | ULONG TouchedInLineNumber; 51 | NDIS_SPIN_LOCK NdisLock; 52 | } NPROT_LOCK, *PNPROT_LOCK; 53 | 54 | #define NPROTL_SIG 'KCOL' 55 | 56 | extern NDIS_SPIN_LOCK ndisprotDbgLogLock; 57 | 58 | extern 59 | VOID 60 | ndisprotAllocateSpinLock( 61 | IN PNPROT_LOCK pLock, 62 | IN ULONG FileNumber, 63 | IN ULONG LineNumber 64 | ); 65 | 66 | extern 67 | VOID 68 | ndisprotFreeSpinLock( 69 | IN PNPROT_LOCK pLock, 70 | IN ULONG FileNumber, 71 | IN ULONG LineNumber 72 | ); 73 | 74 | extern 75 | VOID 76 | ndisprotAcquireSpinLock( 77 | IN PNPROT_LOCK pLock, 78 | IN BOOLEAN DispatchLevel, 79 | IN ULONG FileNumber, 80 | IN ULONG LineNumber 81 | ); 82 | 83 | extern 84 | VOID 85 | ndisprotReleaseSpinLock( 86 | IN PNPROT_LOCK pLock, 87 | IN BOOLEAN DispatchLevel, 88 | IN ULONG FileNumber, 89 | IN ULONG LineNumber 90 | ); 91 | 92 | extern 93 | VOID 94 | ndisprotFreeDbgLock( 95 | VOID 96 | ); 97 | 98 | #define CHECK_LOCK_COUNT(Count) \ 99 | { \ 100 | if ((INT)(Count) < 0) \ 101 | { \ 102 | DbgPrint("Lock Count %d is < 0! File %s, Line %d\n",\ 103 | Count, __FILE__, __LINE__); \ 104 | DbgBreakPoint(); \ 105 | } \ 106 | } 107 | #else 108 | 109 | #define CHECK_LOCK_COUNT(Count) 110 | 111 | typedef NDIS_SPIN_LOCK NPROT_LOCK; 112 | typedef PNDIS_SPIN_LOCK PNPROT_LOCK; 113 | 114 | #endif // DBG_SPIN_LOCK 115 | 116 | #if DBG 117 | 118 | extern INT ndisprotDebugLevel; 119 | 120 | 121 | #define DEBUGP(lev, stmt) \ 122 | { \ 123 | if ((lev) <= ndisprotDebugLevel) \ 124 | { \ 125 | DbgPrint("Wtapdrv: "); DbgPrint stmt; \ 126 | } \ 127 | } 128 | 129 | #define DEBUGPDUMP(lev, pBuf, Len) \ 130 | { \ 131 | if ((lev) <= ndisprotDebugLevel) \ 132 | { \ 133 | DbgPrintHexDump((PUCHAR)(pBuf), (ULONG)(Len)); \ 134 | } \ 135 | } 136 | 137 | #define NPROT_ASSERT(exp) \ 138 | { \ 139 | if (!(exp)) \ 140 | { \ 141 | DbgPrint("Wtapdrv: assert " #exp " failed in" \ 142 | " file %s, line %d\n", __FILE__, __LINE__); \ 143 | DbgBreakPoint(); \ 144 | } \ 145 | } 146 | 147 | #define NPROT_SET_SIGNATURE(s, t)\ 148 | (s)->t##_sig = t##_signature; 149 | 150 | #define NPROT_STRUCT_ASSERT(s, t) \ 151 | if ((s)->t##_sig != t##_signature) \ 152 | { \ 153 | DbgPrint("Wtapdrv: assertion failure" \ 154 | " for type " #t " at 0x%p in file %s, line %d\n", \ 155 | s, __FILE__, __LINE__); \ 156 | DbgBreakPoint(); \ 157 | } 158 | 159 | 160 | // 161 | // Memory Allocation/Freeing Audit: 162 | // 163 | 164 | // 165 | // The NPROTD_ALLOCATION structure stores all info about one allocation 166 | // 167 | typedef struct _NPROTD_ALLOCATION { 168 | 169 | ULONG Signature; 170 | struct _NPROTD_ALLOCATION *Next; 171 | struct _NPROTD_ALLOCATION *Prev; 172 | ULONG FileNumber; 173 | ULONG LineNumber; 174 | ULONG Size; 175 | ULONG_PTR Location; // where the returned ptr was stored 176 | union 177 | { 178 | ULONGLONG Alignment; 179 | UCHAR UserData; 180 | }; 181 | 182 | } NPROTD_ALLOCATION, *PNPROTD_ALLOCATION; 183 | 184 | #define NPROTD_MEMORY_SIGNATURE (ULONG)'CSII' 185 | 186 | extern 187 | PVOID 188 | ndisprotAuditAllocMem ( 189 | PVOID pPointer, 190 | ULONG Size, 191 | ULONG FileNumber, 192 | ULONG LineNumber 193 | ); 194 | 195 | extern 196 | VOID 197 | ndisprotAuditFreeMem( 198 | PVOID Pointer 199 | ); 200 | 201 | extern 202 | VOID 203 | ndisprotAuditShutdown( 204 | VOID 205 | ); 206 | 207 | extern 208 | VOID 209 | DbgPrintHexDump( 210 | PUCHAR pBuffer, 211 | ULONG Length 212 | ); 213 | 214 | #else 215 | 216 | // 217 | // No debug 218 | // 219 | #define DEBUGP(lev, stmt) 220 | #define DEBUGPDUMP(lev, pBuf, Len) 221 | 222 | #define NPROT_ASSERT(exp) 223 | #define NPROT_SET_SIGNATURE(s, t) UNREFERENCED_PARAMETER(s) 224 | #define NPROT_STRUCT_ASSERT(s, t) UNREFERENCED_PARAMETER(s) 225 | 226 | #endif // DBG 227 | 228 | 229 | #endif // _NPROTDEBUG__H 230 | -------------------------------------------------------------------------------- /code/sys/excallbk.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2015, Defensive Depth (Defensivedepth.com) 3 | * 4 | * All rights reserved. 5 | * 6 | * This file is part of WinTAP. 7 | * WinTAP is dual-licensed under the MIT License http://opensource.org/licenses/MIT, 8 | * as well as the GNU General Public License, version 3. 9 | * 10 | * GPL 3: 11 | * WinTAP is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * WinTAP is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with WinTAP. If not, see . 23 | * 24 | * 25 | */ 26 | 27 | /* 28 | Abstract: The routines in this module helps to solve driver load order 29 | dependency between this sample and NDISWDM sample. These 30 | routines are not required in a typical protocol driver. By default 31 | this module is not included in the sample. You include these routines 32 | by adding EX_CALLBACK defines to the 'sources' file. Read the 33 | NDISWDM samples readme file for more information on how ExCallback 34 | kernel interfaces are used to solve driver load order issue. 35 | */ 36 | 37 | #include "precomp.h" 38 | 39 | #ifdef EX_CALLBACK 40 | 41 | #define __FILENUMBER 'LCxE' 42 | 43 | #define NDISPROT_CALLBACK_NAME L"\\Callback\\NdisProtCallbackObject" 44 | 45 | #define CALLBACK_SOURCE_NDISPROT 0 46 | #define CALLBACK_SOURCE_NDISWDM 1 47 | 48 | PCALLBACK_OBJECT CallbackObject = NULL; 49 | PVOID CallbackRegisterationHandle = NULL; 50 | 51 | typedef VOID (* NOTIFY_PRESENCE_CALLBACK)(OUT PVOID Source); 52 | 53 | #ifdef ALLOC_PRAGMA 54 | 55 | #pragma alloc_text(PAGE, ndisprotRegisterExCallBack) 56 | #pragma alloc_text(PAGE, ndisprotUnregisterExCallBack) 57 | 58 | #endif // ALLOC_PRAGMA 59 | 60 | BOOLEAN 61 | ndisprotRegisterExCallBack() 62 | { 63 | OBJECT_ATTRIBUTES ObjectAttr; 64 | UNICODE_STRING CallBackObjectName; 65 | NTSTATUS Status; 66 | BOOLEAN bResult = TRUE; 67 | 68 | DEBUGP(DL_LOUD, ("--> ndisprotRegisterExCallBack\n")); 69 | 70 | PAGED_CODE(); 71 | 72 | do { 73 | 74 | RtlInitUnicodeString(&CallBackObjectName, NDISPROT_CALLBACK_NAME); 75 | 76 | InitializeObjectAttributes(&ObjectAttr, 77 | &CallBackObjectName, 78 | OBJ_CASE_INSENSITIVE | OBJ_PERMANENT, 79 | NULL, 80 | NULL); 81 | 82 | Status = ExCreateCallback(&CallbackObject, 83 | &ObjectAttr, 84 | TRUE, 85 | TRUE); 86 | 87 | 88 | if (!NT_SUCCESS(Status)) 89 | { 90 | 91 | DEBUGP(DL_ERROR, ("RegisterExCallBack: failed to create callback %lx\n", Status)); 92 | bResult = FALSE; 93 | break; 94 | } 95 | 96 | CallbackRegisterationHandle = ExRegisterCallback(CallbackObject, 97 | ndisprotCallback, 98 | (PVOID)NULL); 99 | if (CallbackRegisterationHandle == NULL) 100 | { 101 | DEBUGP(DL_ERROR,("RegisterExCallBack: failed to register a Callback routine%lx\n", Status)); 102 | bResult = FALSE; 103 | break; 104 | } 105 | 106 | ExNotifyCallback(CallbackObject, 107 | (PVOID)CALLBACK_SOURCE_NDISPROT, 108 | (PVOID)NULL); 109 | 110 | 111 | }while(FALSE); 112 | 113 | if(!bResult) { 114 | if (CallbackRegisterationHandle) 115 | { 116 | ExUnregisterCallback(CallbackRegisterationHandle); 117 | CallbackRegisterationHandle = NULL; 118 | } 119 | 120 | if (CallbackObject) 121 | { 122 | ObDereferenceObject(CallbackObject); 123 | CallbackObject = NULL; 124 | } 125 | } 126 | 127 | DEBUGP(DL_LOUD, ("<-- ndisprotRegisterExCallBack\n")); 128 | 129 | return bResult; 130 | 131 | } 132 | 133 | VOID 134 | ndisprotUnregisterExCallBack() 135 | { 136 | DEBUGP(DL_LOUD, ("--> ndisprotUnregisterExCallBack\n")); 137 | 138 | PAGED_CODE(); 139 | 140 | if (CallbackRegisterationHandle) 141 | { 142 | ExUnregisterCallback(CallbackRegisterationHandle); 143 | CallbackRegisterationHandle = NULL; 144 | } 145 | 146 | if (CallbackObject) 147 | { 148 | ObDereferenceObject(CallbackObject); 149 | CallbackObject = NULL; 150 | } 151 | 152 | DEBUGP(DL_LOUD, ("<-- ndisprotUnregisterExCallBack\n")); 153 | 154 | } 155 | 156 | VOID 157 | ndisprotCallback( 158 | PVOID CallBackContext, 159 | PVOID Source, 160 | PVOID CallbackAddr 161 | ) 162 | { 163 | NOTIFY_PRESENCE_CALLBACK func; 164 | 165 | DEBUGP(DL_LOUD, ("==>ndisprotoCallback: Source %lx, CallbackAddr %p\n", 166 | Source, CallbackAddr)); 167 | 168 | // 169 | // if we are the one issuing this notification, just return 170 | // 171 | if (Source == CALLBACK_SOURCE_NDISPROT) { 172 | return; 173 | } 174 | 175 | // 176 | // Notification is coming from NDISWDM 177 | // let it know that you are here 178 | // 179 | ASSERT(Source == (PVOID)CALLBACK_SOURCE_NDISWDM); 180 | 181 | if(Source == (PVOID)CALLBACK_SOURCE_NDISWDM) { 182 | 183 | ASSERT(CallbackAddr); 184 | 185 | if (CallbackAddr == NULL) 186 | { 187 | DEBUGP(DL_ERROR, ("Callback called with invalid address %p\n", CallbackAddr)); 188 | return; 189 | } 190 | 191 | func = CallbackAddr; 192 | 193 | func(CALLBACK_SOURCE_NDISPROT); 194 | } 195 | 196 | DEBUGP(DL_LOUD, ("<==ndisprotoCallback: Source, %lx\n", Source)); 197 | 198 | } 199 | 200 | #endif 201 | -------------------------------------------------------------------------------- /code/sys/macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2015, Defensive Depth (Defensivedepth.com) 3 | * 4 | * All rights reserved. 5 | * 6 | * This file is part of WinTAP. 7 | * WinTAP is dual-licensed under the MIT License http://opensource.org/licenses/MIT, 8 | * as well as the GNU General Public License, version 3. 9 | * 10 | * GPL 3: 11 | * WinTAP is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * WinTAP is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with WinTAP. If not, see . 23 | * 24 | * 25 | */ 26 | 27 | // Some macros for WinTap. 28 | 29 | 30 | #ifndef MIN 31 | #define MIN(_a, _b) ((_a) < (_b)? (_a): (_b)) 32 | #endif 33 | 34 | #if DBG 35 | #define NPROT_REF_OPEN(_pOpen) ndisprotDbgRefOpen(_pOpen, __FILENUMBER, __LINE__) 36 | #define NPROT_DEREF_OPEN(_pOpen) ndisprotDbgDerefOpen(_pOpen, __FILENUMBER, __LINE__) 37 | #else 38 | #define NPROT_REF_OPEN(_pOpen) ndisprotRefOpen(_pOpen) 39 | #define NPROT_DEREF_OPEN(_pOpen) ndisprotDerefOpen(_pOpen) 40 | #endif 41 | 42 | 43 | // 44 | // Spinlock macros 45 | // 46 | #if DBG_SPIN_LOCK 47 | 48 | #define NPROT_INIT_LOCK(_pLock) \ 49 | ndisprotAllocateSpinLock(_pLock, __FILENUMBER, __LINE__) 50 | 51 | #define NPROT_ACQUIRE_LOCK(_pLock, DispatchLevel) \ 52 | ndisprotAcquireSpinLock(_pLock, DispatchLevel,__FILENUMBER, __LINE__) 53 | 54 | #define NPROT_RELEASE_LOCK(_pLock,DispatchLevel) \ 55 | ndisprotReleaseSpinLock(_pLock, DispatchLevel,__FILENUMBER, __LINE__) 56 | 57 | #define NPROT_FREE_LOCK(_pLock) \ 58 | ndisprotFreeSpinLock(_pLock, __FILENUMBER, __LINE__) 59 | 60 | #define NPROT_FREE_DBG_LOCK() \ 61 | ndisprotFreeDbgLock() 62 | #else 63 | 64 | #define NPROT_INIT_LOCK(_pLock) NdisAllocateSpinLock(_pLock) 65 | #define NPROT_ACQUIRE_LOCK(_pLock, DispatchLevel) \ 66 | { \ 67 | if (DispatchLevel == TRUE) \ 68 | { \ 69 | NdisDprAcquireSpinLock(_pLock); \ 70 | } \ 71 | else \ 72 | { \ 73 | NdisAcquireSpinLock(_pLock); \ 74 | } \ 75 | } 76 | #define NPROT_RELEASE_LOCK(_pLock, DispatchLevel) \ 77 | { \ 78 | if (DispatchLevel == TRUE) \ 79 | { \ 80 | NdisDprReleaseSpinLock(_pLock); \ 81 | } \ 82 | else \ 83 | { \ 84 | NdisReleaseSpinLock(_pLock); \ 85 | } \ 86 | } 87 | 88 | #define NPROT_FREE_LOCK(_pLock) NdisFreeSpinLock(_pLock) 89 | 90 | #define NPROT_FREE_DBG_LOCK() 91 | 92 | #endif // DBG 93 | 94 | // 95 | // List manipulation. 96 | // 97 | #define NPROT_INIT_LIST_HEAD(_pList) InitializeListHead(_pList) 98 | #define NPROT_IS_LIST_EMPTY(_pList) IsListEmpty(_pList) 99 | #define NPROT_INSERT_HEAD_LIST(_pList, _pEnt) InsertHeadList(_pList, _pEnt) 100 | #define NPROT_INSERT_TAIL_LIST(_pList, _pEnt) InsertTailList(_pList, _pEnt) 101 | #define NPROT_REMOVE_ENTRY_LIST(_pEnt) RemoveEntryList(_pEnt) 102 | #define NPROT_REMOVE_HEAD_LIST(_pList) RemoveHeadList(_pList) 103 | 104 | 105 | 106 | #define NPROT_RCV_NBL_TO_LIST_ENTRY(_pNbl) \ 107 | (&((PNPROT_RECV_NBL_RSVD)(NET_BUFFER_LIST_PROTOCOL_RESERVED(_pNbl)))->Link) 108 | 109 | #define NPROT_RCV_NBL_FROM_LIST_ENTRY(_pEnt) \ 110 | (((PNPROT_RECV_NBL_RSVD)(CONTAINING_RECORD(_pEnt, NPROT_RECV_NBL_RSVD, Link)))->pNetBufferList) 111 | 112 | 113 | // 114 | // Send net buffer list context 115 | // 116 | #define NPROT_IRP_FROM_SEND_NBL(_pNbl) \ 117 | (((PNPROT_SEND_NETBUFLIST_RSVD)((_pNbl)->Context->ContextData + (_pNbl)->Context->Offset))->pIrp) 118 | 119 | #define NPROT_SEND_NBL_RSVD(_pNbl) \ 120 | ((PNPROT_SEND_NETBUFLIST_RSVD)((_pNbl)->Context->ContextData + (_pNbl)->Context->Offset)) 121 | 122 | 123 | #define NPROT_REF_SEND_NBL(_pNbl) \ 124 | (VOID)NdisInterlockedIncrement((PLONG)&NPROT_SEND_NBL_RSVD(_pNbl)->RefCount) 125 | 126 | 127 | #define NPROT_DEREF_SEND_NBL(_pNbl, DispatchLevel) \ 128 | { \ 129 | if (NdisInterlockedDecrement((PLONG)&NPROT_SEND_NBL_RSVD(_pNbl)->RefCount) == 0) \ 130 | { \ 131 | NdisFreeNetBufferList(_pNbl); \ 132 | } \ 133 | } 134 | 135 | // 136 | // Cancel IDs are generated by using the partial cancel ID we got from 137 | // NDIS ORed with a monotonically increasing locally generated ID. 138 | // 139 | #define NPROT_CANCEL_ID_LOW_MASK (((ULONG_PTR)-1) >> 8) 140 | 141 | #define NPROT_GET_NEXT_CANCEL_ID() \ 142 | (PVOID)(Globals.PartialCancelId | \ 143 | ((NdisInterlockedIncrement((PLONG)&Globals.LocalCancelId)) & NPROT_CANCEL_ID_LOW_MASK)) 144 | 145 | 146 | // 147 | // Memory allocation 148 | // 149 | #if DBG 150 | #define NPROT_ALLOC_MEM(_pVar, _Size) \ 151 | (_pVar) = ndisprotAuditAllocMem( \ 152 | (PVOID)&(_pVar), \ 153 | _Size, \ 154 | __FILENUMBER, \ 155 | __LINE__); 156 | 157 | #define NPROT_FREE_MEM(_pMem) \ 158 | ndisprotAuditFreeMem(_pMem); 159 | 160 | #else 161 | 162 | #define NPROT_ALLOC_MEM(_pVar, _Size) \ 163 | NdisAllocateMemoryWithTag((PVOID *)(&_pVar), (_Size), NPROT_ALLOC_TAG) 164 | 165 | #define NPROT_FREE_MEM(_pMem) \ 166 | NdisFreeMemory(_pMem, 0, 0) 167 | 168 | #endif // DBG 169 | 170 | 171 | #define NPROT_ZERO_MEM(_pMem, _ByteCount) \ 172 | NdisZeroMemory(_pMem, _ByteCount) 173 | 174 | #define NPROT_COPY_MEM(_pDst, _pSrc, _ByteCount) \ 175 | NdisMoveMemory(_pDst, _pSrc, _ByteCount) 176 | 177 | #define NPROT_MEM_CMP(_p1, _p2, _ByteCount) \ 178 | NdisEqualMemory(_p1, _p2, _ByteCount) 179 | 180 | #define NPROT_SET_MEM(_pMem, _ByteVal, _ByteCount) \ 181 | NdisFillMemory(_pMem, _ByteCount, _ByteVal) 182 | 183 | // 184 | // Events. 185 | // 186 | #define NPROT_INIT_EVENT(_pEvent) NdisInitializeEvent(_pEvent) 187 | #define NPROT_SIGNAL_EVENT(_pEvent) NdisSetEvent(_pEvent) 188 | #define NPROT_WAIT_EVENT(_pEvent, _MsToWait) NdisWaitEvent(_pEvent, _MsToWait) 189 | 190 | 191 | // 192 | // Flags 193 | // 194 | #define NPROT_SET_FLAGS(_FlagsVar, _Mask, _BitsToSet) \ 195 | (_FlagsVar) = ((_FlagsVar) & ~(_Mask)) | (_BitsToSet) 196 | 197 | #define NPROT_TEST_FLAGS(_FlagsVar, _Mask, _BitsToCheck) \ 198 | (((_FlagsVar) & (_Mask)) == (_BitsToCheck)) 199 | 200 | 201 | #define NDIS_STATUS_TO_NT_STATUS(_NdisStatus, _pNtStatus) \ 202 | { \ 203 | /* \ 204 | * The following NDIS status codes map directly to NT status codes. \ 205 | */ \ 206 | if (((NDIS_STATUS_SUCCESS == (_NdisStatus)) || \ 207 | (NDIS_STATUS_PENDING == (_NdisStatus)) || \ 208 | (NDIS_STATUS_BUFFER_OVERFLOW == (_NdisStatus)) || \ 209 | (NDIS_STATUS_FAILURE == (_NdisStatus)) || \ 210 | (NDIS_STATUS_RESOURCES == (_NdisStatus)) || \ 211 | (NDIS_STATUS_NOT_SUPPORTED == (_NdisStatus)))) \ 212 | { \ 213 | *(_pNtStatus) = (NTSTATUS)(_NdisStatus); \ 214 | } \ 215 | else if (NDIS_STATUS_BUFFER_TOO_SHORT == (_NdisStatus)) \ 216 | { \ 217 | /* \ 218 | * The above NDIS status codes require a little special casing. \ 219 | */ \ 220 | *(_pNtStatus) = STATUS_BUFFER_TOO_SMALL; \ 221 | } \ 222 | else if (NDIS_STATUS_INVALID_LENGTH == (_NdisStatus)) \ 223 | { \ 224 | *(_pNtStatus) = STATUS_INVALID_BUFFER_SIZE; \ 225 | } \ 226 | else if (NDIS_STATUS_INVALID_DATA == (_NdisStatus)) \ 227 | { \ 228 | *(_pNtStatus) = STATUS_INVALID_PARAMETER; \ 229 | } \ 230 | else if (NDIS_STATUS_ADAPTER_NOT_FOUND == (_NdisStatus)) \ 231 | { \ 232 | *(_pNtStatus) = STATUS_NO_MORE_ENTRIES; \ 233 | } \ 234 | else if (NDIS_STATUS_ADAPTER_NOT_READY == (_NdisStatus)) \ 235 | { \ 236 | *(_pNtStatus) = STATUS_DEVICE_NOT_READY; \ 237 | } \ 238 | else \ 239 | { \ 240 | *(_pNtStatus) = STATUS_UNSUCCESSFUL; \ 241 | } \ 242 | } 243 | -------------------------------------------------------------------------------- /code/sys/precomp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2015, Defensive Depth (Defensivedepth.com) 3 | * 4 | * All rights reserved. 5 | * 6 | * This file is part of WinTAP. 7 | * WinTAP is dual-licensed under the MIT License http://opensource.org/licenses/MIT, 8 | * as well as the GNU General Public License, version 3. 9 | * 10 | * GPL 3: 11 | * WinTAP is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * WinTAP is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with WinTAP. If not, see . 23 | * 24 | * 25 | */ 26 | 27 | #pragma warning(disable:4214) // bit field types other than int 28 | 29 | #pragma warning(disable:4201) // nameless struct/union 30 | #pragma warning(disable:4115) // named type definition in parentheses 31 | #pragma warning(disable:4127) // conditional expression is constant 32 | #pragma warning(disable:4054) // cast of function pointer to PVOID 33 | #pragma warning(disable:4244) // conversion from 'int' to 'BOOLEAN', possible loss of data 34 | #pragma warning(disable:4206) // nonstandard extension used : translation unit is empty 35 | 36 | #include "ndis.h" 37 | #include "ntddk.h" 38 | #include 39 | #include 40 | #include 41 | #include "debug.h" 42 | #include "ndisprot.h" 43 | #include "macros.h" 44 | #include "protuser.h" 45 | 46 | #if DBG 47 | #include 48 | #endif 49 | -------------------------------------------------------------------------------- /code/sys/protuser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2015, Defensive Depth (Defensivedepth.com) 3 | * 4 | * All rights reserved. 5 | * 6 | * This file is part of WinTAP. 7 | * WinTAP is dual-licensed under the MIT License http://opensource.org/licenses/MIT, 8 | * as well as the GNU General Public License, version 3. 9 | * 10 | * GPL 3: 11 | * WinTAP is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * WinTAP is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with WinTAP. If not, see . 23 | * 24 | * 25 | */ 26 | 27 | // Constants and types to access the WinTap driver. 28 | // Users must also include ntddndis.h 29 | 30 | #ifndef __NPROTUSER__H 31 | #define __NPROTUSER__H 32 | 33 | 34 | #define FSCTL_NDISPROT_BASE FILE_DEVICE_NETWORK 35 | 36 | #define _NDISPROT_CTL_CODE(_Function, _Method, _Access) \ 37 | CTL_CODE(FSCTL_NDISPROT_BASE, _Function, _Method, _Access) 38 | 39 | #define IOCTL_NDISPROT_OPEN_DEVICE \ 40 | _NDISPROT_CTL_CODE(0x200, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 41 | 42 | #define IOCTL_NDISPROT_QUERY_OID_VALUE \ 43 | _NDISPROT_CTL_CODE(0x201, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 44 | 45 | #define IOCTL_NDISPROT_SET_OID_VALUE \ 46 | _NDISPROT_CTL_CODE(0x205, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 47 | 48 | #define IOCTL_NDISPROT_QUERY_BINDING \ 49 | _NDISPROT_CTL_CODE(0x203, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 50 | 51 | #define IOCTL_NDISPROT_BIND_WAIT \ 52 | _NDISPROT_CTL_CODE(0x204, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 53 | 54 | 55 | 56 | 57 | // 58 | // Structure to go with IOCTL_NDISPROT_QUERY_OID_VALUE. 59 | // The Data part is of variable length, determined by 60 | // the input buffer length passed to DeviceIoControl. 61 | // 62 | typedef struct _NDISPROT_QUERY_OID 63 | { 64 | NDIS_OID Oid; 65 | NDIS_PORT_NUMBER PortNumber; 66 | UCHAR Data[sizeof(ULONG)]; 67 | } NDISPROT_QUERY_OID, *PNDISPROT_QUERY_OID; 68 | 69 | // 70 | // Structure to go with IOCTL_NDISPROT_SET_OID_VALUE. 71 | // The Data part is of variable length, determined 72 | // by the input buffer length passed to DeviceIoControl. 73 | // 74 | typedef struct _NDISPROT_SET_OID 75 | { 76 | NDIS_OID Oid; 77 | NDIS_PORT_NUMBER PortNumber; 78 | UCHAR Data[sizeof(ULONG)]; 79 | } NDISPROT_SET_OID, *PNDISPROT_SET_OID; 80 | 81 | 82 | // 83 | // Structure to go with IOCTL_NDISPROT_QUERY_BINDING. 84 | // The input parameter is BindingIndex, which is the 85 | // index into the list of bindings active at the driver. 86 | // On successful completion, we get back a device name 87 | // and a device descriptor (friendly name). 88 | // 89 | typedef struct _NDISPROT_QUERY_BINDING 90 | { 91 | ULONG BindingIndex; // 0-based binding number 92 | ULONG DeviceNameOffset; // from start of this struct 93 | ULONG DeviceNameLength; // in bytes 94 | ULONG DeviceDescrOffset; // from start of this struct 95 | ULONG DeviceDescrLength; // in bytes 96 | 97 | } NDISPROT_QUERY_BINDING, *PNDISPROT_QUERY_BINDING; 98 | 99 | #endif // __NPROTUSER__H 100 | 101 | -------------------------------------------------------------------------------- /code/test/prottest.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Win8 Debug 6 | Win32 7 | 8 | 9 | Win7 Debug 10 | Win32 11 | 12 | 13 | Vista Debug 14 | Win32 15 | 16 | 17 | Win8 Release 18 | Win32 19 | 20 | 21 | Win7 Release 22 | Win32 23 | 24 | 25 | Vista Release 26 | Win32 27 | 28 | 29 | Win8 Debug 30 | x64 31 | 32 | 33 | Win7 Debug 34 | x64 35 | 36 | 37 | Vista Debug 38 | x64 39 | 40 | 41 | Win8 Release 42 | x64 43 | 44 | 45 | Win7 Release 46 | x64 47 | 48 | 49 | Vista Release 50 | x64 51 | 52 | 53 | 54 | 55 | WindowsApplicationForDrivers8.0 56 | Application 57 | 58 | 59 | $(VCTargetsPath11) 60 | Win8 Debug 61 | Win32 62 | DbgengKernelDebugger 63 | DbgengRemoteDebugger 64 | {32CD42FF-6B1A-42F9-A612-3B33A3C7703D} 65 | 66 | 67 | 68 | {103384F3-2DF5-4366-B5F6-BA75D5FC701F} 69 | $(MSBuildProjectName) 70 | 71 | 72 | Win8 73 | True 74 | 75 | 76 | Win7 77 | True 78 | 79 | 80 | Vista 81 | True 82 | 83 | 84 | Win8 85 | False 86 | 87 | 88 | Win7 89 | False 90 | 91 | 92 | Vista 93 | False 94 | 95 | 96 | Win8 97 | True 98 | 99 | 100 | Win7 101 | True 102 | 103 | 104 | Vista 105 | True 106 | 107 | 108 | Win8 109 | False 110 | 111 | 112 | Win7 113 | False 114 | 115 | 116 | Vista 117 | False 118 | 119 | 120 | 121 | $(IntDir) 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | prottest 162 | 163 | 164 | 165 | %(PreprocessorDefinitions);UNICODE=1 166 | %(PreprocessorDefinitions);_UNICODE=1 167 | %(PreprocessorDefinitions);_WIN32WIN_ 168 | Level4 169 | 170 | 171 | %(PreprocessorDefinitions);UNICODE=1 172 | %(PreprocessorDefinitions);_UNICODE=1 173 | %(PreprocessorDefinitions);_WIN32WIN_ 174 | 175 | 176 | %(PreprocessorDefinitions);UNICODE=1 177 | %(PreprocessorDefinitions);_UNICODE=1 178 | %(PreprocessorDefinitions);_WIN32WIN_ 179 | 180 | 181 | 182 | 183 | %(AdditionalDependencies);user32.lib 184 | 185 | 186 | %(AdditionalIncludeDirectories);..\sys 187 | 188 | 189 | %(AdditionalIncludeDirectories);..\sys 190 | 191 | 192 | 193 | 194 | %(AdditionalIncludeDirectories);..\sys 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | -------------------------------------------------------------------------------- /code/test/prottest.vcxproj.Filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | {7C9CEBD4-EA40-4766-9EF6-0BE5A1CE50D6} 7 | 8 | 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | {B0C3ABA6-A9FE-4F83-82FA-5C850A8F5274} 11 | 12 | 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 14 | {84AAF542-54C5-45FD-90A4-E30BDF6113EA} 15 | 16 | 17 | -------------------------------------------------------------------------------- /code/test/prottest.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /code/wintap.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/code/wintap.htm -------------------------------------------------------------------------------- /code/wintap.v11.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/code/wintap.v11.suo -------------------------------------------------------------------------------- /code/wintap/wintap.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Win8 Debug 6 | Win32 7 | 8 | 9 | Win7 Debug 10 | Win32 11 | 12 | 13 | Vista Debug 14 | Win32 15 | 16 | 17 | Win8 Release 18 | Win32 19 | 20 | 21 | Win7 Release 22 | Win32 23 | 24 | 25 | Vista Release 26 | Win32 27 | 28 | 29 | Win8 Debug 30 | x64 31 | 32 | 33 | Win7 Debug 34 | x64 35 | 36 | 37 | Vista Debug 38 | x64 39 | 40 | 41 | Win8 Release 42 | x64 43 | 44 | 45 | Win7 Release 46 | x64 47 | 48 | 49 | Vista Release 50 | x64 51 | 52 | 53 | 54 | 55 | WindowsApplicationForDrivers8.0 56 | Application 57 | 58 | 59 | $(VCTargetsPath11) 60 | Win8 Debug 61 | Win32 62 | DbgengKernelDebugger 63 | DbgengRemoteDebugger 64 | {32CD42FF-6B1A-42F9-A612-3B33A3C7703D} 65 | 66 | 67 | 68 | {4AAAAB44-4C4E-413C-A916-B87DAE084FC1} 69 | $(MSBuildProjectName) 70 | 71 | 72 | Win8 73 | True 74 | 75 | 76 | Win7 77 | True 78 | 79 | 80 | Vista 81 | True 82 | 83 | 84 | Win8 85 | False 86 | 87 | 88 | Win7 89 | False 90 | 91 | 92 | Vista 93 | False 94 | 95 | 96 | Win8 97 | True 98 | 99 | 100 | Win7 101 | True 102 | 103 | 104 | Vista 105 | True 106 | 107 | 108 | Win8 109 | False 110 | 111 | 112 | Win7 113 | False 114 | 115 | 116 | Vista 117 | False 118 | 119 | 120 | 121 | $(IntDir) 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | wintap 161 | 162 | 163 | true 164 | 165 | 166 | 167 | %(PreprocessorDefinitions);UNICODE=1 168 | %(PreprocessorDefinitions);_UNICODE=1 169 | %(PreprocessorDefinitions);_WIN32WIN_ 170 | Level4 171 | 172 | 173 | %(PreprocessorDefinitions);UNICODE=1 174 | %(PreprocessorDefinitions);_UNICODE=1 175 | %(PreprocessorDefinitions);_WIN32WIN_ 176 | 177 | 178 | %(PreprocessorDefinitions);UNICODE=1 179 | %(PreprocessorDefinitions);_UNICODE=1 180 | %(PreprocessorDefinitions);_WIN32WIN_ 181 | 182 | 183 | 184 | 185 | %(AdditionalDependencies);user32.lib 186 | RequireAdministrator 187 | 188 | 189 | %(AdditionalIncludeDirectories);..\sys 190 | 191 | 192 | %(AdditionalIncludeDirectories);..\sys 193 | 194 | 195 | true 196 | Cdecl 197 | true 198 | 199 | 200 | %(AdditionalIncludeDirectories);..\sys 201 | 202 | 203 | true 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | -------------------------------------------------------------------------------- /code/wintap/wintap.vcxproj.Filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | {7C9CEBD4-EA40-4766-9EF6-0BE5A1CE50D6} 7 | 8 | 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | {B0C3ABA6-A9FE-4F83-82FA-5C850A8F5274} 11 | 12 | 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 14 | {84AAF542-54C5-45FD-90A4-E30BDF6113EA} 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /code/wintap/wintap.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | true 5 | 6 | -------------------------------------------------------------------------------- /code/x64/VistaDebug/package.cer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/code/x64/VistaDebug/package.cer -------------------------------------------------------------------------------- /code/x64/VistaDebug/prottest.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/code/x64/VistaDebug/prottest.exe -------------------------------------------------------------------------------- /code/x64/VistaDebug/setup.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/code/x64/VistaDebug/setup.exe -------------------------------------------------------------------------------- /code/x64/VistaDebug/setup.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/code/x64/VistaDebug/setup.pdb -------------------------------------------------------------------------------- /code/x64/VistaDebug/wintap.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/code/x64/VistaDebug/wintap.exe -------------------------------------------------------------------------------- /code/x64/VistaDebug/wintap.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/code/x64/VistaDebug/wintap.pdb -------------------------------------------------------------------------------- /code/x64/VistaDebug/wtapdrv.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/code/x64/VistaDebug/wtapdrv.cat -------------------------------------------------------------------------------- /code/x64/VistaDebug/wtapdrv.inf: -------------------------------------------------------------------------------- 1 | ;------------------------------------------------------------------------- 2 | ; WTAPDRV.INF -- WinTap Protocol Driver 3 | ; 4 | ; Copyright 2013-2015, Defensive Depth (Defensivedepth.com) 5 | ; 6 | ; This file is part of WinTAP. 7 | ; WinTAP is dual-licensed under the MIT License http://opensource.org/licenses/MIT, 8 | ; as well as the GNU General Public License, version 3. 9 | ; 10 | ; GPL 3: 11 | ; WinTAP is free software: you can redistribute it and/or modify 12 | ; it under the terms of the GNU General Public License as published by 13 | ; the Free Software Foundation, either version 3 of the License, or 14 | ; (at your option) any later version. 15 | ; 16 | ; WinTAP is distributed in the hope that it will be useful, 17 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ; GNU General Public License for more details. 20 | ; 21 | ; You should have received a copy of the GNU General Public License 22 | ; along with WinTAP. If not, see . 23 | ;------------------------------------------------------------------------- 24 | [version] 25 | Signature = "$Windows NT$" 26 | Class = NetTrans 27 | ClassGUID = {4d36e975-e325-11ce-bfc1-08002be10318} 28 | Provider = %Mfg% 29 | DriverVer=05/08/2013,7.25.41.695 30 | CatalogFile = wtapdrv.cat 31 | 32 | 33 | [Manufacturer] 34 | %Mfg%=WTAP,NTx86,NTia64,NTamd64 35 | 36 | [WTAP.NTx86] 37 | %Svc_Desc%=Install, WINTAP_TAPROTO 38 | 39 | [WTAP.NTia64] 40 | %Svc_Desc%=Install, WINTAP_TAPROTO 41 | 42 | [WTAP.NTamd64] 43 | %Svc_Desc%=Install, WINTAP_TAPROTO 44 | 45 | ;------------------------------------------------------------------------- 46 | ; Installation Section 47 | ;------------------------------------------------------------------------- 48 | [Install] 49 | AddReg=Inst_Ndi 50 | Characteristics=0x0 ; 51 | CopyFiles=CpyFiles_Sys 52 | 53 | ;------------------------------------------------------------------------- 54 | ; Ndi installation support 55 | ;------------------------------------------------------------------------- 56 | [Inst_Ndi] 57 | HKR,Ndi,Service,,"wintap" 58 | HKR,Ndi,HelpText,,%Svc_HelpText% 59 | HKR,Ndi\Interfaces, UpperRange,, noupper 60 | HKR,"Ndi\Interfaces","LowerRange",,"ndis5,ndis4,ndis5_prot" 61 | 62 | ;------------------------------------------------------------------------- 63 | ; Service installation support 64 | ;------------------------------------------------------------------------- 65 | [Install.Services] 66 | AddService=wintap,,WinTap_Service_Inst 67 | 68 | [WinTap_Service_Inst] 69 | DisplayName = %Svc_Desc% 70 | ServiceType = 1 ;SERVICE_KERNEL_DRIVER 71 | StartType = 2 ;SERVICE_AUTO_START 72 | ErrorControl = 1 ;SERVICE_ERROR_NORMAL 73 | ServiceBinary = %12%\wtapdrv.sys 74 | LoadOrderGroup = NDIS 75 | Description = %Svc_Desc% 76 | 77 | [Install.Remove.Services] 78 | DelService=wintap,0x200 79 | 80 | ;------------------------------------------------------------------------- 81 | ; Declare Destination Directories for file copy/deletion 82 | ;------------------------------------------------------------------------- 83 | [SourceDisksNames] 84 | 1=%DiskDescription%,"",, 85 | 86 | [SourceDisksFiles] 87 | wtapdrv.sys=1 88 | 89 | 90 | [DestinationDirs] 91 | CpyFiles_Sys = 12 ; DIRID_DRIVERS 92 | 93 | 94 | ;------------------------------------------------------------------------- 95 | ; Files to Copy/Delete - Referenced by Install and Remove sections above 96 | ;------------------------------------------------------------------------- 97 | [CpyFiles_Sys] 98 | wtapdrv.sys,,,2 99 | 100 | [Strings] 101 | Mfg = "Aczire Solutions" 102 | DiskDescription = "WinTap Protocol Driver Disk" 103 | Svc_Desc = "WinTap Protocol Driver" 104 | Svc_HelpText = "WinTap driver to support user-mode I/O on NICs" 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /code/x64/VistaDebug/wtapdrv.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/code/x64/VistaDebug/wtapdrv.pdb -------------------------------------------------------------------------------- /code/x64/VistaDebug/wtapdrv.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/code/x64/VistaDebug/wtapdrv.sys -------------------------------------------------------------------------------- /description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | WinTap Protocol Driver v1.1 8 | 9 | 10 | 11 | 24 | 25 | 26 |
27 |

WinTap Protocol Driver v1.1

28 | 114 |
115 | 126 |
127 |

WinTap (wtapdrv.sys) is a connection-less NDIS 6.0 protocol driver to support user-mode mirroring of raw ethernet frames from one network device to another. The wintap.exe is the user-mode application program which setup a uni-directional, user-level bridge to create a soft-tap, like daemonlogger. It opens the source and destination adapters specified by the user and starts copying all ethernet frames from source to destination. I.e, it receives packets from adapter 1 and sends them down to adapter 2. During the mirroring process, the ethernet frames are re-written to match the destination adapter's MAC.

128 |

To Build WinTap

129 |

130 | The source code for WinTap is available for download at 131 |

132 | 133 | https://github.com/aczire/wintap 134 |
135 | To build the WinTap package from source: 136 |
    137 |
  1. Download and install the Visual Studio 2012.
  2. 138 |
  3. Download and install the latest Windows Driver Kit.
  4. 139 |
  5. Open wintap.sln in Visual Studio 2012.
  6. 140 |
  7. Rebuild the solution. 141 |

    This will build the following files and place them in the 142 | <SolutionDir>\<Platform>\<ConfigurationName>\Package subdirectory:

    143 |
      144 |
    • wtapdrv.sys: Kernel-mode driver.
    • 145 |
    • wtapdrv.inf: INF file for wtapdrv.sys.
    • 146 |
    • wtapdrv.cat: CAT file for wtapdrv.sys.
    • 147 |
    • wtapdrv.pdb: Debug symbols for WinDivert.sys.
    • 148 |
    • WinTap.exe: User-mode application to reflect traffic.
    • 149 |
    150 |
151 |

Driver Signing

152 |

153 | Before the WinTap package can be used, the wtapdrv.sys driver must be digitally signed. 154 | This is Microsoft policy for all kernel drivers in recent versions of 155 | Windows. See Driver Signing Requirements for Windows 156 | for more information. If you wish to simply test WinTap, you can set up a test certificate and test sign the wtapdrv.sys 157 | driver. 158 | See 159 | Test Signing a Driver Package for more information. 160 | In summary, the steps are: 161 |

    162 |
  1. Download and install the latest 163 | Windows 164 | Driver Kit.
  2. 165 |
  3. Open a WDK Build Environment console as Administrator.
  4. 166 |
  5. Run the MakeCert.exe tool to create a test certificate, e.g. 167 | with: 168 |
    MakeCert -r -pe -ss TestCertStoreName -n "CN=TestCertName" CertFileName.cer 169 |
  6. 170 |
  7. Install the test certificate with CertMgr.exe, e.g. with:
    171 | CertMgr /add CertFileName.cer /s /r localMachine ROOT
    172 | CertMgr /add CertFileName.cer /s /r localMachine TrustedPublisher 173 |
  8. 174 |
  9. Sign wtapdrv.sys with the test certificate, e.g. with:
    175 | SignTool sign /v /s TestCertStoreName /n TestCertName wtapdrv.sys 176 | 177 |
  10. 178 |
  11. Before you can load test-signed drivers, you must enable 179 | Windows test mode. 180 | To do this, run the command: 181 |
        Bcdedit.exe -set TESTSIGNING ON
    182 | 
    183 | and restart Windows. 184 | For more information, see 185 | The 186 | TESTSIGNING Boot Configuration Option. 187 |
  12. 188 |
189 | After following these steps you should be able to use the WinTap driver. 190 |

191 |

For information on how to build a driver solution using Microsoft Visual Studio, see 192 | Building a Driver.

193 |

To Run WinTap

194 |

INSTALLATION

195 |

You can either use the provided setup.exe or do the manual installation

196 |

For automated install using setup.exe, place all the driver files ( wtapdrv.sys, wtapdrv.inf, wtapdrv.cat ) together with setup.exe in a separate folder.

Now run
setup.exe /install
within an administrative console. Verify in Network Connections UI that the driver is correctly installed.

197 |

Manual Install

198 |

The driver is installed using the INF file wtapdrv.inf, which is provided in the driver directory.

In Network Connections UI, select an adapter and open 199 | Properties.

200 |

Click Install, then Protocol, then Add, and then Have disk. Then point to the location of the .inf and driver.

201 |

Select WinTap Protocol Driver and click OK. After installing the protocol, copy over the user-mode application wintap.exe to a convenient location. Please note that the driver service has been set to manual start in the INF file. As a result, 202 | it doesn't get loaded automatically when you install.

203 |

Usage

204 |

To start the driver, type net start wintap.

205 |

To stop the driver, type net stop wintap.

206 |

To test the driver, run wintap. For help on usage, run wintap -?

207 |

usage: wintap <source deviceid> <destination deviceid>

208 |

*Note: In order to use wintap, the user must have administrative privilege.

209 | 210 |
C:\Users\Administrator\wintap>wintap.exe
211 | Available Devices:
212 |  0. \DEVICE\{CE5C7DDF-A5A4-4534-B354-633C1CDB70CB}
213 |      - Intel(R) PRO/1000 MT Network Connection #2
214 |  1. \DEVICE\{17152850-6288-471A-9708-2889E7F55EE8}
215 |      - Intel(R) PRO/1000 MT Network Connection
216 | 
217 | Enter the number of source interface to use (0-1):1
218 | Enter the number of destination interface to use (0-1):0
219 | 
220 |  1. \DEVICE\{17152850-6288-471A-9708-2889E7F55EE8}
221 |      - Intel(R) PRO/1000 MT Network Connection
222 | Trying to access NDIS Device: \DEVICE\{17152850-6288-471A-9708-2889E7F55EE8}
223 | Opened source interface successfully!
224 | Trying to get src mac address
225 | Got source MAC: 00:0c:29:34:a1:09
226 | 
227 |  0. \DEVICE\{CE5C7DDF-A5A4-4534-B354-633C1CDB70CB}
228 |      - Intel(R) PRO/1000 MT Network Connection #2
229 | Trying to access NDIS Device: \DEVICE\{CE5C7DDF-A5A4-4534-B354-633C1CDB70CB}
230 | Opened destination interface successfully!
231 | Trying to get destination mac address
232 | Got destination MAC: 00:0c:29:34:a1:13
233 | 
234 | Started reflecting the adapter...
235 | >>: read pkt - 148 bytes
236 | >>: read pkt - 60 bytes
237 | 
238 | 239 |

240 |

For more information, see 241 | NDIS Protocol Drivers.

242 |
243 | 244 |
245 | 246 | 247 |
248 | 249 | 250 | -------------------------------------------------------------------------------- /description/84ada392-ed9e-43d3-9c3e-f99f948be6cbBrand.css: -------------------------------------------------------------------------------- 1 | /*Global*/ 2 | h1 { 3 | font-size: 36px; 4 | font-family: 'Segoe UI Light'; 5 | color: #707070; 6 | font-weight: normal; 7 | margin-bottom: 17px !important; 8 | } 9 | 10 | h2, h3, h4, h5, h6, #searchPage h3 { 11 | font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif !important; 12 | font-weight:normal; 13 | color: #2A2A2A !important; 14 | } 15 | 16 | a, a:link, a:visited { 17 | color: #0095c4; 18 | } 19 | 20 | body { 21 | color:#707070; 22 | } 23 | 24 | .profile-usercard { 25 | color:#707070 !important; 26 | } 27 | 28 | /*temporary setting to override msdn_windows.css 29 | can remove once conflicting settings are removed from that file*/ 30 | 31 | 32 | .LocalNavigation, .LocalNavigation .TabOn, .LocalNavigation .TabOn:hover, .LocalNavigation .TabOff, .LocalNavigation .TabOff a:hover { 33 | display: block; 34 | background-color:transparent !important; 35 | color: #0095c4; 36 | } 37 | 38 | .LocalNavigation .TabOff a { 39 | color:#707070 ; 40 | } 41 | 42 | /*End Global*/ 43 | 44 | .EyebrowContainer 45 | { 46 | margin-bottom: 0 !important; 47 | } 48 | 49 | #sideNav 50 | { 51 | width: 215px !important; 52 | } 53 | 54 | #searchPage #mainContentContainer 55 | { 56 | margin-right:0 !important; 57 | margin-left:243px !important; 58 | } 59 | 60 | #searchPage .dirSubHeading h2 61 | { 62 | font-size:1.1em !important; 63 | } 64 | 65 | #searchPage h2, #searchPage h3 66 | { 67 | font-size: 1.25em !important; 68 | } 69 | 70 | #sideNav #contributeSection h3, .sidebar #contributeSection h3, #contributeSection h3 71 | { 72 | font-size: 1.65em !important; 73 | } 74 | .subMenu > h2 75 | { 76 | font-family: 'Segoe UI Light','Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif !important; 77 | font-weight:normal; 78 | font-size:30px; 79 | margin: 15px 10px 5px 0; 80 | padding-bottom:0px; 81 | } 82 | 83 | .itemRow { 84 | } 85 | .itemRow .itemTitle { 86 | font-weight: normal; 87 | } 88 | #MainContent a.officialMicrosoftLabel 89 | { 90 | color: #ACACAC; 91 | } 92 | . 93 | .tabContents { 94 | border-top-width:0px; 95 | } 96 | 97 | #UploadPage { 98 | margin: 0px 0px 0px 10px; 99 | } 100 | #UploadPage h1 { 101 | padding: 0; 102 | font-size: 22px; 103 | } 104 | #UploadPage h2 { 105 | color:#F39700 !important; 106 | } 107 | 108 | #UploadPage #uploadPageInstruction { 109 | margin-top:10px; 110 | } 111 | 112 | #UploadPage fieldset { 113 | margin-left:0px; 114 | } 115 | 116 | #UploadPage fieldset h2 { 117 | font-weight:normal; 118 | } 119 | 120 | #UploadPage fieldset#uploadsForm{ 121 | margin-top:25px; 122 | } 123 | 124 | #UploadPage fieldset#summary textarea { 125 | margin-left:0px; 126 | } 127 | 128 | 129 | #sideNav { 130 | } 131 | 132 | #sideNav .section h3 { 133 | background-color: transparent; 134 | 135 | } 136 | 137 | #sideNav .section UL LI { 138 | border-bottom-width: 0px; 139 | } 140 | 141 | #sideNav .section form > div { 142 | border-bottom: none; 143 | color: #707070; 144 | } 145 | #sideNav .section ul li > div.itemCount 146 | { 147 | color: #707070; 148 | } 149 | 150 | 151 | #searchPage { 152 | } 153 | 154 | #searchPage h2, #searchPage h3 { 155 | text-transform:none; 156 | background-color:transparent; 157 | font-weight:normal; 158 | font-size:1.2em; 159 | } 160 | 161 | #searchPage .browseFilterBar { 162 | background-color:transparent; 163 | border-width:0px; 164 | font-weight:normal; 165 | } 166 | 167 | #requestsPage { 168 | padding-top:15px; 169 | } 170 | 171 | #requestsPage .tabHeaders { 172 | overflow: visible; 173 | } 174 | 175 | #requestsPage #requestsList { 176 | border: none; 177 | } 178 | 179 | #requestsPage h2, #requestsPage h3 { 180 | text-transform:none; 181 | background-color:transparent; 182 | font-weight:normal; 183 | font-size:1.2em; 184 | } 185 | 186 | #extraActions { 187 | } 188 | #extraActions .section 189 | { 190 | margin-bottom: 10px; 191 | } 192 | #extraActions .section a 193 | { 194 | font-weight:normal; 195 | } 196 | 197 | #extraActions #contributeSection div img { 198 | width:0px; 199 | } 200 | 201 | 202 | #projectPage { 203 | } 204 | 205 | #projectPage .projectTitle { 206 | color: #707070; 207 | margin: 5px 0px 15px 0px; 208 | } 209 | 210 | #projectPage #publishBar a, #projectPage #publishBar a:visited { 211 | color: #0095c4; 212 | font-weight: normal; 213 | } 214 | 215 | #projectPage #Collections .bevelButton{ 216 | background-color: #F8F8F8; 217 | color: #0095C4; 218 | border: 1px solid #707070; 219 | } 220 | 221 | #projectPage #DiscussionsTabPane .threadHeader .title { 222 | font-weight:bold !important; 223 | color:Black !important;#F8F8F8; 224 | font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif !important; 225 | } 226 | 227 | #projectPage .sidebar .section .titleBar h3 { 228 | font-weight:normal; 229 | font-size:1.2em; 230 | } 231 | 232 | #LocalNav { 233 | } 234 | 235 | #LocalNav.HeaderTabs { 236 | margin-left:11px; 237 | } 238 | 239 | #searchPage .dirSubHeading h1 240 | { 241 | margin-bottom:17px !important; 242 | } 243 | 244 | 245 | 246 | -------------------------------------------------------------------------------- /description/Combined.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/description/Combined.css -------------------------------------------------------------------------------- /description/Galleries.css: -------------------------------------------------------------------------------- 1 | /* *************************************************** 2 | Galleries.css - Common Structure 3 | 4 | This is where we define common layout for structures that are truly close to common across the different 5 | Galleries sites. To make sure this works we need to follow certain conventions. 6 | 7 | 1. Define each logical structure in its own section with its own comment block that gives the section 8 | a Name, Description and defines the root element if one exists (i.e #someElement). Also, mark the closing block. 9 | 10 | 2. Indent styles in a section to represent if it is a child of a previous element. 11 | i.e. #someDiv{ 12 | } 13 | #someDiv ul { 14 | } 15 | 16 | 3. Do not include brand specific information here like colors and fonts unless they are *really* common. 17 | 18 | 4. If there is an element that you know will be overridden in each brand stylesheet still include it here with an empty definition. 19 | This will aid in knowing what section to override and what selectors to use. 20 | 21 | i.e. #someSction a { 22 | } 23 | 24 | 5. When you add a new section also update the Table of Contents below so that we have a quick overview of the sections 25 | 26 | *****************************************************/ 27 | 28 | /**************************************************** 29 | Table of Contents 30 | 31 | Global - global classes 32 | 33 | FileAttachmentDisplay - The list of attached files under the editor 34 | Eyebrow - The breadcrumb control at the top of the master page 35 | Pager - The common paging control, used for browsing pages of search results 36 | Profile User Card - Elements in the profile usercard control 37 | SideNav - The navigation side bar that contains the search filters 38 | 39 | 40 | *****************************************************/ 41 | 42 | /******************************** 43 | Name: Global 44 | Root: none 45 | Description: truly global classes 46 | ********************************/ 47 | body { 48 | text-align: left; 49 | direction: ltr; 50 | } 51 | 52 | img.rss { 53 | background: url(../../../GlobalResources/Images/Rss.png) no-repeat; 54 | background-position: 0px 0px; 55 | height: 17px; 56 | width: 17px; 57 | } 58 | /* End Global Section */ 59 | 60 | /******************************** 61 | Name: FileAttachmentDisplay 62 | Root: #fileAttachmentDisplay 63 | Description: The list of attached files under the editor 64 | ********************************/ 65 | #fileAttachmentDisplay { 66 | } 67 | #fileAttachmentDisplay .attachment { 68 | margin-right: 10px; 69 | float: left; 70 | } 71 | 72 | #fileAttachmentDisplay .attachment .displayAttachment { 73 | padding: 0px 0 13px 0; 74 | float: left; 75 | } 76 | 77 | #fileAttachmentDisplay .attachment .removeAttachment { 78 | background-image: url('/Content/Common/delete.png'); 79 | display: block; 80 | width: 16px; 81 | height: 16px; 82 | float: left; 83 | } 84 | /* End FileAttachmentDisplay Section */ 85 | 86 | 87 | /******************************** 88 | Name: Eyebrow 89 | Root: .EyebrowContainer 90 | Description: The breadcrumb control at the top of the master page 91 | ********************************/ 92 | .EyebrowContainer { 93 | } 94 | .EyebrowContainer div.EyebrowElement{ 95 | display:inline; 96 | } 97 | 98 | .EyebrowContainer .EyebrowElement{ 99 | font-weight:normal 100 | } 101 | .EyebrowContainer .EyebrowLeafLink{ 102 | color:#000; 103 | } 104 | /* End Eyebrow Section */ 105 | 106 | /******************************** 107 | Name: Pager 108 | Root: #Pager 109 | Description: The common paging control, used for browsing pages of search results 110 | ********************************/ 111 | #Pager { 112 | } 113 | #Pager div{ 114 | display:inline; 115 | } 116 | /* End Pager Section */ 117 | 118 | /******************************** 119 | 120 | Name: Profile User Card 121 | Root: #dashboardPage #userCard 122 | Description: Elements in the profile usercard control 123 | 124 | ********************************/ 125 | #dashboardPage #userCard .profile-usercard-inline { 126 | margin: 5px 0 10px 0; 127 | } 128 | 129 | /* #dashboardPage #userCard .profile-usercard { 130 | width: 288px; 131 | } 132 | /* End Profile User Card Section */ 133 | 134 | /******************************** 135 | 136 | Name: Discussion 137 | Root: #DiscussionsTabPane 138 | Description: Defines the layout of the dicussion 139 | 140 | 141 | ********************************/ 142 | #DiscussionsTabPane { 143 | } 144 | 145 | #DiscussionsTabPane .itemHidden 146 | { 147 | background: lightgrey; 148 | } 149 | 150 | #discussionListItem { 151 | } 152 | 153 | .discussion .postActions 154 | { 155 | float: right; 156 | } 157 | 158 | #discussionListItem .postItem 159 | { 160 | white-space: pre-wrap; 161 | word-wrap: break-word; 162 | font-size:1em; 163 | } 164 | 165 | /* End Discussion Section */ 166 | 167 | 168 | /******************************** 169 | 170 | Name: SearchDefaultLocale 171 | Root: .searchDefaultLocale 172 | Description: Defines the layout of the include english result checkbox on the Browse Page 173 | 174 | 175 | ********************************/ 176 | .searchDefaultLocale 177 | { 178 | float: right; 179 | margin: 20px 0 0 5px; 180 | } 181 | .searchDefaultLocale input 182 | { 183 | vertical-align:top; 184 | } 185 | .searchDefaultLocale span 186 | { 187 | margin-left: -3px; 188 | } 189 | /*-------- End SearchDefaultLocale --------*/ 190 | 191 | 192 | /******************************** 193 | 194 | Name: SideNav 195 | Root: #sideNav 196 | Description: Defines the layout of the naviation elements on the side of the Browse Page 197 | These represent the different filters like Code Language, Category and Tag 198 | 199 | 200 | ********************************/ 201 | 202 | #sideNav { 203 | width: 250px; 204 | vertical-align:top; 205 | background-color:#eee; 206 | } 207 | #sideNav h3 { 208 | } 209 | 210 | #sideNav .section { 211 | padding: 0 0 10px 0; 212 | position: relative; 213 | } 214 | 215 | #sideNav .section a { 216 | } 217 | 218 | #sideNav .section a:hover { 219 | } 220 | 221 | #sideNav .section > div { 222 | padding:5px 5px 5px 0; 223 | line-height:150%; 224 | } 225 | 226 | #sideNav .section ul { 227 | list-style-type:none; 228 | padding:0px; 229 | margin:0px; 230 | } 231 | 232 | #sideNav .section ul li { 233 | position: relative; 234 | padding: 5px 5px 5px 0; 235 | } 236 | 237 | #sideNav .section ul li .selectedFilter { 238 | float: left; 239 | padding-right: 5px; 240 | } 241 | 242 | #sideNav .section div.itemCount { 243 | float: right; 244 | } 245 | 246 | #sideNav .section form input[ type = "checkbox"] { 247 | margin: 0px 4px 0px 0px; 248 | vertical-align: middle; 249 | } 250 | /* End SideNav Section */ 251 | 252 | /*----------- Contribution Logos *******/ 253 | .contributionLogo { 254 | float: left; 255 | position: relative; 256 | margin-right: 6px; 257 | } 258 | 259 | .logo_visualstudio { 260 | background: transparent url('../common/logos/visualstudio.png') no-repeat; 261 | width: 23px; 262 | height: 12px; 263 | margin-top: 3px; 264 | } 265 | .logo_allinonecode { 266 | background: transparent url('../common/logos/1code.png') no-repeat; 267 | width: 14px; 268 | height: 16px; 269 | } 270 | .logo_exchange { 271 | background: transparent url('../common/logos/exchange.png') no-repeat; 272 | width: 14px; 273 | height: 16px; 274 | } 275 | .logo_ie { 276 | background: transparent url('../common/logos/ie.png') no-repeat; 277 | width: 16px; 278 | height: 16px; 279 | } 280 | .logo_office { 281 | background: transparent url('../common/logos/office.png') no-repeat; 282 | width: 17px; 283 | height: 16px; 284 | } 285 | .logo_windows { 286 | background: transparent url('../common/logos/windows.png') no-repeat; 287 | width: 17px; 288 | height: 16px; 289 | } 290 | .logo_azure { 291 | background: transparent url('../common/logos/windowsazure.png') no-repeat; 292 | width: 18px; 293 | height: 16px; 294 | } 295 | 296 | .logo_windowsphone { 297 | background: transparent url('../common/logos/windowsphone.png') no-repeat; 298 | width: 16px; 299 | height: 16px; 300 | } 301 | 302 | .contributionLogoTip { 303 | position: absolute; 304 | display: none; 305 | border: solid 1px #CCC; 306 | color: #333; 307 | background-color: #F0F0F0; 308 | font-size: 11px; 309 | font-family: "Segoe UI",Sans-Serif; 310 | box-shadow: 3px 3px 5px #888; 311 | -moz-box-shadow: 3px 3px 5px #888; 312 | z-index: 1003; 313 | padding: 5px; 314 | min-width: 250px; 315 | } 316 | 317 | /*----------- End Contribution Logos *******/ 318 | 319 | .clear 320 | { 321 | clear: both; 322 | } 323 | 324 | .customcontributionLogoTip { 325 | position: absolute; 326 | display: none; 327 | border: solid 1px #CCC; 328 | background-color: white; 329 | color: #333; 330 | font-size: 11px; 331 | font-family: "Segoe UI",Sans-Serif; 332 | box-shadow: 3px 3px 5px #888; 333 | -moz-box-shadow: 3px 3px 5px #888; 334 | z-index: 1004; 335 | padding: 5px; 336 | min-width: 250px; 337 | } 338 | 339 | .customcontributionTittle { 340 | font-size: 14px; 341 | margin-left: 90px; 342 | } 343 | 344 | .customcontributionDiscription { 345 | font-size: 13px; 346 | margin: 10px 5px; 347 | text-align: justify; 348 | } 349 | 350 | .customcontribution { 351 | float: left; 352 | position: relative; 353 | margin-right: 6px; 354 | } 355 | 356 | .customcontributionLink { 357 | margin-left: 5px; 358 | } 359 | 360 | .customcontributionlogo { 361 | float: left; 362 | padding: 0 10px; 363 | margin: 0; 364 | width: 70px; 365 | height: 70px; 366 | background-repeat: no-repeat; 367 | } 368 | 369 | 370 | .logo_azure_large { 371 | background-image: url('../common/logos/windowsazure_large.png'); 372 | } 373 | .logo_visualstudio_large { 374 | background-image: url('../common/logos/visualstudio_large.png'); 375 | } 376 | .logo_exchange_large { 377 | background-image: url('../common/logos/exchange_large.png'); 378 | } 379 | .logo_ie_large { 380 | background-image: url('../common/logos/ie_large.png'); 381 | } 382 | .logo_office_large { 383 | background-image: url('../common/logos/office_large.png'); 384 | } 385 | .logo_windows_large { 386 | background-image: url('../common/logos/windows_large.png'); 387 | } 388 | .logo_windowsphone_large { 389 | background-image: url('../common/logos/windowsphone_large.png'); 390 | } 391 | 392 | /* Custome Header */ 393 | .dirSubHeading .windowssdk .container 394 | { 395 | background: #FF3300 url('wpappsbackground.png') no-repeat; 396 | color: white; 397 | padding: 8px 10px 18px 170px; 398 | } 399 | 400 | .dirSubHeading .windowssdk .container h1, .dirSubHeading .windowssdk .container h2 { 401 | color: white !important; 402 | } 403 | 404 | .dirSubHeading .windowssdk .container p { 405 | margin: 20px 0 0 0 !important; 406 | } 407 | 408 | .dirSubHeading .windowssdk .container a { 409 | background-color:#ffd800; 410 | color: #2a2a2a !important; 411 | cursor:pointer; 412 | font-size:13px; 413 | font-family:'Segoe UI Semibold','Segoe UI','Lucida Grande',Verdana,Arial,Helvetica,sans-serif; 414 | padding:4px 12px 6px; 415 | } 416 | 417 | 418 | 419 | -------------------------------------------------------------------------------- /description/Layout.css: -------------------------------------------------------------------------------- 1 | #container { 2 | min-height: 768px; 3 | } 4 | 5 | #leftSubHeaderContainer 6 | { 7 | margin-top:20px; 8 | } 9 | 10 | #title h1 11 | { 12 | font-size:25px; 13 | } 14 | 15 | #subtitle h2 16 | { 17 | font-size:15px; 18 | } 19 | 20 | #subtitle 21 | { 22 | margin-left:10px; 23 | } 24 | 25 | 26 | #formContainer 27 | { 28 | margin-left:10px; 29 | margin-top:30px; 30 | } 31 | 32 | .formLabel 33 | { 34 | float:left; 35 | width: 250px; 36 | } 37 | 38 | .formRow 39 | { 40 | clear:both; 41 | padding: 10px 0 10px 10px; 42 | } 43 | 44 | 45 | .formRecaptchaRow 46 | { 47 | clear:both; 48 | float:left; 49 | margin-top:20px; 50 | margin-left:10px; 51 | margin-bottom:20px; 52 | } 53 | 54 | .formSubmitRow 55 | { 56 | clear:both; 57 | margin-top:20px; 58 | margin-left:300px; 59 | margin-bottom:20px; 60 | } 61 | 62 | .formControl { 63 | width:300px; 64 | float:left; 65 | } 66 | .formControl .textInput 67 | { 68 | width:300px; 69 | } 70 | 71 | .formControl textarea 72 | { 73 | width:425px; 74 | height:100px; 75 | } 76 | 77 | .formControl .tag 78 | { 79 | width:425px; 80 | } 81 | 82 | .formControl .richText 83 | { 84 | margin-top:10px; 85 | width:500px; 86 | height:440px; 87 | } 88 | 89 | .formWideLabel 90 | { 91 | width:500px; 92 | } 93 | 94 | .formBigLabel 95 | { 96 | margin-top:20px; 97 | font-size:20px; 98 | } 99 | 100 | .formControlBelow 101 | { 102 | clear:both; 103 | margin-top:10px; 104 | width:500px; 105 | } 106 | 107 | .required 108 | { 109 | color: Red; 110 | } 111 | .helpText 112 | { 113 | color: #9D9D9D; 114 | font-style: italic; 115 | } 116 | 117 | #agreementSummary 118 | { 119 | clear:both; 120 | margin-top:10px; 121 | width:800px; 122 | } 123 | 124 | .field-validation-error, .validation-summary-errors 125 | { 126 | color: #FF0000; 127 | font-weight: bold; 128 | } 129 | 130 | .tinyMCETemplate { 131 | position: relative; 132 | left: 400px; 133 | width: 300px; 134 | max-height: 300px; 135 | overflow: auto; 136 | } 137 | 138 | .IE6 .tinyMCETemplate { 139 | left: 25px; 140 | } 141 | 142 | .ownerBar { 143 | padding: 5px; 144 | } 145 | .ownerBar .ownerBarOptions { 146 | float: right; 147 | } 148 | -------------------------------------------------------------------------------- /description/d0a480a2-d1c4-4159-af59-5aa4abd59cb0Combined.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/description/d0a480a2-d1c4-4159-af59-5aa4abd59cb0Combined.css -------------------------------------------------------------------------------- /description/iframedescription.css: -------------------------------------------------------------------------------- 1 | body { 2 | color: #000000; 3 | font-family: 'Segoe UI',Verdana,Arial; 4 | font-size: 0.813em; 5 | font-style: normal; 6 | word-wrap: break-word; 7 | } 8 | 9 | /*BEGIN HEADERS*/ 10 | .h1, h1 { 11 | color: #3A3E43; 12 | font-family: 'Segoe UI',Verdana,Arial; 13 | font-size: 1.4em; 14 | font-weight: bold; 15 | margin: 0; 16 | } 17 | 18 | .h2, h2 { 19 | color: #3A3E43; 20 | font-family: 'Segoe UI',Verdana,Arial; 21 | font-size: 1.2em; 22 | font-weight: bold; 23 | } 24 | .h3, h3 { 25 | color: #3A3E43; 26 | font-family: 'Segoe UI',Verdana,Arial; 27 | font-size: 1.077em; 28 | font-weight: bold; 29 | } 30 | .h4, h4 { 31 | color: #3A3E43; 32 | font-family: 'Segoe UI',Verdana,Arial; 33 | font-size: 1em; 34 | font-weight: bold; 35 | } 36 | h4.subHeading { 37 | margin-bottom: 7px; 38 | margin-top: 13px; 39 | } 40 | /*END HEADERS*/ 41 | 42 | /*BEGIN LINKS*/ 43 | a:link { 44 | color: #00749E; 45 | text-decoration: none; 46 | } 47 | a:hover { 48 | text-decoration: underline; 49 | } 50 | a:visited { 51 | color: #960BB4; 52 | text-decoration: none; 53 | } 54 | a:focus { 55 | outline: 1px dotted #000000; 56 | } 57 | 58 | a.libraryLink:link { 59 | text-decoration:none; 60 | border-bottom:1px dotted; 61 | } 62 | 63 | /*END LINKS*/ 64 | 65 | /*BEGIN IMAGES*/ 66 | img { 67 | border: 0 none; 68 | } 69 | /*END IMAGES*/ 70 | 71 | /*BEGIN TABLE*/ 72 | .title table { 73 | color: #000000; 74 | font-family: 'Segoe UI',Verdana,Arial; 75 | font-size: 1.077em; 76 | font-style: normal; 77 | } 78 | table { 79 | border-collapse: collapse; 80 | } 81 | 82 | table, table th, table td { 83 | border:1px solid #BBBBBB; 84 | } 85 | /*END TABLE*/ 86 | 87 | /*BEGIN LIST*/ 88 | ul { 89 | list-style-type: disc; 90 | margin-left:40px; 91 | padding-left: 0; 92 | } 93 | ul li { 94 | padding-bottom: 10px; 95 | } 96 | ol { 97 | margin-left:40px; 98 | padding-left: 0; 99 | } 100 | ol li { 101 | padding-bottom: 10px; 102 | } 103 | /*END LIST*/ 104 | 105 | .scriptcode { 106 | position: relative; 107 | padding: 8px 8px 8px 8px; 108 | background: #FFFFFF; 109 | font-size: 12px; 110 | line-height: 125%; 111 | font-weight:normal; 112 | } 113 | .scriptcode pre 114 | { 115 | white-space: pre-wrap !important; /* css-3 */ 116 | word-wrap: break-word !important; /* Internet Explorer 5.5+ */ 117 | margin:0 0 10px 0 !important; 118 | padding: 10px; 119 | border-top: solid 2px #D0D2D2; 120 | border-bottom: solid 2px #D0D2D2; 121 | border-left: solid 1px #D0D2D2; 122 | border-right: solid 1px #D0D2D2; 123 | } 124 | 125 | .scriptcode .title { 126 | color:#E66A38; 127 | font-size: 12px; 128 | font-weight:bold; 129 | margin: 0; 130 | min-height: 23px; 131 | } 132 | .scriptcode .title > span:first-child { 133 | border-left: solid 1px #D0D2D2; 134 | } 135 | .scriptcode .title > span { 136 | padding: 4px 8px 4px 8px; 137 | display: inline-block; 138 | border-top: 1px solid #D0D2D2; 139 | border-right: 1px solid #D0D2D2; 140 | border-collapse: collapse; 141 | text-align: center; 142 | background: white; 143 | } 144 | .scriptcode .title > span.otherTab { 145 | color: #1364C4; 146 | background: #EFF5FF; 147 | cursor: pointer; 148 | } 149 | 150 | .scriptcode .hidden { 151 | display: none !important; 152 | visibility: hidden !important; 153 | } 154 | 155 | .scriptcode .copyCode { 156 | padding: 8px 2px 0 2px !important; 157 | margin-right: 15px; 158 | position: absolute !important; 159 | right: 0 !important; 160 | top: 17px; 161 | display:block !important; 162 | background: #FFFFFF; 163 | } 164 | .scriptcode .pluginLinkHolder { 165 | display: none; 166 | } 167 | .scriptcode .pluginEditHolderLink { 168 | display: none; 169 | } 170 | 171 | .Opera wbr 172 | { 173 | display: inline-block; 174 | } 175 | 176 | .IE9 wbr:after 177 | { 178 | content: "\00200B"; 179 | } 180 | -------------------------------------------------------------------------------- /description/offline.js: -------------------------------------------------------------------------------- 1 | var Galleries = Galleries || { }; 2 | 3 | (function() { 4 | 5 | function findElem(parent, tagName, className) { 6 | var elemToSearch = (parent) ? parent : document.body; 7 | var tagMatch = elemToSearch.getElementsByTagName(tagName); 8 | var evaluator = function(elem) { 9 | return (className) ? (elem.className.indexOf(className) > -1) : true; 10 | }; 11 | 12 | return findArrayElem(tagMatch, evaluator); 13 | } 14 | 15 | function findArrayElem(array, evaluator) { 16 | var newArray = new Array(); 17 | for (var count = 0; count < array.length; count++) { 18 | if (evaluator(array[count])) { 19 | newArray.push(array[count]); 20 | } 21 | } 22 | return newArray; 23 | } 24 | 25 | function iterateElem(elems, delegate) { 26 | for(var count = 0; count < elems.length; count++) { 27 | delegate(count, elems[count]); 28 | } 29 | } 30 | 31 | function isHidden(elem) { 32 | return (elem.offsetHeight === 0 && elem.offsetWidth === 0) || elem.style && elem.style.display === "none"; 33 | } 34 | 35 | function onWindowLoad(callback) { 36 | attachEventHandler(null, 'load', callback); 37 | } 38 | 39 | function attachEventHandler(elem, event, callback) { 40 | var elemToAttach = (elem) ? elem : window; 41 | if (document.addEventListener) { 42 | elemToAttach.addEventListener(event, callback, false); 43 | } else if ( document.attachEvent ) { 44 | elemToAttach.attachEvent('on' + event, callback); 45 | } 46 | } 47 | 48 | Galleries.findElem = findElem; 49 | Galleries.iterateElem = iterateElem; 50 | Galleries.attachEventHandler = attachEventHandler; 51 | Galleries.onWindowLoad = onWindowLoad; 52 | })(); -------------------------------------------------------------------------------- /description/wiretap.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defensivedepth/WinTAP/0470a9c8c6dedfbd8e5eb68ce5cfd2c7af34f7bf/description/wiretap.jpg --------------------------------------------------------------------------------