Hi I am using COM Class and loading it in browser.

I am calling LoadLibrary of kernel32 but it returns me zero.

I have also tried using LoadLibraryEx which gives me pointer to DLL but when I call any function of that dll it gives me Attempt to read or write protected memory.

<DllImport("kernel32.dll", EntryPoint:="LoadLibraryEx")> _
    Public Shared Function LoadLibraryEx(ByVal lpLibFileName As String, ByVal hint As IntPtr, ByVal hparam As UInteger) As IntPtr
    End Function

<UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet:=CharSet.Unicode)> _
    Public Delegate Function LoadIdcardLibrary() As Integer

Dim lb As IntPtr = LoadLibraryEx("\idcarddll.dll", IntPtr.Zero, 8)
i = Marshal.GetDelegateForFunctionPointer(pb, GetType(LoadIdcardLibrary)).DynamicInvoke()

Thanks in advance

>I am calling LoadLibrary of kernel32 but it returns me zero.

Because it fails to load due to lack of privileges.

>I am calling LoadLibrary of kernel32 but it returns me zero.

Because it fails to load due to lack of privileges.

How to set privileges to load dll file.