Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
DDERegistryEntry Struct Reference
Inheritance diagram for DDERegistryEntry:
Inheritance graph
[legend]
Collaboration diagram for DDERegistryEntry:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DDERegistryEntry (const char *protocol)
nsresult set ()
nsresult reset ()
PRBool isAlreadySet () const
nsCString currentSetting (PRBool *currentUndefined=0) const
const char * valueNameArg () const
nsCString fullName () const

Public Attributes

SavedRegistryEntry activate
SavedRegistryEntry app
SavedRegistryEntry topic
HKEY baseKey
PRBool isNull
nsCString keyName
nsCString valueName
nsCString setting

Detailed Description

Definition at line 242 of file nsWindowsHooksUtil.cpp.


Constructor & Destructor Documentation

DDERegistryEntry::DDERegistryEntry ( const char *  protocol) [inline]

Definition at line 243 of file nsWindowsHooksUtil.cpp.

        : SavedRegistryEntry( HKEY_LOCAL_MACHINE, "", "", 0 ),
          activate( HKEY_LOCAL_MACHINE, "", "NoActivateHandler", 0 ),
          app( HKEY_LOCAL_MACHINE, "", "", 0 ),
          topic( HKEY_LOCAL_MACHINE, "", "", 0 ) {
        // Derive keyName from protocol.
        keyName = "Software\\Classes\\";
        keyName += protocol;
        keyName += "\\shell\\open\\ddeexec";
        // Set subkey names.
        activate.keyName = keyName;
        app.keyName = keyName;
        app.keyName += "\\Application";
        topic.keyName = keyName;
        topic.keyName += "\\Topic";
    }

Member Function Documentation

nsCString RegistryEntry::currentSetting ( PRBool currentUndefined = 0) const [inherited]

Definition at line 725 of file nsWindowsHooksUtil.cpp.

                                                                          {
    nsCString result;

    if ( currentlyUndefined ) {
        *currentlyUndefined = PR_TRUE;
    }

    HKEY   key;
    LONG   rc = ::RegOpenKey( baseKey, keyName.get(), &key );
    if ( rc == ERROR_SUCCESS ) {
        if (!IsNT()) {
            char buffer[4096] = { 0 };
            DWORD len = sizeof buffer;
            rc = ::RegQueryValueExA( key, valueNameArg(), NULL, NULL,
                 (LPBYTE)buffer, &len );
            if ( rc == ERROR_SUCCESS ) {
                nsAutoString uResult;
                NS_CopyNativeToUnicode(nsDependentCString(buffer), uResult);
                CopyUTF16toUTF8(uResult, result);
                if ( currentlyUndefined ) {
                    *currentlyUndefined = PR_FALSE; // Indicate entry is present
                }
            }
        } else {
            PRUnichar buffer[4096] = { 0 };
            DWORD len = sizeof buffer;
            rc = ::RegQueryValueExW( key,
                 NS_ConvertASCIItoUTF16(valueNameArg()).get(), NULL, NULL,
                 (LPBYTE)buffer, &len );
            if ( rc == ERROR_SUCCESS ) {
                CopyUTF16toUTF8(buffer, result);
                if ( currentlyUndefined ) {
                    *currentlyUndefined = PR_FALSE; // Indicate entry is present
                }
            }
        }
        ::RegCloseKey( key );
    }

    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsCString RegistryEntry::fullName ( ) const [inherited]

Definition at line 302 of file nsWindowsHooksUtil.cpp.

                                        {
    nsCString result;
    if ( baseKey == HKEY_CURRENT_USER ) {
        result = "HKEY_CURRENT_USER\\";
    } else if ( baseKey == HKEY_LOCAL_MACHINE ) {
        result = "HKEY_LOCAL_MACHINE\\";
    } else {
        result = "\\";
    }
    result += keyName;
    if ( !valueName.IsEmpty() ) {
        result += "[";
        result += valueName;
        result += "]";
    }
    return result;
}

Here is the caller graph for this function:

PRBool RegistryEntry::isAlreadySet ( ) const [inherited]

Definition at line 321 of file nsWindowsHooksUtil.cpp.

                                         {
    PRBool result = FALSE;

    nsCAutoString current( currentSetting() );

    result = ( current == setting );

    return result;
}

Here is the call graph for this function:

Reimplemented from SavedRegistryEntry.

Definition at line 712 of file nsWindowsHooksUtil.cpp.

                                 {
    nsresult rv = SavedRegistryEntry::reset();
    rv = activate.reset();
    rv = app.reset();
    rv = topic.reset();
    return rv;
}

Here is the call graph for this function:

Reimplemented from SavedRegistryEntry.

Definition at line 693 of file nsWindowsHooksUtil.cpp.

                               {
    nsresult rv = SavedRegistryEntry::set();
    rv = activate.set();
    rv = app.set();
    rv = topic.set();
    // We've saved what we can.  Now recurse through this key and
    // subkeys.  This is necessary due to the fact that
    // ::RegDeleteKey won't work on WinNT (and Win2k?) if there are
    // subkeys.
    if ( deleteKey( baseKey, keyName.get() ) != ERROR_SUCCESS ) {
        rv = NS_ERROR_FAILURE;
    }
    return rv;
}

Here is the call graph for this function:

const char* RegistryEntry::valueNameArg ( ) const [inline, inherited]

Definition at line 148 of file nsWindowsHooksUtil.cpp.

                                     {
        return valueName.IsEmpty() ? NULL : valueName.get();
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 261 of file nsWindowsHooksUtil.cpp.

Definition at line 261 of file nsWindowsHooksUtil.cpp.

Definition at line 129 of file nsWindowsHooksUtil.cpp.

Definition at line 130 of file nsWindowsHooksUtil.cpp.

Definition at line 131 of file nsWindowsHooksUtil.cpp.

Definition at line 133 of file nsWindowsHooksUtil.cpp.

Definition at line 261 of file nsWindowsHooksUtil.cpp.

Definition at line 132 of file nsWindowsHooksUtil.cpp.


The documentation for this struct was generated from the following file: