Click here to Skip to main content
16,008,719 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: stupid one... maximizing a window (another time) Pin
Joan M22-Nov-02 8:04
professionalJoan M22-Nov-02 8:04 
GeneralRe: stupid one... maximizing a window (another time) Pin
Ravi Bhavnani22-Nov-02 8:33
professionalRavi Bhavnani22-Nov-02 8:33 
Questionany body could provide the link? Pin
imran_rafique22-Nov-02 5:49
imran_rafique22-Nov-02 5:49 
AnswerRe: any body could provide the link? Pin
techno_guru22-Nov-02 5:59
techno_guru22-Nov-02 5:59 
GeneralRe: any body could provide the link? Pin
techno_guru22-Nov-02 6:06
techno_guru22-Nov-02 6:06 
Questionreturn sucessfully.but? Pin
imran_rafique22-Nov-02 5:18
imran_rafique22-Nov-02 5:18 
AnswerRe: return sucessfully.but? Pin
Anders Molin22-Nov-02 10:14
professionalAnders Molin22-Nov-02 10:14 
GeneralGroup Members and Logon Pin
Richard Hudson22-Nov-02 5:08
Richard Hudson22-Nov-02 5:08 
I posted a threaad earlier on, but I still have probs

I need to enter a username, password and domain. Then it needs
to validate this info from a server (permissions, privileges,
groups etc..).

The code below works fine to logon to windows, but I need to check whether a user is part of a particular group? CAn anyone shed any light into the matter.

int AttemptLogon()
{
HANDLE hUser;
TOKEN_STATISTICS TStats;
TOKEN_GROUPS * pGroups;
PSID pLogonSid;
PLUID pLogonId;
HANDLE hUserToken;
DWORD size;
MiniAccount stAccount;

pLogonId = new LUID;
pLogonSid = new SID;

strcpy(stAccount.szUsername, "eric");
strcpy(stAccount.szDomain, "cognitronics");
strcpy(stAccount.szPassword, "");

if (LogonUser( (LPTSTR)stAccount.szUsername,
(LPTSTR)stAccount.szDomain,
(LPTSTR)stAccount.szPassword,
LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT,
&hUser))
{
hUserToken = hUser;

//
// Now, grovel the token we got back for interesting

stuff:
//

GetTokenInformation(hUser,
TokenStatistics,
&TStats,
sizeof(TStats),
&size);

*pLogonId = TStats.AuthenticationId;

pGroups = (TOKEN_GROUPS*)LocalAlloc(LMEM_FIXED, 1024);

if (!pGroups)
{
CloseHandle(hUser);
return(WLX_SAS_ACTION_NONE);
}

//
// The tricky part. We need to get the Logon SID from

the token,
// since that is what Winlogon will use to protect the

windowstation
// and desktop.
//

GetTokenInformation(hUser,
TokenGroups,
pGroups,
1024,
&size);

if (size > 1024)
{
pGroups = (TOKEN_GROUPS*)LocalReAlloc(pGroups,

LMEM_FIXED, size);
GetTokenInformation(hUser,
TokenGroups,
pGroups,
size,
&size);
}

int n = pGroups->GroupCount;
for (int i = 0; i < pGroups->GroupCount ; i++)
{
if ((pGroups->Groups[i].Attributes &

SE_GROUP_LOGON_ID) == SE_GROUP_LOGON_ID)
{
CopySid(GetLengthSid(pLogonSid),
pLogonSid,
pGroups->Groups[i].Sid );
break;
}
}

LocalFree(pGroups);

return(WLX_SAS_ACTION_LOGON);
}

delete pLogonId;
delete pLogonSid;

int nLastError = GetLastError();

return(WLX_SAS_ACTION_NONE);
}

Does anyone have any ideas or sample source code.
Thankyou for your timeSmile | :)


Rich
GeneralRe: Group Members and Logon Pin
imran_rafique22-Nov-02 5:40
imran_rafique22-Nov-02 5:40 
GeneralRe: Group Members and Logon Pin
Anders Molin22-Nov-02 10:11
professionalAnders Molin22-Nov-02 10:11 
Questionplz see code and solve my problem? Pin
imran_rafique22-Nov-02 5:05
imran_rafique22-Nov-02 5:05 
AnswerRe: plz see code and solve my problem? Pin
Daniel Turini22-Nov-02 5:16
Daniel Turini22-Nov-02 5:16 
AnswerRe: plz see code and solve my problem? Pin
Joan M22-Nov-02 6:37
professionalJoan M22-Nov-02 6:37 
GeneralVS6 IDE "hangs" Pin
Nitron22-Nov-02 4:27
Nitron22-Nov-02 4:27 
GeneralRe: VS6 IDE "hangs" Pin
Michael P Butler22-Nov-02 4:41
Michael P Butler22-Nov-02 4:41 
GeneralRe: VS6 IDE "hangs" Pin
Nitron22-Nov-02 4:51
Nitron22-Nov-02 4:51 
GeneralRe: VS6 IDE "hangs" Pin
Michael P Butler22-Nov-02 5:02
Michael P Butler22-Nov-02 5:02 
GeneralInvalid floating operation Pin
Patje22-Nov-02 4:19
Patje22-Nov-02 4:19 
QuestionExcel grids? Pin
-Dy22-Nov-02 4:10
-Dy22-Nov-02 4:10 
AnswerRe: Excel grids? Pin
Nitron22-Nov-02 4:59
Nitron22-Nov-02 4:59 
GeneralRe: Excel grids? Pin
-Dy22-Nov-02 5:06
-Dy22-Nov-02 5:06 
GeneralRe: Excel grids? Pin
Nitron22-Nov-02 5:13
Nitron22-Nov-02 5:13 
AnswerRe: Excel grids? Pin
Obliterator22-Nov-02 7:21
Obliterator22-Nov-02 7:21 
Generaladd some color to propertysheet Pin
Deepti22-Nov-02 3:46
Deepti22-Nov-02 3:46 
GeneralSetForegroundWindow.... Pin
Neha22-Nov-02 2:56
Neha22-Nov-02 2:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.