Since the lib file contains dll file information, the lib name is modified directly. When the linker performs linking, the content in the lib file does not change. The result is that the program still looks for the dll named after the original name when the program is running. file. So we directly modify the corresponding lib file and dll file name will cause the program can not find the dll file
Operating environment: wind10 + vs2015 + x64
Modification method: (Taking tensorflow_cc.dll to tensorflow.dll as an example)
- First export the contents of the dll through the dumpbin tool
DUMPBIN /path/tensorflow_cc.dll /EXPORTS /OUT:/path/tensorflow.def- Open tensorflow.def through a text editor, the content is as follows.
Dump of file D:\Project\SciDnnDll\DependencyDll\tensorflow_cc.dll
File Type: DLL
Section contains the following exports for tensorflow_cc.dll
00000000 characteristics
5DE87B88 time date stamp Thu Dec 5 11:37:44 2019
0.00 version
1 ordinal base
3131 number of functions
3131 number of names
ordinal hint RVA name
1 0 0304C6A0 ??$CreateMaybeMessage@VGPUOptions@tensorflow@@$$V@Arena@protobuf@google@@CAPEAVGPUOptions@tensorflow@@PEAV012@@Z
2 1 0307F3F0 ??$CreateMaybeMessage@VNodeDef@tensorflow@@$$V@Arena@protobuf@google@@CAPEAVNodeDef@tensorflow@@PEAV012@@Z
3 2 023EFF40 ??0?$MaybeStackArray@D$0CI@@icu_62@@AEAA@AEBV01@@Z
.
.
.
3130 C39 028FA770 utrie_unserializeDummy_62
3131 C3A 028FA900 utrie_unserialize_62
Summary
36A000 .data
1000 .gfids
1F8000 .pdata
1047000 .rdata
65000 .reloc
32E0000 .text
1000 .tls
11000 _RDATA
- Organize the files and get the following content (operating with python is simpler).
EXPORTS
??$CreateMaybeMessage@VGPUOptions@tensorflow@@$$V@Arena@protobuf@google@@CAPEAVGPUOptions@tensorflow@@PEAV012@@Z @1
??$CreateMaybeMessage@VNodeDef@tensorflow@@$$V@Arena@protobuf@google@@CAPEAVNodeDef@tensorflow@@PEAV012@@Z @2
??0?$MaybeStackArray@D$0CI@@icu_62@@AEAA@AEBV01@@Z @3
.
.
.
utrie_unserializeDummy_62 @3130
utrie_unserialize_62 @3131
- Use the vs tool lib to regenerate the renamed lib file (my machine is 64-bit)
LIB /DEF:/path/tensorflow.def /machine:X64 /OUT:/path/tensorflow.lib- After obtaining tensorflow.lib, then rename tensorflow_cc.dll to tensorflow.dll to complete the modification of the dll name.
Problems encountered during: LIBARY and other statements in the def file cannot be recognized by the LIB file (According to my guess, it may be due to different versions and references)
Reference materials:
https://blog.csdn.net/WL2002200/article/details/51418372/
http://suddymail.org/show-160-1.html
https://blog.csdn.net/b2292486308/article/details/53762806/
public void renameFile(String oldFile, String newFile) { HttpServletRequest request = ServletActionContext.getRequest(); String path = request.getSession().getServletCont...
Article Directory 1. Right, show in Finder, find the folder where the file 2. files from the folders in renaming 3. Place the project in the original file deleted 4. Rename the folder files back onto ...
On a public server, and sometimes there will be some file name is garbled file, the god of my colleagues do not know which engage in out ~ As an OCD patient, we must take its name changed back. Howeve...
Introduction of the desired module and get uploadPath files.projectFile.name file name with a suffix; files.projectFile.path relative file path where the project pathStr is assembled path To upload fi...
import os path = (‘D:\1\’) path2 = () Get all the files in that directory, the stored list f = os.listdir(path) j=391 n = 0 for i in f:...
modify the names of all files in the specified path, wherein the expression by leaving only positive numbers. from "ITPUB blog" link: http: //blog.itpub.net/31402262/viewspace-2286707/, For ...
Some time ago, I encountered a problem of modifying file names in batches, and took notes. Demo: before fixing: After modification:...
You cannot use a relative path to modify the file name. It must be an absolute path. For example, the current working directory is as follows, modify run.py to newrun.txt. First get the working path s...