%USERNAME% on Windows 95 and 98

Yoshiki Ohshima yoshiki at squeakland.org
Tue Mar 22 21:38:58 UTC 2005


  Korakurider-san (it is a disguised name; his true identity is kept
secret here) wrote a proposed fix for a problem.  The problem is that
the environment variable %USERNAME% is not usually defined on Windows
95 and 98, so the creation of the untrusted folder wasn't working.

  His change is to replace the line:

  lstrcpy(untrustedUserDirectory, TEXT("C:\\My Squeak\\%USERNAME%"));

in ioInitSecurity with lines like:

/* 2005/3/21 Tooru Nosse:
	Previous code assume environment variable USERNAME
	is defined, though it was not supported on Win95/98.
	That leave %USERNAME% unresolved.
  lstrcpy(untrustedUserDirectory, TEXT("C:\\My Squeak\\"));
  dirLen = lstrlen(untrustedUserDirectory);
  dwSize = MAX_PATH-dirLen;
  GetUserName(untrustedUserDirectory+dirLen, &dwSize);

  I guess that even GetUserName() fails, or even the user name is
null, it doesn't create a bogus folder at least.

-- Yoshiki

More information about the Vm-dev mailing list