Comments (8)
Question answered -> thread closed :-)
from zydis.
Zydis itself does not use any kernel32.dll
functions. These imports are added by the compiler for different reasons. It's pretty hard to create a Windows binary without any reference to kernel32
.
In your case these functions are probably imported by the CRT which is statically linked to your output binary. To get rid of LibC, you have to enable the ZYAN_NO_LIBC
CMake option or pass the corresponding compiler flag by hand. That being said, there still might be some references to kernel32.dll
left after doing so.
May I ask why you are concerned about these imports?
from zydis.
Florian, thank you for the reply.
I did enable the ZYAN_NO_LIBC thinking that might be the reason why I was getting those kernel32 imports but, it made no difference.
My concern is just that I had read that Zydis had no dependencies, not even on libc which I think is great, consequently I didn't expect any kernel32 functions either.
Does what you stated above mean that Zydis does not really use any kernel32 functions but, for some reason the compiler just puts those imports in there even though they are not used ?
Just FYI, I simply compile the Zydis dll in VS2022 then I use dumpbin to dump the PE file. dumpbin shows that Zydis.dll imports functions from kernel32 even though the comp;ile was done with ZYAN_NO_LIBC enabled.
from zydis.
All mainstream compilers will automatically link libc unless explicitly told not to. With gcc/clang this is achieved with -ffreestanding -nostdlib
. Not sure how to do this with MSVC.
@ZehMatt @Mattiwatti maybe?
from zydis.
https://learn.microsoft.com/en-us/cpp/build/reference/nodefaultlib-ignore-libraries?view=msvc-170
Seems like you can use /NODEFAULTLIB
. Just pay attention to this remark:
If you use /NODEFAULTLIB to build your program without the C run-time library, you may also have to use the /ENTRY option to specify the entry-point function in your program. For more information, see CRT library features.
from zydis.
Thank you Florian. I had completely forgotten about /NODEFAULTLIB and I have reason to believe that might get rid of the kernel32 imports.
I disassembled Zydis.dll to find out where and why those kernel functions were being used and it is the C runtime that is using them (in hindsight, no surprise there.) I think a little "playing" with /NODEFAULTLIB might end up doing the trick.
I very much appreciate your help. Thank you again!
from zydis.
The question as to why those kernel32 functions are present has been answered.
Should I close this thread to reflect that this is not an issue ?
from zydis.
Yes -- let's close this here then. :)
from zydis.
Related Issues (20)
- Compile error in VS2019 HOT 2
- [HELP] OperandDefinitions.inc Need a C89 style define file. HOT 2
- Movabs not supported with ZydisDisassembleIntel HOT 4
- ATT: Missing parenthesis for absolute memory operands HOT 8
- Is there a separate function for Length disassembly in zydis? HOT 11
- Question about ZydisEncoderDecodedInstructionToEncoderRequest's operand_count parameter HOT 3
- Encoder generates wrong relative offset with bnd prefix
- Missing enum definitions in Documentation HOT 1
- Incorrect operand size with mov instruction HOT 3
- How to get operand address as a ZyanU64? HOT 5
- Encoder mishandles 16-bit address truncation behavior HOT 2
- Build failed: build zydis as a dynamic link library on MacOS HOT 4
- Encoder fails to enforce predicted instruction size in some scenarios
- Incorrect disassembly of push rdi HOT 2
- ZydisDecodedInstruction has ZYDIS_ATTRIB_IS_RELATIVE attribute when decoding absolute JMP HOT 3
- ZydisWinKernel.c 0xC0000428 HOT 3
- Add [in,out] hints to Doxygen parameter strings HOT 7
- undocumented/unintended ZYDIS_FORMATTER_FUNC_POST_OPERAND behavior HOT 6
- Amalgamated build should auto-define `ZYDIS_STATIC_BUILD` HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zydis.