diff options
Diffstat (limited to 'examples/Registry')
-rw-r--r-- | examples/Registry/Registry.dsp | 69 | ||||
-rw-r--r-- | examples/Registry/Registry.dsw | 41 | ||||
-rw-r--r-- | examples/Registry/Registry.mak | 271 | ||||
-rw-r--r-- | examples/Registry/Registry.mdp | bin | 40448 -> 0 bytes | |||
-rw-r--r-- | examples/Registry/test_registry_iterator.cpp | 130 | ||||
-rw-r--r-- | examples/Registry/test_registry_update.cpp | 145 | ||||
-rw-r--r-- | examples/Registry/update.dsp | 69 |
7 files changed, 0 insertions, 725 deletions
diff --git a/examples/Registry/Registry.dsp b/examples/Registry/Registry.dsp deleted file mode 100644 index 4aae3d51426..00000000000 --- a/examples/Registry/Registry.dsp +++ /dev/null @@ -1,69 +0,0 @@ -# Microsoft Developer Studio Project File - Name="iterator" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=iterator - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Registry.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Registry.mak" CFG="iterator - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "iterator - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ".\iterator\Debug"
-# PROP BASE Intermediate_Dir ".\iterator\Debug"
-# PROP BASE Target_Dir ".\iterator"
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "."
-# PROP Intermediate_Dir ".\debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ".\iterator"
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\\" /I "..\..\STL" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
-# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\..\ace"
-# Begin Target
-
-# Name "iterator - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
-# Begin Source File
-
-SOURCE=.\test_registry_iterator.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/examples/Registry/Registry.dsw b/examples/Registry/Registry.dsw deleted file mode 100644 index fdb2c88b751..00000000000 --- a/examples/Registry/Registry.dsw +++ /dev/null @@ -1,41 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 5.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "iterator"=.\Registry.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "update"=.\update.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/examples/Registry/Registry.mak b/examples/Registry/Registry.mak deleted file mode 100644 index 51c9543af89..00000000000 --- a/examples/Registry/Registry.mak +++ /dev/null @@ -1,271 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-!IF "$(CFG)" == ""
-CFG=update - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to update - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "iterator - Win32 Debug" && "$(CFG)" != "update - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE on this makefile
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Registry.mak" CFG="update - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "iterator - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "update - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-################################################################################
-# Begin Project
-# PROP Target_Last_Scanned "update - Win32 Debug"
-RSC=rc.exe
-CPP=cl.exe
-
-!IF "$(CFG)" == "iterator - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "iterator\Debug"
-# PROP BASE Intermediate_Dir "iterator\Debug"
-# PROP BASE Target_Dir "iterator"
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "."
-# PROP Intermediate_Dir "debug"
-# PROP Target_Dir "iterator"
-OUTDIR=.\.
-INTDIR=.\debug
-
-ALL : "$(OUTDIR)\iterator.exe"
-
-CLEAN :
- -@erase "$(INTDIR)\test_registry_iterator.obj"
- -@erase "$(INTDIR)\vc40.idb"
- -@erase "$(INTDIR)\vc40.pdb"
- -@erase "$(OUTDIR)\iterator.exe"
- -@erase "$(OUTDIR)\iterator.ilk"
- -@erase "$(OUTDIR)\iterator.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-"$(INTDIR)" :
- if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
-
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\STL" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-CPP_OBJS=.\debug/
-CPP_SBRS=.\.
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-BSC32_FLAGS=/nologo /o"$(OUTDIR)/iterator.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
-# ADD LINK32 aced.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
-LINK32_FLAGS=aced.lib kernel32.lib user32.lib gdi32.lib winspool.lib\
- comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\
- odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes\
- /pdb:"$(OUTDIR)/iterator.pdb" /debug /machine:I386\
- /out:"$(OUTDIR)/iterator.exe"
-LINK32_OBJS= \
- "$(INTDIR)\test_registry_iterator.obj"
-
-"$(OUTDIR)\iterator.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "update - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "update\Debug"
-# PROP BASE Intermediate_Dir "update\Debug"
-# PROP BASE Target_Dir "update"
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "."
-# PROP Intermediate_Dir "debug"
-# PROP Target_Dir "update"
-OUTDIR=.\.
-INTDIR=.\debug
-
-ALL : "$(OUTDIR)\update.exe"
-
-CLEAN :
- -@erase "$(INTDIR)\test_registry_update.obj"
- -@erase "$(INTDIR)\vc40.idb"
- -@erase "$(INTDIR)\vc40.pdb"
- -@erase "$(OUTDIR)\update.exe"
- -@erase "$(OUTDIR)\update.ilk"
- -@erase "$(OUTDIR)\update.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-"$(INTDIR)" :
- if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
-
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\STL" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-CPP_OBJS=.\debug/
-CPP_SBRS=.\.
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-BSC32_FLAGS=/nologo /o"$(OUTDIR)/update.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
-# ADD LINK32 aced.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
-LINK32_FLAGS=aced.lib kernel32.lib user32.lib gdi32.lib winspool.lib\
- comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\
- odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes\
- /pdb:"$(OUTDIR)/update.pdb" /debug /machine:I386 /out:"$(OUTDIR)/update.exe"
-LINK32_OBJS= \
- "$(INTDIR)\test_registry_update.obj"
-
-"$(OUTDIR)\update.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\STL" /D "WIN32" /D "_DEBUG"\
- /D "_CONSOLE" /Fp"$(INTDIR)/iterator.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/"\
- /c
-
-.c{$(CPP_OBJS)}.obj:
- $(CPP) $(CPP_PROJ) $<
-
-.cpp{$(CPP_OBJS)}.obj:
- $(CPP) $(CPP_PROJ) $<
-
-.cxx{$(CPP_OBJS)}.obj:
- $(CPP) $(CPP_PROJ) $<
-
-.c{$(CPP_SBRS)}.sbr:
- $(CPP) $(CPP_PROJ) $<
-
-.cpp{$(CPP_SBRS)}.sbr:
- $(CPP) $(CPP_PROJ) $<
-
-.cxx{$(CPP_SBRS)}.sbr:
- $(CPP) $(CPP_PROJ) $<
-
-################################################################################
-# Begin Target
-
-# Name "iterator - Win32 Debug"
-################################################################################
-# Begin Source File
-
-SOURCE=.\test_registry_iterator.cpp
-DEP_CPP_TEST_=\
- "..\..\STL\algobase.h"\
- "..\..\STL\bool.h"\
- "..\..\STL\bstring.h"\
- "..\..\STL\defalloc.h"\
- "..\..\STL\function.h"\
- "..\..\STL\iterator.h"\
- "..\..\STL\pair.h"\
- "..\..\STL\vector.h"\
- {$(INCLUDE)}"\ace\ACE.h"\
- {$(INCLUDE)}"\ace\ACE.i"\
- {$(INCLUDE)}"\ace\Auto_Ptr.cpp"\
- {$(INCLUDE)}"\ace\Auto_Ptr.h"\
- {$(INCLUDE)}"\ace\Auto_Ptr.i"\
- {$(INCLUDE)}"\ace\config-win32-common.h"\
- {$(INCLUDE)}"\ace\config-win32.h"\
- {$(INCLUDE)}"\ace\config.h"\
- {$(INCLUDE)}"\ace\Log_Msg.h"\
- {$(INCLUDE)}"\ace\Log_Priority.h"\
- {$(INCLUDE)}"\ace\Log_Record.h"\
- {$(INCLUDE)}"\ace\Log_Record.i"\
- {$(INCLUDE)}"\ace\Object_Manager.h"\
- {$(INCLUDE)}"\ace\Object_Manager.i"\
- {$(INCLUDE)}"\ace\OS.h"\
- {$(INCLUDE)}"\ace\OS.i"\
- {$(INCLUDE)}"\ace\Registry.h"\
- {$(INCLUDE)}"\ace\SString.h"\
- {$(INCLUDE)}"\ace\SString.i"\
- {$(INCLUDE)}"\ace\stdcpp.h"\
- {$(INCLUDE)}"\ace\Trace.h"\
- {$(INCLUDE)}"\ace\ws2tcpip.h"\
-
-
-"$(INTDIR)\test_registry_iterator.obj" : $(SOURCE) $(DEP_CPP_TEST_) "$(INTDIR)"
-
-
-# End Source File
-# End Target
-################################################################################
-# Begin Target
-
-# Name "update - Win32 Debug"
-################################################################################
-# Begin Source File
-
-SOURCE=.\test_registry_update.cpp
-DEP_CPP_TEST_R=\
- "..\..\STL\algobase.h"\
- "..\..\STL\bool.h"\
- "..\..\STL\bstring.h"\
- "..\..\STL\defalloc.h"\
- "..\..\STL\function.h"\
- "..\..\STL\iterator.h"\
- "..\..\STL\pair.h"\
- "..\..\STL\vector.h"\
- {$(INCLUDE)}"\ace\ACE.h"\
- {$(INCLUDE)}"\ace\ACE.i"\
- {$(INCLUDE)}"\ace\Auto_Ptr.cpp"\
- {$(INCLUDE)}"\ace\Auto_Ptr.h"\
- {$(INCLUDE)}"\ace\Auto_Ptr.i"\
- {$(INCLUDE)}"\ace\config-win32-common.h"\
- {$(INCLUDE)}"\ace\config-win32.h"\
- {$(INCLUDE)}"\ace\config.h"\
- {$(INCLUDE)}"\ace\Log_Msg.h"\
- {$(INCLUDE)}"\ace\Log_Priority.h"\
- {$(INCLUDE)}"\ace\Log_Record.h"\
- {$(INCLUDE)}"\ace\Log_Record.i"\
- {$(INCLUDE)}"\ace\Object_Manager.h"\
- {$(INCLUDE)}"\ace\Object_Manager.i"\
- {$(INCLUDE)}"\ace\OS.h"\
- {$(INCLUDE)}"\ace\OS.i"\
- {$(INCLUDE)}"\ace\Registry.h"\
- {$(INCLUDE)}"\ace\SString.h"\
- {$(INCLUDE)}"\ace\SString.i"\
- {$(INCLUDE)}"\ace\stdcpp.h"\
- {$(INCLUDE)}"\ace\Trace.h"\
- {$(INCLUDE)}"\ace\ws2tcpip.h"\
-
-
-"$(INTDIR)\test_registry_update.obj" : $(SOURCE) $(DEP_CPP_TEST_R) "$(INTDIR)"
-
-
-# End Source File
-# End Target
-# End Project
-################################################################################
diff --git a/examples/Registry/Registry.mdp b/examples/Registry/Registry.mdp Binary files differdeleted file mode 100644 index ad0da5c5084..00000000000 --- a/examples/Registry/Registry.mdp +++ /dev/null diff --git a/examples/Registry/test_registry_iterator.cpp b/examples/Registry/test_registry_iterator.cpp deleted file mode 100644 index 73811bd7bc3..00000000000 --- a/examples/Registry/test_registry_iterator.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// This example uses the ACE_Registry class to iterator through the -// entries in the predefined registries. The host of iteration can be -// varied through argv[1]. If no host is specified the local host is -// used. This is very similar to how regedt32 starts up. -// -// This examples points the cool iterators in ACE_Registry - - -#include "ace/Registry.h" - - -// Indentation while printing names -static const u_long INDENTATION_LEVEL = 3; - -// Prototypes -static int print_naming_context (ACE_Registry::Naming_Context &naming_context, - u_long indentation); -static void print_object (const ACE_Registry::Istring &name, - u_long indentation); -static void print_context (ACE_Registry::Naming_Context &parent, - const ACE_Registry::Istring &name, - u_long indentation); -static void indent (u_long indentation); - -int -main (int argc, char *argv[]) -{ - int result; - ACE_Registry::Naming_Context naming_context; - - // Connect to a predefined naming context - result = ACE_Predefined_Naming_Contexts::connect (naming_context, - HKEY_LOCAL_MACHINE, - // HKEY_CLASSES_ROOT, - // HKEY_USERS, - // HKEY_CURRENT_USER, - argc == 2 ? ACE_WIDE_STRING (argv[1]) : 0); - - if (result != 0) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Predefined_Naming_Contexts::connect failed"), -1); - - // Print contents of naming context - result = ::print_naming_context (naming_context, 0); - if (result != 0) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "print_naming_context failed"), -1); - - return 0; -} - - -// Print contents of <naming_context> -static int -print_naming_context (ACE_Registry::Naming_Context &naming_context, - u_long indentation) -{ - ACE_Registry::Binding_List list; - - // Get the list of all entries - int result = naming_context.list (list); - if (result != 0) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Registry::Naming_Context::list"), -1); - - // Iterator through all entries - for (ACE_Registry::Binding_List::iterator i = list.begin (); - i != list.end (); - i++) - { - // Yeeesss! STL rules! - ACE_Registry::Binding &binding = *i; - - if (binding.type () == ACE_Registry::OBJECT) - // If object - ::print_object (binding.name (), - indentation); - else - // If context - ::print_context (naming_context, - binding.name (), - indentation); - } - return 0; -} - - -// Print an object with <name> -static void -print_object (const ACE_Registry::Istring &name, - u_long indentation) -{ - // Set indentation - ::indent (indentation); - cout << name << endl; -} - - -// Print an context with <name> and <parent> -static void -print_context (ACE_Registry::Naming_Context &parent, - const ACE_Registry::Istring &name, - u_long indentation) -{ - // Set indentation - indent (indentation); - cout << name << endl; - - ACE_Registry::Naming_Context child_context; - // Find child context - int result = parent.resolve_context (name, - child_context, - KEY_READ); - if (result != 0) - ACE_ERROR ((LM_ERROR, "%s %s\n", "ACE_Registry::Naming_Context::resolve_context failed for:", name.c_str ())); - else - { - // Print contents of the child - result = ::print_naming_context (child_context, - indentation + INDENTATION_LEVEL); - if (result != 0) - ACE_ERROR ((LM_ERROR, "%p\n", "print_naming_context failed")); - } -} - - -// Pretty formating -static void -indent (u_long indentation) -{ - for (; indentation > 0; indentation--) - cout << " "; -} diff --git a/examples/Registry/test_registry_update.cpp b/examples/Registry/test_registry_update.cpp deleted file mode 100644 index 5ea097cdbe9..00000000000 --- a/examples/Registry/test_registry_update.cpp +++ /dev/null @@ -1,145 +0,0 @@ -// Suppose this application belonged to AcmeSoft. AcmeSoft wants to -// keep track of the number of times this application is -// executed. They want two counters: one counts the number of -// executions per machine, the other keeps track of the number of -// executions per user. -// -// 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. - -#include "ace/Registry.h" - - -// Name for application's naming context -static ACE_Registry::Name application_context_name; - -// Name for instance counter. -static ACE_Registry::Name counter_name; - -// Protypes -static int update_counter (HKEY predefined, - u_long ¤t_counter); -static void setup_names (); - -int -main(int argc, char *argv[]) -{ - int result; - u_long current_counter = 0; - - // initialize name - setup_names (); - - // Update counter per user - result = ::update_counter (HKEY_CURRENT_USER, - current_counter); - if (result == 0) - { - cout << "User counter: " << current_counter << endl; - - // Update counter per machine - result = ::update_counter (HKEY_LOCAL_MACHINE, - current_counter); - 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 -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, - 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 - ACE_Registry::Object object ((void *) &counter, - sizeof counter, - REG_DWORD); - // Find counter - result = application_context.resolve (counter_name, - object); - - if (result != 0) - // Failed to find: create new binding for object - { - counter = 1; - result = application_context.bind (counter_name, - object); - } - else - // Counter was found - { - // increment counter - counter++; - // Update - result = application_context.rebind (counter_name, - object); - } - - if (result != 0) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Registry::Naming_Contexts::bind/resolve failed"), -1); - else - current_counter = counter; - - return 0; -} - - -static void -setup_names () -{ - // Stupid implementation of STL is broken - /* - ::application_context_name.reserve (4); - ::application_context_name [0].id_ = __TEXT ("Software"); - ::application_context_name [1].id_ = __TEXT ("AcmeSoft"); - ::application_context_name [2].id_ = __TEXT ("AcmeApplication"); - ::application_context_name [3].id_ = __TEXT ("1.0"); - - ::counter_name.reserve (1); - ::counter_name [0].id_ = __TEXT ("Instance Counter"); - */ - - ACE_Registry::Name_Component component; - - component.id_ = __TEXT ("Software"), ::application_context_name.push_back (component); - component.id_ = __TEXT ("AcmeSoft"), ::application_context_name.push_back (component); - component.id_ = __TEXT ("AcmeApplication"), ::application_context_name.push_back (component); - component.id_ = __TEXT ("1.0"), ::application_context_name.push_back (component); - - component.id_ = __TEXT ("Instance Counter"), ::counter_name.push_back (component); -} - diff --git a/examples/Registry/update.dsp b/examples/Registry/update.dsp deleted file mode 100644 index 6089230b384..00000000000 --- a/examples/Registry/update.dsp +++ /dev/null @@ -1,69 +0,0 @@ -# Microsoft Developer Studio Project File - Name="update" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=update - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "update.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "update.mak" CFG="update - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "update - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ".\update\Debug"
-# PROP BASE Intermediate_Dir ".\update\Debug"
-# PROP BASE Target_Dir ".\update"
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "."
-# PROP Intermediate_Dir ".\debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ".\update"
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\\" /I "..\..\STL" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
-# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\..\ace"
-# Begin Target
-
-# Name "update - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
-# Begin Source File
-
-SOURCE=.\test_registry_update.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
|