summaryrefslogtreecommitdiffstats
path: root/src/VBox/Devices/Storage/HBDMgmt-win.cpp
blob: 4fa44217a522e4e377c28bc57a4335827ee26ca0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
/* $Id: HBDMgmt-win.cpp $ */
/** @file
 * VBox storage devices: Host block device management API.
 */

/*
 * Copyright (C) 2015-2023 Oracle and/or its affiliates.
 *
 * This file is part of VirtualBox base platform packages, as
 * available from https://www.virtualbox.org.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation, in version 3 of the
 * License.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <https://www.gnu.org/licenses>.
 *
 * SPDX-License-Identifier: GPL-3.0-only
 */
#define LOG_GROUP LOG_GROUP_DRV_VD
#include <VBox/cdefs.h>
#include <VBox/err.h>
#include <VBox/log.h>
#include <iprt/assert.h>
#include <iprt/string.h>
#include <iprt/mem.h>
#include <iprt/semaphore.h>
#include <iprt/list.h>

#include <iprt/nt/nt-and-windows.h>
#include <iprt/win/windows.h>

#include "HBDMgmt.h"


/*********************************************************************************************************************************
*   Defined Constants And Macros                                                                                                 *
*********************************************************************************************************************************/


/*********************************************************************************************************************************
*   Structures and Typedefs                                                                                                      *
*********************************************************************************************************************************/

/**
 * Claimed block device state.
 */
typedef struct HBDMGRDEV
{
    /** List node. */
    RTLISTNODE         ListNode;
    /** The block device name. */
    char              *pszDevice;
    /** Number of volumes for this block device. */
    unsigned           cVolumes;
    /** Array of handle to the volumes for unmounting and taking it offline. */
    HANDLE             ahVolumes[1];
} HBDMGRDEV;
/** Pointer to a claimed block device. */
typedef HBDMGRDEV *PHBDMGRDEV;

/**
 * Internal Host block device manager state.
 */
typedef struct HBDMGRINT
{
    /** List of claimed block devices. */
    RTLISTANCHOR       ListClaimed;
    /** Fast mutex protecting the list. */
    RTSEMFASTMUTEX     hMtxList;
} HBDMGRINT;
/** Pointer to an interal block device manager state. */
typedef HBDMGRINT *PHBDMGRINT;

#define HBDMGR_NT_HARDDISK_START "\\Device\\Harddisk"


/*********************************************************************************************************************************
*   Global Variables                                                                                                             *
*********************************************************************************************************************************/


/*********************************************************************************************************************************
*   Internal Functions                                                                                                           *
*********************************************************************************************************************************/

/**
 * Unclaims the given block device and frees its state removing it from the list.
 *
 * @param   pDev           The block device to unclaim.
 */
static void hbdMgrDevUnclaim(PHBDMGRDEV pDev)
{
    LogFlowFunc(("pDev=%p{%s} cVolumes=%u\n", pDev, pDev->pszDevice, pDev->cVolumes));

    for (unsigned i = 0; i < pDev->cVolumes; i++)
    {
        DWORD dwReturned = 0;

        LogFlowFunc(("Taking volume %u online\n", i));
        BOOL bRet = DeviceIoControl(pDev->ahVolumes[i], IOCTL_VOLUME_ONLINE, NULL, 0, NULL, 0, &dwReturned, NULL);
        if (!bRet)
            LogRel(("HBDMgmt: Failed to take claimed volume online during cleanup: %s{%Rrc}\n",
                    pDev->pszDevice, RTErrConvertFromWin32(GetLastError())));

        CloseHandle(pDev->ahVolumes[i]);
    }

    RTListNodeRemove(&pDev->ListNode);
    RTStrFree(pDev->pszDevice);
    RTMemFree(pDev);
}

/**
 * Returns the block device given by the filename if claimed or NULL.
 *
 * @returns Pointer to the claimed block device or NULL if not claimed.
 * @param   pThis          The block device manager.
 * @param   pszFilename    The name to look for.
 */
static PHBDMGRDEV hbdMgrDevFindByName(PHBDMGRINT pThis, const char *pszFilename)
{
    bool fFound = false;

    PHBDMGRDEV pIt;
    RTListForEach(&pThis->ListClaimed, pIt, HBDMGRDEV, ListNode)
    {
        if (!RTStrCmp(pszFilename, pIt->pszDevice))
        {
            fFound = true;
            break;
        }
    }

    return fFound ? pIt : NULL;
}

