Click here to Skip to main content
15,895,011 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Adobe Acrobat ActiveX Control Pin
Paul Selormey12-May-03 4:27
Paul Selormey12-May-03 4:27 
GeneralRe: Adobe Acrobat ActiveX Control Pin
Poul Haahr Klemmensen12-May-03 20:27
Poul Haahr Klemmensen12-May-03 20:27 
GeneralRe: Adobe Acrobat ActiveX Control Pin
Paul Selormey12-May-03 20:42
Paul Selormey12-May-03 20:42 
GeneralUploading file thru WININET Pin
Tili12-May-03 2:12
Tili12-May-03 2:12 
GeneralRe: Uploading file thru WININET Pin
Asmenok30-Sep-03 3:16
Asmenok30-Sep-03 3:16 
General3d game.. like DOOM for console:) Pin
Member 25795612-May-03 2:12
Member 25795612-May-03 2:12 
QuestionHow to knew that a NT/2000 User has logon on? Pin
GooBears12-May-03 2:09
GooBears12-May-03 2:09 
AnswerRe: How to knew that a NT/2000 User has logon on? Pin
Maxwell Chen13-May-03 1:19
Maxwell Chen13-May-03 1:19 
Here it is...

<br />
// The following constant may be defined by including NtStatus.h.<br />
#define STATUS_SUCCESS  ((NTSTATUS)0x00000000L)<br />
// The LSA authentication functions are available in unicode only.<br />
#define UNICODE<br />
<br />
VOID GetSessionData (PLUID session)<br />
{<br />
  PSECURITY_LOGON_SESSION_DATA sessionData = NULL;<br />
  NTSTATUS retval;<br />
  WCHAR buffer[256];<br />
  WCHAR *usBuffer;<br />
  int usLength;<br />
<br />
  // Check for a valid session.<br />
  if (!session ) {<br />
    wprintf(L"Error - Invalid logon session identifier.\n");<br />
    return;<br />
  }<br />
  //Get the session information.<br />
  retval = LsaGetLogonSessionData (session, &sessionData);<br />
  if (retval != STATUS_SUCCESS) {<br />
    // An error occurred. Tell the world.<br />
    wprintf (L"LsaGetLogonSessionData failed %lu \n",<br />
      LsaNtStatusToWinError(retval));<br />
    // If session information was returned, free it.<br />
    if (sessionData) {<br />
      LsaFreeReturnBuffer(sessionData);<br />
    }<br />
    return;<br />
  } <br />
  // Check that there is sesssion data to parse. <br />
  if (!sessionData) { // No data for session.<br />
    wprintf(L"Invalid logon session data. \n");<br />
    LsaFreeReturnBuffer(sessionData);<br />
    return;<br />
  }<br />
  if (sessionData->UserName.Buffer != NULL) {<br />
    // Get the user name.<br />
    usBuffer = (sessionData->UserName).Buffer;<br />
    usLength = (sessionData->UserName).Length;<br />
    lstrcpyn (buffer, usBuffer, usLength);<br />
    lstrcat (buffer,L"");<br />
    wprintf (L"user %s was authenticated ",buffer);<br />
  } else {<br />
    wprintf (L"\nMissing user name.\n");<br />
    LsaFreeReturnBuffer(sessionData);<br />
    return;<br />
  }<br />
  if ((SECURITY_LOGON_TYPE) sessionData->LogonType == Interactive) {<br />
    wprintf(L"interactively ");<br />
  }<br />
  if (sessionData->AuthenticationPackage.Buffer != NULL) {<br />
    // Get the authentication package name.<br />
    usBuffer = (sessionData->AuthenticationPackage).Buffer;<br />
    usLength = (sessionData->AuthenticationPackage).Length;<br />
    lstrcpyn (buffer, usBuffer, usLength);<br />
    lstrcat (buffer,L"");<br />
    wprintf(L"using %s ",buffer);<br />
  } else {<br />
    wprintf (L"\nMissing authentication package.");<br />
    LsaFreeReturnBuffer(sessionData);<br />
    return;<br />
  }<br />
  if (sessionData->LogonDomain.Buffer != NULL) {<br />
    // Get the domain name.<br />
    usBuffer = (sessionData->LogonDomain).Buffer;<br />
    usLength = (sessionData->LogonDomain).Length;<br />
    lstrcpyn (buffer, usBuffer, usLength);<br />
    lstrcat (buffer,L"");<br />
    wprintf(L"in the %s domain.\n",buffer);<br />
  } else {<br />
    wprintf (L"\nMissing authenticating domain information. ");<br />
    LsaFreeReturnBuffer(sessionData);<br />
    return;<br />
  }<br />
  // Free the memory returned by the LSA.<br />
  LsaFreeReturnBuffer(sessionData);<br />
  return;<br />
}<br />


BuggyMax
QuestionWhere to Find MFC FAQ? Pin
Haja12-May-03 1:52
Haja12-May-03 1:52 
AnswerRe: Where to Find MFC FAQ? Pin
Kevin McFarlane12-May-03 1:58
Kevin McFarlane12-May-03 1:58 
GeneralRe: Where to Find MFC FAQ? Pin
GooBears12-May-03 2:06
GooBears12-May-03 2:06 
AnswerRe: Where to Find MFC FAQ? Pin
David Crow12-May-03 2:29
David Crow12-May-03 2:29 
GeneralClickety police ! Pin
Trollslayer12-May-03 2:56
mentorTrollslayer12-May-03 2:56 
GeneralBitmap Pin
midupk12-May-03 1:52
midupk12-May-03 1:52 
GeneralRe: Bitmap Pin
midupk12-May-03 1:53
midupk12-May-03 1:53 
Generaltext in video Pin
sharlila12-May-03 1:17
sharlila12-May-03 1:17 
GeneralButton with Bitmap Pin
Rage12-May-03 0:10
professionalRage12-May-03 0:10 
GeneralRe: Button with Bitmap Pin
macmac3812-May-03 0:18
macmac3812-May-03 0:18 
GeneralRe: Button with Bitmap Pin
Rage12-May-03 1:29
professionalRage12-May-03 1:29 
GeneralRe: Button with Bitmap Pin
Member 25795612-May-03 0:20
Member 25795612-May-03 0:20 
GeneralRe: Button with Bitmap Pin
Member 25795612-May-03 0:23
Member 25795612-May-03 0:23 
GeneralRe: Button with Bitmap Pin
David Crow12-May-03 2:34
David Crow12-May-03 2:34 
GeneralCFile trouble Pin
macmac3812-May-03 0:10
macmac3812-May-03 0:10 
GeneralRe: CFile trouble Pin
Hari Krishnan (Noida)12-May-03 0:39
Hari Krishnan (Noida)12-May-03 0:39 
GeneralRe: CFile trouble Pin
macmac3812-May-03 1:07
macmac3812-May-03 1:07 

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.