2 * Copyright (C) 2005 Mike McCormack for CodeWeavers
3 * Copyright (C) 2005 Aric Stewart for CodeWeavers
5 * A test program for MSI record formatting
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/test.h"
30 static const char msifile
[] = "winetest-format.msi";
32 static UINT
package_from_db(MSIHANDLE hdb
, MSIHANDLE
*handle
)
38 sprintf(szPackage
, "#%u", hdb
);
39 res
= MsiOpenPackageA(szPackage
, &hPackage
);
40 if (res
!= ERROR_SUCCESS
)
43 res
= MsiCloseHandle(hdb
);
44 if (res
!= ERROR_SUCCESS
)
46 MsiCloseHandle(hPackage
);
54 static UINT
helper_createpackage( const char *szName
, MSIHANDLE
*handle
)
56 MSIHANDLE hPackage
, suminfo
, hdb
= 0;
63 len
= MultiByteToWideChar( CP_ACP
, 0, szName
, -1, NULL
, 0 );
64 if (!(nameW
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) )))
65 return ERROR_OUTOFMEMORY
;
66 MultiByteToWideChar( CP_ACP
, 0, szName
, -1, nameW
, len
);
68 /* create an empty database */
69 res
= MsiOpenDatabaseW( nameW
, MSIDBOPEN_CREATEDIRECT
, &hdb
);
70 HeapFree( GetProcessHeap(), 0, nameW
);
71 ok( res
== ERROR_SUCCESS
, "Failed to create database %u\n", res
);
72 if (res
!= ERROR_SUCCESS
)
75 res
= MsiDatabaseCommit( hdb
);
76 ok( res
== ERROR_SUCCESS
, "Failed to commit database %u\n", res
);
78 /* build summary info */
79 res
= MsiGetSummaryInformationA(hdb
, NULL
, 7, &suminfo
);
80 ok( res
== ERROR_SUCCESS
, "Failed to open summaryinfo\n" );
82 res
= MsiSummaryInfoSetPropertyA(suminfo
,2, VT_LPSTR
, 0,NULL
,
83 "Installation Database");
84 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
86 res
= MsiSummaryInfoSetPropertyA(suminfo
,3, VT_LPSTR
, 0,NULL
,
87 "Installation Database");
88 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
90 res
= MsiSummaryInfoSetPropertyA(suminfo
,4, VT_LPSTR
, 0,NULL
,
92 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
94 res
= MsiSummaryInfoSetPropertyA(suminfo
,7, VT_LPSTR
, 0,NULL
,
96 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
98 res
= MsiSummaryInfoSetPropertyA(suminfo
,9, VT_LPSTR
, 0,NULL
,
99 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
100 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
102 res
= MsiSummaryInfoSetPropertyA(suminfo
, 14, VT_I4
, 100, NULL
, NULL
);
103 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
105 res
= MsiSummaryInfoSetPropertyA(suminfo
, 15, VT_I4
, 0, NULL
, NULL
);
106 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
108 res
= MsiSummaryInfoPersist(suminfo
);
109 ok( res
== ERROR_SUCCESS
, "Failed to make summary info persist\n" );
111 res
= MsiCloseHandle( suminfo
);
112 ok( res
== ERROR_SUCCESS
, "Failed to close suminfo\n" );
114 res
= package_from_db( hdb
, &hPackage
);
117 if (res
!= ERROR_SUCCESS
)
118 DeleteFileA( szName
);
125 static void test_createpackage(void)
127 MSIHANDLE hPackage
= 0;
130 res
= helper_createpackage( msifile
, &hPackage
);
131 if (res
== ERROR_INSTALL_PACKAGE_REJECTED
)
133 skip("Not enough rights to perform tests\n");
136 ok( res
== ERROR_SUCCESS
, "Failed to create package %u\n", res
);
138 res
= MsiCloseHandle( hPackage
);
139 ok( res
== ERROR_SUCCESS
, "Failed to close package %u\n", res
);
141 DeleteFileA( msifile
);
144 static void test_formatrecord(void)
151 r
= MsiFormatRecordA(0, 0, NULL
, NULL
);
152 ok( r
== ERROR_INVALID_HANDLE
, "wrong error\n");
154 hrec
= MsiCreateRecord(0);
155 ok( hrec
, "failed to create record\n");
157 /* format an empty record on a record with no parameters */
159 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
160 ok( r
== ERROR_SUCCESS
, "format failed\n");
161 ok( sz
== 0, "size wrong\n");
163 MsiCloseHandle( hrec
);
165 hrec
= MsiCreateRecord(4);
166 ok( hrec
, "failed to create record\n");
168 /* format an empty record */
169 r
= MsiFormatRecordA(0, hrec
, NULL
, NULL
);
170 ok( r
== ERROR_SUCCESS
, "format failed\n");
174 r
= MsiFormatRecordA(0, hrec
, buffer
+1, &sz
);
175 ok( r
== ERROR_MORE_DATA
&& buffer
[0] == 'x', "format failed measuring with buffer\n");
176 ok( sz
== 16, "size wrong\n");
178 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
179 ok( r
== ERROR_SUCCESS
, "format failed with empty buffer\n");
180 ok( sz
== 16, "size wrong\n");
181 ok( 0 == strcmp(buffer
,"1: 2: 3: 4: "), "wrong output\n");
183 r
= MsiCloseHandle(hrec
);
184 ok(r
==ERROR_SUCCESS
, "Unable to close record\n");
186 hrec
= MsiCreateRecord(6);
187 ok( hrec
, "failed to create record\n");
192 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
193 ok( r
== ERROR_SUCCESS
, "format failed with empty buffer\n");
194 ok( sz
== 24, "size wrong\n");
195 ok( 0 == strcmp(buffer
,"1: 2: 3: 4: 5: 6: "), "wrong output\n");
198 /* format a format string with everything else empty */
199 r
= MsiRecordSetStringA(hrec
, 0, "%1");
200 ok( r
== ERROR_SUCCESS
, "set string failed\n");
201 r
= MsiFormatRecordA(0, hrec
, NULL
, NULL
);
202 ok( r
== ERROR_SUCCESS
, "format failed\n");
203 r
= MsiFormatRecordA(0, hrec
, buffer
, NULL
);
204 ok( r
== ERROR_INVALID_PARAMETER
, "wrong error\n");
207 r
= MsiFormatRecordA(0, hrec
, NULL
, &sz
);
208 ok( r
== ERROR_SUCCESS
, "format failed with empty buffer\n");
209 ok( sz
== 2, "size wrong (%i)\n",sz
);
213 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
214 ok( r
== ERROR_SUCCESS
, "format failed with empty buffer\n");
215 ok( sz
== 2, "size wrong\n");
216 ok( 0 == strcmp(buffer
,"%1"), "wrong output\n");
218 /* make the buffer too small */
222 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
223 ok( r
== ERROR_MORE_DATA
, "format failed with empty buffer\n");
224 ok( sz
== 2, "size wrong\n");
225 ok( 0 == strcmp(buffer
,"x"), "wrong output\n");
227 /* make the buffer a little bit bigger */
231 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
232 ok( r
== ERROR_MORE_DATA
, "format failed with empty buffer\n");
233 ok( sz
== 2, "size wrong\n");
234 ok( 0 == strcmp(buffer
,""), "wrong output (%s)\n",buffer
);
240 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
241 ok( r
== ERROR_MORE_DATA
, "format failed with empty buffer\n");
242 ok( sz
== 2, "size wrong\n");
243 ok( 0 == strcmp(buffer
,"%"), "wrong output\n");
249 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
250 ok( r
== ERROR_SUCCESS
, "format failed with empty buffer\n");
251 ok( sz
== 2, "size wrong\n");
252 ok( 0 == strcmp(buffer
,"%1"), "wrong output\n");
254 /* now try a real format string */
255 r
= MsiRecordSetStringA(hrec
, 0, "[1]");
256 ok( r
== ERROR_SUCCESS
, "set string failed\n");
258 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
259 ok( r
== ERROR_SUCCESS
, "format failed\n");
260 ok( sz
== 0, "size wrong\n");
261 ok( 0 == strcmp(buffer
,""), "wrong output\n");
263 /* now put something in the first field */
264 r
= MsiRecordSetStringA(hrec
, 1, "boo hoo");
265 ok( r
== ERROR_SUCCESS
, "set string failed\n");
267 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
268 ok( r
== ERROR_SUCCESS
, "format failed\n");
269 ok( sz
== 7, "size wrong\n");
270 ok( 0 == strcmp(buffer
,"boo hoo"), "wrong output\n");
272 /* now put something in the first field */
273 r
= MsiRecordSetStringA(hrec
, 0, "[1] [2]");
274 ok( r
== ERROR_SUCCESS
, "set string failed\n");
275 r
= MsiRecordSetStringA(hrec
, 1, "boo");
276 ok( r
== ERROR_SUCCESS
, "set string failed\n");
277 r
= MsiRecordSetStringA(hrec
, 2, "hoo");
278 ok( r
== ERROR_SUCCESS
, "set string failed\n");
280 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
281 ok( r
== ERROR_SUCCESS
, "format failed\n");
282 ok( sz
== 7, "size wrong\n");
283 ok( 0 == strcmp(buffer
,"boo hoo"), "wrong output\n");
285 /* self-referential format field */
286 r
= MsiRecordSetStringA(hrec
, 0, "[1] test [0]");
287 ok( r
== ERROR_SUCCESS
, "set string failed\n");
289 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
290 ok( r
== ERROR_SUCCESS
, "format failed\n");
291 ok( sz
== 21, "size wrong\n");
292 ok( 0 == strcmp(buffer
,"boo test [1] test [0]"), "wrong output\n");
295 r
= MsiRecordSetStringA(hrec
, 0, "");
296 ok( r
== ERROR_SUCCESS
, "set string failed\n");
298 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
299 ok( r
== ERROR_SUCCESS
, "format failed\n");
300 ok( sz
== 30, "size wrong %i\n",sz
);
301 ok( 0 == strcmp(buffer
,"1: boo 2: hoo 3: 4: 5: 6: "),
302 "wrong output(%s)\n",buffer
);
304 /* empty string with numbers */
305 r
= MsiRecordSetStringA(hrec
, 1, "123");
306 ok( r
== ERROR_SUCCESS
, "set string failed\n");
307 r
= MsiRecordSetInteger(hrec
, 2, 4567);
308 ok( r
== ERROR_SUCCESS
, "set string failed\n");
310 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
311 ok( r
== ERROR_SUCCESS
, "format failed\n");
312 ok( sz
== 31, "size wrong %i\n",sz
);
313 ok( 0 == strcmp(buffer
,"1: 123 2: 4567 3: 4: 5: 6: "),
314 "wrong output(%s)\n",buffer
);
316 /* play games with recursive lookups */
317 r
= MsiRecordSetStringA(hrec
, 0, "[[1]] [2]");
318 ok( r
== ERROR_SUCCESS
, "set string failed\n");
319 r
= MsiRecordSetStringA(hrec
, 1, "2");
320 ok( r
== ERROR_SUCCESS
, "set string failed\n");
321 r
= MsiRecordSetStringA(hrec
, 2, "hey");
322 ok( r
== ERROR_SUCCESS
, "set string failed\n");
324 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
325 ok( r
== ERROR_SUCCESS
, "format failed\n");
326 ok( sz
== 7, "size wrong,(%i)\n",sz
);
327 ok( 0 == strcmp(buffer
,"hey hey"), "wrong output (%s)\n",buffer
);
329 r
= MsiRecordSetStringA(hrec
, 0, "[[1]] [2]");
330 ok( r
== ERROR_SUCCESS
, "set string failed\n");
331 r
= MsiRecordSetStringA(hrec
, 1, "[2]");
332 ok( r
== ERROR_SUCCESS
, "set string failed\n");
333 r
= MsiRecordSetStringA(hrec
, 2, "hey");
334 ok( r
== ERROR_SUCCESS
, "set string failed\n");
336 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
337 ok( r
== ERROR_SUCCESS
, "format failed\n");
338 ok( sz
== 9, "size wrong,(%i)\n",sz
);
339 ok( 0 == strcmp(buffer
,"[[2]] hey"), "wrong output (%s)\n",buffer
);
341 r
= MsiRecordSetStringA(hrec
, 0, "[[[3]]] [2]");
342 ok( r
== ERROR_SUCCESS
, "set string failed\n");
343 r
= MsiRecordSetStringA(hrec
, 1, "2");
344 ok( r
== ERROR_SUCCESS
, "set string failed\n");
345 r
= MsiRecordSetStringA(hrec
, 2, "hey");
346 ok( r
== ERROR_SUCCESS
, "set string failed\n");
347 r
= MsiRecordSetStringA(hrec
, 3, "1");
348 ok( r
== ERROR_SUCCESS
, "set string failed\n");
350 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
351 ok( r
== ERROR_SUCCESS
, "format failed\n");
352 ok( sz
== 7, "size wrong,(%i)\n",sz
);
353 ok( 0 == strcmp(buffer
,"hey hey"), "wrong output (%s)\n",buffer
);
355 r
= MsiCloseHandle(hrec
);
356 ok(r
==ERROR_SUCCESS
, "Unable to close record\n");
357 hrec
= MsiCreateRecord(12);
358 ok( hrec
, "failed to create record\n");
360 r
= MsiRecordSetStringA(hrec
, 0, "[[3][1]] [2]");
361 ok( r
== ERROR_SUCCESS
, "set string failed\n");
362 r
= MsiRecordSetStringA(hrec
, 1, "2");
363 ok( r
== ERROR_SUCCESS
, "set string failed\n");
364 r
= MsiRecordSetStringA(hrec
, 2, "hey");
365 ok( r
== ERROR_SUCCESS
, "set string failed\n");
366 r
= MsiRecordSetStringA(hrec
, 3, "1");
367 ok( r
== ERROR_SUCCESS
, "set string failed\n");
368 r
= MsiRecordSetStringA(hrec
, 12, "big");
369 ok( r
== ERROR_SUCCESS
, "set string failed\n");
371 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
372 ok( r
== ERROR_SUCCESS
, "format failed\n");
373 ok( sz
== 7, "size wrong,(%i)\n",sz
);
374 ok( 0 == strcmp(buffer
,"big hey"), "wrong output (%s)\n",buffer
);
376 r
= MsiRecordSetStringA(hrec
, 0, "[[3][4][1]] [2]");
377 ok( r
== ERROR_SUCCESS
, "set string failed\n");
378 r
= MsiRecordSetStringA(hrec
, 1, "2");
379 ok( r
== ERROR_SUCCESS
, "set string failed\n");
380 r
= MsiRecordSetStringA(hrec
, 2, "hey");
381 ok( r
== ERROR_SUCCESS
, "set string failed\n");
382 r
= MsiRecordSetStringA(hrec
, 3, "1");
383 ok( r
== ERROR_SUCCESS
, "set string failed\n");
384 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
385 ok( r
== ERROR_SUCCESS
, "set string failed\n");
386 r
= MsiRecordSetStringA(hrec
, 12, "big");
387 ok( r
== ERROR_SUCCESS
, "set string failed\n");
389 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
390 ok( r
== ERROR_SUCCESS
, "format failed\n");
391 ok( sz
== 7, "size wrong,(%i)\n",sz
);
392 ok( 0 == strcmp(buffer
,"big hey"), "wrong output (%s)\n",buffer
);
394 r
= MsiRecordSetStringA(hrec
, 0, "[[3][[4]][1]] [2]");
395 ok( r
== ERROR_SUCCESS
, "set string failed\n");
396 r
= MsiRecordSetStringA(hrec
, 1, "2");
397 ok( r
== ERROR_SUCCESS
, "set string failed\n");
398 r
= MsiRecordSetStringA(hrec
, 2, "hey");
399 ok( r
== ERROR_SUCCESS
, "set string failed\n");
400 r
= MsiRecordSetStringA(hrec
, 3, "1");
401 ok( r
== ERROR_SUCCESS
, "set string failed\n");
402 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
403 ok( r
== ERROR_SUCCESS
, "set string failed\n");
404 r
= MsiRecordSetStringA(hrec
, 12, "big");
405 ok( r
== ERROR_SUCCESS
, "set string failed\n");
407 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
408 ok( r
== ERROR_SUCCESS
, "format failed\n");
409 ok( sz
== 10, "size wrong,(%i)\n",sz
);
410 ok( 0 == strcmp(buffer
,"[1[]2] hey"), "wrong output (%s)\n",buffer
);
412 /* incorrect formats */
413 r
= MsiRecordSetStringA(hrec
, 0, "[[[3][[4]][1]] [2]");
414 ok( r
== ERROR_SUCCESS
, "set string failed\n");
415 r
= MsiRecordSetStringA(hrec
, 1, "2");
416 ok( r
== ERROR_SUCCESS
, "set string failed\n");
417 r
= MsiRecordSetStringA(hrec
, 2, "hey");
418 ok( r
== ERROR_SUCCESS
, "set string failed\n");
419 r
= MsiRecordSetStringA(hrec
, 3, "1");
420 ok( r
== ERROR_SUCCESS
, "set string failed\n");
421 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
422 ok( r
== ERROR_SUCCESS
, "set string failed\n");
423 r
= MsiRecordSetStringA(hrec
, 12, "big");
424 ok( r
== ERROR_SUCCESS
, "set string failed\n");
426 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
427 ok( r
== ERROR_SUCCESS
, "format failed\n");
428 ok( sz
== 18, "size wrong,(%i)\n",sz
);
429 ok( 0 == strcmp(buffer
,"[[[3][[4]][1]] [2]"), "wrong output (%s)\n",buffer
);
431 r
= MsiRecordSetStringA(hrec
, 0, "[[3][[4]][1]] [2]]");
432 ok( r
== ERROR_SUCCESS
, "set string failed\n");
433 r
= MsiRecordSetStringA(hrec
, 1, "2");
434 ok( r
== ERROR_SUCCESS
, "set string failed\n");
435 r
= MsiRecordSetStringA(hrec
, 2, "hey");
436 ok( r
== ERROR_SUCCESS
, "set string failed\n");
437 r
= MsiRecordSetStringA(hrec
, 3, "1");
438 ok( r
== ERROR_SUCCESS
, "set string failed\n");
439 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
440 ok( r
== ERROR_SUCCESS
, "set string failed\n");
441 r
= MsiRecordSetStringA(hrec
, 12, "big");
442 ok( r
== ERROR_SUCCESS
, "set string failed\n");
444 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
445 ok( r
== ERROR_SUCCESS
, "format failed\n");
446 ok( sz
== 11, "size wrong,(%i)\n",sz
);
447 ok( 0 == strcmp(buffer
,"[1[]2] hey]"), "wrong output (%s)\n",buffer
);
450 /* play games with {} */
452 r
= MsiRecordSetStringA(hrec
, 0, "{[3][1]} [2]");
453 ok( r
== ERROR_SUCCESS
, "set string failed\n");
454 r
= MsiRecordSetStringA(hrec
, 1, "2");
455 ok( r
== ERROR_SUCCESS
, "set string failed\n");
456 r
= MsiRecordSetStringA(hrec
, 2, "hey");
457 ok( r
== ERROR_SUCCESS
, "set string failed\n");
458 r
= MsiRecordSetStringA(hrec
, 3, "1");
459 ok( r
== ERROR_SUCCESS
, "set string failed\n");
460 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
461 ok( r
== ERROR_SUCCESS
, "set string failed\n");
462 r
= MsiRecordSetStringA(hrec
, 12, "big");
463 ok( r
== ERROR_SUCCESS
, "set string failed\n");
465 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
466 ok( r
== ERROR_SUCCESS
, "format failed\n");
467 ok( sz
== 6, "size wrong,(%i)\n",sz
);
468 ok( 0 == strcmp(buffer
,"12 hey"), "wrong output (%s)\n",buffer
);
470 r
= MsiRecordSetStringA(hrec
, 0, "[{[3][1]}] [2]");
471 ok( r
== ERROR_SUCCESS
, "set string failed\n");
472 r
= MsiRecordSetStringA(hrec
, 1, "2");
473 ok( r
== ERROR_SUCCESS
, "set string failed\n");
474 r
= MsiRecordSetStringA(hrec
, 2, "hey");
475 ok( r
== ERROR_SUCCESS
, "set string failed\n");
476 r
= MsiRecordSetStringA(hrec
, 3, "1");
477 ok( r
== ERROR_SUCCESS
, "set string failed\n");
478 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
479 ok( r
== ERROR_SUCCESS
, "set string failed\n");
480 r
= MsiRecordSetStringA(hrec
, 12, "big");
481 ok( r
== ERROR_SUCCESS
, "set string failed\n");
483 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
484 ok( r
== ERROR_SUCCESS
, "format failed\n");
485 ok( sz
== 8, "size wrong,(%i)\n",sz
);
486 ok( 0 == strcmp(buffer
,"[12] hey"), "wrong output (%s)\n",buffer
);
489 r
= MsiRecordSetStringA(hrec
, 0, "{test} [2]");
490 ok( r
== ERROR_SUCCESS
, "set string failed\n");
491 r
= MsiRecordSetStringA(hrec
, 1, "2");
492 ok( r
== ERROR_SUCCESS
, "set string failed\n");
493 r
= MsiRecordSetStringA(hrec
, 2, "hey");
494 ok( r
== ERROR_SUCCESS
, "set string failed\n");
495 r
= MsiRecordSetStringA(hrec
, 3, "1");
496 ok( r
== ERROR_SUCCESS
, "set string failed\n");
497 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
498 ok( r
== ERROR_SUCCESS
, "set string failed\n");
499 r
= MsiRecordSetStringA(hrec
, 12, "big");
500 ok( r
== ERROR_SUCCESS
, "set string failed\n");
502 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
503 ok( r
== ERROR_SUCCESS
, "format failed\n");
504 ok( sz
== 10, "size wrong,(%i)\n",sz
);
505 ok( 0 == strcmp(buffer
,"{test} hey"), "wrong output (%s)\n",buffer
);
507 r
= MsiRecordSetStringA(hrec
, 0, "{[test]} [2]");
508 ok( r
== ERROR_SUCCESS
, "set string failed\n");
509 r
= MsiRecordSetStringA(hrec
, 1, "2");
510 ok( r
== ERROR_SUCCESS
, "set string failed\n");
511 r
= MsiRecordSetStringA(hrec
, 2, "hey");
512 ok( r
== ERROR_SUCCESS
, "set string failed\n");
513 r
= MsiRecordSetStringA(hrec
, 3, "1");
514 ok( r
== ERROR_SUCCESS
, "set string failed\n");
515 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
516 ok( r
== ERROR_SUCCESS
, "set string failed\n");
517 r
= MsiRecordSetStringA(hrec
, 12, "big");
518 ok( r
== ERROR_SUCCESS
, "set string failed\n");
520 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
521 ok( r
== ERROR_SUCCESS
, "format failed\n");
522 ok( sz
== 12, "size wrong,(%i)\n",sz
);
523 ok( 0 == strcmp(buffer
,"{[test]} hey"), "wrong output (%s)\n",buffer
);
525 r
= MsiRecordSetStringA(hrec
, 0, "{[1][2][3][4]} [2]");
526 ok( r
== ERROR_SUCCESS
, "set string failed\n");
527 r
= MsiRecordSetStringA(hrec
, 1, "2");
528 ok( r
== ERROR_SUCCESS
, "set string failed\n");
529 r
= MsiRecordSetStringA(hrec
, 2, "hey");
530 ok( r
== ERROR_SUCCESS
, "set string failed\n");
531 r
= MsiRecordSetStringA(hrec
, 3, "1");
532 ok( r
== ERROR_SUCCESS
, "set string failed\n");
533 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
534 ok( r
== ERROR_SUCCESS
, "set string failed\n");
535 r
= MsiRecordSetStringA(hrec
, 12, "big");
536 ok( r
== ERROR_SUCCESS
, "set string failed\n");
538 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
539 ok( r
== ERROR_SUCCESS
, "format failed\n");
540 ok( sz
== 4, "size wrong,(%i)\n",sz
);
541 ok( 0 == strcmp(buffer
," hey"), "wrong output (%s)\n",buffer
);
543 r
= MsiRecordSetStringA(hrec
, 0, "{[1][2][3][dummy]} [2]");
544 ok( r
== ERROR_SUCCESS
, "set string failed\n");
545 r
= MsiRecordSetStringA(hrec
, 1, "2");
546 ok( r
== ERROR_SUCCESS
, "set string failed\n");
547 r
= MsiRecordSetStringA(hrec
, 2, "hey");
548 ok( r
== ERROR_SUCCESS
, "set string failed\n");
549 r
= MsiRecordSetStringA(hrec
, 3, "1");
550 ok( r
== ERROR_SUCCESS
, "set string failed\n");
551 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
552 ok( r
== ERROR_SUCCESS
, "set string failed\n");
553 r
= MsiRecordSetStringA(hrec
, 12, "big");
554 ok( r
== ERROR_SUCCESS
, "set string failed\n");
556 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
557 ok( r
== ERROR_SUCCESS
, "format failed\n");
558 ok( sz
== 18, "size wrong,(%i)\n",sz
);
559 ok( 0 == strcmp(buffer
,"{2hey1[dummy]} hey"), "wrong output (%s)\n",buffer
);
561 r
= MsiRecordSetStringA(hrec
, 0, "{[1][2][3][4][dummy]} [2]");
562 ok( r
== ERROR_SUCCESS
, "set string failed\n");
563 r
= MsiRecordSetStringA(hrec
, 1, "2");
564 ok( r
== ERROR_SUCCESS
, "set string failed\n");
565 r
= MsiRecordSetStringA(hrec
, 2, "hey");
566 ok( r
== ERROR_SUCCESS
, "set string failed\n");
567 r
= MsiRecordSetStringA(hrec
, 3, "1");
568 ok( r
== ERROR_SUCCESS
, "set string failed\n");
569 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
570 ok( r
== ERROR_SUCCESS
, "set string failed\n");
571 r
= MsiRecordSetStringA(hrec
, 12, "big");
572 ok( r
== ERROR_SUCCESS
, "set string failed\n");
574 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
575 ok( r
== ERROR_SUCCESS
, "format failed\n");
576 ok( sz
== 18, "size wrong,(%i)\n",sz
);
577 ok( 0 == strcmp(buffer
,"{2hey1[dummy]} hey"), "wrong output (%s)\n",buffer
);
579 r
= MsiRecordSetStringA(hrec
, 0, "{{[1][2]}[3][4][dummy]}");
580 ok( r
== ERROR_SUCCESS
, "set string failed\n");
581 r
= MsiRecordSetStringA(hrec
, 1, "2");
582 ok( r
== ERROR_SUCCESS
, "set string failed\n");
583 r
= MsiRecordSetStringA(hrec
, 2, "hey");
584 ok( r
== ERROR_SUCCESS
, "set string failed\n");
585 r
= MsiRecordSetStringA(hrec
, 3, "1");
586 ok( r
== ERROR_SUCCESS
, "set string failed\n");
587 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
588 ok( r
== ERROR_SUCCESS
, "set string failed\n");
589 r
= MsiRecordSetStringA(hrec
, 12, "big");
590 ok( r
== ERROR_SUCCESS
, "set string failed\n");
592 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
593 ok( r
== ERROR_SUCCESS
, "format failed\n");
594 ok( sz
== 16, "size wrong,(%i)\n",sz
);
595 ok( 0 == strcmp(buffer
,"{{2hey}1[dummy]}"), "wrong output (%s)\n",buffer
);
597 r
= MsiRecordSetStringA(hrec
, 0, "{{[1][2]}[3]{[4][dummy]}}");
598 ok( r
== ERROR_SUCCESS
, "set string failed\n");
599 r
= MsiRecordSetStringA(hrec
, 1, "2");
600 ok( r
== ERROR_SUCCESS
, "set string failed\n");
601 r
= MsiRecordSetStringA(hrec
, 2, "hey");
602 ok( r
== ERROR_SUCCESS
, "set string failed\n");
603 r
= MsiRecordSetStringA(hrec
, 3, "1");
604 ok( r
== ERROR_SUCCESS
, "set string failed\n");
605 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
606 ok( r
== ERROR_SUCCESS
, "set string failed\n");
607 r
= MsiRecordSetStringA(hrec
, 12, "big");
608 ok( r
== ERROR_SUCCESS
, "set string failed\n");
610 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
611 ok( r
== ERROR_SUCCESS
, "format failed\n");
612 ok( sz
== 0, "size wrong,(%i)\n",sz
);
613 ok( 0 == strcmp(buffer
,""), "wrong output (%s)\n",buffer
);
615 r
= MsiRecordSetStringA(hrec
, 0, "{{[1][2]}[3]} {[1][2]}");
616 ok( r
== ERROR_SUCCESS
, "set string failed\n");
617 r
= MsiRecordSetStringA(hrec
, 1, "1");
618 ok( r
== ERROR_SUCCESS
, "set string failed\n");
619 r
= MsiRecordSetStringA(hrec
, 2, "2");
620 ok( r
== ERROR_SUCCESS
, "set string failed\n");
621 r
= MsiRecordSetStringA(hrec
, 3, "3");
622 ok( r
== ERROR_SUCCESS
, "set string failed\n");
623 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
624 ok( r
== ERROR_SUCCESS
, "set string failed\n");
625 r
= MsiRecordSetStringA(hrec
, 12, "big");
626 ok( r
== ERROR_SUCCESS
, "set string failed\n");
628 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
629 ok( r
== ERROR_SUCCESS
, "format failed\n");
630 ok( sz
== 12, "size wrong,(%i)\n",sz
);
631 ok( 0 == strcmp(buffer
,"{{12}3} {12}"), "wrong output (%s)\n",buffer
);
633 r
= MsiRecordSetStringA(hrec
, 0, "{[1][2]} {{[1][2]}[3]} {[1][2]}");
634 ok( r
== ERROR_SUCCESS
, "set string failed\n");
635 r
= MsiRecordSetStringA(hrec
, 1, "1");
636 ok( r
== ERROR_SUCCESS
, "set string failed\n");
637 r
= MsiRecordSetStringA(hrec
, 2, "2");
638 ok( r
== ERROR_SUCCESS
, "set string failed\n");
639 r
= MsiRecordSetStringA(hrec
, 3, "3");
640 ok( r
== ERROR_SUCCESS
, "set string failed\n");
641 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
642 ok( r
== ERROR_SUCCESS
, "set string failed\n");
643 r
= MsiRecordSetStringA(hrec
, 12, "big");
644 ok( r
== ERROR_SUCCESS
, "set string failed\n");
646 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
647 ok( r
== ERROR_SUCCESS
, "format failed\n");
648 ok( sz
== 15, "size wrong,(%i)\n",sz
);
649 ok( 0 == strcmp(buffer
,"12 {{12}3} {12}"), "wrong output (%s)\n",buffer
);
651 r
= MsiRecordSetStringA(hrec
, 0, "{[4]}{[1][2]} {{[1][2]}[3]} {[1][2]}");
652 ok( r
== ERROR_SUCCESS
, "set string failed\n");
653 r
= MsiRecordSetStringA(hrec
, 1, "1");
654 ok( r
== ERROR_SUCCESS
, "set string failed\n");
655 r
= MsiRecordSetStringA(hrec
, 2, "2");
656 ok( r
== ERROR_SUCCESS
, "set string failed\n");
657 r
= MsiRecordSetStringA(hrec
, 3, "3");
658 ok( r
== ERROR_SUCCESS
, "set string failed\n");
659 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
660 ok( r
== ERROR_SUCCESS
, "set string failed\n");
661 r
= MsiRecordSetStringA(hrec
, 12, "big");
662 ok( r
== ERROR_SUCCESS
, "set string failed\n");
664 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
665 ok( r
== ERROR_SUCCESS
, "format failed\n");
666 ok( sz
== 15, "size wrong,(%i)\n",sz
);
667 ok( 0 == strcmp(buffer
,"12 {{12}3} {12}"), "wrong output (%s)\n",buffer
);
669 r
= MsiRecordSetStringA(hrec
, 0, "{blah} {[4]}{[1][2]} {{[1][2]}[3]} {[1][2]}");
670 ok( r
== ERROR_SUCCESS
, "set string failed\n");
671 r
= MsiRecordSetStringA(hrec
, 1, "1");
672 ok( r
== ERROR_SUCCESS
, "set string failed\n");
673 r
= MsiRecordSetStringA(hrec
, 2, "2");
674 ok( r
== ERROR_SUCCESS
, "set string failed\n");
675 r
= MsiRecordSetStringA(hrec
, 3, "3");
676 ok( r
== ERROR_SUCCESS
, "set string failed\n");
677 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
678 ok( r
== ERROR_SUCCESS
, "set string failed\n");
679 r
= MsiRecordSetStringA(hrec
, 12, "big");
680 ok( r
== ERROR_SUCCESS
, "set string failed\n");
682 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
683 ok( r
== ERROR_SUCCESS
, "format failed\n");
684 ok( sz
== 22, "size wrong,(%i)\n",sz
);
685 ok( 0 == strcmp(buffer
,"{blah} 12 {{12}3} {12}"), "wrong output (%s)\n",buffer
);
687 r
= MsiRecordSetStringA(hrec
, 0, "{{[1]}[2]} {[4]}{[1][2]}");
688 ok( r
== ERROR_SUCCESS
, "set string failed\n");
689 r
= MsiRecordSetStringA(hrec
, 1, "1");
690 ok( r
== ERROR_SUCCESS
, "set string failed\n");
691 r
= MsiRecordSetStringA(hrec
, 2, "2");
692 ok( r
== ERROR_SUCCESS
, "set string failed\n");
693 r
= MsiRecordSetStringA(hrec
, 3, "3");
694 ok( r
== ERROR_SUCCESS
, "set string failed\n");
695 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
696 ok( r
== ERROR_SUCCESS
, "set string failed\n");
697 r
= MsiRecordSetStringA(hrec
, 12, "big");
698 ok( r
== ERROR_SUCCESS
, "set string failed\n");
700 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
701 ok( r
== ERROR_SUCCESS
, "format failed\n");
702 ok( sz
== 13, "size wrong,(%i)\n",sz
);
703 ok( 0 == strcmp(buffer
,"{{1}2} {}{12}"), "wrong output (%s)\n",buffer
);
705 r
= MsiRecordSetStringA(hrec
, 0, "{{[1]}} {[4]}{[1][2]}");
706 ok( r
== ERROR_SUCCESS
, "set string failed\n");
707 r
= MsiRecordSetStringA(hrec
, 1, "1");
708 ok( r
== ERROR_SUCCESS
, "set string failed\n");
709 r
= MsiRecordSetStringA(hrec
, 2, "2");
710 ok( r
== ERROR_SUCCESS
, "set string failed\n");
711 r
= MsiRecordSetStringA(hrec
, 3, "3");
712 ok( r
== ERROR_SUCCESS
, "set string failed\n");
713 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
714 ok( r
== ERROR_SUCCESS
, "set string failed\n");
715 r
= MsiRecordSetStringA(hrec
, 12, "big");
716 ok( r
== ERROR_SUCCESS
, "set string failed\n");
718 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
719 ok( r
== ERROR_SUCCESS
, "format failed\n");
720 ok( sz
== 3, "size wrong,(%i)\n",sz
);
721 ok( 0 == strcmp(buffer
," 12"), "wrong output (%s)\n",buffer
);
723 r
= MsiRecordSetStringA(hrec
, 0, "{{{[1]}} {[4]}{[1][2]}");
724 ok( r
== ERROR_SUCCESS
, "set string failed\n");
725 r
= MsiRecordSetStringA(hrec
, 1, "1");
726 ok( r
== ERROR_SUCCESS
, "set string failed\n");
727 r
= MsiRecordSetStringA(hrec
, 2, "2");
728 ok( r
== ERROR_SUCCESS
, "set string failed\n");
729 r
= MsiRecordSetStringA(hrec
, 3, "3");
730 ok( r
== ERROR_SUCCESS
, "set string failed\n");
731 r
= MsiRecordSetStringA(hrec
, 4, NULL
);
732 ok( r
== ERROR_SUCCESS
, "set string failed\n");
733 r
= MsiRecordSetStringA(hrec
, 12, "big");
734 ok( r
== ERROR_SUCCESS
, "set string failed\n");
736 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
737 ok( r
== ERROR_SUCCESS
, "format failed\n");
739 ok( sz
== 3, "size wrong,(%i)\n",sz
);
740 ok( 0 == strcmp(buffer
," 12"), "wrong output (%s)\n",buffer
);
743 /* now put play games with escaping */
744 r
= MsiRecordSetStringA(hrec
, 0, "[1] [2] [\\3asdf]");
745 ok( r
== ERROR_SUCCESS
, "set string failed\n");
746 r
= MsiRecordSetStringA(hrec
, 1, "boo");
747 ok( r
== ERROR_SUCCESS
, "set string failed\n");
748 r
= MsiRecordSetStringA(hrec
, 2, "hoo");
749 ok( r
== ERROR_SUCCESS
, "set string failed\n");
751 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
752 ok( r
== ERROR_SUCCESS
, "format failed\n");
753 ok( sz
== 16, "size wrong\n");
754 ok( 0 == strcmp(buffer
,"boo hoo [\\3asdf]"), "wrong output\n");
756 /* now put play games with escaping */
757 r
= MsiRecordSetStringA(hrec
, 0, "[1] [2] [\\x]");
758 ok( r
== ERROR_SUCCESS
, "set string failed\n");
759 r
= MsiRecordSetStringA(hrec
, 1, "boo");
760 ok( r
== ERROR_SUCCESS
, "set string failed\n");
761 r
= MsiRecordSetStringA(hrec
, 2, "hoo");
762 ok( r
== ERROR_SUCCESS
, "set string failed\n");
764 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
765 ok( r
== ERROR_SUCCESS
, "format failed\n");
766 ok( sz
== 12, "size wrong\n");
767 ok( 0 == strcmp(buffer
,"boo hoo [\\x]"), "wrong output\n");
769 r
= MsiRecordSetStringA(hrec
, 0, "[\\x]");
770 ok( r
== ERROR_SUCCESS
, "set string failed\n");
772 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
773 ok( r
== ERROR_SUCCESS
, "format failed\n");
774 ok( sz
== 4, "size wrong: %d\n", sz
);
775 ok( 0 == strcmp(buffer
,"[\\x]"), "wrong output: %s\n", buffer
);
777 r
= MsiRecordSetStringA(hrec
, 0, "{\\x}");
778 ok( r
== ERROR_SUCCESS
, "set string failed\n");
780 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
781 ok( r
== ERROR_SUCCESS
, "format failed\n");
782 ok( sz
== 4, "size wrong: %d\n", sz
);
783 ok( 0 == strcmp(buffer
,"{\\x}"), "wrong output: %s\n", buffer
);
785 r
= MsiRecordSetStringA(hrec
, 0, "[abc\\x]");
786 ok( r
== ERROR_SUCCESS
, "set string failed\n");
788 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
789 ok( r
== ERROR_SUCCESS
, "format failed\n");
790 ok( sz
== 7, "size wrong: %d\n", sz
);
791 ok( 0 == strcmp(buffer
,"[abc\\x]"), "wrong output: %s\n", buffer
);
793 r
= MsiRecordSetStringA(hrec
, 0, "[\\[]Bracket Text[\\]]");
794 ok( r
== ERROR_SUCCESS
, "set string failed\n");
796 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
797 ok( r
== ERROR_SUCCESS
, "format failed\n");
798 ok( sz
== 20, "size wrong: %d\n", sz
);
799 ok( 0 == strcmp(buffer
,"[\\[]Bracket Text[\\]]"), "wrong output: %s\n", buffer
);
801 /* now try other formats without a package */
802 r
= MsiRecordSetStringA(hrec
, 0, "[1] [2] [property]");
803 ok( r
== ERROR_SUCCESS
, "set string failed\n");
804 r
= MsiRecordSetStringA(hrec
, 1, "boo");
805 ok( r
== ERROR_SUCCESS
, "set string failed\n");
806 r
= MsiRecordSetStringA(hrec
, 2, "hoo");
807 ok( r
== ERROR_SUCCESS
, "set string failed\n");
809 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
810 ok( r
== ERROR_SUCCESS
, "format failed\n");
811 ok( sz
== 18, "size wrong\n");
812 ok( 0 == strcmp(buffer
,"boo hoo [property]"), "wrong output\n");
814 r
= MsiRecordSetStringA(hrec
, 0, "[1] [~] [2]");
815 ok( r
== ERROR_SUCCESS
, "set string failed\n");
816 r
= MsiRecordSetStringA(hrec
, 1, "boo");
817 ok( r
== ERROR_SUCCESS
, "set string failed\n");
818 r
= MsiRecordSetStringA(hrec
, 2, "hoo");
819 ok( r
== ERROR_SUCCESS
, "set string failed\n");
821 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
822 ok( r
== ERROR_SUCCESS
, "format failed\n");
823 ok( sz
== 11, "size wrong\n");
824 ok( 0 == strcmp(buffer
,"boo [~] hoo"), "wrong output (%s)\n",buffer
);
826 r
= MsiRecordSetStringA(hrec
, 0, "[1]");
827 ok( r
== ERROR_SUCCESS
, "set string failed\n");
828 r
= MsiRecordSetInteger(hrec
, 1, 123456);
829 ok( r
== ERROR_SUCCESS
, "set integer failed\n");
831 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
832 ok( r
== ERROR_SUCCESS
, "format failed\n");
833 ok( sz
== 6, "size wrong\n");
834 ok( 0 == strcmp(buffer
,"123456"), "wrong output (%s)\n",buffer
);
836 r
= MsiRecordSetStringA(hrec
, 0, "[~]");
837 ok( r
== ERROR_SUCCESS
, "set string failed\n");
839 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
840 ok( sz
== 3, "size wrong\n");
841 ok( 0 == strcmp(buffer
,"[~]"), "wrong output\n");
842 ok( r
== ERROR_SUCCESS
, "format failed\n");
844 r
= MsiRecordSetStringA(hrec
, 0, "[]");
845 ok( r
== ERROR_SUCCESS
, "set string failed\n");
847 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
848 ok( sz
== 2, "size wrong\n");
849 ok( 0 == strcmp(buffer
,"[]"), "wrong output\n");
850 ok( r
== ERROR_SUCCESS
, "format failed\n");
852 /* MsiFormatRecordA doesn't seem to handle a negative too well */
853 r
= MsiRecordSetStringA(hrec
, 0, "[-1]");
854 ok( r
== ERROR_SUCCESS
, "set string failed\n");
856 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
857 ok( sz
== 4, "size wrong\n");
858 ok( 0 == strcmp(buffer
,"[-1]"), "wrong output\n");
859 ok( r
== ERROR_SUCCESS
, "format failed\n");
861 r
= MsiRecordSetStringA(hrec
, 0, "{[]}");
862 ok( r
== ERROR_SUCCESS
, "set string failed\n");
864 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
865 ok( sz
== 4, "size wrong\n");
866 ok( 0 == strcmp(buffer
,"{[]}"), "wrong output\n");
867 ok( r
== ERROR_SUCCESS
, "format failed\n");
869 r
= MsiRecordSetStringA(hrec
, 0, "[0]");
870 ok( r
== ERROR_SUCCESS
, "set string failed\n");
872 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
873 ok( sz
== 3, "size wrong\n");
874 ok( 0 == strcmp(buffer
,"[0]"), "wrong output\n");
875 ok( r
== ERROR_SUCCESS
, "format failed\n");
877 r
= MsiRecordSetStringA(hrec
, 0, "[100]");
878 ok( r
== ERROR_SUCCESS
, "set string failed\n");
880 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
881 ok( sz
== 0, "size wrong\n");
882 ok( 0 == strcmp(buffer
,""), "wrong output\n");
883 ok( r
== ERROR_SUCCESS
, "format failed\n");
885 r
= MsiRecordSetStringA(hrec
, 0, "{[1] [2]}");
886 ok( r
== ERROR_SUCCESS
, "set string failed\n");
887 r
= MsiRecordSetStringA(hrec
, 1, "boo");
888 ok( r
== ERROR_SUCCESS
, "set string failed\n");
889 r
= MsiRecordSetStringA(hrec
, 2, "hoo");
890 ok( r
== ERROR_SUCCESS
, "set string failed\n");
892 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
893 ok( sz
== 7, "size wrong\n");
894 ok( 0 == strcmp(buffer
,"boo hoo"), "wrong output\n");
895 ok( r
== ERROR_SUCCESS
, "format failed\n");
897 r
= MsiRecordSetStringA(hrec
, 0, "{}");
898 ok( r
== ERROR_SUCCESS
, "set string failed\n");
900 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
901 ok( sz
== 0, "size wrong\n");
902 ok( 0 == strcmp(buffer
,""), "wrong output\n");
903 ok( r
== ERROR_SUCCESS
, "format failed\n");
905 r
= MsiRecordSetStringA(hrec
, 0, "{foo}");
906 ok( r
== ERROR_SUCCESS
, "set string failed\n");
908 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
909 ok( sz
== 5, "size wrong\n");
910 ok( 0 == strcmp(buffer
,"{foo}"), "wrong output\n");
911 ok( r
== ERROR_SUCCESS
, "format failed\n");
913 r
= MsiRecordSetStringA(hrec
, 0, "{boo [1]}");
914 ok( r
== ERROR_SUCCESS
, "set string failed\n");
915 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
916 ok( r
== ERROR_SUCCESS
, "set string failed\n");
918 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
919 ok( sz
== 7, "size wrong\n");
920 ok( 0 == strcmp(buffer
,"boo hoo"), "wrong output\n");
921 ok( r
== ERROR_SUCCESS
, "format failed\n");
923 r
= MsiRecordSetStringA(hrec
, 0, "{{[1]}}");
924 ok( r
== ERROR_SUCCESS
, "set string failed\n");
925 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
926 ok( r
== ERROR_SUCCESS
, "set string failed\n");
928 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
929 ok( sz
== 0, "size wrong\n");
930 ok( 0 == strcmp(buffer
,""), "wrong output\n");
931 ok( r
== ERROR_SUCCESS
, "format failed\n");
933 r
= MsiRecordSetStringA(hrec
, 0, "{ {[1]}}");
934 ok( r
== ERROR_SUCCESS
, "set string failed\n");
935 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
936 ok( r
== ERROR_SUCCESS
, "set string failed\n");
938 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
941 ok( 0 == strcmp(buffer
," {hoo}"), "wrong output\n");
942 ok( sz
== 6, "size wrong\n");
944 ok( r
== ERROR_SUCCESS
, "format failed\n");
946 r
= MsiRecordSetStringA(hrec
, 0, "{{[1]} }");
947 ok( r
== ERROR_SUCCESS
, "set string failed\n");
948 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
949 ok( r
== ERROR_SUCCESS
, "set string failed\n");
951 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
952 ok( sz
== 8, "size wrong\n");
953 ok( 0 == strcmp(buffer
,"{{hoo} }"), "wrong output\n");
954 ok( r
== ERROR_SUCCESS
, "format failed\n");
956 r
= MsiRecordSetStringA(hrec
, 0, "{{ [1]}}");
957 ok( r
== ERROR_SUCCESS
, "set string failed\n");
958 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
959 ok( r
== ERROR_SUCCESS
, "set string failed\n");
961 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
962 ok( sz
== 0, "size wrong\n");
963 ok( 0 == strcmp(buffer
,""), "wrong output\n");
964 ok( r
== ERROR_SUCCESS
, "format failed\n");
966 r
= MsiRecordSetStringA(hrec
, 0, "{{[1] }}");
967 ok( r
== ERROR_SUCCESS
, "set string failed\n");
968 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
969 ok( r
== ERROR_SUCCESS
, "set string failed\n");
971 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
972 ok( sz
== 0, "size wrong\n");
973 ok( 0 == strcmp(buffer
,""), "wrong output\n");
974 ok( r
== ERROR_SUCCESS
, "format failed\n");
976 r
= MsiRecordSetStringA(hrec
, 0, "{{a}{b}{c }{ d}{any text}}");
977 ok( r
== ERROR_SUCCESS
, "set string failed\n");
979 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
980 ok( sz
== 0, "size wrong\n");
981 ok( 0 == strcmp(buffer
,""), "wrong output\n");
982 ok( r
== ERROR_SUCCESS
, "format failed\n");
984 r
= MsiRecordSetStringA(hrec
, 0, "{{a} }");
985 ok( r
== ERROR_SUCCESS
, "set string failed\n");
987 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
988 ok( sz
== 6, "size wrong\n");
989 ok( 0 == strcmp(buffer
,"{{a} }"), "wrong output\n");
990 ok( r
== ERROR_SUCCESS
, "format failed\n");
992 r
= MsiRecordSetStringA(hrec
, 0, "{{a} {b}}");
993 ok( r
== ERROR_SUCCESS
, "set string failed\n");
995 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
996 ok( sz
== 0, "size wrong\n");
997 ok( 0 == strcmp(buffer
,""), "wrong output\n");
998 ok( r
== ERROR_SUCCESS
, "format failed\n");
1000 r
= MsiRecordSetStringA(hrec
, 0, "{{a} b}}");
1001 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1003 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1004 todo_wine
ok( sz
== 0, "size wrong\n");
1005 todo_wine
ok( 0 == strcmp(buffer
,""), "wrong output\n");
1006 ok( r
== ERROR_SUCCESS
, "format failed\n");
1008 r
= MsiRecordSetStringA(hrec
, 0, "{{a b}}");
1009 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1011 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1012 ok( sz
== 0, "size wrong\n");
1013 ok( 0 == strcmp(buffer
,""), "wrong output\n");
1014 ok( r
== ERROR_SUCCESS
, "format failed\n");
1016 r
= MsiRecordSetStringA(hrec
, 0, "{ }");
1017 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1019 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1020 ok( sz
== 3, "size wrong\n");
1021 ok( 0 == strcmp(buffer
,"{ }"), "wrong output\n");
1022 ok( r
== ERROR_SUCCESS
, "format failed\n");
1024 r
= MsiRecordSetStringA(hrec
, 0, " {{a}}}");
1025 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1027 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1028 ok( sz
== 2, "size wrong\n");
1029 ok( 0 == strcmp(buffer
," }"), "wrong output\n");
1030 ok( r
== ERROR_SUCCESS
, "format failed\n");
1032 r
= MsiRecordSetStringA(hrec
, 0, "{{ almost {{ any }} text }}");
1033 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1035 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1036 todo_wine
ok( sz
== 8, "size wrong\n");
1037 todo_wine
ok( 0 == strcmp(buffer
," text }}"), "wrong output\n");
1038 ok( r
== ERROR_SUCCESS
, "format failed\n");
1040 r
= MsiRecordSetStringA(hrec
, 0, "{{ } { hidden ][ [ }}");
1041 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1043 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1044 todo_wine
ok( sz
== 0, "size wrong\n");
1045 todo_wine
ok( 0 == strcmp(buffer
,""), "wrong output\n");
1046 ok( r
== ERROR_SUCCESS
, "format failed\n");
1048 r
= MsiRecordSetStringA(hrec
, 0, "[ 1]");
1049 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1050 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1051 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1053 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1054 ok( sz
== 4, "size wrong\n");
1055 ok( 0 == strcmp(buffer
,"[ 1]"), "wrong output\n");
1056 ok( r
== ERROR_SUCCESS
, "format failed\n");
1058 r
= MsiRecordSetStringA(hrec
, 0, "[01]");
1059 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1060 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1061 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1063 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1064 ok( sz
== 3, "size wrong\n");
1065 ok( 0 == strcmp(buffer
,"hoo"), "wrong output\n");
1066 ok( r
== ERROR_SUCCESS
, "format failed\n");
1068 r
= MsiRecordSetStringA(hrec
, 0, "{{test}} [01");
1069 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1070 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1071 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1073 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1074 todo_wine
ok( sz
== 4, "size wrong\n");
1075 todo_wine
ok( 0 == strcmp(buffer
," [01"), "wrong output\n");
1076 ok( r
== ERROR_SUCCESS
, "format failed\n");
1078 r
= MsiRecordSetStringA(hrec
, 0, "[\\[]");
1079 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1080 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1081 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1083 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1084 ok( sz
== 4, "size wrong\n");
1085 ok( 0 == strcmp(buffer
,"[\\[]"), "wrong output\n");
1086 ok( r
== ERROR_SUCCESS
, "format failed\n");
1088 r
= MsiRecordSetStringA(hrec
, 0, "[\\[]");
1089 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1090 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1091 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1092 sz
= sizeof(buffer
);
1093 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1094 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1095 ok(sz
== 4, "Expected 4, got %d\n", sz
);
1096 ok(!lstrcmpA(buffer
, "[\\[]"), "Expected \"[\\[]\", got \"%s\"\n", buffer
);
1098 r
= MsiRecordSetStringA(hrec
, 0, "[foo]");
1099 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1100 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1101 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1103 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1104 ok( sz
== 5, "size wrong\n");
1105 ok( 0 == strcmp(buffer
,"[foo]"), "wrong output\n");
1106 ok( r
== ERROR_SUCCESS
, "format failed\n");
1108 r
= MsiRecordSetStringA(hrec
, 0, "[01.]");
1109 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1110 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1111 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1113 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1114 ok( sz
== 5, "size wrong\n");
1115 ok( 0 == strcmp(buffer
,"[01.]"), "wrong output\n");
1116 ok( r
== ERROR_SUCCESS
, "format failed\n");
1118 SetEnvironmentVariableA("FOO", "BAR");
1119 r
= MsiRecordSetStringA(hrec
, 0, "[%FOO]");
1120 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1122 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1123 ok( sz
== 6, "size wrong\n");
1124 ok( 0 == strcmp(buffer
,"[%FOO]"), "wrong output\n");
1125 ok( r
== ERROR_SUCCESS
, "format failed\n");
1127 r
= MsiRecordSetStringA(hrec
, 0, "{{[1]}");
1128 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1129 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1130 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1132 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1133 ok( sz
== 6, "size wrong\n");
1134 ok( 0 == strcmp(buffer
,"{{hoo}"), "wrong output\n");
1135 ok( r
== ERROR_SUCCESS
, "format failed\n");
1137 r
= MsiRecordSetStringA(hrec
, 0, "{{ {[1]}");
1138 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1139 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1140 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1142 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1143 ok( sz
== 8, "size wrong\n");
1144 ok( 0 == strcmp(buffer
,"{{ {hoo}"), "wrong output\n");
1145 ok( r
== ERROR_SUCCESS
, "format failed\n");
1147 r
= MsiRecordSetStringA(hrec
, 0, "{{ {[1]}");
1148 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1149 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1150 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1152 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1153 ok( sz
== 8, "size wrong\n");
1154 ok( 0 == strcmp(buffer
,"{{ {hoo}"), "wrong output\n");
1155 ok( r
== ERROR_SUCCESS
, "format failed\n");
1157 r
= MsiRecordSetStringA(hrec
, 0, "{{ {{[1]}");
1158 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1159 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1160 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1162 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1163 ok( sz
== 9, "size wrong\n");
1164 ok( 0 == strcmp(buffer
,"{{ {{hoo}"), "wrong output\n");
1165 ok( r
== ERROR_SUCCESS
, "format failed\n");
1167 r
= MsiRecordSetStringA(hrec
, 0, "[1]}");
1168 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1169 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1170 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1172 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1173 ok( sz
== 4, "size wrong\n");
1174 ok( 0 == strcmp(buffer
,"hoo}"), "wrong output\n");
1175 ok( r
== ERROR_SUCCESS
, "format failed\n");
1177 r
= MsiRecordSetStringA(hrec
, 0, "{{ {{a}");
1178 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1180 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1181 ok( sz
== 7, "size wrong\n");
1182 ok( 0 == strcmp(buffer
,"{{ {{a}"), "wrong output\n");
1183 ok( r
== ERROR_SUCCESS
, "format failed\n");
1185 r
= MsiRecordSetStringA(hrec
, 0, "{{ {{a}");
1186 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1188 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1189 ok( sz
== 7, "size wrong\n");
1190 ok( 0 == strcmp(buffer
,"{{ {{a}"), "wrong output\n");
1191 ok( r
== ERROR_SUCCESS
, "format failed\n");
1193 r
= MsiRecordSetStringA(hrec
, 0, "0{1{2{3{4[1]5}6}7}8}9");
1194 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1195 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1196 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1198 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1201 ok( sz
== 19, "size wrong\n");
1202 ok( 0 == strcmp(buffer
,"01{2{3{4hoo56}7}8}9"), "wrong output\n");
1204 ok( r
== ERROR_SUCCESS
, "format failed\n");
1206 r
= MsiRecordSetStringA(hrec
, 0, "0{1{2[1]3}4");
1207 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1208 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1209 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1211 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1214 ok( sz
== 9, "size wrong\n");
1215 ok( 0 == strcmp(buffer
,"01{2hoo34"), "wrong output\n");
1217 ok( r
== ERROR_SUCCESS
, "format failed\n");
1219 r
= MsiRecordSetStringA(hrec
, 0, "0{1{2[1]3}4");
1220 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1221 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1222 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1224 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1227 ok( sz
== 9, "size wrong\n");
1228 ok( 0 == strcmp(buffer
,"01{2hoo34"), "wrong output\n");
1230 ok( r
== ERROR_SUCCESS
, "format failed\n");
1232 r
= MsiRecordSetStringA(hrec
, 0, "{[1.} [1]");
1233 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1234 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1235 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1237 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1238 ok( sz
== 9, "size wrong\n");
1241 ok( 0 == strcmp(buffer
,"{[1.} hoo"), "wrong output\n");
1243 ok( r
== ERROR_SUCCESS
, "format failed\n");
1245 r
= MsiRecordSetStringA(hrec
, 0, "{[{[1]}]}");
1246 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1247 r
= MsiRecordSetStringA(hrec
, 1, "2");
1248 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1249 r
= MsiRecordSetStringA(hrec
, 2, "foo");
1250 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1252 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1255 ok( sz
== 9, "size wrong\n");
1256 ok( 0 == strcmp(buffer
,"{[{[1]}]}"), "wrong output\n");
1258 ok( r
== ERROR_SUCCESS
, "format failed\n");
1260 r
= MsiRecordSetStringA(hrec
, 0, "{[1][}");
1261 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1262 r
= MsiRecordSetStringA(hrec
, 1, "2");
1263 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1264 r
= MsiRecordSetStringA(hrec
, 2, "foo");
1265 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1267 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1270 ok( sz
== 2, "size wrong\n");
1271 ok( 0 == strcmp(buffer
,"2["), "wrong output\n");
1273 ok( r
== ERROR_SUCCESS
, "format failed\n");
1275 r
= MsiRecordSetStringA(hrec
, 0, "[1]");
1276 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1277 r
= MsiRecordSetStringA(hrec
, 1, "[2]");
1278 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1279 r
= MsiRecordSetStringA(hrec
, 2, "foo");
1280 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1282 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1283 ok( sz
== 3, "size wrong\n");
1284 ok( 0 == strcmp(buffer
,"[2]"), "wrong output\n");
1285 ok( r
== ERROR_SUCCESS
, "format failed\n");
1287 r
= MsiRecordSetStringA(hrec
, 0, "[{{boo}}1]");
1288 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1289 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1290 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1292 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1293 ok( r
== ERROR_SUCCESS
, "format failed\n");
1294 ok( sz
== 3, "size wrong\n");
1297 ok( 0 == strcmp(buffer
,"[1]"), "wrong output: %s\n", buffer
);
1300 r
= MsiRecordSetStringA(hrec
, 0, "[{{boo}}1]");
1301 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1302 r
= MsiRecordSetStringA(hrec
, 0, "[1{{boo}}]");
1303 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1304 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1305 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1307 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1308 ok( sz
== 3, "size wrong\n");
1309 ok( 0 == strcmp(buffer
,"[1]"), "wrong output\n");
1310 ok( r
== ERROR_SUCCESS
, "format failed\n");
1312 r
= MsiRecordSetStringA(hrec
, 0, "{[1]{{boo} }}");
1313 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1314 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1315 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1317 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1320 ok( sz
== 11, "size wrong\n");
1321 ok( 0 == strcmp(buffer
,"hoo{{boo }}"), "wrong output\n");
1323 ok( r
== ERROR_SUCCESS
, "format failed\n");
1325 r
= MsiRecordSetStringA(hrec
, 0, "{[1{{boo}}]}");
1326 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1327 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1328 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1330 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1333 ok( sz
== 12, "size wrong: got %u, expected 12\n", sz
);
1334 ok( 0 == strcmp(buffer
,"{[1{{boo}}]}"), "wrong output: got %s, expected [1]\n", buffer
);
1336 ok( r
== ERROR_SUCCESS
, "format failed\n");
1338 r
= MsiRecordSetStringA(hrec
, 0, "{{[1]}");
1339 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1340 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1341 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1343 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1344 ok( sz
== 6, "size wrong: got %u, expected 3\n", sz
);
1345 ok( 0 == strcmp(buffer
,"{{hoo}"), "wrong output: got %s, expected [1]\n", buffer
);
1346 ok( r
== ERROR_SUCCESS
, "format failed\n");
1348 r
= MsiRecordSetStringA(hrec
, 0, "{[1{{bo}o}}]}");
1349 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1350 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1351 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1353 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1354 ok( sz
== 13, "size wrong\n");
1355 ok( 0 == strcmp(buffer
,"{[1{{bo}o}}]}"), "wrong output %s\n",buffer
);
1356 ok( r
== ERROR_SUCCESS
, "format failed\n");
1358 r
= MsiRecordSetStringA(hrec
, 0, "{[1{{b{o}o}}]}");
1359 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1361 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1364 ok( sz
== 14, "size wrong\n");
1365 ok( 0 == strcmp(buffer
,"{[1{{b{o}o}}]}"), "wrong output %s\n",buffer
);
1367 ok( r
== ERROR_SUCCESS
, "format failed\n");
1369 r
= MsiRecordSetStringA(hrec
, 0, "{ {[1]}");
1370 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1371 r
= MsiRecordSetStringA(hrec
, 1, "hoo");
1372 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1374 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1377 ok( sz
== 5, "size wrong\n");
1378 ok( 0 == strcmp(buffer
," {hoo"), "wrong output %s\n",buffer
);
1380 ok( r
== ERROR_SUCCESS
, "format failed\n");
1382 /* {} inside a substitution does strange things... */
1383 r
= MsiRecordSetStringA(hrec
, 0, "[[1]{}]");
1384 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1385 r
= MsiRecordSetStringA(hrec
, 1, "2");
1386 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1388 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1391 ok( sz
== 5, "size wrong\n");
1392 ok( 0 == strcmp(buffer
,"[[1]]"), "wrong output %s\n",buffer
);
1394 ok( r
== ERROR_SUCCESS
, "format failed\n");
1396 r
= MsiRecordSetStringA(hrec
, 0, "[[1]{}[1]]");
1397 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1398 r
= MsiRecordSetStringA(hrec
, 1, "2");
1399 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1401 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1404 ok( sz
== 6, "size wrong\n");
1405 ok( 0 == strcmp(buffer
,"[[1]2]"), "wrong output %s\n",buffer
);
1407 ok( r
== ERROR_SUCCESS
, "format failed\n");
1409 r
= MsiRecordSetStringA(hrec
, 0, "[a[1]b[1]c{}d[1]e]");
1410 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1411 r
= MsiRecordSetStringA(hrec
, 1, "2");
1412 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1414 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1417 ok( sz
== 14, "size wrong\n");
1418 ok( 0 == strcmp(buffer
,"[a[1]b[1]cd2e]"), "wrong output %s\n",buffer
);
1420 ok( r
== ERROR_SUCCESS
, "format failed\n");
1422 r
= MsiRecordSetStringA(hrec
, 0, "[a[1]b");
1423 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1424 r
= MsiRecordSetStringA(hrec
, 1, "2");
1425 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1427 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1428 ok( sz
== 6, "size wrong\n");
1429 ok( 0 == strcmp(buffer
,"[a[1]b"), "wrong output %s\n",buffer
);
1430 ok( r
== ERROR_SUCCESS
, "format failed\n");
1432 r
= MsiRecordSetStringA(hrec
, 0, "a[1]b]");
1433 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1434 r
= MsiRecordSetStringA(hrec
, 1, "2");
1435 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1437 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1438 ok( sz
== 4, "size wrong\n");
1439 ok( 0 == strcmp(buffer
,"a2b]"), "wrong output %s\n",buffer
);
1440 ok( r
== ERROR_SUCCESS
, "format failed\n");
1442 r
= MsiRecordSetStringA(hrec
, 0, "]a[1]b");
1443 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1444 r
= MsiRecordSetStringA(hrec
, 1, "2");
1445 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1447 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1448 ok( sz
== 4, "size wrong\n");
1449 ok( 0 == strcmp(buffer
,"]a2b"), "wrong output %s\n",buffer
);
1450 ok( r
== ERROR_SUCCESS
, "format failed\n");
1452 r
= MsiRecordSetStringA(hrec
, 0, "]a[1]b");
1453 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1454 r
= MsiRecordSetStringA(hrec
, 1, "2");
1455 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1457 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1458 ok( sz
== 4, "size wrong\n");
1459 ok( 0 == strcmp(buffer
,"]a2b"), "wrong output %s\n",buffer
);
1460 ok( r
== ERROR_SUCCESS
, "format failed\n");
1462 r
= MsiRecordSetStringA(hrec
, 0, "\\[1]");
1463 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1464 r
= MsiRecordSetStringA(hrec
, 1, "2");
1465 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1467 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1468 ok( sz
== 2, "size wrong\n");
1469 ok( 0 == strcmp(buffer
,"\\2"), "wrong output %s\n",buffer
);
1470 ok( r
== ERROR_SUCCESS
, "format failed\n");
1472 r
= MsiRecordSetStringA(hrec
, 0, "\\{[1]}");
1473 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1474 r
= MsiRecordSetStringA(hrec
, 1, "2");
1475 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1477 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1478 ok( sz
== 2, "size wrong\n");
1479 ok( 0 == strcmp(buffer
,"\\2"), "wrong output %s\n",buffer
);
1480 ok( r
== ERROR_SUCCESS
, "format failed\n");
1482 r
= MsiRecordSetStringA(hrec
, 0, "a{b[1]c}d");
1483 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1484 r
= MsiRecordSetStringA(hrec
, 1, NULL
);
1485 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1487 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1488 ok( sz
== 2, "size wrong\n");
1489 ok( 0 == strcmp(buffer
,"ad"), "wrong output %s\n",buffer
);
1490 ok( r
== ERROR_SUCCESS
, "format failed\n");
1492 r
= MsiRecordSetStringA(hrec
, 0, "{a[0]b}");
1493 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1494 r
= MsiRecordSetStringA(hrec
, 1, "foo");
1495 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1497 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1498 ok( sz
== 9, "size wrong\n");
1499 ok( 0 == strcmp(buffer
,"a{a[0]b}b"), "wrong output %s\n",buffer
);
1500 ok( r
== ERROR_SUCCESS
, "format failed\n");
1502 r
= MsiRecordSetStringA(hrec
, 0, "[foo]");
1503 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1505 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1506 ok( sz
== 5, "size wrong\n");
1507 ok( 0 == strcmp(buffer
,"[foo]"), "wrong output %s\n",buffer
);
1508 ok( r
== ERROR_SUCCESS
, "format failed\n");
1510 r
= MsiRecordSetStringA(hrec
, 0, "{[1][-1][1]}");
1511 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1512 r
= MsiRecordSetStringA(hrec
, 1, "foo");
1513 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1515 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1518 ok( sz
== 12, "size wrong\n");
1519 ok( 0 == strcmp(buffer
,"{foo[-1]foo}"), "wrong output %s\n",buffer
);
1521 ok( r
== ERROR_SUCCESS
, "format failed\n");
1525 r
= MsiRecordSetStringA(hrec
, 0, "{abcd}");
1526 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1527 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1528 ok( r
== ERROR_SUCCESS
, "format failed\n");
1529 ok( sz
== 6, "size wrong(%i)\n",sz
);
1530 ok( 0 == strcmp(buffer
,"{abcd}"), "wrong output (%s)\n",buffer
);
1533 r
= MsiRecordSetStringA(hrec
, 0, "{a[one]bc[two]de[one]f}");
1534 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1535 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1536 ok( r
== ERROR_SUCCESS
, "format failed\n");
1537 ok( sz
== 23, "size wrong(%i)\n",sz
);
1538 ok( 0 == strcmp(buffer
,"{a[one]bc[two]de[one]f}"), "wrong output (%s)\n",buffer
);
1541 r
= MsiRecordSetStringA(hrec
, 0, "{a[one]bc[bad]de[two]f}");
1542 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1543 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1544 ok( r
== ERROR_SUCCESS
, "format failed\n");
1545 ok( sz
== 23, "size wrong(%i)\n",sz
);
1546 ok( 0 == strcmp(buffer
,"{a[one]bc[bad]de[two]f}"), "wrong output (%s)\n",buffer
);
1549 r
= MsiRecordSetStringA(hrec
, 0, "{[bad]}");
1550 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1551 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1552 ok( r
== ERROR_SUCCESS
, "format failed\n");
1553 ok( sz
== 7, "size wrong(%i)\n",sz
);
1554 ok( 0 == strcmp(buffer
,"{[bad]}"), "wrong output (%s)\n",buffer
);
1557 r
= MsiRecordSetStringA(hrec
, 0, "{abc{d[one]ef}"); /* missing final brace */
1558 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1559 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1560 ok( r
== ERROR_SUCCESS
, "format failed\n");
1561 ok( sz
== 14, "size wrong(%i)\n",sz
);
1562 ok( 0 == strcmp(buffer
,"{abc{d[one]ef}"), "wrong output (%s)\n",buffer
);
1565 r
= MsiRecordSetStringA(hrec
, 0, "{abc{d[one]ef}}");
1566 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1567 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1568 ok( r
== ERROR_SUCCESS
, "format failed\n");
1569 ok( sz
== 15, "size wrong(%i)\n",sz
);
1570 ok( 0 == strcmp(buffer
,"{abc{d[one]ef}}"), "wrong output (%s)\n",buffer
);
1573 r
= MsiRecordSetStringA(hrec
, 0, "{abc}{{def}hi{j[one]k}}");
1574 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1575 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1576 ok( r
== ERROR_SUCCESS
, "format failed\n");
1577 ok( sz
== 5, "size wrong(%i)\n",sz
);
1578 ok( 0 == strcmp(buffer
,"{abc}"), "wrong output (%s)\n",buffer
);
1581 r
= MsiRecordSetStringA(hrec
, 0, "{{def}hi{j[one]k}}");
1582 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1583 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1584 ok( r
== ERROR_SUCCESS
, "format failed\n");
1585 ok( sz
== 0, "size wrong(%i)\n",sz
);
1586 ok( 0 == strcmp(buffer
,""), "wrong output (%s)\n",buffer
);
1589 r
= MsiRecordSetStringA(hrec
, 0, "{{def}hi{jk}}");
1590 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1591 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1592 ok( r
== ERROR_SUCCESS
, "format failed\n");
1593 ok( sz
== 0, "size wrong(%i)\n",sz
);
1594 ok( 0 == strcmp(buffer
,""), "wrong output (%s)\n",buffer
);
1597 r
= MsiRecordSetStringA(hrec
, 0, "{{{def}}hi{jk}}");
1598 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1599 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1600 ok( r
== ERROR_SUCCESS
, "format failed\n");
1603 ok( sz
== 7, "size wrong(%i)\n",sz
);
1604 ok( 0 == strcmp(buffer
,"hi{jk}}"), "wrong output (%s)\n",buffer
);
1608 r
= MsiRecordSetStringA(hrec
, 0, "{{def}hi{{jk}}}");
1609 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1610 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1611 ok( r
== ERROR_SUCCESS
, "format failed\n");
1614 ok( sz
== 1, "size wrong(%i)\n",sz
);
1615 ok( 0 == strcmp(buffer
,"}"), "wrong output (%s)\n",buffer
);
1619 r
= MsiRecordSetStringA(hrec
, 0, "{{def}{jk}}");
1620 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1621 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1622 ok( r
== ERROR_SUCCESS
, "format failed\n");
1623 ok( sz
== 0, "size wrong(%i)\n",sz
);
1624 ok( 0 == strcmp(buffer
,""), "wrong output (%s)\n",buffer
);
1627 r
= MsiRecordSetStringA(hrec
, 0, "{{def}}");
1628 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1629 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1630 ok( r
== ERROR_SUCCESS
, "format failed\n");
1631 ok( sz
== 0, "size wrong(%i)\n",sz
);
1632 ok( 0 == strcmp(buffer
,""), "wrong output (%s)\n",buffer
);
1635 r
= MsiRecordSetStringA(hrec
, 0, "{a{b}c}");
1636 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1637 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1638 ok( r
== ERROR_SUCCESS
, "format failed\n");
1639 ok( sz
== 7, "size wrong(%i)\n",sz
);
1640 ok( 0 == strcmp(buffer
,"{a{b}c}"), "wrong output (%s)\n",buffer
);
1643 r
= MsiRecordSetStringA(hrec
, 0, "{a{b}}");
1644 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1645 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1646 ok( r
== ERROR_SUCCESS
, "format failed\n");
1647 ok( sz
== 6, "size wrong(%i)\n",sz
);
1648 ok( 0 == strcmp(buffer
,"{a{b}}"), "wrong output (%s)\n",buffer
);
1651 r
= MsiRecordSetStringA(hrec
, 0, "{{b}c}");
1652 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1653 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1654 ok( r
== ERROR_SUCCESS
, "format failed\n");
1655 ok( sz
== 6, "size wrong(%i)\n",sz
);
1656 ok( 0 == strcmp(buffer
,"{{b}c}"), "wrong output (%s)\n",buffer
);
1659 r
= MsiRecordSetStringA(hrec
, 0, "{{{{}}}}");
1660 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1661 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1662 ok( r
== ERROR_SUCCESS
, "format failed\n");
1665 ok( sz
== 2, "size wrong(%i)\n",sz
);
1666 ok( 0 == strcmp(buffer
,"}}"), "wrong output (%s)\n",buffer
);
1670 MsiRecordSetInteger(hrec
, 1, 100);
1671 MsiRecordSetInteger(hrec
, 2, -100);
1672 r
= MsiRecordSetStringA(hrec
, 0, "[1] [2]");
1673 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1674 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1675 ok( r
== ERROR_SUCCESS
, "format failed\n");
1676 ok( sz
== 8, "size wrong(%i)\n",sz
);
1677 ok( 0 == strcmp(buffer
,"100 -100"), "wrong output (%s)\n",buffer
);
1679 sz
= sizeof(buffer
);
1680 r
= MsiRecordSetStringA(hrec
, 0, "[1] {[noprop] [twoprop]} {abcdef}");
1681 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1682 r
= MsiRecordSetStringA(hrec
, 1, "one");
1683 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1684 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1685 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1686 ok(sz
== 33, "Expected 33, got %d\n",sz
);
1687 ok(!lstrcmpA(buffer
, "one {[noprop] [twoprop]} {abcdef}"),
1688 "Expected \"one {[noprop] [twoprop]} {abcdef}\", got \"%s\"\n", buffer
);
1690 sz
= sizeof(buffer
);
1691 r
= MsiRecordSetStringA(hrec
, 0, "[1] {[noprop] [one]} {abcdef}");
1692 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1693 r
= MsiRecordSetStringA(hrec
, 1, "one");
1694 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1695 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1696 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1697 ok(sz
== 29, "Expected 29, got %d\n",sz
);
1698 ok(!lstrcmpA(buffer
, "one {[noprop] [one]} {abcdef}"),
1699 "Expected \"one {[noprop] [one]} {abcdef}\", got \"%s\"\n", buffer
);
1701 sz
= sizeof(buffer
);
1702 r
= MsiRecordSetStringA(hrec
, 0, "[1] {[one]} {abcdef}");
1703 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1704 r
= MsiRecordSetStringA(hrec
, 1, "one");
1705 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1706 r
= MsiFormatRecordA(0, hrec
, buffer
, &sz
);
1707 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1708 ok(sz
== 20, "Expected 20, got %d\n",sz
);
1709 ok(!lstrcmpA(buffer
, "one {[one]} {abcdef}"),
1710 "Expected \"one {[one]} {abcdef}\", got \"%s\"\n", buffer
);
1712 MsiCloseHandle( hrec
);
1715 static void test_formatrecord_package(void)
1723 r
= helper_createpackage( msifile
, &package
);
1724 if (r
== ERROR_INSTALL_PACKAGE_REJECTED
)
1726 skip("Not enough rights to perform tests\n");
1729 ok( r
== ERROR_SUCCESS
, "Unable to create package %u\n", r
);
1731 hrec
= MsiCreateRecord(12);
1732 ok( hrec
, "failed to create record\n");
1734 r
= MsiFormatRecordA(package
, 0, NULL
, NULL
);
1735 ok( r
== ERROR_INVALID_HANDLE
, "wrong error\n");
1737 r
= MsiFormatRecordA(package
, hrec
, NULL
, NULL
);
1738 ok( r
== ERROR_SUCCESS
, "format failed\n");
1740 r
= MsiRecordSetStringA(hrec
,0,NULL
);
1741 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1742 r
= MsiRecordSetStringA(hrec
,1,NULL
);
1743 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1744 r
= MsiRecordSetStringA(hrec
,2,NULL
);
1745 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1746 r
= MsiRecordSetStringA(hrec
,3,NULL
);
1747 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1748 r
= MsiRecordSetStringA(hrec
,4,NULL
);
1749 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1750 r
= MsiRecordSetStringA(hrec
,5,NULL
);
1751 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1752 r
= MsiRecordSetStringA(hrec
,6,NULL
);
1753 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1754 r
= MsiRecordSetStringA(hrec
,7,NULL
);
1755 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1756 r
= MsiRecordSetStringA(hrec
,8,NULL
);
1757 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1758 r
= MsiRecordSetStringA(hrec
,9,NULL
);
1759 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1760 r
= MsiRecordSetStringA(hrec
,10,NULL
);
1761 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1762 r
= MsiRecordSetStringA(hrec
,11,NULL
);
1763 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1764 r
= MsiRecordSetStringA(hrec
,12,NULL
);
1765 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1768 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1769 ok( r
== ERROR_SUCCESS
, "format failed with empty buffer (%i)\n",r
);
1770 ok( sz
== 51, "size wrong (%i)\n",sz
);
1771 ok( 0 == strcmp(buffer
,"1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: "), "wrong output(%s)\n",buffer
);
1773 r
= MsiSetPropertyA(package
, "prop", "val");
1774 ok( r
== ERROR_SUCCESS
, "failed to set property: %d\n", r
);
1776 r
= MsiRecordSetStringA(hrec
, 0, NULL
);
1777 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1778 r
= MsiRecordSetStringA(hrec
, 1, "[2]");
1779 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1780 r
= MsiRecordSetStringA(hrec
, 2, "stuff");
1781 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1782 r
= MsiRecordSetStringA(hrec
, 3, "prop");
1783 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1784 r
= MsiRecordSetStringA(hrec
, 4, "[prop]");
1785 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1786 r
= MsiRecordSetStringA(hrec
, 5, "[noprop]");
1787 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1789 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1790 ok( r
== ERROR_SUCCESS
, "format failed with empty buffer (%i)\n",r
);
1793 ok( sz
== 66, "size wrong (%i)\n",sz
);
1794 ok( !lstrcmpA(buffer
,
1795 "1: [2] 2: stuff 3: prop 4: val 5: 6: 7: 8: 9: 10: 11: 12: "),
1796 "wrong output(%s)\n",buffer
);
1799 /* now put play games with escaping */
1800 r
= MsiRecordSetStringA(hrec
, 0, "[1] [2] [\\3asdf]");
1801 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1802 r
= MsiRecordSetStringA(hrec
, 1, "boo");
1803 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1804 r
= MsiRecordSetStringA(hrec
, 2, "hoo");
1805 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1807 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1808 ok( r
== ERROR_SUCCESS
, "format failed\n");
1809 ok( sz
== 9, "size wrong(%i)\n",sz
);
1810 ok( 0 == strcmp(buffer
,"boo hoo 3"), "wrong output (%s)\n",buffer
);
1812 r
= MsiRecordSetStringA(hrec
, 0, "[1] [2] [\\x]");
1813 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1814 r
= MsiRecordSetStringA(hrec
, 1, "boo");
1815 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1816 r
= MsiRecordSetStringA(hrec
, 2, "hoo");
1817 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1819 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1820 ok( r
== ERROR_SUCCESS
, "format failed\n");
1821 ok( sz
== 9, "size wrong(%i)\n",sz
);
1822 ok( 0 == strcmp(buffer
,"boo hoo x"), "wrong output (%s)\n",buffer
);
1824 MsiRecordSetStringA(hrec
, 0, "[\\x]");
1826 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1827 ok( r
== ERROR_SUCCESS
, "format failed\n");
1828 ok( sz
== 1, "size wrong: %d\n", sz
);
1829 ok( 0 == strcmp(buffer
,"x"), "wrong output: %s\n", buffer
);
1831 MsiRecordSetStringA(hrec
, 0, "{\\x}");
1833 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1834 ok( r
== ERROR_SUCCESS
, "format failed\n");
1835 ok( sz
== 4, "size wrong: %d\n", sz
);
1836 ok( 0 == strcmp(buffer
,"{\\x}"), "wrong output: %s\n", buffer
);
1838 MsiRecordSetStringA(hrec
, 0, "[abc\\x]");
1840 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1841 ok( r
== ERROR_SUCCESS
, "format failed\n");
1842 ok( sz
== 0, "size wrong: %d\n", sz
);
1843 ok( 0 == strcmp(buffer
,""), "wrong output: %s\n", buffer
);
1845 MsiRecordSetStringA(hrec
, 0, "[abc\\xdef]");
1847 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1848 ok( r
== ERROR_SUCCESS
, "format failed\n");
1849 ok( sz
== 0, "size wrong: %d\n", sz
);
1850 ok( 0 == strcmp(buffer
,""), "wrong output: %s\n", buffer
);
1852 MsiRecordSetStringA(hrec
, 0, "\\x");
1853 sz
= sizeof(buffer
);
1854 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1855 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1856 ok(sz
== 2, "Expected 2, got %d\n", sz
);
1857 ok(!lstrcmpA(buffer
, "\\x"), "Expected \"\\x\", got \"%s\"\n", buffer
);
1859 MsiRecordSetStringA(hrec
, 0, "[\\[");
1860 sz
= sizeof(buffer
);
1861 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1862 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1863 ok(sz
== 3, "Expected 3, got %d\n", sz
);
1864 ok(!lstrcmpA(buffer
, "[\\["), "Expected \"[\\[\", got \"%s\"\n", buffer
);
1866 MsiRecordSetStringA(hrec
, 0, "[\\[]");
1867 sz
= sizeof(buffer
);
1868 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1869 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1870 ok(sz
== 1, "Expected 1, got %d\n", sz
);
1871 ok(!lstrcmpA(buffer
, "["), "Expected \"[\", got \"%s\"\n", buffer
);
1873 MsiRecordSetStringA(hrec
, 0, "[[]");
1874 sz
= sizeof(buffer
);
1875 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1876 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1877 ok(sz
== 3, "Expected 3, got %d\n", sz
);
1878 ok(!lstrcmpA(buffer
, "[[]"), "Expected \"[]\", got \"%s\"\n", buffer
);
1880 MsiRecordSetStringA(hrec
, 0, "[\\[]]");
1881 sz
= sizeof(buffer
);
1882 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1883 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1884 ok(sz
== 2, "Expected 2, got %d\n", sz
);
1885 ok(!lstrcmpA(buffer
, "[]"), "Expected \"[]\", got \"%s\"\n", buffer
);
1887 MsiRecordSetStringA(hrec
, 0, "[\\[a]");
1888 sz
= sizeof(buffer
);
1889 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1890 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1891 ok(sz
== 1, "Expected 1, got %d\n", sz
);
1892 ok(!lstrcmpA(buffer
, "["), "Expected \"[\", got \"%s\"\n", buffer
);
1894 MsiRecordSetStringA(hrec
, 0, "[\\a[]");
1895 sz
= sizeof(buffer
);
1896 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1897 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1900 ok(sz
== 1, "Expected 1, got %d\n", sz
);
1901 ok(!lstrcmpA(buffer
, "a"), "Expected \"a\", got \"%s\"\n", buffer
);
1904 MsiRecordSetStringA(hrec
, 0, "[prop]");
1905 sz
= sizeof(buffer
);
1906 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1907 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1908 ok(sz
== 3, "Expected 3, got %d\n", sz
);
1909 ok(!lstrcmpA(buffer
, "val"), "Expected \"val\", got \"%s\"\n", buffer
);
1911 MsiRecordSetStringA(hrec
, 0, "[prop] [pro\\pblah] [prop]");
1912 sz
= sizeof(buffer
);
1913 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1914 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1915 ok(sz
== 8, "Expected 8, got %d\n", sz
);
1916 ok(!lstrcmpA(buffer
, "val val"), "Expected \"val val\", got \"%s\"\n", buffer
);
1918 MsiSetPropertyA(package
, "b", "ball");
1919 MsiRecordSetStringA(hrec
, 0, "[\\b]");
1920 sz
= sizeof(buffer
);
1921 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1922 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1923 ok(sz
== 1, "Expected 1, got %d\n", sz
);
1924 ok(!lstrcmpA(buffer
, "b"), "Expected \"b\", got \"%s\"\n", buffer
);
1926 MsiRecordSetStringA(hrec
, 0, "[\\c]");
1927 sz
= sizeof(buffer
);
1928 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1929 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1930 ok(sz
== 1, "Expected 1, got %d\n", sz
);
1931 ok(!lstrcmpA(buffer
, "c"), "Expected \"c\", got \"%s\"\n", buffer
);
1933 MsiRecordSetStringA(hrec
, 0, "[\\[]prop]");
1934 sz
= sizeof(buffer
);
1935 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1936 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1937 ok(sz
== 6, "Expected 6, got %d\n", sz
);
1938 ok(!lstrcmpA(buffer
, "[prop]"), "Expected \"[prop]\", got \"%s\"\n", buffer
);
1940 MsiRecordSetStringA(hrec
, 0, "[\\a]prop]");
1941 sz
= sizeof(buffer
);
1942 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1943 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1944 ok(sz
== 6, "Expected 6, got %d\n", sz
);
1945 ok(!lstrcmpA(buffer
, "aprop]"), "Expected \"aprop]\", got \"%s\"\n", buffer
);
1947 MsiRecordSetStringA(hrec
, 0, "[\\[]Bracket Text[\\]]");
1949 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1950 ok( r
== ERROR_SUCCESS
, "format failed\n");
1951 ok( sz
== 14, "size wrong: %d\n", sz
);
1952 ok( 0 == strcmp(buffer
,"[Bracket Text]"), "wrong output: %s\n", buffer
);
1954 /* null characters */
1955 r
= MsiRecordSetStringA(hrec
, 0, "[1] [~] [2]");
1956 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1957 r
= MsiRecordSetStringA(hrec
, 1, "boo");
1958 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1959 r
= MsiRecordSetStringA(hrec
, 2, "hoo");
1960 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1962 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1963 ok( r
== ERROR_SUCCESS
, "format failed\n");
1964 ok( sz
== 9, "size wrong: %d\n", sz
);
1965 ok( 0 == strcmp(buffer
,"boo "), "wrong output: %s\n", buffer
);
1966 ok(!lstrcmpA(&buffer
[5], " hoo"),
1967 "Expected \" hoo\", got \"%s\"\n", &buffer
[5]);
1969 r
= MsiRecordSetStringA(hrec
, 0, "[1] [~abc] [2]");
1970 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1971 r
= MsiRecordSetStringA(hrec
, 1, "boo");
1972 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1973 r
= MsiRecordSetStringA(hrec
, 2, "hoo");
1974 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1975 sz
= sizeof(buffer
);
1976 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1977 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1978 ok(sz
== 8, "Expected 8, got %d\n", sz
);
1979 ok(!lstrcmpA(buffer
, "boo hoo"), "Expected \"boo hoo\", got \"%s\"\n", buffer
);
1982 r
= MsiSetPropertyA(package
,"dummy","Bork");
1983 ok( r
== ERROR_SUCCESS
, "set property failed\n");
1984 r
= MsiRecordSetStringA(hrec
, 0, "[1] [dummy] [2]");
1985 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1986 r
= MsiRecordSetStringA(hrec
, 1, "boo");
1987 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1988 r
= MsiRecordSetStringA(hrec
, 2, "hoo");
1989 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1991 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
1992 ok( r
== ERROR_SUCCESS
, "format failed\n");
1993 ok( sz
== 12, "size wrong\n");
1994 ok( 0 == strcmp(buffer
,"boo Bork hoo"), "wrong output\n");
1996 r
= MsiRecordSetStringA(hrec
, 0, "[1] [invalid] [2]");
1997 ok( r
== ERROR_SUCCESS
, "set string failed\n");
1998 r
= MsiRecordSetStringA(hrec
, 1, "boo");
1999 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2000 r
= MsiRecordSetStringA(hrec
, 2, "hoo");
2001 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2003 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2004 ok( r
== ERROR_SUCCESS
, "format failed\n");
2005 ok( sz
== 8, "size wrong\n");
2006 ok( 0 == strcmp(buffer
,"boo hoo"), "wrong output\n");
2009 r
= MsiSetPropertyA(package
,"dummya","foo");
2010 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2011 r
= MsiSetPropertyA(package
,"dummyb","baa");
2012 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2013 r
= MsiSetPropertyA(package
,"adummyc","whoa");
2014 ok( r
== ERROR_SUCCESS
, "set property failed\n");
2015 r
= MsiRecordSetStringA(hrec
, 0, "[dummy[1]] [dummy[2]] [[1]dummy[3]]");
2016 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2017 r
= MsiRecordSetStringA(hrec
, 1, "a");
2018 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2019 r
= MsiRecordSetStringA(hrec
, 2, "b");
2020 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2021 r
= MsiRecordSetStringA(hrec
, 3, "c");
2022 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2024 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2025 ok( r
== ERROR_SUCCESS
, "format failed\n");
2026 ok( sz
== 12, "size wrong(%i)\n",sz
);
2027 ok( 0 == strcmp(buffer
,"foo baa whoa"), "wrong output (%s)\n",buffer
);
2029 r
= MsiSetPropertyA(package
,"dummya","1");
2030 ok( r
== ERROR_SUCCESS
, "set property failed\n");
2031 r
= MsiSetPropertyA(package
,"dummyb","[2]");
2032 ok( r
== ERROR_SUCCESS
, "set property failed\n");
2033 r
= MsiRecordSetStringA(hrec
, 0, "[dummya] [[dummya]] [dummyb]");
2034 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2035 r
= MsiRecordSetStringA(hrec
, 1, "aaa");
2036 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2037 r
= MsiRecordSetStringA(hrec
, 2, "bbb");
2038 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2039 r
= MsiRecordSetStringA(hrec
, 3, "ccc");
2040 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2042 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2043 ok( r
== ERROR_SUCCESS
, "format failed\n");
2046 ok( sz
== 9, "size wrong(%i)\n",sz
);
2047 ok( 0 == strcmp(buffer
,"1 [1] [2]"), "wrong output (%s)\n",buffer
);
2050 r
= MsiSetPropertyA(package
,"dummya","1");
2051 ok( r
== ERROR_SUCCESS
, "set property failed\n");
2052 r
= MsiSetPropertyA(package
,"dummyb","a");
2053 ok( r
== ERROR_SUCCESS
, "set property failed\n");
2054 r
= MsiSetPropertyA(package
,"dummyc","\\blath");
2055 ok( r
== ERROR_SUCCESS
, "set property failed\n");
2056 r
= MsiSetPropertyA(package
,"dummyd","[\\blath]");
2057 ok( r
== ERROR_SUCCESS
, "set property failed\n");
2058 r
= MsiRecordSetStringA(hrec
, 0, "[dummyc] [[dummyc]] [dummy[dummyb]]");
2059 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2060 r
= MsiRecordSetStringA(hrec
, 1, "aaa");
2061 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2062 r
= MsiRecordSetStringA(hrec
, 2, "bbb");
2063 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2064 r
= MsiRecordSetStringA(hrec
, 3, "ccc");
2065 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2067 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2068 ok( r
== ERROR_SUCCESS
, "format failed\n");
2069 ok( sz
== 10, "size wrong(%i)\n",sz
);
2070 ok( 0 == strcmp(buffer
,"\\blath b 1"), "wrong output (%s)\n",buffer
);
2072 r
= MsiRecordSetStringA(hrec
, 0, "[1] [2] [[\\3asdf]]");
2073 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2074 r
= MsiRecordSetStringA(hrec
, 1, "boo");
2075 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2076 r
= MsiRecordSetStringA(hrec
, 2, "hoo");
2077 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2078 r
= MsiRecordSetStringA(hrec
, 3, "yeah");
2079 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2081 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2082 ok( r
== ERROR_SUCCESS
, "format failed\n");
2085 ok( sz
== 11, "size wrong(%i)\n",sz
);
2086 ok( 0 == strcmp(buffer
,"boo hoo [3]"), "wrong output (%s)\n",buffer
);
2089 r
= MsiRecordSetStringA(hrec
, 0, "[1] [2] [[3]]");
2090 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2091 r
= MsiRecordSetStringA(hrec
, 1, "boo");
2092 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2093 r
= MsiRecordSetStringA(hrec
, 2, "hoo");
2094 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2095 r
= MsiRecordSetStringA(hrec
, 3, "\\help");
2096 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2098 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2099 ok( r
== ERROR_SUCCESS
, "format failed\n");
2100 ok( sz
== 9, "size wrong(%i)\n",sz
);
2101 ok( 0 == strcmp(buffer
,"boo hoo h"), "wrong output (%s)\n",buffer
);
2103 /* nested properties */
2104 MsiSetPropertyA(package
, "PropA", "surprise");
2105 MsiSetPropertyA(package
, "PropB", "[PropA]");
2106 MsiSetPropertyA(package
, "PropC", "[PropB]");
2108 MsiRecordSetStringA(hrec
, 0, "[PropC]");
2109 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2110 ok( r
== ERROR_SUCCESS
, "format failed\n");
2111 ok( sz
== 7, "size wrong(%i)\n",sz
);
2112 ok( 0 == strcmp(buffer
,"[PropB]"), "wrong output (%s)\n",buffer
);
2114 MsiSetPropertyA(package
, "PropA", "surprise");
2115 MsiSetPropertyA(package
, "PropB", "PropA");
2116 MsiSetPropertyA(package
, "PropC", "PropB");
2118 MsiRecordSetStringA(hrec
, 0, "[PropC]");
2119 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2120 ok( r
== ERROR_SUCCESS
, "format failed\n");
2121 ok( sz
== 5, "size wrong(%i)\n",sz
);
2122 ok( 0 == strcmp(buffer
,"PropB"), "wrong output (%s)\n",buffer
);
2124 MsiSetPropertyA(package
, "PropA", "surprise");
2125 MsiSetPropertyA(package
, "PropB", "[PropA]");
2126 MsiSetPropertyA(package
, "PropC", "[PropB]");
2128 MsiRecordSetStringA(hrec
, 0, "[[PropC]]");
2129 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2130 ok( r
== ERROR_SUCCESS
, "format failed\n");
2131 ok( sz
== 0, "size wrong(%i)\n",sz
);
2132 ok( 0 == strcmp(buffer
,""), "wrong output (%s)\n",buffer
);
2134 MsiSetPropertyA(package
, "PropA", "surprise");
2135 MsiSetPropertyA(package
, "PropB", "[PropA]");
2136 MsiSetPropertyA(package
, "PropC", "PropB");
2138 MsiRecordSetStringA(hrec
, 0, "[[PropC]]");
2139 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2140 ok( r
== ERROR_SUCCESS
, "format failed\n");
2141 ok( sz
== 7, "size wrong(%i)\n",sz
);
2142 ok( 0 == strcmp(buffer
,"[PropA]"), "wrong output (%s)\n",buffer
);
2144 MsiSetPropertyA(package
, "PropA", "surprise");
2145 MsiSetPropertyA(package
, "PropB", "PropA");
2146 MsiSetPropertyA(package
, "PropC", "PropB");
2148 MsiRecordSetStringA(hrec
, 0, "[[PropC]]");
2149 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2150 ok( r
== ERROR_SUCCESS
, "format failed\n");
2151 ok( sz
== 5, "size wrong(%i)\n",sz
);
2152 ok( 0 == strcmp(buffer
,"PropA"), "wrong output (%s)\n",buffer
);
2154 MsiSetPropertyA(package
, "PropA", "surprise");
2155 MsiSetPropertyA(package
, "PropB", "PropA");
2156 MsiSetPropertyA(package
, "PropC", "PropB");
2158 MsiRecordSetStringA(hrec
, 0, "[[[PropC]]]");
2159 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2160 ok( r
== ERROR_SUCCESS
, "format failed\n");
2161 ok( sz
== 8, "size wrong(%i)\n",sz
);
2162 ok( 0 == strcmp(buffer
,"surprise"), "wrong output (%s)\n",buffer
);
2164 /* properties inside braces */
2166 MsiRecordSetStringA(hrec
, 0, "{abcd}");
2167 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2168 ok( r
== ERROR_SUCCESS
, "format failed\n");
2169 ok( sz
== 6, "size wrong(%i)\n",sz
);
2170 ok( 0 == strcmp(buffer
,"{abcd}"), "wrong output (%s)\n",buffer
);
2172 MsiSetPropertyA(package
, "one", "mercury");
2173 MsiSetPropertyA(package
, "two", "venus");
2175 MsiRecordSetStringA(hrec
, 0, "{a[one]bc[two]de[one]f}");
2176 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2177 ok( r
== ERROR_SUCCESS
, "format failed: %d\n", r
);
2178 ok( sz
== 25, "size wrong(%i)\n",sz
);
2179 ok( 0 == strcmp(buffer
,"amercurybcvenusdemercuryf"), "wrong output (%s)\n",buffer
);
2181 MsiSetPropertyA(package
, "one", "mercury");
2182 MsiSetPropertyA(package
, "two", "venus");
2183 MsiSetPropertyA(package
, "bad", "");
2185 MsiRecordSetStringA(hrec
, 0, "{a[one]bc[bad]de[two]f}");
2186 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2187 ok( r
== ERROR_SUCCESS
, "format failed\n");
2188 ok( sz
== 0, "size wrong(%i)\n",sz
);
2189 ok( 0 == strcmp(buffer
,""), "wrong output (%s)\n",buffer
);
2191 MsiSetPropertyA(package
, "bad", "");
2193 MsiRecordSetStringA(hrec
, 0, "{[bad]}");
2194 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2195 ok( r
== ERROR_SUCCESS
, "format failed\n");
2196 ok( sz
== 0, "size wrong(%i)\n",sz
);
2197 ok( 0 == strcmp(buffer
,""), "wrong output (%s)\n",buffer
);
2199 MsiSetPropertyA(package
, "one", "mercury");
2201 MsiRecordSetStringA(hrec
, 0, "{abc{d[one]ef}"); /* missing final brace */
2202 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2203 ok( r
== ERROR_SUCCESS
, "format failed\n");
2206 ok( sz
== 14, "size wrong(%i)\n",sz
);
2207 ok( 0 == strcmp(buffer
,"abc{dmercuryef"), "wrong output (%s)\n",buffer
);
2210 MsiSetPropertyA(package
, "one", "mercury");
2212 MsiRecordSetStringA(hrec
, 0, "{abc{d[one]ef}}");
2213 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2214 ok( r
== ERROR_SUCCESS
, "format failed\n");
2217 ok( sz
== 15, "size wrong(%i)\n",sz
);
2218 ok( 0 == strcmp(buffer
,"abc{dmercuryef}"), "wrong output (%s)\n",buffer
);
2221 MsiSetPropertyA(package
, "one", "mercury");
2223 MsiRecordSetStringA(hrec
, 0, "{abc}{{def}hi{j[one]k}}");
2224 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2225 ok( r
== ERROR_SUCCESS
, "format failed\n");
2226 ok( sz
== 5, "size wrong(%i)\n",sz
);
2227 ok( 0 == strcmp(buffer
,"{abc}"), "wrong output (%s)\n",buffer
);
2229 MsiSetPropertyA(package
, "one", "mercury");
2232 MsiRecordSetStringA(hrec
, 0, "{{def}hi{j[one]k}}");
2233 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2234 ok( r
== ERROR_SUCCESS
, "format failed\n");
2235 ok( sz
== 0, "size wrong(%i)\n",sz
);
2236 ok( 0 == strcmp(buffer
,""), "wrong output (%s)\n",buffer
);
2238 sz
= sizeof(buffer
);
2239 MsiRecordSetStringA(hrec
, 0, "[1] {[noprop] [twoprop]} {abcdef}");
2240 MsiRecordSetStringA(hrec
, 1, "one");
2241 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2242 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2243 ok(sz
== 13, "Expected 13, got %d\n",sz
);
2244 ok(!lstrcmpA(buffer
, "one {abcdef}"),
2245 "Expected \"one {abcdef}\", got \"%s\"\n", buffer
);
2247 sz
= sizeof(buffer
);
2248 MsiRecordSetStringA(hrec
, 0, "[1] {[noprop] [one]} {abcdef}");
2249 MsiRecordSetStringA(hrec
, 1, "one");
2250 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2251 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2252 ok(sz
== 13, "Expected 13, got %d\n",sz
);
2253 ok(!lstrcmpA(buffer
, "one {abcdef}"),
2254 "Expected \"one {abcdef}\", got \"%s\"\n", buffer
);
2256 sz
= sizeof(buffer
);
2257 MsiRecordSetStringA(hrec
, 0, "[1] {[one]} {abcdef}");
2258 MsiRecordSetStringA(hrec
, 1, "one");
2259 r
= MsiFormatRecordA(package
, hrec
, buffer
, &sz
);
2260 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2261 ok(sz
== 20, "Expected 20, got %d\n",sz
);
2262 ok(!lstrcmpA(buffer
, "one mercury {abcdef}"),
2263 "Expected \"one mercury {abcdef}\", got \"%s\"\n", buffer
);
2265 MsiCloseHandle(hrec
);
2267 r
= MsiCloseHandle(package
);
2268 ok(r
==ERROR_SUCCESS
, "Unable to close package\n");
2270 DeleteFileA( msifile
);
2273 static void test_processmessage(void)
2275 MSIHANDLE hrec
, package
;
2278 MsiSetInternalUI(INSTALLUILEVEL_BASIC
, NULL
);
2280 r
= helper_createpackage( msifile
, &package
);
2281 if (r
== ERROR_INSTALL_PACKAGE_REJECTED
)
2283 skip("Not enough rights to perform tests\n");
2286 ok( r
== ERROR_SUCCESS
, "Unable to create package %u\n", r
);
2288 hrec
= MsiCreateRecord(3);
2289 ok( hrec
, "failed to create record\n");
2291 r
= MsiRecordSetStringA(hrec
, 1, "");
2292 ok( r
== ERROR_SUCCESS
, "set string failed\n");
2294 r
= MsiProcessMessage(package
, INSTALLMESSAGE_ACTIONSTART
, hrec
);
2295 ok( r
== IDOK
, "expected IDOK, got %i\n", r
);
2297 r
= MsiProcessMessage(package
, INSTALLMESSAGE_PROGRESS
, hrec
);
2298 ok( r
== IDOK
, "expected IDOK, got %i\n", r
);
2300 r
= MsiProcessMessage(package
, INSTALLMESSAGE_INFO
, hrec
);
2301 ok( r
== 0, "expected 0, got %i\n", r
);
2303 r
= MsiProcessMessage(package
, INSTALLMESSAGE_INITIALIZE
, hrec
);
2304 ok( r
== -1, "expected -1, got %i\n", r
);
2306 r
= MsiRecordSetInteger(hrec
, 1, 2);
2307 ok( r
== ERROR_SUCCESS
, "set integer failed\n");
2308 r
= MsiRecordSetInteger(hrec
, 2, 1);
2309 ok( r
== ERROR_SUCCESS
, "set integer failed\n");
2310 r
= MsiProcessMessage(package
, INSTALLMESSAGE_COMMONDATA
, hrec
);
2312 ok( r
== IDOK
, "expected IDOK, got %i\n", r
);
2314 r
= MsiRecordSetInteger(hrec
, 2, 2);
2315 ok( r
== ERROR_SUCCESS
, "set integer failed\n");
2316 r
= MsiProcessMessage(package
, INSTALLMESSAGE_COMMONDATA
, hrec
);
2318 ok( r
== IDOK
, "expected IDOK, got %i\n", r
);
2320 r
= MsiRecordSetInteger(hrec
, 1, 1);
2321 ok( r
== ERROR_SUCCESS
, "set integer failed\n");
2322 r
= MsiProcessMessage(package
, INSTALLMESSAGE_COMMONDATA
, hrec
);
2323 ok( r
== -1, "expected -1, got %i\n", r
);
2325 MsiCloseHandle(package
);
2327 MsiSetInternalUI(INSTALLUILEVEL_BASIC
|INSTALLUILEVEL_PROGRESSONLY
, NULL
);
2328 helper_createpackage(msifile
, &package
);
2330 r
= MsiProcessMessage(package
, INSTALLMESSAGE_ERROR
, hrec
);
2331 ok( r
== 0, "expected 0, got %i\n", r
);
2333 MsiCloseHandle(hrec
);
2334 MsiCloseHandle(package
);
2336 DeleteFileA(msifile
);
2341 test_createpackage();
2342 test_formatrecord();
2343 test_formatrecord_package();
2344 test_processmessage();