开发者

Opensource dll injector

开发者 https://www.devze.com 2023-04-05 14:59 出处:网络
I have developed a tool that changes the appearance of certain programs. To do it I need to inject a dll in some processes.

I have developed a tool that changes the appearance of certain programs. To do it I need to inject a dll in some processes.

For now I use basically this approach. The problem is often people cannot inject the dll because they don't run the target process as an admin or other things I don't understand开发者_如何学JAVA (someone couldn't inject on vista at all, even with UAC off) so it is pretty os dependant.

Is there a reliable opensource solution that I could use in my application, that allows troubleshooting like identifying user problems?


The method is quite common and reliable.

Just try adding

 HANDLE hToken;
 LUID sedebugnameValue;
 TOKEN_PRIVILEGES tkp;
  if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) puts("Failed to Enable Debug Options!");
  if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &sedebugnameValue))
  {
   CloseHandle(hToken);
   puts("Failed to Enable Debug Options!");
   gets(temp);
   return 0;
  }
 tkp.PrivilegeCount = 1;
 tkp.Privileges[0].Luid = sedebugnameValue;
 tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
 if (!AdjustTokenPrivileges(hToken, FALSE, &tkp, sizeof tkp, NULL, NULL)) CloseHandle(hToken);

So your injection app will get debug privileges.


It can be useful to learn sources of Detours: http://research.microsoft.com/en-us/projects/detours/

0

精彩评论

暂无评论...
验证码 换一张
取 消