Closed kgv closed 2 years ago
Yep, I'd like to be able to generate these but a little concerned about the explosion in crate size. Will think about it some more.
out of interest, what size differences are we talking about, 20%, 100%, 500%?
Code size, build time, maintainability. All factors to consider. There are a lot of API functions in the windows
crate. I just have to try it and see how practical it is.
While this would be convenient for experimenting, I don't think there is enough demand for such a capability to warrant including all the extra generated code needed to make it happen.
I want to know how to convert the FARPROC type obtained from GetProcAddress to the HOOKPROC type.
Motivation
Generate types for api functions will be useful for dynamic exploration. For example when using
GetModuleHandleW
andGetProcAddress
.GetProcAddress
returnFARPROC
which we need to transmute into a function. To do this, we need to know the type of the function.Drawbacks
Perhaps there is some way to get function pointer type from function pointer. But I don't know this.
Rationale and alternatives
A similar macro solves the problem, but not for the case with static variable. For statics, you must explicitly specify the type.
Additional context
See func-types feature in ntapi (Implementation).