MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / IsManaged

Method IsManaged

WinSysCore/Processes.cpp:249–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247}
248
249bool Process::IsManaged() const {
250 wil::unique_handle hProcess;
251 if (!::DuplicateHandle(::GetCurrentProcess(), _handle.get(), ::GetCurrentProcess(), hProcess.addressof(),
252 PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, 0))
253 return false;
254
255 WCHAR filename[MAX_PATH], sysPath[MAX_PATH];
256 BOOL wow64 = FALSE;
257 ::IsWow64Process(hProcess.get(), &wow64);
258 ::GetSystemDirectory(sysPath, MAX_PATH);
259 ::wcscat_s(sysPath, L"\\mscoree.dll");
260
261 HMODULE hModule[64];
262 DWORD needed;
263 if (!::EnumProcessModulesEx(hProcess.get(), hModule, sizeof(hModule), &needed, wow64 ? LIST_MODULES_32BIT : LIST_MODULES_ALL))
264 return false;
265
266 int count = min(_countof(hModule), needed / sizeof(HMODULE));
267
268 for (int i = 0; i < count; i++) {
269 if(::GetModuleFileNameEx(hProcess.get(),hModule[i],filename,MAX_PATH)==0)
270 continue;
271 if (::_wcsicmp(filename, sysPath) == 0)
272 return true;// �Ƿ����йܳ���
273 }
274 return false;
275}
276
277WinSys::ProcessPriorityClass Process::GetPriorityClass() const {
278 return static_cast<ProcessPriorityClass>(::GetPriorityClass(_handle.get()));

Callers 1

GetAttributesMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected