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 EjectLib
void Injector::EjectLib(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.
	EjectLib(ProcID, UnicodePath);
}