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
// Returns an OBJECT_NAME_INFORMATION object pointed by name | |
// Caller must free `name` after usage | |
UNICODE_STRING* GetObjectNameInformation(HANDLE object_handle) | |
{ | |
ULONG length = 0; | |
UNICODE_STRING* obj = (UNICODE_STRING*)malloc(sizeof(UNICODE_STRING)); | |
NTSTATUS(*myNtQueryObject)(HANDLE, ObjectInfoClass, UNICODE_STRING*, uint32_t, PULONG) = (NTSTATUS(*)(HANDLE, ObjectInfoClass, UNICODE_STRING*, uint32_t, PULONG))GetProcAddress(GetModuleHandle("ntdll"), "NtQueryObject"); | |
NTSTATUS status = myNtQueryObject(object_handle, ObjectNameInformation, obj, sizeof(UNICODE_STRING), &length); | |
if (!NT_SUCCESS(status) && (status == 0xc0000004 || status == 0x80000005)) | |
{ |
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
use mlua::Lua; | |
use rustyline::{ | |
CompletionType, Config, EditMode, Editor, | |
completion::{Completer, Pair, extract_word}, | |
error::ReadlineError, | |
history::FileHistory, | |
}; | |
use rustyline_derive::{Helper, Highlighter, Hinter, Validator}; | |
struct MyObject { |
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 <clang/AST/ASTConsumer.h> | |
#include <clang/AST/RecursiveASTVisitor.h> | |
#include <clang/Frontend/FrontendAction.h> | |
#include <clang/Frontend/FrontendActions.h> | |
#include <clang/Tooling/CommonOptionsParser.h> | |
#include <clang/Tooling/Tooling.h> | |
#include <llvm/Support/CommandLine.h> | |
#include <llvm/Support/MemoryBuffer.h> | |
#include <filesystem> |
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
use std::fs; | |
use tree_sitter::{InputEdit, Language, Node, Parser, Point}; | |
use tree_sitter_cpp; | |
fn find_matching_parenthesis(node: &Node) -> Option<usize> { | |
for index in (0..node.child_count()).rev() { | |
println!("{}", node.child(index).unwrap()); | |
let current = node.child(index).unwrap(); | |
if current.kind() == ")" { |
OlderNewer