Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
winEmbedFileLocProvider.cpp File Reference
#include "winEmbedFileLocProvider.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceDefs.h"
#include "nsILocalFile.h"
#include "nsString.h"
#include "nsXPIDLString.h"
#include "nsCRT.h"
#include <windows.h>
#include <shlobj.h>

Go to the source code of this file.

Defines

#define APP_REGISTRY_NAME   NS_LITERAL_CSTRING("registry.dat")
#define PROFILE_ROOT_DIR_NAME   NS_LITERAL_CSTRING("Profiles")
#define DEFAULTS_DIR_NAME   NS_LITERAL_CSTRING("defaults")
#define DEFAULTS_PREF_DIR_NAME   NS_LITERAL_CSTRING("pref")
#define DEFAULTS_PROFILE_DIR_NAME   NS_LITERAL_CSTRING("profile")
#define RES_DIR_NAME   NS_LITERAL_CSTRING("res")
#define CHROME_DIR_NAME   NS_LITERAL_CSTRING("chrome")
#define PLUGINS_DIR_NAME   NS_LITERAL_CSTRING("plugins")
#define SEARCH_DIR_NAME   NS_LITERAL_CSTRING("searchplugins")
#define COMPONENTS_DIR_NAME   NS_LITERAL_CSTRING("components")

Functions

static char * GetGreLocationFromRegistry ()

Define Documentation

Definition at line 55 of file winEmbedFileLocProvider.cpp.

Definition at line 62 of file winEmbedFileLocProvider.cpp.

Definition at line 65 of file winEmbedFileLocProvider.cpp.

Definition at line 58 of file winEmbedFileLocProvider.cpp.

Definition at line 59 of file winEmbedFileLocProvider.cpp.

Definition at line 60 of file winEmbedFileLocProvider.cpp.

Definition at line 63 of file winEmbedFileLocProvider.cpp.

Definition at line 57 of file winEmbedFileLocProvider.cpp.

Definition at line 61 of file winEmbedFileLocProvider.cpp.

#define SEARCH_DIR_NAME   NS_LITERAL_CSTRING("searchplugins")

Definition at line 64 of file winEmbedFileLocProvider.cpp.


Function Documentation

static char* GetGreLocationFromRegistry ( ) [static]

Definition at line 193 of file winEmbedFileLocProvider.cpp.

{
    char szKey[256];
    HKEY hRegKey = NULL;
    DWORD dwLength = _MAX_PATH * sizeof(char);
    long rc;
    char keyValue[_MAX_PATH + 1];
    char *pGreLocation = NULL;

    // A couple of key points here:
    // 1. Note the usage of the "Software\\Mozilla\\GRE" subkey - this allows
    //    us to have multiple versions of GREs on the same machine by having
    //    subkeys such as 1.0, 1.1, 2.0 etc. under it.
    // 2. In this sample below we're looking for the location of GRE version 1.3
    //    i.e. we're compatible with GRE 1.3 and we're trying to find it's install
    //    location.
    //
    // Please see http://www.mozilla.org/projects/embedding/MRE.html for
    // more info.
    //
    strcpy(szKey, "Software\\Mozilla\\GRE\\" MOZILLA_VERSION);

    if (::RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_QUERY_VALUE, &hRegKey) == ERROR_SUCCESS) 
    {
        if ((rc = ::RegQueryValueEx(hRegKey, "GreHome", NULL, NULL, (BYTE *)keyValue, &dwLength))==ERROR_SUCCESS)
        {
            pGreLocation = ::strdup(keyValue);
            ::RegCloseKey(hRegKey);
        }
    }

    return pGreLocation;
}

Here is the caller graph for this function: