DynamoRIO / DynamoRIO/dynamorio

Winsock not working inside a DynamoRio windows client

Open
#1,883 14 comments 0 reactions 0 assignees View on GitHub
Bug-ToolFail help wanted OpSys-Windows
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 15h
Merged PRs (30d)
31

Description

Hi,

I was trying to use sockets inside a Windows client but the WSA initialization fails:

``` C
#include
#include

DR_EXPORT void dr_client_main(client_id_t id, int argc, const char *argv[])
{

dr_enable_console_printing();
WSADATA WsaDat;
int result = WSAStartup(MAKEWORD(2, 0), &WsaDat);
if (result == 0)
dr_printf("WSA Initializated\n");
else
dr_printf("WSAStartup failed with error: %d\n", result);
}
```

The output is always the same:

```
WSAStartup failed with error: 10107
```

That error code in [msdn](https://msdn.microsoft.com/en-us/library/windows/desktop/ms740668%28v=vs.85%29.aspx):

```
WSASYSCALLFAILURE
10107
System call failure.
A system call that should never fail has failed. This is a generic error code, returned under various conditions.
Returned when a system call that should never fail does fail. For example, if a call to WaitForMultipleEvents fails or one of the registry functions fails trying to manipulate the protocol/namespace catalogs.
Returned when a provider does not return SUCCESS and does not provide an extended error code. Can indicate a service provider implementation error.
```

It seems that the DR transparency is interfering with the `WSAStartup` function.

Could anyone check why is this happening?

Any help will be appreciated.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.