ReactOS 0.4.16-dev-401-g45b008d
crypt.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windows.h"
#include "wincrypt.h"
#include "mscat.h"
#include "wine/test.h"
Include dependency graph for crypt.c:

Go to the source code of this file.

Macros

#define WINTRUST_GET_PROC(func)
 
#define CHECK_EXPECT(a, b)
 
#define CLEAR_EXPECT    error_area = local_error = -1
 
#define SET_UNEXPECTED    error_area = local_error = -2
 

Functions

static BOOL (WINAPI *pCryptCATAdminAcquireContext)(HCATADMIN *
 
static HCATINFO (WINAPI *pCryptCATAdminAddCatalog)(HCATADMIN
 
static HANDLE (WINAPI *pCryptCATOpen)(LPWSTR
 
static CRYPTCATATTRIBUTE *WINAPIpCryptCATCDFEnumCatAttributes (CRYPTCATCDF *, CRYPTCATATTRIBUTE *, PFN_CDF_PARSE_ERROR_CALLBACK)
 
static LPWSTR (WINAPI *pCryptCATCDFEnumMembersByCDFTagEx)(CRYPTCATCDF *
 
static CRYPTCATCDF *WINAPIpCryptCATCDFOpen (LPWSTR, PFN_CDF_PARSE_ERROR_CALLBACK)
 
static CRYPTCATATTRIBUTE *WINAPIpCryptCATEnumerateCatAttr (HANDLE, CRYPTCATATTRIBUTE *)
 
static CRYPTCATMEMBER *WINAPIpCryptCATEnumerateMember (HANDLE, CRYPTCATMEMBER *)
 
static CRYPTCATATTRIBUTE *WINAPIpCryptCATEnumerateAttr (HANDLE, CRYPTCATMEMBER *, CRYPTCATATTRIBUTE *)
 
static void InitFunctionPtrs (void)
 
static void test_context (void)
 
static void test_calchash (void)
 
static void test_CryptCATOpen (void)
 
static void WINAPI cdf_callback (DWORD area, DWORD error, WCHAR *line)
 
static void test_CryptCATCDF_params (void)
 
static void test_CryptCATAdminAddRemoveCatalog (void)
 
static void test_catalog_properties (const char *catfile, int attributes, int members)
 
static void test_create_catalog_file (void)
 
static void create_cdf_file (const CHAR *filename, const CHAR *contents)
 
static void test_cdf_parsing (void)
 
static void test_sip (void)
 
 START_TEST (crypt)
 

Variables

static char selfname [MAX_PATH]
 
static CHAR CURR_DIR [MAX_PATH]
 
static CHAR catroot [MAX_PATH]
 
static CHAR catroot2 [MAX_PATH]
 
static const WCHAR hashmeW [] = {'h','a','s','h','m','e',0}
 
static const WCHAR attr1W [] = {'a','t','t','r','1',0}
 
static const WCHAR attr2W [] = {'a','t','t','r','2',0}
 
static const CHAR test_cdf []
 
static const BYTE test_catalog []
 
static const GUID DWORD
 
static PWSTR
 
static LPCWSTR
 
static HCATINFO
 
static HCRYPTPROV
 
static LPWSTR
 
static PFN_CDF_PARSE_ERROR_CALLBACK
 
static CRYPTCATMEMBER BOOL
 
static CRYPTCATMEMBER LPVOID
 
static pCryptSIPGetSignedDataMsg pGetSignedDataMsg
 
static pCryptSIPPutSignedDataMsg pPutSignedDataMsg
 
static GUID dummy = {0xdeadbeef,0xdead,0xbeef,{0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}}
 
static DWORD error_area
 
static DWORD local_error
 
struct {
   WORD   e_magic
 
   WORD   unused [29]
 
   DWORD   e_lfanew
 
dos_header
 
static IMAGE_NT_HEADERS nt_header
 

Macro Definition Documentation

◆ CHECK_EXPECT

#define CHECK_EXPECT (   a,
  b 
)
Value:
do { \
ok(a == error_area, "Expected %08x, got %08x\n", a, error_area); \
ok(b == local_error, "Expected %08x, got %08x\n", b, local_error); \
} while (0)
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
static DWORD local_error
Definition: crypt.c:434
static DWORD error_area
Definition: crypt.c:433

Definition at line 870 of file crypt.c.

◆ CLEAR_EXPECT

#define CLEAR_EXPECT    error_area = local_error = -1

Definition at line 877 of file crypt.c.

◆ SET_UNEXPECTED

#define SET_UNEXPECTED    error_area = local_error = -2

Definition at line 881 of file crypt.c.

◆ WINTRUST_GET_PROC

#define WINTRUST_GET_PROC (   func)
Value:
p ## func = (void*)GetProcAddress(hWintrust, #func); \
if(!p ## func) { \
trace("GetProcAddress(%s) failed\n", #func); \
}
#define GetProcAddress(x, y)
Definition: compat.h:753
GLenum func
Definition: glext.h:6028
GLfloat GLfloat p
Definition: glext.h:8902

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pCryptCATAdminAcquireContext)
static

◆ cdf_callback()

static void WINAPI cdf_callback ( DWORD  area,
DWORD  error,
WCHAR line 
)
static

Definition at line 436 of file crypt.c.

437{
438 ok(error_area != -2, "Didn't expect cdf_callback() to be called (%08x, %08x)\n",
439 area, error);
440
443}
#define ok(value,...)
Definition: atltest.h:57
#define error(str)
Definition: mkdosfs.c:1605
static Real area(Real A[2], Real B[2], Real C[2])
Definition: polyDBG.cc:50

Referenced by test_cdf_parsing(), and test_CryptCATCDF_params().

◆ create_cdf_file()

static void create_cdf_file ( const CHAR filename,
const CHAR contents 
)
static

Definition at line 859 of file crypt.c.

860{
861 HANDLE file;
862 DWORD written;
863
865 ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %u\n", GetLastError());
868}
#define NULL
Definition: types.h:112
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
unsigned long DWORD
Definition: ntddk_ex.h:95
const char * filename
Definition: ioapi.h:137
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define CREATE_ALWAYS
Definition: disk.h:72
static const char * contents
Definition: parser.c:511
#define GENERIC_WRITE
Definition: nt_native.h:90
Definition: fci.c:127
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by test_cdf_parsing().

◆ HANDLE()

static HANDLE ( WINAPI pCryptCATOpen)
static

◆ HCATINFO()

static HCATINFO ( WINAPI pCryptCATAdminAddCatalog)
static

◆ InitFunctionPtrs()

static void InitFunctionPtrs ( void  )
static

Definition at line 122 of file crypt.c.

123{
124 HMODULE hWintrust = GetModuleHandleA("wintrust.dll");
125
126#define WINTRUST_GET_PROC(func) \
127 p ## func = (void*)GetProcAddress(hWintrust, #func); \
128 if(!p ## func) { \
129 trace("GetProcAddress(%s) failed\n", #func); \
130 }
131
148
149#undef WINTRUST_GET_PROC
150
151 pGetSignedDataMsg = (void*)GetProcAddress(hWintrust, "CryptSIPGetSignedDataMsg");
153 trace("GetProcAddress(CryptSIPGetSignedDataMsg) failed\n");
154
155 pPutSignedDataMsg = (void*)GetProcAddress(hWintrust, "CryptSIPPutSignedDataMsg");
157 trace("GetProcAddress(CryptSIPPutSignedDataMsg) failed\n");
158}
#define trace
Definition: atltest.h:70
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
BOOL WINAPI CryptCATAdminReleaseContext(HCATADMIN hCatAdmin, DWORD dwFlags)
Definition: crypt.c:444
CRYPTCATCDF *WINAPI CryptCATCDFOpen(LPWSTR pwszFilePath, PFN_CDF_PARSE_ERROR_CALLBACK pfnParseError)
Definition: crypt.c:1020
CRYPTCATATTRIBUTE *WINAPI CryptCATCDFEnumCatAttributes(CRYPTCATCDF *pCDF, CRYPTCATATTRIBUTE *pPrevAttr, PFN_CDF_PARSE_ERROR_CALLBACK pfnParseError)
Definition: crypt.c:994
BOOL WINAPI CryptCATClose(HANDLE hCatalog)
Definition: crypt.c:540
HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV hProv, DWORD dwPublicVersion, DWORD dwEncodingType)
Definition: crypt.c:854
CRYPTCATMEMBER *WINAPI CryptCATEnumerateMember(HANDLE hCatalog, CRYPTCATMEMBER *prev)
Definition: crypt.c:650
BOOL WINAPI CryptCATCatalogInfoFromContext(HCATINFO hcatinfo, CATALOG_INFO *info, DWORD flags)
Definition: crypt.c:835
BOOL WINAPI CryptCATAdminCalcHashFromFileHandle(HANDLE hFile, DWORD *pcbHash, BYTE *pbHash, DWORD dwFlags)
Definition: crypt.c:219
BOOL WINAPI CryptCATCDFClose(CRYPTCATCDF *pCDF)
Definition: crypt.c:984
LPWSTR WINAPI CryptCATCDFEnumMembersByCDFTagEx(CRYPTCATCDF *pCDF, LPWSTR pwszPrevCDFTag, PFN_CDF_PARSE_ERROR_CALLBACK pfnParseError, CRYPTCATMEMBER **ppMember, BOOL fContinueOnError, LPVOID pvReserved)
Definition: crypt.c:1006
HCATINFO WINAPI CryptCATAdminAddCatalog(HCATADMIN catAdmin, PWSTR catalogFile, PWSTR selectBaseName, DWORD flags)
Definition: crypt.c:162
BOOL WINAPI CryptCATAdminReleaseCatalogContext(HCATADMIN hCatAdmin, HCATINFO hCatInfo, DWORD dwFlags)
Definition: crypt.c:412
BOOL WINAPI CryptCATAdminRemoveCatalog(HCATADMIN hCatAdmin, LPCWSTR pwszCatalogFile, DWORD dwFlags)
Definition: crypt.c:475
CRYPTCATATTRIBUTE *WINAPI CryptCATEnumerateCatAttr(HANDLE hCatalog, CRYPTCATATTRIBUTE *prev)
Definition: crypt.c:632
BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN *catAdmin, const GUID *sys, DWORD dwFlags)
Definition: crypt.c:97
CRYPTCATATTRIBUTE *WINAPI CryptCATEnumerateAttr(HANDLE hCatalog, CRYPTCATMEMBER *member, CRYPTCATATTRIBUTE *prev)
Definition: crypt.c:614
static pCryptSIPPutSignedDataMsg pPutSignedDataMsg
Definition: crypt.c:120
#define WINTRUST_GET_PROC(func)
static pCryptSIPGetSignedDataMsg pGetSignedDataMsg
Definition: crypt.c:119

Referenced by START_TEST().

◆ LPWSTR()

static LPWSTR ( WINAPI pCryptCATCDFEnumMembersByCDFTagEx)
static

◆ pCryptCATCDFEnumCatAttributes()

static CRYPTCATATTRIBUTE *WINAPI * pCryptCATCDFEnumCatAttributes ( CRYPTCATCDF ,
CRYPTCATATTRIBUTE ,
PFN_CDF_PARSE_ERROR_CALLBACK   
)
static

◆ pCryptCATCDFOpen()

◆ pCryptCATEnumerateAttr()

static CRYPTCATATTRIBUTE *WINAPI * pCryptCATEnumerateAttr ( HANDLE  ,
CRYPTCATMEMBER ,
CRYPTCATATTRIBUTE  
)
static

Referenced by test_catalog_properties().

◆ pCryptCATEnumerateCatAttr()

static CRYPTCATATTRIBUTE *WINAPI * pCryptCATEnumerateCatAttr ( HANDLE  ,
CRYPTCATATTRIBUTE  
)
static

Referenced by test_catalog_properties().

◆ pCryptCATEnumerateMember()

static CRYPTCATMEMBER *WINAPI * pCryptCATEnumerateMember ( HANDLE  ,
CRYPTCATMEMBER  
)
static

Referenced by test_catalog_properties().

◆ START_TEST()

START_TEST ( crypt  )

Definition at line 1308 of file crypt.c.

1309{
1310 char** myARGV;
1311 char sysdir[MAX_PATH];
1312
1314
1315 if (!pCryptCATAdminAcquireContext)
1316 {
1317 win_skip("CryptCATAdmin functions are not available\n");
1318 return;
1319 }
1320
1322 lstrcpyA(catroot, sysdir);
1323 lstrcatA(catroot, "\\CatRoot");
1324 lstrcpyA(catroot2, sysdir);
1325 lstrcatA(catroot2, "\\CatRoot2");
1326
1328 strcpy(selfname, myARGV[0]);
1329
1331
1332 test_context();
1333 test_calchash();
1335 /* Parameter checking only */
1337 /* Test the parsing of a cdf file */
1339 /* Create a catalog file out of our own catalog definition file */
1342 test_sip();
1343}
static LPSTR * myARGV
Definition: FindFiles.c:30
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2146
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2283
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
static CHAR CURR_DIR[MAX_PATH]
Definition: crypt.c:32
static void test_CryptCATAdminAddRemoveCatalog(void)
Definition: crypt.c:491
static CHAR catroot2[MAX_PATH]
Definition: crypt.c:34
static void test_cdf_parsing(void)
Definition: crypt.c:884
static CHAR catroot[MAX_PATH]
Definition: crypt.c:33
static void test_calchash(void)
Definition: crypt.c:307
static void test_context(void)
Definition: crypt.c:162
static void InitFunctionPtrs(void)
Definition: crypt.c:122
static void test_CryptCATCDF_params(void)
Definition: crypt.c:445
static void test_CryptCATOpen(void)
Definition: crypt.c:402
static void test_sip(void)
Definition: crypt.c:1211
static char selfname[MAX_PATH]
Definition: crypt.c:31
static void test_create_catalog_file(void)
Definition: crypt.c:743
#define win_skip
Definition: test.h:163
int winetest_get_mainargs(char ***pargv)

◆ test_calchash()

static void test_calchash ( void  )
static

Definition at line 307 of file crypt.c.

308{
309 BOOL ret;
310 HANDLE file;
311 DWORD hashsize = 0;
312 BYTE* hash;
313 BYTE expectedhash[20] = {0x3a,0xa1,0x19,0x08,0xec,0xa6,0x0d,0x2e,0x7e,0xcc,0x7a,0xca,0xf5,0xb8,0x2e,0x62,0x6a,0xda,0xf0,0x19};
315 DWORD written;
316
317 /* All NULL */
318 SetLastError(0xdeadbeef);
319 ret = pCryptCATAdminCalcHashFromFileHandle(NULL, NULL, NULL, 0);
320 ok(!ret, "Expected failure\n");
322 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
323
324 /* NULL filehandle, rest is legal */
325 SetLastError(0xdeadbeef);
326 ret = pCryptCATAdminCalcHashFromFileHandle(NULL, &hashsize, NULL, 0);
327 ok(!ret, "Expected failure\n");
329 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
330
331 /* Correct filehandle, rest is NULL */
333 SetLastError(0xdeadbeef);
334 ret = pCryptCATAdminCalcHashFromFileHandle(file, NULL, NULL, 0);
335 ok(!ret, "Expected failure\n");
337 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
339
340 /* All OK, but dwFlags set to 1 */
342 SetLastError(0xdeadbeef);
343 ret = pCryptCATAdminCalcHashFromFileHandle(file, &hashsize, NULL, 1);
344 ok(!ret, "Expected failure\n");
346 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
348
349 /* All OK, requesting the size of the hash */
351 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed %u\n", GetLastError());
352 SetLastError(0xdeadbeef);
353 ret = pCryptCATAdminCalcHashFromFileHandle(file, &hashsize, NULL, 0);
354 ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
355 ok(hashsize == 20," Expected a hash size of 20, got %d\n", hashsize);
357 "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
359
360 /* All OK, retrieve the hash
361 * Double the hash buffer to see what happens to the size parameter
362 */
364 hashsize *= 2;
365 hash = HeapAlloc(GetProcessHeap(), 0, hashsize);
366 SetLastError(0xdeadbeef);
367 ret = pCryptCATAdminCalcHashFromFileHandle(file, &hashsize, hash, 0);
368 ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
369 ok(hashsize == 20," Expected a hash size of 20, got %d\n", hashsize);
371 "Expected ERROR_SUCCESS, got %d\n", GetLastError());
374
375 /* Do the same test with a file created and filled by ourselves (and we thus
376 * have a known hash for).
377 */
378 GetTempFileNameA(CURR_DIR, "hsh", 0, temp);
380 WriteFile(file, "Text in this file is needed to create a know hash", 49, &written, NULL);
382
383 /* All OK, first request the size and then retrieve the hash */
385 hashsize = 0;
386 pCryptCATAdminCalcHashFromFileHandle(file, &hashsize, NULL, 0);
387 hash = HeapAlloc(GetProcessHeap(), 0, hashsize);
388 SetLastError(0xdeadbeef);
389 ret = pCryptCATAdminCalcHashFromFileHandle(file, &hashsize, hash, 0);
390 ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
392 "Expected ERROR_SUCCESS, got %d\n", GetLastError());
393 ok(hashsize == sizeof(expectedhash) &&
394 !memcmp(hash, expectedhash, sizeof(expectedhash)),
395 "Hashes didn't match\n");
397
400}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_SUCCESS
Definition: deptool.c:10
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define OPEN_EXISTING
Definition: compat.h:775
#define SetLastError(x)
Definition: compat.h:752
#define HeapAlloc
Definition: compat.h:733
#define GENERIC_READ
Definition: compat.h:135
#define HeapFree(x, y, z)
Definition: compat.h:735
#define FILE_SHARE_READ
Definition: compat.h:136
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
unsigned int BOOL
Definition: ntddk_ex.h:94
static calc_node_t temp
Definition: rpn_ieee.c:38
Definition: _hash_fun.h:40
int ret
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().

◆ test_catalog_properties()

static void test_catalog_properties ( const char catfile,
int  attributes,
int  members 
)
static

Definition at line 652 of file crypt.c.

653{
654 static const GUID subject = {0xde351a42,0x8e59,0x11d0,{0x8c,0x47,0x00,0xc0,0x4f,0xc2,0x95,0xee}};
655
656 HANDLE hcat;
659 char catalog[MAX_PATH];
660 WCHAR catalogW[MAX_PATH];
661 DWORD attrs;
662 BOOL ret;
663 int attrcount = 0, membercount = 0;
664
665 /* FIXME: Wine can't create catalog files out of catalog definition files yet. Remove this piece
666 * once wine is fixed
667 */
668 attrs = GetFileAttributesA(catfile);
669 if (attrs == INVALID_FILE_ATTRIBUTES)
670 {
671 HANDLE file;
672 DWORD written;
673
674 trace("Creating the catalog file\n");
675 if (!GetTempFileNameA(CURR_DIR, "cat", 0, catalog)) return;
677 ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %u\n", GetLastError());
678 WriteFile(file, test_catalog, sizeof(test_catalog), &written, NULL);
680
681 attributes = 2;
682 members = 1;
683 MultiByteToWideChar(CP_ACP, 0, catalog, -1, catalogW, MAX_PATH);
684 }
685 else
686 {
687 MultiByteToWideChar(CP_ACP, 0, catfile, -1, catalogW, MAX_PATH);
688 catalog[0] = 0;
689 }
690
691 hcat = pCryptCATOpen(catalogW, 0, 0, 0, 0);
692 if (hcat == INVALID_HANDLE_VALUE && members == 0)
693 {
694 win_skip("CryptCATOpen on W2K can't handle catalog files with no members\n");
695 return;
696 }
697 ok(hcat != INVALID_HANDLE_VALUE, "CryptCATOpen failed %u\n", GetLastError());
698
700 ok(m == NULL, "CryptCATEnumerateMember succeeded\n");
701
702 m = NULL;
703 while ((m = pCryptCATEnumerateMember(hcat, m)))
704 {
705 ok(m->cbStruct == sizeof(CRYPTCATMEMBER), "unexpected size %u\n", m->cbStruct);
706 todo_wine ok(!lstrcmpW(m->pwszReferenceTag, hashmeW), "unexpected tag\n");
707 ok(!memcmp(&m->gSubjectType, &subject, sizeof(subject)), "guid differs\n");
708 ok(!m->fdwMemberFlags, "got %x expected 0\n", m->fdwMemberFlags);
709 ok(m->dwCertVersion == 0x200, "got %x expected 0x200\n", m->dwCertVersion);
710 ok(!m->dwReserved, "got %x expected 0\n", m->dwReserved);
711 ok(m->hReserved == NULL, "got %p expected NULL\n", m->hReserved);
712
714 ok(attr == NULL, "CryptCATEnumerateAttr succeeded\n");
715
716 membercount++;
717 }
718 ok(membercount == members, "Expected %d members, got %d\n", members, membercount);
719
721 ok(attr == NULL, "CryptCATEnumerateAttr succeeded\n");
722
724 ok(attr == NULL, "CryptCATEnumerateAttr succeeded\n");
725
726 attr = NULL;
727 while ((attr = pCryptCATEnumerateCatAttr(hcat, attr)))
728 {
729 ok(!lstrcmpW(attr->pwszReferenceTag, attr1W) ||
730 !lstrcmpW(attr->pwszReferenceTag, attr2W),
731 "Expected 'attr1' or 'attr2'\n");
732
733 attrcount++;
734 }
736 ok(attrcount == attributes, "Expected %d catalog attributes, got %d\n", attributes, attrcount);
737
738 ret = pCryptCATClose(hcat);
739 ok(ret, "CryptCATClose failed\n");
740 if (catalog[0]) DeleteFileA( catalog );
741}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:636
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243
const GLfloat * m
Definition: glext.h:10848
#define todo_wine
Definition: custom.c:89
static const BYTE test_catalog[]
Definition: crypt.c:70
static CRYPTCATATTRIBUTE *WINAPI * pCryptCATEnumerateAttr(HANDLE, CRYPTCATMEMBER *, CRYPTCATATTRIBUTE *)
static CRYPTCATMEMBER *WINAPI * pCryptCATEnumerateMember(HANDLE, CRYPTCATMEMBER *)
static const WCHAR attr2W[]
Definition: crypt.c:38
static const WCHAR attr1W[]
Definition: crypt.c:37
static const WCHAR hashmeW[]
Definition: crypt.c:36
static CRYPTCATATTRIBUTE *WINAPI * pCryptCATEnumerateCatAttr(HANDLE, CRYPTCATATTRIBUTE *)
Definition: cookie.c:202
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by test_cdf_parsing(), and test_create_catalog_file().

◆ test_cdf_parsing()

static void test_cdf_parsing ( void  )
static

Definition at line 884 of file crypt.c.

885{
886 static const char catfileA[] = "tempfile.cat";
887 static const char cdffileA[] = "tempfile.cdf";
888 static WCHAR cdffileW[] = {'t','e','m','p','f','i','l','e','.','c','d','f',0};
889 CHAR cdf_contents[4096];
890 CRYPTCATCDF *catcdf;
891 CRYPTCATATTRIBUTE *catattr;
892 CRYPTCATMEMBER *catmember;
893 WCHAR *catmembertag;
894
895 if (!pCryptCATCDFOpen)
896 {
897 win_skip("CryptCATCDFOpen is not available\n");
898 return;
899 }
900
901 /* Empty file */
902 DeleteFileA(cdffileA);
903 create_cdf_file(cdffileA, "");
904
906 SetLastError(0xdeadbeef);
907 catcdf = pCryptCATCDFOpen(cdffileW, cdf_callback);
910 ok(catcdf == NULL, "CryptCATCDFOpen succeeded\n");
912 ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
913 DeleteFileA(cdffileA);
914 ok(!DeleteFileA(catfileA), "Didn't expect a catalog file to be created\n");
915
916 /* Just the header */
917 lstrcpyA(cdf_contents, "[CatalogHeader]\r\n");
918 create_cdf_file(cdffileA, cdf_contents);
919
921 SetLastError(0xdeadbeef);
922 catcdf = pCryptCATCDFOpen(cdffileW, cdf_callback);
923 ok(catcdf == NULL, "CryptCATCDFOpen succeeded\n");
926 "Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
927 DeleteFileA(cdffileA);
928
929 /* Header and member only */
930 lstrcpyA(cdf_contents, "[CatalogHeader]\r\n");
931 lstrcatA(cdf_contents, "[CatalogFiles]\r\n");
932 lstrcatA(cdf_contents, "hashme=.\\tempfile.cdf\r\n");
933 create_cdf_file(cdffileA, cdf_contents);
934
936 SetLastError(0xdeadbeef);
937 catcdf = pCryptCATCDFOpen(cdffileW, cdf_callback);
938 ok(catcdf == NULL, "CryptCATCDFOpen succeeded\n");
941 "Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
942 DeleteFileA(cdffileA);
943 ok(!DeleteFileA(catfileA), "Didn't expect a catalog file to be created\n");
944
945 /* Header and Name (no value) */
946 lstrcpyA(cdf_contents, "[CatalogHeader]\r\n");
947 lstrcatA(cdf_contents, "Name=\r\n");
948 create_cdf_file(cdffileA, cdf_contents);
949
951 SetLastError(0xdeadbeef);
952 catcdf = pCryptCATCDFOpen(cdffileW, cdf_callback);
953 ok(catcdf == NULL, "CryptCATCDFOpen succeeded\n");
956 "Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
957 DeleteFileA(cdffileA);
958 ok(!DeleteFileA(catfileA), "Didn't expect a catalog file to be created\n");
959
960 /* Header and Name */
961 lstrcpyA(cdf_contents, "[CatalogHeader]\r\n");
962 lstrcatA(cdf_contents, "Name=tempfile.cat\r\n");
963 create_cdf_file(cdffileA, cdf_contents);
964
966 SetLastError(0xdeadbeef);
967 catcdf = pCryptCATCDFOpen(cdffileW, cdf_callback);
969 {
970 ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
971 ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
972 }
973 pCryptCATCDFClose(catcdf);
974 DeleteFileA(cdffileA);
976 ok(DeleteFileA(catfileA), "Expected a catalog file to be created\n");
977
978 /* Header and nonexistent member */
979 lstrcpyA(cdf_contents, "[CatalogHeader]\r\n");
980 lstrcatA(cdf_contents, "Name=tempfile.cat\r\n");
981 lstrcatA(cdf_contents, "[CatalogFiles]\r\n");
982 lstrcatA(cdf_contents, "hashme=.\\deadbeef.cdf\r\n");
983 create_cdf_file(cdffileA, cdf_contents);
984
986 SetLastError(0xdeadbeef);
987 catcdf = pCryptCATCDFOpen(cdffileW, cdf_callback);
989 {
990 ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
991 ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
992 }
993 /* Loop through the members */
995 catmember = NULL;
996 catmembertag = NULL;
997 while ((catmembertag = pCryptCATCDFEnumMembersByCDFTagEx(catcdf, catmembertag, cdf_callback, &catmember, FALSE, NULL))) ;
1000 pCryptCATCDFClose(catcdf);
1001 DeleteFileA(cdffileA);
1002 todo_wine
1003 ok(DeleteFileA(catfileA), "Expected a catalog file to be created\n");
1004
1005 /* Header, correct member but no explicit newline */
1006 lstrcpyA(cdf_contents, "[CatalogHeader]\r\n");
1007 lstrcatA(cdf_contents, "Name=tempfile.cat\r\n");
1008 lstrcatA(cdf_contents, "[CatalogFiles]\r\n");
1009 lstrcatA(cdf_contents, "hashme=.\\tempfile.cdf\r");
1010 create_cdf_file(cdffileA, cdf_contents);
1011
1013 SetLastError(0xdeadbeef);
1014 catcdf = pCryptCATCDFOpen(cdffileW, cdf_callback);
1015 todo_wine
1016 {
1017 ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
1018 ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
1019 }
1020 /* Loop through the members */
1022 catmember = NULL;
1023 catmembertag = NULL;
1024 while ((catmembertag = pCryptCATCDFEnumMembersByCDFTagEx(catcdf, catmembertag, cdf_callback, &catmember, FALSE, NULL))) ;
1025 ok(error_area == 0xffffffff || broken(error_area == CRYPTCAT_E_AREA_MEMBER) /* < win81 */,
1026 "Expected area 0xffffffff, got %08x\n", error_area);
1027 ok(local_error == 0xffffffff || broken(local_error == CRYPTCAT_E_CDF_MEMBER_FILE_PATH) /* < win81 */,
1028 "Expected error 0xffffffff, got %08x\n", local_error);
1029
1030 pCryptCATCDFClose(catcdf);
1031 DeleteFileA(cdffileA);
1032 todo_wine
1033 ok(DeleteFileA(catfileA), "Expected a catalog file to be created\n");
1034
1035 /* Header and 2 duplicate members */
1036 lstrcpyA(cdf_contents, "[CatalogHeader]\r\n");
1037 lstrcatA(cdf_contents, "Name=tempfile.cat\r\n");
1038 lstrcatA(cdf_contents, "[CatalogFiles]\r\n");
1039 lstrcatA(cdf_contents, "hashme=.\\tempfile.cdf\r\n");
1040 lstrcatA(cdf_contents, "hashme=.\\tempfile.cdf\r\n");
1041 create_cdf_file(cdffileA, cdf_contents);
1042
1044 SetLastError(0xdeadbeef);
1045 catcdf = pCryptCATCDFOpen(cdffileW, cdf_callback);
1046 todo_wine
1047 {
1048 ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
1049 ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
1050 }
1051 /* Loop through the members */
1053 catmember = NULL;
1054 catmembertag = NULL;
1055 while ((catmembertag = pCryptCATCDFEnumMembersByCDFTagEx(catcdf, catmembertag, cdf_callback, &catmember, FALSE, NULL))) ;
1056 pCryptCATCDFClose(catcdf);
1057 test_catalog_properties(catfileA, 0, 1);
1058 DeleteFileA(cdffileA);
1059 todo_wine
1060 ok(DeleteFileA(catfileA), "Expected a catalog file to be created\n");
1061
1062 /* Wrong attribute */
1063 lstrcpyA(cdf_contents, "[CatalogHeader]\r\n");
1064 lstrcatA(cdf_contents, "Name=tempfile.cat\r\n");
1065 lstrcatA(cdf_contents, "CATATTR1=0x10010001:attr1\r\n");
1066 create_cdf_file(cdffileA, cdf_contents);
1067
1069 SetLastError(0xdeadbeef);
1070 catcdf = pCryptCATCDFOpen(cdffileW, cdf_callback);
1071 todo_wine
1072 {
1073 ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
1074 ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
1075 }
1076 /* Loop through the attributes */
1078 catattr = NULL;
1079 while ((catattr = pCryptCATCDFEnumCatAttributes(catcdf, catattr, cdf_callback))) ;
1080 todo_wine
1082 pCryptCATCDFClose(catcdf);
1083 DeleteFileA(cdffileA);
1084 todo_wine
1085 ok(DeleteFileA(catfileA), "Expected a catalog file to be created\n");
1086
1087 /* Two identical attributes */
1088 lstrcpyA(cdf_contents, "[CatalogHeader]\r\n");
1089 lstrcatA(cdf_contents, "Name=tempfile.cat\r\n");
1090 lstrcatA(cdf_contents, "CATATTR1=0x10010001:attr1:value1\r\n");
1091 lstrcatA(cdf_contents, "CATATTR1=0x10010001:attr1:value1\r\n");
1092 lstrcatA(cdf_contents, "[CatalogFiles]\r\n");
1093 lstrcatA(cdf_contents, "hashme=.\\tempfile.cdf\r\n");
1094 create_cdf_file(cdffileA, cdf_contents);
1095
1097 SetLastError(0xdeadbeef);
1098 catcdf = pCryptCATCDFOpen(cdffileW, cdf_callback);
1099 todo_wine
1100 {
1101 ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
1102 ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
1103 }
1104 /* Loop through the members */
1106 catmember = NULL;
1107 catmembertag = NULL;
1108 while ((catmembertag = pCryptCATCDFEnumMembersByCDFTagEx(catcdf, catmembertag, cdf_callback, &catmember, FALSE, NULL))) ;
1109 /* Loop through the attributes */
1111 catattr = NULL;
1112 while ((catattr = pCryptCATCDFEnumCatAttributes(catcdf, catattr, cdf_callback))) ;
1113 pCryptCATCDFClose(catcdf);
1114 test_catalog_properties(catfileA, 1, 1);
1115 DeleteFileA(cdffileA);
1116 todo_wine
1117 ok(DeleteFileA(catfileA), "Expected a catalog file to be created\n");
1118
1119 /* Two different attribute values with the same tag */
1120 lstrcpyA(cdf_contents, "[CatalogHeader]\r\n");
1121 lstrcatA(cdf_contents, "Name=tempfile.cat\r\n");
1122 lstrcatA(cdf_contents, "CATATTR1=0x10010001:attr1:value1\r\n");
1123 lstrcatA(cdf_contents, "CATATTR1=0x10010001:attr2:value2\r\n");
1124 lstrcatA(cdf_contents, "[CatalogFiles]\r\n");
1125 lstrcatA(cdf_contents, "hashme=.\\tempfile.cdf\r\n");
1126 create_cdf_file(cdffileA, cdf_contents);
1127
1129 SetLastError(0xdeadbeef);
1130 catcdf = pCryptCATCDFOpen(cdffileW, cdf_callback);
1131 todo_wine
1132 {
1133 ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
1134 ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
1135 }
1136 /* Loop through the members */
1138 catmember = NULL;
1139 catmembertag = NULL;
1140 while ((catmembertag = pCryptCATCDFEnumMembersByCDFTagEx(catcdf, catmembertag, cdf_callback, &catmember, FALSE, NULL))) ;
1141 /* Loop through the attributes */
1143 catattr = NULL;
1144 while ((catattr = pCryptCATCDFEnumCatAttributes(catcdf, catattr, cdf_callback))) ;
1145 pCryptCATCDFClose(catcdf);
1146 test_catalog_properties(catfileA, 1, 1);
1147 DeleteFileA(cdffileA);
1148 todo_wine
1149 ok(DeleteFileA(catfileA), "Expected a catalog file to be created\n");
1150}
#define broken(x)
Definition: atltest.h:178
#define FALSE
Definition: types.h:117
static void test_catalog_properties(const char *catfile, int attributes, int members)
Definition: crypt.c:652
static void WINAPI cdf_callback(DWORD area, DWORD error, WCHAR *line)
Definition: crypt.c:436
static CRYPTCATCDF *WINAPI * pCryptCATCDFOpen(LPWSTR, PFN_CDF_PARSE_ERROR_CALLBACK)
static CRYPTCATATTRIBUTE *WINAPI * pCryptCATCDFEnumCatAttributes(CRYPTCATCDF *, CRYPTCATATTRIBUTE *, PFN_CDF_PARSE_ERROR_CALLBACK)
#define CHECK_EXPECT(a, b)
Definition: crypt.c:870
#define SET_UNEXPECTED
Definition: crypt.c:881
#define CLEAR_EXPECT
Definition: crypt.c:877
static void create_cdf_file(const CHAR *filename, const CHAR *contents)
Definition: crypt.c:859
#define CRYPTCAT_E_CDF_TAGNOTFOUND
Definition: mscat.h:47
#define CRYPTCAT_E_AREA_ATTRIBUTE
Definition: mscat.h:43
#define CRYPTCAT_E_CDF_MEMBER_FILENOTFOUND
Definition: mscat.h:51
#define CRYPTCAT_E_AREA_MEMBER
Definition: mscat.h:42
#define CRYPTCAT_E_AREA_HEADER
Definition: mscat.h:41
#define CRYPTCAT_E_CDF_MEMBER_FILE_PATH
Definition: mscat.h:49
#define CRYPTCAT_E_CDF_ATTR_TOOFEWVALUES
Definition: mscat.h:54
#define ERROR_SHARING_VIOLATION
Definition: winerror.h:135

Referenced by START_TEST().

◆ test_context()

static void test_context ( void  )
static

Definition at line 162 of file crypt.c.

163{
164 BOOL ret;
165 HCATADMIN hca;
166 static GUID unknown = { 0xC689AABA, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }}; /* WINTRUST.DLL */
167 CHAR dummydir[MAX_PATH];
168 DWORD attrs;
169
170 /* When CryptCATAdminAcquireContext is successful it will create
171 * several directories if they don't exist:
172 *
173 * ...\system32\CatRoot\{GUID}, this directory holds the .cat files
174 * ...\system32\CatRoot2\{GUID} (WinXP and up), here we find the catalog database for that GUID
175 *
176 * Windows Vista uses lowercase catroot and catroot2.
177 *
178 * When passed a NULL GUID it will create the following directories although on
179 * WinXP and up these directories are already present when Windows is installed:
180 *
181 * ...\system32\CatRoot\{127D0A1D-4EF2-11D1-8608-00C04FC295EE}
182 * ...\system32\CatRoot2\{127D0A1D-4EF2-11D1-8608-00C04FC295EE} (WinXP up)
183 *
184 * TODO: Find out what this GUID is/does.
185 *
186 * On WinXP and up there is also a TimeStamp file in some of directories that
187 * seem to indicate the last change to the catalog database for that GUID.
188 *
189 * On Windows 2000 some files are created/updated:
190 *
191 * ...\system32\CatRoot\SYSMAST.cbk
192 * ...\system32\CatRoot\SYSMAST.cbd
193 * ...\system32\CatRoot\{GUID}\CATMAST.cbk
194 * ...\system32\CatRoot\{GUID}\CATMAST.cbd
195 *
196 */
197
198 /* All NULL */
199 SetLastError(0xdeadbeef);
200 ret = pCryptCATAdminAcquireContext(NULL, NULL, 0);
201 ok(!ret, "Expected failure\n");
203 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
204
205 /* NULL GUID */
206 if (0) { /* crashes on 64-bit win10 */
207 ret = pCryptCATAdminAcquireContext(&hca, NULL, 0);
208 ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
209 ok(hca != NULL, "Expected a context handle, got NULL\n");
210
211 /* Proper release */
212 SetLastError(0xdeadbeef);
213 ret = pCryptCATAdminReleaseContext(hca, 0);
214 ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
215
216 /* Try to release a second time */
217 SetLastError(0xdeadbeef);
218 ret = pCryptCATAdminReleaseContext(hca, 0);
219 ok(!ret, "Expected failure\n");
221 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
222 }
223
224 /* All NULL */
225 SetLastError(0xdeadbeef);
226 ret = pCryptCATAdminReleaseContext(NULL, 0);
227 ok(!ret, "Expected failure\n");
229 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
230
231 /* NULL context handle and dummy GUID */
232 SetLastError(0xdeadbeef);
233 ret = pCryptCATAdminAcquireContext(NULL, &dummy, 0);
234 ok(!ret, "Expected failure\n");
236 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
237
238 /* Correct context handle and dummy GUID
239 *
240 * The tests run in the past unfortunately made sure that some directories were created.
241 *
242 * FIXME:
243 * We don't want to mess too much with these for now so we should delete only the ones
244 * that shouldn't be there like the deadbeef ones. We first have to figure out if it's
245 * safe to remove files and directories from CatRoot/CatRoot2.
246 */
247
248 ret = pCryptCATAdminAcquireContext(&hca, &dummy, 0);
249 ok(ret || GetLastError() == ERROR_ACCESS_DENIED, "CryptCATAdminAcquireContext failed %u\n", GetLastError());
251 {
252 win_skip("Not running as administrator\n");
253 return;
254 }
255 ok(hca != NULL, "Expected a context handle, got NULL\n");
256
258 ok(attrs != INVALID_FILE_ATTRIBUTES, "Expected the CatRoot directory to exist\n");
259
260 /* Windows creates the GUID directory in capitals */
261 lstrcpyA(dummydir, catroot);
262 lstrcatA(dummydir, "\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}");
263 attrs = GetFileAttributesA(dummydir);
265 "Expected CatRoot\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF} directory to exist\n");
266
267 /* Only present on XP or higher. */
269 if (attrs != INVALID_FILE_ATTRIBUTES)
270 {
271 lstrcpyA(dummydir, catroot2);
272 lstrcatA(dummydir, "\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}");
273 attrs = GetFileAttributesA(dummydir);
275 "Expected CatRoot2\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF} directory to exist\n");
276 }
277
278 ret = pCryptCATAdminReleaseContext(hca, 0);
279 ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
280
281 /* Correct context handle and GUID */
282 ret = pCryptCATAdminAcquireContext(&hca, &unknown, 0);
283 ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
284 ok(hca != NULL, "Expected a context handle, got NULL\n");
285
286 ret = pCryptCATAdminReleaseContext(hca, 0);
287 ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
288
289 hca = (void *) 0xdeadbeef;
290 SetLastError(0xdeadbeef);
291 /* Flags is documented as unused, but the parameter is checked since win8 */
292 ret = pCryptCATAdminAcquireContext(&hca, &unknown, 1);
293 ok((!ret && (GetLastError() == ERROR_INVALID_PARAMETER) && (hca == (void *) 0xdeadbeef)) ||
294 broken(ret && hca != NULL && hca != (void *) 0xdeadbeef),
295 "Expected FALSE and ERROR_INVALID_PARAMETER with untouched handle, got %d and %u with %p\n",
296 ret, GetLastError(), hca);
297
298 if (ret && hca)
299 {
300 SetLastError(0xdeadbeef);
301 ret = pCryptCATAdminReleaseContext(hca, 0);
302 ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
303 }
304}
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
static const GUID unknown
Definition: crypt.c:1365

Referenced by START_TEST().

◆ test_create_catalog_file()

static void test_create_catalog_file ( void  )
static

Definition at line 743 of file crypt.c.

744{
745 static const char catfileA[] = "winetest.cat";
746 static const char cdffileA[] = "winetest.cdf";
747 static WCHAR cdffileW[] = {'w','i','n','e','t','e','s','t','.','c','d','f',0};
748 CRYPTCATCDF *catcdf;
749 CRYPTCATATTRIBUTE *catattr;
750 CRYPTCATMEMBER *catmember;
751 WCHAR *catmembertag;
752 DWORD written, attrs;
753 HANDLE file;
754 BOOL ret;
755 int attrcount, membercount;
756
757 if (!pCryptCATCDFOpen)
758 {
759 win_skip("CryptCATCDFOpen is not available\n");
760 return;
761 }
762
763 /* Create the cdf file */
765 ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %u\n", GetLastError());
766 WriteFile(file, test_cdf, sizeof(test_cdf) - 1, &written, NULL);
768
769 /* Don't enumerate attributes and members */
770 trace("No attribs and members\n");
771 SetLastError(0xdeadbeef);
772 catcdf = pCryptCATCDFOpen(cdffileW, NULL);
774 {
775 ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
776 ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
777 }
778
779 ret = pCryptCATCDFClose(catcdf);
781 {
782 ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
783 ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
784 }
785
786 attrs = GetFileAttributesA(catfileA);
788 ok(attrs != INVALID_FILE_ATTRIBUTES, "Expected the catalog file to exist\n");
789
790 test_catalog_properties(catfileA, 0, 0);
791 DeleteFileA(catfileA);
792
793 /* Only enumerate the attributes */
794 trace("Only attributes\n");
795 attrcount = 0;
796 catcdf = pCryptCATCDFOpen(cdffileW, NULL);
797
798 catattr = NULL;
799 while ((catattr = pCryptCATCDFEnumCatAttributes(catcdf, catattr, NULL)))
800 {
801 ok(!lstrcmpW(catattr->pwszReferenceTag, attr1W) ||
802 !lstrcmpW(catattr->pwszReferenceTag, attr2W),
803 "Expected 'attr1' or 'attr2'\n");
804
805 attrcount++;
806 }
808 ok(attrcount == 2, "Expected 2 attributes, got %d\n", attrcount);
809
810 pCryptCATCDFClose(catcdf);
811 /* Even though the resulting catalog file shows the attributes, they will not be enumerated */
812 test_catalog_properties(catfileA, 0, 0);
813 DeleteFileA(catfileA);
814
815 /* Only enumerate the members */
816 trace("Only members\n");
817 membercount = 0;
818 catcdf = pCryptCATCDFOpen(cdffileW, NULL);
819
820 catmember = NULL;
821 catmembertag = NULL;
822 while ((catmembertag = pCryptCATCDFEnumMembersByCDFTagEx(catcdf, catmembertag, NULL, &catmember, FALSE, NULL)))
823 {
824 ok(!lstrcmpW(catmembertag, hashmeW), "Expected 'hashme'\n");
825 membercount++;
826 }
828 ok(membercount == 1, "Expected 1 member, got %d\n", membercount);
829
830 pCryptCATCDFClose(catcdf);
831 test_catalog_properties(catfileA, 0, 1);
832 DeleteFileA(catfileA);
833
834 /* Enumerate members and attributes */
835 trace("Attributes and members\n");
836 attrcount = membercount = 0;
837 catcdf = pCryptCATCDFOpen(cdffileW, NULL);
838
839 catattr = NULL;
840 while ((catattr = pCryptCATCDFEnumCatAttributes(catcdf, catattr, NULL)))
841 attrcount++;
843 ok(attrcount == 2, "Expected 2 attributes, got %d\n", attrcount);
844
845 catmember = NULL;
846 catmembertag = NULL;
847 while ((catmembertag = pCryptCATCDFEnumMembersByCDFTagEx(catcdf, catmembertag, NULL, &catmember, FALSE, NULL)))
848 membercount++;
850 ok(membercount == 1, "Expected 1 member, got %d\n", membercount);
851
852 pCryptCATCDFClose(catcdf);
853 test_catalog_properties(catfileA, 2, 1);
854 DeleteFileA(catfileA);
855
856 DeleteFileA(cdffileA);
857}
static const CHAR test_cdf[]
Definition: crypt.c:58
LPWSTR pwszReferenceTag
Definition: mscat.h:62

