1450 – Registry: invalid UTF-8 sequence

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1450 - Registry: invalid UTF-8 sequence
Summary: Registry: invalid UTF-8 sequence
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 major
Assignee: Walter Bright
URL:
Keywords:
Depends on:
Blocks:
Reported: 2007年08月29日 08:54 UTC by keystuffs
Modified: 2014年02月16日 15:23 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description keystuffs 2007年08月29日 08:54:20 UTC
I get this error when I use the function value_EXPAND_SZ:
 std.stdio.writefln(key.getValue("").value_EXPAND_SZ());
This is caused because the value returned is 2 characters too long. 
The function value_EXPAND_SZ use the function ExpandEnvironmentStringsA. In the documentation found here: http://msdn2.microsoft.com/en-us/library/ms724265.aspx, this function return the string length, plus terminating null character, plus one.
This means that the variable "newValue" returned by value_EXPAND_SZ contains 2 extra characters.
To resolve the bug, I changed the last line by:
 return newValue[0 .. newValue.length - 2];
Comment 1 Walter Bright 2007年09月28日 22:15:52 UTC
Fixed dmd 1.021 and 2.004


AltStyle によって変換されたページ (->オリジナル) /