示例#1
0
        internal void OnModuleLoad(
            TProcess process,
            TModule module,
            OnFunctionResolvedDelegate <TModule, TRequest> onFunctionResolved
            )
        {
            if (!ShouldEnableFunctionResolver(process))
            {
                return;
            }

            MetadataResolver <TProcess, TModule, TRequest> resolver = null;
            var requests = GetRequests(process);

            foreach (var request in requests)
            {
                if (!ShouldHandleRequest(request))
                {
                    continue;
                }

                var moduleName = GetRequestModuleName(request);
                if (!ShouldModuleHandleRequest(module, moduleName))
                {
                    continue;
                }

                var signature = GetParsedSignature(request);
                if (signature == null)
                {
                    continue;
                }

                if (resolver == null)
                {
                    var reader = GetModuleMetadata(module);
                    if (reader == null)
                    {
                        return;
                    }
                    resolver = CreateMetadataResolver(process, module, reader, onFunctionResolved);
                }

                resolver.Resolve(request, signature);
            }
        }
        private void ResolveRequests(TProcess process, TModule module, TRequest[] requests)
        {
            if (!ShouldEnableFunctionResolver(process))
            {
                return;
            }

            MetadataResolver <TProcess, TModule, TRequest> resolver = null;

            foreach (var request in requests)
            {
                var moduleName = GetRequestModuleName(request);
                if (!ShouldModuleHandleRequest(module, moduleName))
                {
                    continue;
                }

                var signature = GetParsedSignature(request);
                if (signature == null)
                {
                    continue;
                }

                if (resolver == null)
                {
                    var reader = GetModuleMetadata(module);
                    if (reader == null)
                    {
                        return;
                    }
                    resolver = new MetadataResolver <TProcess, TModule, TRequest>(this, process, module, reader);
                }

                resolver.Resolve(request, signature);
            }
        }
示例#3
0
        internal void EnableResolution(TProcess process, TRequest request, OnFunctionResolvedDelegate <TModule, TRequest> onFunctionResolved)
        {
            var moduleName = GetRequestModuleName(request);
            var signature  = GetParsedSignature(request);

            if (signature == null)
            {
                return;
            }

            bool checkEnabled = true;

            foreach (var module in GetAllModules(process))
            {
                if (checkEnabled)
                {
                    if (!ShouldEnableFunctionResolver(process))
                    {
                        return;
                    }
                    checkEnabled = false;
                }

                if (!ShouldModuleHandleRequest(module, moduleName))
                {
                    continue;
                }
                var reader = GetModuleMetadata(module);
                if (reader == null)
                {
                    continue;
                }
                var resolver = new MetadataResolver <TProcess, TModule, TRequest>(process, module, reader, onFunctionResolved);
                resolver.Resolve(request, signature);
            }
        }