~ubuntu-branches/ubuntu/quantal/nspr/quantal-security

« back to all changes in this revision

Viewing changes to mozilla/nsprpub/pr/src/md/windows/w32ipcsem.c

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2009-08-10 11:34:26 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090810113426-3uv4diflrkcbdimm
Tags: 4.8-0ubuntu1
* New upstream release: 4.8 (LP: #387812)
* adjust patches to changed upstreanm codebase
  - update debian/patches/99_configure.patch
* update shlibs symbols to include new API elements
  - update debian/libnspr4-0d.symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 
43
43
#include "primpl.h"
44
44
 
 
45
#ifdef WINCE
 
46
static HANDLE OpenSemaphore(DWORD inDesiredAccess,
 
47
                            BOOL inInheritHandle,
 
48
                            const char *inName)
 
49
{
 
50
    HANDLE retval = NULL;
 
51
    HANDLE semaphore = NULL;
 
52
    PRUnichar wideName[MAX_PATH];  /* name size is limited to MAX_PATH */
 
53
    
 
54
    MultiByteToWideChar(CP_ACP, 0, inName, -1, wideName, MAX_PATH);
 
55
    /* 0x7fffffff is the max count for our semaphore */
 
56
    semaphore = CreateSemaphoreW(NULL, 0, 0x7fffffff, wideName);
 
57
    if (NULL != semaphore) {
 
58
        DWORD lastErr = GetLastError();
 
59
      
 
60
        if (ERROR_ALREADY_EXISTS != lastErr)
 
61
            CloseHandle(semaphore);
 
62
        else
 
63
            retval = semaphore;
 
64
    }
 
65
    return retval;
 
66
}
 
67
#endif
 
68
 
45
69
/*
46
70
 * NSPR-to-NT access right mapping table for semaphore objects.
47
71
 *
147
171
            sa.bInheritHandle = FALSE;
148
172
            lpSA = &sa;
149
173
        }
150
 
        sem->sem = CreateSemaphore(lpSA, value, 0x7fffffff, osname);
 
174
#ifdef WINCE
 
175
        {
 
176
            /* The size of a sem's name is limited to MAX_PATH. */
 
177
            PRUnichar wosname[MAX_PATH]; 
 
178
            MultiByteToWideChar(CP_ACP, 0, osname, -1, wosname, MAX_PATH);
 
179
            sem->sem = CreateSemaphoreW(lpSA, value, 0x7fffffff, wosname);
 
180
        }
 
181
#else
 
182
        sem->sem = CreateSemaphoreA(lpSA, value, 0x7fffffff, osname);
 
183
#endif
151
184
        if (lpSA != NULL) {
152
185
            _PR_NT_FreeSecurityDescriptorACL(pSD, pACL);
153
186
        }