Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
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
Administrator
Magisk
Commits
8513946e
Commit
8513946e
authored
Jun 08, 2019
by
Ian Macdonald
Committed by
John Wu
Jun 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'magiskboot hexpatch' will exit with status 1 when nothing patched.
parent
8ebd9c89
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
3 deletions
+7
-3
hexpatch.cpp
native/jni/magiskboot/hexpatch.cpp
+5
-1
magiskboot.h
native/jni/magiskboot/magiskboot.h
+1
-1
main.cpp
native/jni/magiskboot/main.cpp
+1
-1
No files found.
native/jni/magiskboot/hexpatch.cpp
View file @
8513946e
...
@@ -16,8 +16,9 @@ static void hex2byte(uint8_t *hex, uint8_t *str) {
...
@@ -16,8 +16,9 @@ static void hex2byte(uint8_t *hex, uint8_t *str) {
}
}
}
}
void
hexpatch
(
const
char
*
image
,
const
char
*
from
,
const
char
*
to
)
{
int
hexpatch
(
const
char
*
image
,
const
char
*
from
,
const
char
*
to
)
{
int
patternsize
=
strlen
(
from
)
/
2
,
patchsize
=
strlen
(
to
)
/
2
;
int
patternsize
=
strlen
(
from
)
/
2
,
patchsize
=
strlen
(
to
)
/
2
;
int
patched
=
1
;
size_t
filesize
;
size_t
filesize
;
uint8_t
*
file
,
*
pattern
,
*
patch
;
uint8_t
*
file
,
*
pattern
,
*
patch
;
mmap_rw
(
image
,
file
,
filesize
);
mmap_rw
(
image
,
file
,
filesize
);
...
@@ -31,9 +32,12 @@ void hexpatch(const char *image, const char *from, const char *to) {
...
@@ -31,9 +32,12 @@ void hexpatch(const char *image, const char *from, const char *to) {
memset
(
file
+
i
,
0
,
patternsize
);
memset
(
file
+
i
,
0
,
patternsize
);
memcpy
(
file
+
i
,
patch
,
patchsize
);
memcpy
(
file
+
i
,
patch
,
patchsize
);
i
+=
patternsize
-
1
;
i
+=
patternsize
-
1
;
patched
=
0
;
}
}
}
}
munmap
(
file
,
filesize
);
munmap
(
file
,
filesize
);
free
(
pattern
);
free
(
pattern
);
free
(
patch
);
free
(
patch
);
return
patched
;
}
}
native/jni/magiskboot/magiskboot.h
View file @
8513946e
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
// Main entries
// Main entries
int
unpack
(
const
char
*
image
,
bool
hdr
=
false
);
int
unpack
(
const
char
*
image
,
bool
hdr
=
false
);
void
repack
(
const
char
*
orig_image
,
const
char
*
out_image
);
void
repack
(
const
char
*
orig_image
,
const
char
*
out_image
);
void
hexpatch
(
const
char
*
image
,
const
char
*
from
,
const
char
*
to
);
int
hexpatch
(
const
char
*
image
,
const
char
*
from
,
const
char
*
to
);
int
cpio_commands
(
int
argc
,
char
*
argv
[]);
int
cpio_commands
(
int
argc
,
char
*
argv
[]);
int
dtb_commands
(
const
char
*
cmd
,
int
argc
,
char
*
argv
[]);
int
dtb_commands
(
const
char
*
cmd
,
int
argc
,
char
*
argv
[]);
...
...
native/jni/magiskboot/main.cpp
View file @
8513946e
...
@@ -151,7 +151,7 @@ int main(int argc, char *argv[]) {
...
@@ -151,7 +151,7 @@ int main(int argc, char *argv[]) {
}
else
if
(
argc
>
2
&&
strncmp
(
argv
[
1
],
"compress"
,
8
)
==
0
)
{
}
else
if
(
argc
>
2
&&
strncmp
(
argv
[
1
],
"compress"
,
8
)
==
0
)
{
compress
(
argv
[
1
][
8
]
==
'='
?
&
argv
[
1
][
9
]
:
"gzip"
,
argv
[
2
],
argv
[
3
]);
compress
(
argv
[
1
][
8
]
==
'='
?
&
argv
[
1
][
9
]
:
"gzip"
,
argv
[
2
],
argv
[
3
]);
}
else
if
(
argc
>
4
&&
strcmp
(
argv
[
1
],
"hexpatch"
)
==
0
)
{
}
else
if
(
argc
>
4
&&
strcmp
(
argv
[
1
],
"hexpatch"
)
==
0
)
{
hexpatch
(
argv
[
2
],
argv
[
3
],
argv
[
4
]);
return
hexpatch
(
argv
[
2
],
argv
[
3
],
argv
[
4
]);
}
else
if
(
argc
>
2
&&
strcmp
(
argv
[
1
],
"cpio"
)
==
0
)
{
}
else
if
(
argc
>
2
&&
strcmp
(
argv
[
1
],
"cpio"
)
==
0
)
{
if
(
cpio_commands
(
argc
-
2
,
argv
+
2
))
usage
(
argv
[
0
]);
if
(
cpio_commands
(
argc
-
2
,
argv
+
2
))
usage
(
argv
[
0
]);
}
else
if
(
argc
>
2
&&
strncmp
(
argv
[
1
],
"dtb"
,
3
)
==
0
)
{
}
else
if
(
argc
>
2
&&
strncmp
(
argv
[
1
],
"dtb"
,
3
)
==
0
)
{
...
...
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