Exemplo n.º 1
0
 protected Native.Core.Field getField(int size, LpProcName lpProcName)
 {
     return(provider
            .Svc
            .native(lpProcName)
            .t(size)
            .Raw.Type.FirstField);
 }
Exemplo n.º 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);
            });
        }
Exemplo n.º 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
                       ));
        }
Exemplo n.º 4
0
 private string tryAlias(LpProcName lpProcName)
 {
     return((aliasDict == null) ? (string)lpProcName : aliasDict.use(lpProcName));
 }
Exemplo n.º 5
0
 protected TDyn wire(MethodInfo mi, LpProcName lpProcName, CallingConvention conv)
 {
     return(wire(mi, getProcAddress(lpProcName), conv));
 }
Exemplo n.º 6
0
 protected TDyn wire(MethodInfo mi, LpProcName lpProcName)
 {
     return(wire(mi, lpProcName, Convention));
 }
Exemplo n.º 7
0
 protected T getDelegate <T>(LpProcName lpProcName) where T : class
 {
     return(getDelegate <T>(getProcAddress(lpProcName)));
 }
Exemplo n.º 8
0
 public NativeData native(LpProcName lpProcName)
 {
     return(getProcAddr(lpProcName).Native());
 }
Exemplo n.º 9
0
 public IntPtr getProcAddr(LpProcName lpProcName)
 {
     return(provider.getProcAddress(lpProcName));
 }