Question

How to create a TFENode from a Path?


EDIT:

I am a bit farer, there is a method in TGlobalWindowController:

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

...

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

Unfortunately, I'm not able to create a TString.


EDIT2:
After research, 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];

The node is correct, but the finder crashes as soon as the next garbage collection process starts.

Was it helpful?

Solution

Found the 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;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top