Not sure if anyone is using (add-name-to-file) on Windows, as this bug
looks to have been here for a while... the mswindows_link function in
nt.c does:
wcscpy (data.wid.cStreamName, newuni);
data.wid.dwStreamId = BACKUP_LINK;
data.wid.dwStreamAttributes = 0;
data.wid.Size.LowPart = wlen; /* in bytes, not chars! */
data.wid.Size.HighPart = 0;
data.wid.dwStreamNameSize = 0;
The comment about bytes is correct, but is missing one important
detail: wlen contains wcslen(newuni), but BackupWrite expects the Size
to include the trailing null. So depending on what happens to follow
in memory, the new file might have a garbage name.
When I started seeing these garbage filenames, I copied mswindows_link
out to a standalone program and was able to consistently reproduce the
problem.
This is fixed by changing it to:
data.wid.Size.LowPart = wlen + sizeof(WCHAR); /* including the trailing null. in
bytes, not chars! */
--
Ron Isaacson
Morgan Stanley
ron.isaacson(a)morganstanley.com / (212) 762-1051
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta