EldoS | Feel safer!

Software components for data protection, secure storage and transfer

CbFsEnumerateDirectory

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
#5589
Posted: 03/24/2008 14:19:27
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

Hello, again.

I am running your VDisk sample with some modifications I made under the Visual Studio Debugger and I don't quite understand when the OnEnumerateDirectory callback function gets called. It seems to get called when you open a directory, but then again it also seems to get called again when you unmount the mounting point. Is that true? If so, what should I do in that case?

Also, the software we are trying to integrate with yours comes originally from a UNIX system and it is written in straight ANSI C. I am having much difficulty coordinating the use of your UNICODE, multi-byte strings with the standard C strings that our code uses. Do you have a version that doesn't use multi-byte strings?
#5590
Posted: 03/24/2008 15:11:38
by Volodymyr Zinin (EldoS Corp.)

Hello,

Quote
Sid Schipper wrote:
I am running your VDisk sample with some modifications I made under the Visual Studio Debugger and I don't quite understand when the OnEnumerateDirectory callback function gets called. It seems to get called when you open a directory, but then again it also seems to get called again when you unmount the mounting point. Is that true? If so, what should I do in that case?

You must always return a list of files for the requested directory.

Quote
Sid Schipper wrote:
Also, the software we are trying to integrate with yours comes originally from a UNIX system and it is written in straight ANSI C. I am having much difficulty coordinating the use of your UNICODE, multi-byte strings with the standard C strings that our code uses. Do you have a version that doesn't use multi-byte strings?

Unfortunately CallbackFS works only with unicode strings. If your files names contain only Roman characters then converting to unicode format is very simple. In the other case you can use MultiByteToWideChar api.
#5608
Posted: 03/25/2008 09:53:47
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

Quote
Vladimir Zinin wrote:
If your files names contain only Roman characters then converting to unicode format is very simple.


Could you please specify the simple API that I can use to do what you say above.
#5610
Posted: 03/25/2008 10:10:00
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

Quote
Vladimir Zinin wrote:
You must always return a list of files for the requested directory.


When I click the "Delete" button for my mounting point, the system calls the EnumerateDirectory Callback function and I provide the same list of files that I do when I originally open the directory. When I do that, I get a Windows Message Box with the error Icon that says "The system cannot find the file specified". Do you know why that happens?
#5611
Posted: 03/25/2008 10:42:39
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

Please disregard the message directly above this one. I figured out on my own why I was getting that Windows error message box and I have fixed the problem. I also implemented a simple conversion program of my own that converts UNICODE to char, but if you know of a Microsoft approved version of the same, I'd rather use that.
#5612
Posted: 03/25/2008 10:58:42
by Eugene Mayevski (EldoS Corp.)

the correct WinAPI way for conversion is MultiByteToWideChar() and WideCharToMultiByte().
If you want to stay with characters 0x20-0x7F, then you can do something like this (writing by memory):

Code
void ToUnicode(PCHAR input, unsigned short * *output)
{
int l = strlen(input);
output = (unsigned short *) malloc((l + 1) << 1);
for (int i =0; i < l; i++)
{
    (*output)[i] = (unsigned short) input[i];
}
(*output)[l] = 0;
}

void FromUnicode(unsigned short * input, PCHAR *output)
{
int l = wcslen(input);
output = (char *) malloc(l + 1);

for (int i =0; i < l; i++)
{
    (*output)[i] = ((char) input[i]) & 0x7F;
}
(*output)[l] = 0;
}


Sincerely yours
Eugene Mayevski
#5613
Posted: 03/25/2008 13:30:56
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

Thank you, Eugene, what you wrote above is very similar to the one I implemented myself.
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

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