Skip to content

Instantly share code, notes, and snippets.

View BinToss's full-sized avatar
✍️
Making progress...

Noah Sherwin BinToss

✍️
Making progress...
View GitHub Profile
@BinToss
BinToss / config.txt
Last active February 15, 2021 04:00
Halo Custom Edition harware config
////////////////////////////////
// audio parameters //
////////////////////////////////
// EnableStopStart - Sound card supports fast calls to stop and start buffer functions
// HeadRelativeSpeech - Sound card prefers head relative instead of disabled 3D calls
// InvalidSoundDriver - A sound driver which we know has serious issues
// OldSoundDriver - A sound driver we do not recommend because it's older than ones we have tested
//
////////////////////////////////
// video parameters //
@BinToss
BinToss / GetDiscordGameSDKURL.userscript.js
Last active August 24, 2021 07:46
A userscript to get the URL of the latest Discord GameSDK Release. Older versions can be accessed, but you have to guess their URLs.
// ==UserScript==
// @name Get Discord GameSDK URL
// @namespace Violentmonkey Scripts
// @match https://discord.com/developers/docs/game-sdk/sdk-starter-guide
// @match https://github.com/discord/discord-api-docs/blob/master/docs/game_sdk/SDK_Starter_Guide.md
// @grant none
// @version 1.0.3
// @homepageURL https://gist.github.com/BinToss/7a5fdccb13c03116766bfe49fcf23ce2
// @downloadURL https://gist.githubusercontent.com/BinToss/7a5fdccb13c03116766bfe49fcf23ce2/raw/GetDiscordGameSDKURL.userscript.js
// @updateURL https://gist.githubusercontent.com/BinToss/7a5fdccb13c03116766bfe49fcf23ce2/raw/GetDiscordGameSDKURL.userscript.js
Num Lat DL UL Desc
03 Failed to get servers available. Something may be blocking requests error:23
04 Failed to get servers available. Something may be blocking requests error:23
05 Failed to get servers available. Something may be blocking requests error:23
06 Failed to get servers available. Something may be blocking requests error:23
07 Browser could not reach ANY server! Perhaps an extension like NO SCRIPT is blocking things. error:7
08 Browser could not reach ANY server! Perhaps an extension like NO SCRIPT is blocking things. error:7
09 1526ms No data seen at all during do
@BinToss
BinToss / AutoImplPropsInUnmanagedStructs.cs
Last active July 16, 2022 23:46
Auto-implemented properties add type-specific size to unmanaged struct as if they were fields
// Auto-implemented properties add type-specific size to unmanaged struct
/// (via Visual Studio Code extension ".NET Interactive"
struct tmp{
public nuint pp{get;set;}
}
System.Runtime.InteropServices.Marshal.SizeOf<tmp>().Display();
// 8 bytes on 64-bit runtime
// 4 bytes on 32-bit runtime
@BinToss
BinToss / BitfieldInUnmanagedStruct.cs
Last active July 17, 2022 00:50
C/C++ code often employs bitfields and unions (overlapping data) to save bandwidth and conserve memory. This is an example of a bitfield implemented in C#
/// bitfield experiment
/// <summary>C definition</summary>
/// <remarks>
/// <para>
/// C bitfield unions' maximum size is defined by the
/// size of the largest Type in the bitfield union.
/// </para>
/// <para>
@BinToss
BinToss / OpenProcess_PidNotFound.dib
Last active May 11, 2023 04:25
What does OpenProcess do when it cannot find a process with the given PID?
#!meta
{"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}}
#!csharp
/** Q: What does OpenProcess do when it cannot find a process with the given PID?
A: Returns a null handle and writes ERROR_SUCCESS (0) to "LastError"
*/
@BinToss
BinToss / GetFileType_badHandle.dib
Created May 11, 2023 04:28
What happens if a null, invalid, or closed handle if passed to GetFileType?
#!meta
{"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}}
#!csharp
/** Q: What happens if a null, invalid, or closed handle is passed to GetFileType?
A: If the handle passed to GetFileType is null, invalid (i.e. 0 or -1), or closed, the Win32Error code will be ERROR_INVALID_HANDLE (6)
*/
using Microsoft.Win32.SafeHandles;
@BinToss
BinToss / ReadProcessMemory_bufferSmallerThanSize.dib
Last active May 11, 2023 04:31
What happens if we supply a buffer to ReadProcessMemory, but it's smaller than the requested amount of bytes?
#!meta
{"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}}
#!csharp
/** Q: What happens if we supply a buffer to ReadProcessMemory, but it's smaller than the requested amount of bytes?
A: The buffer is filled to capacity and the Read operation continues until it has read the specified amount of bytes.
*/
@BinToss
BinToss / C# - flags.ToString().dib
Last active May 11, 2023 04:33
C# - How is a combination of flag values converted to string?
#!meta
{"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}}
#!csharp
/** Q: How is a combination of flag values converted to string?
A: 3 is "one, two"
*/
[Flags]
@BinToss
BinToss / IsWow64Process2_processIsNative.dib
Last active May 11, 2023 04:40
Using IsWow64Process2, how do we determine if a process is running natively?
#!meta
{"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}}
#!csharp
/** Q: Using IsWow64Process2, how do we determine if a process is running natively?
A: pProcessMachine will be assigned the UNKNOWN enum value.
*/