Error Strongly Naming DLL Without Source Code - windows

I'm attempting to take a DLL that is not strongly named and then strongly name it without needing to have the source code, since I will not always have the source code, only the DLL. When I try and run the batch file with the below code to accomplish this I get an error. Here is the code:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\ildasm.exe" .\targetFile.dll /out:.\Signed\targetFile.il
"C:\Windows\Microsoft.NET\Framework\v2.0.50727\ilasm.exe" .\Signed\targetFile.il /dll /key=.\targetFile.snk /output=.\Signed\targetFile.dll
The error I get is the following:
.\Signed\targetFile.il(43) : error -- Failed to extract public key: 0x80070005
I'm not sure what I'm missing, I have permissions to all involved folders including the MacnineKeys folder in ProgramData.

Related

Can't add Embree to my project, getting LNK1104 error

I'm trying to add Embree to an already working solution, following this resource I've added to my CMakeLists.txt file the following:
FIND_PACKAGE(embree 3.0 REQUIRED)
INCLUDE_DIRECTORIES(${EMBREE_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(application ${EMBREE_LIBRARY})
I've also created a Windows environment variable embree_DIR with my Embree installation folder ("C:\Program Files\Intel\Embree3 x64").
CMake configures the solution fine, but when I build I get a fatal error LNK1104: impossible to open 'embree3.lib'.
Just so you know, I actually have a C:\Program Files\Intel\Embree3 x64\lib\embree3.lib file.
Anyone has any clue why this might be happening?
Set EMBREE_ROOT_DIR e.g.:
set(EMBREE_ROOT_DIR "C:/thirdparty/vs2017/x64/embree-2.17.0")
Link to ${EMBREE_LIBRARIES}
target_link_libraries(YourApp
...
${EMBREE_LIBRARIES}
...
)

Windows Driver build - incorrect path passed to Inf2Cat.exe

I'm new to the subject of windows drivers. I'm trying to build one of the Windows-driver-samples in Visual Studio 2015. The compilation and linking steps pass without errors and then I get the following error:
TRACKER : error TRK0002: Failed to execute command:
""C:\Program Files (x86)\Windows Kits\10\bin\x86\inf2cat.exe"
/os:10_x64 /driver:x64\Debug\WFPSamplerCalloutDriver\".
The operation identifier is not valid.
(Note the relative path in /driver argument). If I call Inf2Cat manually from command prompt with full path to the driver, it passes without a hitch:
C:\Program Files (x86)\Windows Kits\10\bin\x86>Inf2Cat.exe /os:10_x64
/driver:C:\Users\****\Windows-driver-samples\network\trans\WFPSampler\sys\x64\Debug\W
FPSamplerCalloutDriver
...........................
Signability test complete.
Errors:
None
Warnings:
None
Catalog generation complete.
C:\Users\****\Windows-driver-samples\network\trans\WFPSampler\sys\x64\Debug
\WFPSamplerCalloutDriver\wfpsamplercalloutdriver.cat
So, it seems to me that VS somehow failed to provide the full path to the driver in the argument to Inf2Cat.
How can I fix this? Which configuration property of my project is incorrect?
Description
Seems Inf2Cat from SDK10 does not accept directory path format provided by VS Project Configurator. Works when: either output folder name has with no trailing "\" or folder name ends up with "\.".
Workaroud
Disable Inf2Cat under Project Preferences: Run Inf2Cat -> No
Configure build events under Build-Events->Post Build-Event: Command Line -> "$(WindowsSdkDir)bin\$(DDKPlatform)\inf2cat.exe" /os:10_$(DDKPlatform) /driver:"$(ProjectDir)$(IntDir)$(MSBuildProjectName)"

visual studio 2015 c++ sddl.h does not appear as external dependency

I am trying to use the function ConvertSidToStringSid() in a Visual Studio 2015 Community, console project.
According to the msdn page
https://msdn.microsoft.com/en-us/library/windows/desktop/aa376399(v=vs.85).aspx
the requirements are:
Minimum supported client: Windows XP [desktop apps only]
Minimum supported server: Windows Server 2003 [desktop apps only]
Header: sddl.h
Library: Advapi32.lib
DLL: Advapi32.dll
I am using a Windows 10 Home, 64-bit computer. I have the *.lib and *.dll files respectively in :
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x64\AdvAPI32.Lib
C:\Windows\System32\advapi32.dll
When i fill in the "#inclucde " in stdafx.h, I get no error from Intellisense. In contrast, "#include <blah.h>" gives a red wiggling underline under the 'include', and a mouse-over says 'Error: Cannot open source file "blah.h"'.
In my .cpp source file, which includes "stdafx.h", I add the code
BOOL OK ... ;
PSID owner;
char *sOwner;
OK = ConvertSidToStringSidW(owner, sOwner);
but then I get the red wiggle under ConvertSidToStringSidW.
In the solution explorer, under the project, under External dependencies there are files SCardErr.h and sdkddkver.h, but nothing, no sddl.h, between these two. (And, by the way, sddkver.h defines _WIN32_WINNT_THRESHOLD 0x0A00. Testing with IntelliSense in the editor, _WIN32_WINNT is also 0x0A00.)
When compiling, I first got an error message that the file sddl.h could not be found. I have multiple copies on the computer, and added to the "Additional include directories" for all configurations, the directory
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\shared
Compiling still fails with "identifier xxx is undefined" and 'xxx': Identifier not found, from IntelliSense and Build respectively.
The header sddl.h is still not in the external dependencies. Right-clicking on the sdksddkver.h I get its full path: The newly added additional include directory. I don't know what it was before I added this include directory.
Right clicking on the include directive in stdafx.h, I can open sddl.h. The editor shows parts of the contents in a light grey color, when the contents is guarded by an #if/#ifdef directive whose argument is false. However, the function I want to use, ConvertSidToStringSid, is shown in full color.
Unsure if its a clue that the error messages say "defined" rather than "declared". In the project properties, linker, input, additional dependencies, the file advapi32.lib is listed.
What am I doing wrong?
I found the solution myself. The problem was that I had two projects in the same "solution", each with its own stdafx.h file. I had the wrong stdafx.h file open in the editor, and placed the #include directive in the wrong file.
-Thanks

Inf2Cat Error 22.9.12 - INF cannot be copied to %Windir%

I am making a driver official for Windows 7 as it it unsigned and the process to disable things to make the unsigned driver work is much more hassle then to actually sign the driver.
Well, in order to sign the driver, first I need to make the catalog file for the driver using the latest Inf2Cat from the Windows Driver Development Kit, all is going really well and there are no warnings but there is one error -
C:\Users\User\Downloads\dsdriv\dsdriv>"C:\Program Files (x86)\Windows Kits\8.1\bin\x86\Inf2Cat.exe" /driver:C:\Users\Support\Downloads\dsdriv\dsdriv /os:XP_X64,Server2003_X64,Vista_X64,
7_X64
................................
Signability test failed.
Errors:
22.9.12: INF file (\driver.inf) cannot be copied to %windir%\inf.
Warnings:
None
I've look around Google and I found results of where people have has similar errors but the solution was not explained, then I tried to use the Chkinf.bat utility that comes with the kit to help me find the error with the INF file but I came across a very strange error that the syntax of the command was incorrect, however I wrote the batch to check the INF file exactly to the Chkinf Documentation and yet it was still coming up with the syntax error, here is the bat that I compiled to check the driver.inf file -
"C:\Program Files (x86)\Windows Kits\8.1\Tools\x86\ChkInf\chkinf" "C:\Users\User\Downloads\dsdriv\dsdriv\driver.inf"
I also tried -
"C:\Program Files (x86)\Windows Kits\8.1\Tools\x86\ChkInf\chkinf.bat" "C:\Users\User\Downloads\dsdriv\dsdriv\driver.inf"
and -
"C:\Program Files (x86)\Windows Kits\8.1\Tools\x86\ChkInf\chkinf" C:\Users\User\Downloads\dsdriv\dsdriv\driver.inf /L results.txt /B /LO
but no use.
The ChkInf may not be present in any of the above directories. It is shipped along the WinDDK.
You can find it exactly at
WinDDK_InstalledPath\Version_of_WinDDK\tools\Chkinf\chkinf.bat
The issue could be due to the [SourceDisksFiles] containing INF copy directives

OpenCV and VisualStudio 2010 dll problems

Hi everyone I would like to try the openCV library but I have some problems setting up the environment.
From the property Manager I created a new sheet and set:
VC++ Directories :
- Include Directories: $(OPENCV_DIR)\build\x86\vc10\bin and $(OPENCV2_DIR)\build\include
- Library Directories: $(OPENCV2_DIR)\build\x86\vc10\lib;
C/C++ :
- Additional Includes Directories: $(OPENCV2_DIR)\include;
Linker:
opencv_calib3d244d.lib opencv_contrib244d.lib opencv_core244d.lib
opencv_features2d244d.lib opencv_flann244d.lib opencv_gpu244d.lib
opencv_haartraining_engined.lib opencv_highgui244d.lib
opencv_imgproc244d.lib opencv_legacy244d.lib opencv_ml244d.lib
opencv_nonfree244d.lib opencv_objdetect244d.lib opencv_photo244d.lib
opencv_stitching244d.lib opencv_ts244d.lib opencv_video244d.lib
opencv_videostab244d.lib
-Additional Library Directories: $(OPENCV2_DIR)\libs
I can compile but i can't execute the program because I get an error opencv_core242.dll is missing.
Where's my error? Thanks
"I get an error opencv_core242.dll is missing"
if you linked against the libs in opencv\build\x86\vc10\lib (your compiler/linker settings look ok),
you'll have to append
opencv\build\x86\vc10\bin
to your PATH environment variable, so your exe can find the dlls at runtime.

Resources