Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How reliable/secure are getenv('User') & WScript.Network
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00953302
Message ID:
00954675
Vues:
11
That's an interesting discussion, mind if I join :)

I just tried a simple code. It shows that at the very beginning a FoxPro app reads environmental variables to its internal variables. Whenever you call GETENV(), it does not invoke GetEnvironmentVariable API call.

Here is the code:
CLEAR
CLEAR ALL

DECLARE INTEGER SetEnvironmentVariable IN kernel32 STRING lpName, STRING lpValue

DECLARE INTEGER GetEnvironmentVariable IN kernel32;
	STRING lpName, STRING @lpBuffer, INTEGER nSize

? "Before:"
? GETENV("username")
? gv("username")

? SetEnvironmentVariable("username", "Homer Simpson")

? "After:"
? gv("username")
? GETENV("username")

FUNCTION gv(cName)
	LOCAL cBuffer, nBufsize
	nBufsize=4096
	cBuffer= REPLICATE(CHR(0), nBufsize)
	nBufsize = GetEnvironmentVariable(cName, @cBuffer, nBufsize)
RETURN SUBSTR(cBuffer, 1, nBufsize)
Probably C/C++ debugger may reveal even more interesting details.

Technically, though very much unlikely, someone with sufficient tools and knowledge may start another process that can reach the heap of Visual FoxPro application and change those internal variables.

What was the initial question :) Am I out of topic?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform