mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 00:43:00 -05:00
dll: NPOpenEnum, NPEnumResources, NPCloseEnum: testing
This commit is contained in:
parent
00ee25f904
commit
1e1b9cdda3
21
src/dll/np.c
21
src/dll/np.c
@ -524,6 +524,7 @@ DWORD APIENTRY NPEnumResource(
|
||||
DWORD NpResult;
|
||||
LPNETRESOURCEW Resource; /* grows upwards */
|
||||
PWCHAR Strings; /* grows downwards */
|
||||
PWCHAR ProviderName = 0;
|
||||
DWORD Count;
|
||||
PWCHAR P, VolumePrefix;
|
||||
ULONG Backslashes;
|
||||
@ -538,9 +539,7 @@ DWORD APIENTRY NPEnumResource(
|
||||
Resource = lpBuffer;
|
||||
Strings = (PVOID)((PUINT8)lpBuffer + (*lpBufferSize & ~1/* WCHAR alignment */));
|
||||
Count = 0;
|
||||
while (*lpcCount > Count)
|
||||
{
|
||||
for (P = Enum->VolumeName; Enum->VolumeListBufEnd > P; P++)
|
||||
for (P = Enum->VolumeName; *lpcCount > Count && Enum->VolumeListBufEnd > P; P++)
|
||||
{
|
||||
if (L'\0' == *P)
|
||||
{
|
||||
@ -563,14 +562,15 @@ DWORD APIENTRY NPEnumResource(
|
||||
{
|
||||
Drive = FspNpGetDriveLetter(&Enum->LogicalDrives, Enum->VolumeName);
|
||||
|
||||
Strings -= (Drive ? 3 : 0) + 2/* backslash + term-0 */ + lstrlenW(VolumePrefix);
|
||||
Strings -= (Drive ? 3 : 0) + 2/* backslash + term-0 */ + lstrlenW(VolumePrefix) +
|
||||
(0 == ProviderName ? lstrlenW(L"" FSP_NP_NAME) + 1 : 0);
|
||||
|
||||
if ((PVOID)(Resource + 1) > (PVOID)Strings)
|
||||
{
|
||||
if (0 == Count)
|
||||
{
|
||||
*lpBufferSize =
|
||||
(DWORD)((PUINT8)Resource - (PUINT8)lpBuffer) +
|
||||
(DWORD)((PUINT8)(Resource + 1) - (PUINT8)lpBuffer) +
|
||||
(DWORD)((PUINT8)lpBuffer + *lpBufferSize - (PUINT8)Strings);
|
||||
NpResult = WN_MORE_DATA;
|
||||
}
|
||||
@ -583,6 +583,12 @@ DWORD APIENTRY NPEnumResource(
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (0 == ProviderName)
|
||||
{
|
||||
ProviderName = Strings + (Drive ? 3 : 0) + 2/* backslash + term-0 */ + lstrlenW(VolumePrefix);
|
||||
lstrcpyW(ProviderName, L"" FSP_NP_NAME);
|
||||
}
|
||||
|
||||
if (Drive)
|
||||
{
|
||||
Strings[0] = Drive;
|
||||
@ -594,7 +600,7 @@ DWORD APIENTRY NPEnumResource(
|
||||
}
|
||||
else
|
||||
{
|
||||
Strings[1] = L'\\';
|
||||
Strings[0] = L'\\';
|
||||
lstrcpyW(Strings + 1, VolumePrefix);
|
||||
}
|
||||
|
||||
@ -605,7 +611,7 @@ DWORD APIENTRY NPEnumResource(
|
||||
Resource->lpLocalName = Drive ? Strings : 0;
|
||||
Resource->lpRemoteName = Drive ? Strings + 3 : Strings;
|
||||
Resource->lpComment = 0;
|
||||
Resource->lpProvider = 0;
|
||||
Resource->lpProvider = ProviderName;
|
||||
Resource++;
|
||||
|
||||
Count++;
|
||||
@ -614,7 +620,6 @@ DWORD APIENTRY NPEnumResource(
|
||||
Enum->VolumeName = P + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (0 == Count)
|
||||
NpResult = WN_NO_MORE_ENTRIES;
|
||||
|
Loading…
x
Reference in New Issue
Block a user