Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
6 registered members (TipmyPip, Niels, dBc, Ed_Love, 3run, 1 invisible), 17,577 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Can 3dgs read from and write to %appdata%? #334501
07/23/10 18:06
07/23/10 18:06
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
We're having the Problem that our game, once installed, won't run on win7 and Vista, seemingly because of administrative rights. We need to write and modify files in the folders. The manual entry on "save_dir" says to change the dir on windows vista.
Now we want to change the dir where everything is saved to the application data, since that's what it's for. Can 3dgs somehow access the %appdata% variable at runtime without any plugins?


~"I never let school interfere with my education"~
-Mark Twain
Re: Can 3dgs read from and write to %appdata%? [Re: Germanunkol] #334503
07/23/10 18:12
07/23/10 18:12
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
The win32 function 'SHGetFolderPath" is what you want. You can pass in environment variables like APPDATA, PROGRAM_FILES, SYSTEM and it will return the path on the current system...

http://msdn.microsoft.com/en-us/library/bb762181(VS.85).aspx

Re: Can 3dgs read from and write to %appdata%? [Re: DJBMASTER] #334511
07/23/10 18:37
07/23/10 18:37
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
Uh, yes. Exactly. Thanks...
How do I access that function in LiteC though? This gives me a syntax error:
HRESULT WINAPI SHGetFolderPath(HWND hwndOwner, int nFolder,HANDLE hToken,DWORD dwFlags,LPTSTR pszPath);
#define PRAGMA_API SHGetFolderPath;Shell32.dll!SHGetFolderPath


~"I never let school interfere with my education"~
-Mark Twain
Re: Can 3dgs read from and write to %appdata%? [Re: Germanunkol] #334512
07/23/10 18:39
07/23/10 18:39
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
just an assumption: you have to specify either SHGetFolderPathA or SHGetFolderPathW

Re: Can 3dgs read from and write to %appdata%? [Re: Joey] #334531
07/23/10 19:46
07/23/10 19:46
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Code:
#include <acknex.h>
#include <default.c>
#include <windows.h>

HRESULT WINAPI SHGetFolderPath(HWND hwndOwner, int nFolder,HANDLE hToken,DWORD dwFlags,char* pszPath);
#define PRAGMA_API SHGetFolderPath;Shell32.dll!SHGetFolderPathA

const int APPDATA = 0x001A;
char buffer[260];

void main()
{
	
	SHGetFolderPath(NULL,APPDATA,0,NULL,buffer);
	error(buffer);
}



Re: Can 3dgs read from and write to %appdata%? [Re: DJBMASTER] #334542
07/23/10 20:29
07/23/10 20:29
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
Perfect. Thank you very much.
I didn't convert LPTSTR into a char* pointer... and SHGetFolderPathA was the other Rroblem. So 0x001A is the value of CSIDL_APPDATA? interesting...


~"I never let school interfere with my education"~
-Mark Twain
Re: Can 3dgs read from and write to %appdata%? [Re: Germanunkol] #334549
07/23/10 21:09
07/23/10 21:09
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Yeh sorry I should have mentioned you have 2 signatures for ansi (SHGetFolderPathA) and unicode (SHGetFolderPathW).

I use this page to find all the CSIDL values...

http://www.pinvoke.net/default.aspx/shell32.shgetfolderpath


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

Gamestudio download | 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