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

classc.c File Reference

#include "precomp.h"

Go to the source code of this file.

Defines

#define INDEX_OFFSET   GCLP_HICONSM

Functions

ULONG_PTR _GetClassData (PCLS pcls, PWND pwnd, int index, BOOL bAnsi)
ULONG_PTR _GetClassLongPtr (PWND pwnd, int index, BOOL bAnsi)
WORD GetClassWord (HWND hwnd, int index)

Variables

CONST BYTE afClassDWord []
CONST BYTE aiClassOffset []


Define Documentation

#define INDEX_OFFSET   GCLP_HICONSM
 

Definition at line 84 of file classc.c.

Referenced by _GetClassData(), and xxxSetClassData().


Function Documentation

ULONG_PTR _GetClassData PCLS  pcls,
PWND  pwnd,
int  index,
BOOL  bAnsi
 

Definition at line 100 of file classc.c.

References afClassDWord, aiClassOffset, BYTE, CPD_ANSI_TO_UNICODE, CPD_UNICODE_TO_ANSI, CPD_WNDTOCLS, CSF_ANSIPROC, tagCLS::CSF_flags, CSF_SERVERSIDEPROC, CSF_WOWCLASS, CSF_WOWEXTRA, DWORD, GetCPD(), INDEX_OFFSET, IS_PTR, tagCLS::lpszClientAnsiMenuName, tagCLS::lpszClientUnicodeMenuName, MapClientNeuterToClientPfn(), MapServerToClientPfn(), NtUserCallHwndParam(), PtoH, and PWCFromPCLS.

Referenced by _GetClassLongPtr(), GetClassWord(), and GetClassWOWWords().

00105 { 00106 KERNEL_ULONG_PTR dwData; 00107 DWORD dwCPDType = 0; 00108 00109 index -= INDEX_OFFSET; 00110 00111 if (index < 0) { 00112 RIPERR0(ERROR_INVALID_INDEX, RIP_VERBOSE, ""); 00113 return 0; 00114 } 00115 00116 UserAssert(index >= 0); 00117 UserAssert(index < sizeof(afClassDWord)); 00118 UserAssert(sizeof(afClassDWord) == sizeof(aiClassOffset)); 00119 if (afClassDWord[index] == sizeof(DWORD)) { 00120 dwData = *(DWORD *)(((BYTE *)pcls) + aiClassOffset[index]); 00121 } else if (afClassDWord[index] == sizeof(KERNEL_ULONG_PTR)) { 00122 dwData = *(KERNEL_ULONG_PTR *)(((BYTE *)pcls) + aiClassOffset[index]); 00123 } else { 00124 dwData = (DWORD)*(WORD *)(((BYTE *)pcls) + aiClassOffset[index]); 00125 } 00126 00127 index += INDEX_OFFSET; 00128 00129 /* 00130 * If we're returning an icon or cursor handle, do the reverse 00131 * mapping here. 00132 */ 00133 switch(index) { 00134 case GCLP_MENUNAME: 00135 if (IS_PTR(pcls->lpszMenuName)) { 00136 /* 00137 * The Menu Name is a real string: return the client-side address. 00138 * (If the class was registered by another app this returns an 00139 * address in that app's addr. space, but it's the best we can do) 00140 */ 00141 dwData = bAnsi ? 00142 (ULONG_PTR)pcls->lpszClientAnsiMenuName : 00143 (ULONG_PTR)pcls->lpszClientUnicodeMenuName; 00144 } 00145 break; 00146 00147 case GCLP_HICON: 00148 case GCLP_HCURSOR: 00149 case GCLP_HICONSM: 00150 /* 00151 * We have to go to the kernel to convert the pcursor to a handle because 00152 * cursors are allocated out of POOL, which is not accessable from the client. 00153 */ 00154 if (dwData) { 00155 dwData = NtUserCallHwndParam(PtoH(pwnd), index, SFI_GETCLASSICOCUR); 00156 } 00157 break; 00158 00159 case GCLP_WNDPROC: 00160 { 00161 00162 /* 00163 * Always return the client wndproc in case this is a server 00164 * window class. 00165 */ 00166 00167 if (pcls->CSF_flags & CSF_SERVERSIDEPROC) { 00168 dwData = MapServerToClientPfn(dwData, bAnsi); 00169 } else { 00170 KERNEL_ULONG_PTR dwT = dwData; 00171 00172 dwData = MapClientNeuterToClientPfn(pcls, dwT, bAnsi); 00173 00174 /* 00175 * If the client mapping didn't change the window proc then see if 00176 * we need a callproc handle. 00177 */ 00178 if (dwData == dwT) { 00179 /* 00180 * Need to return a CallProc handle if there is an Ansi/Unicode mismatch 00181 */ 00182 if (bAnsi != !!(pcls->CSF_flags & CSF_ANSIPROC)) { 00183 dwCPDType |= bAnsi ? CPD_ANSI_TO_UNICODE : CPD_UNICODE_TO_ANSI; 00184 } 00185 } 00186 } 00187 00188 if (dwCPDType) { 00189 ULONG_PTR dwCPD; 00190 00191 dwCPD = GetCPD(pwnd, dwCPDType | CPD_WNDTOCLS, KERNEL_ULONG_PTR_TO_ULONG_PTR(dwData)); 00192 00193 if (dwCPD) { 00194 dwData = dwCPD; 00195 } else { 00196 RIPMSG0(RIP_WARNING, "GetClassLong unable to alloc CPD returning handle\n"); 00197 } 00198 } 00199 } 00200 break; 00201 00202 case GCL_CBCLSEXTRA: 00203 if ((pcls->CSF_flags & CSF_WOWCLASS) && (pcls->CSF_flags & CSF_WOWEXTRA)) { 00204 /* 00205 * The 16-bit app changed its Extra bytes value. Return the changed 00206 * value. FritzS 00207 */ 00208 00209 return PWCFromPCLS(pcls)->iClsExtra; 00210 } 00211 else 00212 return pcls->cbclsExtra; 00213 00214 break; 00215 00216 /* 00217 * WOW uses a pointer straight into the class structure. 00218 */ 00219 case GCLP_WOWWORDS: 00220 if (pcls->CSF_flags & CSF_WOWCLASS) { 00221 return ((ULONG_PTR)PWCFromPCLS(pcls)); 00222 } else 00223 return 0; 00224 00225 case GCL_STYLE: 00226 dwData &= CS_VALID; 00227 break; 00228 } 00229 00230 return KERNEL_ULONG_PTR_TO_ULONG_PTR(dwData); 00231 }

