loadlibrary

LoadLibraryEx ignores side-by-side manifest

亡梦爱人 提交于 2021-02-19 01:34:49
问题 Does LoadLibraryEx function use side-by-side manifests? I have bar.dll with embedded SxS manifest, and that manifest describes version of this bar.dll, other dll file foo.dll has manifest that lists bar.dll as dependency, with specified version. But when I try to load bar.dll from foo.dll with LoadLibraryEx("bar.dll", NULL, 0) I see (with enabled sls with gflags) that it ignores these manifests, and loads first version of bar.dll that it sees in searchpath, if I define ISOLATION_AWARE_ENABLED

How to make LoadLibrary to show error dialog when there are missing dependencies

老子叫甜甜 提交于 2021-01-27 07:36:15
问题 Suppose we have two dynamic libraries libfoo.dll and libbar.dll , given that libbar.dll depends on libfoo.dll . Further we compile an executable test.exe that loads our libbar.dll using WinAPI function LoadLibrary() . If we run text.exe on Windows XP with missing libfoo.dll , LoadLibrary() shows dialog box alerting than libfoo.dll is actually missing and sets LastError to ERROR_MOD_NOT_FOUND (126). If we run same text.exe in same conditions on Windows 10, LoadLibrary() sets LastError to ERROR

Getting Version of already loaded DLL (Windows API)

╄→гoц情女王★ 提交于 2020-12-08 02:20:52
问题 ok, getting the file version of a dll before loading, is easy. im using GetFileVersionInfoSize + GetFileVersionInfo + VerQueryValue and it works like a charm. but what if the dll is already loaded? i know you can use LoadLibrary + IMAGE_DOS_HEADER + IMAGE_NT_HEADERS to retrieve certain information such as the function names etc. i noticed that IMAGE_OPTIONAL_HEADER has different version fields such as MajorImageVersion & MinorImageVersion etc. i tried pretty much everything, but those fields

Getting Version of already loaded DLL (Windows API)

柔情痞子 提交于 2020-12-08 02:20:23
问题 ok, getting the file version of a dll before loading, is easy. im using GetFileVersionInfoSize + GetFileVersionInfo + VerQueryValue and it works like a charm. but what if the dll is already loaded? i know you can use LoadLibrary + IMAGE_DOS_HEADER + IMAGE_NT_HEADERS to retrieve certain information such as the function names etc. i noticed that IMAGE_OPTIONAL_HEADER has different version fields such as MajorImageVersion & MinorImageVersion etc. i tried pretty much everything, but those fields

LoadLibraryW and POSIX path separator

怎甘沉沦 提交于 2020-08-09 05:44:10
问题 The MSDN documentation for LoadLibrary warns not to use normal Unix slash "/": When specifying a path, be sure to use backslashes (\), not forward slashes (/). I couldn't find any problems using either forward slashes or backslashes (or both) when calling this API. I tried the following pathnames: c:/foo/bar/baz.dll /foo/bar/baz.dll c:/foo/bar\\baz.dll /foo/bar\\baz.dll ./bar/baz.dll All combinations worked as expected. Why does the MSDN recommend against using forward slashes as path

LoadLibraryW and POSIX path separator

試著忘記壹切 提交于 2020-08-09 05:43:30
问题 The MSDN documentation for LoadLibrary warns not to use normal Unix slash "/": When specifying a path, be sure to use backslashes (\), not forward slashes (/). I couldn't find any problems using either forward slashes or backslashes (or both) when calling this API. I tried the following pathnames: c:/foo/bar/baz.dll /foo/bar/baz.dll c:/foo/bar\\baz.dll /foo/bar\\baz.dll ./bar/baz.dll All combinations worked as expected. Why does the MSDN recommend against using forward slashes as path

LoadLibraryExW() fails, last error is ERROR_MOD_NOT_FOUND, but no missing dependencies?

人盡茶涼 提交于 2020-05-09 02:51:13
问题 A customer is using our dll which is creating a child process which uses an open source library, which ultimately fails because of a call to LoadLibraryExW(), the last error returned is ERROR_MOD_NOT_FOUND. This occurs on WinXP 32-bit, but not on other machines. But we know the correct set of dependencies is installed and even in the same directory. So we thought naturally, to use Dependency Walker to look for what dependency is missing on that particular machine. Unfortunately it doesn't

How to load a c++ dll file into Matlab

喜你入骨 提交于 2020-02-23 09:37:09
问题 I have a C++ dll file that uses a lot of other c++ librarys (IPP, Opencv +++) that I need to load into matlab. How can I do this? I have tried loadlibrary and mex. The load library does not work. The mex finds the linux things (platform independent library) and tries to include them. And that does not work. Does anyone have any good ideas? 回答1: loadlibrary should work. I use it all the time to call functions from dlls written in C++ with C wrappers. What errors are you getting when you try to

C# RichTextBox实现背景透明

女生的网名这么多〃 提交于 2020-02-09 18:59:31
C#RichTextBox实现背景透明 这几天在做一个文本编辑器,要将RichTextBox的背景透明,但是发现C#的RichTextBox是不支持将背景设置为Transparent(透明)。 网上找了好多方法,但都不行。 后来自己想了个办法,自己定义个类继承RichTextBox。 首先启动Visual Studio(我用的是Visual Studio 2008),打开项目,选择新建-类,将名字改为"RichTextBoxTM"。 打开类,将namespace里面的内容都清空,并加入以下代码: class RichTextBoxTM : RichTextBox { [DllImport("kernel32.dll", CharSet = CharSet.Auto)] private static extern IntPtr LoadLibrary(string lpFileName); protected override CreateParams CreateParams { get { CreateParams prams = base.CreateParams; if (LoadLibrary("msftedit.dll") != IntPtr.Zero) { prams.ExStyle |= 0x020; prams.ClassName = "RICHEDIT50W";

FreeLibrary returns true indefinitely

别说谁变了你拦得住时间么 提交于 2020-01-24 00:40:17
问题 Is there any reason why FreeLibrary would repetitively return true? I'm trying to unload some native dll from my process, so I'm getting it's handle and then calling FreeLibrary until the ref count goes to zero and so FreeLibrary returns false... but it never does: IntPtr pDll = DllLoadingImports.LoadLibrary(dllTounLoad); //throw if pDll == IntPtr.Zero while(DllLoadingImports.FreeLibrary(pDll)); The code runs and never returns. Also the process explorer shows the dll still loaded. More