Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

获取 函数 地址是错误 的。 #11

Open
AltmanMusk opened this issue Jul 10, 2019 · 2 comments
Open

获取 函数 地址是错误 的。 #11

AltmanMusk opened this issue Jul 10, 2019 · 2 comments

Comments

@AltmanMusk
Copy link

例如像这样声明

[HookMethod("System.Net.HttpWebRequest")]
public WebResponse GetResponse(){}

@xiangyuecn
Copy link
Contributor

#10

@xiangyuecn
Copy link
Contributor

xiangyuecn commented Sep 8, 2019

刚试了一下.net 4.7.2 HttpWebRequest.GetResponse方法显示是已经替换掉了,但不会走hook方法,不知道啥原因。


测试代码:

public class aaa : IMethodHook {
	[HookMethod("System.Net.HttpWebRequest")]
	public WebResponse GetResponse() {
		Console.WriteLine("Hook Url Load");
		return GetResponse_Original();
	}
	[OriginalMethod]
	public WebResponse GetResponse_Original() {
		return null;
	}
}

public static void main() {
	MethodHook.Install();

	var req = WebRequest.CreateHttp("https://csdn.net");
	Console.WriteLine("Call");
	var rep = (HttpWebResponse)req.GetResponse();
	rep.Close();
	Console.WriteLine((int)rep.StatusCode);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants