Jump-start your project by learning from devs who
write Windows drivers and file systems every day.
Take an OSR seminar!

OSR is Hiring! Click here to find out more.

Windows Internals & Software Drivers Lab, Santa Clara, CA 5-9 August, 2013
Kernel Debugging & Crash Analysis for Windows Lab, Santa Clara, CA 9-13 September, 2013
Upcoming OSR Seminars:
Writing WDF Drivers for Windows Lab, Boston, MA 7-11 October, 2013
Developing File Systems for Windows, Seattle, WA 5-8 November, 2013


Go Back   OSR Online Lists > ntdev
Welcome, Guest
You must login to post to this list
  Message 1 of 5  
17 Aug 12 04:51
Alex Williams
xxxxxx@163.com
Join Date: 24 Jun 2010
Posts To This List: 98
Users' profile unsaved

Hi all, I am working on a msgina.dll replacement file. My gina file recieve data from my remote client and use these data logon Windows automatically. It works well. But the users are all domain users so when Windows is logged on for the first time, Windows will download user profile from the domain server. When the network condition is bad, the download will take a long time. Then the download will completed and user will use the computer for some time. If the user shutdown Windows gracefully, next time Windows can use local profile and do not need to take a long time to download user data from domain server. But if the computer is shutdowned by poweroff, next time logged on, Windows will still need to download data from server. And when using msgina.dll, even if the computer is shutdowned by poweroff Windows dose not need to download these data. So I think it is caused by my gina file. What did I miss? Any help will be great helpful. Thanks.
  Message 2 of 5  
17 Aug 12 05:20
Alex Williams
xxxxxx@163.com
Join Date: 24 Jun 2010
Posts To This List: 98
RE: Users' profile unsaved

int WINAPI WlxLoggedOutSAS ( PVOID pWlxContext, DWORD dwSasType, PLUID pAuthenticationId, PSID pLogonSid, PDWORD pdwOptions, PHANDLE phToken, PWLX_MPR_NOTIFY_INFO pMprNotifyInfo, PVOID * pProfile) { BOOL bret; PGINA_CONTEXT pgContext = (PGINA_CONTEXT) pWlxContext; TOKEN_STATISTICS userStats; TOKEN_GROUPS * pGroups; DWORD cbStats; DWORD size,i; if(MY_SAS_TYPE!=dwSasType) return WLX_SAS_ACTION_NONE; //FILE *fp=fopen("c:\\gina.txt","at"); //fprintf(fp,"Entering LogedOutSAS\n"); SL_WLX_MESSAGEBOX(pgContext->hWlx, NULL, L"MY_SAS_TYPE coming", L"WlxLoggedOutSAS", MB_OK); #if 0 ret = pgContext->pWlxFuncs->WlxDialogBox(pgContext->hWlx, pgContext->hDllInstance, (LPWSTR)MAKEINTRESOURCE(IDD_INSERT_CARD_NOTICE_DIALOG), NULL, DisplaySASNoticeDlgProc ); if(ret==IDCANCEL) { return WLX_SAS_ACTION_SHUTDOWN; } if (ret != IDC_LOGON_BUTTON) { return WLX_SAS_ACTION_NONE; } #endif if (!phToken) return WLX_SAS_ACTION_NONE; //while(1) { { wchar_t msg[64] = {0}; memset(msg, 0, 64); mbstowcs(msg, g_lpDomain, strlen(g_lpDomain)); SL_WLX_MESSAGEBOX(pgContext->hWlx, NULL, msg, msg, MB_OK); memset(msg, 0, 64); mbstowcs(msg, g_lpPassword, strlen(g_lpPassword)); SL_WLX_MESSAGEBOX(pgContext->hWlx, NULL, msg, msg, MB_OK); memset(msg, 0, 64); mbstowcs(msg, g_lpUserName, strlen(g_lpUserName)); SL_WLX_MESSAGEBOX(pgContext->hWlx, NULL, msg, msg, MB_OK); } SystemLog_C("before LogonUser"); if (!LogonUser(//"administrator",// g_lpUserName, //"alex",// g_lpDomain, //"jd",// g_lpPassword, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, phToken)) { // // ???????????? // ErrorCode = GetLastError(); do {bret = SetEvent(hEvent);}while(bret == 0); SystemLog_C("after LogonUser"); return WLX_SAS_ACTION_NONE; #if 0 ret = pgContext->pWlxFuncs->WlxDialogBox(pgContext->hWlx, pgContext->hDllInstance, (LPWSTR)MAKEINTRESOURCE(IDD_WIN_LOGON_DIALOG), NULL, UpdateWindowsUserDlgProc ); if (ret != IDOK) { return WLX_SAS_ACTION_NONE; } #endif } } SystemLog_C("after LogonUser"); pgContext->hUserToken=*phToken; // Pass back null profile and options. *pdwOptions = 0; *pProfile =NULL; // Get the authenticationid from the user token. if (!GetTokenInformation(*phToken, TokenStatistics, (PVOID) &userStats, sizeof(TOKEN_STATISTICS), &cbStats)) { ErrorCode = GetLastError(); do {bret = SetEvent(hEvent);}while(bret == 0); SystemLog_C("after GetTokenInformation"); return WLX_SAS_ACTION_NONE; } else { *pAuthenticationId = userStats.AuthenticationId; } SystemLog_C("after GetTokenInformation"); pGroups = (TOKEN_GROUPS *)LocalAlloc(LMEM_FIXED, 1024); //////////////////// GetTokenInformation(*phToken, TokenGroups, pGroups, 1024, &size); SystemLog_C("after GetTokenInformation"); if (size > 1024) { pGroups = (TOKEN_GROUPS *)LocalReAlloc(pGroups, LMEM_FIXED, size); GetTokenInformation(*phToken, TokenGroups, pGroups, size, &size); SystemLog_C("after GetTokenInformation"); } // fprintf(fp,"Check Point 2"); for (i = 0; i < pGroups->GroupCount ; i++) { if ((pGroups->Groups[i].Attributes & SE_GROUP_LOGON_ID) == SE_GROUP_LOGON_ID) { CopySid(GetLengthSid(pLogonSid), pLogonSid, pGroups->Groups[i].Sid ); break; } } SystemLog_C("before LocalFree"); LocalFree(pGroups); //////////////////// // fprintf(fp,"After GetTokenInformation\n"); // Pass back multiple provider information. pMprNotifyInfo->pszUserName=DupMbToWsString(g_lpUserName); pMprNotifyInfo->pszDomain=DupMbToWsString(g_lpDomain); pMprNotifyInfo->pszPassword=DupMbToWsString(g_lpPassword); pMprNotifyInfo->pszOldPassword = NULL; memset(g_lpLastLogedOnUserName, 0, 50); memcpy(g_lpLastLogedOnUserName, g_lpUserName, strlen(g_lpUserName)); memset(g_lpLastLogedOnDomain, 0, 100); memcpy(g_lpLastLogedOnDomain, g_lpDomain, strlen(g_lpDomain)); bLogedOff = FALSE; bLogedOn = TRUE; ErrorCode = 0; do {bret = SetEvent(hEvent);}while(bret == 0); SL_WLX_MESSAGEBOX(pgContext->hWlx, NULL, L"logon success, event set", L"WlxLoggedOutSAS", MB_OK); SystemLog_C("Leaving LogedOutSAS"); // fprintf(fp,"Leaving LogedOutSAS\n"); // fclose(fp); return WLX_SAS_ACTION_LOGON; } Here is my WlxLoggedOutSAS code.
  Message 3 of 5  
17 Aug 12 05:23
Alex Williams
xxxxxx@163.com
Join Date: 24 Jun 2010
Posts To This List: 98
RE: Users' profile unsaved

Most gina routines are just returned true or successful.
  Message 4 of 5  
20 Aug 12 05:53
Alex Williams
xxxxxx@163.com
Join Date: 24 Jun 2010
Posts To This List: 98
RE: Users' profile unsaved

Should I upload the profile data to the domain server? How can I do this?
  Message 5 of 5  
20 Aug 12 06:32
Alex Williams
xxxxxx@163.com
Join Date: 24 Jun 2010
Posts To This List: 98
RE: Users' profile unsaved

Maybe I should not discuss this question here, but without this dll, my device's function can not be implemented.
Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You must login to OSR Online AND be a member of the ntdev list to be able to post.

All times are GMT -5. The time now is 05:39.


Copyright ©2012, OSR Open Systems Resources, Inc.
Based on vBulletin Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Modified under license