pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS


Try to get pagefile.sys working
Posted by Anonymous on Sat 1st Nov 2025 14:05
raw | new post

  1. diff --git a/daemon/fileinfoutil.c b/daemon/fileinfoutil.c
  2. index 3466cfd..ce845e1 100644
  3. --- a/daemon/fileinfoutil.c
  4. +++ b/daemon/fileinfoutil.c
  5. @@ -95,6 +95,28 @@ ULONG nfs_file_info_to_attributes(
  6.      return attrs ? attrs : FILE_ATTRIBUTE_NORMAL;
  7.  }
  8.  
  9. +#if 1
  10. +static
  11. +bool ends_with_pagefile_sys(const char *s)
  12. +{
  13. +    static const char suffix[] = "pagefile.sys";
  14. +    size_t n, m;
  15. +
  16. +    if (s == NULL) {
  17. +        return false;
  18. +    }
  19. +
  20. +    n = strlen(s);
  21. +    m = sizeof(suffix) - 1;
  22. +
  23. +    if (n < m) {
  24. +        return false;
  25. +    }
  26. +
  27. +    return (memcmp(s + (n - m), suffix, m) == 0)?true:false;
  28. +}
  29. +#endif
  30. +
  31.  void nfs_to_basic_info(
  32.      IN const char *restrict name,
  33.      IN const nfs41_superblock *restrict superblock,
  34. @@ -142,6 +164,19 @@ void nfs_to_basic_info(
  35.  
  36.      basic_out->FileAttributes =
  37.          nfs_file_info_to_attributes(superblock, info);
  38. +
  39. +#if 1
  40. +    if (ends_with_pagefile_sys(name)) {
  41. +        DPRINTF(1, ("nfs_to_basic_info(name='%s'): "
  42. +            "hack: set FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM "
  43. +            "for pagefile.sys\n",
  44. +            name));
  45. +
  46. +        basic_out->FileAttributes |=
  47. +            FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM;
  48. +        basic_out->FileAttributes &= ~FILE_ATTRIBUTE_SPARSE_FILE;
  49. +    }
  50. +#endif
  51.  }
  52.  
  53.  void nfs_to_standard_info(
  54. @@ -221,6 +256,7 @@ void nfs_to_remote_protocol_info(
  55.  {
  56.      (void)memset(rpi_out, 0, sizeof(FILE_REMOTE_PROTOCOL_INFORMATION));
  57.  
  58. +#if 0
  59.      rpi_out->StructureVersion = 4;
  60.      rpi_out->StructureSize = sizeof(FILE_REMOTE_PROTOCOL_INFORMATION);
  61.      rpi_out->Protocol = WNNC_NET_RDR2SAMPLE; /* FIXME! */
  62. @@ -237,6 +273,44 @@ void nfs_to_remote_protocol_info(
  63.       * |REMOTE_PROTOCOL_FLAG_INTEGRITY| (krb5i) in case of Krb5 auth
  64.       */
  65.      rpi_out->Flags = 0;
  66. +#else
  67. +    /* Pretend to be SMB */
  68. +    rpi_out->StructureVersion = 4;
  69. +    rpi_out->StructureSize = 116;
  70. +    rpi_out->Protocol = WNNC_NET_SMB;
  71. +    rpi_out->ProtocolMajorVersion = 3;
  72. +    rpi_out->ProtocolMinorVersion = 1;
  73. +    rpi_out->ProtocolRevision = 1;
  74. +    rpi_out->Reserved = 0x0;
  75. +    rpi_out->Flags = REMOTE_PROTOCOL_FLAG_MUTUAL_AUTH;
  76. +    rpi_out->GenericReserved.Reserved[0]=0x0;
  77. +    rpi_out->GenericReserved.Reserved[1]=0x0;
  78. +    rpi_out->GenericReserved.Reserved[2]=0x0;
  79. +    rpi_out->GenericReserved.Reserved[3]=0x0;
  80. +    rpi_out->GenericReserved.Reserved[4]=0x0;
  81. +    rpi_out->GenericReserved.Reserved[5]=0x0;
  82. +    rpi_out->GenericReserved.Reserved[6]=0x0;
  83. +    rpi_out->GenericReserved.Reserved[7]=0x0;
  84. +    rpi_out->ProtocolSpecific.Reserved[0]=0x6f;
  85. +    rpi_out->ProtocolSpecific.Reserved[1]=0x0;
  86. +    rpi_out->ProtocolSpecific.Reserved[2]=0x0;
  87. +    rpi_out->ProtocolSpecific.Reserved[3]=0x0;
  88. +    rpi_out->ProtocolSpecific.Reserved[4]=0x0;
  89. +    rpi_out->ProtocolSpecific.Reserved[5]=0x0;
  90. +    rpi_out->ProtocolSpecific.Reserved[6]=0x0;
  91. +    rpi_out->ProtocolSpecific.Reserved[7]=0x0;
  92. +    rpi_out->ProtocolSpecific.Reserved[8]=0x0;
  93. +    rpi_out->ProtocolSpecific.Reserved[9]=0x0;
  94. +    rpi_out->ProtocolSpecific.Reserved[10]=0x0;
  95. +    rpi_out->ProtocolSpecific.Reserved[11]=0x0;
  96. +    rpi_out->ProtocolSpecific.Reserved[12]=0x0;
  97. +    rpi_out->ProtocolSpecific.Reserved[13]=0x0;
  98. +    rpi_out->ProtocolSpecific.Reserved[14]=0x0;
  99. +    rpi_out->ProtocolSpecific.Reserved[15]=0x800000;
  100. +
  101. +    DPRINTF(0, ("nfs_to_remote_protocol_info: "
  102. +        "returning fake WNNC_NET_SMB info\n"));
  103. +#endif
  104.  }
  105.  
  106.  #ifdef NFS41_DRIVER_WSL_SUPPORT
  107. diff --git a/include/from_kernel.h b/include/from_kernel.h
  108. index b9640a1..da354ed 100644
  109. --- a/include/from_kernel.h
  110. +++ b/include/from_kernel.h
  111. @@ -388,6 +388,18 @@ typedef struct _FILE_REMOTE_PROTOCOL_INFORMATION
  112.      } ProtocolSpecificReserved;
  113.  #else
  114.      union {
  115. +        struct {
  116. +            struct {
  117. +                ULONG Capabilities;
  118. +            } Server;
  119. +            struct {
  120. +                ULONG Capabilities;
  121. +                ULONG CachingFlags;
  122. +                UCHAR ShareType;
  123. +                UCHAR Reserved0[3];
  124. +                ULONG Reserved1;
  125. +            } Share;
  126. +        } Smb2;
  127.          ULONG Reserved[16];
  128.      } ProtocolSpecific;
  129.  #endif /* (_WIN32_WINNT < _WIN32_WINNT_WIN8) */
  130. diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
  131. index 39689ab..f697ada 100644
  132. --- a/sys/nfs41sys_driver.c
  133. +++ b/sys/nfs41sys_driver.c
  134. @@ -1478,7 +1478,7 @@ NTSTATUS DriverEntry(
  135.      DbgP("DriverEntry: calling RxRegisterMinirdr\n");
  136.      status = RxRegisterMinirdr(&nfs41_dev, drv, &nfs41_ops, flags, &dev_name,
  137.                  sizeof(NFS41_DEVICE_EXTENSION),
  138. -                FILE_DEVICE_NETWORK_FILE_SYSTEM, FILE_REMOTE_DEVICE);
  139. +                FILE_DEVICE_NETWORK_FILE_SYSTEM, 0/*FILE_REMOTE_DEVICE*/);
  140.      if (status != STATUS_SUCCESS) {
  141.          print_error("RxRegisterMinirdr failed: 0x%08lx\n", status);
  142.          goto out;
  143. diff --git a/sys/nfs41sys_volinfo.c b/sys/nfs41sys_volinfo.c
  144. index 017dcb6..9c52ba5 100644
  145. --- a/sys/nfs41sys_volinfo.c
  146. +++ b/sys/nfs41sys_volinfo.c
  147. @@ -187,7 +187,7 @@ NTSTATUS nfs41_QueryVolumeInformation(
  148.              goto out;
  149.          }
  150.          pDevInfo->DeviceType = RxContext->pFcb->pNetRoot->DeviceType;
  151. -        pDevInfo->Characteristics = FILE_REMOTE_DEVICE | FILE_DEVICE_IS_MOUNTED;
  152. +        pDevInfo->Characteristics = /*FILE_REMOTE_DEVICE |*/ FILE_DEVICE_IS_MOUNTED;
  153.          RxContext->Info.LengthRemaining -= SizeUsed;
  154.          status = STATUS_SUCCESS;
  155.          goto out;

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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at