int main(const int argc, const char* argv[]) { if (argc != 3 && argc != 4 && argc != 5) { logError(L"Not enough arguments, requiring 2: <target> <dll> [<0|default 1|inject, 2|eject>]!", argc); system("PAUSE"); return 0; } std::string sTarget(argv[1]); std::string sDll(argv[2]); auto option = 0; auto isRemoteThread = true; if(argc > 3) { isRemoteThread = atoi(argv[3]) == 0 ? true : false; } if(argc == 5) { option = atoi(argv[4]); if(option>2 || option < 0) { logError(L"Invalid 3rd parameter given.", option); system("PAUSE"); return 0; } } logInfo(L"Injecting DLL into " + std::wstring(sTarget.begin(), sTarget.end())); //SetDebugPrivilege(); Injector* iInjector = nullptr; if(isRemoteThread) { iInjector = new RemoteThreadInjector(sTarget, sDll); } else { iInjector = new WindowsHookInjector(sTarget, sDll); } if (option == 0 || option == 1) { iInjector->inject(); logInfo(L"Finished injecting"); system("PAUSE"); } if(option == 0 || option == 2) { iInjector->free(); logInfo(L"Ejected!"); system("PAUSE"); } iInjector->Release(); delete iInjector; return 0; }
CString FileMisc::ResolveShortcut(LPCTSTR szShortcut) { // start by checking its a valid file if (!FileExists(szShortcut)) { return _T(""); } CoInitialize(NULL); HRESULT hResult; IShellLink* psl; CString sTarget(szShortcut); hResult = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&psl); if (SUCCEEDED(hResult)) { LPPERSISTFILE ppf; hResult = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf); if (SUCCEEDED(hResult)) { hResult = ppf->Load(ATL::CT2OLE(szShortcut), STGM_READ); if (SUCCEEDED(hResult)) { hResult = psl->Resolve(NULL, SLR_ANY_MATCH | SLR_NO_UI); if (SUCCEEDED(hResult)) { TCHAR szPath[MAX_PATH]; WIN32_FIND_DATA wfd; //fabio_2005 #if _MSC_VER >= 1400 _tcscpy_s(szPath, szShortcut); #else _tcscpy(szPath, szShortcut); #endif hResult = psl->GetPath(szPath, MAX_PATH, (WIN32_FIND_DATA*)&wfd, SLGP_SHORTPATH); if (SUCCEEDED(hResult)) { sTarget = CString(szPath); } } } ppf->Release(); } psl->Release(); } CoUninitialize(); return sTarget; }
void wxLIRCCSession::onCTCPAction( const char * event, const char * origin, const char ** params, unsigned int count ) { wxArrayString data; wxString sNick( origin, wxConvUTF8 ); wxString sTarget( params[0], wxConvUTF8 ); wxString sMsg( params[1], wxConvUTF8 ); data.Add( sNick ); // Who generates the message. data.Add( sTarget ); // Mandatory?, contains the target name. data.Add( sMsg ); // Mandatory, the ACTION message. wxLIRCCSessionEvent sessionevent = wxLIRCCSessionEvent( wxLIRCC_EVT_THREAD_CTCPACT, wxLIRCC_ID_CTCP_ACTION, this ); sessionevent.SetParams( data ); wxQueueEvent( wxLIRCCSessionManager::Get(), sessionevent.Clone() ); }
void wxLIRCCSession::onChanNotice( const char * event, const char * origin, const char ** params, unsigned int count ) { if ( count < 1 ) return; wxArrayString data; wxString sNick( origin, wxConvUTF8 ); wxString sTarget( params[0], wxConvUTF8 ); wxString sMsg( params[1], wxConvUTF8 ); data.Add( sNick ); // Who generates the message. data.Add( sTarget ); // Mandatory, contains the channel name. data.Add( sMsg ); // Optional, contains the message text. wxLIRCCSessionEvent sessionevent = wxLIRCCSessionEvent( wxLIRCC_EVT_THREAD_CHAN_NOTICE, wxLIRCC_ID_CHAN_NOTICE, this ); sessionevent.SetParams( data ); wxQueueEvent( wxLIRCCSessionManager::Get(), sessionevent.Clone() ); }
/** * Constructor. * * @param * @return * @exception - * @see */ CXMLDocument::CXMLDocument() { HRESULT hr = m_domDocument.CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER); ASSERT(hr == S_OK); // create processing instruction node CComPtr<IXMLDOMProcessingInstruction> pPINode; CComBSTR sTarget("xml"); CComBSTR sData("version=\"1.0\" encoding=\"UTF-8\""); hr = m_domDocument->createProcessingInstruction(sTarget, sData, &pPINode); if(hr == S_OK) { // add processing instruction node to document CComQIPtr<IXMLDOMNode, &IID_IXMLDOMNode> docNode = m_domDocument; CComPtr<IXMLDOMNode> pOutNode; hr = docNode->appendChild(pPINode, &pOutNode); ASSERT(hr == S_OK); } }