This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NTSTATUS enumerate_handles(ENUM_HANDLE_CALLBACK callback) | |
{ | |
NTSTATUS status = STATUS_UNSUCCESSFUL; | |
PVOID buffer = NULL; | |
ULONG bufferSize = 0; | |
do { | |
status = NtQuerySystemInformation((SYSTEM_INFORMATION_CLASS)16/*SystemHandleInformation*/, buffer, bufferSize, &bufferSize); | |
if(!NT_SUCCESS(status)) { | |
if(status == STATUS_INFO_LENGTH_MISMATCH) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HANDLE get_handle_to_process(LPWSTR process) | |
{ | |
HANDLE hProcess = NULL; | |
enumerate_handles([&](PSYSTEM_HANDLE_TABLE_ENTRY_INFO handle) { | |
if(GetCurrentProcessId() != handle->UniqueProcessId) return STATUS_UNSUCCESSFUL; | |
BOOL found = FALSE; | |
PVOID buffer = NULL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.yazzn { | |
box-sizing: border-box; | |
} | |
@media screen and (min-width: 999px) { | |
code.hljs.javascript { | |
border-radius: 5px; | |
max-width: 640px; | |
max-width: calc(100vw - 347px); | |
max-height: 700px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <cstdint> | |
#include <array> | |
#include <string> | |
template<typename T, uint32_t D> | |
class vec | |
{ | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NTSTATUS KapFindKernelPattern( | |
_In_ PUCHAR Pattern, | |
_In_ PUCHAR Mask, | |
_In_ ULONG PatternLength, | |
_Out_ PVOID* Result | |
) | |
{ | |
PIMAGE_NT_HEADERS NtHeaders; | |
PIMAGE_SECTION_HEADER FirstSection; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Lexer.hpp" | |
namespace sage | |
{ | |
namespace detail | |
{ | |
// ---------------------------------------------------------------------------- | |
inline char getCharAndAdvance(const char*& ptr) | |
{ | |
return *ptr++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "SafeHandles/SafeHandle.hpp" | |
#include "windows.hpp" | |
class SafeFileHandle // | |
: public SafeHandle<INVALID_HANDLE_VALUE> // | |
{ | |
public: | |
SafeFileHandle(void* handle) | |
: SafeHandle(handle, &SafeFileHandle::deleter) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required (VERSION 3.12) | |
# not strictly needed, but it helps when you forget to pass the CMAKE_TOOLCHAIN_FILE as argument to cmake | |
if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE) | |
set(CMAKE_TOOLCHAIN_FILE | |
"$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" | |
CACHE STRING "") | |
endif() | |
project(cmake_example CXX) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::string Board::prettyPrint(bool useUnicodeChars) const | |
{ | |
std::string_view charPieces[2][6] = { | |
{ | |
useUnicodeChars ? "\u2659" : "P", | |
useUnicodeChars ? "\u2657" : "B", | |
useUnicodeChars ? "\u2658" : "N", | |
useUnicodeChars ? "\u2656" : "R", | |
useUnicodeChars ? "\u2655" : "Q", | |
useUnicodeChars ? "\u2654" : "K", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void fail(beast::error_code ec, char const* what) | |
{ | |
// TODO: Better error logging | |
std::cerr << what << ": " << ec.message() << "\n"; | |
} | |
// ------------------------------------------------------------------------------------------------- | |
Gateway::Gateway(net::io_context& ioc, ssl::context& ctx) | |
: ws_(net::make_strand(ioc), ctx), | |
resolver_(net::make_strand(ioc)), | |
host_("gateway.discord.gg"s), |