summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_console.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2006-01-03 17:44:26 +0000
committerChristopher Faylor <me@cgf.cx>2006-01-03 17:44:26 +0000
commitadcff8d159698ea0ff59505ada74fc7243738e68 (patch)
tree8efd16e71fdef6a230dcb316dbca01a4127fad0d /winsup/cygwin/fhandler_console.cc
parent825d0b93850125861ebefa6925ada44fe8f93f92 (diff)
downloadcygnal-adcff8d159698ea0ff59505ada74fc7243738e68.tar.gz
cygnal-adcff8d159698ea0ff59505ada74fc7243738e68.tar.bz2
cygnal-adcff8d159698ea0ff59505ada74fc7243738e68.zip
* dir.cc (readdir_worker): Minor code cleanup.
* fhandler_console.cc (beep): Use a more Windows-generic wav file if the beep is missing. Use a more foolproof way to find out whether we should be recreating the missing key. * registry.h (reg_key::_disposition): New field. (reg_key::created): New function. * registry.cc (reg_key::reg_key): Set _disposition to zero by default. (reg_key::build_key): Fill in _disposition field.
Diffstat (limited to 'winsup/cygwin/fhandler_console.cc')
-rw-r--r--winsup/cygwin/fhandler_console.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 3370564c2..431886352 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -1,6 +1,7 @@
/* fhandler_console.cc
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2006 Red Hat, Inc.
This file is part of Cygwin.
@@ -1416,11 +1417,17 @@ bad_escape:
static void
beep ()
{
- char buf[4096];
reg_key r (HKEY_CURRENT_USER, KEY_ALL_ACCESS, "AppEvents", "Schemes", "Apps",
- ".Default", ".Default", ".current", NULL);
- if (r.get_string ("", buf, sizeof (buf), "") != 0)
- r.set_string ("", "Windows XP Ding.wav");
+ ".Default", ".Default", ".Current", NULL);
+ if (r.created ())
+ {
+ char *buf = NULL;
+ UINT len = GetWindowsDirectory (buf, 0);
+ buf = (char *) alloca (len += sizeof ("\\media\\ding.wav"));
+ UINT res = GetWindowsDirectory (buf, len);
+ if (res && res <= len)
+ r.set_string ("", strcat (buf, "\\media\\ding.wav"));
+ }
MessageBeep (0xFFFFFFFF);
}