Code::Blocks Forums

User forums => Help => Topic started by: Blacksheep on November 01, 2017, 03:40:09 pm

Title: Error saving file
Post by: Blacksheep on November 01, 2017, 03:40:09 pm
Hi all,

after applying the latest Windows Creator update (the one with the exploit protection) c::b no longer overwrites an existing file (error saving file). If the file is being deleted the file can be written but the next attempt to overwrite the file is quitted then again with error writing file.

Steps done to narrow down the problem:
- Disabled Exploit protection -> No success
- The file permissions checked (local disk with NTFS) -> Everything is fine
- Created a new project, changed a file and try to save -> no success

Other IDEs tested does not have the issue, e.g. CodeLite

So be careful if you plan to apply the creator update to your productive system. I suspect that this will cause this behaviour
Title: Re: Error saving file
Post by: BlueHazzard on November 01, 2017, 05:14:26 pm
i can not find anything about this on the net. Have you some resources where i can read about this? (i can not find anyone complaining on stack or other forums)
i do not have windows 10 but i would like to help other people with this...
Title: Re: Error saving file
Post by: oBFusCATed on November 01, 2017, 08:52:47 pm
What version of codeblocks are you using?
Title: Re: Error saving file
Post by: Miguel Gimenez on November 01, 2017, 09:24:39 pm
Microsoft decided some folders (like My documents) should be protected from non secure apps, so you can't update your files without their consent. This is called Controlled Folder Access and supposedly is disable by default. The second link explains how to activate it, but of course it also serves to deactivate it. F**k Microsoft  >:(.

https://www.theregister.co.uk/2017/10/23/fyi_windows_10_ransomware_protection/ (https://www.theregister.co.uk/2017/10/23/fyi_windows_10_ransomware_protection/)
https://betanews.com/2017/10/24/windows-10-fall-creators-update-controlled-folder-access/ (https://betanews.com/2017/10/24/windows-10-fall-creators-update-controlled-folder-access/)
Title: Re: Error saving file
Post by: Blacksheep on November 02, 2017, 12:12:12 am
What version of codeblocks are you using?

The stock 16.01. Downloaded again today and reinstalled without success.

Update:
- I played around with the settings in Windows Defender Control Center and explicit deactivated all settings -> No success
- Providing all rights in Exploit Settings for codeblocks.exe -> No success
- Tested directory outside of "My Documents", e.g. D:\Code -> No success

I am at the end of my knowledge here.

Maybe I will try to monitor tomorrow with sysinternals. Until the problem is solved I am coding now on linux only (the windows machine is just for testing)

Title: Re: Error saving file
Post by: Blacksheep on November 02, 2017, 12:16:21 am
Microsoft decided some folders (like My documents) should be protected from non secure apps, so you can't update your files without their consent. This is called Controlled Folder Access and supposedly is disable by default. The second link explains how to activate it, but of course it also serves to deactivate it. F**k Microsoft  >:(.

https://www.theregister.co.uk/2017/10/23/fyi_windows_10_ransomware_protection/ (https://www.theregister.co.uk/2017/10/23/fyi_windows_10_ransomware_protection/)
https://betanews.com/2017/10/24/windows-10-fall-creators-update-controlled-folder-access/ (https://betanews.com/2017/10/24/windows-10-fall-creators-update-controlled-folder-access/)

Basically this feature is a good one. Any executable not being trusted is not able to manipulate files (e.g. encrypt). I am not sure if this is really the reason for the observed behaviour, it's just my assumption. I will tomorrow setup a VM with Win 10 and test again if the problem really happens after installing the latest windows creator update.

By the way: The windows creator update is being rolled out since some days. If I am right the problem will affect many users running win 10
Title: Re: Error saving file
Post by: Blacksheep on November 02, 2017, 09:37:52 am
Hm, I tried to reproduce the problem in a VM.

- Installed latest Win10 iso in a VM
- Installed codeblocks

I can save changed files without issues. So the problem appears to be local

