@H_404_3@NtUserRedrawWindow函数主要用来重画窗口显示。具体代码如下:@H_404_3@
@H_404_3@#001 BOOL APIENTRY
@H_404_3@#002 NtUserRedrawWindow(HWND hWnd,CONST RECT *lprcUpdate,HRGN hrgnUpdate,
@H_404_3@#003 UINT flags)
@H_404_3@#004 {
@H_404_3@#005 RECT SafeUpdateRect;
@H_404_3@#006 NTSTATUS Status;
@H_404_3@#007 PWINDOW_OBJECT Wnd;
@H_404_3@#008 DECLARE_RETURN(BOOL);
@H_404_3@#009 USER_REFERENCE_ENTRY Ref;
@H_404_3@#010
@H_404_3@#011 DPRINT("Enter NtUserRedrawWindow/n");
@H_404_3@
@H_404_3@#012 UserEnterExclusive();
@H_404_3@#013
@H_404_3@
@H_404_3@#014 if (!(Wnd = UserGetWindowObject(hWnd ? hWnd : IntGetDesktopWindow())))
@H_404_3@#015 {
@H_404_3@#016 RETURN( FALSE);
@H_404_3@#017 }
@H_404_3@#018
@H_404_3@
如果更新窗口的大小不为空,就是固定大小的窗口更新。@H_404_3@
@H_404_3@#019 if (lprcUpdate != NULL)
@H_404_3@#020 {
@H_404_3@#021 Status = MmCopyFromCaller(&SafeUpdateRect,(PRECT)lprcUpdate,
@H_404_3@#022 sizeof(RECT));
@H_404_3@#023
@H_404_3@#024 if (!NT_SUCCESS(Status))
@H_404_3@#025 {
@H_404_3@#026 SetLastWin32Error(ERROR_INVALID_PARAMETER);
@H_404_3@#027 RETURN( FALSE);
@H_404_3@#028 }
@H_404_3@#029 }
@H_404_3@#030
@H_404_3@
@H_404_3@#031 UserRefObjectCo(Wnd,&Ref);
@H_404_3@#032
@H_404_3@
调用函数@H_404_3@co_UserRedrawWindow来更新窗口。@H_404_3@
@H_404_3@#033 Status = co_UserRedrawWindow(Wnd,NULL == lprcUpdate ? NULL : &SafeUpdateRect,
@H_404_3@#034 hrgnUpdate,flags);
@H_404_3@#035
@H_404_3@
减少窗口引用计数。@H_404_3@
@H_404_3@#036 UserDerefObjectCo(Wnd);
@H_404_3@#037
@H_404_3@
如果执行不成功,就返回出错码。@H_404_3@
@H_404_3@#038 if (!NT_SUCCESS(Status))
@H_404_3@#039 {
@H_404_3@#040 /* IntRedrawWindow fails only in case that flags are invalid */
@H_404_3@#041 SetLastWin32Error(ERROR_INVALID_PARAMETER);
@H_404_3@#042 RETURN( FALSE);
@H_404_3@#043 }
@H_404_3@#044
@H_404_3@#045 RETURN( TRUE);
@H_404_3@#046
@H_404_3@#047 CLEANUP:
@H_404_3@#048 DPRINT("Leave NtUserRedrawWindow,ret=%i/n",_ret_);
@H_404_3@
@H_404_3@#049 UserLeave();
@H_404_3@#050 END_CLEANUP;
@H_404_3@#051}