annotate src/w32reg.c @ 68529:7daec5f4a289

* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string instead of replace-regexp-in-string. (crm, multi-prompt): Use mh-require instead of require. (mh-goto-address-find-address-at-point): Use mh-line-beginning-position and mh-line-end-position instead of line-beginning-position and line-end-position. Use mh-match-string-no-properties instead of match-string-no-properties. * mh-comp.el (mh-modify-header-field): Use mh-line-beginning-position and mh-line-end-position instead of line-beginning-position and line-end-position. * mh-compat.el (mailabbrev): Use mh-require instead of require. (mh-assoc-string, mh-display-completion-list, mh-face-foreground) (mh-face-background): Make docstring consistent. (mh-require, mh-cancel-timer, mh-display-color-cells) (mh-line-beginning-position, mh-line-end-position) (mh-match-string-no-properties, mh-replace-regexp-in-string) (mh-view-mode-enter): Move definition here from mh-xemacs.el and add mh- prefix since compatibility functions should have our package prefix (mh-) by Emacs convention and to avoid messing up checks for the same functions in other packages. * mh-e.el (mh-compiling-flag): Move mh-xemacs-compiling-flag here from mh-xemacs.el and rename. (mh-xargs): Use mh-line-beginning-position and mh-line-end-position instead of line-beginning-position and line-end-position. (mh-defface-compat): Use mh-display-color-cells instead of display-color-cells. * mh-folder.el (which-func): Use mh-require instead of require. * mh-funcs.el (mh-list-folders): Use mh-view-mode-enter instead of view-mode-enter. * mh-gnus.el (gnus-util, mm-bodies, mm-decode, mm-view, mml): Use mh-require instead of require. * mh-letter.el (mh-letter-header-end, mh-letter-mode) (mh-letter-next-header-field): Use mh-line-beginning-position and mh-line-end-position instead of line-beginning-position and line-end-position. * mh-limit.el (mh-subject-to-sequence-unthreaded): Use mh-match-string-no-properties instead of match-string-no-properties. (mh-narrow-to-header-field): Use mh-line-beginning-position and mh-line-end-position instead of line-beginning-position and line-end-position. * mh-mime.el (mh-mime-inline-part, mh-mm-display-part) (mh-mh-quote-unescaped-sharp, mh-mh-directive-present-p): Use mh-line-beginning-position and mh-line-end-position instead of line-beginning-position and line-end-position. * mh-search.el (which-func): Use mh-require instead of require. (mh-make-pick-template, mh-index-visit-folder) (mh-pick-parse-search-buffer, mh-swish-next-result) (mh-mairix-next-result, mh-namazu-next-result) (mh-pick-next-result, mh-grep-next-result) (mh-index-create-imenu-index, mh-index-match-checksum) (mh-md5sum-parser, mh-openssl-parser, mh-index-update-maps): Use mh-line-beginning-position and mh-line-end-position instead of line-beginning-position and line-end-position. * mh-seq.el (mh-list-sequences): Use mh-view-mode-enter instead of view-mode-enter. (mh-folder-size-flist, mh-parse-flist-output-line) (mh-add-sequence-notation): Use mh-line-beginning-position and mh-line-end-position instead of line-beginning-position and line-end-position. * mh-show.el (mh-show-addr): Use mh-require instead of require. * mh-speed.el (mh-folder-speedbar-menu-items, mh-speed-toggle) (mh-speed-view, mh-folder-speedbar-buttons) (mh-speed-highlight, mh-speed-goto-folder) (mh-speed-add-buttons, mh-speed-parse-flists-output) (mh-speed-invalidate-map, mh-speedbar-change-expand-button-char) (mh-speed-add-folder): Use mh-line-beginning-position and mh-line-end-position instead of line-beginning-position and line-end-position. (mh-speed-flists): Use mh-cancel-timer instead of cancel-timer. * mh-thread.el (mh-thread-find-children) (mh-thread-parse-scan-line, mh-thread-generate): Use mh-line-beginning-position and mh-line-end-position instead of line-beginning-position and line-end-position. * mh-utils.el (mh-colors-available-p): Use mh-display-color-cells instead of display-color-cells. (mh-folder-list): Use mh-replace-regexp-in-string instead of replace-regexp-in-string. (mh-sub-folders-actual, mh-letter-toggle-header-field-display): Use mh-line-beginning-position and mh-line-end-position instead of line-beginning-position and line-end-position. * mh-comp.el (mh-send-sub): Don't find components file in current directory--this seems to have been a side-effect of commenting out the use of an old mh-etc variable. Improve error message.
author Bill Wohler <wohler@newt.com>
date Wed, 01 Feb 2006 23:24:34 +0000
parents a0d1312ede66
children 3bd95f4f2941 2d92f5c9d6ae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1 /* Emulate the X Resource Manager through the registry.
64770
a0d1312ede66 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64084
diff changeset
2 Copyright (C) 1990, 1993, 1994, 2002, 2003, 2004,
a0d1312ede66 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64084
diff changeset
3 2005 Free Software Foundation, Inc.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
5 This file is part of GNU Emacs.
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
6
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
7 GNU Emacs is free software; you can redistribute it and/or modify
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9 the Free Software Foundation; either version 2, or (at your option)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
10 any later version.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
11
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
15 GNU General Public License for more details.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
16
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
18 along with GNU Emacs; see the file COPYING. If not, write to
64084
a8fa7c632ee4 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
a8fa7c632ee4 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
20 Boston, MA 02110-1301, USA. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
21
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
22 /* Written by Kevin Gallo */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
23
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
24 #include <config.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
25 #include "lisp.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
26 #include "w32term.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
27 #include "blockinput.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
28
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
29 #include <stdio.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
30 #include <string.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
31
15149
685510b93c83 (REG_ROOT): Remove trailing backslash.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
32 #define REG_ROOT "SOFTWARE\\GNU\\Emacs"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
33
51501
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
34 /* Default system colors from the Display Control Panel settings. */
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
35 #define SYSTEM_DEFAULT_RESOURCES \
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
36 "emacs.foreground:SystemWindowText\0" \
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
37 "emacs.background:SystemWindow\0" \
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
38 "emacs.tooltip.attributeForeground:SystemInfoText\0" \
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
39 "emacs.tooltip.attributeBackground:SystemInfoWindow\0" \
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
40 "emacs.tool-bar.attributeForeground:SystemButtonText\0" \
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
41 "emacs.tool-bar.attributeBackground:SystemButtonFace\0" \
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
42 "emacs.menu.attributeForeground:SystemMenuText\0" \
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
43 "emacs.menu.attributeBackground:SystemMenu\0" \
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
44 "emacs.scroll-bar.attributeForeground:SystemScrollbar"
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
45
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
46 /* Other possibilities for default faces:
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
47
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
48 region: Could use SystemHilight, but interferes with our ability to
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
49 see most syntax highlighting through the region face.
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
50
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
51 modeline: Could use System(In)ActiveTitle, gradient versions (not
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
52 supported on 95 and NT), but modeline is more like a status bar
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
53 really (which don't appear to be configurable in Windows).
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
54
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
55 highlight: Could use SystemHotTrackingColor, but it is not supported
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
56 on Windows 95 or NT, and other apps only seem to use it for menus
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
57 anyway.
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
58
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
59 */
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
60
50040
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
61 static char *
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
62 w32_get_rdb_resource (rdb, resource)
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
63 char *rdb;
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
64 char *resource;
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
65 {
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
66 char *value = rdb;
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
67 int len = strlen (resource);
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
68
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
69 while (*value)
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
70 {
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
71 /* Comparison is case-insensitive because registry searches are too. */
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
72 if ((strnicmp (value, resource, len) == 0) && (value[len] == ':'))
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
73 return xstrdup (&value[len + 1]);
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
74
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
75 value = strchr (value, '\0') + 1;
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
76 }
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
77
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
78 return NULL;
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
79 }
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
80
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 24672
diff changeset
81 LPBYTE
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15149
diff changeset
82 w32_get_string_resource (name, class, dwexptype)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
83 char *name, *class;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
84 DWORD dwexptype;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
85 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
86 LPBYTE lpvalue = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
87 HKEY hrootkey = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
88 DWORD dwType;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
89 DWORD cbData;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
90 BOOL ok = FALSE;
24672
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
91 HKEY hive = HKEY_CURRENT_USER;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 24672
diff changeset
92
24672
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
93 trykey:
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
94
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
95 BLOCK_INPUT;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 24672
diff changeset
96
24672
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
97 /* Check both the current user and the local machine to see if we have
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
98 any resources */
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
99
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
100 if (RegOpenKeyEx (hive, REG_ROOT, 0, KEY_READ, &hrootkey) == ERROR_SUCCESS)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
101 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
102 char *keyname;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 24672
diff changeset
103
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
104 if (RegQueryValueEx (hrootkey, name, NULL, &dwType, NULL, &cbData) == ERROR_SUCCESS
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
105 && dwType == dwexptype)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
106 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
107 keyname = name;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 24672
diff changeset
108 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
109 else if (RegQueryValueEx (hrootkey, class, NULL, &dwType, NULL, &cbData) == ERROR_SUCCESS
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
110 && dwType == dwexptype)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
111 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
112 keyname = class;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
113 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
114 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
115 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
116 keyname = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
117 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 24672
diff changeset
118
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
119 ok = (keyname
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
120 && (lpvalue = (LPBYTE) xmalloc (cbData)) != NULL
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
121 && RegQueryValueEx (hrootkey, keyname, NULL, NULL, lpvalue, &cbData) == ERROR_SUCCESS);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 24672
diff changeset
122
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
123 RegCloseKey (hrootkey);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
124 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 24672
diff changeset
125
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
126 UNBLOCK_INPUT;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 24672
diff changeset
127
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 24672
diff changeset
128 if (!ok)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
129 {
24672
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
130 if (lpvalue)
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
131 {
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
132 xfree (lpvalue);
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
133 lpvalue = NULL;
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
134 }
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
135 if (hive == HKEY_CURRENT_USER)
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
136 {
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
137 hive = HKEY_LOCAL_MACHINE;
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
138 goto trykey;
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
139 }
51501
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
140
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
141 /* Check if there are Windows specific defaults defined. */
b79b842995c2 (SYSTEM_DEFAULT_RESOURCES): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 50364
diff changeset
142 return w32_get_rdb_resource (SYSTEM_DEFAULT_RESOURCES, name);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 24672
diff changeset
143 }
24672
8387918b52c6 (w32_get_string_resource): Check for name in current
Andrew Innes <andrewi@gnu.org>
parents: 16588
diff changeset
144 return (lpvalue);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
145 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
146
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
147 /* Retrieve the string resource specified by NAME with CLASS from
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
148 database RDB. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
149
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
150 char *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
151 x_get_string_resource (rdb, name, class)
50364
fcf617f53ab1 (x_get_string_resource): Use XrmDatabase.
Kim F. Storm <storm@cua.dk>
parents: 50040
diff changeset
152 XrmDatabase rdb;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
153 char *name, *class;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
154 {
50040
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
155 if (rdb)
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
156 {
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
157 char *resource;
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
158
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
159 if (resource = w32_get_rdb_resource (rdb, name))
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
160 return resource;
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
161 if (resource = w32_get_rdb_resource (rdb, class))
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
162 return resource;
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
163 }
57e262ca5d0d (w32_get_rdb_resource): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 49600
diff changeset
164
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15149
diff changeset
165 return (w32_get_string_resource (name, class, REG_SZ));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
166 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51501
diff changeset
167
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51501
diff changeset
168 /* arch-tag: 755fce25-42d7-4acb-874f-2fb42336823d
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51501
diff changeset
169 (do not change this comment) */