Thanks for reading and commenting
Title: Re: Error saving file
Post by: 0_0 on November 06, 2017, 12:23:25 pm
Hm, I tried to reproduce the problem in a VM.

- Installed latest Win10 iso in a VM
- Installed codeblocks

I can save changed files without issues. So the problem appears to be local

Thanks for reading and commenting

I think I encountered the same problem as you did. I have checked that microsoft windows 10 is updated already.

How do you use a vm?
Title: Re: Error saving file
Post by: Blacksheep on November 12, 2017, 10:14:36 pm
I installed Virtualbox (virtualbox.org), created a VM, mounted a Windows10 Iso as a DVD in the VM and so on.
Title: Re: Error saving file
Post by: BlueHazzard on November 13, 2017, 09:43:48 am
isn't the creator update rolled out only in batches? Can you confirm that you have the update installed?
I personally don't think this is the main cause of this problem, because it would make the pc rater useless if i can not modify any files created by other programs....

Title: Re: Error saving file
Post by: Blacksheep on November 13, 2017, 11:09:49 pm
I can confirm that the Creator Update is implemented because of the options for exploit protection coming with the update exist on my system.

I personally believe that something in Windows has changed that c::b is running into this issue. We will see how many users report this issue in the future. It is definetely not a permission issue. This has been meanwhile checked several times. And if that would be a permission issue c::b would not be able to create a file. But c::b has only issues with overwriting existing files even if they are created just before by c::b itself.

Title: Re: Error saving file
Post by: wadhere on November 20, 2017, 07:10:16 pm
Hi all,

it seems to that I have the same issue. I install c::b first time on two different Windows 10 (64bit) machines with the creator update.
My current WinVersion is Win10 Pro, Version 1709 , Build 16299.64 .
c::b version: 16.01

