Exemplo n.º 1
0
void Dlg_OnCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
{

    switch (id)
    {
    case IDCANCEL:
        EndDialog(hWnd, id);
        break;

    case IDC_INJECT:
        DWORD dwProcessId = GetDlgItemInt(hWnd, IDC_PROCESSID, NULL, FALSE);
        if (dwProcessId == 0)
        {
            // A process ID of 0 causes everything to take place in the
            // local process; this makes things easier for debugging.
            dwProcessId = GetCurrentProcessId();
        }

        TCHAR szLibFile[MAX_PATH];
        GetModuleFileName(NULL, szLibFile, _countof(szLibFile));
        PTSTR pFilename = _tcsrchr(szLibFile, TEXT('\\')) + 1;
        _tcscpy_s(pFilename, _countof(szLibFile) - (pFilename - szLibFile),
                  TEXT("22-ImgWalk.DLL"));
        if (InjectLib(dwProcessId, szLibFile))
        {
            chVERIFY(EjectLib(dwProcessId, szLibFile));
            chMB("DLL Injection/Ejection successful.");
        }
        else
        {
            chMB("DLL Injection/Ejection failed.");
        }
        break;
    }
}
Exemplo n.º 2
0
// MBCS version of InjectLib
void Injector::InjectLib(DWORD ProcID, const std::string& Path)
{
	// Convert path to unicode
	std::wstring UnicodePath(Path.begin(),Path.end());

	// Call the Unicode version of the function to actually do the work.
	InjectLib(ProcID, UnicodePath);
}
Exemplo n.º 3
0
BOOL KInject::Inject2Process(DWORD dwPid, LPCTSTR szDLL){
	if(InjectLib(dwPid, szDLL)==TRUE) return 0;
	return -1;
}