Ignore:
Timestamp:
Aug 16, 2010, 1:06:28 PM (15 years ago)
Author:
Silvan Scherrer
Message:

Samba Server 3.3: fixed ticket 144

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/lib/os2helper.c

    r470 r482  
    9595}
    9696
    97 // we search the path of the .exe and return it
    98 int os2_GetExePath(char *buff)
     97// get the exe name (including path)
     98bool os2_GetExeName(char *sExeName)
    9999{
    100100        APIRET rc = NO_ERROR;
    101         PPIB ppib = NULL;
    102         char sExePath [_MAX_PATH];
    103         char sDrive [_MAX_PATH], sDir [_MAX_DIR];
     101        PPIB ppib = NULL;
    104102
    105103        // we search for the infoblock to get the module name
     
    107105        if (rc != NO_ERROR)
    108106        {
    109                 return -1;
     107                return false;
    110108        }
    111109
    112110        // with the module name we get the path (including the exe name)
    113         rc = DosQueryModuleName(ppib->pib_hmte, sizeof(sExePath), sExePath);
     111        rc = DosQueryModuleName(ppib->pib_hmte, sizeof(sExeName), sExeName);
    114112        if (rc != NO_ERROR)
    115113        {
    116                 return -1;
    117         }
     114                return false;
     115        }
     116        return true;
     117}
     118
     119// we search the path of the .exe and return it
     120int os2_GetExePath(char *buff)
     121{
     122        char sExeName [_MAX_PATH];
     123        char sDrive [_MAX_PATH], sDir [_MAX_DIR];
     124
     125        if (!os2_GetExeName(sExeName))
     126                return false;
    118127
    119128        // we split to the different values
    120         _splitpath(sExePath, sDrive, sDir, NULL, NULL);
     129        _splitpath(sExeName, sDrive, sDir, NULL, NULL);
    121130        // strcat(sDrive, sDir);
    122131        strncat(sDrive, sDir, strlen(sDir) -1);
     
    124133
    125134        return 0;
     135}
     136
     137// we search with the exe name if we are in client mode
     138bool os2_isClient()
     139{
     140        char sExeName [_MAX_PATH];
     141        char sDrive [_MAX_PATH], sDir [_MAX_DIR], sName[_MAX_PATH];
     142
     143        if (!os2_GetExeName(sExeName))
     144                return false;
     145
     146        // we split to the different values
     147        _splitpath(sExeName, sDrive, sDir, sName, NULL);
     148        if ( (stricmp(sName, "NDCTL") == 0) || (stricmp(sName, "EVFSCTL") == 0) )
     149        {
     150                return true;
     151        } else  {
     152                return false;
     153        }
    126154}
    127155
Note: See TracChangeset for help on using the changeset viewer.