strip whitespace from end of lines

svn path=/trunk/; revision=15167
This commit is contained in:
Steven Edwards 2005-05-09 01:42:07 +00:00
parent ae4b8f6e93
commit 6a73e87d9b
39 changed files with 564 additions and 564 deletions

View file

@ -6,9 +6,9 @@
#ifndef MAKEINTATOMA #ifndef MAKEINTATOMA
#define MAKEINTATOMA(atom) ((LPCSTR)((ULONG_PTR)((WORD)(atom)))) #define MAKEINTATOMA(atom) ((LPCSTR)((ULONG_PTR)((WORD)(atom))))
#endif #endif
#ifndef WM_ISACTIVEICON #ifndef WM_ISACTIVEICON
#define WM_ISACTIVEICON 0x0035 #define WM_ISACTIVEICON 0x0035
#endif #endif
#ifndef __USE_W32API #ifndef __USE_W32API
#if defined(STRICT) #if defined(STRICT)

View file

@ -824,7 +824,7 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
case WM_GETDLGCODE: case WM_GETDLGCODE:
result = DLGC_HASSETSEL | DLGC_WANTCHARS | DLGC_WANTARROWS; result = DLGC_HASSETSEL | DLGC_WANTCHARS | DLGC_WANTARROWS;
if (es->style & ES_MULTILINE) if (es->style & ES_MULTILINE)
{ {
result |= DLGC_WANTALLKEYS; result |= DLGC_WANTALLKEYS;
@ -3799,7 +3799,7 @@ static void EDIT_WM_Char(EDITSTATE *es, WCHAR c)
/*If Edit control style is ES_NUMBER allow users to key in only numeric values*/ /*If Edit control style is ES_NUMBER allow users to key in only numeric values*/
if( (es->style & ES_NUMBER) && !( c >= '0' && c <= '9') ) if( (es->style & ES_NUMBER) && !( c >= '0' && c <= '9') )
break; break;
if (!(es->style & ES_READONLY) && (c >= ' ') && (c != 127)) { if (!(es->style & ES_READONLY) && (c >= ' ') && (c != 127)) {
WCHAR str[2]; WCHAR str[2];
str[0] = c; str[0] = c;
@ -4593,7 +4593,7 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs, BOOL unicode)
* If WS_BORDER without WS_EX_CLIENTEDGE is specified we shouldn't have * If WS_BORDER without WS_EX_CLIENTEDGE is specified we shouldn't have
* a nonclient area and we should handle painting the border ourselves. * a nonclient area and we should handle painting the border ourselves.
* *
* When making modifications please ensure that the code still works * When making modifications please ensure that the code still works
* for edit controls created directly with style 0x50800000, exStyle 0 * for edit controls created directly with style 0x50800000, exStyle 0
* (which should have a single pixel border) * (which should have a single pixel border)
*/ */

View file

@ -19,7 +19,7 @@ static void RegisterBuiltinClass(const struct builtin_class_descr *Descr)
WNDCLASSEXW wc; WNDCLASSEXW wc;
UNICODE_STRING ClassName; UNICODE_STRING ClassName;
UNICODE_STRING MenuName; UNICODE_STRING MenuName;
wc.cbSize = sizeof(WNDCLASSEXW); wc.cbSize = sizeof(WNDCLASSEXW);
wc.lpszClassName = Descr->name; wc.lpszClassName = Descr->name;
wc.lpfnWndProc = Descr->procW; wc.lpfnWndProc = Descr->procW;

View file

@ -52,7 +52,7 @@
#define SCROLL_FIRST_DELAY 200 /* Delay (in ms) before first repetition when #define SCROLL_FIRST_DELAY 200 /* Delay (in ms) before first repetition when
holding the button down */ holding the button down */
#define SCROLL_REPEAT_DELAY 50 /* Delay (in ms) between scroll repetitions */ #define SCROLL_REPEAT_DELAY 50 /* Delay (in ms) between scroll repetitions */
#define SCROLL_TIMER 0 /* Scroll timer id */ #define SCROLL_TIMER 0 /* Scroll timer id */
/* Minimum size of the rectangle between the arrows */ /* Minimum size of the rectangle between the arrows */
@ -157,7 +157,7 @@ IntDrawScrollInterior(HWND hWnd, HDC hDC, INT nBar, BOOL Vertical,
SelectObject(hDC, hSaveBrush); SelectObject(hDC, hSaveBrush);
return; return;
} }
ThumbTop -= ScrollBarInfo->dxyLineButton; ThumbTop -= ScrollBarInfo->dxyLineButton;
if (ScrollBarInfo->dxyLineButton) if (ScrollBarInfo->dxyLineButton)
@ -312,7 +312,7 @@ IntScrollGetObjectId(INT SBType)
STATIC BOOL FASTCALL STATIC BOOL FASTCALL
IntGetScrollBarInfo(HWND Wnd, INT Bar, PSCROLLBARINFO ScrollBarInfo) IntGetScrollBarInfo(HWND Wnd, INT Bar, PSCROLLBARINFO ScrollBarInfo)
{ {
ScrollBarInfo->cbSize = sizeof(SCROLLBARINFO); ScrollBarInfo->cbSize = sizeof(SCROLLBARINFO);
return NtUserGetScrollBarInfo(Wnd, IntScrollGetObjectId(Bar), ScrollBarInfo); return NtUserGetScrollBarInfo(Wnd, IntScrollGetObjectId(Bar), ScrollBarInfo);
@ -349,7 +349,7 @@ IntDrawScrollBar(HWND Wnd, HDC DC, INT Bar)
{ {
return; return;
} }
if (IsRectEmpty(&Info.rcScrollBar)) if (IsRectEmpty(&Info.rcScrollBar))
{ {
return; return;
@ -419,7 +419,7 @@ IntScrollHitTest(PSCROLLBARINFO ScrollBarInfo, BOOL Vertical, POINT Pt, BOOL Dra
ThumbSize = ScrollBarInfo->xyThumbBottom - ThumbPos; ThumbSize = ScrollBarInfo->xyThumbBottom - ThumbPos;
ArrowSize = ScrollBarInfo->dxyLineButton; ArrowSize = ScrollBarInfo->dxyLineButton;
if (Vertical) if (Vertical)
{ {
if (Pt.y < ScrollBarInfo->rcScrollBar.top + ArrowSize) if (Pt.y < ScrollBarInfo->rcScrollBar.top + ArrowSize)
{ {
@ -1069,7 +1069,7 @@ static void IntScrollCreateScrollBar(
LPCREATESTRUCTW lpCreate /* [in] The style and place of the scroll bar */) LPCREATESTRUCTW lpCreate /* [in] The style and place of the scroll bar */)
{ {
SCROLLINFO Info; SCROLLINFO Info;
Info.cbSize = sizeof(SCROLLINFO); Info.cbSize = sizeof(SCROLLINFO);
Info.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; Info.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
Info.nMin = 0; Info.nMin = 0;
@ -1098,7 +1098,7 @@ static void IntScrollCreateScrollBar(
} }
else if (0 != (lpCreate->style & SBS_SIZEBOXBOTTOMRIGHTALIGN)) else if (0 != (lpCreate->style & SBS_SIZEBOXBOTTOMRIGHTALIGN))
{ {
MoveWindow(Wnd, lpCreate->x + lpCreate->cx - GetSystemMetrics(SM_CXVSCROLL) - 1, MoveWindow(Wnd, lpCreate->x + lpCreate->cx - GetSystemMetrics(SM_CXVSCROLL) - 1,
lpCreate->y + lpCreate->cy - GetSystemMetrics(SM_CYHSCROLL) - 1, lpCreate->y + lpCreate->cy - GetSystemMetrics(SM_CYHSCROLL) - 1,
GetSystemMetrics(SM_CXVSCROLL) + 1, GetSystemMetrics(SM_CXVSCROLL) + 1,
GetSystemMetrics(SM_CYHSCROLL) + 1, FALSE); GetSystemMetrics(SM_CYHSCROLL) + 1, FALSE);
@ -1140,7 +1140,7 @@ STATIC INT FASTCALL
IntScrollGetScrollPos(HWND Wnd, INT Bar) IntScrollGetScrollPos(HWND Wnd, INT Bar)
{ {
SCROLLINFO ScrollInfo; SCROLLINFO ScrollInfo;
ScrollInfo.cbSize = sizeof(SCROLLINFO); ScrollInfo.cbSize = sizeof(SCROLLINFO);
ScrollInfo.fMask = SIF_POS; ScrollInfo.fMask = SIF_POS;
if (! NtUserGetScrollInfo(Wnd, Bar, &ScrollInfo)) if (! NtUserGetScrollInfo(Wnd, Bar, &ScrollInfo))
@ -1156,13 +1156,13 @@ IntScrollGetScrollRange(HWND Wnd, int Bar, LPINT MinPos, LPINT MaxPos)
{ {
BOOL Result; BOOL Result;
SCROLLINFO ScrollInfo; SCROLLINFO ScrollInfo;
if (NULL == MinPos || NULL == MaxPos) if (NULL == MinPos || NULL == MaxPos)
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
ScrollInfo.cbSize = sizeof(SCROLLINFO); ScrollInfo.cbSize = sizeof(SCROLLINFO);
ScrollInfo.fMask = SIF_RANGE; ScrollInfo.fMask = SIF_RANGE;
Result = NtUserGetScrollInfo(Wnd, Bar, &ScrollInfo); Result = NtUserGetScrollInfo(Wnd, Bar, &ScrollInfo);
@ -1171,7 +1171,7 @@ IntScrollGetScrollRange(HWND Wnd, int Bar, LPINT MinPos, LPINT MaxPos)
*MinPos = ScrollInfo.nMin; *MinPos = ScrollInfo.nMin;
*MaxPos = ScrollInfo.nMax; *MaxPos = ScrollInfo.nMax;
} }
return Result; return Result;
} }
@ -1194,7 +1194,7 @@ ScrollTrackScrollBar(HWND Wnd, INT SBType, POINT Pt)
if (SB_CTL != SBType) if (SB_CTL != SBType)
{ {
NtUserGetWindowRect(Wnd, &WindowRect); NtUserGetWindowRect(Wnd, &WindowRect);
Pt.x -= WindowRect.left; Pt.x -= WindowRect.left;
Pt.y -= WindowRect.top; Pt.y -= WindowRect.top;
@ -1551,10 +1551,10 @@ SetScrollPos(HWND hWnd, INT nBar, INT nPos, BOOL bRedraw)
{ {
INT Result = 0; INT Result = 0;
SCROLLINFO ScrollInfo; SCROLLINFO ScrollInfo;
ScrollInfo.cbSize = sizeof(SCROLLINFO); ScrollInfo.cbSize = sizeof(SCROLLINFO);
ScrollInfo.fMask = SIF_POS; ScrollInfo.fMask = SIF_POS;
/* /*
* Call NtUserGetScrollInfo() to get the previous position that * Call NtUserGetScrollInfo() to get the previous position that
* we will later return. * we will later return.
@ -1569,7 +1569,7 @@ SetScrollPos(HWND hWnd, INT nBar, INT nPos, BOOL bRedraw)
NtUserSetScrollInfo(hWnd, nBar, &ScrollInfo, bRedraw); NtUserSetScrollInfo(hWnd, nBar, &ScrollInfo, bRedraw);
} }
} }
return Result; return Result;
} }

View file

@ -1 +1 @@
HPEN STDCALL GetSysColorPen (int nIndex);; HPEN STDCALL GetSysColorPen (int nIndex);

View file

@ -110,7 +110,7 @@ SystemParametersInfoA(UINT uiAction,
return TRUE; return TRUE;
} }
#endif #endif
/* FIXME - Read the registry key for now, but what happens if the wallpaper was /* FIXME - Read the registry key for now, but what happens if the wallpaper was
changed without SPIF_UPDATEINIFILE?! */ changed without SPIF_UPDATEINIFILE?! */
if(RegOpenKeyExW(HKEY_CURRENT_USER, if(RegOpenKeyExW(HKEY_CURRENT_USER,
@ -138,7 +138,7 @@ SystemParametersInfoA(UINT uiAction,
HBITMAP hNewWallpaper; HBITMAP hNewWallpaper;
BOOL Ret; BOOL Ret;
LPSTR lpWallpaper = (LPSTR)pvParam; LPSTR lpWallpaper = (LPSTR)pvParam;
if(lpWallpaper != NULL && *lpWallpaper != '\0') if(lpWallpaper != NULL && *lpWallpaper != '\0')
{ {
hNewWallpaper = LoadImageA(0, lpWallpaper, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); hNewWallpaper = LoadImageA(0, lpWallpaper, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
@ -152,7 +152,7 @@ SystemParametersInfoA(UINT uiAction,
hNewWallpaper = NULL; hNewWallpaper = NULL;
lpWallpaper = NULL; lpWallpaper = NULL;
} }
/* Set the wallpaper bitmap */ /* Set the wallpaper bitmap */
if(!NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, 0, &hNewWallpaper, fWinIni & SPIF_SENDCHANGE)) if(!NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, 0, &hNewWallpaper, fWinIni & SPIF_SENDCHANGE))
{ {
@ -161,7 +161,7 @@ SystemParametersInfoA(UINT uiAction,
return FALSE; return FALSE;
} }
/* Do not use the bitmap handle anymore, it doesn't belong to our process anymore! */ /* Do not use the bitmap handle anymore, it doesn't belong to our process anymore! */
Ret = TRUE; Ret = TRUE;
if(fWinIni & SPIF_UPDATEINIFILE) if(fWinIni & SPIF_UPDATEINIFILE)
{ {
@ -317,12 +317,12 @@ CreateDesktopA(LPCSTR lpszDesktop,
HDESK hDesktop; HDESK hDesktop;
DEVMODEW DevmodeW; DEVMODEW DevmodeW;
if (lpszDesktop != NULL) if (lpszDesktop != NULL)
{ {
RtlInitAnsiString(&DesktopNameA, (LPSTR)lpszDesktop); RtlInitAnsiString(&DesktopNameA, (LPSTR)lpszDesktop);
RtlAnsiStringToUnicodeString(&DesktopNameU, &DesktopNameA, TRUE); RtlAnsiStringToUnicodeString(&DesktopNameU, &DesktopNameA, TRUE);
} }
else else
{ {
RtlInitUnicodeString(&DesktopNameU, NULL); RtlInitUnicodeString(&DesktopNameU, NULL);
} }

View file

@ -49,7 +49,7 @@ EnumDisplayDevicesA(
BOOL rc; BOOL rc;
UNICODE_STRING Device; UNICODE_STRING Device;
DISPLAY_DEVICEW DisplayDeviceW; DISPLAY_DEVICEW DisplayDeviceW;
if ( !RtlCreateUnicodeStringFromAsciiz ( &Device, (PCSZ)lpDevice ) ) if ( !RtlCreateUnicodeStringFromAsciiz ( &Device, (PCSZ)lpDevice ) )
{ {
SetLastError ( ERROR_OUTOFMEMORY ); SetLastError ( ERROR_OUTOFMEMORY );
@ -62,7 +62,7 @@ EnumDisplayDevicesA(
iDevNum, iDevNum,
&DisplayDeviceW, &DisplayDeviceW,
dwFlags ); dwFlags );
/* Copy result from DisplayDeviceW to lpDisplayDevice */ /* Copy result from DisplayDeviceW to lpDisplayDevice */
lpDisplayDevice->StateFlags = DisplayDeviceW.StateFlags; lpDisplayDevice->StateFlags = DisplayDeviceW.StateFlags;
WideCharToMultiByte(CP_ACP,0, WideCharToMultiByte(CP_ACP,0,

View file

@ -36,7 +36,7 @@ InitThread(VOID)
{ {
PUSER32_THREAD_DATA ThreadData; PUSER32_THREAD_DATA ThreadData;
ThreadData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ThreadData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(USER32_THREAD_DATA)); sizeof(USER32_THREAD_DATA));
TlsSetValue(User32TlsIndex, ThreadData); TlsSetValue(User32TlsIndex, ThreadData);
} }

View file

@ -43,10 +43,10 @@
* Execution continues in WinLogon, which calls ExitWindowsEx() again to * Execution continues in WinLogon, which calls ExitWindowsEx() again to
* terminate COM processes in the interactive user's session. * terminate COM processes in the interactive user's session.
* - WinLogon stops impersonating the interactive user (whos processes are * - WinLogon stops impersonating the interactive user (whos processes are
* all dead by now). and enters log-out state * all dead by now). and enters log-out state
* - If the ExitWindowsEx() request was for a logoff, WinLogon sends a SAS * - If the ExitWindowsEx() request was for a logoff, WinLogon sends a SAS
* event (to display the "press ctrl+alt+del") to the GINA. WinLogon then * event (to display the "press ctrl+alt+del") to the GINA. WinLogon then
* waits for the GINA to send a SAS event to login. * waits for the GINA to send a SAS event to login.
* - If the ExitWindowsEx() request was for shutdown/restart, WinLogon calls * - If the ExitWindowsEx() request was for shutdown/restart, WinLogon calls
* ExitWindowsEx() again in the system process context. * ExitWindowsEx() again in the system process context.
* - CSRSS goes through the motions of sending WM_QUERYENDSESSION/WM_ENDSESSION * - CSRSS goes through the motions of sending WM_QUERYENDSESSION/WM_ENDSESSION

View file

@ -333,9 +333,9 @@ static UINT ICO_ExtractIconExW(
NE_NAMEINFO *pIconStorage = NULL; NE_NAMEINFO *pIconStorage = NULL;
NE_NAMEINFO *pIconDir = NULL; NE_NAMEINFO *pIconDir = NULL;
LPicoICONDIR lpiID = NULL; LPicoICONDIR lpiID = NULL;
TRACE("-- OS2/icon Signature (0x%08lx)\n", sig); TRACE("-- OS2/icon Signature (0x%08lx)\n", sig);
if (pData == (BYTE*)-1) if (pData == (BYTE*)-1)
{ {
pCIDir = ICO_GetIconDirectory(peimage, &lpiID, &uSize); /* check for .ICO file */ pCIDir = ICO_GetIconDirectory(peimage, &lpiID, &uSize); /* check for .ICO file */
@ -361,7 +361,7 @@ static UINT ICO_ExtractIconExW(
} }
pTInfo = (NE_TYPEINFO *)((char*)(pTInfo+1)+pTInfo->count*sizeof(NE_NAMEINFO)); pTInfo = (NE_TYPEINFO *)((char*)(pTInfo+1)+pTInfo->count*sizeof(NE_NAMEINFO));
} }
if ((pIconStorage && pIconDir) || lpiID) /* load resources and create icons */ if ((pIconStorage && pIconDir) || lpiID) /* load resources and create icons */
{ {
if (nIcons == 0) if (nIcons == 0)
@ -375,7 +375,7 @@ static UINT ICO_ExtractIconExW(
UINT16 i, icon; UINT16 i, icon;
if (nIcons > iconDirCount - nIconIndex) if (nIcons > iconDirCount - nIconIndex)
nIcons = iconDirCount - nIconIndex; nIcons = iconDirCount - nIconIndex;
for (i = 0; i < nIcons; i++) for (i = 0; i < nIcons; i++)
{ {
/* .ICO files have only one icon directory */ /* .ICO files have only one icon directory */
@ -385,7 +385,7 @@ static UINT ICO_ExtractIconExW(
} }
if (lpiID && pCIDir) /* *.ico file, deallocate heap pointer*/ if (lpiID && pCIDir) /* *.ico file, deallocate heap pointer*/
HeapFree(GetProcessHeap(), 0, pCIDir); HeapFree(GetProcessHeap(), 0, pCIDir);
for (icon = 0; icon < nIcons; icon++) for (icon = 0; icon < nIcons; icon++)
{ {
pCIDir = NULL; pCIDir = NULL;
@ -395,7 +395,7 @@ static UINT ICO_ExtractIconExW(
for (i = 0; i < iconCount; i++) for (i = 0; i < iconCount; i++)
if (pIconStorage[i].id == ((int)pIconId[icon] | 0x8000) ) if (pIconStorage[i].id == ((int)pIconId[icon] | 0x8000) )
pCIDir = USER32_LoadResource(peimage, pIconStorage + i, *(WORD*)pData, &uSize); pCIDir = USER32_LoadResource(peimage, pIconStorage + i, *(WORD*)pData, &uSize);
if (pCIDir) if (pCIDir)
RetPtr[icon] = (HICON)CreateIconFromResourceEx(pCIDir, uSize, TRUE, 0x00030000, RetPtr[icon] = (HICON)CreateIconFromResourceEx(pCIDir, uSize, TRUE, 0x00030000,
(icon & 1) ? cx2 : cx1, (icon & 1) ? cy2 : cy1, flags); (icon & 1) ? cx2 : cx1, (icon & 1) ? cy2 : cy1, flags);
@ -410,7 +410,7 @@ static UINT ICO_ExtractIconExW(
/* exe/dll */ /* exe/dll */
else if( sig == IMAGE_NT_SIGNATURE ) else if( sig == IMAGE_NT_SIGNATURE )
#endif #endif
if( sig == IMAGE_NT_SIGNATURE ) if( sig == IMAGE_NT_SIGNATURE )
{ {
LPBYTE idata,igdata; LPBYTE idata,igdata;

View file

@ -93,15 +93,15 @@ GetUserObjectInformationA(
LPDWORD lpnLengthNeeded) LPDWORD lpnLengthNeeded)
{ {
LPWSTR buffer; LPWSTR buffer;
BOOL ret = TRUE; BOOL ret = TRUE;
DPRINT("GetUserObjectInformationA(%x %d %x %d %x)\n", hObj, nIndex, DPRINT("GetUserObjectInformationA(%x %d %x %d %x)\n", hObj, nIndex,
pvInfo, nLength, lpnLengthNeeded); pvInfo, nLength, lpnLengthNeeded);
if (nIndex != UOI_NAME && nIndex != UOI_TYPE) if (nIndex != UOI_NAME && nIndex != UOI_TYPE)
return GetUserObjectInformationW(hObj, nIndex, pvInfo, nLength, lpnLengthNeeded); return GetUserObjectInformationW(hObj, nIndex, pvInfo, nLength, lpnLengthNeeded);
/* allocate unicode buffer */ /* allocate unicode buffer */
buffer = HeapAlloc(GetProcessHeap(), 0, nLength*2); buffer = HeapAlloc(GetProcessHeap(), 0, nLength*2);
if (buffer == NULL) if (buffer == NULL)
{ {
@ -124,7 +124,7 @@ GetUserObjectInformationA(
} }
} }
/* free resources */ /* free resources */
HeapFree(GetProcessHeap(), 0, buffer); HeapFree(GetProcessHeap(), 0, buffer);
return ret; return ret;
} }

View file

@ -127,7 +127,7 @@ int STDCALL LoadStringA
strBuf.Buffer = lpBuffer; strBuf.Buffer = lpBuffer;
nErrCode = RtlUnicodeStringToAnsiString(&strBuf, &wstrResStr, FALSE); nErrCode = RtlUnicodeStringToAnsiString(&strBuf, &wstrResStr, FALSE);
if(!NT_SUCCESS(nErrCode)) if(!NT_SUCCESS(nErrCode))
{ {
/* failure */ /* failure */
@ -198,10 +198,10 @@ int STDCALL LoadStringW
/* copy the string */ /* copy the string */
memcpy(lpBuffer, wstrResStr.Buffer, nStringLen * sizeof(WCHAR)); memcpy(lpBuffer, wstrResStr.Buffer, nStringLen * sizeof(WCHAR));
/* null-terminate it */ /* null-terminate it */
lpBuffer[nStringLen] = 0; lpBuffer[nStringLen] = 0;
/* success */ /* success */
return nStringLen; return nStringLen;
} }

View file

@ -62,7 +62,7 @@ NTSTATUS
HEAP_strcpyAtoW ( LPWSTR lpszW, LPCSTR lpszA, DWORD len ) HEAP_strcpyAtoW ( LPWSTR lpszW, LPCSTR lpszA, DWORD len )
{ {
NTSTATUS Status = NTSTATUS Status =
RtlMultiByteToUnicodeN ( lpszW, len*sizeof(WCHAR), NULL, (LPSTR)lpszA, len ); RtlMultiByteToUnicodeN ( lpszW, len*sizeof(WCHAR), NULL, (LPSTR)lpszA, len );
lpszW[len] = L'\0'; lpszW[len] = L'\0';
return Status; return Status;
} }

View file

@ -177,7 +177,7 @@ EndTask(
BOOL fForce) BOOL fForce)
{ {
SendMessageW(hWnd, WM_CLOSE, 0, 0); SendMessageW(hWnd, WM_CLOSE, 0, 0);
if (IsWindow(hWnd)) if (IsWindow(hWnd))
{ {
if (fForce) if (fForce)
@ -185,7 +185,7 @@ EndTask(
else else
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
@ -515,7 +515,7 @@ BroadcastSystemMessageExA(
/* /*
* @unimplemented * @unimplemented
*/ */
BOOL BOOL
STDCALL STDCALL
AlignRects(LPRECT rect, DWORD b, DWORD c, DWORD d) AlignRects(LPRECT rect, DWORD b, DWORD c, DWORD d)
{ {
@ -752,7 +752,7 @@ IMPGetIMEA( HWND hwnd, LPIMEPROA ime)
/* /*
* @unimplemented * @unimplemented
*/ */
LRESULT LRESULT
STDCALL STDCALL
SendIMEMessageExW(HWND hwnd,LPARAM lparam) SendIMEMessageExW(HWND hwnd,LPARAM lparam)
{ {
@ -763,7 +763,7 @@ SendIMEMessageExW(HWND hwnd,LPARAM lparam)
/* /*
* @unimplemented * @unimplemented
*/ */
LRESULT LRESULT
STDCALL STDCALL
SendIMEMessageExA(HWND hwnd, LPARAM lparam) SendIMEMessageExA(HWND hwnd, LPARAM lparam)
{ {

View file

@ -43,7 +43,7 @@ KillSystemTimer(
HWND hWnd, HWND hWnd,
UINT_PTR IDEvent) UINT_PTR IDEvent)
{ {
return NtUserKillSystemTimer(hWnd, IDEvent); return NtUserKillSystemTimer(hWnd, IDEvent);
} }
@ -56,7 +56,7 @@ KillTimer(
HWND hWnd, HWND hWnd,
UINT_PTR IDEvent) UINT_PTR IDEvent)
{ {
return NtUserKillTimer(hWnd, IDEvent); return NtUserKillTimer(hWnd, IDEvent);
} }

View file

@ -71,7 +71,7 @@ WinHelpA(HWND hWnd, LPCSTR lpszHelp, UINT uCommand, DWORD dwData)
if (WinExec("winhlp32.exe -x", SW_SHOWNORMAL) < 32) { if (WinExec("winhlp32.exe -x", SW_SHOWNORMAL) < 32) {
//ERR("can't start winhlp32.exe -x ?\n"); //ERR("can't start winhlp32.exe -x ?\n");
return FALSE; return FALSE;
} }
if (!(hDest = FindWindowA("MS_WINHELP", NULL))) { if (!(hDest = FindWindowA("MS_WINHELP", NULL))) {
//FIXME("did not find MS_WINHELP (FindWindow() failed, maybe global window handling still unimplemented)\n"); //FIXME("did not find MS_WINHELP (FindWindow() failed, maybe global window handling still unimplemented)\n");
return FALSE; return FALSE;

View file

@ -35,14 +35,14 @@ CreateWindowStationA(LPSTR lpwinsta,
ANSI_STRING WindowStationNameA; ANSI_STRING WindowStationNameA;
UNICODE_STRING WindowStationNameU; UNICODE_STRING WindowStationNameU;
HWINSTA hWinSta; HWINSTA hWinSta;
if (lpwinsta != NULL) if (lpwinsta != NULL)
{ {
RtlInitAnsiString(&WindowStationNameA, lpwinsta); RtlInitAnsiString(&WindowStationNameA, lpwinsta);
RtlAnsiStringToUnicodeString(&WindowStationNameU, &WindowStationNameA, RtlAnsiStringToUnicodeString(&WindowStationNameU, &WindowStationNameA,
TRUE); TRUE);
} }
else else
{ {
RtlInitUnicodeString(&WindowStationNameU, NULL); RtlInitUnicodeString(&WindowStationNameU, NULL);
} }
@ -53,7 +53,7 @@ CreateWindowStationA(LPSTR lpwinsta,
lpsa); lpsa);
RtlFreeUnicodeString(&WindowStationNameU); RtlFreeUnicodeString(&WindowStationNameU);
return hWinSta; return hWinSta;
} }
@ -68,9 +68,9 @@ CreateWindowStationW(LPWSTR lpwinsta,
LPSECURITY_ATTRIBUTES lpsa) LPSECURITY_ATTRIBUTES lpsa)
{ {
UNICODE_STRING WindowStationName; UNICODE_STRING WindowStationName;
RtlInitUnicodeString(&WindowStationName, lpwinsta); RtlInitUnicodeString(&WindowStationName, lpwinsta);
return NtUserCreateWindowStation(&WindowStationName, return NtUserCreateWindowStation(&WindowStationName,
dwDesiredAccess, dwDesiredAccess,
lpsa, 0, 0, 0); lpsa, 0, 0, 0);
@ -294,22 +294,22 @@ OpenWindowStationA(LPSTR lpszWinSta,
ANSI_STRING WindowStationNameA; ANSI_STRING WindowStationNameA;
UNICODE_STRING WindowStationNameU; UNICODE_STRING WindowStationNameU;
HWINSTA hWinSta; HWINSTA hWinSta;
if (lpszWinSta != NULL) if (lpszWinSta != NULL)
{ {
RtlInitAnsiString(&WindowStationNameA, lpszWinSta); RtlInitAnsiString(&WindowStationNameA, lpszWinSta);
RtlAnsiStringToUnicodeString(&WindowStationNameU, &WindowStationNameA, RtlAnsiStringToUnicodeString(&WindowStationNameU, &WindowStationNameA,
TRUE); TRUE);
} }
else else
{ {
RtlInitUnicodeString(&WindowStationNameU, NULL); RtlInitUnicodeString(&WindowStationNameU, NULL);
} }
hWinSta = OpenWindowStationW(WindowStationNameU.Buffer, hWinSta = OpenWindowStationW(WindowStationNameU.Buffer,
fInherit, fInherit,
dwDesiredAccess); dwDesiredAccess);
RtlFreeUnicodeString(&WindowStationNameU); RtlFreeUnicodeString(&WindowStationNameU);
return hWinSta; return hWinSta;

View file

@ -26,7 +26,7 @@
* PROJECT: ReactOS User32 * PROJECT: ReactOS User32
* PURPOSE: [w]sprintf functions * PURPOSE: [w]sprintf functions
* FILE: lib/user32/wsprintf.c * FILE: lib/user32/wsprintf.c
* PROGRAMER: Steven Edwards * PROGRAMER: Steven Edwards
* REVISION HISTORY: 2003/07/13 Merged from wine user/wsprintf.c * REVISION HISTORY: 2003/07/13 Merged from wine user/wsprintf.c
* NOTES: Adapted from Wine * NOTES: Adapted from Wine
*/ */

View file

@ -59,7 +59,7 @@ U32_ACCEL_CACHE_ENTRY ** WINAPI U32AccelCacheFind(HANDLE Object, HGLOBAL Data)
return a pointer to the list link that points to the desired entry return a pointer to the list link that points to the desired entry
*/ */
U32_ACCEL_CACHE_ENTRY ** ppEntry = &U32AccelCache; U32_ACCEL_CACHE_ENTRY ** ppEntry = &U32AccelCache;
for(; *ppEntry; ppEntry = &((*ppEntry)->Next)) for(; *ppEntry; ppEntry = &((*ppEntry)->Next))
if((*ppEntry)->Object == Object || (*ppEntry)->Data == Data) break; if((*ppEntry)->Object == Object || (*ppEntry)->Data == Data) break;
@ -145,7 +145,7 @@ HACCEL WINAPI U32LoadAccelerators(HINSTANCE hInstance, HRSRC hTableRes)
/* free the buffer */ /* free the buffer */
LocalFree(pAccTableData); LocalFree(pAccTableData);
/* failure */ /* failure */
if(hAccTable == NULL) goto l_Leave; if(hAccTable == NULL) goto l_Leave;
@ -229,7 +229,7 @@ HACCEL WINAPI LoadAcceleratorsW(HINSTANCE hInstance, LPCWSTR lpTableName)
{ {
return U32LoadAccelerators return U32LoadAccelerators
( (
hInstance, hInstance,
FindResourceExW(hInstance, MAKEINTRESOURCEW(RT_ACCELERATOR), lpTableName, 0) FindResourceExW(hInstance, MAKEINTRESOURCEW(RT_ACCELERATOR), lpTableName, 0)
); );
} }
@ -296,9 +296,9 @@ int WINAPI CopyAcceleratorTableA
) )
{ {
int i; int i;
cAccelEntries = CopyAcceleratorTableW(hAccelSrc, lpAccelDst, cAccelEntries); cAccelEntries = CopyAcceleratorTableW(hAccelSrc, lpAccelDst, cAccelEntries);
if (lpAccelDst == NULL) return cAccelEntries; if (lpAccelDst == NULL) return cAccelEntries;
for(i = 0; i < cAccelEntries; ++ i) for(i = 0; i < cAccelEntries; ++ i)
@ -310,11 +310,11 @@ int WINAPI CopyAcceleratorTableA
NULL, NULL,
(PWCHAR)&lpAccelDst[i].key, (PWCHAR)&lpAccelDst[i].key,
sizeof(lpAccelDst[i].key) sizeof(lpAccelDst[i].key)
); );
if(!NT_SUCCESS(nErrCode)) lpAccelDst[i].key = 0; if(!NT_SUCCESS(nErrCode)) lpAccelDst[i].key = 0;
} }
return cAccelEntries; return cAccelEntries;
} }

View file

@ -57,7 +57,7 @@ LoadImageA(HINSTANCE hinst,
UNICODE_STRING NameString; UNICODE_STRING NameString;
if (HIWORD(lpszName)) if (HIWORD(lpszName))
{ {
RtlCreateUnicodeStringFromAsciiz(&NameString, (LPSTR)lpszName); RtlCreateUnicodeStringFromAsciiz(&NameString, (LPSTR)lpszName);
lpszWName = NameString.Buffer; lpszWName = NameString.Buffer;
Handle = LoadImageW(hinst, lpszWName, uType, cxDesired, Handle = LoadImageW(hinst, lpszWName, uType, cxDesired,
@ -93,7 +93,7 @@ LoadCursorImage(HINSTANCE hinst, LPCWSTR lpszName, UINT fuLoad)
INT id; INT id;
ICONIMAGE *ResIcon; ICONIMAGE *ResIcon;
UINT ColorBits; UINT ColorBits;
if (!(fuLoad & LR_LOADFROMFILE)) if (!(fuLoad & LR_LOADFROMFILE))
{ {
if (hinst == NULL) if (hinst == NULL)
@ -105,7 +105,7 @@ LoadCursorImage(HINSTANCE hinst, LPCWSTR lpszName, UINT fuLoad)
{ {
return NULL; return NULL;
} }
if (fuLoad & LR_SHARED) if (fuLoad & LR_SHARED)
{ {
/* FIXME - pass size! */ /* FIXME - pass size! */
@ -151,7 +151,7 @@ LoadCursorImage(HINSTANCE hinst, LPCWSTR lpszName, UINT fuLoad)
32, 32, fuLoad & (LR_DEFAULTCOLOR | LR_MONOCHROME)); 32, 32, fuLoad & (LR_DEFAULTCOLOR | LR_MONOCHROME));
if (hIcon && 0 != (fuLoad & LR_SHARED)) if (hIcon && 0 != (fuLoad & LR_SHARED))
{ {
NtUserSetCursorIconData((HICON)hIcon, NULL, NULL, hinst, (HRSRC)hfRes, NtUserSetCursorIconData((HICON)hIcon, NULL, NULL, hinst, (HRSRC)hfRes,
(HRSRC)NULL); (HRSRC)NULL);
} }
@ -162,7 +162,7 @@ LoadCursorImage(HINSTANCE hinst, LPCWSTR lpszName, UINT fuLoad)
{ {
DbgPrint("FIXME: need LR_SHARED support loading cursor images from files\n"); DbgPrint("FIXME: need LR_SHARED support loading cursor images from files\n");
} }
hFile = CreateFileW(lpszName, GENERIC_READ, FILE_SHARE_READ, NULL, hFile = CreateFileW(lpszName, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, 0, NULL); OPEN_EXISTING, 0, NULL);
if (hFile == NULL) if (hFile == NULL)
@ -185,7 +185,7 @@ LoadCursorImage(HINSTANCE hinst, LPCWSTR lpszName, UINT fuLoad)
return NULL; return NULL;
} }
/* /*
* Get a handle to the screen dc, the icon we create is going to be * Get a handle to the screen dc, the icon we create is going to be
* compatable with it. * compatable with it.
*/ */
@ -219,7 +219,7 @@ LoadCursorImage(HINSTANCE hinst, LPCWSTR lpszName, UINT fuLoad)
return(NULL); return(NULL);
} }
SafeIconImage = RtlAllocateHeap(GetProcessHeap(), 0, dirEntry->dwBytesInRes); SafeIconImage = RtlAllocateHeap(GetProcessHeap(), 0, dirEntry->dwBytesInRes);
memcpy(SafeIconImage, ((PBYTE)IconDIR) + dirEntry->dwImageOffset, dirEntry->dwBytesInRes); memcpy(SafeIconImage, ((PBYTE)IconDIR) + dirEntry->dwImageOffset, dirEntry->dwBytesInRes);
/* at this point we have a copy of the icon image to play with */ /* at this point we have a copy of the icon image to play with */
@ -241,7 +241,7 @@ LoadCursorImage(HINSTANCE hinst, LPCWSTR lpszName, UINT fuLoad)
} }
HeaderSize = sizeof(BITMAPINFOHEADER) + ColorCount * sizeof(RGBQUAD); HeaderSize = sizeof(BITMAPINFOHEADER) + ColorCount * sizeof(RGBQUAD);
} }
/* make data point to the start of the XOR image data */ /* make data point to the start of the XOR image data */
Data = (PBYTE)SafeIconImage + HeaderSize; Data = (PBYTE)SafeIconImage + HeaderSize;
@ -271,7 +271,7 @@ LoadIconImage(HINSTANCE hinst, LPCWSTR lpszName, INT width, INT height, UINT fuL
GRPCURSORICONDIR* IconResDir; GRPCURSORICONDIR* IconResDir;
INT id; INT id;
ICONIMAGE *ResIcon; ICONIMAGE *ResIcon;
if (!(fuLoad & LR_LOADFROMFILE)) if (!(fuLoad & LR_LOADFROMFILE))
{ {
if (hinst == NULL) if (hinst == NULL)
@ -283,7 +283,7 @@ LoadIconImage(HINSTANCE hinst, LPCWSTR lpszName, INT width, INT height, UINT fuL
{ {
return(NULL); return(NULL);
} }
if (fuLoad & LR_SHARED) if (fuLoad & LR_SHARED)
{ {
hIcon = NtUserFindExistingCursorIcon(hinst, (HRSRC)hfRes, width, height); hIcon = NtUserFindExistingCursorIcon(hinst, (HRSRC)hfRes, width, height);
@ -326,7 +326,7 @@ LoadIconImage(HINSTANCE hinst, LPCWSTR lpszName, INT width, INT height, UINT fuL
width, height, fuLoad & (LR_DEFAULTCOLOR | LR_MONOCHROME)); width, height, fuLoad & (LR_DEFAULTCOLOR | LR_MONOCHROME));
if (hIcon && 0 != (fuLoad & LR_SHARED)) if (hIcon && 0 != (fuLoad & LR_SHARED))
{ {
NtUserSetCursorIconData((HICON)hIcon, NULL, NULL, hinst, (HRSRC)hfRes, NtUserSetCursorIconData((HICON)hIcon, NULL, NULL, hinst, (HRSRC)hfRes,
(HRSRC)NULL); (HRSRC)NULL);
} }
return hIcon; return hIcon;
@ -334,7 +334,7 @@ LoadIconImage(HINSTANCE hinst, LPCWSTR lpszName, INT width, INT height, UINT fuL
else else
{ {
/* /*
* FIXME: This code is incorrect and is likely to crash in many cases. * FIXME: This code is incorrect and is likely to crash in many cases.
* In the file the cursor/icon directory records are stored like * In the file the cursor/icon directory records are stored like
* CURSORICONFILEDIR, but we treat them like CURSORICONDIR. In Wine * CURSORICONFILEDIR, but we treat them like CURSORICONDIR. In Wine
* this is solved by creating a fake cursor/icon directory in memory * this is solved by creating a fake cursor/icon directory in memory
@ -345,7 +345,7 @@ LoadIconImage(HINSTANCE hinst, LPCWSTR lpszName, INT width, INT height, UINT fuL
{ {
DbgPrint("FIXME: need LR_SHARED support for loading icon images from files\n"); DbgPrint("FIXME: need LR_SHARED support for loading icon images from files\n");
} }
hFile = CreateFileW(lpszName, hFile = CreateFileW(lpszName,
GENERIC_READ, GENERIC_READ,
FILE_SHARE_READ, FILE_SHARE_READ,
@ -396,7 +396,7 @@ LoadIconImage(HINSTANCE hinst, LPCWSTR lpszName, INT width, INT height, UINT fuL
return(NULL); return(NULL);
} }
SafeIconImage = RtlAllocateHeap(GetProcessHeap(), 0, dirEntry->dwBytesInRes); SafeIconImage = RtlAllocateHeap(GetProcessHeap(), 0, dirEntry->dwBytesInRes);
memcpy(SafeIconImage, ((PBYTE)IconDIR) + dirEntry->dwImageOffset, dirEntry->dwBytesInRes); memcpy(SafeIconImage, ((PBYTE)IconDIR) + dirEntry->dwImageOffset, dirEntry->dwBytesInRes);
@ -423,7 +423,7 @@ LoadIconImage(HINSTANCE hinst, LPCWSTR lpszName, INT width, INT height, UINT fuL
} }
HeaderSize = sizeof(BITMAPINFOHEADER) + ColorCount * sizeof(RGBQUAD); HeaderSize = sizeof(BITMAPINFOHEADER) + ColorCount * sizeof(RGBQUAD);
} }
//make data point to the start of the XOR image data //make data point to the start of the XOR image data
Data = (PBYTE)SafeIconImage + HeaderSize; Data = (PBYTE)SafeIconImage + HeaderSize;
@ -503,7 +503,7 @@ LoadBitmapImage(HINSTANCE hInstance, LPCWSTR lpszName, UINT fuLoad)
NULL); NULL);
CloseHandle(hFile); CloseHandle(hFile);
if (hSection == NULL) if (hSection == NULL)
{ {
return(NULL); return(NULL);
} }
BitmapInfo = MapViewOfFile(hSection, BitmapInfo = MapViewOfFile(hSection,
@ -567,7 +567,7 @@ LoadBitmapImage(HINSTANCE hInstance, LPCWSTR lpszName, UINT fuLoad)
{ {
DIBSECTION Dib; DIBSECTION Dib;
hBitmap = CreateDIBSection(hScreenDc, PrivateInfo, DIB_RGB_COLORS, NULL, hBitmap = CreateDIBSection(hScreenDc, PrivateInfo, DIB_RGB_COLORS, NULL,
0, 0); 0, 0);
GetObjectA(hBitmap, sizeof(DIBSECTION), &Dib); GetObjectA(hBitmap, sizeof(DIBSECTION), &Dib);
SetDIBits(hScreenDc, hBitmap, 0, Dib.dsBm.bmHeight, Data, BitmapInfo, SetDIBits(hScreenDc, hBitmap, 0, Dib.dsBm.bmHeight, Data, BitmapInfo,
@ -595,7 +595,7 @@ LoadImageW(HINSTANCE hinst,
int cxDesired, int cxDesired,
int cyDesired, int cyDesired,
UINT fuLoad) UINT fuLoad)
{ {
if (fuLoad & LR_DEFAULTSIZE) if (fuLoad & LR_DEFAULTSIZE)
{ {
if (uType == IMAGE_ICON) if (uType == IMAGE_ICON)
@ -692,7 +692,7 @@ CopyImage(HANDLE hnd, UINT type, INT desiredx, INT desiredy, UINT flags)
} }
return res; return res;
} }
case IMAGE_ICON: case IMAGE_ICON:
{ {
static BOOL IconMsgDisplayed = FALSE; static BOOL IconMsgDisplayed = FALSE;
/* FIXME: support loading the image as shared from an instance */ /* FIXME: support loading the image as shared from an instance */
@ -702,7 +702,7 @@ CopyImage(HANDLE hnd, UINT type, INT desiredx, INT desiredy, UINT flags)
} }
return CopyIcon(hnd); return CopyIcon(hnd);
} }
case IMAGE_CURSOR: case IMAGE_CURSOR:
{ {
static BOOL IconMsgDisplayed = FALSE; static BOOL IconMsgDisplayed = FALSE;
/* FIXME: support loading the image as shared from an instance */ /* FIXME: support loading the image as shared from an instance */

View file

@ -36,7 +36,7 @@
void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo) void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo)
{ {
HDC hDC, hComp; HDC hDC, hComp;
hDC = GetDC(hWnd); hDC = GetDC(hWnd);
if(hDC) if(hDC)
{ {

View file

@ -56,7 +56,7 @@ static BOOL GetClassInfoExCommon(
else else
{ {
Status = HEAP_strdupAtoW(&str, (LPCSTR)lpszClass, NULL); Status = HEAP_strdupAtoW(&str, (LPCSTR)lpszClass, NULL);
if (! NT_SUCCESS(Status)) if (! NT_SUCCESS(Status))
{ {
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
@ -278,7 +278,7 @@ GetClassNameA(
int result; int result;
LPWSTR ClassNameW; LPWSTR ClassNameW;
NTSTATUS Status; NTSTATUS Status;
if(!lpClassName) if(!lpClassName)
return 0; return 0;
@ -436,7 +436,7 @@ RegisterClassExA(CONST WNDCLASSEXA *lpwcx)
/* Yes, this is correct. We should modify the passed structure. */ /* Yes, this is correct. We should modify the passed structure. */
if (lpwcx->hInstance == NULL) if (lpwcx->hInstance == NULL)
((WNDCLASSEXA*)lpwcx)->hInstance = GetModuleHandleW(NULL); ((WNDCLASSEXA*)lpwcx)->hInstance = GetModuleHandleW(NULL);
RtlCopyMemory(&WndClass, lpwcx, sizeof(WNDCLASSEXW)); RtlCopyMemory(&WndClass, lpwcx, sizeof(WNDCLASSEXW));
if (IS_ATOM(lpwcx->lpszMenuName) || lpwcx->lpszMenuName == 0) if (IS_ATOM(lpwcx->lpszMenuName) || lpwcx->lpszMenuName == 0)
@ -728,7 +728,7 @@ UnregisterClassA(
LPWSTR ClassName; LPWSTR ClassName;
NTSTATUS Status; NTSTATUS Status;
BOOL Result; BOOL Result;
if(!IS_ATOM(lpClassName)) if(!IS_ATOM(lpClassName))
{ {
Status = HEAP_strdupAtoW(&ClassName, lpClassName, NULL); Status = HEAP_strdupAtoW(&ClassName, lpClassName, NULL);
@ -740,12 +740,12 @@ UnregisterClassA(
} }
else else
ClassName = (LPWSTR)lpClassName; ClassName = (LPWSTR)lpClassName;
Result = (BOOL)NtUserUnregisterClass((LPCWSTR)ClassName, hInstance, 0); Result = (BOOL)NtUserUnregisterClass((LPCWSTR)ClassName, hInstance, 0);
if(ClassName && !IS_ATOM(lpClassName)) if(ClassName && !IS_ATOM(lpClassName))
HEAP_free(ClassName); HEAP_free(ClassName);
return Result; return Result;
} }

View file

@ -114,7 +114,7 @@ GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount)
HEAP_strcpyWtoA(lpszFormatName, lpBuffer, Length); HEAP_strcpyWtoA(lpszFormatName, lpBuffer, Length);
HEAP_free(lpBuffer); HEAP_free(lpBuffer);
DPRINT("GetClipboardFormatNameA(%x): returning %s\n", format, lpszFormatName); DPRINT("GetClipboardFormatNameA(%x): returning %s\n", format, lpszFormatName);
return Length; return Length;
} }
@ -126,7 +126,7 @@ GetClipboardFormatNameW(UINT format, LPWSTR lpszFormatName, INT cchMaxCount)
{ {
UNICODE_STRING FormatName; UNICODE_STRING FormatName;
ULONG Ret; ULONG Ret;
FormatName.Length = 0; FormatName.Length = 0;
FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR); FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR);
FormatName.Buffer = (PWSTR)lpszFormatName; FormatName.Buffer = (PWSTR)lpszFormatName;

View file

@ -44,7 +44,7 @@ User32SetupDefaultCursors(PVOID Arguments, ULONG ArgumentLength)
{ {
BOOL *DefaultCursor = (BOOL*)Arguments; BOOL *DefaultCursor = (BOOL*)Arguments;
LRESULT Result = TRUE; LRESULT Result = TRUE;
if(*DefaultCursor) if(*DefaultCursor)
{ {
/* set default cursor */ /* set default cursor */
@ -56,7 +56,7 @@ User32SetupDefaultCursors(PVOID Arguments, ULONG ArgumentLength)
SetCursor(0); SetCursor(0);
SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW)); SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW));
} }
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS)); return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
} }
@ -70,7 +70,7 @@ HCURSOR STDCALL
CopyCursor(HCURSOR pcur) CopyCursor(HCURSOR pcur)
{ {
ICONINFO IconInfo; ICONINFO IconInfo;
if(NtUserGetCursorIconInfo((HANDLE)pcur, &IconInfo)) if(NtUserGetCursorIconInfo((HANDLE)pcur, &IconInfo))
{ {
return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE); return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE);
@ -124,10 +124,10 @@ CreateCursor(HINSTANCE hInst,
IconInfo.hbmMask = CreateDIBitmap(hScreenDc, &bwBIH->bmiHeader, 0, IconInfo.hbmMask = CreateDIBitmap(hScreenDc, &bwBIH->bmiHeader, 0,
NULL, bwBIH, DIB_RGB_COLORS); NULL, bwBIH, DIB_RGB_COLORS);
if (IconInfo.hbmMask) if (IconInfo.hbmMask)
{ {
SetDIBits(hScreenDc, IconInfo.hbmMask, 0, nHeight, SetDIBits(hScreenDc, IconInfo.hbmMask, 0, nHeight,
pvXORPlane, bwBIH, DIB_RGB_COLORS); pvXORPlane, bwBIH, DIB_RGB_COLORS);
SetDIBits(hScreenDc, IconInfo.hbmMask, nHeight, nHeight, SetDIBits(hScreenDc, IconInfo.hbmMask, nHeight, nHeight,
pvANDPlane, bwBIH, DIB_RGB_COLORS); pvANDPlane, bwBIH, DIB_RGB_COLORS);
} }
else else
@ -141,7 +141,7 @@ CreateCursor(HINSTANCE hInst,
IconInfo.xHotspot = xHotSpot; IconInfo.xHotspot = xHotSpot;
IconInfo.yHotspot = yHotSpot; IconInfo.yHotspot = yHotSpot;
IconInfo.hbmColor = 0; IconInfo.hbmColor = 0;
return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE); return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE);
} }
@ -204,7 +204,7 @@ GetCursorPos(LPPOINT lpPoint)
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
res = NtUserGetCursorPos(lpPoint); res = NtUserGetCursorPos(lpPoint);
return res; return res;
@ -232,7 +232,7 @@ LoadCursorFromFileA(LPCSTR lpFileName)
UNICODE_STRING FileName; UNICODE_STRING FileName;
HCURSOR Result; HCURSOR Result;
RtlCreateUnicodeStringFromAsciiz(&FileName, (LPSTR)lpFileName); RtlCreateUnicodeStringFromAsciiz(&FileName, (LPSTR)lpFileName);
Result = LoadImageW(0, FileName.Buffer, IMAGE_CURSOR, 0, 0, Result = LoadImageW(0, FileName.Buffer, IMAGE_CURSOR, 0, 0,
LR_LOADFROMFILE | LR_DEFAULTSIZE); LR_LOADFROMFILE | LR_DEFAULTSIZE);
RtlFreeUnicodeString(&FileName); RtlFreeUnicodeString(&FileName);
return(Result); return(Result);
@ -245,7 +245,7 @@ LoadCursorFromFileA(LPCSTR lpFileName)
HCURSOR STDCALL HCURSOR STDCALL
LoadCursorFromFileW(LPCWSTR lpFileName) LoadCursorFromFileW(LPCWSTR lpFileName)
{ {
return(LoadImageW(0, lpFileName, IMAGE_CURSOR, 0, 0, return(LoadImageW(0, lpFileName, IMAGE_CURSOR, 0, 0,
LR_LOADFROMFILE | LR_DEFAULTSIZE)); LR_LOADFROMFILE | LR_DEFAULTSIZE));
} }
@ -292,7 +292,7 @@ SetCursorPos(int X,
int Y) int Y)
{ {
INPUT Input; INPUT Input;
Input.type = INPUT_MOUSE; Input.type = INPUT_MOUSE;
Input.mi.dx = (LONG)X; Input.mi.dx = (LONG)X;
Input.mi.dy = (LONG)Y; Input.mi.dy = (LONG)Y;
@ -300,7 +300,7 @@ SetCursorPos(int X,
Input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE; Input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
Input.mi.time = 0; Input.mi.time = 0;
Input.mi.dwExtraInfo = 0; Input.mi.dwExtraInfo = 0;
NtUserSendInput(1, &Input, sizeof(INPUT)); NtUserSendInput(1, &Input, sizeof(INPUT));
return TRUE; return TRUE;
} }

View file

@ -78,7 +78,7 @@ GetSysColor(int nIndex)
{ {
return SysColors[nIndex]; return SysColors[nIndex];
} }
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return 0; return 0;
} }
@ -132,7 +132,7 @@ SetSysColors(
ChangeSysColors.Elements = (INT*)lpaElements; ChangeSysColors.Elements = (INT*)lpaElements;
ChangeSysColors.Colors = (COLORREF*)lpaRgbValues; ChangeSysColors.Colors = (COLORREF*)lpaRgbValues;
if(cElements > 0) if(cElements > 0)
{ {
Ret = NtUserSetSysColors(&ChangeSysColors, cElements); Ret = NtUserSetSysColors(&ChangeSysColors, cElements);
@ -147,7 +147,7 @@ SetSysColors(
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
Ret = FALSE; Ret = FALSE;
} }
return Ret; return Ret;
} }
@ -286,15 +286,15 @@ DefWndHandleSetCursor(HWND hWnd, WPARAM wParam, LPARAM lParam, ULONG Style)
return((LRESULT)SetCursor(LoadCursorW(0, IDC_ARROW))); return((LRESULT)SetCursor(LoadCursorW(0, IDC_ARROW)));
} }
static LONG static LONG
DefWndStartSizeMove(HWND hWnd, WPARAM wParam, POINT *capturePoint) DefWndStartSizeMove(HWND hWnd, WPARAM wParam, POINT *capturePoint)
{ {
LONG hittest = 0; LONG hittest = 0;
POINT pt; POINT pt;
MSG msg; MSG msg;
RECT rectWindow; RECT rectWindow;
ULONG Style = GetWindowLongW(hWnd, GWL_STYLE); ULONG Style = GetWindowLongW(hWnd, GWL_STYLE);
GetWindowRect(hWnd, &rectWindow); GetWindowRect(hWnd, &rectWindow);
if ((wParam & 0xfff0) == SC_MOVE) if ((wParam & 0xfff0) == SC_MOVE)
@ -327,10 +327,10 @@ DefWndStartSizeMove(HWND hWnd, WPARAM wParam, POINT *capturePoint)
if ((hittest < HTLEFT) || (hittest > HTBOTTOMRIGHT)) if ((hittest < HTLEFT) || (hittest > HTBOTTOMRIGHT))
hittest = 0; hittest = 0;
break; break;
case WM_LBUTTONUP: case WM_LBUTTONUP:
return 0; return 0;
case WM_KEYDOWN: case WM_KEYDOWN:
switch(msg.wParam) switch(msg.wParam)
{ {
@ -375,21 +375,21 @@ DefWndStartSizeMove(HWND hWnd, WPARAM wParam, POINT *capturePoint)
#define ON_BOTTOM_BORDER(hit) \ #define ON_BOTTOM_BORDER(hit) \
(((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT)) (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT))
VOID STATIC VOID STATIC
UserDrawWindowFrame(HDC hdc, const RECT *rect, UserDrawWindowFrame(HDC hdc, const RECT *rect,
ULONG width, ULONG height) ULONG width, ULONG height)
{ {
static HBRUSH hDraggingRectBrush = NULL; static HBRUSH hDraggingRectBrush = NULL;
if(!hDraggingRectBrush) if(!hDraggingRectBrush)
{ {
static HBITMAP hDraggingPattern = NULL; static HBITMAP hDraggingPattern = NULL;
const DWORD Pattern[4] = {0x5555AAAA, 0x5555AAAA, 0x5555AAAA, 0x5555AAAA}; const DWORD Pattern[4] = {0x5555AAAA, 0x5555AAAA, 0x5555AAAA, 0x5555AAAA};
hDraggingPattern = CreateBitmap(8, 8, 1, 1, Pattern); hDraggingPattern = CreateBitmap(8, 8, 1, 1, Pattern);
hDraggingRectBrush = CreatePatternBrush(hDraggingPattern); hDraggingRectBrush = CreatePatternBrush(hDraggingPattern);
} }
HBRUSH hbrush = SelectObject( hdc, hDraggingRectBrush ); HBRUSH hbrush = SelectObject( hdc, hDraggingRectBrush );
PatBlt( hdc, rect->left, rect->top, PatBlt( hdc, rect->left, rect->top,
rect->right - rect->left - width, height, PATINVERT ); rect->right - rect->left - width, height, PATINVERT );
@ -427,7 +427,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
POINT minTrack, maxTrack; POINT minTrack, maxTrack;
POINT capturePoint, pt; POINT capturePoint, pt;
ULONG Style = GetWindowLongW(hwnd, GWL_STYLE); ULONG Style = GetWindowLongW(hwnd, GWL_STYLE);
ULONG ExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE); ULONG ExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
BOOL thickframe; BOOL thickframe;
BOOL iconic = Style & WS_MINIMIZE; BOOL iconic = Style & WS_MINIMIZE;
BOOL moved = FALSE; BOOL moved = FALSE;
@ -436,20 +436,20 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
HWND hWndParent = NULL; HWND hWndParent = NULL;
SystemParametersInfoA(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0); SystemParametersInfoA(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0);
pt.x = GET_X_LPARAM(dwPoint); pt.x = GET_X_LPARAM(dwPoint);
pt.y = GET_Y_LPARAM(dwPoint); pt.y = GET_Y_LPARAM(dwPoint);
capturePoint = pt; capturePoint = pt;
if (IsZoomed(hwnd) || !IsWindowVisible(hwnd)) if (IsZoomed(hwnd) || !IsWindowVisible(hwnd))
{ {
return; return;
} }
thickframe = UserHasThickFrameStyle(Style, ExStyle) && !(Style & WS_MINIMIZE); thickframe = UserHasThickFrameStyle(Style, ExStyle) && !(Style & WS_MINIMIZE);
if ((wParam & 0xfff0) == SC_MOVE) if ((wParam & 0xfff0) == SC_MOVE)
{ {
if (!hittest) if (!hittest)
{ {
hittest = DefWndStartSizeMove(hwnd, wParam, &capturePoint); hittest = DefWndStartSizeMove(hwnd, wParam, &capturePoint);
} }
@ -481,7 +481,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
} }
/* Get min/max info */ /* Get min/max info */
WinPosGetMinMaxInfo(hwnd, NULL, NULL, &minTrack, &maxTrack); WinPosGetMinMaxInfo(hwnd, NULL, NULL, &minTrack, &maxTrack);
GetWindowRect(hwnd, &sizingRect); GetWindowRect(hwnd, &sizingRect);
if (Style & WS_CHILD) if (Style & WS_CHILD)
@ -493,7 +493,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
clipRect = mouseRect; clipRect = mouseRect;
MapWindowPoints(hWndParent, HWND_DESKTOP, (LPPOINT)&clipRect, 2); MapWindowPoints(hWndParent, HWND_DESKTOP, (LPPOINT)&clipRect, 2);
} }
else else
{ {
if(!(ExStyle & WS_EX_TOPMOST)) if(!(ExStyle & WS_EX_TOPMOST))
{ {
@ -508,7 +508,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
unmodRect = sizingRect; unmodRect = sizingRect;
} }
ClipCursor(&clipRect); ClipCursor(&clipRect);
origRect = sizingRect; origRect = sizingRect;
if (ON_LEFT_BORDER(hittest)) if (ON_LEFT_BORDER(hittest))
{ {
@ -531,14 +531,14 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y ); mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y );
} }
if (Style & WS_CHILD) if (Style & WS_CHILD)
{ {
MapWindowPoints( hWndParent, 0, (LPPOINT)&mouseRect, 2 ); MapWindowPoints( hWndParent, 0, (LPPOINT)&mouseRect, 2 );
} }
SendMessageA( hwnd, WM_ENTERSIZEMOVE, 0, 0 ); SendMessageA( hwnd, WM_ENTERSIZEMOVE, 0, 0 );
NtUserSetGUIThreadHandle(MSQ_STATE_MOVESIZE, hwnd); NtUserSetGUIThreadHandle(MSQ_STATE_MOVESIZE, hwnd);
if (GetCapture() != hwnd) SetCapture( hwnd ); if (GetCapture() != hwnd) SetCapture( hwnd );
if (Style & WS_CHILD) if (Style & WS_CHILD)
{ {
/* Retrieve a default cache DC (without using the window style) */ /* Retrieve a default cache DC (without using the window style) */
@ -550,9 +550,9 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
hdc = GetDC( 0 ); hdc = GetDC( 0 );
DesktopRgn = CreateRectRgnIndirect(&clipRect); DesktopRgn = CreateRectRgnIndirect(&clipRect);
} }
SelectObject(hdc, DesktopRgn); SelectObject(hdc, DesktopRgn);
if( iconic ) /* create a cursor for dragging */ if( iconic ) /* create a cursor for dragging */
{ {
HICON hIcon = (HICON)GetClassLongW(hwnd, GCL_HICON); HICON hIcon = (HICON)GetClassLongW(hwnd, GCL_HICON);
@ -560,25 +560,25 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
if( hIcon ) hDragCursor = CursorIconToCursor( hIcon, TRUE ); if( hIcon ) hDragCursor = CursorIconToCursor( hIcon, TRUE );
if( !hDragCursor ) iconic = FALSE; if( !hDragCursor ) iconic = FALSE;
} }
/* invert frame if WIN31_LOOK to indicate mouse click on caption */ /* invert frame if WIN31_LOOK to indicate mouse click on caption */
if( !iconic && !DragFullWindows) if( !iconic && !DragFullWindows)
{ {
UserDrawMovingFrame( hdc, &sizingRect, thickframe); UserDrawMovingFrame( hdc, &sizingRect, thickframe);
} }
for(;;) for(;;)
{ {
int dx = 0, dy = 0; int dx = 0, dy = 0;
if (GetMessageW(&msg, 0, 0, 0) <= 0) if (GetMessageW(&msg, 0, 0, 0) <= 0)
break; break;
/* Exit on button-up, Return, or Esc */ /* Exit on button-up, Return, or Esc */
if ((msg.message == WM_LBUTTONUP) || if ((msg.message == WM_LBUTTONUP) ||
((msg.message == WM_KEYDOWN) && ((msg.message == WM_KEYDOWN) &&
((msg.wParam == VK_RETURN) || (msg.wParam == VK_ESCAPE)))) break; ((msg.wParam == VK_RETURN) || (msg.wParam == VK_ESCAPE)))) break;
if (msg.message == WM_PAINT) if (msg.message == WM_PAINT)
{ {
if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe ); if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe );
@ -586,47 +586,47 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe ); if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe );
continue; continue;
} }
if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE)) if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE))
continue; /* We are not interested in other messages */ continue; /* We are not interested in other messages */
pt = msg.pt; pt = msg.pt;
if (msg.message == WM_KEYDOWN) switch(msg.wParam) if (msg.message == WM_KEYDOWN) switch(msg.wParam)
{ {
case VK_UP: pt.y -= 8; break; case VK_UP: pt.y -= 8; break;
case VK_DOWN: pt.y += 8; break; case VK_DOWN: pt.y += 8; break;
case VK_LEFT: pt.x -= 8; break; case VK_LEFT: pt.x -= 8; break;
case VK_RIGHT: pt.x += 8; break; case VK_RIGHT: pt.x += 8; break;
} }
pt.x = max( pt.x, mouseRect.left ); pt.x = max( pt.x, mouseRect.left );
pt.x = min( pt.x, mouseRect.right ); pt.x = min( pt.x, mouseRect.right );
pt.y = max( pt.y, mouseRect.top ); pt.y = max( pt.y, mouseRect.top );
pt.y = min( pt.y, mouseRect.bottom ); pt.y = min( pt.y, mouseRect.bottom );
dx = pt.x - capturePoint.x; dx = pt.x - capturePoint.x;
dy = pt.y - capturePoint.y; dy = pt.y - capturePoint.y;
if (dx || dy) if (dx || dy)
{ {
if( !moved ) if( !moved )
{ {
moved = TRUE; moved = TRUE;
if( iconic ) /* ok, no system popup tracking */ if( iconic ) /* ok, no system popup tracking */
{ {
hOldCursor = SetCursor(hDragCursor); hOldCursor = SetCursor(hDragCursor);
ShowCursor( TRUE ); ShowCursor( TRUE );
} }
} }
if (msg.message == WM_KEYDOWN) SetCursorPos( pt.x, pt.y ); if (msg.message == WM_KEYDOWN) SetCursorPos( pt.x, pt.y );
else else
{ {
RECT newRect = unmodRect; RECT newRect = unmodRect;
WPARAM wpSizingHit = 0; WPARAM wpSizingHit = 0;
if (hittest == HTCAPTION) OffsetRect( &newRect, dx, dy ); if (hittest == HTCAPTION) OffsetRect( &newRect, dx, dy );
if (ON_LEFT_BORDER(hittest)) newRect.left += dx; if (ON_LEFT_BORDER(hittest)) newRect.left += dx;
else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx; else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
@ -634,13 +634,13 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy; else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe ); if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe );
capturePoint = pt; capturePoint = pt;
/* determine the hit location */ /* determine the hit location */
if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT) if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT)
wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT); wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT);
unmodRect = newRect; unmodRect = newRect;
SendMessageA( hwnd, WM_SIZING, wpSizingHit, (LPARAM)&newRect ); SendMessageA( hwnd, WM_SIZING, wpSizingHit, (LPARAM)&newRect );
if (!iconic) if (!iconic)
{ {
if(!DragFullWindows) if(!DragFullWindows)
@ -658,7 +658,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
} }
} }
} }
ReleaseCapture(); ReleaseCapture();
ClipCursor(NULL); ClipCursor(NULL);
if( iconic ) if( iconic )
@ -672,7 +672,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
} }
else if(!DragFullWindows) else if(!DragFullWindows)
UserDrawMovingFrame( hdc, &sizingRect, thickframe ); UserDrawMovingFrame( hdc, &sizingRect, thickframe );
if (Style & WS_CHILD) if (Style & WS_CHILD)
ReleaseDC( hWndParent, hdc ); ReleaseDC( hWndParent, hdc );
else else
@ -686,7 +686,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
NtUserSetGUIThreadHandle(MSQ_STATE_MOVESIZE, NULL); NtUserSetGUIThreadHandle(MSQ_STATE_MOVESIZE, NULL);
SendMessageA( hwnd, WM_EXITSIZEMOVE, 0, 0 ); SendMessageA( hwnd, WM_EXITSIZEMOVE, 0, 0 );
SendMessageA( hwnd, WM_SETVISIBLE, !IsIconic(hwnd), 0L); SendMessageA( hwnd, WM_SETVISIBLE, !IsIconic(hwnd), 0L);
/* window moved or resized */ /* window moved or resized */
if (moved) if (moved)
{ {
@ -708,17 +708,17 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
origRect.right - origRect.left, origRect.right - origRect.left,
origRect.bottom - origRect.top, origRect.bottom - origRect.top,
( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 ); ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
} }
} }
if( IsWindow(hwnd) ) if( IsWindow(hwnd) )
if( Style & WS_MINIMIZE ) if( Style & WS_MINIMIZE )
{ {
/* Single click brings up the system menu when iconized */ /* Single click brings up the system menu when iconized */
if( !moved ) if( !moved )
{ {
if( Style & WS_SYSMENU ) if( Style & WS_SYSMENU )
SendMessageA( hwnd, WM_SYSCOMMAND, SendMessageA( hwnd, WM_SYSCOMMAND,
SC_MOUSEMENU + HTSYSMENU, MAKELONG(pt.x,pt.y)); SC_MOUSEMENU + HTSYSMENU, MAKELONG(pt.x,pt.y));
} }
@ -760,7 +760,7 @@ LRESULT
DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, POINT Pt) DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, POINT Pt)
{ {
WINDOWPLACEMENT wp; WINDOWPLACEMENT wp;
switch (wParam & 0xfff0) switch (wParam & 0xfff0)
{ {
case SC_MOVE: case SC_MOVE:
@ -933,7 +933,7 @@ DefWndControlColor(HDC hDC, UINT ctlType)
VOID FASTCALL VOID FASTCALL
DefWndScreenshot(HWND hWnd) DefWndScreenshot(HWND hWnd)
{ {
} }
LRESULT STDCALL LRESULT STDCALL
@ -1028,9 +1028,9 @@ User32DefWindowProc(HWND hWnd,
POINT Pt; POINT Pt;
DWORD Style; DWORD Style;
LONG HitCode; LONG HitCode;
Style = GetWindowLongW(hWnd, GWL_STYLE); Style = GetWindowLongW(hWnd, GWL_STYLE);
Pt.x = GET_X_LPARAM(lParam); Pt.x = GET_X_LPARAM(lParam);
Pt.y = GET_Y_LPARAM(lParam); Pt.y = GET_Y_LPARAM(lParam);
if (Style & WS_CHILD) if (Style & WS_CHILD)
@ -1044,17 +1044,17 @@ User32DefWindowProc(HWND hWnd,
{ {
HMENU SystemMenu; HMENU SystemMenu;
UINT Flags; UINT Flags;
if((SystemMenu = GetSystemMenu(hWnd, FALSE))) if((SystemMenu = GetSystemMenu(hWnd, FALSE)))
{ {
MenuInitSysMenuPopup(SystemMenu, GetWindowLongW(hWnd, GWL_STYLE), MenuInitSysMenuPopup(SystemMenu, GetWindowLongW(hWnd, GWL_STYLE),
GetClassLongW(hWnd, GCL_STYLE), HitCode); GetClassLongW(hWnd, GCL_STYLE), HitCode);
if(HitCode == HTCAPTION) if(HitCode == HTCAPTION)
Flags = TPM_LEFTBUTTON | TPM_RIGHTBUTTON; Flags = TPM_LEFTBUTTON | TPM_RIGHTBUTTON;
else else
Flags = TPM_LEFTBUTTON; Flags = TPM_LEFTBUTTON;
TrackPopupMenu(SystemMenu, Flags, TrackPopupMenu(SystemMenu, Flags,
Pt.x, Pt.y, 0, hWnd, NULL); Pt.x, Pt.y, 0, hWnd, NULL);
} }
@ -1062,7 +1062,7 @@ User32DefWindowProc(HWND hWnd,
} }
break; break;
} }
case WM_PRINT: case WM_PRINT:
{ {
/* FIXME: Implement. */ /* FIXME: Implement. */
@ -1075,7 +1075,7 @@ User32DefWindowProc(HWND hWnd,
PAINTSTRUCT Ps; PAINTSTRUCT Ps;
HDC hDC = BeginPaint(hWnd, &Ps); HDC hDC = BeginPaint(hWnd, &Ps);
if (hDC) if (hDC)
{ {
HICON hIcon; HICON hIcon;
if (GetWindowLongW(hWnd, GWL_STYLE) & WS_MINIMIZE && if (GetWindowLongW(hWnd, GWL_STYLE) & WS_MINIMIZE &&
(hIcon = (HICON)GetClassLongW(hWnd, GCL_HICON)) != NULL) (hIcon = (HICON)GetClassLongW(hWnd, GCL_HICON)) != NULL)
@ -1088,7 +1088,7 @@ User32DefWindowProc(HWND hWnd,
y = (ClientRect.bottom - ClientRect.top - y = (ClientRect.bottom - ClientRect.top -
GetSystemMetrics(SM_CYICON)) / 2; GetSystemMetrics(SM_CYICON)) / 2;
DrawIcon(hDC, x, y, hIcon); DrawIcon(hDC, x, y, hIcon);
} }
EndPaint(hWnd, &Ps); EndPaint(hWnd, &Ps);
} }
return (0); return (0);
@ -1195,7 +1195,7 @@ User32DefWindowProc(HWND hWnd,
FillRect((HDC)wParam, &Rect, hBrush); FillRect((HDC)wParam, &Rect, hBrush);
return (1); return (1);
} }
case WM_CTLCOLORMSGBOX: case WM_CTLCOLORMSGBOX:
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
case WM_CTLCOLORLISTBOX: case WM_CTLCOLORLISTBOX:
@ -1208,7 +1208,7 @@ User32DefWindowProc(HWND hWnd,
case WM_SETCURSOR: case WM_SETCURSOR:
{ {
ULONG Style = GetWindowLongW(hWnd, GWL_STYLE); ULONG Style = GetWindowLongW(hWnd, GWL_STYLE);
if (Style & WS_CHILD) if (Style & WS_CHILD)
{ {
if (LOWORD(lParam) < HTLEFT || LOWORD(lParam) > HTBOTTOMRIGHT) if (LOWORD(lParam) < HTLEFT || LOWORD(lParam) > HTBOTTOMRIGHT)
@ -1272,7 +1272,7 @@ User32DefWindowProc(HWND hWnd,
} }
break; break;
} }
case WM_SHOWWINDOW: case WM_SHOWWINDOW:
{ {
LONG Style; LONG Style;
@ -1307,7 +1307,7 @@ User32DefWindowProc(HWND hWnd,
return (-1); return (-1);
/* /*
case WM_DROPOBJECT: case WM_DROPOBJECT:
break; break;
*/ */
case WM_QUERYDROPOBJECT: case WM_QUERYDROPOBJECT:
@ -1382,7 +1382,7 @@ User32DefWindowProc(HWND hWnd,
} }
break; break;
} }
case WM_SYSTIMER: case WM_SYSTIMER:
{ {
THRDCARETINFO CaretInfo; THRDCARETINFO CaretInfo;
@ -1457,7 +1457,7 @@ DefWindowProcA(HWND hWnd,
{ {
ANSI_STRING AnsiString; ANSI_STRING AnsiString;
UNICODE_STRING UnicodeString; UNICODE_STRING UnicodeString;
if(lParam) if(lParam)
{ {
RtlInitAnsiString(&AnsiString, (LPSTR)lParam); RtlInitAnsiString(&AnsiString, (LPSTR)lParam);
@ -1467,7 +1467,7 @@ DefWindowProcA(HWND hWnd,
} }
else else
NtUserDefSetText(hWnd, NULL); NtUserDefSetText(hWnd, NULL);
if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION) if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
{ {
DefWndNCPaint(hWnd, (HRGN)1, -1); DefWndNCPaint(hWnd, (HRGN)1, -1);
@ -1525,9 +1525,9 @@ DefWindowProcW(HWND hWnd,
if(lParam) if(lParam)
RtlInitUnicodeString(&UnicodeString, (LPWSTR)lParam); RtlInitUnicodeString(&UnicodeString, (LPWSTR)lParam);
NtUserDefSetText(hWnd, (lParam ? &UnicodeString : NULL)); NtUserDefSetText(hWnd, (lParam ? &UnicodeString : NULL));
if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION) if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
{ {
DefWndNCPaint(hWnd, (HRGN)1, -1); DefWndNCPaint(hWnd, (HRGN)1, -1);

View file

@ -233,7 +233,7 @@ static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info,
info->y = GET_WORD(p); p++; info->y = GET_WORD(p); p++;
info->cx = GET_WORD(p); p++; info->cx = GET_WORD(p); p++;
info->cy = GET_WORD(p); p++; info->cy = GET_WORD(p); p++;
if (dialogEx) if (dialogEx)
{ {
/* id is a DWORD for DIALOGEX */ /* id is a DWORD for DIALOGEX */
@ -245,7 +245,7 @@ static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info,
info->id = GET_WORD(p); info->id = GET_WORD(p);
p++; p++;
} }
if (GET_WORD(p) == 0xffff) if (GET_WORD(p) == 0xffff)
{ {
static const WCHAR class_names[6][10] = static const WCHAR class_names[6][10] =
@ -274,7 +274,7 @@ static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info,
info->className = (LPCWSTR)p; info->className = (LPCWSTR)p;
p += wcslen( info->className ) + 1; p += wcslen( info->className ) + 1;
} }
if (GET_WORD(p) == 0xffff) /* Is it an integer id? */ if (GET_WORD(p) == 0xffff) /* Is it an integer id? */
{ {
info->windowName = HeapAlloc( GetProcessHeap(), 0, 10 ); info->windowName = HeapAlloc( GetProcessHeap(), 0, 10 );
@ -288,7 +288,7 @@ static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info,
info->windowNameFree = FALSE; info->windowNameFree = FALSE;
p += wcslen( info->windowName ) + 1; p += wcslen( info->windowName ) + 1;
} }
if (GET_WORD(p)) if (GET_WORD(p))
{ {
info->data = p + 1; info->data = p + 1;
@ -296,9 +296,9 @@ static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info,
} }
else info->data = NULL; else info->data = NULL;
p++; p++;
/* Next control is on dword boundary */ /* Next control is on dword boundary */
return (const WORD *)((((int)p) + 3) & ~3); return (const WORD *)((((int)p) + 3) & ~3);
} }
/*********************************************************************** /***********************************************************************
@ -366,7 +366,7 @@ static BOOL DIALOG_CreateControls32( HWND hwnd, LPCSTR template, const DLG_TEMPL
if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class ); if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class );
if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption ); if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption );
} }
if (info.windowNameFree) if (info.windowNameFree)
{ {
HeapFree( GetProcessHeap(), 0, (LPVOID)info.windowName ); HeapFree( GetProcessHeap(), 0, (LPVOID)info.windowName );
@ -411,7 +411,7 @@ static HWND DIALOG_FindMsgDestination( HWND hwndDlg )
{ {
HWND hParent = GetParent(hwndDlg); HWND hParent = GetParent(hwndDlg);
if (!hParent) break; if (!hParent) break;
if (!IsWindow(hParent)) break; if (!IsWindow(hParent)) break;
if (!GETDLGINFO(hParent)) /* TODO: Correct? */ if (!GETDLGINFO(hParent)) /* TODO: Correct? */
@ -589,9 +589,9 @@ static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result )
p += wcslen( result->menuName ) + 1; p += wcslen( result->menuName ) + 1;
break; break;
} }
/* Get the class name */ /* Get the class name */
switch(GET_WORD(p)) switch(GET_WORD(p))
{ {
case 0x0000: case 0x0000:
@ -607,7 +607,7 @@ static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result )
p += wcslen( result->className ) + 1; p += wcslen( result->className ) + 1;
break; break;
} }
/* Get the window caption */ /* Get the window caption */
result->caption = (LPCWSTR)p; result->caption = (LPCWSTR)p;
@ -669,7 +669,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
dlgTemplate = DIALOG_ParseTemplate32( dlgTemplate, &template ); dlgTemplate = DIALOG_ParseTemplate32( dlgTemplate, &template );
/* Initialise dialog extra data */ /* Initialise dialog extra data */
if (!(dlgInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo) ))) return 0; if (!(dlgInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo) ))) return 0;
dlgInfo->hwndFocus = 0; dlgInfo->hwndFocus = 0;
dlgInfo->hUserFont = 0; dlgInfo->hUserFont = 0;
@ -679,11 +679,11 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
dlgInfo->idResult = 0; dlgInfo->idResult = 0;
dlgInfo->flags = 0; dlgInfo->flags = 0;
//dlgInfo->hDialogHeap = 0; //dlgInfo->hDialogHeap = 0;
/* Load menu */ /* Load menu */
if (template.menuName) dlgInfo->hMenu = LoadMenuW( hInst, template.menuName ); if (template.menuName) dlgInfo->hMenu = LoadMenuW( hInst, template.menuName );
/* Create custom font if needed */ /* Create custom font if needed */
if (template.style & DS_SETFONT) if (template.style & DS_SETFONT)
@ -758,7 +758,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
if( rect.top < 0 ) rect.top = 0; if( rect.top < 0 ) rect.top = 0;
} }
} }
if (modal) if (modal)
{ {
ownerEnabled = DIALOG_DisableOwner( owner ); ownerEnabled = DIALOG_DisableOwner( owner );
@ -795,7 +795,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
owner, dlgInfo->hMenu, hInst, NULL ); owner, dlgInfo->hMenu, hInst, NULL );
if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class ); if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class );
if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption ); if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption );
} }
if (!hwnd) if (!hwnd)
{ {
@ -819,12 +819,12 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
SETDLGINFO(hwnd, dlgInfo); SETDLGINFO(hwnd, dlgInfo);
SetWindowLongA( hwnd, DWL_DLGPROC, (LONG)dlgProc ); SetWindowLongA( hwnd, DWL_DLGPROC, (LONG)dlgProc );
} }
if (dlgInfo->hUserFont) if (dlgInfo->hUserFont)
SendMessageA( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 ); SendMessageA( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 );
/* Create controls */ /* Create controls */
if (DIALOG_CreateControls32( hwnd, dlgTemplate, &template, hInst, unicode )) if (DIALOG_CreateControls32( hwnd, dlgTemplate, &template, hInst, unicode ))
{ {
/* Send initialisation messages and set focus */ /* Send initialisation messages and set focus */
@ -843,7 +843,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
} }
return hwnd; return hwnd;
} }
if( IsWindow(hwnd) ) DestroyWindow( hwnd ); if( IsWindow(hwnd) ) DestroyWindow( hwnd );
if (modal && ownerEnabled) DIALOG_EnableOwner(owner); if (modal && ownerEnabled) DIALOG_EnableOwner(owner);
return 0; return 0;
@ -874,7 +874,7 @@ static void DEFDLG_SetFocus( HWND hwndDlg, HWND hwndCtrl )
*/ */
static void DEFDLG_SaveFocus( HWND hwnd ) static void DEFDLG_SaveFocus( HWND hwnd )
{ {
DIALOGINFO *infoPtr; DIALOGINFO *infoPtr;
HWND hwndFocus = GetFocus(); HWND hwndFocus = GetFocus();
if (!hwndFocus || !IsChild( hwnd, hwndFocus )) return; if (!hwndFocus || !IsChild( hwnd, hwndFocus )) return;
@ -985,7 +985,7 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
GlobalFree16(dlgInfo->hDialogHeap); GlobalFree16(dlgInfo->hDialogHeap);
}*/ }*/
if (dlgInfo->hUserFont) DeleteObject( dlgInfo->hUserFont ); if (dlgInfo->hUserFont) DeleteObject( dlgInfo->hUserFont );
if (dlgInfo->hMenu) DestroyMenu( dlgInfo->hMenu ); if (dlgInfo->hMenu) DestroyMenu( dlgInfo->hMenu );
HeapFree( GetProcessHeap(), 0, dlgInfo ); HeapFree( GetProcessHeap(), 0, dlgInfo );
} }
/* Window clean-up */ /* Window clean-up */
@ -1337,8 +1337,8 @@ BOOL CALLBACK GetDlgItemEnumProc (HWND hwnd, LPARAM lParam )
{ {
GETDLGITEMINFO * info = (GETDLGITEMINFO *)lParam; GETDLGITEMINFO * info = (GETDLGITEMINFO *)lParam;
if(info->nIDDlgItem == GetWindowLongW( hwnd, GWL_ID )) if(info->nIDDlgItem == GetWindowLongW( hwnd, GWL_ID ))
{ {
info->control = hwnd; info->control = hwnd;
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
@ -1458,7 +1458,7 @@ DefDlgProcA(
DIALOGINFO * dlgInfo; DIALOGINFO * dlgInfo;
/* if there's no dialog info property then call default windows proc?? */ /* if there's no dialog info property then call default windows proc?? */
if (!(dlgInfo = GETDLGINFO(hDlg))) if (!(dlgInfo = GETDLGINFO(hDlg)))
return DefWindowProcA( hDlg, Msg, wParam, lParam ); return DefWindowProcA( hDlg, Msg, wParam, lParam );
SetWindowLongW( hDlg, DWL_MSGRESULT, 0 ); SetWindowLongW( hDlg, DWL_MSGRESULT, 0 );
@ -1519,7 +1519,7 @@ DefDlgProcW(
DIALOGINFO * dlgInfo; DIALOGINFO * dlgInfo;
/* if there's no dialog info property then call default windows proc?? */ /* if there's no dialog info property then call default windows proc?? */
if (!(dlgInfo = GETDLGINFO(hDlg))) if (!(dlgInfo = GETDLGINFO(hDlg)))
return DefWindowProcW( hDlg, Msg, wParam, lParam ); return DefWindowProcW( hDlg, Msg, wParam, lParam );
SetWindowLongW( hDlg, DWL_MSGRESULT, 0 ); SetWindowLongW( hDlg, DWL_MSGRESULT, 0 );
@ -1636,7 +1636,7 @@ DialogBoxParamA(
HWND hwnd; HWND hwnd;
HRSRC hrsrc; HRSRC hrsrc;
LPCDLGTEMPLATE ptr; LPCDLGTEMPLATE ptr;
if (!(hrsrc = FindResourceA( hInstance, lpTemplateName, (LPCSTR)RT_DIALOG ))) return 0; if (!(hrsrc = FindResourceA( hInstance, lpTemplateName, (LPCSTR)RT_DIALOG ))) return 0;
if (!(ptr = (LPCDLGTEMPLATE)LoadResource(hInstance, hrsrc))) return 0; if (!(ptr = (LPCDLGTEMPLATE)LoadResource(hInstance, hrsrc))) return 0;
hwnd = DIALOG_CreateIndirect(hInstance, ptr, hWndParent, lpDialogFunc, dwInitParam, FALSE, TRUE); hwnd = DIALOG_CreateIndirect(hInstance, ptr, hWndParent, lpDialogFunc, dwInitParam, FALSE, TRUE);
@ -1660,7 +1660,7 @@ DialogBoxParamW(
HWND hwnd; HWND hwnd;
HRSRC hrsrc; HRSRC hrsrc;
LPCDLGTEMPLATE ptr; LPCDLGTEMPLATE ptr;
if (!(hrsrc = FindResourceW( hInstance, lpTemplateName, (LPCWSTR)RT_DIALOG ))) return 0; if (!(hrsrc = FindResourceW( hInstance, lpTemplateName, (LPCWSTR)RT_DIALOG ))) return 0;
if (!(ptr = (LPCDLGTEMPLATE)LoadResource(hInstance, hrsrc))) return 0; if (!(ptr = (LPCDLGTEMPLATE)LoadResource(hInstance, hrsrc))) return 0;
hwnd = DIALOG_CreateIndirect(hInstance, ptr, hWndParent, lpDialogFunc, dwInitParam, TRUE, TRUE); hwnd = DIALOG_CreateIndirect(hInstance, ptr, hWndParent, lpDialogFunc, dwInitParam, TRUE, TRUE);
@ -1811,7 +1811,7 @@ EndDialog(
HWND owner; HWND owner;
if (!(dlgInfo = GETDLGINFO(hDlg))) return FALSE; if (!(dlgInfo = GETDLGINFO(hDlg))) return FALSE;
dlgInfo->idResult = nResult; dlgInfo->idResult = nResult;
dlgInfo->flags |= DF_END; dlgInfo->flags |= DF_END;
wasEnabled = (dlgInfo->flags & DF_OWNERENABLED); wasEnabled = (dlgInfo->flags & DF_OWNERENABLED);
@ -2058,20 +2058,20 @@ IsDialogMessageA(
LPMSG lpMsg) LPMSG lpMsg)
{ {
INT dlgCode = 0; INT dlgCode = 0;
// FIXME: hooks // FIXME: hooks
//if (CallMsgFilterA( lpMsg, MSGF_DIALOGBOX )) return TRUE; //if (CallMsgFilterA( lpMsg, MSGF_DIALOGBOX )) return TRUE;
if ((hDlg != lpMsg->hwnd) && !IsChild( hDlg, lpMsg->hwnd )) return FALSE; if ((hDlg != lpMsg->hwnd) && !IsChild( hDlg, lpMsg->hwnd )) return FALSE;
hDlg = DIALOG_FindMsgDestination(hDlg); hDlg = DIALOG_FindMsgDestination(hDlg);
switch(lpMsg->message) switch(lpMsg->message)
{ {
case WM_KEYDOWN: case WM_KEYDOWN:
dlgCode = SendMessageA( lpMsg->hwnd, WM_GETDLGCODE, lpMsg->wParam, (LPARAM)lpMsg ); dlgCode = SendMessageA( lpMsg->hwnd, WM_GETDLGCODE, lpMsg->wParam, (LPARAM)lpMsg );
if (dlgCode & DLGC_WANTMESSAGE) break; if (dlgCode & DLGC_WANTMESSAGE) break;
switch(lpMsg->wParam) switch(lpMsg->wParam)
{ {
case VK_TAB: case VK_TAB:
@ -2081,7 +2081,7 @@ IsDialogMessageA(
return TRUE; return TRUE;
} }
break; break;
case VK_RIGHT: case VK_RIGHT:
case VK_DOWN: case VK_DOWN:
case VK_LEFT: case VK_LEFT:
@ -2094,12 +2094,12 @@ IsDialogMessageA(
return TRUE; return TRUE;
} }
break; break;
case VK_CANCEL: case VK_CANCEL:
case VK_ESCAPE: case VK_ESCAPE:
SendMessageA( hDlg, WM_COMMAND, IDCANCEL, (LPARAM)GetDlgItem( hDlg, IDCANCEL ) ); SendMessageA( hDlg, WM_COMMAND, IDCANCEL, (LPARAM)GetDlgItem( hDlg, IDCANCEL ) );
return TRUE; return TRUE;
case VK_EXECUTE: case VK_EXECUTE:
case VK_RETURN: case VK_RETURN:
{ {
@ -2112,19 +2112,19 @@ IsDialogMessageA(
else else
{ {
SendMessageA( hDlg, WM_COMMAND, IDOK, (LPARAM)GetDlgItem( hDlg, IDOK ) ); SendMessageA( hDlg, WM_COMMAND, IDOK, (LPARAM)GetDlgItem( hDlg, IDOK ) );
} }
} }
return TRUE; return TRUE;
} }
break; break;
case WM_CHAR: case WM_CHAR:
dlgCode = SendMessageA( lpMsg->hwnd, WM_GETDLGCODE, lpMsg->wParam, (LPARAM)lpMsg ); dlgCode = SendMessageA( lpMsg->hwnd, WM_GETDLGCODE, lpMsg->wParam, (LPARAM)lpMsg );
if (dlgCode & (DLGC_WANTCHARS|DLGC_WANTMESSAGE)) break; if (dlgCode & (DLGC_WANTCHARS|DLGC_WANTMESSAGE)) break;
if (lpMsg->wParam == '\t' && (dlgCode & DLGC_WANTTAB)) break; if (lpMsg->wParam == '\t' && (dlgCode & DLGC_WANTTAB)) break;
/* drop through */ /* drop through */
case WM_SYSCHAR: case WM_SYSCHAR:
if (DIALOG_IsAccelerator( lpMsg->hwnd, hDlg, lpMsg->wParam )) if (DIALOG_IsAccelerator( lpMsg->hwnd, hDlg, lpMsg->wParam ))
{ {
@ -2133,7 +2133,7 @@ IsDialogMessageA(
} }
break; break;
} }
TranslateMessage( lpMsg ); TranslateMessage( lpMsg );
DispatchMessageA( lpMsg ); DispatchMessageA( lpMsg );
return TRUE; return TRUE;
@ -2150,20 +2150,20 @@ IsDialogMessageW(
LPMSG lpMsg) LPMSG lpMsg)
{ {
INT dlgCode = 0; INT dlgCode = 0;
// FIXME: hooks // FIXME: hooks
//if (CallMsgFilterW( lpMsg, MSGF_DIALOGBOX )) return TRUE; //if (CallMsgFilterW( lpMsg, MSGF_DIALOGBOX )) return TRUE;
if ((hDlg != lpMsg->hwnd) && !IsChild( hDlg, lpMsg->hwnd )) return FALSE; if ((hDlg != lpMsg->hwnd) && !IsChild( hDlg, lpMsg->hwnd )) return FALSE;
hDlg = DIALOG_FindMsgDestination(hDlg); hDlg = DIALOG_FindMsgDestination(hDlg);
switch(lpMsg->message) switch(lpMsg->message)
{ {
case WM_KEYDOWN: case WM_KEYDOWN:
dlgCode = SendMessageW( lpMsg->hwnd, WM_GETDLGCODE, lpMsg->wParam, (LPARAM)lpMsg ); dlgCode = SendMessageW( lpMsg->hwnd, WM_GETDLGCODE, lpMsg->wParam, (LPARAM)lpMsg );
if (dlgCode & DLGC_WANTMESSAGE) break; if (dlgCode & DLGC_WANTMESSAGE) break;
switch(lpMsg->wParam) switch(lpMsg->wParam)
{ {
case VK_TAB: case VK_TAB:
@ -2173,7 +2173,7 @@ IsDialogMessageW(
return TRUE; return TRUE;
} }
break; break;
case VK_RIGHT: case VK_RIGHT:
case VK_DOWN: case VK_DOWN:
case VK_LEFT: case VK_LEFT:
@ -2186,12 +2186,12 @@ IsDialogMessageW(
return TRUE; return TRUE;
} }
break; break;
case VK_CANCEL: case VK_CANCEL:
case VK_ESCAPE: case VK_ESCAPE:
SendMessageW( hDlg, WM_COMMAND, IDCANCEL, (LPARAM)GetDlgItem( hDlg, IDCANCEL ) ); SendMessageW( hDlg, WM_COMMAND, IDCANCEL, (LPARAM)GetDlgItem( hDlg, IDCANCEL ) );
return TRUE; return TRUE;
case VK_EXECUTE: case VK_EXECUTE:
case VK_RETURN: case VK_RETURN:
{ {
@ -2204,19 +2204,19 @@ IsDialogMessageW(
else else
{ {
SendMessageW( hDlg, WM_COMMAND, IDOK, (LPARAM)GetDlgItem( hDlg, IDOK ) ); SendMessageW( hDlg, WM_COMMAND, IDOK, (LPARAM)GetDlgItem( hDlg, IDOK ) );
} }
} }
return TRUE; return TRUE;
} }
break; break;
case WM_CHAR: case WM_CHAR:
dlgCode = SendMessageW( lpMsg->hwnd, WM_GETDLGCODE, lpMsg->wParam, (LPARAM)lpMsg ); dlgCode = SendMessageW( lpMsg->hwnd, WM_GETDLGCODE, lpMsg->wParam, (LPARAM)lpMsg );
if (dlgCode & (DLGC_WANTCHARS|DLGC_WANTMESSAGE)) break; if (dlgCode & (DLGC_WANTCHARS|DLGC_WANTMESSAGE)) break;
if (lpMsg->wParam == '\t' && (dlgCode & DLGC_WANTTAB)) break; if (lpMsg->wParam == '\t' && (dlgCode & DLGC_WANTTAB)) break;
/* drop through */ /* drop through */
case WM_SYSCHAR: case WM_SYSCHAR:
if (DIALOG_IsAccelerator( lpMsg->hwnd, hDlg, lpMsg->wParam )) if (DIALOG_IsAccelerator( lpMsg->hwnd, hDlg, lpMsg->wParam ))
{ {
@ -2225,7 +2225,7 @@ IsDialogMessageW(
} }
break; break;
} }
TranslateMessage( lpMsg ); TranslateMessage( lpMsg );
DispatchMessageW( lpMsg ); DispatchMessageW( lpMsg );
return TRUE; return TRUE;
@ -2366,7 +2366,7 @@ static BOOL CALLBACK CheckRB(HWND hwnd, LPARAM lParam)
{ {
LONG lChildID = GetWindowLongW(hwnd, GWL_ID); LONG lChildID = GetWindowLongW(hwnd, GWL_ID);
RADIOGROUP *lpRadioGroup = (RADIOGROUP *)lParam; RADIOGROUP *lpRadioGroup = (RADIOGROUP *)lParam;
if((lChildID >= lpRadioGroup->firstID) && if((lChildID >= lpRadioGroup->firstID) &&
(lChildID <= lpRadioGroup->lastID)) (lChildID <= lpRadioGroup->lastID))
{ {
@ -2379,7 +2379,7 @@ static BOOL CALLBACK CheckRB(HWND hwnd, LPARAM lParam)
SendMessageW(hwnd, BM_SETCHECK, BST_UNCHECKED, 0); SendMessageW(hwnd, BM_SETCHECK, BST_UNCHECKED, 0);
} }
} }
return TRUE; return TRUE;
} }
@ -2395,11 +2395,11 @@ CheckRadioButton(
int nIDCheckButton) int nIDCheckButton)
{ {
RADIOGROUP radioGroup; RADIOGROUP radioGroup;
radioGroup.firstID = nIDFirstButton; radioGroup.firstID = nIDFirstButton;
radioGroup.lastID = nIDLastButton; radioGroup.lastID = nIDLastButton;
radioGroup.checkID = nIDCheckButton; radioGroup.checkID = nIDCheckButton;
return EnumChildWindows(hDlg, CheckRB, (LPARAM)&radioGroup); return EnumChildWindows(hDlg, CheckRB, (LPARAM)&radioGroup);
} }

View file

@ -1370,21 +1370,21 @@ IntGrayString(
ForeColor = SetTextColor(hDC, RGB(0, 0, 0)); ForeColor = SetTextColor(hDC, RGB(0, 0, 0));
BackColor = SetBkColor(hDC, RGB(255, 255, 255)); BackColor = SetBkColor(hDC, RGB(255, 255, 255));
if (! hBrush) if (! hBrush)
{ {
// The documentation is a little vague on what exactly should happen // The documentation is a little vague on what exactly should happen
// here. Something about using the same brush for window text??? // here. Something about using the same brush for window text???
hBrush = (HBRUSH) GetCurrentObject(hDC, OBJ_BRUSH); hBrush = (HBRUSH) GetCurrentObject(hDC, OBJ_BRUSH);
} }
if ((nCount == -1) && (! lpOutputFunc)) if ((nCount == -1) && (! lpOutputFunc))
return FALSE; return FALSE;
if (! nCount) if (! nCount)
{ {
// TODO: calculate the length (easy enough) // TODO: calculate the length (easy enough)
if (unicode) if (unicode)
nCount = lstrlenW((WCHAR*)lpData); nCount = lstrlenW((WCHAR*)lpData);
else else
@ -1395,19 +1395,19 @@ IntGrayString(
{ {
SIZE s; SIZE s;
// TODO: calculate the rect // TODO: calculate the rect
if (unicode) if (unicode)
success = GetTextExtentPoint32W(hDC, (WCHAR*) lpData, nCount, &s); success = GetTextExtentPoint32W(hDC, (WCHAR*) lpData, nCount, &s);
else else
success = GetTextExtentPoint32A(hDC, (CHAR*) lpData, nCount, &s); success = GetTextExtentPoint32A(hDC, (CHAR*) lpData, nCount, &s);
if (! success) goto cleanup; if (! success) goto cleanup;
if (! nWidth) nWidth = s.cx; if (! nWidth) nWidth = s.cx;
if (! nHeight) nHeight = s.cy; if (! nHeight) nHeight = s.cy;
} }
SetRect(&r, X, Y, X + nWidth, Y + nHeight); SetRect(&r, X, Y, X + nWidth, Y + nHeight);
MemDC = CreateCompatibleDC(hDC); MemDC = CreateCompatibleDC(hDC);
if (! MemDC) goto cleanup; if (! MemDC) goto cleanup;
@ -1424,11 +1424,11 @@ IntGrayString(
SetTextColor(MemDC, RGB(255, 255, 255)); SetTextColor(MemDC, RGB(255, 255, 255));
SetBkColor(MemDC, RGB(0, 0, 0)); SetBkColor(MemDC, RGB(0, 0, 0));
if (lpOutputFunc) if (lpOutputFunc)
{ {
success = lpOutputFunc(MemDC, lpData, nCount); // Set brush etc first? success = lpOutputFunc(MemDC, lpData, nCount); // Set brush etc first?
if ((nCount == -1) && (! success)) if ((nCount == -1) && (! success))
{ {
// Don't gray (documented behaviour) // Don't gray (documented behaviour)
@ -1442,7 +1442,7 @@ IntGrayString(
success = TextOutW(MemDC, 0, 0, (WCHAR*) lpData, nCount); success = TextOutW(MemDC, 0, 0, (WCHAR*) lpData, nCount);
else else
success = TextOutA(MemDC, 0, 0, (CHAR*) lpData, nCount); success = TextOutA(MemDC, 0, 0, (CHAR*) lpData, nCount);
if (! success) goto cleanup; if (! success) goto cleanup;
PatBlt(MemDC, 0, 0, nWidth, nHeight, PATCOPY); PatBlt(MemDC, 0, 0, nWidth, nHeight, PATCOPY);
@ -1780,12 +1780,12 @@ FrameRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr)
if ((r.right <= r.left) || (r.bottom <= r.top)) return 0; if ((r.right <= r.left) || (r.bottom <= r.top)) return 0;
if (!(oldbrush = SelectObject(hDC, hbr))) return 0; if (!(oldbrush = SelectObject(hDC, hbr))) return 0;
PatBlt(hDC, r.left, r.top, 1, r.bottom - r.top, PATCOPY); PatBlt(hDC, r.left, r.top, 1, r.bottom - r.top, PATCOPY);
PatBlt(hDC, r.right - 1, r.top, 1, r.bottom - r.top, PATCOPY); PatBlt(hDC, r.right - 1, r.top, 1, r.bottom - r.top, PATCOPY);
PatBlt(hDC, r.left, r.top, r.right - r.left, 1, PATCOPY); PatBlt(hDC, r.left, r.top, r.right - r.left, 1, PATCOPY);
PatBlt(hDC, r.left, r.bottom - 1, r.right - r.left, 1, PATCOPY); PatBlt(hDC, r.left, r.bottom - 1, r.right - r.left, 1, PATCOPY);
SelectObject(hDC, oldbrush); SelectObject(hDC, oldbrush);
return TRUE; return TRUE;
} }
@ -1817,7 +1817,7 @@ INT STDCALL
FillRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr) FillRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr)
{ {
HBRUSH prevhbr; HBRUSH prevhbr;
if (hbr <= (HBRUSH)(COLOR_MENUBAR + 1)) if (hbr <= (HBRUSH)(COLOR_MENUBAR + 1))
{ {
hbr = GetSysColorBrush((int)hbr - 1); hbr = GetSysColorBrush((int)hbr - 1);
@ -1852,21 +1852,21 @@ DrawFocusRect(HDC hdc, CONST RECT *rect)
static HBRUSH hFocusRectBrush = NULL; static HBRUSH hFocusRectBrush = NULL;
HGDIOBJ OldObj; HGDIOBJ OldObj;
UINT cx, cy; UINT cx, cy;
if(!hFocusRectBrush) if(!hFocusRectBrush)
{ {
static HBITMAP hFocusPattern = NULL; static HBITMAP hFocusPattern = NULL;
const DWORD Pattern[4] = {0x5555AAAA, 0x5555AAAA, 0x5555AAAA, 0x5555AAAA}; const DWORD Pattern[4] = {0x5555AAAA, 0x5555AAAA, 0x5555AAAA, 0x5555AAAA};
hFocusPattern = CreateBitmap(8, 8, 1, 1, Pattern); hFocusPattern = CreateBitmap(8, 8, 1, 1, Pattern);
hFocusRectBrush = CreatePatternBrush(hFocusPattern); hFocusRectBrush = CreatePatternBrush(hFocusPattern);
} }
NtUserSystemParametersInfo(SPI_GETFOCUSBORDERWIDTH, 0, &cx, 0); NtUserSystemParametersInfo(SPI_GETFOCUSBORDERWIDTH, 0, &cx, 0);
NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &cy, 0); NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &cy, 0);
OldObj = SelectObject(hdc, hFocusRectBrush); OldObj = SelectObject(hdc, hFocusRectBrush);
/* top */ /* top */
PatBlt(hdc, rect->left, rect->top, rect->right - rect->left, cy, PATINVERT); PatBlt(hdc, rect->left, rect->top, rect->right - rect->left, cy, PATINVERT);
/* bottom */ /* bottom */
@ -1875,7 +1875,7 @@ DrawFocusRect(HDC hdc, CONST RECT *rect)
PatBlt(hdc, rect->left, rect->top + cy, cx, rect->bottom - rect->top - (2 * cy), PATINVERT); PatBlt(hdc, rect->left, rect->top + cy, cx, rect->bottom - rect->top - (2 * cy), PATINVERT);
/* right */ /* right */
PatBlt(hdc, rect->right - cx, rect->top + cy, cx, rect->bottom - rect->top - (2 * cy), PATINVERT); PatBlt(hdc, rect->right - cx, rect->top + cy, cx, rect->bottom - rect->top - (2 * cy), PATINVERT);
SelectObject(hdc, OldObj); SelectObject(hdc, OldObj);
return TRUE; return TRUE;
} }

View file

@ -52,8 +52,8 @@ ICON_CreateIconFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDe
DIB_RGB_COLORS); DIB_RGB_COLORS);
/* Make ImageData point to the start of the AND image data. */ /* Make ImageData point to the start of the AND image data. */
ImageData = ((PBYTE)ImageData) + (((IconImage->icHeader.biWidth * ImageData = ((PBYTE)ImageData) + (((IconImage->icHeader.biWidth *
IconImage->icHeader.biBitCount + 31) & ~31) >> 3) * IconImage->icHeader.biBitCount + 31) & ~31) >> 3) *
(IconImage->icHeader.biHeight ); (IconImage->icHeader.biHeight );
/* Create a BITMAPINFO header for the monocrome part of the icon. */ /* Create a BITMAPINFO header for the monocrome part of the icon. */
@ -82,10 +82,10 @@ ICON_CreateIconFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDe
/* Load the AND bitmap. */ /* Load the AND bitmap. */
IconInfo.hbmMask = CreateDIBitmap(hDC, &bwBIH->bmiHeader, 0, IconInfo.hbmMask = CreateDIBitmap(hDC, &bwBIH->bmiHeader, 0,
ImageData, bwBIH, DIB_RGB_COLORS); ImageData, bwBIH, DIB_RGB_COLORS);
SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight, SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight,
ImageData, bwBIH, DIB_RGB_COLORS); ImageData, bwBIH, DIB_RGB_COLORS);
/* Create the icon based on everything we have so far */ /* Create the icon based on everything we have so far */
return NtUserCreateCursorIconHandle(&IconInfo, FALSE); return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
} }
@ -102,7 +102,7 @@ ICON_CreateCursorFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cx
IconInfo.fIcon = FALSE; IconInfo.fIcon = FALSE;
IconInfo.xHotspot = xHotspot; IconInfo.xHotspot = xHotspot;
IconInfo.yHotspot = yHotspot; IconInfo.yHotspot = yHotspot;
/* Create a BITMAPINFO header for the monocrome part of the icon */ /* Create a BITMAPINFO header for the monocrome part of the icon */
bwBIH->bmiHeader.biBitCount = 1; bwBIH->bmiHeader.biBitCount = 1;
bwBIH->bmiHeader.biWidth = IconImage->icHeader.biWidth; bwBIH->bmiHeader.biWidth = IconImage->icHeader.biWidth;
@ -131,12 +131,12 @@ ICON_CreateCursorFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cx
XORImageData, bwBIH, DIB_RGB_COLORS); XORImageData, bwBIH, DIB_RGB_COLORS);
if (IconInfo.hbmMask) if (IconInfo.hbmMask)
{ {
SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight, SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight,
XORImageData, bwBIH, DIB_RGB_COLORS); XORImageData, bwBIH, DIB_RGB_COLORS);
} }
IconInfo.hbmColor = (HBITMAP)0; IconInfo.hbmColor = (HBITMAP)0;
/* Create the icon based on everything we have so far */ /* Create the icon based on everything we have so far */
return NtUserCreateCursorIconHandle(&IconInfo, FALSE); return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
} }
@ -151,7 +151,7 @@ CopyIcon(
HICON hIcon) HICON hIcon)
{ {
ICONINFO IconInfo; ICONINFO IconInfo;
if(NtUserGetCursorIconInfo((HANDLE)hIcon, &IconInfo)) if(NtUserGetCursorIconInfo((HANDLE)hIcon, &IconInfo))
{ {
return NtUserCreateCursorIconHandle(&IconInfo, FALSE); return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
@ -190,7 +190,7 @@ CreateIcon(
DeleteObject(IconInfo.hbmMask); DeleteObject(IconInfo.hbmMask);
return (HICON)0; return (HICON)0;
} }
return NtUserCreateCursorIconHandle(&IconInfo, FALSE); return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
} }
@ -232,7 +232,7 @@ CreateIconFromResourceEx(
HDC hScreenDc; HDC hScreenDc;
WORD wXHotspot; WORD wXHotspot;
WORD wYHotspot; WORD wYHotspot;
/* /*
FIXME - does win support LR_SHARED? According to msdn it does but we don't FIXME - does win support LR_SHARED? According to msdn it does but we don't
have useful information to identify the icon have useful information to identify the icon
@ -261,11 +261,11 @@ CreateIconFromResourceEx(
/* get an safe copy of the icon data */ /* get an safe copy of the icon data */
SafeIconImage = RtlAllocateHeap(GetProcessHeap(), 0, cbIconBits); SafeIconImage = RtlAllocateHeap(GetProcessHeap(), 0, cbIconBits);
memcpy(SafeIconImage, pbIconBits, cbIconBits); memcpy(SafeIconImage, pbIconBits, cbIconBits);
/* take into acount the origonal height was for both the AND and XOR images */ /* take into acount the origonal height was for both the AND and XOR images */
if(fIcon) if(fIcon)
SafeIconImage->icHeader.biHeight /= 2; SafeIconImage->icHeader.biHeight /= 2;
if (SafeIconImage->icHeader.biSize == sizeof(BITMAPCOREHEADER)) if (SafeIconImage->icHeader.biSize == sizeof(BITMAPCOREHEADER))
{ {
BITMAPCOREHEADER* Core = (BITMAPCOREHEADER*)SafeIconImage; BITMAPCOREHEADER* Core = (BITMAPCOREHEADER*)SafeIconImage;
@ -274,7 +274,7 @@ CreateIconFromResourceEx(
} }
else else
{ {
ColourCount = (SafeIconImage->icHeader.biBitCount <= 8) ? ColourCount = (SafeIconImage->icHeader.biBitCount <= 8) ?
(1 << SafeIconImage->icHeader.biBitCount) : 0; (1 << SafeIconImage->icHeader.biBitCount) : 0;
HeaderSize = sizeof(BITMAPINFOHEADER) + ColourCount * sizeof(RGBQUAD); HeaderSize = sizeof(BITMAPINFOHEADER) + ColourCount * sizeof(RGBQUAD);
} }
@ -326,7 +326,7 @@ CreateIconIndirect(PICONINFO IconInfo)
{ {
return (HICON)0; return (HICON)0;
} }
/* FIXME - i doubt this is right (monochrome cursors */ /* FIXME - i doubt this is right (monochrome cursors */
/*if(ColorBitmap.bmWidth != MaskBitmap.bmWidth || /*if(ColorBitmap.bmWidth != MaskBitmap.bmWidth ||
ColorBitmap.bmHeight != MaskBitmap.bmWidth) ColorBitmap.bmHeight != MaskBitmap.bmWidth)
@ -334,7 +334,7 @@ CreateIconIndirect(PICONINFO IconInfo)
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return (HICON)0; return (HICON)0;
}*/ }*/
return (HICON)NtUserCreateCursorIconHandle(IconInfo, TRUE); return (HICON)NtUserCreateCursorIconHandle(IconInfo, TRUE);
} }
@ -381,8 +381,8 @@ DrawIconEx(
HBRUSH hbrFlickerFreeDraw, HBRUSH hbrFlickerFreeDraw,
UINT diFlags) UINT diFlags)
{ {
return (BOOL)NtUserDrawIconEx(hdc, xLeft, yTop, hIcon, cxWidth, cyWidth, return (BOOL)NtUserDrawIconEx(hdc, xLeft, yTop, hIcon, cxWidth, cyWidth,
istepIfAniCur, hbrFlickerFreeDraw, diFlags, istepIfAniCur, hbrFlickerFreeDraw, diFlags,
0, 0); 0, 0);
} }
@ -455,7 +455,7 @@ CURSORICON_FindBestCursor( GRPCURSORICONDIR *dir, int width, int height, int col
DPRINT("Empty directory!\n"); DPRINT("Empty directory!\n");
return NULL; return NULL;
} }
if (dir->idCount == 1) if (dir->idCount == 1)
return &dir->idEntries[0]; /* No choice... */ return &dir->idEntries[0]; /* No choice... */
/* Find Best Fit */ /* Find Best Fit */

View file

@ -80,9 +80,9 @@ EnableWindow(HWND hWnd,
LONG Style = NtUserGetWindowLong(hWnd, GWL_STYLE, FALSE); LONG Style = NtUserGetWindowLong(hWnd, GWL_STYLE, FALSE);
Style = bEnable ? Style & ~WS_DISABLED : Style | WS_DISABLED; Style = bEnable ? Style & ~WS_DISABLED : Style | WS_DISABLED;
NtUserSetWindowLong(hWnd, GWL_STYLE, Style, FALSE); NtUserSetWindowLong(hWnd, GWL_STYLE, Style, FALSE);
SendMessageA(hWnd, WM_ENABLE, (LPARAM) IsWindowEnabled(hWnd), 0); SendMessageA(hWnd, WM_ENABLE, (LPARAM) IsWindowEnabled(hWnd), 0);
// Return nonzero if it was disabled, or zero if it wasn't: // Return nonzero if it was disabled, or zero if it wasn't:
return IsWindowEnabled(hWnd); return IsWindowEnabled(hWnd);
} }
@ -140,7 +140,7 @@ GetKeyNameTextA(LONG lParam,
LPSTR lpString, LPSTR lpString,
int nSize) int nSize)
{ {
LPWSTR intermediateString = LPWSTR intermediateString =
HeapAlloc(GetProcessHeap(),0,nSize * sizeof(WCHAR)); HeapAlloc(GetProcessHeap(),0,nSize * sizeof(WCHAR));
int ret = 0; int ret = 0;
UINT wstrLen = 0; UINT wstrLen = 0;
@ -149,9 +149,9 @@ GetKeyNameTextA(LONG lParam,
if( !intermediateString ) return 0; if( !intermediateString ) return 0;
ret = GetKeyNameTextW(lParam,intermediateString,nSize); ret = GetKeyNameTextW(lParam,intermediateString,nSize);
if( ret == 0 ) { lpString[0] = 0; return 0; } if( ret == 0 ) { lpString[0] = 0; return 0; }
wstrLen = wcslen( intermediateString ); wstrLen = wcslen( intermediateString );
ret = WideCharToMultiByte(CP_ACP, 0, ret = WideCharToMultiByte(CP_ACP, 0,
intermediateString, wstrLen, intermediateString, wstrLen,
lpString, nSize, ".", &defChar ); lpString, nSize, ".", &defChar );
lpString[ret] = 0; lpString[ret] = 0;
@ -222,7 +222,7 @@ GetKeyboardLayoutNameW(LPWSTR pwszKLID)
BOOL STDCALL BOOL STDCALL
GetKeyboardState(PBYTE lpKeyState) GetKeyboardState(PBYTE lpKeyState)
{ {
return (BOOL) NtUserGetKeyboardState((LPBYTE) lpKeyState); return (BOOL) NtUserGetKeyboardState((LPBYTE) lpKeyState);
} }
@ -438,7 +438,7 @@ ToUnicode(UINT wVirtKey,
int cchBuff, int cchBuff,
UINT wFlags) UINT wFlags)
{ {
return ToUnicodeEx( wVirtKey, wScanCode, lpKeyState, pwszBuff, cchBuff, return ToUnicodeEx( wVirtKey, wScanCode, lpKeyState, pwszBuff, cchBuff,
wFlags, 0 ); wFlags, 0 );
} }
@ -582,14 +582,14 @@ keybd_event(
{ {
INPUT Input; INPUT Input;
Input.type = INPUT_KEYBOARD; Input.type = INPUT_KEYBOARD;
Input.ki.wVk = bVk; Input.ki.wVk = bVk;
Input.ki.wScan = bScan; Input.ki.wScan = bScan;
Input.ki.dwFlags = dwFlags; Input.ki.dwFlags = dwFlags;
Input.ki.time = 0; Input.ki.time = 0;
Input.ki.dwExtraInfo = dwExtraInfo; Input.ki.dwExtraInfo = dwExtraInfo;
NtUserSendInput(1, &Input, sizeof(INPUT)); NtUserSendInput(1, &Input, sizeof(INPUT));
} }
@ -607,7 +607,7 @@ mouse_event(
ULONG_PTR dwExtraInfo) ULONG_PTR dwExtraInfo)
{ {
INPUT Input; INPUT Input;
Input.type = INPUT_MOUSE; Input.type = INPUT_MOUSE;
Input.mi.dx = dx; Input.mi.dx = dx;
Input.mi.dy = dy; Input.mi.dy = dy;
@ -615,7 +615,7 @@ mouse_event(
Input.mi.dwFlags = dwFlags; Input.mi.dwFlags = dwFlags;
Input.mi.time = 0; Input.mi.time = 0;
Input.mi.dwExtraInfo = dwExtraInfo; Input.mi.dwExtraInfo = dwExtraInfo;
NtUserSendInput(1, &Input, sizeof(INPUT)); NtUserSendInput(1, &Input, sizeof(INPUT));
} }

View file

@ -149,8 +149,8 @@ BOOL CALLBACK MDI_GetChildByID_EnumProc (HWND hwnd, LPARAM lParam )
{ {
DWORD *control = (DWORD *)lParam; DWORD *control = (DWORD *)lParam;
if(*control == GetWindowLongW( hwnd, GWL_ID )) if(*control == GetWindowLongW( hwnd, GWL_ID ))
{ {
*control = (DWORD)hwnd; *control = (DWORD)hwnd;
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
@ -1285,7 +1285,7 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message,
SetWindowLongPtrW( hwnd, 0, (LONG_PTR)ci ); SetWindowLongPtrW( hwnd, 0, (LONG_PTR)ci );
return TRUE; return TRUE;
#endif #endif
case WM_CREATE: case WM_CREATE:
{ {
RECT rect; RECT rect;

View file

@ -71,7 +71,7 @@
(0 != ((MenuInfo)->Flags & MF_POPUP) && 0 != ((MenuInfo)->Flags & MF_SYSMENU)) (0 != ((MenuInfo)->Flags & MF_POPUP) && 0 != ((MenuInfo)->Flags & MF_SYSMENU))
#define IS_MAGIC_ITEM(Bmp) ((int) Bmp <12) #define IS_MAGIC_ITEM(Bmp) ((int) Bmp <12)
#define MENU_BAR_ITEMS_SPACE (12) #define MENU_BAR_ITEMS_SPACE (12)
#define SEPARATOR_HEIGHT (5) #define SEPARATOR_HEIGHT (5)
#define MENU_TAB_SPACE (8) #define MENU_TAB_SPACE (8)
@ -126,8 +126,8 @@ const struct builtin_class_descr POPUPMENU_builtin_class =
/* INTERNAL FUNCTIONS ********************************************************/ /* INTERNAL FUNCTIONS ********************************************************/
/* Rip the fun and easy to use and fun WINE unicode string manipulation routines. /* Rip the fun and easy to use and fun WINE unicode string manipulation routines.
* Of course I didnt copy the ASM code because we want this to be portable * Of course I didnt copy the ASM code because we want this to be portable
* and it needs to go away. * and it needs to go away.
*/ */
@ -164,7 +164,7 @@ MenuGetRosMenuInfo(PROSMENUINFO MenuInfo, HMENU Menu)
{ {
MenuInfo->cbSize = sizeof(ROSMENUINFO); MenuInfo->cbSize = sizeof(ROSMENUINFO);
MenuInfo->fMask = MIM_BACKGROUND | MIM_HELPID | MIM_MAXHEIGHT | MIM_MENUDATA | MIM_STYLE; MenuInfo->fMask = MIM_BACKGROUND | MIM_HELPID | MIM_MAXHEIGHT | MIM_MENUDATA | MIM_STYLE;
return NtUserMenuInfo(Menu, MenuInfo, FALSE); return NtUserMenuInfo(Menu, MenuInfo, FALSE);
} }
@ -178,7 +178,7 @@ MenuSetRosMenuInfo(PROSMENUINFO MenuInfo)
{ {
MenuInfo->cbSize = sizeof(ROSMENUINFO); MenuInfo->cbSize = sizeof(ROSMENUINFO);
MenuInfo->fMask = MIM_BACKGROUND | MIM_HELPID | MIM_MAXHEIGHT | MIM_MENUDATA | MIM_STYLE; MenuInfo->fMask = MIM_BACKGROUND | MIM_HELPID | MIM_MAXHEIGHT | MIM_MENUDATA | MIM_STYLE;
return NtUserMenuInfo(MenuInfo->Self, MenuInfo, TRUE); return NtUserMenuInfo(MenuInfo->Self, MenuInfo, TRUE);
} }
@ -255,7 +255,7 @@ MenuSetRosMenuItemInfo(HMENU Menu, UINT Index, PROSMENUITEMINFO ItemInfo)
ItemInfo->fMask = MIIM_BITMAP | MIIM_CHECKMARKS | MIIM_DATA | MIIM_FTYPE ItemInfo->fMask = MIIM_BITMAP | MIIM_CHECKMARKS | MIIM_DATA | MIIM_FTYPE
| MIIM_ID | MIIM_STATE | MIIM_STRING | MIIM_SUBMENU | MIIM_TYPE; | MIIM_ID | MIIM_STATE | MIIM_STRING | MIIM_SUBMENU | MIIM_TYPE;
Ret = NtUserMenuItemInfo(Menu, Index, TRUE, ItemInfo, TRUE); Ret = NtUserMenuItemInfo(Menu, Index, TRUE, ItemInfo, TRUE);
return Ret; return Ret;
@ -1063,7 +1063,7 @@ BOOL
MenuInit(VOID) MenuInit(VOID)
{ {
NONCLIENTMETRICSW ncm; NONCLIENTMETRICSW ncm;
/* get the menu font */ /* get the menu font */
if(!hMenuFont || !hMenuFontBold) if(!hMenuFont || !hMenuFontBold)
{ {
@ -1073,14 +1073,14 @@ MenuInit(VOID)
DbgPrint("MenuInit(): SystemParametersInfoW(SPI_GETNONCLIENTMETRICS) failed!\n"); DbgPrint("MenuInit(): SystemParametersInfoW(SPI_GETNONCLIENTMETRICS) failed!\n");
return FALSE; return FALSE;
} }
hMenuFont = CreateFontIndirectW(&ncm.lfMenuFont); hMenuFont = CreateFontIndirectW(&ncm.lfMenuFont);
if(hMenuFont == NULL) if(hMenuFont == NULL)
{ {
DbgPrint("MenuInit(): CreateFontIndirectW(hMenuFont) failed!\n"); DbgPrint("MenuInit(): CreateFontIndirectW(hMenuFont) failed!\n");
return FALSE; return FALSE;
} }
ncm.lfMenuFont.lfWeight = max(ncm.lfMenuFont.lfWeight + 300, 1000); ncm.lfMenuFont.lfWeight = max(ncm.lfMenuFont.lfWeight + 300, 1000);
hMenuFontBold = CreateFontIndirectW(&ncm.lfMenuFont); hMenuFontBold = CreateFontIndirectW(&ncm.lfMenuFont);
if(hMenuFontBold == NULL) if(hMenuFontBold == NULL)
@ -1905,8 +1905,8 @@ MenuMoveSelection(HWND WndOwner, PROSMENUINFO MenuInfo, INT Offset)
i = -1; i = -1;
} }
else else
{ {
i = MenuInfo->FocusedItem; i = MenuInfo->FocusedItem;
} }
do do
@ -1968,7 +1968,7 @@ MenuInitSysMenuPopup(HMENU Menu, DWORD Style, DWORD ClsStyle, LONG HitTest )
{ {
EnableMenuItem(Menu, SC_CLOSE, MF_GRAYED); EnableMenuItem(Menu, SC_CLOSE, MF_GRAYED);
} }
/* Set default menu item */ /* Set default menu item */
if(Style & WS_MINIMIZE) if(Style & WS_MINIMIZE)
{ {
@ -1988,7 +1988,7 @@ MenuInitSysMenuPopup(HMENU Menu, DWORD Style, DWORD ClsStyle, LONG HitTest )
#if 0 #if 0
mii.cbSize = sizeof(MENUITEMINFOW); mii.cbSize = sizeof(MENUITEMINFOW);
mii.fMask = MIIM_STATE; mii.fMask = MIIM_STATE;
if((DefItem != SC_CLOSE) && GetMenuItemInfoW(Menu, DefItem, FALSE, &mii) && if((DefItem != SC_CLOSE) && GetMenuItemInfoW(Menu, DefItem, FALSE, &mii) &&
(mii.fState & (MFS_GRAYED | MFS_DISABLED))) (mii.fState & (MFS_GRAYED | MFS_DISABLED)))
{ {
DefItem = SC_CLOSE; DefItem = SC_CLOSE;
@ -3353,7 +3353,7 @@ MenuTrackMenu(HMENU Menu, UINT Flags, INT x, INT y,
Mt.TrackFlags &= ~TF_SKIPREMOVE; Mt.TrackFlags &= ~TF_SKIPREMOVE;
} }
} }
NtUserSetGUIThreadHandle(MSQ_STATE_MENUOWNER, NULL); NtUserSetGUIThreadHandle(MSQ_STATE_MENUOWNER, NULL);
SetCapture(NULL); /* release the capture */ SetCapture(NULL); /* release the capture */
@ -3453,7 +3453,7 @@ AppendMenuA(HMENU hMenu,
UINT_PTR uIDNewItem, UINT_PTR uIDNewItem,
LPCSTR lpNewItem) LPCSTR lpNewItem)
{ {
return(InsertMenuA(hMenu, -1, uFlags | MF_BYPOSITION, uIDNewItem, return(InsertMenuA(hMenu, -1, uFlags | MF_BYPOSITION, uIDNewItem,
lpNewItem)); lpNewItem));
} }
@ -3467,7 +3467,7 @@ AppendMenuW(HMENU hMenu,
UINT_PTR uIDNewItem, UINT_PTR uIDNewItem,
LPCWSTR lpNewItem) LPCWSTR lpNewItem)
{ {
return(InsertMenuW(hMenu, -1, uFlags | MF_BYPOSITION, uIDNewItem, return(InsertMenuW(hMenu, -1, uFlags | MF_BYPOSITION, uIDNewItem,
lpNewItem)); lpNewItem));
} }
@ -3611,7 +3611,7 @@ GetMenuBarInfo(HWND hwnd,
LONG STDCALL LONG STDCALL
GetMenuCheckMarkDimensions(VOID) GetMenuCheckMarkDimensions(VOID)
{ {
return(MAKELONG(GetSystemMetrics(SM_CXMENUCHECK), return(MAKELONG(GetSystemMetrics(SM_CXMENUCHECK),
GetSystemMetrics(SM_CYMENUCHECK))); GetSystemMetrics(SM_CYMENUCHECK)));
} }
@ -3637,16 +3637,16 @@ GetMenuInfo(HMENU hmenu,
{ {
ROSMENUINFO mi; ROSMENUINFO mi;
BOOL res = FALSE; BOOL res = FALSE;
if(!lpcmi || (lpcmi->cbSize != sizeof(MENUINFO))) if(!lpcmi || (lpcmi->cbSize != sizeof(MENUINFO)))
return FALSE; return FALSE;
RtlZeroMemory(&mi, sizeof(MENUINFO)); RtlZeroMemory(&mi, sizeof(MENUINFO));
mi.cbSize = sizeof(MENUINFO); mi.cbSize = sizeof(MENUINFO);
mi.fMask = lpcmi->fMask; mi.fMask = lpcmi->fMask;
res = NtUserMenuInfo(hmenu, &mi, FALSE); res = NtUserMenuInfo(hmenu, &mi, FALSE);
memcpy(lpcmi, &mi, sizeof(MENUINFO)); memcpy(lpcmi, &mi, sizeof(MENUINFO));
return res; return res;
} }
@ -3672,15 +3672,15 @@ GetMenuItemID(HMENU hMenu,
int nPos) int nPos)
{ {
ROSMENUITEMINFO mii; ROSMENUITEMINFO mii;
mii.cbSize = sizeof(MENUITEMINFOW); mii.cbSize = sizeof(MENUITEMINFOW);
mii.fMask = MIIM_ID | MIIM_SUBMENU; mii.fMask = MIIM_ID | MIIM_SUBMENU;
if (! NtUserMenuItemInfo(hMenu, nPos, MF_BYPOSITION, &mii, FALSE)) if (! NtUserMenuItemInfo(hMenu, nPos, MF_BYPOSITION, &mii, FALSE))
{ {
return -1; return -1;
} }
if (NULL != mii.hSubMenu) if (NULL != mii.hSubMenu)
{ {
return -1; return -1;
@ -3689,7 +3689,7 @@ GetMenuItemID(HMENU hMenu,
{ {
return -1; return -1;
} }
return mii.wID; return mii.wID;
} }
@ -3730,7 +3730,7 @@ GetMenuItemInfoA(
if (miiW.dwTypeData == NULL) if (miiW.dwTypeData == NULL)
return FALSE; return FALSE;
} }
if (!NtUserMenuItemInfo(Menu, Item, ByPosition, (PROSMENUITEMINFO)&miiW, FALSE)) if (!NtUserMenuItemInfo(Menu, Item, ByPosition, (PROSMENUITEMINFO)&miiW, FALSE))
{ {
HeapFree(GetProcessHeap(), 0, miiW.dwTypeData); HeapFree(GetProcessHeap(), 0, miiW.dwTypeData);
@ -3798,7 +3798,7 @@ GetMenuState(
mii.cbSize = sizeof(MENUITEMINFOW); mii.cbSize = sizeof(MENUITEMINFOW);
mii.fMask = MIIM_STATE | MIIM_TYPE | MIIM_SUBMENU; mii.fMask = MIIM_STATE | MIIM_TYPE | MIIM_SUBMENU;
mii.dwTypeData = NULL; mii.dwTypeData = NULL;
SetLastError(0); SetLastError(0);
if(NtUserMenuItemInfo(hMenu, uId, uFlags, &mii, FALSE)) if(NtUserMenuItemInfo(hMenu, uId, uFlags, &mii, FALSE))
{ {
@ -3810,18 +3810,18 @@ GetMenuState(
return (UINT) -1; return (UINT) -1;
} }
nSubItems = MenuInfo.MenuItemCount; nSubItems = MenuInfo.MenuItemCount;
/* FIXME - ported from wine, does that work (0xff)? */ /* FIXME - ported from wine, does that work (0xff)? */
if(GetLastError() != ERROR_INVALID_MENU_HANDLE) if(GetLastError() != ERROR_INVALID_MENU_HANDLE)
return (nSubItems << 8) | ((mii.fState | mii.fType) & 0xff); return (nSubItems << 8) | ((mii.fState | mii.fType) & 0xff);
return (UINT)-1; /* Invalid submenu */ return (UINT)-1; /* Invalid submenu */
} }
/* FIXME - ported from wine, does that work? */ /* FIXME - ported from wine, does that work? */
return (mii.fType | mii.fState); return (mii.fType | mii.fState);
} }
return (UINT)-1; return (UINT)-1;
} }
@ -3931,7 +3931,7 @@ InsertMenuA(
mii.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_STATE; mii.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_STATE;
mii.fType = 0; mii.fType = 0;
mii.fState = MFS_ENABLED; mii.fState = MFS_ENABLED;
if(uFlags & MF_BITMAP) if(uFlags & MF_BITMAP)
{ {
mii.fType |= MFT_BITMAP; mii.fType |= MFT_BITMAP;
@ -3950,7 +3950,7 @@ InsertMenuA(
mii.dwTypeData = (LPSTR)lpNewItem; mii.dwTypeData = (LPSTR)lpNewItem;
mii.cch = (NULL == lpNewItem ? 0 : strlen(lpNewItem)); mii.cch = (NULL == lpNewItem ? 0 : strlen(lpNewItem));
} }
if(uFlags & MF_RIGHTJUSTIFY) if(uFlags & MF_RIGHTJUSTIFY)
{ {
mii.fType |= MFT_RIGHTJUSTIFY; mii.fType |= MFT_RIGHTJUSTIFY;
@ -3971,7 +3971,7 @@ InsertMenuA(
{ {
mii.fState |= MFS_GRAYED; mii.fState |= MFS_GRAYED;
} }
if(uFlags & MF_POPUP) if(uFlags & MF_POPUP)
{ {
mii.fType |= MF_POPUP; mii.fType |= MF_POPUP;
@ -4004,13 +4004,13 @@ InsertMenuItemA(
BOOL CleanHeap = FALSE; BOOL CleanHeap = FALSE;
NTSTATUS Status; NTSTATUS Status;
if((lpmii->cbSize == sizeof(MENUITEMINFOA)) || if((lpmii->cbSize == sizeof(MENUITEMINFOA)) ||
(lpmii->cbSize == sizeof(MENUITEMINFOA) - sizeof(HBITMAP))) (lpmii->cbSize == sizeof(MENUITEMINFOA) - sizeof(HBITMAP)))
{ {
RtlMoveMemory ( &mi, lpmii, lpmii->cbSize ); RtlMoveMemory ( &mi, lpmii, lpmii->cbSize );
/* copy the text string */ /* copy the text string */
if((mi.fMask & (MIIM_TYPE | MIIM_STRING)) && if((mi.fMask & (MIIM_TYPE | MIIM_STRING)) &&
(MENU_ITEM_TYPE(mi.fType) == MF_STRING) && mi.dwTypeData) (MENU_ITEM_TYPE(mi.fType) == MF_STRING) && mi.dwTypeData)
{ {
Status = RtlCreateUnicodeStringFromAsciiz(&MenuText, (LPSTR)mi.dwTypeData); Status = RtlCreateUnicodeStringFromAsciiz(&MenuText, (LPSTR)mi.dwTypeData);
@ -4052,13 +4052,13 @@ InsertMenuItemW(
if a bad user passes bad data, we crash his process instead of the if a bad user passes bad data, we crash his process instead of the
entire kernel */ entire kernel */
if((lpmii->cbSize == sizeof(MENUITEMINFOW)) || if((lpmii->cbSize == sizeof(MENUITEMINFOW)) ||
(lpmii->cbSize == sizeof(MENUITEMINFOW) - sizeof(HBITMAP))) (lpmii->cbSize == sizeof(MENUITEMINFOW) - sizeof(HBITMAP)))
{ {
memcpy(&mi, lpmii, lpmii->cbSize); memcpy(&mi, lpmii, lpmii->cbSize);
/* copy the text string */ /* copy the text string */
if((mi.fMask & (MIIM_TYPE | MIIM_STRING)) && if((mi.fMask & (MIIM_TYPE | MIIM_STRING)) &&
(MENU_ITEM_TYPE(mi.fType) == MF_STRING) && (MENU_ITEM_TYPE(mi.fType) == MF_STRING) &&
mi.dwTypeData != NULL) mi.dwTypeData != NULL)
{ {
@ -4066,7 +4066,7 @@ InsertMenuItemW(
mi.dwTypeData = MenuText.Buffer; mi.dwTypeData = MenuText.Buffer;
mi.cch = MenuText.Length / sizeof(WCHAR); mi.cch = MenuText.Length / sizeof(WCHAR);
}; };
res = NtUserInsertMenuItem(hMenu, uItem, fByPosition, &mi); res = NtUserInsertMenuItem(hMenu, uItem, fByPosition, &mi);
} }
return res; return res;
@ -4109,7 +4109,7 @@ InsertMenuW(
mii.dwTypeData = (LPWSTR)lpNewItem; mii.dwTypeData = (LPWSTR)lpNewItem;
mii.cch = (NULL == lpNewItem ? 0 : wcslen(lpNewItem)); mii.cch = (NULL == lpNewItem ? 0 : wcslen(lpNewItem));
} }
if(uFlags & MF_RIGHTJUSTIFY) if(uFlags & MF_RIGHTJUSTIFY)
{ {
mii.fType |= MFT_RIGHTJUSTIFY; mii.fType |= MFT_RIGHTJUSTIFY;
@ -4130,7 +4130,7 @@ InsertMenuW(
{ {
mii.fState |= MFS_GRAYED; mii.fState |= MFS_GRAYED;
} }
if(uFlags & MF_POPUP) if(uFlags & MF_POPUP)
{ {
mii.fType |= MF_POPUP; mii.fType |= MF_POPUP;
@ -4344,7 +4344,7 @@ SetMenuInfo(
BOOL res = FALSE; BOOL res = FALSE;
if(lpcmi->cbSize != sizeof(MENUINFO)) if(lpcmi->cbSize != sizeof(MENUINFO))
return res; return res;
memcpy(&mi, lpcmi, sizeof(MENUINFO)); memcpy(&mi, lpcmi, sizeof(MENUINFO));
return NtUserMenuInfo(hmenu, &mi, TRUE); return NtUserMenuInfo(hmenu, &mi, TRUE);
} }
@ -4436,7 +4436,7 @@ SetMenuItemInfoW(
BOOL BOOL
STDCALL STDCALL
SetSystemMenu ( SetSystemMenu (
HWND hwnd, HWND hwnd,
HMENU hMenu) HMENU hMenu)
{ {
if(!hwnd) if(!hwnd)
@ -4528,7 +4528,7 @@ GetMenuContextHelpId(HMENU hmenu)
ROSMENUINFO mi; ROSMENUINFO mi;
mi.cbSize = sizeof(ROSMENUINFO); mi.cbSize = sizeof(ROSMENUINFO);
mi.fMask = MIM_HELPID; mi.fMask = MIM_HELPID;
if(NtUserMenuInfo(hmenu, &mi, FALSE)) if(NtUserMenuInfo(hmenu, &mi, FALSE))
{ {
return mi.dwContextHelpID; return mi.dwContextHelpID;
@ -4590,7 +4590,7 @@ ChangeMenuW(
{ {
case MF_APPEND : case MF_APPEND :
return AppendMenuW(hMenu, flags &~ MF_APPEND, cmdInsert, lpszNewItem); return AppendMenuW(hMenu, flags &~ MF_APPEND, cmdInsert, lpszNewItem);
case MF_DELETE : case MF_DELETE :
return DeleteMenu(hMenu, cmd, flags &~ MF_DELETE); return DeleteMenu(hMenu, cmd, flags &~ MF_DELETE);
@ -4628,7 +4628,7 @@ ChangeMenuA(
{ {
case MF_APPEND : case MF_APPEND :
return AppendMenuA(hMenu, flags &~ MF_APPEND, cmdInsert, lpszNewItem); return AppendMenuA(hMenu, flags &~ MF_APPEND, cmdInsert, lpszNewItem);
case MF_DELETE : case MF_DELETE :
return DeleteMenu(hMenu, cmd, flags &~ MF_DELETE); return DeleteMenu(hMenu, cmd, flags &~ MF_DELETE);

View file

@ -15,7 +15,7 @@
#include <message.h> #include <message.h>
/* DDE message exchange /* DDE message exchange
* *
* - Session initialization * - Session initialization
* Client sends a WM_DDE_INITIATE message, usually a broadcast message. lParam of * Client sends a WM_DDE_INITIATE message, usually a broadcast message. lParam of
* this message contains a pair of global atoms, the Application and Topic atoms. * this message contains a pair of global atoms, the Application and Topic atoms.
@ -91,7 +91,7 @@ DdeAddPair(HGLOBAL ClientMem, HGLOBAL ServerMem)
} }
else else
{ {
New = HeapAlloc(GetProcessHeap(), 0, New = HeapAlloc(GetProcessHeap(), 0,
(DdeNumAlloc + GROWBY) * sizeof(DDEPAIR)); (DdeNumAlloc + GROWBY) * sizeof(DDEPAIR));
} }
@ -195,7 +195,7 @@ MsgiUMToKMMessage(PMSG UMMsg, PMSG KMMsg, BOOL Posted)
SIZE_T Size; SIZE_T Size;
PKMDDEEXECUTEDATA KMDdeExecuteData; PKMDDEEXECUTEDATA KMDdeExecuteData;
PVOID Data; PVOID Data;
Size = GlobalSize((HGLOBAL) UMMsg->lParam); Size = GlobalSize((HGLOBAL) UMMsg->lParam);
Data = GlobalLock((HGLOBAL) UMMsg->lParam); Data = GlobalLock((HGLOBAL) UMMsg->lParam);
if (NULL == Data) if (NULL == Data)
@ -235,7 +235,7 @@ MsgiUMToKMMessage(PMSG UMMsg, PMSG KMMsg, BOOL Posted)
pKMCopyData->cbData = pUMCopyData->cbData; pKMCopyData->cbData = pUMCopyData->cbData;
pKMCopyData->lpData = pKMCopyData + 1; pKMCopyData->lpData = pKMCopyData + 1;
RtlCopyMemory(pKMCopyData + 1, pUMCopyData->lpData, RtlCopyMemory(pKMCopyData + 1, pUMCopyData->lpData,
pUMCopyData->cbData); pUMCopyData->cbData);
KMMsg->lParam = (LPARAM)pKMCopyData; KMMsg->lParam = (LPARAM)pKMCopyData;
@ -759,7 +759,7 @@ MsgConversionAdd(PMSGCONVERSION Conversion)
} }
else else
{ {
New = HeapAlloc(GetProcessHeap(), 0, New = HeapAlloc(GetProcessHeap(), 0,
(MsgConversionNumAlloc + GROWBY) * sizeof(MSGCONVERSION)); (MsgConversionNumAlloc + GROWBY) * sizeof(MSGCONVERSION));
} }
@ -1631,7 +1631,7 @@ SendMessageTimeoutW(
LRESULT Result; LRESULT Result;
Info.Ansi = FALSE; Info.Ansi = FALSE;
Result = NtUserSendMessageTimeout(hWnd, Msg, wParam, lParam, fuFlags, uTimeout, Result = NtUserSendMessageTimeout(hWnd, Msg, wParam, lParam, fuFlags, uTimeout,
lpdwResult, &Info); lpdwResult, &Info);
if (! Info.HandledByKernel) if (! Info.HandledByKernel)
{ {
@ -1779,7 +1779,7 @@ STDCALL
RealGetQueueStatus(UINT flags) RealGetQueueStatus(UINT flags)
{ {
DWORD ret; DWORD ret;
WORD changed_bits, wake_bits; WORD changed_bits, wake_bits;
#if 0 /* wine stuff. don't know what it does... */ #if 0 /* wine stuff. don't know what it does... */
@ -1805,7 +1805,7 @@ BOOL STDCALL GetInputState(VOID)
DWORD ret; DWORD ret;
WORD wake_bits; WORD wake_bits;
#if 0 /* wine stuff. don't know what it does... */ #if 0 /* wine stuff. don't know what it does... */
/* check for pending X events */ /* check for pending X events */
if (USER_Driver.pMsgWaitForMultipleObjectsEx) if (USER_Driver.pMsgWaitForMultipleObjectsEx)
@ -1813,7 +1813,7 @@ BOOL STDCALL GetInputState(VOID)
#endif #endif
ret = NtUserGetQueueStatus(FALSE /*ClearChanges*/); ret = NtUserGetQueueStatus(FALSE /*ClearChanges*/);
wake_bits = HIWORD(ret); wake_bits = HIWORD(ret);
return wake_bits & (QS_KEY | QS_MOUSEBUTTON); return wake_bits & (QS_KEY | QS_MOUSEBUTTON);
@ -1922,7 +1922,7 @@ BOOL WINAPI IsInsideMessagePumpHook()
{ {
if(!gfMessagePumpHook) if(!gfMessagePumpHook)
return FALSE; return FALSE;
/* This code checks if we're inside SendMessage. */ /* This code checks if we're inside SendMessage. */
#if 0 #if 0
/* Since our TEB doesnt match that of real windows, testing this value is useless until we know what it does /* Since our TEB doesnt match that of real windows, testing this value is useless until we know what it does

View file

@ -103,7 +103,7 @@ static INT_PTR CALLBACK MessageBoxProc( HWND hwnd, UINT message,
PMSGBOXINFO mbi; PMSGBOXINFO mbi;
HELPINFO hi; HELPINFO hi;
HWND owner; HWND owner;
switch(message) { switch(message) {
case WM_INITDIALOG: case WM_INITDIALOG:
mbi = (PMSGBOXINFO)lParam; mbi = (PMSGBOXINFO)lParam;
@ -113,7 +113,7 @@ static INT_PTR CALLBACK MessageBoxProc( HWND hwnd, UINT message,
if(mbi->Icon) if(mbi->Icon)
SendDlgItemMessageW(hwnd, MSGBOX_IDICON, STM_SETICON, (WPARAM)mbi->Icon, 0); SendDlgItemMessageW(hwnd, MSGBOX_IDICON, STM_SETICON, (WPARAM)mbi->Icon, 0);
SetWindowContextHelpId(hwnd, mbi->ContextHelpId); SetWindowContextHelpId(hwnd, mbi->ContextHelpId);
/* set control fonts */ /* set control fonts */
SendDlgItemMessageW(hwnd, MSGBOX_IDTEXT, WM_SETFONT, (WPARAM)mbi->Font, 0); SendDlgItemMessageW(hwnd, MSGBOX_IDTEXT, WM_SETFONT, (WPARAM)mbi->Font, 0);
for(i = 0; i < mbi->nButtons; i++) for(i = 0; i < mbi->nButtons; i++)
@ -132,7 +132,7 @@ static INT_PTR CALLBACK MessageBoxProc( HWND hwnd, UINT message,
SetTimer(hwnd, 0, mbi->Timeout, NULL); SetTimer(hwnd, 0, mbi->Timeout, NULL);
} }
return 0; return 0;
case WM_COMMAND: case WM_COMMAND:
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
@ -159,7 +159,7 @@ static INT_PTR CALLBACK MessageBoxProc( HWND hwnd, UINT message,
return 0; return 0;
} }
return 0; return 0;
case WM_HELP: case WM_HELP:
mbi = (PMSGBOXINFO)GetPropW(hwnd, L"ROS_MSGBOX"); mbi = (PMSGBOXINFO)GetPropW(hwnd, L"ROS_MSGBOX");
if(!mbi) if(!mbi)
@ -176,7 +176,7 @@ static INT_PTR CALLBACK MessageBoxProc( HWND hwnd, UINT message,
SendMessageW(GetWindow(hwnd, GW_OWNER), WM_HELP, 0, (LPARAM)&hi); SendMessageW(GetWindow(hwnd, GW_OWNER), WM_HELP, 0, (LPARAM)&hi);
} }
return 0; return 0;
case WM_CLOSE: case WM_CLOSE:
mbi = (PMSGBOXINFO)GetPropW(hwnd, L"ROS_MSGBOX"); mbi = (PMSGBOXINFO)GetPropW(hwnd, L"ROS_MSGBOX");
if(!mbi) if(!mbi)
@ -189,7 +189,7 @@ static INT_PTR CALLBACK MessageBoxProc( HWND hwnd, UINT message,
} }
EndDialog(hwnd, IDCANCEL); EndDialog(hwnd, IDCANCEL);
return 1; return 1;
case WM_TIMER: case WM_TIMER:
if(wParam == 0) if(wParam == 0)
{ {
@ -224,9 +224,9 @@ MessageBoxTimeoutIndirectW(
MSGBOXINFO mbi; MSGBOXINFO mbi;
BOOL defbtn = FALSE; BOOL defbtn = FALSE;
DWORD units = GetDialogBaseUnits(); DWORD units = GetDialogBaseUnits();
hUser32 = GetModuleHandleW(L"USER32"); hUser32 = GetModuleHandleW(L"USER32");
if(!lpMsgBoxParams->lpszCaption || !HIWORD((LPWSTR)lpMsgBoxParams->lpszCaption)) if(!lpMsgBoxParams->lpszCaption || !HIWORD((LPWSTR)lpMsgBoxParams->lpszCaption))
{ {
LoadStringW(hUser32, IDS_ERROR, &capbuf[0], 32); LoadStringW(hUser32, IDS_ERROR, &capbuf[0], 32);
@ -234,15 +234,15 @@ MessageBoxTimeoutIndirectW(
} }
else else
caption = (LPWSTR)lpMsgBoxParams->lpszCaption; caption = (LPWSTR)lpMsgBoxParams->lpszCaption;
if(!lpMsgBoxParams->lpszText || !HIWORD(lpMsgBoxParams->lpszText)) if(!lpMsgBoxParams->lpszText || !HIWORD(lpMsgBoxParams->lpszText))
text = L""; text = L"";
else else
text = lpMsgBoxParams->lpszText; text = lpMsgBoxParams->lpszText;
caplen = strlenW(caption); caplen = strlenW(caption);
textlen = strlenW(text); textlen = strlenW(text);
/* Create selected buttons */ /* Create selected buttons */
switch(lpMsgBoxParams->dwStyle & MB_TYPEMASK) switch(lpMsgBoxParams->dwStyle & MB_TYPEMASK)
{ {
@ -289,7 +289,7 @@ MessageBoxTimeoutIndirectW(
/* Create Help button */ /* Create Help button */
if(lpMsgBoxParams->dwStyle & MB_HELP) if(lpMsgBoxParams->dwStyle & MB_HELP)
Buttons[nButtons++] = IDHELP; Buttons[nButtons++] = IDHELP;
switch(lpMsgBoxParams->dwStyle & MB_ICONMASK) switch(lpMsgBoxParams->dwStyle & MB_ICONMASK)
{ {
case MB_ICONEXCLAMATION: case MB_ICONEXCLAMATION:
@ -322,7 +322,7 @@ MessageBoxTimeoutIndirectW(
} }
/* Basic space */ /* Basic space */
bufsize = sizeof(DLGTEMPLATE) + bufsize = sizeof(DLGTEMPLATE) +
2 * sizeof(WORD) + /* menu and class */ 2 * sizeof(WORD) + /* menu and class */
(caplen + 1) * sizeof(WCHAR); /* title */ (caplen + 1) * sizeof(WCHAR); /* title */
@ -341,7 +341,7 @@ MessageBoxTimeoutIndirectW(
3 * sizeof(WORD) + 3 * sizeof(WORD) +
(textlen + 1) * sizeof(WCHAR); (textlen + 1) * sizeof(WCHAR);
for(i = 0; i < nButtons; i++) for(i = 0; i < nButtons; i++)
{ {
switch(Buttons[i]) switch(Buttons[i])
@ -387,22 +387,22 @@ MessageBoxTimeoutIndirectW(
3 * sizeof(WORD) + 3 * sizeof(WORD) +
(wcslen(ButtonText[i]) + 1) * sizeof(WCHAR); (wcslen(ButtonText[i]) + 1) * sizeof(WCHAR);
} }
buf = RtlAllocateHeap(GetProcessHeap(), 0, bufsize); buf = RtlAllocateHeap(GetProcessHeap(), 0, bufsize);
if(!buf) if(!buf)
{ {
return 0; return 0;
} }
iico = itxt = NULL; iico = itxt = NULL;
hDC = CreateCompatibleDC(0); hDC = CreateCompatibleDC(0);
nclm.cbSize = sizeof(nclm); nclm.cbSize = sizeof(nclm);
SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, sizeof(nclm), &nclm, 0); SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, sizeof(nclm), &nclm, 0);
hFont = CreateFontIndirectW (&nclm.lfMessageFont); hFont = CreateFontIndirectW (&nclm.lfMessageFont);
tpl = (DLGTEMPLATE *)buf; tpl = (DLGTEMPLATE *)buf;
tpl->style = WS_CAPTION | WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_SYSMENU | DS_CENTER | DS_MODALFRAME | DS_NOIDLEMSG; tpl->style = WS_CAPTION | WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_SYSMENU | DS_CENTER | DS_MODALFRAME | DS_NOIDLEMSG;
tpl->dwExtendedStyle = WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CONTROLPARENT; tpl->dwExtendedStyle = WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CONTROLPARENT;
if(lpMsgBoxParams->dwStyle & MB_TOPMOST) if(lpMsgBoxParams->dwStyle & MB_TOPMOST)
@ -412,9 +412,9 @@ MessageBoxTimeoutIndirectW(
tpl->x = 100; tpl->x = 100;
tpl->y = 100; tpl->y = 100;
tpl->cdit = nButtons + ((Icon != (HICON)0) ? 1 : 0) + 1; tpl->cdit = nButtons + ((Icon != (HICON)0) ? 1 : 0) + 1;
dest = (BYTE *)(tpl + 1); dest = (BYTE *)(tpl + 1);
*(WORD*)dest = 0; /* no menu */ *(WORD*)dest = 0; /* no menu */
*(((WORD*)dest) + 1) = 0; /* use default window class */ *(((WORD*)dest) + 1) = 0; /* use default window class */
dest += 2 * sizeof(WORD); dest += 2 * sizeof(WORD);
@ -422,7 +422,7 @@ MessageBoxTimeoutIndirectW(
dest += caplen * sizeof(WCHAR); dest += caplen * sizeof(WCHAR);
*(WCHAR*)dest = L'\0'; *(WCHAR*)dest = L'\0';
dest += sizeof(WCHAR); dest += sizeof(WCHAR);
/* Create icon */ /* Create icon */
if(Icon) if(Icon)
{ {
@ -431,7 +431,7 @@ MessageBoxTimeoutIndirectW(
iico->style = WS_CHILD | WS_VISIBLE | SS_ICON; iico->style = WS_CHILD | WS_VISIBLE | SS_ICON;
iico->dwExtendedStyle = 0; iico->dwExtendedStyle = 0;
iico->id = MSGBOX_IDICON; iico->id = MSGBOX_IDICON;
dest += sizeof(DLGITEMTEMPLATE); dest += sizeof(DLGITEMTEMPLATE);
*(WORD*)dest = 0xFFFF; *(WORD*)dest = 0xFFFF;
dest += sizeof(WORD); dest += sizeof(WORD);
@ -444,7 +444,7 @@ MessageBoxTimeoutIndirectW(
*(WORD*)dest = 0; *(WORD*)dest = 0;
dest += sizeof(WORD); dest += sizeof(WORD);
} }
/* create static for text */ /* create static for text */
dest = (BYTE*)(((DWORD)dest + 3) & ~3); dest = (BYTE*)(((DWORD)dest + 3) & ~3);
itxt = (DLGITEMTEMPLATE *)dest; itxt = (DLGITEMTEMPLATE *)dest;
@ -466,7 +466,7 @@ MessageBoxTimeoutIndirectW(
dest += sizeof(WCHAR); dest += sizeof(WCHAR);
*(WORD*)dest = 0; *(WORD*)dest = 0;
dest += sizeof(WORD); dest += sizeof(WORD);
/* create buttons */ /* create buttons */
btnsize.cx = BTN_CX; btnsize.cx = BTN_CX;
btnsize.cy = BTN_CY; btnsize.cy = BTN_CY;
@ -503,7 +503,7 @@ MessageBoxTimeoutIndirectW(
btnsize.cx = max(btnsize.cx, btnrect.right); btnsize.cx = max(btnsize.cx, btnrect.right);
btnsize.cy = max(btnsize.cy, btnrect.bottom); btnsize.cy = max(btnsize.cy, btnrect.bottom);
} }
/* make first button the default button if no other is */ /* make first button the default button if no other is */
if(!defbtn) if(!defbtn)
{ {
@ -511,7 +511,7 @@ MessageBoxTimeoutIndirectW(
ibtn[0]->style |= BS_DEFPUSHBUTTON; ibtn[0]->style |= BS_DEFPUSHBUTTON;
mbi.DefBtn = Buttons[0]; mbi.DefBtn = Buttons[0];
} }
/* calculate position and size of controls */ /* calculate position and size of controls */
txtrect.right = GetSystemMetrics(SM_CXSCREEN) / 5 * 4; txtrect.right = GetSystemMetrics(SM_CXSCREEN) / 5 * 4;
if(Icon) if(Icon)
@ -520,11 +520,11 @@ MessageBoxTimeoutIndirectW(
SelectObject(hDC, hFont); SelectObject(hDC, hFont);
DrawTextW(hDC, text, textlen, &txtrect, DT_LEFT | DT_NOPREFIX | DT_WORDBREAK | DT_CALCRECT); DrawTextW(hDC, text, textlen, &txtrect, DT_LEFT | DT_NOPREFIX | DT_WORDBREAK | DT_CALCRECT);
txtrect.right++; txtrect.right++;
/* calculate position and size of the icon */ /* calculate position and size of the icon */
rc.left = rc.bottom = rc.right = 0; rc.left = rc.bottom = rc.right = 0;
btntop = 0; btntop = 0;
if(iico) if(iico)
{ {
rc.right = GetSystemMetrics(SM_CXICON); rc.right = GetSystemMetrics(SM_CXICON);
@ -591,7 +591,7 @@ MessageBoxTimeoutIndirectW(
btnleft += btnsize.cx + MSGBOXEX_BUTTONSPACING; btnleft += btnsize.cx + MSGBOXEX_BUTTONSPACING;
} }
/* calculate size and position of the messagebox window */ /* calculate size and position of the messagebox window */
btnleft = max(btnleft - MSGBOXEX_BUTTONSPACING, rc.left + txtrect.right); btnleft = max(btnleft - MSGBOXEX_BUTTONSPACING, rc.left + txtrect.right);
btnleft += MSGBOXEX_MARGIN; btnleft += MSGBOXEX_MARGIN;
btntop += btnsize.cy + MSGBOXEX_MARGIN; btntop += btnsize.cy + MSGBOXEX_MARGIN;
/* set size and position of the message static */ /* set size and position of the message static */
@ -602,7 +602,7 @@ MessageBoxTimeoutIndirectW(
/* set size of the window */ /* set size of the window */
tpl->cx = (btnleft * 4) / LOWORD(units); tpl->cx = (btnleft * 4) / LOWORD(units);
tpl->cy = (btntop * 8) / HIWORD(units); tpl->cy = (btntop * 8) / HIWORD(units);
/* finally show the messagebox */ /* finally show the messagebox */
mbi.Icon = Icon; mbi.Icon = Icon;
mbi.Font = hFont; mbi.Font = hFont;
@ -612,16 +612,16 @@ MessageBoxTimeoutIndirectW(
mbi.nButtons = nButtons; mbi.nButtons = nButtons;
mbi.Btns = &Buttons[0]; mbi.Btns = &Buttons[0];
mbi.Timeout = Timeout; mbi.Timeout = Timeout;
if(hDC) if(hDC)
DeleteDC(hDC); DeleteDC(hDC);
ret = DialogBoxIndirectParamW(lpMsgBoxParams->hInstance, tpl, lpMsgBoxParams->hwndOwner, ret = DialogBoxIndirectParamW(lpMsgBoxParams->hInstance, tpl, lpMsgBoxParams->hwndOwner,
MessageBoxProc, (LPARAM)&mbi); MessageBoxProc, (LPARAM)&mbi);
if(hFont) if(hFont)
DeleteObject(hFont); DeleteObject(hFont);
RtlFreeHeap(GetProcessHeap(), 0, buf); RtlFreeHeap(GetProcessHeap(), 0, buf);
return ret; return ret;
} }
@ -914,7 +914,7 @@ MessageBeep(UINT uType)
if(waveOutGetNumDevs() == 0) if(waveOutGetNumDevs() == 0)
return Beep(500, 100); // Beep through speaker return Beep(500, 100); // Beep through speaker
/* fall through */ /* fall through */
case MB_OK: case MB_OK:
EventName = L"SystemDefault"; EventName = L"SystemDefault";
break; break;
case MB_ICONASTERISK: case MB_ICONASTERISK:

View file

@ -94,7 +94,7 @@ IntIsScrollBarVisible(HWND hWnd, INT hBar)
sbi.cbSize = sizeof(SCROLLBARINFO); sbi.cbSize = sizeof(SCROLLBARINFO);
if(!NtUserGetScrollBarInfo(hWnd, hBar, &sbi)) if(!NtUserGetScrollBarInfo(hWnd, hBar, &sbi))
return FALSE; return FALSE;
return !(sbi.rgstate[0] & STATE_SYSTEM_OFFSCREEN); return !(sbi.rgstate[0] & STATE_SYSTEM_OFFSCREEN);
} }
@ -111,7 +111,7 @@ UserHasWindowEdge(DWORD Style, DWORD ExStyle)
return TRUE; return TRUE;
Style &= WS_CAPTION; Style &= WS_CAPTION;
if (Style == WS_DLGFRAME || Style == WS_CAPTION) if (Style == WS_DLGFRAME || Style == WS_CAPTION)
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
@ -144,7 +144,7 @@ UserHasMenu(HWND hWnd, ULONG Style)
return (!(Style & WS_CHILD) && GetMenu(hWnd) != 0); return (!(Style & WS_CHILD) && GetMenu(hWnd) != 0);
} }
HICON HICON
UserGetWindowIcon(HWND hwnd) UserGetWindowIcon(HWND hwnd)
{ {
HICON hIcon = 0; HICON hIcon = 0;
@ -170,7 +170,7 @@ BOOL
UserDrawSysMenuButton(HWND hWnd, HDC hDC, LPRECT Rect, BOOL Down) UserDrawSysMenuButton(HWND hWnd, HDC hDC, LPRECT Rect, BOOL Down)
{ {
HICON WindowIcon; HICON WindowIcon;
if ((WindowIcon = UserGetWindowIcon(hWnd))) if ((WindowIcon = UserGetWindowIcon(hWnd)))
{ {
return DrawIconEx(hDC, Rect->left + 2, Rect->top + 2, WindowIcon, return DrawIconEx(hDC, Rect->left + 2, Rect->top + 2, WindowIcon,
@ -216,7 +216,7 @@ UserDrawCaptionButton(LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDo
TempRect.right -= 1; TempRect.right -= 1;
DrawFrameControl(hDC, &TempRect, DFC_CAPTION, DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
((Style & WS_MINIMIZE) ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMIN) | ((Style & WS_MINIMIZE) ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMIN) |
(bDown ? DFCS_PUSHED : 0) | (bDown ? DFCS_PUSHED : 0) |
((Style & WS_MINIMIZEBOX) ? 0 : DFCS_INACTIVE)); ((Style & WS_MINIMIZEBOX) ? 0 : DFCS_INACTIVE));
break; break;
@ -246,7 +246,7 @@ UserDrawCaptionButton(LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDo
if (ExStyle & WS_EX_TOOLWINDOW) if (ExStyle & WS_EX_TOOLWINDOW)
{ {
TempRect.left = TempRect.right - GetSystemMetrics(SM_CXSMSIZE); TempRect.left = TempRect.right - GetSystemMetrics(SM_CXSMSIZE);
TempRect.bottom = TempRect.top + GetSystemMetrics(SM_CYSMSIZE) - 2; TempRect.bottom = TempRect.top + GetSystemMetrics(SM_CYSMSIZE) - 2;
} }
else else
{ {
@ -305,7 +305,7 @@ DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active)
{ {
return 0; return 0;
} }
Parent = GetParent(hWnd); Parent = GetParent(hWnd);
ExStyle = GetWindowLongW(hWnd, GWL_EXSTYLE); ExStyle = GetWindowLongW(hWnd, GWL_EXSTYLE);
if (Active == -1) if (Active == -1)
@ -341,7 +341,7 @@ DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active)
SelectObject(hDC, GetSysColorBrush(COLOR_BTNSHADOW)); SelectObject(hDC, GetSysColorBrush(COLOR_BTNSHADOW));
PatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY); PatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
PatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY); PatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
SelectObject(hDC, GetSysColorBrush(COLOR_BTNHIGHLIGHT)); SelectObject(hDC, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
PatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY); PatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
PatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY); PatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
@ -349,7 +349,7 @@ DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active)
InflateRect(&CurrentRect, -1, -1); InflateRect(&CurrentRect, -1, -1);
#endif #endif
} }
/* Firstly the "thick" frame */ /* Firstly the "thick" frame */
if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE)) if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE))
{ {
@ -382,7 +382,7 @@ DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active)
{ {
DWORD Width = GetSystemMetrics(SM_CXBORDER); DWORD Width = GetSystemMetrics(SM_CXBORDER);
DWORD Height = GetSystemMetrics(SM_CYBORDER); DWORD Height = GetSystemMetrics(SM_CYBORDER);
SelectObject(hDC, GetSysColorBrush( SelectObject(hDC, GetSysColorBrush(
(ExStyle & (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE)) ? COLOR_3DFACE : (ExStyle & (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE)) ? COLOR_3DFACE :
(ExStyle & WS_EX_STATICEDGE) ? COLOR_WINDOWFRAME : (ExStyle & WS_EX_STATICEDGE) ? COLOR_WINDOWFRAME :
@ -409,7 +409,7 @@ DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active)
DWORD CaptionFlags = DC_ICON | DC_TEXT | DC_BUTTONS; DWORD CaptionFlags = DC_ICON | DC_TEXT | DC_BUTTONS;
HPEN PreviousPen; HPEN PreviousPen;
BOOL Gradient = FALSE; BOOL Gradient = FALSE;
if(SystemParametersInfoW(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient) if(SystemParametersInfoW(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
{ {
CaptionFlags |= DC_GRADIENT; CaptionFlags |= DC_GRADIENT;
@ -433,7 +433,7 @@ DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active)
TempRect.bottom = TempRect.top + GetSystemMetrics(SM_CYCAPTION) - 1; TempRect.bottom = TempRect.top + GetSystemMetrics(SM_CYCAPTION) - 1;
CurrentRect.top += GetSystemMetrics(SM_CYCAPTION); CurrentRect.top += GetSystemMetrics(SM_CYCAPTION);
} }
DrawCaption(hWnd, hDC, &TempRect, CaptionFlags); DrawCaption(hWnd, hDC, &TempRect, CaptionFlags);
/* Draw buttons */ /* Draw buttons */
@ -458,7 +458,7 @@ DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active)
SelectObject(hDC, PreviousPen); SelectObject(hDC, PreviousPen);
} }
} }
if(!(Style & WS_MINIMIZE)) if(!(Style & WS_MINIMIZE))
{ {
HMENU menu = GetMenu(hWnd); HMENU menu = GetMenu(hWnd);
@ -469,18 +469,18 @@ DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active)
TempRect.bottom = TempRect.top + (UINT)NtUserSetMenuBarHeight(menu, 0); TempRect.bottom = TempRect.top + (UINT)NtUserSetMenuBarHeight(menu, 0);
CurrentRect.top += MenuDrawMenuBar(hDC, &TempRect, hWnd, FALSE); CurrentRect.top += MenuDrawMenuBar(hDC, &TempRect, hWnd, FALSE);
} }
if (ExStyle & WS_EX_CLIENTEDGE) if (ExStyle & WS_EX_CLIENTEDGE)
{ {
DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
} }
/* Draw the scrollbars */ /* Draw the scrollbars */
if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) && if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) &&
IntIsScrollBarVisible(hWnd, OBJID_VSCROLL) && IntIsScrollBarVisible(hWnd, OBJID_HSCROLL)) IntIsScrollBarVisible(hWnd, OBJID_VSCROLL) && IntIsScrollBarVisible(hWnd, OBJID_HSCROLL))
{ {
RECT ParentClientRect; RECT ParentClientRect;
TempRect = CurrentRect; TempRect = CurrentRect;
if (ExStyle & WS_EX_LEFTSCROLLBAR) if (ExStyle & WS_EX_LEFTSCROLLBAR)
TempRect.right = TempRect.left + GetSystemMetrics(SM_CXVSCROLL); TempRect.right = TempRect.left + GetSystemMetrics(SM_CXVSCROLL);
@ -533,14 +533,14 @@ DefWndNCCalcSize(HWND hWnd, BOOL CalcSizeStruct, RECT *Rect)
} }
Result |= WVR_VALIDRECTS; Result |= WVR_VALIDRECTS;
} }
Style = GetWindowLongW(hWnd, GWL_STYLE); Style = GetWindowLongW(hWnd, GWL_STYLE);
ExStyle = GetWindowLongW(hWnd, GWL_EXSTYLE); ExStyle = GetWindowLongW(hWnd, GWL_EXSTYLE);
if (!(Style & WS_MINIMIZE)) if (!(Style & WS_MINIMIZE))
{ {
HMENU menu = GetMenu(hWnd); HMENU menu = GetMenu(hWnd);
if (UserHasWindowEdge(Style, ExStyle)) if (UserHasWindowEdge(Style, ExStyle))
{ {
UserGetWindowBorders(Style, ExStyle, &WindowBorders, FALSE); UserGetWindowBorders(Style, ExStyle, &WindowBorders, FALSE);
@ -579,18 +579,18 @@ DefWndNCCalcSize(HWND hWnd, BOOL CalcSizeStruct, RECT *Rect)
InflateRect(Rect, -2 * GetSystemMetrics(SM_CXBORDER), InflateRect(Rect, -2 * GetSystemMetrics(SM_CXBORDER),
-2 * GetSystemMetrics(SM_CYBORDER)); -2 * GetSystemMetrics(SM_CYBORDER));
} }
if(Style & (WS_VSCROLL | WS_HSCROLL)) if(Style & (WS_VSCROLL | WS_HSCROLL))
{ {
SCROLLBARINFO sbi; SCROLLBARINFO sbi;
SETSCROLLBARINFO ssbi; SETSCROLLBARINFO ssbi;
sbi.cbSize = sizeof(SCROLLBARINFO); sbi.cbSize = sizeof(SCROLLBARINFO);
if((Style & WS_VSCROLL) && NtUserGetScrollBarInfo(hWnd, OBJID_VSCROLL, &sbi)) if((Style & WS_VSCROLL) && NtUserGetScrollBarInfo(hWnd, OBJID_VSCROLL, &sbi))
{ {
int i; int i;
LONG sx = Rect->right; LONG sx = Rect->right;
sx -= GetSystemMetrics(SM_CXVSCROLL); sx -= GetSystemMetrics(SM_CXVSCROLL);
for(i = 0; i <= CCHILDREN_SCROLLBAR; i++) for(i = 0; i <= CCHILDREN_SCROLLBAR; i++)
ssbi.rgstate[i] = sbi.rgstate[i]; ssbi.rgstate[i] = sbi.rgstate[i];
@ -604,12 +604,12 @@ DefWndNCCalcSize(HWND hWnd, BOOL CalcSizeStruct, RECT *Rect)
} }
else else
Style &= ~WS_VSCROLL; Style &= ~WS_VSCROLL;
if((Style & WS_HSCROLL) && NtUserGetScrollBarInfo(hWnd, OBJID_HSCROLL, &sbi)) if((Style & WS_HSCROLL) && NtUserGetScrollBarInfo(hWnd, OBJID_HSCROLL, &sbi))
{ {
int i; int i;
LONG sy = Rect->bottom; LONG sy = Rect->bottom;
sy -= GetSystemMetrics(SM_CYHSCROLL); sy -= GetSystemMetrics(SM_CYHSCROLL);
for(i = 0; i <= CCHILDREN_SCROLLBAR; i++) for(i = 0; i <= CCHILDREN_SCROLLBAR; i++)
ssbi.rgstate[i] = sbi.rgstate[i]; ssbi.rgstate[i] = sbi.rgstate[i];
@ -655,7 +655,7 @@ DefWndNCCalcSize(HWND hWnd, BOOL CalcSizeStruct, RECT *Rect)
Rect->right = Rect->left; Rect->right = Rect->left;
Rect->bottom = Rect->top; Rect->bottom = Rect->top;
} }
return Result; return Result;
} }
@ -681,14 +681,14 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
GetWindowRect(hWnd, &WindowRect); GetWindowRect(hWnd, &WindowRect);
if (!PtInRect(&WindowRect, Point)) if (!PtInRect(&WindowRect, Point))
{ {
return HTNOWHERE; return HTNOWHERE;
} }
OrigWndRect = WindowRect; OrigWndRect = WindowRect;
if (UserHasWindowEdge(Style, ExStyle)) if (UserHasWindowEdge(Style, ExStyle))
{ {
LONG XSize, YSize; LONG XSize, YSize;
UserGetWindowBorders(Style, ExStyle, &WindowBorders, FALSE); UserGetWindowBorders(Style, ExStyle, &WindowBorders, FALSE);
InflateRect(&WindowRect, -WindowBorders.cx, -WindowBorders.cy); InflateRect(&WindowRect, -WindowBorders.cx, -WindowBorders.cy);
@ -697,7 +697,7 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
if (!PtInRect(&WindowRect, Point)) if (!PtInRect(&WindowRect, Point))
{ {
BOOL ThickFrame; BOOL ThickFrame;
ThickFrame = (Style & WS_THICKFRAME); ThickFrame = (Style & WS_THICKFRAME);
if (Point.y < WindowRect.top) if (Point.y < WindowRect.top)
{ {
@ -794,20 +794,20 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
return HTCAPTION; return HTCAPTION;
} }
} }
if(!(Style & WS_MINIMIZE)) if(!(Style & WS_MINIMIZE))
{ {
HMENU menu; HMENU menu;
ClientPoint = Point; ClientPoint = Point;
ScreenToClient(hWnd, &ClientPoint); ScreenToClient(hWnd, &ClientPoint);
GetClientRect(hWnd, &ClientRect); GetClientRect(hWnd, &ClientRect);
if (PtInRect(&ClientRect, ClientPoint)) if (PtInRect(&ClientRect, ClientPoint))
{ {
return HTCLIENT; return HTCLIENT;
} }
if ((menu = GetMenu(hWnd)) && !(Style & WS_CHILD)) if ((menu = GetMenu(hWnd)) && !(Style & WS_CHILD))
{ {
if (Point.x > 0 && Point.x < WindowRect.right && ClientPoint.y < 0) if (Point.x > 0 && Point.x < WindowRect.right && ClientPoint.y < 0)
@ -846,7 +846,7 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
TempRect.bottom = TempRect2.bottom; TempRect.bottom = TempRect2.bottom;
if(Parent) if(Parent)
GetClientRect(Parent, &ParentRect); GetClientRect(Parent, &ParentRect);
if (PtInRect(&TempRect, Point) && HASSIZEGRIP(Style, ExStyle, if (PtInRect(&TempRect, Point) && HASSIZEGRIP(Style, ExStyle,
GetWindowLongW(Parent, GWL_STYLE), OrigWndRect, ParentRect)) GetWindowLongW(Parent, GWL_STYLE), OrigWndRect, ParentRect))
{ {
if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
@ -877,7 +877,7 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
} }
} }
} }
return HTNOWHERE; return HTNOWHERE;
} }
@ -889,7 +889,7 @@ DefWndDoButton(HWND hWnd, WPARAM wParam)
BOOL Pressed = TRUE, OldState; BOOL Pressed = TRUE, OldState;
WPARAM SCMsg; WPARAM SCMsg;
ULONG ButtonType, Style; ULONG ButtonType, Style;
Style = GetWindowLongW(hWnd, GWL_STYLE); Style = GetWindowLongW(hWnd, GWL_STYLE);
switch (wParam) switch (wParam)
{ {
@ -916,7 +916,7 @@ DefWndDoButton(HWND hWnd, WPARAM wParam)
ASSERT(FALSE); ASSERT(FALSE);
return; return;
} }
/* /*
* FIXME: Not sure where to do this, but we must flush the pending * FIXME: Not sure where to do this, but we must flush the pending
* window updates when someone clicks on the close button and at * window updates when someone clicks on the close button and at
@ -929,12 +929,12 @@ DefWndDoButton(HWND hWnd, WPARAM wParam)
UserDrawCaptionButtonWnd(hWnd, WindowDC, TRUE, ButtonType); UserDrawCaptionButtonWnd(hWnd, WindowDC, TRUE, ButtonType);
SetCapture(hWnd); SetCapture(hWnd);
for (;;) for (;;)
{ {
if (GetMessageW(&Msg, 0, WM_MOUSEFIRST, WM_MOUSELAST) <= 0) if (GetMessageW(&Msg, 0, WM_MOUSEFIRST, WM_MOUSELAST) <= 0)
break; break;
if (Msg.message == WM_LBUTTONUP) if (Msg.message == WM_LBUTTONUP)
break; break;
@ -946,7 +946,7 @@ DefWndDoButton(HWND hWnd, WPARAM wParam)
if (Pressed != OldState) if (Pressed != OldState)
UserDrawCaptionButtonWnd(hWnd, WindowDC, Pressed, ButtonType); UserDrawCaptionButtonWnd(hWnd, WindowDC, Pressed, ButtonType);
} }
if (Pressed) if (Pressed)
UserDrawCaptionButtonWnd(hWnd, WindowDC, FALSE, ButtonType); UserDrawCaptionButtonWnd(hWnd, WindowDC, FALSE, ButtonType);
ReleaseCapture(); ReleaseCapture();
@ -1022,7 +1022,7 @@ LRESULT
DefWndNCLButtonDblClk(HWND hWnd, WPARAM wParam, LPARAM lParam) DefWndNCLButtonDblClk(HWND hWnd, WPARAM wParam, LPARAM lParam)
{ {
ULONG Style; ULONG Style;
Style = GetWindowLongW(hWnd, GWL_STYLE); Style = GetWindowLongW(hWnd, GWL_STYLE);
switch(wParam) switch(wParam)
{ {
@ -1073,13 +1073,13 @@ DefWndTrackScrollBar(HWND hWnd, WPARAM wParam, POINT Point)
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
AdjustWindowRectEx(LPRECT lpRect, AdjustWindowRectEx(LPRECT lpRect,
DWORD dwStyle, DWORD dwStyle,
BOOL bMenu, BOOL bMenu,
DWORD dwExStyle) DWORD dwExStyle)
{ {
SIZE BorderSize; SIZE BorderSize;
if (bMenu) if (bMenu)
{ {
lpRect->top -= GetSystemMetrics(SM_CYMENU); lpRect->top -= GetSystemMetrics(SM_CYMENU);
@ -1150,7 +1150,7 @@ DrawCaption(HWND hWnd, HDC hDC, LPCRECT lprc, UINT uFlags)
#endif #endif
Style = GetWindowLongW(hWnd, GWL_STYLE); Style = GetWindowLongW(hWnd, GWL_STYLE);
/* Windows behaves like this */ /* Windows behaves like this */
Height = GetSystemMetrics(SM_CYCAPTION) - 1; Height = GetSystemMetrics(SM_CYCAPTION) - 1;
@ -1177,13 +1177,13 @@ DrawCaption(HWND hWnd, HDC hDC, LPCRECT lprc, UINT uFlags)
TRIVERTEX vert[2]; TRIVERTEX vert[2];
COLORREF Colors[2]; COLORREF Colors[2];
LONG xx; LONG xx;
r.right = (lprc->right - lprc->left); r.right = (lprc->right - lprc->left);
if (uFlags & DC_SMALLCAP) if (uFlags & DC_SMALLCAP)
ButtonWidth = GetSystemMetrics(SM_CXSMSIZE) - 2; ButtonWidth = GetSystemMetrics(SM_CXSMSIZE) - 2;
else else
ButtonWidth = GetSystemMetrics(SM_CXSIZE) - 2; ButtonWidth = GetSystemMetrics(SM_CXSIZE) - 2;
if (Style & WS_SYSMENU) if (Style & WS_SYSMENU)
{ {
r.right -= 3 + ButtonWidth; r.right -= 3 + ButtonWidth;
@ -1196,10 +1196,10 @@ DrawCaption(HWND hWnd, HDC hDC, LPCRECT lprc, UINT uFlags)
r.right -= 2; r.right -= 2;
} }
} }
Colors[0] = GetSysColor((uFlags & DC_ACTIVE) ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION); Colors[0] = GetSysColor((uFlags & DC_ACTIVE) ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION);
Colors[1] = GetSysColor((uFlags & DC_ACTIVE) ? COLOR_GRADIENTACTIVECAPTION : COLOR_GRADIENTINACTIVECAPTION); Colors[1] = GetSysColor((uFlags & DC_ACTIVE) ? COLOR_GRADIENTACTIVECAPTION : COLOR_GRADIENTINACTIVECAPTION);
if ((uFlags & DC_ICON) && (Style & WS_SYSMENU) && !(uFlags & DC_SMALLCAP)) if ((uFlags & DC_ICON) && (Style & WS_SYSMENU) && !(uFlags & DC_SMALLCAP))
{ {
OldBrush = SelectObject(MemDC, GetSysColorBrush(uFlags & DC_ACTIVE ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION)); OldBrush = SelectObject(MemDC, GetSysColorBrush(uFlags & DC_ACTIVE ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION));
@ -1213,23 +1213,23 @@ DrawCaption(HWND hWnd, HDC hDC, LPCRECT lprc, UINT uFlags)
r.left += xx; r.left += xx;
r.top ++; r.top ++;
} }
vert[0].x = r.left; vert[0].x = r.left;
vert[0].y = 0; vert[0].y = 0;
vert[0].Red = GetRValue(Colors[0]) << 8; vert[0].Red = GetRValue(Colors[0]) << 8;
vert[0].Green = GetGValue(Colors[0]) << 8; vert[0].Green = GetGValue(Colors[0]) << 8;
vert[0].Blue = GetBValue(Colors[0]) << 8; vert[0].Blue = GetBValue(Colors[0]) << 8;
vert[0].Alpha = 0; vert[0].Alpha = 0;
vert[1].x = r.right; vert[1].x = r.right;
vert[1].y = lprc->bottom - lprc->top; vert[1].y = lprc->bottom - lprc->top;
vert[1].Red = GetRValue(Colors[1]) << 8; vert[1].Red = GetRValue(Colors[1]) << 8;
vert[1].Green = GetGValue(Colors[1]) << 8; vert[1].Green = GetGValue(Colors[1]) << 8;
vert[1].Blue = GetBValue(Colors[1]) << 8; vert[1].Blue = GetBValue(Colors[1]) << 8;
vert[1].Alpha = 0; vert[1].Alpha = 0;
GdiGradientFill(MemDC, vert, 2, &gcap, 1, GRADIENT_FILL_RECT_H); GdiGradientFill(MemDC, vert, 2, &gcap, 1, GRADIENT_FILL_RECT_H);
if(OldBrush) if(OldBrush)
{ {
SelectObject(MemDC, OldBrush); SelectObject(MemDC, OldBrush);
@ -1250,7 +1250,7 @@ DrawCaption(HWND hWnd, HDC hDC, LPCRECT lprc, UINT uFlags)
if (! PatBlt(MemDC, 0, 0, lprc->right - lprc->left, lprc->bottom - lprc->top, PATCOPY )) goto cleanup; if (! PatBlt(MemDC, 0, 0, lprc->right - lprc->left, lprc->bottom - lprc->top, PATCOPY )) goto cleanup;
} }
} }
if ((uFlags & DC_ICON) && !(uFlags & DC_GRADIENT) && (Style & WS_SYSMENU) && !(uFlags & DC_SMALLCAP)) if ((uFlags & DC_ICON) && !(uFlags & DC_GRADIENT) && (Style & WS_SYSMENU) && !(uFlags & DC_SMALLCAP))
{ {
/* For some reason the icon isn't centered correctly... */ /* For some reason the icon isn't centered correctly... */
@ -1301,14 +1301,14 @@ DrawCaption(HWND hWnd, HDC hDC, LPCRECT lprc, UINT uFlags)
hOldFont = SelectObject(MemDC, hFont); hOldFont = SelectObject(MemDC, hFont);
if (! hOldFont) goto cleanup; if (! hOldFont) goto cleanup;
if (uFlags & DC_INBUTTON) if (uFlags & DC_INBUTTON)
OldTextColor = SetTextColor(MemDC, GetSysColor(uFlags & DC_ACTIVE ? COLOR_BTNTEXT : COLOR_GRAYTEXT)); OldTextColor = SetTextColor(MemDC, GetSysColor(uFlags & DC_ACTIVE ? COLOR_BTNTEXT : COLOR_GRAYTEXT));
else else
OldTextColor = SetTextColor(MemDC, GetSysColor(uFlags & DC_ACTIVE ? COLOR_CAPTIONTEXT : COLOR_INACTIVECAPTIONTEXT)); OldTextColor = SetTextColor(MemDC, GetSysColor(uFlags & DC_ACTIVE ? COLOR_CAPTIONTEXT : COLOR_INACTIVECAPTIONTEXT));
DrawTextW(MemDC, buffer, wcslen(buffer), &r, DT_VCENTER | DT_END_ELLIPSIS); DrawTextW(MemDC, buffer, wcslen(buffer), &r, DT_VCENTER | DT_END_ELLIPSIS);
SetTextColor(MemDC, OldTextColor); SetTextColor(MemDC, OldTextColor);
} }

View file

@ -41,7 +41,7 @@ BOOL STDCALL PolyPatBlt(HDC,DWORD,PPATRECT,INT,ULONG);
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID VOID
CreateFrameBrushes(VOID) CreateFrameBrushes(VOID)
{ {
FrameBrushes[0] = CreateSolidBrush(RGB(0,0,0)); FrameBrushes[0] = CreateSolidBrush(RGB(0,0,0));
@ -60,7 +60,7 @@ CreateFrameBrushes(VOID)
FrameBrushes[12] = CreatePatternBrush(hHatch); FrameBrushes[12] = CreatePatternBrush(hHatch);
} }
VOID VOID
DeleteFrameBrushes(VOID) DeleteFrameBrushes(VOID)
{ {
unsigned Brush; unsigned Brush;

View file

@ -52,13 +52,13 @@ EnumPropsA(HWND hWnd, PROPENUMPROCA lpEnumFunc)
NTSTATUS Status; NTSTATUS Status;
DWORD Count; DWORD Count;
int ret = -1; int ret = -1;
if(!lpEnumFunc) if(!lpEnumFunc)
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return ret; return ret;
} }
Status = NtUserBuildPropList(hWnd, NULL, 0, &Count); Status = NtUserBuildPropList(hWnd, NULL, 0, &Count);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
@ -68,11 +68,11 @@ EnumPropsA(HWND hWnd, PROPENUMPROCA lpEnumFunc)
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return ret; return ret;
} }
if(Count > 0) if(Count > 0)
{ {
pli = RtlAllocateHeap(GetProcessHeap(), 0, Count); pli = RtlAllocateHeap(GetProcessHeap(), 0, Count);
Status = NtUserBuildPropList(hWnd, (LPVOID)pli, Count, &Count); Status = NtUserBuildPropList(hWnd, (LPVOID)pli, Count, &Count);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
@ -83,23 +83,23 @@ EnumPropsA(HWND hWnd, PROPENUMPROCA lpEnumFunc)
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return ret; return ret;
} }
i = pli; i = pli;
for(; Count > 0; Count--, i++) for(; Count > 0; Count--, i++)
{ {
char str[ATOM_BUFFER_SIZE]; char str[ATOM_BUFFER_SIZE];
if(!GlobalGetAtomNameA(i->Atom, str, ATOM_BUFFER_SIZE)) if(!GlobalGetAtomNameA(i->Atom, str, ATOM_BUFFER_SIZE))
continue; continue;
ret = lpEnumFunc(hWnd, str, i->Data); ret = lpEnumFunc(hWnd, str, i->Data);
if(!ret) if(!ret)
break; break;
} }
RtlFreeHeap(GetProcessHeap(), 0, pli); RtlFreeHeap(GetProcessHeap(), 0, pli);
} }
return ret; return ret;
} }
@ -114,13 +114,13 @@ EnumPropsExA(HWND hWnd, PROPENUMPROCEXA lpEnumFunc, LPARAM lParam)
NTSTATUS Status; NTSTATUS Status;
DWORD Count; DWORD Count;
int ret = -1; int ret = -1;
if(!lpEnumFunc) if(!lpEnumFunc)
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return ret; return ret;
} }
Status = NtUserBuildPropList(hWnd, NULL, 0, &Count); Status = NtUserBuildPropList(hWnd, NULL, 0, &Count);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
@ -130,11 +130,11 @@ EnumPropsExA(HWND hWnd, PROPENUMPROCEXA lpEnumFunc, LPARAM lParam)
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return ret; return ret;
} }
if(Count > 0) if(Count > 0)
{ {
pli = RtlAllocateHeap(GetProcessHeap(), 0, Count); pli = RtlAllocateHeap(GetProcessHeap(), 0, Count);
Status = NtUserBuildPropList(hWnd, (LPVOID)pli, Count, &Count); Status = NtUserBuildPropList(hWnd, (LPVOID)pli, Count, &Count);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
@ -145,23 +145,23 @@ EnumPropsExA(HWND hWnd, PROPENUMPROCEXA lpEnumFunc, LPARAM lParam)
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return ret; return ret;
} }
i = pli; i = pli;
for(; Count > 0; Count--, i++) for(; Count > 0; Count--, i++)
{ {
char str[ATOM_BUFFER_SIZE]; char str[ATOM_BUFFER_SIZE];
if(!GlobalGetAtomNameA(i->Atom, str, ATOM_BUFFER_SIZE)) if(!GlobalGetAtomNameA(i->Atom, str, ATOM_BUFFER_SIZE))
continue; continue;
ret = lpEnumFunc(hWnd, str, i->Data, lParam); ret = lpEnumFunc(hWnd, str, i->Data, lParam);
if(!ret) if(!ret)
break; break;
} }
RtlFreeHeap(GetProcessHeap(), 0, pli); RtlFreeHeap(GetProcessHeap(), 0, pli);
} }
return ret; return ret;
} }
@ -176,13 +176,13 @@ EnumPropsExW(HWND hWnd, PROPENUMPROCEXW lpEnumFunc, LPARAM lParam)
NTSTATUS Status; NTSTATUS Status;
DWORD Count; DWORD Count;
int ret = -1; int ret = -1;
if(!lpEnumFunc) if(!lpEnumFunc)
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return ret; return ret;
} }
Status = NtUserBuildPropList(hWnd, NULL, 0, &Count); Status = NtUserBuildPropList(hWnd, NULL, 0, &Count);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
@ -192,11 +192,11 @@ EnumPropsExW(HWND hWnd, PROPENUMPROCEXW lpEnumFunc, LPARAM lParam)
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return ret; return ret;
} }
if(Count > 0) if(Count > 0)
{ {
pli = RtlAllocateHeap(GetProcessHeap(), 0, Count); pli = RtlAllocateHeap(GetProcessHeap(), 0, Count);
Status = NtUserBuildPropList(hWnd, (LPVOID)pli, Count, &Count); Status = NtUserBuildPropList(hWnd, (LPVOID)pli, Count, &Count);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
@ -207,23 +207,23 @@ EnumPropsExW(HWND hWnd, PROPENUMPROCEXW lpEnumFunc, LPARAM lParam)
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return ret; return ret;
} }
i = pli; i = pli;
for(; Count > 0; Count--, i++) for(; Count > 0; Count--, i++)
{ {
WCHAR str[ATOM_BUFFER_SIZE]; WCHAR str[ATOM_BUFFER_SIZE];
if(!GlobalGetAtomNameW(i->Atom, str, ATOM_BUFFER_SIZE)) if(!GlobalGetAtomNameW(i->Atom, str, ATOM_BUFFER_SIZE))
continue; continue;
ret = lpEnumFunc(hWnd, str, i->Data, lParam); ret = lpEnumFunc(hWnd, str, i->Data, lParam);
if(!ret) if(!ret)
break; break;
} }
RtlFreeHeap(GetProcessHeap(), 0, pli); RtlFreeHeap(GetProcessHeap(), 0, pli);
} }
return ret; return ret;
} }
@ -238,13 +238,13 @@ EnumPropsW(HWND hWnd, PROPENUMPROCW lpEnumFunc)
NTSTATUS Status; NTSTATUS Status;
DWORD Count; DWORD Count;
int ret = -1; int ret = -1;
if(!lpEnumFunc) if(!lpEnumFunc)
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return ret; return ret;
} }
Status = NtUserBuildPropList(hWnd, NULL, 0, &Count); Status = NtUserBuildPropList(hWnd, NULL, 0, &Count);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
@ -254,11 +254,11 @@ EnumPropsW(HWND hWnd, PROPENUMPROCW lpEnumFunc)
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return ret; return ret;
} }
if(Count > 0) if(Count > 0)
{ {
pli = RtlAllocateHeap(GetProcessHeap(), 0, Count); pli = RtlAllocateHeap(GetProcessHeap(), 0, Count);
Status = NtUserBuildPropList(hWnd, (LPVOID)pli, Count, &Count); Status = NtUserBuildPropList(hWnd, (LPVOID)pli, Count, &Count);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
@ -269,23 +269,23 @@ EnumPropsW(HWND hWnd, PROPENUMPROCW lpEnumFunc)
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return ret; return ret;
} }
i = pli; i = pli;
for(; Count > 0; Count--, i++) for(; Count > 0; Count--, i++)
{ {
WCHAR str[ATOM_BUFFER_SIZE]; WCHAR str[ATOM_BUFFER_SIZE];
if(!GlobalGetAtomNameW(i->Atom, str, ATOM_BUFFER_SIZE)) if(!GlobalGetAtomNameW(i->Atom, str, ATOM_BUFFER_SIZE))
continue; continue;
ret = lpEnumFunc(hWnd, str, i->Data); ret = lpEnumFunc(hWnd, str, i->Data);
if(!ret) if(!ret)
break; break;
} }
RtlFreeHeap(GetProcessHeap(), 0, pli); RtlFreeHeap(GetProcessHeap(), 0, pli);
} }
return ret; return ret;
} }
@ -313,7 +313,7 @@ GetPropA(HWND hWnd, LPCSTR lpString)
else else
{ {
Ret = GetPropW(hWnd, (LPWSTR)lpString); Ret = GetPropW(hWnd, (LPWSTR)lpString);
} }
return(Ret); return(Ret);
} }
@ -395,7 +395,7 @@ SetPropA(HWND hWnd, LPCSTR lpString, HANDLE hData)
PWSTR lpWString; PWSTR lpWString;
UNICODE_STRING UString; UNICODE_STRING UString;
BOOL Ret; BOOL Ret;
if (HIWORD(lpString)) if (HIWORD(lpString))
{ {
RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString); RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
@ -430,6 +430,6 @@ SetPropW(HWND hWnd, LPCWSTR lpString, HANDLE hData)
{ {
Atom = LOWORD((DWORD)lpString); Atom = LOWORD((DWORD)lpString);
} }
return(NtUserSetProp(hWnd, Atom, hData)); return(NtUserSetProp(hWnd, Atom, hData));
} }

View file

@ -41,7 +41,7 @@ CopyRect(LPRECT lprcDst, CONST RECT *lprcSrc)
{ {
if(lprcDst == NULL || lprcSrc == NULL) if(lprcDst == NULL || lprcSrc == NULL)
return(FALSE); return(FALSE);
*lprcDst = *lprcSrc; *lprcDst = *lprcSrc;
return(TRUE); return(TRUE);
} }
@ -57,7 +57,7 @@ EqualRect(
{ {
if (lprc1 == NULL || lprc2 == NULL) if (lprc1 == NULL || lprc2 == NULL)
return FALSE; return FALSE;
return (lprc1->left == lprc2->left) && (lprc1->top == lprc2->top) && return (lprc1->left == lprc2->left) && (lprc1->top == lprc2->top) &&
(lprc1->right == lprc2->right) && (lprc1->bottom == lprc2->bottom); (lprc1->right == lprc2->right) && (lprc1->bottom == lprc2->bottom);
} }
@ -86,9 +86,9 @@ IntersectRect(LPRECT lprcDst,
CONST RECT *lprcSrc2) CONST RECT *lprcSrc2)
{ {
if (IsRectEmpty(lprcSrc1) || IsRectEmpty(lprcSrc2) || if (IsRectEmpty(lprcSrc1) || IsRectEmpty(lprcSrc2) ||
lprcSrc1->left >= lprcSrc2->right || lprcSrc1->left >= lprcSrc2->right ||
lprcSrc2->left >= lprcSrc1->right || lprcSrc2->left >= lprcSrc1->right ||
lprcSrc1->top >= lprcSrc2->bottom || lprcSrc1->top >= lprcSrc2->bottom ||
lprcSrc2->top >= lprcSrc1->bottom) lprcSrc2->top >= lprcSrc1->bottom)
{ {
SetRectEmpty(lprcDst); SetRectEmpty(lprcDst);
@ -120,12 +120,12 @@ OffsetRect(LPRECT rect, int dx, int dy)
{ {
if(rect == NULL) if(rect == NULL)
return(FALSE); return(FALSE);
rect->left += dx; rect->left += dx;
rect->top += dy; rect->top += dy;
rect->right += dx; rect->right += dx;
rect->bottom += dy; rect->bottom += dy;
return(TRUE); return(TRUE);
} }
@ -168,15 +168,15 @@ BOOL STDCALL
SubtractRect(LPRECT lprcDst, CONST RECT *lprcSrc1, CONST RECT *lprcSrc2) SubtractRect(LPRECT lprcDst, CONST RECT *lprcSrc1, CONST RECT *lprcSrc2)
{ {
RECT tempRect; RECT tempRect;
if(lprcDst == NULL || lprcSrc1 == NULL || lprcSrc2 == NULL) if(lprcDst == NULL || lprcSrc1 == NULL || lprcSrc2 == NULL)
return(FALSE); return(FALSE);
CopyRect(lprcDst, lprcSrc1); CopyRect(lprcDst, lprcSrc1);
if(!IntersectRect(&tempRect, lprcSrc1, lprcSrc2)) if(!IntersectRect(&tempRect, lprcSrc1, lprcSrc2))
return(TRUE); return(TRUE);
if (EqualRect(&tempRect, lprcDst)) if (EqualRect(&tempRect, lprcDst))
{ {
SetRectEmpty(lprcDst); SetRectEmpty(lprcDst);
@ -196,7 +196,7 @@ SubtractRect(LPRECT lprcDst, CONST RECT *lprcSrc1, CONST RECT *lprcSrc2)
else if(lprcDst->right == tempRect.right) else if(lprcDst->right == tempRect.right)
lprcDst->right = tempRect.left; lprcDst->right = tempRect.left;
} }
return(TRUE); return(TRUE);
} }

View file

@ -87,11 +87,11 @@ BeginDeferWindowPos(int nNumWindows)
BOOL STDCALL BOOL STDCALL
BringWindowToTop(HWND hWnd) BringWindowToTop(HWND hWnd)
{ {
return NtUserSetWindowPos( hWnd, return NtUserSetWindowPos( hWnd,
HWND_TOP, HWND_TOP,
0, 0,
0, 0,
0, 0,
0, 0,
SWP_NOSIZE | SWP_NOMOVE ); SWP_NOSIZE | SWP_NOMOVE );
} }
@ -217,7 +217,7 @@ CreateWindowExA(DWORD dwExStyle,
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
return (HWND)0; return (HWND)0;
} }
if(!hMenu && (dwStyle & (WS_OVERLAPPEDWINDOW | WS_POPUP))) if(!hMenu && (dwStyle & (WS_OVERLAPPEDWINDOW | WS_POPUP)))
{ {
wce.cbSize = sizeof(WNDCLASSEXA); wce.cbSize = sizeof(WNDCLASSEXA);
@ -248,11 +248,11 @@ CreateWindowExA(DWORD dwExStyle,
RtlFreeUnicodeString(&WindowName); RtlFreeUnicodeString(&WindowName);
if (!IS_ATOM(lpClassName)) if (!IS_ATOM(lpClassName))
{ {
RtlFreeUnicodeString(&ClassName); RtlFreeUnicodeString(&ClassName);
} }
return Handle; return Handle;
} }
@ -289,12 +289,12 @@ CreateWindowExW(DWORD dwExStyle,
return CreateMDIWindowW(lpClassName, lpWindowName, dwStyle, x, y, return CreateMDIWindowW(lpClassName, lpWindowName, dwStyle, x, y,
nWidth, nHeight, hWndParent, hInstance, (LPARAM)lpParam); nWidth, nHeight, hWndParent, hInstance, (LPARAM)lpParam);
if (IS_ATOM(lpClassName)) if (IS_ATOM(lpClassName))
{ {
RtlInitUnicodeString(&ClassName, NULL); RtlInitUnicodeString(&ClassName, NULL);
ClassName.Buffer = (LPWSTR)lpClassName; ClassName.Buffer = (LPWSTR)lpClassName;
} }
else else
{ {
RtlInitUnicodeString(&ClassName, lpClassName); RtlInitUnicodeString(&ClassName, lpClassName);
} }
@ -542,12 +542,12 @@ FindWindowExA(HWND hwndParent,
ucClassName.Buffer = NULL; ucClassName.Buffer = NULL;
ucClassName.Length = 0; ucClassName.Length = 0;
} }
else if (IS_ATOM(lpszClass)) else if (IS_ATOM(lpszClass))
{ {
ucClassName.Buffer = (LPWSTR)lpszClass; ucClassName.Buffer = (LPWSTR)lpszClass;
ucClassName.Length = 0; ucClassName.Length = 0;
} }
else else
{ {
RtlCreateUnicodeStringFromAsciiz(&ucClassName, (LPSTR)lpszClass); RtlCreateUnicodeStringFromAsciiz(&ucClassName, (LPSTR)lpszClass);
} }
@ -557,7 +557,7 @@ FindWindowExA(HWND hwndParent,
Result = NtUserFindWindowEx(hwndParent, hwndChildAfter, &ucClassName, Result = NtUserFindWindowEx(hwndParent, hwndChildAfter, &ucClassName,
&ucWindowName); &ucWindowName);
if (!IS_ATOM(lpszClass)) if (!IS_ATOM(lpszClass))
RtlFreeUnicodeString(&ucClassName); RtlFreeUnicodeString(&ucClassName);
RtlFreeUnicodeString(&ucWindowName); RtlFreeUnicodeString(&ucWindowName);
@ -582,16 +582,16 @@ FindWindowExW(HWND hwndParent,
ucClassName.Buffer = NULL; ucClassName.Buffer = NULL;
ucClassName.Length = 0; ucClassName.Length = 0;
} }
else if (IS_ATOM(lpszClass)) else if (IS_ATOM(lpszClass))
{ {
RtlInitUnicodeString(&ucClassName, NULL); RtlInitUnicodeString(&ucClassName, NULL);
ucClassName.Buffer = (LPWSTR)lpszClass; ucClassName.Buffer = (LPWSTR)lpszClass;
} }
else else
{ {
RtlInitUnicodeString(&ucClassName, lpszClass); RtlInitUnicodeString(&ucClassName, lpszClass);
} }
RtlInitUnicodeString(&ucWindowName, lpszWindow); RtlInitUnicodeString(&ucWindowName, lpszWindow);
return NtUserFindWindowEx(hwndParent, hwndChildAfter, &ucClassName, &ucWindowName); return NtUserFindWindowEx(hwndParent, hwndChildAfter, &ucClassName, &ucWindowName);
@ -616,14 +616,14 @@ FindWindowA(LPCSTR lpClassName, LPCSTR lpWindowName)
HWND STDCALL HWND STDCALL
FindWindowW(LPCWSTR lpClassName, LPCWSTR lpWindowName) FindWindowW(LPCWSTR lpClassName, LPCWSTR lpWindowName)
{ {
/* /*
There was a FIXME here earlier, but I think it is just a documentation unclarity. There was a FIXME here earlier, but I think it is just a documentation unclarity.
FindWindow only searches top level windows. What they mean is that child FindWindow only searches top level windows. What they mean is that child
windows of other windows than the desktop can be searched. windows of other windows than the desktop can be searched.
FindWindowExW never does a recursive search. FindWindowExW never does a recursive search.
/ Joakim / Joakim
*/ */
@ -778,12 +778,12 @@ GetWindowModuleFileNameA(HWND hwnd,
UINT cchFileNameMax) UINT cchFileNameMax)
{ {
HINSTANCE hWndInst; HINSTANCE hWndInst;
if(!(hWndInst = NtUserGetWindowInstance(hwnd))) if(!(hWndInst = NtUserGetWindowInstance(hwnd)))
{ {
return 0; return 0;
} }
return GetModuleFileNameA(hWndInst, lpszFileName, cchFileNameMax); return GetModuleFileNameA(hWndInst, lpszFileName, cchFileNameMax);
} }
@ -797,12 +797,12 @@ GetWindowModuleFileNameW(HWND hwnd,
UINT cchFileNameMax) UINT cchFileNameMax)
{ {
HINSTANCE hWndInst; HINSTANCE hWndInst;
if(!(hWndInst = NtUserGetWindowInstance(hwnd))) if(!(hWndInst = NtUserGetWindowInstance(hwnd)))
{ {
return 0; return 0;
} }
return GetModuleFileNameW(hWndInst, lpszFileName, cchFileNameMax); return GetModuleFileNameW(hWndInst, lpszFileName, cchFileNameMax);
} }
@ -840,13 +840,13 @@ GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
{ {
return 0; return 0;
} }
if(ProcessId != GetCurrentProcessId()) if(ProcessId != GetCurrentProcessId())
{ {
/* do not send WM_GETTEXT messages to other processes */ /* do not send WM_GETTEXT messages to other processes */
LPWSTR Buffer; LPWSTR Buffer;
INT Length; INT Length;
if (nMaxCount > 1) if (nMaxCount > 1)
{ {
*((PWSTR)lpString) = '\0'; *((PWSTR)lpString) = '\0';
@ -861,12 +861,12 @@ GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
{ {
lpString[0] = '\0'; lpString[0] = '\0';
} }
HeapFree(GetProcessHeap(), 0, Buffer); HeapFree(GetProcessHeap(), 0, Buffer);
return (LRESULT)Length; return (LRESULT)Length;
} }
return(SendMessageA(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString)); return(SendMessageA(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString));
} }
@ -882,12 +882,12 @@ GetWindowTextLengthA(HWND hWnd)
{ {
return 0; return 0;
} }
if(ProcessId == GetCurrentProcessId()) if(ProcessId == GetCurrentProcessId())
{ {
return(SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0)); return(SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0));
} }
/* do not send WM_GETTEXT messages to other processes */ /* do not send WM_GETTEXT messages to other processes */
return (LRESULT)NtUserInternalGetWindowText(hWnd, NULL, 0); return (LRESULT)NtUserInternalGetWindowText(hWnd, NULL, 0);
} }
@ -904,12 +904,12 @@ GetWindowTextLengthW(HWND hWnd)
{ {
return 0; return 0;
} }
if(ProcessId == GetCurrentProcessId()) if(ProcessId == GetCurrentProcessId())
{ {
return(SendMessageW(hWnd, WM_GETTEXTLENGTH, 0, 0)); return(SendMessageW(hWnd, WM_GETTEXTLENGTH, 0, 0));
} }
/* do not send WM_GETTEXT messages to other processes */ /* do not send WM_GETTEXT messages to other processes */
return (LRESULT)NtUserInternalGetWindowText(hWnd, NULL, 0); return (LRESULT)NtUserInternalGetWindowText(hWnd, NULL, 0);
} }
@ -929,18 +929,18 @@ GetWindowTextW(
{ {
return 0; return 0;
} }
if(ProcessId == GetCurrentProcessId()) if(ProcessId == GetCurrentProcessId())
{ {
return(SendMessageW(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString)); return(SendMessageW(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString));
} }
/* do not send WM_GETTEXT messages to other processes */ /* do not send WM_GETTEXT messages to other processes */
if (nMaxCount > 1) if (nMaxCount > 1)
{ {
*((PWSTR)lpString) = L'\0'; *((PWSTR)lpString) = L'\0';
} }
return (LRESULT)NtUserInternalGetWindowText(hWnd, (PWSTR)lpString, nMaxCount); return (LRESULT)NtUserInternalGetWindowText(hWnd, (PWSTR)lpString, nMaxCount);
} }
@ -964,12 +964,12 @@ IsChild(HWND hWndParent,
return FALSE; return FALSE;
} }
do do
{ {
hWnd = (HWND)NtUserGetWindowLong(hWnd, GWL_HWNDPARENT, FALSE); hWnd = (HWND)NtUserGetWindowLong(hWnd, GWL_HWNDPARENT, FALSE);
} }
while (hWnd != NULL && hWnd != hWndParent); while (hWnd != NULL && hWnd != hWndParent);
return hWnd == hWndParent; return hWnd == hWndParent;
} }
@ -980,7 +980,7 @@ IsChild(HWND hWndParent,
BOOL STDCALL BOOL STDCALL
IsIconic(HWND hWnd) IsIconic(HWND hWnd)
{ {
return (NtUserGetWindowLong( hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE) != 0; return (NtUserGetWindowLong( hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE) != 0;
} }
@ -1088,7 +1088,7 @@ AnimateWindow(HWND hwnd,
/* If trying to show/hide and it's already * /* If trying to show/hide and it's already *
* shown/hidden or invalid window, fail with * * shown/hidden or invalid window, fail with *
* invalid parameter */ * invalid parameter */
BOOL visible; BOOL visible;
visible = IsWindowVisible(hwnd); visible = IsWindowVisible(hwnd);
// if(!IsWindow(hwnd) || // if(!IsWindow(hwnd) ||
@ -1217,13 +1217,13 @@ SetWindowTextA(HWND hWnd,
{ {
return FALSE; return FALSE;
} }
if(ProcessId != GetCurrentProcessId()) if(ProcessId != GetCurrentProcessId())
{ {
/* do not send WM_GETTEXT messages to other processes */ /* do not send WM_GETTEXT messages to other processes */
ANSI_STRING AnsiString; ANSI_STRING AnsiString;
UNICODE_STRING UnicodeString; UNICODE_STRING UnicodeString;
if(lpString) if(lpString)
{ {
RtlInitAnsiString(&AnsiString, (LPSTR)lpString); RtlInitAnsiString(&AnsiString, (LPSTR)lpString);
@ -1233,14 +1233,14 @@ SetWindowTextA(HWND hWnd,
} }
else else
NtUserDefSetText(hWnd, NULL); NtUserDefSetText(hWnd, NULL);
if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION) if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
{ {
DefWndNCPaint(hWnd, (HRGN)1, -1); DefWndNCPaint(hWnd, (HRGN)1, -1);
} }
return TRUE; return TRUE;
} }
return SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString); return SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString);
} }
@ -1257,24 +1257,24 @@ SetWindowTextW(HWND hWnd,
{ {
return FALSE; return FALSE;
} }
if(ProcessId != GetCurrentProcessId()) if(ProcessId != GetCurrentProcessId())
{ {
/* do not send WM_GETTEXT messages to other processes */ /* do not send WM_GETTEXT messages to other processes */
UNICODE_STRING UnicodeString; UNICODE_STRING UnicodeString;
if(lpString) if(lpString)
RtlInitUnicodeString(&UnicodeString, (LPWSTR)lpString); RtlInitUnicodeString(&UnicodeString, (LPWSTR)lpString);
NtUserDefSetText(hWnd, (lpString ? &UnicodeString : NULL)); NtUserDefSetText(hWnd, (lpString ? &UnicodeString : NULL));
if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION) if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
{ {
DefWndNCPaint(hWnd, (HRGN)1, -1); DefWndNCPaint(hWnd, (HRGN)1, -1);
} }
return TRUE; return TRUE;
} }
return SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString); return SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString);
} }
@ -1356,7 +1356,7 @@ UpdateLayeredWindow(HWND hwnd,
HWND STDCALL HWND STDCALL
WindowFromPoint(POINT Point) WindowFromPoint(POINT Point)
{ {
//TODO: Determine what the actual parameters to //TODO: Determine what the actual parameters to
// NtUserWindowFromPoint are. // NtUserWindowFromPoint are.
return NtUserWindowFromPoint(Point.x, Point.y); return NtUserWindowFromPoint(Point.x, Point.y);
} }
@ -1404,7 +1404,7 @@ MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints)
/* /*
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
ScreenToClient(HWND hWnd, LPPOINT lpPoint) ScreenToClient(HWND hWnd, LPPOINT lpPoint)
{ {
return(MapWindowPoints(NULL, hWnd, lpPoint, 1) != 0); return(MapWindowPoints(NULL, hWnd, lpPoint, 1) != 0);
@ -1534,7 +1534,7 @@ BOOL STDCALL
ScrollWindow(HWND hWnd, int dx, int dy, CONST RECT *lpRect, ScrollWindow(HWND hWnd, int dx, int dy, CONST RECT *lpRect,
CONST RECT *prcClip) CONST RECT *prcClip)
{ {
return NtUserScrollWindowEx(hWnd, dx, dy, lpRect, prcClip, 0, NULL, return NtUserScrollWindowEx(hWnd, dx, dy, lpRect, prcClip, 0, NULL,
(lpRect ? 0 : SW_SCROLLCHILDREN) | SW_INVALIDATE) != ERROR; (lpRect ? 0 : SW_SCROLLCHILDREN) | SW_INVALIDATE) != ERROR;
} }
@ -1574,11 +1574,11 @@ IsWindowInDestroy(HWND hWnd)
* @implemented * @implemented
*/ */
VOID VOID
STDCALL STDCALL
DisableProcessWindowsGhosting(VOID) DisableProcessWindowsGhosting(VOID)
{ {
NtUserEnableProcessWindowGhosting(FALSE); NtUserEnableProcessWindowGhosting(FALSE);
} }
/* EOF */ /* EOF */

View file

@ -27,7 +27,7 @@ WinPosGetMinMaxInfo(HWND hWnd, POINT* MaxSize, POINT* MaxPos,
POINT* MinTrack, POINT* MaxTrack) POINT* MinTrack, POINT* MaxTrack)
{ {
MINMAXINFO MinMax; MINMAXINFO MinMax;
if(NtUserGetMinMaxInfo(hWnd, &MinMax, TRUE)) if(NtUserGetMinMaxInfo(hWnd, &MinMax, TRUE))
{ {
MinMax.ptMaxTrackSize.x = max(MinMax.ptMaxTrackSize.x, MinMax.ptMaxTrackSize.x = max(MinMax.ptMaxTrackSize.x,