public static CK_FUNCTION_LIST GeFunctionList(IntPtr hLib) { IntPtr flpp; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { flpp = new KernelUtilWindows().GetProcAddress(hLib, "C_GetFunctionList"); } else { flpp = new KernelUtilUNIX().GetProcAddress(hLib, "C_GetFunctionList"); } if (flpp == IntPtr.Zero) { throw new Exception("C_GetFunctionList could not be found"); } C_GetFunctionList GetFunctionList = (C_GetFunctionList)Marshal.GetDelegateForFunctionPointer(flpp, typeof(C_GetFunctionList)); IntPtr flp; GetFunctionList(out flp); if (flp == IntPtr.Zero) { throw new Exception("C_GetFunctionList return invalid pointer."); } CK_FUNCTION_LIST flist; flist = (CK_FUNCTION_LIST)Marshal.PtrToStructure(flp, typeof(CK_FUNCTION_LIST)); return(flist); }
public static CK_FUNCTION_LIST GeFunctionList(IntPtr hLib) { IntPtr flpp = KernelUtil.GetProcAddress(hLib, "C_GetFunctionList"); if (flpp == IntPtr.Zero) { throw new Exception("C_GetFunctionList could not be found"); } C_GetFunctionList GetFunctionList = (C_GetFunctionList)Marshal.GetDelegateForFunctionPointer(flpp, typeof(C_GetFunctionList)); IntPtr flp; GetFunctionList(out flp); if (flp == IntPtr.Zero) { throw new Exception("C_GetFunctionList return invalid pointer."); } CK_FUNCTION_LIST flist; flist = (CK_FUNCTION_LIST)Marshal.PtrToStructure(flp, typeof(CK_FUNCTION_LIST)); return(flist); }