Re: [v5 03/12] reg.exe: Add REG_MULTI_SZ tests for reg add
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2014-10-17 20:38, schrieb Jonathan Vollebregt:
+ /* REG_MULTI_SZ */ + run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi0 /t REG_MULTI_SZ /d \"three\\0little\\0strings\" /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + memcpy(buffer, "three", 6); + memcpy(buffer+6, "little", 7); + memcpy(buffer+6+7, "strings", 8); + buffer[21] = 0; + verify_reg(hkey, "multi0", REG_MULTI_SZ, buffer, 22, TODO_REG_SIZE); I think this shoudl work as well: const char buffer[] = "three\0little\0strings\0";
verify_reg(hkey, "multi0", REG_MULTI_SZ, buffer, sizeof(buffer), TODO_REG_SIZE); Notice the [] to declare an array so sizeof returns the proper value. strlen will not work.
+ run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"#randomgibberish\" /d \"three#little#strings\" /f", &r); + todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"\" /d \"three#little#strings\" /f", &r); + todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"##\" /f", &r); + todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"two##strings\" /f", &r); + todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"#a\" /f", &r); + todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); What about the following cases?
/s ABC /d threeABClittleABCstrings /s \\0 /d three\\0little\\0strings -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJURR9NAAoJEN0/YqbEcdMw/6UP/Rs7diy+TUkZDbJq2x3JyZYZ c+YK2Z9PoWNs3oTvwvVtaxrVqSX1y0fVnGEpNixGEMbo5fae7/rm9fN5WqvI+1FW RWG0ViCpJ4EduNVhORtHmMGzhqQAAGlfuEF0fthSshynaD8MirwPMW5LzBVTK/A8 zhI0wvveQElhscEoYtaZOkuI5WZzzKnjGpuGtserx31B41ClASEpR/MiU4XJD78p OvqaPotzlbQermrte9B+ZWcxjjVyrsM2fToVbXMNhtBDyDy17uG1Lpr8lQrXL85J uFYpVFiYoRf7CCHrhY2Gx8H7AsHwc8W0LDlnvlIKk6yRWnzyQuSzQJVbFNzBAy9u wBlQ6kZjMJzvaGCk9el5MXiwgN6Vs2bHa3j/8qvrzQyaGNebiZA7QLaXUXOqXpb6 De6/ev8iyTD1cyFwVootQBAsb40HKBk24ZwmP0sp+j3seJUlzR37ve/R71avexWL uheZ9Xj5xeBm0G3JJQ3C0cxUYo+f22t9gDLbKtOa+5BcRskjtmgHjEHEzZs33T8F BcXhGtAyL99XwXh73ILHg321pjkTu1sWzd9ILigVz6mYmOJzZp/L4Azy6E3W/U7j GHkT46Ag7/aUN4BTR5MieySdFtAQ9pbdYI1FRMBINie2Ny9AC71UrDYtFpNQuzaN C4BbMES4ZXNJQuGSHs33 =iJxu -----END PGP SIGNATURE-----
On 10/20/2014 04:42 PM, Stefan Dösinger wrote:
I think this shoudl work as well: const char buffer[] = "three\0little\0strings\0";
Then I'd get:
warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
I could assign it at the start of the reg_add function but that seems a bit out of place and since the REG_BINARY tests reuse the buffer it's easier to have it non-const. However, this did give me the idea of using:
memcpy(buffer, "three\0little\0strings\0", 22);
What about the following cases?
/s ABC /d threeABClittleABCstrings /s \\0 /d three\\0little\\0strings
If the separator is more than one character native reg returns 1, though I haven't tested for the second case.
If you want to print the expected value I'd prefer something like this:
todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS);
I'll change my patches to this. Should I expand the commit to change the existing tests as well?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2014-10-20 17:14, schrieb Jonathan Vollebregt:
I could assign it at the start of the reg_add function but that seems a bit out of place and since the REG_BINARY tests reuse the buffer it's easier to have it non-const.
However, this did give me the idea of using:
memcpy(buffer, "three\0little\0strings\0", 22); That would work. IMHO using separate variables that are declared in a way that don't need magic sizes is nicer, but I'll leave this up to you. And I don't know what Alexandre prefers either way.
What about the following cases?
/s ABC /d threeABClittleABCstrings /s \\0 /d three\\0little\\0strings
If the separator is more than one character native reg returns 1, though I haven't tested for the second case. Afaics your tests don't distinguish between the case that the separator is more than one character and the case that the separator does not occur in the input value.
In other words, this needs another test: /s # /d onebigstring
todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS);
I'll change my patches to this. Should I expand the commit to change the existing tests as well? Yes please.
Thanks again for your work! Stefan -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJURSkTAAoJEN0/YqbEcdMwVMoP/0gbpxwXp+bWlYxLp0yGX1W2 1yYMxEh092R7izh3XZ2pOLNvcX6snHSwlYbVz6VTGr2P1NHBg7hJAwwvCl849wYG IHKpzUT9C1lFq3pRcb0U24pyvpD+Puh1icPTIoilXv5BNJtM0MdtQH5KEo7Oph+k dDApEPH6uGB/3n29UO1KKGUO5pkpWMjq4hQHYbGFLrn+93VzPxW7oJHA88yl3vEt vIpO01v7+TT+e2Hi6qicLneu/sP3b10mT0Ce98euaaoUSN7BiLm32AL3jusCoRrZ zLXSluSR6cus6lcQ9iukiVIdMLywRIlReco0t5aGTrenPFFhoSh6CsyH9ADszDKL rel87y2gz9IPhYBMAZw7E6yhzvG76QSEg9Rmjz6NjlOKEl5auwYIm4nkcbbP3io6 JPxD6yP/tlbLvSmGHthe0uLtSrC2PxTsoa6UGGCYltOVbw75I3T7fODr/AR3FXOR zr2DdteVNkBALVLMkNC0lb7/U4pqxw9PIaMA+lrIo4SXqyQi8ASJGmZGX4mNr7k/ 0FnXFt6SEoAKd5NZTtbPV1wnPPCktmXuP3Jb3EMVrtQptStATcbSr5BzEI6hj6vG hc1+8J/gpHFr5yVx7DGS0bU5xe3AeQNbNSZ2hQjQqQYRQi9bXNny9xn3O6bWJvo1 HWcNdAKQqrwYDrFGr4Dc =XBnk -----END PGP SIGNATURE-----
participants (2)
-
Jonathan Vollebregt -
Stefan Dösinger