1

Topic: LoadLibrary failed on

Under virtual machine VMWare - Windows10 refuses one of mine DLL by 126 error is loaded. A way to DLL correct judging by a broad gull. Dependency Walker does not see passed DLL at the uppermost level (except a type API-MS-WIN-CORE-*.DLL in system DLL type KERNEL32.DLL but others DLL c are loaded by the same pattern - so it should not influence). What can be?

2

Re: LoadLibrary failed on

Hello, turbocode, you wrote: T> Under virtual machine VMWare - Windows10 refuses one of mine DLL by 126 error is loaded. T> a way to DLL correct judging by a broad gull. T> Dependency Walker does not see passed DLL at the uppermost level (except a type API-MS-WIN-CORE-*.DLL in system DLL type KERNEL32.DLL but others DLL c are loaded by the same pattern - so it should not influence). T> That else can be? Can run ProcMon th?

3

Re: LoadLibrary failed on

R> can run ProcMon th? Precisely, it appeared that she searches for subordinate DLL near to.EXE, instead of where the main DLL is in the same folder. It is possible as that to regulate? I want that all DLL were in Bin, instead of near to EXE? That is so: Root Bin test.dll test2.dll test.exe And now it demands so: Root Bin test.dll test.exe test2.dll

4

Re: LoadLibrary failed on

Hello, turbocode, you wrote: T> Under virtual machine VMWare - Windows10 refuses one of mine DLL by 126 error is loaded. T> that else can be?  "windbg loader snaps" in Google.

5

Re: LoadLibrary failed on

Hello, turbocode, you wrote: T> It is possible as that to regulate? MSDN "LoadLibrary"-> Remarks-> Dynamic-Link Library Search Order

6

Re: LoadLibrary failed on

Hello, turbocode, you wrote: R>> can run ProcMon th? T> it is exact, it appeared that she searches for subordinate DLL near to.EXE, instead of where the main DLL is in the same folder. T> it is possible as that to regulate? I want that all DLL were in Bin, instead of near to EXE? T> That is so: T> T> Root T> Bin T> test.dll T> test2.dll T> test.exe T> T> And now it demands so: T> T> Root T> Bin T> test.dll T> test.exe T> test2.dll T> LoadLibrary function The first directory searched is the directory containing the image file used to create the calling process (for more information, see the CreateProcess function). Doing this allows private dynamic-link library (DLL) files associated with a process to be found without adding the process's installed directory to the PATH environment variable. If a relative path is specified, the entire relative path is appended to every token in the DLL search path list. To load a module from a relative path without searching any other path, use GetFullPathName to get a nonrelative path and call LoadLibrary with the nonrelative path. For more information on the DLL search order, see Dynamic-Link Library Search Order. The search path can be altered using the SetDllDirectory function. This solution is recommended instead of using SetCurrentDirectory or hard-coding the full path to the DLL. UPD. SetDllDirectory function After calling SetDllDirectory, the standard DLL search path is: The directory from which the application loaded. The directory specified by the lpPathName parameter. The system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is System32. The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory. The directories that are listed in the PATH environment variable. That turns out in your case most

7

Re: LoadLibrary failed on

IID> MSDN "LoadLibrary"-> Remarks-> Dynamic-Link Library Search Order SetDllDirectory it is necessary to call in.EXE or in principal.DLL?

8

Re: LoadLibrary failed on

Hello, turbocode, you wrote: IID>> MSDN "LoadLibrary"-> Remarks-> Dynamic-Link Library Search Order T> SetDllDirectory it is necessary to call in.EXE or in principal.DLL? As far as I understand, in your case it is enough to cause in any place TO call LoadLibrary for the subordinate dll: The SetDllDirectory function affects all subsequent calls to the LoadLibrary and LoadLibraryEx functions. It also effectively disables safe DLL search mode while the specified directory is in the search path.

9

Re: LoadLibrary failed on

T> That else can be? For example, problems with the manifesto. It is necessary to look in system broad gulls, it is not assured about present , but the seven wrote such problems to broad gulls earlier.

10

Re: LoadLibrary failed on

R> R> The SetDllDirectory function affects all subsequent calls to the LoadLibrary and LoadLibraryEx functions. It also effectively disables safe DLL search mode while the specified directory is in the search path. Function SetDllDirectory is defined in Windows 8.1 SDK, and the collector at me under Windows7 and she does not see determination of such function, . And it is necessary that worked from Windows7 to Windows 10. How such to bypass?

11

Re: LoadLibrary failed on

Hello, turbocode, you wrote: R>> R>> The SetDllDirectory function affects all subsequent calls to the LoadLibrary and LoadLibraryEx functions. It also effectively disables safe DLL search mode while the specified directory is in the search path. T> Function SetDllDirectory is defined in Windows 8.1 SDK, and the collector at me under Windows7 and she does not see determination of such function, . T> And it is necessary that worked from Windows7 to Windows 10. T> As such to bypass? Minimum supported client Windows Vista, Windows XP with SP1 [desktop apps only] Header Winbase.h (include Windows.h) all should work from XP to 10 do not forget about SetDllDirectoryW/A UPD. SetDllDirectory function UPD2. Even if to include a mode "I do not trust " on mine 7-ke in kernel32.dll is  functions SetDllDirectoryW and SetDllDirectoryA you do something not so

