George Fleming
43c7bdd137
New GetLinkCount()
2015-10-23 10:55:55 -07:00
Andrew Schwartzmeyer
020a768c31
Use getpwuid(geteuid()) instead of getlogin()
...
This removes the dependency on a TTY and now does what is expected: gets
the (possibly impersonated) username of the current process/thread.
Implementation and tests updated, still uses reentrant versions where possible.
2015-09-23 15:57:23 -07:00
Andrew Schwartzmeyer
39174a0afb
Fix GetCpInfo
...
- Move cpinfo related code out of pal.h and into getcpinfo.h
- Use static cpinfo struct (not pointer) in test and pass address
- Whitespace cleanup
2015-08-28 15:59:31 -07:00
Aaron
782d164247
Changes to documentation
2015-08-28 15:17:34 -07:00
Aaron
f32441327d
Merge Conflict
2015-08-26 13:28:51 -07:00
Aaron
4762820519
Get rid of merge conflict
2015-08-26 13:03:51 -07:00
Aaron
805394e423
Got rid of merge conflict
2015-08-26 09:28:48 -07:00
Aaron Katz
aba54f074d
Merge pull request 102 from dev/9-getcomputername into develop
2015-08-21 16:56:54 +00:00
Aaron
23ad440cfc
made changes based on feedback from pull request
2015-08-21 09:55:39 -07:00
Aaron
50f9af1bd3
changes back on feedback from pull request
2015-08-20 14:40:02 -07:00
Aaron
e4fd76b739
Added changed from feedback from Andy
2015-08-17 17:02:40 -07:00
Aaron
d7355a0572
implemented suggested changes based off of feedback
2015-08-14 12:26:15 -07:00
Aaron
4f62559eaf
Merge remote-tracking branch 'origin/develop' into dev/8-getcpinfo
2015-08-14 11:34:48 -07:00
Aaron
2241d63a28
No longer defining LPSTR
2015-08-14 11:27:22 -07:00
Aaron
1a796b5924
Changes to make converting beteween UTF8 and UTF16
2015-08-14 10:51:25 -07:00
Aaron
53e7c11e69
Added changes based of feedback from Peter
2015-08-14 09:26:45 -07:00
Andrew Schwartzmeyer
60a9a360a1
Use libicu properly for UTF-16 conversion
...
- No more messy calculations
- Only one include, not four
- No resizing
- No memcpy
- Faster because of fromUTF8()
2015-08-13 21:27:08 -07:00
Andrew Schwartzmeyer
70a163e061
Use known size instead of calculation
2015-08-13 20:32:30 -07:00
Andrew Schwartzmeyer
674ca43046
Use just LOGIN_NAME_MAX
...
The +1 is unnecessary since LOGIN_NAME_MAX includes null.
2015-08-13 20:32:30 -07:00
Andrew Schwartzmeyer
db7117bd47
Use length() instead of size()
...
To be consistent with everything else.
2015-08-13 20:32:30 -07:00
Andrew Schwartzmeyer
fc8f5d18c4
Use 0 instead of '\0'
...
To be consistent with tests
2015-08-13 20:32:30 -07:00
Andrew Schwartzmeyer
bb67bfaae7
Remove std::string utf8
...
Not used consistently. Use in-place for comparison.
2015-08-13 17:53:28 -07:00
Andrew Schwartzmeyer
46677d776b
Return FALSE instead of 0
2015-08-13 17:44:05 -07:00
Aaron
72ea5abd0b
New line for {
2015-08-13 10:53:09 -07:00
Aaron
1b537f0c8f
Changed based of feedback
2015-08-13 10:48:38 -07:00
Aaron
f496f91af0
Added changes to code based on additional documention and using a 16 bit string
2015-08-13 09:47:10 -07:00
Aaron
01f85ecf1c
Fixed Merge Confilct with CMakeLists.txt
2015-08-12 14:04:39 -07:00
Aaron
f2ce0d713d
changes to pal.h
2015-08-12 13:56:55 -07:00
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
Aaron
316cabbdcf
Got rid of tests for UTF7, added error checking, adding test to check for null paramater for codepage
2015-08-06 10:16:13 -07:00
Aaron
8bf19f7144
updates to CMakeFile.txt
2015-08-05 13:28:12 -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
Aaron
54618f1750
Made changes based off feedback from Peter. Also added more unit tests
2015-08-04 14:38:53 -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
Aaron
c979881804
added more error handling
2015-08-03 13:54:07 -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
a18a5912ab
Explain GetUserName signature
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