Go to the source code of this file.
◆ ENV_BUFFER_SIZE
◆ SearchForExecutable()
Definition at line 142 of file where.c.
143{
144 static TCHAR pszDefaultPathExt[] =
_T(
".com;.exe;.bat;.cmd");
145 LPTSTR pszPathExt, pszPath;
149
150
152 if (!pszPathExt)
153 {
154 WARN(
"Cannot allocate memory for pszPathExt!\n");
156 }
157
160 {
161 LPTSTR pszOldPathExt = pszPathExt;
163 if (!pszPathExt)
164 {
165 WARN(
"Cannot reallocate memory for pszPathExt!\n");
168 }
171 }
172 else if (0 == dwBuffer)
173 {
174 _tcscpy(pszPathExt, pszDefaultPathExt);
175 }
176 else
177 {
179 }
180
181
183 {
186 }
187
188
189 if (pFileName[1] ==
_T(
':') ||
_tcschr(pFileName,
_T(
'\\')))
190 {
193 }
194
195
197 if (!pszPath)
198 {
199 WARN(
"Cannot allocate memory for pszPath!\n");
201 }
202
205 {
206 LPTSTR pszOldPath = pszPath;
208 if (!pszPath)
209 {
210 WARN(
"Cannot reallocate memory for pszPath!\n");
214 }
216 }
217
219
220
222 while (pCh)
223 {
225 {
229 }
231 }
232
236}
BOOL SearchForExecutableSingle(LPCTSTR pFileName, LPTSTR pFullName, LPTSTR pPathExt, LPTSTR pDirectory)
#define cmd_realloc(ptr, size)
#define GetEnvironmentVariable
Referenced by cmd_start(), Execute(), and GetCmdLineCommand().
◆ SearchForExecutableSingle()
Definition at line 86 of file where.c.
87{
90
91 *pFullName =
_T(
'\0');
92
93 TRACE (
"SearchForExecutableSingle: \'%s\' in dir: \'%s\'\n",
95
96 pszPathEnd = szPathBuffer;
97 if (pDirectory !=
NULL)
98 {
99 _tcscpy(szPathBuffer, pDirectory);
100 pszPathEnd +=
_tcslen(pszPathEnd);
101 *pszPathEnd++ =
_T(
'\\');
102 }
103 _tcscpy(pszPathEnd, pFileName);
104 pszPathEnd +=
_tcslen(pszPathEnd);
105
107 {
111 }
112
115 {
117
119 {
121 pszPathEnd[
f-
s] =
_T(
'\0');
123 }
124 else
125 {
128 }
129
131 {
135 }
136 }
138}
BOOL IsExistingFile(IN LPCTSTR pszPath)
Referenced by SearchForExecutable().