[PATCH] crypt32/tests: Fix a registerOIDInfo() failure when missing elevated privileges.
Dmitry Timoshkov
dmitry at baikal.ru
Mon Dec 14 09:31:14 CST 2020
Francois Gouget <fgouget at codeweavers.com> wrote:
> > > @@ -499,7 +515,7 @@ static void test_getDefaultOIDFunctionAddress(void)
> > > SetLastError(0xdeadbeef);
> > > ret = CryptRegisterDefaultOIDFunction(0, "CertDllOpenStoreProv", 0,
> > > bogusDll);
> > > - if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
> > > + if (!ret && GetLastError() == ERROR_ACCESS_DENIED && !is_process_elevated())
> > > skip("Need admin rights\n");
> > > else
> > > ok(ret, "CryptRegisterDefaultOIDFunction failed: %08x\n", GetLastError());
> >
> > In which cases the changes above are needed? It seems that this only
> > complicates things without a reason and could potentially slow down
> > the tests execution.
>
> These are not strictly needed. Rather the goal is to verify that we only
> get ERROR_ACCESS_DENIED when missing elevated privileges rather than
> blindly assuming the access denied error is justified.
If the intent to add is_process_elevated() checks to every place where
ERROR_ACCESS_DENIED error returned then it's not justified.
> > > @@ -645,7 +661,11 @@ static void test_registerOIDInfo(void)
> > > info1.pszOID = test_oid;
> > > SetLastError(0xdeadbeef);
> > > ret = CryptUnregisterOIDInfo(&info1);
> > > - ok(!ret, "should fail\n");
> > > + if (!ret && GetLastError() == ERROR_ACCESS_DENIED && !is_process_elevated())
> > > + {
> > > + skip("Need admin rights FIXME\n");
> > > + return;
> > > + } ok(!ret, "should fail\n");
> >
> > This change doesn't look right. Most likely it's not needed here.
>
> It is needed:
> https://test.winehq.org/data/3acb0b3326c4120ea0c4c6076bd03c9cfe82c744/win10_newtb-w1064-adm-64/crypt32:oid.html
In addition to broken indentation and strange skip message the test bot
results seem not related, in both cases !ret is the only accepted value.
--
Dmitry.
More information about the wine-devel
mailing list