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