static int GetTziFromKey()

in src/win32/dt_win32.c [350:374]


static int GetTziFromKey(const char szKey[], const char szValue[], REG_TZI_FORMAT *ptzi)
{
    int rc = EXIT_FAILURE;
    HKEY hkey_tz = NULL;
    DWORD dw = sizeof(REG_TZI_FORMAT);
    if (ptzi == NULL || szKey == NULL || szValue == NULL) {
        return EXIT_FAILURE;
    }

    memset(ptzi, 0, sizeof(REG_TZI_FORMAT));

    if (ERROR_SUCCESS !=  RegOpenKeyA(HKEY_LOCAL_MACHINE, szKey, &hkey_tz)) {
        return EXIT_FAILURE;
    }

    if (ERROR_SUCCESS != RegQueryValueExA(hkey_tz, szValue,
                                          NULL, NULL, (LPBYTE)ptzi, &dw)) {
        rc = EXIT_FAILURE;
    } else {
        rc = EXIT_SUCCESS;
    }

    RegCloseKey(hkey_tz);
    return rc;
}