Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ReyunSecureSdk
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
daiwenjie
ReyunSecureSdk
Commits
14ce6561
Commit
14ce6561
authored
Apr 02, 2021
by
Fear1ess
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4/2
parent
0dfcd92b
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
99 additions
and
174 deletions
+99
-174
build.gradle
app/build.gradle
+1
-14
CMakeLists.txt
app/src/main/cpp/CMakeLists.txt
+0
-49
native-lib.cpp
app/src/main/cpp/native-lib.cpp
+0
-11
MainActivity.java
app/src/main/java/com/reyun/sdktestdemo/MainActivity.java
+1
-3
MyApplication.java
app/src/main/java/com/reyun/sdktestdemo/MyApplication.java
+0
-1
CMakeLists.txt
wandun/src/main/cpp/CMakeLists.txt
+5
-5
core.c
wandun/src/main/cpp/core.c
+4
-3
jni_helper.h
wandun/src/main/cpp/include/jni_helper.h
+3
-3
wd_syscall.h
wandun/src/main/cpp/include/wd_syscall.h
+3
-3
jni_helper.c
wandun/src/main/cpp/jni_helper.c
+82
-82
wd_syscall.c
wandun/src/main/cpp/wd_syscall.c
+0
-0
No files found.
app/build.gradle
View file @
14ce6561
...
...
@@ -14,14 +14,6 @@ android {
versionName
"1.0"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild
{
cmake
{
cppFlags
""
}
}
ndk
{
abiFilters
"armeabi-v7a"
,
"arm64-v8a"
}
}
buildTypes
{
...
...
@@ -30,12 +22,7 @@ android {
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
}
}
externalNativeBuild
{
cmake
{
path
"src/main/cpp/CMakeLists.txt"
version
"3.10.2"
}
}
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
...
...
app/src/main/cpp/CMakeLists.txt
deleted
100644 → 0
View file @
0dfcd92b
# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html
# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required
(
VERSION 3.10.2
)
# Declares and names the project.
project
(
"sdktestdemo"
)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
add_library
(
# Sets the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
native-lib.cpp
)
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
find_library
(
# Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log
)
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries
(
# Specifies the target library.
native-lib
# Links the target library to the log library
# included in the NDK.
${
log-lib
}
)
\ No newline at end of file
app/src/main/cpp/native-lib.cpp
deleted
100644 → 0
View file @
0dfcd92b
#include <jni.h>
#include <string>
extern
"C"
JNIEXPORT
jstring
JNICALL
Java_com_reyun_sdktestdemo_MainActivity_stringFromJNI
(
JNIEnv
*
env
,
jobject
/* this */
)
{
std
::
string
hello
=
"Hello from C++"
;
return
env
->
NewStringUTF
(
hello
.
c_str
());
}
\ No newline at end of file
app/src/main/java/com/reyun/sdktestdemo/MainActivity.java
View file @
14ce6561
...
...
@@ -19,12 +19,11 @@ public class MainActivity extends AppCompatActivity {
// Example of a call to a native method
TextView
tv
=
findViewById
(
R
.
id
.
sample_text
);
tv
.
setText
(
stringFromJNI
()
);
tv
.
setText
(
"hello world!"
);
}
/**
* A native method that is implemented by the 'native-lib' native library,
* which is packaged with this application.
*/
public
native
String
stringFromJNI
();
}
\ No newline at end of file
app/src/main/java/com/reyun/sdktestdemo/MyApplication.java
View file @
14ce6561
...
...
@@ -22,7 +22,6 @@ public class MyApplication extends Application {
public
void
onWdId
(
String
wdId
)
{
Log
.
d
(
TAG
,
"onWdId: "
+
wdId
);
}
/*
@Override
public void onError(String errorMsg) {
...
...
wandun/src/main/cpp/CMakeLists.txt
View file @
14ce6561
...
...
@@ -9,18 +9,18 @@ if(${CMAKE_ANDROID_ARCH_ABI} STREQUAL "arm64-v8a")
wd_syscall64.s
)
elseif
(
${
CMAKE_ANDROID_ARCH_ABI
}
STREQUAL
"armeabi-v7a"
)
set
(
ARCH_DEPENDED
1
_SRC
set
(
ARCH_DEPENDED_SRC
wd_syscall32.s
)
endif
()
set
(
CMAKE_CXX_FLAGS_RELEASE
"-fvisibility=hidden -O3 -fno-unwind-tables"
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"-fvisibility=hidden -O3 -fno-unwind-tables
-flto
"
)
add_library
(
wdun
SHARED
core.c
pp
wd_syscall.c
pp
jni_helper.c
pp
core.c
wd_syscall.c
jni_helper.c
${
ARCH_DEPENDED_SRC
}
)
...
...
wandun/src/main/cpp/core.c
pp
→
wandun/src/main/cpp/core.c
View file @
14ce6561
...
...
@@ -15,15 +15,16 @@ IMPORTWDSYSCALL
#define WDMAIN_GETWDID_METHOD_SIG "()Ljava/lang/String;"
jstring
jni_get_wdid
(
JNIEnv
*
env
,
jobject
thiz
)
{
}
JNIEXPORT
jint
JNI_OnLoad
(
JavaVM
*
vm
,
void
*
reserved
)
{
int
pid
=
WDSYSCALL
(
SYS_getpid
);
JNIEnv
*
env
=
NULL
;
if
(
vm
->
GetEnv
(
(
void
**
)
&
env
,
JNI_VERSION_1_6
)
==
JNI_TRUE
)
{
jclass
cls
=
env
->
FindClass
(
WDMAIN_CLASS_NAME
);
if
(
(
*
vm
)
->
GetEnv
(
vm
,
(
void
**
)
&
env
,
JNI_VERSION_1_6
)
==
JNI_TRUE
)
{
jclass
cls
=
(
*
env
)
->
FindClass
(
env
,
WDMAIN_CLASS_NAME
);
JNINativeMethod
methods
[]
=
{{
WDMAIN_GETWDID_METHOD_NAME
,
WDMAIN_GETWDID_METHOD_SIG
,
(
void
*
)
jni_get_wdid
}};
env
->
RegisterNatives
(
cls
,
methods
,
sizeof
(
methods
)
/
sizeof
(
JNINativeMethod
));
(
*
env
)
->
RegisterNatives
(
env
,
cls
,
methods
,
sizeof
(
methods
)
/
sizeof
(
JNINativeMethod
));
}
cJSON
*
json
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
json
,
"name"
,
"zhanglei"
);
...
...
wandun/src/main/cpp/include/jni_helper.h
View file @
14ce6561
...
...
@@ -9,14 +9,14 @@
void
wdCheckException
(
JNIEnv
*
env
);
char
wdGetMethodRetType
(
const
char
*
sig
);
inline
char
wdGetFieldType
(
const
char
*
sig
)
{
return
*
sig
;
}
char
wdGetFieldType
(
const
char
*
sig
)
{
return
*
sig
;
}
jvalue
wdGetStaticField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
);
jvalue
wdGetField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
);
void
wdSetStaticField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jvalue
value
);
void
wdSetField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jvalue
value
);
jobject
wdNewObject
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodSig
,
...);
jvalue
wdCallStaticMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...
);
jvalue
wdCallMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...
);
jvalue
wdCallStaticMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
va_list
args
);
jvalue
wdCallMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
va_list
args
);
jboolean
wdCallStaticBooleanMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jbyte
wdCallStaticByteMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jchar
wdCallStaticCharMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
...
...
wandun/src/main/cpp/include/wd_syscall.h
View file @
14ce6561
...
...
@@ -18,10 +18,10 @@
#endif
#define IMPORTWDSYSCALL \
__attribute__((visibility("hidden"))) extern
"C"
int wd_syscall32(int cmd, ...);\
__attribute__((visibility("hidden"))) extern
"C"
int wd_syscall64(int cmd, ...);
__attribute__((visibility("hidden"))) extern int wd_syscall32(int cmd, ...);\
__attribute__((visibility("hidden"))) extern int wd_syscall64(int cmd, ...);
extern
"C"
int
wd_set_errno
(
int
n
);
int
wd_set_errno
(
int
n
);
#endif //REYUNSDK_WD_SYSCALL_H
wandun/src/main/cpp/jni_helper.c
pp
→
wandun/src/main/cpp/jni_helper.c
View file @
14ce6561
...
...
@@ -5,9 +5,9 @@
#include "jni_helper.h"
void
wdCheckException
(
JNIEnv
*
env
)
{
if
(
env
->
ExceptionOccurred
()
!=
nullptr
){
env
->
ExceptionDescribe
(
);
env
->
ExceptionClear
(
);
if
(
(
*
env
)
->
ExceptionOccurred
(
env
)
!=
NULL
){
(
*
env
)
->
ExceptionDescribe
(
env
);
(
*
env
)
->
ExceptionClear
(
env
);
}
}
...
...
@@ -23,257 +23,257 @@ char wdGetMethodRetType(const char* sig) {
}
jvalue
wdGetStaticField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
jclass
cls
=
env
->
FindClass
(
clsName
);
jfieldID
fieldId
=
env
->
GetStaticFieldID
(
cls
,
fieldName
,
fieldSig
);
jclass
cls
=
(
*
env
)
->
FindClass
(
env
,
clsName
);
jfieldID
fieldId
=
(
*
env
)
->
GetStaticFieldID
(
env
,
cls
,
fieldName
,
fieldSig
);
jvalue
value
=
{
0
};
switch
(
wdGetFieldType
(
fieldSig
))
{
case
'['
:
case
'L'
:
value
.
l
=
env
->
GetStaticObjectField
(
cls
,
fieldId
);
value
.
l
=
(
*
env
)
->
GetStaticObjectField
(
env
,
cls
,
fieldId
);
break
;
case
'Z'
:
value
.
z
=
env
->
GetStaticBooleanField
(
cls
,
fieldId
);
value
.
z
=
(
*
env
)
->
GetStaticBooleanField
(
env
,
cls
,
fieldId
);
break
;
case
'B'
:
value
.
b
=
env
->
GetStaticByteField
(
cls
,
fieldId
);
value
.
b
=
(
*
env
)
->
GetStaticByteField
(
env
,
cls
,
fieldId
);
break
;
case
'C'
:
value
.
c
=
env
->
GetStaticCharField
(
cls
,
fieldId
);
value
.
c
=
(
*
env
)
->
GetStaticCharField
(
env
,
cls
,
fieldId
);
break
;
case
'S'
:
value
.
s
=
env
->
GetStaticShortField
(
cls
,
fieldId
);
value
.
s
=
(
*
env
)
->
GetStaticShortField
(
env
,
cls
,
fieldId
);
break
;
case
'I'
:
value
.
i
=
env
->
GetStaticIntField
(
cls
,
fieldId
);
value
.
i
=
(
*
env
)
->
GetStaticIntField
(
env
,
cls
,
fieldId
);
break
;
case
'J'
:
value
.
j
=
env
->
GetStaticLongField
(
cls
,
fieldId
);
value
.
j
=
(
*
env
)
->
GetStaticLongField
(
env
,
cls
,
fieldId
);
break
;
case
'F'
:
value
.
f
=
env
->
GetStaticFloatField
(
cls
,
fieldId
);
value
.
f
=
(
*
env
)
->
GetStaticFloatField
(
env
,
cls
,
fieldId
);
break
;
case
'D'
:
value
.
d
=
env
->
GetStaticDoubleField
(
cls
,
fieldId
);
value
.
d
=
(
*
env
)
->
GetStaticDoubleField
(
env
,
cls
,
fieldId
);
break
;
default:
break
;
}
wdCheckException
(
env
);
env
->
DeleteLocalRef
(
cls
);
(
*
env
)
->
DeleteLocalRef
(
env
,
cls
);
return
value
;
}
jvalue
wdGetField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
jclass
cls
=
env
->
GetObjectClass
(
obj
);
jfieldID
fieldId
=
env
->
GetFieldID
(
cls
,
fieldName
,
fieldSig
);
jclass
cls
=
(
*
env
)
->
GetObjectClass
(
env
,
obj
);
jfieldID
fieldId
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
fieldName
,
fieldSig
);
jvalue
value
=
{
0
};
switch
(
wdGetFieldType
(
fieldSig
))
{
case
'['
:
case
'L'
:
value
.
l
=
env
->
GetObjectField
(
cls
,
fieldId
);
value
.
l
=
(
*
env
)
->
GetObjectField
(
env
,
cls
,
fieldId
);
break
;
case
'Z'
:
value
.
z
=
env
->
GetBooleanField
(
cls
,
fieldId
);
value
.
z
=
(
*
env
)
->
GetBooleanField
(
env
,
cls
,
fieldId
);
break
;
case
'B'
:
value
.
b
=
env
->
GetByteField
(
cls
,
fieldId
);
value
.
b
=
(
*
env
)
->
GetByteField
(
env
,
cls
,
fieldId
);
break
;
case
'C'
:
value
.
c
=
env
->
GetCharField
(
cls
,
fieldId
);
value
.
c
=
(
*
env
)
->
GetCharField
(
env
,
cls
,
fieldId
);
break
;
case
'S'
:
value
.
s
=
env
->
GetShortField
(
cls
,
fieldId
);
value
.
s
=
(
*
env
)
->
GetShortField
(
env
,
cls
,
fieldId
);
break
;
case
'I'
:
value
.
i
=
env
->
GetIntField
(
cls
,
fieldId
);
value
.
i
=
(
*
env
)
->
GetIntField
(
env
,
cls
,
fieldId
);
break
;
case
'J'
:
value
.
j
=
env
->
GetLongField
(
cls
,
fieldId
);
value
.
j
=
(
*
env
)
->
GetLongField
(
env
,
cls
,
fieldId
);
break
;
case
'F'
:
value
.
f
=
env
->
GetFloatField
(
cls
,
fieldId
);
value
.
f
=
(
*
env
)
->
GetFloatField
(
env
,
cls
,
fieldId
);
break
;
case
'D'
:
value
.
d
=
env
->
GetDoubleField
(
cls
,
fieldId
);
value
.
d
=
(
*
env
)
->
GetDoubleField
(
env
,
cls
,
fieldId
);
break
;
default:
break
;
}
wdCheckException
(
env
);
env
->
DeleteLocalRef
(
cls
);
(
*
env
)
->
DeleteLocalRef
(
env
,
cls
);
return
value
;
}
void
wdSetStaticField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jvalue
value
)
{
jclass
cls
=
env
->
FindClass
(
clsName
);
jfieldID
fieldId
=
env
->
GetStaticFieldID
(
cls
,
fieldName
,
fieldSig
);
jclass
cls
=
(
*
env
)
->
FindClass
(
env
,
clsName
);
jfieldID
fieldId
=
(
*
env
)
->
GetStaticFieldID
(
env
,
cls
,
fieldName
,
fieldSig
);
switch
(
wdGetFieldType
(
fieldSig
))
{
case
'['
:
case
'L'
:
env
->
SetStaticObjectField
(
cls
,
fieldId
,
value
.
l
);
(
*
env
)
->
SetStaticObjectField
(
env
,
cls
,
fieldId
,
value
.
l
);
break
;
case
'Z'
:
env
->
SetStaticBooleanField
(
cls
,
fieldId
,
value
.
z
);
(
*
env
)
->
SetStaticBooleanField
(
env
,
cls
,
fieldId
,
value
.
z
);
break
;
case
'B'
:
env
->
SetStaticByteField
(
cls
,
fieldId
,
value
.
b
);
(
*
env
)
->
SetStaticByteField
(
env
,
cls
,
fieldId
,
value
.
b
);
break
;
case
'C'
:
env
->
SetStaticCharField
(
cls
,
fieldId
,
value
.
c
);
(
*
env
)
->
SetStaticCharField
(
env
,
cls
,
fieldId
,
value
.
c
);
break
;
case
'S'
:
env
->
SetStaticShortField
(
cls
,
fieldId
,
value
.
s
);
(
*
env
)
->
SetStaticShortField
(
env
,
cls
,
fieldId
,
value
.
s
);
break
;
case
'I'
:
env
->
SetStaticIntField
(
cls
,
fieldId
,
value
.
i
);
(
*
env
)
->
SetStaticIntField
(
env
,
cls
,
fieldId
,
value
.
i
);
break
;
case
'J'
:
env
->
SetStaticLongField
(
cls
,
fieldId
,
value
.
j
);
(
*
env
)
->
SetStaticLongField
(
env
,
cls
,
fieldId
,
value
.
j
);
break
;
case
'F'
:
env
->
SetStaticFloatField
(
cls
,
fieldId
,
value
.
f
);
(
*
env
)
->
SetStaticFloatField
(
env
,
cls
,
fieldId
,
value
.
f
);
break
;
case
'D'
:
env
->
SetStaticDoubleField
(
cls
,
fieldId
,
value
.
d
);
(
*
env
)
->
SetStaticDoubleField
(
env
,
cls
,
fieldId
,
value
.
d
);
break
;
default:
break
;
}
wdCheckException
(
env
);
env
->
DeleteLocalRef
(
cls
);
(
*
env
)
->
DeleteLocalRef
(
env
,
cls
);
}
void
wdSetField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jvalue
value
)
{
jclass
cls
=
env
->
GetObjectClass
(
cls
);
jfieldID
fieldId
=
env
->
GetFieldID
(
cls
,
fieldName
,
fieldSig
);
jclass
cls
=
(
*
env
)
->
GetObjectClass
(
env
,
cls
);
jfieldID
fieldId
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
fieldName
,
fieldSig
);
switch
(
wdGetFieldType
(
fieldSig
))
{
case
'['
:
case
'L'
:
env
->
SetObjectField
(
obj
,
fieldId
,
value
.
l
);
(
*
env
)
->
SetObjectField
(
env
,
obj
,
fieldId
,
value
.
l
);
break
;
case
'Z'
:
env
->
SetBooleanField
(
cls
,
fieldId
,
value
.
z
);
(
*
env
)
->
SetBooleanField
(
env
,
cls
,
fieldId
,
value
.
z
);
break
;
case
'B'
:
env
->
SetByteField
(
cls
,
fieldId
,
value
.
b
);
(
*
env
)
->
SetByteField
(
env
,
cls
,
fieldId
,
value
.
b
);
break
;
case
'C'
:
env
->
SetCharField
(
cls
,
fieldId
,
value
.
c
);
(
*
env
)
->
SetCharField
(
env
,
cls
,
fieldId
,
value
.
c
);
break
;
case
'S'
:
env
->
SetShortField
(
cls
,
fieldId
,
value
.
s
);
(
*
env
)
->
SetShortField
(
env
,
cls
,
fieldId
,
value
.
s
);
break
;
case
'I'
:
env
->
SetIntField
(
cls
,
fieldId
,
value
.
i
);
(
*
env
)
->
SetIntField
(
env
,
cls
,
fieldId
,
value
.
i
);
break
;
case
'J'
:
env
->
SetLongField
(
cls
,
fieldId
,
value
.
j
);
(
*
env
)
->
SetLongField
(
env
,
cls
,
fieldId
,
value
.
j
);
break
;
case
'F'
:
env
->
SetFloatField
(
cls
,
fieldId
,
value
.
f
);
(
*
env
)
->
SetFloatField
(
env
,
cls
,
fieldId
,
value
.
f
);
break
;
case
'D'
:
env
->
SetDoubleField
(
cls
,
fieldId
,
value
.
d
);
(
*
env
)
->
SetDoubleField
(
env
,
cls
,
fieldId
,
value
.
d
);
break
;
default:
break
;
}
wdCheckException
(
env
);
env
->
DeleteLocalRef
(
cls
);
(
*
env
)
->
DeleteLocalRef
(
env
,
cls
);
}
jobject
wdNewObject
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodSig
,
...)
{
jclass
cls
=
env
->
FindClass
(
clsName
);
jmethodID
methodId
=
env
->
GetMethodID
(
cls
,
"<init>"
,
methodSig
);
jclass
cls
=
(
*
env
)
->
FindClass
(
env
,
clsName
);
jmethodID
methodId
=
(
*
env
)
->
GetMethodID
(
env
,
cls
,
"<init>"
,
methodSig
);
va_list
args
;
va_start
(
args
,
methodSig
);
jobject
res
=
nullptr
;
res
=
env
->
NewObjectV
(
cls
,
methodId
,
args
);
jobject
res
=
NULL
;
res
=
(
*
env
)
->
NewObjectV
(
env
,
cls
,
methodId
,
args
);
wdCheckException
(
env
);
va_end
(
args
);
env
->
DeleteLocalRef
(
cls
);
(
*
env
)
->
DeleteLocalRef
(
env
,
cls
);
return
res
;
}
jvalue
wdCallStaticMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
va_list
args
)
{
jclass
cls
=
env
->
FindClass
(
clsName
);
jmethodID
methodId
=
env
->
GetStaticMethodID
(
cls
,
methodName
,
methodSig
);
jclass
cls
=
(
*
env
)
->
FindClass
(
env
,
clsName
);
jmethodID
methodId
=
(
*
env
)
->
GetStaticMethodID
(
env
,
cls
,
methodName
,
methodSig
);
jvalue
value
=
{
0
};
switch
(
wdGetMethodRetType
(
methodSig
))
{
case
'V'
:
env
->
CallStaticVoidMethodV
(
cls
,
methodId
,
args
);
(
*
env
)
->
CallStaticVoidMethodV
(
env
,
cls
,
methodId
,
args
);
break
;
case
'['
:
case
'L'
:
value
.
l
=
env
->
CallStaticObjectMethodV
(
cls
,
methodId
,
args
);
value
.
l
=
(
*
env
)
->
CallStaticObjectMethodV
(
env
,
cls
,
methodId
,
args
);
break
;
case
'Z'
:
value
.
z
=
env
->
CallStaticBooleanMethodV
(
cls
,
methodId
,
args
);
value
.
z
=
(
*
env
)
->
CallStaticBooleanMethodV
(
env
,
cls
,
methodId
,
args
);
break
;
case
'B'
:
value
.
b
=
env
->
CallStaticByteMethodV
(
cls
,
methodId
,
args
);
value
.
b
=
(
*
env
)
->
CallStaticByteMethodV
(
env
,
cls
,
methodId
,
args
);
break
;
case
'C'
:
value
.
c
=
env
->
CallStaticCharMethodV
(
cls
,
methodId
,
args
);
value
.
c
=
(
*
env
)
->
CallStaticCharMethodV
(
env
,
cls
,
methodId
,
args
);
break
;
case
'S'
:
value
.
s
=
env
->
CallStaticShortMethodV
(
cls
,
methodId
,
args
);
value
.
s
=
(
*
env
)
->
CallStaticShortMethodV
(
env
,
cls
,
methodId
,
args
);
break
;
case
'I'
:
value
.
i
=
env
->
CallStaticIntMethodV
(
cls
,
methodId
,
args
);
value
.
i
=
(
*
env
)
->
CallStaticIntMethodV
(
env
,
cls
,
methodId
,
args
);
break
;
case
'J'
:
value
.
j
=
env
->
CallStaticLongMethodV
(
cls
,
methodId
,
args
);
value
.
j
=
(
*
env
)
->
CallStaticLongMethodV
(
env
,
cls
,
methodId
,
args
);
break
;
case
'F'
:
value
.
f
=
env
->
CallStaticFloatMethodV
(
cls
,
methodId
,
args
);
value
.
f
=
(
*
env
)
->
CallStaticFloatMethodV
(
env
,
cls
,
methodId
,
args
);
break
;
case
'D'
:
value
.
d
=
env
->
CallStaticDoubleMethodV
(
cls
,
methodId
,
args
);
value
.
d
=
(
*
env
)
->
CallStaticDoubleMethodV
(
env
,
cls
,
methodId
,
args
);
break
;
default:
break
;
}
wdCheckException
(
env
);
env
->
DeleteLocalRef
(
cls
);
(
*
env
)
->
DeleteLocalRef
(
env
,
cls
);
return
value
;
}
jvalue
wdCallMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
va_list
args
)
{
jclass
cls
=
env
->
GetObjectClass
(
obj
);
jmethodID
methodId
=
env
->
GetMethodID
(
cls
,
methodName
,
methodSig
);
jclass
cls
=
(
*
env
)
->
GetObjectClass
(
env
,
obj
);
jmethodID
methodId
=
(
*
env
)
->
GetMethodID
(
env
,
cls
,
methodName
,
methodSig
);
jvalue
value
=
{
0
};
switch
(
wdGetMethodRetType
(
methodSig
))
{
case
'V'
:
env
->
CallVoidMethodV
(
obj
,
methodId
,
args
);
(
*
env
)
->
CallVoidMethodV
(
env
,
obj
,
methodId
,
args
);
break
;
case
'['
:
case
'L'
:
value
.
l
=
env
->
CallObjectMethodV
(
obj
,
methodId
,
args
);
value
.
l
=
(
*
env
)
->
CallObjectMethodV
(
env
,
obj
,
methodId
,
args
);
break
;
case
'Z'
:
value
.
z
=
env
->
CallBooleanMethodV
(
obj
,
methodId
,
args
);
value
.
z
=
(
*
env
)
->
CallBooleanMethodV
(
env
,
obj
,
methodId
,
args
);
break
;
case
'B'
:
value
.
b
=
env
->
CallByteMethodV
(
obj
,
methodId
,
args
);
value
.
b
=
(
*
env
)
->
CallByteMethodV
(
env
,
obj
,
methodId
,
args
);
break
;
case
'C'
:
value
.
c
=
env
->
CallCharMethodV
(
obj
,
methodId
,
args
);
value
.
c
=
(
*
env
)
->
CallCharMethodV
(
env
,
obj
,
methodId
,
args
);
break
;
case
'S'
:
value
.
s
=
env
->
CallShortMethodV
(
obj
,
methodId
,
args
);
value
.
s
=
(
*
env
)
->
CallShortMethodV
(
env
,
obj
,
methodId
,
args
);
break
;
case
'I'
:
value
.
i
=
env
->
CallIntMethodV
(
obj
,
methodId
,
args
);
value
.
i
=
(
*
env
)
->
CallIntMethodV
(
env
,
obj
,
methodId
,
args
);
break
;
case
'J'
:
value
.
j
=
env
->
CallLongMethodV
(
obj
,
methodId
,
args
);
value
.
j
=
(
*
env
)
->
CallLongMethodV
(
env
,
obj
,
methodId
,
args
);
break
;
case
'F'
:
value
.
f
=
env
->
CallFloatMethodV
(
obj
,
methodId
,
args
);
value
.
f
=
(
*
env
)
->
CallFloatMethodV
(
env
,
obj
,
methodId
,
args
);
break
;
case
'D'
:
value
.
d
=
env
->
CallDoubleMethodV
(
obj
,
methodId
,
args
);
value
.
d
=
(
*
env
)
->
CallDoubleMethodV
(
env
,
obj
,
methodId
,
args
);
break
;
default:
break
;
}
wdCheckException
(
env
);
env
->
DeleteLocalRef
(
cls
);
(
*
env
)
->
DeleteLocalRef
(
env
,
cls
);
return
value
;
}
...
...
wandun/src/main/cpp/wd_syscall.c
pp
→
wandun/src/main/cpp/wd_syscall.c
View file @
14ce6561
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment