[PATCH] WIn32 check_writable for 21.5 revised to fix qxe problem and remove MDd usage

Benson Margulies bim2006 at basistech.com
Sat Nov 25 13:50:15 EST 2006


1) Forward port of 21.4 change to make check_writable get the correct
answer in Win32 and cygwin.
2) Remove use of -MDd to allow installers based on debug builds to avoid
dependency on non-redistributable DLLs.  Whomever has the Wyse license
now should add the dependency to the non-debug DLL to the installer. 

lib-src/ChangeLog addition:

2006-11-25  Benson I. Margulies  <benson at dchbk.us>

	* make-mswin-unicode.pl: tolerate lower case name, works better
in cygwin.


nt/ChangeLog addition:

2006-11-25  Benson I. Margulies  <bim2006 at basistech.com>

	* xemacs.mak (C_LIBFLAG): Stop using -MDd to permit the
installer to avoid dependency on 
        nonredistributable.


src/ChangeLog addition:

2006-11-25  Benson I. Margulies  <benson at dchbk.us>

	* fileio.c (check_writable): Use Win32 facilities for proper
check
	* intl-auto-encap-win32.c: regenerated, all looks different.
Purpose
        was to add GetNamedSecurityInfo.
	* intl-auto-encap-win32.c (qxeDragQueryFile):
	* intl-auto-encap-win32.c (qxeShellExecute):
	* intl-auto-encap-win32.c (qxeFindExecutable):
	* intl-auto-encap-win32.c (qxeShellAbout):
	* intl-auto-encap-win32.c (qxeExtractAssociatedIcon):
	* intl-auto-encap-win32.c (qxeExtractIcon):
	* intl-auto-encap-win32.c (qxeDoEnvironmentSubst):
	* intl-auto-encap-win32.c (qxeEnumPrinters):
	* intl-auto-encap-win32.c (qxewvsprintf):
	* intl-auto-encap-win32.c (qxeLoadKeyboardLayout):
	* intl-auto-encap-win32.c (qxeGetKeyboardLayoutName):
	* intl-auto-encap-win32.c (qxeOpenDesktop):
	* intl-auto-encap-win32.c (qxeEnumDesktops):
	* intl-auto-encap-win32.c (qxeCreateWindowStation):
	* intl-auto-encap-win32.c (qxeOpenWindowStation):
	* intl-auto-encap-win32.c (qxeEnumWindowStations):
	* intl-auto-encap-win32.c (qxeGetUserObjectInformation):
	* intl-auto-encap-win32.c (qxeSetUserObjectInformation):
	* intl-auto-encap-win32.c (qxeRegisterWindowMessage):
	* intl-auto-encap-win32.c (qxeGetMessage):
	* intl-auto-encap-win32.c (qxeDispatchMessage):
	* intl-auto-encap-win32.c (qxePeekMessage):
	* intl-auto-encap-win32.c (qxeSendMessageTimeout):
	* intl-auto-encap-win32.c (qxeSendNotifyMessage):
	* intl-auto-encap-win32.c (qxeSendMessageCallback):
	* intl-auto-encap-win32.c (qxePostMessage):
	* intl-auto-encap-win32.c (qxePostThreadMessage):
	* intl-auto-encap-win32.c (qxeGetClassInfo):
	* intl-auto-encap-win32.c (qxeGetClassInfoEx):
	* intl-auto-encap-win32.c (qxeCreateWindowEx):
	* intl-auto-encap-win32.c (qxeCreateDialogParam):
	* intl-auto-encap-win32.c (qxeCreateDialogIndirectParam):
	* intl-auto-encap-win32.c (qxeDialogBoxParam):
	* intl-auto-encap-win32.c (qxeDialogBoxIndirectParam):
	* intl-auto-encap-win32.c (qxeSetDlgItemText):
	* intl-auto-encap-win32.c (qxeGetDlgItemText):
	* intl-auto-encap-win32.c (qxeSendDlgItemMessage):
	* intl-auto-encap-win32.c (qxeCallMsgFilter):
	* intl-auto-encap-win32.c (qxeRegisterClipboardFormat):
	* intl-auto-encap-win32.c (qxeGetClipboardFormatName):
	* intl-auto-encap-win32.c (qxeCharToOem):
	* intl-auto-encap-win32.c (qxeOemToChar):
	* intl-auto-encap-win32.c (qxeCharToOemBuff):
	* intl-auto-encap-win32.c (qxeOemToCharBuff):
	* intl-auto-encap-win32.c (qxeCharUpper):
	* intl-auto-encap-win32.c (qxeCharUpperBuff):
	* intl-auto-encap-win32.c (qxeCharLower):
	* intl-auto-encap-win32.c (qxeCharLowerBuff):
	* intl-auto-encap-win32.c (qxeCharNext):
	* intl-auto-encap-win32.c (qxeCharPrev):
	* intl-auto-encap-win32.c (qxeGetKeyNameText):
	* intl-auto-encap-win32.c (qxeMapVirtualKey):
	* intl-auto-encap-win32.c (qxeMapVirtualKeyEx):
	* intl-auto-encap-win32.c (qxeLoadAccelerators):
	* intl-auto-encap-win32.c (qxeCreateAcceleratorTable):
	* intl-auto-encap-win32.c (qxeCopyAcceleratorTable):
	* intl-auto-encap-win32.c (qxeTranslateAccelerator):
	* intl-auto-encap-win32.c (qxeLoadMenu):
	* intl-auto-encap-win32.c (qxeLoadMenuIndirect):
	* intl-auto-encap-win32.c (qxeChangeMenu):
	* intl-auto-encap-win32.c (qxeGetMenuString):
	* intl-auto-encap-win32.c (qxeInsertMenu):
	* intl-auto-encap-win32.c (qxeAppendMenu):
	* intl-auto-encap-win32.c (qxeModifyMenu):
	* intl-auto-encap-win32.c (qxeInsertMenuItem):
	* intl-auto-encap-win32.c (qxeGetMenuItemInfo):
	* intl-auto-encap-win32.c (qxeSetMenuItemInfo):
	* intl-auto-encap-win32.c (qxeDrawText):
	* intl-auto-encap-win32.c (qxeDrawTextEx):
	* intl-auto-encap-win32.c (qxeGrayString):
	* intl-auto-encap-win32.c (qxeDrawState):
	* intl-auto-encap-win32.c (qxeTabbedTextOut):
	* intl-auto-encap-win32.c (qxeGetTabbedTextExtent):
	* intl-auto-encap-win32.c (qxeSetProp):
	* intl-auto-encap-win32.c (qxeGetProp):
	* intl-auto-encap-win32.c (qxeRemoveProp):
	* intl-auto-encap-win32.c (qxeEnumPropsEx):
	* intl-auto-encap-win32.c (qxeEnumProps):
	* intl-auto-encap-win32.c (qxeSetWindowText):
	* intl-auto-encap-win32.c (qxeGetWindowText):
	* intl-auto-encap-win32.c (qxeGetWindowTextLength):
	* intl-auto-encap-win32.c (qxeMessageBox):
	* intl-auto-encap-win32.c (qxeMessageBoxEx):
	* intl-auto-encap-win32.c (qxeMessageBoxIndirect):
	* intl-auto-encap-win32.c (qxeGetWindowLong):
	* intl-auto-encap-win32.c (qxeSetWindowLong):
	* intl-auto-encap-win32.c (qxeGetClassLong):
	* intl-auto-encap-win32.c (qxeSetClassLong):
	* intl-auto-encap-win32.c (qxeFindWindow):
	* intl-auto-encap-win32.c (qxeFindWindowEx):
	* intl-auto-encap-win32.c (qxeGetClassName):
	* intl-auto-encap-win32.c (qxeSetWindowsHookEx):
	* intl-auto-encap-win32.c (qxeLoadBitmap):
	* intl-auto-encap-win32.c (qxeLoadCursor):
	* intl-auto-encap-win32.c (qxeLoadCursorFromFile):
	* intl-auto-encap-win32.c (qxeLoadIcon):
	* intl-auto-encap-win32.c (qxeLoadImage):
	* intl-auto-encap-win32.c (qxeLoadString):
	* intl-auto-encap-win32.c (qxeIsDialogMessage):
	* intl-auto-encap-win32.c (qxeDlgDirList):
	* intl-auto-encap-win32.c (qxeDlgDirSelectEx):
	* intl-auto-encap-win32.c (qxeDlgDirListComboBox):
	* intl-auto-encap-win32.c (qxeDlgDirSelectComboBoxEx):
	* intl-auto-encap-win32.c (qxeDefFrameProc):
	* intl-auto-encap-win32.c (qxeCreateMDIWindow):
	* intl-auto-encap-win32.c (qxeWinHelp):
	* intl-auto-encap-win32.c (qxeSystemParametersInfo):
	* intl-auto-encap-win32.c (qxeImmInstallIME):
	* intl-auto-encap-win32.c (qxeImmGetIMEFileName):
	* intl-auto-encap-win32.c (qxeImmGetCompositionString):
	* intl-auto-encap-win32.c (qxeImmGetGuideLine):
	* intl-auto-encap-win32.c (qxeImmIsUIMessage):
	* intl-auto-encap-win32.c (qxeImmUnregisterWord):
	* intl-auto-encap-win32.c (qxeWNetCancelConnection2):
	* intl-auto-encap-win32.c (qxeWNetUseConnection):
	* intl-auto-encap-win32.c (qxeWNetConnectionDialog1):
	* intl-auto-encap-win32.c (qxeWNetDisconnectDialog1):
	* intl-auto-encap-win32.c (qxeWNetOpenEnum):
	* intl-auto-encap-win32.c (qxeWNetEnumResource):
	* intl-auto-encap-win32.c (qxeWNetGetUser):
	* intl-auto-encap-win32.c (qxeWNetGetNetworkInformation):
	* intl-auto-encap-win32.c (qxeWNetGetLastError):
	* intl-auto-encap-win32.c (qxeMultinetGetConnectionPerformance):
	* intl-auto-encap-win32.c (qxeDdeInitialize):
	* intl-auto-encap-win32.c (qxeAddFontResource):
	* intl-auto-encap-win32.c (qxeCopyMetaFile):
	* intl-auto-encap-win32.c (qxeCreateFont):
	* intl-auto-encap-win32.c (qxeCreateMetaFile):
	* intl-auto-encap-win32.c (qxeCreateScalableFontResource):
	* intl-auto-encap-win32.c (qxeGetCharWidth):
	* intl-auto-encap-win32.c (qxeGetCharWidth32):
	* intl-auto-encap-win32.c (qxeGetCharWidthFloat):
	* intl-auto-encap-win32.c (qxeGetCharABCWidths):
	* intl-auto-encap-win32.c (qxeGetCharABCWidthsFloat):
	* intl-auto-encap-win32.c (qxeGetGlyphOutline):
	* intl-auto-encap-win32.c (qxeGetMetaFile):
	* intl-auto-encap-win32.c (qxeGetTextExtentPoint):
	* intl-auto-encap-win32.c (qxeGetTextExtentPoint32):
	* intl-auto-encap-win32.c (qxeGetTextExtentExPoint):
	* intl-auto-encap-win32.c (qxeGetCharacterPlacement):
	* intl-auto-encap-win32.c (qxeRemoveFontResource):
	* intl-auto-encap-win32.c (qxeCopyEnhMetaFile):
	* intl-auto-encap-win32.c (qxeCreateEnhMetaFile):
	* intl-auto-encap-win32.c (qxeGetEnhMetaFile):
	* intl-auto-encap-win32.c (qxeGetEnhMetaFileDescription):
	* intl-auto-encap-win32.c (qxeStartDoc):
	* intl-auto-encap-win32.c (qxeTextOut):
	* intl-auto-encap-win32.c (qxeExtTextOut):
	* intl-auto-encap-win32.c (qxePolyTextOut):
	* intl-auto-encap-win32.c (qxeGetTextFace):
	* intl-auto-encap-win32.c (qxeGetKerningPairs):
	* intl-auto-encap-win32.c (qxeSetICMProfile):
	* intl-auto-encap-win32.c (qxeEnumICMProfiles):
	* intl-auto-encap-win32.c (qxeRegEnumValue):
	* intl-auto-encap-win32.c (qxeRegLoadKey):
	* intl-auto-encap-win32.c (qxeRegOpenKey):
	* intl-auto-encap-win32.c (qxeRegOpenKeyEx):
	* intl-auto-encap-win32.c (qxeRegReplaceKey):
	* intl-auto-encap-win32.c (qxeRegRestoreKey):
	* intl-auto-encap-win32.c (qxeRegSetValue):
	* intl-auto-encap-win32.c (qxeRegSetValueEx):
	* intl-auto-encap-win32.c (qxeRegUnLoadKey):
	* intl-auto-encap-win32.c (qxeAbortSystemShutdown):
	* intl-auto-encap-win32.c (qxeGetOpenFileName):
	* intl-auto-encap-win32.c (qxeGetSaveFileName):
	* intl-auto-encap-win32.c (qxeGetFileTitle):
	* intl-auto-encap-win32.c (qxeChooseColor):
	* intl-auto-encap-win32.c (qxeFindText):
	* intl-auto-encap-win32.c (qxeReplaceText):
	* intl-auto-encap-win32.c (qxeGetBinaryType):
	* intl-auto-encap-win32.c (qxeGetShortPathName):
	* intl-auto-encap-win32.c (qxeFreeEnvironmentStrings):
	* intl-auto-encap-win32.c (qxeFormatMessage):
	* intl-auto-encap-win32.c (qxeCreateMailslot):
	* intl-auto-encap-win32.c (qxelstrcmp):
	* intl-auto-encap-win32.c (qxelstrcmpi):
	* intl-auto-encap-win32.c (qxelstrcpyn):
	* intl-auto-encap-win32.c (qxelstrcpy):
	* intl-auto-encap-win32.c (qxelstrcat):
	* intl-auto-encap-win32.c (qxelstrlen):
	* intl-auto-encap-win32.c (qxeCreateMutex):
	* intl-auto-encap-win32.c (qxeOpenMutex):
	* intl-auto-encap-win32.c (qxeCreateEvent):
	* intl-auto-encap-win32.c (qxeOpenEvent):
	* intl-auto-encap-win32.c (qxeCreateSemaphore):
	* intl-auto-encap-win32.c (qxeOpenSemaphore):
	* intl-auto-encap-win32.c (qxeCreateWaitableTimer):
	* intl-auto-encap-win32.c (qxeOpenWaitableTimer):
	* intl-auto-encap-win32.c (qxeCreateFileMapping):
	* intl-auto-encap-win32.c (qxeOpenFileMapping):
	* intl-auto-encap-win32.c (qxeGetLogicalDriveStrings):
	* intl-auto-encap-win32.c (qxeLoadLibrary):
	* intl-auto-encap-win32.c (qxeLoadLibraryEx):
	* intl-auto-encap-win32.c (qxeGetModuleFileName):
	* intl-auto-encap-win32.c (qxeGetModuleHandle):
	* intl-auto-encap-win32.c (qxeCreateProcess):
	* intl-auto-encap-win32.c (qxeFatalAppExit):
	* intl-auto-encap-win32.c (qxeGetStartupInfo):
	* intl-auto-encap-win32.c (qxeGetEnvironmentVariable):
	* intl-auto-encap-win32.c (qxeSetEnvironmentVariable):
	* intl-auto-encap-win32.c (qxeExpandEnvironmentStrings):
	* intl-auto-encap-win32.c (qxeOutputDebugString):
	* intl-auto-encap-win32.c (qxeFindResource):
	* intl-auto-encap-win32.c (qxeFindResourceEx):
	* intl-auto-encap-win32.c (qxeUpdateResource):
	* intl-auto-encap-win32.c (qxeEndUpdateResource):
	* intl-auto-encap-win32.c (qxeGlobalAddAtom):
	* intl-auto-encap-win32.c (qxeGlobalFindAtom):
	* intl-auto-encap-win32.c (qxeGlobalGetAtomName):
	* intl-auto-encap-win32.c (qxeAddAtom):
	* intl-auto-encap-win32.c (qxeFindAtom):
	* intl-auto-encap-win32.c (qxeGetAtomName):
	* intl-auto-encap-win32.c (qxeGetProfileInt):
	* intl-auto-encap-win32.c (qxeGetProfileString):
	* intl-auto-encap-win32.c (qxeWriteProfileString):
	* intl-auto-encap-win32.c (qxeGetProfileSection):
	* intl-auto-encap-win32.c (qxeWriteProfileSection):
	* intl-auto-encap-win32.c (qxeGetPrivateProfileInt):
	* intl-auto-encap-win32.c (qxeGetPrivateProfileString):
	* intl-auto-encap-win32.c (qxeWritePrivateProfileString):
	* intl-auto-encap-win32.c (qxeGetPrivateProfileSection):
	* intl-auto-encap-win32.c (qxeWritePrivateProfileSection):
	* intl-auto-encap-win32.c (qxeGetPrivateProfileSectionNames):
	* intl-auto-encap-win32.c (qxeGetPrivateProfileStruct):
	* intl-auto-encap-win32.c (qxeWritePrivateProfileStruct):
	* intl-auto-encap-win32.c (qxeGetDriveType):
	* intl-auto-encap-win32.c (qxeGetSystemDirectory):
	* intl-auto-encap-win32.c (qxeGetTempPath):
	* intl-auto-encap-win32.c (qxeGetTempFileName):
	* intl-auto-encap-win32.c (qxeGetWindowsDirectory):
	* intl-auto-encap-win32.c (qxeSetCurrentDirectory):
	* intl-auto-encap-win32.c (qxeGetCurrentDirectory):
	* intl-auto-encap-win32.c (qxeGetDiskFreeSpace):
	* intl-auto-encap-win32.c (qxeGetDiskFreeSpaceEx):
	* intl-auto-encap-win32.c (qxeCreateDirectory):
	* intl-auto-encap-win32.c (qxeCreateDirectoryEx):
	* intl-auto-encap-win32.c (qxeRemoveDirectory):
	* intl-auto-encap-win32.c (qxeGetFullPathName):
	* intl-auto-encap-win32.c (qxeDefineDosDevice):
	* intl-auto-encap-win32.c (qxeQueryDosDevice):
	* intl-auto-encap-win32.c (qxeCreateFile):
	* intl-auto-encap-win32.c (qxeSetFileAttributes):
	* intl-auto-encap-win32.c (qxeGetFileAttributes):
	* intl-auto-encap-win32.c (qxeGetFileAttributesEx):
	* intl-auto-encap-win32.c (qxeGetCompressedFileSize):
	* intl-auto-encap-win32.c (qxeDeleteFile):
	* intl-auto-encap-win32.c (qxeSearchPath):
	* intl-auto-encap-win32.c (qxeCopyFile):
	* intl-auto-encap-win32.c (qxeCopyFileEx):
	* intl-auto-encap-win32.c (qxeMoveFile):
	* intl-auto-encap-win32.c (qxeMoveFileEx):
	* intl-auto-encap-win32.c (qxeCreateNamedPipe):
	* intl-auto-encap-win32.c (qxeGetNamedPipeHandleState):
	* intl-auto-encap-win32.c (qxeCallNamedPipe):
	* intl-auto-encap-win32.c (qxeWaitNamedPipe):
	* intl-auto-encap-win32.c (qxeSetVolumeLabel):
	* intl-auto-encap-win32.c (qxeGetVolumeInformation):
	* intl-auto-encap-win32.c (qxeClearEventLog):
	* intl-auto-encap-win32.c (qxeBackupEventLog):
	* intl-auto-encap-win32.c (qxeOpenEventLog):
	* intl-auto-encap-win32.c (qxeRegisterEventSource):
	* intl-auto-encap-win32.c (qxeOpenBackupEventLog):
	* intl-auto-encap-win32.c (qxeReadEventLog):
	* intl-auto-encap-win32.c (qxeReportEvent):
	* intl-auto-encap-win32.c (qxeAccessCheckAndAuditAlarm):
	* intl-auto-encap-win32.c (qxeObjectOpenAuditAlarm):
	* intl-auto-encap-win32.c (qxeObjectPrivilegeAuditAlarm):
	* intl-auto-encap-win32.c (qxeObjectCloseAuditAlarm):
	* intl-auto-encap-win32.c (qxeObjectDeleteAuditAlarm):
	* intl-auto-encap-win32.c (qxePrivilegedServiceAuditAlarm):
	* intl-auto-encap-win32.c (qxeSetFileSecurity):
	* intl-auto-encap-win32.c (qxeGetFileSecurity):
	* intl-auto-encap-win32.c (qxeFindFirstChangeNotification):
	* intl-auto-encap-win32.c (qxeIsBadStringPtr):
	* intl-auto-encap-win32.c (qxeLookupAccountSid):
	* intl-auto-encap-win32.c (qxeLookupAccountName):
	* intl-auto-encap-win32.c (qxeLookupPrivilegeValue):
	* intl-auto-encap-win32.c (qxeLookupPrivilegeName):
	* intl-auto-encap-win32.c (qxeLookupPrivilegeDisplayName):
	* intl-auto-encap-win32.c (qxeBuildCommDCB):
	* intl-auto-encap-win32.c (qxeBuildCommDCBAndTimeouts):
	* intl-auto-encap-win32.c (qxeCommConfigDialog):
	* intl-auto-encap-win32.c (qxeGetDefaultCommConfig):
	* intl-auto-encap-win32.c (qxeSetDefaultCommConfig):
	* intl-auto-encap-win32.c (qxeGetComputerName):
	* intl-auto-encap-win32.c (qxeSetComputerName):
	* intl-auto-encap-win32.c (qxeGetUserName):
	* intl-auto-encap-win32.c (qxeLogonUser):
	* intl-auto-encap-win32.c (qxeCreateProcessAsUser):
	* intl-auto-encap-win32.c (qxeGetNamedSecurityInfo):
	* intl-auto-encap-win32.h:
	* intl-auto-encap-win32.h (qxeGetNamedSecurityInfo): Add this
function.
	* intl-encap-win32.c: add GetNamedSecurityInfo
	* syswindows.h: Add another cygwin path function.


XEmacs21-5 source patch:
Diff command:   cvs -q diff -u
Files affected: src/syswindows.h src/intl-encap-win32.c
src/intl-auto-encap-win32.h src/intl-auto-encap-win32.c src/fileio.c
nt/xemacs.mak lib-src/make-mswin-unicode.pl

