Hi Paul,
From: Paul Vriens [mailto:paul.vriens.wine@gmail.com] Ge van Geldorp wrote:
Try 2: Add buffer overflow tests
Changelog: secur32/tests: Add simple tests for GetUserNameExA/W()
dlls/secur32/tests/secur32.c | 86 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 86 insertions(+), 0 deletions(-)
Hi Ge,
The tests show a big list of possible last errors. Are these for a specific platform? If so, we should probably list that. Is the ERROR_INVALID_PARAMETER for NameUnknown also for a specific platform?
I've now tested on all Windows platforms. Passing NameUnknown returns ERROR_NONE_MAPPED if the current user is a local (non-domain) account and ERROR_NO_SUCH_USER if the current user is a domain account. The ERROR_NONE_MAPPED code is returned for all formats except NameSamCompatible if the current user is a local account.
The reason I'm asking is because W2K fails with ERROR_INVALID_PARAMETER for NameDnsDomain and I'm looking for the cleanest way to add that (as broken()).
Based on my new test runs, I came up with the following test:
ok(rc || (formats[i] == NameUnknown && GetLastError() == ERROR_NO_SUCH_USER) || GetLastError() == ERROR_NONE_MAPPED || broken(formats[i] == NameDnsDomain && GetLastError() == ERROR_INVALID_PARAMETER), "GetUserNameExW(%d) failed: %d\n", formats[i], GetLastError());
This passes on all my Windows machines. Personally, I probably wouldn't have used broken() for the W2K case but I'll follow your lead :-)
Ge.