I'm trying to trap the arguments of the function in bookmarking on MobileSafari. But I get compile errors. I suspect the WebBookmark class is undeclared and found none of the headers in Safari declaring the interface for it. So I added:
#import <WebKit/WebKit.h>
#import <WebCore/WebCore.h>
To my Tweak.mk. Does anyone know where to find their interfaces? Below are my makefiles, tweak and output. Thanks!
# output:
Making all for tweak TestingTweak...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UITableView.h:11,
from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIPickerView.h:11,
from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityAdditions.h:10,
from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibility.h:12,
from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:10,
from /opt/theos/Prefix.pch:4,
from <command-line>:0:
/opt/theos/include/UIKit/UISwipeGestureRecognizer.h:6:26: error: Availability2.h: No such file or directory
Tweak.xm:30: error: ‘WebBookmark’ has not been declared
Tweak.xm:30: error: ‘WebBookmark’ has not been declared
Tweak.xm:30: error: expected initializer before ‘*’ token
Tweak.xm:30: error: expected initializer before ‘*’ token
Tweak.xm:30: error: ‘WebBookmark’ has not been declared
Tweak.xm:30: error: ‘WebBookmark’ has not been declared
Tweak.xm:30: error: expected initializer before ‘*’ token
Tweak.xm:30: error: expected initializer before ‘*’ token
Tweak.xm:464: error: ‘WebBookmark’ has not been declared
Tweak.xm:465: error: expected initializer before ‘*’ token
Tweak.xm:466: error: ‘WebBookmark’ has not been declared
Tweak.xm:467: error: expected initializer before ‘*’ token
Tweak.xm: In function ‘void _logosLocalInit()’:
Tweak.xm:2569: error: ‘_logos_method$_ungrouped$FolderPickerViewController$parentBookmark’ was not declared in this scope
Tweak.xm:2569: error: ‘_logos_orig$_ungrouped$FolderPickerViewController$parentBookmark’ was not declared in this scope
Tweak.xm:2569: error: ‘_logos_method$_ungrouped$FolderPickerViewController$movingBookmark’ was not declared in this scope
Tweak.xm:2569: error: ‘_logos_orig$_ungrouped$FolderPickerViewController$movingBookmark’ was not declared in this scope
make[2]: *** [obj/Tweak.xm.o] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [TestingTweak.all.tweak.variables] Error 2
WHAt went in:
#import <UIKit/UIKit2.h>
%hook FolderPickerViewController
- (id)initWithDelegate:(id)arg1 bookmarkCollection:(id)arg2 { %log; id r = %orig; NSLog(#" = %#", r); return r; }
- (void)dealloc { %log; %orig; }
- (int)tableView:(id)arg1 numberOfRowsInSection:(int)arg2 { %log; int r = %orig; NSLog(#" = %d", r); return r; }
- (id)tableView:(id)arg1 cellForRowAtIndexPath:(id)arg2 { %log; id r = %orig; NSLog(#" = %#", r); return r; }
- (void)tableView:(id)arg1 didSelectRowAtIndexPath:(id)arg2 { %log; %orig; }
- (void)_cancel { %log; %orig; }
- (void)willShowForBookmark:(id)arg1 parent:(id)arg2 { %log; %orig; }
// the following properties seem to be the culprit
- (void)setParentBookmark:(WebBookmark *)parentBookmark { %log; %orig; }
- (WebBookmark *)parentBookmark { %log; WebBookmark * r = %orig; NSLog(#" = %#", r); return r; }
- (void)setMovingBookmark:(WebBookmark *)movingBookmark { %log; %orig; }
- (WebBookmark *)movingBookmark { %log; WebBookmark * r = %orig; NSLog(#" = %#", r); return r; }
%end
What's in the makefile:
SDKVERSION=5.0
include theos/makefiles/common.mk
TWEAK_NAME = TestingTweak
TestingTweak_FILES = Tweak.xm
include $(THEOS_MAKE_PATH)/tweak.mk
Filter:
{ Filter = { Bundles = ( "com.apple.mobilesafari" ); }; }
WebBookmark comes from WebBookmarks.framework. It's a private framework, you'll have to class-dump it.
Related
I have the following SystemTap program:
#!/usr/bin/stap
function proc:string() {
return sprintf("[%s] %s(%s)::%s() (pid %d, uid %d, cwd %s)",
execname(), cmdline_arg(0), cmdline_args(1,-1,", "), caller(), pid(), uid(),
fullpath_struct_path(task_cwd_path(task_current()))
);
}
probe syscall.open.return, syscall.stat.return,
syscall.open64.return ?, syscall.stat64.return ? {
filename = user_string($filename);
if ($return < 0) {
eno = -$return;
printf("%s => %s '%s' by %s\n", pn(), errno_str(eno), filename, proc());
}
}
when run it gets the following error:
semantic error: unresolved function (similar: d_path, inode_path, task_cpu, task_current, task_dentry_path): identifier 'task_cwd_path' at /tmp/stap-test:5:30
which I believe is because Red Hat did not add the task_cwd_path() function until RHEL7. Is there an alternative way to return the current directory that will work with RHEL6?
I am try to compile using matlab mex, but i keep receiving this error:
Warning: You are using gcc version "5.4.0-6ubuntu1~16.04.1)". The version
currently supported with MEX is "4.2.3".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/
In file included from descriptor.h:4:0,
from calc_shot.cpp:11:
mesh.h: In function ‘double magnitude(const vec3d<T>&)’:
mesh.h:106:9: error: ‘sqrt’ is not a member of ‘std’
return std::sqrt((v1.x*v1.x) + (v1.y*v1.y) + (v1.z*v1.z));
^
In file included from calc_shot.cpp:11:0:
descriptor.h: At global scope:
descriptor.h:7:57: error: expected class-name before ‘{’ token
class invalid_mesh_descriptor : public std::logic_error {
^
descriptor.h: In constructor ‘invalid_mesh_descriptor::invalid_mesh_descriptor()’:
descriptor.h:9:57: error: expected class-name before ‘(’ token
explicit invalid_mesh_descriptor() : std::logic_error("Exception invalid_mesh_descriptor caught.") {}
^
descriptor.h:9:57: error: expected ‘{’ before ‘(’ token
descriptor.h: In constructor ‘invalid_mesh_descriptor::invalid_mesh_descriptor(const string&)’:
descriptor.h:10:70: error: expected class-name before ‘(’ token
invalid_mesh_descriptor(const std::string& msg) : std::logic_error("Exception invalid_mesh_descriptor caught: "+msg) {}
^
descriptor.h:10:70: error: expected ‘{’ before ‘(’ token
descriptor.h: In function ‘std::ostream& operator<<(std::ostream&, const vec_descriptor<T>&)’:
descriptor.h:123:45: error: no match for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream<char>}’ and ‘const char [2]’)
for (size_t k=1; k < d.size(); ++k) s << " " << d(k);
^
In file included from /usr/include/c++/5/string:52:0,
from descriptor.h:5,
from calc_shot.cpp:11:
/usr/include/c++/5/bits/basic_string.h:5172:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
operator<<(basic_ostream<_CharT, _Traits>& __os,
^
/usr/include/c++/5/bits/basic_string.h:5172:5: note: template argument deduction/substitution failed:
In file included from calc_shot.cpp:11:0:
descriptor.h:123:48: note: mismatched types ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘const char [2]’
for (size_t k=1; k < d.size(); ++k) s << " " << d(k);
^
mex: compile of ' "calc_shot.cpp"' failed.
i used to compile this code with LD_PRELOAD but at the moment i do not remember the argument, how can i solve?
solution:
mex -v calc_shot.cpp shot_descriptor.cpp -DUSE_FLANN -I"C:\Program Files\flann\include" -I/usr/include/eigen3
using this command the programs works like a charm
I tried to integrate HockeyApp in my cocos2d-x project, using following link:-
http://support.hockeyapp.net/kb/client-integration-android/hockeyapp-for-android-ndk-early-access
But it gives me following error when I tried to run ndk-build command
jni/../../breakpad/android/google_breakpad/../../src/client/linux/log/log.cc:47:7: error: expected nested-name-specifier before 'AndroidLogBufferWriteFunc'
using AndroidLogBufferWriteFunc = int (*)(int bufID, int prio, const char *tag,
^
jni/../../breakpad/android/google_breakpad/../../src/client/linux/log/log.cc:47:7: error: 'AndroidLogBufferWriteFunc' has not been declared
jni/../../breakpad/android/google_breakpad/../../src/client/linux/log/log.cc:47:33: error: expected ';' before '=' token
using AndroidLogBufferWriteFunc = int (*)(int bufID, int prio, const char *tag,
^
jni/../../breakpad/android/google_breakpad/../../src/client/linux/log/log.cc:47:33: error: expected unqualified-id before '=' token
jni/../../breakpad/android/google_breakpad/../../src/client/linux/log/log.cc:53:1: error: 'AndroidLogBufferWriteFunc' does not name a type
AndroidLogBufferWriteFunc g_android_log_buf_write = nullptr;
^
jni/../../breakpad/android/google_breakpad/../../src/client/linux/log/log.cc: In function 'void logger::initializeCrashLogWriter()':
jni/../../breakpad/android/google_breakpad/../../src/client/linux/log/log.cc:60:3: error: 'g_android_log_buf_write' was not declared in this scope
g_android_log_buf_write = reinterpret_cast<AndroidLogBufferWriteFunc>(
^
jni/../../breakpad/android/google_breakpad/../../src/client/linux/log/log.cc:60:46: error: expected type-specifier before 'AndroidLogBufferWriteFunc'
g_android_log_buf_write = reinterpret_cast<AndroidLogBufferWriteFunc>(
^
jni/../../breakpad/android/google_breakpad/../../src/client/linux/log/log.cc:60:46: error: expected '>' before 'AndroidLogBufferWriteFunc'
jni/../../breakpad/android/google_breakpad/../../src/client/linux/log/log.cc:60:46: error: expected '(' before 'AndroidLogBufferWriteFunc'
jni/../../breakpad/android/google_breakpad/../../src/client/linux/log/log.cc:60:46: error: 'AndroidLogBufferWriteFunc' was not declared in this scope
jni/../../breakpad/android/google_breakpad/../../src/client/linux/log/log.cc:61:54: error: expected ')' before ';' token
dlsym(RTLD_DEFAULT, "__android_log_buf_write"));
^
jni/../../breakpad/android/google_breakpad/../../src/client/linux/log/log.cc: In function 'int logger::writeToCrashLog(const char*)':
jni/../../breakpad/android/google_breakpad/../../src/client/linux/log/log.cc:68:7: error: 'g_android_log_buf_write' was not declared in this scope
if (g_android_log_buf_write) {
^
make: *** [obj/local/armeabi/objs/breakpad_client/src/client/linux/log/log.o] Error 1
GCC 4.6.3 doesn't support C++11 type aliases:
in
Breakpad\src\client\linux\log\log.cc
replace
using AndroidLogBufferWriteFunc = int (*)(int bufID, int prio, const char *tag,const char *text);
with
typedef int (*AndroidLogBufferWriteFunc)(int bufID, int prio, const char *tag,const char *text);
I followed http://brandontreb.com/beginning-jailbroken-ios-development-building-and-deployment
to make a tweak.
but after i done successfully with the helloworld tweak.
I hook the fopen using MSHookFunction
and then i meet a linking error
Making all for tweak hw...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
Linking tweak hw...
Undefined symbols for architecture armv7:
"_MSHookFunction", referenced from:
global constructors keyed to Tweak.xm.mmin Tweak.xm.51941273.o
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
make[2]: *** [.theos/obj/hw.dylib.ba964c90.unsigned] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [hw.all.tweak.variables] Error 2
this is Tweak.xm
#import "substrate.h"
static FILE * (*s_orig_fopen) ( const char * filename, const char * mode );
static FILE * my_fopen ( const char * filename, const char * mode ){
return s_orig_fopen(filename, mode);
}
static void entry(void) __attribute__ ((constructor));
static void entry(void) {
MSHookFunction(fopen, my_fopen, &s_orig_fopen);
}
does anyone know how to fix it?
You can try this:
#import "substrate.h"
static FILE * (*s_orig_fopen) ( const char * filename, const char * mode );
static FILE * my_fopen ( const char * filename, const char * mode ){
return s_orig_fopen(filename, mode);
}
%ctor {
MSHookFunction(fopen, my_fopen, &s_orig_fopen);
}
still working on this system call!!!
i have added a system call to a kernel, compiled and the OS is running off it.
now i am getting syntax error on the compilation of my test application.
testmycall.h
#include<linux/unistd.h>
#define __NR_mycall 244
_syscall1(long, mycall, int, i)
testmycall.c
#include<stdio.h>
#include "testmycall.h"
int main(int argc, char *argv[])
{
printf("%d\n", mycall(15));
}
here is the error
stef#ubuntu:~$ gcc -o testmycall testmycall.c
In file included from testmycall.c:3:
testmycall.h:7: error: expected ‘)’ before ‘mycall’
stef#ubuntu:~$ gcc -o testmycall testmycall.c
In file included from testmycall.c:3:
testmycall.h:7: error: expected declaration specifiers or ‘...’ before ‘mycall’
testmycall.h:7: error: expected declaration specifiers or ‘...’ before ‘i’
testmycall.c: In function ‘_syscall1’:
testmycall.c:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
testmycall.h:7: error: parameter name omitted
testmycall.h:7: error: parameter name omitted
testmycall.c:11: error: expected ‘{’ at end of input
stef#ubuntu
i have added in the syscall instead of _syscall1
now i get this error
stef#ubuntu:~$ gcc -o testmycall testmycall.c
testmycall.c: In function ‘syscall’:
testmycall.c:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
testmycall.c:11: error: expected ‘{’
this is the app, any ideas why???
I believe the _syscallN() macros were removed from the kernel headers around 2.6.18 or so.
The (not especially helpful) error messages from gcc are due to _syscall1 not being defined at all - you get the same errors if you write:
any_old_rubbish_here(long, mycall, int, i)
The syscall() function should work. man syscall for details.
The _syscall macros are obsolete and should not be used, instead use syscall, eg.
#define _GNU_SOURCE
#include <unistd.h>
...
printf("%d\n", syscall(__NR_mycall, 15));
Here's my test program:
#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#define __NR_mycall 244
int main(int argc, char **argv)
{
printf("%d\n", syscall(__NR_mycall,15));
return 0;
}