basic cleanup

This commit is contained in:
Lyssa
2025-04-02 14:06:52 +04:00
parent 07f43e2613
commit b8558d8fb2
10 changed files with 30 additions and 41 deletions

View File

@ -2,10 +2,7 @@ namespace LibTSforge.SPP
{
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
public class SPSys
{
@ -24,7 +21,7 @@ namespace LibTSforge.SPP
{
SafeFileHandle file = CreateFileSafe(@"\\.\SpDevice");
IntPtr buffer = Marshal.AllocHGlobal(1);
int bytesReturned = 0;
int bytesReturned;
DeviceIoControl(file, 0x80006008, IntPtr.Zero, 0, buffer, 1, out bytesReturned, IntPtr.Zero);
bool running = Marshal.ReadByte(buffer) != 0;
Marshal.FreeHGlobal(buffer);
@ -36,7 +33,7 @@ namespace LibTSforge.SPP
{
SafeFileHandle file = CreateFileSafe(@"\\.\SpDevice");
IntPtr buffer = Marshal.AllocHGlobal(4);
int bytesReturned = 0;
int bytesReturned;
DeviceIoControl(file, start ? 0x8000a000 : 0x8000a004, IntPtr.Zero, 0, buffer, 4, out bytesReturned, IntPtr.Zero);
int result = Marshal.ReadInt32(buffer);
Marshal.FreeHGlobal(buffer);