コード例 #1
0
//-----------------------------------------------
// MainDlgProc
// Notice: dialog procedure
//
BOOL CALLBACK MainDlgProc (HWND hDlg,	// handle to dialog box
						   UINT uMsg,      // message
						   WPARAM wParam,  // first message parameter
						   LPARAM lParam ) // second message parameter
{
	switch (uMsg) {
	case WM_COMMAND:
		if (!bInj) {
			bInj = InjectCode( hStart );
			if (bInj)
				::SetDlgItemText( hDlg, IDC_BUTTON, TEXT("Eject") );
		}
		else {
			bInj = !EjectCode();
			if (!bInj)
				::SetDlgItemText( hDlg, IDC_BUTTON, TEXT("Let's Inject") );
		}
		break;

	case WM_CLOSE:
		// be polite and restore the old window procedure (but  
		// note that we could leave the START button subclassed, too)
		if( bInj ) 
			bInj = !EjectCode( );

		if( bInj )
			::MessageBox( NULL, TEXT("Injected code could not be removed"),TEXT("  Error"),MB_OK );

		::EndDialog (hDlg, 0);
		break;		
	}

	return false;
}
コード例 #2
0
ファイル: Inject.c プロジェクト: justdan96/VNCappWrapper
/*************************************
 * Eject code from a remote process. *
 *************************************/
BOOL Eject()
{
#ifdef INJECT_DLL
    return (EjectDll() != 0);
#else
    return (EjectCode() != 0);
#endif
}