Use handrolled checkenv function to reduce warnings on windows.

Change-Id: I48ff4d59df91d3cb1f4a1f185ae10c97e0fd4250
Merge topic 'windows_getenv' into next

1434738 Use handrolled checkenv function to reduce warnings on windows.