App crash if not running as Administrator

BlitzMax Forums/BlitzMax Programming/App crash if not running as Administrator

Armitage 1982(Posted 2012) [#1]
I think that since Windows Vista/Seven a few folder are more protected like program files.

Is there a way to bypass this behavior so I can update log files or edit level in my application folder when installed under program files ?

More info and game test : http://blitzmax.com/Community/posts.php?topic=97287

Run Metagolf as Administrator fix the problem but it is somewhat restrictive. And what to think about all those games and softwares that already do this since years and still work.

I probably miss something :)


Htbaa(Posted 2012) [#2]
Yes, use bah.volumes to determine the application directory and store files in there.


Armitage 1982(Posted 2012) [#3]
Thing is it's a crossplatform product.
I like to stick with the same procedure for creating map, log files, saving progress and things like that.
Isn't there any other solution ?

I may also allow people to install the game by default somewhere else but it's just a way around.


Htbaa(Posted 2012) [#4]
yes, bah.volumes. It can find the right directories on Linux, OSX and Windows.


therevills(Posted 2012) [#5]
Maybe check here for Windows:
http://www.blitzbasic.com/Community/posts.php?topic=90125#1024649


xlsior(Posted 2012) [#6]
Thing is it's a crossplatform product.
I like to stick with the same procedure for creating map, log files, saving progress and things like that.
Isn't there any other solution ?


Not really, you should store files in their designated locations -- MS has development guidelines for a reason.

If you choose to ignore them and put your files in semi-random other locations (which includes the actual installation folder itself, after the initial installation) you are almost guaranteed to run into problems that prevent your game from working on some computers -- and if not today, there's a realistic chance that it breaks with the next windows version or service pack.

Maybe inconvenient, but less so than having your game break in the future when it's entirely preventable.


Armitage 1982(Posted 2012) [#7]
Hummm OK.

By default it's working differently on every windows distribution. Quite hard to test such things when you don't have the specific error.

Some people get stuck at setup, fewer at launch time but each time it' a question of damn permission...

I'm even tempted to release the game as a zip file like Gary was suggesting.

So if I'm following you Therevills, I have to set the permission group on my installed folder to everyone ?
I guess it's something I could try with the installer itself. Let's see what we can do. Thanks !


Armitage 1982(Posted 2012) [#8]
I try to create a standard user account to see but a warning normally appears during the installation preventing you from installing the game under a folder without administrator right.

Choosing the user folder as default installation folder fix the problem.

I also try to run the game as simple invited but of course I got the C++ error for whatever permission right.

I never ever in my whole life been a simple users inside Windows, feel strange to create an application folder inside the user/xxxxx/ account...


xlsior(Posted 2012) [#9]
That's one of Microsoft's biggest problems making windows secure: A lot of developers simply force the programs to write in locations they shouldn't by taking shortcuts, or because it 'feels strange'.

If all developers complied with the rules, there would be next to no need to have a normal user run as administrator, and it would be a LOT easier to prevent virusses and malware from infecting your system.

All we can do is try to be part of the solution, rather than perpetuate the problem. :-?


xlsior(Posted 2012) [#10]
And as a final thought: This is also the reason that Microsoft made UAC pretty restrictive when it was first introduced: They were hoping that the nagscreens would force the app developers from getting their act together quickly, and update their software to be compliant with the restrictions.

Instead, it resulted in many users turning the whole thing off altogether, making windows less secure again.


GaryV(Posted 2012) [#11]
I'm even tempted to release the game as a zip file like Gary was suggesting.
I never suggested this, I suggested zipping the setup exe you were distributing on your site.


Armitage 1982(Posted 2012) [#12]
I never suggested this, I suggested zipping the setup exe you were distributing on your site.

Then, it's what I said :0)

I will use the user folder on my next installer release, under mac it's already OK thanks to DMG (through I could add the sandbox stuff, maybe next time) and on linux it's an archive so no problems either.

I'm coming from an old "program files filed with s**t" background.
This explain that :D


GaryV(Posted 2012) [#13]
It is best to play by the rules for each OS. The Windows requirements have actually been there since IE 4 was released for Windows 95, they were just not enforced until Vista was released.

OS X is strict, too and with the new version of OS X, Apple will by default (user can bypass this) not allow games to be installed if they are not sold via Apple's store. Part of the approval process is having your game write to the proper locations.

Pain in the back end, but it is a necessity nowadays. There should be several BMax examples floating around to help you out.