[Bug 48521] New: StaxRip throes errors: Win32Exception (2.0.6.0) Invalid function System.ComponentModel.Win32Exception (0x80004005): Invalid function

WineHQ Bugzilla wine-bugs at winehq.org
Sun Jan 26 04:02:04 CST 2020


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

            Bug ID: 48521
           Summary: StaxRip throes errors: Win32Exception (2.0.6.0)
                    Invalid function  System.ComponentModel.Win32Exception
                    (0x80004005): Invalid function
           Product: Wine
           Version: 5.0
          Hardware: x86
               URL: https://github.com/staxrip/staxrip/releases
                OS: Linux
            Status: NEW
          Keywords: dotnet, download, source
          Severity: normal
          Priority: P2
         Component: ntdll
          Assignee: wine-bugs at winehq.org
          Reporter: xerox.xerox2000x at gmail.com
      Distribution: Debian

Steps to reproduce:

Use Staging (workaround https://bugs.winehq.org/show_bug.cgi?id=45868) and do 

- winetricks -q dotnet40 dotnet48
- Invoke like ''wine start /unix /home/louis/StaxRip.exe'' otherwise you run
into 
https://bugs.winehq.org/show_bug.cgi?id=48503

Try open an avi, it`ll tell you to install AviSynth, let it complete, then try
convert it; In the end an errormessage pops up:


Win32Exception (2.0.6.0)

Invalid function

System.ComponentModel.Win32Exception (0x80004005): Invalid function
   at StaxRip.PowerRequest.SuppressStandby() in
D:\Projekte\VB\staxrip\General\General.vb:line 1532
   at StaxRip.GlobalClass.ProcessJobs() in
D:\Projekte\VB\staxrip\General\GlobalClass.vb:line 36


The source is available from github:

Public Class PowerRequest
    Private Shared CurrentPowerRequest As IntPtr

    Shared Sub SuppressStandby()
        If CurrentPowerRequest <> IntPtr.Zero Then
            PowerClearRequest(CurrentPowerRequest,
PowerRequestType.PowerRequestSystemRequired)
            CurrentPowerRequest = IntPtr.Zero
        End If

        Dim pContext As POWER_REQUEST_CONTEXT
        pContext.Flags = &H1 'POWER_REQUEST_CONTEXT_SIMPLE_STRING
        pContext.Version = 0 'POWER_REQUEST_CONTEXT_VERSION
        pContext.SimpleReasonString = "Standby suppressed by StaxRip"  'shown
when the command "powercfg -requests" is executed

        CurrentPowerRequest = PowerCreateRequest(pContext)

        If CurrentPowerRequest = IntPtr.Zero Then
            Dim err = Marshal.GetLastWin32Error()
            If err <> 0 Then Throw New Win32Exception(err)
        End If

        Dim success = PowerSetRequest(CurrentPowerRequest,
PowerRequestType.PowerRequestSystemRequired)

        If Not success Then
            CurrentPowerRequest = IntPtr.Zero
            Dim err = Marshal.GetLastWin32Error()
            If err <> 0 Then Throw New Win32Exception(err)
        End If
    End Sub

    Shared Sub EnableStandby()
        If CurrentPowerRequest <> IntPtr.Zero Then
            Dim success = PowerClearRequest(CurrentPowerRequest,
PowerRequestType.PowerRequestSystemRequired)

            If Not success Then
                CurrentPowerRequest = IntPtr.Zero
                Dim err = Marshal.GetLastWin32Error()
                If err <> 0 Then Throw New Win32Exception(err)
            Else
                CurrentPowerRequest = IntPtr.Zero
            End If
        End If
    End Sub

    Enum PowerRequestType
        PowerRequestDisplayRequired
        PowerRequestSystemRequired
        PowerRequestAwayModeRequired
        PowerRequestExecutionRequired
    End Enum

    <DllImport("kernel32.dll", SetLastError:=True)>
    Shared Function PowerCreateRequest(ByRef Context As POWER_REQUEST_CONTEXT)
As IntPtr
    End Function

    <DllImport("kernel32.dll", SetLastError:=True)>
    Shared Function PowerSetRequest(PowerRequestHandle As IntPtr, RequestType
As PowerRequestType) As Boolean
    End Function

    <DllImport("kernel32.dll", SetLastError:=True)>
    Shared Function PowerClearRequest(PowerRequestHandle As IntPtr, RequestType
As PowerRequestType) As Boolean
    End Function

    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
    Structure POWER_REQUEST_CONTEXT
        Public Version As UInt32
        Public Flags As UInt32
        <MarshalAs(UnmanagedType.LPWStr)>
        Public SimpleReasonString As String
    End Structure
End Class


Returning STATUS_SUCCESS for Nt{Create,Set,Clear}PowerRequest gets rid of the
errors. AFAICT it should be pretty safe to just return success from these three
functions, right?

Relevant console-output:
009c:fixme:ntdll:NtCreatePowerRequest (0x22d5e8, 0x22d5f0): stub
009c:fixme:ntdll:NtSetPowerRequest (0x110ea80, 1): stub
.
.
009c:fixme:ntdll:NtClearPowerRequest (0x110ea80, 1): stub

-- 
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