MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2QuerySrv

Function Ext2QuerySrv

Ext2Mgr/Ext2Pipe.cpp:427–459  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

425
426
427DWORD Ext2QuerySrv(TCHAR *srv, DWORD *pids, DWORD as)
428{
429 DWORD total = 0;
430 HANDLE p = NULL;
431 PROCESSENTRY32 r = {0};
432
433 p = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
434 if (INVALID_HANDLE_VALUE == p)
435 return 0;
436
437 r.dwSize=sizeof(PROCESSENTRY32);
438 if (!Process32First(p, &r)) {
439 goto errorout;
440 }
441
442 do {
443 TCHAR *n = _tcsrchr(&r.szExeFile[0], _T('\\'));
444 if (!n)
445 n = &r.szExeFile[0];
446 if (_tcsicmp(n, srv) == 0) {
447 pids[total++] = r.th32ProcessID;
448 if (total >= as)
449 break;
450 }
451
452 } while(Process32Next(p, &r));
453
454errorout:
455
456 CloseHandle(p);
457
458 return total;
459}
460
461TCHAR *Ext2StrLastA(TCHAR *t, TCHAR *s)
462{

Callers 1

Ext2StartSrvFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected