]>
code.delx.au - gnu-emacs/blob - src/w32reg.c
1 /* Emulate the X Resource Manager through the registry.
2 Copyright (C) 1990, 1993, 1994 Free Software Foundation.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
18 /* Written by Kevin Gallo */
23 #include "blockinput.h"
28 #define REG_ROOT "SOFTWARE\\GNU\\Emacs\\"
31 win32_get_string_resource (name
, class, dwexptype
)
35 LPBYTE lpvalue
= NULL
;
43 /* Check both the current user and the local machine to see if we have any resources */
45 if (RegOpenKeyEx (HKEY_CURRENT_USER
, REG_ROOT
, 0, KEY_READ
, &hrootkey
) == ERROR_SUCCESS
46 || RegOpenKeyEx (HKEY_LOCAL_MACHINE
, REG_ROOT
, 0, KEY_READ
, &hrootkey
) == ERROR_SUCCESS
)
50 if (RegQueryValueEx (hrootkey
, name
, NULL
, &dwType
, NULL
, &cbData
) == ERROR_SUCCESS
51 && dwType
== dwexptype
)
55 else if (RegQueryValueEx (hrootkey
, class, NULL
, &dwType
, NULL
, &cbData
) == ERROR_SUCCESS
56 && dwType
== dwexptype
)
66 && (lpvalue
= (LPBYTE
) xmalloc (cbData
)) != NULL
67 && RegQueryValueEx (hrootkey
, keyname
, NULL
, NULL
, lpvalue
, &cbData
) == ERROR_SUCCESS
);
69 RegCloseKey (hrootkey
);
76 if (lpvalue
) xfree (lpvalue
);
85 /* Retrieve the string resource specified by NAME with CLASS from
89 x_get_string_resource (rdb
, name
, class)
93 return (win32_get_string_resource (name
, class, REG_SZ
));