diff options
Diffstat (limited to 'ace/Sock_Connect.cpp')
-rw-r--r-- | ace/Sock_Connect.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/ace/Sock_Connect.cpp b/ace/Sock_Connect.cpp index 94fa96ca963..4c285ddbebf 100644 --- a/ace/Sock_Connect.cpp +++ b/ace/Sock_Connect.cpp @@ -5,6 +5,7 @@ #include "ace/Log_Msg.h" #include "ace/Handle_Set.h" #include "ace/Auto_Ptr.h" +#include "ace/SString.h" #if defined (ACE_LACKS_INLINE_FUNCTIONS) #include "ace/Sock_Connect.i" @@ -12,6 +13,45 @@ ACE_RCSID(ace, Sock_Connect, "$Id$") +#if defined (ACE_WIN32) +// Return value in buffer for a key/name pair from the Windows +// Registry up to buf_len size. + +static int +get_reg_value (const ACE_TCHAR *key, + const ACE_TCHAR *name, + ACE_TCHAR *buffer, + DWORD &buf_len) +{ + HKEY hk; + DWORD buf_type; + LONG rc = ACE_TEXT_RegOpenKeyEx (HKEY_LOCAL_MACHINE, + key, + 0, + KEY_READ, + &hk); + // 1. open key that defines the interfaces used for TCP/IP? + if (rc != ERROR_SUCCESS) + // print_error_string(ACE_LIB_TEXT ("RegOpenKeyEx"), rc); + return -1; + + rc = ACE_TEXT_RegQueryValueEx (hk, + name, + 0, + &buf_type, + (u_char *) buffer, + &buf_len); + if (rc != ERROR_SUCCESS) + { + // print_error_string(ACE_LIB_TEXT ("RegEnumKeyEx"), rc); + RegCloseKey (hk); + return -2; + } + + ::RegCloseKey (hk); + return 0; +} +#endif /* ACE_WIN32 */ // Bind socket to an unused port. |