Creating TFENode from the path

How to create TFENode from path?


EDIT:

I'm a little more complicated, there is a method in TGlobalWindowController:

struct TString {
    struct TRef<const __CFString *, TRetainReleasePolicy<CFStringRef>> fString;
};

...

+ (struct TFENode)nodeForUrl:(const struct TString *)arg1;

Sorry, I can not create TString.


EDIT2:
After researching, I found out that this method works:

struct TString {
//struct TRef<CFStringRef, TRetainReleasePolicy<CFStringRef>> fString;
CFStringRef fString;
};

NSString *path = [[NSString alloc] initWithString:@"file:///"];
struct TString *tstr = (struct TString *)malloc(sizeof(struct TString*));
tstr->fString = (CFStringRef)path;
id node = [NSClassFromString(@"TGlobalWindowController") performSelector:NSSelectorFromString(@"nodeForUrl:") withObject:(id)tstr];
free(tstr);
[path release];

node is correct, but the crawler will work as soon as the next garbage collection process begins.

+4
source share
1 answer

Found answer:

+ (char*) nodeForPath:(NSURL*)url node:(char*) node
{
    memset(node, 0, 0x204);

    int *v6;
    void* v7;

    if ( (double)NSAppKitVersionNumber < 1110.0 )
    {
        v6 = (int *)[url absoluteString];
    }
    else
    {
        v7 = [url absoluteString];
        v6 = (int *)&v7;
    }
    objc_msgSend_stret((id)node,NSClassFromString(@"TGlobalWindowController"), NSSelectorFromString(@"nodeForUrl:"), v6);
    return node;
}
0
source

Source: https://habr.com/ru/post/1539744/


All Articles