diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2000-03-11 00:04:49 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2000-03-11 00:04:49 +0000 |
commit | 44ff21532af07106c07712b2a7da51faef1abf81 (patch) | |
tree | e6d18c94d656aa3b5aa7940b81be8db6cbc534d2 /TAO/orbsvcs/Naming_Service | |
parent | ced1e5b9626ea8524715b817a312ec24c502906c (diff) | |
download | ATCD-44ff21532af07106c07712b2a7da51faef1abf81.tar.gz |
ChangeLogTag:Fri Mar 10 00:17:37 2000 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
Diffstat (limited to 'TAO/orbsvcs/Naming_Service')
-rw-r--r-- | TAO/orbsvcs/Naming_Service/NT_Naming_Service.cpp | 80 | ||||
-rw-r--r-- | TAO/orbsvcs/Naming_Service/NT_Naming_Service.h | 7 |
2 files changed, 80 insertions, 7 deletions
diff --git a/TAO/orbsvcs/Naming_Service/NT_Naming_Service.cpp b/TAO/orbsvcs/Naming_Service/NT_Naming_Service.cpp index ef3f0d23906..afb16d1bae7 100644 --- a/TAO/orbsvcs/Naming_Service/NT_Naming_Service.cpp +++ b/TAO/orbsvcs/Naming_Service/NT_Naming_Service.cpp @@ -4,14 +4,27 @@ #include /**/ "Naming_Service.h" #include /**/ "NT_Naming_Service.h" +#define REGISTRY_KEY_ROOT HKEY_LOCAL_MACHINE +#define TAO_REGISTRY_SUBKEY "SOFTWARE\\ACE\\TAO" +#define TAO_NAMING_SERVICE_OPTS_NAME "TaoNamingServiceOptions" + TAO_NT_Naming_Service::TAO_NT_Naming_Service (void) - : argc_(0), - argv_(0) + : argc_ (0), + argc_save_ (0), + argv_ (0), + argv_save_ (0) { } TAO_NT_Naming_Service::~TAO_NT_Naming_Service (void) { + if (argv_save_) + { + for (int i = 0; i < argc_save_; i++) + ACE_OS::free (argv_save_[i]); + + ACE_OS::free (argv_save_); + } } void @@ -21,7 +34,7 @@ TAO_NT_Naming_Service::handle_control (DWORD control_code) || control_code == SERVICE_CONTROL_STOP) { report_status (SERVICE_STOP_PENDING); - TAO_ORB_Core_instance ()->reactor ()->end_event_loop (); + TAO_ORB_Core_instance ()->reactor ()->end_reactor_event_loop (); TAO_ORB_Core_instance ()->orb ()->shutdown (1); report_status (SERVICE_STOPPED); } @@ -39,8 +52,64 @@ int TAO_NT_Naming_Service::init (int argc, ASYS_TCHAR *argv[]) { - argc_ = argc; - argv_ = argv; + HKEY hkey = 0; + BYTE buf[ACE_DEFAULT_ARGV_BUFSIZ]; + + *buf = '\0'; + + // This solution is very kludgy. It looks in the NT Registry under + // \\HKEY_LOCAL_MACHINE\SOFTWARE\ACE\TAO for the value of + // "TaoNamingServiceOptions" for any Naming Service options such as + // "-ORBEndpoint". + + // Get Naming Service options from the NT Registry. + + RegOpenKeyEx (REGISTRY_KEY_ROOT, + TAO_REGISTRY_SUBKEY, + 0, + KEY_READ|KEY_WRITE, + &hkey); + + DWORD type; + DWORD bufSize = sizeof (buf); + + RegQueryValueEx (hkey, + TAO_NAMING_SERVICE_OPTS_NAME, + NULL, + &type, + buf, + &bufSize); + + RegCloseKey (hkey); + + // Add options to the args list (if any). + + if (ACE_OS::strlen ((char *) buf) > 0) + { + // Allocate the internal args list to be one bigger than the + // args list passed into the function. We use a 'save' list in + // case we use a 'destructive' args list processor - this way we + // maintain the correct argv and argc for memory freeing + // operations in the destructor. + argv_save_ = (char **) malloc (sizeof (char *) *(argc + 1)); + + // Copy the values into the internal args buffer. + for (int i = 0; i < argc; i++) + argv_save_[i] = ACE_OS::strdup (argv[i]); + + // Add the configured option to the argument list. + argv_save_[argc] = ACE_OS::strdup ((char *) buf); + + // Set the arg counter. + argc_save_ = argc + 1; + argc_ = argc_save_; + argv_ = argv_save_; + } + else + { + argc_ = argc; + argv_ = argv; + } return 0; } @@ -72,4 +141,3 @@ TAO_NT_Naming_Service::svc (void) return 0; } - diff --git a/TAO/orbsvcs/Naming_Service/NT_Naming_Service.h b/TAO/orbsvcs/Naming_Service/NT_Naming_Service.h index a0440c9de80..e3e18698e2f 100644 --- a/TAO/orbsvcs/Naming_Service/NT_Naming_Service.h +++ b/TAO/orbsvcs/Naming_Service/NT_Naming_Service.h @@ -54,9 +54,14 @@ public: // Initialize the objects argc_ and argv_ attributes values. private: - // Keep track of the "command-line" arguments. + // = Keep track of the "command-line" arguments. int argc_; + int argc_save_; + // Argument count. + char **argv_; + char **argv_save_; + // Argument list. friend class ACE_Singleton<TAO_NT_Naming_Service, MUTEX>; }; |