%USERNAME% on Windows 95 and 98

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

%USERNAME% on Windows 95 and 98

Yoshiki Ohshima
  Hello,

  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