Ignore:
Timestamp:
Apr 15, 2000, 12:35:29 AM (25 years ago)
Author:
sandervl
Message:

GetFileAttributes, pe loader & command line fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/directory.cpp

    r3347 r3375  
    1 /* $Id: directory.cpp,v 1.18 2000-04-07 19:43:46 sandervl Exp $ */
     1/* $Id: directory.cpp,v 1.19 2000-04-14 22:35:26 sandervl Exp $ */
    22
    33/*
     
    1313 *
    1414 * Copyright 1995 Alexandre Julliard
     15 *
     16 * TODO: System/window directories should be created by install program!
    1517 *
    1618 * Project Odin Software License can be found in LICENSE.TXT
     
    229231                                       UINT,uSize)
    230232{
    231   LPSTR lpstrEnv = getenv("WIN32.DIR.SYSTEM");          /* query environment */
    232   CHAR  buf[255];
    233 
    234   if (lpstrEnv != NULL)
    235   {
    236         if(lpBuffer)
    237                 lstrcpynA(lpBuffer, lpstrEnv, uSize);
    238 
    239         return (lstrlenA(lpstrEnv));                /* return number of copies bytes */
    240   }
    241   else
    242   {
    243     int len;
    244 
    245     len = ODIN_PROFILE_GetOdinIniString(ODINDIRECTORIES,"SYSTEM","",buf,sizeof(buf));
    246     if (len > 2) {
    247         if(buf[len-1] == '\\') {
    248                 buf[len-1] = 0;
    249                 len--;
    250         }
    251         if(lpBuffer)
    252                 lstrcpynA(lpBuffer, buf, uSize);
    253 
    254         return len;
    255     }
    256     else {//SvL: Use path of kernel32.dll instead of calling Open32 api (which returns \OS2\SYSTEM)
    257         lstrcpynA(buf, kernel32Path, sizeof(buf)-1);
     233  char buf[255];
     234  int  len;
     235
     236        lstrcpynA(buf, kernel32Path, sizeof(buf)-1);
    258237        len = lstrlenA(buf);;
    259238        if(buf[len-1] == '\\') {
     
    264243                lstrcpynA(lpBuffer, buf, uSize);
    265244        return len;
    266     }
    267   }
    268245}
    269246
     
    315292                                        UINT,uSize)
    316293{
    317   LPSTR lpstrEnv = getenv("WIN32.DIR.WINDOWS");         /* query environment */
     294  static int fWindirExists = FALSE;
    318295  CHAR  buf[255];
    319 
    320   if (lpstrEnv != NULL)
    321   {
    322         if(lpBuffer)
    323                 lstrcpynA(lpBuffer, lpstrEnv, uSize);
    324 
    325         return (lstrlenA(lpstrEnv));                /* return number of copies bytes */
    326   }
    327   else
    328   {
    329     int len;
    330 
    331     len = ODIN_PROFILE_GetOdinIniString(ODINDIRECTORIES,"WINDOWS","",buf,sizeof(buf));
    332     if (len > 2) {
    333         if(buf[len-1] == '\\') {
    334                 buf[len-1] = 0;
    335                 len--;
    336         }
    337         if(lpBuffer)
    338                 lstrcpynA(lpBuffer, buf, uSize);
    339 
    340         return len;
    341     }
    342     else {//SvL: Use path of kernel32.dll instead of calling Open32 api (which returns \OS2\SYSTEM)
    343 
     296  int   len;
     297 
     298        //SvL: Use path of kernel32.dll instead of calling Open32 api (which returns \OS2\SYSTEM)
    344299        lstrcpynA(buf, kernel32Path, sizeof(buf)-1);
    345300        strcat(buf, "WIN");
    346         O32_CreateDirectory(buf, NULL);
     301        if(!fWindirExists) {
     302                O32_CreateDirectory(buf, NULL);
     303                fWindirExists = TRUE;
     304        }
    347305
    348306        len = lstrlenA(buf);;
     
    354312                lstrcpynA(lpBuffer, buf, uSize);
    355313        return len;
    356     }
    357   }
    358314}
    359315
Note: See TracChangeset for help on using the changeset viewer.