I have the following class that I am hooking, I am trying to figure out how to hook and set m_proxyPort. I can read it without issue, but how about if I want to change it?
There is a setter for the 3 NSString ivars, but theres no setter for m_proxyPort, would like to know if there is a way to set that ivar?
@interface DDURLProtocol : NSURLProtocol <NSURLAuthenticationChallengeSender, DDURLProtocolHttpAdapterDelegate>
{
int m_proxyPort;
NSString *_proxyHost;
NSString *_proxyUsername;
NSString *_proxyPassword;
}
%hook DDURLProtocol
- (void) check
{
[self setProxyHost:@"127.0.0.1"];
int pp = MSHookIvar<int>(self, "m_proxyPort");
NSLog(@"proxyPort: %d", pp);
// How to set m_proxyPort????
}
%end
You can set it the same way you get it.
MSHookIvar<int>(self, "m_proxyPort") = 23;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With