42#define WINTRUST_GET_PROC(func) \
43 p ## func = (void*)GetProcAddress(hWintrust, #func); \
45 trace("GetProcAddress(%s) failed\n", #func);
54#undef WINTRUST_GET_PROC
59 static WCHAR DummyDllW[] = {
'd',
'e',
'a',
'd',
'b',
'e',
'e',
'f',
'.',
'd',
'l',
'l',0 };
60 static WCHAR DummyFunctionW[] = {
'd',
'u',
'm',
'm',
'y',
'f',
'u',
'n',
'c',
't',
'i',
'o',
'n',0 };
61 GUID ActionID = { 0xdeadbeef, 0xdead, 0xbeef, { 0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef }};
67 if (!pWintrustAddActionID || !pWintrustRemoveActionID)
69 win_skip(
"WintrustAddActionID and/or WintrustRemoveActionID are not available\n");
76 ok (!
ret,
"Expected WintrustAddActionID to fail.\n");
79 "Expected ERROR_INVALID_PARAMETER(W2K3) or 0xdeadbeef(Win98/NT4/W2K), got %u.\n",
GetLastError());
83 ret = pWintrustAddActionID(&ActionID, 0,
NULL);
84 ok (!
ret,
"Expected WintrustAddActionID to fail.\n");
87 "Expected ERROR_INVALID_PARAMETER(W2K3) or 0xdeadbeef(Win98/NT4/W2K), got %u.\n",
GetLastError());
92 ret = pWintrustAddActionID(&ActionID, 0, &ActionIDFunctions);
93 ok (!
ret,
"Expected WintrustAddActionID to fail.\n");
96 "Expected ERROR_INVALID_PARAMETER(W2K3) or 0xdeadbeef(Win98/NT4/W2K), got %u.\n",
GetLastError());
102 ret = pWintrustAddActionID(&ActionID, 0, &ActionIDFunctions);
103 ok (
ret,
"Expected WintrustAddActionID to succeed.\n");
105 "Expected ERROR_INVALID_PARAMETER, got %u.\n",
GetLastError());
121 ret = pWintrustAddActionID(&ActionID, 0, &ActionIDFunctions);
122 ok (
ret,
"Expected WintrustAddActionID to succeed.\n");
125 "Expected ERROR_INVALID_PARAMETER or ERROR_ACCESS_DENIED, got %u.\n",
142 ret = pWintrustAddActionID(&ActionID, 0, &ActionIDFunctions);
143 ok (
ret,
"Expected WintrustAddActionID to succeed.\n");
145 "Expected 0xdeadbeef or ERROR_ACCESS_DENIED, got %u.\n",
149 ret = pWintrustRemoveActionID(&ActionID);
155 ret = pWintrustRemoveActionID(
NULL);
156 ok (
ret,
"Expected WintrustRemoveActionID to succeed.\n");
158 "Expected ERROR_INVALID_PARAMETER, got %u.\n",
GetLastError());
162 ret = pWintrustRemoveActionID(&ActionID);
163 ok (
ret,
"Expected WintrustRemoveActionID to succeed.\n");
171 static GUID ActionID = { 0xdeadbeef, 0xdead, 0xbeef, { 0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef }};
172 static WCHAR DummyDllW[] = {
'd',
'e',
'a',
'd',
'b',
'e',
'e',
'f',
'.',
'd',
'l',
'l',0 };
173 static CHAR DummyFunction[] =
"dummyfunction";
174 static const CHAR oid[] =
"1.2.3.4.5.6.7.8.9.10";
177 if (!pWintrustAddDefaultForUsage)
179 win_skip(
"WintrustAddDefaultForUsage is not available\n");
186 ok (!
ret,
"Expected WintrustAddDefaultForUsage to fail.\n");
188 "Expected ERROR_INVALID_PARAMETER, got %u.\n",
GetLastError());
192 ret = pWintrustAddDefaultForUsage(oid,
NULL);
193 ok (!
ret,
"Expected WintrustAddDefaultForUsage to fail.\n");
195 "Expected ERROR_INVALID_PARAMETER, got %u.\n",
GetLastError());
205 ret = pWintrustAddDefaultForUsage(
NULL, &DefUsage);
206 ok (!
ret,
"Expected WintrustAddDefaultForUsage to fail.\n");
208 "Expected ERROR_INVALID_PARAMETER, got %u.\n",
GetLastError());
218 ret = pWintrustAddDefaultForUsage(oid, &DefUsage);
219 ok (!
ret,
"Expected WintrustAddDefaultForUsage to fail.\n");
221 "Expected ERROR_INVALID_PARAMETER, got %u.\n",
GetLastError());
230 if (!pWintrustLoadFunctionPointers)
232 win_skip(
"WintrustLoadFunctionPointers is not available\n");
244 ok(!
ret,
"WintrustLoadFunctionPointers succeeded\n");
247 "Expected ERROR_INVALID_PARAMETER or 0xdeadbeef, got %d\n",
GetLastError());
257 ok(
funcs.pfnAlloc !=
NULL,
"Expected a pointer\n");
271 "Software\\Microsoft\\Windows\\CurrentVersion\\Wintrust\\"
272 "Trust Providers\\Software Publishing";
279 if (!pWintrustGetRegPolicyFlags || !pWintrustSetRegPolicyFlags)
281 win_skip(
"Policy flags functions not present\n");
285 pWintrustGetRegPolicyFlags(&flags2);
289 ok(!
r,
"RegOpenKeyEx failed: %d\n",
r);
291 size =
sizeof(flags1);
295 ok(flags1 == flags2,
"Got %08x flags instead of %08x\n", flags1, flags2);
298 ret = pWintrustSetRegPolicyFlags(flags3);
300 size =
sizeof(flags1);
302 ok(!
r,
"RegQueryValueEx failed: %d\n",
r);
303 ok(flags1 == flags3,
"Got %08x flags instead of %08x\n", flags1, flags3);
305 pWintrustSetRegPolicyFlags(flags2);
#define RegCloseKey(hKey)
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
#define ERROR_INVALID_PARAMETER
#define ERROR_ACCESS_DENIED
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
BOOL WINAPI WintrustLoadFunctionPointers(GUID *pgActionID, CRYPT_PROVIDER_FUNCTIONS *pPfns)
BOOL WINAPI WintrustAddActionID(GUID *pgActionID, DWORD fdwFlags, CRYPT_REGISTER_ACTIONID *psProvInfo)
BOOL WINAPI WintrustRemoveActionID(GUID *pgActionID)
BOOL WINAPI WintrustAddDefaultForUsage(const char *pszUsageOID, CRYPT_PROVIDER_REGDEFUSAGE *psDefUsage)
GLdouble GLdouble GLdouble r
#define ERROR_FILE_NOT_FOUND
static void test_RegPolicyFlags(void)
#define WINTRUST_GET_PROC(func)
static void InitFunctionPtrs(void)
static void test_AddRem_ActionID(void)
static void test_LoadFunctionPointers(void)
static void test_AddDefaultForUsage(void)
static struct __wine_debug_functions funcs
#define WINTRUST_ACTION_GENERIC_VERIFY_V2
char * pwszLoadCallbackDataFunctionName
char * pwszFreeCallbackDataFunctionName
CRYPT_TRUST_REG_ENTRY sCertificateProvider
CRYPT_TRUST_REG_ENTRY sInitProvider
CRYPT_TRUST_REG_ENTRY sTestPolicyProvider
CRYPT_TRUST_REG_ENTRY sCertificatePolicyProvider
CRYPT_TRUST_REG_ENTRY sFinalPolicyProvider
CRYPT_TRUST_REG_ENTRY sCleanupProvider
CRYPT_TRUST_REG_ENTRY sObjectProvider
CRYPT_TRUST_REG_ENTRY sSignatureProvider
DWORD WINAPI GetLastError(void)
#define HKEY_CURRENT_USER
struct _CRYPT_PROVIDER_REGDEFUSAGE CRYPT_PROVIDER_REGDEFUSAGE
struct _CRYPT_REGISTER_ACTIONID CRYPT_REGISTER_ACTIONID
struct _CRYPT_TRUST_REG_ENTRY CRYPT_TRUST_REG_ENTRY
static const WCHAR Software_Publishing[]
void WINAPI WintrustGetRegPolicyFlags(DWORD *pdwPolicyFlags)
BOOL WINAPI WintrustSetRegPolicyFlags(DWORD dwPolicyFlags)