From 3c1ebfdf82242e28ef697c139e0e94cb5ceb3fcd Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 12 Jul 2020 20:32:10 -0500 Subject: [PATCH] kernel32: Implement registry mapping in GetPrivateProfileSectionNames(). Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/kernel32/profile.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c index abd5429c8d0..6d8d64fc812 100644 --- a/dlls/kernel32/profile.c +++ b/dlls/kernel32/profile.c @@ -1807,11 +1807,26 @@ DWORD WINAPI GetPrivateProfileSectionNamesW( LPWSTR buffer, DWORD size, LPCWSTR filename) { DWORD ret = 0; + HKEY key; + + if ((key = open_file_mapping_key( filename ))) + { + WCHAR *section; + DWORD i; + + for (i = 0; (section = enum_key( key, i )); ++i) + { + lstrcpynW( buffer + ret, section, size - ret - 1 ); + ret = min( ret + strlenW( section ) + 1, size - 1 ); + } + + RegCloseKey( key ); + } RtlEnterCriticalSection( &PROFILE_CritSect ); if (PROFILE_Open( filename, FALSE )) - ret = PROFILE_GetSectionNames(buffer, size); + ret += PROFILE_GetSectionNames( buffer + ret, size - ret ); RtlLeaveCriticalSection( &PROFILE_CritSect );