Subversion Repositories Aucun

Compare Revisions

Ignore whitespace Rev 223 → Rev 224

/branches/selfserve/common/Trace.c
125,3 → 125,4
Trace(eERROR, file, function, line, L"0x%08X: %s", dw, lpMsgBuf);
LocalFree(lpMsgBuf);
}
 
/branches/selfserve/client-debug.cmd
1,0 → 0,0
@start "" windbg -v -n -k com:pipe,port=\\.\pipe\com_1,reconnect -srcpath SRV*;"%~dp0" -y c:\windows\system32;c:\windows\symbols;%~dp0Debug
@echo start "" windbg -v -n -k com:pipe,port=\\.\pipe\com_1,reconnect -srcpath SRV*;"%~dp0" -y c:\windows\system32;c:\windows\symbols;%~dp0Debug
/branches/selfserve/GINA/SecurityHelper.cpp
554,47 → 554,48
wchar_t mutable_password[LM20_PWLEN];
wcsncpy_s(mutable_password, LM20_PWLEN, randpasswd, _TRUNCATE);
ui.usri1003_password = mutable_password;
DWORD error_index = 0;
 
NET_API_STATUS apistatus;
 
apistatus = NetUserSetInfo(0, username, 1003, (LPBYTE)&ui, 0);
apistatus = NetUserSetInfo(0, username, 1003, (LPBYTE)&ui, &error_index);
 
switch(apistatus)
{
case ERROR_ACCESS_DENIED:
TRACE(eERROR, L"The user does not have access to the requested information. (%d)\n", apistatus);
TRACE(eERROR, L"The user does not have access to the requested information. (%d, %d)\n", apistatus, error_index);
break;
 
case ERROR_INVALID_PARAMETER:
TRACE(eERROR, L"One of the function parameters is invalid. For more information, see the following Remarks section. (%d)\n", apistatus);
TRACE(eERROR, L"One of the function parameters is invalid. For more information, see the following Remarks section. (%d, %d)\n", apistatus, error_index);
break;
 
case NERR_InvalidComputer:
TRACE(eERROR, L"The computer name is invalid. (%d)\n", apistatus);
TRACE(eERROR, L"The computer name is invalid. (%d, %d)\n", apistatus, error_index);
break;
 
case NERR_NotPrimary:
TRACE(eERROR, L"The operation is allowed only on the primary domain controller of the domain. (%d)\n", apistatus);
TRACE(eERROR, L"The operation is allowed only on the primary domain controller of the domain. (%d, %d)\n", apistatus, error_index);
break;
 
case NERR_SpeGroupOp:
TRACE(eERROR, L"The operation is not allowed on specified special groups, which are user groups, admin groups, local groups, or guest groups. (%d)\n", apistatus);
TRACE(eERROR, L"The operation is not allowed on specified special groups, which are user groups, admin groups, local groups, or guest groups. (%d, %d)\n", apistatus, error_index);
break;
 
case NERR_LastAdmin:
TRACE(eERROR, L"The operation is not allowed on the last administrative account. (%d)\n", apistatus);
TRACE(eERROR, L"The operation is not allowed on the last administrative account. (%d, %d)\n", apistatus, error_index);
break;
 
case NERR_BadPassword:
TRACE(eERROR, L"The share name or password is invalid. (%d)\n", apistatus);
TRACE(eERROR, L"The share name or password is invalid. (%d, %d)\n", apistatus, error_index);
break;
 
case NERR_PasswordTooShort:
TRACE(eERROR, L"The password is shorter than required. (The password could also be too long, be too recent in its change history, not have enough unique characters, or not meet another password policy requirement.) (%d)\n", apistatus);
TRACE(eERROR, L"The password is shorter than required. (The password could also be too long, be too recent in its change history, not have enough unique characters, or not meet another password policy requirement.) (%d, %d)\n", apistatus, error_index);
break;
 
case NERR_UserNotFound:
TRACE(eERROR, L"The user name could not be found. (%d)\n", apistatus);
TRACE(eERROR, L"The user name could not be found. (%d, %d)\n", apistatus, error_index);
break;
 
case NERR_Success:
/branches/selfserve/GINA/loggedout_dlg.cpp
37,8 → 37,8
#define _SECURE_ATL 1
 
#include <atlbase.h>
#include "atlapp.h"
#include "atlctrls.h"
#include <atlapp.h>
#include <atlctrls.h>
#include "StaticPrompt.h"
 
#include "randpasswd.h"
258,7 → 258,7
} else {
ShowWindow(GetDlgItem(hwndDlg, 1502), SW_SHOW); //Username
ShowWindow(GetDlgItem(hwndDlg, 1503), SW_SHOW); //Password
//TODO : Maybe the domain was not there to begin with
//Maybe the domain was not there to begin with
if(domain_was_present)
ShowWindow(GetDlgItem(hwndDlg, 1504), SW_SHOW); //Domain
}
/branches/selfserve/GINA/StaticPrompt.cpp
0,0 → 1,182
#include <atlbase.h>
#include <atlapp.h>
#include <atlctrls.h>
 
#include "StaticPrompt.h"
 
template< class T, class TBase, class TWinTraits >
CStaticPromptImpl<T, TBase, TWinTraits>::CStaticPromptImpl()
: m_margin(DEFAULT_MARGIN_PIXEL)
, m_hand(0)
{
}
 
