1
0
mirror of https://github.com/UzixLS/KernelEx.git synced 2025-07-19 07:21:20 +03:00

import KernelEx-4.0-RC1

This commit is contained in:
UzixLS
2018-11-03 16:18:57 +03:00
commit d4e0420295
295 changed files with 28034 additions and 0 deletions

131
KernelEx.dsw Executable file
View File

@ -0,0 +1,131 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Core"=.\core\core.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "KernelEx Base NonShared"=.\apilibs\kexbasen\kexbasen.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name prep
End Project Dependency
}}}
###############################################################################
Project: "KernelEx Base Shared"=.\apilibs\kexbases\kexbases.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name prep
End Project Dependency
}}}
###############################################################################
Project: "auxiliary"=.\auxiliary\auxiliary.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "kexcontrol"=.\kexcontrol\kexcontrol.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "kexcrt"=.\kexcrt\kexcrt.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "prep"=.\util\prep\prep.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "setup"=.\setup\setup.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "sheet"=.\sheet\sheet.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

313
KernelEx.nsi Executable file
View File

@ -0,0 +1,313 @@
!define VERSION '4.0 RC 1'
;--------------------------------
;Includes
!include "MUI2.nsh"
!include "UpdateDLL.nsh"
!include "WinVer.nsh"
;--------------------------------
;General
;Name and file
Name "KernelEx"
Caption "KernelEx ${VERSION} Setup"
OutFile "..\KernelEx-${VERSION}.exe"
;Default installation folder
InstallDir "$WINDIR\KernelEx"
;Get installation folder from registry if available
InstallDirRegKey HKLM "Software\KernelEx" "InstallDir"
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
; !define MUI_FINISHPAGE_NOAUTOCLOSE
; !define MUI_UNFINISHPAGE_NOAUTOCLOSE
;--------------------------------
;Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "License.txt"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
LangString DESC_SHORTPRODUCT ${LANG_ENGLISH} "Microsoft Layer for Unicode"
LangString DESC_LONGPRODUCT ${LANG_ENGLISH} "Microsoft Layer for Unicode on Windows 95, 98, and Me Systems, 1.1.3790.0"
LangString DESC_PRODUCT_DECISION ${LANG_ENGLISH} "$(DESC_SHORTPRODUCT) is required.$\nIt is strongly \
advised that you install$\n$(DESC_SHORTPRODUCT) before continuing.$\nIf you choose to continue, \
you will need to connect$\nto the internet before proceeding.$\nWould you like to continue with \
the installation?"
LangString SEC_PRODUCT ${LANG_ENGLISH} "$(DESC_SHORTPRODUCT) "
LangString DESC_INSTALLING ${LANG_ENGLISH} "Installing"
LangString DESC_DOWNLOADING1 ${LANG_ENGLISH} "Downloading"
LangString DESC_DOWNLOADFAILED ${LANG_ENGLISH} "Download Failed:"
LangString DESC_PRODUCT_TIMEOUT ${LANG_ENGLISH} "The installation of the $(DESC_SHORTPRODUCT) \
has timed out."
LangString ERROR_PRODUCT_INVALID_PATH ${LANG_ENGLISH} "The $(DESC_SHORTPRODUCT) Installation$\n\
was not found in the following location:$\n"
LangString ERROR_PRODUCT_FATAL ${LANG_ENGLISH} "A fatal error occurred during the installation$\n\
of the $(DESC_SHORTPRODUCT)."
LangString DESC_SETTINGS_PRESERVE ${LANG_ENGLISH} "Do you want to preserve custom settings?"
;--------------------------------
;Installer Section
Section "MSLU" SECPRODUCT
!define URL_PRODUCT "http://download.microsoft.com/download/b/7/5/b75eace3-00e2-4aa0-9a6f-0b6882c71642/unicows.exe"
IfFileExists $SYSDIR\unicows.dll 0 lbl_download
;check version
GetDllVersion $SYSDIR\unicows.dll $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF
StrCmp "1.1.3790.0" "$R2.$R3.$R4.$R5" lbl_Skip
lbl_download:
DetailPrint "$(DESC_DOWNLOADING1) $(DESC_SHORTPRODUCT)..."
MessageBox MB_ICONEXCLAMATION|MB_YESNO|MB_DEFBUTTON2 "$(DESC_PRODUCT_DECISION)" /SD IDNO \
IDYES +2 IDNO 0
Abort
; Download
AddSize 900
nsisdl::download /TIMEOUT=30000 "${URL_PRODUCT}" "$TEMP\unicows.exe"
Pop $0
StrCmp "$0" "success" lbl_continue
DetailPrint "$(DESC_DOWNLOADFAILED) $0"
Abort
lbl_continue:
DetailPrint "$(DESC_INSTALLING) $(DESC_SHORTPRODUCT)..."
Banner::show /NOUNLOAD "$(DESC_INSTALLING) $(DESC_SHORTPRODUCT)..."
CreateDirectory "$INSTDIR\MSLU"
nsExec::Exec '"$TEMP\unicows.exe" /t:$INSTDIR\MSLU'
Pop $0
Banner::destroy
Delete "$TEMP\unicows.exe"
; obtain any error code and inform the user ($0)
; If nsExec is unable to execute the process,
; it will return "error"
; If the process timed out it will return "timeout"
; else it will return the return code from the executed process.
StrCmp $0 "" lbl_NoError
StrCmp $0 "0" lbl_NoError
StrCmp $0 "error" lbl_Error
StrCmp $0 "timeout" lbl_TimeOut
; all others are fatal
DetailPrint "$(ERROR_PRODUCT_FATAL)[$0]"
Goto lbl_commonError
lbl_TimeOut:
DetailPrint "$(DESC_PRODUCT_TIMEOUT)"
Goto lbl_commonError
lbl_Error:
DetailPrint "$(ERROR_PRODUCT_INVALID_PATH)"
Goto lbl_commonError
lbl_commonError:
RMDir /r "$INSTDIR"
Abort
lbl_NoError:
CopyFiles /SILENT "$INSTDIR\MSLU\unicows.dll" "$INSTDIR\mslu.tmp"
Rename /REBOOTOK "$INSTDIR\mslu.tmp" "$SYSDIR\unicows.dll"
lbl_Skip:
SectionEnd
Section "Install"
SetDetailsView show
SetOutPath "$INSTDIR"
SetOverwrite on
File setup\Release\setupkex.exe
SetOverwrite lastused
nsExec::ExecToLog '"$INSTDIR\setupkex.exe" "$INSTDIR\kernel32.bak"'
Pop $0
DetailPrint " setup returned: $0"
Delete "$INSTDIR\setupkex.exe"
StrCmp $0 "0" +3
RMDir "$INSTDIR"
Abort
;Files to install
;UpdateDLL_Func params:
;$R4 - target; $R5 - tempdir; $R6 - register?; $R7 - source
GetTempFileName $0 "$INSTDIR"
File /oname=$0 "Core\Release\KernelEx.dll"
StrCpy $R4 "$INSTDIR\KernelEx.dll"
StrCpy $R6 "0"
StrCpy $R7 $0
Call UpgradeDLL_Func
GetTempFileName $0 "$INSTDIR"
File /oname=$0 "apilibs\kexbases\Release\kexbases.dll"
StrCpy $R4 "$INSTDIR\kexbases.dll"
StrCpy $R6 "0"
StrCpy $R7 $0
Call UpgradeDLL_Func
GetTempFileName $0 "$INSTDIR"
File /oname=$0 "apilibs\kexbasen\Release\kexbasen.dll"
StrCpy $R4 "$INSTDIR\kexbasen.dll"
StrCpy $R6 "0"
StrCpy $R7 $0
Call UpgradeDLL_Func
GetTempFileName $0 "$INSTDIR"
File /oname=$0 "sheet\Release\sheet.dll"
StrCpy $R4 "$INSTDIR\sheet.dll"
StrCpy $R6 "1"
StrCpy $R7 $0
Call UpgradeDLL_Func
SetOverwrite on
File apilibs\core.ini
File apilibs\settings.reg
File license.txt
GetTempFileName $0 "$INSTDIR"
File /oname=$0 auxiliary\msimg32.dll
Delete "$INSTDIR\msimg32.dll"
Rename /REBOOTOK $0 "$INSTDIR\msimg32.dll"
WriteRegStr HKLM "System\CurrentControlSet\Control\SessionManager\KnownDLLs" \
"MSIMG32" "..\KernelEx\msimg32.dll"
GetTempFileName $0 "$INSTDIR"
File /oname=$0 auxiliary\pdh.dll
Delete "$INSTDIR\pdh.dll"
Rename /REBOOTOK $0 "$INSTDIR\pdh.dll"
WriteRegStr HKLM "System\CurrentControlSet\Control\SessionManager\KnownDLLs" \
"PDH" "..\KernelEx\pdh.dll"
GetTempFileName $0 "$INSTDIR"
File /oname=$0 auxiliary\psapi.dll
Delete "$INSTDIR\psapi.dll"
Rename /REBOOTOK $0 "$INSTDIR\psapi.dll"
WriteRegStr HKLM "System\CurrentControlSet\Control\SessionManager\KnownDLLs" \
"PSAPI" "..\KernelEx\psapi.dll"
GetTempFileName $0 "$INSTDIR"
File /oname=$0 auxiliary\uxtheme.dll
Delete "$INSTDIR\uxtheme.dll"
Rename /REBOOTOK $0 "$INSTDIR\uxtheme.dll"
WriteRegStr HKLM "System\CurrentControlSet\Control\SessionManager\KnownDLLs" \
"UXTHEME" "..\KernelEx\uxtheme.dll"
GetTempFileName $0 "$INSTDIR"
File /oname=$0 auxiliary\wtsapi32.dll
Delete "$INSTDIR\wtsapi32.dll"
Rename /REBOOTOK $0 "$INSTDIR\wtsapi32.dll"
WriteRegStr HKLM "System\CurrentControlSet\Control\SessionManager\KnownDLLs" \
"WTSAPI32" "..\KernelEx\wtsapi32.dll"
SetOverwrite lastused
ExecWait '"$WINDIR\regedit.exe" /s "$INSTDIR\settings.reg"'
Delete "$INSTDIR\settings.reg"
;Store installation folder
WriteRegStr HKLM "Software\KernelEx" "InstallDir" $INSTDIR
;Store run key
WriteRegStr HKLM "System\CurrentControlSet\Control\MPRServices\KernelEx" "DLLName" "$INSTDIR\KernelEx.dll"
WriteRegStr HKLM "System\CurrentControlSet\Control\MPRServices\KernelEx" "EntryPoint" "_MprStart@4"
WriteRegDWORD HKLM "System\CurrentControlSet\Control\MPRServices\KernelEx" "StackSize" 0x1000
;Store uninstaller key
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\KernelEx" "DisplayName" "KernelEx ${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\KernelEx" "UninstallString" '"$INSTDIR\uninstall.exe"'
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SetRebootFlag true
SectionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall"
SetDetailsView show
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "$(DESC_SETTINGS_PRESERVE)" IDYES +2 IDNO 0
DeleteRegKey HKLM "Software\KernelEx"
DeleteRegKey HKLM "System\CurrentControlSet\Control\MPRServices\KernelEx"
DeleteRegKey /ifempty HKLM "System\CurrentControlSet\Control\MPRServices"
;Files to uninstall
Rename /REBOOTOK "$INSTDIR\kernel32.bak" "$SYSDIR\kernel32.dll"
Delete /REBOOTOK "$INSTDIR\KernelEx.dll"
Delete /REBOOTOK "$INSTDIR\kexbases.dll"
Delete /REBOOTOK "$INSTDIR\kexbasen.dll"
Delete "$INSTDIR\core.ini"
UnRegDLL "$INSTDIR\sheet.dll"
Delete /REBOOTOK "$INSTDIR\sheet.dll"
Delete "$INSTDIR\license.txt"
Delete /REBOOTOK "$INSTDIR\msimg32.dll"
DeleteRegValue HKLM "System\CurrentControlSet\Control\SessionManager\KnownDLLs" "MSIMG32"
Delete /REBOOTOK "$INSTDIR\pdh.dll"
DeleteRegValue HKLM "System\CurrentControlSet\Control\SessionManager\KnownDLLs" "PDH"
Delete /REBOOTOK "$INSTDIR\psapi.dll"
DeleteRegValue HKLM "System\CurrentControlSet\Control\SessionManager\KnownDLLs" "PSAPI"
Delete /REBOOTOK "$INSTDIR\uxtheme.dll"
DeleteRegValue HKLM "System\CurrentControlSet\Control\SessionManager\KnownDLLs" "UXTHEME"
Delete /REBOOTOK "$INSTDIR\wtsapi32.dll"
DeleteRegValue HKLM "System\CurrentControlSet\Control\SessionManager\KnownDLLs" "WTSAPI32"
Delete "$INSTDIR\Uninstall.exe"
RMDir /r "$INSTDIR\MSLU"
WriteINIStr $WINDIR\wininit.ini Rename DIRNUL $INSTDIR
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\KernelEx"
SetRebootFlag true
SectionEnd
;--------------------------------
;.onInit
Function .onInit
${If} ${IsWin98}
${OrIf} ${IsWinME}
Goto lbl_Ok
${EndIf}
MessageBox MB_ICONSTOP|MB_OK "This program requires Windows 98 or Windows Millennium."
Abort
lbl_Ok:
FunctionEnd

281
License.txt Executable file
View File

@ -0,0 +1,281 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS

180
UpdateDLL.nsh Executable file
View File

@ -0,0 +1,180 @@
!ifndef UPGRADEDLL_FUNC_INCLUDED
!define UPGRADEDLL_FUNC_INCLUDED
; Function - Upgrade DLL File
; Written by Opher Shachar on 2004/01/14
; Revised on 2004/01/15: Supports registering *.TLB, *.OLB files with 'regtlib.exe'
; Needs 'GetFileExt' (http://nsis.sourceforge.net/wiki/Get_extention_of_file)
; Revised 2007/02/06: fix directory as source, skip '.' and '..' entries
; $R6 now is VOLATILE
; Revised 2009/02 by Xeno86: tempdir = localdir, no tlb register, erase source
; file if no upgrade
; Based on macro by Joost Verburg
; --------------------------------------
;
; Parameters:
; $R4 = DESTFILE - Location of the DLL file that should be upgraded (on user's system)
; OR DESTDIR - Target directory for upgraded DLLs
; $R6 = REGISTER - if you want to upgrade a DLL that has to be registered.
; 0 = Don't register, anything else = Register -- note: VOLATILE
; $R7 = LOCALFILE - Location of the new DLL file (on the user's system)
; OR LOCALDIR - Source directory of newer DLLs
; Note: If you want to support Win9x, you can only use short filenames (8.3).
;
; Example of usage for single file:
; $R4 = "$SYSDIR\dllname.dll"
; $R6 = "1" (= Register DLL)
; $R7 = "Source_dir\dllname.dll"
; Call UpgradeDLL_Func
;
; Example of usage with File command:
; SetOutPath "$PLUGINSDIR\SysFiles"
; File /r "sys_files_to_be_installed\*.*" ...
; ...
; File "some_other_sys_file.dll"
; $R4 = "$SYSDIR" -- note no '\', MUST be an existing directory
; $R6 = "1" (= Register DLL)
; $R7 = "$PLUGINSDIR\SysFiles" -- note no '\'
; Call UpgradeDLL_Func
; RMDir /r "$PLUGINSDIR\SysFiles"
;
; Example of usage for whole bunch of external files:
; $R4 = "$SYSDIR" -- note no '\', MUST be an existing directory
; $R6 = "1" (= Register DLL)
; $R7 = "Source_dir" -- note no '\'
; Call UpgradeDLL_Func
Function UpgradeDLL_Func
Push $R0
Push $R1
Push $R2
Push $R3
SetOverwrite try
;------------------------
;Check single file
IfFileExists "$R7\*.*" +3
Call :upgradedll.doit
Goto upgradedll.end
;------------------------
;Enumerate directory
Push $0
Push $1
Push $2
StrCpy $1 $R7
StrCpy $2 $R4
FindFirst $0 $R0 "$1\*.*"
loop:
IfErrors upgradedll.nomore
StrCpy $R7 "$1\$R0"
StrCpy $R4 "$2\$R0"
StrCmp $R0 "." +3
StrCmp $R0 ".." +2
Call :upgradedll.doit
FindNext $0 $R0
Goto loop
upgradedll.nomore:
FindClose $0
StrCpy $R7 $1
StrCpy $R4 $2
Pop $2
Pop $1
Pop $0
Goto upgradedll.end
;------------------------
;Do we want to register file?
upgradedll.doit:
IntCmp $R6 0 upgradedll.moveon
;------------------------
;File already installed? No. Just copy
upgradedll.moveon:
IfFileExists $R4 0 upgradedll.copy
;------------------------
;Check file and version
ClearErrors
GetDLLVersion $R7 $R0 $R1
GetDLLVersion $R4 $R2 $R3
IfErrors upgradedll.upgrade
IntCmpU $R0 $R2 0 upgradedll.dontupgrade upgradedll.upgrade
IntCmpU $R1 $R3 upgradedll.upgrade upgradedll.dontupgrade upgradedll.upgrade
;------------------------
;Let's upgrade the DLL!
upgradedll.upgrade:
IntCmp $R6 1 0 +2 +2
UnRegDLL $R4 ;Unregister the DLL
;------------------------
;Try to copy the DLL directly
upgradedll.copy:
ClearErrors
Rename $R7 $R4
IfErrors 0 upgradedll.noreboot
;------------------------
;DLL is in use. Copy it to a temp file and Rename it on reboot.
Rename /REBOOTOK $R7 $R4
;------------------------
;Register the DLL on reboot
IntCmp $R6 0 upgradedll.done
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
"Register $R4" '"$SYSDIR\regsvr32.exe" /s "$R4"'
Goto upgradedll.done
;------------------------
;Register the DLL
upgradedll.noreboot:
IntCmp $R6 0 upgradedll.done
RegDLL $R4
Goto upgradedll.done
;------------------------
;No upgrade required - delete file
upgradedll.dontupgrade:
Delete $R7
;------------------------
;Done
upgradedll.done:
Return
;------------------------
;End
upgradedll.end:
Pop $R3
Pop $R2
Pop $R1
Pop $R0
;------------------------
;Restore settings
SetOverwrite lastused
FunctionEnd
!endif

136
apilibs/CORE.INI Normal file
View File

@ -0,0 +1,136 @@
[ApiConfigurations]
default=0
0=DCFG1
1=WIN95
2=WIN98
3=WINME
4=NT40
5=NT2K
6=WINXP
7=WIN2K3
8=VISTA
9=WIN2K8
[DCFG1]
contents=std,kexbases,kexbasen
noshow=1
[DCFG1.names.98]
KERNEL32.GetVersion=std
KERNEL32.GetVersionExA=std
KERNEL32.GetVersionExW=std
GDI32.SetWorldTransform=kexbases.0
GDI32.GetRandomRgn=std
GDI32.SetGraphicsMode=std
KERNEL32.VerSetConditionMask=none
KERNEL32.VerifyVersionInfoA=none
KERNEL32.VerifyVersionInfoW=none
[DCFG1.names.Me]
KERNEL32.GetVersion=std
KERNEL32.GetVersionExA=std
KERNEL32.GetVersionExW=std
GDI32.SetWorldTransform=kexbases.0
GDI32.GetRandomRgn=std
GDI32.SetGraphicsMode=std
KERNEL32.VerSetConditionMask=none
KERNEL32.VerifyVersionInfoA=none
KERNEL32.VerifyVersionInfoW=none
USER32.AllowSetForegroundWindow=std
USER32.LockSetForegroundWindow=std
USER32.GetMouseMovePointsEx=std
[WIN95]
inherit=DCFG1
desc=Windows 95
[WIN95.names]
KERNEL32.GetVersion=kexbases.0
KERNEL32.GetVersionExA=kexbases.0
KERNEL32.GetVersionExW=kexbases.0
[WIN98]
inherit=WIN95
desc=Windows 98 SE
[WIN98.names]
KERNEL32.GetVersion=kexbases.1
KERNEL32.GetVersionExA=kexbases.1
KERNEL32.GetVersionExW=kexbases.1
[WINME]
inherit=WIN98
desc=Windows Millennium
[WINME.names]
KERNEL32.GetVersion=kexbases.2
KERNEL32.GetVersionExA=kexbases.2
KERNEL32.GetVersionExW=kexbases.2
[NT40]
inherit=WIN95
desc=Windows NT 4.0 SP6
[NT40.names]
KERNEL32.GetVersion=kexbases.3
KERNEL32.GetVersionExA=kexbases.3
KERNEL32.GetVersionExW=kexbases.3
[NT2K]
inherit=NT40
desc=Windows 2000 SP4
[NT2K.names]
KERNEL32.GetVersion=kexbases.4
KERNEL32.GetVersionExA=kexbases.4
KERNEL32.GetVersionExW=kexbases.4
GDI32.SetWorldTransform=kexbases.1
GDI32.GetRandomRgn=kexbases.0
GDI32.SetGraphicsMode=kexbases.0
KERNEL32.VerSetConditionMask=kexbases.0
KERNEL32.VerifyVersionInfoA=kexbases.0
KERNEL32.VerifyVersionInfoW=kexbases.0
[WINXP]
inherit=NT2K
desc=Windows XP SP2
[WINXP.names]
KERNEL32.GetVersion=kexbases.5
KERNEL32.GetVersionExA=kexbases.5
KERNEL32.GetVersionExW=kexbases.5
KERNEL32.VerifyVersionInfoA=kexbases.1
KERNEL32.VerifyVersionInfoW=kexbases.1
[WIN2K3]
inherit=WINXP
desc=Windows 2003 SP1
[WIN2K3.names]
KERNEL32.GetVersion=kexbases.6
KERNEL32.GetVersionExA=kexbases.6
KERNEL32.GetVersionExW=kexbases.6
KERNEL32.VerifyVersionInfoA=kexbases.2
KERNEL32.VerifyVersionInfoW=kexbases.2
[VISTA]
inherit=WIN2K3
desc=Windows Vista
[VISTA.names]
KERNEL32.GetVersion=kexbases.7
KERNEL32.GetVersionExA=kexbases.7
KERNEL32.GetVersionExW=kexbases.7
KERNEL32.VerifyVersionInfoA=kexbases.3
KERNEL32.VerifyVersionInfoW=kexbases.3
[WIN2K8]
inherit=VISTA
desc=Windows 2008 SP1
[WIN2K8.names]
KERNEL32.GetVersion=kexbases.8
KERNEL32.GetVersionExA=kexbases.8
KERNEL32.GetVersionExW=kexbases.8
KERNEL32.VerifyVersionInfoA=kexbases.4
KERNEL32.VerifyVersionInfoW=kexbases.4

View File

@ -0,0 +1,66 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
#include "kexcoresdk.h"
#include "_advapi32_apilist.h"
BOOL init_advapi32()
{
return TRUE;
}
static const apilib_named_api advapi32_named_apis[] =
{
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("GetUserNameW", GetUserNameW_fwd),
DECL_API("IsTextUnicode", IsTextUnicode_fwd),
DECL_API("RegConnectRegistryW", RegConnectRegistryW_fwd),
DECL_API("RegCreateKeyExW", RegCreateKeyExW_fwd),
DECL_API("RegCreateKeyW", RegCreateKeyW_fwd),
DECL_API("RegDeleteKeyW", RegDeleteKeyW_fwd),
DECL_API("RegDeleteValueW", RegDeleteValueW_fwd),
DECL_API("RegEnumKeyExW", RegEnumKeyExW_fwd),
DECL_API("RegEnumKeyW", RegEnumKeyW_fwd),
DECL_API("RegEnumValueW", RegEnumValueW_fwd),
DECL_API("RegLoadKeyW", RegLoadKeyW_fwd),
DECL_API("RegOpenKeyExW", RegOpenKeyExW_fwd),
DECL_API("RegOpenKeyW", RegOpenKeyW_fwd),
DECL_API("RegQueryInfoKeyW", RegQueryInfoKeyW_fwd),
DECL_API("RegQueryMultipleValuesW", RegQueryMultipleValuesW_fwd),
DECL_API("RegQueryValueW", RegQueryValueW_fwd),
DECL_API("RegReplaceKeyW", RegReplaceKeyW_fwd),
DECL_API("RegSaveKeyW", RegSaveKeyW_fwd),
DECL_API("RegSetValueExW", RegSetValueExW_fwd),
DECL_API("RegSetValueW", RegSetValueW_fwd),
DECL_API("RegUnLoadKeyW", RegUnLoadKeyW_fwd),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};
#if 0
static const apilib_unnamed_api advapi32_ordinal_apis[] =
{
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
};
#endif
const apilib_api_table apitable_advapi32 = DECL_TAB("ADVAPI32.DLL", advapi32_named_apis, 0 /*advapi32_ordinal_apis*/);

View File

@ -0,0 +1,55 @@
/*
* KernelEx
* Copyright (C) 2008, 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.
*
*/
#ifndef _ADVAPI32_APILIST_H
#define _ADVAPI32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_advapi32();
extern const apilib_api_table apitable_advapi32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
FWDPROC GetUserNameW_fwd;
FWDPROC IsTextUnicode_fwd;
FWDPROC RegConnectRegistryW_fwd;
FWDPROC RegCreateKeyExW_fwd;
FWDPROC RegCreateKeyW_fwd;
FWDPROC RegDeleteKeyW_fwd;
FWDPROC RegDeleteValueW_fwd;
FWDPROC RegEnumKeyExW_fwd;
FWDPROC RegEnumKeyW_fwd;
FWDPROC RegEnumValueW_fwd;
FWDPROC RegLoadKeyW_fwd;
FWDPROC RegOpenKeyExW_fwd;
FWDPROC RegOpenKeyW_fwd;
FWDPROC RegQueryInfoKeyW_fwd;
FWDPROC RegQueryMultipleValuesW_fwd;
FWDPROC RegQueryValueW_fwd;
FWDPROC RegReplaceKeyW_fwd;
FWDPROC RegSaveKeyW_fwd;
FWDPROC RegSetValueExW_fwd;
FWDPROC RegSetValueW_fwd;
FWDPROC RegUnLoadKeyW_fwd;
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

View File

@ -0,0 +1,44 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "unifwd.h"
FORWARD_TO_UNICOWS(GetUserNameW);
FORWARD_TO_UNICOWS(IsTextUnicode);
FORWARD_TO_UNICOWS(RegConnectRegistryW);
FORWARD_TO_UNICOWS(RegCreateKeyExW);
FORWARD_TO_UNICOWS(RegCreateKeyW);
FORWARD_TO_UNICOWS(RegDeleteKeyW);
FORWARD_TO_UNICOWS(RegDeleteValueW);
FORWARD_TO_UNICOWS(RegEnumKeyExW);
FORWARD_TO_UNICOWS(RegEnumKeyW);
FORWARD_TO_UNICOWS(RegEnumValueW);
FORWARD_TO_UNICOWS(RegLoadKeyW);
FORWARD_TO_UNICOWS(RegOpenKeyExW);
FORWARD_TO_UNICOWS(RegOpenKeyW);
FORWARD_TO_UNICOWS(RegQueryInfoKeyW);
FORWARD_TO_UNICOWS(RegQueryMultipleValuesW);
FORWARD_TO_UNICOWS(RegQueryValueW);
FORWARD_TO_UNICOWS(RegReplaceKeyW);
FORWARD_TO_UNICOWS(RegSaveKeyW);
FORWARD_TO_UNICOWS(RegSetValueExW);
FORWARD_TO_UNICOWS(RegSetValueW);
FORWARD_TO_UNICOWS(RegUnLoadKeyW);

132
apilibs/kexbasen/auxdecl.h Normal file
View File

@ -0,0 +1,132 @@
/* This file contains required declarations missing from MINGW and MSVC6 without PSDK */
#ifndef __AUXDECL_H
#define __AUXDECL_H
#include <windows.h>
/* declarations for MSVC6 without PSDK */
#if defined (_MSC_VER) && (WINVER < 0x0500)
#define VER_MINORVERSION 0x0000001
#define VER_MAJORVERSION 0x0000002
#define VER_BUILDNUMBER 0x0000004
#define VER_PLATFORMID 0x0000008
#define VER_SERVICEPACKMINOR 0x0000010
#define VER_SERVICEPACKMAJOR 0x0000020
#define VER_SUITENAME 0x0000040
#define VER_PRODUCT_TYPE 0x0000080
#define VER_EQUAL 1
#define VER_GREATER 2
#define VER_GREATER_EQUAL 3
#define VER_LESS 4
#define VER_LESS_EQUAL 5
#define VER_AND 6
#define VER_OR 7
#define VER_NT_WORKSTATION 1
#define VER_NT_DOMAIN_CONTROLLER 2
#define VER_NT_SERVER 3
#define VER_SUITE_SMALLBUSINESS 1
#define VER_SUITE_ENTERPRISE 2
#define VER_SUITE_BACKOFFICE 4
#define VER_SUITE_TERMINAL 16
#define VER_SUITE_SMALLBUSINESS_RESTRICTED 32
#define VER_SUITE_EMBEDDEDNT 64
#define VER_SUITE_DATACENTER 128
#define VER_SUITE_SINGLEUSERTS 256
#define VER_SUITE_PERSONAL 512
#define VER_SUITE_BLADE 1024
#define VER_SUITE_STORAGE_SERVER 8192
#define VER_SUITE_COMPUTE_SERVER 16384
#define OSVERSIONINFOEXA __OSVERSIONINFOEXA
#define POSVERSIONINFOEXA __POSVERSIONINFOEXA
#define LPOSVERSIONINFOEXA __LPOSVERSIONINFOEXA
#define OSVERSIONINFOEXW __OSVERSIONINFOEXW
#define POSVERSIONINFOEXW __POSVERSIONINFOEXW
#define LPOSVERSIONINFOEXW __LPOSVERSIONINFOEXW
typedef struct {
DWORD dwOSVersionInfoSize;
DWORD dwMajorVersion;
DWORD dwMinorVersion;
DWORD dwBuildNumber;
DWORD dwPlatformId;
CHAR szCSDVersion[128];
WORD wServicePackMajor;
WORD wServicePackMinor;
WORD wSuiteMask;
BYTE wProductType;
BYTE wReserved;
} __OSVERSIONINFOEXA, *__POSVERSIONINFOEXA, *__LPOSVERSIONINFOEXA;
typedef struct {
DWORD dwOSVersionInfoSize;
DWORD dwMajorVersion;
DWORD dwMinorVersion;
DWORD dwBuildNumber;
DWORD dwPlatformId;
WCHAR szCSDVersion[128];
WORD wServicePackMajor;
WORD wServicePackMinor;
WORD wSuiteMask;
BYTE wProductType;
BYTE wReserved;
} __OSVERSIONINFOEXW, *__POSVERSIONINFOEXW, *__LPOSVERSIONINFOEXW;
typedef long LONG_PTR;
typedef BOOL (CALLBACK *UILANGUAGE_ENUMPROCA)(LPSTR, LONG_PTR);
typedef BOOL (CALLBACK *UILANGUAGE_ENUMPROCW)(LPWSTR, LONG_PTR);
#define MEMORYSTATUSEX __MEMORYSTATUSEX
#define PMEMORYSTATUSEX __PMEMORYSTATUSEX
#define LPMEMORYSTATUSEX __LPMEMORYSTATUSEX
typedef struct
{
DWORD dwLength;
DWORD dwMemoryLoad;
DWORDLONG ullTotalPhys;
DWORDLONG ullAvailPhys;
DWORDLONG ullTotalPageFile;
DWORDLONG ullAvailPageFile;
DWORDLONG ullTotalVirtual;
DWORDLONG ullAvailVirtual;
DWORDLONG ullAvailExtendedVirtual;
} __MEMORYSTATUSEX, *__PMEMORYSTATUSEX, *__LPMEMORYSTATUSEX;
typedef enum {
SHGFP_TYPE_CURRENT = 0,
SHGFP_TYPE_DEFAULT = 1,
} SHGFP_TYPE;
#define GA_ROOT 2
typedef void *LPPRINTDLGEX;
EXTERN_C int WINAPI GetRandomRgn(HDC hdc, HRGN hrgn, INT iNum);
EXTERN_C HRESULT WINAPI SHGetFolderPathA(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPSTR pszPath);
EXTERN_C HWND WINAPI GetAncestor(HWND hwnd, UINT gaFlags);
EXTERN_C UINT WINAPI RealGetWindowClass(HWND hwnd, LPTSTR pszType, UINT cchType);
#endif /* defined (_MSC_VER) && (WINVER < 0x0500) */
/* declarations for MINGW32 */
#ifdef __MINGW32_VERSION
/* The security descriptor structure */
typedef struct {
BYTE Revision;
BYTE Sbz1;
SECURITY_DESCRIPTOR_CONTROL Control;
DWORD Owner;
DWORD Group;
DWORD Sacl;
DWORD Dacl;
} SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
#endif /* __MINGW32_VERSION */
#endif /* __AUXDECL_H */

View File

@ -0,0 +1,54 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
#include "kexcoresdk.h"
#include "_comdlg32_apilist.h"
BOOL init_comdlg32()
{
return TRUE;
}
static const apilib_named_api comdlg32_named_apis[] =
{
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("ChooseColorW", ChooseColorW_fwd),
DECL_API("ChooseFontW", ChooseFontW_fwd),
DECL_API("FindTextW", FindTextW_fwd),
DECL_API("GetFileTitleW", GetFileTitleW_fwd),
DECL_API("GetOpenFileNameW", GetOpenFileNameW_fwd),
DECL_API("GetSaveFileNameW", GetSaveFileNameW_fwd),
DECL_API("PageSetupDlgW", PageSetupDlgW_fwd),
DECL_API("PrintDlgW", PrintDlgW_fwd),
DECL_API("ReplaceTextW", ReplaceTextW_fwd),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};
#if 0
static const apilib_unnamed_api comdlg32_ordinal_apis[] =
{
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
};
#endif
const apilib_api_table apitable_comdlg32 = DECL_TAB("COMDLG32.DLL", comdlg32_named_apis, 0 /*comdlg32_ordinal_apis*/);

View File

@ -0,0 +1,43 @@
/*
* KernelEx
* Copyright (C) 2008, 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.
*
*/
#ifndef _COMDLG32_APILIST_H
#define _COMDLG32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_comdlg32();
extern const apilib_api_table apitable_comdlg32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
FWDPROC ChooseColorW_fwd;
FWDPROC ChooseFontW_fwd;
FWDPROC FindTextW_fwd;
FWDPROC GetFileTitleW_fwd;
FWDPROC GetOpenFileNameW_fwd;
FWDPROC GetSaveFileNameW_fwd;
FWDPROC PageSetupDlgW_fwd;
FWDPROC PrintDlgW_fwd;
FWDPROC ReplaceTextW_fwd;
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

View File

@ -0,0 +1,32 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "unifwd.h"
FORWARD_TO_UNICOWS(ChooseColorW);
FORWARD_TO_UNICOWS(ChooseFontW);
FORWARD_TO_UNICOWS(FindTextW);
FORWARD_TO_UNICOWS(GetFileTitleW);
FORWARD_TO_UNICOWS(GetOpenFileNameW);
FORWARD_TO_UNICOWS(GetSaveFileNameW);
FORWARD_TO_UNICOWS(PageSetupDlgW);
FORWARD_TO_UNICOWS(PrintDlgW);
FORWARD_TO_UNICOWS(ReplaceTextW);

59
apilibs/kexbasen/common.c Normal file
View File

@ -0,0 +1,59 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
int acp_mcs;
static int GetMaxCharSize(UINT CodePage)
{
CPINFO cpi;
if (!GetCPInfo(CodePage, &cpi))
return 2;
return cpi.MaxCharSize;
}
BOOL common_init(void)
{
acp_mcs = GetMaxCharSize(CP_ACP);
return TRUE;
}
char* file_fixWprefix(char* in)
{
if (*(int *)in == 0x5c3f5c5c) //if (!strncmp(in, "\\?\", 4))
{
in += 4;
if (*(int *)in == 0x5c434e55) //if (!strncmp(in, "UNC\", 4))
{
in += 2;
*in = '\\';
}
}
return in;
}
void fatal_error(const char* msg)
{
MessageBox(NULL, msg, "KernelEx error", MB_OK | MB_ICONERROR);
#pragma message("place DBGBREAK here!!!!")
ExitProcess(1);
}

107
apilibs/kexbasen/common.h Normal file
View File

@ -0,0 +1,107 @@
/*
* KernelEx
* Copyright (C) 2008, 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.
*
*/
#ifndef __COMMON_H
#define __COMMON_H
#include <windows.h>
#include <malloc.h>
typedef int __stdcall STUB(void);
typedef int __stdcall FWDPROC(void);
extern int acp_mcs;
BOOL common_init(void);
int WINAPI CommonUnimpStub(void);
char* file_fixWprefix(char* in);
void fatal_error(const char* msg);
#ifdef __GNUC__
#define UNIMPL_FUNC(name,params) \
__asm__( ".text\n" \
".globl _" #name "_stub@0\n" \
"_" #name "_new@0:\n\t" \
"xor %eax, %eax\n\t" \
"movb $" #params ", %cl\n\t" \
"jmp _CommonUnimpStub@0\n\t" \
)
#else
#define UNIMPL_FUNC(name,params) \
int __declspec(naked) __stdcall name##_stub() \
{ \
__asm xor eax,eax \
__asm mov cl, params \
__asm jmp CommonUnimpStub \
}
#endif
#define AtoW(str, bsize) MultiByteToWideChar(CP_ACP, 0, str##A, -1, str##W, bsize)
#define WtoA(str, bsize) WideCharToMultiByte(CP_ACP, 0, str##W, -1, str##A, bsize, NULL, NULL)
#define _ALLOC_WtoA(str) \
const WCHAR* p; \
int c; \
for (p = str##W ; *p ; p++); \
c = (int) p - (int) str##W; \
c *= acp_mcs; \
str##A = (char*) alloca(c); \
WtoA(str, c)
#define ALLOC_WtoA(str) \
char* str##A; \
if (str##W) \
{ \
_ALLOC_WtoA(str); \
} \
else str##A = NULL
#define ALLOC_A(str, cnt) \
char* str##A = str##W ? ((char*) alloca(cnt)) : NULL
#define ABUFtoW(str, inbsize, outbsize) \
MultiByteToWideChar(CP_ACP, 0, str##A, inbsize, str##W, outbsize)
#define file_GetCP() \
UINT file_CP = AreFileApisANSI() ? CP_ACP : CP_OEMCP
#define file_AtoW(str, bsize) MultiByteToWideChar(file_CP, 0, str##A, -1, str##W, bsize)
#define file_WtoA(str, bsize) WideCharToMultiByte(file_CP, 0, str##W, -1, str##A, bsize, "_", NULL); \
str##A = file_fixWprefix(str##A)
#define file_ALLOC_WtoA(str) \
char* str##A; \
if (str##W) \
{ \
const WCHAR* p; \
int c; \
for (p = str##W ; *p ; p++); \
c = (int) p - (int) str##W; \
c *= acp_mcs; \
str##A = (char*) alloca(c); \
file_WtoA(str, c); \
} \
else str##A = NULL
#define file_ABUFtoW(str, cntsrc, bsize) \
MultiByteToWideChar(file_CP, 0, str##A, cntsrc, str##W, bsize)
#endif

6
apilibs/kexbasen/dirlist Normal file
View File

@ -0,0 +1,6 @@
kernel32
user32
gdi32
advapi32
comdlg32
shell32

View File

@ -0,0 +1,335 @@
/*
* KernelEx
*
* Copyright 1993 Alexandre Julliard
* 1997 Alex Korobka
* Copyright 2002,2003 Shachar Shemesh
* Copyright 2003 CodeWeavers Inc. (Ulrich Czekalla)
*
* Copyright (C) 2008, 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 <malloc.h>
#include <windows.h>
#include "common.h"
//#include <usp10.h>
typedef void *SCRIPT_CACHE;
typedef struct {
int cBytes;
WORD wgBlank;
WORD wgDefault;
WORD wgInvalid;
WORD wgKashida;
int iKashidaWidth;
} SCRIPT_FONTPROPERTIES;
typedef HRESULT (WINAPI *PFNSCRIPTGETCMAP) (
HDC hdc,
SCRIPT_CACHE *psc,
const WCHAR *pwcInChars,
int cChars,
DWORD dwFlags,
WORD *pwOutGlyphs);
typedef HRESULT (WINAPI *PFNSFC) (SCRIPT_CACHE *psc);
typedef HRESULT (WINAPI *PFNCGH) ( HDC hdc, SCRIPT_CACHE *psc, long *tmHeight );
typedef HRESULT (WINAPI *PFNGFP) ( HDC hdc, SCRIPT_CACHE *psc, SCRIPT_FONTPROPERTIES *sfp );
typedef HRESULT (WINAPI *PFNGETGABCWIDTH) ( HDC hdc, SCRIPT_CACHE *psc, WORD wGlyph, ABC *pABC);
static HRESULT WINAPI ScriptGetCMap_dld(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcInChars, int cChars, DWORD dwFlags, WORD *pwOutGlyphs);
static HRESULT WINAPI ScriptFreeCache_dld(SCRIPT_CACHE *psc);
static HRESULT WINAPI ScriptCacheGetHeight_dld(HDC hdc, SCRIPT_CACHE *psc, long *tmHeight);
static HRESULT WINAPI ScriptGetFontProperties_dld(HDC hdc, SCRIPT_CACHE *psc, SCRIPT_FONTPROPERTIES *sfp);
static PFNSCRIPTGETCMAP ScriptGetCMap_pfn = ScriptGetCMap_dld;
static PFNSFC ScriptFreeCache_pfn = ScriptFreeCache_dld;
static PFNCGH ScriptCacheGetHeight_pfn = ScriptCacheGetHeight_dld;
static PFNGFP ScriptGetFontProperties_pfn = ScriptGetFontProperties_dld;
static PFNGETGABCWIDTH ScriptGetGlyphABCWidth_pfn = NULL;
/* delay-loaded Uniscribe start */
static const char c_szUsp10[]="usp10.dll";
static FARPROC WINAPI LoadUniscribeProc(LPCSTR proc)
{
static HMODULE usp10;
FARPROC ret;
DWORD lasterr = GetLastError();
if (!usp10)
{
usp10 = GetModuleHandleA(c_szUsp10);
if (!usp10) usp10 = LoadLibraryA(c_szUsp10);
if (!usp10)
fatal_error("kexbasen: Failed to load Uniscribe!");
}
ret = GetProcAddress(usp10,proc);
SetLastError(lasterr);
return ret;
}
static HRESULT WINAPI ScriptGetCMap_dld(
HDC hdc,
SCRIPT_CACHE *psc,
const WCHAR *pwcInChars,
int cChars,
DWORD dwFlags,
WORD *pwOutGlyphs
)
{
PFNSCRIPTGETCMAP pfn;
pfn = (PFNSCRIPTGETCMAP)LoadUniscribeProc("ScriptGetCMap");
if ( !pfn ) return E_FAIL;
ScriptGetCMap_pfn = pfn;
return pfn (hdc,psc,pwcInChars,cChars,dwFlags,pwOutGlyphs);
}
static HRESULT WINAPI ScriptFreeCache_dld(
SCRIPT_CACHE *psc
)
{
PFNSFC pfn;
pfn = (PFNSFC)LoadUniscribeProc("ScriptFreeCache");
if ( !pfn ) return E_FAIL;
ScriptFreeCache_pfn = pfn;
return pfn (psc);
}
static HRESULT WINAPI ScriptCacheGetHeight_dld(
HDC hdc,
SCRIPT_CACHE *psc,
long *tmHeight
)
{
PFNCGH pfn;
pfn = (PFNCGH)LoadUniscribeProc("ScriptCacheGetHeight");
if ( !pfn ) return E_FAIL;
ScriptCacheGetHeight_pfn = pfn;
return pfn (hdc,psc,tmHeight);
}
static HRESULT WINAPI ScriptGetFontProperties_dld(
HDC hdc,
SCRIPT_CACHE *psc,
SCRIPT_FONTPROPERTIES *sfp
)
{
PFNGFP pfn;
pfn = (PFNGFP)LoadUniscribeProc("ScriptGetFontProperties");
if ( !pfn ) return E_FAIL;
ScriptGetFontProperties_pfn = pfn;
return pfn (hdc,psc,sfp);
}
/* delay-loaded Uniscribe END */
/* 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
)
{
HRESULT result;
SCRIPT_CACHE cache = 0;
if (!hdc || !pgi || (UINT)lpstr<0xFFFFu || !c) return GDI_ERROR;
result = ScriptGetCMap_pfn(hdc,&cache,lpstr,c,0,pgi);
if ( !( result == S_OK || result == S_FALSE ) ) return GDI_ERROR;
if ( fl && result == S_FALSE)
{
WORD* checkglyph = pgi;
int i;
SCRIPT_FONTPROPERTIES fpr;
fpr.cBytes = sizeof(SCRIPT_FONTPROPERTIES);
if (FAILED(ScriptGetFontProperties_pfn(hdc,&cache,&fpr))) return GDI_ERROR;
for (i = 0; i < c; i++)
{
if (*checkglyph == fpr.wgDefault) *checkglyph = 0xFFFF;
checkglyph++;
}
}
ScriptFreeCache_pfn(&cache);
return c;
}
static int WINAPI GdiGetCodePage( HDC hdc )
{
UINT cp = CP_ACP;
CHARSETINFO csi;
int charset = GetTextCharset(hdc);
/* Hmm, nicely designed api this one! */
if(TranslateCharsetInfo((DWORD*)charset, &csi, TCI_SRCCHARSET))
cp = csi.ciACP;
else
{
switch(charset)
{
case OEM_CHARSET:
cp = GetOEMCP();
break;
case DEFAULT_CHARSET:
cp = GetACP();
break;
}
}
return cp;
}
/* 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
)
{
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;
}
/* 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
)
{
SCRIPT_CACHE cache = 0;
ABC abc;
WORD* glyph = pgiIn;
int* dxs = alpDx;
int i;
int sum = 0;
int glyphwidth;
BOOL unfit = FALSE;
if (!ScriptGetGlyphABCWidth_pfn)
ScriptGetGlyphABCWidth_pfn = (PFNGETGABCWIDTH)LoadUniscribeProc("ScriptGetGlyphABCWidth");
if ( !hdc || !pgiIn || cgi<=0 || !lpSize || !ScriptGetGlyphABCWidth_pfn)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
//in UberKern, ScriptPlace was used. However, it's too costly...
//so let's compute the info ourselves
for (i = 0; i < cgi; i++)
{
if ( ScriptGetGlyphABCWidth_pfn(hdc,&cache,*glyph,&abc) != S_OK ) break;
glyphwidth = abc.abcA + abc.abcB + abc.abcC;
sum += glyphwidth;
if ( !unfit )
{
unfit = ( sum > nMaxExtent );
if (alpDx) {*dxs = sum; dxs++;}
if (unfit && lpnFit) *lpnFit = i+1; //test test!
}
glyph++;
}
lpSize->cx = sum;
ScriptCacheGetHeight_pfn(hdc,&cache,&lpSize->cy);
ScriptFreeCache_pfn(&cache);
return TRUE;
}
/* 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
)
{
return GetTextExtentExPointI_new(hdc,pgiIn,cgi,32768,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
)
{
SCRIPT_CACHE cache = 0;
ABC abc;
WORD glyph;
if (!ScriptGetGlyphABCWidth_pfn)
ScriptGetGlyphABCWidth_pfn = (PFNGETGABCWIDTH)LoadUniscribeProc("ScriptGetGlyphABCWidth");
if ( !hdc || !lpBuffer || cgi<=0 || !ScriptGetGlyphABCWidth_pfn)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if ( !pgi ) //cgi glyphs starting giFirst
{
for ( glyph = giFirst; glyph < giFirst+cgi; glyph++)
{
ScriptGetGlyphABCWidth_pfn(hdc,&cache,glyph,&abc);
*lpBuffer = abc.abcA + abc.abcB + abc.abcC;
lpBuffer++;
}
}
else
{
for ( glyph = 0; glyph < cgi; glyph++)
{
ScriptGetGlyphABCWidth_pfn(hdc,&cache,*pgi,&abc);
*lpBuffer = abc.abcA + abc.abcB + abc.abcC;
pgi++;
lpBuffer++;
}
}
ScriptFreeCache_pfn(&cache);
return TRUE;
}
/* 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
)
{
UINT glyph = 0;
if (uFormat & GGO_GLYPH_INDEX)
return GetGlyphOutlineA( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, lpmat2 );
GetGlyphIndicesW_new( hdc, (LPWSTR)&uChar, 1, (LPWORD)&glyph, 0 );
return GetGlyphOutlineA( hdc, glyph, uFormat | GGO_GLYPH_INDEX, lpgm, cbBuffer, lpvBuffer, lpmat2 );
}

View File

@ -0,0 +1,82 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
#include "kexcoresdk.h"
#include "_gdi32_apilist.h"
BOOL init_gdi32()
{
return TRUE;
}
static const apilib_named_api gdi32_named_apis[] =
{
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("CopyEnhMetaFileW", CopyEnhMetaFileW_fwd),
DECL_API("CopyMetaFileW", CopyMetaFileW_fwd),
DECL_API("CreateColorSpaceW", CreateColorSpaceW_fwd),
DECL_API("CreateDCW", CreateDCW_fwd),
DECL_API("CreateEnhMetaFileW", CreateEnhMetaFileW_fwd),
DECL_API("CreateFontIndirectW", CreateFontIndirectW_fwd),
DECL_API("CreateFontW", CreateFontW_fwd),
DECL_API("CreateICW", CreateICW_fwd),
DECL_API("CreateMetaFileW", CreateMetaFileW_fwd),
DECL_API("CreateScalableFontResourceW", CreateScalableFontResourceW_fwd),
DECL_API("EnumFontFamiliesExW", EnumFontFamiliesExW_fwd),
DECL_API("EnumFontFamiliesW", EnumFontFamiliesW_fwd),
DECL_API("EnumFontsW", EnumFontsW_fwd),
DECL_API("EnumICMProfilesW", EnumICMProfilesW_fwd),
DECL_API("GetCharABCWidthsW", GetCharABCWidthsW_fwd),
DECL_API("GetCharWidthI", GetCharWidthI_new),
DECL_API("GetCharacterPlacementW", GetCharacterPlacementW_fwd),
DECL_API("GetEnhMetaFileDescriptionW", GetEnhMetaFileDescriptionW_fwd),
DECL_API("GetEnhMetaFileW", GetEnhMetaFileW_fwd),
DECL_API("GetGlyphIndicesA", GetGlyphIndicesA_new),
DECL_API("GetGlyphIndicesW", GetGlyphIndicesW_new),
DECL_API("GetGlyphOutlineW", GetGlyphOutlineW_new),
DECL_API("GetICMProfileW", GetICMProfileW_fwd),
DECL_API("GetKerningPairsW", GetKerningPairsW_fwd),
DECL_API("GetLogColorSpaceW", GetLogColorSpaceW_fwd),
DECL_API("GetMetaFileW", GetMetaFileW_fwd),
DECL_API("GetObjectW", GetObjectW_fwd),
DECL_API("GetOutlineTextMetricsW", GetOutlineTextMetricsW_fwd),
DECL_API("GetTextExtentExPointI", GetTextExtentExPointI_new),
DECL_API("GetTextExtentExPointW", GetTextExtentExPointW_fwd),
DECL_API("GetTextExtentPointI", GetTextExtentPointI_new),
DECL_API("GetTextFaceW", GetTextFaceW_fwd),
DECL_API("GetTextMetricsW", GetTextMetricsW_fwd),
DECL_API("ResetDCW", ResetDCW_fwd),
DECL_API("SetICMProfileW", SetICMProfileW_fwd),
DECL_API("StartDocW", StartDocW_fwd),
DECL_API("UpdateICMRegKeyW", UpdateICMRegKeyW_fwd),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};
#if 0
static const apilib_unnamed_api gdi32_ordinal_apis[] =
{
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
};
#endif
const apilib_api_table apitable_gdi32 = DECL_TAB("GDI32.DLL", gdi32_named_apis, 0 /*gdi32_ordinal_apis*/);

View File

@ -0,0 +1,71 @@
/*
* KernelEx
* Copyright (C) 2008, 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.
*
*/
#ifndef _GDI32_APILIST_H
#define _GDI32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_gdi32();
extern const apilib_api_table apitable_gdi32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
int WINAPI GetGlyphIndicesW_new(HDC hdc, LPWSTR lpstr, int c, LPWORD pgi, DWORD fl);
int WINAPI GetGlyphIndicesA_new(HDC hdc, LPCSTR lpstr, int c, LPWORD pgi, DWORD fl);
BOOL WINAPI GetTextExtentExPointI_new(HDC hdc, LPWORD pgiIn, int cgi, int nMaxExtent, LPINT lpnFit, LPINT alpDx, LPSIZE lpSize);
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);
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;
FWDPROC CreateColorSpaceW_fwd;
FWDPROC CreateDCW_fwd;
FWDPROC CreateEnhMetaFileW_fwd;
FWDPROC CreateFontIndirectW_fwd;
FWDPROC CreateFontW_fwd;
FWDPROC CreateICW_fwd;
FWDPROC CreateMetaFileW_fwd;
FWDPROC CreateScalableFontResourceW_fwd;
FWDPROC EnumFontFamiliesExW_fwd;
FWDPROC EnumFontFamiliesW_fwd;
FWDPROC EnumFontsW_fwd;
FWDPROC EnumICMProfilesW_fwd;
FWDPROC GetCharABCWidthsW_fwd;
FWDPROC GetCharacterPlacementW_fwd;
FWDPROC GetEnhMetaFileDescriptionW_fwd;
FWDPROC GetEnhMetaFileW_fwd;
FWDPROC GetICMProfileW_fwd;
FWDPROC GetKerningPairsW_fwd;
FWDPROC GetLogColorSpaceW_fwd;
FWDPROC GetMetaFileW_fwd;
FWDPROC GetObjectW_fwd;
FWDPROC GetOutlineTextMetricsW_fwd;
FWDPROC GetTextExtentExPointW_fwd;
FWDPROC GetTextFaceW_fwd;
FWDPROC GetTextMetricsW_fwd;
FWDPROC ResetDCW_fwd;
FWDPROC SetICMProfileW_fwd;
FWDPROC StartDocW_fwd;
FWDPROC UpdateICMRegKeyW_fwd;
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

View File

@ -0,0 +1,54 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "unifwd.h"
FORWARD_TO_UNICOWS(CopyEnhMetaFileW);
FORWARD_TO_UNICOWS(CopyMetaFileW);
FORWARD_TO_UNICOWS(CreateColorSpaceW);
FORWARD_TO_UNICOWS(CreateDCW);
FORWARD_TO_UNICOWS(CreateEnhMetaFileW);
FORWARD_TO_UNICOWS(CreateFontIndirectW);
FORWARD_TO_UNICOWS(CreateFontW);
FORWARD_TO_UNICOWS(CreateICW);
FORWARD_TO_UNICOWS(CreateMetaFileW);
FORWARD_TO_UNICOWS(CreateScalableFontResourceW);
FORWARD_TO_UNICOWS(EnumFontFamiliesExW);
FORWARD_TO_UNICOWS(EnumFontFamiliesW);
FORWARD_TO_UNICOWS(EnumFontsW);
FORWARD_TO_UNICOWS(EnumICMProfilesW);
FORWARD_TO_UNICOWS(GetCharABCWidthsW);
FORWARD_TO_UNICOWS(GetCharacterPlacementW);
FORWARD_TO_UNICOWS(GetEnhMetaFileDescriptionW);
FORWARD_TO_UNICOWS(GetEnhMetaFileW);
FORWARD_TO_UNICOWS(GetICMProfileW);
FORWARD_TO_UNICOWS(GetKerningPairsW);
FORWARD_TO_UNICOWS(GetLogColorSpaceW);
FORWARD_TO_UNICOWS(GetMetaFileW);
FORWARD_TO_UNICOWS(GetObjectW);
FORWARD_TO_UNICOWS(GetOutlineTextMetricsW);
FORWARD_TO_UNICOWS(GetTextExtentExPointW);
FORWARD_TO_UNICOWS(GetTextFaceW);
FORWARD_TO_UNICOWS(GetTextMetricsW);
FORWARD_TO_UNICOWS(ResetDCW);
FORWARD_TO_UNICOWS(SetICMProfileW);
FORWARD_TO_UNICOWS(StartDocW);
FORWARD_TO_UNICOWS(UpdateICMRegKeyW);

View File

@ -0,0 +1,129 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
#include "kexcoresdk.h"
#include "_kernel32_apilist.h"
BOOL init_kernel32()
{
return TRUE;
}
static const apilib_named_api kernel32_named_apis[] =
{
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("BuildCommDCBAndTimeoutsW", BuildCommDCBAndTimeoutsW_fwd),
DECL_API("BuildCommDCBW", BuildCommDCBW_fwd),
DECL_API("CallNamedPipeW", CallNamedPipeW_fwd),
DECL_API("CommConfigDialogW", CommConfigDialogW_fwd),
DECL_API("CompareStringW", CompareStringW_fwd),
DECL_API("CreateEventW", CreateEventW_fwd),
DECL_API("CreateFileMappingW", CreateFileMappingW_fwd),
DECL_API("CreateMailslotW", CreateMailslotW_fwd),
DECL_API("CreateMutexW", CreateMutexW_fwd),
DECL_API("CreateProcessW", CreateProcessW_fwd),
DECL_API("CreateSemaphoreW", CreateSemaphoreW_fwd),
DECL_API("CreateWaitableTimerW", CreateWaitableTimerW_fwd),
DECL_API("EnumCalendarInfoExW", EnumCalendarInfoExW_fwd),
DECL_API("EnumCalendarInfoW", EnumCalendarInfoW_fwd),
DECL_API("EnumDateFormatsExW", EnumDateFormatsExW_fwd),
DECL_API("EnumDateFormatsW", EnumDateFormatsW_fwd),
DECL_API("EnumSystemCodePagesW", EnumSystemCodePagesW_fwd),
DECL_API("EnumSystemLocalesW", EnumSystemLocalesW_fwd),
DECL_API("EnumTimeFormatsW", EnumTimeFormatsW_fwd),
DECL_API("ExpandEnvironmentStringsW", ExpandEnvironmentStringsW_fwd),
DECL_API("FatalAppExitW", FatalAppExitW_fwd),
DECL_API("FillConsoleOutputCharacterW", FillConsoleOutputCharacterW_fwd),
DECL_API("FormatMessageW", FormatMessageW_fwd),
DECL_API("GetAtomNameW", GetAtomNameW_fwd),
DECL_API("GetCPInfoExW", GetCPInfoExW_fwd),
DECL_API("GetCalendarInfoW", GetCalendarInfoW_fwd),
DECL_API("GetComputerNameW", GetComputerNameW_fwd),
DECL_API("GetConsoleTitleW", GetConsoleTitleW_fwd),
DECL_API("GetCurrencyFormatW", GetCurrencyFormatW_fwd),
DECL_API("GetDateFormatW", GetDateFormatW_fwd),
DECL_API("GetDriveTypeW", GetDriveTypeW_fwd),
DECL_API("GetEnvironmentVariableW", GetEnvironmentVariableW_fwd),
DECL_API("GetLocaleInfoW", GetLocaleInfoW_fwd),
DECL_API("GetLogicalDriveStringsW", GetLogicalDriveStringsW_fwd),
DECL_API("GetModuleFileNameW", GetModuleFileNameW_fwd),
DECL_API("GetModuleHandleW", GetModuleHandleW_fwd),
DECL_API("GetNamedPipeHandleStateW", GetNamedPipeHandleStateW_fwd),
DECL_API("GetNumberFormatW", GetNumberFormatW_fwd),
DECL_API("GetPrivateProfileIntW", GetPrivateProfileIntW_fwd),
DECL_API("GetPrivateProfileSectionNamesW", GetPrivateProfileSectionNamesW_fwd),
DECL_API("GetPrivateProfileSectionW", GetPrivateProfileSectionW_fwd),
DECL_API("GetPrivateProfileStringW", GetPrivateProfileStringW_fwd),
DECL_API("GetPrivateProfileStructW", GetPrivateProfileStructW_fwd),
DECL_API("GetProfileIntW", GetProfileIntW_fwd),
DECL_API("GetProfileSectionW", GetProfileSectionW_fwd),
DECL_API("GetProfileStringW", GetProfileStringW_fwd),
DECL_API("GetStringTypeExW", GetStringTypeExW_fwd),
DECL_API("GetStringTypeW", GetStringTypeW_fwd),
DECL_API("GetTimeFormatW", GetTimeFormatW_fwd),
DECL_API("GetVolumeInformationW", GetVolumeInformationW_fwd),
DECL_API("IsBadStringPtrW", IsBadStringPtrW_fwd),
DECL_API("LCMapStringW", LCMapStringW_fwd),
DECL_API("LoadLibraryExW", LoadLibraryExW_fwd),
DECL_API("LoadLibraryW", LoadLibraryW_fwd),
DECL_API("OpenEventW", OpenEventW_fwd),
DECL_API("OpenFileMappingW", OpenFileMappingW_fwd),
DECL_API("OpenMutexW", OpenMutexW_fwd),
DECL_API("OpenSemaphoreW", OpenSemaphoreW_fwd),
DECL_API("OpenWaitableTimerW", OpenWaitableTimerW_fwd),
DECL_API("PeekConsoleInputW", PeekConsoleInputW_fwd),
DECL_API("QueryDosDeviceW", QueryDosDeviceW_fwd),
DECL_API("ReadConsoleInputW", ReadConsoleInputW_fwd),
DECL_API("ReadConsoleOutputCharacterW", ReadConsoleOutputCharacterW_fwd),
DECL_API("ReadConsoleOutputW", ReadConsoleOutputW_fwd),
DECL_API("ReadConsoleW", ReadConsoleW_fwd),
DECL_API("ScrollConsoleScreenBufferW", ScrollConsoleScreenBufferW_fwd),
DECL_API("SetCalendarInfoW", SetCalendarInfoW_fwd),
DECL_API("SetComputerNameW", SetComputerNameW_fwd),
DECL_API("SetDefaultCommConfigW", SetDefaultCommConfigW_fwd),
DECL_API("SetEnvironmentVariableW", SetEnvironmentVariableW_fwd),
DECL_API("SetLocaleInfoW", SetLocaleInfoW_fwd),
DECL_API("SetVolumeLabelW", SetVolumeLabelW_fwd),
DECL_API("WaitNamedPipeW", WaitNamedPipeW_fwd),
DECL_API("WriteConsoleInputW", WriteConsoleInputW_fwd),
DECL_API("WriteConsoleOutputCharacterW", WriteConsoleOutputCharacterW_fwd),
DECL_API("WriteConsoleOutputW", WriteConsoleOutputW_fwd),
DECL_API("WriteConsoleW", WriteConsoleW_fwd),
DECL_API("WritePrivateProfileSectionW", WritePrivateProfileSectionW_fwd),
DECL_API("WritePrivateProfileStringW", WritePrivateProfileStringW_fwd),
DECL_API("WritePrivateProfileStructW", WritePrivateProfileStructW_fwd),
DECL_API("WriteProfileSectionW", WriteProfileSectionW_fwd),
DECL_API("WriteProfileStringW", WriteProfileStringW_fwd),
DECL_API("lstrcmpW", lstrcmpW_fwd),
DECL_API("lstrcmpiW", lstrcmpiW_fwd),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};
#if 0
static const apilib_unnamed_api kernel32_ordinal_apis[] =
{
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
};
#endif
const apilib_api_table apitable_kernel32 = DECL_TAB("KERNEL32.DLL", kernel32_named_apis, 0 /*kernel32_ordinal_apis*/);

View File

@ -0,0 +1,118 @@
/*
* KernelEx
* Copyright (C) 2008, 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.
*
*/
#ifndef _KERNEL32_APILIST_H
#define _KERNEL32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_kernel32();
extern const apilib_api_table apitable_kernel32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
FWDPROC BuildCommDCBAndTimeoutsW_fwd;
FWDPROC BuildCommDCBW_fwd;
FWDPROC CallNamedPipeW_fwd;
FWDPROC CommConfigDialogW_fwd;
FWDPROC CompareStringW_fwd;
FWDPROC CreateEventW_fwd;
FWDPROC CreateFileMappingW_fwd;
FWDPROC CreateMailslotW_fwd;
FWDPROC CreateMutexW_fwd;
FWDPROC CreateProcessW_fwd;
FWDPROC CreateSemaphoreW_fwd;
FWDPROC CreateWaitableTimerW_fwd;
FWDPROC EnumCalendarInfoExW_fwd;
FWDPROC EnumCalendarInfoW_fwd;
FWDPROC EnumDateFormatsExW_fwd;
FWDPROC EnumDateFormatsW_fwd;
FWDPROC EnumSystemCodePagesW_fwd;
FWDPROC EnumSystemLocalesW_fwd;
FWDPROC EnumTimeFormatsW_fwd;
FWDPROC ExpandEnvironmentStringsW_fwd;
FWDPROC FatalAppExitW_fwd;
FWDPROC FillConsoleOutputCharacterW_fwd;
FWDPROC FormatMessageW_fwd;
FWDPROC GetAtomNameW_fwd;
FWDPROC GetCPInfoExW_fwd;
FWDPROC GetCalendarInfoW_fwd;
FWDPROC GetComputerNameW_fwd;
FWDPROC GetConsoleTitleW_fwd;
FWDPROC GetCurrencyFormatW_fwd;
FWDPROC GetDateFormatW_fwd;
FWDPROC GetDriveTypeW_fwd;
FWDPROC GetEnvironmentVariableW_fwd;
FWDPROC GetLocaleInfoW_fwd;
FWDPROC GetLogicalDriveStringsW_fwd;
FWDPROC GetModuleFileNameW_fwd;
FWDPROC GetModuleHandleW_fwd;
FWDPROC GetNamedPipeHandleStateW_fwd;
FWDPROC GetNumberFormatW_fwd;
FWDPROC GetPrivateProfileIntW_fwd;
FWDPROC GetPrivateProfileSectionNamesW_fwd;
FWDPROC GetPrivateProfileSectionW_fwd;
FWDPROC GetPrivateProfileStringW_fwd;
FWDPROC GetPrivateProfileStructW_fwd;
FWDPROC GetProfileIntW_fwd;
FWDPROC GetProfileSectionW_fwd;
FWDPROC GetProfileStringW_fwd;
FWDPROC GetStringTypeExW_fwd;
FWDPROC GetStringTypeW_fwd;
FWDPROC GetTimeFormatW_fwd;
FWDPROC GetVolumeInformationW_fwd;
FWDPROC IsBadStringPtrW_fwd;
FWDPROC LCMapStringW_fwd;
FWDPROC LoadLibraryExW_fwd;
FWDPROC LoadLibraryW_fwd;
FWDPROC OpenEventW_fwd;
FWDPROC OpenFileMappingW_fwd;
FWDPROC OpenMutexW_fwd;
FWDPROC OpenSemaphoreW_fwd;
FWDPROC OpenWaitableTimerW_fwd;
FWDPROC PeekConsoleInputW_fwd;
FWDPROC QueryDosDeviceW_fwd;
FWDPROC ReadConsoleInputW_fwd;
FWDPROC ReadConsoleOutputCharacterW_fwd;
FWDPROC ReadConsoleOutputW_fwd;
FWDPROC ReadConsoleW_fwd;
FWDPROC ScrollConsoleScreenBufferW_fwd;
FWDPROC SetCalendarInfoW_fwd;
FWDPROC SetComputerNameW_fwd;
FWDPROC SetDefaultCommConfigW_fwd;
FWDPROC SetEnvironmentVariableW_fwd;
FWDPROC SetLocaleInfoW_fwd;
FWDPROC SetVolumeLabelW_fwd;
FWDPROC WaitNamedPipeW_fwd;
FWDPROC WriteConsoleInputW_fwd;
FWDPROC WriteConsoleOutputCharacterW_fwd;
FWDPROC WriteConsoleOutputW_fwd;
FWDPROC WriteConsoleW_fwd;
FWDPROC WritePrivateProfileSectionW_fwd;
FWDPROC WritePrivateProfileStringW_fwd;
FWDPROC WritePrivateProfileStructW_fwd;
FWDPROC WriteProfileSectionW_fwd;
FWDPROC WriteProfileStringW_fwd;
FWDPROC lstrcmpW_fwd;
FWDPROC lstrcmpiW_fwd;
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

View File

@ -0,0 +1,107 @@
/*
* KernelEx
* Copyright (C) 2006-2008, 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 "unifwd.h"
FORWARD_TO_UNICOWS(BuildCommDCBAndTimeoutsW);
FORWARD_TO_UNICOWS(BuildCommDCBW);
FORWARD_TO_UNICOWS(CallNamedPipeW);
FORWARD_TO_UNICOWS(CommConfigDialogW);
FORWARD_TO_UNICOWS(CompareStringW);
FORWARD_TO_UNICOWS(CreateEventW);
FORWARD_TO_UNICOWS(CreateFileMappingW);
FORWARD_TO_UNICOWS(CreateMailslotW);
FORWARD_TO_UNICOWS(CreateMutexW);
FORWARD_TO_UNICOWS(CreateProcessW);
FORWARD_TO_UNICOWS(CreateSemaphoreW);
FORWARD_TO_UNICOWS(CreateWaitableTimerW);
FORWARD_TO_UNICOWS(EnumCalendarInfoExW);
FORWARD_TO_UNICOWS(EnumCalendarInfoW);
FORWARD_TO_UNICOWS(EnumDateFormatsExW);
FORWARD_TO_UNICOWS(EnumDateFormatsW);
FORWARD_TO_UNICOWS(EnumSystemCodePagesW);
FORWARD_TO_UNICOWS(EnumSystemLocalesW);
FORWARD_TO_UNICOWS(EnumTimeFormatsW);
FORWARD_TO_UNICOWS(ExpandEnvironmentStringsW);
FORWARD_TO_UNICOWS(FatalAppExitW);
FORWARD_TO_UNICOWS(FillConsoleOutputCharacterW);
FORWARD_TO_UNICOWS(FormatMessageW);
FORWARD_TO_UNICOWS(GetAtomNameW);
FORWARD_TO_UNICOWS(GetCPInfoExW);
FORWARD_TO_UNICOWS(GetCalendarInfoW);
FORWARD_TO_UNICOWS(GetComputerNameW);
FORWARD_TO_UNICOWS(GetConsoleTitleW);
FORWARD_TO_UNICOWS(GetCurrencyFormatW);
FORWARD_TO_UNICOWS(GetDateFormatW);
FORWARD_TO_UNICOWS(GetDriveTypeW);
FORWARD_TO_UNICOWS(GetEnvironmentVariableW);
FORWARD_TO_UNICOWS(GetLocaleInfoW);
FORWARD_TO_UNICOWS(GetLogicalDriveStringsW);
FORWARD_TO_UNICOWS(GetModuleFileNameW);
FORWARD_TO_UNICOWS(GetModuleHandleW);
FORWARD_TO_UNICOWS(GetNamedPipeHandleStateW);
FORWARD_TO_UNICOWS(GetNumberFormatW);
FORWARD_TO_UNICOWS(GetPrivateProfileIntW);
FORWARD_TO_UNICOWS(GetPrivateProfileSectionNamesW);
FORWARD_TO_UNICOWS(GetPrivateProfileSectionW);
FORWARD_TO_UNICOWS(GetPrivateProfileStringW);
FORWARD_TO_UNICOWS(GetPrivateProfileStructW);
FORWARD_TO_UNICOWS(GetProfileIntW);
FORWARD_TO_UNICOWS(GetProfileSectionW);
FORWARD_TO_UNICOWS(GetProfileStringW);
FORWARD_TO_UNICOWS(GetStringTypeExW);
FORWARD_TO_UNICOWS(GetStringTypeW);
FORWARD_TO_UNICOWS(GetTimeFormatW);
FORWARD_TO_UNICOWS(GetVolumeInformationW);
FORWARD_TO_UNICOWS(IsBadStringPtrW);
FORWARD_TO_UNICOWS(LCMapStringW);
FORWARD_TO_UNICOWS(LoadLibraryExW);
FORWARD_TO_UNICOWS(LoadLibraryW);
FORWARD_TO_UNICOWS(OpenEventW);
FORWARD_TO_UNICOWS(OpenFileMappingW);
FORWARD_TO_UNICOWS(OpenMutexW);
FORWARD_TO_UNICOWS(OpenSemaphoreW);
FORWARD_TO_UNICOWS(OpenWaitableTimerW);
FORWARD_TO_UNICOWS(PeekConsoleInputW);
FORWARD_TO_UNICOWS(QueryDosDeviceW);
FORWARD_TO_UNICOWS(ReadConsoleInputW);
FORWARD_TO_UNICOWS(ReadConsoleOutputCharacterW);
FORWARD_TO_UNICOWS(ReadConsoleOutputW);
FORWARD_TO_UNICOWS(ReadConsoleW);
FORWARD_TO_UNICOWS(ScrollConsoleScreenBufferW);
FORWARD_TO_UNICOWS(SetCalendarInfoW);
FORWARD_TO_UNICOWS(SetComputerNameW);
FORWARD_TO_UNICOWS(SetDefaultCommConfigW);
FORWARD_TO_UNICOWS(SetEnvironmentVariableW);
FORWARD_TO_UNICOWS(SetLocaleInfoW);
FORWARD_TO_UNICOWS(SetVolumeLabelW);
FORWARD_TO_UNICOWS(WaitNamedPipeW);
FORWARD_TO_UNICOWS(WriteConsoleInputW);
FORWARD_TO_UNICOWS(WriteConsoleOutputCharacterW);
FORWARD_TO_UNICOWS(WriteConsoleOutputW);
FORWARD_TO_UNICOWS(WriteConsoleW);
FORWARD_TO_UNICOWS(WritePrivateProfileSectionW);
FORWARD_TO_UNICOWS(WritePrivateProfileStringW);
FORWARD_TO_UNICOWS(WritePrivateProfileStructW);
FORWARD_TO_UNICOWS(WriteProfileSectionW);
FORWARD_TO_UNICOWS(WriteProfileStringW);
FORWARD_TO_UNICOWS(lstrcmpW);
FORWARD_TO_UNICOWS(lstrcmpiW);

View File

@ -0,0 +1 @@
LIBRARY kexbasen.dll BASE=0x7D000000

View File

@ -0,0 +1,295 @@
# Microsoft Developer Studio Project File - Name="KernelEx Base NonShared" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=KernelEx Base NonShared - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "kexbasen.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "kexbasen.mak" CFG="KernelEx Base NonShared - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "KernelEx Base NonShared - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "KernelEx Base NonShared - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "KernelEx Base NonShared - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "KEXBASEN_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /O2 /I "." /I "../../common" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D _WIN32_WINNT=0x0500 /YX /FD /TP /GF /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x415 /d "NDEBUG"
# ADD RSC /l 0x415 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# 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 ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib /nologo /dll /map /machine:I386 /nodefaultlib /OPT:NOWIN98
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "KernelEx Base NonShared - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "KEXBASEN_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "." /I "../../common" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D _WIN32_WINNT=0x0500 /YX /FD /TP /GZ /GF /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x415 /d "_DEBUG"
# ADD RSC /l 0x415 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# 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 ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib /nologo /dll /map /debug /machine:I386 /nodefaultlib /pdbtype:sept /OPT:NOWIN98
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "KernelEx Base NonShared - Win32 Release"
# Name "KernelEx Base NonShared - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Group "kernel32"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\kernel32\_kernel32_apilist.c
# End Source File
# Begin Source File
SOURCE=.\kernel32\_kernel32_apilist.h
# End Source File
# Begin Source File
SOURCE=.\kernel32\unikernel32.c
# End Source File
# End Group
# Begin Group "user32"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\user32\_user32_apilist.c
# End Source File
# Begin Source File
SOURCE=.\user32\_user32_apilist.h
# End Source File
# Begin Source File
SOURCE=.\user32\uniuser32.c
# End Source File
# End Group
# Begin Group "gdi32"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\gdi32\_gdi32_apilist.c
# End Source File
# Begin Source File
SOURCE=.\gdi32\_gdi32_apilist.h
# End Source File
# Begin Source File
SOURCE=.\gdi32\UberGDI.c
# End Source File
# Begin Source File
SOURCE=.\gdi32\unigdi32.c
# End Source File
# End Group
# Begin Group "advapi32"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\advapi32\_advapi32_apilist.c
# End Source File
# Begin Source File
SOURCE=.\advapi32\_advapi32_apilist.h
# End Source File
# Begin Source File
SOURCE=.\advapi32\uniadvapi32.c
# End Source File
# End Group
# Begin Group "comdlg32"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\comdlg32\_comdlg32_apilist.c
# End Source File
# Begin Source File
SOURCE=.\comdlg32\_comdlg32_apilist.h
# End Source File
# Begin Source File
SOURCE=.\comdlg32\unicomdlg32.c
# End Source File
# End Group
# Begin Group "shell32"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\shell32\_shell32_apilist.c
# End Source File
# Begin Source File
SOURCE=.\shell32\_shell32_apilist.h
# End Source File
# Begin Source File
SOURCE=.\shell32\auxshlguid.h
# End Source File
# Begin Source File
SOURCE=.\shell32\pidl.h
# End Source File
# Begin Source File
SOURCE=.\shell32\SHGetFolderLocation.c
# End Source File
# Begin Source File
SOURCE=.\shell32\SHGetFolderPath.c
# End Source File
# Begin Source File
SOURCE=.\shell32\unishell32.c
# End Source File
# End Group
# Begin Source File
SOURCE=.\common.c
# End Source File
# Begin Source File
SOURCE=.\kexbasen.def
!IF "$(CFG)" == "KernelEx Base NonShared - Win32 Release"
# Begin Custom Build
OutDir=.\Release
ProjDir=.
InputPath=.\kexbasen.def
BuildCmds= \
link /LIB /NOLOGO /MACHINE:IX86 /DEF:$(ProjDir)\shell32ord.def /OUT:$(OutDir)\shell32ord.lib
"$(OutDir)\shell32ord.lib" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(OutDir)\shell32ord.exp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "KernelEx Base NonShared - Win32 Debug"
# Begin Custom Build
OutDir=.\Debug
ProjDir=.
InputPath=.\kexbasen.def
BuildCmds= \
link /LIB /NOLOGO /MACHINE:IX86 /DEF:$(ProjDir)\shell32ord.def /OUT:$(OutDir)\shell32ord.lib
"$(OutDir)\shell32ord.lib" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(OutDir)\shell32ord.exp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\main.c
# End Source File
# Begin Source File
SOURCE=.\shell32ord.def
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=.\unifwd.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\auxdecl.h
# End Source File
# Begin Source File
SOURCE=.\common.h
# End Source File
# Begin Source File
SOURCE=.\unifwd.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\kexbasen.rc
# End Source File
# End Group
# End Target
# End Project

View File

@ -0,0 +1,109 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Polish resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_PLK)
#ifdef _WIN32
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
#pragma code_page(1250)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,0,1,0
PRODUCTVERSION 4,0,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Xeno86\0"
VALUE "FileDescription", "KernelEx Base Non-shared Api Library\0"
VALUE "FileVersion", "4, 0, 1, 0\0"
VALUE "InternalName", "kexbasen\0"
VALUE "LegalCopyright", "Copyright <20> 2009, Xeno86\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "kexbasen.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "KernelEx\0"
VALUE "ProductVersion", "4, 0, 1, 0\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END
#endif // !_MAC
#endif // Polish resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

77
apilibs/kexbasen/main.c Normal file
View File

@ -0,0 +1,77 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
#include "unifwd.h"
#include "kexcoresdk.h"
#include "kernel32/_kernel32_apilist.h"
#include "gdi32/_gdi32_apilist.h"
#include "user32/_user32_apilist.h"
#include "advapi32/_advapi32_apilist.h"
#include "comdlg32/_comdlg32_apilist.h"
#include "shell32/_shell32_apilist.h"
//#include "/__apilist.h"
static apilib_api_table api_table[7];
static void fill_apitable()
{
api_table[0] = apitable_kernel32;
api_table[1] = apitable_gdi32;
api_table[2] = apitable_user32;
api_table[3] = apitable_advapi32;
api_table[4] = apitable_comdlg32;
api_table[5] = apitable_shell32;
//last entry is null terminator
}
extern "C"
__declspec(dllexport)
const apilib_api_table* get_api_table()
{
fill_apitable();
//check if unicows is available
if (!unifwd_init())
return NULL;
return api_table;
}
BOOL init()
{
return common_init() && init_kernel32() && init_gdi32() && init_user32() && init_advapi32() && init_comdlg32() && init_shell32();
}
BOOL APIENTRY DllMain(HINSTANCE instance, DWORD reason, BOOL load_static)
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
// kexDebugPrint("KernelEx Base Non-shared library reporting in action!\n");
DisableThreadLibraryCalls(instance);
if (!init())
return FALSE;
break;
case DLL_PROCESS_DETACH:
// kexDebugPrint("KernelEx Base Non-shared library signing off!\n");
break;
}
return TRUE;
}

View File

@ -0,0 +1,15 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by kexbasen.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -0,0 +1,307 @@
/*
* Path Functions
*
* Copyright 1998, 1999, 2000 Juergen Schmied
* Copyright 2004 Juan Lang
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#ifdef _MSC_VER
#pragma warning(disable:4002)
#define TRACE() ((void)0)
#define TRACE_() ((void)0)
#define WARN() ((void)0)
#else
#define TRACE(...) do {} while(0)
#define TRACE_(x) TRACE
#define WARN(...) do {} while(0)
#endif
#define _WIN32_IE 0x0500
#include <windows.h>
#include <shlguid.h>
#include "auxshlguid.h"
#include "pidl.h"
#include <shlwapi.h>
#include "common.h"
#include "_shell32_apilist.h"
#include "auxdecl.h"
EXTERN_C HRESULT WINAPI SHILCreateFromPathA(LPCSTR path, LPITEMIDLIST *ppidl, DWORD *attributes); /* ORDINAL 28 */
EXTERN_C LPVOID WINAPI SHAlloc(DWORD len); /* ORDINAL 196 */
EXTERN_C void WINAPI SHFree(LPVOID pv); /* ORDINAL 195 */
EXTERN_C LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl); /* ORDINAL 153 */
EXTERN_C LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2); /* ORDINAL 25 */
/**************************************************************************
*
* internal functions
*
* ### 1. section creating pidls ###
*
*************************************************************************
*/
LPITEMIDLIST _ILAlloc(PIDLTYPE type, unsigned int size)
{
LPITEMIDLIST pidlOut = NULL;
pidlOut = (LPITEMIDLIST) SHAlloc(size + 5);
if(pidlOut)
{
LPPIDLDATA pData;
LPITEMIDLIST pidlNext;
ZeroMemory(pidlOut, size + 5);
pidlOut->mkid.cb = size + 3;
pData = _ILGetDataPointer(pidlOut);
if (pData)
pData->type = type;
pidlNext = ILGetNext(pidlOut);
if (pidlNext)
pidlNext->mkid.cb = 0x00;
TRACE("-- (pidl=%p, size=%u)\n", pidlOut, size);
}
return pidlOut;
}
LPITEMIDLIST _ILCreateDesktop()
{
LPITEMIDLIST ret;
TRACE("()\n");
ret = (LPITEMIDLIST) SHAlloc(2);
if (ret)
ret->mkid.cb = 0;
return ret;
}
LPITEMIDLIST _ILCreateMyComputer()
{
TRACE("()\n");
return _ILCreateGuid(PT_GUID, &CLSID_MyComputer);
}
LPITEMIDLIST _ILCreateMyDocuments()
{
TRACE("()\n");
return _ILCreateGuid(PT_GUID, &CLSID_MyDocuments);
}
LPITEMIDLIST _ILCreateIExplore()
{
TRACE("()\n");
return _ILCreateGuid(PT_GUID, &CLSID_Internet);
}
LPITEMIDLIST _ILCreateControlPanel()
{
LPITEMIDLIST parent = _ILCreateGuid(PT_GUID, &CLSID_MyComputer), ret = NULL;
TRACE("()\n");
if (parent)
{
LPITEMIDLIST cpl = _ILCreateGuid(PT_SHELLEXT, &CLSID_ControlPanel);
if (cpl)
{
ret = ILCombine(parent, cpl);
SHFree(cpl);
}
SHFree(parent);
}
return ret;
}
LPITEMIDLIST _ILCreatePrinters()
{
LPITEMIDLIST parent = _ILCreateGuid(PT_GUID, &CLSID_MyComputer), ret = NULL;
TRACE("()\n");
if (parent)
{
LPITEMIDLIST printers = _ILCreateGuid(PT_YAGUID, &CLSID_Printers);
if (printers)
{
ret = ILCombine(parent, printers);
SHFree(printers);
}
SHFree(parent);
}
return ret;
}
LPITEMIDLIST _ILCreateNetwork()
{
TRACE("()\n");
return _ILCreateGuid(PT_GUID, &CLSID_NetworkPlaces);
}
LPITEMIDLIST _ILCreateBitBucket()
{
TRACE("()\n");
return _ILCreateGuid(PT_GUID, &CLSID_RecycleBin);
}
LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, const IID *guid)
{
LPITEMIDLIST pidlOut;
if (type == PT_SHELLEXT || type == PT_GUID || type == PT_YAGUID)
{
pidlOut = _ILAlloc(type, sizeof(GUIDStruct));
if (pidlOut)
{
LPPIDLDATA pData = _ILGetDataPointer(pidlOut);
memcpy(&(pData->u.guid.guid), guid, sizeof(GUID));
TRACE("-- create GUID-pidl %s\n",
debugstr_guid(&(pData->u.guid.guid)));
}
}
else
{
WARN("%d: invalid type for GUID\n", type);
pidlOut = NULL;
}
return pidlOut;
}
/**************************************************************************
*
* ### 4. getting pointers to parts of pidls ###
*
**************************************************************************
* _ILGetDataPointer()
*/
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
{
if(pidl && pidl->mkid.cb != 0x00)
return (LPPIDLDATA) &(pidl->mkid.abID);
return NULL;
}
/*************************************************************************
* SHGetFolderLocation [SHELL32.@]
*
* Gets the folder locations from the registry and creates a pidl.
*
* PARAMS
* hwndOwner [I]
* nFolder [I] CSIDL_xxxxx
* hToken [I] token representing user, or NULL for current user, or -1 for
* default user
* dwReserved [I] must be zero
* ppidl [O] PIDL of a special folder
*
* RETURNS
* Success: S_OK
* Failure: Standard OLE-defined error result, S_FALSE or E_INVALIDARG
*
* NOTES
* Creates missing reg keys and directories.
* Mostly forwards to SHGetFolderPathW, but a few values of nFolder return
* virtual folders that are handled here.
*/
/* MAKE_EXPORT SHGetFolderLocation_new=SHGetFolderLocation */
HRESULT WINAPI SHGetFolderLocation_new(
HWND hwndOwner,
int nFolder,
HANDLE hToken,
DWORD dwReserved,
LPVOID *_ppidl)
{
LPITEMIDLIST *ppidl = (LPITEMIDLIST*) _ppidl;
HRESULT hr = E_INVALIDARG;
TRACE("%p 0x%08x %p 0x%08lx %p\n",
hwndOwner, nFolder, hToken, dwReserved, ppidl);
if (!ppidl)
return E_INVALIDARG;
if (dwReserved)
return E_INVALIDARG;
/* The virtual folders' locations are not user-dependent */
*ppidl = NULL;
switch (nFolder)
{
case CSIDL_DESKTOP:
*ppidl = _ILCreateDesktop();
break;
case CSIDL_PERSONAL:
*ppidl = _ILCreateMyDocuments();
break;
case CSIDL_INTERNET:
*ppidl = _ILCreateIExplore();
break;
case CSIDL_CONTROLS:
*ppidl = _ILCreateControlPanel();
break;
case CSIDL_PRINTERS:
*ppidl = _ILCreatePrinters();
break;
case CSIDL_BITBUCKET:
*ppidl = _ILCreateBitBucket();
break;
case CSIDL_DRIVES:
*ppidl = _ILCreateMyComputer();
break;
case CSIDL_NETWORK:
*ppidl = _ILCreateNetwork();
break;
default:
{
char szPath[MAX_PATH];
hr = SHGetFolderPathA_new(hwndOwner, nFolder, hToken,
SHGFP_TYPE_CURRENT, szPath);
if (SUCCEEDED(hr))
{
DWORD attributes=0;
TRACE("Value=%s\n", debugstr_w(szPath));
hr = SHILCreateFromPathA(szPath, ppidl, &attributes);
}
else if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
{
/* unlike SHGetFolderPath, SHGetFolderLocation in shell32
* version 6.0 returns E_FAIL for nonexistent paths
*/
hr = E_FAIL;
}
}
}
if(*ppidl)
hr = NOERROR;
TRACE("-- (new pidl %p)\n",*ppidl);
return hr;
}

View File

@ -0,0 +1,80 @@
/*
* KernelEx
* Copyright (C) 2009, 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 "kexcoresdk.h"
typedef HRESULT (WINAPI *SHGetFolderPathA_t)(HWND, int, HANDLE, DWORD, LPSTR);
typedef HRESULT (WINAPI *SHGetFolderPathW_t)(HWND, int, HANDLE, DWORD, LPWSTR);
static SHGetFolderPathA_t SHGetFolderPathA_pfn = (SHGetFolderPathA_t)-1;
static SHGetFolderPathW_t SHGetFolderPathW_pfn = (SHGetFolderPathW_t)-1;
BOOL init_shfolder(void)
{
DWORD lasterr = GetLastError();
HMODULE hShell32 = GetModuleHandle("SHELL32.DLL");
PROC pfn = kexGetProcAddress(hShell32, "SHGetFolderPathA");
if (pfn)
SHGetFolderPathA_pfn = (SHGetFolderPathA_t) pfn;
pfn = kexGetProcAddress(hShell32, "SHGetFolderPathW");
if (pfn)
SHGetFolderPathW_pfn = (SHGetFolderPathW_t) pfn;
SetLastError(lasterr);
return TRUE;
}
static PROC LoadShfolderProc(const char* proc)
{
static const char ShfolderFn[] = "SHFOLDER.DLL";
static HMODULE hShfolder;
PROC ret = NULL;
DWORD lasterr = GetLastError();
if (!hShfolder)
{
hShfolder = GetModuleHandle(ShfolderFn);
if (!hShfolder) hShfolder = LoadLibrary(ShfolderFn);
if (hShfolder) ret = kexGetProcAddress(hShfolder, proc);
}
SetLastError(lasterr);
return ret;
}
/* MAKE_EXPORT SHGetFolderPathA_new=SHGetFolderPathA */
HRESULT WINAPI SHGetFolderPathA_new(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPSTR pszPath)
{
if (SHGetFolderPathA_pfn == (void*)-1)
SHGetFolderPathA_pfn = (SHGetFolderPathA_t) LoadShfolderProc("SHGetFolderPathA");
if (SHGetFolderPathA_pfn == NULL)
return E_NOTIMPL;
return SHGetFolderPathA_pfn(hwndOwner, nFolder, hToken, dwFlags, pszPath);
}
/* MAKE_EXPORT SHGetFolderPathW_new=SHGetFolderPathW */
HRESULT WINAPI SHGetFolderPathW_new(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
{
if (SHGetFolderPathW_pfn == (void*)-1)
SHGetFolderPathW_pfn = (SHGetFolderPathW_t) LoadShfolderProc("SHGetFolderPathW");
if (SHGetFolderPathW_pfn == NULL)
return E_NOTIMPL;
return SHGetFolderPathW_pfn(hwndOwner, nFolder, hToken, dwFlags, pszPath);
}

View File

@ -0,0 +1,62 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
#include "kexcoresdk.h"
#include "_shell32_apilist.h"
extern BOOL init_shfolder(void);
BOOL init_shell32()
{
return init_shfolder();
}
static const apilib_named_api shell32_named_apis[] =
{
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("DragQueryFileW", DragQueryFileW_fwd),
DECL_API("ExtractIconExW", ExtractIconExW_fwd),
DECL_API("ExtractIconW", ExtractIconW_fwd),
DECL_API("FindExecutableW", FindExecutableW_fwd),
DECL_API("SHBrowseForFolderW", SHBrowseForFolderW_fwd),
DECL_API("SHFileOperationW", SHFileOperationW_fwd),
DECL_API("SHGetFileInfoW", SHGetFileInfoW_fwd),
DECL_API("SHGetFolderLocation", SHGetFolderLocation_new),
DECL_API("SHGetFolderPathA", SHGetFolderPathA_new),
DECL_API("SHGetFolderPathW", SHGetFolderPathW_new),
DECL_API("SHGetNewLinkInfoW", SHGetNewLinkInfoW_fwd),
DECL_API("ShellAboutW", ShellAboutW_fwd),
DECL_API("ShellExecuteExW", ShellExecuteExW_fwd),
DECL_API("ShellExecuteW", ShellExecuteW_fwd),
DECL_API("Shell_NotifyIconW", Shell_NotifyIconW_fwd),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};
#if 0
static const apilib_unnamed_api shell32_ordinal_apis[] =
{
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
};
#endif
const apilib_api_table apitable_shell32 = DECL_TAB("SHELL32.DLL", shell32_named_apis, 0 /*shell32_ordinal_apis*/);

View File

@ -0,0 +1,49 @@
/*
* KernelEx
* Copyright (C) 2008, 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.
*
*/
#ifndef _SHELL32_APILIST_H
#define _SHELL32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_shell32();
extern const apilib_api_table apitable_shell32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
HRESULT WINAPI SHGetFolderLocation_new(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPVOID *_ppidl);
HRESULT WINAPI SHGetFolderPathA_new(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPSTR pszPath);
HRESULT WINAPI SHGetFolderPathW_new(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath);
FWDPROC DragQueryFileW_fwd;
FWDPROC ExtractIconExW_fwd;
FWDPROC ExtractIconW_fwd;
FWDPROC FindExecutableW_fwd;
FWDPROC SHBrowseForFolderW_fwd;
FWDPROC Shell_NotifyIconW_fwd;
FWDPROC ShellAboutW_fwd;
FWDPROC ShellExecuteExW_fwd;
FWDPROC ShellExecuteW_fwd;
FWDPROC SHFileOperationW_fwd;
FWDPROC SHGetFileInfoW_fwd;
FWDPROC SHGetNewLinkInfoW_fwd;
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

View File

@ -0,0 +1,24 @@
#ifndef __AUX_SHLGUID_H
#define __AUX_SHLGUID_H
#ifdef DEFINE_GUID
#undef DEFINE_GUID
#endif
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
const GUID name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(CLSID_NetworkPlaces, 0x208D2C60, 0x3AEA, 0x1069, 0xA2, 0xD7, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D);
DEFINE_GUID(CLSID_NetworkDomain, 0x46e06680, 0x4bf0, 0x11d1, 0x83, 0xee, 0x00, 0xa0, 0xc9, 0x0d, 0xc8, 0x49);
DEFINE_GUID(CLSID_NetworkServer, 0xc0542a90, 0x4bf0, 0x11d1, 0x83, 0xee, 0x00, 0xa0, 0xc9, 0x0d, 0xc8, 0x49);
DEFINE_GUID(CLSID_NetworkShare, 0x54a754c0, 0x4bf0, 0x11d1, 0x83, 0xee, 0x00, 0xa0, 0xc9, 0x0d, 0xc8, 0x49);
DEFINE_GUID(CLSID_MyComputer, 0x20D04FE0, 0x3AEA, 0x1069, 0xA2, 0xD8, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D);
DEFINE_GUID(CLSID_Internet, 0x871C5380, 0x42A0, 0x1069, 0xA2, 0xEA, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D);
DEFINE_GUID(CLSID_ShellFSFolder, 0xF3364BA0, 0x65B9, 0x11CE, 0xA9, 0xBA, 0x00, 0xAA, 0x00, 0x4A, 0xE8, 0x37);
DEFINE_GUID(CLSID_RecycleBin, 0x645FF040, 0x5081, 0x101B, 0x9F, 0x08, 0x00, 0xAA, 0x00, 0x2F, 0x95, 0x4E);
DEFINE_GUID(CLSID_ControlPanel, 0x21EC2020, 0x3AEA, 0x1069, 0xA2, 0xDD, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D);
DEFINE_GUID(CLSID_Printers, 0x2227A280, 0x3AEA, 0x1069, 0xA2, 0xDE, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D);
DEFINE_GUID(CLSID_MyDocuments, 0x450d8fba, 0xad25, 0x11d0, 0x98, 0xa8, 0x08, 0x00, 0x36, 0x1b, 0x11, 0x03);
#endif

View File

@ -0,0 +1,286 @@
/*
* internal pidl functions
*
* Copyright 1998 Juergen Schmied
* Copyright 2004 Juan Lang
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTES:
*
* DO NOT use this definitions outside the shell32.dll !
*
* The contents of a pidl should never used from a application
* directly.
*
* Undocumented:
* MS says: the abID of SHITEMID should be treated as binary data and not
* be interpreted by applications. Applies to everyone but MS itself.
* Word95 interprets the contents of abID (Filesize/Date) so we have to go
* for binary compatibility here.
*/
#ifndef __WINE_PIDL_H
#define __WINE_PIDL_H
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "shlobj.h"
/*
* the pidl does cache fileattributes to speed up SHGetAttributes when
* displaying a big number of files.
*
* a pidl of NULL means the desktop
*
* The structure of the pidl seems to be a union. The first byte of the
* PIDLDATA desribes the type of pidl.
*
* object ! first byte / ! format ! living space
* ! size
* ----------------------------------------------------------------
* my computer 0x1F/20 guid (2) (usual)
* network 0x1F guid
* bitbucket 0x1F guid
* drive 0x23/25 drive (usual)
* drive 0x25/25 drive (lnk/persistent)
* drive 0x29/25 drive
* shell extension 0x2E guid
* drive 0x2F drive (lnk/persistent)
* folder/file 0x30 folder/file (1) (lnk/persistent)
* folder 0x31 folder (usual)
* valueA 0x32 file (ANSI file name)
* valueW 0x34 file (Unicode file name)
* workgroup 0x41 network (3)
* computer 0x42 network (4)
* net provider 0x46 network
* whole network 0x47 network (5)
* MSITStore 0x61 htmlhlp (7)
* printers/ras connections 0x70 guid
* history/favorites 0xb1 file
* share 0xc3 network (6)
*
* guess: the persistent elements are non tracking
*
* (1) dummy byte is used, attributes are empty
* (2) IID_MyComputer = 20D04FE0L-3AEA-1069-A2D8-08002B30309D
* (3) two strings "workgroup" "Microsoft Network"
* (4) two strings "\\sirius" "Microsoft Network"
* (5) one string "Entire Network"
* (6) two strings "\\sirius\c" "Microsoft Network"
* (7) contains string "mk:@MSITStore:C:\path\file.chm::/path/filename.htm"
* GUID 871C5380-42A0-1069-A2EA-08002B30309D
*/
#define PT_CPLAPPLET 0x00
#define PT_GUID 0x1F
#define PT_DRIVE 0x23
#define PT_DRIVE2 0x25
#define PT_DRIVE3 0x29
#define PT_SHELLEXT 0x2E
#define PT_DRIVE1 0x2F
#define PT_FOLDER1 0x30
#define PT_FOLDER 0x31
#define PT_VALUE 0x32
#define PT_VALUEW 0x34
#define PT_WORKGRP 0x41
#define PT_COMP 0x42
#define PT_NETPROVIDER 0x46
#define PT_NETWORK 0x47
#define PT_IESPECIAL1 0x61
#define PT_YAGUID 0x70 /* yet another guid.. */
#define PT_IESPECIAL2 0xb1
#define PT_SHARE 0xc3
#include "pshpack1.h"
typedef BYTE PIDLTYPE;
typedef struct tagPIDLCPanelStruct
{
BYTE dummy; /*01 is 0x00 */
DWORD iconIdx; /*02 negative icon ID */
WORD offsDispName; /*06*/
WORD offsComment; /*08*/
CHAR szName[1]; /*10*/ /* terminated by 0x00, followed by display name and comment string */
} PIDLCPanelStruct;
typedef struct tagGUIDStruct
{
BYTE dummy; /* offset 01 is unknown */
GUID guid; /* offset 02 */
} GUIDStruct;
typedef struct tagDriveStruct
{
CHAR szDriveName[20]; /*01*/
WORD unknown; /*21*/
} DriveStruct;
typedef struct tagFileStruct
{
BYTE dummy; /*01 is 0x00 for files or dirs */
DWORD dwFileSize; /*02*/
WORD uFileDate; /*06*/
WORD uFileTime; /*08*/
WORD uFileAttribs; /*10*/
CHAR szNames[1]; /*12*/
/* Here are coming two strings. The first is the long name.
The second the dos name when needed or just 0x00 */
} FileStruct;
/* At least on WinXP, this struct is appended with 2-byte-alignment to FileStruct. There follows
* a WORD member after the wszName string, which gives the offset from the beginning of the PIDL
* to the FileStructW member. */
typedef struct tagFileStructW {
WORD cbLen;
BYTE dummy1[6];
WORD uCreationDate;
WORD uCreationTime;
WORD uLastAccessDate;
WORD uLastAccessTime;
BYTE dummy2[4];
WCHAR wszName[1];
} FileStructW;
typedef struct tagValueW
{
WCHAR name[1];
} ValueWStruct;
typedef struct tagPIDLDATA
{ PIDLTYPE type; /*00*/
union
{
struct tagGUIDStruct guid;
struct tagDriveStruct drive;
struct tagFileStruct file;
struct
{ WORD dummy; /*01*/
CHAR szNames[1]; /*03*/
} network;
struct
{ WORD dummy; /*01*/
DWORD dummy1; /*02*/
CHAR szName[1]; /*06*/ /* terminated by 0x00 0x00 */
} htmlhelp;
struct tagPIDLCPanelStruct cpanel;
struct tagValueW valueW;
}u;
} PIDLDATA, *LPPIDLDATA;
#include "poppack.h"
/*
* getting special values from simple pidls
*/
DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
DWORD _ILSimpleGetTextW (LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize);
BOOL _ILGetFileDate (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
DWORD _ILGetFileSize (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
BOOL _ILGetExtension (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
void _ILGetFileType (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
DWORD _ILGetFileAttributes (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
BOOL _ILGetFileDateTime (LPCITEMIDLIST pidl, FILETIME *ft);
DWORD _ILGetDrive (LPCITEMIDLIST, LPSTR, UINT);
/*
* testing simple pidls
*/
BOOL _ILIsDesktop (LPCITEMIDLIST pidl);
BOOL _ILIsMyComputer (LPCITEMIDLIST pidl);
BOOL _ILIsDrive (LPCITEMIDLIST pidl);
BOOL _ILIsFolder (LPCITEMIDLIST pidl);
BOOL _ILIsValue (LPCITEMIDLIST pidl);
BOOL _ILIsSpecialFolder (LPCITEMIDLIST pidl);
BOOL _ILIsPidlSimple (LPCITEMIDLIST pidl);
BOOL _ILIsCPanelStruct (LPCITEMIDLIST pidl);
/*
static inline
BOOL _ILIsEqualSimple (LPCITEMIDLIST pidlA, LPCITEMIDLIST pidlB)
{
return (pidlA->mkid.cb > 0 && !memcmp(pidlA, pidlB, pidlA->mkid.cb)) ||
(!pidlA->mkid.cb && !pidlB->mkid.cb);
}
static inline
BOOL _ILIsEmpty (LPCITEMIDLIST pidl) { return _ILIsDesktop(pidl); }
*/
/*
* simple pidls
*/
/* Basic PIDL constructor. Allocates size + 5 bytes, where:
* - two bytes are SHITEMID.cb
* - one byte is PIDLDATA.type
* - two bytes are the NULL PIDL terminator
* Sets type of the returned PIDL to type.
*/
LPITEMIDLIST _ILAlloc(PIDLTYPE type, unsigned int size);
/* Creates a PIDL with guid format and type type, which must be one of PT_GUID,
* PT_SHELLEXT, or PT_YAGUID.
*/
LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, const IID *guid);
/* Like _ILCreateGuid, but using the string szGUID. */
LPITEMIDLIST _ILCreateGuidFromStrA(LPCSTR szGUID);
LPITEMIDLIST _ILCreateGuidFromStrW(LPCWSTR szGUID);
/* Commonly used PIDLs representing file system objects. */
LPITEMIDLIST _ILCreateDesktop (void);
LPITEMIDLIST _ILCreateFromFindDataA(WIN32_FIND_DATAA *stffile);
LPITEMIDLIST _ILCreateFromFindDataW(WIN32_FIND_DATAW *stffile);
HRESULT _ILCreateFromPathA (LPCSTR szPath, LPITEMIDLIST* ppidl);
HRESULT _ILCreateFromPathW (LPCWSTR szPath, LPITEMIDLIST* ppidl);
/* Other helpers */
LPITEMIDLIST _ILCreateMyComputer (void);
LPITEMIDLIST _ILCreateMyDocuments (void);
LPITEMIDLIST _ILCreateIExplore (void);
LPITEMIDLIST _ILCreateControlPanel (void);
LPITEMIDLIST _ILCreatePrinters (void);
LPITEMIDLIST _ILCreateNetwork (void);
LPITEMIDLIST _ILCreateBitBucket (void);
LPITEMIDLIST _ILCreateDrive (LPCWSTR);
/*
* helper functions (getting struct-pointer)
*/
LPPIDLDATA _ILGetDataPointer (LPCITEMIDLIST);
LPSTR _ILGetTextPointer (LPCITEMIDLIST);
LPSTR _ILGetSTextPointer (LPCITEMIDLIST);
IID *_ILGetGUIDPointer (LPCITEMIDLIST pidl);
FileStructW *_ILGetFileStructW (LPCITEMIDLIST pidl);
/*
* debug helper
*/
void pdump (LPCITEMIDLIST pidl);
BOOL pcheck (LPCITEMIDLIST pidl);
/*
* aPidl helper
*/
void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl);
LPITEMIDLIST * _ILCopyaPidl(LPCITEMIDLIST * apidlsrc, UINT cidl);
LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, LPIDA cida);
BOOL WINAPI ILGetDisplayNameExA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPSTR path, DWORD type);
BOOL WINAPI ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type);
#endif

View File

@ -0,0 +1,35 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "unifwd.h"
FORWARD_TO_UNICOWS(DragQueryFileW);
FORWARD_TO_UNICOWS(ExtractIconExW);
FORWARD_TO_UNICOWS(ExtractIconW);
FORWARD_TO_UNICOWS(FindExecutableW);
FORWARD_TO_UNICOWS(SHBrowseForFolderW);
FORWARD_TO_UNICOWS(Shell_NotifyIconW);
FORWARD_TO_UNICOWS(ShellAboutW);
FORWARD_TO_UNICOWS(ShellExecuteExW);
FORWARD_TO_UNICOWS(ShellExecuteW);
FORWARD_TO_UNICOWS(SHFileOperationW);
FORWARD_TO_UNICOWS(SHGetFileInfoW);
FORWARD_TO_UNICOWS(SHGetNewLinkInfoW);

View File

@ -0,0 +1,8 @@
LIBRARY SHELL32.dll
EXPORTS
SHILCreateFromPathA@12 @28 NONAME
SHAlloc@4 @196 NONAME
SHFree@4 @195 NONAME
ILGetNext@4 @153 NONAME
ILCombine@8 @25 NONAME

53
apilibs/kexbasen/unifwd.c Normal file
View File

@ -0,0 +1,53 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "unifwd.h"
#include "kexcoresdk.h"
#include "common.h"
static HMODULE hUnicows;
int unifwd_init(void)
{
hUnicows = GetModuleHandle("UNICOWS.DLL");
if (!hUnicows)
hUnicows = LoadLibrary("UNICOWS.DLL");
return (hUnicows != NULL);
}
void unicows_fatal_error(const char* func)
{
char msg[256];
strcpy(msg, "kexbasen: Failed to get unicows proc addr: ");
strcat(msg, func);
fatal_error(msg);
}
unsigned long __stdcall GetUnicowsAddress(const char* name)
{
if (!hUnicows)
unifwd_init();
PROC addr = GetProcAddress(hUnicows, name);
if (!addr)
unicows_fatal_error(name);
return (unsigned long) addr;
}

88
apilibs/kexbasen/unifwd.h Normal file
View File

@ -0,0 +1,88 @@
/*
* KernelEx
* Copyright (C) 2008, 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.
*
*/
#ifndef __UNIFWD_H
#define __UNIFWD_H
#pragma warning(disable:4409)
int unifwd_init(void);
unsigned long __stdcall GetUnicowsAddress(const char* name);
/* Q: Why FORWARD_TO_UNICOWS macro is in asm?
* A: We don't know the parameters of called function
* so we can't call the function in C
*
* Note that the code below would be correct if all compilers translated
* the 'return' line to JMP instruction but it is not always the case
* and we can't rely on that so we workaround this writing the macro in asm.
*
* int __stdcall fun_fwd()
* {
* static const char* n = "fun";
* static unsigned long ref = 0;
* if (!ref)
* ref = GetUnicowsAddress("fun");
* return ((int (__stdcall *)())ref)();
* }
*/
#ifdef __GNUC__
/* How to make it less messy? */
#define FORWARD_TO_UNICOWS(name) \
__asm__( \
".section .rdata,\"dr\"\n" \
"LC_" #name ":\n\t" \
".ascii \"" #name "\\0\"\n\t" \
".text\n" \
".globl _" #name "_fwd@0\n\t" \
".def _" #name "fwd@0; .scl 2; .type 32; .endef\n" \
"_" #name "_fwd@0:\n\t" \
"cmpl $0, _ref_" #name "\n\t" \
"jnz LOC_" #name "\n\t" \
"pushl $LC_" #name "\n\t" \
"call _GetUnicowsAddress@4\n\t" \
"movl %eax, _ref_" #name "\n" \
"LOC_" #name ":\n\t" \
"movl _ref_" #name ", %eax\n\t" \
"jmp *%eax\n" \
".lcomm _ref_" #name ",4\n\t"
#else
#define FORWARD_TO_UNICOWS(name) \
int __declspec(naked) __stdcall name##_fwd(void) \
{ \
static const char n[] = #name; \
static unsigned long ref = 0; \
__asm { cmp dword ptr [ref], 0} \
__asm { jnz L1 } \
__asm { push offset n } \
__asm { call GetUnicowsAddress } \
__asm { mov dword ptr [ref], eax } \
__asm { L1: jmp [ref] } \
}
#endif /* #ifdef __GNUC__ */
#endif

View File

@ -0,0 +1,163 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
#include "kexcoresdk.h"
#include "_user32_apilist.h"
BOOL init_user32()
{
return TRUE;
}
static const apilib_named_api user32_named_apis[] =
{
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("AppendMenuW", AppendMenuW_fwd),
DECL_API("BroadcastSystemMessageW", BroadcastSystemMessageW_fwd),
DECL_API("CallMsgFilterW", CallMsgFilterW_fwd),
DECL_API("CallWindowProcW", CallWindowProcW_fwd),
DECL_API("ChangeDisplaySettingsExW", ChangeDisplaySettingsExW_fwd),
DECL_API("ChangeDisplaySettingsW", ChangeDisplaySettingsW_fwd),
DECL_API("ChangeMenuW", ChangeMenuW_fwd),
DECL_API("CharLowerBuffW", CharLowerBuffW_fwd),
DECL_API("CharLowerW", CharLowerW_fwd),
DECL_API("CharNextW", CharNextW_fwd),
DECL_API("CharPrevW", CharPrevW_fwd),
DECL_API("CharToOemBuffW", CharToOemBuffW_fwd),
DECL_API("CharToOemW", CharToOemW_fwd),
DECL_API("CharUpperBuffW", CharUpperBuffW_fwd),
DECL_API("CharUpperW", CharUpperW_fwd),
DECL_API("CopyAcceleratorTableW", CopyAcceleratorTableW_fwd),
DECL_API("CreateAcceleratorTableW", CreateAcceleratorTableW_fwd),
DECL_API("CreateDialogIndirectParamW", CreateDialogIndirectParamW_fwd),
DECL_API("CreateDialogParamW", CreateDialogParamW_new),
DECL_API("CreateMDIWindowW", CreateMDIWindowW_fwd),
DECL_API("CreateWindowExW", CreateWindowExW_fwd),
DECL_API("DdeCreateStringHandleW", DdeCreateStringHandleW_fwd),
DECL_API("DdeInitializeW", DdeInitializeW_fwd),
DECL_API("DdeQueryStringW", DdeQueryStringW_fwd),
DECL_API("DefDlgProcW", DefDlgProcW_fwd),
DECL_API("DefFrameProcW", DefFrameProcW_fwd),
DECL_API("DefMDIChildProcW", DefMDIChildProcW_fwd),
DECL_API("DefWindowProcW", DefWindowProcW_new),
DECL_API("DialogBoxIndirectParamW", DialogBoxIndirectParamW_fwd),
DECL_API("DialogBoxParamW", DialogBoxParamW_fwd),
DECL_API("DispatchMessageW", DispatchMessageW_fwd),
DECL_API("DlgDirListComboBoxW", DlgDirListComboBoxW_fwd),
DECL_API("DlgDirListW", DlgDirListW_fwd),
DECL_API("DlgDirSelectComboBoxExW", DlgDirSelectComboBoxExW_fwd),
DECL_API("DlgDirSelectExW", DlgDirSelectExW_fwd),
DECL_API("DrawStateW", DrawStateW_fwd),
DECL_API("DrawTextExW", DrawTextExW_fwd),
DECL_API("DrawTextW", DrawTextW_fwd),
DECL_API("EnumDisplayDevicesW", EnumDisplayDevicesW_fwd),
DECL_API("EnumDisplaySettingsExW", EnumDisplaySettingsExW_fwd),
DECL_API("EnumDisplaySettingsW", EnumDisplaySettingsW_fwd),
DECL_API("EnumPropsExW", EnumPropsExW_fwd),
DECL_API("EnumPropsW", EnumPropsW_fwd),
DECL_API("FindWindowExW", FindWindowExW_fwd),
DECL_API("FindWindowW", FindWindowW_fwd),
DECL_API("GetAltTabInfoW", GetAltTabInfoW_fwd),
DECL_API("GetClassInfoExW", GetClassInfoExW_fwd),
DECL_API("GetClassInfoW", GetClassInfoW_fwd),
DECL_API("GetClassLongW", GetClassLongW_fwd),
DECL_API("GetClassNameW", GetClassNameW_fwd),
DECL_API("GetClipboardFormatNameW", GetClipboardFormatNameW_fwd),
DECL_API("GetDlgItemTextW", GetDlgItemTextW_fwd),
DECL_API("GetKeyNameTextW", GetKeyNameTextW_fwd),
DECL_API("GetKeyboardLayoutNameW", GetKeyboardLayoutNameW_fwd),
DECL_API("GetMenuItemInfoW", GetMenuItemInfoW_fwd),
DECL_API("GetMenuStringW", GetMenuStringW_fwd),
DECL_API("GetMessageW", GetMessageW_fwd),
DECL_API("GetMonitorInfoW", GetMonitorInfoW_fwd),
DECL_API("GetPropW", GetPropW_fwd),
DECL_API("GetTabbedTextExtentW", GetTabbedTextExtentW_fwd),
DECL_API("GetWindowLongW", GetWindowLongW_fwd),
DECL_API("GetWindowTextLengthW", GetWindowTextLengthW_fwd),
DECL_API("GetWindowTextW", GetWindowTextW_fwd),
DECL_API("GrayStringW", GrayStringW_fwd),
DECL_API("InsertMenuItemW", InsertMenuItemW_fwd),
DECL_API("InsertMenuW", InsertMenuW_fwd),
DECL_API("IsCharAlphaNumericW", IsCharAlphaNumericW_fwd),
DECL_API("IsCharAlphaW", IsCharAlphaW_fwd),
DECL_API("IsCharLowerW", IsCharLowerW_fwd),
DECL_API("IsCharUpperW", IsCharUpperW_fwd),
DECL_API("IsDialogMessageW", IsDialogMessageW_fwd),
DECL_API("IsWindowUnicode", IsWindowUnicode_fwd),
DECL_API("LoadAcceleratorsW", LoadAcceleratorsW_fwd),
DECL_API("LoadBitmapW", LoadBitmapW_fwd),
DECL_API("LoadCursorFromFileW", LoadCursorFromFileW_fwd),
DECL_API("LoadCursorW", LoadCursorW_fwd),
DECL_API("LoadIconW", LoadIconW_fwd),
DECL_API("LoadImageW", LoadImageW_fwd),
DECL_API("LoadKeyboardLayoutW", LoadKeyboardLayoutW_fwd),
DECL_API("LoadMenuIndirectW", LoadMenuIndirectW_fwd),
DECL_API("LoadMenuW", LoadMenuW_fwd),
DECL_API("MapVirtualKeyExW", MapVirtualKeyExW_fwd),
DECL_API("MapVirtualKeyW", MapVirtualKeyW_fwd),
DECL_API("MessageBoxIndirectW", MessageBoxIndirectW_fwd),
DECL_API("ModifyMenuW", ModifyMenuW_fwd),
DECL_API("OemToCharBuffW", OemToCharBuffW_fwd),
DECL_API("OemToCharW", OemToCharW_fwd),
DECL_API("PeekMessageW", PeekMessageW_fwd),
DECL_API("PostMessageW", PostMessageW_fwd),
DECL_API("PostThreadMessageW", PostThreadMessageW_fwd),
DECL_API("RegisterClassExW", RegisterClassExW_fwd),
DECL_API("RegisterClassW", RegisterClassW_fwd),
DECL_API("RegisterClipboardFormatW", RegisterClipboardFormatW_fwd),
DECL_API("RegisterDeviceNotificationW", RegisterDeviceNotificationW_fwd),
DECL_API("RegisterWindowMessageW", RegisterWindowMessageW_fwd),
DECL_API("RemovePropW", RemovePropW_fwd),
DECL_API("SendDlgItemMessageW", SendDlgItemMessageW_fwd),
DECL_API("SendMessageCallbackW", SendMessageCallbackW_fwd),
DECL_API("SendMessageTimeoutW", SendMessageTimeoutW_fwd),
DECL_API("SendMessageW", SendMessageW_fwd),
DECL_API("SendNotifyMessageW", SendNotifyMessageW_fwd),
DECL_API("SetClassLongW", SetClassLongW_fwd),
DECL_API("SetDlgItemTextW", SetDlgItemTextW_fwd),
DECL_API("SetMenuItemInfoW", SetMenuItemInfoW_fwd),
DECL_API("SetPropW", SetPropW_fwd),
DECL_API("SetWindowLongW", SetWindowLongW_fwd),
DECL_API("SetWindowTextW", SetWindowTextW_fwd),
DECL_API("SetWindowsHookExW", SetWindowsHookExW_fwd),
DECL_API("SetWindowsHookW", SetWindowsHookW_fwd),
DECL_API("SystemParametersInfoW", SystemParametersInfoW_fwd),
DECL_API("TabbedTextOutW", TabbedTextOutW_fwd),
DECL_API("TranslateAcceleratorW", TranslateAcceleratorW_fwd),
DECL_API("UnregisterClassW", UnregisterClassW_fwd),
DECL_API("VkKeyScanExW", VkKeyScanExW_fwd),
DECL_API("VkKeyScanW", VkKeyScanW_fwd),
DECL_API("WinHelpW", WinHelpW_fwd),
DECL_API("wsprintfW", wsprintfW_fwd),
DECL_API("wvsprintfW", wvsprintfW_fwd),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};
#if 0
static const apilib_unnamed_api user32_ordinal_apis[] =
{
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
};
#endif
const apilib_api_table apitable_user32 = DECL_TAB("USER32.DLL", user32_named_apis, 0 /*user32_ordinal_apis*/);

View File

@ -0,0 +1,152 @@
/*
* KernelEx
* Copyright (C) 2008, 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.
*
*/
#ifndef _USER32_APILIST_H
#define _USER32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_user32();
extern const apilib_api_table apitable_user32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
FWDPROC AppendMenuW_fwd;
FWDPROC BroadcastSystemMessageW_fwd;
FWDPROC CallMsgFilterW_fwd;
FWDPROC CallWindowProcW_fwd;
FWDPROC ChangeDisplaySettingsExW_fwd;
FWDPROC ChangeDisplaySettingsW_fwd;
FWDPROC ChangeMenuW_fwd;
FWDPROC CharLowerBuffW_fwd;
FWDPROC CharLowerW_fwd;
FWDPROC CharNextW_fwd;
FWDPROC CharPrevW_fwd;
FWDPROC CharToOemBuffW_fwd;
FWDPROC CharToOemW_fwd;
FWDPROC CharUpperBuffW_fwd;
FWDPROC CharUpperW_fwd;
FWDPROC CopyAcceleratorTableW_fwd;
FWDPROC CreateAcceleratorTableW_fwd;
FWDPROC CreateDialogIndirectParamW_fwd;
FWDPROC CreateMDIWindowW_fwd;
FWDPROC CreateWindowExW_fwd;
FWDPROC DdeCreateStringHandleW_fwd;
FWDPROC DdeInitializeW_fwd;
FWDPROC DdeQueryStringW_fwd;
FWDPROC DefDlgProcW_fwd;
FWDPROC DefFrameProcW_fwd;
FWDPROC DefMDIChildProcW_fwd;
FWDPROC DialogBoxIndirectParamW_fwd;
FWDPROC DialogBoxParamW_fwd;
FWDPROC DispatchMessageW_fwd;
FWDPROC DlgDirListComboBoxW_fwd;
FWDPROC DlgDirListW_fwd;
FWDPROC DlgDirSelectComboBoxExW_fwd;
FWDPROC DlgDirSelectExW_fwd;
FWDPROC DrawStateW_fwd;
FWDPROC DrawTextExW_fwd;
FWDPROC DrawTextW_fwd;
FWDPROC EnumDisplayDevicesW_fwd;
FWDPROC EnumDisplaySettingsExW_fwd;
FWDPROC EnumDisplaySettingsW_fwd;
FWDPROC EnumPropsExW_fwd;
FWDPROC EnumPropsW_fwd;
FWDPROC FindWindowExW_fwd;
FWDPROC FindWindowW_fwd;
FWDPROC GetAltTabInfoW_fwd;
FWDPROC GetClassInfoExW_fwd;
FWDPROC GetClassInfoW_fwd;
FWDPROC GetClassLongW_fwd;
FWDPROC GetClassNameW_fwd;
FWDPROC GetClipboardFormatNameW_fwd;
FWDPROC GetDlgItemTextW_fwd;
FWDPROC GetKeyboardLayoutNameW_fwd;
FWDPROC GetKeyNameTextW_fwd;
FWDPROC GetMenuItemInfoW_fwd;
FWDPROC GetMenuStringW_fwd;
FWDPROC GetMessageW_fwd;
FWDPROC GetMonitorInfoW_fwd;
FWDPROC GetPropW_fwd;
FWDPROC GetTabbedTextExtentW_fwd;
FWDPROC GetWindowLongW_fwd;
FWDPROC GetWindowTextLengthW_fwd;
FWDPROC GetWindowTextW_fwd;
FWDPROC GrayStringW_fwd;
FWDPROC InsertMenuItemW_fwd;
FWDPROC InsertMenuW_fwd;
FWDPROC IsCharAlphaNumericW_fwd;
FWDPROC IsCharAlphaW_fwd;
FWDPROC IsCharLowerW_fwd;
FWDPROC IsCharUpperW_fwd;
FWDPROC IsDialogMessageW_fwd;
FWDPROC IsWindowUnicode_fwd;
FWDPROC LoadAcceleratorsW_fwd;
FWDPROC LoadBitmapW_fwd;
FWDPROC LoadCursorFromFileW_fwd;
FWDPROC LoadCursorW_fwd;
FWDPROC LoadIconW_fwd;
FWDPROC LoadImageW_fwd;
FWDPROC LoadKeyboardLayoutW_fwd;
FWDPROC LoadMenuIndirectW_fwd;
FWDPROC LoadMenuW_fwd;
FWDPROC MapVirtualKeyExW_fwd;
FWDPROC MapVirtualKeyW_fwd;
FWDPROC MessageBoxIndirectW_fwd;
FWDPROC ModifyMenuW_fwd;
FWDPROC OemToCharBuffW_fwd;
FWDPROC OemToCharW_fwd;
FWDPROC PeekMessageW_fwd;
FWDPROC PostMessageW_fwd;
FWDPROC PostThreadMessageW_fwd;
FWDPROC RegisterClassExW_fwd;
FWDPROC RegisterClassW_fwd;
FWDPROC RegisterClipboardFormatW_fwd;
FWDPROC RegisterDeviceNotificationW_fwd;
FWDPROC RegisterWindowMessageW_fwd;
FWDPROC RemovePropW_fwd;
FWDPROC SendDlgItemMessageW_fwd;
FWDPROC SendMessageCallbackW_fwd;
FWDPROC SendMessageTimeoutW_fwd;
FWDPROC SendMessageW_fwd;
FWDPROC SendNotifyMessageW_fwd;
FWDPROC SetClassLongW_fwd;
FWDPROC SetDlgItemTextW_fwd;
FWDPROC SetMenuItemInfoW_fwd;
FWDPROC SetPropW_fwd;
FWDPROC SetWindowLongW_fwd;
FWDPROC SetWindowsHookExW_fwd;
FWDPROC SetWindowsHookW_fwd;
FWDPROC SetWindowTextW_fwd;
FWDPROC SystemParametersInfoW_fwd;
FWDPROC TabbedTextOutW_fwd;
FWDPROC TranslateAcceleratorW_fwd;
FWDPROC UnregisterClassW_fwd;
FWDPROC VkKeyScanExW_fwd;
FWDPROC VkKeyScanW_fwd;
FWDPROC WinHelpW_fwd;
FWDPROC wsprintfW_fwd;
FWDPROC wvsprintfW_fwd;
HWND WINAPI CreateDialogParamW_new(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam);
LRESULT WINAPI DefWindowProcW_new(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

View File

@ -0,0 +1,170 @@
/*
* KernelEx
* Copyright (C) 2008, 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 <commctrl.h>
#include "unifwd.h"
FORWARD_TO_UNICOWS(AppendMenuW);
FORWARD_TO_UNICOWS(BroadcastSystemMessageW);
FORWARD_TO_UNICOWS(CallMsgFilterW);
FORWARD_TO_UNICOWS(CallWindowProcW);
FORWARD_TO_UNICOWS(ChangeDisplaySettingsExW);
FORWARD_TO_UNICOWS(ChangeDisplaySettingsW);
FORWARD_TO_UNICOWS(ChangeMenuW);
FORWARD_TO_UNICOWS(CharLowerBuffW);
FORWARD_TO_UNICOWS(CharLowerW);
FORWARD_TO_UNICOWS(CharNextW);
FORWARD_TO_UNICOWS(CharPrevW);
FORWARD_TO_UNICOWS(CharToOemBuffW);
FORWARD_TO_UNICOWS(CharToOemW);
FORWARD_TO_UNICOWS(CharUpperBuffW);
FORWARD_TO_UNICOWS(CharUpperW);
FORWARD_TO_UNICOWS(CopyAcceleratorTableW);
FORWARD_TO_UNICOWS(CreateAcceleratorTableW);
FORWARD_TO_UNICOWS(CreateDialogIndirectParamW);
static BOOL CALLBACK SetUnicode(HWND hwnd, LPARAM lParam)
{
return SendMessage(hwnd, CCM_SETUNICODEFORMAT, TRUE, 0);
}
/* MAKE_EXPORT CreateDialogParamW_new=CreateDialogParamW */
HWND WINAPI CreateDialogParamW_new(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
{
typedef HWND (WINAPI *CreateDialogParamW_t)(HINSTANCE, LPCSTR, HWND, DLGPROC, LPARAM);
static CreateDialogParamW_t g_DialogParamW;
HWND hDlg;
if (!g_DialogParamW) g_DialogParamW = (CreateDialogParamW_t) GetUnicowsAddress("CreateDialogParamW");
hDlg = g_DialogParamW(hInstance, lpTemplateName, hWndParent, lpDialogFunc, dwInitParam);
if (hDlg) EnumChildWindows(hDlg, SetUnicode, 0);
return hDlg;
}
FORWARD_TO_UNICOWS(CreateMDIWindowW);
FORWARD_TO_UNICOWS(CreateWindowExW);
FORWARD_TO_UNICOWS(DdeCreateStringHandleW);
FORWARD_TO_UNICOWS(DdeInitializeW);
FORWARD_TO_UNICOWS(DdeQueryStringW);
FORWARD_TO_UNICOWS(DefDlgProcW);
FORWARD_TO_UNICOWS(DefFrameProcW);
FORWARD_TO_UNICOWS(DefMDIChildProcW);
/* MAKE_EXPORT DefWindowProcW_new=DefWindowProcW */
LRESULT WINAPI DefWindowProcW_new(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
typedef LRESULT (WINAPI *DefWindowProcW_t)(HWND, UINT, WPARAM, LPARAM);
static DefWindowProcW_t g_DefProcW;
if (!g_DefProcW) g_DefProcW = (DefWindowProcW_t) GetUnicowsAddress("DefWindowProcW");
if (Msg == WM_NOTIFYFORMAT && lParam == NF_QUERY && IsWindowUnicode(hWnd)) return NFR_UNICODE;
return g_DefProcW(hWnd, Msg, wParam, lParam);
}
FORWARD_TO_UNICOWS(DialogBoxIndirectParamW);
FORWARD_TO_UNICOWS(DialogBoxParamW);
FORWARD_TO_UNICOWS(DispatchMessageW);
FORWARD_TO_UNICOWS(DlgDirListComboBoxW);
FORWARD_TO_UNICOWS(DlgDirListW);
FORWARD_TO_UNICOWS(DlgDirSelectComboBoxExW);
FORWARD_TO_UNICOWS(DlgDirSelectExW);
FORWARD_TO_UNICOWS(DrawStateW);
FORWARD_TO_UNICOWS(DrawTextExW);
FORWARD_TO_UNICOWS(DrawTextW);
FORWARD_TO_UNICOWS(EnumDisplayDevicesW);
FORWARD_TO_UNICOWS(EnumDisplaySettingsExW);
FORWARD_TO_UNICOWS(EnumDisplaySettingsW);
FORWARD_TO_UNICOWS(EnumPropsExW);
FORWARD_TO_UNICOWS(EnumPropsW);
FORWARD_TO_UNICOWS(FindWindowExW);
FORWARD_TO_UNICOWS(FindWindowW);
FORWARD_TO_UNICOWS(GetAltTabInfoW);
FORWARD_TO_UNICOWS(GetClassInfoExW);
FORWARD_TO_UNICOWS(GetClassInfoW);
FORWARD_TO_UNICOWS(GetClassLongW);
FORWARD_TO_UNICOWS(GetClassNameW);
FORWARD_TO_UNICOWS(GetClipboardFormatNameW);
FORWARD_TO_UNICOWS(GetDlgItemTextW);
FORWARD_TO_UNICOWS(GetKeyboardLayoutNameW);
FORWARD_TO_UNICOWS(GetKeyNameTextW);
FORWARD_TO_UNICOWS(GetMenuItemInfoW);
FORWARD_TO_UNICOWS(GetMenuStringW);
FORWARD_TO_UNICOWS(GetMessageW);
FORWARD_TO_UNICOWS(GetMonitorInfoW);
FORWARD_TO_UNICOWS(GetPropW);
FORWARD_TO_UNICOWS(GetTabbedTextExtentW);
FORWARD_TO_UNICOWS(GetWindowLongW);
FORWARD_TO_UNICOWS(GetWindowTextLengthW);
FORWARD_TO_UNICOWS(GetWindowTextW);
FORWARD_TO_UNICOWS(GrayStringW);
FORWARD_TO_UNICOWS(InsertMenuItemW);
FORWARD_TO_UNICOWS(InsertMenuW);
FORWARD_TO_UNICOWS(IsCharAlphaNumericW);
FORWARD_TO_UNICOWS(IsCharAlphaW);
FORWARD_TO_UNICOWS(IsCharLowerW);
FORWARD_TO_UNICOWS(IsCharUpperW);
FORWARD_TO_UNICOWS(IsDialogMessageW);
FORWARD_TO_UNICOWS(IsWindowUnicode);
FORWARD_TO_UNICOWS(LoadAcceleratorsW);
FORWARD_TO_UNICOWS(LoadBitmapW);
FORWARD_TO_UNICOWS(LoadCursorFromFileW);
FORWARD_TO_UNICOWS(LoadCursorW);
FORWARD_TO_UNICOWS(LoadIconW);
FORWARD_TO_UNICOWS(LoadImageW);
FORWARD_TO_UNICOWS(LoadKeyboardLayoutW);
FORWARD_TO_UNICOWS(LoadMenuIndirectW);
FORWARD_TO_UNICOWS(LoadMenuW);
FORWARD_TO_UNICOWS(MapVirtualKeyExW);
FORWARD_TO_UNICOWS(MapVirtualKeyW);
FORWARD_TO_UNICOWS(MessageBoxIndirectW);
FORWARD_TO_UNICOWS(ModifyMenuW);
FORWARD_TO_UNICOWS(OemToCharBuffW);
FORWARD_TO_UNICOWS(OemToCharW);
FORWARD_TO_UNICOWS(PeekMessageW);
FORWARD_TO_UNICOWS(PostMessageW);
FORWARD_TO_UNICOWS(PostThreadMessageW);
FORWARD_TO_UNICOWS(RegisterClassExW);
FORWARD_TO_UNICOWS(RegisterClassW);
FORWARD_TO_UNICOWS(RegisterClipboardFormatW);
FORWARD_TO_UNICOWS(RegisterDeviceNotificationW);
FORWARD_TO_UNICOWS(RegisterWindowMessageW);
FORWARD_TO_UNICOWS(RemovePropW);
FORWARD_TO_UNICOWS(SendDlgItemMessageW);
FORWARD_TO_UNICOWS(SendMessageCallbackW);
FORWARD_TO_UNICOWS(SendMessageTimeoutW);
FORWARD_TO_UNICOWS(SendMessageW);
FORWARD_TO_UNICOWS(SendNotifyMessageW);
FORWARD_TO_UNICOWS(SetClassLongW);
FORWARD_TO_UNICOWS(SetDlgItemTextW);
FORWARD_TO_UNICOWS(SetMenuItemInfoW);
FORWARD_TO_UNICOWS(SetPropW);
FORWARD_TO_UNICOWS(SetWindowLongW);
FORWARD_TO_UNICOWS(SetWindowsHookExW);
FORWARD_TO_UNICOWS(SetWindowsHookW);
FORWARD_TO_UNICOWS(SetWindowTextW);
FORWARD_TO_UNICOWS(SystemParametersInfoW);
FORWARD_TO_UNICOWS(TabbedTextOutW);
FORWARD_TO_UNICOWS(TranslateAcceleratorW);
FORWARD_TO_UNICOWS(UnregisterClassW);
FORWARD_TO_UNICOWS(VkKeyScanExW);
FORWARD_TO_UNICOWS(VkKeyScanW);
FORWARD_TO_UNICOWS(WinHelpW);
FORWARD_TO_UNICOWS(wsprintfW);
FORWARD_TO_UNICOWS(wvsprintfW);

View File

@ -0,0 +1,28 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
/* MAKE_EXPORT RegDisablePredefinedCache_new=RegDisablePredefinedCache */
BOOL WINAPI RegDisablePredefinedCache_new()
{
return ERROR_SUCCESS;
}

View File

@ -0,0 +1,28 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
/* MAKE_EXPORT RegOpenCurrentUser_new=RegOpenCurrentUser */
LONG WINAPI RegOpenCurrentUser_new(REGSAM access, PHKEY retkey)
{
return RegOpenKeyExA(HKEY_CURRENT_USER, NULL, 0, access, retkey);
}

View File

@ -0,0 +1,34 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
/* MAKE_EXPORT TraceMessage_new=TraceMessage */
ULONG CDECL TraceMessage_new(
ULONG64 LoggerHandle,
ULONG MessageFlags,
LPGUID MessageGuid,
USHORT MessageNumber,
...
)
{
return ERROR_SUCCESS;
}

View File

@ -0,0 +1,120 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
#include "kexcoresdk.h"
#include "_advapi32_apilist.h"
BOOL init_advapi32()
{
return TRUE;
}
static const apilib_named_api advapi32_named_apis[] =
{
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("AccessCheck", AccessCheck_new),
DECL_API("AddAccessAllowedAce", AddAccessAllowedAce_new),
DECL_API("AdjustTokenPrivileges", AdjustTokenPrivileges_new),
DECL_API("AllocateAndInitializeSid", AllocateAndInitializeSid_new),
DECL_API("CheckTokenMembership", CheckTokenMembership_new),
DECL_API("ConvertSecurityDescriptorToStringSecurityDescriptorA", ConvertSecurityDescriptorToStringSecurityDescriptorA_stub),
DECL_API("ConvertSecurityDescriptorToStringSecurityDescriptorW", ConvertSecurityDescriptorToStringSecurityDescriptorW_stub),
DECL_API("ConvertSidToStringSidA", ConvertSidToStringSidA_stub),
DECL_API("ConvertSidToStringSidW", ConvertSidToStringSidW_stub),
DECL_API("ConvertStringSecurityDescriptorToSecurityDescriptorA", ConvertStringSecurityDescriptorToSecurityDescriptorA_stub),
DECL_API("ConvertStringSecurityDescriptorToSecurityDescriptorW", ConvertStringSecurityDescriptorToSecurityDescriptorW_stub),
DECL_API("ConvertStringSidToSidA", ConvertStringSidToSidA_stub),
DECL_API("ConvertStringSidToSidW", ConvertStringSidToSidW_stub),
DECL_API("CopySid", CopySid_new),
DECL_API("CreateRestrictedToken", CreateRestrictedToken_new),
DECL_API("CreateWellKnownSid", CreateWellKnownSid_new),
DECL_API("CryptAcquireContextW", CryptAcquireContextW_stub),
DECL_API("CryptEnumProviderTypesW", CryptEnumProviderTypesW_stub),
DECL_API("CryptEnumProvidersW", CryptEnumProvidersW_stub),
DECL_API("CryptGetDefaultProviderW", CryptGetDefaultProviderW_stub),
DECL_API("CryptSetProviderExW", CryptSetProviderExW_stub),
DECL_API("CryptSetProviderW", CryptSetProviderW_stub),
DECL_API("CryptSignHashW", CryptSignHashW_stub),
DECL_API("CryptVerifySignatureW", CryptVerifySignatureW_stub),
DECL_API("DuplicateToken", DuplicateToken_new),
DECL_API("DuplicateTokenEx", DuplicateTokenEx_new),
DECL_API("EqualPrefixSid", EqualPrefixSid_new),
DECL_API("EqualSid", EqualSid_new),
DECL_API("FreeSid", FreeSid_new),
DECL_API("GetAce", GetAce_new),
DECL_API("GetFileSecurityA", GetFileSecurityA_new),
DECL_API("GetFileSecurityW", GetFileSecurityW_new),
DECL_API("GetLengthSid", GetLengthSid_new),
DECL_API("GetSecurityDescriptorControl", GetSecurityDescriptorControl_new),
DECL_API("GetSecurityDescriptorDacl", GetSecurityDescriptorDacl_new),
DECL_API("GetSecurityDescriptorGroup", GetSecurityDescriptorGroup_new),
DECL_API("GetSecurityDescriptorLength", GetSecurityDescriptorLength_new),
DECL_API("GetSecurityDescriptorOwner", GetSecurityDescriptorOwner_new),
DECL_API("GetSecurityDescriptorSacl", GetSecurityDescriptorSacl_new),
DECL_API("GetSidIdentifierAuthority", GetSidIdentifierAuthority_new),
DECL_API("GetSidLengthRequired", GetSidLengthRequired_new),
DECL_API("GetSidSubAuthority", GetSidSubAuthority_new),
DECL_API("GetSidSubAuthorityCount", GetSidSubAuthorityCount_new),
DECL_API("GetTokenInformation", GetTokenInformation_new),
DECL_API("ImpersonateSelf", ImpersonateSelf_new),
DECL_API("InitializeAcl", InitializeAcl_new),
DECL_API("InitializeSecurityDescriptor", InitializeSecurityDescriptor_new),
DECL_API("InitializeSid", InitializeSid_new),
DECL_API("IsValidSecurityDescriptor", IsValidSecurityDescriptor_new),
DECL_API("IsValidSid", IsValidSid_new),
DECL_API("IsWellKnownSid", IsWellKnownSid_stub),
DECL_API("LookupAccountSidA", LookupAccountSidA_new),
DECL_API("LookupAccountSidW", LookupAccountSidW_new),
DECL_API("LookupPrivilegeValueA", LookupPrivilegeValueA_new),
DECL_API("LookupPrivilegeValueW", LookupPrivilegeValueW_new),
DECL_API("MakeSelfRelativeSD", MakeSelfRelativeSD_new),
DECL_API("NotifyBootConfigStatus", NotifyBootConfigStatus_new),
DECL_API("OpenProcessToken", OpenProcessToken_new),
DECL_API("OpenThreadToken", OpenThreadToken_new),
DECL_API("PrivilegeCheck", PrivilegeCheck_new),
DECL_API("QueryServiceStatusEx", QueryServiceStatusEx_stub),
DECL_API("RegDisablePredefinedCache", RegDisablePredefinedCache_new),
DECL_API("RegOpenCurrentUser", RegOpenCurrentUser_new),
DECL_API("RegOverridePredefKey", RegOverridePredefKey_stub),
DECL_API("RegQueryValueExW", RegQueryValueExW_new),
DECL_API("RevertToSelf", RevertToSelf_new),
DECL_API("SetFileSecurityA", SetFileSecurityA_new),
DECL_API("SetFileSecurityW", SetFileSecurityW_new),
DECL_API("SetKernelObjectSecurity", SetKernelObjectSecurity_new),
DECL_API("SetSecurityDescriptorDacl", SetSecurityDescriptorDacl_new),
DECL_API("SetSecurityDescriptorGroup", SetSecurityDescriptorGroup_new),
DECL_API("SetSecurityDescriptorOwner", SetSecurityDescriptorOwner_new),
DECL_API("SetSecurityDescriptorSacl", SetSecurityDescriptorSacl_new),
DECL_API("SetThreadToken", SetThreadToken_new),
DECL_API("TraceMessage", TraceMessage_new),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};
#if 0
static const apilib_unnamed_api advapi32_ordinal_apis[] =
{
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
};
#endif
const apilib_api_table apitable_advapi32 = DECL_TAB("ADVAPI32.DLL", advapi32_named_apis, 0 /*advapi32_ordinal_apis*/);

View File

@ -0,0 +1,109 @@
/*
* KernelEx
* Copyright (C) 2008, 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.
*
*/
#ifndef _ADVAPI32_APILIST_H
#define _ADVAPI32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_advapi32();
extern const apilib_api_table apitable_advapi32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
BOOL WINAPI RegDisablePredefinedCache_new();
LONG WINAPI RegOpenCurrentUser_new(REGSAM access, PHKEY retkey);
ULONG CDECL TraceMessage_new(ULONG64 LoggerHandle, ULONG MessageFlags, LPGUID MessageGuid, USHORT MessageNumber, ...);
STUB CryptAcquireContextW_stub;
STUB CryptEnumProvidersW_stub;
STUB CryptEnumProviderTypesW_stub;
STUB CryptGetDefaultProviderW_stub;
STUB CryptSetProviderExW_stub;
STUB CryptSetProviderW_stub;
STUB CryptSignHashW_stub;
STUB CryptVerifySignatureW_stub;
STUB ConvertSidToStringSidA_stub;
STUB ConvertStringSidToSidA_stub;
STUB ConvertSidToStringSidW_stub;
STUB ConvertStringSidToSidW_stub;
STUB RegOverridePredefKey_stub;
STUB IsWellKnownSid_stub;
STUB ConvertStringSecurityDescriptorToSecurityDescriptorA_stub;
STUB ConvertStringSecurityDescriptorToSecurityDescriptorW_stub;
STUB ConvertSecurityDescriptorToStringSecurityDescriptorA_stub;
STUB ConvertSecurityDescriptorToStringSecurityDescriptorW_stub;
STUB QueryServiceStatusEx_stub;
BOOL WINAPI OpenProcessToken_new(HANDLE ProcessHandle, DWORD DesiredAccess, HANDLE *TokenHandle);
BOOL WINAPI OpenThreadToken_new(HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, HANDLE *TokenHandle);
BOOL WINAPI DuplicateTokenEx_new(HANDLE ExistingTokenHandle, DWORD dwDesiredAccess, LPSECURITY_ATTRIBUTES lpTokenAttributes, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, TOKEN_TYPE TokenType, PHANDLE DuplicateTokenHandle);
BOOL WINAPI DuplicateToken_new(HANDLE ExistingTokenHandle, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, PHANDLE DuplicateTokenHandle);
BOOL WINAPI AdjustTokenPrivileges_new(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, LPDWORD ReturnLength);
BOOL WINAPI CheckTokenMembership_new(HANDLE TokenHandle, PSID SidToCheck, PBOOL IsMember);
BOOL WINAPI GetTokenInformation_new(HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass, LPVOID tokeninfo, DWORD tokeninfolength, LPDWORD retlen);
BOOL WINAPI SetThreadToken_new(PHANDLE thread, HANDLE token);
BOOL WINAPI AllocateAndInitializeSid_new(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid);
PVOID WINAPI FreeSid_new(PSID pSid);
BOOL WINAPI CopySid_new(DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid);
BOOL WINAPI IsValidSid_new(PSID pSid);
BOOL WINAPI EqualSid_new(PSID pSid1, PSID pSid2);
BOOL WINAPI EqualPrefixSid_new (PSID pSid1, PSID pSid2);
DWORD WINAPI GetSidLengthRequired_new(BYTE nSubAuthorityCount);
BOOL WINAPI InitializeSid_new (PSID pSid, PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount);
PSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority_new(PSID pSid);
PDWORD WINAPI GetSidSubAuthority_new(PSID pSid, DWORD nSubAuthority);
PUCHAR WINAPI GetSidSubAuthorityCount_new (PSID pSid);
DWORD WINAPI GetLengthSid_new (PSID pSid);
BOOL WINAPI InitializeSecurityDescriptor_new(SECURITY_DESCRIPTOR *pDescr, DWORD revision);
DWORD WINAPI GetSecurityDescriptorLength_new(SECURITY_DESCRIPTOR *pDescr);
BOOL WINAPI GetSecurityDescriptorOwner_new(SECURITY_DESCRIPTOR *pDescr, PSID *Owner, LPBOOL OwnerDefaulted);
BOOL WINAPI SetSecurityDescriptorOwner_new(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID owner, BOOL ownerdefaulted);
BOOL WINAPI GetSecurityDescriptorGroup_new(PSECURITY_DESCRIPTOR SecurityDescriptor, PSID *Group, LPBOOL GroupDefaulted);
BOOL WINAPI SetSecurityDescriptorGroup_new (PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID group, BOOL groupdefaulted);
BOOL WINAPI IsValidSecurityDescriptor_new(PSECURITY_DESCRIPTOR pSecurityDescriptor);
BOOL WINAPI GetSecurityDescriptorDacl_new(IN PSECURITY_DESCRIPTOR pSecurityDescriptor, OUT LPBOOL lpbDaclPresent, OUT PACL *pDacl, OUT LPBOOL lpbDaclDefaulted);
BOOL WINAPI SetSecurityDescriptorDacl_new (PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL daclpresent, PACL dacl, BOOL dacldefaulted);
BOOL WINAPI GetSecurityDescriptorSacl_new(IN PSECURITY_DESCRIPTOR pSecurityDescriptor, OUT LPBOOL lpbSaclPresent, OUT PACL *pSacl, OUT LPBOOL lpbSaclDefaulted);
BOOL WINAPI SetSecurityDescriptorSacl_new (PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL saclpresent, PACL sacl, BOOL sacldefaulted);
BOOL WINAPI MakeSelfRelativeSD_new(IN PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, IN OUT LPDWORD lpdwBufferLength);
BOOL WINAPI GetSecurityDescriptorControl_new (PSECURITY_DESCRIPTOR pSecurityDescriptor, PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision);
BOOL WINAPI InitializeAcl_new(PACL acl, DWORD size, DWORD rev);
BOOL WINAPI LookupPrivilegeValueW_new(LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid);
BOOL WINAPI LookupPrivilegeValueA_new(LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid);
BOOL WINAPI GetFileSecurityW_new(LPCWSTR lpFileName, SECURITY_INFORMATION RequestedInformation, SECURITY_DESCRIPTOR* pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded);
BOOL WINAPI GetFileSecurityA_new(LPCSTR lpFileName, SECURITY_INFORMATION RequestedInformation, SECURITY_DESCRIPTOR* pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded);
BOOL WINAPI LookupAccountSidA_new(IN LPCSTR system, IN PSID sid, OUT LPSTR account, IN OUT LPDWORD accountSize, OUT LPSTR domain, IN OUT LPDWORD domainSize, OUT PSID_NAME_USE name_use);
BOOL WINAPI LookupAccountSidW_new(IN LPCWSTR system, IN PSID sid, OUT LPWSTR account, IN OUT LPDWORD accountSize, OUT LPWSTR domain, IN OUT LPDWORD domainSize, OUT PSID_NAME_USE name_use);
BOOL WINAPI SetFileSecurityA_new(LPCSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor);
BOOL WINAPI SetFileSecurityW_new(LPCWSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor);
BOOL WINAPI NotifyBootConfigStatus_new(BOOL x1);
BOOL WINAPI RevertToSelf_new(void);
BOOL WINAPI ImpersonateSelf_new(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel);
BOOL WINAPI AccessCheck_new(PSECURITY_DESCRIPTOR SecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus);
BOOL WINAPI SetKernelObjectSecurity_new (IN HANDLE Handle, IN SECURITY_INFORMATION SecurityInformation, IN PSECURITY_DESCRIPTOR SecurityDescriptor);
BOOL WINAPI PrivilegeCheck_new(HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult);
BOOL WINAPI AddAccessAllowedAce_new(IN OUT PACL pAcl, IN DWORD dwAceRevision, IN DWORD AccessMask, IN PSID pSid);
BOOL WINAPI GetAce_new(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce);
BOOL WINAPI CreateRestrictedToken_new(HANDLE baseToken, DWORD flags, DWORD nDisableSids, PSID_AND_ATTRIBUTES disableSids, DWORD nDeletePrivs, PLUID_AND_ATTRIBUTES deletePrivs, DWORD nRestrictSids, PSID_AND_ATTRIBUTES restrictSids, PHANDLE newToken);
BOOL WINAPI CreateWellKnownSid_new(DWORD WellKnownSidType, PSID DomainSid, PSID pSid, DWORD* cbSid);
LONG WINAPI RegQueryValueExW_new(HKEY hKey, LPCWSTR lpValueNameW, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData);
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

View File

@ -0,0 +1,46 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
UNIMPL_FUNC(CryptAcquireContextW, 5); //all MSLU does is to load this function from advapi32 so it loops...
UNIMPL_FUNC(CryptEnumProvidersW, 6); //so it loops...
UNIMPL_FUNC(CryptEnumProviderTypesW, 6); //so it loops...
UNIMPL_FUNC(CryptGetDefaultProviderW, 5); //so it loops...
UNIMPL_FUNC(CryptSetProviderExW, 4); //...
UNIMPL_FUNC(CryptSetProviderW, 2); //...
UNIMPL_FUNC(CryptSignHashW, 6); //...
UNIMPL_FUNC(CryptVerifySignatureW, 6); //...
UNIMPL_FUNC(ConvertSidToStringSidA, 2);
UNIMPL_FUNC(ConvertStringSidToSidA, 2);
UNIMPL_FUNC(ConvertSidToStringSidW, 2);
UNIMPL_FUNC(ConvertStringSidToSidW, 2);
UNIMPL_FUNC(RegOverridePredefKey, 2);
UNIMPL_FUNC(IsWellKnownSid, 2);
UNIMPL_FUNC(ConvertStringSecurityDescriptorToSecurityDescriptorA, 4);
UNIMPL_FUNC(ConvertStringSecurityDescriptorToSecurityDescriptorW, 4);
UNIMPL_FUNC(ConvertSecurityDescriptorToStringSecurityDescriptorA, 5);
UNIMPL_FUNC(ConvertSecurityDescriptorToStringSecurityDescriptorW, 5);
UNIMPL_FUNC(QueryServiceStatusEx, 5);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,113 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
//MAKE_EXPORT RegQueryValueExW_new=RegQueryValueExW
LONG WINAPI RegQueryValueExW_new(HKEY hKey, LPCWSTR lpValueNameW, LPDWORD lpReserved,
LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
{
LONG ret;
DWORD type;
BYTE stackbuf[256];
BYTE* ptr = stackbuf;
BYTE* heapbuf = NULL;
DWORD bufsize = sizeof(stackbuf);
if ((lpData && !lpcbData) || lpReserved) return ERROR_INVALID_PARAMETER;
if (!lpData && lpcbData) *lpcbData = 0;
//try with stack buffer first
if (lpValueNameW)
{
ALLOC_WtoA(lpValueName);
ret = RegQueryValueExA(hKey, lpValueNameA, lpReserved, &type, ptr, &bufsize);
if (lpType) *lpType = type;
if (lpcbData && type != REG_SZ && bufsize > *lpcbData)
{
*lpcbData = bufsize;
return ERROR_MORE_DATA;
}
//retry with dynamic buffer
if (ret == ERROR_MORE_DATA)
{
ptr = heapbuf = (BYTE*) HeapAlloc(GetProcessHeap(), 0, bufsize);
if (!heapbuf)
{
return ERROR_NOT_ENOUGH_MEMORY;
}
ret = RegQueryValueExA(hKey, lpValueNameA, lpReserved, &type, ptr, &bufsize);
}
}
else
{
ret = RegQueryValueExA(hKey, 0, lpReserved, &type, ptr, &bufsize);
if (lpType) *lpType = type;
if (lpcbData && type != REG_SZ && bufsize > *lpcbData)
{
*lpcbData = bufsize;
return ERROR_MORE_DATA;
}
//retry with dynamic buffer
if (ret == ERROR_MORE_DATA)
{
ptr = heapbuf = (BYTE*) HeapAlloc(GetProcessHeap(), 0, bufsize);
if (!heapbuf)
{
return ERROR_NOT_ENOUGH_MEMORY;
}
ret = RegQueryValueExA(hKey, 0, lpReserved, &type, ptr, &bufsize);
}
}
if (ret != ERROR_SUCCESS) goto _end;
if (type == REG_SZ)
{
if (lpcbData)
{
DWORD gle = GetLastError();
int written = MultiByteToWideChar(CP_ACP, 0, (LPSTR) ptr, -1,
(LPWSTR)lpData, lpData ? (*lpcbData >> 1) : 0);
if (!written)
{
ret = GetLastError();
if (ret == ERROR_INSUFFICIENT_BUFFER)
{
*lpcbData = MultiByteToWideChar(CP_ACP, 0, (LPSTR) ptr,
-1, NULL, 0) << 1;
ret = ERROR_MORE_DATA;
}
SetLastError(gle);
goto _end;
}
*lpcbData = written << 1;
}
}
else
{
if (lpData) memcpy(lpData, ptr, bufsize);
if (lpcbData) *lpcbData = bufsize;
}
_end:
if (heapbuf) HeapFree(GetProcessHeap(), 0, heapbuf);
return ret;
}

View File

@ -0,0 +1,34 @@
/*
* KernelEx
*
* Copyright (C) 2009, 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>
/* MAKE_EXPORT AddFontResourceExA_new=AddFontResourceExA */
INT WINAPI AddFontResourceExA_new(LPCSTR str, DWORD fl, PVOID pdv)
{
return AddFontResourceA(str);
}
/* MAKE_EXPORT RemoveFontResourceExA_new=RemoveFontResourceExA */
BOOL WINAPI RemoveFontResourceExA_new(LPCSTR str, DWORD fl, PVOID pdv)
{
return RemoveFontResourceA(str);
}

View File

@ -0,0 +1,39 @@
/*
* KernelEx
*
* Copyright (C) 2008, 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>
/* 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
)
{
//last parameter must point to writeable memory
MAT2 matr;
memcpy( &matr, lpmat2, sizeof(MAT2) );
return GetGlyphOutlineA( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, &matr );
}

View File

@ -0,0 +1,230 @@
/*
* KernelEx
*
* Copyright 1993 Alexandre Julliard
* 1997 Alex Korobka
* Copyright 2002,2003 Shachar Shemesh
* Copyright 2003 CodeWeavers Inc. (Ulrich Czekalla)
*
* Copyright (C) 2008, 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 "auxdecl.h"
#ifndef ETO_PDY
#define ETO_PDY 0x2000
#endif
static void WINAPI MakeDxFromDxDy(const int* lpDx, int* newlpDx, UINT cbCount)
{
UINT oneDx;
for (oneDx = 0; oneDx < cbCount; oneDx++)
{
*newlpDx = *lpDx;
newlpDx++;
lpDx++;
lpDx++;
}
newlpDx--;
if (*newlpDx == 0) *newlpDx = 16; //TERRIBLE HACK but needed on some fonts/glyphs/etc!
}
/* 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
)
{
BOOL result;
int* buffer = 0;
if ((UINT)lpString>0xFFFFu)
{
if (cbCount>8192) cbCount = 8192;
if (fuOptions & ETO_PDY) //win9x can't understand it and messes up other flags
{
fuOptions = fuOptions & ~ETO_PDY;
if (lpDx) //we have to make array which contains dx values only
{
buffer = (int*)HeapAlloc(GetProcessHeap(),0,cbCount*sizeof(int));
if (!buffer) //you've managed to ruin everything
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
MakeDxFromDxDy(lpDx,buffer, cbCount);
lpDx = buffer;
}
}
}
result = ExtTextOutA(hdc,X,Y,fuOptions,lprc,lpString,cbCount,lpDx);
if (buffer) HeapFree (GetProcessHeap(),0,buffer);
return result;
}
/* 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
)
{
BOOL result;
BOOL optimized = FALSE;
int* buffer = 0;
char english[128];
if ((UINT)lpString>0xFFFFu)
{
if (cbCount>8192) cbCount = 8192;
if (fuOptions & ETO_PDY)
{
fuOptions = fuOptions & ~ETO_PDY;
if (lpDx)
{
buffer = (int*)HeapAlloc(GetProcessHeap(),0,cbCount*sizeof(int));
if (!buffer)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
MakeDxFromDxDy(lpDx,buffer,cbCount);
lpDx = buffer;
}
}
//now, common case optimization (English short string)
if (!(fuOptions & ETO_GLYPH_INDEX || cbCount>128 || *lpString>0x7Fu))
{
UINT i;
LPCWSTR uString = lpString;
for (i = 0; i< cbCount; i++)
{
if (*uString>0x7Fu) break; else english[i]=(char)*uString;
uString++;
}
optimized = (i == cbCount);
}
else
optimized = FALSE;
}
if (optimized)
result = ExtTextOutA(hdc,X,Y,fuOptions,lprc,english,cbCount,lpDx);
else
result = ExtTextOutW(hdc,X,Y,fuOptions,lprc,lpString,cbCount,lpDx);
if (buffer) HeapFree (GetProcessHeap(),0,buffer);
return result;
}
/* MAKE_EXPORT PolyTextOutA_new=PolyTextOutA */
BOOL WINAPI PolyTextOutA_new( HDC hdc, const POLYTEXTA *pptxt, INT cStrings )
{
if (!hdc || !cStrings || !pptxt)
{
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;
}
/* MAKE_EXPORT PolyTextOutW_new=PolyTextOutW */
BOOL WINAPI PolyTextOutW_new( HDC hdc, const POLYTEXTW *pptxt, INT cStrings )
{
if (!hdc || !cStrings || !pptxt)
{
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;
}
/* MAKE_EXPORT GetFontUnicodeRanges_new=GetFontUnicodeRanges */
DWORD WINAPI GetFontUnicodeRanges_new(
HDC hdc,
LPGLYPHSET lpgs
)
{
SetLastError(ERROR_NOT_SUPPORTED);
return 0;
}
/* 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
)
{
return GM_COMPATIBLE;
}
/* MAKE_EXPORT SetWorldTransform_9x=SetWorldTransform */
BOOL WINAPI SetWorldTransform_9x(
HDC hdc, // handle to device context
CONST XFORM *lpXform // transformation data
)
{
return FALSE;
}
/* MAKE_EXPORT SetWorldTransform_NT=SetWorldTransform */
BOOL WINAPI SetWorldTransform_NT(
HDC hdc, // handle to device context
CONST XFORM *lpXform // transformation data
)
{
return TRUE;
}
/* MAKE_EXPORT GetRandomRgn_NT=GetRandomRgn */
int WINAPI GetRandomRgn_NT(
HDC hdc, // handle to DC
HRGN hrgn, // handle to region
INT iNum // must be SYSRGN
)
{
int result = GetRandomRgn(hdc,hrgn,iNum);
if (result)
{
POINT pt;
GetDCOrgEx(hdc,&pt);
OffsetRgn(hrgn,pt.x,pt.y);
}
return result;
}

View File

@ -0,0 +1,72 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
#include "kexcoresdk.h"
#include "_gdi32_apilist.h"
BOOL init_gdi32()
{
return TRUE;
}
/*
* MAKE_EXPORT GetCharWidthA=GetCharWidth32A
* MAKE_EXPORT GetCharWidthW=GetCharWidth32W
*/
static const apilib_named_api gdi32_named_apis[] =
{
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("AddFontMemResourceEx", AddFontMemResourceEx_stub),
DECL_API("AddFontResourceExA", AddFontResourceExA_new),
DECL_API("AddFontResourceExW", AddFontResourceExW_new),
DECL_API("AddFontResourceW", AddFontResourceW_new),
DECL_API("ExtTextOutA", ExtTextOutA_new),
DECL_API("ExtTextOutW", ExtTextOutW_new),
DECL_API("GetCharWidth32A", GetCharWidthA),
DECL_API("GetCharWidth32W", GetCharWidthW),
DECL_API("GetFontUnicodeRanges", GetFontUnicodeRanges_new),
DECL_API("GetGlyphOutlineA", GetGlyphOutlineA_fix),
DECL_API("GetRandomRgn", GetRandomRgn_NT),
DECL_API("PolyTextOutA", PolyTextOutA_new),
DECL_API("PolyTextOutW", PolyTextOutW_new),
DECL_API("RemoveFontMemResourceEx", RemoveFontMemResourceEx_stub),
DECL_API("RemoveFontResourceExA", RemoveFontResourceExA_new),
DECL_API("RemoveFontResourceExW", RemoveFontResourceExW_new),
DECL_API("RemoveFontResourceW", RemoveFontResourceW_new),
DECL_API("SetDCBrushColor", SetDCBrushColor_stub),
DECL_API("SetDCPenColor", SetDCPenColor_stub),
DECL_API("SetGraphicsMode", SetGraphicsMode_NT),
DECL_API("SetWorldTransform", SetWorldTransform_9x),
DECL_API("SetWorldTransform", SetWorldTransform_NT),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};
#if 0
static const apilib_unnamed_api gdi32_ordinal_apis[] =
{
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
};
#endif
const apilib_api_table apitable_gdi32 = DECL_TAB("GDI32.DLL", gdi32_named_apis, 0 /*gdi32_ordinal_apis*/);

View File

@ -0,0 +1,54 @@
/*
* KernelEx
* Copyright (C) 2008, 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.
*
*/
#ifndef _GDI32_APILIST_H
#define _GDI32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_gdi32();
extern const apilib_api_table apitable_gdi32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
INT WINAPI AddFontResourceExA_new(LPCSTR str, DWORD fl, PVOID pdv);
BOOL WINAPI RemoveFontResourceExA_new(LPCSTR str, DWORD fl, PVOID pdv);
DWORD WINAPI GetGlyphOutlineA_fix(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2);
BOOL WINAPI ExtTextOutA_new(HDC hdc, int X, int Y, UINT fuOptions, CONST RECT* lprc, LPCSTR lpString, UINT cbCount, CONST INT* lpDx);
BOOL WINAPI ExtTextOutW_new(HDC hdc, int X, int Y, UINT fuOptions, CONST RECT* lprc, LPCWSTR lpString, UINT cbCount, CONST INT* lpDx);
BOOL WINAPI PolyTextOutA_new(HDC hdc, const POLYTEXTA *pptxt, INT cStrings);
BOOL WINAPI PolyTextOutW_new(HDC hdc, const POLYTEXTW *pptxt, INT cStrings);
DWORD WINAPI GetFontUnicodeRanges_new(HDC hdc, LPGLYPHSET lpgs);
int WINAPI SetGraphicsMode_NT(HDC hdc, int iMode);
BOOL WINAPI SetWorldTransform_9x(HDC hdc, CONST XFORM *lpXform);
BOOL WINAPI SetWorldTransform_NT(HDC hdc, CONST XFORM *lpXform);
int WINAPI GetRandomRgn_NT(HDC hdc, HRGN hrgn, INT iNum);
STUB SetDCBrushColor_stub;
STUB SetDCPenColor_stub;
STUB AddFontMemResourceEx_stub;
STUB RemoveFontMemResourceEx_stub;
INT WINAPI AddFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv);
INT WINAPI AddFontResourceW_new(LPCWSTR strW);
BOOL WINAPI RemoveFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv);
BOOL WINAPI RemoveFontResourceW_new(LPCWSTR strW);
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

View File

@ -0,0 +1,27 @@
/*
* KernelEx
* Copyright (C) 2009, 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 "common.h"
UNIMPL_FUNC(SetDCBrushColor, 2);
UNIMPL_FUNC(SetDCPenColor, 2);
UNIMPL_FUNC(AddFontMemResourceEx, 4);
UNIMPL_FUNC(RemoveFontMemResourceEx, 1);

View File

@ -0,0 +1,55 @@
/*
* KernelEx
* Copyright (C) 2009, 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 "common.h"
#include "_gdi32_apilist.h"
//MAKE_EXPORT AddFontResourceExW_new=AddFontResourceExW
INT WINAPI AddFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv)
{
file_GetCP();
file_ALLOC_WtoA(str);
return AddFontResourceExA_new(strA, fl, pdv);
}
//MAKE_EXPORT AddFontResourceW_new=AddFontResourceW
INT WINAPI AddFontResourceW_new(LPCWSTR strW)
{
file_GetCP();
file_ALLOC_WtoA(str);
return AddFontResourceA(strA);
}
//MAKE_EXPORT RemoveFontResourceExW_new=RemoveFontResourceExW
BOOL WINAPI RemoveFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv)
{
file_GetCP();
file_ALLOC_WtoA(str);
return RemoveFontResourceExA_new(strA, fl, pdv);
}
//MAKE_EXPORT RemoveFontResourceW_new=RemoveFontResourceW
BOOL WINAPI RemoveFontResourceW_new(LPCWSTR strW)
{
file_GetCP();
file_ALLOC_WtoA(str);
return RemoveFontResourceA(strA);
}

View File

@ -0,0 +1,29 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
/* 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,
(dwCopyFlags & COPY_FILE_FAIL_IF_EXISTS) != 0);
}

View File

@ -0,0 +1,44 @@
/*
* KernelEx
* Copyright (C) 2008-2009, 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>
/* MAKE_EXPORT CreateFileA_fix=CreateFileA */
HANDLE WINAPI CreateFileA_fix(LPCSTR lpFileName, DWORD dwDesiredAccess,
DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDistribution, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{
/* translate NT-specific access rights to generic ones */
if (dwDesiredAccess & ~0xf0010100)
{
DWORD oldaccess = dwDesiredAccess;
dwDesiredAccess &= 0xf0010100;
if (oldaccess & FILE_READ_DATA)
dwDesiredAccess |= GENERIC_READ;
if (oldaccess & FILE_WRITE_DATA)
dwDesiredAccess |= GENERIC_WRITE;
if (oldaccess & FILE_EXECUTE)
dwDesiredAccess |= GENERIC_EXECUTE;
}
// hTemplate has to be NULL on 9x
return CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes,
dwCreationDistribution, dwFlagsAndAttributes, NULL);
}

View File

@ -0,0 +1,37 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
/* 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
)
{
DWORD dummy;
if ( !lpThreadId ) lpThreadId = &dummy;
return CreateThread( lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId );
}

View File

@ -0,0 +1,30 @@
/*
* KernelEx
*
* Copyright (C) 2008, 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>
/* MAKE_EXPORT DeleteCriticalSection_new=DeleteCriticalSection */
void WINAPI DeleteCriticalSection_new(PCRITICAL_SECTION lpCriticalSection)
{
//make DeleteCriticalSection not fail on deleted section
byte* deleted = (byte*) lpCriticalSection;
if (*deleted != 0) DeleteCriticalSection(lpCriticalSection);
}

View File

@ -0,0 +1,38 @@
/*
* KernelEx
* Copyright (C) 2006, 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>
/* MAKE_EXPORT GetFileSizeEx_new=GetFileSizeEx */
BOOL WINAPI GetFileSizeEx_new(HANDLE hFile, PLARGE_INTEGER lpFileSize)
{
DWORD h, l, lasterr;
lasterr = GetLastError();
l = GetFileSize(hFile, &h);
if (l == INVALID_FILE_SIZE && GetLastError() != NO_ERROR) return FALSE;
else
{
lpFileSize->HighPart = h;
lpFileSize->LowPart = l;
}
SetLastError(lasterr);
return TRUE;
}

View File

@ -0,0 +1,48 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "auxdecl.h"
/* MAKE_EXPORT GlobalMemoryStatusEx_new=GlobalMemoryStatusEx */
BOOL WINAPI GlobalMemoryStatusEx_new(LPMEMORYSTATUSEX lpmemex)
{
MEMORYSTATUS mem;
if (lpmemex->dwLength != sizeof(*lpmemex))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
mem.dwLength = sizeof(mem);
GlobalMemoryStatus(&mem);
lpmemex->dwMemoryLoad = mem.dwMemoryLoad;
lpmemex->ullTotalPhys = mem.dwTotalPhys;
lpmemex->ullAvailPhys = mem.dwAvailPhys;
lpmemex->ullTotalPageFile = mem.dwTotalPageFile;
lpmemex->ullAvailPageFile = mem.dwAvailPageFile;
lpmemex->ullTotalVirtual = mem.dwTotalVirtual;
lpmemex->ullAvailVirtual = mem.dwAvailVirtual;
lpmemex->ullAvailExtendedVirtual = 0;
return TRUE;
}

View File

@ -0,0 +1,51 @@
/*
* KernelEx
*
* Copyright (C) 2008, 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>
static BOOL IsValidHeap(HANDLE hHeap)
{
WORD *sig;
if ( IsBadReadPtr(hHeap,0x74) ) return FALSE;
sig = (WORD*)((DWORD)hHeap+0x72);
if ( *sig != 0x4948 ) return FALSE;
return TRUE;
}
/* MAKE_EXPORT HeapLock_new=HeapLock */
BOOL WINAPI HeapLock_new(
HANDLE hHeap
)
{
if ( !IsValidHeap(hHeap) ) return FALSE;
EnterCriticalSection((CRITICAL_SECTION*)((DWORD)hHeap+0x50));
return TRUE;
}
/* MAKE_EXPORT HeapUnlock_new=HeapUnlock */
BOOL WINAPI HeapUnlock_new(
HANDLE hHeap
)
{
if ( !IsValidHeap(hHeap) ) return FALSE;
LeaveCriticalSection((CRITICAL_SECTION*)((DWORD)hHeap+0x50));
return TRUE;
}

View File

@ -0,0 +1,29 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
/* MAKE_EXPORT InitializeCriticalSectionAndSpinCount_new=InitializeCriticalSectionAndSpinCount */
BOOL WINAPI InitializeCriticalSectionAndSpinCount_new(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount)
{
InitializeCriticalSection(lpCriticalSection);
return TRUE;
}

View File

@ -0,0 +1,81 @@
/*
* KernelEx
* Copyright (C) 2008, Xeno86
* Copyright (C) 2008, 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>
/* MAKE_EXPORT CreateJobObjectA_new=CreateJobObjectA */
HANDLE WINAPI CreateJobObjectA_new(LPSECURITY_ATTRIBUTES sa, LPCSTR name)
{
return (HANDLE) 0x1ee7;
}
/* MAKE_EXPORT CreateJobObjectW_new=CreateJobObjectW */
HANDLE WINAPI CreateJobObjectW_new(LPSECURITY_ATTRIBUTES sa, LPCWSTR name)
{
return (HANDLE) 0x1ee7;
}
/* MAKE_EXPORT TerminateJobObject_new=TerminateJobObject */
BOOL WINAPI TerminateJobObject_new(HANDLE job, UINT exit_code)
{
return TRUE;
}
/* MAKE_EXPORT OpenJobObjectA_new=OpenJobObjectA */
HANDLE WINAPI OpenJobObjectA_new(DWORD access, BOOL inherit, LPCSTR name)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/* MAKE_EXPORT OpenJobObjectW_new=OpenJobObjectW */
HANDLE WINAPI OpenJobObjectW_new(DWORD access, BOOL inherit, LPCWSTR name)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/* MAKE_EXPORT QueryInformationJobObject_new=QueryInformationJobObject */
BOOL WINAPI QueryInformationJobObject_new(HANDLE job, PVOID classs, LPVOID info, DWORD len, DWORD *ret_len)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/* MAKE_EXPORT SetInformationJobObject_new=SetInformationJobObject */
BOOL WINAPI SetInformationJobObject_new(HANDLE job, PVOID classs, LPVOID info, DWORD len)
{
return TRUE;
}
/* MAKE_EXPORT AssignProcessToJobObject_new=AssignProcessToJobObject */
BOOL WINAPI AssignProcessToJobObject_new(HANDLE job, HANDLE process)
{
return TRUE;
}
/* MAKE_EXPORT IsProcessInJob_new=IsProcessInJob */
BOOL WINAPI IsProcessInJob_new(HANDLE process, HANDLE job, PBOOL result)
{
*result = FALSE;
return TRUE;
}

View File

@ -0,0 +1,31 @@
/*
* KernelEx
* Copyright (C) 2009, 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 <stdio.h>
#include <windows.h>
#include "kexcoresdk.h"
/* MAKE_EXPORT KEXVersion=KEXVersion */
void WINAPI KEXVersion(char* out)
{
unsigned long ver = kexGetKEXVersion();
sprintf(out, "%d.%d.%d", (ver>>24) & 0xff, (ver>>16) & 0xff, ver & 0xffff);
}

View File

@ -0,0 +1,36 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
/* MAKE_EXPORT LockFileEx_new=LockFileEx */
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
*/
if (dwReserved)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
return LockFile(hFile, lpOverlapped->Offset, lpOverlapped->OffsetHigh, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh);
}

View File

@ -0,0 +1,44 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
/* MAKE_EXPORT MapViewOfFileEx_new=MapViewOfFileEx */
LPVOID WINAPI MapViewOfFileEx_new(
HANDLE hFileMappingObject,
DWORD dwDesiredAccess,
DWORD dwFileOffsetHigh,
DWORD dwFileOffsetLow,
SIZE_T dwNumberOfBytesToMap,
LPVOID lpBaseAddress
)
{
/*
* With this modification MapViewOfFileEx won't fail if lpBaseAddress
* doesn't point to Shared Arena - it will ignore suggested starting address
*/
if ((DWORD)lpBaseAddress < 0x80000000 || (DWORD)lpBaseAddress >= 0xc0000000)
{
lpBaseAddress = 0;
}
return MapViewOfFileEx(hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh,
dwFileOffsetLow, dwNumberOfBytesToMap, lpBaseAddress);
}

View File

@ -0,0 +1,111 @@
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: MoveFileExA.cpp,v $
*
* $Revision: 1.4 $
*
* last change: $Author: rt $ $Date: 2005/09/08 16:21:23 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
//#include "macros.h"
#include <windows.h>
#define WININIT_FILENAME "wininit.ini"
#define RENAME_SECTION "rename"
#define BUFSIZE 32767
/* MAKE_EXPORT MoveFileExA_new=MoveFileExA */
BOOL WINAPI MoveFileExA_new( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags )
{
BOOL fSuccess = FALSE; // assume failure
// Windows 9x has a special mechanism to move files after reboot
if ( dwFlags & MOVEFILE_DELAY_UNTIL_REBOOT )
{
CHAR szExistingFileNameA[MAX_PATH];
CHAR szNewFileNameA[MAX_PATH];
lstrcpyA( szNewFileNameA, "NUL" );
// Path names in WININIT.INI must be in short path name form
if (
GetShortPathNameA( lpExistingFileNameA, szExistingFileNameA, MAX_PATH ) &&
(!lpNewFileNameA || GetShortPathNameA( lpNewFileNameA, szNewFileNameA, MAX_PATH ))
)
{
CHAR* szBuffer = (CHAR*) HeapAlloc( GetProcessHeap(), 0, BUFSIZE ); // The buffer size must not exceed 32K
DWORD dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, BUFSIZE, WININIT_FILENAME );
CHAR szRename[MAX_PATH]; // This is enough for at most to times 67 chracters
size_t lnRename;
lstrcpyA( szRename, szNewFileNameA );
lstrcatA( szRename, "=" );
lstrcatA( szRename, szExistingFileNameA );
lnRename = lstrlenA(szRename);
if ( dwBufLen + lnRename + 2 <= BUFSIZE )
{
lstrcpyA( &szBuffer[dwBufLen], szRename );
szBuffer[ dwBufLen + lnRename + 1 ] = 0;
fSuccess = WritePrivateProfileSectionA( RENAME_SECTION, szBuffer, WININIT_FILENAME );
}
else
SetLastError( ERROR_BUFFER_OVERFLOW );
HeapFree( GetProcessHeap(), 0, szBuffer );
}
}
else
{
fSuccess = MoveFileA( lpExistingFileNameA, lpNewFileNameA );
if ( !fSuccess && 0 != (dwFlags & (MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) )
{
BOOL bFailIfExist = 0 == (dwFlags & MOVEFILE_REPLACE_EXISTING);
fSuccess = CopyFileA( lpExistingFileNameA, lpNewFileNameA, bFailIfExist );
// In case of successfull copy do not return FALSE if delete fails.
// Error detection is done by GetLastError()
if ( fSuccess )
{
SetLastError( NO_ERROR );
DeleteFileA( lpExistingFileNameA );
}
}
}
return fSuccess;
}

View File

@ -0,0 +1,28 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
/* MAKE_EXPORT MoveFileWithProgressA_new=MoveFileWithProgressA */
BOOL WINAPI MoveFileWithProgressA_new(LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags)
{
return MoveFileExA(lpExistingFileName, lpNewFileName, dwFlags);
}

View File

@ -0,0 +1,60 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "kexcoresdk.h"
typedef HANDLE (__stdcall *AllocHandle_t)(void* current_pdb, void* tdb, DWORD access);
AllocHandle_t AllocHandle = NULL;
BOOL init_openthread()
{
int i;
DWORD addr = (DWORD) kexGetProcAddress(GetModuleHandle("kernel32"), "OpenProcess");
for (i = 0 ; i < 100 ; i++, addr++)
if (*(DWORD*) addr == 0xe832ff50)
{
addr += 4;
AllocHandle = (AllocHandle_t)(addr + 4 + *(DWORD*)addr);
return TRUE;
}
return FALSE;
}
/* MAKE_EXPORT OpenThread_new=OpenThread */
HANDLE WINAPI OpenThread_new(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId)
{
HANDLE ret;
BYTE* tdb = (BYTE*) kexTIDtoTDB(dwThreadId);
if (!tdb || *tdb != 7)
{
SetLastError(ERROR_INVALID_PARAMETER);
return NULL;
}
dwDesiredAccess &= THREAD_ALL_ACCESS;
if (bInheritHandle)
dwDesiredAccess |= 0x80000000;
ret = AllocHandle(kexPIDtoPDB(GetCurrentProcessId()), tdb, dwDesiredAccess);
if (ret == INVALID_HANDLE_VALUE)
return NULL;
return ret;
}

View File

@ -0,0 +1,40 @@
/*
* KernelEx
* Copyright (C) 2006, 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>
#ifndef INVALID_SET_FILE_POINTER
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
#endif
/* MAKE_EXPORT SetFilePointerEx_new=SetFilePointerEx */
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;
}

View File

@ -0,0 +1,51 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
/* COMPLETE SHIT. PORT WINE HERE */
/* MAKE_EXPORT RegisterWaitForSingleObject_new=RegisterWaitForSingleObject */
BOOL WINAPI RegisterWaitForSingleObject_new(PHANDLE phNewWaitObject, HANDLE hObject, PVOID Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/* MAKE_EXPORT RegisterWaitForSingleObjectEx_new=RegisterWaitForSingleObjectEx */
HANDLE WINAPI RegisterWaitForSingleObjectEx_new(HANDLE hObject,
PVOID Callback, PVOID Context,
ULONG dwMilliseconds, ULONG dwFlags)
{
return 0;
}
/* MAKE_EXPORT UnregisterWait_new=UnregisterWait */
BOOL WINAPI UnregisterWait_new(HANDLE WaitHandle)
{
return WaitHandle != 0;
}
/* MAKE_EXPORT UnregisterWaitEx_new=UnregisterWaitEx */
BOOL WINAPI UnregisterWaitEx_new(HANDLE WaitHandle, HANDLE CompletionEvent)
{
return WaitHandle != 0;
}

View File

@ -0,0 +1,152 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "kexcoresdk.h"
#define K32OBJ_CRITICAL_SECTION 4
typedef struct _CRIT_SECT // Size = 0x20
{
BYTE Type; // 00 = 4: K32_OBJECT_CRITICAL_SECTION
int RecursionCount; // 04 initially 0, incremented on lock
void* OwningThread; // 08 pointer to TDBX
DWORD un3; // 0C
int LockCount; // 10 initially 1, decremented on lock
struct _CRIT_SECT* Next; // 14
void* PLst; // 18 list of processes using it?
struct _WIN_CRITICAL_SECTION* UserCS; // 1C pointer to user defined CRITICAL_SECTION
} CRIT_SECT, *PCRIT_SECT;
typedef struct _WIN_CRITICAL_SECTION
{
BYTE Type; //= 4: K32_OBJECT_CRITICAL_SECTION
PCRIT_SECT crit;
DWORD un1;
DWORD un2;
DWORD un3;
DWORD un4;
} WIN_CRITICAL_SECTION, *PWIN_CRITICAL_SECTION;
static DWORD _offset;
BOOL init_tryentercritsec()
{
DWORD GV = kexGetVersion();
if (GV == 0xc0000a04) //98
{
_offset = 0x58 - 0x8;
return TRUE;
}
if (GV == 0xc0005a04) //Me
{
_offset = 0x88 - 0x8;
return TRUE;
}
return FALSE;
}
#ifdef __GNUC__
BOOL WINAPI TryEnterCrst(CRIT_SECT* crit);
__asm__(".text\n\t"
".align 4\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"
".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"
".L2: \n\t"
/* critical section owned by other thread - do nothing */
"xorl %eax,%eax\n\t"
"ret $4\n\t"
);
#else
__declspec(naked) BOOL WINAPI TryEnterCrst(CRIT_SECT* crit)
{
__asm {
mov edx, [esp+4]
xor eax, eax
inc eax
xor ecx, ecx
cmpxchg [edx+10h], ecx ;if (OP1==eax) { OP1=OP2; ZF=1; } else { eax=OP1; ZF=0 }
;mov ecx, ppTDBXCur
mov ecx, fs:[18h]
add ecx, [_offset]
mov ecx, [ecx] ;ecx will contain TDBX now
cmp eax, 1
jnz L1
;critical section was unowned => successful lock
mov [edx+8], ecx
inc dword ptr [edx+4]
ret 4
L1:
cmp [edx+8], ecx
jnz L2
;critical section owned by this thread
dec dword ptr [edx+10h]
inc dword ptr [edx+4]
xor eax, eax
inc eax
ret 4
L2:
;critical section owned by other thread - do nothing
xor eax, eax
ret 4
}
}
#endif
/* MAKE_EXPORT TryEnterCriticalSection_new=TryEnterCriticalSection */
BOOL WINAPI TryEnterCriticalSection_new(CRITICAL_SECTION* cs)
{
WIN_CRITICAL_SECTION* mycs = (WIN_CRITICAL_SECTION*) cs;
if (mycs->Type != K32OBJ_CRITICAL_SECTION)
RaiseException(STATUS_ACCESS_VIOLATION, 0, 0, NULL);
return TryEnterCrst(mycs->crit);
}

View File

@ -0,0 +1,41 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
#ifndef VA_SHARED
#define VA_SHARED 0x8000000
#endif
/* MAKE_EXPORT VirtualAllocEx_new=VirtualAllocEx */
LPVOID WINAPI VirtualAllocEx_new(HANDLE hProcess, LPVOID lpAddress, DWORD dwSize, DWORD flAllocationType, DWORD flProtect)
{
if (hProcess != GetCurrentProcess())
//if (GetProcessID(hProcess) != GetCurrentProcessId())
flAllocationType |= VA_SHARED;
return VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect);
}
/* MAKE_EXPORT VirtualFreeEx_new=VirtualFreeEx */
BOOL WINAPI VirtualFreeEx_new(HANDLE hProcess, LPVOID lpAddress, DWORD dwSize, DWORD dwFreeType)
{
return VirtualFree(lpAddress, dwSize, dwFreeType);
}

View File

@ -0,0 +1,194 @@
/*
* KernelEx
* Copyright (C) 2008, 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.
*
*/
/*TODOS:
CreateRemoteThread
http://17slon.com/blogs/gabr/2007/02/four-ways-to-detect-vista.html
*/
#include "common.h"
#include "kexcoresdk.h"
#include "_kernel32_apilist.h"
BOOL init_tryentercritsec();
BOOL init_openthread();
BOOL init_kernel32()
{
return init_tryentercritsec() && init_openthread();
}
/*
* MAKE_EXPORT GetWindowsDirectoryA=GetSystemWindowsDirectoryA
* MAKE_EXPORT GetWindowsDirectoryW=GetSystemWindowsDirectoryW
* MAKE_EXPORT GetSystemInfo=GetNativeSystemInfo
* MAKE_EXPORT SetLastError=RestoreLastError
*/
static const apilib_named_api kernel32_named_apis[] =
{
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("AddAtomW", AddAtomW_new),
DECL_API("AssignProcessToJobObject", AssignProcessToJobObject_new),
DECL_API("CopyFileExA", CopyFileExA_new),
DECL_API("CopyFileExW", CopyFileExW_new),
DECL_API("CopyFileW", CopyFileW_new),
DECL_API("CreateDirectoryExW", CreateDirectoryExW_new),
DECL_API("CreateDirectoryW", CreateDirectoryW_new),
DECL_API("CreateFileA", CreateFileA_fix),
DECL_API("CreateFileW", CreateFileW_new),
DECL_API("CreateHardLinkA", CreateHardLinkA_stub),
DECL_API("CreateHardLinkW", CreateHardLinkW_stub),
DECL_API("CreateJobObjectA", CreateJobObjectA_new),
DECL_API("CreateJobObjectW", CreateJobObjectW_new),
DECL_API("CreateThread", CreateThread_fix),
DECL_API("DefineDosDeviceW", DefineDosDeviceW_new),
DECL_API("DeleteCriticalSection", DeleteCriticalSection_new),
DECL_API("DeleteFileW", DeleteFileW_new),
DECL_API("EnumUILanguagesA", EnumUILanguagesA_new),
DECL_API("EnumUILanguagesW", EnumUILanguagesW_new),
DECL_API("FindAtomW", FindAtomW_new),
DECL_API("FindFirstChangeNotificationW", FindFirstChangeNotificationW_new),
DECL_API("FindFirstFileExW", FindFirstFileExW_stub),
DECL_API("FindFirstFileW", FindFirstFileW_new),
DECL_API("FindNextFileW", FindNextFileW_new),
DECL_API("FindResourceExW", FindResourceExW_new),
DECL_API("FindResourceW", FindResourceW_new),
DECL_API("FreeEnvironmentStringsW", FreeEnvironmentStringsW_new),
DECL_API("GetConsoleWindow", GetConsoleWindow_stub),
DECL_API("GetCurrentDirectoryW", GetCurrentDirectoryW_new),
DECL_API("GetDefaultCommConfigW", GetDefaultCommConfigW_new),
DECL_API("GetDiskFreeSpaceExW", GetDiskFreeSpaceExW_new),
DECL_API("GetDiskFreeSpaceW", GetDiskFreeSpaceW_new),
DECL_API("GetEnvironmentStringsW", GetEnvironmentStringsW_new),
DECL_API("GetFileAttributesExW", GetFileAttributesExW_new),
DECL_API("GetFileAttributesW", GetFileAttributesW_new),
DECL_API("GetFileSizeEx", GetFileSizeEx_new),
DECL_API("GetFullPathNameW", GetFullPathNameW_new),
DECL_API("GetLongPathNameW", GetLongPathNameW_new),
DECL_API("GetNativeSystemInfo", GetSystemInfo),
DECL_API("GetShortPathNameW", GetShortPathNameW_new),
DECL_API("GetStartupInfoW", GetStartupInfoW_new),
DECL_API("GetSystemDefaultUILanguage", GetSystemDefaultUILanguage_new),
DECL_API("GetSystemDirectoryW", GetSystemDirectoryW_new),
DECL_API("GetSystemWindowsDirectoryA", GetWindowsDirectoryA),
DECL_API("GetSystemWindowsDirectoryW", GetWindowsDirectoryW),
DECL_API("GetTempFileNameW", GetTempFileNameW_new),
DECL_API("GetTempPathW", GetTempPathW_new),
DECL_API("GetUserDefaultUILanguage", GetUserDefaultUILanguage_new),
DECL_API("GetVersion", GetVersion_WIN95),
DECL_API("GetVersion", GetVersion_WIN98),
DECL_API("GetVersion", GetVersion_WINME),
DECL_API("GetVersion", GetVersion_NT40),
DECL_API("GetVersion", GetVersion_NT2K),
DECL_API("GetVersion", GetVersion_WINXP),
DECL_API("GetVersion", GetVersion_WIN2K3),
DECL_API("GetVersion", GetVersion_VISTA),
DECL_API("GetVersion", GetVersion_WIN2K8),
DECL_API("GetVersionExA", GetVersionExA_WIN95),
DECL_API("GetVersionExA", GetVersionExA_WIN98),
DECL_API("GetVersionExA", GetVersionExA_WINME),
DECL_API("GetVersionExA", GetVersionExA_NT40),
DECL_API("GetVersionExA", GetVersionExA_NT2K),
DECL_API("GetVersionExA", GetVersionExA_WINXP),
DECL_API("GetVersionExA", GetVersionExA_WIN2K3),
DECL_API("GetVersionExA", GetVersionExA_VISTA),
DECL_API("GetVersionExA", GetVersionExA_WIN2K8),
DECL_API("GetVersionExW", GetVersionExW_WIN95),
DECL_API("GetVersionExW", GetVersionExW_WIN98),
DECL_API("GetVersionExW", GetVersionExW_WINME),
DECL_API("GetVersionExW", GetVersionExW_NT40),
DECL_API("GetVersionExW", GetVersionExW_NT2K),
DECL_API("GetVersionExW", GetVersionExW_WINXP),
DECL_API("GetVersionExW", GetVersionExW_WIN2K3),
DECL_API("GetVersionExW", GetVersionExW_VISTA),
DECL_API("GetVersionExW", GetVersionExW_WIN2K8),
DECL_API("GetWindowsDirectoryW", GetWindowsDirectoryW_new),
DECL_API("GlobalAddAtomW", GlobalAddAtomW_new),
DECL_API("GlobalFindAtomW", GlobalFindAtomW_new),
DECL_API("GlobalGetAtomNameW", GlobalGetAtomNameW_new),
DECL_API("GlobalMemoryStatusEx", GlobalMemoryStatusEx_new),
DECL_API("HeapLock", HeapLock_new),
DECL_API("HeapUnlock", HeapUnlock_new),
DECL_API("InitializeCriticalSectionAndSpinCount", InitializeCriticalSectionAndSpinCount_new),
DECL_API("IsProcessInJob", IsProcessInJob_new),
DECL_API("IsValidLanguageGroup", IsValidLanguageGroup_stub),
DECL_API("KEXVersion", KEXVersion),
DECL_API("LockFileEx", LockFileEx_new),
DECL_API("MapViewOfFileEx", MapViewOfFileEx_new),
DECL_API("Module32FirstW", Module32FirstW_new),
DECL_API("Module32NextW", Module32NextW_new),
DECL_API("MoveFileExA", MoveFileExA_new),
DECL_API("MoveFileExW", MoveFileExW_new),
DECL_API("MoveFileW", MoveFileW_new),
DECL_API("MoveFileWithProgressA", MoveFileWithProgressA_new),
DECL_API("MoveFileWithProgressW", MoveFileWithProgressW_new),
DECL_API("OpenJobObjectA", OpenJobObjectA_new),
DECL_API("OpenJobObjectW", OpenJobObjectW_new),
DECL_API("OpenThread", OpenThread_new),
DECL_API("OutputDebugStringW", OutputDebugStringW_new),
DECL_API("Process32FirstW", Process32FirstW_new),
DECL_API("Process32NextW", Process32NextW_new),
DECL_API("QueryInformationJobObject", QueryInformationJobObject_new),
DECL_API("QueueUserWorkItem", QueueUserWorkItem_stub),
DECL_API("RegisterWaitForSingleObject", RegisterWaitForSingleObject_new),
DECL_API("RegisterWaitForSingleObjectEx", RegisterWaitForSingleObjectEx_new),
DECL_API("RemoveDirectoryW", RemoveDirectoryW_new),
DECL_API("ReplaceFileA", ReplaceFileA_stub),
DECL_API("ReplaceFileW", ReplaceFileW_stub),
DECL_API("RestoreLastError", SetLastError),
DECL_API("SearchPathW", SearchPathW_new),
DECL_API("SetConsoleTitleW", SetConsoleTitleW_new),
DECL_API("SetCurrentDirectoryW", SetCurrentDirectoryW_new),
DECL_API("SetFileAttributesW", SetFileAttributesW_new),
DECL_API("SetFilePointerEx", SetFilePointerEx_new),
DECL_API("SetInformationJobObject", SetInformationJobObject_new),
DECL_API("TerminateJobObject", TerminateJobObject_new),
DECL_API("TryEnterCriticalSection", TryEnterCriticalSection_new),
DECL_API("UnregisterWait", UnregisterWait_new),
DECL_API("UnregisterWaitEx", UnregisterWaitEx_new),
DECL_API("VerLanguageNameW", VerLanguageNameW_new),
DECL_API("VerSetConditionMask", VerSetConditionMask_new),
DECL_API("VerifyVersionInfoA", VerifyVersionInfoA_NT2K),
DECL_API("VerifyVersionInfoA", VerifyVersionInfoA_WINXP),
DECL_API("VerifyVersionInfoA", VerifyVersionInfoA_WIN2K3),
DECL_API("VerifyVersionInfoA", VerifyVersionInfoA_VISTA),
DECL_API("VerifyVersionInfoA", VerifyVersionInfoA_WIN2K8),
DECL_API("VerifyVersionInfoW", VerifyVersionInfoW_NT2K),
DECL_API("VerifyVersionInfoW", VerifyVersionInfoW_WINXP),
DECL_API("VerifyVersionInfoW", VerifyVersionInfoW_WIN2K3),
DECL_API("VerifyVersionInfoW", VerifyVersionInfoW_VISTA),
DECL_API("VerifyVersionInfoW", VerifyVersionInfoW_WIN2K8),
DECL_API("VirtualAllocEx", VirtualAllocEx_new),
DECL_API("VirtualFreeEx", VirtualFreeEx_new),
DECL_API("lstrcpynW", lstrcpynW_new),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};
#if 0
static const apilib_unnamed_api kernel32_ordinal_apis[] =
{
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
};
#endif
const apilib_api_table apitable_kernel32 = DECL_TAB("KERNEL32.DLL", kernel32_named_apis, 0 /*kernel32_ordinal_apis*/);

View File

@ -0,0 +1,165 @@
/*
* KernelEx
* Copyright (C) 2008, 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.
*
*/
#ifndef _KERNEL32_APILIST_H
#define _KERNEL32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
#include <tlhelp32.h>
BOOL init_kernel32();
extern const apilib_api_table apitable_kernel32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
BOOL WINAPI CopyFileExA_new(LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags);
HANDLE WINAPI CreateFileA_fix(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDistribution, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
HANDLE WINAPI CreateThread_fix(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId);
void WINAPI DeleteCriticalSection_new(PCRITICAL_SECTION lpCriticalSection);
BOOL WINAPI GetFileSizeEx_new(HANDLE hFile, PLARGE_INTEGER lpFileSize);
BOOL WINAPI GlobalMemoryStatusEx_new(LPMEMORYSTATUSEX lpmemex);
BOOL WINAPI HeapLock_new(HANDLE hHeap);
BOOL WINAPI HeapUnlock_new(HANDLE hHeap);
BOOL WINAPI InitializeCriticalSectionAndSpinCount_new(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount);
HANDLE WINAPI CreateJobObjectA_new(LPSECURITY_ATTRIBUTES sa, LPCSTR name);
HANDLE WINAPI CreateJobObjectW_new(LPSECURITY_ATTRIBUTES sa, LPCWSTR name);
BOOL WINAPI TerminateJobObject_new(HANDLE job, UINT exit_code);
HANDLE WINAPI OpenJobObjectA_new(DWORD access, BOOL inherit, LPCSTR name);
HANDLE WINAPI OpenJobObjectW_new(DWORD access, BOOL inherit, LPCWSTR name);
BOOL WINAPI QueryInformationJobObject_new(HANDLE job, PVOID classs, LPVOID info, DWORD len, DWORD *ret_len);
BOOL WINAPI SetInformationJobObject_new(HANDLE job, PVOID classs, LPVOID info, DWORD len);
BOOL WINAPI AssignProcessToJobObject_new(HANDLE job, HANDLE process);
BOOL WINAPI IsProcessInJob_new(HANDLE process, HANDLE job, PBOOL result);
void WINAPI KEXVersion(char* out);
BOOL WINAPI LockFileEx_new(HANDLE hFile, DWORD dwFlags, DWORD dwReserved, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped);
LPVOID WINAPI MapViewOfFileEx_new(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress);
BOOL WINAPI MoveFileExA_new(LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags);
BOOL WINAPI MoveFileWithProgressA_new(LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags);
HANDLE WINAPI OpenThread_new(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId);
BOOL WINAPI SetFilePointerEx_new(HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod);
BOOL WINAPI RegisterWaitForSingleObject_new(PHANDLE phNewWaitObject, HANDLE hObject, PVOID Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags);
HANDLE WINAPI RegisterWaitForSingleObjectEx_new(HANDLE hObject, PVOID Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags);
BOOL WINAPI UnregisterWait_new(HANDLE WaitHandle);
BOOL WINAPI UnregisterWaitEx_new(HANDLE WaitHandle, HANDLE CompletionEvent);
BOOL WINAPI TryEnterCriticalSection_new(CRITICAL_SECTION* cs);
LPVOID WINAPI VirtualAllocEx_new(HANDLE hProcess, LPVOID lpAddress, DWORD dwSize, DWORD flAllocationType, DWORD flProtect);
BOOL WINAPI VirtualFreeEx_new(HANDLE hProcess, LPVOID lpAddress, DWORD dwSize, DWORD dwFreeType);
STUB CreateHardLinkA_stub;
STUB CreateHardLinkW_stub;
STUB GetConsoleWindow_stub;
STUB IsValidLanguageGroup_stub;
STUB QueueUserWorkItem_stub;
STUB ReplaceFileA_stub;
STUB ReplaceFileW_stub;
STUB FindFirstFileExW_stub;
LANGID WINAPI GetUserDefaultUILanguage_new(void);
LANGID WINAPI GetSystemDefaultUILanguage_new(void);
BOOL WINAPI EnumUILanguagesA_new(UILANGUAGE_ENUMPROCA pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam);
BOOL WINAPI EnumUILanguagesW_new(UILANGUAGE_ENUMPROCW pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam);
ATOM WINAPI AddAtomW_new(LPCWSTR strW);
BOOL WINAPI CopyFileExW_new(LPCWSTR lpExistingFileNameW, LPCWSTR lpNewFileNameW, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags);
BOOL WINAPI CopyFileW_new(LPCWSTR lpExistingFileNameW, LPCWSTR lpNewFileNameW, BOOL bFailIfExists);
BOOL WINAPI CreateDirectoryExW_new(LPCWSTR templatedirW, LPCWSTR newdirW, LPSECURITY_ATTRIBUTES secattr);
BOOL WINAPI CreateDirectoryW_new(LPCWSTR PathW, LPSECURITY_ATTRIBUTES SecAttr);
HANDLE WINAPI CreateFileW_new(LPCWSTR strW, DWORD access, DWORD sharemode, LPSECURITY_ATTRIBUTES secattr, DWORD creatdistr, DWORD flags, HANDLE temp);
BOOL WINAPI DefineDosDeviceW_new(DWORD dwFlags, LPCWSTR lpDeviceNameW, LPCWSTR lpTargetPathW);
BOOL WINAPI DeleteFileW_new(LPCWSTR lpFileNameW);
ATOM WINAPI FindAtomW_new(LPCWSTR strW);
HANDLE WINAPI FindFirstChangeNotificationW_new(LPCWSTR pathW, BOOL watchsubtree, DWORD filter);
HANDLE WINAPI FindFirstFileW_new(LPCWSTR strW, LPWIN32_FIND_DATAW dataW);
BOOL WINAPI FindNextFileW_new(HANDLE handle, LPWIN32_FIND_DATAW dataW);
HRSRC WINAPI FindResourceExW_new(HMODULE hModule, LPCWSTR typeW, LPCWSTR nameW, WORD lang);
HRSRC WINAPI FindResourceW_new(HINSTANCE hModule, LPCWSTR name, LPCWSTR type);
BOOL WINAPI FreeEnvironmentStringsW_new(void* env);
DWORD WINAPI GetCurrentDirectoryW_new(DWORD nBufferLength, LPWSTR lpBufferW);
BOOL WINAPI GetDefaultCommConfigW_new(LPCWSTR lpszNameW, LPCOMMCONFIG lpCC, LPDWORD lpdwSize);
BOOL WINAPI GetDiskFreeSpaceExW_new(LPCWSTR lpDirectoryNameW, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes);
BOOL WINAPI GetDiskFreeSpaceW_new(LPCWSTR lpRootPathNameW, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters);
void* WINAPI GetEnvironmentStringsW_new(void);
BOOL WINAPI GetFileAttributesExW_new(LPCWSTR lpFileNameW, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation);
DWORD WINAPI GetFileAttributesW_new(LPCWSTR lpFileNameW);
DWORD WINAPI GetFullPathNameW_new(LPCWSTR lpFileNameW, DWORD nBufferLength, LPWSTR lpBufferW, LPWSTR *lpFilePartW);
DWORD WINAPI GetLongPathNameW_new(LPCWSTR lpszShortPathW, LPWSTR lpszLongPathW, DWORD cchBuffer);
DWORD WINAPI GetShortPathNameW_new(LPCWSTR lpszLongPathW, LPWSTR lpszShortPathW, DWORD cchBuffer);
VOID WINAPI GetStartupInfoW_new(LPSTARTUPINFOW lpStartupInfo);
UINT WINAPI GetSystemDirectoryW_new(LPWSTR lpBufferW, UINT uSize);
UINT WINAPI GetTempFileNameW_new(LPCWSTR lpPathNameW, LPCWSTR lpPrefixStringW, UINT uUnique, LPWSTR lpTempFileNameW);
DWORD WINAPI GetTempPathW_new(DWORD nBufferLength, LPWSTR lpBufferW);
UINT WINAPI GetWindowsDirectoryW_new(LPWSTR lpBufferW, UINT uSize);
ATOM WINAPI GlobalAddAtomW_new(LPCWSTR strW);
ATOM WINAPI GlobalFindAtomW_new(LPCWSTR strW);
UINT WINAPI GlobalGetAtomNameW_new(ATOM atom, LPWSTR bufferW, int size);
BOOL WINAPI Module32FirstW_new(HANDLE hSnapshot, LPMODULEENTRY32W lpmeW);
BOOL WINAPI Module32NextW_new(HANDLE hSnapshot, LPMODULEENTRY32W lpmeW);
BOOL WINAPI MoveFileExW_new(LPCWSTR existingfileW, LPCWSTR newfileW, DWORD flags);
BOOL WINAPI MoveFileW_new(LPCWSTR existingfileW, LPCWSTR newfileW);
BOOL WINAPI MoveFileWithProgressW_new(LPCWSTR existingfileW, LPCWSTR newfileW, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags);
void WINAPI OutputDebugStringW_new(LPCWSTR strW);
BOOL WINAPI Process32FirstW_new(HANDLE hSnapshot, LPPROCESSENTRY32W lppeW);
BOOL WINAPI Process32NextW_new(HANDLE hSnapshot, LPPROCESSENTRY32W lppeW);
BOOL WINAPI RemoveDirectoryW_new(LPCWSTR lpPathNameW);
DWORD WINAPI SearchPathW_new(LPCWSTR lpPathW, LPCWSTR lpFileNameW, LPCWSTR lpExtensionW, DWORD nBufferLength, LPWSTR lpBufferW, LPWSTR *lpFilePartW);
BOOL WINAPI SetConsoleTitleW_new(LPCWSTR strW);
BOOL WINAPI SetCurrentDirectoryW_new(LPCWSTR lpPathNameW);
BOOL WINAPI SetFileAttributesW_new(LPCWSTR lpFileNameW, DWORD dwFileAttributes);
DWORD WINAPI VerLanguageNameW_new(DWORD wLang, LPWSTR szLangW, DWORD nSize);
LPWSTR WINAPI lstrcpynW_new(LPWSTR dst, LPCWSTR src, INT n);
ULONGLONG WINAPI VerSetConditionMask_new(ULONGLONG dwlConditionMask, DWORD dwTypeBitMask, BYTE dwConditionMask);
DWORD WINAPI GetVersion_WIN95(void);
DWORD WINAPI GetVersion_WIN98(void);
DWORD WINAPI GetVersion_WINME(void);
DWORD WINAPI GetVersion_NT40(void);
DWORD WINAPI GetVersion_NT2K(void);
DWORD WINAPI GetVersion_WINXP(void);
DWORD WINAPI GetVersion_WIN2K3(void);
DWORD WINAPI GetVersion_VISTA(void);
DWORD WINAPI GetVersion_WIN2K8(void);
BOOL WINAPI GetVersionExA_WIN95(LPOSVERSIONINFOA lpVersionInfo);
BOOL WINAPI GetVersionExW_WIN95(LPOSVERSIONINFOW lpVersionInfo);
BOOL WINAPI GetVersionExA_WIN98(LPOSVERSIONINFOA lpVersionInfo);
BOOL WINAPI GetVersionExW_WIN98(LPOSVERSIONINFOW lpVersionInfo);
BOOL WINAPI GetVersionExA_WINME(LPOSVERSIONINFOA lpVersionInfo);
BOOL WINAPI GetVersionExW_WINME(LPOSVERSIONINFOW lpVersionInfo);
BOOL WINAPI GetVersionExA_NT40(LPOSVERSIONINFOA lpVersionInfo);
BOOL WINAPI GetVersionExW_NT40(LPOSVERSIONINFOW lpVersionInfo);
BOOL WINAPI GetVersionExA_NT2K(LPOSVERSIONINFOA lpVersionInfo);
BOOL WINAPI GetVersionExW_NT2K(LPOSVERSIONINFOW lpVersionInfo);
BOOL WINAPI GetVersionExA_WINXP(LPOSVERSIONINFOA lpVersionInfo);
BOOL WINAPI GetVersionExW_WINXP(LPOSVERSIONINFOW lpVersionInfo);
BOOL WINAPI GetVersionExA_WIN2K3(LPOSVERSIONINFOA lpVersionInfo);
BOOL WINAPI GetVersionExW_WIN2K3(LPOSVERSIONINFOW lpVersionInfo);
BOOL WINAPI GetVersionExA_VISTA(LPOSVERSIONINFOA lpVersionInfo);
BOOL WINAPI GetVersionExW_VISTA(LPOSVERSIONINFOW lpVersionInfo);
BOOL WINAPI GetVersionExA_WIN2K8(LPOSVERSIONINFOA lpVersionInfo);
BOOL WINAPI GetVersionExW_WIN2K8(LPOSVERSIONINFOW lpVersionInfo);
BOOL WINAPI VerifyVersionInfoA_NT2K(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
BOOL WINAPI VerifyVersionInfoW_NT2K(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
BOOL WINAPI VerifyVersionInfoA_WINXP(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
BOOL WINAPI VerifyVersionInfoW_WINXP(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
BOOL WINAPI VerifyVersionInfoA_WIN2K3(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
BOOL WINAPI VerifyVersionInfoW_WIN2K3(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
BOOL WINAPI VerifyVersionInfoA_VISTA(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
BOOL WINAPI VerifyVersionInfoW_VISTA(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
BOOL WINAPI VerifyVersionInfoA_WIN2K8(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
BOOL WINAPI VerifyVersionInfoW_WIN2K8(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

View File

@ -0,0 +1,31 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
UNIMPL_FUNC(CreateHardLinkA, 3);
UNIMPL_FUNC(CreateHardLinkW, 3);
UNIMPL_FUNC(GetConsoleWindow, 0);
UNIMPL_FUNC(IsValidLanguageGroup, 2);
UNIMPL_FUNC(QueueUserWorkItem, 3);
UNIMPL_FUNC(ReplaceFileA, 6);
UNIMPL_FUNC(ReplaceFileW, 6);
UNIMPL_FUNC(FindFirstFileExW, 6);

View File

@ -0,0 +1,160 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
static DWORD hexstr_to_dword(const char* hexstr)
{
int i;
DWORD res = 0;
for (i = 0 ; i < 8 ; i++)
{
res <<= 4;
if (hexstr[i] >= '0' && hexstr[i] <= '9')
res += hexstr[i] - '0';
else if (hexstr[i] >= 'a' && hexstr[i] <= 'f')
res += hexstr[i] - 'a' + 0xa;
else if (hexstr[i] >= 'A' && hexstr[i] <= 'F')
res += hexstr[i] - 'A' + 0xA;
else
return (DWORD)-1;
}
return res;
}
static void dword_to_hexstr(DWORD val, void* _out, BOOL unicode)
{
int i;
char* out = (char*) _out;
for (i = 0 ; i < 8 ; i++)
{
int v = (val & 0xf0000000) >> 28;
val <<= 4;
if (v <= 9)
*out++ = v + '0';
else
*out++ = v - 0xa + 'A';
if (unicode)
*out++ = 0;
}
*out++ = 0;
if (unicode)
*out++ = 0;
}
static LANGID UILanguage_readreg()
{
HKEY key;
DWORD type;
char data[10];
LONG res;
DWORD count = sizeof(data);
if (RegOpenKey(HKEY_CURRENT_USER, "Control Panel\\desktop\\ResourceLocale", &key))
return (LANGID) -1;
res = RegQueryValueEx(key, NULL, NULL, &type, (BYTE*)data, &count);
RegCloseKey(key);
if (!res && type == REG_SZ && count == 9)
{
DWORD res = hexstr_to_dword(data);
if (res < 0x10000)
return (LANGID) res;
}
return (LANGID) -1;
}
/* MAKE_EXPORT GetUserDefaultUILanguage_new=GetUserDefaultUILanguage */
LANGID WINAPI GetUserDefaultUILanguage_new(void)
{
LANGID res = UILanguage_readreg();
if (res != (LANGID) -1)
return res;
return (LANGID) 0x409; /* default to English US */
}
/* MAKE_EXPORT GetSystemDefaultUILanguage_new=GetSystemDefaultUILanguage */
LANGID WINAPI GetSystemDefaultUILanguage_new(void)
{
LANGID res = UILanguage_readreg();
if (res != (LANGID) -1)
return res;
return (LANGID) 0x409; /* default to English US */
}
typedef long LONG_PTR;
typedef BOOL (CALLBACK *UILANGUAGE_ENUMPROCA)(LPSTR, LONG_PTR);
typedef BOOL (CALLBACK *UILANGUAGE_ENUMPROCW)(LPWSTR, LONG_PTR);
/* MAKE_EXPORT EnumUILanguagesA_new=EnumUILanguagesA */
BOOL WINAPI EnumUILanguagesA_new(UILANGUAGE_ENUMPROCA pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam)
{
char buf[10];
LANGID lid;
if (!pUILangEnumProc)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (dwFlags)
{
SetLastError(ERROR_INVALID_FLAGS);
return FALSE;
}
lid = GetSystemDefaultUILanguage_new();
dword_to_hexstr(lid, buf, FALSE);
pUILangEnumProc(buf, lParam);
return TRUE;
}
/* MAKE_EXPORT EnumUILanguagesW_new=EnumUILanguagesW */
BOOL WINAPI EnumUILanguagesW_new(UILANGUAGE_ENUMPROCW pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam)
{
WCHAR buf[10];
LANGID lid;
if (!pUILangEnumProc)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (dwFlags)
{
SetLastError(ERROR_INVALID_FLAGS);
return FALSE;
}
lid = GetSystemDefaultUILanguage_new();
dword_to_hexstr(lid, buf, TRUE);
pUILangEnumProc(buf, lParam);
return TRUE;
}

View File

@ -0,0 +1,794 @@
/*
* KernelEx
* Copyright (C) 2006-2008, 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.
*
*/
#define _WIN32_WINDOWS 0x0410
#define ENABLE_FILEAPIS
#include "common.h"
#include <tlhelp32.h>
#include "_kernel32_apilist.h"
//MAKE_EXPORT AddAtomW_new=AddAtomW
ATOM WINAPI AddAtomW_new(LPCWSTR strW)
{
ALLOC_WtoA(str);
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)
{
file_GetCP();
file_ALLOC_WtoA(lpExistingFileName);
file_ALLOC_WtoA(lpNewFileName);
return CopyFileExA_new(lpExistingFileNameA, lpNewFileNameA,
lpProgressRoutine, lpData, pbCancel, dwCopyFlags);
}
//MAKE_EXPORT CopyFileW_new=CopyFileW
BOOL WINAPI CopyFileW_new(LPCWSTR lpExistingFileNameW, LPCWSTR lpNewFileNameW, BOOL bFailIfExists)
{
file_GetCP();
file_ALLOC_WtoA(lpExistingFileName);
file_ALLOC_WtoA(lpNewFileName);
return CopyFileA(lpExistingFileNameA, lpNewFileNameA, bFailIfExists);
}
//MAKE_EXPORT CreateDirectoryExW_new=CreateDirectoryExW
BOOL WINAPI CreateDirectoryExW_new(LPCWSTR templatedirW, LPCWSTR newdirW, LPSECURITY_ATTRIBUTES secattr)
{
file_GetCP();
file_ALLOC_WtoA(templatedir);
file_ALLOC_WtoA(newdir);
return CreateDirectoryExA(templatedirA, newdirA, secattr);
}
//MAKE_EXPORT CreateDirectoryW_new=CreateDirectoryW
BOOL WINAPI CreateDirectoryW_new(LPCWSTR PathW, LPSECURITY_ATTRIBUTES SecAttr)
{
file_GetCP();
file_ALLOC_WtoA(Path);
return CreateDirectoryA(PathA, SecAttr);
}
//MAKE_EXPORT CreateFileW_new=CreateFileW
HANDLE WINAPI CreateFileW_new(LPCWSTR strW, DWORD access, DWORD sharemode,
LPSECURITY_ATTRIBUTES secattr, DWORD creatdistr, DWORD flags, HANDLE temp)
{
file_GetCP();
file_ALLOC_WtoA(str);
return CreateFileA_fix(strA, access, sharemode, secattr, creatdistr, flags, temp);
}
//MAKE_EXPORT DefineDosDeviceW_new=DefineDosDeviceW
BOOL WINAPI DefineDosDeviceW_new(DWORD dwFlags, LPCWSTR lpDeviceNameW,
LPCWSTR lpTargetPathW)
{
file_GetCP();
file_ALLOC_WtoA(lpDeviceName);
file_ALLOC_WtoA(lpTargetPath);
return DefineDosDeviceA(dwFlags, lpDeviceNameA, lpTargetPathA);
}
//MAKE_EXPORT DeleteFileW_new=DeleteFileW
BOOL WINAPI DeleteFileW_new(LPCWSTR lpFileNameW)
{
file_GetCP();
file_ALLOC_WtoA(lpFileName);
return DeleteFileA(lpFileNameA);
}
//MAKE_EXPORT FindAtomW_new=FindAtomW
ATOM WINAPI FindAtomW_new(LPCWSTR strW)
{
ALLOC_WtoA(str);
return FindAtomA(strA);
}
//MAKE_EXPORT FindFirstChangeNotificationW_new=FindFirstChangeNotificationW
HANDLE WINAPI FindFirstChangeNotificationW_new(LPCWSTR pathW, BOOL watchsubtree, DWORD filter)
{
file_GetCP();
file_ALLOC_WtoA(path);
return FindFirstChangeNotificationA(pathA, watchsubtree, filter);
}
//MAKE_EXPORT FindFirstFileW_new=FindFirstFileW
HANDLE WINAPI FindFirstFileW_new(LPCWSTR strW, LPWIN32_FIND_DATAW dataW)
{
HANDLE ret;
char cFileNameA[MAX_PATH];
char cAlternateFileNameA[14];
WCHAR* cFileNameW = dataW->cFileName;
WCHAR* cAlternateFileNameW = dataW->cAlternateFileName;
file_GetCP();
file_ALLOC_WtoA(str);
ret = FindFirstFileA(strA, (LPWIN32_FIND_DATAA)dataW);
if (ret != INVALID_HANDLE_VALUE)
{
strcpy(cFileNameA, ((LPWIN32_FIND_DATAA)dataW)->cFileName);
strcpy(cAlternateFileNameA, ((LPWIN32_FIND_DATAA)dataW)->cAlternateFileName);
file_AtoW(cFileName, sizeof(dataW->cFileName) / sizeof(WCHAR));
file_AtoW(cAlternateFileName, sizeof(dataW->cAlternateFileName) / sizeof(WCHAR));
}
return ret;
}
//MAKE_EXPORT FindNextFileW_new=FindNextFileW
BOOL WINAPI FindNextFileW_new(HANDLE handle, LPWIN32_FIND_DATAW dataW)
{
BOOL ret;
char cFileNameA[MAX_PATH];
char cAlternateFileNameA[14];
WCHAR* cFileNameW = dataW->cFileName;
WCHAR* cAlternateFileNameW = dataW->cAlternateFileName;
ret = FindNextFileA(handle, (LPWIN32_FIND_DATAA)dataW);
if (ret)
{
file_GetCP();
strcpy(cFileNameA, ((LPWIN32_FIND_DATAA)dataW)->cFileName);
strcpy(cAlternateFileNameA, ((LPWIN32_FIND_DATAA)dataW)->cAlternateFileName);
file_AtoW(cFileName, sizeof(dataW->cFileName) / sizeof(WCHAR));
file_AtoW(cAlternateFileName, sizeof(dataW->cAlternateFileName) / sizeof(WCHAR));
}
return ret;
}
//MAKE_EXPORT FindResourceExW_new=FindResourceExW
HRSRC WINAPI FindResourceExW_new(HMODULE hModule, LPCWSTR typeW, LPCWSTR nameW, WORD lang)
{
LPSTR nameA, typeA;
if (HIWORD(nameW))
{
_ALLOC_WtoA(name);
}
else
nameA = (LPSTR) nameW;
if (HIWORD(typeW))
{
_ALLOC_WtoA(type);
}
else
typeA = (LPSTR) typeW;
return FindResourceExA(hModule, typeA, nameA, lang);
}
//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));
}
//MAKE_EXPORT FreeEnvironmentStringsW_new=FreeEnvironmentStringsW
BOOL WINAPI FreeEnvironmentStringsW_new(void* env)
{
return HeapFree(GetProcessHeap(), 0, env);
}
//MAKE_EXPORT GetCurrentDirectoryW_new=GetCurrentDirectoryW
DWORD WINAPI GetCurrentDirectoryW_new(DWORD nBufferLength, LPWSTR lpBufferW)
{
DWORD ret;
char lpBufferA[MAX_PATH];
ret = GetCurrentDirectoryA(MAX_PATH, lpBufferA);
if (ret)
{
file_GetCP();
if (ret > MAX_PATH)
{
SetLastError(ERROR_FILENAME_EXCED_RANGE);
return 0;
}
ret = file_AtoW(lpBuffer, 0);
if (ret <= nBufferLength)
{
ret = file_AtoW(lpBuffer, nBufferLength);
if (ret) ret--;
}
}
return ret;
}
//MAKE_EXPORT GetDefaultCommConfigW_new=GetDefaultCommConfigW
BOOL WINAPI GetDefaultCommConfigW_new(LPCWSTR lpszNameW, LPCOMMCONFIG lpCC, LPDWORD lpdwSize)
{
ALLOC_WtoA(lpszName);
return GetDefaultCommConfigA(lpszNameA, lpCC, lpdwSize);
}
//MAKE_EXPORT GetDiskFreeSpaceExW_new=GetDiskFreeSpaceExW
BOOL WINAPI GetDiskFreeSpaceExW_new(LPCWSTR lpDirectoryNameW, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes)
{
file_GetCP();
file_ALLOC_WtoA(lpDirectoryName);
return GetDiskFreeSpaceExA(lpDirectoryNameA, lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes);
}
//MAKE_EXPORT GetDiskFreeSpaceW_new=GetDiskFreeSpaceW
BOOL WINAPI GetDiskFreeSpaceW_new(LPCWSTR lpRootPathNameW, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters)
{
file_GetCP();
file_ALLOC_WtoA(lpRootPathName);
return GetDiskFreeSpaceA(lpRootPathNameA, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters);
}
//MAKE_EXPORT GetEnvironmentStringsW_new=GetEnvironmentStringsW
void* WINAPI GetEnvironmentStringsW_new(void)
{
int len;
WCHAR* envW;
char* envA = GetEnvironmentStringsA();
char* ptrA = (char*) envA;
if (!envA) return envA;
do while (*ptrA++); while (*++ptrA);
len = (int) ptrA - (int) envA;
envW = (WCHAR*) HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (envW)
ABUFtoW(env, len, len);
FreeEnvironmentStringsA(envA);
return envW;
}
//MAKE_EXPORT GetFileAttributesExW_new=GetFileAttributesExW
BOOL WINAPI GetFileAttributesExW_new(LPCWSTR lpFileNameW, GET_FILEEX_INFO_LEVELS fInfoLevelId,
LPVOID lpFileInformation)
{
file_GetCP();
file_ALLOC_WtoA(lpFileName);
return GetFileAttributesExA(lpFileNameA, fInfoLevelId, lpFileInformation);
}
//MAKE_EXPORT GetFileAttributesW_new=GetFileAttributesW
DWORD WINAPI GetFileAttributesW_new(LPCWSTR lpFileNameW)
{
file_GetCP();
file_ALLOC_WtoA(lpFileName);
return GetFileAttributesA(lpFileNameA);
}
//MAKE_EXPORT GetFullPathNameW_new=GetFullPathNameW
DWORD WINAPI GetFullPathNameW_new(LPCWSTR lpFileNameW, DWORD nBufferLength, LPWSTR lpBufferW, LPWSTR *lpFilePartW)
{
DWORD ret;
char lpBufferA[MAX_PATH];
file_GetCP();
file_ALLOC_WtoA(lpFileName);
ret = GetFullPathNameA(lpFileNameA, MAX_PATH, lpBufferA, NULL);
if (ret)
{
if (ret > MAX_PATH)
{
SetLastError(ERROR_FILENAME_EXCED_RANGE);
return 0;
}
ret = file_AtoW(lpBuffer, 0);
if (ret <= nBufferLength)
{
ret = file_AtoW(lpBuffer, nBufferLength);
if (ret && lpFilePartW)
{
if (lpBufferW[ret - 1] == '\\') *lpFilePartW = 0;
else
{
LPWSTR p = lpBufferW + ret - 1;
while ((p > lpBufferW + 2) && (*p != '\\')) p--;
*lpFilePartW = p + 1;
}
}
if (ret) ret--;
}
}
return ret;
}
//MAKE_EXPORT GetLongPathNameW_new=GetLongPathNameW
DWORD WINAPI GetLongPathNameW_new(LPCWSTR lpszShortPathW, LPWSTR lpszLongPathW, DWORD cchBuffer)
{
DWORD ret;
char lpszLongPathA[MAX_PATH];
file_GetCP();
file_ALLOC_WtoA(lpszShortPath);
ret = GetLongPathNameA(lpszShortPathA, lpszLongPathA, MAX_PATH);
if (ret)
{
if (ret > MAX_PATH)
{
SetLastError(ERROR_FILENAME_EXCED_RANGE);
return 0;
}
ret = file_AtoW(lpszLongPath, 0);
if (ret <= cchBuffer)
{
ret = file_AtoW(lpszLongPath, cchBuffer);
if (ret) ret--;
}
}
return ret;
}
//MAKE_EXPORT GetShortPathNameW_new=GetShortPathNameW
DWORD WINAPI GetShortPathNameW_new(LPCWSTR lpszLongPathW, LPWSTR lpszShortPathW, DWORD cchBuffer)
{
DWORD ret;
char lpszShortPathA[MAX_PATH];
file_GetCP();
file_ALLOC_WtoA(lpszLongPath);
ret = GetShortPathNameA(lpszLongPathA, lpszShortPathA, MAX_PATH);
if (ret)
{
if (ret > MAX_PATH)
{
SetLastError(ERROR_FILENAME_EXCED_RANGE);
return 0;
}
ret = file_AtoW(lpszShortPath, 0);
if (ret <= cchBuffer)
{
ret = file_AtoW(lpszShortPath, cchBuffer);
if (ret) ret--;
}
}
return ret;
}
//MAKE_EXPORT GetStartupInfoW_new=GetStartupInfoW
VOID WINAPI GetStartupInfoW_new(LPSTARTUPINFOW lpStartupInfo)
{
// since lpDesktop and lpTitle and lpReserved are
// always zero we can just execute ansi version
GetStartupInfoA((LPSTARTUPINFOA)lpStartupInfo);
}
//MAKE_EXPORT GetSystemDirectoryW_new=GetSystemDirectoryW
UINT WINAPI GetSystemDirectoryW_new(LPWSTR lpBufferW, UINT uSize)
{
UINT ret;
char lpBufferA[MAX_PATH];
ret = GetSystemDirectoryA(lpBufferA, MAX_PATH);
if (ret)
{
if (ret > MAX_PATH)
{
SetLastError(ERROR_FILENAME_EXCED_RANGE);
return 0;
}
file_GetCP();
ret = file_AtoW(lpBuffer, 0);
if (ret <= uSize)
{
ret = file_AtoW(lpBuffer, uSize);
if (ret) ret--;
}
}
return ret;
}
//MAKE_EXPORT GetTempFileNameW_new=GetTempFileNameW
UINT WINAPI GetTempFileNameW_new(LPCWSTR lpPathNameW, LPCWSTR lpPrefixStringW, UINT uUnique, LPWSTR lpTempFileNameW)
{
UINT ret;
char lpTempFileNameA[MAX_PATH];
file_GetCP();
file_ALLOC_WtoA(lpPathName);
file_ALLOC_WtoA(lpPrefixString);
ret = GetTempFileNameA(lpPathNameA, lpPrefixStringA, uUnique, lpTempFileNameA);
if (ret)
{
file_AtoW(lpTempFileName, MAX_PATH);
}
return ret;
}
//MAKE_EXPORT GetTempPathW_new=GetTempPathW
DWORD WINAPI GetTempPathW_new(DWORD nBufferLength, LPWSTR lpBufferW)
{
DWORD ret;
char lpBufferA[MAX_PATH];
ret = GetTempPathA(MAX_PATH, lpBufferA);
if (ret)
{
if (ret > MAX_PATH)
{
SetLastError(ERROR_FILENAME_EXCED_RANGE);
return 0;
}
file_GetCP();
ret = file_AtoW(lpBuffer, 0);
if (ret <= nBufferLength)
{
ret = file_AtoW(lpBuffer, nBufferLength);
if (ret) ret--;
}
}
return ret;
}
//MAKE_EXPORT GetWindowsDirectoryW_new=GetWindowsDirectoryW
UINT WINAPI GetWindowsDirectoryW_new(LPWSTR lpBufferW, UINT uSize)
{
UINT ret;
char lpBufferA[MAX_PATH];
ret = GetWindowsDirectoryA(lpBufferA, MAX_PATH);
if (ret)
{
if (ret > MAX_PATH)
{
SetLastError(ERROR_FILENAME_EXCED_RANGE);
return 0;
}
file_GetCP();
ret = file_AtoW(lpBuffer, 0);
if (ret <= uSize)
{
ret = file_AtoW(lpBuffer, uSize);
if (ret) ret--;
}
}
return ret;
}
//MAKE_EXPORT GlobalAddAtomW_new=GlobalAddAtomW
ATOM WINAPI GlobalAddAtomW_new(LPCWSTR strW)
{
ALLOC_WtoA(str);
return GlobalAddAtomA(strA);
}
//MAKE_EXPORT GlobalFindAtomW_new=GlobalFindAtomW
ATOM WINAPI GlobalFindAtomW_new(LPCWSTR strW)
{
ALLOC_WtoA(str);
return GlobalFindAtomA(strA);
}
//MAKE_EXPORT GlobalGetAtomNameW_new=GlobalGetAtomNameW
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 = ABUFtoW(buffer, ret + 1, size);
if (ret) ret--;
return ret;
}
//MAKE_EXPORT Module32FirstW_new=Module32FirstW
BOOL WINAPI Module32FirstW_new(HANDLE hSnapshot, LPMODULEENTRY32W lpmeW)
{
BOOL ret;
char szModuleA[MAX_MODULE_NAME32 + 1];
char szExePathA[MAX_PATH];
WCHAR* szModuleW = lpmeW->szModule;
WCHAR* szExePathW = lpmeW->szExePath;
if (lpmeW->dwSize < sizeof(MODULEENTRY32W))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
lpmeW->dwSize = sizeof(MODULEENTRY32);
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;
}
//MAKE_EXPORT Module32NextW_new=Module32NextW
BOOL WINAPI Module32NextW_new(HANDLE hSnapshot, LPMODULEENTRY32W lpmeW)
{
BOOL ret;
char szModuleA[MAX_MODULE_NAME32 + 1];
char szExePathA[MAX_PATH];
WCHAR* szModuleW = lpmeW->szModule;
WCHAR* szExePathW = lpmeW->szExePath;
if (lpmeW->dwSize < sizeof(MODULEENTRY32W))
{
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;
}
//MAKE_EXPORT MoveFileExW_new=MoveFileExW
BOOL WINAPI MoveFileExW_new(LPCWSTR existingfileW, LPCWSTR newfileW, DWORD flags)
{
file_GetCP();
file_ALLOC_WtoA(existingfile);
file_ALLOC_WtoA(newfile);
return MoveFileExA_new(existingfileA, newfileA, flags);
}
//MAKE_EXPORT MoveFileW_new=MoveFileW
BOOL WINAPI MoveFileW_new(LPCWSTR existingfileW, LPCWSTR newfileW)
{
file_GetCP();
file_ALLOC_WtoA(existingfile);
file_ALLOC_WtoA(newfile);
return MoveFileA(existingfileA, newfileA);
}
//MAKE_EXPORT MoveFileWithProgressW_new=MoveFileWithProgressW
BOOL WINAPI MoveFileWithProgressW_new(LPCWSTR existingfileW, LPCWSTR newfileW, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags)
{
file_GetCP();
file_ALLOC_WtoA(existingfile);
file_ALLOC_WtoA(newfile);
return MoveFileWithProgressA_new(existingfileA, newfileA, lpProgressRoutine, lpData, dwFlags);
}
//MAKE_EXPORT OutputDebugStringW_new=OutputDebugStringW
void WINAPI OutputDebugStringW_new(LPCWSTR strW)
{
ALLOC_WtoA(str);
OutputDebugStringA(strA);
}
//MAKE_EXPORT Process32FirstW_new=Process32FirstW
BOOL WINAPI Process32FirstW_new(HANDLE hSnapshot, LPPROCESSENTRY32W lppeW)
{
BOOL ret;
char szExeFileA[MAX_PATH];
WCHAR* szExeFileW = lppeW->szExeFile;
if (lppeW->dwSize < sizeof(PROCESSENTRY32W))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
lppeW->dwSize = sizeof(PROCESSENTRY32);
if ((ret = Process32First(hSnapshot, (LPPROCESSENTRY32)lppeW)) != FALSE)
{
strcpy(szExeFileA, ((LPPROCESSENTRY32)lppeW)->szExeFile);
AtoW(szExeFile, sizeof(lppeW->szExeFile) / sizeof(WCHAR));
}
lppeW->dwSize = sizeof(PROCESSENTRY32W);
return ret;
}
//MAKE_EXPORT Process32NextW_new=Process32NextW
BOOL WINAPI Process32NextW_new(HANDLE hSnapshot, LPPROCESSENTRY32W lppeW)
{
BOOL ret;
char szExeFileA[MAX_PATH];
WCHAR* szExeFileW = lppeW->szExeFile;
if (lppeW->dwSize < sizeof(PROCESSENTRY32W))
{
SetLastError(ERROR_INVALID_DATA);
return FALSE;
}
lppeW->dwSize = sizeof(PROCESSENTRY32);
if ((ret = Process32Next(hSnapshot, (LPPROCESSENTRY32)lppeW)) != FALSE)
{
strcpy(szExeFileA, ((LPPROCESSENTRY32)lppeW)->szExeFile);
AtoW(szExeFile, sizeof(lppeW->szExeFile) / sizeof(WCHAR));
}
lppeW->dwSize = sizeof(PROCESSENTRY32W);
return ret;
}
//MAKE_EXPORT RemoveDirectoryW_new=RemoveDirectoryW
BOOL WINAPI RemoveDirectoryW_new(LPCWSTR lpPathNameW)
{
file_GetCP();
file_ALLOC_WtoA(lpPathName);
return RemoveDirectoryA(lpPathNameA);
}
//MAKE_EXPORT SearchPathW_new=SearchPathW
DWORD WINAPI SearchPathW_new(LPCWSTR lpPathW, LPCWSTR lpFileNameW, LPCWSTR lpExtensionW, DWORD nBufferLength, LPWSTR lpBufferW, LPWSTR *lpFilePartW)
{
DWORD ret;
char lpBufferA[MAX_PATH];
file_GetCP();
file_ALLOC_WtoA(lpPath);
file_ALLOC_WtoA(lpFileName);
file_ALLOC_WtoA(lpExtension);
ret = SearchPathA(lpPathA, lpFileNameA, lpExtensionA, MAX_PATH, lpBufferA, NULL);
if (ret)
{
ret = file_AtoW(lpBuffer, 0);
if (ret <= nBufferLength)
{
ret = file_AtoW(lpBuffer, nBufferLength);
if (lpFilePartW)
{
DWORD i;
for (i = ret ; i >= 0 ; i--)
{
if (lpBufferW[i] == '\\')
{
*lpFilePartW = &lpBufferW[i + 1];
break;
}
}
}
}
}
return ret;
}
//MAKE_EXPORT SetConsoleTitleW_new=SetConsoleTitleW
BOOL WINAPI SetConsoleTitleW_new(LPCWSTR strW)
{
ALLOC_WtoA(str);
return SetConsoleTitleA(strA);
}
//MAKE_EXPORT SetCurrentDirectoryW_new=SetCurrentDirectoryW
BOOL WINAPI SetCurrentDirectoryW_new(LPCWSTR lpPathNameW)
{
file_GetCP();
file_ALLOC_WtoA(lpPathName);
return SetCurrentDirectoryA(lpPathNameA);
}
//MAKE_EXPORT SetFileAttributesW_new=SetFileAttributesW
BOOL WINAPI SetFileAttributesW_new(LPCWSTR lpFileNameW, DWORD dwFileAttributes)
{
file_GetCP();
file_ALLOC_WtoA(lpFileName);
return SetFileAttributesA(lpFileNameA, dwFileAttributes);
}
//MAKE_EXPORT VerLanguageNameW_new=VerLanguageNameW
DWORD WINAPI VerLanguageNameW_new(DWORD wLang, LPWSTR szLangW, DWORD nSize)
{
DWORD ret;
DWORD buf_size = VerLanguageNameA(wLang, NULL, 1); //GPF if nSize==0
if (!buf_size) return 0;
buf_size++;
ALLOC_A(szLang, buf_size);
ret = VerLanguageNameA(wLang, szLangA, buf_size);
if (ret)
{
DWORD last_err = GetLastError();
ret = AtoW(szLang, nSize);
if (!ret)
{
szLangW[nSize - 1] = 0;
ret = AtoW(szLang, 0);
}
if (ret) ret--;
SetLastError(last_err);
}
return ret;
}
//MAKE_EXPORT lstrcpynW_new=lstrcpynW
LPWSTR WINAPI lstrcpynW_new(LPWSTR dst, LPCWSTR src, INT n)
{
LPWSTR ret = dst;
if (IsBadReadPtr(src, n) || IsBadWritePtr(dst, n))
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
while ((n > 1) && *src)
{
*dst++ = *src++;
n--;
}
*dst = 0;
return ret;
}

View File

@ -0,0 +1,584 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "auxdecl.h"
/* 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;
} 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
} 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
}
};
static DWORD common_GetVersion(WINDOWS_VERSION version)
{
const OSVERSIONINFOEXA_PRIV* osv = &VersionData[version];
DWORD result;
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;
}
static BOOL common_GetVersionEx(WINDOWS_VERSION version, void* buf, BOOL unicode)
{
const OSVERSIONINFOEXA_PRIV* osv = &VersionData[version];
if (!unicode)
{
OSVERSIONINFOEXA* osa = (OSVERSIONINFOEXA*) buf;
if (osa->dwOSVersionInfoSize != sizeof(OSVERSIONINFOA)
&& osa->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXA))
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
osa->dwMajorVersion = osv->dwMajorVersion;
osa->dwMinorVersion = osv->dwMinorVersion;
osa->dwBuildNumber = osv->dwBuildNumber;
osa->dwPlatformId = osv->dwPlatformId;
strcpy(osa->szCSDVersion, osv->lpszCSDVersion);
if (osa->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXA))
{
osa->wServicePackMajor = osv->wServicePackMajor;
osa->wServicePackMinor = osv->wServicePackMinor;
osa->wSuiteMask = osv->wSuiteMask;
osa->wProductType = osv->wProductType;
osa->wReserved = osv->wReserved;
}
}
else //if (unicode)
{
OSVERSIONINFOEXW* osw = (OSVERSIONINFOEXW*) buf;
if (osw->dwOSVersionInfoSize != sizeof(OSVERSIONINFOW)
&& osw->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXW))
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
osw->dwMajorVersion = osv->dwMajorVersion;
osw->dwMinorVersion = osv->dwMinorVersion;
osw->dwBuildNumber = osv->dwBuildNumber;
osw->dwPlatformId = osv->dwPlatformId;
MultiByteToWideChar(CP_ACP, 0, osv->lpszCSDVersion, -1,
osw->szCSDVersion, sizeof(osw->szCSDVersion) / sizeof(WCHAR));
if (osw->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW))
{
osw->wServicePackMajor = osv->wServicePackMajor;
osw->wServicePackMinor = osv->wServicePackMinor;
osw->wSuiteMask = osv->wSuiteMask;
osw->wProductType = osv->wProductType;
osw->wReserved = osv->wReserved;
}
}
return TRUE;
}
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;
}
static DWORD common_VerifyVersionInfo(WINDOWS_VERSION version,
const OSVERSIONINFOEXA* info, DWORD dwTypeMask, DWORDLONG dwlConditionMask)
{
const OSVERSIONINFOEXA_PRIV* osv = &VersionData[version];
DWORD status;
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_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)
{
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;
}
return ERROR_SUCCESS;
}
static BOOL WINAPI common_VerifyVersionInfoA(WINDOWS_VERSION version,
LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask,
DWORDLONG dwlConditionMask)
{
DWORD ret = common_VerifyVersionInfo(version, lpVersionInfo, dwTypeMask, dwlConditionMask);
if (ret)
{
SetLastError(ret);
return FALSE;
}
return TRUE;
}
static BOOL WINAPI common_VerifyVersionInfoW(WINDOWS_VERSION version,
LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask,
DWORDLONG dwlConditionMask)
{
DWORD ret;
OSVERSIONINFOEXA VersionInfoA;
VersionInfoA.dwMajorVersion = lpVersionInfo->dwMajorVersion;
VersionInfoA.dwMinorVersion = lpVersionInfo->dwMinorVersion;
VersionInfoA.dwBuildNumber = lpVersionInfo->dwBuildNumber;
VersionInfoA.dwPlatformId = lpVersionInfo->dwPlatformId;
VersionInfoA.wServicePackMajor = lpVersionInfo->wServicePackMajor;
VersionInfoA.wServicePackMinor = lpVersionInfo->wServicePackMinor;
VersionInfoA.wSuiteMask = lpVersionInfo->wSuiteMask;
VersionInfoA.wProductType = lpVersionInfo->wProductType;
ret = common_VerifyVersionInfo(version, &VersionInfoA, dwTypeMask, dwlConditionMask);
if (ret)
{
SetLastError(ret);
return FALSE;
}
return TRUE;
}
/* MAKE_EXPORT VerSetConditionMask_new=VerSetConditionMask */
ULONGLONG WINAPI VerSetConditionMask_new(ULONGLONG dwlConditionMask,
DWORD dwTypeBitMask, BYTE dwConditionMask)
{
if (dwTypeBitMask == 0)
return dwlConditionMask;
dwConditionMask &= 0x07;
if (dwConditionMask == 0)
return dwlConditionMask;
if (dwTypeBitMask & VER_PRODUCT_TYPE)
dwlConditionMask |= dwConditionMask << 7*3;
else if (dwTypeBitMask & VER_SUITENAME)
dwlConditionMask |= dwConditionMask << 6*3;
else if (dwTypeBitMask & VER_SERVICEPACKMAJOR)
dwlConditionMask |= dwConditionMask << 5*3;
else if (dwTypeBitMask & VER_SERVICEPACKMINOR)
dwlConditionMask |= dwConditionMask << 4*3;
else if (dwTypeBitMask & VER_PLATFORMID)
dwlConditionMask |= dwConditionMask << 3*3;
else if (dwTypeBitMask & VER_BUILDNUMBER)
dwlConditionMask |= dwConditionMask << 2*3;
else if (dwTypeBitMask & VER_MAJORVERSION)
dwlConditionMask |= dwConditionMask << 1*3;
else if (dwTypeBitMask & VER_MINORVERSION)
dwlConditionMask |= dwConditionMask << 0*3;
return dwlConditionMask;
}
/* MAKE_EXPORT GetVersion_WIN95=GetVersion */
DWORD WINAPI GetVersion_WIN95(void)
{
return common_GetVersion(WIN95);
}
/* MAKE_EXPORT GetVersion_WIN98=GetVersion */
DWORD WINAPI GetVersion_WIN98(void)
{
return common_GetVersion(WIN98);
}
/* MAKE_EXPORT GetVersion_WINME=GetVersion */
DWORD WINAPI GetVersion_WINME(void)
{
return common_GetVersion(WINME);
}
/* MAKE_EXPORT GetVersion_NT40=GetVersion */
DWORD WINAPI GetVersion_NT40(void)
{
return common_GetVersion(NT40);
}
/* MAKE_EXPORT GetVersion_NT2K=GetVersion */
DWORD WINAPI GetVersion_NT2K(void)
{
return common_GetVersion(NT2K);
}
/* MAKE_EXPORT GetVersion_WINXP=GetVersion */
DWORD WINAPI GetVersion_WINXP(void)
{
return common_GetVersion(WINXP);
}
/* MAKE_EXPORT GetVersion_WIN2K3=GetVersion */
DWORD WINAPI GetVersion_WIN2K3(void)
{
return common_GetVersion(WIN2K3);
}
/* MAKE_EXPORT GetVersion_VISTA=GetVersion */
DWORD WINAPI GetVersion_VISTA(void)
{
return common_GetVersion(VISTA);
}
/* MAKE_EXPORT GetVersion_WIN2K8=GetVersion */
DWORD WINAPI GetVersion_WIN2K8(void)
{
return common_GetVersion(WIN2K8);
}
/* MAKE_EXPORT GetVersionExA_WIN95=GetVersionExA */
BOOL WINAPI GetVersionExA_WIN95(LPOSVERSIONINFOA lpVersionInfo)
{
return common_GetVersionEx(WIN95, lpVersionInfo, FALSE);
}
/* MAKE_EXPORT GetVersionExW_WIN95=GetVersionExW */
BOOL WINAPI GetVersionExW_WIN95(LPOSVERSIONINFOW lpVersionInfo)
{
return common_GetVersionEx(WIN95, lpVersionInfo, TRUE);
}
/* MAKE_EXPORT GetVersionExA_WIN98=GetVersionExA */
BOOL WINAPI GetVersionExA_WIN98(LPOSVERSIONINFOA lpVersionInfo)
{
return common_GetVersionEx(WIN98, lpVersionInfo, FALSE);
}
/* MAKE_EXPORT GetVersionExW_WIN98=GetVersionExW */
BOOL WINAPI GetVersionExW_WIN98(LPOSVERSIONINFOW lpVersionInfo)
{
return common_GetVersionEx(WIN98, lpVersionInfo, TRUE);
}
/* MAKE_EXPORT GetVersionExA_WINME=GetVersionExA */
BOOL WINAPI GetVersionExA_WINME(LPOSVERSIONINFOA lpVersionInfo)
{
return common_GetVersionEx(WINME, lpVersionInfo, FALSE);
}
/* MAKE_EXPORT GetVersionExW_WINME=GetVersionExW */
BOOL WINAPI GetVersionExW_WINME(LPOSVERSIONINFOW lpVersionInfo)
{
return common_GetVersionEx(WINME, lpVersionInfo, TRUE);
}
/* MAKE_EXPORT GetVersionExA_NT40=GetVersionExA */
BOOL WINAPI GetVersionExA_NT40(LPOSVERSIONINFOA lpVersionInfo)
{
return common_GetVersionEx(NT40, lpVersionInfo, FALSE);
}
/* MAKE_EXPORT GetVersionExW_NT40=GetVersionExW */
BOOL WINAPI GetVersionExW_NT40(LPOSVERSIONINFOW lpVersionInfo)
{
return common_GetVersionEx(NT40, lpVersionInfo, TRUE);
}
/* MAKE_EXPORT GetVersionExA_NT2K=GetVersionExA */
BOOL WINAPI GetVersionExA_NT2K(LPOSVERSIONINFOA lpVersionInfo)
{
return common_GetVersionEx(NT2K, lpVersionInfo, FALSE);
}
/* MAKE_EXPORT GetVersionExW_NT2K=GetVersionExW */
BOOL WINAPI GetVersionExW_NT2K(LPOSVERSIONINFOW lpVersionInfo)
{
return common_GetVersionEx(NT2K, lpVersionInfo, TRUE);
}
/* MAKE_EXPORT GetVersionExA_WINXP=GetVersionExA */
BOOL WINAPI GetVersionExA_WINXP(LPOSVERSIONINFOA lpVersionInfo)
{
return common_GetVersionEx(WINXP, lpVersionInfo, FALSE);
}
/* MAKE_EXPORT GetVersionExW_WINXP=GetVersionExW */
BOOL WINAPI GetVersionExW_WINXP(LPOSVERSIONINFOW lpVersionInfo)
{
return common_GetVersionEx(WINXP, lpVersionInfo, TRUE);
}
/* MAKE_EXPORT GetVersionExA_WIN2K3=GetVersionExA */
BOOL WINAPI GetVersionExA_WIN2K3(LPOSVERSIONINFOA lpVersionInfo)
{
return common_GetVersionEx(WIN2K3, lpVersionInfo, FALSE);
}
/* MAKE_EXPORT GetVersionExW_WIN2K3=GetVersionExW */
BOOL WINAPI GetVersionExW_WIN2K3(LPOSVERSIONINFOW lpVersionInfo)
{
return common_GetVersionEx(WIN2K3, lpVersionInfo, TRUE);
}
/* MAKE_EXPORT GetVersionExA_VISTA=GetVersionExA */
BOOL WINAPI GetVersionExA_VISTA(LPOSVERSIONINFOA lpVersionInfo)
{
return common_GetVersionEx(VISTA, lpVersionInfo, FALSE);
}
/* MAKE_EXPORT GetVersionExW_VISTA=GetVersionExW */
BOOL WINAPI GetVersionExW_VISTA(LPOSVERSIONINFOW lpVersionInfo)
{
return common_GetVersionEx(VISTA, lpVersionInfo, TRUE);
}
/* MAKE_EXPORT GetVersionExA_WIN2K8=GetVersionExA */
BOOL WINAPI GetVersionExA_WIN2K8(LPOSVERSIONINFOA lpVersionInfo)
{
return common_GetVersionEx(WIN2K8, lpVersionInfo, FALSE);
}
/* MAKE_EXPORT GetVersionExW_WIN2K8=GetVersionExW */
BOOL WINAPI GetVersionExW_WIN2K8(LPOSVERSIONINFOW lpVersionInfo)
{
return common_GetVersionEx(WIN2K8, lpVersionInfo, TRUE);
}
/* MAKE_EXPORT VerifyVersionInfoA_NT2K=VerifyVersionInfoA */
BOOL WINAPI VerifyVersionInfoA_NT2K(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask,
DWORDLONG dwlConditionMask)
{
return common_VerifyVersionInfoA(NT2K, lpVersionInfo, dwTypeMask, dwlConditionMask);
}
/* MAKE_EXPORT VerifyVersionInfoW_NT2K=VerifyVersionInfoW */
BOOL WINAPI VerifyVersionInfoW_NT2K(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask,
DWORDLONG dwlConditionMask)
{
return common_VerifyVersionInfoW(NT2K, lpVersionInfo, dwTypeMask, dwlConditionMask);
}
/* MAKE_EXPORT VerifyVersionInfoA_WINXP=VerifyVersionInfoA */
BOOL WINAPI VerifyVersionInfoA_WINXP(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask,
DWORDLONG dwlConditionMask)
{
return common_VerifyVersionInfoA(WINXP, lpVersionInfo, dwTypeMask, dwlConditionMask);
}
/* MAKE_EXPORT VerifyVersionInfoW_WINXP=VerifyVersionInfoW */
BOOL WINAPI VerifyVersionInfoW_WINXP(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask,
DWORDLONG dwlConditionMask)
{
return common_VerifyVersionInfoW(WINXP, lpVersionInfo, dwTypeMask, dwlConditionMask);
}
/* MAKE_EXPORT VerifyVersionInfoA_WIN2K3=VerifyVersionInfoA */
BOOL WINAPI VerifyVersionInfoA_WIN2K3(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask,
DWORDLONG dwlConditionMask)
{
return common_VerifyVersionInfoA(WIN2K3, lpVersionInfo, dwTypeMask, dwlConditionMask);
}
/* MAKE_EXPORT VerifyVersionInfoW_WIN2K3=VerifyVersionInfoW */
BOOL WINAPI VerifyVersionInfoW_WIN2K3(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask,
DWORDLONG dwlConditionMask)
{
return common_VerifyVersionInfoW(WIN2K3, lpVersionInfo, dwTypeMask, dwlConditionMask);
}
/* MAKE_EXPORT VerifyVersionInfoA_VISTA=VerifyVersionInfoA */
BOOL WINAPI VerifyVersionInfoA_VISTA(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask,
DWORDLONG dwlConditionMask)
{
return common_VerifyVersionInfoA(VISTA, lpVersionInfo, dwTypeMask, dwlConditionMask);
}
/* MAKE_EXPORT VerifyVersionInfoW_VISTA=VerifyVersionInfoW */
BOOL WINAPI VerifyVersionInfoW_VISTA(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask,
DWORDLONG dwlConditionMask)
{
return common_VerifyVersionInfoW(VISTA, lpVersionInfo, dwTypeMask, dwlConditionMask);
}
/* MAKE_EXPORT VerifyVersionInfoA_WIN2K8=VerifyVersionInfoA */
BOOL WINAPI VerifyVersionInfoA_WIN2K8(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask,
DWORDLONG dwlConditionMask)
{
return common_VerifyVersionInfoA(WIN2K8, lpVersionInfo, dwTypeMask, dwlConditionMask);
}
/* MAKE_EXPORT VerifyVersionInfoW_WIN2K8=VerifyVersionInfoW */
BOOL WINAPI VerifyVersionInfoW_WIN2K8(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask,
DWORDLONG dwlConditionMask)
{
return common_VerifyVersionInfoW(WIN2K8, lpVersionInfo, dwTypeMask, dwlConditionMask);
}

View File

@ -0,0 +1,50 @@
/*
* KernelEx
* Copyright (C) 2008, Xeno86
* Copyright (C) 2008, 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>
__declspec(naked)
/* MAKE_EXPORT CallWindowProcA_fix=CallWindowProcA */
LRESULT WINAPI CallWindowProcA_fix(WNDPROC lpPrevWndFunc, HWND hWnd,
UINT Msg, WPARAM wParam, LPARAM lParam)
{
static const char unicows_str[] = "unicows.dll";
static const char callwindowproca_str[] = "CallWindowProcA";
/* We shouldn't write it in C because some weird programs depend
* on CallWindowProc calling function directly!
*/
__asm {
mov eax, [esp+4] ;lpPrevWndFunc
and eax, 0x7FFFFFF0
cmp eax, 0x7FFFFFF0
je UNI
jmp dword ptr [CallWindowProcA]
UNI:
push offset unicows_str
call dword ptr [GetModuleHandleA]
push offset callwindowproca_str
push eax
call dword ptr [GetProcAddress]
jmp eax
}
}

View File

@ -0,0 +1,25 @@
/*
* KernelEx
* Copyright (C) 2008, 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.
*
*/
/* MAKE_EXPORT DisableProcessWindowsGhosting_new=DisableProcessWindowsGhosting */
void __stdcall DisableProcessWindowsGhosting_new(void)
{
}

View File

@ -0,0 +1,36 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
/*
* Win9x seems to look at only the low 16 bits of bEnable.
* This causes a problem, for example, if the caller passes
* a count of items with the intent to enable a window when
* the count is >0. That will fail when the count is
* a multiple of 64K
*/
/* MAKE_EXPORT EnableWindow_new=EnableWindow */
BOOL WINAPI EnableWindow_new(HWND hWnd, BOOL bEnable)
{
return EnableWindow(hWnd, bEnable ? TRUE : FALSE);
}

View File

@ -0,0 +1,34 @@
/*
* KernelEx
* Copyright (C) 2009, 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>
/* MAKE_EXPORT AllowSetForegroundWindow_98=AllowSetForegroundWindow */
BOOL WINAPI AllowSetForegroundWindow_98(DWORD procid)
{
return TRUE;
}
/* MAKE_EXPORT LockSetForegroundWindow_98=LockSetForegroundWindow */
BOOL WINAPI LockSetForegroundWindow_98(UINT lockcode)
{
return TRUE;
}

View File

@ -0,0 +1,35 @@
/*
* KernelEx
* Copyright (C) 2008, Xeno86
* Copyright (C) 1998-2001 Avery Lee
*
* 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 "auxdecl.h"
//MAKE_EXPORT GetAncestor_fix=GetAncestor
HWND APIENTRY GetAncestor_fix(HWND hwnd, UINT gaFlags)
{
// Believe it or not, HWND_MESSAGE works under Windows 98 -- and if you call GetAncestor()
// on such a window, user32 crashes in 16-bit code. :(
if (gaFlags == GA_ROOT && GetParent(hwnd) == NULL)
return hwnd;
return GetAncestor(hwnd, gaFlags);
}

View File

@ -0,0 +1,31 @@
/*
* KernelEx
* Copyright (C) 2009, 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 "common.h"
#include "_user32_apilist.h"
GetMouseMovePoints_t GetMouseMovePoints_pfn;
/* MAKE_EXPORT GetMouseMovePointsEx_98=GetMouseMovePointsEx */
int WINAPI GetMouseMovePointsEx_98(UINT size, LPMOUSEMOVEPOINT ptin, LPMOUSEMOVEPOINT ptout, int count, DWORD res)
{
return GetMouseMovePoints_pfn(size, ptin, ptout, count, res);
}

View File

@ -0,0 +1,29 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
#include "_user32_apilist.h"
/* MAKE_EXPORT IsHungAppWindow_new=IsHungAppWindow */
BOOL WINAPI IsHungAppWindow_new(HWND hWnd)
{
return IsHungThread_pfn(GetWindowThreadProcessId(hWnd, NULL));
}

View File

@ -0,0 +1,28 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
/* MAKE_EXPORT LockWorkStation_new=LockWorkStation */
BOOL WINAPI LockWorkStation_new(void)
{
//FIXME: rundll32 likes to call it and crashes because stack would be incorrect
return WinExec("conlock.mod -uSeR",SW_SHOWDEFAULT) > 31 ? TRUE : FALSE;
}

View File

@ -0,0 +1,49 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
/* MapVirtualKey translation types */
#define MAPVK_VK_TO_VSC 0
#define MAPVK_VSC_TO_VK 1
#define MAPVK_VK_TO_CHAR 2
#define MAPVK_VSC_TO_VK_EX 3
#define MAPVK_VK_TO_VSC_EX 4
/* 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);
}
/* 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);
}

View File

@ -0,0 +1,85 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
/* MAKE_EXPORT SendMessageA_fix=SendMessageA */
__declspec(naked)
LRESULT WINAPI SendMessageA_fix(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
__asm {
mov eax, [esp+8] ;Msg
cmp eax, 402 ;LB_SETTABSTOPS
jz fix_settabstops
cmp eax, 203 ;EM_SETTABSTOPS
jz fix_settabstops
orig_func:
jmp dword ptr [SendMessageA]
fix_settabstops:
mov eax, [esp+12] ;wParam
cmp eax, 0
jbe orig_func ;sanity check: wParam > 0 ?
shl eax, 2 ;wParam * sizeof(DWORD)
push eax ;HeapAlloc.dwBytes
push eax ;cb
push dword ptr [esp+16+8]
call dword ptr [IsBadReadPtr] ;sanity check: ok to read ?
test eax, eax
jz L2
add esp, 4 ;can't read => return failure
xor eax, eax
ret 16
L2:
push 0
call dword ptr [GetProcessHeap]
push eax
call dword ptr [HeapAlloc]
test eax, eax
jnz L3 ;alloc successful?
ret 16
L3:
mov ecx, [esp+12]
push esi
push edi
mov esi, [esp+16+8]
mov edi, eax
cld
rep movsd
pop edi
pop esi
push ebx
mov ebx, eax ;alloc'd mem ptr
push eax
push dword ptr [esp+12+8]
push dword ptr [esp+8+12]
push dword ptr [esp+4+16]
call dword ptr [SendMessageA]
push eax ;remember result
push ebx
push 0
call dword ptr [GetProcessHeap]
push eax
call dword ptr [HeapFree]
pop eax ;remembered result
pop ebx
ret 16
}
}

View File

@ -0,0 +1,134 @@
/*
* KernelEx
*
* Copyright 1993 Alexandre Julliard
* 1997 Alex Korobka
* Copyright 2002,2003 Shachar Shemesh
* Copyright 2003 CodeWeavers Inc. (Ulrich Czekalla)
*
* Copyright (C) 2008, 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>
static const char c_szUnicows[]="unicows.dll";
static const char c_szUnicowsProp[]="GodotMemoryBlock";
static int WINAPI GetCPFromLocale(LCID Locale)
{
int cp;
Locale = Locale & 0xFFFF; //we can assume that HKL == LCID in 9x... i hope :)
if (GetLocaleInfoA(Locale,LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,(LPSTR)&cp,sizeof(int)))
return cp;
else
return CP_ACP;
}
/* MAKE_EXPORT ToUnicodeEx_new=ToUnicodeEx */
int WINAPI ToUnicodeEx_new(
UINT wVirtKey,
UINT wScanCode,
const PBYTE lpKeyState,
LPWSTR pwszBuff,
int cchBuff,
UINT wFlags,
HKL dwhkl
)
{
int result;
WORD asciibuf[4];
char ansibuf[4];
if (!lpKeyState || !pwszBuff)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
result = ToAsciiEx(wVirtKey,wScanCode,lpKeyState,asciibuf,wFlags,dwhkl);
if (result && cchBuff)
{
int i;
for (i = 0; i < result; i++) ansibuf[i]=(char)asciibuf[i];
MultiByteToWideChar(GetCPFromLocale((LCID)dwhkl),0,ansibuf,result,pwszBuff,cchBuff);
}
return result;
}
/* MAKE_EXPORT ToUnicode_new=ToUnicode */
int WINAPI ToUnicode_new(
UINT wVirtKey,
UINT wScanCode,
const PBYTE lpKeyState,
LPWSTR pwszBuff,
int cchBuff,
UINT wFlags
)
{
return ToUnicodeEx_new(wVirtKey,wScanCode,lpKeyState,pwszBuff,cchBuff,wFlags,GetKeyboardLayout(GetCurrentThreadId()));
}
/* MAKE_EXPORT GetLastInputInfo_new=GetLastInputInfo */
BOOL WINAPI GetLastInputInfo_new(
PLASTINPUTINFO plii // last input event
)
{
if ( !plii ) return FALSE;
plii->dwTime = GetTickCount() - 123;
return TRUE;
}
/* MAKE_EXPORT GetMessageW_new=GetMessageW */
BOOL WINAPI GetMessageW_new(
LPMSG lpMsg, // message information
HWND hWnd, // handle to window
UINT wMsgFilterMin, // first message
UINT wMsgFilterMax // last message
)
{
BOOL result;
/* HACKHACK ALERT: don't bother calling MSLU. We know how it works already. Win speed instead! */
result = GetMessageA(lpMsg,hWnd,wMsgFilterMin,wMsgFilterMax);
if (lpMsg && lpMsg->message == WM_CHAR && lpMsg->wParam > 0x7Fu && lpMsg->wParam <= 0xFFu && IsWindow(lpMsg->hwnd) && GetPropA(lpMsg->hwnd,c_szUnicowsProp))
{
WORD unichar;
char ansichar = lpMsg->wParam;
MultiByteToWideChar(GetCPFromLocale((LCID)GetKeyboardLayout(GetCurrentThreadId())),0,&ansichar,1,&unichar,1);
lpMsg->wParam = unichar;
}
return result;
}
/* This fix is mainly for Winamp. Proper fix would be to hook SetWindowLongA too, but it's too hard and still,
MSLU would fail to deliver right ANSI functions. Forget it!
*/
/* MAKE_EXPORT GetWindowLongA_new=GetWindowLongA */
LONG WINAPI GetWindowLongA_new(HWND hWnd, int nIndex)
{
LONG ret = GetWindowLongA( hWnd, nIndex );
if ( nIndex == GWL_WNDPROC && ret & 0x80000000 && GetPropA(hWnd, c_szUnicowsProp) )
{
typedef HRESULT (WINAPI *GWLU) (HWND hWnd, int nIndex);
GWLU GetWindowLongAU = (GWLU)GetProcAddress( GetModuleHandleA(c_szUnicows), "GetWindowLongA" );
if ( GetWindowLongAU )
{
LONG retU = GetWindowLongAU( hWnd, nIndex );
if ( retU ) return retU;
}
}
return ret;
}

View File

@ -0,0 +1,45 @@
/*
* KernelEx
* Copyright (C) 2008, 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>
/* 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
)
{
//pretty dumb stub for Firefox
if ( hdcSrc && psize && pptSrc )
{
HDC hdc = GetDC( hwnd );
BitBlt( hdc, 0, 0, psize->cx, psize->cy, hdcSrc, pptSrc->x, pptSrc->y, SRCCOPY );
ReleaseDC( hwnd, hdc );
}
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}

View File

@ -0,0 +1,97 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
#include "kexcoresdk.h"
#include "_user32_apilist.h"
IsHungThread_t IsHungThread_pfn;
DrawCaptionTempA_t DrawCaptionTempA_pfn;
BOOL init_user32()
{
HMODULE hUser32 = GetModuleHandle("USER32.DLL");
IsHungThread_pfn = (IsHungThread_t)GetProcAddress(hUser32, "IsHungThread");
DrawCaptionTempA_pfn = (DrawCaptionTempA_t)GetProcAddress(hUser32, "DrawCaptionTempA");
GetMouseMovePoints_pfn = (GetMouseMovePoints_t)GetProcAddress(hUser32, "GetMouseMovePoints");
return IsHungThread_pfn && DrawCaptionTempA_pfn && GetMouseMovePoints_pfn;
}
/*
* MAKE_EXPORT RealGetWindowClass=RealGetWindowClassA
* MAKE_EXPORT GetAltTabInfo=GetAltTabInfoA
* MAKE_EXPORT PeekMessageA=PeekMessageW
* MAKE_EXPORT DispatchMessageA=DispatchMessageW
* MAKE_EXPORT IsDialogMessageA=IsDialogMessageW
* MAKE_EXPORT TranslateAcceleratorA=TranslateAcceleratorW
* MAKE_EXPORT CopyAcceleratorTableA=CopyAcceleratorTableW
* MAKE_EXPORT CreateAcceleratorTableA=CreateAcceleratorTableW
* MAKE_EXPORT CallMsgFilterA=CallMsgFilterW
*/
static const apilib_named_api user32_named_apis[] =
{
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("AllowSetForegroundWindow", AllowSetForegroundWindow_98),
DECL_API("CallMsgFilterW", CallMsgFilterA),
DECL_API("CallWindowProcA", CallWindowProcA_fix),
DECL_API("CopyAcceleratorTableW", CopyAcceleratorTableA),
DECL_API("CreateAcceleratorTableW", CreateAcceleratorTableA),
DECL_API("DisableProcessWindowsGhosting", DisableProcessWindowsGhosting_new),
DECL_API("DispatchMessageW", DispatchMessageA),
DECL_API("DrawCaptionTempW", DrawCaptionTempW_new),
DECL_API("EnableWindow", EnableWindow_new),
DECL_API("GetAltTabInfoA", GetAltTabInfo),
DECL_API("GetAncestor", GetAncestor_fix),
DECL_API("GetLastInputInfo", GetLastInputInfo_new),
DECL_API("GetMessageW", GetMessageW_new),
DECL_API("GetMouseMovePointsEx", GetMouseMovePointsEx_98),
DECL_API("GetWindowLongA", GetWindowLongA_new),
DECL_API("IsDialogMessageW", IsDialogMessageA),
DECL_API("IsHungAppWindow", IsHungAppWindow_new),
DECL_API("LoadStringW", LoadStringW_new),
DECL_API("LockSetForegroundWindow", LockSetForegroundWindow_98),
DECL_API("LockWorkStation", LockWorkStation_new),
DECL_API("MapVirtualKeyA", MapVirtualKeyA_new),
DECL_API("MapVirtualKeyExA", MapVirtualKeyExA_new),
DECL_API("PeekMessageW", PeekMessageA),
DECL_API("RealGetWindowClassA", RealGetWindowClass),
DECL_API("RealGetWindowClassW", RealGetWindowClassW_new),
DECL_API("SendMessageA", SendMessageA_fix),
DECL_API("SetLayeredWindowAttributes", SetLayeredWindowAttributes_stub),
DECL_API("ToUnicode", ToUnicode_new),
DECL_API("ToUnicodeEx", ToUnicodeEx_new),
DECL_API("TranslateAcceleratorW", TranslateAcceleratorA),
DECL_API("UpdateLayeredWindow", UpdateLayeredWindow_new),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};
#if 0
static const apilib_unnamed_api user32_ordinal_apis[] =
{
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
};
#endif
const apilib_api_table apitable_user32 = DECL_TAB("USER32.DLL", user32_named_apis, 0 /*user32_ordinal_apis*/);

View File

@ -0,0 +1,63 @@
/*
* KernelEx
* Copyright (C) 2008, 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.
*
*/
#ifndef _USER32_APILIST_H
#define _USER32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
typedef BOOL (WINAPI *IsHungThread_t)(DWORD ThreadID);
extern IsHungThread_t IsHungThread_pfn;
typedef BOOL (WINAPI *DrawCaptionTempA_t)(HWND, HDC, const RECT*, HFONT, HICON, LPCSTR, UINT);
extern DrawCaptionTempA_t DrawCaptionTempA_pfn;
typedef int (WINAPI *GetMouseMovePoints_t)(UINT,LPMOUSEMOVEPOINT,LPMOUSEMOVEPOINT,int,DWORD);
extern GetMouseMovePoints_t GetMouseMovePoints_pfn;
BOOL init_user32();
extern const apilib_api_table apitable_user32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
LRESULT WINAPI CallWindowProcA_fix(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void __stdcall DisableProcessWindowsGhosting_new(void);
BOOL WINAPI EnableWindow_new(HWND hWnd, BOOL bEnable);
BOOL WINAPI AllowSetForegroundWindow_98(DWORD procid);
BOOL WINAPI LockSetForegroundWindow_98(UINT lockcode);
HWND APIENTRY GetAncestor_fix(HWND hwnd, UINT gaFlags);
int WINAPI GetMouseMovePointsEx_98(UINT size, LPMOUSEMOVEPOINT ptin, LPMOUSEMOVEPOINT ptout, int count, DWORD res);
BOOL WINAPI IsHungAppWindow_new(HWND hWnd);
BOOL WINAPI LockWorkStation_new(void);
UINT WINAPI MapVirtualKeyA_new(UINT uCode, UINT uMapType);
UINT WINAPI MapVirtualKeyExA_new(UINT uCode, UINT uMapType, HKL dwhkl);
LRESULT WINAPI SendMessageA_fix(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
int WINAPI ToUnicodeEx_new(UINT wVirtKey, UINT wScanCode, const PBYTE lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags, HKL dwhkl);
int WINAPI ToUnicode_new(UINT wVirtKey, UINT wScanCode, const PBYTE lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags);
BOOL WINAPI GetLastInputInfo_new(PLASTINPUTINFO plii);
BOOL WINAPI GetMessageW_new(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax);
LONG WINAPI GetWindowLongA_new(HWND hWnd, int nIndex);
BOOL WINAPI UpdateLayeredWindow_new(HWND hwnd, HDC hdcDst, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags);
STUB SetLayeredWindowAttributes_stub;
BOOL WINAPI DrawCaptionTempW_new(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon, LPCWSTR strW, UINT uFlags);
int WINAPI LoadStringW_new(HINSTANCE hInstance, UINT uID, LPWSTR lpBuffer, int nBufferMax);
UINT WINAPI RealGetWindowClassW_new(HWND hwnd, LPWSTR pszTypeW, UINT cchType);
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

View File

@ -0,0 +1,24 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
UNIMPL_FUNC(SetLayeredWindowAttributes, 4);

View File

@ -0,0 +1,91 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
#include "_user32_apilist.h"
#include <commctrl.h>
/* 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);
else
{
ALLOC_WtoA(str);
return DrawCaptionTempA_pfn(hwnd, hdc, rect, hFont, hIcon, strA, uFlags);
}
}
/* MAKE_EXPORT LoadStringW_new=LoadStringW */
int WINAPI LoadStringW_new(HINSTANCE hInstance, UINT uID, LPWSTR lpBuffer, int nBufferMax)
{
int len;
LPWSTR wstr;
len = 0;
if (lpBuffer)
{
// find stringtable resource
HRSRC res = FindResourceA(hInstance, MAKEINTRESOURCE((uID >> 4) + 1), RT_STRING);
if (res)
{
// load stringtable resource
HGLOBAL data = LoadResource(hInstance, res);
if (data)
{
// find string in stringtable
uID &= 0xf;
do
{
len = *(WORD*)data;
wstr = (LPWSTR)data + 1;
data = (HGLOBAL)(wstr + len);
}
while (uID--);
// if nBufferMax is zero, then lpBuffer receives pointer to the resource itself
if (!nBufferMax)
{
*(LPWSTR*)lpBuffer = wstr;
return len;
}
if (len > nBufferMax - 1)
{
len = nBufferMax - 1;
}
memcpy(lpBuffer, wstr, len * sizeof(WCHAR));
}
}
lpBuffer[len] = 0;
}
return len;
}
/* MAKE_EXPORT RealGetWindowClassW_new=RealGetWindowClassW */
UINT WINAPI RealGetWindowClassW_new(HWND hwnd, LPWSTR pszTypeW, UINT cchType)
{
UINT ret;
ALLOC_A(pszType, cchType * acp_mcs);
ret = RealGetWindowClass(hwnd, pszTypeA, cchType * acp_mcs);
if (ret)
ret = ABUFtoW(pszType, ret, cchType);
return ret;
}

136
apilibs/kexbases/auxdecl.h Normal file
View File

@ -0,0 +1,136 @@
/* This file contains required declarations missing from MINGW and MSVC6 without PSDK */
#ifndef __AUXDECL_H
#define __AUXDECL_H
#include <windows.h>
/* declarations for MSVC6 without PSDK */
#if defined (_MSC_VER) && (WINVER < 0x0500)
#define VER_MINORVERSION 0x0000001
#define VER_MAJORVERSION 0x0000002
#define VER_BUILDNUMBER 0x0000004
#define VER_PLATFORMID 0x0000008
#define VER_SERVICEPACKMINOR 0x0000010
#define VER_SERVICEPACKMAJOR 0x0000020
#define VER_SUITENAME 0x0000040
#define VER_PRODUCT_TYPE 0x0000080
#define VER_EQUAL 1
#define VER_GREATER 2
#define VER_GREATER_EQUAL 3
#define VER_LESS 4
#define VER_LESS_EQUAL 5
#define VER_AND 6
#define VER_OR 7
#define VER_NT_WORKSTATION 1
#define VER_NT_DOMAIN_CONTROLLER 2
#define VER_NT_SERVER 3
#define VER_SUITE_SMALLBUSINESS 1
#define VER_SUITE_ENTERPRISE 2
#define VER_SUITE_BACKOFFICE 4
#define VER_SUITE_TERMINAL 16
#define VER_SUITE_SMALLBUSINESS_RESTRICTED 32
#define VER_SUITE_EMBEDDEDNT 64
#define VER_SUITE_DATACENTER 128
#define VER_SUITE_SINGLEUSERTS 256
#define VER_SUITE_PERSONAL 512
#define VER_SUITE_BLADE 1024
#define VER_SUITE_STORAGE_SERVER 8192
#define VER_SUITE_COMPUTE_SERVER 16384
#define OSVERSIONINFOEXA __OSVERSIONINFOEXA
#define POSVERSIONINFOEXA __POSVERSIONINFOEXA
#define LPOSVERSIONINFOEXA __LPOSVERSIONINFOEXA
#define OSVERSIONINFOEXW __OSVERSIONINFOEXW
#define POSVERSIONINFOEXW __POSVERSIONINFOEXW
#define LPOSVERSIONINFOEXW __LPOSVERSIONINFOEXW
typedef struct {
DWORD dwOSVersionInfoSize;
DWORD dwMajorVersion;
DWORD dwMinorVersion;
DWORD dwBuildNumber;
DWORD dwPlatformId;
CHAR szCSDVersion[128];
WORD wServicePackMajor;
WORD wServicePackMinor;
WORD wSuiteMask;
BYTE wProductType;
BYTE wReserved;
} __OSVERSIONINFOEXA, *__POSVERSIONINFOEXA, *__LPOSVERSIONINFOEXA;
typedef struct {
DWORD dwOSVersionInfoSize;
DWORD dwMajorVersion;
DWORD dwMinorVersion;
DWORD dwBuildNumber;
DWORD dwPlatformId;
WCHAR szCSDVersion[128];
WORD wServicePackMajor;
WORD wServicePackMinor;
WORD wSuiteMask;
BYTE wProductType;
BYTE wReserved;
} __OSVERSIONINFOEXW, *__POSVERSIONINFOEXW, *__LPOSVERSIONINFOEXW;
typedef long LONG_PTR;
typedef BOOL (CALLBACK *UILANGUAGE_ENUMPROCA)(LPSTR, LONG_PTR);
typedef BOOL (CALLBACK *UILANGUAGE_ENUMPROCW)(LPWSTR, LONG_PTR);
#define MEMORYSTATUSEX __MEMORYSTATUSEX
#define PMEMORYSTATUSEX __PMEMORYSTATUSEX
#define LPMEMORYSTATUSEX __LPMEMORYSTATUSEX
typedef struct
{
DWORD dwLength;
DWORD dwMemoryLoad;
DWORDLONG ullTotalPhys;
DWORDLONG ullAvailPhys;
DWORDLONG ullTotalPageFile;
DWORDLONG ullAvailPageFile;
DWORDLONG ullTotalVirtual;
DWORDLONG ullAvailVirtual;
DWORDLONG ullAvailExtendedVirtual;
} __MEMORYSTATUSEX, *__PMEMORYSTATUSEX, *__LPMEMORYSTATUSEX;
typedef enum {
SHGFP_TYPE_CURRENT = 0,
SHGFP_TYPE_DEFAULT = 1,
} SHGFP_TYPE;
#define GA_ROOT 2
typedef void *LPPRINTDLGEX;
typedef void *LPMOUSEMOVEPOINT;
EXTERN_C int WINAPI GetRandomRgn(HDC hdc, HRGN hrgn, INT iNum);
EXTERN_C HRESULT WINAPI SHGetFolderPathA(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPSTR pszPath);
EXTERN_C HWND WINAPI GetAncestor(HWND hwnd, UINT gaFlags);
EXTERN_C UINT WINAPI RealGetWindowClass(HWND hwnd, LPTSTR pszType, UINT cchType);
#endif /* defined (_MSC_VER) && (WINVER < 0x0500) */
/* declarations for MINGW32 */
#ifdef __MINGW32_VERSION
/* The security descriptor structure */
typedef struct {
BYTE Revision;
BYTE Sbz1;
SECURITY_DESCRIPTOR_CONTROL Control;
DWORD Owner;
DWORD Group;
DWORD Sacl;
DWORD Dacl;
} SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
#endif /* __MINGW32_VERSION */
/* declarations for everyone */
EXTERN_C BOOL WINAPI GetAltTabInfo(HWND,int,PVOID,LPSTR,UINT);
#endif /* __AUXDECL_H */

View File

@ -0,0 +1,31 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "auxdecl.h"
/* MAKE_EXPORT PrintDlgEx_new=PrintDlgExA
* MAKE_EXPORT PrintDlgEx_new=PrintDlgExW
*/
HRESULT WINAPI PrintDlgEx_new(LPPRINTDLGEX lppd)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return E_NOTIMPL;
}

View File

@ -0,0 +1,47 @@
/*
* KernelEx
* Copyright (C) 2008, 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 "common.h"
#include "kexcoresdk.h"
#include "_comdlg32_apilist.h"
BOOL init_comdlg32()
{
return TRUE;
}
static const apilib_named_api comdlg32_named_apis[] =
{
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("PrintDlgExA", PrintDlgEx_new),
DECL_API("PrintDlgExW", PrintDlgEx_new),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};
#if 0
static const apilib_unnamed_api comdlg32_ordinal_apis[] =
{
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
};
#endif
const apilib_api_table apitable_comdlg32 = DECL_TAB("COMDLG32.DLL", comdlg32_named_apis, 0 /*comdlg32_ordinal_apis*/);

View File

@ -0,0 +1,35 @@
/*
* KernelEx
* Copyright (C) 2008, 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.
*
*/
#ifndef _COMDLG32_APILIST_H
#define _COMDLG32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_comdlg32();
extern const apilib_api_table apitable_comdlg32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
HRESULT WINAPI PrintDlgEx_new(LPPRINTDLGEX lppd);
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

Some files were not shown because too many files have changed in this diff Show More