Hallo,
vielen Dank für deine Anregungen Mittlerweile habe ich eine Lösung für Managed Code erarbeitet. Für alle, die das selbe Problem haben, hier ein kleiner Beispielcode:
Code:
Public Sub QuerySessionStatus()
    Dim data As HLDQuerySessionStatus
    Dim p As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(data))

    Try
        Dim ret As UInteger = 0
        Dim l As UInt32 = 20
        Dim rc As UInt32 = 0
               
        data.qsst_shortname = Me.sessionId

        Marshal.StructureToPtr(data, p, False)

        Dim f As UInt32 = HA_QUERY_SESSION_STATUS
        ret = hllapi2(f, p, l, rc)

        data = Marshal.PtrToStructure(p, data.GetType)

        Me.ScreenHeight = data.qsst_ps_rows
        Me.ScreenWidth = data.qsst_ps_cols

    Catch ex As Exception
        'pass the error to the caller
        Throw ex
    Finally
        Marshal.FreeHGlobal(p)
    End Try
End Sub
Danke!