Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem when compiling #34

Closed
HuntFrank opened this issue Dec 3, 2019 · 8 comments
Closed

problem when compiling #34

HuntFrank opened this issue Dec 3, 2019 · 8 comments

Comments

@HuntFrank
Copy link

i always get this error,i tried lots of ways,if i just copy this file to the project ,i will get more error.
error C1083 can't open: “capstone.h”: No such file or directory DdiMon C:\Users\hunter\Desktop\fdssd\DdiMon-master\DdiMon\shadow_hook.cpp 21

i do not know how to include this file ,can you help me

@tandasat
Copy link
Owner

tandasat commented Dec 3, 2019

Did you clone submodules?

git clone --recursive https://github.com/tandasat/DdiMon.git

@HuntFrank
Copy link
Author

when i did as you say,i got those errors and i have no idea where the problem is.my visual studio is 2019.can you help me?
error LNK2019 Unresolved external symbol _invoke_watson,The symbol in the function "protected: virtual void __cdecl stdext::bad_alloc::_Doraise(void)const " (?_Doraise@bad_alloc@stdext@@MEBAXXZ) Referenced DdiMon C:\Users\hunter\Desktop\myhv\new\DdiMon\DdiMon\shadow_hook.obj 1
error LNK2001 Unresolved external symbol "void (__cdecl* std::_Raise_handler)(class stdext::exception const &)" (?_Raise_handler@std@@3P6AXAEBVexception@stdext@@@ZEA) DdiMon C:\Users\hunter\Desktop\myhv\new\DdiMon\DdiMon\shadow_hook.obj 1

@tandasat
Copy link
Owner

tandasat commented Dec 4, 2019

It turned out that it is no longer possible to use the C standard library in the kernel mode with only _HAS_EXCEPTION 0 with VS 2019.

I was able to compile the project by adding those missing definitions. I do not know what the implication of this exactly but you can try and play with the project.

// in shadow_hook.cpp

////////////////////////////////////////////////////////////////////////////////
//
// implementations
//

EXTERN_C
_ACRTIMP void __cdecl _invoke_watson(
    _In_opt_z_ wchar_t const* _Expression,
    _In_opt_z_ wchar_t const* _FunctionName,
    _In_opt_z_ wchar_t const* _FileName,
    _In_       unsigned int _LineNo,
    _In_       uintptr_t _Reserved)
{
}

namespace std { _Prhand _Raise_handler; }

@HuntFrank
Copy link
Author

Thank you very much.I solved this error

@jlopezdan
Copy link

Hi @HuntFrank
Can you please described how did you sove it? (I am facing the same error)

@jlopezdan
Copy link

Nevermind. I wrongly added ucrtd library. Now it builds.

@uRDy
Copy link

uRDy commented Jan 2, 2023

LNK2001 "void (__cdecl* std::_Raise_handler)(class stdext::exception const &)" (?_Raise_handler@std@@3P6AXAEBVexception@stdext@@@ZEA).

How to fix it?

@rainerzufalldererste
Copy link

Since google appears to be pointing to this and there appears to be an issue with the latest Visual Studio version, I'm going to resurrect this issue. Sorry about that.

I was consistently able to resolve the issue by not using /std:latest but rather /std:c 20 (which to me is less limiting than having to enable exceptions and the problems exception handling can cause with the Address Sanitizer).

Hope this helps someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants