- From ad4aa3a0cf0eb01a72b9505e3369b3b9b9a0387f Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Sat, 20 Sep 2025 17:46:29 +0200
- Subject: [PATCH 1/2] daemon,sys: Simplify UTF-8 string transfer kernel to
- userland daemon
- Simplify UTF-8 string transfer kernel to userland daemon.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/util.c | 11 ++++++++++-
- sys/nfs41sys_driver.c | 45 ++++++++++++++++++++++++-------------------
- sys/nfs41sys_util.h | 3 ++-
- 3 files changed, 37 insertions(+), 22 deletions(-)
- diff --git a/daemon/util.c b/daemon/util.c
- index 4788d85..37660d2 100644
- --- a/daemon/util.c
- +++ b/daemon/util.c
- @@ -82,6 +82,7 @@ int get_name(unsigned char **pos, uint32_t *remaining, const char **out_name)
- {
- int status;
- USHORT len;
- + const char *name;
- status = safe_read(pos, remaining, &len, sizeof(USHORT));
- if (status) goto out;
- @@ -89,9 +90,17 @@ int get_name(unsigned char **pos, uint32_t *remaining, const char **out_name)
- status = ERROR_BUFFER_OVERFLOW;
- goto out;
- }
- - *out_name = (const char*)*pos;
- +
- + name = (const char *)*pos;
- +
- + EASSERT_MSG((name[len-1] == '\0'),
- + ("name='%s', (len-1)=%d, expected 0x00, got 0x%x\n",
- + name, (int)(len-1), (int)name[len-1]));
- +
- + *out_name = name;
- *pos += len;
- *remaining -= len;
- +
- out:
- return status;
- }
- diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
- index efd2d94..33b4a40 100644
- --- a/sys/nfs41sys_driver.c
- +++ b/sys/nfs41sys_driver.c
- @@ -180,42 +180,47 @@ NTSTATUS marshall_unicode_as_utf8(
- IN OUT unsigned char **pos,
- IN PCUNICODE_STRING str)
- {
- - ANSI_STRING ansi;
- ULONG ActualCount;
- NTSTATUS status;
- + PCHAR out_str;
- +
- + out_str = ((PCHAR)*pos) + sizeof(USHORT);
- if (str->Length == 0) {
- status = STATUS_SUCCESS;
- ActualCount = 0;
- - ansi.MaximumLength = 1;
- goto out_copy;
- }
- - /* query the number of bytes required for the utf8 encoding */
- - status = RtlUnicodeToUTF8N(NULL, 0xffff,
- + /*
- + * Convert the string directly into the upcall buffer
- + * (We assume that the caller has used |length_as_utf8()|
- + * to make sure the buffer is big enougth)
- + */
- + status = RtlUnicodeToUTF8N(out_str, 0xFFFF,
- &ActualCount, str->Buffer, str->Length);
- if (status) {
- - print_error("RtlUnicodeToUTF8N('%wZ') failed with 0x%08X\n",
- - str, status);
- + print_error("marshall_unicode_as_utf8: "
- + "RtlUnicodeToUTF8N(str='%wZ',str->Length=%ld) failed with 0x%lx\n",
- + str, (long)str->Length, (long)status);
- goto out;
- }
- - /* convert the string directly into the upcall buffer */
- - ansi.Buffer = (PCHAR)*pos + sizeof(ansi.MaximumLength);
- - ansi.MaximumLength = (USHORT)ActualCount + sizeof(UNICODE_NULL);
- - status = RtlUnicodeToUTF8N(ansi.Buffer, ansi.MaximumLength,
- - &ActualCount, str->Buffer, str->Length);
- - if (status) {
- - print_error("RtlUnicodeToUTF8N(%hu, '%wZ', %hu) failed with 0x%08X\n",
- - ansi.MaximumLength, str, str->Length, status);
- - goto out;
- - }
- out_copy:
- - RtlCopyMemory(*pos, &ansi.MaximumLength, sizeof(ansi.MaximumLength));
- - *pos += sizeof(ansi.MaximumLength);
- - (*pos)[ActualCount] = '\0';
- - *pos += ansi.MaximumLength;
- + /* Terminate buffer */
- + out_str[ActualCount] = '\0';
- +
- + /*
- + * Copy size field
- + * (string itself was already converted&&written by |RtlUnicodeToUTF8N()|)
- + */
- + USHORT out_str_len = (USHORT)(ActualCount+1L);
- + RtlCopyMemory(*pos, &out_str_len, sizeof(out_str_len));
- + *pos += sizeof(out_str_len);
- +
- + /* Add string size to buffer pointer */
- + *pos += out_str_len;
- out:
- return status;
- }
- diff --git a/sys/nfs41sys_util.h b/sys/nfs41sys_util.h
- index f0f6791..c1ade4c 100644
- --- a/sys/nfs41sys_util.h
- +++ b/sys/nfs41sys_util.h
- @@ -40,7 +40,8 @@ static INLINE ULONG length_as_utf8(
- {
- ULONG ActualCount = 0;
- RtlUnicodeToUTF8N(NULL, 0xffff, &ActualCount, str->Buffer, str->Length);
- - return sizeof(str->MaximumLength) + ActualCount + sizeof(UNICODE_NULL);
- + /* Length of length field + string length + '\0'*/
- + return sizeof(USHORT) + ActualCount + 1;
- }
- /* Prototypes */
- --
- 2.51.0
- From 92bdef5254e8408e288557a10a64b4985ea428af Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Sat, 20 Sep 2025 17:53:57 +0200
- Subject: [PATCH 2/2] README.md,docs: Document "Borland Turbo C" as supported
- in NTVDM
- Document "Borland Turbo C" as supported in NTVDM
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- README.md | 6 ++++--
- docs/README.xml | 1 +
- 2 files changed, 5 insertions(+), 2 deletions(-)
- diff --git a/README.md b/README.md
- index 4a05d7e..69478be 100644
- --- a/README.md
- +++ b/README.md
- @@ -246,8 +246,10 @@ NFSv4.2/NFSv4.1 filesystem driver for Windows 10/11 & Windows Server
- - Windows 16bit DOS and Windows 3.x applications via [NT Virtual DOS
- Machine](https://learn.microsoft.com/en-us/windows/compatibility/ntvdm-and-16-bit-app-support)
- - (requires case-insensitive filesystem), e.g. [Total Commander for
- - Windows 3.x](https://www.ghisler.com/wcmd16.htm),
- + (requires case-insensitive filesystem), e.g. [Borland Turbo C
- + compiler](https://web.archive.org/web/20040401174842/http://bdn.borland.com/article/0,1410,20841,00.html),
- + [Total Commander for Windows
- + 3.x](https://www.ghisler.com/wcmd16.htm),
- [DOSNIX](http://www.retroarchive.org/garbo/pc/unix/dosnx23b.zip),
- [DOS 16bit
- zip](https://github.com/DankRank/ftp.info-zip.org/raw/refs/heads/master/ftp.info-zip.org/pub/infozip/msdos/zip232x.zip),
- diff --git a/docs/README.xml b/docs/README.xml
- index 02ddeb4..4f66314 100644
- --- a/docs/README.xml
- +++ b/docs/README.xml
- @@ -280,6 +280,7 @@
- <para>Windows 16bit DOS and Windows 3.x applications via
- <link xl:href="https://learn.microsoft.com/en-us/windows/compatibility/ntvdm-and-16-bit-app-support">NT Virtual DOS Machine</link> (requires case-insensitive filesystem), e.g.
- <simplelist type="inline">
- + <member><link xl:href="https://web.archive.org/web/20040401174842/http://bdn.borland.com/article/0,1410,20841,00.html">Borland Turbo C compiler</link></member>
- <member><link xl:href="https://www.ghisler.com/wcmd16.htm">Total Commander for Windows 3.x</link></member>
- <member><link xl:href="http://www.retroarchive.org/garbo/pc/unix/dosnx23b.zip">DOSNIX</link></member>
- <member><link xl:href="https://github.com/DankRank/ftp.info-zip.org/raw/refs/heads/master/ftp.info-zip.org/pub/infozip/msdos/zip232x.zip">DOS 16bit zip</link></member>
- --
- 2.51.0
msnfs41client: Simpify kernel2userland string transfer, document Borland Turbo C+misc, 2025-09-20
Posted by Anonymous on Sat 20th Sep 2025 17:00
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
rovema.kpaste.net RSS