From 5e16f19508216e8871f771ac664121a4c8841f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B8is=C3=A6ther=20Rasch?= Date: Thu, 6 Feb 2020 23:09:23 +0100 Subject: [PATCH 1/8] Create new project for ks.h --- TH-NETII Windows API.sln | 15 +++++++++++++++ src-native-c/THNETII.WinApi.Sample.Native/main.c | 10 +++++++--- .../THNETII.WinApi.Headers.Ks.csproj | 12 ++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 src/THNETII.WinApi.Headers.Ks/THNETII.WinApi.Headers.Ks.csproj diff --git a/TH-NETII Windows API.sln b/TH-NETII Windows API.sln index 3d5eac55..9b59e1ac 100644 --- a/TH-NETII Windows API.sln +++ b/TH-NETII Windows API.sln @@ -93,6 +93,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "THNETII.WinApi.Headers.WinS EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "THNETII.WinApi.Headers.DevPropDef", "src\THNETII.WinApi.Headers.DevPropDef\THNETII.WinApi.Headers.DevPropDef.csproj", "{E4A4DA91-3696-40A6-9834-E5FAACEF682E}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "THNETII.WinApi.Headers.Ks", "src\THNETII.WinApi.Headers.Ks\THNETII.WinApi.Headers.Ks.csproj", "{27DD8683-2AF2-4753-BF69-2AD2C5B9790E}" +EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "THNETII.WinApi.Headers.ApDevPKey", "src\THNETII.WinApi.Headers.ApDevPKey\THNETII.WinApi.Headers.ApDevPKey.csproj", "{C0B32983-2879-4DAD-B834-8A40570A35CA}" EndProject Global @@ -489,6 +491,18 @@ Global {E4A4DA91-3696-40A6-9834-E5FAACEF682E}.Release|x64.Build.0 = Release|Any CPU {E4A4DA91-3696-40A6-9834-E5FAACEF682E}.Release|x86.ActiveCfg = Release|Any CPU {E4A4DA91-3696-40A6-9834-E5FAACEF682E}.Release|x86.Build.0 = Release|Any CPU + {27DD8683-2AF2-4753-BF69-2AD2C5B9790E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27DD8683-2AF2-4753-BF69-2AD2C5B9790E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27DD8683-2AF2-4753-BF69-2AD2C5B9790E}.Debug|x64.ActiveCfg = Debug|Any CPU + {27DD8683-2AF2-4753-BF69-2AD2C5B9790E}.Debug|x64.Build.0 = Debug|Any CPU + {27DD8683-2AF2-4753-BF69-2AD2C5B9790E}.Debug|x86.ActiveCfg = Debug|Any CPU + {27DD8683-2AF2-4753-BF69-2AD2C5B9790E}.Debug|x86.Build.0 = Debug|Any CPU + {27DD8683-2AF2-4753-BF69-2AD2C5B9790E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27DD8683-2AF2-4753-BF69-2AD2C5B9790E}.Release|Any CPU.Build.0 = Release|Any CPU + {27DD8683-2AF2-4753-BF69-2AD2C5B9790E}.Release|x64.ActiveCfg = Release|Any CPU + {27DD8683-2AF2-4753-BF69-2AD2C5B9790E}.Release|x64.Build.0 = Release|Any CPU + {27DD8683-2AF2-4753-BF69-2AD2C5B9790E}.Release|x86.ActiveCfg = Release|Any CPU + {27DD8683-2AF2-4753-BF69-2AD2C5B9790E}.Release|x86.Build.0 = Release|Any CPU {C0B32983-2879-4DAD-B834-8A40570A35CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C0B32983-2879-4DAD-B834-8A40570A35CA}.Debug|Any CPU.Build.0 = Debug|Any CPU {C0B32983-2879-4DAD-B834-8A40570A35CA}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -539,6 +553,7 @@ Global {25A891EB-9BF0-45D1-89EE-B24E80DE259E} = {9689DB3E-1ED7-478C-AC14-C734B0397619} {56348771-2C99-4C0A-B63A-C7F0736621DA} = {9689DB3E-1ED7-478C-AC14-C734B0397619} {E4A4DA91-3696-40A6-9834-E5FAACEF682E} = {9689DB3E-1ED7-478C-AC14-C734B0397619} + {27DD8683-2AF2-4753-BF69-2AD2C5B9790E} = {9689DB3E-1ED7-478C-AC14-C734B0397619} {C0B32983-2879-4DAD-B834-8A40570A35CA} = {9689DB3E-1ED7-478C-AC14-C734B0397619} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/src-native-c/THNETII.WinApi.Sample.Native/main.c b/src-native-c/THNETII.WinApi.Sample.Native/main.c index 56448bcc..405f9241 100644 --- a/src-native-c/THNETII.WinApi.Sample.Native/main.c +++ b/src-native-c/THNETII.WinApi.Sample.Native/main.c @@ -1,11 +1,15 @@ #include -#include +#include +#include +#include +#include +#include int main(int argc, char* argv[]) { - DEVPROPTYPE instance; + KSRESET instance; const int size = sizeof(instance); - const int value = DEVPROP_TYPE_EMPTY; + const int value = IOCTL_KS_PROPERTY; const void* ptr = NULL; diff --git a/src/THNETII.WinApi.Headers.Ks/THNETII.WinApi.Headers.Ks.csproj b/src/THNETII.WinApi.Headers.Ks/THNETII.WinApi.Headers.Ks.csproj new file mode 100644 index 00000000..d9bc12c4 --- /dev/null +++ b/src/THNETII.WinApi.Headers.Ks/THNETII.WinApi.Headers.Ks.csproj @@ -0,0 +1,12 @@ + + + + + true + 8 + netstandard1.3;netstandard2.0 + true + THNETII.WinApi.Native.Ks + + + From cfa0946c971ade0b7b43d0f6030f6dc9f2c1c7b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B8is=C3=A6ther=20Rasch?= Date: Thu, 6 Feb 2020 23:18:35 +0100 Subject: [PATCH 2/8] GUID_NULL constant, ks.h line 64 --- .../GlobalSuppressions.cs | 13 +++++++++++++ src/THNETII.WinApi.Headers.Ks/KsConstants.cs | 15 +++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/THNETII.WinApi.Headers.Ks/GlobalSuppressions.cs create mode 100644 src/THNETII.WinApi.Headers.Ks/KsConstants.cs diff --git a/src/THNETII.WinApi.Headers.Ks/GlobalSuppressions.cs b/src/THNETII.WinApi.Headers.Ks/GlobalSuppressions.cs new file mode 100644 index 00000000..f0b137d6 --- /dev/null +++ b/src/THNETII.WinApi.Headers.Ks/GlobalSuppressions.cs @@ -0,0 +1,13 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +using System.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Documentation", "CS1591: Missing XML comment for publicly visible type or member")] +[assembly: SuppressMessage("Design", "CA1028: Enum Storage should be Int32")] +[assembly: SuppressMessage("Naming", "CA1714: Flags enums should have plural names")] +[assembly: SuppressMessage("Naming", "CA1707: Identifiers should not contain underscores")] +[assembly: SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +[assembly: SuppressMessage("Performance", "CA1815: Override equals and operator equals on value types")] diff --git a/src/THNETII.WinApi.Headers.Ks/KsConstants.cs b/src/THNETII.WinApi.Headers.Ks/KsConstants.cs new file mode 100644 index 00000000..20b0eb5d --- /dev/null +++ b/src/THNETII.WinApi.Headers.Ks/KsConstants.cs @@ -0,0 +1,15 @@ +using System; + +namespace THNETII.WinApi.Native.Ks +{ + // C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\ks.h + /// + /// Windows Driver Model/Connection and Streaming Architecture (WDM-CSA) + /// core definitions. + /// + public static class KsConstants + { + // C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\ks.h, line 62 + public static readonly Guid GUID_NULL = Guid.Parse("00000000-0000-0000-0000-000000000000"); + } +} From 5044b3364e7c9dfc2543b3fa0614a968ce5f4ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B8is=C3=A6ther=20Rasch?= Date: Thu, 6 Feb 2020 23:22:57 +0100 Subject: [PATCH 3/8] IOCTL_KS_* constants, ks.h line 82 --- src/THNETII.WinApi.Headers.Ks/KsConstants.cs | 18 ++++++++++++++++++ .../THNETII.WinApi.Headers.Ks.csproj | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/src/THNETII.WinApi.Headers.Ks/KsConstants.cs b/src/THNETII.WinApi.Headers.Ks/KsConstants.cs index 20b0eb5d..efee20ba 100644 --- a/src/THNETII.WinApi.Headers.Ks/KsConstants.cs +++ b/src/THNETII.WinApi.Headers.Ks/KsConstants.cs @@ -1,7 +1,12 @@ using System; +using THNETII.WinApi.Native.WinIOCtl; + namespace THNETII.WinApi.Native.Ks { + using static WinIOCtlConstants; + using static WinIOCtlFunctions; + // C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\ks.h /// /// Windows Driver Model/Connection and Streaming Architecture (WDM-CSA) @@ -11,5 +16,18 @@ public static class KsConstants { // C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\ks.h, line 62 public static readonly Guid GUID_NULL = Guid.Parse("00000000-0000-0000-0000-000000000000"); + + // C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\ks.h, line 72 + //=========================================================================== + + public static readonly int IOCTL_KS_PROPERTY = CTL_CODE(FILE_DEVICE_KS, 0x000, METHOD_NEITHER, FILE_ANY_ACCESS); + public static readonly int IOCTL_KS_ENABLE_EVENT = CTL_CODE(FILE_DEVICE_KS, 0x001, METHOD_NEITHER, FILE_ANY_ACCESS); + public static readonly int IOCTL_KS_DISABLE_EVENT = CTL_CODE(FILE_DEVICE_KS, 0x002, METHOD_NEITHER, FILE_ANY_ACCESS); + public static readonly int IOCTL_KS_METHOD = CTL_CODE(FILE_DEVICE_KS, 0x003, METHOD_NEITHER, FILE_ANY_ACCESS); + public static readonly int IOCTL_KS_WRITE_STREAM = CTL_CODE(FILE_DEVICE_KS, 0x004, METHOD_NEITHER, FILE_WRITE_ACCESS); + public static readonly int IOCTL_KS_READ_STREAM = CTL_CODE(FILE_DEVICE_KS, 0x005, METHOD_NEITHER, FILE_READ_ACCESS); + public static readonly int IOCTL_KS_RESET_STATE = CTL_CODE(FILE_DEVICE_KS, 0x006, METHOD_NEITHER, FILE_ANY_ACCESS); + + //=========================================================================== } } diff --git a/src/THNETII.WinApi.Headers.Ks/THNETII.WinApi.Headers.Ks.csproj b/src/THNETII.WinApi.Headers.Ks/THNETII.WinApi.Headers.Ks.csproj index d9bc12c4..718e3ac9 100644 --- a/src/THNETII.WinApi.Headers.Ks/THNETII.WinApi.Headers.Ks.csproj +++ b/src/THNETII.WinApi.Headers.Ks/THNETII.WinApi.Headers.Ks.csproj @@ -9,4 +9,8 @@ THNETII.WinApi.Native.Ks + + + + From f2d37ddf3359d55c50ea851ac873a195bc65839c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B8is=C3=A6ther=20Rasch?= Date: Thu, 6 Feb 2020 23:26:44 +0100 Subject: [PATCH 4/8] KSRESET enumeration, ks.h line 87 --- src/THNETII.WinApi.Headers.Ks/GlobalSuppressions.cs | 1 + src/THNETII.WinApi.Headers.Ks/KSRESET.cs | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/THNETII.WinApi.Headers.Ks/KSRESET.cs diff --git a/src/THNETII.WinApi.Headers.Ks/GlobalSuppressions.cs b/src/THNETII.WinApi.Headers.Ks/GlobalSuppressions.cs index f0b137d6..b8d724ab 100644 --- a/src/THNETII.WinApi.Headers.Ks/GlobalSuppressions.cs +++ b/src/THNETII.WinApi.Headers.Ks/GlobalSuppressions.cs @@ -11,3 +11,4 @@ [assembly: SuppressMessage("Naming", "CA1707: Identifiers should not contain underscores")] [assembly: SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] [assembly: SuppressMessage("Performance", "CA1815: Override equals and operator equals on value types")] +[assembly: SuppressMessage("Naming", "CA1712: Do not prefix enum values with type name")] diff --git a/src/THNETII.WinApi.Headers.Ks/KSRESET.cs b/src/THNETII.WinApi.Headers.Ks/KSRESET.cs new file mode 100644 index 00000000..3b719bbc --- /dev/null +++ b/src/THNETII.WinApi.Headers.Ks/KSRESET.cs @@ -0,0 +1,12 @@ +namespace THNETII.WinApi.Native.Ks +{ + // C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\ks.h, line 84 + /// + /// Microsoft Docs page: KSRESET enumeration + /// + public enum KSRESET + { + KSRESET_BEGIN, + KSRESET_END + } +} From 94bd9cad5826bdb4852d9d756bc5a4ef4fd02354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B8is=C3=A6ther=20Rasch?= Date: Thu, 6 Feb 2020 23:28:51 +0100 Subject: [PATCH 5/8] KSSTATE enumeration, ks.h line 94 --- src/THNETII.WinApi.Headers.Ks/KSSTATE.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/THNETII.WinApi.Headers.Ks/KSSTATE.cs diff --git a/src/THNETII.WinApi.Headers.Ks/KSSTATE.cs b/src/THNETII.WinApi.Headers.Ks/KSSTATE.cs new file mode 100644 index 00000000..69880531 --- /dev/null +++ b/src/THNETII.WinApi.Headers.Ks/KSSTATE.cs @@ -0,0 +1,21 @@ +namespace THNETII.WinApi.Native.Ks +{ + // C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\ks.h, line 89 + /// + /// The enumeration lists possible states of a kernel streaming object. + /// + /// + /// Microsoft Docs page: KSSTATE enumeration + /// + public enum KSSTATE + { + /// Indicates that the object is in minimum resource consumption mode. + KSSTATE_STOP, + /// Indicates that the object is acquiring resources. + KSSTATE_ACQUIRE, + /// Indicates that the object is preparing to make instant transition to Run state. + KSSTATE_PAUSE, + /// Indicates that the object is actively streaming. + KSSTATE_RUN + } +} From 40557b4269d9d594640f6eeb4e8acc742ea3d6a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B8is=C3=A6ther=20Rasch?= Date: Thu, 6 Feb 2020 23:39:03 +0100 Subject: [PATCH 6/8] KSPRIORITY structure, ks.h line 104 --- src/THNETII.WinApi.Headers.Ks/KSPRIORITY.cs | 31 +++++++++++++++++++ .../KSPRIORITY_CLASS.cs | 15 +++++++++ src/THNETII.WinApi.Headers.Ks/KsConstants.cs | 6 ++++ 3 files changed, 52 insertions(+) create mode 100644 src/THNETII.WinApi.Headers.Ks/KSPRIORITY.cs create mode 100644 src/THNETII.WinApi.Headers.Ks/KSPRIORITY_CLASS.cs diff --git a/src/THNETII.WinApi.Headers.Ks/KSPRIORITY.cs b/src/THNETII.WinApi.Headers.Ks/KSPRIORITY.cs new file mode 100644 index 00000000..315c46be --- /dev/null +++ b/src/THNETII.WinApi.Headers.Ks/KSPRIORITY.cs @@ -0,0 +1,31 @@ +using System.Runtime.InteropServices; + +namespace THNETII.WinApi.Native.Ks +{ + using static KSPRIORITY_CLASS; + + // C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\ks.h, line 101 + /// + /// The structure is used to specify priority and is used with the property. + /// + /// + /// The member allows a client to set exclusive use of resources consumed by a pin and also to prioritize the use of those resources by the client's pins within that exclusive class. The initial priority of a pin is set by the connection request typically performed through , and is usually , with a subclass priority of 1. A pin uses these priorities as parameters when allocating shared resources from any component managing resources. Resource allocation occurs when formats are set on pins. + /// If the removal of resources by a higher priority client causes the filter pin to fail, the client must be notified through the event (assuming that the client had registered for event notification of this type). + /// Microsoft Docs page: KSPRIORITY structure + /// + /// + /// + [StructLayout(LayoutKind.Sequential)] + public struct KSPRIORITY + { + /// + /// Specifies a number ranging from 1 to 0xFFFFFFFF, where 1 is least priority and 0xFFFFFFFF is the highest priority. Zero is reserved for future use. When setting a class value, 0xFFFFFFFF is used to indicate exclusive access to the resources consumed by the pin. + /// + [MarshalAs(UnmanagedType.U4)] + public KSPRIORITY_CLASS PriorityClass; + /// + /// Specifies a number ranging from 1 to 0xFFFFFFFF, where 1 is the least priority within the class and 0xFFFFFFFF is the most priority. Zero is reserved for future use. + /// + public int PrioritySubClass; + } +} diff --git a/src/THNETII.WinApi.Headers.Ks/KSPRIORITY_CLASS.cs b/src/THNETII.WinApi.Headers.Ks/KSPRIORITY_CLASS.cs new file mode 100644 index 00000000..0803c886 --- /dev/null +++ b/src/THNETII.WinApi.Headers.Ks/KSPRIORITY_CLASS.cs @@ -0,0 +1,15 @@ +namespace THNETII.WinApi.Native.Ks +{ + // C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\ks.h, line 96 + public enum KSPRIORITY_CLASS + { + /// Specifies the lowest priority. + KSPRIORITY_LOW = KsConstants.KSPRIORITY_LOW, + /// Specifies normal priority. + KSPRIORITY_NORMAL = KsConstants.KSPRIORITY_NORMAL, + /// Specifies an elevated priority. + KSPRIORITY_HIGH = KsConstants.KSPRIORITY_HIGH, + /// Specifies the highest priority, which implies exclusive access to resources. + KSPRIORITY_EXCLUSIVE = KsConstants.KSPRIORITY_EXCLUSIVE, + } +} diff --git a/src/THNETII.WinApi.Headers.Ks/KsConstants.cs b/src/THNETII.WinApi.Headers.Ks/KsConstants.cs index efee20ba..5febf4ce 100644 --- a/src/THNETII.WinApi.Headers.Ks/KsConstants.cs +++ b/src/THNETII.WinApi.Headers.Ks/KsConstants.cs @@ -29,5 +29,11 @@ public static class KsConstants public static readonly int IOCTL_KS_RESET_STATE = CTL_CODE(FILE_DEVICE_KS, 0x006, METHOD_NEITHER, FILE_ANY_ACCESS); //=========================================================================== + + // C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\ks.h, line 96 + public const int KSPRIORITY_LOW = 0x00000001; + public const int KSPRIORITY_NORMAL = 0x40000000; + public const int KSPRIORITY_HIGH = unchecked((int)0x80000000); + public const int KSPRIORITY_EXCLUSIVE = unchecked((int)0xFFFFFFFF); } } From 03f0b23a64c1a8ad1cae8a39fbbcb908c31b697e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B8is=C3=A6ther=20Rasch?= Date: Fri, 7 Feb 2020 00:11:13 +0100 Subject: [PATCH 7/8] KSIDENTIFIER structure, ks.h line 121 --- src/THNETII.WinApi.Headers.Ks/KSIDENTIFIER.cs | 71 +++++++++++++++++++ .../THNETII.WinApi.Headers.Ks.csproj | 8 ++- 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 src/THNETII.WinApi.Headers.Ks/KSIDENTIFIER.cs diff --git a/src/THNETII.WinApi.Headers.Ks/KSIDENTIFIER.cs b/src/THNETII.WinApi.Headers.Ks/KSIDENTIFIER.cs new file mode 100644 index 00000000..c3e6bd73 --- /dev/null +++ b/src/THNETII.WinApi.Headers.Ks/KSIDENTIFIER.cs @@ -0,0 +1,71 @@ +using System; +using System.Runtime.InteropServices; + +using THNETII.WinApi.Native.NTStatus; + +namespace THNETII.WinApi.Native.Ks +{ + using static NTStatusConstants; + using static KsConstants; + + // C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\ks.h, line 106 + /// + /// The structure specifies a that uniquely identifies a related set of s, and an index value to refer to a specific member within that set. + /// + /// + /// The KSEVENT, KSMETHOD, and KSPROPERTY structures are aliases for the structure. As such, their definitions are identical. + /// The use of an ID within the set allows one to perform a single large compare for a set identifier, then smaller quick compares (for example, by using a switch statement for identifiers within a set). For example, a property set is referred to by a unique GUID identifier, and properties within that set are referred to by the short ID. + /// Method, Event, Interface, and medium sets can be thought of as "classes" of sets. + /// The size of the output buffer passed determines what data is returned from a request. If the output buffer is the size of a , only the access flags are returned. If the output buffer is the size of the structure, the structure is filled with the access flags, the inclusive size of the entire values information, the property value type information, and the number of member lists that correspond to the structure. + /// For a request, data returned also depends on the size of the output buffer. If the output buffer size is zero, the size required to return the related properties is returned in with a warning status of . If the buffer is the size of a structure, both the byte size and count of relations is returned. Otherwise, the buffer is expected to be long enough to return the structure and all related property identifiers, which is returned as a list of structures. + /// and requests allow interaction with multiple properties with a single call from the client. If the kernel streaming handler is being used to process property requests, these are broken up into multiple calls by the function. When using this handler, the property set definition controls which properties are to be serialized. + /// For serialization requests, the member of the relevant structure is checked for a nonzero value that indicates the size, in bytes, of the property. If the value of the member is 1, it is unknown and must be queried (all unknown properties begin with a structure that can be queried separately). To query for the total size a serialization would take, the client passes a zero length buffer in the call to . then returns the size, in bytes, that the buffer must be to serialize the set, and a warning status of . A buffer allocated that size can then be filled with the serialized data. + /// The format of the serialization buffer is a , followed by serialized properties. Each property that follows contains a header (), followed by the property data, with the start of each property on . Note that the serial header structure is defined to be on . + /// and are supported if a property item handler exists. The function invokes the handler provided by the minidriver. The buffer size required for serialization can also be queried by passing a zero-length buffer to a serialize raw request. Because handlers are attached to property items rather than the property set, a specific item within the property set must be specified in the Property parameter. This handler may deal with multiple properties within the set. + /// Microsoft provides several system-defined property set GUIDs. Minidrivers specify one of these GUIDs in the member. Kernel streaming property sets typically begin with either a KSPROPSETID or a PROPSETID prefix. Kernel streaming property sets are defined in ks.h, ksmedia.h, bdamedia.h, and possibly other header files. + /// For more information about kernel streaming properties, see KS Properties, Events, and Methods. + /// A client can use the request along with the structure to execute methods on a kernel streaming object that the minidriver handles. For more information, see KS Methods. + /// The structure identifies a medium, with a unique medium GUID and instance identifier, which is generated in a bus-specific manner. There is a reserved identifier value that is used when bus instances are not of concern. For example, the refers to the system bus, of which there should only be one. So this instance identifier is always used just as a convenience. + /// A pin may support multiple mediums and interfaces on those mediums. The way in which a pin is described implies that the list of interfaces is supported on all mediums enumerated for a pin. If there is a case in which this is not true, another pin may be used to describe each subset of interfaces for the specific mediums. + /// The medium is also cached by kernel streaming to speed up the search for a possible connection. + /// An example of use of this structure can be found in a tuner sample, in which represents unique connections between tuners, crossbars, and other tuner components. + /// The member can contain different values based on the type of signal degradation that the client employs. See Quality Management for more details on different strategies for solving QM problems by reducing signal quality. + /// Because contains in integer value, multiple Skip requests may be needed to remedy the QM issue. + /// Microsoft Docs page: KSIDENTIFIER structure + /// + [StructLayout(LayoutKind.Explicit)] + public struct KSIDENTIFIER + { + [FieldOffset(0)] + internal KSIDENTIFIER_CONTENT Content; + + public Guid Set + { + get => Content.Set; + set => Content.Set = value; + } + + public int Id + { + get => Content.Id; + set => Content.Id = value; + } + + public int Flags + { + get => Content.Flags; + set => Content.Flags = value; + } + + [FieldOffset(0)] + public long Alignment; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct KSIDENTIFIER_CONTENT + { + public Guid Set; + public int Id; + public int Flags; + } +} diff --git a/src/THNETII.WinApi.Headers.Ks/THNETII.WinApi.Headers.Ks.csproj b/src/THNETII.WinApi.Headers.Ks/THNETII.WinApi.Headers.Ks.csproj index 718e3ac9..801308b4 100644 --- a/src/THNETII.WinApi.Headers.Ks/THNETII.WinApi.Headers.Ks.csproj +++ b/src/THNETII.WinApi.Headers.Ks/THNETII.WinApi.Headers.Ks.csproj @@ -10,7 +10,13 @@ - + + All + + + + + From 9e337a108f148e0ea7c69119a3453c43ca62be83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B8is=C3=A6ther=20Rasch?= Date: Fri, 7 Feb 2020 00:13:52 +0100 Subject: [PATCH 8/8] KSMETHOD_TYPE_*, KSPROPERTY_TYPE_* constants, ks.h line 152 --- src/THNETII.WinApi.Headers.Ks/KsConstants.cs | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/THNETII.WinApi.Headers.Ks/KsConstants.cs b/src/THNETII.WinApi.Headers.Ks/KsConstants.cs index 5febf4ce..47996a6c 100644 --- a/src/THNETII.WinApi.Headers.Ks/KsConstants.cs +++ b/src/THNETII.WinApi.Headers.Ks/KsConstants.cs @@ -35,5 +35,37 @@ public static class KsConstants public const int KSPRIORITY_NORMAL = 0x40000000; public const int KSPRIORITY_HIGH = unchecked((int)0x80000000); public const int KSPRIORITY_EXCLUSIVE = unchecked((int)0xFFFFFFFF); + + // C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\ks.h, line 96 + public const int KSMETHOD_TYPE_NONE = 0x00000000; + public const int KSMETHOD_TYPE_READ = 0x00000001; + public const int KSMETHOD_TYPE_WRITE = 0x00000002; + public const int KSMETHOD_TYPE_MODIFY = 0x00000003; + public const int KSMETHOD_TYPE_SOURCE = 0x00000004; + + public const int KSMETHOD_TYPE_SEND = 0x00000001; + public const int KSMETHOD_TYPE_SETSUPPORT = 0x00000100; + public const int KSMETHOD_TYPE_BASICSUPPORT = 0x00000200; + + public const int KSMETHOD_TYPE_TOPOLOGY = 0x10000000; + + // C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\ks.h, line 135 + public const int KSPROPERTY_TYPE_GET = 0x00000001; + public const int KSPROPERTY_TYPE_SET = 0x00000002; + public const int KSPROPERTY_TYPE_GETPAYLOADSIZE = 0x00000004; + public const int KSPROPERTY_TYPE_SETSUPPORT = 0x00000100; + public const int KSPROPERTY_TYPE_BASICSUPPORT = 0x00000200; + public const int KSPROPERTY_TYPE_RELATIONS = 0x00000400; + public const int KSPROPERTY_TYPE_SERIALIZESET = 0x00000800; + public const int KSPROPERTY_TYPE_UNSERIALIZESET = 0x00001000; + public const int KSPROPERTY_TYPE_SERIALIZERAW = 0x00002000; + public const int KSPROPERTY_TYPE_UNSERIALIZERAW = 0x00004000; + public const int KSPROPERTY_TYPE_SERIALIZESIZE = 0x00008000; + public const int KSPROPERTY_TYPE_DEFAULTVALUES = 0x00010000; + + public const int KSPROPERTY_TYPE_TOPOLOGY = 0x10000000; + public const int KSPROPERTY_TYPE_HIGHPRIORITY = 0x08000000; + public const int KSPROPERTY_TYPE_FSFILTERSCOPE = 0x40000000; + public const int KSPROPERTY_TYPE_COPYPAYLOAD = unchecked((int)0x80000000); } }