// Operations
template< class T, class TBase = CStatic, class TWinTraits >
BOOL CStaticPromptImpl<T, TBase, TWinTraits>::SubclassWindow(HWND hWnd)
{
ATLASSERT(m_hWnd == NULL);
ATLASSERT(::IsWindow(hWnd));
BOOL bRet = CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd);
 
if (bRet)
{
_Init();
}
 
return bRet;
}
 
// Implementation
void CStaticPromptImpl::_Init()
{
ATLASSERT(::IsWindow(m_hWnd));
// Check if we should paint a label
TCHAR lpszBuffer[10] = { 0 };
 
if (::GetClassName(m_hWnd, lpszBuffer, 9))
{
if (::lstrcmpi(lpszBuffer, TBase::GetWndClassName()) == 0)
{
ModifyStyle(0, SS_NOTIFY); // We need this
DWORD dwStyle = GetStyle() & 0x000000FF;
 
if (dwStyle == SS_ICON || dwStyle == SS_BLACKRECT || dwStyle == SS_GRAYRECT ||
dwStyle == SS_WHITERECT || dwStyle == SS_BLACKFRAME || dwStyle == SS_GRAYFRAME ||
dwStyle == SS_WHITEFRAME || dwStyle == SS_OWNERDRAW ||
dwStyle == SS_BITMAP || dwStyle == SS_ENHMETAFILE)
{
ATLASSERT("Invalid static style for gradient label" == NULL);
}
 
SetClassLong(*this, GCL_HCURSOR, (LONG)LoadCursor(0, IDC_HAND));
}
}
 
// Set font
CWindow wnd = GetParent();
CFontHandle font = wnd.GetFont();
 
if( !font.IsNull() )
{
SetFont(font);
}
}
 
//Returns the amount of space not covered by text, in pixels
int CStaticPromptImpl::TotalPadding()
{
// Let the compiler optimise this. The 0 is the widht of the text,
// the rest is taken up by margins and the icon
return m_margin + DEFAULT_ICON_SIZE + m_margin + 0 + m_margin;
}
 
//Return the static control height that can hold all the text
int CStaticPromptImpl::ComputeRequiredHeight(int margin = -1)
{
if(margin < 0)
{
margin = m_margin;
}
 
wchar_t prompt[2048];
RECT rect;
GetClientRect(&rect);
// Let the compiler optimise this. The 0 is the widht of the text,
// the rest is taken up by margins and the icon
rect.left = TotalPadding();
GetWindowText(prompt, sizeof prompt / sizeof * prompt);
CPaintDC dc(*this);
// Set font
CWindow wnd = GetParent();
CFontHandle font = wnd.GetFont();
 
if( !font.IsNull())
{
dc.SelectFont(font);
}
 
dc.DrawText(prompt, -1, &rect, DT_CALCRECT | DT_WORDBREAK); //Compute the height
//Room for the text and a top and bottom margin
return max(rect.bottom - rect.top, DEFAULT_ICON_SIZE) + 2 * margin;
}
 
LRESULT CStaticPromptImpl::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
_Init();
return 0;
}
LRESULT CStaticPromptImpl::OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
return 1; // We're painting it all
}
 
LRESULT CStaticPromptImpl::OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
T* pT = static_cast<T*>(this);
 
if (wParam != NULL)
{
pT->DoPaint((HDC) wParam);
}
else
{
CPaintDC dc(m_hWnd);
pT->DoPaint((HDC) dc);
}
 
return 0;
}
 
// Paint methods
void CStaticPromptImpl::DoPaint(CDCHandle dc)
{
RECT rcClient;
GetClientRect(&rcClient);
//Tooltip color background
dc.FillRect(&rcClient, GetSysColorBrush(COLOR_INFOBK));
HICON question = (HICON)LoadImage(0, IDI_QUESTION, IMAGE_ICON, DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE, LR_SHARED);
dc.DrawIconEx(m_margin, m_margin, question, DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE, DI_NORMAL);
rcClient.left = TotalPadding() - m_margin;
rcClient.right -= m_margin;
rcClient.bottom -= m_margin;
rcClient.top = m_margin;
dc.SetBkMode(TRANSPARENT);
dc.SetTextColor(GetSysColor(COLOR_INFOTEXT));
HFONT hOldFont = dc.SelectFont(GetFont());
int nLen = GetWindowTextLength();
 
if (nLen > 0)
{
LPTSTR lpszText = (LPTSTR) _alloca((nLen + 1) * sizeof(TCHAR));
 
if (GetWindowText(lpszText, nLen + 1))
{
DWORD dwStyle = GetStyle();
int nDrawStyle = DT_LEFT;
 
if (dwStyle & SS_CENTER)
{
nDrawStyle = DT_CENTER;
}
else if (dwStyle & SS_RIGHT)
{
nDrawStyle = DT_RIGHT;
}
 
if (dwStyle & SS_SIMPLE)
{
nDrawStyle = DT_VCENTER | DT_SINGLELINE;
}
 
dc.DrawText(lpszText, -1, &rcClient, nDrawStyle | DT_WORDBREAK);
}
}
 
GetClientRect(&rcClient);
dc.FrameRect(&rcClient, GetSysColorBrush(COLOR_3DSHADOW));
dc.SelectFont(hOldFont);
}
 
 
 
/branches/selfserve/GINA/GinaHook.c
300,7 → 300,7
 
TRACE(eDEBUG, L"WlxNegotiate\n");
 
//SAFEDEBUGBREAK();
SAFEDEBUGBREAK();
 
//
// Load MSGINA.DLL.