Changeset 1417


Ignore:
Timestamp:
Oct 23, 1999, 6:43:50 PM (26 years ago)
Author:
cbratschi
Message:

partial fix for NT's clock.exe: ChooseFont

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/comdlg32/comdlg32.cpp

    r1350 r1417  
    1 /* $Id: comdlg32.cpp,v 1.13 1999-10-18 11:59:04 sandervl Exp $ */
     1/* $Id: comdlg32.cpp,v 1.14 1999-10-23 16:43:50 cbratschi Exp $ */
    22
    33/*
     
    3737    a->lpfnHook = (c)Win32WindowProc::GetOS2Callback();\
    3838  } \
    39   a->hwndOwner = Win32ToOS2Handle(a->hwndOwner); 
     39  a->hwndOwner = Win32ToOS2Handle(a->hwndOwner);
    4040
    4141#define COMDLG32_CHECKHOOK2(a,b,c,d)        \
     
    4848    a->d = (c)Win32WindowProc::GetOS2Callback();\
    4949  } \
    50   a->hwndOwner = Win32ToOS2Handle(a->hwndOwner); 
     50  a->hwndOwner = Win32ToOS2Handle(a->hwndOwner);
    5151#else
    5252#define COMDLG32_CHECKHOOK(a,b,c)           \
     
    5555    a->lpfnHook = 0; \
    5656  } \
    57   a->hwndOwner = Win32ToOS2Handle(a->hwndOwner); 
     57  a->hwndOwner = Win32ToOS2Handle(a->hwndOwner);
    5858
    5959#define COMDLG32_CHECKHOOK2(a,b,c,d)        \
     
    6262    a->d = 0; \
    6363  } \
    64   a->hwndOwner = Win32ToOS2Handle(a->hwndOwner); 
     64  a->hwndOwner = Win32ToOS2Handle(a->hwndOwner);
    6565#endif
    6666/*****************************************************************************
     
    247247  // NOTE: LOGFONTW/A is NOT converted !
    248248  dprintf(("COMDLG32: ChooseFontW not correctly implemented.\n"));
     249
     250  if (!lpcf)
     251  {
     252    SetLastError(ERROR_INVALID_PARAMETER);
     253
     254    return FALSE;
     255  }
    249256
    250257  // convert to ASCII string
     
    265272      asciicf.lpTemplateName = UnicodeToAsciiString((LPWSTR)lpcf->lpTemplateName);
    266273
    267   UnicodeToAsciiN(lpcf->lpszStyle,
    268                   szAsciiStyle,
    269                   sizeof(szAsciiStyle) - 1);
    270   asciicf.lpszStyle = szAsciiStyle;
     274  if (lpcf->lpszStyle)
     275  {
     276    //CB: NT's clock.exe sets this pointer, don't know why
     277    //    it's not a pointer to a string!
     278    if ((UINT)lpcf->lpszStyle == 0xAAAAAAAA)
     279      asciicf.lpszStyle = NULL;
     280    else
     281    {
     282      UnicodeToAsciiN(lpcf->lpszStyle,
     283                      szAsciiStyle,
     284                      sizeof(szAsciiStyle));
     285
     286      asciicf.lpszStyle = szAsciiStyle;
     287    }
     288  };
    271289
    272290  UnicodeToAsciiN(lpcf->lpLogFont->lfFaceName,
     
    280298  bResult = O32_ChooseFont((LPCHOOSEFONTA)&asciicf);        // call ASCII version
    281299
    282   // transfer BACK resulting strings !!!
    283   AsciiToUnicodeN(asciicf.lpLogFont->lfFaceName,
    284                   lpcf->lpLogFont->lfFaceName,
    285                   LF_FACESIZE-1);
    286 
    287   AsciiToUnicode(asciicf.lpszStyle,
    288                  lpcf->lpszStyle);
     300  if (bResult)
     301  {
     302    // transfer BACK resulting strings !!!
     303    AsciiToUnicodeN(asciicf.lpLogFont->lfFaceName,
     304                    lpcf->lpLogFont->lfFaceName,
     305                    LF_FACESIZE-1);
     306
     307    if (lpcf->lpszStyle) AsciiToUnicode(asciicf.lpszStyle,lpcf->lpszStyle);
     308  }
    289309
    290310  if (lpcf->Flags & CF_ENABLETEMPLATE)
Note: See TracChangeset for help on using the changeset viewer.