Commit Graph
93 Commits
Author SHA1 Message Date
Aaron 95060b345f Merge Conflict 2015-08-26 11:55:58 -07:00
Aaron f6958d7212 Got rid of merge conflict 2015-08-26 09:28:48 -07:00
Aaron c9164d5401 made changes based on feedback from pull request 2015-08-25 13:47:39 -07:00
Andrew Schwartzmeyer 440cf6a236 Remove type_name and function_name from host
Custom hosting code was refactored to take a path to an assembly instead
of an assembly name coupled with a type and function to
execute. Instead, the host now directly executes the given assembly,
calling its Main function.

The path is resolved relative to the current directory, as should be
expected.
2015-08-21 17:39:52 -07:00
Andy Schwartzmeyer 1a34c0de9a Merge pull request 123 from dev/123-main into develop 2015-08-21 23:28:32 +00:00
Andrew Schwartzmeyer 5d117330a8 Call into Main of PowerShell assembly
Instead of UnmanagedMain. Requires patch to CoreCLR (submitted upstream
but backported until we've integrated their work).
2015-08-21 16:17:16 -07:00
Peter Honeder 4ffb564dbd added testing code to call into Main 2015-08-21 16:16:38 -07:00
Aaron Katz c5be936efa Merge pull request 102 from dev/9-getcomputername into develop 2015-08-21 16:56:54 +00:00
Aaron e1d4d14028 made changes based on feedback from pull request 2015-08-21 09:55:39 -07:00
Aaron ca4504ec0a changes back on feedback from pull request 2015-08-20 14:40:02 -07:00
Aaron f62c92432b Added changed from feedback from Andy 2015-08-17 17:02:40 -07:00
Aaron d2f7ba1cb4 implemented suggested changes based off of feedback 2015-08-14 12:26:15 -07:00
Aaron d627dac5e8 Merge remote-tracking branch 'origin/develop' into dev/8-getcpinfo 2015-08-14 11:34:48 -07:00
Aaron 18e8bb1dfa No longer defining LPSTR 2015-08-14 11:27:22 -07:00
Aaron df8ab7f662 Changes to make converting beteween UTF8 and UTF16 2015-08-14 10:51:25 -07:00
Aaron 427cce83f0 Added changes based of feedback from Peter 2015-08-14 09:26:45 -07:00
Andrew Schwartzmeyer 9164baa9c4 Use libicu properly in tests 2015-08-13 21:34:59 -07:00
Andrew Schwartzmeyer 8fdfeb250d 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 77f9757a05 Use known size instead of calculation 2015-08-13 20:32:30 -07:00
Andrew Schwartzmeyer fd8352c469 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 c6aa25acd5 Use length() instead of size()
To be consistent with everything else.
2015-08-13 20:32:30 -07:00
Andrew Schwartzmeyer 91345a149e Use 0 instead of '\0'
To be consistent with tests
2015-08-13 20:32:30 -07:00
Andrew Schwartzmeyer bef9deeb84 Remove std::string utf8
Not used consistently. Use in-place for comparison.
2015-08-13 17:53:28 -07:00
Andrew Schwartzmeyer 454d1f276a Return FALSE instead of 0 2015-08-13 17:44:05 -07:00
Aaron 6bb2c69782 New line for { 2015-08-13 10:53:09 -07:00
Aaron e900fc89d6 Changed based of feedback 2015-08-13 10:48:38 -07:00
Aaron dfb7a49c21 Added changes to code based on additional documention and using a 16 bit string 2015-08-13 09:47:10 -07:00
Aaron e10abd1971 Fixed Merge Confilct with CMakeLists.txt 2015-08-12 14:04:39 -07:00
Aaron 6fc54d4e42 changes to pal.h 2015-08-12 13:56:55 -07:00
Andrew Schwartzmeyer a99c56eea3 Convert to Allman style with 4-space indentation 2015-08-07 18:43:58 -07:00
Andrew Schwartzmeyer f35efda7e7 Add -Wall to CMAKE_CXX_FLAGS 2015-08-07 12:07:19 -07:00
Andrew Schwartzmeyer 467fdeeb0c 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 062eb5a7b4 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 1b18bfd5e1 Clean up CMakeLists 2015-08-06 17:03:53 -07:00
Andrew Schwartzmeyer afab62205a Rename to GetUserNameW since it is Unicode 2015-08-06 16:28:29 -07:00
Aaron 3aba128b6d 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 8e5bfe3072 updates to CMakeFile.txt 2015-08-05 13:28:12 -07:00
Andrew Schwartzmeyer 2ec0c2996f 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 9ff9a88279 Made changes based off feedback from Peter. Also added more unit tests 2015-08-04 14:38:53 -07:00
Andrew Schwartzmeyer 7d007d6708 Remove PAL submodule 2015-08-04 14:16:57 -07:00
Andrew Schwartzmeyer b77b0a7e6c Update GetUserName tests
Note that these fail when run in a Docker container because a) the
current container's locale is not completely set, and b) getlogin()
returns null with ENOENT since /var/run/utmp is being mapped to the
host, and thus denied access from within the container.

The container needs the locale set and its own /run/utmp, see
https://lists.linuxcontainers.org/pipermail/lxc-users/2011-July/002374.html
2015-08-04 14:16:57 -07:00
Andrew Schwartzmeyer 052ecc801d 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 84d24589be Link ps against icu instead of scxcore
Remove scxcore library from CMake
2015-08-04 14:14:07 -07:00
Aaron 245b287443 added more error handling 2015-08-03 13:54:07 -07:00
Andrew Schwartzmeyer 011d8f41ea Rename userName in test to expectedUsername
To clarify that it is for comparison; not the result of GetUserName.
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer d589ac1cbf Refactor setting of lpnSize when buffer size is insufficient 2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer 865fd0a56b Remove unnecessary static qualifier from const string 2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer b36cdcdc12 Use std::string instead of C99 dynamic array 2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer bb8d0b793e 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 e2d4ce0ab1 Add more unit test coverage for GetUserName 2015-08-03 13:00:34 -07:00