Ignore:
Timestamp:
Apr 29, 2000, 8:26:59 PM (25 years ago)
Author:
sandervl
Message:

init changes, export for installation program, create additional directories & registry keys, added lvl2 debug log feature, override for windows dir re-added

File:
1 edited

Legend:

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

    r3375 r3461  
    1 /* $Id: directory.cpp,v 1.19 2000-04-14 22:35:26 sandervl Exp $ */
     1/* $Id: directory.cpp,v 1.20 2000-04-29 18:26:58 sandervl Exp $ */
    22
    33/*
     
    6363void InitDirectories()
    6464{
    65         GetWindowsDirectoryA((LPSTR)&DIR_Windows, sizeof(DIR_Windows));
    66         GetSystemDirectoryA((LPSTR)&DIR_System, sizeof(DIR_System));
    67 }
    68 
     65 char *endofwinpath, *tmp;
     66 int   len;
     67
     68   strcpy(DIR_System, kernel32Path);
     69   len = strlen(DIR_System);
     70   if(DIR_System[len-1] == '\\') {
     71        DIR_System[len-1] = 0;
     72   }
     73   len = ODIN_PROFILE_GetOdinIniString(ODINDIRECTORIES,"WINDOWS","",DIR_Windows,sizeof(DIR_Windows));
     74   if (len > 2) {
     75        if(DIR_Windows[len-1] == '\\') {
     76                DIR_Windows[len-1] = 0;
     77        }
     78   }
     79   else {
     80        strcpy(DIR_Windows, DIR_System);
     81        endofwinpath = tmp = strchr(DIR_Windows, '\\');
     82        while(tmp) {
     83                tmp = strchr(endofwinpath+1, '\\');
     84                if(tmp)
     85                        endofwinpath = tmp;
     86        }
     87        if(endofwinpath) {
     88                *endofwinpath = 0; //remove \SYSTEM32
     89        }
     90        else DebugInt3();
     91   }
     92}
    6993/*****************************************************************************
    7094 * Name      : GetCurrentDirectoryA
     
    231255                                       UINT,uSize)
    232256{
    233   char buf[255];
    234   int  len;
    235 
    236         lstrcpynA(buf, kernel32Path, sizeof(buf)-1);
    237         len = lstrlenA(buf);;
    238         if(buf[len-1] == '\\') {
    239                 buf[len-1] = 0;
    240                 len--;
    241         }
     257 int   len;
     258 char *dir;
     259
     260        dir = InternalGetSystemDirectoryA();
     261        len = lstrlenA(dir);
    242262        if(lpBuffer)
    243                 lstrcpynA(lpBuffer, buf, uSize);
     263                lstrcpynA(lpBuffer, dir, uSize);
    244264        return len;
    245265}
     
    265285
    266286  if(lpBuffer)
    267         asciibuffer = (char *)malloc(uSize+1);
     287        asciibuffer = (char *)alloca(uSize+1);
     288
     289  if(lpBuffer && asciibuffer == NULL) {
     290        DebugInt3();
     291  }
    268292
    269293  rc = GetSystemDirectoryA(asciibuffer, uSize);
     
    271295        AsciiToUnicode(asciibuffer, lpBuffer);
    272296
    273   if(asciibuffer)
    274         free(asciibuffer);
    275297  return(rc);
    276298}
     
    292314                                        UINT,uSize)
    293315{
    294   static int fWindirExists = FALSE;
    295   CHAR  buf[255];
    296   int   len;
    297  
    298         //SvL: Use path of kernel32.dll instead of calling Open32 api (which returns \OS2\SYSTEM)
    299         lstrcpynA(buf, kernel32Path, sizeof(buf)-1);
    300         strcat(buf, "WIN");
    301         if(!fWindirExists) {
    302                 O32_CreateDirectory(buf, NULL);
    303                 fWindirExists = TRUE;
    304         }
    305 
    306         len = lstrlenA(buf);;
    307         if(buf[len-1] == '\\') {
    308                 buf[len-1] = 0;
    309                 len--;
    310         }
     316 char *dir;
     317 int   len;
     318
     319        dir = InternalGetWindowsDirectoryA();
     320        len = lstrlenA(dir);
    311321        if(lpBuffer)
    312                 lstrcpynA(lpBuffer, buf, uSize);
     322                lstrcpynA(lpBuffer, dir, uSize);
    313323        return len;
    314324}
     
    334344
    335345  if(lpBuffer)
    336         asciibuffer = (char *)malloc(uSize+1);
     346        asciibuffer = (char *)alloca(uSize+1);
     347
     348  if(lpBuffer && asciibuffer == NULL) {
     349        DebugInt3();
     350  }
    337351
    338352  rc = GetWindowsDirectoryA(asciibuffer, uSize);
     
    340354        AsciiToUnicode(asciibuffer, lpBuffer);
    341355
    342   if(asciibuffer)
    343         free(asciibuffer);
    344356  return(rc);
    345357}
Note: See TracChangeset for help on using the changeset viewer.