Logo Search packages:      
Sourcecode: maxdb-7.5.00 version File versions

bool Tools_EventLogFile::modifyRegistry ( const Tools_DynamicUTF8String aResourceLibrary  )  [private]

makes registry entries

Registers the resource library. See Microsoft's descrption for making event log entries. Sets status returned by checkFile().

Parameters:
aResourceLibrary [IN] path to and including the library
See also:
checkFile()

Definition at line 107 of file Tools_EventLogFile.cpp.

References bConnected, Tools_DynamicUTF8String::CharPtr(), Tools_DynamicUTF8String::Empty(), hEventLog, Tools_DynamicUTF8String::Length(), sRegistryRoot, and sSourceName.

Referenced by Tools_EventLogFile().

                                                         {

    Tools_DynamicUTF8String temp;

    if( !aResourceLibrary.Empty() ) {
        // if the subtree, that we create here, exists
        // already, the result is the same.
        // add source name as a subkey under the Application 
        // key in the EventLog registry key. 
        HKEY hNewRegNode;
        Tools_DynamicUTF8String sNewRegNode(sRegistryRoot);
        sNewRegNode += sSourceName;
        bConnected = (ERROR_SUCCESS ==
                    RegCreateKey(
                        HKEY_LOCAL_MACHINE,
                        sNewRegNode.CharPtr(),
                        &hNewRegNode));

        if( !bConnected )
            return false;

        // add subkey with path to resource library
        temp = aResourceLibrary;
        bConnected = (ERROR_SUCCESS ==
                    RegSetValueEx(
                        hNewRegNode,
                        "EventMessageFile",
                        0,
                        REG_EXPAND_SZ,
                        (LPBYTE)temp.CharPtr(),
                        temp.Length() + 1));

        if( !bConnected )
            return false;
        
        // add subkey with supported message types
        DWORD dwData = STATUS_SEVERITY_INFORMATIONAL |
                    STATUS_SEVERITY_WARNING       |
                    STATUS_SEVERITY_ERROR;

        bConnected = (ERROR_SUCCESS ==
                    RegSetValueEx(
                        hNewRegNode,
                        "TypesSupported",
                        0,
                        REG_DWORD,
                        (LPBYTE) &dwData,
                        sizeof(DWORD)));
    }

    temp = sSourceName;
    hEventLog = RegisterEventSource(
                     NULL,
                     temp.CharPtr());
    
    bConnected = (hEventLog != NULL);

    return bConnected;
}


Generated by  Doxygen 1.6.0   Back to index