12

Re: LoadLibrary failed on

Hello, turbocode, you wrote: R>> R>> The SetDllDirectory function affects all subsequent calls to the LoadLibrary and LoadLibraryEx functions. It also effectively disables safe DLL search mode while the specified directory is in the search path. T> Function SetDllDirectory is defined in Windows 8.1 SDK, Hm, https://msdn.microsoft.com/en-us/librar … p/ms686203 (v=vs.85).aspx Minimum supported client Windows Vista, Windows XP with SP1 [desktop apps only] Minimum supported server Windows Server 2003 [desktop apps only]

13

Re: LoadLibrary failed on

R> SetDllDirectory function Neznaju as such can be but section inside _WIN32_WINNT on Windows7: #if _WIN32_WINNT> = 0x0502 WINBASEAPI BOOL WINAPI SetDllDirectoryA (_In_opt_ LPCSTR lpPathName); WINBASEAPI BOOL WINAPI SetDllDirectoryW (_In_opt_ LPCWSTR lpPathName); #ifdef UNICODE #define SetDllDirectory SetDllDirectoryW #else #define SetDllDirectory SetDllDirectoryA #endif//! UNICODE shows gray color.

14

Re: LoadLibrary failed on

Hello, turbocode, you wrote: R>> SetDllDirectory function T> Neznaju as such can be but section inside _WIN32_WINNT on Windows7: T> T>#if _WIN32_WINNT> = 0x0502 T> WINBASEAPI T> BOOL T> WINAPI T> SetDllDirectoryA (T> _In_opt_ LPCSTR lpPathName T>); T> WINBASEAPI T> BOOL T> WINAPI T> SetDllDirectoryW (T> _In_opt_ LPCWSTR lpPathName T>); T>#ifdef UNICODE T>#define SetDllDirectory SetDllDirectoryW T>#else T>#define SetDllDirectory SetDllDirectoryA T>#endif//! UNICODE T> T> shows gray color. Version VS? On  it is possible in impudent through GetProcAddress (or by means of such wrapper the Author: rumit7 Date: 10.04 09:38) to cut necessary SetDllDirectory from kernel32.dll UPD. Can you him manually somewhere defined _WIN32_WINNT as 0x0501 for boost:: asio for example?

15

Re: LoadLibrary failed on

R> version VS? 2015 R> on  it is possible in impudent through GetProcAddress to cut necessary SetDllDirectory from kernel32.dll it would not be desirable. R> UPD. Can you him manually somewhere defined _WIN32_WINNT as 0x0501 for boost:: asio for example? Changed Nothing, boost is not present.

16

Re: LoadLibrary failed on

Hello, turbocode, you wrote: R>> version VS? T> 2015 can Platform Toolset selected for XP? R>> on  it is possible in impudent through GetProcAddress to cut necessary SetDllDirectory from kernel32.dll T> it would not be desirable. And I often only and should do since quite often I depend only from ntdll

17

Re: LoadLibrary failed on

Hello, turbocode, you wrote: R>> UPD. Can you him manually somewhere defined _WIN32_WINNT as 0x0501 for boost:: asio for example? T> changed Nothing, boost is not present. Interpose #pragma message and look to that it is equal _WIN32_WINNT. https://stackoverflow.com/questions/156 … mpile-time Besides, it is possible, flag LOAD_WITH_ALTERED_SEARCH_PATH helps: Note that the standard search strategy and the alternate search strategy specified by LoadLibraryEx with LOAD_WITH_ALTERED_SEARCH_PATH differ in just one way: The standard search begins in the calling application's directory, and the alternate search begins in the directory of the executable module that LoadLibraryEx is loading.

18

Re: LoadLibrary failed on

T>> 2015 R> can Platform Toolset selected for XP? No, a Visual Studio 2015 (v140)

19

Re: LoadLibrary failed on

Hello, turbocode, you wrote: T>>> 2015 R>> can Platform Toolset selected for XP? T> Is not present, a Visual Studio 2015 (v140) well I do not know, if only the minimum project throw off here, it is possible . And that guessing on a coffee thick any

20

Re: LoadLibrary failed on

zou> Interpose #pragma message and look to that it is equal _WIN32_WINNT. zou> https://stackoverflow.com/questions/156 … mpile-time #define _WIN32_WINNT 0x0501 it seems found a problem in stdafx.h: #ifndef _WIN32_WINNT//Allow use of features specific to Windows XP or later. #define _WIN32_WINNT 0x0501//Change this to the appropriate value to target other versions of Windows. #endif Changed on 0x0502 and all . Probably the project still was is created at the time of WindowsXP.