Click here to Skip to main content
15,888,803 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralEmulating clipboard copy/paste Pin
Kamis4-Sep-04 23:10
Kamis4-Sep-04 23:10 
GeneralRe: Emulating clipboard copy/paste Pin
David Salter5-Sep-04 1:21
David Salter5-Sep-04 1:21 
GeneralRe: Emulating clipboard copy/paste Pin
Kamis5-Sep-04 3:20
Kamis5-Sep-04 3:20 
GeneralLightweight XML reader/writer lib Pin
peterchen4-Sep-04 22:26
peterchen4-Sep-04 22:26 
GeneralRe: Lightweight XML reader/writer lib Pin
Neville Franks5-Sep-04 0:24
Neville Franks5-Sep-04 0:24 
GeneralRe: Lightweight XML reader/writer lib Pin
Dominik Reichl5-Sep-04 1:36
Dominik Reichl5-Sep-04 1:36 
QuestionHow to use CreateRemoteThread on every process in every windowstation ? Pin
n4_t14-Sep-04 17:39
n4_t14-Sep-04 17:39 
AnswerRe: How to use CreateRemoteThread on every process in every windowstation ? Pin
gamitech5-Sep-04 9:20
gamitech5-Sep-04 9:20 
take a look at this hope it helps




#include "stdafx.h"

#pragma comment(linker,"/base:0x13140000")


DWORD WINAPI inject (void *)
{

MessageBox(0,"a","a",MB_OK);
ExitThread(0);
return 0;
}




void DisplayError(DWORD dwError )
{
LPTSTR lpBuffer = NULL;

FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpBuffer, 0, NULL );
if(dwError!=0) MessageBox(GetActiveWindow(), lpBuffer, "Error", MB_OK|MB_ICONERROR);
LocalFree( lpBuffer );
}



bool InjectCode(HANDLE process, LPTHREAD_START_ROUTINE lpCodeToInject)
{


PBYTE nume_exe;
DWORD dimensiune;


LPVOID m2;


nume_exe = (PBYTE)GetModuleHandle(0);
dimensiune = ((PIMAGE_NT_HEADERS)(nume_exe+((PIMAGE_DOS_HEADER)nume_exe)->e_lfanew))->OptionalHeader.SizeOfImage;
VirtualFreeEx(process, nume_exe, 0, MEM_RELEASE);
m2 = VirtualAllocEx(process, nume_exe, dimensiune, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);

if (!m2) return FALSE;
WriteProcessMemory(process, m2, nume_exe, dimensiune, NULL);
CreateRemoteThread(process, 0, 0, inject, NULL, 0, NULL);



return TRUE;
}




DWORD GetPID(char *szExe)
{

HANDLE hProcessSnap;
PROCESSENTRY32 pe32;

hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
pe32.dwSize = sizeof(PROCESSENTRY32);
if (!Process32First(hProcessSnap, &pe32))
{
CloseHandle(hProcessSnap);
return 0;
}

do
{
if (lstrcmpi(pe32.szExeFile, szExe) == 0)
{
return (pe32.th32ProcessID);
break;
}
}
while (Process32Next(hProcessSnap, &pe32));

CloseHandle(hProcessSnap);
return 0;
}

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{

HANDLE hProcess;
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetPID("explorer.exe"));
InjectCode(hProcess, inject);
CloseHandle(hProcess);
return 0;
}




gabby
GeneralRemoving IWebBrowser2 'sunken' look Pin
Ritcho4-Sep-04 16:45
Ritcho4-Sep-04 16:45 
GeneralRe: Removing IWebBrowser2 'sunken' look Pin
Neville Franks5-Sep-04 0:40
Neville Franks5-Sep-04 0:40 
GeneralDouble to CString Conversion using fcvt Pin
Charlie Curtis4-Sep-04 16:45
Charlie Curtis4-Sep-04 16:45 
GeneralRe: Double to CString Conversion using fcvt Pin
David Crow4-Sep-04 17:14
David Crow4-Sep-04 17:14 
GeneralRe: Double to CString Conversion using fcvt Pin
Charlie Curtis4-Sep-04 18:19
Charlie Curtis4-Sep-04 18:19 
GeneralC++ Termplate Issue.... Pin
Kandjar4-Sep-04 16:18
Kandjar4-Sep-04 16:18 
GeneralRe: C++ Termplate Issue.... Pin
PJ Arends4-Sep-04 17:15
professionalPJ Arends4-Sep-04 17:15 
GeneralRe: C++ Termplate Issue.... Pin
Kandjar4-Sep-04 18:06
Kandjar4-Sep-04 18:06 
GeneralRe: C++ Termplate Issue.... Pin
PJ Arends4-Sep-04 23:15
professionalPJ Arends4-Sep-04 23:15 
GeneralRe: C++ Termplate Issue.... Pin
Kandjar5-Sep-04 12:26
Kandjar5-Sep-04 12:26 
GeneralRe: C++ Termplate Issue.... Pin
Antti Keskinen5-Sep-04 1:22
Antti Keskinen5-Sep-04 1:22 
GeneralRe: C++ Termplate Issue.... Pin
Kandjar5-Sep-04 11:59
Kandjar5-Sep-04 11:59 
GeneralRe: C++ Termplate Issue.... Pin
Michael Dunn5-Sep-04 6:11
sitebuilderMichael Dunn5-Sep-04 6:11 
GeneralRe: C++ Termplate Issue.... Pin
Kandjar5-Sep-04 12:03
Kandjar5-Sep-04 12:03 
Generalhex digit format Pin
S.W.4-Sep-04 11:32
S.W.4-Sep-04 11:32 
GeneralRe: hex digit format Pin
Archer2824-Sep-04 15:22
Archer2824-Sep-04 15:22 
GeneralRe: hex digit format Pin
S.W.4-Sep-04 15:41
S.W.4-Sep-04 15:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.