-
- // VZ: why should it be so complicated??
-#if 0
- // Gets the current user's full name according to the MS article PSS ID
- // Number: Q119670
- // Seems to be the same as the login name for me?
- char *UserName = new char[256];
- char *Domain = new char[256];
- DWORD maxCharacters = 255;
- GetUserName( UserName, &maxCharacters );
- GetComputerName( Domain, &maxCharacters );
-
- WCHAR wszUserName[256]; // Unicode user name
- WCHAR wszDomain[256];
- LPBYTE ComputerName;
-
- struct _SERVER_INFO_100 *si100; // Server structure
- struct _USER_INFO_2 *ui; // User structure
-
- // Convert ASCII user name and domain to Unicode.
-
- MultiByteToWideChar( CP_ACP, 0, UserName,
- strlen(UserName)+1, wszUserName, sizeof(wszUserName) );
- MultiByteToWideChar( CP_ACP, 0, Domain,
- strlen(Domain)+1, wszDomain, sizeof(wszDomain) );
-
- // Get the computer name of a DC for the specified domain.
- // >If you get a link error on this, include netapi32.lib<
-
- NetGetDCName( NULL, wszDomain, &ComputerName );
-
- // Look up the user on the DC.
-
- if(NetUserGetInfo( (LPWSTR) ComputerName,
- (LPWSTR) &wszUserName, 2, (LPBYTE *) &ui))
- {
- printf( "Error getting user information.\n" );
- return( FALSE );
- }
-
- // Convert the Unicode full name to ASCII.
-
- WideCharToMultiByte( CP_ACP, 0, ui->usri2_full_name,
- -1, buf, 256, NULL, NULL );
- }
- return( TRUE );
-#else // 1