EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Anyone impl NtOpenFile based on SolFS?

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
#4946
Posted: 02/10/2008 23:34:10
by Huihong Luo (Standard support level)
Joined: 02/10/2008
Posts: 10

I know SolFS user space follows closely with standard win32 APIs, such as ReadFile, WriteFile, etc. However, I need to implement the native set of NT APIs, such as NtCreateFile, NtOpenFile, in user space based on SolFS code. Has there anyone already done this? any suggestions? Thanks
#4948
Posted: 02/11/2008 01:34:39
by Volodymyr Zinin (EldoS Corp.)

Hello,

Yes, the native APIs work with SolFS.
#4949
Posted: 02/11/2008 01:48:20
by Eugene Mayevski (EldoS Corp.)

Frankly speaking, I didn't understand the original question at all.

If you need to make the OS internals call SolFS (located in user mode), then you need either driver edition of SolFS or Callback File System which will expose the SolFS storage to the OS.

If you need to just emulate Nt*File() API interfaces in user mode, then nobody did this before.


Sincerely yours
Eugene Mayevski
#4958
Posted: 02/11/2008 12:08:33
by Huihong Luo (Standard support level)
Joined: 02/10/2008
Posts: 10

Yes, I just need to emulate Nt*File() API interfaces in user mode. Since you implemented a driver edition, inside the filesystem driver, you must have handled requests such as IRP_MJ_CREATE, etc., which is about same as NtCreateFile. Can you provide some thoughts on how to implement Nt*File() funcs in user mode based on SolFs? I guess I wanted to ask anything that might be useful in emulating the native APIs. For example, do you have any low level interface that we can use from your source code?
#4960
Posted: 02/11/2008 12:33:42
by Eugene Mayevski (EldoS Corp.)

Personally I have no idea about how this is implemented (Vladimir wrote the kernel mode code), but I can't imagine any specific problems. As I understand you need some kind of "proxy" that will have Nt*File()-like interface and will call Win32-based SolFS API. Indeed, in kernel mode such code exists. If it can be easily separated, we will share it with you. However, I can't promise cause it can be that the code is spread across the driver's sources.


Sincerely yours
Eugene Mayevski
#4963
Posted: 02/11/2008 13:07:51
by Huihong Luo (Standard support level)
Joined: 02/10/2008
Posts: 10

Thanks, Eugene. Now you got exactly what our question is. If you can share even some sample code to implement Nt*File(), it would be greatly helpful to us.

If you can share some technique info, we can also try to modify the src ourselves. Before we do that, we wanted to make sure we are doing the right thing, and try not to re-invent if your team has already done so. We need to understand at which level of your code would be the best place to start from. We quickly browsed through the src, seems TStorage* is the entry point?

Thanks,

Huihong
#4964
Posted: 02/11/2008 16:02:20
by Volodymyr Zinin (EldoS Corp.)

Unfortunately the SolFS driver's sources won't help you. They are too complicated and contain a lot of code that is system specific.
But if you have questions (for example how some Nt-function parameters should be converted before a SolFS function call), I will answer.
#4965
Posted: 02/11/2008 17:22:34
by Huihong Luo (Standard support level)
Joined: 02/10/2008
Posts: 10

Thanks. Take a look of the code below, any suggestions to improve? About the time format, how do you convert from SolFS DateTime to PFILE_BASIC_INFORMATION's LARGE_INTEGER? Is the conversation below correct?

//////////////////////
NTSTATUS
NTAPI
SfsNtQueryAttributesFile(
IN HANDLE SfsStorage,
IN PWSTR FileName,
OUT PFILE_BASIC_INFORMATION FileInformation
)
{
LongWord Attr;
Error e;

e = TStorageGetFileAttributes((PStorage)SfsStorage, FileName, &Attr);
if (e == 0) {
DateTime CreationTime, LastAccessTime, LastWriteTime;
FileInformation->FileAttributes = SolfsToWin32Attribute(Attr);

TStorageGetFileTimes((PStorage)SfsStorage, FileName, &CreationTime, &LastWriteTime, &LastAccessTime);

FileInformation->CreationTime.QuadPart = CreationTime;
FileInformation->LastAccessTime.QuadPart = LastAccessTime;
FileInformation->LastWriteTime.QuadPart = LastWriteTime;
FileInformation->ChangeTime.QuadPart = LastWriteTime;
}

return SolfsErrorToNtStatus(e);
}
#4968
Posted: 02/12/2008 01:22:19
by Volodymyr Zinin (EldoS Corp.)

Yes, it's correct.

I have attached the functions for converting attributes, times and error codes.


[ Download ]
#4969
Posted: 02/12/2008 01:23:49
by Volodymyr Zinin (EldoS Corp.)

...


[ Download ]
Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.

Reply

Statistics

Topic viewed 9308 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!