EldoS | Feel safer!

Software components for data protection, secure storage and transfer

System hang where I use readfile in postopenFilec

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#9192
Posted: 03/09/2009 18:23:19
by Wang Sheng (Basic support level)
Joined: 02/16/2009
Posts: 44

I edit your sample:encrypt.I want to read some data of file before CbFltReadFileC. So In CbFltPostOpenFileC

void CbFltPostOpenFileC(
CallbackFilter* Sender,
LPWSTR FileName,
ACCESS_MASK DesiredAccess,
WORD FileAttributes,
WORD ShareMode,
DWORD CreateOptions,
PVOID* UserContext)
{
EncryptContext *Context;
WCHAR text[MAX_PATH * 2];

if (*UserContext == NULL)
{
wsprintfW(text, L"PostOpenFileC create %s", FileName);
AddToLog(text);
Context = new EncryptContext(Sender, FileName);
*UserContext = Context;
Context->ReadSomeData();
}
else
{
wsprintfW(text, L"PostOpenFileC add %s", FileName);
AddToLog(text);

Context = (EncryptContext*)*UserContext;
Context->IncrementRef();
// Context->SetFileSize(3);

}

}

BOOL EncryptContext::ReadSomeData()
{
OVERLAPPED Overlapped;
DWORD Completed=0;
int ret=0;
__int64 CurrPos;
CurrPos=0;

memset(&Overlapped, 0, sizeof(Overlapped));
Overlapped.Offset = (DWORD)(CurrPos & 0xFFFFFFFF);
Overlapped.OffsetHigh = (DWORD)((CurrPos >> 32) & 0xFFFFFFFF);

if (!ReadFile(mHandle, mBuffer, mBufferSize, &Completed,
&Overlapped) || (Completed == 0))
{

return FALSE;
}
return TRUE;
}
But,when goto ReadFile(), System hang?
Why? Can I do that?
#9199
Posted: 03/10/2009 03:35:36
by Vladimir Cherniga (EldoS Corp.)

In current version read/write action avalable only from read/write/rename callbacks. In attached driver your sample code should work.


[ Download ]
#9209
Posted: 03/10/2009 20:09:12
by Wang Sheng (Basic support level)
Joined: 02/16/2009
Posts: 44

Sorry,How to use your attached driver?
I uninstall previous driver (ver.1.1.15.40)
And Install the attached driver, still show version information:ver.1.1.15.40
And not ask me to reboot?
And system hang where Execute ReadFile() in postOpenfile callback.

How?
Thank.
#9213
Posted: 03/11/2009 02:28:02
by Vladimir Cherniga (EldoS Corp.)

The attached driver version is 0.1.4.14.
Uninstall prevoius version, then reboot machine. After that, install the attached one. In the case if different installation products present on your machine(the different installation GUIDs were used) do the full uninstall with a CallbackFilter.UninstallDriver(). When this api have raised ECBFltError() exception, this mean that service fully uninstalled. You could modify sample code like this:
Code
    try {
   
        g_CbFlt.UninstallDriver(g_AppName, &reboot);
    }
    catch(ECBFltError err) {

        MessageBox(NULL, err.Message(), MB_OK, MB_ICONERROR);
    }


And do the click on uninstall button until error message box have raised.
#9230
Posted: 03/11/2009 18:27:15
by Wang Sheng (Basic support level)
Joined: 02/16/2009
Posts: 44

Yes,It work.Great.
But the attached driver 's version is 0.1.4.14.
And Your now version is:1.1.15.40
What's the difference between them?
Can I evaluate on the basic of version 0.1.4.14.
I am afraid it is a very old version which may have many bug which current version have solved.
#9233
Posted: 03/12/2009 01:59:06
by Wang Sheng (Basic support level)
Joined: 02/16/2009
Posts: 44

It maybe an old version,some method of version 1.0.13
like:SetEndOfFile ,if run under driver version 0.1.4.14
will Blue Screen.

Could may some change:so in current version ,postopenCallback
can execute ReadFile, or can add your own method ReadFile,instead of Win32 ReadFile ?
#9235
Posted: 03/12/2009 02:59:55
by Vladimir Cherniga (EldoS Corp.)

Don't look at the version. The attached driver is slightly corrected 1.1.15.40 version. If you obtain BSOD under this version, please specify the way we could reproduce such situation.
#9236
Posted: 03/12/2009 06:10:58
by Vladimir Cherniga (EldoS Corp.)

Quote
can execute ReadFile, or can add your own method ReadFile,instead of Win32 ReadFile ?


We didn't add any ReadFile methods, this is only Win32 ReadFile/WriteFile api calls avalaible. But you should use CallbackFilter.OpenFile() api to obtain handle that could be used withing callbacks.
#9252
Posted: 03/12/2009 18:54:43
by Wang Sheng (Basic support level)
Joined: 02/16/2009
Posts: 44

Hi,SetEndOfFile has bug

void CbFltPostOpenFileC(
CallbackFilter* Sender,
LPWSTR FileName,
ACCESS_MASK DesiredAccess,
WORD FileAttributes,
WORD ShareMode,
DWORD CreateOptions,
PVOID* UserContext)
{
EncryptContext *Context;

if (*UserContext == NULL)
{
Context = new EncryptContext(Sender, FileName);
*UserContext = Context;
Context->SetEof(3);
}
else
{
Context = (EncryptContext*)*UserContext;
Context->IncrementRef();
}

WCHAR text[MAX_PATH * 2];
wsprintfW(text, L"PostOpenFileC %s", FileName);
AddToLog(text);
}

I add Context->SetEof(3) in PostOpen Callback in your samples:encrypt
(version:1.1.15.40).
Under the driver version 1.1.15 system hang when execuate:
ret=mFilter->SetEndOfFile(mHandle, EndOfFile);

Under your attached driver (0.1.4.14 ) system not hang
But it seems that mFilter->SetEndOfFile(mHandle, EndOfFile) do not make any change to fileSize.Although the return value of mFilter->SetEndOfFile(mHandle, EndOfFile); is TRUE





#9286
Posted: 03/15/2009 21:14:52
by Wang Sheng (Basic support level)
Joined: 02/16/2009
Posts: 44

Hi,Execute mFilter->SetEndOfFile(mHandle, EndOfFile) in PostOpenfile callback

under version 1.0.13 is OK.

Under version 1.1.15,system hang.

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages

Reply

Statistics

Topic viewed 9157 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!