Processing flags before files in regsvr32

Stefan Dösinger stefandoesinger at gmail.com
Wed Jul 15 06:05:15 CDT 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I haven't really looked into the details, but I am curious if your
change works ok if the user passes a Unix path to regsvr32?

Cheers,
Stefan

Am 2015-07-14 um 13:37 schrieb Hugh McMaster:
> After investigating bug 38870 [1], I came up with some possible
> solutions to this problem.
> 
> 1. Duplicate argv. 2. Copy the filename argument into a dynamically
> allocated array. 3. Copy the filename's iteration number (the 'n'
> of argv[n]) into a dynamically allocated array. 4. Use NULL
> pointers after processing to determine whether an argument is a
> flag or a filename.
> 
> Of these answers, option four is the lightest and easiest to
> implement. It is also efficient. The idea is to assign argv[i] =
> NULL after we have processed an argument that is a flag.
> 
> So, I'm proposing something like this pseudo-code (there is an
> actual diff below):
> 
> for (i = 1; i < argc; i++) { if (is a flag) { do something; argv[i]
> = NULL; } } for (i = 1; i < argc; i++) { if (argv[i]) /* only
> filenames are valid */ do something; }
> 
> diff --git a/programs/regsvr32/regsvr32.c
> b/programs/regsvr32/regsvr32.c index 449124f..ef895e0 100644 ---
> a/programs/regsvr32/regsvr32.c +++ b/programs/regsvr32/regsvr32.c 
> @@ -270,8 +270,13 @@ int wmain(int argc, WCHAR* argv[]) 
> output_write(STRING_USAGE); return 1; } +            argv[i] =
> NULL; } -        else +    } + +    for (i = 1; i < argc; i++) +
> { +        if (argv[i]) { WCHAR *DllName = argv[i]; int res = 0;
> 
> The proposed changes work correctly, both with a test DLL and also
> MediaInfo program from the bug.
> 
> Any comments and suggestions are welcome.
> 
> [1] https://bugs.winehq.org/show_bug.cgi?id=38870 
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJVpj5rAAoJEN0/YqbEcdMwB8kP/Agq4+077JKosF1d8Gsjty7V
wzDv7OSAzQpV5eNMWUTKbHH7YzfEwOCQVPoXV89yDvPJR2bXqyu0oZoa8VVcPMl0
0lDjaV4yIeXgUbHL3lNabitZbbyr410rux52cjLLZtn4I32ngmIrshwuKcgvLYCz
/VAQd17B2eCl3/BzG4T+BtGdcxNzKvwEMjYYOYKofeyzmbPo5zkf1Sc54zYxmN7P
8znvGvmQ7mhBRwsQyS/XCdHhIISKr9B6AywIaKHKJWiOp6+cNy6q0pexKYLZyjQQ
a0Q+ujpeyNST/Pro7cm8CnQ2A/ULjGCm/TyVjrxyjVyd7EfM6ScjqGsgg2gJmNT1
mOiA2GwuBtXUiYeBnjtHUEBTlPKHW4LqsCFu7HIHWQrEbTqcXkozqHxL+z/0Do+V
NPOdGfoV2EVhsTD3T69m04pFqEMxdkzbtB6J6njjp2qENI7JTCiZtjBUmn2PGnv3
AV9Hj0SXJjWFpkGCdHDcX6Ida382io6eXL5Y92zw1U9RznEQIdjOmPL/zu7y0YhH
MlCx/yutKY8K34IlbKN2y03ieeFmwVp9r0H6GpN4PqFrEsoPmMPKBxYnmRGImdoc
u8ps+sv5lKafEj8Cs2rEmyBHvOQpNqEDqWrfSeYhRJ0AvtxnQc+IM7CQLLSm7tz8
M0C5Fm41ae6ZfKpwEQ6t
=J+Xu
-----END PGP SIGNATURE-----



More information about the wine-devel mailing list