- Timestamp:
- Jul 4, 2000, 10:41:13 AM (25 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/Fileio.cpp
r3697 r3799 1 /* $Id: Fileio.cpp,v 1.3 5 2000-06-13 07:11:37 phallerExp $ */1 /* $Id: Fileio.cpp,v 1.36 2000-07-04 08:41:12 sandervl Exp $ */ 2 2 3 3 /* … … 6 6 * Copyright 1998 Sander van Leeuwen 7 7 * Copyright 1998 Patrick Haller 8 * 9 * Some parts copied from Wine (CopyFileExA/W) 10 * 11 * Copyright 1993 John Burton 12 * Copyright 1996 Alexandre Julliard 13 * 8 14 * 9 15 * Project Odin Software License can be found in LICENSE.TXT … … 288 294 FreeAsciiString(astring1); 289 295 return(rc); 296 } 297 /***************************************************************************** 298 * Name : BOOL WIN32API CopyFileExA 299 * Purpose : The CopyFileExA function copies an existing file to a new file. 300 * This function preserves extended attributes, OLE structured 301 * storage, NTFS alternate data streams, and file attributes. 302 * Security attributes for the existing file are not copied to 303 * the new file. 304 * Parameters: LPCSTR lpExistingFileName pointer to name of an existing file 305 * LPCSTR lpNewFileName pointer to filename to copy to 306 * LPPROGRESS_ROUTINE lpProgressRoutine pointer to the callback function 307 * LPVOID lpData to be passed to the callback function 308 * LPBOOL pbCancel flag that can be used to cancel the operation 309 * DWORD dwCopyFlags flags that specify how the file is copied 310 * Variables : 311 * Result : f the function succeeds, the return value is nonzero. 312 * If the function fails, the return value is zero. 313 * To get extended error information call GetLastError. 314 * Remark : 315 * Status : UNTESTED STUB 316 * 317 * Author : Markus Montkowski [Thu, 1998/05/19 11:46] 318 *****************************************************************************/ 319 320 BOOL WIN32API CopyFileExA( LPCSTR lpExistingFileName, 321 LPCSTR lpNewFileName, 322 LPPROGRESS_ROUTINE lpProgressRoutine, 323 LPVOID lpData, 324 LPBOOL pbCancel, 325 DWORD dwCopyFlags) 326 { 327 328 dprintf(("KERNEL32: CopyFileExA(%08x,%08x,%08x,%08x,%08x,%08x) not properly implemented\n", 329 lpExistingFileName, 330 lpNewFileName, 331 lpProgressRoutine, 332 lpData, 333 pbCancel, 334 dwCopyFlags 335 )); 336 337 BOOL failIfExists = FALSE; 338 339 /* 340 * Interpret the only flag that CopyFile can interpret. 341 */ 342 if((dwCopyFlags & COPY_FILE_FAIL_IF_EXISTS) != 0) 343 { 344 failIfExists = TRUE; 345 } 346 347 return CopyFileA(lpExistingFileName, lpNewFileName, failIfExists); 348 } 349 350 351 /***************************************************************************** 352 * Name : BOOL WIN32API CopyFileExW 353 * Purpose : The CopyFileExW function copies an existing file to a new file. 354 * This function preserves extended attributes, OLE structured 355 * storage, NTFS alternate data streams, and file attributes. 356 * Security attributes for the existing file are not copied to 357 * the new file. 358 * Parameters: LPCWSTR lpExistingFileName pointer to name of an existing file 359 * LPCWSTR lpNewFileName pointer to filename to copy to 360 * LPPROGRESS_ROUTINE lpProgressRoutine pointer to the callback function 361 * LPVOID lpData to be passed to the callback function 362 * LPBOOL pbCancel flag that can be used to cancel the operation 363 * DWORD dwCopyFlags flags that specify how the file is copied 364 * Variables : 365 * Result : f the function succeeds, the return value is nonzero. 366 * If the function fails, the return value is zero. 367 * To get extended error information call GetLastError. 368 * Remark : 369 * Status : UNTESTED STUB 370 * 371 * Author : Markus Montkowski [Thu, 1998/05/19 11:46] 372 *****************************************************************************/ 373 374 BOOL WIN32API CopyFileExW( LPCWSTR lpExistingFileName, 375 LPCWSTR lpNewFileName, 376 LPPROGRESS_ROUTINE lpProgressRoutine, 377 LPVOID lpData, 378 LPBOOL pbCancel, 379 DWORD dwCopyFlags) 380 { 381 LPSTR sourceA = HEAP_strdupWtoA( GetProcessHeap(), 0, lpExistingFileName ); 382 LPSTR destA = HEAP_strdupWtoA( GetProcessHeap(), 0, lpNewFileName ); 383 384 BOOL ret = CopyFileExA(sourceA, 385 destA, 386 lpProgressRoutine, 387 lpData, 388 pbCancel, 389 dwCopyFlags); 390 391 HeapFree( GetProcessHeap(), 0, sourceA ); 392 HeapFree( GetProcessHeap(), 0, destA ); 393 394 return ret; 290 395 } 291 396 //****************************************************************************** … … 780 885 } 781 886 //****************************************************************************** 887 //Behaviour in NT 4, SP6: 888 //- converts long filename to 8.3 short filname (TODO: not yet done here!) 889 //- fails on volume that doesn't support 8.3 filenames 890 //- if lpszShortPath 0 or cchBuffer too small -> return required length 891 // (INCLUDING 0 terminator) 892 //- if lpszLongPath == NULL -> ERROR_INVALID_PARAMETER (return 0) 893 //- if lpszLongPath empty -> proceed as if nothing is wrong 894 //- does NOT clear the last error if successful! 895 //- if successful -> return length of string (excluding 0 terminator) 782 896 //****************************************************************************** 783 897 ODINFUNCTION3(DWORD, GetShortPathNameA, … … 788 902 int length; 789 903 790 dprintf(("KERNEL32: GetShortPathNameA of %s, just copying it\n", lpszLongPath)); 791 length = strlen(lpszLongPath) + 1; 904 dprintf(("KERNEL32: GetShortPathNameA of %s, just copying it", lpszLongPath)); 905 906 if(!lpszLongPath) { 907 SetLastError(ERROR_INVALID_PARAMETER); 908 return 0; 909 } 910 911 length = lstrlenA(lpszLongPath) + 1; 792 912 if(length > cchBuffer) { 793 *lpszShortPath = 0; 794 return(length); 795 } 796 memcpy(lpszShortPath, lpszLongPath, length); 913 if(lpszShortPath) { 914 *lpszShortPath = 0; 915 } 916 return(length); //return length required (including 0 terminator) 917 } 918 lstrcpyA(lpszShortPath, lpszLongPath); 797 919 return(length-1); 798 920 } … … 806 928 int length; 807 929 808 dprintf(("KERNEL32: GetShortPathNameW; just copying it\n")); 809 length = UniStrlen((UniChar*)lpszLongPath) + 1; 930 dprintf(("KERNEL32: GetShortPathNameW; just copying it")); 931 if(!lpszLongPath) { 932 SetLastError(ERROR_INVALID_PARAMETER); 933 return 0; 934 } 935 936 length = lstrlenW(lpszLongPath) + 1; 810 937 if(length > cchBuffer) { 811 *lpszShortPath = 0; 812 return(length); 813 } 814 memcpy(lpszShortPath, lpszLongPath, length*sizeof(USHORT)); 938 if(lpszShortPath) { 939 *lpszShortPath = 0; 940 } 941 return(length); //return length required (including 0 terminator) 942 } 943 lstrcpyW(lpszShortPath, lpszLongPath); 815 944 return(length-1); 816 945 } 946 //****************************************************************************** 947 //****************************************************************************** 817 948 ODINPROCEDURE0(SetFileApisToANSI) 818 949 { -
trunk/src/kernel32/directory.cpp
r3779 r3799 1 /* $Id: directory.cpp,v 1.2 8 2000-06-30 08:39:20sandervl Exp $ */1 /* $Id: directory.cpp,v 1.29 2000-07-04 08:41:13 sandervl Exp $ */ 2 2 3 3 /* … … 277 277 } 278 278 279 /***************************************************************************** 280 * Name : BOOL WIN32API CreateDirectoryExA 281 * Purpose : The CreateDirectoryExA function creates a new directory with a 282 * specified path that retains the attributes of a specified 283 * template directory. If the underlying file system supports 284 * security on files and directories, the function applies a 285 * specified security descriptor to the new directory. 286 * The new directory retains the other attributes of the specified 287 * template directory. Note that CreateDirectoryEx has a template 288 * parameter, while CreateDirectory does not. 289 * Parameters: LPCSTR lpTemplateDirectory pointer to path string of template 290 * directory 291 * LPCSTR lpNewDirectory pointer to path string of directory 292 * to create 293 * LPSECURITY_ATTRIBUTES lpSecurityAttributes pointer to security 294 * descriptor 295 * 296 * Variables : 297 * Result : If the function succeeds, the return value is nonzero. 298 * If the function fails, the return value is zero. 299 * To get extended error information, call GetLastError. 300 * Remark : 301 * Status : UNTESTED STUB 302 * 303 * Author : Markus Montkowski [Tha, 1998/05/21 17:46] 304 *****************************************************************************/ 305 306 BOOL WIN32API CreateDirectoryExA( LPCSTR lpTemplateDirectory, 307 LPCSTR lpNewDirectory, 308 LPSECURITY_ATTRIBUTES lpSecurityAttributes) 309 { 310 311 dprintf(("KERNEL32:CreateDirectoryExA(%08x,%08x,%08x) not properly implemented\n", 312 lpTemplateDirectory,lpNewDirectory,lpSecurityAttributes 313 )); 314 315 return CreateDirectoryA(lpNewDirectory, lpSecurityAttributes); 316 } 317 318 /***************************************************************************** 319 * Name : BOOL WIN32API CreateDirectoryExW 320 * Purpose : The CreateDirectoryExW function creates a new directory with a 321 * specified path that retains the attributes of a specified 322 * template directory. If the underlying file system supports 323 * security on files and directories, the function applies a 324 * specified security descriptor to the new directory. 325 * The new directory retains the other attributes of the specified 326 * template directory. Note that CreateDirectoryEx has a template 327 * parameter, while CreateDirectory does not. 328 * Parameters: LPCWSTR lpTemplateDirectory pointer to path string of template 329 * directory 330 * LPCWSTR lpNewDirectory pointer to path string of directory 331 * to create 332 * LPSECURITY_ATTRIBUTES lpSecurityAttributes pointer to security 333 * descriptor 334 * 335 * Variables : 336 * Result : If the function succeeds, the return value is nonzero. 337 * If the function fails, the return value is zero. 338 * To get extended error information, call GetLastError. 339 * Remark : 340 * Status : UNTESTED STUB 341 * 342 * Author : Markus Montkowski [Tha, 1998/05/21 17:46] 343 *****************************************************************************/ 344 345 BOOL WIN32API CreateDirectoryExW( LPCWSTR lpTemplateDirectory, 346 LPCWSTR lpNewDirectory, 347 LPSECURITY_ATTRIBUTES lpSecurityAttributes) 348 { 349 350 dprintf(("KERNEL32:CreateDirectoryExW(%08x,%08x,%08x) not properly implemented\n", 351 lpTemplateDirectory,lpNewDirectory,lpSecurityAttributes 352 )); 353 354 return CreateDirectoryW(lpNewDirectory, lpSecurityAttributes); 355 } 279 356 280 357 /***************************************************************************** -
trunk/src/kernel32/stubs.cpp
r3483 r3799 1 /* $Id: stubs.cpp,v 1.2 2 2000-05-02 20:53:13 sandervl Exp $ */1 /* $Id: stubs.cpp,v 1.23 2000-07-04 08:41:13 sandervl Exp $ */ 2 2 3 3 /* … … 530 530 531 531 return (Locale); 532 }533 534 /*****************************************************************************535 * Name : BOOL WIN32API CopyFileExA536 * Purpose : The CopyFileExA function copies an existing file to a new file.537 * This function preserves extended attributes, OLE structured538 * storage, NTFS alternate data streams, and file attributes.539 * Security attributes for the existing file are not copied to540 * the new file.541 * Parameters: LPCSTR lpExistingFileName pointer to name of an existing file542 * LPCSTR lpNewFileName pointer to filename to copy to543 * LPPROGRESS_ROUTINE lpProgressRoutine pointer to the callback function544 * LPVOID lpData to be passed to the callback function545 * LPBOOL pbCancel flag that can be used to cancel the operation546 * DWORD dwCopyFlags flags that specify how the file is copied547 * Variables :548 * Result : f the function succeeds, the return value is nonzero.549 * If the function fails, the return value is zero.550 * To get extended error information call GetLastError.551 * Remark :552 * Status : UNTESTED STUB553 *554 * Author : Markus Montkowski [Thu, 1998/05/19 11:46]555 *****************************************************************************/556 557 BOOL WIN32API CopyFileExA( LPCSTR lpExistingFileName,558 LPCSTR lpNewFileName,559 LPPROGRESS_ROUTINE lpProgressRoutine,560 LPVOID lpData,561 LPBOOL pbCancel,562 DWORD dwCopyFlags)563 {564 565 dprintf(("KERNEL32: CopyFileExA(%08x,%08x,%08x,%08x,%08x,%08x) not implemented\n",566 lpExistingFileName,567 lpNewFileName,568 lpProgressRoutine,569 lpData,570 pbCancel,571 dwCopyFlags572 ));573 574 return (FALSE);575 }576 577 578 /*****************************************************************************579 * Name : BOOL WIN32API CopyFileExW580 * Purpose : The CopyFileExW function copies an existing file to a new file.581 * This function preserves extended attributes, OLE structured582 * storage, NTFS alternate data streams, and file attributes.583 * Security attributes for the existing file are not copied to584 * the new file.585 * Parameters: LPCWSTR lpExistingFileName pointer to name of an existing file586 * LPCWSTR lpNewFileName pointer to filename to copy to587 * LPPROGRESS_ROUTINE lpProgressRoutine pointer to the callback function588 * LPVOID lpData to be passed to the callback function589 * LPBOOL pbCancel flag that can be used to cancel the operation590 * DWORD dwCopyFlags flags that specify how the file is copied591 * Variables :592 * Result : f the function succeeds, the return value is nonzero.593 * If the function fails, the return value is zero.594 * To get extended error information call GetLastError.595 * Remark :596 * Status : UNTESTED STUB597 *598 * Author : Markus Montkowski [Thu, 1998/05/19 11:46]599 *****************************************************************************/600 601 BOOL WIN32API CopyFileExW( LPCWSTR lpExistingFileName,602 LPCWSTR lpNewFileName,603 LPPROGRESS_ROUTINE lpProgressRoutine,604 LPVOID lpData,605 LPBOOL pbCancel,606 DWORD dwCopyFlags)607 {608 609 dprintf(("KERNEL32: CopyFileExW(%08x,%08x,%08x,%08x,%08x,%08x) not implemented\n",610 lpExistingFileName,611 lpNewFileName,612 lpProgressRoutine,613 lpData,614 pbCancel,615 dwCopyFlags616 ));617 618 return (FALSE);619 }620 621 /*****************************************************************************622 * Name : BOOL WIN32API CreateDirectoryExA623 * Purpose : The CreateDirectoryExA function creates a new directory with a624 * specified path that retains the attributes of a specified625 * template directory. If the underlying file system supports626 * security on files and directories, the function applies a627 * specified security descriptor to the new directory.628 * The new directory retains the other attributes of the specified629 * template directory. Note that CreateDirectoryEx has a template630 * parameter, while CreateDirectory does not.631 * Parameters: LPCSTR lpTemplateDirectory pointer to path string of template632 * directory633 * LPCSTR lpNewDirectory pointer to path string of directory634 * to create635 * LPSECURITY_ATTRIBUTES lpSecurityAttributes pointer to security636 * descriptor637 *638 * Variables :639 * Result : If the function succeeds, the return value is nonzero.640 * If the function fails, the return value is zero.641 * To get extended error information, call GetLastError.642 * Remark :643 * Status : UNTESTED STUB644 *645 * Author : Markus Montkowski [Tha, 1998/05/21 17:46]646 *****************************************************************************/647 648 BOOL WIN32API CreateDirectoryExA( LPCSTR lpTemplateDirectory,649 LPCSTR lpNewDirectory,650 LPSECURITY_ATTRIBUTES lpSecurityAttributes)651 {652 653 dprintf(("KERNEL32:CreateDirectoryExA(%08x,%08x,%08x) not implemented\n",654 lpTemplateDirectory,lpNewDirectory,lpSecurityAttributes655 ));656 657 return (FALSE);658 }659 660 /*****************************************************************************661 * Name : BOOL WIN32API CreateDirectoryExW662 * Purpose : The CreateDirectoryExW function creates a new directory with a663 * specified path that retains the attributes of a specified664 * template directory. If the underlying file system supports665 * security on files and directories, the function applies a666 * specified security descriptor to the new directory.667 * The new directory retains the other attributes of the specified668 * template directory. Note that CreateDirectoryEx has a template669 * parameter, while CreateDirectory does not.670 * Parameters: LPCWSTR lpTemplateDirectory pointer to path string of template671 * directory672 * LPCWSTR lpNewDirectory pointer to path string of directory673 * to create674 * LPSECURITY_ATTRIBUTES lpSecurityAttributes pointer to security675 * descriptor676 *677 * Variables :678 * Result : If the function succeeds, the return value is nonzero.679 * If the function fails, the return value is zero.680 * To get extended error information, call GetLastError.681 * Remark :682 * Status : UNTESTED STUB683 *684 * Author : Markus Montkowski [Tha, 1998/05/21 17:46]685 *****************************************************************************/686 687 BOOL WIN32API CreateDirectoryExW( LPCWSTR lpTemplateDirectory,688 LPCWSTR lpNewDirectory,689 LPSECURITY_ATTRIBUTES lpSecurityAttributes)690 {691 692 dprintf(("KERNEL32:CreateDirectoryExW(%08x,%08x,%08x) not implemented\n",693 lpTemplateDirectory,lpNewDirectory,lpSecurityAttributes694 ));695 696 return (FALSE);697 532 } 698 533
Note:
See TracChangeset
for help on using the changeset viewer.