Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

random.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

HBRUSH WINAPI GetSysColorBrush (int nIndex)
WINUSERAPI HANDLE WINAPI SetSysColorsTemp (CONST COLORREF *lpRGBs, CONST HBRUSH *lpBrushes, UINT_PTR cBrushes)
LPWSTR TextAlloc (LPCWSTR lpszSrc)
VOID WINAPI SetLastErrorEx (DWORD dwErrCode, DWORD dwType)
BOOL GetLastInputInfo (PLASTINPUTINFO plii)

Variables

HBRUSH ghbrWhite = NULL
HBRUSH ghbrBlack = NULL
LPCOLORREF gpOriginalRGBs = NULL
UINT gcOriginalRGBs = 0


Function Documentation

BOOL GetLastInputInfo PLASTINPUTINFO  plii  ) 
 

Definition at line 262 of file w32/ntuser/client/random.c.

References BOOL, FALSE, GetLastInputInfo(), gpsi, and TRUE.

Referenced by GetLastInputInfo().

00263 { 00264 VALIDATIONFNNAME(GetLastInputInfo); 00265 00266 if (plii->cbSize != sizeof(LASTINPUTINFO)) { 00267 VALIDATIONFAIL(plii->cbSize); 00268 } 00269 00270 plii->dwTime = gpsi->dwLastRITEventTickCount; 00271 00272 return TRUE; 00273 VALIDATIONERROR(FALSE); 00274 }

HBRUSH WINAPI GetSysColorBrush int  nIndex  ) 
 

Definition at line 32 of file w32/ntuser/client/random.c.

References NULL, and SYSHBRUSH.

00034 { 00035 if ((nIndex < 0) || (nIndex >= COLOR_MAX)) 00036 return NULL; 00037 00038 return SYSHBRUSH(nIndex); 00039 }

VOID WINAPI SetLastErrorEx DWORD  dwErrCode,
DWORD  dwType
 

Definition at line 208 of file w32/ntuser/client/random.c.

References VOID().

00212 { 00213 UNREFERENCED_PARAMETER(dwType); 00214 00215 SetLastError(dwErrCode); 00216 }

WINUSERAPI HANDLE WINAPI SetSysColorsTemp CONST COLORREF *  lpRGBs,
CONST HBRUSH *  lpBrushes,
UINT_PTR  cBrushes
 

Definition at line 63 of file w32/ntuser/client/random.c.

References gcOriginalRGBs, gpOriginalRGBs, gpsi, NtUserSetSysColors(), NULL, TRUE, UINT, UserLocalAlloc, and UserLocalFree.

00067 { 00068 UINT cbRGBSize; 00069 UINT i; 00070 UINT abElements[COLOR_MAX]; 00071 00072 /* 00073 * See if we are resetting the colors back to a saved state 00074 */ 00075 if (lpRGBs == NULL) { 00076 00077 /* 00078 * When restoring cBrushes is really a handle to the old global 00079 * handle. Make sure that is true. Also lpBrushes is unused 00080 */ 00081 UNREFERENCED_PARAMETER(lpBrushes); 00082 UserAssert(lpBrushes == NULL); 00083 UserAssert(cBrushes == (ULONG_PTR)gpOriginalRGBs); 00084 00085 if (gpOriginalRGBs == NULL) { 00086 RIPMSG0(RIP_ERROR, "SetSysColorsTemp: Can not restore if not saved"); 00087 return NULL; 00088 } 00089 00090 /* 00091 * reset the global Colors 00092 */ 00093 UserAssert((sizeof(abElements)/sizeof(abElements[0])) >= gcOriginalRGBs); 00094 for (i = 0; i < gcOriginalRGBs; i++) 00095 abElements[i] = i; 00096 00097 NtUserSetSysColors(gcOriginalRGBs, abElements, gpOriginalRGBs, 0); 00098 00099 UserLocalFree(gpOriginalRGBs); 00100 00101 gpOriginalRGBs = NULL; 00102 gcOriginalRGBs = 0; 00103 00104 return (HANDLE)TRUE; 00105 } 00106 00107 /* 00108 * Make sure we aren't trying to set too many colors 00109 * If we allow more then COLOR_MAX change the abElements array 00110 */ 00111 if (cBrushes > COLOR_MAX) { 00112 RIPMSG1(RIP_ERROR, "SetSysColorsTemp: trying to set too many colors %lX", cBrushes); 00113 return NULL; 00114 } 00115 00116 /* 00117 * If we have already a saved state then don't let them save it again 00118 */ 00119 if (gpOriginalRGBs != NULL) { 00120 RIPMSG0(RIP_ERROR, "SetSysColorsTemp: temp colors already set"); 00121 return NULL; 00122 } 00123 00124 /* 00125 * If we are here then we must be setting the new temp colors 00126 * 00127 * First save the old colors 00128 */ 00129 cbRGBSize = sizeof(COLORREF) * (UINT)cBrushes; 00130 00131 UserAssert(sizeof(COLORREF) == sizeof(int)); 00132 gpOriginalRGBs = UserLocalAlloc(HEAP_ZERO_MEMORY, cbRGBSize); 00133 00134 if (gpOriginalRGBs == NULL) { 00135 RIPMSG0(RIP_WARNING, "SetSysColorsTemp: unable to alloc temp colors buffer"); 00136 } 00137 00138 RtlCopyMemory(gpOriginalRGBs, gpsi->argbSystem, cbRGBSize); 00139 00140 /* 00141 * Now set the new colors. 00142 */ 00143 UserAssert( (sizeof(abElements)/sizeof(abElements[0])) >= cBrushes); 00144 00145 for (i = 0; i < cBrushes; i++) 00146 abElements[i] = i; 00147 00148 NtUserSetSysColors((UINT)cBrushes, abElements, lpRGBs, 0); 00149 00150 gcOriginalRGBs = (UINT)cBrushes; 00151 00152 return gpOriginalRGBs; 00153 }

LPWSTR TextAlloc LPCWSTR  lpszSrc  ) 
 

Definition at line 164 of file w32/ntuser/client/random.c.

References DWORD, NULL, and UserLocalAlloc.

Referenced by MDIClientWndProcWorker(), MessageBoxWorker(), and xxxSetFrameTitle().

00166 { 00167 LPWSTR pszT; 00168 DWORD cbString; 00169 00170 if (lpszSrc == NULL) 00171 return NULL; 00172 00173 cbString = (wcslen(lpszSrc) + 1) * sizeof(WCHAR); 00174 00175 if (pszT = (LPWSTR)UserLocalAlloc(HEAP_ZERO_MEMORY, cbString)) { 00176 00177 RtlCopyMemory(pszT, lpszSrc, cbString); 00178 } 00179 00180 return pszT; 00181 }


Variable Documentation

UINT gcOriginalRGBs = 0
 

Definition at line 61 of file w32/ntuser/client/random.c.

Referenced by SetSysColorsTemp().

HBRUSH ghbrBlack = NULL
 

Definition at line 24 of file w32/ntuser/client/random.c.

HBRUSH ghbrWhite = NULL
 

Definition at line 23 of file w32/ntuser/client/random.c.

LPCOLORREF gpOriginalRGBs = NULL
 

Definition at line 60 of file w32/ntuser/client/random.c.

Referenced by SetSysColorsTemp().


Generated on Sat May 15 19:45:26 2004 for test by doxygen 1.3.7