mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-02 17:43:44 +00:00
setupapi: Remove duplicate backslashes on dirids.
This commit is contained in:
parent
d391c11d43
commit
7f901f41f0
3 changed files with 20 additions and 8 deletions
|
@ -419,12 +419,10 @@ static void translateinfstringex_test(void)
|
|||
hr = pTranslateInfStringEx(hinf, inf_file, "Options.NTx86", "Result1",
|
||||
buffer, size, &size, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
todo_wine { /* Wine returns C:\\Program Files, not C:\Program Files */
|
||||
ok(!lstrcmpi(buffer, PROG_FILES_ROOT),
|
||||
"Expected %s, got %s\n", PROG_FILES_ROOT, buffer);
|
||||
ok(size == lstrlenA(PROG_FILES_ROOT)+1, "Expected size %d, got %d\n",
|
||||
lstrlenA(PROG_FILES_ROOT)+1, size);
|
||||
}
|
||||
ok(!lstrcmpi(buffer, PROG_FILES_ROOT),
|
||||
"Expected %s, got %s\n", PROG_FILES_ROOT, buffer);
|
||||
ok(size == lstrlenA(PROG_FILES_ROOT)+1, "Expected size %d, got %d\n",
|
||||
lstrlenA(PROG_FILES_ROOT)+1, size);
|
||||
|
||||
memset(buffer, 'a', PROG_FILES_LEN);
|
||||
buffer[PROG_FILES_LEN - 1] = '\0';
|
||||
|
|
|
@ -316,7 +316,8 @@ static const WCHAR *get_dirid_subst( struct inf_file *file, int dirid, unsigned
|
|||
|
||||
/* retrieve the string substitution for a given string, or NULL if not found */
|
||||
/* if found, len is set to the substitution length */
|
||||
static const WCHAR *get_string_subst( struct inf_file *file, const WCHAR *str, unsigned int *len )
|
||||
static const WCHAR *get_string_subst( struct inf_file *file, const WCHAR *str, unsigned int *len,
|
||||
BOOL no_trailing_slash )
|
||||
{
|
||||
static const WCHAR percent = '%';
|
||||
|
||||
|
@ -353,6 +354,7 @@ static const WCHAR *get_string_subst( struct inf_file *file, const WCHAR *str, u
|
|||
dirid_str[*len] = 0;
|
||||
dirid = strtolW( dirid_str, &end, 10 );
|
||||
if (!*end) ret = get_dirid_subst( file, dirid, len );
|
||||
if (no_trailing_slash && ret && *len && ret[*len - 1] == '\\') *len -= 1;
|
||||
HeapFree( GetProcessHeap(), 0, dirid_str );
|
||||
return ret;
|
||||
}
|
||||
|
@ -387,7 +389,7 @@ unsigned int PARSER_string_substW( struct inf_file *file, const WCHAR *text, WCH
|
|||
else /* end of the %xx% string, find substitution */
|
||||
{
|
||||
len = p - start - 1;
|
||||
subst = get_string_subst( file, start + 1, &len );
|
||||
subst = get_string_subst( file, start + 1, &len, p[1] == '\\' );
|
||||
if (!subst)
|
||||
{
|
||||
subst = start;
|
||||
|
|
|
@ -60,6 +60,7 @@ static const char tmpfilename[] = ".\\tmp.inf";
|
|||
#define STR_SECTION "[Strings]\nfoo=aaa\nbar=bbb\nloop=%loop2%\nloop2=%loop%\n" \
|
||||
"per%%cent=abcd\nper=1\ncent=2\n22=foo\n" \
|
||||
"big=" A400 "\n" \
|
||||
"mydrive=\"C:\\\"\n" \
|
||||
"verybig=" A400 A400 A400 "\n"
|
||||
|
||||
/* create a new file with specified contents and open it */
|
||||
|
@ -284,6 +285,7 @@ static const struct
|
|||
{ "ab=cd\",\"ef", "ab", { "cd,ef" } },
|
||||
{ "ab=cd\",ef", "ab", { "cd,ef" } },
|
||||
{ "ab=cd\",ef\\\nab", "ab", { "cd,ef\\" } },
|
||||
|
||||
/* single quotes (unhandled)*/
|
||||
{ "HKLM,A,B,'C',D", NULL, { "HKLM", "A","B","'C'","D" } },
|
||||
/* spaces */
|
||||
|
@ -317,6 +319,16 @@ static const struct
|
|||
{ "a=%big%%big%%big%%big%\n" STR_SECTION, "a", { A400 A400 A400 A400 } },
|
||||
{ "a=%big%%big%%big%%big%%big%%big%%big%%big%%big%\n" STR_SECTION, "a", { A400 A400 A400 A400 A400 A400 A400 A400 A400 } },
|
||||
{ "a=%big%%big%%big%%big%%big%%big%%big%%big%%big%%big%%big%\n" STR_SECTION, "a", { A4097 /*MAX_INF_STRING_LENGTH+1*/ } },
|
||||
|
||||
/* Prove expansion of system entries removes extra \'s and string
|
||||
replacements doesnt */
|
||||
{ "ab=\"%24%\"\n" STR_SECTION, "ab", { "C:\\" } },
|
||||
{ "ab=\"%mydrive%\"\n" STR_SECTION, "ab", { "C:\\" } },
|
||||
{ "ab=\"%24%\\fred\"\n" STR_SECTION, "ab", { "C:\\fred" } },
|
||||
{ "ab=\"%mydrive%\\fred\"\n" STR_SECTION,"ab", { "C:\\\\fred" } },
|
||||
/* Confirm duplicate \'s kept */
|
||||
{ "ab=\"%24%\\\\fred\"", "ab", { "C:\\\\fred" } },
|
||||
{ "ab=C:\\\\FRED", "ab", { "C:\\\\FRED" } },
|
||||
};
|
||||
|
||||
/* check the key of a certain line */
|
||||
|
|
Loading…
Reference in a new issue