till213 / SkyDolly

Sky Dolly connects with Flight Simulator 2020 and records the flight path and basic instruments for replay.
MIT License
79 stars 10 forks source link

Logbbok cannot be created / opened #119

Closed PhilM5253 closed 11 months ago

PhilM5253 commented 1 year ago

re our previous conversations ...

I am using SD v0.16.3

No - as far as I can see / tell - SD is NOT creating a log file, that I can ever find, in any location, via File Explorer.

What seems to be happening (to my untutored eye) is that SD is running a check to see if there is an existing log file: that would be loaded if present, both to be available for use and to prevent a new, default file being opened which would (?) overwrite the existing file.

On first use, there is no existing log file, and so SD correctly (?) shows an error message that no file exists.

If (?) SD should then create a new, default file for use, is it that next step that is not happening?

And, as said before, I cannot manually create a new file either.

In trying to open, create and save a log file, file explorer can never 'see' a *.sdlog file with which to perform any operation.

Is the first, correct (?) error message that no file exists on opening somehow stopping the create / save file actions from working as expected?

As noted in the other issue post, SD IS creating Registry entries on my system: it was that info that was in my screenshot (posted here also for ease of reference): I don't have any idea what the Registry entries should look like or contain, but I thought they might help explain was is / is not happening?

Screenshot skydolly regedit
till213 commented 1 year ago

Hello,

Thank you for reporting this issue! In fact, I can now reproduce this issue (even on Windows 10), and it is as I had thought: the issue is related to "ransomware protection", as introduced by Windows 10:

https://support.microsoft.com/de-de/topic/schutz-vor-ransomware-in-windows-security-445039d6-537a-488a-ad53-48906f346363

(The URL points to the German site, but I am sure there is a "language selector" somewhere on that site)

In any case, "ransomware protection" (specifically: "protected folder access") was disabled in my case. I have now enabled it, and after having made sure that "SkyDolly.exe" is not in the list of "allowed applications" I can now reproduce the "file not found" issue:

grafik

And then, while trying to create a new logbook (CTRL + N) in my (now protected) "documents" folder:

grafik

However it should be possible to create new logbooks in non-protected folders, such as c:\temp (that I have created previously):

grafik

One way (workaround? By Windows design?) to allow SkyDolly.exe to create logbooks in any protected folder is to add it to the list of "allowed applications":

grafik

The easiest way is to choose "last blocked app":

grafik

And then select SkyDolly.exe (with the appropirate path where you have unzipped it):

grafik

At this point you need to make a concious decision, by trusting the app SkyDolly.exe (and in general for any other app that you add to this list): SkyDolly.exe now will get access (both read and write) to your protected folders, such as your "documents" folder. Click on the "+" (plus) button to add the app to the list of "allowed apps".

Again, the alternative is not to give SkyDolly.exe any permission, and store your logbooks to a non-protected folder (such as c:\temp, or any better named folder). This is a decision you must make.

If you have decided to add SkyDolly.exe to the list of "allowed apps" then your list should look something like this:

grafik

(Again, with corresponding paths)

Once you have done so you should then be able to create your logbook in your "documents" (or any other protected) folder:

grafik

I will keep this issue open for now, as I think the process should be smoother: I would expect Windows to ask for permission once you try (via the file selector) to create a folder / file anywhere in a protected folder. I assume (have to re-read the Windows API documentation) that this is related to the so-called "manifest" files: XML documents that are typically embedded into the executable (here: SkyDolly.exe). Hence my initial reference to the other issue, that might also be related to the currently embedded (and "generic") XML manifest file.

But do let me know if adding SkyDolly.exe (if you decide to do so) to the list of "allowed applications" does help already in your case!

I am aware that the above screenshots are Windows 10 specific - I hope you figure out the corresponding settings in Windows 11 ;)

till213 commented 1 year ago

Apparently "controlled folder access" has more to do with "trusted" vs "untrusted" apps rather than manifest files. Sky Dolly is not "digitally signed" (a digital signing certificate costs hundreds of dollars every other year), so I guess that makes it an "untrusted" app.

Or in other words: there is probably little I can do "in a programmatic way" (by providing a corresponding manifest file, that is).

Also refer to:

https://www.computerworld.com/article/3665694/windows-controlled-folder-access-think-twice-before-deploying.html

So while I will do more research whether I can still make an app "trustworthy" (by providing a proper manifest) I now tend to say that "this is simply by design": if you enable "controlled folder access" (that might be enabled by default on Windows 11 now? But then again, I would have received many more reports from Windows 11 users...) then it is up to the user to check the Windows notifications and add the app to the "trusted apps" list, as outlined above.

till213 commented 1 year ago

And this is what "ChatGPT" has to say about the topic:

https://zzzcode.ai/answer-question?id=7a954536-bfac-4829-9ae9-fd5eef044254

Pretty much sums up what I wrote above. And (except for making the app "trustworthy", which I guess means to have it digitally signed by Microsoft respectively a Certificate Authority (CA) that is trusted by Windows) there does not seem to be another (programmatic) way...

I'll investigate some more (as having a proper manifest file embedded into the executable is a good think anyway). But don't hold your breath: the above manual steps ("add Sky Dolly to the list of trusted apps that may write into your documents folder) may be the final solution in the end.

PhilM5253 commented 1 year ago

Hi thanks for all of your work on this, and for your help: I hope that it has been of some use to you also!

I am sorted now: no reccordings yet (!), but SD has now created a default logbook for me on opening.

I could not make it work on a new logbook by e.g. creating then trying use a 'public' folder like C:/temp ... that still did not work.

I dont know if my 'public' folder of that type is somehow still protected? But it still looked like SD wasn't even creating the new log file, as the Win 11 save dialogue box could not 'see' a file to save?

But I have added SD as my first item on a list to 'add an allowed app' 'through controlled folder access' in Win 11.

Making this change and then starting SD has created the log file, and I now have an active (not greyed out) 'record' button within the SD UI.

Now I just need to make the time to do some MSFS flying, and record it!

Thanks again for your help, and for making SD in the first place.

PhilM5253 commented 1 year ago

I now have my first recording ... brilliant!

till213 commented 1 year ago

"I now have my first recording ... brilliant!"

That's great to hear :)

To summarise the above:

I have checked with several apps, such as Qt Creator (the development tool that I use, naturally also written with the Qt toolkit), Little Navmap (https://albar965.github.io/littlenavmap.html) and DB Browser for SQLite (https://sqlitebrowser.org/).

Qt Creator and DB Browser for SQLite are actually code-signed, so they can write into the "documents" folder. Little Navmap on the other hand (also a Qt application, by the way) is not code-signed: when trying to export the flight path as CSV file into the documents folder I get the exact same "file not found" dialog.

The thing with code-signing: this costs money: every other year. DB Browser for SQLite is code-signed with a certificate "for open source developers" (by https://www.certum.eu/en/), but that also costs 25 EUR yearly. Plus the one-time costs for a "card reader" and "encryption card" (that I don't know). So this is currently a bit too much investment into Sky Dolly on my part - at least for the time being. This is not a "categorical no", but again: currently no plans to do so at this stage.

I will keep this issue open and close it once I have my custom "manifest" (XML) file that claims compatibility with "Windows 10 and 11" and claims "no administrator rights required" (so having such a manifest is a good thing in any case), but again, this won't have any impact on the "trust level" of the application (I earlier thought that it would be possible to claim also "access to the documents folder", but apparently I misread this: this was for another configuration file (not "manifest files") for "univeral applications" that are distributed via the Microsoft Store - or so...).

Clarification: I earlier wrote that "controlled folder access" would also protect the folders from reading: this was wrong. "Controlled folder access" is only about writing (or change existing files) into such "controlled folders". Essentially this is to prevent "ransomware" from encrypting ("modifying = writing") your personal files.

PhilM5253 commented 1 year ago

Thanks for the clarifications / confirmations, and thanks again for your help and support.

till213 commented 11 months ago

I am now closing this issue, with the following summary: