Live data from Hacker News

Dotfile madness

0x46.net

491–500 of 534 posts

Re: Dotfile madness

#491
post #421

Earlier quoted context omitted.

> Part of the problem in Windows is that Program Files is write protected for security, so you can't store a local configuration file relative to the exe. So where does it go? This hasn't been a problem since the first version of Windows that had a filesystem with such protections - that would be Windows NT 3.1. The correct location for such stuff is %USERPROFILE%\AppData\Roaming or ...\Local, depending on whether th…

> The problem is that so many apps just straight up ignore all those guidelines. The fact it happens so often suggests that the documentation isn't good enough. > Of course. At least Apple's pages is pretty clear and has some nice diagrams. I think this page is more appropriate: https://docs.microsoft.com/en-us/windows/desktop/shell/csidl It's reasonably well documented for UWP, though I can't find an equivalent for…

> The fact it happens so often suggests that the documentation isn't good enough.

Any library or framework author knows that documentation is never enough. ~ On Windows, though, there's also historical reasons - back in Win9x days, there was no practical reason for apps to bother if they didn't anticipate running on NT, which is why it was so common to just dump configs next to the .exe (and even to this day, Windows uses FS virtualization to make this work for old apps). When 2K and especially XP became popular, and everyone was rapidly porting their stuff, people often didn't bother looking up docs and all, and just used the "least significant change" approach to fixing things. And that kind of set the background for later - why bother being nice, if nobody else does?

> I think this page is more appropriate: https://docs.microsoft.com/en-us/windows/desktop/shell/csidl

This page describes pre-Vista, deprecated APIs. Unless you need to target XP, a desktop app should use the known folder mechanism.

Re: Dotfile madness

#492

Earlier quoted context omitted.

Well, the hidden-bit on Windows is really semantically equivalent to dot-prefix on Unix, and people set up their file managers to show such files for similar reasons (I don't even use Explorer, mostly). In Win10, it's even exposed as a setting in Settings | For Developers

What do you use in lieu of Explorer, out of curiosity? 15 year Mac user (re)exploring Windows due to bad hardware...

For actual file management, and generally working in the terminal, I'm firmly in the "two blue panes" club, so it's Far Manager on Windows (and Midnight Commander on Linux). Far is probably the most advanced text-mode file manager in general right now.

https://www.farmanager.com/screenshots.php?l=en

Re: Dotfile madness

#493

Earlier quoted context omitted.

Sure but in the non-game software world we'd do a runtime check to see if the OS was Vista or later and fallback if not.

You can't do it as a runtime check. You have to compile the software with the flags to import and link to the latest windows library. The program will hard crash if run on an older version. I just tried to use the API. I literally couldn't find a working example on the internet in 2 hours so I guess noone figured it out in a decade. Wrote https://stackoverflow.com/a/54499257/5994461

What's wrong with calling IsWindowsVistaOrGreater[0]?

[0] https://docs.microsoft.com/en-us/windows/desktop/api/version...

Re: Dotfile madness

#494

Earlier quoted context omitted.

There's an entire research field dedicated to the information flow control which could solve just that (if it were actually used). In my research team, we used a tainting tracing mechanism to understand the behavior of malware. Basically, we installed a malware on a clean phone and we then traced all information flow originating from the APK to processes, to files, to sockets, etc. It helped reverse-engineering the m…

Any interesting links to papers?

There's the work by Myers and Liskov which is quite central to the whole field: https://dl.acm.org/citation.cfm?id=266669, there's Flume: https://dl.acm.org/citation.cfm?id=1294293, DStar https://www.usenix.org/event/nsdi08/tech/full_papers/zeldovi.... More recently, on Android: https://www.usenix.org/system/files/conference/usenixsecurit.... And this (disclaimer: I'm the main author): https://link.springer.com/chapter/10.1007/978-3-319-66197-1_....

Re: Dotfile madness

#496

Earlier quoted context omitted.

You can't do it as a runtime check. You have to compile the software with the flags to import and link to the latest windows library. The program will hard crash if run on an older version. I just tried to use the API. I literally couldn't find a working example on the internet in 2 hours so I guess noone figured it out in a decade. Wrote https://stackoverflow.com/a/54499257/5994461

What's wrong with calling IsWindowsVistaOrGreater[0]? [0] https://docs.microsoft.com/en-us/windows/desktop/api/version...

You won't have the chance to call anything. If the executable is statistically linked to the latest API, the executable won't be able to load on older systems.

I'm surprised that these new IsWindows...() functions claim compatibility down to Windows 2000. Doubt microsoft knew how they would name their next release 20 years ago. A Google search indicates that they are in fact broken.

Re: Dotfile madness

#497
post #463

Earlier quoted context omitted.

The first software I ever sold online was an app that would change the creator code of a file to whatever application you wanted. For some reason, there was no obvious built-in way to do that in Mac OS 8 (besides opening the document in the other application and saving it, or changing it in ResEdit). I only ever sold one license, but I was 12, so I was pretty excited.

If that can be done, doesn't it defeat the purpose here? Anything can create a file, and then change this tag to 'system' or whatever.

But why would they?

Re: Dotfile madness

#498
post #463

Earlier quoted context omitted.

The first software I ever sold online was an app that would change the creator code of a file to whatever application you wanted. For some reason, there was no obvious built-in way to do that in Mac OS 8 (besides opening the document in the other application and saving it, or changing it in ResEdit). I only ever sold one license, but I was 12, so I was pretty excited.

If that can be done, doesn't it defeat the purpose here? Anything can create a file, and then change this tag to 'system' or whatever.

Mac OS 8 dates to the 90s. Nowadays these things are probably public key signed, but back then they probably were not.

Re: Dotfile madness

#499

Earlier quoted context omitted.

Well, the hidden-bit on Windows is really semantically equivalent to dot-prefix on Unix, and people set up their file managers to show such files for similar reasons (I don't even use Explorer, mostly). In Win10, it's even exposed as a setting in Settings | For Developers

What do you use in lieu of Explorer, out of curiosity? 15 year Mac user (re)exploring Windows due to bad hardware...

Directory Opus.

https://www.gpsoft.com.au/

Re: Dotfile madness

#500

Earlier quoted context omitted.

What's wrong with calling IsWindowsVistaOrGreater[0]? [0] https://docs.microsoft.com/en-us/windows/desktop/api/version...

You won't have the chance to call anything. If the executable is statistically linked to the latest API, the executable won't be able to load on older systems. I'm surprised that these new IsWindows...() functions claim compatibility down to Windows 2000. Doubt microsoft knew how they would name their next release 20 years ago. A Google search indicates that they are in fact broken.

You won't be able to compile with the function imported using the modern lib (because it doesn't exist on XP) but you can conditionally link it at runtime with LoadLibrary/GetProcAddress.

If IsWindows... doesn't work then you can use the VerifyVersionInfo function directly.

Post reply on HN