Click here to Skip to main content
15,921,989 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionSetting the min size a floating dock bar can be sized to? Pin
Roger Allen9-Apr-02 6:45
Roger Allen9-Apr-02 6:45 
GeneralRegisterHotKey() Pin
Sumudu Perera9-Apr-02 6:23
Sumudu Perera9-Apr-02 6:23 
Generalfrom VC++6 to C++.net Pin
Sumudu Perera9-Apr-02 6:11
Sumudu Perera9-Apr-02 6:11 
GeneralRe: from VC++6 to C++.net Pin
Rick Crone9-Apr-02 6:41
Rick Crone9-Apr-02 6:41 
GeneralRe: from VC++6 to C++.net Pin
Sumudu Perera9-Apr-02 6:44
Sumudu Perera9-Apr-02 6:44 
GeneralCSplitterWnd and CToolBar Pin
dazinith9-Apr-02 6:02
dazinith9-Apr-02 6:02 
GeneralMicrosoft Paint's toolbar. Pin
kursatkaraca9-Apr-02 5:56
kursatkaraca9-Apr-02 5:56 
GeneralAlmost gettin' mad: sockaddr_in Pin
User 66589-Apr-02 5:19
User 66589-Apr-02 5:19 
Hi
As I mentioned in one of my threads before I'm working on a project that displays the traffic of other applications in a seperate window. For this purspose I'm using the Microsoft "Detours" library.
Now I want to intercept the sendto() function. This is done that way:

int __stdcall MINE_sendto(SOCKET s, const char FAR * buf, int len, int flags, const struct sockaddr FAR * to, int tolen )
{
	LogToList(buf, (struct sockaddr_in*)&to);

	return REAL_sendto(s, buf, len, flags, to, tolen );
}


It intercepts the sendto-function, displays some interesting data into the seperate window and returns the original sendto() function. However, I can't figure out the destination IP to where the packet is about to be sent.

LogToList() is this function:
void LogToList(const char FAR * buf, struct sockaddr_in *to = NULL)
{
	if(logTraffic)
	{
		struct sockaddr_in	*dest;

		dest = to;

		char ip[20];
		sprintf(ip,"%s:%d",inet_ntoa(dest->sin_addr),ntohs(dest->sin_port));
				
                ....(set values for buffer and IP into ListCtrl - this works)....
	}
}


The buffer is displayed correct, however, the IP is always the same:
16.0.0.0:62464
What am I doing wrong?

regards

modified 12-Sep-18 21:01pm.

GeneralRe: Almost gettin' mad: sockaddr_in Pin
Joaquín M López Muñoz9-Apr-02 7:55
Joaquín M López Muñoz9-Apr-02 7:55 
GeneralThanks!!! Pin
User 66589-Apr-02 8:03
User 66589-Apr-02 8:03 
GeneralMultiDocument And MultView (and per document) :: MFC Pin
valikac9-Apr-02 5:05
valikac9-Apr-02 5:05 
GeneralRe: MultiDocument And MultView (and per document) :: MFC Pin
l a u r e n9-Apr-02 5:28
l a u r e n9-Apr-02 5:28 
GeneralRe: MultiDocument And MultView (and per document) :: MFC Pin
Roger Allen9-Apr-02 5:31
Roger Allen9-Apr-02 5:31 
GeneralRe: Like this? Pin
valikac9-Apr-02 16:01
valikac9-Apr-02 16:01 
GeneralRe: SDI or MDI Pin
valikac9-Apr-02 18:35
valikac9-Apr-02 18:35 
GeneralDocument View - Printing Pin
AJ1239-Apr-02 4:58
AJ1239-Apr-02 4:58 
GeneralRe: Document View - Printing Pin
Roger Allen9-Apr-02 5:28
Roger Allen9-Apr-02 5:28 
GeneralPure Virtual Functions Pin
PaulJ9-Apr-02 4:38
PaulJ9-Apr-02 4:38 
GeneralRe: Pure Virtual Functions Pin
Roger Allen9-Apr-02 4:42
Roger Allen9-Apr-02 4:42 
QuestionHow to make my window transparent while dragged (code inside) Pin
John O'Byrne9-Apr-02 4:30
John O'Byrne9-Apr-02 4:30 
AnswerRe: How to make my window transparent while dragged (code inside) Pin
Roger Allen9-Apr-02 4:46
Roger Allen9-Apr-02 4:46 
GeneralRe: How to make my window transparent while dragged (code inside) Pin
John O'Byrne9-Apr-02 4:55
John O'Byrne9-Apr-02 4:55 
GeneralRe: How to make my window transparent while dragged (code inside) Pin
Roger Allen9-Apr-02 5:20
Roger Allen9-Apr-02 5:20 
GeneralRe: How to make my window transparent while dragged (code inside) Pin
John O'Byrne9-Apr-02 5:37
John O'Byrne9-Apr-02 5:37 
General*LPUNKOWN Pin
Braulio Dez9-Apr-02 4:05
Braulio Dez9-Apr-02 4:05 

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.