mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-04-29 18:27:48 +02:00
Return STATUS_DIRECTORY_NOT_EMPTY when trying to delete a folder that is not empty
This commit is contained in:
parent
353460a976
commit
bb0cff643a
4 changed files with 9 additions and 1 deletions
|
@ -32,6 +32,7 @@ namespace SMBLibrary
|
|||
STATUS_NOT_SUPPORTED = 0xC00000BB,
|
||||
STATUS_NETWORK_NAME_DELETED = 0xC00000C9,
|
||||
STATUS_TOO_MANY_SESSIONS = 0xC00000CE,
|
||||
STATUS_DIRECTORY_NOT_EMPTY = 0xC0000101,
|
||||
STATUS_TOO_MANY_OPENED_FILES = 0xC000011F,
|
||||
STATUS_CANNOT_DELETE = 0xC0000121,
|
||||
STATUS_FILE_CLOSED = 0xC0000128,
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace SMBLibrary
|
|||
ERROR_ACCESS_DENIED = 0x0005,
|
||||
ERROR_SHARING_VIOLATION = 0x0020,
|
||||
ERROR_DISK_FULL = 0x0070,
|
||||
ERROR_DIR_NOT_EMPTY = 0x0091,
|
||||
ERROR_ALREADY_EXISTS = 0x00B7,
|
||||
ERROR_LOGON_FAILURE = 0x052E,
|
||||
ERROR_ACCOUNT_RESTRICTION = 0x052F,
|
||||
|
|
|
@ -382,6 +382,12 @@ namespace SMBLibrary.Server
|
|||
{
|
||||
return NTStatus.STATUS_DISK_FULL;
|
||||
}
|
||||
else if (errorCode == (ushort)Win32Error.ERROR_DIR_NOT_EMPTY)
|
||||
{
|
||||
// If a user tries to rename folder1 to folder2 when folder2 already exists, Windows 7 will offer to merge folder1 into folder2.
|
||||
// In such case, Windows 7 will delete folder 1 and will expect STATUS_DIRECTORY_NOT_EMPTY if there are files to merge.
|
||||
return NTStatus.STATUS_DIRECTORY_NOT_EMPTY;
|
||||
}
|
||||
else if (errorCode == (ushort)Win32Error.ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
// According to [MS-FSCC], FileRenameInformation MUST return STATUS_OBJECT_NAME_COLLISION when the specified name already exists and ReplaceIfExists is zero.
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace SMBServer
|
|||
}
|
||||
else if (Directory.Exists(fullPath))
|
||||
{
|
||||
Directory.Delete(fullPath, true);
|
||||
Directory.Delete(fullPath, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue