TCP/IP stack Winsock MSAFD.DLL problem
Results 1 to 9 of 9

Thread: TCP/IP stack Winsock MSAFD.DLL problem

  1. #1
    Senior Member
    Join Date
    Feb 2003
    Posts
    282

    TCP/IP stack Winsock MSAFD.DLL problem

    I'm recieveing an invalid page fault in module MSAFD.DLL at address 0167:7b411257

    This hapens after conecting to a server I made from telnet. The server at this stage is suposed to acept() the conection and sit there. But upon conect from telnet instant crash.

    I looked this error up, and one solution sugested a broken chain in my TCP/IP stack on winsock. I downloaded a fix LSPFix.exe for Win 98SE and apeared to reinstall winsock.

    The problem persists. I did investigate, apears MSAFD.DLL is a Service Provider Dll for TCP/IP

    My internet (Cable ) did not come with any software to install, other then the drivers for the network card. I know this problem is common because google found lots of posts about this, but non of the solutions solved my problem.

    The server I attached, compiled with Borland C/C++ 5.5 for Win32, And I would like to get to the bottom line of this problem. Perhaps its a library borland is inporting that perhaps is interfering. I checked with Dependancy Walker, the contents of MSAFD.DLL and indicates all dependancys are present and no problems reported.

    Anyone have this problem and solve it.

    Dont know what version of winsock I have. Any sugestions? Any advice would be apreciated.

    The server atached with source code, opens port 9081, and acepts any conections. No recv is present so its suposed to sit there, but not suposed to crash

    Let me know if it crashes for you.

  2. #2
    Member
    Join Date
    Jul 2003
    Posts
    35

    let me try

    Is it a problem that the server daemon is causing, by chance?
    TinFoilHat Linux O.o who needs more?

  3. #3
    Senior Member
    Join Date
    Feb 2003
    Posts
    282
    Posible, one reason for includeing the source. The examples I am following to the tea.

    I can't locate any problems with my source, everything corosponds to those found in http://www.hal-pc.org/~johnnie2/winsock.html

  4. #4
    Member
    Join Date
    Jul 2003
    Posts
    35

    Hmm

    I'm sorry to say this, but I'm honestly stumped. I'll research your problem into depth for a while and see what I can come up with.
    If nothing else, I'll see if my Windows 98 SE has the same problem you have. If not, then I could possibly send you a copy of mine to replace yours and hope for the best.
    Cool with you?
    TinFoilHat Linux O.o who needs more?

  5. #5
    Senior Member
    Join Date
    Feb 2003
    Posts
    282
    yes, i too am Google searching to my hearts content, seems win 98 comes up alot under msafd.dll

    Ill try downloading a copy, and swaping it. If that don't work you can send me yours on WinMe

    Ok I just downloaded MSAFD.DLL aparently version 5.00.2153.1 the newest. I tryed replaceing but mine was in use, so I saved it to a temp folder, rebooted to dos and made the switch. After reboot my firewall failed to start, and no internet once so ever. I tryed unregistering re registering it

    regsvr32 \u C:\WIN\SYSTEM\MSAFD.DLL
    regsvr32 C:\WIN\SYSTEM\MSAFD.DLL

    Both failed, LoadLibrary(...) failed, GetLastError returned 0x0000001f

    well I was stuck with no internet, untill I remembered I still have that wsfix.exe file on my desktop, the repair for winsock 2

    I did that, when it got to copying the MSAFD.DLL from my CD, it told me the file I had was newer then file being copyed, so I said yea keep current, to see if it will make it work, but no. So then I redid the fix this time saying no to MSAFD.DLL and got my internet back.

    So it apears I am stuck with the old MSAFD.DLL

  6. #6
    Senior Member
    Join Date
    Feb 2003
    Posts
    282
    =======UPDATE======

    Your first suspisions corect, my code is the problem though I was so sure I followed everything exactly.

    Narrowed down the problem to accept(). See its as soon as I connect. Now if I comment out the acept the problem disapears. I tryed a difernt compiler and same problem. So then I investiages the arguments to accept.

    changed

    client = acept(sock, (LPSOCKADDR)&addr_remote, (int *)sizeof(struct sockaddr));

    to

    client = accept(sock, NULL, NULL);

    and viola, it worked. The whole invalid page fault disapeared. But this was dificult because the compiler and linker compiled fine with no errors, so naturaly I thought if the compiler likes the arguments to accept then I do.

  7. #7
    Senior Member
    Join Date
    Jan 2002
    Posts
    1,207
    Originally posted here by journy101
    client = acept(sock, (LPSOCKADDR)&addr_remote, (int *)sizeof(struct sockaddr));
    [/B]
    Should really be

    Code:
    int junk = sizeof (struct sockaddr);
    client = accept(sock, (LPSOCKADDR)&addr_remote, &junk);
    Previously you were casting an int into an int *, which is bad. You should declare a variable and pass a pointer to that. The size variable is a return pointer.

    Obviously this causes a crash in whatever DLL it is tries to use the duff pointer you've created by casting a small int into a pointer.

    Slarty

    PS: of course if you pass NULLs, you won't get the address of the client. Most applications want the address of the client for a security check or audit log.

  8. #8
    Senior Member
    Join Date
    Feb 2003
    Posts
    282
    Thanks slarty for that help is greatly apreciated. the docs said those perameters were optional, but I did want them as you said sometimes used to do a security check on the client. In my case I was interested in the ip of the client. So im greatfull you showed me the corect way

    when compileing origionaly it gave compile errors on those arguments, i i just type cast it to make the compiler happy. Thanks so much for the corect way.

    Now that I make your changes all is fine. So nothing was wrong with my winsock afterall

  9. #9
    Junior Member
    Join Date
    Jul 2003
    Posts
    1
    Thanks to all for your posts; the Winsock tutorial has been updated to clarify this extended usage of accept().

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •