I was wondering if its possible to add custom folders to console2 app, when it starts.
What i mean is, i created a USB flash that always uses drive letter X, and i have custom apps there, that i need to add to system path, to use them in console2. But the problem is, that don't want to install all of the applications to each computer i connect my USB, nor do i want to add them to system path, since the path will be wrong, when i remove the usb from computer.
So basically, what i want is to create fully portable usb drive with all of the software in it, and i want it to be automatically added and available to console2, but not to the computers system path..
i hope i made my goal clear..
I think I understand your problem, but I'm not entirely sure from your wording. Since you mentioned that you have already created a static drive letter ( X:\ ) for your USB drive, then couldn't you just add the programs to your shell using the path from your USB like this:
http://puu.sh/5wCqW.png
If you're using a different computer every time, then you might have to change the static drive letter for your USB on the computer that you're working on at that moment so that it matches the one in your Console2 shell:
http://www.howtogeek.com/96298/assign-a-static-drive-letter-to-a-usb-drive-in-windows-7/
Related
I'm running low on memory on my C:\ but I have plenty on D:\
My goal is to make it so all programs installs to D:/Programs even those dumb programs where you don't get an option to choose where they will be installed.
I have been looking into different ways to move the default installation path & register edits & things, but most of them are kind of dangerous, really annoying to do &/or might bring unexpected side effects; like the programs cant be found & such.
But then I found a suggestion to use the windows cmd (commandpromts) mklink command to basically make a shortcut from C:\Programs to D:\Programs
But I'm thinking: What happens if I simply Drag & drop the C:\Programs to D:\ then right click on it & chooses make shortcut & move that shortcut back to C:/
Is this a really stupid or smart solution? (I'm leaning to dumb, because it's just too simple, but I don't know why it would be dumb?)
& does anyone knows what can go wrong with this solution?
I'm using Windows 7
I think I found why this would be stupid, a shortcut done in windows is apparently a file that points to the target & not all programs use it correctly, while using cmd to make a symbolic link is "registered to the hard drive" & it should work better.
Quote from this page:
"Shortcuts, symbolic links, hard links & junctions?!
A shortcut is a file that points to another file. It is an antiquated pointing system from the Windows 95 era that many programs do not recognise. Shortcuts do not only use up space on the hard drive, but they also break and linger behind after the deletion, renaming or moving of the target.
A symbolic link is similar to a shortcut, but instead of being saved as a file it is registered to the hard drive partition. It does not use any disk space, and all programs recognise both the link and the target. A symbolic link can point to any file or folder either locally on the computer or over a network using an SMB path.
A file hard link is a little different and can not be used over multiple partitions meaning you can not have a link on drive C: pointing to a file on drive D:. A file hard link points to and duplicates a target as a mirrored copy, but the duplicate does not use any additional space on the hard drive partition. So two hard links that mirror a 1 GB file would in total only use 1 GB on the partition rather than 3 GB. Importantly if either the hard links or the target were to delete, the other links retain the data. Changes to the content of either the target or the links automatically propagate to all other items.
A junction behaves like a hard link for directories, but unlike file hard links you can create junctions that span multiple partitions. Again a directory junction and its content are stored on the hard drive partition, but they do not use any additional space. Any changes to the content within either the target or the links will automatically propagate except where the target directory is deleted or renamed. In that case, all links that point to the target will break and linger on the partition."
I am using Delphi 5. I originally had problems copying a file from a network mapped drive. If I use the UNC path I can copy the file. The problem is I wont always know the UNC path. I am using windows 10, 64 bit. Is there a solution that would allow me to obtain the UNC path? Every time I use the ExpandUNCFileName function it returns the path N:\tmp\file1.mdb instead of \hermes\apps\tmp\file1.mdb. If I run the code on XP or Windows 7 it returns the UNC path correctly but when I run it on Windows 10 it fails and gives me the path with the drive letter.
What I am trying to do is run an install program which updates a database file. For it to work I need to copy the database file locally. Now the problem happens when I first start the update program exe, my windows 10 forces the program into run administrator. As soon as I run the exe it pulls up an administrator login. It only does this on windows 10. With windows 7, XP it does not ask or force it to run as administrator.
Please help if you can, thanks.
ExpandUNCFileName works correctly. If you call that function from a context which has the drive letter mapped, then it will return the desired UNC name.
The problem therefore must be that when you call the function the drive is not mapped. Common reason for that would be that your code was executing in a service, or under a user account that does not map the drive, but there are other reasons.
Exactly how to solve your problem is not clear from here. You might solve it by making sure that the drive letter is always mapped. However, this is a potentially brittle approach, as you are discovering.
Perhaps a more reliable approach would be to operate exclusively with UNC names. This after all is the reason for their existence. So, when the user provides you a path to a network directory or file, convert it at that point to a UNC name. From that point on use that UNC name.
If you don't want your program to be elevated then you need to either give it an application manifest, or change its name. Executables without application manifests, and with names like update or patch, are elevated by UAC aware versions of Windows. UAC was introduced 12 years ago, it is perhaps time for you to get up to speed with the implications for developers. Not least because your old Delphi 5 development environment predates UAC, and therefore will not generate and link a manifest for you.
I want to make a program that opens two different programs (one virus file that infects the computer and one that is the real program). I have tried with .bat files, but it requires me to write the path to the file that includes the name of the targets user account. The problem is that i don't know what the target has named his account. Is there any way a program can search the sub folder and find the target programs automaticly? (Im planning on having that program with the folder "first" and in that folder the virus and the actual program will be)
Sorry for bad English
You can use Veil-Framework or metasploit to embed a payload into a file, and it accepts several different formats. Then you have to use social engeenering to distribute the infected file. Youll have to do some tests in local to ensure that infected file evades antivirus (the av evasion is the hard thing to do here as signatures of known payloads are also known by av software).
Renember that infecting a remote computer not owned by you can be considered a delictive act an can get you into legal issues.
Hope this helps.
We have a Delphi program whose task is like a service program. It watches a particular folder for a certain period, and it works great on Windows XP and 2003, but on Windows 2008r2 64bit, when it wants to create an automatic folder, it will show this message:
The ... folder does not exist. The file may have been moved or deleted.
This message causes the program to halt, which is not good; it should not be interrupted.
What can I do about this?
P.S.: I really don't have any idea whether to post my problem in Stack Overflow or Server Fault, so I've guessed it should be here.
It's likely the VirtualStore, if you're trying to store beneath Program Files (either one). See my writeup:
http://www.clipboardextender.com/off-topic/vista-program-files-hide-and-seek
You've left out the ... folder name. While that's understandable, it wouldn't happen to have anything to do with program files (which on x64 will be split in 2 directories) would it?
Windows Server 2008 is able to use 'virtual' file pathes. That means: 'what you see is not what you get'. The Windows Explorer just shows you the 'display' name. Check the file path with cmd.exe, if the path you are trying to use does realy exist.
The reason is of cause the File Virtualization (see for example http://msdn.microsoft.com/en-us/library/bb756960.aspx and http://technet.microsoft.com/en-us/magazine/2007.06.uac.aspx).
Because we on stackoverflow.com and not on serverfault.com I want add to all other answers that you can use Wow64DisableWow64FsRedirection, Wow64RevertWow64FsRedirection and Wow64EnableWow64FsRedirection functions (see http://msdn.microsoft.com/en-us/library/aa365743.aspx) to control the File Virtualization in your program. An example of the usage of this functions in C# you can find here http://www.pinvoke.net/default.aspx/kernel32.wow64disablewow64fsredirection.
You'll need to tell us the exact path and how do you go about constructing it. It can be as simple as the app not using env variable expansion but assuming that user's folders are where they were before.
Path virtualization (there are 2 kids actually) that people mentioned will hit you only if your app is trying to mess with system folders.
More puzzling problem will hit you if you are not expanding env vars like APPDATA, LOCALAPPDATA etc. and not expecting that there's more of them on Win7 and 2k8. Not only that default paths of user's files changed but some of them can also be on network shares - for the same user. So if you were running based on expectation that all user's stuff will be at definite paths under say %USERPROFILE% you can get hit by several surprises. Also notice %ProgramData% .
Fastest way to find out - open cmd.exe, run set and if you see some paths that you are constructing in alternative ways, take notice that you need to start expanding env vars for them. Then open cmd.exe as a 32-bit app and check set again. You can also pick them up via Process Explorer from some running 32-bit or 64-bit app.
Switching your app to 64-bit build will resolve most of virtualization issues but not the env var expansion. Also if your app is touching system folders you need to request elevated run from the code or even better make the manifest and declare it there. Then OS will yell at user up front if his UAC is on and your app will avoid that 2nd virtualization. BTW, virtualization is controllable via group policies so it might be present on some boxes and missing on others.
After many months of postponing it, this week, I finally started using a new Windows 7 Professional PC for actual development (which is 90% still done in Delphi 7 with some of these programs still using the Borland IDAPI to access Paradox files). The previous development pc was still an XP-one.
Every thing works except for one thing: somehow the settings of the IDAPI and BdeAdmin configuration files are messed up or they are read/written in different locations. To be more precise, it looks like two configuration files are active.
It must have something to do with rights or settings being read/written in the wrong folder or registry setting, but after searching for it for a couple of hours, I give up.
Anyone had any problems with this, before ? And if so, hopefully, has any one solved this problem ?
Thx for any thoughts/solutions ...
My guess is it has something to do with the fact that Vista and Windows 7 don't allow programs to change files under the C:\Program Files folder. They create a copy of those changed files in a virtual store, the process is known as virtualization. The copies end up in the hidden appdata folder of the user account and can be found in the Local\VirtualStore\Program Files folder. The structure in that folder reflects the one in the actual Program Files folder.
Programs that access their files in the Program Files folder using a "hardcoded" path, will always get the original - unchanged - file contents.
Solution: running the apps in a virtual XP system or upgrading the apps is probably your best bet.
You could try to run the apps elevated. That is: right click them and choose Run as Administrator. Please note that it isn't enough to be logged in as an administrator. Even administrators run all processes unelevated by default. Instead of right-clicking, you can also create a shortcut and set the Run as administrator for the shortcut - the checkbox for this is on the compatibility tab of the properties dialog. No guarantees though that this will alleviate the problem.
Since IIRC D7 setup allows you to configure paths in multiple ways, maybe simply do a reinstall outside "program files"?
Afaik this solves several vista/w7 problems.