ULONG_PTR _GetClassLongPtr PWND  pwnd,
int  index,
BOOL  bAnsi
 

Definition at line 246 of file classc.c.

References _GetClassData(), BYTE, and REBASEALWAYS.

00250 { 00251 PCLS pcls = REBASEALWAYS(pwnd, pcls); 00252 00253 if (index < 0) { 00254 return _GetClassData(pcls, pwnd, index, bAnsi); 00255 } else { 00256 if (index + (int)sizeof(ULONG_PTR) > pcls->cbclsExtra) { 00257 RIPERR0(ERROR_INVALID_INDEX, RIP_VERBOSE, ""); 00258 return 0; 00259 } else { 00260 ULONG_PTR UNALIGNED *pudw; 00261 pudw = (ULONG_PTR UNALIGNED *)((BYTE *)(pcls + 1) + index); 00262 return *pudw; 00263 } 00264 } 00265 }

WORD GetClassWord HWND  hwnd,
int  index
 

Definition at line 305 of file classc.c.

References _GetClassData(), BYTE, FALSE, NULL, REBASEALWAYS, and ValidateHwnd.

00308 { 00309 PWND pwnd; 00310 PCLS pclsClient; 00311 00312 pwnd = ValidateHwnd(hwnd); 00313 00314 if (pwnd == NULL) 00315 return 0; 00316 00317 pclsClient = (PCLS)REBASEALWAYS(pwnd, pcls); 00318 00319 if (index == GCW_ATOM) { 00320 return (WORD)_GetClassData(pclsClient, pwnd, index, FALSE); 00321 } else { 00322 if ((index < 0) || (index + (int)sizeof(WORD) > pclsClient->cbclsExtra)) { 00323 RIPERR0(ERROR_INVALID_INDEX, RIP_VERBOSE, ""); 00324 return 0; 00325 } else { 00326 WORD UNALIGNED *puw; 00327 puw = (WORD UNALIGNED *)((BYTE *)(pclsClient + 1) + index); 00328 return *puw; 00329 } 00330 } 00331 }


Variable Documentation

CONST BYTE afClassDWord[]
 

Initial value:

{ FIELD_SIZE(CLS, spicnSm), 0, FIELD_SIZE(CLS, atomClassName), 0, 0, 0, 0, 0, FIELD_SIZE(CLS, style), 0, FIELD_SIZE(CLS, lpfnWndProc), 0, 0, 0, FIELD_SIZE(CLS, cbclsExtra), 0, FIELD_SIZE(CLS, cbwndExtra), 0, FIELD_SIZE(CLS, hModule), 0, FIELD_SIZE(CLS, spicn), 0, FIELD_SIZE(CLS, spcur), 0, FIELD_SIZE(CLS, hbrBackground), 0, FIELD_SIZE(CLS, lpszMenuName) }

Definition at line 21 of file classc.c.

Referenced by _GetClassData(), and xxxSetClassData().

CONST BYTE aiClassOffset[]
 

Initial value:

{ FIELD_OFFSET(CLS, spicnSm), 0, FIELD_OFFSET(CLS, atomClassName), 0, 0, 0, 0, 0, FIELD_OFFSET(CLS, style), 0, FIELD_OFFSET(CLS, lpfnWndProc), 0, 0, 0, FIELD_OFFSET(CLS, cbclsExtra), 0, FIELD_OFFSET(CLS, cbwndExtra), 0, FIELD_OFFSET(CLS, hModule), 0, FIELD_OFFSET(CLS, spicn), 0, FIELD_OFFSET(CLS, spcur), 0, FIELD_OFFSET(CLS, hbrBackground), 0, FIELD_OFFSET(CLS, lpszMenuName) }

Definition at line 51 of file classc.c.

Referenced by _GetClassData(), and xxxSetClassData().


Generated on Sat May 15 19:43:04 2004 for test by doxygen 1.3.7