- diff --git a/dll/nfs41_np.c b/dll/nfs41_np.c
- index dfd7b88..db7fcff 100644
- --- a/dll/nfs41_np.c
- +++ b/dll/nfs41_np.c
- @@ -65,6 +65,12 @@ ULONG _cdecl NFS41DbgPrint(__in LPTSTR fmt, ...)
- #pragma warning( pop )
- szbp += wcslen(szbp);
- +#if 1
- + StringCchPrintfW(szbp, SZBUFFER_SIZE-(szbp - szbuffer),
- + TEXT("[thr=%04x]"), (int)GetCurrentThreadId());
- + szbp += wcslen(szbp);
- +#endif
- +
- StringCchVPrintfW(szbp, SZBUFFER_SIZE-(szbp - szbuffer), fmt, marker);
- szbuffer[SZBUFFER_SIZE-1] = L'\0';
- @@ -267,7 +273,21 @@ static DWORD StoreConnectionInfo(
- pNfs41NetResource->ConnectionNameLength,
- ConnectionName);
- +#if 0
- // TODO: copy mount options -cbodley
- +#else
- + DbgP((TEXT("lpNetResource->lpComment='%s'\n"), lpNetResource->lpComment));
- + DbgP((TEXT("lpNetResource->lpCommentIsMountOption='%d'\n"), (int)IS_MOUNT_OPTION_BUFFER(lpNetResource->lpComment) ));
- + if (IS_MOUNT_OPTION_BUFFER(lpNetResource->lpComment)) {
- + pNfs41NetResource->mountoptbuff_size = MOUNT_OPTION_BUFFER_SIZE(lpNetResource->lpComment);
- + (void)memcpy(pNfs41NetResource->mountoptbuff, lpNetResource->lpComment, pNfs41NetResource->mountoptbuff_size);
- + }
- + else {
- + pNfs41NetResource->mountoptbuff_size = 0;
- + }
- +#endif
- +
- + DbgP((TEXT("lpNetResource->lpProvider='%s'\n"), lpNetResource->lpProvider));
- out_close:
- CloseSharedMemory(&hMutex, &hMemory, &(PVOID)pSharedMemory);
- @@ -726,8 +746,10 @@ NPGetConnection(
- HANDLE hMutex, hMemory;
- PNFS41NP_SHARED_MEMORY pSharedMemory;
- + size_t lpLocalNameLen = wcslen(lpLocalName);
- - DbgP((TEXT("--> NPGetConnection(lpLocalName='%s')\n"), lpLocalName));
- + DbgP((TEXT("--> NPGetConnection(lpLocalName='%s', *lpBufferSize=%ld)\n"),
- + lpLocalName, (long)*lpBufferSize));
- Status = OpenSharedMemory( &hMutex,
- &hMemory,
- @@ -745,7 +767,22 @@ NPGetConnection(
- if (pNetResource->InUse)
- {
- - if ( ( (wcslen(lpLocalName) + 1) * sizeof(WCHAR) ==
- + /*
- + * Fixme: Add |wcsbytelen()| macro
- + */
- + DbgP((TEXT("Matching %d, "
- + "pNetResource->(LocalName='%s', LocalNameLength=%ld), "
- + "pNetResource->(RemoteName='%s', RemoteNameLength=%ld, "
- + "wcsbytelen(RemoteName)=%ld)"
- + "\n"),
- + Index,
- + pNetResource->LocalName,
- + (long)pNetResource->LocalNameLength,
- + pNetResource->RemoteName,
- + (long)pNetResource->RemoteNameLength,
- + (long)(wcslen(pNetResource->RemoteName)*sizeof(WCHAR))));
- +
- + if ( ( ((lpLocalNameLen+1)*sizeof(WCHAR)) ==
- pNetResource->LocalNameLength)
- && (!wcscmp(lpLocalName, pNetResource->LocalName)))
- {
- @@ -769,6 +806,9 @@ NPGetConnection(
- CloseSharedMemory( &hMutex, &hMemory, (PVOID)&pSharedMemory);
- }
- + else {
- + DbgP((TEXT("Cannot open shared memory, Status=%d\n"), Status));
- + }
- DbgP((TEXT("<-- NPGetConnection returns %d\n"), (int)Status));
- @@ -864,6 +904,7 @@ NPEnumResource(
- SpaceNeeded += pNfsNetResource->RemoteNameLength;
- SpaceNeeded += 5 * sizeof(WCHAR); // comment
- SpaceNeeded += sizeof(NFS41_PROVIDER_NAME_U); // provider name
- + SpaceNeeded += pNfsNetResource->mountoptbuff_size + 1024 /* fixme */;
- if ( SpaceNeeded > SpaceAvailable )
- {
- Status = WN_MORE_DATA;
- @@ -895,6 +936,14 @@ NPEnumResource(
- pNfsNetResource->RemoteName );
- pNetResource->lpRemoteName = StringZone;
- StringZone += pNfsNetResource->RemoteNameLength/sizeof(WCHAR);
- +#if 1
- + if (pNfsNetResource->mountoptbuff_size > 0) {
- + pNetResource->lpComment = StringZone;
- + memcpy(pNetResource->lpComment, pNfsNetResource->mountoptbuff, pNfsNetResource->mountoptbuff_size);
- + StringZone+=pNfsNetResource->mountoptbuff_size+1; /* fixme */
- + DbgP((L"NPEnumResource: lpComment: copied mountoptbuff_size=%ld\n", (long)pNfsNetResource->mountoptbuff_size));
- + }
- + else {
- // copy comment
- pNetResource->lpComment = StringZone;
- *StringZone++ = L'A';
- @@ -902,6 +951,9 @@ NPEnumResource(
- *StringZone++ = L'O';
- *StringZone++ = L'K';
- *StringZone++ = L'\0';
- + DbgP((L"NPEnumResource: lpComment: A_OK\n"));
- + }
- +#endif
- // copy provider name
- pNetResource->lpProvider = StringZone;
- StringCbCopyW( StringZone, sizeof(NFS41_PROVIDER_NAME_U), NFS41_PROVIDER_NAME_U );
- diff --git a/dll/nfs41_np.h b/dll/nfs41_np.h
- index 5f3d77c..3b03e28 100644
- --- a/dll/nfs41_np.h
- +++ b/dll/nfs41_np.h
- @@ -39,6 +39,8 @@ typedef struct __NFS41NP_NETRESOURCE {
- WCHAR RemoteName[NFS41_SYS_MAX_PATH_LEN];
- WCHAR ConnectionName[NFS41_SYS_MAX_PATH_LEN];
- WCHAR Options[NFS41_SYS_MAX_PATH_LEN];
- + char mountoptbuff[8192];
- + size_t mountoptbuff_size;
- } NFS41NP_NETRESOURCE, *PNFS41NP_NETRESOURCE;
- typedef struct __NFS41NP_SHARED_MEMORY {
- diff --git a/dll/options.h b/dll/options.h
- index b425458..5ba931b 100644
- --- a/dll/options.h
- +++ b/dll/options.h
- @@ -38,6 +38,11 @@ typedef struct _MOUNT_OPTION_BUFFER {
- BYTE Buffer[1];
- } MOUNT_OPTION_BUFFER, *PMOUNT_OPTION_BUFFER;
- +#define IS_MOUNT_OPTION_BUFFER(b) \
- + (((PMOUNT_OPTION_BUFFER)(b))->Secret==MOUNT_OPTION_BUFFER_SECRET)
- +#define MOUNT_OPTION_BUFFER_SIZE(b) \
- + (sizeof(MOUNT_OPTION_BUFFER)+((PMOUNT_OPTION_BUFFER)(b))->Length)
- +
- /* CONNECTION_BUFFER
- * The connection information as sent to the driver via
- * IOCTL_NFS41_ADDCONN. The buffer contains the connection name
prototype preserve mount options
Posted by Anonymous on Tue 4th Jun 2024 17:30
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.