Click here to Skip to main content
15,886,919 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: what about x = x++; ? Pin
pesho293219-Sep-05 5:38
pesho293219-Sep-05 5:38 
GeneralRe: what about x = x++; ? Pin
bugDanny19-Sep-05 7:43
bugDanny19-Sep-05 7:43 
GeneralRe: what about x = x++; ? Pin
pesho293219-Sep-05 21:14
pesho293219-Sep-05 21:14 
GeneralRe: what about x = x++; ? Pin
bugDanny20-Sep-05 3:16
bugDanny20-Sep-05 3:16 
GeneralRe: what about x = x++; ? Pin
pesho293220-Sep-05 4:52
pesho293220-Sep-05 4:52 
GeneralRe: what about x = x++; ? [Modified 2005-09-19] Pin
Maxwell Chen15-Sep-05 21:17
Maxwell Chen15-Sep-05 21:17 
GeneralRe: what about x = x++; ? Pin
bugDanny16-Sep-05 3:21
bugDanny16-Sep-05 3:21 
QuestionVC++6.0 - Finding users privileges Pin
Rainos15-Sep-05 4:48
Rainos15-Sep-05 4:48 
Dear fellow coders,

Im just trying to establish if the current user has the privileges to stop/start services.
Im trying to link some example code from the MDSN website into my visual C++ 6.0 project
and i get the following error. can you help?

Linking...
OLMECDlg.obj : error LNK2001: unresolved external symbol "int __cdecl
CheckTokenMembership(void *,void *,int *)"
(?CheckTokenMembership@@YAHPAX0PAH@Z)
Debug/OLMEC.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

the example code i was using was as follows:


#include <winbase.h>
#include <windows.h>

extern BOOL CheckTokenMembership(HANDLE TokenHandle,PSID SidToCheck,PBOOL
IsMember);


/*++
Routine Description: This routine returns TRUE if the caller's process
is a member of the Administrators local group. Caller is NOT expected
to be impersonating anyone and is expected to be able to open its own
process and process token.
Arguments: None.
Return Value:
TRUE - Caller has Administrators local group.
FALSE - Caller does not have Administrators local group. --
*/
BOOL COLMECDlg::IsUserAdmin(VOID)
{
BOOL b;
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
PSID AdministratorsGroup;

b = AllocateAndInitializeSid(
&NtAuthority,
2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&AdministratorsGroup);

if(b)
{
if (!CheckTokenMembership( NULL, AdministratorsGroup, &b))
{
b = FALSE;
}
FreeSid(AdministratorsGroup);
}

return(b);
}



Please note that I have also setup my linker to include advapi32.lib but
this still fails. What am i doing wrong or is there a mistake on the MSDN
webpage?
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/s
ecurity/checktokenmembership.asp)

Im just trying to establish if the current user has the privileges to stop/start services.
Has anyone done this before, or know how to do it in VC6.0 ?


thanks,
Paul
AnswerRe: VC++6.0 - Finding users privileges Pin
David Crow15-Sep-05 7:32
David Crow15-Sep-05 7:32 
GeneralRe: VC++6.0 - Finding users privileges Pin
Rainos15-Sep-05 21:49
Rainos15-Sep-05 21:49 
GeneralRe: VC++6.0 - Finding users privileges Pin
David Crow16-Sep-05 2:11
David Crow16-Sep-05 2:11 
GeneralRe: VC++6.0 - Finding users privileges Pin
Rainos16-Sep-05 2:49
Rainos16-Sep-05 2:49 
GeneralRe: VC++6.0 - Finding users privileges Pin
David Crow16-Sep-05 4:59
David Crow16-Sep-05 4:59 
GeneralRe: VC++6.0 - Finding users privileges Pin
Rainos16-Sep-05 5:42
Rainos16-Sep-05 5:42 
GeneralRe: VC++6.0 - Finding users privileges Pin
David Crow16-Sep-05 5:48
David Crow16-Sep-05 5:48 
QuestionCTabCtrl Background in XP Themed Pin
RickyC15-Sep-05 4:15
RickyC15-Sep-05 4:15 
AnswerRe: CTabCtrl Background in XP Themed Pin
Ravi Bhavnani15-Sep-05 8:07
professionalRavi Bhavnani15-Sep-05 8:07 
GeneralRe: CTabCtrl Background in XP Themed Pin
RickyC15-Sep-05 9:39
RickyC15-Sep-05 9:39 
GeneralRe: CTabCtrl Background in XP Themed Pin
Ravi Bhavnani15-Sep-05 9:44
professionalRavi Bhavnani15-Sep-05 9:44 
GeneralRe: CTabCtrl Background in XP Themed Pin
RickyC16-Sep-05 1:39
RickyC16-Sep-05 1:39 
GeneralRe: CTabCtrl Background in XP Themed Pin
Ravi Bhavnani16-Sep-05 2:14
professionalRavi Bhavnani16-Sep-05 2:14 
QuestionExtending Command Routing Pin
Joel Holdsworth15-Sep-05 4:03
Joel Holdsworth15-Sep-05 4:03 
AnswerRe: Extending Command Routing Pin
Taka Muraoka15-Sep-05 7:36
Taka Muraoka15-Sep-05 7:36 
GeneralRe: Extending Command Routing Pin
Joel Holdsworth15-Sep-05 21:36
Joel Holdsworth15-Sep-05 21:36 
QuestionAdding a new search function to the explorer Pin
chrisbk215-Sep-05 3:23
chrisbk215-Sep-05 3:23 

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.