Exactly what it says on the tin.
Also is there any way to tell what is running inside the shell?*
I suppose I could do this by looking up finding process with matching parent pids* but is that portable to windows? And how would you look up current directory of a process given pid*.
*(most to least preferable) qt or kde api/other crossplatform api/*nix and windows api?
It looks like TerminalInterfaceV2 might be exactly what I need, any extra info about it would be appreciated.
Related
I met a problem when building with Visual studio, it says one DLL is not accessible because it is currently used by another process, my question is how can I determine the "another process"?
Process Explorer has a facility that allows you to search through the currently running processes for a specific file. To perform this search go to Find->Find Handle or DLL... and then enter the name of the file you are interested in.
tasklist /m thelocked.dll
Suggested by
https://blogs.msdn.microsoft.com/winclient/2004/07/08/how-to-find-out-which-process-is-locking-a-dll/
While Process Explorer is the best tool in general, what this error usually means when VS throws it at you is that the application you're trying to compile is still running (from an earlier run) and therefore the linker can't write its output.
Also you may use "close handle" feature inside Process Explorer.
Use the Find function (Find -> Find Handle or DLL) from SysInternals Process Explorer.
I would suggest you try unlocker. Helped me quite a few times.
You can use Process Explorer to see what processes have loaded which Dll's.
I was looking at a project that someone wanted done and in order to do it I need to edit Windows' Start Up Programs. I am unsure of where to begin looking. What I really need is just a reference to some Windows API functions that will let me do this.
Thanks
Startup programs is just a directory, I don't think there are any specific functions for it. You should be able to create shortcuts inside and that should be it.
c:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\
As Nikola Smiljanić says the Startup area is just a directory with file shortcuts in it. However it is dangerous to use a hardcoded path because this changes with different versions of Windows.
You can get the path to the startup folder with the SHGetFolderPath function and CSIDL_STARTUP as a parameter.
I'm trying to move (delete) a file to a Trash Can (in Linux) using C++ (also using QT4 for GUI). Unfortunately it seems to be quite difficult to do so and as far as I can tell there isn't a unified API for it.
I would like for my application to run not only on KDE but on GNOME, Xfce and other Linux desktop environments. That's why I'm searching for a more universal approach.
The best I could find so far is:
send2trash - but that's using Python/QT4 and not C++/QT4
trash-cli - this has the drawback of being a stand alone command line program and not a library
I would be happy with any approach that requires as little desktop environment specific code as possible. Or in other words that's as much independent from KDE/GNOME/Xfce components as possible.
Any help in finding a solution (if there even is one) would be greatly appreciated.
Why not find a terminal command to move the files and then call system() to run it for you inside your C++ program?
This might (I haven't tested it) be a possible one-liner in Linux to move files to the trash via the terminal. You would just pass the command as a quoted string to system() and call it in your C++ implementation.
The answer is in
http://www.freedesktop.org/wiki/Specifications/trash-spec
For every user a “home trash” directory MUST be available. Its name and location are $XDG_DATA_HOME/Trash
you only need to write C++ code move your file into such directory.
You can move files using boost file system and you can retrieve the XDG_DATA_HOME value using cstlib getenv.
As far as I know there's no standard trash can in Linux in the first place.
I can't be clearer than my title. :P
I want to run my program whenever a user renames a file in Windows Explorer (and only within the Explorer). Here's a simple mock up:
A simple link to a tutorial will be very helpful. I couldn't find anything. :/
Thank you in advance.
P.S. I'm new in C++
It looks like Windows API hooking may be your best bet. You'll want to intercept all calls related to Windows file renaming (i.e. MoveFile, MoveFileEx, SHFileOperation, possibly more). There are a few commercial and open source solutions; Microsoft Detours, Madshi's madCodeHook, and the free, open source EasyHook.
This approach, when done correctly, will allow you to capture all file renaming on a system.
I would avoid hooking APIs as much as possible. It gets really ugly really fast.
There are 2 ways I see that you can approach this.
Both ways have a few common factors:
The ReadDirectoryChangesW API. For a very good implementation of that API, see this
article
You will need to minimize your dependencies, so... Use a Microsoft compiler, link to the DLL runtime, stick to C as much as possible etc. This reduces problems. Loading things into the shell memory space is already problematic enough.
Method one is to use ReadDirectoryChangesW from an Explorer shell extension that does nothing else. Keep it minimal. I'm reasonably sure I saw a "do nothing" shell extension as an example in some of Microsoft's documentation.
Method two would be to package your code as a DLL and use a system hook to get your DLL loaded into Explorer only. The system hook should only load inside Explorer to prevent spurious notifications via ReadDirectoryChangesW.
Hope this helps and that you're not using it for something Evil.
I need a tool which will discover whether an arbitrary process is running in x86 or x64 mode on a machine. I need to do this programatically from C++, based on a process ID.
There has to be some way to do this (as you can clearly see it from the task manager). Does anyone know of a windows api that will tell you, given a process ID, whether the application is running under wow64?
Another approach would be to figure out, based on the process id, the executable name/path that is running and try to read the PE headers out of the file. Does anyone have a code snippet that would accomplish that?
There is a WinAPI function, IsWow64Process.