Index: lib-src/make-mswin-unicode.pl
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lib-src/make-mswin-unicode.pl,v
retrieving revision 1.5
diff -u -r1.5 make-mswin-unicode.pl
--- lib-src/make-mswin-unicode.pl	2004/11/04 23:05:48	1.5
+++ lib-src/make-mswin-unicode.pl	2006/11/25 18:37:13
@@ -107,7 +107,7 @@
     $dir=$ENV{"MSVCDIR"} or die "Environment variable MSVCDIR undefined
- run vcvars32.bat from your MSVC installation";
     $dir.='/include';
   }
-die "Can't find MSVC include files in \"$dir\"" unless (-f
$dir.'/WINDOWS.H');
+die "Can't find MSVC include files in \"$dir\"" unless ((-f
$dir.'/WINDOWS.H') || (-f $dir.'/windows.h'));
 
 open (COUT, ">$cout") or die "Can't open C output file $cout: $!";
 open (HOUT, ">$hout") or die "Can't open C output file $hout: $!";
Index: nt/xemacs.mak
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/nt/xemacs.mak,v
retrieving revision 1.121
diff -u -r1.121 xemacs.mak
--- nt/xemacs.mak	2006/03/14 00:09:09	1.121
+++ nt/xemacs.mak	2006/11/25 18:37:17
@@ -712,8 +712,8 @@
 
 !if $(USE_CRTDLL)
 ! if $(DEBUG_XEMACS)
-C_LIBFLAG=-MDd
-LIBC_LIB=msvcrtd.lib
+C_LIBFLAG=-MD
+LIBC_LIB=msvcrt.lib
 ! else
 C_LIBFLAG=-MD
 LIBC_LIB=msvcrt.lib
Index: src/fileio.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/fileio.c,v
retrieving revision 1.107
diff -u -r1.107 fileio.c
--- src/fileio.c	2006/11/01 20:25:50	1.107
+++ src/fileio.c	2006/11/25 18:37:22
@@ -2291,6 +2291,75 @@
 static int
 check_writable (const Ibyte *filename)
 {
+#if defined(WIN32_NATIVE) || defined(CYGWIN)
+#ifdef CYGWIN
+    char filename_buffer[PATH_MAX];
+#endif
+	// Since this has to work for a directory, we can't just call
'CreateFile'
+	PSECURITY_DESCRIPTOR pDesc; /* Must be freed with LocalFree */
+	/* these need not be freed, they point into pDesc */
+	PSID psidOwner;
+	PSID psidGroup;
+	PACL pDacl;
+	PACL pSacl;
+	/* end of insides of descriptor */
+	DWORD error;
+	DWORD attributes;
+	HANDLE tokenHandle;
+	GENERIC_MAPPING genericMapping;
+	DWORD accessMask;
+	PRIVILEGE_SET PrivilegeSet;
+    DWORD dwPrivSetSize = sizeof( PRIVILEGE_SET );
+    BOOL fAccessGranted = FALSE;
+	DWORD dwAccessAllowed;
+  Extbyte *fnameext;
+
+#ifdef CYGWIN
+    cygwin_conv_to_full_win32_path(filename, filename_buffer);
+    filename = (Ibyte*)filename_buffer;
+#endif
+
+    C_STRING_TO_TSTR(filename, fnameext);
+	/* Win32 prototype lacks const. */
+	error = qxeGetNamedSecurityInfo(fnameext, SE_FILE_OBJECT, 
+
DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFO
RMATION,
+		&psidOwner, &psidGroup, &pDacl, &pSacl, &pDesc);
+	if(error != ERROR_SUCCESS) { // FAT?
+		attributes = qxeGetFileAttributes(filename);
+		return (attributes & FILE_ATTRIBUTE_DIRECTORY) || (0 ==
(attributes & FILE_ATTRIBUTE_READONLY));
+	}
+
+	genericMapping.GenericRead = FILE_GENERIC_READ;
+    genericMapping.GenericWrite = FILE_GENERIC_WRITE;
+    genericMapping.GenericExecute = FILE_GENERIC_EXECUTE;
+    genericMapping.GenericAll = FILE_ALL_ACCESS;
+
+	if(!ImpersonateSelf(SecurityDelegation)) {
+		return 0;
+	}
+	if(!OpenThreadToken(GetCurrentThread(), TOKEN_ALL_ACCESS, TRUE,
&tokenHandle)) {
+		return 0;
+	}
+
+	accessMask = GENERIC_WRITE;
+	MapGenericMask(&accessMask, &genericMapping);
+
+	if(!AccessCheck(pDesc, tokenHandle, accessMask, &genericMapping,
+					&PrivilegeSet,       // receives
privileges used in check
+					&dwPrivSetSize,      // size of
PrivilegeSet buffer
+					&dwAccessAllowed,    // receives
mask of allowed access rights
+					&fAccessGranted)) 
+	{
+		CloseHandle(tokenHandle);
+		RevertToSelf();
+		LocalFree(pDesc);
+		return 0;
+	}
+	CloseHandle(tokenHandle);
+	RevertToSelf();
+	LocalFree(pDesc);
+	return fAccessGranted == TRUE;
+#else
 #ifdef HAVE_EACCESS
   return (qxe_eaccess (filename, W_OK) >= 0);
 #else
@@ -2300,6 +2369,7 @@
      Opening with O_WRONLY could work for an ordinary file,
      but would lose for directories.  */
   return (qxe_access (filename, W_OK) >= 0);
+#endif
 #endif
 }
 
Index: src/intl-auto-encap-win32.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/intl-auto-encap-win32.c,v
retrieving revision 1.10
diff -u -r1.10 intl-auto-encap-win32.c
--- src/intl-auto-encap-win32.c	2005/01/24 23:34:00	1.10
+++ src/intl-auto-encap-win32.c	2006/11/25 18:37:24
@@ -1,7 +1,7 @@
 /* Automatically-generated Unicode-encapsulation file,
    using the command
 
-   ../lib-src/make-mswin-unicode.pl --c-output intl-auto-encap-win32.c
--h-output intl-auto-encap-win32.h intl-encap-win32.c
+   ../lib-src/make-mswin-unicode.pl --includedir
/cygdrive/c/vs2003/VC7/PlatformSDK/Include --c-output
intl-auto-encap-win32.c --h-output intl-auto-encap-win32.h
intl-encap-win32.c
 
    Do not edit.  See `make-mswin-unicode.pl'.
 */
@@ -13,125 +13,10 @@
 
 
 
/*----------------------------------------------------------------------
*/
-/*                       Processing file WINCON.H
*/
-/*---------------------------------------------------------------------
-*/
-
-BOOL
-qxePeekConsoleInput (HANDLE hConsoleInput, PINPUT_RECORD lpBuffer,
DWORD nLength, LPDWORD lpNumberOfEventsRead)
-{
-  if (XEUNICODE_P)
-    return PeekConsoleInputW (hConsoleInput, lpBuffer, nLength,
lpNumberOfEventsRead);
-  else
-    return PeekConsoleInputA (hConsoleInput, lpBuffer, nLength,
lpNumberOfEventsRead);
-}
-
-BOOL
-qxeReadConsoleInput (HANDLE hConsoleInput, PINPUT_RECORD lpBuffer,
DWORD nLength, LPDWORD lpNumberOfEventsRead)
-{
-  if (XEUNICODE_P)
-    return ReadConsoleInputW (hConsoleInput, lpBuffer, nLength,
lpNumberOfEventsRead);
-  else
-    return ReadConsoleInputA (hConsoleInput, lpBuffer, nLength,
lpNumberOfEventsRead);
-}
-
-BOOL
-qxeWriteConsoleInput (HANDLE hConsoleInput, CONST INPUT_RECORD *
lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsWritten)
-{
-  if (XEUNICODE_P)
-    return WriteConsoleInputW (hConsoleInput, lpBuffer, nLength,
lpNumberOfEventsWritten);
-  else
-    return WriteConsoleInputA (hConsoleInput, lpBuffer, nLength,
lpNumberOfEventsWritten);
-}
-
-BOOL
-qxeReadConsoleOutput (HANDLE hConsoleOutput, PCHAR_INFO lpBuffer, COORD
dwBufferSize, COORD dwBufferCoord, PSMALL_RECT lpReadRegion)
-{
-  if (XEUNICODE_P)
-    return ReadConsoleOutputW (hConsoleOutput, lpBuffer, dwBufferSize,
dwBufferCoord, lpReadRegion);
-  else
-    return ReadConsoleOutputA (hConsoleOutput, lpBuffer, dwBufferSize,
dwBufferCoord, lpReadRegion);
-}
-
-BOOL
-qxeWriteConsoleOutput (HANDLE hConsoleOutput, CONST CHAR_INFO *
lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, PSMALL_RECT
lpWriteRegion)
-{
-  if (XEUNICODE_P)
-    return WriteConsoleOutputW (hConsoleOutput, lpBuffer, dwBufferSize,
dwBufferCoord, lpWriteRegion);
-  else
-    return WriteConsoleOutputA (hConsoleOutput, lpBuffer, dwBufferSize,
dwBufferCoord, lpWriteRegion);
-}
-
-BOOL
-qxeReadConsoleOutputCharacter (HANDLE hConsoleOutput, Extbyte *
lpCharacter, DWORD nLength, COORD dwReadCoord, LPDWORD
lpNumberOfCharsRead)
-{
-  if (XEUNICODE_P)
-    return ReadConsoleOutputCharacterW (hConsoleOutput, (LPWSTR)
lpCharacter, nLength, dwReadCoord, lpNumberOfCharsRead);
-  else
-    return ReadConsoleOutputCharacterA (hConsoleOutput, (LPSTR)
lpCharacter, nLength, dwReadCoord, lpNumberOfCharsRead);
-}
-
-BOOL
-qxeWriteConsoleOutputCharacter (HANDLE hConsoleOutput, const Extbyte *
lpCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD
lpNumberOfCharsWritten)
-{
-  if (XEUNICODE_P)
-    return WriteConsoleOutputCharacterW (hConsoleOutput, (LPCWSTR)
lpCharacter, nLength, dwWriteCoord, lpNumberOfCharsWritten);
-  else
-    return WriteConsoleOutputCharacterA (hConsoleOutput, (LPCSTR)
lpCharacter, nLength, dwWriteCoord, lpNumberOfCharsWritten);
-}
-
-/* Error if FillConsoleOutputCharacter used: split CHAR */
-
-BOOL
-qxeScrollConsoleScreenBuffer (HANDLE hConsoleOutput, CONST SMALL_RECT *
lpScrollRectangle, CONST SMALL_RECT * lpClipRectangle, COORD
dwDestinationOrigin, CONST CHAR_INFO * lpFill)
-{
-  if (XEUNICODE_P)
-    return ScrollConsoleScreenBufferW (hConsoleOutput,
lpScrollRectangle, lpClipRectangle, dwDestinationOrigin, lpFill);
-  else
-    return ScrollConsoleScreenBufferA (hConsoleOutput,
lpScrollRectangle, lpClipRectangle, dwDestinationOrigin, lpFill);
-}
-
-DWORD
-qxeGetConsoleTitle (Extbyte * lpConsoleTitle, DWORD nSize)
-{
-  if (XEUNICODE_P)
-    return GetConsoleTitleW ((LPWSTR) lpConsoleTitle, nSize);
-  else
-    return GetConsoleTitleA ((LPSTR) lpConsoleTitle, nSize);
-}
-
-BOOL
-qxeSetConsoleTitle (const Extbyte * lpConsoleTitle)
-{
-  if (XEUNICODE_P)
-    return SetConsoleTitleW ((LPCWSTR) lpConsoleTitle);
-  else
-    return SetConsoleTitleA ((LPCSTR) lpConsoleTitle);
-}
-
-BOOL
-qxeReadConsole (HANDLE hConsoleInput, LPVOID lpBuffer, DWORD
nNumberOfCharsToRead, LPDWORD lpNumberOfCharsRead, LPVOID lpReserved)
-{
-  if (XEUNICODE_P)
-    return ReadConsoleW (hConsoleInput, lpBuffer, nNumberOfCharsToRead,
lpNumberOfCharsRead, lpReserved);
-  else
-    return ReadConsoleA (hConsoleInput, lpBuffer, nNumberOfCharsToRead,
lpNumberOfCharsRead, lpReserved);
-}
-
-BOOL
-qxeWriteConsole (HANDLE hConsoleOutput, CONST VOID * lpBuffer, DWORD
nNumberOfCharsToWrite, LPDWORD lpNumberOfCharsWritten, LPVOID
lpReserved)
-{
-  if (XEUNICODE_P)
-    return WriteConsoleW (hConsoleOutput, lpBuffer,
nNumberOfCharsToWrite, lpNumberOfCharsWritten, lpReserved);
-  else
-    return WriteConsoleA (hConsoleOutput, lpBuffer,
nNumberOfCharsToWrite, lpNumberOfCharsWritten, lpReserved);
-}
-
-
-/*---------------------------------------------------------------------
-*/
 /*                      Processing file SHELLAPI.H
*/
 
/*----------------------------------------------------------------------
*/
 
-UINT 
+UINT
 qxeDragQueryFile (HDROP arg1, UINT arg2, Extbyte * arg3, UINT arg4)
 {
   if (XEUNICODE_P)
@@ -140,7 +25,7 @@
     return DragQueryFileA (arg1, arg2, (LPSTR) arg3, arg4);
 }
 
-HINSTANCE 
+HINSTANCE
 qxeShellExecute (HWND hwnd, const Extbyte * lpOperation, const Extbyte
* lpFile, const Extbyte * lpParameters, const Extbyte * lpDirectory, INT
nShowCmd)
 {
   if (XEUNICODE_P)
@@ -149,7 +34,7 @@
     return ShellExecuteA (hwnd, (LPCSTR) lpOperation, (LPCSTR) lpFile,
(LPCSTR) lpParameters, (LPCSTR) lpDirectory, nShowCmd);
 }
 
-HINSTANCE 
+HINSTANCE
 qxeFindExecutable (const Extbyte * lpFile, const Extbyte * lpDirectory,
Extbyte * lpResult)
 {
   if (XEUNICODE_P)
@@ -158,9 +43,7 @@
     return FindExecutableA ((LPCSTR) lpFile, (LPCSTR) lpDirectory,
(LPSTR) lpResult);
 }
 
-/* Error if CommandLineToArgv used: Unicode-only */
-
-INT       
+INT
 qxeShellAbout (HWND hWnd, const Extbyte * szApp, const Extbyte *
szOtherStuff, HICON hIcon)
 {
   if (XEUNICODE_P)
@@ -169,7 +52,7 @@
     return ShellAboutA (hWnd, (LPCSTR) szApp, (LPCSTR) szOtherStuff,
hIcon);
 }
 
-HICON     
+HICON
 qxeExtractAssociatedIcon (HINSTANCE hInst, Extbyte * lpIconPath, LPWORD
lpiIcon)
 {
   if (XEUNICODE_P)
@@ -178,7 +61,7 @@
     return ExtractAssociatedIconA (hInst, (LPSTR) lpIconPath, lpiIcon);
 }
 