/**
 * Queries the target in the NT namespace of the given symbolic link.
 *
 * @returns VBox status code.
 * @param   pwszLinkNt      The symbolic link to query the target for.
 * @param   ppwszLinkTarget Where to store the link target in the NT namespace on success.
 *                          Must be freed with RTUtf16Free().
 */
static int hbdMgrQueryNtLinkTarget(PRTUTF16 pwszLinkNt, PRTUTF16 *ppwszLinkTarget)
{
    int                 rc    = VINF_SUCCESS;
    HANDLE              hFile = RTNT_INVALID_HANDLE_VALUE;
    IO_STATUS_BLOCK     Ios   = RTNT_IO_STATUS_BLOCK_INITIALIZER;
    UNICODE_STRING      NtName;

    NtName.Buffer        = (PWSTR)pwszLinkNt;
    NtName.Length        = (USHORT)(RTUtf16Len(pwszLinkNt) * sizeof(RTUTF16));
    NtName.MaximumLength = NtName.Length + sizeof(RTUTF16);

    OBJECT_ATTRIBUTES ObjAttr;
    InitializeObjectAttributes(&ObjAttr, &NtName, OBJ_CASE_INSENSITIVE, NULL /*hRootDir*/, NULL /*pSecDesc*/);

    NTSTATUS rcNt = NtOpenSymbolicLinkObject(&hFile, SYMBOLIC_LINK_QUERY, &ObjAttr);
    if (NT_SUCCESS(rcNt))
    {
        UNICODE_STRING UniStr;
        RTUTF16 awszBuf[1024];
        RT_ZERO(awszBuf);
        UniStr.Buffer = awszBuf;
        UniStr.MaximumLength = sizeof(awszBuf);
        rcNt = NtQuerySymbolicLinkObject(hFile, &UniStr, NULL);
        if (NT_SUCCESS(rcNt))
        {
            *ppwszLinkTarget = RTUtf16Dup((PRTUTF16)UniStr.Buffer);
            if (!*ppwszLinkTarget)
                rc = VERR_NO_STR_MEMORY;
        }
        else
            rc = RTErrConvertFromNtStatus(rcNt);

        CloseHandle(hFile);
    }
    else
        rc = RTErrConvertFromNtStatus(rcNt);

    return rc;
}

/**
 * Queries the harddisk volume device in the NT namespace for the given Win32
 * block device path.
 *
 * @returns VBox status code.
 * @param   pwszDriveWin32  The Win32 path to the block device (e.g. "\\.\PhysicalDrive0" for example)
 * @param   ppwszDriveNt    Where to store the NT path to the volume on success.
 *                          Must be freed with RTUtf16Free().
 */
static int hbdMgrQueryNtName(PRTUTF16 pwszDriveWin32, PRTUTF16 *ppwszDriveNt)
{
    int rc = VINF_SUCCESS;
    RTUTF16 awszFileNt[1024];

    /*
     * Make sure the path is at least 5 characters long so we can safely access
     * the part following \\.\ below.
     */
    AssertReturn(RTUtf16Len(pwszDriveWin32) >= 5, VERR_INVALID_STATE);

    RT_ZERO(awszFileNt);
    RTUtf16CatAscii(awszFileNt, RT_ELEMENTS(awszFileNt), "\\??\\");
    RTUtf16Cat(awszFileNt, RT_ELEMENTS(awszFileNt), &pwszDriveWin32[4]);

    /* Make sure there is no trailing \ at the end or we will fail. */
    size_t cwcPath = RTUtf16Len(awszFileNt);
    if (awszFileNt[cwcPath - 1] == L'\\')
        awszFileNt[cwcPath - 1] = L'\0';

    return hbdMgrQueryNtLinkTarget(awszFileNt, ppwszDriveNt);
}

