Changeset 21720 for branches/gcc-kmk/src/kernel32/directory.cpp
- Timestamp:
- Oct 19, 2011, 11:26:02 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gcc-kmk/src/kernel32/directory.cpp
r21302 r21720 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 * … … 34 34 #include <options.h> 35 35 #include "initterm.h" 36 #include <win \file.h>36 #include <win/file.h> 37 37 #include <string.h> 38 38 #include "oslibdos.h" … … 80 80 len = strlen(DIR_System); 81 81 if(DIR_System[len-1] == '\\') { 82 DIR_System[len-1] = 0; 82 DIR_System[len-1] = 0; 83 83 } 84 84 len = PROFILE_GetOdinIniString(ODINDIRECTORIES,"WINDOWS","",DIR_Windows,sizeof(DIR_Windows)); 85 85 if (len > 2) { 86 86 if(DIR_Windows[len-1] == '\\') { 87 DIR_Windows[len-1] = 0; 87 DIR_Windows[len-1] = 0; 88 88 } 89 89 } … … 116 116 len = strlen(DIR_System); 117 117 if(DIR_System[len-1] == '\\') { 118 DIR_System[len-1] = 0; 118 DIR_System[len-1] = 0; 119 119 } 120 120 strcpy(DIR_Windows, szWindowsDir); 121 121 len = strlen(DIR_Windows); 122 122 if(DIR_Windows[len-1] == '\\') { 123 DIR_Windows[len-1] = 0; 123 DIR_Windows[len-1] = 0; 124 124 } 125 125 … … 146 146 rc = OSLibDosQueryDir(nBufferLength, lpBuffer); 147 147 if(rc && rc < nBufferLength) { 148 dprintf(("CurrentDirectory = %s (%d)", lpBuffer, rc)); 149 } 150 else dprintf(("CurrentDirectory returned %d", rc)); 148 dprintf(("CurrentDirectory = %s (%d)", lpBuffer, rc)); 149 } 150 else dprintf(("CurrentDirectory returned %d", rc)); 151 151 return rc; 152 152 } … … 196 196 return FALSE; 197 197 } 198 198 199 199 // cut off trailing backslashes 200 200 // not if a process wants to change to the root directory … … 264 264 265 265 int len = strlen(lpstrDirectory); 266 266 267 267 // cut off trailing backslashes 268 268 if ( (lpstrDirectory[len - 1] == '\\') || … … 275 275 lpstrDirectory = lpTemp; 276 276 } 277 277 278 278 dprintf(("CreateDirectoryA %s", lpstrDirectory)); 279 279 280 280 // Creation of an existing directory will fail (verified in NT4 & XP) 281 281 DWORD dwAttr = GetFileAttributesA(lpstrDirectory); 282 if(dwAttr != -1) 282 if(dwAttr != -1) 283 283 { 284 284 if (dwAttr & FILE_ATTRIBUTE_DIRECTORY) … … 287 287 return FALSE; 288 288 } 289 } 289 } 290 290 return(OSLibDosCreateDirectory(lpstrDirectory)); 291 291 } … … 437 437 asciibuffer = (char *)alloca(uSize+1); 438 438 439 if(lpBuffer && asciibuffer == NULL) 439 if(lpBuffer && asciibuffer == NULL) 440 440 { 441 441 DebugInt3(); … … 445 445 if(rc && asciibuffer) 446 446 AsciiToUnicode(asciibuffer, lpBuffer); 447 447 448 448 return(rc); 449 449 } … … 495 495 asciibuffer = (char *)alloca(uSize+1); 496 496 497 if(lpBuffer && asciibuffer == NULL) 497 if(lpBuffer && asciibuffer == NULL) 498 498 { 499 499 DebugInt3(); … … 503 503 if(rc && asciibuffer) 504 504 AsciiToUnicode(asciibuffer, lpBuffer); 505 505 506 506 return(rc); 507 507 } … … 524 524 { 525 525 int len = strlen(lpstrDirectory); 526 526 527 527 if(lpstrDirectory == NULL) { 528 528 SetLastError(ERROR_INVALID_PARAMETER); … … 539 539 lpstrDirectory = lpTemp; 540 540 } 541 541 542 542 dprintf(("RemoveDirectory %s", lpstrDirectory)); 543 543 … … 619 619 those (according to SDK docs) */ 620 620 if ((path != NULL) && strchr(path, ';')) { 621 ret = OSLibDosSearchPath(OSLIB_SEARCHDIR, (LPSTR)path, (LPSTR)name, 621 ret = OSLibDosSearchPath(OSLIB_SEARCHDIR, (LPSTR)path, (LPSTR)name, 622 622 full_name, MAX_PATHNAME_LEN); 623 623 goto done; … … 647 647 name = tmp; 648 648 } 649 649 650 650 /* If we have an explicit path, everything's easy */ 651 651 … … 704 704 * filename is returned. 705 705 * Failure: Zero 706 * 706 * 707 707 * NOTES 708 708 * Should call SetLastError(but currently doesn't). … … 732 732 LPSTR nameA = HEAP_strdupWtoA( GetProcessHeap(), 0, name ); 733 733 LPSTR extA = HEAP_strdupWtoA( GetProcessHeap(), 0, ext ); 734 734 735 735 dprintf(("SearchPathA %s %s %s", pathA, nameA, extA)); 736 736 DWORD ret = DIR_SearchPath( pathA, nameA, extA, (LPSTR)full_name ); 737 737 738 738 if (NULL != extA) 739 739 HeapFree( GetProcessHeap(), 0, extA ); 740 740 741 741 if (NULL != nameA) 742 742 HeapFree( GetProcessHeap(), 0, nameA ); 743 743 744 744 if (NULL != pathA) 745 745 HeapFree( GetProcessHeap(), 0, pathA ); 746 746 747 747 if (!ret) return 0; 748 748
Note:
See TracChangeset
for help on using the changeset viewer.