Added the GetConsoleScreenBufferInfo function.

This commit is contained in:
That-One-Nerd 2023-05-27 16:32:23 -04:00
parent e9b915dec5
commit aa0d04b094
5 changed files with 20 additions and 4 deletions

View File

@ -4,7 +4,7 @@ internal static partial class Kernel32
{ {
[LibraryImport("kernel32.dll", SetLastError = true)] [LibraryImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)] [return: MarshalAs(UnmanagedType.Bool)]
public static partial bool GetConsoleScreenBufferInfo(nint hConsoleOutput); public static partial bool GetConsoleScreenBufferInfo(nint hConsoleOutput, out ConsoleScreenBufferInfo lpConsoleScreenBufferInfo);
[LibraryImport("kernel32.dll", SetLastError = true)] [LibraryImport("kernel32.dll", SetLastError = true)]
public static partial uint GetFinalPathNameByHandleA(nint hFile, [MarshalAs(UnmanagedType.LPTStr)] string lpszFilePath, public static partial uint GetFinalPathNameByHandleA(nint hFile, [MarshalAs(UnmanagedType.LPTStr)] string lpszFilePath,

View File

@ -1,6 +1,15 @@
namespace SrcMod.Shell.Interop.ObjectModels; namespace SrcMod.Shell.Interop.ObjectModels;
[StructLayout(LayoutKind.Sequential)]
internal struct ConsoleScreenBufferInfo internal struct ConsoleScreenBufferInfo
{ {
[MarshalAs(UnmanagedType.LPStruct)]
public Coord dwSize;
[MarshalAs(UnmanagedType.LPStruct)]
public Coord dwCursorPosition;
public int wAttributes;
[MarshalAs(UnmanagedType.LPStruct)]
public SmallRect srWindow;
[MarshalAs(UnmanagedType.LPStruct)]
public Coord dwMaximumWindowSize;
} }

View File

@ -1,6 +1,8 @@
namespace SrcMod.Shell.Interop.ObjectModels; namespace SrcMod.Shell.Interop.ObjectModels;
[StructLayout(LayoutKind.Sequential)]
internal struct Coord internal struct Coord
{ {
public short X;
public short Y;
} }

View File

@ -1,6 +1,10 @@
namespace SrcMod.Shell.Interop.ObjectModels; namespace SrcMod.Shell.Interop.ObjectModels;
[StructLayout(LayoutKind.Sequential)]
internal struct SmallRect internal struct SmallRect
{ {
public short Left;
public short Top;
public short Right;
public short Bottom;
} }

View File

@ -6,6 +6,7 @@ global using SharpCompress.Archives.SevenZip;
global using SharpCompress.Readers; global using SharpCompress.Readers;
global using SrcMod.Shell.Extensions; global using SrcMod.Shell.Extensions;
global using SrcMod.Shell.Interop; global using SrcMod.Shell.Interop;
global using SrcMod.Shell.Interop.ObjectModels;
global using SrcMod.Shell.Modules; global using SrcMod.Shell.Modules;
global using SrcMod.Shell.Modules.ObjectModels; global using SrcMod.Shell.Modules.ObjectModels;
global using SrcMod.Shell.ObjectModels; global using SrcMod.Shell.ObjectModels;