WineHQ
Bug Tracking Database – Bug 37915

 Bugzilla

 

Last modified: 2015-09-04 07:05:02 CDT  

Multiple games and applications need proper handling of Vista+ 'PROCESS_QUERY_LIMITED_INFORMATION' right (UPlay games, MS Visual Studio 2015 installer)

Bug 37915 - Multiple games and applications need proper handling of Vista+ 'PROCESS_QUERY_LIMITED_INFORMATION' right (UPlay games, MS Visual Studio 2015 installer)
Multiple games and applications need proper handling of Vista+ 'PROCESS_QUERY...
Status: CLOSED FIXED
AppDB: Show Apps affected by this bug
Product: Wine
Classification: Unclassified
Component: wineserver
1.7.34
x86-64 Linux
: P2 normal
: ---
Assigned To: Mr. Bugs
http://uplay.ubi.com/
: download, win64
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2015-01-17 01:58 CST by Adam Bolte
Modified: 2015-09-04 07:05 CDT (History)
5 users (show)

See Also:
Regression SHA1:
Fixed by SHA1: 1d2241eca3b3c19855dea1db017305b1e6113c0e
Distribution: Debian
Staged patchset:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Bolte 2015-01-17 01:58:38 CST
While the recent commit http://source.winehq.org/git/wine.git/commitdiff/bfd088dbc6b4f397d9adfbc11a6f878ac0e8fd7c now allows Uplay to launch 64-bit games in a 64-bit prefix when Windows 7 is selected (and probably Vista and 8), it doesn't help with launching 32-bit games.

Since #33776 was closed without covering this situation, I'm opening this bug to cover that use-case here.

Attachment 50492 [details] from #33776 (https://bugs.winehq.org/attachment.cgi?id=50492&action=diff) solves this for me, but seems to be a work in progress based on what the author has said there.

This issue is also perhaps not specific to Uplay, although I don't know of any other application affected by the bugs in the existing implementation at this time (hence the title).
Comment 1 Anastasius Focht 2015-01-17 05:40:23 CST
Hello folks,

refining the summary a bit to define the scope.

PROCESS_QUERY_INFORMATION can be denied on many processes in Vista+ (processes with different ownerships, elevated, etc). In order to still be able to retrieve basic info, PROCESS_QUERY_LIMITED_INFORMATION = cut-down information level was introduced. It available by default in Windows Vista+ and should work on any given process - even on processes don't belong to logged on user (and without elevated rights).

Regards
Comment 2 Adam Bolte 2015-01-18 07:21:49 CST
Thanks for the clarification Anastasius.
Comment 3 Berillions 2015-04-04 13:01:06 CDT
No evolution about this issue ?

Thanks,
Comment 4 Anastasius Focht 2015-08-16 05:38:42 CDT
Hello folks,

it seems the MS Visual Studio 2015 Community Edition installer is also suffering from this.
Refining the summary and raising priority.

Download: https://go.microsoft.com/fwlink/?LinkId=532606

Prerequisite: 

* .NET Framework 4.0, 4.5 -> 'winetricks -q dotnet40' and run the .NET Framework 4.5 installer manually (to avoid having all previous .NET Frameworks installed, not needed here)
* Windows version set to 'Windows 7'

Terminal output, includes managed backtrace:

--- snip ---
$ wine ./vs_community.exe
...
fixme:advapi:RegisterEventSourceW ((null),L".NET Runtime"): stub
fixme:advapi:ReportEventW (0xcafe4242,0x0001,0x0000,0x00000402,(nil),0x0001,0x00000000,0x50ccd84,(nil)): stub
err:eventlog:ReportEventW L"Application: vs_community.exe\nFramework Version: v4.0.30319\nDescription: The process was terminated due to an unhandled exception.\nException Info: System.ComponentModel.Win32Exception\nStack:\n   at System.Diagnostics.Process.GetProcessTimes()\n   at System.Diagnostics.Process.get_StartTime()\n   "...
fixme:advapi:DeregisterEventSource (0xcafe4242) stub

Unhandled Exception: fixme:nls:LocaleNameToLCID unsupported flags 8000000
fixme:nls:LocaleNameToLCID unsupported flags 8000000
fixme:nls:LocaleNameToLCID unsupported flags 8000000
fixme:advapi:EventRegister {8e9f5090-2d75-4d03-8a81-e5afbf85daf1}, 0xdc3902, (nil), 0x192e9b8
System.ComponentModel.Win32Exception: Success
   at System.Diagnostics.Process.GetProcessTimes()
   at System.Diagnostics.Process.get_StartTime()
   at Microsoft.Devdiv.Bootstrapper.ManagedUx.Run()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
wine: Unhandled exception 0xe0434352 in thread 38 at address 0x7b845d3d (thread 0038), starting debugger...
--- snip ---

Relevant part of trace log:

--- snip ---
...
003a:Call KERNEL32.OpenProcess(00001000,00000000,00000030) ret=04c9f874
003a: open_process( pid=0030, access=00001000, attributes=00000000 )
003a: open_process() = 0 { handle=023c }
003a:Ret  KERNEL32.OpenProcess() retval=0000023c ret=04c9f874
003a:Call KERNEL32.GetLastError() ret=00ee19c8
003a:Ret  KERNEL32.GetLastError() retval=00000000 ret=00ee19c8
...
003a:Call KERNEL32.GetProcessTimes(0000023c,0192a178,0192a180,0192a188,0192a190) ret=04c9f970
003a:trace:ntdll:NtQueryInformationProcess (0x23c,0x00000004,0x50ce020,0x00000020,(nil))
003a: get_process_info( handle=023c )
003a: get_process_info() = ACCESS_DENIED { pid=0000, ppid=0000, affinity=00000000, peb=00000000, start_time=0, end_time=0, exit_code=0, priority=0, cpu=x86, debugger_present=0 }
003a:Ret  KERNEL32.GetProcessTimes() retval=00000000 ret=04c9f970
003a:Call KERNEL32.GetLastError() ret=00ee19c8
003a:Ret  KERNEL32.GetLastError() retval=00000000 ret=00ee19c8
...
--- snip ---

