Click here to Skip to main content
15,894,410 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionProblem with CString Pin
rajeevktripathi15-Sep-05 2:24
rajeevktripathi15-Sep-05 2:24 
AnswerRe: Problem with CString Pin
ThatsAlok15-Sep-05 2:44
ThatsAlok15-Sep-05 2:44 
AnswerRe: Problem with CString Pin
22491715-Sep-05 2:56
22491715-Sep-05 2:56 
AnswerRe: Problem with CString Pin
MailtoGops15-Sep-05 2:58
MailtoGops15-Sep-05 2:58 
QuestionAfx Message Handling in CStatic as Child-Window Pin
_NielsB15-Sep-05 2:19
_NielsB15-Sep-05 2:19 
QuestionRe: Afx Message Handling in CStatic as Child-Window Pin
Maximilien15-Sep-05 2:28
Maximilien15-Sep-05 2:28 
AnswerRe: Afx Message Handling in CStatic as Child-Window Pin
khan++15-Sep-05 2:34
khan++15-Sep-05 2:34 
GeneralRe: Afx Message Handling in CStatic as Child-Window Pin
_NielsB15-Sep-05 2:47
_NielsB15-Sep-05 2:47 
Questionhelp for VOIP Pin
vikas amin15-Sep-05 2:13
vikas amin15-Sep-05 2:13 
QuestionAbout Bitmaps: Plz Help Pin
parims15-Sep-05 2:07
parims15-Sep-05 2:07 
AnswerRe: About Bitmaps: Plz Help Pin
Cool Ju15-Sep-05 2:43
Cool Ju15-Sep-05 2:43 
Questionpreview and print access 2000 reports from a visual c++ application Pin
Hervy15-Sep-05 2:00
Hervy15-Sep-05 2:00 
QuestionAbout Cursor blinking : Plz Help Pin
parims15-Sep-05 1:29
parims15-Sep-05 1:29 
AnswerRe: About Cursor blinking : Plz Help Pin
khan++15-Sep-05 1:44
khan++15-Sep-05 1:44 
QuestionCToolBar Question Pin
Joel Holdsworth15-Sep-05 1:16
Joel Holdsworth15-Sep-05 1:16 
QuestionDebug assertion failed Pin
Hervy15-Sep-05 0:47
Hervy15-Sep-05 0:47 
GeneralRe: Debug assertion failed Pin
prasad_som15-Sep-05 1:01
prasad_som15-Sep-05 1:01 
AnswerRe: Debug assertion failed Pin
Bob Stanneveld15-Sep-05 1:01
Bob Stanneveld15-Sep-05 1:01 
AnswerRe: Debug assertion failed Pin
Zdeslav Vojkovic15-Sep-05 2:39
Zdeslav Vojkovic15-Sep-05 2:39 
AnswerRe: Debug assertion failed Pin
David Crow15-Sep-05 7:38
David Crow15-Sep-05 7:38 
QuestionUsing Crystal Report in VC++6.0 Pin
cofd15-Sep-05 0:38
cofd15-Sep-05 0:38 
GeneralRe: Using Crystal Report in VC++6.0 Pin
prasad_som15-Sep-05 3:14
prasad_som15-Sep-05 3:14 
QuestionLinking advapi32.lib Pin
Rainos15-Sep-05 0:36
Rainos15-Sep-05 0:36 
Dear fellow software engineers,

Im trying to link some example code from the MDSN website into my visual C++ 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
#include

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)

Has anyone used this function before,Can anyone help?


thanks,
Rainos
AnswerRe: Linking advapi32.lib Pin
prasad_som15-Sep-05 1:56
prasad_som15-Sep-05 1:56 
AnswerRe: Linking advapi32.lib Pin
Blake Miller15-Sep-05 4:34
Blake Miller15-Sep-05 4:34 

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.