rapid7/metasploit-framework

View on GitHub
external/source/exploits/bypassuac_injection/dll/src/Exploit.h

Summary

Maintainability
Test Coverage
#include <Windows.h>
#include <commctrl.h>
#include <shlobj.h>
#include <Shellapi.h>
#include <stdio.h>
#include <guiddef.h>

// Uncomment this line to include debug output
//#define DEBUGTRACE

#ifdef DEBUGTRACE
#define dprintf(...) real_dprintf(__VA_ARGS__)
static void real_dprintf(char *format, ...)
{
    va_list args;
    char buffer[1024];
    va_start(args, format);
    vsnprintf_s(buffer, sizeof(buffer), sizeof(buffer)-3, format, args);
    strcat_s(buffer, sizeof(buffer), "\r\n");
    OutputDebugStringA(buffer);
}
#else
#define dprintf(...)
#endif

typedef struct _BypassUacPaths
{
    wchar_t szElevDir[MAX_PATH];
    wchar_t szElevDirSysWow64[MAX_PATH];
    wchar_t szElevDll[MAX_PATH];
    wchar_t szElevDllFull[MAX_PATH];
    wchar_t szElevExeFull[MAX_PATH];
    wchar_t szDllTempPath[MAX_PATH];
} BypassUacPaths;

EXTERN_C void exploit(BypassUacPaths const * const paths);