Closed movedoa closed 3 years ago
Just a random idea. Maybe the username contained some exotic characters. Since you use the Ansi version of the winapi function i would guess this would not work.
Maybe you should use the W versions of all winapi functions (there seem to be some more in the codebase) if cpinternal is UTF-8 (With the apropriate codepage convert of corse, see https://knowledgebase.progress.com/articles/Article/000043703 and https://knowledgebase.progress.com/articles/Article/How-to-Call-WIN32-API-Function-GetUserName)
Thinking about it maybe this would also explain #34. SokoDigger uses SendMessageA and we run everything with UTF-8 🤔
For now I think I will just use "default" if the username cannot be retrieved. Will test the sokodigger again with an UTF-8 session
Had this on a client mashine. For some reason GetUserNameA just returned "" and not the user name but the return value (intResult) was 1. I can not reproduce this an my mashine and i can't really debug this on the clients mashine. Maybe some UAC or rights problem.
Anyway there is already a check in this function that looks at the return value and sets the name to default if the return value is <> 1
The code should also check if cUserName is ? or "" to account for this case.