Andrew Schwartzmeyer
9a42b894f2
Convert to Allman style with 4-space indentation
2015-08-07 18:43:58 -07:00
Andrew Schwartzmeyer
665f8f1e87
Map getlogin_r()'s ERANGE to ERROR_GEN_FAILURE
...
ERROR_INSUFFICIENT_BUFFER should never occur here and would be a
misleading error for the user.
2015-08-07 12:05:07 -07:00
Andrew Schwartzmeyer
f8e9dfde8c
Fix style issues
...
- Use Doxygen style comments (with better comments)
- Use `type* ident` instead of `type *ident`
- Start { on new lines
- Use TRUE/FALSE from PAL.H
2015-08-07 12:03:31 -07:00
Andrew Schwartzmeyer
b379fb4a6b
Rename to GetUserNameW since it is Unicode
2015-08-06 16:28:29 -07:00
Andrew Schwartzmeyer
447896aede
Use WCHAR sizes instead of CHAR sizes
...
Such that lpnSize is the length (number of UTF-16 characters, including
null) of the username. Must be multiplied by sizeof(char16_t) for bytes.
2015-08-04 18:31:54 -07:00
Andrew Schwartzmeyer
d60bfe0376
Use icu for Unicode conversion and fix lpnSize
...
A careful reading of the GetUserName documentation and Windows Data
Types says that lpnSize is "the number of TCHARs copied to the
buffer...including the terminating null character," and a TCHAR in this
environment is a CHAR because we assume UNICODE is always defined for
CoreCLR. A CHAR is a byte. So lpSize is number of bytes, not number of
UTF-16 characters as we previously believed.
2015-08-04 14:16:49 -07:00
Andrew Schwartzmeyer
b076850012
Refactor setting of lpnSize when buffer size is insufficient
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
2a2c1d9236
Remove unnecessary static qualifier from const string
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
0592a37395
Use std::string instead of C99 dynamic array
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
9426e9c455
Use LOGIN_NAME_MAX instead of L_cuserid
...
Since L_cuserid is only for cuserid, not getlogin_r
Unit test for L_cuserid removed because the macro may not be available
on all platforms.
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
4a2c1c5a95
Set lpnSize when insufficient
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
e8cb7e24fe
Use L_cuserid instead of 64 and given lpnSize
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
3ab3408378
Factor out using directives
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
6699091f7b
Change global to local static const
...
To avoid polluting the global namespace without using a namespace.
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
3ac74ab849
Convert get_login_r to UTF-16 and return
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
6481f0336d
Check for invalid parameters in GetUserName
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
b80da9ab4d
Use getlogin_r() in GetUserName and map errno
2015-08-03 12:53:39 -07:00
Andrew Schwartzmeyer
f676c77a8e
Check locale in GetUserName
2015-08-03 12:53:39 -07:00
Andrew Schwartzmeyer
4404e03613
Update GetUserName signature
2015-08-03 12:53:39 -07:00
Peter Honeder
1b02619b2d
added libps.so, added stub for GetUserName
2015-06-16 14:02:19 -07:00