Changeset 482 for branches/samba-3.3.x/source/lib
- Timestamp:
- Aug 16, 2010, 1:06:28 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/lib/os2helper.c
r470 r482 95 95 } 96 96 97 // we search the path of the .exe and return it98 int os2_GetExePath(char *buff)97 // get the exe name (including path) 98 bool os2_GetExeName(char *sExeName) 99 99 { 100 100 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; 104 102 105 103 // we search for the infoblock to get the module name … … 107 105 if (rc != NO_ERROR) 108 106 { 109 return -1;107 return false; 110 108 } 111 109 112 110 // with the module name we get the path (including the exe name) 113 rc = DosQueryModuleName(ppib->pib_hmte, sizeof(sExe Path), sExePath);111 rc = DosQueryModuleName(ppib->pib_hmte, sizeof(sExeName), sExeName); 114 112 if (rc != NO_ERROR) 115 113 { 116 return -1; 117 } 114 return false; 115 } 116 return true; 117 } 118 119 // we search the path of the .exe and return it 120 int 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; 118 127 119 128 // we split to the different values 120 _splitpath(sExe Path, sDrive, sDir, NULL, NULL);129 _splitpath(sExeName, sDrive, sDir, NULL, NULL); 121 130 // strcat(sDrive, sDir); 122 131 strncat(sDrive, sDir, strlen(sDir) -1); … … 124 133 125 134 return 0; 135 } 136 137 // we search with the exe name if we are in client mode 138 bool 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 } 126 154 } 127 155
Note:
See TracChangeset
for help on using the changeset viewer.