hi all! i need a little help,
i'm trying to communicate
with a mailslot created in user mode,
but when i try to open the mail slot with ZwOpenFile
it fails with 0xC0000043 that means STATUS_SHARING_VIOLATION ....

This is the code:

//-----------------------

ret = ZwOpenFile(
&hand,
GENERIC_WRITE,
&oa,
&iosb,
0,
FILE_NON_DIRECTORY_FILE);

//-----------------------

are the flags used right?
can someone help me please? ^_^

Thank you anyway and sorry 4 my english :)

Re: Mailslot and Drivers by Maxim

Maxim
Wed Apr 18 08:54:27 CDT 2007

Use inverted call instead, it's easier.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"KuRLiC" <KuRLiC@discussions.microsoft.com> wrote in message
news:29EDD785-E292-49D6-9B35-B7105EBC4C70@microsoft.com...
> hi all! i need a little help,
> i'm trying to communicate
> with a mailslot created in user mode,
> but when i try to open the mail slot with ZwOpenFile
> it fails with 0xC0000043 that means STATUS_SHARING_VIOLATION ....
>
> This is the code:
>
> //-----------------------
>
> ret = ZwOpenFile(
> &hand,
> GENERIC_WRITE,
> &oa,
> &iosb,
> 0,
> FILE_NON_DIRECTORY_FILE);
>
> //-----------------------
>
> are the flags used right?
> can someone help me please? ^_^
>
> Thank you anyway and sorry 4 my english :)


Re: Mailslot and Drivers by KuRLiC

KuRLiC
Wed Apr 18 09:06:04 CDT 2007


^^ i'm new with drivers and i don't know what is an
"inverted call" but i solved the problem,
there was a flag (FILE_SHARE_READ) required to open a mailslot
thank you anyway :P

"Maxim S. Shatskih" wrote:

> Use inverted call instead, it's easier.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com

Re: Mailslot and Drivers by Don

Don
Wed Apr 18 09:32:38 CDT 2007

What Max is saying is that Mailslots are a terrible way to communicate from
the application to the driver. You may have gotten the open to work, but
you still need to handle detection and cleanup when the application fails,
the lack of security with Mailslots (unless you do a lot of work), and the
shared nature of mailslots that makes it easy for an application to attempt
to attack the system through your driver.

An inverted call, is an IOCTL that you pend till you need to request
something from the application, you then complete it and when the app has
done the work it calls back with the IOCTL. See
http://www.osronline.com/login.cfm?prompt=ntInsider&id=94 for details and
code samples. This approach has good security, since the application has
to open your driver, automatic notification of application failures since
the request is canceled, and protection against sharing attacks, since you
can distinguish the sender.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

"KuRLiC" <KuRLiC@discussions.microsoft.com> wrote in message
news:635A0FEF-C974-4207-9669-E121CB10F337@microsoft.com...
>
> ^^ i'm new with drivers and i don't know what is an
> "inverted call" but i solved the problem,
> there was a flag (FILE_SHARE_READ) required to open a mailslot
> thank you anyway :P
>
> "Maxim S. Shatskih" wrote:
>
>> Use inverted call instead, it's easier.
>>
>> --
>> Maxim Shatskih, Windows DDK MVP
>> StorageCraft Corporation
>> maxim@storagecraft.com
>> http://www.storagecraft.com