Administrative privileges and running tests under Windows

Reece Dunn msclrhd at googlemail.com
Fri Jul 16 12:59:47 CDT 2010


2010/7/16 Mariusz Pluciński <vshader at gmail.com>:
> Hi wine-devel
> I have problems with tests I written last time.
> The problem is connected with privileges levels under Windows.
>
> The method I'm testing is IGameExplorer::AddGame,
> which registers given game in Windows Game Explorer.
> One of it's parameters (installScope) defines if game should
> be registered for all users or only currently logged one. The
> problem is that routine's behaviour depends on if application
> was started with administrative privileges or not.
>
> If I call method with GIS_ALL_USERS parameter, it succeeds
> only with administrative privileges (fails if I run it as normal
> user). If I call it with GIS_CURRENT_USER parameter, it succeeds
> under normal user level, and fails (sic!) under administrative.
>
> My question is, how I should write tests to support both
> of these cases. Both seems to be exclusive, and I prefer first
> to ask, rather than trying implement it in some odd
> (and probably wrong) way. I also want to make it available
> to run under Wine project's test machines, but I don't know
> how they're configured and will them allow me to test
> administrative case.

Use broken() to denote the administrator case --

    ok(hr == S_OK || broken(hr == E_ACCESSDENIED) /* non-Admin user
*/, IGameExplorer_AddGame(...));

This means that E_ACCESSDENIED is a valid case on Windows, but not on Wine.

- Reece



More information about the wine-devel mailing list