views:

455

answers:

1

Hi

    I am using RegOpenKeyEx() and giving registry path Software\\Mozilla\\Mozilla Firefox ,its giving error_sucess.but after that how can i get the instal directory Data of mozilla firefox from that path using RegQueryValueEx().
+1  A: 

First you need to open Software\Mozilla\Mozilla Firefox and query the CurrentVersion value for the current active version.

Then, open Software\Mozilla\Mozilla Firefox\\Main and query its Install Directory value.

RegQueryValueEx is used like so;

TCHAR buffer[1024] = {0};
DWORD bufferSize = sizeof(buffer);
DWORD result = RegQueryValueEx( hkeyMain,
                         TEXT("Install Directory"),
                         NULL,
                         NULL,
                         (LPBYTE)buffer,
                         &bufferSize);
if (result == ERROR_SUCCESS)
{
    // buffer now contains the install directory
}
Kim Gräsman
can u pls give example code for fetch the curect version value .because now facing problem for curect version and getting "access denied", RegQueryValueEx(hKey,L"CurrentVersion",NULL,/*REG_SZ*/NULL,(LPBYTE)version,
@BhrKamal: Access denied should only happen on RegOpenKeyEx -- can you show what you are doing in that call?
Kim Gräsman