I create a program to auto start with Windows, using registry:
CURRENT_USER\Microsoft\Windows\CurrentVersion\Run
when Windows starts, the program starts too, the problem is that on auto start he can't manipulate files, when I open the program he can do everything.
Using GetLastError I can see the error code is 5: access denied, strerror return "access denied" and using FormatString the message is something like: "Error description 5: Access denied.
Can someone explain why is this hapening?
The program was starting from System32, so to create the files in the exe dir, is better use GetModuleFileName.
Related
I am learning C, but whenever I run a program I get this error:
a.exe failed to run: Access is denied
+CategoryInfo: Resources Unavailable:(:) [], Application failed exception
+ Fully qualified error is : nativecommandfailed
This error is because of McAfee (real-time scanning) but I don't know how to stop it.
I think it's asking me to put input when I use the scanf() function but it shows an error.
I think your antivirus software, McAfee, is preventing the execution of the .exe file for security purposes. Could you try disabling this feature? Additionally, please ensure that you have installed the C compiler for running your code in Visual Studio.
I'm using yq to convert a YAML document into JSON for use in a C program. In my program, I convert the file to JSON using the command
system("yq ea \'[.]\' -o=json .cache/BT_nginx-ingress.yaml > .cache/package.json")
However this causes the error:
Error: write /dev/stdout: permission denied
Thoughout my program, I've used redirection several times with the system() command, but it fails in this specific instance.
I can run the command normally from the terminal, without root. I'm using bash on PopOS, so I've also added bash -c to the above system() call, but it fails this way too.
Can anyone help me with this? Thanks!
Edit: More details on my configuration. The current working directory is the same as the program's location which is one directory above .cache. The working directory is never changed. I am the owner of .cache and the files inside. The permissions are r/w for me, and the group. I am running the process but not with sudo. system("echo foo > .cache/package.json") works!
I have managed to fix this issue by adding the yq_linux_amd64 binary with the C program itself, rather than using the yq package from snap. It works fine now, and can redirect outputs without any issue.
I've been trying to setup Eclipse for some C developing. I manage to get the example "hello world" program (provided by Eclipse) to compile, however I am unable to run or debug it. Since I am able to compile, I assume that the setup for the compiler is correct, I can also find the executable file in the workspace (which will not run manually).
While trying to run it through Eclipse I get the error "Error Starting Process - Launching Failed, Cannot run program".
While trying to debug it from Eclipse, I get the error "Error in final launch sequence: Failed to execute MI command: -exec-run" and "Error creating process %path to executable%(error 5)".
I've tried changing workspace to one that has no spaces and to reinstall the compiler (MinGW) with no success.
If anyone could provide some insight on the problem I'd be very grateful.
Edit: Attempting to run the executable returns the following error: "Windows cannot access the specified device, path or file. You may not have the appropriate permissions to access the item." This is strange as I am running it as an admin on my machine.
Furthermore, attempting to run the executable from an administrator permission level command prompt window returns "access is denied".
It turned out my anti-virus software was blocking the file's execution, disabled it and the program ran just fine.
I have a strange problem with eclipse, when I want to build a file I get the error:
c:/sysgcc/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file Blok 2 week 1a.exe: Permission denied
collect2.exe: error: ld returned 1 exit status
I only get this error when I have at least build the file once successfully. I have looked if the file was still running(in task manager, debug view, console), but it isn't. The error does not go away after closing eclipse. Only after rebooting my computer I am able to build the file again.
I have really no idea how I could solve this problem. I hope there is someone who could help me with this.
Thanks in advance.......
I'm trying to use popen. When I execute some system command (e.g. let's say ls or whatever) all works fine. But when I'm trying to execute my executable:
pipe = popen("./ <path>","r");
I get an error:
sh: permission denied.
Both executables (which uses popen and that one which I want to launch from first one) belong to my user accound and have "x" permissions.
I'd double check that error message, since it should say what the permission denied relates too. i.e. if path was empty, and you just passed ./, or had an extra space like in your example, you should see
sh: ./: Permission denied
As you describe it, it sounds like your getting a permission denied error trying to run /bin/sh; it seems more likely that you misread the error.