MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / getMappedFileName

Function getMappedFileName

src/common/isc_sync.cpp:1540–1574  ·  view source on GitHub ↗

Get name of the file that was mapped into memory at given address. This routine should not throw as caller is not ready currently.

Source from the content-addressed store, hash-verified

1538// Get name of the file that was mapped into memory at given address.
1539// This routine should not throw as caller is not ready currently.
1540static bool getMappedFileName(void* addr, PathName& mappedName)
1541{
1542 char* mapName = mappedName.getBuffer(MAXPATHLEN + 1);
1543 const DWORD mapLen = GetMappedFileName(GetCurrentProcess(), addr, mapName, MAXPATHLEN);
1544 mappedName.resize(mapLen);
1545 if (!mapLen)
1546 //system_call_failed::raise("GetMappedFileName");
1547 return false;
1548
1549 char dosDevice[] = {'A', ':', 0};
1550
1551 DWORD drives = GetLogicalDrives();
1552 for (; drives; drives >>= 1, dosDevice[0]++)
1553 if (drives & 1)
1554 {
1555 char ntDevice[MAXPATHLEN + 1];
1556 DWORD ntLen = QueryDosDevice(dosDevice, ntDevice, MAXPATHLEN);
1557
1558 if (!ntLen)
1559 //system_call_failed::raise("QueryDosDevice");
1560 return false;
1561
1562 ntLen = strlen(ntDevice);
1563
1564 if (ntLen <= mapLen &&
1565 _memicmp(ntDevice, mapName, ntLen) == 0 &&
1566 mapName[ntLen] == '\\')
1567 {
1568 mappedName.replace(0, ntLen, dosDevice);
1569 return true;
1570 }
1571 }
1572
1573 return false;
1574}
1575
1576
1577void SharedMemoryBase::internalUnmap()

Callers 1

SharedMemoryBaseMethod · 0.70

Calls 2

getBufferMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected