EldoS | Feel safer!

Software components for data protection, secure storage and transfer

CbFsEnumerateNamedStreams - leaking resources

Posted: 05/26/2008 06:51:45
by Søren Kristensen (Basic support level)
Joined: 03/04/2008
Posts: 62

The function CbFsEnumerateNamedStreams is leaking resource in the Mapper sample if the function findes a stream.
We have a problem in our program with CbFsEnumerateNamedStreams sometimes leaking resource - and the same problem is present in the Mapper sample.
If no streams are found the code

    if(*NamedStreamFound == FALSE)
        *NamedStreamContext = NULL;

ensures that the resource are released. But if a stream is found the function CbFsEnumerateNamedStreams must be called again to ensure that the resources are released.

But this does not always happen - I believe never if a stream is found.

How is the right way to write CbFsEnumerateNamedStreams so the resource always are released ??
Posted: 05/26/2008 09:07:07
by Vladimir Cherniga (Team)

If any data stream found and callback function returns TRUE in "NamedStreamFound" parameter than CbFsEnumerateNamedStream callback will be invoked again with no doubts. I found another error in the Mounter sample which leads to invalid data stream enumeration in the case when more than one alternate data stream present in the file. In oder to fix it you should change the first line in while cicle to the next one

while (*NamedStreamFound == FALSE)
    BackupRead(nsc->hFile, (LPBYTE)&sid, StreamHeaderSize, &nRead, FALSE, TRUE,  &nsc->EnumCtx);
    if(sid.dwStreamId == BACKUP_ALTERNATE_DATA)
        *NamedStreamFound = TRUE;
        *StreamNameLength = sid.dwStreamNameSize;
        *StreamSize = sid.Size.QuadPart;
        *StreamAllocationSize = sid.Size.QuadPart;
Posted: 05/27/2008 04:02:40
by Søren Kristensen (Basic support level)
Joined: 03/04/2008
Posts: 62

I cannot get the Mapper sample to work - the fix does not change anything.

Here is my setup:

I have a folder c:\eldos - this folder is MAC-shared with "File Service for MacIntosh" for both MacIntosh and Windows.

I then run the Mapper sample and create a virtual drive I:.

The I:-drive is share as a normal windows share .

When a connect to the share I: from another machine and start browsing the folders, the function CbFsEnumerateNamedStream is called and find the stream ":AFP_AfpInfo:$DATA".

BUT the function CbFsEnumerateNamedStream is not called again and the resources are not released.
Posted: 05/27/2008 08:44:13
by Vladimir Cherniga (Team)

Does this call to the CbFsEnumerateNamedStream function returns TRUE in the
NamedStreamFound parameter ?
Is this behaviour typical not for only network share and also for the local drive mapping ?
Check please if any exception throwing in the CbFsEnumerateNamedStream callback.
Posted: 05/27/2008 09:38:52
by Søren Kristensen (Basic support level)
Joined: 03/04/2008
Posts: 62

The function does return TRUE and no exceptions - the behaviour is seen on network share - I do not think that the problem is pressent on local drive mapping.

We are going to use the solution on a network share so the local drive is "not of our interest"

Are you able to reproduce the problem.
Posted: 05/30/2008 07:54:59
by Vladimir Cherniga (Team)

You should utilize OnCloseEnumeration Callback in order to cleanup stream enumeration context. This callback is extended in functionality in the last build.



Topic viewed 5419 times

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


Back to top

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

Got it!