11#define BITS_PER_BYTE 8
12#define BITMAP_SIZE_INCREMENT 0x400
13#define BITMAP_SIZE_INVALID_BITS 0x3FF
36 TRACE(
"ComDBClaimNextFreePort(%p %p)\n", hComDB, ComNumber);
57 ERR(
"Failed to query the bitmap size!\n");
67 ERR(
"Failed to allocate the bitmap!\n");
89 if ((pBitmap[dwByteIndex] & cMask) == 0)
91 pBitmap[dwByteIndex] |= cMask;
92 *ComNumber = dwBitIndex + 1;
137 TRACE(
"ComDBClaimPort(%p %lu)\n", hComDB, ComNumber);
159 ERR(
"Failed to query the bitmap size!\n");
169 ERR(
"Failed to allocate the bitmap!\n");
185 dwBitIndex = ComNumber - 1;
190 FIXME(
"Resize the bitmap\n");
203 if ((pBitmap[dwByteIndex] & cMask) == 0)
206 pBitmap[dwByteIndex] |= cMask;
239 TRACE(
"ComDBClose(%p)\n", hComDB);
279 TRACE(
"ComDBGetCurrentPortUsage(%p %p %lu %lu %p)\n",
302 ERR(
"Failed to query the bitmap size!\n");
312 ERR(
"Failed to allocate the bitmap!\n");
342 if (MaxPortsReported !=
NULL)
356 if ((pBitmap[dwByteIndex] & cMask) != 0)
384 TRACE(
"ComDBOpen(%p)\n", phComDB);
392 ERR(
"Failed to allocate the database!\n");
403 ERR(
"Failed to create the mutex!\n");
414 L"System\\CurrentControlSet\\Control\\COM Name Arbiter",
441 ERR(
"Failed to allocate the bitmap!\n");
477 *phComDB = (HCOMDB)pComDB;
480 TRACE(
"done (Error %lu)\n", lError);
500 TRACE(
"ComDBReleasePort(%p %lu)\n", hComDB, ComNumber);
521 ERR(
"Failed to query the bitmap size!\n");
531 ERR(
"Failed to allocate the bitmap!\n");
547 dwBitIndex = ComNumber - 1;
561 pBitmap[dwByteIndex] &= ~cMask;
594 TRACE(
"ComDBResizeDatabase(%p %lu)\n", hComDB,
NewSize);
633 ERR(
"Failed to allocate the bitmap!\n");
#define RegCloseKey(hKey)
LONG WINAPI ComDBReleasePort(IN HCOMDB hComDB, IN DWORD ComNumber)
LONG WINAPI ComDBGetCurrentPortUsage(IN HCOMDB hComDB, OUT PBYTE Buffer, IN DWORD BufferSize, IN DWORD ReportType, OUT LPDWORD MaxPortsReported)
LONG WINAPI ComDBClose(IN HCOMDB hComDB)
LONG WINAPI ComDBClaimPort(IN HCOMDB hComDB, IN DWORD ComNumber, IN BOOL ForceClaim, OUT PBOOL Forced)
LONG WINAPI ComDBOpen(OUT HCOMDB *phComDB)
LONG WINAPI ComDBClaimNextFreePort(IN HCOMDB hComDB, OUT LPDWORD ComNumber)
LONG WINAPI ComDBResizeDatabase(IN HCOMDB hComDB, IN DWORD NewSize)
#define BITMAP_SIZE_INVALID_BITS
#define ERROR_NOT_ENOUGH_MEMORY
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
#define ERROR_INVALID_PARAMETER
#define INVALID_HANDLE_VALUE
#define HeapFree(x, y, z)
#define ERROR_ACCESS_DENIED
_Must_inspect_result_ _In_ USHORT NewSize
#define memcpy(s1, s2, n)
#define ERROR_FILE_NOT_FOUND
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
#define HCOMDB_INVALID_HANDLE_VALUE
#define COMDB_MAX_PORTS_ARBITRATED
#define COMDB_MIN_PORTS_ARBITRATED
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
#define ERROR_SHARING_VIOLATION
#define HKEY_LOCAL_MACHINE