49 lines
961 B
C++
49 lines
961 B
C++
#pragma once
|
|
#ifndef UTILS_H
|
|
#define UTILS_H
|
|
#include "Base.h"
|
|
|
|
|
|
struct WINDOWS_VERSION
|
|
{
|
|
DWORD Major;
|
|
DWORD Minor;
|
|
DWORD Build;
|
|
DWORD UBR;
|
|
|
|
const char* Name;
|
|
};
|
|
|
|
|
|
namespace utils
|
|
{
|
|
BYTE* ReadBinaryFile(const char* filePath, DWORD* outSize);
|
|
|
|
BOOL WriteShellcodeToFile(const char* filePath, const BYTE* shellcode, SIZE_T shellcodeSize);
|
|
BOOL CreateDirectoryRecursive(const char* path);
|
|
|
|
auto GetProcessByName(CONST wchar_t* Name)->DWORD;
|
|
|
|
BOOL RegReadString(HKEY hRoot, LPCSTR szSubKey, LPCSTR szValueName, char* outBuf, DWORD bufSize);
|
|
|
|
// 不区分大小写宽字符串查找
|
|
bool StrContainsI(LPCWSTR Source, LPCWSTR Sub);
|
|
|
|
void GetProcessName(
|
|
DWORD ProcessId,
|
|
char* ProcessName,
|
|
DWORD ProcessNameSize
|
|
);
|
|
|
|
//检测是否是32位操作系统
|
|
bool Is32BitOperatingSystem();
|
|
|
|
//检测是否开启VBS和HVCI
|
|
BOOL CheckVBS(BOOL* vbsRunning, BOOL* hvciRunning);
|
|
|
|
//获取操作系统的版本和子版本号
|
|
bool GetWindowsVersion(WINDOWS_VERSION* Version);
|
|
}
|
|
|
|
#endif // !UTILS_h
|