slight winsock design change proposal

James Hawkins truiken at gmail.com
Wed Mar 5 18:37:11 CST 2008


On Wed, Mar 5, 2008 at 6:28 PM, Christopher Harvey
<arbuckle911 at gmail.com> wrote:
> I'm giving the mswsock.c file some development time. I need to know if
>  the winsock API has been inited. This has already been implemented, but
>  I need to get access to the num_startup variable from the mswsock.c
>  file. I hacked a bit and got it, but hesitate to continue because I
>  don't know if I changed it in the proper way to get access. If this
>  change is fine please accept it. if not please advise on the proper way
>  to see if winsock has been inited or not, from the  mswsock.c file.
>
>  Thanks.
>
> diff --git a/dlls/mswsock/mswsock.c b/dlls/mswsock/mswsock.c
>  index d283405..7f339c0 100644
>  --- a/dlls/mswsock/mswsock.c
>  +++ b/dlls/mswsock/mswsock.c
>  @@ -62,9 +62,10 @@ BOOL WINAPI AcceptEx(
>                                        operation */
>   {
>      FIXME("(listen=%ld, accept=%ld, %p, %d, %d, %d, %p, %p), not implemented\n",
>  -       sListenSocket,sAcceptSocket,lpOutputBuffer,dwReceiveDataLength,
>  -       dwLocalAddressLength,dwRemoteAddressLength,lpdwBytesReceived,lpOverlapped
>  -    );
>  +         sListenSocket,sAcceptSocket,lpOutputBuffer,dwReceiveDataLength,
>  +         dwLocalAddressLength,dwRemoteAddressLength,lpdwBytesReceived,lpOverlapped
>  +         );
>  +    //get_num_startup();  Use this to see if Winsock has been inited yet or not
>      return FALSE;
>   }
>
>  diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
>  index 502f309..03030a2 100644
>  --- a/dlls/ws2_32/socket.c
>  +++ b/dlls/ws2_32/socket.c
>  @@ -5021,3 +5021,8 @@ INT WINAPI WSCWriteProviderOrder( LPDWORD entry, DWORD number )
>      FIXME("(%p 0x%08x) Stub!\n", entry, number);
>      return 0;
>   }
>  +
>  +INT get_num_startup()
>  +{
>  +    return num_startup;
>  +}
>  diff --git a/include/winsock2.h b/include/winsock2.h
>  index a302331..dcca0e7 100644
>  --- a/include/winsock2.h
>  +++ b/include/winsock2.h
>  @@ -728,6 +728,7 @@ typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSW)(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPS
>   typedef DWORD (WINAPI *LPFN_WSAWAITFORMULTIPLEEVENTS)(DWORD,const WSAEVENT*,BOOL,DWORD,BOOL);
>   #endif /* WS_API_TYPEDEFS */
>
>  +typedef INT get_num_startup();
>
>   /* Condition function return values */
>   #define CF_ACCEPT       0x0000
>

Are you seriously asking if adding a hack to a public header in order
to read a global variable from another dll is acceptable?  That pretty
much sums up the answer.

-- 
James Hawkins



More information about the wine-devel mailing list