From: "Jiajin Cui" Subject: [PATCH v2 2/2] kernel32: Fix GetPrivateProfileIntW() if section and filename are both NULL. Message-Id: <202007011902301430432@uniontech.com> Date: Wed, 1 Jul 2020 19:02:30 +0800 From 3cbffc98d697b2f7e3aa4bce0d96281145f3134c Mon Sep 17 00:00:00 2001 From: Jiajin Cui Date: Tue, 30 Jun 2020 14:00:36 +0800 Subject: [PATCH v2 2/2] kernel32: Fix GetPrivateProfileIntW() if section and filename are both NULL. Signed-off-by: Changping Yu Signed-off-by: Jiajin Cui --- dlls/kernel32/profile.c | 5 +++++ dlls/kernel32/tests/profile.c | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c index 2cf0819023..6c4f9e8f5d 100644 --- a/dlls/kernel32/profile.c +++ b/dlls/kernel32/profile.c @@ -1198,7 +1198,12 @@ UINT WINAPI GetPrivateProfileIntW( LPCWSTR section, LPCWSTR entry, if (GetPrivateProfileStringW( section, entry, emptystringW, buffer, ARRAY_SIZE( buffer ), filename ) == 0) + { + if(!section && !filename) + return 0; + return def_val; + } /* FIXME: if entry can be found but it's empty, then Win16 is * supposed to return 0 instead of def_val ! Difficult/problematic diff --git a/dlls/kernel32/tests/profile.c b/dlls/kernel32/tests/profile.c index a28c9aa138..9ec57d22aa 100644 --- a/dlls/kernel32/tests/profile.c +++ b/dlls/kernel32/tests/profile.c @@ -109,7 +109,6 @@ static void test_profile_int(void) res = GetPrivateProfileIntA(profileInt[i].section, profileInt[i].key, profileInt[i].defaultVal, profileInt[i].iniFile); - todo_wine_if(i == 0 || i == 3 || i == 4) ok((res == profileInt[i].result), "test<%02d>: ret<%010u> exp<%010u>\n", i, res, profileInt[i].result); } -- 2.20.1