loadlibrary
loadlibrary copied to clipboard
Make multithreads
Hi taviso,
I'm building a project on Windows for call mpengine.dll for scanning virus, rely on your loadlibrary project. My goal is it can run on multithread. I know that mpengine.dll does not support multithread itself. So, I clone the mpengine.dll to multiple files like mpengine_1.dll, mpengine_2.dll... And then I call them separately and running parallel (for multithread). I running test for multiple time and the results are stable. But I notice that when the program is running, it create the files like "mpcache-D14D2B99286F81AB78D33517A803982C748A293D.bin". I think those files are the cache files for improving performance when scanning the same file again, the engine just needs to read from those cache file. This does not happen when I running with 1 thread (mean only one file mpengine.dll was call). Do you have any suggestion for this?
Thank you.
Thuong Le,
Hmm, are you changing how GetEnvironmentVariableW()
works? I think MP_PERSISTEDSTORE_DISABLE
and MP_METASTORE_DISABLE
might control that, but loadlibrary always sets them.
Thank you for your reply, I changing nothing. My project is built on Windows so I just need a part of your project. I build a VS project, including all files in "loadlibrary-master\include" and then I create a new source file call TestMSE.cpp for main() function rely on file mpclient.c. I think that the mechanism of mpengine.dll, when I am trying to call multiple file mpengine.dll at the same time, they will create those cache files. This not happens when I just modify MAX_THREAD to 1 (mean only call for 1 file mpengine.dll). TestMSE.txt
Ahh, I see. I would try setting those variables with SetEnvironmentVariable() somewhere in main and see if that fixes it!
On Thu, May 24, 2018, 21:46 lengocthuong15 [email protected] wrote:
Thank you for your reply, I changing nothing. My project is build on Windows so I just need a part of your project. I build a VS project, include all files in "loadlibrary-master\include" and then I create a new source file call TestMSE.cpp for main() function rely on file mpclient.c. I think that the mechanism of mpengine.dll, when I trying to call to mpengine.dll at the same time, they will create those cache files. This not happend when I just modify MAX_THREAD to 1 (mean only call for 1 file mpengine.dll). TestMSE.txt https://github.com/taviso/loadlibrary/files/2038022/TestMSE.txt
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/taviso/loadlibrary/issues/48#issuecomment-391939776, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHjpmZWAtrc62sprRWrlJtYxIBDEATRks5t14yNgaJpZM4UMAQ6 .
Did that work? e.g. something like
SetEnvironmentVariable("MP_PERSISTEDSTORE_DISABLE", "1");
SetEnvironmentVariable("MP_METASTORE_DISABLE", "1");
I will try and respone to you.
On Sat, May 26, 2018, 9:39 AM Tavis Ormandy [email protected] wrote:
Did that work? e.g. something like
SetEnvironmentVariable("MP_PERSISTEDSTORE_DISABLE", "1"); SetEnvironmentVariable("MP_METASTORE_DISABLE", "1");
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/taviso/loadlibrary/issues/48#issuecomment-392229900, or mute the thread https://github.com/notifications/unsubscribe-auth/AbGpdUTPKyiGQ13l9ZvqQ0pz8_xQRAwcks5t2MBWgaJpZM4UMAQ6 .
Hi taviso, I have set SetEnvironmentVariable("MP_PERSISTEDSTORE_DISABLE", "1"); SetEnvironmentVariable("MP_METASTORE_DISABLE", "1"); and it didn't work.
@lengocthuong15 I think the number of threads running parallel is the same with the number of bin files. All threads cache to the same file name. The first one locks the file, others have to create their own bin files.
This process is like logging to file. If you ran a simple logging application multiple times, it would create multiple log files in its running directory.
If the bin file is created within the same folder that mpengine.dll exists, maybe you could move mpengine.dll to different folders, such as folder_1, folder_2, ...