C++ - Unresolved External in DLL Injector : <p>I can't really see the reason I am getting this error, I have had a look arround and apparently it's something to do with defining a function that does nothing? I can't really tell what the issue is here unfortunately so any help would be appreciated.</p>

<p>Here is my source code:</p>

<p>main.cpp</p>

<pre><code>#include &lt;Windows.h&gt; 
#include &lt;tlhelp32.h&gt; 
#include &lt;shlwapi.h&gt; 
#include &lt;conio.h&gt; 
#include &lt;stdio.h&gt; 
#include &lt;iostream&gt;

using namespace std;

#define WIN32_LEAN_AND_MEAN 
#define CREATE_THREAD_ACCESS (PROCESS_CREATE_THREAD |    PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION | PROCESS_VM_WRITE |    PROCESS_VM_READ) 

BOOL Inject(DWORD pID, const char * DLL_NAME); 
DWORD GetTargetThreadIDFromProcName(const char * ProcName); 

using namespace std;

char buf[MAX_PATH];
LPVOID RemoteString, LoadLib;
HANDLE Proc;
DWORD pID;

__int32 main() 
{
   pID = GetTargetThreadIDFromProcName("Program.exe"); 

   buf[MAX_PATH] = {0}; 
   GetFullPathName("DLL.dll", MAX_PATH, buf, NULL);

   if(!Inject(pID, buf)) cout &lt;&lt; ("Failed to inject!\n\n\n");
   system("pause");
   return 0; 
} 

BOOL Inject(DWORD pID, const char * DLL_NAME) 
{  
   char buf[50] = {0}; 

   if(!pID) return false; 

   Proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pID); 
   if(!Proc) return false; 

   LoadLib = (LPVOID)GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA"); 
   RemoteString = (LPVOID)VirtualAllocEx(Proc, NULL, strlen(DLL_NAME), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); 
   WriteProcessMemory(Proc, (LPVOID)RemoteString, DLL_NAME, strlen(DLL_NAME),    NULL); 
   CreateRemoteThread(Proc, NULL, NULL, (LPTHREAD_START_ROUTINE)LoadLib,    (LPVOID)RemoteString, NULL, NULL); 
   CloseHandle(Proc); 
   return true; 
} 

DWORD GetTargetThreadIDFromProcName(const char * ProcName) 
{ 
   PROCESSENTRY32 pe; 
   HANDLE thSnapShot; 
   BOOL retval, ProcFound = false; 

   thSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); 
   if(thSnapShot == INVALID_HANDLE_VALUE) return false; 

   pe.dwSize = sizeof(PROCESSENTRY32); 
   retval = Process32First(thSnapShot, &amp;pe); 
   while(retval) 
   { 
      if(StrStrI(pe.szExeFile, ProcName)) return pe.th32ProcessID; 
      retval = Process32Next(thSnapShot, &amp;pe); 
   } 
   return 0; 
}
</code></pre>

<p>The error I am getting is the following:</p>

<p>main.obj</p>

<pre><code>unresolved external symbol __imp__StrStrIA@8 referenced in function "unsigned long __cdecl GetTargetThreadIDFromProcName(char const *)" (?GetTargetThreadIDFromProcName@@YAKPBD@Z)
</code></pre>

<p>Injector.exe</p>

<pre><code>1 unresolved externals
</code></pre>

<p>Any solutions or just some help on understanding why this occurs would be great!</p>
