Dependency mechanism on build system - build

The dependency mechanism on build systems of today check the file timestamps or checksums for changes. Is it possible to create a build system that can do that by hooking the CreateProcess(), OpenProcess(), CreateFile(), CloseHandle(), and WriteFile() functions of kernel32.dll?

Related

How to separate gui from logic in C++ (pattern and library necessary to comunicate 2 executable file)

I want make a program in c++ but I want also reuse my code to compile it in multiple operating system and architecture reducing the most possible the changes at code. So I must create a gui executable and a logic executable so that:
for executable logic (start from controller if compared to mvc) is sufficient set architecture set istructions (x86, x64 or arm) and operating system (ios, android, Windows, Linux, ...), then recompile my code without make syntax changes;
executable gui that is different at the changing to each operating system (Windows, android, ios, ...),to each architecture set (android and linux are available in arm, x86 and x64) and to each various display size under 15".
To make this I must find a way to allow at the gui executable and at the logic executable to communicate between they...how can I make this? I must use some library? there is a suite of library or library already included that are available for each combination of operating system, language and architecture set?
The goal is reuse the most possible the code of logic and make different code of gui for each combination of operating system and display size (if under 15 inches).
The IDE that I use is Visual Studio 2015 and I don't want use solutions such as .NET framework or virtual machine because I want maximize the use of efficiency of the hardware.
Hope that request is simple to understand.
You have to use some multiplatform GUI library (Qt, wxWidgets and others). And if you really, really want to separate binary file for GUI and logic you'd have to create dynamic library (dll, so, depending on OS).
for the gui components I find them in other ways or implements GUi application with other IDEs, but the most important thing is find a way that is possibly integrated in C++ language and that is usable in all platform, where I can send and receive data from GUI; a thing that is similar at view class in java (with spring for example but also without it, simple implementing model - view controller pattern)...some ideas? pipes in C++ are valid in all the operating system? the shared memory I have read that can give problems changing the architecture from x86 to x64...

How to differentiate between system calls and normal function calls

I am working on project which is trying to migrate some legacy application running on QNX neutrino operating system to other open source RTOS based on linux.
I have listed all the third party library and device drivers which must be ported and now analyzing design and source code which depends on some special QNX features like QNX IPC MsgSend, MsgReply, MsgSendPulse etc.
I want to know is there any tools which will help me to make a list of all QNX related system calls or functions which is getting used in code from normal user defined functions or functions provided by third party library and C++ library. Since code is written by other organisations we don't know much details about code except how to compiler and how to run it.
Thanks
Please refer link: https://sourceforge.net/projects/simpl/
You don't have direct API calls in linux which are equivalent to MsgSend, MsgReply etc.. but you can achieve it through using existing pipes/POSIX MQs (or) You can install above tgz package (Which is available in https://sourceforge.net/projects/simpl/).

Is it possible on windows to prevent other applications hooking in system DLLs

I am desperately looking for a cause of crashes in my Qt-based Application.
After some observation I've detected, that alone opening a QFileDialog, which is standard windows file dialog, even without selecting any file, causes the application to crash after some minutes. It doesn't happen on all machines.
I've opened my application in dependency walker and the profiling revealed, that opening of file dialog loads tons of DLLs, which I don't need in my application - all the tools which hooked in windows shell. Among the others - TortoiseSVN, which even makes depends to freeze.
Is it possible in an application context to prevent other DLLs like codecs or shell-hooks to be loaded?
Is it at least possible to create a QFileDialog without loading all the tool hooked in windows?
This is definitely possible, but it's not trivial. What you have to do is insert an API hook on LoadLibrary (and/or the Native API equivalent.) When your hook is called, you can examine the DLL filename and decide whether you want to pass it along to the real LoadLibrary or return an error.
A couple places to find more info on API hooks:
A tutorial on CodeProject
Microsoft Detours is Microsoft's library for API hooking.
Now all of that said, for your specific situation you may be better off just changing your TortoiseSVN settings. If you set the include/exclude paths in Tortoise to only look at directories on your computer that contain SVN repos, I bet this freeze will go away as long as you avoid those directories.

JNI use in UMDF driver

I have a umdf driver and I would like to call some functions in .jar files to establish a connection between my driver (PCSC Reader) and an eclipse plugin (JCOP).
I called some java functions (from .jar) in a c++ main using JNI but can we write JNI code in a UMDF driver ?
If yes, I would appreciate some guidelines or point of views about how to approach the subject ...
There aren't much info about the subject when you google it so any info is much appreciated !
Thank you.
I don't have any UMDF driver experience, however, after reading the over view I don't see any reason why JNI would not be able to communicate directly with the Reflector. I don't think it will be able to communicate with the device stack or manager. So, if I understand this correctly, you should probably have some driver you load independently of JNI and then use JNI to talk to the driver via the Reflector.
On a more general note, I would recommend keeping your JNI code as simple as possible. My JNI code usually only functions as a Java <=> Native translation layer. All of the complexity and processing is done in a backing library that can be run independently of Java. By doing that, you can debug your native code with gdb or visual studio without having to jump around an already running JVM. You can choose to either ship the stand alone library as a native dependency and add it the the systems library load path or you can simply link it to the JNI library statically. I have had very good results using LTO and static linking in that exact scenario.

Linux inject C/C++ dll

Ire any solutions available to inject in process own C/C++ dll and start from entrypoint, i need hook process socket send functions and paste my own code there. Is it available on linux?
Thanks!
The typical way to do it is to set the LD_PRELOAD environment variable before launching the program. See for example tsocks. Note though that some programs will disable this due to security reasons (it can snoop a passwords etc), e.g. gnupg prevents LD_PRELOAD from working.
If you want to inject into a running program it's much more difficult. It can be done with ptrace (e.g. attach with gdb and call dlopen). But it's unreliable because you don't know what state the program is when you attach.
I made pyinjector, a tool you can use to inject a running process with a shared library.
To install, simply run pip install pyinjector.
Usage: inject <pid> <dll_path>