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
+ − 219 yes GetLongPathName
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
+ − 901 yes DdeCreateStringHandle
+ − 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
+ − 1285 /* NOTE: NT 4.0+ only */
+ − 1286 UINT
+ − 1287 qxeExtractIconEx (const Extbyte * lpszFile, int nIconIndex, HICON FAR * phiconLarge, HICON FAR * phiconSmall, UINT nIcons)
+ − 1288 {
+ − 1289 /* Cygwin mistakenly declares the return type as HICON. */
+ − 1290 if (XEUNICODE_P)
+ − 1291 return (UINT) ExtractIconExW ((LPCWSTR) lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
+ − 1292 else
+ − 1293 return (UINT) ExtractIconExA ((LPCSTR) lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
+ − 1294 }
+ − 1295
+ − 1296 /* NOTE: NT 4.0+ only */
+ − 1297 BOOL
+ − 1298 qxeGetICMProfile (HDC arg1, LPDWORD arg2, Extbyte * arg3)
+ − 1299 {
+ − 1300 #ifdef CYGWIN_HEADERS
+ − 1301 /* Cygwin mistakenly declares the second argument as DWORD. */
+ − 1302 if (XEUNICODE_P)
+ − 1303 return GetICMProfileW (arg1, (DWORD) arg2, (LPWSTR) arg3);
+ − 1304 else
+ − 1305 return GetICMProfileA (arg1, (DWORD) arg2, (LPSTR) arg3);
+ − 1306 #else
+ − 1307 if (XEUNICODE_P)
+ − 1308 return GetICMProfileW (arg1, arg2, (LPWSTR) arg3);
+ − 1309 else
+ − 1310 return GetICMProfileA (arg1, arg2, (LPSTR) arg3);
+ − 1311 #endif /* CYGWIN_HEADERS */
+ − 1312 }
+ − 1313
+ − 1314 /* NOTE: NT 4.0+ only */
+ − 1315 BOOL
+ − 1316 qxeUpdateICMRegKey (DWORD arg1, Extbyte * arg2, Extbyte * arg3, UINT arg4)
+ − 1317 {
+ − 1318 #ifdef CYGWIN_HEADERS
+ − 1319 /* Cygwin mistakenly declares the second argument as DWORD. */
+ − 1320 if (XEUNICODE_P)
+ − 1321 return UpdateICMRegKeyW (arg1, (DWORD) arg2, (LPWSTR) arg3, arg4);
+ − 1322 else
+ − 1323 return UpdateICMRegKeyA (arg1, (DWORD) arg2, (LPSTR) arg3, arg4);
+ − 1324 #else
+ − 1325 if (XEUNICODE_P)
+ − 1326 return UpdateICMRegKeyW (arg1, (LPWSTR) arg2, (LPWSTR) arg3, arg4);
+ − 1327 else
+ − 1328 return UpdateICMRegKeyA (arg1, (LPSTR) arg2, (LPSTR) arg3, arg4);
+ − 1329 #endif /* CYGWIN_HEADERS */
+ − 1330 }
+ − 1331
+ − 1332 #ifndef CYGWIN /* present in headers but missing in shell32.a */
+ − 1333
+ − 1334 BOOL
+ − 1335 qxeSHGetSpecialFolderPath (HWND hwndOwner, Extbyte * lpszPath, int nFolder, BOOL fCreate)
+ − 1336 {
+ − 1337 #ifdef CYGWIN_HEADERS
+ − 1338 /* Cygwin mistakenly declares the second argument as LPSTR in both
+ − 1339 versions. */
+ − 1340 if (XEUNICODE_P)
+ − 1341 return SHGetSpecialFolderPathW (hwndOwner, (LPSTR) lpszPath, nFolder, fCreate);
+ − 1342 else
+ − 1343 return SHGetSpecialFolderPathA (hwndOwner, (LPSTR) lpszPath, nFolder, fCreate);
+ − 1344 #else
+ − 1345 if (XEUNICODE_P)
+ − 1346 return SHGetSpecialFolderPathW (hwndOwner, (LPWSTR) lpszPath, nFolder, fCreate);
+ − 1347 else
+ − 1348 return SHGetSpecialFolderPathA (hwndOwner, (LPSTR) lpszPath, nFolder, fCreate);
+ − 1349 #endif
+ − 1350 }
+ − 1351
+ − 1352 #endif /* not CYGWIN */
+ − 1353
+ − 1354
+ − 1355 /************************************************************************/
+ − 1356 /* files */
+ − 1357 /************************************************************************/
+ − 1358
+ − 1359 static void
+ − 1360 copy_win32_find_dataa_to_win32_find_dataw (const WIN32_FIND_DATAA *pa,
+ − 1361 WIN32_FIND_DATAW *pw)
+ − 1362 {
+ − 1363 /* the layout of WIN32_FIND_DATA is
+ − 1364
+ − 1365 non-split fields;
+ − 1366 TCHAR cFileName[...];
+ − 1367 TCHAR cAlternateFileName[...];
+ − 1368 */
+ − 1369
+ − 1370 xzero (*pw);
+ − 1371 memcpy (pw, pa, offsetof (WIN32_FIND_DATAA, cFileName));
+ − 1372 memcpy (pw->cFileName, pa->cFileName, sizeof (pa->cFileName));
+ − 1373 memcpy (pw->cAlternateFileName, pa->cAlternateFileName,
+ − 1374 sizeof (pa->cAlternateFileName));
+ − 1375 }
+ − 1376
+ − 1377 HANDLE
+ − 1378 qxeFindFirstFile (const Extbyte *lpFileName,
+ − 1379 WIN32_FIND_DATAW *lpFindFileData)
+ − 1380 {
+ − 1381 if (XEUNICODE_P)
+ − 1382 return FindFirstFileW ((LPCWSTR) lpFileName, lpFindFileData);
+ − 1383 else
+ − 1384 {
+ − 1385 WIN32_FIND_DATAA ansidat;
+ − 1386 HANDLE retval;
+ − 1387
+ − 1388 retval = FindFirstFileA ((LPCSTR) lpFileName, &ansidat);
+ − 1389 if (retval != INVALID_HANDLE_VALUE)
+ − 1390 copy_win32_find_dataa_to_win32_find_dataw (&ansidat, lpFindFileData);
+ − 1391 return retval;
+ − 1392 }
+ − 1393 }
+ − 1394
+ − 1395 BOOL
+ − 1396 qxeFindNextFile (HANDLE hFindFile, WIN32_FIND_DATAW *lpFindFileData)
+ − 1397 {
+ − 1398 if (XEUNICODE_P)
+ − 1399 return FindNextFileW (hFindFile, lpFindFileData);
+ − 1400 else
+ − 1401 {
+ − 1402 WIN32_FIND_DATAA ansidat;
+ − 1403 BOOL retval;
+ − 1404
+ − 1405 retval = FindNextFileA (hFindFile, &ansidat);
+ − 1406 if (retval)
+ − 1407 copy_win32_find_dataa_to_win32_find_dataw (&ansidat, lpFindFileData);
+ − 1408 return retval;
+ − 1409 }
+ − 1410 }
+ − 1411
+ − 1412
+ − 1413 /************************************************************************/
+ − 1414 /* shell */
+ − 1415 /************************************************************************/
+ − 1416
+ − 1417 static void
+ − 1418 copy_shfileinfoa_to_shfileinfow (const SHFILEINFOA *pa,
778
+ − 1419 SHFILEINFOW *pw, UINT sz)
771
+ − 1420 {
+ − 1421 /* the layout of SHFILEINFO is
+ − 1422
+ − 1423 non-split fields;
+ − 1424 TCHAR szDisplayName[...];
+ − 1425 TCHAR szTypeName[...];
+ − 1426 */
+ − 1427
778
+ − 1428 assert (sz >= sizeof (SHFILEINFOW));
771
+ − 1429 xzero (*pw);
+ − 1430 memcpy (pw, pa, offsetof (SHFILEINFOA, szDisplayName));
+ − 1431 memcpy (pw->szDisplayName, pa->szDisplayName, sizeof (pa->szDisplayName));
+ − 1432 memcpy (pw->szTypeName, pa->szTypeName, sizeof (pa->szTypeName));
+ − 1433 }
+ − 1434
+ − 1435 DWORD
+ − 1436 qxeSHGetFileInfo (const Extbyte *pszPath, DWORD dwFileAttributes,
+ − 1437 SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags)
+ − 1438 {
+ − 1439 if (XEUNICODE_P)
+ − 1440 return SHGetFileInfoW ((LPCWSTR) pszPath, dwFileAttributes,
+ − 1441 psfi, cbFileInfo, uFlags);
+ − 1442 else
+ − 1443 {
+ − 1444 SHFILEINFOA ansidat;
+ − 1445 BOOL retval;
+ − 1446
+ − 1447 retval = SHGetFileInfoA ((LPCSTR) pszPath, dwFileAttributes,
778
+ − 1448 (SHFILEINFOA FAR *) &ansidat,
+ − 1449 cbFileInfo ? sizeof (ansidat) : 0, uFlags);
+ − 1450 if (retval && cbFileInfo)
+ − 1451 copy_shfileinfoa_to_shfileinfow (&ansidat, psfi, cbFileInfo);
771
+ − 1452 return retval;
+ − 1453 }
+ − 1454 }
+ − 1455
+ − 1456 struct intercepted_SHBrowseForFolder
+ − 1457 {
+ − 1458 BFFCALLBACK lpfn;
+ − 1459 LPARAM lParam;
+ − 1460 HWND hwnd;
+ − 1461 struct intercepted_SHBrowseForFolder *next;
+ − 1462 };
+ − 1463
+ − 1464 static struct intercepted_SHBrowseForFolder *SHBrowseForFolder_list;
+ − 1465
+ − 1466 static int
+ − 1467 CALLBACK intercepted_SHBrowseForFolder_proc (HWND hwnd, UINT msg,
+ − 1468 LPARAM lParam, LPARAM lpData)
+ − 1469 {
+ − 1470 struct intercepted_SHBrowseForFolder *s =
+ − 1471 (struct intercepted_SHBrowseForFolder *) lpData;
+ − 1472
+ − 1473 if (s->hwnd == 0)
+ − 1474 s->hwnd = hwnd;
+ − 1475 if (s->lpfn)
+ − 1476 {
+ − 1477 /* see below */
+ − 1478 if (XEUNICODE_P && msg == BFFM_VALIDATEFAILEDW)
+ − 1479 msg = BFFM_VALIDATEFAILEDA;
+ − 1480 else if (!XEUNICODE_P && msg == BFFM_VALIDATEFAILEDA)
+ − 1481 msg = BFFM_VALIDATEFAILEDW;
+ − 1482 return (s->lpfn) (hwnd, msg, lParam, s->lParam);
+ − 1483 }
+ − 1484 else
+ − 1485 return 0;
+ − 1486 }
+ − 1487
+ − 1488 static int
+ − 1489 is_SHBrowseForFolder (HWND hwnd)
+ − 1490 {
+ − 1491 struct intercepted_SHBrowseForFolder *s;
+ − 1492
+ − 1493 for (s = SHBrowseForFolder_list; s; s = s->next)
+ − 1494 if (s->hwnd == hwnd)
+ − 1495 return 1;
+ − 1496 return 0;
+ − 1497 }
+ − 1498
+ − 1499 LPITEMIDLIST
+ − 1500 qxeSHBrowseForFolder (LPBROWSEINFOW lpbi)
+ − 1501 {
+ − 1502 struct intercepted_SHBrowseForFolder s;
+ − 1503 LPITEMIDLIST retval;
+ − 1504
+ − 1505 /* There are two outgoing Unicode-split messages:
+ − 1506
+ − 1507 BFFM_SETSELECTION
+ − 1508 BFFM_SETSTATUSTEXT
+ − 1509
+ − 1510 and one incoming:
+ − 1511
+ − 1512 BFFM_VALIDATEFAILED
+ − 1513
+ − 1514 To handle this, we need to intercept the callback. We handle the
+ − 1515 incoming message in the callback, and record the window; when
+ − 1516 qxeSendMessage() is called, we handle the outgoing messages. None of
+ − 1517 the messages have split-sized structures so we don't need to do
+ − 1518 anything complicated there. */
+ − 1519
+ − 1520 s.lParam = lpbi->lParam;
+ − 1521 s.lpfn = lpbi->lpfn;
+ − 1522 s.next = SHBrowseForFolder_list;
+ − 1523 s.hwnd = 0;
+ − 1524 SHBrowseForFolder_list = &s;
+ − 1525
+ − 1526 lpbi->lpfn = intercepted_SHBrowseForFolder_proc;
+ − 1527 lpbi->lParam = (LPARAM) &s;
+ − 1528
+ − 1529 if (XEUNICODE_P)
+ − 1530 retval = SHBrowseForFolderW (lpbi);
+ − 1531 else
+ − 1532 retval = SHBrowseForFolderA ((LPBROWSEINFOA) lpbi);
+ − 1533 SHBrowseForFolder_list = SHBrowseForFolder_list->next;
+ − 1534 return retval;
+ − 1535 }
+ − 1536
+ − 1537 VOID
+ − 1538 qxeSHAddToRecentDocs (UINT uFlags, LPCVOID pv)
+ − 1539 {
+ − 1540 /* pv can be a string pointer; this is handled by Unicode-splitting the
+ − 1541 flag SHARD_PATH rather than the function itself. Fix up the flag to
+ − 1542 be correct. We write it symmetrically so it doesn't matter whether
+ − 1543 UNICODE is defined. */
+ − 1544 if (XEUNICODE_P)
+ − 1545 {
+ − 1546 if (uFlags & SHARD_PATHA)
+ − 1547 {
+ − 1548 uFlags |= SHARD_PATHW;
+ − 1549 uFlags &= ~SHARD_PATHA;
+ − 1550 }
+ − 1551 }
+ − 1552 else
+ − 1553 {
+ − 1554 if (uFlags & SHARD_PATHW)
+ − 1555 {
+ − 1556 uFlags |= SHARD_PATHA;
+ − 1557 uFlags &= ~SHARD_PATHW;
+ − 1558 }
+ − 1559 }
+ − 1560 SHAddToRecentDocs (uFlags, pv);
+ − 1561 }
+ − 1562
+ − 1563 VOID
+ − 1564 qxeSHChangeNotify (LONG wEventId, UINT uFlags, LPCVOID dwItem1,
+ − 1565 LPCVOID dwItem2)
+ − 1566 {
+ − 1567 /* works like SHAddToRecentDocs */
+ − 1568 if (XEUNICODE_P)
+ − 1569 {
+ − 1570 if (uFlags & SHCNF_PATHA)
+ − 1571 {
+ − 1572 uFlags |= SHCNF_PATHW;
+ − 1573 uFlags &= ~SHCNF_PATHA;
+ − 1574 }
+ − 1575 if (uFlags & SHCNF_PRINTERA)
+ − 1576 {
+ − 1577 uFlags |= SHCNF_PRINTERW;
+ − 1578 uFlags &= ~SHCNF_PRINTERA;
+ − 1579 }
+ − 1580 }
+ − 1581 else
+ − 1582 {
+ − 1583 if (uFlags & SHCNF_PATHW)
+ − 1584 {
+ − 1585 uFlags |= SHCNF_PATHA;
+ − 1586 uFlags &= ~SHCNF_PATHW;
+ − 1587 }
+ − 1588 if (uFlags & SHCNF_PRINTERW)
+ − 1589 {
+ − 1590 uFlags |= SHCNF_PRINTERA;
+ − 1591 uFlags &= ~SHCNF_PRINTERW;
+ − 1592 }
+ − 1593 }
+ − 1594 SHChangeNotify (wEventId, uFlags, dwItem1, dwItem2);
+ − 1595 }
+ − 1596
+ − 1597 #ifndef CYGWIN /* present in headers but missing in shell32.a */
+ − 1598
+ − 1599 HRESULT
+ − 1600 qxeSHGetDataFromIDList (IShellFolder *psf, LPCITEMIDLIST pidl, int nFormat,
+ − 1601 PVOID pv, int cb)
+ − 1602 {
+ − 1603 if (XEUNICODE_P)
+ − 1604 return SHGetDataFromIDListW (psf, pidl, nFormat, pv, cb);
+ − 1605 else if (nFormat == SHGDFIL_FINDDATA)
+ − 1606 {
+ − 1607 WIN32_FIND_DATAA ansidat;
+ − 1608 BOOL retval;
+ − 1609
+ − 1610 retval = SHGetDataFromIDListA (psf, pidl, nFormat, &ansidat, cb);
+ − 1611 if (retval == NOERROR)
+ − 1612 copy_win32_find_dataa_to_win32_find_dataw (&ansidat, pv);
+ − 1613 return retval;
+ − 1614 }
+ − 1615 else
+ − 1616 /* nFormat == SHGDFIL_NETRESOURCE, and pv is split-simple NETRESOURCE
+ − 1617 structure, but we don't need to worry about that currently since we
+ − 1618 don't translate strings */
+ − 1619 return SHGetDataFromIDListA (psf, pidl, nFormat, pv, cb);
+ − 1620 }
+ − 1621
+ − 1622 #endif /* not CYGWIN */
+ − 1623
+ − 1624
+ − 1625
+ − 1626 #ifdef HAVE_MS_WINDOWS
+ − 1627
+ − 1628 /************************************************************************/
+ − 1629 /* devmode */
+ − 1630 /************************************************************************/
+ − 1631
+ − 1632 /* These functions return globally allocated blocks because some
+ − 1633 callers (e.g. qxePrintDlg) want this. */
+ − 1634
+ − 1635 static HGLOBAL
+ − 1636 copy_devmodew_to_devmodea (const DEVMODEW *src, DEVMODEA *dst)
+ − 1637 {
+ − 1638 /* the layout of DEVMODE is
+ − 1639
+ − 1640 TCHAR dmDeviceName[...];
+ − 1641 non-split fields, including dmSize (size of structure; differs between
+ − 1642 Unicode and ANSI) and dmDriverExtra;
+ − 1643 TCHAR dmFormName[...];
+ − 1644 non-split fields;
+ − 1645 extra data, of size DEVMODE->dmDriverExtra
+ − 1646 */
+ − 1647 HGLOBAL hdst = NULL;
+ − 1648
+ − 1649 if (!dst)
+ − 1650 {
+ − 1651 hdst = GlobalAlloc (GHND, src->dmSize + src->dmDriverExtra -
+ − 1652 (sizeof (DEVMODEW) - sizeof (DEVMODEA)));
+ − 1653 dst = (DEVMODEA *) GlobalLock (hdst);
+ − 1654 }
+ − 1655
+ − 1656 memcpy (dst->dmDeviceName, src->dmDeviceName, sizeof (dst->dmDeviceName));
+ − 1657 memcpy ((char *) dst + sizeof (dst->dmDeviceName),
+ − 1658 (char *) src + sizeof (src->dmDeviceName),
+ − 1659 offsetof (DEVMODEA, dmFormName) - sizeof (dst->dmDeviceName));
+ − 1660 dst->dmSize -= sizeof (DEVMODEW) - sizeof (DEVMODEA);
+ − 1661 memcpy (dst->dmFormName, src->dmFormName, sizeof (dst->dmFormName));
+ − 1662 memcpy ((char *) dst + offsetof (DEVMODEA, dmFormName) +
+ − 1663 sizeof (dst->dmFormName),
+ − 1664 (char *) src + offsetof (DEVMODEW, dmFormName) +
+ − 1665 sizeof (src->dmFormName),
+ − 1666 dst->dmSize + dst->dmDriverExtra -
+ − 1667 (offsetof (DEVMODEA, dmFormName) + sizeof (dst->dmFormName)));
+ − 1668
+ − 1669 if (hdst)
+ − 1670 GlobalUnlock (hdst);
+ − 1671 return hdst;
+ − 1672 }
+ − 1673
+ − 1674 static HGLOBAL
+ − 1675 copy_devmodea_to_devmodew (const DEVMODEA *src, DEVMODEW *dst)
+ − 1676 {
+ − 1677 HGLOBAL hdst = NULL;
+ − 1678
+ − 1679 if (!dst)
+ − 1680 {
+ − 1681 hdst = GlobalAlloc (GHND, src->dmSize + src->dmDriverExtra +
+ − 1682 (sizeof (DEVMODEW) - sizeof (DEVMODEA)));
+ − 1683 dst = (DEVMODEW *) GlobalLock (hdst);
+ − 1684 }
+ − 1685
+ − 1686 memcpy (dst->dmDeviceName, src->dmDeviceName, sizeof (src->dmDeviceName));
+ − 1687 memcpy ((char *) dst + sizeof (dst->dmDeviceName),
+ − 1688 (char *) src + sizeof (src->dmDeviceName),
+ − 1689 offsetof (DEVMODEA, dmFormName) - sizeof (src->dmDeviceName));
+ − 1690 dst->dmSize += sizeof (DEVMODEW) - sizeof (DEVMODEA);
+ − 1691 memcpy (dst->dmFormName, src->dmFormName, sizeof (src->dmFormName));
+ − 1692 memcpy ((char *) dst + offsetof (DEVMODEW, dmFormName) +
+ − 1693 sizeof (dst->dmFormName),
+ − 1694 (char *) src + offsetof (DEVMODEA, dmFormName) +
+ − 1695 sizeof (src->dmFormName),
+ − 1696 src->dmSize + src->dmDriverExtra -
+ − 1697 (offsetof (DEVMODEA, dmFormName) + sizeof (src->dmFormName)));
+ − 1698
+ − 1699 if (hdst)
+ − 1700 GlobalUnlock (hdst);
+ − 1701 return hdst;
+ − 1702 }
+ − 1703
+ − 1704 HDC
+ − 1705 qxeCreateDC (const Extbyte *lpszDriver, const Extbyte *lpszDevice,
+ − 1706 const Extbyte *lpszOutput, CONST DEVMODEW *lpInitData)
+ − 1707 {
+ − 1708 if (XEUNICODE_P)
+ − 1709 return CreateDCW ((LPCWSTR) lpszDriver, (LPCWSTR) lpszDevice,
+ − 1710 (LPCWSTR) lpszOutput, lpInitData);
+ − 1711 else
+ − 1712 {
+ − 1713 HGLOBAL hInitData = NULL;
+ − 1714 DEVMODEA *lpInitDataa = NULL;
+ − 1715 HDC retval;
+ − 1716
+ − 1717 if (lpInitData)
+ − 1718 {
+ − 1719 hInitData = copy_devmodew_to_devmodea (lpInitData, NULL);
+ − 1720 lpInitDataa = (DEVMODEA *) GlobalLock (hInitData);
+ − 1721 }
+ − 1722 retval = CreateDCA ((LPCSTR) lpszDriver, (LPCSTR) lpszDevice,
+ − 1723 (LPCSTR) lpszOutput, lpInitDataa);
+ − 1724
+ − 1725 if (hInitData)
+ − 1726 {
+ − 1727 GlobalUnlock (hInitData);
+ − 1728 GlobalFree (hInitData);
+ − 1729 }
+ − 1730
+ − 1731 return retval;
+ − 1732 }
+ − 1733 }
+ − 1734
+ − 1735 HDC
+ − 1736 qxeResetDC (HDC hdc, CONST DEVMODEW *lpInitData)
+ − 1737 {
+ − 1738 if (XEUNICODE_P)
+ − 1739 return ResetDCW (hdc, lpInitData);
+ − 1740 else
+ − 1741 {
+ − 1742 HGLOBAL hInitData = NULL;
+ − 1743 DEVMODEA *lpInitDataa = NULL;
+ − 1744 HDC retval;
+ − 1745
+ − 1746 if (lpInitData)
+ − 1747 {
+ − 1748 hInitData = copy_devmodew_to_devmodea (lpInitData, NULL);
+ − 1749 lpInitDataa = (DEVMODEA *) GlobalLock (hInitData);
+ − 1750 }
+ − 1751 retval = ResetDCA (hdc, lpInitDataa);
+ − 1752
+ − 1753 if (hInitData)
+ − 1754 {
+ − 1755 GlobalUnlock (hInitData);
+ − 1756 GlobalFree (hInitData);
+ − 1757 }
+ − 1758
+ − 1759 return retval;
+ − 1760 }
+ − 1761 }
+ − 1762
+ − 1763 DWORD
+ − 1764 qxeOpenPrinter (Extbyte *pPrinterName, LPHANDLE phPrinter,
+ − 1765 LPPRINTER_DEFAULTSW pDefaultconst)
+ − 1766 {
+ − 1767 assert (!pDefaultconst); /* we don't split it, so let's make sure we
+ − 1768 don't try. */
+ − 1769 if (XEUNICODE_P)
+ − 1770 return OpenPrinterW ((LPWSTR) pPrinterName, phPrinter,
+ − 1771 pDefaultconst);
+ − 1772 else
+ − 1773 return OpenPrinterA ((LPSTR) pPrinterName, phPrinter,
+ − 1774 (LPPRINTER_DEFAULTSA) pDefaultconst);
+ − 1775 }
+ − 1776
+ − 1777 LONG
+ − 1778 qxeDocumentProperties (HWND hWnd, HANDLE hPrinter, Extbyte *pDeviceName,
+ − 1779 DEVMODEW *pDevModeOutput, DEVMODEW *pDevModeInput,
+ − 1780 DWORD fMode)
+ − 1781 {
+ − 1782 if (XEUNICODE_P)
+ − 1783 #ifdef CYGWIN_HEADERS
+ − 1784 /* Cygwin mistakenly declares the fourth and fifth arguments as
+ − 1785 PDEVMODEA. */
+ − 1786 return DocumentPropertiesW (hWnd, hPrinter, (LPWSTR) pDeviceName,
+ − 1787 (DEVMODEA *) pDevModeOutput,
+ − 1788 (DEVMODEA *) pDevModeInput, fMode);
+ − 1789 #else
+ − 1790 return DocumentPropertiesW (hWnd, hPrinter, (LPWSTR) pDeviceName,
+ − 1791 pDevModeOutput, pDevModeInput, fMode);
+ − 1792 #endif /* CYGWIN_HEADERS */
+ − 1793 else
+ − 1794 {
+ − 1795 HGLOBAL hDevModeInput = NULL;
+ − 1796 DEVMODEA *pDevModeInputa = NULL;
+ − 1797 LONG retval;
+ − 1798
+ − 1799 if (pDevModeInput)
+ − 1800 {
+ − 1801 hDevModeInput = copy_devmodew_to_devmodea (pDevModeInput, NULL);
+ − 1802 pDevModeInputa = (DEVMODEA *) GlobalLock (hDevModeInput);
+ − 1803 }
+ − 1804
+ − 1805 /* Here we cheat a bit to avoid a problem: If the output
+ − 1806 structure is given but not the input one, how do we know how
+ − 1807 big to allocate our shadow output structure? Since the
+ − 1808 shadow structure is ANSI and the original Unicode, we know
+ − 1809 the shadow structure is smaller than what's given, so we just
+ − 1810 write into the given structure and then fix. */
+ − 1811 retval = DocumentPropertiesA (hWnd, hPrinter, (LPSTR) pDeviceName,
+ − 1812 pDevModeOutput ?
+ − 1813 (DEVMODEA *) pDevModeOutput : 0,
+ − 1814 pDevModeInput ? pDevModeInputa : 0,
+ − 1815 fMode);
+ − 1816
+ − 1817 if (hDevModeInput)
+ − 1818 {
+ − 1819 GlobalUnlock (hDevModeInput);
+ − 1820 GlobalFree (hDevModeInput);
+ − 1821 }
+ − 1822
+ − 1823 if (retval >= 0 && pDevModeOutput)
+ − 1824 {
+ − 1825 /* copy the shadow structure out of the way and then put the
+ − 1826 right contents back. */
+ − 1827 DEVMODEA *shadow = (DEVMODEA *) pDevModeOutput;
+ − 1828 DEVMODEA *newshadow = alloca_array (DEVMODEA, shadow->dmSize +
+ − 1829 shadow->dmDriverExtra);
+ − 1830
+ − 1831 memcpy (newshadow, shadow, shadow->dmSize + shadow->dmDriverExtra);
+ − 1832 copy_devmodea_to_devmodew (newshadow, pDevModeOutput);
+ − 1833 }
+ − 1834
+ − 1835 if (fMode == 0)
+ − 1836 retval += (sizeof (DEVMODEW) - sizeof (DEVMODEA));
+ − 1837 return retval;
+ − 1838 }
+ − 1839 }
+ − 1840
+ − 1841 static BOOL
+ − 1842 ansi_printer_dialog_1 (void *strucked, HGLOBAL *devmode_inout, int do_PrintDlg)
+ − 1843 {
+ − 1844 HGLOBAL hdma = NULL;
+ − 1845 HGLOBAL hdmw = *devmode_inout;
+ − 1846 DEVMODEW *dmw = NULL;
+ − 1847 BOOL retval;
+ − 1848
+ − 1849 if (hdmw != NULL)
+ − 1850 {
+ − 1851 /* copy to shadow in structure if needed */
+ − 1852 dmw = (DEVMODEW *) GlobalLock (hdmw);
+ − 1853 hdma = copy_devmodew_to_devmodea (dmw, NULL);
+ − 1854 *devmode_inout = hdma;
+ − 1855 }
+ − 1856
+ − 1857 if (do_PrintDlg)
+ − 1858 retval = PrintDlgA ((PRINTDLGA *) strucked);
+ − 1859 else
+ − 1860 retval = PageSetupDlgA ((PAGESETUPDLGA *) strucked);
+ − 1861
+ − 1862 if (retval)
+ − 1863 {
+ − 1864 /* copy the shadow output structure back to original, or
+ − 1865 allocate new one. */
+ − 1866 if (*devmode_inout)
+ − 1867 {
+ − 1868 DEVMODEA *newdma = (DEVMODEA *) GlobalLock (*devmode_inout);
+ − 1869 if (dmw)
+ − 1870 {
+ − 1871 copy_devmodea_to_devmodew (newdma, dmw);
+ − 1872 GlobalUnlock (hdmw);
+ − 1873 }
+ − 1874 else
+ − 1875 hdmw = copy_devmodea_to_devmodew (newdma, NULL);
+ − 1876 GlobalUnlock (*devmode_inout);
+ − 1877 GlobalFree (*devmode_inout);
+ − 1878 *devmode_inout = hdmw;
+ − 1879 }
+ − 1880 else if (hdma)
+ − 1881 /* #### can this happen? */
+ − 1882 GlobalFree (hdma);
+ − 1883 }
+ − 1884
+ − 1885 return retval;
+ − 1886 }
+ − 1887
+ − 1888 BOOL
+ − 1889 qxePrintDlg (PRINTDLGW *lppd)
+ − 1890 {
+ − 1891 if (XEUNICODE_P)
+ − 1892 return PrintDlgW (lppd);
+ − 1893 else
+ − 1894 return ansi_printer_dialog_1 (lppd, &lppd->hDevMode, 1);
+ − 1895 }
+ − 1896
+ − 1897 BOOL
+ − 1898 qxePageSetupDlg (PAGESETUPDLGW *lppd)
+ − 1899 {
+ − 1900 if (XEUNICODE_P)
+ − 1901 return PageSetupDlgW (lppd);
+ − 1902 else
+ − 1903 return ansi_printer_dialog_1 (lppd, &lppd->hDevMode, 0);
+ − 1904 }
+ − 1905
+ − 1906
+ − 1907 /************************************************************************/
+ − 1908 /* fonts */
+ − 1909 /************************************************************************/
+ − 1910
+ − 1911 static void
+ − 1912 copy_logfonta_to_logfontw (const LOGFONTA *src, LOGFONTW *dst)
+ − 1913 {
+ − 1914 /* the layout of LOGFONT is
+ − 1915
+ − 1916 non-split fields;
+ − 1917 TCHAR lfFaceName[...];
+ − 1918 */
+ − 1919 memcpy (dst, src, sizeof (LOGFONTA));
+ − 1920 }
+ − 1921
+ − 1922 static void
+ − 1923 copy_logfontw_to_logfonta (const LOGFONTW *src, LOGFONTA *dst)
+ − 1924 {
+ − 1925 memcpy (dst, src, sizeof (LOGFONTA));
+ − 1926 }
+ − 1927
872
+ − 1928 #if 0 /* unused */
+ − 1929
771
+ − 1930 static void
+ − 1931 copy_enumlogfonta_to_enumlogfontw (const ENUMLOGFONTA *src, ENUMLOGFONTW *dst)
+ − 1932 {
+ − 1933 /* the layout of ENUMLOGFONT is
+ − 1934
+ − 1935 LOGFONT elfLogFont;
+ − 1936 TCHAR elfFullName[...];
+ − 1937 TCHAR elfStyle[...];
+ − 1938 */
+ − 1939 xzero (*dst);
+ − 1940 copy_logfonta_to_logfontw (&src->elfLogFont, &dst->elfLogFont);
+ − 1941 memcpy (dst->elfFullName, src->elfFullName, sizeof (src->elfFullName));
+ − 1942 memcpy (dst->elfStyle, src->elfStyle, sizeof (src->elfStyle));
+ − 1943 }
+ − 1944
872
+ − 1945 #endif /* 0 */
+ − 1946
771
+ − 1947 static void
+ − 1948 copy_enumlogfontexa_to_enumlogfontexw (const ENUMLOGFONTEXA *src,
+ − 1949 ENUMLOGFONTEXW *dst)
+ − 1950 {
+ − 1951 /* the layout of ENUMLOGFONT is
+ − 1952
+ − 1953 LOGFONT elfLogFont;
+ − 1954 TCHAR elfFullName[...];
+ − 1955 TCHAR elfStyle[...];
+ − 1956 TCHAR elfScript[...];
+ − 1957 */
+ − 1958 xzero (*dst);
+ − 1959 copy_logfonta_to_logfontw (&src->elfLogFont, &dst->elfLogFont);
+ − 1960 memcpy (dst->elfFullName, src->elfFullName, sizeof (src->elfFullName));
+ − 1961 memcpy (dst->elfStyle, src->elfStyle, sizeof (src->elfStyle));
+ − 1962 memcpy (dst->elfScript, src->elfScript, sizeof (src->elfScript));
+ − 1963 }
+ − 1964
+ − 1965 static void
+ − 1966 copy_newtextmetrica_to_newtextmetricw (const NEWTEXTMETRICA *src,
+ − 1967 NEWTEXTMETRICW *dst)
+ − 1968 {
+ − 1969 /* the layout of NEWTEXTMETRIC is
+ − 1970
+ − 1971 non-split fields;
+ − 1972 WCHAR/BYTE tmFirstChar;
+ − 1973 WCHAR/BYTE tmLastChar;
+ − 1974 WCHAR/BYTE tmDefaultChar;
+ − 1975 WCHAR/BYTE tmBreakChar;
+ − 1976 BYTE tmItalic;
+ − 1977 non-split fields;
+ − 1978 */
+ − 1979 xzero (*dst);
+ − 1980 memcpy ((char *) dst, (char *) src,
+ − 1981 offsetof (NEWTEXTMETRICA, tmFirstChar));
+ − 1982 memcpy ((char *) dst + offsetof (NEWTEXTMETRICW, tmItalic),
+ − 1983 (char *) src + offsetof (NEWTEXTMETRICA, tmItalic),
+ − 1984 sizeof (NEWTEXTMETRICA) - offsetof (NEWTEXTMETRICA, tmItalic));
+ − 1985 dst->tmFirstChar = (WCHAR) src->tmFirstChar;
+ − 1986 dst->tmLastChar = (WCHAR) src->tmLastChar;
+ − 1987 dst->tmDefaultChar = (WCHAR) src->tmDefaultChar;
+ − 1988 dst->tmBreakChar = (WCHAR) src->tmBreakChar;
+ − 1989 }
+ − 1990
+ − 1991 static void
+ − 1992 copy_newtextmetricexa_to_newtextmetricexw (const NEWTEXTMETRICEXA *src,
+ − 1993 NEWTEXTMETRICEXW *dst)
+ − 1994 {
+ − 1995 /* the layout of NEWTEXTMETRICEX is
+ − 1996
+ − 1997 NEWTEXTMETRICA/W ntmTm;
+ − 1998 FONTSIGNATURE ntmFontSig;
+ − 1999 */
+ − 2000 copy_newtextmetrica_to_newtextmetricw (&src->ntmTm, &dst->ntmTm);
+ − 2001 dst->ntmFontSig = src->ntmFontSig;
+ − 2002 }
+ − 2003
872
+ − 2004 #if 0 /* unused */
+ − 2005
771
+ − 2006 static void
+ − 2007 copy_textmetricw_to_textmetrica (const TEXTMETRICW *src,
+ − 2008 TEXTMETRICA *dst)
+ − 2009 {
+ − 2010 /* the layout of TEXTMETRIC is like NEWTEXTMETRIC; see above. */
+ − 2011 xzero (*dst);
+ − 2012 memcpy ((char *) dst, (char *) src,
+ − 2013 offsetof (TEXTMETRICA, tmFirstChar));
+ − 2014 memcpy ((char *) dst + offsetof (TEXTMETRICA, tmItalic),
+ − 2015 (char *) src + offsetof (TEXTMETRICW, tmItalic),
+ − 2016 sizeof (TEXTMETRICA) - offsetof (TEXTMETRICA, tmItalic));
+ − 2017 dst->tmFirstChar = (BYTE) src->tmFirstChar;
+ − 2018 dst->tmLastChar = (BYTE) src->tmLastChar;
+ − 2019 dst->tmDefaultChar = (BYTE) src->tmDefaultChar;
+ − 2020 dst->tmBreakChar = (BYTE) src->tmBreakChar;
+ − 2021 }
+ − 2022
872
+ − 2023 #endif /* 0 */
+ − 2024
771
+ − 2025 static void
+ − 2026 copy_textmetrica_to_textmetricw (const TEXTMETRICA *src,
+ − 2027 TEXTMETRICW *dst)
+ − 2028 {
+ − 2029 /* the layout of TEXTMETRIC is like NEWTEXTMETRIC; see above. */
+ − 2030 xzero (*dst);
+ − 2031 memcpy ((char *) dst, (char *) src,
+ − 2032 offsetof (TEXTMETRICA, tmFirstChar));
+ − 2033 memcpy ((char *) dst + offsetof (TEXTMETRICW, tmItalic),
+ − 2034 (char *) src + offsetof (TEXTMETRICA, tmItalic),
+ − 2035 sizeof (TEXTMETRICA) - offsetof (TEXTMETRICA, tmItalic));
+ − 2036 dst->tmFirstChar = (WCHAR) src->tmFirstChar;
+ − 2037 dst->tmLastChar = (WCHAR) src->tmLastChar;
+ − 2038 dst->tmDefaultChar = (WCHAR) src->tmDefaultChar;
+ − 2039 dst->tmBreakChar = (WCHAR) src->tmBreakChar;
+ − 2040 }
+ − 2041
+ − 2042 typedef int (CALLBACK *qxeEnumFontFamExProcW) (ENUMLOGFONTEXW *lpelfe,
+ − 2043 NEWTEXTMETRICEXW *lpntme,
+ − 2044 DWORD FontType,
+ − 2045 LPARAM lParam);
+ − 2046
+ − 2047 struct qxeEnumFontFamExProcA_wrapper_t
+ − 2048 {
+ − 2049 qxeEnumFontFamExProcW orig_proc;
+ − 2050 LPARAM orig_lparam;
+ − 2051 };
+ − 2052
+ − 2053 static int CALLBACK
+ − 2054 qxeEnumFontFamExProcA_wrapper (ENUMLOGFONTEXA *lpelfe,
+ − 2055 NEWTEXTMETRICEXA *lpntme,
+ − 2056 DWORD fontType,
+ − 2057 struct qxeEnumFontFamExProcA_wrapper_t
+ − 2058 *closure)
+ − 2059 {
+ − 2060 ENUMLOGFONTEXW lpelfew;
+ − 2061 NEWTEXTMETRICEXW lpntmew;
+ − 2062
+ − 2063 /* #### if we're on Windows 2000 or above, lpelfe is actually an
+ − 2064 ENUMLOGFONTEXDV structure, and lpntme is an ENUMTEXTMETRIC structure
+ − 2065 when TRUETYPE_FONTTYPE. both are split-sized and need their own copy
+ − 2066 functions. need to handle. */
+ − 2067 copy_enumlogfontexa_to_enumlogfontexw (lpelfe, &lpelfew);
+ − 2068 if (fontType & TRUETYPE_FONTTYPE)
+ − 2069 copy_newtextmetricexa_to_newtextmetricexw (lpntme, &lpntmew);
+ − 2070 else
+ − 2071 {
+ − 2072 /* see docs of EnumFontFamExProc */
+ − 2073 xzero (lpntmew);
+ − 2074 copy_textmetrica_to_textmetricw ((TEXTMETRICA *) lpntme,
+ − 2075 (TEXTMETRICW *) &lpntmew);
+ − 2076 }
+ − 2077 return (closure->orig_proc) (&lpelfew, &lpntmew, fontType,
+ − 2078 closure->orig_lparam);
+ − 2079 }
+ − 2080
+ − 2081 int
+ − 2082 qxeEnumFontFamiliesEx (HDC hdc, LOGFONTW *lpLogfont,
+ − 2083 FONTENUMPROCW lpEnumFontFamProc, LPARAM lParam,
+ − 2084 DWORD dwFlags)
+ − 2085 {
+ − 2086 if (XEUNICODE_P)
+ − 2087 return EnumFontFamiliesExW (hdc, lpLogfont, lpEnumFontFamProc, lParam,
+ − 2088 dwFlags);
+ − 2089 else
+ − 2090 {
+ − 2091 struct qxeEnumFontFamExProcA_wrapper_t closure;
+ − 2092 LOGFONTA lfa;
+ − 2093
+ − 2094 closure.orig_proc = (qxeEnumFontFamExProcW) lpEnumFontFamProc;
+ − 2095 closure.orig_lparam = lParam;
+ − 2096 copy_logfontw_to_logfonta (lpLogfont, &lfa);
+ − 2097 return EnumFontFamiliesExA (hdc, &lfa,
+ − 2098 (FONTENUMPROCA)
+ − 2099 qxeEnumFontFamExProcA_wrapper,
+ − 2100 (LPARAM) &closure, dwFlags);
+ − 2101 }
+ − 2102 }
+ − 2103
+ − 2104 HFONT
+ − 2105 qxeCreateFontIndirect (CONST LOGFONTW *lplf)
+ − 2106 {
+ − 2107 if (XEUNICODE_P)
+ − 2108 return CreateFontIndirectW (lplf);
+ − 2109 else
+ − 2110 {
+ − 2111 LOGFONTA lfa;
+ − 2112
+ − 2113 copy_logfontw_to_logfonta (lplf, &lfa);
+ − 2114 return CreateFontIndirectA (&lfa);
+ − 2115 }
+ − 2116 }
+ − 2117
+ − 2118 BOOL
+ − 2119 qxeImmSetCompositionFont (HIMC imc, LOGFONTW *lplf)
+ − 2120 {
+ − 2121 if (XEUNICODE_P)
+ − 2122 return ImmSetCompositionFontW (imc, lplf);
+ − 2123 else
+ − 2124 {
+ − 2125 LOGFONTA lfa;
+ − 2126
+ − 2127 copy_logfontw_to_logfonta (lplf, &lfa);
+ − 2128 return ImmSetCompositionFontA (imc, &lfa);
+ − 2129 }
+ − 2130 }
+ − 2131
+ − 2132 BOOL
+ − 2133 qxeImmGetCompositionFont (HIMC imc, LOGFONTW *lplf)
+ − 2134 {
+ − 2135 if (XEUNICODE_P)
+ − 2136 return ImmGetCompositionFontW (imc, lplf);
+ − 2137 else
+ − 2138 {
+ − 2139 LOGFONTA lfa;
+ − 2140 BOOL retval = ImmGetCompositionFontA (imc, &lfa);
+ − 2141
+ − 2142 if (retval)
+ − 2143 copy_logfonta_to_logfontw (&lfa, lplf);
+ − 2144 return retval;
+ − 2145 }
+ − 2146 }
+ − 2147
+ − 2148 int
+ − 2149 qxeGetObject (HGDIOBJ hgdiobj, int cbBuffer, LPVOID lpvObject)
+ − 2150 {
+ − 2151 if (XEUNICODE_P)
+ − 2152 return GetObjectW (hgdiobj, cbBuffer, lpvObject);
+ − 2153 else
+ − 2154 {
+ − 2155 if (cbBuffer == sizeof (LOGFONTW))
+ − 2156 {
+ − 2157 LOGFONTA lfa;
+ − 2158 int retval = GetObjectA (hgdiobj, sizeof (LOGFONTA), &lfa);
+ − 2159
+ − 2160 if (!retval)
+ − 2161 return retval;
+ − 2162 copy_logfonta_to_logfontw (&lfa, (LOGFONTW *) lpvObject);
+ − 2163 return retval;
+ − 2164 }
+ − 2165 else
+ − 2166 return GetObjectA (hgdiobj, cbBuffer, lpvObject);
+ − 2167 }
+ − 2168 }
+ − 2169
+ − 2170 BOOL
+ − 2171 qxeGetTextMetrics (HDC hdc, LPTEXTMETRICW lptm)
+ − 2172 {
+ − 2173 if (XEUNICODE_P)
+ − 2174 return GetTextMetricsW (hdc, lptm);
+ − 2175 else
+ − 2176 {
+ − 2177 TEXTMETRICA tma;
+ − 2178 BOOL retval = GetTextMetricsA (hdc, &tma);
+ − 2179
+ − 2180 if (retval)
+ − 2181 copy_textmetrica_to_textmetricw (&tma, lptm);
+ − 2182 return retval;
+ − 2183 }
+ − 2184 }
+ − 2185
+ − 2186
+ − 2187 /************************************************************************/
+ − 2188 /* windows */
+ − 2189 /************************************************************************/
+ − 2190
+ − 2191 typedef struct Intercepted_wnd_proc
+ − 2192 {
+ − 2193 WNDPROC proc;
+ − 2194 Extbyte *name;
+ − 2195 int is_ansi;
+ − 2196 } Intercepted_wnd_proc;
+ − 2197
+ − 2198 typedef struct
+ − 2199 {
+ − 2200 Dynarr_declare (Intercepted_wnd_proc);
+ − 2201 } Intercepted_wnd_proc_dynarr;
+ − 2202
+ − 2203 static Intercepted_wnd_proc_dynarr *intercepted_wnd_procs;
+ − 2204
+ − 2205 static Intercepted_wnd_proc *
+ − 2206 find_window_class (const Extbyte *name, int is_ansi)
+ − 2207 {
+ − 2208 int i;
+ − 2209
+ − 2210 if (!intercepted_wnd_procs)
+ − 2211 intercepted_wnd_procs = Dynarr_new (Intercepted_wnd_proc);
+ − 2212
+ − 2213 for (i = 0; i < Dynarr_length (intercepted_wnd_procs); i++)
+ − 2214 {
+ − 2215 Intercepted_wnd_proc *s = Dynarr_atp (intercepted_wnd_procs, i);
+ − 2216
+ − 2217 if (s->is_ansi == is_ansi && (is_ansi ? !strcmp (s->name, name) :
+ − 2218 !wcscmp ((wchar_t *) s->name,
+ − 2219 (wchar_t *) name)))
+ − 2220 return s;
+ − 2221 }
+ − 2222
+ − 2223 return 0;
+ − 2224 }
+ − 2225
+ − 2226 /* ####
+ − 2227
+ − 2228 check problem with cutting and pasting in my current mule -- if i cut,
+ − 2229 then go to another application, then switch back to this one and
+ − 2230 paste, it seems to get confused -- loses the size or something?
+ − 2231
+ − 2232 other things: split flags on CreateProcess and DDE stuff should be
+ − 2233 handled by us.
+ − 2234 */
+ − 2235
+ − 2236 static LRESULT WINAPI
+ − 2237 intercepted_wnd_proc (HWND hwnd, UINT message_, WPARAM wParam, LPARAM lParam)
+ − 2238 {
+ − 2239 Intercepted_wnd_proc *s;
+ − 2240 int is_ansi = XEUNICODE_P ? !IsWindowUnicode (hwnd) : 1;
+ − 2241 Extbyte *classname;
+ − 2242 int size = 100;
+ − 2243
+ − 2244 /* Just in case XEUNICODE_P changes during the execution of the program
+ − 2245 (admittedly, unlikely), check whether the window is Unicode and keep
+ − 2246 track of this in the list of classes. */
+ − 2247 while (1)
+ − 2248 {
+ − 2249 classname = alloca_extbytes (size * XETCHAR_SIZE);
+ − 2250 if ((is_ansi ? GetClassNameA (hwnd, (LPSTR) classname, size) :
+ − 2251 GetClassNameW (hwnd, (LPWSTR) classname, size)) < size - 1)
+ − 2252 break;
+ − 2253 size *= 2;
+ − 2254 }
+ − 2255
+ − 2256 s = find_window_class (classname, is_ansi);
+ − 2257
+ − 2258 assert (s);
+ − 2259
+ − 2260 if (message_ == WM_NOTIFY)
+ − 2261 {
+ − 2262 LPNMHDR nmhdr = (LPNMHDR) lParam;
+ − 2263 int putback = nmhdr->code;
+ − 2264 int do_putback = 0;
+ − 2265
+ − 2266 #define FROB(msg) \
+ − 2267 case msg##W: \
+ − 2268 /* split structures are the same size, so no conversion necessary */ \
+ − 2269 nmhdr->code = (UINT) msg##A; \
+ − 2270 do_putback = 1; \
+ − 2271 break;
+ − 2272 switch (nmhdr->code)
+ − 2273 {
+ − 2274 /* NMHEADER */
+ − 2275 FROB (HDN_ITEMCHANGING);
+ − 2276 FROB (HDN_ITEMCHANGED);
+ − 2277 FROB (HDN_ITEMCLICK);
+ − 2278 FROB (HDN_ITEMDBLCLICK);
+ − 2279 FROB (HDN_DIVIDERDBLCLICK);
+ − 2280 FROB (HDN_BEGINTRACK);
+ − 2281 FROB (HDN_ENDTRACK);
+ − 2282 FROB (HDN_TRACK);
+ − 2283 /* NMDISPINFO */
+ − 2284 FROB (HDN_GETDISPINFO);
+ − 2285 /* NMTBGETINFOTIP */
+ − 2286 FROB (TBN_GETINFOTIP);
+ − 2287 /* NMTBDISPINFO */
+ − 2288 FROB (TBN_GETDISPINFO);
+ − 2289 /* NMTOOLBAR */
+ − 2290 FROB (TBN_GETBUTTONINFO);
+ − 2291
+ − 2292 /* split-sized NMTTDISPINFO */
+ − 2293 FROB (TTN_GETDISPINFO); /* handle the ...W case; then handle the
+ − 2294 ...A case specially, since we need to
+ − 2295 mess with the structure */
+ − 2296 case TTN_GETDISPINFOA: /* same as TTN_NEEDTEXTA */
+ − 2297 {
+ − 2298 NMTTDISPINFOW *nmw = alloca_new (NMTTDISPINFOW);
+ − 2299 NMTTDISPINFOA *nma = (NMTTDISPINFOA *) lParam;
+ − 2300 LRESULT retval;
+ − 2301 /* the layout of NMTTDISPINFO is
+ − 2302
+ − 2303 non-split fields;
+ − 2304 TCHAR szText[...];
+ − 2305 non-split fields;
+ − 2306 */
+ − 2307
+ − 2308 xzero (*nmw);
+ − 2309 /* copy to ...W struct for Unicode code */
+ − 2310 memcpy ((char *) nmw, (char *) nma,
+ − 2311 offsetof (NMTTDISPINFOA, szText));
+ − 2312 memcpy ((char *) nmw + offsetof (NMTTDISPINFOW, szText) +
+ − 2313 sizeof (nmw->szText),
+ − 2314 (char *) nma + offsetof (NMTTDISPINFOA, szText) +
+ − 2315 sizeof (nma->szText),
+ − 2316 sizeof (NMTTDISPINFOA) -
+ − 2317 (offsetof (NMTTDISPINFOA, szText) + sizeof (nma->szText)));
+ − 2318 memcpy (nmw->szText, nma->szText, sizeof (nma->szText));
+ − 2319 retval = (s->proc) (hwnd, message_, wParam, lParam);
+ − 2320 /* copy back to ...A struct */
+ − 2321 xzero (*nma);
+ − 2322 memcpy ((char *) nma, (char *) nmw,
+ − 2323 offsetof (NMTTDISPINFOA, szText));
+ − 2324 memcpy ((char *) nma + offsetof (NMTTDISPINFOA, szText) +
+ − 2325 sizeof (nma->szText),
+ − 2326 (char *) nmw + offsetof (NMTTDISPINFOW, szText) +
+ − 2327 sizeof (nmw->szText),
+ − 2328 sizeof (NMTTDISPINFOA) -
+ − 2329 (offsetof (NMTTDISPINFOA, szText) + sizeof (nma->szText)));
+ − 2330 memcpy (nma->szText, nmw->szText, sizeof (nma->szText));
+ − 2331 return retval;
+ − 2332 }
+ − 2333
+ − 2334 /* NMLVFINDITEM */
+ − 2335 FROB (LVN_ODFINDITEM);
+ − 2336 /* NMLVDISPINFO */
+ − 2337 FROB (LVN_BEGINLABELEDIT);
+ − 2338 FROB (LVN_ENDLABELEDIT);
+ − 2339 FROB (LVN_GETDISPINFO);
+ − 2340 FROB (LVN_SETDISPINFO);
+ − 2341 /* NMLVGETINFOTIP */
+ − 2342 FROB (LVN_GETINFOTIP);
+ − 2343 /* NMTREEVIEW */
+ − 2344 FROB (TVN_SELCHANGING);
+ − 2345 FROB (TVN_SELCHANGED);
+ − 2346 FROB (TVN_ITEMEXPANDING);
+ − 2347 FROB (TVN_ITEMEXPANDED);
+ − 2348 FROB (TVN_BEGINDRAG);
+ − 2349 FROB (TVN_BEGINRDRAG);
+ − 2350 FROB (TVN_DELETEITEM);
+ − 2351 /* NMTVDISPINFO */
+ − 2352 FROB (TVN_GETDISPINFO);
+ − 2353 FROB (TVN_SETDISPINFO);
+ − 2354 FROB (TVN_BEGINLABELEDIT);
+ − 2355 FROB (TVN_ENDLABELEDIT);
+ − 2356 /* NMTVGETINFOTIP */
+ − 2357 FROB (TVN_GETINFOTIP);
+ − 2358 /* NMCOMBOBOXEX */
+ − 2359 FROB (CBEN_GETDISPINFO);
+ − 2360
+ − 2361 /* split-sized NMCBEDRAGBEGIN */
+ − 2362 FROB (CBEN_DRAGBEGIN); /* handle the ...W case; then handle the
+ − 2363 ...A case specially, since we need to
+ − 2364 mess with the structure */
+ − 2365 {
+ − 2366 NMCBEDRAGBEGINW *nmw = alloca_new (NMCBEDRAGBEGINW);
+ − 2367 NMCBEDRAGBEGINA *nma = (NMCBEDRAGBEGINA *) lParam;
+ − 2368 LRESULT retval;
+ − 2369 /* the layout of NNMCBEDRAGBEGIN is
+ − 2370
+ − 2371 non-split fields;
+ − 2372 TCHAR szText[...];
+ − 2373 */
+ − 2374
+ − 2375 xzero (*nmw);
+ − 2376 /* copy to ...W struct for Unicode code */
+ − 2377 memcpy ((char *) nmw, (char *) nma,
+ − 2378 sizeof (*nma));
+ − 2379 retval = (s->proc) (hwnd, message_, wParam, lParam);
+ − 2380 /* copy back to ...A struct */
+ − 2381 xzero (*nma);
+ − 2382 memcpy ((char *) nma, (char *) nmw,
+ − 2383 sizeof (*nma));
+ − 2384 return retval;
+ − 2385 }
+ − 2386
+ − 2387 /* split-sized NMCBEENDEDIT */
+ − 2388 FROB (CBEN_ENDEDIT); /* handle the ...W case; then handle the
+ − 2389 ...A case specially, since we need to
+ − 2390 mess with the structure */
+ − 2391 {
+ − 2392 NMCBEENDEDITW *nmw = alloca_new (NMCBEENDEDITW);
+ − 2393 NMCBEENDEDITA *nma = (NMCBEENDEDITA *) lParam;
+ − 2394 LRESULT retval;
+ − 2395 /* the layout of NMCBEENDEDIT is
+ − 2396
+ − 2397 non-split fields;
+ − 2398 TCHAR szText[...];
+ − 2399 non-split fields;
+ − 2400 */
+ − 2401
+ − 2402 xzero (*nmw);
+ − 2403 /* copy to ...W struct for Unicode code */
+ − 2404 memcpy ((char *) nmw, (char *) nma,
+ − 2405 offsetof (NMCBEENDEDITA, szText));
+ − 2406 memcpy ((char *) nmw + offsetof (NMCBEENDEDITW, szText) +
+ − 2407 sizeof (nmw->szText),
+ − 2408 (char *) nma + offsetof (NMCBEENDEDITA, szText) +
+ − 2409 sizeof (nma->szText),
+ − 2410 sizeof (NMCBEENDEDITA) -
+ − 2411 (offsetof (NMCBEENDEDITA, szText) + sizeof (nma->szText)));
+ − 2412 memcpy (nmw->szText, nma->szText, sizeof (nma->szText));
+ − 2413 retval = (s->proc) (hwnd, message_, wParam, lParam);
+ − 2414 /* copy back to ...A struct */
+ − 2415 xzero (*nma);
+ − 2416 memcpy ((char *) nma, (char *) nmw,
+ − 2417 offsetof (NMCBEENDEDITA, szText));
+ − 2418 memcpy ((char *) nma + offsetof (NMCBEENDEDITA, szText) +
+ − 2419 sizeof (nma->szText),
+ − 2420 (char *) nmw + offsetof (NMCBEENDEDITW, szText) +
+ − 2421 sizeof (nmw->szText),
+ − 2422 sizeof (NMCBEENDEDITA) -
+ − 2423 (offsetof (NMCBEENDEDITA, szText) + sizeof (nma->szText)));
+ − 2424 memcpy (nma->szText, nmw->szText, sizeof (nma->szText));
+ − 2425 return retval;
+ − 2426 }
+ − 2427
+ − 2428 /* NMDATETIMESTRING */
+ − 2429 FROB (DTN_USERSTRING);
+ − 2430 /* NMDATETIMEWMKEYDOWN */
+ − 2431 FROB (DTN_WMKEYDOWN);
+ − 2432
+ − 2433 /* split-sized NMDATETIMEFORMAT */
+ − 2434 FROB (DTN_FORMAT); /* handle the ...W case; then handle the
+ − 2435 ...A case specially, since we need to
+ − 2436 mess with the structure */
+ − 2437 {
+ − 2438 NMDATETIMEFORMATW *nmw = alloca_new (NMDATETIMEFORMATW);
+ − 2439 NMDATETIMEFORMATA *nma = (NMDATETIMEFORMATA *) lParam;
+ − 2440 LRESULT retval;
+ − 2441 /* the layout of NMDATETIMEFORMAT is
+ − 2442
+ − 2443 non-split fields;
+ − 2444 TCHAR szText[...];
+ − 2445 */
+ − 2446
+ − 2447 xzero (*nmw);
+ − 2448 /* copy to ...W struct for Unicode code */
+ − 2449 memcpy ((char *) nmw, (char *) nma,
+ − 2450 sizeof (*nma));
+ − 2451 retval = (s->proc) (hwnd, message_, wParam, lParam);
+ − 2452 /* copy back to ...A struct */
+ − 2453 xzero (*nma);
+ − 2454 memcpy ((char *) nma, (char *) nmw,
+ − 2455 sizeof (*nma));
+ − 2456 return retval;
+ − 2457 }
+ − 2458
+ − 2459 /* NMDATETIMEFORMATQUERY */
+ − 2460 FROB (DTN_FORMATQUERY);
+ − 2461 default: break;
+ − 2462 }
+ − 2463 #undef FROB
+ − 2464 if (do_putback)
+ − 2465 {
+ − 2466 LRESULT retval = (s->proc) (hwnd, message_, wParam, lParam);
+ − 2467 ((LPNMHDR) lParam)->code = putback;
+ − 2468 return retval;
+ − 2469 }
+ − 2470 }
+ − 2471
+ − 2472 return (s->proc) (hwnd, message_, wParam, lParam);
+ − 2473 }
+ − 2474
+ − 2475 ATOM
+ − 2476 qxeRegisterClass (CONST WNDCLASSW * lpWndClass)
+ − 2477 {
+ − 2478 Intercepted_wnd_proc *s =
+ − 2479 find_window_class ((Extbyte *) lpWndClass->lpszClassName, !XEUNICODE_P);
+ − 2480 WNDCLASSW classnew;
+ − 2481
+ − 2482 if (s)
+ − 2483 {
+ − 2484 s->proc = lpWndClass->lpfnWndProc;
+ − 2485 s->name = (Extbyte *) lpWndClass->lpszClassName;
+ − 2486 s->is_ansi = !XEUNICODE_P;
+ − 2487 }
+ − 2488 else
+ − 2489 {
+ − 2490 Intercepted_wnd_proc news;
+ − 2491 news.proc = lpWndClass->lpfnWndProc;
+ − 2492 news.name = (Extbyte *) lpWndClass->lpszClassName;
+ − 2493 news.is_ansi = !XEUNICODE_P;
+ − 2494 Dynarr_add (intercepted_wnd_procs, news);
+ − 2495 }
+ − 2496 classnew = *lpWndClass;
+ − 2497 classnew.lpfnWndProc = intercepted_wnd_proc;
+ − 2498 if (XEUNICODE_P)
+ − 2499 return RegisterClassW (&classnew);
+ − 2500 else
+ − 2501 return RegisterClassA ((CONST WNDCLASSA *) &classnew);
+ − 2502 }
+ − 2503
+ − 2504 BOOL
+ − 2505 qxeUnregisterClass (const Extbyte * lpClassName, HINSTANCE hInstance)
+ − 2506 {
+ − 2507 Intercepted_wnd_proc *s =
+ − 2508 find_window_class (lpClassName, !XEUNICODE_P);
+ − 2509
+ − 2510 if (s)
+ − 2511 Dynarr_delete_by_pointer (intercepted_wnd_procs, s);
+ − 2512 if (XEUNICODE_P)
+ − 2513 return UnregisterClassW ((LPCWSTR) lpClassName, hInstance);
+ − 2514 else
+ − 2515 return UnregisterClassA ((LPCSTR) lpClassName, hInstance);
+ − 2516 }
+ − 2517
+ − 2518 /* NOTE: NT 4.0+ only */
+ − 2519 ATOM
+ − 2520 qxeRegisterClassEx (CONST WNDCLASSEXW *lpWndClass)
+ − 2521 {
+ − 2522 Intercepted_wnd_proc *s =
+ − 2523 find_window_class ((Extbyte *) lpWndClass->lpszClassName, !XEUNICODE_P);
+ − 2524 WNDCLASSEXW classnew;
+ − 2525
+ − 2526 if (s)
+ − 2527 {
+ − 2528 s->proc = lpWndClass->lpfnWndProc;
+ − 2529 s->name = (Extbyte *) lpWndClass->lpszClassName;
+ − 2530 s->is_ansi = !XEUNICODE_P;
+ − 2531 }
+ − 2532 else
+ − 2533 {
+ − 2534 Intercepted_wnd_proc news;
+ − 2535 news.proc = lpWndClass->lpfnWndProc;
+ − 2536 news.name = (Extbyte *) lpWndClass->lpszClassName;
+ − 2537 news.is_ansi = !XEUNICODE_P;
+ − 2538 Dynarr_add (intercepted_wnd_procs, news);
+ − 2539 }
+ − 2540 classnew = *lpWndClass;
+ − 2541 classnew.lpfnWndProc = intercepted_wnd_proc;
+ − 2542 if (XEUNICODE_P)
+ − 2543 return RegisterClassExW (&classnew);
+ − 2544 else
+ − 2545 return RegisterClassExA ((CONST WNDCLASSEXA *) &classnew);
+ − 2546 }
+ − 2547
+ − 2548
+ − 2549 /************************************************************************/
+ − 2550 /* COMMCTRL.H */
+ − 2551 /************************************************************************/
+ − 2552
+ − 2553 /* there are only four structures in commctrl.h that cannot be cast
+ − 2554 between Unicode/ANSI versions:
+ − 2555
+ − 2556 NMTTDISPINFO aka TOOLTIPTEXT
+ − 2557 NMCBEDRAGBEGIN
+ − 2558 NMCBEENDEDIT
+ − 2559 NMDATETIMEFORMAT
+ − 2560
+ − 2561 these are all notify structures, and we handle them above in
+ − 2562 intercepted_wnd_proc().
+ − 2563
+ − 2564 in addition, this constant is weird, being a struct size of one of these:
+ − 2565
+ − 2566 NMTTDISPINFO_V1_SIZE
+ − 2567 */
+ − 2568
+ − 2569 /*
+ − 2570 split class names:
+ − 2571
+ − 2572 WC_HEADER
+ − 2573 TOOLBARCLASSNAME
+ − 2574 REBARCLASSNAME
+ − 2575 TOOLTIPS_CLASS
+ − 2576 STATUSCLASSNAME
+ − 2577 TRACKBAR_CLASS
+ − 2578 UPDOWN_CLASS
+ − 2579 PROGRESS_CLASS
+ − 2580 HOTKEY_CLASS
+ − 2581 WC_LISTVIEW
+ − 2582 WC_TREEVIEW
+ − 2583 WC_COMBOBOXEX
+ − 2584 WC_TABCONTROL
+ − 2585 ANIMATE_CLASS
+ − 2586 MONTHCAL_CLASS
+ − 2587 DATETIMEPICK_CLASS
+ − 2588 WC_IPADDRESS
+ − 2589 WC_PAGESCROLLER
+ − 2590 WC_NATIVEFONTCTL
+ − 2591 */
+ − 2592
+ − 2593 /*
+ − 2594 SendMessage split messages:
+ − 2595
+ − 2596 HDM_INSERTITEM
+ − 2597 HDM_GETITEM
+ − 2598 HDM_SETITEM
+ − 2599 TB_GETBUTTONTEXT
+ − 2600 TB_SAVERESTORE
+ − 2601 TB_ADDSTRING
+ − 2602 TB_GETBUTTONINFO
+ − 2603 TB_SETBUTTONINFO
+ − 2604 TB_INSERTBUTTON
+ − 2605 TB_ADDBUTTONS
+ − 2606 RB_INSERTBAND
+ − 2607 RB_SETBANDINFO
+ − 2608 RB_GETBANDINFO
+ − 2609 TTM_ADDTOOL
+ − 2610 TTM_DELTOOL
+ − 2611 TTM_NEWTOOLRECT
+ − 2612 TTM_GETTOOLINFO
+ − 2613 TTM_SETTOOLINFO
+ − 2614 TTM_HITTEST
+ − 2615 TTM_GETTEXT
+ − 2616 TTM_UPDATETIPTEXT
+ − 2617 TTM_ENUMTOOLS
+ − 2618 TTM_GETCURRENTTOOL
+ − 2619 SB_GETTEXT
+ − 2620 SB_SETTEXT
+ − 2621 SB_GETTEXTLENGTH
+ − 2622 SB_SETTIPTEXT
+ − 2623 SB_GETTIPTEXT
+ − 2624 LVM_GETITEM
+ − 2625 LVM_SETITEM
+ − 2626 LVM_INSERTITEM
+ − 2627 LVM_FINDITEM
+ − 2628 LVM_GETSTRINGWIDTH
+ − 2629 LVM_EDITLABEL
+ − 2630 LVM_GETCOLUMN
+ − 2631 LVM_SETCOLUMN
+ − 2632 LVM_GETITEMTEXT
+ − 2633 LVM_SETITEMTEXT
+ − 2634 LVM_GETISEARCHSTRING
+ − 2635 LVM_SETBKIMAGE
+ − 2636 LVM_GETBKIMAGE
+ − 2637 TVM_INSERTITEM
+ − 2638 TVM_GETITEM
+ − 2639 TVM_SETITEM
+ − 2640 TVM_EDITLABEL
+ − 2641 TVM_GETISEARCHSTRING
+ − 2642 CBEM_INSERTITEM
+ − 2643 CBEM_SETITEM
+ − 2644 CBEM_GETITEM
+ − 2645 TCM_GETITEM
+ − 2646 TCM_SETITEM
+ − 2647 TCM_INSERTITEM
+ − 2648 ACM_OPEN
+ − 2649 DTM_SETFORMAT
+ − 2650 BFFM_SETSTATUSTEXT
+ − 2651 BFFM_SETSELECTION
+ − 2652 */
+ − 2653
+ − 2654 /*
+ − 2655 split notify messages:
+ − 2656
+ − 2657 HDN_ITEMCHANGING
+ − 2658 HDN_ITEMCHANGED
+ − 2659 HDN_ITEMCLICK
+ − 2660 HDN_ITEMDBLCLICK
+ − 2661 HDN_DIVIDERDBLCLICK
+ − 2662 HDN_BEGINTRACK
+ − 2663 HDN_ENDTRACK
+ − 2664 HDN_TRACK
+ − 2665 HDN_GETDISPINFO
+ − 2666 TBN_GETINFOTIP
+ − 2667 TBN_GETDISPINFO
+ − 2668 TBN_GETBUTTONINFO
+ − 2669 TTN_GETDISPINFO
+ − 2670 TTN_NEEDTEXTW
+ − 2671 LVN_ODFINDITEM
+ − 2672 LVN_BEGINLABELEDIT
+ − 2673 LVN_ENDLABELEDIT
+ − 2674 LVN_GETDISPINFO
+ − 2675 LVN_SETDISPINFO
+ − 2676 LVN_GETINFOTIP
+ − 2677 TVN_SELCHANGING
+ − 2678 TVN_SELCHANGED
+ − 2679 TVN_GETDISPINFO
+ − 2680 TVN_SETDISPINFO
+ − 2681 TVN_ITEMEXPANDING
+ − 2682 TVN_ITEMEXPANDED
+ − 2683 TVN_BEGINDRAG
+ − 2684 TVN_BEGINRDRAG
+ − 2685 TVN_DELETEITEM
+ − 2686 TVN_BEGINLABELEDIT
+ − 2687 TVN_ENDLABELEDIT
+ − 2688 TVN_GETINFOTIP
+ − 2689 CBEN_GETDISPINFO
+ − 2690 CBEN_DRAGBEGIN
+ − 2691 CBEN_ENDEDIT
+ − 2692 DTN_USERSTRING
+ − 2693 DTN_WMKEYDOWN
+ − 2694 DTN_FORMAT
+ − 2695 DTN_FORMATQUERY
+ − 2696 BFFM_VALIDATEFAILED (send to SHBrowseForFolder procedure)
+ − 2697 */
+ − 2698
+ − 2699 /*
+ − 2700 split structures:
+ − 2701
+ − 2702 TV_INSERTSTRUCT (simple-split, though -- just cast)
+ − 2703 TC_ITEM (simple-split, though -- just cast)
+ − 2704
+ − 2705 ####
+ − 2706 */
+ − 2707
+ − 2708 /*
+ − 2709 split macros or macros needing splitting:
+ − 2710
+ − 2711 ####
+ − 2712 */
+ − 2713
+ − 2714 LRESULT
+ − 2715 qxeSendMessage (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+ − 2716 {
+ − 2717 #define FROB(msg) \
+ − 2718 case msg##A: \
+ − 2719 /* split structures are the same size, so no conversion necessary */ \
+ − 2720 Msg = msg##W; \
+ − 2721 break;
+ − 2722
+ − 2723 if (XEUNICODE_P)
+ − 2724 {
+ − 2725 WCHAR classname[100];
+ − 2726 /* the name for SHBrowseForFolder windows is non-obvious so we have
+ − 2727 to intercept the callback */
+ − 2728 if (is_SHBrowseForFolder (hWnd))
+ − 2729 {
+ − 2730 switch (Msg)
+ − 2731 {
+ − 2732 FROB (BFFM_SETSELECTION);
+ − 2733 FROB (BFFM_SETSTATUSTEXT);
+ − 2734 default: break;
+ − 2735 }
+ − 2736 }
+ − 2737 else if (!GetClassNameW (hWnd, classname, 100))
+ − 2738 ;
+ − 2739 /* luckily, subclassing leaves the name alone, so we can still
+ − 2740 determine fairly easily the correct class to switch on */
+ − 2741 else if (!wcscmp (classname, WC_HEADERW))
+ − 2742 {
+ − 2743 switch (Msg)
+ − 2744 {
+ − 2745 FROB (HDM_INSERTITEM);
+ − 2746 FROB (HDM_GETITEM);
+ − 2747 FROB (HDM_SETITEM);
+ − 2748 default: break;
+ − 2749 }
+ − 2750 }
+ − 2751 else if (!wcscmp (classname, TOOLBARCLASSNAMEW))
+ − 2752 {
+ − 2753 switch (Msg)
+ − 2754 {
+ − 2755 FROB (TB_GETBUTTONTEXT);
+ − 2756 FROB (TB_SAVERESTORE);
+ − 2757 FROB (TB_ADDSTRING);
+ − 2758 FROB (TB_GETBUTTONINFO);
+ − 2759 FROB (TB_SETBUTTONINFO);
+ − 2760 FROB (TB_INSERTBUTTON);
+ − 2761 FROB (TB_ADDBUTTONS);
+ − 2762 default: break;
+ − 2763 }
+ − 2764 }
+ − 2765 else if (!wcscmp (classname, REBARCLASSNAMEW))
+ − 2766 {
+ − 2767 switch (Msg)
+ − 2768 {
+ − 2769 FROB (RB_INSERTBAND);
+ − 2770 FROB (RB_SETBANDINFO);
+ − 2771 FROB (RB_GETBANDINFO);
+ − 2772 default: break;
+ − 2773 }
+ − 2774 }
+ − 2775 else if (!wcscmp (classname, TOOLTIPS_CLASSW))
+ − 2776 {
+ − 2777 switch (Msg)
+ − 2778 {
+ − 2779 FROB (TTM_ADDTOOL);
+ − 2780 FROB (TTM_DELTOOL);
+ − 2781 FROB (TTM_NEWTOOLRECT);
+ − 2782 FROB (TTM_GETTOOLINFO);
+ − 2783 FROB (TTM_SETTOOLINFO);
+ − 2784 FROB (TTM_HITTEST);
+ − 2785 FROB (TTM_GETTEXT);
+ − 2786 FROB (TTM_UPDATETIPTEXT);
+ − 2787 FROB (TTM_ENUMTOOLS);
+ − 2788 FROB (TTM_GETCURRENTTOOL);
+ − 2789 default: break;
+ − 2790 }
+ − 2791 }
+ − 2792 else if (!wcscmp (classname, STATUSCLASSNAMEW))
+ − 2793 {
+ − 2794 switch (Msg)
+ − 2795 {
+ − 2796 FROB (SB_GETTEXT);
+ − 2797 FROB (SB_SETTEXT);
+ − 2798 FROB (SB_GETTEXTLENGTH);
+ − 2799 FROB (SB_SETTIPTEXT);
+ − 2800 FROB (SB_GETTIPTEXT);
+ − 2801 default: break;
+ − 2802 }
+ − 2803 }
+ − 2804 else if (!wcscmp (classname, WC_LISTVIEWW))
+ − 2805 {
+ − 2806 switch (Msg)
+ − 2807 {
+ − 2808 FROB (LVM_GETITEM);
+ − 2809 FROB (LVM_SETITEM);
+ − 2810 FROB (LVM_INSERTITEM);
+ − 2811 FROB (LVM_FINDITEM);
+ − 2812 FROB (LVM_GETSTRINGWIDTH);
+ − 2813 FROB (LVM_EDITLABEL);
+ − 2814 FROB (LVM_GETCOLUMN);
+ − 2815 FROB (LVM_SETCOLUMN);
+ − 2816 FROB (LVM_GETITEMTEXT);
+ − 2817 FROB (LVM_SETITEMTEXT);
+ − 2818 FROB (LVM_GETISEARCHSTRING);
+ − 2819 FROB (LVM_SETBKIMAGE);
+ − 2820 FROB (LVM_GETBKIMAGE);
+ − 2821 default: break;
+ − 2822 }
+ − 2823 }
+ − 2824 else if (!wcscmp (classname, WC_TREEVIEWW))
+ − 2825 {
+ − 2826 switch (Msg)
+ − 2827 {
+ − 2828 FROB (TVM_INSERTITEM); /* no need to split TV_INSERTSTRUCT */
+ − 2829 FROB (TVM_GETITEM);
+ − 2830 FROB (TVM_SETITEM);
+ − 2831 FROB (TVM_EDITLABEL);
+ − 2832 FROB (TVM_GETISEARCHSTRING);
+ − 2833 default: break;
+ − 2834 }
+ − 2835 }
+ − 2836 else if (!wcscmp (classname, WC_COMBOBOXEXW))
+ − 2837 {
+ − 2838 switch (Msg)
+ − 2839 {
+ − 2840 FROB (CBEM_INSERTITEM);
+ − 2841 FROB (CBEM_SETITEM);
+ − 2842 FROB (CBEM_GETITEM);
+ − 2843 default: break;
+ − 2844 }
+ − 2845 }
+ − 2846 else if (!wcscmp (classname, WC_TABCONTROLW))
+ − 2847 {
+ − 2848 switch (Msg)
+ − 2849 {
+ − 2850 FROB (TCM_GETITEM);
+ − 2851 FROB (TCM_SETITEM);
+ − 2852 FROB (TCM_INSERTITEM); /* no need to split TC_ITEM */
+ − 2853 default: break;
+ − 2854 }
+ − 2855 }
+ − 2856 else if (!wcscmp (classname, ANIMATE_CLASSW))
+ − 2857 {
+ − 2858 switch (Msg)
+ − 2859 {
+ − 2860 FROB (ACM_OPEN);
+ − 2861 default: break;
+ − 2862 }
+ − 2863 }
+ − 2864 else if (!wcscmp (classname, DATETIMEPICK_CLASSW))
+ − 2865 {
+ − 2866 switch (Msg)
+ − 2867 {
+ − 2868 FROB (DTM_SETFORMAT);
+ − 2869 default: break;
+ − 2870 }
+ − 2871 }
+ − 2872 }
+ − 2873
+ − 2874 if (XEUNICODE_P)
+ − 2875 return SendMessageW (hWnd, Msg, wParam, lParam);
+ − 2876 else
+ − 2877 return SendMessageA (hWnd, Msg, wParam, lParam);
+ − 2878
+ − 2879 #undef FROB
+ − 2880 }
+ − 2881
+ − 2882 #endif /* HAVE_MS_WINDOWS */
+ − 2883
+ − 2884