我制作了一个简单的 UWP 应用程序和一个桌面应用程序。这段代码将ConsoleApplication1.dll文件注入桌面是正常的,但是我无法注入到UWP应用程序中。我有两个问题:为什么此代码无法注入 UWP 应用程序?以及如何解决?
此代码注入一个 DLL 文件
#include "pch.h"
#include <vector>
#include <string>
#include <windows.h>
#include <Tlhelp32.h>
using std::vector;
using std::string;
int main(void)
{
while (true)
{
vector<string>processNames;
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(PROCESSENTRY32);
HANDLE hTool32 = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
BOOL bProcess = Process32First(hTool32, &pe32);
if (bProcess == TRUE)
{
while ((Process32Next(hTool32, &pe32)) == TRUE)
{
processNames.push_back(pe32.szExeFile);
if (strcmp(pe32.szExeFile, "ConsoleApplication4.exe") == 0 || strcmp(pe32.szExeFile, "UWP.exe") == 0)
{
printf("Hooked %s, %d \n", pe32.szExeFile, pe32.th32ProcessID);
char* DirPath = new char[MAX_PATH];
char* FullPath …Run Code Online (Sandbox Code Playgroud)