summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2003-04-29 22:42:36 +0000
committerSteve Huston <shuston@riverace.com>2003-04-29 22:42:36 +0000
commit9c8b04490e4cc790b36608d95dd1d9883344bbf2 (patch)
tree2928f452cd3a1045ff55b2c51318ffd2b08d79ea /ace
parent17260d40c2bcfe2f6e6a7045671dedcc528d68a5 (diff)
downloadATCD-9c8b04490e4cc790b36608d95dd1d9883344bbf2.tar.gz
ChangeLogTag:Tue Apr 29 18:40:28 2003 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'ace')
-rw-r--r--ace/Configuration.cpp285
-rw-r--r--ace/Log_Msg.cpp2
-rw-r--r--ace/config-WinCE.h9
-rw-r--r--ace/config-win32-common.h4
4 files changed, 190 insertions, 110 deletions
diff --git a/ace/Configuration.cpp b/ace/Configuration.cpp
index 4cf75a0833e..8a1921e5c66 100644
--- a/ace/Configuration.cpp
+++ b/ace/Configuration.cpp
@@ -544,27 +544,38 @@ ACE_Configuration_Win32Registry::open_section (const ACE_Configuration_Section_K
if (load_key (base, base_key))
return -1;
+ int errnum;
HKEY result_key;
- if (ACE_TEXT_RegOpenKeyEx (base_key,
- sub_section,
- 0,
- KEY_ALL_ACCESS,
- &result_key) != ERROR_SUCCESS)
+ if ((errnum = ACE_TEXT_RegOpenKeyEx (base_key,
+ sub_section,
+ 0,
+ KEY_ALL_ACCESS,
+ &result_key)) != ERROR_SUCCESS)
{
if (!create)
- return -1;
+ {
+ errno = errnum;
+ return -1;
+ }
- if (ACE_TEXT_RegCreateKeyEx (base_key,
- sub_section,
- 0,
- 0,
- REG_OPTION_NON_VOLATILE,
- KEY_ALL_ACCESS,
- 0,
- &result_key,
- 0
- ) != ERROR_SUCCESS)
- return -1;
+ if ((errnum = ACE_TEXT_RegCreateKeyEx (base_key,
+ sub_section,
+ 0,
+ 0,
+ REG_OPTION_NON_VOLATILE,
+ KEY_ALL_ACCESS,
+ 0,
+ &result_key,
+#if defined (__MINGW32__)
+ (PDWORD) 0
+#else
+ 0
+#endif /* __MINGW32__ */
+ )) != ERROR_SUCCESS)
+ {
+ errno = errnum;
+ return -1;
+ }
}
ACE_Section_Key_Win32 *temp;
@@ -616,9 +627,14 @@ ACE_Configuration_Win32Registry::remove_section (const ACE_Configuration_Section
}
}
+ int errnum;
#if (ACE_HAS_WINNT4 != 0)
- if (ACE_TEXT_RegDeleteKey (base_key, sub_section) != ERROR_SUCCESS)
- return -1;
+ errnum = ACE_TEXT_RegDeleteKey (base_key, sub_section);
+ if (errnum != ERROR_SUCCESS)
+ {
+ errno = errnum;
+ return -1;
+ }
#else
if (!recursive)
{
@@ -641,10 +657,17 @@ ACE_Configuration_Win32Registry::remove_section (const ACE_Configuration_Section
0,
0,
0) == ERROR_SUCCESS)
- return -1;
+ {
+ errno = ERROR_DIR_NOT_EMPTY;
+ return -1;
+ }
+ }
+ errnum = ACE_TEXT_RegDeleteKey (base_key, sub_section);
+ if (errnum != ERROR_SUCCESS)
+ {
+ errno = errnum;
+ return -1;
}
- if (ACE_TEXT_RegDeleteKey (base_key, sub_section) != ERROR_SUCCESS)
- return -1;
#endif
return 0;
@@ -675,7 +698,10 @@ ACE_Configuration_Win32Registry::enumerate_values (const ACE_Configuration_Secti
if (rc == ERROR_NO_MORE_ITEMS)
return 1;
else if (rc != ERROR_SUCCESS)
- return -1;
+ {
+ errno = rc;
+ return -1;
+ }
name = name_buffer;
@@ -719,7 +745,10 @@ ACE_Configuration_Win32Registry::enumerate_sections (const ACE_Configuration_Sec
if (rc == ERROR_NO_MORE_ITEMS)
return 1;
else if (rc != ERROR_MORE_DATA && rc != ERROR_SUCCESS)
- return -1;
+ {
+ errno = rc;
+ return -1;
+ }
name = name_buffer;
@@ -739,16 +768,20 @@ ACE_Configuration_Win32Registry::set_string_value (const ACE_Configuration_Secti
if (load_key (key, base_key))
return -1;
+ int errnum;
DWORD len = ACE_static_cast (DWORD, value.length () + 1);
len *= sizeof (ACE_TCHAR);
- if (ACE_TEXT_RegSetValueEx (base_key,
- t_name,
- 0,
- REG_SZ,
- (BYTE *) value.fast_rep (),
- len)
+ if ((errnum = ACE_TEXT_RegSetValueEx (base_key,
+ name,
+ 0,
+ REG_SZ,
+ (BYTE *) value.fast_rep (),
+ len))
!= ERROR_SUCCESS)
- return -1;
+ {
+ errno = errnum;
+ return -1;
+ }
return 0;
}
@@ -766,13 +799,17 @@ ACE_Configuration_Win32Registry::set_integer_value (const ACE_Configuration_Sect
if (load_key (key, base_key))
return -1;
- if (ACE_TEXT_RegSetValueEx (base_key,
- t_name,
- 0,
- REG_DWORD,
- (BYTE *) &value,
- sizeof (value)) != ERROR_SUCCESS)
- return -1;
+ int errnum;
+ if ((errnum = ACE_TEXT_RegSetValueEx (base_key,
+ name,
+ 0,
+ REG_DWORD,
+ (BYTE *) &value,
+ sizeof (value))) != ERROR_SUCCESS)
+ {
+ errno = errnum;
+ return -1;
+ }
return 0;
}
@@ -791,14 +828,18 @@ ACE_Configuration_Win32Registry::set_binary_value (const ACE_Configuration_Secti
if (load_key (key, base_key))
return -1;
- if (ACE_TEXT_RegSetValueEx (base_key,
- t_name,
- 0,
- REG_BINARY,
- (BYTE *) data,
- ACE_static_cast (DWORD, length))
+ int errnum;
+ if ((errnum = ACE_TEXT_RegSetValueEx (base_key,
+ name,
+ 0,
+ REG_BINARY,
+ (BYTE *) data,
+ ACE_static_cast (DWORD, length)))
!= ERROR_SUCCESS)
- return -1;
+ {
+ errno = errnum;
+ return -1;
+ }
return 0;
}
@@ -817,19 +858,23 @@ ACE_Configuration_Win32Registry::get_string_value (const ACE_Configuration_Secti
return -1;
// Get the size of the binary data from windows
+ int errnum;
DWORD buffer_length = 0;
DWORD type;
- if (ACE_TEXT_RegQueryValueEx (base_key,
- t_name,
- 0,
- &type,
- (BYTE *) 0,
- &buffer_length) != ERROR_SUCCESS)
- return -1;
+ if ((errnum = ACE_TEXT_RegQueryValueEx (base_key,
+ name,
+ 0,
+ &type,
+ (BYTE *) 0,
+ &buffer_length)) != ERROR_SUCCESS)
+ {
+ errno = errnum;
+ return -1;
+ }
if (type != REG_SZ)
{
- errno = 0; ACE_OS::last_error (ERROR_INVALID_DATATYPE);
+ errno = ERROR_INVALID_DATATYPE;
return -1;
}
@@ -840,15 +885,16 @@ ACE_Configuration_Win32Registry::get_string_value (const ACE_Configuration_Secti
ACE_Auto_Basic_Array_Ptr<ACE_TCHAR> buffer (temp);
- if (ACE_TEXT_RegQueryValueEx (base_key,
- t_name,
- 0,
- &type,
- (BYTE *) buffer.get (),
- &buffer_length) != ERROR_SUCCESS)
- {
- return -1;
- }
+ if ((errnum = ACE_TEXT_RegQueryValueEx (base_key,
+ name,
+ 0,
+ &type,
+ (BYTE *) buffer.get (),
+ &buffer_length)) != ERROR_SUCCESS)
+ {
+ errno = errnum;
+ return -1;
+ }
value = buffer.get ();
return 0;
@@ -867,19 +913,23 @@ ACE_Configuration_Win32Registry::get_integer_value (const ACE_Configuration_Sect
if (load_key (key, base_key))
return -1;
+ int errnum;
DWORD length = sizeof (value);
DWORD type;
- if (ACE_TEXT_RegQueryValueEx (base_key,
- t_name,
- 0,
- &type,
- (BYTE *) &value,
- &length) != ERROR_SUCCESS)
- return -1;
+ if ((errnum = ACE_TEXT_RegQueryValueEx (base_key,
+ name,
+ 0,
+ &type,
+ (BYTE *) &value,
+ &length)) != ERROR_SUCCESS)
+ {
+ errno = errnum;
+ return -1;
+ }
if (type != REG_DWORD)
{
- errno = 0; ACE_OS::last_error (ERROR_INVALID_DATATYPE);
+ errno = ERROR_INVALID_DATATYPE;
return -1;
}
@@ -901,19 +951,23 @@ ACE_Configuration_Win32Registry::get_binary_value (const ACE_Configuration_Secti
return -1;
// Get the size of the binary data from windows
+ int errnum;
DWORD buffer_length = 0;
DWORD type;
- if (ACE_TEXT_RegQueryValueEx (base_key,
- t_name,
- 0,
- &type,
- (BYTE *) 0,
- &buffer_length) != ERROR_SUCCESS)
- return -1;
+ if ((errnum = ACE_TEXT_RegQueryValueEx (base_key,
+ name,
+ 0,
+ &type,
+ (BYTE *) 0,
+ &buffer_length)) != ERROR_SUCCESS)
+ {
+ errno = errnum;
+ return -1;
+ }
if (type != REG_BINARY)
{
- errno = 0; ACE_OS::last_error (ERROR_INVALID_DATATYPE);
+ errno = ERROR_INVALID_DATATYPE;
return -1;
}
@@ -921,15 +975,16 @@ ACE_Configuration_Win32Registry::get_binary_value (const ACE_Configuration_Secti
ACE_NEW_RETURN (data, BYTE[length], -1);
- if (ACE_TEXT_RegQueryValueEx (base_key,
- t_name,
- 0,
- &type,
- (BYTE *) data,
- &buffer_length) != ERROR_SUCCESS)
+ if ((errnum = ACE_TEXT_RegQueryValueEx (base_key,
+ name,
+ 0,
+ &type,
+ (BYTE *) data,
+ &buffer_length)) != ERROR_SUCCESS)
{
delete [] (BYTE *) data;
data = 0;
+ errno = errnum;
return -1;
}
@@ -958,7 +1013,10 @@ ACE_Configuration_Win32Registry::find_value (const ACE_Configuration_Section_Key
0,
&buffer_length);
if (result != ERROR_SUCCESS)
- return -1;
+ {
+ errno = result;
+ return -1;
+ }
switch (type)
{
@@ -990,8 +1048,12 @@ ACE_Configuration_Win32Registry::remove_value (const ACE_Configuration_Section_K
if (load_key (key, base_key))
return -1;
- if (ACE_TEXT_RegDeleteValue (base_key, t_name) != ERROR_SUCCESS)
- return -1;
+ int errnum;
+ if ((errnum = ACE_TEXT_RegDeleteValue (base_key, name)) != ERROR_SUCCESS)
+ {
+ errno = errnum;
+ return -1;
+ }
return 0;
}
@@ -1017,12 +1079,16 @@ ACE_Configuration_Win32Registry::resolve_key (HKEY hKey,
{
HKEY result = 0;
// Make a copy of hKey
+ int errnum;
#if defined (ACE_HAS_WINCE)
- if (::RegOpenKeyEx (hKey, 0, 0, 0, &result) != ERROR_SUCCESS)
+ if ((errnum = RegOpenKeyEx (hKey, 0, 0, 0, &result)) != ERROR_SUCCESS)
#else
- if (::RegOpenKey (hKey, 0, &result) != ERROR_SUCCESS)
+ if ((errnum = RegOpenKey (hKey, 0, &result)) != ERROR_SUCCESS)
#endif // ACE_HAS_WINCE
- return 0;
+ {
+ errno = errnum;
+ return 0;
+ }
// recurse through the path
ACE_TCHAR *temp_path = 0;
@@ -1043,33 +1109,34 @@ ACE_Configuration_Win32Registry::resolve_key (HKEY hKey,
HKEY subkey;
#if defined (ACE_HAS_WINCE)
- if (ACE_TEXT_RegOpenKeyEx (result,
- temp,
- 0,
- 0,
- &subkey) != ERROR_SUCCESS)
+ if ((errnum = ACE_TEXT_RegOpenKeyEx (result,
+ temp,
+ 0,
+ 0,
+ &subkey)) != ERROR_SUCCESS)
#else
- if (ACE_TEXT_RegOpenKey (result,
- temp,
- &subkey) != ERROR_SUCCESS)
+ if ((errnum = ACE_TEXT_RegOpenKey (result,
+ temp,
+ &subkey)) != ERROR_SUCCESS)
#endif // ACE_HAS_WINCE
{
// try creating it
- if (!create || ACE_TEXT_RegCreateKeyEx (result,
- temp,
- 0,
- 0,
- 0,
- KEY_ALL_ACCESS,
- 0,
- &subkey,
+ if (!create || (errnum = ACE_TEXT_RegCreateKeyEx (result,
+ temp,
+ 0,
+ 0,
+ 0,
+ KEY_ALL_ACCESS,
+ 0,
+ &subkey,
#if defined (__MINGW32__)
- (PDWORD) 0
+ (PDWORD) 0
#else
- 0
+ 0
#endif /* __MINGW32__ */
- ) != ERROR_SUCCESS)
+ )) !=ERROR_SUCCESS)
{
+ errno = errnum;
// error
::RegCloseKey (result);
return 0;
diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp
index 6dfa0edaca5..075c4a8e38d 100644
--- a/ace/Log_Msg.cpp
+++ b/ace/Log_Msg.cpp
@@ -1158,6 +1158,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
case 'p': // <errno> string, ala perror()
{
errno = ACE::map_errno (this->errnum ());
+#if !defined (ACE_HAS_WINCE) /* CE doesn't do strerror() */
if (errno >= 0 && errno < sys_nerr)
{
ACE_OS::strcpy (fp, ACE_LIB_TEXT ("s: %s"));
@@ -1171,6 +1172,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_TEXT_CHAR_TO_TCHAR (ACE_OS_String::strerror (errno)));
}
else
+#endif /* !ACE_HAS_WINCE */
{
#if defined (ACE_WIN32)
ACE_TCHAR *lpMsgBuf = 0;
diff --git a/ace/config-WinCE.h b/ace/config-WinCE.h
index 0f93b2eaed6..5b2b8b667ad 100644
--- a/ace/config-WinCE.h
+++ b/ace/config-WinCE.h
@@ -79,6 +79,7 @@
#define ACE_LACKS_IOSTREAM_TOTALLY
#define ACE_LACKS_ACE_IOSTREAM
+#define ACE_LACKS_AUTO_PTR
#if defined (ACE_HAS_STRICT)
# undef ACE_HAS_STRICT
@@ -243,6 +244,12 @@ typedef long off_t;
// @@ This needs to be defined and initialized as a static. (Singleton?)
#define ACE_DEFAULT_LOG_STREAM 0
+// WinCE can't do fixed addresses for memory-mapped files.
+#if defined (ACE_DEFAULT_BASE_ADDR)
+# undef ACE_DEFAULT_BASE_ADDR
+#endif
+#define ACE_DEFAULT_BASE_ADDR 0
+
// If you don't use MFC, this doesn't get defined
#if !defined (ACE_HAS_MFC)
inline void *operator new (unsigned int, void *p) { return p; }
@@ -250,6 +257,8 @@ typedef long off_t;
#define ACE_ENDTHREADEX(STATUS) ExitThread ((DWORD) STATUS)
+#define ACE_HAS_TSS_EMULATION
+
#include "ace/post.h"
#endif // ACE_CONFIG_WINCE_H
diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h
index e98e72dea6a..00ea29ef2a7 100644
--- a/ace/config-win32-common.h
+++ b/ace/config-win32-common.h
@@ -34,7 +34,9 @@
// On Win9X, a shared address SHOULD be between the 2nd and 3rd Gb.
// Note this will not work for NT: The addresses above 2Gb are
// reserved for the system, so this one will fail.
-# define ACE_DEFAULT_BASE_ADDR ((char*) ((2048UL+512UL)*1024UL*1024UL))
+# if !defined (ACE_DEFAULT_BASE_ADDR)
+# define ACE_DEFAULT_BASE_ADDR ((char*) ((2048UL+512UL)*1024UL*1024UL))
+# endif
#endif
// Define ACE_HAS_MFC to 1, if you want ACE to use CWinThread. This should