aboutsummaryrefslogtreecommitdiff
path: root/sketchtrial.m
blob: 78868ec213de0309a4b7cd08dc2417c5e5d524c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#import <objc/runtime.h>
#import <Foundation/Foundation.h>
#include <AppKit/AppKit.h>


//
// BCRegularLicense
//

@interface BCRegularLicensePatched : NSObject
- (bool)isExpired;
- (bool)isValid;
@end

@interface BCLicenseManagerPatched : NSObject
- (long long)numberOfDaysLeftInTrialMode;
@end

@implementation BCRegularLicensePatched

+ (void)load {
    Class origClass = NSClassFromString(@"BCRegularLicense");
    
    method_exchangeImplementations(
        class_getInstanceMethod(origClass, @selector(isExpired)),
        class_getInstanceMethod(NSClassFromString(@"BCRegularLicensePatched"), @selector(isExpired))
    );

    method_exchangeImplementations(
        class_getInstanceMethod(origClass, @selector(isValid)),
        class_getInstanceMethod(NSClassFromString(@"BCRegularLicensePatched"), @selector(isValid))
    );
}

- (bool)isExpired {
    return false;
}

- (bool)isValid {
    return true;
}

@end


//
// BCLicenseManager
//

@implementation BCLicenseManagerPatched

+ (void)load {
    Class origClass = NSClassFromString(@"BCLicenseManager");

    method_exchangeImplementations(
        class_getInstanceMethod(origClass, @selector(numberOfDaysLeftInTrialMode)),
        class_getInstanceMethod(NSClassFromString(@"BCLicenseManagerPatched"), @selector(numberOfDaysLeftInTrialMode))
    );
}

- (long long)numberOfDaysLeftInTrialMode {
    return 9000;
}

@end