Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
nvidia-patch
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
nvidia-patch
Commits
7688bf44
Commit
7688bf44
authored
Oct 23, 2019
by
Snawoot
Committed by
GitHub
Oct 23, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #176 from Snawoot/win_x86
Win x86
parents
3de49e82
b92b7618
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
194 additions
and
141 deletions
+194
-141
win/README.md
win/README.md
+87
-87
win/tools/autopatch/autopatch.py
win/tools/autopatch/autopatch.py
+89
-54
win/win10_x64/440.97/nvcuvid32.1337
win/win10_x64/440.97/nvcuvid32.1337
+3
-0
win/win10_x64/440.97/nvcuvid64.1337
win/win10_x64/440.97/nvcuvid64.1337
+0
-0
win/win10_x64/quadro_440.97/nvcuvid32.1337
win/win10_x64/quadro_440.97/nvcuvid32.1337
+3
-0
win/win10_x64/quadro_440.97/nvcuvid64.1337
win/win10_x64/quadro_440.97/nvcuvid64.1337
+0
-0
win/win7_x64/440.97/nvcuvid32.1337
win/win7_x64/440.97/nvcuvid32.1337
+3
-0
win/win7_x64/440.97/nvcuvid64.1337
win/win7_x64/440.97/nvcuvid64.1337
+0
-0
win/win7_x64/quadro_440.97/nvcuvid32.1337
win/win7_x64/quadro_440.97/nvcuvid32.1337
+3
-0
win/win7_x64/quadro_440.97/nvcuvid64.1337
win/win7_x64/quadro_440.97/nvcuvid64.1337
+0
-0
win/ws2012_x64/quadro_440.97/nvcuvid32.1337
win/ws2012_x64/quadro_440.97/nvcuvid32.1337
+3
-0
win/ws2012_x64/quadro_440.97/nvcuvid64.1337
win/ws2012_x64/quadro_440.97/nvcuvid64.1337
+0
-0
win/ws2016_x64/quadro_440.97/nvcuvid32.1337
win/ws2016_x64/quadro_440.97/nvcuvid32.1337
+3
-0
win/ws2016_x64/quadro_440.97/nvcuvid64.1337
win/ws2016_x64/quadro_440.97/nvcuvid64.1337
+0
-0
No files found.
win/README.md
View file @
7688bf44
This diff is collapsed.
Click to expand it.
win/tools/autopatch/autopatch.py
View file @
7688bf44
#!/usr/bin/env python3
#!/usr/bin/env python3
import
argparse
import
sys
import
sys
import
subprocess
import
subprocess
import
tempfile
import
tempfile
import
os.path
import
os.path
from
binascii
import
unhexlify
from
binascii
import
unhexlify
import
xml.etree.ElementTree
as
ET
import
xml.etree.ElementTree
as
ET
import
itertools
import
functools
PATCH_EXT
=
".1337"
CRLF
=
b
"
\x0d\x0a
"
CRLF
=
b
"
\x0d\x0a
"
HEADER_FORMAT
=
b
">
%
s"
HEADER_FORMAT
=
b
">
%
s"
LINE_FORMAT
=
CRLF
+
b
"
%016
X:
%02
X->
%02
X"
LINE_FORMAT
=
CRLF
+
b
"
%016
X:
%02
X->
%02
X"
...
@@ -16,7 +18,6 @@ OFFSET_ADJUSTMENT = 0xC00 # shift specific to x64dbg .1337 format
...
@@ -16,7 +18,6 @@ OFFSET_ADJUSTMENT = 0xC00 # shift specific to x64dbg .1337 format
def
parse_args
():
def
parse_args
():
import
argparse
parser
=
argparse
.
ArgumentParser
(
parser
=
argparse
.
ArgumentParser
(
description
=
"Generates .1337 patch for Nvidia drivers for Windows"
,
description
=
"Generates .1337 patch for Nvidia drivers for Windows"
,
...
@@ -29,18 +30,41 @@ def parse_args():
...
@@ -29,18 +30,41 @@ def parse_args():
dest
=
"sevenzip"
,
dest
=
"sevenzip"
,
help
=
"location of 7-zip `7z` executable"
)
help
=
"location of 7-zip `7z` executable"
)
parser
.
add_argument
(
"-T"
,
"--target"
,
parser
.
add_argument
(
"-T"
,
"--target"
,
default
=
"Display.Driver/nvcuvid64.dl_"
,
nargs
=
"+"
,
help
=
"target location in archive"
)
default
=
[
"Display.Driver/nvcuvid64.dl_"
,
"Display.Driver/nvcuvid32.dl_"
,
],
help
=
"target location(s) in archive"
)
parser
.
add_argument
(
"-N"
,
"--target-name"
,
parser
.
add_argument
(
"-N"
,
"--target-name"
,
default
=
"nvcuvid.dll"
,
nargs
=
"+"
,
help
=
"name of installed target file. Used for patch "
default
=
[
"nvcuvid.dll"
,
"nvcuvid.dll"
,
],
help
=
"name(s) of installed target file. Used for patch "
"header"
)
"header"
)
parser
.
add_argument
(
"-P"
,
"--patch-name"
,
nargs
=
"+"
,
default
=
[
"nvcuvid64.1337"
,
"nvcuvid32.1337"
,
],
help
=
"relative filename(s) of generated patch(es)"
)
parser
.
add_argument
(
"-S"
,
"--search"
,
parser
.
add_argument
(
"-S"
,
"--search"
,
default
=
"FF909800000084C075"
,
nargs
=
"+"
,
help
=
"representation of search pattern binary string"
)
default
=
[
"FF909800000084C075"
,
"8B404CFFD084C075"
,
],
help
=
"representation of search pattern(s) binary string"
)
parser
.
add_argument
(
"-R"
,
"--replacement"
,
parser
.
add_argument
(
"-R"
,
"--replacement"
,
default
=
"FF90980000000C0175"
,
nargs
=
"+"
,
help
=
"representation of replacement binary string"
)
default
=
[
"FF90980000000C0175"
,
"8B404CFFD00C0175"
,
],
help
=
"representation of replacement(s) binary string"
)
parser
.
add_argument
(
"-o"
,
"--stdout"
,
parser
.
add_argument
(
"-o"
,
"--stdout"
,
action
=
"store_true"
,
action
=
"store_true"
,
help
=
"output into stdout"
)
help
=
"output into stdout"
)
...
@@ -147,6 +171,7 @@ def make_patch(archive, *,
...
@@ -147,6 +171,7 @@ def make_patch(archive, *,
return
res
return
res
@
functools
.
lru_cache
(
maxsize
=
None
)
def
identify_driver
(
archive
,
*
,
sevenzip
=
"7z"
):
def
identify_driver
(
archive
,
*
,
sevenzip
=
"7z"
):
manifest
=
extract_single_file
(
archive
,
"setup.cfg"
,
sevenzip
=
sevenzip
)
manifest
=
extract_single_file
(
archive
,
"setup.cfg"
,
sevenzip
=
sevenzip
)
root
=
ET
.
fromstring
(
manifest
)
root
=
ET
.
fromstring
(
manifest
)
...
@@ -162,53 +187,63 @@ def format_patch(diff, filename):
...
@@ -162,53 +187,63 @@ def format_patch(diff, filename):
res
+=
LINE_FORMAT
%
(
offset
+
OFFSET_ADJUSTMENT
,
left
,
right
)
res
+=
LINE_FORMAT
%
(
offset
+
OFFSET_ADJUSTMENT
,
left
,
right
)
return
res
return
res
def
patch_flow
(
installer_file
,
search
,
replacement
,
target
,
target_name
,
patch_name
,
*
,
def
main
():
direct
=
False
,
stdout
=
False
,
sevenzip
=
"7z"
):
args
=
parse_args
()
search
=
unhexlify
(
search
)
search
=
unhexlify
(
args
.
search
)
replacement
=
unhexlify
(
replacement
)
replacement
=
unhexlify
(
args
.
replacement
)
assert
len
(
search
)
==
len
(
replacement
),
"len() of search and replacement"
\
assert
len
(
search
)
==
len
(
replacement
),
"len() of search and replacement"
\
" is not equal"
" is not equal"
for
installer_file
in
args
.
installer_file
:
patch
=
make_patch
(
installer_file
,
patch
=
make_patch
(
installer_file
,
arch_tgt
=
target
,
arch_tgt
=
args
.
target
,
search
=
search
,
search
=
search
,
replacement
=
replacement
,
replacement
=
replacement
,
sevenzip
=
sevenzip
,
sevenzip
=
args
.
sevenzip
,
direct
=
direct
)
direct
=
args
.
direct
)
patch_content
=
format_patch
(
patch
,
target_name
)
patch_content
=
format_patch
(
patch
,
args
.
target_name
)
if
stdout
or
direct
:
if
args
.
stdout
or
args
.
direct
:
with
open
(
sys
.
stdout
.
fileno
(),
mode
=
'wb'
,
closefd
=
False
)
as
out
:
with
open
(
sys
.
stdout
.
fileno
(),
mode
=
'wb'
,
closefd
=
False
)
as
out
:
out
.
write
(
patch_content
)
out
.
write
(
patch_content
)
else
:
version
,
product_type
=
identify_driver
(
installer_file
,
sevenzip
=
sevenzip
)
drv_prefix
=
{
"100"
:
"quadro_"
,
"300"
:
""
,
"301"
:
"nsd_"
,
}
installer_name
=
os
.
path
.
basename
(
installer_file
)
.
lower
()
if
'winserv2008'
in
installer_name
:
os_prefix
=
'ws2012_x64'
elif
'winserv-2016'
in
installer_name
:
os_prefix
=
'ws2016_x64'
elif
'win10'
in
installer_name
:
os_prefix
=
'win10_x64'
elif
'win7'
in
installer_name
:
os_prefix
=
'win7_x64'
else
:
else
:
version
,
product_type
=
identify_driver
(
installer_file
,
raise
UnknownPlatformException
(
"Can't infer platform from filename
%
s"
sevenzip
=
args
.
sevenzip
)
%
(
repr
(
installer_name
),))
drv_prefix
=
{
driver_name
=
drv_prefix
[
product_type
]
+
version
"100"
:
"quadro_"
,
out_dir
=
os
.
path
.
join
(
"300"
:
""
,
os
.
path
.
dirname
(
"301"
:
"nsd_"
,
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
,
os_prefix
,
driver_name
)
}
os
.
makedirs
(
out_dir
,
0o755
,
True
)
installer_name
=
os
.
path
.
basename
(
installer_file
)
.
lower
()
out_filename
=
os
.
path
.
join
(
out_dir
,
if
'winserv2008'
in
installer_name
:
patch_name
)
os_prefix
=
'ws2012_x64'
with
open
(
out_filename
,
'xb'
)
as
out
:
elif
'winserv-2016'
in
installer_name
:
out
.
write
(
patch_content
)
os_prefix
=
'ws2016_x64'
elif
'win10'
in
installer_name
:
os_prefix
=
'win10_x64'
def
main
():
elif
'win7'
in
installer_name
:
args
=
parse_args
()
os_prefix
=
'win7_x64'
if
args
.
direct
:
else
:
combinations
=
zip
(
args
.
installer_file
,
args
.
search
,
args
.
replacement
,
raise
UnknownPlatformException
(
"Can't infer platform from filename
%
s"
args
.
target
,
args
.
target_name
,
args
.
patch_name
)
%
(
repr
(
installer_name
),))
else
:
driver_name
=
drv_prefix
[
product_type
]
+
version
base_params
=
zip
(
args
.
search
,
args
.
replacement
,
args
.
target
,
args
.
target_name
,
args
.
patch_name
)
out_dir
=
os
.
path
.
join
(
combinations
=
((
l
,)
+
r
for
l
,
r
in
itertools
.
product
(
args
.
installer_file
,
base_params
))
os
.
path
.
dirname
(
for
params
in
combinations
:
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
,
os_prefix
,
driver_name
)
patch_flow
(
*
params
,
direct
=
args
.
direct
,
stdout
=
args
.
stdout
)
os
.
makedirs
(
out_dir
,
0o755
,
True
)
out_filename
=
os
.
path
.
join
(
out_dir
,
os
.
path
.
splitext
(
args
.
target_name
)[
0
]
+
PATCH_EXT
)
with
open
(
out_filename
,
'xb'
)
as
out
:
out
.
write
(
patch_content
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
win/win10_x64/440.97/nvcuvid32.1337
0 → 100644
View file @
7688bf44
>nvcuvid.dll
00000000000E6109:84->0C
00000000000E610A:C0->01
\ No newline at end of file
win/win10_x64/440.97/nvcuvid.1337
→
win/win10_x64/440.97/nvcuvid
64
.1337
View file @
7688bf44
File moved
win/win10_x64/quadro_440.97/nvcuvid32.1337
0 → 100644
View file @
7688bf44
>nvcuvid.dll
00000000000E6109:84->0C
00000000000E610A:C0->01
\ No newline at end of file
win/win10_x64/quadro_440.97/nvcuvid.1337
→
win/win10_x64/quadro_440.97/nvcuvid
64
.1337
View file @
7688bf44
File moved
win/win7_x64/440.97/nvcuvid32.1337
0 → 100644
View file @
7688bf44
>nvcuvid.dll
00000000000D1ED9:84->0C
00000000000D1EDA:C0->01
\ No newline at end of file
win/win7_x64/440.97/nvcuvid.1337
→
win/win7_x64/440.97/nvcuvid
64
.1337
View file @
7688bf44
File moved
win/win7_x64/quadro_440.97/nvcuvid32.1337
0 → 100644
View file @
7688bf44
>nvcuvid.dll
00000000000D1ED9:84->0C
00000000000D1EDA:C0->01
\ No newline at end of file
win/win7_x64/quadro_440.97/nvcuvid.1337
→
win/win7_x64/quadro_440.97/nvcuvid
64
.1337
View file @
7688bf44
File moved
win/ws2012_x64/quadro_440.97/nvcuvid32.1337
0 → 100644
View file @
7688bf44
>nvcuvid.dll
00000000000D1ED9:84->0C
00000000000D1EDA:C0->01
\ No newline at end of file
win/ws2012_x64/quadro_440.97/nvcuvid.1337
→
win/ws2012_x64/quadro_440.97/nvcuvid
64
.1337
View file @
7688bf44
File moved
win/ws2016_x64/quadro_440.97/nvcuvid32.1337
0 → 100644
View file @
7688bf44
>nvcuvid.dll
00000000000E6109:84->0C
00000000000E610A:C0->01
\ No newline at end of file
win/ws2016_x64/quadro_440.97/nvcuvid.1337
→
win/ws2016_x64/quadro_440.97/nvcuvid
64
.1337
View file @
7688bf44
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