creating shared memory mutex in dll

This commit is contained in:
Casey Bodley 2010-10-12 09:56:28 -04:00
parent 86c16a7197
commit 88c28ec995
2 changed files with 2 additions and 26 deletions

View file

@ -44,19 +44,6 @@ typedef struct _nfs41_process_thread {
uint32_t tid;
} nfs41_process_thread;
DWORD InitSharedMemory(
OUT PHANDLE phMutex)
{
DWORD status = NO_ERROR;
*phMutex = CreateMutex(NULL, FALSE, TEXT(NFS41NP_MUTEX_NAME));
if (*phMutex == NULL) {
status = GetLastError();
eprintf("CreateMutex failed with %d\n", status);
}
return status;
}
static unsigned int WINAPI thread_main(void *args)
{
DWORD status = 0;
@ -147,8 +134,6 @@ write_downcall:
void __cdecl _tmain(int argc, TCHAR *argv[])
{
DWORD status = 0, len;
// handles related to shared memory
HANDLE hSharedMemoryMutex;
// handle to our drivers
HANDLE pipe;
nfs41_process_thread tids[MAX_NUM_THREADS];
@ -181,10 +166,6 @@ void __cdecl _tmain(int argc, TCHAR *argv[])
return;
}
status = InitSharedMemory(&hSharedMemoryMutex);
if (status)
goto quit_pipe;
dprintf(1, "starting nfs41 mini redirector\n");
status = DeviceIoControl(pipe, IOCTL_NFS41_START,
NULL, 0, NULL, 0, (LPDWORD)&len, NULL);
@ -200,7 +181,7 @@ void __cdecl _tmain(int argc, TCHAR *argv[])
if (tids[i].handle == INVALID_HANDLE_VALUE) {
status = GetLastError();
eprintf("_beginthreadex failed %d\n", status);
goto quit_pipe;
goto quit;
}
}
//This can be changed to waiting on an array of handles and using waitformultipleobjects
@ -210,8 +191,6 @@ void __cdecl _tmain(int argc, TCHAR *argv[])
dprintf(1, "Parent woke up!!!!\n");
quit:
CloseHandle(hSharedMemoryMutex);
quit_pipe:
CloseHandle(pipe);
return;
}

View file

@ -95,10 +95,7 @@ Return Value:
*phMemory = 0;
*pMemory = NULL;
*phMutex = OpenMutex(SYNCHRONIZE,
FALSE,
TEXT(NFS41NP_MUTEX_NAME));
*phMutex = CreateMutex(NULL, FALSE, TEXT(NFS41NP_MUTEX_NAME));
if (*phMutex == NULL)
{
dwStatus = GetLastError();