Attachment #184218: patch to get rid of it for bug #272166

View | Details | Raw Unified | Return to bug 272166
Collapse All | Expand All

(-)browser/components/shell/public/nsIWindowsShellService.idl (-21 / +1 lines)
Line     Link Here 
 Lines 33-47    Link Here 
33
 * the provisions above, a recipient may use your version of this file under
33
 * the provisions above, a recipient may use your version of this file under
34
 * the terms of any one of the MPL, the GPL or the LGPL.
34
 * the terms of any one of the MPL, the GPL or the LGPL.
35
 *
35
 *
36
 * ***** END LICENSE BLOCK ***** */
36
 * ***** END LICENSE BLOCK ***** */
37
37
38
#include "nsIShellService.idl"
38
#include "nsIShellService.idl"
39
39
40
[scriptable, uuid(eccda3b0-ea69-4066-8343-ddaf1f435b53)]
40
[scriptable, uuid(5a92782c-a2e8-4dd3-b18a-33acc3af4fd7)]
41
interface nsIWindowsShellService : nsIShellService
41
interface nsIWindowsShellService : nsIShellService
42
{
42
{
43
    /**
43
    /**
44
    * Restores system settings to what they were before Firefox 
44
    * Restores system settings to what they were before Firefox 
45
    * modified them.
45
    * modified them.
46
    *
46
    *
47
    * @param aForAllUsers   Whether or not Firefox should restore
47
    * @param aForAllUsers   Whether or not Firefox should restore
 Lines 52-80   interface nsIWindowsShellService : nsISh Link Here 
52
52
53
    /** 
53
    /** 
54
     * The number of unread mail messages for the current user.
54
     * The number of unread mail messages for the current user.
55
     * 
55
     * 
56
     * @return The number of unread (new) mail messages for the current user.
56
     * @return The number of unread (new) mail messages for the current user.
57
     */
57
     */
58
    readonly attribute unsigned long unreadMailCount;
58
    readonly attribute unsigned long unreadMailCount;
59
60
    /**
61
     * Valid starting keys for the Windows Registry.
62
     */
63
    const long HKCR = 0; // HKEY_CLASSES_ROOT
64
    const long HKCC = 1; // HKEY_CURRENT_CONFIG
65
    const long HKCU = 2; // HKEY_CURRENT_USER
66
    const long HKLM = 3; // HKEY_LOCAL_MACHINE
67
    const long HKU  = 4; // HKEY_USERS
68
69
    /** 
70
     * Retrieves a Windows Registry entry value.
71
     * 
72
     * @param aHKeyConstant The starting key, using the constants defined above.
73
     * @param aSubKeyName   The sub key to locate
74
     * @param aValueName    The value to locate in the sub key. The empty string
75
     *                      returns the default value of the sub key.
76
     * @return The value of the specified sub key/value, truncated to 4096 bytes.
77
     */
78
    string getRegistryEntry(in long aHKeyConstant, in string aSubKeyName, in string aValueName);
79
};
59
};
80
60
(-)browser/components/shell/src/nsWindowsShellService.cpp (-48 lines)
Line     Link Here 
 Lines 1006-1067   nsWindowsShellService::GetMailAccountKey Link Here 
1006
  while (1);
1006
  while (1);
1007
1007
1008
  // Close the key we opened.
1008
  // Close the key we opened.
1009
  ::RegCloseKey(mailKey);
1009
  ::RegCloseKey(mailKey);
1010
  return PR_FALSE;
1010
  return PR_FALSE;
1011
}
1011
}
1012
1012
1013
NS_IMETHODIMP
1014
nsWindowsShellService::GetRegistryEntry(PRInt32 aHKEYConstant,
1015
                                        const char *aSubKeyName,
1016
                                        const char *aValueName,
1017
                                        char **aResult)
1018
{
1019
  HKEY hKey, fullKey;
1020
1021
  *aResult = 0;
1022
  // Calculate HKEY_* base key
1023
  switch (aHKEYConstant) {
1024
  case HKCR:
1025
    hKey = HKEY_CLASSES_ROOT;
1026
    break;
1027
  case HKCC:
1028
    hKey = HKEY_CURRENT_CONFIG;
1029
    break;
1030
  case HKCU:
1031
    hKey = HKEY_CURRENT_USER;
1032
    break;
1033
  case HKLM:
1034
    hKey = HKEY_LOCAL_MACHINE;
1035
    break;
1036
  case HKU:
1037
    hKey = HKEY_USERS;
1038
    break;
1039
  default:
1040
    return NS_ERROR_INVALID_ARG;
1041
  }
1042
  
1043
  // Open Key
1044
  LONG rv = ::RegOpenKeyEx(hKey, aSubKeyName, 0, KEY_READ, &fullKey);
1045
1046
  if (rv == ERROR_SUCCESS) {
1047
    char buffer[4096] = { 0 };
1048
    DWORD len = sizeof buffer;
1049
    rv = ::RegQueryValueEx(fullKey, aValueName, NULL, NULL,
1050
                           (LPBYTE)buffer, &len);
1051
1052
    if (rv == ERROR_SUCCESS)
1053
      *aResult = PL_strdup(buffer);
1054
  }
1055
1056
  ::RegCloseKey(fullKey);
1057
1058
  return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
1059
}
1060
1061
static nsresult ResetHomepage()
1013
static nsresult ResetHomepage()
1062
{
1014
{
1063
  // Reset the homepage to the default value if the user requested the installer do so.
1015
  // Reset the homepage to the default value if the user requested the installer do so.
1064
  HKEY theKey;
1016
  HKEY theKey;
1065
  nsresult rv = OpenKeyForWriting("Software\\Mozilla\\Mozilla Firefox", &theKey, PR_FALSE, PR_FALSE);
1017
  nsresult rv = OpenKeyForWriting("Software\\Mozilla\\Mozilla Firefox", &theKey, PR_FALSE, PR_FALSE);
1066
  if (NS_FAILED(rv)) return rv;
1018
  if (NS_FAILED(rv)) return rv;
1067
1019

Return to bug 272166