Changeset 3693 for trunk/src/kernel32/directory.cpp
- Timestamp:
- Jun 12, 2000, 3:03:00 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/directory.cpp
r3642 r3693 1 /* $Id: directory.cpp,v 1.2 3 2000-06-01 11:28:44 sandervlExp $ */1 /* $Id: directory.cpp,v 1.24 2000-06-12 13:03:00 phaller Exp $ */ 2 2 3 3 /* … … 14 14 * Copyright 1995 Alexandre Julliard 15 15 * 16 * TODO: System/window directories should be created by install program! 16 * TODO: 17 * - System/window directories should be created by install program! 17 18 * 18 19 * Project Odin Software License can be found in LICENSE.TXT … … 149 150 150 151 151 ODINFUNCTION1(BOOL,SetCurrentDirectoryA,LPCSTR,lpPathName) 152 { 153 if(HIWORD(lpPathName) == 0) { 154 SetLastError(ERROR_INVALID_PARAMETER); 155 return FALSE; 152 ODINFUNCTION1(BOOL, SetCurrentDirectoryA, 153 LPCSTR, lpstrDirectory) 154 { 155 char szBuffer[260]; // MAXPATHLEN 156 157 if(HIWORD(lpstrDirectory) == 0) 158 { 159 SetLastError(ERROR_INVALID_PARAMETER); 160 return FALSE; 156 161 } 157 int len = strlen(lpPathName); 158 char *tmp=(char *)alloca(len + 1); 159 160 strcpy(tmp, lpPathName); 161 if(tmp[len - 1] == '/') { 162 tmp[len-1] = '\\'; 162 163 // cut off trailing backslashes 164 // not if a process wants to change to the root directory 165 int len = lstrlenA(lpstrDirectory); 166 if ( ( (lpstrDirectory[len - 1] == '\\') || 167 (lpstrDirectory[len - 1] == '/') ) && 168 (len != 1) ) 169 { 170 lstrcpynA(szBuffer, 171 lpstrDirectory, 172 len - 1); 173 szBuffer[len - 1] = 0; 174 lpstrDirectory = szBuffer; 163 175 } 164 //SvL: Don't remove trailing backslash if it wants to chdir to root dir 165 if((tmp[len - 1] == '\\') && len != 1) 166 tmp[len -1] = 0; 167 168 dprintf(("SetCurrentDirectoryA %s", tmp)); 169 return O32_SetCurrentDirectory((LPSTR)tmp); 176 177 dprintf(("SetCurrentDirectoryA %s", lpstrDirectory)); 178 return O32_SetCurrentDirectory((LPSTR)lpstrDirectory); 170 179 } 171 180 … … 207 216 *****************************************************************************/ 208 217 209 ODINFUNCTION2(BOOL,CreateDirectoryA,LPCSTR, arg1,PSECURITY_ATTRIBUTES,arg2) 210 { 211 int len = strlen(arg1); 212 char *tmp=(char *)alloca(len + 1); 213 214 strcpy(tmp, arg1); 215 if(tmp[len -1] == '\\') 216 tmp[len -1] = 0; 217 dprintf(("CreateDirectoryA %s", tmp)); 218 return O32_CreateDirectory(tmp, arg2); 218 ODINFUNCTION2(BOOL, CreateDirectoryA, 219 LPCSTR, lpstrDirectory, 220 PSECURITY_ATTRIBUTES,arg2) 221 { 222 char szBuffer[260]; // MAXPATHLEN 223 int len = strlen(lpstrDirectory); 224 225 // cut off trailing backslashes 226 if (lpstrDirectory[len - 1] == '\\') 227 { 228 lstrcpynA(szBuffer, 229 lpstrDirectory, 230 len - 1); 231 szBuffer[len - 1] = 0; 232 lpstrDirectory = szBuffer; 233 } 234 235 dprintf(("CreateDirectoryA %s", 236 lpstrDirectory)); 237 238 return(O32_CreateDirectory(szBuffer, 239 arg2)); 219 240 } 220 241 … … 289 310 290 311 if(lpBuffer) 291 asciibuffer = (char *)alloca(uSize+1); 292 293 if(lpBuffer && asciibuffer == NULL) { 294 DebugInt3(); 312 asciibuffer = (char *)alloca(uSize+1); 313 314 if(lpBuffer && asciibuffer == NULL) 315 { 316 DebugInt3(); 295 317 } 296 318 297 319 rc = GetSystemDirectoryA(asciibuffer, uSize); 298 320 if(rc && asciibuffer) 299 AsciiToUnicode(asciibuffer, lpBuffer); 300 321 AsciiToUnicode(asciibuffer, lpBuffer); 322 323 free(asciibuffer); 301 324 return(rc); 302 325 } … … 348 371 349 372 if(lpBuffer) 350 asciibuffer = (char *)alloca(uSize+1); 351 352 if(lpBuffer && asciibuffer == NULL) { 353 DebugInt3(); 373 asciibuffer = (char *)alloca(uSize+1); 374 375 if(lpBuffer && asciibuffer == NULL) 376 { 377 DebugInt3(); 354 378 } 355 379 356 380 rc = GetWindowsDirectoryA(asciibuffer, uSize); 357 381 if(rc && asciibuffer) 358 AsciiToUnicode(asciibuffer, lpBuffer); 359 382 AsciiToUnicode(asciibuffer, lpBuffer); 383 384 free(asciibuffer); 360 385 return(rc); 361 386 } … … 375 400 376 401 377 ODINFUNCTION1(BOOL,RemoveDirectoryA,LPCSTR,arg1) 378 { 379 int len = strlen(arg1); 380 char *tmp=(char *)alloca(len + 1); 381 382 strcpy(tmp, arg1); 383 if(tmp[len -1] == '\\') 384 tmp[len -1] = 0; 385 386 dprintf(("RemoveDirectory %s", arg1)); 387 388 return O32_RemoveDirectory(tmp); 402 ODINFUNCTION1(BOOL, RemoveDirectoryA, 403 LPCSTR, lpstrDirectory) 404 { 405 char szBuffer[260]; // MAXPATHLEN 406 int len = strlen(lpstrDirectory); 407 408 // cut off trailing backslashes 409 if (lpstrDirectory[len - 1] == '\\') 410 { 411 lstrcpynA(szBuffer, 412 lpstrDirectory, 413 len - 1); 414 szBuffer[len - 1] = 0; 415 lpstrDirectory = szBuffer; 416 } 417 418 dprintf(("RemoveDirectory %s", 419 lpstrDirectory)); 420 421 return O32_RemoveDirectory(lpstrDirectory); 389 422 } 390 423
Note:
See TracChangeset
for help on using the changeset viewer.