Steps:
- new installation of C::B , including MinGW
- Create a new Project
- Console Application
- Chossed "C"
- Choosed GNU GCC Compiler
- Build the "Hello World"  without problems
- Let it run ... without problems
- change the main.c , change "Hello"  to"Hellllo"; the star in the file tab "main.c" is visible
- Save file produce the error "...main.c could not be saved ..."  :(
- Edit outside of c::b works , than c::b reload the file and it can build again
- changes and save with c::b editor are not working

I tried this with two PC's, different folders ......




 
Title: Re: Error saving file
Post by: oBFusCATed on November 20, 2017, 09:07:37 pm
What happens if you use the rc1 for the upcoming release from here: https://sourceforge.net/projects/codeblocks/files/Binaries/17.xx-RC1/Windows/ ?
Does it work?
Title: Re: Error saving file
Post by: wadhere on November 20, 2017, 09:39:56 pm
Thanks for the quick answer.
I tried the "codeblocks-17.xx-setup-RC1.exe" , but it does not work. Same issue as before. Impossible to save any change.

I'll try try this on a Win7-machine next days.
Title: Re: Error saving file
Post by: oBFusCATed on November 20, 2017, 10:05:27 pm
What are the security settings on the machine?
What happens if you trace the cb executable with procmon/filemon or some other tool which is used for tracing system calls?

(note: I'm mostly linux developers, so I don't know how to debug such issues on windows)
Title: Re: Error saving file
Post by: oBFusCATed on November 21, 2017, 09:59:15 am
@wadhere: What is the full path for the file you want to save?
Title: Re: Error saving file
Post by: wadhere on November 21, 2017, 06:55:34 pm
Today I checked the situation on a win7 PC. Everything works fine. I checked this with 16.01

The path of the c:b installation itself is: c:\Program Files (x86)\CodeBlocks\
MinGw is also there : c:\Program Files (x86)\CodeBlocks\MinGw\

The test project are at: c:\project_CB\test8\
Please see also the attached screenshot.

In regards of security setting of Win10:
I'm not sure what is meant with "security settings" - i checked this with  AVG Antivirus switched off ... but is does not work.

Every time a file "main.c.save-failed" created when I try to save my changes.

Thanks for reading and commenting





Title: Re: Error saving file
Post by: oBFusCATed on November 21, 2017, 09:37:59 pm
OK, this gives some hints what fails.
C::B uses save-to-temp and rename mechanism to prevent data loss.
The .save-failed file is created when the second step fails. So obviously renaming the fail over the original fails.

Can you try to record the save operation with procmon (https://docs.microsoft.com/en-us/sysinternals/downloads/procmon) so we can probably see the error message?
Title: Re: Error saving file
Post by: wadhere on November 22, 2017, 07:31:07 pm
Hello oBFusCATed,
I made the log file, Can I send the files via mail ?
Title: Re: Error saving file
Post by: oBFusCATed on November 22, 2017, 08:16:31 pm
Nope. You can either attach it to a forum pose or pastebin it on some site pastebin like site.
Title: Re: Error saving file
Post by: wadhere on November 22, 2017, 10:17:59 pm
pls see the fileshare system Wetranfer: https://we.tl/l5VTTPAeKV (https://we.tl/l5VTTPAeKV)

filtered log : Process Name "codeblock" ; path: c:\project_CB\

if you need more details or a different filter than please give me a hint

It is too large to attach
Thx
Title: Re: Error saving file
Post by: oBFusCATed on November 22, 2017, 11:49:25 pm
Sorry but I need text files. I don't have windows, nor a tool which could open these.
Title: Re: Error saving file
Post by: BlueHazzard on November 23, 2017, 12:28:04 am
Essentially there is a ACCESS DENIED at renaming "main.c.temp" to "main.c"

Stack trace (does not say anything):
Code
"Frame","Module","Location","Address","Path"
"0","FLTMGR.SYS","FLTMGR.SYS + 0x7682","0xfffff80fe3067682","C:\WINDOWS\System32\drivers\FLTMGR.SYS"
"1","FLTMGR.SYS","FLTMGR.SYS + 0x7228","0xfffff80fe3067228","C:\WINDOWS\System32\drivers\FLTMGR.SYS"
"2","FLTMGR.SYS","FLTMGR.SYS + 0x6e2b","0xfffff80fe3066e2b","C:\WINDOWS\System32\drivers\FLTMGR.SYS"
"3","FLTMGR.SYS","FLTMGR.SYS + 0x6bce","0xfffff80fe3066bce","C:\WINDOWS\System32\drivers\FLTMGR.SYS"
"4","ntoskrnl.exe","ntoskrnl.exe + 0x388d9","0xfffff8006d84f8d9","C:\WINDOWS\system32\ntoskrnl.exe"
"5","ntoskrnl.exe","ntoskrnl.exe + 0x3c7a6","0xfffff8006d8537a6","C:\WINDOWS\system32\ntoskrnl.exe"
"6","ntoskrnl.exe","ntoskrnl.exe + 0x3c6b8","0xfffff8006d8536b8","C:\WINDOWS\system32\ntoskrnl.exe"
"7","ntoskrnl.exe","ntoskrnl.exe + 0x3bd07","0xfffff8006d852d07","C:\WINDOWS\system32\ntoskrnl.exe"
"8","ntoskrnl.exe","ntoskrnl.exe + 0x16f553","0xfffff8006d986553","C:\WINDOWS\system32\ntoskrnl.exe"
"9","ntdll.dll","ntdll.dll + 0xa0324","0x7ff9fcae0324","C:\WINDOWS\SYSTEM32\ntdll.dll"
"10","wow64.dll","wow64.dll + 0x1675e","0x5c3b675e","C:\WINDOWS\System32\wow64.dll"
"11","wow64.dll","wow64.dll + 0x9ca0","0x5c3a9ca0","C:\WINDOWS\System32\wow64.dll"
"12","wow64.dll","wow64.dll + 0x6463","0x5c3a6463","C:\WINDOWS\System32\wow64.dll"
"13","wow64cpu.dll","wow64cpu.dll + 0x1923","0x5c401923","C:\WINDOWS\System32\wow64cpu.dll"
"14","wow64.dll","wow64.dll + 0x1ac12","0x5c3bac12","C:\WINDOWS\System32\wow64.dll"
"15","wow64.dll","wow64.dll + 0xbcf0","0x5c3abcf0","C:\WINDOWS\System32\wow64.dll"
"16","ntdll.dll","ntdll.dll + 0xd5bbd","0x7ff9fcb15bbd","C:\WINDOWS\SYSTEM32\ntdll.dll"
"17","ntdll.dll","ntdll.dll + 0xc75b3","0x7ff9fcb075b3","C:\WINDOWS\SYSTEM32\ntdll.dll"
"18","ntdll.dll","ntdll.dll + 0x7920b","0x7ff9fcab920b","C:\WINDOWS\SYSTEM32\ntdll.dll"
"19","ntdll.dll","ntdll.dll + 0x791be","0x7ff9fcab91be","C:\WINDOWS\SYSTEM32\ntdll.dll"
"20","ntdll.dll","ntdll.dll + 0x6e9dc","0x76f6e9dc","C:\WINDOWS\SysWOW64\ntdll.dll"
"21","KERNELBASE.dll","KERNELBASE.dll + 0x10a647","0x752ea647","C:\WINDOWS\SysWOW64\KERNELBASE.dll"
"22","KERNELBASE.dll","KERNELBASE.dll + 0x10a469","0x752ea469","C:\WINDOWS\SysWOW64\KERNELBASE.dll"
"23","codeblocks.dll","codeblocks.dll + 0xd0b4c","0x61890b4c","C:\Program Files (x86)\CodeBlocks\codeblocks.dll"
"24","codeblocks.dll","codeblocks.dll + 0xdce99","0x6189ce99","C:\Program Files (x86)\CodeBlocks\codeblocks.dll"
"25","codeblocks.exe","codeblocks.exe + 0x7db58","0x47db58","C:\Program Files (x86)\CodeBlocks\codeblocks.exe"
"26","wxmsw28u_gcc_cb.dll","wxmsw28u_gcc_cb.dll + 0x1262","0x6cc41262","C:\Program Files (x86)\CodeBlocks\wxmsw28u_gcc_cb.dll"

function called:
Code
SetRenameInformationFile

i could not find more usefull information...

[EDIT:] There is also this description line
Code
ReplaceIfExists: True, FileName: C:\project_CB\test1\main.c
Title: Re: Error saving file
Post by: oBFusCATed on November 23, 2017, 01:37:17 am
Is there anything else accessing main.c? What about the indexer? Could it be affecting this?
Title: Re: Error saving file
Post by: BlueHazzard on November 23, 2017, 10:47:32 am
i think we will need an other log for this. With a filter for the main.c.temp file
Windows documentation is not quite useful for this, and the error message does not tell anything.

If this is an indexer error, how can we avoid it? Saving directly to the file? Adding delay? Waiting till all processes accessing the file close their handle (and blocking c::b with this)?
what a shitty problem...

Would it help to create the main.c.temp file in advance by the user, or does cb checks for collision?
Title: Re: Error saving file
Post by: wadhere on November 23, 2017, 06:44:52 pm
Ok - I changed the filter. Now all process data related to codeblock.exe should be visible, >90MB
Pls see at aprox 18:34

https://we.tl/KtELGoMFyn (https://we.tl/KtELGoMFyn)

thx


Title: Re: Error saving file
Post by: BlueHazzard on November 24, 2017, 09:30:03 pm
There is not more information. We still don't know what blocks the access to this file. Can you add a filter specially for "C:\project_CB\test\main.c.temp" (if this is possible) don't filter only for codeblocks, so we see all programs that access this file
Title: Re: Error saving file
Post by: stahta01 on November 25, 2017, 12:45:34 am
Likely a dumb question; but, are we sure that "main.c" file has been deleted before "main.c.temp" is renamed to "main.c"?

Tim S.

Title: Re: Error saving file
Post by: MortenMacFly on November 25, 2017, 05:43:10 am
I just tried after updating to 1709. It works for me although all exploit protections are on.

However, in the group policy editor you can define trusted applications. Did you try to add codeblocks to it?
Title: Re: Error saving file
Post by: MortenMacFly on November 25, 2017, 05:48:31 am
I would guess its more an issue with a AV software. For those that experience the same: Two questions:

1.) Do you have a AV software different to the one included with Windows (MS Defender)?
2.) What happens if you temporarily un-install this software? (And I don't mean just de-activate).

The reason for that is that if the protection is an issue, it could also easily interfere with AV solutions not prepared for such.

What I realise besides when activating this protection is that Windows massively slows down, btw.
Title: Re: Error saving file
Post by: Blacksheep on November 25, 2017, 11:53:31 am
Wooha, some progress here during my absence.

I can exclude that AV is responsible. Even the fact that the problem appeared AFTER implementing the creators update and nothing changed else it is very unlikely that AV is responsible. No matter how, I

- deactivated AV -> Problem still exist
- Made exceptions for Folders to save and codeblocks.exe -> Problem still exist
- Deinstalled AV -> Problem still exists

Again: There MUST be any change within the creators update which cause this symptom. Interesting fact: Installing a new machine with the latest ISO (includes the creator update) does not lead to this issue. So only updated machines will be affected.

I will monitor this thread now on a daily basis. Let me know if you need more traces / logs.
Title: Re: Error saving file
Post by: wadhere on November 25, 2017, 04:46:28 pm
I found the issue - on my PC's

After AVG antivirus deinstalled the issue was the same as before . I was not able to save the files .

But on this both win10 machine's an additional security SW is running: "Malwarebytes Antiransomware". After deactivating this I'm able to store the files.

In this tools it is possible to exclude folder or files (see attachment). With excluding my projectfolder everything works as it should.

Now the AVG antivirus is installed again and in the Malwarebytes-tool my project folders excluded from monitoring. With this configuration it works.

Lot of thanks for your help !

If the log files are still interesting for you , with and without activation the Ransomeware protection , than of course I'll try to log this.

best regards "wadhere"


Add: After reboot the the Malwarebyte tool generate the same problem - also with excluding the project folder. So I deactivate this tool complete ...than it works.
Title: Re: Error saving file
Post by: MortenMacFly on November 30, 2017, 07:42:03 pm
I found the issue - on my PC's

After AVG antivirus deinstalled the issue was the same as before . I was not able to save the files .

But on this both win10 machine's an additional security SW is running: "Malwarebytes Antiransomware". After deactivating this I'm able to store the files.

In this tools it is possible to exclude folder or files (see attachment). With excluding my projectfolder everything works as it should.

Now the AVG antivirus is installed again and in the Malwarebytes-tool my project folders excluded from monitoring. With this configuration it works.

Lot of thanks for your help !

If the log files are still interesting for you , with and without activation the Ransomeware protection , than of course I'll try to log this.

best regards "wadhere"


Add: After reboot the the Malwarebyte tool generate the same problem - also with excluding the project folder. So I deactivate this tool complete ...than it works.
Good to know. I am glad you found the reason. Thanks for sharing!

Gesendet von meinem Nexus 6P mit Tapatalk

Title: Re: Error saving file
Post by: BlueHazzard on November 30, 2017, 11:56:33 pm
I will monitor this thread now on a daily basis. Let me know if you need more traces / logs.
If you still have problems, and if you are willing to provide a log, then a log from process explorer (microsoft internals) with a filter on your problematic file would be nice. The problematic file has probably the name "main.c.temp"
Title: Re: Error saving file
Post by: Blacksheep on December 02, 2017, 05:21:28 pm
Confirmed.

Malwarebytes Antiransomware was the problem. Still do not understand why this happened after installing the Windows Creator Update. Malwarebytes Antiransomware was running for a year without issues.

However, problem solved.
Title: Re: Error saving file
Post by: rbatoon on January 09, 2018, 09:44:09 pm
Can also confirm that Malwarebytes Anti-Ransomware was the problem.
Submitting info to Malwarebytes.