771
+ − 1 /* Unicode-encapsulation of Win32 library functions.
+ − 2 Copyright (C) 2000, 2001, 2002 Ben Wing.
+ − 3
+ − 4 This file is part of XEmacs.
+ − 5
+ − 6 XEmacs is free software; you can redistribute it and/or modify it
+ − 7 under the terms of the GNU General Public License as published by the
+ − 8 Free Software Foundation; either version 2, or (at your option) any
+ − 9 later version.
+ − 10
+ − 11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
+ − 12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ − 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ − 14 for more details.
+ − 15
+ − 16 You should have received a copy of the GNU General Public License
+ − 17 along with XEmacs; see the file COPYING. If not, write to
+ − 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ − 19 Boston, MA 02111-1307, USA. */
+ − 20
+ − 21 /* Synched up with: Not in FSF. */
+ − 22
+ − 23 /* Authorship:
+ − 24
+ − 25 Current primary author: Ben Wing <ben@xemacs.org>
+ − 26
+ − 27 Created summer 2000 by Ben Wing. Completed August 2001. Completely
+ − 28 written by Ben Wing.
+ − 29 */
+ − 30
+ − 31 #define NEED_MSWINDOWS_COMMCTRL
+ − 32 #define NEED_MSWINDOWS_SHLOBJ
+ − 33
+ − 34 #include <config.h>
+ − 35 #include "lisp.h"
+ − 36
+ − 37 #include "console-msw.h"
+ − 38
+ − 39 int no_mswin_unicode_lib_calls;
+ − 40
+ − 41 /* The golden rules of writing Unicode-safe code:
+ − 42
+ − 43 -- There are no preprocessor games going on.
+ − 44
+ − 45 -- Do not set the UNICODE constant.
+ − 46
+ − 47 -- You need to change your code to call the Windows API prefixed with "qxe"
+ − 48 functions (when they exist) and use the ...W structs instead of the
+ − 49 generic ones. String arguments in the qxe functions are of type Extbyte
+ − 50 *.
+ − 51
+ − 52 -- You code is responsible for conversion of text arguments. We try to
+ − 53 handle everything else -- the argument differences, the copying back and
+ − 54 forth of structures, etc. Use Qmswindows_tstr and macros such as
+ − 55 C_STRING_TO_TSTR. You are also responsible for interpreting and
+ − 56 specifying string sizes, which have not been changed. Usually these are
+ − 57 in characters, meaning you need to divide by XETCHAR_SIZE. (But, some
+ − 58 functions want sizes in bytes, even with Unicode strings. Look in the
+ − 59 documentation.) Use XETEXT when specifying string constants, so that
+ − 60 they show up in Unicode as necessary.
+ − 61
+ − 62 -- If you need to process external strings (in general you should not do
+ − 63 this; do all your manipulations in internal format and convert at the
+ − 64 point of entry into or exit from the function), use the xet...()
+ − 65 functions.
+ − 66
+ − 67 more specifically:
+ − 68
+ − 69 Unicode support is important for supporting many languages under
+ − 70 Windows, such as Cyrillic, without resorting to translation tables for
+ − 71 particular Windows-specific code pages. Internally, all characters in
+ − 72 Windows can be represented in two encodings: code pages and Unicode.
+ − 73 With Unicode support, we can seamlessly support all Windows
+ − 74 characters. Currently, the test in the drive to support Unicode is if
+ − 75 IME input works properly, since it is being converted from Unicode.
+ − 76
+ − 77 Unicode support also requires that the various Windows API's be
+ − 78 "Unicode-encapsulated", so that they automatically call the ANSI or
+ − 79 Unicode version of the API call appropriately and handle the size
+ − 80 differences in structures. What this means is:
+ − 81
+ − 82 -- first, note that Windows already provides a sort of encapsulation
+ − 83 of all API's that deal with text. All such API's are underlyingly
+ − 84 provided in two versions, with an A or W suffix (ANSI or "wide"
+ − 85 i.e. Unicode), and the compile-time constant UNICODE controls which is
+ − 86 selected by the unsuffixed API. Same thing happens with structures, and
+ − 87 also with types, where the generic types have names beginning with T --
+ − 88 TCHAR, LPTSTR, etc.. Unfortunately, this is compile-time only, not
+ − 89 run-time, so not sufficient. (Creating the necessary run-time encoding
+ − 90 is not conceptually difficult, but very time-consuming to write. It
+ − 91 adds no significant overhead, and the only reason it's not standard in
+ − 92 Windows is conscious marketing attempts by Microsoft to cripple Windows
+ − 93 95. FUCK MICROSOFT! They even describe in a KnowledgeBase article
+ − 94 exactly how to create such an API [although we don't exactly follow
+ − 95 their procedure], and point out its usefulness; the procedure is also
+ − 96 described more generally in Nadine Kano's book on Win32
+ − 97 internationalization -- written SIX YEARS AGO! Obviously Microsoft has
+ − 98 such an API available internally.)
+ − 99
+ − 100 -- what we do is provide an encapsulation of each standard Windows API call
+ − 101 that is split into A and W versions. current theory is to avoid all
+ − 102 preprocessor games; so we name the function with a prefix -- "qxe"
+ − 103 currently -- and require callers to use the prefixed name. Callers need
+ − 104 to explicitly use the W version of all structures, and convert text
+ − 105 themselves using Qmswindows_tstr. the qxe encapsulated version will
+ − 106 automatically call the appropriate A or W version depending on whether
+ − 107 we're running on 9x or NT (you can force use of the A calls on NT,
+ − 108 e.g. for testing purposes, using the command- line switch -nuni aka
+ − 109 -no-unicode-lib-calls), and copy data between W and A versions of the
+ − 110 structures as necessary.
+ − 111
+ − 112 -- We require the caller to handle the actual translation of text to
+ − 113 avoid possible overflow when dealing with fixed-size Windows
+ − 114 structures. There are no such problems when copying data between
+ − 115 the A and W versions because ANSI text is never larger than its
+ − 116 equivalent Unicode representation.
+ − 117
+ − 118 NOTE NOTE NOTE: As of August 2001, Microsoft (finally! See my nasty
+ − 119 comment above) released their own Unicode-encapsulation library, called
+ − 120 Microsoft Layer for Unicode on Windows 95/98/Me Systems. It tries to be
+ − 121 more transparent than we are, in that
+ − 122
+ − 123 -- its routines do ANSI/Unicode string translation, while we don't, for
+ − 124 efficiency (we already have to do internal/external conversion so it's
+ − 125 no extra burden to do the proper conversion directly rather than always
+ − 126 converting to Unicode and then doing a second conversion to ANSI as
+ − 127 necessary)
+ − 128
+ − 129 -- rather than requiring separately-named routines (qxeFooBar), they
+ − 130 physically override the existing routines at the link level. it also
+ − 131 appears that they do this BADLY, in that if you link with the MLU, you
+ − 132 get an application that runs ONLY on Win9x!!! (hint -- use
+ − 133 GetProcAddress()). there's still no way to create a single binary!
+ − 134 fucking losers.
+ − 135
+ − 136 -- they assume you compile with UNICODE defined, so there's no need for the
+ − 137 application to explicitly use ...W structures, as we require.
+ − 138
+ − 139 -- they also intercept windows procedures to deal with notify messages as
+ − 140 necessary, which we don't do yet.
+ − 141
+ − 142 -- they (of course) don't use Extbyte.
+ − 143
+ − 144 at some point (especially when they fix the single-binary problem!), we
+ − 145 should consider switching. for the meantime, we'll stick with what i've
+ − 146 already written. perhaps we should think about adopting some of the
+ − 147 greater transparency they have; but i opted against transparency on
+ − 148 purpose, to make the code easier to follow for someone who's not familiar
+ − 149 with it. until our library is really complete and bug-free, we should
+ − 150 think twice before doing this.
+ − 151 */
+ − 152
+ − 153
+ − 154 /************************************************************************/
+ − 155 /* auto-generation */
+ − 156 /************************************************************************/
+ − 157
+ − 158 /* we use a simple script to control the auto-generation.
+ − 159
+ − 160 \(The following is copied from lib-src/make-mswin-unicode.pl.)
+ − 161
+ − 162 file specifies a file to start reading from.
+ − 163 yes indicates a function to be automatically Unicode-encapsulated.
+ − 164 (All parameters either need no special processing or are LPTSTR or
+ − 165 LPCTSTR.)
+ − 166 soon indicates a function that should be automatically Unicode-encapsulated,
+ − 167 but we're not ready to process it yet.
+ − 168 no indicates a function we don't support (it will be #defined to cause
+ − 169 a compile error, with the text after the function included in the
+ − 170 erroneous definition to indicate why we don't support it).
+ − 171 skip indicates a function we support manually; only a comment about this
+ − 172 will be generated.
+ − 173 split indicates a function with a split structure (different versions
+ − 174 for Unicode and ANSI), but where the only difference is in pointer
+ − 175 types, and the actual size does not differ. The structure name
+ − 176 should follow the function name, and it will be automatically
+ − 177 Unicode-encapsulated with appropriate casts.
+ − 178 begin-bracket indicates a #if statement to be inserted here.
+ − 179 end-bracket indicates the corresponding #endif statement.
+ − 180 blank lines and lines beginning with // are ignored.
+ − 181
+ − 182 The generated files go into intl-auto-encap-win32.[ch].
+ − 183
+ − 184 To regenerate, go to the nt/ subdirectory and type
+ − 185
+ − 186 nmake -f xemacs.mak unicode-encapsulate
+ − 187
+ − 188 This does the following:
+ − 189
+ − 190 cd $(SRC)
+ − 191 perl ../lib-src/make-mswin-unicode.pl --c-output intl-auto-encap-win32.c --h-output intl-auto-encap-win32.h intl-encap-win32.c
+ − 192
+ − 193 */
+ − 194
+ − 195 /*
+ − 196
+ − 197 terminology used below:
+ − 198
+ − 199 "split-simple" means a structure where the A and W versions are the same
+ − 200 size, and the only differences are string pointer arguments. (This does NOT
+ − 201 include structures with a pointer to a split-sized structure within them.)
+ − 202 This can also refer to a function pointer whose only split arguments are
+ − 203 string pointers or split-simple structures.
+ − 204
+ − 205 "split-sized" means a structure where the A and W versions are different
+ − 206 sizes (typically because of an inline string argument), or where there's a
+ − 207 pointer to another split-sized structure.
+ − 208
+ − 209 "split-complex"
+ − 210
+ − 211 begin-unicode-encapsulation-script
+ − 212
800
+ − 213 // dir c:\Program Files\Microsoft Visual Studio\VC98\Include\
+ − 214
771
+ − 215 file WINBASE.H
+ − 216
+ − 217 yes GetBinaryType
+ − 218 yes GetShortPathName
1684
+ − 219 no GetLongPathName Win98/2K+ only
827
+ − 220 skip GetEnvironmentStrings misnamed ANSI version of the function
771
+ − 221 yes FreeEnvironmentStrings
+ − 222 yes FormatMessage
+ − 223 yes CreateMailslot
+ − 224 begin-bracket !defined (CYGWIN_HEADERS)
778
+ − 225 no EncryptFile Win2K+ only
+ − 226 no DecryptFile Win2K+ only
771
+ − 227 end-bracket
+ − 228 no OpenRaw error "The procedure entry point OpenRawW could not be located in the dynamic link library ADVAPI32.dll."
+ − 229 no QueryRecoveryAgents split-sized LPRECOVERY_AGENT_INFORMATION
+ − 230 yes lstrcmp
+ − 231 yes lstrcmpi
+ − 232 yes lstrcpyn
+ − 233 yes lstrcpy
+ − 234 yes lstrcat
+ − 235 yes lstrlen
+ − 236 yes CreateMutex
+ − 237 yes OpenMutex
+ − 238 yes CreateEvent
+ − 239 yes OpenEvent
+ − 240 yes CreateSemaphore
+ − 241 yes OpenSemaphore
+ − 242 yes CreateWaitableTimer
+ − 243 yes OpenWaitableTimer
+ − 244 yes CreateFileMapping
+ − 245 yes OpenFileMapping
+ − 246 yes GetLogicalDriveStrings
+ − 247 yes LoadLibrary
+ − 248 yes LoadLibraryEx
+ − 249 yes GetModuleFileName
+ − 250 yes GetModuleHandle
+ − 251 split CreateProcess LPSTARTUPINFO
+ − 252 yes FatalAppExit
+ − 253 split GetStartupInfo LPSTARTUPINFO
+ − 254 yes GetCommandLine
+ − 255 yes GetEnvironmentVariable
+ − 256 yes SetEnvironmentVariable
+ − 257 yes ExpandEnvironmentStrings
+ − 258 yes OutputDebugString
+ − 259 yes FindResource
+ − 260 yes FindResourceEx
+ − 261 yes EnumResourceTypes
+ − 262 yes EnumResourceNames
+ − 263 yes EnumResourceLanguages
+ − 264 yes BeginUpdateResource
+ − 265 yes UpdateResource
+ − 266 yes EndUpdateResource
+ − 267 yes GlobalAddAtom
+ − 268 yes GlobalFindAtom
+ − 269 yes GlobalGetAtomName
+ − 270 yes AddAtom
+ − 271 yes FindAtom
+ − 272 yes GetAtomName
+ − 273 yes GetProfileInt
+ − 274 yes GetProfileString
+ − 275 yes WriteProfileString
+ − 276 yes GetProfileSection
+ − 277 yes WriteProfileSection
+ − 278 yes GetPrivateProfileInt
+ − 279 yes GetPrivateProfileString
+ − 280 yes WritePrivateProfileString
+ − 281 yes GetPrivateProfileSection
+ − 282 yes WritePrivateProfileSection
+ − 283 yes GetPrivateProfileSectionNames
+ − 284 yes GetPrivateProfileStruct
+ − 285 yes WritePrivateProfileStruct
+ − 286 yes GetDriveType
+ − 287 yes GetSystemDirectory
+ − 288 yes GetTempPath
+ − 289 yes GetTempFileName
+ − 290 yes GetWindowsDirectory
+ − 291 yes SetCurrentDirectory
+ − 292 yes GetCurrentDirectory
+ − 293 yes GetDiskFreeSpace
+ − 294 yes GetDiskFreeSpaceEx
+ − 295 yes CreateDirectory
+ − 296 yes CreateDirectoryEx
+ − 297 yes RemoveDirectory
+ − 298 yes GetFullPathName
+ − 299 yes DefineDosDevice
+ − 300 yes QueryDosDevice
+ − 301 yes CreateFile
+ − 302 yes SetFileAttributes
+ − 303 yes GetFileAttributes
+ − 304 yes GetFileAttributesEx
+ − 305 yes GetCompressedFileSize
+ − 306 yes DeleteFile
+ − 307 no FindFirstFileEx split-sized LPWIN32_FIND_DATA; not used, NT 4.0+ only
+ − 308 skip FindFirstFile split-sized LPWIN32_FIND_DATA
+ − 309 skip FindNextFile split-sized LPWIN32_FIND_DATA
+ − 310 yes SearchPath
+ − 311 yes CopyFile
+ − 312 yes CopyFileEx NT 4.0+ only
+ − 313 yes MoveFile
+ − 314 yes MoveFileEx
+ − 315 no MoveFileWithProgress NT 5.0+ only
+ − 316 no CreateHardLink NT 5.0+ only
+ − 317 yes CreateNamedPipe
+ − 318 yes GetNamedPipeHandleState
+ − 319 yes CallNamedPipe
+ − 320 yes WaitNamedPipe
+ − 321 yes SetVolumeLabel
+ − 322 yes GetVolumeInformation
+ − 323 yes ClearEventLog
+ − 324 yes BackupEventLog
+ − 325 yes OpenEventLog
+ − 326 yes RegisterEventSource
+ − 327 yes OpenBackupEventLog
+ − 328 yes ReadEventLog
+ − 329 yes ReportEvent
+ − 330 yes AccessCheckAndAuditAlarm
+ − 331 no AccessCheckByTypeAndAuditAlarm NT 5.0+ only
+ − 332 no AccessCheckByTypeResultListAndAuditAlarm NT 5.0+ only
+ − 333 yes ObjectOpenAuditAlarm
+ − 334 yes ObjectPrivilegeAuditAlarm
+ − 335 yes ObjectCloseAuditAlarm
+ − 336 yes ObjectDeleteAuditAlarm
+ − 337 yes PrivilegedServiceAuditAlarm
+ − 338 yes SetFileSecurity
+ − 339 yes GetFileSecurity
+ − 340 yes FindFirstChangeNotification
+ − 341 no ReadDirectoryChanges Unicode-only
+ − 342 yes IsBadStringPtr
+ − 343 yes LookupAccountSid
+ − 344 yes LookupAccountName
+ − 345 yes LookupPrivilegeValue
+ − 346 yes LookupPrivilegeName
+ − 347 yes LookupPrivilegeDisplayName
+ − 348 yes BuildCommDCB
+ − 349 yes BuildCommDCBAndTimeouts
+ − 350 yes CommConfigDialog
+ − 351 yes GetDefaultCommConfig
+ − 352 yes SetDefaultCommConfig
+ − 353 yes GetComputerName
+ − 354 yes SetComputerName
+ − 355 yes GetUserName
+ − 356 yes LogonUser
+ − 357 split CreateProcessAsUser LPSTARTUPINFO
+ − 358 no GetCurrentHwProfile split-sized LPHW_PROFILE_INFO; NT 4.0+ only
+ − 359 no GetVersionEx split-sized LPOSVERSIONINFO
+ − 360 no CreateJobObject NT 5.0+ only
+ − 361 no OpenJobObject NT 5.0+ only
+ − 362
+ − 363 file WINUSER.H
+ − 364
+ − 365 skip MAKEINTRESOURCE macro
+ − 366 yes wvsprintf
+ − 367 no wsprintf varargs
+ − 368 yes LoadKeyboardLayout
+ − 369 yes GetKeyboardLayoutName
+ − 370 no CreateDesktop split-sized LPDEVMODE
+ − 371 yes OpenDesktop
+ − 372 split EnumDesktops DESKTOPENUMPROC // callback fun differs only in string pointer type
+ − 373 yes CreateWindowStation
+ − 374 yes OpenWindowStation
+ − 375 split EnumWindowStations WINSTAENUMPROC // callback fun differs only in string pointer type
+ − 376 yes GetUserObjectInformation
+ − 377 yes SetUserObjectInformation
+ − 378 yes RegisterWindowMessage
+ − 379 yes GetMessage
+ − 380 yes DispatchMessage
+ − 381 yes PeekMessage
+ − 382 skip SendMessage split messages and structures
+ − 383 yes SendMessageTimeout
+ − 384 yes SendNotifyMessage
+ − 385 yes SendMessageCallback
+ − 386 no BroadcastSystemMessage win95 version not split; NT 4.0+ only
+ − 387 no RegisterDeviceNotification NT 5.0+ only
+ − 388 yes PostMessage
+ − 389 yes PostThreadMessage
+ − 390 no PostAppMessage macro
+ − 391 skip DefWindowProc return value is conditionalized on _MAC, messes up parser
+ − 392 no CallWindowProc two versions, STRICT and non-STRICT
+ − 393 skip RegisterClass need to intercept so we can provide our own window procedure and handle split notify messages; split-simple WNDCLASS
+ − 394 skip UnregisterClass need to intercept for reasons related to RegisterClass
+ − 395 split GetClassInfo LPWNDCLASS
+ − 396 skip RegisterClassEx need to intercept so we can provide our own window procedure and handle split notify messages; split-simple WNDCLASSEX; NT 4.0+ only
+ − 397 split GetClassInfoEx LPWNDCLASSEX NT 4.0+ only
+ − 398 yes CreateWindowEx
+ − 399 skip CreateWindow macro
+ − 400 yes CreateDialogParam
+ − 401 split CreateDialogIndirectParam LPCDLGTEMPLATE error in Cygwin prototype (no split) but fixable with typedef
+ − 402 no CreateDialog macro
+ − 403 no CreateDialogIndirect macro w/split LPCDLGTEMPLATE
+ − 404 yes DialogBoxParam
+ − 405 split DialogBoxIndirectParam LPCDLGTEMPLATE error in Cygwin prototype (no split) but fixable with typedef
+ − 406 no DialogBox macro
+ − 407 no DialogBoxIndirect macro w/split LPCDLGTEMPLATE
+ − 408 yes SetDlgItemText
+ − 409 yes GetDlgItemText
+ − 410 yes SendDlgItemMessage
+ − 411 no DefDlgProc return value is conditionalized on _MAC, messes up parser
+ − 412 begin-bracket !defined (CYGWIN_HEADERS)
+ − 413 yes CallMsgFilter
+ − 414 end-bracket
+ − 415 yes RegisterClipboardFormat
+ − 416 yes GetClipboardFormatName
+ − 417 yes CharToOem
+ − 418 yes OemToChar
+ − 419 yes CharToOemBuff
+ − 420 yes OemToCharBuff
+ − 421 yes CharUpper
+ − 422 yes CharUpperBuff
+ − 423 yes CharLower
+ − 424 yes CharLowerBuff
+ − 425 yes CharNext
+ − 426 yes CharPrev
+ − 427 no IsCharAlpha split CHAR
+ − 428 no IsCharAlphaNumeric split CHAR
+ − 429 no IsCharUpper split CHAR
+ − 430 no IsCharLower split CHAR
+ − 431 yes GetKeyNameText
+ − 432 skip VkKeyScan split CHAR
+ − 433 no VkKeyScanEx split CHAR; NT 4.0+ only
+ − 434 yes MapVirtualKey
+ − 435 yes MapVirtualKeyEx NT 4.0+ only
+ − 436 yes LoadAccelerators
+ − 437 yes CreateAcceleratorTable
+ − 438 yes CopyAcceleratorTable
+ − 439 yes TranslateAccelerator
+ − 440 yes LoadMenu
+ − 441 split LoadMenuIndirect MENUTEMPLATE
+ − 442 yes ChangeMenu
+ − 443 yes GetMenuString
+ − 444 yes InsertMenu
+ − 445 yes AppendMenu
+ − 446 yes ModifyMenu
+ − 447 split InsertMenuItem LPCMENUITEMINFO NT 4.0+ only
+ − 448 split GetMenuItemInfo LPMENUITEMINFO NT 4.0+ only
+ − 449 split SetMenuItemInfo LPCMENUITEMINFO NT 4.0+ only
+ − 450 yes DrawText
+ − 451 yes DrawTextEx NT 4.0+ only
+ − 452 yes GrayString
+ − 453 yes DrawState NT 4.0+ only
+ − 454 yes TabbedTextOut
+ − 455 yes GetTabbedTextExtent
+ − 456 yes SetProp
+ − 457 yes GetProp
+ − 458 yes RemoveProp
+ − 459 split EnumPropsEx PROPENUMPROCEX // callback fun differs only in string pointer type
+ − 460 split EnumProps PROPENUMPROC // callback fun differs only in string pointer type
+ − 461 yes SetWindowText
+ − 462 yes GetWindowText
+ − 463 yes GetWindowTextLength
+ − 464 yes MessageBox
+ − 465 yes MessageBoxEx
+ − 466 split MessageBoxIndirect LPMSGBOXPARAMS NT 4.0+ only
+ − 467 yes GetWindowLong
+ − 468 yes SetWindowLong
+ − 469 yes GetClassLong
+ − 470 yes SetClassLong
+ − 471 yes FindWindow
+ − 472 yes FindWindowEx NT 4.0+ only
+ − 473 yes GetClassName
+ − 474 no SetWindowsHook obsolete; two versions, STRICT and non-STRICT
+ − 475 yes SetWindowsHookEx
+ − 476 yes LoadBitmap
+ − 477 yes LoadCursor
+ − 478 yes LoadCursorFromFile
+ − 479 yes LoadIcon
+ − 480 yes LoadImage NT 4.0+ only
+ − 481 yes LoadString
+ − 482 yes IsDialogMessage
+ − 483 yes DlgDirList
+ − 484 yes DlgDirSelectEx
+ − 485 yes DlgDirListComboBox
+ − 486 yes DlgDirSelectComboBoxEx
+ − 487 yes DefFrameProc
+ − 488 no DefMDIChildProc return value is conditionalized on _MAC, messes up parser
+ − 489
+ − 490 yes CreateMDIWindow
+ − 491 yes WinHelp
+ − 492 no ChangeDisplaySettings split-sized LPDEVMODE
+ − 493 no ChangeDisplaySettingsEx split-sized LPDEVMODE; NT 5.0/Win98+ only
+ − 494 no EnumDisplaySettings split-sized LPDEVMODE
+ − 495 no EnumDisplayDevices split-sized PDISPLAY_DEVICE; NT 5.0+ only, no Win98
+ − 496 yes SystemParametersInfo probs w/ICONMETRICS, NONCLIENTMETRICS
+ − 497 no GetMonitorInfo NT 5.0/Win98+ only
+ − 498 no GetWindowModuleFileName NT 5.0+ only
+ − 499 no RealGetWindowClass NT 5.0+ only
+ − 500 no GetAltTabInfo NT 5.0+ only
+ − 501
+ − 502 file WINGDI.H
+ − 503
+ − 504 // split-sized LOGCOLORSPACE
+ − 505 // split-sized TEXTMETRIC
+ − 506 // split-sized NEWTEXTMETRIC
+ − 507 // split-sized NEWTEXTMETRICEX
+ − 508 // split-sized LOGFONT
+ − 509 // split-sized ENUMLOGFONT
+ − 510 // split-sized ENUMLOGFONTEX
+ − 511 // split-sized EXTLOGFONT, used in EMREXTCREATEFONTINDIRECTW (Unicode-only) and (???) in DEVINFO (DDK structure)
+ − 512 // split-sized DEVMODE
+ − 513 // split-sized DISPLAY_DEVICE, used in EnumDisplayDevices
+ − 514 // split-sized OUTLINETEXTMETRIC
+ − 515 // split-simple POLYTEXT
+ − 516 // split-simple GCP_RESULTS
+ − 517 // split-sized function pointer OLDFONTENUMPROC, same as FONTENUMPROC
+ − 518 // split-sized function pointer FONTENUMPROC
+ − 519 yes AddFontResource
+ − 520 yes CopyMetaFile
+ − 521 skip CreateDC split-sized DEVMODE
+ − 522 skip CreateFontIndirect split-sized LOGFONT
+ − 523 yes CreateFont
+ − 524 skip CreateIC split-sized DEVMODE
+ − 525 yes CreateMetaFile
+ − 526 yes CreateScalableFontResource
+ − 527 skip DeviceCapabilities split-sized DEVMODE
+ − 528 skip EnumFontFamiliesEx split-complex FONTENUMPROC; NT 4.0+ only
+ − 529 no EnumFontFamilies split-complex FONTENUMPROC
+ − 530 no EnumFonts split-complex FONTENUMPROC
+ − 531 yes GetCharWidth
+ − 532 yes GetCharWidth32
+ − 533 yes GetCharWidthFloat
+ − 534 yes GetCharABCWidths
+ − 535 yes GetCharABCWidthsFloat
+ − 536 yes GetGlyphOutline
+ − 537 yes GetMetaFile
+ − 538 no GetOutlineTextMetrics split-sized LPOUTLINETEXTMETRIC
+ − 539 yes GetTextExtentPoint
+ − 540 yes GetTextExtentPoint32
+ − 541 yes GetTextExtentExPoint
+ − 542 split GetCharacterPlacement LPGCP_RESULTS NT 4.0+ only
+ − 543 no GetGlyphIndices NT 5.0+ only
+ − 544 no AddFontResourceEx NT 5.0+ only
+ − 545 no RemoveFontResourceEx NT 5.0+ only
+ − 546 // split-sized AXISINFO, used in AXESLIST; NT 5.0+ only
+ − 547 // split-sized AXESLIST, used in ENUMLOGFONTEXDV; NT 5.0+ only
+ − 548 // split-sized ENUMLOGFONTEXDV; NT 5.0+ only
+ − 549 no CreateFontIndirectEx split-sized ENUMLOGFONTEXDV; NT 5.0+ only
+ − 550 // split-sized ENUMTEXTMETRIC, returned in EnumFontFamExProc, on NT 5.0+; NT 5.0+ only
+ − 551 skip ResetDC split-sized DEVMODE
+ − 552 yes RemoveFontResource
+ − 553 yes CopyEnhMetaFile
+ − 554 yes CreateEnhMetaFile
+ − 555 yes GetEnhMetaFile
+ − 556 yes GetEnhMetaFileDescription
+ − 557 skip GetTextMetrics split-sized LPTEXTMETRIC
+ − 558 // split-simple DOCINFO
+ − 559 split StartDoc DOCINFO
+ − 560 skip GetObject split-sized LOGFONT
+ − 561 yes TextOut
+ − 562 yes ExtTextOut
+ − 563 split PolyTextOut POLYTEXT
+ − 564 yes GetTextFace
+ − 565 yes GetKerningPairs
+ − 566 // split-simple function pointer ICMENUMPROC
+ − 567 no GetLogColorSpace split-sized LPLOGCOLORSPACE; NT 4.0+ only
+ − 568 no CreateColorSpace split-sized LPLOGCOLORSPACE; NT 4.0+ only
+ − 569 skip GetICMProfile NT 4.0+ only, error in Cygwin prototype
+ − 570 yes SetICMProfile NT 4.0+ only
+ − 571 split EnumICMProfiles ICMENUMPROC NT 4.0+ only
+ − 572 skip UpdateICMRegKey NT 4.0+ only, error in Cygwin prototype
+ − 573 // non-split EMREXTTEXTOUT (A and W versions identical)
+ − 574 // non-split EMRPOLYTEXTOUT (A and W versions identical)
+ − 575 // Unicode-only EMREXTCREATEFONTINDIRECTW
+ − 576 no wglUseFontBitmaps causes link error
+ − 577 no wglUseFontOutlines causes link error
+ − 578
+ − 579 file WINSPOOL.H
+ − 580
+ − 581 begin-bracket defined (HAVE_MS_WINDOWS)
+ − 582 yes EnumPrinters #### problems with DEVMODE pointer in PRINTER_INFO_2
+ − 583 skip OpenPrinter split-sized DEVMODE pointer in split PRINTER_DEFAULTS
+ − 584 no ResetPrinter split-sized DEVMODE pointer in split PRINTER_DEFAULTS
+ − 585 no SetJob split-sized DEVMODE pointer in split JOB_INFO_2
+ − 586 no GetJob split-sized DEVMODE pointer in split JOB_INFO_2
+ − 587 no EnumJobs split-sized DEVMODE pointer in split JOB_INFO_2
+ − 588 no AddPrinter split-sized DEVMODE pointer in split PRINTER_INFO_2
+ − 589 no SetPrinter split-sized DEVMODE pointer in split PRINTER_INFO_2
+ − 590 no GetPrinter split-sized DEVMODE pointer in split PRINTER_INFO_2
+ − 591 // other than DocumentProperties below, we don't use any of the others,
+ − 592 // and they all pretty much have complicated interfaces with lots of
+ − 593 // split structures, etc.
+ − 594 no AddPrinterDriver not used, complicated interface with split structures
+ − 595 no AddPrinterDriverEx not used, complicated interface with split structures
+ − 596 no EnumPrinterDrivers not used, complicated interface with split structures
+ − 597 no GetPrinterDriver not used, complicated interface with split structures
+ − 598 no GetPrinterDriverDirectory not used, complicated interface with split structures
+ − 599 no DeletePrinterDriver not used, complicated interface with split structures
+ − 600 no DeletePrinterDriverEx not used, complicated interface with split structures
+ − 601 no AddPerMachineConnection not used, complicated interface with split structures
+ − 602 no DeletePerMachineConnection not used, complicated interface with split structures
+ − 603 no EnumPerMachineConnections not used, complicated interface with split structures
+ − 604 no AddPrintProcessor not used, complicated interface with split structures
+ − 605 no EnumPrintProcessors not used, complicated interface with split structures
+ − 606 no GetPrintProcessorDirectory not used, complicated interface with split structures
+ − 607 no EnumPrintProcessorDatatypes not used, complicated interface with split structures
+ − 608 no DeletePrintProcessor not used, complicated interface with split structures
+ − 609 no StartDocPrinter not used, complicated interface with split structures
+ − 610 no AddJob not used, complicated interface with split structures
+ − 611 skip DocumentProperties split-sized DEVMODE, error in Cygwin prototype
+ − 612 no AdvancedDocumentProperties not used, complicated interface with split structures
+ − 613 no GetPrinterData not used, complicated interface with split structures
+ − 614 no GetPrinterDataEx not used, complicated interface with split structures
+ − 615 no EnumPrinterData not used, complicated interface with split structures
+ − 616 no EnumPrinterDataEx not used, complicated interface with split structures
+ − 617 no EnumPrinterKey not used, complicated interface with split structures
+ − 618 no SetPrinterData not used, complicated interface with split structures
+ − 619 no SetPrinterDataEx not used, complicated interface with split structures
+ − 620 no DeletePrinterData not used, complicated interface with split structures
+ − 621 no DeletePrinterDataEx not used, complicated interface with split structures
+ − 622 no DeletePrinterKey not used, complicated interface with split structures
+ − 623 no PrinterMessageBox not used, complicated interface with split structures
+ − 624 no AddForm not used, complicated interface with split structures
+ − 625 no DeleteForm not used, complicated interface with split structures
+ − 626 no GetForm not used, complicated interface with split structures
+ − 627 no SetForm not used, complicated interface with split structures
+ − 628 no EnumForms not used, complicated interface with split structures
+ − 629 no EnumMonitors not used, complicated interface with split structures
+ − 630 no AddMonitor not used, complicated interface with split structures
+ − 631 no DeleteMonitor not used, complicated interface with split structures
+ − 632 no EnumPorts not used, complicated interface with split structures
+ − 633 no AddPort not used, complicated interface with split structures
+ − 634 no ConfigurePort not used, complicated interface with split structures
+ − 635 no DeletePort not used, complicated interface with split structures
+ − 636 no XcvData not used, complicated interface with split structures
+ − 637 no SetPort not used, complicated interface with split structures
+ − 638 no AddPrinterConnection not used, complicated interface with split structures
+ − 639 no DeletePrinterConnection not used, complicated interface with split structures
+ − 640 no AddPrintProvidor not used, complicated interface with split structures
+ − 641 no DeletePrintProvidor not used, complicated interface with split structures
+ − 642 no SetPrinterHTMLView not used, complicated interface with split structures
+ − 643 no GetPrinterHTMLView not used, complicated interface with split structures
+ − 644 end-bracket
+ − 645
+ − 646 file SHELLAPI.H
+ − 647
+ − 648 yes DragQueryFile
+ − 649 yes ShellExecute
+ − 650 yes FindExecutable
+ − 651 no CommandLineToArgv Unicode-only
+ − 652 yes ShellAbout
+ − 653 yes ExtractAssociatedIcon
+ − 654 yes ExtractIcon
+ − 655 // split-simple DRAGINFO, used ??? (docs say "Not currently supported")
+ − 656 begin-bracket !defined (CYGWIN_HEADERS)
+ − 657 yes DoEnvironmentSubst NT 4.0+ only
+ − 658 end-bracket
+ − 659 no FindEnvironmentString causes link error; NT 4.0+ only
+ − 660 skip ExtractIconEx NT 4.0+ only, error in Cygwin prototype
+ − 661 // split-simple SHFILEOPSTRUCT, used in SHFileOperation
+ − 662 // split-simple SHNAMEMAPPING, used in SHFileOperation
+ − 663 split SHFileOperation LPSHFILEOPSTRUCT NT 4.0+ only
+ − 664 // split-simple SHELLEXECUTEINFO, used in ShellExecuteEx
+ − 665 split ShellExecuteEx LPSHELLEXECUTEINFO NT 4.0+ only
+ − 666 no WinExecError causes link error; NT 4.0+ only
+ − 667 begin-bracket !defined (CYGWIN_HEADERS)
+ − 668 yes SHQueryRecycleBin NT 4.0+ only
+ − 669 yes SHEmptyRecycleBin NT 4.0+ only
+ − 670 end-bracket
+ − 671 // split-sized NOTIFYICONDATA, used in Shell_NotifyIcon
+ − 672 no Shell_NotifyIcon split-sized NOTIFYICONDATA, NT 4.0+ only
+ − 673 // split-sized SHFILEINFO, used in SHGetFileInfo
+ − 674 skip SHGetFileInfo split-sized SHFILEINFO, NT 4.0+ only
+ − 675 no SHGetDiskFreeSpace causes link error; NT 4.0+ only
+ − 676 begin-bracket !defined (CYGWIN_HEADERS)
+ − 677 yes SHGetNewLinkInfo NT 4.0+ only
+ − 678 yes SHInvokePrinterCommand NT 4.0+ only
+ − 679 end-bracket
+ − 680
+ − 681 end-unicode-encapsulation-script
+ − 682
+ − 683 file COMMCTRL.H
+ − 684
+ − 685 yes ImageList_LoadImage
+ − 686 WC_HEADER
+ − 687 HDITEM
+ − 688 LPHDITEM
+ − 689 HDM_INSERTITEM
+ − 690 HDM_GETITEM
+ − 691 HDM_SETITEM
+ − 692 HDN_ITEMCHANGING
+ − 693 HDN_ITEMCHANGED
+ − 694 HDN_ITEMCLICK
+ − 695 HDN_ITEMDBLCLICK
+ − 696 HDN_DIVIDERDBLCLICK
+ − 697 HDN_BEGINTRACK
+ − 698 HDN_ENDTRACK
+ − 699 HDN_TRACK
+ − 700 HDN_GETDISPINFO
+ − 701 NMHEADER
+ − 702 LPNMHEADER
+ − 703 NMHDDISPINFO
+ − 704 LPNMHDDISPINFO
+ − 705 TOOLBARCLASSNAME
+ − 706 TBSAVEPARAMS
+ − 707 LPTBSAVEPARAMS
+ − 708 TB_GETBUTTONTEXT
+ − 709 TB_SAVERESTORE
+ − 710 TB_ADDSTRING
+ − 711 TBBUTTONINFO
+ − 712 LPTBBUTTONINFO
+ − 713 TB_GETBUTTONINFO
+ − 714 TB_SETBUTTONINFO
+ − 715 TB_INSERTBUTTON
+ − 716 TB_ADDBUTTONS
+ − 717 TBN_GETINFOTIP
+ − 718 NMTBGETINFOTIP
+ − 719 LPNMTBGETINFOTIP
+ − 720 TBN_GETDISPINFO
+ − 721 LPNMTBDISPINFO
+ − 722 TBN_GETBUTTONINFO
+ − 723 NMTOOLBAR
+ − 724 LPNMTOOLBAR
+ − 725 REBARCLASSNAME
+ − 726 REBARBANDINFO
+ − 727 LPREBARBANDINFO
+ − 728 LPCREBARBANDINFO
+ − 729 RB_INSERTBAND
+ − 730 RB_SETBANDINFO
+ − 731 RB_GETBANDINFO
+ − 732 TOOLTIPS_CLASS
+ − 733 TTTOOLINFO
+ − 734 PTOOLINFO
+ − 735 LPTTTOOLINFO
+ − 736 TTM_ADDTOOL
+ − 737 TTM_DELTOOL
+ − 738 TTM_NEWTOOLRECT
+ − 739 TTM_GETTOOLINFO
+ − 740 TTM_SETTOOLINFO
+ − 741 TTM_HITTEST
+ − 742 TTM_GETTEXT
+ − 743 TTM_UPDATETIPTEXT
+ − 744 TTM_ENUMTOOLS
+ − 745 TTM_GETCURRENTTOOL
+ − 746 TTHITTESTINFO
+ − 747 LPTTHITTESTINFO
+ − 748 TTN_GETDISPINFO
+ − 749 NMTTDISPINFO
+ − 750 LPNMTTDISPINFO
+ − 751 CreateStatusWindow
+ − 752 DrawStatusText
+ − 753 STATUSCLASSNAME
+ − 754 SB_GETTEXT
+ − 755 SB_SETTEXT
+ − 756 SB_GETTEXTLENGTH
+ − 757 SB_SETTIPTEXT
+ − 758 SB_GETTIPTEXT
+ − 759 TRACKBAR_CLASS
+ − 760 UPDOWN_CLASS
+ − 761 PROGRESS_CLASS
+ − 762 HOTKEY_CLASS
+ − 763 WC_LISTVIEW
+ − 764 LVITEM
+ − 765 LPLVITEM
+ − 766 LPSTR_TEXTCALLBACK
+ − 767 LVM_GETITEM
+ − 768 LVM_SETITEM
+ − 769 LVM_INSERTITEM
+ − 770 LVFINDINFO
+ − 771 LVM_FINDITEM
+ − 772 LVM_GETSTRINGWIDTH
+ − 773 LVM_EDITLABEL
+ − 774 LVCOLUMN
+ − 775 LPLVCOLUMN
+ − 776 LVM_GETCOLUMN
+ − 777 LVM_SETCOLUMN
+ − 778 LVM_GETITEMTEXT
+ − 779 LVM_SETITEMTEXT
+ − 780 LVM_GETISEARCHSTRING
+ − 781 LVBKIMAGE
+ − 782 LPLVBKIMAGE
+ − 783 LVM_SETBKIMAGE
+ − 784 LVM_GETBKIMAGE
+ − 785 LVN_ODFINDITEM
+ − 786 LVN_BEGINLABELEDIT
+ − 787 LVN_ENDLABELEDIT
+ − 788 LVN_GETDISPINFO
+ − 789 LVN_SETDISPINFO
+ − 790 NMLVDISPINFO
+ − 791 LVN_GETINFOTIP
+ − 792 NMLVGETINFOTIP
+ − 793 LPNMLVGETINFOTIP
+ − 794 WC_TREEVIEW
+ − 795 TVITEM
+ − 796 LPTVITEM
+ − 797 TVINSERTSTRUCT
+ − 798 LPTVINSERTSTRUCT
+ − 799 TVM_INSERTITEM
+ − 800 TVM_GETITEM
+ − 801 TVM_SETITEM
+ − 802 TVM_EDITLABEL
+ − 803 TVM_GETISEARCHSTRING
+ − 804 NMTREEVIEW
+ − 805 LPNMTREEVIEW
+ − 806 NMTVDISPINFO
+ − 807 LPNMTVDISPINFO
+ − 808 TVN_SELCHANGING
+ − 809 TVN_SELCHANGED
+ − 810 TVN_GETDISPINFO
+ − 811 TVN_SETDISPINFO
+ − 812 TVN_ITEMEXPANDING
+ − 813 TVN_ITEMEXPANDED
+ − 814 TVN_BEGINDRAG
+ − 815 TVN_BEGINRDRAG
+ − 816 TVN_DELETEITEM
+ − 817 TVN_BEGINLABELEDIT
+ − 818 TVN_ENDLABELEDIT
+ − 819 TVN_GETINFOTIP
+ − 820 NMTVGETINFOTIP
+ − 821 LPNMTVGETINFOTIP
+ − 822 WC_COMBOBOXEX
+ − 823 COMBOBOXEXITEM
+ − 824 PCOMBOBOXEXITEM
+ − 825 PCCOMBOBOXEXITEM
+ − 826 CBEM_INSERTITEM
+ − 827 CBEM_SETITEM
+ − 828 CBEM_GETITEM
+ − 829 NMCOMBOBOXEX
+ − 830 PNMCOMBOBOXEX
+ − 831 CBEN_GETDISPINFO
+ − 832 CBEN_DRAGBEGIN
+ − 833 CBEN_ENDEDIT
+ − 834 NMCBEDRAGBEGIN
+ − 835 LPNMCBEDRAGBEGIN
+ − 836 PNMCBEDRAGBEGIN
+ − 837 NMCBEENDEDIT
+ − 838 LPNMCBEENDEDIT
+ − 839 PNMCBEENDEDIT
+ − 840 WC_TABCONTROL
+ − 841 TCITEMHEADER
+ − 842 LPTCITEMHEADER
+ − 843 TCITEM
+ − 844 LPTCITEM
+ − 845 TCM_GETITEM
+ − 846 TCM_SETITEM
+ − 847 TCM_INSERTITEM
+ − 848 ANIMATE_CLASS
+ − 849 ACM_OPEN
+ − 850 MONTHCAL_CLASS
+ − 851 DATETIMEPICK_CLASS
+ − 852 DTM_SETFORMAT
+ − 853 DTN_USERSTRING
+ − 854 NMDATETIMESTRING
+ − 855 LPNMDATETIMESTRING
+ − 856 DTN_WMKEYDOWN
+ − 857 NMDATETIMEWMKEYDOWN
+ − 858 LPNMDATETIMEWMKEYDOWN
+ − 859 DTN_FORMAT
+ − 860 NMDATETIMEFORMAT
+ − 861 LPNMDATETIMEFORMAT
+ − 862 DTN_FORMATQUERY
+ − 863 NMDATETIMEFORMATQUERY
+ − 864 LPNMDATETIMEFORMATQUERY
+ − 865 WC_IPADDRESS
+ − 866 WC_PAGESCROLLER
+ − 867 WC_NATIVEFONTCTL
+ − 868
+ − 869 begin-unicode-encapsulation-script
+ − 870
+ − 871 file COMMDLG.H
+ − 872
+ − 873 split GetOpenFileName LPOPENFILENAME
+ − 874 split GetSaveFileName LPOPENFILENAME
+ − 875 yes GetFileTitle
+ − 876 no CommDlg_OpenSave_GetSpec macro
+ − 877 no CommDlg_OpenSave_GetFilePath macro
+ − 878 no CommDlg_OpenSave_GetFolderPath macro
+ − 879 split ChooseColor LPCHOOSECOLOR
+ − 880 split FindText LPFINDREPLACE
+ − 881 split ReplaceText LPFINDREPLACE
+ − 882 no AfxReplaceText mac only
+ − 883 no ChooseFont split-sized LPLOGFONT in LPCHOOSEFONT
+ − 884 // LBSELCHSTRING
+ − 885 // SHAREVISTRING
+ − 886 // FILEOKSTRING
+ − 887 // COLOROKSTRING
+ − 888 // SETRGBSTRING
+ − 889 // HELPMSGSTRING
+ − 890 // FINDMSGSTRING
+ − 891 skip PrintDlg LPPRINTDLG with split-sized DEVMODE handle
+ − 892 skip PageSetupDlg LPPAGESETUPDLG with split-sized DEVMODE handle
+ − 893
+ − 894 file DDE.H
+ − 895
+ − 896 // nothing
+ − 897
+ − 898 file DDEML.H
+ − 899
+ − 900 yes DdeInitialize
1111
+ − 901 skip DdeCreateStringHandle error in Cygwin prototype
771
+ − 902 yes DdeQueryString
+ − 903 // #### split-sized (or split-simple??? not completely obvious) structure MONHSZSTRUCT, used when DDE event MF_HSZ_INFO is sent as part of the XTYP_MONITOR transaction sent to a DDE callback; not yet handled
+ − 904
+ − 905 file IMM.H
+ − 906
+ − 907 begin-bracket defined (HAVE_MS_WINDOWS)
+ − 908 yes ImmInstallIME
+ − 909 yes ImmGetDescription
+ − 910 yes ImmGetIMEFileName
+ − 911 yes ImmGetCompositionString
+ − 912 yes ImmSetCompositionString
+ − 913 yes ImmGetCandidateListCount
+ − 914 yes ImmGetCandidateList
+ − 915 yes ImmGetGuideLine
+ − 916 skip ImmGetCompositionFont split-sized LOGFONT
+ − 917 skip ImmSetCompositionFont split-sized LOGFONT
+ − 918 yes ImmConfigureIME // split-simple REGISTERWORD
+ − 919 yes ImmEscape // strings of various sorts
+ − 920 yes ImmGetConversionList
+ − 921 yes ImmIsUIMessage
+ − 922 yes ImmRegisterWord
+ − 923 yes ImmUnregisterWord
+ − 924 no ImmGetRegisterWordStyle split-sized STYLEBUF
+ − 925 split ImmEnumRegisterWord REGISTERWORDENUMPROC
+ − 926 no ImmGetImeMenuItems split-sized IMEMENUITEMINFO
+ − 927 end-bracket
+ − 928
+ − 929 file MMSYSTEM.H
+ − 930
+ − 931 yes sndPlaySound
+ − 932 yes PlaySound
+ − 933 no waveOutGetDevCaps split-sized LPWAVEOUTCAPS
+ − 934 yes waveOutGetErrorText
+ − 935 no waveInGetDevCaps split-sized LPWAVEINCAPS
+ − 936 yes waveInGetErrorText
+ − 937 no midiOutGetDevCaps split-sized LPMIDIOUTCAPS
+ − 938 yes midiOutGetErrorText
+ − 939 no midiInGetDevCaps split-sized LPMIDIOUTCAPS
+ − 940 yes midiInGetErrorText
+ − 941 no auxGetDevCaps split-sized LPAUXCAPS
+ − 942 no mixerGetDevCaps split-sized LPMIXERCAPS
+ − 943 no mixerGetLineInfo split-sized LPMIXERLINE
+ − 944 no mixerGetLineControls split-sized LPMIXERCONTROL
+ − 945 no mixerGetControlDetails split-sized LPMIXERCONTROL in LPMIXERLINECONTROLS in LPMIXERCONTROLDETAILS
+ − 946 no joyGetDevCaps split-sized LPJOYCAPS
+ − 947 yes mmioStringToFOURCC
+ − 948 yes mmioInstallIOProc
+ − 949 yes mmioOpen
+ − 950 yes mmioRename
+ − 951 yes mciSendCommand
+ − 952 yes mciSendString
+ − 953 yes mciGetDeviceID
+ − 954 begin-bracket !defined (MINGW)
778
+ − 955 no mciGetDeviceIDFromElementID missing from Win98se version of ADVAPI32.dll
771
+ − 956 end-bracket
+ − 957 yes mciGetErrorString
+ − 958
+ − 959 file WINNETWK.H
+ − 960
+ − 961 begin-bracket defined (HAVE_MS_WINDOWS)
+ − 962 yes WNetAddConnection
+ − 963 split WNetAddConnection2 LPNETRESOURCE
+ − 964 split WNetAddConnection3 LPNETRESOURCE
+ − 965 yes WNetCancelConnection
+ − 966 yes WNetCancelConnection2
+ − 967 yes WNetGetConnection
+ − 968 split WNetUseConnection LPNETRESOURCE
+ − 969 split WNetConnectionDialog1 LPCONNECTDLGSTRUCT contains split-simple LPNETRESOURCE
+ − 970 split WNetDisconnectDialog1 LPDISCDLGSTRUCT
+ − 971 split WNetOpenEnum LPNETRESOURCE
+ − 972 yes WNetEnumResource
+ − 973 yes WNetGetUniversalName
+ − 974 yes WNetGetUser
+ − 975 yes WNetGetProviderName
+ − 976 yes WNetGetNetworkInformation
+ − 977 // split-simple function pointer PFNGETPROFILEPATH
+ − 978 // split-simple function pointer PFNRECONCILEPROFILE
+ − 979 // split-simple function pointer PFNPROCESSPOLICIES
+ − 980 yes WNetGetLastError
+ − 981 split MultinetGetConnectionPerformance LPNETRESOURCE
+ − 982 end-bracket
+ − 983
+ − 984 file IME.H
+ − 985
+ − 986 no SendIMEMessageEx obsolete, no docs available
+ − 987
+ − 988 file OBJBASE.H
+ − 989
+ − 990 // nothing
+ − 991
+ − 992 file SHLOBJ.H
+ − 993
+ − 994 // #### split code for IContextMenu not yet written
+ − 995 // split flag constant GCS_VERB of IContextMenu::GetCommandString
+ − 996 // split flag constant GCS_HELPTEXT of IContextMenu::GetCommandString
+ − 997 // split flag constant GCS_VALIDATE of IContextMenu::GetCommandString
+ − 998 // split string constant CMDSTR_NEWFOLDER of CMINVOKECOMMANDINFO.lpVerb or CMINVOKECOMMANDINFOEX.lpVerbW of IContextMenu::InvokeCommand
+ − 999 // split string constant CMDSTR_VIEWLIST of same
+ − 1000 // split string constant CMDSTR_VIEWDETAILS of same
+ − 1001 // #### split code for IExtractIcon, IShellLink, IShellExecuteHook, INewShortcutHook, ICopyHook, IFileViewer not yet written
+ − 1002 // split interface IExtractIcon
+ − 1003 // split interface IShellLink
+ − 1004 // split interface IShellExecuteHook
+ − 1005 // split interface INewShortcutHook
+ − 1006 // split interface ICopyHook
+ − 1007 // split interface IFileViewer
+ − 1008 yes SHGetPathFromIDList
+ − 1009 skip SHGetSpecialFolderPath error in Cygwin prototype, missing from Cygwin libraries
+ − 1010 // split-simple structure BROWSEINFO used in SHBrowseForFolder
+ − 1011 skip SHBrowseForFolder need to intercept callback for SendMessage
+ − 1012 // split message BFFM_SETSTATUSTEXT handled in qxeSendMessage
+ − 1013 // split message BFFM_SETSELECTION handled in qxeSendMessage
+ − 1014 // split message BFFM_VALIDATEFAILED handled in qxeSHBrowseForFolder intercept proc
+ − 1015 // #### code to handle split clipboard formats not yet written. this will
+ − 1016 // #### be tricky -- all functions that use such clipboard formats need to
+ − 1017 // #### be split, and the data itself munged. this may be too much effort,
+ − 1018 // #### and we may just need to require that the app itself does the
+ − 1019 // #### splitting.
+ − 1020 // split clipboard format CFSTR_FILEDESCRIPTOR
+ − 1021 // split clipboard format CFSTR_FILENAME
+ − 1022 // split clipboard format CFSTR_FILENAMEMAP
+ − 1023 // split-sized structure FILEDESCRIPTOR
+ − 1024 // split-sized structure FILEGROUPDESCRIPTOR
+ − 1025 // split flag SHCNF_PATH; we intercept SHChangeNotify
+ − 1026 // split flag SHCNF_PRINTER; we intercept SHChangeNotify
+ − 1027 // split flag SHARD_PATH; we intercept SHAddToRecentDocs
+ − 1028 skip SHGetDataFromIDList split-sized WIN32_FIND_DATA or split-simple NETRESOURCE, missing from Cygwin libraries
+ − 1029
+ − 1030 file WINNLS.H
+ − 1031
798
+ − 1032 no LOCALE_ENUMPROC not used, not examined yet
+ − 1033 no CODEPAGE_ENUMPROC not used, not examined yet
+ − 1034 no DATEFMT_ENUMPROC not used, not examined yet
+ − 1035 no DATEFMT_ENUMPROCEX not used, not examined yet
+ − 1036 no TIMEFMT_ENUMPROC not used, not examined yet
+ − 1037 no CALINFO_ENUMPROC not used, not examined yet
+ − 1038 no CALINFO_ENUMPROCEX not used, not examined yet
+ − 1039 no GetCPInfoEx not used, not examined yet
+ − 1040 no CompareString not used, not examined yet
+ − 1041 no LCMapString not used, not examined yet
+ − 1042 yes GetLocaleInfo
+ − 1043 yes SetLocaleInfo
+ − 1044 no GetTimeFormat not used, not examined yet
+ − 1045 no GetDateFormat not used, not examined yet
+ − 1046 no GetNumberFormat not used, not examined yet
+ − 1047 no GetCurrencyFormat not used, not examined yet
+ − 1048 no EnumCalendarInfo not used, not examined yet
+ − 1049 no EnumCalendarInfoEx not used, not examined yet
+ − 1050 no EnumTimeFormats not used, not examined yet
+ − 1051 no EnumDateFormats not used, not examined yet
+ − 1052 no EnumDateFormatsEx not used, not examined yet
+ − 1053 no GetStringTypeEx not used, not examined yet
800
+ − 1054 no GetStringType no such fun; A and W versions have different nos. of args
798
+ − 1055 no FoldString not used, not examined yet
+ − 1056 no EnumSystemLocales not used, not examined yet
+ − 1057 no EnumSystemCodePages not used, not examined yet
+ − 1058
+ − 1059 end-unicode-encapsulation-script
771
+ − 1060
+ − 1061 file WINVER.H
+ − 1062
+ − 1063 VerFindFile
+ − 1064 VerInstallFile
+ − 1065 GetFileVersionInfoSize
+ − 1066 GetFileVersionInfo
+ − 1067 VerLanguageName
+ − 1068 VerQueryValue
+ − 1069
+ − 1070 begin-unicode-encapsulation-script
+ − 1071
+ − 1072 file WINCON.H
+ − 1073
+ − 1074 yes PeekConsoleInput
+ − 1075 yes ReadConsoleInput
+ − 1076 yes WriteConsoleInput
+ − 1077 yes ReadConsoleOutput
+ − 1078 yes WriteConsoleOutput
+ − 1079 yes ReadConsoleOutputCharacter
+ − 1080 yes WriteConsoleOutputCharacter
+ − 1081 no FillConsoleOutputCharacter split CHAR
+ − 1082 yes ScrollConsoleScreenBuffer
+ − 1083 yes GetConsoleTitle
+ − 1084 yes SetConsoleTitle
+ − 1085 yes ReadConsole
+ − 1086 yes WriteConsole
+ − 1087
+ − 1088 file WINREG.H
+ − 1089
+ − 1090 skip RegConnectRegistry error in Cygwin prototype
+ − 1091 yes RegCreateKey
+ − 1092 yes RegCreateKeyEx
+ − 1093 yes RegDeleteKey
+ − 1094 yes RegDeleteValue
+ − 1095 yes RegEnumKey
+ − 1096 yes RegEnumKeyEx
+ − 1097 yes RegEnumValue
+ − 1098 yes RegLoadKey
+ − 1099 yes RegOpenKey
+ − 1100 yes RegOpenKeyEx
+ − 1101 yes RegQueryInfoKey
+ − 1102 yes RegQueryValue
+ − 1103 split RegQueryMultipleValues PVALENT
+ − 1104 yes RegQueryValueEx
+ − 1105 yes RegReplaceKey
+ − 1106 yes RegRestoreKey
+ − 1107 yes RegSaveKey
+ − 1108 yes RegSetValue
+ − 1109 yes RegSetValueEx
+ − 1110 yes RegUnLoadKey
+ − 1111 yes InitiateSystemShutdown
+ − 1112 yes AbortSystemShutdown
+ − 1113
+ − 1114 file EXCPT.H
+ − 1115
+ − 1116 // nothing
+ − 1117
+ − 1118 file STDARG.H
+ − 1119
+ − 1120 // nothing
+ − 1121
+ − 1122 file CDERR.H
+ − 1123
+ − 1124 // nothing
+ − 1125
+ − 1126 file WINPERF.H
+ − 1127
+ − 1128 // nothing
+ − 1129
+ − 1130 file RPC.H
+ − 1131
+ − 1132 // nothing
+ − 1133
+ − 1134 file NB30.H
+ − 1135
+ − 1136 // nothing
+ − 1137
800
+ − 1138 end-unicode-encapsulation-script
+ − 1139
771
+ − 1140 file WINSOCK2.H
+ − 1141
+ − 1142 SO_PROTOCOL_INFO
+ − 1143 SERVICE_TYPE_VALUE_SAPID
+ − 1144 SERVICE_TYPE_VALUE_TCPPORT
+ − 1145 SERVICE_TYPE_VALUE_UDPPORT
+ − 1146 SERVICE_TYPE_VALUE_OBJECTID
+ − 1147 WSADuplicateSocket
+ − 1148 LPFN_WSADUPLICATESOCKET
+ − 1149 WSAEnumProtocols
+ − 1150 LPFN_WSAENUMPROTOCOLS
+ − 1151 WSASocket
+ − 1152 LPFN_WSASOCKET
+ − 1153 WSAAddressToString
+ − 1154 LPFN_WSAADDRESSTOSTRING
+ − 1155 WSAStringToAddress
+ − 1156 LPFN_WSASTRINGTOADDRESS
+ − 1157 WSALookupServiceBegin
+ − 1158 LPFN_WSALOOKUPSERVICEBEGIN
+ − 1159 WSALookupServiceNext
+ − 1160 LPFN_WSALOOKUPSERVICENEXT
+ − 1161 WSAInstallServiceClass
+ − 1162 LPFN_WSAINSTALLSERVICECLASS
+ − 1163 WSAGetServiceClassInfo
+ − 1164 LPFN_WSAGETSERVICECLASSINFO
+ − 1165 WSAEnumNameSpaceProviders
+ − 1166 LPFN_WSAENUMNAMESPACEPROVIDERS
+ − 1167 WSAGetServiceClassNameByClassId
+ − 1168 LPFN_WSAGETSERVICECLASSNAMEBYCLASSID
+ − 1169 WSASetService
+ − 1170 LPFN_WSASETSERVICE
+ − 1171
+ − 1172 file WINCRYPT.H
+ − 1173
+ − 1174 MS_DEF_PROV_
+ − 1175 MS_ENHANCED_PROV_
+ − 1176 MS_DEF_RSA_SIG_PROV_
+ − 1177 MS_DEF_RSA_SCHANNEL_PROV_
+ − 1178 MS_ENHANCED_RSA_SCHANNEL_PROV_
+ − 1179 MS_DEF_DSS_PROV_
+ − 1180 MS_DEF_DSS_DH_PROV_
+ − 1181 CryptAcquireContext
+ − 1182 CryptSignHash
+ − 1183 CryptVerifySignature
+ − 1184 CryptSetProvider
+ − 1185 CryptSetProviderEx
+ − 1186 CryptGetDefaultProvider
+ − 1187 CryptEnumProviderTypes
+ − 1188 CryptEnumProviders
+ − 1189 CERT_STORE_PROV_FILENAME_
+ − 1190 CERT_STORE_PROV_SYSTEM_
+ − 1191 sz_CERT_STORE_PROV_FILENAME_
+ − 1192 sz_CERT_STORE_PROV_SYSTEM_
+ − 1193 CERT_STORE_SAVE_TO_FILENAME_
+ − 1194 CERT_FIND_SUBJECT_STR_
+ − 1195 CERT_FIND_ISSUER_STR_
+ − 1196 CertRDNValueToStr
+ − 1197 CertNameToStr
+ − 1198 CertStrToName
+ − 1199 CertOpenSystemStore
+ − 1200 CertAddEncodedCertificateToSystemStore
+ − 1201
+ − 1202 */
+ − 1203
+ − 1204 /* the functions below are examples of hand-written Unicode-splitting
+ − 1205 code. note that it needs to be written very carefully and with
+ − 1206 intimate knowledge of the structures involved, and can sometimes be
+ − 1207 very hairy (EnumFontFamiliesEx is the most extreme example). it can
+ − 1208 be argued with some justification that this behind-the-scenes magic
+ − 1209 is confusing and potentially dangerous, and shouldn't be done. but
+ − 1210 making the calling code deal with the results in extremely hard-to-
+ − 1211 read code and is very error-prone. */
+ − 1212
+ − 1213
+ − 1214 /************************************************************************/
+ − 1215 /* would be encapsulatable but for parsing problems */
+ − 1216 /************************************************************************/
+ − 1217
+ − 1218 /* NOTE: return value is conditionalized on _MAC, messes up parser */
+ − 1219 LRESULT
+ − 1220 qxeDefWindowProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+ − 1221 {
+ − 1222 if (XEUNICODE_P)
+ − 1223 return DefWindowProcW (hWnd, Msg, wParam, lParam);
+ − 1224 else
+ − 1225 return DefWindowProcA (hWnd, Msg, wParam, lParam);
+ − 1226 }
+ − 1227
+ − 1228
+ − 1229 /* NOTE: two versions, STRICT and non-STRICT */
+ − 1230 LRESULT
+ − 1231 qxeCallWindowProc (WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+ − 1232 {
+ − 1233 if (XEUNICODE_P)
+ − 1234 return CallWindowProcW (lpPrevWndFunc, hWnd, Msg, wParam, lParam);
+ − 1235 else
+ − 1236 return CallWindowProcA (lpPrevWndFunc, hWnd, Msg, wParam, lParam);
+ − 1237 }
+ − 1238
+ − 1239 /* NOTE: return value is conditionalized on _MAC, messes up parser */
+ − 1240 LRESULT
+ − 1241 qxeDefDlgProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
+ − 1242 {
+ − 1243 if (XEUNICODE_P)
+ − 1244 return DefDlgProcW (hDlg, Msg, wParam, lParam);
+ − 1245 else
+ − 1246 return DefDlgProcA (hDlg, Msg, wParam, lParam);
+ − 1247 }
+ − 1248
+ − 1249 /* NOTE: return value is conditionalized on _MAC, messes up parser */
+ − 1250 LRESULT
+ − 1251 qxeDefMDIChildProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+ − 1252 {
+ − 1253 if (XEUNICODE_P)
+ − 1254 return DefMDIChildProcW (hWnd, uMsg, wParam, lParam);
+ − 1255 else
+ − 1256 return DefMDIChildProcA (hWnd, uMsg, wParam, lParam);
+ − 1257 }
+ − 1258
800
+ − 1259 /* This one has two entry points called GetEnvironmentStringsW and
+ − 1260 GetEnvironmentStrings. (misnamed A version) */
+ − 1261 Extbyte *
+ − 1262 qxeGetEnvironmentStrings (void)
+ − 1263 {
+ − 1264 if (XEUNICODE_P)
+ − 1265 return (Extbyte *) GetEnvironmentStringsW ();
+ − 1266 else
+ − 1267 return (Extbyte *) GetEnvironmentStrings ();
+ − 1268 }
+ − 1269
771
+ − 1270
+ − 1271 /************************************************************************/
+ − 1272 /* would be encapsulatable but for Cygwin problems */
+ − 1273 /************************************************************************/
+ − 1274
+ − 1275 LONG
+ − 1276 qxeRegConnectRegistry (const Extbyte * lpMachineName, HKEY hKey, PHKEY phkResult)
+ − 1277 {
+ − 1278 /* Cygwin mistakenly omits const in first argument. */
+ − 1279 if (XEUNICODE_P)
+ − 1280 return RegConnectRegistryW ((LPWSTR) lpMachineName, hKey, phkResult);
+ − 1281 else
+ − 1282 return RegConnectRegistryA ((LPSTR) lpMachineName, hKey, phkResult);
+ − 1283 }
+ − 1284
1111
+ − 1285 HSZ
+ − 1286 qxeDdeCreateStringHandle (DWORD idInst, const Extbyte * psz, int iCodePage)
+ − 1287 {
+ − 1288 /* Cygwin mistakenly omits const in second argument. */
+ − 1289 if (XEUNICODE_P)
+ − 1290 return DdeCreateStringHandleW (idInst, (LPWSTR) psz, iCodePage);
+ − 1291 else
+ − 1292 return DdeCreateStringHandleA (idInst, (LPSTR) psz, iCodePage);
+ − 1293 }
+ − 1294
771
+ − 1295 /* NOTE: NT 4.0+ only */
+ − 1296 UINT
+ − 1297 qxeExtractIconEx (const Extbyte * lpszFile, int nIconIndex, HICON FAR * phiconLarge, HICON FAR * phiconSmall, UINT nIcons)
+ − 1298 {
+ − 1299 /* Cygwin mistakenly declares the return type as HICON. */
+ − 1300 if (XEUNICODE_P)
+ − 1301 return (UINT) ExtractIconExW ((LPCWSTR) lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
+ − 1302 else
+ − 1303 return (UINT) ExtractIconExA ((LPCSTR) lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
+ − 1304 }
+ − 1305
+ − 1306 /* NOTE: NT 4.0+ only */
+ − 1307 BOOL
+ − 1308 qxeGetICMProfile (HDC arg1, LPDWORD arg2, Extbyte * arg3)
+ − 1309 {
+ − 1310 #ifdef CYGWIN_HEADERS
+ − 1311 /* Cygwin mistakenly declares the second argument as DWORD. */
+ − 1312 if (XEUNICODE_P)
+ − 1313 return GetICMProfileW (arg1, (DWORD) arg2, (LPWSTR) arg3);
+ − 1314 else
+ − 1315 return GetICMProfileA (arg1, (DWORD) arg2, (LPSTR) arg3);
+ − 1316 #else
+ − 1317 if (XEUNICODE_P)
+ − 1318 return GetICMProfileW (arg1, arg2, (LPWSTR) arg3);
+ − 1319 else
+ − 1320 return GetICMProfileA (arg1, arg2, (LPSTR) arg3);
+ − 1321 #endif /* CYGWIN_HEADERS */
+ − 1322 }
+ − 1323
+ − 1324 /* NOTE: NT 4.0+ only */
+ − 1325 BOOL
+ − 1326 qxeUpdateICMRegKey (DWORD arg1, Extbyte * arg2, Extbyte * arg3, UINT arg4)
+ − 1327 {
+ − 1328 #ifdef CYGWIN_HEADERS
+ − 1329 /* Cygwin mistakenly declares the second argument as DWORD. */
+ − 1330 if (XEUNICODE_P)
+ − 1331 return UpdateICMRegKeyW (arg1, (DWORD) arg2, (LPWSTR) arg3, arg4);
+ − 1332 else
+ − 1333 return UpdateICMRegKeyA (arg1, (DWORD) arg2, (LPSTR) arg3, arg4);
+ − 1334 #else
+ − 1335 if (XEUNICODE_P)
+ − 1336 return UpdateICMRegKeyW (arg1, (LPWSTR) arg2, (LPWSTR) arg3, arg4);
+ − 1337 else
+ − 1338 return UpdateICMRegKeyA (arg1, (LPSTR) arg2, (LPSTR) arg3, arg4);
+ − 1339 #endif /* CYGWIN_HEADERS */
+ − 1340 }
+ − 1341
+ − 1342 #ifndef CYGWIN /* present in headers but missing in shell32.a */
+ − 1343
+ − 1344 BOOL
+ − 1345 qxeSHGetSpecialFolderPath (HWND hwndOwner, Extbyte * lpszPath, int nFolder, BOOL fCreate)
+ − 1346 {
+ − 1347 #ifdef CYGWIN_HEADERS
+ − 1348 /* Cygwin mistakenly declares the second argument as LPSTR in both
+ − 1349 versions. */
+ − 1350 if (XEUNICODE_P)
+ − 1351 return SHGetSpecialFolderPathW (hwndOwner, (LPSTR) lpszPath, nFolder, fCreate);
+ − 1352 else
+ − 1353 return SHGetSpecialFolderPathA (hwndOwner, (LPSTR) lpszPath, nFolder, fCreate);
+ − 1354 #else
+ − 1355 if (XEUNICODE_P)
+ − 1356 return SHGetSpecialFolderPathW (hwndOwner, (LPWSTR) lpszPath, nFolder, fCreate);
+ − 1357 else
+ − 1358 return SHGetSpecialFolderPathA (hwndOwner, (LPSTR) lpszPath, nFolder, fCreate);
+ − 1359 #endif
+ − 1360 }
+ − 1361
+ − 1362 #endif /* not CYGWIN */
+ − 1363
+ − 1364
+ − 1365 /************************************************************************/
+ − 1366 /* files */
+ − 1367 /************************************************************************/
+ − 1368
+ − 1369 static void
+ − 1370 copy_win32_find_dataa_to_win32_find_dataw (const WIN32_FIND_DATAA *pa,
+ − 1371 WIN32_FIND_DATAW *pw)
+ − 1372 {
+ − 1373 /* the layout of WIN32_FIND_DATA is
+ − 1374
+ − 1375 non-split fields;
+ − 1376 TCHAR cFileName[...];
+ − 1377 TCHAR cAlternateFileName[...];
+ − 1378 */
+ − 1379
+ − 1380 xzero (*pw);
+ − 1381 memcpy (pw, pa, offsetof (WIN32_FIND_DATAA, cFileName));
+ − 1382 memcpy (pw->cFileName, pa->cFileName, sizeof (pa->cFileName));
+ − 1383 memcpy (pw->cAlternateFileName, pa->cAlternateFileName,
+ − 1384 sizeof (pa->cAlternateFileName));
+ − 1385 }
+ − 1386
+ − 1387 HANDLE
+ − 1388 qxeFindFirstFile (const Extbyte *lpFileName,
+ − 1389 WIN32_FIND_DATAW *lpFindFileData)
+ − 1390 {
+ − 1391 if (XEUNICODE_P)
+ − 1392 return FindFirstFileW ((LPCWSTR) lpFileName, lpFindFileData);
+ − 1393 else
+ − 1394 {
+ − 1395 WIN32_FIND_DATAA ansidat;
+ − 1396 HANDLE retval;
+ − 1397
+ − 1398 retval = FindFirstFileA ((LPCSTR) lpFileName, &ansidat);
+ − 1399 if (retval != INVALID_HANDLE_VALUE)
+ − 1400 copy_win32_find_dataa_to_win32_find_dataw (&ansidat, lpFindFileData);
+ − 1401 return retval;
+ − 1402 }
+ − 1403 }
+ − 1404
+ − 1405 BOOL
+ − 1406 qxeFindNextFile (HANDLE hFindFile, WIN32_FIND_DATAW *lpFindFileData)
+ − 1407 {
+ − 1408 if (XEUNICODE_P)
+ − 1409 return FindNextFileW (hFindFile, lpFindFileData);
+ − 1410 else
+ − 1411 {
+ − 1412 WIN32_FIND_DATAA ansidat;
+ − 1413 BOOL retval;
+ − 1414
+ − 1415 retval = FindNextFileA (hFindFile, &ansidat);
+ − 1416 if (retval)
+ − 1417 copy_win32_find_dataa_to_win32_find_dataw (&ansidat, lpFindFileData);
+ − 1418 return retval;
+ − 1419 }
+ − 1420 }
+ − 1421
+ − 1422
+ − 1423 /************************************************************************/
+ − 1424 /* shell */
+ − 1425 /************************************************************************/
+ − 1426
+ − 1427 static void
+ − 1428 copy_shfileinfoa_to_shfileinfow (const SHFILEINFOA *pa,
778
+ − 1429 SHFILEINFOW *pw, UINT sz)
771
+ − 1430 {
+ − 1431 /* the layout of SHFILEINFO is
+ − 1432
+ − 1433 non-split fields;
+ − 1434 TCHAR szDisplayName[...];
+ − 1435 TCHAR szTypeName[...];
+ − 1436 */
+ − 1437
778
+ − 1438 assert (sz >= sizeof (SHFILEINFOW));
771
+ − 1439 xzero (*pw);
+ − 1440 memcpy (pw, pa, offsetof (SHFILEINFOA, szDisplayName));
+ − 1441 memcpy (pw->szDisplayName, pa->szDisplayName, sizeof (pa->szDisplayName));
+ − 1442 memcpy (pw->szTypeName, pa->szTypeName, sizeof (pa->szTypeName));
+ − 1443 }
+ − 1444
+ − 1445 DWORD
+ − 1446 qxeSHGetFileInfo (const Extbyte *pszPath, DWORD dwFileAttributes,
+ − 1447 SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags)
+ − 1448 {
+ − 1449 if (XEUNICODE_P)
+ − 1450 return SHGetFileInfoW ((LPCWSTR) pszPath, dwFileAttributes,
+ − 1451 psfi, cbFileInfo, uFlags);
+ − 1452 else
+ − 1453 {
+ − 1454 SHFILEINFOA ansidat;
+ − 1455 BOOL retval;
+ − 1456
+ − 1457 retval = SHGetFileInfoA ((LPCSTR) pszPath, dwFileAttributes,
778
+ − 1458 (SHFILEINFOA FAR *) &ansidat,
+ − 1459 cbFileInfo ? sizeof (ansidat) : 0, uFlags);
+ − 1460 if (retval && cbFileInfo)
+ − 1461 copy_shfileinfoa_to_shfileinfow (&ansidat, psfi, cbFileInfo);
771
+ − 1462 return retval;
+ − 1463 }
+ − 1464 }
+ − 1465
+ − 1466 struct intercepted_SHBrowseForFolder
+ − 1467 {
+ − 1468 BFFCALLBACK lpfn;
+ − 1469 LPARAM lParam;
+ − 1470 HWND hwnd;
+ − 1471 struct intercepted_SHBrowseForFolder *next;
+ − 1472 };
+ − 1473
+ − 1474 static struct intercepted_SHBrowseForFolder *SHBrowseForFolder_list;
+ − 1475
+ − 1476 static int
+ − 1477 CALLBACK intercepted_SHBrowseForFolder_proc (HWND hwnd, UINT msg,
+ − 1478 LPARAM lParam, LPARAM lpData)
+ − 1479 {
+ − 1480 struct intercepted_SHBrowseForFolder *s =
+ − 1481 (struct intercepted_SHBrowseForFolder *) lpData;
+ − 1482
+ − 1483 if (s->hwnd == 0)
+ − 1484 s->hwnd = hwnd;
+ − 1485 if (s->lpfn)
+ − 1486 {
+ − 1487 /* see below */
+ − 1488 if (XEUNICODE_P && msg == BFFM_VALIDATEFAILEDW)
+ − 1489 msg = BFFM_VALIDATEFAILEDA;
+ − 1490 else if (!XEUNICODE_P && msg == BFFM_VALIDATEFAILEDA)
+ − 1491 msg = BFFM_VALIDATEFAILEDW;
+ − 1492 return (s->lpfn) (hwnd, msg, lParam, s->lParam);
+ − 1493 }
+ − 1494 else
+ − 1495 return 0;
+ − 1496 }
+ − 1497
1204
+ − 1498 #ifdef HAVE_MS_WINDOWS
+ − 1499
771
+ − 1500 static int
+ − 1501 is_SHBrowseForFolder (HWND hwnd)
+ − 1502 {
+ − 1503 struct intercepted_SHBrowseForFolder *s;
+ − 1504
+ − 1505 for (s = SHBrowseForFolder_list; s; s = s->next)
+ − 1506 if (s->hwnd == hwnd)
+ − 1507 return 1;
+ − 1508 return 0;
+ − 1509 }
+ − 1510
1204
+ − 1511 #endif /* HAVE_MS_WINDOWS */
+ − 1512
771
+ − 1513 LPITEMIDLIST
+ − 1514 qxeSHBrowseForFolder (LPBROWSEINFOW lpbi)
+ − 1515 {
+ − 1516 struct intercepted_SHBrowseForFolder s;
+ − 1517 LPITEMIDLIST retval;
+ − 1518
+ − 1519 /* There are two outgoing Unicode-split messages:
+ − 1520
+ − 1521 BFFM_SETSELECTION
+ − 1522 BFFM_SETSTATUSTEXT
+ − 1523
+ − 1524 and one incoming:
+ − 1525
+ − 1526 BFFM_VALIDATEFAILED
+ − 1527
+ − 1528 To handle this, we need to intercept the callback. We handle the
+ − 1529 incoming message in the callback, and record the window; when
+ − 1530 qxeSendMessage() is called, we handle the outgoing messages. None of
+ − 1531 the messages have split-sized structures so we don't need to do
+ − 1532 anything complicated there. */
+ − 1533
+ − 1534 s.lParam = lpbi->lParam;
+ − 1535 s.lpfn = lpbi->lpfn;
+ − 1536 s.next = SHBrowseForFolder_list;
+ − 1537 s.hwnd = 0;
+ − 1538 SHBrowseForFolder_list = &s;
+ − 1539
+ − 1540 lpbi->lpfn = intercepted_SHBrowseForFolder_proc;
+ − 1541 lpbi->lParam = (LPARAM) &s;
+ − 1542
+ − 1543 if (XEUNICODE_P)
+ − 1544 retval = SHBrowseForFolderW (lpbi);
+ − 1545 else
+ − 1546 retval = SHBrowseForFolderA ((LPBROWSEINFOA) lpbi);
+ − 1547 SHBrowseForFolder_list = SHBrowseForFolder_list->next;
+ − 1548 return retval;
+ − 1549 }
+ − 1550
+ − 1551 VOID
+ − 1552 qxeSHAddToRecentDocs (UINT uFlags, LPCVOID pv)
+ − 1553 {
+ − 1554 /* pv can be a string pointer; this is handled by Unicode-splitting the
+ − 1555 flag SHARD_PATH rather than the function itself. Fix up the flag to
+ − 1556 be correct. We write it symmetrically so it doesn't matter whether
+ − 1557 UNICODE is defined. */
+ − 1558 if (XEUNICODE_P)
+ − 1559 {
+ − 1560 if (uFlags & SHARD_PATHA)
+ − 1561 {
+ − 1562 uFlags |= SHARD_PATHW;
+ − 1563 uFlags &= ~SHARD_PATHA;
+ − 1564 }
+ − 1565 }
+ − 1566 else
+ − 1567 {
+ − 1568 if (uFlags & SHARD_PATHW)
+ − 1569 {
+ − 1570 uFlags |= SHARD_PATHA;
+ − 1571 uFlags &= ~SHARD_PATHW;
+ − 1572 }
+ − 1573 }
+ − 1574 SHAddToRecentDocs (uFlags, pv);
+ − 1575 }
+ − 1576
+ − 1577 VOID
+ − 1578 qxeSHChangeNotify (LONG wEventId, UINT uFlags, LPCVOID dwItem1,
+ − 1579 LPCVOID dwItem2)
+ − 1580 {
+ − 1581 /* works like SHAddToRecentDocs */
+ − 1582 if (XEUNICODE_P)
+ − 1583 {
+ − 1584 if (uFlags & SHCNF_PATHA)
+ − 1585 {
+ − 1586 uFlags |= SHCNF_PATHW;
+ − 1587 uFlags &= ~SHCNF_PATHA;
+ − 1588 }
+ − 1589 if (uFlags & SHCNF_PRINTERA)
+ − 1590 {
+ − 1591 uFlags |= SHCNF_PRINTERW;
+ − 1592 uFlags &= ~SHCNF_PRINTERA;
+ − 1593 }
+ − 1594 }
+ − 1595 else
+ − 1596 {
+ − 1597 if (uFlags & SHCNF_PATHW)
+ − 1598 {
+ − 1599 uFlags |= SHCNF_PATHA;
+ − 1600 uFlags &= ~SHCNF_PATHW;
+ − 1601 }
+ − 1602 if (uFlags & SHCNF_PRINTERW)
+ − 1603 {
+ − 1604 uFlags |= SHCNF_PRINTERA;
+ − 1605 uFlags &= ~SHCNF_PRINTERW;
+ − 1606 }
+ − 1607 }
+ − 1608 SHChangeNotify (wEventId, uFlags, dwItem1, dwItem2);
+ − 1609 }
+ − 1610
+ − 1611 #ifndef CYGWIN /* present in headers but missing in shell32.a */
+ − 1612
+ − 1613 HRESULT
+ − 1614 qxeSHGetDataFromIDList (IShellFolder *psf, LPCITEMIDLIST pidl, int nFormat,
+ − 1615 PVOID pv, int cb)
+ − 1616 {
+ − 1617 if (XEUNICODE_P)
+ − 1618 return SHGetDataFromIDListW (psf, pidl, nFormat, pv, cb);
+ − 1619 else if (nFormat == SHGDFIL_FINDDATA)
+ − 1620 {
+ − 1621 WIN32_FIND_DATAA ansidat;
+ − 1622 BOOL retval;
+ − 1623
+ − 1624 retval = SHGetDataFromIDListA (psf, pidl, nFormat, &ansidat, cb);
+ − 1625 if (retval == NOERROR)
1204
+ − 1626 copy_win32_find_dataa_to_win32_find_dataw (&ansidat,
+ − 1627 (WIN32_FIND_DATAW *) pv);
771
+ − 1628 return retval;
+ − 1629 }
+ − 1630 else
+ − 1631 /* nFormat == SHGDFIL_NETRESOURCE, and pv is split-simple NETRESOURCE
+ − 1632 structure, but we don't need to worry about that currently since we
+ − 1633 don't translate strings */
+ − 1634 return SHGetDataFromIDListA (psf, pidl, nFormat, pv, cb);
+ − 1635 }
+ − 1636
+ − 1637 #endif /* not CYGWIN */
+ − 1638
+ − 1639
+ − 1640
+ − 1641 #ifdef HAVE_MS_WINDOWS
+ − 1642
+ − 1643 /************************************************************************/
+ − 1644 /* devmode */
+ − 1645 /************************************************************************/
+ − 1646
+ − 1647 /* These functions return globally allocated blocks because some
+ − 1648 callers (e.g. qxePrintDlg) want this. */
+ − 1649
+ − 1650 static HGLOBAL
+ − 1651 copy_devmodew_to_devmodea (const DEVMODEW *src, DEVMODEA *dst)
+ − 1652 {
+ − 1653 /* the layout of DEVMODE is
+ − 1654
+ − 1655 TCHAR dmDeviceName[...];
+ − 1656 non-split fields, including dmSize (size of structure; differs between
+ − 1657 Unicode and ANSI) and dmDriverExtra;
+ − 1658 TCHAR dmFormName[...];
+ − 1659 non-split fields;
+ − 1660 extra data, of size DEVMODE->dmDriverExtra
+ − 1661 */
+ − 1662 HGLOBAL hdst = NULL;
+ − 1663
+ − 1664 if (!dst)
+ − 1665 {
+ − 1666 hdst = GlobalAlloc (GHND, src->dmSize + src->dmDriverExtra -
+ − 1667 (sizeof (DEVMODEW) - sizeof (DEVMODEA)));
+ − 1668 dst = (DEVMODEA *) GlobalLock (hdst);
+ − 1669 }
+ − 1670
+ − 1671 memcpy (dst->dmDeviceName, src->dmDeviceName, sizeof (dst->dmDeviceName));
+ − 1672 memcpy ((char *) dst + sizeof (dst->dmDeviceName),
+ − 1673 (char *) src + sizeof (src->dmDeviceName),
+ − 1674 offsetof (DEVMODEA, dmFormName) - sizeof (dst->dmDeviceName));
+ − 1675 dst->dmSize -= sizeof (DEVMODEW) - sizeof (DEVMODEA);
+ − 1676 memcpy (dst->dmFormName, src->dmFormName, sizeof (dst->dmFormName));
+ − 1677 memcpy ((char *) dst + offsetof (DEVMODEA, dmFormName) +
+ − 1678 sizeof (dst->dmFormName),
+ − 1679 (char *) src + offsetof (DEVMODEW, dmFormName) +
+ − 1680 sizeof (src->dmFormName),
+ − 1681 dst->dmSize + dst->dmDriverExtra -
+ − 1682 (offsetof (DEVMODEA, dmFormName) + sizeof (dst->dmFormName)));
+ − 1683
+ − 1684 if (hdst)
+ − 1685 GlobalUnlock (hdst);
+ − 1686 return hdst;
+ − 1687 }
+ − 1688
+ − 1689 static HGLOBAL
+ − 1690 copy_devmodea_to_devmodew (const DEVMODEA *src, DEVMODEW *dst)
+ − 1691 {
+ − 1692 HGLOBAL hdst = NULL;
+ − 1693
+ − 1694 if (!dst)
+ − 1695 {
+ − 1696 hdst = GlobalAlloc (GHND, src->dmSize + src->dmDriverExtra +
+ − 1697 (sizeof (DEVMODEW) - sizeof (DEVMODEA)));
+ − 1698 dst = (DEVMODEW *) GlobalLock (hdst);
+ − 1699 }
+ − 1700
+ − 1701 memcpy (dst->dmDeviceName, src->dmDeviceName, sizeof (src->dmDeviceName));
+ − 1702 memcpy ((char *) dst + sizeof (dst->dmDeviceName),
+ − 1703 (char *) src + sizeof (src->dmDeviceName),
+ − 1704 offsetof (DEVMODEA, dmFormName) - sizeof (src->dmDeviceName));
+ − 1705 dst->dmSize += sizeof (DEVMODEW) - sizeof (DEVMODEA);
+ − 1706 memcpy (dst->dmFormName, src->dmFormName, sizeof (src->dmFormName));
+ − 1707 memcpy ((char *) dst + offsetof (DEVMODEW, dmFormName) +
+ − 1708 sizeof (dst->dmFormName),
+ − 1709 (char *) src + offsetof (DEVMODEA, dmFormName) +
+ − 1710 sizeof (src->dmFormName),
+ − 1711 src->dmSize + src->dmDriverExtra -
+ − 1712 (offsetof (DEVMODEA, dmFormName) + sizeof (src->dmFormName)));
+ − 1713
+ − 1714 if (hdst)
+ − 1715 GlobalUnlock (hdst);
+ − 1716 return hdst;
+ − 1717 }
+ − 1718
+ − 1719 HDC
+ − 1720 qxeCreateDC (const Extbyte *lpszDriver, const Extbyte *lpszDevice,
+ − 1721 const Extbyte *lpszOutput, CONST DEVMODEW *lpInitData)
+ − 1722 {
+ − 1723 if (XEUNICODE_P)
+ − 1724 return CreateDCW ((LPCWSTR) lpszDriver, (LPCWSTR) lpszDevice,
+ − 1725 (LPCWSTR) lpszOutput, lpInitData);
+ − 1726 else
+ − 1727 {
+ − 1728 HGLOBAL hInitData = NULL;
+ − 1729 DEVMODEA *lpInitDataa = NULL;
+ − 1730 HDC retval;
+ − 1731
+ − 1732 if (lpInitData)
+ − 1733 {
+ − 1734 hInitData = copy_devmodew_to_devmodea (lpInitData, NULL);
+ − 1735 lpInitDataa = (DEVMODEA *) GlobalLock (hInitData);
+ − 1736 }
+ − 1737 retval = CreateDCA ((LPCSTR) lpszDriver, (LPCSTR) lpszDevice,
+ − 1738 (LPCSTR) lpszOutput, lpInitDataa);
+ − 1739
+ − 1740 if (hInitData)
+ − 1741 {
+ − 1742 GlobalUnlock (hInitData);
+ − 1743 GlobalFree (hInitData);
+ − 1744 }
+ − 1745
+ − 1746 return retval;
+ − 1747 }
+ − 1748 }
+ − 1749
+ − 1750 HDC
+ − 1751 qxeResetDC (HDC hdc, CONST DEVMODEW *lpInitData)
+ − 1752 {
+ − 1753 if (XEUNICODE_P)
+ − 1754 return ResetDCW (hdc, lpInitData);
+ − 1755 else
+ − 1756 {
+ − 1757 HGLOBAL hInitData = NULL;
+ − 1758 DEVMODEA *lpInitDataa = NULL;
+ − 1759 HDC retval;
+ − 1760
+ − 1761 if (lpInitData)
+ − 1762 {
+ − 1763 hInitData = copy_devmodew_to_devmodea (lpInitData, NULL);
+ − 1764 lpInitDataa = (DEVMODEA *) GlobalLock (hInitData);
+ − 1765 }
+ − 1766 retval = ResetDCA (hdc, lpInitDataa);
+ − 1767
+ − 1768 if (hInitData)
+ − 1769 {
+ − 1770 GlobalUnlock (hInitData);
+ − 1771 GlobalFree (hInitData);
+ − 1772 }
+ − 1773
+ − 1774 return retval;
+ − 1775 }
+ − 1776 }
+ − 1777
+ − 1778 DWORD
+ − 1779 qxeOpenPrinter (Extbyte *pPrinterName, LPHANDLE phPrinter,
+ − 1780 LPPRINTER_DEFAULTSW pDefaultconst)
+ − 1781 {
+ − 1782 assert (!pDefaultconst); /* we don't split it, so let's make sure we
+ − 1783 don't try. */
+ − 1784 if (XEUNICODE_P)
+ − 1785 return OpenPrinterW ((LPWSTR) pPrinterName, phPrinter,
+ − 1786 pDefaultconst);
+ − 1787 else
+ − 1788 return OpenPrinterA ((LPSTR) pPrinterName, phPrinter,
+ − 1789 (LPPRINTER_DEFAULTSA) pDefaultconst);
+ − 1790 }
+ − 1791
+ − 1792 LONG
+ − 1793 qxeDocumentProperties (HWND hWnd, HANDLE hPrinter, Extbyte *pDeviceName,
+ − 1794 DEVMODEW *pDevModeOutput, DEVMODEW *pDevModeInput,
+ − 1795 DWORD fMode)
+ − 1796 {
+ − 1797 if (XEUNICODE_P)
+ − 1798 #ifdef CYGWIN_HEADERS
+ − 1799 /* Cygwin mistakenly declares the fourth and fifth arguments as
+ − 1800 PDEVMODEA. */
+ − 1801 return DocumentPropertiesW (hWnd, hPrinter, (LPWSTR) pDeviceName,
+ − 1802 (DEVMODEA *) pDevModeOutput,
+ − 1803 (DEVMODEA *) pDevModeInput, fMode);
+ − 1804 #else
+ − 1805 return DocumentPropertiesW (hWnd, hPrinter, (LPWSTR) pDeviceName,
+ − 1806 pDevModeOutput, pDevModeInput, fMode);
+ − 1807 #endif /* CYGWIN_HEADERS */
+ − 1808 else
+ − 1809 {
+ − 1810 HGLOBAL hDevModeInput = NULL;
+ − 1811 DEVMODEA *pDevModeInputa = NULL;
+ − 1812 LONG retval;
+ − 1813
+ − 1814 if (pDevModeInput)
+ − 1815 {
+ − 1816 hDevModeInput = copy_devmodew_to_devmodea (pDevModeInput, NULL);
+ − 1817 pDevModeInputa = (DEVMODEA *) GlobalLock (hDevModeInput);
+ − 1818 }
+ − 1819
+ − 1820 /* Here we cheat a bit to avoid a problem: If the output
+ − 1821 structure is given but not the input one, how do we know how
+ − 1822 big to allocate our shadow output structure? Since the
+ − 1823 shadow structure is ANSI and the original Unicode, we know
+ − 1824 the shadow structure is smaller than what's given, so we just
+ − 1825 write into the given structure and then fix. */
+ − 1826 retval = DocumentPropertiesA (hWnd, hPrinter, (LPSTR) pDeviceName,
+ − 1827 pDevModeOutput ?
+ − 1828 (DEVMODEA *) pDevModeOutput : 0,
+ − 1829 pDevModeInput ? pDevModeInputa : 0,
+ − 1830 fMode);
+ − 1831
+ − 1832 if (hDevModeInput)
+ − 1833 {
+ − 1834 GlobalUnlock (hDevModeInput);
+ − 1835 GlobalFree (hDevModeInput);
+ − 1836 }
+ − 1837
+ − 1838 if (retval >= 0 && pDevModeOutput)
+ − 1839 {
+ − 1840 /* copy the shadow structure out of the way and then put the
+ − 1841 right contents back. */
+ − 1842 DEVMODEA *shadow = (DEVMODEA *) pDevModeOutput;
+ − 1843 DEVMODEA *newshadow = alloca_array (DEVMODEA, shadow->dmSize +
+ − 1844 shadow->dmDriverExtra);
+ − 1845
+ − 1846 memcpy (newshadow, shadow, shadow->dmSize + shadow->dmDriverExtra);
+ − 1847 copy_devmodea_to_devmodew (newshadow, pDevModeOutput);
+ − 1848 }
+ − 1849
+ − 1850 if (fMode == 0)
+ − 1851 retval += (sizeof (DEVMODEW) - sizeof (DEVMODEA));
+ − 1852 return retval;
+ − 1853 }
+ − 1854 }
+ − 1855
+ − 1856 static BOOL
+ − 1857 ansi_printer_dialog_1 (void *strucked, HGLOBAL *devmode_inout, int do_PrintDlg)
+ − 1858 {
+ − 1859 HGLOBAL hdma = NULL;
+ − 1860 HGLOBAL hdmw = *devmode_inout;
+ − 1861 DEVMODEW *dmw = NULL;
+ − 1862 BOOL retval;
+ − 1863
+ − 1864 if (hdmw != NULL)
+ − 1865 {
+ − 1866 /* copy to shadow in structure if needed */
+ − 1867 dmw = (DEVMODEW *) GlobalLock (hdmw);
+ − 1868 hdma = copy_devmodew_to_devmodea (dmw, NULL);
+ − 1869 *devmode_inout = hdma;
+ − 1870 }
+ − 1871
+ − 1872 if (do_PrintDlg)
+ − 1873 retval = PrintDlgA ((PRINTDLGA *) strucked);
+ − 1874 else
+ − 1875 retval = PageSetupDlgA ((PAGESETUPDLGA *) strucked);
+ − 1876
+ − 1877 if (retval)
+ − 1878 {
+ − 1879 /* copy the shadow output structure back to original, or
+ − 1880 allocate new one. */
+ − 1881 if (*devmode_inout)
+ − 1882 {
+ − 1883 DEVMODEA *newdma = (DEVMODEA *) GlobalLock (*devmode_inout);
+ − 1884 if (dmw)
+ − 1885 {
+ − 1886 copy_devmodea_to_devmodew (newdma, dmw);
+ − 1887 GlobalUnlock (hdmw);
+ − 1888 }
+ − 1889 else
+ − 1890 hdmw = copy_devmodea_to_devmodew (newdma, NULL);
+ − 1891 GlobalUnlock (*devmode_inout);
+ − 1892 GlobalFree (*devmode_inout);
+ − 1893 *devmode_inout = hdmw;
+ − 1894 }
+ − 1895 else if (hdma)
+ − 1896 /* #### can this happen? */
+ − 1897 GlobalFree (hdma);
+ − 1898 }
+ − 1899
+ − 1900 return retval;
+ − 1901 }
+ − 1902
+ − 1903 BOOL
+ − 1904 qxePrintDlg (PRINTDLGW *lppd)
+ − 1905 {
+ − 1906 if (XEUNICODE_P)
+ − 1907 return PrintDlgW (lppd);
+ − 1908 else
+ − 1909 return ansi_printer_dialog_1 (lppd, &lppd->hDevMode, 1);
+ − 1910 }
+ − 1911
+ − 1912 BOOL
+ − 1913 qxePageSetupDlg (PAGESETUPDLGW *lppd)
+ − 1914 {
+ − 1915 if (XEUNICODE_P)
+ − 1916 return PageSetupDlgW (lppd);
+ − 1917 else
+ − 1918 return ansi_printer_dialog_1 (lppd, &lppd->hDevMode, 0);
+ − 1919 }
+ − 1920
+ − 1921
+ − 1922 /************************************************************************/
+ − 1923 /* fonts */
+ − 1924 /************************************************************************/
+ − 1925
+ − 1926 static void
+ − 1927 copy_logfonta_to_logfontw (const LOGFONTA *src, LOGFONTW *dst)
+ − 1928 {
+ − 1929 /* the layout of LOGFONT is
+ − 1930
+ − 1931 non-split fields;
+ − 1932 TCHAR lfFaceName[...];
+ − 1933 */
+ − 1934 memcpy (dst, src, sizeof (LOGFONTA));
+ − 1935 }
+ − 1936
+ − 1937 static void
+ − 1938 copy_logfontw_to_logfonta (const LOGFONTW *src, LOGFONTA *dst)
+ − 1939 {
+ − 1940 memcpy (dst, src, sizeof (LOGFONTA));
+ − 1941 }
+ − 1942
872
+ − 1943 #if 0 /* unused */
+ − 1944
771
+ − 1945 static void
+ − 1946 copy_enumlogfonta_to_enumlogfontw (const ENUMLOGFONTA *src, ENUMLOGFONTW *dst)
+ − 1947 {
+ − 1948 /* the layout of ENUMLOGFONT is
+ − 1949
+ − 1950 LOGFONT elfLogFont;
+ − 1951 TCHAR elfFullName[...];
+ − 1952 TCHAR elfStyle[...];
+ − 1953 */
+ − 1954 xzero (*dst);
+ − 1955 copy_logfonta_to_logfontw (&src->elfLogFont, &dst->elfLogFont);
+ − 1956 memcpy (dst->elfFullName, src->elfFullName, sizeof (src->elfFullName));
+ − 1957 memcpy (dst->elfStyle, src->elfStyle, sizeof (src->elfStyle));
+ − 1958 }
+ − 1959
872
+ − 1960 #endif /* 0 */
+ − 1961
771
+ − 1962 static void
+ − 1963 copy_enumlogfontexa_to_enumlogfontexw (const ENUMLOGFONTEXA *src,
+ − 1964 ENUMLOGFONTEXW *dst)
+ − 1965 {
+ − 1966 /* the layout of ENUMLOGFONT is
+ − 1967
+ − 1968 LOGFONT elfLogFont;
+ − 1969 TCHAR elfFullName[...];
+ − 1970 TCHAR elfStyle[...];
+ − 1971 TCHAR elfScript[...];
+ − 1972 */
+ − 1973 xzero (*dst);
+ − 1974 copy_logfonta_to_logfontw (&src->elfLogFont, &dst->elfLogFont);
+ − 1975 memcpy (dst->elfFullName, src->elfFullName, sizeof (src->elfFullName));
+ − 1976 memcpy (dst->elfStyle, src->elfStyle, sizeof (src->elfStyle));
+ − 1977 memcpy (dst->elfScript, src->elfScript, sizeof (src->elfScript));
+ − 1978 }
+ − 1979
+ − 1980 static void
+ − 1981 copy_newtextmetrica_to_newtextmetricw (const NEWTEXTMETRICA *src,
+ − 1982 NEWTEXTMETRICW *dst)
+ − 1983 {
+ − 1984 /* the layout of NEWTEXTMETRIC is
+ − 1985
+ − 1986 non-split fields;
+ − 1987 WCHAR/BYTE tmFirstChar;
+ − 1988 WCHAR/BYTE tmLastChar;
+ − 1989 WCHAR/BYTE tmDefaultChar;
+ − 1990 WCHAR/BYTE tmBreakChar;
+ − 1991 BYTE tmItalic;
+ − 1992 non-split fields;
+ − 1993 */
+ − 1994 xzero (*dst);
+ − 1995 memcpy ((char *) dst, (char *) src,
+ − 1996 offsetof (NEWTEXTMETRICA, tmFirstChar));
+ − 1997 memcpy ((char *) dst + offsetof (NEWTEXTMETRICW, tmItalic),
+ − 1998 (char *) src + offsetof (NEWTEXTMETRICA, tmItalic),
+ − 1999 sizeof (NEWTEXTMETRICA) - offsetof (NEWTEXTMETRICA, tmItalic));
+ − 2000 dst->tmFirstChar = (WCHAR) src->tmFirstChar;
+ − 2001 dst->tmLastChar = (WCHAR) src->tmLastChar;
+ − 2002 dst->tmDefaultChar = (WCHAR) src->tmDefaultChar;
+ − 2003 dst->tmBreakChar = (WCHAR) src->tmBreakChar;
+ − 2004 }
+ − 2005
+ − 2006 static void
+ − 2007 copy_newtextmetricexa_to_newtextmetricexw (const NEWTEXTMETRICEXA *src,
+ − 2008 NEWTEXTMETRICEXW *dst)
+ − 2009 {
+ − 2010 /* the layout of NEWTEXTMETRICEX is
+ − 2011
+ − 2012 NEWTEXTMETRICA/W ntmTm;
+ − 2013 FONTSIGNATURE ntmFontSig;
+ − 2014 */
+ − 2015 copy_newtextmetrica_to_newtextmetricw (&src->ntmTm, &dst->ntmTm);
+ − 2016 dst->ntmFontSig = src->ntmFontSig;
+ − 2017 }
+ − 2018
872
+ − 2019 #if 0 /* unused */
+ − 2020
771
+ − 2021 static void
+ − 2022 copy_textmetricw_to_textmetrica (const TEXTMETRICW *src,
+ − 2023 TEXTMETRICA *dst)
+ − 2024 {
+ − 2025 /* the layout of TEXTMETRIC is like NEWTEXTMETRIC; see above. */
+ − 2026 xzero (*dst);
+ − 2027 memcpy ((char *) dst, (char *) src,
+ − 2028 offsetof (TEXTMETRICA, tmFirstChar));
+ − 2029 memcpy ((char *) dst + offsetof (TEXTMETRICA, tmItalic),
+ − 2030 (char *) src + offsetof (TEXTMETRICW, tmItalic),
+ − 2031 sizeof (TEXTMETRICA) - offsetof (TEXTMETRICA, tmItalic));
+ − 2032 dst->tmFirstChar = (BYTE) src->tmFirstChar;
+ − 2033 dst->tmLastChar = (BYTE) src->tmLastChar;
+ − 2034 dst->tmDefaultChar = (BYTE) src->tmDefaultChar;
+ − 2035 dst->tmBreakChar = (BYTE) src->tmBreakChar;
+ − 2036 }
+ − 2037
872
+ − 2038 #endif /* 0 */
+ − 2039
771
+ − 2040 static void
+ − 2041 copy_textmetrica_to_textmetricw (const TEXTMETRICA *src,
+ − 2042 TEXTMETRICW *dst)
+ − 2043 {
+ − 2044 /* the layout of TEXTMETRIC is like NEWTEXTMETRIC; see above. */
+ − 2045 xzero (*dst);
+ − 2046 memcpy ((char *) dst, (char *) src,
+ − 2047 offsetof (TEXTMETRICA, tmFirstChar));
+ − 2048 memcpy ((char *) dst + offsetof (TEXTMETRICW, tmItalic),
+ − 2049 (char *) src + offsetof (TEXTMETRICA, tmItalic),
+ − 2050 sizeof (TEXTMETRICA) - offsetof (TEXTMETRICA, tmItalic));
+ − 2051 dst->tmFirstChar = (WCHAR) src->tmFirstChar;
+ − 2052 dst->tmLastChar = (WCHAR) src->tmLastChar;
+ − 2053 dst->tmDefaultChar = (WCHAR) src->tmDefaultChar;
+ − 2054 dst->tmBreakChar = (WCHAR) src->tmBreakChar;
+ − 2055 }
+ − 2056
+ − 2057 typedef int (CALLBACK *qxeEnumFontFamExProcW) (ENUMLOGFONTEXW *lpelfe,
+ − 2058 NEWTEXTMETRICEXW *lpntme,
+ − 2059 DWORD FontType,
+ − 2060 LPARAM lParam);
+ − 2061
+ − 2062 struct qxeEnumFontFamExProcA_wrapper_t
+ − 2063 {
+ − 2064 qxeEnumFontFamExProcW orig_proc;
+ − 2065 LPARAM orig_lparam;
+ − 2066 };
+ − 2067
+ − 2068 static int CALLBACK
+ − 2069 qxeEnumFontFamExProcA_wrapper (ENUMLOGFONTEXA *lpelfe,
+ − 2070 NEWTEXTMETRICEXA *lpntme,
+ − 2071 DWORD fontType,
+ − 2072 struct qxeEnumFontFamExProcA_wrapper_t
+ − 2073 *closure)
+ − 2074 {
+ − 2075 ENUMLOGFONTEXW lpelfew;
+ − 2076 NEWTEXTMETRICEXW lpntmew;
+ − 2077
+ − 2078 /* #### if we're on Windows 2000 or above, lpelfe is actually an
+ − 2079 ENUMLOGFONTEXDV structure, and lpntme is an ENUMTEXTMETRIC structure
+ − 2080 when TRUETYPE_FONTTYPE. both are split-sized and need their own copy
+ − 2081 functions. need to handle. */
+ − 2082 copy_enumlogfontexa_to_enumlogfontexw (lpelfe, &lpelfew);
+ − 2083 if (fontType & TRUETYPE_FONTTYPE)
+ − 2084 copy_newtextmetricexa_to_newtextmetricexw (lpntme, &lpntmew);
+ − 2085 else
+ − 2086 {
+ − 2087 /* see docs of EnumFontFamExProc */
+ − 2088 xzero (lpntmew);
+ − 2089 copy_textmetrica_to_textmetricw ((TEXTMETRICA *) lpntme,
+ − 2090 (TEXTMETRICW *) &lpntmew);
+ − 2091 }
+ − 2092 return (closure->orig_proc) (&lpelfew, &lpntmew, fontType,
+ − 2093 closure->orig_lparam);
+ − 2094 }
+ − 2095
+ − 2096 int
+ − 2097 qxeEnumFontFamiliesEx (HDC hdc, LOGFONTW *lpLogfont,
+ − 2098 FONTENUMPROCW lpEnumFontFamProc, LPARAM lParam,
+ − 2099 DWORD dwFlags)
+ − 2100 {
+ − 2101 if (XEUNICODE_P)
+ − 2102 return EnumFontFamiliesExW (hdc, lpLogfont, lpEnumFontFamProc, lParam,
+ − 2103 dwFlags);
+ − 2104 else
+ − 2105 {
+ − 2106 struct qxeEnumFontFamExProcA_wrapper_t closure;
+ − 2107 LOGFONTA lfa;
+ − 2108
+ − 2109 closure.orig_proc = (qxeEnumFontFamExProcW) lpEnumFontFamProc;
+ − 2110 closure.orig_lparam = lParam;
+ − 2111 copy_logfontw_to_logfonta (lpLogfont, &lfa);
+ − 2112 return EnumFontFamiliesExA (hdc, &lfa,
+ − 2113 (FONTENUMPROCA)
+ − 2114 qxeEnumFontFamExProcA_wrapper,
+ − 2115 (LPARAM) &closure, dwFlags);
+ − 2116 }
+ − 2117 }
+ − 2118
+ − 2119 HFONT
+ − 2120 qxeCreateFontIndirect (CONST LOGFONTW *lplf)
+ − 2121 {
+ − 2122 if (XEUNICODE_P)
+ − 2123 return CreateFontIndirectW (lplf);
+ − 2124 else
+ − 2125 {
+ − 2126 LOGFONTA lfa;
+ − 2127
+ − 2128 copy_logfontw_to_logfonta (lplf, &lfa);
+ − 2129 return CreateFontIndirectA (&lfa);
+ − 2130 }
+ − 2131 }
+ − 2132
+ − 2133 BOOL
+ − 2134 qxeImmSetCompositionFont (HIMC imc, LOGFONTW *lplf)
+ − 2135 {
+ − 2136 if (XEUNICODE_P)
+ − 2137 return ImmSetCompositionFontW (imc, lplf);
+ − 2138 else
+ − 2139 {
+ − 2140 LOGFONTA lfa;
+ − 2141
+ − 2142 copy_logfontw_to_logfonta (lplf, &lfa);
+ − 2143 return ImmSetCompositionFontA (imc, &lfa);
+ − 2144 }
+ − 2145 }
+ − 2146
+ − 2147 BOOL
+ − 2148 qxeImmGetCompositionFont (HIMC imc, LOGFONTW *lplf)
+ − 2149 {
+ − 2150 if (XEUNICODE_P)
+ − 2151 return ImmGetCompositionFontW (imc, lplf);
+ − 2152 else
+ − 2153 {
+ − 2154 LOGFONTA lfa;
+ − 2155 BOOL retval = ImmGetCompositionFontA (imc, &lfa);
+ − 2156
+ − 2157 if (retval)
+ − 2158 copy_logfonta_to_logfontw (&lfa, lplf);
+ − 2159 return retval;
+ − 2160 }
+ − 2161 }
+ − 2162
+ − 2163 int
+ − 2164 qxeGetObject (HGDIOBJ hgdiobj, int cbBuffer, LPVOID lpvObject)
+ − 2165 {
+ − 2166 if (XEUNICODE_P)
+ − 2167 return GetObjectW (hgdiobj, cbBuffer, lpvObject);
+ − 2168 else
+ − 2169 {
+ − 2170 if (cbBuffer == sizeof (LOGFONTW))
+ − 2171 {
+ − 2172 LOGFONTA lfa;
+ − 2173 int retval = GetObjectA (hgdiobj, sizeof (LOGFONTA), &lfa);
+ − 2174
+ − 2175 if (!retval)
+ − 2176 return retval;
+ − 2177 copy_logfonta_to_logfontw (&lfa, (LOGFONTW *) lpvObject);
+ − 2178 return retval;
+ − 2179 }
+ − 2180 else
+ − 2181 return GetObjectA (hgdiobj, cbBuffer, lpvObject);
+ − 2182 }
+ − 2183 }
+ − 2184
+ − 2185 BOOL
+ − 2186 qxeGetTextMetrics (HDC hdc, LPTEXTMETRICW lptm)
+ − 2187 {
+ − 2188 if (XEUNICODE_P)
+ − 2189 return GetTextMetricsW (hdc, lptm);
+ − 2190 else
+ − 2191 {
+ − 2192 TEXTMETRICA tma;
+ − 2193 BOOL retval = GetTextMetricsA (hdc, &tma);
+ − 2194
+ − 2195 if (retval)
+ − 2196 copy_textmetrica_to_textmetricw (&tma, lptm);
+ − 2197 return retval;
+ − 2198 }
+ − 2199 }
+ − 2200
+ − 2201
+ − 2202 /************************************************************************/
+ − 2203 /* windows */
+ − 2204 /************************************************************************/
+ − 2205
+ − 2206 typedef struct Intercepted_wnd_proc
+ − 2207 {
+ − 2208 WNDPROC proc;
+ − 2209 Extbyte *name;
+ − 2210 int is_ansi;
+ − 2211 } Intercepted_wnd_proc;
+ − 2212
+ − 2213 typedef struct
+ − 2214 {
+ − 2215 Dynarr_declare (Intercepted_wnd_proc);
+ − 2216 } Intercepted_wnd_proc_dynarr;
+ − 2217
+ − 2218 static Intercepted_wnd_proc_dynarr *intercepted_wnd_procs;
+ − 2219
+ − 2220 static Intercepted_wnd_proc *
+ − 2221 find_window_class (const Extbyte *name, int is_ansi)
+ − 2222 {
+ − 2223 int i;
+ − 2224
+ − 2225 if (!intercepted_wnd_procs)
+ − 2226 intercepted_wnd_procs = Dynarr_new (Intercepted_wnd_proc);
+ − 2227
+ − 2228 for (i = 0; i < Dynarr_length (intercepted_wnd_procs); i++)
+ − 2229 {
+ − 2230 Intercepted_wnd_proc *s = Dynarr_atp (intercepted_wnd_procs, i);
+ − 2231
+ − 2232 if (s->is_ansi == is_ansi && (is_ansi ? !strcmp (s->name, name) :
+ − 2233 !wcscmp ((wchar_t *) s->name,
+ − 2234 (wchar_t *) name)))
+ − 2235 return s;
+ − 2236 }
+ − 2237
+ − 2238 return 0;
+ − 2239 }
+ − 2240
+ − 2241 /* ####
+ − 2242
+ − 2243 check problem with cutting and pasting in my current mule -- if i cut,
+ − 2244 then go to another application, then switch back to this one and
+ − 2245 paste, it seems to get confused -- loses the size or something?
+ − 2246
+ − 2247 other things: split flags on CreateProcess and DDE stuff should be
+ − 2248 handled by us.
+ − 2249 */
+ − 2250
+ − 2251 static LRESULT WINAPI
+ − 2252 intercepted_wnd_proc (HWND hwnd, UINT message_, WPARAM wParam, LPARAM lParam)
+ − 2253 {
+ − 2254 Intercepted_wnd_proc *s;
+ − 2255 int is_ansi = XEUNICODE_P ? !IsWindowUnicode (hwnd) : 1;
+ − 2256 Extbyte *classname;
+ − 2257 int size = 100;
+ − 2258
+ − 2259 /* Just in case XEUNICODE_P changes during the execution of the program
+ − 2260 (admittedly, unlikely), check whether the window is Unicode and keep
+ − 2261 track of this in the list of classes. */
+ − 2262 while (1)
+ − 2263 {
+ − 2264 classname = alloca_extbytes (size * XETCHAR_SIZE);
+ − 2265 if ((is_ansi ? GetClassNameA (hwnd, (LPSTR) classname, size) :
+ − 2266 GetClassNameW (hwnd, (LPWSTR) classname, size)) < size - 1)
+ − 2267 break;
+ − 2268 size *= 2;
+ − 2269 }
+ − 2270
+ − 2271 s = find_window_class (classname, is_ansi);
+ − 2272
+ − 2273 assert (s);
+ − 2274
+ − 2275 if (message_ == WM_NOTIFY)
+ − 2276 {
+ − 2277 LPNMHDR nmhdr = (LPNMHDR) lParam;
+ − 2278 int putback = nmhdr->code;
+ − 2279 int do_putback = 0;
+ − 2280
+ − 2281 #define FROB(msg) \
+ − 2282 case msg##W: \
+ − 2283 /* split structures are the same size, so no conversion necessary */ \
+ − 2284 nmhdr->code = (UINT) msg##A; \
+ − 2285 do_putback = 1; \
+ − 2286 break;
+ − 2287 switch (nmhdr->code)
+ − 2288 {
+ − 2289 /* NMHEADER */
+ − 2290 FROB (HDN_ITEMCHANGING);
+ − 2291 FROB (HDN_ITEMCHANGED);
+ − 2292 FROB (HDN_ITEMCLICK);
+ − 2293 FROB (HDN_ITEMDBLCLICK);
+ − 2294 FROB (HDN_DIVIDERDBLCLICK);
+ − 2295 FROB (HDN_BEGINTRACK);
+ − 2296 FROB (HDN_ENDTRACK);
+ − 2297 FROB (HDN_TRACK);
+ − 2298 /* NMDISPINFO */
+ − 2299 FROB (HDN_GETDISPINFO);
+ − 2300 /* NMTBGETINFOTIP */
+ − 2301 FROB (TBN_GETINFOTIP);
+ − 2302 /* NMTBDISPINFO */
+ − 2303 FROB (TBN_GETDISPINFO);
+ − 2304 /* NMTOOLBAR */
+ − 2305 FROB (TBN_GETBUTTONINFO);
+ − 2306
+ − 2307 /* split-sized NMTTDISPINFO */
+ − 2308 FROB (TTN_GETDISPINFO); /* handle the ...W case; then handle the
+ − 2309 ...A case specially, since we need to
+ − 2310 mess with the structure */
+ − 2311 case TTN_GETDISPINFOA: /* same as TTN_NEEDTEXTA */
+ − 2312 {
+ − 2313 NMTTDISPINFOW *nmw = alloca_new (NMTTDISPINFOW);
+ − 2314 NMTTDISPINFOA *nma = (NMTTDISPINFOA *) lParam;
+ − 2315 LRESULT retval;
+ − 2316 /* the layout of NMTTDISPINFO is
+ − 2317
+ − 2318 non-split fields;
+ − 2319 TCHAR szText[...];
+ − 2320 non-split fields;
+ − 2321 */
+ − 2322
+ − 2323 xzero (*nmw);
+ − 2324 /* copy to ...W struct for Unicode code */
+ − 2325 memcpy ((char *) nmw, (char *) nma,
+ − 2326 offsetof (NMTTDISPINFOA, szText));
+ − 2327 memcpy ((char *) nmw + offsetof (NMTTDISPINFOW, szText) +
+ − 2328 sizeof (nmw->szText),
+ − 2329 (char *) nma + offsetof (NMTTDISPINFOA, szText) +
+ − 2330 sizeof (nma->szText),
+ − 2331 sizeof (NMTTDISPINFOA) -
+ − 2332 (offsetof (NMTTDISPINFOA, szText) + sizeof (nma->szText)));
+ − 2333 memcpy (nmw->szText, nma->szText, sizeof (nma->szText));
+ − 2334 retval = (s->proc) (hwnd, message_, wParam, lParam);
+ − 2335 /* copy back to ...A struct */
+ − 2336 xzero (*nma);
+ − 2337 memcpy ((char *) nma, (char *) nmw,
+ − 2338 offsetof (NMTTDISPINFOA, szText));
+ − 2339 memcpy ((char *) nma + offsetof (NMTTDISPINFOA, szText) +
+ − 2340 sizeof (nma->szText),
+ − 2341 (char *) nmw + offsetof (NMTTDISPINFOW, szText) +
+ − 2342 sizeof (nmw->szText),
+ − 2343 sizeof (NMTTDISPINFOA) -
+ − 2344 (offsetof (NMTTDISPINFOA, szText) + sizeof (nma->szText)));
+ − 2345 memcpy (nma->szText, nmw->szText, sizeof (nma->szText));
+ − 2346 return retval;
+ − 2347 }
+ − 2348
+ − 2349 /* NMLVFINDITEM */
+ − 2350 FROB (LVN_ODFINDITEM);
+ − 2351 /* NMLVDISPINFO */
+ − 2352 FROB (LVN_BEGINLABELEDIT);
+ − 2353 FROB (LVN_ENDLABELEDIT);
+ − 2354 FROB (LVN_GETDISPINFO);
+ − 2355 FROB (LVN_SETDISPINFO);
+ − 2356 /* NMLVGETINFOTIP */
+ − 2357 FROB (LVN_GETINFOTIP);
+ − 2358 /* NMTREEVIEW */
+ − 2359 FROB (TVN_SELCHANGING);
+ − 2360 FROB (TVN_SELCHANGED);
+ − 2361 FROB (TVN_ITEMEXPANDING);
+ − 2362 FROB (TVN_ITEMEXPANDED);
+ − 2363 FROB (TVN_BEGINDRAG);
+ − 2364 FROB (TVN_BEGINRDRAG);
+ − 2365 FROB (TVN_DELETEITEM);
+ − 2366 /* NMTVDISPINFO */
+ − 2367 FROB (TVN_GETDISPINFO);
+ − 2368 FROB (TVN_SETDISPINFO);
+ − 2369 FROB (TVN_BEGINLABELEDIT);
+ − 2370 FROB (TVN_ENDLABELEDIT);
+ − 2371 /* NMTVGETINFOTIP */
+ − 2372 FROB (TVN_GETINFOTIP);
+ − 2373 /* NMCOMBOBOXEX */
+ − 2374 FROB (CBEN_GETDISPINFO);
+ − 2375
+ − 2376 /* split-sized NMCBEDRAGBEGIN */
+ − 2377 FROB (CBEN_DRAGBEGIN); /* handle the ...W case; then handle the
+ − 2378 ...A case specially, since we need to
+ − 2379 mess with the structure */
+ − 2380 {
+ − 2381 NMCBEDRAGBEGINW *nmw = alloca_new (NMCBEDRAGBEGINW);
+ − 2382 NMCBEDRAGBEGINA *nma = (NMCBEDRAGBEGINA *) lParam;
+ − 2383 LRESULT retval;
+ − 2384 /* the layout of NNMCBEDRAGBEGIN is
+ − 2385
+ − 2386 non-split fields;
+ − 2387 TCHAR szText[...];
+ − 2388 */
+ − 2389
+ − 2390 xzero (*nmw);
+ − 2391 /* copy to ...W struct for Unicode code */
+ − 2392 memcpy ((char *) nmw, (char *) nma,
+ − 2393 sizeof (*nma));
+ − 2394 retval = (s->proc) (hwnd, message_, wParam, lParam);
+ − 2395 /* copy back to ...A struct */
+ − 2396 xzero (*nma);
+ − 2397 memcpy ((char *) nma, (char *) nmw,
+ − 2398 sizeof (*nma));
+ − 2399 return retval;
+ − 2400 }
+ − 2401
+ − 2402 /* split-sized NMCBEENDEDIT */
+ − 2403 FROB (CBEN_ENDEDIT); /* handle the ...W case; then handle the
+ − 2404 ...A case specially, since we need to
+ − 2405 mess with the structure */
+ − 2406 {
+ − 2407 NMCBEENDEDITW *nmw = alloca_new (NMCBEENDEDITW);
+ − 2408 NMCBEENDEDITA *nma = (NMCBEENDEDITA *) lParam;
+ − 2409 LRESULT retval;
+ − 2410 /* the layout of NMCBEENDEDIT is
+ − 2411
+ − 2412 non-split fields;
+ − 2413 TCHAR szText[...];
+ − 2414 non-split fields;
+ − 2415 */
+ − 2416
+ − 2417 xzero (*nmw);
+ − 2418 /* copy to ...W struct for Unicode code */
+ − 2419 memcpy ((char *) nmw, (char *) nma,
+ − 2420 offsetof (NMCBEENDEDITA, szText));
+ − 2421 memcpy ((char *) nmw + offsetof (NMCBEENDEDITW, szText) +
+ − 2422 sizeof (nmw->szText),
+ − 2423 (char *) nma + offsetof (NMCBEENDEDITA, szText) +
+ − 2424 sizeof (nma->szText),
+ − 2425 sizeof (NMCBEENDEDITA) -
+ − 2426 (offsetof (NMCBEENDEDITA, szText) + sizeof (nma->szText)));
+ − 2427 memcpy (nmw->szText, nma->szText, sizeof (nma->szText));
+ − 2428 retval = (s->proc) (hwnd, message_, wParam, lParam);
+ − 2429 /* copy back to ...A struct */
+ − 2430 xzero (*nma);
+ − 2431 memcpy ((char *) nma, (char *) nmw,
+ − 2432 offsetof (NMCBEENDEDITA, szText));
+ − 2433 memcpy ((char *) nma + offsetof (NMCBEENDEDITA, szText) +
+ − 2434 sizeof (nma->szText),
+ − 2435 (char *) nmw + offsetof (NMCBEENDEDITW, szText) +
+ − 2436 sizeof (nmw->szText),
+ − 2437 sizeof (NMCBEENDEDITA) -
+ − 2438 (offsetof (NMCBEENDEDITA, szText) + sizeof (nma->szText)));
+ − 2439 memcpy (nma->szText, nmw->szText, sizeof (nma->szText));
+ − 2440 return retval;
+ − 2441 }
+ − 2442
+ − 2443 /* NMDATETIMESTRING */
+ − 2444 FROB (DTN_USERSTRING);
+ − 2445 /* NMDATETIMEWMKEYDOWN */
+ − 2446 FROB (DTN_WMKEYDOWN);
+ − 2447
+ − 2448 /* split-sized NMDATETIMEFORMAT */
+ − 2449 FROB (DTN_FORMAT); /* handle the ...W case; then handle the
+ − 2450 ...A case specially, since we need to
+ − 2451 mess with the structure */
+ − 2452 {
+ − 2453 NMDATETIMEFORMATW *nmw = alloca_new (NMDATETIMEFORMATW);
+ − 2454 NMDATETIMEFORMATA *nma = (NMDATETIMEFORMATA *) lParam;
+ − 2455 LRESULT retval;
+ − 2456 /* the layout of NMDATETIMEFORMAT is
+ − 2457
+ − 2458 non-split fields;
+ − 2459 TCHAR szText[...];
+ − 2460 */
+ − 2461
+ − 2462 xzero (*nmw);
+ − 2463 /* copy to ...W struct for Unicode code */
+ − 2464 memcpy ((char *) nmw, (char *) nma,
+ − 2465 sizeof (*nma));
+ − 2466 retval = (s->proc) (hwnd, message_, wParam, lParam);
+ − 2467 /* copy back to ...A struct */
+ − 2468 xzero (*nma);
+ − 2469 memcpy ((char *) nma, (char *) nmw,
+ − 2470 sizeof (*nma));
+ − 2471 return retval;
+ − 2472 }
+ − 2473
+ − 2474 /* NMDATETIMEFORMATQUERY */
+ − 2475 FROB (DTN_FORMATQUERY);
+ − 2476 default: break;
+ − 2477 }
+ − 2478 #undef FROB
+ − 2479 if (do_putback)
+ − 2480 {
+ − 2481 LRESULT retval = (s->proc) (hwnd, message_, wParam, lParam);
+ − 2482 ((LPNMHDR) lParam)->code = putback;
+ − 2483 return retval;
+ − 2484 }
+ − 2485 }
+ − 2486
+ − 2487 return (s->proc) (hwnd, message_, wParam, lParam);
+ − 2488 }
+ − 2489
+ − 2490 ATOM
+ − 2491 qxeRegisterClass (CONST WNDCLASSW * lpWndClass)
+ − 2492 {
+ − 2493 Intercepted_wnd_proc *s =
+ − 2494 find_window_class ((Extbyte *) lpWndClass->lpszClassName, !XEUNICODE_P);
+ − 2495 WNDCLASSW classnew;
+ − 2496
+ − 2497 if (s)
+ − 2498 {
+ − 2499 s->proc = lpWndClass->lpfnWndProc;
+ − 2500 s->name = (Extbyte *) lpWndClass->lpszClassName;
+ − 2501 s->is_ansi = !XEUNICODE_P;
+ − 2502 }
+ − 2503 else
+ − 2504 {
+ − 2505 Intercepted_wnd_proc news;
+ − 2506 news.proc = lpWndClass->lpfnWndProc;
+ − 2507 news.name = (Extbyte *) lpWndClass->lpszClassName;
+ − 2508 news.is_ansi = !XEUNICODE_P;
+ − 2509 Dynarr_add (intercepted_wnd_procs, news);
+ − 2510 }
+ − 2511 classnew = *lpWndClass;
+ − 2512 classnew.lpfnWndProc = intercepted_wnd_proc;
+ − 2513 if (XEUNICODE_P)
+ − 2514 return RegisterClassW (&classnew);
+ − 2515 else
+ − 2516 return RegisterClassA ((CONST WNDCLASSA *) &classnew);
+ − 2517 }
+ − 2518
+ − 2519 BOOL
+ − 2520 qxeUnregisterClass (const Extbyte * lpClassName, HINSTANCE hInstance)
+ − 2521 {
+ − 2522 Intercepted_wnd_proc *s =
+ − 2523 find_window_class (lpClassName, !XEUNICODE_P);
+ − 2524
+ − 2525 if (s)
+ − 2526 Dynarr_delete_by_pointer (intercepted_wnd_procs, s);
+ − 2527 if (XEUNICODE_P)
+ − 2528 return UnregisterClassW ((LPCWSTR) lpClassName, hInstance);
+ − 2529 else
+ − 2530 return UnregisterClassA ((LPCSTR) lpClassName, hInstance);
+ − 2531 }
+ − 2532
+ − 2533 /* NOTE: NT 4.0+ only */
+ − 2534 ATOM
+ − 2535 qxeRegisterClassEx (CONST WNDCLASSEXW *lpWndClass)
+ − 2536 {
+ − 2537 Intercepted_wnd_proc *s =
+ − 2538 find_window_class ((Extbyte *) lpWndClass->lpszClassName, !XEUNICODE_P);
+ − 2539 WNDCLASSEXW classnew;
+ − 2540
+ − 2541 if (s)
+ − 2542 {
+ − 2543 s->proc = lpWndClass->lpfnWndProc;
+ − 2544 s->name = (Extbyte *) lpWndClass->lpszClassName;
+ − 2545 s->is_ansi = !XEUNICODE_P;
+ − 2546 }
+ − 2547 else
+ − 2548 {
+ − 2549 Intercepted_wnd_proc news;
+ − 2550 news.proc = lpWndClass->lpfnWndProc;
+ − 2551 news.name = (Extbyte *) lpWndClass->lpszClassName;
+ − 2552 news.is_ansi = !XEUNICODE_P;
+ − 2553 Dynarr_add (intercepted_wnd_procs, news);
+ − 2554 }
+ − 2555 classnew = *lpWndClass;
+ − 2556 classnew.lpfnWndProc = intercepted_wnd_proc;
+ − 2557 if (XEUNICODE_P)
+ − 2558 return RegisterClassExW (&classnew);
+ − 2559 else
+ − 2560 return RegisterClassExA ((CONST WNDCLASSEXA *) &classnew);
+ − 2561 }
+ − 2562
+ − 2563
+ − 2564 /************************************************************************/
+ − 2565 /* COMMCTRL.H */
+ − 2566 /************************************************************************/
+ − 2567
+ − 2568 /* there are only four structures in commctrl.h that cannot be cast
+ − 2569 between Unicode/ANSI versions:
+ − 2570
+ − 2571 NMTTDISPINFO aka TOOLTIPTEXT
+ − 2572 NMCBEDRAGBEGIN
+ − 2573 NMCBEENDEDIT
+ − 2574 NMDATETIMEFORMAT
+ − 2575
+ − 2576 these are all notify structures, and we handle them above in
+ − 2577 intercepted_wnd_proc().
+ − 2578
+ − 2579 in addition, this constant is weird, being a struct size of one of these:
+ − 2580
+ − 2581 NMTTDISPINFO_V1_SIZE
+ − 2582 */
+ − 2583
+ − 2584 /*
+ − 2585 split class names:
+ − 2586
+ − 2587 WC_HEADER
+ − 2588 TOOLBARCLASSNAME
+ − 2589 REBARCLASSNAME
+ − 2590 TOOLTIPS_CLASS
+ − 2591 STATUSCLASSNAME
+ − 2592 TRACKBAR_CLASS
+ − 2593 UPDOWN_CLASS
+ − 2594 PROGRESS_CLASS
+ − 2595 HOTKEY_CLASS
+ − 2596 WC_LISTVIEW
+ − 2597 WC_TREEVIEW
+ − 2598 WC_COMBOBOXEX
+ − 2599 WC_TABCONTROL
+ − 2600 ANIMATE_CLASS
+ − 2601 MONTHCAL_CLASS
+ − 2602 DATETIMEPICK_CLASS
+ − 2603 WC_IPADDRESS
+ − 2604 WC_PAGESCROLLER
+ − 2605 WC_NATIVEFONTCTL
+ − 2606 */
+ − 2607
+ − 2608 /*
+ − 2609 SendMessage split messages:
+ − 2610
+ − 2611 HDM_INSERTITEM
+ − 2612 HDM_GETITEM
+ − 2613 HDM_SETITEM
+ − 2614 TB_GETBUTTONTEXT
+ − 2615 TB_SAVERESTORE
+ − 2616 TB_ADDSTRING
+ − 2617 TB_GETBUTTONINFO
+ − 2618 TB_SETBUTTONINFO
+ − 2619 TB_INSERTBUTTON
+ − 2620 TB_ADDBUTTONS
+ − 2621 RB_INSERTBAND
+ − 2622 RB_SETBANDINFO
+ − 2623 RB_GETBANDINFO
+ − 2624 TTM_ADDTOOL
+ − 2625 TTM_DELTOOL
+ − 2626 TTM_NEWTOOLRECT
+ − 2627 TTM_GETTOOLINFO
+ − 2628 TTM_SETTOOLINFO
+ − 2629 TTM_HITTEST
+ − 2630 TTM_GETTEXT
+ − 2631 TTM_UPDATETIPTEXT
+ − 2632 TTM_ENUMTOOLS
+ − 2633 TTM_GETCURRENTTOOL
+ − 2634 SB_GETTEXT
+ − 2635 SB_SETTEXT
+ − 2636 SB_GETTEXTLENGTH
+ − 2637 SB_SETTIPTEXT
+ − 2638 SB_GETTIPTEXT
+ − 2639 LVM_GETITEM
+ − 2640 LVM_SETITEM
+ − 2641 LVM_INSERTITEM
+ − 2642 LVM_FINDITEM
+ − 2643 LVM_GETSTRINGWIDTH
+ − 2644 LVM_EDITLABEL
+ − 2645 LVM_GETCOLUMN
+ − 2646 LVM_SETCOLUMN
+ − 2647 LVM_GETITEMTEXT
+ − 2648 LVM_SETITEMTEXT
+ − 2649 LVM_GETISEARCHSTRING
+ − 2650 LVM_SETBKIMAGE
+ − 2651 LVM_GETBKIMAGE
+ − 2652 TVM_INSERTITEM
+ − 2653 TVM_GETITEM
+ − 2654 TVM_SETITEM
+ − 2655 TVM_EDITLABEL
+ − 2656 TVM_GETISEARCHSTRING
+ − 2657 CBEM_INSERTITEM
+ − 2658 CBEM_SETITEM
+ − 2659 CBEM_GETITEM
+ − 2660 TCM_GETITEM
+ − 2661 TCM_SETITEM
+ − 2662 TCM_INSERTITEM
+ − 2663 ACM_OPEN
+ − 2664 DTM_SETFORMAT
+ − 2665 BFFM_SETSTATUSTEXT
+ − 2666 BFFM_SETSELECTION
+ − 2667 */
+ − 2668
+ − 2669 /*
+ − 2670 split notify messages:
+ − 2671
+ − 2672 HDN_ITEMCHANGING
+ − 2673 HDN_ITEMCHANGED
+ − 2674 HDN_ITEMCLICK
+ − 2675 HDN_ITEMDBLCLICK
+ − 2676 HDN_DIVIDERDBLCLICK
+ − 2677 HDN_BEGINTRACK
+ − 2678 HDN_ENDTRACK
+ − 2679 HDN_TRACK
+ − 2680 HDN_GETDISPINFO
+ − 2681 TBN_GETINFOTIP
+ − 2682 TBN_GETDISPINFO
+ − 2683 TBN_GETBUTTONINFO
+ − 2684 TTN_GETDISPINFO
+ − 2685 TTN_NEEDTEXTW
+ − 2686 LVN_ODFINDITEM
+ − 2687 LVN_BEGINLABELEDIT
+ − 2688 LVN_ENDLABELEDIT
+ − 2689 LVN_GETDISPINFO
+ − 2690 LVN_SETDISPINFO
+ − 2691 LVN_GETINFOTIP
+ − 2692 TVN_SELCHANGING
+ − 2693 TVN_SELCHANGED
+ − 2694 TVN_GETDISPINFO
+ − 2695 TVN_SETDISPINFO
+ − 2696 TVN_ITEMEXPANDING
+ − 2697 TVN_ITEMEXPANDED
+ − 2698 TVN_BEGINDRAG
+ − 2699 TVN_BEGINRDRAG
+ − 2700 TVN_DELETEITEM
+ − 2701 TVN_BEGINLABELEDIT
+ − 2702 TVN_ENDLABELEDIT
+ − 2703 TVN_GETINFOTIP
+ − 2704 CBEN_GETDISPINFO
+ − 2705 CBEN_DRAGBEGIN
+ − 2706 CBEN_ENDEDIT
+ − 2707 DTN_USERSTRING
+ − 2708 DTN_WMKEYDOWN
+ − 2709 DTN_FORMAT
+ − 2710 DTN_FORMATQUERY
+ − 2711 BFFM_VALIDATEFAILED (send to SHBrowseForFolder procedure)
+ − 2712 */
+ − 2713
+ − 2714 /*
+ − 2715 split structures:
+ − 2716
+ − 2717 TV_INSERTSTRUCT (simple-split, though -- just cast)
+ − 2718 TC_ITEM (simple-split, though -- just cast)
+ − 2719
+ − 2720 ####
+ − 2721 */
+ − 2722
+ − 2723 /*
+ − 2724 split macros or macros needing splitting:
+ − 2725
+ − 2726 ####
+ − 2727 */
+ − 2728
+ − 2729 LRESULT
+ − 2730 qxeSendMessage (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+ − 2731 {
+ − 2732 #define FROB(msg) \
+ − 2733 case msg##A: \
+ − 2734 /* split structures are the same size, so no conversion necessary */ \
+ − 2735 Msg = msg##W; \
+ − 2736 break;
+ − 2737
+ − 2738 if (XEUNICODE_P)
+ − 2739 {
+ − 2740 WCHAR classname[100];
+ − 2741 /* the name for SHBrowseForFolder windows is non-obvious so we have
+ − 2742 to intercept the callback */
+ − 2743 if (is_SHBrowseForFolder (hWnd))
+ − 2744 {
+ − 2745 switch (Msg)
+ − 2746 {
+ − 2747 FROB (BFFM_SETSELECTION);
+ − 2748 FROB (BFFM_SETSTATUSTEXT);
+ − 2749 default: break;
+ − 2750 }
+ − 2751 }
+ − 2752 else if (!GetClassNameW (hWnd, classname, 100))
+ − 2753 ;
+ − 2754 /* luckily, subclassing leaves the name alone, so we can still
+ − 2755 determine fairly easily the correct class to switch on */
+ − 2756 else if (!wcscmp (classname, WC_HEADERW))
+ − 2757 {
+ − 2758 switch (Msg)
+ − 2759 {
+ − 2760 FROB (HDM_INSERTITEM);
+ − 2761 FROB (HDM_GETITEM);
+ − 2762 FROB (HDM_SETITEM);
+ − 2763 default: break;
+ − 2764 }
+ − 2765 }
+ − 2766 else if (!wcscmp (classname, TOOLBARCLASSNAMEW))
+ − 2767 {
+ − 2768 switch (Msg)
+ − 2769 {
+ − 2770 FROB (TB_GETBUTTONTEXT);
+ − 2771 FROB (TB_SAVERESTORE);
+ − 2772 FROB (TB_ADDSTRING);
+ − 2773 FROB (TB_GETBUTTONINFO);
+ − 2774 FROB (TB_SETBUTTONINFO);
+ − 2775 FROB (TB_INSERTBUTTON);
+ − 2776 FROB (TB_ADDBUTTONS);
+ − 2777 default: break;
+ − 2778 }
+ − 2779 }
+ − 2780 else if (!wcscmp (classname, REBARCLASSNAMEW))
+ − 2781 {
+ − 2782 switch (Msg)
+ − 2783 {
+ − 2784 FROB (RB_INSERTBAND);
+ − 2785 FROB (RB_SETBANDINFO);
+ − 2786 FROB (RB_GETBANDINFO);
+ − 2787 default: break;
+ − 2788 }
+ − 2789 }
+ − 2790 else if (!wcscmp (classname, TOOLTIPS_CLASSW))
+ − 2791 {
+ − 2792 switch (Msg)
+ − 2793 {
+ − 2794 FROB (TTM_ADDTOOL);
+ − 2795 FROB (TTM_DELTOOL);
+ − 2796 FROB (TTM_NEWTOOLRECT);
+ − 2797 FROB (TTM_GETTOOLINFO);
+ − 2798 FROB (TTM_SETTOOLINFO);
+ − 2799 FROB (TTM_HITTEST);
+ − 2800 FROB (TTM_GETTEXT);
+ − 2801 FROB (TTM_UPDATETIPTEXT);
+ − 2802 FROB (TTM_ENUMTOOLS);
+ − 2803 FROB (TTM_GETCURRENTTOOL);
+ − 2804 default: break;
+ − 2805 }
+ − 2806 }
+ − 2807 else if (!wcscmp (classname, STATUSCLASSNAMEW))
+ − 2808 {
+ − 2809 switch (Msg)
+ − 2810 {
+ − 2811 FROB (SB_GETTEXT);
+ − 2812 FROB (SB_SETTEXT);
+ − 2813 FROB (SB_GETTEXTLENGTH);
+ − 2814 FROB (SB_SETTIPTEXT);
+ − 2815 FROB (SB_GETTIPTEXT);
+ − 2816 default: break;
+ − 2817 }
+ − 2818 }
+ − 2819 else if (!wcscmp (classname, WC_LISTVIEWW))
+ − 2820 {
+ − 2821 switch (Msg)
+ − 2822 {
+ − 2823 FROB (LVM_GETITEM);
+ − 2824 FROB (LVM_SETITEM);
+ − 2825 FROB (LVM_INSERTITEM);
+ − 2826 FROB (LVM_FINDITEM);
+ − 2827 FROB (LVM_GETSTRINGWIDTH);
+ − 2828 FROB (LVM_EDITLABEL);
+ − 2829 FROB (LVM_GETCOLUMN);
+ − 2830 FROB (LVM_SETCOLUMN);
+ − 2831 FROB (LVM_GETITEMTEXT);
+ − 2832 FROB (LVM_SETITEMTEXT);
+ − 2833 FROB (LVM_GETISEARCHSTRING);
+ − 2834 FROB (LVM_SETBKIMAGE);
+ − 2835 FROB (LVM_GETBKIMAGE);
+ − 2836 default: break;
+ − 2837 }
+ − 2838 }
+ − 2839 else if (!wcscmp (classname, WC_TREEVIEWW))
+ − 2840 {
+ − 2841 switch (Msg)
+ − 2842 {
+ − 2843 FROB (TVM_INSERTITEM); /* no need to split TV_INSERTSTRUCT */
+ − 2844 FROB (TVM_GETITEM);
+ − 2845 FROB (TVM_SETITEM);
+ − 2846 FROB (TVM_EDITLABEL);
+ − 2847 FROB (TVM_GETISEARCHSTRING);
+ − 2848 default: break;
+ − 2849 }
+ − 2850 }
+ − 2851 else if (!wcscmp (classname, WC_COMBOBOXEXW))
+ − 2852 {
+ − 2853 switch (Msg)
+ − 2854 {
+ − 2855 FROB (CBEM_INSERTITEM);
+ − 2856 FROB (CBEM_SETITEM);
+ − 2857 FROB (CBEM_GETITEM);
+ − 2858 default: break;
+ − 2859 }
+ − 2860 }
+ − 2861 else if (!wcscmp (classname, WC_TABCONTROLW))
+ − 2862 {
+ − 2863 switch (Msg)
+ − 2864 {
+ − 2865 FROB (TCM_GETITEM);
+ − 2866 FROB (TCM_SETITEM);
+ − 2867 FROB (TCM_INSERTITEM); /* no need to split TC_ITEM */
+ − 2868 default: break;
+ − 2869 }
+ − 2870 }
+ − 2871 else if (!wcscmp (classname, ANIMATE_CLASSW))
+ − 2872 {
+ − 2873 switch (Msg)
+ − 2874 {
+ − 2875 FROB (ACM_OPEN);
+ − 2876 default: break;
+ − 2877 }
+ − 2878 }
+ − 2879 else if (!wcscmp (classname, DATETIMEPICK_CLASSW))
+ − 2880 {
+ − 2881 switch (Msg)
+ − 2882 {
+ − 2883 FROB (DTM_SETFORMAT);
+ − 2884 default: break;
+ − 2885 }
+ − 2886 }
+ − 2887 }
+ − 2888
+ − 2889 if (XEUNICODE_P)
+ − 2890 return SendMessageW (hWnd, Msg, wParam, lParam);
+ − 2891 else
+ − 2892 return SendMessageA (hWnd, Msg, wParam, lParam);
+ − 2893
+ − 2894 #undef FROB
+ − 2895 }
+ − 2896
+ − 2897 #endif /* HAVE_MS_WINDOWS */
+ − 2898
+ − 2899