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

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Aug 16 05:38:42 CDT 2015


https://bugs.winehq.org/show_bug.cgi?id=37915

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|-unknown                    |wineserver
            Summary|32-bit UPlay games fail in  |Multiple games and
                   |64-bit WINEPREFIX with      |applications need proper
                   |WinVer set to 'Windows      |handling of Vista+
                   |Vista/7' ('IsWow64Process'  |'PROCESS_QUERY_LIMITED_INFO
                   |fails if process was opened |RMATION' right (UPlay
                   |with                        |games, MS Visual Studio
                   |'PROCESS_QUERY_LIMITED_INFO |2015 installer)
                   |RMATION' rights)            |
           Severity|minor                       |normal

--- Comment #4 from Anastasius Focht <focht at gmx.net> ---
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

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list