diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2001-11-28 08:28:54 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2001-11-28 08:28:54 +0000 |
commit | c2ba520cb266c356438095965caaa118bd42868a (patch) | |
tree | 2b71134b1aa98ccc5b68cc10d3c160d68c3233dd /examples/Registry | |
parent | 82ac0ec162a84659ea26eedc89fa50b2c03a8757 (diff) | |
download | ATCD-c2ba520cb266c356438095965caaa118bd42868a.tar.gz |
ChangeLogTag: Wed Nov 28 09:18:08 2001 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'examples/Registry')
-rw-r--r-- | examples/Registry/test_registry_iterator.cpp | 4 | ||||
-rw-r--r-- | examples/Registry/test_registry_update.cpp | 36 |
2 files changed, 20 insertions, 20 deletions
diff --git a/examples/Registry/test_registry_iterator.cpp b/examples/Registry/test_registry_iterator.cpp index 1931b82b167..2ddecccc240 100644 --- a/examples/Registry/test_registry_iterator.cpp +++ b/examples/Registry/test_registry_iterator.cpp @@ -26,7 +26,7 @@ static void print_context (ACE_Registry::Naming_Context &parent, static void indent (u_long indentation); int -main (int argc, char *argv[]) +main (int argc, ACE_TCHAR *argv[]) { int result; ACE_Registry::Naming_Context naming_context; @@ -37,7 +37,7 @@ main (int argc, char *argv[]) // HKEY_CLASSES_ROOT, // HKEY_USERS, // HKEY_CURRENT_USER, - argc == 2 ? ACE_TEXT_CHAR_TO_TCHAR (argv[1]) : 0); + argc == 2 ? argv[1] : 0); if (result != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Predefined_Naming_Contexts::connect failed"), -1); diff --git a/examples/Registry/test_registry_update.cpp b/examples/Registry/test_registry_update.cpp index a755bb25e01..49728e097c5 100644 --- a/examples/Registry/test_registry_update.cpp +++ b/examples/Registry/test_registry_update.cpp @@ -9,7 +9,7 @@ // This application uses the ACE_Registry class to create and update // entries in the LOCAL_MACHINE and CURRENT_USER predefined registries // to store the counters. -// +// // Note that this application will not work with remote registries // if used with the CURRENT_USER predefined registry. @@ -30,7 +30,7 @@ static int update_counter (HKEY predefined, static void setup_names (); int -main (int, char *[]) +main (int, ACE_TCHAR *[]) { int result; u_long current_counter = 0; @@ -51,41 +51,41 @@ main (int, char *[]) if (result == 0) cout << "Machine counter: " << current_counter << endl; } - + if (result != 0) ACE_DEBUG ((LM_DEBUG, "test failed\n")); else ACE_DEBUG ((LM_DEBUG, "test succeeded\n")); return 0; -} +} -static int +static int update_counter (HKEY predefined, u_long ¤t_counter) { int result; ACE_Registry::Naming_Context parent_context; ACE_Registry::Naming_Context application_context; - + // Connect to predefined entry result = ACE_Predefined_Naming_Contexts::connect (parent_context, predefined); if (result != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Predefined_Naming_Contexts::connect failed"), -1); - + // Find application context name - result = parent_context.resolve_context (application_context_name, + result = parent_context.resolve_context (application_context_name, application_context); - + if (result != 0) // Failed to find: create a new context result = parent_context.bind_new_context (application_context_name, application_context); - + if (result != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Registry::Naming_Contexts::bind/resolve_context failed"), -1); - + // Counter u_long counter = 0; // Represent counter as an ACE_Registry::Object @@ -93,9 +93,9 @@ update_counter (HKEY predefined, sizeof counter, REG_DWORD); // Find counter - result = application_context.resolve (counter_name, + result = application_context.resolve (counter_name, object); - + if (result != 0) // Failed to find: create new binding for object { @@ -110,13 +110,13 @@ update_counter (HKEY predefined, counter++; // Update result = application_context.rebind (counter_name, - object); + object); } if (result != 0) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Registry::Naming_Contexts::bind/resolve failed"), -1); + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Registry::Naming_Contexts::bind/resolve failed"), -1); else - current_counter = counter; + current_counter = counter; return 0; } @@ -132,7 +132,7 @@ setup_names () ::application_context_name [1].id_ = ACE_TEXT ("AcmeSoft"); ::application_context_name [2].id_ = ACE_TEXT ("AcmeApplication"); ::application_context_name [3].id_ = ACE_TEXT ("1.0"); - + ::counter_name.reserve (1); ::counter_name [0].id_ = ACE_TEXT ("Instance Counter"); */ @@ -143,7 +143,7 @@ setup_names () component.id_ = ACE_TEXT ("AcmeSoft"), ::application_context_name.insert (component); component.id_ = ACE_TEXT ("AcmeApplication"), ::application_context_name.insert (component); component.id_ = ACE_TEXT ("1.0"), ::application_context_name.insert (component); - + component.id_ = ACE_TEXT ("Instance Counter"), ::counter_name.insert (component); } |