|
Hi,
I did the same thing and I tried to print pHost->h_addr_list[0].But I am not getting the ip address of the system
Karteek
|
|
|
|
|
karteek wrote:
I am not getting the ip address of the system
Sure you are. It's just not in dotted notation like you are accustomed to seeing it. You need to copy pHost->h_addr_list[0] into a sockaddr_in structure, and then call inet_ntoa() passing it the sin_addr member of that structure.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hello Guys,
How ru all doing..i need some some help in VC++, When iam declaring an CInternetSession variable as global, i get some debug assertion error, when the application runs, i have created the applicaiton through MFC Wizard, in the dialog i do some operations for FTp Connection, so i establish a CInternetSession and CFTPConnection Variable globally, because it is accesed by many functions, when the app runs, the error is thrown off, when i declare the CInternetSession inside a function, i dont get any error, but i want it only globally.
|
|
|
|
|
I just began learning assembler programming on the Linux/i386. I know how the shell code works and can write the assembler for it. I also understand what the code in the main() function does. Creates an int pointer, sets it equal to the cast address of the pointer + 2 then copies the cast shell code int to the dereference of the int pointer and somehow executes. If you have the time could you please explain how the code in the main() function works. Thanks, I really appreciate it.
#include <stdio.h>
char shellcode[] =
"\x31\xc0\x50\x68\x31\x33\x33\x37"
"\x66\xb9\xed\x01\x89\xe3\xb0\x27"
"\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
"\x80\x90\x90\x90\x55\x89";
int main()
{
int * ret;
ret = (int *)&ret + 2;
*ret = (int)shellcode;
}
John
Programmer
|
|
|
|
|
That's a classical buffer overrun. You're basically modifying the function return address to that of shellcode . When the function tries to return using the return address provided by the C-runtime which called main, it'll return straight into the memory area of shellcode . shellcode contains CPU instructions which will do something which was not intended (well, in this case it is intended, but it's just for show).
Here is a more detailed document on the subject: http://www.cs.ucsb.edu/~jzhou/security/overflow.html[^]
I just hope you're not a bad guy
--
In the land of the blind, be king![^]
|
|
|
|
|
|
|
The 22-Nov entry in this blog[^] may provide an answer.
Btw, I hate to do this to you, but my ISP just upped my standard broadband connection (downloads) to 3Mb/sec (about 400 KB/sec).
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
OK, you got me where it hurts. You know I live on ham and cheese sandwiches, while you casually gorge yourself on wondrous delights that for me are but a distant memory. I'd kill for a medhu wada soaked in spicy sambar...
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi!
How do make a counter that starts with zero and then counts up til the program is finished?
I will have misçroseconds precision. I have used struct timeval to get microseconds and it counts p till 999999 microseconds. Then it starts again at 0, but it do not add number 1 for one seconds has gone. In other words it doesn't show 1000000, instead only 0.
Thankful for your help
|
|
|
|
|
Is counter a varible or related with one register of 8254?
If it is a varible to store a value you can work well by "%"
My Family & myself wish you &
yours a very
Merry Christmas & a Happy & Safe New Year.
|
|
|
|
|
lookup QueryPerformanceFrequency and QueryPerformanceCounter if you do a QueryPerformanceCounter at the beginning of your program and on the end, the difference is the amount of time spent.
|
|
|
|
|
I have a project which is a SDI Application,I want to create a button in the StatusBar,So I made a New class
(CMyStatusBar),and write some codes like this:
int CMyStatusBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CStatusBar::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rect;
GetItemRect(CommandToIndex(ID_MYBAR),&rect);
int ret=m_button.Create("test",WS_VISIBLE|WS_CHILD|WS_BORDER,rect,this,ID_MYBAR);
m_button.MoveWindow(rect,TRUE);
return 0;
}
but why i can't see my button :ID_MYBUTTON?????
thanks!
|
|
|
|
|
who can help me? thank you ....
|
|
|
|
|
try
ShowWindow(SW_SHOW)
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
Thank you, i add this code:
ShowWindow(SW_SHOW)
but i can not see button also.......
|
|
|
|
|
1. Do you derive your statusbar from CStatusBar or CStatusBarCtrl ?
2. What coords of rectangle rc did you obtain from GetItemRect() ?
|
|
|
|
|
And another problem that has me completely floored:
In a Windows Installer DLL, it is necessary for me to get and adjust the commandline, write it into RunOnce and reboot the machine.
I've never used GetCommandLine before because I've always had access to the WinMain arguments, so it has never been necessary but in this case there is no other way to access it.
On Windows 9X, I have no problem. I use _tcscpy( szRunOnce, GetCommandLine() ); and szRunOnce is populated with "C:\WINDOWS\SYSTEM\msiexec.exe" /i "E:\MyFolder\MyInstaller.msi" /l*v C:\msilog.txt . That's exactly what I expect.
On Windows 2000, I get something else entirely - something like: C:\WINNT\System32\MsiExec.exe -Embedding 03E11881F81557A4CAAAA7C7B6ADDFBB
This is no use to me whatsoever, as far as I can see.
Is this Windows Installer doing this to me or GetCommandLine? If the latter then is there a good way of building the string that I'm really looking for?
Paul
|
|
|
|
|
Okay, I give up. Can anyone here help me with this:
According to the MSDN docs for RegSaveKey:
"Windows 95/98/Me: RegSaveKey does not support long file names. To save a registry hive to a file with a long file name, first save the hive to a short file name, then rename the resulting file to its long file name."
And sure enough this seems to be the case, so I need to convert the filename to a short path. But when I call GetShortPathName, I get the error: The system cannot find the file specified.
Well, obviously it can't find it, I'm about to create it.
If I create the file to get the short path name then I need to remove it again before calling RegSaveKey, which doesn't seem to support overwriting existing files.
So as far as I can gather, the only solution is to create a file, get it's short path name, delete the file and then call RegSaveKey. This seems very convoluted; does anyone have a better way that works?
OR... have I completely missed the point here? I do notice that the long path name I'm trying to shorten has a double-backslash in it.
C:\WINDOWS\TEMP\\{AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}\MyFolder\MyExtract.reg
I didn't put it there, it's a Windows Installer API problem. It creates a support folder for installations ("[TEMPFOLDER]\[Product Code GUID]") and when you ask it for the path, you get it with the double-backslash.
It hasn't caused me any issues up until this point, but I suppose it could cause the error from GetShortPathName. I don't know.
Anybody?
Paul
|
|
|
|
|
Okay. I discounted the idea that the double-backslash was the problem by using a different folder.
Then I realised that I could use GetShortPathName to get the name of the container folder and make sure the file names were 8.3 format when I added them.
Problem soved. Doh!
Paul
|
|
|
|
|
I have an MDI application with a CDialogBar. Immediately after I have created the dialogbar, I can access the controls on it with GetDlgItem, but when I try to to access them at a later stage, GetDlgItem fails and I get a failed assertion for ASSERT(::IsWindow(m_hWnd)), where m_hWnd is the window handle of the dialogbar. Looking in the debug locals window I can see that CDialogBar::m_hWnd is now NULL. Yet I can still see it fine on the screen.
Why would it lose its HWND? How does it work without it? How can I access the controls on it? Thanks.
|
|
|
|
|
did you do this ?
hDlgWnd = m_wndDialogbar.m_hWnd;
instead do this
hDlgWnd = m_wndDialogBar.GetSafeHwnd();
MFC clears its temp map and the entry goes in permanent map if you do this GetSafeHWnd()
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
I was just calling CDialogBar::GetDlgItem and letting it sort out its own window handle. I've tried GetSafeHwnd() and I still get 0xCDCDCDCD
|
|
|
|
|
such situations can arise in multithreaded environment , are there any threads ?
did you use SPY ++ to see the windows handle
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|