Referenced by START_TEST().

◆ test_CryptCATAdminAddRemoveCatalog()

static void test_CryptCATAdminAddRemoveCatalog ( void  )
static

Definition at line 491 of file crypt.c.

492{
493 static WCHAR basenameW[] = {'w','i','n','e','t','e','s','t','.','c','a','t',0};
494 static const char basename[] = "winetest.cat";
495 HCATADMIN hcatadmin;
496 HCATINFO hcatinfo;
498 WCHAR tmpfileW[MAX_PATH];
499 char tmpfile[MAX_PATH];
500 char catfile[MAX_PATH], catfilepath[MAX_PATH], *p;
501 WCHAR catfileW[MAX_PATH];
502 HANDLE file;
503 DWORD error, written;
504 BOOL ret;
505 DWORD attrs;
506
507 if (!pCryptCATAdminRemoveCatalog)
508 {
509 /* NT4 and W2K do have CryptCATAdminAddCatalog !! */
510 win_skip("CryptCATAdminRemoveCatalog is not available\n");
511 return;
512 }
513
514 if (!GetTempFileNameA(CURR_DIR, "cat", 0, tmpfile)) return;
517 ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %u\n", GetLastError());
519
520 ret = pCryptCATAdminAcquireContext(&hcatadmin, &dummy, 0);
521 ok(ret || GetLastError() == ERROR_ACCESS_DENIED, "CryptCATAdminAcquireContext failed %u\n", GetLastError());
523 {
524 win_skip("Not running as administrator\n");
525 return;
526 }
527
528 SetLastError(0xdeadbeef);
529 hcatinfo = pCryptCATAdminAddCatalog(NULL, NULL, NULL, 0);
531 ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n");
532 ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", GetLastError());
533
534 SetLastError(0xdeadbeef);
535 hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, NULL, NULL, 0);
537 ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n");
538 ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", GetLastError());
539
540 MultiByteToWideChar(CP_ACP, 0, tmpfile, -1, tmpfileW, MAX_PATH);
541
542 SetLastError(0xdeadbeef);
543 hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 0);
545 todo_wine {
546 ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n");
547 ok(error == ERROR_BAD_FORMAT, "got %u expected ERROR_BAD_FORMAT\n", GetLastError());
548 }
549 if (hcatinfo != NULL)
550 pCryptCATAdminReleaseCatalogContext(hcatadmin, hcatinfo, 0);
551
552 SetLastError(0xdeadbeef);
553 hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 1);
555 ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n");
557 error == ERROR_BAD_FORMAT, /* win 8 */
558 "got %u\n", GetLastError());
559
560 SetLastError(0xdeadbeef);
561 hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, NULL, 0);
563 ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n");
564 todo_wine ok(error == ERROR_BAD_FORMAT, "got %u expected ERROR_BAD_FORMAT\n", GetLastError());
565
568 ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %u\n", GetLastError());
569 WriteFile(file, test_catalog, sizeof(test_catalog), &written, NULL);
571
572 /* Unique name will be created */
573 hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, NULL, 0);
574 if (!hcatinfo && (GetLastError() == ERROR_ACCESS_DENIED))
575 {
576 win_skip("Not enough rights\n");
577 goto cleanup;
578 }
579 todo_wine ok(hcatinfo != NULL, "CryptCATAdminAddCatalog failed %u\n", GetLastError());
580
581 info.cbStruct = sizeof(info);
582 info.wszCatalogFile[0] = 0;
583 ret = pCryptCATCatalogInfoFromContext(hcatinfo, &info, 0);
585 {
586 ok(ret, "CryptCATCatalogInfoFromContext failed %u\n", GetLastError());
587 ok(info.wszCatalogFile[0] != 0, "Expected a filename\n");
588 }
589 WideCharToMultiByte(CP_ACP, 0, info.wszCatalogFile, -1, catfile, MAX_PATH, NULL, NULL);
590 if ((p = strrchr(catfile, '\\'))) p++;
591 memset(catfileW, 0, sizeof(catfileW));
592 MultiByteToWideChar(CP_ACP, 0, p, -1, catfileW, MAX_PATH);
593
594 /* Set the file attributes so we can check what happens with them during the 'copy' */
597 ok(ret, "SetFileAttributesA failed : %u\n", GetLastError());
598
599 /* winetest.cat will be created */
600 hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 0);
601 ok(hcatinfo != NULL, "CryptCATAdminAddCatalog failed %u\n", GetLastError());
602
603 lstrcpyA(catfilepath, catroot);
604 lstrcatA(catfilepath, "\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}\\winetest.cat");
605 attrs = GetFileAttributesA(catfilepath);
606 ok(attrs != INVALID_FILE_ATTRIBUTES, "Expected %s to exist\n", catfilepath);
608 ok(attrs == FILE_ATTRIBUTE_SYSTEM ||
610 "File has wrong attributes : %08x\n", attrs);
611
612 info.cbStruct = sizeof(info);
613 info.wszCatalogFile[0] = 0;
614 ret = pCryptCATCatalogInfoFromContext(hcatinfo, &info, 0);
615 ok(ret, "CryptCATCatalogInfoFromContext failed %u\n", GetLastError());
616 ok(info.wszCatalogFile[0] != 0, "Expected a filename\n");
617 WideCharToMultiByte(CP_ACP, 0, info.wszCatalogFile, -1, catfile, MAX_PATH, NULL, NULL);
618 if ((p = strrchr(catfile, '\\'))) p++;
619 ok(!lstrcmpA(basename, p), "Expected %s, got %s\n", basename, p);
620
621 ret = pCryptCATAdminReleaseCatalogContext(hcatadmin, hcatinfo, 0);
622 ok(ret, "CryptCATAdminReleaseCatalogContext failed %u\n", GetLastError());
623
624 /* Remove the catalog file with the unique name */
625 ret = pCryptCATAdminRemoveCatalog(hcatadmin, catfileW, 0);
626 ok(ret, "CryptCATAdminRemoveCatalog failed %u\n", GetLastError());
627
628 /* Remove the winetest.cat catalog file, first with the full path. This should not succeed
629 * according to MSDN */
630 ret = pCryptCATAdminRemoveCatalog(hcatadmin, info.wszCatalogFile, 0);
631 ok(ret, "CryptCATAdminRemoveCatalog failed %u\n", GetLastError());
632 /* The call succeeded with the full path but the file is not removed */
633 attrs = GetFileAttributesA(catfilepath);
634 ok(attrs != INVALID_FILE_ATTRIBUTES, "Expected %s to exist\n", catfilepath);
635 /* Given only the filename the file is removed */
636 ret = pCryptCATAdminRemoveCatalog(hcatadmin, basenameW, 0);
637 ok(ret, "CryptCATAdminRemoveCatalog failed %u\n", GetLastError());
638 attrs = GetFileAttributesA(catfilepath);
639 ok(attrs == INVALID_FILE_ATTRIBUTES, "Expected %s to be removed\n", catfilepath);
640
641cleanup:
642 ret = pCryptCATAdminReleaseContext(hcatadmin, 0);
643 ok(ret, "CryptCATAdminReleaseContext failed %u\n", GetLastError());
644
645 /* Set the attributes so we can delete the file */
646 attrs = FILE_ATTRIBUTE_NORMAL;
648 ok(ret, "SetFileAttributesA failed %u\n", GetLastError());
650}
#define WideCharToMultiByte
Definition: compat.h:111
static void cleanup(void)
Definition: main.c:1335
BOOL WINAPI SetFileAttributesA(LPCSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:776
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4195
static void basename(LPCWSTR path, LPWSTR name)
Definition: profile.c:38
_Check_return_ _CRTIMP FILE *__cdecl tmpfile(void)
Definition: file.c:3914
#define CREATE_NEW
Definition: disk.h:69
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
Definition: ntifs_ex.h:384
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define memset(x, y, z)
Definition: compat.h:39
#define ERROR_BAD_FORMAT
Definition: winerror.h:114

Referenced by START_TEST().

◆ test_CryptCATCDF_params()

static void test_CryptCATCDF_params ( void  )
static

Definition at line 445 of file crypt.c.

446{
447 static WCHAR nonexistent[] = {'d','e','a','d','b','e','e','f','.','c','d','f',0};
448 CRYPTCATCDF *catcdf;
449 BOOL ret;
450
451 if (!pCryptCATCDFOpen)
452 {
453 win_skip("CryptCATCDFOpen is not available\n");
454 return;
455 }
456
457 SetLastError(0xdeadbeef);
458 catcdf = pCryptCATCDFOpen(NULL, NULL);
459 ok(catcdf == NULL, "CryptCATCDFOpen succeeded\n");
461 ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
462
463 SetLastError(0xdeadbeef);
465 ok(catcdf == NULL, "CryptCATCDFOpen succeeded\n");
467 ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
468
469 /* File doesn't exist */
470 SetLastError(0xdeadbeef);
472 ok(catcdf == NULL, "CryptCATCDFOpen succeeded\n");
474 ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
475
476 SetLastError(0xdeadbeef);
477 ret = pCryptCATCDFClose(NULL);
478 ok(!ret, "Expected failure\n");
480 ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
481
482 catcdf = NULL;
483 SetLastError(0xdeadbeef);
484 ret = pCryptCATCDFClose(catcdf);
485 ok(!ret, "Expected failure\n");
487 ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
488}
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static const WCHAR nonexistent[]
Definition: font.c:33

Referenced by START_TEST().

◆ test_CryptCATOpen()

static void test_CryptCATOpen ( void  )
static

Definition at line 402 of file crypt.c.

403{
404 HANDLE hcat;
405 char empty[MAX_PATH];
407 HANDLE file;
408 BOOL ret;
409
410 SetLastError(0xdeadbeef);
411 hcat = pCryptCATOpen(NULL, 0, 0, 0, 0);
412 ok(hcat == INVALID_HANDLE_VALUE, "CryptCATOpen succeeded\n");
414 "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
415
416 if (!GetTempFileNameA(CURR_DIR, "cat", 0, empty)) return;
417
419 ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %u\n", GetLastError());
422
423 hcat = pCryptCATOpen(emptyW, 0, 0, 0, 0);
425 ok(hcat != INVALID_HANDLE_VALUE, "Expected a correct handle\n");
426
427 ret = pCryptCATClose(hcat);
429 ok(ret, "CryptCATClose failed\n");
431}
static const WCHAR empty[]
Definition: main.c:47
static const WCHAR emptyW[]
Definition: navigate.c:40

Referenced by START_TEST().

◆ test_sip()

static void test_sip ( void  )
static

Definition at line 1211 of file crypt.c.

1212{
1213 static const WCHAR nameW[] = {'t','e','s','t','.','e','x','e',0};
1216 HANDLE file;
1217 GUID guid;
1218 BOOL ret;
1219 char buf[1024];
1220
1222 ok(file != INVALID_HANDLE_VALUE, "can't create file\n");
1224 return;
1226 WriteFile(file, &nt_header, sizeof(nt_header), &size, NULL);
1227 memset(buf, 0, sizeof(buf));
1228 WriteFile(file, buf, 0x200 - sizeof(dos_header) - sizeof(nt_header), &size, NULL);
1230
1232 ok(file != INVALID_HANDLE_VALUE, "can't open file\n");
1233
1234 memset(&info, 0, sizeof(SIP_SUBJECTINFO));
1235 info.cbSize = sizeof(SIP_SUBJECTINFO);
1236 info.pgSubjectType = &guid;
1237 ret = CryptSIPRetrieveSubjectGuid(NULL, file, info.pgSubjectType);
1238 ok(ret, "CryptSIPRetrieveSubjectGuid failed (%x)\n", GetLastError());
1239
1241 ok(!ret, "CryptSIPPutSignedDataMsg succeeded\n");
1242 index = GetLastError();
1243 ok(index == ERROR_PATH_NOT_FOUND, "GetLastError returned %x\n", index);
1244
1245 info.hFile = file;
1246 info.pwsFileName = nameW;
1248 ok(!ret, "CryptSIPPutSignedDataMsg succeeded\n");
1249 index = GetLastError();
1250 todo_wine ok(index == ERROR_INVALID_PARAMETER, "GetLastError returned %x\n", index);
1251
1252 info.hFile = INVALID_HANDLE_VALUE;
1253 info.pwsFileName = nameW;
1255 ok(!ret, "CryptSIPPutSignedDataMsg succeeded\n");
1256 index = GetLastError();
1257 ok(index == ERROR_SHARING_VIOLATION, "GetLastError returned %x\n", index);
1258
1261
1262 info.hFile = file;
1263 info.pwsFileName = (void*)0xdeadbeef;
1265 ok(ret, "CryptSIPPutSignedDataMsg failed (%x)\n", GetLastError());
1266 ok(index == 0, "index = %x\n", index);
1267
1270
1271 info.hFile = INVALID_HANDLE_VALUE;
1272 info.pwsFileName = nameW;
1273 ret = pPutSignedDataMsg(&info, X509_ASN_ENCODING, &index, 14, (BYTE*)"longer message");
1274 ok(ret, "CryptSIPPutSignedDataMsg failed (%x)\n", GetLastError());
1275 ok(index == 1, "index = %x\n", index);
1276
1277 size = 0;
1278 encoding = 0xdeadbeef;
1280 ok(ret, "CryptSIPGetSignedDataMsg failed (%x)\n", GetLastError());
1281 ok(encoding == 0xdeadbeef, "encoding = %x\n", encoding);
1282 ok(size == 16, "size = %d\n", size);
1283
1285 ok(ret, "CryptSIPGetSignedDataMsg failed (%x)\n", GetLastError());
1286 ok(encoding == (X509_ASN_ENCODING|PKCS_7_ASN_ENCODING), "encoding = %x\n", encoding);
1287 ok(size == 8, "size = %d\n", size);
1288 ok(!memcmp(buf, "test\0\0\0\0", 8), "buf = %s\n", buf);
1289
1290 size = 0;
1291 encoding = 0xdeadbeef;
1293 ok(ret, "CryptSIPGetSignedDataMsg failed (%x)\n", GetLastError());
1294 ok(encoding == 0xdeadbeef, "encoding = %x\n", encoding);
1295 ok(size == 24, "size = %d\n", size);
1296
1298 ok(ret, "CryptSIPGetSignedDataMsg failed (%x)\n", GetLastError());
1299 ok(encoding == (X509_ASN_ENCODING|PKCS_7_ASN_ENCODING), "encoding = %x\n", encoding);
1300 ok(size == 16, "size = %d\n", size);
1301 ok(!strcmp(buf, "longer message"), "buf = %s\n", buf);
1302
1303 CryptReleaseContext(info.hProv, 0);
1306}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static const WCHAR nameW[]
Definition: main.c:49
#define index(s, c)
Definition: various.h:29
BOOL WINAPI CryptReleaseContext(HCRYPTPROV hProv, DWORD dwFlags)
Definition: crypt.c:648
BOOL WINAPI CryptSIPRetrieveSubjectGuid(LPCWSTR FileName, HANDLE hFileIn, GUID *pgSubject)
Definition: sip.c:310
#define CreateFileW
Definition: compat.h:741
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
const GUID * guid
#define OPEN_ALWAYS
Definition: disk.h:70
static const struct @1746 dos_header
static IMAGE_NT_HEADERS nt_header
Definition: crypt.c:1162
struct SIP_SUBJECTINFO_ SIP_SUBJECTINFO
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
#define PKCS_7_ASN_ENCODING
Definition: wincrypt.h:2299
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
static char * encoding
Definition: xmllint.c:155

Referenced by START_TEST().

Variable Documentation

◆ attr1W

const WCHAR attr1W[] = {'a','t','t','r','1',0}
static

◆ attr2W

const WCHAR attr2W[] = {'a','t','t','r','2',0}
static

Definition at line 38 of file crypt.c.

Referenced by test_catalog_properties(), and test_create_catalog_file().

◆ BOOL

Definition at line 113 of file crypt.c.

◆ catroot

CHAR catroot[MAX_PATH]
static

◆ catroot2

CHAR catroot2[MAX_PATH]
static

Definition at line 34 of file crypt.c.

Referenced by START_TEST(), and test_context().

◆ CURR_DIR

◆ 

const struct { ... } dos_header
Initial value:
=
{
}
#define IMAGE_DOS_SIGNATURE
Definition: pedump.c:89

Referenced by test_sip().

◆ dummy

GUID dummy = {0xdeadbeef,0xdead,0xbeef,{0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}}
static

Definition at line 160 of file crypt.c.

◆ DWORD

Definition at line 101 of file crypt.c.

◆ e_lfanew

◆ e_magic

WORD e_magic

Definition at line 1154 of file crypt.c.

Referenced by test_pack_IMAGE_DOS_HEADER().

◆ error_area

DWORD error_area
static

Definition at line 433 of file crypt.c.

Referenced by cdf_callback(), and test_cdf_parsing().

◆ hashmeW

const WCHAR hashmeW[] = {'h','a','s','h','m','e',0}
static

Definition at line 36 of file crypt.c.

Referenced by test_catalog_properties(), and test_create_catalog_file().

◆ HCATINFO

Definition at line 106 of file crypt.c.

◆ HCRYPTPROV

Definition at line 107 of file crypt.c.

◆ local_error

DWORD local_error
static

Definition at line 434 of file crypt.c.

Referenced by cdf_callback(), and test_cdf_parsing().

◆ LPCWSTR

Definition at line 105 of file crypt.c.

◆ LPVOID

Definition at line 113 of file crypt.c.

◆ LPWSTR

Definition at line 112 of file crypt.c.

◆ nt_header

IMAGE_NT_HEADERS nt_header
static

Definition at line 1162 of file crypt.c.

Referenced by test_sip().

◆ PFN_CDF_PARSE_ERROR_CALLBACK

PFN_CDF_PARSE_ERROR_CALLBACK

Definition at line 112 of file crypt.c.

◆ pGetSignedDataMsg

pCryptSIPGetSignedDataMsg pGetSignedDataMsg
static

Definition at line 119 of file crypt.c.

Referenced by InitFunctionPtrs(), and test_sip().

◆ pPutSignedDataMsg

pCryptSIPPutSignedDataMsg pPutSignedDataMsg
static

Definition at line 120 of file crypt.c.

Referenced by InitFunctionPtrs(), and test_sip().

◆ PWSTR

Definition at line 104 of file crypt.c.

◆ selfname

char selfname[MAX_PATH]
static

Definition at line 31 of file crypt.c.

Referenced by START_TEST(), and test_calchash().

◆ test_catalog

const BYTE test_catalog[]
static
Initial value:
= {
0x30, 0x82, 0x01, 0xbc, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0,
0x82, 0x01, 0xad, 0x30, 0x82, 0x01, 0xa9, 0x02, 0x01, 0x01, 0x31, 0x00, 0x30, 0x82, 0x01, 0x9e,
0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x0a, 0x01, 0xa0, 0x82, 0x01, 0x8f, 0x30,
0x82, 0x01, 0x8b, 0x30, 0x0c, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x0c, 0x01,
0x01, 0x04, 0x10, 0xfa, 0x55, 0x2c, 0xc2, 0xf6, 0xcc, 0xdd, 0x11, 0x2a, 0x9c, 0x00, 0x14, 0x22,
0xec, 0x8f, 0x3b, 0x17, 0x0d, 0x30, 0x38, 0x31, 0x32, 0x31, 0x38, 0x31, 0x31, 0x32, 0x36, 0x34,
0x38, 0x5a, 0x30, 0x0e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x0c, 0x01, 0x02,
0x05, 0x00, 0x30, 0x81, 0xdd, 0x30, 0x81, 0xda, 0x04, 0x0e, 0x68, 0x00, 0x61, 0x00, 0x73, 0x00,
0x68, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00, 0x31, 0x81, 0xc7, 0x30, 0x61, 0x06, 0x0a, 0x2b,
0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x04, 0x31, 0x53, 0x30, 0x51, 0x30, 0x2c, 0x06,
0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x19, 0xa2, 0x1e, 0x80, 0x1c, 0x00,
0x3c, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x4f, 0x00, 0x62, 0x00, 0x73, 0x00, 0x6f, 0x00, 0x6c, 0x00,
0x65, 0x00, 0x74, 0x00, 0x65, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x30, 0x21, 0x30, 0x09, 0x06,
0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14, 0xed, 0xd6, 0x9c, 0x9c, 0xb2, 0xfc,
0xaa, 0x03, 0xe8, 0xd3, 0x20, 0xf6, 0xab, 0x28, 0xc3, 0xff, 0xbd, 0x07, 0x36, 0xf5, 0x30, 0x62,
0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x0c, 0x02, 0x02, 0x31, 0x54, 0x30, 0x52,
0x1e, 0x4c, 0x00, 0x7b, 0x00, 0x44, 0x00, 0x45, 0x00, 0x33, 0x00, 0x35, 0x00, 0x31, 0x00, 0x41,
0x00, 0x34, 0x00, 0x32, 0x00, 0x2d, 0x00, 0x38, 0x00, 0x45, 0x00, 0x35, 0x00, 0x39, 0x00, 0x2d,
0x00, 0x31, 0x00, 0x31, 0x00, 0x44, 0x00, 0x30, 0x00, 0x2d, 0x00, 0x38, 0x00, 0x43, 0x00, 0x34,
0x00, 0x37, 0x00, 0x2d, 0x00, 0x30, 0x00, 0x30, 0x00, 0x43, 0x00, 0x30, 0x00, 0x34, 0x00, 0x46,
0x00, 0x43, 0x00, 0x32, 0x00, 0x39, 0x00, 0x35, 0x00, 0x45, 0x00, 0x45, 0x00, 0x7d, 0x02, 0x02,
0x02, 0x00, 0xa0, 0x6a, 0x30, 0x68, 0x30, 0x32, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82,
0x37, 0x0c, 0x02, 0x01, 0x04, 0x24, 0x30, 0x22, 0x1e, 0x0a, 0x00, 0x61, 0x00, 0x74, 0x00, 0x74,
0x00, 0x72, 0x00, 0x32, 0x02, 0x04, 0x10, 0x01, 0x00, 0x01, 0x04, 0x0e, 0x76, 0x00, 0x61, 0x00,
0x6c, 0x00, 0x75, 0x00, 0x65, 0x00, 0x32, 0x00, 0x00, 0x00, 0x30, 0x32, 0x06, 0x0a, 0x2b, 0x06,
0x01, 0x04, 0x01, 0x82, 0x37, 0x0c, 0x02, 0x01, 0x04, 0x24, 0x30, 0x22, 0x1e, 0x0a, 0x00, 0x61,
0x00, 0x74, 0x00, 0x74, 0x00, 0x72, 0x00, 0x31, 0x02, 0x04, 0x10, 0x01, 0x00, 0x01, 0x04, 0x0e,
0x76, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x75, 0x00, 0x65, 0x00, 0x31, 0x00, 0x00, 0x00, 0x31, 0x00,
}

Definition at line 70 of file crypt.c.

Referenced by test_catalog_properties(), and test_CryptCATAdminAddRemoveCatalog().

◆ test_cdf

const CHAR test_cdf[]
static
Initial value:
=
"[CatalogHeader]\r\n"
"Name=winetest.cat\r\n"
"ResultDir=.\\\r\n"
"PublicVersion=0x00000001\r\n"
"EncodingType=\r\n"
"CATATTR1=0x10010001:attr1:value1\r\n"
"CATATTR2=0x10010001:attr2:value2\r\n"
"\r\n"
"[CatalogFiles]\r\n"
"hashme=.\\winetest.cdf\r\n"

Definition at line 58 of file crypt.c.

Referenced by test_create_catalog_file().

◆ unused