-HICON     
+HICON
 qxeExtractIcon (HINSTANCE hInst, const Extbyte * lpszExeFileName, UINT
nIconIndex)
 {
   if (XEUNICODE_P)
@@ -190,19 +73,17 @@
 #if !defined (CYGWIN_HEADERS)
 
 /* NOTE: NT 4.0+ only */
-DWORD   
-qxeDoEnvironmentSubst (Extbyte * szString, UINT cbString)
+DWORD
+qxeDoEnvironmentSubst (Extbyte * szString, UINT cchString)
 {
   if (XEUNICODE_P)
-    return DoEnvironmentSubstW ((LPWSTR) szString, cbString);
+    return DoEnvironmentSubstW ((LPWSTR) szString, cchString);
   else
-    return DoEnvironmentSubstA ((LPSTR) szString, cbString);
+    return DoEnvironmentSubstA ((LPSTR) szString, cchString);
 }
 
 #endif /* !defined (CYGWIN_HEADERS) */
 
-/* Error if FindEnvironmentString used: causes link error; NT 4.0+ only
*/
-
 /* Skipping ExtractIconEx because NT 4.0+ only, error in Cygwin
prototype */
 
 /* NOTE: NT 4.0+ only */
@@ -259,8 +140,6 @@
 
 /* Skipping SHGetFileInfo because split-sized SHFILEINFO, NT 4.0+ only
*/
 
-/* Error if SHGetDiskFreeSpace used: causes link error; NT 4.0+ only */
-
 #if !defined (CYGWIN_HEADERS)
 
 /* NOTE: NT 4.0+ only */
@@ -298,12 +177,12 @@
 
 /* NOTE: #### problems with DEVMODE pointer in PRINTER_INFO_2 */
 BOOL
-qxeEnumPrinters (DWORD Flags, Extbyte * Name, DWORD Level, LPBYTE
pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
+qxeEnumPrinters (IN DWORD Flags, IN Extbyte * Name, IN DWORD Level, OUT
LPBYTE pPrinterEnum, IN DWORD cbBuf, OUT LPDWORD pcbNeeded, OUT LPDWORD
pcReturned)
 {
   if (XEUNICODE_P)
-    return EnumPrintersW (Flags, (LPWSTR) Name, Level, pPrinterEnum,
cbBuf, pcbNeeded, pcReturned);
+    return EnumPrintersW (Flags, (IN LPWSTR) Name, Level, pPrinterEnum,
cbBuf, pcbNeeded, pcReturned);
   else
-    return EnumPrintersA (Flags, (LPSTR) Name, Level, pPrinterEnum,
cbBuf, pcbNeeded, pcReturned);
+    return EnumPrintersA (Flags, (IN LPSTR) Name, Level, pPrinterEnum,
cbBuf, pcbNeeded, pcReturned);
 }
 
 #endif /* defined (HAVE_MS_WINDOWS) */
@@ -400,24 +279,6 @@
 
 #if defined (HAVE_MS_WINDOWS)
 
-/* Error if AddPerMachineConnection used: not used, complicated
interface with split structures */
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
-
-/* Error if DeletePerMachineConnection used: not used, complicated
interface with split structures */
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
-
-/* Error if EnumPerMachineConnections used: not used, complicated
interface with split structures */
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
-
 /* Error if AddPrintProcessor used: not used, complicated interface
with split structures */
 
 #endif /* defined (HAVE_MS_WINDOWS) */
@@ -644,415 +505,176 @@
 
 #endif /* defined (HAVE_MS_WINDOWS) */
 
-#if defined (HAVE_MS_WINDOWS)
-
-/* Error if SetPrinterHTMLView used: not used, complicated interface
with split structures */
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
-
-/* Error if GetPrinterHTMLView used: not used, complicated interface
with split structures */
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
 
 
/*----------------------------------------------------------------------
*/
-/*                      Processing file WINNETWK.H
*/
+/*                      Processing file WINUSER.H
*/
 
/*----------------------------------------------------------------------
*/
-
-#if defined (HAVE_MS_WINDOWS)
 
-DWORD 
-qxeWNetAddConnection (const Extbyte * lpRemoteName, const Extbyte *
lpPassword, const Extbyte * lpLocalName)
+int
+qxewvsprintf (OUT Extbyte * arg1, IN const Extbyte * arg2, IN va_list
arglist)
 {
   if (XEUNICODE_P)
-    return WNetAddConnectionW ((LPCWSTR) lpRemoteName, (LPCWSTR)
lpPassword, (LPCWSTR) lpLocalName);
+    return wvsprintfW ((OUT LPWSTR) arg1, (IN LPCWSTR) arg2, arglist);
   else
-    return WNetAddConnectionA ((LPCSTR) lpRemoteName, (LPCSTR)
lpPassword, (LPCSTR) lpLocalName);
+    return wvsprintfA ((OUT LPSTR) arg1, (IN LPCSTR) arg2, arglist);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
 
-DWORD 
-qxeWNetAddConnection2 (LPNETRESOURCEW lpNetResource, const Extbyte *
lpPassword, const Extbyte * lpUserName, DWORD dwFlags)
+HKL
+qxeLoadKeyboardLayout (IN const Extbyte * pwszKLID, IN UINT Flags)
 {
   if (XEUNICODE_P)
-    return WNetAddConnection2W (lpNetResource, (LPCWSTR) lpPassword,
(LPCWSTR) lpUserName, dwFlags);
+    return LoadKeyboardLayoutW ((IN LPCWSTR) pwszKLID, Flags);
   else
-    return WNetAddConnection2A ((LPNETRESOURCEA) lpNetResource,
(LPCSTR) lpPassword, (LPCSTR) lpUserName, dwFlags);
+    return LoadKeyboardLayoutA ((IN LPCSTR) pwszKLID, Flags);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
 
-DWORD 
-qxeWNetAddConnection3 (HWND hwndOwner, LPNETRESOURCEW lpNetResource,
const Extbyte * lpPassword, const Extbyte * lpUserName, DWORD dwFlags)
+BOOL
+qxeGetKeyboardLayoutName (OUT Extbyte * pwszKLID)
 {
   if (XEUNICODE_P)
-    return WNetAddConnection3W (hwndOwner, lpNetResource, (LPCWSTR)
lpPassword, (LPCWSTR) lpUserName, dwFlags);
+    return GetKeyboardLayoutNameW ((OUT LPWSTR) pwszKLID);
   else
-    return WNetAddConnection3A (hwndOwner, (LPNETRESOURCEA)
lpNetResource, (LPCSTR) lpPassword, (LPCSTR) lpUserName, dwFlags);
+    return GetKeyboardLayoutNameA ((OUT LPSTR) pwszKLID);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
 
-#if defined (HAVE_MS_WINDOWS)
+/* Error if CreateDesktop used: split-sized LPDEVMODE */
 
-DWORD 
-qxeWNetCancelConnection (const Extbyte * lpName, BOOL fForce)
+HDESK
+qxeOpenDesktop (IN const Extbyte * lpszDesktop, IN DWORD dwFlags, IN
BOOL fInherit, IN ACCESS_MASK dwDesiredAccess)
 {
   if (XEUNICODE_P)
-    return WNetCancelConnectionW ((LPCWSTR) lpName, fForce);
+    return OpenDesktopW ((IN LPCWSTR) lpszDesktop, dwFlags, fInherit,
dwDesiredAccess);
   else
-    return WNetCancelConnectionA ((LPCSTR) lpName, fForce);
+    return OpenDesktopA ((IN LPCSTR) lpszDesktop, dwFlags, fInherit,
dwDesiredAccess);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
 
-DWORD 
-qxeWNetCancelConnection2 (const Extbyte * lpName, DWORD dwFlags, BOOL
fForce)
+/* NOTE: // callback fun differs only in string pointer type */
+BOOL
+qxeEnumDesktops (IN HWINSTA hwinsta, IN DESKTOPENUMPROCW lpEnumFunc, IN
LPARAM lParam)
 {
   if (XEUNICODE_P)
-    return WNetCancelConnection2W ((LPCWSTR) lpName, dwFlags, fForce);
+    return EnumDesktopsW (hwinsta, lpEnumFunc, lParam);
   else
-    return WNetCancelConnection2A ((LPCSTR) lpName, dwFlags, fForce);
+    return EnumDesktopsA (hwinsta, (IN DESKTOPENUMPROCA) lpEnumFunc,
lParam);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
 
-DWORD 
-qxeWNetGetConnection (const Extbyte * lpLocalName, Extbyte *
lpRemoteName, LPDWORD lpnLength)
+HWINSTA
+qxeCreateWindowStation (IN const Extbyte * lpwinsta, IN DWORD
dwReserved, IN ACCESS_MASK dwDesiredAccess, IN LPSECURITY_ATTRIBUTES
lpsa)
 {
   if (XEUNICODE_P)
-    return WNetGetConnectionW ((LPCWSTR) lpLocalName, (LPWSTR)
lpRemoteName, lpnLength);
+    return CreateWindowStationW ((IN LPCWSTR) lpwinsta, dwReserved,
dwDesiredAccess, lpsa);
   else
-    return WNetGetConnectionA ((LPCSTR) lpLocalName, (LPSTR)
lpRemoteName, lpnLength);
+    return CreateWindowStationA ((IN LPCSTR) lpwinsta, dwReserved,
dwDesiredAccess, lpsa);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
 
-DWORD 
-qxeWNetUseConnection (HWND hwndOwner, LPNETRESOURCEW lpNetResource,
const Extbyte * lpUserID, const Extbyte * lpPassword, DWORD dwFlags,
Extbyte * lpAccessName, LPDWORD lpBufferSize, LPDWORD lpResult)
+HWINSTA
+qxeOpenWindowStation (IN const Extbyte * lpszWinSta, IN BOOL fInherit,
IN ACCESS_MASK dwDesiredAccess)
 {
   if (XEUNICODE_P)
-    return WNetUseConnectionW (hwndOwner, lpNetResource, (LPCWSTR)
lpUserID, (LPCWSTR) lpPassword, dwFlags, (LPWSTR) lpAccessName,
lpBufferSize, lpResult);
+    return OpenWindowStationW ((IN LPCWSTR) lpszWinSta, fInherit,
dwDesiredAccess);
   else
-    return WNetUseConnectionA (hwndOwner, (LPNETRESOURCEA)
lpNetResource, (LPCSTR) lpUserID, (LPCSTR) lpPassword, dwFlags, (LPSTR)
lpAccessName, lpBufferSize, lpResult);
+    return OpenWindowStationA ((IN LPCSTR) lpszWinSta, fInherit,
dwDesiredAccess);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
 
-/* NOTE: contains split-simple LPNETRESOURCE */
-DWORD 
-qxeWNetConnectionDialog1 (LPCONNECTDLGSTRUCTW lpConnDlgStruct)
+/* NOTE: // callback fun differs only in string pointer type */
+BOOL
+qxeEnumWindowStations (IN WINSTAENUMPROCW lpEnumFunc, IN LPARAM lParam)
 {
   if (XEUNICODE_P)
-    return WNetConnectionDialog1W (lpConnDlgStruct);
+    return EnumWindowStationsW (lpEnumFunc, lParam);
   else
-    return WNetConnectionDialog1A ((LPCONNECTDLGSTRUCTA)
lpConnDlgStruct);
+    return EnumWindowStationsA ((IN WINSTAENUMPROCA) lpEnumFunc,
lParam);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
 
-DWORD 
-qxeWNetDisconnectDialog1 (LPDISCDLGSTRUCTW lpConnDlgStruct)
+BOOL
+qxeGetUserObjectInformation (IN HANDLE hObj, IN int nIndex, OUT PVOID
pvInfo, IN DWORD nLength, OUT LPDWORD lpnLengthNeeded)
 {
   if (XEUNICODE_P)
-    return WNetDisconnectDialog1W (lpConnDlgStruct);
+    return GetUserObjectInformationW (hObj, nIndex, pvInfo, nLength,
lpnLengthNeeded);
   else
-    return WNetDisconnectDialog1A ((LPDISCDLGSTRUCTA) lpConnDlgStruct);
+    return GetUserObjectInformationA (hObj, nIndex, pvInfo, nLength,
lpnLengthNeeded);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
 
-#if defined (HAVE_MS_WINDOWS)
-
-DWORD 
-qxeWNetOpenEnum (DWORD dwScope, DWORD dwType, DWORD dwUsage,
LPNETRESOURCEW lpNetResource, LPHANDLE lphEnum)
+BOOL
+qxeSetUserObjectInformation (IN HANDLE hObj, IN int nIndex, IN PVOID
pvInfo, IN DWORD nLength)
 {
   if (XEUNICODE_P)
-    return WNetOpenEnumW (dwScope, dwType, dwUsage, lpNetResource,
lphEnum);
+    return SetUserObjectInformationW (hObj, nIndex, pvInfo, nLength);
   else
-    return WNetOpenEnumA (dwScope, dwType, dwUsage, (LPNETRESOURCEA)
lpNetResource, lphEnum);
+    return SetUserObjectInformationA (hObj, nIndex, pvInfo, nLength);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
 
-DWORD 
-qxeWNetEnumResource (HANDLE hEnum, LPDWORD lpcCount, LPVOID lpBuffer,
LPDWORD lpBufferSize)
+UINT
+qxeRegisterWindowMessage (IN const Extbyte * lpString)
 {
   if (XEUNICODE_P)
-    return WNetEnumResourceW (hEnum, lpcCount, lpBuffer, lpBufferSize);
+    return RegisterWindowMessageW ((IN LPCWSTR) lpString);
   else
-    return WNetEnumResourceA (hEnum, lpcCount, lpBuffer, lpBufferSize);
+    return RegisterWindowMessageA ((IN LPCSTR) lpString);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
 
-DWORD 
-qxeWNetGetUniversalName (const Extbyte * lpLocalPath, DWORD
dwInfoLevel, LPVOID lpBuffer, LPDWORD lpBufferSize)
+BOOL
+qxeGetMessage (OUT LPMSG lpMsg, IN HWND hWnd, IN UINT wMsgFilterMin, IN
UINT wMsgFilterMax)
 {
   if (XEUNICODE_P)
-    return WNetGetUniversalNameW ((LPCWSTR) lpLocalPath, dwInfoLevel,
lpBuffer, lpBufferSize);
+    return GetMessageW (lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
   else
-    return WNetGetUniversalNameA ((LPCSTR) lpLocalPath, dwInfoLevel,
lpBuffer, lpBufferSize);
+    return GetMessageA (lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
 
-DWORD 
-qxeWNetGetUser (const Extbyte * lpName, Extbyte * lpUserName, LPDWORD
lpnLength)
+LRESULT
+qxeDispatchMessage (IN CONST MSG * lpMsg)
 {
   if (XEUNICODE_P)
-    return WNetGetUserW ((LPCWSTR) lpName, (LPWSTR) lpUserName,
lpnLength);
+    return DispatchMessageW (lpMsg);
   else
-    return WNetGetUserA ((LPCSTR) lpName, (LPSTR) lpUserName,
lpnLength);
+    return DispatchMessageA (lpMsg);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
 
-DWORD 
-qxeWNetGetProviderName (DWORD dwNetType, Extbyte * lpProviderName,
LPDWORD lpBufferSize)
+BOOL
+qxePeekMessage (OUT LPMSG lpMsg, IN HWND hWnd, IN UINT wMsgFilterMin,
IN UINT wMsgFilterMax, IN UINT wRemoveMsg)
 {
   if (XEUNICODE_P)
-    return WNetGetProviderNameW (dwNetType, (LPWSTR) lpProviderName,
lpBufferSize);
+    return PeekMessageW (lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax,
wRemoveMsg);
   else
-    return WNetGetProviderNameA (dwNetType, (LPSTR) lpProviderName,
lpBufferSize);
+    return PeekMessageA (lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax,
wRemoveMsg);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
 
-#if defined (HAVE_MS_WINDOWS)
+/* Skipping SendMessage because split messages and structures */
 
-DWORD 
-qxeWNetGetNetworkInformation (const Extbyte * lpProvider,
LPNETINFOSTRUCT lpNetInfoStruct)
+LRESULT
+qxeSendMessageTimeout (IN HWND hWnd, IN UINT Msg, IN WPARAM wParam, IN
LPARAM lParam, IN UINT fuFlags, IN UINT uTimeout, OUT PDWORD_PTR
lpdwResult)
 {
   if (XEUNICODE_P)
-    return WNetGetNetworkInformationW ((LPCWSTR) lpProvider,
lpNetInfoStruct);
+    return SendMessageTimeoutW (hWnd, Msg, wParam, lParam, fuFlags,
uTimeout, lpdwResult);
   else
-    return WNetGetNetworkInformationA ((LPCSTR) lpProvider,
lpNetInfoStruct);
+    return SendMessageTimeoutA (hWnd, Msg, wParam, lParam, fuFlags,
uTimeout, lpdwResult);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
 
-DWORD 
-qxeWNetGetLastError (LPDWORD lpError, Extbyte * lpErrorBuf, DWORD
nErrorBufSize, Extbyte * lpNameBuf, DWORD nNameBufSize)
+BOOL
+qxeSendNotifyMessage (IN HWND hWnd, IN UINT Msg, IN WPARAM wParam, IN
LPARAM lParam)
 {
   if (XEUNICODE_P)
-    return WNetGetLastErrorW (lpError, (LPWSTR) lpErrorBuf,
nErrorBufSize, (LPWSTR) lpNameBuf, nNameBufSize);
+    return SendNotifyMessageW (hWnd, Msg, wParam, lParam);
   else
-    return WNetGetLastErrorA (lpError, (LPSTR) lpErrorBuf,
nErrorBufSize, (LPSTR) lpNameBuf, nNameBufSize);
+    return SendNotifyMessageA (hWnd, Msg, wParam, lParam);
 }
-
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-#if defined (HAVE_MS_WINDOWS)
 
-DWORD 
-qxeMultinetGetConnectionPerformance (LPNETRESOURCEW lpNetResource,
LPNETCONNECTINFOSTRUCT lpNetConnectInfoStruct)
+BOOL
+qxeSendMessageCallback (IN HWND hWnd, IN UINT Msg, IN WPARAM wParam, IN
LPARAM lParam, IN SENDASYNCPROC lpResultCallBack, IN ULONG_PTR dwData)
 {
   if (XEUNICODE_P)
-    return MultinetGetConnectionPerformanceW (lpNetResource,
lpNetConnectInfoStruct);
+    return SendMessageCallbackW (hWnd, Msg, wParam, lParam,
lpResultCallBack, dwData);
   else
-    return MultinetGetConnectionPerformanceA ((LPNETRESOURCEA)
lpNetResource, lpNetConnectInfoStruct);
+    return SendMessageCallbackA (hWnd, Msg, wParam, lParam,
lpResultCallBack, dwData);
 }
 
-#endif /* defined (HAVE_MS_WINDOWS) */
-
-
-/*---------------------------------------------------------------------
-*/
-/*                      Processing file WINUSER.H
*/
-/*---------------------------------------------------------------------
-*/
-
-int
-qxewvsprintf (Extbyte * arg1, const Extbyte * arg2, va_list arglist)
-{
-  if (XEUNICODE_P)
-    return wvsprintfW ((LPWSTR) arg1, (LPCWSTR) arg2, arglist);
-  else
-    return wvsprintfA ((LPSTR) arg1, (LPCSTR) arg2, arglist);
-}
-
-HKL
-qxeLoadKeyboardLayout (const Extbyte * pwszKLID, UINT Flags)
-{
-  if (XEUNICODE_P)
-    return LoadKeyboardLayoutW ((LPCWSTR) pwszKLID, Flags);
-  else
-    return LoadKeyboardLayoutA ((LPCSTR) pwszKLID, Flags);
-}
-
-BOOL
-qxeGetKeyboardLayoutName (Extbyte * pwszKLID)
-{
-  if (XEUNICODE_P)
-    return GetKeyboardLayoutNameW ((LPWSTR) pwszKLID);
-  else
-    return GetKeyboardLayoutNameA ((LPSTR) pwszKLID);
-}
-
-/* Error if CreateDesktop used: split-sized LPDEVMODE */
-
-HDESK
-qxeOpenDesktop (Extbyte * lpszDesktop, DWORD dwFlags, BOOL fInherit,
ACCESS_MASK dwDesiredAccess)
-{
-  if (XEUNICODE_P)
-    return OpenDesktopW ((LPWSTR) lpszDesktop, dwFlags, fInherit,
dwDesiredAccess);
-  else
-    return OpenDesktopA ((LPSTR) lpszDesktop, dwFlags, fInherit,
dwDesiredAccess);
-}
-
-/* NOTE: // callback fun differs only in string pointer type */
-BOOL
-qxeEnumDesktops (HWINSTA hwinsta, DESKTOPENUMPROCW lpEnumFunc, LPARAM
lParam)
-{
-  if (XEUNICODE_P)
-    return EnumDesktopsW (hwinsta, lpEnumFunc, lParam);
-  else
-    return EnumDesktopsA (hwinsta, (DESKTOPENUMPROCA) lpEnumFunc,
lParam);
-}
-
-HWINSTA
-qxeCreateWindowStation (Extbyte * lpwinsta, DWORD dwReserved,
ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa)
-{
-  if (XEUNICODE_P)
-    return CreateWindowStationW ((LPWSTR) lpwinsta, dwReserved,
dwDesiredAccess, lpsa);
-  else
-    return CreateWindowStationA ((LPSTR) lpwinsta, dwReserved,
dwDesiredAccess, lpsa);
-}
-
-HWINSTA
-qxeOpenWindowStation (Extbyte * lpszWinSta, BOOL fInherit, ACCESS_MASK
dwDesiredAccess)
-{
-  if (XEUNICODE_P)
-    return OpenWindowStationW ((LPWSTR) lpszWinSta, fInherit,
dwDesiredAccess);
-  else
-    return OpenWindowStationA ((LPSTR) lpszWinSta, fInherit,
dwDesiredAccess);
-}
-
-/* NOTE: // callback fun differs only in string pointer type */
-BOOL
-qxeEnumWindowStations (WINSTAENUMPROCW lpEnumFunc, LPARAM lParam)
-{
-  if (XEUNICODE_P)
-    return EnumWindowStationsW (lpEnumFunc, lParam);
-  else
-    return EnumWindowStationsA ((WINSTAENUMPROCA) lpEnumFunc, lParam);
-}
-
-BOOL
-qxeGetUserObjectInformation (HANDLE hObj, int nIndex, PVOID pvInfo,
DWORD nLength, LPDWORD lpnLengthNeeded)
-{
-  if (XEUNICODE_P)
-    return GetUserObjectInformationW (hObj, nIndex, pvInfo, nLength,
lpnLengthNeeded);
-  else
-    return GetUserObjectInformationA (hObj, nIndex, pvInfo, nLength,
lpnLengthNeeded);
-}
-
-BOOL
-qxeSetUserObjectInformation (HANDLE hObj, int nIndex, PVOID pvInfo,
DWORD nLength)
-{
-  if (XEUNICODE_P)
-    return SetUserObjectInformationW (hObj, nIndex, pvInfo, nLength);
-  else
-    return SetUserObjectInformationA (hObj, nIndex, pvInfo, nLength);
-}
-
-UINT
-qxeRegisterWindowMessage (const Extbyte * lpString)
-{
-  if (XEUNICODE_P)
-    return RegisterWindowMessageW ((LPCWSTR) lpString);
-  else
-    return RegisterWindowMessageA ((LPCSTR) lpString);
-}
-
-BOOL
-qxeGetMessage (LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT
wMsgFilterMax)
-{
-  if (XEUNICODE_P)
-    return GetMessageW (lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
-  else
-    return GetMessageA (lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
-}
-
-LONG
-qxeDispatchMessage (CONST MSG * lpMsg)
-{
-  if (XEUNICODE_P)
-    return DispatchMessageW (lpMsg);
-  else
-    return DispatchMessageA (lpMsg);
-}
-
-BOOL
-qxePeekMessage (LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT
wMsgFilterMax, UINT wRemoveMsg)
-{
-  if (XEUNICODE_P)
-    return PeekMessageW (lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax,
wRemoveMsg);
-  else
-    return PeekMessageA (lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax,
wRemoveMsg);
-}
-
-/* Skipping SendMessage because split messages and structures */
-
-LRESULT
-qxeSendMessageTimeout (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
lParam, UINT fuFlags, UINT uTimeout, LPDWORD lpdwResult)
-{
-  if (XEUNICODE_P)
-    return SendMessageTimeoutW (hWnd, Msg, wParam, lParam, fuFlags,
uTimeout, lpdwResult);
-  else
-    return SendMessageTimeoutA (hWnd, Msg, wParam, lParam, fuFlags,
uTimeout, lpdwResult);
-}
-
-BOOL
-qxeSendNotifyMessage (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
lParam)
-{
-  if (XEUNICODE_P)
-    return SendNotifyMessageW (hWnd, Msg, wParam, lParam);
-  else
-    return SendNotifyMessageA (hWnd, Msg, wParam, lParam);
-}
-
-BOOL
-qxeSendMessageCallback (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
lParam, SENDASYNCPROC lpResultCallBack, DWORD dwData)
-{
-  if (XEUNICODE_P)
-    return SendMessageCallbackW (hWnd, Msg, wParam, lParam,
lpResultCallBack, dwData);
-  else
-    return SendMessageCallbackA (hWnd, Msg, wParam, lParam,
lpResultCallBack, dwData);
-}
-
 /* Error if BroadcastSystemMessage used: win95 version not split; NT
4.0+ only */
 
 /* Error if RegisterDeviceNotification used: NT 5.0+ only */
 
 BOOL
-qxePostMessage (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+qxePostMessage (IN HWND hWnd, IN UINT Msg, IN WPARAM wParam, IN LPARAM
lParam)
 {
   if (XEUNICODE_P)
     return PostMessageW (hWnd, Msg, wParam, lParam);
@@ -1061,7 +683,7 @@
 }
 
 BOOL
-qxePostThreadMessage (DWORD idThread, UINT Msg, WPARAM wParam, LPARAM
lParam)
+qxePostThreadMessage (IN DWORD idThread, IN UINT Msg, IN WPARAM wParam,
IN LPARAM lParam)
 {
   if (XEUNICODE_P)
     return PostThreadMessageW (idThread, Msg, wParam, lParam);
@@ -1080,93 +702,93 @@
 /* Skipping UnregisterClass because need to intercept for reasons
related to RegisterClass */
 
 BOOL
-qxeGetClassInfo (HINSTANCE hInstance, const Extbyte * lpClassName,
LPWNDCLASSW lpWndClass)
+qxeGetClassInfo (IN HINSTANCE hInstance, IN const Extbyte *
lpClassName, OUT LPWNDCLASSW lpWndClass)
 {
   if (XEUNICODE_P)
-    return GetClassInfoW (hInstance, (LPCWSTR) lpClassName,
lpWndClass);
+    return GetClassInfoW (hInstance, (IN LPCWSTR) lpClassName,
lpWndClass);
   else
-    return GetClassInfoA (hInstance, (LPCSTR) lpClassName,
(LPWNDCLASSA) lpWndClass);
+    return GetClassInfoA (hInstance, (IN LPCSTR) lpClassName, (OUT
LPWNDCLASSA) lpWndClass);
 }
 
 /* Skipping RegisterClassEx because need to intercept so we can provide
our own window procedure and handle split notify messages; split-simple
WNDCLASSEX; NT 4.0+ only */
 
 /* NOTE: NT 4.0+ only */
 BOOL
-qxeGetClassInfoEx (HINSTANCE arg1, const Extbyte * arg2, LPWNDCLASSEXW
arg3)
+qxeGetClassInfoEx (IN HINSTANCE arg1, IN const Extbyte * arg2, OUT
LPWNDCLASSEXW arg3)
 {
   if (XEUNICODE_P)
-    return GetClassInfoExW (arg1, (LPCWSTR) arg2, arg3);
+    return GetClassInfoExW (arg1, (IN LPCWSTR) arg2, arg3);
   else
-    return GetClassInfoExA (arg1, (LPCSTR) arg2, (LPWNDCLASSEXA) arg3);
+    return GetClassInfoExA (arg1, (IN LPCSTR) arg2, (OUT LPWNDCLASSEXA)
arg3);
 }
 
 HWND
-qxeCreateWindowEx (DWORD dwExStyle, const Extbyte * lpClassName, const
Extbyte * lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int
nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID
lpParam)
+qxeCreateWindowEx (IN DWORD dwExStyle, IN const Extbyte * lpClassName,
IN const Extbyte * lpWindowName, IN DWORD dwStyle, IN int X, IN int Y,
IN int nWidth, IN int nHeight, IN HWND hWndParent, IN HMENU hMenu, IN
HINSTANCE hInstance, IN LPVOID lpParam)
 {
   if (XEUNICODE_P)
-    return CreateWindowExW (dwExStyle, (LPCWSTR) lpClassName, (LPCWSTR)
lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu,
hInstance, lpParam);
+    return CreateWindowExW (dwExStyle, (IN LPCWSTR) lpClassName, (IN
LPCWSTR) lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent,
hMenu, hInstance, lpParam);
   else
-    return CreateWindowExA (dwExStyle, (LPCSTR) lpClassName, (LPCSTR)
lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu,
hInstance, lpParam);
+    return CreateWindowExA (dwExStyle, (IN LPCSTR) lpClassName, (IN
LPCSTR) lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu,
hInstance, lpParam);
 }
 
 HWND
-qxeCreateDialogParam (HINSTANCE hInstance, const Extbyte *
lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM
dwInitParam)
+qxeCreateDialogParam (IN HINSTANCE hInstance, IN const Extbyte *
lpTemplateName, IN HWND hWndParent, IN DLGPROC lpDialogFunc, IN LPARAM
dwInitParam)
 {
   if (XEUNICODE_P)
-    return CreateDialogParamW (hInstance, (LPCWSTR) lpTemplateName,
hWndParent, lpDialogFunc, dwInitParam);
+    return CreateDialogParamW (hInstance, (IN LPCWSTR) lpTemplateName,
hWndParent, lpDialogFunc, dwInitParam);
   else
-    return CreateDialogParamA (hInstance, (LPCSTR) lpTemplateName,
hWndParent, lpDialogFunc, dwInitParam);
+    return CreateDialogParamA (hInstance, (IN LPCSTR) lpTemplateName,
hWndParent, lpDialogFunc, dwInitParam);
 }
 
 /* NOTE: error in Cygwin prototype (no split) but fixable with typedef
*/
 HWND
-qxeCreateDialogIndirectParam (HINSTANCE hInstance, LPCDLGTEMPLATEW
lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
+qxeCreateDialogIndirectParam (IN HINSTANCE hInstance, IN
LPCDLGTEMPLATEW lpTemplate, IN HWND hWndParent, IN DLGPROC lpDialogFunc,
IN LPARAM dwInitParam)
 {
   if (XEUNICODE_P)
     return CreateDialogIndirectParamW (hInstance, lpTemplate,
hWndParent, lpDialogFunc, dwInitParam);
   else
-    return CreateDialogIndirectParamA (hInstance, (LPCDLGTEMPLATEA)
lpTemplate, hWndParent, lpDialogFunc, dwInitParam);
+    return CreateDialogIndirectParamA (hInstance, (IN LPCDLGTEMPLATEA)
lpTemplate, hWndParent, lpDialogFunc, dwInitParam);
 }
 
-int
-qxeDialogBoxParam (HINSTANCE hInstance, const Extbyte * lpTemplateName,
HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
+INT_PTR
+qxeDialogBoxParam (IN HINSTANCE hInstance, IN const Extbyte *
lpTemplateName, IN HWND hWndParent, IN DLGPROC lpDialogFunc, IN LPARAM
dwInitParam)
 {
   if (XEUNICODE_P)
-    return DialogBoxParamW (hInstance, (LPCWSTR) lpTemplateName,
hWndParent, lpDialogFunc, dwInitParam);
+    return DialogBoxParamW (hInstance, (IN LPCWSTR) lpTemplateName,
hWndParent, lpDialogFunc, dwInitParam);
   else
-    return DialogBoxParamA (hInstance, (LPCSTR) lpTemplateName,
hWndParent, lpDialogFunc, dwInitParam);
+    return DialogBoxParamA (hInstance, (IN LPCSTR) lpTemplateName,
hWndParent, lpDialogFunc, dwInitParam);
 }
 
 /* NOTE: error in Cygwin prototype (no split) but fixable with typedef
*/
-int
-qxeDialogBoxIndirectParam (HINSTANCE hInstance, LPCDLGTEMPLATEW
hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM
dwInitParam)
+INT_PTR
+qxeDialogBoxIndirectParam (IN HINSTANCE hInstance, IN LPCDLGTEMPLATEW
hDialogTemplate, IN HWND hWndParent, IN DLGPROC lpDialogFunc, IN LPARAM
dwInitParam)
 {
   if (XEUNICODE_P)
     return DialogBoxIndirectParamW (hInstance, hDialogTemplate,
hWndParent, lpDialogFunc, dwInitParam);
   else
-    return DialogBoxIndirectParamA (hInstance, (LPCDLGTEMPLATEA)
hDialogTemplate, hWndParent, lpDialogFunc, dwInitParam);
+    return DialogBoxIndirectParamA (hInstance, (IN LPCDLGTEMPLATEA)
hDialogTemplate, hWndParent, lpDialogFunc, dwInitParam);
 }
 
 BOOL
-qxeSetDlgItemText (HWND hDlg, int nIDDlgItem, const Extbyte * lpString)
+qxeSetDlgItemText (IN HWND hDlg, IN int nIDDlgItem, IN const Extbyte *
lpString)
 {
   if (XEUNICODE_P)
-    return SetDlgItemTextW (hDlg, nIDDlgItem, (LPCWSTR) lpString);
+    return SetDlgItemTextW (hDlg, nIDDlgItem, (IN LPCWSTR) lpString);
   else
-    return SetDlgItemTextA (hDlg, nIDDlgItem, (LPCSTR) lpString);
+    return SetDlgItemTextA (hDlg, nIDDlgItem, (IN LPCSTR) lpString);
 }
 
 UINT
-qxeGetDlgItemText (HWND hDlg, int nIDDlgItem, Extbyte * lpString, int
nMaxCount)
+qxeGetDlgItemText (IN HWND hDlg, IN int nIDDlgItem, OUT Extbyte *
lpString, IN int nMaxCount)
 {
   if (XEUNICODE_P)
-    return GetDlgItemTextW (hDlg, nIDDlgItem, (LPWSTR) lpString,
nMaxCount);
+    return GetDlgItemTextW (hDlg, nIDDlgItem, (OUT LPWSTR) lpString,
nMaxCount);
   else
-    return GetDlgItemTextA (hDlg, nIDDlgItem, (LPSTR) lpString,
nMaxCount);
+    return GetDlgItemTextA (hDlg, nIDDlgItem, (OUT LPSTR) lpString,
nMaxCount);
 }
 
-LONG
-qxeSendDlgItemMessage (HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM
wParam, LPARAM lParam)
+LRESULT
+qxeSendDlgItemMessage (IN HWND hDlg, IN int nIDDlgItem, IN UINT Msg, IN
WPARAM wParam, IN LPARAM lParam)
 {
   if (XEUNICODE_P)
     return SendDlgItemMessageW (hDlg, nIDDlgItem, Msg, wParam, lParam);
@@ -1179,7 +801,7 @@
 #if !defined (CYGWIN_HEADERS)
 
 BOOL
-qxeCallMsgFilter (LPMSG lpMsg, int nCode)
+qxeCallMsgFilter (IN LPMSG lpMsg, IN int nCode)
 {
   if (XEUNICODE_P)
     return CallMsgFilterW (lpMsg, nCode);
@@ -1190,111 +812,111 @@
 #endif /* !defined (CYGWIN_HEADERS) */
 
 UINT
-qxeRegisterClipboardFormat (const Extbyte * lpszFormat)
+qxeRegisterClipboardFormat (IN const Extbyte * lpszFormat)
 {
   if (XEUNICODE_P)
-    return RegisterClipboardFormatW ((LPCWSTR) lpszFormat);
+    return RegisterClipboardFormatW ((IN LPCWSTR) lpszFormat);
   else
-    return RegisterClipboardFormatA ((LPCSTR) lpszFormat);
+    return RegisterClipboardFormatA ((IN LPCSTR) lpszFormat);
 }
 
 int
-qxeGetClipboardFormatName (UINT format, Extbyte * lpszFormatName, int
cchMaxCount)
+qxeGetClipboardFormatName (IN UINT format, OUT Extbyte *
lpszFormatName, IN int cchMaxCount)
 {
   if (XEUNICODE_P)
-    return GetClipboardFormatNameW (format, (LPWSTR) lpszFormatName,
cchMaxCount);
+    return GetClipboardFormatNameW (format, (OUT LPWSTR)
lpszFormatName, cchMaxCount);
   else
-    return GetClipboardFormatNameA (format, (LPSTR) lpszFormatName,
cchMaxCount);
+    return GetClipboardFormatNameA (format, (OUT LPSTR) lpszFormatName,
cchMaxCount);
 }
 
 BOOL
-qxeCharToOem (const Extbyte * lpszSrc, LPSTR lpszDst)
+qxeCharToOem (IN const Extbyte * lpszSrc, OUT LPSTR lpszDst)
 {
   if (XEUNICODE_P)
-    return CharToOemW ((LPCWSTR) lpszSrc, lpszDst);
+    return CharToOemW ((IN LPCWSTR) lpszSrc, lpszDst);
   else
-    return CharToOemA ((LPCSTR) lpszSrc, lpszDst);
+    return CharToOemA ((IN LPCSTR) lpszSrc, lpszDst);
 }
 
 BOOL
-qxeOemToChar (LPCSTR lpszSrc, Extbyte * lpszDst)
+qxeOemToChar (IN LPCSTR lpszSrc, OUT Extbyte * lpszDst)
 {
   if (XEUNICODE_P)
-    return OemToCharW (lpszSrc, (LPWSTR) lpszDst);
+    return OemToCharW (lpszSrc, (OUT LPWSTR) lpszDst);
   else
-    return OemToCharA (lpszSrc, (LPSTR) lpszDst);
+    return OemToCharA (lpszSrc, (OUT LPSTR) lpszDst);
 }
 
 BOOL
-qxeCharToOemBuff (const Extbyte * lpszSrc, LPSTR lpszDst, DWORD
cchDstLength)
+qxeCharToOemBuff (IN const Extbyte * lpszSrc, OUT LPSTR lpszDst, IN
DWORD cchDstLength)
 {
   if (XEUNICODE_P)
-    return CharToOemBuffW ((LPCWSTR) lpszSrc, lpszDst, cchDstLength);
+    return CharToOemBuffW ((IN LPCWSTR) lpszSrc, lpszDst,
cchDstLength);
   else
-    return CharToOemBuffA ((LPCSTR) lpszSrc, lpszDst, cchDstLength);
+    return CharToOemBuffA ((IN LPCSTR) lpszSrc, lpszDst, cchDstLength);
 }
 
 BOOL
-qxeOemToCharBuff (LPCSTR lpszSrc, Extbyte * lpszDst, DWORD
cchDstLength)
+qxeOemToCharBuff (IN LPCSTR lpszSrc, OUT Extbyte * lpszDst, IN DWORD
cchDstLength)
 {
   if (XEUNICODE_P)
-    return OemToCharBuffW (lpszSrc, (LPWSTR) lpszDst, cchDstLength);
+    return OemToCharBuffW (lpszSrc, (OUT LPWSTR) lpszDst,
cchDstLength);
   else
-    return OemToCharBuffA (lpszSrc, (LPSTR) lpszDst, cchDstLength);
+    return OemToCharBuffA (lpszSrc, (OUT LPSTR) lpszDst, cchDstLength);
 }
 
 Extbyte *
-qxeCharUpper (Extbyte * lpsz)
+qxeCharUpper (IN OUT Extbyte * lpsz)
 {
   if (XEUNICODE_P)
-    return (Extbyte *) CharUpperW ((LPWSTR) lpsz);
+    return (Extbyte *) CharUpperW ((IN OUT LPWSTR) lpsz);
   else
-    return (Extbyte *) CharUpperA ((LPSTR) lpsz);
+    return (Extbyte *) CharUpperA ((IN OUT LPSTR) lpsz);
 }
 
 DWORD
-qxeCharUpperBuff (Extbyte * lpsz, DWORD cchLength)
+qxeCharUpperBuff (IN OUT Extbyte * lpsz, IN DWORD cchLength)
 {
   if (XEUNICODE_P)
-    return CharUpperBuffW ((LPWSTR) lpsz, cchLength);
+    return CharUpperBuffW ((IN OUT LPWSTR) lpsz, cchLength);
   else
-    return CharUpperBuffA ((LPSTR) lpsz, cchLength);
+    return CharUpperBuffA ((IN OUT LPSTR) lpsz, cchLength);
 }
 
 Extbyte *
-qxeCharLower (Extbyte * lpsz)
+qxeCharLower (IN OUT Extbyte * lpsz)
 {
   if (XEUNICODE_P)
-    return (Extbyte *) CharLowerW ((LPWSTR) lpsz);
+    return (Extbyte *) CharLowerW ((IN OUT LPWSTR) lpsz);
   else
-    return (Extbyte *) CharLowerA ((LPSTR) lpsz);
+    return (Extbyte *) CharLowerA ((IN OUT LPSTR) lpsz);
 }
 
 DWORD
-qxeCharLowerBuff (Extbyte * lpsz, DWORD cchLength)
+qxeCharLowerBuff (IN OUT Extbyte * lpsz, IN DWORD cchLength)
 {
   if (XEUNICODE_P)
-    return CharLowerBuffW ((LPWSTR) lpsz, cchLength);
+    return CharLowerBuffW ((IN OUT LPWSTR) lpsz, cchLength);
   else
-    return CharLowerBuffA ((LPSTR) lpsz, cchLength);
+    return CharLowerBuffA ((IN OUT LPSTR) lpsz, cchLength);
 }
 
 Extbyte *
-qxeCharNext (const Extbyte * lpsz)
+qxeCharNext (IN const Extbyte * lpsz)
 {
   if (XEUNICODE_P)
-    return (Extbyte *) CharNextW ((LPCWSTR) lpsz);
+    return (Extbyte *) CharNextW ((IN LPCWSTR) lpsz);
   else
-    return (Extbyte *) CharNextA ((LPCSTR) lpsz);
+    return (Extbyte *) CharNextA ((IN LPCSTR) lpsz);
 }
 
 Extbyte *
-qxeCharPrev (const Extbyte * lpszStart, const Extbyte * lpszCurrent)
+qxeCharPrev (IN const Extbyte * lpszStart, IN const Extbyte *
lpszCurrent)
 {
   if (XEUNICODE_P)
-    return (Extbyte *) CharPrevW ((LPCWSTR) lpszStart, (LPCWSTR)
lpszCurrent);
+    return (Extbyte *) CharPrevW ((IN LPCWSTR) lpszStart, (IN LPCWSTR)
lpszCurrent);
   else
-    return (Extbyte *) CharPrevA ((LPCSTR) lpszStart, (LPCSTR)
lpszCurrent);
+    return (Extbyte *) CharPrevA ((IN LPCSTR) lpszStart, (IN LPCSTR)
lpszCurrent);
 }
 
 /* Error if IsCharAlpha used: split CHAR */
@@ -1306,12 +928,12 @@
 /* Error if IsCharLower used: split CHAR */
 
 int
-qxeGetKeyNameText (LONG lParam, Extbyte * lpString, int nSize)
+qxeGetKeyNameText (IN LONG lParam, OUT Extbyte * lpString, IN int
nSize)
 {
   if (XEUNICODE_P)
-    return GetKeyNameTextW (lParam, (LPWSTR) lpString, nSize);
+    return GetKeyNameTextW (lParam, (OUT LPWSTR) lpString, nSize);
   else
-    return GetKeyNameTextA (lParam, (LPSTR) lpString, nSize);
+    return GetKeyNameTextA (lParam, (OUT LPSTR) lpString, nSize);
 }
 
 /* Skipping VkKeyScan because split CHAR */
@@ -1319,7 +941,7 @@
 /* Error if VkKeyScanEx used: split CHAR; NT 4.0+ only */
 
 UINT
-qxeMapVirtualKey (UINT uCode, UINT uMapType)
+qxeMapVirtualKey (IN UINT uCode, IN UINT uMapType)
 {
   if (XEUNICODE_P)
     return MapVirtualKeyW (uCode, uMapType);
@@ -1329,7 +951,7 @@
 
 /* NOTE: NT 4.0+ only */
 UINT
-qxeMapVirtualKeyEx (UINT uCode, UINT uMapType, HKL dwhkl)
+qxeMapVirtualKeyEx (IN UINT uCode, IN UINT uMapType, IN HKL dwhkl)
 {
   if (XEUNICODE_P)
     return MapVirtualKeyExW (uCode, uMapType, dwhkl);
@@ -1338,16 +960,16 @@
 }
 
 HACCEL
-qxeLoadAccelerators (HINSTANCE hInstance, const Extbyte * lpTableName)
+qxeLoadAccelerators (IN HINSTANCE hInstance, IN const Extbyte *
lpTableName)
 {
   if (XEUNICODE_P)
-    return LoadAcceleratorsW (hInstance, (LPCWSTR) lpTableName);
+    return LoadAcceleratorsW (hInstance, (IN LPCWSTR) lpTableName);
   else
-    return LoadAcceleratorsA (hInstance, (LPCSTR) lpTableName);
+    return LoadAcceleratorsA (hInstance, (IN LPCSTR) lpTableName);
 }
 
 HACCEL
-qxeCreateAcceleratorTable (LPACCEL arg1, int arg2)
+qxeCreateAcceleratorTable (IN LPACCEL arg1, IN int arg2)
 {
   if (XEUNICODE_P)
     return CreateAcceleratorTableW (arg1, arg2);
@@ -1356,7 +978,7 @@
 }
 
 int
-qxeCopyAcceleratorTable (HACCEL hAccelSrc, LPACCEL lpAccelDst, int
cAccelEntries)
+qxeCopyAcceleratorTable (IN HACCEL hAccelSrc, OUT LPACCEL lpAccelDst,
IN int cAccelEntries)
 {
   if (XEUNICODE_P)
     return CopyAcceleratorTableW (hAccelSrc, lpAccelDst,
cAccelEntries);
@@ -1365,7 +987,7 @@
 }
 
 int
-qxeTranslateAccelerator (HWND hWnd, HACCEL hAccTable, LPMSG lpMsg)
+qxeTranslateAccelerator (IN HWND hWnd, IN HACCEL hAccTable, IN LPMSG
lpMsg)
 {
   if (XEUNICODE_P)
     return TranslateAcceleratorW (hWnd, hAccTable, lpMsg);
@@ -1374,119 +996,119 @@
 }
 
 HMENU
-qxeLoadMenu (HINSTANCE hInstance, const Extbyte * lpMenuName)
+qxeLoadMenu (IN HINSTANCE hInstance, IN const Extbyte * lpMenuName)
 {
   if (XEUNICODE_P)
-    return LoadMenuW (hInstance, (LPCWSTR) lpMenuName);
+    return LoadMenuW (hInstance, (IN LPCWSTR) lpMenuName);
   else
-    return LoadMenuA (hInstance, (LPCSTR) lpMenuName);
+    return LoadMenuA (hInstance, (IN LPCSTR) lpMenuName);
 }
 
 HMENU
-qxeLoadMenuIndirect (CONST MENUTEMPLATEW * lpMenuTemplate)
+qxeLoadMenuIndirect (IN CONST MENUTEMPLATEW * lpMenuTemplate)
 {
   if (XEUNICODE_P)
     return LoadMenuIndirectW (lpMenuTemplate);
   else
-    return LoadMenuIndirectA ((CONST MENUTEMPLATEA *) lpMenuTemplate);
+    return LoadMenuIndirectA ((IN CONST MENUTEMPLATEA *)
lpMenuTemplate);
 }
 
 BOOL
-qxeChangeMenu (HMENU hMenu, UINT cmd, const Extbyte * lpszNewItem, UINT
cmdInsert, UINT flags)
+qxeChangeMenu (IN HMENU hMenu, IN UINT cmd, IN const Extbyte *
lpszNewItem, IN UINT cmdInsert, IN UINT flags)
 {
   if (XEUNICODE_P)
-    return ChangeMenuW (hMenu, cmd, (LPCWSTR) lpszNewItem, cmdInsert,
flags);
+    return ChangeMenuW (hMenu, cmd, (IN LPCWSTR) lpszNewItem,
cmdInsert, flags);
   else
-    return ChangeMenuA (hMenu, cmd, (LPCSTR) lpszNewItem, cmdInsert,
flags);
+    return ChangeMenuA (hMenu, cmd, (IN LPCSTR) lpszNewItem, cmdInsert,
flags);
 }
 
 int
-qxeGetMenuString (HMENU hMenu, UINT uIDItem, Extbyte * lpString, int
nMaxCount, UINT uFlag)
+qxeGetMenuString (IN HMENU hMenu, IN UINT uIDItem, OUT Extbyte *
lpString, IN int nMaxCount, IN UINT uFlag)
 {
   if (XEUNICODE_P)
-    return GetMenuStringW (hMenu, uIDItem, (LPWSTR) lpString,
nMaxCount, uFlag);
+    return GetMenuStringW (hMenu, uIDItem, (OUT LPWSTR) lpString,
nMaxCount, uFlag);
   else
-    return GetMenuStringA (hMenu, uIDItem, (LPSTR) lpString, nMaxCount,
uFlag);
+    return GetMenuStringA (hMenu, uIDItem, (OUT LPSTR) lpString,
nMaxCount, uFlag);
 }
 
 BOOL
-qxeInsertMenu (HMENU hMenu, UINT uPosition, UINT uFlags, UINT
uIDNewItem, const Extbyte * lpNewItem)
+qxeInsertMenu (IN HMENU hMenu, IN UINT uPosition, IN UINT uFlags, IN
UINT_PTR uIDNewItem, IN const Extbyte * lpNewItem)
 {
   if (XEUNICODE_P)
-    return InsertMenuW (hMenu, uPosition, uFlags, uIDNewItem, (LPCWSTR)
lpNewItem);
+    return InsertMenuW (hMenu, uPosition, uFlags, uIDNewItem, (IN
LPCWSTR) lpNewItem);
   else
-    return InsertMenuA (hMenu, uPosition, uFlags, uIDNewItem, (LPCSTR)
lpNewItem);
+    return InsertMenuA (hMenu, uPosition, uFlags, uIDNewItem, (IN
LPCSTR) lpNewItem);
 }
 
 BOOL
-qxeAppendMenu (HMENU hMenu, UINT uFlags, UINT uIDNewItem, const Extbyte
* lpNewItem)
+qxeAppendMenu (IN HMENU hMenu, IN UINT uFlags, IN UINT_PTR uIDNewItem,
IN const Extbyte * lpNewItem)
 {
   if (XEUNICODE_P)
-    return AppendMenuW (hMenu, uFlags, uIDNewItem, (LPCWSTR)
lpNewItem);
+    return AppendMenuW (hMenu, uFlags, uIDNewItem, (IN LPCWSTR)
lpNewItem);
   else
-    return AppendMenuA (hMenu, uFlags, uIDNewItem, (LPCSTR) lpNewItem);
+    return AppendMenuA (hMenu, uFlags, uIDNewItem, (IN LPCSTR)
lpNewItem);
 }
 
 BOOL
-qxeModifyMenu (HMENU hMnu, UINT uPosition, UINT uFlags, UINT
uIDNewItem, const Extbyte * lpNewItem)
+qxeModifyMenu (IN HMENU hMnu, IN UINT uPosition, IN UINT uFlags, IN
UINT_PTR uIDNewItem, IN const Extbyte * lpNewItem)
 {
   if (XEUNICODE_P)
-    return ModifyMenuW (hMnu, uPosition, uFlags, uIDNewItem, (LPCWSTR)
lpNewItem);
+    return ModifyMenuW (hMnu, uPosition, uFlags, uIDNewItem, (IN
LPCWSTR) lpNewItem);
   else
-    return ModifyMenuA (hMnu, uPosition, uFlags, uIDNewItem, (LPCSTR)
lpNewItem);
+    return ModifyMenuA (hMnu, uPosition, uFlags, uIDNewItem, (IN
LPCSTR) lpNewItem);
 }
 
 /* NOTE: NT 4.0+ only */
 BOOL
-qxeInsertMenuItem (HMENU arg1, UINT arg2, BOOL arg3, LPCMENUITEMINFOW
arg4)
+qxeInsertMenuItem (IN HMENU arg1, IN UINT arg2, IN BOOL arg3, IN
LPCMENUITEMINFOW arg4)
 {
   if (XEUNICODE_P)
     return InsertMenuItemW (arg1, arg2, arg3, arg4);
   else
-    return InsertMenuItemA (arg1, arg2, arg3, (LPCMENUITEMINFOA) arg4);
+    return InsertMenuItemA (arg1, arg2, arg3, (IN LPCMENUITEMINFOA)
arg4);
 }
 
 /* NOTE: NT 4.0+ only */
 BOOL
-qxeGetMenuItemInfo (HMENU arg1, UINT arg2, BOOL arg3, LPMENUITEMINFOW
arg4)
+qxeGetMenuItemInfo (IN HMENU arg1, IN UINT arg2, IN BOOL arg3, IN OUT
LPMENUITEMINFOW arg4)
 {
   if (XEUNICODE_P)
     return GetMenuItemInfoW (arg1, arg2, arg3, arg4);
   else
-    return GetMenuItemInfoA (arg1, arg2, arg3, (LPMENUITEMINFOA) arg4);
+    return GetMenuItemInfoA (arg1, arg2, arg3, (IN OUT LPMENUITEMINFOA)
arg4);
 }
 
 /* NOTE: NT 4.0+ only */
 BOOL
-qxeSetMenuItemInfo (HMENU arg1, UINT arg2, BOOL arg3, LPCMENUITEMINFOW
arg4)
+qxeSetMenuItemInfo (IN HMENU arg1, IN UINT arg2, IN BOOL arg3, IN
LPCMENUITEMINFOW arg4)
 {
   if (XEUNICODE_P)
     return SetMenuItemInfoW (arg1, arg2, arg3, arg4);
   else
-    return SetMenuItemInfoA (arg1, arg2, arg3, (LPCMENUITEMINFOA)
arg4);
+    return SetMenuItemInfoA (arg1, arg2, arg3, (IN LPCMENUITEMINFOA)
arg4);
 }
 
 int
-qxeDrawText (HDC hDC, const Extbyte * lpString, int nCount, LPRECT
lpRect, UINT uFormat)
+qxeDrawText (IN HDC hDC, IN const Extbyte * lpString, IN int nCount, IN
OUT LPRECT lpRect, IN UINT uFormat)
 {
   if (XEUNICODE_P)
-    return DrawTextW (hDC, (LPCWSTR) lpString, nCount, lpRect,
uFormat);
+    return DrawTextW (hDC, (IN LPCWSTR) lpString, nCount, lpRect,
uFormat);
   else
-    return DrawTextA (hDC, (LPCSTR) lpString, nCount, lpRect, uFormat);
+    return DrawTextA (hDC, (IN LPCSTR) lpString, nCount, lpRect,
uFormat);
 }
 
 /* NOTE: NT 4.0+ only */
 int
-qxeDrawTextEx (HDC arg1, Extbyte * arg2, int arg3, LPRECT arg4, UINT
arg5, LPDRAWTEXTPARAMS arg6)
+qxeDrawTextEx (IN HDC arg1, IN OUT Extbyte * arg2, IN int arg3, IN OUT
LPRECT arg4, IN UINT arg5, IN LPDRAWTEXTPARAMS arg6)
 {
   if (XEUNICODE_P)
-    return DrawTextExW (arg1, (LPWSTR) arg2, arg3, arg4, arg5, arg6);
+    return DrawTextExW (arg1, (IN OUT LPWSTR) arg2, arg3, arg4, arg5,
arg6);
   else
-    return DrawTextExA (arg1, (LPSTR) arg2, arg3, arg4, arg5, arg6);
+    return DrawTextExA (arg1, (IN OUT LPSTR) arg2, arg3, arg4, arg5,
arg6);
 }
 
 BOOL
-qxeGrayString (HDC hDC, HBRUSH hBrush, GRAYSTRINGPROC lpOutputFunc,
LPARAM lpData, int nCount, int X, int Y, int nWidth, int nHeight)
+qxeGrayString (IN HDC hDC, IN HBRUSH hBrush, IN GRAYSTRINGPROC
lpOutputFunc, IN LPARAM lpData, IN int nCount, IN int X, IN int Y, IN
int nWidth, IN int nHeight)
 {
   if (XEUNICODE_P)
     return GrayStringW (hDC, hBrush, lpOutputFunc, lpData, nCount, X,
Y, nWidth, nHeight);
@@ -1496,7 +1118,7 @@
 
 /* NOTE: NT 4.0+ only */
 BOOL
-qxeDrawState (HDC arg1, HBRUSH arg2, DRAWSTATEPROC arg3, LPARAM arg4,
WPARAM arg5, int arg6, int arg7, int arg8, int arg9, UINT arg10)
+qxeDrawState (IN HDC arg1, IN HBRUSH arg2, IN DRAWSTATEPROC arg3, IN
LPARAM arg4, IN WPARAM arg5, IN int arg6, IN int arg7, IN int arg8, IN
int arg9, IN UINT arg10)
 {
   if (XEUNICODE_P)
     return DrawStateW (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
arg9, arg10);
@@ -1505,90 +1127,90 @@
 }
 
 LONG
-qxeTabbedTextOut (HDC hDC, int X, int Y, const Extbyte * lpString, int
nCount, int nTabPositions, LPINT lpnTabStopPositions, int nTabOrigin)
+qxeTabbedTextOut (IN HDC hDC, IN int X, IN int Y, IN const Extbyte *
lpString, IN int nCount, IN int nTabPositions, IN CONST INT *
lpnTabStopPositions, IN int nTabOrigin)
 {
   if (XEUNICODE_P)
-    return TabbedTextOutW (hDC, X, Y, (LPCWSTR) lpString, nCount,
nTabPositions, lpnTabStopPositions, nTabOrigin);
+    return TabbedTextOutW (hDC, X, Y, (IN LPCWSTR) lpString, nCount,
nTabPositions, lpnTabStopPositions, nTabOrigin);
   else
-    return TabbedTextOutA (hDC, X, Y, (LPCSTR) lpString, nCount,
nTabPositions, lpnTabStopPositions, nTabOrigin);
+    return TabbedTextOutA (hDC, X, Y, (IN LPCSTR) lpString, nCount,
nTabPositions, lpnTabStopPositions, nTabOrigin);
 }
 
 DWORD
-qxeGetTabbedTextExtent (HDC hDC, const Extbyte * lpString, int nCount,
int nTabPositions, LPINT lpnTabStopPositions)
+qxeGetTabbedTextExtent (IN HDC hDC, IN const Extbyte * lpString, IN int
nCount, IN int nTabPositions, IN CONST INT * lpnTabStopPositions)
 {
   if (XEUNICODE_P)
-    return GetTabbedTextExtentW (hDC, (LPCWSTR) lpString, nCount,
nTabPositions, lpnTabStopPositions);
+    return GetTabbedTextExtentW (hDC, (IN LPCWSTR) lpString, nCount,
nTabPositions, lpnTabStopPositions);
   else
-    return GetTabbedTextExtentA (hDC, (LPCSTR) lpString, nCount,
nTabPositions, lpnTabStopPositions);
+    return GetTabbedTextExtentA (hDC, (IN LPCSTR) lpString, nCount,
nTabPositions, lpnTabStopPositions);
 }
 
 BOOL
-qxeSetProp (HWND hWnd, const Extbyte * lpString, HANDLE hData)
+qxeSetProp (IN HWND hWnd, IN const Extbyte * lpString, IN HANDLE hData)
 {
   if (XEUNICODE_P)
-    return SetPropW (hWnd, (LPCWSTR) lpString, hData);
+    return SetPropW (hWnd, (IN LPCWSTR) lpString, hData);
   else
-    return SetPropA (hWnd, (LPCSTR) lpString, hData);
+    return SetPropA (hWnd, (IN LPCSTR) lpString, hData);
 }
 
 HANDLE
-qxeGetProp (HWND hWnd, const Extbyte * lpString)
+qxeGetProp (IN HWND hWnd, IN const Extbyte * lpString)
 {
   if (XEUNICODE_P)
-    return GetPropW (hWnd, (LPCWSTR) lpString);
+    return GetPropW (hWnd, (IN LPCWSTR) lpString);
   else
-    return GetPropA (hWnd, (LPCSTR) lpString);
+    return GetPropA (hWnd, (IN LPCSTR) lpString);
 }
 
 HANDLE
-qxeRemoveProp (HWND hWnd, const Extbyte * lpString)
+qxeRemoveProp (IN HWND hWnd, IN const Extbyte * lpString)
 {
   if (XEUNICODE_P)
-    return RemovePropW (hWnd, (LPCWSTR) lpString);
+    return RemovePropW (hWnd, (IN LPCWSTR) lpString);
   else
-    return RemovePropA (hWnd, (LPCSTR) lpString);
+    return RemovePropA (hWnd, (IN LPCSTR) lpString);
 }
 
 /* NOTE: // callback fun differs only in string pointer type */
 int
-qxeEnumPropsEx (HWND hWnd, PROPENUMPROCEXW lpEnumFunc, LPARAM lParam)
+qxeEnumPropsEx (IN HWND hWnd, IN PROPENUMPROCEXW lpEnumFunc, IN LPARAM
lParam)
 {
   if (XEUNICODE_P)
     return EnumPropsExW (hWnd, lpEnumFunc, lParam);
   else
-    return EnumPropsExA (hWnd, (PROPENUMPROCEXA) lpEnumFunc, lParam);
+    return EnumPropsExA (hWnd, (IN PROPENUMPROCEXA) lpEnumFunc,
lParam);
 }
 
 /* NOTE: // callback fun differs only in string pointer type */
 int
-qxeEnumProps (HWND hWnd, PROPENUMPROCW lpEnumFunc)
+qxeEnumProps (IN HWND hWnd, IN PROPENUMPROCW lpEnumFunc)
 {
   if (XEUNICODE_P)
     return EnumPropsW (hWnd, lpEnumFunc);
   else
-    return EnumPropsA (hWnd, (PROPENUMPROCA) lpEnumFunc);
+    return EnumPropsA (hWnd, (IN PROPENUMPROCA) lpEnumFunc);
 }
 
 BOOL
-qxeSetWindowText (HWND hWnd, const Extbyte * lpString)
+qxeSetWindowText (IN HWND hWnd, IN const Extbyte * lpString)
 {
   if (XEUNICODE_P)
-    return SetWindowTextW (hWnd, (LPCWSTR) lpString);
+    return SetWindowTextW (hWnd, (IN LPCWSTR) lpString);
   else
-    return SetWindowTextA (hWnd, (LPCSTR) lpString);
+    return SetWindowTextA (hWnd, (IN LPCSTR) lpString);
 }
 
 int
-qxeGetWindowText (HWND hWnd, Extbyte * lpString, int nMaxCount)
+qxeGetWindowText (IN HWND hWnd, OUT Extbyte * lpString, IN int
nMaxCount)
 {
   if (XEUNICODE_P)
-    return GetWindowTextW (hWnd, (LPWSTR) lpString, nMaxCount);
+    return GetWindowTextW (hWnd, (OUT LPWSTR) lpString, nMaxCount);
   else
-    return GetWindowTextA (hWnd, (LPSTR) lpString, nMaxCount);
+    return GetWindowTextA (hWnd, (OUT LPSTR) lpString, nMaxCount);
 }
 
 int
-qxeGetWindowTextLength (HWND hWnd)
+qxeGetWindowTextLength (IN HWND hWnd)
 {
   if (XEUNICODE_P)
     return GetWindowTextLengthW (hWnd);
@@ -1597,35 +1219,35 @@
 }
 
 int
-qxeMessageBox (HWND hWnd, const Extbyte * lpText, const Extbyte *
lpCaption, UINT uType)
+qxeMessageBox (IN HWND hWnd, IN const Extbyte * lpText, IN const
Extbyte * lpCaption, IN UINT uType)
 {
   if (XEUNICODE_P)
-    return MessageBoxW (hWnd, (LPCWSTR) lpText, (LPCWSTR) lpCaption,
uType);
+    return MessageBoxW (hWnd, (IN LPCWSTR) lpText, (IN LPCWSTR)
lpCaption, uType);
   else
-    return MessageBoxA (hWnd, (LPCSTR) lpText, (LPCSTR) lpCaption,
uType);
+    return MessageBoxA (hWnd, (IN LPCSTR) lpText, (IN LPCSTR)
lpCaption, uType);
 }
 
 int
-qxeMessageBoxEx (HWND hWnd, const Extbyte * lpText, const Extbyte *
lpCaption, UINT uType, WORD wLanguageId)
+qxeMessageBoxEx (IN HWND hWnd, IN const Extbyte * lpText, IN const
Extbyte * lpCaption, IN UINT uType, IN WORD wLanguageId)
 {
   if (XEUNICODE_P)
-    return MessageBoxExW (hWnd, (LPCWSTR) lpText, (LPCWSTR) lpCaption,
uType, wLanguageId);
+    return MessageBoxExW (hWnd, (IN LPCWSTR) lpText, (IN LPCWSTR)
lpCaption, uType, wLanguageId);
   else
-    return MessageBoxExA (hWnd, (LPCSTR) lpText, (LPCSTR) lpCaption,
uType, wLanguageId);
+    return MessageBoxExA (hWnd, (IN LPCSTR) lpText, (IN LPCSTR)
lpCaption, uType, wLanguageId);
 }
 
 /* NOTE: NT 4.0+ only */
 int
-qxeMessageBoxIndirect (LPMSGBOXPARAMSW arg1)
+qxeMessageBoxIndirect (IN CONST MSGBOXPARAMSW * arg1)
 {
   if (XEUNICODE_P)
     return MessageBoxIndirectW (arg1);
   else
-    return MessageBoxIndirectA ((LPMSGBOXPARAMSA) arg1);
+    return MessageBoxIndirectA ((IN CONST MSGBOXPARAMSA *) arg1);
 }
 
 LONG
-qxeGetWindowLong (HWND hWnd, int nIndex)
+qxeGetWindowLong (IN HWND hWnd, IN int nIndex)
 {
   if (XEUNICODE_P)
     return GetWindowLongW (hWnd, nIndex);
@@ -1634,7 +1256,7 @@
 }
 
 LONG
-qxeSetWindowLong (HWND hWnd, int nIndex, LONG dwNewLong)
+qxeSetWindowLong (IN HWND hWnd, IN int nIndex, IN LONG dwNewLong)
 {
   if (XEUNICODE_P)
     return SetWindowLongW (hWnd, nIndex, dwNewLong);
@@ -1643,7 +1265,7 @@
 }
 
 DWORD
-qxeGetClassLong (HWND hWnd, int nIndex)
+qxeGetClassLong (IN HWND hWnd, IN int nIndex)
 {
   if (XEUNICODE_P)
     return GetClassLongW (hWnd, nIndex);
@@ -1652,7 +1274,7 @@
 }
 
 DWORD
-qxeSetClassLong (HWND hWnd, int nIndex, LONG dwNewLong)
+qxeSetClassLong (IN HWND hWnd, IN int nIndex, IN LONG dwNewLong)
 {
   if (XEUNICODE_P)
     return SetClassLongW (hWnd, nIndex, dwNewLong);
@@ -1661,31 +1283,31 @@
 }
 
 HWND
-qxeFindWindow (const Extbyte * lpClassName, const Extbyte *
lpWindowName)
+qxeFindWindow (IN const Extbyte * lpClassName, IN const Extbyte *
lpWindowName)
 {
   if (XEUNICODE_P)
-    return FindWindowW ((LPCWSTR) lpClassName, (LPCWSTR) lpWindowName);
+    return FindWindowW ((IN LPCWSTR) lpClassName, (IN LPCWSTR)
lpWindowName);
   else
-    return FindWindowA ((LPCSTR) lpClassName, (LPCSTR) lpWindowName);
+    return FindWindowA ((IN LPCSTR) lpClassName, (IN LPCSTR)
lpWindowName);
 }
 
 /* NOTE: NT 4.0+ only */
 HWND
-qxeFindWindowEx (HWND arg1, HWND arg2, const Extbyte * arg3, const
Extbyte * arg4)
+qxeFindWindowEx (IN HWND arg1, IN HWND arg2, IN const Extbyte * arg3,
IN const Extbyte * arg4)
 {
   if (XEUNICODE_P)
-    return FindWindowExW (arg1, arg2, (LPCWSTR) arg3, (LPCWSTR) arg4);
+    return FindWindowExW (arg1, arg2, (IN LPCWSTR) arg3, (IN LPCWSTR)
arg4);
   else
-    return FindWindowExA (arg1, arg2, (LPCSTR) arg3, (LPCSTR) arg4);
+    return FindWindowExA (arg1, arg2, (IN LPCSTR) arg3, (IN LPCSTR)
arg4);
 }
 
 int
-qxeGetClassName (HWND hWnd, Extbyte * lpClassName, int nMaxCount)
+qxeGetClassName (IN HWND hWnd, OUT Extbyte * lpClassName, IN int
nMaxCount)
 {
   if (XEUNICODE_P)
-    return GetClassNameW (hWnd, (LPWSTR) lpClassName, nMaxCount);
+    return GetClassNameW (hWnd, (OUT LPWSTR) lpClassName, nMaxCount);
   else
-    return GetClassNameA (hWnd, (LPSTR) lpClassName, nMaxCount);
+    return GetClassNameA (hWnd, (OUT LPSTR) lpClassName, nMaxCount);
 }
 
 /* Error if SetWindowsHook used: obsolete; two versions, STRICT and
non-STRICT */
@@ -1693,7 +1315,7 @@
 /* Error if SetWindowsHook used: obsolete; two versions, STRICT and
non-STRICT */
 
 HHOOK
-qxeSetWindowsHookEx (int idHook, HOOKPROC lpfn, HINSTANCE hmod, DWORD
dwThreadId)
+qxeSetWindowsHookEx (IN int idHook, IN HOOKPROC lpfn, IN HINSTANCE
hmod, IN DWORD dwThreadId)
 {
   if (XEUNICODE_P)
     return SetWindowsHookExW (idHook, lpfn, hmod, dwThreadId);
@@ -1702,62 +1324,62 @@
 }
 
 HBITMAP
-qxeLoadBitmap (HINSTANCE hInstance, const Extbyte * lpBitmapName)
+qxeLoadBitmap (IN HINSTANCE hInstance, IN const Extbyte * lpBitmapName)
 {
   if (XEUNICODE_P)
-    return LoadBitmapW (hInstance, (LPCWSTR) lpBitmapName);
+    return LoadBitmapW (hInstance, (IN LPCWSTR) lpBitmapName);
   else
-    return LoadBitmapA (hInstance, (LPCSTR) lpBitmapName);
+    return LoadBitmapA (hInstance, (IN LPCSTR) lpBitmapName);
 }
 
 HCURSOR
-qxeLoadCursor (HINSTANCE hInstance, const Extbyte * lpCursorName)
+qxeLoadCursor (IN HINSTANCE hInstance, IN const Extbyte * lpCursorName)
 {
   if (XEUNICODE_P)
-    return LoadCursorW (hInstance, (LPCWSTR) lpCursorName);
+    return LoadCursorW (hInstance, (IN LPCWSTR) lpCursorName);
   else
-    return LoadCursorA (hInstance, (LPCSTR) lpCursorName);
+    return LoadCursorA (hInstance, (IN LPCSTR) lpCursorName);
 }
 
 HCURSOR
-qxeLoadCursorFromFile (const Extbyte * lpFileName)
+qxeLoadCursorFromFile (IN const Extbyte * lpFileName)
 {
   if (XEUNICODE_P)
-    return LoadCursorFromFileW ((LPCWSTR) lpFileName);
+    return LoadCursorFromFileW ((IN LPCWSTR) lpFileName);
   else
-    return LoadCursorFromFileA ((LPCSTR) lpFileName);
+    return LoadCursorFromFileA ((IN LPCSTR) lpFileName);
 }
 
 HICON
-qxeLoadIcon (HINSTANCE hInstance, const Extbyte * lpIconName)
+qxeLoadIcon (IN HINSTANCE hInstance, IN const Extbyte * lpIconName)
 {
   if (XEUNICODE_P)
-    return LoadIconW (hInstance, (LPCWSTR) lpIconName);
+    return LoadIconW (hInstance, (IN LPCWSTR) lpIconName);
   else
-    return LoadIconA (hInstance, (LPCSTR) lpIconName);
+    return LoadIconA (hInstance, (IN LPCSTR) lpIconName);
 }
 
 /* NOTE: NT 4.0+ only */
 HANDLE
-qxeLoadImage (HINSTANCE arg1, const Extbyte * arg2, UINT arg3, int
arg4, int arg5, UINT arg6)
+qxeLoadImage (IN HINSTANCE arg1, IN const Extbyte * arg2, IN UINT arg3,
IN int arg4, IN int arg5, IN UINT arg6)
 {
   if (XEUNICODE_P)
-    return LoadImageW (arg1, (LPCWSTR) arg2, arg3, arg4, arg5, arg6);
+    return LoadImageW (arg1, (IN LPCWSTR) arg2, arg3, arg4, arg5,
arg6);
   else
-    return LoadImageA (arg1, (LPCSTR) arg2, arg3, arg4, arg5, arg6);
+    return LoadImageA (arg1, (IN LPCSTR) arg2, arg3, arg4, arg5, arg6);
 }
 
 int
-qxeLoadString (HINSTANCE hInstance, UINT uID, Extbyte * lpBuffer, int
nBufferMax)
+qxeLoadString (IN HINSTANCE hInstance, IN UINT uID, OUT Extbyte *
lpBuffer, IN int nBufferMax)
 {
   if (XEUNICODE_P)
-    return LoadStringW (hInstance, uID, (LPWSTR) lpBuffer, nBufferMax);
+    return LoadStringW (hInstance, uID, (OUT LPWSTR) lpBuffer,
nBufferMax);
   else
-    return LoadStringA (hInstance, uID, (LPSTR) lpBuffer, nBufferMax);
+    return LoadStringA (hInstance, uID, (OUT LPSTR) lpBuffer,
nBufferMax);
 }
 
 BOOL
-qxeIsDialogMessage (HWND hDlg, LPMSG lpMsg)
+qxeIsDialogMessage (IN HWND hDlg, IN LPMSG lpMsg)
 {
   if (XEUNICODE_P)
     return IsDialogMessageW (hDlg, lpMsg);
@@ -1766,43 +1388,43 @@
 }
 
 int
-qxeDlgDirList (HWND hDlg, Extbyte * lpPathSpec, int nIDListBox, int
nIDStaticPath, UINT uFileType)
+qxeDlgDirList (IN HWND hDlg, IN OUT Extbyte * lpPathSpec, IN int
nIDListBox, IN int nIDStaticPath, IN UINT uFileType)
 {
   if (XEUNICODE_P)
-    return DlgDirListW (hDlg, (LPWSTR) lpPathSpec, nIDListBox,
nIDStaticPath, uFileType);
+    return DlgDirListW (hDlg, (IN OUT LPWSTR) lpPathSpec, nIDListBox,
nIDStaticPath, uFileType);
   else
-    return DlgDirListA (hDlg, (LPSTR) lpPathSpec, nIDListBox,
nIDStaticPath, uFileType);
+    return DlgDirListA (hDlg, (IN OUT LPSTR) lpPathSpec, nIDListBox,
nIDStaticPath, uFileType);
 }
 
 BOOL
-qxeDlgDirSelectEx (HWND hDlg, Extbyte * lpString, int nCount, int
nIDListBox)
+qxeDlgDirSelectEx (IN HWND hDlg, OUT Extbyte * lpString, IN int nCount,
IN int nIDListBox)
 {
   if (XEUNICODE_P)
-    return DlgDirSelectExW (hDlg, (LPWSTR) lpString, nCount,
nIDListBox);
+    return DlgDirSelectExW (hDlg, (OUT LPWSTR) lpString, nCount,
nIDListBox);
   else
-    return DlgDirSelectExA (hDlg, (LPSTR) lpString, nCount,
nIDListBox);
+    return DlgDirSelectExA (hDlg, (OUT LPSTR) lpString, nCount,
nIDListBox);
 }
 
 int
-qxeDlgDirListComboBox (HWND hDlg, Extbyte * lpPathSpec, int
nIDComboBox, int nIDStaticPath, UINT uFiletype)
+qxeDlgDirListComboBox (IN HWND hDlg, IN OUT Extbyte * lpPathSpec, IN
int nIDComboBox, IN int nIDStaticPath, IN UINT uFiletype)
 {
   if (XEUNICODE_P)
-    return DlgDirListComboBoxW (hDlg, (LPWSTR) lpPathSpec, nIDComboBox,
nIDStaticPath, uFiletype);
+    return DlgDirListComboBoxW (hDlg, (IN OUT LPWSTR) lpPathSpec,
nIDComboBox, nIDStaticPath, uFiletype);
   else
-    return DlgDirListComboBoxA (hDlg, (LPSTR) lpPathSpec, nIDComboBox,
nIDStaticPath, uFiletype);
+    return DlgDirListComboBoxA (hDlg, (IN OUT LPSTR) lpPathSpec,
nIDComboBox, nIDStaticPath, uFiletype);
 }
 
 BOOL
-qxeDlgDirSelectComboBoxEx (HWND hDlg, Extbyte * lpString, int nCount,
int nIDComboBox)
+qxeDlgDirSelectComboBoxEx (IN HWND hDlg, OUT Extbyte * lpString, IN int
nCount, IN int nIDComboBox)
 {
   if (XEUNICODE_P)
-    return DlgDirSelectComboBoxExW (hDlg, (LPWSTR) lpString, nCount,
nIDComboBox);
+    return DlgDirSelectComboBoxExW (hDlg, (OUT LPWSTR) lpString,
nCount, nIDComboBox);
   else
-    return DlgDirSelectComboBoxExA (hDlg, (LPSTR) lpString, nCount,
nIDComboBox);
+    return DlgDirSelectComboBoxExA (hDlg, (OUT LPSTR) lpString, nCount,
nIDComboBox);
 }
 
 LRESULT
-qxeDefFrameProc (HWND hWnd, HWND hWndMDIClient, UINT uMsg, WPARAM
wParam, LPARAM lParam)
+qxeDefFrameProc (IN HWND hWnd, IN HWND hWndMDIClient, IN UINT uMsg, IN
WPARAM wParam, IN LPARAM lParam)
 {
   if (XEUNICODE_P)
     return DefFrameProcW (hWnd, hWndMDIClient, uMsg, wParam, lParam);
@@ -1813,21 +1435,21 @@
 /* Error if DefMDIChildProc used: return value is conditionalized on
_MAC, messes up parser */
 
 HWND
-qxeCreateMDIWindow (Extbyte * lpClassName, Extbyte * lpWindowName,
DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent,
HINSTANCE hInstance, LPARAM lParam)
+qxeCreateMDIWindow (IN const Extbyte * lpClassName, IN const Extbyte *
lpWindowName, IN DWORD dwStyle, IN int X, IN int Y, IN int nWidth, IN
int nHeight, IN HWND hWndParent, IN HINSTANCE hInstance, IN LPARAM
lParam)
 {
   if (XEUNICODE_P)
-    return CreateMDIWindowW ((LPWSTR) lpClassName, (LPWSTR)
lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance,
lParam);
+    return CreateMDIWindowW ((IN LPCWSTR) lpClassName, (IN LPCWSTR)
lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance,
lParam);
   else
-    return CreateMDIWindowA ((LPSTR) lpClassName, (LPSTR) lpWindowName,
dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam);
+    return CreateMDIWindowA ((IN LPCSTR) lpClassName, (IN LPCSTR)
lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance,
lParam);
 }
 
 BOOL
-qxeWinHelp (HWND hWndMain, const Extbyte * lpszHelp, UINT uCommand,
DWORD dwData)
+qxeWinHelp (IN HWND hWndMain, IN const Extbyte * lpszHelp, IN UINT
uCommand, IN ULONG_PTR dwData)
 {
   if (XEUNICODE_P)
-    return WinHelpW (hWndMain, (LPCWSTR) lpszHelp, uCommand, dwData);
+    return WinHelpW (hWndMain, (IN LPCWSTR) lpszHelp, uCommand,
dwData);
   else
-    return WinHelpA (hWndMain, (LPCSTR) lpszHelp, uCommand, dwData);
+    return WinHelpA (hWndMain, (IN LPCSTR) lpszHelp, uCommand, dwData);
 }
 
 /* Error if ChangeDisplaySettings used: split-sized LPDEVMODE */
@@ -1840,7 +1462,7 @@
 
 /* NOTE: probs w/ICONMETRICS, NONCLIENTMETRICS */
 BOOL
-qxeSystemParametersInfo (UINT uiAction, UINT uiParam, PVOID pvParam,
UINT fWinIni)
+qxeSystemParametersInfo (IN UINT uiAction, IN UINT uiParam, IN OUT
PVOID pvParam, IN UINT fWinIni)
 {
   if (XEUNICODE_P)
     return SystemParametersInfoW (uiAction, uiParam, pvParam, fWinIni);
@@ -1858,319 +1480,753 @@
 
 
 
/*----------------------------------------------------------------------
*/
-/*                       Processing file DDEML.H
*/
+/*                        Processing file IME.H
*/
 
/*----------------------------------------------------------------------
*/
-
-UINT
-qxeDdeInitialize (LPDWORD pidInst, PFNCALLBACK pfnCallback, DWORD
afCmd, DWORD ulRes)
-{
-  if (XEUNICODE_P)
-    return DdeInitializeW (pidInst, pfnCallback, afCmd, ulRes);
-  else
-    return DdeInitializeA (pidInst, pfnCallback, afCmd, ulRes);
-}
-
-/* Skipping DdeCreateStringHandle because error in Cygwin prototype */
 
-DWORD
-qxeDdeQueryString (DWORD idInst, HSZ hsz, Extbyte * psz, DWORD cchMax,
int iCodePage)
-{
-  if (XEUNICODE_P)
-    return DdeQueryStringW (idInst, hsz, (LPWSTR) psz, cchMax,
iCodePage);
-  else
-    return DdeQueryStringA (idInst, hsz, (LPSTR) psz, cchMax,
iCodePage);
-}
+/* Error if SendIMEMessageEx used: obsolete, no docs available */
 
 
 
/*----------------------------------------------------------------------
*/
-/*                       Processing file WINREG.H
*/
+/*                        Processing file IMM.H
*/
 
/*----------------------------------------------------------------------
*/
-
-/* Skipping RegConnectRegistry because error in Cygwin prototype */
 
-LONG
+#if defined (HAVE_MS_WINDOWS)
 
-qxeRegCreateKey (HKEY hKey, const Extbyte * lpSubKey, PHKEY phkResult)
+HKL
+qxeImmInstallIME (IN const Extbyte * lpszIMEFileName, IN const Extbyte
* lpszLayoutText)
 {
   if (XEUNICODE_P)
-    return RegCreateKeyW (hKey, (LPCWSTR) lpSubKey, phkResult);
+    return ImmInstallIMEW ((IN LPCWSTR) lpszIMEFileName, (IN LPCWSTR)
lpszLayoutText);
   else
-    return RegCreateKeyA (hKey, (LPCSTR) lpSubKey, phkResult);
+    return ImmInstallIMEA ((IN LPCSTR) lpszIMEFileName, (IN LPCSTR)
lpszLayoutText);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
 
-qxeRegCreateKeyEx (HKEY hKey, const Extbyte * lpSubKey, DWORD Reserved,
Extbyte * lpClass, DWORD dwOptions, REGSAM samDesired,
LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD
lpdwDisposition)
+#if defined (HAVE_MS_WINDOWS)
+
+UINT
+qxeImmGetDescription (IN HKL arg1, OUT Extbyte * arg2, IN UINT uBufLen)
 {
   if (XEUNICODE_P)
-    return RegCreateKeyExW (hKey, (LPCWSTR) lpSubKey, Reserved,
(LPWSTR) lpClass, dwOptions, samDesired, lpSecurityAttributes,
phkResult, lpdwDisposition);
+    return ImmGetDescriptionW (arg1, (OUT LPWSTR) arg2, uBufLen);
   else
-    return RegCreateKeyExA (hKey, (LPCSTR) lpSubKey, Reserved, (LPSTR)
lpClass, dwOptions, samDesired, lpSecurityAttributes, phkResult,
lpdwDisposition);
+    return ImmGetDescriptionA (arg1, (OUT LPSTR) arg2, uBufLen);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
 
-qxeRegDeleteKey (HKEY hKey, const Extbyte * lpSubKey)
+UINT
+qxeImmGetIMEFileName (IN HKL arg1, OUT Extbyte * arg2, IN UINT uBufLen)
 {
   if (XEUNICODE_P)
-    return RegDeleteKeyW (hKey, (LPCWSTR) lpSubKey);
+    return ImmGetIMEFileNameW (arg1, (OUT LPWSTR) arg2, uBufLen);
   else
-    return RegDeleteKeyA (hKey, (LPCSTR) lpSubKey);
+    return ImmGetIMEFileNameA (arg1, (OUT LPSTR) arg2, uBufLen);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
 
-qxeRegDeleteValue (HKEY hKey, const Extbyte * lpValueName)
-{
-  if (XEUNICODE_P)
-    return RegDeleteValueW (hKey, (LPCWSTR) lpValueName);
-  else
-    return RegDeleteValueA (hKey, (LPCSTR) lpValueName);
-}
+#if defined (HAVE_MS_WINDOWS)
 
 LONG
-
-qxeRegEnumKey (HKEY hKey, DWORD dwIndex, Extbyte * lpName, DWORD
cbName)
+qxeImmGetCompositionString (IN HIMC arg1, IN DWORD arg2, OUT LPVOID
arg3, IN DWORD arg4)
 {
   if (XEUNICODE_P)
-    return RegEnumKeyW (hKey, dwIndex, (LPWSTR) lpName, cbName);
+    return ImmGetCompositionStringW (arg1, arg2, arg3, arg4);
   else
-    return RegEnumKeyA (hKey, dwIndex, (LPSTR) lpName, cbName);
+    return ImmGetCompositionStringA (arg1, arg2, arg3, arg4);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
 
-qxeRegEnumKeyEx (HKEY hKey, DWORD dwIndex, Extbyte * lpName, LPDWORD
lpcbName, LPDWORD lpReserved, Extbyte * lpClass, LPDWORD lpcbClass,
PFILETIME lpftLastWriteTime)
+#if defined (HAVE_MS_WINDOWS)
+
+/* Skipping ImmSetCompositionString because different prototypes in VC6
and VC7 */
+
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
+
+DWORD
+qxeImmGetCandidateListCount (IN HIMC arg1, OUT LPDWORD lpdwListCount)
 {
   if (XEUNICODE_P)
-    return RegEnumKeyExW (hKey, dwIndex, (LPWSTR) lpName, lpcbName,
lpReserved, (LPWSTR) lpClass, lpcbClass, lpftLastWriteTime);
+    return ImmGetCandidateListCountW (arg1, lpdwListCount);
   else
-    return RegEnumKeyExA (hKey, dwIndex, (LPSTR) lpName, lpcbName,
lpReserved, (LPSTR) lpClass, lpcbClass, lpftLastWriteTime);
+    return ImmGetCandidateListCountA (arg1, lpdwListCount);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
 
-qxeRegEnumValue (HKEY hKey, DWORD dwIndex, Extbyte * lpValueName,
LPDWORD lpcbValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE
lpData, LPDWORD lpcbData)
+#if defined (HAVE_MS_WINDOWS)
+
+DWORD
+qxeImmGetCandidateList (IN HIMC arg1, IN DWORD deIndex, OUT
LPCANDIDATELIST arg3, IN DWORD dwBufLen)
 {
   if (XEUNICODE_P)
-    return RegEnumValueW (hKey, dwIndex, (LPWSTR) lpValueName,
lpcbValueName, lpReserved, lpType, lpData, lpcbData);
+    return ImmGetCandidateListW (arg1, deIndex, arg3, dwBufLen);
   else
-    return RegEnumValueA (hKey, dwIndex, (LPSTR) lpValueName,
lpcbValueName, lpReserved, lpType, lpData, lpcbData);
+    return ImmGetCandidateListA (arg1, deIndex, arg3, dwBufLen);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
 
-qxeRegLoadKey (HKEY hKey, const Extbyte * lpSubKey, const Extbyte *
lpFile)
+DWORD
+qxeImmGetGuideLine (IN HIMC arg1, IN DWORD dwIndex, OUT Extbyte * arg3,
IN DWORD dwBufLen)
 {
   if (XEUNICODE_P)
-    return RegLoadKeyW (hKey, (LPCWSTR) lpSubKey, (LPCWSTR) lpFile);
+    return ImmGetGuideLineW (arg1, dwIndex, (OUT LPWSTR) arg3,
dwBufLen);
   else
-    return RegLoadKeyA (hKey, (LPCSTR) lpSubKey, (LPCSTR) lpFile);
+    return ImmGetGuideLineA (arg1, dwIndex, (OUT LPSTR) arg3,
dwBufLen);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
 
-qxeRegOpenKey (HKEY hKey, const Extbyte * lpSubKey, PHKEY phkResult)
+#if defined (HAVE_MS_WINDOWS)
+
+/* Skipping ImmGetCompositionFont because split-sized LOGFONT */
+
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
+
+/* Skipping ImmSetCompositionFont because split-sized LOGFONT */
+
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
+
+/* NOTE: // split-simple REGISTERWORD */
+BOOL
+qxeImmConfigureIME (IN HKL arg1, IN HWND arg2, IN DWORD arg3, IN LPVOID
arg4)
 {
   if (XEUNICODE_P)
-    return RegOpenKeyW (hKey, (LPCWSTR) lpSubKey, phkResult);
+    return ImmConfigureIMEW (arg1, arg2, arg3, arg4);
   else
-    return RegOpenKeyA (hKey, (LPCSTR) lpSubKey, phkResult);
+    return ImmConfigureIMEA (arg1, arg2, arg3, arg4);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
 
-qxeRegOpenKeyEx (HKEY hKey, const Extbyte * lpSubKey, DWORD ulOptions,
REGSAM samDesired, PHKEY phkResult)
+#if defined (HAVE_MS_WINDOWS)
+
+/* NOTE: // strings of various sorts */
+LRESULT
+qxeImmEscape (IN HKL arg1, IN HIMC arg2, IN UINT arg3, IN LPVOID arg4)
 {
   if (XEUNICODE_P)
-    return RegOpenKeyExW (hKey, (LPCWSTR) lpSubKey, ulOptions,
samDesired, phkResult);
+    return ImmEscapeW (arg1, arg2, arg3, arg4);
   else
-    return RegOpenKeyExA (hKey, (LPCSTR) lpSubKey, ulOptions,
samDesired, phkResult);
+    return ImmEscapeA (arg1, arg2, arg3, arg4);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
 
-qxeRegQueryInfoKey (HKEY hKey, Extbyte * lpClass, LPDWORD lpcbClass,
LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcbMaxSubKeyLen,
LPDWORD lpcbMaxClassLen, LPDWORD lpcValues, LPDWORD lpcbMaxValueNameLen,
LPDWORD lpcbMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME
lpftLastWriteTime)
+#if defined (HAVE_MS_WINDOWS)
+
+DWORD
+qxeImmGetConversionList (IN HKL arg1, IN HIMC arg2, IN const Extbyte *
arg3, OUT LPCANDIDATELIST arg4, IN DWORD dwBufLen, IN UINT uFlag)
 {
   if (XEUNICODE_P)
-    return RegQueryInfoKeyW (hKey, (LPWSTR) lpClass, lpcbClass,
lpReserved, lpcSubKeys, lpcbMaxSubKeyLen, lpcbMaxClassLen, lpcValues,
lpcbMaxValueNameLen, lpcbMaxValueLen, lpcbSecurityDescriptor,
lpftLastWriteTime);
+    return ImmGetConversionListW (arg1, arg2, (IN LPCWSTR) arg3, arg4,
dwBufLen, uFlag);
   else
-    return RegQueryInfoKeyA (hKey, (LPSTR) lpClass, lpcbClass,
lpReserved, lpcSubKeys, lpcbMaxSubKeyLen, lpcbMaxClassLen, lpcValues,
lpcbMaxValueNameLen, lpcbMaxValueLen, lpcbSecurityDescriptor,
lpftLastWriteTime);
+    return ImmGetConversionListA (arg1, arg2, (IN LPCSTR) arg3, arg4,
dwBufLen, uFlag);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
 
-qxeRegQueryValue (HKEY hKey, const Extbyte * lpSubKey, Extbyte *
lpValue, PLONG lpcbValue)
+BOOL
+qxeImmIsUIMessage (IN HWND arg1, IN UINT arg2, IN WPARAM arg3, IN
LPARAM arg4)
 {
   if (XEUNICODE_P)
-    return RegQueryValueW (hKey, (LPCWSTR) lpSubKey, (LPWSTR) lpValue,
lpcbValue);
+    return ImmIsUIMessageW (arg1, arg2, arg3, arg4);
   else
-    return RegQueryValueA (hKey, (LPCSTR) lpSubKey, (LPSTR) lpValue,
lpcbValue);
+    return ImmIsUIMessageA (arg1, arg2, arg3, arg4);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
 
-qxeRegQueryMultipleValues (HKEY hKey, PVALENTW val_list, DWORD
num_vals, Extbyte * lpValueBuf, LPDWORD ldwTotsize)
+#if defined (HAVE_MS_WINDOWS)
+
+BOOL
+qxeImmRegisterWord (IN HKL arg1, IN const Extbyte * lpszReading, IN
DWORD arg3, IN const Extbyte * lpszRegister)
 {
   if (XEUNICODE_P)
-    return RegQueryMultipleValuesW (hKey, val_list, num_vals, (LPWSTR)
lpValueBuf, ldwTotsize);
+    return ImmRegisterWordW (arg1, (IN LPCWSTR) lpszReading, arg3, (IN
LPCWSTR) lpszRegister);
   else
-    return RegQueryMultipleValuesA (hKey, (PVALENTA) val_list,
num_vals, (LPSTR) lpValueBuf, ldwTotsize);
+    return ImmRegisterWordA (arg1, (IN LPCSTR) lpszReading, arg3, (IN
LPCSTR) lpszRegister);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
 
-qxeRegQueryValueEx (HKEY hKey, const Extbyte * lpValueName, LPDWORD
lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
+BOOL
+qxeImmUnregisterWord (IN HKL arg1, IN const Extbyte * lpszReading, IN
DWORD arg3, IN const Extbyte * lpszUnregister)
 {
   if (XEUNICODE_P)
-    return RegQueryValueExW (hKey, (LPCWSTR) lpValueName, lpReserved,
lpType, lpData, lpcbData);
+    return ImmUnregisterWordW (arg1, (IN LPCWSTR) lpszReading, arg3,
(IN LPCWSTR) lpszUnregister);
   else
-    return RegQueryValueExA (hKey, (LPCSTR) lpValueName, lpReserved,
lpType, lpData, lpcbData);
+    return ImmUnregisterWordA (arg1, (IN LPCSTR) lpszReading, arg3, (IN
LPCSTR) lpszUnregister);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
+
+/* Error if ImmGetRegisterWordStyle used: split-sized STYLEBUF */
+
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
+
+UINT
+qxeImmEnumRegisterWord (IN HKL arg1, IN REGISTERWORDENUMPROCW arg2, IN
const Extbyte * lpszReading, IN DWORD arg4, IN const Extbyte *
lpszRegister, IN LPVOID arg6)
+{
+  if (XEUNICODE_P)
+    return ImmEnumRegisterWordW (arg1, arg2, (IN LPCWSTR) lpszReading,
arg4, (IN LPCWSTR) lpszRegister, arg6);
+  else
+    return ImmEnumRegisterWordA (arg1, (IN REGISTERWORDENUMPROCA) arg2,
(IN LPCSTR) lpszReading, arg4, (IN LPCSTR) lpszRegister, arg6);
+}
+
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
+
+/* Error if ImmGetImeMenuItems used: split-sized IMEMENUITEMINFO */
+
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+
+/*---------------------------------------------------------------------
-*/
+/*                      Processing file MMSYSTEM.H
*/
+/*---------------------------------------------------------------------
-*/
+
+BOOL
+qxesndPlaySound (IN const Extbyte * pszSound, IN UINT fuSound)
+{
+  if (XEUNICODE_P)
+    return sndPlaySoundW ((IN LPCWSTR) pszSound, fuSound);
+  else
+    return sndPlaySoundA ((IN LPCSTR) pszSound, fuSound);
+}
+
+BOOL
+qxePlaySound (IN const Extbyte * pszSound, IN HMODULE hmod, IN DWORD
fdwSound)
+{
+  if (XEUNICODE_P)
+    return PlaySoundW ((IN LPCWSTR) pszSound, hmod, fdwSound);
+  else
+    return PlaySoundA ((IN LPCSTR) pszSound, hmod, fdwSound);
+}
+
+/* Error if waveOutGetDevCaps used: split-sized LPWAVEOUTCAPS */
+
+MMRESULT
+qxewaveOutGetErrorText (IN MMRESULT mmrError, OUT Extbyte * pszText, IN
UINT cchText)
+{
+  if (XEUNICODE_P)
+    return waveOutGetErrorTextW (mmrError, (OUT LPWSTR) pszText,
cchText);
+  else
+    return waveOutGetErrorTextA (mmrError, (OUT LPSTR) pszText,
cchText);
+}
+
+/* Error if waveInGetDevCaps used: split-sized LPWAVEINCAPS */
+
+MMRESULT
+qxewaveInGetErrorText (IN MMRESULT mmrError, OUT Extbyte * pszText, IN
UINT cchText)
+{
+  if (XEUNICODE_P)
+    return waveInGetErrorTextW (mmrError, (OUT LPWSTR) pszText,
cchText);
+  else
+    return waveInGetErrorTextA (mmrError, (OUT LPSTR) pszText,
cchText);
+}
+
+/* Error if midiOutGetDevCaps used: split-sized LPMIDIOUTCAPS */
+
+MMRESULT
+qxemidiOutGetErrorText (IN MMRESULT mmrError, OUT Extbyte * pszText, IN
UINT cchText)
+{
+  if (XEUNICODE_P)
+    return midiOutGetErrorTextW (mmrError, (OUT LPWSTR) pszText,
cchText);
+  else
+    return midiOutGetErrorTextA (mmrError, (OUT LPSTR) pszText,
cchText);
+}
+
+/* Error if midiInGetDevCaps used: split-sized LPMIDIOUTCAPS */
+
+MMRESULT
+qxemidiInGetErrorText (IN MMRESULT mmrError, OUT Extbyte * pszText, IN
UINT cchText)
+{
+  if (XEUNICODE_P)
+    return midiInGetErrorTextW (mmrError, (OUT LPWSTR) pszText,
cchText);
+  else
+    return midiInGetErrorTextA (mmrError, (OUT LPSTR) pszText,
cchText);
+}
+
+/* Error if auxGetDevCaps used: split-sized LPAUXCAPS */
+
+/* Error if mixerGetDevCaps used: split-sized LPMIXERCAPS */
+
+/* Error if mixerGetLineInfo used: split-sized LPMIXERLINE */
+
+/* Error if mixerGetLineControls used: split-sized LPMIXERCONTROL */
+
+/* Error if mixerGetControlDetails used: split-sized LPMIXERCONTROL in
LPMIXERLINECONTROLS in LPMIXERCONTROLDETAILS */
+
+/* Error if joyGetDevCaps used: split-sized LPJOYCAPS */
+
+FOURCC
+qxemmioStringToFOURCC (IN const Extbyte * sz, IN UINT uFlags)
+{
+  if (XEUNICODE_P)
+    return mmioStringToFOURCCW ((IN LPCWSTR) sz, uFlags);
+  else
+    return mmioStringToFOURCCA ((IN LPCSTR) sz, uFlags);
+}
+
+LPMMIOPROC
+qxemmioInstallIOProc (IN FOURCC fccIOProc, IN LPMMIOPROC pIOProc, IN
DWORD dwFlags)
+{
+  if (XEUNICODE_P)
+    return mmioInstallIOProcW (fccIOProc, pIOProc, dwFlags);
+  else
+    return mmioInstallIOProcA (fccIOProc, pIOProc, dwFlags);
+}
+
+HMMIO
+qxemmioOpen (IN OUT Extbyte * pszFileName, IN OUT LPMMIOINFO pmmioinfo,
IN DWORD fdwOpen)
+{
+  if (XEUNICODE_P)
+    return mmioOpenW ((IN OUT LPWSTR) pszFileName, pmmioinfo, fdwOpen);
+  else
+    return mmioOpenA ((IN OUT LPSTR) pszFileName, pmmioinfo, fdwOpen);
+}
+
+MMRESULT
+qxemmioRename (IN const Extbyte * pszFileName, IN const Extbyte *
pszNewFileName, IN LPCMMIOINFO pmmioinfo, IN DWORD fdwRename)
+{
+  if (XEUNICODE_P)
+    return mmioRenameW ((IN LPCWSTR) pszFileName, (IN LPCWSTR)
pszNewFileName, pmmioinfo, fdwRename);
+  else
+    return mmioRenameA ((IN LPCSTR) pszFileName, (IN LPCSTR)
pszNewFileName, pmmioinfo, fdwRename);
+}
+
+MCIERROR
+qxemciSendCommand (IN MCIDEVICEID mciId, IN UINT uMsg, IN DWORD_PTR
dwParam1, IN DWORD_PTR dwParam2)
+{
+  if (XEUNICODE_P)
+    return mciSendCommandW (mciId, uMsg, dwParam1, dwParam2);
+  else
+    return mciSendCommandA (mciId, uMsg, dwParam1, dwParam2);
+}
+
+MCIERROR
+qxemciSendString (IN const Extbyte * lpstrCommand, OUT Extbyte *
lpstrReturnString, IN UINT uReturnLength, IN HWND hwndCallback)
+{
+  if (XEUNICODE_P)
+    return mciSendStringW ((IN LPCWSTR) lpstrCommand, (OUT LPWSTR)
lpstrReturnString, uReturnLength, hwndCallback);
+  else
+    return mciSendStringA ((IN LPCSTR) lpstrCommand, (OUT LPSTR)
lpstrReturnString, uReturnLength, hwndCallback);
+}
+
+MCIDEVICEID
+qxemciGetDeviceID (IN const Extbyte * pszDevice)
+{
+  if (XEUNICODE_P)
+    return mciGetDeviceIDW ((IN LPCWSTR) pszDevice);
+  else
+    return mciGetDeviceIDA ((IN LPCSTR) pszDevice);
+}
+
+#if !defined (MINGW)
+
+/* Error if mciGetDeviceIDFromElementID used: missing from Win98se
version of ADVAPI32.dll */
+
+#endif /* !defined (MINGW) */
+
+BOOL
+qxemciGetErrorString (IN MCIERROR mcierr, OUT Extbyte * pszText, IN
UINT cchText)
+{
+  if (XEUNICODE_P)
+    return mciGetErrorStringW (mcierr, (OUT LPWSTR) pszText, cchText);
+  else
+    return mciGetErrorStringA (mcierr, (OUT LPSTR) pszText, cchText);
+}
+
+
+/*---------------------------------------------------------------------
-*/
+/*                       Processing file WINCON.H
*/
+/*---------------------------------------------------------------------
-*/
+
+BOOL
+qxePeekConsoleInput (IN HANDLE hConsoleInput, OUT PINPUT_RECORD
lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead)
+{
+  if (XEUNICODE_P)
+    return PeekConsoleInputW (hConsoleInput, lpBuffer, nLength,
lpNumberOfEventsRead);
+  else
+    return PeekConsoleInputA (hConsoleInput, lpBuffer, nLength,
lpNumberOfEventsRead);
+}
+
+BOOL
+qxeReadConsoleInput (IN HANDLE hConsoleInput, OUT PINPUT_RECORD
lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead)
+{
+  if (XEUNICODE_P)
+    return ReadConsoleInputW (hConsoleInput, lpBuffer, nLength,
lpNumberOfEventsRead);
+  else
+    return ReadConsoleInputA (hConsoleInput, lpBuffer, nLength,
lpNumberOfEventsRead);
+}
+
+BOOL
+qxeWriteConsoleInput (IN HANDLE hConsoleInput, IN CONST INPUT_RECORD *
lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsWritten)
+{
+  if (XEUNICODE_P)
+    return WriteConsoleInputW (hConsoleInput, lpBuffer, nLength,
lpNumberOfEventsWritten);
+  else
+    return WriteConsoleInputA (hConsoleInput, lpBuffer, nLength,
lpNumberOfEventsWritten);
+}
+
+BOOL
+qxeReadConsoleOutput (IN HANDLE hConsoleOutput, OUT PCHAR_INFO
lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT
PSMALL_RECT lpReadRegion)
+{
+  if (XEUNICODE_P)
+    return ReadConsoleOutputW (hConsoleOutput, lpBuffer, dwBufferSize,
dwBufferCoord, lpReadRegion);
+  else
+    return ReadConsoleOutputA (hConsoleOutput, lpBuffer, dwBufferSize,
dwBufferCoord, lpReadRegion);
+}
+
+BOOL
+qxeWriteConsoleOutput (IN HANDLE hConsoleOutput, IN CONST CHAR_INFO *
lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT
PSMALL_RECT lpWriteRegion)
+{
+  if (XEUNICODE_P)
+    return WriteConsoleOutputW (hConsoleOutput, lpBuffer, dwBufferSize,
dwBufferCoord, lpWriteRegion);
+  else
+    return WriteConsoleOutputA (hConsoleOutput, lpBuffer, dwBufferSize,
dwBufferCoord, lpWriteRegion);
+}
+
+BOOL
+qxeReadConsoleOutputCharacter (IN HANDLE hConsoleOutput, OUT Extbyte *
lpCharacter, IN  DWORD nLength, IN COORD dwReadCoord, OUT LPDWORD
lpNumberOfCharsRead)
+{
+  if (XEUNICODE_P)
+    return ReadConsoleOutputCharacterW (hConsoleOutput, (OUT LPWSTR)
lpCharacter, nLength, dwReadCoord, lpNumberOfCharsRead);
+  else
+    return ReadConsoleOutputCharacterA (hConsoleOutput, (OUT LPSTR)
lpCharacter, nLength, dwReadCoord, lpNumberOfCharsRead);
+}
+
+BOOL
+qxeWriteConsoleOutputCharacter (IN HANDLE hConsoleOutput, IN const
Extbyte * lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT
LPDWORD lpNumberOfCharsWritten)
+{
+  if (XEUNICODE_P)
+    return WriteConsoleOutputCharacterW (hConsoleOutput, (IN LPCWSTR)
lpCharacter, nLength, dwWriteCoord, lpNumberOfCharsWritten);
+  else
+    return WriteConsoleOutputCharacterA (hConsoleOutput, (IN LPCSTR)
lpCharacter, nLength, dwWriteCoord, lpNumberOfCharsWritten);
+}
+
+/* Error if FillConsoleOutputCharacter used: split CHAR */
+
+BOOL
+qxeScrollConsoleScreenBuffer (IN HANDLE hConsoleOutput, IN CONST
SMALL_RECT * lpScrollRectangle, IN CONST SMALL_RECT * lpClipRectangle,
IN COORD dwDestinationOrigin, IN CONST CHAR_INFO * lpFill)
+{
+  if (XEUNICODE_P)
+    return ScrollConsoleScreenBufferW (hConsoleOutput,
lpScrollRectangle, lpClipRectangle, dwDestinationOrigin, lpFill);
+  else
+    return ScrollConsoleScreenBufferA (hConsoleOutput,
lpScrollRectangle, lpClipRectangle, dwDestinationOrigin, lpFill);
+}
+
+DWORD
+qxeGetConsoleTitle (OUT Extbyte * lpConsoleTitle, IN DWORD nSize)
+{
+  if (XEUNICODE_P)
+    return GetConsoleTitleW ((OUT LPWSTR) lpConsoleTitle, nSize);
+  else
+    return GetConsoleTitleA ((OUT LPSTR) lpConsoleTitle, nSize);
+}
+
+BOOL
+qxeSetConsoleTitle (IN const Extbyte * lpConsoleTitle)
+{
+  if (XEUNICODE_P)
+    return SetConsoleTitleW ((IN LPCWSTR) lpConsoleTitle);
+  else
+    return SetConsoleTitleA ((IN LPCSTR) lpConsoleTitle);
+}
+
+BOOL
+qxeReadConsole (IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD
nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN LPVOID
lpReserved)
+{
+  if (XEUNICODE_P)
+    return ReadConsoleW (hConsoleInput, lpBuffer, nNumberOfCharsToRead,
lpNumberOfCharsRead, lpReserved);
+  else
+    return ReadConsoleA (hConsoleInput, lpBuffer, nNumberOfCharsToRead,
lpNumberOfCharsRead, lpReserved);
+}
+
+BOOL
+qxeWriteConsole (IN HANDLE hConsoleOutput, IN CONST VOID * lpBuffer, IN
DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, IN
LPVOID lpReserved)
+{
+  if (XEUNICODE_P)
+    return WriteConsoleW (hConsoleOutput, lpBuffer,
nNumberOfCharsToWrite, lpNumberOfCharsWritten, lpReserved);
+  else
+    return WriteConsoleA (hConsoleOutput, lpBuffer,
nNumberOfCharsToWrite, lpNumberOfCharsWritten, lpReserved);
+}
+
+
+/*---------------------------------------------------------------------
-*/
+/*                      Processing file WINNETWK.H
*/
+/*---------------------------------------------------------------------
-*/
+
+#if defined (HAVE_MS_WINDOWS)
+
+DWORD 
+qxeWNetAddConnection (IN const Extbyte * lpRemoteName, IN const Extbyte
* lpPassword, IN const Extbyte * lpLocalName)
+{
+  if (XEUNICODE_P)
+    return WNetAddConnectionW ((IN LPCWSTR) lpRemoteName, (IN LPCWSTR)
lpPassword, (IN LPCWSTR) lpLocalName);
+  else
+    return WNetAddConnectionA ((IN LPCSTR) lpRemoteName, (IN LPCSTR)
lpPassword, (IN LPCSTR) lpLocalName);
+}
+
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
+
+DWORD 
+qxeWNetAddConnection2 (IN LPNETRESOURCEW lpNetResource, IN const
Extbyte * lpPassword, IN const Extbyte * lpUserName, IN DWORD dwFlags)
+{
+  if (XEUNICODE_P)
+    return WNetAddConnection2W (lpNetResource, (IN LPCWSTR) lpPassword,
(IN LPCWSTR) lpUserName, dwFlags);
+  else
+    return WNetAddConnection2A ((IN LPNETRESOURCEA) lpNetResource, (IN
LPCSTR) lpPassword, (IN LPCSTR) lpUserName, dwFlags);
+}
+
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
+
+DWORD 
+qxeWNetAddConnection3 (IN HWND hwndOwner, IN LPNETRESOURCEW
lpNetResource, IN const Extbyte * lpPassword, IN const Extbyte *
lpUserName, IN DWORD dwFlags)
+{
+  if (XEUNICODE_P)
+    return WNetAddConnection3W (hwndOwner, lpNetResource, (IN LPCWSTR)
lpPassword, (IN LPCWSTR) lpUserName, dwFlags);
+  else
+    return WNetAddConnection3A (hwndOwner, (IN LPNETRESOURCEA)
lpNetResource, (IN LPCSTR) lpPassword, (IN LPCSTR) lpUserName, dwFlags);
+}
+
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
+
+DWORD 
+qxeWNetCancelConnection (IN const Extbyte * lpName, IN BOOL fForce)
+{
+  if (XEUNICODE_P)
+    return WNetCancelConnectionW ((IN LPCWSTR) lpName, fForce);
+  else
+    return WNetCancelConnectionA ((IN LPCSTR) lpName, fForce);
+}
+
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
 
-qxeRegReplaceKey (HKEY hKey, const Extbyte * lpSubKey, const Extbyte *
lpNewFile, const Extbyte * lpOldFile)
+DWORD 
+qxeWNetCancelConnection2 (IN const Extbyte * lpName, IN DWORD dwFlags,
IN BOOL fForce)
 {
   if (XEUNICODE_P)
-    return RegReplaceKeyW (hKey, (LPCWSTR) lpSubKey, (LPCWSTR)
lpNewFile, (LPCWSTR) lpOldFile);
+    return WNetCancelConnection2W ((IN LPCWSTR) lpName, dwFlags,
fForce);
   else
-    return RegReplaceKeyA (hKey, (LPCSTR) lpSubKey, (LPCSTR) lpNewFile,
(LPCSTR) lpOldFile);
+    return WNetCancelConnection2A ((IN LPCSTR) lpName, dwFlags,
fForce);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
 
-qxeRegRestoreKey (HKEY hKey, const Extbyte * lpFile, DWORD dwFlags)
+#if defined (HAVE_MS_WINDOWS)
+
+DWORD 
+qxeWNetGetConnection (IN const Extbyte * lpLocalName, OUT Extbyte *
lpRemoteName, IN OUT LPDWORD lpnLength)
 {
   if (XEUNICODE_P)
-    return RegRestoreKeyW (hKey, (LPCWSTR) lpFile, dwFlags);
+    return WNetGetConnectionW ((IN LPCWSTR) lpLocalName, (OUT LPWSTR)
lpRemoteName, lpnLength);
   else
-    return RegRestoreKeyA (hKey, (LPCSTR) lpFile, dwFlags);
+    return WNetGetConnectionA ((IN LPCSTR) lpLocalName, (OUT LPSTR)
lpRemoteName, lpnLength);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
 
-qxeRegSaveKey (HKEY hKey, const Extbyte * lpFile, LPSECURITY_ATTRIBUTES
lpSecurityAttributes)
+DWORD 
+qxeWNetUseConnection (IN HWND hwndOwner, IN LPNETRESOURCEW
lpNetResource, IN const Extbyte * lpPassword, IN const Extbyte *
lpUserID, IN DWORD dwFlags, OUT Extbyte * lpAccessName, IN OUT LPDWORD
lpBufferSize, OUT LPDWORD lpResult)
 {
   if (XEUNICODE_P)
-    return RegSaveKeyW (hKey, (LPCWSTR) lpFile, lpSecurityAttributes);
+    return WNetUseConnectionW (hwndOwner, lpNetResource, (IN LPCWSTR)
lpPassword, (IN LPCWSTR) lpUserID, dwFlags, (OUT LPWSTR) lpAccessName,
lpBufferSize, lpResult);
   else
-    return RegSaveKeyA (hKey, (LPCSTR) lpFile, lpSecurityAttributes);
+    return WNetUseConnectionA (hwndOwner, (IN LPNETRESOURCEA)
lpNetResource, (IN LPCSTR) lpPassword, (IN LPCSTR) lpUserID, dwFlags,
(OUT LPSTR) lpAccessName, lpBufferSize, lpResult);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
 
-qxeRegSetValue (HKEY hKey, const Extbyte * lpSubKey, DWORD dwType,
const Extbyte * lpData, DWORD cbData)
+/* NOTE: contains split-simple LPNETRESOURCE */
+DWORD 
+qxeWNetConnectionDialog1 (IN OUT LPCONNECTDLGSTRUCTW lpConnDlgStruct)
 {
   if (XEUNICODE_P)
-    return RegSetValueW (hKey, (LPCWSTR) lpSubKey, dwType, (LPCWSTR)
lpData, cbData);
+    return WNetConnectionDialog1W (lpConnDlgStruct);
   else
-    return RegSetValueA (hKey, (LPCSTR) lpSubKey, dwType, (LPCSTR)
lpData, cbData);
+    return WNetConnectionDialog1A ((IN OUT LPCONNECTDLGSTRUCTA)
lpConnDlgStruct);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
 
-qxeRegSetValueEx (HKEY hKey, const Extbyte * lpValueName, DWORD
Reserved, DWORD dwType, CONST BYTE* lpData, DWORD cbData)
+DWORD 
+qxeWNetDisconnectDialog1 (IN LPDISCDLGSTRUCTW lpConnDlgStruct)
 {
   if (XEUNICODE_P)
-    return RegSetValueExW (hKey, (LPCWSTR) lpValueName, Reserved,
dwType, lpData, cbData);
+    return WNetDisconnectDialog1W (lpConnDlgStruct);
   else
-    return RegSetValueExA (hKey, (LPCSTR) lpValueName, Reserved,
dwType, lpData, cbData);
+    return WNetDisconnectDialog1A ((IN LPDISCDLGSTRUCTA)
lpConnDlgStruct);
 }
 
-LONG
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
 
-qxeRegUnLoadKey (HKEY hKey, const Extbyte * lpSubKey)
+DWORD 
+qxeWNetOpenEnum (IN DWORD dwScope, IN DWORD dwType, IN DWORD dwUsage,
IN LPNETRESOURCEW lpNetResource, OUT LPHANDLE lphEnum)
 {
   if (XEUNICODE_P)
-    return RegUnLoadKeyW (hKey, (LPCWSTR) lpSubKey);
+    return WNetOpenEnumW (dwScope, dwType, dwUsage, lpNetResource,
lphEnum);
   else
-    return RegUnLoadKeyA (hKey, (LPCSTR) lpSubKey);
+    return WNetOpenEnumA (dwScope, dwType, dwUsage, (IN LPNETRESOURCEA)
lpNetResource, lphEnum);
 }
 
-BOOL
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
 
-qxeInitiateSystemShutdown (Extbyte * lpMachineName, Extbyte *
lpMessage, DWORD dwTimeout, BOOL bForceAppsClosed, BOOL
bRebootAfterShutdown)
+DWORD 
+qxeWNetEnumResource (IN HANDLE hEnum, IN OUT LPDWORD lpcCount, OUT
LPVOID lpBuffer, IN OUT LPDWORD lpBufferSize)
 {
   if (XEUNICODE_P)
-    return InitiateSystemShutdownW ((LPWSTR) lpMachineName, (LPWSTR)
lpMessage, dwTimeout, bForceAppsClosed, bRebootAfterShutdown);
+    return WNetEnumResourceW (hEnum, lpcCount, lpBuffer, lpBufferSize);
   else
-    return InitiateSystemShutdownA ((LPSTR) lpMachineName, (LPSTR)
lpMessage, dwTimeout, bForceAppsClosed, bRebootAfterShutdown);
+    return WNetEnumResourceA (hEnum, lpcCount, lpBuffer, lpBufferSize);
 }
 
-BOOL
+#endif /* defined (HAVE_MS_WINDOWS) */
 
-qxeAbortSystemShutdown (Extbyte * lpMachineName)
+#if defined (HAVE_MS_WINDOWS)
+
+DWORD 
+qxeWNetGetUniversalName (IN const Extbyte * lpLocalPath, IN DWORD
dwInfoLevel, OUT LPVOID lpBuffer, IN OUT LPDWORD lpBufferSize)
 {
   if (XEUNICODE_P)
-    return AbortSystemShutdownW ((LPWSTR) lpMachineName);
+    return WNetGetUniversalNameW ((IN LPCWSTR) lpLocalPath,
dwInfoLevel, lpBuffer, lpBufferSize);
   else
-    return AbortSystemShutdownA ((LPSTR) lpMachineName);
+    return WNetGetUniversalNameA ((IN LPCSTR) lpLocalPath, dwInfoLevel,
lpBuffer, lpBufferSize);
 }
-
-
-/*---------------------------------------------------------------------
-*/
-/*                       Processing file WINNLS.H
*/
-/*---------------------------------------------------------------------
-*/
 
-/* Error if GetCPInfoEx used: not used, not examined yet */
-
-/* Error if CompareString used: not used, not examined yet */
+#endif /* defined (HAVE_MS_WINDOWS) */
 
-/* Error if LCMapString used: not used, not examined yet */
+#if defined (HAVE_MS_WINDOWS)
 
-int
-qxeGetLocaleInfo (LCID Locale, LCTYPE LCType, Extbyte * lpLCData, int
cchData)
+DWORD 
+qxeWNetGetUser (IN const Extbyte * lpName, OUT Extbyte * lpUserName, IN
OUT LPDWORD lpnLength)
 {
   if (XEUNICODE_P)
-    return GetLocaleInfoW (Locale, LCType, (LPWSTR) lpLCData, cchData);
+    return WNetGetUserW ((IN LPCWSTR) lpName, (OUT LPWSTR) lpUserName,
lpnLength);
   else
-    return GetLocaleInfoA (Locale, LCType, (LPSTR) lpLCData, cchData);
+    return WNetGetUserA ((IN LPCSTR) lpName, (OUT LPSTR) lpUserName,
lpnLength);
 }
 
-BOOL
-qxeSetLocaleInfo (LCID Locale, LCTYPE LCType, const Extbyte * lpLCData)
+#endif /* defined (HAVE_MS_WINDOWS) */
+
+#if defined (HAVE_MS_WINDOWS)
+
+DWORD 
+qxeWNetGetProviderName (IN DWORD dwNetType, OUT Extbyte *
lpProviderName, IN OUT LPDWORD lpBufferSize)
 {
   if (XEUNICODE_P)
-    return SetLocaleInfoW (Locale, LCType, (LPCWSTR) lpLCData);
+    return WNetGetProviderNameW (dwNetType, (OUT LPWSTR)
lpProviderName, lpBufferSize);
   else
-    return SetLocaleInfoA (Locale, LCType, (LPCSTR) lpLCData);
+    return WNetGetProviderNameA (dwNetType, (OUT LPSTR) lpProviderName,
lpBufferSize);
 }
-
-/* Error if GetTimeFormat used: not used, not examined yet */
 
-/* Error if GetDateFormat used: not used, not examined yet */
-
-/* Error if GetNumberFormat used: not used, not examined yet */
-
-/* Error if GetCurrencyFormat used: not used, not examined yet */
-
-/* Error if EnumCalendarInfo used: not used, not examined yet */
+#endif /* defined (HAVE_MS_WINDOWS) */
 
-/* Error if EnumCalendarInfoEx used: not used, not examined yet */
+#if defined (HAVE_MS_WINDOWS)
 
-/* Error if EnumTimeFormats used: not used, not examined yet */
+DWORD 
+qxeWNetGetNetworkInformation (IN const Extbyte * lpProvider, OUT
LPNETINFOSTRUCT lpNetInfoStruct)
+{
+  if (XEUNICODE_P)
+    return WNetGetNetworkInformationW ((IN LPCWSTR) lpProvider,
lpNetInfoStruct);
+  else
+    return WNetGetNetworkInformationA ((IN LPCSTR) lpProvider,
lpNetInfoStruct);
+}
 
-/* Error if EnumDateFormats used: not used, not examined yet */
+#endif /* defined (HAVE_MS_WINDOWS) */
 
-/* Error if EnumDateFormatsEx used: not used, not examined yet */
+#if defined (HAVE_MS_WINDOWS)
 
-/* Error if GetStringTypeEx used: not used, not examined yet */
+DWORD 
+qxeWNetGetLastError (OUT LPDWORD lpError, OUT Extbyte * lpErrorBuf, IN
DWORD nErrorBufSize, OUT Extbyte * lpNameBuf, IN DWORD nNameBufSize)
+{
+  if (XEUNICODE_P)
+    return WNetGetLastErrorW (lpError, (OUT LPWSTR) lpErrorBuf,
nErrorBufSize, (OUT LPWSTR) lpNameBuf, nNameBufSize);
+  else
+    return WNetGetLastErrorA (lpError, (OUT LPSTR) lpErrorBuf,
nErrorBufSize, (OUT LPSTR) lpNameBuf, nNameBufSize);
+}
 
-/* Error if GetStringType used: no such fun; A and W versions have
different nos. of args */
+#endif /* defined (HAVE_MS_WINDOWS) */
 
-/* Error if FoldString used: not used, not examined yet */
+#if defined (HAVE_MS_WINDOWS)
 
-/* Error if EnumSystemLocales used: not used, not examined yet */
+DWORD 
+qxeMultinetGetConnectionPerformance (IN LPNETRESOURCEW lpNetResource,
OUT LPNETCONNECTINFOSTRUCT lpNetConnectInfoStruct)
+{
+  if (XEUNICODE_P)
+    return MultinetGetConnectionPerformanceW (lpNetResource,
lpNetConnectInfoStruct);
+  else
+    return MultinetGetConnectionPerformanceA ((IN LPNETRESOURCEA)
lpNetResource, lpNetConnectInfoStruct);
+}
 
-/* Error if EnumSystemCodePages used: not used, not examined yet */
+#endif /* defined (HAVE_MS_WINDOWS) */
 
 
 
/*----------------------------------------------------------------------
*/
-/*                        Processing file IME.H
*/
+/*                       Processing file DDEML.H
*/
 
/*----------------------------------------------------------------------
*/
 
-/* Error if SendIMEMessageEx used: obsolete, no docs available */
+UINT
+qxeDdeInitialize (IN OUT LPDWORD pidInst, IN PFNCALLBACK pfnCallback,
IN DWORD afCmd, IN DWORD ulRes)
+{
+  if (XEUNICODE_P)
+    return DdeInitializeW (pidInst, pfnCallback, afCmd, ulRes);
+  else
+    return DdeInitializeA (pidInst, pfnCallback, afCmd, ulRes);
+}
+
+/* Skipping DdeCreateStringHandle because error in Cygwin prototype */
+
+DWORD
+qxeDdeQueryString (IN DWORD idInst, IN HSZ hsz, IN OUT Extbyte * psz,
IN DWORD cchMax, IN int iCodePage)
+{
+  if (XEUNICODE_P)
+    return DdeQueryStringW (idInst, hsz, (IN OUT LPWSTR) psz, cchMax,
iCodePage);
+  else
+    return DdeQueryStringA (idInst, hsz, (IN OUT LPSTR) psz, cchMax,
iCodePage);
+}
 
 
 
/*----------------------------------------------------------------------
*/
@@ -2178,21 +2234,21 @@
 
/*----------------------------------------------------------------------
*/
 
 int
-qxeAddFontResource (const Extbyte * arg1)
+qxeAddFontResource (IN const Extbyte * arg1)
 {
   if (XEUNICODE_P)
-    return AddFontResourceW ((LPCWSTR) arg1);
+    return AddFontResourceW ((IN LPCWSTR) arg1);
   else
-    return AddFontResourceA ((LPCSTR) arg1);
+    return AddFontResourceA ((IN LPCSTR) arg1);
 }
 
 HMETAFILE
-qxeCopyMetaFile (HMETAFILE arg1, const Extbyte * arg2)
+qxeCopyMetaFile (IN HMETAFILE arg1, IN const Extbyte * arg2)
 {
   if (XEUNICODE_P)
-    return CopyMetaFileW (arg1, (LPCWSTR) arg2);
+    return CopyMetaFileW (arg1, (IN LPCWSTR) arg2);
   else
-    return CopyMetaFileA (arg1, (LPCSTR) arg2);
+    return CopyMetaFileA (arg1, (IN LPCSTR) arg2);
 }
 
 /* Skipping CreateDC because split-sized DEVMODE */
@@ -2200,32 +2256,32 @@
 /* Skipping CreateFontIndirect because split-sized LOGFONT */
 
 HFONT
-qxeCreateFont (int arg1, int arg2, int arg3, int arg4, int arg5, DWORD
arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10, DWORD arg11,
DWORD arg12, DWORD arg13, const Extbyte * arg14)
+qxeCreateFont (IN int arg1, IN int arg2, IN int arg3, IN int arg4, IN
int arg5, IN DWORD arg6, IN DWORD arg7, IN DWORD arg8, IN DWORD arg9, IN
DWORD arg10, IN DWORD arg11, IN DWORD arg12, IN DWORD arg13, IN const
Extbyte * arg14)
 {
   if (XEUNICODE_P)
-    return CreateFontW (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
arg9, arg10, arg11, arg12, arg13, (LPCWSTR) arg14);
+    return CreateFontW (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
arg9, arg10, arg11, arg12, arg13, (IN LPCWSTR) arg14);
   else
-    return CreateFontA (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
arg9, arg10, arg11, arg12, arg13, (LPCSTR) arg14);
+    return CreateFontA (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
arg9, arg10, arg11, arg12, arg13, (IN LPCSTR) arg14);
 }
 
 /* Skipping CreateIC because split-sized DEVMODE */
 
 HDC
-qxeCreateMetaFile (const Extbyte * arg1)
+qxeCreateMetaFile (IN const Extbyte * arg1)
 {
   if (XEUNICODE_P)
-    return CreateMetaFileW ((LPCWSTR) arg1);
+    return CreateMetaFileW ((IN LPCWSTR) arg1);
   else
-    return CreateMetaFileA ((LPCSTR) arg1);
+    return CreateMetaFileA ((IN LPCSTR) arg1);
 }
 
 BOOL
-qxeCreateScalableFontResource (DWORD arg1, const Extbyte * arg2, const
Extbyte * arg3, const Extbyte * arg4)
+qxeCreateScalableFontResource (IN DWORD arg1, IN const Extbyte * arg2,
IN const Extbyte * arg3, IN const Extbyte * arg4)
 {
   if (XEUNICODE_P)
-    return CreateScalableFontResourceW (arg1, (LPCWSTR) arg2, (LPCWSTR)
arg3, (LPCWSTR) arg4);
+    return CreateScalableFontResourceW (arg1, (IN LPCWSTR) arg2, (IN
LPCWSTR) arg3, (IN LPCWSTR) arg4);
   else
-    return CreateScalableFontResourceA (arg1, (LPCSTR) arg2, (LPCSTR)
arg3, (LPCSTR) arg4);
+    return CreateScalableFontResourceA (arg1, (IN LPCSTR) arg2, (IN
LPCSTR) arg3, (IN LPCSTR) arg4);
 }
 
 /* Skipping DeviceCapabilities because split-sized DEVMODE */
@@ -2237,7 +2293,7 @@
 /* Error if EnumFonts used: split-complex FONTENUMPROC */
 
 BOOL
-qxeGetCharWidth (HDC arg1, UINT arg2, UINT arg3, LPINT arg4)
+qxeGetCharWidth (IN HDC arg1, IN UINT arg2, IN UINT arg3, OUT LPINT
arg4)
 {
   if (XEUNICODE_P)
     return GetCharWidthW (arg1, arg2, arg3, arg4);
@@ -2246,7 +2302,7 @@
 }
 
 BOOL
-qxeGetCharWidth32 (HDC arg1, UINT arg2, UINT arg3, LPINT arg4)
+qxeGetCharWidth32 (IN HDC arg1, IN UINT arg2, IN UINT arg3, OUT LPINT
arg4)
 {
   if (XEUNICODE_P)
     return GetCharWidth32W (arg1, arg2, arg3, arg4);
@@ -2255,7 +2311,7 @@
 }
 
 BOOL  
-qxeGetCharWidthFloat (HDC arg1, UINT arg2, UINT arg3, PFLOAT arg4)
+qxeGetCharWidthFloat (IN HDC arg1, IN UINT arg2, IN UINT arg3, OUT
PFLOAT arg4)
 {
   if (XEUNICODE_P)
     return GetCharWidthFloatW (arg1, arg2, arg3, arg4);
@@ -2264,7 +2320,7 @@
 }
 
 BOOL  
-qxeGetCharABCWidths (HDC arg1, UINT arg2, UINT arg3, LPABC arg4)
+qxeGetCharABCWidths (IN HDC arg1, IN UINT arg2, IN UINT arg3, OUT LPABC
arg4)
 {
   if (XEUNICODE_P)
     return GetCharABCWidthsW (arg1, arg2, arg3, arg4);
@@ -2273,7 +2329,7 @@
 }
 
 BOOL  
-qxeGetCharABCWidthsFloat (HDC arg1, UINT arg2, UINT arg3, LPABCFLOAT
arg4)
+qxeGetCharABCWidthsFloat (IN HDC arg1, IN UINT arg2, IN UINT arg3, OUT
LPABCFLOAT arg4)
 {
   if (XEUNICODE_P)
     return GetCharABCWidthsFloatW (arg1, arg2, arg3, arg4);
@@ -2282,7 +2338,7 @@
 }
 
 DWORD
-qxeGetGlyphOutline (HDC arg1, UINT arg2, UINT arg3, LPGLYPHMETRICS
arg4, DWORD arg5, LPVOID arg6, CONST MAT2 * arg7)
+qxeGetGlyphOutline (IN HDC arg1, IN UINT arg2, IN UINT arg3, OUT
LPGLYPHMETRICS arg4, IN DWORD arg5, OUT LPVOID arg6, IN CONST MAT2 *
arg7)
 {
   if (XEUNICODE_P)
     return GetGlyphOutlineW (arg1, arg2, arg3, arg4, arg5, arg6, arg7);
@@ -2291,51 +2347,51 @@
 }
 
 HMETAFILE
-qxeGetMetaFile (const Extbyte * arg1)
+qxeGetMetaFile (IN const Extbyte * arg1)
 {
   if (XEUNICODE_P)
-    return GetMetaFileW ((LPCWSTR) arg1);
+    return GetMetaFileW ((IN LPCWSTR) arg1);
   else
-    return GetMetaFileA ((LPCSTR) arg1);
+    return GetMetaFileA ((IN LPCSTR) arg1);
 }
 
 /* Error if GetOutlineTextMetrics used: split-sized LPOUTLINETEXTMETRIC
*/
 
 BOOL  
-qxeGetTextExtentPoint (HDC arg1, const Extbyte * arg2, int arg3, LPSIZE
arg4)
+qxeGetTextExtentPoint (IN HDC arg1, IN const Extbyte * arg2, IN int
arg3, OUT LPSIZE arg4)
 {
   if (XEUNICODE_P)
-    return GetTextExtentPointW (arg1, (LPCWSTR) arg2, arg3, arg4);
+    return GetTextExtentPointW (arg1, (IN LPCWSTR) arg2, arg3, arg4);
   else
-    return GetTextExtentPointA (arg1, (LPCSTR) arg2, arg3, arg4);
+    return GetTextExtentPointA (arg1, (IN LPCSTR) arg2, arg3, arg4);
 }
 
 BOOL  
-qxeGetTextExtentPoint32 (HDC arg1, const Extbyte * arg2, int arg3,
LPSIZE arg4)
+qxeGetTextExtentPoint32 (IN HDC arg1, IN const Extbyte * arg2, IN int
arg3, OUT LPSIZE arg4)
 {
   if (XEUNICODE_P)
-    return GetTextExtentPoint32W (arg1, (LPCWSTR) arg2, arg3, arg4);
+    return GetTextExtentPoint32W (arg1, (IN LPCWSTR) arg2, arg3, arg4);
   else
-    return GetTextExtentPoint32A (arg1, (LPCSTR) arg2, arg3, arg4);
+    return GetTextExtentPoint32A (arg1, (IN LPCSTR) arg2, arg3, arg4);
 }
 
 BOOL  
-qxeGetTextExtentExPoint (HDC arg1, const Extbyte * arg2, int arg3, int
arg4, LPINT arg5, LPINT arg6, LPSIZE arg7)
+qxeGetTextExtentExPoint (IN HDC arg1, IN const Extbyte * arg2, IN int
arg3, IN int arg4, OUT LPINT arg5, OUT LPINT arg6, OUT LPSIZE arg7)
 {
   if (XEUNICODE_P)
-    return GetTextExtentExPointW (arg1, (LPCWSTR) arg2, arg3, arg4,
arg5, arg6, arg7);
+    return GetTextExtentExPointW (arg1, (IN LPCWSTR) arg2, arg3, arg4,
arg5, arg6, arg7);
   else
-    return GetTextExtentExPointA (arg1, (LPCSTR) arg2, arg3, arg4,
arg5, arg6, arg7);
+    return GetTextExtentExPointA (arg1, (IN LPCSTR) arg2, arg3, arg4,
arg5, arg6, arg7);
 }
 
 /* NOTE: NT 4.0+ only */
 DWORD
-qxeGetCharacterPlacement (HDC arg1, const Extbyte * arg2, int arg3, int
arg4, LPGCP_RESULTSW arg5, DWORD arg6)
+qxeGetCharacterPlacement (IN HDC arg1, IN const Extbyte * arg2, IN int
arg3, IN int arg4, IN OUT LPGCP_RESULTSW arg5, IN DWORD arg6)
 {
   if (XEUNICODE_P)
-    return GetCharacterPlacementW (arg1, (LPCWSTR) arg2, arg3, arg4,
arg5, arg6);
+    return GetCharacterPlacementW (arg1, (IN LPCWSTR) arg2, arg3, arg4,
arg5, arg6);
   else
-    return GetCharacterPlacementA (arg1, (LPCSTR) arg2, arg3, arg4,
(LPGCP_RESULTSA) arg5, arg6);
+    return GetCharacterPlacementA (arg1, (IN LPCSTR) arg2, arg3, arg4,
(IN OUT LPGCP_RESULTSA) arg5, arg6);
 }
 
 /* Error if GetGlyphIndices used: NT 5.0+ only */
@@ -2349,101 +2405,101 @@
 /* Skipping ResetDC because split-sized DEVMODE */
 
 BOOL
-qxeRemoveFontResource (const Extbyte * arg1)
+qxeRemoveFontResource (IN const Extbyte * arg1)
 {
   if (XEUNICODE_P)
-    return RemoveFontResourceW ((LPCWSTR) arg1);
+    return RemoveFontResourceW ((IN LPCWSTR) arg1);
   else
-    return RemoveFontResourceA ((LPCSTR) arg1);
+    return RemoveFontResourceA ((IN LPCSTR) arg1);
 }
 
 HENHMETAFILE
-qxeCopyEnhMetaFile (HENHMETAFILE arg1, const Extbyte * arg2)
+qxeCopyEnhMetaFile (IN HENHMETAFILE arg1, IN const Extbyte * arg2)
 {
   if (XEUNICODE_P)
-    return CopyEnhMetaFileW (arg1, (LPCWSTR) arg2);
+    return CopyEnhMetaFileW (arg1, (IN LPCWSTR) arg2);
   else
-    return CopyEnhMetaFileA (arg1, (LPCSTR) arg2);
+    return CopyEnhMetaFileA (arg1, (IN LPCSTR) arg2);
 }
 
 HDC
-qxeCreateEnhMetaFile (HDC arg1, const Extbyte * arg2, CONST RECT *
arg3, const Extbyte * arg4)
+qxeCreateEnhMetaFile (IN HDC arg1, IN const Extbyte * arg2, IN CONST
RECT * arg3, IN const Extbyte * arg4)
 {
   if (XEUNICODE_P)
-    return CreateEnhMetaFileW (arg1, (LPCWSTR) arg2, arg3, (LPCWSTR)
arg4);
+    return CreateEnhMetaFileW (arg1, (IN LPCWSTR) arg2, arg3, (IN
LPCWSTR) arg4);
   else
-    return CreateEnhMetaFileA (arg1, (LPCSTR) arg2, arg3, (LPCSTR)
arg4);
+    return CreateEnhMetaFileA (arg1, (IN LPCSTR) arg2, arg3, (IN
LPCSTR) arg4);
 }
 
 HENHMETAFILE
-qxeGetEnhMetaFile (const Extbyte * arg1)
+qxeGetEnhMetaFile (IN const Extbyte * arg1)
 {
   if (XEUNICODE_P)
-    return GetEnhMetaFileW ((LPCWSTR) arg1);
+    return GetEnhMetaFileW ((IN LPCWSTR) arg1);
   else
-    return GetEnhMetaFileA ((LPCSTR) arg1);
+    return GetEnhMetaF