Named Semaphore

Hello,

I need to synchronise data transfer between a driver and application.
For that I read somewhere named semaphore is better.But how can I create a
named semaphore?

Thanks,
Abhilash.

In the Win32 App like this… haven’t ever looked into
whether its possible in a driver.

SECURITY_ATTRIBUTES saSecurity;
char achSDBuffer[SECURITY_DESCRIPTOR_MIN_LENGTH];
PSECURITY_DESCRIPTOR pSD = (PSECURITY_DESCRIPTOR) achSDBuffer;

if( !InitializeSecurityDescriptor( pSD, SECURITY_DESCRIPTOR_REVISION ) )
return FALSE;

if( !SetSecurityDescriptorDacl( pSD, TRUE, NULL, FALSE ) )
return FALSE;

saSecurity.nLength = sizeof( SECURITY_ATTRIBUTES );
saSecurity.lpSecurityDescriptor = pSD;
saSecurity.bInheritHandle = TRUE;

m_hSemaphore = CreateSemaphore( &saSecurity, MAXLONG, MAXLONG,
“MyNamedSemaphpre” );

if( m_hSemaphore == NULL )
return FALSE;

Rob Linegar
Software Engineer
Data Encryption Systems Limited

-----Original Message-----
From: Abhilash [mailto:xxxxx@avenir.net]
Sent: 10 October 2002 15:44
To: NT Developers Interest List
Subject: [ntdev] Named Semaphore

Hello,

I need to synchronise data transfer between a driver and application.
For that I read somewhere named semaphore is better.But how can I create
a
named semaphore?

Thanks,
Abhilash.


You are currently subscribed to ntdev as: xxxxx@des.co.uk
To unsubscribe send a blank email to %%email.unsub%%

By definition, the use of ReadFile, WriteFile, and DeviceIoControl will do very nearly all of the synchronization you need between the driver and the application. You can use semaphores and events, but in nearly all cases that simply throws obfuscation into something that really does not need to be complicated. The simplest way to know if data is ready in a buffer is to simply do a ReadFile.


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105
“Abhilash” wrote in message news:xxxxx@ntdev…

Hello,

I need to synchronise data transfer between a driver and application.
For that I read somewhere named semaphore is better.But how can I create a
named semaphore?

Thanks,
Abhilash.