Use Windows Semaphores to synchronize Windows File Mappings

I want to use Windows Semaphores to add synchronization to a Windows File Mapping. So, one process creates the file mapping and another (perhaps multiple other processes) can come in and access the data that is shared. Can anyone give a suggestion as to how this can be done. I have done the following:

In the process that creates the file mapping, I have used

CreateSemaphore

and specified a name. In another process that attempts to access the data, I use

OpenSemaphore

to get a handle to the created sempahore, then I call

WaitForSingleObject

, I then switch on this value, and if its

WAIT_OBJECT0

, I perform the work, and finally calling

ReleaseSemaphore

once the work is done.
I am doing this in C, using a JNI shared library.

The problem is that it simply goes into the default case. Is there anything else that I should do, or am I missing something?

I'm pretty new to how Windows sems work, and I cannot find a concrete example
of how they work between multiple processes (no threads). If anyone can give any suggestions, It would be much appreciated.