Currently a pointer to a local variable is passed, that causes severe stack corruption.
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/hnetcfg/tests/policy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/hnetcfg/tests/policy.c b/dlls/hnetcfg/tests/policy.c index 4e90ceb8fd..208f5838b5 100644 --- a/dlls/hnetcfg/tests/policy.c +++ b/dlls/hnetcfg/tests/policy.c @@ -144,7 +144,7 @@ static void test_NetFwAuthorizedApplication(void)
info = (UNIVERSAL_NAME_INFOW *)&netpath; sz = sizeof(netpath); - hr = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, &info, &sz); + hr = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, info, &sz); if (hr != NO_ERROR) { info->lpUniversalName = netpath + sizeof(*info)/sizeof(WCHAR);
The pointer is set to the required size not only when the input size is 0, but generally when it is too small.
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/mpr/tests/mpr.c | 5 ++++- dlls/mpr/wnet.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/mpr/tests/mpr.c b/dlls/mpr/tests/mpr.c index fc067d98c4..3e5ca099eb 100644 --- a/dlls/mpr/tests/mpr.c +++ b/dlls/mpr/tests/mpr.c @@ -51,11 +51,14 @@ static void test_WNetGetUniversalName(void)
ok(info_size == sizeof(buffer), "Got wrong size: %u\n", info_size);
- fail_size = 0; + fail_size = 1; ret = WNetGetUniversalNameA(driveA, UNIVERSAL_NAME_INFO_LEVEL, buffer, &fail_size); if(drive_type == DRIVE_REMOTE) + { todo_wine ok(ret == WN_BAD_VALUE || ret == WN_MORE_DATA, "WNetGetUniversalNameA failed: %08x\n", ret); + ok(fail_size > 1, "Got %d\n", fail_size); + } else ok(ret == WN_NOT_CONNECTED || ret == WN_NO_NET_OR_BAD_PATH, "(%s) WNetGetUniversalNameW gave wrong error: %u\n", driveA, ret); diff --git a/dlls/mpr/wnet.c b/dlls/mpr/wnet.c index 78759ecb15..002ab7bb52 100644 --- a/dlls/mpr/wnet.c +++ b/dlls/mpr/wnet.c @@ -2386,6 +2386,7 @@ DWORD WINAPI WNetGetUniversalNameW ( LPCWSTR lpLocalPath, DWORD dwInfoLevel, size = sizeof(*info) + (lstrlenW(lpLocalPath) + 1) * sizeof(WCHAR); if (*lpBufferSize < size) { + *lpBufferSize = size; err = WN_MORE_DATA; break; }