static int hbdMgrQueryAllMountpointsForDisk(PRTUTF16 pwszDiskNt, PRTUTF16 **ppapwszVolumes,
                                            unsigned *pcVolumes)
{
    /*
     * Try to get the symlink target for every partition, we will take the easy approach
     * and just try to open every partition starting with \Device\Harddisk<N>\Partition1
     * (0 is a special reserved partition linking to the complete disk).
     *
     * For every partition we get the target \Device\HarddiskVolume<N> and query all mountpoints
     * with that.
     */
    int rc = VINF_SUCCESS;
    char *pszDiskNt = NULL;
    unsigned cVolumes = 0;
    unsigned cVolumesMax = 10;
    PRTUTF16 *papwszVolumes = (PRTUTF16 *)RTMemAllocZ(cVolumesMax * sizeof(PRTUTF16));

    if (!papwszVolumes)
        return VERR_NO_MEMORY;

    rc = RTUtf16ToUtf8(pwszDiskNt, &pszDiskNt);
    if (RT_SUCCESS(rc))
    {
        /* Check that the path matches our expectation \Device\Harddisk<N>\DR<N>. */
        if (!RTStrNCmp(pszDiskNt, HBDMGR_NT_HARDDISK_START, sizeof(HBDMGR_NT_HARDDISK_START) - 1))
        {
            uint32_t iDisk = 0;

            rc = RTStrToUInt32Ex(pszDiskNt + sizeof(HBDMGR_NT_HARDDISK_START) - 1, NULL, 10, &iDisk);
            if (RT_SUCCESS(rc) || rc == VWRN_TRAILING_CHARS)
            {
                uint32_t iPart = 1;

                /* Try to query all mount points for all partitions, the simple way. */
                do
                {
                    char aszDisk[1024];
                    RT_ZERO(aszDisk);

                    size_t cchWritten = RTStrPrintf(&aszDisk[0], sizeof(aszDisk), "\\Device\\Harddisk%u\\Partition%u", iDisk, iPart);
                    if (cchWritten < sizeof(aszDisk))
                    {
                        PRTUTF16 pwszDisk = NULL;
                        rc = RTStrToUtf16(&aszDisk[0], &pwszDisk);
                        if (RT_SUCCESS(rc))
                        {
                            PRTUTF16 pwszTargetNt = NULL;

                            rc = hbdMgrQueryNtLinkTarget(pwszDisk, &pwszTargetNt);
                            if (RT_SUCCESS(rc))
                            {
                                if (cVolumes == cVolumesMax)
                                {
                                    /* Increase array of volumes. */
                                    PRTUTF16 *papwszVolumesNew = (PRTUTF16 *)RTMemAllocZ((cVolumesMax + 10) * sizeof(PRTUTF16));
                                    if (papwszVolumesNew)
                                    {
                                        cVolumesMax += 10;
                                        papwszVolumes = papwszVolumesNew;
                                    }
                                    else
                                    {
                                        RTUtf16Free(pwszTargetNt);
                                        rc = VERR_NO_MEMORY;
                                    }
                                }

                                if (RT_SUCCESS(rc))
                                {
                                    Assert(cVolumes < cVolumesMax);
                                    papwszVolumes[cVolumes++] = pwszTargetNt;
                                    iPart++;
                                }
                            }
                            else if (rc == VERR_FILE_NOT_FOUND)
                            {
                                /* The partition does not exist, so stop trying. */
                                rc = VINF_SUCCESS;
                                break;
                            }

                            RTUtf16Free(pwszDisk);
                        }
                    }
                    else
                        rc = VERR_BUFFER_OVERFLOW;

                } while (RT_SUCCESS(rc));
            }
        }
        else
            rc = VERR_INVALID_STATE;

        RTStrFree(pszDiskNt);
    }

    if (RT_SUCCESS(rc))
    {
        *pcVolumes = cVolumes;
        *ppapwszVolumes = papwszVolumes;
        LogFlowFunc(("rc=%Rrc cVolumes=%u ppapwszVolumes=%p\n", rc, cVolumes, papwszVolumes));
    }
    else
    {
        for (unsigned i = 0; i < cVolumes; i++)
            RTUtf16Free(papwszVolumes[i]);

        RTMemFree(papwszVolumes);
    }

    return rc;
}

static NTSTATUS hbdMgrNtCreateFileWrapper(PRTUTF16 pwszVolume, HANDLE *phVolume)
{
    HANDLE          hVolume = RTNT_INVALID_HANDLE_VALUE;
    IO_STATUS_BLOCK Ios     = RTNT_IO_STATUS_BLOCK_INITIALIZER;
    UNICODE_STRING  NtName;

    NtName.Buffer        = (PWSTR)pwszVolume;
    NtName.Length        = (USHORT)(RTUtf16Len(pwszVolume) * sizeof(RTUTF16));
    NtName.MaximumLength = NtName.Length + sizeof(WCHAR);

    OBJECT_ATTRIBUTES ObjAttr;
    InitializeObjectAttributes(&ObjAttr, &NtName, OBJ_CASE_INSENSITIVE, NULL /*hRootDir*/, NULL /*pSecDesc*/);

    NTSTATUS rcNt = NtCreateFile(&hVolume,
                                 FILE_READ_DATA | FILE_WRITE_DATA | SYNCHRONIZE,
                                 &ObjAttr,
                                 &Ios,
                                 NULL /* Allocation Size*/,
                                 FILE_ATTRIBUTE_NORMAL,
                                 FILE_SHARE_READ | FILE_SHARE_WRITE,
                                 FILE_OPEN,
                                 FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT,
                                 NULL /*EaBuffer*/,
                                 0 /*EaLength*/);
    if (NT_SUCCESS(rcNt))
        rcNt = Ios.Status;

    if (NT_SUCCESS(rcNt))
        *phVolume = hVolume;

    return rcNt;
}

DECLHIDDEN(int) HBDMgrCreate(PHBDMGR phHbdMgr)
{
    AssertPtrReturn(phHbdMgr, VERR_INVALID_POINTER);

    PHBDMGRINT pThis = (PHBDMGRINT)RTMemAllocZ(sizeof(HBDMGRINT));
    if (RT_UNLIKELY(!pThis))
        return VERR_NO_MEMORY;

    int rc = VINF_SUCCESS;
    RTListInit(&pThis->ListClaimed);

    rc = RTSemFastMutexCreate(&pThis->hMtxList);
    if (RT_SUCCESS(rc))
    {
        *phHbdMgr = pThis;
        return VINF_SUCCESS;
    }

    RTMemFree(pThis);
    return rc;
}

DECLHIDDEN(void) HBDMgrDestroy(HBDMGR hHbdMgr)
{
    PHBDMGRINT pThis = hHbdMgr;
    AssertPtrReturnVoid(pThis);

    /* Go through all claimed block devices and release them. */
    RTSemFastMutexRequest(pThis->hMtxList);
    PHBDMGRDEV pIt, pItNext;
    RTListForEachSafe(&pThis->ListClaimed, pIt, pItNext, HBDMGRDEV, ListNode)
    {
        hbdMgrDevUnclaim(pIt);
    }
    RTSemFastMutexRelease(pThis->hMtxList);

    RTSemFastMutexDestroy(pThis->hMtxList);
    RTMemFree(pThis);
}

DECLHIDDEN(bool) HBDMgrIsBlockDevice(const char *pszFilename)
{
    bool fIsBlockDevice = RTStrNICmp(pszFilename, "\\\\.\\PhysicalDrive", sizeof("\\\\.\\PhysicalDrive") - 1) == 0 ? true : false;
    if (!fIsBlockDevice)
        fIsBlockDevice = RTStrNICmp(pszFilename, "\\\\.\\Harddisk", sizeof("\\\\.\\Harddisk") - 1) == 0 ? true : false;

    LogFlowFunc(("returns %s -> %RTbool\n", pszFilename, fIsBlockDevice));
    return fIsBlockDevice;
}

