Beispiel #1
0
 protected Native.Core.Field getField(int size, LpProcName lpProcName)
 {
     return(provider
            .Svc
            .native(lpProcName)
            .t(size)
            .Raw.Type.FirstField);
 }
Beispiel #2
0
        /// <typeparam name="T">The return type for new Delegate should be as T type.</typeparam>
        /// <param name="lpProcName"></param>
        /// <param name="ret">The type of return value.</param>
        /// <param name="args">The type of arguments.</param>
        /// <returns>Delegate of exported function.</returns>
        protected Method <T, object> bind <T>(LpProcName lpProcName, Type ret, params Type[] args)
        {
            MethodInfo mi  = Dynamic.GetMethodInfo((string)lpProcName, ret, args);
            TDyn       dyn = wire(mi, lpProcName, Convention);

            return(delegate(object[] _args) {
                return (T)dyn.dynamic.Invoke(null, _args);
            });
        }
Beispiel #3
0
        /// <param name="lpProcName">The name of exported function.</param>
        /// <returns>The address of the exported function.</returns>
        protected IntPtr getProcAddress(LpProcName lpProcName)
        {
            if (!Library.IsActive && !load())
            {
                throw new LoaderException($"The handle of library is zero. Last loaded library: '{Library.LibName}'");
            }

            return(getProcAddress(
                       Library.Handle,
                       tryAlias(lpProcName),
                       Mangling
                       ));
        }
Beispiel #4
0
 private string tryAlias(LpProcName lpProcName)
 {
     return((aliasDict == null) ? (string)lpProcName : aliasDict.use(lpProcName));
 }
Beispiel #5
0
 protected TDyn wire(MethodInfo mi, LpProcName lpProcName, CallingConvention conv)
 {
     return(wire(mi, getProcAddress(lpProcName), conv));
 }
Beispiel #6
0
 protected TDyn wire(MethodInfo mi, LpProcName lpProcName)
 {
     return(wire(mi, lpProcName, Convention));
 }
Beispiel #7
0
 protected T getDelegate <T>(LpProcName lpProcName) where T : class
 {
     return(getDelegate <T>(getProcAddress(lpProcName)));
 }
Beispiel #8
0
 public NativeData native(LpProcName lpProcName)
 {
     return(getProcAddr(lpProcName).Native());
 }
Beispiel #9
0
 public IntPtr getProcAddr(LpProcName lpProcName)
 {
     return(provider.getProcAddress(lpProcName));
 }