Why does LoadLibrary fail with error code 193? [duplicate] - c

I'm stuck as to why I can't load my dll "interfac" using LoadLibrary. It seems to be failing when loading a dependency but I'm not sure why.
Here's the code:
AfxMessageBox(L"before load library");
HMODULE interfacDll = LoadLibrary(TEXT("C:\\QA\\Pcdlrn\\Win32\\Release\\INTERFAC.DLL"));
if (!interfacDll)
DWORD dw = GetLastError(); // returns 0xc1 (193)
AfxMessageBox(L"after load library");
And here's the output from gflags (x86)'s loader snaps:
18a0:2a40 # 06858973 - LdrGetDllHandleEx - ENTER: DLL name: ntdll.dll DLL path: NULL
18a0:2a40 # 06858973 - LdrGetDllHandleEx - INFO: Locating DLL ntdll.dll in path C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows
18a0:2a40 # 06858989 - LdrpFindLoadedDll - ENTER: DLL name: ntdll.dll DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows
18a0:2a40 # 06858989 - LdrpFindLoadedDll - RETURN: Status: 0x00000000
18a0:2a40 # 06858989 - LdrGetDllHandleEx - RETURN: Status: 0x00000000
18a0:2a40 # 06858989 - LdrGetProcedureAddressEx - INFO: Locating procedure "KiUserExceptionDispatcher" by name
18a0:2a40 # 06858989 - LdrLoadDll - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\syste
18a0:2a40 # 06858989 - LdrpLoadDll - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\syst
18a0:2a40 # 06858989 - LdrpLoadDll - INFO: Loading DLL C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL from path C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\sys
18a0:2a40 # 06858989 - LdrpFindOrMapDll - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows
18a0:2a40 # 06858989 - LdrpSearchPath - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\s
18a0:2a40 # 06858989 - LdrpResolveFileName - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
18a0:2a40 # 06858989 - LdrpResolveFileName - RETURN: Status: 0x00000000
18a0:2a40 # 06858989 - LdrpResolveDllName - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
18a0:2a40 # 06858989 - LdrpResolveDllName - RETURN: Status: 0x00000000
18a0:2a40 # 06858989 - LdrpSearchPath - RETURN: Status: 0x00000000
18a0:2a40 # 06859036 - LdrpMapViewOfSection - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
'CNCServer.exe': Loaded 'C:\QA\Pcdlrn\Win32\Release\INTERFAC.dll', Symbols loaded.
18a0:2a40 # 06859098 - LdrpMapViewOfSection - RETURN: Status: 0x40000003
18a0:2a40 # 06859098 - LdrpRelocateImage - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
18a0:2a40 # 06859098 - LdrpProtectAndRelocateImage - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpRelocateImage - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpFindOrMapDll - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpHandleOneOldFormatImportDescriptor - INFO: DLL "C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL" imports "PCDLRN.exe"
18a0:2a40 # 06859098 - LdrpLoadImportModule - ENTER: DLL name: PCDLRN.exe DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\W
18a0:2a40 # 06859098 - LdrpFindOrMapDll - ENTER: DLL name: PCDLRN.exe DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windo
18a0:2a40 # 06859098 - LdrpFindKnownDll - ENTER: DLL name: PCDLRN.exe
18a0:2a40 # 06859098 - LdrpFindKnownDll - RETURN: Status: 0xc0000135
18a0:2a40 # 06859098 - LdrpSearchPath - ENTER: DLL name: PCDLRN.exe DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows
18a0:2a40 # 06859098 - LdrpResolveFileName - ENTER: DLL name: C:\QA\Pcdlrn\CNCSERVER\Win32\Release\PCDLRN.exe
18a0:2a40 # 06859098 - LdrpResolveFileName - RETURN: Status: 0xc0000135
18a0:2a40 # 06859098 - LdrpResolveFileName - ENTER: DLL name: C:\Windows\system32\PCDLRN.exe
18a0:2a40 # 06859098 - LdrpResolveFileName - RETURN: Status: 0xc0000135
18a0:2a40 # 06859098 - LdrpResolveFileName - ENTER: DLL name: C:\Windows\system\PCDLRN.exe
18a0:2a40 # 06859098 - LdrpResolveFileName - RETURN: Status: 0xc0000135
18a0:2a40 # 06859098 - LdrpResolveFileName - ENTER: DLL name: C:\Windows\PCDLRN.exe
18a0:2a40 # 06859098 - LdrpResolveFileName - RETURN: Status: 0xc0000135
18a0:2a40 # 06859098 - LdrpResolveFileName - ENTER: DLL name: .\PCDLRN.exe
18a0:2a40 # 06859098 - LdrpResolveFileName - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpResolveDllName - ENTER: DLL name: .\PCDLRN.exe
18a0:2a40 # 06859098 - LdrpResolveDllName - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpSearchPath - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpMapViewOfSection - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\PCDLRN.exe
'CNCServer.exe': Loaded 'C:\QA\Pcdlrn\Win32\Release\PCDLRN.exe', Symbols loaded.
18a0:2a40 # 06859597 - LdrpMapViewOfSection - RETURN: Status: 0x40000003
'CNCServer.exe': Unloaded 'C:\QA\Pcdlrn\Win32\Release\PCDLRN.exe'
18a0:2a40 # 06859597 - LdrpFindOrMapDll - RETURN: Status: 0xc000007b
18a0:2a40 # 06859597 - LdrpLoadImportModule - ERROR: Loading DLL PCDLRN.exe from path C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:
18a0:2a40 # 06859597 - LdrpLoadImportModule - RETURN: Status: 0xc000007b
18a0:2a40 # 06859597 - LdrpHandleOneOldFormatImportDescriptor - ERROR: Loading "?????" from the import table of DLL "C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL" failed with status 0xc000007b
18a0:2a40 # 06859613 - LdrpUnloadDll - INFO: Unmapping DLL "C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL"
'CNCServer.exe': Unloaded 'C:\QA\Pcdlrn\Win32\Release\INTERFAC.dll'
18a0:2a40 # 06859613 - LdrpLoadDll - RETURN: Status: 0xc000007b
18a0:2a40 # 06859613 - LdrLoadDll - RETURN: Status: 0xc000007b
I should mention that I am using 64-bit windows but all my executable code is either targeted to x86 (c#) or win32 (c++).
How do I resolve this issue?
Any suggestions would be greatly appreciated.
Thank you very much.
p.s. Here's the dependency walker output:
p.p.s. here's a screenshot showing that my DLLs are x86:
p.p.p.s. here's the linker inputs for interfac.dll:
Edit. Here's the output of dumpbin:
Microsoft (R) COFF/PE Dumper Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file pcdlrn.exe
File Type: EXECUTABLE IMAGE
Section contains the following exports for PCDLRN.exe
00000000 characteristics
5796AD2A time date stamp Mon Jul 25 20:22:02 2016
0.00 version
1 ordinal base
5784 number of functions
5784 number of names
ordinal hint RVA name
1 0 0029CDF0 ??0?$CArray#V?$CStringT#_WV?$StrTraitMFC_DLL#_WV?$ChTraitsCRT#_W#ATL#####ATL##V12###QAE#XZ = ??0?$CArray#V?$CStringT#_WV?$StrTraitMFC_DLL#_WV?$ChTraitsCRT#_W#ATL#####ATL##V12###QAE#XZ (public: __thiscall CArray<class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >,class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > >::CArray<class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >,class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > >(void))
...
5783 1696 02593550 ?zoomOutFine#VisionTargetControls#UIEvents##YAXXZ = ?zoomOutFine#VisionTargetControls#UIEvents##YAXXZ (void __cdecl UIEvents::VisionTargetControls::zoomOutFine(void))
5784 1697 02593640 ?zoomOutMaximum#VisionTargetControls#UIEvents##YAXXZ = ?zoomOutMaximum#VisionTargetControls#UIEvents##YAXXZ (void __cdecl UIEvents::VisionTargetControls::zoomOutMaximum(void))
Summary
2C0000 .data
1000 .fnp_dir
1000 .fnp_mar
AFA000 .rdata
1B000 .rsrc
2E7A000 .text
E5000 .textidx
1000 .tls

One likely explanation for the ERROR_BAD_EXE_FORMAT error from LoadLibrary is that INTERFAC.DLL was linked with a PCDLRN.LIB import library that declares PCDLRN exports, but the PCDLRN.EXE found at runtime does not have an exports table.
The gflags (x86)'s loader snaps shows that the error is triggered while loading PCDLRN.EXE, specifically while resolving the import table of INTERFAC.DLL:
18a0:2a40 # 06859098 - LdrpHandleOneOldFormatImportDescriptor - INFO: DLL "C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL" imports "PCDLRN.exe"
[...]
18a0:2a40 # 06859597 - LdrpHandleOneOldFormatImportDescriptor - ERROR: Loading "?????" from the import table of DLL "C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL" failed with status 0xc000007b
Status 0xc000007b is STATUS_INVALID_IMAGE_FORMAT:
{Bad Image} %hs is either not designed to run on Windows or it contains an error. Try installing the program again using the original installation media or contact your system administrator or the software vendor for support.
NTSTATUS STATUS_INVALID_IMAGE_FORMAT is mapped to Win32 error code ERROR_BAD_EXE_FORMAT per INFO: Mapping NT Status Error Codes to Win32 Error Codes.
I was able to duplicate the same ERROR_BAD_EXE_FORMAT with a mockup of the given scenario: link INTERFAC.DLL to a PCDLRN.LIB that declares an exported foo, then substitute a PCDLRN.EXE without an exports table, and finally attempt to LoadLibrary INTERFAC.DLL.
As a side note, linking a DLL to the import library of another EXE is uncommon and fraught with pitfalls. In the case here, even if error 193 is fixed, the functions in the EXE would not be directly usable from the DLL. See for example Load EXE as DLL: Mission Possible for more details.

Edit: Though what follows makes sense it is actually incorrect. I'm keeping it here just for reference, but I may delete the answer later.
Note however that (at least on Windows 10, which I used to check) even if relocation information is available in the file, if the module is not a DLL it is not applied, so even if you didn't get that error, unless your INTERFAC.DLL applies relocations to PCLDRN.exe after loading it, trying to use it is likely to break somewhere along the way.
With the loader snaps output the situation seems pretty obvious to me.
The loader snaps output once the file is found are (I numbered the lines):
(1) 18a0:2a40 # 06859098 - LdrpMapViewOfSection - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\PCDLRN.exe
(2) 'CNCServer.exe': Loaded 'C:\QA\Pcdlrn\Win32\Release\PCDLRN.exe', Symbols loaded.
(3) 18a0:2a40 # 06859597 - LdrpMapViewOfSection - RETURN: Status: 0x40000003
(4) 'CNCServer.exe': Unloaded 'C:\QA\Pcdlrn\Win32\Release\PCDLRN.exe'
(5) 18a0:2a40 # 06859597 - LdrpFindOrMapDll - RETURN: Status: 0xc000007b
(6) 18a0:2a40 # 06859597 - LdrpLoadImportModule - ERROR: Loading DLL PCDLRN.exe from path C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:
(7) 18a0:2a40 # 06859597 - LdrpLoadImportModule - RETURN: Status: 0xc000007b
(8) 18a0:2a40 # 06859597 - LdrpHandleOneOldFormatImportDescriptor - ERROR: Loading "?????" from the import table of DLL "C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL" failed with status 0xc000007b
(9) 18a0:2a40 # 06859613 - LdrpUnloadDll - INFO: Unmapping DLL "C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL"
(10) 'CNCServer.exe': Unloaded 'C:\QA\Pcdlrn\Win32\Release\INTERFAC.dll'
(11) 18a0:2a40 # 06859613 - LdrpLoadDll - RETURN: Status: 0xc000007b
(12) 18a0:2a40 # 06859613 - LdrLoadDll - RETURN: Status: 0xc000007b
LdrpMapViewOfSection returns an error code (0x40000003) on line 3 which causes the module to unload (line 4) and then LdrpMapViewOfSection's caller - LdrpFindOrMapDll - translates the error code to 0xc000007b (STATUS_INVALID_IMAGE_FORMAT).
But the error that caused the load to fail was 0x40000003 - STATUS_IMAGE_NOT_AT_BASE. The description of this NTSTATUS is:
{Image Relocated} An image file could not be mapped at the address that is specified in the image file. Local fixes must be performed on this image.
(Source: NTSTATUS Values)
By default, EXEs don't contain relocation information (as was mentioned in the comments). Usually that's not a problem as the address space is rather free when the EXE is loaded into it. But your address space isn't free. To make matters worse, all EXEs compiled by Visual C++ share the same base address by default:
The /BASE option sets a base address for the program, overriding the default location for an .exe or DLL file. The default base address for an .exe file is 0x400000 for 32-bit images or 0x140000000 for 64-bit images. For a DLL, the default base address is 0x10000000 for 32-bit images or 0x180000000 for 64-bit images.
(Source: Linker Options: /BASE (Base Address))
That's probably the situation you have. CNCServer.exe already occupies 0x400000 and that's the only place PCDLRN.exe can go. LdrpMapViewOfSection can't map PCDLRN.exe to 0x400000 because it isn't free and fails to map in anywhere else because there's no relocation information.
And from there it goes up the call stack and changes the error, but not the underlying problem. Which is lack of relocation information.
You can see what happened when this error is encountered for a DLL with relocation information in your output too. When INTERFAC.dll is initially loaded:
18a0:2a40 # 06858989 - LdrpFindOrMapDll - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows
18a0:2a40 # 06858989 - LdrpSearchPath - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\s
18a0:2a40 # 06858989 - LdrpResolveFileName - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
18a0:2a40 # 06858989 - LdrpResolveFileName - RETURN: Status: 0x00000000
18a0:2a40 # 06858989 - LdrpResolveDllName - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
18a0:2a40 # 06858989 - LdrpResolveDllName - RETURN: Status: 0x00000000
18a0:2a40 # 06858989 - LdrpSearchPath - RETURN: Status: 0x00000000
18a0:2a40 # 06859036 - LdrpMapViewOfSection - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
'CNCServer.exe': Loaded 'C:\QA\Pcdlrn\Win32\Release\INTERFAC.dll', Symbols loaded.
18a0:2a40 # 06859098 - LdrpMapViewOfSection - RETURN: Status: 0x40000003
18a0:2a40 # 06859098 - LdrpRelocateImage - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
18a0:2a40 # 06859098 - LdrpProtectAndRelocateImage - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpRelocateImage - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpFindOrMapDll - RETURN: Status: 0x00000000
When LdrpMapViewOfSection returns STATUS_IMAGE_NOT_AT_BASE, it's caller (LdrpFindOrMapDll) goes ahead and calls LdrpRelocateImage, something it apparently can't to for PCDLRN.exe.

Related

Raspberry Pi Pico - setting up for C on Windows, but I can't build my own projects

I'm on Windows 10, and I installed the toolchain by following chapter 8.2 of the getting-started-with-pico.pdf file. I created the test-project by following chapter 7 of the same PDF file.
Contents of my project folder
CMakeLists.txt
cmake_minimum_required(VERSION 3.12)
include(pico_sdk_import.cmake)
project(test_project)
pico_sdk_init()
add_executable(test test.c)
pico_enable_stdio_usb(test 1)
pico_enable_stdio_uart(test 1)
pico_sdk_import.cmake
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
# This can be dropped into an external project to help locate this SDK
# It should be include()ed prior to project()
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
endif ()
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
endif ()
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
endif ()
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the PICO SDK")
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO SDK from git if not otherwise locatable")
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
if (NOT PICO_SDK_PATH)
if (PICO_SDK_FETCH_FROM_GIT)
include(FetchContent)
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
if (PICO_SDK_FETCH_FROM_GIT_PATH)
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
endif ()
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
)
if (NOT pico_sdk)
message("Downloading PICO SDK")
FetchContent_Populate(pico_sdk)
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
endif ()
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
else ()
message(FATAL_ERROR
"PICO SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
)
endif ()
endif ()
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
if (NOT EXISTS ${PICO_SDK_PATH})
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
endif ()
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the PICO SDK")
endif ()
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the PICO SDK" FORCE)
include(${PICO_SDK_INIT_CMAKE_FILE})
File test.c
#include <stdio.h>
#include "pico/stdlib.h"
#include "hardware/gpio.h"
#include "pico/binary_info.h"
const uint LED_PIN=25;
int main() {
bi_decl(bi_program_description("This is a test binary."));
bi_decl(bi_1pin_with_name(LED_PIN,"On-board LED"));
stdio_init_all();
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);
while(1) {
gpio_put(LED_PIN, 0);
sleep_ms(250);
gpio_put(LED_PIN,1);
puts("Hello World\n");
sleep_ms(1000);
}
}
Error
So when I run these same commands in my pico-examples folder it works completely fine.
C:\Users\bensl\Desktop\Electronics\Pico\test_project>mkdir build
C:\Users\bensl\Desktop\Electronics\Pico\test_project>cd build
C:\Users\bensl\Desktop\Electronics\Pico\test_project\build>cmake -G "NMake Makefiles" ..
Pico SDK is located at C:/Users/bensl/Desktop/Electronics/Pico/pico-sdk
PICO platform is rp2040.
PICO compiler is
PICO_GCC_TRIPLE defaulted to arm-none-eabi
PICO target board is pico.
Using board configuration from C:/Users/bensl/Desktop/Electronics/Pico/pico-sdk/src/boards/include/boards/pico.h
TinyUSB available at C:/Users/bensl/Desktop/Electronics/Pico/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; adding USB support.
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
ELF2UF2 will need to be built
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/bensl/Desktop/Electronics/Pico/test_project/build
C:\Users\bensl\Desktop\Electronics\Pico\test_project\build>nmake
Microsoft (R) Program Maintenance Utility Version 14.28.29336.0
Copyright (C) Microsoft Corporation. All rights reserved.
[ 1%] Performing configure step for 'ELF2UF2Build'
-- The C compiler identification is MSVC 19.28.29336.0
-- The CXX compiler identification is MSVC 19.28.29336.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.19/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/bensl/Desktop/Electronics/Pico/test_project/build/elf2uf2/CMakeFiles/CMakeTmp
Run Build Command(s):nmake /nologo cmTC_bce2f\fast && "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64\nmake.exe" -f CMakeFiles\cmTC_bce2f.dir\build.make /nologo -L CMakeFiles\cmTC_bce2f.dir\build
Building C object CMakeFiles/cmTC_bce2f.dir/testCCompiler.c.obj
C:\PROGRA~2\MICROS~1\2019\BUILDT~1\VC\Tools\MSVC\1428~1.293\bin\Hostx64\x64\cl.exe #C:\Users\bensl\AppData\Local\Temp\nm3FF1.tmp
testCCompiler.c
Linking C executable cmTC_bce2f.exe
"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_bce2f.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x86\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x86\mt.exe --manifests -- C:\PROGRA~2\MICROS~1\2019\BUILDT~1\VC\Tools\MSVC\1428~1.293\bin\Hostx64\x64\link.exe /nologo #CMakeFiles\cmTC_bce2f.dir\objects1.rsp #C:\Users\bensl\AppData\Local\Temp\nm407E.tmp
LINK Pass 1: command "C:\PROGRA~2\MICROS~1\2019\BUILDT~1\VC\Tools\MSVC\1428~1.293\bin\Hostx64\x64\link.exe /nologo #CMakeFiles\cmTC_bce2f.dir\objects1.rsp /out:cmTC_bce2f.exe /implib:cmTC_bce2f.lib /pdb:C:\Users\bensl\Desktop\Electronics\Pico\test_project\build\elf2uf2\CMakeFiles\CMakeTmp\cmTC_bce2f.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_bce2f.dir/intermediate.manifest CMakeFiles\cmTC_bce2f.dir/manifest.res" failed (exit code 1104) with the following output:
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64\nmake.exe"' : return code '0x2'
Stop.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/bensl/Desktop/Electronics/Pico/test_project/build/elf2uf2/CMakeFiles/CMakeOutput.log".
See also "C:/Users/bensl/Desktop/Electronics/Pico/test_project/build/elf2uf2/CMakeFiles/CMakeError.log".
NMAKE : fatal error U1077: 'echo' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64\nmake.exe"' : return code '0x2'
Stop.
I had the same problem. Then, I used cmake -G "MinGW Makefiles" .. instead. It worked for me. But for build I used nmake.
Note: MinGW GCC must be installed in your device
You should have two compilers. One cross compiler for the target and another one for the Windows host. The Windows compiler is needed to compile for example elf2uf2.exe.
The problem is here:
-- The C compiler identification is MSVC 19.28.29336.0
The compiler should be arm_none_eabi_gcc. I have the same problem, but I don't know how to change this yet.

Archiving react-native project fails with `_RCTCxxBridge` error

I tried a number of solutions I found on the web without any luck. I want to archive a react-native project but it keeps failing with this error
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_RCTCxxBridge", referenced from:
objc-class-ref in libReact.a(RCTBridge.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here is my podfile
rn_path = '../node_modules/react-native'
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
pod 'React', path: rn_path, subspecs: [
'BatchedBridge',
'CxxBridge',
'DevSupport',
'RCTText',
'RCTImage',
'RCTNetwork',
'Core',
'RCTWebSocket',
]
# 'Core',
# 'CxxBridge',
# 'BatchedBridge',
# 'DevSupport',
# 'RCTActionSheet',
# 'RCTAnimation',
# 'RCTGeolocation',
# 'RCTImage',
# 'RCTLinkingIOS',
# 'RCTNetwork',
# 'RCTSettings',
# 'RCTText',
# 'RCTVibration',
# 'RCTWebSocket',
The commented libraries were the one I tried to use at first and on searching I commented it and replaced it with the one that are there.
Here is the link binary with libraries list:
react-native version : 0.58.1
xcode version : 10.2

Statically linking IUP with Visual Studio

I have downloaded the IUP iup-3.25_Win64_vc15_lib.zip (the latest x64 bit VS version they provided) file and have extracted it to my project (in a sub folder called Library). I am trying to compile the following:
#include "Librarty/include/iup.h"
int main(int argc, char **argv) {
IupOpen(&argc, &argv);
IupMessage("TEST", "Test App");
IupClose();
return 0;
}
I have added the path to the header files by selecting
Project > Properties > Additional Include Libraries > File path
It is set to Library/include
Next I have added the .lib files by:
Project > Properties > Linker > Additional Library Dictionaries
The method taken from this answer.
Finally I added the .rc file by:
Under Solutions Explorer > Project Name > Add Existing Item > Given File Path
Set that to Library/ext/iup.rc
I then tried to compile my project and got the following error (I have set the compiler to x64 release):
1>------ Build started: Project: IUP, Configuration: Release x64 ------
1>main.c
1>main.obj : error LNK2001: unresolved external symbol IupOpen
1>main.obj : error LNK2001: unresolved external symbol IupMessage
1>main.obj : error LNK2001: unresolved external symbol IupClose
1>C:\Users\Simon\Desktop\Learn\IUP\x64\Release\IUP.exe : fatal error LNK1120: 3 unresolved externals
1>Done building project "IUP.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What do I need to do to get it to build?
Project Path:
C:\Users\Simon\Desktop\Learn\IUP\
IUP library:
C:\Users\Simon\Desktop\Learn\IUP\Library
EDIT: complete linker:
/OUT:"C:\Users\Simon\Desktop\Learn\IUP\x64\Release\IUP.exe" /MANIFEST /LTCG:incremental /NXCOMPAT /PDB:"C:\Users\Simon\Desktop\Learn\IUP\x64\Release\IUP.pdb" /DYNAMICBASE "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG:FULL /MACHINE:X64 /OPT:REF /PGD:"C:\Users\Simon\Desktop\Learn\IUP\x64\Release\IUP.pgd" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Release\IUP.exe.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"C:\Users\Simon\Desktop\Learn\IUP\Librarty" /TLBID:1

How can I manually specify source files that Ceedling fails to pick up?

I'm developing a feature for an embedded application and I'm using Ceedling (which builds on top of the Unity test framework) to test it. An issue that I'm having is that I need to use functionality in C source files that Ceedling isn't compiling/linking with my unit test files.
According to the Ceedling documentation:
Ceedling knows what files to compile and link into each individual
test executable by way of the #include list contained in each test
file. Any C source files in the configured search directories that
correspond to the header files included in a test file will be
compiled and linked into the resulting test fixture executable.
The problem is that I'm including a header file "RTOS.h" in my unit tests to get access to embOS RTOS functions, but these functions are defined in "RTOSInit.c" and "os7m_tl__dp.a", and according to this documentation Ceedling will only look for "RTOS.c" when it sees #include "RTOS.h" in the unit test code.
What I'm looking for is a way to manually specify that these additional files should be compiled and linked when generating the test runner executable. This seems like a very basic requirement of Ceedling but I can't see a way to do this from the documentation.
I have also raised this as an issue on the Ceedling Github site.
For reference, my current "project.yml" file (used by Ceedling) is given below:
:project:
:use_exceptions: FALSE
:use_test_preprocessor: FALSE
:use_auxiliary_dependencies: TRUE
:build_root: build
:release_build: FALSE
:test_file_prefix: test_
:environment:
- :path:
- 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\bin'
- 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\common\bin'
- #{ENV['PATH']}
:extension:
:executable: .out
:paths:
:test:
- +:test/**
- -:test/support
:source:
- src/main/c/**
- src/main/include/**
- src/main/resources/**
:support:
- test/support
:defines:
:commmon: &common_defines []
:test:
- *common_defines
- TEST
:test_preprocess:
- *common_defines
- TEST
:cmock:
:mock_prefix: mock_
:when_no_prototypes: :warn
:enforce_strict_ordering: TRUE
:plugins:
- :ignore
- :callback
:treat_as:
uint8: HEX8
uint16: HEX16
uint32: UINT32
int8: INT8
bool: UINT8
:tools:
:test_compiler:
:executable: iccarm
:name: 'IAR test compiler'
:arguments:
- -D _DLIB_FILE_DESCRIPTOR=1
- --debug
- --endian=little
- --cpu=Cortex-M3
- -e
- --fpu=None
- -Ol
- --preprocess "${3}"
- --dlib_config "C:/Program Files (x86)/IAR Systems/Embedded Workbench 6.5/arm/INC/c/DLib_Config_Normal.h"
- -I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE
- -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR
- -o "${2}"
- --diag_suppress=Pa050
- '"${1}"'
:test_linker:
:executable: ilinkarm
:name: 'IAR test linker'
:arguments:
- --vfe
- --redirect _Printf=_PrintfFull
- --redirect _Scanf=_ScanfFull
- --semihosting
- --config "C:/Program Files (x86)/IAR Systems/Embedded Workbench 6.5/arm/config/generic_cortex.icf"
- --map "${3}"
- -o "${2}"
- '"${1}"'
:test_fixture:
:executable: cspybat
:name: 'CSpyBat test runner'
:arguments:
- '"C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\bin\armproc.dll"'
- '"C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\bin\armsim2.dll"'
- '"${1}"'
- --plugin "C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\bin\armbat.dll"
- --backend -B
- --endian=little
- --cpu=Cortex-M3
- --fpu=None
- --semihosting
:plugins:
:load_paths:
- vendor/ceedling/plugins
:enabled:
- stdout_pretty_tests_report
- module_generator
...
I had the same problem and used empty header files to force Ceedling compile corresponding source files. Fortunately, a new macro has been added in Unity that solves the issue. Just add something similar at the top of your test files:
TEST_FILE("source_file_to_compile.c")

windbg symbol files unable to resolve

My executable is setup.exe, I have a pdb file named setup.pdb in the same directory c:\ade\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\disk1
My symbol file path is this
cache*c:\symbols;srv*https://msdl.microsoft.com/download/symbols;c:\ade\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\disk1
When I reload using this
.reload /f
I can see this error :
SYMSRV: c:\symbols\image00000001`3f6b0000.dbg\574587D664000\image00000001`3f6b0000.dbg not found
SYMSRV: c:\symbols\image00000001`3f6b0000.dbg\574587D664000\image00000001`3f6b0000.dbg not found
SYMSRV: https://msdl.microsoft.com/download/symbols/image00000001`3f6b0000.dbg/574587D664000/image00000001`3f6b0000.dbg not found
DBGHELP: c:\ade\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\disk1\install\image00000001`3f6b0000.dbg - file not found
DBGHELP: c:\ade\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\disk1\install\.exe\image00000001`3f6b0000.dbg - path not found
DBGHELP: c:\ade\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\disk1\install\symbols\.exe\image00000001`3f6b0000.dbg - path not found
DBGHELP: c:\ade\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\disk1\install\setup.pdb\image00000001`3f6b0000.dbg - path not found
DBGHELP: c:\ade\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\disk1\install\setup.pdb\.exe\image00000001`3f6b0000.dbg - path not found
DBGHELP: c:\ade\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\disk1\install\setup.pdb\symbols\.exe\image00000001`3f6b0000.dbg - path not found
DBGHELP: C:\ADE\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\Disk1\install\image00000001`3f6b0000.dbg - file not found
DBGHELP: C:\ADE\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\Disk1\install\.exe\image00000001`3f6b0000.dbg - path not found
DBGHELP: C:\ADE\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\Disk1\install\symbols\.exe\image00000001`3f6b0000.dbg - path not found
DBGHELP: image00000001`3f6b0000 missing debug info. Searching for pdb anyway
DBGHELP: Can't use symbol server for image00000001`3f6b0000.pdb - no header information available
DBGHELP: c:\ade\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\disk1\install\image00000001`3f6b0000.pdb - file not found
DBGHELP: c:\ade\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\disk1\install\exe\image00000001`3f6b0000.pdb - file not found
DBGHELP: c:\ade\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\disk1\install\symbols\exe\image00000001`3f6b0000.pdb - file not found
DBGHELP: c:\ade\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\disk1\install\setup.pdb\image00000001`3f6b0000.pdb - file not found
DBGHELP: c:\ade\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\disk1\install\setup.pdb\exe\image00000001`3f6b0000.pdb - file not found
DBGHELP: c:\ade\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\disk1\install\setup.pdb\symbols\exe\image00000001`3f6b0000.pdb - file not found
DBGHELP: C:\ADE\bpurana\.ade\view_storage\bpurana_oui_424\oui\cd\Disk1\install\image00000001`3f6b0000.pdb - file not found
DBGHELP: image00000001`3f6b0000.pdb - file not found
*** ERROR: Module load completed but symbols could not be loaded for image00000001`3f6b0000
I am wondering
why is it looking for a dbg file when the pdb is already present in the path.
Why is there a refernce to the image00000001`3f6b0000.pdb ; when the setup.pdb is in the symbol path?
Where is this image<> file name being populated from ?
Edit 1:
Command used for compilation :
icl.exe /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN64" /D "_DEBUG" /D "_WINDOWS" /Fp".\win64\debug\setup.pch" /YX /Fo".\win64\debug\\" /Fd".\win64\debug\\" /c ..\c\runInstaller.c
Edit 2 :
This is what I see when I try the cdb on the exe file. It seems to have a image<> executable within .
C:\Program Files\Debugging Tools for Windows (x64)>cdb.exe -c "q" C:\ADE\bpurana_oui_win\oui\cd\Disk1\install\setup.exe | grep -A 1 -i Execu*
Executable search path is:
ModLoad: 00007ff7`e4e10000 00007ff7`e4e74000 image00007ff7`e4e10000
The ICL version is this :
[C:\ADE\bpurana_oui_win\oui]icl /version
Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.4.237 Build 20140805
Copyright (C) 1985-2014 Intel Corporation. All rights reserved.
Even with this the issue is still persisting is there anything else I need to fix ?
directory with a single src file
:\>ls -l
total 4
-rw-rw-rw- 1 HP 0 63 2016-05-27 13:51 hw.cpp
src is a simple hellow orld
:\>cat hw.cpp
#include <stdio.h>
void main (void)
{
printf("hello");
}
compiled with Debug info
:\>cl /nologo /Zi /Fe:hwdbg.exe hw.cpp
hw.cpp
compiled without debug info
:\>cl /nologo /Fe:hwnodbg.exe hw.cpp
hw.cpp
dumping the contents of Debug Directory in Pe header for nodbg and dbg exes
:\>dumpbin /nologo /headers hwdbg.exe hwnodbg.exe | grep -i -A 4 Debug*
5A220 [ 38] RVA [size] of Debug Directory
xxxx
57480732 cv 38 0005B048 59C48 Format: RSDS, {2233DB57-2608-46AF-A94C-0AB233BB333C},
--
164B0 [ 1C] RVA [size] of Debug Directory
xxxxx
57480738 coffgrp 300 000165F4 159F4
loading both the executables in windbg and checking image names
:\>cdb.exe -c "q" hwdbg.exe | grep -A 1 -i Execu*
Executable search path is:
ModLoad: 01070000 010d5000 hwdbg.exe
:\>cdb.exe -c "q" hwnodbg.exe | grep -A 1 -i Execu*
Executable search path is:
ModLoad: 01320000 0133c000 image01320000

Resources