From: Geoff Schaller on 30 Jul 2010 20:23 I would like to add that all these 'safe' locations work 100% independently of the UAC setting. "Geoff Schaller" <geoffx(a)softwarexobjectives.com.au> wrote in message news:4c520062$0$12394$c30e37c6(a)exi-reader.telstra.net: > Mario. > > You should not use GetEnv() anything unless you set it, know it exists > and have arranged rights to the folder. Despite Dave Smith's unnecessary > cynicism here, Microsoft made many security enhancements with Vista, > carried on to W7 and you and everyone else would be better served > obeying them. Here is a better way to get the "correct" temp file that > is safe and basically guaranteed to exist: > > FUNCTION GetTempFilePath() AS STRING PASCAL > > LOCAL ptrName AS PTR > LOCAL cResult AS STRING > > // Provides a trailing slash - GCS 02/04/2006 > ptrName := MemAlloc(250) > GetTempPath(250,ptrName) > cResult := Psz2String(ptrName) > MemFree(ptrName) > > RETURN cResult > > Here is how you get all the 'special' locations (but look up the API on > google to get the full list of defines) > > FUNCTION SysInfo_GetFolderLocation(iFolder AS INT) AS STRING PASCAL > LOCAL DIM abFolder[256] AS BYTE > LOCAL iItems IS PTR > > SHGetSpecialFolderLocation(GetDesktopWindow(), iFolder, @iItems) > SHGetPathFromIDList(iItems, @abFolder[1]) > > RETURN LTrim(RTrim(Psz2String(@abFolder))) > > ...and here is an example using this: > > FUNCTION GetMyDocumentsFolder() AS STRING PASCAL > > LOCAL cPath AS STRING > > cPath := SysInfo_GetFolderLocation(CSIDL_PERSONAL) > > RETURN cPath > > You can get all the safe, user specific and public (common area) > locations where you should put data and log files for your applications, > whether they be only for the logged on user or all users of the PC. > > Geoff > > > > > > "Mario Schulz" <info(a)removethiswegenspamconcept-dv.de> wrote in message > news:i2rl45$cek$1(a)online.de: > > > > Hi, > > > > thanks a lot at all for your answers... > > > > one question left .. in our app we put some temp-files in a folder get > > by _cPath := GetEnv("TEMP") ... this folder also seemed to be located at > > "C:\xxxx" ... how we can sure that this folder does not have the same > > problems with win7 for storing files like "C:\ww_win"... > > > > or is that another variable form windows that we must use ? > > > > bye, > > Mario
From: Geoff Schaller on 3 Aug 2010 18:16 <rofl> > I think it's all because the dumbo's there haven't been able to > separate internet attacks from changes the legitimate PC owner and his > programs make. I can see why you aren't employed by anyone to design security. When you download that innocent little trojan and execute it unwittingly, it is YOU making the changes. And all those clever little apps that carry out impersonation of the current user (or administrator) that do the damage. There is no distinction - so who is the dumbo now? Geoff
First
|
Prev
|
Pages: 1 2 3 4 5 Prev: ptr belongs to dynamic memory ??? Next: Errors with dbFileSpec Create |