mirror of
https://github.com/UzixLS/KernelEx.git
synced 2025-07-19 07:21:20 +03:00
import KernelEx-4.5-Final
This commit is contained in:
@ -1,3 +1,37 @@
|
||||
KernelEx v4.5 Final by Xeno86
|
||||
2010-12-30
|
||||
|
||||
setup: Start Menu shortcuts, included Release Notes.txt
|
||||
verifier: new welcome screen
|
||||
core/setup: make KernelEx compatible with kernel32.dll updates:
|
||||
- uninstalling KernelEx won't revert kernel32 updates anymore;
|
||||
- KernelEx doesn't need to be reinstalled anymore if kernel32 is updated
|
||||
- kernel32 backup is now stored in sysbckup directory
|
||||
core: don't load api libraries if resolver failed to initialize
|
||||
SystemParametersInfo: fix SPI_GETCARETWIDTH erroneous zero caret width return
|
||||
kernel32.TlsFree(ext) fixes:
|
||||
- fixed a possible deadlock situation which could lead to system hang
|
||||
- return error if TLS index has already been freed
|
||||
- return 1 for success consistently for better compatibility
|
||||
comdlg32 GetOpen[Save]FileName: avoid HeapFree(null), changes last-error
|
||||
MSI shim database integration
|
||||
MSI shim database: transforms for office 2003; office 2007 converters; google earth 5.1,5.2,6.0b; acrobat reader 7
|
||||
settings: force Windows Installer into default configuration
|
||||
gdi32/textout: don't hold Win16Lock while calling GDI apis
|
||||
added Shim database create utility SDBcreate for MSI installer files patching
|
||||
settings: set GTAPI.DLL in Win2000 mode (Google Earth setup)
|
||||
implemented cryptui.CryptUIDlgViewContext (Google Earth 5.2)
|
||||
implemented kernel32.FindFirstFileExA/W (Opera)
|
||||
user32: per-thread keyboard state is now updated for left/right modifier keys (Qt 4.6+ hotkeys)
|
||||
user32: MapVirtualKey now maps left/right modifier key codes to AT keyboard scan codes.
|
||||
gdi32 unicode APIs: wrong conversion macros were used;
|
||||
gdi32: rewritten EnumFont*W APIs, FONTSIGNATURE is now passed to callback function; populated in registry cache (affects Qt 4.6+)
|
||||
DC objects are revalidated after text API calls
|
||||
replace MSLU's shell32.DragQueryFileW with custom implementation (fixes Foxit Reader 3.1 drag&drop crash)
|
||||
minor GDI text api fixes
|
||||
|
||||
---------------------------------------
|
||||
|
||||
KernelEx v4.5 RC 5 by Xeno86
|
||||
2010-11-02
|
||||
|
||||
|
12
KernelEx.dsw
12
KernelEx.dsw
@ -135,6 +135,18 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "sdbcreate"=.\util\sdbcreate\sdbcreate.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
|
71
KernelEx.nsi
71
KernelEx.nsi
@ -1,4 +1,4 @@
|
||||
!define _VERSION '4.5 RC 5'
|
||||
!define _VERSION '4.5 Final'
|
||||
|
||||
!ifndef _DEBUG
|
||||
!define FLAVOUR 'Release'
|
||||
@ -37,6 +37,7 @@
|
||||
|
||||
Var ENABLEBUTTON
|
||||
Var WARNING_TEXT
|
||||
Var StartMenuFolder
|
||||
|
||||
;--------------------------------
|
||||
;Interface Settings
|
||||
@ -50,6 +51,13 @@
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_LICENSE "License.txt"
|
||||
|
||||
;Start Menu Folder Page Configuration
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\KernelEx"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "SMDir"
|
||||
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
|
||||
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
Page custom PageDefConfig PageLeaveDefConfig
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
@ -209,24 +217,38 @@ Section "Install"
|
||||
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
SetOverwrite on
|
||||
File setup\${FLAVOUR}\setupkex.exe
|
||||
SetOverwrite lastused
|
||||
GetTempFileName $R0 "$INSTDIR"
|
||||
File /oname=$R0 "setup\${FLAVOUR}\setupkex.exe"
|
||||
|
||||
StrCpy $R1 "none"
|
||||
IfFileExists "$INSTDIR\kernel32.bak" 0 +6
|
||||
StrCpy $R1 "copy"
|
||||
ClearErrors
|
||||
CopyFiles /SILENT "$INSTDIR\kernel32.bak" "$WINDIR\SYSBCKUP\KERNEL32.DLL"
|
||||
IfErrors 0 +2
|
||||
StrCpy $R1 "exist" ;File already exists
|
||||
|
||||
!ifdef _DEBUG
|
||||
nsExec::ExecToLog '"$INSTDIR\setupkex.exe" "$INSTDIR\kernel32.bak"'
|
||||
nsExec::ExecToLog '"$R0"'
|
||||
Pop $0
|
||||
!else
|
||||
ExecWait '"$INSTDIR\setupkex.exe" "$INSTDIR\kernel32.bak"' $0
|
||||
ExecWait '"$R0"' $0
|
||||
StrCmp $0 "" 0 +2
|
||||
StrCpy $0 "error"
|
||||
!endif
|
||||
DetailPrint " setup returned: $0"
|
||||
Delete "$INSTDIR\setupkex.exe"
|
||||
StrCmp $0 "0" +3
|
||||
StrCmp $0 "0" +6
|
||||
Delete $R0 ;delete temporary setupkex.exe
|
||||
StrCmp $R1 "copy" 0 +2 ;undo copy
|
||||
Delete "$WINDIR\SYSBCKUP\KERNEL32.DLL"
|
||||
RMDir "$INSTDIR"
|
||||
Abort
|
||||
|
||||
Rename /REBOOTOK $R0 "$INSTDIR\setupkex.exe"
|
||||
StrCmp $R1 "copy" +2 0
|
||||
StrCmp $R1 "exist" 0 +2
|
||||
Delete /REBOOTOK "$INSTDIR\kernel32.bak" ;delete deprecated update file
|
||||
|
||||
;Files to install
|
||||
|
||||
;UpdateDLL_Func params:
|
||||
@ -271,6 +293,7 @@ Section "Install"
|
||||
File apilibs\core.ini
|
||||
File apilibs\settings.reg
|
||||
File license.txt
|
||||
File "Release Notes.txt"
|
||||
|
||||
GetTempFileName $0 "$INSTDIR"
|
||||
File /oname=$0 auxiliary\msimg32.dll
|
||||
@ -319,6 +342,12 @@ Section "Install"
|
||||
ExecWait '"$WINDIR\regedit.exe" /s "$INSTDIR\settings.reg"'
|
||||
Delete "$INSTDIR\settings.reg"
|
||||
|
||||
CreateDirectory $WINDIR\AppPatch\Custom
|
||||
File /oname=$WINDIR\AppPatch\Custom\KernelEx.sdb "util\sdbcreate\sdbdb\KernelEx.sdb"
|
||||
File "util\sdbcreate\sdbdb\kexsdb.i.reg"
|
||||
ExecWait '"$WINDIR\regedit.exe" /s "$INSTDIR\kexsdb.i.reg"'
|
||||
Delete "$INSTDIR\kexsdb.i.reg"
|
||||
|
||||
;Store installation folder
|
||||
WriteRegStr HKLM "Software\KernelEx" "InstallDir" $INSTDIR
|
||||
|
||||
@ -341,7 +370,16 @@ Section "Install"
|
||||
;Create uninstaller
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunServicesOnce" "KexNeedsReboot" ""
|
||||
;Create shortcuts
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Release Notes.lnk" "$INSTDIR\Release Notes.txt"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Verify Installation.lnk" "$INSTDIR\verify.exe"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\KernelEx Home Page.lnk" "http://kernelex.sourceforge.net/"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\KernelEx Wiki.lnk" "http://kernelex.sourceforge.net/wiki/"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
|
||||
SetRebootFlag true
|
||||
|
||||
SectionEnd
|
||||
@ -361,10 +399,10 @@ Section "Uninstall"
|
||||
Abort
|
||||
|
||||
;Files to uninstall
|
||||
IfFileExists "$INSTDIR\kernel32.bak" 0 +5
|
||||
IfFileExists "$WINDIR\SYSBCKUP\KERNEL32.DLL" 0 +5
|
||||
GetTempFileName $0 "$SYSDIR"
|
||||
Delete $0
|
||||
Rename "$INSTDIR\kernel32.bak" $0
|
||||
CopyFiles /SILENT "$WINDIR\SYSBCKUP\KERNEL32.DLL" $0
|
||||
Rename /REBOOTOK $0 "$SYSDIR\kernel32.dll"
|
||||
|
||||
Delete /REBOOTOK "$INSTDIR\KernelEx.dll"
|
||||
@ -376,6 +414,7 @@ Section "Uninstall"
|
||||
UnRegDLL "$INSTDIR\kexCOM.dll"
|
||||
Delete /REBOOTOK "$INSTDIR\kexCOM.dll"
|
||||
Delete "$INSTDIR\license.txt"
|
||||
Delete "$INSTDIR\Release Notes.txt"
|
||||
|
||||
Delete /REBOOTOK "$INSTDIR\msimg32.dll"
|
||||
DeleteRegValue HKLM "Software\KernelEx\KnownDLLs" "MSIMG32"
|
||||
@ -390,6 +429,12 @@ Section "Uninstall"
|
||||
Delete /REBOOTOK "$INSTDIR\userenv.dll"
|
||||
DeleteRegValue HKLM "Software\KernelEx\KnownDLLs" "USERENV"
|
||||
|
||||
File "util\sdbcreate\sdbdb\kexsdb.u.reg"
|
||||
ExecWait '"$WINDIR\regedit.exe" /s "$INSTDIR\kexsdb.u.reg"'
|
||||
Delete "$INSTDIR\kexsdb.u.reg"
|
||||
Delete /REBOOTOK "$WINDIR\AppPatch\Custom\KernelEx.sdb"
|
||||
RMDir "$WINDIR\AppPatch\Custom"
|
||||
|
||||
Delete "$INSTDIR\verify.exe"
|
||||
DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "KexVerify"
|
||||
|
||||
@ -398,6 +443,10 @@ Section "Uninstall"
|
||||
RMDir /r "$INSTDIR\MSLU"
|
||||
WriteINIStr $WINDIR\wininit.ini Rename DIRNUL $INSTDIR
|
||||
|
||||
;remove Start Menu shortcuts
|
||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
|
||||
RMDir /r "$SMPROGRAMS\$StartMenuFolder"
|
||||
|
||||
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "$(DESC_SETTINGS_PRESERVE)" IDYES +2 IDNO 0
|
||||
DeleteRegKey HKLM "Software\KernelEx"
|
||||
|
||||
|
253
Release Notes.txt
Executable file
253
Release Notes.txt
Executable file
@ -0,0 +1,253 @@
|
||||
KernelEx v4.5 Final by Xeno86
|
||||
2010-12-30
|
||||
|
||||
What's new:
|
||||
----------------------------------
|
||||
* Reworked installer (should be more compatible with kernel32 updates)
|
||||
* New welcome screen
|
||||
* Fixed stability of extended TLS code
|
||||
* Fixed hang issues with printers
|
||||
* Added Windows Installer compatibility database for MSI files patching
|
||||
|
||||
Apps fixed / now working:
|
||||
-------------------------
|
||||
* Fixed: Foxit Reader 3.1 drag-and-drop crash
|
||||
* Fixed: Qt 4.6+ hotkey issues
|
||||
* Fixed: Opera 11 'about:' pages
|
||||
* Fixed: Firefox displaying file save dialog twice
|
||||
* Fixed: caret not showing on some configurations (Opera)
|
||||
* Now working: Google Earth 5.2 (6.0 beta experimentally)
|
||||
|
||||
#################################################
|
||||
|
||||
KernelEx v4.5 RC 5 by Xeno86
|
||||
2010-11-02
|
||||
|
||||
What's new:
|
||||
----------------------------------
|
||||
* KernelEx should now work better with Windows 95 shell
|
||||
* Fixed stability issues with GDI anti-leaking code
|
||||
|
||||
Apps fixed / now working:
|
||||
-------------------------
|
||||
* Fixed: OpenOffice.org often crashed on closing
|
||||
* Fixed: VLC 1.1.x crashed on DVD playback on windows 98 shell
|
||||
* Fixed: MAME insufficient memory error
|
||||
* Fixed: Inkscape 0.47 invisible save dialog problem
|
||||
* Fixed: Foxit Reader 3,4 resource leaks and random scrolling crashes
|
||||
* Fixed: Opera crashed in 'Windows 2000' mode when trying to save file
|
||||
* Fixed: Qt4 apps not showing interface fonts
|
||||
* Fixed: AkelPad had broken national input
|
||||
* Fixed: Easy Assembler Shell installer crash
|
||||
* Now working: Media Player Classic Home Cinema rev 2374+
|
||||
* Now working: MS Office 2003 Word/Excel + Viewers (experimental)
|
||||
* Now working: MS Office 2007 converters [docx only] (experimental)
|
||||
|
||||
#################################################
|
||||
|
||||
KernelEx v4.5 RC 4 by Xeno86
|
||||
2010-09-21
|
||||
|
||||
What's new:
|
||||
-----------
|
||||
* Fixed: missing background colors and images in Mozilla Firefox 3.6.9/3.6.10
|
||||
* Fixed: MSIMG32 warning and menu icon transparency issues in Opera 10.62
|
||||
* Fixed: crashes introduced in RC 3
|
||||
* KernelEx auxiliary libraries weren't loaded when full path to system file was passed in call to LoadLibary
|
||||
|
||||
#################################################
|
||||
|
||||
KernelEx v4.5 RC 3 by Xeno86
|
||||
2010-09-10
|
||||
|
||||
hotfix to prevent DLL circular-references causing crashes on certain configurations
|
||||
|
||||
#################################################
|
||||
|
||||
KernelEx v4.5 RC 2 by Xeno86
|
||||
2010-09-08
|
||||
|
||||
What's new:
|
||||
-----------
|
||||
* Implemented SysLink common control class
|
||||
|
||||
Apps fixed / now working:
|
||||
-------------------------
|
||||
* Fixed: Google Picasa options dialog (empty tabs)
|
||||
* Fixed: Adobe Flash Player crashes (reported by mailcat via sf.net forum)
|
||||
* Fixed: Adobe Flash Player 10.1 volume control
|
||||
* Fixed: Wizard101 game crash (bug #3041092)
|
||||
* Fixed: Maxthon browser (freezing)
|
||||
* Now working: Maxthon 1.6.7
|
||||
* Now working: VLC 1.1.2 (without RP9)
|
||||
|
||||
#################################################
|
||||
|
||||
KernelEx v4.5 RC 1 by Xeno86
|
||||
2010-07-30
|
||||
|
||||
What's new:
|
||||
----------------------------------
|
||||
* Reworked 'Compatibility' tab to allow resetting compatibility settings to default values
|
||||
* Resources with high ID are disallowed when KernelEx is disabled
|
||||
* Platform check is now re-enabled when KernelEx is disabled
|
||||
* Fixed settings not applied for applications with international characters in path
|
||||
* Implemented get-post I/O completion ports functionality
|
||||
|
||||
Apps fixed / now working:
|
||||
-------------------------
|
||||
* Fixed: MSYS (broken)
|
||||
* Fixed: Microsoft Access XP (crashing)
|
||||
* Fixed: Rally Championship '99 (crashing)
|
||||
* Fixed: GTA San Andreas (crashing)
|
||||
* Fixed: VLC 1.0+ (UI)
|
||||
* Fixed: Firefox 3.6.4+ (high cpu usage)
|
||||
* Now working: Adobe Flash 10.1 plugin
|
||||
* Now working: Mozilla Firefox 4.0 Beta 2
|
||||
* Now working: Artweaver 1.0
|
||||
* Now working: MPC-HC (newer builds, svn build 1391+)
|
||||
|
||||
#################################################
|
||||
|
||||
KernelEx v4.5 Beta 2 by Xeno86
|
||||
2010-02-14
|
||||
|
||||
What's new:
|
||||
----------------------------------
|
||||
* Implemented Uniscribe font caching (improves Firefox 3 performance).
|
||||
* New thread pool implementation (fixes IE6 problems).
|
||||
* Fixed rare font related Firefox 3 crash.
|
||||
* Implemented timer queue APIs.
|
||||
* Implemented SHParseDisplayName and restricted to XP+ configs to fix Firefox mailto issues.
|
||||
* Fixed premature kexCOM unloading crashing Photoshop 5 and other buggy apps.
|
||||
* Updated jemalloc to version from FF3.6.
|
||||
* Fixed jemalloc sensitiveness to invalid pointers. Fixes vmwareuser, cvtaplog crashing.
|
||||
* Implemented EnumPrintersW (Foxit 3.1 Unicode printing support).
|
||||
* Fixed Opera 10.50 Beta Acid3 crash.
|
||||
* Other small fixes / stubs.
|
||||
|
||||
#################################################
|
||||
|
||||
KernelEx v4.5 Beta 1 by Xeno86
|
||||
2010-01-18
|
||||
|
||||
What's new:
|
||||
----------------------------------
|
||||
* Noticeably improved speed of applications which make extensive use of memory.
|
||||
This was made possible by introducing new memory allocator originating from FreeBSD - jemalloc.
|
||||
It improves heap memory allocation/free speed and reduces virtual memory fragmentation.
|
||||
* Improved compatibility with Unicode applications by implementing new windowing layer
|
||||
which provides NT-consistent way to work with Unicode window procedures.
|
||||
* Extended TLS slot limitation from 80 to 1000+, for some heavy apps.
|
||||
* Lifted PE loader named resource limitation, allowing named resource-heavy libraries to load.
|
||||
* Changed kernel obfuscator to produce positive object (process, thread) IDs in order to improve compatibility.
|
||||
* Introduced kexCOM - new library to take care of missing COM interfaces. Fixes creating shell shortcuts in newer installers.
|
||||
* GDI object destroying rules adjusted in order to fix certain resource leaks or unstability with Flash and other apps.
|
||||
* Implemented certain userenv, unicode winspool, thread pool functions.
|
||||
* Lot of API fixes and stubs.
|
||||
* Improved Compatibility tab.
|
||||
* Various architecture improvements.
|
||||
* Fixed uninstall kernel32.bak not restoring reliably issue.
|
||||
|
||||
Apps now working / fixed:
|
||||
-------------------------
|
||||
* .NET Framework 2 (fixed install/uninstall and apps)
|
||||
* AbiWord 2.8 (usable, minor problems)
|
||||
* Adobe Flash 10.1 beta
|
||||
* Adobe Acrobat Reader 9 (very unstable)
|
||||
* Adobe ImageReady CS2 (no Photoshop yet)
|
||||
* Arora (WebKit Internet Browser)
|
||||
* FastStone Image Viewer (fixed plugin crash)
|
||||
* Foxit Reader 3.1
|
||||
* ICQ 6.5 / ICQLite
|
||||
* InkScape (usable)
|
||||
* GIMP 2.6 (usable, fixed brush trace)
|
||||
* Half-Life 2 Episode One/Two
|
||||
* Miranda IM 0.8.x Unicode
|
||||
* Mozilla Thunderbird 3 (fixed out of space errors)
|
||||
* Nero DiscSpeed 4
|
||||
* QtCreator 1.2.1
|
||||
* SoftMaker Office 2008 (fixed input bugs)
|
||||
* WinAmp 5.5x (fixed ML crash, charset problems)
|
||||
* X-Moto
|
||||
|
||||
|
||||
Notes:
|
||||
------
|
||||
* This release is beta quality in order to test several major changes in KernelEx.
|
||||
Please test the apps which were working before. Compare the performance and memory usage of any heavy apps you use.
|
||||
Pay attention to possible national language input problems.
|
||||
* If you want to downgrade to Final 2, you have to uninstall this beta first.
|
||||
* Enjoy this great release. win9x 4ever.
|
||||
|
||||
#################################################
|
||||
|
||||
KernelEx v4.0 Final 2 by Xeno86
|
||||
2009-08-20
|
||||
|
||||
Major changes:
|
||||
--------------
|
||||
* system won't try to load auxiliary libraries (PSAPI, MSIMG32, PDH, UXTHEME, WTSAPI32) when extensions are disabled
|
||||
|
||||
Fixed regressions:
|
||||
------------------
|
||||
* fixed ZoneAlarm not working properly
|
||||
* Firefox 3 couldn't be uninstalled if KernelEx was installed with extensions disabled
|
||||
* Foobar2000 v0.9.6.x installer was crashing
|
||||
|
||||
#################################################
|
||||
|
||||
KernelEx v4.0 Final by Xeno86
|
||||
2009-07-23
|
||||
|
||||
Now working on Windows 98/Me:
|
||||
-----------------------------
|
||||
* Flash 10 in Internet Explorer
|
||||
|
||||
Major changes:
|
||||
--------------
|
||||
* added option to installer to select between enabling KernelEx extensions for all applications and disabling them
|
||||
* added installation verifier
|
||||
* printer driver software no longer running in NT mode
|
||||
* file select dialogs in Flash applets and certain applications should work correctly now
|
||||
* improved RP9 compatibility
|
||||
* loading MSLU altered floating point unit flags and caused certain programs to crash
|
||||
* MSLU (Unicows.dll) is no longer loaded right on startup and should be seen referenced less often in system
|
||||
* Dependency Walker is no longer slow when profiling
|
||||
* startup speed improvements
|
||||
* stability improvements
|
||||
* tons of small changes
|
||||
|
||||
#################################################
|
||||
|
||||
KernelEx v4.0 RC 2 by Xeno86
|
||||
2009-03-21
|
||||
|
||||
Now working on Windows 98/Me:
|
||||
-----------------------------
|
||||
* The Chronicles of Riddick EFBB Demo
|
||||
* QEmu 0.9
|
||||
|
||||
Fixed regressions:
|
||||
------------------
|
||||
* fixed Adobe Acrobat Reader 7.0 not working with RC 1
|
||||
* .Net framework was broken in RC 1 now should work correctly
|
||||
* input issue in Firefox 3 affecting special characters
|
||||
* eMule couldn't complete downloads in RC 1, now fixed
|
||||
* transparency issue in Firefox 3
|
||||
* incompatibility with Norton Utilities
|
||||
|
||||
#################################################
|
||||
|
||||
KernelEx v4.0 RC 1 by Xeno86
|
||||
2009-03-10
|
||||
|
||||
Now working on Windows 98/Me:
|
||||
-----------------------------
|
||||
* Firefox 3.6 alpha
|
||||
* JDK 6 / JRE 6 works fine with the exception of Java applets which don't work (reason: missing proper named-pipe support in the system)
|
||||
* PDF-XChange Viewer now works
|
||||
|
||||
Fixed regressions:
|
||||
------------------
|
||||
* Sysinternals TCPView display fix
|
@ -104,7 +104,7 @@ static int strlenWW(LPWSTR strWW)
|
||||
|
||||
//misc
|
||||
#define StrAllocA(size) (LPSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,size)
|
||||
#define StrFree(ptr) HeapFree(GetProcessHeap(),0,ptr)
|
||||
#define StrFree(ptr) if (ptr) HeapFree(GetProcessHeap(),0,ptr)
|
||||
|
||||
BOOL WINAPI GetSaveFileNameA_fix(LPOPENFILENAMEA lpofn);
|
||||
BOOL WINAPI GetOpenFileNameA_fix(LPOPENFILENAMEA lpofn);
|
||||
|
120
apilibs/kexbasen/cryptui/CryptUIDlgViewContext.c
Executable file
120
apilibs/kexbasen/cryptui/CryptUIDlgViewContext.c
Executable file
@ -0,0 +1,120 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright 2010, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <wintrust.h>
|
||||
|
||||
typedef struct {
|
||||
DWORD dwSize;
|
||||
HWND hwndParent;
|
||||
DWORD dwFlags;
|
||||
LPCWSTR szTitle;
|
||||
PCCTL_CONTEXT pCtlContext;
|
||||
DWORD unknown[6];
|
||||
} CRYPTUI_VIEWCTL_STRUCTW; //size = 0x2C
|
||||
|
||||
typedef struct {
|
||||
DWORD dwSize;
|
||||
HWND hwndParent;
|
||||
DWORD dwFlags;
|
||||
LPCWSTR szTitle;
|
||||
PCCRL_CONTEXT pCtlContext;
|
||||
DWORD unknown[4];
|
||||
} CRYPTUI_VIEWCRL_STRUCTW; //size = 0x24
|
||||
|
||||
typedef struct tagCRYPTUI_VIEWCERTIFICATE_STRUCTW {
|
||||
DWORD dwSize;
|
||||
HWND hwndParent;
|
||||
DWORD dwFlags;
|
||||
LPCWSTR szTitle;
|
||||
PCCERT_CONTEXT pCertContext;
|
||||
LPCSTR* rgszPurposes;
|
||||
DWORD cPurposes;
|
||||
union
|
||||
{
|
||||
CRYPT_PROVIDER_DATA const* pCryptProviderData;
|
||||
HANDLE hWVTStateData;
|
||||
};
|
||||
BOOL fpCryptProviderDataTrustedUsage;
|
||||
DWORD idxSigner;
|
||||
DWORD idxCert;
|
||||
BOOL fCounterSigner;
|
||||
DWORD idxCounterSigner;
|
||||
DWORD cStores;
|
||||
HCERTSTORE* rghStores;
|
||||
DWORD cPropSheetPages;
|
||||
LPCPROPSHEETPAGEW rgPropSheetPages;
|
||||
DWORD nStartPage;
|
||||
} CRYPTUI_VIEWCERTIFICATE_STRUCTW,*PCRYPTUI_VIEWCERTIFICATE_STRUCTW;
|
||||
typedef const CRYPTUI_VIEWCERTIFICATE_STRUCTW *PCCRYPTUI_VIEWCERTIFICATE_STRUCTW;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
BOOL WINAPI CryptUIDlgViewCertificateW(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW, BOOL*);
|
||||
BOOL WINAPI CryptUIDlgViewCTLW(CRYPTUI_VIEWCTL_STRUCTW*);
|
||||
BOOL WINAPI CryptUIDlgViewCRLW(CRYPTUI_VIEWCRL_STRUCTW*);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* MAKE_EXPORT CryptUIDlgViewContext_new=CryptUIDlgViewContext */
|
||||
BOOL WINAPI CryptUIDlgViewContext_new( DWORD dwContextType, const void *pvContext,
|
||||
HWND hwnd, LPCWSTR pwszTitle, DWORD dwFlags, void *pvReserved)
|
||||
{
|
||||
switch (dwContextType) {
|
||||
case CERT_STORE_CERTIFICATE_CONTEXT:
|
||||
{
|
||||
CRYPTUI_VIEWCERTIFICATE_STRUCTW certW;
|
||||
memset(&certW,0,sizeof(certW));
|
||||
certW.dwSize = sizeof(certW);
|
||||
certW.hwndParent = hwnd;
|
||||
certW.szTitle = pwszTitle;
|
||||
certW.pCertContext = (PCERT_CONTEXT)pvContext;
|
||||
return CryptUIDlgViewCertificateW(&certW,NULL);
|
||||
}
|
||||
break;
|
||||
case CERT_STORE_CTL_CONTEXT:
|
||||
{
|
||||
CRYPTUI_VIEWCTL_STRUCTW ctlW;
|
||||
memset(&ctlW,0,sizeof(ctlW));
|
||||
ctlW.dwSize = sizeof(ctlW);
|
||||
ctlW.hwndParent = hwnd;
|
||||
ctlW.szTitle = pwszTitle;
|
||||
ctlW.pCtlContext = (PCCTL_CONTEXT)pvContext;
|
||||
return CryptUIDlgViewCTLW(&ctlW);
|
||||
}
|
||||
break;
|
||||
case CERT_STORE_CRL_CONTEXT:
|
||||
{
|
||||
CRYPTUI_VIEWCRL_STRUCTW crlW;
|
||||
memset(&crlW,0,sizeof(crlW));
|
||||
crlW.dwSize = sizeof(crlW);
|
||||
crlW.hwndParent = hwnd;
|
||||
crlW.szTitle = pwszTitle;
|
||||
crlW.pCtlContext = (PCCRL_CONTEXT)pvContext;
|
||||
return CryptUIDlgViewCRLW(&crlW);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
45
apilibs/kexbasen/cryptui/_cryptui_apilist.c
Executable file
45
apilibs/kexbasen/cryptui/_cryptui_apilist.c
Executable file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "_cryptui_apilist.h"
|
||||
|
||||
BOOL init_cryptui()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const apilib_named_api cryptui_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("CryptUIDlgViewContext", CryptUIDlgViewContext_new),
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const apilib_unnamed_api cryptui_ordinal_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
|
||||
};
|
||||
#endif
|
||||
|
||||
const apilib_api_table apitable_cryptui = DECL_TAB("CRYPTUI.DLL", cryptui_named_apis, 0 /*cryptui_ordinal_apis*/);
|
34
apilibs/kexbasen/cryptui/_cryptui_apilist.h
Executable file
34
apilibs/kexbasen/cryptui/_cryptui_apilist.h
Executable file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _CRYPTUI_APILIST_H
|
||||
#define _CRYPTUI_APILIST_H
|
||||
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
BOOL init_cryptui();
|
||||
extern const apilib_api_table apitable_cryptui;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
BOOL WINAPI CryptUIDlgViewContext_new(DWORD dwContextType, const void *pvContext, HWND hwnd, LPCWSTR pwszTitle, DWORD dwFlags, void *pvReserved);
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
|
||||
|
||||
#endif
|
@ -10,3 +10,4 @@ shfolder
|
||||
winmm
|
||||
ws2_32
|
||||
ole32
|
||||
cryptui
|
||||
|
@ -48,15 +48,15 @@ FONTUID GetHDCFontUID(HDC hdc)
|
||||
|
||||
/* MAKE_EXPORT GetGlyphIndicesW_new=GetGlyphIndicesW */
|
||||
int WINAPI GetGlyphIndicesW_new(
|
||||
HDC hdc, // handle to DC
|
||||
LPWSTR lpstr, // string to convert
|
||||
int c, // number of characters in string
|
||||
LPWORD pgi, // array of glyph indices
|
||||
DWORD fl // glyph options
|
||||
HDC hdc, // handle to DC
|
||||
LPWSTR lpstr, // string to convert
|
||||
int c, // number of characters in string
|
||||
LPWORD pgi, // array of glyph indices
|
||||
DWORD fl // glyph options
|
||||
)
|
||||
{
|
||||
HRESULT result;
|
||||
if (!hdc || !pgi || (UINT)lpstr<0xFFFFu || !c) return GDI_ERROR;
|
||||
if (!hdc || !pgi || (UINT)lpstr<0xFFFFu || c<=0) return GDI_ERROR;
|
||||
ScriptCache::instance.Lock();
|
||||
FONTUID hFont = GetHDCFontUID(hdc);
|
||||
SCRIPT_CACHE cache = ScriptCache::instance.GetCache(hFont);
|
||||
@ -110,41 +110,39 @@ static int WINAPI GdiGetCodePage( HDC hdc )
|
||||
|
||||
/* MAKE_EXPORT GetGlyphIndicesA_new=GetGlyphIndicesA */
|
||||
int WINAPI GetGlyphIndicesA_new(
|
||||
HDC hdc, // handle to DC
|
||||
LPCSTR lpstr, // string to convert
|
||||
int c, // number of characters in string
|
||||
LPWORD pgi, // array of glyph indices
|
||||
DWORD fl // glyph options
|
||||
HDC hdc, // handle to DC
|
||||
LPCSTR lpstr, // string to convert
|
||||
int c, // number of characters in string
|
||||
LPWORD pgi, // array of glyph indices
|
||||
DWORD fl // glyph options
|
||||
)
|
||||
{
|
||||
int result;
|
||||
LPWSTR lpstrwide;
|
||||
if (!hdc || !pgi || (UINT)lpstr<0xFFFF || c<=0) return GDI_ERROR;
|
||||
lpstrwide = (LPWSTR)alloca(c*sizeof(WCHAR));
|
||||
if (MultiByteToWideChar(GdiGetCodePage(hdc),0,lpstr,c,lpstrwide,c))
|
||||
result = GetGlyphIndicesW_new(hdc,lpstrwide,c,pgi,fl);
|
||||
else
|
||||
result = GDI_ERROR;
|
||||
return result;
|
||||
c = MultiByteToWideChar(GdiGetCodePage(hdc),0,lpstr,c,lpstrwide,c);
|
||||
if (!c)
|
||||
return GDI_ERROR;
|
||||
|
||||
return GetGlyphIndicesW_new(hdc,lpstrwide,c,pgi,fl);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetTextExtentExPointI_new=GetTextExtentExPointI */
|
||||
BOOL WINAPI GetTextExtentExPointI_new(
|
||||
HDC hdc, // handle to DC
|
||||
LPWORD pgiIn, // array of glyph indices
|
||||
int cgi, // number of glyphs in array
|
||||
int nMaxExtent, // maximum width of formatted string
|
||||
LPINT lpnFit, // maximum number of characters
|
||||
LPINT alpDx, // array of partial string widths
|
||||
LPSIZE lpSize // string dimensions
|
||||
HDC hdc, // handle to DC
|
||||
LPWORD pgiIn, // array of glyph indices
|
||||
int cgi, // number of glyphs in array
|
||||
int nMaxExtent, // maximum width of formatted string
|
||||
LPINT lpnFit, // maximum number of characters
|
||||
LPINT alpDx, // array of partial string widths
|
||||
LPSIZE lpSize // string dimensions
|
||||
)
|
||||
{
|
||||
ABC abc;
|
||||
WORD* glyph = pgiIn;
|
||||
int* dxs = alpDx;
|
||||
int i;
|
||||
int sum = 0;
|
||||
int glyphwidth;
|
||||
int charextra = GetTextCharacterExtra(hdc);
|
||||
ABC abc;
|
||||
BOOL unfit = FALSE;
|
||||
|
||||
if ( !hdc || !pgiIn || cgi<=0 || !lpSize)
|
||||
@ -157,20 +155,25 @@ BOOL WINAPI GetTextExtentExPointI_new(
|
||||
FONTUID hFont = GetHDCFontUID(hdc);
|
||||
SCRIPT_CACHE cache = ScriptCache::instance.GetCache(hFont);
|
||||
|
||||
//in UberKern, ScriptPlace was used. However, it's too costly...
|
||||
//so let's compute the info ourselves
|
||||
if (lpnFit) *lpnFit = cgi;
|
||||
for (i = 0; i < cgi; i++)
|
||||
{
|
||||
if ( ScriptGetGlyphABCWidth(hdc,&cache,*glyph,&abc) != S_OK ) break;
|
||||
glyphwidth = abc.abcA + abc.abcB + abc.abcC;
|
||||
if ( ScriptGetGlyphABCWidth(hdc,&cache,*pgiIn,&abc) != S_OK ) break;
|
||||
glyphwidth = abc.abcA + abc.abcB + abc.abcC + charextra;
|
||||
sum += glyphwidth;
|
||||
if ( !unfit )
|
||||
{
|
||||
unfit = ( sum > nMaxExtent );
|
||||
if (alpDx) {*dxs = sum; dxs++;}
|
||||
if (unfit && lpnFit) *lpnFit = i+1; //test test!
|
||||
if (unfit)
|
||||
{
|
||||
if ( lpnFit ) *lpnFit = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( alpDx ) *alpDx++ = sum;
|
||||
}
|
||||
}
|
||||
glyph++;
|
||||
pgiIn++;
|
||||
}
|
||||
lpSize->cx = sum;
|
||||
|
||||
@ -183,22 +186,22 @@ BOOL WINAPI GetTextExtentExPointI_new(
|
||||
|
||||
/* MAKE_EXPORT GetTextExtentPointI_new=GetTextExtentPointI */
|
||||
BOOL WINAPI GetTextExtentPointI_new(
|
||||
HDC hdc, // handle to DC
|
||||
LPWORD pgiIn, // glyph indices
|
||||
int cgi, // number of indices in array
|
||||
LPSIZE lpSize // string size
|
||||
HDC hdc, // handle to DC
|
||||
LPWORD pgiIn, // glyph indices
|
||||
int cgi, // number of indices in array
|
||||
LPSIZE lpSize // string size
|
||||
)
|
||||
{
|
||||
return GetTextExtentExPointI_new(hdc,pgiIn,cgi,32768,0,0,lpSize);
|
||||
return GetTextExtentExPointI_new(hdc,pgiIn,cgi,0,0,0,lpSize);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetCharWidthI_new=GetCharWidthI */
|
||||
BOOL WINAPI GetCharWidthI_new(
|
||||
HDC hdc, // handle to DC
|
||||
UINT giFirst, // first glyph index in range
|
||||
UINT cgi, // number of glyph indices in range
|
||||
WORD* pgi, // array of glyph indices
|
||||
INT* lpBuffer // buffer for widths
|
||||
HDC hdc, // handle to DC
|
||||
UINT giFirst, // first glyph index in range
|
||||
UINT cgi, // number of glyph indices in range
|
||||
WORD* pgi, // array of glyph indices
|
||||
INT* lpBuffer // buffer for widths
|
||||
)
|
||||
{
|
||||
ABC abc;
|
||||
@ -243,11 +246,11 @@ BOOL WINAPI GetCharWidthI_new(
|
||||
|
||||
/* MAKE_EXPORT GetCharABCWidthsI_new=GetCharABCWidthsI */
|
||||
BOOL WINAPI GetCharABCWidthsI_new(
|
||||
HDC hdc, // handle to DC
|
||||
UINT giFirst, // first glyph index in range
|
||||
UINT cgi, // count of glyph indices in range
|
||||
LPWORD pgi, // array of glyph indices
|
||||
LPABC lpabc // array of character widths
|
||||
HDC hdc, // handle to DC
|
||||
UINT giFirst, // first glyph index in range
|
||||
UINT cgi, // count of glyph indices in range
|
||||
LPWORD pgi, // array of glyph indices
|
||||
LPABC lpabc // array of character widths
|
||||
)
|
||||
{
|
||||
WORD glyph;
|
||||
@ -283,15 +286,42 @@ BOOL WINAPI GetCharABCWidthsI_new(
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetCharABCWidthsW_new=GetCharABCWidthsW */
|
||||
BOOL WINAPI GetCharABCWidthsW_new(
|
||||
HDC hdc, // handle to DC
|
||||
UINT uFirstChar, // first character in range
|
||||
UINT uLastChar, // last character in range
|
||||
LPABC lpabc // array of character widths
|
||||
)
|
||||
{
|
||||
if ( !hdc || !lpabc || uFirstChar>uLastChar )
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
UINT c = uLastChar-uFirstChar+1;
|
||||
LPWORD glyphs = (LPWORD)alloca(c*sizeof(WORD));
|
||||
LPWSTR chrW = (LPWSTR)alloca(c*sizeof(WCHAR));
|
||||
LPWSTR strW = chrW;
|
||||
for (int i = uFirstChar; i<=uLastChar; i++)
|
||||
{
|
||||
*chrW=(WCHAR)i;
|
||||
chrW++;
|
||||
}
|
||||
if ( GetGlyphIndicesW_new(hdc,strW,c,glyphs,0) == GDI_ERROR )
|
||||
return FALSE;
|
||||
return GetCharABCWidthsI_new(hdc,0,c,glyphs,lpabc);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetGlyphOutlineW_new=GetGlyphOutlineW */
|
||||
DWORD WINAPI GetGlyphOutlineW_new(
|
||||
HDC hdc, // handle to DC
|
||||
UINT uChar, // character to query
|
||||
UINT uFormat, // data format
|
||||
LPGLYPHMETRICS lpgm, // glyph metrics
|
||||
DWORD cbBuffer, // size of data buffer
|
||||
LPVOID lpvBuffer, // data buffer
|
||||
CONST MAT2 *lpmat2 // transformation matrix
|
||||
HDC hdc, // handle to DC
|
||||
UINT uChar, // character to query
|
||||
UINT uFormat, // data format
|
||||
LPGLYPHMETRICS lpgm, // glyph metrics
|
||||
DWORD cbBuffer, // size of data buffer
|
||||
LPVOID lpvBuffer, // data buffer
|
||||
CONST MAT2 *lpmat2 // transformation matrix
|
||||
)
|
||||
{
|
||||
UINT glyph = 0;
|
||||
@ -327,7 +357,7 @@ DWORD WINAPI GetGlyphOutlineW_new(
|
||||
lpgm->gmBlackBoxY = sz.cy;
|
||||
lpgm->gmptGlyphOrigin.x = 0;
|
||||
lpgm->gmptGlyphOrigin.y = sz.cy;
|
||||
lpgm->gmCellIncX = sz.cx;
|
||||
lpgm->gmCellIncX = (short) sz.cx;
|
||||
lpgm->gmCellIncY = 0;
|
||||
ret = 1;
|
||||
}
|
||||
|
@ -43,10 +43,9 @@ static const apilib_named_api gdi32_named_apis[] =
|
||||
DECL_API("CreateICW", CreateICW_fwd),
|
||||
DECL_API("CreateMetaFileW", CreateMetaFileW_fwd),
|
||||
DECL_API("CreateScalableFontResourceW", CreateScalableFontResourceW_fwd),
|
||||
DECL_API("EnumFontsW", EnumFontsW_fwd),
|
||||
DECL_API("EnumICMProfilesW", EnumICMProfilesW_fwd),
|
||||
DECL_API("GetCharABCWidthsI", GetCharABCWidthsI_new),
|
||||
DECL_API("GetCharABCWidthsW", GetCharABCWidthsW_fwd),
|
||||
DECL_API("GetCharABCWidthsW", GetCharABCWidthsW_new),
|
||||
DECL_API("GetCharWidthI", GetCharWidthI_new),
|
||||
DECL_API("GetCharacterPlacementW", GetCharacterPlacementW_fwd),
|
||||
DECL_API("GetEnhMetaFileDescriptionW", GetEnhMetaFileDescriptionW_fwd),
|
||||
|
@ -34,6 +34,7 @@ BOOL WINAPI GetTextExtentExPointI_new(HDC hdc, LPWORD pgiIn, int cgi, int nMaxEx
|
||||
BOOL WINAPI GetTextExtentPointI_new(HDC hdc, LPWORD pgiIn, int cgi, LPSIZE lpSize);
|
||||
BOOL WINAPI GetCharWidthI_new(HDC hdc, UINT giFirst, UINT cgi, WORD* pgi, INT* lpBuffer);
|
||||
BOOL WINAPI GetCharABCWidthsI_new(HDC hdc, UINT giFirst, UINT cgi, LPWORD pgi, LPABC lpabc);
|
||||
BOOL WINAPI GetCharABCWidthsW_new(HDC hdc, UINT uFirstChar, UINT uLastChar, LPABC lpabc);
|
||||
DWORD WINAPI GetGlyphOutlineW_new(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2);
|
||||
FWDPROC CopyEnhMetaFileW_fwd;
|
||||
FWDPROC CopyMetaFileW_fwd;
|
||||
@ -45,9 +46,7 @@ FWDPROC CreateFontW_fwd;
|
||||
FWDPROC CreateICW_fwd;
|
||||
FWDPROC CreateMetaFileW_fwd;
|
||||
FWDPROC CreateScalableFontResourceW_fwd;
|
||||
FWDPROC EnumFontsW_fwd;
|
||||
FWDPROC EnumICMProfilesW_fwd;
|
||||
FWDPROC GetCharABCWidthsW_fwd;
|
||||
FWDPROC GetCharacterPlacementW_fwd;
|
||||
FWDPROC GetEnhMetaFileDescriptionW_fwd;
|
||||
FWDPROC GetEnhMetaFileW_fwd;
|
||||
|
@ -31,9 +31,7 @@ FORWARD_TO_UNICOWS(CreateFontW);
|
||||
FORWARD_TO_UNICOWS(CreateICW);
|
||||
FORWARD_TO_UNICOWS(CreateMetaFileW);
|
||||
FORWARD_TO_UNICOWS(CreateScalableFontResourceW);
|
||||
FORWARD_TO_UNICOWS(EnumFontsW);
|
||||
FORWARD_TO_UNICOWS(EnumICMProfilesW);
|
||||
FORWARD_TO_UNICOWS(GetCharABCWidthsW);
|
||||
FORWARD_TO_UNICOWS(GetCharacterPlacementW);
|
||||
FORWARD_TO_UNICOWS(GetEnhMetaFileDescriptionW);
|
||||
FORWARD_TO_UNICOWS(GetEnhMetaFileW);
|
||||
|
@ -39,8 +39,8 @@ typedef FARPROC (WINAPI* DLFH) (DWORD, PSHLWAPI_DELAYLOAD);
|
||||
|
||||
/* MAKE_EXPORT DelayLoadFailureHook_new=DelayLoadFailureHook */
|
||||
FARPROC WINAPI DelayLoadFailureHook_new(
|
||||
LPSTR pszDllName,
|
||||
LPSTR pszProcName
|
||||
LPSTR pszDllName,
|
||||
LPSTR pszProcName
|
||||
)
|
||||
{
|
||||
SHLWAPI_DELAYLOAD param;
|
||||
|
@ -48,13 +48,15 @@
|
||||
#define TPS_EXECUTEIO 0x00000001
|
||||
#define TPS_LONGEXECTIME 0x00000008
|
||||
|
||||
typedef BOOL (WINAPI* SHQueueUserWorkItem_API) (LPTHREAD_START_ROUTINE pfnCallback,
|
||||
LPVOID pContext,
|
||||
LONG lPriority,
|
||||
PDWORD dwTag,
|
||||
PDWORD * pdwId,
|
||||
LPCSTR pszModule,
|
||||
DWORD dwFlags);
|
||||
typedef BOOL (WINAPI* SHQueueUserWorkItem_API) (
|
||||
LPTHREAD_START_ROUTINE pfnCallback,
|
||||
LPVOID pContext,
|
||||
LONG lPriority,
|
||||
PDWORD dwTag,
|
||||
PDWORD * pdwId,
|
||||
LPCSTR pszModule,
|
||||
DWORD dwFlags
|
||||
);
|
||||
|
||||
static SHQueueUserWorkItem_API SHQueueUserWorkItem;
|
||||
|
||||
@ -89,12 +91,12 @@ BOOL WINAPI QueueUserWorkItem_new( LPTHREAD_START_ROUTINE Function, PVOID Contex
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HANDLE Object;
|
||||
HANDLE TimerObject;
|
||||
WAITORTIMERCALLBACK Callback;
|
||||
PVOID Context;
|
||||
ULONG Milliseconds;
|
||||
ULONG Flags;
|
||||
HANDLE Object;
|
||||
HANDLE TimerObject;
|
||||
WAITORTIMERCALLBACK Callback;
|
||||
PVOID Context;
|
||||
ULONG Milliseconds;
|
||||
ULONG Flags;
|
||||
PVOID waitThread;
|
||||
LONG State;
|
||||
LONG CallbacksPending;
|
||||
@ -471,12 +473,12 @@ BOOL WINAPI UnregisterWait_new(HANDLE WaitHandle)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HANDLE TimerObject;
|
||||
WAITORTIMERCALLBACK Callback;
|
||||
PVOID Parameter;
|
||||
ULONG DueTime;
|
||||
HANDLE TimerObject;
|
||||
WAITORTIMERCALLBACK Callback;
|
||||
PVOID Parameter;
|
||||
ULONG DueTime;
|
||||
DWORD Period;
|
||||
ULONG Flags;
|
||||
ULONG Flags;
|
||||
PVOID TimerQueue;
|
||||
LONG State;
|
||||
LONG CallbacksPending;
|
||||
|
@ -109,14 +109,8 @@ BOOL init_exttls(void)
|
||||
|
||||
void detach_exttls(void)
|
||||
{
|
||||
TDB98* tdb;
|
||||
LPVOID* ext;
|
||||
|
||||
__asm mov eax, fs:18h;
|
||||
__asm sub eax, 8;
|
||||
__asm mov tdb, eax;
|
||||
|
||||
ext = (LPVOID*) tdb->TlsSlots[TLS_SIZE-1];
|
||||
TDB98* tdb = get_tdb();
|
||||
LPVOID ext = tdb->TlsSlots[TLS_SIZE-1];
|
||||
if (ext)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, ext);
|
||||
@ -176,38 +170,38 @@ DWORD WINAPI TlsAlloc_new(void)
|
||||
/* MAKE_EXPORT TlsFree_new=TlsFree */
|
||||
BOOL WINAPI TlsFree_new(DWORD dwTlsIndex)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
PDB98* pdb = get_pdb();
|
||||
|
||||
_EnterSysLevel(k32lock);
|
||||
_EnterSysLevel(TlsLock);
|
||||
|
||||
if (dwTlsIndex < TLS_SIZE-1)
|
||||
{
|
||||
int rem = dwTlsIndex % (sizeof(DWORD) * 8);
|
||||
int div = dwTlsIndex / (sizeof(DWORD) * 8);
|
||||
pdb->tlsInUseBits[div] &= ~(1 << rem);
|
||||
ret = 1;
|
||||
if (pdb->tlsInUseBits[div] & (1 << rem))
|
||||
{
|
||||
pdb->tlsInUseBits[div] &= ~(1 << rem);
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
else if (dwTlsIndex < TOTAL_TLS_SIZE)
|
||||
{
|
||||
dwTlsIndex -= TLS_SIZE-1;
|
||||
int rem = dwTlsIndex % (sizeof(DWORD) * 8);
|
||||
int div = dwTlsIndex / (sizeof(DWORD) * 8);
|
||||
ExtTlsBitmap[div] &= ~(1 << rem);
|
||||
ret = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
ret = 0;
|
||||
if (ExtTlsBitmap[div] & (1 << rem))
|
||||
{
|
||||
ExtTlsBitmap[div] &= ~(1 << rem);
|
||||
ret = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret)
|
||||
{
|
||||
const NODE* thread;
|
||||
|
||||
_EnterSysLevel(k32lock);
|
||||
|
||||
for (thread = pdb->ThreadList->firstNode ; thread != NULL ; thread = thread->next)
|
||||
{
|
||||
TDB98* tdb = (TDB98*) thread->data;
|
||||
@ -220,13 +214,14 @@ BOOL WINAPI TlsFree_new(DWORD dwTlsIndex)
|
||||
ext[dwTlsIndex] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
_LeaveSysLevel(k32lock);
|
||||
}
|
||||
|
||||
_LeaveSysLevel(TlsLock);
|
||||
_LeaveSysLevel(k32lock);
|
||||
|
||||
return ret;
|
||||
if (!ret)
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return (ret != 0);
|
||||
}
|
||||
|
||||
#ifdef __ASM_IS_L33T__
|
||||
@ -315,11 +310,7 @@ static inline void SetLastError_fast(TDB98* tdb, DWORD error)
|
||||
|
||||
LPVOID WINAPI TlsGetValue_new2(DWORD dwTlsIndex)
|
||||
{
|
||||
TDB98* tdb;
|
||||
|
||||
__asm mov eax, fs:18h;
|
||||
__asm sub eax, 8;
|
||||
__asm mov tdb, eax;
|
||||
TDB98* tdb = get_tdb();
|
||||
|
||||
if (dwTlsIndex < TLS_SIZE-1)
|
||||
{
|
||||
@ -344,11 +335,7 @@ LPVOID WINAPI TlsGetValue_new2(DWORD dwTlsIndex)
|
||||
|
||||
BOOL WINAPI TlsSetValue_new2(DWORD dwTlsIndex, LPVOID lpTlsValue)
|
||||
{
|
||||
TDB98* tdb;
|
||||
|
||||
__asm mov eax, fs:18h;
|
||||
__asm sub eax, 8;
|
||||
__asm mov tdb, eax;
|
||||
TDB98* tdb = get_tdb();
|
||||
|
||||
if (dwTlsIndex < TLS_SIZE-1)
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shlwapi.lib shell32.lib rpcrt4.lib usp10.lib winmm.lib ws2_32.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib delayimp.lib /nologo /dll /map /machine:I386 /nodefaultlib /OPT:NOWIN98 /DELAYLOAD:shell32.dll /DELAYLOAD:rpcrt4.dll /DELAYLOAD:usp10.dll /DELAYLOAD:comdlg32.dll /DELAYLOAD:winspool.drv /DELAYLOAD:shlwapi.dll /DELAYLOAD:winmm.dll /DELAYLOAD:ws2_32.dll
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib cryptui.lib comdlg32.lib advapi32.lib shlwapi.lib shell32.lib rpcrt4.lib usp10.lib winmm.lib ws2_32.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib delayimp.lib /nologo /dll /map /machine:I386 /nodefaultlib /OPT:NOWIN98 /DELAYLOAD:shell32.dll /DELAYLOAD:rpcrt4.dll /DELAYLOAD:usp10.dll /DELAYLOAD:comdlg32.dll /DELAYLOAD:winspool.drv /DELAYLOAD:shlwapi.dll /DELAYLOAD:winmm.dll /DELAYLOAD:ws2_32.dll /DELAYLOAD:cryptui.dll
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "KernelEx Base NonShared - Win32 Debug"
|
||||
@ -80,7 +80,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shlwapi.lib shell32.lib rpcrt4.lib usp10.lib winmm.lib ws2_32.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib delayimp.lib /nologo /dll /map /debug /machine:I386 /nodefaultlib /OPT:NOWIN98 /DELAYLOAD:shell32.dll /DELAYLOAD:rpcrt4.dll /DELAYLOAD:usp10.dll /DELAYLOAD:comdlg32.dll /DELAYLOAD:winspool.drv /DELAYLOAD:shlwapi.dll /DELAYLOAD:winmm.dll /DELAYLOAD:ws2_32.dll
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib cryptui.lib comdlg32.lib advapi32.lib shlwapi.lib shell32.lib rpcrt4.lib usp10.lib winmm.lib ws2_32.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib delayimp.lib /nologo /dll /map /debug /machine:I386 /nodefaultlib /OPT:NOWIN98 /DELAYLOAD:shell32.dll /DELAYLOAD:rpcrt4.dll /DELAYLOAD:usp10.dll /DELAYLOAD:comdlg32.dll /DELAYLOAD:winspool.drv /DELAYLOAD:shlwapi.dll /DELAYLOAD:winmm.dll /DELAYLOAD:ws2_32.dll /DELAYLOAD:cryptui.dll
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
@ -364,6 +364,22 @@ SOURCE=.\ole32\_ole32_apilist.h
|
||||
SOURCE=.\ole32\CoWaitForMultipleHandles.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "cryptui"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cryptui\_cryptui_apilist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cryptui\_cryptui_apilist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cryptui\CryptUIDlgViewContext.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\common.c
|
||||
|
@ -34,9 +34,10 @@
|
||||
#include "winmm/_winmm_apilist.h"
|
||||
#include "ws2_32/_ws2_32_apilist.h"
|
||||
#include "ole32/_ole32_apilist.h"
|
||||
#include "cryptui/_cryptui_apilist.h"
|
||||
//#include "/__apilist.h"
|
||||
|
||||
static apilib_api_table api_table[13];
|
||||
static apilib_api_table api_table[14];
|
||||
|
||||
static void fill_apitable()
|
||||
{
|
||||
@ -52,6 +53,7 @@ static void fill_apitable()
|
||||
api_table[9] = apitable_winmm;
|
||||
api_table[10] = apitable_ws2_32;
|
||||
api_table[11] = apitable_ole32;
|
||||
api_table[12] = apitable_cryptui;
|
||||
//last entry is null terminator
|
||||
}
|
||||
|
||||
|
@ -30,9 +30,9 @@ extern const apilib_api_table apitable_rpcrt4;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
HRESULT WINAPI NdrDllGetClassObject_new(REFCLSID rclsid, REFIID riid, void **ppv, PVOID pVoidProxyFileList, const CLSID *pclsid, PVOID pVoidPSFactoryBuffer);
|
||||
RPC_STATUS RPC_ENTRY RpcStringFreeW_new(IN OUT unsigned short ** String);
|
||||
RPC_STATUS RPC_ENTRY UuidFromStringW_new(IN unsigned short * StringUuidW, OUT UUID * Uuid);
|
||||
RPC_STATUS RPC_ENTRY UuidToStringW_new(IN UUID * Uuid, OUT unsigned short ** StringUuid);
|
||||
RPC_STATUS RPC_ENTRY RpcStringFreeW_new(IN OUT LPWSTR * String);
|
||||
RPC_STATUS RPC_ENTRY UuidFromStringW_new(IN LPWSTR StringUuidW, OUT UUID * Uuid);
|
||||
RPC_STATUS RPC_ENTRY UuidToStringW_new(IN UUID * Uuid, OUT LPWSTR * StringUuid);
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
|
||||
|
||||
#endif
|
||||
|
@ -25,7 +25,7 @@
|
||||
/* MAKE_EXPORT RpcStringFreeW_new=RpcStringFreeW */
|
||||
RPC_STATUS
|
||||
RPC_ENTRY
|
||||
RpcStringFreeW_new(IN OUT unsigned short ** String)
|
||||
RpcStringFreeW_new(IN OUT LPWSTR * String)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, *String);
|
||||
return RPC_S_OK;
|
||||
@ -34,7 +34,7 @@ RpcStringFreeW_new(IN OUT unsigned short ** String)
|
||||
/* MAKE_EXPORT UuidFromStringW_new=UuidFromStringW */
|
||||
RPC_STATUS
|
||||
RPC_ENTRY
|
||||
UuidFromStringW_new(IN unsigned short * StringUuidW, OUT UUID * Uuid)
|
||||
UuidFromStringW_new(IN LPWSTR StringUuidW, OUT UUID * Uuid)
|
||||
{
|
||||
ALLOC_WtoA(StringUuid);
|
||||
return UuidFromStringA((unsigned char*) StringUuidA, Uuid);
|
||||
@ -43,7 +43,7 @@ UuidFromStringW_new(IN unsigned short * StringUuidW, OUT UUID * Uuid)
|
||||
/* MAKE_EXPORT UuidToStringW_new=UuidToStringW */
|
||||
RPC_STATUS
|
||||
RPC_ENTRY
|
||||
UuidToStringW_new(IN UUID * Uuid, OUT unsigned short ** StringUuid)
|
||||
UuidToStringW_new(IN UUID * Uuid, OUT LPWSTR * StringUuid)
|
||||
{
|
||||
RPC_STATUS ret;
|
||||
unsigned char* uuidA;
|
||||
@ -51,7 +51,7 @@ UuidToStringW_new(IN UUID * Uuid, OUT unsigned short ** StringUuid)
|
||||
if (ret == RPC_S_OK)
|
||||
{
|
||||
int size = (strlen((char*) uuidA) + 1) * sizeof(short);
|
||||
*StringUuid = (unsigned short*) HeapAlloc(GetProcessHeap(), 0, size);
|
||||
*StringUuid = (LPWSTR) HeapAlloc(GetProcessHeap(), 0, size);
|
||||
if (!*StringUuid)
|
||||
{
|
||||
RpcStringFreeA(&uuidA);
|
||||
|
@ -30,7 +30,7 @@
|
||||
* SHCreateDirectoryEx is in ME shell but no security anyway.
|
||||
*/
|
||||
|
||||
static inline SHCreateDirectoryA(HWND hwnd, LPCSTR pszPath)
|
||||
static inline int SHCreateDirectoryA(HWND hwnd, LPCSTR pszPath)
|
||||
{
|
||||
return SHCreateDirectory(hwnd, (LPCWSTR)pszPath);
|
||||
}
|
||||
|
@ -27,8 +27,8 @@
|
||||
#include <pshpack1.h>
|
||||
typedef struct
|
||||
{
|
||||
BYTE jmp;
|
||||
DWORD func;
|
||||
BYTE jmp;
|
||||
DWORD func;
|
||||
} LONGJMP, *PLONGJMP;
|
||||
#include <poppack.h>
|
||||
|
||||
|
@ -38,7 +38,7 @@ void uninit_shell32()
|
||||
static const apilib_named_api shell32_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("DragQueryFileW", DragQueryFileW_fwd),
|
||||
DECL_API("DragQueryFileW", DragQueryFileW_new),
|
||||
DECL_API("ExtractIconExW", ExtractIconExW_fwd),
|
||||
DECL_API("ExtractIconW", ExtractIconW_fwd),
|
||||
DECL_API("FindExecutableW", FindExecutableW_fwd),
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define _SHELL32_APILIST_H
|
||||
|
||||
#include <shlobj.h>
|
||||
#include <shellapi.h>
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
BOOL init_shell32();
|
||||
@ -40,7 +41,6 @@ HRESULT WINAPI SHGetSpecialFolderLocation_fix(HWND hwndOwner, int nFolder, LPVOI
|
||||
BOOL WINAPI SHGetSpecialFolderPathA_new(HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate);
|
||||
BOOL WINAPI SHGetSpecialFolderPathW_new(HWND hwndOwner, LPWSTR lpszPathW, int nFolder, BOOL fCreate);
|
||||
HRESULT WINAPI SHParseDisplayName_new(PCWSTR pszName, IBindCtx *pbc, LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut);
|
||||
FWDPROC DragQueryFileW_fwd;
|
||||
FWDPROC ExtractIconExW_fwd;
|
||||
FWDPROC ExtractIconW_fwd;
|
||||
FWDPROC FindExecutableW_fwd;
|
||||
@ -52,6 +52,7 @@ FWDPROC ShellExecuteW_fwd;
|
||||
FWDPROC SHFileOperationW_fwd;
|
||||
FWDPROC SHGetFileInfoW_fwd;
|
||||
FWDPROC SHGetNewLinkInfoW_fwd;
|
||||
UINT WINAPI DragQueryFileW_new(HDROP hDrop, UINT iFile, LPWSTR lpszFileW, UINT cch);
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
* Copyright (C) 2008, 2010 Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
@ -20,8 +20,34 @@
|
||||
*/
|
||||
|
||||
#include "unifwd.h"
|
||||
#include "common.h"
|
||||
#include <shellapi.h>
|
||||
#include <shlwapi.h>
|
||||
|
||||
/* MAKE_EXPORT DragQueryFileW_new=DragQueryFileW */
|
||||
UINT WINAPI DragQueryFileW_new(HDROP hDrop, UINT iFile, LPWSTR lpszFileW, UINT cch)
|
||||
{
|
||||
UINT ret;
|
||||
ALLOC_A(lpszFile, cch * 2);
|
||||
|
||||
ret = DragQueryFileA(hDrop, iFile, lpszFileA, cch);
|
||||
|
||||
if (ret && lpszFileA && iFile != 0xffffffff)
|
||||
{
|
||||
DWORD lasterr = GetLastError();
|
||||
|
||||
ret = AtoW(lpszFile, cch);
|
||||
if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
||||
ret = cch;
|
||||
|
||||
if (ret) ret--;
|
||||
|
||||
SetLastError(lasterr);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
FORWARD_TO_UNICOWS(DragQueryFileW);
|
||||
FORWARD_TO_UNICOWS(ExtractIconExW);
|
||||
FORWARD_TO_UNICOWS(ExtractIconW);
|
||||
FORWARD_TO_UNICOWS(FindExecutableW);
|
||||
|
@ -42,58 +42,60 @@ static const DWORD pi_sizeof[] = {0, sizeof(PRINTER_INFO_1), sizeof(PRINTER_INFO
|
||||
*/
|
||||
static LPDEVMODEW DEVMODEdupAtoW(const DEVMODEA *dmA)
|
||||
{
|
||||
LPDEVMODEW dmW;
|
||||
WORD size;
|
||||
LPDEVMODEW dmW;
|
||||
WORD size;
|
||||
|
||||
if (!dmA) return NULL;
|
||||
size = dmA->dmSize + CCHDEVICENAME +
|
||||
((dmA->dmSize > FIELD_OFFSET(DEVMODEA, dmFormName)) ? CCHFORMNAME : 0);
|
||||
if (!dmA) return NULL;
|
||||
size = dmA->dmSize + CCHDEVICENAME +
|
||||
((dmA->dmSize > FIELD_OFFSET(DEVMODEA, dmFormName)) ? CCHFORMNAME : 0);
|
||||
|
||||
dmW = (LPDEVMODEW) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + dmA->dmDriverExtra);
|
||||
if (!dmW) return NULL;
|
||||
dmW = (LPDEVMODEW) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + dmA->dmDriverExtra);
|
||||
if (!dmW) return NULL;
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPSTR)dmA->dmDeviceName, -1,
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPSTR)dmA->dmDeviceName, -1,
|
||||
dmW->dmDeviceName, CCHDEVICENAME);
|
||||
|
||||
if (FIELD_OFFSET(DEVMODEA, dmFormName) >= dmA->dmSize) {
|
||||
memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion,
|
||||
dmA->dmSize - FIELD_OFFSET(DEVMODEA, dmSpecVersion));
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion,
|
||||
FIELD_OFFSET(DEVMODEA, dmFormName) - FIELD_OFFSET(DEVMODEA, dmSpecVersion));
|
||||
if (FIELD_OFFSET(DEVMODEA, dmFormName) >= dmA->dmSize) {
|
||||
memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion,
|
||||
dmA->dmSize - FIELD_OFFSET(DEVMODEA, dmSpecVersion));
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion,
|
||||
FIELD_OFFSET(DEVMODEA, dmFormName) - FIELD_OFFSET(DEVMODEA, dmSpecVersion));
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPSTR)dmA->dmFormName, -1,
|
||||
dmW->dmFormName, CCHFORMNAME);
|
||||
|
||||
memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA->dmSize - FIELD_OFFSET(DEVMODEA, dmLogPixels));
|
||||
}
|
||||
memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA->dmSize - FIELD_OFFSET(DEVMODEA, dmLogPixels));
|
||||
}
|
||||
|
||||
dmW->dmSize = size;
|
||||
memcpy((char *)dmW + dmW->dmSize, (const char *)dmA + dmA->dmSize, dmA->dmDriverExtra);
|
||||
return dmW;
|
||||
dmW->dmSize = size;
|
||||
memcpy((char *)dmW + dmW->dmSize, (const char *)dmA + dmA->dmSize, dmA->dmDriverExtra);
|
||||
return dmW;
|
||||
}
|
||||
|
||||
static void convert_printerinfo_WtoA(LPBYTE outW, LPBYTE pPrintersA,
|
||||
DWORD level, DWORD outlen, DWORD numentries)
|
||||
{
|
||||
DWORD id = 0;
|
||||
LPWSTR ptr;
|
||||
INT len;
|
||||
DWORD id = 0;
|
||||
LPWSTR ptr;
|
||||
INT len;
|
||||
|
||||
len = pi_sizeof[level] * numentries;
|
||||
ptr = (LPWSTR) (outW + len);
|
||||
len = pi_sizeof[level] * numentries;
|
||||
ptr = (LPWSTR) (outW + len);
|
||||
/* first structures */
|
||||
outlen -= len;
|
||||
outlen -= len;
|
||||
/* then text in unicode (we count in wchars from now on) */
|
||||
outlen /= 2;
|
||||
|
||||
/* copy the numbers of all PRINTER_INFO_* first */
|
||||
memcpy(outW, pPrintersA, len);
|
||||
/* copy the numbers of all PRINTER_INFO_* first */
|
||||
memcpy(outW, pPrintersA, len);
|
||||
|
||||
while (id < numentries) {
|
||||
switch (level) {
|
||||
case 1:
|
||||
while (id < numentries)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
PRINTER_INFO_1W * piW = (PRINTER_INFO_1W *) outW;
|
||||
PRINTER_INFO_1A * piA = (PRINTER_INFO_1A *) pPrintersA;
|
||||
@ -122,7 +124,7 @@ static void convert_printerinfo_WtoA(LPBYTE outW, LPBYTE pPrintersA,
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
case 2:
|
||||
{
|
||||
PRINTER_INFO_2W * piW = (PRINTER_INFO_2W *) outW;
|
||||
PRINTER_INFO_2A * piA = (PRINTER_INFO_2A *) pPrintersA;
|
||||
@ -228,7 +230,7 @@ static void convert_printerinfo_WtoA(LPBYTE outW, LPBYTE pPrintersA,
|
||||
break;
|
||||
}
|
||||
|
||||
case 4:
|
||||
case 4:
|
||||
{
|
||||
PRINTER_INFO_4W * piW = (PRINTER_INFO_4W *) outW;
|
||||
PRINTER_INFO_4A * piA = (PRINTER_INFO_4A *) pPrintersA;
|
||||
@ -250,7 +252,7 @@ static void convert_printerinfo_WtoA(LPBYTE outW, LPBYTE pPrintersA,
|
||||
break;
|
||||
}
|
||||
|
||||
case 5:
|
||||
case 5:
|
||||
{
|
||||
PRINTER_INFO_5W * piW = (PRINTER_INFO_5W *) outW;
|
||||
PRINTER_INFO_5A * piA = (PRINTER_INFO_5A *) pPrintersA;
|
||||
@ -271,11 +273,11 @@ static void convert_printerinfo_WtoA(LPBYTE outW, LPBYTE pPrintersA,
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
pPrintersA += pi_sizeof[level];
|
||||
outW += pi_sizeof[level];
|
||||
id++;
|
||||
}
|
||||
}
|
||||
pPrintersA += pi_sizeof[level];
|
||||
outW += pi_sizeof[level];
|
||||
id++;
|
||||
}
|
||||
}
|
||||
|
||||
//AddForm - not supported
|
||||
|
@ -24,5 +24,5 @@
|
||||
/* MAKE_EXPORT RegDisablePredefinedCache_new=RegDisablePredefinedCache */
|
||||
BOOL WINAPI RegDisablePredefinedCache_new()
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
@ -24,5 +24,5 @@
|
||||
/* MAKE_EXPORT RegOpenCurrentUser_new=RegOpenCurrentUser */
|
||||
LONG WINAPI RegOpenCurrentUser_new(REGSAM access, PHKEY retkey)
|
||||
{
|
||||
return RegOpenKeyExA(HKEY_CURRENT_USER, NULL, 0, access, retkey);
|
||||
return RegOpenKeyExA(HKEY_CURRENT_USER, NULL, 0, access, retkey);
|
||||
}
|
||||
|
@ -23,11 +23,11 @@
|
||||
|
||||
/* MAKE_EXPORT TraceMessage_new=TraceMessage */
|
||||
ULONG CDECL TraceMessage_new(
|
||||
ULONG64 LoggerHandle,
|
||||
ULONG MessageFlags,
|
||||
LPGUID MessageGuid,
|
||||
USHORT MessageNumber,
|
||||
...
|
||||
ULONG64 LoggerHandle,
|
||||
ULONG MessageFlags,
|
||||
LPGUID MessageGuid,
|
||||
USHORT MessageNumber,
|
||||
...
|
||||
)
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
|
@ -86,14 +86,14 @@ LONG WINAPI RegQueryValueExW_new(HKEY hKey, LPCWSTR lpValueNameW, LPDWORD lpRese
|
||||
|
||||
//MAKE_EXPORT RegEnumValueW_new=RegEnumValueW
|
||||
LONG WINAPI RegEnumValueW_new(
|
||||
HKEY hKey, // handle to key to query
|
||||
DWORD dwIndex, // index of value to query
|
||||
LPWSTR lpValueName, // value buffer
|
||||
LPDWORD lpcValueName, // size of value buffer
|
||||
LPDWORD lpReserved, // reserved
|
||||
LPDWORD lpType, // type buffer
|
||||
LPBYTE lpData, // data buffer
|
||||
LPDWORD lpcbData // size of data buffer
|
||||
HKEY hKey, // handle to key to query
|
||||
DWORD dwIndex, // index of value to query
|
||||
LPWSTR lpValueName, // value buffer
|
||||
LPDWORD lpcValueName, // size of value buffer
|
||||
LPDWORD lpReserved, // reserved
|
||||
LPDWORD lpType, // type buffer
|
||||
LPBYTE lpData, // data buffer
|
||||
LPDWORD lpcbData // size of data buffer
|
||||
)
|
||||
{
|
||||
LONG ret;
|
||||
|
171
apilibs/kexbases/Gdi32/EnumFont.c
Executable file
171
apilibs/kexbases/Gdi32/EnumFont.c
Executable file
@ -0,0 +1,171 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Xeno86, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FONTENUMPROCW procW;
|
||||
LPARAM lParam;
|
||||
HKEY hKey;
|
||||
ENUMLOGFONTEXDVW elfW;
|
||||
ENUMTEXTMETRICW etmW;
|
||||
} EnumHelperW_t;
|
||||
|
||||
static const char regfontsig[] = "SOFTWARE\\KernelEx\\FontSignature";
|
||||
static const char regttfcachesize[] = "ttfCacheSize";
|
||||
|
||||
static inline void GetFontSignature(HKEY hkey, LOGFONTA* plfA, FONTSIGNATURE* sig)
|
||||
{
|
||||
DWORD sz = sizeof(FONTSIGNATURE);
|
||||
if ( RegQueryValueEx(hkey,plfA->lfFaceName,0,NULL,(LPBYTE)sig,&sz) != ERROR_SUCCESS )
|
||||
{
|
||||
DBGPRINTF(("Querying signature from font %s",plfA->lfFaceName));
|
||||
HDC hdc = CreateCompatibleDC(0);
|
||||
HFONT fnt = CreateFontIndirect(plfA);
|
||||
HGDIOBJ old = SelectObject(hdc,fnt);
|
||||
GetTextCharsetInfo(hdc,sig,0);
|
||||
SelectObject(hdc,old);
|
||||
DeleteObject(fnt);
|
||||
DeleteDC(hdc);
|
||||
sz = sizeof(FONTSIGNATURE);
|
||||
RegSetValueEx(hkey,plfA->lfFaceName,0,REG_BINARY,(LPBYTE)sig,sz);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void ENUMLOGFONTEXAtoW(ENUMLOGFONTEXA* fontA, ENUMLOGFONTEXW* fontW)
|
||||
{
|
||||
memcpy(&fontW->elfLogFont, &fontA->elfLogFont, FIELD_OFFSET(LOGFONT,lfFaceName));
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) fontA->elfLogFont.lfFaceName, -1,
|
||||
fontW->elfLogFont.lfFaceName, LF_FACESIZE);
|
||||
fontW->elfLogFont.lfFaceName[LF_FACESIZE - 1] = 0;
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) fontA->elfFullName, -1,
|
||||
fontW->elfFullName, LF_FULLFACESIZE);
|
||||
fontW->elfFullName[LF_FULLFACESIZE - 1] = 0;
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) fontA->elfStyle, -1,
|
||||
fontW->elfStyle, LF_FACESIZE);
|
||||
fontW->elfStyle[LF_FACESIZE - 1] = 0;
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) fontA->elfScript, -1,
|
||||
fontW->elfScript, LF_FACESIZE);
|
||||
fontW->elfScript[LF_FACESIZE - 1] = 0;
|
||||
}
|
||||
|
||||
static inline void NEWTEXTMETRICAtoW(NEWTEXTMETRICA* tmA, NEWTEXTMETRICW* tmW)
|
||||
{
|
||||
memcpy(tmW,tmA,FIELD_OFFSET(NEWTEXTMETRICA,tmFirstChar));
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) &tmA->tmFirstChar, 1,
|
||||
&tmW->tmFirstChar, 1);
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) &tmA->tmLastChar, 1,
|
||||
&tmW->tmLastChar, 1);
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) &tmA->tmDefaultChar, 1,
|
||||
&tmW->tmDefaultChar, 1);
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) &tmA->tmBreakChar, 1,
|
||||
&tmW->tmBreakChar, 1);
|
||||
|
||||
memcpy(&tmW->tmItalic,&tmA->tmItalic,sizeof(NEWTEXTMETRICA) - FIELD_OFFSET(NEWTEXTMETRICA,tmItalic));
|
||||
}
|
||||
|
||||
int WINAPI EnumFontWHelper( CONST LOGFONTA *lfA, CONST TEXTMETRICA *tmA, DWORD FontType, LPARAM lParam )
|
||||
{
|
||||
ENUMLOGFONTEXA* lpelfA = (ENUMLOGFONTEXA*)lfA;
|
||||
NEWTEXTMETRICA* lpntmA = (NEWTEXTMETRICA*)tmA;
|
||||
EnumHelperW_t* params = (EnumHelperW_t*)lParam;
|
||||
|
||||
ENUMLOGFONTEXAtoW(lpelfA,¶ms->elfW.elfEnumLogfontEx);
|
||||
NEWTEXTMETRICAtoW(lpntmA,¶ms->etmW.etmNewTextMetricEx.ntmTm);
|
||||
if ( FontType == TRUETYPE_FONTTYPE )
|
||||
GetFontSignature(params->hKey,&lpelfA->elfLogFont,¶ms->etmW.etmNewTextMetricEx.ntmFontSig);
|
||||
else
|
||||
memset(¶ms->etmW.etmNewTextMetricEx.ntmFontSig,0,sizeof(FONTSIGNATURE));
|
||||
return params->procW((LOGFONTW*)¶ms->elfW,(TEXTMETRICW*)¶ms->etmW,FontType,params->lParam);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT EnumFontFamiliesExA_new=EnumFontFamiliesExA */
|
||||
int WINAPI EnumFontFamiliesExA_new(HDC hdc, LPLOGFONTA pLogfontA,
|
||||
FONTENUMPROCA pEnumFontFamExProc, LPARAM lParam, DWORD dwFlags)
|
||||
{
|
||||
LOGFONTA logfont;
|
||||
if (!pLogfontA)
|
||||
{
|
||||
memset(&logfont, 0, sizeof(logfont));
|
||||
logfont.lfCharSet = DEFAULT_CHARSET;
|
||||
pLogfontA = &logfont;
|
||||
}
|
||||
return EnumFontFamiliesExA(hdc, pLogfontA, pEnumFontFamExProc, lParam, dwFlags);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT EnumFontFamiliesExW_new=EnumFontFamiliesExW */
|
||||
int WINAPI EnumFontFamiliesExW_new(HDC hdc, LPLOGFONTW pLogfontW,
|
||||
FONTENUMPROCW pEnumFontFamExProc, LPARAM lParam, DWORD dwFlags)
|
||||
{
|
||||
LOGFONTA logfont;
|
||||
if (pLogfontW)
|
||||
{
|
||||
memcpy(&logfont, pLogfontW, FIELD_OFFSET(LOGFONT,lfFaceName));
|
||||
WideCharToMultiByte(CP_ACP, 0, pLogfontW->lfFaceName, -1, logfont.lfFaceName,
|
||||
LF_FACESIZE, NULL, NULL);
|
||||
logfont.lfFaceName[LF_FACESIZE - 1] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&logfont, 0, sizeof(logfont));
|
||||
logfont.lfCharSet = DEFAULT_CHARSET;
|
||||
}
|
||||
EnumHelperW_t params = {0};
|
||||
params.procW = pEnumFontFamExProc;
|
||||
params.lParam = lParam;
|
||||
RegCreateKey(HKEY_LOCAL_MACHINE,regfontsig,¶ms.hKey);
|
||||
int ret = EnumFontFamiliesExA(hdc,&logfont,EnumFontWHelper,(LPARAM)¶ms,dwFlags);
|
||||
RegCloseKey(params.hKey);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT EnumFontFamiliesW_new=EnumFontFamiliesW */
|
||||
int WINAPI EnumFontFamiliesW_new( HDC hdc, LPCWSTR lpszFamilyW,
|
||||
FONTENUMPROCW lpEnumFontFamProc, LPARAM lParam)
|
||||
{
|
||||
LPSTR lpszFamilyA;
|
||||
STACK_WtoA(lpszFamilyW,lpszFamilyA);
|
||||
EnumHelperW_t params = {0};
|
||||
params.procW = lpEnumFontFamProc;
|
||||
params.lParam = lParam;
|
||||
RegCreateKey(HKEY_LOCAL_MACHINE,regfontsig,¶ms.hKey);
|
||||
int ret = EnumFontFamiliesA(hdc,lpszFamilyA,EnumFontWHelper,(LPARAM)¶ms);
|
||||
RegCloseKey(params.hKey);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT EnumFontsW_new=EnumFontsW */
|
||||
int WINAPI EnumFontsW_new( HDC hdc, LPCWSTR lpFaceNameW,
|
||||
FONTENUMPROCW lpFontFunc, LPARAM lParam)
|
||||
{
|
||||
LPSTR lpFaceNameA;
|
||||
STACK_WtoA(lpFaceNameW,lpFaceNameA);
|
||||
EnumHelperW_t params = {0};
|
||||
params.procW = lpFontFunc;
|
||||
params.lParam = lParam;
|
||||
RegCreateKey(HKEY_LOCAL_MACHINE,regfontsig,¶ms.hKey);
|
||||
int ret = EnumFontsA(hdc,lpFaceNameA,EnumFontWHelper,(LPARAM)¶ms);
|
||||
RegCloseKey(params.hKey);
|
||||
return ret;
|
||||
}
|
@ -149,17 +149,13 @@ DWORD WINAPI GetObjectType_fix( HGDIOBJ hgdiobj )
|
||||
return result;
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
#pragma warning (disable:4035) //xeno approves
|
||||
static inline
|
||||
WORD GetCurrentTDB()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov ax, fs:[0Ch]
|
||||
movzx eax, ax
|
||||
ret
|
||||
}
|
||||
__asm mov ax, fs:[0Ch]
|
||||
}
|
||||
#pragma warning (default:4035)
|
||||
|
||||
/************************************************************************
|
||||
The purpose of GdiObjects is to simulate NT GDI object rules, which
|
||||
@ -268,12 +264,12 @@ HGDIOBJ WINAPI SelectObject_fix( HDC hdc, HGDIOBJ hgdiobj )
|
||||
|
||||
/* MAKE_EXPORT CreateDIBSection_fix=CreateDIBSection */
|
||||
HBITMAP WINAPI CreateDIBSection_fix(
|
||||
HDC hdc, // handle to DC
|
||||
BITMAPINFO *pbmi, // bitmap data
|
||||
UINT iUsage, // data type indicator
|
||||
VOID **ppvBits, // bit values
|
||||
HANDLE hSection, // handle to file mapping object
|
||||
DWORD dwOffset // offset to bitmap bit values
|
||||
HDC hdc, // handle to DC
|
||||
BITMAPINFO *pbmi, // bitmap data
|
||||
UINT iUsage, // data type indicator
|
||||
VOID **ppvBits, // bit values
|
||||
HANDLE hSection, // handle to file mapping object
|
||||
DWORD dwOffset // offset to bitmap bit values
|
||||
)
|
||||
{
|
||||
if (pbmi && pbmi->bmiHeader.biSize == sizeof(BITMAPINFO)) //9x does not forgive
|
||||
|
@ -56,11 +56,11 @@ typedef struct
|
||||
{
|
||||
WORD bDoesntExist;
|
||||
DWORD dwOldSSSP;
|
||||
WORD pLocalHeap;
|
||||
WORD pAtomTable;
|
||||
WORD pStackTop;
|
||||
WORD pStackMin;
|
||||
WORD pStackBottom;
|
||||
WORD pLocalHeap;
|
||||
WORD pAtomTable;
|
||||
WORD pStackTop;
|
||||
WORD pStackMin;
|
||||
WORD pStackBottom;
|
||||
} INSTANCE16, *PINSTANCE16;
|
||||
|
||||
typedef struct
|
||||
|
@ -23,13 +23,13 @@
|
||||
|
||||
/* MAKE_EXPORT GetGlyphOutlineA_fix=GetGlyphOutlineA */
|
||||
DWORD WINAPI GetGlyphOutlineA_fix(
|
||||
HDC hdc, // handle to DC
|
||||
UINT uChar, // character to query
|
||||
UINT uFormat, // data format
|
||||
LPGLYPHMETRICS lpgm, // glyph metrics
|
||||
DWORD cbBuffer, // size of data buffer
|
||||
LPVOID lpvBuffer, // data buffer
|
||||
CONST MAT2 *lpmat2 // transformation matrix
|
||||
HDC hdc, // handle to DC
|
||||
UINT uChar, // character to query
|
||||
UINT uFormat, // data format
|
||||
LPGLYPHMETRICS lpgm, // glyph metrics
|
||||
DWORD cbBuffer, // size of data buffer
|
||||
LPVOID lpvBuffer, // data buffer
|
||||
CONST MAT2 *lpmat2 // transformation matrix
|
||||
)
|
||||
{
|
||||
//last parameter must point to writeable memory
|
||||
|
@ -54,8 +54,8 @@ DWORD WINAPI GetFontUnicodeRanges_new(
|
||||
/* On 9x fallback to system function */
|
||||
/* MAKE_EXPORT SetGraphicsMode_NT=SetGraphicsMode */
|
||||
int WINAPI SetGraphicsMode_NT(
|
||||
HDC hdc, // handle to device context
|
||||
int iMode // graphics mode
|
||||
HDC hdc, // handle to device context
|
||||
int iMode // graphics mode
|
||||
)
|
||||
{
|
||||
return GM_COMPATIBLE;
|
||||
@ -63,8 +63,8 @@ int WINAPI SetGraphicsMode_NT(
|
||||
|
||||
/* MAKE_EXPORT SetWorldTransform_9x=SetWorldTransform */
|
||||
BOOL WINAPI SetWorldTransform_9x(
|
||||
HDC hdc, // handle to device context
|
||||
CONST XFORM *lpXform // transformation data
|
||||
HDC hdc, // handle to device context
|
||||
CONST XFORM *lpXform // transformation data
|
||||
)
|
||||
{
|
||||
return FALSE;
|
||||
@ -72,9 +72,9 @@ BOOL WINAPI SetWorldTransform_9x(
|
||||
|
||||
/* MAKE_EXPORT GetRandomRgn_NT=GetRandomRgn */
|
||||
int WINAPI GetRandomRgn_NT(
|
||||
HDC hdc, // handle to DC
|
||||
HRGN hrgn, // handle to region
|
||||
INT iNum // must be SYSRGN
|
||||
HDC hdc, // handle to DC
|
||||
HRGN hrgn, // handle to region
|
||||
INT iNum // must be SYSRGN
|
||||
)
|
||||
{
|
||||
int result = GetRandomRgn(hdc,hrgn,iNum);
|
||||
@ -106,8 +106,8 @@ void floattofrac( float f, int* m, int* d)
|
||||
|
||||
/* MAKE_EXPORT SetWorldTransform_NT=SetWorldTransform */
|
||||
BOOL WINAPI SetWorldTransform_NT(
|
||||
HDC hdc, // handle to device context
|
||||
CONST XFORM *lpXform // transformation data
|
||||
HDC hdc, // handle to device context
|
||||
CONST XFORM *lpXform // transformation data
|
||||
)
|
||||
{
|
||||
GrabWin16Lock();
|
||||
@ -129,23 +129,26 @@ BOOL WINAPI SetWorldTransform_NT(
|
||||
//hack DC mode to anisotropic to make Set*ExtEx work
|
||||
savemapmode = dcobj->mapmode;
|
||||
dcobj->mapmode = MM_ANISOTROPIC;
|
||||
ReleaseWin16Lock();
|
||||
SetWindowExtEx(hdc,wx,wy,NULL);
|
||||
SetViewportExtEx(hdc,vx,vy,NULL);
|
||||
SetViewportOrgEx(hdc,(int)lpXform->eDx,(int)lpXform->eDy,NULL);
|
||||
//set it back
|
||||
GrabWin16Lock();
|
||||
dcobj = GetDCObj(hdc);
|
||||
dcobj->mapmode = savemapmode;
|
||||
ReleaseWin16Lock();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* Those hacks shouldn't hurt anybody. */
|
||||
/* Those hacks shouldn't hurt anybody. */
|
||||
/************************************************************************/
|
||||
|
||||
/* MAKE_EXPORT SetMapMode_NT=SetMapMode */
|
||||
int WINAPI SetMapMode_NT(
|
||||
HDC hdc, // handle to device context
|
||||
int fnMapMode // new mapping mode
|
||||
HDC hdc, // handle to device context
|
||||
int fnMapMode // new mapping mode
|
||||
)
|
||||
{
|
||||
|
||||
@ -155,8 +158,8 @@ int WINAPI SetMapMode_NT(
|
||||
|
||||
/* MAKE_EXPORT GetTextMetricsA_NT=GetTextMetricsA */
|
||||
BOOL WINAPI GetTextMetricsA_NT(
|
||||
HDC hdc, // handle to DC
|
||||
LPTEXTMETRIC lptm // text metrics
|
||||
HDC hdc, // handle to DC
|
||||
LPTEXTMETRIC lptm // text metrics
|
||||
)
|
||||
{
|
||||
GrabWin16Lock();
|
||||
@ -170,20 +173,22 @@ BOOL WINAPI GetTextMetricsA_NT(
|
||||
}
|
||||
if ( dcobj->ViewportExtX != 1 || dcobj->ViewportExtY != 1 || dcobj->WindowExtX != 1 || dcobj->WindowExtY != 1 )
|
||||
{
|
||||
ReleaseWin16Lock();
|
||||
saved = SaveDC(hdc);
|
||||
ResetMapMode(hdc);
|
||||
}
|
||||
else
|
||||
ReleaseWin16Lock();
|
||||
retval = GetTextMetricsA(hdc,lptm);
|
||||
if ( saved )
|
||||
RestoreDC(hdc,-1);
|
||||
ReleaseWin16Lock();
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetWorldTransform_NT=GetWorldTransform */
|
||||
BOOL WINAPI GetWorldTransform_NT(
|
||||
HDC hdc, // handle to device context
|
||||
LPXFORM lpXform // transformation
|
||||
HDC hdc, // handle to device context
|
||||
LPXFORM lpXform // transformation
|
||||
)
|
||||
{
|
||||
SIZE v;
|
||||
@ -204,9 +209,9 @@ BOOL WINAPI GetWorldTransform_NT(
|
||||
|
||||
/* MAKE_EXPORT ModifyWorldTransform_NT=ModifyWorldTransform */
|
||||
BOOL WINAPI ModifyWorldTransform_NT(
|
||||
HDC hdc, // handle to device context
|
||||
CONST XFORM *lpXform, // transformation data
|
||||
DWORD iMode // modification mode
|
||||
HDC hdc, // handle to device context
|
||||
CONST XFORM *lpXform, // transformation data
|
||||
DWORD iMode // modification mode
|
||||
)
|
||||
{
|
||||
//we accept only 'reset world' scenario
|
||||
@ -242,14 +247,14 @@ static void WINAPI MakeDxFromDxDy(const int* lpDx, int* newlpDx, UINT cbCount)
|
||||
|
||||
/* MAKE_EXPORT ExtTextOutA_new=ExtTextOutA */
|
||||
BOOL WINAPI ExtTextOutA_new(
|
||||
HDC hdc, // handle to DC
|
||||
int X, // x-coordinate of reference point
|
||||
int Y, // y-coordinate of reference point
|
||||
UINT fuOptions, // text-output options
|
||||
CONST RECT* lprc, // optional dimensions
|
||||
LPCSTR lpString, // string
|
||||
UINT cbCount, // number of characters in string
|
||||
CONST INT* lpDx // array of spacing values
|
||||
HDC hdc, // handle to DC
|
||||
int X, // x-coordinate of reference point
|
||||
int Y, // y-coordinate of reference point
|
||||
UINT fuOptions, // text-output options
|
||||
CONST RECT* lprc, // optional dimensions
|
||||
LPCSTR lpString, // string
|
||||
UINT cbCount, // number of characters in string
|
||||
CONST INT* lpDx // array of spacing values
|
||||
)
|
||||
{
|
||||
BOOL result;
|
||||
@ -284,14 +289,14 @@ BOOL WINAPI ExtTextOutA_new(
|
||||
|
||||
/* MAKE_EXPORT ExtTextOutW_new=ExtTextOutW */
|
||||
BOOL WINAPI ExtTextOutW_new(
|
||||
HDC hdc, // handle to DC
|
||||
int X, // x-coordinate of reference point
|
||||
int Y, // y-coordinate of reference point
|
||||
UINT fuOptions, // text-output options
|
||||
CONST RECT* lprc, // optional dimensions
|
||||
LPCWSTR lpString, // string
|
||||
UINT cbCount, // number of characters in string
|
||||
CONST INT* lpDx // array of spacing values
|
||||
HDC hdc, // handle to DC
|
||||
int X, // x-coordinate of reference point
|
||||
int Y, // y-coordinate of reference point
|
||||
UINT fuOptions, // text-output options
|
||||
CONST RECT* lprc, // optional dimensions
|
||||
LPCWSTR lpString, // string
|
||||
UINT cbCount, // number of characters in string
|
||||
CONST INT* lpDx // array of spacing values
|
||||
)
|
||||
{
|
||||
BOOL result;
|
||||
@ -328,11 +333,15 @@ BOOL WINAPI ExtTextOutW_new(
|
||||
savemapmode = dcobj->mapmode;
|
||||
dcobj->mapmode = MM_ANISOTROPIC;
|
||||
}
|
||||
ReleaseWin16Lock();
|
||||
result = ExtTextOutW(hdc,X,Y,fuOptions,lprc,lpString,cbCount,lpDx);
|
||||
if ( savemapmode )
|
||||
{
|
||||
GrabWin16Lock();
|
||||
dcobj = GetDCObj( hdc );
|
||||
dcobj->mapmode = savemapmode;
|
||||
ReleaseWin16Lock();
|
||||
|
||||
ReleaseWin16Lock();
|
||||
}
|
||||
if ( buffer && cbCount>128 )
|
||||
HeapFree(GetProcessHeap(),0,buffer);
|
||||
return result;
|
||||
@ -346,10 +355,10 @@ BOOL WINAPI PolyTextOutA_new( HDC hdc, const POLYTEXTA *pptxt, INT cStrings )
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
for (; cStrings>0; cStrings--, pptxt++)
|
||||
if (!ExtTextOutA_new (hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx ))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
for (; cStrings>0; cStrings--, pptxt++)
|
||||
if (!ExtTextOutA_new (hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx ))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT PolyTextOutW_new=PolyTextOutW */
|
||||
@ -360,8 +369,8 @@ BOOL WINAPI PolyTextOutW_new( HDC hdc, const POLYTEXTW *pptxt, INT cStrings )
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
for (; cStrings>0; cStrings--, pptxt++)
|
||||
if (!ExtTextOutW_new (hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx ))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
for (; cStrings>0; cStrings--, pptxt++)
|
||||
if (!ExtTextOutW_new (hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx ))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ static const apilib_named_api gdi32_named_apis[] =
|
||||
DECL_API("EnumFontFamiliesExA", EnumFontFamiliesExA_new),
|
||||
DECL_API("EnumFontFamiliesExW", EnumFontFamiliesExW_new),
|
||||
DECL_API("EnumFontFamiliesW", EnumFontFamiliesW_new),
|
||||
DECL_API("EnumFontsW", EnumFontsW_new),
|
||||
DECL_API("ExtCreatePen", ExtCreatePen_fix),
|
||||
DECL_API("ExtTextOutA", ExtTextOutA_new),
|
||||
DECL_API("ExtTextOutW", ExtTextOutW_new),
|
||||
|
@ -28,6 +28,10 @@ BOOL init_gdi32();
|
||||
extern const apilib_api_table apitable_gdi32;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
int WINAPI EnumFontFamiliesExA_new(HDC hdc, LPLOGFONTA pLogfontA, FONTENUMPROCA pEnumFontFamExProc, LPARAM lParam, DWORD dwFlags);
|
||||
int WINAPI EnumFontFamiliesExW_new(HDC hdc, LPLOGFONTW pLogfontW, FONTENUMPROCW pEnumFontFamExProc, LPARAM lParam, DWORD dwFlags);
|
||||
int WINAPI EnumFontFamiliesW_new(HDC hdc, LPCWSTR lpszFamilyW, FONTENUMPROCW lpEnumFontFamProc, LPARAM lParam);
|
||||
int WINAPI EnumFontsW_new(HDC hdc, LPCWSTR lpFaceNameW, FONTENUMPROCW lpFontFunc, LPARAM lParam);
|
||||
INT WINAPI AddFontResourceExA_new(LPCSTR str, DWORD fl, PVOID pdv);
|
||||
BOOL WINAPI RemoveFontResourceExA_new(LPCSTR str, DWORD fl, PVOID pdv);
|
||||
HANDLE WINAPI AddFontMemResourceEx_stub(PVOID pbFont, DWORD cbFont, PVOID pdv, DWORD *pcFonts);
|
||||
@ -59,9 +63,6 @@ STUB GetDCBrushColor_stub;
|
||||
STUB GetDCPenColor_stub;
|
||||
INT WINAPI AddFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv);
|
||||
INT WINAPI AddFontResourceW_new(LPCWSTR strW);
|
||||
int WINAPI EnumFontFamiliesExA_new(HDC hdc, LPLOGFONTA pLogfontA, FONTENUMPROCA pEnumFontFamExProc, LPARAM lParam, DWORD dwFlags);
|
||||
int WINAPI EnumFontFamiliesExW_new(HDC hdc, LPLOGFONTW pLogfontW, FONTENUMPROCW pEnumFontFamExProc, LPARAM lParam, DWORD dwFlags);
|
||||
int WINAPI EnumFontFamiliesW_new(HDC hdc, LPCWSTR lpszFamily, FONTENUMPROCW lpEnumFontFamProc, LPARAM lParam);
|
||||
BOOL WINAPI RemoveFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv);
|
||||
BOOL WINAPI RemoveFontResourceW_new(LPCWSTR strW);
|
||||
HPEN WINAPI ExtCreatePen_fix(DWORD dwPenStyle, DWORD dwWidth, CONST LOGBRUSH *lplb, DWORD dwStyleCount, CONST DWORD *lpStyle);
|
||||
|
@ -22,193 +22,46 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "_gdi32_apilist.h"
|
||||
#include "../kernel32/_kernel32_apilist.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FONTENUMPROCW EnumProcW;
|
||||
LPARAM lParam;
|
||||
} EnumFamilies_t;
|
||||
|
||||
|
||||
//MAKE_EXPORT AddFontResourceExW_new=AddFontResourceExW
|
||||
INT WINAPI AddFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(str);
|
||||
LPSTR strA;
|
||||
STACK_WtoA(strW,strA)
|
||||
return AddFontResourceExA_new(strA, fl, pdv);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT AddFontResourceW_new=AddFontResourceW
|
||||
INT WINAPI AddFontResourceW_new(LPCWSTR strW)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(str);
|
||||
LPSTR strA;
|
||||
STACK_WtoA(strW,strA)
|
||||
return AddFontResourceA(strA);
|
||||
}
|
||||
|
||||
static int CALLBACK EnumFontFamExConv(const LOGFONTA *plfA,
|
||||
const TEXTMETRICA* ptmA, DWORD FontType, LPARAM lParam)
|
||||
{
|
||||
const ENUMLOGFONTEXA* fontA = (const ENUMLOGFONTEXA*) plfA;
|
||||
const NEWTEXTMETRICEXA* tmA = (const NEWTEXTMETRICEXA*) ptmA;
|
||||
ENUMLOGFONTEXW elfeW;
|
||||
NEWTEXTMETRICEXW ntmeW;
|
||||
ENUMLOGFONTEXW* fontW = &elfeW;
|
||||
NEWTEXTMETRICEXW* tmW = &ntmeW;
|
||||
|
||||
EnumFamilies_t* pef = (EnumFamilies_t*) lParam;
|
||||
|
||||
memcpy(&fontW->elfLogFont, &fontA->elfLogFont, sizeof(LOGFONTA) - LF_FACESIZE);
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) fontA->elfLogFont.lfFaceName, -1,
|
||||
fontW->elfLogFont.lfFaceName, LF_FACESIZE);
|
||||
fontW->elfLogFont.lfFaceName[LF_FACESIZE - 1] = 0;
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) fontA->elfFullName, -1,
|
||||
fontW->elfFullName, LF_FULLFACESIZE);
|
||||
fontW->elfFullName[LF_FULLFACESIZE - 1] = 0;
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) fontA->elfStyle, -1,
|
||||
fontW->elfStyle, LF_FACESIZE);
|
||||
fontW->elfStyle[LF_FACESIZE - 1] = 0;
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) fontA->elfScript, -1,
|
||||
fontW->elfScript, LF_FACESIZE);
|
||||
fontW->elfScript[LF_FACESIZE - 1] = 0;
|
||||
|
||||
tmW->ntmTm.tmHeight = tmA->ntmTm.tmHeight;
|
||||
tmW->ntmTm.tmAscent = tmA->ntmTm.tmAscent;
|
||||
tmW->ntmTm.tmDescent = tmA->ntmTm.tmDescent;
|
||||
tmW->ntmTm.tmInternalLeading = tmA->ntmTm.tmInternalLeading;
|
||||
tmW->ntmTm.tmExternalLeading = tmA->ntmTm.tmExternalLeading;
|
||||
tmW->ntmTm.tmAveCharWidth = tmA->ntmTm.tmAveCharWidth;
|
||||
tmW->ntmTm.tmMaxCharWidth = tmA->ntmTm.tmMaxCharWidth;
|
||||
tmW->ntmTm.tmWeight = tmA->ntmTm.tmWeight;
|
||||
tmW->ntmTm.tmOverhang = tmA->ntmTm.tmOverhang;
|
||||
tmW->ntmTm.tmDigitizedAspectX = tmA->ntmTm.tmDigitizedAspectX;
|
||||
tmW->ntmTm.tmDigitizedAspectY = tmA->ntmTm.tmDigitizedAspectY;
|
||||
tmW->ntmTm.tmItalic = tmA->ntmTm.tmItalic;
|
||||
tmW->ntmTm.tmUnderlined = tmA->ntmTm.tmUnderlined;
|
||||
tmW->ntmTm.tmStruckOut = tmA->ntmTm.tmStruckOut;
|
||||
tmW->ntmTm.tmPitchAndFamily = tmA->ntmTm.tmPitchAndFamily;
|
||||
tmW->ntmTm.tmCharSet = tmA->ntmTm.tmCharSet;
|
||||
|
||||
//needs review - are this conversions necessary or is it enough to just copy?
|
||||
#if 1
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) &tmA->ntmTm.tmFirstChar, 1,
|
||||
&tmW->ntmTm.tmFirstChar, 1);
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) &tmA->ntmTm.tmLastChar, 1,
|
||||
&tmW->ntmTm.tmLastChar, 1);
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) &tmA->ntmTm.tmDefaultChar, 1,
|
||||
&tmW->ntmTm.tmDefaultChar, 1);
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) &tmA->ntmTm.tmBreakChar, 1,
|
||||
&tmW->ntmTm.tmBreakChar, 1);
|
||||
#else
|
||||
tmW->ntmTm.tmFirstChar = tmA->ntmTm.tmFirstChar;
|
||||
tmW->ntmTm.tmLastChar = tmA->ntmTm.tmLastChar;
|
||||
tmW->ntmTm.tmDefaultChar = tmA->ntmTm.tmDefaultChar;
|
||||
tmW->ntmTm.tmBreakChar = tmA->ntmTm.tmBreakChar;
|
||||
#endif
|
||||
|
||||
if (FontType == TRUETYPE_FONTTYPE)
|
||||
{
|
||||
tmW->ntmTm.ntmFlags = tmA->ntmTm.ntmFlags;
|
||||
tmW->ntmTm.ntmSizeEM = tmA->ntmTm.ntmSizeEM;
|
||||
tmW->ntmTm.ntmCellHeight = tmA->ntmTm.ntmCellHeight;
|
||||
tmW->ntmTm.ntmAvgWidth = tmA->ntmTm.ntmAvgWidth;
|
||||
memset(&tmW->ntmFontSig, 0, sizeof(FONTSIGNATURE));
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&tmW->ntmTm.ntmFlags, 0, sizeof(NEWTEXTMETRICEXW)
|
||||
- FIELD_OFFSET(NEWTEXTMETRICEXW, ntmTm.ntmFlags));
|
||||
}
|
||||
|
||||
return pef->EnumProcW((LOGFONTW*) &elfeW, (TEXTMETRICW*) &ntmeW, FontType, pef->lParam);
|
||||
}
|
||||
|
||||
/* Surprise surprise!
|
||||
* logfont* is optional in EnumFontFamiliesEx on NT
|
||||
* and means - all fonts, all charsets
|
||||
*/
|
||||
|
||||
/* MAKE_EXPORT EnumFontFamiliesExA_new=EnumFontFamiliesExA */
|
||||
int WINAPI EnumFontFamiliesExA_new(HDC hdc, LPLOGFONTA pLogfontA,
|
||||
FONTENUMPROCA pEnumFontFamExProc, LPARAM lParam, DWORD dwFlags)
|
||||
{
|
||||
LOGFONTA logfont;
|
||||
if (!pLogfontA)
|
||||
{
|
||||
memset(&logfont, 0, sizeof(logfont));
|
||||
logfont.lfCharSet = DEFAULT_CHARSET;
|
||||
pLogfontA = &logfont;
|
||||
}
|
||||
return EnumFontFamiliesExA(hdc, pLogfontA, pEnumFontFamExProc, lParam, dwFlags);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT EnumFontFamiliesExW_new=EnumFontFamiliesExW */
|
||||
int WINAPI EnumFontFamiliesExW_new(HDC hdc, LPLOGFONTW pLogfontW,
|
||||
FONTENUMPROCW pEnumFontFamExProc, LPARAM lParam, DWORD dwFlags)
|
||||
{
|
||||
EnumFamilies_t ef;
|
||||
LOGFONTA logfont;
|
||||
if (pLogfontW)
|
||||
{
|
||||
memcpy(&logfont, pLogfontW, sizeof(LOGFONTA) - LF_FACESIZE);
|
||||
WideCharToMultiByte(CP_ACP, 0, pLogfontW->lfFaceName, -1, logfont.lfFaceName,
|
||||
LF_FACESIZE, NULL, NULL);
|
||||
logfont.lfFaceName[LF_FACESIZE - 1] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&logfont, 0, sizeof(logfont));
|
||||
logfont.lfCharSet = DEFAULT_CHARSET;
|
||||
}
|
||||
ef.EnumProcW = pEnumFontFamExProc;
|
||||
ef.lParam = lParam;
|
||||
return EnumFontFamiliesExA(hdc, &logfont, EnumFontFamExConv, (LPARAM) &ef, dwFlags);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT EnumFontFamiliesW_new=EnumFontFamiliesW */
|
||||
int WINAPI EnumFontFamiliesW_new(HDC hdc, LPCWSTR lpszFamily,
|
||||
FONTENUMPROCW lpEnumFontFamProc, LPARAM lParam)
|
||||
{
|
||||
LOGFONTW lf;
|
||||
LOGFONTW* plf = NULL;
|
||||
|
||||
if (lpszFamily)
|
||||
{
|
||||
if (!*lpszFamily)
|
||||
return 1;
|
||||
lstrcpynW_new(lf.lfFaceName, lpszFamily, LF_FACESIZE);
|
||||
lf.lfCharSet = DEFAULT_CHARSET;
|
||||
lf.lfPitchAndFamily = 0;
|
||||
plf = &lf;
|
||||
}
|
||||
|
||||
return EnumFontFamiliesExW_new(hdc, plf, lpEnumFontFamProc, lParam, 0);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT RemoveFontResourceExW_new=RemoveFontResourceExW
|
||||
BOOL WINAPI RemoveFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(str);
|
||||
LPSTR strA;
|
||||
STACK_WtoA(strW,strA)
|
||||
return RemoveFontResourceExA_new(strA, fl, pdv);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT RemoveFontResourceW_new=RemoveFontResourceW
|
||||
BOOL WINAPI RemoveFontResourceW_new(LPCWSTR strW)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(str);
|
||||
LPSTR strA;
|
||||
STACK_WtoA(strW,strA)
|
||||
return RemoveFontResourceA(strA);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT ExtCreatePen_fix=ExtCreatePen */
|
||||
HPEN WINAPI ExtCreatePen_fix(
|
||||
DWORD dwPenStyle, // pen style
|
||||
DWORD dwWidth, // pen width
|
||||
CONST LOGBRUSH *lplb, // brush attributes
|
||||
DWORD dwStyleCount, // length of custom style array
|
||||
CONST DWORD *lpStyle // custom style array
|
||||
DWORD dwPenStyle, // pen style
|
||||
DWORD dwWidth, // pen width
|
||||
CONST LOGBRUSH *lplb, // brush attributes
|
||||
DWORD dwStyleCount, // length of custom style array
|
||||
CONST DWORD *lpStyle // custom style array
|
||||
)
|
||||
{
|
||||
dwPenStyle &= ~PS_USERSTYLE;
|
||||
@ -217,9 +70,9 @@ HPEN WINAPI ExtCreatePen_fix(
|
||||
|
||||
/* MAKE_EXPORT GetObjectW_new=GetObjectW */
|
||||
int WINAPI GetObjectW_new(
|
||||
HGDIOBJ hgdiobj, // handle to graphics object
|
||||
int cbBuffer, // size of buffer for object information
|
||||
LPVOID lpvObject // buffer for object information
|
||||
HGDIOBJ hgdiobj, // handle to graphics object
|
||||
int cbBuffer, // size of buffer for object information
|
||||
LPVOID lpvObject // buffer for object information
|
||||
)
|
||||
{
|
||||
int type = GetObjectType_fix(hgdiobj);
|
||||
|
@ -51,10 +51,10 @@ typedef struct
|
||||
|
||||
/* MAKE_EXPORT CreateIoCompletionPort_new=CreateIoCompletionPort */
|
||||
HANDLE WINAPI CreateIoCompletionPort_new(
|
||||
HANDLE FileHandle, // handle to file
|
||||
HANDLE ExistingCompletionPort, // handle to I/O completion port
|
||||
ULONG_PTR CompletionKey, // completion key
|
||||
DWORD NumberOfConcurrentThreads // number of threads to execute concurrently
|
||||
HANDLE FileHandle, // handle to file
|
||||
HANDLE ExistingCompletionPort, // handle to I/O completion port
|
||||
ULONG_PTR CompletionKey, // completion key
|
||||
DWORD NumberOfConcurrentThreads // number of threads to execute concurrently
|
||||
)
|
||||
{
|
||||
//kexDebugPrint("CreateIoCompletionPort FileHandle %p Port %p Key %p Threads %d",FileHandle,ExistingCompletionPort,CompletionKey,NumberOfConcurrentThreads);
|
||||
@ -81,11 +81,11 @@ HANDLE WINAPI CreateIoCompletionPort_new(
|
||||
|
||||
/* MAKE_EXPORT GetQueuedCompletionStatus_new=GetQueuedCompletionStatus */
|
||||
BOOL WINAPI GetQueuedCompletionStatus_new(
|
||||
HANDLE CompletionPort, // handle to completion port
|
||||
LPDWORD lpNumberOfBytes, // bytes transferred
|
||||
PULONG_PTR lpCompletionKey, // file completion key
|
||||
LPOVERLAPPED *lpOverlapped, // buffer
|
||||
DWORD dwMilliseconds // optional timeout value
|
||||
HANDLE CompletionPort, // handle to completion port
|
||||
LPDWORD lpNumberOfBytes, // bytes transferred
|
||||
PULONG_PTR lpCompletionKey, // file completion key
|
||||
LPOVERLAPPED *lpOverlapped, // buffer
|
||||
DWORD dwMilliseconds // optional timeout value
|
||||
)
|
||||
{
|
||||
PCOMPLET_PORT port = (PCOMPLET_PORT)MapViewOfFile(CompletionPort,FILE_MAP_ALL_ACCESS,0,0,0);
|
||||
@ -120,10 +120,10 @@ BOOL WINAPI GetQueuedCompletionStatus_new(
|
||||
|
||||
/* MAKE_EXPORT PostQueuedCompletionStatus_new=PostQueuedCompletionStatus */
|
||||
BOOL WINAPI PostQueuedCompletionStatus_new(
|
||||
HANDLE CompletionPort, // handle to an I/O completion port
|
||||
DWORD dwNumberOfBytesTransferred, // bytes transferred
|
||||
ULONG_PTR dwCompletionKey, // completion key
|
||||
LPOVERLAPPED lpOverlapped // overlapped buffer
|
||||
HANDLE CompletionPort, // handle to an I/O completion port
|
||||
DWORD dwNumberOfBytesTransferred, // bytes transferred
|
||||
ULONG_PTR dwCompletionKey, // completion key
|
||||
LPOVERLAPPED lpOverlapped // overlapped buffer
|
||||
)
|
||||
{
|
||||
PCOMPLET_PORT port = (PCOMPLET_PORT)MapViewOfFile(CompletionPort,FILE_MAP_ALL_ACCESS,0,0,0);
|
||||
|
@ -24,6 +24,6 @@
|
||||
/* MAKE_EXPORT CopyFileExA_new=CopyFileExA */
|
||||
BOOL WINAPI CopyFileExA_new(LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags)
|
||||
{
|
||||
return CopyFileA(lpExistingFileNameA, lpNewFileNameA,
|
||||
return CopyFileA(lpExistingFileNameA, lpNewFileNameA,
|
||||
(dwCopyFlags & COPY_FILE_FAIL_IF_EXISTS) != 0);
|
||||
}
|
||||
|
@ -23,12 +23,12 @@
|
||||
|
||||
/* MAKE_EXPORT CreateThread_fix=CreateThread */
|
||||
HANDLE WINAPI CreateThread_fix(
|
||||
LPSECURITY_ATTRIBUTES lpThreadAttributes, // SD
|
||||
SIZE_T dwStackSize, // initial stack size
|
||||
LPTHREAD_START_ROUTINE lpStartAddress, // thread function
|
||||
LPVOID lpParameter, // thread argument
|
||||
DWORD dwCreationFlags, // creation option
|
||||
LPDWORD lpThreadId // thread identifier
|
||||
LPSECURITY_ATTRIBUTES lpThreadAttributes, // SD
|
||||
SIZE_T dwStackSize, // initial stack size
|
||||
LPTHREAD_START_ROUTINE lpStartAddress, // thread function
|
||||
LPVOID lpParameter, // thread argument
|
||||
DWORD dwCreationFlags, // creation option
|
||||
LPDWORD lpThreadId // thread identifier
|
||||
)
|
||||
{
|
||||
DWORD dummy;
|
||||
|
39
apilibs/kexbases/Kernel32/FindFirstFileEx.c
Executable file
39
apilibs/kexbases/Kernel32/FindFirstFileEx.c
Executable file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "_kernel32_apilist.h"
|
||||
|
||||
/* MAKE_EXPORT FindFirstFileExA_new=FindFirstFileExA */
|
||||
HANDLE WINAPI FindFirstFileExA_new( LPCSTR lpFileNameA, FINDEX_INFO_LEVELS fInfoLevelId,
|
||||
LPWIN32_FIND_DATAA lpFindFileDataA, FINDEX_SEARCH_OPS fSearchOp,
|
||||
LPVOID lpSearchFilter, DWORD dwAdditionalFlags)
|
||||
{
|
||||
return FindFirstFileA(lpFileNameA,lpFindFileDataA);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT FindFirstFileExW_new=FindFirstFileExW */
|
||||
HANDLE WINAPI FindFirstFileExW_new( LPWSTR lpFileNameW, FINDEX_INFO_LEVELS fInfoLevelId,
|
||||
LPWIN32_FIND_DATAW lpFindFileDataW, FINDEX_SEARCH_OPS fSearchOp,
|
||||
LPVOID lpSearchFilter, DWORD dwAdditionalFlags)
|
||||
{
|
||||
return FindFirstFileW_new(lpFileNameW,lpFindFileDataW);
|
||||
}
|
@ -27,9 +27,9 @@
|
||||
|
||||
/* MAKE_EXPORT GetModuleHandleExA_new=GetModuleHandleExA */
|
||||
BOOL WINAPI GetModuleHandleExA_new(
|
||||
DWORD dwFlags,
|
||||
LPCSTR lpModuleName,
|
||||
HMODULE* phModule
|
||||
DWORD dwFlags,
|
||||
LPCSTR lpModuleName,
|
||||
HMODULE* phModule
|
||||
)
|
||||
{
|
||||
char buf[MAX_PATH];
|
||||
@ -60,9 +60,9 @@ BOOL WINAPI GetModuleHandleExA_new(
|
||||
|
||||
/* MAKE_EXPORT GetModuleHandleExW_new=GetModuleHandleExW */
|
||||
BOOL WINAPI GetModuleHandleExW_new(
|
||||
DWORD dwFlags,
|
||||
LPCWSTR lpModuleNameW,
|
||||
HMODULE* phModule
|
||||
DWORD dwFlags,
|
||||
LPCWSTR lpModuleNameW,
|
||||
HMODULE* phModule
|
||||
)
|
||||
{
|
||||
if (dwFlags & GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS)
|
||||
|
@ -27,10 +27,10 @@ BOOL WINAPI GlobalMemoryStatusEx_new(LPMEMORYSTATUSEX lpmemex)
|
||||
MEMORYSTATUS mem;
|
||||
|
||||
if (lpmemex->dwLength != sizeof(*lpmemex))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
mem.dwLength = sizeof(mem);
|
||||
GlobalMemoryStatus(&mem);
|
||||
|
@ -32,7 +32,7 @@ static BOOL IsValidHeap(HANDLE hHeap)
|
||||
|
||||
/* MAKE_EXPORT HeapLock_new=HeapLock */
|
||||
BOOL WINAPI HeapLock_new(
|
||||
HANDLE hHeap
|
||||
HANDLE hHeap
|
||||
)
|
||||
{
|
||||
if ( !IsValidHeap(hHeap) ) return FALSE;
|
||||
@ -42,7 +42,7 @@ BOOL WINAPI HeapLock_new(
|
||||
|
||||
/* MAKE_EXPORT HeapUnlock_new=HeapUnlock */
|
||||
BOOL WINAPI HeapUnlock_new(
|
||||
HANDLE hHeap
|
||||
HANDLE hHeap
|
||||
)
|
||||
{
|
||||
if ( !IsValidHeap(hHeap) ) return FALSE;
|
||||
@ -54,7 +54,7 @@ BOOL WINAPI HeapUnlock_new(
|
||||
|
||||
/* MAKE_EXPORT GlobalLock_fix=GlobalLock */
|
||||
LPVOID WINAPI GlobalLock_fix(
|
||||
HGLOBAL hMem // address of the global memory object
|
||||
HGLOBAL hMem // address of the global memory object
|
||||
)
|
||||
{
|
||||
if (ISPOINTER(hMem))
|
||||
@ -64,7 +64,7 @@ LPVOID WINAPI GlobalLock_fix(
|
||||
|
||||
/* MAKE_EXPORT GlobalUnlock_fix=GlobalUnlock */
|
||||
BOOL WINAPI GlobalUnlock_fix(
|
||||
HGLOBAL hMem // handle to the global memory object
|
||||
HGLOBAL hMem // handle to the global memory object
|
||||
)
|
||||
{
|
||||
if (ISPOINTER(hMem))
|
||||
|
@ -66,30 +66,32 @@ static void do_cpuid(unsigned int _eax, unsigned int *p)
|
||||
|
||||
void get_cpuinfo()
|
||||
{
|
||||
unsigned int regs[4], regs2[4];
|
||||
unsigned int regs[4], regs2[4];
|
||||
|
||||
do_cpuid(0x00000000, regs); /* get standard cpuid level and vendor name */
|
||||
if (regs[0]>=0x00000001) /* Check for supported cpuid version */
|
||||
{
|
||||
do_cpuid(0x00000001, regs2); /* get cpu features */
|
||||
PF[PF_FLOATING_POINT_EMULATED] = !(regs2[3] & 1);
|
||||
PF[PF_RDTSC_INSTRUCTION_AVAILABLE] = (regs2[3] & (1 << 4 )) >> 4;
|
||||
PF[PF_COMPARE_EXCHANGE_DOUBLE] = (regs2[3] & (1 << 8 )) >> 8;
|
||||
PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1 << 23)) >> 23;
|
||||
PF[PF_XMMI_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1 << 25)) >> 25;
|
||||
PF[PF_XMMI64_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1 << 26)) >> 26;
|
||||
PF[PF_SSE3_INSTRUCTIONS_AVAILABLE] = (regs2[2] & 1);
|
||||
do_cpuid(0x00000000, regs); /* get standard cpuid level and vendor name */
|
||||
if (regs[0]>=0x00000001) /* Check for supported cpuid version */
|
||||
{
|
||||
do_cpuid(0x00000001, regs2); /* get cpu features */
|
||||
PF[PF_FLOATING_POINT_EMULATED] = !(regs2[3] & 1);
|
||||
PF[PF_RDTSC_INSTRUCTION_AVAILABLE] = (regs2[3] & (1 << 4 )) >> 4;
|
||||
PF[PF_COMPARE_EXCHANGE_DOUBLE] = (regs2[3] & (1 << 8 )) >> 8;
|
||||
PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1 << 23)) >> 23;
|
||||
PF[PF_XMMI_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1 << 25)) >> 25;
|
||||
PF[PF_XMMI64_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1 << 26)) >> 26;
|
||||
PF[PF_SSE3_INSTRUCTIONS_AVAILABLE] = (regs2[2] & 1);
|
||||
|
||||
if (regs[1] == AUTH &&
|
||||
regs[3] == ENTI &&
|
||||
regs[2] == CAMD) {
|
||||
do_cpuid(0x80000000, regs); /* get vendor cpuid level */
|
||||
if (regs[0]>=0x80000001) {
|
||||
do_cpuid(0x80000001, regs2); /* get vendor features */
|
||||
PF[PF_3DNOW_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1 << 31)) >> 31;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (regs[1] == AUTH &&
|
||||
regs[3] == ENTI &&
|
||||
regs[2] == CAMD)
|
||||
{
|
||||
do_cpuid(0x80000000, regs); /* get vendor cpuid level */
|
||||
if (regs[0]>=0x80000001)
|
||||
{
|
||||
do_cpuid(0x80000001, regs2); /* get vendor features */
|
||||
PF[PF_3DNOW_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1 << 31)) >> 31;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT IsProcessorFeaturePresent_new=IsProcessorFeaturePresent */
|
||||
|
@ -22,15 +22,24 @@
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT LockFileEx_new=LockFileEx */
|
||||
BOOL WINAPI LockFileEx_new(HANDLE hFile, DWORD dwFlags, DWORD dwReserved, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped)
|
||||
BOOL WINAPI LockFileEx_new(
|
||||
HANDLE hFile,
|
||||
DWORD dwFlags,
|
||||
DWORD dwReserved,
|
||||
DWORD nNumberOfBytesToLockLow,
|
||||
DWORD nNumberOfBytesToLockHigh,
|
||||
LPOVERLAPPED lpOverlapped
|
||||
)
|
||||
{
|
||||
/* FIXME: flags LOCKFILE_FAIL_IMMEDIATELY and LOCKFILE_EXCLUSIVE_LOCK not supported (always set),
|
||||
Event signalling not supported
|
||||
/*
|
||||
* FIXME: flags LOCKFILE_FAIL_IMMEDIATELY and LOCKFILE_EXCLUSIVE_LOCK not supported (always set),
|
||||
* Event signalling not supported
|
||||
*/
|
||||
if (dwReserved)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
return LockFile(hFile, lpOverlapped->Offset, lpOverlapped->OffsetHigh, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh);
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
return LockFile(hFile, lpOverlapped->Offset, lpOverlapped->OffsetHigh,
|
||||
nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh);
|
||||
}
|
||||
|
@ -29,12 +29,12 @@
|
||||
BOOL WINAPI SetFilePointerEx_new(HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod)
|
||||
{
|
||||
DWORD lasterr = GetLastError();
|
||||
if ((liDistanceToMove.LowPart = SetFilePointer(hFile, liDistanceToMove.LowPart, &liDistanceToMove.HighPart, dwMoveMethod)) == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
if (lpNewFilePointer) *lpNewFilePointer = liDistanceToMove;
|
||||
SetLastError(lasterr);
|
||||
return TRUE;
|
||||
if ((liDistanceToMove.LowPart = SetFilePointer(hFile, liDistanceToMove.LowPart, &liDistanceToMove.HighPart, dwMoveMethod)) == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
if (lpNewFilePointer) *lpNewFilePointer = liDistanceToMove;
|
||||
SetLastError(lasterr);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -74,33 +74,33 @@ __asm__(".text\n\t"
|
||||
".globl _TryEnterCrst@4\n\t"
|
||||
".def _TryEnterCrst@4; .scl 2; .type 32; .endef\n"
|
||||
"_TryEnterCrst@4:\n\t"
|
||||
"movl 4(%esp),%edx\n\t"
|
||||
"xorl %eax,%eax\n\t"
|
||||
"incl %eax\n\t"
|
||||
"xorl %ecx,%ecx\n\t"
|
||||
"cmpxchgl %ecx,0x10(%edx)\n\t" /* if (OP1==eax) { OP1=OP2; ZF=1; } else { eax=OP1; ZF=0 } */
|
||||
"movl %fs:0x18, %ecx\n\t"
|
||||
"addl _offset,%ecx\n\t"
|
||||
"movl (%ecx),%ecx\n\t" /* ecx will contain TDBX now */
|
||||
"cmpl $1,%eax\n\t"
|
||||
"jnz .L1\n\t"
|
||||
/* critical section was unowned => successful lock */
|
||||
"movl %ecx,8(%edx)\n\t"
|
||||
"incl 4(%edx)\n\t"
|
||||
"ret $4\n\t"
|
||||
"movl 4(%esp),%edx\n\t"
|
||||
"xorl %eax,%eax\n\t"
|
||||
"incl %eax\n\t"
|
||||
"xorl %ecx,%ecx\n\t"
|
||||
"cmpxchgl %ecx,0x10(%edx)\n\t" /* if (OP1==eax) { OP1=OP2; ZF=1; } else { eax=OP1; ZF=0 } */
|
||||
"movl %fs:0x18, %ecx\n\t"
|
||||
"addl _offset,%ecx\n\t"
|
||||
"movl (%ecx),%ecx\n\t" /* ecx will contain TDBX now */
|
||||
"cmpl $1,%eax\n\t"
|
||||
"jnz .L1\n\t"
|
||||
/* critical section was unowned => successful lock */
|
||||
"movl %ecx,8(%edx)\n\t"
|
||||
"incl 4(%edx)\n\t"
|
||||
"ret $4\n\t"
|
||||
".L1: \n\t"
|
||||
"cmpl %ecx,8(%edx)\n\t"
|
||||
"jnz .L2\n\t"
|
||||
/* critical section owned by this thread */
|
||||
"decl 0x10(%edx)\n\t"
|
||||
"incl 4(%edx)\n\t"
|
||||
"xorl %eax,%eax\n\t"
|
||||
"incl %eax\n\t"
|
||||
"ret $4\n\t"
|
||||
"cmpl %ecx,8(%edx)\n\t"
|
||||
"jnz .L2\n\t"
|
||||
/* critical section owned by this thread */
|
||||
"decl 0x10(%edx)\n\t"
|
||||
"incl 4(%edx)\n\t"
|
||||
"xorl %eax,%eax\n\t"
|
||||
"incl %eax\n\t"
|
||||
"ret $4\n\t"
|
||||
".L2: \n\t"
|
||||
/* critical section owned by other thread - do nothing */
|
||||
"xorl %eax,%eax\n\t"
|
||||
"ret $4\n\t"
|
||||
/* critical section owned by other thread - do nothing */
|
||||
"xorl %eax,%eax\n\t"
|
||||
"ret $4\n\t"
|
||||
);
|
||||
|
||||
#else
|
||||
|
@ -77,7 +77,8 @@ static const apilib_named_api kernel32_named_apis[] =
|
||||
DECL_API("ExitProcess", ExitProcess_fix),
|
||||
DECL_API("FindAtomW", FindAtomW_new),
|
||||
DECL_API("FindFirstChangeNotificationW", FindFirstChangeNotificationW_new),
|
||||
DECL_API("FindFirstFileExW", FindFirstFileExW_stub),
|
||||
DECL_API("FindFirstFileExA", FindFirstFileExA_new),
|
||||
DECL_API("FindFirstFileExW", FindFirstFileExW_new),
|
||||
DECL_API("FindFirstFileW", FindFirstFileW_new),
|
||||
DECL_API("FindNextFileW", FindNextFileW_new),
|
||||
DECL_API("FindResourceExW", FindResourceExW_new),
|
||||
|
@ -44,6 +44,8 @@ BOOL WINAPI WriteFile_fix(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesTo
|
||||
UINT WINAPI GetTempFileNameA_fix(LPCSTR lpPathName, LPCSTR lpPrefixString, UINT uUnique, LPTSTR lpTempFileName);
|
||||
BOOL WINAPI GetDiskFreeSpaceA_fix(LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters);
|
||||
BOOL WINAPI GetDiskFreeSpaceExA_fix(LPCSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailable, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes);
|
||||
HANDLE WINAPI FindFirstFileExA_new(LPCSTR lpFileNameA, FINDEX_INFO_LEVELS fInfoLevelId, LPWIN32_FIND_DATAA lpFindFileDataA, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags);
|
||||
HANDLE WINAPI FindFirstFileExW_new(LPWSTR lpFileNameW, FINDEX_INFO_LEVELS fInfoLevelId, LPWIN32_FIND_DATAW lpFindFileDataW, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags);
|
||||
HWND WINAPI GetConsoleWindow_new();
|
||||
BOOL WINAPI GetFileSizeEx_new(HANDLE hFile, PLARGE_INTEGER lpFileSize);
|
||||
BOOL WINAPI GetModuleHandleExA_new(DWORD dwFlags, LPCSTR lpModuleName, HMODULE* phModule);
|
||||
@ -85,7 +87,6 @@ STUB CreateHardLinkW_stub;
|
||||
STUB IsValidLanguageGroup_stub;
|
||||
STUB ReplaceFileA_stub;
|
||||
STUB ReplaceFileW_stub;
|
||||
STUB FindFirstFileExW_stub;
|
||||
STUB HeapSetInformation_stub;
|
||||
STUB GetProcessIoCounters_stub;
|
||||
STUB RtlCaptureStackBackTrace_stub;
|
||||
|
@ -26,7 +26,6 @@ UNIMPL_FUNC(CreateHardLinkW, 3);
|
||||
UNIMPL_FUNC(IsValidLanguageGroup, 2);
|
||||
UNIMPL_FUNC(ReplaceFileA, 6);
|
||||
UNIMPL_FUNC(ReplaceFileW, 6);
|
||||
UNIMPL_FUNC(FindFirstFileExW, 6);
|
||||
UNIMPL_FUNC(HeapSetInformation, 4);
|
||||
UNIMPL_FUNC(GetProcessIoCounters, 2);
|
||||
UNIMPL_FUNC(RtlCaptureStackBackTrace, 4);
|
||||
|
@ -43,35 +43,35 @@
|
||||
*/
|
||||
/* MAKE_EXPORT CompareStringW_new=CompareStringW */
|
||||
INT WINAPI CompareStringW_new(LCID lcid, DWORD style,
|
||||
LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
|
||||
LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
|
||||
{
|
||||
INT ret;
|
||||
INT ret;
|
||||
|
||||
if (!str1 || !str2)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
if (!str1 || !str2)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( style & ~(NORM_IGNORECASE|NORM_IGNORENONSPACE|NORM_IGNORESYMBOLS|
|
||||
SORT_STRINGSORT|NORM_IGNOREKANATYPE|NORM_IGNOREWIDTH|LOCALE_USE_CP_ACP|0x10000000) )
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return 0;
|
||||
}
|
||||
if( style & ~(NORM_IGNORECASE|NORM_IGNORENONSPACE|NORM_IGNORESYMBOLS|
|
||||
SORT_STRINGSORT|NORM_IGNOREKANATYPE|NORM_IGNOREWIDTH|LOCALE_USE_CP_ACP|0x10000000) )
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* this style is related to diacritics in Arabic, Japanese, and Hebrew */
|
||||
if (style & 0x10000000)
|
||||
WARN("Ignoring unknown style 0x10000000\n");
|
||||
/* this style is related to diacritics in Arabic, Japanese, and Hebrew */
|
||||
if (style & 0x10000000)
|
||||
WARN("Ignoring unknown style 0x10000000\n");
|
||||
|
||||
if (len1 < 0) len1 = strlenW(str1);
|
||||
if (len2 < 0) len2 = strlenW(str2);
|
||||
if (len1 < 0) len1 = strlenW(str1);
|
||||
if (len2 < 0) len2 = strlenW(str2);
|
||||
|
||||
ret = wine_compare_string(style, str1, len1, str2, len2);
|
||||
ret = wine_compare_string(style, str1, len1, str2, len2);
|
||||
|
||||
if (ret) /* need to translate result */
|
||||
return (ret < 0) ? CSTR_LESS_THAN : CSTR_GREATER_THAN;
|
||||
return CSTR_EQUAL;
|
||||
if (ret) /* need to translate result */
|
||||
return (ret < 0) ? CSTR_LESS_THAN : CSTR_GREATER_THAN;
|
||||
return CSTR_EQUAL;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@ -82,52 +82,52 @@ INT WINAPI CompareStringW_new(LCID lcid, DWORD style,
|
||||
/* MAKE_EXPORT GetStringTypeW_new=GetStringTypeW */
|
||||
BOOL WINAPI GetStringTypeW_new( DWORD type, LPCWSTR src, INT count, LPWORD chartype )
|
||||
{
|
||||
if (count == -1) count = strlenW(src) + 1;
|
||||
switch(type)
|
||||
{
|
||||
case CT_CTYPE1:
|
||||
while (count--) *chartype++ = get_char_typeW( *src++ ) & 0xfff;
|
||||
break;
|
||||
case CT_CTYPE2:
|
||||
while (count--) *chartype++ = get_char_typeW( *src++ ) >> 12;
|
||||
break;
|
||||
case CT_CTYPE3:
|
||||
{
|
||||
if (count == -1) count = strlenW(src) + 1;
|
||||
switch(type)
|
||||
{
|
||||
case CT_CTYPE1:
|
||||
while (count--) *chartype++ = get_char_typeW( *src++ ) & 0xfff;
|
||||
break;
|
||||
case CT_CTYPE2:
|
||||
while (count--) *chartype++ = get_char_typeW( *src++ ) >> 12;
|
||||
break;
|
||||
case CT_CTYPE3:
|
||||
{
|
||||
#if 0
|
||||
WARN("CT_CTYPE3: semi-stub.\n");
|
||||
while (count--)
|
||||
{
|
||||
int c = *src;
|
||||
WORD type1, type3 = 0; /* C3_NOTAPPLICABLE */
|
||||
WARN("CT_CTYPE3: semi-stub.\n");
|
||||
while (count--)
|
||||
{
|
||||
int c = *src;
|
||||
WORD type1, type3 = 0; /* C3_NOTAPPLICABLE */
|
||||
|
||||
type1 = get_char_typeW( *src++ ) & 0xfff;
|
||||
/* try to construct type3 from type1 */
|
||||
if(type1 & C1_SPACE) type3 |= C3_SYMBOL;
|
||||
if(type1 & C1_ALPHA) type3 |= C3_ALPHA;
|
||||
if ((c>=0x30A0)&&(c<=0x30FF)) type3 |= C3_KATAKANA;
|
||||
if ((c>=0x3040)&&(c<=0x309F)) type3 |= C3_HIRAGANA;
|
||||
if ((c>=0x4E00)&&(c<=0x9FAF)) type3 |= C3_IDEOGRAPH;
|
||||
if ((c>=0x0600)&&(c<=0x06FF)) type3 |= C3_KASHIDA;
|
||||
if ((c>=0x3000)&&(c<=0x303F)) type3 |= C3_SYMBOL;
|
||||
type1 = get_char_typeW( *src++ ) & 0xfff;
|
||||
/* try to construct type3 from type1 */
|
||||
if(type1 & C1_SPACE) type3 |= C3_SYMBOL;
|
||||
if(type1 & C1_ALPHA) type3 |= C3_ALPHA;
|
||||
if ((c>=0x30A0)&&(c<=0x30FF)) type3 |= C3_KATAKANA;
|
||||
if ((c>=0x3040)&&(c<=0x309F)) type3 |= C3_HIRAGANA;
|
||||
if ((c>=0x4E00)&&(c<=0x9FAF)) type3 |= C3_IDEOGRAPH;
|
||||
if ((c>=0x0600)&&(c<=0x06FF)) type3 |= C3_KASHIDA;
|
||||
if ((c>=0x3000)&&(c<=0x303F)) type3 |= C3_SYMBOL;
|
||||
|
||||
if ((c>=0xFF00)&&(c<=0xFF60)) type3 |= C3_FULLWIDTH;
|
||||
if ((c>=0xFF00)&&(c<=0xFF20)) type3 |= C3_SYMBOL;
|
||||
if ((c>=0xFF3B)&&(c<=0xFF40)) type3 |= C3_SYMBOL;
|
||||
if ((c>=0xFF5B)&&(c<=0xFF60)) type3 |= C3_SYMBOL;
|
||||
if ((c>=0xFF21)&&(c<=0xFF3A)) type3 |= C3_ALPHA;
|
||||
if ((c>=0xFF41)&&(c<=0xFF5A)) type3 |= C3_ALPHA;
|
||||
if ((c>=0xFFE0)&&(c<=0xFFE6)) type3 |= C3_FULLWIDTH;
|
||||
if ((c>=0xFFE0)&&(c<=0xFFE6)) type3 |= C3_SYMBOL;
|
||||
if ((c>=0xFF00)&&(c<=0xFF60)) type3 |= C3_FULLWIDTH;
|
||||
if ((c>=0xFF00)&&(c<=0xFF20)) type3 |= C3_SYMBOL;
|
||||
if ((c>=0xFF3B)&&(c<=0xFF40)) type3 |= C3_SYMBOL;
|
||||
if ((c>=0xFF5B)&&(c<=0xFF60)) type3 |= C3_SYMBOL;
|
||||
if ((c>=0xFF21)&&(c<=0xFF3A)) type3 |= C3_ALPHA;
|
||||
if ((c>=0xFF41)&&(c<=0xFF5A)) type3 |= C3_ALPHA;
|
||||
if ((c>=0xFFE0)&&(c<=0xFFE6)) type3 |= C3_FULLWIDTH;
|
||||
if ((c>=0xFFE0)&&(c<=0xFFE6)) type3 |= C3_SYMBOL;
|
||||
|
||||
if ((c>=0xFF61)&&(c<=0xFFDC)) type3 |= C3_HALFWIDTH;
|
||||
if ((c>=0xFF61)&&(c<=0xFF64)) type3 |= C3_SYMBOL;
|
||||
if ((c>=0xFF65)&&(c<=0xFF9F)) type3 |= C3_KATAKANA;
|
||||
if ((c>=0xFF65)&&(c<=0xFF9F)) type3 |= C3_ALPHA;
|
||||
if ((c>=0xFFE8)&&(c<=0xFFEE)) type3 |= C3_HALFWIDTH;
|
||||
if ((c>=0xFFE8)&&(c<=0xFFEE)) type3 |= C3_SYMBOL;
|
||||
*chartype++ = type3;
|
||||
}
|
||||
break;
|
||||
if ((c>=0xFF61)&&(c<=0xFFDC)) type3 |= C3_HALFWIDTH;
|
||||
if ((c>=0xFF61)&&(c<=0xFF64)) type3 |= C3_SYMBOL;
|
||||
if ((c>=0xFF65)&&(c<=0xFF9F)) type3 |= C3_KATAKANA;
|
||||
if ((c>=0xFF65)&&(c<=0xFF9F)) type3 |= C3_ALPHA;
|
||||
if ((c>=0xFFE8)&&(c<=0xFFEE)) type3 |= C3_HALFWIDTH;
|
||||
if ((c>=0xFFE8)&&(c<=0xFFEE)) type3 |= C3_SYMBOL;
|
||||
*chartype++ = type3;
|
||||
}
|
||||
break;
|
||||
#else
|
||||
//use implementation from SHLWAPI - ordinal 35
|
||||
HMODULE hShlwapi = GetModuleHandle("SHLWAPI.DLL");
|
||||
@ -143,12 +143,12 @@ BOOL WINAPI GetStringTypeW_new( DWORD type, LPCWSTR src, INT count, LPWORD chart
|
||||
kexGetProcAddress(hShlwapi, (LPSTR) 35);
|
||||
return GetStringType3ExW(src, count, chartype);
|
||||
#endif
|
||||
}
|
||||
default:
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
default:
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -160,8 +160,8 @@ BOOL WINAPI GetStringTypeW_new( DWORD type, LPCWSTR src, INT count, LPWORD chart
|
||||
/* MAKE_EXPORT GetStringTypeExW_new=GetStringTypeExW */
|
||||
BOOL WINAPI GetStringTypeExW_new( LCID locale, DWORD type, LPCWSTR src, INT count, LPWORD chartype )
|
||||
{
|
||||
/* locale is ignored for Unicode */
|
||||
return GetStringTypeW_new( type, src, count, chartype );
|
||||
/* locale is ignored for Unicode */
|
||||
return GetStringTypeW_new( type, src, count, chartype );
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
@ -171,128 +171,128 @@ BOOL WINAPI GetStringTypeExW_new( LCID locale, DWORD type, LPCWSTR src, INT coun
|
||||
*/
|
||||
/* MAKE_EXPORT LCMapStringW_new=LCMapStringW */
|
||||
INT WINAPI LCMapStringW_new(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
|
||||
LPWSTR dst, INT dstlen)
|
||||
LPWSTR dst, INT dstlen)
|
||||
{
|
||||
LPWSTR dst_ptr;
|
||||
LPWSTR dst_ptr;
|
||||
|
||||
if (!src || !srclen || dstlen < 0)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
if (!src || !srclen || dstlen < 0)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* mutually exclusive flags */
|
||||
if ((flags & (LCMAP_LOWERCASE | LCMAP_UPPERCASE)) == (LCMAP_LOWERCASE | LCMAP_UPPERCASE) ||
|
||||
(flags & (LCMAP_HIRAGANA | LCMAP_KATAKANA)) == (LCMAP_HIRAGANA | LCMAP_KATAKANA) ||
|
||||
(flags & (LCMAP_HALFWIDTH | LCMAP_FULLWIDTH)) == (LCMAP_HALFWIDTH | LCMAP_FULLWIDTH) ||
|
||||
(flags & (LCMAP_TRADITIONAL_CHINESE | LCMAP_SIMPLIFIED_CHINESE)) == (LCMAP_TRADITIONAL_CHINESE | LCMAP_SIMPLIFIED_CHINESE))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return 0;
|
||||
}
|
||||
/* mutually exclusive flags */
|
||||
if ((flags & (LCMAP_LOWERCASE | LCMAP_UPPERCASE)) == (LCMAP_LOWERCASE | LCMAP_UPPERCASE) ||
|
||||
(flags & (LCMAP_HIRAGANA | LCMAP_KATAKANA)) == (LCMAP_HIRAGANA | LCMAP_KATAKANA) ||
|
||||
(flags & (LCMAP_HALFWIDTH | LCMAP_FULLWIDTH)) == (LCMAP_HALFWIDTH | LCMAP_FULLWIDTH) ||
|
||||
(flags & (LCMAP_TRADITIONAL_CHINESE | LCMAP_SIMPLIFIED_CHINESE)) == (LCMAP_TRADITIONAL_CHINESE | LCMAP_SIMPLIFIED_CHINESE))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!dstlen) dst = NULL;
|
||||
if (!dstlen) dst = NULL;
|
||||
|
||||
lcid = ConvertDefaultLocale(lcid);
|
||||
lcid = ConvertDefaultLocale(lcid);
|
||||
|
||||
if (flags & LCMAP_SORTKEY)
|
||||
{
|
||||
INT ret;
|
||||
if (src == dst)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return 0;
|
||||
}
|
||||
if (flags & LCMAP_SORTKEY)
|
||||
{
|
||||
INT ret;
|
||||
if (src == dst)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (srclen < 0) srclen = strlenW(src);
|
||||
if (srclen < 0) srclen = strlenW(src);
|
||||
|
||||
TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n",
|
||||
lcid, flags, debugstr_wn(src, srclen), srclen, dst, dstlen);
|
||||
TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n",
|
||||
lcid, flags, debugstr_wn(src, srclen), srclen, dst, dstlen);
|
||||
|
||||
ret = wine_get_sortkey(flags, src, srclen, (BYTE *)dst, dstlen);
|
||||
if (ret == 0)
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
else
|
||||
ret++;
|
||||
return ret;
|
||||
}
|
||||
ret = wine_get_sortkey(flags, src, srclen, (BYTE *)dst, dstlen);
|
||||
if (ret == 0)
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
else
|
||||
ret++;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* SORT_STRINGSORT must be used exclusively with LCMAP_SORTKEY */
|
||||
if (flags & SORT_STRINGSORT)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return 0;
|
||||
}
|
||||
/* SORT_STRINGSORT must be used exclusively with LCMAP_SORTKEY */
|
||||
if (flags & SORT_STRINGSORT)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (srclen < 0) srclen = strlenW(src) + 1;
|
||||
if (srclen < 0) srclen = strlenW(src) + 1;
|
||||
|
||||
TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n",
|
||||
lcid, flags, debugstr_wn(src, srclen), srclen, dst, dstlen);
|
||||
TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n",
|
||||
lcid, flags, debugstr_wn(src, srclen), srclen, dst, dstlen);
|
||||
|
||||
if (!dst) /* return required string length */
|
||||
{
|
||||
INT len;
|
||||
if (!dst) /* return required string length */
|
||||
{
|
||||
INT len;
|
||||
|
||||
for (len = 0; srclen; src++, srclen--)
|
||||
{
|
||||
WCHAR wch = *src;
|
||||
/* tests show that win2k just ignores NORM_IGNORENONSPACE,
|
||||
* and skips white space and punctuation characters for
|
||||
* NORM_IGNORESYMBOLS.
|
||||
*/
|
||||
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
|
||||
continue;
|
||||
len++;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
for (len = 0; srclen; src++, srclen--)
|
||||
{
|
||||
WCHAR wch = *src;
|
||||
/* tests show that win2k just ignores NORM_IGNORENONSPACE,
|
||||
* and skips white space and punctuation characters for
|
||||
* NORM_IGNORESYMBOLS.
|
||||
*/
|
||||
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
|
||||
continue;
|
||||
len++;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
if (flags & LCMAP_UPPERCASE)
|
||||
{
|
||||
for (dst_ptr = dst; srclen && dstlen; src++, srclen--)
|
||||
{
|
||||
WCHAR wch = *src;
|
||||
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
|
||||
continue;
|
||||
*dst_ptr++ = toupperW(wch);
|
||||
dstlen--;
|
||||
}
|
||||
}
|
||||
else if (flags & LCMAP_LOWERCASE)
|
||||
{
|
||||
for (dst_ptr = dst; srclen && dstlen; src++, srclen--)
|
||||
{
|
||||
WCHAR wch = *src;
|
||||
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
|
||||
continue;
|
||||
*dst_ptr++ = tolowerW(wch);
|
||||
dstlen--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (src == dst)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return 0;
|
||||
}
|
||||
for (dst_ptr = dst; srclen && dstlen; src++, srclen--)
|
||||
{
|
||||
WCHAR wch = *src;
|
||||
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
|
||||
continue;
|
||||
*dst_ptr++ = wch;
|
||||
dstlen--;
|
||||
}
|
||||
}
|
||||
if (flags & LCMAP_UPPERCASE)
|
||||
{
|
||||
for (dst_ptr = dst; srclen && dstlen; src++, srclen--)
|
||||
{
|
||||
WCHAR wch = *src;
|
||||
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
|
||||
continue;
|
||||
*dst_ptr++ = toupperW(wch);
|
||||
dstlen--;
|
||||
}
|
||||
}
|
||||
else if (flags & LCMAP_LOWERCASE)
|
||||
{
|
||||
for (dst_ptr = dst; srclen && dstlen; src++, srclen--)
|
||||
{
|
||||
WCHAR wch = *src;
|
||||
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
|
||||
continue;
|
||||
*dst_ptr++ = tolowerW(wch);
|
||||
dstlen--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (src == dst)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return 0;
|
||||
}
|
||||
for (dst_ptr = dst; srclen && dstlen; src++, srclen--)
|
||||
{
|
||||
WCHAR wch = *src;
|
||||
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
|
||||
continue;
|
||||
*dst_ptr++ = wch;
|
||||
dstlen--;
|
||||
}
|
||||
}
|
||||
|
||||
if (srclen)
|
||||
{
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
return 0;
|
||||
}
|
||||
if (srclen)
|
||||
{
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return dst_ptr - dst;
|
||||
return dst_ptr - dst;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
@ -304,31 +304,31 @@ INT WINAPI LCMapStringW_new(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
|
||||
INT WINAPI FoldStringW_new(DWORD dwFlags, LPCWSTR src, INT srclen,
|
||||
LPWSTR dst, INT dstlen)
|
||||
{
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
switch (dwFlags & (MAP_COMPOSITE|MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES))
|
||||
{
|
||||
case 0:
|
||||
if (dwFlags)
|
||||
break;
|
||||
/* Fall through for dwFlags == 0 */
|
||||
case MAP_PRECOMPOSED|MAP_COMPOSITE:
|
||||
case MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES:
|
||||
case MAP_COMPOSITE|MAP_EXPAND_LIGATURES:
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return 0;
|
||||
}
|
||||
switch (dwFlags & (MAP_COMPOSITE|MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES))
|
||||
{
|
||||
case 0:
|
||||
if (dwFlags)
|
||||
break;
|
||||
/* Fall through for dwFlags == 0 */
|
||||
case MAP_PRECOMPOSED|MAP_COMPOSITE:
|
||||
case MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES:
|
||||
case MAP_COMPOSITE|MAP_EXPAND_LIGATURES:
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = wine_fold_string(dwFlags, src, srclen, dst, dstlen);
|
||||
if (!ret)
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
return ret;
|
||||
ret = wine_fold_string(dwFlags, src, srclen, dst, dstlen);
|
||||
if (!ret)
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
@ -353,54 +353,54 @@ INT WINAPI FoldStringW_new(DWORD dwFlags, LPCWSTR src, INT srclen,
|
||||
INT WINAPI FoldStringA_new(DWORD dwFlags, LPCSTR src, INT srclen,
|
||||
LPSTR dst, INT dstlen)
|
||||
{
|
||||
INT ret = 0, srclenW = 0;
|
||||
WCHAR *srcW = NULL, *dstW = NULL;
|
||||
INT ret = 0, srclenW = 0;
|
||||
WCHAR *srcW = NULL, *dstW = NULL;
|
||||
|
||||
if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
srclenW = MultiByteToWideChar(CP_ACP, dwFlags & MAP_COMPOSITE ? MB_COMPOSITE : 0,
|
||||
src, srclen, NULL, 0);
|
||||
srcW = (WCHAR*) HeapAlloc(GetProcessHeap(), 0, srclenW * sizeof(WCHAR));
|
||||
srclenW = MultiByteToWideChar(CP_ACP, dwFlags & MAP_COMPOSITE ? MB_COMPOSITE : 0,
|
||||
src, srclen, NULL, 0);
|
||||
srcW = (WCHAR*) HeapAlloc(GetProcessHeap(), 0, srclenW * sizeof(WCHAR));
|
||||
|
||||
if (!srcW)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
goto FoldStringA_exit;
|
||||
}
|
||||
if (!srcW)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
goto FoldStringA_exit;
|
||||
}
|
||||
|
||||
MultiByteToWideChar(CP_ACP, dwFlags & MAP_COMPOSITE ? MB_COMPOSITE : 0,
|
||||
src, srclen, srcW, srclenW);
|
||||
MultiByteToWideChar(CP_ACP, dwFlags & MAP_COMPOSITE ? MB_COMPOSITE : 0,
|
||||
src, srclen, srcW, srclenW);
|
||||
|
||||
dwFlags = (dwFlags & ~MAP_PRECOMPOSED) | MAP_FOLDCZONE;
|
||||
dwFlags = (dwFlags & ~MAP_PRECOMPOSED) | MAP_FOLDCZONE;
|
||||
|
||||
ret = FoldStringW_new(dwFlags, srcW, srclenW, NULL, 0);
|
||||
if (ret && dstlen)
|
||||
{
|
||||
dstW = (WCHAR*) HeapAlloc(GetProcessHeap(), 0, ret * sizeof(WCHAR));
|
||||
ret = FoldStringW_new(dwFlags, srcW, srclenW, NULL, 0);
|
||||
if (ret && dstlen)
|
||||
{
|
||||
dstW = (WCHAR*) HeapAlloc(GetProcessHeap(), 0, ret * sizeof(WCHAR));
|
||||
|
||||
if (!dstW)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
goto FoldStringA_exit;
|
||||
}
|
||||
if (!dstW)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
goto FoldStringA_exit;
|
||||
}
|
||||
|
||||
ret = FoldStringW_new(dwFlags, srcW, srclenW, dstW, ret);
|
||||
if (!WideCharToMultiByte(CP_ACP, 0, dstW, ret, dst, dstlen, NULL, NULL))
|
||||
{
|
||||
ret = 0;
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
}
|
||||
}
|
||||
ret = FoldStringW_new(dwFlags, srcW, srclenW, dstW, ret);
|
||||
if (!WideCharToMultiByte(CP_ACP, 0, dstW, ret, dst, dstlen, NULL, NULL))
|
||||
{
|
||||
ret = 0;
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
}
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, dstW);
|
||||
HeapFree(GetProcessHeap(), 0, dstW);
|
||||
|
||||
FoldStringA_exit:
|
||||
HeapFree(GetProcessHeap(), 0, srcW);
|
||||
return ret;
|
||||
HeapFree(GetProcessHeap(), 0, srcW);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
@ -411,16 +411,16 @@ FoldStringA_exit:
|
||||
/* MAKE_EXPORT lstrcmpW_new=lstrcmpW */
|
||||
int WINAPI lstrcmpW_new(LPCWSTR str1, LPCWSTR str2)
|
||||
{
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
if ((str1 == NULL) && (str2 == NULL)) return 0;
|
||||
if (str1 == NULL) return -1;
|
||||
if (str2 == NULL) return 1;
|
||||
if ((str1 == NULL) && (str2 == NULL)) return 0;
|
||||
if (str1 == NULL) return -1;
|
||||
if (str2 == NULL) return 1;
|
||||
|
||||
ret = CompareStringW_new(GetThreadLocale(), 0, str1, -1, str2, -1);
|
||||
if (ret) ret -= 2;
|
||||
ret = CompareStringW_new(GetThreadLocale(), 0, str1, -1, str2, -1);
|
||||
if (ret) ret -= 2;
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
@ -431,15 +431,14 @@ int WINAPI lstrcmpW_new(LPCWSTR str1, LPCWSTR str2)
|
||||
/* MAKE_EXPORT lstrcmpiW_new=lstrcmpiW */
|
||||
int WINAPI lstrcmpiW_new(LPCWSTR str1, LPCWSTR str2)
|
||||
{
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
if ((str1 == NULL) && (str2 == NULL)) return 0;
|
||||
if (str1 == NULL) return -1;
|
||||
if (str2 == NULL) return 1;
|
||||
if ((str1 == NULL) && (str2 == NULL)) return 0;
|
||||
if (str1 == NULL) return -1;
|
||||
if (str2 == NULL) return 1;
|
||||
|
||||
ret = CompareStringW_new(GetThreadLocale(), NORM_IGNORECASE, str1, -1, str2, -1);
|
||||
if (ret) ret -= 2;
|
||||
ret = CompareStringW_new(GetThreadLocale(), NORM_IGNORECASE, str1, -1, str2, -1);
|
||||
if (ret) ret -= 2;
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -22,177 +22,177 @@
|
||||
|
||||
static inline WCHAR to_unicode_digit( WCHAR ch )
|
||||
{
|
||||
extern const WCHAR wine_digitmap[];
|
||||
return ch + wine_digitmap[wine_digitmap[ch >> 8] + (ch & 0xff)];
|
||||
extern const WCHAR wine_digitmap[];
|
||||
return ch + wine_digitmap[wine_digitmap[ch >> 8] + (ch & 0xff)];
|
||||
}
|
||||
|
||||
static inline WCHAR to_unicode_native( WCHAR ch )
|
||||
{
|
||||
extern const WCHAR wine_compatmap[];
|
||||
return ch + wine_compatmap[wine_compatmap[ch >> 8] + (ch & 0xff)];
|
||||
extern const WCHAR wine_compatmap[];
|
||||
return ch + wine_compatmap[wine_compatmap[ch >> 8] + (ch & 0xff)];
|
||||
}
|
||||
|
||||
static const WCHAR wine_ligatures[] =
|
||||
{
|
||||
0x00c6, 0x00de, 0x00df, 0x00e6, 0x00fe, 0x0132, 0x0133, 0x0152,
|
||||
0x0153, 0x01c4, 0x01c5, 0x01c6, 0x01c7, 0x01c8, 0x01c9, 0x01ca,
|
||||
0x01cb, 0x01cc, 0x01e2, 0x01e3, 0x01f1, 0x01f2, 0x01f3, 0x01fc,
|
||||
0x01fd, 0x05f0, 0x05f1, 0x05f2, 0xfb00, 0xfb01, 0xfb02, 0xfb03,
|
||||
0xfb04, 0xfb05, 0xfb06
|
||||
0x00c6, 0x00de, 0x00df, 0x00e6, 0x00fe, 0x0132, 0x0133, 0x0152,
|
||||
0x0153, 0x01c4, 0x01c5, 0x01c6, 0x01c7, 0x01c8, 0x01c9, 0x01ca,
|
||||
0x01cb, 0x01cc, 0x01e2, 0x01e3, 0x01f1, 0x01f2, 0x01f3, 0x01fc,
|
||||
0x01fd, 0x05f0, 0x05f1, 0x05f2, 0xfb00, 0xfb01, 0xfb02, 0xfb03,
|
||||
0xfb04, 0xfb05, 0xfb06
|
||||
};
|
||||
|
||||
/* Unicode expanded ligatures */
|
||||
static const WCHAR wine_expanded_ligatures[][4] =
|
||||
{
|
||||
{ 'A','E','\0',1 },
|
||||
{ 'T','H','\0',1 },
|
||||
{ 's','s','\0',1 },
|
||||
{ 'a','e','\0',1 },
|
||||
{ 't','h','\0',1 },
|
||||
{ 'I','J','\0',1 },
|
||||
{ 'i','j','\0',1 },
|
||||
{ 'O','E','\0',1 },
|
||||
{ 'o','e','\0',1 },
|
||||
{ 'D',0x017d,'\0',1 },
|
||||
{ 'D',0x017e,'\0',1 },
|
||||
{ 'd',0x017e,'\0',1 },
|
||||
{ 'L','J','\0',1 },
|
||||
{ 'L','j','\0',1 },
|
||||
{ 'l','j','\0',1 },
|
||||
{ 'N','J','\0',1 },
|
||||
{ 'N','j','\0',1 },
|
||||
{ 'n','j','\0',1 },
|
||||
{ 0x0100,0x0112,'\0',1 },
|
||||
{ 0x0101,0x0113,'\0',1 },
|
||||
{ 'D','Z','\0',1 },
|
||||
{ 'D','z','\0',1 },
|
||||
{ 'd','z','\0',1 },
|
||||
{ 0x00c1,0x00c9,'\0',1 },
|
||||
{ 0x00e1,0x00e9,'\0',1 },
|
||||
{ 0x05d5,0x05d5,'\0',1 },
|
||||
{ 0x05d5,0x05d9,'\0',1 },
|
||||
{ 0x05d9,0x05d9,'\0',1 },
|
||||
{ 'f','f','\0',1 },
|
||||
{ 'f','i','\0',1 },
|
||||
{ 'f','l','\0',1 },
|
||||
{ 'f','f','i',2 },
|
||||
{ 'f','f','l',2 },
|
||||
{ 0x017f,'t','\0',1 },
|
||||
{ 's','t','\0',1 }
|
||||
{ 'A','E','\0',1 },
|
||||
{ 'T','H','\0',1 },
|
||||
{ 's','s','\0',1 },
|
||||
{ 'a','e','\0',1 },
|
||||
{ 't','h','\0',1 },
|
||||
{ 'I','J','\0',1 },
|
||||
{ 'i','j','\0',1 },
|
||||
{ 'O','E','\0',1 },
|
||||
{ 'o','e','\0',1 },
|
||||
{ 'D',0x017d,'\0',1 },
|
||||
{ 'D',0x017e,'\0',1 },
|
||||
{ 'd',0x017e,'\0',1 },
|
||||
{ 'L','J','\0',1 },
|
||||
{ 'L','j','\0',1 },
|
||||
{ 'l','j','\0',1 },
|
||||
{ 'N','J','\0',1 },
|
||||
{ 'N','j','\0',1 },
|
||||
{ 'n','j','\0',1 },
|
||||
{ 0x0100,0x0112,'\0',1 },
|
||||
{ 0x0101,0x0113,'\0',1 },
|
||||
{ 'D','Z','\0',1 },
|
||||
{ 'D','z','\0',1 },
|
||||
{ 'd','z','\0',1 },
|
||||
{ 0x00c1,0x00c9,'\0',1 },
|
||||
{ 0x00e1,0x00e9,'\0',1 },
|
||||
{ 0x05d5,0x05d5,'\0',1 },
|
||||
{ 0x05d5,0x05d9,'\0',1 },
|
||||
{ 0x05d9,0x05d9,'\0',1 },
|
||||
{ 'f','f','\0',1 },
|
||||
{ 'f','i','\0',1 },
|
||||
{ 'f','l','\0',1 },
|
||||
{ 'f','f','i',2 },
|
||||
{ 'f','f','l',2 },
|
||||
{ 0x017f,'t','\0',1 },
|
||||
{ 's','t','\0',1 }
|
||||
};
|
||||
|
||||
static inline int get_ligature_len( WCHAR wc )
|
||||
{
|
||||
int low = 0, high = sizeof(wine_ligatures)/sizeof(WCHAR) -1;
|
||||
while (low <= high)
|
||||
{
|
||||
int pos = (low + high) / 2;
|
||||
if (wine_ligatures[pos] < wc)
|
||||
low = pos + 1;
|
||||
else if (wine_ligatures[pos] > wc)
|
||||
high = pos - 1;
|
||||
else
|
||||
return wine_expanded_ligatures[pos][3];
|
||||
}
|
||||
return 0;
|
||||
int low = 0, high = sizeof(wine_ligatures)/sizeof(WCHAR) -1;
|
||||
while (low <= high)
|
||||
{
|
||||
int pos = (low + high) / 2;
|
||||
if (wine_ligatures[pos] < wc)
|
||||
low = pos + 1;
|
||||
else if (wine_ligatures[pos] > wc)
|
||||
high = pos - 1;
|
||||
else
|
||||
return wine_expanded_ligatures[pos][3];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline const WCHAR* get_ligature( WCHAR wc )
|
||||
{
|
||||
static const WCHAR empty_ligature[] = { '\0','\0','\0', 0 };
|
||||
int low = 0, high = sizeof(wine_ligatures)/sizeof(WCHAR) -1;
|
||||
while (low <= high)
|
||||
{
|
||||
int pos = (low + high) / 2;
|
||||
if (wine_ligatures[pos] < wc)
|
||||
low = pos + 1;
|
||||
else if (wine_ligatures[pos] > wc)
|
||||
high = pos - 1;
|
||||
else
|
||||
return wine_expanded_ligatures[pos];
|
||||
}
|
||||
return empty_ligature;
|
||||
static const WCHAR empty_ligature[] = { '\0','\0','\0', 0 };
|
||||
int low = 0, high = sizeof(wine_ligatures)/sizeof(WCHAR) -1;
|
||||
while (low <= high)
|
||||
{
|
||||
int pos = (low + high) / 2;
|
||||
if (wine_ligatures[pos] < wc)
|
||||
low = pos + 1;
|
||||
else if (wine_ligatures[pos] > wc)
|
||||
high = pos - 1;
|
||||
else
|
||||
return wine_expanded_ligatures[pos];
|
||||
}
|
||||
return empty_ligature;
|
||||
}
|
||||
|
||||
/* fold a unicode string */
|
||||
int wine_fold_string( int flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen )
|
||||
{
|
||||
WCHAR *dstbase = dst;
|
||||
const WCHAR *expand;
|
||||
int i;
|
||||
WCHAR *dstbase = dst;
|
||||
const WCHAR *expand;
|
||||
int i;
|
||||
|
||||
if (srclen == -1)
|
||||
srclen = strlenW(src) + 1; /* Include terminating NUL in count */
|
||||
if (srclen == -1)
|
||||
srclen = strlenW(src) + 1; /* Include terminating NUL in count */
|
||||
|
||||
if (!dstlen)
|
||||
{
|
||||
/* Calculate the required size for dst */
|
||||
dstlen = srclen;
|
||||
if (!dstlen)
|
||||
{
|
||||
/* Calculate the required size for dst */
|
||||
dstlen = srclen;
|
||||
|
||||
if (flags & MAP_EXPAND_LIGATURES)
|
||||
{
|
||||
while (srclen--)
|
||||
{
|
||||
dstlen += get_ligature_len(*src);
|
||||
src++;
|
||||
}
|
||||
}
|
||||
else if (flags & MAP_COMPOSITE)
|
||||
{
|
||||
/* FIXME */
|
||||
}
|
||||
else if (flags & MAP_PRECOMPOSED)
|
||||
{
|
||||
/* FIXME */
|
||||
}
|
||||
return dstlen;
|
||||
}
|
||||
if (flags & MAP_EXPAND_LIGATURES)
|
||||
{
|
||||
while (srclen--)
|
||||
{
|
||||
dstlen += get_ligature_len(*src);
|
||||
src++;
|
||||
}
|
||||
}
|
||||
else if (flags & MAP_COMPOSITE)
|
||||
{
|
||||
/* FIXME */
|
||||
}
|
||||
else if (flags & MAP_PRECOMPOSED)
|
||||
{
|
||||
/* FIXME */
|
||||
}
|
||||
return dstlen;
|
||||
}
|
||||
|
||||
if (srclen > dstlen)
|
||||
return 0;
|
||||
if (srclen > dstlen)
|
||||
return 0;
|
||||
|
||||
dstlen -= srclen;
|
||||
dstlen -= srclen;
|
||||
|
||||
/* Actually perform the mapping(s) specified */
|
||||
for (i = 0; i < srclen; i++)
|
||||
{
|
||||
WCHAR ch = *src;
|
||||
/* Actually perform the mapping(s) specified */
|
||||
for (i = 0; i < srclen; i++)
|
||||
{
|
||||
WCHAR ch = *src;
|
||||
|
||||
if (flags & MAP_EXPAND_LIGATURES)
|
||||
{
|
||||
expand = get_ligature(ch);
|
||||
if (expand[0])
|
||||
{
|
||||
if (!dstlen--)
|
||||
return 0;
|
||||
dst[0] = expand[0];
|
||||
if (expand[2])
|
||||
{
|
||||
if (!dstlen--)
|
||||
return 0;
|
||||
*++dst = expand[1];
|
||||
ch = expand[2];
|
||||
}
|
||||
else
|
||||
ch = expand[1];
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
else if (flags & MAP_COMPOSITE)
|
||||
{
|
||||
/* FIXME */
|
||||
}
|
||||
else if (flags & MAP_PRECOMPOSED)
|
||||
{
|
||||
/* FIXME */
|
||||
}
|
||||
if (flags & MAP_FOLDDIGITS)
|
||||
ch = to_unicode_digit(ch);
|
||||
if (flags & MAP_FOLDCZONE)
|
||||
ch = to_unicode_native(ch);
|
||||
if (flags & MAP_EXPAND_LIGATURES)
|
||||
{
|
||||
expand = get_ligature(ch);
|
||||
if (expand[0])
|
||||
{
|
||||
if (!dstlen--)
|
||||
return 0;
|
||||
dst[0] = expand[0];
|
||||
if (expand[2])
|
||||
{
|
||||
if (!dstlen--)
|
||||
return 0;
|
||||
*++dst = expand[1];
|
||||
ch = expand[2];
|
||||
}
|
||||
else
|
||||
ch = expand[1];
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
else if (flags & MAP_COMPOSITE)
|
||||
{
|
||||
/* FIXME */
|
||||
}
|
||||
else if (flags & MAP_PRECOMPOSED)
|
||||
{
|
||||
/* FIXME */
|
||||
}
|
||||
if (flags & MAP_FOLDDIGITS)
|
||||
ch = to_unicode_digit(ch);
|
||||
if (flags & MAP_FOLDCZONE)
|
||||
ch = to_unicode_native(ch);
|
||||
|
||||
*dst++ = ch;
|
||||
src++;
|
||||
}
|
||||
return dst - dstbase;
|
||||
*dst++ = ch;
|
||||
src++;
|
||||
}
|
||||
return dst - dstbase;
|
||||
}
|
||||
|
@ -29,322 +29,322 @@ extern const unsigned int collation_table[];
|
||||
*/
|
||||
int wine_get_sortkey(int flags, const WCHAR *src, int srclen, BYTE *dst, int dstlen)
|
||||
{
|
||||
WCHAR dummy[4]; /* no decomposition is larger than 4 chars */
|
||||
int key_len[4];
|
||||
BYTE *key_ptr[4];
|
||||
const WCHAR *src_save = src;
|
||||
int srclen_save = srclen;
|
||||
WCHAR dummy[4]; /* no decomposition is larger than 4 chars */
|
||||
int key_len[4];
|
||||
BYTE *key_ptr[4];
|
||||
const WCHAR *src_save = src;
|
||||
int srclen_save = srclen;
|
||||
|
||||
key_len[0] = key_len[1] = key_len[2] = key_len[3] = 0;
|
||||
for (; srclen; srclen--, src++)
|
||||
{
|
||||
int decomposed_len = 1;/*get_decomposition(*src, dummy, 4);*/
|
||||
dummy[0] = *src;
|
||||
if (decomposed_len)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < decomposed_len; i++)
|
||||
{
|
||||
WCHAR wch = dummy[i];
|
||||
unsigned int ce;
|
||||
key_len[0] = key_len[1] = key_len[2] = key_len[3] = 0;
|
||||
for (; srclen; srclen--, src++)
|
||||
{
|
||||
int decomposed_len = 1;/*get_decomposition(*src, dummy, 4);*/
|
||||
dummy[0] = *src;
|
||||
if (decomposed_len)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < decomposed_len; i++)
|
||||
{
|
||||
WCHAR wch = dummy[i];
|
||||
unsigned int ce;
|
||||
|
||||
/* tests show that win2k just ignores NORM_IGNORENONSPACE,
|
||||
* and skips white space and punctuation characters for
|
||||
* NORM_IGNORESYMBOLS.
|
||||
*/
|
||||
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
|
||||
continue;
|
||||
/* tests show that win2k just ignores NORM_IGNORENONSPACE,
|
||||
* and skips white space and punctuation characters for
|
||||
* NORM_IGNORESYMBOLS.
|
||||
*/
|
||||
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
|
||||
continue;
|
||||
|
||||
if (flags & NORM_IGNORECASE) wch = tolowerW(wch);
|
||||
if (flags & NORM_IGNORECASE) wch = tolowerW(wch);
|
||||
|
||||
ce = collation_table[collation_table[wch >> 8] + (wch & 0xff)];
|
||||
if (ce != (unsigned int)-1)
|
||||
{
|
||||
if (ce >> 16) key_len[0] += 2;
|
||||
if ((ce >> 8) & 0xff) key_len[1]++;
|
||||
if ((ce >> 4) & 0x0f) key_len[2]++;
|
||||
if (ce & 1)
|
||||
{
|
||||
if (wch >> 8) key_len[3]++;
|
||||
key_len[3]++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
key_len[0] += 2;
|
||||
if (wch >> 8) key_len[0]++;
|
||||
if (wch & 0xff) key_len[0]++;
|
||||
ce = collation_table[collation_table[wch >> 8] + (wch & 0xff)];
|
||||
if (ce != (unsigned int)-1)
|
||||
{
|
||||
if (ce >> 16) key_len[0] += 2;
|
||||
if ((ce >> 8) & 0xff) key_len[1]++;
|
||||
if ((ce >> 4) & 0x0f) key_len[2]++;
|
||||
if (ce & 1)
|
||||
{
|
||||
if (wch >> 8) key_len[3]++;
|
||||
key_len[3]++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
key_len[0] += 2;
|
||||
if (wch >> 8) key_len[0]++;
|
||||
if (wch & 0xff) key_len[0]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!dstlen) /* compute length */
|
||||
/* 4 * '\1' + 1 * '\0' + key length */
|
||||
return key_len[0] + key_len[1] + key_len[2] + key_len[3] + 4 + 1;
|
||||
if (!dstlen) /* compute length */
|
||||
/* 4 * '\1' + 1 * '\0' + key length */
|
||||
return key_len[0] + key_len[1] + key_len[2] + key_len[3] + 4 + 1;
|
||||
|
||||
if (dstlen < key_len[0] + key_len[1] + key_len[2] + key_len[3] + 4 + 1)
|
||||
return 0; /* overflow */
|
||||
if (dstlen < key_len[0] + key_len[1] + key_len[2] + key_len[3] + 4 + 1)
|
||||
return 0; /* overflow */
|
||||
|
||||
src = src_save;
|
||||
srclen = srclen_save;
|
||||
src = src_save;
|
||||
srclen = srclen_save;
|
||||
|
||||
key_ptr[0] = dst;
|
||||
key_ptr[1] = key_ptr[0] + key_len[0] + 1;
|
||||
key_ptr[2] = key_ptr[1] + key_len[1] + 1;
|
||||
key_ptr[3] = key_ptr[2] + key_len[2] + 1;
|
||||
key_ptr[0] = dst;
|
||||
key_ptr[1] = key_ptr[0] + key_len[0] + 1;
|
||||
key_ptr[2] = key_ptr[1] + key_len[1] + 1;
|
||||
key_ptr[3] = key_ptr[2] + key_len[2] + 1;
|
||||
|
||||
for (; srclen; srclen--, src++)
|
||||
{
|
||||
int decomposed_len = 1;/*get_decomposition(*src, dummy, 4);*/
|
||||
dummy[0] = *src;
|
||||
if (decomposed_len)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < decomposed_len; i++)
|
||||
{
|
||||
WCHAR wch = dummy[i];
|
||||
unsigned int ce;
|
||||
for (; srclen; srclen--, src++)
|
||||
{
|
||||
int decomposed_len = 1;/*get_decomposition(*src, dummy, 4);*/
|
||||
dummy[0] = *src;
|
||||
if (decomposed_len)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < decomposed_len; i++)
|
||||
{
|
||||
WCHAR wch = dummy[i];
|
||||
unsigned int ce;
|
||||
|
||||
/* tests show that win2k just ignores NORM_IGNORENONSPACE,
|
||||
* and skips white space and punctuation characters for
|
||||
* NORM_IGNORESYMBOLS.
|
||||
*/
|
||||
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
|
||||
continue;
|
||||
/* tests show that win2k just ignores NORM_IGNORENONSPACE,
|
||||
* and skips white space and punctuation characters for
|
||||
* NORM_IGNORESYMBOLS.
|
||||
*/
|
||||
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
|
||||
continue;
|
||||
|
||||
if (flags & NORM_IGNORECASE) wch = tolowerW(wch);
|
||||
if (flags & NORM_IGNORECASE) wch = tolowerW(wch);
|
||||
|
||||
ce = collation_table[collation_table[wch >> 8] + (wch & 0xff)];
|
||||
if (ce != (unsigned int)-1)
|
||||
{
|
||||
WCHAR key;
|
||||
if ((key = ce >> 16))
|
||||
{
|
||||
*key_ptr[0]++ = key >> 8;
|
||||
*key_ptr[0]++ = key & 0xff;
|
||||
}
|
||||
/* make key 1 start from 2 */
|
||||
if ((key = (ce >> 8) & 0xff)) *key_ptr[1]++ = key + 1;
|
||||
/* make key 2 start from 2 */
|
||||
if ((key = (ce >> 4) & 0x0f)) *key_ptr[2]++ = key + 1;
|
||||
/* key 3 is always a character code */
|
||||
if (ce & 1)
|
||||
{
|
||||
if (wch >> 8) *key_ptr[3]++ = wch >> 8;
|
||||
if (wch & 0xff) *key_ptr[3]++ = wch & 0xff;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*key_ptr[0]++ = 0xff;
|
||||
*key_ptr[0]++ = 0xfe;
|
||||
if (wch >> 8) *key_ptr[0]++ = wch >> 8;
|
||||
if (wch & 0xff) *key_ptr[0]++ = wch & 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ce = collation_table[collation_table[wch >> 8] + (wch & 0xff)];
|
||||
if (ce != (unsigned int)-1)
|
||||
{
|
||||
WCHAR key;
|
||||
if ((key = ce >> 16))
|
||||
{
|
||||
*key_ptr[0]++ = key >> 8;
|
||||
*key_ptr[0]++ = key & 0xff;
|
||||
}
|
||||
/* make key 1 start from 2 */
|
||||
if ((key = (ce >> 8) & 0xff)) *key_ptr[1]++ = key + 1;
|
||||
/* make key 2 start from 2 */
|
||||
if ((key = (ce >> 4) & 0x0f)) *key_ptr[2]++ = key + 1;
|
||||
/* key 3 is always a character code */
|
||||
if (ce & 1)
|
||||
{
|
||||
if (wch >> 8) *key_ptr[3]++ = wch >> 8;
|
||||
if (wch & 0xff) *key_ptr[3]++ = wch & 0xff;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*key_ptr[0]++ = 0xff;
|
||||
*key_ptr[0]++ = 0xfe;
|
||||
if (wch >> 8) *key_ptr[0]++ = wch >> 8;
|
||||
if (wch & 0xff) *key_ptr[0]++ = wch & 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*key_ptr[0] = '\1';
|
||||
*key_ptr[1] = '\1';
|
||||
*key_ptr[2] = '\1';
|
||||
*key_ptr[3]++ = '\1';
|
||||
*key_ptr[3] = 0;
|
||||
*key_ptr[0] = '\1';
|
||||
*key_ptr[1] = '\1';
|
||||
*key_ptr[2] = '\1';
|
||||
*key_ptr[3]++ = '\1';
|
||||
*key_ptr[3] = 0;
|
||||
|
||||
return key_ptr[3] - dst;
|
||||
return key_ptr[3] - dst;
|
||||
}
|
||||
|
||||
static inline int compare_unicode_weights(int flags, const WCHAR *str1, int len1,
|
||||
const WCHAR *str2, int len2)
|
||||
const WCHAR *str2, int len2)
|
||||
{
|
||||
unsigned int ce1, ce2;
|
||||
int ret;
|
||||
unsigned int ce1, ce2;
|
||||
int ret;
|
||||
|
||||
/* 32-bit collation element table format:
|
||||
* unicode weight - high 16 bit, diacritic weight - high 8 bit of low 16 bit,
|
||||
* case weight - high 4 bit of low 8 bit.
|
||||
*/
|
||||
while (len1 > 0 && len2 > 0)
|
||||
{
|
||||
if (flags & NORM_IGNORESYMBOLS)
|
||||
{
|
||||
int skip = 0;
|
||||
/* FIXME: not tested */
|
||||
if (get_char_typeW(*str1) & (C1_PUNCT | C1_SPACE))
|
||||
{
|
||||
str1++;
|
||||
len1--;
|
||||
skip = 1;
|
||||
}
|
||||
if (get_char_typeW(*str2) & (C1_PUNCT | C1_SPACE))
|
||||
{
|
||||
str2++;
|
||||
len2--;
|
||||
skip = 1;
|
||||
}
|
||||
if (skip) continue;
|
||||
}
|
||||
/* 32-bit collation element table format:
|
||||
* unicode weight - high 16 bit, diacritic weight - high 8 bit of low 16 bit,
|
||||
* case weight - high 4 bit of low 8 bit.
|
||||
*/
|
||||
while (len1 > 0 && len2 > 0)
|
||||
{
|
||||
if (flags & NORM_IGNORESYMBOLS)
|
||||
{
|
||||
int skip = 0;
|
||||
/* FIXME: not tested */
|
||||
if (get_char_typeW(*str1) & (C1_PUNCT | C1_SPACE))
|
||||
{
|
||||
str1++;
|
||||
len1--;
|
||||
skip = 1;
|
||||
}
|
||||
if (get_char_typeW(*str2) & (C1_PUNCT | C1_SPACE))
|
||||
{
|
||||
str2++;
|
||||
len2--;
|
||||
skip = 1;
|
||||
}
|
||||
if (skip) continue;
|
||||
}
|
||||
|
||||
/* hyphen and apostrophe are treated differently depending on
|
||||
* whether SORT_STRINGSORT specified or not
|
||||
*/
|
||||
if (!(flags & SORT_STRINGSORT))
|
||||
{
|
||||
if (*str1 == '-' || *str1 == '\'')
|
||||
{
|
||||
if (*str2 != '-' && *str2 != '\'')
|
||||
{
|
||||
str1++;
|
||||
len1--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (*str2 == '-' || *str2 == '\'')
|
||||
{
|
||||
str2++;
|
||||
len2--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* hyphen and apostrophe are treated differently depending on
|
||||
* whether SORT_STRINGSORT specified or not
|
||||
*/
|
||||
if (!(flags & SORT_STRINGSORT))
|
||||
{
|
||||
if (*str1 == '-' || *str1 == '\'')
|
||||
{
|
||||
if (*str2 != '-' && *str2 != '\'')
|
||||
{
|
||||
str1++;
|
||||
len1--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (*str2 == '-' || *str2 == '\'')
|
||||
{
|
||||
str2++;
|
||||
len2--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ce1 = collation_table[collation_table[*str1 >> 8] + (*str1 & 0xff)];
|
||||
ce2 = collation_table[collation_table[*str2 >> 8] + (*str2 & 0xff)];
|
||||
ce1 = collation_table[collation_table[*str1 >> 8] + (*str1 & 0xff)];
|
||||
ce2 = collation_table[collation_table[*str2 >> 8] + (*str2 & 0xff)];
|
||||
|
||||
if (ce1 != (unsigned int)-1 && ce2 != (unsigned int)-1)
|
||||
ret = (ce1 >> 16) - (ce2 >> 16);
|
||||
else
|
||||
ret = *str1 - *str2;
|
||||
if (ce1 != (unsigned int)-1 && ce2 != (unsigned int)-1)
|
||||
ret = (ce1 >> 16) - (ce2 >> 16);
|
||||
else
|
||||
ret = *str1 - *str2;
|
||||
|
||||
if (ret) return ret;
|
||||
if (ret) return ret;
|
||||
|
||||
str1++;
|
||||
str2++;
|
||||
len1--;
|
||||
len2--;
|
||||
}
|
||||
return len1 - len2;
|
||||
str1++;
|
||||
str2++;
|
||||
len1--;
|
||||
len2--;
|
||||
}
|
||||
return len1 - len2;
|
||||
}
|
||||
|
||||
static inline int compare_diacritic_weights(int flags, const WCHAR *str1, int len1,
|
||||
const WCHAR *str2, int len2)
|
||||
const WCHAR *str2, int len2)
|
||||
{
|
||||
unsigned int ce1, ce2;
|
||||
int ret;
|
||||
unsigned int ce1, ce2;
|
||||
int ret;
|
||||
|
||||
/* 32-bit collation element table format:
|
||||
* unicode weight - high 16 bit, diacritic weight - high 8 bit of low 16 bit,
|
||||
* case weight - high 4 bit of low 8 bit.
|
||||
*/
|
||||
while (len1 > 0 && len2 > 0)
|
||||
{
|
||||
if (flags & NORM_IGNORESYMBOLS)
|
||||
{
|
||||
int skip = 0;
|
||||
/* FIXME: not tested */
|
||||
if (get_char_typeW(*str1) & (C1_PUNCT | C1_SPACE))
|
||||
{
|
||||
str1++;
|
||||
len1--;
|
||||
skip = 1;
|
||||
}
|
||||
if (get_char_typeW(*str2) & (C1_PUNCT | C1_SPACE))
|
||||
{
|
||||
str2++;
|
||||
len2--;
|
||||
skip = 1;
|
||||
}
|
||||
if (skip) continue;
|
||||
}
|
||||
/* 32-bit collation element table format:
|
||||
* unicode weight - high 16 bit, diacritic weight - high 8 bit of low 16 bit,
|
||||
* case weight - high 4 bit of low 8 bit.
|
||||
*/
|
||||
while (len1 > 0 && len2 > 0)
|
||||
{
|
||||
if (flags & NORM_IGNORESYMBOLS)
|
||||
{
|
||||
int skip = 0;
|
||||
/* FIXME: not tested */
|
||||
if (get_char_typeW(*str1) & (C1_PUNCT | C1_SPACE))
|
||||
{
|
||||
str1++;
|
||||
len1--;
|
||||
skip = 1;
|
||||
}
|
||||
if (get_char_typeW(*str2) & (C1_PUNCT | C1_SPACE))
|
||||
{
|
||||
str2++;
|
||||
len2--;
|
||||
skip = 1;
|
||||
}
|
||||
if (skip) continue;
|
||||
}
|
||||
|
||||
ce1 = collation_table[collation_table[*str1 >> 8] + (*str1 & 0xff)];
|
||||
ce2 = collation_table[collation_table[*str2 >> 8] + (*str2 & 0xff)];
|
||||
ce1 = collation_table[collation_table[*str1 >> 8] + (*str1 & 0xff)];
|
||||
ce2 = collation_table[collation_table[*str2 >> 8] + (*str2 & 0xff)];
|
||||
|
||||
if (ce1 != (unsigned int)-1 && ce2 != (unsigned int)-1)
|
||||
ret = ((ce1 >> 8) & 0xff) - ((ce2 >> 8) & 0xff);
|
||||
else
|
||||
ret = *str1 - *str2;
|
||||
if (ce1 != (unsigned int)-1 && ce2 != (unsigned int)-1)
|
||||
ret = ((ce1 >> 8) & 0xff) - ((ce2 >> 8) & 0xff);
|
||||
else
|
||||
ret = *str1 - *str2;
|
||||
|
||||
if (ret) return ret;
|
||||
if (ret) return ret;
|
||||
|
||||
str1++;
|
||||
str2++;
|
||||
len1--;
|
||||
len2--;
|
||||
}
|
||||
return len1 - len2;
|
||||
str1++;
|
||||
str2++;
|
||||
len1--;
|
||||
len2--;
|
||||
}
|
||||
return len1 - len2;
|
||||
}
|
||||
|
||||
static inline int compare_case_weights(int flags, const WCHAR *str1, int len1,
|
||||
const WCHAR *str2, int len2)
|
||||
const WCHAR *str2, int len2)
|
||||
{
|
||||
unsigned int ce1, ce2;
|
||||
int ret;
|
||||
unsigned int ce1, ce2;
|
||||
int ret;
|
||||
|
||||
/* 32-bit collation element table format:
|
||||
* unicode weight - high 16 bit, diacritic weight - high 8 bit of low 16 bit,
|
||||
* case weight - high 4 bit of low 8 bit.
|
||||
*/
|
||||
while (len1 > 0 && len2 > 0)
|
||||
{
|
||||
if (flags & NORM_IGNORESYMBOLS)
|
||||
{
|
||||
int skip = 0;
|
||||
/* FIXME: not tested */
|
||||
if (get_char_typeW(*str1) & (C1_PUNCT | C1_SPACE))
|
||||
{
|
||||
str1++;
|
||||
len1--;
|
||||
skip = 1;
|
||||
}
|
||||
if (get_char_typeW(*str2) & (C1_PUNCT | C1_SPACE))
|
||||
{
|
||||
str2++;
|
||||
len2--;
|
||||
skip = 1;
|
||||
}
|
||||
if (skip) continue;
|
||||
}
|
||||
/* 32-bit collation element table format:
|
||||
* unicode weight - high 16 bit, diacritic weight - high 8 bit of low 16 bit,
|
||||
* case weight - high 4 bit of low 8 bit.
|
||||
*/
|
||||
while (len1 > 0 && len2 > 0)
|
||||
{
|
||||
if (flags & NORM_IGNORESYMBOLS)
|
||||
{
|
||||
int skip = 0;
|
||||
/* FIXME: not tested */
|
||||
if (get_char_typeW(*str1) & (C1_PUNCT | C1_SPACE))
|
||||
{
|
||||
str1++;
|
||||
len1--;
|
||||
skip = 1;
|
||||
}
|
||||
if (get_char_typeW(*str2) & (C1_PUNCT | C1_SPACE))
|
||||
{
|
||||
str2++;
|
||||
len2--;
|
||||
skip = 1;
|
||||
}
|
||||
if (skip) continue;
|
||||
}
|
||||
|
||||
ce1 = collation_table[collation_table[*str1 >> 8] + (*str1 & 0xff)];
|
||||
ce2 = collation_table[collation_table[*str2 >> 8] + (*str2 & 0xff)];
|
||||
ce1 = collation_table[collation_table[*str1 >> 8] + (*str1 & 0xff)];
|
||||
ce2 = collation_table[collation_table[*str2 >> 8] + (*str2 & 0xff)];
|
||||
|
||||
if (ce1 != (unsigned int)-1 && ce2 != (unsigned int)-1)
|
||||
ret = ((ce1 >> 4) & 0x0f) - ((ce2 >> 4) & 0x0f);
|
||||
else
|
||||
ret = *str1 - *str2;
|
||||
if (ce1 != (unsigned int)-1 && ce2 != (unsigned int)-1)
|
||||
ret = ((ce1 >> 4) & 0x0f) - ((ce2 >> 4) & 0x0f);
|
||||
else
|
||||
ret = *str1 - *str2;
|
||||
|
||||
if (ret) return ret;
|
||||
if (ret) return ret;
|
||||
|
||||
str1++;
|
||||
str2++;
|
||||
len1--;
|
||||
len2--;
|
||||
}
|
||||
return len1 - len2;
|
||||
str1++;
|
||||
str2++;
|
||||
len1--;
|
||||
len2--;
|
||||
}
|
||||
return len1 - len2;
|
||||
}
|
||||
|
||||
static inline int real_length(const WCHAR *str, int len)
|
||||
{
|
||||
while (len && !str[len - 1]) len--;
|
||||
return len;
|
||||
while (len && !str[len - 1]) len--;
|
||||
return len;
|
||||
}
|
||||
|
||||
int wine_compare_string(int flags, const WCHAR *str1, int len1,
|
||||
const WCHAR *str2, int len2)
|
||||
{
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
len1 = real_length(str1, len1);
|
||||
len2 = real_length(str2, len2);
|
||||
len1 = real_length(str1, len1);
|
||||
len2 = real_length(str2, len2);
|
||||
|
||||
ret = compare_unicode_weights(flags, str1, len1, str2, len2);
|
||||
if (!ret)
|
||||
{
|
||||
if (!(flags & NORM_IGNORENONSPACE))
|
||||
ret = compare_diacritic_weights(flags, str1, len1, str2, len2);
|
||||
if (!ret && !(flags & NORM_IGNORECASE))
|
||||
ret = compare_case_weights(flags, str1, len1, str2, len2);
|
||||
}
|
||||
return ret;
|
||||
ret = compare_unicode_weights(flags, str1, len1, str2, len2);
|
||||
if (!ret)
|
||||
{
|
||||
if (!(flags & NORM_IGNORENONSPACE))
|
||||
ret = compare_diacritic_weights(flags, str1, len1, str2, len2);
|
||||
if (!ret && !(flags & NORM_IGNORECASE))
|
||||
ret = compare_case_weights(flags, str1, len1, str2, len2);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -62,37 +62,37 @@ typedef unsigned long ULONG_PTR;
|
||||
/* code page info common to SBCS and DBCS */
|
||||
struct cp_info
|
||||
{
|
||||
unsigned int codepage; /* codepage id */
|
||||
unsigned int char_size; /* char size (1 or 2 bytes) */
|
||||
WCHAR def_char; /* default char value (can be double-byte) */
|
||||
WCHAR def_unicode_char; /* default Unicode char value */
|
||||
const char *name; /* code page name */
|
||||
unsigned int codepage; /* codepage id */
|
||||
unsigned int char_size; /* char size (1 or 2 bytes) */
|
||||
WCHAR def_char; /* default char value (can be double-byte) */
|
||||
WCHAR def_unicode_char; /* default Unicode char value */
|
||||
const char *name; /* code page name */
|
||||
};
|
||||
|
||||
struct sbcs_table
|
||||
{
|
||||
struct cp_info info;
|
||||
const WCHAR *cp2uni; /* code page -> Unicode map */
|
||||
const WCHAR *cp2uni_glyphs; /* code page -> Unicode map with glyph chars */
|
||||
const unsigned char *uni2cp_low; /* Unicode -> code page map */
|
||||
const unsigned short *uni2cp_high;
|
||||
struct cp_info info;
|
||||
const WCHAR *cp2uni; /* code page -> Unicode map */
|
||||
const WCHAR *cp2uni_glyphs; /* code page -> Unicode map with glyph chars */
|
||||
const unsigned char *uni2cp_low; /* Unicode -> code page map */
|
||||
const unsigned short *uni2cp_high;
|
||||
};
|
||||
|
||||
struct dbcs_table
|
||||
{
|
||||
struct cp_info info;
|
||||
const WCHAR *cp2uni; /* code page -> Unicode map */
|
||||
const unsigned char *cp2uni_leadbytes;
|
||||
const unsigned short *uni2cp_low; /* Unicode -> code page map */
|
||||
const unsigned short *uni2cp_high;
|
||||
unsigned char lead_bytes[12]; /* lead bytes ranges */
|
||||
struct cp_info info;
|
||||
const WCHAR *cp2uni; /* code page -> Unicode map */
|
||||
const unsigned char *cp2uni_leadbytes;
|
||||
const unsigned short *uni2cp_low; /* Unicode -> code page map */
|
||||
const unsigned short *uni2cp_high;
|
||||
unsigned char lead_bytes[12]; /* lead bytes ranges */
|
||||
};
|
||||
|
||||
union cptable
|
||||
{
|
||||
struct cp_info info;
|
||||
struct sbcs_table sbcs;
|
||||
struct dbcs_table dbcs;
|
||||
struct cp_info info;
|
||||
struct sbcs_table sbcs;
|
||||
struct dbcs_table dbcs;
|
||||
};
|
||||
|
||||
extern const union cptable *wine_cp_get_table( unsigned int codepage );
|
||||
@ -127,21 +127,21 @@ extern int vsnprintfW( WCHAR *str, size_t len, const WCHAR *format, va_list vali
|
||||
WINE_UNICODE_INLINE int wine_is_dbcs_leadbyte( const union cptable *table, unsigned char ch );
|
||||
WINE_UNICODE_INLINE int wine_is_dbcs_leadbyte( const union cptable *table, unsigned char ch )
|
||||
{
|
||||
return (table->info.char_size == 2) && (table->dbcs.cp2uni_leadbytes[ch]);
|
||||
return (table->info.char_size == 2) && (table->dbcs.cp2uni_leadbytes[ch]);
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE WCHAR tolowerW( WCHAR ch );
|
||||
WINE_UNICODE_INLINE WCHAR tolowerW( WCHAR ch )
|
||||
{
|
||||
extern WINE_UNICODE_API const WCHAR wine_casemap_lower[];
|
||||
return ch + wine_casemap_lower[wine_casemap_lower[ch >> 8] + (ch & 0xff)];
|
||||
extern WINE_UNICODE_API const WCHAR wine_casemap_lower[];
|
||||
return ch + wine_casemap_lower[wine_casemap_lower[ch >> 8] + (ch & 0xff)];
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE WCHAR toupperW( WCHAR ch );
|
||||
WINE_UNICODE_INLINE WCHAR toupperW( WCHAR ch )
|
||||
{
|
||||
extern WINE_UNICODE_API const WCHAR wine_casemap_upper[];
|
||||
return ch + wine_casemap_upper[wine_casemap_upper[ch >> 8] + (ch & 0xff)];
|
||||
extern WINE_UNICODE_API const WCHAR wine_casemap_upper[];
|
||||
return ch + wine_casemap_upper[wine_casemap_upper[ch >> 8] + (ch & 0xff)];
|
||||
}
|
||||
|
||||
/* the character type contains the C1_* flags in the low 12 bits */
|
||||
@ -149,74 +149,74 @@ WINE_UNICODE_INLINE WCHAR toupperW( WCHAR ch )
|
||||
WINE_UNICODE_INLINE unsigned short get_char_typeW( WCHAR ch );
|
||||
WINE_UNICODE_INLINE unsigned short get_char_typeW( WCHAR ch )
|
||||
{
|
||||
extern WINE_UNICODE_API const unsigned short wine_wctype_table[];
|
||||
return wine_wctype_table[wine_wctype_table[ch >> 8] + (ch & 0xff)];
|
||||
extern WINE_UNICODE_API const unsigned short wine_wctype_table[];
|
||||
return wine_wctype_table[wine_wctype_table[ch >> 8] + (ch & 0xff)];
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE int iscntrlW( WCHAR wc );
|
||||
WINE_UNICODE_INLINE int iscntrlW( WCHAR wc )
|
||||
{
|
||||
return get_char_typeW(wc) & C1_CNTRL;
|
||||
return get_char_typeW(wc) & C1_CNTRL;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE int ispunctW( WCHAR wc );
|
||||
WINE_UNICODE_INLINE int ispunctW( WCHAR wc )
|
||||
{
|
||||
return get_char_typeW(wc) & C1_PUNCT;
|
||||
return get_char_typeW(wc) & C1_PUNCT;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE int isspaceW( WCHAR wc );
|
||||
WINE_UNICODE_INLINE int isspaceW( WCHAR wc )
|
||||
{
|
||||
return get_char_typeW(wc) & C1_SPACE;
|
||||
return get_char_typeW(wc) & C1_SPACE;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE int isdigitW( WCHAR wc );
|
||||
WINE_UNICODE_INLINE int isdigitW( WCHAR wc )
|
||||
{
|
||||
return get_char_typeW(wc) & C1_DIGIT;
|
||||
return get_char_typeW(wc) & C1_DIGIT;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE int isxdigitW( WCHAR wc );
|
||||
WINE_UNICODE_INLINE int isxdigitW( WCHAR wc )
|
||||
{
|
||||
return get_char_typeW(wc) & C1_XDIGIT;
|
||||
return get_char_typeW(wc) & C1_XDIGIT;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE int islowerW( WCHAR wc );
|
||||
WINE_UNICODE_INLINE int islowerW( WCHAR wc )
|
||||
{
|
||||
return get_char_typeW(wc) & C1_LOWER;
|
||||
return get_char_typeW(wc) & C1_LOWER;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE int isupperW( WCHAR wc );
|
||||
WINE_UNICODE_INLINE int isupperW( WCHAR wc )
|
||||
{
|
||||
return get_char_typeW(wc) & C1_UPPER;
|
||||
return get_char_typeW(wc) & C1_UPPER;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE int isalnumW( WCHAR wc );
|
||||
WINE_UNICODE_INLINE int isalnumW( WCHAR wc )
|
||||
{
|
||||
return get_char_typeW(wc) & (C1_ALPHA|C1_DIGIT|C1_LOWER|C1_UPPER);
|
||||
return get_char_typeW(wc) & (C1_ALPHA|C1_DIGIT|C1_LOWER|C1_UPPER);
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE int isalphaW( WCHAR wc );
|
||||
WINE_UNICODE_INLINE int isalphaW( WCHAR wc )
|
||||
{
|
||||
return get_char_typeW(wc) & (C1_ALPHA|C1_LOWER|C1_UPPER);
|
||||
return get_char_typeW(wc) & (C1_ALPHA|C1_LOWER|C1_UPPER);
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE int isgraphW( WCHAR wc );
|
||||
WINE_UNICODE_INLINE int isgraphW( WCHAR wc )
|
||||
{
|
||||
return get_char_typeW(wc) & (C1_ALPHA|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
|
||||
return get_char_typeW(wc) & (C1_ALPHA|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE int isprintW( WCHAR wc );
|
||||
WINE_UNICODE_INLINE int isprintW( WCHAR wc )
|
||||
{
|
||||
return get_char_typeW(wc) & (C1_ALPHA|C1_BLANK|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
|
||||
return get_char_typeW(wc) & (C1_ALPHA|C1_BLANK|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
|
||||
}
|
||||
|
||||
/* some useful string manipulation routines */
|
||||
@ -224,17 +224,17 @@ WINE_UNICODE_INLINE int isprintW( WCHAR wc )
|
||||
WINE_UNICODE_INLINE unsigned int strlenW( const WCHAR *str );
|
||||
WINE_UNICODE_INLINE unsigned int strlenW( const WCHAR *str )
|
||||
{
|
||||
const WCHAR *s = str;
|
||||
while (*s) s++;
|
||||
return s - str;
|
||||
const WCHAR *s = str;
|
||||
while (*s) s++;
|
||||
return s - str;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE WCHAR *strcpyW( WCHAR *dst, const WCHAR *src );
|
||||
WINE_UNICODE_INLINE WCHAR *strcpyW( WCHAR *dst, const WCHAR *src )
|
||||
{
|
||||
WCHAR *p = dst;
|
||||
while ((*p++ = *src++));
|
||||
return dst;
|
||||
WCHAR *p = dst;
|
||||
while ((*p++ = *src++));
|
||||
return dst;
|
||||
}
|
||||
|
||||
/* strncpy doesn't do what you think, don't use it */
|
||||
@ -243,106 +243,106 @@ WINE_UNICODE_INLINE WCHAR *strcpyW( WCHAR *dst, const WCHAR *src )
|
||||
WINE_UNICODE_INLINE int strcmpW( const WCHAR *str1, const WCHAR *str2 );
|
||||
WINE_UNICODE_INLINE int strcmpW( const WCHAR *str1, const WCHAR *str2 )
|
||||
{
|
||||
while (*str1 && (*str1 == *str2)) { str1++; str2++; }
|
||||
return *str1 - *str2;
|
||||
while (*str1 && (*str1 == *str2)) { str1++; str2++; }
|
||||
return *str1 - *str2;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE int strncmpW( const WCHAR *str1, const WCHAR *str2, int n );
|
||||
WINE_UNICODE_INLINE int strncmpW( const WCHAR *str1, const WCHAR *str2, int n )
|
||||
{
|
||||
if (n <= 0) return 0;
|
||||
while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; }
|
||||
return *str1 - *str2;
|
||||
if (n <= 0) return 0;
|
||||
while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; }
|
||||
return *str1 - *str2;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE WCHAR *strcatW( WCHAR *dst, const WCHAR *src );
|
||||
WINE_UNICODE_INLINE WCHAR *strcatW( WCHAR *dst, const WCHAR *src )
|
||||
{
|
||||
strcpyW( dst + strlenW(dst), src );
|
||||
return dst;
|
||||
strcpyW( dst + strlenW(dst), src );
|
||||
return dst;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE WCHAR *strchrW( const WCHAR *str, WCHAR ch );
|
||||
WINE_UNICODE_INLINE WCHAR *strchrW( const WCHAR *str, WCHAR ch )
|
||||
{
|
||||
do { if (*str == ch) return (WCHAR *)(ULONG_PTR)str; } while (*str++);
|
||||
return NULL;
|
||||
do { if (*str == ch) return (WCHAR *)(ULONG_PTR)str; } while (*str++);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE WCHAR *strrchrW( const WCHAR *str, WCHAR ch );
|
||||
WINE_UNICODE_INLINE WCHAR *strrchrW( const WCHAR *str, WCHAR ch )
|
||||
{
|
||||
WCHAR *ret = NULL;
|
||||
do { if (*str == ch) ret = (WCHAR *)(ULONG_PTR)str; } while (*str++);
|
||||
return ret;
|
||||
WCHAR *ret = NULL;
|
||||
do { if (*str == ch) ret = (WCHAR *)(ULONG_PTR)str; } while (*str++);
|
||||
return ret;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept );
|
||||
WINE_UNICODE_INLINE WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept )
|
||||
{
|
||||
for ( ; *str; str++) if (strchrW( accept, *str )) return (WCHAR *)(ULONG_PTR)str;
|
||||
return NULL;
|
||||
for ( ; *str; str++) if (strchrW( accept, *str )) return (WCHAR *)(ULONG_PTR)str;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE size_t strspnW( const WCHAR *str, const WCHAR *accept );
|
||||
WINE_UNICODE_INLINE size_t strspnW( const WCHAR *str, const WCHAR *accept )
|
||||
{
|
||||
const WCHAR *ptr;
|
||||
for (ptr = str; *ptr; ptr++) if (!strchrW( accept, *ptr )) break;
|
||||
return ptr - str;
|
||||
const WCHAR *ptr;
|
||||
for (ptr = str; *ptr; ptr++) if (!strchrW( accept, *ptr )) break;
|
||||
return ptr - str;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE size_t strcspnW( const WCHAR *str, const WCHAR *reject );
|
||||
WINE_UNICODE_INLINE size_t strcspnW( const WCHAR *str, const WCHAR *reject )
|
||||
{
|
||||
const WCHAR *ptr;
|
||||
for (ptr = str; *ptr; ptr++) if (strchrW( reject, *ptr )) break;
|
||||
return ptr - str;
|
||||
const WCHAR *ptr;
|
||||
for (ptr = str; *ptr; ptr++) if (strchrW( reject, *ptr )) break;
|
||||
return ptr - str;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE WCHAR *strlwrW( WCHAR *str );
|
||||
WINE_UNICODE_INLINE WCHAR *strlwrW( WCHAR *str )
|
||||
{
|
||||
WCHAR *ret = str;
|
||||
while ((*str = tolowerW(*str))) str++;
|
||||
return ret;
|
||||
WCHAR *ret = str;
|
||||
while ((*str = tolowerW(*str))) str++;
|
||||
return ret;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE WCHAR *struprW( WCHAR *str );
|
||||
WINE_UNICODE_INLINE WCHAR *struprW( WCHAR *str )
|
||||
{
|
||||
WCHAR *ret = str;
|
||||
while ((*str = toupperW(*str))) str++;
|
||||
return ret;
|
||||
WCHAR *ret = str;
|
||||
while ((*str = toupperW(*str))) str++;
|
||||
return ret;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n );
|
||||
WINE_UNICODE_INLINE WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n )
|
||||
{
|
||||
const WCHAR *end;
|
||||
for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) return (WCHAR *)(ULONG_PTR)ptr;
|
||||
return NULL;
|
||||
const WCHAR *end;
|
||||
for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) return (WCHAR *)(ULONG_PTR)ptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE WCHAR *memrchrW( const WCHAR *ptr, WCHAR ch, size_t n );
|
||||
WINE_UNICODE_INLINE WCHAR *memrchrW( const WCHAR *ptr, WCHAR ch, size_t n )
|
||||
{
|
||||
const WCHAR *end;
|
||||
WCHAR *ret = NULL;
|
||||
for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) ret = (WCHAR *)(ULONG_PTR)ptr;
|
||||
return ret;
|
||||
const WCHAR *end;
|
||||
WCHAR *ret = NULL;
|
||||
for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) ret = (WCHAR *)(ULONG_PTR)ptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*WINE_UNICODE_INLINE long int atolW( const WCHAR *str );
|
||||
WINE_UNICODE_INLINE long int atolW( const WCHAR *str )
|
||||
{
|
||||
return strtolW( str, (WCHAR **)0, 10 );
|
||||
return strtolW( str, (WCHAR **)0, 10 );
|
||||
}
|
||||
|
||||
WINE_UNICODE_INLINE int atoiW( const WCHAR *str );
|
||||
WINE_UNICODE_INLINE int atoiW( const WCHAR *str )
|
||||
{
|
||||
return (int)atolW( str );
|
||||
return (int)atolW( str );
|
||||
}*/
|
||||
|
||||
#undef WINE_UNICODE_INLINE
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,17 +25,17 @@ BOOL WINAPI SystemFunction036_new(PVOID pbBuffer, ULONG dwLen);
|
||||
|
||||
static LONG get_pointer_obfuscator(void)
|
||||
{
|
||||
static LONG obfuscator;
|
||||
static LONG obfuscator;
|
||||
|
||||
if (obfuscator == 0)
|
||||
{
|
||||
if (obfuscator == 0)
|
||||
{
|
||||
LONG rand;
|
||||
SystemFunction036_new(&rand, sizeof(rand));
|
||||
rand |= 0xc0000000;
|
||||
InterlockedCompareExchange(&obfuscator, rand, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return obfuscator;
|
||||
return obfuscator;
|
||||
}
|
||||
|
||||
/* FIXME: EncodePointer/DecodePointer should use per-process obfuscator */
|
||||
@ -46,6 +46,6 @@ static LONG get_pointer_obfuscator(void)
|
||||
/* MAKE_EXPORT XorPointer=DecodeSystemPointer */
|
||||
PVOID WINAPI XorPointer(PVOID ptr)
|
||||
{
|
||||
LONG ptrval = (LONG) ptr;
|
||||
return (PVOID)(ptrval ^ get_pointer_obfuscator());
|
||||
LONG ptrval = (LONG) ptr;
|
||||
return (PVOID)(ptrval ^ get_pointer_obfuscator());
|
||||
}
|
||||
|
@ -23,21 +23,21 @@
|
||||
#include "common.h"
|
||||
|
||||
#define LL2FILETIME( ll, pft )\
|
||||
(pft)->dwLowDateTime = (UINT)(ll); \
|
||||
(pft)->dwHighDateTime = (UINT)((ll) >> 32);
|
||||
(pft)->dwLowDateTime = (UINT)(ll); \
|
||||
(pft)->dwHighDateTime = (UINT)((ll) >> 32);
|
||||
#define FILETIME2LL( pft, ll) \
|
||||
ll = (((LONGLONG)((pft)->dwHighDateTime))<<32) + (pft)-> dwLowDateTime ;
|
||||
ll = (((LONGLONG)((pft)->dwHighDateTime))<<32) + (pft)-> dwLowDateTime ;
|
||||
|
||||
|
||||
static const int MonthLengths[2][12] =
|
||||
{
|
||||
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
|
||||
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
|
||||
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
|
||||
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
|
||||
};
|
||||
|
||||
static inline int IsLeapYear(int Year)
|
||||
{
|
||||
return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 1 : 0;
|
||||
return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
@ -58,48 +58,48 @@ static inline int IsLeapYear(int Year)
|
||||
* -2 if an error occurs
|
||||
*/
|
||||
static int TIME_DayLightCompareDate( const SYSTEMTIME *date,
|
||||
const SYSTEMTIME *compareDate )
|
||||
const SYSTEMTIME *compareDate )
|
||||
{
|
||||
int limit_day, dayinsecs;
|
||||
int limit_day, dayinsecs;
|
||||
|
||||
if (date->wMonth < compareDate->wMonth)
|
||||
return -1; /* We are in a month before the date limit. */
|
||||
if (date->wMonth < compareDate->wMonth)
|
||||
return -1; /* We are in a month before the date limit. */
|
||||
|
||||
if (date->wMonth > compareDate->wMonth)
|
||||
return 1; /* We are in a month after the date limit. */
|
||||
if (date->wMonth > compareDate->wMonth)
|
||||
return 1; /* We are in a month after the date limit. */
|
||||
|
||||
/* if year is 0 then date is in day-of-week format, otherwise
|
||||
* it's absolute date.
|
||||
*/
|
||||
if (compareDate->wYear == 0)
|
||||
{
|
||||
WORD First;
|
||||
/* compareDate->wDay is interpreted as number of the week in the month
|
||||
* 5 means: the last week in the month */
|
||||
int weekofmonth = compareDate->wDay;
|
||||
/* calculate the day of the first DayOfWeek in the month */
|
||||
First = ( 6 + compareDate->wDayOfWeek - date->wDayOfWeek + date->wDay
|
||||
) % 7 + 1;
|
||||
limit_day = First + 7 * (weekofmonth - 1);
|
||||
/* check needed for the 5th weekday of the month */
|
||||
if(limit_day > MonthLengths[date->wMonth==2 && IsLeapYear(date->wYear)]
|
||||
[date->wMonth - 1])
|
||||
limit_day -= 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
limit_day = compareDate->wDay;
|
||||
}
|
||||
/* if year is 0 then date is in day-of-week format, otherwise
|
||||
* it's absolute date.
|
||||
*/
|
||||
if (compareDate->wYear == 0)
|
||||
{
|
||||
WORD First;
|
||||
/* compareDate->wDay is interpreted as number of the week in the month
|
||||
* 5 means: the last week in the month */
|
||||
int weekofmonth = compareDate->wDay;
|
||||
/* calculate the day of the first DayOfWeek in the month */
|
||||
First = ( 6 + compareDate->wDayOfWeek - date->wDayOfWeek + date->wDay
|
||||
) % 7 + 1;
|
||||
limit_day = First + 7 * (weekofmonth - 1);
|
||||
/* check needed for the 5th weekday of the month */
|
||||
if(limit_day > MonthLengths[date->wMonth==2 && IsLeapYear(date->wYear)]
|
||||
[date->wMonth - 1])
|
||||
limit_day -= 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
limit_day = compareDate->wDay;
|
||||
}
|
||||
|
||||
/* convert to seconds */
|
||||
limit_day = ((limit_day * 24 + compareDate->wHour) * 60 +
|
||||
compareDate->wMinute ) * 60;
|
||||
dayinsecs = ((date->wDay * 24 + date->wHour) * 60 +
|
||||
date->wMinute ) * 60 + date->wSecond;
|
||||
/* and compare */
|
||||
return dayinsecs < limit_day ? -1 :
|
||||
dayinsecs > limit_day ? 1 :
|
||||
0; /* date is equal to the date limit. */
|
||||
/* convert to seconds */
|
||||
limit_day = ((limit_day * 24 + compareDate->wHour) * 60 +
|
||||
compareDate->wMinute ) * 60;
|
||||
dayinsecs = ((date->wDay * 24 + date->wHour) * 60 +
|
||||
date->wMinute ) * 60 + date->wSecond;
|
||||
/* and compare */
|
||||
return dayinsecs < limit_day ? -1 :
|
||||
dayinsecs > limit_day ? 1 :
|
||||
0; /* date is equal to the date limit. */
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -119,74 +119,74 @@ static int TIME_DayLightCompareDate( const SYSTEMTIME *date,
|
||||
* TIME_ZONE_ID_DAYLIGHT Current time is daylight savings time
|
||||
*/
|
||||
static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
|
||||
FILETIME *lpFileTime, BOOL islocal )
|
||||
FILETIME *lpFileTime, BOOL islocal )
|
||||
{
|
||||
int ret;
|
||||
BOOL beforeStandardDate, afterDaylightDate;
|
||||
DWORD retval = TIME_ZONE_ID_INVALID;
|
||||
LONGLONG llTime = 0; /* initialized to prevent gcc complaining */
|
||||
SYSTEMTIME SysTime;
|
||||
FILETIME ftTemp;
|
||||
int ret;
|
||||
BOOL beforeStandardDate, afterDaylightDate;
|
||||
DWORD retval = TIME_ZONE_ID_INVALID;
|
||||
LONGLONG llTime = 0; /* initialized to prevent gcc complaining */
|
||||
SYSTEMTIME SysTime;
|
||||
FILETIME ftTemp;
|
||||
|
||||
if (pTZinfo->DaylightDate.wMonth != 0)
|
||||
{
|
||||
/* if year is 0 then date is in day-of-week format, otherwise
|
||||
* it's absolute date.
|
||||
*/
|
||||
if (pTZinfo->StandardDate.wMonth == 0 ||
|
||||
(pTZinfo->StandardDate.wYear == 0 &&
|
||||
(pTZinfo->StandardDate.wDay<1 ||
|
||||
pTZinfo->StandardDate.wDay>5 ||
|
||||
pTZinfo->DaylightDate.wDay<1 ||
|
||||
pTZinfo->DaylightDate.wDay>5)))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return TIME_ZONE_ID_INVALID;
|
||||
}
|
||||
if (pTZinfo->DaylightDate.wMonth != 0)
|
||||
{
|
||||
/* if year is 0 then date is in day-of-week format, otherwise
|
||||
* it's absolute date.
|
||||
*/
|
||||
if (pTZinfo->StandardDate.wMonth == 0 ||
|
||||
(pTZinfo->StandardDate.wYear == 0 &&
|
||||
(pTZinfo->StandardDate.wDay<1 ||
|
||||
pTZinfo->StandardDate.wDay>5 ||
|
||||
pTZinfo->DaylightDate.wDay<1 ||
|
||||
pTZinfo->DaylightDate.wDay>5)))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return TIME_ZONE_ID_INVALID;
|
||||
}
|
||||
|
||||
if (!islocal) {
|
||||
FILETIME2LL( lpFileTime, llTime );
|
||||
llTime -= ( pTZinfo->Bias + pTZinfo->DaylightBias )
|
||||
* (LONGLONG)600000000;
|
||||
LL2FILETIME( llTime, &ftTemp)
|
||||
lpFileTime = &ftTemp;
|
||||
}
|
||||
if (!islocal) {
|
||||
FILETIME2LL( lpFileTime, llTime );
|
||||
llTime -= ( pTZinfo->Bias + pTZinfo->DaylightBias )
|
||||
* (LONGLONG)600000000;
|
||||
LL2FILETIME( llTime, &ftTemp)
|
||||
lpFileTime = &ftTemp;
|
||||
}
|
||||
|
||||
FileTimeToSystemTime(lpFileTime, &SysTime);
|
||||
FileTimeToSystemTime(lpFileTime, &SysTime);
|
||||
|
||||
/* check for daylight savings */
|
||||
ret = TIME_DayLightCompareDate( &SysTime, &pTZinfo->StandardDate);
|
||||
if (ret == -2)
|
||||
return TIME_ZONE_ID_INVALID;
|
||||
/* check for daylight savings */
|
||||
ret = TIME_DayLightCompareDate( &SysTime, &pTZinfo->StandardDate);
|
||||
if (ret == -2)
|
||||
return TIME_ZONE_ID_INVALID;
|
||||
|
||||
beforeStandardDate = ret < 0;
|
||||
beforeStandardDate = ret < 0;
|
||||
|
||||
if (!islocal) {
|
||||
llTime -= ( pTZinfo->StandardBias - pTZinfo->DaylightBias )
|
||||
* (LONGLONG)600000000;
|
||||
LL2FILETIME( llTime, &ftTemp)
|
||||
FileTimeToSystemTime(lpFileTime, &SysTime);
|
||||
}
|
||||
if (!islocal) {
|
||||
llTime -= ( pTZinfo->StandardBias - pTZinfo->DaylightBias )
|
||||
* (LONGLONG)600000000;
|
||||
LL2FILETIME( llTime, &ftTemp)
|
||||
FileTimeToSystemTime(lpFileTime, &SysTime);
|
||||
}
|
||||
|
||||
ret = TIME_DayLightCompareDate( &SysTime, &pTZinfo->DaylightDate);
|
||||
if (ret == -2)
|
||||
return TIME_ZONE_ID_INVALID;
|
||||
ret = TIME_DayLightCompareDate( &SysTime, &pTZinfo->DaylightDate);
|
||||
if (ret == -2)
|
||||
return TIME_ZONE_ID_INVALID;
|
||||
|
||||
afterDaylightDate = ret >= 0;
|
||||
afterDaylightDate = ret >= 0;
|
||||
|
||||
retval = TIME_ZONE_ID_STANDARD;
|
||||
if( pTZinfo->DaylightDate.wMonth < pTZinfo->StandardDate.wMonth ) {
|
||||
/* Northern hemisphere */
|
||||
if( beforeStandardDate && afterDaylightDate )
|
||||
retval = TIME_ZONE_ID_DAYLIGHT;
|
||||
} else /* Down south */
|
||||
if( beforeStandardDate || afterDaylightDate )
|
||||
retval = TIME_ZONE_ID_DAYLIGHT;
|
||||
} else
|
||||
/* No transition date */
|
||||
retval = TIME_ZONE_ID_UNKNOWN;
|
||||
retval = TIME_ZONE_ID_STANDARD;
|
||||
if( pTZinfo->DaylightDate.wMonth < pTZinfo->StandardDate.wMonth ) {
|
||||
/* Northern hemisphere */
|
||||
if( beforeStandardDate && afterDaylightDate )
|
||||
retval = TIME_ZONE_ID_DAYLIGHT;
|
||||
} else /* Down south */
|
||||
if( beforeStandardDate || afterDaylightDate )
|
||||
retval = TIME_ZONE_ID_DAYLIGHT;
|
||||
} else
|
||||
/* No transition date */
|
||||
retval = TIME_ZONE_ID_UNKNOWN;
|
||||
|
||||
return retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -204,19 +204,19 @@ static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
|
||||
* TRUE when the time zone bias was calculated.
|
||||
*/
|
||||
static BOOL TIME_GetTimezoneBias( const TIME_ZONE_INFORMATION *pTZinfo,
|
||||
FILETIME *lpFileTime, BOOL islocal, LONG *pBias )
|
||||
FILETIME *lpFileTime, BOOL islocal, LONG *pBias )
|
||||
{
|
||||
LONG bias = pTZinfo->Bias;
|
||||
DWORD tzid = TIME_CompTimeZoneID( pTZinfo, lpFileTime, islocal);
|
||||
LONG bias = pTZinfo->Bias;
|
||||
DWORD tzid = TIME_CompTimeZoneID( pTZinfo, lpFileTime, islocal);
|
||||
|
||||
if( tzid == TIME_ZONE_ID_INVALID)
|
||||
return FALSE;
|
||||
if (tzid == TIME_ZONE_ID_DAYLIGHT)
|
||||
bias += pTZinfo->DaylightBias;
|
||||
else if (tzid == TIME_ZONE_ID_STANDARD)
|
||||
bias += pTZinfo->StandardBias;
|
||||
*pBias = bias;
|
||||
return TRUE;
|
||||
if( tzid == TIME_ZONE_ID_INVALID)
|
||||
return FALSE;
|
||||
if (tzid == TIME_ZONE_ID_DAYLIGHT)
|
||||
bias += pTZinfo->DaylightBias;
|
||||
else if (tzid == TIME_ZONE_ID_STANDARD)
|
||||
bias += pTZinfo->StandardBias;
|
||||
*pBias = bias;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -236,34 +236,34 @@ static BOOL TIME_GetTimezoneBias( const TIME_ZONE_INFORMATION *pTZinfo,
|
||||
|
||||
/* MAKE_EXPORT SystemTimeToTzSpecificLocalTime_new=SystemTimeToTzSpecificLocalTime */
|
||||
BOOL WINAPI SystemTimeToTzSpecificLocalTime_new(
|
||||
const TIME_ZONE_INFORMATION *lpTimeZoneInformation,
|
||||
const SYSTEMTIME *lpUniversalTime, LPSYSTEMTIME lpLocalTime )
|
||||
const TIME_ZONE_INFORMATION *lpTimeZoneInformation,
|
||||
const SYSTEMTIME *lpUniversalTime, LPSYSTEMTIME lpLocalTime )
|
||||
{
|
||||
FILETIME ft;
|
||||
LONG lBias;
|
||||
LONGLONG llTime;
|
||||
TIME_ZONE_INFORMATION tzinfo;
|
||||
FILETIME ft;
|
||||
LONG lBias;
|
||||
LONGLONG llTime;
|
||||
TIME_ZONE_INFORMATION tzinfo;
|
||||
|
||||
if (lpTimeZoneInformation != NULL)
|
||||
{
|
||||
tzinfo = *lpTimeZoneInformation;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_INVALID)
|
||||
return FALSE;
|
||||
}
|
||||
if (lpTimeZoneInformation != NULL)
|
||||
{
|
||||
tzinfo = *lpTimeZoneInformation;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_INVALID)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!SystemTimeToFileTime(lpUniversalTime, &ft))
|
||||
return FALSE;
|
||||
FILETIME2LL( &ft, llTime)
|
||||
if (!TIME_GetTimezoneBias(&tzinfo, &ft, FALSE, &lBias))
|
||||
return FALSE;
|
||||
/* convert minutes to 100-nanoseconds-ticks */
|
||||
llTime -= (LONGLONG)lBias * 600000000;
|
||||
LL2FILETIME( llTime, &ft)
|
||||
if (!SystemTimeToFileTime(lpUniversalTime, &ft))
|
||||
return FALSE;
|
||||
FILETIME2LL( &ft, llTime)
|
||||
if (!TIME_GetTimezoneBias(&tzinfo, &ft, FALSE, &lBias))
|
||||
return FALSE;
|
||||
/* convert minutes to 100-nanoseconds-ticks */
|
||||
llTime -= (LONGLONG)lBias * 600000000;
|
||||
LL2FILETIME( llTime, &ft)
|
||||
|
||||
return FileTimeToSystemTime(&ft, lpLocalTime);
|
||||
return FileTimeToSystemTime(&ft, lpLocalTime);
|
||||
}
|
||||
|
||||
|
||||
@ -284,31 +284,31 @@ BOOL WINAPI SystemTimeToTzSpecificLocalTime_new(
|
||||
|
||||
/* MAKE_EXPORT TzSpecificLocalTimeToSystemTime_new=TzSpecificLocalTimeToSystemTime */
|
||||
BOOL WINAPI TzSpecificLocalTimeToSystemTime_new(
|
||||
const TIME_ZONE_INFORMATION *lpTimeZoneInformation,
|
||||
const SYSTEMTIME *lpLocalTime, LPSYSTEMTIME lpUniversalTime)
|
||||
const TIME_ZONE_INFORMATION *lpTimeZoneInformation,
|
||||
const SYSTEMTIME *lpLocalTime, LPSYSTEMTIME lpUniversalTime)
|
||||
{
|
||||
FILETIME ft;
|
||||
LONG lBias;
|
||||
LONGLONG t;
|
||||
TIME_ZONE_INFORMATION tzinfo;
|
||||
FILETIME ft;
|
||||
LONG lBias;
|
||||
LONGLONG t;
|
||||
TIME_ZONE_INFORMATION tzinfo;
|
||||
|
||||
if (lpTimeZoneInformation != NULL)
|
||||
{
|
||||
tzinfo = *lpTimeZoneInformation;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_INVALID)
|
||||
return FALSE;
|
||||
}
|
||||
if (lpTimeZoneInformation != NULL)
|
||||
{
|
||||
tzinfo = *lpTimeZoneInformation;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_INVALID)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!SystemTimeToFileTime(lpLocalTime, &ft))
|
||||
return FALSE;
|
||||
FILETIME2LL( &ft, t)
|
||||
if (!TIME_GetTimezoneBias(&tzinfo, &ft, TRUE, &lBias))
|
||||
return FALSE;
|
||||
/* convert minutes to 100-nanoseconds-ticks */
|
||||
t += (LONGLONG)lBias * 600000000;
|
||||
LL2FILETIME( t, &ft)
|
||||
return FileTimeToSystemTime(&ft, lpUniversalTime);
|
||||
if (!SystemTimeToFileTime(lpLocalTime, &ft))
|
||||
return FALSE;
|
||||
FILETIME2LL( &ft, t)
|
||||
if (!TIME_GetTimezoneBias(&tzinfo, &ft, TRUE, &lBias))
|
||||
return FALSE;
|
||||
/* convert minutes to 100-nanoseconds-ticks */
|
||||
t += (LONGLONG)lBias * 600000000;
|
||||
LL2FILETIME( t, &ft)
|
||||
return FileTimeToSystemTime(&ft, lpUniversalTime);
|
||||
}
|
||||
|
@ -113,24 +113,24 @@ BOOL WINAPI EnumUILanguagesA_new(UILANGUAGE_ENUMPROCA pUILangEnumProc, DWORD dwF
|
||||
char buf[10];
|
||||
LANGID lid;
|
||||
|
||||
if (!pUILangEnumProc)
|
||||
if (!pUILangEnumProc)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (dwFlags)
|
||||
if (dwFlags)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return FALSE;
|
||||
}
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lid = GetSystemDefaultUILanguage_new();
|
||||
|
||||
dword_to_hexstr(lid, buf, FALSE);
|
||||
|
||||
pUILangEnumProc(buf, lParam);
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT EnumUILanguagesW_new=EnumUILanguagesW */
|
||||
@ -139,22 +139,22 @@ BOOL WINAPI EnumUILanguagesW_new(UILANGUAGE_ENUMPROCW pUILangEnumProc, DWORD dwF
|
||||
WCHAR buf[10];
|
||||
LANGID lid;
|
||||
|
||||
if (!pUILangEnumProc)
|
||||
if (!pUILangEnumProc)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (dwFlags)
|
||||
if (dwFlags)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return FALSE;
|
||||
}
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lid = GetSystemDefaultUILanguage_new();
|
||||
|
||||
dword_to_hexstr(lid, buf, TRUE);
|
||||
|
||||
pUILangEnumProc(buf, lParam);
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -29,78 +29,9 @@
|
||||
ATOM WINAPI AddAtomW_new(LPCWSTR strW)
|
||||
{
|
||||
ALLOC_WtoA(str);
|
||||
return AddAtomA(strA);
|
||||
return AddAtomA(strA);
|
||||
}
|
||||
|
||||
/* something seems to be wrong with this and I don't know what
|
||||
INT WINAPI CompareStringW_new(LCID lcid, DWORD style,
|
||||
LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
|
||||
{
|
||||
CHAR buf1A[BUFSIZE];
|
||||
CHAR buf2A[BUFSIZE];
|
||||
LPSTR str1A, str2A;
|
||||
INT len1A, len2A, ret;
|
||||
UINT locale_cp = CP_ACP;
|
||||
int lasterr;
|
||||
|
||||
DBGMSGW((L"CompareStringW(0x%1!x!,0x%2!x!,%3!s!,%4!d!,%5!s!,%6!d!)\n",lcid,style,str1,len1,str2,len2));
|
||||
|
||||
lasterr = GetLastError();
|
||||
if (lcid == LANG_INVARIANT) lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
|
||||
|
||||
if (!str1 || !str2)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(style & LOCALE_USE_CP_ACP))
|
||||
if (!GetLocaleInfoA(lcid, LOCALE_IDEFAULTANSICODEPAGE|LOCALE_RETURN_NUMBER,
|
||||
(CHAR *)&locale_cp, sizeof(locale_cp)/sizeof(CHAR))) locale_cp = 0;
|
||||
|
||||
str1A = buf1A;
|
||||
if (len1 != 0)
|
||||
{
|
||||
len1A = WideCharToMultiByte(locale_cp, 0, str1, len1, buf1A, BUFSIZE, NULL, NULL);
|
||||
if (!len1A)
|
||||
{
|
||||
len1A = WideCharToMultiByte(locale_cp, 0, str1, len1, NULL, 0, NULL, NULL);
|
||||
str1A = HeapAlloc(GetProcessHeap(), 0, len1A);
|
||||
if (!str1A)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return 0;
|
||||
}
|
||||
WideCharToMultiByte(locale_cp, 0, str1, len1, str1A, len1A, NULL, NULL);
|
||||
}
|
||||
}
|
||||
str2A = buf2A;
|
||||
if (len2 != 0)
|
||||
{
|
||||
len2A = WideCharToMultiByte(locale_cp, 0, str2, len2, buf2A, BUFSIZE, NULL, NULL);
|
||||
if (!len2A)
|
||||
{
|
||||
len2A = WideCharToMultiByte(locale_cp, 0, str2, len2, NULL, 0, NULL, NULL);
|
||||
str2A = HeapAlloc(GetProcessHeap(), 0, len2A);
|
||||
if (!str2A)
|
||||
{
|
||||
if (str1A != buf1A) HeapFree(GetProcessHeap(), 0, str1A);
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return 0;
|
||||
}
|
||||
WideCharToMultiByte(locale_cp, 0, str2, len2, str2A, len2A, NULL, NULL);
|
||||
}
|
||||
}
|
||||
SetLastError(lasterr);
|
||||
|
||||
ret = CompareStringA(lcid, style, str1A, len1A, str2A, len2A);
|
||||
|
||||
if (str1A != buf1A) HeapFree(GetProcessHeap(), 0, str1A);
|
||||
if (str2A != buf2A) HeapFree(GetProcessHeap(), 0, str2A);
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
|
||||
//MAKE_EXPORT CopyFileExW_new=CopyFileExW
|
||||
BOOL WINAPI CopyFileExW_new(LPCWSTR lpExistingFileNameW, LPCWSTR lpNewFileNameW, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags)
|
||||
{
|
||||
@ -167,8 +98,8 @@ BOOL WINAPI DeleteFileW_new(LPCWSTR lpFileNameW)
|
||||
//MAKE_EXPORT FindAtomW_new=FindAtomW
|
||||
ATOM WINAPI FindAtomW_new(LPCWSTR strW)
|
||||
{
|
||||
ALLOC_WtoA(str);
|
||||
return FindAtomA(strA);
|
||||
ALLOC_WtoA(str);
|
||||
return FindAtomA(strA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT FindFirstChangeNotificationW_new=FindFirstChangeNotificationW
|
||||
@ -245,7 +176,7 @@ HRSRC WINAPI FindResourceExW_new(HMODULE hModule, LPCWSTR typeW, LPCWSTR nameW,
|
||||
//MAKE_EXPORT FindResourceW_new=FindResourceW
|
||||
HRSRC WINAPI FindResourceW_new(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
|
||||
{
|
||||
return FindResourceExW_new(hModule, type, name, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL));
|
||||
return FindResourceExW_new(hModule, type, name, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL));
|
||||
}
|
||||
|
||||
//MAKE_EXPORT FreeEnvironmentStringsW_new=FreeEnvironmentStringsW
|
||||
@ -259,11 +190,11 @@ UINT WINAPI GetAtomNameW_new(ATOM atom, LPWSTR bufferW, int size)
|
||||
{
|
||||
UINT ret;
|
||||
ALLOC_A(buffer, size * acp_mcs);
|
||||
ret = GetAtomNameA(atom, bufferA, size * acp_mcs);
|
||||
if (ret)
|
||||
ret = GetAtomNameA(atom, bufferA, size * acp_mcs);
|
||||
if (ret)
|
||||
ret = ABUFtoW(buffer, ret + 1, size);
|
||||
if (ret) ret--;
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetCurrentDirectoryW_new=GetCurrentDirectoryW
|
||||
@ -569,15 +500,15 @@ UINT WINAPI GetWindowsDirectoryW_new(LPWSTR lpBufferW, UINT uSize)
|
||||
//MAKE_EXPORT GlobalAddAtomW_new=GlobalAddAtomW
|
||||
ATOM WINAPI GlobalAddAtomW_new(LPCWSTR strW)
|
||||
{
|
||||
ALLOC_WtoA(str);
|
||||
return GlobalAddAtomA(strA);
|
||||
ALLOC_WtoA(str);
|
||||
return GlobalAddAtomA(strA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GlobalFindAtomW_new=GlobalFindAtomW
|
||||
ATOM WINAPI GlobalFindAtomW_new(LPCWSTR strW)
|
||||
{
|
||||
ALLOC_WtoA(str);
|
||||
return GlobalFindAtomA(strA);
|
||||
ALLOC_WtoA(str);
|
||||
return GlobalFindAtomA(strA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GlobalGetAtomNameW_new=GlobalGetAtomNameW
|
||||
@ -585,11 +516,11 @@ UINT WINAPI GlobalGetAtomNameW_new(ATOM atom, LPWSTR bufferW, int size)
|
||||
{
|
||||
UINT ret;
|
||||
ALLOC_A(buffer, size * acp_mcs);
|
||||
ret = GlobalGetAtomNameA(atom, bufferA, size * acp_mcs);
|
||||
if (ret)
|
||||
ret = GlobalGetAtomNameA(atom, bufferA, size * acp_mcs);
|
||||
if (ret)
|
||||
ret = ABUFtoW(buffer, ret + 1, size);
|
||||
if (ret) ret--;
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT LoadLibraryW_new=LoadLibraryW
|
||||
@ -613,27 +544,27 @@ BOOL WINAPI Module32FirstW_new(HANDLE hSnapshot, LPMODULEENTRY32W lpmeW)
|
||||
{
|
||||
BOOL ret;
|
||||
char szModuleA[MAX_MODULE_NAME32 + 1];
|
||||
char szExePathA[MAX_PATH];
|
||||
char szExePathA[MAX_PATH];
|
||||
WCHAR* szModuleW = lpmeW->szModule;
|
||||
WCHAR* szExePathW = lpmeW->szExePath;
|
||||
|
||||
if (lpmeW->dwSize < sizeof(MODULEENTRY32W))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lpmeW->dwSize = sizeof(MODULEENTRY32);
|
||||
lpmeW->dwSize = sizeof(MODULEENTRY32);
|
||||
|
||||
if ((ret = Module32First(hSnapshot, (LPMODULEENTRY32)lpmeW)) != FALSE)
|
||||
{
|
||||
if ((ret = Module32First(hSnapshot, (LPMODULEENTRY32)lpmeW)) != FALSE)
|
||||
{
|
||||
strcpy(szModuleA, ((LPMODULEENTRY32)lpmeW)->szModule);
|
||||
strcpy(szExePathA, ((LPMODULEENTRY32)lpmeW)->szExePath);
|
||||
AtoW(szModule, sizeof(lpmeW->szModule) / sizeof(WCHAR));
|
||||
AtoW(szExePath, sizeof(lpmeW->szExePath) / sizeof(WCHAR));
|
||||
}
|
||||
lpmeW->dwSize = sizeof(MODULEENTRY32W);
|
||||
return ret;
|
||||
}
|
||||
lpmeW->dwSize = sizeof(MODULEENTRY32W);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT Module32NextW_new=Module32NextW
|
||||
@ -641,27 +572,27 @@ BOOL WINAPI Module32NextW_new(HANDLE hSnapshot, LPMODULEENTRY32W lpmeW)
|
||||
{
|
||||
BOOL ret;
|
||||
char szModuleA[MAX_MODULE_NAME32 + 1];
|
||||
char szExePathA[MAX_PATH];
|
||||
char szExePathA[MAX_PATH];
|
||||
WCHAR* szModuleW = lpmeW->szModule;
|
||||
WCHAR* szExePathW = lpmeW->szExePath;
|
||||
|
||||
if (lpmeW->dwSize < sizeof(MODULEENTRY32W))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_DATA);
|
||||
return FALSE;
|
||||
}
|
||||
{
|
||||
SetLastError(ERROR_INVALID_DATA);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lpmeW->dwSize = sizeof(MODULEENTRY32);
|
||||
|
||||
if ((ret = Module32Next(hSnapshot, (LPMODULEENTRY32)lpmeW)) != FALSE)
|
||||
{
|
||||
{
|
||||
strcpy(szModuleA, ((LPMODULEENTRY32)lpmeW)->szModule);
|
||||
strcpy(szExePathA, ((LPMODULEENTRY32)lpmeW)->szExePath);
|
||||
AtoW(szModule, sizeof(lpmeW->szModule) / sizeof(WCHAR));
|
||||
AtoW(szExePath, sizeof(lpmeW->szExePath) / sizeof(WCHAR));
|
||||
}
|
||||
lpmeW->dwSize = sizeof(MODULEENTRY32W);
|
||||
return ret;
|
||||
}
|
||||
lpmeW->dwSize = sizeof(MODULEENTRY32W);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT MoveFileExW_new=MoveFileExW
|
||||
@ -790,8 +721,8 @@ DWORD WINAPI SearchPathW_new(LPCWSTR lpPathW, LPCWSTR lpFileNameW, LPCWSTR lpExt
|
||||
//MAKE_EXPORT SetConsoleTitleW_new=SetConsoleTitleW
|
||||
BOOL WINAPI SetConsoleTitleW_new(LPCWSTR strW)
|
||||
{
|
||||
ALLOC_WtoA(str);
|
||||
return SetConsoleTitleA(strA);
|
||||
ALLOC_WtoA(str);
|
||||
return SetConsoleTitleA(strA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT SetCurrentDirectoryW_new=SetCurrentDirectoryW
|
||||
|
@ -24,88 +24,88 @@
|
||||
/* special structure used internally to save some space */
|
||||
typedef struct
|
||||
{
|
||||
DWORD dwMajorVersion;
|
||||
DWORD dwMinorVersion;
|
||||
DWORD dwBuildNumber;
|
||||
DWORD dwPlatformId;
|
||||
CHAR* lpszCSDVersion;
|
||||
WORD wServicePackMajor;
|
||||
WORD wServicePackMinor;
|
||||
WORD wSuiteMask;
|
||||
BYTE wProductType;
|
||||
BYTE wReserved;
|
||||
DWORD dwMajorVersion;
|
||||
DWORD dwMinorVersion;
|
||||
DWORD dwBuildNumber;
|
||||
DWORD dwPlatformId;
|
||||
CHAR* lpszCSDVersion;
|
||||
WORD wServicePackMajor;
|
||||
WORD wServicePackMinor;
|
||||
WORD wSuiteMask;
|
||||
BYTE wProductType;
|
||||
BYTE wReserved;
|
||||
} OSVERSIONINFOEXA_PRIV;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WIN95, /* Windows 95 */
|
||||
WIN98, /* Windows 98 */
|
||||
WINME, /* Windows Me */
|
||||
NT40, /* Windows NT 4.0 */
|
||||
NT2K, /* Windows 2000 */
|
||||
WINXP, /* Windows XP */
|
||||
WIN2K3, /* Windows 2003 */
|
||||
VISTA, /* Windows Vista */
|
||||
WIN2K8, /* Windows 2008 */
|
||||
NB_WINDOWS_VERSIONS
|
||||
WIN95, /* Windows 95 */
|
||||
WIN98, /* Windows 98 */
|
||||
WINME, /* Windows Me */
|
||||
NT40, /* Windows NT 4.0 */
|
||||
NT2K, /* Windows 2000 */
|
||||
WINXP, /* Windows XP */
|
||||
WIN2K3, /* Windows 2003 */
|
||||
VISTA, /* Windows Vista */
|
||||
WIN2K8, /* Windows 2008 */
|
||||
NB_WINDOWS_VERSIONS
|
||||
} WINDOWS_VERSION;
|
||||
|
||||
static const OSVERSIONINFOEXA_PRIV VersionData[NB_WINDOWS_VERSIONS] =
|
||||
{
|
||||
/* WIN95 */
|
||||
{
|
||||
4, 0, 0x40003B6, VER_PLATFORM_WIN32_WINDOWS,
|
||||
"",
|
||||
0, 0, 0, 0, 0
|
||||
},
|
||||
/* WIN98 (second edition) */
|
||||
{
|
||||
4, 10, 0x40A08AE, VER_PLATFORM_WIN32_WINDOWS,
|
||||
" A ",
|
||||
0, 0, 0, 0, 0
|
||||
},
|
||||
/* WINME */
|
||||
{
|
||||
4, 90, 0x45A0BB8, VER_PLATFORM_WIN32_WINDOWS,
|
||||
" ",
|
||||
0, 0, 0, 0, 0
|
||||
},
|
||||
/* NT40 */
|
||||
{
|
||||
4, 0, 0x565, VER_PLATFORM_WIN32_NT,
|
||||
"Service Pack 6a",
|
||||
6, 0, 0, VER_NT_WORKSTATION, 0
|
||||
},
|
||||
/* NT2K */
|
||||
{
|
||||
5, 0, 0x893, VER_PLATFORM_WIN32_NT,
|
||||
"Service Pack 4",
|
||||
4, 0, 0, VER_NT_WORKSTATION, 30
|
||||
},
|
||||
/* WINXP */
|
||||
{
|
||||
5, 1, 0xA28, VER_PLATFORM_WIN32_NT,
|
||||
"Service Pack 2",
|
||||
2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 30
|
||||
},
|
||||
/* WIN2K3 */
|
||||
{
|
||||
5, 2, 0xECE, VER_PLATFORM_WIN32_NT,
|
||||
"Service Pack 1",
|
||||
1, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
|
||||
},
|
||||
/* WINVISTA */
|
||||
{
|
||||
6, 0, 0x1770, VER_PLATFORM_WIN32_NT,
|
||||
" ",
|
||||
0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
|
||||
},
|
||||
/* WIN2K8 */
|
||||
{
|
||||
6, 0, 0x1771, VER_PLATFORM_WIN32_NT,
|
||||
"Service Pack 1",
|
||||
0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
|
||||
}
|
||||
/* WIN95 */
|
||||
{
|
||||
4, 0, 0x40003B6, VER_PLATFORM_WIN32_WINDOWS,
|
||||
"",
|
||||
0, 0, 0, 0, 0
|
||||
},
|
||||
/* WIN98 (second edition) */
|
||||
{
|
||||
4, 10, 0x40A08AE, VER_PLATFORM_WIN32_WINDOWS,
|
||||
" A ",
|
||||
0, 0, 0, 0, 0
|
||||
},
|
||||
/* WINME */
|
||||
{
|
||||
4, 90, 0x45A0BB8, VER_PLATFORM_WIN32_WINDOWS,
|
||||
" ",
|
||||
0, 0, 0, 0, 0
|
||||
},
|
||||
/* NT40 */
|
||||
{
|
||||
4, 0, 0x565, VER_PLATFORM_WIN32_NT,
|
||||
"Service Pack 6a",
|
||||
6, 0, 0, VER_NT_WORKSTATION, 0
|
||||
},
|
||||
/* NT2K */
|
||||
{
|
||||
5, 0, 0x893, VER_PLATFORM_WIN32_NT,
|
||||
"Service Pack 4",
|
||||
4, 0, 0, VER_NT_WORKSTATION, 30
|
||||
},
|
||||
/* WINXP */
|
||||
{
|
||||
5, 1, 0xA28, VER_PLATFORM_WIN32_NT,
|
||||
"Service Pack 2",
|
||||
2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 30
|
||||
},
|
||||
/* WIN2K3 */
|
||||
{
|
||||
5, 2, 0xECE, VER_PLATFORM_WIN32_NT,
|
||||
"Service Pack 1",
|
||||
1, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
|
||||
},
|
||||
/* WINVISTA */
|
||||
{
|
||||
6, 0, 0x1770, VER_PLATFORM_WIN32_NT,
|
||||
" ",
|
||||
0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
|
||||
},
|
||||
/* WIN2K8 */
|
||||
{
|
||||
6, 0, 0x1771, VER_PLATFORM_WIN32_NT,
|
||||
"Service Pack 1",
|
||||
0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
|
||||
}
|
||||
};
|
||||
|
||||
static BOOL original_GetVersionEx(void* buf, BOOL unicode)
|
||||
@ -173,9 +173,9 @@ static DWORD common_GetVersion(WINDOWS_VERSION version)
|
||||
|
||||
result = MAKELONG(MAKEWORD(osv->dwMajorVersion, osv->dwMinorVersion),
|
||||
(osv->dwPlatformId ^ 2) << 14);
|
||||
if (osv->dwPlatformId == VER_PLATFORM_WIN32_NT)
|
||||
result |= LOWORD(osv->dwBuildNumber) << 16;
|
||||
return result;
|
||||
if (osv->dwPlatformId == VER_PLATFORM_WIN32_NT)
|
||||
result |= LOWORD(osv->dwBuildNumber) << 16;
|
||||
return result;
|
||||
}
|
||||
|
||||
static BOOL common_GetVersionEx(WINDOWS_VERSION version, void* buf, BOOL unicode)
|
||||
@ -234,111 +234,112 @@ static BOOL common_GetVersionEx(WINDOWS_VERSION version, void* buf, BOOL unicode
|
||||
|
||||
static DWORD version_compare_values(ULONG left, ULONG right, UCHAR condition)
|
||||
{
|
||||
switch (condition) {
|
||||
case VER_EQUAL:
|
||||
if (left != right) return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
case VER_GREATER:
|
||||
if (left <= right) return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
case VER_GREATER_EQUAL:
|
||||
if (left < right) return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
case VER_LESS:
|
||||
if (left >= right) return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
case VER_LESS_EQUAL:
|
||||
if (left > right) return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
default:
|
||||
return ERROR_OLD_WIN_VERSION;
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
switch (condition)
|
||||
{
|
||||
case VER_EQUAL:
|
||||
if (left != right) return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
case VER_GREATER:
|
||||
if (left <= right) return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
case VER_GREATER_EQUAL:
|
||||
if (left < right) return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
case VER_LESS:
|
||||
if (left >= right) return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
case VER_LESS_EQUAL:
|
||||
if (left > right) return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
default:
|
||||
return ERROR_OLD_WIN_VERSION;
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static DWORD common_VerifyVersionInfo(WINDOWS_VERSION version,
|
||||
const OSVERSIONINFOEXA* info, DWORD dwTypeMask, DWORDLONG dwlConditionMask)
|
||||
{
|
||||
const OSVERSIONINFOEXA_PRIV* osv = &VersionData[version];
|
||||
DWORD status;
|
||||
DWORD status;
|
||||
|
||||
if (!(dwTypeMask && dwlConditionMask)) return ERROR_BAD_ARGUMENTS;
|
||||
if (!(dwTypeMask && dwlConditionMask)) return ERROR_BAD_ARGUMENTS;
|
||||
|
||||
if (dwTypeMask & VER_PRODUCT_TYPE)
|
||||
{
|
||||
status = version_compare_values(osv->wProductType, info->wProductType, (UCHAR)(dwlConditionMask >> 7*3 & 0x07));
|
||||
if (status != ERROR_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
if (dwTypeMask & VER_SUITENAME)
|
||||
switch(dwlConditionMask >> 6*3 & 0x07)
|
||||
{
|
||||
case VER_AND:
|
||||
if ((info->wSuiteMask & osv->wSuiteMask) != info->wSuiteMask)
|
||||
return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
case VER_OR:
|
||||
if (!(info->wSuiteMask & osv->wSuiteMask) && info->wSuiteMask)
|
||||
return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
default:
|
||||
return ERROR_BAD_ARGUMENTS;
|
||||
}
|
||||
if (dwTypeMask & VER_PLATFORMID)
|
||||
{
|
||||
status = version_compare_values(osv->dwPlatformId, info->dwPlatformId, (UCHAR)(dwlConditionMask >> 3*3 & 0x07));
|
||||
if (status != ERROR_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
if (dwTypeMask & VER_BUILDNUMBER)
|
||||
{
|
||||
status = version_compare_values(osv->dwBuildNumber, info->dwBuildNumber, (UCHAR)(dwlConditionMask >> 2*3 & 0x07));
|
||||
if (status != ERROR_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
if (dwTypeMask & VER_PRODUCT_TYPE)
|
||||
{
|
||||
status = version_compare_values(osv->wProductType, info->wProductType, (UCHAR)(dwlConditionMask >> 7*3 & 0x07));
|
||||
if (status != ERROR_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
if (dwTypeMask & VER_SUITENAME)
|
||||
switch(dwlConditionMask >> 6*3 & 0x07)
|
||||
{
|
||||
case VER_AND:
|
||||
if ((info->wSuiteMask & osv->wSuiteMask) != info->wSuiteMask)
|
||||
return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
case VER_OR:
|
||||
if (!(info->wSuiteMask & osv->wSuiteMask) && info->wSuiteMask)
|
||||
return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
default:
|
||||
return ERROR_BAD_ARGUMENTS;
|
||||
}
|
||||
if (dwTypeMask & VER_PLATFORMID)
|
||||
{
|
||||
status = version_compare_values(osv->dwPlatformId, info->dwPlatformId, (UCHAR)(dwlConditionMask >> 3*3 & 0x07));
|
||||
if (status != ERROR_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
if (dwTypeMask & VER_BUILDNUMBER)
|
||||
{
|
||||
status = version_compare_values(osv->dwBuildNumber, info->dwBuildNumber, (UCHAR)(dwlConditionMask >> 2*3 & 0x07));
|
||||
if (status != ERROR_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
|
||||
if (dwTypeMask & (VER_MAJORVERSION|VER_MINORVERSION|VER_SERVICEPACKMAJOR|VER_SERVICEPACKMINOR))
|
||||
{
|
||||
UCHAR condition = 0;
|
||||
BOOL do_next_check = TRUE;
|
||||
if (dwTypeMask & (VER_MAJORVERSION|VER_MINORVERSION|VER_SERVICEPACKMAJOR|VER_SERVICEPACKMINOR))
|
||||
{
|
||||
UCHAR condition = 0;
|
||||
BOOL do_next_check = TRUE;
|
||||
|
||||
if (dwTypeMask & VER_MAJORVERSION)
|
||||
condition = (UCHAR)(dwlConditionMask >> 1*3 & 0x07);
|
||||
else if (dwTypeMask & VER_MINORVERSION)
|
||||
condition = (UCHAR)(dwlConditionMask >> 0*3 & 0x07);
|
||||
else if (dwTypeMask & VER_SERVICEPACKMAJOR)
|
||||
condition = (UCHAR)(dwlConditionMask >> 5*3 & 0x07);
|
||||
else if (dwTypeMask & VER_SERVICEPACKMINOR)
|
||||
condition = (UCHAR)(dwlConditionMask >> 4*3 & 0x07);
|
||||
if (dwTypeMask & VER_MAJORVERSION)
|
||||
condition = (UCHAR)(dwlConditionMask >> 1*3 & 0x07);
|
||||
else if (dwTypeMask & VER_MINORVERSION)
|
||||
condition = (UCHAR)(dwlConditionMask >> 0*3 & 0x07);
|
||||
else if (dwTypeMask & VER_SERVICEPACKMAJOR)
|
||||
condition = (UCHAR)(dwlConditionMask >> 5*3 & 0x07);
|
||||
else if (dwTypeMask & VER_SERVICEPACKMINOR)
|
||||
condition = (UCHAR)(dwlConditionMask >> 4*3 & 0x07);
|
||||
|
||||
if (dwTypeMask & VER_MAJORVERSION)
|
||||
{
|
||||
status = version_compare_values(osv->dwMajorVersion, info->dwMajorVersion, condition);
|
||||
do_next_check = (osv->dwMajorVersion == info->dwMajorVersion) &&
|
||||
((condition != VER_EQUAL) || (status == ERROR_SUCCESS));
|
||||
}
|
||||
if ((dwTypeMask & VER_MINORVERSION) && do_next_check)
|
||||
{
|
||||
status = version_compare_values(osv->dwMinorVersion, info->dwMinorVersion, condition);
|
||||
do_next_check = (osv->dwMinorVersion == info->dwMinorVersion) &&
|
||||
((condition != VER_EQUAL) || (status == ERROR_SUCCESS));
|
||||
}
|
||||
if ((dwTypeMask & VER_SERVICEPACKMAJOR) && do_next_check)
|
||||
{
|
||||
status = version_compare_values(osv->wServicePackMajor, info->wServicePackMajor, condition);
|
||||
do_next_check = (osv->wServicePackMajor == info->wServicePackMajor) &&
|
||||
((condition != VER_EQUAL) || (status == ERROR_SUCCESS));
|
||||
}
|
||||
if ((dwTypeMask & VER_SERVICEPACKMINOR) && do_next_check)
|
||||
{
|
||||
status = version_compare_values(osv->wServicePackMinor, info->wServicePackMinor, condition);
|
||||
}
|
||||
if (dwTypeMask & VER_MAJORVERSION)
|
||||
{
|
||||
status = version_compare_values(osv->dwMajorVersion, info->dwMajorVersion, condition);
|
||||
do_next_check = (osv->dwMajorVersion == info->dwMajorVersion) &&
|
||||
((condition != VER_EQUAL) || (status == ERROR_SUCCESS));
|
||||
}
|
||||
if ((dwTypeMask & VER_MINORVERSION) && do_next_check)
|
||||
{
|
||||
status = version_compare_values(osv->dwMinorVersion, info->dwMinorVersion, condition);
|
||||
do_next_check = (osv->dwMinorVersion == info->dwMinorVersion) &&
|
||||
((condition != VER_EQUAL) || (status == ERROR_SUCCESS));
|
||||
}
|
||||
if ((dwTypeMask & VER_SERVICEPACKMAJOR) && do_next_check)
|
||||
{
|
||||
status = version_compare_values(osv->wServicePackMajor, info->wServicePackMajor, condition);
|
||||
do_next_check = (osv->wServicePackMajor == info->wServicePackMajor) &&
|
||||
((condition != VER_EQUAL) || (status == ERROR_SUCCESS));
|
||||
}
|
||||
if ((dwTypeMask & VER_SERVICEPACKMINOR) && do_next_check)
|
||||
{
|
||||
status = version_compare_values(osv->wServicePackMinor, info->wServicePackMinor, condition);
|
||||
}
|
||||
|
||||
if (status != ERROR_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
if (status != ERROR_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static BOOL WINAPI common_VerifyVersionInfoA(WINDOWS_VERSION version,
|
||||
@ -382,29 +383,29 @@ static BOOL WINAPI common_VerifyVersionInfoW(WINDOWS_VERSION version,
|
||||
ULONGLONG WINAPI VerSetConditionMask_new(ULONGLONG dwlConditionMask,
|
||||
DWORD dwTypeBitMask, BYTE dwConditionMask)
|
||||
{
|
||||
if (dwTypeBitMask == 0)
|
||||
if (dwTypeBitMask == 0)
|
||||
return dwlConditionMask;
|
||||
dwConditionMask &= 0x07;
|
||||
if (dwConditionMask == 0)
|
||||
dwConditionMask &= 0x07;
|
||||
if (dwConditionMask == 0)
|
||||
return dwlConditionMask;
|
||||
|
||||
if (dwTypeBitMask & VER_PRODUCT_TYPE)
|
||||
if (dwTypeBitMask & VER_PRODUCT_TYPE)
|
||||
dwlConditionMask |= dwConditionMask << 7*3;
|
||||
else if (dwTypeBitMask & VER_SUITENAME)
|
||||
else if (dwTypeBitMask & VER_SUITENAME)
|
||||
dwlConditionMask |= dwConditionMask << 6*3;
|
||||
else if (dwTypeBitMask & VER_SERVICEPACKMAJOR)
|
||||
else if (dwTypeBitMask & VER_SERVICEPACKMAJOR)
|
||||
dwlConditionMask |= dwConditionMask << 5*3;
|
||||
else if (dwTypeBitMask & VER_SERVICEPACKMINOR)
|
||||
else if (dwTypeBitMask & VER_SERVICEPACKMINOR)
|
||||
dwlConditionMask |= dwConditionMask << 4*3;
|
||||
else if (dwTypeBitMask & VER_PLATFORMID)
|
||||
else if (dwTypeBitMask & VER_PLATFORMID)
|
||||
dwlConditionMask |= dwConditionMask << 3*3;
|
||||
else if (dwTypeBitMask & VER_BUILDNUMBER)
|
||||
else if (dwTypeBitMask & VER_BUILDNUMBER)
|
||||
dwlConditionMask |= dwConditionMask << 2*3;
|
||||
else if (dwTypeBitMask & VER_MAJORVERSION)
|
||||
else if (dwTypeBitMask & VER_MAJORVERSION)
|
||||
dwlConditionMask |= dwConditionMask << 1*3;
|
||||
else if (dwTypeBitMask & VER_MINORVERSION)
|
||||
else if (dwTypeBitMask & VER_MINORVERSION)
|
||||
dwlConditionMask |= dwConditionMask << 0*3;
|
||||
return dwlConditionMask;
|
||||
return dwlConditionMask;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersion_WIN95=GetVersion */
|
||||
|
@ -25,17 +25,17 @@
|
||||
BOOL WINAPI GetVolumePathNameA_new(LPCSTR filename, LPSTR volumepathname, DWORD buflen)
|
||||
{
|
||||
//semi-stub - doesn't work with UNC
|
||||
const char *p = filename;
|
||||
const char *p = filename;
|
||||
|
||||
if (p && tolower(p[0]) >= 'a' && tolower(p[0]) <= 'z' && p[1] ==':' && p[2] == '\\' && buflen >= 4)
|
||||
{
|
||||
volumepathname[0] = p[0];
|
||||
volumepathname[1] = ':';
|
||||
volumepathname[2] = '\\';
|
||||
volumepathname[3] = 0;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
if (p && tolower(p[0]) >= 'a' && tolower(p[0]) <= 'z' && p[1] ==':' && p[2] == '\\' && buflen >= 4)
|
||||
{
|
||||
volumepathname[0] = p[0];
|
||||
volumepathname[1] = ':';
|
||||
volumepathname[2] = '\\';
|
||||
volumepathname[3] = 0;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVolumePathNameW_new=GetVolumePathNameW */
|
||||
|
@ -32,15 +32,15 @@
|
||||
|
||||
/* MAKE_EXPORT WideCharToMultiByte_new=WideCharToMultiByte */
|
||||
int WINAPI WideCharToMultiByte_new(
|
||||
UINT CodePage,
|
||||
DWORD dwFlags,
|
||||
LPCWSTR lpWideCharStr,
|
||||
int cchWideChar,
|
||||
LPSTR lpMultiByteStr,
|
||||
int cchMultiByte,
|
||||
LPCSTR lpDefaultChar,
|
||||
LPBOOL lpUsedDefaultChar
|
||||
)
|
||||
UINT CodePage,
|
||||
DWORD dwFlags,
|
||||
LPCWSTR lpWideCharStr,
|
||||
int cchWideChar,
|
||||
LPSTR lpMultiByteStr,
|
||||
int cchMultiByte,
|
||||
LPCSTR lpDefaultChar,
|
||||
LPBOOL lpUsedDefaultChar
|
||||
)
|
||||
{
|
||||
if (CodePage == CP_THREAD_ACP)
|
||||
CodePage = CP_ACP;
|
||||
@ -52,13 +52,13 @@ int WINAPI WideCharToMultiByte_new(
|
||||
|
||||
/* MAKE_EXPORT MultiByteToWideChar_new=MultiByteToWideChar */
|
||||
int WINAPI MultiByteToWideChar_new(
|
||||
UINT CodePage,
|
||||
DWORD dwFlags,
|
||||
LPCSTR lpMultiByteStr,
|
||||
int cchMultiByte,
|
||||
LPWSTR lpWideCharStr,
|
||||
int cchWideChar
|
||||
)
|
||||
UINT CodePage,
|
||||
DWORD dwFlags,
|
||||
LPCSTR lpMultiByteStr,
|
||||
int cchMultiByte,
|
||||
LPWSTR lpWideCharStr,
|
||||
int cchWideChar
|
||||
)
|
||||
{
|
||||
if (CodePage == CP_THREAD_ACP)
|
||||
CodePage = CP_ACP;
|
||||
|
@ -24,11 +24,11 @@
|
||||
/* MAKE_EXPORT AllowSetForegroundWindow_98=AllowSetForegroundWindow */
|
||||
BOOL WINAPI AllowSetForegroundWindow_98(DWORD procid)
|
||||
{
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT LockSetForegroundWindow_98=LockSetForegroundWindow */
|
||||
BOOL WINAPI LockSetForegroundWindow_98(UINT lockcode)
|
||||
{
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -21,23 +21,23 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* Here we have fix for retarded situation.
|
||||
* 9x stucks trying to get next control in dialog to tab
|
||||
* when there is only one control on dialog, and it has tab-able
|
||||
/* Here we have fix for retarded situation.
|
||||
* 9x stucks trying to get next control in dialog to tab
|
||||
* when there is only one control on dialog, and it has tab-able
|
||||
* child windows (WS_EX_CONTROLPARENT), and if it's disabled or hidden,
|
||||
* user.exe crashes with stack overflow, silently or soundly.
|
||||
* More proper fix would be to scan whole dialog and enable/show at least
|
||||
* one such window, since GetNextDlgTabItem also happens internally.
|
||||
* However, likely it won't be this function and our case works for
|
||||
* Winamp ML.
|
||||
* user.exe crashes with stack overflow, silently or soundly.
|
||||
* More proper fix would be to scan whole dialog and enable/show at least
|
||||
* one such window, since GetNextDlgTabItem also happens internally.
|
||||
* However, likely it won't be this function and our case works for
|
||||
* Winamp ML.
|
||||
*/
|
||||
|
||||
|
||||
/* MAKE_EXPORT GetNextDlgTabItem_fix=GetNextDlgTabItem */
|
||||
HWND WINAPI GetNextDlgTabItem_fix(
|
||||
HWND hDlg, // handle to dialog box
|
||||
HWND hCtl, // handle to known control
|
||||
BOOL bPrevious // direction flag
|
||||
HWND hDlg, // handle to dialog box
|
||||
HWND hCtl, // handle to known control
|
||||
BOOL bPrevious // direction flag
|
||||
)
|
||||
{
|
||||
HWND hTestCtl = hCtl;
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
* Copyright (C) 2010, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
@ -28,22 +29,109 @@
|
||||
#define MAPVK_VSC_TO_VK_EX 3
|
||||
#define MAPVK_VK_TO_VSC_EX 4
|
||||
|
||||
/* Scan codes for standard keyboard */
|
||||
#define VSC_LSHIFT 0x002A
|
||||
#define VSC_RSHIFT 0x0036
|
||||
#define VSC_LALT 0x0038
|
||||
#define VSC_RALT 0xE038
|
||||
#define VSC_LCONTROL 0x001D
|
||||
#define VSC_RCONTROL 0xE01D
|
||||
|
||||
/*
|
||||
From MS keyboard docs:
|
||||
Under all Microsoft operating systems, all keyboards actually transmit Scan Code Set 2 values down
|
||||
the wire from the keyboard to the keyboard port. These values are translated to Scan Code Set 1 by
|
||||
the i8042 port chip.
|
||||
The rest of the operating system, and all applications that handle scan codes
|
||||
expect the values to be from Scan Code Set 1.
|
||||
From other MS docs about USB keyboards:
|
||||
The mapper driver translates the Keyboard Page HID usages to PS/2 Set 1 scan codes and forwards them
|
||||
to the keyboard class driver.
|
||||
Nice link btw: http://www.microsoft.com/taiwan/whdc/archive/w2kbd.mspx
|
||||
|
||||
So we have guarantee AT set (Set 1) will be in scancode.
|
||||
*/
|
||||
|
||||
static inline int NoLeftRightVK(int nVirtKey)
|
||||
{
|
||||
switch(nVirtKey)
|
||||
{
|
||||
case VK_LSHIFT:
|
||||
case VK_RSHIFT:
|
||||
nVirtKey = VK_SHIFT;
|
||||
break;
|
||||
case VK_LCONTROL:
|
||||
case VK_RCONTROL:
|
||||
nVirtKey = VK_CONTROL;
|
||||
break;
|
||||
case VK_LMENU:
|
||||
case VK_RMENU:
|
||||
nVirtKey = VK_MENU;
|
||||
break;
|
||||
}
|
||||
return nVirtKey;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT MapVirtualKeyA_new=MapVirtualKeyA */
|
||||
UINT WINAPI MapVirtualKeyA_new(UINT uCode, UINT uMapType)
|
||||
{
|
||||
if (uMapType == MAPVK_VK_TO_VSC_EX)
|
||||
uMapType = MAPVK_VK_TO_VSC;
|
||||
else if (uMapType == MAPVK_VSC_TO_VK_EX)
|
||||
uMapType = MAPVK_VSC_TO_VK;
|
||||
return MapVirtualKeyA(uCode, uMapType);
|
||||
switch(uMapType) {
|
||||
case MAPVK_VK_TO_VSC_EX:
|
||||
if ( uCode == VK_RCONTROL ) return VSC_RCONTROL;
|
||||
if ( uCode == VK_RMENU ) return VSC_RALT;
|
||||
//fall down
|
||||
case MAPVK_VK_TO_VSC:
|
||||
if ( uCode == VK_RSHIFT ) return VSC_RSHIFT; //separate scan code
|
||||
return MapVirtualKeyA(NoLeftRightVK(uCode),MAPVK_VK_TO_VSC);
|
||||
case MAPVK_VSC_TO_VK_EX:
|
||||
switch(uCode) {
|
||||
case VSC_RSHIFT:
|
||||
return VK_RSHIFT;
|
||||
case VSC_LSHIFT:
|
||||
return VK_LSHIFT;
|
||||
case VSC_LCONTROL:
|
||||
return VK_LCONTROL;
|
||||
case VSC_RCONTROL:
|
||||
return VK_RCONTROL;
|
||||
case VSC_LALT:
|
||||
return VK_LMENU;
|
||||
case VSC_RALT:
|
||||
return VK_RMENU;
|
||||
default:
|
||||
uMapType = MAPVK_VSC_TO_VK;
|
||||
}
|
||||
}
|
||||
return MapVirtualKeyA(uCode,uMapType);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT MapVirtualKeyExA_new=MapVirtualKeyExA */
|
||||
UINT WINAPI MapVirtualKeyExA_new(UINT uCode, UINT uMapType, HKL dwhkl)
|
||||
{
|
||||
if (uMapType == MAPVK_VK_TO_VSC_EX)
|
||||
uMapType = MAPVK_VK_TO_VSC;
|
||||
else if (uMapType == MAPVK_VSC_TO_VK_EX)
|
||||
uMapType = MAPVK_VSC_TO_VK;
|
||||
return MapVirtualKeyExA(uCode, uMapType, dwhkl);
|
||||
switch(uMapType) {
|
||||
case MAPVK_VK_TO_VSC_EX:
|
||||
if ( uCode == VK_RCONTROL ) return VSC_RCONTROL;
|
||||
if ( uCode == VK_RMENU ) return VSC_RALT;
|
||||
//fall down
|
||||
case MAPVK_VK_TO_VSC:
|
||||
if ( uCode == VK_RSHIFT ) return VSC_RSHIFT; //separate scan code
|
||||
return MapVirtualKeyExA(NoLeftRightVK(uCode),MAPVK_VK_TO_VSC,dwhkl);
|
||||
case MAPVK_VSC_TO_VK_EX:
|
||||
switch(uCode) {
|
||||
case VSC_RSHIFT:
|
||||
return VK_RSHIFT;
|
||||
case VSC_LSHIFT:
|
||||
return VK_LSHIFT;
|
||||
case VSC_LCONTROL:
|
||||
return VK_LCONTROL;
|
||||
case VSC_RCONTROL:
|
||||
return VK_RCONTROL;
|
||||
case VSC_LALT:
|
||||
return VK_LMENU;
|
||||
case VSC_RALT:
|
||||
return VK_RMENU;
|
||||
default:
|
||||
uMapType = MAPVK_VSC_TO_VK;
|
||||
}
|
||||
}
|
||||
return MapVirtualKeyExA(uCode,uMapType,dwhkl);
|
||||
}
|
||||
|
@ -20,25 +20,7 @@
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "k32ord.h"
|
||||
#include "hwnd9x.h"
|
||||
|
||||
static DWORD g_UserBase;
|
||||
static HTOP_API HWNDtoPWND;
|
||||
|
||||
//those are in thunilay
|
||||
void GrabWin16Lock();
|
||||
void ReleaseWin16Lock();
|
||||
|
||||
#define REBASEUSER(x) ((x) != 0 ? g_UserBase + (DWORD)(x) : 0)
|
||||
|
||||
BOOL SetParent_fix_init()
|
||||
{
|
||||
g_UserBase = MapSL(LoadLibrary16("user") << 16);
|
||||
/* IsWindow returns PWND */
|
||||
HWNDtoPWND = (HTOP_API)IsWindow;
|
||||
return (g_UserBase != 0 && HWNDtoPWND != 0);
|
||||
}
|
||||
#include "thuni_layer.h"
|
||||
|
||||
/* returns TRUE if hwnd is a parent of hwndNewParent */
|
||||
static BOOL WINAPI TestChild(HWND hwnd, HWND hwndNewParent)
|
||||
|
@ -44,5 +44,15 @@ BOOL WINAPI SystemParametersInfoA_fix(
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
if (ret && uiAction == SPI_GETCARETWIDTH && pvParam)
|
||||
{
|
||||
//there's a bug in USER: default caret width is 0
|
||||
//(should be 1). although NT can be forced to set
|
||||
//caret width to 0, it's not sane so we fix this.
|
||||
DWORD* pCaretWidth = (DWORD*)pvParam;
|
||||
if (*pCaretWidth == 0)
|
||||
*pCaretWidth = 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -24,15 +24,15 @@
|
||||
|
||||
/* MAKE_EXPORT UpdateLayeredWindow_new=UpdateLayeredWindow */
|
||||
BOOL WINAPI UpdateLayeredWindow_new(
|
||||
HWND hwnd, // handle to layered window
|
||||
HDC hdcDst, // handle to screen DC
|
||||
POINT *pptDst, // new screen position
|
||||
SIZE *psize, // new size of the layered window
|
||||
HDC hdcSrc, // handle to surface DC
|
||||
POINT *pptSrc, // layer position
|
||||
COLORREF crKey, // color key
|
||||
BLENDFUNCTION *pblend, // blend function
|
||||
DWORD dwFlags // options
|
||||
HWND hwnd, // handle to layered window
|
||||
HDC hdcDst, // handle to screen DC
|
||||
POINT *pptDst, // new screen position
|
||||
SIZE *psize, // new size of the layered window
|
||||
HDC hdcSrc, // handle to surface DC
|
||||
POINT *pptSrc, // layer position
|
||||
COLORREF crKey, // color key
|
||||
BLENDFUNCTION *pblend, // blend function
|
||||
DWORD dwFlags // options
|
||||
)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
@ -38,7 +38,7 @@ BOOL init_user32()
|
||||
GetMouseMovePoints_pfn = (GetMouseMovePoints_t)kexGetProcAddress(hUser32, "GetMouseMovePoints");
|
||||
|
||||
return IsHungThread_pfn && DrawCaptionTempA_pfn && GetMouseMovePoints_pfn
|
||||
&& InitUniThunkLayer() && SetParent_fix_init();
|
||||
&& InitUniThunkLayer();
|
||||
}
|
||||
|
||||
/* APIs which don't require Unicode implementations in thuni model
|
||||
|
@ -65,17 +65,16 @@ typedef struct _WND
|
||||
WORD classAtom; // 56h See also offs. 2 in the field 24 struct ptr
|
||||
} WND, *PWND;
|
||||
|
||||
|
||||
typedef struct _MSGQUEUE
|
||||
{
|
||||
WORD nextQueue; // 00h next queue in the list
|
||||
WORD hTask; // 02h Task that this queue is associated with
|
||||
WORD headMsg; // 04h Near ptr to head of linked list of QUEUEMSGs
|
||||
WORD tailMsg; // 06h Near ptr to end of list of QUEUEMSGs
|
||||
WORD lastMsg; // 08h Near ptr to last msg retrieved (not really!)
|
||||
WORD cMsgs; // 0Ah Number of messages (not really for win98?)
|
||||
WORD cMsgs; // 08h Number of posted messages (98,Me)
|
||||
WORD nilword; // 0Ah ???
|
||||
BYTE un1; // 0Ch ???
|
||||
BYTE sig[3]; // 0Dh "MJT" (Jon Thomason?)
|
||||
BYTE sig[3]; // 0Dh "MJT" (Michael Jackson ..??)
|
||||
WORD npPerQueue; // 10h 16 bit offset in USER DGROUP to PERQUEUEDATA
|
||||
// type == LT_USER_VWININFO???
|
||||
WORD un2; // 12h ???
|
||||
@ -87,7 +86,9 @@ typedef struct _MSGQUEUE
|
||||
WORD un4; // 2Ch ??? (seems to always be 0)
|
||||
WORD lastMsg2; // 2Eh Near ptr to last retrieved QUEUEMSG
|
||||
DWORD extraInfo; // 30h returned by GetMessageExtraInfo()
|
||||
DWORD un5[2]; // 34h ???
|
||||
DWORD un5; // 34h ???
|
||||
WORD cQuit; // 38h PostQuitMessage
|
||||
WORD exitCode; // 3Ah same
|
||||
DWORD threadId; // 3Ch See GetWindowProcessThreadId
|
||||
WORD un6; // 40h ??
|
||||
WORD expWinVer; // 42h Version of Windows this app expects
|
||||
@ -98,7 +99,8 @@ typedef struct _MSGQUEUE
|
||||
// waiting for
|
||||
WORD un8; // 4Eh ???
|
||||
WORD hQueueSend; // 50h App that's in SendMessage to this queue
|
||||
DWORD un9; // 52h ???
|
||||
WORD hSMS; // 52h SMS (inter-thread sendmessage) struct ptr
|
||||
WORD dunno; // 54h ???
|
||||
WORD sig2; // 56h "HQ"
|
||||
HKL hkl; // 58h current thread HKL (keyboard layout)
|
||||
DWORD un10[3]; // 5Ch ??? filler
|
||||
@ -107,8 +109,38 @@ typedef struct _MSGQUEUE
|
||||
DWORD un12[3]; // 5Eh+0Ah+4 ??? filler
|
||||
WORD block2; // 5Eh+1Ah block for SendMessageA (event?)
|
||||
} MSGQUEUE, *PMSGQUEUE;
|
||||
|
||||
typedef struct _PERQUEUEDATA
|
||||
{
|
||||
WORD npNext; // 00h a USER heap handle (type == LT_USER_VWININFO)
|
||||
WORD un2; // 02h
|
||||
WORD wSumFlags; // 04h
|
||||
WORD npQMsg; // 06h type == LT_USER_QMSG
|
||||
WORD un5; // 08h
|
||||
WORD un6; // 0Ah
|
||||
WORD un7; // 0Ch
|
||||
WORD un8; // 0Eh
|
||||
WORD un9; // 10h
|
||||
WORD un10; // 12h
|
||||
WORD somehQueue1; // 14h a msg queue handle
|
||||
WORD somehQueue2; // 16h a msg queue handle
|
||||
DWORD hWndCapture; // 18h
|
||||
DWORD hWndFocus; // 1Ch
|
||||
DWORD hWndActive; // 20h
|
||||
BYTE filler[0x34]; // 24h
|
||||
DWORD keysbuffer; // 58h 16:16 keyboard state ptr
|
||||
} PERQUEUEDATA, *PPERQUEUEDATA;
|
||||
|
||||
typedef struct _QUEUEKEYBUFFER
|
||||
{
|
||||
BYTE filler[0x20]; // 00h sth
|
||||
BYTE keystate[0xFF]; // 20h keys state (0x80-pressed, 0x1-toggled)
|
||||
} QUEUEKEYBUFFER, *PQUEUEKEYBUFFER;
|
||||
|
||||
|
||||
#pragma pack()
|
||||
|
||||
typedef PWND (WINAPI *HTOP_API) (HWND hwnd);
|
||||
/* IsWindow returns PWND */
|
||||
#define HWNDtoPWND(hwnd) (PWND)IsWindow(hwnd)
|
||||
|
||||
#endif
|
||||
|
@ -36,8 +36,8 @@
|
||||
/* MAKE_EXPORT CharNextExW_new=CharNextExW */
|
||||
LPWSTR WINAPI CharNextExW_new( WORD codepage, LPCWSTR ptr, DWORD flags )
|
||||
{
|
||||
/* doesn't make sense, there are no codepages for Unicode */
|
||||
return NULL;
|
||||
/* doesn't make sense, there are no codepages for Unicode */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -47,9 +47,9 @@ LPWSTR WINAPI CharNextExW_new( WORD codepage, LPCWSTR ptr, DWORD flags )
|
||||
/* MAKE_EXPORT CharNextW_new=CharNextW */
|
||||
LPWSTR WINAPI CharNextW_new(LPCWSTR x)
|
||||
{
|
||||
if (*x) x++;
|
||||
if (*x) x++;
|
||||
|
||||
return (LPWSTR)x;
|
||||
return (LPWSTR)x;
|
||||
}
|
||||
|
||||
|
||||
@ -59,8 +59,8 @@ LPWSTR WINAPI CharNextW_new(LPCWSTR x)
|
||||
/* MAKE_EXPORT CharPrevExW_new=CharPrevExW */
|
||||
LPSTR WINAPI CharPrevExW_new( WORD codepage, LPCWSTR start, LPCWSTR ptr, DWORD flags )
|
||||
{
|
||||
/* doesn't make sense, there are no codepages for Unicode */
|
||||
return NULL;
|
||||
/* doesn't make sense, there are no codepages for Unicode */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -70,8 +70,8 @@ LPSTR WINAPI CharPrevExW_new( WORD codepage, LPCWSTR start, LPCWSTR ptr, DWORD f
|
||||
/* MAKE_EXPORT CharPrevW_new=CharPrevW */
|
||||
LPWSTR WINAPI CharPrevW_new(LPCWSTR start,LPCWSTR x)
|
||||
{
|
||||
if (x>start) return (LPWSTR)(x-1);
|
||||
else return (LPWSTR)x;
|
||||
if (x>start) return (LPWSTR)(x-1);
|
||||
else return (LPWSTR)x;
|
||||
}
|
||||
|
||||
|
||||
@ -81,9 +81,9 @@ LPWSTR WINAPI CharPrevW_new(LPCWSTR start,LPCWSTR x)
|
||||
/* MAKE_EXPORT CharToOemBuffW_new=CharToOemBuffW */
|
||||
BOOL WINAPI CharToOemBuffW_new( LPCWSTR s, LPSTR d, DWORD len )
|
||||
{
|
||||
if ( !s || !d ) return TRUE;
|
||||
WideCharToMultiByte( CP_OEMCP, 0, s, len, d, len, NULL, NULL );
|
||||
return TRUE;
|
||||
if ( !s || !d ) return TRUE;
|
||||
WideCharToMultiByte( CP_OEMCP, 0, s, len, d, len, NULL, NULL );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ BOOL WINAPI CharToOemBuffW_new( LPCWSTR s, LPSTR d, DWORD len )
|
||||
/* MAKE_EXPORT CharToOemW_new=CharToOemW */
|
||||
BOOL WINAPI CharToOemW_new( LPCWSTR s, LPSTR d )
|
||||
{
|
||||
return CharToOemBuffW_new( s, d, strlenW( s ) + 1 );
|
||||
return CharToOemBuffW_new( s, d, strlenW( s ) + 1 );
|
||||
}
|
||||
|
||||
|
||||
@ -103,8 +103,8 @@ BOOL WINAPI CharToOemW_new( LPCWSTR s, LPSTR d )
|
||||
/* MAKE_EXPORT OemToCharBuffW_new=OemToCharBuffW */
|
||||
BOOL WINAPI OemToCharBuffW_new( LPCSTR s, LPWSTR d, DWORD len )
|
||||
{
|
||||
MultiByteToWideChar( CP_OEMCP, 0, s, len, d, len );
|
||||
return TRUE;
|
||||
MultiByteToWideChar( CP_OEMCP, 0, s, len, d, len );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ BOOL WINAPI OemToCharBuffW_new( LPCSTR s, LPWSTR d, DWORD len )
|
||||
/* MAKE_EXPORT OemToCharW_new=OemToCharW */
|
||||
BOOL WINAPI OemToCharW_new( LPCSTR s, LPWSTR d )
|
||||
{
|
||||
return OemToCharBuffW_new( s, d, strlen( s ) + 1 );
|
||||
return OemToCharBuffW_new( s, d, strlen( s ) + 1 );
|
||||
}
|
||||
|
||||
|
||||
@ -124,8 +124,8 @@ BOOL WINAPI OemToCharW_new( LPCSTR s, LPWSTR d )
|
||||
/* MAKE_EXPORT CharLowerW_new=CharLowerW */
|
||||
LPWSTR WINAPI CharLowerW_new(LPWSTR x)
|
||||
{
|
||||
if (HIWORD(x)) return strlwrW(x);
|
||||
else return (LPWSTR)((UINT_PTR)tolowerW(LOWORD(x)));
|
||||
if (HIWORD(x)) return strlwrW(x);
|
||||
else return (LPWSTR)((UINT_PTR)tolowerW(LOWORD(x)));
|
||||
}
|
||||
|
||||
|
||||
@ -135,8 +135,8 @@ LPWSTR WINAPI CharLowerW_new(LPWSTR x)
|
||||
/* MAKE_EXPORT CharUpperW_new=CharUpperW */
|
||||
LPWSTR WINAPI CharUpperW_new(LPWSTR x)
|
||||
{
|
||||
if (HIWORD(x)) return struprW(x);
|
||||
else return (LPWSTR)((UINT_PTR)toupperW(LOWORD(x)));
|
||||
if (HIWORD(x)) return struprW(x);
|
||||
else return (LPWSTR)((UINT_PTR)toupperW(LOWORD(x)));
|
||||
}
|
||||
|
||||
|
||||
@ -146,10 +146,10 @@ LPWSTR WINAPI CharUpperW_new(LPWSTR x)
|
||||
/* MAKE_EXPORT CharLowerBuffW_new=CharLowerBuffW */
|
||||
DWORD WINAPI CharLowerBuffW_new( LPWSTR str, DWORD len )
|
||||
{
|
||||
DWORD ret = len;
|
||||
if (!str) return 0; /* YES */
|
||||
for (; len; len--, str++) *str = tolowerW(*str);
|
||||
return ret;
|
||||
DWORD ret = len;
|
||||
if (!str) return 0; /* YES */
|
||||
for (; len; len--, str++) *str = tolowerW(*str);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -159,10 +159,10 @@ DWORD WINAPI CharLowerBuffW_new( LPWSTR str, DWORD len )
|
||||
/* MAKE_EXPORT CharUpperBuffW_new=CharUpperBuffW */
|
||||
DWORD WINAPI CharUpperBuffW_new( LPWSTR str, DWORD len )
|
||||
{
|
||||
DWORD ret = len;
|
||||
if (!str) return 0; /* YES */
|
||||
for (; len; len--, str++) *str = toupperW(*str);
|
||||
return ret;
|
||||
DWORD ret = len;
|
||||
if (!str) return 0; /* YES */
|
||||
for (; len; len--, str++) *str = toupperW(*str);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -172,7 +172,7 @@ DWORD WINAPI CharUpperBuffW_new( LPWSTR str, DWORD len )
|
||||
/* MAKE_EXPORT IsCharLowerW_new=IsCharLowerW */
|
||||
BOOL WINAPI IsCharLowerW_new(WCHAR x)
|
||||
{
|
||||
return (get_char_typeW(x) & C1_LOWER) != 0;
|
||||
return (get_char_typeW(x) & C1_LOWER) != 0;
|
||||
}
|
||||
|
||||
|
||||
@ -182,7 +182,7 @@ BOOL WINAPI IsCharLowerW_new(WCHAR x)
|
||||
/* MAKE_EXPORT IsCharUpperW_new=IsCharUpperW */
|
||||
BOOL WINAPI IsCharUpperW_new(WCHAR x)
|
||||
{
|
||||
return (get_char_typeW(x) & C1_UPPER) != 0;
|
||||
return (get_char_typeW(x) & C1_UPPER) != 0;
|
||||
}
|
||||
|
||||
|
||||
@ -192,7 +192,7 @@ BOOL WINAPI IsCharUpperW_new(WCHAR x)
|
||||
/* MAKE_EXPORT IsCharAlphaNumericW_new=IsCharAlphaNumericW */
|
||||
BOOL WINAPI IsCharAlphaNumericW_new(WCHAR x)
|
||||
{
|
||||
return (get_char_typeW(x) & (C1_ALPHA|C1_DIGIT)) != 0;
|
||||
return (get_char_typeW(x) & (C1_ALPHA|C1_DIGIT)) != 0;
|
||||
}
|
||||
|
||||
|
||||
@ -202,5 +202,5 @@ BOOL WINAPI IsCharAlphaNumericW_new(WCHAR x)
|
||||
/* MAKE_EXPORT IsCharAlphaW_new=IsCharAlphaW */
|
||||
BOOL WINAPI IsCharAlphaW_new(WCHAR x)
|
||||
{
|
||||
return (get_char_typeW(x) & C1_ALPHA) != 0;
|
||||
return (get_char_typeW(x) & C1_ALPHA) != 0;
|
||||
}
|
||||
|
@ -26,47 +26,6 @@
|
||||
#include "thuni_macro.h"
|
||||
#include "thuni_thunk.h"
|
||||
|
||||
|
||||
__declspec(naked)
|
||||
LRESULT WINAPI CallWindowProc_stdcall( WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
__asm {
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push edi
|
||||
push esi
|
||||
push ebx
|
||||
sub esp, 12
|
||||
push [ebp+24]
|
||||
push [ebp+20]
|
||||
push [ebp+16]
|
||||
push [ebp+12]
|
||||
mov eax, [ebp+8]
|
||||
call eax
|
||||
lea esp, [ebp-12]
|
||||
pop ebx
|
||||
pop esi
|
||||
pop edi
|
||||
leave
|
||||
ret 20
|
||||
}
|
||||
}
|
||||
|
||||
int GetCPFromLocale(LCID Locale)
|
||||
{
|
||||
int cp;
|
||||
Locale = LOWORD(Locale);
|
||||
if (GetLocaleInfoA(Locale,LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,(LPSTR)&cp,sizeof(int)))
|
||||
return cp;
|
||||
else
|
||||
return CP_ACP;
|
||||
}
|
||||
|
||||
static UINT GetCurrentKeyboardCP()
|
||||
{
|
||||
return GetCPFromLocale((LCID)GetKeyboardLayout(0));
|
||||
}
|
||||
|
||||
WPARAM wparam_AtoW( HWND hwnd, UINT message, WPARAM wParam, BOOL messDBCS )
|
||||
{
|
||||
WPARAM newwParam = wParam;
|
||||
@ -441,4 +400,3 @@ LRESULT WINAPI CallProcUnicodeWithAnsi( WNDPROC callback, HWND hwnd, UINT msg, W
|
||||
}
|
||||
return CallWindowProc_stdcall(callback,hwnd,msg,wParam,lParam);
|
||||
}
|
||||
|
||||
|
@ -22,45 +22,18 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include "k32ord.h"
|
||||
#include "thuni_thunk.h"
|
||||
#include "thuni_layer.h"
|
||||
#include "thuni_macro.h"
|
||||
|
||||
static GCQ_API GetCurrentThreadQueue;
|
||||
static HTOP_API HWNDtoPWND;
|
||||
|
||||
static LPCRITICAL_SECTION pWin16Mutex;
|
||||
static CRITICAL_SECTION wndproc_cs;
|
||||
|
||||
static HMODULE g_hUser32;
|
||||
|
||||
#define SetWinCreateEvent(proc) SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_CREATE, g_hUser32, \
|
||||
(WINEVENTPROC)(proc), GetCurrentProcessId(), GetCurrentThreadId(), WINEVENT_INCONTEXT)
|
||||
|
||||
BOOL InitUniThunkLayer()
|
||||
{
|
||||
g_hUser32 = GetModuleHandleA("user32");
|
||||
/* Returns current thread hQueue 32-bit pointer */
|
||||
GetCurrentThreadQueue = (GCQ_API) RELTOABS( (DWORD)GetMessageExtraInfo + 7 );
|
||||
/* IsWindow returns PWND */
|
||||
HWNDtoPWND = (HTOP_API)IsWindow;
|
||||
|
||||
_GetpWin16Lock( &pWin16Mutex );
|
||||
InitializeCriticalSection( &wndproc_cs );
|
||||
MakeCriticalSectionGlobal( &wndproc_cs );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void GrabWin16Lock()
|
||||
{
|
||||
_EnterSysLevel(pWin16Mutex);
|
||||
}
|
||||
|
||||
void ReleaseWin16Lock()
|
||||
{
|
||||
_LeaveSysLevel(pWin16Mutex);
|
||||
return InitUniThunkLayerStuff();
|
||||
}
|
||||
|
||||
static WNDPROC WINAPI _GetWindowProc32(PWND pwnd)
|
||||
|
@ -1,14 +1,9 @@
|
||||
#include "k32ord.h"
|
||||
#include "hwnd9x.h"
|
||||
|
||||
static const char c_szDBCSProp[]="kexDBCS";
|
||||
|
||||
|
||||
static DWORD GetWindowProcessId( HWND hwnd )
|
||||
{
|
||||
DWORD procID = 0;
|
||||
GetWindowThreadProcessId( hwnd, &procID );
|
||||
return procID;
|
||||
}
|
||||
#define REBASEUSER(x) ((x) != 0 ? g_UserBase + (DWORD)(x) : 0)
|
||||
|
||||
#define ISOURPROCESSHWND(hwnd) ( GetWindowProcessId(hwnd) == GetCurrentProcessId() )
|
||||
#define IS_SHARED(x) (((DWORD)x) & 0x80000000)
|
||||
@ -20,29 +15,41 @@ static DWORD GetWindowProcessId( HWND hwnd )
|
||||
#define IS32BITWIN(pwnd) (pwnd->dwFlags & WF_EX_WIN32)
|
||||
#define ISDIALOG(pwnd) (pwnd->moreFlags & WF_M_DIALOG)
|
||||
|
||||
typedef PMSGQUEUE (WINAPI *GCQ_API) ();
|
||||
|
||||
#define RELTOABS(x) ( (DWORD)(x) + *(DWORD*)(x) + 4 )
|
||||
|
||||
int GetCPFromLocale(LCID Locale);
|
||||
#define SetWinCreateEvent(proc) SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_CREATE, g_hUser32, \
|
||||
(WINEVENTPROC)(proc), GetCurrentProcessId(), GetCurrentThreadId(), WINEVENT_INCONTEXT)
|
||||
|
||||
//stuff
|
||||
extern DWORD g_UserBase;
|
||||
extern HMODULE g_hUser32;
|
||||
BOOL InitUniThunkLayerStuff();
|
||||
void GrabWin16Lock();
|
||||
void ReleaseWin16Lock();
|
||||
DWORD GetWindowProcessId( HWND hwnd );
|
||||
LRESULT WINAPI CallWindowProc_stdcall( WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
int GetCPFromLocale(LCID Locale);
|
||||
UINT GetCurrentKeyboardCP();
|
||||
PMSGQUEUE GetCurrentThreadQueue();
|
||||
void UpdateLRKeyState(LPMSG msg);
|
||||
|
||||
//conv
|
||||
WPARAM wparam_AtoW( HWND hwnd, UINT message, WPARAM wParam, BOOL messDBCS );
|
||||
WPARAM wparam_WtoA( UINT message, WPARAM wParam );
|
||||
|
||||
LRESULT WINAPI CallProcUnicodeWithAnsi( WNDPROC callback, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT WINAPI CallProcAnsiWithUnicode( WNDPROC callback, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
//proc
|
||||
LRESULT WINAPI DefWindowProcW_NEW( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT WINAPI DefDlgProcW_NEW( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT WINAPI DefMDIChildProcW_NEW( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
//layer
|
||||
BOOL IsWindowReallyUnicode(HWND hwnd);
|
||||
BOOL WINAPI IsWindowUnicode_NEW( HWND hWnd );
|
||||
BOOL InitUniThunkLayer();
|
||||
|
||||
//sendmessage_fix
|
||||
LRESULT WINAPI SendMessageA_fix(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
BOOL InitUniThunkLayer();
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* KernelEx
|
||||
*
|
||||
* Copyright (C) 2009, Tihiy
|
||||
* Copyright (C) 2009-2010, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
@ -119,7 +119,10 @@ BOOL WINAPI GetMessageA_NEW( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wM
|
||||
if ( !lpMsg ) return -1; //9x fails to check that
|
||||
ret = GetMessageA( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax );
|
||||
if ( ret && ((lpMsg->message>=WM_KEYFIRST && lpMsg->message<=WM_KEYLAST)||(lpMsg->message>=WM_MOUSEFIRST && lpMsg->message<=WM_MOUSELAST)) )
|
||||
{
|
||||
g_LastInputTime = GetTickCount();
|
||||
UpdateLRKeyState(lpMsg);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -130,7 +133,10 @@ BOOL WINAPI PeekMessageA_NEW( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT w
|
||||
if ( !lpMsg ) return FALSE; //9x fails to check that
|
||||
ret = PeekMessageA( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg );
|
||||
if ( ret && ((lpMsg->message>=WM_KEYFIRST && lpMsg->message<=WM_KEYLAST)||(lpMsg->message>=WM_MOUSEFIRST && lpMsg->message<=WM_MOUSELAST)) )
|
||||
{
|
||||
g_LastInputTime = GetTickCount();
|
||||
UpdateLRKeyState(lpMsg);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
165
apilibs/kexbases/User32/thuni_stuff.c
Executable file
165
apilibs/kexbases/User32/thuni_stuff.c
Executable file
@ -0,0 +1,165 @@
|
||||
/*
|
||||
* KernelEx
|
||||
*
|
||||
* Copyright (C) 2010, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/* various thuni routines here */
|
||||
|
||||
#include <windows.h>
|
||||
#include "thuni_layer.h"
|
||||
|
||||
static LPCRITICAL_SECTION pWin16Mutex;
|
||||
DWORD g_UserBase;
|
||||
HMODULE g_hUser32;
|
||||
|
||||
BOOL InitUniThunkLayerStuff()
|
||||
{
|
||||
_GetpWin16Lock( &pWin16Mutex );
|
||||
g_UserBase = MapSL(LoadLibrary16("user") << 16);
|
||||
g_hUser32 = GetModuleHandleA("user32");
|
||||
|
||||
return (g_UserBase && g_hUser32);
|
||||
}
|
||||
|
||||
void GrabWin16Lock()
|
||||
{
|
||||
_EnterSysLevel(pWin16Mutex);
|
||||
}
|
||||
|
||||
void ReleaseWin16Lock()
|
||||
{
|
||||
_LeaveSysLevel(pWin16Mutex);
|
||||
}
|
||||
|
||||
DWORD GetWindowProcessId( HWND hwnd )
|
||||
{
|
||||
DWORD procID = 0;
|
||||
GetWindowThreadProcessId( hwnd, &procID );
|
||||
return procID;
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
LRESULT WINAPI CallWindowProc_stdcall( WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
__asm {
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push edi
|
||||
push esi
|
||||
push ebx
|
||||
sub esp, 12
|
||||
push [ebp+24]
|
||||
push [ebp+20]
|
||||
push [ebp+16]
|
||||
push [ebp+12]
|
||||
mov eax, [ebp+8]
|
||||
call eax
|
||||
lea esp, [ebp-12]
|
||||
pop ebx
|
||||
pop esi
|
||||
pop edi
|
||||
leave
|
||||
ret 20
|
||||
}
|
||||
}
|
||||
|
||||
int GetCPFromLocale(LCID Locale)
|
||||
{
|
||||
int cp;
|
||||
Locale = LOWORD(Locale);
|
||||
if (GetLocaleInfoA(Locale,LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,(LPSTR)&cp,sizeof(int)))
|
||||
return cp;
|
||||
else
|
||||
return CP_ACP;
|
||||
}
|
||||
|
||||
UINT GetCurrentKeyboardCP()
|
||||
{
|
||||
return GetCPFromLocale((LCID)GetKeyboardLayout(0));
|
||||
}
|
||||
|
||||
#pragma warning (disable:4035)
|
||||
static inline
|
||||
WORD GetCurrentThreadhQueue()
|
||||
{
|
||||
__asm mov ax, fs:[28h]
|
||||
}
|
||||
#pragma warning (default:4035)
|
||||
|
||||
PMSGQUEUE GetCurrentThreadQueue()
|
||||
{
|
||||
return (PMSGQUEUE)MapSL( GetCurrentThreadhQueue() << 16 );
|
||||
}
|
||||
|
||||
//per-thread keyboard state
|
||||
static PQUEUEKEYBUFFER GetCurrentThreadKeyBuffer()
|
||||
{
|
||||
PMSGQUEUE msgq = GetCurrentThreadQueue();
|
||||
if (!msgq) return NULL;
|
||||
PPERQUEUEDATA queuedata = (PPERQUEUEDATA)REBASEUSER(msgq->npPerQueue);
|
||||
if (!queuedata) return NULL;
|
||||
return (PQUEUEKEYBUFFER)MapSL(queuedata->keysbuffer);
|
||||
}
|
||||
|
||||
void UpdateLRKeyState(LPMSG msg)
|
||||
{
|
||||
switch(msg->message) {
|
||||
case WM_KEYDOWN:
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_SYSKEYUP:
|
||||
if (msg->wParam == VK_SHIFT)
|
||||
{
|
||||
PQUEUEKEYBUFFER keybuffer = GetCurrentThreadKeyBuffer();
|
||||
if (keybuffer)
|
||||
{
|
||||
BYTE scancode = LOBYTE(HIWORD(msg->lParam));
|
||||
if ( scancode == MapVirtualKey(VK_SHIFT,0) ) //left shift
|
||||
keybuffer->keystate[VK_LSHIFT] = keybuffer->keystate[VK_SHIFT];
|
||||
else
|
||||
keybuffer->keystate[VK_RSHIFT] = keybuffer->keystate[VK_SHIFT];
|
||||
}
|
||||
}
|
||||
else if (msg->wParam == VK_CONTROL)
|
||||
{
|
||||
PQUEUEKEYBUFFER keybuffer = GetCurrentThreadKeyBuffer();
|
||||
if (keybuffer)
|
||||
{
|
||||
if ( msg->lParam & 0x1000000 ) //extended bit -> right
|
||||
keybuffer->keystate[VK_RCONTROL] = keybuffer->keystate[VK_CONTROL];
|
||||
else
|
||||
keybuffer->keystate[VK_LCONTROL] = keybuffer->keystate[VK_CONTROL];
|
||||
}
|
||||
}
|
||||
else if (msg->wParam == VK_MENU)
|
||||
{
|
||||
PQUEUEKEYBUFFER keybuffer = GetCurrentThreadKeyBuffer();
|
||||
if (keybuffer)
|
||||
{
|
||||
if ( msg->lParam & 0x1000000 ) //extended bit -> right
|
||||
keybuffer->keystate[VK_RMENU] = keybuffer->keystate[VK_MENU];
|
||||
else
|
||||
keybuffer->keystate[VK_LMENU] = keybuffer->keystate[VK_MENU];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,8 @@
|
||||
/* MAKE_EXPORT DrawCaptionTempW_new=DrawCaptionTempW */
|
||||
BOOL WINAPI DrawCaptionTempW_new(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon, LPCWSTR strW, UINT uFlags)
|
||||
{
|
||||
if (!(uFlags & DC_TEXT) || !strW)
|
||||
return DrawCaptionTempA_pfn(hwnd, hdc, rect, hFont, hIcon, (LPCSTR)strW, uFlags);
|
||||
if (!(uFlags & DC_TEXT) || !strW)
|
||||
return DrawCaptionTempA_pfn(hwnd, hdc, rect, hFont, hIcon, (LPCSTR)strW, uFlags);
|
||||
else
|
||||
{
|
||||
ALLOC_WtoA(str);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -137,6 +137,10 @@ SOURCE=.\Kernel32\FileApis_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\FindFirstFileEx.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\GetConsoleWindow.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -317,10 +321,6 @@ SOURCE=.\User32\GetNextDlgTabItem_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\hwnd9x.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\IsHungAppWindow.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -377,6 +377,10 @@ SOURCE=.\User32\thuni_proc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\thuni_stuff.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\thuni_thunk.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -409,6 +413,10 @@ SOURCE=.\Gdi32\_gdi32_stubs.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Gdi32\EnumFont.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Gdi32\FontResourceEx.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -668,6 +676,10 @@ SOURCE=..\..\common\common.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\hwnd9x.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\k32ord.def
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
|
@ -56,149 +56,149 @@
|
||||
/* MAKE_EXPORT CommandLineToArgvW_new=CommandLineToArgvW */
|
||||
LPWSTR* WINAPI CommandLineToArgvW_new(LPCWSTR lpCmdline, int* numargs)
|
||||
{
|
||||
DWORD argc;
|
||||
LPWSTR *argv;
|
||||
LPCWSTR cs;
|
||||
LPWSTR arg,s,d;
|
||||
LPWSTR cmdline;
|
||||
int in_quotes,bcount;
|
||||
DWORD argc;
|
||||
LPWSTR *argv;
|
||||
LPCWSTR cs;
|
||||
LPWSTR arg,s,d;
|
||||
LPWSTR cmdline;
|
||||
int in_quotes,bcount;
|
||||
|
||||
if (*lpCmdline==0)
|
||||
{
|
||||
/* Return the path to the executable */
|
||||
DWORD len, size=16;
|
||||
if (*lpCmdline==0)
|
||||
{
|
||||
/* Return the path to the executable */
|
||||
DWORD len, size=16;
|
||||
|
||||
argv=(LPWSTR*)LocalAlloc(LMEM_FIXED, size);
|
||||
for (;;)
|
||||
{
|
||||
len = GetModuleFileNameW_new(0, (LPWSTR)(argv+1), (size-sizeof(LPWSTR))/sizeof(WCHAR));
|
||||
if (!len)
|
||||
{
|
||||
LocalFree(argv);
|
||||
return NULL;
|
||||
}
|
||||
if (len < size) break;
|
||||
size*=2;
|
||||
argv=(LPWSTR*)LocalReAlloc(argv, size, 0);
|
||||
}
|
||||
argv[0]=(LPWSTR)(argv+1);
|
||||
if (numargs)
|
||||
*numargs=2;
|
||||
argv=(LPWSTR*)LocalAlloc(LMEM_FIXED, size);
|
||||
for (;;)
|
||||
{
|
||||
len = GetModuleFileNameW_new(0, (LPWSTR)(argv+1), (size-sizeof(LPWSTR))/sizeof(WCHAR));
|
||||
if (!len)
|
||||
{
|
||||
LocalFree(argv);
|
||||
return NULL;
|
||||
}
|
||||
if (len < size) break;
|
||||
size*=2;
|
||||
argv=(LPWSTR*)LocalReAlloc(argv, size, 0);
|
||||
}
|
||||
argv[0]=(LPWSTR)(argv+1);
|
||||
if (numargs)
|
||||
*numargs=2;
|
||||
|
||||
return argv;
|
||||
}
|
||||
return argv;
|
||||
}
|
||||
|
||||
/* to get a writable copy */
|
||||
argc=0;
|
||||
bcount=0;
|
||||
in_quotes=0;
|
||||
cs=lpCmdline;
|
||||
while (1)
|
||||
{
|
||||
if (*cs==0 || ((*cs==0x0009 || *cs==0x0020) && !in_quotes))
|
||||
{
|
||||
/* space */
|
||||
argc++;
|
||||
/* skip the remaining spaces */
|
||||
while (*cs==0x0009 || *cs==0x0020) {
|
||||
cs++;
|
||||
}
|
||||
if (*cs==0)
|
||||
break;
|
||||
bcount=0;
|
||||
continue;
|
||||
}
|
||||
else if (*cs==0x005c)
|
||||
{
|
||||
/* '\', count them */
|
||||
bcount++;
|
||||
}
|
||||
else if ((*cs==0x0022) && ((bcount & 1)==0))
|
||||
{
|
||||
/* unescaped '"' */
|
||||
in_quotes=!in_quotes;
|
||||
bcount=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* a regular character */
|
||||
bcount=0;
|
||||
}
|
||||
cs++;
|
||||
}
|
||||
/* Allocate in a single lump, the string array, and the strings that go with it.
|
||||
* This way the caller can make a single GlobalFree call to free both, as per MSDN.
|
||||
*/
|
||||
argv=(LPWSTR*)LocalAlloc(LMEM_FIXED, argc*sizeof(LPWSTR)+(lstrlenW(lpCmdline)+1)*sizeof(WCHAR));
|
||||
if (!argv)
|
||||
return NULL;
|
||||
cmdline=(LPWSTR)(argv+argc);
|
||||
lstrcpyW(cmdline, lpCmdline);
|
||||
/* to get a writable copy */
|
||||
argc=0;
|
||||
bcount=0;
|
||||
in_quotes=0;
|
||||
cs=lpCmdline;
|
||||
while (1)
|
||||
{
|
||||
if (*cs==0 || ((*cs==0x0009 || *cs==0x0020) && !in_quotes))
|
||||
{
|
||||
/* space */
|
||||
argc++;
|
||||
/* skip the remaining spaces */
|
||||
while (*cs==0x0009 || *cs==0x0020) {
|
||||
cs++;
|
||||
}
|
||||
if (*cs==0)
|
||||
break;
|
||||
bcount=0;
|
||||
continue;
|
||||
}
|
||||
else if (*cs==0x005c)
|
||||
{
|
||||
/* '\', count them */
|
||||
bcount++;
|
||||
}
|
||||
else if ((*cs==0x0022) && ((bcount & 1)==0))
|
||||
{
|
||||
/* unescaped '"' */
|
||||
in_quotes=!in_quotes;
|
||||
bcount=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* a regular character */
|
||||
bcount=0;
|
||||
}
|
||||
cs++;
|
||||
}
|
||||
/* Allocate in a single lump, the string array, and the strings that go with it.
|
||||
* This way the caller can make a single GlobalFree call to free both, as per MSDN.
|
||||
*/
|
||||
argv=(LPWSTR*)LocalAlloc(LMEM_FIXED, argc*sizeof(LPWSTR)+(lstrlenW(lpCmdline)+1)*sizeof(WCHAR));
|
||||
if (!argv)
|
||||
return NULL;
|
||||
cmdline=(LPWSTR)(argv+argc);
|
||||
lstrcpyW(cmdline, lpCmdline);
|
||||
|
||||
argc=0;
|
||||
bcount=0;
|
||||
in_quotes=0;
|
||||
arg=d=s=cmdline;
|
||||
while (*s)
|
||||
{
|
||||
if ((*s==0x0009 || *s==0x0020) && !in_quotes)
|
||||
{
|
||||
/* Close the argument and copy it */
|
||||
*d=0;
|
||||
argv[argc++]=arg;
|
||||
argc=0;
|
||||
bcount=0;
|
||||
in_quotes=0;
|
||||
arg=d=s=cmdline;
|
||||
while (*s)
|
||||
{
|
||||
if ((*s==0x0009 || *s==0x0020) && !in_quotes)
|
||||
{
|
||||
/* Close the argument and copy it */
|
||||
*d=0;
|
||||
argv[argc++]=arg;
|
||||
|
||||
/* skip the remaining spaces */
|
||||
do {
|
||||
s++;
|
||||
} while (*s==0x0009 || *s==0x0020);
|
||||
/* skip the remaining spaces */
|
||||
do {
|
||||
s++;
|
||||
} while (*s==0x0009 || *s==0x0020);
|
||||
|
||||
/* Start with a new argument */
|
||||
arg=d=s;
|
||||
bcount=0;
|
||||
}
|
||||
else if (*s==0x005c)
|
||||
{
|
||||
/* '\\' */
|
||||
*d++=*s++;
|
||||
bcount++;
|
||||
}
|
||||
else if (*s==0x0022)
|
||||
{
|
||||
/* '"' */
|
||||
if ((bcount & 1)==0)
|
||||
{
|
||||
/* Preceded by an even number of '\', this is half that
|
||||
* number of '\', plus a quote which we erase.
|
||||
*/
|
||||
d-=bcount/2;
|
||||
in_quotes=!in_quotes;
|
||||
s++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Preceded by an odd number of '\', this is half that
|
||||
* number of '\' followed by a '"'
|
||||
*/
|
||||
d=d-bcount/2-1;
|
||||
*d++='"';
|
||||
s++;
|
||||
}
|
||||
bcount=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* a regular character */
|
||||
*d++=*s++;
|
||||
bcount=0;
|
||||
}
|
||||
}
|
||||
if (*arg)
|
||||
{
|
||||
*d='\0';
|
||||
argv[argc++]=arg;
|
||||
}
|
||||
if (numargs)
|
||||
*numargs=argc;
|
||||
/* Start with a new argument */
|
||||
arg=d=s;
|
||||
bcount=0;
|
||||
}
|
||||
else if (*s==0x005c)
|
||||
{
|
||||
/* '\\' */
|
||||
*d++=*s++;
|
||||
bcount++;
|
||||
}
|
||||
else if (*s==0x0022)
|
||||
{
|
||||
/* '"' */
|
||||
if ((bcount & 1)==0)
|
||||
{
|
||||
/* Preceded by an even number of '\', this is half that
|
||||
* number of '\', plus a quote which we erase.
|
||||
*/
|
||||
d-=bcount/2;
|
||||
in_quotes=!in_quotes;
|
||||
s++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Preceded by an odd number of '\', this is half that
|
||||
* number of '\' followed by a '"'
|
||||
*/
|
||||
d=d-bcount/2-1;
|
||||
*d++='"';
|
||||
s++;
|
||||
}
|
||||
bcount=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* a regular character */
|
||||
*d++=*s++;
|
||||
bcount=0;
|
||||
}
|
||||
}
|
||||
if (*arg)
|
||||
{
|
||||
*d='\0';
|
||||
argv[argc++]=arg;
|
||||
}
|
||||
if (numargs)
|
||||
*numargs=argc;
|
||||
|
||||
return argv;
|
||||
return argv;
|
||||
}
|
||||
|
@ -43,6 +43,11 @@ REGEDIT4
|
||||
;-Office 2007
|
||||
"*\\OFFICE12\\MSO.DLL"="NT2K"
|
||||
"*\\OFFICE12\\WORDCONV.EXE"="NT2K"
|
||||
;-Google Earth setup
|
||||
"%TEMP%\\GTAPI.DLL"="NT2K"
|
||||
;-Windows Installer
|
||||
"%WINDIR%\\SYSTEM\\MSI.DLL"="DCFG1"
|
||||
"%WINDIR%\\SYSTEM\\MSIEXEC.EXE"="DCFG1"
|
||||
|
||||
[HKEY_LOCAL_MACHINE\Software\KernelEx\AppSettings\Flags]
|
||||
;DISABLE KERNELEX FOR:
|
||||
|
@ -44,23 +44,23 @@
|
||||
|
||||
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
if (fdwReason == DLL_PROCESS_ATTACH)
|
||||
if (fdwReason == DLL_PROCESS_ATTACH)
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOL WINAPI AlphaBlend_NEW( HDC hdcDest, // handle to destination DC
|
||||
int nXOriginDest, // x-coord of upper-left corner
|
||||
int nYOriginDest, // y-coord of upper-left corner
|
||||
int nWidthDest, // destination width
|
||||
int nHeightDest, // destination height
|
||||
HDC hdcSrc, // handle to source DC
|
||||
int nXOriginSrc, // x-coord of upper-left corner
|
||||
int nYOriginSrc, // y-coord of upper-left corner
|
||||
int nWidthSrc, // source width
|
||||
int nHeightSrc, // source height
|
||||
BLENDFUNCTION blendFunction // alpha-blending function
|
||||
int nXOriginDest, // x-coord of upper-left corner
|
||||
int nYOriginDest, // y-coord of upper-left corner
|
||||
int nWidthDest, // destination width
|
||||
int nHeightDest, // destination height
|
||||
HDC hdcSrc, // handle to source DC
|
||||
int nXOriginSrc, // x-coord of upper-left corner
|
||||
int nYOriginSrc, // y-coord of upper-left corner
|
||||
int nWidthSrc, // source width
|
||||
int nHeightSrc, // source height
|
||||
BLENDFUNCTION blendFunction // alpha-blending function
|
||||
)
|
||||
{
|
||||
unsigned int srcalpha, dstalpha;
|
||||
@ -160,10 +160,10 @@ BOOL WINAPI GradientFill_NEW( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
|
||||
unsigned int i;
|
||||
|
||||
if ( !hdc || !vert_array || ! grad_array )
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
@ -275,7 +275,7 @@ BOOL WINAPI GradientFill_NEW( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
|
||||
int b2 = (v2->Blue * y2 + v-> Blue * (dy2 - y2)) / dy2;
|
||||
|
||||
int x;
|
||||
if (x1 < x2)
|
||||
if (x1 < x2)
|
||||
{
|
||||
int dx = x2 - x1;
|
||||
for (x = 0; x < dx; x++)
|
||||
@ -307,19 +307,19 @@ BOOL WINAPI GradientFill_NEW( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
|
||||
* GdiTransparentBlt [GDI32.@]
|
||||
*/
|
||||
BOOL WINAPI TransparentBlt_NEW( HDC hdcDest, int xDest, int yDest, int widthDest, int heightDest,
|
||||
HDC hdcSrc, int xSrc, int ySrc, int widthSrc, int heightSrc,
|
||||
UINT crTransparent )
|
||||
HDC hdcSrc, int xSrc, int ySrc, int widthSrc, int heightSrc,
|
||||
UINT crTransparent )
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
HDC hdcWork;
|
||||
HBITMAP bmpWork;
|
||||
HGDIOBJ oldWork;
|
||||
HDC hdcMask = NULL;
|
||||
HBITMAP bmpMask = NULL;
|
||||
HBITMAP oldMask = NULL;
|
||||
COLORREF oldBackground;
|
||||
COLORREF oldForeground;
|
||||
int oldStretchMode;
|
||||
BOOL ret = FALSE;
|
||||
HDC hdcWork;
|
||||
HBITMAP bmpWork;
|
||||
HGDIOBJ oldWork;
|
||||
HDC hdcMask = NULL;
|
||||
HBITMAP bmpMask = NULL;
|
||||
HBITMAP oldMask = NULL;
|
||||
COLORREF oldBackground;
|
||||
COLORREF oldForeground;
|
||||
int oldStretchMode;
|
||||
|
||||
if ( !hdcDest || !hdcSrc )
|
||||
{
|
||||
@ -327,56 +327,56 @@ BOOL WINAPI TransparentBlt_NEW( HDC hdcDest, int xDest, int yDest, int widthDest
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(widthDest < 0 || heightDest < 0 || widthSrc < 0 || heightSrc < 0) {
|
||||
return FALSE;
|
||||
}
|
||||
if(widthDest < 0 || heightDest < 0 || widthSrc < 0 || heightSrc < 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
oldBackground = SetBkColor(hdcDest, RGB(255,255,255));
|
||||
oldForeground = SetTextColor(hdcDest, RGB(0,0,0));
|
||||
oldBackground = SetBkColor(hdcDest, RGB(255,255,255));
|
||||
oldForeground = SetTextColor(hdcDest, RGB(0,0,0));
|
||||
|
||||
/* Stretch bitmap */
|
||||
oldStretchMode = GetStretchBltMode(hdcSrc);
|
||||
if(oldStretchMode == BLACKONWHITE || oldStretchMode == WHITEONBLACK)
|
||||
SetStretchBltMode(hdcSrc, COLORONCOLOR);
|
||||
hdcWork = CreateCompatibleDC(hdcDest);
|
||||
bmpWork = CreateCompatibleBitmap(hdcDest, widthDest, heightDest);
|
||||
oldWork = SelectObject(hdcWork, bmpWork);
|
||||
if(!StretchBlt(hdcWork, 0, 0, widthDest, heightDest, hdcSrc, xSrc, ySrc, widthSrc, heightSrc, SRCCOPY)) goto error;
|
||||
SetBkColor(hdcWork, crTransparent);
|
||||
/* Stretch bitmap */
|
||||
oldStretchMode = GetStretchBltMode(hdcSrc);
|
||||
if(oldStretchMode == BLACKONWHITE || oldStretchMode == WHITEONBLACK)
|
||||
SetStretchBltMode(hdcSrc, COLORONCOLOR);
|
||||
hdcWork = CreateCompatibleDC(hdcDest);
|
||||
bmpWork = CreateCompatibleBitmap(hdcDest, widthDest, heightDest);
|
||||
oldWork = SelectObject(hdcWork, bmpWork);
|
||||
if(!StretchBlt(hdcWork, 0, 0, widthDest, heightDest, hdcSrc, xSrc, ySrc, widthSrc, heightSrc, SRCCOPY)) goto error;
|
||||
SetBkColor(hdcWork, crTransparent);
|
||||
|
||||
/* Create mask */
|
||||
hdcMask = CreateCompatibleDC(hdcDest);
|
||||
bmpMask = CreateCompatibleBitmap(hdcMask, widthDest, heightDest);
|
||||
oldMask = SelectObject(hdcMask, bmpMask);
|
||||
if(!BitBlt(hdcMask, 0, 0, widthDest, heightDest, hdcWork, 0, 0, SRCCOPY)) goto error;
|
||||
/* Create mask */
|
||||
hdcMask = CreateCompatibleDC(hdcDest);
|
||||
bmpMask = CreateCompatibleBitmap(hdcMask, widthDest, heightDest);
|
||||
oldMask = SelectObject(hdcMask, bmpMask);
|
||||
if(!BitBlt(hdcMask, 0, 0, widthDest, heightDest, hdcWork, 0, 0, SRCCOPY)) goto error;
|
||||
|
||||
/* Replace transparent color with black */
|
||||
SetBkColor(hdcWork, RGB(0,0,0));
|
||||
SetTextColor(hdcWork, RGB(255,255,255));
|
||||
if(!BitBlt(hdcWork, 0, 0, widthDest, heightDest, hdcMask, 0, 0, SRCAND)) goto error;
|
||||
/* Replace transparent color with black */
|
||||
SetBkColor(hdcWork, RGB(0,0,0));
|
||||
SetTextColor(hdcWork, RGB(255,255,255));
|
||||
if(!BitBlt(hdcWork, 0, 0, widthDest, heightDest, hdcMask, 0, 0, SRCAND)) goto error;
|
||||
|
||||
/* Replace non-transparent area on destination with black */
|
||||
if(!BitBlt(hdcDest, xDest, yDest, widthDest, heightDest, hdcMask, 0, 0, SRCAND)) goto error;
|
||||
/* Replace non-transparent area on destination with black */
|
||||
if(!BitBlt(hdcDest, xDest, yDest, widthDest, heightDest, hdcMask, 0, 0, SRCAND)) goto error;
|
||||
|
||||
/* Draw the image */
|
||||
if(!BitBlt(hdcDest, xDest, yDest, widthDest, heightDest, hdcWork, 0, 0, SRCPAINT)) goto error;
|
||||
/* Draw the image */
|
||||
if(!BitBlt(hdcDest, xDest, yDest, widthDest, heightDest, hdcWork, 0, 0, SRCPAINT)) goto error;
|
||||
|
||||
ret = TRUE;
|
||||
ret = TRUE;
|
||||
error:
|
||||
SetStretchBltMode(hdcSrc, oldStretchMode);
|
||||
SetBkColor(hdcDest, oldBackground);
|
||||
SetTextColor(hdcDest, oldForeground);
|
||||
if(hdcWork) {
|
||||
SelectObject(hdcWork, oldWork);
|
||||
DeleteDC(hdcWork);
|
||||
}
|
||||
if(bmpWork) DeleteObject(bmpWork);
|
||||
if(hdcMask) {
|
||||
SelectObject(hdcMask, oldMask);
|
||||
DeleteDC(hdcMask);
|
||||
}
|
||||
if(bmpMask) DeleteObject(bmpMask);
|
||||
return ret;
|
||||
SetStretchBltMode(hdcSrc, oldStretchMode);
|
||||
SetBkColor(hdcDest, oldBackground);
|
||||
SetTextColor(hdcDest, oldForeground);
|
||||
if(hdcWork) {
|
||||
SelectObject(hdcWork, oldWork);
|
||||
DeleteDC(hdcWork);
|
||||
}
|
||||
if(bmpWork) DeleteObject(bmpWork);
|
||||
if(hdcMask) {
|
||||
SelectObject(hdcMask, oldMask);
|
||||
DeleteDC(hdcMask);
|
||||
}
|
||||
if(bmpMask) DeleteObject(bmpMask);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void WINAPI vSetDdrawflag()
|
||||
|
@ -44,24 +44,25 @@ int WINAPI CommonUnimpStub(void);
|
||||
|
||||
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
switch (fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
switch (fdwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
OSVERSIONINFO osv;
|
||||
osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
GetVersionEx(&osv);
|
||||
if (osv.dwMajorVersion < 5)
|
||||
return FALSE;
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
break;
|
||||
}
|
||||
case DLL_PROCESS_DETACH:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
break;
|
||||
}
|
||||
case DLL_PROCESS_DETACH:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UNIMPL_FUNC(PdhGetDllVersion, 1);
|
||||
|
@ -41,54 +41,54 @@
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
TRACE("%p %d %p\n", hinstDLL, fdwReason, lpvReserved);
|
||||
TRACE("%p %d %p\n", hinstDLL, fdwReason, lpvReserved);
|
||||
|
||||
switch (fdwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
switch (fdwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WINAPI CreateEnvironmentBlock( LPVOID* lpEnvironment,
|
||||
HANDLE hToken, BOOL bInherit )
|
||||
{
|
||||
FIXME("%p %p %d\n", lpEnvironment, hToken, bInherit );
|
||||
return FALSE;
|
||||
FIXME("%p %p %d\n", lpEnvironment, hToken, bInherit );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI DestroyEnvironmentBlock( LPVOID lpEnvironment )
|
||||
{
|
||||
FIXME("%p\n", lpEnvironment);
|
||||
FIXME("%p\n", lpEnvironment);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI ExpandEnvironmentStringsForUserA( HANDLE hToken, LPCSTR lpSrc,
|
||||
LPSTR lpDest, DWORD dwSize )
|
||||
{
|
||||
BOOL ret;
|
||||
BOOL ret;
|
||||
|
||||
TRACE("%p %s %p %d\n", hToken, debugstr_a(lpSrc), lpDest, dwSize);
|
||||
TRACE("%p %s %p %d\n", hToken, debugstr_a(lpSrc), lpDest, dwSize);
|
||||
|
||||
ret = ExpandEnvironmentStringsA( lpSrc, lpDest, dwSize );
|
||||
TRACE("<- %s\n", debugstr_a(lpDest));
|
||||
return ret;
|
||||
ret = ExpandEnvironmentStringsA( lpSrc, lpDest, dwSize );
|
||||
TRACE("<- %s\n", debugstr_a(lpDest));
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI ExpandEnvironmentStringsForUserW( HANDLE hToken, LPCWSTR lpSrc,
|
||||
LPWSTR lpDest, DWORD dwSize )
|
||||
{
|
||||
BOOL ret;
|
||||
BOOL ret;
|
||||
|
||||
TRACE("%p %s %p %d\n", hToken, debugstr_w(lpSrc), lpDest, dwSize);
|
||||
TRACE("%p %s %p %d\n", hToken, debugstr_w(lpSrc), lpDest, dwSize);
|
||||
|
||||
ret = ExpandEnvironmentStringsW( lpSrc, lpDest, dwSize );
|
||||
TRACE("<- %s\n", debugstr_w(lpDest));
|
||||
return ret;
|
||||
ret = ExpandEnvironmentStringsW( lpSrc, lpDest, dwSize );
|
||||
TRACE("<- %s\n", debugstr_w(lpDest));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int getsubdirpath(int nFolder, LPSTR lpBuffer, LPSTR lpSubDir)
|
||||
@ -154,49 +154,49 @@ int WINAPI GetAllUsersProfileDirectoryW( LPWSTR lpProfileDir, LPDWORD lpcchSize
|
||||
|
||||
int WINAPI GetProfilesDirectoryA( LPSTR lpProfilesDir, LPDWORD lpcchSize )
|
||||
{
|
||||
return GetSpecialSubdirPathA(CSIDL_APPDATA,"..\\..",lpProfilesDir,lpcchSize);
|
||||
return GetSpecialSubdirPathA(CSIDL_APPDATA,"..\\..",lpProfilesDir,lpcchSize);
|
||||
}
|
||||
|
||||
int WINAPI GetProfilesDirectoryW( LPWSTR lpProfilesDir, LPDWORD lpcchSize )
|
||||
{
|
||||
return GetSpecialSubdirPathW(CSIDL_APPDATA,"..\\..",lpProfilesDir,lpcchSize);
|
||||
return GetSpecialSubdirPathW(CSIDL_APPDATA,"..\\..",lpProfilesDir,lpcchSize);
|
||||
}
|
||||
|
||||
BOOL WINAPI GetProfileType( DWORD *pdwFlags )
|
||||
{
|
||||
FIXME("%p\n", pdwFlags );
|
||||
*pdwFlags = 0;
|
||||
return TRUE;
|
||||
FIXME("%p\n", pdwFlags );
|
||||
*pdwFlags = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WINAPI LoadUserProfileA( HANDLE hToken, LPPROFILEINFOA lpProfileInfo )
|
||||
{
|
||||
FIXME("%p %p\n", hToken, lpProfileInfo );
|
||||
lpProfileInfo->hProfile = HKEY_CURRENT_USER;
|
||||
return TRUE;
|
||||
FIXME("%p %p\n", hToken, lpProfileInfo );
|
||||
lpProfileInfo->hProfile = HKEY_CURRENT_USER;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WINAPI LoadUserProfileW( HANDLE hToken, LPPROFILEINFOW lpProfileInfo )
|
||||
{
|
||||
FIXME("%p %p\n", hToken, lpProfileInfo );
|
||||
lpProfileInfo->hProfile = HKEY_CURRENT_USER;
|
||||
return TRUE;
|
||||
FIXME("%p %p\n", hToken, lpProfileInfo );
|
||||
lpProfileInfo->hProfile = HKEY_CURRENT_USER;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WINAPI RegisterGPNotification( HANDLE event, BOOL machine )
|
||||
{
|
||||
FIXME("%p %d\n", event, machine );
|
||||
return TRUE;
|
||||
FIXME("%p %d\n", event, machine );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WINAPI UnregisterGPNotification( HANDLE event )
|
||||
{
|
||||
FIXME("%p\n", event );
|
||||
return TRUE;
|
||||
FIXME("%p\n", event );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WINAPI UnloadUserProfile( HANDLE hToken, HANDLE hProfile )
|
||||
{
|
||||
FIXME("(%p, %p): stub\n", hToken, hProfile);
|
||||
return FALSE;
|
||||
FIXME("(%p, %p): stub\n", hToken, hProfile);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -36,14 +36,14 @@
|
||||
*/
|
||||
BOOL WINAPI GetThemeSysBool(HTHEME hTheme, int iBoolID)
|
||||
{
|
||||
SetLastError(0);
|
||||
if(iBoolID == TMT_FLATMENUS) {
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
SetLastError(STG_E_INVALIDPARAMETER);
|
||||
}
|
||||
return FALSE;
|
||||
SetLastError(0);
|
||||
if(iBoolID == TMT_FLATMENUS) {
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
SetLastError(STG_E_INVALIDPARAMETER);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -52,8 +52,8 @@ BOOL WINAPI GetThemeSysBool(HTHEME hTheme, int iBoolID)
|
||||
*/
|
||||
COLORREF WINAPI GetThemeSysColor(HTHEME hTheme, int iColorID)
|
||||
{
|
||||
SetLastError(0);
|
||||
return GetSysColor(iColorID - TMT_FIRSTCOLOR);
|
||||
SetLastError(0);
|
||||
return GetSysColor(iColorID - TMT_FIRSTCOLOR);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -62,7 +62,7 @@ COLORREF WINAPI GetThemeSysColor(HTHEME hTheme, int iColorID)
|
||||
*/
|
||||
HBRUSH WINAPI GetThemeSysColorBrush(HTHEME hTheme, int iColorID)
|
||||
{
|
||||
return CreateSolidBrush(GetThemeSysColor(hTheme, iColorID));
|
||||
return CreateSolidBrush(GetThemeSysColor(hTheme, iColorID));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -71,29 +71,29 @@ HBRUSH WINAPI GetThemeSysColorBrush(HTHEME hTheme, int iColorID)
|
||||
*/
|
||||
HRESULT WINAPI GetThemeSysFont(HTHEME hTheme, int iFontID, LOGFONTW *plf)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if(iFontID == TMT_ICONTITLEFONT) {
|
||||
if(!SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(LOGFONTW), &plf, 0))
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
else {
|
||||
NONCLIENTMETRICSW ncm;
|
||||
LOGFONTW *font = NULL;
|
||||
ncm.cbSize = sizeof(NONCLIENTMETRICSW);
|
||||
if(!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &ncm, 0))
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
switch(iFontID) {
|
||||
case TMT_CAPTIONFONT: font = &ncm.lfCaptionFont; break;
|
||||
case TMT_SMALLCAPTIONFONT: font = &ncm.lfSmCaptionFont; break;
|
||||
case TMT_MENUFONT: font = &ncm.lfMenuFont; break;
|
||||
case TMT_STATUSFONT: font = &ncm.lfStatusFont; break;
|
||||
case TMT_MSGBOXFONT: font = &ncm.lfMessageFont; break;
|
||||
}
|
||||
if(font) *plf = *font;
|
||||
else hr = STG_E_INVALIDPARAMETER;
|
||||
}
|
||||
return hr;
|
||||
if(iFontID == TMT_ICONTITLEFONT) {
|
||||
if(!SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(LOGFONTW), &plf, 0))
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
else {
|
||||
NONCLIENTMETRICSW ncm;
|
||||
LOGFONTW *font = NULL;
|
||||
ncm.cbSize = sizeof(NONCLIENTMETRICSW);
|
||||
if(!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &ncm, 0))
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
switch(iFontID) {
|
||||
case TMT_CAPTIONFONT: font = &ncm.lfCaptionFont; break;
|
||||
case TMT_SMALLCAPTIONFONT: font = &ncm.lfSmCaptionFont; break;
|
||||
case TMT_MENUFONT: font = &ncm.lfMenuFont; break;
|
||||
case TMT_STATUSFONT: font = &ncm.lfStatusFont; break;
|
||||
case TMT_MSGBOXFONT: font = &ncm.lfMessageFont; break;
|
||||
}
|
||||
if(font) *plf = *font;
|
||||
else hr = STG_E_INVALIDPARAMETER;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -102,7 +102,7 @@ HRESULT WINAPI GetThemeSysFont(HTHEME hTheme, int iFontID, LOGFONTW *plf)
|
||||
*/
|
||||
HRESULT WINAPI GetThemeSysInt(HTHEME hTheme, int iIntID, int *piValue)
|
||||
{
|
||||
return E_HANDLE;
|
||||
return E_HANDLE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -111,7 +111,7 @@ HRESULT WINAPI GetThemeSysInt(HTHEME hTheme, int iIntID, int *piValue)
|
||||
*/
|
||||
int WINAPI GetThemeSysSize(HTHEME hTheme, int iSizeID)
|
||||
{
|
||||
return GetSystemMetrics(iSizeID);
|
||||
return GetSystemMetrics(iSizeID);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -121,5 +121,5 @@ int WINAPI GetThemeSysSize(HTHEME hTheme, int iSizeID)
|
||||
HRESULT WINAPI GetThemeSysString(HTHEME hTheme, int iStringID,
|
||||
LPWSTR pszStringBuff, int cchMaxStringChars)
|
||||
{
|
||||
return E_HANDLE;
|
||||
return E_HANDLE;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, BOOL bLoadStatic)
|
||||
{
|
||||
if (fdwReason == DLL_PROCESS_ATTACH)
|
||||
if (fdwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
if (!bLoadStatic)
|
||||
{
|
||||
@ -44,7 +44,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, BOOL bLoadStatic)
|
||||
}
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
}
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UNIMPL_FUNC(CloseThemeData, 1, _E_NOTIMPL);
|
||||
|
@ -69,35 +69,36 @@ static HMODULE WTSAPI32_hModule = 0;
|
||||
|
||||
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
TRACE("%p,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
|
||||
TRACE("%p,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
|
||||
|
||||
switch (fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
switch (fdwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
OSVERSIONINFO osv;
|
||||
osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
GetVersionEx(&osv);
|
||||
if (osv.dwMajorVersion < 5)
|
||||
return FALSE;
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
WTSAPI32_hModule = hinstDLL;
|
||||
break;
|
||||
}
|
||||
case DLL_PROCESS_DETACH:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
WTSAPI32_hModule = hinstDLL;
|
||||
break;
|
||||
}
|
||||
case DLL_PROCESS_DETACH:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* WTSCloseServer (WTSAPI32.@)
|
||||
*/
|
||||
void WINAPI WTSCloseServer(HANDLE hServer)
|
||||
{
|
||||
FIXME("Stub %p\n", hServer);
|
||||
FIXME("Stub %p\n", hServer);
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
@ -105,110 +106,110 @@ void WINAPI WTSCloseServer(HANDLE hServer)
|
||||
*/
|
||||
BOOL WINAPI WTSDisconnectSession(HANDLE hServer, DWORD SessionId, BOOL bWait)
|
||||
{
|
||||
FIXME("Stub %p 0x%08lx %d\n", hServer, SessionId, bWait);
|
||||
return TRUE;
|
||||
FIXME("Stub %p 0x%08lx %d\n", hServer, SessionId, bWait);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* WTSEnumerateProcessesA (WTSAPI32.@)
|
||||
*/
|
||||
BOOL WINAPI WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved, DWORD Version,
|
||||
PWTS_PROCESS_INFOA* ppProcessInfo, DWORD* pCount)
|
||||
PWTS_PROCESS_INFOA* ppProcessInfo, DWORD* pCount)
|
||||
{
|
||||
FIXME("Stub %p 0x%08lx 0x%08lx %p %p\n", hServer, Reserved, Version,
|
||||
ppProcessInfo, pCount);
|
||||
FIXME("Stub %p 0x%08lx 0x%08lx %p %p\n", hServer, Reserved, Version,
|
||||
ppProcessInfo, pCount);
|
||||
|
||||
if (!ppProcessInfo || !pCount) return FALSE;
|
||||
if (!ppProcessInfo || !pCount) return FALSE;
|
||||
|
||||
*pCount = 0;
|
||||
*ppProcessInfo = NULL;
|
||||
*pCount = 0;
|
||||
*ppProcessInfo = NULL;
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* WTSEnumerateProcessesW (WTSAPI32.@)
|
||||
*/
|
||||
BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version,
|
||||
PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount)
|
||||
PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount)
|
||||
{
|
||||
FIXME("Stub %p 0x%08lx 0x%08lx %p %p\n", hServer, Reserved, Version,
|
||||
ppProcessInfo, pCount);
|
||||
FIXME("Stub %p 0x%08lx 0x%08lx %p %p\n", hServer, Reserved, Version,
|
||||
ppProcessInfo, pCount);
|
||||
|
||||
if (!ppProcessInfo || !pCount) return FALSE;
|
||||
if (!ppProcessInfo || !pCount) return FALSE;
|
||||
|
||||
*pCount = 0;
|
||||
*ppProcessInfo = NULL;
|
||||
*pCount = 0;
|
||||
*ppProcessInfo = NULL;
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* WTSEnumerateServersA (WTSAPI32.@)
|
||||
*/
|
||||
BOOL WINAPI WTSEnumerateServersA(LPSTR pDomainName, DWORD Reserved, DWORD Version,
|
||||
PWTS_SERVER_INFOA* ppServerInfo, DWORD* pCount)
|
||||
PWTS_SERVER_INFOA* ppServerInfo, DWORD* pCount)
|
||||
{
|
||||
FIXME("Stub %s 0x%08lx 0x%08lx %p %p\n", debugstr_a(pDomainName), Reserved, Version,
|
||||
ppServerInfo, pCount);
|
||||
FIXME("Stub %s 0x%08lx 0x%08lx %p %p\n", debugstr_a(pDomainName), Reserved, Version,
|
||||
ppServerInfo, pCount);
|
||||
|
||||
if (!ppServerInfo || !pCount) return FALSE;
|
||||
if (!ppServerInfo || !pCount) return FALSE;
|
||||
|
||||
*pCount = 0;
|
||||
*ppServerInfo = NULL;
|
||||
*pCount = 0;
|
||||
*ppServerInfo = NULL;
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* WTSEnumerateServersW (WTSAPI32.@)
|
||||
*/
|
||||
BOOL WINAPI WTSEnumerateServersW(LPWSTR pDomainName, DWORD Reserved, DWORD Version,
|
||||
PWTS_SERVER_INFOW* ppServerInfo, DWORD* pCount)
|
||||
PWTS_SERVER_INFOW* ppServerInfo, DWORD* pCount)
|
||||
{
|
||||
FIXME("Stub %s 0x%08lx 0x%08lx %p %p\n", debugstr_w(pDomainName), Reserved, Version,
|
||||
ppServerInfo, pCount);
|
||||
FIXME("Stub %s 0x%08lx 0x%08lx %p %p\n", debugstr_w(pDomainName), Reserved, Version,
|
||||
ppServerInfo, pCount);
|
||||
|
||||
if (!ppServerInfo || !pCount) return FALSE;
|
||||
if (!ppServerInfo || !pCount) return FALSE;
|
||||
|
||||
*pCount = 0;
|
||||
*ppServerInfo = NULL;
|
||||
*pCount = 0;
|
||||
*ppServerInfo = NULL;
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* WTSEnumerateEnumerateSessionsA (WTSAPI32.@)
|
||||
*/
|
||||
BOOL WINAPI WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved, DWORD Version,
|
||||
PWTS_SESSION_INFOA* ppSessionInfo, DWORD* pCount)
|
||||
PWTS_SESSION_INFOA* ppSessionInfo, DWORD* pCount)
|
||||
{
|
||||
FIXME("Stub %p 0x%08lx 0x%08lx %p %p\n", hServer, Reserved, Version,
|
||||
ppSessionInfo, pCount);
|
||||
FIXME("Stub %p 0x%08lx 0x%08lx %p %p\n", hServer, Reserved, Version,
|
||||
ppSessionInfo, pCount);
|
||||
|
||||
if (!ppSessionInfo || !pCount) return FALSE;
|
||||
if (!ppSessionInfo || !pCount) return FALSE;
|
||||
|
||||
*pCount = 0;
|
||||
*ppSessionInfo = NULL;
|
||||
*pCount = 0;
|
||||
*ppSessionInfo = NULL;
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* WTSEnumerateEnumerateSessionsW (WTSAPI32.@)
|
||||
*/
|
||||
BOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version,
|
||||
PWTS_SESSION_INFOW* ppSessionInfo, DWORD* pCount)
|
||||
PWTS_SESSION_INFOW* ppSessionInfo, DWORD* pCount)
|
||||
{
|
||||
FIXME("Stub %p 0x%08lx 0x%08lx %p %p\n", hServer, Reserved, Version,
|
||||
ppSessionInfo, pCount);
|
||||
FIXME("Stub %p 0x%08lx 0x%08lx %p %p\n", hServer, Reserved, Version,
|
||||
ppSessionInfo, pCount);
|
||||
|
||||
if (!ppSessionInfo || !pCount) return FALSE;
|
||||
if (!ppSessionInfo || !pCount) return FALSE;
|
||||
|
||||
*pCount = 0;
|
||||
*ppSessionInfo = NULL;
|
||||
*pCount = 0;
|
||||
*ppSessionInfo = NULL;
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
@ -216,8 +217,8 @@ BOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version,
|
||||
*/
|
||||
void WINAPI WTSFreeMemory(PVOID pMemory)
|
||||
{
|
||||
FIXME("Stub %p\n", pMemory);
|
||||
return;
|
||||
FIXME("Stub %p\n", pMemory);
|
||||
return;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
@ -225,9 +226,9 @@ void WINAPI WTSFreeMemory(PVOID pMemory)
|
||||
*/
|
||||
HANDLE WINAPI WTSOpenServerA(LPSTR pServerName)
|
||||
{
|
||||
FIXME("(%s) stub\n", debugstr_a(pServerName));
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return NULL;
|
||||
FIXME("(%s) stub\n", debugstr_a(pServerName));
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
@ -235,64 +236,72 @@ HANDLE WINAPI WTSOpenServerA(LPSTR pServerName)
|
||||
*/
|
||||
HANDLE WINAPI WTSOpenServerW(LPWSTR pServerName)
|
||||
{
|
||||
FIXME("(%s) stub\n", debugstr_w(pServerName));
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return NULL;
|
||||
FIXME("(%s) stub\n", debugstr_w(pServerName));
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* WTSQuerySessionInformationA (WTSAPI32.@)
|
||||
*/
|
||||
BOOL WINAPI WTSQuerySessionInformationA(
|
||||
HANDLE hServer,
|
||||
DWORD SessionId,
|
||||
WTS_INFO_CLASS WTSInfoClass,
|
||||
LPSTR* Buffer,
|
||||
DWORD* BytesReturned)
|
||||
HANDLE hServer,
|
||||
DWORD SessionId,
|
||||
WTS_INFO_CLASS WTSInfoClass,
|
||||
LPSTR* Buffer,
|
||||
DWORD* BytesReturned)
|
||||
{
|
||||
/* FIXME: Forward request to winsta.dll::WinStationQueryInformationA */
|
||||
FIXME("Stub %p 0x%08lx %d %p %p\n", hServer, SessionId, WTSInfoClass,
|
||||
Buffer, BytesReturned);
|
||||
/* FIXME: Forward request to winsta.dll::WinStationQueryInformationA */
|
||||
FIXME("Stub %p 0x%08lx %d %p %p\n", hServer, SessionId, WTSInfoClass,
|
||||
Buffer, BytesReturned);
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* WTSQuerySessionInformationW (WTSAPI32.@)
|
||||
*/
|
||||
BOOL WINAPI WTSQuerySessionInformationW(
|
||||
HANDLE hServer,
|
||||
DWORD SessionId,
|
||||
WTS_INFO_CLASS WTSInfoClass,
|
||||
LPWSTR* Buffer,
|
||||
DWORD* BytesReturned)
|
||||
HANDLE hServer,
|
||||
DWORD SessionId,
|
||||
WTS_INFO_CLASS WTSInfoClass,
|
||||
LPWSTR* Buffer,
|
||||
DWORD* BytesReturned)
|
||||
{
|
||||
/* FIXME: Forward request to winsta.dll::WinStationQueryInformationW */
|
||||
FIXME("Stub %p 0x%08lx %d %p %p\n", hServer, SessionId, WTSInfoClass,
|
||||
Buffer, BytesReturned);
|
||||
/* FIXME: Forward request to winsta.dll::WinStationQueryInformationW */
|
||||
FIXME("Stub %p 0x%08lx %d %p %p\n", hServer, SessionId, WTSInfoClass,
|
||||
Buffer, BytesReturned);
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* WTSQueryUserConfigA (WTSAPI32.@)
|
||||
*/
|
||||
BOOL WINAPI WTSQueryUserConfigA(LPSTR pServerName, LPSTR pUserName,
|
||||
WTS_CONFIG_CLASS WTSConfigClass, LPSTR* ppBuffer, DWORD* pBytesReturned)
|
||||
BOOL WINAPI WTSQueryUserConfigA(
|
||||
LPSTR pServerName,
|
||||
LPSTR pUserName,
|
||||
WTS_CONFIG_CLASS WTSConfigClass,
|
||||
LPSTR* ppBuffer,
|
||||
DWORD* pBytesReturned)
|
||||
{
|
||||
FIXME("Stub %s %s 0x%08lx %p %p\n", debugstr_a(pServerName), debugstr_a(pUserName),
|
||||
WTSConfigClass, ppBuffer, pBytesReturned);
|
||||
WTSConfigClass, ppBuffer, pBytesReturned);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* WTSQueryUserConfigW (WTSAPI32.@)
|
||||
*/
|
||||
BOOL WINAPI WTSQueryUserConfigW(LPWSTR pServerName, LPWSTR pUserName,
|
||||
WTS_CONFIG_CLASS WTSConfigClass, LPWSTR* ppBuffer, DWORD* pBytesReturned)
|
||||
BOOL WINAPI WTSQueryUserConfigW(
|
||||
LPWSTR pServerName,
|
||||
LPWSTR pUserName,
|
||||
WTS_CONFIG_CLASS WTSConfigClass,
|
||||
LPWSTR* ppBuffer,
|
||||
DWORD* pBytesReturned)
|
||||
{
|
||||
FIXME("Stub %s %s 0x%08lx %p %p\n", debugstr_w(pServerName), debugstr_w(pUserName),
|
||||
WTSConfigClass, ppBuffer, pBytesReturned);
|
||||
WTSConfigClass, ppBuffer, pBytesReturned);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -320,8 +329,8 @@ BOOL WINAPI WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags)
|
||||
BOOL WINAPI WTSTerminateProcess(HANDLE hServer, DWORD ProcessId, DWORD ExitCode)
|
||||
{
|
||||
FIXME("Stub %p 0x%08x 0x%08x\n", hServer, ProcessId, ExitCode);
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
@ -338,7 +347,7 @@ BOOL WINAPI WTSUnRegisterSessionNotification(HWND hWnd)
|
||||
*/
|
||||
BOOL WINAPI WTSWaitSystemEvent(HANDLE hServer, DWORD Mask, DWORD* Flags)
|
||||
{
|
||||
/* FIXME: Forward request to winsta.dll::WinStationWaitSystemEvent */
|
||||
FIXME("Stub %p 0x%08lx %p\n", hServer, Mask, Flags);
|
||||
return FALSE;
|
||||
/* FIXME: Forward request to winsta.dll::WinStationWaitSystemEvent */
|
||||
FIXME("Stub %p 0x%08lx %p\n", hServer, Mask, Flags);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -28,74 +28,74 @@ extern "C" {
|
||||
|
||||
typedef enum tagWTS_INFO_CLASS
|
||||
{
|
||||
WTSInitialProgram,
|
||||
WTSApplicationName,
|
||||
WTSWorkingDirectory,
|
||||
WTSOEMId,
|
||||
WTSSessionId,
|
||||
WTSUserName,
|
||||
WTSWinStationName,
|
||||
WTSDomainName,
|
||||
WTSConnectState,
|
||||
WTSClientBuildNumber,
|
||||
WTSClientName,
|
||||
WTSClientDirectory,
|
||||
WTSClientProductId,
|
||||
WTSClientHardwareId,
|
||||
WTSClientAddress,
|
||||
WTSClientDisplay,
|
||||
WTSClientProtocolType,
|
||||
WTSInitialProgram,
|
||||
WTSApplicationName,
|
||||
WTSWorkingDirectory,
|
||||
WTSOEMId,
|
||||
WTSSessionId,
|
||||
WTSUserName,
|
||||
WTSWinStationName,
|
||||
WTSDomainName,
|
||||
WTSConnectState,
|
||||
WTSClientBuildNumber,
|
||||
WTSClientName,
|
||||
WTSClientDirectory,
|
||||
WTSClientProductId,
|
||||
WTSClientHardwareId,
|
||||
WTSClientAddress,
|
||||
WTSClientDisplay,
|
||||
WTSClientProtocolType,
|
||||
} WTS_INFO_CLASS;
|
||||
|
||||
typedef enum _WTS_CONNECTSTATE_CLASS
|
||||
{
|
||||
WTSActive,
|
||||
WTSConnected,
|
||||
WTSConnectQuery,
|
||||
WTSShadow,
|
||||
WTSDisconnected,
|
||||
WTSIdle,
|
||||
WTSListen,
|
||||
WTSReset,
|
||||
WTSDown,
|
||||
WTSInit
|
||||
WTSActive,
|
||||
WTSConnected,
|
||||
WTSConnectQuery,
|
||||
WTSShadow,
|
||||
WTSDisconnected,
|
||||
WTSIdle,
|
||||
WTSListen,
|
||||
WTSReset,
|
||||
WTSDown,
|
||||
WTSInit
|
||||
} WTS_CONNECTSTATE_CLASS;
|
||||
|
||||
typedef enum _WTS_CONFIG_CLASS
|
||||
{
|
||||
WTSUserConfigInitialProgram,
|
||||
WTSUserConfigWorkingDirectory,
|
||||
WTSUserConfigInheritInitialProgram,
|
||||
WTSUserConfigAllowLogonTerminalServer,
|
||||
WTSUserConfigTimeoutSettingsConnections,
|
||||
WTSUserConfigTimeoutSettingsDisconnections,
|
||||
WTSUserConfigTimeoutSettingsIdle,
|
||||
WTSUserConfigDeviceClientDrives,
|
||||
WTSUserConfigDeviceClientPrinters,
|
||||
WTSUserConfigDeviceClientDefaultPrinter,
|
||||
WTSUserConfigBrokenTimeoutSettings,
|
||||
WTSUserConfigModemCallbackSettings,
|
||||
WTSUserConfigModemCallbackPhoneNumber,
|
||||
WTSUserConfigShadowSettings,
|
||||
WTSUserConfigTerminalServerProfilePath,
|
||||
WTSUserConfigTerminalServerHomeDirectory,
|
||||
WTSUserConfigfTerminalServerRemoteHomeDir
|
||||
WTSUserConfigInitialProgram,
|
||||
WTSUserConfigWorkingDirectory,
|
||||
WTSUserConfigInheritInitialProgram,
|
||||
WTSUserConfigAllowLogonTerminalServer,
|
||||
WTSUserConfigTimeoutSettingsConnections,
|
||||
WTSUserConfigTimeoutSettingsDisconnections,
|
||||
WTSUserConfigTimeoutSettingsIdle,
|
||||
WTSUserConfigDeviceClientDrives,
|
||||
WTSUserConfigDeviceClientPrinters,
|
||||
WTSUserConfigDeviceClientDefaultPrinter,
|
||||
WTSUserConfigBrokenTimeoutSettings,
|
||||
WTSUserConfigModemCallbackSettings,
|
||||
WTSUserConfigModemCallbackPhoneNumber,
|
||||
WTSUserConfigShadowSettings,
|
||||
WTSUserConfigTerminalServerProfilePath,
|
||||
WTSUserConfigTerminalServerHomeDirectory,
|
||||
WTSUserConfigfTerminalServerRemoteHomeDir
|
||||
} WTS_CONFIG_CLASS;
|
||||
|
||||
typedef struct _WTS_PROCESS_INFOA
|
||||
{
|
||||
DWORD SessionId;
|
||||
DWORD ProcessId;
|
||||
LPSTR pProcessName;
|
||||
PSID pUserSid;
|
||||
DWORD SessionId;
|
||||
DWORD ProcessId;
|
||||
LPSTR pProcessName;
|
||||
PSID pUserSid;
|
||||
} WTS_PROCESS_INFOA, *PWTS_PROCESS_INFOA;
|
||||
|
||||
typedef struct _WTS_PROCESS_INFOW
|
||||
{
|
||||
DWORD SessionId;
|
||||
DWORD ProcessId;
|
||||
LPWSTR pProcessName;
|
||||
PSID pUserSid;
|
||||
DWORD SessionId;
|
||||
DWORD ProcessId;
|
||||
LPWSTR pProcessName;
|
||||
PSID pUserSid;
|
||||
} WTS_PROCESS_INFOW, *PWTS_PROCESS_INFOW;
|
||||
|
||||
DECL_WINELIB_TYPE_AW(WTS_PROCESS_INFO)
|
||||
@ -103,16 +103,16 @@ DECL_WINELIB_TYPE_AW(PWTS_PROCESS_INFO)
|
||||
|
||||
typedef struct _WTS_SESSION_INFOA
|
||||
{
|
||||
DWORD SessionId;
|
||||
LPSTR pWinStationName;
|
||||
WTS_CONNECTSTATE_CLASS State;
|
||||
DWORD SessionId;
|
||||
LPSTR pWinStationName;
|
||||
WTS_CONNECTSTATE_CLASS State;
|
||||
} WTS_SESSION_INFOA, *PWTS_SESSION_INFOA;
|
||||
|
||||
typedef struct _WTS_SESSION_INFOW
|
||||
{
|
||||
DWORD SessionId;
|
||||
LPWSTR pWinStationName;
|
||||
WTS_CONNECTSTATE_CLASS State;
|
||||
DWORD SessionId;
|
||||
LPWSTR pWinStationName;
|
||||
WTS_CONNECTSTATE_CLASS State;
|
||||
} WTS_SESSION_INFOW, *PWTS_SESSION_INFOW;
|
||||
|
||||
DECL_WINELIB_TYPE_AW(WTS_SESSION_INFO)
|
||||
@ -120,12 +120,12 @@ DECL_WINELIB_TYPE_AW(PWTS_SESSION_INFO)
|
||||
|
||||
typedef struct _WTS_SERVER_INFOA
|
||||
{
|
||||
LPSTR pServerName;
|
||||
LPSTR pServerName;
|
||||
} WTS_SERVER_INFOA, *PWTS_SERVER_INFOA;
|
||||
|
||||
typedef struct _WTS_SERVER_INFOW
|
||||
{
|
||||
LPWSTR pServerName;
|
||||
LPWSTR pServerName;
|
||||
} WTS_SERVER_INFOW, *PWTS_SERVER_INFOW;
|
||||
|
||||
DECL_WINELIB_TYPE_AW(WTS_SERVER_INFO)
|
||||
|
@ -22,9 +22,9 @@
|
||||
#ifndef __VERSION_H
|
||||
#define __VERSION_H
|
||||
|
||||
#define VERSION_STR "4.5 RC 5"
|
||||
#define VERSION_CODE 0x0405000F
|
||||
#define RCVERSION 4, 5, 1, 5
|
||||
#define _RCVERSION_ "4, 5, 1, 5"
|
||||
#define VERSION_STR "4.5 Final"
|
||||
#define VERSION_CODE 0x04050065
|
||||
#define RCVERSION 4, 5, 10, 1
|
||||
#define _RCVERSION_ "4, 5, 10, 1"
|
||||
|
||||
#endif
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include "debug.h"
|
||||
#include "SettingsDB.h"
|
||||
#include "internals.h"
|
||||
#include "resolver.h"
|
||||
#include "apiconfmgr.h"
|
||||
@ -174,6 +175,9 @@ __error:
|
||||
DBGPRINTF(("Default api configuration is: %s\n", default_apiconf->get_name()));
|
||||
DBGPRINTF(("API extensions are by default: %s\n",
|
||||
disable_extensions ? "disabled" : "enabled"));
|
||||
|
||||
SettingsDB::instance.flush_all();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,24 @@ void ShowError(UINT id, ...)
|
||||
MessageBox(NULL, out, "KernelEx Core", MB_OK | MB_ICONERROR);
|
||||
}
|
||||
|
||||
bool rerun_setup()
|
||||
{
|
||||
char cmd[MAX_PATH];
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
|
||||
strcpy(cmd, "\"");
|
||||
strcat(cmd, kernelex_dir);
|
||||
strcat(cmd, "setupkex.exe\" /R");
|
||||
|
||||
GetStartupInfo(&si);
|
||||
if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
|
||||
return false;
|
||||
CloseHandle(pi.hThread);
|
||||
CloseHandle(pi.hProcess);
|
||||
return true;
|
||||
}
|
||||
|
||||
DWORD* find_unique_pattern(void* start, int size, const short* pattern, int pat_len, const char* pat_name)
|
||||
{
|
||||
unsigned char* pos = (unsigned char*) start;
|
||||
|
@ -44,6 +44,7 @@ extern sstring kernelex_dir;
|
||||
extern sstring own_path;
|
||||
|
||||
void ShowError(UINT id, ...);
|
||||
bool rerun_setup();
|
||||
bool isWinMe();
|
||||
|
||||
typedef MODREF* (__stdcall *MRFromHLib_t)(HMODULE);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008-2009, Xeno86
|
||||
* Copyright (C) 2008-2010, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
@ -53,12 +53,12 @@ int kexInit()
|
||||
if (!internals_init())
|
||||
goto __error1;
|
||||
|
||||
if (!apiconfmgr.load_api_configurations())
|
||||
goto __error2;
|
||||
|
||||
if (!resolver_init())
|
||||
goto __error2;
|
||||
|
||||
if (!apiconfmgr.load_api_configurations())
|
||||
goto __error3;
|
||||
|
||||
resolver_hook();
|
||||
|
||||
#ifdef _DEBUG
|
||||
@ -68,6 +68,8 @@ int kexInit()
|
||||
DBGPRINTF(("Initialized successfully\n"));
|
||||
return ++init_count;
|
||||
|
||||
__error3:
|
||||
resolver_uninit();
|
||||
__error2:
|
||||
internals_uninit();
|
||||
__error1:
|
||||
|
@ -879,7 +879,8 @@ int resolver_init()
|
||||
if (!dseg)
|
||||
{
|
||||
DBGPRINTF(("Signature not found\n"));
|
||||
ShowError(IDS_NOTREADY);
|
||||
if (!rerun_setup())
|
||||
ShowError(IDS_NOTREADY);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
@ -889,7 +890,8 @@ int resolver_init()
|
||||
{
|
||||
DBGPRINTF(("Wrong stub version, expected: %d, got: %d\n",
|
||||
KEX_STUB_VER, dseg->version));
|
||||
ShowError(IDS_STUBMISMATCH, KEX_STUB_VER, dseg->version);
|
||||
if (!rerun_setup())
|
||||
ShowError(IDS_STUBMISMATCH, KEX_STUB_VER, dseg->version);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -899,8 +901,6 @@ int resolver_init()
|
||||
system_path_len = GetSystemDirectory(system_path, sizeof(system_path));
|
||||
RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\KernelEx\\KnownDLLs", &known_dlls_key);
|
||||
|
||||
SettingsDB::instance.flush_all();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#define KEX_SIGNATURE "KrnlEx"
|
||||
/* Update this whenever patching functions are changed. */
|
||||
#define KEX_STUB_VER 9
|
||||
#define KEX_STUB_VER 10
|
||||
|
||||
#define JTAB_SIZE 8
|
||||
#define JTAB_EFO_DYN 0
|
||||
|
577
setup/patch.cpp
Executable file
577
setup/patch.cpp
Executable file
@ -0,0 +1,577 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <cassert>
|
||||
#include "patch.h"
|
||||
#include "debug.h"
|
||||
#include "loadstub.h"
|
||||
#include "pemanip.h"
|
||||
#include "resource.h"
|
||||
|
||||
#define CODE_SEG ".text"
|
||||
#define DATA_SEG ".data"
|
||||
#define INIT_SEG "_INIT"
|
||||
|
||||
void ShowError(UINT id, ...);
|
||||
|
||||
|
||||
Patch::Patch(PEmanip& pem) : pefile(pem)
|
||||
{
|
||||
}
|
||||
|
||||
void Patch::apply()
|
||||
{
|
||||
find_ExportFromX();
|
||||
find_IsKnownDLL();
|
||||
find_FLoadTreeNotify1();
|
||||
find_FLoadTreeNotify2();
|
||||
prepare_subsystem_check();
|
||||
find_resource_check1();
|
||||
find_resource_check2();
|
||||
disable_named_and_rcdata_resources_mirroring();
|
||||
mod_imte_alloc();
|
||||
mod_mr_alloc();
|
||||
mod_pdb_alloc();
|
||||
|
||||
KernelEx_codeseg* cseg;
|
||||
KernelEx_dataseg* dseg;
|
||||
if (!pefile.AllocSectionSpace(CODE_SEG,
|
||||
sizeof(KernelEx_codeseg), (void**) &cseg, sizeof(DWORD)))
|
||||
ShowError(IDS_FAILSEC, CODE_SEG);
|
||||
if (!pefile.AllocSectionSpace(DATA_SEG,
|
||||
sizeof(KernelEx_dataseg), (void**) &dseg, sizeof(DWORD)))
|
||||
ShowError(IDS_FAILSEC, DATA_SEG);
|
||||
|
||||
memcpy(cseg->signature, "KrnlEx", 6);
|
||||
cseg->version = KEX_STUB_VER;
|
||||
for (int i = 0 ; i < JTAB_SIZE ; i++)
|
||||
{
|
||||
cseg->jmp_stub[i].opcode = 0x25ff;
|
||||
cseg->jmp_stub[i].addr = (DWORD)
|
||||
pefile.PointerToRva(&dseg->jtab[i]) + pefile.GetImageBase();
|
||||
cseg->jmp_stub[i].nop = 0x9090;
|
||||
}
|
||||
|
||||
memcpy(dseg->signature, "KrnlEx", 6);
|
||||
dseg->version = KEX_STUB_VER;
|
||||
dseg->jtab[JTAB_EFO_DYN] = _ExportFromOrdinal + pefile.GetImageBase();
|
||||
dseg->jtab[JTAB_EFO_STA] = _ExportFromOrdinal + pefile.GetImageBase();
|
||||
dseg->jtab[JTAB_EFN_DYN] = _ExportFromName + pefile.GetImageBase();
|
||||
dseg->jtab[JTAB_EFN_STA] = _ExportFromName + pefile.GetImageBase();
|
||||
dseg->jtab[JTAB_KNO_DLL] = _IsKnownDLL + pefile.GetImageBase();
|
||||
dseg->jtab[JTAB_FLD_TRN] = _FLoadTreeNotify + pefile.GetImageBase();
|
||||
dseg->jtab[JTAB_SYS_CHK] = _SubsysCheckPerform + pefile.GetImageBase();
|
||||
dseg->jtab[JTAB_RES_CHK] = _GetOrdinal + pefile.GetImageBase();
|
||||
|
||||
//exportfromx patch
|
||||
DWORD code = (DWORD) pefile.GetSectionByName(CODE_SEG);
|
||||
int code_size = pefile.GetSectionSize(CODE_SEG);
|
||||
|
||||
int efo_cnt = 0;
|
||||
int efn_cnt = 0;
|
||||
|
||||
for (DWORD a = code ; a < code + code_size ; a++)
|
||||
{
|
||||
if (is_call_ref(a, _ExportFromOrdinal))
|
||||
{
|
||||
DWORD file_loc = a;
|
||||
if (a == EFN_EFO_call)
|
||||
continue;
|
||||
if (a == gpa_ExportFromOrdinal_call)
|
||||
set_call_ref(file_loc, (DWORD) &cseg->jmp_stub[JTAB_EFO_DYN]);
|
||||
else
|
||||
set_call_ref(file_loc, (DWORD) &cseg->jmp_stub[JTAB_EFO_STA]);
|
||||
DBGPRINTF(("%s: address 0x%08x\n", "EFO", pefile.PointerToRva((void*) a)
|
||||
+ pefile.GetImageBase()));
|
||||
efo_cnt++;
|
||||
}
|
||||
else if (is_call_ref(a, _ExportFromName))
|
||||
{
|
||||
DWORD file_loc = a;
|
||||
if (is_fixupc(a))
|
||||
continue;
|
||||
if (a == gpa_ExportFromName_call)
|
||||
set_call_ref(file_loc, (DWORD) &cseg->jmp_stub[JTAB_EFN_DYN]);
|
||||
else
|
||||
set_call_ref(file_loc, (DWORD) &cseg->jmp_stub[JTAB_EFN_STA]);
|
||||
DBGPRINTF(("%s: address 0x%08x\n", "EFN", pefile.PointerToRva((void*) a)
|
||||
+ pefile.GetImageBase()));
|
||||
efn_cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
if (efo_cnt != 2 || efn_cnt != 2)
|
||||
ShowError(IDS_ERRCHECK);
|
||||
|
||||
//isknowndll patch
|
||||
set_call_ref(IsKnownDLL_call, (DWORD) &cseg->jmp_stub[JTAB_KNO_DLL]);
|
||||
DBGPRINTF(("%s: address 0x%08x\n", "KNO_DLL", pefile.PointerToRva((void*) IsKnownDLL_call)
|
||||
+ pefile.GetImageBase()));
|
||||
|
||||
//FLoadTreeNotify patch
|
||||
set_call_ref(FLoadTreeNotify_call1, (DWORD) &cseg->jmp_stub[JTAB_FLD_TRN]);
|
||||
DBGPRINTF(("%s: address 0x%08x\n", "FLD_TRN1", pefile.PointerToRva((void*) FLoadTreeNotify_call1)
|
||||
+ pefile.GetImageBase()));
|
||||
set_call_ref(FLoadTreeNotify_call2, (DWORD) &cseg->jmp_stub[JTAB_FLD_TRN]);
|
||||
DBGPRINTF(("%s: address 0x%08x\n", "FLD_TRN2", pefile.PointerToRva((void*) FLoadTreeNotify_call2)
|
||||
+ pefile.GetImageBase()));
|
||||
|
||||
//subsys check patch
|
||||
set_jmp_ref(SubsysCheck_jmp, (DWORD) &cseg->jmp_stub[JTAB_SYS_CHK]);
|
||||
DBGPRINTF(("%s: address 0x%08x\n", "SYS_CHK", pefile.PointerToRva((void*) SubsysCheck_jmp)
|
||||
+ pefile.GetImageBase()));
|
||||
|
||||
//resource check patch
|
||||
set_call_ref(GetOrdinal_call1, (DWORD) &cseg->jmp_stub[JTAB_RES_CHK]);
|
||||
DBGPRINTF(("%s: address 0x%08x\n", "RES_CHK1", pefile.PointerToRva((void*) GetOrdinal_call1)
|
||||
+ pefile.GetImageBase()));
|
||||
set_call_ref(GetOrdinal_call2, (DWORD) &cseg->jmp_stub[JTAB_RES_CHK]);
|
||||
DBGPRINTF(("%s: address 0x%08x\n", "RES_CHK2", pefile.PointerToRva((void*) GetOrdinal_call2)
|
||||
+ pefile.GetImageBase()));
|
||||
}
|
||||
|
||||
int Patch::find_pattern(DWORD offset, int size, const short* pattern,
|
||||
int pat_len, DWORD* found_loc)
|
||||
{
|
||||
DWORD end_offset = offset + size - pat_len;
|
||||
int found = 0;
|
||||
|
||||
for (DWORD i = offset ; i <= end_offset ; i++)
|
||||
{
|
||||
if (pattern[0] < 0 || *(unsigned char*)i == pattern[0])
|
||||
{
|
||||
int j;
|
||||
for (j = 1 ; j < pat_len ; j++)
|
||||
{
|
||||
if (pattern[j] >= 0 && *(unsigned char*)(i + j) != pattern[j])
|
||||
break;
|
||||
}
|
||||
if (j == pat_len) //pattern found
|
||||
{
|
||||
*found_loc = i;
|
||||
found++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
void Patch::set_pattern(DWORD loc, const short* new_pattern, int pat_len)
|
||||
{
|
||||
unsigned char* offset = (unsigned char*) loc;
|
||||
const short* pat_ptr = new_pattern;
|
||||
|
||||
while (pat_len--)
|
||||
{
|
||||
if (*pat_ptr != -1)
|
||||
*offset = *pat_ptr & 0xff;
|
||||
offset++;
|
||||
pat_ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
void Patch::prepare_subsystem_check()
|
||||
{
|
||||
static const short pattern[] = {
|
||||
0x66,0x8b,0x46,0x48,0x66,0x3d,0x04,0x00,0x0f,0x87,0x9c,0x01,0x00,0x00,
|
||||
0x75,0x0b,0x66,0x83,0x7e,0x4a,0x0a,0x0f,0x87,0x8f,0x01,0x00,0x00,0x66,
|
||||
0x81,0x7e,0x04,0x4c,0x01,
|
||||
};
|
||||
static const short after[] = {
|
||||
0x66,0x83,0x7E,0x48,0x04,0x75,0x05,0x66,0x83,0x7E,0x4A,0x0A,0xE9,0x00,
|
||||
0x00,0x00,0x00,0x0F,0x87,0x93,0x01,0x00,0x00,0x90,0x90,0x90,0x90,0x66,
|
||||
0x81,0x7e,0x04,0x4c,0x01,
|
||||
};
|
||||
|
||||
DWORD offset = (DWORD) pefile.GetSectionByName(CODE_SEG);
|
||||
int size = pefile.GetSectionSize(CODE_SEG);
|
||||
int length = sizeof(pattern) / sizeof(short);
|
||||
DWORD found_loc;
|
||||
int found = find_pattern(offset, size, pattern, length, &found_loc);
|
||||
if (found != 1)
|
||||
{
|
||||
if (!found) ShowError(IDS_NOPAT, "subsystem_check");
|
||||
else ShowError(IDS_MULPAT, "subsystem_check");
|
||||
}
|
||||
DBGPRINTF(("%s: pattern found @ 0x%08x\n", "subsystem_check",
|
||||
pefile.PointerToRva((void*) found_loc) + pefile.GetImageBase()));
|
||||
set_pattern(found_loc, after, length);
|
||||
|
||||
SubsysCheck_jmp = found_loc + 12;
|
||||
_SubsysCheckPerform = decode_jmp(SubsysCheck_jmp, 5);
|
||||
}
|
||||
|
||||
void Patch::find_resource_check1()
|
||||
{
|
||||
static const short pattern[] = {
|
||||
0x6A,0x00,0x8D,0x45,0xE0,0x50,0xFF,0x75,0xA4,0xFF,0x75,0xD0,0x8D,0x45,
|
||||
0xCC,0x50,0xFF,0x75,0x08,0xE8,-2,-2,-2,-2,0x85,0xC0
|
||||
};
|
||||
|
||||
DWORD offset = (DWORD) pefile.GetSectionByName(CODE_SEG);
|
||||
int size = pefile.GetSectionSize(CODE_SEG);
|
||||
int length = sizeof(pattern) / sizeof(short);
|
||||
DWORD found_loc;
|
||||
int found = find_pattern(offset, size,pattern, length, &found_loc);
|
||||
if (found != 1)
|
||||
{
|
||||
if (!found) ShowError(IDS_NOPAT, "resource_check1");
|
||||
else ShowError(IDS_MULPAT, "resource_check1");
|
||||
}
|
||||
DBGPRINTF(("%s: pattern found @ 0x%08x\n", "resource_check1",
|
||||
pefile.PointerToRva((void*) found_loc) + pefile.GetImageBase()));
|
||||
GetOrdinal_call1 = found_loc + 19;
|
||||
_GetOrdinal = decode_call(GetOrdinal_call1, 5);
|
||||
}
|
||||
|
||||
void Patch::find_resource_check2()
|
||||
{
|
||||
static const short pattern[] = {
|
||||
0x66,0x8B,0x45,0xE0,0x66,0x2D,0x06,0x80,0x66,0x3D,0x01,0x00,0x1B,0xC0,
|
||||
0xF7,0xD8,0x50,0x8D,0x45,0xDE,0x50,0xFF,0x75, -1,0xFF,0x75,0xD0,0x8D,
|
||||
0x45,0xCC,0x50,0xFF,0x75,0x08,0xE8, -2, -2, -2, -2,0x85,0xC0
|
||||
};
|
||||
|
||||
DWORD offset = (DWORD) pefile.GetSectionByName(CODE_SEG);
|
||||
int size = pefile.GetSectionSize(CODE_SEG);
|
||||
int length = sizeof(pattern) / sizeof(short);
|
||||
DWORD found_loc;
|
||||
int found = find_pattern(offset, size,pattern, length, &found_loc);
|
||||
if (found != 1)
|
||||
{
|
||||
if (!found) ShowError(IDS_NOPAT, "resource_check2");
|
||||
else ShowError(IDS_MULPAT, "resource_check2");
|
||||
}
|
||||
DBGPRINTF(("%s: pattern found @ 0x%08x\n", "resource_check2",
|
||||
pefile.PointerToRva((void*) found_loc) + pefile.GetImageBase()));
|
||||
GetOrdinal_call2 = found_loc + 34;
|
||||
}
|
||||
|
||||
//no named/rcdata resource types mirroring
|
||||
void Patch::disable_named_and_rcdata_resources_mirroring()
|
||||
{
|
||||
static const short pattern[] = {
|
||||
0x66,0x8B,0x40,0x0E,0x66,0x89,0x45,0xDA,0x8B,0x45, -1,0x66,0x8B,0x48,
|
||||
0x0C,0x66,0x89,0x4D,0xD8,0x66,0x8B,0x45,0xE0,0x8B,0x4D,0xD4,0x66,0x89,
|
||||
0x01,0x83,0x45,0xD4,0x02,0x66,0x8B,0x45,0xDA,0x66,0x03,0x45,0xD8,0x66,
|
||||
0x89,0x45,0x8C,0x8B,0x4D,0xD4,0x66,0x89,0x01,0x83,0x45,0xD4,0x02
|
||||
};
|
||||
static const short after[] = {
|
||||
0x66,0x8B,0x48,0x0E,0x66,0x03,0x48,0x0C,0x66,0x89,0x4D,0x8C,0x8B,0x45,
|
||||
0xA4,0x83,0x38,0x0A,0x74,0x40,0x83,0x38,0x00,0x79,0x04,0x3B,0xC0,0xEB,
|
||||
0x37,0x66,0x8B,0x45,0xE0,0x8B,0x4D,0xD4,0x66,0x89,0x01,0x83,0xC1,0x02,
|
||||
0x66,0x8B,0x45,0x8C,0x66,0x89,0x01,0x83,0xC1,0x02,0x89,0x4D,0xD4
|
||||
};
|
||||
|
||||
DWORD offset = (DWORD) pefile.GetSectionByName(CODE_SEG);
|
||||
int size = pefile.GetSectionSize(CODE_SEG);
|
||||
int length = sizeof(pattern) / sizeof(short);
|
||||
DWORD found_loc;
|
||||
int found = find_pattern(offset, size, pattern, length, &found_loc);
|
||||
if (found != 1)
|
||||
{
|
||||
if (!found) ShowError(IDS_NOPAT, "disable_named_and_rcdata_resources_mirroring");
|
||||
else ShowError(IDS_MULPAT, "disable_named_and_rcdata_resources_mirroring");
|
||||
}
|
||||
DBGPRINTF(("%s: pattern found @ 0x%08x\n", "disable_named_and_rcdata_resources_mirroring",
|
||||
pefile.PointerToRva((void*) found_loc) + pefile.GetImageBase()));
|
||||
set_pattern(found_loc, after, length);
|
||||
}
|
||||
|
||||
void Patch::mod_imte_alloc()
|
||||
{
|
||||
//VA BFF8745C, RVA 1745C, file 15A5C, sec E45C
|
||||
static const short pattern[] = {
|
||||
0x66,0xff,0x05,-1,-1,-1,0xbf,0x6a,0x3c,0xe8,
|
||||
};
|
||||
static const short after[] = {
|
||||
0x66,0xff,0x05,-1,-1,-1,0xbf,0x6a,0x40,0xe8,
|
||||
};
|
||||
|
||||
DWORD offset = (DWORD) pefile.GetSectionByName(CODE_SEG);
|
||||
int size = pefile.GetSectionSize(CODE_SEG);
|
||||
int length = sizeof(pattern) / sizeof(short);
|
||||
DWORD found_loc;
|
||||
int found = find_pattern(offset, size, pattern, length, &found_loc);
|
||||
if (found != 1)
|
||||
{
|
||||
if (!found) ShowError(IDS_NOPAT, "mod_imte_alloc");
|
||||
else ShowError(IDS_MULPAT, "mod_imte_alloc");
|
||||
}
|
||||
DBGPRINTF(("%s: pattern found @ 0x%08x\n", "mod_imte_alloc",
|
||||
pefile.PointerToRva((void*) found_loc) + pefile.GetImageBase()));
|
||||
set_pattern(found_loc, after, length);
|
||||
}
|
||||
|
||||
void Patch::mod_mr_alloc()
|
||||
{
|
||||
static const short pattern[] = {
|
||||
0x75,0xF6,0x8D,0x04,-1,0x1C,0x00,0x00,0x00,0x50
|
||||
};
|
||||
static const short after[] = {
|
||||
0x75,0xF6,0x8D,0x04,-1,0x24,0x00,0x00,0x00,0x50
|
||||
};
|
||||
|
||||
DWORD offset = (DWORD) pefile.GetSectionByName(CODE_SEG);
|
||||
int size = pefile.GetSectionSize(CODE_SEG);
|
||||
int length = sizeof(pattern) / sizeof(short);
|
||||
DWORD found_loc;
|
||||
int found = find_pattern(offset, size, pattern, length, &found_loc);
|
||||
if (found != 1)
|
||||
{
|
||||
if (!found) ShowError(IDS_NOPAT, "mod_mr_alloc");
|
||||
else ShowError(IDS_MULPAT, "mod_mr_alloc");
|
||||
}
|
||||
DBGPRINTF(("%s: pattern found @ 0x%08x\n", "mod_mr_alloc",
|
||||
pefile.PointerToRva((void*) found_loc) + pefile.GetImageBase()));
|
||||
set_pattern(found_loc, after, length);
|
||||
}
|
||||
|
||||
void Patch::mod_pdb_alloc()
|
||||
{
|
||||
static const short pattern[] = {
|
||||
0x53,0x56,0x57,0x6A,0x06,0x68,0xC4,0x00,0x00,0x00,0xE8
|
||||
};
|
||||
static const short after[] = {
|
||||
0x53,0x56,0x57,0x6A,0x06,0x68,0xC8,0x00,0x00,0x00,0xE8
|
||||
};
|
||||
|
||||
DWORD offset = (DWORD) pefile.GetSectionByName(CODE_SEG);
|
||||
int size = pefile.GetSectionSize(CODE_SEG);
|
||||
int length = sizeof(pattern) / sizeof(short);
|
||||
DWORD found_loc;
|
||||
int found = find_pattern(offset, size, pattern, length, &found_loc);
|
||||
if (found != 1)
|
||||
{
|
||||
if (!found) ShowError(IDS_NOPAT, "mod_pdb_alloc");
|
||||
else ShowError(IDS_MULPAT, "mod_pdb_alloc");
|
||||
}
|
||||
DBGPRINTF(("%s: pattern found @ 0x%08x\n", "mod_pdb_alloc",
|
||||
pefile.PointerToRva((void*) found_loc) + pefile.GetImageBase()));
|
||||
set_pattern(found_loc, after, length);
|
||||
}
|
||||
|
||||
void Patch::find_ExportFromX()
|
||||
{
|
||||
static const short pattern[] = {
|
||||
0x8B,0x0D,-1,-1,-1,-1,0x0F,0xBF,0x40,0x10,0x8B,0x14,0x81,0x8B,0x44,
|
||||
0x24,0x14,0x3D,0x00,0x00,0x01,0x00,0x8B,0x4A,0x04,0x73,0x15,-1,0x1D,
|
||||
-1,-1,-1,-1,0x75,0x04,0x6A,0x32,0xEB,0x3E,0x50,0x51,0xE8,-2,-2,-2,-2,
|
||||
0xEB,0x0C,0xFF,0x74,0x24,0x14,0x6A,0x00,0x51,0xE8,-2,-2,-2,-2,0x83,
|
||||
0x7F,0x54,0x00,0x8B,0xF0
|
||||
};
|
||||
|
||||
DWORD offset = (DWORD) pefile.GetSectionByName(CODE_SEG);
|
||||
int size = pefile.GetSectionSize(CODE_SEG);
|
||||
int length = sizeof(pattern) / sizeof(short);
|
||||
DWORD found_loc;
|
||||
int found = find_pattern(offset, size,pattern, length, &found_loc);
|
||||
if (found != 1)
|
||||
{
|
||||
if (!found) ShowError(IDS_NOPAT, "exportfromX");
|
||||
else ShowError(IDS_MULPAT, "exportfromX");
|
||||
}
|
||||
DBGPRINTF(("%s: pattern found @ 0x%08x\n", "exportfromX",
|
||||
pefile.PointerToRva((void*) found_loc) + pefile.GetImageBase()));
|
||||
gpa_ExportFromOrdinal_call = found_loc + 0x29;
|
||||
gpa_ExportFromName_call = found_loc + 0x37;
|
||||
_ExportFromOrdinal = decode_call(gpa_ExportFromOrdinal_call, 5);
|
||||
_ExportFromName = decode_call(gpa_ExportFromName_call, 5);
|
||||
DWORD start = (DWORD) pefile.RvaToPointer(_ExportFromName);
|
||||
for (DWORD a = start ; a < start + 0x100 ; a++)
|
||||
if (is_call_ref(a, _ExportFromOrdinal))
|
||||
EFN_EFO_call = a;
|
||||
}
|
||||
|
||||
void Patch::find_IsKnownDLL()
|
||||
{
|
||||
static const short pattern[] = {
|
||||
0xFF,0x75,0xFC,0x8D,0x8D,0xF0,0xFE,0xFF,0xFF,0x51,0xE8,-2,-2,-2,-2,
|
||||
0x85,0xC0,0x75,0x1E,0x8D,0x85,0xE8,0xFD,0xFF,0xFF,
|
||||
0x8D,0x8D,0xF0,0xFE,0xFF,0xFF,0x50,0x51
|
||||
};
|
||||
|
||||
DWORD offset = (DWORD) pefile.GetSectionByName(CODE_SEG);
|
||||
int size = pefile.GetSectionSize(CODE_SEG);
|
||||
int length = sizeof(pattern) / sizeof(short);
|
||||
DWORD found_loc;
|
||||
int found = find_pattern(offset, size,pattern, length, &found_loc);
|
||||
if (found != 1)
|
||||
{
|
||||
if (!found) ShowError(IDS_NOPAT, "IsKnownDLL");
|
||||
else ShowError(IDS_MULPAT, "IsKnownDLL");
|
||||
}
|
||||
DBGPRINTF(("%s: pattern found @ 0x%08x\n", "IsKnownDLL",
|
||||
pefile.PointerToRva((void*) found_loc) + pefile.GetImageBase()));
|
||||
IsKnownDLL_call = found_loc + 10;
|
||||
_IsKnownDLL = decode_call(IsKnownDLL_call, 5);
|
||||
}
|
||||
|
||||
void Patch::find_FLoadTreeNotify1()
|
||||
{
|
||||
static const short pattern[] = {
|
||||
0x56,0xA1,-1,-1,-1,-1,0x6A,0x01,0x8B,0x08,0xFF,0xB1,0x98,0x00,0x00,
|
||||
0x00,0xE8,-2,-2,-2,-2,0x83,0xF8,0x01,0x1B,0xF6,0xF7,0xDE
|
||||
};
|
||||
|
||||
DWORD offset = (DWORD) pefile.GetSectionByName(CODE_SEG);
|
||||
int size = pefile.GetSectionSize(CODE_SEG);
|
||||
int length = sizeof(pattern) / sizeof(short);
|
||||
DWORD found_loc;
|
||||
int found = find_pattern(offset, size,pattern, length, &found_loc);
|
||||
if (found != 1)
|
||||
{
|
||||
if (!found) ShowError(IDS_NOPAT, "FLoadTreeNotify1");
|
||||
else ShowError(IDS_MULPAT, "FLoadTreeNotify1");
|
||||
}
|
||||
DBGPRINTF(("%s: pattern found @ 0x%08x\n", "FLoadTreeNotify1",
|
||||
pefile.PointerToRva((void*) found_loc) + pefile.GetImageBase()));
|
||||
FLoadTreeNotify_call1 = found_loc + 16;
|
||||
_FLoadTreeNotify = decode_call(FLoadTreeNotify_call1, 5);
|
||||
}
|
||||
|
||||
void Patch::find_FLoadTreeNotify2()
|
||||
{
|
||||
static const short pattern[] = {
|
||||
0x6A,0x00,0x57,0xE8,-1,-1,-1,-1,0x6A,0x00,0x56,0xE8,-2,-2,-2,-2,
|
||||
0x85,0xC0,0x74,0x12,0x56,0xE8,-1,-1,-1,-1,0x68,0x5A,0x04,0x00,0x00,
|
||||
0x33,0xF6,0xE8,-1,-1,-1,-1
|
||||
};
|
||||
|
||||
DWORD offset = (DWORD) pefile.GetSectionByName(CODE_SEG);
|
||||
int size = pefile.GetSectionSize(CODE_SEG);
|
||||
int length = sizeof(pattern) / sizeof(short);
|
||||
DWORD found_loc;
|
||||
int found = find_pattern(offset, size,pattern, length, &found_loc);
|
||||
if (found != 1)
|
||||
{
|
||||
if (!found) ShowError(IDS_NOPAT, "FLoadTreeNotify2");
|
||||
else ShowError(IDS_MULPAT, "FLoadTreeNotify2");
|
||||
}
|
||||
DBGPRINTF(("%s: pattern found @ 0x%08x\n", "FLoadTreeNotify2",
|
||||
pefile.PointerToRva((void*) found_loc) + pefile.GetImageBase()));
|
||||
FLoadTreeNotify_call2 = found_loc + 11;
|
||||
}
|
||||
|
||||
DWORD Patch::decode_call(DWORD addr, int len)
|
||||
{
|
||||
unsigned char* code = (unsigned char*)addr;
|
||||
|
||||
/* CALL rel32 */
|
||||
if (code[0] == 0xe8)
|
||||
{
|
||||
if (len && len == 5 || !len)
|
||||
return (DWORD)(pefile.PointerToRva(code) + 5 + *(INT32*)(code + 1));
|
||||
}
|
||||
/* CALL imm32 */
|
||||
else if (code[0] == 0xff && code[1] == 0x15)
|
||||
{
|
||||
if (len && len == 6 || !len)
|
||||
return *(DWORD*)(code + 2);
|
||||
}
|
||||
/* unmatched */
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD Patch::decode_jmp(DWORD addr, int len)
|
||||
{
|
||||
unsigned char* code = (unsigned char*)addr;
|
||||
|
||||
/* JMP rel8 */
|
||||
if (code[0] == 0xeb)
|
||||
{
|
||||
if (len && len == 2 || !len)
|
||||
return (DWORD)(pefile.PointerToRva(code) + 2 + *(INT8*)(code + 1));
|
||||
}
|
||||
/* JMP rel32 */
|
||||
else if (code[0] == 0xe9)
|
||||
{
|
||||
if (len && len == 5 || !len)
|
||||
return (DWORD)(pefile.PointerToRva(code) + 5 + *(INT32*)(code + 1));
|
||||
}
|
||||
/* JMP imm32 */
|
||||
else if (code[0] == 0xff && code[1] == 0x25)
|
||||
{
|
||||
if (len && len == 6 || !len)
|
||||
return *(DWORD*)(code + 2);
|
||||
}
|
||||
/* Jxx rel8 */
|
||||
else if (code[0] >= 0x70 && code[0] < 0x7f || code[0] == 0xe3)
|
||||
{
|
||||
if (len && len == 2 || !len)
|
||||
return (DWORD)(pefile.PointerToRva(code) + 2 + *(INT8*)(code + 1));
|
||||
}
|
||||
/* Jxx rel32 */
|
||||
else if (code[0] == 0x0f && code[1] >= 0x80 && code[1] <= 0x8f)
|
||||
{
|
||||
if (len && len == 6 || !len)
|
||||
return (DWORD)(pefile.PointerToRva(code) + 6 + *(INT32*)(code + 2));
|
||||
}
|
||||
/* unmatched */
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Patch::is_call_ref(DWORD loc, DWORD target)
|
||||
{
|
||||
DWORD addr = decode_call(loc, 5); // size of call imm32 opcode
|
||||
if (addr == target)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Both addresses have to be from the same section!
|
||||
void Patch::set_call_ref(DWORD loc, DWORD target)
|
||||
{
|
||||
DWORD rel;
|
||||
|
||||
assert(*(BYTE*) loc == 0xe8);
|
||||
|
||||
rel = target - (loc + 5);
|
||||
*(DWORD*)(loc + 1) = rel;
|
||||
}
|
||||
|
||||
// Both addresses have to be from the same section!
|
||||
void Patch::set_jmp_ref(DWORD loc, DWORD target)
|
||||
{
|
||||
DWORD rel;
|
||||
unsigned char* code = (unsigned char*)loc;
|
||||
|
||||
if (code[0] == 0xe9)
|
||||
{
|
||||
rel = target - (loc + 5);
|
||||
*(DWORD*)(loc + 1) = rel;
|
||||
}
|
||||
else if (code[0] == 0x0f && code[1] >= 0x80 && code[1] <= 0x8f)
|
||||
{
|
||||
rel = target - (loc + 6);
|
||||
*(DWORD*)(loc + 2) = rel;
|
||||
}
|
||||
else assert(false);
|
||||
}
|
||||
|
||||
bool Patch::is_fixupc(DWORD addr)
|
||||
{
|
||||
if (*(DWORD*)(addr - 5) == 0xDAC)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user