Renaming executable's image name is giving it write permission - rename

Dear community members,
We have three of same hardware Windows 7 Professional computers. No one of them is connected to a domain or directory service etc.
We run same executable image on all three computers. In one of them, I had to rename it. Because, with my application's original filename, it has no write access to it's working directory.
I setup full access permisions to USER group in working directory manually but this did not solve.
I suspect some kind of deny mechanism in Windows based on executable's name.
I searched the registry for executable's name but I did not find something relevant or meaningfull.
This situation occured after lot of crashes and updates of my program on that computer (I am a developer). One day, it suddenly started not to open files. I did not touch registry or did not change something other on OS.
My executable's name is karbon_tart.exe
When it start, it calls CreateFile (open mode if exist or create mode if not exist) to open karbon_tart.log file and karbon_tart.ini file.
With the files are exist and without the file exists, I tried two times and none of them, the program can open the files.
But if I just rename the name to karbon_tart_a.exe, program can open files no matter if they are exist or not.
Thank you for your interest
Regards
Ömür Ölmez.

I figured out at the end.
It is because of an old copy of my application in Virtual Store.

Related

How to use a folder and file with the same name but different case from github in windows 10?

I want to clone a github repo that uses two different files/folders:
\packages\ - Folder
\Packages - File
However, due to windows not using Case Sensitive File/Directory Names, this isnt working, it gives me the error that the folder cant be renamed because a file already has the same name.
The program that uses this project REQUIRES that there be a no-extension binary text file Packages (Its like a giant file full of control files (If you recognize linux debian youll understand)
But it also requires a folder named \packages\ to hold the json files containing the config data for each control file within Packages
This question is an updated form of this previous question, which is outdated, and doesnt have an answer that solves the problem: Working in git with directories with the same name but different case in Windows
From Windows 10's update in April of 2018, they added a feature to "enable" case-sensitivity on specific directories.
I simply used the command on my github storage directory and now my project works fine.
To use the feature: Open a command prompt window (I dont believe this requires Administrator, it didnt for me)
Copy the full directory path to the folder you want to enable the flag on, type in the console:
fsutil.exe file SetCaseSensitiveInfo #:\Path\To\Directory\Here enable
Paste your C:/D:/E: or whatever Drive path into the location above. Then hit enter.
You DO NOT need to restart your computer, the flag seems to take effect immediately
Info sourced from: https://www.windowscentral.com/how-enable-ntfs-treat-folders-case-sensitive-windows-10#enable_case_sensitivity_ntfs_windows10

Informatica creates a zero byte file and then can't write to same file

I have an Informatica workflow that is supposed to generate a .dat file.
The issues is that the wroflow creates a 0 byte file, but then can not write to the file it JUST created. It's baffling.
The target directory is a linux server, and there is a developer on our team that is able to run the workflow just fine, without this file-writing issue.
However, I have checked with our linux admins and several of them have confiremd that there is no major difference in access/permissions between her linux ID and my own. She is in two more user groups than I am, but I have been told that they would not have anything to do with this issue.
The ID used by the connection object is also in the same user group as my id on the linux server, enduser. Therefore it should be able to write to my home directory.
The workaround we have devised is to remove the files using my id, touch the files and then chmod them. This allows the id used by the Informatica connection object to write to the files, but it is not a permanent (or correct) fix.
My best guess is that this is most likely some sort of (very obscure) Linux environment issue.
I am also not able to make any changes to the Informatica workflow or mapping, since it is built correctly and this issue appears to be completely local to certain linux user ID's.
Does the etluser have write permissions? have you tried running a post session command script for chmod and giving full permissions and then writing into the file?

Program File saved file

I have developed an application in Visual Basic.net. When I install this application to a ProgramFiles/[Appname] folder, and I create a file that is saved in the same folder (a settings file, created from in the application), the file is not visible, yet the application can still read it.
Where is this file saved?
On Windows Vista and higher, writing to the Program Files directory requires administrative privileges. Your file is probably being affected by virtualization (a redirection of the write operation) to the virtual store. You can find it (in Windows 7) in C:\Users\<username>\AppData\Local\VirtualStore.
The obvious solution is not to try to save the settings in the wrong location in the first place. Your app should create a folder under %APPDATA%, and write it's settings there instead. This answer to a related question can provide some links that might help.

Accessing C:\ drive on Windows 7

I have full admin privileges on my Windows 7 machine but when I run my application which creates a file on c:\ drive I get error code 5 (Access is denied). I know windows 7 doesn't allow creating files in protected areas like c drive and program files and file explorer brings up 'administrative' message box if I copy a file there from somewhere else after which it does allows but can my application obtain write level access?
In my application, user gets to pick the folder where they want to create the file so if they choose c:\ drive s/he will obviously get this error which is not desirable.
void CTestDlg::OnBnClickedButtonCreate()
{
CFile f;
CFileException e;
TCHAR* pszFileName = _T("c:\\test.txt"); // here i am hard coding path for simplicity.
if(!f.Open(pszFileName, CFile::modeCreate | CFile::modeWrite, &e))
{
TRACE(_T("File could not be opened %d\n"), e.m_cause);
}
}
As far as I have researched it seems I can't by-pass the UAC dialog which is fine but my application don't even present it (which is understandable as well) but what are my options?
I see my only option is to detect this in my own application if this is Windows 7 OS and than check for file path before creating the file and present a more user friendly message 'windows 7 doesn't like you to create file in this folder, choose a different folder or go back to xp'. Is this scheme the way to go on Windows 7? Is there any other way?
As Kolink noted, your application needs to run with administrator privileges. In order to do that automatically, embed a manifest as explained here.
EDIT: For VS2010: Project Properties > Configuration Properties > Linker > Manifest File Change the 'UAC Execution Level' to the desired value.
Either don't try to write to protected areas, or require that your application be run with permissions (right-click => Run as Administrator).
I know I don't like random files appearing in my root - I like my files organised.
If it's the user who provides the path, then you should inform them that the file cannot be saved to this location and ask to provide another name.
Usually the shell, GetSaveFileName function, checks whether the new file can be created in the selected directory before returning, see flag OFN_NOTESTFILECREATE in description of OPENFILENAME structure.
Another option is to handle such situation and to show UAC confirmation yourself. But this solution requires much more effort than it's really worth. You can't elevate the current process, so the operation of saving the file to a protected area has to be implemented in another process. At the same time your current process has the data to be saved, so you'll have to implement the communication between the two processes. Read Designing UAC Applications for Windows Vista for more information.

Windows 7 Domain Account cannot read/write inside AppData folder

I am creating an installer with InnoSetup. My program requires that I be able to read and write to files as it reads data from my hardware device that is connected over IPv4. I also write to files as I am creating content within my program. I am having issues on a Windows 7 Professional 64bit machine that has a domain account. It is not allowing some .exe files within my program to open as necessary. The .exe files that need to open are reading and writing data from the files to which I have created content with the main exe of my entire program. The error that comes up is when I click a button in one program that will open another .exe file. The error reads Failed to set data for "". It seems as though the argument is being passed for my button link, but the link becomes null where it is trying to open "" file, which does not have a pathway. There appears to be some permission on the file that is rendering its location as unreadable, thus giving the failed to open "" location.
I have setup my installation file with the following flags that I believe should be necessary to allow read/write access in Windows 7.
[setup]
DefaultDirName={localappdata}\{#MyAppName}
; to install to localappdata folder of local user
[Dirs]
Name: "{app}" ; Permissions: users-modify users-full
; to allow the user to have read/write permission of all files within the installation folder. This should not be necessary because localappdata should already have read/write permissions.
This works fine on other machines that have only local user accounts. However, on the same computer that I am having trouble with, I have tried logging in as a local user account and I still find the same errors.
What am I missing to allow the program to read/write to all files within my installation folder, located in c://user/domainaccountaddress/appdata/local/my program directory?
I'm quite new to this, all advice is appreciated.

Resources