On 10/25/21 15:34, Alexandre Julliard wrote:
Nick Fox <nick(a)foxsec.net> writes:
+ lstrcpyW( buffer, L"c:\\temp" ); + p = buffer + lstrlenW(buffer); + *p++ = '\\'; + lstrcpyW( p, fooW ); + ret = pLdrGetDllPath( buffer, LOAD_WITH_ALTERED_SEARCH_PATH, &path, &unknown_ptr ); + ok( !ret, "LdrGetDllPath failed %x\n", ret ); + ok( !unknown_ptr, "unknown ptr %p\n", unknown_ptr ); + lstrcpyW( buffer, L"c:\\temp" ); + p = buffer + lstrlenW( buffer ); + *p++ = '\\'; + *p++ = ';'; + GetSystemDirectoryW( p, buffer + ARRAY_SIZE(buffer) - p ); + p = buffer + lstrlenW(buffer); + *p++ = ';'; + GetSystemDirectoryW( p, buffer + ARRAY_SIZE(buffer) - p ); + p = buffer + lstrlenW(buffer) - 2; /* remove "32" */ + *p++ = ';'; + GetWindowsDirectoryW( p, buffer + ARRAY_SIZE(buffer) - p ); + p = buffer + lstrlenW(buffer); + *p++ = ';'; + *p++ = '.'; + *p++ = ';'; Please use the existing helper instead of duplicating all this code.
-- Alexandre Julliard julliard(a)winehq.org
Thank you for the review and suggestion. Also apologies in advance if this email isn't formatted properly, this is my first time. Did you mean the build_search_path() function? I looked at it but it was subtly different than what I needed to do (related to the bug), and I wasn't comfortable defining a new one or adding complexity to the existing one by handling this edge case. For example, here are the results on Windows when I use build_search_path() instead of building it manually: path.c:2696: Test failed: got L".\\foo;C:\\WINDOWS\\SYSTEM32;C:\\WINDOWS\\system;C:\\WINDOWS;.;foo" expected L"C:\\Users\\nick\\Documents;C:\\WINDOWS\\system32;C:\\WINDOWS\\system;C:\\WINDOWS;.;foo" path.c:2723: Test failed: got L"temp\\;C:\\WINDOWS\\SYSTEM32;C:\\WINDOWS\\system;C:\\WINDOWS;.;foo" expected L"C:\\Users\\nick\\Documents;C:\\WINDOWS\\system32;C:\\WINDOWS\\system;C:\\WINDOWS;.;foo" path.c:2750: Test failed: got L"c:\\temp;C:\\WINDOWS\\SYSTEM32;C:\\WINDOWS\\system;C:\\WINDOWS;.;foo" expected L"C:\\Users\\nick\\Documents;C:\\WINDOWS\\system32;C:\\WINDOWS\\system;C:\\WINDOWS;.;foo" They all pass when building the path manually. Do you think it would be better to try and modify the existing helper function, or add a new one? If adding a new one, I wasn't sure what to call it. build_altered_search_path() or something like that maybe?