Thread: syntax error before '.' token

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    8

    Thumbs down syntax error before '.' token

    this is probably going to be a easy one for u all but i dont get it..
    why wont this code compile ?? do i need to include a .lib ?


    #include <windows.h>

    Code:
    BOOL fResult;

    HANDLE hToken;
    TOKEN_PRIVILEGES tkp;


    int APIENTRY WinMain(HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow)
    {



    if (!OpenProcessToken(GetCurrentProcess(),
    TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
    MessageBox(NULL,NULL,"OpenProcessToken failed.", MB_OK | MB_ICONINFORMATION);



    LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
    &tkp.Privileges[0].Luid);

    tkp.PrivilegeCount = 1;
    tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;



    AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
    (PTOKEN_PRIVILEGES) NULL, 0);



    if (GetLastError() != ERROR_SUCCESS)
    MessageBox(NULL,NULL,"AdjustTokenPrivileges enable failed.",MB_OK | MB_ICONINFORMATION);



    fResult = InitiateSystemShutdown(
    NULL,
    "Click on the main window and press the Escape key to cancel shutdown.",
    3,
    TRUE,
    TRUE);

    if (!fResult)
    {
    MessageBox(NULL,NULL,"InitiateSystemShutdown failed.",MB_OK | MB_ICONINFORMATION);
    }


    tkp.Privileges[0].Attributes = 0;
    AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
    (PTOKEN_PRIVILEGES) NULL, 0);

    if (GetLastError() != ERROR_SUCCESS)
    {
    MessageBox(NULL,NULL,"AdjustTokenPrivileges disable failed.",MB_OK | MB_ICONINFORMATION);
    }

    return 0;
    }

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    1) use code tags
    2) what line is the error on?

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    8
    sorry to bother u all with this, stupid stupid problem the error was on the second line on code :
    cuz it came out of the tutorial... (should had been //code: or something)
    sorry again..

  4. #4
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    *snip*
    Nevermind, you fixed it
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM