Click here to Skip to main content
15,892,480 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
GeneralRe: Question about time stamp info stored in the file? Pin
Kuang Cao29-Dec-04 10:53
Kuang Cao29-Dec-04 10:53 
GeneralDatabase problems Pin
Deian29-Dec-04 8:48
Deian29-Dec-04 8:48 
GeneralRe: Database problems Pin
David Crow29-Dec-04 9:46
David Crow29-Dec-04 9:46 
Generaledit ctrl Pin
act_x29-Dec-04 7:53
act_x29-Dec-04 7:53 
GeneralRe: edit ctrl Pin
David Crow29-Dec-04 9:49
David Crow29-Dec-04 9:49 
GeneralRe: edit ctrl Pin
act_x29-Dec-04 10:12
act_x29-Dec-04 10:12 
QuestionTooltip Flickers Continously ? Pin
Azghar Hussain29-Dec-04 7:39
professionalAzghar Hussain29-Dec-04 7:39 
AnswerRe: Tooltip Flickers Continously ? Pin
PJ Arends29-Dec-04 8:11
professionalPJ Arends29-Dec-04 8:11 
GeneralZ-ordering, wndTopMost and modal dialogs Pin
moredip29-Dec-04 7:33
moredip29-Dec-04 7:33 
GeneralRe: Z-ordering, wndTopMost and modal dialogs Pin
Michael Dunn29-Dec-04 14:12
sitebuilderMichael Dunn29-Dec-04 14:12 
GeneralImage processing with visual studio Pin
monageasmear29-Dec-04 6:02
monageasmear29-Dec-04 6:02 
GeneralSome input please Pin
Tom Wright29-Dec-04 4:53
Tom Wright29-Dec-04 4:53 
GeneralRe: Some input please Pin
Ravi Bhavnani29-Dec-04 5:20
professionalRavi Bhavnani29-Dec-04 5:20 
GeneralRe: Some input please Pin
David Crow29-Dec-04 9:52
David Crow29-Dec-04 9:52 

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.