On Wed, Mar 5, 2008 at 6:28 PM, Christopher Harvey arbuckle911@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 wrote:
On Wed, Mar 5, 2008 at 6:28 PM, Christopher Harvey arbuckle911@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.
I can't think of any other way. I'm asking for help.
I'm giving the mswsock.c file some development time. I need to know if the winsock API has been inited.
The question is, why do you need to know that? Can't you just initialize it yourself? Then you'll know it has been. --Juan
Juan Lang wrote:
I'm giving the mswsock.c file some development time. I need to know if the winsock API has been inited.
The question is, why do you need to know that? Can't you just initialize it yourself? Then you'll know it has been. --Juan
There are some functions that return errors if WSAStartup hasn't been called. I think wine should do that too, rather than call it for the application.
There are some functions that return errors if WSAStartup hasn't been called. I think wine should do that too, rather than call it for the application.
Perhaps it should, but that should be fixed in ws2_32, not in mswsock. --Juan
"Christopher Harvey" arbuckle911@gmail.com wrote:
Juan Lang wrote:
I'm giving the mswsock.c file some development time. I need to know if the winsock API has been inited.
The question is, why do you need to know that? Can't you just initialize it yourself? Then you'll know it has been. --Juan
There are some functions that return errors if WSAStartup hasn't been called. I think wine should do that too, rather than call it for the application.
It would really help to at least name those "some functions", or even better to provide a test case.
Dmitry Timoshkov wrote:
"Christopher Harvey" arbuckle911@gmail.com wrote:
Juan Lang wrote:
I'm giving the mswsock.c file some development time. I need to know if the winsock API has been inited.
The question is, why do you need to know that? Can't you just initialize it yourself? Then you'll know it has been. --Juan
There are some functions that return errors if WSAStartup hasn't been called. I think wine should do that too, rather than call it for the application.
It would really help to at least name those "some functions", or even better to provide a test case.
Alright, I see where I'm going wrong. I was reading the WSAAccept function when I thought I was reading the AcceptEx page in MSDN.
Sorry.
Actually the correct way IMHO is to implement AcceptEx/GetAcceptExSockaddrs/TransmitFile in ws2_32.dll, and use WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER) to get function addresses in mswsock.dll. I believe this is that Windows' mswsock.dll do.
Christopher Harvey wrote:
Dmitry Timoshkov wrote:
"Christopher Harvey" arbuckle911@gmail.com wrote:
Juan Lang wrote:
I'm giving the mswsock.c file some development time. I need to know if the winsock API has been inited.
The question is, why do you need to know that? Can't you just initialize it yourself? Then you'll know it has been. --Juan
There are some functions that return errors if WSAStartup hasn't been called. I think wine should do that too, rather than call it for the application.
It would really help to at least name those "some functions", or even better to provide a test case.
Alright, I see where I'm going wrong. I was reading the WSAAccept function when I thought I was reading the AcceptEx page in MSDN.
Sorry.