You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While developing an EDR, I encountered an issue when working with kernel32.dll and user32.dll for inline hooking using the CreateFileW API. This is not the main problem, as my issue occurs during the build process.
Build started at 09.11 PM...
1>------ Build started: Project: ConsoleApplication1, Configuration: Debug x64 ------
1>ConsoleApplication1.cpp
1>LINK : fatal error LNK1104: cannot open file 'detours.lib'
1>Done building project "ConsoleApplication1.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 09.11 PM and took 01.273 seconds ==========
Does anyone have a solution for how to fix this issue?
The text was updated successfully, but these errors were encountered:
Hi, I'm not sure if you're still encountering this issue, but I've had similar ones before. Here's a general fix that I used.
I hope you're using Visual Studio 2022, as that's what I'm familiar with, but I believe the process for Visual Studio Code is gonna be similar.
In short, your console app isn't finding the static library you're trying to include.
If you're looking for a quick fix and you've already built Detours as a static library, insert the following line into your console app's source code. Replace 'X' with the full path to your built Detours static library, enclosed in a C-style quoted string. This instructs the compiler to include this library in the build.
#pragma comment (lib, "X")
I also recommend setting your solution to build Detours before your console app. In Visual Studio 2022, you can set build dependencies in the project menu for the project in question. This should get you back up and running.
A better long-term solution would be to learn some of the macros and set the library paths in your console app to find the Detours version you're using based on config (Debug/ Release). For instance, if Detours compiles and outputs to "$(SolutionDir)\builds\Detours$(Config)\x64", this could translate to "C:\repos\builds\Detours\Debug\x64" for the debug build and "C:\repos\builds\Detours\Release\x64" for the release build. In Visual Studio 2022, you would add the macro "$(SolutionDir)\builds\Detours$(Config)\x64" to the VC++ Directories in the list of directories to search. Visual Studio will expand it based on the configuration, ensuring that your console app's release version uses the release Detours DLL, and the debug version does the same.
While developing an EDR, I encountered an issue when working with kernel32.dll and user32.dll for inline hooking using the CreateFileW API. This is not the main problem, as my issue occurs during the build process.
Build started at 09.11 PM...
1>------ Build started: Project: ConsoleApplication1, Configuration: Debug x64 ------
1>ConsoleApplication1.cpp
1>LINK : fatal error LNK1104: cannot open file 'detours.lib'
1>Done building project "ConsoleApplication1.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 09.11 PM and took 01.273 seconds ==========
Does anyone have a solution for how to fix this issue?
The text was updated successfully, but these errors were encountered: