   Vista and running games on it
  Hi, I have spent too many hours trying to get my game to run on Vista without forcing players to manually choose "Run as Administrator" by removing unnecessary file creation at the start of the game, and replacing all "std::fstream" with "std::ifstream" when I only needed to read the files.  The problem really only occurs when the game is installed in the Program Files directory.  I don't think I can code it to the point of forcing them to run as admin (and if they're not, have them enter the password or whatever the standard vista option is) - if I can, this will probably solve all my issues.My concern now comes with the issue of 1) Screen shots, 2) interface files (i.e., the positions of menus, hotkeys, toolbar settings, etc).  Those are saved at the end of the program or when a player presses PrtSc.  I record screenshots purely through directX 9 (I can post the code if you'll be able to tell if its Vista friendly or not).I am not 100% concerned with the others, as I can have buttons (like spells) be stored on the server, and sent on login, as it is not very much memory, probably 10-20 bytes is all I'd need to send.  I am also not completely concerned with hotkeys, as this can ALSO be stored on the server, but I'd like to keep it as local as possible.  This stuff is saved at the end of the game, when they quit.Thanks for any help, I now hate Vista because of this.  I am fortunate that I had a spare Vista lap top sitting around that allowed me to test it easily without constantly sending my game to friends.   
  Use the "home folder" that you are allowed to write in.Check out SHGetFolderLocation or SHGetKnownFolderIDLis (vista only) functions.There doesn't seem to be a standard convention yet, some games like to put data in C:/Users/<username>/Documents/My Games, some in C:/Users/<username>/AppData   ;Quote:Original post by CrazyfoolThanks for any help, I now hate Vista because of this.  I am fortunate that I had a spare Vista lap top sitting around that allowed me to test it easily without constantly sending my game to friends.Your app is broken if it requires writing to Program Files. The fact that it works on Windows XP is due to most users running with administrator privileges. I was one of the XP users who ran as standard user, so your game would've been broken for me even then.If you want to work with string paths instead of PIDLs, you can use SHGetFolderPath.Quote:Original post by marsongThere doesn't seem to be a standard convention yet, some games like to put data in C:/Users/<username>/Documents/My Games, some in C:/Users/<username>/AppDataRaymond Chen describes the difference here.   ;  There is a pretty good article on msdn addressing this problem:User Account Control for Game Developers;  Using C:\Users\<username> aka %HOMEDRIVE%%HOMEPATH%  would solve this problem or you can even go the World of Warcraft solution to the problem and use C:\Users\Public\Games   ;Quote:Original post by mutexYour app is broken if it requires writing to Program Files. The fact that it works on Windows XP is due to most users running with administrator privileges. I was one of the XP users who ran as standard user, so your game would've been broken for me even then.If you want to work with string paths instead of PIDLs, you can use SHGetFolderPath.Quote:Original post by marsongThere doesn't seem to be a standard convention yet, some games like to put data in C:/Users/<username>/Documents/My Games, some in C:/Users/<username>/AppDataRaymond Chen describes the difference here.Well, that seems a bit strong to say.  I have never played a game that did not write screen shots to the program folder. Never.  I am not saying that they did it wrong, but it pretty much set a precedent for gamers to expect the same functionality.  I am sure there are games that save screen shots to other folders, probably now more since Vista has taken on more popularity.  Just look at it from my position - I am only trying to follow what other games have done.  No matter how bad the practice, I think its best to keep the convenient things players expect to be consistent.  Tab is my auto target, num pad will be auto run, right clicking on a target will attack them, etc.  Thats what players expect.With that being said, I have no other option I just wanted to defend my 'broken' app ;p   ;  The problem lies in the fact that Windows XP and Vista use a different security model from Windows '95 which is where the writing data into the Program Files directory convention came into place (when security policies were pitiful if they even existed). The NTFS filesystem has far superior security policies (as compared to Win95) and non-admin users are only allowed free access to a few directories.You have two options -- you can either write the Users directory using API calls or you can install the game into the root directory (e.g., c:\yourAppName) which is the method that WoW uses if it's not in the Program Files directory.Personally I hate this as it's very *nix in style but this is not new and can hardly be blamed on Vista -- all of this started with the advent of NT 4.0 and Windows 2000 (not sure about Me but I'm pretty sure it was a GUI overhaul of '95 but either way it's irrelevant at this point). Vista just enforces it more thoroughly.   ;Quote:Original post by marsongThere doesn't seem to be a standard convention yet, some games like to put data in C:/Users/<username>/Documents/My Games, some in C:/Users/<username>/AppDataIf you are on Vista and wish to store data in the user's Documents area, please use the known folder FOLDERID_SavedGames, and not some horrible My-prefixed folder. [smile]   ;Quote:Original post by CrazyfoolWell, that seems a bit strong to say.  I have never played a game that did not write screen shots to the program folder. Never.  I am not saying that they did it wrong, but it pretty much set a precedent for gamers to expect the same functionality.  I am sure there are games that save screen shots to other folders, probably now more since Vista has taken on more popularity.  Just look at it from my position - I am only trying to follow what other games have done.  No matter how bad the practice, I think its best to keep the convenient things players expect to be consistent.  Tab is my auto target, num pad will be auto run, right clicking on a target will attack them, etc.  Thats what players expect.With that being said, I have no other option I just wanted to defend my 'broken' app ;pSticking with something, anything, just because "that's the way its always been done" is a terrible excuse for anything. The fact that Windows defaulted users to admin privileges for most of its lifespan, allowing ordinary users to write anywhere they please willy-nilly, and that uninformed or lazy devs took advantage of that in the past has left windows with many security attack vectors, as well as system-wide stability issues.Windows has finally gotten around to doing The Right Thing, and now its up to developers to play along. Its unfortunate, but we should really be blaming the problem (that admin rights were default in the past) rather than the solution (taking them away) -- In reality, its not your app that is broken, but all the others. We certainly shouldn't be compromising security and stability just to allow a loophole for games to write screenshots to their program folder.Conventions are great and all, but a broken convention just perpetuates flawed practices, entrenching them even deeper -- its best to root them out as early as possible before the "infection" has spread, and consequences are milder.   