title: IDP.Generic when i try to run a dll injector in visual studio. Is this safe to run? (can i even get a virus from VS?)
body: <pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt;
  #include &lt;Windows.h&gt;
  #include &lt;TlHelp32.h&gt;
  
  DWORD GetProcId(const char* procName)
  {
      DWORD procId = 0;
      HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  
      if (hSnap != INVALID_HANDLE_VALUE)
      {
          PROCESSENTRY32 procEntry;
          procEntry.dwSize = sizeof(procEntry);
  
          if (Process32First(hSnap, &amp;procEntry))
          {
              do
              {
                  if (!_stricmp(procEntry.szExeFile, procName))
                  {
                      procId = procEntry.th32ProcessID;
                      break;
                  }
              } while (Process32Next(hSnap, &amp;procEntry));
          }
      }
      CloseHandle(hSnap);
      return procId;
  }
  
  int main()
  {
      const char* dllPath = &quot;C:\\Users\\tme\\Downloads\\dll.dll&quot;;
      const char* procName = &quot;Application.exe&quot;;
      DWORD procId = 0;
  
      while (!procId)
      {
          procId = GetProcId(procName);
          Sleep(30);
      }
  
      HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, 0, procId);
  
      if (hProc &amp;&amp; hProc != INVALID_HANDLE_VALUE)
      {
          void* loc = VirtualAllocEx(hProc, 0, MAX_PATH, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
  
          WriteProcessMemory(hProc, loc, dllPath, strlen(dllPath) + 1, 0);
  
          HANDLE hThread = CreateRemoteThread(hProc, 0, 0, (LPTHREAD_START_ROUTINE)LoadLibraryA, loc, 0, 0);
  
          if (hThread)
          {
              CloseHandle(hThread);
          }
      }
  
      if (hProc)
      {
          CloseHandle(hProc);
      }
  
      return 0;
  }
  </code></pre>