Re: Win32Lib getUserName() problem

new topic     » goto parent     » topic index » view thread      » older message » newer message
AndyDrummond said...
mattlewis said...

Your code looks ok to me. Have you tried any of the other formats? If it fails, you might try calling GetLastError to see if there's anything interesting there.

Matt

The failure is a terminal one - I shall have to put getLastError() into the crash file. We will see what we will see then ...

Ah. That's different, then. In this sort of situation I often try allocating a much larger buffer than I need, just in case there's something strange going on there, or I misread what I'm supposed to be doing. And a closer reading of the documentation shows this

GetUserNameEx said...
  • lpnSize This parameter receives the required buffer size, in Unicode characters (whether or not Unicode is being used), including the terminating null character.

So it looks like you may need to allocate double the size buffer (so 518 bytes total in your code). That's what I'd try.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu