Problem using WinVerifyTrust Function

VB_al 91 Reputation points

Visual Basic .NET Framework

Hello, as @Drake Wu - MSFT said, I used WinVerifyTrust but
when I code
dim Result as long = WinVerifyTrust(........)
if result = 0 then
'verified successfully
'not verified
end if

it throws an exception: MarshalDirectiveException

I don't know ho to solve and i think i code GUID , pointer. . . . correctly..


Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,452 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Drake Wu - MSFT 991 Reputation points

    Hi, @VB_al MarshalDirectiveException seems to be caused by the calling convention of the function. The calling convention of WinVerifyTrust is the __stdcall:
    You can try to explicitly declare as CallingConvention = CallingConvention.StdCall. If this still does not solve the problem, please provide your sample which shows how you declare all the types and functions.

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments