示例#1
0
axis2_status_t AXIS2_CALL read_registery_init_data() 
{
    long rc = 0;
    axis2_status_t ok = TRUE;
    char tmpbuf[INTERNET_MAX_URL_LENGTH];
    HKEY hkey;
	AXIS2_IMPORT extern axis2_char_t *axis2_request_url_prefix;

    rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGISTRY_LOCATION, (DWORD) 0, KEY_READ, &hkey);
    if (ERROR_SUCCESS != rc)
    {
        return AXIS2_FAILURE;
    }
    if (get_registry_config_parameter(hkey, AXIS2_IIS_REPO_PATH_TAG, tmpbuf, sizeof(repo_path)))
    {
        strcpy(repo_path, tmpbuf);
    }
    else
    {
		return AXIS2_FAILURE;
    }
    if (get_registry_config_parameter(hkey, AXIS2_IIS_LOG_FILE_TAG, tmpbuf, sizeof(log_file)))
    {
        strcpy(log_file, tmpbuf);
    }
    else
    {
		return AXIS2_FAILURE;
    }
    if (get_registry_config_parameter(hkey, AXIS2_IIS_LOG_LEVEL_TAG, tmpbuf, sizeof(tmpbuf)))
    {
        log_level = axis2_iis_parse_log_level(tmpbuf);
    }
	else 
	{
		return AXIS2_FAILURE;
	}
	if (get_registry_config_parameter(hkey, AXIS2_IIS_SERVICE_URL_PREFIX, tmpbuf, sizeof(tmpbuf)))
	{
		axis2_request_url_prefix = _strdup(tmpbuf); 
	}
	if (get_registry_config_parameter(hkey, AXIS2_IIS_AXIS2_LOCATION, tmpbuf, sizeof(tmpbuf)))
	{
		axis2_location = _strdup(tmpbuf); 
	}
    RegCloseKey(hkey);
    return ok;
}
示例#2
0
static int read_registry_init_data(jk_env_t *env)
{
    char tmpbuf[INTERNET_MAX_URL_LENGTH];
    HKEY hkey;
    long rc;
    int  ok = JK_TRUE; 
    char *tmp;
    jk_map_t *map;
   
    if (JK_OK==jk2_map_default_create(env, &map, workerEnv->pool )) {
        if (JK_OK==jk2_config_file_read(env,map, ini_file_name)) {
            tmp = map->get(env,map,EXTENSION_URI_TAG);
            if (tmp) {
                strcpy(extension_uri, tmp);
            } else {
                ok = JK_FALSE;
            }
            tmp = map->get(env,map,SERVER_ROOT_TAG);
            if (tmp) {
                strcpy(server_root, tmp);
            } else {
                ok = JK_FALSE;
            }
            tmp = map->get(env,map,WORKERS_FILE_TAG);
            if (tmp) {
                strcpy(worker_file, tmp);
            }
            tmp = map->get(env,map,THREAD_POOL_TAG);
            if (tmp) {
                use_thread_pool = atoi(tmp);
                if (use_thread_pool < 10)
                    use_thread_pool = 0;
            }
            tmp = map->get(env,map,USE_AUTH_COMP_TAG);
            if (tmp) {
                use_auth_notification_flags = atoi(tmp);
            }
            tmp = map->get(env,map,SEND_GROUPS_TAG);
            if (tmp) {
                send_groups = atoi(tmp);
            }
            using_ini_file=JK_TRUE;            
            return ok;
        }     
    } else {
        env->l->jkLog(env, env->l, JK_LOG_ERROR, 
               "read_registry_init_data, Failed to create map \n");
    }
    rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
                      REGISTRY_LOCATION,
                      (DWORD)0,
                      KEY_READ,
                      &hkey);
    if(ERROR_SUCCESS != rc) {
        env->l->jkLog(env, env->l, JK_LOG_ERROR, 
               "read_registry_init_data, Failed Registry OpenKey %s\n",REGISTRY_LOCATION);
        return JK_FALSE;
    } 

    if(get_registry_config_parameter(hkey,
                                     EXTENSION_URI_TAG,
                                     tmpbuf,
                                     sizeof(extension_uri))) {
        strcpy(extension_uri, tmpbuf);
    } else {
        ok = JK_FALSE;
    }

    if(get_registry_config_parameter(hkey,
                                     SERVER_ROOT_TAG,
                                     tmpbuf,
                                     sizeof(server_root))) {
        strcpy(server_root, tmpbuf);
    } else {
        ok = JK_FALSE;
    }
    if(get_registry_config_parameter(hkey,
                                     WORKERS_FILE_TAG,
                                     tmpbuf,
                                     sizeof(server_root))) {
        strcpy(worker_file, tmpbuf);
    } else {
        ok = JK_FALSE;
    }
    if(get_registry_config_parameter(hkey,
                                     THREAD_POOL_TAG,
                                     tmpbuf,
                                     8)) {
        use_thread_pool = atoi(tmpbuf);
        if (use_thread_pool < 10) {
            use_thread_pool = 0;
            env->l->jkLog(env, env->l, JK_LOG_INFO, 
                          "read_registry_init_data, ThreadPool must be set to the value 10 or higher\n");
        }
    }
    if(get_registry_config_parameter(hkey,
                                     USE_AUTH_COMP_TAG,
                                     tmpbuf,
                                     8)) {
        use_auth_notification_flags = atoi(tmpbuf);
    }

    if(get_registry_config_parameter(hkey,
                                     SEND_GROUPS_TAG,
                                     tmpbuf,
                                     8)) {
        send_groups = atoi(tmpbuf);
    }

    RegCloseKey(hkey);
    return ok;
}