Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Nymphodora), 485 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Write txt in program files, not allowed in vista! #296777
11/02/09 22:12
11/02/09 22:12
Joined: Nov 2003
Posts: 433
The Netherlands
T
Toon Offline OP
Senior Member
Toon  Offline OP
Senior Member
T

Joined: Nov 2003
Posts: 433
The Netherlands
Code:
var save_handle;

function save_settings()
{		
  save_handle = file_open_write("resolution.txt");
	
  file_var_write(save_handle,resolution);

  file_close(save_handle);
}



We made a save system in our game based on code like this right up here. We really want to install the game in the program files folder but Vista seems to have a problem with reading and writing files like that in that folder.

It says "Empty pointer in"E1415, invalid pointer or handle in".

Anyone knows a solution to this?

Re: Write txt in program files, not allowed in vista! [Re: Toon] #296955
11/03/09 23:15
11/03/09 23:15
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline
Serious User
Lion_Ts  Offline
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
Vista has the UAC rules, you should write your data to specific folders only (%USERPROFILE%\AppData\Local, for example), or you have to modify your installer to allow "program files" folder access for your application (this is the very bad way).
btw, under xp or win2k we have the specific places to store an application data too (like "Documents and Settings\All Users\Application Data", for example).
Refer to msdn, please; look for the SHGetKnownFolderPath (SHGetFolderPath).

Re: Write txt in program files, not allowed in vista! [Re: Lion_Ts] #297285
11/06/09 14:51
11/06/09 14:51
Joined: Nov 2003
Posts: 433
The Netherlands
T
Toon Offline OP
Senior Member
Toon  Offline OP
Senior Member
T

Joined: Nov 2003
Posts: 433
The Netherlands
Thanks for your reply.

Are prefixes like %USERPROFILE% possible in gamestudio path descriptions?

Re: Write txt in program files, not allowed in vista! [Re: Toon] #297322
11/06/09 19:16
11/06/09 19:16
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline
Serious User
Lion_Ts  Offline
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
There is nothing to do with that shell variable (prefix) under GS. Actually, you can obtain the value of that variable, but there is more convenient way. Look at SHGetFolderPath. You can call it to obtain the right place to store your data.

Re: Write txt in program files, not allowed in vista! [Re: Lion_Ts] #297329
11/06/09 20:12
11/06/09 20:12
Joined: Oct 2006
Posts: 470
Balkan
Ganderoleg Offline
Senior Member
Ganderoleg  Offline
Senior Member

Joined: Oct 2006
Posts: 470
Balkan
Ups this is news to me- I have exactly the same save system as this one frown
My txt files are in the same folder as exe and I had no problem under Xp but haven't test it under Vista.

Is there same example in C-Script on how this can be fixed ( I don't really understand how to use information from suggested link (SHGetFolderPath))?


>>Demos free3DModels Tutorials<<
>>>>>>> by Pavle Nikolic <<<<<<<

Re: Write txt in program files, not allowed in vista! [Re: Ganderoleg] #297340
11/06/09 21:40
11/06/09 21:40
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655

Code:
var save_handle = 0;

function save_settings() {		
	save_handle = file_open_write("resolution.txt");
	if (save_handle == 0) { 
		error("Hello user.  A save system error has occurred.");
		error("To resolve this issue, you might try to 'revert' to a 'better' OS or modify user priviledges for folder n.");
		error("We recommend that you send a report to Microsoft and then go try to make better use of your time.");
		error("Why are you still here?");
		return;
	}
	file_var_write(save_handle,resolution);
	file_close(save_handle);
}



Quoting Ganderoleg.
Quote:
Is there same example in C-Script on how this can be fixed...



Indeed, that wasn't it.


point @ idea fair & obvious = check return value

Re: Write txt in program files, not allowed in vista! [Re: testDummy] #297346
11/06/09 22:21
11/06/09 22:21
Joined: Oct 2006
Posts: 470
Balkan
Ganderoleg Offline
Senior Member
Ganderoleg  Offline
Senior Member

Joined: Oct 2006
Posts: 470
Balkan
smile smile O.k. but I'm not sure about the point thing: return value? ...of what? I have txt files already present in the exe folder. Is this a problem with all Vista versions?


>>Demos free3DModels Tutorials<<
>>>>>>> by Pavle Nikolic <<<<<<<

Re: Write txt in program files, not allowed in vista! [Re: Ganderoleg] #297362
11/07/09 00:12
11/07/09 00:12
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline
Serious User
Lion_Ts  Offline
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
This is not a problem. This is the feature laugh
If you have the GS7 then you can call the SHGetFolderPath function (contained in the shell32.dll version 5.0 or later) using liteC language, save returned path string, concatenate it with you file name and do what you need. If you're using older GS version then you can build "wrapper" dll for some needed OS/shell interfaces to call the wrapper from C-script. That's all...

Re: Write txt in program files, not allowed in vista! [Re: Lion_Ts] #297365
11/07/09 00:45
11/07/09 00:45
Joined: Oct 2006
Posts: 470
Balkan
Ganderoleg Offline
Senior Member
Ganderoleg  Offline
Senior Member

Joined: Oct 2006
Posts: 470
Balkan
Thanx for reply. Can way to do this be found in the manual? I have no idea on how to make wrapper dll frown
I am using a small proportion of Lite-C with C-Script in my game but only for PP Effects. They can't share variables as I remember.

Can some free dll of this kind be found on the forum? I can't believe that no one needs this feature.


>>Demos free3DModels Tutorials<<
>>>>>>> by Pavle Nikolic <<<<<<<

Re: Write txt in program files, not allowed in vista! [Re: Lion_Ts] #299760
11/26/09 17:13
11/26/09 17:13
Joined: Nov 2003
Posts: 433
The Netherlands
T
Toon Offline OP
Senior Member
Toon  Offline OP
Senior Member
T

Joined: Nov 2003
Posts: 433
The Netherlands
How to create such a dll? I tryed the regular savesystem (gamestudio) as well but also without results.

Is there no other way to check for the users paths in c-script? Or perhaps a way to share variables between the two languages?

confused Can anyone tell me how to save files from an .exe that is started in the program files folder on a Vista with c-script...

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1