/[emacs]/emacs/src/w32reg.c
ViewVC logotype

Diff of /emacs/src/w32reg.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by andrewi, Sun May 2 10:28:55 1999 UTC revision 1.8 by lektu, Tue Feb 4 14:03:16 2003 UTC
# Line 30  Boston, MA 02111-1307, USA.  */ Line 30  Boston, MA 02111-1307, USA.  */
30    
31  #define REG_ROOT "SOFTWARE\\GNU\\Emacs"  #define REG_ROOT "SOFTWARE\\GNU\\Emacs"
32    
33  LPBYTE  LPBYTE
34  w32_get_string_resource (name, class, dwexptype)  w32_get_string_resource (name, class, dwexptype)
35       char *name, *class;       char *name, *class;
36       DWORD dwexptype;       DWORD dwexptype;
# Line 41  w32_get_string_resource (name, class, dw Line 41  w32_get_string_resource (name, class, dw
41    DWORD cbData;    DWORD cbData;
42    BOOL ok = FALSE;    BOOL ok = FALSE;
43    HKEY hive = HKEY_CURRENT_USER;    HKEY hive = HKEY_CURRENT_USER;
44      
45   trykey:   trykey:
46    
47    BLOCK_INPUT;    BLOCK_INPUT;
48      
49    /* Check both the current user and the local machine to see if we have    /* Check both the current user and the local machine to see if we have
50       any resources */       any resources */
51    
52    if (RegOpenKeyEx (hive, REG_ROOT, 0, KEY_READ, &hrootkey) == ERROR_SUCCESS)    if (RegOpenKeyEx (hive, REG_ROOT, 0, KEY_READ, &hrootkey) == ERROR_SUCCESS)
53      {      {
54        char *keyname;        char *keyname;
55          
56        if (RegQueryValueEx (hrootkey, name, NULL, &dwType, NULL, &cbData) == ERROR_SUCCESS        if (RegQueryValueEx (hrootkey, name, NULL, &dwType, NULL, &cbData) == ERROR_SUCCESS
57            && dwType == dwexptype)            && dwType == dwexptype)
58          {          {
59            keyname = name;            keyname = name;
60          }          }
61        else if (RegQueryValueEx (hrootkey, class, NULL, &dwType, NULL, &cbData) == ERROR_SUCCESS        else if (RegQueryValueEx (hrootkey, class, NULL, &dwType, NULL, &cbData) == ERROR_SUCCESS
62                 && dwType == dwexptype)                 && dwType == dwexptype)
63          {          {
# Line 67  w32_get_string_resource (name, class, dw Line 67  w32_get_string_resource (name, class, dw
67          {          {
68            keyname = NULL;            keyname = NULL;
69          }          }
70          
71        ok = (keyname        ok = (keyname
72              && (lpvalue = (LPBYTE) xmalloc (cbData)) != NULL              && (lpvalue = (LPBYTE) xmalloc (cbData)) != NULL
73              && RegQueryValueEx (hrootkey, keyname, NULL, NULL, lpvalue, &cbData) == ERROR_SUCCESS);              && RegQueryValueEx (hrootkey, keyname, NULL, NULL, lpvalue, &cbData) == ERROR_SUCCESS);
74          
75        RegCloseKey (hrootkey);        RegCloseKey (hrootkey);
76      }      }
77      
78    UNBLOCK_INPUT;    UNBLOCK_INPUT;
79      
80    if (!ok)    if (!ok)
81      {      {
82        if (lpvalue)        if (lpvalue)
83          {          {
# Line 90  w32_get_string_resource (name, class, dw Line 90  w32_get_string_resource (name, class, dw
90            goto trykey;            goto trykey;
91          }          }
92        return (NULL);        return (NULL);
93      }      }
94    return (lpvalue);    return (lpvalue);
95  }  }
96    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26