DECLHIDDEN(int) HBDMgrClaimBlockDevice(HBDMGR hHbdMgr, const char *pszFilename)
{
    PHBDMGRINT pThis = hHbdMgr;
    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    AssertReturn(HBDMgrIsBlockDevice(pszFilename), VERR_INVALID_PARAMETER);

    int rc = VINF_SUCCESS;
    PHBDMGRDEV pDev = hbdMgrDevFindByName(pThis, pszFilename);
    if (!pDev)
    {
        PRTUTF16 pwszVolume = NULL;

        rc = RTStrToUtf16(pszFilename, &pwszVolume);
        if (RT_SUCCESS(rc))
        {
            PRTUTF16 pwszVolNt = NULL;

            rc = hbdMgrQueryNtName(pwszVolume, &pwszVolNt);
            if (RT_SUCCESS(rc))
            {
                PRTUTF16 *papwszVolumes = NULL;
                unsigned cVolumes = 0;

                /* Complete disks need to be handled differently. */
                if (!RTStrNCmp(pszFilename, "\\\\.\\PhysicalDrive", sizeof("\\\\.\\PhysicalDrive") - 1))
                {
                    rc = hbdMgrQueryAllMountpointsForDisk(pwszVolNt, &papwszVolumes, &cVolumes);
                    RTUtf16Free(pwszVolNt);
                }
                else
                {
                    papwszVolumes = &pwszVolNt;
                    cVolumes = 1;
                }

                if (RT_SUCCESS(rc))
                {
#ifdef LOG_ENABLED
                    for (unsigned i = 0; i < cVolumes; i++)
                        LogFlowFunc(("Volume %u: %ls\n", i, papwszVolumes[i]));
#endif
                    pDev = (PHBDMGRDEV)RTMemAllocZ(RT_UOFFSETOF_DYN(HBDMGRDEV, ahVolumes[cVolumes]));
                    if (pDev)
                    {
                        pDev->cVolumes = 0;
                        pDev->pszDevice = RTStrDup(pszFilename);
                        if (pDev->pszDevice)
                        {
                            for (unsigned i = 0; i < cVolumes; i++)
                            {
                                HANDLE hVolume;

                                NTSTATUS rcNt = hbdMgrNtCreateFileWrapper(papwszVolumes[i], &hVolume);
                                if (NT_SUCCESS(rcNt))
                                {
                                    DWORD dwReturned = 0;

                                    Assert(hVolume != INVALID_HANDLE_VALUE);
                                    BOOL bRet = DeviceIoControl(hVolume, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, &dwReturned, NULL);
                                    if (bRet)
                                    {
                                         bRet = DeviceIoControl(hVolume, IOCTL_VOLUME_OFFLINE, NULL, 0, NULL, 0, &dwReturned, NULL);
                                         if (bRet)
                                            pDev->ahVolumes[pDev->cVolumes++] = hVolume;
                                         else
                                            rc = RTErrConvertFromWin32(GetLastError());
                                    }
                                    else
                                        rc = RTErrConvertFromWin32(GetLastError());

                                    if (RT_FAILURE(rc))
                                        CloseHandle(hVolume);
                                }
                                else
                                    rc = RTErrConvertFromNtStatus(rcNt);
                            }
                        }
                        else
                            rc = VERR_NO_STR_MEMORY;

                        if (RT_SUCCESS(rc))
                        {
                            RTSemFastMutexRequest(pThis->hMtxList);
                            RTListAppend(&pThis->ListClaimed, &pDev->ListNode);
                            RTSemFastMutexRelease(pThis->hMtxList);
                        }
                        else
                        {
                            /* Close all open handles and take the volumes online again. */
                            for (unsigned i = 0; i < pDev->cVolumes; i++)
                            {
                                DWORD dwReturned = 0;
                                BOOL bRet = DeviceIoControl(pDev->ahVolumes[i], IOCTL_VOLUME_ONLINE, NULL, 0, NULL, 0, &dwReturned, NULL);
                                if (!bRet)
                                    LogRel(("HBDMgmt: Failed to take claimed volume online during cleanup: %s{%Rrc}\n",
                                            pDev->pszDevice, RTErrConvertFromWin32(GetLastError())));

                                CloseHandle(pDev->ahVolumes[i]);
                            }
                            if (pDev->pszDevice)
                                RTStrFree(pDev->pszDevice);
                            RTMemFree(pDev);
                        }
                    }
                    else
                        rc = VERR_NO_MEMORY;

                    for (unsigned i = 0; i < cVolumes; i++)
                        RTUtf16Free(papwszVolumes[i]);

                    RTMemFree(papwszVolumes);
                }
            }

            RTUtf16Free(pwszVolume);
        }
    }
    else
        rc = VERR_ALREADY_EXISTS;

    return rc;
}

DECLHIDDEN(int) HBDMgrUnclaimBlockDevice(HBDMGR hHbdMgr, const char *pszFilename)
{
    PHBDMGRINT pThis = hHbdMgr;
    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);

    RTSemFastMutexRequest(pThis->hMtxList);
    int rc = VINF_SUCCESS;
    PHBDMGRDEV pDev = hbdMgrDevFindByName(pThis, pszFilename);
    if (pDev)
        hbdMgrDevUnclaim(pDev);
    else
        rc = VERR_NOT_FOUND;
    RTSemFastMutexRelease(pThis->hMtxList);

    return rc;
}

DECLHIDDEN(bool) HBDMgrIsBlockDeviceClaimed(HBDMGR hHbdMgr, const char *pszFilename)
{
    PHBDMGRINT pThis = hHbdMgr;
    AssertPtrReturn(pThis, false);

    RTSemFastMutexRequest(pThis->hMtxList);
    PHBDMGRDEV pIt = hbdMgrDevFindByName(pThis, pszFilename);
    RTSemFastMutexRelease(pThis->hMtxList);

    return pIt ? true : false;
}