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

ntcftxt.h

Go to the documentation of this file.
00001 /***************************** Module Header ******************************\ 00002 * Module Name: ntcftxt.h 00003 * 00004 * Copyright (c) 1985 - 1999, Microsoft Corporation 00005 * 00006 * Kernel call forward stubs with text arguments 00007 * 00008 * Each function will be created with two flavors Ansi and Unicode 00009 * 00010 * 06-Jan-1992 IanJa Moved from cf.h 00011 * 18-Mar-1995 JimA Ported from cftxt.h 00012 \**************************************************************************/ 00013 00014 #ifdef UNICODE 00015 #define IS_ANSI FALSE 00016 #ifndef _UNICODE 00017 #define _UNICODE 00018 #endif 00019 #else 00020 #define IS_ANSI TRUE 00021 #undef _UNICODE 00022 #endif 00023 #include <tchar.h> 00024 #include "ntsend.h" 00025 00026 HWND TEXT_FN(InternalFindWindowEx)( 00027 HWND hwndParent, 00028 HWND hwndChild, 00029 LPCTSTR pClassName, 00030 LPCTSTR pWindowName, 00031 DWORD dwFlag) 00032 { 00033 IN_STRING strClass; 00034 IN_STRING strWindow; 00035 00036 /* 00037 * Make sure cleanup will work successfully 00038 */ 00039 strClass.fAllocated = FALSE; 00040 strWindow.fAllocated = FALSE; 00041 00042 BEGINCALL() 00043 00044 FIRSTCOPYLPTSTRIDOPT(&strClass, pClassName); 00045 COPYLPTSTROPT(&strWindow, pWindowName); 00046 00047 retval = (ULONG_PTR)NtUserFindWindowEx( 00048 hwndParent, 00049 hwndChild, 00050 strClass.pstr, 00051 strWindow.pstr, 00052 dwFlag); 00053 00054 ERRORTRAP(0); 00055 CLEANUPLPTSTR(strClass); 00056 CLEANUPLPTSTR(strWindow); 00057 ENDCALL(HWND); 00058 00059 } 00060 00061 HWND FindWindowEx( 00062 HWND hwndParent, 00063 HWND hwndChild, 00064 LPCTSTR pClassName, 00065 LPCTSTR pWindowName) 00066 { 00067 return TEXT_FN(InternalFindWindowEx)(hwndParent, hwndChild, pClassName, pWindowName, FW_BOTH); 00068 } 00069 00070 HWND FindWindow( 00071 LPCTSTR pClassName, 00072 LPCTSTR pWindowName) 00073 { 00074 return TEXT_FN(InternalFindWindowEx)(NULL, NULL, pClassName, pWindowName, FW_BOTH); 00075 } 00076 00077 extern WNDPROC mpPfnAddress[]; 00078 00079 BOOL GetClassInfo( 00080 HINSTANCE hmod OPTIONAL, 00081 LPCTSTR pszClassName, 00082 LPWNDCLASS pwc) 00083 { 00084 IN_STRING strClassName; 00085 LPWSTR pszMenuName; 00086 WNDCLASSEXW WndClass; 00087 00088 /* 00089 * Make sure cleanup will work successfully 00090 */ 00091 strClassName.fAllocated = FALSE; 00092 00093 BEGINCALL() 00094 00095 FIRSTCOPYLPTSTRID(&strClassName, pszClassName); 00096 00097 retval = (DWORD)NtUserGetClassInfo( 00098 hmod, 00099 strClassName.pstr, 00100 &WndClass, 00101 &pszMenuName, 00102 IS_ANSI); 00103 00104 if (retval) { 00105 00106 /* 00107 * Move the info from the WNDCLASSEX to the WNDCLASS structure 00108 * On 64-bit plaforms we'll have 32 bits of padding between style and 00109 * lpfnWndProc in WNDCLASS, so start the copy from the first 64-bit 00110 * aligned field and hand copy the rest. 00111 */ 00112 RtlCopyMemory(&(pwc->lpfnWndProc), &(WndClass.lpfnWndProc), sizeof(WNDCLASS) - FIELD_OFFSET(WNDCLASS, lpfnWndProc)); 00113 pwc->style = WndClass.style; 00114 00115 /* 00116 * Update these pointers so they point to something real. 00117 * pszMenuName is actually just the pointer the app originally 00118 * passed to us. 00119 */ 00120 pwc->lpszMenuName = (LPTSTR)pszMenuName; 00121 pwc->lpszClassName = pszClassName; 00122 } 00123 00124 ERRORTRAP(0); 00125 CLEANUPLPTSTR(strClassName); 00126 ENDCALL(BOOL); 00127 } 00128 00129 BOOL GetClassInfoEx( 00130 HINSTANCE hmod OPTIONAL, 00131 LPCTSTR pszClassName, 00132 LPWNDCLASSEX pwc) 00133 { 00134 IN_STRING strClassName; 00135 LPWSTR pszMenuName; 00136 00137 /* 00138 * Make sure cleanup will work successfully 00139 */ 00140 strClassName.fAllocated = FALSE; 00141 00142 BEGINCALL() 00143 00144 FIRSTCOPYLPTSTRID(&strClassName, pszClassName); 00145 00146 retval = (DWORD)NtUserGetClassInfo( 00147 hmod, 00148 strClassName.pstr, 00149 (LPWNDCLASSEXW)pwc, 00150 &pszMenuName, 00151 IS_ANSI); 00152 00153 if (retval) { 00154 00155 /* 00156 * Update these pointers so they point to something real. 00157 * pszMenuName is actually just the pointer the app originally 00158 * passed to us. 00159 */ 00160 pwc->lpszMenuName = (LPTSTR)pszMenuName; 00161 pwc->lpszClassName = pszClassName; 00162 } 00163 00164 ERRORTRAP(0); 00165 CLEANUPLPTSTR(strClassName); 00166 ENDCALL(BOOL); 00167 } 00168 00169 int GetClipboardFormatName( 00170 UINT wFormat, 00171 LPTSTR pFormatName, 00172 int chMaxCount) 00173 { 00174 LPWSTR lpszReserve; 00175 00176 BEGINCALL() 00177 00178 #ifdef UNICODE 00179 lpszReserve = pFormatName; 00180 #else 00181 lpszReserve = LocalAlloc(LMEM_FIXED, chMaxCount * sizeof(WCHAR)); 00182 if (!lpszReserve) { 00183 return 0; 00184 } 00185 #endif 00186 00187 retval = (DWORD)NtUserGetClipboardFormatName( 00188 wFormat, 00189 lpszReserve, 00190 chMaxCount); 00191 00192 #ifndef UNICODE 00193 if (retval) { 00194 /* 00195 * Do not copy out more than the requested byte count 'chMaxCount'. 00196 * Set retval to reflect the number of ANSI bytes. 00197 */ 00198 retval = WCSToMB(lpszReserve, (UINT)retval, 00199 &pFormatName, chMaxCount-1, FALSE); 00200 pFormatName[retval] = '\0'; 00201 } 00202 LocalFree(lpszReserve); 00203 #endif 00204 00205 ERRORTRAP(0); 00206 ENDCALL(int); 00207 } 00208 00209 int GetKeyNameText( 00210 LONG lParam, 00211 LPTSTR pString, 00212 int cchSize) 00213 { 00214 LPWSTR lpszReserve; 00215 00216 BEGINCALL() 00217 00218 #ifdef UNICODE 00219 lpszReserve = pString; 00220 #else 00221 lpszReserve = LocalAlloc(LMEM_FIXED, cchSize * sizeof(WCHAR)); 00222 if (!lpszReserve) { 00223 return 0; 00224 } 00225 #endif 00226 00227 retval = (DWORD)NtUserGetKeyNameText( 00228 lParam, 00229 lpszReserve, 00230 cchSize); 00231 00232 #ifndef UNICODE 00233 if (retval) { 00234 /* 00235 * Do not copy out more than the requested byte count 'nSize'. 00236 * Set retval to reflect the number of ANSI bytes. 00237 */ 00238 retval = WCSToMB(lpszReserve, (UINT)retval, 00239 &pString, cchSize-1, FALSE); 00240 } 00241 LocalFree(lpszReserve); 00242 ((LPSTR)pString)[retval] = '\0'; 00243 #endif 00244 00245 ERRORTRAP(0); 00246 ENDCALL(int); 00247 } 00248 00249 BOOL APIENTRY GetMessage( 00250 LPMSG pmsg, 00251 HWND hwnd, 00252 UINT wMsgFilterMin, 00253 UINT wMsgFilterMax) 00254 { 00255 BEGINCALL() 00256 00257 /* 00258 * Prevent apps from setting hi 16 bits so we can use them internally. 00259 */ 00260 if ((wMsgFilterMin | wMsgFilterMax) & RESERVED_MSG_BITS) { 00261 MSGERRORCODE(ERROR_INVALID_PARAMETER); 00262 } 00263 00264 #ifndef UNICODE 00265 /* 00266 * If we have pushed message for DBCS messaging, we should pass this one 00267 * to Apps at first... 00268 */ 00269 GET_DBCS_MESSAGE_IF_EXIST(GetMessage, pmsg, wMsgFilterMin, wMsgFilterMax, TRUE); 00270 #endif 00271 00272 retval = (DWORD)NtUserGetMessage( 00273 pmsg, 00274 hwnd, 00275 wMsgFilterMin, 00276 wMsgFilterMax); 00277 00278 #ifndef UNICODE 00279 // May have a bit more work to do if this MSG is for an ANSI app 00280 00281 // !!! LATER if the unichar translates into multiple ANSI chars 00282 // !!! then what??? Divide into two messages?? WM_SYSDEADCHAR?? 00283 00284 if (RtlWCSMessageWParamCharToMB(pmsg->message, &(pmsg->wParam))) { 00285 WPARAM dwAnsi = pmsg->wParam; 00286 /* 00287 * Build DBCS-ware wParam. (for EM_SETPASSWORDCHAR...) 00288 */ 00289 BUILD_DBCS_MESSAGE_TO_CLIENTA_FROM_SERVER(pmsg, dwAnsi, TRUE, TRUE); 00290 } else { 00291 retval = 0; 00292 } 00293 ExitGetMessage: 00294 #else 00295 /* 00296 * Only LOWORD of WPARAM is valid for WM_CHAR (Unicode).... 00297 * (Mask off DBCS messaging information.) 00298 */ 00299 BUILD_DBCS_MESSAGE_TO_CLIENTW_FROM_SERVER(pmsg->message,pmsg->wParam); 00300 #endif // UNICODE 00301 00302 ERRORTRAP(0); 00303 ENDCALL(BOOL); 00304 } 00305 00306 BOOL GetKeyboardLayoutName( 00307 LPTSTR pwszKL) 00308 { 00309 #ifdef UNICODE 00310 UNICODE_STRING str; 00311 PUNICODE_STRING pstr = &str; 00312 #else 00313 PUNICODE_STRING pstr = &NtCurrentTeb()->StaticUnicodeString; 00314 #endif 00315 00316 BEGINCALL() 00317 00318 #ifdef UNICODE 00319 str.MaximumLength = KL_NAMELENGTH * sizeof(WCHAR); 00320 str.Buffer = pwszKL; 00321 #endif 00322 00323 retval = (DWORD)NtUserGetKeyboardLayoutName(pstr); 00324 00325 #ifndef UNICODE 00326 if (retval) { 00327 /* 00328 * Non-zero retval means some text to copy out. Do not copy out 00329 * more than the requested byte count 'chMaxCount'. 00330 */ 00331 WCSToMB(pstr->Buffer, -1, &pwszKL, KL_NAMELENGTH, FALSE); 00332 } 00333 #endif 00334 00335 ERRORTRAP(0); 00336 ENDCALL(BOOL); 00337 } 00338 00339 UINT MapVirtualKey( 00340 UINT wCode, 00341 UINT wMapType) 00342 { 00343 BEGINCALL() 00344 00345 retval = (DWORD)NtUserMapVirtualKeyEx( 00346 wCode, 00347 wMapType, 00348 0, 00349 FALSE); 00350 00351 #ifndef UNICODE 00352 if ((wMapType == 2) && (retval != 0)) { 00353 WCHAR wch = LOWORD(retval); 00354 retval &= ~0xFFFF; 00355 RtlUnicodeToMultiByteN((LPSTR)&(retval), sizeof(CHAR), 00356 NULL, &wch, sizeof(WCHAR)); 00357 } 00358 #endif 00359 00360 ERRORTRAP(0); 00361 ENDCALL(UINT); 00362 } 00363 00364 /**************************************************************************\ 00365 * MapVirtualKeyEx 00366 * 00367 * 21-Feb-1995 GregoryW Created 00368 \**************************************************************************/ 00369 00370 #ifndef UNICODE 00371 static HKL hMVKCachedHKL = 0; 00372 static UINT uMVKCachedCP = 0; 00373 #endif 00374 UINT MapVirtualKeyEx( 00375 UINT wCode, 00376 UINT wMapType, 00377 HKL hkl) 00378 { 00379 BEGINCALL() 00380 00381 retval = (DWORD)NtUserMapVirtualKeyEx( 00382 wCode, 00383 wMapType, 00384 (ULONG_PTR)hkl, 00385 TRUE); 00386 00387 #ifndef UNICODE 00388 if ((wMapType == 2) && (retval != 0)) { 00389 WCHAR wch = LOWORD(retval); 00390 00391 if (hkl != hMVKCachedHKL) { 00392 DWORD dwCodePage; 00393 if (!GetLocaleInfoW( 00394 HandleToUlong(hkl) & 0xffff, 00395 LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, 00396 (LPWSTR)&dwCodePage, 00397 sizeof(dwCodePage) / sizeof(WCHAR) 00398 )) { 00399 MSGERROR(); 00400 } 00401 uMVKCachedCP = dwCodePage; 00402 hMVKCachedHKL = hkl; 00403 } 00404 /* 00405 * Clear low word which contains Unicode character returned from server. 00406 * This preserves the high word which is used to indicate dead key status. 00407 */ 00408 retval = retval & 0xffff0000; 00409 if (!WideCharToMultiByte( 00410 uMVKCachedCP, 00411 0, 00412 &wch, 00413 1, 00414 (LPSTR)&(retval), 00415 1, 00416 NULL, 00417 NULL)) { 00418 MSGERROR(); 00419 } 00420 } 00421 #endif 00422 00423 ERRORTRAP(0); 00424 ENDCALL(UINT); 00425 } 00426 00427 BOOL APIENTRY PostMessage( 00428 HWND hwnd, 00429 UINT wMsg, 00430 WPARAM wParam, 00431 LPARAM lParam) 00432 { 00433 BEGINCALL() 00434 00435 switch (wMsg) { 00436 case WM_DROPFILES: 00437 if (GetWindowProcess(hwnd) != GETPROCESSID()) { 00438 /* 00439 * We first send a WM_COPYGLOBALDATA message to get the data into the proper 00440 * context. 00441 */ 00442 HGLOBAL hg; 00443 00444 hg = (HGLOBAL)SendMessage(hwnd, WM_COPYGLOBALDATA, 00445 GlobalSize((HGLOBAL)wParam), wParam); 00446 if (!hg) { 00447 MSGERROR(); 00448 } 00449 wParam = (WPARAM)hg; 00450 } 00451 break; 00452 00453 case LB_DIR: 00454 case CB_DIR: 00455 /* 00456 * Make sure this bit is set so the client side string gets 00457 * successfully copied over. 00458 */ 00459 wParam |= DDL_POSTMSGS; 00460 break; 00461 } 00462 00463 #ifndef UNICODE 00464 /* 00465 * Setup DBCS Messaging for WM_CHAR... 00466 */ 00467 BUILD_DBCS_MESSAGE_TO_SERVER_FROM_CLIENTA(wMsg,wParam,TRUE); 00468 00469 RtlMBMessageWParamCharToWCS(wMsg, &wParam); 00470 #endif 00471 retval = (DWORD)NtUserPostMessage( 00472 hwnd, 00473 wMsg, 00474 wParam, 00475 lParam); 00476 00477 ERRORTRAP(0); 00478 ENDCALL(BOOL); 00479 } 00480 00481 BOOL APIENTRY PostThreadMessage( 00482 DWORD idThread, 00483 UINT msg, 00484 WPARAM wParam, 00485 LPARAM lParam) 00486 { 00487 BEGINCALL() 00488 00489 #ifndef UNICODE 00490 #ifdef FE_SB // PostThreadMessage() 00491 /* 00492 * The server always expects the characters to be unicode so 00493 * if this was generated from an ANSI routine convert it to Unicode 00494 */ 00495 BUILD_DBCS_MESSAGE_TO_SERVER_FROM_CLIENTA(msg,wParam,TRUE); 00496 #endif // FE_SB 00497 00498 RtlMBMessageWParamCharToWCS(msg, &wParam); 00499 #endif 00500 00501 retval = (DWORD)NtUserPostThreadMessage( 00502 idThread, 00503 msg, 00504 wParam, 00505 lParam); 00506 00507 ERRORTRAP(0); 00508 ENDCALL(BOOL); 00509 } 00510 00511 00512 /**************************************************************************\ 00513 * StringDuplicate 00514 * 00515 * 03-25-96 GerardoB Added Header. 00516 \**************************************************************************/ 00517 #define StringDuplicate TEXT_FN(StringDuplicate) 00518 LPTSTR StringDuplicate(LPCTSTR ptszDup) { 00519 LPTSTR ptsz; 00520 ULONG cb; 00521 00522 cb = (_tcslen(ptszDup) + 1) * sizeof(TCHAR); 00523 ptsz = (LPTSTR)LocalAlloc(NONZEROLPTR, cb); 00524 if (ptsz != NULL) { 00525 RtlCopyMemory(ptsz, ptszDup, cb); 00526 } 00527 return ptsz; 00528 } 00529 /**************************************************************************\ 00530 * InitClsMenuName 00531 * 00532 * 03-22-96 GerardoB Created. 00533 \**************************************************************************/ 00534 #define InitClsMenuName TEXT_FN(InitClsMenuName) 00535 BOOL InitClsMenuName (PCLSMENUNAME pcmn, LPCTSTR lpszMenuName, PIN_STRING pstrMenuName) 00536 { 00537 /* 00538 * We check the high-word because this may be a resource-ID. 00539 */ 00540 if (IS_PTR(lpszMenuName)) { 00541 #ifdef UNICODE 00542 if ((pcmn->pwszClientUnicodeMenuName = StringDuplicate(lpszMenuName)) == NULL) { 00543 return FALSE; 00544 } 00545 00546 if (!WCSToMB(lpszMenuName, -1, &(pcmn->pszClientAnsiMenuName), -1, TRUE)) { 00547 pcmn->pszClientAnsiMenuName = NULL; 00548 } 00549 #else 00550 if ((pcmn->pszClientAnsiMenuName = StringDuplicate(lpszMenuName)) == NULL) { 00551 return FALSE; 00552 } 00553 00554 if (!MBToWCS(lpszMenuName, -1, &(pcmn->pwszClientUnicodeMenuName), -1, TRUE)) { 00555 pcmn->pwszClientUnicodeMenuName = NULL; 00556 } 00557 #endif // UNICODE 00558 } else { 00559 /* Copy the ID */ 00560 pcmn->pszClientAnsiMenuName = (LPSTR)lpszMenuName; 00561 pcmn->pwszClientUnicodeMenuName = (LPWSTR)lpszMenuName; 00562 } 00563 00564 COPYLPTSTRID(pstrMenuName, lpszMenuName); 00565 pcmn->pusMenuName = pstrMenuName->pstr; 00566 00567 return TRUE; 00568 00569 goto errorexit; /* Keep the compiler happy */ 00570 errorexit: /* Used by COPYLPTSTRID */ 00571 return FALSE; 00572 } 00573 00574 /**************************************************************************\ 00575 * SetClassLong 00576 * 00577 * 03-22-96 GerardoB Moved from client\cltxt.h & client\ntstubs.c 00578 \**************************************************************************/ 00579 ULONG_PTR APIENTRY SetClassLongPtr(HWND hwnd, int nIndex, LONG_PTR dwNewLong) 00580 { 00581 CLSMENUNAME cmn; 00582 IN_STRING strMenuName; 00583 00584 switch (nIndex) { 00585 case GCLP_MENUNAME: 00586 if (!InitClsMenuName(&cmn, (LPCTSTR) dwNewLong, &strMenuName)) { 00587 RIPERR0(ERROR_INVALID_HANDLE, RIP_WARNING, "SetClassLong: InitClsMenuName failed"); 00588 return 0; 00589 } 00590 dwNewLong = (ULONG_PTR) &cmn; 00591 break; 00592 00593 case GCLP_HBRBACKGROUND: 00594 if ((DWORD)dwNewLong > COLOR_ENDCOLORS) { 00595 /* 00596 * Let gdi validate the brush. If it's invalid, then 00597 * gdi will log a warning. No need to rip twice so we'll 00598 * just set the last-error. 00599 */ 00600 if (GdiValidateHandle((HBRUSH)dwNewLong) == FALSE) { 00601 RIPERR0(ERROR_INVALID_HANDLE, RIP_VERBOSE, ""); 00602 return 0; 00603 } 00604 } 00605 break; 00606 } 00607 00608 BEGINCALL() 00609 00610 retval = (ULONG_PTR)NtUserSetClassLongPtr(hwnd, nIndex, dwNewLong, IS_ANSI); 00611 00612 ERRORTRAP(0); 00613 00614 /* Clean up */ 00615 switch (nIndex) { 00616 case GCLP_MENUNAME: 00617 CLEANUPLPTSTR(strMenuName); /* Initialized by InitClsMenuName */ 00618 /* 00619 * We free either the old strings (returned by the kernel), 00620 * or the new ones if the kernel call failed 00621 */ 00622 if (IS_PTR(cmn.pszClientAnsiMenuName)) { 00623 LocalFree(cmn.pszClientAnsiMenuName); 00624 } 00625 if (IS_PTR(cmn.pwszClientUnicodeMenuName)) { 00626 LocalFree(cmn.pwszClientUnicodeMenuName); 00627 } 00628 00629 break; 00630 } 00631 00632 ENDCALL(ULONG_PTR); 00633 00634 } 00635 00636 #ifdef _WIN64 00637 DWORD APIENTRY SetClassLong(HWND hwnd, int nIndex, LONG dwNewLong) 00638 { 00639 BEGINCALL() 00640 00641 retval = (DWORD)NtUserSetClassLong(hwnd, nIndex, dwNewLong, IS_ANSI); 00642 00643 ERRORTRAP(0); 00644 ENDCALL(DWORD); 00645 } 00646 #endif 00647 /**************************************************************************\ 00648 * RegisterClassExWOW 00649 * 00650 * 03-22-96 GerardoB Added Header 00651 \**************************************************************************/ 00652 ATOM TEXT_FN(RegisterClassExWOW)( 00653 WNDCLASSEX *lpWndClass, 00654 LPDWORD pdwWOWstuff, 00655 WORD fnid) 00656 { 00657 WNDCLASSEX WndClass; 00658 IN_STRING strClassName; 00659 IN_STRING strMenuName; 00660 DWORD dwFlags, dwExpWinVer; 00661 CLSMENUNAME cmn; 00662 00663 strClassName.fAllocated = 0; 00664 strMenuName.fAllocated = 0; 00665 00666 /* 00667 * Skip validation for our classes 00668 */ 00669 if (fnid !=0) { 00670 /* 00671 * This is a hack to bypass validation for DDE classes 00672 * specifically, allow them to use hmodUser. 00673 */ 00674 if (fnid == FNID_DDE_BIT) { 00675 fnid = 0; 00676 } 00677 dwExpWinVer = VER40; 00678 } else { 00679 if (lpWndClass->cbSize != sizeof(WNDCLASSEX)) { 00680 RIPMSG0(RIP_WARNING, "RegisterClass: Invalid cbSize"); 00681 } 00682 00683 if (lpWndClass->cbClsExtra < 0 || 00684 lpWndClass->cbWndExtra < 0) { 00685 RIPMSG0(RIP_WARNING, "RegisterClass: invalid cb*Extra"); 00686 goto BadParameter; 00687 } 00688 00689 /* 00690 * Validate hInstance 00691 * Don't allow 4.0 apps to use hmodUser 00692 */ 00693 if ((lpWndClass->hInstance == hmodUser) 00694 && (GetClientInfo()->dwExpWinVer >= VER40)) { 00695 RIPMSG0(RIP_WARNING, "RegisterClass: Cannot use USER's hInstance"); 00696 goto BadParameter; 00697 } else if (lpWndClass->hInstance == NULL) { 00698 /* 00699 * For 32 bit apps we need to fix up the hInstance because Win 95 does 00700 * this in their thunk MapHInstLS 00701 */ 00702 00703 lpWndClass->hInstance = GetModuleHandle(NULL); 00704 RIPMSG1(RIP_VERBOSE, "RegisterClass: fixing up NULL hmodule to %#p", 00705 lpWndClass->hInstance); 00706 } 00707 00708 dwExpWinVer = GETEXPWINVER(lpWndClass->hInstance); 00709 00710 00711 /* 00712 * Check for valid style bits and strip if appropriate 00713 */ 00714 if (lpWndClass->style & ~CS_VALID40) { 00715 00716 if (dwExpWinVer > VER31) { 00717 RIPMSG0(RIP_WARNING, "RegisterClass: Invalid class style"); 00718 goto BadParameter; 00719 } 00720 00721 /* 00722 * Old application - strip bogus bits and pass through 00723 */ 00724 RIPMSG0(RIP_WARNING, "RegisterClass: Invalid class style, stripping bad styles"); 00725 lpWndClass->style &= CS_VALID40; 00726 } 00727 00728 /* 00729 * Validate hbrBackground 00730 */ 00731 if (lpWndClass->hbrBackground > (HBRUSH)COLOR_MAX 00732 && !GdiValidateHandle(lpWndClass->hbrBackground)) { 00733 00734 RIPMSG1(RIP_WARNING, "RegisterClass: Invalid class brush:%#p", lpWndClass->hbrBackground); 00735 if (dwExpWinVer > VER30) { 00736 goto BadParameter; 00737 } 00738 00739 lpWndClass->hbrBackground = NULL; 00740 } 00741 00742 } /* if (fnid !=0) */ 00743 00744 00745 if (!InitClsMenuName(&cmn, lpWndClass->lpszMenuName, &strMenuName)) { 00746 return FALSE; 00747 } 00748 00749 BEGINCALL() 00750 00751 WndClass = *lpWndClass; 00752 00753 #ifdef UNICODE 00754 dwFlags = 0; 00755 #else 00756 dwFlags = CSF_ANSIPROC; 00757 #endif // UNICODE 00758 00759 if (dwExpWinVer > VER31) { 00760 dwFlags |= CSF_WIN40COMPAT; 00761 } 00762 00763 COPYLPTSTRID(&strClassName, (LPTSTR)lpWndClass->lpszClassName); 00764 00765 retval = NtUserRegisterClassExWOW( 00766 &WndClass, 00767 strClassName.pstr, 00768 &cmn, 00769 fnid, 00770 dwFlags, 00771 pdwWOWstuff); 00772 00773 /* 00774 * Return the atom associated with this class or if earlier 00775 * than Win 3.1 convert it to a strict BOOL (some apps check) 00776 */ 00777 if (GETEXPWINVER(lpWndClass->hInstance) < VER31) 00778 retval = !!retval; 00779 00780 ERRORTRAP(0); 00781 CLEANUPLPTSTR(strMenuName); /* Initialized by InitClsMenuName */ 00782 CLEANUPLPTSTR(strClassName); 00783 00784 if (!retval) { 00785 if (IS_PTR(cmn.pszClientAnsiMenuName)) { 00786 LocalFree(cmn.pszClientAnsiMenuName); 00787 } 00788 if (IS_PTR(cmn.pwszClientUnicodeMenuName)) { 00789 LocalFree(cmn.pwszClientUnicodeMenuName); 00790 } 00791 } 00792 ENDCALL(BOOL); 00793 00794 BadParameter: 00795 RIPERR0(ERROR_INVALID_PARAMETER, RIP_VERBOSE, "RegisterClass: Invalid Parameter"); 00796 return FALSE; 00797 00798 } 00799 00800 UINT RegisterWindowMessage( 00801 LPCTSTR pString) 00802 { 00803 IN_STRING str; 00804 00805 /* 00806 * Make sure cleanup will work successfully 00807 */ 00808 str.fAllocated = FALSE; 00809 00810 BEGINCALL() 00811 00812 FIRSTCOPYLPTSTR(&str, (LPTSTR)pString); 00813 00814 retval = (DWORD)NtUserRegisterWindowMessage( 00815 str.pstr); 00816 00817 ERRORTRAP(0); 00818 CLEANUPLPTSTR(str); 00819 ENDCALL(UINT); 00820 } 00821 00822 HANDLE RemoveProp( 00823 HWND hwnd, 00824 LPCTSTR pString) 00825 { 00826 ATOM atomProp; 00827 DWORD dwProp; 00828 00829 BEGINCALL() 00830 00831 if (IS_PTR(pString)) { 00832 atomProp = GlobalFindAtom(pString); 00833 if (atomProp == 0) 00834 MSGERROR(); 00835 dwProp = MAKELONG(atomProp, TRUE); 00836 } else 00837 dwProp = MAKELONG(PTR_TO_ID(pString), FALSE); 00838 00839 retval = (ULONG_PTR)NtUserRemoveProp( 00840 hwnd, 00841 dwProp); 00842 00843 if (retval != 0 && IS_PTR(pString)) 00844 GlobalDeleteAtom(atomProp); 00845 00846 ERRORTRAP(0); 00847 ENDCALL(HANDLE); 00848 } 00849 00850 BOOL APIENTRY SendMessageCallback( 00851 HWND hwnd, 00852 UINT wMsg, 00853 WPARAM wParam, 00854 LPARAM lParam, 00855 SENDASYNCPROC lpResultCallBack, 00856 ULONG_PTR dwData) 00857 { 00858 BEGINCALL() 00859 00860 #ifndef UNICODE 00861 #ifdef FE_SB // SendMessageCallBack() 00862 /* 00863 * Setup DBCS Messaging for WM_CHAR... 00864 */ 00865 BUILD_DBCS_MESSAGE_TO_SERVER_FROM_CLIENTA(wMsg,wParam,TRUE); 00866 #endif // FE_SB 00867 00868 RtlMBMessageWParamCharToWCS(wMsg, &wParam); 00869 #endif 00870 00871 retval = (DWORD)NtUserSendMessageCallback( 00872 hwnd, 00873 wMsg, 00874 wParam, 00875 lParam, 00876 lpResultCallBack, 00877 dwData); 00878 00879 ERRORTRAP(0); 00880 ENDCALL(BOOL); 00881 } 00882 00883 BOOL APIENTRY SendNotifyMessage( 00884 HWND hwnd, 00885 UINT wMsg, 00886 WPARAM wParam, 00887 LPARAM lParam) 00888 { 00889 LARGE_STRING str; 00890 LPWSTR lpUniName = NULL; 00891 00892 00893 BEGINCALL() 00894 00895 #ifndef UNICODE 00896 #ifdef FE_SB // SendNotifyMessage() 00897 /* 00898 * Setup DBCS Messaging for WM_CHAR... 00899 */ 00900 BUILD_DBCS_MESSAGE_TO_SERVER_FROM_CLIENTA(wMsg,wParam,TRUE); 00901 #endif // FE_SB 00902 00903 RtlMBMessageWParamCharToWCS(wMsg, &wParam); 00904 #endif 00905 00906 /* 00907 * Allow system notification messages containing 00908 * strings to go through. 00909 */ 00910 if ((wMsg == WM_WININICHANGE || wMsg == WM_DEVMODECHANGE) && lParam) { 00911 #ifdef UNICODE 00912 RtlInitLargeUnicodeString((PLARGE_UNICODE_STRING)&str, 00913 (LPWSTR)lParam, (UINT)-1); 00914 #else 00915 if (!MBToWCS((LPSTR)lParam, -1, &lpUniName, -1, TRUE)) 00916 return FALSE; 00917 00918 RtlInitLargeUnicodeString((PLARGE_UNICODE_STRING)&str, 00919 lpUniName, (UINT)-1); 00920 #endif 00921 lParam = (LPARAM)(&str); 00922 } 00923 00924 retval = (DWORD)NtUserSendNotifyMessage( 00925 hwnd, 00926 wMsg, 00927 wParam, 00928 lParam); 00929 00930 if (lpUniName) 00931 UserLocalFree(lpUniName); 00932 00933 ERRORTRAP(0); 00934 ENDCALL(BOOL); 00935 } 00936 00937 BOOL SetProp( 00938 HWND hwnd, 00939 LPCTSTR pString, 00940 HANDLE hData) 00941 { 00942 ATOM atomProp; 00943 DWORD dwProp; 00944 00945 BEGINCALL() 00946 00947 if (IS_PTR(pString)) { 00948 atomProp = GlobalAddAtom(pString); 00949 if (atomProp == 0) 00950 MSGERROR(); 00951 dwProp = MAKELONG(atomProp, TRUE); 00952 } else 00953 dwProp = MAKELONG(PTR_TO_ID(pString), FALSE); 00954 00955 retval = (DWORD)NtUserSetProp( 00956 hwnd, 00957 dwProp, 00958 hData); 00959 00960 /* 00961 * If it failed, get rid of the atom 00962 */ 00963 if (retval == FALSE && IS_PTR(pString)) 00964 GlobalDeleteAtom(atomProp); 00965 00966 ERRORTRAP(0); 00967 ENDCALL(BOOL); 00968 } 00969 00970 BOOL UnregisterClass( 00971 LPCTSTR pszClassName, 00972 HINSTANCE hModule) 00973 { 00974 IN_STRING strClassName; 00975 CLSMENUNAME cmn; 00976 00977 /* 00978 * Make sure cleanup will work successfully 00979 */ 00980 strClassName.fAllocated = FALSE; 00981 00982 BEGINCALL() 00983 00984 FIRSTCOPYLPTSTRID(&strClassName, pszClassName); 00985 00986 retval = (DWORD)NtUserUnregisterClass( 00987 strClassName.pstr, 00988 hModule, 00989 &cmn); 00990 00991 00992 /* 00993 * Check explicity for TRUE so we don't get a !FALSE when 00994 * converttogui fails and the NtUser returns a status code intead of bool. 00995 */ 00996 if (retval == TRUE) { 00997 /* 00998 * Free the menu strings if they are not resource IDs 00999 */ 01000 if (IS_PTR(cmn.pszClientAnsiMenuName)) { 01001 LocalFree(cmn.pszClientAnsiMenuName); 01002 } 01003 if (IS_PTR(cmn.pwszClientUnicodeMenuName)) { 01004 LocalFree(cmn.pwszClientUnicodeMenuName); 01005 } 01006 } 01007 01008 ERRORTRAP(0); 01009 CLEANUPLPTSTR(strClassName); 01010 ENDCALL(BOOL); 01011 } 01012 01013 SHORT VkKeyScan( 01014 TCHAR cChar) 01015 { 01016 WCHAR wChar; 01017 01018 BEGINCALL() 01019 01020 #ifdef UNICODE 01021 wChar = cChar; 01022 #else 01023 #ifdef FE_SB // VkKeyScan() 01024 /* 01025 * Return 0xFFFFFFFF for DBCS LeadByte character. 01026 */ 01027 if (IsDBCSLeadByte(cChar)) { 01028 MSGERROR(); 01029 } 01030 #endif // FE_SB 01031 01032 RtlMultiByteToUnicodeN((LPWSTR)&(wChar), sizeof(WCHAR), NULL, &cChar, sizeof(CHAR)); 01033 #endif // UNICODE 01034 01035 retval = (DWORD)NtUserVkKeyScanEx( 01036 wChar, 01037 0, 01038 FALSE); 01039 01040 ERRORTRAP(-1); 01041 ENDCALL(SHORT); 01042 } 01043 01044 #ifndef UNICODE 01045 static HKL hVKSCachedHKL = 0; 01046 static UINT uVKSCachedCP = 0; 01047 #endif 01048 SHORT VkKeyScanEx( 01049 TCHAR cChar, 01050 HKL hkl) 01051 { 01052 WCHAR wChar; 01053 BEGINCALL() 01054 01055 #ifdef UNICODE 01056 wChar = cChar; 01057 #else 01058 if (hkl != hVKSCachedHKL) { 01059 DWORD dwCodePage; 01060 if (!GetLocaleInfoW( 01061 HandleToUlong(hkl) & 0xffff, 01062 LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, 01063 (LPWSTR)&dwCodePage, 01064 sizeof(dwCodePage) / sizeof(WCHAR) 01065 )) { 01066 MSGERROR(); 01067 } 01068 uVKSCachedCP = dwCodePage; 01069 hVKSCachedHKL = hkl; 01070 } 01071 01072 #ifdef FE_SB // VkKeyScanEx() 01073 /* 01074 * Return 0xFFFFFFFF for DBCS LeadByte character. 01075 */ 01076 if (IsDBCSLeadByteEx(uVKSCachedCP,cChar)) { 01077 MSGERROR(); 01078 } 01079 #endif // FE_SB 01080 01081 if (!MultiByteToWideChar( 01082 uVKSCachedCP, 01083 0, 01084 &cChar, 01085 sizeof(CHAR), 01086 &wChar, 01087 sizeof(WCHAR))) { 01088 MSGERROR(); 01089 } 01090 #endif // UNICODE 01091 01092 retval = (DWORD)NtUserVkKeyScanEx( 01093 wChar, 01094 (ULONG_PTR)hkl, 01095 TRUE); 01096 01097 ERRORTRAP(-1); 01098 ENDCALL(SHORT); 01099 } 01100 01101 BOOL 01102 EnumDisplayDevices( 01103 LPCTSTR lpszDevice, 01104 DWORD iDevNum, 01105 PDISPLAY_DEVICE lpDisplayDevice, 01106 DWORD dwFlags) 01107 { 01108 UNICODE_STRING UnicodeString; 01109 PUNICODE_STRING pUnicodeString = NULL; 01110 NTSTATUS Status; 01111 DISPLAY_DEVICEW tmpDisplayDevice; 01112 01113 // 01114 // Clear out things to make sure the caller passes in appropriate 01115 // parameters 01116 // 01117 01118 ZeroMemory(((PUCHAR)lpDisplayDevice) + sizeof(DWORD), 01119 lpDisplayDevice->cb - sizeof(DWORD)); 01120 01121 tmpDisplayDevice.cb = sizeof(DISPLAY_DEVICEW); 01122 01123 if (lpszDevice) { 01124 01125 #ifdef UNICODE 01126 01127 RtlInitUnicodeString(&UnicodeString, lpszDevice); 01128 01129 #else 01130 01131 ANSI_STRING AnsiString; 01132 01133 UnicodeString = NtCurrentTeb()->StaticUnicodeString; 01134 RtlInitAnsiString(&AnsiString, (LPSTR)lpszDevice); 01135 01136 if (!NT_SUCCESS(RtlAnsiStringToUnicodeString(&UnicodeString, 01137 &AnsiString, 01138 FALSE))) { 01139 return FALSE; 01140 } 01141 01142 #endif 01143 01144 pUnicodeString = &UnicodeString; 01145 } 01146 01147 Status = NtUserEnumDisplayDevices( 01148 pUnicodeString, 01149 iDevNum, 01150 &tmpDisplayDevice, 01151 dwFlags); 01152 01153 if (NT_SUCCESS(Status)) 01154 { 01155 #ifndef UNICODE 01156 LPSTR psz; 01157 01158 if (lpDisplayDevice->cb >= FIELD_OFFSET(DISPLAY_DEVICE, DeviceString)) { 01159 psz = (LPSTR)&(lpDisplayDevice->DeviceName[0]); 01160 WCSToMB(&(tmpDisplayDevice.DeviceName[0]), -1, &psz, 32, FALSE); 01161 } 01162 01163 if (lpDisplayDevice->cb >= FIELD_OFFSET(DISPLAY_DEVICE, StateFlags)) { 01164 psz = (LPSTR)&(lpDisplayDevice->DeviceString[0]); 01165 WCSToMB(&(tmpDisplayDevice.DeviceString[0]), -1, &psz, 128, FALSE); 01166 } 01167 01168 if (lpDisplayDevice->cb >= FIELD_OFFSET(DISPLAY_DEVICE, DeviceID)) { 01169 lpDisplayDevice->StateFlags = tmpDisplayDevice.StateFlags; 01170 } 01171 01172 if (lpDisplayDevice->cb >= FIELD_OFFSET(DISPLAY_DEVICE, DeviceKey)) { 01173 psz = (LPSTR)&(lpDisplayDevice->DeviceID[0]); 01174 WCSToMB(&(tmpDisplayDevice.DeviceID[0]), -1, &psz, 128, FALSE); 01175 } 01176 if (lpDisplayDevice->cb >= sizeof(DISPLAY_DEVICE)) { 01177 psz = (LPSTR)&(lpDisplayDevice->DeviceKey[0]); 01178 WCSToMB(&(tmpDisplayDevice.DeviceKey[0]), -1, &psz, 128, FALSE); 01179 } 01180 #else 01181 01182 RtlMoveMemory(lpDisplayDevice, 01183 &tmpDisplayDevice, 01184 lpDisplayDevice->cb); 01185 01186 #endif 01187 01188 return TRUE; 01189 } 01190 01191 return FALSE; 01192 } 01193 01194 BOOL EnumDisplaySettings( 01195 LPCTSTR lpszDeviceName, 01196 DWORD iModeNum, 01197 LPDEVMODE lpDevMode) 01198 { 01199 01200 // 01201 // Work-around Win95 problem which does not require the caller 01202 // to initialize these two fields. 01203 // 01204 01205 lpDevMode->dmDriverExtra = 0; 01206 lpDevMode->dmSize = FIELD_OFFSET(DEVMODE, dmICMMethod); 01207 01208 return EnumDisplaySettingsEx(lpszDeviceName, iModeNum, lpDevMode, 0); 01209 } 01210 01211 BOOL EnumDisplaySettingsEx( 01212 LPCTSTR lpszDeviceName, 01213 DWORD iModeNum, 01214 LPDEVMODE lpDevMode, 01215 DWORD dwFlags) 01216 { 01217 UNICODE_STRING UnicodeString; 01218 PUNICODE_STRING pUnicodeString = NULL; 01219 LPDEVMODEW lpDevModeReserve; 01220 BOOL retval = FALSE; 01221 WORD size = lpDevMode->dmSize; 01222 01223 if (lpszDeviceName) { 01224 01225 #ifdef UNICODE 01226 01227 RtlInitUnicodeString(&UnicodeString, lpszDeviceName); 01228 01229 #else 01230 01231 ANSI_STRING AnsiString; 01232 01233 UnicodeString = NtCurrentTeb()->StaticUnicodeString; 01234 RtlInitAnsiString(&AnsiString, (LPSTR)lpszDeviceName); 01235 01236 if (!NT_SUCCESS(RtlAnsiStringToUnicodeString(&UnicodeString, 01237 &AnsiString, 01238 FALSE))) { 01239 return FALSE; 01240 } 01241 01242 #endif 01243 01244 pUnicodeString = &UnicodeString; 01245 } 01246 01247 /* 01248 * Currently -2 is reserved (undocumented function of the NT api. 01249 * remove the check is win95 implements this. 01250 * -> -1 returns the content of the registry at the time of the call 01251 * 01252 * 01253 * if (iModeNum == (DWORD) -2) 01254 * { 01255 * return FALSE; 01256 * } 01257 * 01258 * 01259 * -1 should return the current DEVMODE for the device. 01260 * This is handled in the kernel part of the function, so we pass it on. 01261 * 01262 * 01263 * 01264 * We will always request a full DEVMODE from the kernel. 01265 * So allocate the space needed 01266 * 01267 */ 01268 lpDevModeReserve = UserLocalAlloc(HEAP_ZERO_MEMORY, 01269 sizeof(DEVMODEW) + lpDevMode->dmDriverExtra); 01270 01271 if (lpDevModeReserve) { 01272 01273 lpDevModeReserve->dmSize = sizeof(DEVMODEW); 01274 lpDevModeReserve->dmDriverExtra = lpDevMode->dmDriverExtra; 01275 01276 /* 01277 * Get the information 01278 */ 01279 retval = (NT_SUCCESS(NtUserEnumDisplaySettings(pUnicodeString, 01280 iModeNum, 01281 lpDevModeReserve, 01282 dwFlags))); 01283 if (retval) { 01284 01285 #ifndef UNICODE 01286 LPSTR psz; 01287 #endif 01288 01289 /* 01290 * return only the amount of information requested. 01291 * For ANSI, this requires a conversion. 01292 */ 01293 01294 /* 01295 * First, copy the driver extra information 01296 */ 01297 01298 if (lpDevMode->dmDriverExtra && 01299 lpDevModeReserve->dmDriverExtra) { 01300 01301 RtlMoveMemory(((PUCHAR)lpDevMode) + size, 01302 lpDevModeReserve + 1, 01303 min(lpDevMode->dmDriverExtra, 01304 lpDevModeReserve->dmDriverExtra)); 01305 } 01306 01307 #ifndef UNICODE 01308 psz = (LPSTR)&(lpDevMode->dmDeviceName[0]); 01309 01310 retval = WCSToMB(lpDevModeReserve->dmDeviceName, 01311 -1, 01312 &psz, 01313 32, 01314 FALSE); 01315 01316 RtlMoveMemory(&lpDevMode->dmSpecVersion, 01317 &lpDevModeReserve->dmSpecVersion, 01318 min(size, FIELD_OFFSET(DEVMODE,dmFormName)) - 01319 FIELD_OFFSET(DEVMODE,dmSpecVersion)); 01320 01321 lpDevMode->dmSize = size; 01322 01323 if (size >= FIELD_OFFSET(DEVMODE,dmFormName)) { 01324 01325 psz = (LPSTR)&(lpDevMode->dmFormName[0]); 01326 01327 retval = WCSToMB(lpDevModeReserve->dmFormName, -1, &psz, 32, FALSE); 01328 } 01329 01330 if (size > FIELD_OFFSET(DEVMODE,dmBitsPerPel)) { 01331 01332 RtlMoveMemory(&lpDevMode->dmBitsPerPel, 01333 &lpDevModeReserve->dmBitsPerPel, 01334 lpDevMode->dmSize + 01335 lpDevMode->dmDriverExtra - 01336 FIELD_OFFSET(DEVMODE,dmBitsPerPel)); 01337 } 01338 01339 #else 01340 RtlMoveMemory(lpDevMode, lpDevModeReserve, size); 01341 01342 lpDevMode->dmSize = size; 01343 01344 #endif 01345 01346 if (size != lpDevMode->dmSize) { 01347 RIPMSG0(RIP_WARNING, "EnumDisplaySettings : Error in dmSize"); 01348 } 01349 01350 /* 01351 * Don't return invalid field flags to the application 01352 * Add any other new ones here. 01353 * 01354 * We assume apps at least have up to dmDisplayFrenquency for 01355 * now ... 01356 */ 01357 01358 if (size < FIELD_OFFSET(DEVMODE,dmPanningWidth)) 01359 lpDevMode->dmFields &= ~DM_PANNINGWIDTH; 01360 01361 if (size < FIELD_OFFSET(DEVMODE,dmPanningHeight)) 01362 lpDevMode->dmFields &= ~DM_PANNINGHEIGHT; 01363 } 01364 01365 LocalFree(lpDevModeReserve); 01366 } 01367 01368 return retval; 01369 } 01370 01371 01372 LONG ChangeDisplaySettings( 01373 LPDEVMODE lpDevMode, 01374 DWORD dwFlags) 01375 { 01376 01377 /* 01378 * Compatibility 01379 */ 01380 if (lpDevMode) 01381 lpDevMode->dmDriverExtra = 0; 01382 01383 return ChangeDisplaySettingsEx(NULL, lpDevMode, NULL, dwFlags, NULL); 01384 } 01385 01386 LONG ChangeDisplaySettingsEx( 01387 LPCTSTR lpszDeviceName, 01388 LPDEVMODE lpDevMode, 01389 HWND hwnd, 01390 DWORD dwFlags, 01391 LPVOID lParam) 01392 { 01393 #ifndef UNICODE 01394 ANSI_STRING AnsiString; 01395 #endif 01396 01397 UNICODE_STRING UnicodeString; 01398 PUNICODE_STRING pUnicodeString = NULL; 01399 LONG status = DISP_CHANGE_FAILED; 01400 LPDEVMODEW lpDevModeW; 01401 01402 if (lpszDeviceName) { 01403 01404 #ifdef UNICODE 01405 01406 RtlInitUnicodeString(&UnicodeString, lpszDeviceName); 01407 01408 #else 01409 01410 UnicodeString = NtCurrentTeb()->StaticUnicodeString; 01411 RtlInitAnsiString(&AnsiString, (LPSTR)lpszDeviceName); 01412 01413 if (!NT_SUCCESS(RtlAnsiStringToUnicodeString(&UnicodeString, 01414 &AnsiString, 01415 FALSE))) { 01416 return FALSE; 01417 } 01418 01419 #endif 01420 01421 pUnicodeString = &UnicodeString; 01422 } 01423 01424 #ifdef UNICODE 01425 01426 lpDevModeW = lpDevMode; 01427 01428 #else 01429 01430 lpDevModeW = NULL; 01431 01432 if (lpDevMode) { 01433 01434 lpDevModeW = GdiConvertToDevmodeW(lpDevMode); 01435 01436 if (lpDevModeW == NULL) { 01437 01438 return FALSE; 01439 } 01440 } 01441 01442 #endif 01443 01444 status = NtUserChangeDisplaySettings(pUnicodeString, 01445 lpDevModeW, 01446 hwnd, 01447 dwFlags, 01448 lParam); 01449 01450 #ifndef UNICODE 01451 if (lpDevMode) { 01452 LocalFree(lpDevModeW); 01453 } 01454 #endif 01455 01456 return status; 01457 } 01458 01459 01460 BOOL CallMsgFilter( 01461 LPMSG pmsg, 01462 int nCode) 01463 { 01464 PCLIENTINFO pci; 01465 MSG msg; 01466 01467 BEGINCALLCONNECT() 01468 01469 /* 01470 * If we're not hooked, don't bother going to the server 01471 */ 01472 pci = GetClientInfo(); 01473 if (!IsHooked(pci, (WH_MSGFILTER | WH_SYSMSGFILTER))) { 01474 return FALSE; 01475 } 01476 01477 /* 01478 * Don't allow apps to use the hiword of the message parameter. 01479 */ 01480 if (pmsg->message & RESERVED_MSG_BITS) { 01481 MSGERRORCODE(ERROR_INVALID_PARAMETER); 01482 } 01483 msg = *pmsg; 01484 01485 #ifndef UNICODE 01486 switch (pmsg->message) { 01487 #ifdef FE_SB // CallMsgFilter() 01488 case WM_CHAR: 01489 case EM_SETPASSWORDCHAR: 01490 #ifndef LATER 01491 /* 01492 * we should not return "TRUE" everytime for DBCS leadbyte character... 01493 * but should convert DBCS character to Unicode correctly.. How I can do ?? 01494 * then ,finally, we just take what we did in NT 3.51, it means do nothing.. 01495 */ 01496 #else 01497 /* 01498 * Build DBCS-aware message. 01499 */ 01500 BUILD_DBCS_MESSAGE_TO_SERVER_FROM_CLIENTA(pmsg->message,pmsg->wParam,TRUE); 01501 /* 01502 * Fall through..... 01503 */ 01504 #endif // LATER 01505 #else 01506 case WM_CHAR: 01507 case EM_SETPASSWORDCHAR: 01508 #endif // FE_SB 01509 case WM_CHARTOITEM: 01510 case WM_DEADCHAR: 01511 case WM_SYSCHAR: 01512 case WM_SYSDEADCHAR: 01513 case WM_MENUCHAR: 01514 #ifdef FE_IME // CallMsgFilter() 01515 case WM_IME_CHAR: 01516 case WM_IME_COMPOSITION: 01517 #endif // FE_IME 01518 01519 RtlMBMessageWParamCharToWCS( msg.message, &(msg.wParam)); 01520 break; 01521 } 01522 #endif 01523 01524 retval = (DWORD)NtUserCallMsgFilter( 01525 &msg, 01526 nCode); 01527 01528 ERRORTRAP(0); 01529 ENDCALL(BOOL); 01530 } 01531 01532 BOOL DrawCaptionTemp( 01533 HWND hwnd, 01534 HDC hdc, 01535 LPCRECT lprc, 01536 HFONT hFont, 01537 HICON hicon, 01538 LPCTSTR lpText, 01539 UINT flags) 01540 { 01541 HDC hdcr; 01542 IN_STRING strText; 01543 01544 /* 01545 * Make sure cleanup will work successfully 01546 */ 01547 strText.fAllocated = FALSE; 01548 01549 BEGINCALL() 01550 01551 if (IsMetaFile(hdc)) return FALSE; 01552 01553 hdcr = GdiConvertAndCheckDC(hdc); 01554 if (hdcr == (HDC)0) 01555 return FALSE; 01556 01557 FIRSTCOPYLPTSTRIDOPT(&strText, lpText); 01558 01559 retval = (DWORD)NtUserDrawCaptionTemp( 01560 hwnd, 01561 hdc, 01562 lprc, 01563 hFont, 01564 hicon, 01565 strText.pstr, 01566 flags); 01567 01568 ERRORTRAP(0); 01569 CLEANUPLPTSTR(strText); 01570 ENDCALL(BOOL); 01571 } 01572 01573 WINUSERAPI UINT WINAPI 01574 RealGetWindowClass( 01575 HWND hwnd, 01576 LPTSTR ptszClassName, 01577 UINT cchClassNameMax) 01578 { 01579 UNICODE_STRING strClassName; 01580 int retval; 01581 01582 strClassName.MaximumLength = (USHORT)(cchClassNameMax * sizeof(WCHAR)); 01583 01584 #ifndef UNICODE 01585 strClassName.Buffer = LocalAlloc(LMEM_FIXED, strClassName.MaximumLength); 01586 if (!strClassName.Buffer) { 01587 return 0; 01588 } 01589 #else 01590 strClassName.Buffer = ptszClassName; 01591 #endif 01592 01593 retval = NtUserGetClassName(hwnd, TRUE, &strClassName); 01594 01595 #ifndef UNICODE 01596 if (retval || (cchClassNameMax == 1)) { 01597 /* 01598 * Copy the result 01599 */ 01600 retval = WCSToMB(strClassName.Buffer, retval, 01601 &ptszClassName, cchClassNameMax-1, FALSE); 01602 ptszClassName[retval] = '\0'; 01603 } 01604 LocalFree(strClassName.Buffer); 01605 #endif 01606 01607 return retval; 01608 } 01609 01610 WINUSERAPI BOOL WINAPI GetAltTabInfo( 01611 HWND hwnd, 01612 int iItem, 01613 PALTTABINFO pati, 01614 LPTSTR pszItemText, 01615 UINT cchItemText OPTIONAL) 01616 { 01617 BEGINCALL() 01618 01619 retval = (DWORD)NtUserGetAltTabInfo(hwnd, iItem, pati, 01620 (LPWSTR)pszItemText, cchItemText, IS_ANSI); 01621 01622 ERRORTRAP(0); 01623 ENDCALL(BOOL); 01624 }

Generated on Sat May 15 19:40:59 2004 for test by doxygen 1.3.7