Managed code for reference:

--- snip ---
// Microsoft.Win32.NativeMethods
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool GetProcessTimes(SafeProcessHandle handle, out long creation, out long exit, out long kernel, out long user);

...

// System.Diagnostics.Process
private ProcessThreadTimes GetProcessTimes()
{
	ProcessThreadTimes processThreadTimes = new ProcessThreadTimes();
	SafeProcessHandle safeProcessHandle = null;
	try
	{
		safeProcessHandle = this.GetProcessHandle(1024, false);
		if (safeProcessHandle.IsInvalid)
		{
			throw new InvalidOperationException(SR.GetString("ProcessHasExited", new object[]
			{
				this.processId.ToString(CultureInfo.CurrentCulture)
			}));
		}
		if (!NativeMethods.GetProcessTimes(safeProcessHandle, out processThreadTimes.create, out processThreadTimes.exit, out processThreadTimes.kernel, out processThreadTimes.user))
		{
			throw new Win32Exception();
		}
	}
	finally
	{
		this.ReleaseProcessHandle(safeProcessHandle);
	}
	return processThreadTimes;
}
--- snip ---

The process is opened with 'PROCESS_QUERY_LIMITED_INFORMATION' (0x1000) access rights.
Wineserver has pre-Vista behaviour hard-coded in several places:

'PROCESS_QUERY_INFORMATION' (0x400) access rights

Source: https://source.winehq.org/git/wine.git/blob/905bf79337e04ed31d2823508e90169298049697:/server/process.c#l1337

--- snip ---
1337 /* fetch information about a process */
1338 DECL_HANDLER(get_process_info)
1339 {
1340     struct process *process;
1341 
1342     if ((process = get_process_from_handle( req->handle, PROCESS_QUERY_INFORMATION )))
1343     {
1344         reply->pid              = get_process_id( process );
1345         reply->ppid             = process->parent ? get_process_id( process->parent ) : 0;
1346         reply->exit_code        = process->exit_code;
1347         reply->priority         = process->priority;
1348         reply->affinity         = process->affinity;
1349         reply->peb              = process->peb;
1350         reply->start_time       = process->start_time;
1351         reply->end_time         = process->end_time;
1352         reply->cpu              = process->cpu;
1353         reply->debugger_present = !!process->debugger;
1354         release_object( process );
1355     }
1356 }
--- snip ---

https://source.winehq.org/git/wine.git/blob/5d85f57814f023c105948636094e5e07654605ec:/server/handle.c#l415

--- snip ---
 415 /* retrieve the object corresponding to a handle, incrementing its refcount */
 416 struct object *get_handle_obj( struct process *process, obj_handle_t handle,
 417                                unsigned int access, const struct object_ops *ops )
 418 {
 419     struct handle_entry *entry;
 420     struct object *obj;
 421 
 422     if (!(obj = get_magic_handle( handle )))
 423     {
 424         if (!(entry = get_handle( process, handle )))
 425         {
 426             set_error( STATUS_INVALID_HANDLE );
 427             return NULL;
 428         }
 429         obj = entry->ptr;
 430         if (ops && (obj->ops != ops))
 431         {
 432             set_error( STATUS_OBJECT_TYPE_MISMATCH );  /* not the right type */
 433             return NULL;
 434         }
 435         if ((entry->access & access) != access)
 436         {
 437             set_error( STATUS_ACCESS_DENIED );
 438             return NULL;
 439         }
 440     }
...
 447 }
--- snip ---

MSDN: https://msdn.microsoft.com/de-de/library/windows/desktop/ms684880%28v=vs.85%29.aspx

--- quote ---
...
A handle that has the PROCESS_QUERY_INFORMATION access right is automatically granted PROCESS_QUERY_LIMITED_INFORMATION.

Windows Server 2003 and Windows XP:  This access right is not supported.
...
--- quote ---

$ sha1sum vs_community.exe 
396d8565f81969783bb4eb57aeff995cdabb8077  vs_community.exe

$ du -sh vs_community.exe 
3.0M	vs_community.exe

$ wine --version
wine-1.7.49-41-g36a39ce

Regards
Comment 5 Anastasius Focht 2015-08-21 14:53:23 CDT
Hello folks,

this is fixed by commits:

https://source.winehq.org/git/wine.git/commitdiff/c19091272d98600de346c516301dd41c2e0a57d7 ("server: Add implicit PROCESS_[QUERY|SET]_LIMITED_INFORMATION access.")

https://source.winehq.org/git/wine.git/commitdiff/1d2241eca3b3c19855dea1db017305b1e6113c0e ("server: For querying process information demand PROCESS_QUERY_LIMITED_INFORMATION access.")

Thanks Dmitry

Regards
Comment 6 Adam Bolte 2015-08-21 21:39:56 CDT
Confirming this now works in 1.7.50. Thanks guys.
Comment 7 Alexandre Julliard 2015-09-04 07:05:02 CDT
Closing bugs fixed in 1.7.51.


Privacy Policy
If you have a privacy inquiry regarding this site, please write to privacy@winehq.org

Hosted By CodeWeavers