????DLL??????????????
?????????????£?????С??????????????????????????
????DLL????????????????????????????????????DLL?п??????????????????????
???????????
????1?????????????LoadLibrary?????????DLL???????????????CreateRemoteThread??LoadLibrary????????????????????????????????“?????????????LoadLibrary”???????
????2?????DLL??DllMain????DLL??е????????MFC??DLL??InitInstance????DLL??е????????????????????
???????
????a????????????????????????DLLMain????DLL????????MFC??DLL????InitInstance??????μ??????????????????????????????С??????????MFC??DLL????????????
????b????????????????MFC??????????DLL???????????????????MFC??DLL??
??????????
????1????DLL?????????????????????????
????2?????CreateRemoteThread??LoadLibrary???????????????????????
??????????????е????????????????????????????
??????ó???????????
// #pragma once
#include <windows.h>
#include <TlHelp32.h>
#include <iostream>
#include <time.h>
// ??????????????
bool enableDebugPriv()
{
HANDLE  hToken;
LUID    sedebugnameValue;
TOKEN_PRIVILEGES tkp;
if  ( !OpenProcessToken(  GetCurrentProcess()??
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY?? &hToken)
)
{
return false;
}
if( !LookupPrivilegeValue(NULL?? SE_DEBUG_NAME?? &sedebugnameValue) )
{
CloseHandle(hToken);
return false;
}
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Luid = sedebugnameValue;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
if( !AdjustTokenPrivileges(hToken?? FALSE?? &tkp?? sizeof(tkp)?? NULL?? NULL) )
{
CloseHandle(hToken);
return false;
}
return true;
}