[PATCH 1/3] ntdll: Factor out SMBIOS table creation.

Alexandre Julliard julliard at winehq.org
Thu Sep 16 15:12:33 CDT 2021


Brendan Shanks <bshanks at codeweavers.com> writes:

> @@ -1264,13 +1264,200 @@ static NTSTATUS create_cpuset_info(SYSTEM_CPU_SET_INFORMATION *info)
>  
>  #ifdef linux
>  
> -static void copy_smbios_string( char **buffer, char *s, size_t len )
> +static void copy_smbios_string( char **buffer, const char *s, size_t len )
>  {
>      if (!len) return;
>      memcpy(*buffer, s, len + 1);
>      *buffer += len + 1;
>  }
>  
> +#define S(s) const char * s, size_t s ## _len
> +static NTSTATUS create_smbios_tables( SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti, ULONG available_len,
> +                                      ULONG *required_len,
> +                                      S(bios_vendor), S(bios_version), S(bios_date),
> +                                      S(system_vendor), S(system_product), S(system_version),
> +                                      S(system_serial), const GUID *system_uuid, S(system_sku),
> +                                      S(system_family),
> +                                      S(board_vendor), S(board_product), S(board_version),
> +                                      S(board_serial), S(board_asset_tag),
> +                                      S(chassis_vendor), BYTE chassis_type, S(chassis_version),
> +                                      S(chassis_serial), S(chassis_asset_tag) )
> +#undef S

If you have to add macros to define the function parameters, it's
probably a sign that you should be passing some sort of array or
structure instead.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list