Changeset 21916 for trunk/src/kernel32/directory.cpp
- Timestamp:
- Dec 18, 2011, 10:28:22 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 1 bin 2 Makefile.inc 1 env.cmd 2 LocalConfig.kmk
-
-
Property svn:mergeinfo
set to
/branches/gcc-kmk merged eligible
- Property svn:ignore
-
trunk/src/kernel32/directory.cpp
r21302 r21916 6 6 * Copyright 1998 Sander van Leeuwen 7 7 * 8 * NOTE: Directory creation has to be done in install program (odin\win) 8 * NOTE: Directory creation has to be done in install program (odin\win) 9 9 * 10 10 * Parts based on Wine code (991031) (files\directory.c) … … 14 14 * Copyright 1995 Alexandre Julliard 15 15 * 16 * TODO: 16 * TODO: 17 17 * - System/window directories should be created by install program! 18 18 * … … 30 30 #include <os2win.h> 31 31 #include <stdlib.h> 32 #include <string.h> 33 #ifdef __GNUC__ 34 #include <alloca.h> 35 #endif 32 36 #include <unicode.h> 33 37 #include <heapstring.h> 34 38 #include <options.h> 35 39 #include "initterm.h" 36 #include <win\file.h> 37 #include <string.h> 40 #include <win/file.h> 38 41 #include "oslibdos.h" 39 42 #include "profile.h" … … 80 83 len = strlen(DIR_System); 81 84 if(DIR_System[len-1] == '\\') { 82 DIR_System[len-1] = 0; 85 DIR_System[len-1] = 0; 83 86 } 84 87 len = PROFILE_GetOdinIniString(ODINDIRECTORIES,"WINDOWS","",DIR_Windows,sizeof(DIR_Windows)); 85 88 if (len > 2) { 86 89 if(DIR_Windows[len-1] == '\\') { 87 DIR_Windows[len-1] = 0; 90 DIR_Windows[len-1] = 0; 88 91 } 89 92 } … … 116 119 len = strlen(DIR_System); 117 120 if(DIR_System[len-1] == '\\') { 118 DIR_System[len-1] = 0; 121 DIR_System[len-1] = 0; 119 122 } 120 123 strcpy(DIR_Windows, szWindowsDir); 121 124 len = strlen(DIR_Windows); 122 125 if(DIR_Windows[len-1] == '\\') { 123 DIR_Windows[len-1] = 0; 126 DIR_Windows[len-1] = 0; 124 127 } 125 128 … … 146 149 rc = OSLibDosQueryDir(nBufferLength, lpBuffer); 147 150 if(rc && rc < nBufferLength) { 148 dprintf(("CurrentDirectory = %s (%d)", lpBuffer, rc)); 149 } 150 else dprintf(("CurrentDirectory returned %d", rc)); 151 dprintf(("CurrentDirectory = %s (%d)", lpBuffer, rc)); 152 } 153 else dprintf(("CurrentDirectory returned %d", rc)); 151 154 return rc; 152 155 } … … 196 199 return FALSE; 197 200 } 198 201 199 202 // cut off trailing backslashes 200 203 // not if a process wants to change to the root directory … … 204 207 (len != 1) ) 205 208 { 206 LPSTR lpTemp = (LPSTR) _alloca(len);209 LPSTR lpTemp = (LPSTR)alloca(len); 207 210 lstrcpynA(lpTemp, 208 211 lpstrDirectory, … … 264 267 265 268 int len = strlen(lpstrDirectory); 266 269 267 270 // cut off trailing backslashes 268 271 if ( (lpstrDirectory[len - 1] == '\\') || 269 272 (lpstrDirectory[len - 1] == '/') ) 270 273 { 271 LPSTR lpTemp = (LPSTR) _alloca(len);274 LPSTR lpTemp = (LPSTR)alloca(len); 272 275 lstrcpynA(lpTemp, 273 276 lpstrDirectory, … … 275 278 lpstrDirectory = lpTemp; 276 279 } 277 280 278 281 dprintf(("CreateDirectoryA %s", lpstrDirectory)); 279 282 280 283 // Creation of an existing directory will fail (verified in NT4 & XP) 281 284 DWORD dwAttr = GetFileAttributesA(lpstrDirectory); 282 if(dwAttr != -1) 285 if(dwAttr != -1) 283 286 { 284 287 if (dwAttr & FILE_ATTRIBUTE_DIRECTORY) … … 287 290 return FALSE; 288 291 } 289 } 292 } 290 293 return(OSLibDosCreateDirectory(lpstrDirectory)); 291 294 } … … 437 440 asciibuffer = (char *)alloca(uSize+1); 438 441 439 if(lpBuffer && asciibuffer == NULL) 442 if(lpBuffer && asciibuffer == NULL) 440 443 { 441 444 DebugInt3(); … … 445 448 if(rc && asciibuffer) 446 449 AsciiToUnicode(asciibuffer, lpBuffer); 447 450 448 451 return(rc); 449 452 } … … 495 498 asciibuffer = (char *)alloca(uSize+1); 496 499 497 if(lpBuffer && asciibuffer == NULL) 500 if(lpBuffer && asciibuffer == NULL) 498 501 { 499 502 DebugInt3(); … … 503 506 if(rc && asciibuffer) 504 507 AsciiToUnicode(asciibuffer, lpBuffer); 505 508 506 509 return(rc); 507 510 } … … 524 527 { 525 528 int len = strlen(lpstrDirectory); 526 529 527 530 if(lpstrDirectory == NULL) { 528 531 SetLastError(ERROR_INVALID_PARAMETER); … … 533 536 (lpstrDirectory[len - 1] == '/') ) 534 537 { 535 LPSTR lpTemp = (LPSTR) _alloca(len);538 LPSTR lpTemp = (LPSTR)alloca(len); 536 539 lstrcpynA(lpTemp, 537 540 lpstrDirectory, … … 539 542 lpstrDirectory = lpTemp; 540 543 } 541 544 542 545 dprintf(("RemoveDirectory %s", lpstrDirectory)); 543 546 … … 619 622 those (according to SDK docs) */ 620 623 if ((path != NULL) && strchr(path, ';')) { 621 ret = OSLibDosSearchPath(OSLIB_SEARCHDIR, (LPSTR)path, (LPSTR)name, 624 ret = OSLibDosSearchPath(OSLIB_SEARCHDIR, (LPSTR)path, (LPSTR)name, 622 625 full_name, MAX_PATHNAME_LEN); 623 626 goto done; … … 647 650 name = tmp; 648 651 } 649 652 650 653 /* If we have an explicit path, everything's easy */ 651 654 … … 704 707 * filename is returned. 705 708 * Failure: Zero 706 * 709 * 707 710 * NOTES 708 711 * Should call SetLastError(but currently doesn't). … … 732 735 LPSTR nameA = HEAP_strdupWtoA( GetProcessHeap(), 0, name ); 733 736 LPSTR extA = HEAP_strdupWtoA( GetProcessHeap(), 0, ext ); 734 737 735 738 dprintf(("SearchPathA %s %s %s", pathA, nameA, extA)); 736 739 DWORD ret = DIR_SearchPath( pathA, nameA, extA, (LPSTR)full_name ); 737 740 738 741 if (NULL != extA) 739 742 HeapFree( GetProcessHeap(), 0, extA ); 740 743 741 744 if (NULL != nameA) 742 745 HeapFree( GetProcessHeap(), 0, nameA ); 743 746 744 747 if (NULL != pathA) 745 748 HeapFree( GetProcessHeap(), 0, pathA ); 746 749 747 750 if (!ret) return 0; 748 751
Note:
See TracChangeset
for help on using the changeset viewer.