Thanks for your answer, Ninja. However I don't know if I could use it. I want to block users that have privileges as guest users, not only the name.
I've found out this code below:
Code:
using namespace System;
using namespace System::Security::Principal;

int main(int argc, char **argv)
{
    // Retrieve the Windows account token for the current user.
    IntPtr logonToken = WindowsIdentity::GetCurrent()->Token;

    // Construct a WindowsIdentity object using the input account token.
    WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken );
    // Verify that the user account is considered to be a Guest account
    // by the system.
    if ( windowsIdentity->IsGuest )
    {
       exit(1);
    }
}
However, I don't know how to add the Common Language Runtime Support (/clr) into QT Creator - the IDE I'm using, that manages the build scripts...


PS: also, I was getting a compiler error on Ninja's code (GetUserNameW: cannot convert parameter 1 from 'unsigned int' to 'LPWSTR')