Click here to Skip to main content
15,914,795 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralThanks a billion !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Pin
IsaacLitingjun30-Dec-04 18:35
IsaacLitingjun30-Dec-04 18:35 
GeneralThank you Thank you! ^.^ Pin
IsaacLitingjun30-Dec-04 18:40
IsaacLitingjun30-Dec-04 18:40 
GeneralSth. wrong with thread Pin
IsaacLitingjun6-Jan-05 16:27
IsaacLitingjun6-Jan-05 16:27 
GeneralRe: Sth. wrong with thread Pin
Rahim Rattani6-Jan-05 17:10
Rahim Rattani6-Jan-05 17:10 
GeneralRe: Sth. wrong with thread Pin
IsaacLitingjun6-Jan-05 18:41
IsaacLitingjun6-Jan-05 18:41 
GeneralRe: Sth. wrong with thread Pin
Rahim Rattani6-Jan-05 18:50
Rahim Rattani6-Jan-05 18:50 
GeneralI'm really so lucky!! Pin
IsaacLitingjun6-Jan-05 19:13
IsaacLitingjun6-Jan-05 19:13 
GeneralProblem solved, thx! Pin
IsaacLitingjun8-Jan-05 16:05
IsaacLitingjun8-Jan-05 16:05 
GeneralUsing this can solve that problem Pin
IsaacLitingjun6-Jan-05 18:50
IsaacLitingjun6-Jan-05 18:50 
GeneralRe: A question about GetDlgItem Pin
V.29-Dec-04 21:07
professionalV.29-Dec-04 21:07 
GeneralRe: A question about GetDlgItem Pin
Joseph M. Newcomer31-Dec-04 5:49
Joseph M. Newcomer31-Dec-04 5:49 
Generalpostmessage in a callback function Pin
Marcus Spitzmiller29-Dec-04 15:41
Marcus Spitzmiller29-Dec-04 15:41 
GeneralRe: postmessage in a callback function Pin
Neville Franks30-Dec-04 1:32
Neville Franks30-Dec-04 1:32 
GeneralRe: postmessage in a callback function Pin
Marcus Spitzmiller30-Dec-04 5:02
Marcus Spitzmiller30-Dec-04 5:02 
GeneralRe: postmessage in a callback function Pin
Neville Franks30-Dec-04 8:41
Neville Franks30-Dec-04 8:41 
GeneralRe: postmessage in a callback function Pin
Marcus Spitzmiller30-Dec-04 9:17
Marcus Spitzmiller30-Dec-04 9:17 
GeneralRe: postmessage in a callback function Pin
Neville Franks30-Dec-04 9:21
Neville Franks30-Dec-04 9:21 
GeneralPainting Node Pin
Adrian Soon29-Dec-04 15:27
Adrian Soon29-Dec-04 15:27 
GeneralRe: Painting Node Pin
PJ Arends29-Dec-04 22:59
professionalPJ Arends29-Dec-04 22:59 
GeneralRe: Painting Node Pin
Adrian Soon31-Dec-04 4:20
Adrian Soon31-Dec-04 4:20 
GeneralTraceroute Pin
hafiziziziz29-Dec-04 15:05
hafiziziziz29-Dec-04 15:05 
Generalwinsock send hooking(no ddk allowed) Pin
Spiritofamerica29-Dec-04 8:53
Spiritofamerica29-Dec-04 8:53 
OK, so I hook this function with a global hook like I would any other and I test it out with a program I made some time ago a client-server app that I knew used this function and it worked like a charm. All it had to d owas show me in a message box what was in the socket.

But then I tryed it with two bulk mailing programs that I had and it crashed both of them.

then I tryed it with outlook express and it didnt' say nothing.

What is wrong?

Why does the hook only work some of the time?


Also I found on a delphi programming site(I hate Delphi) the source of a program that attempted to do just what I was doing, but instead of using a system whide hook they somehow injected the dll into the virtual memory of Outlook and then the dll also made a hook but I don't know if it was global or not cause I don't have the source to their hooking object cause they are selling the source and I don't know Delphi that good either.

What I don't understand is how they expect to actually get the dll to work because they don't seem to be calling any function from it just loading the dll with LoadLibraryA.

I took a shot at translating the code to C and here it is but when I try this method that they(on the site) say works I get nothing(of course I am doing it in C as I don't have a Delphi compiler and with my own hooking class since they won't give me theirs)

void InjectLib(HANDLE hProcess, char *szLibPath)
{
//Vars
char szDLLPath[256];
LPVOID lpBuffer;
HANDLE hThread;
DWORD dwBytesWritten, dwThreadID;
LPTHREAD_START_ROUTINE lpModule;
strcpy(szDLLPath, szLibPath);
//Get LoadLibraryA
lpModule = (LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle("KERNEL32.DLL"), "LoadLibraryA");
//The Magic Happens Here!
lpBuffer = VirtualAllocEx(hProcess, NULL, sizeof(szDLLPath), MEM_COMMIT, PAGE_READWRITE);
WriteProcessMemory(hProcess, lpBuffer, szDLLPath, sizeof(szDLLPath), &dwBytesWritten);
hThread = CreateRemoteThread(hProcess, NULL, 0, lpModule, lpBuffer, 0, &dwThreadID);
WaitForSingleObject(hThread, 1000); //INFINITE
VirtualFreeEx(hProcess, lpBuffer, 0, MEM_RELEASE);
//The DLL Is Now Injected, Yay!
//Close Handles
CloseHandle(hThread);
CloseHandle(hProcess);
}
GeneralRe: winsock send hooking(no ddk allowed) Pin
ThatsAlok30-Dec-04 22:28
ThatsAlok30-Dec-04 22:28 
QuestionQuestion about time stamp info stored in the file? Pin
Kuang Cao29-Dec-04 8:50
Kuang Cao29-Dec-04 8:50 
AnswerRe: Question about time stamp info stored in the file? Pin
WoutL29-Dec-04 10:37
WoutL29-Dec-04 10:37 

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.