60 "Name=winetest.cat\r\n"
62 "PublicVersion=0x00000001\r\n"
64 "CATATTR1=0x10010001:attr1:value1\r\n"
65 "CATATTR2=0x10010001:attr2:value2\r\n"
68 "hashme=.\\winetest.cdf\r\n";
71 0x30, 0x82, 0x01, 0xbc, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0,
72 0x82, 0x01, 0xad, 0x30, 0x82, 0x01, 0xa9, 0x02, 0x01, 0x01, 0x31, 0x00, 0x30, 0x82, 0x01, 0x9e,
73 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x0a, 0x01, 0xa0, 0x82, 0x01, 0x8f, 0x30,
74 0x82, 0x01, 0x8b, 0x30, 0x0c, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x0c, 0x01,
75 0x01, 0x04, 0x10, 0xfa, 0x55, 0x2c, 0xc2, 0xf6, 0xcc, 0xdd, 0x11, 0x2a, 0x9c, 0x00, 0x14, 0x22,
76 0xec, 0x8f, 0x3b, 0x17, 0x0d, 0x30, 0x38, 0x31, 0x32, 0x31, 0x38, 0x31, 0x31, 0x32, 0x36, 0x34,
77 0x38, 0x5a, 0x30, 0x0e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x0c, 0x01, 0x02,
78 0x05, 0x00, 0x30, 0x81, 0xdd, 0x30, 0x81, 0xda, 0x04, 0x0e, 0x68, 0x00, 0x61, 0x00, 0x73, 0x00,
79 0x68, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00, 0x31, 0x81, 0xc7, 0x30, 0x61, 0x06, 0x0a, 0x2b,
80 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x04, 0x31, 0x53, 0x30, 0x51, 0x30, 0x2c, 0x06,
81 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x19, 0xa2, 0x1e, 0x80, 0x1c, 0x00,
82 0x3c, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x4f, 0x00, 0x62, 0x00, 0x73, 0x00, 0x6f, 0x00, 0x6c, 0x00,
83 0x65, 0x00, 0x74, 0x00, 0x65, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x30, 0x21, 0x30, 0x09, 0x06,
84 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14, 0xed, 0xd6, 0x9c, 0x9c, 0xb2, 0xfc,
85 0xaa, 0x03, 0xe8, 0xd3, 0x20, 0xf6, 0xab, 0x28, 0xc3, 0xff, 0xbd, 0x07, 0x36, 0xf5, 0x30, 0x62,
86 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x0c, 0x02, 0x02, 0x31, 0x54, 0x30, 0x52,
87 0x1e, 0x4c, 0x00, 0x7b, 0x00, 0x44, 0x00, 0x45, 0x00, 0x33, 0x00, 0x35, 0x00, 0x31, 0x00, 0x41,
88 0x00, 0x34, 0x00, 0x32, 0x00, 0x2d, 0x00, 0x38, 0x00, 0x45, 0x00, 0x35, 0x00, 0x39, 0x00, 0x2d,
89 0x00, 0x31, 0x00, 0x31, 0x00, 0x44, 0x00, 0x30, 0x00, 0x2d, 0x00, 0x38, 0x00, 0x43, 0x00, 0x34,
90 0x00, 0x37, 0x00, 0x2d, 0x00, 0x30, 0x00, 0x30, 0x00, 0x43, 0x00, 0x30, 0x00, 0x34, 0x00, 0x46,
91 0x00, 0x43, 0x00, 0x32, 0x00, 0x39, 0x00, 0x35, 0x00, 0x45, 0x00, 0x45, 0x00, 0x7d, 0x02, 0x02,
92 0x02, 0x00, 0xa0, 0x6a, 0x30, 0x68, 0x30, 0x32, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82,
93 0x37, 0x0c, 0x02, 0x01, 0x04, 0x24, 0x30, 0x22, 0x1e, 0x0a, 0x00, 0x61, 0x00, 0x74, 0x00, 0x74,
94 0x00, 0x72, 0x00, 0x32, 0x02, 0x04, 0x10, 0x01, 0x00, 0x01, 0x04, 0x0e, 0x76, 0x00, 0x61, 0x00,
95 0x6c, 0x00, 0x75, 0x00, 0x65, 0x00, 0x32, 0x00, 0x00, 0x00, 0x30, 0x32, 0x06, 0x0a, 0x2b, 0x06,
96 0x01, 0x04, 0x01, 0x82, 0x37, 0x0c, 0x02, 0x01, 0x04, 0x24, 0x30, 0x22, 0x1e, 0x0a, 0x00, 0x61,
97 0x00, 0x74, 0x00, 0x74, 0x00, 0x72, 0x00, 0x31, 0x02, 0x04, 0x10, 0x01, 0x00, 0x01, 0x04, 0x0e,
98 0x76, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x75, 0x00, 0x65, 0x00, 0x31, 0x00, 0x00, 0x00, 0x31, 0x00,
128#define WINTRUST_GET_PROC(func) \
129 p ## func = (void*)GetProcAddress(hWintrust, #func); \
131 trace("GetProcAddress(%s) failed\n", #func); \
153#undef WINTRUST_GET_PROC
157 trace(
"GetProcAddress(CryptSIPGetSignedDataMsg) failed\n");
161 trace(
"GetProcAddress(CryptSIPPutSignedDataMsg) failed\n");
164static GUID dummy = {0xdeadbeef,0xdead,0xbeef,{0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}};
170 static GUID unknown = { 0xC689AABA, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
171 static const WCHAR unknown_alg[] = {
'A',
'L',
'G',
'-',
'U',
'N',
'K',
'N',
'O',
'W',
'N',
'\0'};
206 ok(!
ret,
"Expected failure\n");
208 "Expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
212 ret = pCryptCATAdminAcquireContext(&hca,
NULL, 0);
214 ok(hca !=
NULL,
"Expected a context handle, got NULL\n");
218 ret = pCryptCATAdminReleaseContext(hca, 0);
223 ret = pCryptCATAdminReleaseContext(hca, 0);
224 ok(!
ret,
"Expected failure\n");
226 "Expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
231 ret = pCryptCATAdminReleaseContext(
NULL, 0);
232 ok(!
ret,
"Expected failure\n");
234 "Expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
239 ok(!
ret,
"Expected failure\n");
241 "Expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
253 ret = pCryptCATAdminAcquireContext(&hca, &
dummy, 0);
257 win_skip(
"Not running as administrator\n");
260 ok(hca !=
NULL,
"Expected a context handle, got NULL\n");
267 lstrcatA(dummydir,
"\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}");
270 "Expected CatRoot\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF} directory to exist\n");
277 lstrcatA(dummydir,
"\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}");
280 "Expected CatRoot2\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF} directory to exist\n");
283 ret = pCryptCATAdminReleaseContext(hca, 0);
287 ret = pCryptCATAdminAcquireContext(&hca, &
unknown, 0);
289 ok(hca !=
NULL,
"Expected a context handle, got NULL\n");
291 ret = pCryptCATAdminReleaseContext(hca, 0);
294 hca = (
void *) 0xdeadbeef;
297 ret = pCryptCATAdminAcquireContext(&hca, &
unknown, 1);
300 "Expected FALSE and ERROR_INVALID_PARAMETER with untouched handle, got %d and %lu with %p\n",
306 ret = pCryptCATAdminReleaseContext(hca, 0);
313 ok(hca !=
NULL,
"Expected a context handle, got NULL\n");
315 ret = pCryptCATAdminReleaseContext(hca, 0);
321 ok(hca !=
NULL,
"Expected a context handle, got NULL\n");
323 ret = pCryptCATAdminReleaseContext(hca, 0);
327 ret = pCryptCATAdminAcquireContext2(&hca, &
unknown, unknown_alg,
NULL, 0);
328 ok(!
ret,
"Expected failure\n");
341 BYTE expectedhash[20] = {0x3a,0xa1,0x19,0x08,0xec,0xa6,0x0d,0x2e,0x7e,0xcc,0x7a,0xca,0xf5,0xb8,0x2e,0x62,0x6a,0xda,0xf0,0x19};
342 BYTE expectedhash_sha256[32] = { 0x8a, 0xfd, 0x8c, 0xec, 0xdd, 0xe3, 0x0b, 0xaa, 0x2f, 0x1c, 0x3f, 0x61, 0xaf, 0xdf, 0x24, 0x84, 0x99, 0x8b, 0xe3, 0xcf, 0xda, 0xff, 0x0c, 0x5e, 0xa8, 0x68, 0xe8, 0xea, 0x94, 0x1e, 0x90, 0xe2};
349 ok(!
ret,
"Expected failure\n");
351 "Expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
355 ret = pCryptCATAdminCalcHashFromFileHandle(
NULL, &hashsize,
NULL, 0);
356 ok(!
ret,
"Expected failure\n");
358 "Expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
364 ok(!
ret,
"Expected failure\n");
366 "Expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
373 ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha1,
NULL,
NULL,
NULL, 0);
374 ok(!
ret,
"Expected failure\n");
376 "Expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
381 ret = pCryptCATAdminCalcHashFromFileHandle(
file, &hashsize,
NULL, 1);
382 ok(!
ret,
"Expected failure\n");
384 "Expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
391 ret = pCryptCATAdminCalcHashFromFileHandle(
file, &hashsize,
NULL, 0);
393 ok(hashsize == 20,
" Expected a hash size of 20, got %ld\n", hashsize);
395 "Expected ERROR_INSUFFICIENT_BUFFER, got %ld\n",
GetLastError());
405 ret = pCryptCATAdminCalcHashFromFileHandle(
file, &hashsize,
hash, 0);
407 ok(hashsize == 20,
" Expected a hash size of 20, got %ld\n", hashsize);
418 WriteFile(
file,
"Text in this file is needed to create a know hash", 49, &written,
NULL);
424 pCryptCATAdminCalcHashFromFileHandle(
file, &hashsize,
NULL, 0);
427 ret = pCryptCATAdminCalcHashFromFileHandle(
file, &hashsize,
hash, 0);
431 ok(hashsize ==
sizeof(expectedhash) &&
432 !
memcmp(
hash, expectedhash,
sizeof(expectedhash)),
433 "Hashes didn't match\n");
441 ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha1,
file, &hashsize,
NULL, 0);
443 ok(hashsize == 20,
" Expected a hash size of 20, got %ld\n", hashsize);
445 "Expected ERROR_INSUFFICIENT_BUFFER, got %ld\n",
GetLastError());
448 ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha1,
file, &hashsize,
hash, 0);
450 ok(hashsize == 20,
" Expected a hash size of 20, got %ld\n", hashsize);
459 pCryptCATAdminCalcHashFromFileHandle2(hca_sha1,
file, &hashsize,
NULL, 0);
462 ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha1,
file, &hashsize,
hash, 0);
466 ok(hashsize ==
sizeof(expectedhash) &&
467 !
memcmp(
hash, expectedhash,
sizeof(expectedhash)),
468 "Hashes didn't match\n");
471 pCryptCATAdminReleaseContext(hca_sha1, 0);
478 ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha256,
file, &hashsize,
NULL, 0);
480 ok(hashsize == 32,
" Expected a hash size of 32, got %ld\n", hashsize);
482 "Expected ERROR_INSUFFICIENT_BUFFER, got %ld\n",
GetLastError());
485 ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha256,
file, &hashsize,
hash, 0);
487 ok(hashsize == 32,
" Expected a hash size of 32, got %ld\n", hashsize);
497 ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha256,
file, &hashsize,
NULL, 0);
501 ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha256,
file, &hashsize,
hash, 0);
505 ok(hashsize ==
sizeof(expectedhash_sha256) &&
506 !
memcmp(
hash, expectedhash_sha256,
sizeof(expectedhash_sha256)),
507 "Hashes didn't match\n");
510 pCryptCATAdminReleaseContext(hca_sha256, 0);
527 cat = pCryptCATOpen(
NULL, 0, 0, 0, 0);
540 ok(!
ret,
"flags %#lx: expected failure\n",
flags);
546 ret = pCryptCATClose(cat);
547 ok(
ret,
"flags %#lx: failed to close file\n",
flags);
560 ret = pCryptCATClose(cat);
561 ok(
ret,
"flags %#lx: failed to close file\n",
flags);
581 ok(
error_area != -2,
"Didn't expect cdf_callback() to be called (%08lx, %08lx)\n",
590 static WCHAR nonexistent[] = {
'd',
'e',
'a',
'd',
'b',
'e',
'e',
'f',
'.',
'c',
'd',
'f',0};
596 win_skip(
"CryptCATCDFOpen is not available\n");
602 ok(catcdf ==
NULL,
"CryptCATCDFOpen succeeded\n");
608 ok(catcdf ==
NULL,
"CryptCATCDFOpen succeeded\n");
615 ok(catcdf ==
NULL,
"CryptCATCDFOpen succeeded\n");
621 ok(!
ret,
"Expected failure\n");
627 ret = pCryptCATCDFClose(catcdf);
628 ok(!
ret,
"Expected failure\n");
636 static WCHAR basenameW[] = {
'w',
'i',
'n',
'e',
't',
'e',
's',
't',
'.',
'c',
'a',
't',0};
637 static const char basename[] =
"winetest.cat";
650 if (!pCryptCATAdminRemoveCatalog)
653 win_skip(
"CryptCATAdminRemoveCatalog is not available\n");
663 ret = pCryptCATAdminAcquireContext(&hcatadmin, &
dummy, 0);
667 win_skip(
"Not running as administrator\n");
672 hcatinfo = pCryptCATAdminAddCatalog(
NULL,
NULL,
NULL, 0);
674 ok(hcatinfo ==
NULL,
"CryptCATAdminAddCatalog succeeded\n");
678 hcatinfo = pCryptCATAdminAddCatalog(hcatadmin,
NULL,
NULL, 0);
680 ok(hcatinfo ==
NULL,
"CryptCATAdminAddCatalog succeeded\n");
686 hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 0);
689 ok(hcatinfo ==
NULL,
"CryptCATAdminAddCatalog succeeded\n");
692 if (hcatinfo !=
NULL)
693 pCryptCATAdminReleaseCatalogContext(hcatadmin, hcatinfo, 0);
696 hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 1);
698 ok(hcatinfo ==
NULL,
"CryptCATAdminAddCatalog succeeded\n");
704 hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW,
NULL, 0);
706 ok(hcatinfo ==
NULL,
"CryptCATAdminAddCatalog succeeded\n");
716 hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW,
NULL, 0);
725 info.wszCatalogFile[0] = 0;
726 ret = pCryptCATCatalogInfoFromContext(hcatinfo, &
info, 0);
730 ok(
info.wszCatalogFile[0] != 0,
"Expected a filename\n");
734 memset(catfileW, 0,
sizeof(catfileW));
743 hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 0);
747 lstrcatA(catfilepath,
"\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}\\winetest.cat");
753 "File has wrong attributes : %08lx\n", attrs);
756 info.wszCatalogFile[0] = 0;
757 ret = pCryptCATCatalogInfoFromContext(hcatinfo, &
info, 0);
759 ok(
info.wszCatalogFile[0] != 0,
"Expected a filename\n");
764 ret = pCryptCATAdminReleaseCatalogContext(hcatadmin, hcatinfo, 0);
768 ret = pCryptCATAdminRemoveCatalog(hcatadmin, catfileW, 0);
773 ret = pCryptCATAdminRemoveCatalog(hcatadmin,
info.wszCatalogFile, 0);
779 ret = pCryptCATAdminRemoveCatalog(hcatadmin, basenameW, 0);
785 ret = pCryptCATAdminReleaseContext(hcatadmin, 0);
797 static const GUID subject = {0xde351a42,0x8e59,0x11d0,{0x8c,0x47,0x00,0xc0,0x4f,0xc2,0x95,0xee}};
806 int attrcount = 0, membercount = 0;
817 trace(
"Creating the catalog file\n");
834 hcat = pCryptCATOpen(catalogW, 0, 0, 0, 0);
837 win_skip(
"CryptCATOpen on W2K can't handle catalog files with no members\n");
843 ok(
m ==
NULL,
"CryptCATEnumerateMember succeeded\n");
850 ok(!
memcmp(&
m->gSubjectType, &subject,
sizeof(subject)),
"guid differs\n");
851 ok(!
m->fdwMemberFlags,
"got %lx expected 0\n",
m->fdwMemberFlags);
852 ok(
m->dwCertVersion == 0x200,
"got %lx expected 0x200\n",
m->dwCertVersion);
853 ok(!
m->dwReserved,
"got %lx expected 0\n",
m->dwReserved);
854 ok(
m->hReserved ==
NULL,
"got %p expected NULL\n",
m->hReserved);
857 ok(
attr ==
NULL,
"CryptCATEnumerateAttr succeeded\n");
861 ok(membercount == members,
"Expected %d members, got %d\n", members, membercount);
864 ok(
attr ==
NULL,
"CryptCATEnumerateAttr succeeded\n");
867 ok(
attr ==
NULL,
"CryptCATEnumerateAttr succeeded\n");
874 "Expected 'attr1' or 'attr2'\n");
879 ok(attrcount == attributes,
"Expected %d catalog attributes, got %d\n", attributes, attrcount);
881 ret = pCryptCATClose(hcat);
882 ok(
ret,
"CryptCATClose failed\n");
888 static const char catfileA[] =
"winetest.cat";
889 static const char cdffileA[] =
"winetest.cdf";
890 static WCHAR cdffileW[] = {
'w',
'i',
'n',
'e',
't',
'e',
's',
't',
'.',
'c',
'd',
'f',0};
895 DWORD written, attrs;
898 int attrcount, membercount;
902 win_skip(
"CryptCATCDFOpen is not available\n");
913 trace(
"No attribs and members\n");
918 ok(catcdf !=
NULL,
"CryptCATCDFOpen failed\n");
922 ret = pCryptCATCDFClose(catcdf);
937 trace(
"Only attributes\n");
946 "Expected 'attr1' or 'attr2'\n");
951 ok(attrcount == 2,
"Expected 2 attributes, got %d\n", attrcount);
953 pCryptCATCDFClose(catcdf);
959 trace(
"Only members\n");
965 while ((catmembertag = pCryptCATCDFEnumMembersByCDFTagEx(catcdf, catmembertag,
NULL, &catmember,
FALSE,
NULL)))
971 ok(membercount == 1,
"Expected 1 member, got %d\n", membercount);
973 pCryptCATCDFClose(catcdf);
978 trace(
"Attributes and members\n");
979 attrcount = membercount = 0;
986 ok(attrcount == 2,
"Expected 2 attributes, got %d\n", attrcount);
990 while ((catmembertag = pCryptCATCDFEnumMembersByCDFTagEx(catcdf, catmembertag,
NULL, &catmember,
FALSE,
NULL)))
993 ok(membercount == 1,
"Expected 1 member, got %d\n", membercount);
995 pCryptCATCDFClose(catcdf);
1013#define CHECK_EXPECT(a, b) \
1015 ok(a == error_area, "Expected %08x, got %08lx\n", a, error_area); \
1016 ok(b == local_error, "Expected %08x, got %08lx\n", b, local_error); \
1020#define CLEAR_EXPECT \
1021 error_area = local_error = -1
1024#define SET_UNEXPECTED \
1025 error_area = local_error = -2
1029 static const char catfileA[] =
"tempfile.cat";
1030 static const char cdffileA[] =
"tempfile.cdf";
1031 static WCHAR cdffileW[] = {
't',
'e',
'm',
'p',
'f',
'i',
'l',
'e',
'.',
'c',
'd',
'f',0};
1032 CHAR cdf_contents[4096];
1036 WCHAR *catmembertag;
1040 win_skip(
"CryptCATCDFOpen is not available\n");
1053 ok(catcdf ==
NULL,
"CryptCATCDFOpen succeeded\n");
1057 ok(!
DeleteFileA(catfileA),
"Didn't expect a catalog file to be created\n");
1060 lstrcpyA(cdf_contents,
"[CatalogHeader]\r\n");
1066 ok(catcdf ==
NULL,
"CryptCATCDFOpen succeeded\n");
1069 "Expected ERROR_SHARING_VIOLATION, got %ld\n",
GetLastError());
1073 lstrcpyA(cdf_contents,
"[CatalogHeader]\r\n");
1074 lstrcatA(cdf_contents,
"[CatalogFiles]\r\n");
1075 lstrcatA(cdf_contents,
"hashme=.\\tempfile.cdf\r\n");
1081 ok(catcdf ==
NULL,
"CryptCATCDFOpen succeeded\n");
1084 "Expected ERROR_SHARING_VIOLATION, got %ld\n",
GetLastError());
1086 ok(!
DeleteFileA(catfileA),
"Didn't expect a catalog file to be created\n");
1089 lstrcpyA(cdf_contents,
"[CatalogHeader]\r\n");
1090 lstrcatA(cdf_contents,
"Name=\r\n");
1096 ok(catcdf ==
NULL,
"CryptCATCDFOpen succeeded\n");
1099 "Expected ERROR_SHARING_VIOLATION, got %ld\n",
GetLastError());
1101 ok(!
DeleteFileA(catfileA),
"Didn't expect a catalog file to be created\n");
1104 lstrcpyA(cdf_contents,
"[CatalogHeader]\r\n");
1105 lstrcatA(cdf_contents,
"Name=tempfile.cat\r\n");
1113 ok(catcdf !=
NULL,
"CryptCATCDFOpen failed\n");
1116 pCryptCATCDFClose(catcdf);
1119 ok(
DeleteFileA(catfileA),
"Expected a catalog file to be created\n");
1122 lstrcpyA(cdf_contents,
"[CatalogHeader]\r\n");
1123 lstrcatA(cdf_contents,
"Name=tempfile.cat\r\n");
1124 lstrcatA(cdf_contents,
"[CatalogFiles]\r\n");
1125 lstrcatA(cdf_contents,
"hashme=.\\deadbeef.cdf\r\n");
1133 ok(catcdf !=
NULL,
"CryptCATCDFOpen failed\n");
1139 catmembertag =
NULL;
1140 while ((catmembertag = pCryptCATCDFEnumMembersByCDFTagEx(catcdf, catmembertag,
cdf_callback, &catmember,
FALSE,
NULL))) ;
1143 pCryptCATCDFClose(catcdf);
1146 ok(
DeleteFileA(catfileA),
"Expected a catalog file to be created\n");
1149 lstrcpyA(cdf_contents,
"[CatalogHeader]\r\n");
1150 lstrcatA(cdf_contents,
"Name=tempfile.cat\r\n");
1151 lstrcatA(cdf_contents,
"[CatalogFiles]\r\n");
1152 lstrcatA(cdf_contents,
"hashme=.\\tempfile.cdf\r");
1160 ok(catcdf !=
NULL,
"CryptCATCDFOpen failed\n");
1166 catmembertag =
NULL;
1167 while ((catmembertag = pCryptCATCDFEnumMembersByCDFTagEx(catcdf, catmembertag,
cdf_callback, &catmember,
FALSE,
NULL))) ;
1169 "Expected area 0xffffffff, got %08lx\n",
error_area);
1171 "Expected error 0xffffffff, got %08lx\n",
local_error);
1173 pCryptCATCDFClose(catcdf);
1176 ok(
DeleteFileA(catfileA),
"Expected a catalog file to be created\n");
1179 lstrcpyA(cdf_contents,
"[CatalogHeader]\r\n");
1180 lstrcatA(cdf_contents,
"Name=tempfile.cat\r\n");
1181 lstrcatA(cdf_contents,
"[CatalogFiles]\r\n");
1182 lstrcatA(cdf_contents,
"hashme=.\\tempfile.cdf\r\n");
1183 lstrcatA(cdf_contents,
"hashme=.\\tempfile.cdf\r\n");
1191 ok(catcdf !=
NULL,
"CryptCATCDFOpen failed\n");
1197 catmembertag =
NULL;
1198 while ((catmembertag = pCryptCATCDFEnumMembersByCDFTagEx(catcdf, catmembertag,
cdf_callback, &catmember,
FALSE,
NULL))) ;
1199 pCryptCATCDFClose(catcdf);
1203 ok(
DeleteFileA(catfileA),
"Expected a catalog file to be created\n");
1206 lstrcpyA(cdf_contents,
"[CatalogHeader]\r\n");
1207 lstrcatA(cdf_contents,
"Name=tempfile.cat\r\n");
1208 lstrcatA(cdf_contents,
"CATATTR1=0x10010001:attr1\r\n");
1216 ok(catcdf !=
NULL,
"CryptCATCDFOpen failed\n");
1225 pCryptCATCDFClose(catcdf);
1228 ok(
DeleteFileA(catfileA),
"Expected a catalog file to be created\n");
1231 lstrcpyA(cdf_contents,
"[CatalogHeader]\r\n");
1232 lstrcatA(cdf_contents,
"Name=tempfile.cat\r\n");
1233 lstrcatA(cdf_contents,
"CATATTR1=0x10010001:attr1:value1\r\n");
1234 lstrcatA(cdf_contents,
"CATATTR1=0x10010001:attr1:value1\r\n");
1235 lstrcatA(cdf_contents,
"[CatalogFiles]\r\n");
1236 lstrcatA(cdf_contents,
"hashme=.\\tempfile.cdf\r\n");
1244 ok(catcdf !=
NULL,
"CryptCATCDFOpen failed\n");
1250 catmembertag =
NULL;
1251 while ((catmembertag = pCryptCATCDFEnumMembersByCDFTagEx(catcdf, catmembertag,
cdf_callback, &catmember,
FALSE,
NULL))) ;
1256 pCryptCATCDFClose(catcdf);
1260 ok(
DeleteFileA(catfileA),
"Expected a catalog file to be created\n");
1263 lstrcpyA(cdf_contents,
"[CatalogHeader]\r\n");
1264 lstrcatA(cdf_contents,
"Name=tempfile.cat\r\n");
1265 lstrcatA(cdf_contents,
"CATATTR1=0x10010001:attr1:value1\r\n");
1266 lstrcatA(cdf_contents,
"CATATTR1=0x10010001:attr2:value2\r\n");
1267 lstrcatA(cdf_contents,
"[CatalogFiles]\r\n");
1268 lstrcatA(cdf_contents,
"hashme=.\\tempfile.cdf\r\n");
1276 ok(catcdf !=
NULL,
"CryptCATCDFOpen failed\n");
1282 catmembertag =
NULL;
1283 while ((catmembertag = pCryptCATCDFEnumMembersByCDFTagEx(catcdf, catmembertag,
cdf_callback, &catmember,
FALSE,
NULL))) ;
1288 pCryptCATCDFClose(catcdf);
1292 ok(
DeleteFileA(catfileA),
"Expected a catalog file to be created\n");
1356 static const WCHAR nameW[] = {
't',
'e',
's',
't',
'.',
'e',
'x',
'e',0};
1384 ok(!
ret,
"CryptSIPPutSignedDataMsg succeeded\n");
1391 ok(!
ret,
"CryptSIPPutSignedDataMsg succeeded\n");
1398 ok(!
ret,
"CryptSIPPutSignedDataMsg succeeded\n");
1406 info.pwsFileName = (
void*)0xdeadbeef;
1421 encoding = 0xdeadbeef;
1424 ok(encoding == 0xdeadbeef,
"encoding = %lx\n", encoding);
1434 encoding = 0xdeadbeef;
1437 ok(encoding == 0xdeadbeef,
"encoding = %lx\n", encoding);
1458 if (!pCryptCATAdminAcquireContext)
1460 win_skip(
"CryptCATAdmin functions are not available\n");
static const WCHAR nameW[]
#define BCRYPT_SHA256_ALGORITHM
#define BCRYPT_SHA1_ALGORITHM
#define ERROR_INSUFFICIENT_BUFFER
BOOL WINAPI CryptReleaseContext(HCRYPTPROV hProv, DWORD dwFlags)
BOOL WINAPI CryptSIPRetrieveSubjectGuid(LPCWSTR FileName, HANDLE hFileIn, GUID *pgSubject)
#define ERROR_INVALID_PARAMETER
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
static __inline const char * debugstr_an(const char *s, int n)
#define HeapFree(x, y, z)
#define FILE_ATTRIBUTE_NORMAL
#define WideCharToMultiByte
#define MultiByteToWideChar
#define ERROR_ACCESS_DENIED
static void cleanup(void)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
BOOL WINAPI SetFileAttributesA(LPCSTR lpFileName, DWORD dwFileAttributes)
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
static void basename(LPCWSTR path, LPWSTR name)
int CDECL fclose(FILE *file)
size_t CDECL fread(void *ptr, size_t size, size_t nmemb, FILE *file)
FILE *CDECL _wfopen(const wchar_t *path, const wchar_t *mode)
int CDECL fputs(const char *s, FILE *file)
FILE *CDECL tmpfile(void)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
_ACRTIMP char *__cdecl strrchr(const char *, int)
BOOL WINAPI CryptCATAdminReleaseContext(HCATADMIN hCatAdmin, DWORD dwFlags)
CRYPTCATCDF *WINAPI CryptCATCDFOpen(LPWSTR pwszFilePath, PFN_CDF_PARSE_ERROR_CALLBACK pfnParseError)
CRYPTCATATTRIBUTE *WINAPI CryptCATCDFEnumCatAttributes(CRYPTCATCDF *pCDF, CRYPTCATATTRIBUTE *pPrevAttr, PFN_CDF_PARSE_ERROR_CALLBACK pfnParseError)
BOOL WINAPI CryptCATClose(HANDLE hCatalog)
CRYPTCATMEMBER *WINAPI CryptCATEnumerateMember(HANDLE hCatalog, CRYPTCATMEMBER *prev)
BOOL WINAPI CryptCATCatalogInfoFromContext(HCATINFO hcatinfo, CATALOG_INFO *info, DWORD flags)
BOOL WINAPI CryptCATAdminCalcHashFromFileHandle(HANDLE hFile, DWORD *pcbHash, BYTE *pbHash, DWORD dwFlags)
static const GUID unknown
BOOL WINAPI CryptCATCDFClose(CRYPTCATCDF *pCDF)
BOOL WINAPI CryptCATAdminAcquireContext2(HCATADMIN *catAdmin, const GUID *sys, const WCHAR *algorithm, const CERT_STRONG_SIGN_PARA *policy, DWORD dwFlags)
LPWSTR WINAPI CryptCATCDFEnumMembersByCDFTagEx(CRYPTCATCDF *pCDF, LPWSTR pwszPrevCDFTag, PFN_CDF_PARSE_ERROR_CALLBACK pfnParseError, CRYPTCATMEMBER **ppMember, BOOL fContinueOnError, LPVOID pvReserved)
BOOL WINAPI CryptCATAdminCalcHashFromFileHandle2(HCATADMIN catAdmin, HANDLE hFile, DWORD *pcbHash, BYTE *pbHash, DWORD dwFlags)
HCATINFO WINAPI CryptCATAdminAddCatalog(HCATADMIN catAdmin, PWSTR catalogFile, PWSTR selectBaseName, DWORD flags)
BOOL WINAPI CryptCATAdminReleaseCatalogContext(HCATADMIN hCatAdmin, HCATINFO hCatInfo, DWORD dwFlags)
BOOL WINAPI CryptCATAdminRemoveCatalog(HCATADMIN hCatAdmin, LPCWSTR pwszCatalogFile, DWORD dwFlags)
CRYPTCATATTRIBUTE *WINAPI CryptCATEnumerateCatAttr(HANDLE hCatalog, CRYPTCATATTRIBUTE *prev)
BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN *catAdmin, const GUID *sys, DWORD dwFlags)
CRYPTCATATTRIBUTE *WINAPI CryptCATEnumerateAttr(HANDLE hCatalog, CRYPTCATMEMBER *member, CRYPTCATATTRIBUTE *prev)
HANDLE WINAPI CryptCATOpen(WCHAR *filename, DWORD flags, HCRYPTPROV hProv, DWORD dwPublicVersion, DWORD dwEncodingType)
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
GLenum GLuint GLenum GLsizei const GLchar * buf
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
int WINAPI lstrlenA(LPCSTR lpString)
#define ERROR_FILE_NOT_FOUND
static const WCHAR nonexistent[]
static const char * contents
static CHAR CURR_DIR[MAX_PATH]
static void test_CryptCATAdminAddRemoveCatalog(void)
static CHAR catroot2[MAX_PATH]
static pCryptSIPPutSignedDataMsg pPutSignedDataMsg
static void test_cdf_parsing(void)
static void test_catalog_properties(const char *catfile, int attributes, int members)
static const BYTE test_catalog[]
static IMAGE_NT_HEADERS nt_header
static CHAR catroot[MAX_PATH]
#define WINTRUST_GET_PROC(func)
static CRYPTCATATTRIBUTE *WINAPI * pCryptCATEnumerateAttr(HANDLE, CRYPTCATMEMBER *, CRYPTCATATTRIBUTE *)
static CRYPTCATMEMBER *WINAPI * pCryptCATEnumerateMember(HANDLE, CRYPTCATMEMBER *)
static void test_calchash(void)
static void test_context(void)
static pCryptSIPGetSignedDataMsg pGetSignedDataMsg
static const WCHAR attr2W[]
static void InitFunctionPtrs(void)
static const WCHAR attr1W[]
static void WINAPI cdf_callback(DWORD area, DWORD error, WCHAR *line)
static void test_CryptCATCDF_params(void)
static const WCHAR hashmeW[]
static void test_CryptCATOpen(void)
static CRYPTCATCDF *WINAPI * pCryptCATCDFOpen(LPWSTR, PFN_CDF_PARSE_ERROR_CALLBACK)
static const CHAR test_cdf[]
static CRYPTCATATTRIBUTE *WINAPI * pCryptCATCDFEnumCatAttributes(CRYPTCATCDF *, CRYPTCATATTRIBUTE *, PFN_CDF_PARSE_ERROR_CALLBACK)
#define CHECK_EXPECT(a, b)
static const struct @1870 dos_header
static CRYPTCATATTRIBUTE *WINAPI * pCryptCATEnumerateCatAttr(HANDLE, CRYPTCATATTRIBUTE *)
static CRYPTCATMEMBER LPVOID
static void test_sip(void)
static char selfname[MAX_PATH]
static void create_cdf_file(const CHAR *filename, const CHAR *contents)
static void test_create_catalog_file(void)
#define CRYPTCAT_E_CDF_TAGNOTFOUND
#define CRYPTCAT_E_AREA_ATTRIBUTE
#define CRYPTCAT_OPEN_CREATENEW
#define CRYPTCAT_E_CDF_MEMBER_FILENOTFOUND
#define CRYPTCAT_E_AREA_MEMBER
#define CRYPTCAT_E_AREA_HEADER
#define CRYPTCAT_E_CDF_MEMBER_FILE_PATH
#define CRYPTCAT_E_CDF_ATTR_TOOFEWVALUES
void(WINAPI * PFN_CDF_PARSE_ERROR_CALLBACK)(DWORD, DWORD, WCHAR *)
#define CRYPTCAT_OPEN_EXISTING
BOOL(WINAPI * pCryptSIPGetSignedDataMsg)(SIP_SUBJECTINFO *, DWORD *, DWORD, DWORD *, BYTE *)
BOOL(WINAPI * pCryptSIPPutSignedDataMsg)(SIP_SUBJECTINFO *, DWORD, DWORD *, DWORD, BYTE *)
struct SIP_SUBJECTINFO_ SIP_SUBJECTINFO
#define FILE_ATTRIBUTE_READONLY
#define FILE_ATTRIBUTE_SYSTEM
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
#define IMAGE_SUBSYSTEM_WINDOWS_CUI
#define IMAGE_NT_OPTIONAL_HDR_MAGIC
#define IMAGE_FILE_EXECUTABLE_IMAGE
#define IMAGE_FILE_MACHINE_I386
struct _IMAGE_OPTIONAL_HEADER IMAGE_OPTIONAL_HEADER
#define IMAGE_NT_SIGNATURE
#define IMAGE_DOS_SIGNATURE
static Real area(Real A[2], Real B[2], Real C[2])
int winetest_get_mainargs(char ***pargv)
#define INVALID_FILE_ATTRIBUTES
DWORD WINAPI GetLastError(void)
#define X509_ASN_ENCODING
#define PKCS_7_ASN_ENCODING
#define ERROR_SHARING_VIOLATION
#define ERROR_PATH_NOT_FOUND