0

WinDbg is telling me that I've done the following in my program: "A Winsock API was called before a successful WSAStartup() or after a balancing successful WSACleanup() call was made"

This is strange since the stack trace seems to reveal that the offending Winsock API call is WSAStartup(). As far as I know, that's the first WinSock API call that needs to be made when using WinSock, so it shouldn't be causing this kind of error.

00000000`0280c4f0  000007fe`f8c7b475 vfnet!VfHookWSAStartup+0x8d
00000000`0280c4f8  000007fe`fa93a3c9 libcurl!curl_global_init_mem+0x3b9
00000000`0280c500  000007fe`fa939fd9 libcurl!curl_global_init+0x89

I never actually call any WinSock API functions, libCURL does all that stuff for me. I realize I haven't posted much in the way of code, but are there any ideas what might be causing WinDbg to complain that Winsock hasn't been initialized when I'm calling the WinSock initialization function?

MD XF
  • 7,860
  • 7
  • 40
  • 71
Adam
  • 8,752
  • 12
  • 54
  • 96
  • 1
    That error message is a result of a Winsock function reporting a `WSANOTINITIALISED` error code (or App Verifier doing a static analysis of your code and *incorrectly* reporting an error that is not actually an error, which has been known to happen). That error code is not one that `WSAStartup()` itself can report, though. So the problem has to be elsewhere, and you are looking at the wrong call stack. – Remy Lebeau Jun 20 '16 at 18:39
  • @RemyLebeau I'm not that familiar with WinDbg/ App Verifier. Can you think of any WinDbg commands I could try off the top of you head that might be more helpful? – Adam Jun 20 '16 at 18:49
  • 1
    Sorry, I have never actually used WinDbg or AppVerifier myself. But I do use the WinSock API all the time, so I know `WSAStartup()` itself is not the problem, the culprit is elsewhere. – Remy Lebeau Jun 20 '16 at 18:55
  • 1
    `~*kb1000` will show you all the call stacks. – Marc Sherman Jun 21 '16 at 13:03

0 Answers0