From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 15F2C3858C32; Thu, 22 Feb 2024 19:11:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15F2C3858C32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1708629088; bh=n07NFB5oNxSMf44/wJSsscdTtg4UbKyzTVSyO9qNHa4=; h=Date:From:To:Subject:Reply-To:References:In-Reply-To:From; b=FqdFWKaidk8R2wncSSj+j4RKhSD4vMENl4yk99nlJ28jrsYq6YhB2aTu2cpcBBYfd wRUmJhcIXO7iJXUxJSM1iIM4UtAmQRQexA1Y64tkUKuFgURk9O9OJCqKEPB1x7DLHL Ve3f3WazOBN4sAA0er3ByAZFuTz4d5ycIotolKX4= Received: by calimero.vinschen.de (Postfix, from userid 500) id CCFA1A80935; Thu, 22 Feb 2024 20:11:25 +0100 (CET) Date: Thu, 22 Feb 2024 20:11:25 +0100 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Switching groups with newgrp - how to get the new group with |GetTokenInformation()| ? Message-ID: Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: On Feb 22 18:38, Roland Mainz via Cygwin wrote: > Hi! > > ---- > > If I switch the current user's group with /usr/bin/newgrp, how can a > (native) Win32 process use > |GetTokenInformation(GetCurrentThreadToken(), ...)| to find out which > group is the new "current group" (e.g. which |TokenInformationClass| > should I use) ? PSID sidbuf = (PSID) alloca (SECURITY_MAX_SID_SIZE); NTSTATUS status; ULONG size; status = NtQueryInformationToken (hProcToken, TokenPrimaryGroup, sidbuf, SECURITY_MAX_SID_SIZE, &size); Corinna