Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.94 KB | None | 0 0
  1. Public Function IsAppLicensed(ByVal appName As String) As <MarshalAs(UnmanagedType.U1)> Boolean
  2.     Dim num2 As Integer = CInt(stackalloc Byte[<Module>.__CxxQueryExceptionSize])
  3.     Monitor.Enter(Me.dotNetSession_)
  4.     Dim numPtr As SByte ModOpt(IsSignUnspecifiedByte)* = Nothing
  5.     Try
  6.         If (appName = Nothing) Then
  7.             Throw New FMEOException(0, "IsAppLicensed")
  8.         End If
  9.         numPtr = Me.dotNetSession_.CreateCharPtrFromString(appName)
  10.         Dim managerPtr As IFMELicenseManager* = Me.fmeLicenseManager_
  11.         Dim flag As Boolean = (*DirectCast(managerPtr, Integer*)(60)(managerPtr, numPtr) = 1)
  12.         Dim flag2 As Boolean = flag
  13.         If (Not numPtr Is Nothing) Then
  14.             Dim hglobal As New IntPtr(numPtr)
  15.             Marshal.FreeHGlobal(hglobal)
  16.         End If
  17.         Monitor.Exit(Me.dotNetSession_)
  18.         Dim num3 As Byte = CByte(flag)
  19.         Return CBool(num3)
  20.     Catch exception1 As FMEOException
  21.         If (Not numPtr Is Nothing) Then
  22.             Dim ptr2 As New IntPtr(numPtr)
  23.             Marshal.FreeHGlobal(ptr2)
  24.         End If
  25.         Monitor.Exit(Me.dotNetSession_)
  26.         Throw exception1
  27.     Catch obj1 As Object When (?)
  28.         Dim num As UInt32 = 0
  29.         <Module>.__CxxRegisterExceptionObject(DirectCast(Marshal.GetExceptionPointers, Void*), DirectCast(num2, Void*))
  30.         Try
  31.             Try
  32.                 If (Not numPtr Is Nothing) Then
  33.                     Dim ptr As New IntPtr(numPtr)
  34.                     Marshal.FreeHGlobal(ptr)
  35.                 End If
  36.                 Monitor.Exit(Me.dotNetSession_)
  37.                 Throw New FMEOException(0, "Unhandled exception")
  38.             Catch obj2 As Object When (?)
  39.             End Try
  40.             If (num <> 0) Then
  41.                 Throw
  42.             End If
  43.         Finally
  44.             <Module>.__CxxUnregisterExceptionObject(DirectCast(num2, Void*), CInt(num))
  45.         End Try
  46.     End Try
  47.     Return False
  48. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement