private static SafeHGlobalBuffer EnumEnvironmentValues(SystemEnvironmentValueInformationClass info_class) { int ret_length = 0; NtStatus status = NtSystemCalls.NtEnumerateSystemEnvironmentValuesEx(info_class, SafeHGlobalBuffer.Null, ref ret_length); if (status != NtStatus.STATUS_BUFFER_TOO_SMALL) { throw new NtException(status); } var buffer = new SafeHGlobalBuffer(ret_length); try { ret_length = buffer.Length; NtSystemCalls.NtEnumerateSystemEnvironmentValuesEx(info_class, buffer, ref ret_length).ToNtException(); return(buffer); } catch { buffer.Dispose(); throw; } }
public static extern NtStatus NtEnumerateSystemEnvironmentValuesEx( SystemEnvironmentValueInformationClass SystemEnvironmentValueInformationClass, SafeBuffer Buffer, ref int BufferLength);