X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CEC833858438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1708629160; bh=0ewVLn+B69LFv600RdgPFr+iU93fqEPQSQmF8helL6w=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=HWkThKc6fE8O7K7iZcpLqjphVCIQpD1B1C9VBhRYxFpKr0FjVpjz+Y0H+G4bTQAuw v3a7RWSyfORJzuINmI7ohTg0vrE6xVciOV7sc7H63rOd1V55TWRYRTrko6Jnp/4B0S V+SZVWfrWV24VETHXDrlq5yErAlYrs5riQwfgRnM= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15F2C3858C32 Date: Thu, 22 Feb 2024 20:11:25 +0100 To: cygwin AT cygwin DOT com Subject: Re: Switching groups with newgrp - how to get the new group with |GetTokenInformation()| ? Message-ID: Mail-Followup-To: cygwin AT cygwin DOT com References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" 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 -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple