mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-08-15 03:33:47 +02:00
Better handling of Transaction2SetFileInformation requests
This commit is contained in:
parent
0eecde7152
commit
2da05e979b
1 changed files with 9 additions and 6 deletions
|
@ -281,6 +281,8 @@ namespace SMBLibrary.Server
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OpenedFileObject fileObject = state.GetOpenedFileObject(subcommand.FID);
|
||||||
|
|
||||||
Transaction2SetFileInformationResponse response = new Transaction2SetFileInformationResponse();
|
Transaction2SetFileInformationResponse response = new Transaction2SetFileInformationResponse();
|
||||||
switch (subcommand.InformationLevel)
|
switch (subcommand.InformationLevel)
|
||||||
{
|
{
|
||||||
|
@ -370,8 +372,13 @@ namespace SMBLibrary.Server
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fileObject.Stream != null)
|
||||||
|
{
|
||||||
|
fileObject.Stream.Close();
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
System.Diagnostics.Debug.Print("[{0}] NTCreate: Deleting file '{1}'", DateTime.Now.ToString("HH:mm:ss:ffff"), openedFilePath);
|
||||||
share.FileSystem.Delete(openedFilePath);
|
share.FileSystem.Delete(openedFilePath);
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
|
@ -395,9 +402,7 @@ namespace SMBLibrary.Server
|
||||||
ulong allocationSize = ((SetFileAllocationInfo)subcommand.SetInfo).AllocationSize;
|
ulong allocationSize = ((SetFileAllocationInfo)subcommand.SetInfo).AllocationSize;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Stream stream = share.FileSystem.OpenFile(openedFilePath, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
|
fileObject.Stream.SetLength((long)allocationSize);
|
||||||
stream.SetLength((long)allocationSize);
|
|
||||||
stream.Close();
|
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
|
@ -414,9 +419,7 @@ namespace SMBLibrary.Server
|
||||||
ulong endOfFile = ((SetFileEndOfFileInfo)subcommand.SetInfo).EndOfFile;
|
ulong endOfFile = ((SetFileEndOfFileInfo)subcommand.SetInfo).EndOfFile;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Stream stream = share.FileSystem.OpenFile(openedFilePath, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
|
fileObject.Stream.SetLength((long)endOfFile);
|
||||||
stream.SetLength((long)endOfFile);
|
|
||||||
stream.Close();
|
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue