Skip to content

Instantly share code, notes, and snippets.

#ifndef OFFSETOFCLASS
#define OFFSETOFCLASS(base, derived) ((ULONG)((LONG_PTR)(static_cast<base*>((derived*)MINLONG_PTR))-MINLONG_PTR))
#endif
__declspec(noinline) NTSTATUS TestQuery(PVOID pv, ULONG cb, ULONG* rcb)
{
ULONG s = GetTickCount() ? 0x64 : 0x20;
DbgPrint("API: 0x%p 0x%x | 0x%p << 0x%x\n", pv, cb, RtlOffsetToPointer(pv, cb), s);
*rcb = s;
if (cb < s)
#include <ntlsa.h>
VOID CheckWindowsPrivileges(DWORD PID)
{
if (HANDLE hProcess = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, PID))
{
HANDLE hToken;
BOOL b = OpenProcessToken(hProcess, TOKEN_QUERY, &hToken);
CloseHandle(hProcess);
if (b)
BOOL timer_create(
_Outptr_ PHANDLE phTimer,
_In_ WAITORTIMERCALLBACK Callback,
_In_opt_ PVOID Parameter,
_In_ DWORD DueTime,
_In_ DWORD Period
);
void timer_release(HANDLE /*hTimer*/);
struct DTimer
{
HANDLE _M_hTimer = 0;
LONG _M_dwRefCount = 1;
ULONG _M_n = 0;
ULONG _M_dwThreadId = GetCurrentThreadId();
LONG _M_stopping = FALSE;
void AddRef()
{
#define printf DbgPrint
#ifndef IDC_STATIC
#define IDC_STATIC 65535 // MAXUSHORT
#endif
struct DTimer
{
HANDLE _M_hTimer = 0;
LONG _M_dwRefCount = 1;
NTSTATUS ShowAuthPackage()
{
HANDLE hToken;
NTSTATUS status = NtOpenProcessToken(NtCurrentProcess(), TOKEN_QUERY, &hToken);
if (0 <= status)
{
TOKEN_STATISTICS ts;
status = NtQueryInformationToken(hToken, TokenStatistics, &ts, sizeof(ts), &ts.DynamicAvailable);
NtClose(hToken);
#include "stdafx.h"
_NT_BEGIN
NTSTATUS CreatePlaceHolder(PCWSTR lpFileName, ULONG SizeOfImage)
{
struct SEF : IMAGE_DOS_HEADER, IMAGE_NT_HEADERS, IMAGE_SECTION_HEADER
{
} y {};
void MinimizeAll(_In_ BOOL bDialogsToo, _In_opt_ HWND hwndMy = 0)
{
if (HWND hwnd = FindWindowW(L"Shell_TrayWnd", 0))
{
ULONG dwProcessId;
if (GetWindowThreadProcessId(hwnd, &dwProcessId))
{
AllowSetForegroundWindow(dwProcessId);
//WCHAR name[0x100];
сейчас у нас есть 2 формата ответов ( FAILURE / OK )
<responseHolder>
<status>FAILURE</status>
<error>
<code>%u</code>
<message>%s</message>
</error>
</responseHolder>
************************
//++ObjectSecurity
DACL:
T FL AcessMsK Sid
A 00 000F01FF [S-1-5-18] 'NT AUTHORITY\SYSTEM' [WellKnownGroup]
A 00 00020008 [S-1-5-32-544] 'BUILTIN\Administrators' [Alias]
A 00 000F01FF [S-1-5-32-544] 'BUILTIN\Administrators' [Alias]
A 00 000F01FF [S-1-5-21-3349500742-45979764-2889026240-500] 'AAA\Administrator' [User]
A 00 000F01FF [S-1-5-21-3349500742-45979764-2889026240-1109] 'AAA\Kelly' [User]
LABEL: