pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for debug output, fcblistlock locking+VS2022 driver test signing, 2024-10-14
Posted by Anonymous on Mon 14th Oct 2024 18:15
raw | new post

  1. From 20f3ff6b6319ff9bcf0258430f31565cfc49f5ce Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Mon, 14 Oct 2024 14:45:31 +0200
  4. Subject: [PATCH 1/3] sys: Fix |DbgPrintEx()| fmt %x to %x/%lx/%llx to match
  5.  the datatypes
  6.  
  7. Fix |DbgPrintEx()| fmt %x to %x/%lx/%llx to match the datatypes,
  8. mainly |NTSTATUS| to |long| and |LARGE_INTEGER.Quadpart| to
  9. |long long|.
  10.  
  11. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  12. ---
  13. sys/nfs41sys_acl.c        | 17 ++++++++++-------
  14.  sys/nfs41sys_debug.c      | 18 +++++++++++-------
  15.  sys/nfs41sys_debug.h      |  8 ++++----
  16.  sys/nfs41sys_dir.c        | 14 ++++++++------
  17.  sys/nfs41sys_driver.c     | 18 ++++++++++--------
  18.  sys/nfs41sys_ea.c         | 20 +++++++++++++-------
  19.  sys/nfs41sys_fileinfo.c   | 21 ++++++++++++---------
  20.  sys/nfs41sys_lock.c       | 16 ++++++++++------
  21.  sys/nfs41sys_mount.c      | 23 +++++++++++++----------
  22.  sys/nfs41sys_openclose.c  | 17 ++++++++++-------
  23.  sys/nfs41sys_readwrite.c  | 15 ++++++++-------
  24.  sys/nfs41sys_symlink.c    |  5 +++--
  25.  sys/nfs41sys_updowncall.c |  8 ++++----
  26.  sys/nfs41sys_volinfo.c    |  5 +++--
  27.  14 files changed, 119 insertions(+), 86 deletions(-)
  28.  
  29. diff --git a/sys/nfs41sys_acl.c b/sys/nfs41sys_acl.c
  30. index 02e7324..1ad4c77 100644
  31. --- a/sys/nfs41sys_acl.c
  32. +++ b/sys/nfs41sys_acl.c
  33. @@ -93,7 +93,7 @@ NTSTATUS marshal_nfs41_getacl(
  34.      *len = header_len;
  35.  
  36.  #ifdef DEBUG_MARSHAL_DETAIL
  37. -    DbgP("marshal_nfs41_getacl: class=0x%x\n", entry->u.Acl.query);
  38. +    DbgP("marshal_nfs41_getacl: class=0x%x\n", (int)entry->u.Acl.query);
  39.  #endif
  40.  out:
  41.      return status;
  42. @@ -129,7 +129,7 @@ NTSTATUS marshal_nfs41_setacl(
  43.  
  44.  #ifdef DEBUG_MARSHAL_DETAIL
  45.      DbgP("marshal_nfs41_setacl: class=0x%x sec_desc_len=%lu\n",
  46. -         entry->u.Acl.query, entry->buf_len);
  47. +         (int)entry->u.Acl.query, (long)entry->buf_len);
  48.  #endif
  49.  out:
  50.      return status;
  51. @@ -172,8 +172,9 @@ NTSTATUS map_query_acl_error(
  52.      case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  53.      default:
  54.          print_error("map_query_acl_error: "
  55. -            "failed to map windows ERROR_0x%x to NTSTATUS; "
  56. -            "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", error);
  57. +            "failed to map windows ERROR_0x%lx to NTSTATUS; "
  58. +            "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n",
  59. +            (long long)error);
  60.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  61.      }
  62.  }
  63. @@ -230,8 +231,9 @@ NTSTATUS nfs41_QuerySecurityInformation(
  64.          LARGE_INTEGER current_time;
  65.          KeQuerySystemTime(&current_time);
  66.  #ifdef DEBUG_ACL_QUERY
  67. -        DbgP("CurrentTime 0x%lx Saved Acl time 0x%lx\n",
  68. -            current_time.QuadPart, nfs41_fobx->time.QuadPart);
  69. +        DbgP("CurrentTime 0x%llx Saved Acl time 0x%llx\n",
  70. +            (long long)current_time.QuadPart,
  71. +            (long long)nfs41_fobx->time.QuadPart);
  72.  #endif
  73.          if (current_time.QuadPart - nfs41_fobx->time.QuadPart <= 20*1000) {
  74.              PSECURITY_DESCRIPTOR sec_desc = (PSECURITY_DESCRIPTOR)
  75. @@ -380,7 +382,8 @@ NTSTATUS nfs41_SetSecurityInformation(
  76.          status = RtlGetDaclSecurityDescriptor(sec_desc, &present, &acl,
  77.                      &dacl_default);
  78.          if (status) {
  79. -            DbgP("RtlGetDaclSecurityDescriptor failed 0x%x\n", status);
  80. +            DbgP("RtlGetDaclSecurityDescriptor failed status=0x%lx\n",
  81. +                (long)status);
  82.              goto out;
  83.          }
  84.          if (present == FALSE) {
  85. diff --git a/sys/nfs41sys_debug.c b/sys/nfs41sys_debug.c
  86. index 7bb0f33..d19a1f2 100644
  87. --- a/sys/nfs41sys_debug.c
  88. +++ b/sys/nfs41sys_debug.c
  89. @@ -218,18 +218,21 @@ void print_basic_info(int on, PFILE_BASIC_INFORMATION info)
  90.  {
  91.      if (!on) return;
  92.      DbgP("BASIC_INFO: "
  93. -        "Create=0x%lx Access=0x%lx Write=0x%lx Change=0x%lx Attr=0x%x\n",
  94. -        info->CreationTime.QuadPart, info->LastAccessTime.QuadPart,
  95. -        info->LastWriteTime.QuadPart, info->ChangeTime.QuadPart,
  96. -        info->FileAttributes);
  97. +        "Create=0x%llx Access=0x%llx Write=0x%llx Change=0x%llx Attr=0x%x\n",
  98. +        (long long)info->CreationTime.QuadPart,
  99. +        (long long)info->LastAccessTime.QuadPart,
  100. +        (long long)info->LastWriteTime.QuadPart,
  101. +        (long long)info->ChangeTime.QuadPart,
  102. +        (int)info->FileAttributes);
  103.  }
  104.  void print_std_info(int on, PFILE_STANDARD_INFORMATION info)
  105.  {
  106.      if (!on) return;
  107.      DbgP("STD_INFO: "
  108. -        "Type='%s' #Links=%d Alloc=0x%lx EOF=0x%lx Delete=%d\n",
  109. +        "Type='%s' #Links=%d Alloc=0x%llx EOF=0x%llx Delete=%d\n",
  110.          info->Directory?"DIR":"FILE", info->NumberOfLinks,
  111. -        info->AllocationSize.QuadPart, info->EndOfFile.QuadPart,
  112. +        (long long)info->AllocationSize.QuadPart,
  113. +        (long long)info->EndOfFile.QuadPart,
  114.          info->DeletePending);
  115.  }
  116.  
  117. @@ -767,7 +770,8 @@ dprintk(
  118.  
  119.          if (!NT_SUCCESS(status))
  120.              rv = DbgPrintEx(PNFS_FLTR_ID, DPFLTR_MASK | flags,
  121. -                            "RtlStringCbVPrintfA failed 0x%x \n", status);
  122. +                            "RtlStringCbVPrintfA failed 0x%lx \n",
  123. +                            (long)status);
  124.          else
  125.              rv = DbgPrintEx(PNFS_FLTR_ID, DPFLTR_MASK | flags, "'%s'    '%s': '%s'\n",
  126.                      PNFS_TRACE_TAG, func, debugMessageBuffer);
  127. diff --git a/sys/nfs41sys_debug.h b/sys/nfs41sys_debug.h
  128. index d5e0f03..d199ddf 100644
  129. --- a/sys/nfs41sys_debug.h
  130. +++ b/sys/nfs41sys_debug.h
  131. @@ -70,18 +70,18 @@ void print_debug_header(PRX_CONTEXT RxContext);
  132.          __func__); __try {
  133.  
  134.  #define DbgEx() DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL, \
  135. -        "<-- [%s] [%04x] %s status = 0x%08lx\n", _DRIVER_NAME_, PsGetCurrentProcessShortDebugId(), \
  136. -        __func__, status); \
  137. +        "<-- [%s] [%04x] %s status=0x%lx\n", _DRIVER_NAME_, PsGetCurrentProcessShortDebugId(), \
  138. +        __func__, (long)status); \
  139.          } __except (EXCEPTION_EXECUTE_HANDLER) { \
  140.              status = GetExceptionCode() ; \
  141. -            DbgP("Exception encountered with value = Ox%x\n", status); \
  142. +            DbgP("Exception encountered with value = 0x%lx\n", (long)status); \
  143.          }
  144.  #define DbgR() DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL, \
  145.          "<-- [%s] [%04x] %s\n", _DRIVER_NAME_, PsGetCurrentProcessShortDebugId(), __func__); \
  146.          } __except (EXCEPTION_EXECUTE_HANDLER) { \
  147.              NTSTATUS exc_status; \
  148.              exc_status = GetExceptionCode() ; \
  149. -            DbgP("Exception encountered with value = 0x%x\n", (int)exc_status); \
  150. +            DbgP("Exception encountered with value = 0x%lx\n", (long)exc_status); \
  151.          }
  152.  
  153.  /* These are for ToasterDebugPrint */
  154. diff --git a/sys/nfs41sys_dir.c b/sys/nfs41sys_dir.c
  155. index 01f078a..83109ed 100644
  156. --- a/sys/nfs41sys_dir.c
  157. +++ b/sys/nfs41sys_dir.c
  158. @@ -117,7 +117,7 @@ NTSTATUS marshal_nfs41_dirquery(
  159.          code = GetExceptionCode();
  160.          print_error("marshal_nfs41_dirquery: Call to "
  161.              "MmMapLockedPagesSpecifyCache() failed "
  162. -            "due to exception 0x%x\n", (int)code);
  163. +            "due to exception 0x%lx\n", (long)code);
  164.          status = STATUS_ACCESS_VIOLATION;
  165.          goto out;
  166.      }
  167. @@ -152,7 +152,8 @@ NTSTATUS unmarshal_nfs41_dirquery(
  168.      } __except(EXCEPTION_EXECUTE_HANDLER) {
  169.          NTSTATUS code;
  170.          code = GetExceptionCode();
  171. -        print_error("MmUnmapLockedPages thrown exception=0x%0x\n", code);
  172. +        print_error("MmUnmapLockedPages thrown exception=0x%lx\n",
  173. +            (long)code);
  174.          status = STATUS_ACCESS_VIOLATION;
  175.      }
  176.      if (buf_len > cur->buf_len)
  177. @@ -199,8 +200,9 @@ NTSTATUS map_querydir_errors(
  178.      case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  179.      default:
  180.          print_error("map_querydir_errors: "
  181. -            "failed to map windows ERROR_0x%x to NTSTATUS; "
  182. -            "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
  183. +            "failed to map windows ERROR_0x%lx to NTSTATUS; "
  184. +            "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n",
  185. +            (long)status);
  186.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  187.      }
  188.  }
  189. @@ -303,8 +305,8 @@ NTSTATUS nfs41_QueryDirectory(
  190.          status = STATUS_SUCCESS;
  191.      } else if ((entry->status == STATUS_ACCESS_VIOLATION) ||
  192.          (entry->status == STATUS_INSUFFICIENT_RESOURCES)) {
  193. -        DbgP("nfs41_QueryDirectory: internal error: entry->status=0x%x\n",
  194. -            (int)entry->status);
  195. +        DbgP("nfs41_QueryDirectory: internal error: entry->status=0x%lx\n",
  196. +            (long)entry->status);
  197.          status = STATUS_INSUFFICIENT_RESOURCES;
  198.      } else {
  199.          /* map windows ERRORs to NTSTATUS */
  200. diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
  201. index 193ab28..246ba36 100644
  202. --- a/sys/nfs41sys_driver.c
  203. +++ b/sys/nfs41sys_driver.c
  204. @@ -224,7 +224,7 @@ NTSTATUS marshal_nfs41_header(
  205.          MmIsAddressValid(entry->filename->Buffer)) {
  206.  #ifdef DEBUG_MARSHAL_HEADER
  207.          DbgP("[upcall header] xid=%lld opcode='%s' filename='%wZ' version=%d "
  208. -            "session=0x%x open_state=0x%x\n", entry->xid,
  209. +            "session=0x%p open_state=0x%x\n", entry->xid,
  210.              ENTRY_OPCODE2STRING(entry), entry->filename,
  211.              entry->version, entry->session, entry->open_state);
  212.  #endif /* DEBUG_MARSHAL_HEADER */
  213. @@ -670,17 +670,19 @@ static ULONG nfs41_ExtendForCache(
  214.      PLOWIO_CONTEXT LowIoContext  = &RxContext->LowIoContext;
  215.      DbgEn();
  216.      print_debug_header(RxContext);
  217. -    DbgP("input: byte count 0x%x filesize 0x%x alloc size 0x%x\n",
  218. -        LowIoContext->ParamsFor.ReadWrite.ByteCount, *pNewFileSize,
  219. -        *pNewAllocationSize);
  220. +    DbgP("input: bytecount=0x%lx filesize=0x%llx allocsize=0x%llx\n",
  221. +        (long)LowIoContext->ParamsFor.ReadWrite.ByteCount,
  222. +        (long long)pNewFileSize->QuadPart,
  223. +        (long long)pNewAllocationSize->QuadPart);
  224.  #endif
  225.      pNewAllocationSize->QuadPart = pNewFileSize->QuadPart + 8192;
  226.      nfs41_fcb->StandardInfo.AllocationSize.QuadPart =
  227.          pNewAllocationSize->QuadPart;
  228.      nfs41_fcb->StandardInfo.EndOfFile.QuadPart = pNewFileSize->QuadPart;
  229.  #ifdef DEBUG_CACHE
  230. -    DbgP("new filesize 0x%x new allocation size 0x%x\n",
  231. -        *pNewFileSize, *pNewAllocationSize);
  232. +    DbgP("newfilesize=0x%llx newallocationsize=0x%llx\n",
  233. +        (long long)pNewFileSize->QuadPart,
  234. +        (long long)pNewAllocationSize->QuadPart);
  235.  #endif
  236.  #ifdef DEBUG_CACHE
  237.      DbgEx();
  238. @@ -993,7 +995,7 @@ out:
  239.  #ifdef DEBUG_FSDDISPATCH
  240.      DbgP("IoStatus status = 0x%lx info = 0x%x\n",
  241.          (long)Irp->IoStatus.Status,
  242. -        Irp->IoStatus.Information);
  243. +        (int)Irp->IoStatus.Information);
  244.      DbgEx();
  245.  #endif
  246.      return status;
  247. @@ -1009,7 +1011,7 @@ NTSTATUS nfs41_AreFilesAliased(
  248.      PFCB a,
  249.      PFCB b)
  250.  {
  251. -    DbgP("nfs41_AreFilesAliased: a=0x%p b=%0x%p\n",
  252. +    DbgP("nfs41_AreFilesAliased: a=0x%p b=0x%p\n",
  253.          (void *)a, (void *)b);
  254.      return STATUS_NOT_IMPLEMENTED;
  255.  }
  256. diff --git a/sys/nfs41sys_ea.c b/sys/nfs41sys_ea.c
  257. index 83943de..dee8ef1 100644
  258. --- a/sys/nfs41sys_ea.c
  259. +++ b/sys/nfs41sys_ea.c
  260. @@ -100,7 +100,9 @@ NTSTATUS marshal_nfs41_easet(
  261.  
  262.  #ifdef DEBUG_MARSHAL_DETAIL
  263.      DbgP("marshal_nfs41_easet: filename='%wZ', buflen=%d mode=0x%x\n",
  264. -        entry->filename, entry->buf_len, entry->u.SetEa.mode);
  265. +        entry->filename,
  266. +        (int)entry->buf_len,
  267. +        (int)entry->u.SetEa.mode);
  268.  #endif
  269.  out:
  270.      return status;
  271. @@ -172,10 +174,13 @@ void unmarshal_nfs41_eaget(
  272.  static void print_nfs3_attrs(
  273.      nfs3_attrs *attrs)
  274.  {
  275. -    DbgP("type=%d mode=0%o nlink=%d size=%d "
  276. -        "atime=0x%x mtime=0x%x ctime=0x%x\n",
  277. -        attrs->type, attrs->mode, attrs->nlink, attrs->size, attrs->atime,
  278. -        attrs->mtime, attrs->ctime);
  279. +    DbgP("type=%d mode=0%o nlink=%d size=%lld "
  280. +        "atime=0x%llx mtime=0x%llx ctime=0x%llx\n",
  281. +        attrs->type, attrs->mode, attrs->nlink,
  282. +        (long long)attrs->size.QuadPart,
  283. +        (long long)attrs->atime,
  284. +        (long long)attrs->mtime,
  285. +        (long long)attrs->ctime);
  286.  }
  287.  
  288.  static void file_time_to_nfs_time(
  289. @@ -233,8 +238,9 @@ NTSTATUS map_setea_error(
  290.      case ERROR_INTERNAL_ERROR:          return STATUS_INTERNAL_ERROR;
  291.      default:
  292.          print_error("map_setea_error: "
  293. -            "failed to map windows ERROR_0x%x to NTSTATUS; "
  294. -            "defaulting to STATUS_INVALID_PARAMETER\n", error);
  295. +            "failed to map windows ERROR_0x%lx to NTSTATUS; "
  296. +            "defaulting to STATUS_INVALID_PARAMETER\n",
  297. +            (long)error);
  298.      case ERROR_INVALID_PARAMETER:       return STATUS_INVALID_PARAMETER;
  299.      }
  300.  }
  301. diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
  302. index 0839bc2..0f7ca82 100644
  303. --- a/sys/nfs41sys_fileinfo.c
  304. +++ b/sys/nfs41sys_fileinfo.c
  305. @@ -174,8 +174,9 @@ NTSTATUS map_queryfile_error(
  306.      case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  307.      default:
  308.          print_error("map_queryfile_error: "
  309. -            "failed to map windows ERROR_0x%x to NTSTATUS; "
  310. -            "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", error);
  311. +            "failed to map windows ERROR_0x%lx to NTSTATUS; "
  312. +            "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n",
  313. +            (long)error);
  314.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  315.      }
  316.  }
  317. @@ -369,8 +370,8 @@ NTSTATUS nfs41_QueryFileInformation(
  318.              if (nfs41_fcb->StandardInfo.AllocationSize.QuadPart >
  319.                      std_info->AllocationSize.QuadPart) {
  320.  #ifdef DEBUG_FILE_QUERY
  321. -                DbgP("Old AllocationSize is bigger: saving 0x%x\n",
  322. -                    nfs41_fcb->StandardInfo.AllocationSize.QuadPart);
  323. +                DbgP("Old AllocationSize is bigger: saving 0x%llx\n",
  324. +                    (long long)nfs41_fcb->StandardInfo.AllocationSize.QuadPart);
  325.  #endif
  326.                  std_info->AllocationSize.QuadPart =
  327.                      nfs41_fcb->StandardInfo.AllocationSize.QuadPart;
  328. @@ -378,8 +379,8 @@ NTSTATUS nfs41_QueryFileInformation(
  329.              if (nfs41_fcb->StandardInfo.EndOfFile.QuadPart >
  330.                      std_info->EndOfFile.QuadPart) {
  331.  #ifdef DEBUG_FILE_QUERY
  332. -                DbgP("Old EndOfFile is bigger: saving 0x%x\n",
  333. -                    nfs41_fcb->StandardInfo.EndOfFile);
  334. +                DbgP("Old EndOfFile is bigger: saving 0x%llx\n",
  335. +                    (long long)nfs41_fcb->StandardInfo.EndOfFile.QuadPart);
  336.  #endif
  337.                  std_info->EndOfFile.QuadPart =
  338.                      nfs41_fcb->StandardInfo.EndOfFile.QuadPart;
  339. @@ -420,7 +421,8 @@ out:
  340.  #endif
  341.  #ifdef DEBUG_FILE_QUERY
  342.      DbgEx();
  343. -    DbgP("<-- nfs41_QueryFileInformation, status=0x%lx\n", (long)status);
  344. +    DbgP("<-- nfs41_QueryFileInformation, status=0x%lx\n",
  345. +        (long)status);
  346.  #endif
  347.      return status;
  348.  }
  349. @@ -447,8 +449,9 @@ NTSTATUS map_setfile_error(
  350.      case ERROR_INTERNAL_ERROR:          return STATUS_INTERNAL_ERROR;
  351.      default:
  352.          print_error("map_setfile_error: "
  353. -            "failed to map windows ERROR_0x%x to NTSTATUS; "
  354. -            "defaulting to STATUS_INVALID_PARAMETER\n", error);
  355. +            "failed to map windows ERROR_0x%lx to NTSTATUS; "
  356. +            "defaulting to STATUS_INVALID_PARAMETER\n",
  357. +            (long)error);
  358.      case ERROR_INVALID_PARAMETER:       return STATUS_INVALID_PARAMETER;
  359.      }
  360.  }
  361. diff --git a/sys/nfs41sys_lock.c b/sys/nfs41sys_lock.c
  362. index 208fc6d..50f0716 100644
  363. --- a/sys/nfs41sys_lock.c
  364. +++ b/sys/nfs41sys_lock.c
  365. @@ -100,7 +100,9 @@ NTSTATUS marshal_nfs41_lock(
  366.  #ifdef DEBUG_MARSHAL_DETAIL
  367.      DbgP("marshal_nfs41_lock: "
  368.          "offset=0x%llx length=0x%llx exclusive=%u "
  369. -        "blocking=%u\n", entry->u.Lock.offset, entry->u.Lock.length,
  370. +        "blocking=%u\n",
  371. +        (long long)entry->u.Lock.offset,
  372. +        (long long)entry->u.Lock.length,
  373.          entry->u.Lock.exclusive, entry->u.Lock.blocking);
  374.  #endif
  375.  out:
  376. @@ -158,7 +160,8 @@ NTSTATUS nfs41_IsLockRealizable(
  377.  #ifdef DEBUG_LOCK
  378.      DbgEn();
  379.      DbgP("offset 0x%llx, length 0x%llx, exclusive=%u, blocking=%u\n",
  380. -        ByteOffset->QuadPart,Length->QuadPart,
  381. +        (long long)ByteOffset->QuadPart,
  382. +        (long long)Length->QuadPart,
  383.          BooleanFlagOn(LowIoLockFlags, SL_EXCLUSIVE_LOCK),
  384.          !BooleanFlagOn(LowIoLockFlags, SL_FAIL_IMMEDIATELY));
  385.  #endif
  386. @@ -191,8 +194,9 @@ NTSTATUS map_lock_errors(
  387.      case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  388.      default:
  389.          print_error("map_lock_errors: "
  390. -            "failed to map windows ERROR_0x%x to NTSTATUS; "
  391. -            "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
  392. +            "failed to map windows ERROR_0x%lx to NTSTATUS; "
  393. +            "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n",
  394. +            (long)status);
  395.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  396.      }
  397.  }
  398. @@ -204,8 +208,8 @@ static void print_lock_args(
  399.      const ULONG flags = LowIoContext->ParamsFor.Locks.Flags;
  400.      print_debug_header(RxContext);
  401.      DbgP("offset 0x%llx, length 0x%llx, exclusive=%u, blocking=%u\n",
  402. -        LowIoContext->ParamsFor.Locks.ByteOffset,
  403. -        LowIoContext->ParamsFor.Locks.Length,
  404. +        (long long)LowIoContext->ParamsFor.Locks.ByteOffset,
  405. +        (long long)LowIoContext->ParamsFor.Locks.Length,
  406.          BooleanFlagOn(flags, SL_EXCLUSIVE_LOCK),
  407.          !BooleanFlagOn(flags, SL_FAIL_IMMEDIATELY));
  408.  }
  409. diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
  410. index e062df6..8317980 100644
  411. --- a/sys/nfs41sys_mount.c
  412. +++ b/sys/nfs41sys_mount.c
  413. @@ -163,8 +163,9 @@ void unmarshal_nfs41_mount(
  414.      *buf += sizeof(DWORD);
  415.      RtlCopyMemory(cur->u.Mount.FsAttrs, *buf, sizeof(FILE_FS_ATTRIBUTE_INFORMATION));
  416.  #ifdef DEBUG_MARSHAL_DETAIL
  417. -    DbgP("unmarshal_nfs41_mount: session pointer 0x%x version %d lease_time "
  418. -         "%d\n", cur->session, cur->version, cur->u.Mount.lease_time);
  419. +    DbgP("unmarshal_nfs41_mount: session=0x%p version=%d lease_time "
  420. +         "%d\n",
  421. +         cur->session, cur->version, cur->u.Mount.lease_time);
  422.  #endif
  423.  }
  424.  
  425. @@ -228,8 +229,9 @@ NTSTATUS map_mount_errors(
  426.      case ERROR_INTERNAL_ERROR:  return STATUS_INTERNAL_ERROR;
  427.      default:
  428.          print_error("map_mount_errors: "
  429. -            "failed to map windows ERROR_0x%x to NTSTATUS; "
  430. -            "defaulting to STATUS_INSUFFICIENT_RESOURCES\n", status);
  431. +            "failed to map windows ERROR_0x%lx to NTSTATUS; "
  432. +            "defaulting to STATUS_INSUFFICIENT_RESOURCES\n",
  433. +            (long)status);
  434.          return STATUS_INSUFFICIENT_RESOURCES;
  435.      }
  436.  }
  437. @@ -629,13 +631,14 @@ NTSTATUS nfs41_GetLUID(
  438.          FALSE, &clnt_sec_ctx);
  439.      if (status) {
  440.          print_error("nfs41_GetLUID: SeCreateClientSecurityFromSubjectContext "
  441. -             "failed 0x%x\n", status);
  442. +             "failed status=0x%lx\n", (long)status);
  443.          goto release_sec_ctx;
  444.      }
  445.      status = SeQueryAuthenticationIdToken(clnt_sec_ctx.ClientToken, id);
  446.      if (status) {
  447.          print_error("nfs41_GetLUID: "
  448. -            "SeQueryAuthenticationIdToken() failed 0x%x\n", status);
  449. +            "SeQueryAuthenticationIdToken() failed 0x%lx\n",
  450. +            (long)status);
  451.          goto release_clnt_sec_ctx;
  452.      }
  453.  release_clnt_sec_ctx:
  454. @@ -754,11 +757,11 @@ NTSTATUS nfs41_CreateVNetRoot(
  455.      // print_v_net_root(pVNetRoot);
  456.  
  457.      DbgP("pVNetRoot=0x%p pNetRoot=0x%p pSrvCall=0x%p\n", pVNetRoot, pNetRoot, pSrvCall);
  458. -    DbgP("pNetRoot='%wZ' Type=%d pSrvCallName='%wZ' VirtualNetRootStatus=0x%x "
  459. +    DbgP("pNetRoot='%wZ' Type=%d pSrvCallName='%wZ' VirtualNetRootStatus=0x%lx "
  460.          "NetRootStatus=0x%x\n", pNetRoot->pNetRootName,
  461.          pNetRoot->Type, pSrvCall->pSrvCallName,
  462.          pCreateNetRootContext->VirtualNetRootStatus,
  463. -        pCreateNetRootContext->NetRootStatus);
  464. +        (long)pCreateNetRootContext->NetRootStatus);
  465.  #endif
  466.  
  467.      if (pNetRoot->Type != NET_ROOT_DISK && pNetRoot->Type != NET_ROOT_WILD) {
  468. @@ -1090,7 +1093,7 @@ NTSTATUS nfs41_CreateVNetRoot(
  469.          /* modify existing mount entry */
  470.  #ifdef DEBUG_MOUNT
  471.          DbgP("Using existing %d flavor session 0x%x\n",
  472. -            pVNetRootContext->sec_flavor);
  473. +            (int)pVNetRootContext->sec_flavor);
  474.  #endif
  475.          switch (pVNetRootContext->sec_flavor) {
  476.          case RPCSEC_AUTH_SYS:
  477. @@ -1105,7 +1108,7 @@ NTSTATUS nfs41_CreateVNetRoot(
  478.      }
  479.      pNetRootContext->nfs41d_version = nfs41d_version;
  480.  #ifdef DEBUG_MOUNT
  481. -    DbgP("Saving new session 0x%x\n", pVNetRootContext->session);
  482. +    DbgP("Saving new session 0x%p\n", pVNetRootContext->session);
  483.  #endif
  484.  
  485.  out_free:
  486. diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
  487. index 14f3471..0018105 100644
  488. --- a/sys/nfs41sys_openclose.c
  489. +++ b/sys/nfs41sys_openclose.c
  490. @@ -93,7 +93,7 @@ NTSTATUS nfs41_get_sec_ctx(
  491.          FALSE, out_ctx);
  492.      if (status != STATUS_SUCCESS) {
  493.          print_error("SeCreateClientSecurityFromSubjectContext "
  494. -            "failed with 0x%x\n", status);
  495. +            "failed with 0x%lx\n", (long)status);
  496.      }
  497.  #ifdef DEBUG_SECURITY_TOKEN
  498.      DbgP("Created client security token 0x%p\n", out_ctx->ClientToken);
  499. @@ -175,7 +175,7 @@ NTSTATUS marshal_nfs41_open(
  500.      } __except(EXCEPTION_EXECUTE_HANDLER) {
  501.          print_error("marshal_nfs41_open: Call to "
  502.              "MmMapLockedPagesSpecifyCache() failed "
  503. -            "due to exception 0x%x\n", (int)GetExceptionCode());
  504. +            "due to exception 0x%lx\n", (long)GetExceptionCode());
  505.          status = STATUS_ACCESS_VIOLATION;
  506.          goto out;
  507.      }
  508. @@ -254,7 +254,8 @@ NTSTATUS unmarshal_nfs41_open(
  509.          if (cur->u.Open.EaBuffer)
  510.              MmUnmapLockedPages(cur->u.Open.EaBuffer, cur->u.Open.EaMdl);
  511.      } __except(EXCEPTION_EXECUTE_HANDLER) {
  512. -        print_error("MmUnmapLockedPages thrown exception=0x%0x\n", GetExceptionCode());
  513. +        print_error("MmUnmapLockedPages thrown exception=0x%lx\n",
  514. +            (long)GetExceptionCode());
  515.          status = cur->status = STATUS_ACCESS_VIOLATION;
  516.          goto out;
  517.      }
  518. @@ -381,8 +382,9 @@ NTSTATUS map_open_errors(
  519.      case ERROR_FILE_TOO_LARGE:          return STATUS_FILE_TOO_LARGE;
  520.      case ERROR_INTERNAL_ERROR:          return STATUS_INTERNAL_ERROR;
  521.      default:
  522. -        print_error("[ERROR] nfs41_Create: upcall returned ERROR_0x%x "
  523. -            "returning STATUS_INSUFFICIENT_RESOURCES\n", status);
  524. +        print_error("[ERROR] nfs41_Create: upcall returned ERROR_0x%lx "
  525. +            "returning STATUS_INSUFFICIENT_RESOURCES\n",
  526. +            (long)status);
  527.      case ERROR_OUTOFMEMORY:             return STATUS_INSUFFICIENT_RESOURCES;
  528.      }
  529.  }
  530. @@ -955,8 +957,9 @@ NTSTATUS map_close_errors(
  531.      case ERROR_FILE_TOO_LARGE:  return STATUS_FILE_TOO_LARGE;
  532.      default:
  533.          print_error("map_close_errors: "
  534. -            "failed to map windows ERROR_0x%x to NTSTATUS; "
  535. -            "defaulting to STATUS_INTERNAL_ERROR\n", status);
  536. +            "failed to map windows ERROR_0x%lx to NTSTATUS; "
  537. +            "defaulting to STATUS_INTERNAL_ERROR\n",
  538. +            (long)status);
  539.      case ERROR_INTERNAL_ERROR:  return STATUS_INTERNAL_ERROR;
  540.      }
  541.  }
  542. diff --git a/sys/nfs41sys_readwrite.c b/sys/nfs41sys_readwrite.c
  543. index d567824..c039d23 100644
  544. --- a/sys/nfs41sys_readwrite.c
  545. +++ b/sys/nfs41sys_readwrite.c
  546. @@ -77,9 +77,9 @@ static void print_readwrite_args(
  547.      PLOWIO_CONTEXT LowIoContext  = &RxContext->LowIoContext;
  548.  
  549.      print_debug_header(RxContext);
  550. -    DbgP("Bytecount 0x%x Byteoffset 0x%x Buffer 0x%p\n",
  551. -        LowIoContext->ParamsFor.ReadWrite.ByteCount,
  552. -        LowIoContext->ParamsFor.ReadWrite.ByteOffset,
  553. +    DbgP("Byteoffset=0x%llx Bytecount=0x%llx Buffer=0x%p\n",
  554. +        (long long)LowIoContext->ParamsFor.ReadWrite.ByteOffset,
  555. +        (long long)LowIoContext->ParamsFor.ReadWrite.ByteCount,
  556.          LowIoContext->ParamsFor.ReadWrite.Buffer);
  557.  }
  558.  
  559. @@ -132,7 +132,7 @@ NTSTATUS marshal_nfs41_rw(
  560.          code = GetExceptionCode();
  561.          print_error("marshal_nfs41_rw: Call to "
  562.              "MmMapLockedPagesSpecifyCache() failed due to "
  563. -            "exception 0x%x\n", (int)code);
  564. +            "exception 0x%lx\n", (long)code);
  565.          status = STATUS_ACCESS_VIOLATION;
  566.          goto out;
  567.      }
  568. @@ -174,7 +174,7 @@ NTSTATUS unmarshal_nfs41_rw(
  569.          NTSTATUS code;
  570.          code = GetExceptionCode();
  571.          print_error("unmarshal_nfs41_rw: Call to MmUnmapLockedPages() "
  572. -            "failed due to exception 0x%0x\n", (int)code);
  573. +            "failed due to exception 0x%0x\n", (long)code);
  574.          status = STATUS_ACCESS_VIOLATION;
  575.      }
  576.  #endif
  577. @@ -198,8 +198,9 @@ NTSTATUS map_readwrite_errors(
  578.      case ERROR_INTERNAL_ERROR:          return STATUS_INTERNAL_ERROR;
  579.      default:
  580.          print_error("map_readwrite_errors: "
  581. -            "failed to map windows ERROR_0x%x to NTSTATUS; "
  582. -            "defaulting to STATUS_NET_WRITE_FAULT\n", status);
  583. +            "failed to map windows ERROR_0x%lx to NTSTATUS; "
  584. +            "defaulting to STATUS_NET_WRITE_FAULT\n",
  585. +            (long)status);
  586.      case ERROR_NET_WRITE_FAULT:         return STATUS_NET_WRITE_FAULT;
  587.      }
  588.  }
  589. diff --git a/sys/nfs41sys_symlink.c b/sys/nfs41sys_symlink.c
  590. index ad5d968..938a733 100644
  591. --- a/sys/nfs41sys_symlink.c
  592. +++ b/sys/nfs41sys_symlink.c
  593. @@ -148,8 +148,9 @@ NTSTATUS map_symlink_errors(
  594.      case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  595.      default:
  596.          print_error("map_symlink_errors: "
  597. -            "failed to map windows ERROR_0x%x to NTSTATUS; "
  598. -            "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
  599. +            "failed to map windows ERROR_0x%lx to NTSTATUS; "
  600. +            "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n",
  601. +            (long)status);
  602.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  603.      }
  604.  }
  605. diff --git a/sys/nfs41sys_updowncall.c b/sys/nfs41sys_updowncall.c
  606. index aff160d..f79712e 100644
  607. --- a/sys/nfs41sys_updowncall.c
  608. +++ b/sys/nfs41sys_updowncall.c
  609. @@ -214,7 +214,7 @@ NTSTATUS handle_upcall(
  610.          NTSTATUS code;
  611.          code = GetExceptionCode();
  612.          print_error("handle_upcall: Call to SeImpersonateClientEx() "
  613. -            "failed due to exception 0x%0x\n", (int)code);
  614. +            "failed due to exception 0x%lx\n", (long)code);
  615.          status = STATUS_INTERNAL_ERROR;
  616.      }
  617.  #else
  618. @@ -222,7 +222,7 @@ NTSTATUS handle_upcall(
  619.  #endif /* NFS41_DRIVER_STABILITY_HACKS */
  620.      if (status != STATUS_SUCCESS) {
  621.          print_error("handle_upcall: "
  622. -            "SeImpersonateClientEx() failed 0x%x\n", status);
  623. +            "SeImpersonateClientEx() failed 0x%lx\n", (long)status);
  624.          goto out;
  625.      }
  626.  
  627. @@ -349,8 +349,8 @@ NTSTATUS nfs41_UpcallCreate(
  628.          if (status != STATUS_SUCCESS) {
  629.              print_error("nfs41_UpcallCreate: "
  630.                  "SeCreateClientSecurityFromSubjectContext() "
  631. -                "failed with 0x%x\n",
  632. -                status);
  633. +                "failed with 0x%lx\n",
  634. +                (long)status);
  635.              nfs41_upcall_free_updowncall_entry(entry);
  636.              entry = NULL;
  637.          }
  638. diff --git a/sys/nfs41sys_volinfo.c b/sys/nfs41sys_volinfo.c
  639. index 253e050..b153ddb 100644
  640. --- a/sys/nfs41sys_volinfo.c
  641. +++ b/sys/nfs41sys_volinfo.c
  642. @@ -139,8 +139,9 @@ NTSTATUS map_volume_errors(
  643.      case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  644.      default:
  645.          print_error("map_volume_errors: "
  646. -            "failed to map windows ERROR_0x%x to NTSTATUS; "
  647. -            "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
  648. +            "failed to map windows ERROR_0x%lx to NTSTATUS; "
  649. +            "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n",
  650. +            (long)status);
  651.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  652.      }
  653.  }
  654. --
  655. 2.45.1
  656.  
  657. From 719e0fd6a45e9352f6842fe83ca1003bd28a1cc2 Mon Sep 17 00:00:00 2001
  658. From: Roland Mainz <roland.mainz@nrubsig.org>
  659. Date: Mon, 14 Oct 2024 17:28:27 +0200
  660. Subject: [PATCH 2/3] sys: Fix mutex |fcblistLock| release in
  661.  |enable_caching()|
  662.  
  663. Fix mutex |fcblistLock| release in |enable_caching()|
  664.  
  665. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  666. ---
  667. sys/nfs41sys_driver.c | 4 +++-
  668.  1 file changed, 3 insertions(+), 1 deletion(-)
  669.  
  670. diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
  671. index 246ba36..362dc82 100644
  672. --- a/sys/nfs41sys_driver.c
  673. +++ b/sys/nfs41sys_driver.c
  674. @@ -941,7 +941,8 @@ void enable_caching(
  675.  #endif
  676.          oentry = RxAllocatePoolWithTag(NonPagedPoolNx,
  677.              sizeof(nfs41_fcb_list_entry), NFS41_MM_POOLTAG_OPEN);
  678. -        if (oentry == NULL) return;
  679. +        if (oentry == NULL)
  680. +            goto out_release_fcblistlock;
  681.          oentry->fcb = SrvOpen->pFcb;
  682.          oentry->session = session;
  683.          oentry->nfs41_fobx = nfs41_fobx;
  684. @@ -950,6 +951,7 @@ void enable_caching(
  685.          InsertTailList(&openlist.head, &oentry->next);
  686.          nfs41_fobx->deleg_type = 0;
  687.      }
  688. +out_release_fcblistlock:
  689.      ExReleaseFastMutex(&fcblistLock);
  690.  }
  691.  
  692. --
  693. 2.45.1
  694.  
  695. From f8ad720d25d090ef1c6a37775191e6a24dafb5f5 Mon Sep 17 00:00:00 2001
  696. From: Roland Mainz <roland.mainz@nrubsig.org>
  697. Date: Mon, 14 Oct 2024 17:55:56 +0200
  698. Subject: [PATCH 3/3] build.vc19: Explicitly use "sha256" for driver signing
  699.  for VS2022 support
  700.  
  701. Explicitly use "sha256" for driver signing for VS2022 support
  702.  
  703. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  704. ---
  705. build.vc19/nfs41_driver/nfs41_driver.vcxproj | 12 ++++++++++++
  706.  1 file changed, 12 insertions(+)
  707.  
  708. diff --git a/build.vc19/nfs41_driver/nfs41_driver.vcxproj b/build.vc19/nfs41_driver/nfs41_driver.vcxproj
  709. index 4481c16..0af98cd 100644
  710. --- a/build.vc19/nfs41_driver/nfs41_driver.vcxproj
  711. +++ b/build.vc19/nfs41_driver/nfs41_driver.vcxproj
  712. @@ -174,6 +174,9 @@
  713.      <Link>
  714.        <AdditionalDependencies>$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib</AdditionalDependencies>
  715.      </Link>
  716. +    <DriverSign>
  717. +      <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
  718. +    </DriverSign>
  719.    </ItemDefinitionGroup>
  720.    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
  721.      <ClCompile>
  722. @@ -188,6 +191,9 @@
  723.      <Link>
  724.        <AdditionalDependencies>$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib</AdditionalDependencies>
  725.      </Link>
  726. +    <DriverSign>
  727. +      <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
  728. +    </DriverSign>
  729.    </ItemDefinitionGroup>
  730.    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
  731.      <ClCompile>
  732. @@ -230,6 +236,9 @@
  733.      <Link>
  734.        <AdditionalDependencies>$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib</AdditionalDependencies>
  735.      </Link>
  736. +    <DriverSign>
  737. +      <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
  738. +    </DriverSign>
  739.    </ItemDefinitionGroup>
  740.    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
  741.      <ClCompile>
  742. @@ -244,6 +253,9 @@
  743.      <Link>
  744.        <AdditionalDependencies>$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib</AdditionalDependencies>
  745.      </Link>
  746. +    <DriverSign>
  747. +      <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
  748. +    </DriverSign>
  749.    </ItemDefinitionGroup>
  750.    <ItemGroup>
  751.      <FilesToPackage Include="$(TargetPath)" />
  752. --
  753. 2.45.1

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