pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for nfs_mount/np issues, DOS drive autoselection fix, VS2022 64bit-only build, UCRT ISO widefmt defaults+misc, 2024-12-02
Posted by Anonymous on Mon 2nd Dec 2024 18:12
raw | new post

  1. From efc27b293a1f9c2f86f6f013f312e9e243c5d8aa Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Fri, 29 Nov 2024 18:15:10 +0100
  4. Subject: [PATCH 1/8] cygwin: Add "build64", "installdest64" and "bintarball64"
  5.  for 64bit-only builds
  6.  
  7. Add "build64", "installdest64" and "bintarball64" for 64bit-only builds
  8. to support Visual Studio 2022, which no longer supports building
  9. for 32bit kernels.
  10.  
  11. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  12. ---
  13. cygwin/Makefile                 | 60 ++++++++++++++++++++++++---------
  14.  cygwin/Makefile.install         |  7 ++++
  15.  cygwin/README.txt               | 37 +++++++++++++++++---
  16.  cygwin/devel/msnfs41client.bash |  2 +-
  17.  4 files changed, 85 insertions(+), 21 deletions(-)
  18.  
  19. diff --git a/cygwin/Makefile b/cygwin/Makefile
  20. index 43813de..5993c1a 100644
  21. --- a/cygwin/Makefile
  22. +++ b/cygwin/Makefile
  23. @@ -18,20 +18,6 @@ VS_BUILD_DIR64:=$(PROJECT_BASEDIR_DIR)/build.vc19/x64/Debug/
  24.  #VS_BUILD_DIR32:=$(PROJECT_BASEDIR_DIR)/build.vc19/Release/
  25.  #VS_BUILD_DIR64:=$(PROJECT_BASEDIR_DIR)/build.vc19/x64/Release/
  26.  
  27. -# trigger "build" target when these binaries are needed
  28. -$(VS_BUILD_DIR32)/nfsd.exe \
  29. -       $(VS_BUILD_DIR32)/nfs_mount.exe \
  30. -       $(VS_BUILD_DIR32)/nfs_install.exe \
  31. -       $(VS_BUILD_DIR32)/nfs41_driver.sys \
  32. -       $(VS_BUILD_DIR32)/libtirpc.dll \
  33. -       $(VS_BUILD_DIR32)/nfs41_np.dll \
  34. -       $(VS_BUILD_DIR64)/nfsd.exe \
  35. -       $(VS_BUILD_DIR64)/nfs_mount.exe \
  36. -       $(VS_BUILD_DIR64)/nfs_install.exe \
  37. -       $(VS_BUILD_DIR64)/nfs41_driver.sys \
  38. -       $(VS_BUILD_DIR64)/libtirpc.dll \
  39. -       $(VS_BUILD_DIR64)/nfs41_np.dll: build
  40. -
  41.  # trigger "build_testutils" target when these binaries are needed
  42.  $(PROJECT_BASEDIR_DIR)/tests/ea/nfs_ea.exe \
  43.         $(PROJECT_BASEDIR_DIR)/tests/winfsinfo1/winfsinfo.exe \
  44. @@ -60,6 +46,16 @@ build_32bit_debug:
  45.         which MSBuild.exe
  46.         MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:Build  -p:Configuration=Debug -p:Platform=x86
  47.  
  48. +build_32bit_release_clientutils:
  49. +       @printf '#\n# PATH is %q\n#\n' '$(PATH)'
  50. +       which MSBuild.exe
  51. +       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:nfs41_np,nfs_mount  -p:Configuration=Release -p:Platform=x86
  52. +
  53. +build_32bit_debug_clientutils:
  54. +       @printf '#\n# PATH is %q\n#\n' '$(PATH)'
  55. +       which MSBuild.exe
  56. +       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:nfs41_np,nfs_mount  -p:Configuration=Debug -p:Platform=x86
  57. +
  58.  build_arm_64bit_debug:
  59.         @printf '#\n# PATH is %q\n#\n' '$(PATH)'
  60.         which MSBuild.exe
  61. @@ -73,6 +69,19 @@ build_testutils:
  62.  build: build_32bit_release build_32bit_debug build_64bit_release build_64bit_debug build_arm_64bit_debug build_testutils
  63.         sync
  64.  
  65. +# 64bit kernel only build, for Visual Studio 2022 build
  66. +# - VS2022 no longe supports building 32bit kernel modules
  67. +# - we need 32bit nfs_mount.exe for testing
  68. +# - we need 32bit nfs41_np.dll to support 32bit applications on 64bit machines
  69. +# - BUG: ARM64 build not working yet
  70. +build64: \
  71. +       build_32bit_release_clientutils \
  72. +       build_32bit_debug_clientutils \
  73. +       build_64bit_release \
  74. +       build_64bit_debug \
  75. +       build_testutils
  76. +       sync
  77. +
  78.  #
  79.  # clean target
  80.  #
  81. @@ -146,7 +155,28 @@ bintarball: installdest
  82.                         -e "s/\\$$\{bintarball.base_filename\}/$${base_filename}/g" \
  83.                         -e "s/\\$$\{bintarball.archive_sha256hash\}/$${archive_sha256hash}/g" >"$${base_filename}.readme" \
  84.         ) ; \
  85. -       printf "\n#\n# tarball is ready now\n#\n" ; \
  86. +       printf "\n#\n# 32bit+64bit tarball is ready now\n#\n" ; \
  87. +       ls -l "$(DESTDIR)/$${base_filename}.tar.bz2" ; \
  88. +       ls -l "$(DESTDIR)/$${base_filename}.readme"
  89. +       sync
  90. +
  91. +bintarball64: installdest64
  92. +       set -o errexit ; set -o xtrace ; \
  93. +       base_filename="msnfs41client_cygwin_binaries_$$(date +%Y%m%d_%Hh%Mm)_git$$(git rev-parse --short HEAD)" ; \
  94. +       ( \
  95. +       cd "$(DESTDIR)" && \
  96. +       tar -cvf - \
  97. +               --owner=SYSTEM:18 \
  98. +               --group=SYSTEM:18 \
  99. +               cygdrive/c/cygwin64 \
  100. +               | \
  101. +                       bzip2 -9 >"$${base_filename}.tar.bz2" ; \
  102. +       archive_sha256hash="$$(openssl sha256 -r "$${base_filename}.tar.bz2" | while read a dummy ; do printf "%s\n" "$$a" ; done)" ; \
  103. +               sed -E <"../cygwin/README.bintarball.txt" \
  104. +                       -e "s/\\$$\{bintarball.base_filename\}/$${base_filename}/g" \
  105. +                       -e "s/\\$$\{bintarball.archive_sha256hash\}/$${archive_sha256hash}/g" >"$${base_filename}.readme" \
  106. +       ) ; \
  107. +       printf "\n#\n# 64bit-only tarball is ready now\n#\n" ; \
  108.         ls -l "$(DESTDIR)/$${base_filename}.tar.bz2" ; \
  109.         ls -l "$(DESTDIR)/$${base_filename}.readme"
  110.         sync
  111. diff --git a/cygwin/Makefile.install b/cygwin/Makefile.install
  112. index b973635..1ec9884 100644
  113. --- a/cygwin/Makefile.install
  114. +++ b/cygwin/Makefile.install
  115. @@ -51,6 +51,13 @@ installdest:
  116.         cp $(VS_BUILD_DIR)/nfs_install.*        $(DESTDIR)/$(CYGWIN_BASEPATH)/sbin/.
  117.         cp $(VS_BUILD_DIR)/libtirpc.*   $(DESTDIR)/$(CYGWIN_BASEPATH)/sbin/.
  118.         cp $(VS_BUILD_DIR)/nfs41_np.*   $(DESTDIR)/$(CYGWIN_BASEPATH)/lib/msnfs41client/.
  119. +       if [[ "$(CYGWIN_BASEPATH)" == *64* ]] ; then \
  120. +               mkdir -p -- $(DESTDIR)/$(CYGWIN_BASEPATH)/lib/msnfs41client/i686 ; \
  121. +               cp $(VS_BUILD_DIR32)/../Release/nfs41_np.dll $(DESTDIR)/$(CYGWIN_BASEPATH)/lib/msnfs41client/i686/nfs41_np.dll ; \
  122. +               cp $(VS_BUILD_DIR32)/../Release/nfs41_np.exp $(DESTDIR)/$(CYGWIN_BASEPATH)/lib/msnfs41client/i686/nfs41_np.exp ; \
  123. +               cp $(VS_BUILD_DIR32)/../Release/nfs41_np.lib $(DESTDIR)/$(CYGWIN_BASEPATH)/lib/msnfs41client/i686/nfs41_np.lib ; \
  124. +               cp $(VS_BUILD_DIR32)/../Release/nfs41_np.pdb $(DESTDIR)/$(CYGWIN_BASEPATH)/lib/msnfs41client/i686/nfs41_np.pdb ; \
  125. +       fi
  126.         cp $(VS_BUILD_DIR)/nfs41_driver.*       $(DESTDIR)/$(CYGWIN_BASEPATH)/lib/msnfs41client/.
  127.         cp $(PROJECT_BASEDIR_DIR)/nfs41rdr.inf  $(DESTDIR)/$(CYGWIN_BASEPATH)/lib/msnfs41client/.
  128.         cp $(PROJECT_BASEDIR_DIR)/etc_netconfig $(DESTDIR)/$(CYGWIN_BASEPATH)/lib/msnfs41client/.
  129. diff --git a/cygwin/README.txt b/cygwin/README.txt
  130. index 24f3342..ffce8ad 100644
  131. --- a/cygwin/README.txt
  132. +++ b/cygwin/README.txt
  133. @@ -6,8 +6,8 @@
  134.  
  135.  ######## Building ms-nfs41-client using Cygwin+Makefile:
  136.  ** Required software:
  137. -- Visual Studio 19
  138. -  Start Visual Studio 19 installer and import the installer
  139. +* Windows 10 with Visual Studio 2019
  140. +- Start Visual Studio 19 installer and import the installer
  141.    config file "ms-nfs41-client/build.vc19/ms-nfs41-client.vsconfig",
  142.    and then install Visual Studio.
  143.    (Note that due to a bug in the VS installer it is sometimes
  144. @@ -19,15 +19,42 @@
  145.    (see "ms-nfs41-clientcygwin/README.bintarball.txt" for Cygwin 32bit
  146.    and 64bit installation instructions)
  147.  
  148. -** Build the project using VS19/VS22+Cygwin command line (bash/ksh93):
  149. +* Windows 10/11 with Visual Studio 2022
  150. +- Start Visual Studio 2022 installer and import the installer
  151. +  config file "ms-nfs41-client/build.vc19/ms-nfs41-client.vsconfig",
  152. +  and then install Visual Studio.
  153. +  (Note that due to a bug in the VS installer it is sometimes
  154. +  required to manually add another (random) component to be installed,
  155. +  otherwise the imported config might be ignored)
  156. +- WDK for Windows 11, version 1591, from
  157. +  https://go.microsoft.com/fwlink/?linkid=2286137
  158. +- Cygwin 64bit >= 3.5.0
  159. +  (see "ms-nfs41-clientcygwin/README.bintarball.txt" for Cygwin 32bit
  160. +  and 64bit installation instructions)
  161. +
  162. +
  163. +** Build the project
  164. +* using Visual Studio 2019+Cygwin command line (bash/ksh93):
  165. +# this creates a 32bit+kernel+64bit-kernel build for Windows 10+11
  166.  export PATH="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/:$PATH"
  167. -# VS22 use: $ export PATH="/cygdrive/c/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/:$PATH"
  168.  git clone https://github.com/kofemann/ms-nfs41-client.git
  169.  cd ms-nfs41-client
  170.  cd cygwin
  171. +make build
  172.  make installdest
  173. +make bintarball
  174. +
  175. +* using Visual Studio 2022+Cygwin command line (bash/ksh93):
  176. +# this creates a 64bit-kernel only build for Windows 11
  177. +export PATH="/cygdrive/c/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/:$PATH"
  178. +git clone https://github.com/kofemann/ms-nfs41-client.git
  179. +cd ms-nfs41-client
  180. +cd cygwin
  181. +make build64
  182. +make installdest64
  183. +make bintarball64
  184.  
  185. -# Note that $ make installdest # can fail on SMB/NFSv4.1 filesystems
  186. +# Note that $ make installdest #/$ make installdest64 # can fail on SMB/NFSv4.1 filesystems
  187.  # with a "link.exe" crash.
  188.  # Workaround is to disable incremental linking before building, e.g. do
  189.  # ---- snip ----
  190. diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
  191. index 739ab30..4337a02 100755
  192. --- a/cygwin/devel/msnfs41client.bash
  193. +++ b/cygwin/devel/msnfs41client.bash
  194. @@ -314,7 +314,7 @@ function nfsclient_adddriver
  195.         #
  196.         if is_windows_64bit ; then
  197.                 # copy from the 32bit install dir
  198. -               cp '../../../../../cygdrive/c/cygwin/lib/msnfs41client/nfs41_np.dll' '/cygdrive/c/Windows/SysWOW64/'
  199. +               cp './i686/nfs41_np.dll' '/cygdrive/c/Windows/SysWOW64/'
  200.         fi
  201.  
  202.         return 0
  203. --
  204. 2.45.1
  205.  
  206. From 15c0e33c6f14883c3d46176dc37da4d6912ea17b Mon Sep 17 00:00:00 2001
  207. From: Roland Mainz <roland.mainz@nrubsig.org>
  208. Date: Mon, 2 Dec 2024 14:25:50 +0100
  209. Subject: [PATCH 2/8] dll: Implement nfs41_np |NPGetConnection3()|
  210.  
  211. Implement nfs41_np |NPGetConnection3()|
  212.  
  213. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  214. ---
  215. dll/nfs41_np.c | 50 +++++++++++++++++++++++++++++++++++++++++++++-----
  216.  1 file changed, 45 insertions(+), 5 deletions(-)
  217.  
  218. diff --git a/dll/nfs41_np.c b/dll/nfs41_np.c
  219. index fb25f5c..5e81099 100644
  220. --- a/dll/nfs41_np.c
  221. +++ b/dll/nfs41_np.c
  222. @@ -1011,19 +1011,50 @@ out:
  223.  
  224.  DWORD APIENTRY
  225.  NPGetConnection(
  226. -    __in LPWSTR  lpLocalName,
  227. +    __in LPWSTR                         lpLocalName,
  228.      __out_bcount(*lpBufferSize) LPWSTR  lpRemoteName,
  229. -    __inout LPDWORD lpBufferSize )
  230. +    __inout LPDWORD                     lpBufferSize)
  231.  {
  232. -    DWORD   Status = 0;
  233. +    DWORD Status = 0;
  234. +    DbgP((L"--> NPGetConnection(lpLocalName='%s')\n",
  235. +        lpLocalName));
  236. +    Status = NPGetConnection3(lpLocalName,
  237. +        WNGETCON_CONNECTED, lpRemoteName, lpBufferSize);
  238. +    if (Status == WN_SUCCESS) {
  239. +        DbgP((L"<-- NPGetConnection(lpRemoteName='%.*s',*lpBufferSize=%d) returns %d\n",
  240. +            (int)*lpBufferSize,
  241. +            lpRemoteName,
  242. +            (int)*lpBufferSize,
  243. +            (int)Status));
  244. +    }
  245. +    else {
  246. +        DbgP((L"<-- NPGetConnection() returns %d\n", (int)Status));
  247. +    }
  248.  
  249. +    return Status;
  250. +}
  251. +
  252. +DWORD APIENTRY
  253. +NPGetConnection3(
  254. +    __in LPCWSTR                        lpLocalName,
  255. +    __in DWORD                          dwLevel,
  256. +    __out_bcount(*lpBufferSize) LPWSTR  lpRemoteName,
  257. +    __inout LPDWORD                     lpBufferSize)
  258. +{
  259. +    DWORD Status = 0;
  260.      HANDLE  hMutex, hMemory;
  261.      PNFS41NP_SHARED_MEMORY  pSharedMemory;
  262.  #ifdef NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE
  263.      LUID authenticationid = { .LowPart = 0, .HighPart = 0L };
  264.  #endif /* NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE */
  265.  
  266. -    DbgP((L"--> NPGetConnection(lpLocalName='%s')\n", lpLocalName));
  267. +    DbgP((L"--> NPGetConnection3(lpLocalName='%s',dwLevel=%d)\n",
  268. +        lpLocalName, (int)dwLevel));
  269. +
  270. +    if (dwLevel != WNGETCON_CONNECTED) {
  271. +        Status = WN_SUCCESS;
  272. +        goto out;
  273. +    }
  274.  
  275.      if (lpLocalName == NULL) {
  276.          lpLocalName = NFS41NP_LOCALNAME_UNC_MARKER;
  277. @@ -1108,7 +1139,16 @@ NPGetConnection(
  278.  
  279.      CloseSharedMemory( &hMutex, &hMemory, (PVOID)&pSharedMemory);
  280.  out:
  281. -    DbgP((L"<-- NPGetConnection returns %d\n", (int)Status));
  282. +    if (Status == WN_SUCCESS) {
  283. +        DbgP((L"<-- NPGetConnection3(lpRemoteName='%.*s',*lpBufferSize=%d) returns %d\n",
  284. +            (int)*lpBufferSize,
  285. +            lpRemoteName,
  286. +            (int)*lpBufferSize,
  287. +            (int)Status));
  288. +    }
  289. +    else {
  290. +        DbgP((L"<-- NPGetConnection3() returns %d\n", (int)Status));
  291. +    }
  292.  
  293.      return Status;
  294.  }
  295. --
  296. 2.45.1
  297.  
  298. From 5b65e678622c7af502532cf743826d851a833aa7 Mon Sep 17 00:00:00 2001
  299. From: Roland Mainz <roland.mainz@nrubsig.org>
  300. Date: Mon, 2 Dec 2024 16:08:39 +0100
  301. Subject: [PATCH 3/8] mount: Fix broken DOS device autoselction (nfs_mount '*'
  302.  ...)
  303.  
  304. Fix broken DOS device autoselction (e.g. $ nfs_mount -o rw '*' ... #)
  305.  
  306. Reported-by: Takeshi Nishimura <takeshi.nishimura.linux@gmail.com>
  307. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  308. ---
  309. mount/mount.c | 8 +++++++-
  310.  1 file changed, 7 insertions(+), 1 deletion(-)
  311.  
  312. diff --git a/mount/mount.c b/mount/mount.c
  313. index 388bfa9..cec8e35 100644
  314. --- a/mount/mount.c
  315. +++ b/mount/mount.c
  316. @@ -1053,7 +1053,13 @@ static DWORD DoMount(
  317.      NetResource.dwType = RESOURCETYPE_DISK;
  318.      if (pLocalName) {
  319.          /* drive letter is chosen automatically if lpLocalName == "*" */
  320. -        NetResource.lpLocalName = *pLocalName == L'*' ? NULL : pLocalName;
  321. +        if (*pLocalName == L'*') {
  322. +            NetResource.lpLocalName = NULL;
  323. +            Flags |= CONNECT_REDIRECT;
  324. +        }
  325. +        else {
  326. +            NetResource.lpLocalName = pLocalName;
  327. +        }
  328.      }
  329.      else {
  330.          NetResource.lpLocalName = NULL;
  331. --
  332. 2.45.1
  333.  
  334. From f24dbd34bcd56c14a1034e89ddd7767a028984f6 Mon Sep 17 00:00:00 2001
  335. From: Roland Mainz <roland.mainz@nrubsig.org>
  336. Date: Mon, 2 Dec 2024 16:31:47 +0100
  337. Subject: [PATCH 4/8] mount: Unrecognized options+arguments should be fatal
  338.  
  339. Unrecognized options+arguments should be fatal, otherwise
  340. admins can get unwanted surprises.
  341.  
  342. Reported-by: Takeshi Nishimura <takeshi.nishimura.linux@gmail.com>
  343. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  344. ---
  345. mount/mount.c | 15 ++++++++++-----
  346.  1 file changed, 10 insertions(+), 5 deletions(-)
  347.  
  348. diff --git a/mount/mount.c b/mount/mount.c
  349. index cec8e35..c9e0464 100644
  350. --- a/mount/mount.c
  351. +++ b/mount/mount.c
  352. @@ -373,10 +373,13 @@ opt_o_argv_i_again:
  353.                      goto out_free;
  354.                  }
  355.              }
  356. -            else
  357. -                (void)fwprintf(stderr, L"Unrecognized option "
  358. -                    L"'%s', disregarding.\n",
  359. +            else {
  360. +                (void)fwprintf(stderr,
  361. +                    L"Unrecognized option '%s'\n",
  362.                      argv[i]);
  363. +                result = 1;
  364. +                goto out;
  365. +            }
  366.          }
  367.          /* Windows-style "nfs_mount /?" help */
  368.          else if (!wcscmp(argv[i], L"/?")) {
  369. @@ -394,9 +397,11 @@ opt_o_argv_i_again:
  370.              pRemoteName = argv[i];
  371.          }
  372.          else {
  373. -            (void)fwprintf(stderr, L"Unrecognized argument "
  374. -                L"'%s', disregarding.\n",
  375. +            (void)fwprintf(stderr,
  376. +                L"Unrecognized argument '%s'.\n",
  377.                  argv[i]);
  378. +            result = 1;
  379. +            goto out;
  380.          }
  381.      }
  382.  
  383. --
  384. 2.45.1
  385.  
  386. From dca1c641cced6461ca3a6111aba6958f734b5f5b Mon Sep 17 00:00:00 2001
  387. From: Roland Mainz <roland.mainz@nrubsig.org>
  388. Date: Mon, 2 Dec 2024 16:35:24 +0100
  389. Subject: [PATCH 5/8] mount: Fix copy&paste&clipboard mistake added with commit
  390.  #6981ffb29ed771c0a7120d587f0342bc74400bda
  391.  
  392. Fix copy&paste&clipboard mistake added with commit
  393. paste)
  394.  
  395. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  396. ---
  397. mount/mount.c | 2 +-
  398.  1 file changed, 1 insertion(+), 1 deletion(-)
  399.  
  400. diff --git a/mount/mount.c b/mount/mount.c
  401. index c9e0464..0b5f313 100644
  402. --- a/mount/mount.c
  403. +++ b/mount/mount.c
  404. @@ -368,7 +368,7 @@ opt_o_argv_i_again:
  405.                  if (!wcscmp(argv[i], L"nfs")) {
  406.                      result = ERROR_BAD_ARGUMENTS;
  407.                      (void)fwprintf(stderr, L"Filesystem type '%s' "
  408. -                        L"not supported.\n\n./build.vc19/x64/Debug/nfs_mount.exe", argv[i]);
  409. +                        L"not supported.\n\n.", argv[i]);
  410.                      PrintMountUsage(argv[0]);
  411.                      goto out_free;
  412.                  }
  413. --
  414. 2.45.1
  415.  
  416. From df1880f412ccc0297c2d9e3990c0727bf6223fdc Mon Sep 17 00:00:00 2001
  417. From: Dan Shelton <dan.f.shelton@gmail.com>
  418. Date: Mon, 2 Dec 2024 17:00:50 +0100
  419. Subject: [PATCH 6/8] daemon,sys: Fix printf fmt '%*s' to '%.*s'
  420.  
  421. Fix printf fmt '%*s' to '%.*s', otherwise - depending on
  422. printf implementation - we can get space padding characters.
  423.  
  424. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  425. ---
  426. daemon/acl.c         | 4 ++--
  427.  daemon/setattr.c     | 4 ++--
  428.  sys/nfs41sys_mount.c | 2 +-
  429.  3 files changed, 5 insertions(+), 5 deletions(-)
  430.  
  431. diff --git a/daemon/acl.c b/daemon/acl.c
  432. index 27e04f2..159ad1f 100644
  433. --- a/daemon/acl.c
  434. +++ b/daemon/acl.c
  435. @@ -1114,13 +1114,13 @@ add_domain:
  436.          (!strncmp(who_out, "Administrators@", who_size+1))) {
  437.          domain = "BUILTIN";
  438.          DPRINTF(1,
  439. -            ("map_sid2nfs4ace_who: Fixup '%*s' domain='%s'\n",
  440. +            ("map_sid2nfs4ace_who: Fixup '%.*s' domain='%s'\n",
  441.              (int)who_size+1, who_out, domain));
  442.      }
  443.      else if (!strncmp(who_out, "SYSTEM@", who_size+1)) {
  444.          domain = "NT AUTHORITY";
  445.          DPRINTF(1,
  446. -            ("map_sid2nfs4ace_who: Fixup '%*s' domain='%s'\n",
  447. +            ("map_sid2nfs4ace_who: Fixup '%.*s' domain='%s'\n",
  448.              (int)who_size+1, who_out, domain));
  449.      }
  450.  #endif /* NFS41_DRIVER_WS2022_HACKS */
  451. diff --git a/daemon/setattr.c b/daemon/setattr.c
  452. index 84efb70..79709da 100644
  453. --- a/daemon/setattr.c
  454. +++ b/daemon/setattr.c
  455. @@ -352,7 +352,7 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
  456.      if (dst_path.len == 0) {
  457.          eprintf("handle_nfs41_rename(args->path='%s'): "
  458.              "WideCharToMultiByte() failed to convert destination "
  459. -            "filename '%*S', lasterr=%d.\n",
  460. +            "filename '%.*S', lasterr=%d.\n",
  461.              args->path,
  462.              (int)(rename->FileNameLength/sizeof(WCHAR)),
  463.              rename->FileName,
  464. @@ -511,7 +511,7 @@ static int handle_nfs41_link(void *daemon_context, setattr_upcall_args *args)
  465.      if (dst_path.len == 0) {
  466.          eprintf("handle_nfs41_link(args->path='%s'): "
  467.              "WideCharToMultiByte() failed to convert destination "
  468. -            "filename '%*S', lasterr=%d.\n",
  469. +            "filename '%.*S', lasterr=%d.\n",
  470.              args->path,
  471.              (int)(link->FileNameLength/sizeof(WCHAR)),
  472.              link->FileName, (int)GetLastError());
  473. diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
  474. index 37b7f0c..8cc45f4 100644
  475. --- a/sys/nfs41sys_mount.c
  476. +++ b/sys/nfs41sys_mount.c
  477. @@ -427,7 +427,7 @@ NTSTATUS nfs41_MountConfig_ParseOptions(
  478.          Name = (LPWSTR)Option->EaName;
  479.          NameLen = Option->EaNameLength/sizeof(WCHAR);
  480.  
  481. -        DbgP("nfs41_MountConfig_ParseOptions: Name='%*S'/NameLen=%d\n",
  482. +        DbgP("nfs41_MountConfig_ParseOptions: Name='%.*S'/NameLen=%d\n",
  483.              (int)NameLen, Name, (int)NameLen);
  484.  
  485.          usValue.Length = usValue.MaximumLength = Option->EaValueLength;
  486. --
  487. 2.45.1
  488.  
  489. From b80472c735c24c185c1a95c52c132dfe4c07b6c4 Mon Sep 17 00:00:00 2001
  490. From: Roland Mainz <roland.mainz@nrubsig.org>
  491. Date: Mon, 2 Dec 2024 17:13:05 +0100
  492. Subject: [PATCH 7/8] cygwin: Fix s/driver letter/drive letter/
  493.  
  494. Fix s/driver letter/drive letter/
  495.  
  496. Reported-by: Takeshi Nishimura <takeshi.nishimura.linux@gmail.com>
  497. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  498. ---
  499. cygwin/README.bintarball.txt | 10 +++++-----
  500.  1 file changed, 5 insertions(+), 5 deletions(-)
  501.  
  502. diff --git a/cygwin/README.bintarball.txt b/cygwin/README.bintarball.txt
  503. index f335787..0afaecc 100644
  504. --- a/cygwin/README.bintarball.txt
  505. +++ b/cygwin/README.bintarball.txt
  506. @@ -43,14 +43,14 @@ NFSv4.1 filesystem driver for Windows 10/11&Windows Server 2019
  507.        characters in the mount path, independent of current locale.
  508.  
  509.  - UNC paths
  510. -    - Mounting UNC paths without DOS driver letterpacman -S --noconfirm
  511. +    - Mounting UNC paths without DOS drive letter
  512.      - IPv6 support in UNC paths
  513.      - /sbin/nfs_mount prints UNC paths in Win32+Cygwin/MSYS2 formats
  514.      - Cygwin/MSYS2 bash+ksh93 support UNC paths, e.g.
  515.        cd //derfwnb4966@2049/nfs4/bigdisk/mysqldb4/
  516.  
  517.  - WSL support
  518. -    - Mount Windows NFSv4.1 shares via driver letter or UNC path
  519. +    - Mount Windows NFSv4.1 shares via drive letter or UNC path
  520.        in WSL via mount -t drvfs
  521.      - Supports NFS owner/group to WSL uid/gid mapping
  522.  
  523. @@ -369,14 +369,14 @@ does not wait until nfsd*.exe is available for accepting mounts.
  524.  
  525.  
  526.  # WSL usage:
  527. -Example 1: Mount Windows NFSv4.1 share via Windows driver letter
  528. -# Mount NFSv4.1 share in Windows to driver letter 'N':
  529. +Example 1: Mount Windows NFSv4.1 share via Windows drive letter
  530. +# Mount NFSv4.1 share in Windows to drive letter 'N':
  531.  ---- snip ----
  532.  $ /sbin/nfs_mount -o rw 'N' nfs://10.49.202.230//bigdisk
  533.  Successfully mounted '10.49.202.230@2049' to drive 'N:'
  534.  ---- snip ----
  535.  
  536. -# Within WSL mount driver letter 'N' to /mnt/n
  537. +# Within WSL mount drive letter 'N' to /mnt/n
  538.  ---- snip ----
  539.  $ sudo bash
  540.  $ mkdir /mnt/n
  541. --
  542. 2.45.1
  543.  
  544. From 00c3c7f4206cff1efd3bbd13c1ca3c7de851fa6b Mon Sep 17 00:00:00 2001
  545. From: Roland Mainz <roland.mainz@nrubsig.org>
  546. Date: Mon, 2 Dec 2024 18:42:58 +0100
  547. Subject: [PATCH 8/8] build.vc19,daemon,mount: Use
  548.  |_CRT_STDIO_ISO_WIDE_SPECIFIERS| for portability
  549.  
  550. Use |_CRT_STDIO_ISO_WIDE_SPECIFIERS| for portability so we can
  551. use wide-char streams in libtirpc, url parser etc. in the future
  552. without issues with non-portable string format specifers (i.e.
  553. UCRT |fwprintf()| uses "%s" for wide-strings by default
  554. (without |_CRT_STDIO_ISO_WIDE_SPECIFIERS|) while ISO C99 uses
  555. "%S"/"%ls".
  556.  
  557. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  558. ---
  559. build.vc19/libtirpc/libtirpc.vcxproj       | 12 ++--
  560.  build.vc19/nfs41_np/nfs41_np.vcxproj       | 12 ++--
  561.  build.vc19/nfs_install/nfs_install.vcxproj | 12 ++--
  562.  build.vc19/nfs_mount/nfs_mount.vcxproj     | 12 ++--
  563.  build.vc19/nfsd/nfsd.vcxproj               | 12 ++--
  564.  daemon/service.c                           | 35 ++++++-----
  565.  mount/enum.c                               | 16 +++--
  566.  mount/mount.c                              | 72 ++++++++++++----------
  567.  mount/options.c                            | 12 ++--
  568.  mount/urlparser1.c                         |  6 ++
  569.  10 files changed, 114 insertions(+), 87 deletions(-)
  570.  
  571. diff --git a/build.vc19/libtirpc/libtirpc.vcxproj b/build.vc19/libtirpc/libtirpc.vcxproj
  572. index a231975..c2b6670 100644
  573. --- a/build.vc19/libtirpc/libtirpc.vcxproj
  574. +++ b/build.vc19/libtirpc/libtirpc.vcxproj
  575. @@ -120,7 +120,7 @@
  576.        </PrecompiledHeader>
  577.        <WarningLevel>Level4</WarningLevel>
  578.        <Optimization>Disabled</Optimization>
  579. -      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  580. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  581.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  582.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  583.        <StringPooling>true</StringPooling>
  584. @@ -143,7 +143,7 @@
  585.        </PrecompiledHeader>
  586.        <WarningLevel>Level4</WarningLevel>
  587.        <Optimization>Disabled</Optimization>
  588. -      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  589. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  590.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  591.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  592.        <StringPooling>true</StringPooling>
  593. @@ -166,7 +166,7 @@
  594.        </PrecompiledHeader>
  595.        <WarningLevel>Level4</WarningLevel>
  596.        <Optimization>Disabled</Optimization>
  597. -      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  598. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  599.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  600.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  601.        <StringPooling>true</StringPooling>
  602. @@ -191,7 +191,7 @@
  603.        <Optimization>MaxSpeed</Optimization>
  604.        <FunctionLevelLinking>true</FunctionLevelLinking>
  605.        <IntrinsicFunctions>true</IntrinsicFunctions>
  606. -      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  607. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  608.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  609.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  610.        <StringPooling>true</StringPooling>
  611. @@ -216,7 +216,7 @@
  612.        <Optimization>MaxSpeed</Optimization>
  613.        <FunctionLevelLinking>true</FunctionLevelLinking>
  614.        <IntrinsicFunctions>true</IntrinsicFunctions>
  615. -      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  616. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  617.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  618.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  619.        <StringPooling>true</StringPooling>
  620. @@ -241,7 +241,7 @@
  621.        <Optimization>MaxSpeed</Optimization>
  622.        <FunctionLevelLinking>true</FunctionLevelLinking>
  623.        <IntrinsicFunctions>true</IntrinsicFunctions>
  624. -      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  625. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  626.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  627.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  628.        <StringPooling>true</StringPooling>
  629. diff --git a/build.vc19/nfs41_np/nfs41_np.vcxproj b/build.vc19/nfs41_np/nfs41_np.vcxproj
  630. index 867d7d4..3b7e8e9 100644
  631. --- a/build.vc19/nfs41_np/nfs41_np.vcxproj
  632. +++ b/build.vc19/nfs41_np/nfs41_np.vcxproj
  633. @@ -120,7 +120,7 @@
  634.        </PrecompiledHeader>
  635.        <WarningLevel>Level4</WarningLevel>
  636.        <Optimization>Disabled</Optimization>
  637. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  638. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  639.        <AdditionalIncludeDirectories>..\..\sys;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  640.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  641.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  642. @@ -139,7 +139,7 @@
  643.        </PrecompiledHeader>
  644.        <WarningLevel>Level4</WarningLevel>
  645.        <Optimization>Disabled</Optimization>
  646. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  647. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  648.        <AdditionalIncludeDirectories>..\..\sys;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  649.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  650.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  651. @@ -158,7 +158,7 @@
  652.        </PrecompiledHeader>
  653.        <WarningLevel>Level4</WarningLevel>
  654.        <Optimization>Disabled</Optimization>
  655. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  656. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  657.        <AdditionalIncludeDirectories>..\..\sys;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  658.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  659.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  660. @@ -179,7 +179,7 @@
  661.        <Optimization>MaxSpeed</Optimization>
  662.        <FunctionLevelLinking>true</FunctionLevelLinking>
  663.        <IntrinsicFunctions>true</IntrinsicFunctions>
  664. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  665. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  666.        <AdditionalIncludeDirectories>..\..\sys;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  667.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  668.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  669. @@ -201,7 +201,7 @@
  670.        <Optimization>MaxSpeed</Optimization>
  671.        <FunctionLevelLinking>true</FunctionLevelLinking>
  672.        <IntrinsicFunctions>true</IntrinsicFunctions>
  673. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  674. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  675.        <AdditionalIncludeDirectories>..\..\sys;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  676.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  677.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  678. @@ -223,7 +223,7 @@
  679.        <Optimization>MaxSpeed</Optimization>
  680.        <FunctionLevelLinking>true</FunctionLevelLinking>
  681.        <IntrinsicFunctions>true</IntrinsicFunctions>
  682. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  683. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  684.        <AdditionalIncludeDirectories>..\..\sys;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  685.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  686.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  687. diff --git a/build.vc19/nfs_install/nfs_install.vcxproj b/build.vc19/nfs_install/nfs_install.vcxproj
  688. index 0650cfe..85eac67 100644
  689. --- a/build.vc19/nfs_install/nfs_install.vcxproj
  690. +++ b/build.vc19/nfs_install/nfs_install.vcxproj
  691. @@ -120,7 +120,7 @@
  692.        </PrecompiledHeader>
  693.        <WarningLevel>Level4</WarningLevel>
  694.        <Optimization>Disabled</Optimization>
  695. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  696. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  697.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  698.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  699.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  700. @@ -137,7 +137,7 @@
  701.        </PrecompiledHeader>
  702.        <WarningLevel>Level4</WarningLevel>
  703.        <Optimization>Disabled</Optimization>
  704. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  705. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  706.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  707.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  708.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  709. @@ -154,7 +154,7 @@
  710.        </PrecompiledHeader>
  711.        <WarningLevel>Level4</WarningLevel>
  712.        <Optimization>Disabled</Optimization>
  713. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  714. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  715.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  716.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  717.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  718. @@ -173,7 +173,7 @@
  719.        <Optimization>MaxSpeed</Optimization>
  720.        <FunctionLevelLinking>true</FunctionLevelLinking>
  721.        <IntrinsicFunctions>true</IntrinsicFunctions>
  722. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  723. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  724.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  725.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  726.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  727. @@ -193,7 +193,7 @@
  728.        <Optimization>MaxSpeed</Optimization>
  729.        <FunctionLevelLinking>true</FunctionLevelLinking>
  730.        <IntrinsicFunctions>true</IntrinsicFunctions>
  731. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  732. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  733.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  734.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  735.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  736. @@ -213,7 +213,7 @@
  737.        <Optimization>MaxSpeed</Optimization>
  738.        <FunctionLevelLinking>true</FunctionLevelLinking>
  739.        <IntrinsicFunctions>true</IntrinsicFunctions>
  740. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  741. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  742.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  743.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  744.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  745. diff --git a/build.vc19/nfs_mount/nfs_mount.vcxproj b/build.vc19/nfs_mount/nfs_mount.vcxproj
  746. index b94bfb2..b17cc2a 100644
  747. --- a/build.vc19/nfs_mount/nfs_mount.vcxproj
  748. +++ b/build.vc19/nfs_mount/nfs_mount.vcxproj
  749. @@ -120,7 +120,7 @@
  750.        </PrecompiledHeader>
  751.        <WarningLevel>Level4</WarningLevel>
  752.        <Optimization>Disabled</Optimization>
  753. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  754. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  755.        <AdditionalIncludeDirectories>..\..\sys;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  756.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  757.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  758. @@ -138,7 +138,7 @@
  759.        </PrecompiledHeader>
  760.        <WarningLevel>Level4</WarningLevel>
  761.        <Optimization>Disabled</Optimization>
  762. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  763. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  764.        <AdditionalIncludeDirectories>..\..\sys;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  765.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  766.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  767. @@ -156,7 +156,7 @@
  768.        </PrecompiledHeader>
  769.        <WarningLevel>Level4</WarningLevel>
  770.        <Optimization>Disabled</Optimization>
  771. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  772. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  773.        <AdditionalIncludeDirectories>..\..\sys;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  774.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  775.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  776. @@ -176,7 +176,7 @@
  777.        <Optimization>MaxSpeed</Optimization>
  778.        <FunctionLevelLinking>true</FunctionLevelLinking>
  779.        <IntrinsicFunctions>true</IntrinsicFunctions>
  780. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  781. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  782.        <AdditionalIncludeDirectories>..\..\sys;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  783.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  784.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  785. @@ -197,7 +197,7 @@
  786.        <Optimization>MaxSpeed</Optimization>
  787.        <FunctionLevelLinking>true</FunctionLevelLinking>
  788.        <IntrinsicFunctions>true</IntrinsicFunctions>
  789. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  790. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  791.        <AdditionalIncludeDirectories>..\..\sys;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  792.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  793.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  794. @@ -218,7 +218,7 @@
  795.        <Optimization>MaxSpeed</Optimization>
  796.        <FunctionLevelLinking>true</FunctionLevelLinking>
  797.        <IntrinsicFunctions>true</IntrinsicFunctions>
  798. -      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  799. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  800.        <AdditionalIncludeDirectories>..\..\sys;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  801.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  802.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  803. diff --git a/build.vc19/nfsd/nfsd.vcxproj b/build.vc19/nfsd/nfsd.vcxproj
  804. index ad5db46..65bba64 100644
  805. --- a/build.vc19/nfsd/nfsd.vcxproj
  806. +++ b/build.vc19/nfsd/nfsd.vcxproj
  807. @@ -120,7 +120,7 @@
  808.        </PrecompiledHeader>
  809.        <WarningLevel>Level4</WarningLevel>
  810.        <Optimization>Disabled</Optimization>
  811. -      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;STANDALONE_NFSD;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  812. +      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;STANDALONE_NFSD;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  813.        <AdditionalIncludeDirectories>..\..\include;..\..\libtirpc\tirpc;..\..\sys;..\..\dll;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  814.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  815.        <BasicRuntimeChecks>Default</BasicRuntimeChecks>
  816. @@ -142,7 +142,7 @@
  817.        </PrecompiledHeader>
  818.        <WarningLevel>Level4</WarningLevel>
  819.        <Optimization>Disabled</Optimization>
  820. -      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;STANDALONE_NFSD;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  821. +      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;STANDALONE_NFSD;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  822.        <AdditionalIncludeDirectories>..\..\include;..\..\libtirpc\tirpc;..\..\sys;..\..\dll;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  823.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  824.        <BasicRuntimeChecks>Default</BasicRuntimeChecks>
  825. @@ -164,7 +164,7 @@
  826.        </PrecompiledHeader>
  827.        <WarningLevel>Level4</WarningLevel>
  828.        <Optimization>Disabled</Optimization>
  829. -      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;STANDALONE_NFSD;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  830. +      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;STANDALONE_NFSD;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  831.        <AdditionalIncludeDirectories>..\..\include;..\..\libtirpc\tirpc;..\..\sys;..\..\dll;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  832.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  833.        <BasicRuntimeChecks>Default</BasicRuntimeChecks>
  834. @@ -188,7 +188,7 @@
  835.        <Optimization>MaxSpeed</Optimization>
  836.        <FunctionLevelLinking>true</FunctionLevelLinking>
  837.        <IntrinsicFunctions>true</IntrinsicFunctions>
  838. -      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  839. +      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  840.        <AdditionalIncludeDirectories>..\..\include;..\..\libtirpc\tirpc;..\..\sys;..\..\dll;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  841.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  842.        <BufferSecurityCheck>false</BufferSecurityCheck>
  843. @@ -212,7 +212,7 @@
  844.        <Optimization>MaxSpeed</Optimization>
  845.        <FunctionLevelLinking>true</FunctionLevelLinking>
  846.        <IntrinsicFunctions>true</IntrinsicFunctions>
  847. -      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  848. +      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  849.        <AdditionalIncludeDirectories>..\..\include;..\..\libtirpc\tirpc;..\..\sys;..\..\dll;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  850.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  851.        <BufferSecurityCheck>false</BufferSecurityCheck>
  852. @@ -236,7 +236,7 @@
  853.        <Optimization>MaxSpeed</Optimization>
  854.        <FunctionLevelLinking>true</FunctionLevelLinking>
  855.        <IntrinsicFunctions>true</IntrinsicFunctions>
  856. -      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  857. +      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  858.        <AdditionalIncludeDirectories>..\..\include;..\..\libtirpc\tirpc;..\..\sys;..\..\dll;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  859.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  860.        <BufferSecurityCheck>false</BufferSecurityCheck>
  861. diff --git a/daemon/service.c b/daemon/service.c
  862. index d30d43c..bbf34b4 100644
  863. --- a/daemon/service.c
  864. +++ b/daemon/service.c
  865. @@ -21,6 +21,11 @@ FUNCTIONS:
  866.    GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize );
  867.  
  868.    ---------------------------------------------------------------------------*/
  869. +
  870. +#ifndef _CRT_STDIO_ISO_WIDE_SPECIFIERS
  871. +#error Code requires ISO wide-char behaviour
  872. +#endif /* !_CRT_STDIO_ISO_WIDE_SPECIFIERS */
  873. +
  874.  #include <windows.h>
  875.  #ifndef STANDALONE_NFSD
  876.  #include <stdio.h>
  877. @@ -303,7 +308,7 @@ VOID AddToMessageLog(LPTSTR lpszMsg)
  878.        //
  879.        hEventSource = RegisterEventSource(NULL, TEXT(SZSERVICENAME));
  880.  
  881. -      _stprintf_s(szMsg,(sizeof(SZSERVICENAME) / sizeof(TCHAR)) + 100, TEXT("%s error: %d"), TEXT(SZSERVICENAME), dwErr);
  882. +      _stprintf_s(szMsg,(sizeof(SZSERVICENAME) / sizeof(TCHAR)) + 100, TEXT("%ls error: %d"), TEXT(SZSERVICENAME), dwErr);
  883.        lpszStrings[0] = szMsg;
  884.        lpszStrings[1] = lpszMsg;
  885.  
  886. @@ -355,7 +360,7 @@ void CmdInstallService()
  887.  
  888.     if ( GetModuleFileName( NULL, szPath, 512 ) == 0 )
  889.     {
  890. -      _tprintf(TEXT("Unable to install %s - %s\n"), TEXT(SZSERVICEDISPLAYNAME), GetLastErrorText(szErr, 256));
  891. +      _tprintf(TEXT("Unable to install %ls - %ls\n"), TEXT(SZSERVICEDISPLAYNAME), GetLastErrorText(szErr, 256));
  892.        return;
  893.     }
  894.  
  895. @@ -383,18 +388,18 @@ void CmdInstallService()
  896.  
  897.        if ( schService )
  898.        {
  899. -         _tprintf(TEXT("%s installed.\n"), TEXT(SZSERVICEDISPLAYNAME) );
  900. +         _tprintf(TEXT("%ls installed.\n"), TEXT(SZSERVICEDISPLAYNAME) );
  901.           CloseServiceHandle(schService);
  902.        }
  903.        else
  904.        {
  905. -         _tprintf(TEXT("CreateService failed - %s\n"), GetLastErrorText(szErr, 256));
  906. +         _tprintf(TEXT("CreateService failed - %ls\n"), GetLastErrorText(szErr, 256));
  907.        }
  908.  
  909.        CloseServiceHandle(schSCManager);
  910.     }
  911.     else
  912. -      _tprintf(TEXT("OpenSCManager failed - %s\n"), GetLastErrorText(szErr,256));
  913. +      _tprintf(TEXT("OpenSCManager failed - %ls\n"), GetLastErrorText(szErr,256));
  914.  }
  915.  
  916.  
  917. @@ -431,7 +436,7 @@ void CmdRemoveService()
  918.           // try to stop the service
  919.           if ( ControlService( schService, SERVICE_CONTROL_STOP, &ssStatus ) )
  920.           {
  921. -            _tprintf(TEXT("Stopping %s."), TEXT(SZSERVICEDISPLAYNAME));
  922. +            _tprintf(TEXT("Stopping %ls."), TEXT(SZSERVICEDISPLAYNAME));
  923.              Sleep( 1000 );
  924.  
  925.              while ( QueryServiceStatus( schService, &ssStatus ) )
  926. @@ -446,28 +451,28 @@ void CmdRemoveService()
  927.              }
  928.  
  929.              if ( ssStatus.dwCurrentState == SERVICE_STOPPED )
  930. -               _tprintf(TEXT("\n%s stopped.\n"), TEXT(SZSERVICEDISPLAYNAME) );
  931. +               _tprintf(TEXT("\n%ls stopped.\n"), TEXT(SZSERVICEDISPLAYNAME) );
  932.              else
  933. -               _tprintf(TEXT("\n%s failed to stop.\n"), TEXT(SZSERVICEDISPLAYNAME) );
  934. +               _tprintf(TEXT("\n%ls failed to stop.\n"), TEXT(SZSERVICEDISPLAYNAME) );
  935.  
  936.           }
  937.  
  938.           // now remove the service
  939.           if ( DeleteService(schService) )
  940. -            _tprintf(TEXT("%s removed.\n"), TEXT(SZSERVICEDISPLAYNAME) );
  941. +            _tprintf(TEXT("%ls removed.\n"), TEXT(SZSERVICEDISPLAYNAME) );
  942.           else
  943. -            _tprintf(TEXT("DeleteService failed - %s\n"), GetLastErrorText(szErr,256));
  944. +            _tprintf(TEXT("DeleteService failed - %ls\n"), GetLastErrorText(szErr,256));
  945.  
  946.  
  947.           CloseServiceHandle(schService);
  948.        }
  949.        else
  950. -         _tprintf(TEXT("OpenService failed - %s\n"), GetLastErrorText(szErr,256));
  951. +         _tprintf(TEXT("OpenService failed - %ls\n"), GetLastErrorText(szErr,256));
  952.  
  953.        CloseServiceHandle(schSCManager);
  954.     }
  955.     else
  956. -      _tprintf(TEXT("OpenSCManager failed - %s\n"), GetLastErrorText(szErr,256));
  957. +      _tprintf(TEXT("OpenSCManager failed - %ls\n"), GetLastErrorText(szErr,256));
  958.  }
  959.  
  960.  
  961. @@ -511,7 +516,7 @@ void CmdDebugService(int argc, char ** argv)
  962.     lpszArgv = argv;
  963.  #endif
  964.  
  965. -   _tprintf(TEXT("Debugging %s.\n"), TEXT(SZSERVICEDISPLAYNAME));
  966. +   _tprintf(TEXT("Debugging %ls.\n"), TEXT(SZSERVICEDISPLAYNAME));
  967.  
  968.     SetConsoleCtrlHandler( ControlHandler, TRUE );
  969.  
  970. @@ -546,7 +551,7 @@ BOOL WINAPI ControlHandler ( DWORD dwCtrlType )
  971.     {
  972.     case CTRL_BREAK_EVENT:  // use Ctrl+C or Ctrl+Break to simulate
  973.     case CTRL_C_EVENT:      // SERVICE_CONTROL_STOP in debug mode
  974. -      _tprintf(TEXT("Stopping %s.\n"), TEXT(SZSERVICEDISPLAYNAME));
  975. +      _tprintf(TEXT("Stopping %ls.\n"), TEXT(SZSERVICEDISPLAYNAME));
  976.        ServiceStop();
  977.        return TRUE;
  978.        break;
  979. @@ -590,7 +595,7 @@ LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize )
  980.         if (NULL != lpszTemp)
  981.         {
  982.             lpszTemp[lstrlen(lpszTemp)-2] = TEXT('\0');  //remove cr and newline character
  983. -           _stprintf_s( lpszBuf, dwSize, TEXT("%s (0x%x)"), lpszTemp, GetLastError() );
  984. +           _stprintf_s( lpszBuf, dwSize, TEXT("%ls (0x%x)"), lpszTemp, GetLastError() );
  985.         }
  986.     }
  987.  
  988. diff --git a/mount/enum.c b/mount/enum.c
  989. index ab436d3..669023c 100644
  990. --- a/mount/enum.c
  991. +++ b/mount/enum.c
  992. @@ -20,6 +20,14 @@
  993.   * Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  994.   */
  995.  
  996. +#if ((__STDC_VERSION__-0) < 201710L)
  997. +#error Code requires ISO C17
  998. +#endif
  999. +
  1000. +#ifndef _CRT_STDIO_ISO_WIDE_SPECIFIERS
  1001. +#error Code requires ISO wide-char behaviour
  1002. +#endif /* !_CRT_STDIO_ISO_WIDE_SPECIFIERS */
  1003. +
  1004.  #include <Windows.h>
  1005.  #include <stdbool.h>
  1006.  #include <stdio.h>
  1007. @@ -203,7 +211,7 @@ void PrintMountLine(
  1008.  #pragma warning( pop )
  1009.      }
  1010.  
  1011. -    (void)wprintf(L"%-8s\t%-50s\t%-50s\t%-50S\n",
  1012. +    (void)wprintf(L"%-8ls\t%-50ls\t%-50ls\t%-50s\n",
  1013.          local, remote, cygwin_unc_buffer, cygwin_nfsurl_buffer);
  1014.  
  1015.      free(utf8unc);
  1016. @@ -238,9 +246,9 @@ DWORD EnumMounts(
  1017.      if (result)
  1018.          goto out_free;
  1019.  
  1020. -    (void)wprintf(L"Listing '%s' mounts:\n\n",
  1021. +    (void)wprintf(L"Listing '%ls' mounts:\n\n",
  1022.          NFS41_PROVIDER_NAME_U);
  1023. -    (void)wprintf(L"%-8s\t%-50s\t%-50s\t%-50s\n",
  1024. +    (void)wprintf(L"%-8ls\t%-50ls\t%-50ls\t%-50ls\n",
  1025.          L"Volume", L"Remote path", L"Cygwin UNC path", L"URL");
  1026.  
  1027.      do
  1028. @@ -269,7 +277,7 @@ DWORD EnumMounts(
  1029.  
  1030.      result = WNetCloseEnum(hEnum);
  1031.  
  1032. -    (void)wprintf(L"\nFound %d share%s.\n", dwTotal,
  1033. +    (void)wprintf(L"\nFound %d share%ls.\n", dwTotal,
  1034.          (dwTotal == 1) ? L"" : L"s");
  1035.  
  1036.  out_free:
  1037. diff --git a/mount/mount.c b/mount/mount.c
  1038. index 0b5f313..5b872a2 100644
  1039. --- a/mount/mount.c
  1040. +++ b/mount/mount.c
  1041. @@ -24,6 +24,10 @@
  1042.  #error Code requires ISO C17
  1043.  #endif
  1044.  
  1045. +#ifndef _CRT_STDIO_ISO_WIDE_SPECIFIERS
  1046. +#error Code requires ISO wide-char behaviour
  1047. +#endif /* !_CRT_STDIO_ISO_WIDE_SPECIFIERS */
  1048. +
  1049.  #include <crtdbg.h>
  1050.  #include <Windows.h>
  1051.  #include <strsafe.h>
  1052. @@ -80,10 +84,10 @@ static
  1053.  void PrintMountUsage(LPWSTR pProcess)
  1054.  {
  1055.      (void)fwprintf(stderr,
  1056. -        L"Usage: %s [options] <drive letter|*> <hostname>:<path>\n"
  1057. -        "Usage: %s [options] <hostname>:<path>\n"
  1058. -        "Usage: %s -d [options] <drive letter>\n"
  1059. -        "Usage: %s\n"
  1060. +        L"Usage: %ls [options] <drive letter|*> <hostname>:<path>\n"
  1061. +        "Usage: %ls [options] <hostname>:<path>\n"
  1062. +        "Usage: %ls -d [options] <drive letter>\n"
  1063. +        "Usage: %ls\n"
  1064.  
  1065.          "* Options:\n"
  1066.          "\t-h, --help, /?\thelp\n"
  1067. @@ -174,7 +178,7 @@ static
  1068.  void PrintUmountUsage(LPWSTR pProcess)
  1069.  {
  1070.      (void)fwprintf(stderr,
  1071. -        L"Usage: %s [options] <drive letter>\n"
  1072. +        L"Usage: %ls [options] <drive letter>\n"
  1073.  
  1074.          "* Options:\n"
  1075.          "\t-h, --help, /?\thelp\n"
  1076. @@ -367,7 +371,7 @@ opt_o_argv_i_again:
  1077.  
  1078.                  if (!wcscmp(argv[i], L"nfs")) {
  1079.                      result = ERROR_BAD_ARGUMENTS;
  1080. -                    (void)fwprintf(stderr, L"Filesystem type '%s' "
  1081. +                    (void)fwprintf(stderr, L"Filesystem type '%ls' "
  1082.                          L"not supported.\n\n.", argv[i]);
  1083.                      PrintMountUsage(argv[0]);
  1084.                      goto out_free;
  1085. @@ -375,7 +379,7 @@ opt_o_argv_i_again:
  1086.              }
  1087.              else {
  1088.                  (void)fwprintf(stderr,
  1089. -                    L"Unrecognized option '%s'\n",
  1090. +                    L"Unrecognized option '%ls'\n",
  1091.                      argv[i]);
  1092.                  result = 1;
  1093.                  goto out;
  1094. @@ -398,7 +402,7 @@ opt_o_argv_i_again:
  1095.          }
  1096.          else {
  1097.              (void)fwprintf(stderr,
  1098. -                L"Unrecognized argument '%s'.\n",
  1099. +                L"Unrecognized argument '%ls'.\n",
  1100.                  argv[i]);
  1101.              result = 1;
  1102.              goto out;
  1103. @@ -409,7 +413,7 @@ opt_o_argv_i_again:
  1104.      if (pLocalName) {
  1105.          if (!ParseDriveLetter(pLocalName, szLocalName)) {
  1106.              result = ERROR_BAD_ARGUMENTS;
  1107. -            (void)fwprintf(stderr, L"Invalid drive letter '%s'. "
  1108. +            (void)fwprintf(stderr, L"Invalid drive letter '%ls'. "
  1109.                  L"Expected 'C' or 'C:'.\n\n",
  1110.                  pLocalName);
  1111.              PrintMountUsage(argv[0]);
  1112. @@ -503,7 +507,7 @@ int umount_main(int argc, wchar_t *argv[])
  1113.              }
  1114.              else {
  1115.                  (void)fwprintf(stderr, L"Unrecognized option "
  1116. -                    L"'%s', disregarding.\n",
  1117. +                    L"'%ls', disregarding.\n",
  1118.                      argv[i]);
  1119.                  result = ERROR_BAD_ARGUMENTS;
  1120.              }
  1121. @@ -520,7 +524,7 @@ int umount_main(int argc, wchar_t *argv[])
  1122.          }
  1123.          else {
  1124.              (void)fwprintf(stderr, L"Unrecognized argument "
  1125. -                L"'%s', disregarding.\n",
  1126. +                L"'%ls', disregarding.\n",
  1127.                  argv[i]);
  1128.          }
  1129.      }
  1130. @@ -534,7 +538,7 @@ int umount_main(int argc, wchar_t *argv[])
  1131.  
  1132.      if (!ParseDriveLetter(pLocalName, szLocalName)) {
  1133.          result = ERROR_BAD_ARGUMENTS;
  1134. -        (void)fwprintf(stderr, L"Invalid drive letter '%s'. "
  1135. +        (void)fwprintf(stderr, L"Invalid drive letter '%ls'. "
  1136.              L"Expected 'C' or 'C:'.\n\n",
  1137.              pLocalName);
  1138.          PrintUmountUsage(argv[0]);
  1139. @@ -604,7 +608,7 @@ int __cdecl wmain(int argc, wchar_t *argv[])
  1140.          goto out;
  1141.      }
  1142.      else {
  1143. -        (void)fwprintf(stderr, L"%s: Unknown mode\n", argv[0]);
  1144. +        (void)fwprintf(stderr, L"%ls: Unknown mode\n", argv[0]);
  1145.          result = 1;
  1146.          goto out;
  1147.      }
  1148. @@ -738,7 +742,7 @@ static DWORD ParseRemoteName(
  1149.  
  1150.          if (url_parser_parse(uctx) < 0) {
  1151.              result = ERROR_BAD_ARGUMENTS;
  1152. -            (void)fwprintf(stderr, L"Error parsing nfs://-URL '%S'.\n", premotename_utf8);
  1153. +            (void)fwprintf(stderr, L"Error parsing nfs://-URL '%s'.\n", premotename_utf8);
  1154.              goto out;
  1155.          }
  1156.  
  1157. @@ -774,7 +778,7 @@ static DWORD ParseRemoteName(
  1158.                          result = ERROR_BAD_ARGUMENTS;
  1159.                          (void)fwprintf(stderr,
  1160.                              L"Unsupported nfs://-URL parameter "
  1161. -                            L"'%S' value '%S'.\n",
  1162. +                            L"'%s' value '%s'.\n",
  1163.                              pname, pvalue);
  1164.                          goto out;
  1165.                      }
  1166. @@ -790,7 +794,7 @@ static DWORD ParseRemoteName(
  1167.                          result = ERROR_BAD_ARGUMENTS;
  1168.                          (void)fwprintf(stderr,
  1169.                              L"Unsupported nfs://-URL parameter "
  1170. -                            L"'%S' value '%S'.\n",
  1171. +                            L"'%s' value '%s'.\n",
  1172.                              pname, pvalue);
  1173.                          goto out;
  1174.                      }
  1175. @@ -798,7 +802,7 @@ static DWORD ParseRemoteName(
  1176.                  else {
  1177.                      result = ERROR_BAD_ARGUMENTS;
  1178.                      (void)fwprintf(stderr,
  1179. -                        L"Unsupported nfs://-URL parameter '%S'.\n",
  1180. +                        L"Unsupported nfs://-URL parameter '%s'.\n",
  1181.                          pname);
  1182.                      goto out;
  1183.                  }
  1184. @@ -811,7 +815,7 @@ static DWORD ParseRemoteName(
  1185.          hostname_wstr = utf8str2wcs(uctx->hostport.hostname);
  1186.          if (!hostname_wstr) {
  1187.              result = GetLastError();
  1188. -            (void)fwprintf(stderr, L"Cannot convert URL host '%S', lasterr=%d\n",
  1189. +            (void)fwprintf(stderr, L"Cannot convert URL host '%s', lasterr=%d\n",
  1190.                  uctx->hostport.hostname, result);
  1191.              goto out;
  1192.          }
  1193. @@ -835,7 +839,7 @@ static DWORD ParseRemoteName(
  1194.          pEnd = mountstrmem = utf8str2wcs(uctx->path);
  1195.          if (!mountstrmem) {
  1196.              result = GetLastError();
  1197. -            (void)fwprintf(stderr, L"Cannot convert URL path '%S', lasterr=%d\n",
  1198. +            (void)fwprintf(stderr, L"Cannot convert URL path '%s', lasterr=%d\n",
  1199.                  uctx->path, result);
  1200.              goto out;
  1201.          }
  1202. @@ -920,7 +924,7 @@ static DWORD ParseRemoteName(
  1203.              c = premotename[i];
  1204.              if (!(iswxdigit(c) || (c == L':'))) {
  1205.                  fwprintf(stderr, L"Failed to parse raw IPv6 "
  1206. -                   L"address, illegal character '%c' found.\n",
  1207. +                   L"address, illegal character '%lc' found.\n",
  1208.                     c);
  1209.                  result = ERROR_BAD_ARGUMENTS;
  1210.                  goto out;
  1211. @@ -942,11 +946,11 @@ static DWORD ParseRemoteName(
  1212.          *   too
  1213.          */
  1214.          (void)swprintf(srvname, SRVNAME_LEN,
  1215. -           L"%s.ipv6-literal.net@%d", premotename, port);
  1216. +           L"%ls.ipv6-literal.net@%d", premotename, port);
  1217.      }
  1218.      else {
  1219.          /* ALWAYS add port number to hostname, so UNC paths use it too */
  1220. -        (void)swprintf(srvname, SRVNAME_LEN, L"%s@%d",
  1221. +        (void)swprintf(srvname, SRVNAME_LEN, L"%ls@%d",
  1222.             premotename, port);
  1223.      }
  1224.  
  1225. @@ -955,15 +959,15 @@ static DWORD ParseRemoteName(
  1226.       * address without ':', or just random garbage
  1227.       */
  1228.      if (wcschr(srvname, L':')) {
  1229. -        fwprintf(stderr,
  1230. -           L"Illegal ':' character hostname '%s'.\n", srvname);
  1231. +        (void)fwprintf(stderr,
  1232. +           L"Illegal ':' character hostname '%ls'.\n", srvname);
  1233.          result = ERROR_BAD_ARGUMENTS;
  1234.          goto out;
  1235.      }
  1236.  
  1237.  #ifdef DEBUG_MOUNT
  1238.      (void)fwprintf(stderr,
  1239. -        L"srvname='%s', mntpt='%s'\n",
  1240. +        L"srvname='%ls', mntpt='%ls'\n",
  1241.          srvname,
  1242.          pEnd);
  1243.  #endif
  1244. @@ -993,7 +997,7 @@ static DWORD ParseRemoteName(
  1245.  
  1246.  #ifdef DEBUG_MOUNT
  1247.      (void)fwprintf(stderr,
  1248. -        L"pConnectionName='%s', pParsedRemoteName='%s', use_nfspubfh='%d'\n",
  1249. +        L"pConnectionName='%ls', pParsedRemoteName='%ls', use_nfspubfh='%d'\n",
  1250.          pConnectionName,
  1251.          pParsedRemoteName,
  1252.          (int)use_nfspubfh);
  1253. @@ -1029,7 +1033,7 @@ static DWORD DoMount(
  1254.  
  1255.  #ifdef DEBUG_MOUNT
  1256.      (void)fwprintf(stderr,
  1257. -        L"DoMount(pLocalName='%s', pRemoteName='%s', pParsedRemoteName='%s')\n",
  1258. +        L"DoMount(pLocalName='%ls', pRemoteName='%ls', pParsedRemoteName='%ls')\n",
  1259.          pLocalName,
  1260.          pRemoteName,
  1261.          pParsedRemoteName);
  1262. @@ -1042,8 +1046,8 @@ static DWORD DoMount(
  1263.          result = WNetGetConnectionW(pLocalName, (LPWSTR)szExisting, &dwLength);
  1264.          if (result == NO_ERROR) {
  1265.              result = ERROR_ALREADY_ASSIGNED;
  1266. -            (void)fwprintf(stderr, L"Mount failed, drive '%s' is "
  1267. -                L"already assigned to '%s'.\n",
  1268. +            (void)fwprintf(stderr, L"Mount failed, drive '%ls' is "
  1269. +                L"already assigned to '%ls'.\n",
  1270.                  pLocalName, szExisting);
  1271.              return result;
  1272.          }
  1273. @@ -1085,11 +1089,11 @@ static DWORD DoMount(
  1274.          szConnection, &ConnectSize, &ConnectResult);
  1275.  
  1276.      if (result == NO_ERROR) {
  1277. -        (void)wprintf(L"Successfully mounted '%s' to drive '%s'\n",
  1278. +        (void)wprintf(L"Successfully mounted '%ls' to drive '%ls'\n",
  1279.              pParsedRemoteName, szConnection);
  1280.      }
  1281.      else {
  1282. -        (void)fwprintf(stderr, L"WNetUseConnectionW('%s', '%s') "
  1283. +        (void)fwprintf(stderr, L"WNetUseConnectionW('%ls', '%ls') "
  1284.              L"failed with error code %u.\n",
  1285.              pLocalName, pRemoteName, result);
  1286.      }
  1287. @@ -1109,15 +1113,15 @@ static DWORD DoUnmount(
  1288.      switch (result)
  1289.      {
  1290.      case NO_ERROR:
  1291. -        (void)wprintf(L"Drive '%s' unmounted successfully.\n",
  1292. +        (void)wprintf(L"Drive '%ls' unmounted successfully.\n",
  1293.              pLocalName);
  1294.          break;
  1295.      case ERROR_NOT_CONNECTED:
  1296. -        (void)fwprintf(stderr, L"Drive '%s' is not currently "
  1297. +        (void)fwprintf(stderr, L"Drive '%ls' is not currently "
  1298.              L"connected.\n", pLocalName);
  1299.          break;
  1300.      default:
  1301. -        (void)fwprintf(stderr, L"WNetCancelConnection2W('%s') failed "
  1302. +        (void)fwprintf(stderr, L"WNetCancelConnection2W('%ls') failed "
  1303.              L"with error code %u.\n", pLocalName, result);
  1304.          break;
  1305.      }
  1306. diff --git a/mount/options.c b/mount/options.c
  1307. index 4f3ca54..0c28756 100644
  1308. --- a/mount/options.c
  1309. +++ b/mount/options.c
  1310. @@ -20,6 +20,10 @@
  1311.   * Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  1312.   */
  1313.  
  1314. +#ifndef _CRT_STDIO_ISO_WIDE_SPECIFIERS
  1315. +#error Code requires ISO wide-char behaviour
  1316. +#endif /* !_CRT_STDIO_ISO_WIDE_SPECIFIERS */
  1317. +
  1318.  #include <crtdbg.h>
  1319.  #include <Windows.h>
  1320.  #include <strsafe.h>
  1321. @@ -124,9 +128,9 @@ BOOL InsertOption(
  1322.      if (FindOptionByName(Name, Options, &Current)) {
  1323.          (void)fwprintf(stderr, L"Found a duplicate option "
  1324.              L"'%s%s%s' while parsing '%s%s%s'.\n",
  1325. -            (PTCH)Current->EaName,
  1326. +            (PWCH)Current->EaName,
  1327.              Current->EaValueLength ? L"=" : L"",
  1328. -            (PTCH)(Current->EaName + Current->EaNameLength + sizeof(wchar_t)),
  1329. +            (PWCH)(Current->EaName + Current->EaNameLength + sizeof(wchar_t)),
  1330.              Name, ValueLen ? L"=" : Value, Value);
  1331.          return FALSE;
  1332.      }
  1333. @@ -197,7 +201,7 @@ BOOL ParseMountOptions(
  1334.      IN LPWSTR Arg,
  1335.      IN OUT PMOUNT_OPTION_LIST Options)
  1336.  {
  1337. -    PTCH pos, comma, equals;
  1338. +    PWCH pos, comma, equals;
  1339.  
  1340.      pos = Arg;
  1341.      for (;;)
  1342. @@ -237,7 +241,7 @@ BOOL ParseMountOptions(
  1343.  
  1344.  out_empty_option:
  1345.      (void)fwprintf(stderr, L"Found an empty option while "
  1346. -        L"reading mount options at '%s'.\n",
  1347. +        L"reading mount options at '%ls'.\n",
  1348.          pos);
  1349.      return FALSE;
  1350.  }
  1351. diff --git a/mount/urlparser1.c b/mount/urlparser1.c
  1352. index 8fcae52..66303a1 100644
  1353. --- a/mount/urlparser1.c
  1354. +++ b/mount/urlparser1.c
  1355. @@ -25,6 +25,12 @@
  1356.  #error Code requires ISO C17
  1357.  #endif
  1358.  
  1359. +#ifdef _MSC_VER
  1360. +#ifndef _CRT_STDIO_ISO_WIDE_SPECIFIERS
  1361. +#error Code requires ISO wide-char behaviour
  1362. +#endif /* !_CRT_STDIO_ISO_WIDE_SPECIFIERS */
  1363. +#endif /* _MSC_VER */
  1364. +
  1365.  #include <stdlib.h>
  1366.  #include <stdbool.h>
  1367.  #include <string.h>
  1368. --
  1369. 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