MCPcopy Create free account
hub / github.com/0xJs/RedTeaming_CheatSheet / FindThread

Function FindThread

coding/projects/Code_Injection/MapView/implant.cpp:163–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163HANDLE FindThread(int pid){
164
165 HANDLE hThread = NULL;
166 THREADENTRY32 thEntry;
167
168 thEntry.dwSize = sizeof(thEntry);
169 HANDLE Snap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
170
171 while (Thread32Next(Snap, &thEntry)) {
172 if (thEntry.th32OwnerProcessID == pid) {
173 hThread = OpenThread(THREAD_ALL_ACCESS, FALSE, thEntry.th32ThreadID);
174 break;
175 }
176 }
177 CloseHandle(Snap);
178
179 return hThread;
180}
181
182// map section views injection
183int InjectVIEW(HANDLE hProc, unsigned char * payl, unsigned int payl_len) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected