Saving game profiles under Vista problem

Blitz3D Forums/Blitz3D Programming/Saving game profiles under Vista problem

MadJack(Posted 2008) [#1]
I'm getting a few reports of people losing their game profile under Vista.

After each level's loaded, the game updates a *.sav file which is stored in a SAVE subdirectory within the game directory (so typically,
C:\Program Files\Steam\steamapps\common\tank universal steamworks edition\saves\...

I understand Vista has a security feature which 'virtualises' file saving in order to keep the program files dir 'inviolable'?


Wings(Posted 2008) [#2]
All i can tell you is this

C:\Program Files\

only admins may write to this folder. those user is probably not admin. and vista has even made it harder as default admin is not admin...


what i trying to say is that storing data in c:\program files is kind of hard.

also this breaks updates.

I created a own map on root C:\MyGame

But after a while the map is locked.. even i have empty it for all it is stil locked. this is visa ! thanks MS for the security !


MadJack(Posted 2008) [#3]
as default admin is not admin...

How do you mean?


Gabriel(Posted 2008) [#4]
I *think* he means that an account with administrative privileges is not the same thing as an administrative account. But I thought that was true of previous versions of Windows too.


LineOf7s(Posted 2008) [#5]
Madjack:

GFK had similar issues about a year ago when he was trying to get his game (at the time, Buzzwords, I believe) to behave "properly" in Vista.

IIRC, the thread turned into a quite informative blow-by-blow account as the forum discovered exactly how this new-fangled Vista thing worked in the context of games. I've not finished reading back through it, so apologies if this is all a load of bananas.

The thread in question is HERE.

(Off topic: Someone mentioned something once about "relative URLs" or something, so if someone was logged in to blitzmax.com and not blitzbasic.com they could still get to the link properly. If anyone remembers that, feel free to remind me what the deal with that was so I can fix the above link)


GfK(Posted 2008) [#6]
This is how I do it, but its for BlitzMax. Not sure how you go about implementing API stuff in Blitz3D but I guess its possible.

Function GetSpecialFolder:String(folder_id) 
	Local  idl:TBank = CreateBank(8) 
	Local  pathbank:TBank = CreateBank (260) 
	If SHGetSpecialFolderLocation(0,folder_id,BankBuf(idl)) = 0		
		SHGetPathFromIDList PeekInt( idl,0), BankBuf(pathbank)
		Return String.FromCString(pathbank.Buf()) + "\"
	EndIf
End Function



What's the folder_id parameter?

Const CSIDL_DESKTOP = $0
Const CSIDL_INTERNET = $1
Const CSIDL_PROGRAMS = $2
Const CSIDL_CONTROLS = $3
Const CSIDL_PRINTERS = $4
Const CSIDL_PERSONAL = $5
Const CSIDL_FAVORITES = $6
Const CSIDL_STARTUP = $7
Const CSIDL_RECENT = $8
Const CSIDL_SENDTO = $9
Const CSIDL_BITBUCKET = $A
Const CSIDL_STARTMENU = $B
Const CSIDL_DESKTOPDIRECTORY = $10
Const CSIDL_DRIVES = $11
Const CSIDL_NETWORK = $12
Const CSIDL_NETHOOD = $13
Const CSIDL_FONTS = $14
Const CSIDL_TEMPLATES = $15
Const CSIDL_COMMON_STARTMENU = $16
Const CSIDL_COMMON_PROGRAMS = $17
Const CSIDL_COMMON_STARTUP = $18
Const CSIDL_COMMON_DESKTOPDIRECTORY = $19
Const CSIDL_APPDATA = $1A
Const CSIDL_PRINTHOOD = $1B
Const CSIDL_LOCAL_APPDATA = $1C
Const CSIDL_ALTSTARTUP = $1D
Const CSIDL_COMMON_ALTSTARTUP = $1E
Const CSIDL_COMMON_FAVORITES = $1F
Const CSIDL_INTERNET_CACHE = $20
Const CSIDL_COOKIES = $21
Const CSIDL_HISTORY = $22
Const CSIDL_COMMON_APPDATA = $23

CSIDL_LOCAL_APPDATA and CSIDL_COMMON_APPDATA are the ones which will likely interest you.