import.c 174 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606
  1. /*
  2. * Copyright 2016-2018, 2021 Hugh McMaster
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  17. */
  18. #include "reg_test.h"
  19. static BOOL write_file(const void *str, DWORD size)
  20. {
  21. HANDLE file;
  22. BOOL ret;
  23. DWORD written;
  24. file = CreateFileA("test.reg", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
  25. FILE_ATTRIBUTE_NORMAL, NULL);
  26. ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
  27. if (file == INVALID_HANDLE_VALUE)
  28. return FALSE;
  29. ret = WriteFile(file, str, size, &written, NULL);
  30. ok(ret, "WriteFile failed: %u\n", GetLastError());
  31. CloseHandle(file);
  32. return ret;
  33. }
  34. BOOL import_reg(const char *file, unsigned line, const char *contents, BOOL unicode, DWORD *rc)
  35. {
  36. int lenA;
  37. BOOL ret;
  38. lenA = strlen(contents);
  39. if (unicode)
  40. {
  41. int len = MultiByteToWideChar(CP_UTF8, 0, contents, lenA, NULL, 0);
  42. int size = len * sizeof(WCHAR);
  43. WCHAR *wstr = HeapAlloc(GetProcessHeap(), 0, size);
  44. if (!wstr) return FALSE;
  45. MultiByteToWideChar(CP_UTF8, 0, contents, lenA, wstr, len);
  46. ret = write_file(wstr, size);
  47. HeapFree(GetProcessHeap(), 0, wstr);
  48. }
  49. else
  50. ret = write_file(contents, lenA);
  51. if (!ret) return FALSE;
  52. run_reg_exe("reg import test.reg", rc);
  53. ret = DeleteFileA("test.reg");
  54. lok(ret, "DeleteFile failed: %u\n", GetLastError());
  55. return ret;
  56. }
  57. /* Unit tests */
  58. static void test_import(void)
  59. {
  60. DWORD r, dword = 0x123, type, size;
  61. char buffer[24];
  62. HKEY hkey, subkey = NULL;
  63. LONG err;
  64. BYTE hex[8];
  65. delete_tree(HKEY_CURRENT_USER, KEY_BASE);
  66. verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE);
  67. run_reg_exe("reg import", &r);
  68. ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
  69. run_reg_exe("reg import /?", &r);
  70. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  71. run_reg_exe("reg import /h", &r);
  72. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  73. run_reg_exe("reg import -H", &r);
  74. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  75. run_reg_exe("reg import missing.reg", &r);
  76. ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
  77. run_reg_exe("reg import a.reg b.reg", &r);
  78. ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
  79. /* Test file contents */
  80. test_import_str("regedit\n", &r);
  81. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  82. "got exit code %d, expected 1\n", r);
  83. test_import_str("regedit4\n", &r);
  84. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  85. "got exit code %d, expected 1\n", r);
  86. test_import_str("REGEDIT", &r);
  87. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  88. test_import_str("REGEDIT\n", &r);
  89. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  90. test_import_str("REGEDIT4\n", &r);
  91. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  92. test_import_str(" REGEDIT4\n", &r);
  93. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  94. test_import_str("\tREGEDIT4\n", &r);
  95. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  96. test_import_str("\nREGEDIT4\n", &r);
  97. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  98. "got exit code %d, expected 1\n", r);
  99. test_import_str("AREGEDIT4\n", &r);
  100. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  101. "got exit code %d, expected 1\n", r);
  102. test_import_str("1REGEDIT4\n", &r);
  103. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  104. "got exit code %d, expected 1\n", r);
  105. test_import_str("REGEDIT3\n", &r);
  106. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  107. test_import_str("REGEDIT5\n", &r);
  108. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  109. test_import_str("REGEDIT9\n", &r);
  110. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  111. test_import_str("REGEDIT 4\n", &r);
  112. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  113. test_import_str("REGEDIT4 FOO\n", &r);
  114. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  115. test_import_str("REGEDIT4\n"
  116. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n", &r);
  117. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  118. open_key(HKEY_CURRENT_USER, KEY_BASE, KEY_SET_VALUE, &hkey);
  119. test_import_str("REGEDIT4\n"
  120. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  121. "\"Wine\"=dword:00000123\n\n", &r);
  122. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  123. verify_reg(hkey, "Wine", REG_DWORD, &dword, sizeof(dword), 0);
  124. test_import_str("REGEDIT4\n"
  125. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  126. "@=\"Test string\"\n\n", &r);
  127. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  128. verify_reg(hkey, NULL, REG_SZ, "Test string", 12, 0);
  129. test_import_str("REGEDIT3\n\n"
  130. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  131. "\"Test1\"=\"Value\"\n", &r);
  132. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  133. verify_reg_nonexist(hkey, "Test1");
  134. test_import_str("regedit4\n\n"
  135. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  136. "\"Test2\"=\"Value\"\n", &r);
  137. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  138. "got exit code %d, expected 1\n", r);
  139. verify_reg_nonexist(hkey, "Test2");
  140. test_import_str("Regedit4\n\n"
  141. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  142. "\"Test3\"=\"Value\"\n", &r);
  143. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  144. "got exit code %d, expected 1\n", r);
  145. verify_reg_nonexist(hkey, "Test3");
  146. test_import_str("REGEDIT 4\n\n"
  147. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  148. "\"Test4\"=\"Value\"\n", &r);
  149. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  150. verify_reg_nonexist(hkey, "Test4");
  151. test_import_str("REGEDIT4FOO\n\n"
  152. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  153. "\"Test5\"=\"Value\"\n", &r);
  154. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  155. verify_reg_nonexist(hkey, "Test5");
  156. test_import_str("REGEDIT4 FOO\n\n"
  157. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  158. "\"Test6\"=\"Value\"\n", &r);
  159. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  160. verify_reg_nonexist(hkey, "Test6");
  161. test_import_str("REGEDIT5\n\n"
  162. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  163. "\"Test7\"=\"Value\"\n", &r);
  164. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  165. verify_reg_nonexist(hkey, "Test7");
  166. test_import_str("REGEDIT9\n\n"
  167. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  168. "\"Test8\"=\"Value\"\n", &r);
  169. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  170. verify_reg_nonexist(hkey, "Test8");
  171. test_import_str("Windows Registry Editor Version 4.00\n\n"
  172. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  173. "\"Test9\"=\"Value\"\n", &r);
  174. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  175. "got exit code %d, expected 1\n", r);
  176. verify_reg_nonexist(hkey, "Test9");
  177. test_import_str("Windows Registry Editor Version 5\n\n"
  178. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  179. "\"Test10\"=\"Value\"\n", &r);
  180. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  181. "got exit code %d, expected 1\n", r);
  182. verify_reg_nonexist(hkey, "Test10");
  183. test_import_str("WINDOWS REGISTRY EDITOR VERSION 5.00\n\n"
  184. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  185. "\"Test11\"=\"Value\"\n", &r);
  186. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  187. "got exit code %d, expected 1\n", r);
  188. verify_reg_nonexist(hkey, "Test11");
  189. test_import_str("Windows Registry Editor version 5.00\n\n"
  190. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  191. "\"Test12\"=\"Value\"\n", &r);
  192. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  193. "got exit code %d, expected 1\n", r);
  194. verify_reg_nonexist(hkey, "Test12");
  195. test_import_str("REGEDIT4\n"
  196. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  197. "\"Test1\"=\"Value1\"\n", &r);
  198. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  199. verify_reg(hkey, "Test1", REG_SZ, "Value1", 7, 0);
  200. test_import_str("REGEDIT4\n"
  201. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  202. "\"Test2\"=\"Value2\"\n\n", &r);
  203. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  204. verify_reg(hkey, "Test2", REG_SZ, "Value2", 7, 0);
  205. test_import_str("REGEDIT4\n\n"
  206. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  207. "\"Test3\"=\"Value3\"\n\n", &r);
  208. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  209. verify_reg(hkey, "Test3", REG_SZ, "Value3", 7, 0);
  210. test_import_str("Windows Registry Editor Version 4.00\n", &r);
  211. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  212. "got exit code %d, expected 1\n", r);
  213. test_import_str("Windows Registry Editor Version 5.00\n", &r);
  214. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  215. test_import_str("Windows Registry Editor Version 5.00\n"
  216. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  217. "\"Test4\"=\"Value4\"\n", &r);
  218. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  219. verify_reg(hkey, "Test4", REG_SZ, "Value4", 7, 0);
  220. test_import_str("Windows Registry Editor Version 5.00\n"
  221. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  222. "\"Test5\"=\"Value5\"\n\n", &r);
  223. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  224. verify_reg(hkey, "Test5", REG_SZ, "Value5", 7, 0);
  225. test_import_str("Windows Registry Editor Version 5.00\n\n"
  226. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  227. "\"Test6\"=\"Value6\"\n\n", &r);
  228. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  229. verify_reg(hkey, "Test6", REG_SZ, "Value6", 7, 0);
  230. test_import_str("REGEDIT4\n\n"
  231. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  232. "\"Line1\"=\"Value1\"\n\n"
  233. "\"Line2\"=\"Value2\"\n\n\n"
  234. "\"Line3\"=\"Value3\"\n\n\n\n"
  235. "\"Line4\"=\"Value4\"\n\n", &r);
  236. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  237. verify_reg(hkey, "Line1", REG_SZ, "Value1", 7, 0);
  238. verify_reg(hkey, "Line2", REG_SZ, "Value2", 7, 0);
  239. verify_reg(hkey, "Line3", REG_SZ, "Value3", 7, 0);
  240. verify_reg(hkey, "Line4", REG_SZ, "Value4", 7, 0);
  241. test_import_str("REGEDIT4\n\n"
  242. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  243. "\"Wine1\"=dword:00000782\n\n"
  244. "\"Wine2\"=\"Test Value\"\n"
  245. "\"Wine3\"=hex(7):4c,69,6e,65,20,\\\n"
  246. " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
  247. "#comment\n"
  248. "@=\"Test\"\n"
  249. ";comment\n\n"
  250. "\"Wine4\"=dword:12345678\n\n", &r);
  251. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  252. dword = 0x782;
  253. verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword), 0);
  254. verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0);
  255. verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  256. verify_reg(hkey, "", REG_SZ, "Test", 5, 0);
  257. dword = 0x12345678;
  258. verify_reg(hkey, "Wine4", REG_DWORD, &dword, sizeof(dword), 0);
  259. test_import_str("REGEDIT4\n\n"
  260. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  261. "\"Wine5\"=\"No newline\"", &r);
  262. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  263. err = RegQueryValueExA(hkey, "Wine5", NULL, NULL, NULL, NULL);
  264. ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */),
  265. "got exit code %d, expected 0\n", err);
  266. if (err == ERROR_SUCCESS)
  267. verify_reg(hkey, "Wine5", REG_SZ, "No newline", 11, 0);
  268. test_import_str("REGEDIT4\n\n"
  269. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  270. "\"Wine6\"=dword:00000050\n\n"
  271. "\"Wine7\"=\"No newline\"", &r);
  272. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  273. dword = 0x50;
  274. verify_reg(hkey, "Wine6", REG_DWORD, &dword, sizeof(dword), 0);
  275. err = RegQueryValueExA(hkey, "Wine7", NULL, NULL, NULL, NULL);
  276. ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */),
  277. "got exit code %d, expected 0\n", err);
  278. if (err == ERROR_SUCCESS)
  279. verify_reg(hkey, "Wine7", REG_SZ, "No newline", 11, 0);
  280. test_import_str("REGEDIT4\n\n"
  281. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  282. "#comment\\\n"
  283. "\"Wine8\"=\"Line 1\"\n"
  284. ";comment\\\n"
  285. "\"Wine9\"=\"Line 2\"\n\n", &r);
  286. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  287. verify_reg(hkey, "Wine8", REG_SZ, "Line 1", 7, 0);
  288. verify_reg(hkey, "Wine9", REG_SZ, "Line 2", 7, 0);
  289. test_import_str("REGEDIT4\n\n"
  290. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  291. "\"Wine10\"=\"Value 1\"#comment\n"
  292. "\"Wine11\"=\"Value 2\";comment\n"
  293. "\"Wine12\"=dword:01020304 #comment\n"
  294. "\"Wine13\"=dword:02040608 ;comment\n\n", &r);
  295. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  296. verify_reg_nonexist(hkey, "Wine10");
  297. verify_reg(hkey, "Wine11", REG_SZ, "Value 2", 8, 0);
  298. verify_reg_nonexist(hkey, "Wine12");
  299. dword = 0x2040608;
  300. verify_reg(hkey, "Wine13", REG_DWORD, &dword, sizeof(dword), 0);
  301. test_import_str("REGEDIT4\n\n"
  302. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  303. "\"Wine14\"=hex(7):4c,69,6e,65,20,\\\n"
  304. " #comment\n"
  305. " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
  306. "\"Wine15\"=\"A valid line\"\n"
  307. "\"Wine16\"=hex(7):4c,69,6e,65,20,\\\n"
  308. " ;comment\n"
  309. " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
  310. "\"Wine17\"=\"Another valid line\"\n\n", &r);
  311. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  312. verify_reg_nonexist(hkey, "Wine14");
  313. verify_reg(hkey, "Wine15", REG_SZ, "A valid line", 13, 0);
  314. verify_reg(hkey, "Wine16", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  315. verify_reg(hkey, "Wine17", REG_SZ, "Another valid line", 19, 0);
  316. test_import_str("REGEDIT4\n\n"
  317. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  318. "#\"Comment1\"=\"Value 1\"\n"
  319. ";\"Comment2\"=\"Value 2\"\n"
  320. " #\"Comment3\"=\"Value 3\"\n"
  321. " ;\"Comment4\"=\"Value 4\"\n"
  322. "\"Wine18\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n"
  323. "\"Wine19\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n", &r);
  324. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  325. verify_reg_nonexist(hkey, "Comment1");
  326. verify_reg_nonexist(hkey, "Comment2");
  327. verify_reg_nonexist(hkey, "Comment3");
  328. verify_reg_nonexist(hkey, "Comment4");
  329. verify_reg_nonexist(hkey, "Wine18");
  330. verify_reg_nonexist(hkey, "Comment5");
  331. verify_reg(hkey, "Wine19", REG_SZ, "Value 7", 8, 0);
  332. verify_reg_nonexist(hkey, "Comment6");
  333. test_import_str("REGEDIT4\n\n"
  334. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  335. "\"Wine20\"=#\"Value 8\"\n"
  336. "\"Wine21\"=;\"Value 9\"\n"
  337. "\"Wine22\"=\"#comment1\"\n"
  338. "\"Wine23\"=\";comment2\"\n"
  339. "\"Wine24\"=\"Value#comment3\"\n"
  340. "\"Wine25\"=\"Value;comment4\"\n"
  341. "\"Wine26\"=\"Value #comment5\"\n"
  342. "\"Wine27\"=\"Value ;comment6\"\n"
  343. "\"Wine28\"=#dword:00000001\n"
  344. "\"Wine29\"=;dword:00000002\n"
  345. "\"Wine30\"=dword:00000003#comment\n"
  346. "\"Wine31\"=dword:00000004;comment\n\n", &r);
  347. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  348. verify_reg_nonexist(hkey, "Wine20");
  349. verify_reg_nonexist(hkey, "Wine21");
  350. verify_reg(hkey, "Wine22", REG_SZ, "#comment1", 10, 0);
  351. verify_reg(hkey, "Wine23", REG_SZ, ";comment2", 10, 0);
  352. verify_reg(hkey, "Wine24", REG_SZ, "Value#comment3", 15, 0);
  353. verify_reg(hkey, "Wine25", REG_SZ, "Value;comment4", 15, 0);
  354. verify_reg(hkey, "Wine26", REG_SZ, "Value #comment5", 16, 0);
  355. verify_reg(hkey, "Wine27", REG_SZ, "Value ;comment6", 16, 0);
  356. verify_reg_nonexist(hkey, "Wine28");
  357. verify_reg_nonexist(hkey, "Wine29");
  358. verify_reg_nonexist(hkey, "Wine30");
  359. dword = 0x00000004;
  360. verify_reg(hkey, "Wine31", REG_DWORD, &dword, sizeof(dword), 0);
  361. test_import_str("REGEDIT4\n\n"
  362. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  363. "\"Multi-Line1\"=hex(7):4c,69,6e,65,20,\\\n"
  364. " 63,6f,6e,\\;comment\n"
  365. " 63,61,74,\\;comment\n"
  366. " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  367. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  368. verify_reg(hkey, "Multi-Line1", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  369. test_import_str("REGEDIT4\n\n"
  370. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  371. "\"Multi-Line2\"=hex(7):4c,69,6e,65,20,\\\n"
  372. " 63,6f,6e,\\;comment\n"
  373. " 63,61,74,;comment\n"
  374. " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  375. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  376. verify_reg(hkey, "Multi-Line2", REG_MULTI_SZ, "Line concat", 12, 0);
  377. test_import_str("REGEDIT4\n\n"
  378. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  379. "\"Multi-Line3\"=hex(7):4c,69,6e,65,20\\\n"
  380. ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  381. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  382. verify_reg_nonexist(hkey, "Multi-Line3");
  383. test_import_str("REGEDIT4\n\n"
  384. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  385. "\"Multi-Line4\"=hex(7):4c,69,6e,65,20\\\n"
  386. " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  387. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  388. verify_reg_nonexist(hkey, "Multi-Line4");
  389. test_import_str("Windows Registry Editor Version 5.00\n\n"
  390. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  391. "\"Multi-Line5\"=hex(7):4c,69,6e,65,20\\\n"
  392. ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  393. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  394. verify_reg_nonexist(hkey, "Multi-Line5");
  395. test_import_str("Windows Registry Editor Version 5.00\n\n"
  396. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  397. "\"Multi-Line6\"=hex(7):4c,69,6e,65,20\\\n"
  398. " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  399. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  400. verify_reg_nonexist(hkey, "Multi-Line6");
  401. test_import_str("REGEDIT4\n\n"
  402. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  403. "\"Multi-Line7\"=hex(7):4c,69,6e,\\;comment\n"
  404. " 65,20,\\;comment\n"
  405. " 63,6f,6e,\\;comment\n"
  406. " 63,61,74,\\;comment\n"
  407. " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  408. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  409. verify_reg(hkey, "Multi-Line7", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  410. test_import_str("REGEDIT4\n\n"
  411. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  412. "\"Multi-Line8\"=hex(7):4c,69,6e,\\;#comment\n"
  413. " 65,20,\\;#comment\n"
  414. " 63,6f,6e,\\;#comment\n"
  415. " 63,61,74,\\;#comment\n"
  416. " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  417. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  418. verify_reg(hkey, "Multi-Line8", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  419. test_import_str("REGEDIT4\n\n"
  420. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  421. "\"Multi-Line9\"=hex(7):4c,69,6e,\\;comment\n"
  422. " 65,20,\\;comment\n"
  423. " 63,6f,6e,\\;comment\n"
  424. " 63,61,74,\\#comment\n"
  425. " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  426. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  427. verify_reg_nonexist(hkey, "Multi-Line9");
  428. test_import_str("REGEDIT4\n\n"
  429. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  430. "\"Multi-Line10\"=hex(7):4c,69,6e,65,20,\\\n"
  431. " 63,6f,6e,\\;comment\n"
  432. " 63,61,74,\\\n\n"
  433. " 65,6e,\\;comment\n\n"
  434. " 61,74,69,6f,6e,00,00\n\n", &r);
  435. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  436. verify_reg(hkey, "Multi-Line10", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  437. test_import_str("REGEDIT4\n\n"
  438. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  439. "\"Wine32a\"=dword:1\n"
  440. "\"Wine32b\"=dword:4444\n\n", &r);
  441. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  442. dword = 0x1;
  443. verify_reg(hkey, "Wine32a", REG_DWORD, &dword, sizeof(dword), 0);
  444. dword = 0x4444;
  445. verify_reg(hkey, "Wine32b", REG_DWORD, &dword, sizeof(dword), 0);
  446. test_import_str("REGEDIT4\n\n"
  447. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  448. "\"Wine33a\"=dword:\n"
  449. "\"Wine33b\"=dword:hello\n"
  450. "\"Wine33c\"=dword:123456789\n"
  451. "\"Wine33d\"=dword:012345678\n"
  452. "\"Wine33e\"=dword:000000001\n\n", &r);
  453. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  454. verify_reg_nonexist(hkey, "Wine33a");
  455. verify_reg_nonexist(hkey, "Wine33b");
  456. verify_reg_nonexist(hkey, "Wine33c");
  457. verify_reg_nonexist(hkey, "Wine33d");
  458. verify_reg_nonexist(hkey, "Wine33e");
  459. test_import_str("REGEDIT4\n\n"
  460. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  461. "\"Wine34a\"=dword:12345678abc\n"
  462. "\"Wine34b\"=dword:12345678 abc\n\n", &r);
  463. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  464. verify_reg_nonexist(hkey, "Wine34a");
  465. verify_reg_nonexist(hkey, "Wine34b");
  466. test_import_str("REGEDIT4\n\n"
  467. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  468. "\"Wine35a\"=dword:0x123\n"
  469. "\"Wine35b\"=dword:123 456\n"
  470. "\"Wine35c\"=dword:1234 5678\n\n", &r);
  471. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  472. verify_reg_nonexist(hkey, "Wine35a");
  473. verify_reg_nonexist(hkey, "Wine35b");
  474. verify_reg_nonexist(hkey, "Wine35c");
  475. test_import_str("REGEDIT4\n\n"
  476. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  477. "\"Wine36a\"=dword:1234;5678\n"
  478. "\"Wine36b\"=dword:1234 ;5678\n"
  479. "\"Wine36c\"=dword:1234#5678\n"
  480. "\"Wine36d\"=dword:1234 #5678\n\n", &r);
  481. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  482. dword = 0x1234;
  483. verify_reg(hkey, "Wine36a", REG_DWORD, &dword, sizeof(dword), 0);
  484. verify_reg(hkey, "Wine36b", REG_DWORD, &dword, sizeof(dword), 0);
  485. verify_reg_nonexist(hkey, "Wine36c");
  486. verify_reg_nonexist(hkey, "Wine36d");
  487. test_import_str("REGEDIT4\n\n"
  488. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  489. "\"Wine37a\"=\"foo\"bar\"\n"
  490. "\"Wine37b\"=\"foo\"\"bar\"\n\n", &r);
  491. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  492. verify_reg_nonexist(hkey, "Wine37a");
  493. verify_reg_nonexist(hkey, "Wine37b");
  494. test_import_str("REGEDIT4\n\n"
  495. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  496. "\"Empty string\"=\"\"\n"
  497. "\"\"=\"Default Value Name\"\n\n", &r);
  498. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  499. verify_reg(hkey, "Empty string", REG_SZ, "", 1, 0);
  500. verify_reg(hkey, NULL, REG_SZ, "Default Value Name", 19, 0);
  501. test_import_str("REGEDIT4\n\n"
  502. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  503. "\"Test38a\"=\n"
  504. "\"Test38b\"=\\\"\n"
  505. "\"Test38c\"=\\\"Value\\\"\n"
  506. "\"Test38d\"=\\\"Value\"\n\n", &r);
  507. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  508. verify_reg_nonexist(hkey, "Test38a");
  509. verify_reg_nonexist(hkey, "Test38b");
  510. verify_reg_nonexist(hkey, "Test38c");
  511. verify_reg_nonexist(hkey, "Test38d");
  512. test_import_str("REGEDIT4\n\n"
  513. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  514. "\"Wine39a\"=\"Value1\" ;comment\n"
  515. "\"Wine39b\"=\"Value2\"\t\t;comment\n"
  516. "\"Wine39c\"=\"Value3\" #comment\n"
  517. "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r);
  518. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  519. verify_reg(hkey, "Wine39a", REG_SZ, "Value1", 7, 0);
  520. verify_reg(hkey, "Wine39b", REG_SZ, "Value2", 7, 0);
  521. verify_reg_nonexist(hkey, "Wine39c");
  522. verify_reg_nonexist(hkey, "Wine39d");
  523. test_import_str("REGEDIT4\n\n"
  524. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  525. "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r);
  526. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  527. verify_reg_nonexist(hkey, "TestNoBeginQuote");
  528. test_import_str("REGEDIT4\n\n"
  529. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  530. "\"TestNoEndQuote\"=\"Asdffdsa\n", &r);
  531. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  532. verify_reg_nonexist(hkey, "TestNoEndQuote");
  533. test_import_str("REGEDIT4\n\n"
  534. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  535. "\"TestNoQuotes\"=Asdffdsa\n", &r);
  536. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  537. verify_reg_nonexist(hkey, "TestNoQuotes");
  538. test_import_str("REGEDIT4\n\n"
  539. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  540. "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r);
  541. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  542. verify_reg_nonexist(hkey, "NameNoBeginQuote");
  543. test_import_str("REGEDIT4\n\n"
  544. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  545. "\"NameNoEndQuote=\"Asdffdsa\"\n", &r);
  546. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  547. verify_reg_nonexist(hkey, "NameNoEndQuote");
  548. test_import_str("REGEDIT4\n\n"
  549. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  550. "NameNoQuotes=\"Asdffdsa\"\n", &r);
  551. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  552. verify_reg_nonexist(hkey, "NameNoQuotes");
  553. test_import_str("REGEDIT4\n\n"
  554. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  555. "\"MixedQuotes=Asdffdsa\"\n", &r);
  556. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  557. verify_reg_nonexist(hkey, "MixedQuotes");
  558. verify_reg_nonexist(hkey, "MixedQuotes=Asdffdsa");
  559. test_import_str("REGEDIT4\n\n"
  560. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  561. "\"Wine40a\"=hex(2):4c,69,6e,65,00\n"
  562. "\"Wine40b\"=\"Value 1\"\n"
  563. "\"Wine40c\"=hex(2):4c,69,6e,65\\\n"
  564. "\"Wine40d\"=\"Value 2\"\n"
  565. "\"Wine40e\"=hex(2):4c,69,6e,65,\\\n"
  566. "\"Wine40f\"=\"Value 3\"\n"
  567. "\"Wine40g\"=\"Value 4\"\n\n", &r);
  568. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  569. verify_reg(hkey, "Wine40a", REG_EXPAND_SZ, "Line", 5, 0);
  570. verify_reg(hkey, "Wine40b", REG_SZ, "Value 1", 8, 0);
  571. verify_reg_nonexist(hkey, "Wine40c");
  572. verify_reg(hkey, "Wine40d", REG_SZ, "Value 2", 8, 0);
  573. verify_reg_nonexist(hkey, "Wine40e");
  574. verify_reg_nonexist(hkey, "Wine40f");
  575. verify_reg(hkey, "Wine40g", REG_SZ, "Value 4", 8, 0);
  576. test_import_str("REGEDIT4\n\n"
  577. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  578. "\"Wine41a\"=dword:1234\\\n"
  579. "5678\n"
  580. "\"Wine41b\"=\"Test \\\n"
  581. "Value\"\n\n", &r);
  582. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  583. verify_reg_nonexist(hkey, "Wine41a");
  584. verify_reg_nonexist(hkey, "Wine41b");
  585. test_import_str("REGEDIT4\n\n"
  586. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  587. "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n"
  588. "\"single'quote\"=dword:00000008\n\n", &r);
  589. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  590. verify_reg(hkey, "double\"quote", REG_SZ, "valid \"or\" not", 15, 0);
  591. dword = 0x00000008;
  592. verify_reg(hkey, "single'quote", REG_DWORD, &dword, sizeof(dword), 0);
  593. /* Test key name and value name concatenation */
  594. test_import_str("REGEDIT4\n\n"
  595. "[HKEY_CURRENT_USER\\" KEY_BASE "\\\n"
  596. "Subkey1]\n", &r);
  597. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  598. verify_key_nonexist(hkey, "Subkey1");
  599. test_import_str("REGEDIT4\n\n"
  600. "[HKEY_CURRENT_USER\\" KEY_BASE "\n"
  601. "\\Subkey2]\n", &r);
  602. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  603. verify_key_nonexist(hkey, "Subkey2");
  604. test_import_str("REGEDIT4\n\n"
  605. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  606. "\"Wine\\\n"
  607. "42a\"=\"Value 1\"\n"
  608. "\"Wine42b\"=\"Value 2\"\n"
  609. "\"Wine\n"
  610. "\\42c\"=\"Value 3\"\n\n", &r);
  611. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  612. verify_reg_nonexist(hkey, "Wine42a");
  613. verify_reg(hkey, "Wine42b", REG_SZ, "Value 2", 8, 0);
  614. verify_reg_nonexist(hkey, "Wine42c");
  615. /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */
  616. test_import_str("REGEDIT4\n\n"
  617. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  618. "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n"
  619. "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n"
  620. " 75,00,65,00,00,00\n"
  621. "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n"
  622. ",75,00,65,00,00,00\n"
  623. "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n"
  624. " ,75,00,65,00,00,00\n"
  625. "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n"
  626. " 75,00,65,00,00,00\n"
  627. "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n"
  628. "5,00,65,00,00,00\n"
  629. "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n"
  630. " 5,00,65,00,00,00\n"
  631. "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n"
  632. " 6c,00,75,00,\\\n"
  633. " 65,00,00,00\n"
  634. "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n"
  635. " 6c,00,75,00,\n"
  636. " 65,00,00,00\n"
  637. "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n"
  638. " 6c,00,75,00,;comment\n"
  639. " 65,00,00,00\n"
  640. "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n"
  641. " 6c,00,75,00,\\#comment\n"
  642. " 65,00,00,00\n\n", &r);
  643. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  644. verify_reg(hkey, "Wine43a", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
  645. verify_reg(hkey, "Wine43b", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
  646. verify_reg_nonexist(hkey, "Wine43c");
  647. verify_reg_nonexist(hkey, "Wine43d");
  648. verify_reg_nonexist(hkey, "Wine43e");
  649. verify_reg_nonexist(hkey, "Wine43f");
  650. verify_reg_nonexist(hkey, "Wine43g");
  651. verify_reg(hkey, "Wine43h", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
  652. verify_reg(hkey, "Wine43i", REG_NONE, "V\0a\0l\0u", 8, 0);
  653. verify_reg(hkey, "Wine43j", REG_NONE, "V\0a\0l\0u", 8, 0);
  654. verify_reg_nonexist(hkey, "Wine43k");
  655. test_import_str("REGEDIT4\n\n"
  656. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  657. "\"Wine44a\"=hex(2):25,50,41,54,48,25,00\n"
  658. "\"Wine44b\"=hex(2):25,50,41,\\\n"
  659. " 54,48,25,00\n"
  660. "\"Wine44c\"=hex(2):25,50,41\\\n"
  661. ",54,48,25,00\n"
  662. "\"Wine44d\"=hex(2):25,50,41\\\n"
  663. " ,54,48,25,00\n"
  664. "\"Wine44e\"=hex(2):25,50,41\\\n"
  665. " 54,48,25,00\n"
  666. "\"Wine44f\"=hex(2):25,50,4\\\n"
  667. "1,54,48,25,00\n"
  668. "\"Wine44g\"=hex(2):25,50,4\\\n"
  669. " 1,54,48,25,00\n"
  670. "\"Wine44h\"=hex(2):25,50,41,\\;comment\n"
  671. " 54,48,\\\n"
  672. " 25,00\n"
  673. "\"Wine44i\"=hex(2):25,50,41,\\;comment\n"
  674. " 54,48,\n"
  675. " 25,00\n"
  676. "\"Wine44j\"=hex(2):25,50,41,\\;comment\n"
  677. " 54,48,;comment\n"
  678. " 25,00\n"
  679. "\"Wine44k\"=hex(2):25,50,41,\\;comment\n"
  680. " 54,48,\\#comment\n"
  681. " 25,00\n\n", &r);
  682. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  683. verify_reg(hkey, "Wine44a", REG_EXPAND_SZ, "%PATH%", 7, 0);
  684. verify_reg(hkey, "Wine44b", REG_EXPAND_SZ, "%PATH%", 7, 0);
  685. verify_reg_nonexist(hkey, "Wine44c");
  686. verify_reg_nonexist(hkey, "Wine44d");
  687. verify_reg_nonexist(hkey, "Wine44e");
  688. verify_reg_nonexist(hkey, "Wine44f");
  689. verify_reg_nonexist(hkey, "Wine44g");
  690. verify_reg(hkey, "Wine44h", REG_EXPAND_SZ, "%PATH%", 7, 0);
  691. /* Wine44i */
  692. size = sizeof(buffer);
  693. err = RegQueryValueExA(hkey, "Wine44i", NULL, &type, (BYTE *)&buffer, &size);
  694. ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err);
  695. ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ);
  696. ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size);
  697. ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
  698. /* Wine44j */
  699. size = sizeof(buffer);
  700. memset(buffer, '-', size);
  701. err = RegQueryValueExA(hkey, "Wine44j", NULL, &type, (BYTE *)&buffer, &size);
  702. ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err);
  703. ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ);
  704. ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size);
  705. ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
  706. /* Wine44k */
  707. verify_reg_nonexist(hkey, "Wine44k");
  708. test_import_str("REGEDIT4\n\n"
  709. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  710. "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n"
  711. "\"Wine45b\"=hex:11,22,33,44,\\\n"
  712. " 55,66,77,88\n"
  713. "\"Wine45c\"=hex:11,22,33,44\\\n"
  714. ",55,66,77,88\n"
  715. "\"Wine45d\"=hex:11,22,33,44\\\n"
  716. " ,55,66,77,88\n"
  717. "\"Wine45e\"=hex:11,22,33,44\\\n"
  718. " 55,66,77,88\n"
  719. "\"Wine45f\"=hex:11,22,33,4\\\n"
  720. "4,55,66,77,88\n"
  721. "\"Wine45g\"=hex:11,22,33,4\\\n"
  722. " 4,55,66,77,88\n"
  723. "\"Wine45h\"=hex:11,22,33,44,\\;comment\n"
  724. " 55,66,\\\n"
  725. " 77,88\n"
  726. "\"Wine45i\"=hex:11,22,33,44,\\;comment\n"
  727. " 55,66,\n"
  728. " 77,88\n"
  729. "\"Wine45j\"=hex:11,22,33,44,\\;comment\n"
  730. " 55,66,;comment\n"
  731. " 77,88\n"
  732. "\"Wine45k\"=hex:11,22,33,\\;comment\n"
  733. " 44,55,66,\\#comment\n"
  734. " 77,88\n\n", &r);
  735. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  736. hex[0] = 0x11; hex[1] = 0x22; hex[2] = 0x33; hex[3] = 0x44;
  737. hex[4] = 0x55; hex[5] = 0x66; hex[6] = 0x77; hex[7] = 0x88;
  738. verify_reg(hkey, "Wine45a", REG_BINARY, hex, sizeof(hex), 0);
  739. verify_reg(hkey, "Wine45b", REG_BINARY, hex, sizeof(hex), 0);
  740. verify_reg_nonexist(hkey, "Wine45c");
  741. verify_reg_nonexist(hkey, "Wine45d");
  742. verify_reg_nonexist(hkey, "Wine45e");
  743. verify_reg_nonexist(hkey, "Wine45f");
  744. verify_reg_nonexist(hkey, "Wine45g");
  745. verify_reg(hkey, "Wine45h", REG_BINARY, hex, sizeof(hex), 0);
  746. verify_reg(hkey, "Wine45i", REG_BINARY, hex, 6, 0);
  747. verify_reg(hkey, "Wine45j", REG_BINARY, hex, 6, 0);
  748. verify_reg_nonexist(hkey, "Wine45k");
  749. /* Test import with subkeys */
  750. test_import_str("REGEDIT4\n\n"
  751. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey\"1]\n"
  752. "\"Wine\\\\31\"=\"Test value\"\n\n", &r);
  753. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  754. open_key(hkey, "Subkey\"1", 0, &subkey);
  755. verify_reg(subkey, "Wine\\31", REG_SZ, "Test value", 11, 0);
  756. close_key(subkey);
  757. delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey\"1");
  758. test_import_str("REGEDIT4\n\n"
  759. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey/2]\n"
  760. "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r);
  761. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  762. open_key(hkey, "Subkey/2", 0, &subkey);
  763. verify_reg(subkey, "123/\"4;'5", REG_SZ, "Random value name", 18, 0);
  764. close_key(subkey);
  765. delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey/2");
  766. /* Test key creation */
  767. test_import_str("REGEDIT4\n\n"
  768. "HKEY_CURRENT_USER\\" KEY_BASE "\\No_Opening_Bracket]\n", &r);
  769. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  770. verify_key_nonexist(hkey, "No_Opening_Bracket");
  771. test_import_str("REGEDIT4\n\n"
  772. "[HKEY_CURRENT_USER\\" KEY_BASE "\\No_Closing_Bracket\n", &r);
  773. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  774. verify_key_nonexist(hkey, "No_Closing_Bracket");
  775. test_import_str("REGEDIT4\n\n"
  776. "[ HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1a]\n", &r);
  777. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  778. verify_key_nonexist(hkey, "Subkey1a");
  779. test_import_str("REGEDIT4\n\n"
  780. "[\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1b]\n", &r);
  781. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  782. verify_key_nonexist(hkey, "Subkey1b");
  783. test_import_str("REGEDIT4\n\n"
  784. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1c ]\n", &r);
  785. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  786. verify_key(hkey, "Subkey1c ");
  787. delete_key(hkey, "Subkey1c ");
  788. test_import_str("REGEDIT4\n\n"
  789. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1d\t]\n", &r);
  790. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  791. verify_key(hkey, "Subkey1d\t");
  792. delete_key(hkey, "Subkey1d\t");
  793. test_import_str("REGEDIT4\n\n"
  794. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1e\\]\n"
  795. "\"Wine\"=\"Test value\"\n\n", &r);
  796. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  797. verify_key(hkey, "Subkey1e\\");
  798. verify_key(hkey, "Subkey1e");
  799. open_key(hkey, "Subkey1e", 0, &subkey);
  800. verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0);
  801. close_key(subkey);
  802. delete_key(hkey, "Subkey1e");
  803. test_import_str("REGEDIT4\n\n"
  804. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1f\\\\]\n"
  805. "\"Wine\"=\"Test value\"\n\n", &r);
  806. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  807. verify_key(hkey, "Subkey1f\\\\");
  808. verify_key(hkey, "Subkey1f\\");
  809. verify_key(hkey, "Subkey1f");
  810. open_key(hkey, "Subkey1f\\\\", 0, &subkey);
  811. verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0);
  812. close_key(subkey);
  813. delete_key(hkey, "Subkey1f\\\\");
  814. test_import_str("REGEDIT4\n\n"
  815. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1g\\\\\\\\]\n"
  816. "\"Wine\"=\"Test value\"\n\n", &r);
  817. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  818. verify_key(hkey, "Subkey1g\\\\\\\\");
  819. verify_key(hkey, "Subkey1g\\\\");
  820. verify_key(hkey, "Subkey1g\\");
  821. verify_key(hkey, "Subkey1g");
  822. open_key(hkey, "Subkey1g\\\\", 0, &subkey);
  823. verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0);
  824. close_key(subkey);
  825. delete_key(hkey, "Subkey1g\\\\");
  826. /* Test key deletion. We start by creating some registry keys. */
  827. test_import_str("REGEDIT4\n\n"
  828. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n"
  829. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r);
  830. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  831. verify_key(hkey, "Subkey2a");
  832. verify_key(hkey, "Subkey2b");
  833. test_import_str("REGEDIT4\n\n"
  834. "[ -HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r);
  835. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  836. verify_key(hkey, "Subkey2a");
  837. test_import_str("REGEDIT4\n\n"
  838. "[\t-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r);
  839. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  840. verify_key(hkey, "Subkey2b");
  841. test_import_str("REGEDIT4\n\n"
  842. "[- HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r);
  843. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  844. verify_key(hkey, "Subkey2a");
  845. test_import_str("REGEDIT4\n\n"
  846. "[-\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r);
  847. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  848. verify_key(hkey, "Subkey2b");
  849. test_import_str("REGEDIT4\n\n"
  850. "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n"
  851. "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r);
  852. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  853. verify_key_nonexist(hkey, "Subkey2a");
  854. verify_key_nonexist(hkey, "Subkey2b");
  855. /* Test case sensitivity when creating and deleting registry keys. */
  856. test_import_str("REGEDIT4\n\n"
  857. "[hkey_CURRENT_user\\" KEY_BASE "\\Subkey3a]\n\n"
  858. "[HkEy_CuRrEnT_uSeR\\" KEY_BASE "\\SuBkEy3b]\n\n", &r);
  859. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  860. verify_key(hkey, "Subkey3a");
  861. verify_key(hkey, "Subkey3b");
  862. test_import_str("REGEDIT4\n\n"
  863. "[-HKEY_current_USER\\" KEY_BASE "\\sUBKEY3A]\n\n"
  864. "[-hKeY_cUrReNt_UsEr\\" KEY_BASE "\\sUbKeY3B]\n\n", &r);
  865. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  866. verify_key_nonexist(hkey, "Subkey3a");
  867. verify_key_nonexist(hkey, "Subkey3b");
  868. /* Test mixed key creation and deletion. We start by creating a subkey. */
  869. test_import_str("REGEDIT4\n\n"
  870. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n\n", &r);
  871. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  872. verify_key(hkey, "Subkey4a");
  873. test_import_str("REGEDIT4\n\n"
  874. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n"
  875. "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n"
  876. "\"Wine46a\"=dword:12345678\n\n", &r);
  877. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  878. verify_key_nonexist(hkey, "Subkey4a");
  879. verify_reg_nonexist(hkey, "Wine46a");
  880. test_import_str("REGEDIT4\n\n"
  881. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n"
  882. "[HKEY_CURRENT_USERS\\" KEY_BASE "\\Subkey4b]\n"
  883. "\"Wine46b\"=dword:12345678\n\n", &r);
  884. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  885. verify_key_nonexist(hkey, "Subkey4b");
  886. verify_reg_nonexist(hkey, "Wine46b");
  887. /* Test value deletion. We start by creating some registry values. */
  888. test_import_str("REGEDIT4\n\n"
  889. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  890. "\"Wine46a\"=\"Test Value\"\n"
  891. "\"Wine46b\"=dword:00000008\n"
  892. "\"Wine46c\"=hex:11,22,33,44\n"
  893. "\"Wine46d\"=hex(7):4c,69,6e,65,20,\\\n"
  894. " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
  895. "\"Wine46e\"=hex(2):25,50,41,54,48,25,00\n"
  896. "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r);
  897. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  898. verify_reg(hkey, "Wine46a", REG_SZ, "Test Value", 11, 0);
  899. verify_reg(hkey, "Wine46b", REG_DWORD, &dword, sizeof(dword), 0);
  900. verify_reg(hkey, "Wine46c", REG_BINARY, hex, 4, 0);
  901. verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  902. verify_reg(hkey, "Wine46e", REG_EXPAND_SZ, "%PATH%", 7, 0);
  903. verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
  904. test_import_str("REGEDIT4\n\n"
  905. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  906. "\"Wine46a\"=-\n"
  907. "\"Wine46b\"= -\n"
  908. "\"Wine46c\"= \t-\t \n"
  909. "\"Wine46d\"=-\"Test\"\n"
  910. "\"Wine46e\"=- ;comment\n"
  911. "\"Wine46f\"=- #comment\n\n", &r);
  912. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  913. verify_reg_nonexist(hkey, "Wine46a");
  914. verify_reg_nonexist(hkey, "Wine46b");
  915. verify_reg_nonexist(hkey, "Wine46c");
  916. verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  917. verify_reg_nonexist(hkey, "Wine46e");
  918. verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
  919. /* Test the accepted range of the hex-based data types */
  920. test_import_str("REGEDIT4\n\n"
  921. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  922. "\"Wine47a\"=hex(0):56,61,6c,75,65,00\n"
  923. "\"Wine47b\"=hex(10):56,61,6c,75,65,00\n"
  924. "\"Wine47c\"=hex(100):56,61,6c,75,65,00\n"
  925. "\"Wine47d\"=hex(1000):56,61,6c,75,65,00\n"
  926. "\"Wine47e\"=hex(7fff):56,61,6c,75,65,00\n"
  927. "\"Wine47f\"=hex(ffff):56,61,6c,75,65,00\n"
  928. "\"Wine47g\"=hex(7fffffff):56,61,6c,75,65,00\n"
  929. "\"Wine47h\"=hex(ffffffff):56,61,6c,75,65,00\n"
  930. "\"Wine47i\"=hex(100000000):56,61,6c,75,65,00\n"
  931. "\"Wine47j\"=hex(0x2):56,61,6c,75,65,00\n"
  932. "\"Wine47k\"=hex(0X2):56,61,6c,75,65,00\n"
  933. "\"Wine47l\"=hex(x2):56,61,6c,75,65,00\n\n", &r);
  934. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  935. verify_reg(hkey, "Wine47a", REG_NONE, "Value", 6, 0);
  936. verify_reg(hkey, "Wine47b", 0x10, "Value", 6, 0);
  937. verify_reg(hkey, "Wine47c", 0x100, "Value", 6, 0);
  938. verify_reg(hkey, "Wine47d", 0x1000, "Value", 6, 0);
  939. verify_reg(hkey, "Wine47e", 0x7fff, "Value", 6, 0);
  940. verify_reg(hkey, "Wine47f", 0xffff, "Value", 6, 0);
  941. verify_reg(hkey, "Wine47g", 0x7fffffff, "Value", 6, 0);
  942. verify_reg(hkey, "Wine47h", 0xffffffff, "Value", 6, 0);
  943. verify_reg_nonexist(hkey, "Wine47i");
  944. verify_reg_nonexist(hkey, "Wine47j");
  945. verify_reg_nonexist(hkey, "Wine47k");
  946. verify_reg_nonexist(hkey, "Wine47l");
  947. test_import_str("REGEDIT4\n\n"
  948. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  949. "\"Wine48a\"=hex(7):4c,69,6e,65,20, \\\n"
  950. " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
  951. "\"Wine48b\"=hex(7):4c,69,6e,65,20,\t\\\n"
  952. " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  953. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  954. verify_reg(hkey, "Wine48a", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  955. verify_reg(hkey, "Wine48b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  956. test_import_str("REGEDIT4\n\n"
  957. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  958. "\"Wine49\"=hex(2):25,50,41,54,48,25,00,\n\n", &r);
  959. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  960. verify_reg(hkey, "Wine49", REG_EXPAND_SZ, "%PATH%", 7, 0);
  961. test_import_str("REGEDIT4\n\n"
  962. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  963. "\"Wine50a\"=hex(2):25,50,41,54,48,25,00 ;comment\n"
  964. "\"Wine50b\"=hex(2):25,50,41,54,48,25,00\t;comment\n"
  965. "\"Wine50c\"=hex(2):25,50,41,54,48,25,00 #comment\n"
  966. "\"Wine50d\"=hex(2):25,50,41,54,48,25,00\t#comment\n\n", &r);
  967. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  968. verify_reg(hkey, "Wine50a", REG_EXPAND_SZ, "%PATH%", 7, 0);
  969. verify_reg(hkey, "Wine50b", REG_EXPAND_SZ, "%PATH%", 7, 0);
  970. verify_reg_nonexist(hkey, "Wine50c");
  971. verify_reg_nonexist(hkey, "Wine50d");
  972. /* Test support for characters greater than 0xff */
  973. test_import_str("REGEDIT4\n\n"
  974. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  975. "\"Wine51a\"=hex(0):25,50,100,54,48,25,00\n"
  976. "\"Wine51b\"=hex(0):25,1a4,100,164,124,25,00\n\n", &r);
  977. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  978. verify_reg_nonexist(hkey, "Wine51a");
  979. verify_reg_nonexist(hkey, "Wine51b");
  980. /* Test the effect of backslashes in hex data */
  981. test_import_str("REGEDIT4\n\n"
  982. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  983. "\"Wine52a\"=hex(2):25,48\\,4f,4d,45,25,00\n"
  984. "\"Wine52b\"=hex(2):25,48,\\4f,4d,45,25,00\n"
  985. "\"Wine52c\"=hex(2):25,48\\ ,4f,4d,45,25,00\n"
  986. "\"Wine52d\"=hex(2):25,48,\\ 4f,4d,45,25,00\n"
  987. "\"Wine52e\"=hex(2):\\25,48,4f,4d,45,25,00\n"
  988. "\"Wine52f\"=hex(2):\\ 25,48,4f,4d,45,25,00\n"
  989. "\"Wine52g\"=hex(2):25,48,4\\f,4d,45,25,00\n"
  990. "\"Wine52h\"=hex(2):25,48,4\\\n"
  991. " f,4d,45,25,00\n"
  992. "\"Wine52i\"=hex(2):25,50,\\,41,54,48,25,00\n"
  993. "\"Wine52j\"=hex(2):25,48,4f,4d,45,25,5c,\\\\\n"
  994. " 25,50,41,54,48,25,00\n"
  995. "\"Wine52k\"=hex(2):,\\\n"
  996. " 25,48,4f,4d,45,25,00\n"
  997. "\"Wine52l\"=hex(2):\\\n"
  998. " 25,48,4f,4d,45,25,00\n\n", &r);
  999. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1000. verify_reg_nonexist(hkey, "Wine52a");
  1001. verify_reg_nonexist(hkey, "Wine52b");
  1002. verify_reg_nonexist(hkey, "Wine52c");
  1003. verify_reg_nonexist(hkey, "Wine52d");
  1004. verify_reg_nonexist(hkey, "Wine52e");
  1005. verify_reg_nonexist(hkey, "Wine52f");
  1006. verify_reg_nonexist(hkey, "Wine52g");
  1007. verify_reg_nonexist(hkey, "Wine52h");
  1008. verify_reg_nonexist(hkey, "Wine52i");
  1009. verify_reg_nonexist(hkey, "Wine52j");
  1010. verify_reg_nonexist(hkey, "Wine52k");
  1011. verify_reg(hkey, "Wine52l", REG_EXPAND_SZ, "%HOME%", 7, 0);
  1012. test_import_str("REGEDIT4\n\n"
  1013. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1014. "\"Wine53a\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
  1015. " 25,50,41,54,48,25,00\n"
  1016. "\"Wine53b\"=hex(2):25,48,4f,4d,45,25,5c\\\n"
  1017. " 25,50,41,54,48,25,00\n"
  1018. "\"Wine53c\"=hex(2):25,48,4f,4d,45,25,5c, \\ ;comment\n"
  1019. " 25,50,41,54,48,25,00\n"
  1020. "\"Wine53d\"=hex(2):25,48,4f,4d,45,25,5c \\ ;comment\n"
  1021. " 25,50,41,54,48,25,00\n"
  1022. "\"Wine53e\"=hex(2):25,48,4f,4d,45,25,5c,\\\t ;comment\n"
  1023. " 25,50,41,54,48,25,00\n"
  1024. "\"Wine53f\"=hex(2):25,48,4f,4d,45,25,5c\\\t ;comment\n"
  1025. " 25,50,41,54,48,25,00\n\n", &r);
  1026. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1027. verify_reg(hkey, "Wine53a", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0);
  1028. verify_reg_nonexist(hkey, "Wine53b");
  1029. verify_reg(hkey, "Wine53c", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0);
  1030. verify_reg_nonexist(hkey, "Wine53d");
  1031. verify_reg(hkey, "Wine53e", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0);
  1032. verify_reg_nonexist(hkey, "Wine53f");
  1033. test_import_str("REGEDIT4\n\n"
  1034. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1035. "\"Wine54a\"=hex(2):4c,69,6e,65,20,\\\n"
  1036. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\n", &r);
  1037. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1038. verify_reg_nonexist(hkey, "Wine54a");
  1039. verify_key_nonexist(hkey, "Subkey1");
  1040. test_import_str("REGEDIT4\n\n"
  1041. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1042. "\"Wine54b\"=hex(2):4c,69,6e,65,20\\\n"
  1043. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2]\n", &r);
  1044. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1045. verify_reg_nonexist(hkey, "Wine54b");
  1046. verify_key(hkey, "Subkey2");
  1047. delete_key(hkey, "Subkey2");
  1048. test_import_str("REGEDIT4\n\n"
  1049. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1050. "\"Wine55a\"=hex(2):4c,69,6e,65,20,\\\n"
  1051. "\"Wine55b\"=\"Test value\"\n"
  1052. "\"Wine55c\"=hex(2):4c,69,6e,65,20,\\\n"
  1053. ";comment\n"
  1054. "\"Wine55d\"=\"Test value\"\n"
  1055. "\"Wine55e\"=hex(2):4c,69,6e,65,20,\\\n"
  1056. "#comment\n"
  1057. "\"Wine55f\"=\"Test value\"\n"
  1058. "\"Wine55g\"=hex(2):4c,69,6e,65,20,\\\n\n"
  1059. "\"Wine55h\"=\"Test value\"\n"
  1060. "\"Wine55i\"=hex(2):4c,69,6e,65,20\\\n"
  1061. "\"Wine55j\"=\"Test value\"\n\n", &r);
  1062. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1063. verify_reg_nonexist(hkey, "Wine55a");
  1064. verify_reg_nonexist(hkey, "Wine55b");
  1065. verify_reg_nonexist(hkey, "Wine55c");
  1066. verify_reg_nonexist(hkey, "Wine55d");
  1067. verify_reg_nonexist(hkey, "Wine55e");
  1068. verify_reg(hkey, "Wine55f", REG_SZ, "Test value", 11, 0);
  1069. verify_reg_nonexist(hkey, "Wine55g");
  1070. verify_reg_nonexist(hkey, "Wine55h");
  1071. verify_reg_nonexist(hkey, "Wine55i");
  1072. verify_reg(hkey, "Wine55j", REG_SZ, "Test value", 11, 0);
  1073. test_import_str("REGEDIT4\n\n"
  1074. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1075. "\"Wine56a\"=hex(2):4c,69,6e,65,20,\\\n"
  1076. "\"Wine56b\"=dword:00000008\n"
  1077. "\"Wine56c\"=hex(2):4c,69,6e,65,20,\\\n"
  1078. ";comment\n"
  1079. "\"Wine56d\"=dword:00000008\n"
  1080. "\"Wine56e\"=hex(2):4c,69,6e,65,20,\\\n"
  1081. "#comment\n"
  1082. "\"Wine56f\"=dword:00000008\n"
  1083. "\"Wine56g\"=hex(2):4c,69,6e,65,20,\\\n\n"
  1084. "\"Wine56h\"=dword:00000008\n"
  1085. "\"Wine56i\"=hex(2):4c,69,6e,65,20\\\n"
  1086. "\"Wine56j\"=dword:00000008\n\n", &r);
  1087. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1088. verify_reg_nonexist(hkey, "Wine56a");
  1089. verify_reg_nonexist(hkey, "Wine56b");
  1090. verify_reg_nonexist(hkey, "Wine56c");
  1091. verify_reg_nonexist(hkey, "Wine56d");
  1092. verify_reg_nonexist(hkey, "Wine56e");
  1093. verify_reg(hkey, "Wine56f", REG_DWORD, &dword, sizeof(dword), 0);
  1094. verify_reg_nonexist(hkey, "Wine56g");
  1095. verify_reg_nonexist(hkey, "Wine56h");
  1096. verify_reg_nonexist(hkey, "Wine56i");
  1097. verify_reg(hkey, "Wine56j", REG_DWORD, &dword, sizeof(dword), 0);
  1098. test_import_str("REGEDIT4\n\n"
  1099. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1100. "\"Wine57a\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
  1101. "\"Wine57b\"=hex(2):25,50,41,54,48,25,00\n"
  1102. "\"Wine57c\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
  1103. ";comment\n"
  1104. "\"Wine57d\"=hex(2):25,50,41,54,48,25,00\n"
  1105. "\"Wine57e\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
  1106. "#comment\n"
  1107. "\"Wine57f\"=hex(2):25,50,41,54,48,25,00\n"
  1108. "\"Wine57g\"=hex(2):25,48,4f,4d,45,25,5c,\\\n\n"
  1109. "\"Wine57h\"=hex(2):25,50,41,54,48,25,00\n"
  1110. "\"Wine57i\"=hex(2):25,48,4f,4d,45,25,5c\\\n"
  1111. "\"Wine57j\"=hex(2):25,50,41,54,48,25,00\n\n", &r);
  1112. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1113. verify_reg_nonexist(hkey, "Wine57a");
  1114. verify_reg_nonexist(hkey, "Wine57b");
  1115. verify_reg_nonexist(hkey, "Wine57c");
  1116. verify_reg_nonexist(hkey, "Wine57d");
  1117. verify_reg_nonexist(hkey, "Wine57e");
  1118. verify_reg(hkey, "Wine57f", REG_EXPAND_SZ, "%PATH%", 7, 0);
  1119. verify_reg_nonexist(hkey, "Wine57g");
  1120. verify_reg_nonexist(hkey, "Wine57h");
  1121. verify_reg_nonexist(hkey, "Wine57i");
  1122. verify_reg(hkey, "Wine57j", REG_EXPAND_SZ, "%PATH%", 7, 0);
  1123. delete_value(hkey, NULL);
  1124. test_import_str("REGEDIT4\n\n"
  1125. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1126. "\"Wine58a\"=hex(2):4c,69,6e,65,20,\\\n"
  1127. "@=\"Default value 1\"\n\n", &r);
  1128. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1129. verify_reg_nonexist(hkey, "Wine58a");
  1130. verify_reg_nonexist(hkey, NULL);
  1131. test_import_str("REGEDIT4\n\n"
  1132. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1133. "\"Wine58b\"=hex(2):4c,69,6e,65,20,\\\n"
  1134. ";comment\n"
  1135. "@=\"Default value 2\"\n\n", &r);
  1136. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1137. verify_reg_nonexist(hkey, "Wine58b");
  1138. verify_reg_nonexist(hkey, NULL);
  1139. test_import_str("REGEDIT4\n\n"
  1140. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1141. "\"Wine58c\"=hex(2):4c,69,6e,65,20,\\\n"
  1142. "#comment\n"
  1143. "@=\"Default value 3\"\n\n", &r);
  1144. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1145. verify_reg_nonexist(hkey, "Wine58c");
  1146. verify_reg(hkey, NULL, REG_SZ, "Default value 3", 16, 0);
  1147. delete_value(hkey, NULL);
  1148. test_import_str("REGEDIT4\n\n"
  1149. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1150. "\"Wine58d\"=hex(2):4c,69,6e,65,20,\\\n\n"
  1151. "@=\"Default value 4\"\n\n", &r);
  1152. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1153. verify_reg_nonexist(hkey, "Wine58d");
  1154. verify_reg_nonexist(hkey, NULL);
  1155. test_import_str("REGEDIT4\n\n"
  1156. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1157. "\"Wine58e\"=hex(2):4c,69,6e,65,20\\\n"
  1158. "@=\"Default value 5\"\n\n", &r);
  1159. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1160. verify_reg_nonexist(hkey, "Wine58e");
  1161. verify_reg(hkey, NULL, REG_SZ, "Default value 5", 16, 0);
  1162. test_import_str("REGEDIT4\n\n"
  1163. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1164. "\"Wine59a\"=hex:11,22,33,\\\n"
  1165. "\\\n"
  1166. " 44,55,66\n"
  1167. "\"Wine59b\"=hex:11,22,33,\\\n"
  1168. " \\\n"
  1169. " 44,55,66\n\n", &r);
  1170. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1171. verify_reg_nonexist(hkey, "Wine59a");
  1172. verify_reg_nonexist(hkey, "Wine59b");
  1173. test_import_str("REGEDIT4\n\n"
  1174. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1175. "\"Wine60a\"=hex(7):4c,69,6e,65,20,\\\n"
  1176. " 63,6f,6e,63,61,74,\\\n"
  1177. ";comment\n"
  1178. " 65,6e,\\;comment\n"
  1179. " 61,74,69,6f,6e,00,00\n\n", &r);
  1180. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1181. verify_reg(hkey, "Wine60a", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  1182. test_import_str("REGEDIT4\n\n"
  1183. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1184. "\"Wine60b\"=hex(7):4c,69,6e,65,20,\\\n"
  1185. " 63,6f,6e,63,61,74,\\\n"
  1186. " ;comment\n"
  1187. " 65,6e,\\;comment\n"
  1188. " 61,74,69,6f,6e,00,00\n\n", &r);
  1189. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1190. verify_reg(hkey, "Wine60b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  1191. test_import_str("REGEDIT4\n\n"
  1192. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1193. "\"Wine60c\"=hex(7):4c,69,6e,65,20,\\\n"
  1194. " 63,6f,6e,63,61,74,\\\n"
  1195. "#comment\n"
  1196. " 65,6e,\\;comment\n"
  1197. " 61,74,69,6f,6e,00,00\n\n", &r);
  1198. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1199. verify_reg_nonexist(hkey, "Wine60c");
  1200. test_import_str("REGEDIT4\n\n"
  1201. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1202. "\"Wine60d\"=hex(7):4c,69,6e,65,20,\\\n"
  1203. " 63,6f,6e,63,61,74,\\\n"
  1204. " #comment\n"
  1205. " 65,6e,\\;comment\n"
  1206. " 61,74,69,6f,6e,00,00\n\n", &r);
  1207. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1208. verify_reg_nonexist(hkey, "Wine60d");
  1209. test_import_str("REGEDIT4\n\n"
  1210. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1211. "\"Wine60e\"=hex(7):4c,69,6e,65,20,\\\n"
  1212. " 63,6f,6e,\\\n\n"
  1213. " 63,61,74,\\\n\n\n"
  1214. " 65,6e,\\\n\n\n\n"
  1215. " 61,74,69,6f,6e,00,00\n\n", &r);
  1216. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1217. verify_reg(hkey, "Wine60e", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  1218. test_import_str("REGEDIT4\n\n"
  1219. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1220. "\"Wine60f\"=hex(7):4c,69,6e,65,20,\\\n"
  1221. " 63,6f,6e,\\\n \n"
  1222. " 63,61,74,\\\n\t\n\t\n"
  1223. " 65,6e,\\\n\t \t\n\t \t\n\t \t\n"
  1224. " 61,74,69,6f,6e,00,00\n\n", &r);
  1225. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1226. verify_reg(hkey, "Wine60f", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  1227. test_import_str("REGEDIT4\n\n"
  1228. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1229. "\"Wine61a\"=hex(0):25,48,4f,4d,45,25,5c,/\n"
  1230. " 25,50,41,54,48,25,00\n"
  1231. "\"Wine61b\"=hex(0):25,48,4f,4d,45,25,5c/\n"
  1232. " 25,50,41,54,48,25,00\n\n", &r);
  1233. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1234. verify_reg_nonexist(hkey, "Wine61a");
  1235. verify_reg_nonexist(hkey, "Wine61b");
  1236. test_import_str("REGEDIT4\n\n"
  1237. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1238. "\"Wine62a\"=hex(0):56,61,6c,75,65,\\", &r);
  1239. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1240. err = RegQueryValueExA(hkey, "Wine62a", NULL, NULL, NULL, NULL);
  1241. ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
  1242. "got exit code %d, expected 0\n", err);
  1243. if (err == ERROR_SUCCESS)
  1244. verify_reg(hkey, "Wine62a", REG_NONE, "Value", 5, 0);
  1245. test_import_str("REGEDIT4\n\n"
  1246. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1247. "\"Wine62b\"=hex(2):25,50,41,54,48,25,\\", &r);
  1248. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1249. err = RegQueryValueExA(hkey, "Wine62b", NULL, NULL, NULL, NULL);
  1250. ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
  1251. "got exit code %d, expected 0\n", err);
  1252. if (err == ERROR_SUCCESS)
  1253. verify_reg(hkey, "Wine62b", REG_EXPAND_SZ, "%PATH%", 7, 0);
  1254. test_import_str("REGEDIT4\n\n"
  1255. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1256. "\"Wine62c\"=hex:11,22,33,44,55,\\", &r);
  1257. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1258. err = RegQueryValueExA(hkey, "Wine62c", NULL, NULL, NULL, NULL);
  1259. ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
  1260. "got exit code %d, expected 0\n", err);
  1261. if (err == ERROR_SUCCESS)
  1262. verify_reg(hkey, "Wine62c", REG_BINARY, hex, 5, 0);
  1263. test_import_str("REGEDIT4\n\n"
  1264. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1265. "\"Wine62d\"=hex(7):4c,69,6e,65,\\", &r);
  1266. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1267. err = RegQueryValueExA(hkey, "Wine62d", NULL, NULL, NULL, NULL);
  1268. ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
  1269. "got exit code %d, expected 0\n", err);
  1270. if (err == ERROR_SUCCESS)
  1271. verify_reg(hkey, "Wine62d", REG_MULTI_SZ, "Line", 5, 0);
  1272. test_import_str("REGEDIT4\n\n"
  1273. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1274. "\"Wine62e\"=hex(100):56,61,6c,75,65,\\", &r);
  1275. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1276. err = RegQueryValueExA(hkey, "Wine62e", NULL, NULL, NULL, NULL);
  1277. ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
  1278. "got exit code %d, expected 0\n", err);
  1279. if (err == ERROR_SUCCESS)
  1280. verify_reg(hkey, "Wine62e", 0x100, "Value", 5, 0);
  1281. test_import_str("REGEDIT4\n\n"
  1282. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1283. "\"Wine62f\"=hex(7):4c,69,6e,65,20\\", &r);
  1284. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1285. verify_reg_nonexist(hkey, "Wine62f");
  1286. test_import_str("REGEDIT4\n\n"
  1287. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1288. "\"Wine63a\"=hex(7):4c,69,6e,65,20,\\\n"
  1289. " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
  1290. "\"Wine63b\"=hex(7):4c,69,6e,65,20,\\\n"
  1291. " 63,,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  1292. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1293. verify_reg_nonexist(hkey, "Wine63a");
  1294. verify_reg_nonexist(hkey, "Wine63b");
  1295. test_import_str("REGEDIT4\n\n"
  1296. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1297. "\"Wine64a\"=hex(7):4c,69,6e,65,00,00\n"
  1298. "\"Wine64b\"=hex(7):4c,69,6e,65,20,\\\n"
  1299. " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
  1300. "\"Wine64c\"=hex(7):4c,69,6e,65,20,\\;comment\n"
  1301. " 63,6f,6e,63,61,74,\\\n"
  1302. " 65,6e,61,74,69,6f,6e,00,00\n"
  1303. "\"Wine64d\"=hex(7):4c,69,6e,65,20,\\;comment\n"
  1304. " 63,6f,6e,63,61,74,\n"
  1305. " 65,6e,61,74,69,6f,6e,00,00\n"
  1306. "\"Wine64e\"=hex(7):4c,69,6e,65,20,\\\n"
  1307. " 63,6f,6e,63,61,74,;comment\n"
  1308. " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  1309. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1310. verify_reg(hkey, "Wine64a", REG_MULTI_SZ, "Line\0", 6, 0);
  1311. verify_reg(hkey, "Wine64b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  1312. verify_reg(hkey, "Wine64c", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  1313. /* Wine64d */
  1314. size = sizeof(buffer);
  1315. err = RegQueryValueExA(hkey, "Wine64d", NULL, &type, (BYTE *)&buffer, &size);
  1316. ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err);
  1317. ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ);
  1318. ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size);
  1319. ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
  1320. /* Wine64e */
  1321. size = sizeof(buffer);
  1322. err = RegQueryValueExA(hkey, "Wine64e", NULL, &type, (BYTE *)&buffer, &size);
  1323. ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err);
  1324. ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ);
  1325. ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size);
  1326. ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
  1327. test_import_str("REGEDIT4\n\n"
  1328. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1329. "\"Wine65a\"=hex(100):25,50,41,54,48,25,00\n"
  1330. "\"Wine65b\"=hex(100):25,50,41,\\\n"
  1331. " 54,48,25,00\n"
  1332. "\"Wine65c\"=hex(100):25,50,41,\\;comment\n"
  1333. " 54,48,\\\n"
  1334. " 25,00\n"
  1335. "\"Wine65d\"=hex(100):25,50,41,\\;comment\n"
  1336. " 54,48,\n"
  1337. " 25,00\n"
  1338. "\"Wine65e\"=hex(100):25,50,41,\\;comment\n"
  1339. " 54,48,;comment\n"
  1340. " 25,00\n", &r);
  1341. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1342. verify_reg(hkey, "Wine65a", 0x100, "%PATH%", 7, 0);
  1343. verify_reg(hkey, "Wine65b", 0x100, "%PATH%", 7, 0);
  1344. verify_reg(hkey, "Wine65c", 0x100, "%PATH%", 7, 0);
  1345. verify_reg(hkey, "Wine65d", 0x100, "%PATH", 5, 0);
  1346. verify_reg(hkey, "Wine65e", 0x100, "%PATH", 5, 0);
  1347. /* Test null-termination of REG_EXPAND_SZ and REG_MULTI_SZ data*/
  1348. test_import_str("REGEDIT4\n\n"
  1349. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1350. "\"Wine66a\"=hex(7):4c,69,6e,65\n"
  1351. "\"Wine66b\"=hex(7):4c,69,6e,65,\n"
  1352. "\"Wine66c\"=hex(7):4c,69,6e,65,00\n"
  1353. "\"Wine66d\"=hex(7):4c,69,6e,65,00,\n"
  1354. "\"Wine66e\"=hex(7):4c,69,6e,65,00,00\n"
  1355. "\"Wine66f\"=hex(7):4c,69,6e,65,00,00,\n\n", &r);
  1356. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1357. verify_reg(hkey, "Wine66a", REG_MULTI_SZ, "Line", 5, 0);
  1358. verify_reg(hkey, "Wine66b", REG_MULTI_SZ, "Line", 5, 0);
  1359. verify_reg(hkey, "Wine66c", REG_MULTI_SZ, "Line", 5, 0);
  1360. verify_reg(hkey, "Wine66d", REG_MULTI_SZ, "Line", 5, 0);
  1361. verify_reg(hkey, "Wine66e", REG_MULTI_SZ, "Line\0", 6, 0);
  1362. verify_reg(hkey, "Wine66f", REG_MULTI_SZ, "Line\0", 6, 0);
  1363. test_import_str("REGEDIT4\n\n"
  1364. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1365. "\"Wine67a\"=hex(2):25,50,41,54,48,25\n"
  1366. "\"Wine67b\"=hex(2):25,50,41,54,48,25,\n"
  1367. "\"Wine67c\"=hex(2):25,50,41,54,48,25,00\n"
  1368. "\"Wine67d\"=hex(2):25,50,41,54,48,25,00,\n\n", &r);
  1369. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1370. verify_reg(hkey, "Wine67a", REG_EXPAND_SZ, "%PATH%", 7, 0);
  1371. verify_reg(hkey, "Wine67b", REG_EXPAND_SZ, "%PATH%", 7, 0);
  1372. verify_reg(hkey, "Wine67c", REG_EXPAND_SZ, "%PATH%", 7, 0);
  1373. verify_reg(hkey, "Wine67d", REG_EXPAND_SZ, "%PATH%", 7, 0);
  1374. test_import_str("REGEDIT4\n\n"
  1375. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1376. "\"Wine68a\"=hex(1):\n"
  1377. "\"Wine68b\"=hex(2):\n"
  1378. "\"Wine68c\"=hex(3):\n"
  1379. "\"Wine68d\"=hex(4):\n"
  1380. "\"Wine68e\"=hex(7):\n"
  1381. "\"Wine68f\"=hex(100):\n"
  1382. "\"Wine68g\"=hex(abcd):\n"
  1383. "\"Wine68h\"=hex:\n"
  1384. "\"Wine68i\"=hex(0):\n\n", &r);
  1385. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1386. verify_reg(hkey, "Wine68a", REG_SZ, NULL, 0, 0);
  1387. verify_reg(hkey, "Wine68b", REG_EXPAND_SZ, NULL, 0, 0);
  1388. verify_reg(hkey, "Wine68c", REG_BINARY, NULL, 0, 0);
  1389. verify_reg(hkey, "Wine68d", REG_DWORD, NULL, 0, 0);
  1390. verify_reg(hkey, "Wine68e", REG_MULTI_SZ, NULL, 0, 0);
  1391. verify_reg(hkey, "Wine68f", 0x100, NULL, 0, 0);
  1392. verify_reg(hkey, "Wine68g", 0xabcd, NULL, 0, 0);
  1393. verify_reg(hkey, "Wine68h", REG_BINARY, NULL, 0, 0);
  1394. verify_reg(hkey, "Wine68i", REG_NONE, NULL, 0, 0);
  1395. /* Test with escaped null characters */
  1396. test_import_str("REGEDIT4\n\n"
  1397. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1398. "\"Wine69a\"=\"\\\\0\"\n"
  1399. "\"Wine69b\"=\"\\\\0\\\\0\"\n"
  1400. "\"Wine69c\"=\"Value1\\\\0\"\n"
  1401. "\"Wine69d\"=\"Value2\\\\0\\\\0\\\\0\\\\0\"\n"
  1402. "\"Wine69e\"=\"Value3\\\\0Value4\"\n"
  1403. "\"Wine69f\"=\"\\\\0Value5\"\n\n", &r);
  1404. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1405. verify_reg(hkey, "Wine69a", REG_SZ, "\\0", 3, 0);
  1406. verify_reg(hkey, "Wine69b", REG_SZ, "\\0\\0", 5, 0);
  1407. verify_reg(hkey, "Wine69c", REG_SZ, "Value1\\0", 9, 0);
  1408. verify_reg(hkey, "Wine69d", REG_SZ, "Value2\\0\\0\\0\\0", 15, 0);
  1409. verify_reg(hkey, "Wine69e", REG_SZ, "Value3\\0Value4", 15, 0);
  1410. verify_reg(hkey, "Wine69f", REG_SZ, "\\0Value5", 9, 0);
  1411. test_import_str("REGEDIT4\n\n"
  1412. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1413. "\"Wine70a\"=\"\\0\"\n"
  1414. "\"Wine70b\"=\"\\0\\0\"\n"
  1415. "\"Wine70c\"=\"Value1\\0\"\n"
  1416. "\"Wine70d\"=\"Value2\\0\\0\\0\\0\"\n"
  1417. "\"Wine70e\"=\"Value3\\0Value4\"\n"
  1418. "\"Wine70f\"=\"\\0Value5\"\n\n", &r);
  1419. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1420. verify_reg_nonexist(hkey, "Wine70a");
  1421. verify_reg_nonexist(hkey, "Wine70b");
  1422. verify_reg_nonexist(hkey, "Wine70c");
  1423. verify_reg_nonexist(hkey, "Wine70d");
  1424. verify_reg_nonexist(hkey, "Wine70e");
  1425. verify_reg_nonexist(hkey, "Wine70f");
  1426. /* Test forward and back slashes */
  1427. test_import_str("REGEDIT4\n\n"
  1428. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1429. "\"count/up\"=\"one/two/three\"\n"
  1430. "\"\\\\foo\\\\bar\"=\"\"\n\n"
  1431. "[HKEY_CURRENT_USER\\" KEY_BASE "\\https://winehq.org]\n\n", &r);
  1432. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1433. verify_reg(hkey, "count/up", REG_SZ, "one/two/three", 14, 0);
  1434. verify_reg(hkey, "\\foo\\bar", REG_SZ, "", 1, 0);
  1435. verify_key(hkey, "https://winehq.org");
  1436. close_key(hkey);
  1437. delete_tree(HKEY_CURRENT_USER, KEY_BASE);
  1438. }
  1439. static void test_unicode_import(void)
  1440. {
  1441. DWORD r, dword = 0x123, type, size;
  1442. HKEY hkey, subkey;
  1443. LONG err;
  1444. char buffer[24];
  1445. BYTE hex[8];
  1446. delete_tree(HKEY_CURRENT_USER, KEY_BASE);
  1447. verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE);
  1448. test_import_wstr("REGEDIT\n", &r);
  1449. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  1450. "got exit code %d, expected 1\n", r);
  1451. test_import_wstr("REGEDIT4\n", &r);
  1452. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  1453. "got exit code %d, expected 1\n", r);
  1454. test_import_wstr("\xef\xbb\xbfREGEDIT", &r);
  1455. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1456. test_import_wstr("\xef\xbb\xbfREGEDIT\n", &r);
  1457. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1458. test_import_wstr("\xef\xbb\xbfREGEDIT4", &r);
  1459. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1460. test_import_wstr("\xef\xbb\xbfREGEDIT4\n", &r);
  1461. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1462. test_import_wstr("\xef\xbb\xbf REGEDIT4\n", &r);
  1463. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1464. test_import_wstr("\xef\xbb\xbf\tREGEDIT4\n", &r);
  1465. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1466. test_import_wstr("\xef\xbb\xbf\nREGEDIT4\n", &r);
  1467. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  1468. "got exit code %d, expected 1\n", r);
  1469. test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
  1470. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n", &r);
  1471. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1472. open_key(HKEY_CURRENT_USER, KEY_BASE, KEY_SET_VALUE, &hkey);
  1473. test_import_wstr("\xef\xbb\xbfREGEDIT3\n\n"
  1474. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1475. "\"Test1\"=\"Value\"\n", &r);
  1476. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1477. verify_reg_nonexist(hkey, "Test1");
  1478. test_import_wstr("\xef\xbb\xbfregedit4\n\n"
  1479. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1480. "\"Test2\"=\"Value\"\n", &r);
  1481. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  1482. "got exit code %d, expected 1\n", r);
  1483. verify_reg_nonexist(hkey, "Test2");
  1484. test_import_wstr("\xef\xbb\xbfRegedit4\n\n"
  1485. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1486. "\"Test3\"=\"Value\"\n", &r);
  1487. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  1488. "got exit code %d, expected 1\n", r);
  1489. verify_reg_nonexist(hkey, "Test3");
  1490. test_import_wstr("\xef\xbb\xbfREGEDIT 4\n\n"
  1491. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1492. "\"Test4\"=\"Value\"\n", &r);
  1493. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1494. verify_reg_nonexist(hkey, "Test4");
  1495. test_import_wstr("\xef\xbb\xbfREGEDIT4FOO\n\n"
  1496. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1497. "\"Test5\"=\"Value\"\n", &r);
  1498. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1499. verify_reg_nonexist(hkey, "Test5");
  1500. test_import_wstr("\xef\xbb\xbfREGEDIT4 FOO\n\n"
  1501. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1502. "\"Test6\"=\"Value\"\n", &r);
  1503. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1504. verify_reg_nonexist(hkey, "Test6");
  1505. test_import_wstr("\xef\xbb\xbfREGEDIT5\n\n"
  1506. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1507. "\"Test7\"=\"Value\"\n", &r);
  1508. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1509. verify_reg_nonexist(hkey, "Test7");
  1510. test_import_wstr("\xef\xbb\xbfREGEDIT9\n\n"
  1511. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1512. "\"Test8\"=\"Value\"\n", &r);
  1513. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1514. verify_reg_nonexist(hkey, "Test8");
  1515. test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
  1516. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1517. "\"Unicode1\"=\"Value1\"\n", &r);
  1518. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1519. verify_reg(hkey, "Unicode1", REG_SZ, "Value1", 7, 0);
  1520. test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
  1521. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1522. "\"Unicode2\"=\"Value2\"\n\n", &r);
  1523. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1524. verify_reg(hkey, "Unicode2", REG_SZ, "Value2", 7, 0);
  1525. test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
  1526. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1527. "\"Unicode3\"=\"Value3\"\n\n", &r);
  1528. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1529. verify_reg(hkey, "Unicode3", REG_SZ, "Value3", 7, 0);
  1530. test_import_wstr("Windows Registry Editor Version 4.00\n", &r);
  1531. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  1532. "got exit code %d, expected 1\n", r);
  1533. test_import_wstr("Windows Registry Editor Version 5.00\n", &r);
  1534. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  1535. "got exit code %d, expected 1\n", r);
  1536. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n", &r);
  1537. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  1538. "got exit code %d, expected 1\n", r);
  1539. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00", &r);
  1540. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1541. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n", &r);
  1542. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1543. test_import_wstr("\xef\xbb\xbfWINDOWS Registry Editor Version 5.00\n", &r);
  1544. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  1545. "got exit code %d, expected 1\n", r);
  1546. test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n", &r);
  1547. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1548. test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n", &r);
  1549. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1550. test_import_wstr("\xef\xbb\xbf\nWindows Registry Editor Version 5.00\n", &r);
  1551. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  1552. "got exit code %d, expected 1\n", r);
  1553. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 4.00\n\n"
  1554. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1555. "\"Test9\"=\"Value\"\n", &r);
  1556. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  1557. "got exit code %d, expected 1\n", r);
  1558. verify_reg_nonexist(hkey, "Test9");
  1559. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n\n"
  1560. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1561. "\"Test10\"=\"Value\"\n", &r);
  1562. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  1563. "got exit code %d, expected 1\n", r);
  1564. verify_reg_nonexist(hkey, "Test10");
  1565. test_import_wstr("\xef\xbb\xbfWINDOWS REGISTRY EDITOR VERSION 5.00\n\n"
  1566. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1567. "\"Test11\"=\"Value\"\n", &r);
  1568. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  1569. "got exit code %d, expected 1\n", r);
  1570. verify_reg_nonexist(hkey, "Test11");
  1571. test_import_wstr("\xef\xbb\xbfWindows Registry Editor version 5.00\n\n"
  1572. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1573. "\"Test12\"=\"Value\"\n", &r);
  1574. ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
  1575. "got exit code %d, expected 1\n", r);
  1576. verify_reg_nonexist(hkey, "Test12");
  1577. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1578. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1579. "\"Wine\"=dword:00000123\n\n", &r);
  1580. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1581. verify_reg(hkey, "Wine", REG_DWORD, &dword, sizeof(dword), 0);
  1582. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1583. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1584. "@=\"Test string\"\n\n", &r);
  1585. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1586. verify_reg(hkey, NULL, REG_SZ, "Test string", 12, 0);
  1587. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n"
  1588. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1589. "\"Unicode4\"=\"Value4\"\n", &r);
  1590. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1591. verify_reg(hkey, "Unicode4", REG_SZ, "Value4", 7, 0);
  1592. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n"
  1593. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1594. "\"Unicode5\"=\"Value5\"\n\n", &r);
  1595. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1596. verify_reg(hkey, "Unicode5", REG_SZ, "Value5", 7, 0);
  1597. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1598. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1599. "\"Unicode6\"=\"Value6\"\n\n", &r);
  1600. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1601. verify_reg(hkey, "Unicode6", REG_SZ, "Value6", 7, 0);
  1602. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1603. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1604. "\"Line1\"=\"Value1\"\n\n"
  1605. "\"Line2\"=\"Value2\"\n\n\n"
  1606. "\"Line3\"=\"Value3\"\n\n\n\n"
  1607. "\"Line4\"=\"Value4\"\n\n", &r);
  1608. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1609. verify_reg(hkey, "Line1", REG_SZ, "Value1", 7, 0);
  1610. verify_reg(hkey, "Line2", REG_SZ, "Value2", 7, 0);
  1611. verify_reg(hkey, "Line3", REG_SZ, "Value3", 7, 0);
  1612. verify_reg(hkey, "Line4", REG_SZ, "Value4", 7, 0);
  1613. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1614. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1615. "\"Wine1\"=dword:00000782\n\n"
  1616. "\"Wine2\"=\"Test Value\"\n"
  1617. "\"Wine3\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
  1618. " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
  1619. "#comment\n"
  1620. "@=\"Test\"\n"
  1621. ";comment\n\n"
  1622. "\"Wine4\"=dword:12345678\n\n", &r);
  1623. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1624. dword = 0x782;
  1625. verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword), 0);
  1626. verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0);
  1627. verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  1628. verify_reg(hkey, "", REG_SZ, "Test", 5, 0);
  1629. dword = 0x12345678;
  1630. verify_reg(hkey, "Wine4", REG_DWORD, &dword, sizeof(dword), 0);
  1631. test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
  1632. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1633. "\"Wine5\"=\"No newline\"", &r);
  1634. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1635. err = RegQueryValueExA(hkey, "Wine5", NULL, NULL, NULL, NULL);
  1636. ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */),
  1637. "got exit code %d, expected 0\n", err);
  1638. if (err == ERROR_SUCCESS)
  1639. verify_reg(hkey, "Wine5", REG_SZ, "No newline", 11, 0);
  1640. test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
  1641. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1642. "\"Wine6\"=dword:00000050\n\n"
  1643. "\"Wine7\"=\"No newline\"", &r);
  1644. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1645. dword = 0x50;
  1646. verify_reg(hkey, "Wine6", REG_DWORD, &dword, sizeof(dword), 0);
  1647. err = RegQueryValueExA(hkey, "Wine7", NULL, NULL, NULL, NULL);
  1648. ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */),
  1649. "got exit code %d, expected 0\n", err);
  1650. if (err == ERROR_SUCCESS)
  1651. verify_reg(hkey, "Wine7", REG_SZ, "No newline", 11, 0);
  1652. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1653. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1654. "#comment\\\n"
  1655. "\"Wine8\"=\"Line 1\"\n"
  1656. ";comment\\\n"
  1657. "\"Wine9\"=\"Line 2\"\n\n", &r);
  1658. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1659. verify_reg(hkey, "Wine8", REG_SZ, "Line 1", 7, 0);
  1660. verify_reg(hkey, "Wine9", REG_SZ, "Line 2", 7, 0);
  1661. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1662. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1663. "\"Wine10\"=\"Value 1\"#comment\n"
  1664. "\"Wine11\"=\"Value 2\";comment\n"
  1665. "\"Wine12\"=dword:01020304 #comment\n"
  1666. "\"Wine13\"=dword:02040608 ;comment\n\n", &r);
  1667. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1668. verify_reg_nonexist(hkey, "Wine10");
  1669. verify_reg(hkey, "Wine11", REG_SZ, "Value 2", 8, 0);
  1670. verify_reg_nonexist(hkey, "Wine12");
  1671. dword = 0x2040608;
  1672. verify_reg(hkey, "Wine13", REG_DWORD, &dword, sizeof(dword), 0);
  1673. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1674. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1675. "\"Wine14\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
  1676. " #comment\n"
  1677. " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
  1678. "\"Wine15\"=\"A valid line\"\n"
  1679. "\"Wine16\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
  1680. " ;comment\n"
  1681. " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
  1682. "\"Wine17\"=\"Another valid line\"\n\n", &r);
  1683. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1684. verify_reg_nonexist(hkey, "Wine14");
  1685. verify_reg(hkey, "Wine15", REG_SZ, "A valid line", 13, 0);
  1686. verify_reg(hkey, "Wine16", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  1687. verify_reg(hkey, "Wine17", REG_SZ, "Another valid line", 19, 0);
  1688. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1689. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1690. "#\"Comment1\"=\"Value 1\"\n"
  1691. ";\"Comment2\"=\"Value 2\"\n"
  1692. " #\"Comment3\"=\"Value 3\"\n"
  1693. " ;\"Comment4\"=\"Value 4\"\n"
  1694. "\"Wine18\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n"
  1695. "\"Wine19\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n", &r);
  1696. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1697. verify_reg_nonexist(hkey, "Comment1");
  1698. verify_reg_nonexist(hkey, "Comment2");
  1699. verify_reg_nonexist(hkey, "Comment3");
  1700. verify_reg_nonexist(hkey, "Comment4");
  1701. verify_reg_nonexist(hkey, "Wine18");
  1702. verify_reg_nonexist(hkey, "Comment5");
  1703. verify_reg(hkey, "Wine19", REG_SZ, "Value 7", 8, 0);
  1704. verify_reg_nonexist(hkey, "Comment6");
  1705. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1706. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1707. "\"Wine20\"=#\"Value 8\"\n"
  1708. "\"Wine21\"=;\"Value 9\"\n"
  1709. "\"Wine22\"=\"#comment1\"\n"
  1710. "\"Wine23\"=\";comment2\"\n"
  1711. "\"Wine24\"=\"Value#comment3\"\n"
  1712. "\"Wine25\"=\"Value;comment4\"\n"
  1713. "\"Wine26\"=\"Value #comment5\"\n"
  1714. "\"Wine27\"=\"Value ;comment6\"\n"
  1715. "\"Wine28\"=#dword:00000001\n"
  1716. "\"Wine29\"=;dword:00000002\n"
  1717. "\"Wine30\"=dword:00000003#comment\n"
  1718. "\"Wine31\"=dword:00000004;comment\n\n", &r);
  1719. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1720. verify_reg_nonexist(hkey, "Wine20");
  1721. verify_reg_nonexist(hkey, "Wine21");
  1722. verify_reg(hkey, "Wine22", REG_SZ, "#comment1", 10, 0);
  1723. verify_reg(hkey, "Wine23", REG_SZ, ";comment2", 10, 0);
  1724. verify_reg(hkey, "Wine24", REG_SZ, "Value#comment3", 15, 0);
  1725. verify_reg(hkey, "Wine25", REG_SZ, "Value;comment4", 15, 0);
  1726. verify_reg(hkey, "Wine26", REG_SZ, "Value #comment5", 16, 0);
  1727. verify_reg(hkey, "Wine27", REG_SZ, "Value ;comment6", 16, 0);
  1728. verify_reg_nonexist(hkey, "Wine28");
  1729. verify_reg_nonexist(hkey, "Wine29");
  1730. verify_reg_nonexist(hkey, "Wine30");
  1731. dword = 0x00000004;
  1732. verify_reg(hkey, "Wine31", REG_DWORD, &dword, sizeof(dword), 0);
  1733. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1734. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1735. "\"Wine32a\"=dword:1\n"
  1736. "\"Wine32b\"=dword:4444\n\n", &r);
  1737. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1738. dword = 0x1;
  1739. verify_reg(hkey, "Wine32a", REG_DWORD, &dword, sizeof(dword), 0);
  1740. dword = 0x4444;
  1741. verify_reg(hkey, "Wine32b", REG_DWORD, &dword, sizeof(dword), 0);
  1742. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1743. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1744. "\"Wine33a\"=dword:\n"
  1745. "\"Wine33b\"=dword:hello\n"
  1746. "\"Wine33c\"=dword:123456789\n"
  1747. "\"Wine33d\"=dword:012345678\n"
  1748. "\"Wine33e\"=dword:000000001\n\n", &r);
  1749. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1750. verify_reg_nonexist(hkey, "Wine33a");
  1751. verify_reg_nonexist(hkey, "Wine33b");
  1752. verify_reg_nonexist(hkey, "Wine33c");
  1753. verify_reg_nonexist(hkey, "Wine33d");
  1754. verify_reg_nonexist(hkey, "Wine33e");
  1755. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1756. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1757. "\"Wine34a\"=dword:12345678abc\n"
  1758. "\"Wine34b\"=dword:12345678 abc\n\n", &r);
  1759. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1760. verify_reg_nonexist(hkey, "Wine34a");
  1761. verify_reg_nonexist(hkey, "Wine34b");
  1762. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1763. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1764. "\"Wine35a\"=dword:0x123\n"
  1765. "\"Wine35b\"=dword:123 456\n"
  1766. "\"Wine35c\"=dword:1234 5678\n\n", &r);
  1767. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1768. verify_reg_nonexist(hkey, "Wine35a");
  1769. verify_reg_nonexist(hkey, "Wine35b");
  1770. verify_reg_nonexist(hkey, "Wine35c");
  1771. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1772. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1773. "\"Wine36a\"=dword:1234;5678\n"
  1774. "\"Wine36b\"=dword:1234 ;5678\n"
  1775. "\"Wine36c\"=dword:1234#5678\n"
  1776. "\"Wine36d\"=dword:1234 #5678\n\n", &r);
  1777. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1778. dword = 0x1234;
  1779. verify_reg(hkey, "Wine36a", REG_DWORD, &dword, sizeof(dword), 0);
  1780. verify_reg(hkey, "Wine36b", REG_DWORD, &dword, sizeof(dword), 0);
  1781. verify_reg_nonexist(hkey, "Wine36c");
  1782. verify_reg_nonexist(hkey, "Wine36d");
  1783. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1784. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1785. "\"Wine37a\"=\"foo\"bar\"\n"
  1786. "\"Wine37b\"=\"foo\"\"bar\"\n\n", &r);
  1787. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1788. verify_reg_nonexist(hkey, "Wine37a");
  1789. verify_reg_nonexist(hkey, "Wine37b");
  1790. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1791. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1792. "\"Empty string\"=\"\"\n"
  1793. "\"\"=\"Default registry value\"\n\n", &r);
  1794. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1795. verify_reg(hkey, "Empty string", REG_SZ, "", 1, 0);
  1796. verify_reg(hkey, NULL, REG_SZ, "Default registry value", 23, 0);
  1797. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1798. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1799. "\"Test38a\"=\n"
  1800. "\"Test38b\"=\\\"\n"
  1801. "\"Test38c\"=\\\"Value\\\"\n"
  1802. "\"Test38d\"=\\\"Value\"\n\n", &r);
  1803. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1804. verify_reg_nonexist(hkey, "Test38a");
  1805. verify_reg_nonexist(hkey, "Test38b");
  1806. verify_reg_nonexist(hkey, "Test38c");
  1807. verify_reg_nonexist(hkey, "Test38d");
  1808. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1809. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1810. "\"Wine39a\"=\"Value1\" ;comment\n"
  1811. "\"Wine39b\"=\"Value2\"\t\t;comment\n"
  1812. "\"Wine39c\"=\"Value3\" #comment\n"
  1813. "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r);
  1814. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1815. verify_reg(hkey, "Wine39a", REG_SZ, "Value1", 7, 0);
  1816. verify_reg(hkey, "Wine39b", REG_SZ, "Value2", 7, 0);
  1817. verify_reg_nonexist(hkey, "Wine39c");
  1818. verify_reg_nonexist(hkey, "Wine39d");
  1819. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1820. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1821. "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r);
  1822. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1823. verify_reg_nonexist(hkey, "TestNoBeginQuote");
  1824. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1825. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1826. "\"TestNoEndQuote\"=\"Asdffdsa\n", &r);
  1827. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1828. verify_reg_nonexist(hkey, "TestNoEndQuote");
  1829. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1830. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1831. "\"TestNoQuotes\"=Asdffdsa\n", &r);
  1832. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1833. verify_reg_nonexist(hkey, "TestNoQuotes");
  1834. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1835. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1836. "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r);
  1837. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1838. verify_reg_nonexist(hkey, "NameNoBeginQuote");
  1839. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1840. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1841. "\"NameNoEndQuote=\"Asdffdsa\"\n", &r);
  1842. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1843. verify_reg_nonexist(hkey, "NameNoEndQuote");
  1844. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1845. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1846. "NameNoQuotes=\"Asdffdsa\"\n", &r);
  1847. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1848. verify_reg_nonexist(hkey, "NameNoQuotes");
  1849. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1850. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1851. "\"MixedQuotes=Asdffdsa\"\n", &r);
  1852. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1853. verify_reg_nonexist(hkey, "MixedQuotes");
  1854. verify_reg_nonexist(hkey, "MixedQuotes=Asdffdsa");
  1855. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1856. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1857. "\"Wine40a\"=hex(2):4c,00,69,00,6e,00,65,00,00,00\n"
  1858. "\"Wine40b\"=\"Value 1\"\n"
  1859. "\"Wine40c\"=hex(2):4c,00,69,00,6e,00,65,00\\\n"
  1860. "\"Wine40d\"=\"Value 2\"\n"
  1861. "\"Wine40e\"=hex(2):4c,00,69,00,6e,00,65,00,\\\n"
  1862. "\"Wine40f\"=\"Value 3\"\n"
  1863. "\"Wine40g\"=\"Value 4\"\n\n", &r);
  1864. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1865. verify_reg(hkey, "Wine40a", REG_EXPAND_SZ, "Line", 5, 0);
  1866. verify_reg(hkey, "Wine40b", REG_SZ, "Value 1", 8, 0);
  1867. verify_reg_nonexist(hkey, "Wine40c");
  1868. verify_reg(hkey, "Wine40d", REG_SZ, "Value 2", 8, 0);
  1869. verify_reg_nonexist(hkey, "Wine40e");
  1870. verify_reg_nonexist(hkey, "Wine40f");
  1871. verify_reg(hkey, "Wine40g", REG_SZ, "Value 4", 8, 0);
  1872. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1873. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1874. "\"Multi-Line1\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  1875. " 63,00,6f,00,6e,00,\\;comment\n"
  1876. " 63,00,61,00,74,00,\\;comment\n"
  1877. " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  1878. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1879. verify_reg(hkey, "Multi-Line1", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  1880. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1881. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1882. "\"Multi-Line2\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  1883. " 63,00,6f,00,6e,00,\\;comment\n"
  1884. " 63,00,61,00,74,00,;comment\n"
  1885. " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  1886. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1887. verify_reg(hkey, "Multi-Line2", REG_MULTI_SZ, "Line concat", 12, 0);
  1888. test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
  1889. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1890. "\"Multi-Line3\"=hex(7):4c,69,6e,65,20\\\n"
  1891. ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  1892. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1893. verify_reg_nonexist(hkey, "Multi-Line3");
  1894. test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
  1895. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1896. "\"Multi-Line4\"=hex(7):4c,69,6e,65,20\\\n"
  1897. " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  1898. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1899. verify_reg_nonexist(hkey, "Multi-Line4");
  1900. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1901. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1902. "\"Multi-Line5\"=hex(7):4c,69,6e,65,20\\\n"
  1903. ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  1904. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1905. verify_reg_nonexist(hkey, "Multi-Line5");
  1906. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1907. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1908. "\"Multi-Line6\"=hex(7):4c,69,6e,65,20\\\n"
  1909. " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  1910. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1911. verify_reg_nonexist(hkey, "Multi-Line6");
  1912. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1913. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1914. "\"Multi-Line7\"=hex(7):4c,00,69,00,6e,00,\\;comment\n"
  1915. " 65,00,20,00,\\;comment\n"
  1916. " 63,00,6f,00,6e,00,\\;comment\n"
  1917. " 63,00,61,00,74,00,\\;comment\n"
  1918. " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  1919. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1920. verify_reg(hkey, "Multi-Line7", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  1921. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1922. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1923. "\"Multi-Line8\"=hex(7):4c,00,69,00,6e,00,\\;#comment\n"
  1924. " 65,00,20,00,\\;#comment\n"
  1925. " 63,00,6f,00,6e,00,\\;#comment\n"
  1926. " 63,00,61,00,74,00,\\;#comment\n"
  1927. " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  1928. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1929. verify_reg(hkey, "Multi-Line8", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  1930. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1931. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1932. "\"Multi-Line9\"=hex(7):4c,00,69,00,6e,00,\\;comment\n"
  1933. " 65,00,20,00,\\;comment\n"
  1934. " 63,00,6f,00,6e,00,\\;comment\n"
  1935. " 63,00,61,00,74,00,\\#comment\n"
  1936. " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  1937. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1938. verify_reg_nonexist(hkey, "Multi-Line9");
  1939. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1940. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1941. "\"Multi-Line10\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  1942. " 63,00,6f,00,6e,00,\\;comment\n"
  1943. " 63,00,61,00,74,00,\\\n\n"
  1944. " 65,00,6e,00,\\;comment\n\n"
  1945. " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  1946. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1947. verify_reg(hkey, "Multi-Line10", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  1948. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1949. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1950. "\"Wine41a\"=dword:1234\\\n"
  1951. "5678\n"
  1952. "\"Wine41b\"=\"Test \\\n"
  1953. "Value\"\n\n", &r);
  1954. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1955. verify_reg_nonexist(hkey, "Wine41a");
  1956. verify_reg_nonexist(hkey, "Wine41b");
  1957. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1958. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1959. "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n"
  1960. "\"single'quote\"=dword:00000008\n\n", &r);
  1961. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1962. verify_reg(hkey, "double\"quote", REG_SZ, "valid \"or\" not", 15, 0);
  1963. dword = 0x00000008;
  1964. verify_reg(hkey, "single'quote", REG_DWORD, &dword, sizeof(dword), 0);
  1965. /* Test key name and value name concatenation */
  1966. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1967. "[HKEY_CURRENT_USER\\" KEY_BASE "\\\n"
  1968. "Subkey1]\n", &r);
  1969. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1970. verify_key_nonexist(hkey, "Subkey1");
  1971. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1972. "[HKEY_CURRENT_USER\\" KEY_BASE "\n"
  1973. "\\Subkey2]\n", &r);
  1974. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1975. verify_key_nonexist(hkey, "Subkey2");
  1976. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1977. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1978. "\"Wine\\\n"
  1979. "42a\"=\"Value 1\"\n"
  1980. "\"Wine42b\"=\"Value 2\"\n"
  1981. "\"Wine\n"
  1982. "\\42c\"=\"Value 3\"\n\n", &r);
  1983. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  1984. verify_reg_nonexist(hkey, "Wine42a");
  1985. verify_reg(hkey, "Wine42b", REG_SZ, "Value 2", 8, 0);
  1986. verify_reg_nonexist(hkey, "Wine42c");
  1987. /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */
  1988. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  1989. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  1990. "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n"
  1991. "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n"
  1992. " 75,00,65,00,00,00\n"
  1993. "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n"
  1994. ",75,00,65,00,00,00\n"
  1995. "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n"
  1996. " ,75,00,65,00,00,00\n"
  1997. "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n"
  1998. " 75,00,65,00,00,00\n"
  1999. "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n"
  2000. "5,00,65,00,00,00\n"
  2001. "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n"
  2002. " 5,00,65,00,00,00\n"
  2003. "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n"
  2004. " 6c,00,75,00,\\\n"
  2005. " 65,00,00,00\n"
  2006. "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n"
  2007. " 6c,00,75,00,\n"
  2008. " 65,00,00,00\n"
  2009. "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n"
  2010. " 6c,00,75,00,;comment\n"
  2011. " 65,00,00,00\n"
  2012. "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n"
  2013. " 6c,00,75,00,\\#comment\n"
  2014. " 65,00,00,00\n\n", &r);
  2015. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2016. verify_reg(hkey, "Wine43a", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
  2017. verify_reg(hkey, "Wine43b", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
  2018. verify_reg_nonexist(hkey, "Wine43c");
  2019. verify_reg_nonexist(hkey, "Wine43d");
  2020. verify_reg_nonexist(hkey, "Wine43e");
  2021. verify_reg_nonexist(hkey, "Wine43f");
  2022. verify_reg_nonexist(hkey, "Wine43g");
  2023. verify_reg(hkey, "Wine43h", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
  2024. verify_reg(hkey, "Wine43i", REG_NONE, "V\0a\0l\0u", 8, 0);
  2025. verify_reg(hkey, "Wine43j", REG_NONE, "V\0a\0l\0u", 8, 0);
  2026. verify_reg_nonexist(hkey, "Wine43k");
  2027. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2028. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2029. "\"Wine44a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
  2030. "\"Wine44b\"=hex(2):25,00,50,00,41,00,\\\n"
  2031. " 54,00,48,00,25,00,00,00\n"
  2032. "\"Wine44c\"=hex(2):25,00,50,00,41,00\\\n"
  2033. ",54,00,48,00,25,00,00,00\n"
  2034. "\"Wine44d\"=hex(2):25,00,50,00,41,00\\\n"
  2035. " ,54,00,48,00,25,00,00,00\n"
  2036. "\"Wine44e\"=hex(2):25,00,50,00,41,00\\\n"
  2037. " 54,00,48,00,25,00,00,00\n"
  2038. "\"Wine44f\"=hex(2):25,00,50,00,4\\\n"
  2039. "1,00,54,00,48,00,25,00,00,00\n"
  2040. "\"Wine44g\"=hex(2):25,00,50,00,4\\\n"
  2041. " 1,00,54,00,48,00,25,00,00,00\n"
  2042. "\"Wine44h\"=hex(2):25,00,50,00,41,00,\\;comment\n"
  2043. " 54,00,48,00,\\\n"
  2044. " 25,00,00,00\n"
  2045. "\"Wine44i\"=hex(2):25,00,50,00,41,00,\\;comment\n"
  2046. " 54,00,48,00\n"
  2047. " 25,00,00,00\n"
  2048. "\"Wine44j\"=hex(2):25,00,50,00,41,00,\\;comment\n"
  2049. " 54,00,48,00;comment\n"
  2050. " 25,00,00,00\n"
  2051. "\"Wine44k\"=hex(2):25,00,50,00,41,00,\\;comment\n"
  2052. " 54,00,48,00,\\#comment\n"
  2053. " 25,00,00,00\n\n", &r);
  2054. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2055. verify_reg(hkey, "Wine44a", REG_EXPAND_SZ, "%PATH%", 7, 0);
  2056. verify_reg(hkey, "Wine44b", REG_EXPAND_SZ, "%PATH%", 7, 0);
  2057. verify_reg_nonexist(hkey, "Wine44c");
  2058. verify_reg_nonexist(hkey, "Wine44d");
  2059. verify_reg_nonexist(hkey, "Wine44e");
  2060. verify_reg_nonexist(hkey, "Wine44f");
  2061. verify_reg_nonexist(hkey, "Wine44g");
  2062. verify_reg(hkey, "Wine44h", REG_EXPAND_SZ, "%PATH%", 7, 0);
  2063. /* Wine44i */
  2064. size = sizeof(buffer);
  2065. err = RegQueryValueExA(hkey, "Wine44i", NULL, &type, (BYTE *)&buffer, &size);
  2066. ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err);
  2067. ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ);
  2068. ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size);
  2069. ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
  2070. /* Wine44j */
  2071. size = sizeof(buffer);
  2072. memset(buffer, '-', size);
  2073. err = RegQueryValueExA(hkey, "Wine44j", NULL, &type, (BYTE *)&buffer, &size);
  2074. ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err);
  2075. ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ);
  2076. ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size);
  2077. ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
  2078. /* Wine44k */
  2079. verify_reg_nonexist(hkey, "Wine44k");
  2080. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2081. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2082. "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n"
  2083. "\"Wine45b\"=hex:11,22,33,44,\\\n"
  2084. " 55,66,77,88\n"
  2085. "\"Wine45c\"=hex:11,22,33,44\\\n"
  2086. ",55,66,77,88\n"
  2087. "\"Wine45d\"=hex:11,22,33,44\\\n"
  2088. " ,55,66,77,88\n"
  2089. "\"Wine45e\"=hex:11,22,33,44\\\n"
  2090. " 55,66,77,88\n"
  2091. "\"Wine45f\"=hex:11,22,33,4\\\n"
  2092. "4,55,66,77,88\n"
  2093. "\"Wine45g\"=hex:11,22,33,4\\\n"
  2094. " 4,55,66,77,88\n"
  2095. "\"Wine45h\"=hex:11,22,33,44,\\;comment\n"
  2096. " 55,66,\\\n"
  2097. " 77,88\n"
  2098. "\"Wine45i\"=hex:11,22,33,44,\\;comment\n"
  2099. " 55,66,\n"
  2100. " 77,88\n"
  2101. "\"Wine45j\"=hex:11,22,33,44,\\;comment\n"
  2102. " 55,66,;comment\n"
  2103. " 77,88\n"
  2104. "\"Wine45k\"=hex:11,22,33,\\;comment\n"
  2105. " 44,55,66,\\#comment\n"
  2106. " 77,88\n\n", &r);
  2107. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2108. hex[0] = 0x11; hex[1] = 0x22; hex[2] = 0x33; hex[3] = 0x44;
  2109. hex[4] = 0x55; hex[5] = 0x66; hex[6] = 0x77; hex[7] = 0x88;
  2110. verify_reg(hkey, "Wine45a", REG_BINARY, hex, sizeof(hex), 0);
  2111. verify_reg(hkey, "Wine45b", REG_BINARY, hex, sizeof(hex), 0);
  2112. verify_reg_nonexist(hkey, "Wine45c");
  2113. verify_reg_nonexist(hkey, "Wine45d");
  2114. verify_reg_nonexist(hkey, "Wine45e");
  2115. verify_reg_nonexist(hkey, "Wine45f");
  2116. verify_reg_nonexist(hkey, "Wine45g");
  2117. verify_reg(hkey, "Wine45h", REG_BINARY, hex, sizeof(hex), 0);
  2118. verify_reg(hkey, "Wine45i", REG_BINARY, hex, 6, 0);
  2119. verify_reg(hkey, "Wine45j", REG_BINARY, hex, 6, 0);
  2120. verify_reg_nonexist(hkey, "Wine45k");
  2121. /* Test import with subkeys */
  2122. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2123. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey\"1]\n"
  2124. "\"Wine\\\\31\"=\"Test value\"\n\n", &r);
  2125. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2126. open_key(hkey, "Subkey\"1", 0, &subkey);
  2127. verify_reg(subkey, "Wine\\31", REG_SZ, "Test value", 11, 0);
  2128. close_key(subkey);
  2129. delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey\"1");
  2130. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2131. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey/2]\n"
  2132. "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r);
  2133. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2134. open_key(hkey, "Subkey/2", 0, &subkey);
  2135. verify_reg(subkey, "123/\"4;'5", REG_SZ, "Random value name", 18, 0);
  2136. close_key(subkey);
  2137. delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey/2");
  2138. /* Test key creation */
  2139. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2140. "HKEY_CURRENT_USER\\" KEY_BASE "\\No_Opening_Bracket]\n", &r);
  2141. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2142. verify_key_nonexist(hkey, "No_Opening_Bracket");
  2143. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2144. "[HKEY_CURRENT_USER\\" KEY_BASE "\\No_Closing_Bracket\n", &r);
  2145. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2146. verify_key_nonexist(hkey, "No_Closing_Bracket");
  2147. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2148. "[ HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1a]\n", &r);
  2149. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2150. verify_key_nonexist(hkey, "Subkey1a");
  2151. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2152. "[\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1b]\n", &r);
  2153. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2154. verify_key_nonexist(hkey, "Subkey1b");
  2155. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2156. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1c ]\n", &r);
  2157. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2158. verify_key(hkey, "Subkey1c ");
  2159. delete_key(hkey, "Subkey1c ");
  2160. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2161. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1d\t]\n", &r);
  2162. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2163. verify_key(hkey, "Subkey1d\t");
  2164. delete_key(hkey, "Subkey1d\t");
  2165. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2166. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1e\\]\n"
  2167. "\"Wine\"=\"Test value\"\n\n", &r);
  2168. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2169. verify_key(hkey, "Subkey1e\\");
  2170. verify_key(hkey, "Subkey1e");
  2171. open_key(hkey, "Subkey1e", 0, &subkey);
  2172. verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0);
  2173. close_key(subkey);
  2174. delete_key(hkey, "Subkey1e");
  2175. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2176. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1f\\\\]\n"
  2177. "\"Wine\"=\"Test value\"\n\n", &r);
  2178. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2179. verify_key(hkey, "Subkey1f\\\\");
  2180. verify_key(hkey, "Subkey1f\\");
  2181. verify_key(hkey, "Subkey1f");
  2182. open_key(hkey, "Subkey1f\\\\", 0, &subkey);
  2183. verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0);
  2184. close_key(subkey);
  2185. delete_key(hkey, "Subkey1f\\\\");
  2186. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2187. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1g\\\\\\\\]\n"
  2188. "\"Wine\"=\"Test value\"\n\n", &r);
  2189. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2190. verify_key(hkey, "Subkey1g\\\\\\\\");
  2191. verify_key(hkey, "Subkey1g\\\\");
  2192. verify_key(hkey, "Subkey1g\\");
  2193. verify_key(hkey, "Subkey1g");
  2194. open_key(hkey, "Subkey1g\\\\", 0, &subkey);
  2195. verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0);
  2196. close_key(subkey);
  2197. delete_key(hkey, "Subkey1g\\\\");
  2198. /* Test key deletion. We start by creating some registry keys. */
  2199. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2200. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n"
  2201. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r);
  2202. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2203. verify_key(hkey, "Subkey2a");
  2204. verify_key(hkey, "Subkey2b");
  2205. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2206. "[ -HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r);
  2207. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2208. verify_key(hkey, "Subkey2a");
  2209. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2210. "[\t-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r);
  2211. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2212. verify_key(hkey, "Subkey2b");
  2213. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2214. "[- HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r);
  2215. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2216. verify_key(hkey, "Subkey2a");
  2217. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2218. "[-\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r);
  2219. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2220. verify_key(hkey, "Subkey2b");
  2221. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2222. "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n"
  2223. "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r);
  2224. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2225. verify_key_nonexist(hkey, "Subkey2a");
  2226. verify_key_nonexist(hkey, "Subkey2b");
  2227. /* Test case sensitivity when creating and deleting registry keys. */
  2228. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2229. "[hkey_CURRENT_user\\" KEY_BASE "\\Subkey3a]\n\n"
  2230. "[HkEy_CuRrEnT_uSeR\\" KEY_BASE "\\SuBkEy3b]\n\n", &r);
  2231. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2232. verify_key(hkey, "Subkey3a");
  2233. verify_key(hkey, "Subkey3b");
  2234. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2235. "[-HKEY_current_USER\\" KEY_BASE "\\sUBKEY3A]\n\n"
  2236. "[-hKeY_cUrReNt_UsEr\\" KEY_BASE "\\sUbKeY3B]\n\n", &r);
  2237. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2238. verify_key_nonexist(hkey, "Subkey3a");
  2239. verify_key_nonexist(hkey, "Subkey3b");
  2240. /* Test mixed key creation and deletion. We start by creating a subkey. */
  2241. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2242. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n\n", &r);
  2243. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2244. verify_key(hkey, "Subkey4a");
  2245. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2246. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n"
  2247. "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n"
  2248. "\"Wine46a\"=dword:12345678\n\n", &r);
  2249. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2250. verify_key_nonexist(hkey, "Subkey4a");
  2251. verify_reg_nonexist(hkey, "Wine46a");
  2252. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2253. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n"
  2254. "[HKEY_CURRENT_USERS\\" KEY_BASE "\\Subkey4b]\n"
  2255. "\"Wine46b\"=dword:12345678\n\n", &r);
  2256. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2257. verify_key_nonexist(hkey, "Subkey4b");
  2258. verify_reg_nonexist(hkey, "Wine46b");
  2259. /* Test value deletion. We start by creating some registry values. */
  2260. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2261. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2262. "\"Wine46a\"=\"Test Value\"\n"
  2263. "\"Wine46b\"=dword:00000008\n"
  2264. "\"Wine46c\"=hex:11,22,33,44\n"
  2265. "\"Wine46d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2266. " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
  2267. " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
  2268. "\"Wine46e\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
  2269. "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r);
  2270. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2271. verify_reg(hkey, "Wine46a", REG_SZ, "Test Value", 11, 0);
  2272. verify_reg(hkey, "Wine46b", REG_DWORD, &dword, sizeof(dword), 0);
  2273. verify_reg(hkey, "Wine46c", REG_BINARY, hex, 4, 0);
  2274. verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  2275. verify_reg(hkey, "Wine46e", REG_EXPAND_SZ, "%PATH%", 7, 0);
  2276. verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
  2277. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2278. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2279. "\"Wine46a\"=-\n"
  2280. "\"Wine46b\"= -\n"
  2281. "\"Wine46c\"= \t-\t \n"
  2282. "\"Wine46d\"=-\"Test\"\n"
  2283. "\"Wine46e\"=- ;comment\n"
  2284. "\"Wine46f\"=- #comment\n\n", &r);
  2285. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2286. verify_reg_nonexist(hkey, "Wine46a");
  2287. verify_reg_nonexist(hkey, "Wine46b");
  2288. verify_reg_nonexist(hkey, "Wine46c");
  2289. verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  2290. verify_reg_nonexist(hkey, "Wine46e");
  2291. verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
  2292. /* Test the accepted range of the hex-based data types */
  2293. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2294. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2295. "\"Wine47a\"=hex(0):56,61,6c,75,65,00\n"
  2296. "\"Wine47b\"=hex(10):56,61,6c,75,65,00\n"
  2297. "\"Wine47c\"=hex(100):56,61,6c,75,65,00\n"
  2298. "\"Wine47d\"=hex(1000):56,61,6c,75,65,00\n"
  2299. "\"Wine47e\"=hex(7fff):56,61,6c,75,65,00\n"
  2300. "\"Wine47f\"=hex(ffff):56,61,6c,75,65,00\n"
  2301. "\"Wine47g\"=hex(7fffffff):56,61,6c,75,65,00\n"
  2302. "\"Wine47h\"=hex(ffffffff):56,61,6c,75,65,00\n"
  2303. "\"Wine47i\"=hex(100000000):56,61,6c,75,65,00\n"
  2304. "\"Wine47j\"=hex(0x2):56,00,61,00,6c,00,75,00,65,00,00,00\n"
  2305. "\"Wine47k\"=hex(0X2):56,00,61,00,6c,00,75,00,65,00,00,00\n"
  2306. "\"Wine47l\"=hex(x2):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r);
  2307. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2308. verify_reg(hkey, "Wine47a", REG_NONE, "Value", 6, 0);
  2309. verify_reg(hkey, "Wine47b", 0x10, "Value", 6, 0);
  2310. verify_reg(hkey, "Wine47c", 0x100, "Value", 6, 0);
  2311. verify_reg(hkey, "Wine47d", 0x1000, "Value", 6, 0);
  2312. verify_reg(hkey, "Wine47e", 0x7fff, "Value", 6, 0);
  2313. verify_reg(hkey, "Wine47f", 0xffff, "Value", 6, 0);
  2314. verify_reg(hkey, "Wine47g", 0x7fffffff, "Value", 6, 0);
  2315. verify_reg(hkey, "Wine47h", 0xffffffff, "Value", 6, 0);
  2316. verify_reg_nonexist(hkey, "Wine47i");
  2317. verify_reg_nonexist(hkey, "Wine47j");
  2318. verify_reg_nonexist(hkey, "Wine47k");
  2319. verify_reg_nonexist(hkey, "Wine47l");
  2320. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2321. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2322. "\"Wine48a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00, \\\n"
  2323. " 63,00,6f,00,6e,00,63,00,61,00,74,00, \\\n"
  2324. " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
  2325. "\"Wine48b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\t\\\n"
  2326. " 63,00,6f,00,6e,00,63,00,61,00,74,00,\t \t \\\n"
  2327. " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  2328. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2329. verify_reg(hkey, "Wine48a", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  2330. verify_reg(hkey, "Wine48b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  2331. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2332. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2333. "\"Wine49\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00,\n\n", &r);
  2334. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2335. verify_reg(hkey, "Wine49", REG_EXPAND_SZ, "%PATH%", 7, 0);
  2336. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2337. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2338. "\"Wine50a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00 ;comment\n"
  2339. "\"Wine50b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\t;comment\n"
  2340. "\"Wine50c\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00 #comment\n"
  2341. "\"Wine50d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\t#comment\n\n", &r);
  2342. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2343. verify_reg(hkey, "Wine50a", REG_EXPAND_SZ, "%PATH%", 7, 0);
  2344. verify_reg(hkey, "Wine50b", REG_EXPAND_SZ, "%PATH%", 7, 0);
  2345. verify_reg_nonexist(hkey, "Wine50c");
  2346. verify_reg_nonexist(hkey, "Wine50d");
  2347. /* Test support for characters greater than 0xff */
  2348. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2349. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2350. "\"Wine51a\"=hex(0):25,50,100,54,48,25,00\n"
  2351. "\"Wine51b\"=hex(0):25,1a4,100,164,124,25,00\n\n", &r);
  2352. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2353. verify_reg_nonexist(hkey, "Wine51a");
  2354. verify_reg_nonexist(hkey, "Wine51b");
  2355. /* Test the effect of backslashes in hex data */
  2356. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2357. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2358. "\"Wine52a\"=hex(2):25,00,48\\,00,4f,00,4d,00,45,00,25,00,00,00\n"
  2359. "\"Wine52b\"=hex(2):25,00,48,00,\\4f,00,4d,00,45,00,25,00,00,00\n"
  2360. "\"Wine52c\"=hex(2):25,00,48\\ ,00,4f,00,4d,00,45,00,25,00,00,00\n"
  2361. "\"Wine52d\"=hex(2):25,00,48,00,\\ 4f,00,4d,00,45,00,25,00,00,00\n"
  2362. "\"Wine52e\"=hex(2):\\25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n"
  2363. "\"Wine52f\"=hex(2):\\ 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n"
  2364. "\"Wine52g\"=hex(2):25,00,48,00,4\\f,00,4d,00,45,00,25,00,00,00\n"
  2365. "\"Wine52h\"=hex(2):25,00,48,00,4\\\n"
  2366. " f,00,4d,00,45,00,25,00,00,00\n"
  2367. "\"Wine52i\"=hex(2):25,00,50,00,\\,41,00,54,00,48,00,25,00,00,00\n"
  2368. "\"Wine52j\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\\\n"
  2369. " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
  2370. "\"Wine52k\"=hex(2):,\\\n"
  2371. " 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n"
  2372. "\"Wine52l\"=hex(2):\\\n"
  2373. " 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n\n", &r);
  2374. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2375. verify_reg_nonexist(hkey, "Wine52a");
  2376. verify_reg_nonexist(hkey, "Wine52b");
  2377. verify_reg_nonexist(hkey, "Wine52c");
  2378. verify_reg_nonexist(hkey, "Wine52d");
  2379. verify_reg_nonexist(hkey, "Wine52e");
  2380. verify_reg_nonexist(hkey, "Wine52f");
  2381. verify_reg_nonexist(hkey, "Wine52g");
  2382. verify_reg_nonexist(hkey, "Wine52h");
  2383. verify_reg_nonexist(hkey, "Wine52i");
  2384. verify_reg_nonexist(hkey, "Wine52j");
  2385. verify_reg_nonexist(hkey, "Wine52k");
  2386. verify_reg(hkey, "Wine52l", REG_EXPAND_SZ, "%HOME%", 7, 0);
  2387. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2388. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2389. "\"Wine53a\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n"
  2390. " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
  2391. "\"Wine53b\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\n"
  2392. " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
  2393. "\"Wine53c\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00, \\ ;comment\n"
  2394. " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
  2395. "\"Wine53d\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00 \\ ;comment\n"
  2396. " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
  2397. "\"Wine53e\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\t ;comment\n"
  2398. " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
  2399. "\"Wine53f\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\t ;comment\n"
  2400. " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n\n", &r);
  2401. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2402. verify_reg(hkey, "Wine53a", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0);
  2403. verify_reg_nonexist(hkey, "Wine53b");
  2404. verify_reg(hkey, "Wine53c", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0);
  2405. verify_reg_nonexist(hkey, "Wine53d");
  2406. verify_reg(hkey, "Wine53e", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0);
  2407. verify_reg_nonexist(hkey, "Wine53f");
  2408. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2409. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2410. "\"Wine54a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2411. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\n", &r);
  2412. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2413. verify_reg_nonexist(hkey, "Wine54a");
  2414. verify_key_nonexist(hkey, "Subkey1");
  2415. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2416. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2417. "\"Wine54b\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n"
  2418. "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2]\n", &r);
  2419. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2420. verify_reg_nonexist(hkey, "Wine54b");
  2421. verify_key(hkey, "Subkey2");
  2422. delete_key(hkey, "Subkey2");
  2423. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2424. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2425. "\"Wine55a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2426. "\"Wine55b\"=\"Test value\"\n"
  2427. "\"Wine55c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2428. ";comment\n"
  2429. "\"Wine55d\"=\"Test value\"\n"
  2430. "\"Wine55e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2431. "#comment\n"
  2432. "\"Wine55f\"=\"Test value\"\n"
  2433. "\"Wine55g\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n"
  2434. "\"Wine55h\"=\"Test value\"\n"
  2435. "\"Wine55i\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n"
  2436. "\"Wine55j\"=\"Test value\"\n\n", &r);
  2437. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2438. verify_reg_nonexist(hkey, "Wine55a");
  2439. verify_reg_nonexist(hkey, "Wine55b");
  2440. verify_reg_nonexist(hkey, "Wine55c");
  2441. verify_reg_nonexist(hkey, "Wine55d");
  2442. verify_reg_nonexist(hkey, "Wine55e");
  2443. verify_reg(hkey, "Wine55f", REG_SZ, "Test value", 11, 0);
  2444. verify_reg_nonexist(hkey, "Wine55g");
  2445. verify_reg_nonexist(hkey, "Wine55h");
  2446. verify_reg_nonexist(hkey, "Wine55i");
  2447. verify_reg(hkey, "Wine55j", REG_SZ, "Test value", 11, 0);
  2448. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2449. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2450. "\"Wine56a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2451. "\"Wine56b\"=dword:00000008\n"
  2452. "\"Wine56c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2453. ";comment\n"
  2454. "\"Wine56d\"=dword:00000008\n"
  2455. "\"Wine56e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2456. "#comment\n"
  2457. "\"Wine56f\"=dword:00000008\n"
  2458. "\"Wine56g\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n"
  2459. "\"Wine56h\"=dword:00000008\n"
  2460. "\"Wine56i\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n"
  2461. "\"Wine56j\"=dword:00000008\n\n", &r);
  2462. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2463. verify_reg_nonexist(hkey, "Wine56a");
  2464. verify_reg_nonexist(hkey, "Wine56b");
  2465. verify_reg_nonexist(hkey, "Wine56c");
  2466. verify_reg_nonexist(hkey, "Wine56d");
  2467. verify_reg_nonexist(hkey, "Wine56e");
  2468. verify_reg(hkey, "Wine56f", REG_DWORD, &dword, sizeof(dword), 0);
  2469. verify_reg_nonexist(hkey, "Wine56g");
  2470. verify_reg_nonexist(hkey, "Wine56h");
  2471. verify_reg_nonexist(hkey, "Wine56i");
  2472. verify_reg(hkey, "Wine56j", REG_DWORD, &dword, sizeof(dword), 0);
  2473. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2474. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2475. "\"Wine57a\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n"
  2476. "\"Wine57b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
  2477. "\"Wine57c\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n"
  2478. ";comment\n"
  2479. "\"Wine57d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
  2480. "\"Wine57e\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n"
  2481. "#comment\n"
  2482. "\"Wine57f\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
  2483. "\"Wine57g\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n\n"
  2484. "\"Wine57h\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
  2485. "\"Wine57i\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\n"
  2486. "\"Wine57j\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n\n", &r);
  2487. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2488. verify_reg_nonexist(hkey, "Wine57a");
  2489. verify_reg_nonexist(hkey, "Wine57b");
  2490. verify_reg_nonexist(hkey, "Wine57c");
  2491. verify_reg_nonexist(hkey, "Wine57d");
  2492. verify_reg_nonexist(hkey, "Wine57e");
  2493. verify_reg(hkey, "Wine57f", REG_EXPAND_SZ, "%PATH%", 7, 0);
  2494. verify_reg_nonexist(hkey, "Wine57g");
  2495. verify_reg_nonexist(hkey, "Wine57h");
  2496. verify_reg_nonexist(hkey, "Wine57i");
  2497. verify_reg(hkey, "Wine57j", REG_EXPAND_SZ, "%PATH%", 7, 0);
  2498. delete_value(hkey, NULL);
  2499. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2500. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2501. "\"Wine58a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2502. "@=\"Default value 1\"\n\n", &r);
  2503. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2504. verify_reg_nonexist(hkey, "Wine58a");
  2505. verify_reg_nonexist(hkey, NULL);
  2506. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2507. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2508. "\"Wine58b\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2509. ";comment\n"
  2510. "@=\"Default value 2\"\n\n", &r);
  2511. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2512. verify_reg_nonexist(hkey, "Wine58b");
  2513. verify_reg_nonexist(hkey, NULL);
  2514. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2515. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2516. "\"Wine58c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2517. "#comment\n"
  2518. "@=\"Default value 3\"\n\n", &r);
  2519. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2520. verify_reg_nonexist(hkey, "Wine58c");
  2521. verify_reg(hkey, NULL, REG_SZ, "Default value 3", 16, 0);
  2522. delete_value(hkey, NULL);
  2523. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2524. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2525. "\"Wine58d\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n"
  2526. "@=\"Default value 4\"\n\n", &r);
  2527. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2528. verify_reg_nonexist(hkey, "Wine58d");
  2529. verify_reg_nonexist(hkey, NULL);
  2530. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2531. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2532. "\"Wine58e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n"
  2533. "@=\"Default value 5\"\n\n", &r);
  2534. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2535. verify_reg_nonexist(hkey, "Wine58e");
  2536. verify_reg(hkey, NULL, REG_SZ, "Default value 5", 16, 0);
  2537. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2538. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2539. "\"Wine59a\"=hex:11,22,33,\\\n"
  2540. "\\\n"
  2541. " 44,55,66\n"
  2542. "\"Wine59b\"=hex:11,22,33,\\\n"
  2543. " \\\n"
  2544. " 44,55,66\n\n", &r);
  2545. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2546. verify_reg_nonexist(hkey, "Wine59a");
  2547. verify_reg_nonexist(hkey, "Wine59b");
  2548. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2549. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2550. "\"Wine60a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2551. " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
  2552. ";comment\n"
  2553. " 65,00,6e,00,\\;comment\n"
  2554. " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  2555. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2556. verify_reg(hkey, "Wine60a", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  2557. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2558. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2559. "\"Wine60b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2560. " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
  2561. " ;comment\n"
  2562. " 65,00,6e,00,\\;comment\n"
  2563. " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  2564. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2565. verify_reg(hkey, "Wine60b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  2566. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2567. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2568. "\"Wine60c\"=hex(7):4c,69,6e,65,20,\\\n"
  2569. " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
  2570. "#comment\n"
  2571. " 65,00,6e,00,\\;comment\n"
  2572. " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  2573. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2574. verify_reg_nonexist(hkey, "Wine60c");
  2575. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2576. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2577. "\"Wine60d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2578. " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
  2579. " #comment\n"
  2580. " 65,00,6e,00,\\;comment\n"
  2581. " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  2582. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2583. verify_reg_nonexist(hkey, "Wine60d");
  2584. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2585. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2586. "\"Wine60e\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2587. " 63,00,6f,00,6e,00,\\\n\n"
  2588. " 63,00,61,00,74,00,\\\n\n\n"
  2589. " 65,00,6e,00,\\\n\n\n\n"
  2590. " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  2591. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2592. verify_reg(hkey, "Wine60e", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  2593. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2594. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2595. "\"Wine60f\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2596. " 63,00,6f,00,6e,00,\\\n \n"
  2597. " 63,00,61,00,74,00,\\\n\t\n\t\n"
  2598. " 65,00,6e,00,\\\n\t \t\n\t \t\n\t \t\n"
  2599. " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  2600. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2601. verify_reg(hkey, "Wine60f", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  2602. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2603. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2604. "\"Wine61a\"=hex(0):25,48,4f,4d,45,25,5c,/\n"
  2605. " 25,50,41,54,48,25,00\n"
  2606. "\"Wine61b\"=hex(0):25,48,4f,4d,45,25,5c/\n"
  2607. " 25,50,41,54,48,25,00\n\n", &r);
  2608. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2609. verify_reg_nonexist(hkey, "Wine61a");
  2610. verify_reg_nonexist(hkey, "Wine61b");
  2611. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2612. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2613. "\"Wine62a\"=hex(0):56,61,6c,75,65,\\", &r);
  2614. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2615. err = RegQueryValueExA(hkey, "Wine62a", NULL, NULL, NULL, NULL);
  2616. ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
  2617. "got exit code %d, expected 0\n", err);
  2618. if (err == ERROR_SUCCESS)
  2619. verify_reg(hkey, "Wine62a", REG_NONE, "Value", 5, 0);
  2620. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2621. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2622. "\"Wine62b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,\\", &r);
  2623. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2624. err = RegQueryValueExA(hkey, "Wine62b", NULL, NULL, NULL, NULL);
  2625. ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
  2626. "got exit code %d, expected 0\n", err);
  2627. if (err == ERROR_SUCCESS)
  2628. verify_reg(hkey, "Wine62b", REG_EXPAND_SZ, "%PATH%", 7, 0);
  2629. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2630. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2631. "\"Wine62c\"=hex:11,22,33,44,55,\\", &r);
  2632. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2633. err = RegQueryValueExA(hkey, "Wine62c", NULL, NULL, NULL, NULL);
  2634. ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
  2635. "got exit code %d, expected 0\n", err);
  2636. if (err == ERROR_SUCCESS)
  2637. verify_reg(hkey, "Wine62c", REG_BINARY, hex, 5, 0);
  2638. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2639. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2640. "\"Wine62d\"=hex(7):4c,00,69,00,6e,00,65,00,\\", &r);
  2641. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2642. err = RegQueryValueExA(hkey, "Wine62d", NULL, NULL, NULL, NULL);
  2643. ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
  2644. "got exit code %d, expected 0\n", err);
  2645. if (err == ERROR_SUCCESS)
  2646. verify_reg(hkey, "Wine62d", REG_MULTI_SZ, "Line", 5, 0);
  2647. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2648. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2649. "\"Wine62e\"=hex(100):56,61,6c,75,65,\\", &r);
  2650. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2651. err = RegQueryValueExA(hkey, "Wine62e", NULL, NULL, NULL, NULL);
  2652. ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
  2653. "got exit code %d, expected 0\n", err);
  2654. if (err == ERROR_SUCCESS)
  2655. verify_reg(hkey, "Wine62e", 0x100, "Value", 5, 0);
  2656. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2657. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2658. "\"Wine62f\"=hex(7):4c,00,69,00,6e,00,65,00,20,00\\", &r);
  2659. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2660. verify_reg_nonexist(hkey, "Wine62f");
  2661. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2662. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2663. "\"Wine63a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2664. " ,63,00,6f,00,6e,00,\\\n"
  2665. " 63,00,61,00,74,00,\\\n"
  2666. " 65,00,6e,00,\\\n"
  2667. " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
  2668. "\"Wine63b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2669. " 63,,00,6f,00,6e,00,\\\n"
  2670. " 63,00,61,00,74,00,\\\n"
  2671. " 65,00,6e,00,\\\n"
  2672. " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  2673. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2674. verify_reg_nonexist(hkey, "Wine63a");
  2675. verify_reg_nonexist(hkey, "Wine63b");
  2676. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2677. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2678. "\"Wine64a\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,00,00\n"
  2679. "\"Wine64b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2680. " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
  2681. " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
  2682. "\"Wine64c\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\;comment\n"
  2683. " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
  2684. " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
  2685. "\"Wine64d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\;comment\n"
  2686. " 63,00,6f,00,6e,00,63,00,61,00,74,00,\n"
  2687. " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
  2688. "\"Wine64e\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  2689. " 63,00,6f,00,6e,00,63,00,61,00,74,00,;comment\n"
  2690. " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  2691. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2692. verify_reg(hkey, "Wine64a", REG_MULTI_SZ, "Line\0", 6, 0);
  2693. verify_reg(hkey, "Wine64b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  2694. verify_reg(hkey, "Wine64c", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  2695. /* Wine64d */
  2696. size = sizeof(buffer);
  2697. err = RegQueryValueExA(hkey, "Wine64d", NULL, &type, (BYTE *)&buffer, &size);
  2698. ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err);
  2699. ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ);
  2700. ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size);
  2701. ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
  2702. /* Wine64e */
  2703. size = sizeof(buffer);
  2704. err = RegQueryValueExA(hkey, "Wine64e", NULL, &type, (BYTE *)&buffer, &size);
  2705. ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err);
  2706. ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ);
  2707. ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size);
  2708. ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
  2709. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2710. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2711. "\"Wine65a\"=hex(100):25,50,41,54,48,25,00\n"
  2712. "\"Wine65b\"=hex(100):25,50,41,\\\n"
  2713. " 54,48,25,00\n"
  2714. "\"Wine65c\"=hex(100):25,50,41,\\;comment\n"
  2715. " 54,48,\\\n"
  2716. " 25,00\n"
  2717. "\"Wine65d\"=hex(100):25,50,41,\\;comment\n"
  2718. " 54,48,\n"
  2719. " 25,00\n"
  2720. "\"Wine65e\"=hex(100):25,50,41,\\;comment\n"
  2721. " 54,48,;comment\n"
  2722. " 25,00\n", &r);
  2723. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2724. verify_reg(hkey, "Wine65a", 0x100, "%PATH%", 7, 0);
  2725. verify_reg(hkey, "Wine65b", 0x100, "%PATH%", 7, 0);
  2726. verify_reg(hkey, "Wine65c", 0x100, "%PATH%", 7, 0);
  2727. verify_reg(hkey, "Wine65d", 0x100, "%PATH", 5, 0);
  2728. verify_reg(hkey, "Wine65e", 0x100, "%PATH", 5, 0);
  2729. /* Test null-termination of REG_EXPAND_SZ and REG_MULTI_SZ data*/
  2730. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2731. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2732. "\"Wine66a\"=hex(7):4c,00,69,00,6e,00,65,00\n"
  2733. "\"Wine66b\"=hex(7):4c,00,69,00,6e,00,65,00,\n"
  2734. "\"Wine66c\"=hex(7):4c,00,69,00,6e,00,65,00,00,00\n"
  2735. "\"Wine66d\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,\n"
  2736. "\"Wine66e\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,00,00\n"
  2737. "\"Wine66f\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,00,00,\n\n", &r);
  2738. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2739. verify_reg(hkey, "Wine66a", REG_MULTI_SZ, "Line", 5, 0);
  2740. verify_reg(hkey, "Wine66b", REG_MULTI_SZ, "Line", 5, 0);
  2741. verify_reg(hkey, "Wine66c", REG_MULTI_SZ, "Line", 5, 0);
  2742. verify_reg(hkey, "Wine66d", REG_MULTI_SZ, "Line", 5, 0);
  2743. verify_reg(hkey, "Wine66e", REG_MULTI_SZ, "Line\0", 6, 0);
  2744. verify_reg(hkey, "Wine66f", REG_MULTI_SZ, "Line\0", 6, 0);
  2745. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2746. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2747. "\"Wine67a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00\n"
  2748. "\"Wine67b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,\n"
  2749. "\"Wine67c\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
  2750. "\"Wine67d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00,\n\n", &r);
  2751. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2752. verify_reg(hkey, "Wine67a", REG_EXPAND_SZ, "%PATH%", 7, 0);
  2753. verify_reg(hkey, "Wine67b", REG_EXPAND_SZ, "%PATH%", 7, 0);
  2754. verify_reg(hkey, "Wine67c", REG_EXPAND_SZ, "%PATH%", 7, 0);
  2755. verify_reg(hkey, "Wine67d", REG_EXPAND_SZ, "%PATH%", 7, 0);
  2756. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2757. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2758. "\"Wine68a\"=hex(1):\n"
  2759. "\"Wine68b\"=hex(2):\n"
  2760. "\"Wine68c\"=hex(3):\n"
  2761. "\"Wine68d\"=hex(4):\n"
  2762. "\"Wine68e\"=hex(7):\n"
  2763. "\"Wine68f\"=hex(100):\n"
  2764. "\"Wine68g\"=hex(abcd):\n"
  2765. "\"Wine68h\"=hex:\n"
  2766. "\"Wine68i\"=hex(0):\n\n", &r);
  2767. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2768. verify_reg(hkey, "Wine68a", REG_SZ, NULL, 0, 0);
  2769. verify_reg(hkey, "Wine68b", REG_EXPAND_SZ, NULL, 0, 0);
  2770. verify_reg(hkey, "Wine68c", REG_BINARY, NULL, 0, 0);
  2771. verify_reg(hkey, "Wine68d", REG_DWORD, NULL, 0, 0);
  2772. verify_reg(hkey, "Wine68e", REG_MULTI_SZ, NULL, 0, 0);
  2773. verify_reg(hkey, "Wine68f", 0x100, NULL, 0, 0);
  2774. verify_reg(hkey, "Wine68g", 0xabcd, NULL, 0, 0);
  2775. verify_reg(hkey, "Wine68h", REG_BINARY, NULL, 0, 0);
  2776. verify_reg(hkey, "Wine68i", REG_NONE, NULL, 0, 0);
  2777. /* Test with embedded null characters */
  2778. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2779. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2780. "\"Wine69a\"=\"\\\\0\"\n"
  2781. "\"Wine69b\"=\"\\\\0\\\\0\"\n"
  2782. "\"Wine69c\"=\"Value1\\\\0\"\n"
  2783. "\"Wine69d\"=\"Value2\\\\0\\\\0\\\\0\\\\0\"\n"
  2784. "\"Wine69e\"=\"Value3\\\\0Value4\"\n"
  2785. "\"Wine69f\"=\"\\\\0Value5\"\n\n", &r);
  2786. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2787. verify_reg(hkey, "Wine69a", REG_SZ, "\\0", 3, 0);
  2788. verify_reg(hkey, "Wine69b", REG_SZ, "\\0\\0", 5, 0);
  2789. verify_reg(hkey, "Wine69c", REG_SZ, "Value1\\0", 9, 0);
  2790. verify_reg(hkey, "Wine69d", REG_SZ, "Value2\\0\\0\\0\\0", 15, 0);
  2791. verify_reg(hkey, "Wine69e", REG_SZ, "Value3\\0Value4", 15, 0);
  2792. verify_reg(hkey, "Wine69f", REG_SZ, "\\0Value5", 9, 0);
  2793. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2794. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2795. "\"Wine70a\"=\"\\0\"\n"
  2796. "\"Wine70b\"=\"\\0\\0\"\n"
  2797. "\"Wine70c\"=\"Value1\\0\"\n"
  2798. "\"Wine70d\"=\"Value2\\0\\0\\0\\0\"\n"
  2799. "\"Wine70e\"=\"Value3\\0Value4\"\n"
  2800. "\"Wine70f\"=\"\\0Value5\"\n\n", &r);
  2801. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2802. verify_reg_nonexist(hkey, "Wine70a");
  2803. verify_reg_nonexist(hkey, "Wine70b");
  2804. verify_reg_nonexist(hkey, "Wine70c");
  2805. verify_reg_nonexist(hkey, "Wine70d");
  2806. verify_reg_nonexist(hkey, "Wine70e");
  2807. verify_reg_nonexist(hkey, "Wine70f");
  2808. /* Test forward and back slashes */
  2809. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2810. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2811. "\"count/up\"=\"one/two/three\"\n"
  2812. "\"\\\\foo\\\\bar\"=\"\"\n\n"
  2813. "[HKEY_CURRENT_USER\\" KEY_BASE "\\https://winehq.org]\n\n", &r);
  2814. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2815. verify_reg(hkey, "count/up", REG_SZ, "one/two/three", 14, 0);
  2816. verify_reg(hkey, "\\foo\\bar", REG_SZ, "", 1, 0);
  2817. verify_key(hkey, "https://winehq.org");
  2818. close_key(hkey);
  2819. delete_tree(HKEY_CURRENT_USER, KEY_BASE);
  2820. }
  2821. static void test_import_with_whitespace(void)
  2822. {
  2823. HKEY hkey;
  2824. DWORD r, dword;
  2825. delete_tree(HKEY_CURRENT_USER, KEY_BASE);
  2826. verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE);
  2827. test_import_str(" REGEDIT4\n\n"
  2828. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n", &r);
  2829. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2830. open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
  2831. test_import_str(" REGEDIT4\n\n"
  2832. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2833. "\"Wine1a\"=\"Value\"\n\n", &r);
  2834. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2835. verify_reg(hkey, "Wine1a", REG_SZ, "Value", 6, 0);
  2836. test_import_str("\tREGEDIT4\n\n"
  2837. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2838. "\"Wine1b\"=\"Value\"\n\n", &r);
  2839. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2840. verify_reg(hkey, "Wine1b", REG_SZ, "Value", 6, 0);
  2841. test_import_str(" \t REGEDIT4\n\n"
  2842. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2843. "\"Wine1c\"=\"Value\"\n\n", &r);
  2844. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2845. verify_reg(hkey, "Wine1c", REG_SZ, "Value", 6, 0);
  2846. test_import_str("REGEDIT4\n\n"
  2847. " [HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2848. "\"Wine2a\"=\"Value\"\n\n", &r);
  2849. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2850. verify_reg(hkey, "Wine2a", REG_SZ, "Value", 6, 0);
  2851. test_import_str("REGEDIT4\n\n"
  2852. "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2853. "\"Wine2b\"=\"Value\"\n\n", &r);
  2854. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2855. verify_reg(hkey, "Wine2b", REG_SZ, "Value", 6, 0);
  2856. test_import_str("REGEDIT4\n\n"
  2857. " \t [HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2858. "\"Wine2c\"=\"Value\"\n\n", &r);
  2859. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2860. verify_reg(hkey, "Wine2c", REG_SZ, "Value", 6, 0);
  2861. test_import_str("REGEDIT4\n\n"
  2862. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2863. " \"Wine3a\"=\"Two leading spaces\"\n\n", &r);
  2864. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2865. verify_reg(hkey, "Wine3a", REG_SZ, "Two leading spaces", 19, 0);
  2866. test_import_str("REGEDIT4\n\n"
  2867. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2868. "\t\"Wine3b\"=\"One leading tab\"\n\n", &r);
  2869. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2870. verify_reg(hkey, "Wine3b", REG_SZ, "One leading tab", 16, 0);
  2871. test_import_str("REGEDIT4\n\n"
  2872. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2873. " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r);
  2874. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2875. verify_reg(hkey, "Wine3c", REG_SZ, "Space, tab, space", 18, 0);
  2876. test_import_str(" REGEDIT4\n\n"
  2877. "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2878. "\t \"Wine4a\"=\"Tab and four spaces\"\n"
  2879. " \"Wine4b\"=dword:00112233\n"
  2880. "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,69,6e,65,20,\\\n"
  2881. " 63,6f,6e,\\;comment\n"
  2882. "\t\t\t\t63,61,74,\\;comment\n"
  2883. " \t65,6e,61,74,69,6f,6e,00,00\n\n", &r);
  2884. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2885. verify_reg(hkey, "Wine4a", REG_SZ, "Tab and four spaces", 20, 0);
  2886. dword = 0x112233;
  2887. verify_reg(hkey, "Wine4b", REG_DWORD, &dword, sizeof(dword), 0);
  2888. verify_reg(hkey, "Wine4c", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  2889. test_import_str(" REGEDIT4\n\n"
  2890. "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2891. " \"Wine5a\"=\"Leading spaces\"\n"
  2892. "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n"
  2893. "\t \"Wine5c\"=\t \"Tabs and spaces\"\n"
  2894. " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r);
  2895. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2896. verify_reg(hkey, "Wine5a", REG_SZ, "Leading spaces", 15, 0);
  2897. verify_reg(hkey, "Wine5b", REG_SZ, "Leading tabs", 13, 0);
  2898. verify_reg(hkey, "Wine5c", REG_SZ, "Tabs and spaces", 16, 0);
  2899. verify_reg(hkey, "Wine5d", REG_SZ, "More whitespace", 16, 0);
  2900. test_import_str("REGEDIT4\n\n"
  2901. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2902. "\" Wine6a\"=\"Leading spaces\"\n"
  2903. "\"\t\tWine6b\"=\"Leading tabs\"\n"
  2904. " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r);
  2905. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2906. verify_reg(hkey, " Wine6a", REG_SZ, "Leading spaces", 15, 0);
  2907. verify_reg(hkey, "\t\tWine6b", REG_SZ, "Leading tabs", 13, 0);
  2908. verify_reg(hkey, " Wine6c ", REG_SZ, " Spaces everywhere ", 22, 0);
  2909. test_import_str("REGEDIT4\n\n"
  2910. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2911. "\"Wine7a\"=\" Four spaces in the data\"\n"
  2912. "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r);
  2913. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2914. verify_reg(hkey, "Wine7a", REG_SZ, " Four spaces in the data", 28, 0);
  2915. verify_reg(hkey, "Wine7b", REG_SZ, "\t\tTwo tabs in the data", 23, 0);
  2916. test_import_str("REGEDIT4\n\n"
  2917. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2918. "\"Wine8a\"=\"Trailing spaces\" \n"
  2919. "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r);
  2920. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2921. verify_reg(hkey, "Wine8a", REG_SZ, "Trailing spaces", 16, 0);
  2922. verify_reg(hkey, "Wine8b", REG_SZ, "Trailing tabs and spaces", 25, 0);
  2923. test_import_str("REGEDIT4\n\n"
  2924. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2925. "\"Wine9a\"=dword: 00000008\n"
  2926. "\"Wine9b\"=dword:\t\t00000008\n\n", &r);
  2927. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2928. dword = 0x00000008;
  2929. verify_reg(hkey, "Wine9a", REG_DWORD, &dword, sizeof(dword), 0);
  2930. verify_reg(hkey, "Wine9b", REG_DWORD, &dword, sizeof(dword), 0);
  2931. test_import_str("REGEDIT4\n\n"
  2932. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2933. "@ = \"Test Value\"\n\n", &r);
  2934. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2935. verify_reg(hkey, "", REG_SZ, "Test Value", 11, 0);
  2936. test_import_str("REGEDIT4\n\n"
  2937. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2938. "\t@\t=\tdword:\t00000008\t\n\n", &r);
  2939. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2940. verify_reg(hkey, "", REG_DWORD, &dword, sizeof(DWORD), 0);
  2941. close_key(hkey);
  2942. delete_key(HKEY_CURRENT_USER, KEY_BASE);
  2943. }
  2944. static void test_unicode_import_with_whitespace(void)
  2945. {
  2946. HKEY hkey;
  2947. DWORD r, dword;
  2948. delete_tree(HKEY_CURRENT_USER, KEY_BASE);
  2949. verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE);
  2950. test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
  2951. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n", &r);
  2952. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2953. open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
  2954. test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
  2955. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2956. "\"Wine1a\"=\"Value\"\n\n", &r);
  2957. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2958. verify_reg(hkey, "Wine1a", REG_SZ, "Value", 6, 0);
  2959. test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n\n"
  2960. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2961. "\"Wine1b\"=\"Value\"\n\n", &r);
  2962. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2963. verify_reg(hkey, "Wine1b", REG_SZ, "Value", 6, 0);
  2964. test_import_wstr("\xef\xbb\xbf \t Windows Registry Editor Version 5.00\n\n"
  2965. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2966. "\"Wine1c\"=\"Value\"\n\n", &r);
  2967. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2968. verify_reg(hkey, "Wine1c", REG_SZ, "Value", 6, 0);
  2969. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2970. " [HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2971. "\"Wine2a\"=\"Value\"\n\n", &r);
  2972. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2973. verify_reg(hkey, "Wine2a", REG_SZ, "Value", 6, 0);
  2974. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2975. "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2976. "\"Wine2b\"=\"Value\"\n\n", &r);
  2977. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2978. verify_reg(hkey, "Wine2b", REG_SZ, "Value", 6, 0);
  2979. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2980. " \t [HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2981. "\"Wine2c\"=\"Value\"\n\n", &r);
  2982. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2983. verify_reg(hkey, "Wine2c", REG_SZ, "Value", 6, 0);
  2984. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2985. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2986. " \"Wine3a\"=\"Two leading spaces\"\n\n", &r);
  2987. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2988. verify_reg(hkey, "Wine3a", REG_SZ, "Two leading spaces", 19, 0);
  2989. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2990. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2991. "\t\"Wine3b\"=\"One leading tab\"\n\n", &r);
  2992. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2993. verify_reg(hkey, "Wine3b", REG_SZ, "One leading tab", 16, 0);
  2994. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  2995. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  2996. " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r);
  2997. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  2998. verify_reg(hkey, "Wine3c", REG_SZ, "Space, tab, space", 18, 0);
  2999. test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
  3000. "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  3001. "\t \"Wine4a\"=\"Tab and four spaces\"\n"
  3002. " \"Wine4b\"=dword:00112233\n"
  3003. "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
  3004. " 63,00,6f,00,6e,00,\\;comment\n"
  3005. "\t\t\t\t63,00,61,00,74,00,\\;comment\n"
  3006. " \t65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
  3007. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3008. verify_reg(hkey, "Wine4a", REG_SZ, "Tab and four spaces", 20, 0);
  3009. dword = 0x112233;
  3010. verify_reg(hkey, "Wine4b", REG_DWORD, &dword, sizeof(dword), 0);
  3011. verify_reg(hkey, "Wine4c", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
  3012. test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
  3013. "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  3014. " \"Wine5a\"=\"Leading spaces\"\n"
  3015. "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n"
  3016. "\t \"Wine5c\"=\t \"Tabs and spaces\"\n"
  3017. " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r);
  3018. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3019. verify_reg(hkey, "Wine5a", REG_SZ, "Leading spaces", 15, 0);
  3020. verify_reg(hkey, "Wine5b", REG_SZ, "Leading tabs", 13, 0);
  3021. verify_reg(hkey, "Wine5c", REG_SZ, "Tabs and spaces", 16, 0);
  3022. verify_reg(hkey, "Wine5d", REG_SZ, "More whitespace", 16, 0);
  3023. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  3024. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  3025. "\" Wine6a\"=\"Leading spaces\"\n"
  3026. "\"\t\tWine6b\"=\"Leading tabs\"\n"
  3027. " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r);
  3028. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3029. verify_reg(hkey, " Wine6a", REG_SZ, "Leading spaces", 15, 0);
  3030. verify_reg(hkey, "\t\tWine6b", REG_SZ, "Leading tabs", 13, 0);
  3031. verify_reg(hkey, " Wine6c ", REG_SZ, " Spaces everywhere ", 22, 0);
  3032. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  3033. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  3034. "\"Wine7a\"=\" Four spaces in the data\"\n"
  3035. "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r);
  3036. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3037. verify_reg(hkey, "Wine7a", REG_SZ, " Four spaces in the data", 28, 0);
  3038. verify_reg(hkey, "Wine7b", REG_SZ, "\t\tTwo tabs in the data", 23, 0);
  3039. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  3040. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  3041. "\"Wine8a\"=\"Trailing spaces\" \n"
  3042. "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r);
  3043. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3044. verify_reg(hkey, "Wine8a", REG_SZ, "Trailing spaces", 16, 0);
  3045. verify_reg(hkey, "Wine8b", REG_SZ, "Trailing tabs and spaces", 25, 0);
  3046. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  3047. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  3048. "\"Wine9a\"=dword: 00000008\n"
  3049. "\"Wine9b\"=dword:\t\t00000008\n\n", &r);
  3050. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3051. dword = 0x00000008;
  3052. verify_reg(hkey, "Wine9a", REG_DWORD, &dword, sizeof(dword), 0);
  3053. verify_reg(hkey, "Wine9b", REG_DWORD, &dword, sizeof(dword), 0);
  3054. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  3055. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  3056. "@ = \"Test Value\"\n\n", &r);
  3057. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3058. verify_reg(hkey, "", REG_SZ, "Test Value", 11, 0);
  3059. test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
  3060. "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
  3061. "\t@\t=\tdword:\t00000008\t\n\n", &r);
  3062. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3063. verify_reg(hkey, "", REG_DWORD, &dword, sizeof(DWORD), 0);
  3064. close_key(hkey);
  3065. delete_key(HKEY_CURRENT_USER, KEY_BASE);
  3066. }
  3067. static void test_import_win31(void)
  3068. {
  3069. LONG err;
  3070. HKEY hkey;
  3071. DWORD r;
  3072. /* Check if reg.exe is running with elevated privileges */
  3073. err = RegDeleteKeyA(HKEY_CLASSES_ROOT, KEY_BASE);
  3074. if (err == ERROR_ACCESS_DENIED)
  3075. {
  3076. win_skip("reg.exe is not running with elevated privileges; "
  3077. "skipping Windows 3.1 import tests\n");
  3078. return;
  3079. }
  3080. if (err == ERROR_FILE_NOT_FOUND)
  3081. {
  3082. if (RegCreateKeyExA(HKEY_CLASSES_ROOT, KEY_BASE, 0, NULL, REG_OPTION_NON_VOLATILE,
  3083. KEY_READ, NULL, &hkey, NULL))
  3084. {
  3085. win_skip("reg.exe is not running with elevated privileges; "
  3086. "skipping Windows 3.1 import tests\n");
  3087. return;
  3088. }
  3089. RegCloseKey(hkey);
  3090. RegDeleteKeyA(HKEY_CLASSES_ROOT, KEY_BASE);
  3091. }
  3092. /* Test simple value */
  3093. test_import_str("REGEDIT\r\n"
  3094. "HKEY_CLASSES_ROOT\\" KEY_BASE " = Value0\r\n", &r);
  3095. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3096. open_key(HKEY_CLASSES_ROOT, KEY_BASE, KEY_SET_VALUE, &hkey);
  3097. verify_reg(hkey, "", REG_SZ, "Value0", 7, 0);
  3098. /* Test proper handling of spaces and equals signs */
  3099. test_import_str("REGEDIT\r\n"
  3100. "HKEY_CLASSES_ROOT\\" KEY_BASE " =Value1\r\n", &r);
  3101. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3102. verify_reg(hkey, "", REG_SZ, "Value1", 7, 0);
  3103. test_import_str("REGEDIT\r\n"
  3104. "HKEY_CLASSES_ROOT\\" KEY_BASE " = Value2\r\n", &r);
  3105. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3106. verify_reg(hkey, "", REG_SZ, " Value2", 8, 0);
  3107. test_import_str("REGEDIT\r\n"
  3108. "HKEY_CLASSES_ROOT\\" KEY_BASE " = Value3 \r\n", &r);
  3109. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3110. verify_reg(hkey, "", REG_SZ, "Value3 ", 8, 0);
  3111. test_import_str("REGEDIT\r\n"
  3112. "HKEY_CLASSES_ROOT\\" KEY_BASE " Value4\r\n", &r);
  3113. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3114. verify_reg(hkey, "", REG_SZ, "Value4", 7, 0);
  3115. test_import_str("REGEDIT\r\n"
  3116. "HKEY_CLASSES_ROOT\\" KEY_BASE " Value5\r\n", &r);
  3117. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3118. verify_reg(hkey, "", REG_SZ, "Value5", 7, 0);
  3119. test_import_str("REGEDIT\r\n"
  3120. "HKEY_CLASSES_ROOT\\" KEY_BASE "\r\n", &r);
  3121. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3122. verify_reg(hkey, "", REG_SZ, "", 1, 0);
  3123. test_import_str("REGEDIT\r\n"
  3124. "HKEY_CLASSES_ROOT\\" KEY_BASE " \r\n", &r);
  3125. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3126. verify_reg(hkey, "", REG_SZ, "", 1, 0);
  3127. test_import_str("REGEDIT\r\n"
  3128. "HKEY_CLASSES_ROOT\\" KEY_BASE " = No newline", &r);
  3129. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3130. verify_reg(hkey, "", REG_SZ, "No newline", 11, 0);
  3131. delete_value(hkey, NULL);
  3132. /* Test character validity at the start of the line */
  3133. test_import_str("REGEDIT\r\n"
  3134. " HKEY_CLASSES_ROOT\\" KEY_BASE " = Value1a\r\n", &r);
  3135. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3136. verify_reg_nonexist(hkey, "");
  3137. test_import_str("REGEDIT\r\n"
  3138. " HKEY_CLASSES_ROOT\\" KEY_BASE " = Value1b\r\n", &r);
  3139. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3140. verify_reg_nonexist(hkey, "");
  3141. test_import_str("REGEDIT\r\n"
  3142. "\tHKEY_CLASSES_ROOT\\" KEY_BASE " = Value1c\r\n", &r);
  3143. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3144. verify_reg_nonexist(hkey, "");
  3145. test_import_str("REGEDIT\r\n"
  3146. ";HKEY_CLASSES_ROOT\\" KEY_BASE " = Value2a\r\n", &r);
  3147. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3148. verify_reg_nonexist(hkey, "");
  3149. test_import_str("REGEDIT\r\n"
  3150. "#HKEY_CLASSES_ROOT\\" KEY_BASE " = Value2b\r\n", &r);
  3151. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3152. verify_reg_nonexist(hkey, "");
  3153. /* Test case sensitivity */
  3154. test_import_str("REGEDIT\r\n"
  3155. "hkey_classes_root\\" KEY_BASE " = Value3a\r\n", &r);
  3156. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3157. verify_reg_nonexist(hkey, "");
  3158. test_import_str("REGEDIT\r\n"
  3159. "hKEY_CLASSES_ROOT\\" KEY_BASE " = Value3b\r\n", &r);
  3160. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3161. verify_reg_nonexist(hkey, "");
  3162. test_import_str("REGEDIT\r\n"
  3163. "Hkey_Classes_Root\\" KEY_BASE " = Value3c\r\n", &r);
  3164. ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
  3165. verify_reg_nonexist(hkey, "");
  3166. close_key(hkey);
  3167. delete_key(HKEY_CLASSES_ROOT, KEY_BASE);
  3168. }
  3169. START_TEST(import)
  3170. {
  3171. DWORD r;
  3172. if (!run_reg_exe("reg.exe /?", &r)) {
  3173. win_skip("reg.exe not available, skipping 'import' tests\n");
  3174. return;
  3175. }
  3176. test_import();
  3177. test_unicode_import();
  3178. test_import_with_whitespace();
  3179. test_unicode_import_with_whitespace();
  3180. test_import_win31();
  3181. }