[PATCH 4/4] ntdll: Add more complete implementation of NtPowerInformation

Alexandre Julliard julliard at winehq.org
Thu Sep 13 09:58:57 CDT 2012


James Eder <jimportal at gmail.com> writes:

> @@ -2261,7 +2242,19 @@ NTSTATUS WINAPI NtInitiatePowerAction(
>  		SystemAction,MinSystemState,Flags,Asynchronous);
>          return STATUS_NOT_IMPLEMENTED;
>  }
> -	
> +
> +#ifdef linux
> +static int have_cpufreq(void)
> +{
> +    FILE* f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", "r");
> +    if(f)
> +    {
> +        fclose(f);
> +        return 1;
> +    }
> +    return 0;
> +}
> +#endif

You don't want to open a file just to see if you will be able to open it
for real later on. You'll need to check the subsequent open anyway, so
you can do the fallback at that point.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list